Skip to content

Commit cc16c4d

Browse files
feat(whiteboard): pin whiteboard-cli to v0.2.11 in lark-whiteboard skill (#850)
1 parent 1ee7f22 commit cc16c4d

13 files changed

Lines changed: 36 additions & 36 deletions

File tree

skills/lark-whiteboard/SKILL.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ metadata:
1313

1414
> [!IMPORTANT]
1515
> - 运行 `lark-cli --version`,确认可用,无需询问用户。
16-
> - 运行 `npx -y @larksuite/whiteboard-cli@^0.2.10 -v`,确认可用,无需询问用户。
16+
> - 运行 `npx -y @larksuite/whiteboard-cli@^0.2.11 -v`,确认可用,无需询问用户。
1717
1818
**CRITICAL — 开始前 MUST 先用 Read 工具读取 [`../lark-shared/SKILL.md`](../lark-shared/SKILL.md),其中包含认证、权限处理**
1919

@@ -124,15 +124,15 @@ diagram.png ← 渲染结果
124124
125125
```bash
126126
# 第一步:dry-run 探测
127-
npx -y @larksuite/whiteboard-cli@^0.2.10 -i <产物文件> --to openapi --format json \
127+
npx -y @larksuite/whiteboard-cli@^0.2.11 -i <产物文件> --to openapi --format json \
128128
| lark-cli whiteboard +update \
129129
--whiteboard-token <Token> \
130130
--source - --input_format raw \
131131
--idempotent-token <10+字符唯一串> \
132132
--overwrite --dry-run --as user
133133

134134
# 第二步:确认后执行
135-
npx -y @larksuite/whiteboard-cli@^0.2.10 -i <产物文件> --to openapi --format json \
135+
npx -y @larksuite/whiteboard-cli@^0.2.11 -i <产物文件> --to openapi --format json \
136136
| lark-cli whiteboard +update \
137137
--whiteboard-token <Token> \
138138
--source - --input_format raw \

skills/lark-whiteboard/references/image.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,24 @@
44
55
## 概述
66

7-
画板 DSL 支持 `type: 'image'` 节点,但图片不能直接使用 URL,必须先上传到飞书获取 **media token**,然后在 DSL 中引用。
7+
画板 DSL 支持 `type: 'image'` 节点,但图片不能直接使用 URL 或其他域的 token,**必须先上传到目标画板获取 `whiteboard`media token**,然后在 DSL 中引用。
88

9-
**关键约束**
10-
- 图片 token 必须通过 `docs +media-upload --parent-type whiteboard` 上传获取
11-
- 图片必须上传到**目标画板**`--parent-node` 设为目标画板 token),跨画板的 token 不可用
12-
- `drive +upload` 获取的 Drive file token **不能**用于画板图片节点
9+
**核心规则**:不管图片从哪来(本地文件、URL、文档中的 `docx_image` token、其他域的 Drive token),都必须通过 `docs +media-upload --parent-type whiteboard --parent-node <目标画板token>` 上传,拿到画板专属的 media token 后才能在 DSL 中使用。直接使用非 `whiteboard` 域的 token 会导致画板 API 报 500(错误码 2891001)或图片在文档中消失。
1310

1411
## Step 0:图片准备流程
1512

16-
### 1. 下载图片
13+
### 1. 获取图片到本地
1714

18-
`curl` 下载图片到本地。**必须使用能根据关键词返回相关图片的图片源**
15+
根据图片来源选择对应方式:
1916

20-
**推荐图片源**
17+
| 图片来源 | 获取方式 |
18+
|---------|---------|
19+
| 本地文件 | 直接使用 |
20+
| 网络 URL | `curl -L -o photo.jpg "<URL>"` |
21+
| 文档中的图片 token | `lark-cli docs +media-download --token <token> --output ./photo.png` |
22+
| 其他域的 Drive token | `lark-cli docs +media-download --token <token> --output ./photo.png` |
23+
24+
**图片源选择(需要搜索图片时)**
2125

2226
| 图片源类型 | 说明 |
2327
|-------|------|
@@ -29,11 +33,6 @@
2933
- **关键词搜索**:支持按关键词搜索并返回相关图片,确保图片内容与主题匹配
3034
- **内容丰富**:图库图片种类多、数量大,能覆盖常见主题(宠物、美食、景点、产品等)
3135

32-
```bash
33-
curl -L -o photo1.jpg "<图片URL>"
34-
curl -L -o photo2.jpg "<图片URL>"
35-
```
36-
3736
**严禁使用随机占位图服务**:某些图库仅提供随机占位图,URL 中的关键词参数不会影响返回的图片内容,下载的图片与主题完全无关。
3837

3938
### 2. 校验图片
@@ -74,7 +73,8 @@ lark-cli docs +media-upload --file ./photo3.jpg --parent-type whiteboard --paren
7473

7574
| 错误现象 | 原因 | 解决 |
7675
|---------|------|------|
77-
| 画板 API 返回 500(2891001) | 使用了 Drive file token 而非 media token | 改用 `docs +media-upload --parent-type whiteboard` |
76+
| 画板 API 返回 500(2891001) | 使用了非 `whiteboard` token(如 `docx_image`、Drive file token | 下载图片后用 `docs +media-upload --parent-type whiteboard` 重新上传 |
7877
| 画板 API 返回 500 | 图片上传到了其他画板 | 重新上传到目标画板 |
78+
| 画板在文档中图片消失 | 图片 token 的资源域与画板不匹配 | 确保图片通过 `--parent-type whiteboard --parent-node <画板token>` 上传 |
7979
| 图片裂开/无法显示 | token 无效或已过期 | 重新上传获取新 token |
8080
| 图片内容与主题无关 | 使用了随机占位图服务 | 改用免费版权图库服务 |

skills/lark-whiteboard/references/lark-whiteboard-update.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ whiteboard-cli 工具的具体用法请参考 [§ 渲染 & 写入画板](../SKIL
7474

7575
```bash
7676
# 使用 whiteboard-cli 生成 OpenAPI 格式并通过管道传递
77-
npx -y @larksuite/whiteboard-cli@^0.2.10 -i <产物文件> --to openapi --format json \
77+
npx -y @larksuite/whiteboard-cli@^0.2.11 -i <产物文件> --to openapi --format json \
7878
| lark-cli whiteboard +update \
7979
--whiteboard-token <画板Token> \
8080
--source - --input_format raw \
@@ -88,7 +88,7 @@ whiteboard-cli 工具的具体用法请参考 [§ 渲染 & 写入画板](../SKIL
8888

8989
```bash
9090
# 生成 OpenAPI 格式到文件
91-
npx -y @larksuite/whiteboard-cli@^0.2.10 -i <DSL 文件> --to openapi --format json -o ./temp.json
91+
npx -y @larksuite/whiteboard-cli@^0.2.11 -i <DSL 文件> --to openapi --format json -o ./temp.json
9292

9393
# 从文件读取并更新
9494
lark-cli whiteboard +update \

skills/lark-whiteboard/references/layout.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ DSL 的语法是严格白名单,不能写原生 CSS 属性(不支持 `alignS
336336
先出骨架图导出坐标,再基于坐标补充连线和注解:
337337

338338
```bash
339-
npx -y @larksuite/whiteboard-cli@^0.2.10 -i skeleton.json -o step1.png -l coords.json
339+
npx -y @larksuite/whiteboard-cli@^0.2.11 -i skeleton.json -o step1.png -l coords.json
340340
```
341341

342342
`coords.json` 包含每个带 id 节点的精确坐标(absX, absY, width, height)。

skills/lark-whiteboard/references/schema.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,14 +272,14 @@ SVG 通过 `image/svg+xml` Blob 加载到画布,**不在 HTML DOM 中**,因
272272
x?: number; y?: number;
273273
width?: WBSizeValue; // 默认 48
274274
height?: WBSizeValue; // 默认 48,保持正方形
275-
name: string; // 图标名称,从 npx -y @larksuite/whiteboard-cli@^0.2.10 --icons 输出中选取
275+
name: string; // 图标名称,从 npx -y @larksuite/whiteboard-cli@^0.2.11 --icons 输出中选取
276276
color?: string; // 可选颜色覆盖,hex 格式如 '#FF6600'
277277
}
278278
```
279279

280280
**获取可用图标**:规划好内容和布局后,运行以下命令查看所有可用图标名,从中选取:
281281
```bash
282-
npx -y @larksuite/whiteboard-cli@^0.2.10 --icons
282+
npx -y @larksuite/whiteboard-cli@^0.2.11 --icons
283283
```
284284

285285
用法:

skills/lark-whiteboard/routes/dsl.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Step 1: 路由 & 读取知识
1313
Step 2: 生成完整 DSL(含颜色)
1414
- 按 content.md 规划信息量和分组
1515
- 按 layout.md 选择布局模式和间距
16-
- 推荐使用图标让图表更直观,运行 `npx -y @larksuite/whiteboard-cli@^0.2.10 --icons` 查看可用图标
16+
- 推荐使用图标让图表更直观,运行 `npx -y @larksuite/whiteboard-cli@^0.2.11 --icons` 查看可用图标
1717
- 按 style.md 上色(用户没指定时用默认经典色板)
1818
- 按 schema.md 语法输出完整 JSON
1919
- 连线参考 connectors.md,排版参考 typography.md
@@ -25,12 +25,12 @@ Step 2: 生成完整 DSL(含颜色)
2525
2626
Step 3: 渲染 & 审查 → 交付
2727
- 渲染前自查(见下方检查清单)
28-
- 渲染 PNG(仅用于预览验证,不是最终产物):npx -y @larksuite/whiteboard-cli@^0.2.10 -i diagram.json -o diagram.png
28+
- 渲染 PNG(仅用于预览验证,不是最终产物):npx -y @larksuite/whiteboard-cli@^0.2.11 -i diagram.json -o diagram.png
2929
- 检查:信息完整?布局合理?配色协调?文字无截断?连线无交叉?
3030
- 有问题 → 按症状表修复 → 重新渲染(最多 2 轮)
3131
- 2 轮后仍有严重问题 → 考虑走 Mermaid 路径兜底
3232
- 写入画板:用 whiteboard-cli 将 diagram.json 转换为 OpenAPI 格式并 pipe 给 +update:
33-
npx -y @larksuite/whiteboard-cli@^0.2.10 -i diagram.json --to openapi --format json \
33+
npx -y @larksuite/whiteboard-cli@^0.2.11 -i diagram.json --to openapi --format json \
3434
| lark-cli whiteboard +update --whiteboard-token <board_token> \
3535
--source - --input_format raw --idempotent-token <时间戳+标识> --as user
3636
→ 完整 dry-run / 确认流程见 SKILL.md [§ 写入画板](../SKILL.md#写入画板)

skills/lark-whiteboard/routes/mermaid.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ Step 3: 渲染验证 & 写入画板 & 交付
1616
1. 创建产物目录 ./diagrams/YYYY-MM-DDTHHMMSS/
1717
2. 保存为 diagram.mmd
1818
3. 渲染(仅用于预览验证,PNG 不是最终产物):
19-
npx -y @larksuite/whiteboard-cli@^0.2.10 -i diagram.mmd -o diagram.png
19+
npx -y @larksuite/whiteboard-cli@^0.2.11 -i diagram.mmd -o diagram.png
2020
4. 审查 PNG,有问题修改后重新渲染(最多 2 轮)
2121
5. 写入画板:用 whiteboard-cli 将 diagram.mmd 转换为 OpenAPI 格式并 pipe 给 +update:
22-
npx -y @larksuite/whiteboard-cli@^0.2.10 -i diagram.mmd --to openapi --format json \
22+
npx -y @larksuite/whiteboard-cli@^0.2.11 -i diagram.mmd --to openapi --format json \
2323
| lark-cli whiteboard +update --whiteboard-token <board_token> \
2424
--source - --input_format raw --idempotent-token <时间戳+标识> --as user
2525
→ 完整 dry-run / 确认流程见 SKILL.md [§ 写入画板](../SKILL.md#写入画板)

skills/lark-whiteboard/routes/svg.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
```
3131
建目录 ./diagrams/YYYY-MM-DDTHHMMSS/ (例:./diagrams/2026-04-15T143022/)
3232
写文件 <dir>/diagram.svg
33-
渲染 npx -y @larksuite/whiteboard-cli@^0.2.10 -i <dir>/diagram.svg -o <dir>/diagram.png -f svg
34-
检查 npx -y @larksuite/whiteboard-cli@^0.2.10 -i <dir>/diagram.svg -f svg --check
35-
导出 npx -y @larksuite/whiteboard-cli@^0.2.10 -i <dir>/diagram.svg -f svg --to openapi --format json > <dir>/diagram.json
33+
渲染 npx -y @larksuite/whiteboard-cli@^0.2.11 -i <dir>/diagram.svg -o <dir>/diagram.png -f svg
34+
检查 npx -y @larksuite/whiteboard-cli@^0.2.11 -i <dir>/diagram.svg -f svg --check
35+
导出 npx -y @larksuite/whiteboard-cli@^0.2.11 -i <dir>/diagram.svg -f svg --to openapi --format json > <dir>/diagram.json
3636
```
3737

38-
`npx -y @larksuite/whiteboard-cli@^0.2.10 --check` 检测 `text-overflow``node-overlap`, 并结合视觉效果(查看 PNG)进行调整
38+
`npx -y @larksuite/whiteboard-cli@^0.2.11 --check` 检测 `text-overflow``node-overlap`, 并结合视觉效果(查看 PNG)进行调整
3939

4040
## 画板怎么处理 SVG
4141

skills/lark-whiteboard/scenes/bar-chart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
## Layout 选型
1010

11-
- **脚本生成坐标**(推荐):用 .cjs 脚本计算柱体位置和高度,脚本输出 JSON 文件后调用 `npx -y @larksuite/whiteboard-cli@^0.2.10` 渲染
11+
- **脚本生成坐标**(推荐):用 .cjs 脚本计算柱体位置和高度,脚本输出 JSON 文件后调用 `npx -y @larksuite/whiteboard-cli@^0.2.11` 渲染
1212
- **绝对定位手写**:简单柱状图(≤ 5 个柱)可手写坐标
1313

1414
## Layout 规则

skills/lark-whiteboard/scenes/fishbone.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
## Layout 选型
1212

13-
- **脚本生成坐标**(必须):用 .cjs 脚本通过三角函数计算鱼骨坐标,脚本输出 JSON 文件后调用 `npx -y @larksuite/whiteboard-cli@^0.2.10` 渲染
13+
- **脚本生成坐标**(必须):用 .cjs 脚本通过三角函数计算鱼骨坐标,脚本输出 JSON 文件后调用 `npx -y @larksuite/whiteboard-cli@^0.2.11` 渲染
1414

1515
## Layout 规则
1616

0 commit comments

Comments
 (0)