@amaster.ai/pi-lark 0.1.2-beta.47 → 0.1.2-beta.49
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/README.md +5 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -2
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/skills/lark-apps/SKILL.md +1 -0
- package/skills/lark-apps/references/lark-apps-cache.md +61 -0
- package/skills/lark-base/SKILL.md +16 -7
- package/skills/lark-base/references/lark-base-data-query.md +11 -4
- package/skills/lark-base/references/lark-base-filter-condition.md +179 -0
- package/skills/lark-base/references/lark-base-form-questions-create.md +40 -7
- package/skills/lark-base/references/lark-base-form-questions-update.md +73 -20
- package/skills/lark-base/references/lark-base-role-guide.md +11 -0
- package/skills/lark-base/references/lark-base-view-set-filter.md +11 -137
- package/skills/lark-base/references/role-config.md +31 -5
- package/skills/lark-calendar/SKILL.md +14 -8
- package/skills/lark-calendar/references/lark-calendar-create.md +6 -6
- package/skills/lark-calendar/references/lark-calendar-recurring.md +1 -0
- package/skills/lark-calendar/references/lark-calendar-room-find.md +2 -1
- package/skills/lark-calendar/references/lark-calendar-schedule-clear-time.md +1 -0
- package/skills/lark-calendar/references/lark-calendar-suggestion.md +1 -1
- package/skills/lark-calendar/references/lark-calendar-update.md +7 -4
- package/skills/lark-contact/SKILL.md +19 -3
- package/skills/lark-contact/references/lark-contact-search-bot.md +60 -0
- package/skills/lark-drive/SKILL.md +21 -44
- package/skills/lark-drive/references/lark-drive-add-comment.md +2 -4
- package/skills/lark-drive/references/lark-drive-add-reply.md +47 -0
- package/skills/lark-drive/references/lark-drive-apply-permission.md +2 -2
- package/skills/lark-drive/references/lark-drive-batch-query-comments.md +46 -0
- package/skills/lark-drive/references/lark-drive-comment-content.md +50 -0
- package/skills/lark-drive/references/lark-drive-comment-location.md +7 -13
- package/skills/lark-drive/references/lark-drive-delete-reply.md +48 -0
- package/skills/lark-drive/references/lark-drive-download.md +5 -1
- package/skills/lark-drive/references/lark-drive-list-comments.md +25 -68
- package/skills/lark-drive/references/lark-drive-list-replies.md +54 -0
- package/skills/lark-drive/references/lark-drive-member-add.md +2 -2
- package/skills/lark-drive/references/lark-drive-member-list.md +65 -0
- package/skills/lark-drive/references/lark-drive-permission-get-setting.md +48 -0
- package/skills/lark-drive/references/lark-drive-preview.md +11 -1
- package/skills/lark-drive/references/lark-drive-react-reply.md +51 -0
- package/skills/lark-drive/references/lark-drive-reactions.md +27 -25
- package/skills/lark-drive/references/lark-drive-resolve-comment.md +45 -0
- package/skills/lark-drive/references/lark-drive-restore-comment.md +46 -0
- package/skills/lark-drive/references/lark-drive-search.md +6 -1
- package/skills/lark-drive/references/lark-drive-secure-label.md +1 -1
- package/skills/lark-drive/references/lark-drive-update-reply.md +46 -0
- package/skills/lark-drive/references/lark-drive-workflow-permission-governance-commands.md +38 -8
- package/skills/lark-drive/references/lark-drive-workflow-permission-governance-outputs.md +10 -10
- package/skills/lark-drive/references/lark-drive-workflow-permission-governance.md +22 -20
- package/skills/lark-slides/SKILL.md +16 -26
- package/skills/lark-slides/references/lark-slides-create.md +14 -5
- package/skills/lark-slides/references/lark-slides-media-upload.md +1 -1
- package/skills/lark-slides/references/slides_xml_schema_definition.xml +491 -31
- package/skills/lark-slides/references/xml-schema-quick-ref.md +39 -0
- package/skills/lark-slides/scripts/sxsd_validator.py +908 -0
- package/skills/lark-slides/scripts/xml_text_overlap_lint.py +633 -124
- package/skills/lark-slides/scripts/xml_text_overlap_lint_test.py +2038 -219
- package/skills/lark-task/references/lark-task-create.md +9 -0
- package/skills/lark-drive/references/lark-drive-comments-guide.md +0 -80
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# +search-bot
|
|
2
|
+
|
|
3
|
+
按关键词搜索当前用户可见的机器人。仅支持 user 身份,需要 `search:bot` 权限。
|
|
4
|
+
|
|
5
|
+
- ✅ 用关键词搜索机器人并获取 open_id
|
|
6
|
+
- ✅ 一次搜索多个关键词(`--queries`)
|
|
7
|
+
- ✅ 在指定群范围内搜索机器人(`--chat-ids`)
|
|
8
|
+
|
|
9
|
+
## 参数
|
|
10
|
+
|
|
11
|
+
必须传 `--query` 或 `--queries`。`--chat-ids` 指定搜索范围,`--has-chatted` 筛选已聊过的机器人;两者都不能单独使用。
|
|
12
|
+
|
|
13
|
+
| Flag | 说明 |
|
|
14
|
+
|---|---|
|
|
15
|
+
| `--query <text>` | 搜索一个关键词,最多 50 个字符 |
|
|
16
|
+
| `--queries <csv>` | 并行搜索多个关键词,最多 20 个;每个最多 50 个字符。不能和 `--query` 一起使用 |
|
|
17
|
+
| `--chat-ids <csv>` | 只在指定群内搜索,最多 100 个群;支持群 ID 或群链接 |
|
|
18
|
+
| `--has-chatted` | 只返回聊过天的机器人;不需要时不要传此参数 |
|
|
19
|
+
| `--page-size <n>` | 返回条数,1–30,默认 20 |
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
lark-cli contact +search-bot --query '会议助手' --as user
|
|
23
|
+
lark-cli contact +search-bot --query '助手' --has-chatted --as user
|
|
24
|
+
lark-cli contact +search-bot --queries '会议助手,日报助手,审批助手' --as user
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 输出
|
|
28
|
+
|
|
29
|
+
| 字段 | 类型 | 说明 | 空值时 |
|
|
30
|
+
|---|---|---|---|
|
|
31
|
+
| `open_id` | string | 机器人 ID | 始终非空 |
|
|
32
|
+
| `name` | string | 机器人名称 | 空字符串 |
|
|
33
|
+
| `description` | string | 机器人简介 | 字段省略 |
|
|
34
|
+
| `chat_id` | string | 与机器人的单聊 ID | 空字符串 |
|
|
35
|
+
| `enable_join_group` | bool | 是否允许加入群聊 | — |
|
|
36
|
+
| `is_agent` | bool | 是否是智能体 | — |
|
|
37
|
+
| `tenant_id` | string | 租户标识 | 字段省略 |
|
|
38
|
+
| `match_segments` | string[] | 命中的文本片段 | 无命中时为 `[]` |
|
|
39
|
+
|
|
40
|
+
### 没有分页
|
|
41
|
+
|
|
42
|
+
不支持分页。`has_more=true` 时改用更具体的关键词,或调整搜索范围。
|
|
43
|
+
|
|
44
|
+
### 多条命中怎么选
|
|
45
|
+
|
|
46
|
+
命中多个机器人时,结合 `description` 和 `is_agent` 判断。后续要发消息或拉群时,让用户确认目标,不要直接选择第一条。
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
lark-cli contact +search-bot --query '会议助手' \
|
|
50
|
+
--jq '.data.bots[] | select((.description // "") | contains("<功能关键词>"))' --as user
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## fanout(`--queries`)
|
|
54
|
+
|
|
55
|
+
输出为 `{bots[], queries[], notice?}`。`has_more` 只出现在每个关键词的结果中。
|
|
56
|
+
|
|
57
|
+
- `bots[].matched_query`:该结果对应的关键词
|
|
58
|
+
- `queries[]`:每个关键词的执行结果,格式为 `{query, error?, has_more, notice?}`
|
|
59
|
+
- 部分关键词失败时保留其他结果;全部失败时命令报错
|
|
60
|
+
- `--chat-ids` 和 `--has-chatted` 对所有关键词生效
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: lark-drive
|
|
3
3
|
version: 1.0.0
|
|
4
|
-
description: "飞书云空间(云盘/云存储):管理 Drive
|
|
4
|
+
description: "飞书云空间(云盘/云存储):管理 Drive 文件和文件夹,包含上传/下载、创建文件夹、复制/移动/删除、查看元数据、查询权限设置、评论/权限/订阅、标题、版本、飞书文档密级标签(secure labels)和本地文件导入。用户需要整理云盘目录、处理云空间资源 URL/token、判断链接类型/真实 token/标题,或导入 Word/Markdown/Excel/CSV/PPTX/.base 为 docx/sheet/bitable/slides 时使用;doubao.com 云空间 URL/token 也按资源路径和 token 路由,不回退 WebFetch。不负责:文档内容编辑(走 lark-doc)、表格/Base 表内数据操作(走 lark-sheets/lark-base)、知识空间节点/成员管理(走 lark-wiki)、原生 Markdown 文件读写/patch/diff(走 lark-markdown)。"
|
|
5
5
|
metadata:
|
|
6
6
|
requires:
|
|
7
7
|
bins: ["lark-cli"]
|
|
@@ -27,13 +27,12 @@ metadata:
|
|
|
27
27
|
- 用户要**检查 / 治理文档权限、公开范围、链接分享、外部访问、复制下载权限、密级标签、owner 转移**,或要”权限风险报告、收紧权限、申请查看 / 编辑权限、转移 / 批量转移 owner”,必须先阅读 [`references/lark-drive-workflow.md`](references/lark-drive-workflow.md),再按其中 `Workflow Registry` 进入 [`permission_governance`](references/lark-drive-workflow-permission-governance.md) workflow。
|
|
28
28
|
- 用户要为指定飞书文档**设置 / 修改密级标签(secure label)**,或查询当前用户可用的密级标签,直接读取 [`references/lark-drive-secure-label.md`](references/lark-drive-secure-label.md);这是 Drive 文件治理能力。
|
|
29
29
|
- 用户要**检查 / 治理文档权限、公开范围、链接分享、外部访问、复制下载权限、密级标签、owner 转移**,或要“权限风险报告、收紧权限、申请查看 / 编辑权限、转移 / 批量转移 owner”,必须先阅读 [`references/lark-drive-workflow.md`](references/lark-drive-workflow.md),再按其中 `Workflow Registry` 进入 [`permission_governance`](references/lark-drive-workflow-permission-governance.md) workflow。
|
|
30
|
+
- 用户要**查询文件、文件夹或云文档自身的公开访问、分享、协作者管理、安全与评论权限设置**,优先使用 `lark-cli drive +permission-get-setting`;它只读取目标自身设置,不递归审计文件夹子文档权限。裸 token 必须显式传 `--type`。
|
|
30
31
|
- 用户要**按特定主题、关键词或内容线索跨容器查找资料,并统一收集到 Drive 文件夹或 Wiki 节点**,必须先阅读 [`references/lark-drive-workflow.md`](references/lark-drive-workflow.md),再按其中 `Workflow Registry` 进入 [`topic_move_collector`](references/lark-drive-workflow-topic-move-collector.md) workflow。该 workflow 负责搜索召回、内容验证、相关性分类、移动计划、写前确认和结果验证;禁止直接从 `drive +search` 或 `drive +move` 开始。
|
|
31
32
|
- 用户要**整理云盘 / 文件夹 / 文档库 / 知识库 / 个人文档库**,或要“盘点目录结构、找出未归档/临时/重复/空目录、生成整理方案”,必须先阅读 [`references/lark-drive-workflow.md`](references/lark-drive-workflow.md),再按其中 `Workflow Registry` 进入 [`knowledge_organize`](references/lark-drive-workflow-knowledge-organize.md) workflow。默认只生成方案;创建目录、移动资源、申请权限都必须单独确认。
|
|
32
33
|
- 按主题跨范围查找并集中归档,进入 `topic_move_collector`;对已知文件夹、文档库或知识库做目录盘点和结构重组,进入 `knowledge_organize`;只移动一个已明确资源时仍使用原子移动命令。
|
|
33
34
|
- 用户要**搜文档 / Wiki / 电子表格 / 多维表格 / 云空间(云盘/云存储)对象**,优先使用 `lark-cli drive +search`。自然语言里"最近我编辑过的"、"我创建的"(→ `--created-by-me`,原始创建者语义)、"我负责/owner 的"(→ `--mine`,owner 语义)、"最近一周我打开过的 xxx"、"某人 owner 的 docx" 等直接映射到扁平 flag,避免手写嵌套 JSON。
|
|
34
|
-
-
|
|
35
|
-
- 妙搭 apps 评论场景:除新增全文/局部评论不支持外,评论列表、批量查询、解决/恢复、回复创建/读取/更新/删除、reaction 添加/删除等评论管理能力已支持;使用原生命令时文档类型传 `apps`(`file_type=apps`),裸 token 调 shortcut 时传 `--type apps`。
|
|
36
|
-
- 用户要**根据文档评论定位正文位置**,例如 根据评论 review 文档、根据评论内容回看文档、区分多处相同引用文本时,对于 docx 类型(`file_type=docx`)的文档支持通过 `drive +list-comments --need-relation` 返回评论位置,其他类型会静默忽略该参数;具体用法需要先阅读 [`references/lark-drive-comment-location.md`](references/lark-drive-comment-location.md) 了解。
|
|
35
|
+
- 用户要对**文档评论**做任何操作(添加评论、列表 / 批量查询、回复、获取 / 更新 / 删除回复、解决 / 恢复、reaction),按下方 Shortcuts 表选择对应的 `drive +<verb>` 评论命令,执行前先阅读该命令的 ref。按评论定位文档正文位置见 [`references/lark-drive-comment-location.md`](references/lark-drive-comment-location.md)。
|
|
37
36
|
- 用户给出 doubao.com 的云空间资源 URL/token,或明确提到豆包里的 file/folder/docx/sheet/bitable/wiki 资源时,仍按资源类型、URL 路径和 token 路由到本 skill;不要因为域名不是飞书而回退到 WebFetch。
|
|
38
37
|
- 用户要把本地 `.xlsx` / `.csv` / `.base` 导入成 Base / 多维表格 / bitable,第一步必须使用 `lark-cli drive +import --type bitable`。
|
|
39
38
|
- 用户要把本地 `.md` / `.docx` / `.doc` / `.txt` / `.html` 导入成在线文档,使用 `lark-cli drive +import --type docx`。
|
|
@@ -44,7 +43,7 @@ metadata:
|
|
|
44
43
|
- 用户要查看、下载、回滚或删除文件的**历史版本**,使用 `drive +version-history`、`drive +version-get`、`drive +version-revert`、`drive +version-delete`;这组命令同时支持 `--as user` 和 `--as bot`,自动化场景优先 `--as bot`。
|
|
45
44
|
- 用户要把本地 `.xlsx` / `.xls` / `.csv` 导入成电子表格,使用 `lark-cli drive +import --type sheet`。
|
|
46
45
|
- 用户要在云空间(云盘/云存储)里新建文件夹,优先使用 `lark-cli drive +create-folder`。
|
|
47
|
-
-
|
|
46
|
+
- 用户要查看或下载文件内容,或者查看文件可用预览格式并获取 PDF / HTML / 文本 / 图片等转换预览产物,使用 `lark-cli drive +preview`。
|
|
48
47
|
- 用户要获取某个文件的封面图,优先使用 `lark-cli drive +cover`;先 `--list-only` 看规格,再选 `--spec` 下载。
|
|
49
48
|
- 用户要导出云文档时,优先使用 `lark-cli drive +export --url '<文档 URL>' --file-extension <格式>`;详细参数、Wiki token 和错误码处理见 [`references/lark-drive-export.md`](references/lark-drive-export.md)。
|
|
50
49
|
- 用户要把本地文件上传到知识库 / 文档库里的某个 wiki 节点下时,仍然使用 `lark-cli drive +upload --wiki-token <wiki_token>`;不要误切到 `wiki` 域命令。
|
|
@@ -69,7 +68,7 @@ metadata:
|
|
|
69
68
|
| `/doc/` | `https://example.larksuite.com/doc/doccnxxxxxxxxx` | `file_token` | URL 路径中的 token 直接作为 `file_token` 使用 |
|
|
70
69
|
| `/wiki/` | `https://example.larksuite.com/wiki/wikcnxxxxxxxxx` | `wiki_token` | 不能直接当底层 `file_token`;优先用 `drive +inspect` 解包获取 `obj_token` |
|
|
71
70
|
| `/sheets/` | `https://example.larksuite.com/sheets/shtcnxxxxxxxxx` | `file_token` | URL 路径中的 token 直接作为 `file_token` 使用 |
|
|
72
|
-
| `/page/` | `https://example.feishu.cn/page/
|
|
71
|
+
| `/page/` | `https://example.feishu.cn/page/pagcnxxxxxxxx/` | apps token | URL 路径中的 token 直接使用,资源类型为 `apps` |
|
|
73
72
|
| `/drive/folder/` | `https://example.larksuite.com/drive/folder/fldcnxxxx` | `folder_token` | URL 路径中的 token 作为文件夹 token 使用 |
|
|
74
73
|
|
|
75
74
|
### Wiki 链接特殊处理
|
|
@@ -85,28 +84,8 @@ lark-cli drive +inspect --url 'https://xxx.feishu.cn/wiki/wikcnXXX'
|
|
|
85
84
|
| 操作 | 需要的 Token | 说明 |
|
|
86
85
|
|------|-------------|------|
|
|
87
86
|
| 读取文档内容 | `file_token` / 通过 `docs +fetch` 自动处理 | `docs +fetch` 支持直接传入 URL |
|
|
88
|
-
| 添加局部评论(划词评论) | `file_token` | 传 `--block-id` 时,`drive +add-comment` 会创建局部评论;`docx` 支持文本定位或 block_id,`sheet` 使用 `<sheetId>!<cell>`,`slides` 使用 `<slide-block-type>!<xml-id>`;Base 只有记录局部评论,定位为 file_token(base_token) + `--block-id <table-id>!<record-id>!<view-id>` |
|
|
89
|
-
| 添加全文评论 | `file_token` | 不传 `--block-id` 时,`drive +add-comment` 默认创建全文评论;支持 `docx`、旧版 `doc` URL、白名单扩展名的 Drive file,以及最终解析为 `doc`/`docx`/`file` 的 wiki URL |
|
|
90
87
|
| 下载文件 | `file_token` | 从文件 URL 中直接提取 |
|
|
91
88
|
| 上传文件 | `folder_token` / `wiki_node_token` | 目标位置的 token |
|
|
92
|
-
| 列出文档评论 | URL 或 `file_token` | 优先使用 `drive +list-comments --url '<url>'`;wiki URL/token 会自动解析到底层真实 token/type;妙搭 apps URL 使用 `/page/<token>` |
|
|
93
|
-
|
|
94
|
-
### 评论能力入口
|
|
95
|
-
|
|
96
|
-
- 添加评论优先使用 [`+add-comment`](references/lark-drive-add-comment.md):review / 审阅 / 校对场景默认尽量创建局部评论,不要把多个可定位问题合并为一条全文评论。
|
|
97
|
-
- 获取评论列表优先使用 [`+list-comments`](references/lark-drive-list-comments.md):推荐传 `--url`,支持 wiki 自动解包;参数细节见 reference。
|
|
98
|
-
- 评论查询、统计、排序、回复限制,先读 [`lark-drive-comments-guide.md`](references/lark-drive-comments-guide.md)。
|
|
99
|
-
- 需要根据评论定位正文位置时,先确认目标是 `file_type=docx`,再读 [`lark-drive-comment-location.md`](references/lark-drive-comment-location.md),并使用 `drive +list-comments --need-relation`;其他文档类型会静默忽略该参数。
|
|
100
|
-
- reaction / 表情相关操作先读 [`lark-drive-reactions.md`](references/lark-drive-reactions.md);只有用户明确需要 reaction 信息时才带 `need_reaction=true`。
|
|
101
|
-
- `drive +add-comment` 的 `--content` 需要传 `reply_elements` JSON 数组字符串,例如 `--content '[{"type":"text","text":"正文"}]'`。
|
|
102
|
-
- `slides` 评论要求显式传 `--block-id <slide-block-type>!<xml-id>`;CLI 会将其拆分后写入 `anchor.block_id` 和 `anchor.slide_block_type`。其中 `<xml-id>` 是 PPT XML 协议中的元素 `id`;不支持 `--selection-with-ellipsis` 和 `--full-comment`。
|
|
103
|
-
- 评论写入内容(添加评论、回复评论、编辑回复)里的文本不能直接出现 `<`、`>`;提交前必须先转义:`<` -> `<`,`>` -> `>`。
|
|
104
|
-
- 使用 `drive +add-comment` 时,shortcut 会对 `type=text` 的文本元素自动做上述转义兜底;如果直接调用 `drive file.comments create_v2`、`drive file.comment.replys create`、`drive file.comment.replys update`,则需要在请求里自行传入已转义的内容。
|
|
105
|
-
- Base 记录局部评论使用 `--type bitable` / `--type base` 或 `/base/`、`/bitable/`、wiki Base 链接;`bitable` 和 Base 是同一概念,`bitable` 是内部代号、Base 是产品名,裸 token 推荐传 `bitable`,`base` 仅作为兼容别名兜底。
|
|
106
|
-
- Base 不支持全局评论,所有评论都挂在记录上;定位信息必须是 file token(base token)+ `--block-id <table-id>!<record-id>!<view-id>`,其中 table/record/view ID 通常分别以 `tbl`/`rec`/`vew` 开头。view_id 只决定被提及时点击通知打开哪个视图,不影响评论挂载点;只要在同一记录上都能看到评论,但必须传,否则通知无法确定跳转视图。ID 可通过 [`lark-base`](../lark-base/SKILL.md) 获取。
|
|
107
|
-
- 如果 wiki 解析后不是 `doc`/`docx`/`file`/`sheet`/`slides`/`bitable`/`base`,不要用 `+add-comment`。
|
|
108
|
-
- 如果需要更底层地直接调用评论 V2 协议,再走原生 API:先执行 `lark-cli schema drive.file.comments.create_v2`,再执行 `lark-cli drive file.comments create_v2 ...`。全文评论省略 `anchor`;docx/sheet/slides 局部评论传 `anchor.block_id`,Base 记录局部评论传 `anchor.block_id`(table_id)、`anchor.base_record_id`、`anchor.base_view_id`。
|
|
109
|
-
- 直接调用原生 `drive.file.comments.*` / `drive.file.comment.replys.*` 评论 Base 文档时,`file_type` 填 `bitable`,不要填 `base`。
|
|
110
89
|
|
|
111
90
|
### 典型错误与解决方案
|
|
112
91
|
|
|
@@ -120,6 +99,7 @@ lark-cli drive +inspect --url 'https://xxx.feishu.cn/wiki/wikcnXXX'
|
|
|
120
99
|
### 权限能力入口
|
|
121
100
|
|
|
122
101
|
- 用户要管理 Drive 文档/文件协作者、公开权限、授权当前应用访问文档,或处理 `permission.public.patch` 的 `91009` / `91010` / `91011` / `91012` 错误时,先读 [`lark-drive-permission-guide.md`](references/lark-drive-permission-guide.md)。
|
|
102
|
+
- 用户要查询文件、文件夹或云文档自身的公开访问、分享、协作者管理、安全与评论权限设置,使用 [`+permission-get-setting`](references/lark-drive-permission-get-setting.md);如果要递归审计文件夹下子文档权限,再进入 [`permission_governance`](references/lark-drive-workflow-permission-governance.md) workflow。
|
|
123
103
|
- 用户只是没有访问权限并希望向 owner 申请访问,优先使用 [`+apply-permission`](references/lark-drive-apply-permission.md)。
|
|
124
104
|
- 普通 scope、身份或登录问题仍按 [`lark-shared`](../lark-shared/SKILL.md) 处理;不要把租户安全策略、对外分享、密级拦截简单归类为缺 scope。
|
|
125
105
|
|
|
@@ -141,15 +121,23 @@ Shortcut 是对常用操作的高级封装(`lark-cli drive +<verb> [flags]`)
|
|
|
141
121
|
| [`+upload`](references/lark-drive-upload.md) | 上传本地文件到 Drive 文件夹或 wiki 节点;修改/重写/更新已有文件时优先覆盖上传,而不是直接上传一个新文件。 |
|
|
142
122
|
| [`+create-folder`](references/lark-drive-create-folder.md) | 新建 Drive 文件夹,支持父文件夹与 bot 创建后自动授权。 |
|
|
143
123
|
| [`+download`](references/lark-drive-download.md) | 下载 Drive 文件到本地。 |
|
|
144
|
-
| [`+preview`](references/lark-drive-preview.md) |
|
|
124
|
+
| [`+preview`](references/lark-drive-preview.md) | 查看或下载文件内容,或者查看文件可用预览格式并获取 PDF / HTML / 文本 / 图片等转换预览产物。 |
|
|
145
125
|
| [`+cover`](references/lark-drive-cover.md) | 查看或下载文件封面图规格。 |
|
|
146
126
|
| [`+status`](references/lark-drive-status.md) | 比较本地目录与 Drive 文件夹差异;默认按 SHA-256 精确比较,`--quick` 使用修改时间近似比较。 |
|
|
147
127
|
| [`+pull`](references/lark-drive-pull.md) | 从 Drive 拉取文件到本地目录,支持重复远端路径处理和增量模式。 |
|
|
148
128
|
| `+sync` | 双向同步本地目录与 Drive 文件夹:拉取 `new_remote`、推送 `new_local`,`modified` 按 `--on-conflict=remote-wins\|local-wins\|keep-both\|ask` 处理;`--quick` 用修改时间近似比较;`--on-duplicate-remote` 支持 `fail` / `newest` / `oldest`;只同步 `type=file`,跳过在线文档和 shortcut,且不会删除两端多余文件。 |
|
|
149
129
|
| [`+push`](references/lark-drive-push.md) | 将本地目录推送到 Drive 文件夹,支持 skip / smart / overwrite 与确认后删除远端。 |
|
|
150
130
|
| [`+create-shortcut`](references/lark-drive-create-shortcut.md) | 在另一个文件夹里创建现有 Drive 文件的快捷方式。 |
|
|
151
|
-
| [`+add-comment`](references/lark-drive-add-comment.md) | 给 doc/docx/file/sheet/slides/base(bitable)
|
|
152
|
-
| [`+list-comments`](references/lark-drive-list-comments.md) |
|
|
131
|
+
| [`+add-comment`](references/lark-drive-add-comment.md) | 给 doc/docx/file/sheet/slides/base(bitable) 添加全文/局部评论;不支持妙搭 apps。 |
|
|
132
|
+
| [`+list-comments`](references/lark-drive-list-comments.md) | 分页获取评论列表。 |
|
|
133
|
+
| [`+batch-query-comments`](references/lark-drive-batch-query-comments.md) | 按评论 ID 批量获取评论。 |
|
|
134
|
+
| [`+resolve-comment`](references/lark-drive-resolve-comment.md) | 把评论标记为已解决(`is_solved=true`)。 |
|
|
135
|
+
| [`+restore-comment`](references/lark-drive-restore-comment.md) | 恢复/重新打开已解决评论(`is_solved=false`)。 |
|
|
136
|
+
| [`+add-reply`](references/lark-drive-add-reply.md) | 给已有评论添加回复。 |
|
|
137
|
+
| [`+list-replies`](references/lark-drive-list-replies.md) | 分页获取某条评论下的回复。 |
|
|
138
|
+
| [`+update-reply`](references/lark-drive-update-reply.md) | 整体替换某条回复的内容。 |
|
|
139
|
+
| [`+delete-reply`](references/lark-drive-delete-reply.md) | 删除评论下的某条回复(高风险,需 `--yes`)。 |
|
|
140
|
+
| [`+react-reply`](references/lark-drive-react-reply.md) | 给回复加/删表情回应。 |
|
|
153
141
|
| [`+export`](references/lark-drive-export.md) | 将 doc/docx/sheet/bitable/slides 导出为本地文件。 |
|
|
154
142
|
| [`+export-download`](references/lark-drive-export-download.md) | 根据导出产物的 file_token 下载文件。 |
|
|
155
143
|
| [`+import`](references/lark-drive-import.md) | 将本地文件导入为飞书在线文档、表格、多维表格或幻灯片。 |
|
|
@@ -163,9 +151,12 @@ Shortcut 是对常用操作的高级封装(`lark-cli drive +<verb> [flags]`)
|
|
|
163
151
|
| [`+inspect`](references/lark-drive-inspect.md) | 检视 URL 的类型、标题和 canonical token;wiki URL 会自动解包到底层文档。 |
|
|
164
152
|
| [`+apply-permission`](references/lark-drive-apply-permission.md) | 以 user 身份向文档 owner 申请访问权限。 |
|
|
165
153
|
| [`+member-add`](references/lark-drive-member-add.md) | 添加一个或最多 10 个 Drive 文档、文件、文件夹或 wiki 节点协作者/授权成员;封装 Drive permission member create/batch_create,真实写入需要 `--yes`。 |
|
|
154
|
+
| [`+member-list`](references/lark-drive-member-list.md) | 查询 Drive 文档、文件、文件夹或 wiki 节点的协作者/授权成员列表。 |
|
|
155
|
+
| [`+permission-get-setting`](references/lark-drive-permission-get-setting.md) | 查询文件、文件夹或云文档自身的公开访问、分享、协作者管理、安全与评论权限设置;支持 URL 或裸 token + `--type`;不递归读取文件夹子文档权限。 |
|
|
166
156
|
| [`+secure-label-list`](references/lark-drive-secure-label.md) | 列出当前用户可用的密级标签。 |
|
|
167
157
|
| [`+secure-label-update`](references/lark-drive-secure-label.md) | 更新 Drive 文件或文档的密级标签。 |
|
|
168
158
|
|
|
159
|
+
|
|
169
160
|
## API Resources
|
|
170
161
|
|
|
171
162
|
```bash
|
|
@@ -184,20 +175,6 @@ lark-cli drive <resource> <method> [flags] # 调用 API
|
|
|
184
175
|
- `list` — 获取文件夹下的清单;使用前阅读 [`references/lark-drive-files-list.md`](references/lark-drive-files-list.md)
|
|
185
176
|
- `patch` — 修改文件标题
|
|
186
177
|
|
|
187
|
-
### file.comments
|
|
188
|
-
|
|
189
|
-
- `batch_query` — 批量获取评论
|
|
190
|
-
- `create_v2` — 添加全文/局部(划词)评论
|
|
191
|
-
- `list` — 分页获取文档评论
|
|
192
|
-
- `patch` — 解决/恢复 评论
|
|
193
|
-
|
|
194
|
-
### file.comment.replys
|
|
195
|
-
|
|
196
|
-
- `create` — 添加回复
|
|
197
|
-
- `delete` — 删除回复
|
|
198
|
-
- `list` — 获取回复
|
|
199
|
-
- `update` — 更新回复
|
|
200
|
-
|
|
201
178
|
### permission.members
|
|
202
179
|
|
|
203
180
|
- `auth` —
|
|
@@ -226,7 +203,7 @@ lark-cli drive <resource> <method> [flags] # 调用 API
|
|
|
226
203
|
|
|
227
204
|
### file.comment.reply.reactions
|
|
228
205
|
|
|
229
|
-
- `update_reaction` — 添加/删除 reaction
|
|
206
|
+
- `update_reaction` — 添加/删除 reaction;优先使用 `drive +react-reply`
|
|
230
207
|
|
|
231
208
|
### quota_details
|
|
232
209
|
|
|
@@ -159,6 +159,7 @@ lark-cli drive +add-comment \
|
|
|
159
159
|
|
|
160
160
|
## 行为说明
|
|
161
161
|
|
|
162
|
+
- **不支持妙搭 apps**:妙搭不支持新增评论,`--doc` 传 `/page/<token>` URL 或 `--type apps` 都不可用。其余评论管理命令(列表、批量查询、回复、解决/恢复、reaction)都支持 apps。
|
|
162
163
|
- **局部评论需要先获取 block ID**:先调用 `docs +fetch --doc <TOKEN> --detail with-ids` 获取带有 block ID 的文档内容,然后使用 `--block-id` 指定目标块。
|
|
163
164
|
- **Review 场景优先局部评论**:审阅、校对、逐条指出问题时,必须先尝试定位到具体 block / 单元格 / slide 元素,并逐问题创建局部评论;不要把所有问题合并成一条全文评论。
|
|
164
165
|
- 未传 `--block-id` 时,shortcut 默认创建**全文评论**;也可以显式传 `--full-comment`。全文评论支持 `docx`、旧版 `doc` URL、白名单扩展名的 Drive file,以及最终可解析为 `doc`/`docx`/`file` 的 wiki URL。
|
|
@@ -174,10 +175,7 @@ lark-cli drive +add-comment \
|
|
|
174
175
|
- `<img id="bPk" ... />` 对应 `--block-id img!bPk`,表示给图片元素评论。
|
|
175
176
|
- `<shape type="text" id="bPq">...</shape>` 对应 `--block-id shape!bPq`,表示给文本 shape 评论。
|
|
176
177
|
|
|
177
|
-
- `--content`
|
|
178
|
-
- `type=text` 的评论文本不能直接包含 `<`、`>`;应优先传 `<`、`>`。shortcut 在发送前也会自动将 `<`、`>` 转义为 `<`、`>` 作为兜底。
|
|
179
|
-
- **所有 `type=text` 元素的字符总和 ≤ 10000**(按字符算,中英文 / 符号一视同仁)。超过会被 shortcut 在发送前拒绝,并指出累计超长的元素。**拆成多个 text element 不能绕过这个上限**——上限是总额,不是每元素。需要更长内容就缩短或拆成多条评论。
|
|
180
|
-
- 长度限制只对 `type=text` 生效,`mention_user` / `link` 不计入。
|
|
178
|
+
- `--content` 是结构化评论元素数组(`text` / `mention_user` / `link`),完整格式见 [`lark-drive-comment-content.md`](lark-drive-comment-content.md);上方示例已覆盖常见写法。
|
|
181
179
|
- 写入评论前会自动生成符合 OpenAPI 定义的请求体;shortcut 用户只需要传 `--doc`、`--content`,局部评论再传对应格式的 `--block-id`。
|
|
182
180
|
- `--dry-run` 仅预览调用链和请求体,不会实际写入。
|
|
183
181
|
- 如果需要更底层的控制,仍可改用 `lark-cli schema drive.file.comments.create_v2` + `lark-cli drive file.comments create_v2`。
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# drive +add-reply
|
|
2
|
+
|
|
3
|
+
> **前置条件:** 先阅读 [`../../lark-shared/SKILL.md`](../../lark-shared/SKILL.md) 了解认证、全局参数和权限处理;`--content` 完整格式见 [`lark-drive-comment-content.md`](lark-drive-comment-content.md)。
|
|
4
|
+
|
|
5
|
+
给已有评论添加一条回复。
|
|
6
|
+
|
|
7
|
+
## 命令
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# 推荐:完整 URL + 目标评论 ID + 回复内容
|
|
11
|
+
lark-cli drive +add-reply --url "https://example.larksuite.com/docx/<DOCX_TOKEN>" --comment-id '<id>' --content '[{"type":"text","text":"回复内容"}]'
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## 参数
|
|
15
|
+
|
|
16
|
+
| 参数 | 必填 | 说明 |
|
|
17
|
+
|---|---|---|
|
|
18
|
+
| `--url` | 与 `--token` 二选一 | 推荐入口。支持 doc/docx/sheet/file/slides/base/bitable/apps/wiki URL;apps 妙搭 URL 使用 `/page/<token>`;wiki URL 会自动解析到真实文档。 |
|
|
19
|
+
| `--token` | 与 `--url` 二选一 | 裸 token 或 URL。裸 token 必须搭配 `--type`;wiki token 使用 `--type wiki`。 |
|
|
20
|
+
| `--type` | 裸 token 时必填 | 传 token 对应类型:`doc`、`docx`、`sheet`、`file`、`slides`、`bitable`、`base`、`apps`、`wiki`。wiki token 使用 `wiki`;传 `base` 时,CLI 会按 `bitable` 类型处理。 |
|
|
21
|
+
| `--comment-id` | 是 | 要回复的评论 ID;来自 `drive +list-comments` 的 `items[].comment_id` |
|
|
22
|
+
| `--content` | 是 | `reply_elements` JSON,`type=text` 文本自动转义;完整 schema、mention_user/link、10000 字符限制见 [`lark-drive-comment-content.md`](lark-drive-comment-content.md) |
|
|
23
|
+
|
|
24
|
+
## 回复限制
|
|
25
|
+
|
|
26
|
+
- `is_whole=true` 的全文评论、`is_solved=true` 的已解决评论都不能回复。
|
|
27
|
+
- 目标的 `is_whole` / `is_solved` 通常在上一步 `+list-comments` / `+batch-query-comments` 的结果里已有,据此判断即可;信息不足时再补查一次。
|
|
28
|
+
- 补查时注意 `+list-comments` 默认只返回未解决评论:要核对某条评论是否已被解决,需要带 `--solved-status all`,否则已解决评论根本不出现在结果里,看起来像评论不存在。
|
|
29
|
+
- 命中限制时如实提示(“全文评论不支持回复” / “该评论已被解决,无法回复”),不要自动替用户改回复到别的评论。
|
|
30
|
+
|
|
31
|
+
## 输出
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"file_token": "docx_token",
|
|
36
|
+
"file_type": "docx",
|
|
37
|
+
"comment_id": "<comment_id>",
|
|
38
|
+
"created": true,
|
|
39
|
+
"reply_id": "<reply_id>"
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 参考
|
|
44
|
+
|
|
45
|
+
- [lark-drive-comment-content](lark-drive-comment-content.md) -- `--content` 格式
|
|
46
|
+
- [lark-drive-batch-query-comments](lark-drive-batch-query-comments.md) -- 按 ID 查 is_whole/is_solved
|
|
47
|
+
- [lark-drive-list-replies](lark-drive-list-replies.md) -- 获取回复
|
|
@@ -34,8 +34,8 @@ lark-cli drive +apply-permission \
|
|
|
34
34
|
|
|
35
35
|
| 参数 | 必填 | 说明 |
|
|
36
36
|
|------|------|------|
|
|
37
|
-
| `--token` | 是 | 目标文档 token 或完整 URL(`/docx/`、`/sheets/`、`/base/`、`/bitable/`、`/file/`、`/wiki/`、`/doc/`、`/mindnote/`、`/slides/` 路径里的 token 会被自动提取) |
|
|
38
|
-
| `--type` | 否 | 目标类型,可选值 `doc` / `sheet` / `file` / `wiki` / `bitable` / `docx` / `mindnote` / `slides`。传 URL
|
|
37
|
+
| `--token` | 是 | 目标文档 token 或完整 URL(`/docx/`、`/sheets/`、`/base/`、`/bitable/`、`/file/`、`/wiki/`、`/doc/`、`/mindnote/`、`/slides/`、`/page/` 路径里的 token 会被自动提取) |
|
|
38
|
+
| `--type` | 否 | 目标类型,可选值 `doc` / `sheet` / `file` / `wiki` / `bitable` / `docx` / `mindnote` / `slides` / `apps`。传 URL 时由 shortcut 自动推断;如显式传入,必须与 URL 路径类型一致。bare token 必须显式传 |
|
|
39
39
|
| `--perm` | 是 | 申请的权限,仅支持 `view` 或 `edit`(**不支持 `full_access`**,CLI 侧会直接拒绝) |
|
|
40
40
|
| `--remark` | 否 | 备注,会显示在权限申请卡片上 |
|
|
41
41
|
| `--dry-run` | 否 | 仅打印请求内容,不实际发送 |
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# drive +batch-query-comments
|
|
2
|
+
|
|
3
|
+
> **前置条件:** 先阅读 [`../../lark-shared/SKILL.md`](../../lark-shared/SKILL.md) 了解认证、全局参数和权限处理。
|
|
4
|
+
|
|
5
|
+
按评论 ID 批量获取评论卡片。已知 comment_id 时用它精确取;要分页遍历、全量统计或找最新/最早评论,用 [`lark-drive-list-comments.md`](lark-drive-list-comments.md)。
|
|
6
|
+
|
|
7
|
+
## 命令
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# 推荐:完整 URL + 评论 ID(逗号分隔或重复 --comment-ids,单次上限 100)
|
|
11
|
+
lark-cli drive +batch-query-comments --url "https://example.larksuite.com/docx/<DOCX_TOKEN>" --comment-ids '<id1>,<id2>'
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## 参数
|
|
15
|
+
|
|
16
|
+
| 参数 | 必填 | 说明 |
|
|
17
|
+
|---|---|---|
|
|
18
|
+
| `--url` | 与 `--token` 二选一 | 推荐入口。支持 doc/docx/sheet/file/slides/base/bitable/apps/wiki URL;apps 妙搭 URL 使用 `/page/<token>`;wiki URL 会自动解析到真实文档。 |
|
|
19
|
+
| `--token` | 与 `--url` 二选一 | 裸 token 或 URL。裸 token 必须搭配 `--type`;wiki token 使用 `--type wiki`。 |
|
|
20
|
+
| `--type` | 裸 token 时必填 | 传 token 对应类型:`doc`、`docx`、`sheet`、`file`、`slides`、`bitable`、`base`、`apps`、`wiki`。wiki token 使用 `wiki`;传 `base` 时,CLI 会按 `bitable` 类型处理。 |
|
|
21
|
+
| `--comment-ids` | 是 | 评论 ID,逗号分隔或重复传,单次最多 100 个;来自 `drive +list-comments` 的 `items[].comment_id` |
|
|
22
|
+
| `--need-reaction` | 否 | 返回评论卡片上的 reaction 数据,见 [`lark-drive-reactions.md`](lark-drive-reactions.md) |
|
|
23
|
+
| `--need-relation` | 否 | docx 评论定位关系;仅 docx 生效,非 docx 静默忽略,见 [`lark-drive-comment-location.md`](lark-drive-comment-location.md) |
|
|
24
|
+
|
|
25
|
+
## 行为说明
|
|
26
|
+
|
|
27
|
+
- `--need-relation` 通过请求 **body** 发送(`+list-comments` 是 query param),只在解析后的目标是 docx 时发送;该参数未收录于平台 metadata,但服务端支持,返回 `items[].relation` 及块位置。
|
|
28
|
+
- 输出的 `items` 始终是 JSON 数组(服务端省略时归一化为 `[]`),外层补 `file_token`、`file_type`、`count`。
|
|
29
|
+
|
|
30
|
+
## 输出
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"file_token": "docx_token",
|
|
35
|
+
"file_type": "docx",
|
|
36
|
+
"items": [],
|
|
37
|
+
"count": 0
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`items` 是命中的评论卡片数组(外层补 `file_token`/`file_type`,wiki 输入再加 `wiki_token`);`count` 是命中数。
|
|
42
|
+
|
|
43
|
+
## 参考
|
|
44
|
+
|
|
45
|
+
- [lark-drive-list-comments](lark-drive-list-comments.md) -- 分页获取评论列表
|
|
46
|
+
- [lark-drive-comment-location](lark-drive-comment-location.md) -- `need_relation` 评论定位
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Drive 评论内容格式(--content)
|
|
2
|
+
|
|
3
|
+
> 本文是写入类评论命令(`+add-comment` / `+add-reply` / `+update-reply`)共享的 `--content` 内容格式说明,由这三个命令的 ref 引用。
|
|
4
|
+
|
|
5
|
+
`drive +add-comment`、`drive +add-reply`、`drive +update-reply` 的 `--content` 使用同一套 `reply_elements` JSON 数组格式。本文集中说明 schema、元素类型、转义和长度限制,各命令 ref 只保留最常见的纯文本例子。
|
|
6
|
+
|
|
7
|
+
## Schema
|
|
8
|
+
|
|
9
|
+
`--content` 是一个 JSON 数组字符串,至少一个元素。每个元素按 `type` 用对应字段承载值:
|
|
10
|
+
|
|
11
|
+
| type | 字段 | 值 |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| `text` | `text` | 普通文本正文 |
|
|
14
|
+
| `mention_user` | `mention_user` | 被 @ 用户的 open_id |
|
|
15
|
+
| `link` | `link` | 飞书云文档链接(docx/doc/sheet/bitable/wiki 等云文档 URL;对应 wire `docs_link`) |
|
|
16
|
+
|
|
17
|
+
最常见就是单个纯文本元素:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
--content '[{"type":"text","text":"评论正文"}]'
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
组合多种元素:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
--content '[
|
|
27
|
+
{"type":"text","text":"请 "},
|
|
28
|
+
{"type":"mention_user","mention_user":"ou_xxx"},
|
|
29
|
+
{"type":"text","text":" 看下 "},
|
|
30
|
+
{"type":"link","link":"https://your-tenant.feishu.cn/docx/<TOKEN>"}
|
|
31
|
+
]'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- `type=text` 的 `text` 不能为空;未知 `type` 会被拒绝,只允许 `text` / `mention_user` / `link`。
|
|
35
|
+
- 为省事,`mention_user` / `link` 的值也可以直接放在 `text` 字段(如 `{"type":"mention_user","text":"ou_xxx"}`),CLI 会识别;推荐用上表的专属字段,语义更清晰。
|
|
36
|
+
- `link` 是**飞书云文档链接**(wire 类型就叫 `docs_link`),不是任意网页链接。回复类命令(`+add-reply` / `+update-reply`)会校验,传外部 URL 被服务端拒绝(`1069302`),只接受飞书云文档 URL;`+add-comment` 对外部 URL 较宽松(能写入),但外部链接未必按云文档链接渲染,仍建议只放云文档 URL。
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## 长度限制
|
|
40
|
+
|
|
41
|
+
- 所有 `type=text` 元素的字符(rune)总和上限 10000,按原始输入的字符数计(中英文、符号一视同仁,不是字节数、也不是转义后的长度)。
|
|
42
|
+
- 这是对**总额**的限制:把一段长文本拆成多个 text 元素不能绕过,它们共用同一个 10000 字符预算。
|
|
43
|
+
- `mention_user` / `link` 不计入该长度。
|
|
44
|
+
- 超限时 shortcut 在发送前拒绝并指出累计超长的元素;服务端对超限返回不透明的 `[1069302]`,所以这是预检。
|
|
45
|
+
|
|
46
|
+
## 参考
|
|
47
|
+
|
|
48
|
+
- [lark-drive-add-comment](lark-drive-add-comment.md) -- 添加评论
|
|
49
|
+
- [lark-drive-add-reply](lark-drive-add-reply.md) -- 回复评论
|
|
50
|
+
- [lark-drive-update-reply](lark-drive-update-reply.md) -- 更新回复
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# 文档评论定位字段
|
|
2
2
|
|
|
3
|
-
当用户需要根据评论定位文档正文位置、对文档做 review、区分多处相同引用文本,或把评论落点映射到 `docs +fetch --detail with-ids` 的内容时,优先使用 `drive +list-comments --need-relation` 查询 docx
|
|
3
|
+
当用户需要根据评论定位文档正文位置、对文档做 review、区分多处相同引用文本,或把评论落点映射到 `docs +fetch --detail with-ids` 的内容时,优先使用 `drive +list-comments --need-relation` 查询 docx 评论位置;已知评论 ID 时用 `drive +batch-query-comments --need-relation`。
|
|
4
4
|
|
|
5
5
|
## 适用范围
|
|
6
6
|
|
|
7
7
|
- 当前只有 `file_type=docx` 支持通过 `need_relation=true` 查询评论的位置,并返回可用于定位正文 block 的 `relation`、`parent_type`、`parent_token` 等字段。
|
|
8
|
-
- `drive +list-comments`
|
|
8
|
+
- `drive +list-comments` 和 `drive +batch-query-comments` 都会在目标不是 docx 时静默忽略 `--need-relation`,避免把无效参数传给 OpenAPI。遇到 sheet、bitable、slides、普通文件等类型的评论时,不要承诺可以用 `need_relation` 精确定位正文位置,应退回普通评论字段、对应资源能力下钻或人工确认。
|
|
9
|
+
- 注意参数位置差异:list 的 `need_relation` 在 query params,batch_query 的在请求 body(直接调 raw OpenAPI 时才需要关心;两个 shortcut 已各自处理)。
|
|
9
10
|
|
|
10
11
|
## 调用方式
|
|
11
12
|
|
|
@@ -21,20 +22,13 @@ lark-cli drive +list-comments --url '<docx_or_wiki_url>' --need-relation
|
|
|
21
22
|
lark-cli drive +list-comments --token '<wiki_token>' --type wiki --need-relation
|
|
22
23
|
```
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
已知评论 ID 时,用 `drive +batch-query-comments --need-relation` 直接按 ID 取:
|
|
25
26
|
|
|
26
27
|
```bash
|
|
27
|
-
lark-cli drive
|
|
28
|
-
--params '{"file_token":"<doc_token>","file_type":"docx","is_solved":false,"need_relation":true}'
|
|
28
|
+
lark-cli drive +batch-query-comments --url '<docx_or_wiki_url>' --comment-ids '<comment_id>' --need-relation
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
lark-cli drive file.comments batch_query \
|
|
35
|
-
--params '{"file_token":"<doc_token>","file_type":"docx"}' \
|
|
36
|
-
--data '{"comment_ids":["<comment_id>"],"need_relation":true}'
|
|
37
|
-
```
|
|
31
|
+
只有在需要 shortcut 未暴露的底层参数时,才直接调 raw OpenAPI(两个 shortcut 已各自处理 `need_relation` 的位置差异:list 在 query params,batch_query 在请求 body)。
|
|
38
32
|
|
|
39
33
|
同时获取文档内容,并要求返回 block id:
|
|
40
34
|
|
|
@@ -138,7 +132,7 @@ lark-cli docs +fetch --doc '<doc_token_or_url>' --detail with-ids
|
|
|
138
132
|
## 定位流程
|
|
139
133
|
|
|
140
134
|
1. 确认目标是 `file_type=docx`;只有 docx 文档支持通过 `need_relation` 查询评论位置。
|
|
141
|
-
2. 用 `drive +list-comments --need-relation` 获取评论;已知评论 ID
|
|
135
|
+
2. 用 `drive +list-comments --need-relation` 获取评论;已知评论 ID 且需要批量查询时,用 `drive +batch-query-comments --need-relation`。原生 `drive file.comments list/batch_query` 仅在需要 shortcut 未暴露的底层参数时兜底。
|
|
142
136
|
3. 用 `docs +fetch --detail with-ids` 获取文档内容。
|
|
143
137
|
4. 对每条评论先看 `relation`:
|
|
144
138
|
- 如果存在 `relation.relation`,解析这个 JSON 字符串。
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# drive +delete-reply
|
|
2
|
+
|
|
3
|
+
> **前置条件:** 先阅读 [`../../lark-shared/SKILL.md`](../../lark-shared/SKILL.md) 了解认证、全局参数和权限处理。
|
|
4
|
+
|
|
5
|
+
删除某条回复。**高风险写操作**:真实执行需要按 [`../../lark-shared/SKILL.md`](../../lark-shared/SKILL.md) 的高风险审批协议向用户确认后追加 `--yes`;删除不可恢复。
|
|
6
|
+
|
|
7
|
+
## 命令
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# 先预览(--dry-run 不需要 --yes)
|
|
11
|
+
lark-cli drive +delete-reply --url "https://example.larksuite.com/docx/<DOCX_TOKEN>" --comment-id '<id>' --reply-id '<id>' --dry-run
|
|
12
|
+
|
|
13
|
+
# 确认后真实删除(把 --dry-run 换成 --yes)
|
|
14
|
+
lark-cli drive +delete-reply --url "https://example.larksuite.com/docx/<DOCX_TOKEN>" --comment-id '<id>' --reply-id '<id>' --yes
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 参数
|
|
18
|
+
|
|
19
|
+
| 参数 | 必填 | 说明 |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| `--url` | 与 `--token` 二选一 | 推荐入口。支持 doc/docx/sheet/file/slides/base/bitable/apps/wiki URL;apps 妙搭 URL 使用 `/page/<token>`;wiki URL 会自动解析到真实文档。 |
|
|
22
|
+
| `--token` | 与 `--url` 二选一 | 裸 token 或 URL。裸 token 必须搭配 `--type`;wiki token 使用 `--type wiki`。 |
|
|
23
|
+
| `--type` | 裸 token 时必填 | 传 token 对应类型:`doc`、`docx`、`sheet`、`file`、`slides`、`bitable`、`base`、`apps`、`wiki`。wiki token 使用 `wiki`;传 `base` 时,CLI 会按 `bitable` 类型处理。 |
|
|
24
|
+
| `--comment-id` | 是 | 回复所属的评论 ID;来自 `drive +list-comments` |
|
|
25
|
+
| `--reply-id` | 是 | 要删除的回复 ID;来自 `drive +list-replies` 的 `items[].reply_id`,或 `drive +list-comments` 的 `items[].reply_list.replies[].reply_id` |
|
|
26
|
+
| `--yes` | 真实执行时是 | 高风险确认;`--dry-run` 预览不需要 |
|
|
27
|
+
|
|
28
|
+
## 行为说明
|
|
29
|
+
|
|
30
|
+
- 删除永久生效,回复没有回收站或撤销。
|
|
31
|
+
- 删除按 reply 逐条生效:删除某条回复(包括第一条/根回复)不影响其它回复;把该评论卡片下的所有回复都删完后,评论卡片在前端页面才不再显示。
|
|
32
|
+
- **删除整条评论没有专门的命令,需要用本命令删光该卡片下的所有回复**(先用 `drive +list-replies` 拉全回复 id)。删除前先和用户确认删的是某条回复还是整条评论。
|
|
33
|
+
|
|
34
|
+
## 输出
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"file_token": "docx_token",
|
|
39
|
+
"file_type": "docx",
|
|
40
|
+
"comment_id": "<comment_id>",
|
|
41
|
+
"reply_id": "<reply_id>",
|
|
42
|
+
"deleted": true
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## 参考
|
|
47
|
+
|
|
48
|
+
- [lark-drive-list-replies](lark-drive-list-replies.md) -- 获取回复与 reply_id
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
# 下载到指定路径
|
|
12
12
|
lark-cli drive +download --file-token boxbc_xxx --output ./report.pdf
|
|
13
13
|
|
|
14
|
-
# 只提供 token
|
|
14
|
+
# 只提供 token,默认保存到当前目录
|
|
15
15
|
lark-cli drive +download --file-token boxbc_xxx
|
|
16
16
|
```
|
|
17
17
|
|
|
@@ -25,6 +25,10 @@ https://xxx.feishu.cn/drive/file/boxbc_xxx
|
|
|
25
25
|
file_token
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
## 排障
|
|
29
|
+
|
|
30
|
+
- 如果返回 `HTTP 403`,可以使用 [lark-drive-preview](lark-drive-preview.md) 下载源文件产物。
|
|
31
|
+
|
|
28
32
|
## 参考
|
|
29
33
|
|
|
30
34
|
- [lark-drive](../SKILL.md) -- 云空间(云盘/云存储)全部命令
|