lark-shared
Lark CLI configuration, authentication, and operational guidelines for agent workflows.
- Requires initial setup via
lark-cli config init --new; generate QR codes for all verification URLs usinglark-cli auth qrcodebefore sharing with users - Supports two identity types—user (personal resources via
auth login) and bot (application-level via appId/appSecret)—with distinct permission models; confirm identity matches the operation's intent - Handle permission errors differently by identity: bot requires backend scope setup (provide
console_url), user requiresauth login --scopeor--domainwith explicit scope specification - Use split-flow for agent-initiated auth: execute
--no-wait --jsonto get verification URL and device code, display to user, then execute--device-codein a follow-up step after user confirms completion - High-risk write operations require explicit user confirmation; when CLI exits with code 10 and
confirmation_requirederror, display the action details, obtain user consent, then retry with--yesappended to the original command
lark-cli 共享规则
所有 lark-* skill 共享的底座:身份、认证、输出契约与高风险操作。
通用准则
-
调用前先确认用法:执行前读对应 reference 或跑
--help,别猜 flag 盲调。 -
身份决定你代表谁操作:
--as user代表用户本人(能看到、也能操作其日历、云空间/云盘/云存储等个人资源),--as bot代表应用自己,应用级操作,只能访问bot自己的资源,bot 查用户资源会返回空成功而非报错。动手前先搞清楚身份identity。身份模型和权限管理 →lark-shared-identity-and-permissions.md。 -
授权 / 配置类 URL 必须配二维码:当命令输出
verification_url、verification_uri_complete、console_url等 URL 字段时,必须用lark-cli auth qrcode生成并在回复中展示,URL 在前二维码在后;优先生成 PNG(--output),仅当用户明确要求时才使用 ASCII(--ascii)。URL 原样转发——不编解码、不加标点、不重拼 query,二维码和链接请一起展示给用户。 -
--format json(默认)下,判断成功用ok == true(或进程退出码 0),不要用code == 0:成功信封没有顶层code/msg字段,code只出现在错误信封的error内。按 OpenAPI 老格式{"code": 0, "msg": "ok"}判断会把所有成功调用误判为失败——封装写入类命令时尤其危险。JSON 输出契约 →lark-shared-output-contract.md。
安全规则
- 禁止输出密钥(appSecret、accessToken等)到终端明文。