dingtalk-doc
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese钉钉文档 Skill
DingTalk Document Skill
<!-- DWS_RUNTIME_CONTRACT_START -->
<!-- DWS_RUNTIME_CONTRACT_START -->
最小 DWS 执行契约
Minimal DWS Execution Contract
- 只用 ;结构化读取加
dws,按真实返回判断。--format json - 已知命令直调;参数/约束/安全不明查 leaf 窄 Schema。Schema 不可用才读已知 leaf Help 一次;用同 leaf Help 修正一次。
unknown flag不查 Help:优先错误中的明确 suggestion,其次已加载 Skill/reference 中的明确兼容入口;均无则报漂移并停,禁全 Catalog。低频 reference 不默认 Help,禁 root/parent/product Help。发现后必须执行或说明阻塞。unknown command - 不猜命令/flag/字段/ID/账号/业务事实;ID 来自真实返回。目标零命中/多候选/类型不明先消歧;仅可选时间/展示范围用契约默认,缺必需信息即停。
- 解析/读/写同一 profile,ID 不跨组织。多账号只用唯一 ;否则用户指定,禁止选择第一项、最近登录或最近使用账号。
isOrgCurrent=true - 不输出/记录 token、refresh token、appSecret、webhook token;已注入认证时不索要。
- 写须符合明确意图;确认以最终 Runtime gate/Schema 为准,确认后才加 。
--yes - 写后验证结果,不凭退出码宣称成功。退出须最终答复,区分完成、部分、阻塞、待确认、失败;保留已有数据及 。
complete/hasMore/stopReason/failures - 时间戳按会话时区展示,必要时保留原值。
- 认证/权限/profile/confirmation/未知错误只读 对应 reference,禁连续猜替代命令。
dingtalk-shared
- Use only ; add
dwsfor structured reads, and judge based on actual returns.--format json - Directly call known commands; if parameters/constraints/security are unclear, consult the leaf narrow Schema. Only read the known leaf Help once if Schema is unavailable; fix once with the same leaf Help. For
unknown flag, do not check Help: prioritize explicit suggestions in the error, then explicit compatible entries in loaded Skills/references; if none, report drift and stop, and prohibit full Catalog searches. Low-frequency references do not default to Help; prohibit root/parent/product Help. Once discovered, execute or explain the blockage.unknown command - Do not guess commands/flags/fields/IDs/accounts/business facts; IDs come from actual returns. Disambiguate first for zero hits/multiple candidates/unclear types; use contract defaults only for optional time/display ranges, and stop if required information is missing.
- Parse/read/write the same profile; do not cross organizations with IDs. For multiple accounts, use only the unique ; otherwise user-specified, and prohibit selecting the first item, most recently logged-in, or most recently used account.
isOrgCurrent=true - Do not output/record token, refresh token, appSecret, webhook token; do not request authentication when already injected.
- Writes must conform to explicit intent; confirmation is based on the final Runtime gate/Schema; add only after confirmation.
--yes - Verify results after writes; do not claim success based on exit codes. Exit with a final response distinguishing completed, partial, blocked, pending confirmation, failed; preserve existing data and .
complete/hasMore/stopReason/failures - Display timestamps in the session timezone, preserving original values when necessary.
- For authentication/permissions/profile/confirmation/unknown errors, only read the corresponding reference in ; prohibit guessing alternative commands repeatedly.
dingtalk-shared
Shortcut 发现(按需)
Shortcut Discovery (On Demand)
docresultdata_schemaunknown flagunknown command仅当现有路由和 reference 都无法定位低频能力时,才执行 做最后回退;不要为已知高频意图加载完整 Shortcut Catalog 或产品级 Schema。
<!-- VISIBLE_SHORTCUTS_END -->dws shortcut list --service doc --format jsondocresultdata_schemaunknown flagunknown commandOnly when existing routes and references cannot locate a low-frequency capability, execute as a last resort; do not load the full Shortcut Catalog or product-level Schema for known high-frequency intents.
<!-- VISIBLE_SHORTCUTS_END -->dws shortcut list --service doc --format jsonGolden Route
Golden Route
ID/URL 直用;标题唯一命中后执行。顺序:稳定 ID → shortcut → 局部读 → 精确写;禁以产品 Schema/全文/atomic 起步。
| 用户意图 | 唯一推荐入口 | 关键边界 |
|---|---|---|
| <!-- dws-intent: doc.search.by_title -->按标题或主题定位文档 | | |
| 最近访问或最近编辑文档 | 加载 | 默认最近访问, |
| 已知 alidocs 文档目录 URL,列出当前层 | | 复用完整 URL;不要改用 |
| <!-- dws-intent: doc.content.read -->已知 ID/URL 读取正文或局部内容 | | 术语用 |
| 聚合查看信息、权限、版本、媒体或评论 | | 基础元信息默认返回;样式、权限、历史、媒体、评论才用对应 |
| 新建文档并写入 | | 指定位置复用真实 ID,二者互斥; |
| <!-- dws-intent: doc.content.update -->追加、覆盖或精确编辑 block | | 唯一文本 |
| 重要内容更新且需要恢复点 | | 自动保存版本,更新并回读;检查 |
| 版本操作 | | 快照/列表/回滚 |
| <!-- dws-intent: doc.export.format -->导出为 docx/markdown/pdf | | 格式必须显式指定;普通文件下载切 |
| <!-- dws-intent: doc.import.local_file -->本地文件转在线文档 | | 指定位置复用真实 ID,二者互斥;知识库用 workspaceId;未指定才由 Runtime 取默认根并回读; |
| 封面/背景 | | 写后 |
| 浏览模板 | | “我的/我这边”只查 MY;明确公开才查 PUBLIC;“有哪些/全部”加 |
| 搜索模板 | | 来源可选 MY/PUBLIC;零命中停止,禁止拿无关模板替代;多候选消歧 |
| 从模板创建 | | 已有唯一 templateId 才创建;不重复 list/search |
| 创建/查评论 | | node/content 必填;划词也用 |
| <!-- dws-intent: doc.access.grant -->添加/调整/移除协作者权限 | | |
| <!-- dws-intent: doc.share.link_only -->只发链接不改权限 | | 内置姓名解析;仅歧义时 aisearch,禁预查人;普通私信用 chat |
| 授权后向多人分享链接 | | 仅需改权限时用(必填 |
| <!-- dws-intent: doc.media.insert -->把文件/PPT/PDF 作为正文附件 | | 正文附件走 Doc; |
ID/URL direct use; execute after unique title hit. Order: stable ID → shortcut → local read → precise write; do not start with product Schema/full text/atomic.
| User Intent | Unique Recommended Entry | Key Boundaries |
|---|---|---|
| <!-- dws-intent: doc.search.by_title -->Locate a document by title or topic | | |
| Recently accessed or recently edited documents | Load | Default is recently accessed, |
| Known alidocs folder URL, list current level | | Reuse the full URL; do not switch to |
| <!-- dws-intent: doc.content.read -->Read body or partial content with known ID/URL | | Use |
| Aggregated view of info, permissions, versions, media, or comments | | Basic metadata is returned by default; use corresponding |
| Create a document and write content | `dws doc +create --name <title> --content <text\ | -\ |
| <!-- dws-intent: doc.content.update -->Append, overwrite, or precisely edit blocks | | Unique text |
| Important content update requiring a recovery point | | Auto-save version, update and read back; check |
| Version operations | | Snapshot/List/Rollback. |
| <!-- dws-intent: doc.export.format -->Export to docx/markdown/pdf | | Format must be explicitly specified; switch to |
| <!-- dws-intent: doc.import.local_file -->Convert local file to online document | `dws doc +import --file <relative path> [--folder <ID>\ | --workspace <ID>] [--name <document name>]` |
| Cover/background | | After writing, |
| Browse templates | `dws doc +template-list [--source MY\ | PUBLIC] [--page-all]` |
| Search templates | | Source optional MY/PUBLIC; stop on zero hits, do not substitute unrelated templates; disambiguate multiple candidates. |
| Create from template | | Create only when a unique templateId exists; do not repeat list/search. |
| Create/view comments | | node/content required; use |
| <!-- dws-intent: doc.access.grant -->Add/adjust/remove collaborator permissions | | |
| <!-- dws-intent: doc.share.link_only -->Share link only without changing permissions | | Built-in name resolution; use aisearch only for ambiguity, do not pre-query people; use chat for ordinary private messages. |
| Share link with multiple people after granting permissions | | Use when only permission changes are needed ( |
| <!-- dws-intent: doc.media.insert -->Insert file/PPT/PDF as body attachment | | Body attachments go through Doc; |
关键结果语义
Key Result Semantics
- 保留真实 /URL/类型/容器;复用 ID,禁标题/钉盘重搜。
nodeId - :内容用
extension=dlink;嵌套逐跳,失败/缺失/循环即停;入口移动/改名/删除用顶层 ID。linkSourceInfo.nodeId - 复用 Runtime 回执;仅局部验收、/commit-unknown 再
partial_success。+fetch - 恢复:只补未完成;
partial_success先回读、禁重写;unknown仅限明确未开始;权限/参数/认证失败即停。retryable - 回读匹配才报完成。
- 搜索/列表检查 /
complete/cursor/失败项;“全部”翻完页,前 N 条须声明范围。hasMore - 检查
+import及success/verified=true;复用返回 ID,禁 Drive 重找;中断查原任务,禁重导。taskId/nodeId/documentUrl - 知识库导入再移到我的文档:→
doc +import --workspace <Wiki ID>,复用 nodeId;禁先建在个人域。wiki +move-to-drive - 导出/下载用 cwd 相对路径;有
+export且localPath即终态,禁sizeBytes>0。ls/stat
- Preserve the real /URL/type/container; reuse IDs, do not re-search by title or DingTalk Drive.
nodeId - : use
extension=dlinkfor content; nested traversal, stop on failure/missing/loop; use top-level ID for entry moves/renames/deletes.linkSourceInfo.nodeId - Reuse Runtime receipts; only perform again for partial acceptance,
+fetch/commit-unknown.partial_success - Recovery: only completes unfinished items;
partial_successreads back first, prohibits rewriting;unknownonly for explicitly not started; stop on permission/parameter/authentication failures.retryable - Report completion only when read-back matches.
- For search/list, check /
complete/cursor/failures; for "all", page through, and declare scope for the first N items.hasMore - For , check
+importandsuccess/verified=true; reuse returned IDs, do not re-find via Drive; if interrupted, check the original task, do not re-import.taskId/nodeId/documentUrl - For knowledge base import then move to My Documents: →
doc +import --workspace <Wiki ID>, reusing nodeId; do not create in personal domain first.wiki +move-to-drive - Use cwd relative paths for export/download; with
+exportandlocalPathis final, do not usesizeBytes>0.ls/stat
参数与安全边界
Parameter and Security Boundaries
- :已有或临时文件先暂存到 cwd;传
@file,生成文本优先@相对路径;禁绝对路径和--content -。.. - 用
doc +update指定动作;block ID 必须来自--command或真实列表。+fetch --detail with-ids - Schema 门禁:不确定时仅查一次精确 leaf:;禁用产品级/
--fields use_when,avoid_when,parameters,constraints,confirmation。准备 Help 时,本轮仅查一次。--all - 消费本页或精确 Schema 的 :
confirmation且原请求/预授权已确认目标、动作、参数时,首调即加user_required;否则预览/询问;禁止靠失败探测门禁。--yes - JSONML 顶层必须是单个非空元素;禁止 元素数组包裹。
[[...]]
- : stage existing or temporary files to cwd first; pass
@file, prefer@relative pathfor generated text; prohibit absolute paths and--content -... - uses
doc +updateto specify the action; block IDs must come from--commandor actual lists.+fetch --detail with-ids - Schema gate: only query the precise leaf once when uncertain: ; disable product-level/
--fields use_when,avoid_when,parameters,constraints,confirmation. When preparing Help, query only once in this turn.--all - Consume from this page or precise Schema: if
confirmationand the original request/pre-authorization has confirmed the target, action, and parameters, adduser_requiredon the first call; otherwise preview/ask; do not probe the gate via failures.--yes - JSONML top-level must be a single non-empty element; prohibit wrapping with element arrays.
[[...]]
按需加载
On-Demand Loading
Golden Route 已给出命令且参数足够时,禁止读取 reference;其余仅遇下表语义时才最多读取一个 reference:
| 触发条件 | Reference |
|---|---|
| 低频/无 shortcut 意图消歧 | intent-guide.md / doc.md 对应章节 |
分页、 | contracts.md |
| 复杂 JSONML、长文或局部精准读写 | create / read / update |
| block/划词评论/媒体/封面/背景高级参数 | block / comment / media |
| 导出/导入失败恢复 | export / import |
常规 、、 append/overwrite、、 禁止读取 reference;禁预加载/连读。
+create+fetch+update+export+importWhen the Golden Route has provided commands and parameters, reading references is prohibited; otherwise, read at most one reference only when encountering the following semantics:
| Trigger Condition | Reference |
|---|---|
| Low-frequency/no shortcut intent disambiguation | intent-guide.md / doc.md corresponding sections |
Pagination, | contracts.md |
| Complex JSONML, long texts, or precise local read/write | create / read / update |
| Advanced parameters for block/selection comments/media/cover/background | block / comment / media |
| Export/import failure recovery | export / import |
For routine , , append/overwrite, , , reading references is prohibited; do not preload/chain-read.
+create+fetch+update+export+import错误最短路径
Shortest Error Path
- 零命中、多候选、类型不明或分页不完整:停止写入,展示候选或 continuation;禁止默认第一项。
- 若确认目标是目录,浏览请求复用完整 URL 执行
+fetch,不要改用+list --folder。Help 不参与选路;先读一次精确 leaf Schema。仅真实drive +list/契约漂移查一次 leaf Help;unknown flag只查一次 shortcut 清单,禁止试探后缀和unknown command。dws doc --help | grep/head - :重新读取当前 revision,展示差异;未经用户确认不得改成无 revision 覆盖。
REVISION_CONFLICT - :先回读;禁止自动重试创建或追加。
doc_write_commit_unknown - 认证、权限或 profile 错误:只读 对应 reference,禁底层命令绕过。
dingtalk-shared - 导出/媒体失败:保留稳定 ID 后停止;禁网络请求/安装依赖/本地文档库兜底。
- Zero hits, multiple candidates, unclear types, or incomplete pagination: stop writing, show candidates or continuation; prohibit defaulting to the first item.
- If confirms the target is a folder, for browse requests reuse the full URL and run
+fetch, do not switch to+list --folder. Help does not participate in routing; read the precise leaf Schema once first. Only for realdrive +list/contract drift, check leaf Help once; forunknown flag, check the shortcut list only once, and do not probe suffixes orunknown command.dws doc --help | grep/head - : re-read the current revision, show differences; do not change to overwriting without revision without user confirmation.
REVISION_CONFLICT - : read back first; do not automatically retry creation or append.
doc_write_commit_unknown - Authentication, permission, or profile errors: only read the corresponding reference, do not bypass with low-level commands.
dingtalk-shared - Export/media failure: preserve stable ID and stop; do not use network requests/install dependencies/local document library as fallback.
产品边界
Product Boundaries
- 姓名/工号/部门/职责找人或解析 userId → ;已有完整 userId 补详情才用
dingtalk-aisearchdingtalk-contact - 普通文件/目录存储与上传下载 → ;保留原文件进入明确知识库可用
dingtalk-drive;“放进/附到这篇文档”是正文附件 →drive +upload --workspace;在线转换 →doc +media-insertdoc +import - 文档节点复制、移动、模板另存 → ;doc 同名命令仅兼容
dingtalk-drive +copy/+move - 知识库空间、节点层级和成员管理 → ;本地文件进入明确知识库时由 Doc
dingtalk-wiki创建内容节点,后续移出使用 Wiki+import --workspace+move-to-drive - 原生 文件读取和编辑 →
.mddingtalk-misc - /
axls→ 对应电子表格或多维表 Skillable - 持续监听文档事件 →
dingtalk-misc
- For finding people or resolving userId by name/employee ID/department/role → ; use
dingtalk-aisearchonly when a full userId exists and details are needed.dingtalk-contact - For ordinary file/directory storage and upload/download → ; when keeping original files into a specific knowledge base, use
dingtalk-drive; "put into/attach to this document" means body attachment →drive +upload --workspace; online conversion →doc +media-insert.doc +import - For copying, moving document nodes, saving templates → ; doc's same-name commands are only for compatibility.
dingtalk-drive +copy/+move - For knowledge base spaces, node hierarchy, and member management → ; when local files enter a specific knowledge base, Doc
dingtalk-wikicreates the content node, and use Wiki+import --workspacefor later removal.+move-to-drive - For native file reading and editing →
.md.dingtalk-misc - /
axls→ corresponding spreadsheet or multidimensional table Skills.able - For continuous monitoring of document events → .
dingtalk-misc