SuperAPI AI Directory

lark-drive

Office & productivity

View repository

Updated 10-14 05:33

About this skill

drive (v1)

CRITICAL — Before starting, you MUST first use the Read tool to read ../lark-shared/SKILL.md, which contains authentication and permission handling

Terminology notes: Feishu Cloud Space is also often called "Cloud Drive", "Cloud Storage", "Netdisk", or "My Space". These terms usually refer to the same product, which is Feishu's official cloud file storage and management center.

Import routing rules: If the user wants to import a local Excel / CSV / .base snapshot into Base / Bitable / bitable, you must prioritize using lark-cli drive +import --type bitable. Do not first switch to lark-base;lark-base only handles in-table operations after the import is complete.

Copy routing rules: If the user wants to copy an online document, create a document copy, or copy a document to another folder, you must use lark-cli drive +copy. Do not use drive +export to download and then drive +import upload, and do not use docs +fetch + docs +create to rebuild the body; export/import is only for local file conversion or offline artifacts.

Quick decisions

  • The user wants tomove an existing Wiki node out of the knowledge base and place it in a Drive folder or the root directory of "My Space": switch to lark-wiki, use lark-cli wiki +move-to-drive; do not hand the Wiki token directly to drive +move. This is a write operation that changes document ownership and permission inheritance. Before executing, confirm the source node and target location.
  • The user wants tocopy a document / create a copy to the cloud drive or a folder: If a directly usable URL or token is provided, follow references/lark-drive-copy.md and use lark-cli drive +copy; if only the title is provided, first follow references/lark-drive-search.md and use drive +search to uniquely locate the source resource, then copy it according to copy reference. If you want to copy a document / create a copy to the knowledge base, use wiki +node-copy(see lark-wiki-node-copy.md)。
  • The user wants toidentify the type and token of a Feishu / doubao cloud space URL: You can first make a lightweight judgment based on the URL path form; when the path already clearly points to resources such as docx / sheet / bitable / slides / file / folder, you can directly extract the corresponding token/type. If a wiki URL is passed in, the title or canonical URL needs to be identified, the URL/token is ambiguous, or subsequent operations depend on the underlying real resource, then use lark-cli drive +inspect --url '<url>' for identification; for specific usage, failure handling, and boundaries, see references/lark-drive-inspect.md。
  • High-risk write operations (deletion, public permission changes, owner transfer, version deletion/rollback, bulk move/overwrite/sync) must satisfy three conditions simultaneously before execution: the target has been resolved into an execution object directly usable by that operation, the execution details are clear enough to directly invoke the command (for example, the file-token/type for deletion, the sharing scope for public permission changes, the target owner for owner transfer, the version id for version deletion/rollback, and the target location and conflict policy for move/overwrite/sync), and the user explicitly confirms the execution of these specific targets and execution details in this turn. When the user only says "delete useless files", "open/share with everyone", "change to open", or "overwrite/move these", it only indicates the target state; first perform read-only discovery and list the candidates, permission levels, or execution plans, then stop and wait for user confirmation.
  • The user wants tocheck / govern document permissions, public scope, link sharing, external access, copy and download permissions, security level labels, owner transfer, or wants a "permission risk report, tighten permissions, request view / edit permission, transfer / bulk transfer owner", you must first read references/lark-drive-workflow.md, then follow its Workflow Registry to enter permission_governance workflow。
  • When the user explicitly wants toremove a single cloud document collaborator's permission, use lark-cli drive +member-remove; first read references/lark-drive-member-remove.md. This is a high-risk write operation; actual execution must confirm the exact resource, member ID/type, and wiki permission scope, and explicitly pass --yes。
  • When the user wants to, for a specified Feishu document,set / modify the security level label (secure label), or query the security level labels available to the current user, directly read references/lark-drive-secure-label.md; this is a Drive file governance capability.
  • The user wants tocheck / govern document permissions, public scope, link sharing, external access, copy and download permissions, security level labels, owner transfer, or wants a "permission risk report, tighten permissions, request view / edit permission, transfer / bulk transfer owner", you must first read references/lark-drive-workflow.md, then follow its Workflow Registry to enter permission_governance workflow。
  • The user wants toquery the public access, sharing, collaborator management, security, and comment permission settings of a file, folder, or cloud document itself, prefer to use lark-cli drive +permission-get-setting; it only reads the target's own settings and does not recursively audit folder subdocument permissions. A bare token must be explicitly passed --type。
  • When the user wants tosearch for materials across containers by a specific topic, keyword, or content clue, and uniformly collect them into a Drive folder or Wiki node, you must first read references/lark-drive-workflow.md, then follow its Workflow Registry to enter the topic_move_collector workflow. This workflow is responsible for search recall, content verification, relevance classification, move planning, pre-write confirmation, and result verification; it is forbidden to start directly from drive +search or drive +move .
  • The user wants toorganize a cloud drive / folder / document library / knowledge base / personal document library, or wants to "inventory the directory structure, find unarchived/temporary/duplicate/empty directories, generate an organization plan", you must first read references/lark-drive-workflow.md, then follow its Workflow Registry to enter the knowledge_organize workflow. By default, only generate a plan; creating directories, moving resources, and requesting permissions must all be confirmed separately.
  • To search across scopes by topic and archive them centrally, enter topic_move_collector; to inventory directories and restructure a known folder, document library, or knowledge base, enter knowledge_organize; when moving only one already-identified resource, still use the atomic move command.
  • When the user wants tosearch documents / Wiki / spreadsheets / Base / cloud space (cloud drive/cloud storage) objects, prefer lark-cli drive +search; when locating by title and handling duplicate candidates, follow references/lark-drive-search.md. Natural language such as "recently edited by me", "created by me" (→ --created-by-me, original creator semantics), "owned by me/owner" (→ --mine, owner semantics), "xxx I opened in the last week", "docx owned by someone" etc. map directly to flat flags, avoiding hand-written nested JSON.
  • When the user wants todocument commentsperform any operation (add comment, list / batch query, reply, get / update / delete reply, resolve / restore, reaction), select the corresponding drive +<verb> comment command according to the Shortcuts table below, and read that command's ref before executing. For locating document body positions by comment, see references/lark-drive-comment-location.md。
  • When the user provides a doubao.com cloud space resource URL/token, or explicitly mentions a file/folder/docx/sheet/bitable/wiki resource in Doubao, still route to this skill by resource type, URL path, and token; do not fall back to WebFetch just because the domain is not Feishu.
  • When the user wants to import local .xlsx / .csv / .base as a Base / bitable, the first step must use lark-cli drive +import --type bitable。
  • When the user wants to import local .md / .docx / .doc / .txt / .html as an online document, use lark-cli drive +import --type docx。
  • When the user wants to import local .pptx as Feishu Slides, use lark-cli drive +import --type slides; the current PPTX import limit is 500MB.
  • When batch executing drive +import and the target is the same location (the same --folder-token, default root directory, or the same --target-token), execution must be serial; do not import to the same location concurrently, as the server may return a concurrency conflict error.
  • When the user wants to upload, create, read, partially patch, or overwrite-update in Drivenative .md files(not import as docx), switch to lark-markdown。
  • When the user wants to compare native .md files'historical version differences, or compare remote Markdown with a local draft, switch to lark-markdown the lark-cli markdown +diff; when a version number is needed, first use drive +version-history。
  • When the user wants to view, download, roll back, or delete a file'shistorical versions, use drive +version-history、drive +version-get、drive +version-revert、drive +version-delete; this group of commands supports both --as user and --as bot, and automation scenarios prefer --as bot。
  • When the user wants to import local .xlsx / .xls / .csv as a spreadsheet, use lark-cli drive +import --type sheet。
  • When the user wants to create a new folder in cloud space (cloud drive/cloud storage), prefer lark-cli drive +create-folder。
  • When the user wants to view or download file content, or view the available preview formats of a file and obtain converted preview outputs such as PDF / HTML / text / image, use lark-cli drive +preview。+preview and +download both support --file-token / --url / --wiki-token choose one of three (Wiki resolves to the underlying file); but the two only handle Drive files, if the target is an online document such as docx/sheet/bitable/slides, use instead drive +export。
  • When the user wants to get the cover image of a file, prefer lark-cli drive +cover; first --list-only check the specs, then choose --spec download.
  • When the user wants to export a cloud document, prioritize using lark-cli drive +export --url '<文档 URL>' --file-extension <格式>; for detailed parameters, Wiki tokens, and error code handling, see references/lark-drive-export.md。
  • When the user wants to upload a local file to a wiki node in a knowledge base / document library, still use lark-cli drive +upload --wiki-token <wiki_token>; do not mistakenly switch to the wiki domain command.
  • lark-base prematurely at the "local file -> Base" step. lark-base。
  • When the user provides a wiki URL / token, and the underlying resource type has not yet been clarified, first use lark-cli drive +inspect to unwrap;+inspect after a failure, do not automatically switch to another write interface to keep trying; first handle permission, scope, or link issues according to the error message.
  • drive +inspect / drive +upload When encountering not found、permission denied、missing scope , stop retrying by default; only rate limit or temporary network errors are suitable for limited retries.

