lark-drive
SkillCommunityTranslated from ChineseThis skill provides comprehensive management for Lark Drive (also known as Feishu Cloud Storage). It enables users to upload, download, organize, and search files, as well as manage document permissions, comments, and metadata. Additionally, it supports importing local files like Word, Excel, and Markdown into online Lark documents.
npx skills add open.feishu.cn/lark-drivedrive (v1)
CRITICAL, Before starting, you MUST use the Read tool to read ../lark-shared/SKILL.md, which contains information on authentication and permission handling.
Terminology Note: Feishu Cloud Space is also commonly referred to as "Cloud Drive," "Cloud Storage," "Network Drive," or "My Space." These terms generally refer to the same product, which is the official Feishu cloud-based file storage and management center.
Import Routing Rule: If a user wants to import a local Excel / CSV /
.basesnapshot into Base / Bitable, you must prioritize usinglark-cli drive +import --type bitable. Do not switch tolark-basefirst;lark-baseis only responsible for operations within the table after the import is complete.
Quick Decision Making
- If a user wants to check / govern document permissions, public visibility, link sharing, external access, copy/download permissions, security labels, or owner transfer, or needs a "permission risk report, tightening of permissions, requesting view / edit access, or transferring / batch transferring ownership," you must first read
references/lark-drive-workflow.mdand then enter thepermission_governanceworkflow via theWorkflow Registry. - If a user wants to organize their Cloud Drive / folders / document libraries / knowledge bases / personal document libraries, or needs to "audit directory structure, identify unarchived/temporary/duplicate/empty directories, or generate an organization plan," you must first read
references/lark-drive-workflow-knowledge-organize.md. By default, only generate a plan; creating directories, moving resources, and requesting permissions must be confirmed separately. - If a user wants to search for documents / Wiki / spreadsheets / Bitable / Cloud Space (Cloud Drive/Cloud Storage) objects, prioritize using
lark-cli drive +search. In natural language, "recently edited by me," "created by me" (→--created-by-me, original creator semantics), "managed/owned by me" (→--mine, owner semantics), "xxx I opened in the last week," "docx owned by someone," etc., map directly to flat flags to avoid manual nested JSON. - If a user wants to locate text based on document comments, such as reviewing a document based on comments, looking back at a document based on comment content, or distinguishing between multiple identical cited texts, docx type (
file_type=docx) documents support returning comment locations vianeed_relation=true. Other types are not currently supported. For specific usage, readreferences/lark-drive-comment-location.mdfirst. - If a user provides a doubao.com Cloud Space resource URL/token, or explicitly mentions a file/folder/docx/sheet/bitable/wiki resource in Doubao, route to this skill based on the resource type, URL path, and token; do not fall back to WebFetch just because the domain is not Feishu.
- If a user wants to import a local
.xlsx/.csv/.baseinto Base / Bitable, the first step must be usinglark-cli drive +import --type bitable. - If a user wants to import a local
.md/.docx/.doc/.txt/.htmlinto an online document, uselark-cli drive +import --type docx. - If a user wants to import a local
.pptxinto Feishu Slides, uselark-cli drive +import --type slides; the current PPTX import limit is 500MB. - If a user wants to upload, create, read, partially patch, or overwrite update native
.mdfiles (not imported as docx) in Drive, switch tolark-markdown. - If a user wants to compare historical version differences of native
.mdfiles, or compare a remote Markdown with a local draft, switch tolark-cli markdown +diffinlark-markdown; usedrive +version-historyfirst if a version number is needed. - If a user wants to view, download, roll back, or delete historical versions of a file, use
drive +version-history,drive +version-get,drive +version-revert, ordrive +version-delete; this set of commands supports both--as userand--as bot, with--as botpreferred for automation scenarios. - If a user wants to import a local
.xlsx/.xls/.csvinto a spreadsheet, uselark-cli drive +import --type sheet. - If a user wants to create a new folder in Cloud Space (Cloud Drive/Cloud Storage), prioritize using
lark-cli drive +create-folder. - If a user wants to see which downloadable/previewable formats are available for a file, or wants to download PDF / HTML / text / image preview artifacts, use
lark-cli drive +preview. - If a user wants to get a cover image for a file, prioritize using
lark-cli drive +cover; use--list-onlyfirst to check specifications, then select--specto download. - If a user wants to upload a local file to a specific wiki node in a knowledge base / document library, still use
lark-cli drive +upload --wiki-token <wiki_token>; do not mistakenly switch towikidomain commands. - If the user provides a wiki URL / token and the underlying resource type is not yet explicitly known, use
lark-cli drive +inspectto unpack it first; do not automatically switch to other write interfaces if+inspectfails, handle permissions, scope, or link issues according to the error prompt first. - If
drive +inspect/drive +uploadencountersnot found,permission denied, ormissing scope, stop retrying by default; onlyrate limitor temporary network errors are suitable for limited retries.
Modify Title
- Use the
drive files patchcommand and the new_title field to modify the title. This supports docx, sheet, bitable, file, wiki, and folder types.
Core Concepts
Document Types and Tokens
In the Feishu Open Platform, different document types 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.
Document URL Formats and Token Handling
| URL Format | Example | Token Type | Handling Method |
|---|---|---|---|
/docx/ | https://example.larksuite.com/docx/doxcnxxxxxxxxx | file_token | Use the token in the URL path directly as file_token |
/doc/ | https://example.larksuite.com/doc/doccnxxxxxxxxx | file_token | Use the token in the URL path directly as file_token |
/wiki/ | https://example.larksuite.com/wiki/wikcnxxxxxxxxx | wiki_token | Cannot be used directly as an underlying file_token; prioritize using drive +inspect to unpack and get obj_token |
/sheets/ | https://example.larksuite.com/sheets/shtcnxxxxxxxxx | file_token | Use the token in the URL path directly as file_token |
/drive/folder/ | https://example.larksuite.com/drive/folder/fldcnxxxx | folder_token | Use the token in the URL path as the folder token |
Wiki Link Special Handling
lark-cli drive +inspect --url 'https://xxx.feishu.cn/wiki/wikcnXXX'
Behind a knowledge base link could be a docx, sheet, bitable, slides, file, or other object. When performing subsequent comments, downloads, exports, or content reading, prioritize using drive +inspect to get the type, token, title, and url; for complete manual parsing and cross-skill routing, see the shared document lark-wiki-token-routing.md. Do not guess the underlying type based solely on /wiki/<token>.
Common Operation Token Requirements
| Operation | Required Token | Note |
|---|---|---|
| Read document content | file_token / Automatically handled via docs +fetch --api-version v2 | docs +fetch --api-version v2 supports passing the URL directly |
| Add partial comment (highlight comment) | file_token | When passing --block-id, drive +add-comment creates a partial comment; docx supports text positioning or block_id, sheet uses <sheetId>!<cell>, slides uses <slide-block-type>!<xml-id>; Base only has record partial comments, positioned as file_token(base_token) + --block-id <table-id>!<record-id>!<view-id> |
| Add full-text comment | file_token | When --block-id is not passed, drive +add-comment creates a full-text comment by default; supports docx, legacy doc URLs, Drive files with whitelisted extensions, and wiki URLs that resolve to doc/docx/file |
| Download file | file_token | Extract directly from the file URL |
| Upload file | folder_token / wiki_node_token | Token of the target location |
| List document comments | file_token | Same as adding comments |
Comment Capability Entry
- For adding comments, prioritize using
+add-comment: in review / proofreading scenarios, default to creating partial comments whenever possible; do not merge multiple locatable issues into one full-text comment. - For comment queries, statistics, sorting, and reply restrictions, read
lark-drive-comments-guide.mdfirst. - When you need to locate text based on comments, confirm the target is
file_type=docxfirst, then readlark-drive-comment-location.md; other document types do not currently support returning location fields. - For reaction / emoji-related operations, read
lark-drive-reactions.mdfirst; only includeneed_reaction=truewhen the user explicitly requires reaction information. - The
--contentfordrive +add-commentrequires areply_elementsJSON array string, e.g.,--content '[{"type":"text","text":"body"}]'. slidescomments require explicitly passing--block-id <slide-block-type>!<xml-id>; the CLI will split this and write it intoanchor.block_idandanchor.slide_block_type. The<xml-id>is the elementidin the PPT XML protocol;--selection-with-ellipsisand--full-commentare not supported.- Text content in comments (adding comments, replying to comments, editing replies) cannot directly contain
<or>; they must be escaped before submission:<-><,>->>. - When using
drive +add-comment, the shortcut automatically performs the above escaping fortype=textelements; if callingdrive file.comments create_v2,drive file.comment.replys create, ordrive file.comment.replys updatedirectly, you must pass the escaped content in the request yourself. - Base record partial comments use
--type bitable/--type baseor/base/,/bitable/, or wiki Base links;bitableand Base are the same concept,bitableis the internal code, Base is the product name. It is recommended to passbitablefor raw tokens;baseis only used as a compatibility alias. - Base does not support global comments; all comments are attached to records. Positioning information must be file token (base token) +
--block-id <table-id>!<record-id>!<view-id>, where table/record/view IDs usually start withtbl/rec/vewrespectively. The view_id only determines which view opens when clicked from a notification; it does not affect the comment attachment point. Comments are visible on the same record regardless, but it must be passed, otherwise the notification cannot determine which view to jump to. IDs can be obtained vialark-base. - If the wiki resolves to something other than
doc/docx/file/sheet/slides/bitable/base, do not use+add-comment. - If you need to call the comment V2 protocol directly at a lower level, use the native API: execute
lark-cli schema drive.file.comments.create_v2first, then executelark-cli drive file.comments create_v2 .... Omitanchorfor full-text comments; for docx/sheet/slides partial comments, passanchor.block_id; for Base record partial comments, passanchor.block_id(table_id),anchor.base_record_id, andanchor.base_view_id. - When calling native
drive.file.comments.*/drive.file.comment.replys.*to comment on Base documents, setfile_typetobitable, notbase.
Typical Errors and Solutions
| Error Message | Reason | Solution |
|---|---|---|
not exist | Incorrect token used | Check token type; wiki links must be queried first to get obj_token |
permission denied | No relevant operation permission | Guide the user to check if their current identity has the corresponding operation permission for the document/file; grant permission if necessary |
invalid file_type | Incorrect file_type parameter | Pass the correct file_type (docx/doc/sheet/slides/bitable) based on obj_type |
Permission Capability Entry
- If a user wants to manage Drive document/file collaborators, public permissions, authorize the current application to access a document, or handle
91009/91010/91011/91012errors frompermission.public.patch, readlark-drive-permission-guide.mdfirst. - If the user simply lacks access and wishes to request access from the owner, prioritize using
+apply-permission. - General scope, identity, or login issues are still handled according to
lark-shared; do not simply classify tenant security policies, external sharing, or security level interception as missing scope.
Out of Scope for This Skill
- Document body reading, summarization, creation, editing, image/attachment insertion or download: use
lark-doc. - Spreadsheet cell, filtering, formula, style, and other in-table operations: use
lark-sheets. - Base / Bitable internal table, field, record, view, dashboard, and other operations: use
lark-base. - Knowledge space, Wiki node hierarchy, space member management: use
lark-wiki; uploading local files to wiki nodes still usesdrive +upload --wiki-token. - Native Markdown file reading, writing, patching, diffing: use
lark-markdown; only usedrive +import --type docxto import Markdown as an online docx.
Shortcuts (Recommended)
Shortcuts are high-level encapsulations of common operations (lark-cli drive +<verb> [flags]). Prioritize using operations that have shortcuts.
| Shortcut | Note |
|---|---|
+search | Search for documents, Wiki, tables, folders, and other Cloud Space objects; supports flat flags like --edited-since, --created-by-me, --mine, --doc-types, etc.; distinguishes between original creator and owner semantics. |
+upload | Upload local files to a Drive folder or wiki node. |
+create-folder | Create a new Drive folder; supports parent folder and automatic authorization after bot creation. |
+download | Download Drive files to local. |
+preview | View or download PDF / HTML / text / image preview artifacts of a file. |
+cover | View or download file cover image specifications. |
+status | Compare differences between a local directory and a Drive folder; defaults to precise comparison via SHA-256, --quick uses modification time for approximate comparison. |
+pull | Pull files from Drive to a local directory; supports duplicate remote path handling and incremental mode. |
+sync | Two-way sync between local directory and Drive folder: pull new_remote, push new_local, handle modified via --on-conflict=remote-wins|local-wins|keep-both|ask; --quick uses modification time for approximate comparison; --on-duplicate-remote supports fail / newest / oldest; only syncs type=file, skips online documents and shortcuts, and does not delete extra files on either side. |
+push | Push local directory to a Drive folder; supports skip / smart / overwrite and deletion of remote files after confirmation. |
+create-shortcut | Create a shortcut to an existing Drive file in another folder. |
+add-comment | Add comments to doc/docx/file/sheet/slides/base(bitable); also supports wiki URLs that resolve to these types; see lark-drive-comments-guide.md for comment statistics, replies, and reaction details. |
+export | Export doc/docx/sheet/bitable/slides as local files. |
+export-download | Download files based on the file_token of the exported artifact. |
+import | Import local files as Feishu online documents, sheets, Bitable, or slides. |
+version-history | View file historical versions. |
+version-get | Download a specific historical version. |
+version-revert | Roll back to a specific historical version. |
+version-delete | Delete a specific historical version. |
+move | Move Drive files or folders; use lark-wiki for Wiki hierarchy moves. |
+delete | Delete Drive files or folders; folder deletion will poll asynchronous tasks. |
+task_result | Query results of asynchronous tasks like import/export/move/delete. |
+inspect | Inspect the type, title, and canonical token of a URL; wiki URLs are automatically unpacked to the underlying document. |
+apply-permission | Request access permissions from the document owner as a user. |
+secure-label-list | List security labels available to the current user. |
+secure-label-update | Update the security label of a Drive file or document. |
API Resources
lark-cli schema drive.<resource>.<method> # Must view parameter structure before calling API
lark-cli drive <resource> <method> [flags] # Call API
Important: When using native APIs, you must run
schemafirst to view the--data/--paramsparameter structure; do not guess field formats.High-Frequency Native Commands: When reading a Drive folder list, use
drive files list. You must passfolder_token/page_tokenvia--paramsaccording to the template inreferences/lark-drive-files-list.mdand handle pagination manually; do not pass--page-alloutput directly to JSON parsing scripts.
files
copy, Copy filecreate_folder, Create new folderlist, Get list under a folder; readreferences/lark-drive-files-list.mdbefore usepatch, Modify file title
file.comments
batch_query, Batch get commentscreate_v2, Add full-text/partial (highlight) commentlist, Get document comments by pagepatch, Resolve/restore comment
file.comment.replys
create, Add replydelete, Delete replylist, Get repliesupdate, Update reply
permission.members
-
auth, -create, Add collaborator permission -
transfer_owner, ### metas -
batch_query, Get document metadata
user
remove_subscription, Unsubscribe from user/application dimension eventssubscription, Subscribe to user/application dimension events (comment addition events are open this time)subscription_status, Query subscription status of user/application for specified events
file.statistics
get, Get file statistics
file.view_records
list, Get visitor records for a document
file.comment.reply.reactions
update_reaction, Add/delete reaction
quota_details
get, Get capacity information for the current user, including usage by business, whether tenant quota is exceeded, user quota, and department quota- Only supports
--as user, do not use the default bot identity - Pass the current user's
user_idforquota_detail_id
- Only supports
drive (v1)
CRITICAL — 开始前 MUST 先用 Read 工具读取 ../lark-shared/SKILL.md,其中包含认证、权限处理
术语说明: 飞书云空间也常被称为"云盘"、"云存储"、"网盘"或"我的空间",这些说法通常指的是同一个产品,是飞书官方的云端文件存储与管理中心。
导入分流规则: 如果用户要把本地 Excel / CSV /
.base快照导入成 Base / 多维表格 / bitable,必须优先使用lark-cli drive +import --type bitable。不要先切到lark-base;lark-base只负责导入完成后的表内操作。
快速决策
- 用户要检查 / 治理文档权限、公开范围、链接分享、外部访问、复制下载权限、密级标签、owner 转移,或要“权限风险报告、收紧权限、申请查看 / 编辑权限、转移 / 批量转移 owner”,必须先阅读
references/lark-drive-workflow.md,再按其中Workflow Registry进入permission_governanceworkflow。 - 用户要整理云盘 / 文件夹 / 文档库 / 知识库 / 个人文档库,或要“盘点目录结构、找出未归档/临时/重复/空目录、生成整理方案”,必须先阅读
references/lark-drive-workflow-knowledge-organize.md。默认只生成方案;创建目录、移动资源、申请权限都必须单独确认。 - 用户要搜文档 / Wiki / 电子表格 / 多维表格 / 云空间(云盘/云存储)对象,优先使用
lark-cli drive +search。自然语言里"最近我编辑过的"、"我创建的"(→--created-by-me,原始创建者语义)、"我负责/owner 的"(→--mine,owner 语义)、"最近一周我打开过的 xxx"、"某人 owner 的 docx" 等直接映射到扁平 flag,避免手写嵌套 JSON。 - 用户要根据文档评论定位正文位置,例如 根据评论 review 文档、根据评论内容回看文档、区分多处相同引用文本时,对于 docx 类型(
file_type=docx)的文档支持通过need_relation=true返回评论位置,其他类型暂不支持,具体用法需要先阅读references/lark-drive-comment-location.md了解。 - 用户给出 doubao.com 的云空间资源 URL/token,或明确提到豆包里的 file/folder/docx/sheet/bitable/wiki 资源时,仍按资源类型、URL 路径和 token 路由到本 skill;不要因为域名不是飞书而回退到 WebFetch。
- 用户要把本地
.xlsx/.csv/.base导入成 Base / 多维表格 / bitable,第一步必须使用lark-cli drive +import --type bitable。 - 用户要把本地
.md/.docx/.doc/.txt/.html导入成在线文档,使用lark-cli drive +import --type docx。 - 用户要把本地
.pptx导入成飞书幻灯片,使用lark-cli drive +import --type slides;当前 PPTX 导入上限是 500MB。 - 用户要在 Drive 里上传、创建、读取、局部 patch 或覆盖更新原生
.md文件(不是导入成 docx),切到lark-markdown。 - 用户要比较原生
.md文件的历史版本差异,或比较远端 Markdown 与本地草稿,切到lark-markdown的lark-cli markdown +diff;需要版本号时先用drive +version-history。 - 用户要查看、下载、回滚或删除文件的历史版本,使用
drive +version-history、drive +version-get、drive +version-revert、drive +version-delete;这组命令同时支持--as user和--as bot,自动化场景优先--as bot。 - 用户要把本地
.xlsx/.xls/.csv导入成电子表格,使用lark-cli drive +import --type sheet。 - 用户要在云空间(云盘/云存储)里新建文件夹,优先使用
lark-cli drive +create-folder。 - 用户要查看某个文件有哪些可下载预览格式,或想下载 PDF / HTML / 文本 / 图片等预览产物,使用
lark-cli drive +preview。 - 用户要获取某个文件的封面图,优先使用
lark-cli drive +cover;先--list-only看规格,再选--spec下载。 - 用户要把本地文件上传到知识库 / 文档库里的某个 wiki 节点下时,仍然使用
lark-cli drive +upload --wiki-token <wiki_token>;不要误切到wiki域命令。 lark-base只负责导入完成后的 Base 内部操作(表、字段、记录、视图),不要在“本地文件 -> Base”这一步提前切到lark-base。- 用户给的是 wiki URL / token,且后续还没明确底层资源类型时,先用
lark-cli drive +inspect解包;+inspect失败后不要自动切到别的写接口继续尝试,先按错误提示处理权限、scope 或链接问题。 drive +inspect/drive +upload遇到not found、permission denied、missing scope时,默认停止重试;只有rate limit或临时网络错误才适合有限重试。
修改标题
- 使用
drive files patch命令,通过new_title字段可以修改标题,支持 docx、sheet、bitable、file、wiki、folder 类型
核心概念
文档类型与 Token
飞书开放平台中,不同类型的文档有不同的 URL 格式和 Token 处理方式。在进行文档操作(如添加评论、下载文件等)时,必须先获取正确的 file_token。
文档 URL 格式与 Token 处理
| URL 格式 | 示例 | Token 类型 | 处理方式 |
|---|---|---|---|
/docx/ | https://example.larksuite.com/docx/doxcnxxxxxxxxx | file_token | URL 路径中的 token 直接作为 file_token 使用 |
/doc/ | https://example.larksuite.com/doc/doccnxxxxxxxxx | file_token | URL 路径中的 token 直接作为 file_token 使用 |
/wiki/ | https://example.larksuite.com/wiki/wikcnxxxxxxxxx | wiki_token | 不能直接当底层 file_token;优先用 drive +inspect 解包获取 obj_token |
/sheets/ | https://example.larksuite.com/sheets/shtcnxxxxxxxxx | file_token | URL 路径中的 token 直接作为 file_token 使用 |
/drive/folder/ | https://example.larksuite.com/drive/folder/fldcnxxxx | folder_token | URL 路径中的 token 作为文件夹 token 使用 |
Wiki 链接特殊处理
lark-cli drive +inspect --url 'https://xxx.feishu.cn/wiki/wikcnXXX'
知识库链接背后可能是 docx、sheet、bitable、slides、file 等不同对象。后续要做评论、下载、导出或内容读取时,优先用 drive +inspect 拿到 type、token、title、url;完整手动解析和跨 skill 路由见共享文档 lark-wiki-token-routing.md。不要只根据 /wiki/<token> 猜底层类型。
常见操作 Token 需求
| 操作 | 需要的 Token | 说明 |
|---|---|---|
| 读取文档内容 | file_token / 通过 docs +fetch --api-version v2 自动处理 | docs +fetch --api-version v2 支持直接传入 URL |
| 添加局部评论(划词评论) | 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> |
| 添加全文评论 | file_token | 不传 --block-id 时,drive +add-comment 默认创建全文评论;支持 docx、旧版 doc URL、白名单扩展名的 Drive file,以及最终解析为 doc/docx/file 的 wiki URL |
| 下载文件 | file_token | 从文件 URL 中直接提取 |
| 上传文件 | folder_token / wiki_node_token | 目标位置的 token |
| 列出文档评论 | file_token | 同添加评论 |
评论能力入口
- 添加评论优先使用
+add-comment:review / 审阅 / 校对场景默认尽量创建局部评论,不要把多个可定位问题合并为一条全文评论。 - 评论查询、统计、排序、回复限制,先读
lark-drive-comments-guide.md。 - 需要根据评论定位正文位置时,先确认目标是
file_type=docx,再读lark-drive-comment-location.md;其他文档类型暂不支持返回定位字段。 - reaction / 表情相关操作先读
lark-drive-reactions.md;只有用户明确需要 reaction 信息时才带need_reaction=true。 drive +add-comment的--content需要传reply_elementsJSON 数组字符串,例如--content '[{"type":"text","text":"正文"}]'。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。- 评论写入内容(添加评论、回复评论、编辑回复)里的文本不能直接出现
<、>;提交前必须先转义:<-><,>->>。 - 使用
drive +add-comment时,shortcut 会对type=text的文本元素自动做上述转义兜底;如果直接调用drive file.comments create_v2、drive file.comment.replys create、drive file.comment.replys update,则需要在请求里自行传入已转义的内容。 - Base 记录局部评论使用
--type bitable/--type base或/base/、/bitable/、wiki Base 链接;bitable和 Base 是同一概念,bitable是内部代号、Base 是产品名,裸 token 推荐传bitable,base仅作为兼容别名兜底。 - 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获取。 - 如果 wiki 解析后不是
doc/docx/file/sheet/slides/bitable/base,不要用+add-comment。 - 如果需要更底层地直接调用评论 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。 - 直接调用原生
drive.file.comments.*/drive.file.comment.replys.*评论 Base 文档时,file_type填bitable,不要填base。
典型错误与解决方案
| 错误信息 | 原因 | 解决方案 |
|---|---|---|
not exist | 使用了错误的 token | 检查 token 类型,wiki 链接必须先查询获取 obj_token |
permission denied | 没有相关操作权限 | 引导用户检查当前身份对文档/文件是否有相应操作权限;如果需要,可以授予相应权限 |
invalid file_type | file_type 参数错误 | 根据 obj_type 传入正确的 file_type(docx/doc/sheet/slides/bitable) |
权限能力入口
- 用户要管理 Drive 文档/文件协作者、公开权限、授权当前应用访问文档,或处理
permission.public.patch的91009/91010/91011/91012错误时,先读lark-drive-permission-guide.md。 - 用户只是没有访问权限并希望向 owner 申请访问,优先使用
+apply-permission。 - 普通 scope、身份或登录问题仍按
lark-shared处理;不要把租户安全策略、对外分享、密级拦截简单归类为缺 scope。
不在本 skill 范围
- 文档正文读取、总结、创建、编辑、图片/附件插入或下载:使用
lark-doc。 - 电子表格单元格、筛选、公式、样式等表内操作:使用
lark-sheets。 - Base / 多维表格内部的表、字段、记录、视图、仪表盘等操作:使用
lark-base。 - 知识空间、Wiki 节点层级、空间成员管理:使用
lark-wiki;上传本地文件到 wiki 节点仍用drive +upload --wiki-token。 - 原生 Markdown 文件读取、写入、patch、diff:使用
lark-markdown;把 Markdown 导入成在线 docx 才用drive +import --type docx。
Shortcuts(推荐优先使用)
Shortcut 是对常用操作的高级封装(lark-cli drive +<verb> [flags])。有 Shortcut 的操作优先使用。
| Shortcut | 说明 |
|---|---|
+search | 搜索文档、Wiki、表格、文件夹等云空间对象;支持 --edited-since、--created-by-me、--mine、--doc-types 等扁平 flag;区分 original creator 与 owner 语义。 |
+upload | 上传本地文件到 Drive 文件夹或 wiki 节点。 |
+create-folder | 新建 Drive 文件夹,支持父文件夹与 bot 创建后自动授权。 |
+download | 下载 Drive 文件到本地。 |
+preview | 查看或下载文件的 PDF / HTML / 文本 / 图片等预览产物。 |
+cover | 查看或下载文件封面图规格。 |
+status | 比较本地目录与 Drive 文件夹差异;默认按 SHA-256 精确比较,--quick 使用修改时间近似比较。 |
+pull | 从 Drive 拉取文件到本地目录,支持重复远端路径处理和增量模式。 |
+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,且不会删除两端多余文件。 |
+push | 将本地目录推送到 Drive 文件夹,支持 skip / smart / overwrite 与确认后删除远端。 |
+create-shortcut | 在另一个文件夹里创建现有 Drive 文件的快捷方式。 |
+add-comment | 给 doc/docx/file/sheet/slides/base(bitable) 添加评论,也支持解析到这些类型的 wiki URL;评论统计、回复和 reaction 细则见 lark-drive-comments-guide.md。 |
+export | 将 doc/docx/sheet/bitable/slides 导出为本地文件。 |
+export-download | 根据导出产物的 file_token 下载文件。 |
+import | 将本地文件导入为飞书在线文档、表格、多维表格或幻灯片。 |
+version-history | 查看文件历史版本。 |
+version-get | 下载指定历史版本。 |
+version-revert | 回滚到指定历史版本。 |
+version-delete | 删除指定历史版本。 |
+move | 移动 Drive 文件或文件夹;Wiki 层级移动走 lark-wiki。 |
+delete | 删除 Drive 文件或文件夹,文件夹删除会轮询异步任务。 |
+task_result | 查询 import/export/move/delete 等异步任务结果。 |
+inspect | 检视 URL 的类型、标题和 canonical token;wiki URL 会自动解包到底层文档。 |
+apply-permission | 以 user 身份向文档 owner 申请访问权限。 |
+secure-label-list | 列出当前用户可用的密级标签。 |
+secure-label-update | 更新 Drive 文件或文档的密级标签。 |
API Resources
lark-cli schema drive.<resource>.<method> # 调用 API 前必须先查看参数结构
lark-cli drive <resource> <method> [flags] # 调用 API
重要:使用原生 API 时,必须先运行
schema查看--data/--params参数结构,不要猜测字段格式。高频原生命令: 读取 Drive 文件夹清单时使用
drive files list,必须按references/lark-drive-files-list.md的模板通过--params传folder_token/page_token,并手动处理分页;不要把--page-all输出直接交给 JSON 解析脚本。
files
copy— 复制文件create_folder— 新建文件夹list— 获取文件夹下的清单;使用前阅读references/lark-drive-files-list.mdpatch— 修改文件标题
file.comments
batch_query— 批量获取评论create_v2— 添加全文/局部(划词)评论list— 分页获取文档评论patch— 解决/恢复 评论
file.comment.replys
create— 添加回复delete— 删除回复list— 获取回复update— 更新回复
permission.members
auth—create— 增加协作者权限transfer_owner—
metas
batch_query— 获取文档元数据
user
remove_subscription— 取消订阅用户、应用维度事件subscription— 订阅用户、应用维度事件(本次开放评论添加事件)subscription_status— 查询用户、应用对指定事件的订阅状态
file.statistics
get— 获取文件统计信息
file.view_records
list— 获取文档的访问者记录
file.comment.reply.reactions
update_reaction— 添加/删除 reaction
quota_details
get— 获取当前用户的容量信息,包含各业务使用量、租户配额是否超限、用户配额、所在部门配额- 仅支持
--as user,不要使用默认的 bot 身份 quota_detail_id传当前用户的user_id
- 仅支持
Installs
275,739First seen
Jun 10, 2026
Auto-fetched from GitHub .
Stats via skills.sh.
Skills similar to lark-drive:
Installs
Installs
Installs