diff --git a/internal/cli/schema_agent_metadata/doc.json b/internal/cli/schema_agent_metadata/doc.json index d261f40e..9ffdacec 100644 --- a/internal/cli/schema_agent_metadata/doc.json +++ b/internal/cli/schema_agent_metadata/doc.json @@ -6964,8 +6964,7 @@ "agent_summary_source": "dws-agent-selection/doc", "availability": "available", "avoid_when": [ - "删除评论用 delete;回复用 reply", - "响应为 null/空对象或回查仍是旧正文时不能判成功,必须报告更新未生效或部分完成" + "删除评论用 delete;回复用 reply" ], "confirmation": "not_required", "effect": "write", @@ -6980,14 +6979,14 @@ "source": "internal/cli/schema_hints/selection/doc.json", "precedence": "reviewed_explicit", "resolution": "highest_precedence", - "review_reason": "人工对齐评论更新的业务结果与 comment list 回查语义;null/空响应不能单独证明成功,不改变命令身份、参数契约或接口绑定。", + "review_reason": "人工审阅:结合本机 dws schema 实时 MCP description/parameters(经 interface_ref)、产品 Skill、Cobra Long 与 Runtime 确认门禁,按飞书风格重写选型文案;不改变命令身份、参数契约或接口绑定。", "candidates": [ { "value": "更新指定文档评论的文字内容和可选 @用户/@群。", "source": "internal/cli/schema_hints/selection/doc.json", "precedence": "reviewed_explicit", "selected": true, - "review_reason": "人工对齐评论更新的业务结果与 comment list 回查语义;null/空响应不能单独证明成功,不改变命令身份、参数契约或接口绑定。" + "review_reason": "人工审阅:结合本机 dws schema 实时 MCP description/parameters(经 interface_ref)、产品 Skill、Cobra Long 与 Runtime 确认门禁,按飞书风格重写选型文案;不改变命令身份、参数契约或接口绑定。" } ] }, @@ -7009,23 +7008,21 @@ }, "avoid_when": { "value": [ - "删除评论用 delete;回复用 reply", - "响应为 null/空对象或回查仍是旧正文时不能判成功,必须报告更新未生效或部分完成" + "删除评论用 delete;回复用 reply" ], "source": "internal/cli/schema_hints/selection/doc.json", "precedence": "reviewed_explicit", "resolution": "highest_precedence", - "review_reason": "人工对齐评论更新的业务结果与 comment list 回查语义;null/空响应不能单独证明成功,不改变命令身份、参数契约或接口绑定。", + "review_reason": "人工审阅:结合本机 dws schema 实时 MCP description/parameters(经 interface_ref)、产品 Skill、Cobra Long 与 Runtime 确认门禁,按飞书风格重写选型文案;不改变命令身份、参数契约或接口绑定。", "candidates": [ { "value": [ - "删除评论用 delete;回复用 reply", - "响应为 null/空对象或回查仍是旧正文时不能判成功,必须报告更新未生效或部分完成" + "删除评论用 delete;回复用 reply" ], "source": "internal/cli/schema_hints/selection/doc.json", "precedence": "reviewed_explicit", "selected": true, - "review_reason": "人工对齐评论更新的业务结果与 comment list 回查语义;null/空响应不能单独证明成功,不改变命令身份、参数契约或接口绑定。" + "review_reason": "人工审阅:结合本机 dws schema 实时 MCP description/parameters(经 interface_ref)、产品 Skill、Cobra Long 与 Runtime 确认门禁,按飞书风格重写选型文案;不改变命令身份、参数契约或接口绑定。" } ] }, @@ -7081,7 +7078,7 @@ "source": "internal/cli/schema_hints/selection/doc.json", "precedence": "reviewed_explicit", "resolution": "highest_precedence", - "review_reason": "人工对齐评论更新的业务结果与 comment list 回查语义;null/空响应不能单独证明成功,不改变命令身份、参数契约或接口绑定。", + "review_reason": "人工审阅:结合本机 dws schema 实时 MCP description/parameters(经 interface_ref)、产品 Skill、Cobra Long 与 Runtime 确认门禁,按飞书风格重写选型文案;不改变命令身份、参数契约或接口绑定。", "candidates": [ { "value": [ @@ -7091,7 +7088,7 @@ "source": "internal/cli/schema_hints/selection/doc.json", "precedence": "reviewed_explicit", "selected": true, - "review_reason": "人工对齐评论更新的业务结果与 comment list 回查语义;null/空响应不能单独证明成功,不改变命令身份、参数契约或接口绑定。" + "review_reason": "人工审阅:结合本机 dws schema 实时 MCP description/parameters(经 interface_ref)、产品 Skill、Cobra Long 与 Runtime 确认门禁,按飞书风格重写选型文案;不改变命令身份、参数契约或接口绑定。" } ] }, @@ -7184,7 +7181,7 @@ "source": "internal/cli/schema_hints/selection/doc.json", "precedence": "reviewed_explicit", "selected": false, - "review_reason": "人工对齐评论更新的业务结果与 comment list 回查语义;null/空响应不能单独证明成功,不改变命令身份、参数契约或接口绑定。" + "review_reason": "人工审阅:结合本机 dws schema 实时 MCP description/parameters(经 interface_ref)、产品 Skill、Cobra Long 与 Runtime 确认门禁,按飞书风格重写选型文案;不改变命令身份、参数契约或接口绑定。" } ] }, @@ -7212,21 +7209,21 @@ }, "use_when": { "value": [ - "修改已有评论正文;可选更新 --mention 或 --mentioned-open-conversation-id;执行后必须用 comment list 回查同一 commentKey 的目标字段" + "修改已有评论正文;可选更新 --mention 或 --mentioned-open-conversation-id" ], "source": "internal/cli/schema_hints/selection/doc.json", "precedence": "reviewed_explicit", "resolution": "highest_precedence", - "review_reason": "人工对齐评论更新的业务结果与 comment list 回查语义;null/空响应不能单独证明成功,不改变命令身份、参数契约或接口绑定。", + "review_reason": "人工审阅:结合本机 dws schema 实时 MCP description/parameters(经 interface_ref)、产品 Skill、Cobra Long 与 Runtime 确认门禁,按飞书风格重写选型文案;不改变命令身份、参数契约或接口绑定。", "candidates": [ { "value": [ - "修改已有评论正文;可选更新 --mention 或 --mentioned-open-conversation-id;执行后必须用 comment list 回查同一 commentKey 的目标字段" + "修改已有评论正文;可选更新 --mention 或 --mentioned-open-conversation-id" ], "source": "internal/cli/schema_hints/selection/doc.json", "precedence": "reviewed_explicit", "selected": true, - "review_reason": "人工对齐评论更新的业务结果与 comment list 回查语义;null/空响应不能单独证明成功,不改变命令身份、参数契约或接口绑定。" + "review_reason": "人工审阅:结合本机 dws schema 实时 MCP description/parameters(经 interface_ref)、产品 Skill、Cobra Long 与 Runtime 确认门禁,按飞书风格重写选型文案;不改变命令身份、参数契约或接口绑定。" } ] } @@ -7247,7 +7244,7 @@ "structured-hint:internal/cli/schema_hints/products/doc.json" ], "use_when": [ - "修改已有评论正文;可选更新 --mention 或 --mentioned-open-conversation-id;执行后必须用 comment list 回查同一 commentKey 的目标字段" + "修改已有评论正文;可选更新 --mention 或 --mentioned-open-conversation-id" ] }, "doc copy": { diff --git a/internal/cli/schema_agent_metadata/index.json b/internal/cli/schema_agent_metadata/index.json index ad71d917..160baa3f 100644 --- a/internal/cli/schema_agent_metadata/index.json +++ b/internal/cli/schema_agent_metadata/index.json @@ -1,6 +1,6 @@ { "version": 1, - "source_hash": "sha256:3e4c1e7738dc039b264f7f807ba089df367caa8a11e14e2852d5bc7a1c178c62", + "source_hash": "sha256:35727a6c324fbffde5271e96d972843abdf780391151ba858f6d04384268cd51", "surface_hash": "sha256:4897d582a472d9d3596f88fb4546e7795d6b9bc334d020712f5d895ce894f7a7", "coverage": { "surface_products": 26, diff --git a/internal/cli/schema_agent_metadata_audit.json b/internal/cli/schema_agent_metadata_audit.json index e4a1c33b..eb800d6b 100644 --- a/internal/cli/schema_agent_metadata_audit.json +++ b/internal/cli/schema_agent_metadata_audit.json @@ -1,6 +1,6 @@ { "version": 1, - "source_hash": "sha256:3e4c1e7738dc039b264f7f807ba089df367caa8a11e14e2852d5bc7a1c178c62", + "source_hash": "sha256:35727a6c324fbffde5271e96d972843abdf780391151ba858f6d04384268cd51", "surface_hash": "sha256:4897d582a472d9d3596f88fb4546e7795d6b9bc334d020712f5d895ce894f7a7", "source_files": 160, "hint_files": 54, diff --git a/internal/cli/schema_catalog/catalog.json b/internal/cli/schema_catalog/catalog.json index e8348f7e..c1ae536f 100644 --- a/internal/cli/schema_catalog/catalog.json +++ b/internal/cli/schema_catalog/catalog.json @@ -1,12 +1,12 @@ { "version": 1, "surface_hash": "sha256:4897d582a472d9d3596f88fb4546e7795d6b9bc334d020712f5d895ce894f7a7", - "source_hash": "sha256:63baeebf24225e9e3adef0ee609a41df0c64c479440c14360ce715ae3f701f66", + "source_hash": "sha256:807d11cf6c62a0d4aaca4b5a6b438e6654b2792d3a32b4e271032202d45ff8fa", "catalog": { "agent_metadata": { "products_with_metadata": 26, "source": "embedded-skill-metadata", - "source_hash": "sha256:3e4c1e7738dc039b264f7f807ba089df367caa8a11e14e2852d5bc7a1c178c62", + "source_hash": "sha256:35727a6c324fbffde5271e96d972843abdf780391151ba858f6d04384268cd51", "surface_hash": "sha256:4897d582a472d9d3596f88fb4546e7795d6b9bc334d020712f5d895ce894f7a7", "surface_products": 26, "surface_tools": 875, @@ -16804,8 +16804,7 @@ "agent_summary_source": "dws-agent-selection/doc", "availability": "available", "avoid_when": [ - "删除评论用 delete;回复用 reply", - "响应为 null/空对象或回查仍是旧正文时不能判成功,必须报告更新未生效或部分完成" + "删除评论用 delete;回复用 reply" ], "canonical_path": "doc.update_comment", "cli_name": "update", @@ -16823,7 +16822,7 @@ "risk": "medium", "title": "更新文档评论", "use_when": [ - "修改已有评论正文;可选更新 --mention 或 --mentioned-open-conversation-id;执行后必须用 comment list 回查同一 commentKey 的目标字段" + "修改已有评论正文;可选更新 --mention 或 --mentioned-open-conversation-id" ] }, { diff --git a/internal/cli/schema_catalog/tools/doc.json b/internal/cli/schema_catalog/tools/doc.json index 7e6e5a60..931ca443 100644 --- a/internal/cli/schema_catalog/tools/doc.json +++ b/internal/cli/schema_catalog/tools/doc.json @@ -37251,8 +37251,7 @@ "agent_summary_source": "dws-agent-selection/doc", "availability": "available", "avoid_when": [ - "删除评论用 delete;回复用 reply", - "响应为 null/空对象或回查仍是旧正文时不能判成功,必须报告更新未生效或部分完成" + "删除评论用 delete;回复用 reply" ], "canonical_path": "doc.update_comment", "cli_name": "update", @@ -37271,7 +37270,7 @@ "candidates": [ { "precedence": "reviewed_explicit", - "review_reason": "人工对齐评论更新的业务结果与 comment list 回查语义;null/空响应不能单独证明成功,不改变命令身份、参数契约或接口绑定。", + "review_reason": "人工审阅:结合本机 dws schema 实时 MCP description/parameters(经 interface_ref)、产品 Skill、Cobra Long 与 Runtime 确认门禁,按飞书风格重写选型文案;不改变命令身份、参数契约或接口绑定。", "selected": true, "source": "internal/cli/schema_hints/selection/doc.json", "value": "更新指定文档评论的文字内容和可选 @用户/@群。" @@ -37279,7 +37278,7 @@ ], "precedence": "reviewed_explicit", "resolution": "highest_precedence", - "review_reason": "人工对齐评论更新的业务结果与 comment list 回查语义;null/空响应不能单独证明成功,不改变命令身份、参数契约或接口绑定。", + "review_reason": "人工审阅:结合本机 dws schema 实时 MCP description/parameters(经 interface_ref)、产品 Skill、Cobra Long 与 Runtime 确认门禁,按飞书风格重写选型文案;不改变命令身份、参数契约或接口绑定。", "source": "internal/cli/schema_hints/selection/doc.json", "value": "更新指定文档评论的文字内容和可选 @用户/@群。" }, @@ -37303,22 +37302,20 @@ "candidates": [ { "precedence": "reviewed_explicit", - "review_reason": "人工对齐评论更新的业务结果与 comment list 回查语义;null/空响应不能单独证明成功,不改变命令身份、参数契约或接口绑定。", + "review_reason": "人工审阅:结合本机 dws schema 实时 MCP description/parameters(经 interface_ref)、产品 Skill、Cobra Long 与 Runtime 确认门禁,按飞书风格重写选型文案;不改变命令身份、参数契约或接口绑定。", "selected": true, "source": "internal/cli/schema_hints/selection/doc.json", "value": [ - "删除评论用 delete;回复用 reply", - "响应为 null/空对象或回查仍是旧正文时不能判成功,必须报告更新未生效或部分完成" + "删除评论用 delete;回复用 reply" ] } ], "precedence": "reviewed_explicit", "resolution": "highest_precedence", - "review_reason": "人工对齐评论更新的业务结果与 comment list 回查语义;null/空响应不能单独证明成功,不改变命令身份、参数契约或接口绑定。", + "review_reason": "人工审阅:结合本机 dws schema 实时 MCP description/parameters(经 interface_ref)、产品 Skill、Cobra Long 与 Runtime 确认门禁,按飞书风格重写选型文案;不改变命令身份、参数契约或接口绑定。", "source": "internal/cli/schema_hints/selection/doc.json", "value": [ - "删除评论用 delete;回复用 reply", - "响应为 null/空对象或回查仍是旧正文时不能判成功,必须报告更新未生效或部分完成" + "删除评论用 delete;回复用 reply" ] }, "canonical_path": { @@ -37407,7 +37404,7 @@ "candidates": [ { "precedence": "reviewed_explicit", - "review_reason": "人工对齐评论更新的业务结果与 comment list 回查语义;null/空响应不能单独证明成功,不改变命令身份、参数契约或接口绑定。", + "review_reason": "人工审阅:结合本机 dws schema 实时 MCP description/parameters(经 interface_ref)、产品 Skill、Cobra Long 与 Runtime 确认门禁,按飞书风格重写选型文案;不改变命令身份、参数契约或接口绑定。", "selected": true, "source": "internal/cli/schema_hints/selection/doc.json", "value": [ @@ -37418,7 +37415,7 @@ ], "precedence": "reviewed_explicit", "resolution": "highest_precedence", - "review_reason": "人工对齐评论更新的业务结果与 comment list 回查语义;null/空响应不能单独证明成功,不改变命令身份、参数契约或接口绑定。", + "review_reason": "人工审阅:结合本机 dws schema 实时 MCP description/parameters(经 interface_ref)、产品 Skill、Cobra Long 与 Runtime 确认门禁,按飞书风格重写选型文案;不改变命令身份、参数契约或接口绑定。", "source": "internal/cli/schema_hints/selection/doc.json", "value": [ "dws doc comment update --node \u003cDOC_ID\u003e --comment-key \u003cCOMMENT_KEY\u003e --content \"已按最新数据修正\" --format json", @@ -37506,7 +37503,7 @@ }, { "precedence": "reviewed_explicit", - "review_reason": "人工对齐评论更新的业务结果与 comment list 回查语义;null/空响应不能单独证明成功,不改变命令身份、参数契约或接口绑定。", + "review_reason": "人工审阅:结合本机 dws schema 实时 MCP description/parameters(经 interface_ref)、产品 Skill、Cobra Long 与 Runtime 确认门禁,按飞书风格重写选型文案;不改变命令身份、参数契约或接口绑定。", "selected": false, "source": "internal/cli/schema_hints/selection/doc.json", "value": true @@ -37558,20 +37555,20 @@ "candidates": [ { "precedence": "reviewed_explicit", - "review_reason": "人工对齐评论更新的业务结果与 comment list 回查语义;null/空响应不能单独证明成功,不改变命令身份、参数契约或接口绑定。", + "review_reason": "人工审阅:结合本机 dws schema 实时 MCP description/parameters(经 interface_ref)、产品 Skill、Cobra Long 与 Runtime 确认门禁,按飞书风格重写选型文案;不改变命令身份、参数契约或接口绑定。", "selected": true, "source": "internal/cli/schema_hints/selection/doc.json", "value": [ - "修改已有评论正文;可选更新 --mention 或 --mentioned-open-conversation-id;执行后必须用 comment list 回查同一 commentKey 的目标字段" + "修改已有评论正文;可选更新 --mention 或 --mentioned-open-conversation-id" ] } ], "precedence": "reviewed_explicit", "resolution": "highest_precedence", - "review_reason": "人工对齐评论更新的业务结果与 comment list 回查语义;null/空响应不能单独证明成功,不改变命令身份、参数契约或接口绑定。", + "review_reason": "人工审阅:结合本机 dws schema 实时 MCP description/parameters(经 interface_ref)、产品 Skill、Cobra Long 与 Runtime 确认门禁,按飞书风格重写选型文案;不改变命令身份、参数契约或接口绑定。", "source": "internal/cli/schema_hints/selection/doc.json", "value": [ - "修改已有评论正文;可选更新 --mention 或 --mentioned-open-conversation-id;执行后必须用 comment list 回查同一 commentKey 的目标字段" + "修改已有评论正文;可选更新 --mention 或 --mentioned-open-conversation-id" ] } }, @@ -38096,7 +38093,7 @@ "source": "reviewed_command_registry", "title": "更新文档评论", "use_when": [ - "修改已有评论正文;可选更新 --mention 或 --mentioned-open-conversation-id;执行后必须用 comment list 回查同一 commentKey 的目标字段" + "修改已有评论正文;可选更新 --mention 或 --mentioned-open-conversation-id" ] }, "doc.update_document": { diff --git a/internal/cli/schema_hints/selection/doc.json b/internal/cli/schema_hints/selection/doc.json index 163ffb26..b695f3b4 100644 --- a/internal/cli/schema_hints/selection/doc.json +++ b/internal/cli/schema_hints/selection/doc.json @@ -725,18 +725,17 @@ "doc.update_comment": { "agent_summary": "更新指定文档评论的文字内容和可选 @用户/@群。", "use_when": [ - "修改已有评论正文;可选更新 --mention 或 --mentioned-open-conversation-id;执行后必须用 comment list 回查同一 commentKey 的目标字段" + "修改已有评论正文;可选更新 --mention 或 --mentioned-open-conversation-id" ], "avoid_when": [ - "删除评论用 delete;回复用 reply", - "响应为 null/空对象或回查仍是旧正文时不能判成功,必须报告更新未生效或部分完成" + "删除评论用 delete;回复用 reply" ], "examples": [ "dws doc comment update --node --comment-key --content \"已按最新数据修正\" --format json", "dws doc comment update --node --comment-key --content \"请群内确认\" --mentioned-open-conversation-id " ], "reviewed": true, - "review_reason": "人工对齐评论更新的业务结果与 comment list 回查语义;null/空响应不能单独证明成功,不改变命令身份、参数契约或接口绑定。", + "review_reason": "人工审阅:结合本机 dws schema 实时 MCP description/parameters(经 interface_ref)、产品 Skill、Cobra Long 与 Runtime 确认门禁,按飞书风格重写选型文案;不改变命令身份、参数契约或接口绑定。", "source_refs": [ "internal/cli/schema_command_registry.json#doc.update_comment", "cobra-help:dws doc comment update --help", diff --git a/skills/mono/references/best_practices/04-document.md b/skills/mono/references/best_practices/04-document.md index df86a479..27b9e6e2 100644 --- a/skills/mono/references/best_practices/04-document.md +++ b/skills/mono/references/best_practices/04-document.md @@ -2,12 +2,11 @@ > 通用规范见 [_common/conventions.md](_common/conventions.md)。 -## 显式工作流与事实保真 +## 显式工作流 - 用户点名的 `create → list → insert/append/update` 是可观察命令链,必须保持顺序逐项执行;create 只承载明确的初始正文。有序列表块必须验证回读结构中的 `list.isOrdered=true`。 - `--name` 不替代用户显式要求的正文 H1;新建资源返回 ID 后,同一请求的指代绑定该新资源,禁止搜索同名旧资源替换。 - Word/Excel 需要“在线编辑/直接在线改”时使用 `doc import`,普通 `drive upload` 只保留原文件。 -- 汇总时保留证据强度:验证数量不等于通过数量,整理问题不等于根因分析。任一步骤返回 `null`/空结果或回查不一致时只能报告部分完成。 | Recipe | 行动指南(固定路线) | |--------|-------------------| diff --git a/skills/mono/references/products/doc.md b/skills/mono/references/products/doc.md index 5352b5f1..41d051aa 100644 --- a/skills/mono/references/products/doc.md +++ b/skills/mono/references/products/doc.md @@ -1060,8 +1060,6 @@ EOF - `drive upload` / `doc upload` 是普通文件存储路径;用户要求 Word/Excel “在线编辑/直接在线改”时硬路由到 `doc import`,并验证导入后的在线类型和文件夹。只有用户明确同时要原文件与在线版时才分别 upload + import - 同一请求中新建、复制或导入返回的 `nodeId` 必须绑定后续“这篇/刚才那篇/上次那篇”;禁止搜索同名旧资源覆盖绑定 - `--name` 只是文档外壳标题,不能替代用户显式要求的正文 H1;用户说“正文先起一级标题”时必须写入或插入真实 H1 -- 汇总只能保持用户事实强度:“验证 12 条”不等于“12 条全部通过”,“整理问题清单”不等于“输出根因分析” -- 写操作响应为 `null`/空对象或回查未变化时,该步骤失败;必须报告部分完成,禁止用其他成功步骤把整体说成“全部完成” - `upload` 是三步自动完成的流程 (获取凭证 → OSS 上传 → 提交入库),无需手动分步操作 - `download` 是两步自动完成的流程 (获取下载链接 → HTTP GET 下载),支持自动推断文件名;`--output` 可指定文件路径或目录 - `media insert` 是三步自动完成的流程 (获取附件上传凭证 → OSS 上传 → 插入附件块到文档),无需手动分步操作 diff --git a/skills/mono/references/products/doc/doc-comment.md b/skills/mono/references/products/doc/doc-comment.md index 9f7c5f5c..77edc1c6 100644 --- a/skills/mono/references/products/doc/doc-comment.md +++ b/skills/mono/references/products/doc/doc-comment.md @@ -131,7 +131,6 @@ Flags: - 划词评论的 `--start` / `--end` 是块内文本字符偏移量,从 0 开始;通过 [`./doc-block.md`](./doc-block.md) `block list` 取 `paragraph.text` 后人工或脚本计算。 - `reply` 加 `--emoji` 时 `--content` 填表情名称(如 `比心`、`赞`),不是文字内容。 - `reply --emoji` 不能同时 @群。 -- `comment create/reply/update/delete` 的退出码 0 不等于业务成功。响应为 `null`、空对象或缺少可核验字段时,立即执行 `comment list` 回查目标 `commentKey`。若 update 后正文仍是旧值,必须判定“更新未生效”;即使其他步骤成功或评论随后被删除,也只能报告部分完成,禁止写“全部完成”。 ## 上下文传递 diff --git a/skills/mono/scripts/doc_create_and_write.py b/skills/mono/scripts/doc_create_and_write.py index 4f2d9f29..a306b0e5 100644 --- a/skills/mono/scripts/doc_create_and_write.py +++ b/skills/mono/scripts/doc_create_and_write.py @@ -60,8 +60,6 @@ def run_dws(args: Sequence[str], dry_run: bool = False) -> Any: f"dws 命令失败:{detail or f'退出码 {result.returncode}'}" ) data = decode_json_output(result.stdout) - if data is None or data == {}: - raise ScriptError("dws 返回空业务结果,无法确认操作成功") if isinstance(data, dict) and data.get("success") is False: detail = data.get("errorMsg") or data.get("message") or "未知错误" raise ScriptError(f"dws 业务调用失败:{detail}") @@ -147,14 +145,12 @@ def run(argv: Optional[Sequence[str]] = None) -> int: ["doc", "info", "--node", node_id, "--format", "json"], dry_run=args.dry_run, ) - readback = run_dws( + run_dws( ["doc", "read", "--node", node_id, "--format", "json"], dry_run=args.dry_run, ) if args.dry_run: return 0 - if not first_value(readback, ("markdown", "jsonml", "content")): - raise ScriptError("文档回读未返回正文,无法确认写入成功") summary = { "success": True, diff --git a/skills/multi/dingtalk-doc/SKILL.md b/skills/multi/dingtalk-doc/SKILL.md index 356bcde0..6130d4d1 100644 --- a/skills/multi/dingtalk-doc/SKILL.md +++ b/skills/multi/dingtalk-doc/SKILL.md @@ -72,8 +72,6 @@ metadata: - 已有 callout、分栏、样式、@人、图片或附件时,先读 JSONML;局部改动优先 `block update`,不要用 Markdown 整篇重写。 - `block insert` 默认追加;只有明确相对位置时才传真实 `--ref-block` / `--parent-block`。`block delete` 和评论删除必须确认。 - 写后按对象验证:正文用 `doc read`,块/附件用 `doc block list`,元信息/链接用 `doc info`,版本用 `version list`。 -- 工具退出码 0、`success=true`、空对象或 `null` 都不能单独证明成功。每个写步骤必须同时有非空业务结果和针对目标字段的回查;例如 comment update 返回 `null` 且 list 仍是旧内容时,该步骤失败,最终必须报告“部分完成/更新未生效”,不得以“全部完成”开头。 -- 汇总和改写只能重组用户给出的事实,不得增强确定性或新增任务:“验证 12 条用例”不能写成“12 条全部通过”,“整理问题清单”不能扩写成“输出根因分析”。数字、状态、结论和承诺逐项保持原义。 ## 低频 atomic 路由 diff --git a/skills/multi/dingtalk-doc/references/04-document.md b/skills/multi/dingtalk-doc/references/04-document.md index f43bb056..67ec38f3 100644 --- a/skills/multi/dingtalk-doc/references/04-document.md +++ b/skills/multi/dingtalk-doc/references/04-document.md @@ -58,9 +58,7 @@ dws doc read --node # 校验关键标题、段落首句、表格、@ **禁止**在未回读的情况下向用户报告「已完成」。 -## 显式工作流与事实保真 +## 显式工作流 - 用户点名的 `create → list → insert/append/update` 是可观察命令链,必须保持顺序逐项执行;create 只承载明确的初始正文。有序列表块必须验证回读结构中的 `list.isOrdered=true`。 - 新建资源返回 ID 后,同一请求的指代默认绑定该新资源;禁止搜索同名旧资源替换绑定。 -- 汇总用户材料时保留证据强度:验证数量不等于通过数量,计划整理问题不等于承诺根因分析。不得为“更专业”而补造结论、状态或任务。 -- 任一步骤返回 `null`/空结果或回查不一致时,该步骤未完成;最终按步骤报告成功与失败,不能用其他成功步骤把整体描述成“全部完成”。 diff --git a/skills/multi/dingtalk-doc/references/doc/doc-comment.md b/skills/multi/dingtalk-doc/references/doc/doc-comment.md index d90b7d08..6bdc7eab 100644 --- a/skills/multi/dingtalk-doc/references/doc/doc-comment.md +++ b/skills/multi/dingtalk-doc/references/doc/doc-comment.md @@ -135,7 +135,6 @@ Flags: - `reply` 加 `--emoji` 时 `--content` 填表情名称(如 `比心`、`赞`),不是文字内容。 - `reply --emoji` 与群 mention 冲突;CLI 会在调用服务端前报错,不会静默忽略。 - `delete` 是不可逆操作;AI Agent 必须先让用户确认,再追加 `--yes`,避免 CLI 进入交互等待。 -- `comment create/reply/update/delete` 的退出码 0 不等于业务成功。响应为 `null`、空对象或缺少可核验字段时,立即执行 `comment list` 回查目标 `commentKey`。若 update 后正文仍是旧值,必须判定“更新未生效”;即使其他步骤成功或评论随后被删除,也只能报告部分完成,禁止写“全部完成”。 ## 上下文传递 diff --git a/skills/multi/dingtalk-doc/scripts/doc_create_and_write.py b/skills/multi/dingtalk-doc/scripts/doc_create_and_write.py index 4f2d9f29..a306b0e5 100644 --- a/skills/multi/dingtalk-doc/scripts/doc_create_and_write.py +++ b/skills/multi/dingtalk-doc/scripts/doc_create_and_write.py @@ -60,8 +60,6 @@ def run_dws(args: Sequence[str], dry_run: bool = False) -> Any: f"dws 命令失败:{detail or f'退出码 {result.returncode}'}" ) data = decode_json_output(result.stdout) - if data is None or data == {}: - raise ScriptError("dws 返回空业务结果,无法确认操作成功") if isinstance(data, dict) and data.get("success") is False: detail = data.get("errorMsg") or data.get("message") or "未知错误" raise ScriptError(f"dws 业务调用失败:{detail}") @@ -147,14 +145,12 @@ def run(argv: Optional[Sequence[str]] = None) -> int: ["doc", "info", "--node", node_id, "--format", "json"], dry_run=args.dry_run, ) - readback = run_dws( + run_dws( ["doc", "read", "--node", node_id, "--format", "json"], dry_run=args.dry_run, ) if args.dry_run: return 0 - if not first_value(readback, ("markdown", "jsonml", "content")): - raise ScriptError("文档回读未返回正文,无法确认写入成功") summary = { "success": True, diff --git a/test/scripts/doc_skill_scripts_test.py b/test/scripts/doc_skill_scripts_test.py index bfdf3026..b543ae9d 100644 --- a/test/scripts/doc_skill_scripts_test.py +++ b/test/scripts/doc_skill_scripts_test.py @@ -71,7 +71,7 @@ class DocSkillAlignmentTest(unittest.TestCase): self.assertNotIn("超过 200KB", combined) self.assertNotIn("doc get", combined) - def test_workflow_identity_and_fidelity_rules_are_explicit(self): + def test_workflow_and_identity_rules_are_explicit(self): skill = (SKILL_ROOT / "SKILL.md").read_text(encoding="utf-8") create_refs = "\n".join( path.read_text(encoding="utf-8") @@ -94,22 +94,11 @@ class DocSkillAlignmentTest(unittest.TestCase): MONO_DOC_ROOT / "doc-import.md", ] ) - comment_refs = "\n".join( - path.read_text(encoding="utf-8") - for path in [ - SKILL_ROOT / "references" / "doc" / "doc-comment.md", - MONO_DOC_ROOT / "doc-comment.md", - ] - ) - self.assertIn("不能覆盖用户显式要求的正文 H1", skill) self.assertIn("禁止先搜索同名文档", create_refs) self.assertIn("显式块操作不可折叠", block_refs) self.assertIn("list.isOrdered=true", block_refs) self.assertIn("在线编辑硬路由", import_refs) - self.assertIn("update 后正文仍是旧值", comment_refs) - self.assertIn("验证 12 条用例", skill) - self.assertIn("部分完成/更新未生效", skill) def test_schema_selection_preserves_doc_drive_boundaries(self): doc = json.loads( @@ -136,10 +125,6 @@ class DocSkillAlignmentTest(unittest.TestCase): "list.isOrdered=true", " ".join(doc["doc.insert_document_block"]["use_when"]), ) - self.assertIn( - "null/空对象", - " ".join(doc["doc.update_comment"]["avoid_when"]), - ) self.assertIn( "dws doc import", " ".join(drive["drive.upload"]["avoid_when"]), @@ -203,16 +188,6 @@ class DocCreateAndWriteTest(unittest.TestCase): with self.assertRaisesRegex(self.module.ScriptError, "denied"): self.module.run_dws(["doc", "create"]) - with mock.patch.object( - self.module.subprocess, - "run", - return_value=subprocess.CompletedProcess( - ["dws"], 0, stdout="null", stderr="" - ), - ): - with self.assertRaisesRegex(self.module.ScriptError, "空业务结果"): - self.module.run_dws(["doc", "create"]) - def test_wrapper_uses_create_then_info_and_read_without_manual_update(self): calls = [] @@ -236,18 +211,6 @@ class DocCreateAndWriteTest(unittest.TestCase): self.assertEqual("doc-1", summary["nodeId"]) self.assertTrue(summary["verified"]) - def test_wrapper_rejects_empty_readback(self): - def fake_run(args, dry_run=False): - if args[:2] == ["doc", "create"]: - return {"success": True, "nodeId": "doc-1"} - if args[:2] == ["doc", "info"]: - return {"success": True, "docUrl": "https://example.test/doc-1"} - return {"success": True, "markdown": ""} - - with mock.patch.object(self.module, "run_dws", side_effect=fake_run): - with self.assertRaisesRegex(self.module.ScriptError, "回读未返回正文"): - self.module.run(["--name", "周报", "--content", "hello"]) - def test_dry_run_shows_create_and_verification_commands(self): stdout = io.StringIO() with contextlib.redirect_stdout(stdout):