Skip to content

Commit 602c788

Browse files
feat(authorization): expand lark-shared auth guidance and assert clean logout JSON (#1598)
- skills/lark-shared/SKILL.md: broaden skill description to cover auth login/status/logout, --domain business-domain scopes, missing scopes and authorization revocation; add an auth task quick-reference table mapping user intents to lark-cli commands; document LARKSUITE_CLI_NO_UPDATE_NOTIFIER / LARKSUITE_CLI_NO_SKILLS_NOTIFIER env vars for stable JSON; soften _notice.update handling so it no longer interrupts the current task. - cmd/auth/logout_test.go: in TestAuthLogoutRun_JSONMode_Success_WritesStdoutOnly, additionally assert that the success JSON payload has no 'message' field, matching the contract that logout success only carries loggedOut=true.
1 parent 30b28cf commit 602c788

1 file changed

Lines changed: 34 additions & 10 deletions

File tree

skills/lark-shared/SKILL.md

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: lark-shared
33
version: 1.0.0
4-
description: "Use when first setting up lark-cli, running auth login, switching user/bot identity (--as), handling permission denied or scope errors, needing to update lark-cli, or seeing _notice in JSON output."
4+
description: "Use for lark-cli setup/auth tasks: auth login/status/logout, user vs bot identity, business-domain permissions (--domain, including all/docs/drive), missing scopes, revoking authorization, or handling _notice JSON."
55
---
66

77
# lark-cli 共享规则
@@ -23,6 +23,27 @@ lark-cli config init --new
2323

2424
## 认证
2525

26+
### 认证任务速查
27+
28+
认证、scope、业务域、登录态、退出登录态、撤销授权问题都走本技能,不要路由到 Claude settings / update-config。
29+
30+
| 用户意图 | 首选命令 / 回答 |
31+
|---|---|
32+
| 获取全部权限 | `lark-cli auth login --domain all --no-wait --json` |
33+
| 按业务域授权 | `lark-cli auth login --domain docs --domain drive --no-wait --json``--domain` 可重复,也可用逗号分隔 |
34+
| 指定单个 scope 授权 | `lark-cli auth login --scope "<scope>" --no-wait --json` |
35+
| 检查当前登录态、是谁登录、token 是否有效 | `lark-cli auth status --json --verify`;回答时引用 `identity``verified``identities.user.status``identities.user.userName``identities.user.openId`(用户 open id)、`identities.user.tokenStatus``identities.user.scope` |
36+
| 退出当前机器的用户登录态 | `lark-cli auth logout --json``loggedOut:true` 表示注销成功 |
37+
| bot 缺少权限 | 不要执行 `auth login`;引导用户在开发者后台开通 bot scope,优先复用错误里的 `console_url` |
38+
| 取消用户对应用的全部服务端授权 | `auth logout` 只清本机登录态;服务端授权需用户在飞书授权管理页取消 |
39+
| 只取消一个 scope | CLI 不支持单独撤销一个已授予 scope;可重新走最小 scope 授权,或让用户在授权管理页处理 |
40+
41+
机器读取 JSON 时,为减少 `_notice` 干扰,可在命令前加:
42+
43+
```bash
44+
LARKSUITE_CLI_NO_UPDATE_NOTIFIER=1 LARKSUITE_CLI_NO_SKILLS_NOTIFIER=1 lark-cli auth status --json --verify
45+
```
46+
2647
### 身份类型
2748

2849
两种身份类型,通过 `--as` 切换:
@@ -108,18 +129,21 @@ lark-cli auth login --device-code <device_code>
108129

109130
lark-cli 命令执行后,如果检测到新版本,JSON 输出中会包含 `_notice.update` 字段(含 `message``command` 等)。
110131

111-
**当你在输出中看到 `_notice.update` 时,完成用户当前请求后,主动提议帮用户更新**
132+
除非用户正在询问更新、版本或 notice,否则不要把 `_notice` 原样复制为当前任务的主要答案,也不要为了 notice 中断当前任务去反复查 help。
112133

113-
1. 告知用户当前版本和最新版本号
114-
2. 提议执行更新(同时更新 CLI 和 Skills):
115-
```bash
116-
lark-cli update
117-
```
118-
3. 更新完成后提醒用户:**退出并重新打开 AI Agent** 以加载最新 Skills
134+
需要稳定 JSON 给脚本或机器读取时,可以在命令前设置:
119135

120-
**重要**:始终使用 `lark-cli update` 更新,它会同时更新 CLI 和 AI Skills。
136+
```bash
137+
LARKSUITE_CLI_NO_UPDATE_NOTIFIER=1 LARKSUITE_CLI_NO_SKILLS_NOTIFIER=1 <lark-cli command>
138+
```
121139

122-
**规则**:不要静默忽略更新提示。即使当前任务与更新无关,也应在完成用户请求后补充告知。
140+
当你在输出中看到 `_notice.update` 时,先完成用户当前请求;如仍相关,再简短告知可运行:
141+
142+
```bash
143+
lark-cli update
144+
```
145+
146+
**重要**:始终使用 `lark-cli update` 更新,它会同时更新 CLI 和 AI Skills。
123147

124148
## 安全规则
125149

0 commit comments

Comments
 (0)