SuperAPI AI Directory

dingtalk-drive

General & other

View repository

Updated 10-16 05:06

About this skill

DingTalk Drive

Minimal DWS execution contract

  • Use only dws; for structured reads add --format json, and judge by the actual return.
  • Call known commands directly; when parameters/constraints/security are unclear, check the leaf narrow Schema. Only when the Schema is unavailable, read the known leaf Help once;unknown flag correct once using the same leaf Help.unknown command Do not check Help: prefer the explicit suggestion in the error, then an explicit compatible entry point in an already loaded Skill/reference; if neither exists, report drift and stop; a full Catalog is forbidden. Low-frequency references do not default to Help; root/parent/product Help is forbidden. After discovery, it must be executed or the blockage explained.
  • Do not guess commands/flags/fields/IDs/accounts/business facts; IDs come from actual returns. For zero hits/multiple candidates/unclear type, disambiguate first; use contract defaults only for optional time/display scope, and stop when required information is missing.
  • Parse/read/write use the same profile, and IDs do not cross organizations. For multiple accounts, use only the unique isOrgCurrent=true; otherwise use the user-specified one, and do not choose the first item, the most recently logged in, or the most recently used account.
  • Do not output/record tokens, refresh tokens, appSecret, or webhook tokens; do not request them when authentication is already injected.
  • Writes must match explicit intent; confirmation is subject to the final Runtime gate/Schema, and only after confirmation add --yes。
  • After writing, verify the result and do not claim success based on the exit code. Exit must be the final reply, distinguishing completed, partial, blocked, pending confirmation, and failed; preserve existing data and complete/hasMore/stopReason/failures。
  • Display timestamps in the session time zone, and preserve the original values when necessary.
  • For authentication/permissions/profile/confirmation/unknown errors, only read the dingtalk-shared corresponding reference; do not repeatedly guess alternative commands.

Shortcut discovery (on demand)

drive There are currently 28 public shortcuts; the complete list is kept in the Runtime Catalog and Schema, and is not expanded repeatedly in high-frequency product root Skills. Route known intents as below; when parameters/constraints/security are unclear, read the leaf narrow Schema once. Only when result is needed and already published, check outcomes/pagination, and for field-level details check data_schema; do not infer missing parts from Help/examples. Only when the Schema is unavailable, read the known leaf Help once;unknown flag correct once using the same leaf Help.unknown command Help is forbidden: error suggestion → explicit entry point in an already loaded Skill/reference; if neither exists, report drift. Full Catalog/root/parent/product Help is forbidden; low-frequency references do not default to Help.

Only when existing routes and references cannot locate a low-frequency capability, execute dws shortcut list --service drive --format json as the last fallback; do not load the complete Shortcut Catalog or product-level Schema for known high-frequency intents.

Golden Route

User intent Sole recommended entry point Key boundaries
Find files globally by name or keyword dws drive +search --query <关键词> --page-all --max-pages 20 --max-items 500 Automatically paginate when complete search is needed; when only the first batch of results is needed, you may omit --page-all; stop on multiple candidates; for online document body search use doc +search
Browse the root directory or a known folder dws drive +list [--folder <dentryUuid>] --page-all --max-pages 20 --max-items 500 Automatically paginate when complete browsing is needed; when only the first batch of results is needed, you may omit --page-all
Discover DingTalk Drive enterprise space or "My Files" space dws wiki space list --type <orgSpace|mySpace> --format json Drive read-only preflight; orgSpace paginates by nextToken, retrieve spaceId/rootFolderId then return to Drive
View recently accessed/edited document list dws drive +recent [--operate-type 1] --limit <N> 1=recently edited; default recently accessed; use directly when there is no subject, person, direction or action condition
View node type and metadata dws drive +inspect --node <dentryUuid> Add stats/publish/cover on demand, do not force calls for ordinary lists
Download ordinary file dws drive +download --node <dentryUuid> --output <相对路径> Current shortcut accepts ID; for online documents use doc +export
Only want temporary download URL without writing to disk dws drive download --node <dentryUuid> --url-only --format json Use when Agent sandbox/external system downloads on its own; with --output/--overwrite and other write-to-disk parameters are mutually exclusive
Upload ordinary file to DingTalk Drive or knowledge base dws drive +upload --file <相对路径> [--workspace <ID>] Goes to DingTalk Drive by default; when workspace is specified it becomes an independent file node in the knowledge base/document space; folder and node, workspace and space-id are mutually exclusive respectively
Manage ordinary file global comments dws drive comment list-v2/create-v2/reply/update/delete/batch-query/list-replies/resolve/restore/react-reply Reuse the Doc/Sheet new comment pipeline; old list/create is deprecated; fixed full text global, does not support text selection, cells or mention
Create folder dws drive +create-folder --name <名称> [--folder <ID>] Shortcut has been submitted and read back
Create an independent copy of an ordinary file dws drive +download --node <源ID> --output <相对路径> → dws drive +upload --file <同一相对路径> [--folder <目标ID>] Execute after user authorization; when known to be an ordinary file do not try +copy; new upload does not pass --node, to avoid overwriting; for completion evidence see the copy rules below
Copy online document node dws drive +copy --node <ID> [--folder <目标ID>] Ordinary DingTalk Drive files will be rejected; Base structure copy goes through AITable +base-copy --base-id <ID> --target-folder-id <真实ID> --only-struct
Move node dws drive +move --node <ID> --folder <目标ID> Destructive change, follow Runtime confirmation
Rename node dws drive +rename --node <ID> --name <新名称> Check final name after writing
Compare local and DingTalk Drive folders dws drive status --local-folder <绝对路径> --remote-folder <folderId> Read-only; exact MD5 by default, do not pull or push first
Pull DingTalk Drive folder to local dws drive pull --local-folder <绝对路径> --remote-folder <folderId> --if-exists skip Safe default does not overwrite; first use the same parameters --dry-run, then execute after confirmation
Push local folder to DingTalk Drive dws drive push --local-folder <绝对路径> --remote-folder <folderId> --if-exists skip Safe default does not overwrite; dry-run first; will not delete extra remote files
Bidirectional folder sync dws drive sync --local-folder <绝对路径> --remote-folder <folderId> --on-conflict skip Dry-run first; conflict policy must be explicitly preserved