Modify title

Core concepts

Document types and tokens

On the Feishu 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。

Document URL formats and token handling

URL format Example Token type Handling method
/docx/ https://example.larksuite.com/docx/doxcnxxxxxxxxx file_token The token in the URL path is used directly as file_token use
/doc/ https://example.larksuite.com/doc/doccnxxxxxxxxx file_token The token in the URL path is used directly as file_token use
/wiki/ https://example.larksuite.com/wiki/wikcnxxxxxxxxx wiki_token It cannot be directly used as the underlying file_token; prioritize using drive +inspect to unwrap and obtain obj_token
/sheets/ https://example.larksuite.com/sheets/shtcnxxxxxxxxx file_token The token in the URL path is used directly as file_token use
/page/ https://example.feishu.cn/page/pagcnxxxxxxxx/ apps token The token in the URL path is used directly, and the resource type is apps
/drive/folder/ https://example.larksuite.com/drive/folder/fldcnxxxx folder_token The token in the URL path is used as the folder token

Special handling for Wiki links

lark-cli drive +inspect --url 'https://xxx.feishu.cn/wiki/wikcnXXX'

Behind a knowledge base link there may be different objects such as docx, sheet, bitable, slides, file, etc. When later performing comments, downloads, exports, or content reads, prioritize using drive +inspect to get type、token、title、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 only on /wiki/<token> .

