@amaster.ai/pi-lark 0.1.2-beta.53 → 0.1.2-beta.55
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 +2 -2
- package/skills/lark-apps/SKILL.md +29 -2
- package/skills/lark-base/SKILL.md +4 -3
- package/skills/lark-base/references/lark-base-data-query-guide.md +8 -0
- package/skills/lark-base/references/lark-base-field-create.md +19 -8
- package/skills/lark-base/references/lark-base-field-json.md +3 -2
- package/skills/lark-doc/SKILL.md +25 -61
- package/skills/lark-doc/references/genres/business-analysis.md +30 -0
- package/skills/lark-doc/references/genres/data-report.md +32 -0
- package/skills/lark-doc/references/genres/email.md +38 -0
- package/skills/lark-doc/references/genres/execution-plan.md +27 -0
- package/skills/lark-doc/references/genres/formal-doc.md +37 -0
- package/skills/lark-doc/references/genres/meeting-minutes.md +24 -0
- package/skills/lark-doc/references/genres/memo-brief.md +25 -0
- package/skills/lark-doc/references/genres/official-redhead.md +73 -0
- package/skills/lark-doc/references/genres/prd.md +26 -0
- package/skills/lark-doc/references/genres/proposal.md +24 -0
- package/skills/lark-doc/references/genres/research-report.md +32 -0
- package/skills/lark-doc/references/genres/retrospective.md +25 -0
- package/skills/lark-doc/references/genres/route-consumer.md +37 -0
- package/skills/lark-doc/references/genres/route-creative.md +36 -0
- package/skills/lark-doc/references/genres/route-knowledge.md +39 -0
- package/skills/lark-doc/references/genres/route-marketing.md +40 -0
- package/skills/lark-doc/references/genres/route-media.md +36 -0
- package/skills/lark-doc/references/genres/route-opinion.md +38 -0
- package/skills/lark-doc/references/genres/route-personal-brand.md +36 -0
- package/skills/lark-doc/references/genres/route-platform.md +9 -0
- package/skills/lark-doc/references/genres/route-report.md +10 -0
- package/skills/lark-doc/references/genres/route-workplace.md +17 -0
- package/skills/lark-doc/references/genres/sop-tutorial.md +41 -0
- package/skills/lark-doc/references/genres/technical-doc.md +39 -0
- package/skills/lark-doc/references/genres/wechat.md +39 -0
- package/skills/lark-doc/references/genres/weekly-report.md +24 -0
- package/skills/lark-doc/references/genres/white-paper.md +32 -0
- package/skills/lark-doc/references/genres/xiaohongshu.md +38 -0
- package/skills/lark-doc/references/lark-doc-create-workflow.md +121 -0
- package/skills/lark-doc/references/lark-doc-create.md +22 -48
- package/skills/lark-doc/references/lark-doc-fetch.md +75 -92
- package/skills/lark-doc/references/lark-doc-history.md +3 -1
- package/skills/lark-doc/references/lark-doc-md.md +5 -1
- package/skills/lark-doc/references/lark-doc-media-download.md +2 -1
- package/skills/lark-doc/references/lark-doc-script.md +76 -0
- package/skills/lark-doc/references/lark-doc-update.md +70 -222
- package/skills/lark-doc/references/lark-doc-whiteboard.md +5 -9
- package/skills/lark-doc/references/lark-doc-xml-extended-blocks.md +17 -12
- package/skills/lark-doc/references/lark-doc-xml.md +38 -167
- package/skills/lark-drive/SKILL.md +1 -1
- package/skills/lark-drive/references/lark-drive-download.md +29 -2
- package/skills/lark-drive/references/lark-drive-preview.md +21 -2
- package/skills/lark-im/SKILL.md +3 -3
- package/skills/lark-im/references/lark-im-messages-resources-download.md +19 -25
- package/skills/lark-slides/SKILL.md +57 -59
- package/skills/lark-slides/references/cli/lark-slides-create.md +176 -0
- package/skills/lark-slides/references/cli/lark-slides-history.md +132 -0
- package/skills/lark-slides/references/cli/lark-slides-media-upload.md +104 -0
- package/skills/lark-slides/references/cli/lark-slides-replace-slide.md +258 -0
- package/skills/lark-slides/references/cli/lark-slides-screenshot.md +115 -0
- package/skills/lark-slides/references/cli/lark-slides-xml-presentation-slide-get.md +110 -0
- package/skills/lark-slides/references/cli/lark-slides-xml-presentation-slide-replace.md +188 -0
- package/skills/lark-slides/references/cli/lark-slides-xml-presentations-get.md +157 -0
- package/skills/lark-slides/references/iconpark-index.json +5 -41901
- package/skills/lark-slides/references/iconpark.md +3 -44
- package/skills/lark-slides/references/lark-slides-add-slide.md +3 -90
- package/skills/lark-slides/references/lark-slides-create.md +3 -143
- package/skills/lark-slides/references/lark-slides-delete-slide.md +3 -63
- package/skills/lark-slides/references/lark-slides-edit-workflows.md +3 -144
- package/skills/lark-slides/references/lark-slides-history.md +3 -130
- package/skills/lark-slides/references/lark-slides-media-upload.md +3 -102
- package/skills/lark-slides/references/lark-slides-pptx-template-workflows.md +3 -83
- package/skills/lark-slides/references/lark-slides-replace-slide.md +3 -256
- package/skills/lark-slides/references/lark-slides-screenshot.md +3 -113
- package/skills/lark-slides/references/lark-slides-update-slide.md +146 -0
- package/skills/lark-slides/references/lark-slides-xml-presentation-slide-get.md +3 -108
- package/skills/lark-slides/references/lark-slides-xml-presentation-slide-replace.md +3 -186
- package/skills/lark-slides/references/lark-slides-xml-presentations-get.md +3 -132
- package/skills/lark-slides/references/planning-layer.md +1 -1
- package/skills/lark-slides/references/slides_chart_demo.xml +5 -1416
- package/skills/lark-slides/references/slides_xml_schema_definition.xml +3 -3512
- package/skills/lark-slides/references/troubleshooting.md +3 -60
- package/skills/lark-slides/references/validation-checklist.md +3 -154
- package/skills/lark-slides/references/workflow/error-handling.md +62 -0
- package/skills/lark-slides/references/workflow/slides_editing.md +143 -0
- package/skills/lark-slides/references/workflow/template-editing.md +85 -0
- package/skills/lark-slides/references/workflow/validation-xml.md +156 -0
- package/skills/lark-slides/references/xml/iconpark-index.json +37458 -0
- package/skills/lark-slides/references/xml/iconpark.md +46 -0
- package/skills/lark-slides/references/xml/lark-slides-add-slide.md +92 -0
- package/skills/lark-slides/references/xml/lark-slides-delete-slide.md +65 -0
- package/skills/lark-slides/references/xml/slides_chart_demo.xml +1415 -0
- package/skills/lark-slides/references/xml/slides_xml_schema_definition.xml +3514 -0
- package/skills/lark-slides/references/xml/xml-schema-quick-ref.md +497 -0
- package/skills/lark-slides/references/xml-schema-quick-ref.md +3 -497
- package/skills/lark-slides/scripts/iconpark_tool.py +1 -1
- package/skills/lark-slides/scripts/xml_lint.py +2989 -0
- package/skills/lark-slides/scripts/xml_lint_test.py +4720 -0
- package/skills/lark-slides/scripts/xml_text_overlap_lint.py +3 -2975
- package/skills/lark-slides/scripts/xml_text_overlap_lint_test.py +5 -4712
- package/skills/lark-wiki/SKILL.md +3 -1
- package/skills/lark-wiki/references/lark-wiki-node-copy.md +4 -19
- package/skills/lark-doc/references/lark-doc-word-stat.md +0 -93
- package/skills/lark-doc/references/style/lark-doc-create-workflow.md +0 -47
- package/skills/lark-doc/references/style/lark-doc-style.md +0 -68
- package/skills/lark-doc/references/style/lark-doc-update-workflow.md +0 -48
- package/skills/lark-doc/scripts/doc_word_stat.py +0 -1243
- /package/skills/lark-slides/references/{lark-slides-replace-pages.md → cli/lark-slides-replace-pages.md} +0 -0
|
@@ -1,183 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
# 一、标准 HTML 标签
|
|
4
|
-
p, h1-h9, ul, ol, li, table, thead, tbody, tr, th, td, blockquote, pre, code, hr, img, b, em, u, del, a, br, span 语义不变
|
|
5
|
-
|
|
6
|
-
# 二、扩展标签速查表
|
|
7
|
-
## 块级标签
|
|
8
|
-
|标签|说明|关键属性|
|
|
9
|
-
|-|-|-|
|
|
10
|
-
| `<title>` | 文档标题(每篇唯一)| `align` |
|
|
11
|
-
| `<checkbox>` | 待办项| `done="true"\|"false"` |
|
|
12
|
-
|
|
13
|
-
## 容器标签
|
|
14
|
-
|标签|说明|关键属性|
|
|
15
|
-
|-|-|-|
|
|
16
|
-
| `<callout>` | 高亮框,子块仅支持文本块(如 `<p>`)、标题、列表、待办、引用;禁止裸文本及 `<table>`、`<img>`、`<pre>`、`<hr>`、`<grid>`、`<whiteboard>`、`<sheet>` 等其他块级标签或资源块 | `emoji`(默认 bulb), `background-color`, `border-color`, `text-color` |
|
|
17
|
-
| `<grid>` + `<column>` | 分栏布局,各列 width-ratio 之和为 1 | `width-ratio` |
|
|
18
|
-
| `<whiteboard>` | 嵌入画板 | `type`: `blank` \| `mermaid` \| `plantuml` \| `svg` |
|
|
19
|
-
| `<pre>` | (代码块,内含 `code`)| `lang`, `caption` |
|
|
20
|
-
| `<figure>` | 视图容器 | `view-type` |
|
|
21
|
-
| `<bookmark>` | 书签链接 | `<bookmark name="标题" href="https://..."></bookmark>`,必传 name 和 href |
|
|
22
|
-
|
|
23
|
-
## 行内组件
|
|
24
|
-
| 标签 | 说明 | 关键属性 |
|
|
25
|
-
|-|-|-|
|
|
26
|
-
| `<cite type="user">` | @人 | XML 导入时必须显式传入 `user-id`:`<cite type="user" user-id="userID"></cite>` |
|
|
27
|
-
| `<cite type="doc">` | @文档 | `<cite type="doc" doc-id="docx_token"></cite>` |
|
|
28
|
-
| `<latex>` | 行内公式 | `<latex>E = mc^2</latex>` |
|
|
29
|
-
| `<img>` | 图片(可独立成块或内联) | `<img width="800" height="600" caption="说明" name="图.png" href="http 或 https"/>` |
|
|
30
|
-
| `<source>` | 文件附件(可独立成块或内联) | `<source name="报告.pdf"/>` |
|
|
31
|
-
| `<a type="url-preview">` | 预览卡片 | `<a type="url-preview" href="...">标题</a>` |
|
|
32
|
-
| `<button>` | 操作按钮 | `background-color`、`src`,必须包含 `action=OpenLink\|DuplicatePage\|FollowPage` |
|
|
33
|
-
| `<time>` | 提醒 | 必包含 `expire-time`、`notify-time`(毫秒时间戳)、`should-notify=true\|false` |
|
|
34
|
-
|
|
35
|
-
## 文本块通用属性
|
|
36
|
-
- `align` — `"left"`|`"center"`|`"right"`(适用于 p / h1-h9 / li / checkbox)
|
|
37
|
-
- 有序列表项用 `seq="auto"` 自动编号
|
|
38
|
-
|
|
39
|
-
# 三、资源块
|
|
40
|
-
|
|
41
|
-
文档中可嵌入外部资源块(属于容器标签的特殊形式),需要额外语法创建:
|
|
42
|
-
|
|
43
|
-
- `<img>` — `<img href="https://..."/>` 上传网络图片
|
|
44
|
-
- `<whiteboard>` — 简单图由 SubAgent 直接插入 `<whiteboard type="svg">完整自包含 SVG</whiteboard>`;也可用本地文件简写 `<whiteboard type="svg" path="@diagram.svg"></whiteboard>`、`<whiteboard type="mermaid" path="@flow.mmd"></whiteboard>`、`<whiteboard type="plantuml" path="@sequence.puml"></whiteboard>`,CLI 会写入前展开为内联内容;复杂图使用 `<whiteboard type="blank"></whiteboard>` 先创建空白画板,再按 [`lark-doc-whiteboard.md`](lark-doc-whiteboard.md) 启动 SubAgent 调用 `lark-whiteboard` 写入;
|
|
45
|
-
- `<sheet>` — `<sheet type="blank"></sheet>` 空白;`<sheet sheet-id="SID" token="TOKEN"></sheet>` 复制已有
|
|
46
|
-
- `<task>` — `<task task-id="GUID"></task>`,必传 task-id(任务 guid)
|
|
47
|
-
- `<chat_card>` — `<chat_card chat-id="CHAT_ID"></chat_card>`,必传 chat-id
|
|
48
|
-
- `<sub-page-list>` — `<sub-page-list></sub-page-list>` 子页面列表块;仅 wiki 文档可插入
|
|
49
|
-
- `<html5-block>`、`<okr>` — 前者在飞书文档「HTML 块」iframe 中加载单文件 HTML,内容可用 HTML 渲染时直接使用;后者创建时仅支持 root-only `<okr cycle-id="..."/>` 挂载已有 OKR。完整语法与字段规则见 [`lark-doc-xml-extended-blocks.md`](lark-doc-xml-extended-blocks.md)。
|
|
50
|
-
- bitable、base_ref、synced_reference、synced_source — 不可创建,仅支持移动
|
|
51
|
-
|
|
52
|
-
# 四、块级复制与移动
|
|
53
|
-
|
|
54
|
-
## 移动(block_move_after)
|
|
55
|
-
支持**所有**块类型(块级标签、容器标签、行内组件、资源块),使用 `docs +update --command block_move_after --block-id "<锚点>" --src-block-ids "id1,id2"`。
|
|
56
|
-
|
|
57
|
-
## 复制(block_copy_insert_after)
|
|
58
|
-
- **基础标签**(块级标签、容器标签、行内组件):均支持复制
|
|
59
|
-
- **资源块**:仅 img、source、whiteboard、sheet、chat_card、sub-page-list 支持复制;task、bitable、base_ref、synced_reference、synced_source、okr 不支持复制
|
|
60
|
-
|
|
61
|
-
使用 `docs +update --command block_copy_insert_after --block-id "<锚点>" --src-block-ids "id1,id2"`。
|
|
62
|
-
|
|
63
|
-
> 详见 [lark-doc-update.md](lark-doc-update.md)。
|
|
64
|
-
|
|
65
|
-
# 五、补充规则
|
|
66
|
-
|
|
67
|
-
## 富文本样式嵌套顺序
|
|
68
|
-
- 行内样式标签必须按以下固定顺序嵌套(外 → 内),关闭顺序严格反转:`<a> → <b> → <em> → <del> → <u> → <code> → <span> → 文本内容`
|
|
69
|
-
|
|
70
|
-
## 列表分组
|
|
71
|
-
- 连续同类型列表项自动合并为一个 `<ul>` 或 `<ol>`
|
|
72
|
-
- 嵌套子列表放在 `<li>` 内部
|
|
73
|
-
- 新增列表项必须包在 `<ul>` 或 `<ol>` 内:
|
|
74
|
-
```xml
|
|
75
|
-
<ul>
|
|
76
|
-
<li>第一项</li>
|
|
77
|
-
<li>第二项</li>
|
|
78
|
-
</ul>
|
|
79
|
-
```
|
|
1
|
+
# 飞书 XML 语法
|
|
80
2
|
|
|
81
|
-
|
|
82
|
-
- 代码块必须写成 `<pre lang="xxx" caption="可选说明"><code>代码内容</code></pre>`。
|
|
83
|
-
- 不要将代码文本直接放在 `<pre>` 下;应放在内层 `<code>` 中。
|
|
3
|
+
**语法采用类 HTML 标签,渲染采用纵向块级文档流:顶层 Block 按文档顺序纵向排列,块内支持富文本和子块嵌套。默认宽度约 820 px,宽版模式约 1020 px**
|
|
84
4
|
|
|
5
|
+
以下为 XML 语法示例,使用时需替换其中的示例值。属性必须写成 `name="value"`,禁止省略引号。
|
|
85
6
|
|
|
86
|
-
##
|
|
7
|
+
## 常用标签
|
|
87
8
|
|
|
88
|
-
-
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
9
|
+
- `p, h1-h9, blockquote, hr, img, b, em, u, del, br, span` 语义不变。普通文档建议只使用 `h1-h6`,`h7-h9` 仅在确需更深层级时使用。
|
|
10
|
+
- `<a type="url-preview" href="URL">链接标题</a>`
|
|
11
|
+
- `<latex>E = mc^2</latex>`:适用行内公式,也适用于上标、下标写法。
|
|
12
|
+
- `<ol><li>第一项<ul><li>子项</li></ul></li><li>第二项</li></ol>`:子列表放在 `<li>` 内;新增列表项必须放在 `<ul>` 或 `<ol>` 内。
|
|
13
|
+
- `<pre lang="go" caption="示例"><code>fmt.Println("hello")</code></pre>`:代码必须放在 `<code>` 内,禁止直接放在 `<pre>` 下;`caption` 可省略。
|
|
14
|
+
- `<img path="@./photo.png"/>`:上传当前工作目录内的本地图片。也可用 `<img href="URL"/>` 上传公开 HTTP(S) 网络图片,或用 `<img src="token"/>` 复制原始图片;三者任选一个,可选 `width`、`height`、`caption`、`name`。使用 `href` 时,CLI 会将远程图片转为本地资源并完成上传;响应须为 PNG、JPEG、GIF 或 WebP,单图不超过 20MiB。内部网络图片须先下载到本地再使用 `path`。
|
|
15
|
+
- `<source path="@./report.pdf" name="报告.pdf"/>`:上传本地附件;也可使用 `<source token="token" name="xx"/>` 复制已有附件。可独立使用、放入 `<p>` 作为行内附件,或写成 `<figure view-type="Card|Preview"><source/></figure>`;
|
|
16
|
+
- `<checkbox done="true|false">todo</checkbox>`
|
|
17
|
+
- `p, h1-h9, li, checkbox, title` 支持可选属性 `align`,可选值为 `left`、`center`、`right`,例如 `<p align="center">居中正文</p>`。
|
|
92
18
|
|
|
93
|
-
##
|
|
94
|
-
标准 HTML table 结构不变,扩展点:
|
|
95
|
-
- `<colgroup>` / `<col>` 定义列宽,紧跟 `<table>` 之后:`<col span="2" width="100"/>`
|
|
96
|
-
- `<th>` / `<td>` 增加 `background-color` 和 `vertical-align`(top | middle | bottom)
|
|
97
|
-
- 有表头时第一行在 `<thead>` 用 `<th>`,其余在 `<tbody>` 用 `<td>`
|
|
98
|
-
- 合并单元格仅起始格输出 `colspan` / `rowspan`,被合并的格不出现
|
|
19
|
+
## 标题与列表编号
|
|
99
20
|
|
|
100
|
-
|
|
101
|
-
-
|
|
102
|
-
| 属性 | 支持的命名色 |
|
|
103
|
-
|-|-|
|
|
104
|
-
| 文字颜色 `<span text-color>` | 基础色 |
|
|
105
|
-
| 高亮框字色 `<callout text-color>` | 基础色 |
|
|
106
|
-
| 高亮框边框 `<callout border-color>` | 基础色 |
|
|
107
|
-
| 文字背景 `<span background-color>` | 基础色 + `light-{色}` + `medium-gray` |
|
|
108
|
-
| 高亮框填充 `<callout background-color>` | `gray` + `light-{色}` + `medium-{色}` |
|
|
109
|
-
| 单元格背景 `<th/td background-color>` | 同文字背景 |
|
|
110
|
-
| 按钮背景 `<button background-color>` | 同文字背景 |
|
|
111
|
-
- 常用 emoji: 💡(默认)✅❌📝❓❗👍❤️📌🏁⭐
|
|
21
|
+
- 完整文档以唯一的 `<title>` 开头;正文标题使用 `<h1>` 至 `<h9>`,层级须连续,不跳级,例如 `<h1>` 后不能直接使用 `<h3>`,应先出现 `<h2>`。需要自动编号时设置 `seq="auto"`,系统会按标题层级生成并递增阿拉伯数字编号,例如一级标题为 `1`,二级标题为 `1.1`。
|
|
22
|
+
- 有序列表:默认属性 `seq="auto"`,需从指定数字开始时设置对应值,如 `seq="3"`。
|
|
112
23
|
|
|
113
|
-
|
|
114
|
-
## 转义规则:标签本身 **禁止转义**,只有标签内部的文本内容才需要转义
|
|
24
|
+
## 表格
|
|
115
25
|
|
|
116
|
-
|
|
117
|
-
|
|
26
|
+
- `<table><thead><tr><th><p>表头</p></th></tr></thead><tbody><tr><td><p>内容</p></td></tr></tbody></table>`
|
|
27
|
+
- `<colgroup><col /></colgroup>` 紧跟 `<table>` 定义列宽;`width` 表示列宽,可选 `span` 表示连续作用的列数。
|
|
28
|
+
- `<th>` / `<td>` 支持 `background-color`、`vertical-align`、`colspan`、`rowspan`;`vertical-align`:`top | middle | bottom`;`background-color` 支持基础色相、`light-{色相}`、`medium-gray`,表头优先使用 `light-gray` 或 `medium-gray`,彩色单元格仅用于表达状态或分类。被合并的单元格不再写入。
|
|
118
29
|
|
|
119
|
-
|
|
120
|
-
- `<` → `<`
|
|
121
|
-
- `>` → `>`
|
|
122
|
-
- `&` → `&`
|
|
123
|
-
- `\n`(换行符) → `<br/>`
|
|
30
|
+
## 扩展标签
|
|
124
31
|
|
|
32
|
+
- `<cite type="user" user-id="ou_xxx"/>`:@人,会渲染为用户头像;必须显式传入用户 `open_id`,不得用纯文本名字冒充 @人。
|
|
33
|
+
- `<cite type="doc" doc-id="DOC_TOKEN"/>`:@文档,会渲染为文档标题。
|
|
34
|
+
- `<cite type="citation"><a href="URL" url-type="N"></a></cite>`:参考文献容器,仅含多个 `<a>`。`url-type` 标识链接类型:`5`(WebURL)须在`<a></a>`中填写渲染标题;`1`(Docx)、`6`(Minutes)、`12`(Base)、`13`(Sheet)可留空。
|
|
35
|
+
- `<whiteboard></whiteboard>`:`type | src` 二选一。`type=blank` 为新建;`type=mermaid|plantuml|svg` 时,支持 `path=@./file` 导入,也支持在标签内直接写入内容;`src=token` 表示复制已有画板。复杂图需读取 [`lark-doc-whiteboard.md`](lark-doc-whiteboard.md);
|
|
36
|
+
- `<grid><column width-ratio="0.5"><p>左栏</p></column><column width-ratio="0.5"><p>右栏</p></column></grid>`:各列 `width-ratio` 之和为 1。
|
|
37
|
+
- `<callout emoji="💡" background-color="light-*" border-color="*"><p>高亮块内容</p></callout>`:子块仅支持 `p`、`ol`、`ul`、`checkbox`、行内标签;禁止 `<table>`、`<img>`、`<pre>`、`<hr>`、`<grid>`、`<whiteboard>`、等其他块级标签或资源块。可选 `text-color`。
|
|
38
|
+
- 其他扩展标签 `html5-block`、`bookmark`、`button`、`time`、`sheet`、`task`、`chat_card`、`sub-page-list`、`okr` 见 [`lark-doc-xml-extended-blocks.md`](lark-doc-xml-extended-blocks.md)。
|
|
125
39
|
|
|
126
|
-
|
|
40
|
+
## 颜色
|
|
127
41
|
|
|
128
|
-
|
|
129
|
-
<title>文档标题</title>
|
|
42
|
+
颜色用于表达语义,并在全文保持一致;默认保持中性色排版,避免仅为装饰而着色。
|
|
130
43
|
|
|
131
|
-
|
|
44
|
+
- **合法值**:色相为 `red, orange, yellow, green, blue, purple, gray`;`text-color`、`border-color` 使用基础色相;`<span>`、`<th>`、`<td>`、`<button>` 背景支持基础色相、`light-{色相}`、`medium-gray`;高亮块背景支持 `gray`、`light-{色相}`、`medium-{色相}`。
|
|
45
|
+
- **高亮块**:默认使用 `light-*` 背景和默认文字色;强提醒才使用 `medium-*`,彩色文字只强调短语。
|
|
46
|
+
- **表格**:表头优先使用 `light-gray` 或 `medium-gray`;彩色单元格只表达状态或分类,避免整表铺色。
|
|
132
47
|
|
|
133
|
-
|
|
48
|
+
## 转义规则
|
|
134
49
|
|
|
135
|
-
|
|
136
|
-
<p>高亮框内容,子块仅支持文本/标题/列表/待办/引用</p>
|
|
137
|
-
</callout>
|
|
50
|
+
禁止转义标签本身;只转义标签内部的文本内容。
|
|
138
51
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
<grid>
|
|
143
|
-
<column width-ratio="0.5">
|
|
144
|
-
<p>左栏</p>
|
|
145
|
-
</column>
|
|
146
|
-
<column width-ratio="0.5">
|
|
147
|
-
<p>右栏</p>
|
|
148
|
-
</column>
|
|
149
|
-
</grid>
|
|
150
|
-
|
|
151
|
-
<table>
|
|
152
|
-
<colgroup><col span="2" width="120"/></colgroup>
|
|
153
|
-
<thead><tr><th background-color="light-gray">表头</th><th background-color="light-gray">表头</th></tr></thead>
|
|
154
|
-
<tbody><tr><td>单元格</td><td>单元格</td></tr></tbody>
|
|
155
|
-
</table>
|
|
156
|
-
|
|
157
|
-
<p><cite type="doc" doc-id="DOC_TOKEN"></cite> <cite type="user" user-id="USER_ID"></cite></p>
|
|
158
|
-
|
|
159
|
-
<ol><li seq="auto">第一项</li><li seq="auto">第二项</li></ol>
|
|
160
|
-
|
|
161
|
-
<p><a type="url-preview" href="https://example.com">链接标题</a></p>
|
|
162
|
-
|
|
163
|
-
<p><latex>E = mc^2</latex></p>
|
|
164
|
-
|
|
165
|
-
<pre lang="go" caption="示例"><code>fmt.Println("hello")</code></pre>
|
|
166
|
-
|
|
167
|
-
<hr/>
|
|
168
|
-
|
|
169
|
-
<source name="文件名.pdf"/>
|
|
170
|
-
<img src="IMG_TOKEN" width="800" height="400" caption="说明" name="图.png"/>
|
|
171
|
-
<img href="https://example.com/photo.png"/>
|
|
172
|
-
|
|
173
|
-
<button action="OpenLink" src="https://example.com">按钮文字</button>
|
|
174
|
-
|
|
175
|
-
<time expire-time="1775916000000" notify-time="1775912400000" should-notify="false">时间戳毫秒</time>
|
|
176
|
-
|
|
177
|
-
<cite type="citation"><a href="https://example.com">引文标题</a></cite>
|
|
178
|
-
<bookmark name="书签标题" href="https://example.com"></bookmark>
|
|
179
|
-
|
|
180
|
-
<task task-id="TASK_GUID"></task>
|
|
181
|
-
<chat_card chat-id="CHAT_ID"></chat_card>
|
|
182
|
-
<sub-page-list></sub-page-list>
|
|
183
|
-
```
|
|
52
|
+
- 文本转义:`<` → `<`,`>` → `>`,`&` → `&`,换行符 `\n` → `<br/>`。
|
|
53
|
+
- 错误:`<p>内容</p>`
|
|
54
|
+
- 正确:`<p>A & B 的对比:1 < 2</p>`
|
|
@@ -43,7 +43,7 @@ metadata:
|
|
|
43
43
|
- 用户要查看、下载、回滚或删除文件的**历史版本**,使用 `drive +version-history`、`drive +version-get`、`drive +version-revert`、`drive +version-delete`;这组命令同时支持 `--as user` 和 `--as bot`,自动化场景优先 `--as bot`。
|
|
44
44
|
- 用户要把本地 `.xlsx` / `.xls` / `.csv` 导入成电子表格,使用 `lark-cli drive +import --type sheet`。
|
|
45
45
|
- 用户要在云空间(云盘/云存储)里新建文件夹,优先使用 `lark-cli drive +create-folder`。
|
|
46
|
-
- 用户要查看或下载文件内容,或者查看文件可用预览格式并获取 PDF / HTML / 文本 / 图片等转换预览产物,使用 `lark-cli drive +preview`。
|
|
46
|
+
- 用户要查看或下载文件内容,或者查看文件可用预览格式并获取 PDF / HTML / 文本 / 图片等转换预览产物,使用 `lark-cli drive +preview`。`+preview` 和 `+download` 都支持 `--file-token` / `--url` / `--wiki-token` 三选一(Wiki 会解析到底层 `file`);但两者只处理 Drive **文件**,若目标是 docx/sheet/bitable/slides 等在线文档,改用 `drive +export`。
|
|
47
47
|
- 用户要获取某个文件的封面图,优先使用 `lark-cli drive +cover`;先 `--list-only` 看规格,再选 `--spec` 下载。
|
|
48
48
|
- 用户要导出云文档时,优先使用 `lark-cli drive +export --url '<文档 URL>' --file-extension <格式>`;详细参数、Wiki token 和错误码处理见 [`references/lark-drive-export.md`](references/lark-drive-export.md)。
|
|
49
49
|
- 用户要把本地文件上传到知识库 / 文档库里的某个 wiki 节点下时,仍然使用 `lark-cli drive +upload --wiki-token <wiki_token>`;不要误切到 `wiki` 域命令。
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
> **前置条件:** 先阅读 [`../lark-shared/SKILL.md`](../../lark-shared/SKILL.md) 了解认证、全局参数和安全规则。
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
从飞书云空间(云盘/云存储)下载文件到本地。下载对象是 Drive **文件**(上传的 PDF/zip/图片/音视频等文件),以及支持 Wiki URL / Wiki token。
|
|
7
7
|
|
|
8
8
|
## 命令
|
|
9
9
|
|
|
@@ -13,8 +13,27 @@ lark-cli drive +download --file-token boxbc_xxx --output ./report.pdf
|
|
|
13
13
|
|
|
14
14
|
# 只提供 token,默认保存到当前目录
|
|
15
15
|
lark-cli drive +download --file-token boxbc_xxx
|
|
16
|
+
|
|
17
|
+
# 直接传 URL,CLI 自动解析类型和 token
|
|
18
|
+
lark-cli drive +download --url "https://example.feishu.cn/file/<FILE_TOKEN>" --output ./report.pdf
|
|
19
|
+
|
|
20
|
+
# Wiki URL 也可直接传,CLI 会先解析到底层 obj_token/obj_type(obj_type 必须是 file)
|
|
21
|
+
lark-cli drive +download --url "https://example.feishu.cn/wiki/<WIKI_NODE_TOKEN>" --output ./report.pdf
|
|
22
|
+
|
|
23
|
+
# 只有裸 Wiki node token 时,显式传 --wiki-token,让 CLI 先解析底层文件
|
|
24
|
+
lark-cli drive +download --wiki-token "<WIKI_NODE_TOKEN>" --output ./report.pdf
|
|
16
25
|
```
|
|
17
26
|
|
|
27
|
+
## 参数
|
|
28
|
+
|
|
29
|
+
| 参数 | 必填 | 说明 |
|
|
30
|
+
|------|------|------|
|
|
31
|
+
| `--file-token` | 条件必填 | Drive 文件 token;与 `--url` / `--wiki-token` 三选一 |
|
|
32
|
+
| `--url` | 条件必填 | 飞书文件 URL 或 Wiki URL;CLI 自动解析类型和 token |
|
|
33
|
+
| `--wiki-token` | 条件必填 | 裸 Wiki node token;CLI 先解析到底层 Drive 文件 |
|
|
34
|
+
| `--output` | 否 | 本地输出路径;不传时默认保存到当前目录 |
|
|
35
|
+
| `--overwrite` | 否 | 覆盖已存在的输出文件;不传时目标已存在会报错 |
|
|
36
|
+
|
|
18
37
|
## URL 解析
|
|
19
38
|
|
|
20
39
|
从飞书文件 URL 提取 token:
|
|
@@ -25,9 +44,17 @@ https://xxx.feishu.cn/drive/file/boxbc_xxx
|
|
|
25
44
|
file_token
|
|
26
45
|
```
|
|
27
46
|
|
|
47
|
+
Wiki URL / 裸 Wiki node token 会先解析到底层文档,解析后会在输出里附带 `wiki_token` 和 `wiki_node`(含底层 `obj_token`/`obj_type`)。
|
|
48
|
+
|
|
49
|
+
## 关键约束
|
|
50
|
+
|
|
51
|
+
- Wiki 节点解析后的 `obj_type` 必须是 `file`;不确定 token 类型时,先用 `lark-cli drive +inspect --url <TOKEN> --type wiki` 检查。
|
|
52
|
+
|
|
28
53
|
## 排障
|
|
29
54
|
|
|
30
|
-
- 如果返回 `HTTP 403
|
|
55
|
+
- 如果返回 `permission_denied`,或最终下载返回 `HTTP 403`,按错误 `hint` 使用 `lark-cli drive +preview --file-token <FILE_TOKEN> --type source_file --output <path>` 获取预览产物。
|
|
56
|
+
- 如果返回限流错误,停止立即重试,稍后按指数退避重试。
|
|
57
|
+
- 如果目标(或 Wiki 解析出的底层文档)是 `docx` / `sheet` / `bitable` / `slides` 等在线文档,`+download` 无法直接下载,会返回 typed validation error;改用 [lark-drive-export](lark-drive-export.md) 渲染成 pdf / xlsx / pptx / markdown 等格式。
|
|
31
58
|
|
|
32
59
|
## 参考
|
|
33
60
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **前置条件:** 先阅读 [`../lark-shared/SKILL.md`](../../lark-shared/SKILL.md) 了解认证、权限处理和安全规则。
|
|
4
4
|
|
|
5
|
-
查看或下载 Drive
|
|
5
|
+
查看或下载 Drive 文件内容,或列出并获取文件可用的预览产物。对象是 Drive **文件**,也支持 Wiki URL / node token(CLI 先把 Wiki 节点解析到底层文件,`obj_type` 必须是 `file`)。这个 shortcut 不猜测默认类型:
|
|
6
6
|
|
|
7
7
|
- 如果只需要查看或下载文件内容,或不关心 PDF/text/image 等转换预览,优先使用 `--type source_file --output <path>`
|
|
8
8
|
- 只想看候选项时,用 `--list-only`
|
|
@@ -20,6 +20,22 @@ lark-cli drive +preview \
|
|
|
20
20
|
--type source_file \
|
|
21
21
|
--output ./artifacts/source
|
|
22
22
|
|
|
23
|
+
# 推荐:直接传 URL,CLI 自动解析类型和 token
|
|
24
|
+
lark-cli drive +preview \
|
|
25
|
+
--url "https://example.feishu.cn/file/<FILE_TOKEN>" \
|
|
26
|
+
--list-only
|
|
27
|
+
|
|
28
|
+
# Wiki URL 也可直接传,CLI 会先解析到底层 obj_token/obj_type(obj_type 必须是 file)
|
|
29
|
+
lark-cli drive +preview \
|
|
30
|
+
--url "https://example.feishu.cn/wiki/<WIKI_NODE_TOKEN>" \
|
|
31
|
+
--type source_file \
|
|
32
|
+
--output ./artifacts/source
|
|
33
|
+
|
|
34
|
+
# 只有裸 Wiki node token 时,显式传 --wiki-token
|
|
35
|
+
lark-cli drive +preview \
|
|
36
|
+
--wiki-token "<WIKI_NODE_TOKEN>" \
|
|
37
|
+
--list-only
|
|
38
|
+
|
|
23
39
|
# 列出可用预览候选项
|
|
24
40
|
lark-cli drive +preview \
|
|
25
41
|
--file-token "<FILE_TOKEN>" \
|
|
@@ -50,7 +66,9 @@ lark-cli drive +preview \
|
|
|
50
66
|
|
|
51
67
|
| 参数 | 必填 | 说明 |
|
|
52
68
|
|------|------|------|
|
|
53
|
-
| `--file-token` |
|
|
69
|
+
| `--file-token` | 条件必填 | Drive 文件 token;与 `--url` / `--wiki-token` 三选一 |
|
|
70
|
+
| `--url` | 条件必填 | 飞书文件 URL 或 Wiki URL;CLI 自动解析类型和 token |
|
|
71
|
+
| `--wiki-token` | 条件必填 | 裸 Wiki node token;CLI 先解析到底层 Drive 文件 |
|
|
54
72
|
| `--type` | 条件必填 | 预览类型;优先使用 `--list-only` 返回的 `type`,如 `pdf` / `html` / `text` / `png` / `jpg` / `source_file` |
|
|
55
73
|
| `--version` | 否 | 文件版本号 |
|
|
56
74
|
| `--list-only` | 否 | 仅返回候选项,不下载 |
|
|
@@ -90,6 +108,7 @@ lark-cli drive +preview \
|
|
|
90
108
|
- `--type source_file` 用于查看文件内容,不依赖 `--list-only` 返回的候选项;它适合读取或保存源内容,不等同于 PDF/text/image 等转换预览
|
|
91
109
|
- 候选项状态来自后端 `preview_status` 枚举,例如 `READY` / `PROCESSING` / `FAILED` / `NO_SUPPORT`
|
|
92
110
|
- 本地文件名在未显式带扩展名时,会结合响应头自动补扩展名
|
|
111
|
+
- Wiki URL / 裸 Wiki node token 会先解析到底层文档,解析后会在输出里附带 `wiki_token` 和 `wiki_node`(含底层 `obj_token`/`obj_type`);`obj_type` 必须是 `file`。如果 Wiki 指向 `docx` / `sheet` / `bitable` / `slides` 等在线文档,`+preview` 无法直接处理,CLI 会返回 typed validation error,并在 hint 中提示改用 [lark-drive-export](lark-drive-export.md)
|
|
93
112
|
|
|
94
113
|
### 参考
|
|
95
114
|
|
package/skills/lark-im/SKILL.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: lark-im
|
|
3
3
|
version: 1.0.0
|
|
4
|
-
description: "
|
|
4
|
+
description: "飞书即时通讯:收发消息和管理群聊。发送和回复消息、搜索聊天记录、管理群聊成员、上传下载图片和文件、管理表情回复、发送应用内/短信/电话加急、发送和处理交互卡片(Interactive Card)、监听卡片按钮回调(card.action.trigger)。当用户需要发消息、查看或搜索聊天记录、下载聊天中的文件、查看群成员、搜索群、创建群聊或话题群、管理标记数据、管理 Feed 置顶(添加/移除/查询置顶会话)、管理标签数据、处理卡片回调时使用。"
|
|
5
5
|
metadata:
|
|
6
6
|
requires:
|
|
7
7
|
bins: ["lark-cli"]
|
|
@@ -56,7 +56,7 @@ The four message-pulling shortcuts (`+messages-mget`, `+chat-messages-list`, `+m
|
|
|
56
56
|
|
|
57
57
|
### Opt-in resource auto-download (`--download-resources`)
|
|
58
58
|
|
|
59
|
-
`+chat-messages-list`, `+messages-mget`, and `+threads-messages-list` accept `--download-resources`
|
|
59
|
+
`+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.
|
|
60
60
|
|
|
61
61
|
### Card Messages (Interactive)
|
|
62
62
|
|
|
@@ -111,7 +111,7 @@ Shortcut 是对常用操作的高级封装(`lark-cli im +<verb> [flags]`)。
|
|
|
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
|
-
| [`+messages-resources-download`](references/lark-im-messages-resources-download.md) | Download
|
|
114
|
+
| [`+messages-resources-download`](references/lark-im-messages-resources-download.md) | Download an image or file attached to a message; user/bot |
|
|
115
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
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 |
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
> **Prerequisite:** Read [`../lark-shared/SKILL.md`](../../lark-shared/SKILL.md) first to understand authentication, global parameters, and safety rules.
|
|
4
4
|
|
|
5
|
-
Download image or file
|
|
5
|
+
Download an image or file attached to a message. Use the `message_id` and resource key returned by a message-reading command; do not guess or combine identifiers from different messages.
|
|
6
6
|
|
|
7
7
|
> **Note:** read-only message commands render resource keys in message content, but they do not download binaries automatically. Use this command whenever you need to fetch the actual image/file bytes or save them to a specific path.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Shortcut: `lark-cli im +messages-resources-download`.
|
|
10
10
|
|
|
11
11
|
## Commands
|
|
12
12
|
|
|
@@ -34,27 +34,11 @@ lark-cli im +messages-resources-download --message-id om_xxx --file-key img_v3_x
|
|
|
34
34
|
| `--message-id <id>` | Yes | Message ID (`om_xxx` format) |
|
|
35
35
|
| `--file-key <key>` | Yes | Resource key (`img_xxx` or `file_xxx`) |
|
|
36
36
|
| `--type <type>` | Yes | Resource type: `image` or `file` |
|
|
37
|
-
| `--output <path>` | No |
|
|
37
|
+
| `--output <path>` | No | Relative output path; absolute paths and `..` traversal are rejected. When omitted, the command uses the attachment name when available and otherwise falls back to the resource key |
|
|
38
38
|
| `--as <identity>` | No | Identity type: `user` (default) or `bot` |
|
|
39
39
|
| `--dry-run` | No | Print the request only, do not execute it |
|
|
40
40
|
|
|
41
|
-
##
|
|
42
|
-
|
|
43
|
-
When downloading large files, the command automatically uses **HTTP Range requests** for reliable chunked downloading:
|
|
44
|
-
|
|
45
|
-
| Behavior | Details |
|
|
46
|
-
|----------|---------|
|
|
47
|
-
| Probe chunk | First 128 KB to detect file size and Content-Type |
|
|
48
|
-
| Chunk size | 8 MB per subsequent request |
|
|
49
|
-
| Workers | Single-threaded sequential download (ensures reliability) |
|
|
50
|
-
| Retries | Up to 2 retries for transient request failures, with exponential backoff |
|
|
51
|
-
|
|
52
|
-
**Benefits:**
|
|
53
|
-
- Reduces the impact of transient request failures during large downloads
|
|
54
|
-
- Preserves the server's original filename via `Content-Disposition` (supports RFC 5987 UTF-8 encoding); falls back to `Content-Type`-based extension inference
|
|
55
|
-
- Validates file size integrity after download completion
|
|
56
|
-
|
|
57
|
-
## `file_key` Sources
|
|
41
|
+
## Choose `--type`
|
|
58
42
|
|
|
59
43
|
Different resource markers in message content correspond to different `file_key` and `type` values:
|
|
60
44
|
|
|
@@ -65,6 +49,17 @@ Different resource markers in message content correspond to different `file_key`
|
|
|
65
49
|
| Audio | `file_xxx` | `file_xxx` | `file` |
|
|
66
50
|
| Video | `file_xxx` | `file_xxx` | `file` |
|
|
67
51
|
|
|
52
|
+
Stickers cannot be downloaded with this command.
|
|
53
|
+
|
|
54
|
+
## Output
|
|
55
|
+
|
|
56
|
+
On success, read:
|
|
57
|
+
|
|
58
|
+
| Field | Meaning |
|
|
59
|
+
|------|---------|
|
|
60
|
+
| `data.saved_path` | Saved local path |
|
|
61
|
+
| `data.size_bytes` | Saved byte count |
|
|
62
|
+
|
|
68
63
|
## Usage Scenario
|
|
69
64
|
|
|
70
65
|
### Scenario: Extract and download an image from a message
|
|
@@ -82,11 +77,10 @@ lark-cli im +messages-resources-download --message-id om_xxx --file-key img_v3_x
|
|
|
82
77
|
|
|
83
78
|
| Symptom | Root Cause | Solution |
|
|
84
79
|
|---------|---------|---------|
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
| Content-Range error | Server returned invalid range header | Transient API issue; retry the command |
|
|
80
|
+
| Resource does not match the message | `file_key` and `message_id` came from different messages | Read the message again and use its matching identifiers |
|
|
81
|
+
| Permission denied | `im:message:readonly` is not authorized | For user identity, run `lark-cli auth login --scope "im:message:readonly"`; for bot identity, grant the scope to the app in the developer console |
|
|
82
|
+
| Attachment unavailable | The message or resource is deleted, hidden, restricted, or inaccessible to the caller | Do not retry unchanged; report the exact CLI error |
|
|
83
|
+
| Retryable network error | The transfer did not complete | Retry the same command |
|
|
90
84
|
|
|
91
85
|
## References
|
|
92
86
|
|