@amaster.ai/pi-lark 0.1.2-beta.50 → 0.1.2-beta.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/package.json +2 -2
  2. package/skills/lark-base/SKILL.md +11 -4
  3. package/skills/lark-base/references/lark-base-dashboard-block-get-data.md +17 -1
  4. package/skills/lark-base/references/lark-base-dashboard.md +17 -4
  5. package/skills/lark-base/references/lark-base-field-json.md +2 -0
  6. package/skills/lark-calendar/SKILL.md +1 -1
  7. package/skills/lark-doc/SKILL.md +1 -0
  8. package/skills/lark-doc/references/lark-doc-history.md +13 -14
  9. package/skills/lark-drive/references/lark-drive-apply-permission.md +1 -1
  10. package/skills/lark-drive/references/lark-drive-export.md +3 -0
  11. package/skills/lark-drive/references/lark-drive-task-result.md +3 -0
  12. package/skills/lark-event/SKILL.md +7 -4
  13. package/skills/lark-event/references/lark-event-vc.md +8 -2
  14. package/skills/lark-im/SKILL.md +5 -5
  15. package/skills/lark-im/references/lark-im-chat-list.md +9 -2
  16. package/skills/lark-im/references/lark-im-chat-members-list.md +7 -4
  17. package/skills/lark-im/references/lark-im-chat-messages-list.md +10 -3
  18. package/skills/lark-im/references/lark-im-chat-search.md +9 -2
  19. package/skills/lark-im/references/lark-im-feed-group-list-item.md +2 -2
  20. package/skills/lark-im/references/lark-im-feed-group-list.md +2 -2
  21. package/skills/lark-im/references/lark-im-feed-shortcut-list.md +1 -1
  22. package/skills/lark-im/references/lark-im-flag-list.md +2 -2
  23. package/skills/lark-im/references/lark-im-messages-search.md +3 -2
  24. package/skills/lark-im/references/lark-im-threads-messages-list.md +8 -4
  25. package/skills/lark-mail/references/lark-mail-triage.md +19 -4
  26. package/skills/lark-minutes/SKILL.md +1 -1
  27. package/skills/lark-minutes/references/lark-minutes-search.md +6 -7
  28. package/skills/lark-shared/SKILL.md +3 -3
  29. package/skills/lark-slides/SKILL.md +25 -40
  30. package/skills/lark-slides/references/lark-slides-add-slide.md +92 -0
  31. package/skills/lark-slides/references/lark-slides-create.md +16 -35
  32. package/skills/lark-slides/references/lark-slides-delete-slide.md +65 -0
  33. package/skills/lark-slides/references/lark-slides-edit-workflows.md +5 -3
  34. package/skills/lark-slides/references/lark-slides-media-upload.md +3 -25
  35. package/skills/lark-slides/references/lark-slides-replace-pages.md +6 -4
  36. package/skills/lark-slides/references/lark-slides-replace-slide.md +22 -1
  37. package/skills/lark-slides/references/lark-slides-screenshot.md +31 -13
  38. package/skills/lark-slides/references/lark-slides-xml-presentations-get.md +5 -5
  39. package/skills/lark-slides/references/slides_chart_demo.xml +1 -1
  40. package/skills/lark-slides/references/slides_xml_schema_definition.xml +48 -4
  41. package/skills/lark-slides/references/troubleshooting.md +1 -2
  42. package/skills/lark-slides/references/validation-checklist.md +3 -3
  43. package/skills/lark-slides/references/xml-schema-quick-ref.md +23 -9
  44. package/skills/lark-slides/scripts/sxsd_validator.py +154 -10
  45. package/skills/lark-slides/scripts/xml_text_overlap_lint.py +360 -76
  46. package/skills/lark-slides/scripts/xml_text_overlap_lint_test.py +1138 -214
  47. package/skills/lark-wiki/SKILL.md +5 -3
  48. package/skills/lark-wiki/references/lark-wiki-delete-space.md +6 -3
  49. package/skills/lark-slides/references/lark-slides-xml-presentation-slide-create.md +0 -219
  50. package/skills/lark-slides/references/lark-slides-xml-presentation-slide-delete.md +0 -126
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amaster.ai/pi-lark",
3
- "version": "0.1.2-beta.50",
3
+ "version": "0.1.2-beta.52",
4
4
  "description": "Pi extension for Lark/Feishu workspace — calendar, docs, drive, sheets, tasks, mail and more via lark-cli.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -61,7 +61,7 @@
61
61
  "vitest": "^4.0.0"
62
62
  },
63
63
  "dependencies": {
64
- "@amaster.ai/pi-shared": "0.1.2-beta.50"
64
+ "@amaster.ai/pi-shared": "0.1.2-beta.52"
65
65
  },
