@mycodemap/mycodemap 0.4.2 → 0.5.1
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 +105 -3
- package/README.md +192 -53
- package/dist/ai/claude.d.ts +38 -0
- package/dist/ai/claude.d.ts.map +1 -0
- package/dist/ai/claude.js +169 -0
- package/dist/ai/claude.js.map +1 -0
- package/dist/ai/codex.d.ts +38 -0
- package/dist/ai/codex.d.ts.map +1 -0
- package/dist/ai/codex.js +169 -0
- package/dist/ai/codex.js.map +1 -0
- package/dist/ai/factory.d.ts +48 -0
- package/dist/ai/factory.d.ts.map +1 -0
- package/dist/ai/factory.js +95 -0
- package/dist/ai/factory.js.map +1 -0
- package/dist/ai/index.d.ts +12 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +29 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/provider.d.ts +70 -0
- package/dist/ai/provider.d.ts.map +1 -0
- package/dist/ai/provider.js +31 -0
- package/dist/ai/provider.js.map +1 -0
- package/dist/ai/subagent-caller.d.ts +90 -0
- package/dist/ai/subagent-caller.d.ts.map +1 -0
- package/dist/ai/subagent-caller.js +280 -0
- package/dist/ai/subagent-caller.js.map +1 -0
- package/dist/ai/types.d.ts +70 -0
- package/dist/ai/types.d.ts.map +1 -0
- package/dist/ai/types.js +5 -0
- package/dist/ai/types.js.map +1 -0
- package/dist/cli/commands/analyze.d.ts +18 -0
- package/dist/cli/commands/analyze.d.ts.map +1 -1
- package/dist/cli/commands/analyze.js +239 -6
- package/dist/cli/commands/analyze.js.map +1 -1
- package/dist/cli/commands/check.d.ts +22 -0
- package/dist/cli/commands/check.d.ts.map +1 -0
- package/dist/cli/commands/check.js +168 -0
- package/dist/cli/commands/check.js.map +1 -0
- package/dist/cli/commands/ci.d.ts +25 -0
- package/dist/cli/commands/ci.d.ts.map +1 -1
- package/dist/cli/commands/ci.js +139 -36
- package/dist/cli/commands/ci.js.map +1 -1
- package/dist/cli/commands/complexity.d.ts.map +1 -1
- package/dist/cli/commands/complexity.js +6 -0
- package/dist/cli/commands/complexity.js.map +1 -1
- package/dist/cli/commands/design.d.ts +52 -0
- package/dist/cli/commands/design.d.ts.map +1 -0
- package/dist/cli/commands/design.js +274 -0
- package/dist/cli/commands/design.js.map +1 -0
- package/dist/cli/commands/generate.d.ts +1 -0
- package/dist/cli/commands/generate.d.ts.map +1 -1
- package/dist/cli/commands/generate.js +121 -8
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/cli/commands/history.d.ts +26 -0
- package/dist/cli/commands/history.d.ts.map +1 -0
- package/dist/cli/commands/history.js +92 -0
- package/dist/cli/commands/history.js.map +1 -0
- package/dist/cli/commands/mcp.d.ts +13 -0
- package/dist/cli/commands/mcp.d.ts.map +1 -0
- package/dist/cli/commands/mcp.js +108 -0
- package/dist/cli/commands/mcp.js.map +1 -0
- package/dist/cli/commands/server.d.ts +9 -0
- package/dist/cli/commands/server.d.ts.map +1 -0
- package/dist/cli/commands/server.js +65 -0
- package/dist/cli/commands/server.js.map +1 -0
- package/dist/cli/commands/ship/pipeline.d.ts.map +1 -1
- package/dist/cli/commands/ship/pipeline.js +8 -1
- package/dist/cli/commands/ship/pipeline.js.map +1 -1
- package/dist/cli/commands/ship/publisher.d.ts +9 -1
- package/dist/cli/commands/ship/publisher.d.ts.map +1 -1
- package/dist/cli/commands/ship/publisher.js +149 -6
- package/dist/cli/commands/ship/publisher.js.map +1 -1
- package/dist/cli/commands/workflow.d.ts.map +1 -1
- package/dist/cli/commands/workflow.js +22 -2
- package/dist/cli/commands/workflow.js.map +1 -1
- package/dist/cli/config-loader.d.ts.map +1 -1
- package/dist/cli/config-loader.js +3 -2
- package/dist/cli/config-loader.js.map +1 -1
- package/dist/cli/contract-checker.d.ts +33 -0
- package/dist/cli/contract-checker.d.ts.map +1 -0
- package/dist/cli/contract-checker.js +719 -0
- package/dist/cli/contract-checker.js.map +1 -0
- package/dist/cli/contract-diff-scope.d.ts +14 -0
- package/dist/cli/contract-diff-scope.d.ts.map +1 -0
- package/dist/cli/contract-diff-scope.js +127 -0
- package/dist/cli/contract-diff-scope.js.map +1 -0
- package/dist/cli/contract-gate-thresholds.d.ts +14 -0
- package/dist/cli/contract-gate-thresholds.d.ts.map +1 -0
- package/dist/cli/contract-gate-thresholds.js +19 -0
- package/dist/cli/contract-gate-thresholds.js.map +1 -0
- package/dist/cli/design-contract-loader.d.ts +15 -0
- package/dist/cli/design-contract-loader.d.ts.map +1 -0
- package/dist/cli/design-contract-loader.js +527 -0
- package/dist/cli/design-contract-loader.js.map +1 -0
- package/dist/cli/design-contract-schema.d.ts +11 -0
- package/dist/cli/design-contract-schema.d.ts.map +1 -0
- package/dist/cli/design-contract-schema.js +75 -0
- package/dist/cli/design-contract-schema.js.map +1 -0
- package/dist/cli/design-handoff-builder.d.ts +15 -0
- package/dist/cli/design-handoff-builder.d.ts.map +1 -0
- package/dist/cli/design-handoff-builder.js +345 -0
- package/dist/cli/design-handoff-builder.js.map +1 -0
- package/dist/cli/design-scope-resolver.d.ts +8 -0
- package/dist/cli/design-scope-resolver.d.ts.map +1 -0
- package/dist/cli/design-scope-resolver.js +760 -0
- package/dist/cli/design-scope-resolver.js.map +1 -0
- package/dist/cli/design-verification-builder.d.ts +8 -0
- package/dist/cli/design-verification-builder.d.ts.map +1 -0
- package/dist/cli/design-verification-builder.js +369 -0
- package/dist/cli/design-verification-builder.js.map +1 -0
- package/dist/cli/index.js +20 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/paths.d.ts.map +1 -1
- package/dist/cli/paths.js +30 -7
- package/dist/cli/paths.js.map +1 -1
- package/dist/cli-new/commands/server.d.ts +13 -0
- package/dist/cli-new/commands/server.d.ts.map +1 -0
- package/dist/cli-new/commands/server.js +90 -0
- package/dist/cli-new/commands/server.js.map +1 -0
- package/dist/core/analyzer.d.ts.map +1 -1
- package/dist/core/analyzer.js +16 -0
- package/dist/core/analyzer.js.map +1 -1
- package/dist/domain/entities/CodeGraph.d.ts +5 -1
- package/dist/domain/entities/CodeGraph.d.ts.map +1 -1
- package/dist/domain/entities/CodeGraph.js +29 -12
- package/dist/domain/entities/CodeGraph.js.map +1 -1
- package/dist/domain/entities/Dependency.d.ts +8 -1
- package/dist/domain/entities/Dependency.d.ts.map +1 -1
- package/dist/domain/entities/Dependency.js +19 -4
- package/dist/domain/entities/Dependency.js.map +1 -1
- package/dist/domain/entities/Symbol.d.ts +2 -1
- package/dist/domain/entities/Symbol.d.ts.map +1 -1
- package/dist/domain/entities/Symbol.js +6 -3
- package/dist/domain/entities/Symbol.js.map +1 -1
- package/dist/generator/ai-overview.d.ts +51 -0
- package/dist/generator/ai-overview.d.ts.map +1 -0
- package/dist/generator/ai-overview.js +160 -0
- package/dist/generator/ai-overview.js.map +1 -0
- package/dist/infrastructure/storage/StorageFactory.d.ts +13 -5
- package/dist/infrastructure/storage/StorageFactory.d.ts.map +1 -1
- package/dist/infrastructure/storage/StorageFactory.js +62 -16
- package/dist/infrastructure/storage/StorageFactory.js.map +1 -1
- package/dist/infrastructure/storage/adapters/FileSystemStorage.d.ts +3 -1
- package/dist/infrastructure/storage/adapters/FileSystemStorage.d.ts.map +1 -1
- package/dist/infrastructure/storage/adapters/FileSystemStorage.js +10 -2
- package/dist/infrastructure/storage/adapters/FileSystemStorage.js.map +1 -1
- package/dist/infrastructure/storage/adapters/KuzuDBStorage.d.ts +3 -1
- package/dist/infrastructure/storage/adapters/KuzuDBStorage.d.ts.map +1 -1
- package/dist/infrastructure/storage/adapters/KuzuDBStorage.js +9 -1
- package/dist/infrastructure/storage/adapters/KuzuDBStorage.js.map +1 -1
- package/dist/infrastructure/storage/adapters/MemoryStorage.d.ts +3 -1
- package/dist/infrastructure/storage/adapters/MemoryStorage.d.ts.map +1 -1
- package/dist/infrastructure/storage/adapters/MemoryStorage.js +9 -1
- package/dist/infrastructure/storage/adapters/MemoryStorage.js.map +1 -1
- package/dist/infrastructure/storage/adapters/Neo4jStorage.d.ts +41 -0
- package/dist/infrastructure/storage/adapters/Neo4jStorage.d.ts.map +1 -0
- package/dist/infrastructure/storage/adapters/Neo4jStorage.js +162 -0
- package/dist/infrastructure/storage/adapters/Neo4jStorage.js.map +1 -0
- package/dist/infrastructure/storage/adapters/SQLiteStorage.d.ts +53 -0
- package/dist/infrastructure/storage/adapters/SQLiteStorage.d.ts.map +1 -0
- package/dist/infrastructure/storage/adapters/SQLiteStorage.js +879 -0
- package/dist/infrastructure/storage/adapters/SQLiteStorage.js.map +1 -0
- package/dist/infrastructure/storage/graph-helpers.d.ts +3 -1
- package/dist/infrastructure/storage/graph-helpers.d.ts.map +1 -1
- package/dist/infrastructure/storage/graph-helpers.js +90 -0
- package/dist/infrastructure/storage/graph-helpers.js.map +1 -1
- package/dist/infrastructure/storage/index.d.ts +1 -1
- package/dist/infrastructure/storage/index.d.ts.map +1 -1
- package/dist/infrastructure/storage/interfaces/StorageBase.d.ts +3 -1
- package/dist/infrastructure/storage/interfaces/StorageBase.d.ts.map +1 -1
- package/dist/infrastructure/storage/interfaces/StorageBase.js.map +1 -1
- package/dist/infrastructure/storage/sqlite/GovernanceGraphCache.d.ts +27 -0
- package/dist/infrastructure/storage/sqlite/GovernanceGraphCache.d.ts.map +1 -0
- package/dist/infrastructure/storage/sqlite/GovernanceGraphCache.js +246 -0
- package/dist/infrastructure/storage/sqlite/GovernanceGraphCache.js.map +1 -0
- package/dist/infrastructure/storage/sqlite/perf-thresholds.d.ts +25 -0
- package/dist/infrastructure/storage/sqlite/perf-thresholds.d.ts.map +1 -0
- package/dist/infrastructure/storage/sqlite/perf-thresholds.js +25 -0
- package/dist/infrastructure/storage/sqlite/perf-thresholds.js.map +1 -0
- package/dist/infrastructure/storage/sqlite/schema.d.ts +4 -0
- package/dist/infrastructure/storage/sqlite/schema.d.ts.map +1 -0
- package/dist/infrastructure/storage/sqlite/schema.js +111 -0
- package/dist/infrastructure/storage/sqlite/schema.js.map +1 -0
- package/dist/interface/types/design-check.d.ts +73 -0
- package/dist/interface/types/design-check.d.ts.map +1 -0
- package/dist/interface/types/design-check.js +4 -0
- package/dist/interface/types/design-check.js.map +1 -0
- package/dist/interface/types/design-contract.d.ts +123 -0
- package/dist/interface/types/design-contract.d.ts.map +1 -0
- package/dist/interface/types/design-contract.js +7 -0
- package/dist/interface/types/design-contract.js.map +1 -0
- package/dist/interface/types/design-handoff.d.ts +68 -0
- package/dist/interface/types/design-handoff.d.ts.map +1 -0
- package/dist/interface/types/design-handoff.js +4 -0
- package/dist/interface/types/design-handoff.js.map +1 -0
- package/dist/interface/types/design-mapping.d.ts +51 -0
- package/dist/interface/types/design-mapping.d.ts.map +1 -0
- package/dist/interface/types/design-mapping.js +4 -0
- package/dist/interface/types/design-mapping.js.map +1 -0
- package/dist/interface/types/design-verification.d.ts +49 -0
- package/dist/interface/types/design-verification.d.ts.map +1 -0
- package/dist/interface/types/design-verification.js +4 -0
- package/dist/interface/types/design-verification.js.map +1 -0
- package/dist/interface/types/history-risk.d.ts +90 -0
- package/dist/interface/types/history-risk.d.ts.map +1 -0
- package/dist/interface/types/history-risk.js +4 -0
- package/dist/interface/types/history-risk.js.map +1 -0
- package/dist/interface/types/index.d.ts +20 -1
- package/dist/interface/types/index.d.ts.map +1 -1
- package/dist/interface/types/storage.d.ts +28 -1
- package/dist/interface/types/storage.d.ts.map +1 -1
- package/dist/orchestrator/adapters/ast-grep-adapter.d.ts +10 -0
- package/dist/orchestrator/adapters/ast-grep-adapter.d.ts.map +1 -1
- package/dist/orchestrator/adapters/ast-grep-adapter.js +46 -17
- package/dist/orchestrator/adapters/ast-grep-adapter.js.map +1 -1
- package/dist/orchestrator/adapters/codemap-adapter.d.ts.map +1 -1
- package/dist/orchestrator/adapters/codemap-adapter.js +2 -22
- package/dist/orchestrator/adapters/codemap-adapter.js.map +1 -1
- package/dist/orchestrator/ai-feed-generator.d.ts +210 -0
- package/dist/orchestrator/ai-feed-generator.d.ts.map +1 -0
- package/dist/orchestrator/ai-feed-generator.js +377 -0
- package/dist/orchestrator/ai-feed-generator.js.map +1 -0
- package/dist/orchestrator/history-risk-service.d.ts +55 -0
- package/dist/orchestrator/history-risk-service.d.ts.map +1 -0
- package/dist/orchestrator/history-risk-service.js +680 -0
- package/dist/orchestrator/history-risk-service.js.map +1 -0
- package/dist/orchestrator/types.d.ts +19 -1
- package/dist/orchestrator/types.d.ts.map +1 -1
- package/dist/orchestrator/types.js +19 -0
- package/dist/orchestrator/types.js.map +1 -1
- package/dist/server/mcp/index.d.ts +4 -0
- package/dist/server/mcp/index.d.ts.map +1 -0
- package/dist/server/mcp/index.js +5 -0
- package/dist/server/mcp/index.js.map +1 -0
- package/dist/server/mcp/server.d.ts +17 -0
- package/dist/server/mcp/server.d.ts.map +1 -0
- package/dist/server/mcp/server.js +84 -0
- package/dist/server/mcp/server.js.map +1 -0
- package/dist/server/mcp/service.d.ts +22 -0
- package/dist/server/mcp/service.d.ts.map +1 -0
- package/dist/server/mcp/service.js +177 -0
- package/dist/server/mcp/service.js.map +1 -0
- package/dist/server/mcp/types.d.ts +56 -0
- package/dist/server/mcp/types.d.ts.map +1 -0
- package/dist/server/mcp/types.js +4 -0
- package/dist/server/mcp/types.js.map +1 -0
- package/docs/AI_ASSISTANT_SETUP.md +1 -1
- package/docs/SETUP_GUIDE.md +6 -6
- package/docs/ai-guide/COMMANDS.md +171 -4
- package/docs/ai-guide/INTEGRATION.md +137 -433
- package/docs/ai-guide/OUTPUT.md +890 -5
- package/docs/ai-guide/PATTERNS.md +54 -14
- package/docs/ai-guide/PROMPTS.md +17 -6
- package/docs/archive/test-report-symbol-search.md +384 -0
- package/docs/archive/test-scenario-4-complexity-analysis.md +460 -0
- package/docs/archive/test_report_scenario5.md +615 -0
- package/docs/archive/test_scenario_3_impact_analysis_report.md +520 -0
- package/docs/backlog.md +177 -0
- package/docs/eatdogfood-reports/2026-04-17-eatdogfood-agent-experience.md +231 -0
- package/docs/exec-plans/completed/2026-04-17-eatdogfood-codemap-cli.md +103 -0
- package/docs/ideation/2026-04-15-executable-architecture-constitution-ideation.md +102 -0
- package/docs/product-specs/DESIGN_CONTRACT_TEMPLATE.md +126 -0
- package/docs/product-specs/MVP3-ARCHITECTURE-COMPARISON.md +11 -10
- package/docs/product-specs/MVP3-ARCHITECTURE-REDESIGN-PRD.md +10 -10
- package/docs/product-specs/MVP3-ARCHITECTURE-REDESIGN-TECH-PRD.md +17 -12
- package/docs/product-specs/README.md +2 -1
- package/docs/rules/README.md +16 -11
- package/docs/rules/architecture-guardrails.md +24 -336
- package/docs/rules/code-quality-redlines.md +25 -311
- package/docs/rules/engineering-with-codex-openai.md +20 -3
- package/docs/rules/validation.md +90 -37
- package/mycodemap.config.schema.json +3 -3
- package/package.json +7 -2
- package/scripts/benchmark-governance-graph.mjs +132 -0
- package/scripts/calibrate-contract-gate.mjs +221 -0
- package/scripts/capability-report.py +255 -0
- package/scripts/experiments/arcadedb-http-smoke.mjs +90 -0
- package/scripts/qa-rule-control.sh +254 -0
- package/scripts/report-high-risk-files.mjs +395 -0
- package/scripts/rule-context.mjs +155 -0
- package/scripts/smoke-sqlite-impact.mjs +85 -0
- package/scripts/sync-analyze-docs.js +1 -0
- package/scripts/tests/test_capability_report.py +89 -0
- package/scripts/tests/test_rule_control_workflow.py +51 -0
- package/scripts/tests/test_validate_rules.py +81 -0
- package/scripts/validate-ai-docs.js +283 -1
- package/scripts/validate-docs.js +479 -25
- package/scripts/validate-rules.py +254 -0
package/scripts/validate-docs.js
CHANGED
|
@@ -195,17 +195,8 @@ function validateAnalyzeDocs(rootDir, failures) {
|
|
|
195
195
|
failures
|
|
196
196
|
);
|
|
197
197
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
'CLAUDE.md analyze retrieval guidance',
|
|
201
|
-
[
|
|
202
|
-
'node dist/cli/index.js analyze -i <find|read|link|show>'
|
|
203
|
-
],
|
|
204
|
-
[
|
|
205
|
-
'node dist/cli/index.js analyze <intent>'
|
|
206
|
-
],
|
|
207
|
-
failures
|
|
208
|
-
);
|
|
198
|
+
// NOTE: CLAUDE.md 已演进为执行手册(路由层),analyze 命令指南已移至 AI_GUIDE.md / docs/ai-guide/
|
|
199
|
+
// 相关检查已下放至 AI_GUIDE.md 与 docs/ai-guide/*.md 的 validateSnippets 中
|
|
209
200
|
|
|
210
201
|
validateSnippets(
|
|
211
202
|
engineeringGuide,
|
|
@@ -226,6 +217,432 @@ function validateAnalyzeDocs(rootDir, failures) {
|
|
|
226
217
|
failures.push(...collectAnalyzeDocSyncFailures(rootDir));
|
|
227
218
|
}
|
|
228
219
|
|
|
220
|
+
function validateHistoryRiskDocs(rootDir, failures) {
|
|
221
|
+
const readme = readText(rootDir, 'README.md', failures);
|
|
222
|
+
const aiGuide = readText(rootDir, 'AI_GUIDE.md', failures);
|
|
223
|
+
const claudeGuide = readText(rootDir, 'CLAUDE.md', failures);
|
|
224
|
+
const commandsGuide = readText(rootDir, 'docs/ai-guide/COMMANDS.md', failures);
|
|
225
|
+
const outputGuide = readText(rootDir, 'docs/ai-guide/OUTPUT.md', failures);
|
|
226
|
+
const validationRule = readText(rootDir, 'docs/rules/validation.md', failures);
|
|
227
|
+
const cliIndexSource = readText(rootDir, 'src/cli/index.ts', failures);
|
|
228
|
+
const historyCommandSource = readText(rootDir, 'src/cli/commands/history.ts', failures);
|
|
229
|
+
|
|
230
|
+
if (cliIndexSource) {
|
|
231
|
+
expectIncludes(cliIndexSource, 'program.addCommand(historyCommand);', 'src/cli/index.ts history command registration', failures);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (historyCommandSource) {
|
|
235
|
+
validateSnippets(
|
|
236
|
+
historyCommandSource,
|
|
237
|
+
'src/cli/commands/history.ts command surface',
|
|
238
|
+
[
|
|
239
|
+
"new Command('history')",
|
|
240
|
+
".requiredOption('--symbol <name>'",
|
|
241
|
+
".option('--human'",
|
|
242
|
+
],
|
|
243
|
+
[],
|
|
244
|
+
failures
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
if (readme) {
|
|
249
|
+
validateSnippets(
|
|
250
|
+
readme,
|
|
251
|
+
'README.md history risk baseline',
|
|
252
|
+
[
|
|
253
|
+
'# 查询某个符号的历史轨迹与风险摘要\nmycodemap history --symbol createCheckCommand',
|
|
254
|
+
'### `mycodemap history`\n\n符号级 Git history / risk 查询:\n\n```bash\n# 默认输出 machine-first JSON\nmycodemap history --symbol createCheckCommand',
|
|
255
|
+
'`--include-git-history` 现在只会在 `read` intent 上附加统一的 Git history enrichment;其他 intent 会显式给出 warning,而不是 silent noop。',
|
|
256
|
+
'`ci assess-risk` 现在输出 `status/confidence/freshness/source` 与统一 risk level;若 Git history 不可用,会显式打印 `unavailable` / warning,并说明阈值未被应用。'
|
|
257
|
+
],
|
|
258
|
+
[],
|
|
259
|
+
failures
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (aiGuide) {
|
|
264
|
+
validateSnippets(
|
|
265
|
+
aiGuide,
|
|
266
|
+
'AI_GUIDE.md history risk baseline',
|
|
267
|
+
[
|
|
268
|
+
'`history --symbol <name>`',
|
|
269
|
+
'`check` / `ci assess-risk` / `history` 现在共用同一套 Git history risk truth;history unavailable 时会显式给出 `unavailable` / `confidence=low`',
|
|
270
|
+
'interface HistoryCommandResult {'
|
|
271
|
+
],
|
|
272
|
+
[],
|
|
273
|
+
failures
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// NOTE: CLAUDE.md 已演进为执行手册(路由层),history 风险基线已移至 AI_GUIDE.md / docs/ai-guide/
|
|
278
|
+
// 相关检查已下放至 AI_GUIDE.md 与 docs/ai-guide/*.md 的 validateSnippets 中
|
|
279
|
+
|
|
280
|
+
if (commandsGuide) {
|
|
281
|
+
validateSnippets(
|
|
282
|
+
commandsGuide,
|
|
283
|
+
'docs/ai-guide/COMMANDS.md history risk baseline',
|
|
284
|
+
[
|
|
285
|
+
'## history - 符号级 Git history / risk 查询',
|
|
286
|
+
'Git history risk 是 additive enrichment:会附加 `violations[].risk` 与顶层 `history`,但不会改变 `severity:error` / exit 语义',
|
|
287
|
+
'`ci assess-risk` 现在输出 `status / confidence / freshness / source / score / level`'
|
|
288
|
+
],
|
|
289
|
+
[],
|
|
290
|
+
failures
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (outputGuide) {
|
|
295
|
+
validateSnippets(
|
|
296
|
+
outputGuide,
|
|
297
|
+
'docs/ai-guide/OUTPUT.md history risk baseline',
|
|
298
|
+
[
|
|
299
|
+
'interface HistoryCommandResult {',
|
|
300
|
+
'Git history risk 是 additive enrichment:它补充 `history` 与 `violations[].risk`',
|
|
301
|
+
'"git-history-unsupported-intent"'
|
|
302
|
+
],
|
|
303
|
+
[],
|
|
304
|
+
failures
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (validationRule) {
|
|
309
|
+
validateSnippets(
|
|
310
|
+
validationRule,
|
|
311
|
+
'docs/rules/validation.md history risk baseline',
|
|
312
|
+
[
|
|
313
|
+
'`check` / `ci assess-risk` / `history` / `analyze --include-git-history` 的统一 risk truth',
|
|
314
|
+
'node dist/cli/index.js history --symbol createCheckCommand',
|
|
315
|
+
'node scripts/report-high-risk-files.mjs --top 3'
|
|
316
|
+
],
|
|
317
|
+
[],
|
|
318
|
+
failures
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
function validateDesignContractDocs(rootDir, failures) {
|
|
324
|
+
const readme = readText(rootDir, 'README.md', failures);
|
|
325
|
+
const aiGuide = readText(rootDir, 'AI_GUIDE.md', failures);
|
|
326
|
+
const claudeGuide = readText(rootDir, 'CLAUDE.md', failures);
|
|
327
|
+
const commandsGuide = readText(rootDir, 'docs/ai-guide/COMMANDS.md', failures);
|
|
328
|
+
const outputGuide = readText(rootDir, 'docs/ai-guide/OUTPUT.md', failures);
|
|
329
|
+
const patternsGuide = readText(rootDir, 'docs/ai-guide/PATTERNS.md', failures);
|
|
330
|
+
const promptsGuide = readText(rootDir, 'docs/ai-guide/PROMPTS.md', failures);
|
|
331
|
+
const engineeringGuide = readText(rootDir, 'docs/rules/engineering-with-codex-openai.md', failures);
|
|
332
|
+
const validationRule = readText(rootDir, 'docs/rules/validation.md', failures);
|
|
333
|
+
const productSpecsReadme = readText(rootDir, 'docs/product-specs/README.md', failures);
|
|
334
|
+
const designTemplate = readText(rootDir, 'docs/product-specs/DESIGN_CONTRACT_TEMPLATE.md', failures);
|
|
335
|
+
const cliIndexSource = readText(rootDir, 'src/cli/index.ts', failures);
|
|
336
|
+
const designCommandSource = readText(rootDir, 'src/cli/commands/design.ts', failures);
|
|
337
|
+
const checkCommandSource = readText(rootDir, 'src/cli/commands/check.ts', failures);
|
|
338
|
+
const repoContract = readText(rootDir, 'mycodemap.design.md', failures);
|
|
339
|
+
|
|
340
|
+
if (cliIndexSource) {
|
|
341
|
+
expectIncludes(cliIndexSource, 'program.addCommand(designCommand);', 'src/cli/index.ts design command registration', failures);
|
|
342
|
+
expectIncludes(cliIndexSource, 'program.addCommand(checkCommand);', 'src/cli/index.ts check command registration', failures);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
if (designCommandSource) {
|
|
346
|
+
validateSnippets(
|
|
347
|
+
designCommandSource,
|
|
348
|
+
'src/cli/commands/design.ts command surface',
|
|
349
|
+
[
|
|
350
|
+
"new Command('design')",
|
|
351
|
+
".command('validate')",
|
|
352
|
+
".command('map')",
|
|
353
|
+
".command('handoff')",
|
|
354
|
+
".command('verify')",
|
|
355
|
+
'renderDesignMappingResult',
|
|
356
|
+
'renderDesignVerificationResult',
|
|
357
|
+
'runDesignHandoff',
|
|
358
|
+
'runDesignVerify',
|
|
359
|
+
'DEFAULT_DESIGN_CONTRACT_PATH',
|
|
360
|
+
'JSON 格式输出'
|
|
361
|
+
],
|
|
362
|
+
[],
|
|
363
|
+
failures
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
if (checkCommandSource) {
|
|
368
|
+
validateSnippets(
|
|
369
|
+
checkCommandSource,
|
|
370
|
+
'src/cli/commands/check.ts command surface',
|
|
371
|
+
[
|
|
372
|
+
"new Command('check')",
|
|
373
|
+
"--contract <file>",
|
|
374
|
+
"--against <path>",
|
|
375
|
+
'--base <git-ref>',
|
|
376
|
+
'--changed-files <paths...>',
|
|
377
|
+
'--annotation-format <format>',
|
|
378
|
+
'--annotation-file <file>',
|
|
379
|
+
'resolveContractDiffScope',
|
|
380
|
+
'runContractCheck',
|
|
381
|
+
'renderGitHubAnnotations',
|
|
382
|
+
'renderGitLabAnnotations',
|
|
383
|
+
],
|
|
384
|
+
[],
|
|
385
|
+
failures
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
if (readme) {
|
|
390
|
+
validateSnippets(
|
|
391
|
+
readme,
|
|
392
|
+
'README.md design contract baseline',
|
|
393
|
+
[
|
|
394
|
+
'mycodemap design validate mycodemap.design.md --json',
|
|
395
|
+
'mycodemap design map mycodemap.design.md --json',
|
|
396
|
+
'mycodemap design handoff mycodemap.design.md --json',
|
|
397
|
+
'mycodemap design verify mycodemap.design.md --json',
|
|
398
|
+
'mycodemap check --contract mycodemap.design.md --against src',
|
|
399
|
+
'--annotation-format github',
|
|
400
|
+
'--annotation-format gitlab --annotation-file gl-code-quality-report.json',
|
|
401
|
+
'node scripts/calibrate-contract-gate.mjs --max-changed-files 10 --max-false-positive-rate 0.10',
|
|
402
|
+
'changed files <= 10',
|
|
403
|
+
'warn-only / fallback',
|
|
404
|
+
'false-positive rate >10%',
|
|
405
|
+
'docs/product-specs/DESIGN_CONTRACT_TEMPLATE.md',
|
|
406
|
+
'`mycodemap.design.md`',
|
|
407
|
+
'`design validate → design map → design handoff → design verify`'
|
|
408
|
+
],
|
|
409
|
+
[],
|
|
410
|
+
failures
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
if (aiGuide) {
|
|
415
|
+
validateSnippets(
|
|
416
|
+
aiGuide,
|
|
417
|
+
'AI_GUIDE.md design contract baseline',
|
|
418
|
+
[
|
|
419
|
+
'design validate mycodemap.design.md --json',
|
|
420
|
+
'design map mycodemap.design.md --json',
|
|
421
|
+
'design handoff mycodemap.design.md --json',
|
|
422
|
+
'design verify mycodemap.design.md --json',
|
|
423
|
+
'check --contract mycodemap.design.md --against src',
|
|
424
|
+
'--annotation-format github',
|
|
425
|
+
'node scripts/calibrate-contract-gate.mjs --max-changed-files 10 --max-false-positive-rate 0.10',
|
|
426
|
+
'changed files <= 10',
|
|
427
|
+
'warn-only / fallback',
|
|
428
|
+
'`mycodemap.design.md`',
|
|
429
|
+
'interface DesignValidateOutput {',
|
|
430
|
+
'interface DesignMapOutput {',
|
|
431
|
+
'interface DesignHandoffOutput {',
|
|
432
|
+
'interface DesignVerificationOutput {',
|
|
433
|
+
'interface ContractCheckResult {'
|
|
434
|
+
],
|
|
435
|
+
[],
|
|
436
|
+
failures
|
|
437
|
+
);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// NOTE: CLAUDE.md 已演进为执行手册(路由层),design 检索指南已移至 AI_GUIDE.md / docs/ai-guide/
|
|
441
|
+
// 相关检查已下放至 AI_GUIDE.md 与 docs/ai-guide/*.md 的 validateSnippets 中
|
|
442
|
+
|
|
443
|
+
if (commandsGuide) {
|
|
444
|
+
validateSnippets(
|
|
445
|
+
commandsGuide,
|
|
446
|
+
'docs/ai-guide/COMMANDS.md design contract baseline',
|
|
447
|
+
[
|
|
448
|
+
'## design - 设计契约输入、范围映射与验证',
|
|
449
|
+
'mycodemap design validate mycodemap.design.md --json',
|
|
450
|
+
'mycodemap design map mycodemap.design.md --json',
|
|
451
|
+
'mycodemap design handoff mycodemap.design.md --json',
|
|
452
|
+
'mycodemap design verify mycodemap.design.md --json',
|
|
453
|
+
'## check - 执行 contract gate',
|
|
454
|
+
'mycodemap check --contract mycodemap.design.md --against src',
|
|
455
|
+
'mycodemap check --contract mycodemap.design.md --against src --base origin/main',
|
|
456
|
+
'--annotation-format github',
|
|
457
|
+
'--annotation-format gitlab --annotation-file gl-code-quality-report.json',
|
|
458
|
+
'node scripts/calibrate-contract-gate.mjs --max-changed-files 10 --max-false-positive-rate 0.10',
|
|
459
|
+
'changed files <= 10',
|
|
460
|
+
'warn-only / fallback',
|
|
461
|
+
'`mycodemap.design.md`',
|
|
462
|
+
'### 必填 sections',
|
|
463
|
+
'### map',
|
|
464
|
+
'### handoff',
|
|
465
|
+
'### verify',
|
|
466
|
+
'no-candidates'
|
|
467
|
+
],
|
|
468
|
+
[],
|
|
469
|
+
failures
|
|
470
|
+
);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
if (outputGuide) {
|
|
474
|
+
validateSnippets(
|
|
475
|
+
outputGuide,
|
|
476
|
+
'docs/ai-guide/OUTPUT.md design validate schema',
|
|
477
|
+
[
|
|
478
|
+
'## design validate 命令输出结构',
|
|
479
|
+
'## check 命令输出结构',
|
|
480
|
+
'## design map 命令输出结构',
|
|
481
|
+
'## design handoff 命令输出结构',
|
|
482
|
+
'## design verify 命令输出结构',
|
|
483
|
+
'type DesignContractDiagnosticCode =',
|
|
484
|
+
'interface DesignValidateOutput {',
|
|
485
|
+
'interface DesignMapOutput {',
|
|
486
|
+
'interface DesignHandoffOutput {',
|
|
487
|
+
'interface DesignVerificationOutput {',
|
|
488
|
+
'interface ContractCheckResult {',
|
|
489
|
+
'details?: Record<string, string | number | boolean | null>;',
|
|
490
|
+
'rule_type: "layer_direction" | "forbidden_imports" | "module_public_api_only" | "complexity_threshold";',
|
|
491
|
+
'diagnostic?: {',
|
|
492
|
+
'scope: "line" | "file" | "general";',
|
|
493
|
+
'category: "dependency" | "module_boundary" | "complexity";',
|
|
494
|
+
'Annotation-friendly diagnostics',
|
|
495
|
+
'gl-code-quality-report.json',
|
|
496
|
+
'warn-only / fallback',
|
|
497
|
+
'unknowns: string[];',
|
|
498
|
+
'diagnostics: DesignMappingDiagnostic[];',
|
|
499
|
+
'readyForExecution: boolean;',
|
|
500
|
+
'approvals: Array<DesignHandoffTraceItem & {',
|
|
501
|
+
'assumptions: DesignHandoffTraceItem[];',
|
|
502
|
+
'openQuestions: DesignHandoffTraceItem[];',
|
|
503
|
+
'type DesignVerificationStatus =',
|
|
504
|
+
'type DesignDriftKind =',
|
|
505
|
+
'"scan_mode": "diff"',
|
|
506
|
+
'"rule_type": "layer_direction"',
|
|
507
|
+
'"code": "hard-gate-window-exceeded"',
|
|
508
|
+
'checklist: Array<{',
|
|
509
|
+
'drift: Array<{',
|
|
510
|
+
'"code": "handoff-missing"',
|
|
511
|
+
'"code": "missing-section"',
|
|
512
|
+
'"code": "high-risk-scope"',
|
|
513
|
+
'"code": "review-required"'
|
|
514
|
+
],
|
|
515
|
+
[],
|
|
516
|
+
failures
|
|
517
|
+
);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
if (patternsGuide) {
|
|
521
|
+
validateSnippets(
|
|
522
|
+
patternsGuide,
|
|
523
|
+
'docs/ai-guide/PATTERNS.md design/workflow baseline',
|
|
524
|
+
[
|
|
525
|
+
'node dist/cli/index.js design validate mycodemap.design.md --json',
|
|
526
|
+
'node dist/cli/index.js design map mycodemap.design.md --json',
|
|
527
|
+
'node dist/cli/index.js design handoff mycodemap.design.md --json',
|
|
528
|
+
'node dist/cli/index.js design verify mycodemap.design.md --json',
|
|
529
|
+
'node scripts/calibrate-contract-gate.mjs --max-changed-files 10 --max-false-positive-rate 0.10',
|
|
530
|
+
'node dist/cli/index.js check --contract mycodemap.design.md --against src --base origin/main --annotation-format github',
|
|
531
|
+
'--annotation-format gitlab --annotation-file gl-code-quality-report.json',
|
|
532
|
+
'changed files <= 10',
|
|
533
|
+
'warn-only / fallback',
|
|
534
|
+
'`design validate → design map → design handoff → design verify`',
|
|
535
|
+
'`workflow` 仍只保留 `find` / `read` / `link` / `show` 四阶段'
|
|
536
|
+
],
|
|
537
|
+
[
|
|
538
|
+
'5. `commit` - 提交验证',
|
|
539
|
+
'6. `ci` - CI 验证'
|
|
540
|
+
],
|
|
541
|
+
failures
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
if (promptsGuide) {
|
|
546
|
+
validateSnippets(
|
|
547
|
+
promptsGuide,
|
|
548
|
+
'docs/ai-guide/PROMPTS.md design contract prompt',
|
|
549
|
+
[
|
|
550
|
+
'cp docs/product-specs/DESIGN_CONTRACT_TEMPLATE.md mycodemap.design.md',
|
|
551
|
+
'node dist/cli/index.js design validate mycodemap.design.md --json',
|
|
552
|
+
'node dist/cli/index.js check --contract mycodemap.design.md --against src'
|
|
553
|
+
],
|
|
554
|
+
[],
|
|
555
|
+
failures
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
if (engineeringGuide) {
|
|
560
|
+
validateSnippets(
|
|
561
|
+
engineeringGuide,
|
|
562
|
+
'docs/rules/engineering-with-codex-openai.md design command guardrail',
|
|
563
|
+
[
|
|
564
|
+
'`node dist/cli/index.js design validate mycodemap.design.md --json`',
|
|
565
|
+
'`node dist/cli/index.js design map mycodemap.design.md --json`',
|
|
566
|
+
'`node dist/cli/index.js design handoff mycodemap.design.md --json`',
|
|
567
|
+
'`node dist/cli/index.js design verify mycodemap.design.md --json`',
|
|
568
|
+
'`node dist/cli/index.js check --contract mycodemap.design.md --against src`',
|
|
569
|
+
'`candidates` / `unknowns` / `diagnostics`',
|
|
570
|
+
'`readyForExecution` / `approvals` / `assumptions` / `openQuestions`',
|
|
571
|
+
'`checklist` / `drift` / `diagnostics` / `readyForExecution`',
|
|
572
|
+
'`docs/product-specs/DESIGN_CONTRACT_TEMPLATE.md`'
|
|
573
|
+
],
|
|
574
|
+
[],
|
|
575
|
+
failures
|
|
576
|
+
);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
if (productSpecsReadme) {
|
|
580
|
+
validateSnippets(
|
|
581
|
+
productSpecsReadme,
|
|
582
|
+
'docs/product-specs/README.md design template index',
|
|
583
|
+
[
|
|
584
|
+
'`DESIGN_CONTRACT_TEMPLATE.md`'
|
|
585
|
+
],
|
|
586
|
+
[],
|
|
587
|
+
failures
|
|
588
|
+
);
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
if (validationRule) {
|
|
592
|
+
validateSnippets(
|
|
593
|
+
validationRule,
|
|
594
|
+
'docs/rules/validation.md design verification baseline',
|
|
595
|
+
[
|
|
596
|
+
'`design validate` / `design map` / `design handoff` / `design verify`',
|
|
597
|
+
'`check --contract mycodemap.design.md --against src`',
|
|
598
|
+
'`design validate → design map → design handoff → design verify`',
|
|
599
|
+
'design verify mycodemap.design.md --json',
|
|
600
|
+
'review-needed 与 blocker 退出语义',
|
|
601
|
+
'github.event.pull_request.base.sha'
|
|
602
|
+
],
|
|
603
|
+
[],
|
|
604
|
+
failures
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
if (designTemplate) {
|
|
609
|
+
validateSnippets(
|
|
610
|
+
designTemplate,
|
|
611
|
+
'docs/product-specs/DESIGN_CONTRACT_TEMPLATE.md',
|
|
612
|
+
[
|
|
613
|
+
'保存为 `mycodemap.design.md`',
|
|
614
|
+
'rules:',
|
|
615
|
+
'type: layer_direction',
|
|
616
|
+
'## Goal',
|
|
617
|
+
'## Constraints',
|
|
618
|
+
'## Acceptance Criteria',
|
|
619
|
+
'## Non-Goals'
|
|
620
|
+
],
|
|
621
|
+
[],
|
|
622
|
+
failures
|
|
623
|
+
);
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
if (repoContract) {
|
|
627
|
+
validateSnippets(
|
|
628
|
+
repoContract,
|
|
629
|
+
'mycodemap.design.md repo-root contract',
|
|
630
|
+
[
|
|
631
|
+
'rules:',
|
|
632
|
+
'type: layer_direction',
|
|
633
|
+
'from: "src/core/**"',
|
|
634
|
+
'to: "src/cli/**"',
|
|
635
|
+
'## Goal',
|
|
636
|
+
'## Constraints',
|
|
637
|
+
'## Acceptance Criteria',
|
|
638
|
+
'## Non-Goals'
|
|
639
|
+
],
|
|
640
|
+
[],
|
|
641
|
+
failures
|
|
642
|
+
);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
|
|
229
646
|
function validatePositioningBaselineDocs(rootDir, failures) {
|
|
230
647
|
const readme = readText(rootDir, 'README.md', failures);
|
|
231
648
|
const aiGuide = readText(rootDir, 'AI_GUIDE.md', failures);
|
|
@@ -525,6 +942,7 @@ function validatePluginRuntimeDocs(rootDir, failures) {
|
|
|
525
942
|
function validateGraphStorageDocs(rootDir, failures) {
|
|
526
943
|
const readme = readText(rootDir, 'README.md', failures);
|
|
527
944
|
const aiGuide = readText(rootDir, 'AI_GUIDE.md', failures);
|
|
945
|
+
const claudeGuide = readText(rootDir, 'CLAUDE.md', failures);
|
|
528
946
|
const commandsGuide = readText(rootDir, 'docs/ai-guide/COMMANDS.md', failures);
|
|
529
947
|
const quickstartGuide = readText(rootDir, 'docs/ai-guide/QUICKSTART.md', failures);
|
|
530
948
|
const setupGuide = readText(rootDir, 'docs/SETUP_GUIDE.md', failures);
|
|
@@ -537,8 +955,9 @@ function validateGraphStorageDocs(rootDir, failures) {
|
|
|
537
955
|
'README.md graph storage contract',
|
|
538
956
|
[
|
|
539
957
|
'"storage": {',
|
|
540
|
-
'| `storage.type` | `"filesystem" \\| "
|
|
541
|
-
'`neo4j` 已不再是正式支持的 backend;旧配置会返回显式迁移错误,不会静默 fallback 到 `filesystem`。',
|
|
958
|
+
'| `storage.type` | `"filesystem" \\| "sqlite" \\| "memory" \\| "auto"` | 图存储后端类型 | `"filesystem"` |',
|
|
959
|
+
'`neo4j` 与 `kuzudb` 已不再是正式支持的 backend;旧配置会返回显式迁移错误,不会静默 fallback 到 `filesystem`。',
|
|
960
|
+
'`storage.type = "auto"` 当前优先选择 `sqlite`;若运行时缺少 `better-sqlite3` 或 Node.js `<20` 导致 SQLite 不可用,则 warning 后回退到 `filesystem`。',
|
|
542
961
|
'图存储后端生产化不等于重新开放公共 HTTP API 产品面;`Server Layer` 仍是内部架构层。'
|
|
543
962
|
],
|
|
544
963
|
[],
|
|
@@ -553,13 +972,17 @@ function validateGraphStorageDocs(rootDir, failures) {
|
|
|
553
972
|
[
|
|
554
973
|
'| "需要切换/排查图存储后端" | 编辑 `mycodemap.config.json.storage` → 运行 `generate` / `export` |',
|
|
555
974
|
'`generate` 会写入配置的图存储后端;`export` 与内部 `Server Layer` handler 会读取同一份后端数据。',
|
|
556
|
-
'`neo4j` 已不再是正式支持的 backend;旧配置会暴露显式迁移错误,不会静默 fallback。'
|
|
975
|
+
'`neo4j` 与 `kuzudb` 已不再是正式支持的 backend;旧配置会暴露显式迁移错误,不会静默 fallback。',
|
|
976
|
+
'`storage.type = "auto"` 当前优先选择 `sqlite`;若运行时缺少 `better-sqlite3` 或 Node.js `<20` 导致 SQLite 不可用,则 warning 后回退到 `filesystem`。'
|
|
557
977
|
],
|
|
558
978
|
[],
|
|
559
979
|
failures
|
|
560
980
|
);
|
|
561
981
|
}
|
|
562
982
|
|
|
983
|
+
// NOTE: CLAUDE.md 已演进为执行手册(路由层),graph storage 合约已移至 AI_GUIDE.md / docs/ai-guide/
|
|
984
|
+
// 相关检查已下放至 AI_GUIDE.md 与 docs/ai-guide/*.md 的 validateSnippets 中
|
|
985
|
+
|
|
563
986
|
if (commandsGuide) {
|
|
564
987
|
validateSnippets(
|
|
565
988
|
commandsGuide,
|
|
@@ -593,8 +1016,10 @@ function validateGraphStorageDocs(rootDir, failures) {
|
|
|
593
1016
|
'docs/SETUP_GUIDE.md graph storage contract',
|
|
594
1017
|
[
|
|
595
1018
|
'"storage": {',
|
|
596
|
-
'| `storage.type` | string | `"filesystem"` | 图存储后端类型:`filesystem` / `
|
|
597
|
-
'旧的 `neo4j` 配置已不再受支持,会返回显式迁移错误,不会静默 fallback 到 `filesystem`。'
|
|
1019
|
+
'| `storage.type` | string | `"filesystem"` | 图存储后端类型:`filesystem` / `sqlite` / `memory` / `auto` |',
|
|
1020
|
+
'旧的 `neo4j` / `kuzudb` 配置已不再受支持,会返回显式迁移错误,不会静默 fallback 到 `filesystem`。',
|
|
1021
|
+
'显式选择 `sqlite` 且运行时缺少 `better-sqlite3` 或 Node.js `<20` 时,会返回显式错误。',
|
|
1022
|
+
'`storage.type = "auto"` 当前优先选择 `sqlite`;仅当 SQLite 运行时不可用时才 warning 后回退到 `filesystem`。'
|
|
598
1023
|
],
|
|
599
1024
|
[],
|
|
600
1025
|
failures
|
|
@@ -608,7 +1033,9 @@ function validateGraphStorageDocs(rootDir, failures) {
|
|
|
608
1033
|
[
|
|
609
1034
|
'若改动涉及 `mycodemap.config.json.storage` 或图数据库适配器',
|
|
610
1035
|
'schema / README / AI 文档没同步',
|
|
611
|
-
'旧的 `neo4j` 配置已经不受支持,但文档还把它写成正式 backend'
|
|
1036
|
+
'旧的 `neo4j` / `kuzudb` 配置已经不受支持,但文档还把它写成正式 backend',
|
|
1037
|
+
'Node.js `>=20`',
|
|
1038
|
+
'`STORAGE_BACKEND_MIGRATED`、`SQLITE_NOT_AVAILABLE`'
|
|
612
1039
|
],
|
|
613
1040
|
[],
|
|
614
1041
|
failures
|
|
@@ -621,7 +1048,7 @@ function validateGraphStorageDocs(rootDir, failures) {
|
|
|
621
1048
|
'mycodemap.config.schema.json storage contract',
|
|
622
1049
|
[
|
|
623
1050
|
'"storage"',
|
|
624
|
-
'"enum": ["filesystem", "
|
|
1051
|
+
'"enum": ["filesystem", "sqlite", "memory", "auto"]',
|
|
625
1052
|
'"outputPath"',
|
|
626
1053
|
'"databasePath"',
|
|
627
1054
|
'"autoThresholds"'
|
|
@@ -794,14 +1221,18 @@ function validateProductSpecsDocs(rootDir, failures) {
|
|
|
794
1221
|
[
|
|
795
1222
|
'# MVP3 架构对比:历史设计目标 vs v1.3 已落地基线',
|
|
796
1223
|
'`src/server/` 保留为**内部架构层**;公共 `server` 命令已移除',
|
|
797
|
-
'`filesystem` / `memory` / `
|
|
1224
|
+
'`filesystem` / `memory` / `sqlite` / `auto` 为正式 surface;`neo4j` 与 `kuzudb` 已退出正式支持',
|
|
1225
|
+
'当前优先选择 `sqlite`;仅当 SQLite 运行时不可用时 warning 后回退 `filesystem`',
|
|
1226
|
+
'`sqlite` 需要 `better-sqlite3` + Node.js `>=20`;否则返回 `SQLITE_NOT_AVAILABLE`',
|
|
798
1227
|
'当前公开能力仅保留 analysis-only:`find → read → link → show`',
|
|
799
1228
|
'Java / Rust / C/C++ 等更多 parser 实现 | 接口预留,未作为当前 shipped reality |'
|
|
800
1229
|
],
|
|
801
1230
|
[
|
|
802
1231
|
'# MVP3 架构对比:Before vs After',
|
|
803
1232
|
'cli/commands/viz.ts',
|
|
804
|
-
'支持 14 种语言'
|
|
1233
|
+
'支持 14 种语言',
|
|
1234
|
+
'Kùzu-only',
|
|
1235
|
+
'当前仍保守落到 `filesystem`'
|
|
805
1236
|
],
|
|
806
1237
|
failures
|
|
807
1238
|
);
|
|
@@ -814,13 +1245,17 @@ function validateProductSpecsDocs(rootDir, failures) {
|
|
|
814
1245
|
[
|
|
815
1246
|
'# CodeMap MVP3 架构重构产品需求文档(PRD,v1.3 同步版)',
|
|
816
1247
|
'公共 CLI 不再暴露 `server`、`watch`、`report`、`logs`',
|
|
817
|
-
'| `
|
|
1248
|
+
'| `auto` | shipped surface | 配置面存在,当前优先选择 `sqlite`;SQLite 不可用时回退 `filesystem` |',
|
|
1249
|
+
'| `neo4j` / `kuzudb` | removed | 不再是正式支持 backend;旧配置返回显式迁移错误 |',
|
|
1250
|
+
'显式 `sqlite` 缺少 `better-sqlite3` 或 Node.js `<20` 时会返回 `SQLITE_NOT_AVAILABLE`',
|
|
818
1251
|
'`workflow` 是 **analysis-only** 能力,只编排 `find → read → link → show`',
|
|
819
1252
|
'| 公共 HTTP API / `mycodemap server` 产品面 | Deferred |'
|
|
820
1253
|
],
|
|
821
1254
|
[
|
|
822
1255
|
'支持 14 种语言',
|
|
823
|
-
'neo4j | shipped'
|
|
1256
|
+
'neo4j | shipped',
|
|
1257
|
+
'Kùzu-only',
|
|
1258
|
+
'当前仍保守落到 `filesystem`'
|
|
824
1259
|
],
|
|
825
1260
|
failures
|
|
826
1261
|
);
|
|
@@ -832,14 +1267,18 @@ function validateProductSpecsDocs(rootDir, failures) {
|
|
|
832
1267
|
'docs/product-specs/MVP3-ARCHITECTURE-REDESIGN-TECH-PRD.md technical baseline',
|
|
833
1268
|
[
|
|
834
1269
|
'# CodeMap MVP3 架构重构技术需求文档(Tech-PRD,v1.3 同步版)',
|
|
835
|
-
'`neo4j` 已不再是正式支持 backend。',
|
|
1270
|
+
'`neo4j` 与 `kuzudb` 已不再是正式支持 backend。',
|
|
1271
|
+
'显式选择 `sqlite` 且运行时缺少 `better-sqlite3` 或 Node.js `<20` 时,`StorageFactory` 会抛出 `SQLITE_NOT_AVAILABLE`',
|
|
836
1272
|
'`auto` 是稳定配置面',
|
|
1273
|
+
'`auto` 会先探测 SQLite runtime,可用时返回 `sqlite`,不可用时 warning 后回退 `filesystem`',
|
|
837
1274
|
'但“按规模自动切到图数据库”的更强启发式仍是未来候选,而不是当前完成能力',
|
|
838
1275
|
'| analyze / refresh / incremental update 作为公共能力 | 明确返回 `501` unsupported |',
|
|
839
1276
|
'`workflow` 当前是 analysis-only 能力:'
|
|
840
1277
|
],
|
|
841
1278
|
[
|
|
842
|
-
'TypeScriptParser, GoParser, PythonParser, ParserRegistry'
|
|
1279
|
+
'TypeScriptParser, GoParser, PythonParser, ParserRegistry',
|
|
1280
|
+
'当前仍保守返回 `filesystem`',
|
|
1281
|
+
'Kùzu-native'
|
|
843
1282
|
],
|
|
844
1283
|
failures
|
|
845
1284
|
);
|
|
@@ -856,7 +1295,8 @@ function validateGuardrailDocs(rootDir, failures) {
|
|
|
856
1295
|
if (readme) {
|
|
857
1296
|
const requiredReadmeGuardrails = [
|
|
858
1297
|
'npm run docs:check',
|
|
859
|
-
'mycodemap ci check-docs-sync'
|
|
1298
|
+
'mycodemap ci check-docs-sync',
|
|
1299
|
+
'mycodemap check --contract mycodemap.design.md --against src'
|
|
860
1300
|
];
|
|
861
1301
|
|
|
862
1302
|
for (const snippet of requiredReadmeGuardrails) {
|
|
@@ -880,12 +1320,24 @@ function validateGuardrailDocs(rootDir, failures) {
|
|
|
880
1320
|
|
|
881
1321
|
if (validationRule) {
|
|
882
1322
|
expectIncludes(validationRule, 'npm run docs:check', 'docs/rules/validation.md', failures);
|
|
1323
|
+
expectIncludes(validationRule, 'node dist/cli/index.js check --contract mycodemap.design.md --against src', 'docs/rules/validation.md', failures);
|
|
1324
|
+
expectIncludes(validationRule, 'node scripts/calibrate-contract-gate.mjs --max-changed-files 10 --max-false-positive-rate 0.10', 'docs/rules/validation.md', failures);
|
|
1325
|
+
expectIncludes(validationRule, '--annotation-format github', 'docs/rules/validation.md', failures);
|
|
1326
|
+
expectIncludes(validationRule, 'changed files <= 10', 'docs/rules/validation.md', failures);
|
|
1327
|
+
expectIncludes(validationRule, 'warn-only / fallback', 'docs/rules/validation.md', failures);
|
|
883
1328
|
}
|
|
884
1329
|
|
|
885
1330
|
if (ciWorkflow) {
|
|
886
1331
|
expectIncludes(ciWorkflow, 'run: npm run docs:check', '.github/workflows/ci-gateway.yml', failures);
|
|
887
1332
|
expectIncludes(ciWorkflow, 'run: npm run typecheck', '.github/workflows/ci-gateway.yml', failures);
|
|
888
1333
|
expectIncludes(ciWorkflow, 'run: npm run build', '.github/workflows/ci-gateway.yml', failures);
|
|
1334
|
+
expectIncludes(ciWorkflow, 'check --contract mycodemap.design.md --against src', '.github/workflows/ci-gateway.yml', failures);
|
|
1335
|
+
expectIncludes(ciWorkflow, 'github.event.pull_request.base.sha', '.github/workflows/ci-gateway.yml', failures);
|
|
1336
|
+
expectIncludes(ciWorkflow, 'scripts/calibrate-contract-gate.mjs --max-changed-files 10 --max-false-positive-rate 0.10', '.github/workflows/ci-gateway.yml', failures);
|
|
1337
|
+
expectIncludes(ciWorkflow, '--annotation-format github', '.github/workflows/ci-gateway.yml', failures);
|
|
1338
|
+
expectIncludes(ciWorkflow, 'contract-gate-calibration.json', '.github/workflows/ci-gateway.yml', failures);
|
|
1339
|
+
expectIncludes(ciWorkflow, 'contract-check-result.json', '.github/workflows/ci-gateway.yml', failures);
|
|
1340
|
+
expectIncludes(ciWorkflow, 'warn-only / fallback', '.github/workflows/ci-gateway.yml', failures);
|
|
889
1341
|
expectIncludes(ciWorkflow, 'run: node dist/cli/index.js ci check-docs-sync', '.github/workflows/ci-gateway.yml', failures);
|
|
890
1342
|
expectIncludes(ciWorkflow, 'node dist/cli/index.js generate', '.github/workflows/ci-gateway.yml', failures);
|
|
891
1343
|
}
|
|
@@ -938,6 +1390,8 @@ function validateDocs(rootDir) {
|
|
|
938
1390
|
validatePluginRuntimeDocs(rootDir, failures);
|
|
939
1391
|
validateGraphStorageDocs(rootDir, failures);
|
|
940
1392
|
validateAnalyzeDocs(rootDir, failures);
|
|
1393
|
+
validateHistoryRiskDocs(rootDir, failures);
|
|
1394
|
+
validateDesignContractDocs(rootDir, failures);
|
|
941
1395
|
validateTestingDocs(rootDir, failures);
|
|
942
1396
|
validateWorkflowAndDiscoveryDocs(rootDir, failures);
|
|
943
1397
|
validateProductSpecsDocs(rootDir, failures);
|