@amaster.ai/pi-lark 0.1.2-beta.71 → 0.1.2-beta.72

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amaster.ai/pi-lark",
3
- "version": "0.1.2-beta.71",
3
+ "version": "0.1.2-beta.72",
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.71"
64
+ "@amaster.ai/pi-shared": "0.1.2-beta.72"
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.21
3
+ version: 1.2.22
4
4
  description: "飞书多维表格(Base)操作:建表、字段、记录、视图、统计、公式/lookup、表单、仪表盘、应用模式(BaseApp/AppMode 页面与组件)、Workspace 目录、workflow、角色权限、模板中心(多维表格模板分类/列表/搜索);遇到 Base/多维表格/bitable、BaseApp/AppMode、/base/ 或 /app/ 链接时使用。BaseApp 不走 lark-apps;文件导入/导出转 lark-drive,认证/授权转 lark-shared。"
5
5
  metadata:
6
6
  requires:
@@ -209,8 +209,9 @@ Form 依附于 Table,以 Field 作为题目,每次有效提交会创建一
209
209
 
210
210
  1. **读取 Table 中的表单配置:** 使用 `+form-list` / `+form-get` 读取表单,使用 `+form-questions-list` 读取题目配置;这些命令使用表单所属的 `base_token + table_id`。
211
211
  2. **创建或修改 Table 中的表单配置:** 使用 `+form-create` / `+form-update` / `+form-delete` 管理表单;题目由 Table Field 承载,question ID 对应 `field_id`,创建和更新分别读取 [questions create](references/lark-base-form-questions-create.md) / [questions update](references/lark-base-form-questions-update.md),删除使用 `+form-questions-delete`。
212
- 3. **管理表单分享:** 使用 `+form-share-get` / `+form-share-update` 管理启停、访问范围和匿名/登录要求;更新前先读取现状,每次只修改一个字段,布尔值显式传 `true` 或 `false`。
213
- 4. **填写分享表单并提交:** 对表单分享链接使用 `+url-resolve` 取得 `share_token`,按 [Form detail](references/lark-base-form-detail.md) 执行 `+form-detail` 读取真实题目、必填项和显示条件,再按 [Form submit](references/lark-base-form-submit.md) 构造字段与附件并执行 `+form-submit`。
212
+ 3. **调整表单题目显隐和顺序:** Form 在 `visible_fields` 接口中作为 View,`form_id` 传给 `--view-id`。用 `+view-get-visible-fields` 读取当前可见题目,再用 `+view-set-visible-fields` 提交最终需要展示的完整有序题目 ID 列表;省略当前可见题目会隐藏它,加入已有隐藏 Form 成员会重新展示,空列表会隐藏全部题目。目标只能包含已有 Form 成员;仍显示题目的 `visible_rule` 只能引用位于它之前的可见题目。
213
+ 4. **管理表单分享:** 使用 `+form-share-get` / `+form-share-update` 管理启停、访问范围和匿名/登录要求;更新前先读取现状,每次只修改一个字段,布尔值显式传 `true` 或 `false`。
214
+ 5. **填写分享表单并提交:** 对表单分享链接使用 `+url-resolve` 取得 `share_token`,按 [Form detail](references/lark-base-form-detail.md) 执行 `+form-detail` 读取真实题目、必填项和显示条件,再按 [Form submit](references/lark-base-form-submit.md) 构造字段与附件并执行 `+form-submit`。
214
215
 
215
216
  表单题目和字段的关系:
216
217
 
@@ -224,7 +224,7 @@ user / created_by / updated_by: is, isNot, isEmpty, isNotEmpty
224
224
  - `group_by[].sort.type` 为 `group` 或 `view` 且缺少 `order` 时,自动补 `order:"asc"`;`value` 排序不会自动补方向
225
225
  - 本地校验(可通过 `--no-validate` 跳过)
226
226
  - `+dashboard-block-create` 默认对 `data_config` 做轻量校验;失败会聚合错误并给出修复建议
227
- - `+dashboard-block-update` 不带 `--type`,所以不做按组件类型的强校验,字段由后端验证;但 `number_format` 子字段与 create 一样本地拦截(见下方 number_format 小节)
227
+ - `+dashboard-block-update` 不带 `--type`,所以不做按组件类型的强校验;但会对可解析的 `filter` 条件做轻量校验,包括 `conjunction`、字段引用、`operator` 和必需的 `value`,并与 create 一样拦截非法 `number_format` 子字段(见下方 number_format 小节)
228
228
  - 仅需传入合法 JSON;CLI 不会擅自改写你的业务含义
229
229
 