Common operation token requirements

Operation Token required Description
Read document content file_token / automatically handled via docs +fetch auto-handled via docs +fetch supports passing the URL directly
Download file file_token Extract directly from the file URL
Upload file folder_token / wiki_node_token Token of the target location

Typical errors and solutions

Error message Cause Solution
not exist The wrong token was used Check the token type; wiki links must first be queried to obtain obj_token
permission denied No relevant operation permission Guide the user to check whether the current identity has the corresponding operation permission for the document/file; if needed, the corresponding permission can be granted
invalid file_type file_type parameter error According to obj_type Pass the correct file_type (docx/doc/sheet/slides/bitable/apps)
232140101 / 232140100 / 233523001(Commonly seen in drive +import of job_error_msg) Concurrent import / create operations exist at the same location When batch importing to the same folder, root directory, or the same --target-token , switch to serial execution; before each retry for each failed item, wait a few seconds, retry at most 3 times in total, and if it still fails, stop and report the conflict

Permission capability entry points

  • When the user wants to manage collaborators, public permissions, or authorize the current application to access a Drive document/file, or handle permission.public.patch of 91009 / 91010 / 91011 / 91012 error, first read lark-drive-permission-guide.md。
  • When the user wants to query the public access, sharing, collaborator management, security, and comment permission settings of a file, folder, or cloud document itself, use +permission-get-setting; if you need to recursively audit the permissions of sub-documents under a folder, then enter permission_governance workflow。
  • If the user simply lacks access permission and wants to request access from the owner, prefer using +apply-permission。
  • Ordinary scope, identity, or login issues are still handled according to lark-shared ; do not simply classify tenant security policies, external sharing, or confidentiality-level interception as missing scope.

Not within the scope of this skill

  • Reading, summarizing, creating, editing document body text, or inserting or downloading images/attachments: use lark-doc。
  • In-sheet operations such as spreadsheet cells, filters, formulas, and styles: use lark-sheets。
  • Operations within Base / Bitable such as tables, fields, records, views, and dashboards: use lark-base。
  • Knowledge spaces, Wiki node hierarchy, and space member management: use lark-wiki; uploading local files to a wiki node still uses drive +upload --wiki-token。
  • Native Markdown file reading, writing, patch, and diff: use lark-markdown; importing Markdown as an online docx uses drive +import --type docx。

Shortcuts (recommended to use first)

Shortcuts are high-level wrappers for common operations (lark-cli drive +<verb> [flags]). For operations that have a Shortcut, prefer using it.

