@mycodemap/mycodemap 0.5.0 → 0.5.2-beta.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 +25 -0
- package/README.md +77 -9
- 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 +5 -0
- package/dist/cli/commands/design.d.ts.map +1 -1
- package/dist/cli/commands/design.js +6 -0
- package/dist/cli/commands/design.js.map +1 -1
- 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/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.map +1 -1
- package/dist/cli/design-contract-loader.js +355 -3
- package/dist/cli/design-contract-loader.js.map +1 -1
- package/dist/cli/design-scope-resolver.d.ts.map +1 -1
- package/dist/cli/design-scope-resolver.js +89 -41
- package/dist/cli/design-scope-resolver.js.map +1 -1
- package/dist/cli/index.js +18 -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/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/infrastructure/storage/StorageFactory.d.ts +1 -0
- package/dist/infrastructure/storage/StorageFactory.d.ts.map +1 -1
- package/dist/infrastructure/storage/StorageFactory.js +7 -2
- 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/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 +56 -1
- package/dist/interface/types/design-contract.d.ts.map +1 -1
- 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 +17 -2
- 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/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/PUBLISHING.md +41 -12
- package/docs/SETUP_GUIDE.md +6 -6
- package/docs/ai-guide/COMMANDS.md +98 -4
- package/docs/ai-guide/INTEGRATION.md +137 -433
- package/docs/ai-guide/OUTPUT.md +476 -6
- package/docs/ai-guide/PATTERNS.md +41 -11
- package/docs/ai-guide/PROMPTS.md +11 -6
- 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 +47 -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/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 +14 -1
- package/docs/rules/pre-release-checklist.md +9 -4
- package/docs/rules/validation.md +91 -40
- 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/pre-release-check.js +2 -2
- 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 +249 -42
- package/scripts/validate-rules.py +254 -0
- package/dist/ai/claude.d.ts +0 -38
- package/dist/ai/claude.d.ts.map +0 -1
- package/dist/ai/claude.js +0 -169
- package/dist/ai/claude.js.map +0 -1
- package/dist/ai/codex.d.ts +0 -38
- package/dist/ai/codex.d.ts.map +0 -1
- package/dist/ai/codex.js +0 -169
- package/dist/ai/codex.js.map +0 -1
- package/dist/ai/factory.d.ts +0 -48
- package/dist/ai/factory.d.ts.map +0 -1
- package/dist/ai/factory.js +0 -95
- package/dist/ai/factory.js.map +0 -1
- package/dist/ai/index.d.ts +0 -12
- package/dist/ai/index.d.ts.map +0 -1
- package/dist/ai/index.js +0 -29
- package/dist/ai/index.js.map +0 -1
- package/dist/ai/provider.d.ts +0 -70
- package/dist/ai/provider.d.ts.map +0 -1
- package/dist/ai/provider.js +0 -31
- package/dist/ai/provider.js.map +0 -1
- package/dist/ai/subagent-caller.d.ts +0 -90
- package/dist/ai/subagent-caller.d.ts.map +0 -1
- package/dist/ai/subagent-caller.js +0 -280
- package/dist/ai/subagent-caller.js.map +0 -1
- package/dist/ai/types.d.ts +0 -70
- package/dist/ai/types.d.ts.map +0 -1
- package/dist/ai/types.js +0 -5
- package/dist/ai/types.js.map +0 -1
- package/dist/cli/commands/server.d.ts +0 -9
- package/dist/cli/commands/server.d.ts.map +0 -1
- package/dist/cli/commands/server.js +0 -65
- package/dist/cli/commands/server.js.map +0 -1
- package/dist/cli-new/commands/server.d.ts +0 -13
- package/dist/cli-new/commands/server.d.ts.map +0 -1
- package/dist/cli-new/commands/server.js +0 -90
- package/dist/cli-new/commands/server.js.map +0 -1
- package/dist/generator/ai-overview.d.ts +0 -51
- package/dist/generator/ai-overview.d.ts.map +0 -1
- package/dist/generator/ai-overview.js +0 -160
- package/dist/generator/ai-overview.js.map +0 -1
- package/dist/infrastructure/storage/adapters/Neo4jStorage.d.ts +0 -41
- package/dist/infrastructure/storage/adapters/Neo4jStorage.d.ts.map +0 -1
- package/dist/infrastructure/storage/adapters/Neo4jStorage.js +0 -162
- package/dist/infrastructure/storage/adapters/Neo4jStorage.js.map +0 -1
- package/dist/orchestrator/ai-feed-generator.d.ts +0 -210
- package/dist/orchestrator/ai-feed-generator.d.ts.map +0 -1
- package/dist/orchestrator/ai-feed-generator.js +0 -377
- package/dist/orchestrator/ai-feed-generator.js.map +0 -1
- package/docs/archive/test-report-symbol-search.md +0 -384
- package/docs/archive/test-scenario-4-complexity-analysis.md +0 -460
- package/docs/archive/test_report_scenario5.md +0 -615
- package/docs/archive/test_scenario_3_impact_analysis_report.md +0 -520
|
@@ -63,6 +63,32 @@ function readText(filePath) {
|
|
|
63
63
|
return readFileSync(absolutePath, 'utf8');
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
function collectSnippetFailures(
|
|
67
|
+
content,
|
|
68
|
+
requiredSnippets,
|
|
69
|
+
outdatedSnippets,
|
|
70
|
+
) {
|
|
71
|
+
const snippetFailures = [];
|
|
72
|
+
|
|
73
|
+
if (!content) {
|
|
74
|
+
return snippetFailures;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
for (const snippet of requiredSnippets) {
|
|
78
|
+
if (!content.includes(snippet)) {
|
|
79
|
+
snippetFailures.push(`missing required snippet: ${snippet}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
for (const snippet of outdatedSnippets) {
|
|
84
|
+
if (content.includes(snippet)) {
|
|
85
|
+
snippetFailures.push(`contains outdated snippet: ${snippet}`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return snippetFailures;
|
|
90
|
+
}
|
|
91
|
+
|
|
66
92
|
function checkRequiredDocs(failures) {
|
|
67
93
|
console.log('Checking required AI documents...\n');
|
|
68
94
|
|
|
@@ -194,7 +220,7 @@ function checkCrossReferences(failures) {
|
|
|
194
220
|
// CLAUDE.md 必须链接到 AI 文档
|
|
195
221
|
const claude = readText('CLAUDE.md');
|
|
196
222
|
if (claude) {
|
|
197
|
-
if (!claude.includes('AI_GUIDE.md')
|
|
223
|
+
if (!claude.includes('AI_GUIDE.md')) {
|
|
198
224
|
failures.push('CLAUDE.md must reference AI docs');
|
|
199
225
|
console.log(' ❌ CLAUDE.md missing AI docs references');
|
|
200
226
|
} else {
|
|
@@ -314,6 +340,258 @@ function checkAnalyzeContractConsistency(failures) {
|
|
|
314
340
|
}
|
|
315
341
|
}
|
|
316
342
|
|
|
343
|
+
function checkPhase25DogfoodContractConsistency(failures) {
|
|
344
|
+
console.log('\nChecking Phase 25 dogfood contract consistency...\n');
|
|
345
|
+
|
|
346
|
+
const phase25Checks = [
|
|
347
|
+
{
|
|
348
|
+
file: 'AI_GUIDE.md',
|
|
349
|
+
requiredSnippets: [
|
|
350
|
+
'query -S "XXX" -j',
|
|
351
|
+
'partialFailure',
|
|
352
|
+
'`rtk` 不是 CodeMap 产品功能',
|
|
353
|
+
],
|
|
354
|
+
outdatedSnippets: [],
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
file: 'docs/ai-guide/COMMANDS.md',
|
|
358
|
+
requiredSnippets: [
|
|
359
|
+
'mycodemap analyze -i find -k "SourceLocation" --json --structured',
|
|
360
|
+
'mycodemap complexity -f "src/cli/index.ts" -j',
|
|
361
|
+
'mycodemap ci assess-risk --files "changed.ts" --json',
|
|
362
|
+
'mycodemap workflow start "inspect analyze find" --json',
|
|
363
|
+
'JSON 默认包含 `passed` 与 `summary`',
|
|
364
|
+
'`workflow` 只保留 `find → read → link → show` 四个分析阶段',
|
|
365
|
+
],
|
|
366
|
+
outdatedSnippets: [
|
|
367
|
+
'`workflow` 同时包含 analyze、实现、CI、ship 等多个阶段',
|
|
368
|
+
],
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
file: 'docs/ai-guide/OUTPUT.md',
|
|
372
|
+
requiredSnippets: [
|
|
373
|
+
'interface AnalyzeDiagnostics',
|
|
374
|
+
'"partialFailure"',
|
|
375
|
+
'diagnostics.status = "success"',
|
|
376
|
+
'diagnostics.status = "failure"',
|
|
377
|
+
],
|
|
378
|
+
outdatedSnippets: [],
|
|
379
|
+
},
|
|
380
|
+
];
|
|
381
|
+
|
|
382
|
+
for (const { file, requiredSnippets, outdatedSnippets } of phase25Checks) {
|
|
383
|
+
const content = readText(file);
|
|
384
|
+
if (!content) {
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
const docFailures = collectSnippetFailures(content, requiredSnippets, outdatedSnippets);
|
|
389
|
+
if (docFailures.length > 0) {
|
|
390
|
+
failures.push(`${file}: ${docFailures.join(', ')}`);
|
|
391
|
+
console.log(` ❌ ${file}`);
|
|
392
|
+
for (const docFailure of docFailures) {
|
|
393
|
+
console.log(` - ${docFailure}`);
|
|
394
|
+
}
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
console.log(` ✅ ${file}`);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
function checkStorageContractConsistency(failures) {
|
|
403
|
+
console.log('\nChecking storage contract consistency...\n');
|
|
404
|
+
|
|
405
|
+
const storageDocChecks = [
|
|
406
|
+
{
|
|
407
|
+
file: 'AI_GUIDE.md',
|
|
408
|
+
requiredSnippets: [
|
|
409
|
+
'`storage.type = "auto"` 当前优先选择 `sqlite`;若运行时缺少 `better-sqlite3` 或 Node.js `<20` 导致 SQLite 不可用,则 warning 后回退到 `filesystem`。'
|
|
410
|
+
],
|
|
411
|
+
outdatedSnippets: [],
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
file: 'docs/ai-guide/COMMANDS.md',
|
|
415
|
+
requiredSnippets: [
|
|
416
|
+
'- `storage.type` 支持 `filesystem`、`sqlite`、`memory`、`auto`;默认是 `filesystem`。',
|
|
417
|
+
'- 旧的 `neo4j` / `kuzudb` 配置会直接报迁移错误;显式选择 `sqlite` 但运行时缺少 `better-sqlite3` 或 Node.js `<20` 时也会直接报错,不会静默 fallback 到 `filesystem`。',
|
|
418
|
+
],
|
|
419
|
+
outdatedSnippets: [],
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
file: 'docs/ai-guide/PATTERNS.md',
|
|
423
|
+
requiredSnippets: [
|
|
424
|
+
'- 旧的 `neo4j` / `kuzudb` 配置现在应该直接报迁移错误;显式 `sqlite` 但运行时不满足条件时也应看到显式错误,而不是静默 fallback。',
|
|
425
|
+
'- `storage.type = "auto"` 当前优先落到 `sqlite`;只有 SQLite 不可用时才回退 `filesystem`,不要把阈值字段误读成更复杂的调度器。',
|
|
426
|
+
],
|
|
427
|
+
outdatedSnippets: [],
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
file: 'docs/ai-guide/INTEGRATION.md',
|
|
431
|
+
requiredSnippets: [
|
|
432
|
+
'`UNSUPPORTED_STORAGE_TYPE` / `STORAGE_BACKEND_MIGRATED` / `SQLITE_NOT_AVAILABLE`',
|
|
433
|
+
'`better-sqlite3`',
|
|
434
|
+
'Node.js `>=20`',
|
|
435
|
+
'SQLite 不可用时会 warning 后回退 `filesystem`',
|
|
436
|
+
],
|
|
437
|
+
outdatedSnippets: [
|
|
438
|
+
'KUZU_INIT_FAILED',
|
|
439
|
+
'安装 `kuzu`',
|
|
440
|
+
],
|
|
441
|
+
},
|
|
442
|
+
];
|
|
443
|
+
|
|
444
|
+
for (const { file, requiredSnippets, outdatedSnippets } of storageDocChecks) {
|
|
445
|
+
const content = readText(file);
|
|
446
|
+
if (!content) {
|
|
447
|
+
continue;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
const docFailures = collectSnippetFailures(content, requiredSnippets, outdatedSnippets);
|
|
451
|
+
if (docFailures.length > 0) {
|
|
452
|
+
failures.push(`${file}: ${docFailures.join(', ')}`);
|
|
453
|
+
console.log(` ❌ ${file}`);
|
|
454
|
+
for (const docFailure of docFailures) {
|
|
455
|
+
console.log(` - ${docFailure}`);
|
|
456
|
+
}
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
console.log(` ✅ ${file}`);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
function checkHistoryRiskContractConsistency(failures) {
|
|
465
|
+
console.log('\nChecking history risk contract consistency...\n');
|
|
466
|
+
|
|
467
|
+
const historyRiskChecks = [
|
|
468
|
+
{
|
|
469
|
+
file: 'AI_GUIDE.md',
|
|
470
|
+
requiredSnippets: [
|
|
471
|
+
'`history --symbol <name>`',
|
|
472
|
+
'`check` / `ci assess-risk` / `history` 现在共用同一套 Git history risk truth;history unavailable 时会显式给出 `unavailable` / `confidence=low`',
|
|
473
|
+
'interface HistoryCommandResult {',
|
|
474
|
+
],
|
|
475
|
+
outdatedSnippets: [],
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
file: 'docs/ai-guide/COMMANDS.md',
|
|
479
|
+
requiredSnippets: [
|
|
480
|
+
'## history - 符号级 Git history / risk 查询',
|
|
481
|
+
'`ci assess-risk` 现在输出 `status / confidence / freshness / source / score / level`',
|
|
482
|
+
'history 不可用,会显式给出 `unavailable` / warning',
|
|
483
|
+
],
|
|
484
|
+
outdatedSnippets: [],
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
file: 'docs/ai-guide/OUTPUT.md',
|
|
488
|
+
requiredSnippets: [
|
|
489
|
+
'interface HistoryCommandResult {',
|
|
490
|
+
'"git-history-unsupported-intent"',
|
|
491
|
+
'Git history risk 是 additive enrichment:它补充 `history` 与 `violations[].risk`',
|
|
492
|
+
],
|
|
493
|
+
outdatedSnippets: [],
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
file: 'docs/ai-guide/PATTERNS.md',
|
|
497
|
+
requiredSnippets: [
|
|
498
|
+
'node dist/cli/index.js history --symbol createCheckCommand',
|
|
499
|
+
'`ci assess-risk`、`check`、`history` 共用同一套 Git history risk truth',
|
|
500
|
+
],
|
|
501
|
+
outdatedSnippets: [],
|
|
502
|
+
},
|
|
503
|
+
];
|
|
504
|
+
|
|
505
|
+
for (const { file, requiredSnippets, outdatedSnippets } of historyRiskChecks) {
|
|
506
|
+
const content = readText(file);
|
|
507
|
+
if (!content) {
|
|
508
|
+
continue;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
const docFailures = collectSnippetFailures(content, requiredSnippets, outdatedSnippets);
|
|
512
|
+
if (docFailures.length > 0) {
|
|
513
|
+
failures.push(`${file}: ${docFailures.join(', ')}`);
|
|
514
|
+
console.log(` ❌ ${file}`);
|
|
515
|
+
for (const docFailure of docFailures) {
|
|
516
|
+
console.log(` - ${docFailure}`);
|
|
517
|
+
}
|
|
518
|
+
continue;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
console.log(` ✅ ${file}`);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
function checkContractGateAnnotationConsistency(failures) {
|
|
526
|
+
console.log('\nChecking contract gate annotation consistency...\n');
|
|
527
|
+
|
|
528
|
+
const contractGateChecks = [
|
|
529
|
+
{
|
|
530
|
+
file: 'AI_GUIDE.md',
|
|
531
|
+
requiredSnippets: [
|
|
532
|
+
'--annotation-format github',
|
|
533
|
+
'node scripts/calibrate-contract-gate.mjs --max-changed-files 10 --max-false-positive-rate 0.10',
|
|
534
|
+
'changed files <= 10',
|
|
535
|
+
'warn-only / fallback',
|
|
536
|
+
],
|
|
537
|
+
outdatedSnippets: [],
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
file: 'docs/ai-guide/COMMANDS.md',
|
|
541
|
+
requiredSnippets: [
|
|
542
|
+
'--annotation-format github',
|
|
543
|
+
'--annotation-format gitlab --annotation-file gl-code-quality-report.json',
|
|
544
|
+
'changed files <= 10',
|
|
545
|
+
'false-positive rate >10%',
|
|
546
|
+
'warn-only / fallback',
|
|
547
|
+
],
|
|
548
|
+
outdatedSnippets: [],
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
file: 'docs/ai-guide/OUTPUT.md',
|
|
552
|
+
requiredSnippets: [
|
|
553
|
+
'details?: Record<string, string | number | boolean | null>;',
|
|
554
|
+
'diagnostic?: {',
|
|
555
|
+
'scope: "line" | "file" | "general";',
|
|
556
|
+
'Annotation-friendly diagnostics',
|
|
557
|
+
'gl-code-quality-report.json',
|
|
558
|
+
'warn-only / fallback',
|
|
559
|
+
],
|
|
560
|
+
outdatedSnippets: [],
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
file: 'docs/ai-guide/PATTERNS.md',
|
|
564
|
+
requiredSnippets: [
|
|
565
|
+
'node scripts/calibrate-contract-gate.mjs --max-changed-files 10 --max-false-positive-rate 0.10',
|
|
566
|
+
'--annotation-format github',
|
|
567
|
+
'--annotation-format gitlab --annotation-file gl-code-quality-report.json',
|
|
568
|
+
'changed files <= 10',
|
|
569
|
+
'warn-only / fallback',
|
|
570
|
+
],
|
|
571
|
+
outdatedSnippets: [],
|
|
572
|
+
},
|
|
573
|
+
];
|
|
574
|
+
|
|
575
|
+
for (const { file, requiredSnippets, outdatedSnippets } of contractGateChecks) {
|
|
576
|
+
const content = readText(file);
|
|
577
|
+
if (!content) {
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
const docFailures = collectSnippetFailures(content, requiredSnippets, outdatedSnippets);
|
|
582
|
+
if (docFailures.length > 0) {
|
|
583
|
+
failures.push(`${file}: ${docFailures.join(', ')}`);
|
|
584
|
+
console.log(` ❌ ${file}`);
|
|
585
|
+
for (const docFailure of docFailures) {
|
|
586
|
+
console.log(` - ${docFailure}`);
|
|
587
|
+
}
|
|
588
|
+
continue;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
console.log(` ✅ ${file}`);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
317
595
|
function validateAIDocs() {
|
|
318
596
|
console.log('========================================');
|
|
319
597
|
console.log('AI Documentation Guardrails Check');
|
|
@@ -327,6 +605,10 @@ function validateAIDocs() {
|
|
|
327
605
|
checkPromptsLibrary(failures);
|
|
328
606
|
checkDecisionTrees(failures);
|
|
329
607
|
checkAnalyzeContractConsistency(failures);
|
|
608
|
+
checkPhase25DogfoodContractConsistency(failures);
|
|
609
|
+
checkStorageContractConsistency(failures);
|
|
610
|
+
checkHistoryRiskContractConsistency(failures);
|
|
611
|
+
checkContractGateAnnotationConsistency(failures);
|
|
330
612
|
|
|
331
613
|
console.log('\n========================================');
|
|
332
614
|
|