Ordinary file copy rules: reuse the node type and source ID from an existing reliable receipt; if the type is unknown, inspect first, do not probe the type with a failed copy. After a successful download, create a new upload at the target location authorized by the user; confirm that the returned new node ID is different from the source ID, and verify the name, size or content as required by the task. Only giving operation instructions does not count as a created copy; this path does not promise to copy permissions, version history or other online collaboration metadata.

Low-frequency entries

  • Delete confirmed node:dws drive +delete --node <dentryUuid>; restore:+recycle-list/+recycle-restore; version:+version-history/+version-get/+version-download/+version-revert。
  • Favorite:+star-*; public status:+publish-get/+publish-unset(+publish-set does not enter Agent routing); stats/cover use +inspect; shortcuts use +create-shortcut。
  • Node sharing scope:dws drive permission set-share-scope --node <ID> --visibility <PRIVATE|ORGANIZATION|PUBLIC>([Danger] three tiers converge, set enterprise-public/internet-public/collaborators-only). To query the current sharing scope use permission get-setting。
  • Directory tree only uses bounded +list layer-by-layer traversal.

Compatible alias does not select a route:+info→+inspect,+find-file→+search,+search-docs→doc +search。

Current shortest path

  • Known dentryUuid: directly execute inspect/download/list/move/rename; do not search first; execute copy only after confirming it is a supported online document node.
  • If the task explicitly requires "create an online document in a new knowledge base from a local file, then move it to My Documents," it is not Drive root directory organization: do not pre-query mySpace/rootFolderId, do not doc +create then drive +move; the space should be created by Wiki, Doc +import --workspace <新workspaceId>, then Wiki +move-to-drive --workspace <新workspaceId>。
  • When the current command needs to locate a space and lacks the target ID: first clarify the enterprise space orgSpace or "My Files"mySpace, use dws wiki space list --type <类型> --format json to discover spaces;orgSpace when nextToken is non-empty, continue paging with --cursor <nextToken> ,mySpace is fixed to a single item and does not paginate. Obtain the real spaceId or rootFolderId according to the subsequent command and then immediately return to Drive; when these IDs are known, do not perform space discovery.
  • Name only:+search → the unique candidate's nodeId → target command; do not automatically select the first item.
  • Folder hierarchy only: start from the nearest known folder ID +list, do not recurse unboundedly from the root directory.
  • Upload a regular file: a single +upload; for a knowledge base/document space target, explicitly add --workspace, do not fall back to upload-info + handwritten HTTP + commit. To convert to an online document, use Doc +import; to insert a body attachment, use Doc +media-insert。
  • Upload after export:doc +export specify the final local file name on the first attempt, directly reuse the receipt localPath, and on the first formal drive +upload include the already authorized --yes; do not rename after upload.
  • When copy/move/rename/create-folder already have built-in read-after-write, the Agent no longer repeatedly executes +inspect。
  • For renaming with a known nodeId, directly +rename, without first using Catalog, Help, or search; ALIDOC's logical title is verified by reading back the document inside the shortcut.
  • When the folder direction is already clear, directly status/pull/push/sync, without first checking status; for write operations, first dry-run with exactly the same parameters, then execute formally.
  • After search results type=able , reroute according to the business verb: structural copy/delete/operations within Base go to AITable. For structural copy, provide the source Base ID according to the current leaf and the real --target-folder-id; if the target ID is missing, stop; do not guess the root ID or invent --target-root。
  • +inspect/+download/+list only guarantees dentryUuid; when there is only a URL, first use dws drive info --node <URL> --format json to parse and verify result.fileId(i.e., dentryUuid).
  • drive info returns extension=dlink , save result.fileId as the shortcut entry ID, first use dws doc info --node <result.fileId> --format json to read linkSourceInfo. For content reading, editing, export, and type routing, switch to the target linkSourceInfo.nodeId; if the target is still dlink, resolve hop by hop and record visited IDs; stop immediately if resolution fails, a field is missing, or an ID repeats. When the user explicitly moves, renames, or deletes the shortcut entry itself, still use the original result.fileId。