230
230
  ## 可复制模板
@@ -19,7 +19,7 @@ metadata:
19
19
  按**日程归属**选身份:
20
20
 
21
21
  - 查看/管理登录用户本人的日程 → `--as user`(默认,绝大多数场景)。
22
- - 查看/管理 bot 自己创建/拥有的日程 → `--as bot`
22
+ - 查看/管理 bot 自己创建/拥有的日程 → `--as bot`
23
23
 
24
24
  **对话人称映射**:「我」= 登录用户,「你」= 应用(bot);作为字段取值的人称(参会人、会议 owner 等)不参与身份判定,如「你创建日程,邀请我、会议 owner 为我」→ `--as bot` 创建,登录用户仅作参会人与会议 owner。
25
25
 
@@ -46,7 +46,7 @@ JSON 输出包含以下字段:
46
46
 
47
47
  - `--url` 为必填参数
48
48
  - 当 `--url` 是 bare token(非完整 URL)时,`--type` 也是必填的
49
- - wiki URL 会自动调用 `get_node` API 解包,输出中 `type` 和 `token` 是底层文档的类型和 token
49
+ - wiki URL 会自动调用 `node_by_token` API 解包,输出中 `type` 和 `token` 是底层文档的类型和 token
50
50
  - `+inspect` 只用于识别/消歧;如果任务已能通过 URL 路径形态完成路由判断,不必把它作为所有 Drive 操作的通用前置步骤
51
51
  - `+inspect` 失败后不要自动切到写接口继续尝试,先按错误提示处理权限、scope 或链接问题
52
52
  - 支持 `--dry-run` 查看将调用的 API 步骤
@@ -58,10 +58,16 @@ The raw `sender_name` is not duplicated in output (its value is in `name`); the
58
58
 
59
59
  The four message-pulling shortcuts (`+messages-mget`, `+chat-messages-list`, `+messages-search`, `+threads-messages-list`) automatically attach a `reactions` block and (for edited messages) `update_time` to each returned message — no separate `im.reactions.batch_query` call is needed. Pass `--no-reactions` to opt out. For the full contract (output shape, the `im:message.reactions:read` scope requirement, and the "missing field ≠ fetch failure" data rules), read [`references/lark-im-message-enrichment.md`](references/lark-im-message-enrichment.md).
60
60
 
61
+ ### Compact message output (`--concise`)
62
+
63
+ Some message-listing shortcuts support `--concise` for compact Markdown output. Use it when the user asks for concise output or a smaller result/file; check `--help` for availability and do not combine it with an explicit `--format`, an enabled `--json`, or a non-empty `--jq`.
64
+
61
65
  ### Opt-in resource auto-download (`--download-resources`)
62
66
 
63
67
  `+chat-messages-list`, `+messages-mget`, and `+threads-messages-list` accept `--download-resources` to save eligible attachments into `./lark-im-resources/` and add a `resources` array to each message. It is off by default; stickers are not downloadable. A failed attachment is reported on that resource without aborting the message pull. Use [`+messages-resources-download`](references/lark-im-messages-resources-download.md) for one attachment. See [`references/lark-im-message-enrichment.md`](references/lark-im-message-enrichment.md) for the output contract.
64
68
 
69
+ **Folder resources** are containers, not files — a folder `file_key` cannot be downloaded directly. Expand it first with `lark-cli im files folder --recursive --file-key <folder_key> --srctype message --srcid <message_id>`, then download the files inside with [`+messages-resources-download`](references/lark-im-messages-resources-download.md).
70
+
65
71
  ### Card Messages (Interactive)
66
72
 
67
73
  **Before sending, replying with, or updating any `interactive` card (`+messages-send` / `+messages-reply` / `messages.patch`), you MUST read [`references/card/lark-im-card-create.md`](references/card/lark-im-card-create.md) and follow its workflow.** The card JSON passed to `--msg-type interactive --content` (send/reply) or `messages.patch --data` (update) must be the output of that workflow — never hand-write or copy a card payload.