Shortcut Description
+search Search cloud space objects such as documents, Wiki, sheets, and folders; supports --edited-since、--created-by-me、--mine、--doc-types and other flat flags; distinguishes the semantics of original creator and owner.
+upload Upload local files to a Drive folder or wiki node; when modifying/rewriting/updating an existing file, prefer overwrite upload rather than directly uploading a new file.
+create-folder Create a new Drive folder, supporting parent folders and automatic authorization after bot creation.
+download Download Drive files to local.
+preview View or download file content, or view the available preview formats of a file and obtain converted preview outputs such as PDF / HTML / text / images.
+cover View or download file cover image specifications.
+status Compare differences between a local directory and a Drive folder; by default compares exactly by SHA-256,--quick uses modification time for approximate comparison.
+pull Pull files from Drive to a local directory, supporting duplicate remote path handling and incremental mode.
+sync Bidirectionally sync a local directory with a Drive folder: pull new_remote, push new_local,modified according to --on-conflict=remote-wins|local-wins|keep-both|ask handling;--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 a local directory to a Drive folder, supporting skip / smart / overwrite and deleting the remote after confirmation.
+create-shortcut Create shortcuts to existing Drive files in another folder.
+copy Copy resources to the target folder; to copy to a wiki, use wiki +node-copy;
+add-comment Add full-text/partial comments to doc/docx/file/sheet/slides/base(bitable); Miaoda apps are not supported.
+list-comments Get the comment list with pagination.
+batch-query-comments Batch get comments by comment ID.
+resolve-comment Mark a comment as resolved (is_solved=true)。
+restore-comment Restore/reopen a resolved comment (is_solved=false)。
+add-reply Add a reply to an existing comment.
+list-replies Get the replies under a comment with pagination.
+update-reply Replace the content of a reply entirely.
+delete-reply Delete a reply under a comment (high risk, requires --yes)。
+react-reply Add/remove emoji reactions to a reply.
+export Export doc/docx/sheet/bitable/slides as local files.
+export-download Download the file based on the file_token of the export artifact.
+import Import a local file as a Feishu online document, spreadsheet, bitable, or slides.
+version-history View file version history.
+version-get Download a specified historical version.
+version-revert Roll back to a specified historical version.
+version-delete Delete a specified historical version.
+move Move a Drive file or folder; for Wiki hierarchy moves use lark-wiki。
+update-title Rename a file, folder, online document, or wiki.
+delete Delete a Drive file or folder; folder deletion polls the async task.
+task_result Query the results of async tasks such as import/export/move/delete.
+inspect Inspect the URL's type, title, and canonical token; wiki URLs are automatically unwrapped to the underlying document.
+apply-permission Request access permission from the document owner as a user.
+member-add Add one or up to 10 collaborators/authorized members to a Drive document, file, folder, or wiki node; wraps Drive permission member create/batch_create, and actual writes require --yes。
+member-list Query the collaborator/authorized member list of a Drive document, file, folder, or wiki node.
+member-remove Remove a collaborator from a Drive document, file, folder, or wiki node; wraps Drive permission member delete, and actual writes require --yes。
+permission-get-setting Query the public access, sharing, collaborator management, security, and comment permission settings of a file, folder, or cloud document itself; supports URL or bare token + --type; does not recursively read the permissions of subdocuments in a folder.
+secure-label-list List the classification labels available to the current user.
+secure-label-update Update the classification label of a Drive file or document.

API Resources

lark-cli schema drive.<resource>.<method>   # 调用 API 前必须先查看参数结构
lark-cli drive <resource> <method> [flags] # 调用 API

Important: When using native APIs, you must first run schema to view the --data / --params parameter structure; do not guess the field format.

High-frequency native commands: When reading a Drive folder listing, use drive files list; before use, read references/lark-drive-files-list.md, pass parameters via --params according to the template and handle pagination manually; do not pass the --page-all output directly to a JSON parsing script.

files

permission.members

  • auth —
  • create — Add collaborator permissions
  • transfer_owner —

metas

  • batch_query — Get document metadata

user

  • remove_subscription — Unsubscribe from user and app dimension events
  • subscription — Subscribe to user and app dimension events (this release opens the comment added event)
  • subscription_status — Query the subscription status of users and apps for specified events

file.statistics

  • get — Get file statistics
    • When getting docx / file statistics, it is recommended to use typed flags first:lark-cli drive file.statistics get --file-token <token> --file-type <type> --format json;--params JSON is also supported, suitable for batch assembly or raw parameter scenarios.

file.view_records

  • list — Get the document's visitor records
    • When viewing recent docx access records, returning open_id, up to N entries, it is recommended to use typed flags first:lark-cli drive file.view_records list --file-token <docx_token> --file-type docx --page-size <N> --viewer-id-type open_id --format json;--params JSON is also supported, suitable for batch assembly, paginated continuation, or raw parameter scenarios.

file.comment.reply.reactions

  • update_reaction — Add/remove reaction; prefer using drive +react-reply

quota_details

  • get — Get the current user's capacity information, including usage by business, whether the tenant quota is exceeded, user quota, and department quota
    • Only supports --as user, do not use the default bot identity
    • quota_detail_id Pass the current user's user_id