The shortest path does not omit type checking, confirmation, transfer verification, or post-write validation.

Key result semantics

  • +list/+search/+recent For a complete query of --page-all --max-pages <N> --max-items <N>, uniformly use --page-allmay be omitted. A missing collection cannot be treated as an empty result, and when there are multiple candidates, defaulting to the first item is prohibited.
  • +download Validate that the relative path exists and sizeBytes > 0;+upload Check the final nodeId and full name. Ordinary Drive targets must verify the read-back size; when specified --workspace must verify workspaceId, and be compatible with doc/get_document_info splitting the full name into name + extension and the real contract of not returning a size; if a size is returned, it must still match the local one. Only verify checksum when both the source and the result provide a comparable hash; when missing, retain the existing evidence and do not fabricate an end-to-end checksum.
  • copy/move/rename/create-folder check ok/outcome and read-back;partial_success is not completion.
  • status checks the category set; pull/push/sync check summary and per-item results, failed/unknown must be retained.
  • Return a continuation when pagination is not finished; a directory tree or large list must have a maximum depth, page count, and item count.
  • When continuing pages for the same query, if nextCursor repeats and there are no new nodes, stop paging further, retain the results already obtained and report that pagination is incomplete, and do not count duplicate results as newly added.
  • For unknown write effects, inspect/list and read back first; do not blindly replay write operations.

Parameters and safety boundaries

  • --node、--folder uses dentryUuid/fileId, not numeric dentryId; recycle bin restore uses recycleItemId.
  • +list --limit maximum 50,+search --limit maximum 30; if exceeded, paginate, and do not repeatedly try invalid parameters.
  • Write operations are confirmed only by the exact leaf Runtime determination; when specific objects, actions, and effects have been explicitly authorized, the first formal execution directly includes --yes, otherwise confirm first. Previews do not include it, and parameter changes require re-confirmation; using failures lacking --yes for probing is prohibited.
  • Before overwriting an ordinary file, confirm the real type and original name; adoc/axls/able are not overwritten as ordinary files.
  • Single-file Shortcut local input/output uses cwd-relative paths and prohibits ..; folder status/pull/push/sync follows the leaf contract and uses absolute --local-folder。
  • Folder sync defaults to exact MD5; only when the user accepts timestamp approximation use --quick, and redundant files on either side will not be deleted.
  • When parameters are uncertain, check the exact leaf Schema only once; product-level Schema is prohibited.

Load on demand

When Golden Route parameters are sufficient, reading reference is prohibited. Otherwise read at most one exact reference:

Trigger conditions Reference
URL, file type, or cross-product boundary intent-guide
Folder comparison, pull, push, or two-way sync folder-sync
Low-frequency permissions, sharing scope, versions, recycle bin, public status drive reference corresponding sections of
Document query, import, and template shape-preserving workflows lite-recipes

Shortest error path

  1. Zero/multiple candidates, unknown type, or incomplete pagination: stop writing, return candidates or continuation; paginated reads may continue within a valid cursor and budget.
  2. unknown flag: check the current leaf Help only once;unknown command: check the Drive shortcut list only once.
  3. Encountering an online document type during ordinary download: switch to doc +export, and do not repeatedly try Drive download.
  4. Transfer interruption: retain the local temporary state or checkpoint; first determine whether resumption is possible.
  5. Unknown write effect: read back by nodeId; if it cannot be proven, report unknown.
  6. When it is known to be an ordinary file and an independent copy is needed, execute download→upload directly per the Golden Route, and do not use +copy Failure as a pre-check probe. If you still receive the ordinary file copy unsupported error, do not retry or claim completion; after confirming authorization and the target, continue according to the copy rules. If the AITable structure copy lacks or cannot verify the target folder, stop; do not guess the ID or create a test folder.

Cross-product boundaries

  • Storage management of ordinary files/folders and online document nodes → Drive; putting files as attachments into the body of a document goes to Doc +media-insert, and other bodies/content go to Doc, Sheet, and AITable respectively.
  • able outer-layer move/rename goes to Drive; structure copy, Base deletion (+base-delete) and operations inside Base go to AITable.
  • Explicit knowledge base workspace hierarchy → Wiki; the generic term "document space/my documents" usually goes to Drive, but "moving a node in a Wiki library out to my documents" is always completed by Wiki +move-to-drive , Drive does not pre-check mySpaceand does not take over that move.
  • DingTalk Drive storage space discovery exceptionally reuses managed dws wiki space list --type orgSpace|mySpace; only take the real spaceId/rootFolderId and then return to Drive. spaceId is used for the space parameter, and only rootFolderId can be used as the space root directory folder;orgWikiSpace/myWikiSpace returns workspaceId, which must not be mixed into Drive parameters.
  • Use doc +importto convert Word/Markdown/Text to an online document; Drive upload only keeps the original file.