lark-doc
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesedocs (v1)
docs (v1)
CRITICAL — 开始前 MUST 先用 Read 工具读取 ,其中包含认证、权限处理
../lark-shared/SKILL.mdCRITICAL — MUST use the Read tool to read before starting, which contains authentication and permission handling
../lark-shared/SKILL.md核心概念
Core Concepts
文档类型与 Token
Document Types and Tokens
飞书开放平台中,不同类型的文档有不同的 URL 格式和 Token 处理方式。在进行文档操作(如添加评论、下载文件等)时,必须先获取正确的 。
file_tokenIn the Lark Open Platform, different types of documents have different URL formats and token handling methods. When performing document operations (such as adding comments, downloading files, etc.), you must first obtain the correct .
file_token文档 URL 格式与 Token 处理
URL Formats and Token Handling
| URL 格式 | 示例 | Token 类型 | 处理方式 |
|---|---|---|---|
| | | URL 路径中的 token 直接作为 |
| | | URL 路径中的 token 直接作为 |
| | | ⚠️ 不能直接使用,需要先查询获取真实的 |
| | | URL 路径中的 token 直接作为 |
| | | URL 路径中的 token 作为文件夹 token 使用 |
| URL Format | Example | Token Type | Handling Method |
|---|---|---|---|
| | | Use the token in the URL path directly as the |
| | | Use the token in the URL path directly as the |
| | | ⚠️ Cannot be used directly, you need to query to obtain the real |
| | | Use the token in the URL path directly as the |
| | | Use the token in the URL path as the folder token |
Wiki 链接特殊处理(关键!)
Special Handling of Wiki Links (Critical!)
知识库链接()背后可能是云文档、电子表格、多维表格等不同类型的文档。不能直接假设 URL 中的 token 就是 file_token,必须先查询实际类型和真实 token。
/wiki/TOKENKnowledge base links () may correspond to different document types such as cloud documents, spreadsheets, base tables, etc. Do not assume that the token in the URL is the file_token directly; you must first query the actual type and real token.
/wiki/TOKEN处理流程
Processing Flow
-
使用查询节点信息
wiki.spaces.get_nodebashlark-cli wiki spaces get_node --params '{"token":"wiki_token"}' -
从返回结果中提取关键信息
- :文档类型(docx/doc/sheet/bitable/slides/file/mindnote)
node.obj_type - :真实的文档 token(用于后续操作)
node.obj_token - :文档标题
node.title
-
根据使用对应的 API
obj_typeobj_type 说明 使用的 API docx新版云文档 、drive file.comments.*docx.*doc旧版云文档 drive file.comments.*sheet电子表格 sheets.*bitable多维表格 bitable.*slides幻灯片 drive.*file文件 drive.*mindnote思维导图 drive.*
-
Useto query node information
wiki.spaces.get_nodebashlark-cli wiki spaces get_node --params '{"token":"wiki_token"}' -
Extract key information from the returned results
- : Document type (docx/doc/sheet/bitable/slides/file/mindnote)
node.obj_type - : Real document token (used for subsequent operations)
node.obj_token - : Document title
node.title
-
Use the corresponding API based on
obj_typeobj_type Description API to Use docxNew version cloud document ,drive file.comments.*docx.*docOld version cloud document drive file.comments.*sheetSpreadsheet sheets.*bitableBase table bitable.*slidesSlides drive.*fileFile drive.*mindnoteMind map drive.*
查询示例
Query Example
bash
undefinedbash
undefined查询 wiki 节点
Query wiki node
lark-cli wiki spaces get_node --params '{"token":"wiki_token"}'
返回结果示例:
```json
{
"node": {
"obj_type": "docx",
"obj_token": "xxxx",
"title": "标题",
"node_type": "origin",
"space_id": "12345678910"
}
}lark-cli wiki spaces get_node --params '{"token":"wiki_token"}'
Return result example:
```json
{
"node": {
"obj_type": "docx",
"obj_token": "xxxx",
"title": "Title",
"node_type": "origin",
"space_id": "12345678910"
}
}资源关系
Resource Relationships
Wiki Space (知识空间)
└── Wiki Node (知识库节点)
├── obj_type: docx (新版文档)
│ └── obj_token (真实文档 token)
├── obj_type: doc (旧版文档)
│ └── obj_token (真实文档 token)
├── obj_type: sheet (电子表格)
│ └── obj_token (真实文档 token)
├── obj_type: bitable (多维表格)
│ └── obj_token (真实文档 token)
└── obj_type: file/slides/mindnote
└── obj_token (真实文档 token)
Drive Folder (云空间文件夹)
└── File (文件/文档)
└── file_token (直接使用)Wiki Space
└── Wiki Node
├── obj_type: docx (New version document)
│ └── obj_token (Real document token)
├── obj_type: doc (Old version document)
│ └── obj_token (Real document token)
├── obj_type: sheet (Spreadsheet)
│ └── obj_token (Real document token)
├── obj_type: bitable (Base table)
│ └── obj_token (Real document token)
└── obj_type: file/slides/mindnote
└── obj_token (Real document token)
Drive Folder
└── File (File/Document)
└── file_token (Use directly)重要说明:画板编辑
Important Note: Whiteboard Editing
⚠️ lark-doc skill 不能直接编辑已有画板内容,但可以新建空白画板docs +update
⚠️ The lark-doc skill cannot directly edit existing whiteboard content, butcan create new blank whiteboardsdocs +update
场景 1:已通过 docs +fetch 获取到文档内容和画板 token
Scenario 1: Obtained document content and whiteboard token via docs +fetch
如果用户已经通过 拉取了文档内容,并且文档中已有画板(返回的 markdown 中包含 标签),请引导用户:
docs +fetch<whiteboard token="xxx"/>- 记录画板的 token
- 查看 了解如何编辑画板内容
../lark-whiteboard/SKILL.md
If the user has pulled the document content via and the document already contains a whiteboard (the returned markdown includes the tag), guide the user to:
docs +fetch<whiteboard token="xxx"/>- Record the whiteboard token
- Check to learn how to edit whiteboard content
../lark-whiteboard/SKILL.md
场景 2:刚创建画板,需要编辑
Scenario 2: Just created a whiteboard and need to edit it
如果用户刚通过 创建了空白画板,需要编辑时:
步骤 1:按空白画板语法创建
docs +update- 在 中直接传
--markdown<whiteboard type="blank"></whiteboard> - 需要多个空白画板时,在同一个 里重复多个 whiteboard 标签 步骤 2:从响应中记录 token
--markdown - 成功后,读取响应字段
docs +updatedata.board_tokens - 是新建画板的 token 列表,后续编辑直接使用这里的 token 步骤 3:引导编辑
data.board_tokens - 记录需要编辑的画板 token
- 查看 了解如何编辑画板内容
../lark-whiteboard/SKILL.md
If the user just created a blank whiteboard via and needs to edit it:
Step 1: Create using blank whiteboard syntax
docs +update- Directly pass in
<whiteboard type="blank"></whiteboard>--markdown - When multiple blank whiteboards are needed, repeat multiple whiteboard tags in the same Step 2: Record the token from the response
--markdown - After succeeds, read the response field
docs +updatedata.board_tokens - is a list of tokens for the newly created whiteboards; use these tokens directly for subsequent editing Step 3: Guide to editing
data.board_tokens - Record the token of the whiteboard to be edited
- Check to learn how to edit whiteboard content
../lark-whiteboard/SKILL.md
注意事项
Notes
- 已有画板内容无法通过 lark-doc 的 直接编辑
docs +update - 编辑画板需要使用专门的
../lark-whiteboard/SKILL.md
- Existing whiteboard content cannot be directly edited via lark-doc's
docs +update - Specialized is required for editing whiteboards
../lark-whiteboard/SKILL.md
快速决策
Quick Decision
- 用户说“找一个表格”“按名称搜电子表格”“找报表”“最近打开的表格”,先用 做资源发现。
lark-cli docs +search - 不是只搜文档 / Wiki;结果里会直接返回
docs +search等云空间对象。SHEET - 拿到 spreadsheet URL / token 后,再切到 做对象内部读取、筛选、写入等操作。
lark-sheets
- When users say "find a spreadsheet", "search for spreadsheets by name", "find reports", or "recently opened spreadsheets", first use for resource discovery.
lark-cli docs +search - does not only search documents/Wiki; the results will directly return cloud space objects such as
docs +search.SHEET - After obtaining the spreadsheet URL/token, switch to for operations such as internal reading, filtering, and writing.
lark-sheets
补充说明
Supplementary Notes
docs +searchIn addition to searching documents/Wiki, also serves as a resource discovery entry for "locating cloud space objects first, then switching back to the corresponding business skill for operations"; when users verbally mention "spreadsheets/reports", start here first.
docs +searchShortcuts(推荐优先使用)
Shortcuts (Recommended for Priority Use)
Shortcut 是对常用操作的高级封装()。有 Shortcut 的操作优先使用。
lark-cli docs +<verb> [flags]| Shortcut | 说明 |
|---|---|
| Search Lark docs, Wiki, and spreadsheet files (Search v2: doc_wiki/search) |
| Create a Lark document |
| Fetch Lark document content |
| Update a Lark document |
| Insert a local image or file at the end of a Lark document (4-step orchestration + auto-rollback) |
| Download document media or whiteboard thumbnail (auto-detects extension) |
| Update an existing whiteboard in lark document with whiteboard dsl. Such DSL input from stdin. refer to lark-whiteboard skill for more details. |
Shortcuts are advanced encapsulations of common operations (). Prioritize using operations with Shortcuts.
lark-cli docs +<verb> [flags]| Shortcut | Description |
|---|---|
| Search Lark docs, Wiki, and spreadsheet files (Search v2: doc_wiki/search) |
| Create a Lark document |
| Fetch Lark document content |
| Update a Lark document |
| Insert a local image or file at the end of a Lark document (4-step orchestration + auto-rollback) |
| Download document media or whiteboard thumbnail (auto-detects extension) |
| Update an existing whiteboard in lark document with whiteboard dsl. Such DSL input from stdin. refer to lark-whiteboard skill for more details. |