lark-router

Installation
SKILL.md

lark-router — Lark Auth Router スキル

3ルール早見表

ルール 条件 判定 代表例
Rule 1 User名義必須操作 user Calendar書き込み / 承認インスタンス / 承認タスク承認
Rule 2 外部テナントDM blocked error 230038 — 外部ユーザーへのDM
Rule 3 その他全て bot IM通知 / Base読み取り / Wiki参照

実行フロー

Step 1: ルーター実行

larc auth router "<task description>"

出力例:

Auth decision: BOT
Rule applied:  Rule 3 — Bot default
Reason:        IM notification does not require user attribution
Minimum scopes: im:message:send_as_bot

Step 2: 判定に基づいて lark-cli を実行

判定 lark-cli フラグ
user lark-cli --as user <command>
bot lark-cli <command>(デフォルトはbot)
blocked 実行しない → ユーザーに報告

Step 3: blocked の場合

外部テナントへのDMはLark API で不可 (error 230038)。
対応策:
  A) 管理コンソールでゲスト招待 → open_id で直接指定
  B) オープンリンク共有 (open_sharing=anyone_readable)
参照: docs/known-issues/lark-external-user-api-gap.md

スコープ認可

# ルーター実行後、スコープが不足している場合
larc auth login --scope "<router output の scopes>"

# または既存プロファイルを使用
larc auth login --profile writer        # 一般書き込み操作
larc auth login --profile backoffice_agent  # 全スコープ

最小スコープセット早見表

操作 スコープ
Bot IM読み取り im:message:readonly
Bot IM送信 im:message:send_as_bot
User IM送信 im:message
Base書き込み bitable:app
Wiki書き込み wiki:node:create
Calendar書き込み calendar:calendar
承認インスタンス作成 approval:instance:write
承認タスク承認/却下 approval:task:write

テストケース(regression)

larc auth router "send IM notification to team"    # → BOT
larc auth router "create calendar event"            # → USER
larc auth router "send DM to external user"         # → BLOCKED
larc auth router "submit expense approval"          # → USER
larc auth router "read wiki page"                   # → BOT

関連

  • 実装: lib/auth.sh_auth_router() (GitHub Issue #32)
  • 設計doc: docs/permission-model.md
  • 既知制約: docs/known-issues/lark-external-user-api-gap.md
  • Meegle Story: #23312641
Related skills

More from shunsukehayashi/lark-harness

Installs
1
GitHub Stars
2
First Seen
8 days ago