@@ -118,7 +124,7 @@ Shortcut 是对常用操作的高级封装(`lark-cli im +<verb> [flags]`)。
118
124
  | [`+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 |
119
125
  | [`+messages-read-status`](references/lark-im-message-read-status.md) | Batch query whether the current user read 1–50 messages; user-only; returns readable items and invalid message IDs |
120
126
  | [`+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 |
121
- | [`+messages-resources-download`](references/lark-im-messages-resources-download.md) | Download an image or file attached to a message; user/bot |
127
+ | [`+messages-resources-download`](references/lark-im-messages-resources-download.md) | Download an image/file from a message; folders are not directly downloadable — expand with `im files folder --recursive` first, then download the files inside; user/bot |
122
128
  | [`+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 |
123
129
  | [`+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 |
124
130
  | [`+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 |
@@ -17,6 +17,9 @@ lark-cli im +chat-messages-list --chat-id oc_xxx
17
17
  # Get direct messages with a user (pass open_id and resolve p2p chat_id automatically)
18
18
  lark-cli im +chat-messages-list --user-id ou_xxx
19
19
 
20
+ # Read message context as compact Markdown
21
+ lark-cli im +chat-messages-list --chat-id oc_xxx --concise
22
+
20
23
  # Specify a time range (ISO 8601)
21
24
  lark-cli im +chat-messages-list --chat-id oc_xxx --start "2026-03-10T00:00:00+08:00" --end "2026-03-11T00:00:00+08:00"
22
25
 
@@ -51,6 +54,7 @@ lark-cli im +chat-messages-list --chat-id oc_xxx --format json
51
54
  | `--page-limit <n>` | No | Maximum pages fetched by `--page-all` (default 10, range 1-1000) |
52
55
  | `--no-reactions` | No | Skip auto-fetching the `reactions` block |
53
56
  | `--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 |
57
+ | `--concise` | No | Render compact Markdown for message context |
54
58
 
55
59
  > Rule: `--chat-id` and `--user-id` are mutually exclusive. You must provide exactly one of them.
56
60
 
@@ -51,7 +51,7 @@ Each message contains:
51
51
  | `sender` | Sender information (includes `name`) |
52
52
  | `content` | Message content |
53
53
 
54
- For `folder` messages, `content` carries a folder key; `mget` expands the folder one level (`GET /files/:file_key/folder`), rendering first-level children inside the folder tag:
54
+ For `folder` messages, `content` carries a folder key; `mget` expands the folder one level, rendering first-level children inside the folder tag (to expand/download folder children yourself, follow the Folder resources note in [`lark-im`](../SKILL.md)):
55
55
 
56
56
  ```
57
57
  <folder key="file_v3_...g" name="assets" child_count="5">
@@ -51,6 +51,8 @@ Different resource markers in message content correspond to different `file_key`
51
51
 
52
52
  Stickers cannot be downloaded with this command.
53
53
 
54
+ A folder itself cannot be downloaded: expand it with `lark-cli im files folder --recursive` first (see [lark-im](../SKILL.md)), then download the files it contains.
55
+
54
56
  ## Output
55
57
 
56
58
  On success, read:
@@ -31,6 +31,9 @@ lark-cli im +threads-messages-list --thread omt_xxx --format pretty
31
31
  lark-cli im +threads-messages-list --thread omt_xxx --format table
32
32
  lark-cli im +threads-messages-list --thread omt_xxx --format csv
33
33
 
34
+ # Read thread context as compact Markdown
35
+ lark-cli im +threads-messages-list --thread omt_xxx --concise
36
+
34
37
  # View as a bot
35
38
  lark-cli im +threads-messages-list --thread omt_xxx --as bot
36
39
 
@@ -51,6 +54,7 @@ lark-cli im +threads-messages-list --thread omt_xxx --dry-run
51
54
  | `--page-all` | No | Automatically fetch and merge subsequent pages; capped by `--page-limit` |
52
55
  | `--page-limit <n>` | No | Maximum pages fetched by `--page-all` (default 10, range 1-1000) |
53
56
  | `--format <fmt>` | No | Output format: `json` (default) / `pretty` / `table` / `ndjson` / `csv` |
57
+ | `--concise` | No | Render compact Markdown for thread context |
54
58
  | `--as <identity>` | No | Identity type: `user` (default) / `bot` |
55
59
  | `--dry-run` | No | Print the request only, do not execute it |
56
60
 
@@ -12,22 +12,22 @@ lark-cli drive +inspect --url 'https://xxx.feishu.cn/wiki/<wiki_token>'
12
12
 
13
13
  输出中的 `type` 是底层对象类型,`token` 是后续命令应使用的 canonical token。`wiki_node` 字段保留节点侧信息,如 `space_id`、`node_token`、`obj_token`、`obj_type`。
14
14
 
15
- ## 手动方式
15
+ ## 节点详情方式
16
16
 
17
- 如果不能使用 shortcut,再调用 Wiki 节点接口:
17
+ 如果后续操作需要 Wiki 节点侧的字段,使用 `wiki +node-get`:
18
18
 
19
19
  ```bash
20
- lark-cli wiki spaces get_node --params '{"token":"<wiki_token>"}'
20
+ lark-cli wiki +node-get --node-token 'https://xxx.feishu.cn/wiki/<wiki_token>' --format json
21
21
  ```
22
22
 
23
23
  从返回值中读取:
24
24
 
25
25
  | 字段 | 含义 |
26
26
  |------|------|
27
- | `node.obj_type` | 底层对象类型,如 `docx`、`doc`、`sheet`、`bitable`、`slides`、`file`、`mindnote` |
28
- | `node.obj_token` | 底层对象 token,用于对应业务 skill 或原生 API |
29
- | `node.node_token` / `token` | Wiki 节点 token,用于 Wiki 节点层级操作 |
30
- | `node.space_id` | 所属知识空间 |
27
+ | `data.obj_type` | 底层对象类型,如 `docx`、`doc`、`sheet`、`bitable`、`slides`、`file`、`mindnote` |
28
+ | `data.obj_token` | 底层对象 token,用于对应业务 skill 或原生 API |
29
+ | `data.node_token` | Wiki 节点 token,用于 Wiki 节点层级操作 |
30
+ | `data.space_id` | 所属知识空间 |
31
31
 
32
32
  ## 路由
33
33
 
@@ -28,7 +28,7 @@ lark-cli slides +add-slide --as user \
28
28
  --slide @cover.xml \
29
29
  --before-slide-id "$SID"
30
30
 
31
- # wiki 链接(CLI 自动 wiki.spaces.get_node 解析,并校验 obj_type=slides)
31
+ # wiki 链接(CLI 自动通过 node_by_token 接口解析,并校验 obj_type=slides)
32
32
  lark-cli slides +add-slide --as user \
33
33
  --presentation "https://xxx.feishu.cn/wiki/wikcnXXXXXX" \
34
34
  --slide @page3.xml
@@ -15,7 +15,7 @@ lark-cli slides +media-upload --as user \
15
15
  --file ./chart.png \
16
16
  --presentation "https://xxx.feishu.cn/slides/slidesXXXXXXXXXXXXXXXXXXXXXX"
17
17
 
18
- # 传 wiki URL(CLI 自动 wiki.spaces.get_node 解析为真实 token,校验 obj_type=slides)
18
+ # 传 wiki URL(CLI 自动通过 node_by_token 接口解析真实 token,校验 obj_type=slides)
19
19
  lark-cli slides +media-upload --as user \
20
20
  --file ./pic.png \
21
21
  --presentation "https://xxx.feishu.cn/wiki/wikcnXXXXXX"
@@ -32,7 +32,7 @@ lark-cli slides +replace-slide --as user \
32
32
  cat parts.json | lark-cli slides +replace-slide --as user \
33
33
  --presentation $PRES_ID --slide-id $SID --parts -
34
34
 
35
- # wiki URL 直接传(CLI 自动 get_node → 拿真实 xml_presentation_id)
35
+ # wiki URL 直接传(CLI 自动通过 node_by_token 拿真实 xml_presentation_id)
36
36
  lark-cli slides +replace-slide --as user \
37
37
  --presentation "https://xxx.feishu.cn/wiki/wikcnXXXXXX" --slide-id pfG \
38
38
  --parts '[{"action":"block_insert","insertion":"<shape type=\"rect\" width=\"100\" height=\"100\"/>"}]'
@@ -49,7 +49,7 @@ metadata:
49
49
 
50
50
  Shortcut 是对常用操作的高级封装(`lark-cli wiki +<verb> [flags]`)。有 Shortcut 的操作优先使用。
51
51
 
52
- 获取或解析 Wiki 节点统一优先使用 `wiki +node-get`,包括只为获取 `space_id`、`node_token`、`obj_token` 或 `obj_type` 的中间步骤。只有当前 CLI 不提供该 shortcut,或任务明确需要 shortcut 未输出的原始响应字段时,才回退到 `wiki spaces get_node`;回退前先运行 `lark-cli schema wiki.spaces.get_node`。
52
+ 获取或解析 Wiki 节点统一使用 `wiki +node-get`,包括只为获取 `space_id`、`node_token`、`obj_token` 或 `obj_type` 的中间步骤。
53
53
 
54
54
  | Shortcut | 说明 |
55
55
  |----------|------|
@@ -95,7 +95,6 @@ lark-cli wiki <resource> <method> [flags] # 调用 API
95
95
 
96
96
  - `create` — 创建知识空间
97
97
  - `get` — 获取知识空间信息
98
- - `get_node` — 获取知识空间节点信息
99
98
  - `list` — 获取知识空间列表
100
99
 
101
100
  ### members