dsh-doc-guard
文档-代码一致性守护(Document-Code Consistency Guard):审计仓库的版本号/更新记录表/结构树/模块清单/测试计数/文档间交叉引用,检测漂移并按严重度输出修复建议。全程只读。
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:lucky8197/dsh-doc-guard说明文档
阅读完整 README ↗dsh-doc-guard(文档-代码一致性守护)
Document-Code Consistency Guard for DeepSeek Harness. A read-only DSH plugin that audits your versioned Markdown design docs against the actual repository: header version numbers, changelog tables, directory-structure trees, module/test counts, and cross-document references. It detects drift (docs saying one thing, code being another) and outputs actionable, severity-sorted fix suggestions. Install with:
dsh plugin --profile web add "github:/dsh-doc-guard#main".
很多仓库用「版本化 Markdown 文档」记录设计:doc/ 下多份文档,头部有 文档版本:vX.Y,
更新记录是 Markdown 表格,正文含目录结构树、模块/系统清单、测试计数、验收数字与文档间互相引用。
代码改完后文档极易漂移:改了代码没加更新记录行、版本号没递增、结构树与真实文件树不符、
测试数与验收记录对不上、文档间引用版本不一致。
dsh-doc-guard 用纯启发式、全程只读地审计这些维度,检测漂移并按严重度输出可直接执行的修复建议。
是 DSH 生态中第一个做「文档漂移审计」的插件(context-doctor 只审上下文注入成本,不审文档漂移)。
特性
| 审计维度 | 说明 | 漂移类型 | 严重度 |
|---|---|---|---|
| 版本号一致性 | 头部 **文档版本:vX.Y**(或 > - 文档版本:vX.Y)与更新记录表最新行版本比对;文档间 对应技术设计 vX 引用值与目标文档当前版本比对 | version_mismatch | high |
| 更新记录表 | 解析 | 版本 | 日期 | 更新内容 | 表格:最新版本≠头部版本、更新内容为空(禁止只改版本号不记内容) | version_mismatch / missing_record | high / medium |
| 代码变更未记录 | 最近代码文件 mtime 晚于记录表最新日期超过窗口 → 「可能有未记录的代码变更」(mtime 启发式,安全边界内不执行 git) | stale_record | low |
| 结构树漂移 | 代码块中 ├──/└── 目录树 vs 真实文件系统(自动排除构建/VCS 目录;目录级摘要树只比目录层级) | tree_missing / tree_extra | medium / low |
| 模块/系统清单 | N 个 System / N 份文档 / N 个测试文件 等计数声明 vs 真实计数(目录条目/文档数/测试数) | count_mismatch | low |
| 测试计数 | Core 199/199、Net 91 通过/4 跳过 等验收数字 vs 测试源文件静态统计(按扩展名识别 [Fact]/it(/#[test]/def test_/@Test/func Test,不执行测试) | count_mismatch | low |
| 文档间交叉引用 | 详见 §X / 见实现文档 §X → 被引文档是否存在;对应技术设计 vX → 版本值是否等于被引文档当前版本 |