@daogee/mdgraph 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/LICENSE +21 -0
- package/README-ZH.md +203 -0
- package/README.md +203 -0
- package/agent-pack/README.md +26 -0
- package/agent-pack/host-examples.md +71 -0
- package/agent-pack/mcp-config.example.json +14 -0
- package/agent-pack/mdgraph-agent-instructions.md +21 -0
- package/agent-pack/prompts/relationship-trace.md +12 -0
- package/agent-pack/prompts/status-doctor.md +13 -0
- package/agent-pack/prompts/task-start-context.md +15 -0
- package/dist/analysis/doctor-scope.d.ts +8 -0
- package/dist/analysis/doctor-scope.js +109 -0
- package/dist/analysis/doctor.d.ts +148 -0
- package/dist/analysis/doctor.js +919 -0
- package/dist/analysis/status-freshness.d.ts +13 -0
- package/dist/analysis/status-freshness.js +55 -0
- package/dist/benchmark/benchmark.d.ts +118 -0
- package/dist/benchmark/benchmark.js +357 -0
- package/dist/bin/mdgraph.d.ts +2 -0
- package/dist/bin/mdgraph.js +877 -0
- package/dist/bundle/bundle.d.ts +66 -0
- package/dist/bundle/bundle.js +320 -0
- package/dist/config/limits.d.ts +24 -0
- package/dist/config/limits.js +24 -0
- package/dist/config/load-config.d.ts +14 -0
- package/dist/config/load-config.js +177 -0
- package/dist/db/connection.d.ts +15 -0
- package/dist/db/connection.js +145 -0
- package/dist/db/repositories.d.ts +159 -0
- package/dist/db/repositories.js +929 -0
- package/dist/db/schema.sql +110 -0
- package/dist/db/sqlite-adapter.d.ts +18 -0
- package/dist/db/sqlite-adapter.js +60 -0
- package/dist/diff/graph-diff.d.ts +41 -0
- package/dist/diff/graph-diff.js +334 -0
- package/dist/evaluation/retrieval-eval.d.ts +115 -0
- package/dist/evaluation/retrieval-eval.js +399 -0
- package/dist/export/diagram.d.ts +11 -0
- package/dist/export/diagram.js +41 -0
- package/dist/export/graphjson.d.ts +89 -0
- package/dist/export/graphjson.js +299 -0
- package/dist/export/markdown-index.d.ts +21 -0
- package/dist/export/markdown-index.js +89 -0
- package/dist/export/source-bridge.d.ts +22 -0
- package/dist/export/source-bridge.js +83 -0
- package/dist/extraction/entity-extractor.d.ts +12 -0
- package/dist/extraction/entity-extractor.js +153 -0
- package/dist/extraction/graph-builder.d.ts +2 -0
- package/dist/extraction/graph-builder.js +168 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +28 -0
- package/dist/indexer.d.ts +19 -0
- package/dist/indexer.js +100 -0
- package/dist/mcp/debug.d.ts +7 -0
- package/dist/mcp/debug.js +41 -0
- package/dist/mcp/server-instructions.d.ts +2 -0
- package/dist/mcp/server-instructions.js +40 -0
- package/dist/mcp/server.d.ts +28 -0
- package/dist/mcp/server.js +232 -0
- package/dist/mcp/tools.d.ts +31 -0
- package/dist/mcp/tools.js +506 -0
- package/dist/mcp/transport.d.ts +50 -0
- package/dist/mcp/transport.js +88 -0
- package/dist/parser/frontmatter.d.ts +10 -0
- package/dist/parser/frontmatter.js +191 -0
- package/dist/parser/links.d.ts +6 -0
- package/dist/parser/links.js +9 -0
- package/dist/parser/markdown-parser.d.ts +2 -0
- package/dist/parser/markdown-parser.js +267 -0
- package/dist/query/context-builder.d.ts +85 -0
- package/dist/query/context-builder.js +413 -0
- package/dist/query/search.d.ts +32 -0
- package/dist/query/search.js +237 -0
- package/dist/query/trace.d.ts +10 -0
- package/dist/query/trace.js +55 -0
- package/dist/reporting/report.d.ts +49 -0
- package/dist/reporting/report.js +143 -0
- package/dist/resolution/link-resolver.d.ts +17 -0
- package/dist/resolution/link-resolver.js +113 -0
- package/dist/scanner/file-scanner.d.ts +4 -0
- package/dist/scanner/file-scanner.js +144 -0
- package/dist/semantic/local-embedding.d.ts +4 -0
- package/dist/semantic/local-embedding.js +30 -0
- package/dist/semantic/status.d.ts +19 -0
- package/dist/semantic/status.js +70 -0
- package/dist/semantic/vector-codec.d.ts +3 -0
- package/dist/semantic/vector-codec.js +35 -0
- package/dist/types.d.ts +198 -0
- package/dist/types.js +15 -0
- package/dist/utils/bounded-json.d.ts +9 -0
- package/dist/utils/bounded-json.js +57 -0
- package/dist/utils/content-risk.d.ts +5 -0
- package/dist/utils/content-risk.js +20 -0
- package/dist/utils/fts.d.ts +3 -0
- package/dist/utils/fts.js +52 -0
- package/dist/utils/id.d.ts +2 -0
- package/dist/utils/id.js +8 -0
- package/dist/utils/path-safety.d.ts +4 -0
- package/dist/utils/path-safety.js +25 -0
- package/dist/utils/text.d.ts +7 -0
- package/dist/utils/text.js +36 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +11 -0
- package/dist/watcher/file-watcher.d.ts +11 -0
- package/dist/watcher/file-watcher.js +127 -0
- package/docs/EN/Agent_Integration.md +129 -0
- package/docs/EN/Architecture.md +135 -0
- package/docs/EN/Evaluation_Questions.md +68 -0
- package/docs/EN/Output_Contracts.md +274 -0
- package/docs/EN/Public_Contracts.md +88 -0
- package/docs/EN/Public_Contracts_1.0.md +234 -0
- package/docs/EN/Release_Checklist.md +82 -0
- package/docs/ZH/Agent_Integration.md +105 -0
- package/docs/ZH/Architecture.md +124 -0
- package/docs/ZH/Evaluation_Questions.md +66 -0
- package/docs/ZH/Output_Contracts.md +269 -0
- package/docs/ZH/Public_Contracts.md +81 -0
- package/docs/ZH/Public_Contracts_1.0.md +202 -0
- package/docs/ZH/Release_Checklist.md +83 -0
- package/package.json +94 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# MDGraph 1.0 契约冻结附录
|
|
2
|
+
|
|
3
|
+
状态:active
|
|
4
|
+
创建时间:2026-07-09
|
|
5
|
+
配套文档:[Public_Contracts.md](Public_Contracts.md) 与 [Output_Contracts.md](Output_Contracts.md)
|
|
6
|
+
任务:2026-06-27-roadmap-1-0-contract-freeze
|
|
7
|
+
|
|
8
|
+
本附录是 `1.0.0` 发布时冻结的 MDGraph public surface 公开契约清单。它为 [Public Contracts](Public_Contracts.md) ledger 提供
|
|
9
|
+
逐命令、逐格式、逐配置、逐 schema 的细节补充。
|
|
10
|
+
|
|
11
|
+
本地实现上下文见 `docs/tasks/2026-06-27-roadmap-1-0-contract-freeze/`,该目录
|
|
12
|
+
保持忽略,不作为 GitHub 交付物。
|
|
13
|
+
|
|
14
|
+
## 冻结基线
|
|
15
|
+
|
|
16
|
+
- Package version: `1.0.0`
|
|
17
|
+
- SQLite `schemaVersion`: `1`
|
|
18
|
+
- MCP tool surface: 固定下面五个工具
|
|
19
|
+
- 0.9 新增的 additive public surface 在 Public Contracts ledger 中显式标注
|
|
20
|
+
`stable-additive`,与 0.7-0.8 表面一起验证。
|
|
21
|
+
|
|
22
|
+
## 稳定性标签
|
|
23
|
+
|
|
24
|
+
复用 [Public_Contracts.md](Public_Contracts.md) 中的标签:
|
|
25
|
+
|
|
26
|
+
- `stable`:必需名称、必需字段、语义均冻结。
|
|
27
|
+
- `stable-additive`:既有字段与行为已冻结;只要旧消费者仍有效,可增加
|
|
28
|
+
optional 字段、metric 或命令。
|
|
29
|
+
- `experimental`:可见但不为 1.0 兼容承诺,可能随 changelog 与定向 migration
|
|
30
|
+
guidance 调整。
|
|
31
|
+
- `reserved`:为未来保留名称,在 emitter 或 workflow 被记录和测试前不启用。
|
|
32
|
+
- `internal`:实现细节,不提供兼容承诺。
|
|
33
|
+
|
|
34
|
+
## CLI Freeze 清单
|
|
35
|
+
|
|
36
|
+
每个顶层命令在命令路径上冻结。required arguments、options、JSON shape、text
|
|
37
|
+
shape、exit behavior 都是契约的一部分。人可读文本保持 `stable-additive`;JSON
|
|
38
|
+
shape 与 exit semantics 更严格。
|
|
39
|
+
|
|
40
|
+
| 命令 | 必需参数 | JSON 契约 | 文本契约 | 备注 |
|
|
41
|
+
|---|---|---|---|---|
|
|
42
|
+
| `usage` | none | `usage --json` 返回 `projectRoot`、`commonOptions`、`workflows` | 面向 agent 的 workflow guide | `stable-additive` |
|
|
43
|
+
| `init` | `--docs <glob...>`(或默认) | none | init summary | 默认构建初始 graph index;`--no-index` 是 `stable-additive` |
|
|
44
|
+
| `index` | none | `index --json` 返回 `files`、`changed`、`deleted`、`unchanged`、`skipped`、`skippedFiles`、`mode`、`counts` | 进度 summary | `--semantic` 与 `--full` 是 `stable-additive` |
|
|
45
|
+
| `status` | none | `status --json` 返回 graph counts;`--storage` 追加 `storage`;`--freshness` 追加 `freshness` | counts summary | `--freshness` 是 `stable-additive` |
|
|
46
|
+
| `search` | `<query>` | `search --json` 返回 `document`、可选 `section`、`score`、`reason`、`content`、`matchedEntities`、可选 `semantic`;`--explain` 追加 `query`、`limit`、`queryMode`、`entityCandidates`、`ftsQuery`、`semanticEnabled`、`semanticActive`、`ranking`、`matchedEntities`、`results` | 文本列表 | `--explain`、`--semantic`、`--limit` 是 `stable-additive` |
|
|
47
|
+
| `context` | `<query>` | `context --json` 返回 `query`、`maxChars`、`usedChars`、`items`;每个 item 含 `nodeId`、`documentId`、可选 `sectionId`、可选 `anchor`、`path`、`title`、可选 `heading`、可选 `lines`、`reason`、`matchedEntities`、可选 `edgePath`(含 `fromId`、`fromLabel`、`edgeFromId`、`edgeToId`、`edgeKind`、`toId`、`toLabel`、`traversalDirection`、`confidence`、`provenance`)、可选 `sourceRefs`、可选 `riskNotes`、`content`;`--debug` 追加 `debug` | 文本 context summary | recovery fields 是 `stable-additive` |
|
|
48
|
+
| `node` | `<query>` | `node --json` 返回 `id`、`label`、`kind`、`data`;未解析时返回 `error: "ambiguous_section"` 或 `error: "not_found"` | 文本 node summary | 带 anchor 的 section 查找是 `stable-additive` |
|
|
49
|
+
| `trace` | `<from>`, `<to>` | `trace --json` 返回 `from`、`to`、`found`、`steps` | 文本 trace summary | `--depth` 是 `stable-additive` |
|
|
50
|
+
| `eval` | none | `eval --json` 返回 `querySet`、`limit`、`ranking`、`generatedAt`、`summary`、`cases` | summary | `--path`、`--query-set`、`--query-mode`、`--limit` 是 `stable-additive`;`--query-set` 接受封闭枚举 `alpha | cjk`;`--limit` 接受正整数 |
|
|
51
|
+
| `semantic status` | none | `semantic status --json` 返回 `state`(封闭枚举 `disabled | not_indexed | ready | unsupported_provider | needs_reindex`)、`enabled`、`provider`、`model`、`dimensions`、`providerSupported`、`indexed`、`chunks`、`vectors`、`vectorStorageFormat`(封闭枚举 `float32_blob`)、`indexedProviders`、`guidance` | 文本 status | `experimental` |
|
|
52
|
+
| `bundle create` | none | `bundle create --json` 返回 `bundleDir`、`manifestPath`、`manifest` | summary | `--profile` 是 `experimental`;仅支持 `private`;`--path` 是 `stable-additive` |
|
|
53
|
+
| `bundle verify` | `<dir>` | `bundle verify --json` 返回 `bundleDir`、`valid`、`errors`、`manifest`、`counts`、`schemaVersion`、`sourceHash`、`configHash`、`freshness` | summary | `valid: false` 时非零退出;`--path` 是 `stable-additive`,用于 freshness 比较 |
|
|
54
|
+
| `export graphjson` | none | `export graphjson --json` 返回 `format: "mdgraph-graphjson"`、`formatVersion: 1`、`schemaVersion`、`mdgraphVersion`、`exportProfile: "structural"`、`graphHash`、`sourceHash`、`counts`、`exportedCounts`、`nodes`、`edges` | structural JSON | 必需 v1 字段与隐私边界为 `stable`;`--path` 是 `stable-additive` |
|
|
55
|
+
| `export mermaid trace` | `<from>`, `<to>` | `export mermaid trace <from> <to> --json` 返回 `format: "mdgraph-mermaid"`、`formatVersion: 1`、`diagramType: "trace"`、`found`、`diagram`、`trace` | Mermaid text | wrapper 字段为 `stable-additive`;`--depth` 是 `stable-additive` |
|
|
56
|
+
| `export markdown-index` | none | none | WikiLink Markdown | 文档事实为 `stable-additive`;`--path` 是 `stable-additive` |
|
|
57
|
+
| `export docs-site` | none | `export docs-site --json` 返回 `format: "mdgraph-docsite-index"`、`formatVersion: 1`、`sourceFormat`、`graphHash`、`documents` | summary | 文档事实为 `stable-additive`;`--path` 是 `stable-additive` |
|
|
58
|
+
| `export source-bridge` | none | `export source-bridge --json` 返回 `format: "mdgraph-source-bridge"`、`formatVersion: 1`、`provider`、`status`(封闭枚举 `ready | unsupported`)、`reason`、`sourceRefs`、`matched`、`unmatched` | summary | provider 语义为 `experimental`;wrapper 为 `stable-additive`;`--provider` 接受 `json`;`--artifact <file>` 在 `status: "ready"` 时必需 |
|
|
59
|
+
| `import graphjson` | `<file>` | `import graphjson <file> --verify --json` 返回 `valid`、`errors`、`warnings`,以及可读的 `format`、`formatVersion`、`schemaVersion`、`graphHash`、`counts`、`exportedCounts` | summary | `--verify` 必需;`valid: false` 时非零退出;project root 由文件参数隐式决定 |
|
|
60
|
+
| `diff` | none | `diff --base <ref> --json` 返回 `mode`、`base`、`head`、`summary`、`documents`、`impact` | summary | base index 在临时目录中创建 |
|
|
61
|
+
| `report` | none | `report --json` 返回 `projectRoot`、`generatedAt`、`mdgraphVersion`、`indexed`、`schema`、`counts`、`storage`、`source`、`doctor`、`eval`、`bundle`、`diff`、`benchmark`、`trend` | summary | 可选 flags 为 `experimental` |
|
|
62
|
+
| `serve --mcp` | none | 不适用;通过 stdio 发送 MCP JSON-RPC | stdio JSON-RPC;watch 或 MCP debug 开启时记录到 stderr | 默认 watch 为 `stable-additive`;`--no-watch` 是只读退路 |
|
|
63
|
+
| `watch` | none | none | 进度日志 | `--semantic` 与 `--debounce <ms>` 是 `stable-additive` |
|
|
64
|
+
| `doctor` | none | `doctor --json` 返回 `staleIndex`、`summary`(含 `documents`、`orphanDocs`、`deadLinks`、`staleSourceRefs`、`missingDefinitions`、`weaklyLinkedDocs`、`possibleContradictions`、`contentRisks`、`staleIndex`)、`issues`,可选 `scope`(含 `mode`、`baseRef`、`changedPaths`、`deletedPaths`、`renamedPaths`、`untrackedPaths`、`globalHealthIncluded`)、可选 `health`(含 `graph`、`storage`)、可选 `frontmatterDiagnostics` | summary | `--changed` 与 `--since <ref>` 是 `stable-additive`;`--fail-on <severity>`(封闭枚举 `error | warn | info`)在不低于该严重级时非零退出;`--strict` 是旧严格模式 |
|
|
65
|
+
|
|
66
|
+
项目相关命令接受 additive `--path <project>` flag,让 agent 和脚本不必切换
|
|
67
|
+
shell cwd 即可定位仓库。
|
|
68
|
+
|
|
69
|
+
## 配置默认值
|
|
70
|
+
|
|
71
|
+
| Key | Default | 备注 |
|
|
72
|
+
|---|---|---|
|
|
73
|
+
| `docs.include` | `["**/*.md", "**/*.mdx"]` | 默认排除 `**/node_modules/**`、`**/dist/**`、`**/build/**`、`**/.next/**`、`**/coverage/**`、`**/temp/**`、`**/.git/**`、`**/.mdgraph/**`。 |
|
|
74
|
+
| `docs.exclude` | `[]`(在 built-in exclude 之上叠加) | |
|
|
75
|
+
| `index.parseMdx` | `false` | |
|
|
76
|
+
| `index.followGitignore` | `true` | |
|
|
77
|
+
| `index.maxFileBytes` | `524288` | 上限 `10 MiB` |
|
|
78
|
+
| `search.defaultLimit` | `8` | 上限 `100` |
|
|
79
|
+
| `search.maxDepth` | `2` | 上限 `12` |
|
|
80
|
+
| `search.maxContextChars` | `28000` | 上限 `200000` |
|
|
81
|
+
| `search.highFrequencyEntityThreshold` | `50` | 上限 `100000` |
|
|
82
|
+
| `entities.enabledKinds` | `["symbol", "api_route", "error_code", "config_key", "file_path", "command", "package", "concept"]` | |
|
|
83
|
+
| `entities.stopEntities` | `["Config", "Error", "Service", "API", "User", "Data"]` | 噪声抑制列表 |
|
|
84
|
+
| `embedding.enabled` | `false` | 可选本地 semantic vectors |
|
|
85
|
+
| `embedding.provider` | `"local-hash"` | 仅 `local-hash` 是完全受支持的 provider |
|
|
86
|
+
| `embedding.model` | `"mdgraph-local-hash-v1"` | |
|
|
87
|
+
| `embedding.dimensions` | `128` | 上限 `4096` |
|
|
88
|
+
|
|
89
|
+
未知 key 当前由 merge 逻辑忽略。1.0 不强制将未知 key 变为错误;保持"忽略但不
|
|
90
|
+
承诺"的保守默认,使既有 config 文件继续加载。数值与路径相关限制仍属于安全
|
|
91
|
+
契约的一部分。
|
|
92
|
+
|
|
93
|
+
## MCP 冻结
|
|
94
|
+
|
|
95
|
+
MCP surface 保持固定为五个工具:
|
|
96
|
+
|
|
97
|
+
- `mdgraph_search`
|
|
98
|
+
- `mdgraph_context`
|
|
99
|
+
- `mdgraph_node`
|
|
100
|
+
- `mdgraph_trace`
|
|
101
|
+
- `mdgraph_status`
|
|
102
|
+
|
|
103
|
+
`tools/list` 返回的工具顺序属于契约的一部分。每个工具 schema 设置
|
|
104
|
+
`additionalProperties: false`。initialize root 和每个工具的 `projectPath` 必须
|
|
105
|
+
位于 served project root 内。text-first content 面向人;机器契约优先使用
|
|
106
|
+
`structuredContent`。
|
|
107
|
+
|
|
108
|
+
冻结的 MCP 输入形状为:
|
|
109
|
+
|
|
110
|
+
- `mdgraph_search` — 必需 `query`;可选 `limit`(正整数,受 `search.defaultLimit`
|
|
111
|
+
上限 `100` 约束)、`projectPath`。
|
|
112
|
+
- `mdgraph_context` — 必需 `query`;可选 `knownFiles`(字符串数组)、`maxChars`
|
|
113
|
+
(正整数,受 `search.maxContextChars` 上限 `200000` 约束)、`projectPath`。
|
|
114
|
+
- `mdgraph_node` — 必需 `query`;可选 `projectPath`。
|
|
115
|
+
- `mdgraph_trace` — 必需 `from`、`to`;可选 `depth`(正整数,受 `search.maxDepth`
|
|
116
|
+
上限 `12` 约束)、`projectPath`。
|
|
117
|
+
- `mdgraph_status` — 可选 `projectPath`。
|
|
118
|
+
|
|
119
|
+
根据兼容性策略,后续可以在保持旧客户端可用的前提下追加 optional inputs。
|
|
120
|
+
|
|
121
|
+
freshness 行为是 0.9 契约的一部分:`mdgraph_status` 在已建立索引时报告
|
|
122
|
+
freshness;查询工具在索引 `stale` 或 `unknown` 时可以前置非阻塞的 freshness
|
|
123
|
+
warning 并附加 additive freshness metadata。MCP 文本措辞为 `experimental`;
|
|
124
|
+
代表性 `structuredContent` 字段为 `stable-additive`。
|
|
125
|
+
|
|
126
|
+
1.0 冻结期间不向 MCP 添加 0.7 export/import surface。如果未来 agent 需要
|
|
127
|
+
`mdgraph_export_graphjson`,应作为单独的 public-surface 决策。
|
|
128
|
+
|
|
129
|
+
## JSON 格式冻结
|
|
130
|
+
|
|
131
|
+
required top-level fields 冻结;新增 optional fields 仅在兼容性策略标注
|
|
132
|
+
`stable-additive` 时允许。
|
|
133
|
+
|
|
134
|
+
- `mdgraph-graphjson`、`formatVersion: 1`、`schemaVersion`、
|
|
135
|
+
`mdgraphVersion`、`exportProfile: "structural"`、`graphHash`、
|
|
136
|
+
`sourceHash`、`counts`、`exportedCounts`、`nodes`、`edges`。
|
|
137
|
+
- GraphJSON verify 结果:`valid`、`errors`、`warnings`、可读的 metadata 字段、
|
|
138
|
+
错误 `code`、`message`、可选 `evidence` 与 `remediation`。
|
|
139
|
+
- `mdgraph-mermaid`、`formatVersion: 1`、`diagramType: "trace"`、`found`、
|
|
140
|
+
`diagram`、`trace`。
|
|
141
|
+
- `mdgraph-docsite-index`、`formatVersion: 1`、`sourceFormat`、`graphHash`、
|
|
142
|
+
`documents`。
|
|
143
|
+
- `mdgraph-source-bridge`、`formatVersion: 1`、`provider`、`status`(封闭
|
|
144
|
+
枚举 `ready | unsupported`)、`reason`、`sourceRefs`、`matched`、`unmatched`。
|
|
145
|
+
|
|
146
|
+
同时冻结既有核心 JSON 输出,足以支撑脚本与 agent:`usage`、`status`、
|
|
147
|
+
`status --freshness`、`search`、`context`、`node`、`trace`、`doctor`、
|
|
148
|
+
`semantic status`、`eval`、`diff`、`report` 以及 bundle create/verify。
|
|
149
|
+
|
|
150
|
+
兼容性规则:
|
|
151
|
+
|
|
152
|
+
- 删除或重命名必需字段属于破坏性变更。
|
|
153
|
+
- 修改 `format` 或 `formatVersion` 语义需要新的版本化契约。
|
|
154
|
+
- `stable-additive` 对象允许追加 optional 字段。
|
|
155
|
+
- 当必需 v1 字段有效时,可忽略未来未知字段。
|
|
156
|
+
- 确定性导出必须保持稳定排序与隐私边界。
|
|
157
|
+
- `graphHash` 变化要么保持一致的规范语义,要么显式版本升级。
|
|
158
|
+
|
|
159
|
+
## Schema 冻结
|
|
160
|
+
|
|
161
|
+
Schema 稳定性覆盖 MDGraph 自有 index 兼容性,而非第三方 SQL 访问。1.0 契约
|
|
162
|
+
定义:
|
|
163
|
+
|
|
164
|
+
- 当前 `schemaVersion: 1`(参见 `src/db/connection.ts` 中的
|
|
165
|
+
`CURRENT_SCHEMA_VERSION`)
|
|
166
|
+
- 必需的 `schema_metadata` keys
|
|
167
|
+
- `schema_migrations` 的使用方式
|
|
168
|
+
- 在应用本地 schema SQL 前拒绝未来 schema
|
|
169
|
+
- 表/列的 additive 变更迁移规则
|
|
170
|
+
- 何时需要 full reindex 而非原地迁移
|
|
171
|
+
- 旧数据库的回退(`legacy` baseline,针对尚未记录 metadata 的数据库)
|
|
172
|
+
- 哪些 storage 字段是 internal 而不导出
|
|
173
|
+
|
|
174
|
+
SQLite 表名与列名对 MDGraph 升级足够稳定,但外部工具应消费 GraphJSON 而
|
|
175
|
+
不是读取 `.mdgraph/graph.db`。
|
|
176
|
+
|
|
177
|
+
## 兼容策略
|
|
178
|
+
|
|
179
|
+
- 当已有字段语义不变时,允许追加 JSON 字段。
|
|
180
|
+
- 1.0 后删除、重命名或改变已记录 stable 字段类型属于破坏性变更。
|
|
181
|
+
- 默认行为不变时,可新增 optional CLI flag。
|
|
182
|
+
- MCP 工具名与必需 input 稳定;旧客户端可继续工作时允许新增 optional input。
|
|
183
|
+
- 必需 v1 字段有效时,可忽略未知未来 GraphJSON 字段。
|
|
184
|
+
- 不支持的未来 `formatVersion` 必须返回可操作的升级 guidance。
|
|
185
|
+
- 已返回结构化错误的命令应包含稳定 `code` 与 remediation。
|
|
186
|
+
- verify 失败、bundle verify 无效、strict doctor gate 与非法命令用法的非零
|
|
187
|
+
退出属于契约的一部分。
|
|
188
|
+
|
|
189
|
+
## 风险缓解
|
|
190
|
+
|
|
191
|
+
- 过度冻结会阻碍必要的 1.x 修复。缓解:将精确 ranking score、prose 文本和
|
|
192
|
+
物理 SQLite 内部标记为非契约。
|
|
193
|
+
- 冻结过少会让 GraphJSON/MCP 消费者暴露在 drift 中。缓解:用 focused
|
|
194
|
+
contract tests 保护必需 JSON 字段、MCP tool schema 和 CLI command path。
|
|
195
|
+
- Golden fixtures 可能变得嘈杂。缓解:保持小型化、fixture 驱动,仅覆盖
|
|
196
|
+
稳定字段而非整份大输出。
|
|
197
|
+
- Schema migration 承诺可能超出 MVP。缓解:冻结版本/拒绝/reindex 策略,
|
|
198
|
+
而非任意外部 SQL 兼容性。
|
|
199
|
+
- source bridge 仍是 experimental。缓解:仅冻结 report wrapper 与
|
|
200
|
+
unsupported/ready 状态,不冻结任意第三方 schema。
|
|
201
|
+
- Pack 或 release smoke 在当前环境可能较慢。缓解:将 pack smoke 保留为
|
|
202
|
+
release closeout,并在不能完成时记录精确的残余风险。
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# MDGraph 发布清单
|
|
2
|
+
|
|
3
|
+
在发布 MDGraph 或请求维护者切 release 前使用此清单。它补充 [CHANGELOG.md](../../CHANGELOG.md)、[Output_Contracts.md](Output_Contracts.md)、[Public_Contracts.md](Public_Contracts.md) 和 task public check。
|
|
4
|
+
|
|
5
|
+
## 公开检查
|
|
6
|
+
|
|
7
|
+
- 确认公开 package 为 `@daogee/mdgraph`、安装后的 binary 仍为 `mdgraph`,并且 `package.json` / CLI 版本与 release tag 一致。
|
|
8
|
+
- 确认 [CHANGELOG.md](../../CHANGELOG.md) 已包含本次发布条目。
|
|
9
|
+
- 当公开 CLI/MCP 行为变化时,复查 README quick start、运行要求、MCP setup、输出契约、公开契约标签和已知 tradeoff。
|
|
10
|
+
|
|
11
|
+
## 0.8 契约门槛
|
|
12
|
+
|
|
13
|
+
- 确认 [Public_Contracts.md](Public_Contracts.md) 为每个被触及的 public surface 标注 `stable`、`stable-additive`、`experimental`、`reserved` 或 `internal`。
|
|
14
|
+
- 确认 focused contract tests 覆盖 MCP tool definitions、代表性 JSON fields、edge kinds、doctor warning shape、config defaults 和 schema compatibility guidance。
|
|
15
|
+
- 已经返回结构化错误的命令,应确认错误输出包含稳定 `code` 和 remediation。
|
|
16
|
+
|
|
17
|
+
## 0.9 证据门槛
|
|
18
|
+
|
|
19
|
+
- 确认 [Public_Contracts.md](Public_Contracts.md) 将 context recovery fields 标注为 `stable-additive`。
|
|
20
|
+
- 确认 context、MCP 和 contract tests 覆盖 `nodeId`、`documentId`、可选 `sectionId`、可选 `anchor` 和 graph-expansion `edgePath`。
|
|
21
|
+
- 确认 `smoke:cli` 使用仓库自有 fixture 覆盖多问题结构化 benchmark。
|
|
22
|
+
- 除非单独 release 明确冻结,否则确认 optional semantic 行为仍保持 experimental。
|
|
23
|
+
|
|
24
|
+
## 1.0 readiness 门槛
|
|
25
|
+
|
|
26
|
+
- 确认已知 output-shape 不一致已经规范化,或被明确记录为刻意保留。
|
|
27
|
+
- 确认 `context --json` 和 MCP `mdgraph_context.structuredContent` 暴露恢复字段(`nodeId`、`documentId`、可选 `sectionId`、可选 `anchor` 和 graph-expansion `edgePath`),方便 agent 交接到 `node`、`trace` 和 raw Markdown。
|
|
28
|
+
- 确认 Node.js `>=22.5.0` 仍是支持下限,且当前 release 已在当前 Node 22.x 上测试。
|
|
29
|
+
- 确认 Linux 和 Windows full CI 行通过。`1.0` 前确认 macOS CI smoke 行通过 build-output CLI 和 packed-artifact smoke。
|
|
30
|
+
- 对 CI 有意不自动覆盖的平台相关长运行 surface 执行 maintainer smoke:在相关目标 OS 上运行 `serve --mcp` 和 `watch`。
|
|
31
|
+
- 确认 1.0 release notes 将兼容承诺与功能新增分开说明。
|
|
32
|
+
|
|
33
|
+
## 命令门槛
|
|
34
|
+
|
|
35
|
+
安装依赖后,从仓库根目录运行:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm run typecheck
|
|
39
|
+
npm run build
|
|
40
|
+
npm run test:run
|
|
41
|
+
npm run smoke:cli
|
|
42
|
+
npm run smoke:eval
|
|
43
|
+
npm run smoke:pack
|
|
44
|
+
npm run smoke:clean
|
|
45
|
+
node dist/bin/mdgraph.js index --json
|
|
46
|
+
node dist/bin/mdgraph.js doctor --strict --json
|
|
47
|
+
node dist/bin/mdgraph.js status --storage --json
|
|
48
|
+
node dist/bin/mdgraph.js bundle create --profile private --json
|
|
49
|
+
node dist/bin/mdgraph.js bundle verify BUNDLE_DIR_FROM_CREATE_OUTPUT --json
|
|
50
|
+
node dist/bin/mdgraph.js report --json --eval --bundle BUNDLE_DIR_FROM_CREATE_OUTPUT
|
|
51
|
+
node dist/bin/mdgraph.js diff --base HEAD --json
|
|
52
|
+
node dist/bin/mdgraph.js report --json --base HEAD
|
|
53
|
+
node dist/bin/mdgraph.js report --json --benchmark PATH_TO_BENCHMARK_RUN_RECORDS
|
|
54
|
+
npm run task:public-check
|
|
55
|
+
git diff --check
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
预期结果:
|
|
59
|
+
|
|
60
|
+
- Typecheck、tests、build、CLI smoke 和 pack smoke 均以 0 退出。
|
|
61
|
+
- `doctor --strict --json` 对 MDGraph 仓库报告 `staleIndex: 0`,且没有问题计数。
|
|
62
|
+
- `status --storage --json` 返回 `{ counts, storage }`,并包含 database、object、path group、edge kind、high-degree node 和 vector 信息。
|
|
63
|
+
- `bundle create`、`bundle verify` 和 `report --json --eval --bundle` 为当前仓库索引返回有效的私有工作流 artifact。
|
|
64
|
+
- `diff --base` 和 `report --base` 返回 documentation graph impact summary,且不会替换当前 index。
|
|
65
|
+
- `report --benchmark` 为多问题 smoke set 返回 paired run-record delta,将不完整 pair 报告为 skipped,并且不需要 transcript 或 agent/model 执行。
|
|
66
|
+
- `task:public-check` 不应发现 `docs/tasks/` 下除允许公开文件外的已跟踪任务工件。
|
|
67
|
+
- `git diff --check` 干净。Windows CRLF 文件如出现未改动行尾误报,可设置仓库本地 `core.whitespace=cr-at-eol`。
|
|
68
|
+
- 私有或第三方评估语料必须保留在 release artifacts 和公开 fixtures 之外。
|
|
69
|
+
- macOS CI 行仅作 smoke,不替代完整命令门槛,也不替代 MCP server、watcher 和 external-corpus 行为的 maintainer 检查。
|
|
70
|
+
|
|
71
|
+
## Package 门槛
|
|
72
|
+
|
|
73
|
+
- 如果 package metadata 或 included public docs 变化,使用 `npm pack --dry-run` 检查 tarball 内容。
|
|
74
|
+
- 确认 package 包含 `dist`、`README.md`、`README-ZH.md`、`CHANGELOG.md` 和 `LICENSE`。
|
|
75
|
+
- 发布前在干净的临时 prefix 中全局安装打包 tarball,并验证 `mdgraph --version`、`init` 和一个代表性查询。
|
|
76
|
+
- 确认 package 不包含 `.mdgraph/`、任务工件目录、临时输出、本地数据库或外部工作区内容。
|
|
77
|
+
|
|
78
|
+
## Release notes 文案
|
|
79
|
+
|
|
80
|
+
- 总结用户可见的 CLI/MCP 行为变化。
|
|
81
|
+
- 明确指出输出契约变化。
|
|
82
|
+
- 仅把已知 `node:sqlite` experimental warning 描述为非失败运行时 warning。
|
|
83
|
+
- 将外部 alpha warning 与 MDGraph 仓库发布阻塞项分开。
|
package/package.json
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@daogee/mdgraph",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Local-first Markdown document graph for AI coding workflows.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/daoGEE/mdgraph.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/daoGEE/mdgraph/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/daoGEE/mdgraph#readme",
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"agent-pack",
|
|
21
|
+
"docs/EN/*.md",
|
|
22
|
+
"docs/ZH/*.md",
|
|
23
|
+
"README.md",
|
|
24
|
+
"README-ZH.md",
|
|
25
|
+
"CHANGELOG.md",
|
|
26
|
+
"LICENSE"
|
|
27
|
+
],
|
|
28
|
+
"bin": {
|
|
29
|
+
"mdgraph": "dist/bin/mdgraph.js"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc && node scripts/assets.mjs",
|
|
33
|
+
"clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
34
|
+
"prepack": "npm run build",
|
|
35
|
+
"pretest": "npm run build",
|
|
36
|
+
"smoke:cli": "node scripts/smoke-cli.mjs",
|
|
37
|
+
"smoke:clean": "node scripts/smoke-clean.mjs",
|
|
38
|
+
"smoke:eval": "node scripts/smoke-eval.mjs",
|
|
39
|
+
"smoke:pack": "node scripts/smoke-pack.mjs",
|
|
40
|
+
"task:check": "node scripts/task-tools.mjs check",
|
|
41
|
+
"task:new": "node scripts/task-tools.mjs new",
|
|
42
|
+
"task:public-check": "node scripts/task-tools.mjs public-check",
|
|
43
|
+
"task:smoke": "node scripts/task-tools.mjs smoke",
|
|
44
|
+
"test": "vitest run",
|
|
45
|
+
"test:run": "vitest run",
|
|
46
|
+
"test:watch": "vitest",
|
|
47
|
+
"typecheck": "tsc --noEmit"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"chokidar": "^4.0.3",
|
|
51
|
+
"commander": "^12.1.0",
|
|
52
|
+
"fast-glob": "^3.3.3",
|
|
53
|
+
"remark-gfm": "^4.0.1",
|
|
54
|
+
"remark-parse": "^11.0.0",
|
|
55
|
+
"unified": "^11.0.5",
|
|
56
|
+
"yaml": "^2.9.0"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@types/node": "^22.15.30",
|
|
60
|
+
"typescript": "^5.8.3",
|
|
61
|
+
"vitest": "^3.2.6"
|
|
62
|
+
},
|
|
63
|
+
"overrides": {
|
|
64
|
+
"esbuild": "0.28.1"
|
|
65
|
+
},
|
|
66
|
+
"engines": {
|
|
67
|
+
"node": ">=22.5.0"
|
|
68
|
+
},
|
|
69
|
+
"main": "dist/index.js",
|
|
70
|
+
"types": "dist/index.d.ts",
|
|
71
|
+
"exports": {
|
|
72
|
+
".": {
|
|
73
|
+
"types": "./dist/index.d.ts",
|
|
74
|
+
"import": "./dist/index.js"
|
|
75
|
+
},
|
|
76
|
+
"./package.json": "./package.json"
|
|
77
|
+
},
|
|
78
|
+
"directories": {
|
|
79
|
+
"doc": "docs"
|
|
80
|
+
},
|
|
81
|
+
"keywords": [
|
|
82
|
+
"markdown",
|
|
83
|
+
"knowledge-graph",
|
|
84
|
+
"document-graph",
|
|
85
|
+
"mcp",
|
|
86
|
+
"model-context-protocol",
|
|
87
|
+
"ai-agents",
|
|
88
|
+
"coding-agents",
|
|
89
|
+
"local-first",
|
|
90
|
+
"sqlite",
|
|
91
|
+
"documentation"
|
|
92
|
+
],
|
|
93
|
+
"author": "daoGEE"
|
|
94
|
+
}
|