66
66
  "scripts": {
67
67
  "fetch-skills": "node scripts/fetch-skills.mjs",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: lark-base
3
- version: 1.2.3
3
+ version: 1.2.4
4
4
  description: "飞书多维表格(Base)操作:建表、字段、记录、视图、统计、公式/lookup、表单、仪表盘、workflow、角色权限;遇到 Base/多维表格/bitable 或 /base/ 链接时使用。文件导入/导出转 lark-drive,认证/授权转 lark-shared。"
5
5
  metadata:
6
6
  requires:
@@ -30,6 +30,7 @@ metadata:
30
30
 
31
31
  - Base 业务操作只使用 `lark-cli base +...` shortcut,不使用旧聚合式 `+table / +field / +record / +view / +history / +workspace`。
32
32
  - 执行 update 前必须先查当前 shortcut 的 `--help` 或对应 reference。若命令要求完整配置,首次请求必须基于可信的当前配置执行 read-modify-write:只修改用户明确指定的内容,保留其他仍适用的可写配置,并按命令要求的结构提交。若命令支持局部/delta update,按其契约提交最小合法 payload;不得以不完整请求试错补参。
33
+ - Base CLI/OpenAPI 当前不支持视图行高、冻结列、列宽等 UI-only 外观设置。遇到这类需求,说明能力边界并停止,不要猜测未文档化参数或改走 raw API。
33
34
  - 本地文件与 Base 之间的导入/导出转 `lark-drive`,具体格式、参数、路径限制和仅结构导出规则由 `lark-drive` 负责;导入完成后再回到 Base 命令。
34
35
  - 在线复制 Base 使用 `+base-copy`,不要绕行导出/导入。
35
36
  - 认证、初始化、scope、身份切换、权限不足恢复属于 `lark-shared`;Base 文档只保留会影响 Base 路径选择的权限规则。
@@ -54,6 +55,7 @@ metadata:
54
55
  | 查看 Base 内资源目录 | `+base-block-list` | 想先了解一个 Base 里有哪些 table/docx/dashboard/workflow/folder 时优先用它;返回 ID 关系和 fewshot 看 `--help` |
55
56
  | 管理 Base 内资源目录 | `+base-block-create/move/rename/delete` | 创建或整理 Base 直接管理的 folder/table/docx/dashboard/workflow;资源内容继续用对应命令 |
56
57
  | 管理数据表 | `+table-list/get/create/update/delete` | 处理 table 的列出、详情、创建、重命名和删除 |
58
+ | 复制 Base 内单张数据表 | `+table-copy` / `+table-copy-status` | 默认只复制结构;只有用户明确要求复制全表、数据、行或记录时才传 `--range all`;异步任务按返回的 `task_id` 查询或续等 |
57
59
  | 列/查/删字段 | `+field-list/get/delete/search-options` | 写入前用 list/get 确认字段类型、选项、ID;删除前确认目标字段 |
58
60
  | 创建/更新字段 | `+field-create` / `+field-update` | 必读 [lark-base-field-json.md](references/lark-base-field-json.md);公式读 [formula-field-guide.md](references/formula-field-guide.md);lookup 读 [lookup-field-guide.md](references/lookup-field-guide.md);命令细节读 [lark-base-field-create.md](references/lark-base-field-create.md) / [lark-base-field-update.md](references/lark-base-field-update.md) |
59
61
  | 读记录明细 | `+record-get` / `+record-list` / `+record-search` | 涉及筛选、排序、Top/Bottom N、聚合、多表关联、全局结论时读 [lark-base-data-analysis-sop.md](references/lark-base-data-analysis-sop.md) |
@@ -68,7 +70,7 @@ metadata:
68
70
  | 表单题目创建/更新 | `+form-questions-create` / `+form-questions-update` | Base 内表单按 table 管理;先确定并复用真实 `table_id`。读 [lark-base-form-questions-create.md](references/lark-base-form-questions-create.md) / [lark-base-form-questions-update.md](references/lark-base-form-questions-update.md);题目显隐条件 `visible_rule` 结构见公共协议 [lark-base-filter-condition.md](references/lark-base-filter-condition.md) |
69
71
  | Base 内表单管理 | `+form-list/get/create/update/delete` / `+form-questions-list/delete` | 缺少或不确定归属时,先用 `+table-list` 或 `+base-block-list` 取得真实 `table_id`;这些命令使用 `--base-token + --table-id` 并在整个工作流中复用同一 `table_id`,删除前确认目标表单 |
70
72
  | 分享表单详情 | `+form-detail --share-token <share_token>` | 只接受表单分享链接里的 `share_token`,不要传 `--base-token` / `--form-id`;提交前读 [lark-base-form-detail.md](references/lark-base-form-detail.md) |
71
- | 仪表盘与组件 | `+dashboard-*` / `+dashboard-block-*` | 提到图表/看板/block 时先读 [lark-base-dashboard.md](references/lark-base-dashboard.md);组件 `data_config` 读 [dashboard-block-data-config.md](references/dashboard-block-data-config.md);读取图表计算结果用 `+dashboard-block-get-data` |
73
+ | 仪表盘与组件 | `+dashboard-*` / `+dashboard-block-*` | 提到图表/看板/block 时先读 [lark-base-dashboard.md](references/lark-base-dashboard.md);组件 `data_config` 读 [dashboard-block-data-config.md](references/dashboard-block-data-config.md);读取一个或多个图表计算结果用 `+dashboard-block-get-data`;读取完整仪表盘时按 block 类型分流,文本和不支持直接取数的图表按 reference 恢复 |
72
74
  | Workflow | `+workflow-*` | 创建/更新或理解 steps 时读入口 [lark-base-workflow-guide.md](references/lark-base-workflow-guide.md) 和 steps JSON SSOT [lark-base-workflow-schema.md](references/lark-base-workflow-schema.md);list/get/enable/disable 只处理 workflow ID 与启停状态 |
73
75
  | 高级权限与角色 | `+advperm-*` / `+role-*` | 角色操作先读入口 [lark-base-role-guide.md](references/lark-base-role-guide.md);角色 create/update 或解读完整配置再读权限 JSON SSOT [role-config.md](references/role-config.md);系统角色不可删除;关闭高级权限会影响自定义角色 |
74
76
 
@@ -79,6 +81,7 @@ metadata:
79
81
  - `base-block` 只负责资源目录管理,包括创建资源、移动到 folder、重命名和删除;具体资源内容仍走 table/dashboard/workflow 命令。
80
82
  - 新建 Base 时,强烈推荐一次性执行 `lark-cli base +base-create --name "<base>" --table-name "<table>" --fields '<field-json-array>'`,同时配置新 Base 里唯一一个初始数据表的 name 和 schema;使用 `--fields` 前先读 [lark-base-field-json.md](references/lark-base-field-json.md) 或复用 `+field-create` 的字段 JSON 形状,不要猜字段属性。
81
83
  - `+base-create` 不传 `--table-name` 和 `--fields` 时,会创建一个默认 schema 的初始数据表。
84
+ - `+table-copy` 的安全默认值是只复制表结构;用户没有明确要求记录时省略 `--range`,明确要求包含记录时才传 `--range all`。`--table-id` 可直接使用当前 Base 中的表 ID 或表名。
82
85
  - 表、字段、视图、workflow、dashboard block 的名称和 ID 必须来自真实返回,不要凭用户口述猜。
83
86
  - 存储字段可写;系统字段、`formula`、`lookup` 只读;附件字段走专用 attachment 命令。
84
87
  - 一次性原始记录查询优先用 `+record-list` / `+record-search` 的 filter/sort;聚合分析优先用 `+data-query`;需要长期显示在表中时,才新增 `formula` / `lookup` 字段。
@@ -89,6 +92,7 @@ metadata:
89
92
  ## 身份与权限降级
90
93
 
91
94
  - 默认显式使用 `--as user` 操作用户资源;只有用户明确要求应用身份时,才直接用 `--as bot`。
95
+ - `+table-copy --wait` 提交成功后会在 stderr 打印完整 `task_id`;若进程被 Ctrl-C 终止,可用该 ID 和原身份执行 `+table-copy-status` 续查,不要重新提交复制。
92
96
  - user 身份报 scope/授权不足,或错误中包含 `missing_scopes` / `hint`,先转 `lark-shared` 做用户授权恢复,不要直接降级 bot。
93
97
  - user 身份报资源级无访问且无授权恢复提示时,才可用 `--as bot` 重试一次;bot 仍失败就停止重试并按权限错误处理。
94
98
  - `91403` 或明确不可访问错误不要循环换身份重试。
@@ -111,7 +115,7 @@ metadata:
111
115
  - 优先用写入返回确认结果;返回信息不足或任务明确要求核验时,再读回。
112
116
  - 写记录前先读字段结构;只写存储字段。系统字段、附件字段、`formula`、`lookup` 不作为普通记录写入目标。
113
117
  - 附件上传、下载、删除走专用 `+record-*-attachment` 命令。
114
- - 写字段前先读 [lark-base-field-json.md](references/lark-base-field-json.md);涉及 `formula` / `lookup` 时必须读 [formula-field-guide.md](references/formula-field-guide.md) / [lookup-field-guide.md](references/lookup-field-guide.md)。
118
+ - 写字段前先读 [lark-base-field-json.md](references/lark-base-field-json.md);请求字段类型不在 reference 已支持类型目录中时,说明当前 CLI 不支持并停止,不要猜测未注册的字段 JSON、service 或 schema,也不要用其他字段类型冒充;涉及 `formula` / `lookup` 时必须读 [formula-field-guide.md](references/formula-field-guide.md) / [lookup-field-guide.md](references/lookup-field-guide.md)。
115
119
  - 表名、字段名、视图名、workflow 配置中的名称必须来自真实返回;跨表场景还要读取目标表结构。
116
120
  - 删除、角色更新、字段更新、表单提交(`+form-submit`)等高风险操作遵循 CLI 的 confirmation gate,必须带 `--yes`;目标不明确时先用 get/list 消歧。
117
121
  - 批量写入单批最多 200 条;连续写同一表时串行执行,遇到 `1254291` 按短暂等待后重试处理。
@@ -130,7 +134,10 @@ metadata:
130
134
 
131
135
  ## Dashboard / Workflow / Role
132
136
 
133
- - Dashboard 的复杂点是 block 的 `data_config`,不是 list/get/create/delete 命令参数。创建或更新 block 前先读 [dashboard-block-data-config.md](references/dashboard-block-data-config.md),组件必须串行创建;`+dashboard-arrange` 是服务端智能布局,仅在用户明确要求重排/美化、或对本次会话从零新建的仪表盘做收尾整理时执行。`+dashboard-block-get-data` 读取图表最终计算结果,不返回 block 名称、类型、布局或 `data_config`;需要元数据先用 `+dashboard-block-get`。
137
+ - Dashboard 的复杂点是 block 的 `data_config`,不是 list/get/create/delete 命令参数。创建或更新 block 前先读 [dashboard-block-data-config.md](references/dashboard-block-data-config.md),组件必须串行创建;`+dashboard-arrange` 是服务端智能布局,仅在用户明确要求重排/美化、或对本次会话从零新建的仪表盘做收尾整理时执行。`+dashboard-block-get-data` 读取图表最终计算结果,不返回 block 名称、类型、布局或 `data_config`;需要元数据先用 `+dashboard-block-get`。用户要求“全部/完整”仪表盘内容时不得跳过 text 或不支持直接取数的 block,按 [lark-base-dashboard.md](references/lark-base-dashboard.md) 的完整读取分支恢复。
138
+ - Dashboard shortcut 不支持指定组件的 `x/y/w/h`、精确位置或尺寸,不能把 `+dashboard-arrange` 静默当作等价实现。用户只要求一般性重排/美化时可执行一次智能重排;用户要求精确结果时先说明限制并询问是否接受自适应布局,接受后才执行。不要探测 raw `lark-cli api`、源码或未公开布局参数。
139
+ - 创建接口成功返回即表示写入成功;只有结果不确定时才额外执行一次 `+dashboard-get` 或 `+dashboard-block-list`。不要仅为确认创建而逐组件调用 `+dashboard-block-get-data`。
140
+ - 用户要读取多个组件的计算结果时,先完整列出组件(`+dashboard-block-list --page-size 100`;若 `has_more=true`,继续把返回的 `page_token` 传给 `--page-token`,直到 `has_more=false`),再按 [lark-base-dashboard-block-get-data.md](references/lark-base-dashboard-block-get-data.md) 在一个 shell 工具调用内串行读取;不要把每个 block 拆成独立模型轮次。
134
141
  - Workflow 的复杂点是 `steps` 结构。创建、更新或解释完整 workflow 时读入口 [lark-base-workflow-guide.md](references/lark-base-workflow-guide.md) 和 steps JSON SSOT [lark-base-workflow-schema.md](references/lark-base-workflow-schema.md);enable/disable/list 只需确认 workflow ID、当前启停状态和用户意图。
135
142
  - Role 的复杂点是权限 JSON。角色操作先读入口 [lark-base-role-guide.md](references/lark-base-role-guide.md);`+role-create` 只支持自定义角色;`+role-update` 是 delta merge;角色 create/update 或解读完整配置时读权限 JSON SSOT [role-config.md](references/role-config.md)。`+role-delete` 只适用于自定义角色,系统角色不可删除;删除角色和关闭高级权限前必须确认目标和影响。
136
143
 
@@ -63,7 +63,8 @@ lark-cli base +dashboard-block-get-data \
63
63
  # 先看仪表盘里有哪些组件
64
64
  lark-cli base +dashboard-block-list \
65
65
  --base-token bascn***************CtadY \
66
- --dashboard-id blkxxxxxxxx
66
+ --dashboard-id blkxxxxxxxx \
67
+ --page-size 100
67
68
 
68
69
  # 再读取某个组件的最终计算结果
69
70
  lark-cli base +dashboard-block-get-data \
@@ -71,6 +72,21 @@ lark-cli base +dashboard-block-get-data \
71
72
  --block-id chtxxxxxxxx
72
73
  ```
73
74
 
75
+ 如果用户要读取多个组件,先通过 `+dashboard-block-list --page-size 100` 取得真实 ID;若返回 `has_more=true`,继续把本页返回的 `page_token` 传给 `--page-token`,直到 `has_more=false`。收齐目标组件并跳过没有计算结果的文本组件后,再在**一个 shell 工具调用**内串行执行。每条命令会依次输出一个完整 JSON envelope;不要把每个 block 拆成独立模型轮次。
76
+
77
+ ```bash
78
+ set -euo pipefail
79
+
80
+ block_ids=(cht_block_1 cht_block_2)
81
+ for block_id in "${block_ids[@]}"; do
82
+ lark-cli base +dashboard-block-get-data \
83
+ --base-token bascn***************CtadY \
84
+ --block-id "$block_id"
85
+ done
86
+ ```
87
+
88
+ 数组中的 ID 必须逐字来自 `+dashboard-block-list` 返回,不要把名称或未经验证的用户文本作为 shell 代码执行。循环仍然是串行 API 调用,只减少模型往返,不裁剪任何组件结果。
89
+
74
90
  如果你需要先确认组件类型、名称或 `data_config`,请先执行:
75
91
 
76
92
  ```bash
@@ -19,7 +19,7 @@ Dashboard 是 Base 中的数据可视化看板,可以把表格数据变成**
19
19
  | 修改组件 | `+dashboard-block-update` | 先读 block 现状,再读 [dashboard-block-data-config.md](dashboard-block-data-config.md) 决定替换哪些顶层 key |
20
20
  | 查看仪表盘有哪些组件 | `+dashboard-get` 或 `+dashboard-block-list` | 本页下方「查看仪表盘」 |
21
21
  | 读取图表计算结果 | `+dashboard-block-get-data` | 返回图表最终数据协议;需要 block 元数据先用 `+dashboard-block-get` |
22
- | 智能重排组件布局 | `+dashboard-arrange` | 用户明确要求重排,或本次会话新建仪表盘的收尾整理;无法指定精确位置 |
22
+ | 智能重排组件布局 | `+dashboard-arrange` | 用户明确要求重排,或本次会话新建仪表盘的收尾整理;无法指定 `x/y/w/h`、精确位置或尺寸 |
23
23
 
24
24
  ## 典型场景工作流
25
25
 
@@ -29,7 +29,7 @@ Dashboard 是 Base 中的数据可视化看板,可以把表格数据变成**
29
29
 
30
30
  - 聚合方式:创建指标卡或分布图时优先把聚合写进 `data_config`,只有 Top N、字段取值探索、复杂筛选校验或 helper 汇总表场景才先用 `+data-query`。
31
31
  - Dry-run 边界:已按模板构造的简单指标卡、分布图、趋势图不需要逐个 `--dry-run` 后再真实创建;只有在调试 JSON、检查请求体、复杂自造 `data_config` 或处理 API validation 错误时才 dry-run。
32
- - 验证方式:通过创建接口返回值确认创建成功与否,只在结果不确定时用 `+dashboard-get` 或 `+dashboard-block-list` 确认仪表盘和组件存在,或调用 `+dashboard-block-get-data`读取计算结果验证。
32
+ - 验证方式:创建接口成功返回即表示写入成功。只有结果不确定时才用一次 `+dashboard-get` 或 `+dashboard-block-list` 确认仪表盘和组件存在;不要仅为确认创建而逐组件调用 `+dashboard-block-get-data`。
33
33
  - 布局方式:`+dashboard-arrange` 仅两种情况使用:① 用户明确要求美化/重排;② 本次会话中从零新建的仪表盘,建完组件后做一次性布局整理。不是创建成功的必要步骤。
34
34
 
35
35
  示例:搭建一个销售数据分析仪表盘
@@ -142,8 +142,10 @@ lark-cli base +dashboard-block-update \
142
142
 
143
143
  > [!CAUTION]
144
144
  > - 排列结果是**服务端智能推荐**,不一定完全符合用户预期
145
- > - 无法指定具体位置(如"第一排放 A,第二排放 B"),排列逻辑是**自适应**的
145
+ > - Dashboard shortcut 无法指定 `x/y/w/h`、精确位置或尺寸(如"第一排放 A""图表撑满整行"),排列逻辑是**自适应**的
146
146
  > - **不建议**在已有仪表盘上自动调用,除非用户明确要求
147
+ > - 用户只要求一般性重排/美化时,可执行一次 `+dashboard-arrange`;用户要求精确结果时,先说明限制并询问是否接受自适应布局,接受后才执行,不能静默替代或声称精确满足
148
+ > - 执行一次 `+dashboard-arrange` 后即停止;不要继续探测 raw `lark-cli api`、源码或未公开布局参数
147
149
 
148
150
  ```bash
149
151
  # 第 1 步:列出仪表盘,定位到目标仪表盘
@@ -163,6 +165,12 @@ lark-cli base +dashboard-arrange \
163
165
  - 想看某个组件的详细 data_config 配置 → 用 **方式 C**
164
166
  - 想看某个图表/指标卡实际算出来的数据 → 用 **方式 D**
165
167
 
168
+ 用户要求读取“全部图表”或“完整仪表盘”时,先用方式 B 分页枚举所有 block:使用 `--page-size 100`;若返回 `has_more=true`,继续把本页返回的 `page_token` 传给 `--page-token`,直到 `has_more=false`。收齐后再对每个 block 收口,不能只返回 get-data 成功的子集:
169
+
170
+ 1. 图表或指标卡:使用方式 D 读取计算结果。
171
+ 2. `text`:使用方式 C,正文位于 `data_config.text`;text 没有计算结果,但属于完整仪表盘内容。
172
+ 3. get-data 返回不支持的图表类型:先用方式 C 读取真实 `data_config`,确认 `table_name`、维度、指标、聚合与筛选,再按 [数据分析 SOP](lark-base-data-analysis-sop.md) 使用 `+data-query` 重建同口径结果。字段必须来自真实配置和表结构,不得猜测;无法等价重建时明确报告限制,不能静默省略该 block。
173
+
166
174
  ```bash
167
175
  # 第 1 步:列出仪表盘,定位到当前仪表盘
168
176
  lark-cli base +dashboard-list --base-token xxx
@@ -173,7 +181,10 @@ lark-cli base +dashboard-list --base-token xxx
173
181
  lark-cli base +dashboard-get --base-token xxx --dashboard-id blk_xxx
174
182
 
175
183
  # 方式 B:列出所有组件
176
- lark-cli base +dashboard-block-list --base-token xxx --dashboard-id blk_xxx
184
+ lark-cli base +dashboard-block-list \
185
+ --base-token xxx \
186
+ --dashboard-id blk_xxx \
187
+ --page-size 100
177
188
 
178
189
  # 方式 C:查看某个组件的详细配置
179
190
  lark-cli base +dashboard-block-get --base-token xxx --dashboard-id blk_xxx --block-id chtxxxxxxxx
@@ -184,6 +195,8 @@ lark-cli base +dashboard-block-get-data --base-token xxx --block-id chtxxxxxxxx
184
195
  # 最后:把获取到的现状信息整理好告诉用户
185
196
  ```
186
197
 
198
+ 需要读取多个组件的计算结果时,先用方式 B 获取真实 `block_id`(使用 `--page-size 100`;若 `has_more=true`,继续把返回的 `page_token` 传给 `--page-token`,直到 `has_more=false`),再按 [lark-base-dashboard-block-get-data.md](lark-base-dashboard-block-get-data.md) 的多组件范式,在一个 shell 工具调用内串行读取;不要把每个 block 拆成独立模型轮次。文本组件没有计算结果,应跳过。
199
+
187
200
  ## 组件类型选择
188
201
 
189
202
  组件 `type` 决定展示形式:
@@ -518,6 +518,8 @@
518
518
 
519
519
  Object(对象字段)、Button(按钮字段)、Stage(流程字段)暂时都没有被 CLI 支持。这些字段会展示为 `not_support` 字段并被保护:不允许修改,不允许读取内容。
520
520
 
521
+ 遇到暂不支持的字段类型时,直接说明 Base CLI 当前不支持并停止;不要猜测未注册的字段 JSON、service 或 schema,也不要用其他字段类型冒充目标能力。
522
+
521
523
  ## 6. 易错点
522
524
 
523
525
  - `select` 只有一个类型;不要写 `single_select` / `multi_select`,用 `multiple` 控制是否多选。
@@ -190,7 +190,7 @@ lark-cli contact +search-user --query <query> --as user
190
190
  lark-cli im +chat-search --query <query> --as user
191
191
  ```
192
192
 
193
- > 搜索用户接口不支持 bot 身份,必须用 `--as user`;搜到的 `ou_` open_id 用于日程参与人操作(如添加日程参与人)。
193
+ > 搜索用户/群不支持 bot 身份,必须用 `--as user`。**解析不到或类型不明确时,向用户澄清该参会人类型,不要靠名字形态硬猜类型。**
194
194
 
195
195
  ## 不在本 skill 范围
196
196
 
@@ -5,6 +5,7 @@ description: "飞书云文档(Docx / Wiki 文档):读取和编辑飞书文
5
5
  metadata:
6
6
  requires:
7
7
  bins: ["lark-cli"]
8
+ skills: ["lark-shared"]
8
9
  cliHelp: "lark-cli docs --help;lark-cli mindnotes --help"
9
10
  ---
10
11
 
@@ -2,24 +2,23 @@
2
2
 
3
3
  用于查看 Docx 历史版本、按 `history_version_id` 回滚,以及查询回滚任务状态。
4
4
 
5
- ## 安全流程
5
+ ## 安全约束
6
6
 
7
- 1. 先用分页接口 `+history-list` 找到目标版本的 `history_version_id`。
8
- 2. 如果用户指定的是 `revision_id`,不要假设它唯一,也不要把 `revision_id` 直接传给 `+history-revert`。先拉一页并在 `entries[]` 中筛选 `revision_id` 相同的候选;如果未匹配到且 `has_more=true`,继续用 `page_token` 翻页;如果已匹配到候选,最多额外再拉一页补齐可能跨页的相邻候选。最终优先根据用户目标时间与 `edit_time` 的接近程度选择最合适的一条,取同一条的 `history_version_id`;如果没有目标时间,或多个候选无法可靠区分,再向用户展示候选版本(`history_version_id`、`revision_id`、`edit_time`、`name/description`)并确认后回滚。
9
- 3. 如果用户指定的是某一时刻但没有指定 `revision_id`,按 `entries[].edit_time` 匹配;优先选择不晚于目标时刻的最近一条历史记录,无法明确匹配时先向用户确认候选版本。
10
- 4. 再用 `+history-revert --history-version-id <history_version_id>` 发起回滚。默认最多等待 30 秒;如果返回 `status: running`,记录 `task_id`。
11
- 5. 用 `+history-revert-status` 轮询 `task_id`,直到状态不再是 `running`。
12
- 6. 回滚完成后,用 `docs +fetch` 读取文档确认内容。
7
+ - `overwrite` 会重建正文和 block ID,且无法保证保留评论等非正文对象。用户要求保留这些对象时,应先说明限制并确认。
8
+ - `overwrite` 返回 warning 或 `partial_success` 时,先核验最新内容。核验失败或发生 revision conflict 时停止,不要再次覆盖。
9
+ - 权限、网络或临时系统错误应保留原错误分类,不得解释为目标版本不存在。
13
10
 
14
11
  ## 按 revision_id 或时间点回滚
15
12
 
16
- 当用户说“回滚到 revision_id=42”“恢复到昨天下午 3 点的版本”这类需求时,流程是:
17
-
18
- 1. 执行 `docs +history-list --doc <doc>` 获取第一页历史记录;`+history-list` 是分页接口,只有 `has_more=true` 且还需要更多候选时才继续传 `--page-token` 翻页。
19
- 2. 如果用户给出 `revision_id`:先筛选当前页中 `entries[].revision_id == 用户给出的 revision_id`。如果未命中且 `has_more=true`,继续拉下一页;如果已经命中候选,最多额外再拉一页,补齐同一个 `revision_id` 可能跨页出现的相邻 `history_version_id`。若用户同时给出目标时间,在候选里选择 `edit_time` 与目标时间最接近的一条;若未给目标时间但候选只有一条,可直接使用;若多个候选无法可靠区分,不要自行取第一条,向用户展示候选并确认。
20
- 3. 如果用户只给出时间:用 `entries[].edit_time` 匹配,选择目标时刻之前最近的一条;如果用户表达的是“最接近某时刻”,则选择绝对时间差最小的一条。
21
- 4. 从最终匹配条目读取 `history_version_id`。`history_version_id` 对应服务端 `minor_history.version`,这是回滚接口需要的 ID。
22
- 5. 执行 `docs +history-revert --doc <doc> --history-version-id <history_version_id>`。
13
+ 1. 使用 `+history-list` 定位目标记录。需要更多候选时,根据 `has_more` 和 `page_token` 翻页。
14
+ - 用户指定 `revision_id`:逐页筛选相同 `revision_id` 的记录。未命中时必须继续翻页至 `has_more=false` 才可进入 fallback;命中位于页尾时,继续读取下一页以收集相邻的同 `revision_id` 候选。多条记录时结合 `edit_time` 选择;无法区分时请用户确认。
15
+ - 用户指定时间:选择不晚于目标时间的最近一条记录;用户明确要求“最接近”时,选择时间差最小的记录。
16
+ 2. 找到目标记录后,使用该记录的 `history_version_id` 调用 `+history-revert`。不要将 `revision_id` 传给回滚接口。返回 `running` 时使用 `+history-revert-status` 查询;只有 `done` 表示成功,其他终态均停止并报告。
17
+ 3. 没有目标记录但用户指定了 `revision_id` 时,可读取目标版本并恢复正文:
18
+ - 使用 `docs +fetch --doc "<doc>" --revision-id <revision_id> --scope full --detail full --format json` 读取目标版本。确认文档一致、返回的 `revision_id` 与目标一致,且 `content` 不是 `<fragment>`。
19
+ - 使用 `docs +fetch --doc "<doc>" --scope full --detail full --format json` 读取当前完整文档,其 `content` 同样不得是 `<fragment>`。目标与当前响应的 `revision_id` 相同时直接结束,不执行 `overwrite`。否则移除目标 `content` 中旧的 block ID,将正文写入任务目录下的相对路径,然后仅执行一次 `docs +update --doc "<doc>" --command overwrite --revision-id <current_revision_id> --content @target.xml`,其中 `current_revision_id` 来自当前文档响应。目标响应包含非空 JSON object 形式的 `reference_map` 时,将其写入相对路径并追加 `--reference-map @target-reference-map.json`;否则省略该参数。`+update` 不支持 `--yes`。
20
+ - 使用 `docs +fetch --doc "<doc>" --scope full --detail full --format json` 读取最新完整文档并核验。忽略重新生成的 block ID,正文结构、文本、链接和引用资源应与目标版本一致。
21
+ 4. 目标版本明确不可读时停止并报告。
23
22
 
24
23
  候选确认时使用类似格式:
25
24
 
@@ -70,7 +70,7 @@ API 成功时返回空 `data`(仅 `code: 0, msg: "success"`),对应 CLI
70
70
 
71
71
  ## 与 wiki URL 的关系
72
72
 
73
- 传入 `/wiki/<node_token>` 时,shortcut 会直接用 `node_token` 作为路径参数并以 `type=wiki` 调用接口。如果需要先把 wiki 节点解析成 `obj_token`(例如想显式对底层 docx 申请),自行先调 `wiki spaces get_node` 拿 `obj_token + obj_type`,再用 bare token + `--type docx` 调本命令。
73
+ 传入 `/wiki/<node_token>` 时,shortcut 会直接用 `node_token` 作为路径参数并以 `type=wiki` 调用接口。如果需要先把 wiki 节点解析成 `obj_token`,自行先调用 [`wiki +node-get` shortcut](../../lark-wiki/references/lark-wiki-node-get.md) 拿 `obj_token + obj_type`,再用 bare `obj_token` + `--type <obj_type>` 调本命令。
74
74
 
75
75
  ## 参考
76
76
 
@@ -136,6 +136,8 @@ lark-cli drive +export \
136
136
  - `--only-schema` 只支持 `bitable` 导出为 `.base`,用于仅导出表结构
137
137
  - 如果格式不匹配,CLI 会返回 typed validation error,并在 `hint` 中给出可重试的 `--file-extension` 建议;例如 `docx + csv` 会提示改用 `docx/pdf/markdown`,或改传 sheet/bitable URL
138
138
  - shortcut 内部固定有限轮询:最多 10 次,每次间隔 5 秒
139
+ - 创建导出任务时收到 `rate_limit` / `99991400` 不会生成 `ticket`;至少等待 1 分钟后重跑原 `drive +export`,持续限频时从 1 分钟开始指数退避
140
+ - 状态轮询一旦收到 `rate_limit` / `99991400` 会立即停止,不会继续消耗剩余轮询次数;错误会保留原始 typed metadata,并在 `hint` 中提供已有 `ticket` 的续查命令
139
141
  - 轮询超时不是失败;会返回 `ticket`、`timed_out=true` 和 `next_command`,供后续继续查询
140
142
 
141
143
  ## 错误码处理
@@ -144,6 +146,7 @@ lark-cli drive +export \
144
146
  |--------|------|----------|
145
147
  | `1069914` | token 非法或 token/type 不匹配;常见原因是把 Wiki node token 当作底层 `docx` / `sheet` / `bitable` token 使用,没有传 `--doc-type wiki` | 优先改用 `--url <Wiki URL>`;只有裸 Wiki token 时,用 `--token <WIKI_NODE_TOKEN> --doc-type wiki`。不确定 token 类型时,先用 `lark-cli drive +inspect --url <TOKEN> --type wiki` 检查是否能解包为 Wiki node;如果不是 Wiki token,再检查 token 来源、`--doc-type` 是否与实际资源类型一致 |
146
148
  | `1069902` | 没有当前导出任务所需权限 | 不要直接重试同一命令;先确认当前 `--as` 身份是否能访问该文档、是否有下载/导出权限,以及文档是否受分享、密级或租户策略限制。需要补权限时,让文档 owner 或管理员授权后再执行 |
149
+ | `99991400` / `rate_limit` | OpenAPI 请求频率受限 | 立即停止并按错误 `hint` 处理:没有 `ticket` 时,至少等待 1 分钟后重跑原 `drive +export`;已有 `ticket` 时,只执行 `drive +task_result --scenario export` 续查,不要重复创建任务。持续限频时从 1 分钟开始指数退避 |
147
150
  | `99991679` | 缺少 OpenAPI scope | 按错误 envelope 中的 `missing_scopes` / `required_scope` / `hint` 补齐授权;常见方式是重新执行 `lark-cli auth login --scope "<缺失 scope>"`。补 scope 前不要反复重试导出命令 |
148
151
 
149
152
  ## 推荐续跑方式
@@ -329,6 +329,9 @@ lark-cli drive +export --token <SOURCE_DOC_TOKEN> --doc-type docx --file-extensi
329
329
  # 2. 继续查询导出结果
330
330
  lark-cli drive +task_result --scenario export --ticket <EXPORT_TICKET> --file-token <SOURCE_DOC_TOKEN>
331
331
 
332
+ # 如果返回 rate_limit / 99991400:至少等待 1 分钟后重试同一条 +task_result;
333
+ # 若仍限频,以 1 分钟为起点继续指数退避。
334
+
332
335
  # 3. 拿到 file_token 后下载
333
336
  lark-cli drive +export-download --file-token <EXPORTED_FILE_TOKEN>
334
337
  ```
@@ -32,7 +32,7 @@ metadata:
32
32
  | `--max-events N` | Exit after N events. Default 0 = unlimited |
33
33
  | `--timeout D` | Exit after duration D (e.g. `30s`, `2m`). Default 0 = no timeout. Whichever of `--max-events` / `--timeout` fires first wins |
34
34
  | `--output-dir <dir>` | Write each event as a file (relative paths only; prevents traversal) |
35
- | `--quiet` | Suppress stderr diagnostics. **AI should not use this** — it silences the ready marker |
35
+ | `--quiet` | Suppress ready/exit markers and per-event stderr diagnostics, including drop warnings. This can hide event loss. **AI should not use this** — it removes readiness and integrity signals |
36
36
  | `--as user\|bot\|auto` | Identity for the session (see lark-shared) |
37
37
 
38
38
 
@@ -42,6 +42,9 @@ metadata:
42
42
  # Default: stream every event for the key (no filter, no projection)
43
43
  lark-cli event consume im.message.receive_v1 --as bot
44
44
 
45
+ # List every EventKey of one domain (the authoritative, always-current catalog)
46
+ lark-cli event list --domain vc --json
47
+
45
48
  # Grab one sample event to inspect payload shape
46
49
  lark-cli event consume im.message.receive_v1 --max-events 1 --timeout 30s --as bot
47
50
 
@@ -57,7 +60,7 @@ wait
57
60
 
58
61
  ## Call flow
59
62
 
60
- 1. `lark-cli event list --json` → pick a legal key
63
+ 1. `lark-cli event list --json` → pick a legal key. `--domain <d>` narrows to one domain; the domains are `application`, `approval`, `board`, `card`, `im`, `minutes`, `task`, `vc`. An unknown domain fails with the valid set listed in the hint.
61
64
  2. `lark-cli event schema <key> --json` → read `resolved_output_schema` + `jq_root_path` to determine field paths
62
65
  3. `lark-cli event consume <key> [--jq '<expr>']` → consume
63
66
 
@@ -94,7 +97,7 @@ Orchestrators should treat `reason: limit/timeout/signal` (all exit 0) as "busin
94
97
 
95
98
  ### Never `kill -9`
96
99
 
97
- **Avoid `kill -9` on consume processes**: for EventKeys with a **PreConsume hook** (those that register server-side subscriptions via OAPI), `kill -9` skips the OAPI unsubscribe and leaks server-side subscriptions (symptoms: "subscription already exists" on restart, duplicate event delivery). Prefer SIGTERM or closing stdin.
100
+ **Avoid `kill -9` on consume processes** for EventKeys whose PreConsume registers a server-side subscription **and** unsubscribes on exit (minutes, vc, board keys): `kill -9` skips the OAPI unsubscribe and leaks the server-side subscription (symptoms: "subscription already exists" on restart, duplicate event delivery). Keys whose subscription is a durable relation with no cleanup (task, approval keys) do not leak this way, but SIGTERM or closing stdin remains the right shutdown for every key.
98
101
 
99
102
  ### One consume, one EventKey (multi-key = multi-shell)
100
103
 
@@ -151,6 +154,6 @@ Lark-defined semantic tags (**not** JSON Schema's standard `format`). Common val
151
154
  | Approval | [`references/lark-event-approval.md`](references/lark-event-approval.md) | Catalog of 2 Approval EventKeys (`approval.instance.status_changed_v4`, `approval.task.status_changed_v4`) + optional/multi `subscription_type` pre-registration + user-auth subscription lifecycle + flat output field reference |
152
155
  | IM | [`references/lark-event-im.md`](references/lark-event-im.md) | Catalog of 12 IM EventKeys + shape notes (flat vs V2 envelope) + `im.message.receive_v1` field gotchas (`sender_id` is open_id only; `.content` is plain text except for `interactive` cards) + common jq recipes (filter by chat_type / message_type / sender); for `card.action.trigger` see also [`../lark-im/references/lark-im-card-action-reply.md`](../lark-im/references/lark-im-card-action-reply.md) |
153
156
  | Task | [`references/lark-event-task.md`](references/lark-event-task.md) | Catalog of 1 Task EventKey (`task.task.update_user_access_v2`) + Native V2 envelope shape + task commit types + user/bot subscription notes |
154
- | VC | [`references/lark-event-vc.md`](references/lark-event-vc.md) | Catalog of 4 VC EventKeys (`vc.meeting.participant_meeting_started_v1`, `vc.meeting.participant_meeting_joined_v1`, `vc.meeting.participant_meeting_ended_v1`, `vc.note.generated_v1`) + field reference + source type semantics (meeting only) |
157
+ | VC | [`references/lark-event-vc.md`](references/lark-event-vc.md) | Catalog of 7 VC EventKeys (meeting lifecycle `participant_meeting_started/joined/ended_v1`, `vc.note.generated_v1`, recording `recording_started/transcript_generated/ended_v1`) + field reference + source type semantics; the live list is always `lark-cli event list --domain vc --json` |
155
158
  | Minutes | [`references/lark-event-minutes.md`](references/lark-event-minutes.md) | Catalog of 1 Minutes EventKey (`minutes.minute.generated_v1`) + field reference + source type semantics (meeting only) |
156
159
  | Whiteboard | [`references/lark-event-whiteboard.md`](references/lark-event-whiteboard.md) | Catalog of 1 Board EventKey (`board.whiteboard.updated_v1`) + per-whiteboard subscription model (requires `-p whiteboard_id=<token>`) + payload field reference (whiteboard_id / operator_ids triple-id) |
@@ -2,7 +2,7 @@
2
2
 
3
3
  > **Prerequisite:** Read [`../SKILL.md`](../SKILL.md) first for the `event consume` essentials (commands, subprocess contract, jq usage).
4
4
 
5
- ## Key catalog (4)
5
+ ## Key catalog (7)
6
6
 
7
7
  | EventKey | Purpose |
8
8
  |---|---|
@@ -10,8 +10,11 @@
10
10
  | `vc.meeting.participant_meeting_joined_v1` | The current user has joined a meeting |
11
11
  | `vc.meeting.participant_meeting_ended_v1` | A meeting the current user participates in has ended |
12
12
  | `vc.note.generated_v1` | A note has been generated (meeting, recording, upload, etc.) |
13
+ | `vc.recording.recording_started_v1` | A recording_bean recording has started (Feishu software only) |
14
+ | `vc.recording.recording_transcript_generated_v1` | Recording_bean transcript items were generated (Feishu software only) |
15
+ | `vc.recording.recording_ended_v1` | A recording_bean recording ended and uploaded successfully (Feishu software only) |
13
16
 
14
- All four keys use a **Custom schema** (flat output) and carry a **PreConsume hook** that auto-subscribes / unsubscribes via OAPI on first / last consumer. All require `--as user`.
17
+ All seven keys use a **Custom schema** (flat output) and carry a **PreConsume hook** that auto-subscribes / unsubscribes via OAPI on first / last consumer. All require `--as user`.
15
18
 
16
19
  ## Scopes & auth
17
20
 
@@ -21,6 +24,9 @@ All four keys use a **Custom schema** (flat output) and carry a **PreConsume hoo
21
24
  | `vc.meeting.participant_meeting_joined_v1` | `vc:meeting.meetingevent:read` | user |
22
25
  | `vc.meeting.participant_meeting_ended_v1` | `vc:meeting.meetingevent:read` | user |
23
26
  | `vc.note.generated_v1` | `vc:note:read` | user |
27
+ | `vc.recording.recording_started_v1` | `vc:recording:read` | user |
28
+ | `vc.recording.recording_transcript_generated_v1` | `vc:recording:read` | user |
29
+ | `vc.recording.recording_ended_v1` | `vc:recording:read` | user |
24
30
 
25
31
  ---
26
32
 
@@ -104,17 +104,17 @@ Shortcut 是对常用操作的高级封装(`lark-cli im +<verb> [flags]`)。
104
104
  | Shortcut | 说明 |
105
105
  |----------|------|
106
106
  | [`+chat-create`](references/lark-im-chat-create.md) | Create a group chat or topic chat; user/bot; --chat-mode group|topic; private/public; invites users/bots; optionally sets bot manager |
107
- | [`+chat-list`](references/lark-im-chat-list.md) | List chats the current user/bot is a member of; defaults to groups; pass --types=p2p,group to include p2p single chats (user-only); user/bot; supports sorting, pagination, --exclude-muted (user-only) |
107
+ | [`+chat-list`](references/lark-im-chat-list.md) | List chats the current user/bot is a member of; defaults to groups; pass --types=p2p,group to include p2p single chats (user-only); user/bot; supports sorting, auto-pagination, --exclude-muted (user-only) |
108
108
  | [`+chat-members-list`](references/lark-im-chat-members-list.md) | List members of a chat; returns separate users[] / bots[] buckets; callable as user or bot; --member-types filters which kinds to return; --page-all pagination; surfaces truncations[] when the server caps a bucket |
109
- | [`+chat-messages-list`](references/lark-im-chat-messages-list.md) | List messages in a chat or P2P conversation; user/bot; accepts --chat-id or --user-id, resolves P2P chat_id, supports time range/sort/pagination |
110
- | [`+chat-search`](references/lark-im-chat-search.md) | Search visible group chats by --query keyword and/or --member-ids; user/bot; e.g. look up chat_id by group name; supports type filters, sorting, pagination, and --exclude-muted (user identity only) |
109
+ | [`+chat-messages-list`](references/lark-im-chat-messages-list.md) | List messages in a chat or P2P conversation; user/bot; accepts --chat-id or --user-id, resolves P2P chat_id, supports time range, --order asc/desc sorting, auto-pagination |
110
+ | [`+chat-search`](references/lark-im-chat-search.md) | Search visible group chats by --query keyword and/or --member-ids; user/bot; e.g. look up chat_id by group name; supports type filters, sorting, auto-pagination, and --exclude-muted (user identity only) |
111
111
  | [`+chat-update`](references/lark-im-chat-update.md) | Update group chat name or description; user/bot; updates a chat's name or description |
112
112
  | [`+messages-mget`](references/lark-im-messages-mget.md) | Batch get messages by IDs; user/bot; fetches up to 50 om_ message IDs, formats sender names, expands thread replies |
113
113
  | [`+messages-reply`](references/lark-im-messages-reply.md) | Reply to a message (supports thread replies); user/bot; supports text/markdown/post/media replies, reply-in-thread, idempotency key |
114
114
  | [`+messages-resources-download`](references/lark-im-messages-resources-download.md) | Download images/files from a message; user/bot; supports automatic chunked download for large files (8MB chunks), auto-detects file extension from Content-Type |
115
- | [`+messages-search`](references/lark-im-messages-search.md) | Search messages across chats (supports keyword, sender, time range filters) with user identity; user-only; filters by chat/sender/attachment/time, supports auto-pagination via `--page-all` / `--page-limit`, enriches results via batched mget and chats batch_query |
115
+ | [`+messages-search`](references/lark-im-messages-search.md) | Search messages across chats (supports keyword, sender, time range filters) with user or bot identity; filters by chat/sender/attachment/time, supports auto-pagination via `--page-all` / `--page-limit`, enriches results via batched mget and chats batch_query |
116
116
  | [`+messages-send`](references/lark-im-messages-send.md) | Send a message to a chat or direct message; user/bot; sends to chat-id or user-id with text/markdown/post/media, supports idempotency key |
117
- | [`+threads-messages-list`](references/lark-im-threads-messages-list.md) | List messages in a thread; user/bot; accepts om_/omt_ input, resolves message IDs to thread_id, supports sort/pagination |
117
+ | [`+threads-messages-list`](references/lark-im-threads-messages-list.md) | List messages in a thread; user/bot; accepts om_/omt_ input, resolves message IDs to thread_id, supports --order asc/desc sorting, auto-pagination |
118
118
  | [`+flag-create`](references/lark-im-flag-create.md) | Create a bookmark on a message; user-only; defaults to message-layer flag; use --flag-type feed for feed-layer flag (item_type auto-detected from chat mode) |
119
119
  | [`+flag-cancel`](references/lark-im-flag-cancel.md) | Cancel (remove) a bookmark. When no --flag-type is given, best-effort double-cancel: removes message layer and (when chat_type is determinable) feed layer |
120
120
  | [`+flag-list`](references/lark-im-flag-list.md) | List bookmarks; user-only; auto-enriches feed-type thread entries with message content; `--page-all` is capped by `--page-limit` (default 20, max 1000), and `has_more=true` means the result is incomplete |
@@ -23,6 +23,9 @@ lark-cli im +chat-list --page-size 50
23
23
  # Pagination
24
24
  lark-cli im +chat-list --page-token "xxx"
25
25
 
26
+ # Fetch multiple pages automatically, up to 10 pages by default
27
+ lark-cli im +chat-list --page-all
28
+
26
29
  # Drop muted chats (user identity only)
27
30
  lark-cli im +chat-list --exclude-muted
28
31
 
@@ -50,13 +53,17 @@ lark-cli im +chat-list --as user --types p2p
50
53
  | `--types <strings>` | No | `group`, `p2p` (comma-separated or repeated) | Chat types to include. Omitted = groups only (backward compatible). `p2p` requires user identity (`--as user`); under `--as bot`, `--types=p2p` alone is rejected and `--types=p2p,group` is silently downgraded to `group` |
51
54
  | `--sort <field>` | No | `create_time` (default, ascending), `active_time` (descending) | Result ordering |
52
55
  | `--page-size <n>` | No | 1-100, default 20 | Number of results per page |
53
- | `--page-token <token>` | No | - | Pagination token from the previous response |
56
+ | `--page-token <token>` | No | - | Starting cursor, normally returned by a previous response |
57
+ | `--page-all` | No | - | Automatically fetch and merge subsequent pages; capped by `--page-limit` |
58
+ | `--page-limit <n>` | No | 1-1000, default 10 | Maximum pages fetched by `--page-all` |
54
59
  | `--exclude-muted` | No | User identity only | Drop chats the current user has muted (do-not-disturb). Under `--as bot`, the flag is silently inactive; see "Filtering muted chats" below |
55
60
  | `--format json` | No | - | Output as JSON |
56
61
  | `--dry-run` | No | - | Preview the request without executing it |
57
62
 
58
63
  > **Note:** Supports both `--as user` (default) and `--as bot`. When using bot identity, the app must have bot capability enabled.
59
64
 
65
+ With `--page-all`, `--page-token` sets the starting cursor. If `meta.pagination.complete=false`, resume from `meta.pagination.next_token` or raise `--page-limit`.
66
+
60
67
  ## Output Fields
61
68
 
62
69
  | Field | Description |
@@ -156,7 +163,7 @@ done
156
163
 
157
164
  | Symptom | Root Cause | Solution |
158
165
  |---------|---------|---------|
159
- | `--page-size must be an integer between 1 and 100` | page-size is out of range or not an integer | Use an integer between 1 and 100 |
166
+ | `invalid --page-size 101: must be between 1 and 100` | page-size is out of range | Use an integer between 1 and 100 |
160
167
  | Permission denied (99991672) | The bot app does not have `im:chat:read` TAT permission enabled | Enable the permission for the app in the Open Platform console |
161
168
  | Permission denied (99991679) with `--as user` | UAT is not authorized for `im:chat:read` | Run `lark-cli auth login --scope "im:chat:read"` |
162
169
  | `Bot ability is not activated` (232025) | The app does not have bot capability enabled | Enable bot capability in the Open Platform console |
@@ -19,9 +19,12 @@ lark-cli im +chat-members-list --chat-id oc_xxx --member-types user,bot
19
19
  # Walk every page (capped by --page-limit; 0 = unlimited)
20
20
  lark-cli im +chat-members-list --chat-id oc_xxx --page-all --page-limit 0
21
21
 
22
- # Resume from a specific cursor (single page; --page-all is ignored)
22
+ # Fetch one page starting at a specific cursor
23
23
  lark-cli im +chat-members-list --chat-id oc_xxx --page-token "xxx"
24
24
 
25
+ # Continue automatically from a specific cursor
26
+ lark-cli im +chat-members-list --chat-id oc_xxx --page-token "xxx" --page-all
27
+
25
28
  # JSON output / preview the request
26
29
  lark-cli im +chat-members-list --chat-id oc_xxx --format json
27
30
  lark-cli im +chat-members-list --chat-id oc_xxx --dry-run
@@ -35,7 +38,7 @@ lark-cli im +chat-members-list --chat-id oc_xxx --dry-run
35
38
  | `--member-types <strings>` | No | `user`, `bot` (comma-separated or repeated) | Member types to return. Omitted = all |
36
39
  | `--member-id-type <type>` | No | `open_id` (default), `union_id`, `user_id` | ID type for `member_id` in the response |
37
40
  | `--page-size <n>` | No | 1-100, default 20 | Results per page. With `--page-all` and no explicit `--page-size`, the max (100) is used automatically to minimize round-trips |
38
- | `--page-token <token>` | No | - | Pagination cursor; **implies a single-page fetch** (disables auto-pagination) |
41
+ | `--page-token <token>` | No | - | Starting cursor, normally returned by a previous response |
39
42
  | `--page-all` | No | - | Automatically walk every page (capped by `--page-limit`) |
40
43
  | `--page-limit <n>` | No | default 10, `0` = unlimited | Max pages to fetch with `--page-all` |
41
44
  | `--page-delay <ms>` | No | default 200, `0` = no delay | Delay between pages during `--page-all` (throttle to avoid rate limits on large lists) |
@@ -70,7 +73,7 @@ A truncated result is *not* fixable by paging further — it is a server-side ca
70
73
  - With `--page-all` and no explicit `--page-size`, the shortcut uses the maximum page size (100) so a full walk takes the fewest round-trips. An explicit `--page-size` is always honored.
71
74
  - `--page-all` sleeps `--page-delay` ms (default 200) between pages to avoid hammering the API when a tenant has no server-side member cap and the list spans many pages. Set `--page-delay 0` to disable.
72
75
  - `--page-all` stops at `--page-limit` pages (default 10). When it stops early, `has_more` stays `true` so you know the result is incomplete; re-run with `--page-limit 0` for everything.
73
- - `--page-token` and `--page-all` together: `--page-token` wins (single-page fetch from the supplied cursor); a stderr warning is emitted.
76
+ - `--page-token` and `--page-all` together: automatic pagination starts at the supplied cursor and continues until exhaustion or `--page-limit`.
74
77
  - Across pages, `users[]` and `bots[]` are concatenated; `truncations` / `has_more` / `page_token` come from the last page fetched.
75
78
 
76
79
  ## Common Errors and Troubleshooting
@@ -78,6 +81,6 @@ A truncated result is *not* fixable by paging further — it is a server-side ca
78
81
  | Symptom | Root Cause | | Solution |
79
82
  |---------|---------|---|---------|
80
83
  | `--chat-id is required` | `--chat-id` omitted | | Provide the `oc_xxx` chat ID |
81
- | `--page-size must be an integer between 1 and 100` | out of range | | Use 1-100 |
84
+ | `invalid --page-size 101: must be between 1 and 100` | out of range | | Use 1-100 |
82
85
  | `--member-types contains invalid value` | value other than `user`/`bot` | | Use `user`, `bot`, or both |
83
86
  | Permission denied | missing `im:chat.members:read` | | Bot: enable the scope in the console. User: `lark-cli auth login --scope "im:chat.members:read"` |
@@ -29,6 +29,9 @@ lark-cli im +chat-messages-list --chat-id oc_xxx --order asc --page-size 20
29
29
  # Pagination
30
30
  lark-cli im +chat-messages-list --chat-id oc_xxx --page-token "xxx"
31
31
 
32
+ # Fetch multiple pages automatically, up to 10 pages by default
33
+ lark-cli im +chat-messages-list --chat-id oc_xxx --page-all
34
+
32
35
  # JSON output
33
36
  lark-cli im +chat-messages-list --chat-id oc_xxx --format json
34
37
  ```
@@ -43,7 +46,9 @@ lark-cli im +chat-messages-list --chat-id oc_xxx --format json
43
46
  | `--end <time>` | No | End time (ISO 8601 or date only) |
44
47
  | `--order <order>` | No | Sort order: `asc` / `desc` (default `desc`) |
45
48
  | `--page-size <n>` | No | Page size (default 50, max 50) |
46
- | `--page-token <token>` | No | Pagination token |
49
+ | `--page-token <token>` | No | Starting cursor, normally returned by a previous response |
50
+ | `--page-all` | No | Automatically fetch and merge subsequent pages; capped by `--page-limit` |
51
+ | `--page-limit <n>` | No | Maximum pages fetched by `--page-all` (default 10, range 1-1000) |
47
52
  | `--no-reactions` | No | Skip auto-fetching the `reactions` block |
48
53
  | `--download-resources` | No | Download message resources (image/file/audio/video/media + post-embedded, excluding stickers) into `./lark-im-resources/` and attach a `resources` block. Off by default; no extra requests when omitted |
49
54
 
@@ -106,12 +111,14 @@ Each message contains:
106
111
 
107
112
  ## Pagination (`has_more` / `page_token`)
108
113
 
109
- `im +chat-messages-list` returns `has_more` and `page_token` when more data is available. Use `--page-token` to continue:
114
+ By default, `im +chat-messages-list` fetches one page. It returns `has_more` and `page_token` when more data is available. Use `--page-token` to continue:
110
115
 
111
116
  ```bash
112
117
  lark-cli im +chat-messages-list --chat-id oc_xxx --page-token <PAGE_TOKEN>
113
118
  ```
114
119
 
120
+ With `--page-all`, `--page-token` sets the starting cursor. If `meta.pagination.complete=false`, resume from `meta.pagination.next_token` or raise `--page-limit`.
121
+
115
122
  You can also fall back to the generic API:
116
123
 
117
124
  ```bash
@@ -149,7 +156,7 @@ lark-cli api GET /open-apis/im/v1/messages \
149
156
  lark-cli im +chat-search --as bot --query "<chat name keyword>" --format json
150
157
  lark-cli im +chat-messages-list --as bot --chat-id <chat_id> --page-size 50 --format json
151
158
  ```
152
- Do not use `im +messages-search --as bot`; `+messages-search` is user-only. Continue with `--page-token` if `has_more=true`.
159
+ If the request is keyword search across message content, `im +messages-search --as bot` is also supported. Continue with `--page-token` if `has_more=true`.
153
160
 
154
161
  ## References
155
162
 
@@ -33,6 +33,9 @@ lark-cli im +chat-search --query "project" --page-size 10
33
33
  # Pagination
34
34
  lark-cli im +chat-search --query "project" --page-token "xxx"
35
35
 
36
+ # Fetch multiple pages automatically, up to 10 pages by default
37
+ lark-cli im +chat-search --query "project" --page-all
38
+
36
39
  # JSON output
37
40
  lark-cli im +chat-search --query "project" --format json
38
41
 
@@ -52,13 +55,17 @@ lark-cli im +chat-search --query "project" --dry-run
52
55
  | `--disable-search-by-user` | No | - | Disable member-name-based matching and search by group name only |
53
56
  | `--sort <field>` | No | `create_time`, `update_time`, `member_count` | Sort field (always descending) |
54
57
  | `--page-size <n>` | No | 1-100, default 20 | Number of results per page |
55
- | `--page-token <token>` | No | - | Pagination token from the previous response |
58
+ | `--page-token <token>` | No | - | Starting cursor, normally returned by a previous response |
59
+ | `--page-all` | No | - | Automatically fetch and merge subsequent pages; capped by `--page-limit` |
60
+ | `--page-limit <n>` | No | 1-1000, default 10 | Maximum pages fetched by `--page-all` |
56
61
  | `--exclude-muted` | No | User identity only | Drop chats the current user has muted (do-not-disturb). Under `--as bot`, the flag is silently inactive (mute is a per-user setting); see "Filtering muted chats" below |
57
62
  | `--format json` | No | - | Output as JSON |
58
63
  | `--dry-run` | No | - | Preview the request without executing it |
59
64
 
60
65
  > **Note:** Supports both `--as user` (default) and `--as bot`. When using bot identity, the app must have bot capability enabled.
61
66
 
67
+ With `--page-all`, `--page-token` sets the starting cursor. If `meta.pagination.complete=false`, resume from `meta.pagination.next_token` or raise `--page-limit`.
68
+
62
69
  > **CAUTION:** `--sort` is **always descending** — the search API only ranks the chosen field high-to-low (e.g. `member_count` = most members first). There is no ascending option. If the user asks for "fewest first / ascending / 从少到多", tell them the search API does not support ascending order; any low-to-high view requires re-sorting the fetched page client-side and is not an upstream sort. Do **not** invent values like `member_count_asc` or pass `asc` (they are rejected).
63
70
 
64
71
  ## Output Fields
@@ -121,7 +128,7 @@ lark-cli im +messages-send --chat-id "$CHAT_ID" --text "Today's progress update"
121
128
  |---------|---------|---------|
122
129
  | `--query and --member-ids cannot both be empty` | Both were omitted | Provide at least `--query` or `--member-ids` |
123
130
  | Empty results | No visible chats matched the keyword or filters | Relax the keyword or filters and try again |
124
- | `--page-size must be an integer between 1 and 100` | page-size is out of range or not an integer | Use an integer between 1 and 100 |
131
+ | `invalid --page-size 101: must be between 1 and 100` | page-size is out of range | Use an integer between 1 and 100 |
125
132
  | Permission denied (99991672) | The bot app does not have `im:chat:read` TAT permission enabled | Enable the permission for the app in the Open Platform console |
126
133
  | Permission denied (99991679) with `--as user` | UAT is not authorized for `im:chat:read` | Run `lark-cli auth login --scope "im:chat:read"` |
127
134
  | `Bot ability is not activated` (232025) | The app does not have bot capability enabled | Enable bot capability in the Open Platform console |
@@ -34,13 +34,13 @@ lark-cli im +feed-group-list-item --as user --feed-group-id ofg_xxx \
34
34
  |---|---|---|
35
35
  | `--feed-group-id` | Yes | Feed group ID (`ofg_xxx`); path parameter |
36
36
  | `--page-size` | No | Records per page, 1–50 (default 50) |
37
- | `--page-token` | No | Continuation token for a specific page |
37
+ | `--page-token` | No | Starting cursor, normally returned by a previous response |
38
38
  | `--page-all` | No | Auto-paginate and merge all pages |
39
39
  | `--page-limit` | No | Max pages when `--page-all` is set, 1–1000 (default 20) |
40
40
  | `--start-time` | No | Update-time window start (Unix milliseconds as a decimal string) |
41
41
  | `--end-time` | No | Update-time window end (Unix milliseconds as a decimal string) |
42
42
 
43
- When `--page-token` is set explicitly, it wins over `--page-all` (you get exactly that page).
43
+ When `--page-token` and `--page-all` are supplied together, automatic pagination starts at that cursor and continues until exhaustion or `--page-limit`.
44
44
 
45
45
  ## Output
46
46