@mycodemap/mycodemap 0.4.0 → 0.4.2
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 +45 -0
- package/README.md +214 -221
- package/dist/cli/commands/analyze-options.d.ts +36 -0
- package/dist/cli/commands/analyze-options.d.ts.map +1 -0
- package/dist/cli/commands/analyze-options.js +147 -0
- package/dist/cli/commands/analyze-options.js.map +1 -0
- package/dist/cli/commands/analyze.d.ts +93 -4
- package/dist/cli/commands/analyze.d.ts.map +1 -1
- package/dist/cli/commands/analyze.js +592 -176
- package/dist/cli/commands/analyze.js.map +1 -1
- package/dist/cli/commands/ci.d.ts +47 -1
- package/dist/cli/commands/ci.d.ts.map +1 -1
- package/dist/cli/commands/ci.js +208 -1
- package/dist/cli/commands/ci.js.map +1 -1
- package/dist/cli/commands/export.d.ts.map +1 -1
- package/dist/cli/commands/export.js +2 -2
- package/dist/cli/commands/export.js.map +1 -1
- package/dist/cli/commands/generate.d.ts +8 -2
- package/dist/cli/commands/generate.d.ts.map +1 -1
- package/dist/cli/commands/generate.js +151 -22
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +2 -13
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/ship/analyzer.d.ts +1 -1
- package/dist/cli/commands/ship/analyzer.d.ts.map +1 -1
- package/dist/cli/commands/ship/analyzer.js +8 -1
- package/dist/cli/commands/ship/analyzer.js.map +1 -1
- package/dist/cli/commands/ship/checker.d.ts +1 -1
- package/dist/cli/commands/ship/checker.d.ts.map +1 -1
- package/dist/cli/commands/ship/checker.js +17 -6
- package/dist/cli/commands/ship/checker.js.map +1 -1
- package/dist/cli/commands/ship/index.js +2 -2
- package/dist/cli/commands/ship/index.js.map +1 -1
- package/dist/cli/commands/ship/monitor.d.ts +17 -2
- package/dist/cli/commands/ship/monitor.d.ts.map +1 -1
- package/dist/cli/commands/ship/monitor.js +116 -29
- package/dist/cli/commands/ship/monitor.js.map +1 -1
- package/dist/cli/commands/ship/pipeline.d.ts.map +1 -1
- package/dist/cli/commands/ship/pipeline.js +97 -18
- package/dist/cli/commands/ship/pipeline.js.map +1 -1
- package/dist/cli/commands/ship/publisher.d.ts +12 -2
- package/dist/cli/commands/ship/publisher.d.ts.map +1 -1
- package/dist/cli/commands/ship/publisher.js +217 -37
- package/dist/cli/commands/ship/publisher.js.map +1 -1
- package/dist/cli/commands/ship/rules/quality-rules.d.ts +2 -2
- package/dist/cli/commands/ship/rules/quality-rules.d.ts.map +1 -1
- package/dist/cli/commands/ship/rules/quality-rules.js +53 -54
- package/dist/cli/commands/ship/rules/quality-rules.js.map +1 -1
- package/dist/cli/commands/ship/versioner.d.ts +1 -1
- package/dist/cli/commands/ship/versioner.d.ts.map +1 -1
- package/dist/cli/commands/ship/versioner.js +4 -2
- package/dist/cli/commands/ship/versioner.js.map +1 -1
- package/dist/cli/commands/workflow.js +4 -4
- package/dist/cli/commands/workflow.js.map +1 -1
- package/dist/cli/config-loader.d.ts +31 -0
- package/dist/cli/config-loader.d.ts.map +1 -0
- package/dist/cli/config-loader.js +235 -0
- package/dist/cli/config-loader.js.map +1 -0
- package/dist/cli/index.js +19 -64
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/removed-commands.d.ts +9 -0
- package/dist/cli/removed-commands.d.ts.map +1 -0
- package/dist/cli/removed-commands.js +48 -0
- package/dist/cli/removed-commands.js.map +1 -0
- package/dist/cli/storage-runtime.d.ts +8 -0
- package/dist/cli/storage-runtime.d.ts.map +1 -0
- package/dist/cli/storage-runtime.js +14 -0
- package/dist/cli/storage-runtime.js.map +1 -0
- package/dist/cli/tree-sitter-check.d.ts.map +1 -1
- package/dist/cli/tree-sitter-check.js +0 -1
- package/dist/cli/tree-sitter-check.js.map +1 -1
- package/dist/cli-new/commands/export.d.ts.map +1 -1
- package/dist/cli-new/commands/export.js +2 -2
- package/dist/cli-new/commands/export.js.map +1 -1
- package/dist/cli-new/commands/query.d.ts.map +1 -1
- package/dist/cli-new/commands/query.js +5 -4
- package/dist/cli-new/commands/query.js.map +1 -1
- package/dist/cli-new/index.d.ts.map +1 -1
- package/dist/cli-new/index.js +0 -2
- package/dist/cli-new/index.js.map +1 -1
- package/dist/core/analyzer.d.ts.map +1 -1
- package/dist/core/analyzer.js +7 -39
- package/dist/core/analyzer.js.map +1 -1
- package/dist/core/file-discovery.d.ts +17 -0
- package/dist/core/file-discovery.d.ts.map +1 -0
- package/dist/core/file-discovery.js +75 -0
- package/dist/core/file-discovery.js.map +1 -0
- package/dist/core/global-index.d.ts +5 -0
- package/dist/core/global-index.d.ts.map +1 -1
- package/dist/core/global-index.js +71 -21
- package/dist/core/global-index.js.map +1 -1
- package/dist/generator/index.d.ts.map +1 -1
- package/dist/generator/index.js +8 -0
- package/dist/generator/index.js.map +1 -1
- package/dist/infrastructure/parser/implementations/GoParser.d.ts +2 -5
- package/dist/infrastructure/parser/implementations/GoParser.d.ts.map +1 -1
- package/dist/infrastructure/parser/implementations/GoParser.js +2 -5
- package/dist/infrastructure/parser/implementations/GoParser.js.map +1 -1
- package/dist/infrastructure/parser/implementations/PythonParser.d.ts +1 -5
- package/dist/infrastructure/parser/implementations/PythonParser.d.ts.map +1 -1
- package/dist/infrastructure/parser/implementations/PythonParser.js +1 -5
- package/dist/infrastructure/parser/implementations/PythonParser.js.map +1 -1
- package/dist/infrastructure/parser/implementations/TypeScriptParser.d.ts +1 -5
- package/dist/infrastructure/parser/implementations/TypeScriptParser.d.ts.map +1 -1
- package/dist/infrastructure/parser/implementations/TypeScriptParser.js +1 -5
- package/dist/infrastructure/parser/implementations/TypeScriptParser.js.map +1 -1
- package/dist/infrastructure/storage/StorageFactory.d.ts +0 -1
- package/dist/infrastructure/storage/StorageFactory.d.ts.map +1 -1
- package/dist/infrastructure/storage/StorageFactory.js +4 -29
- package/dist/infrastructure/storage/StorageFactory.js.map +1 -1
- package/dist/infrastructure/storage/adapters/FileSystemStorage.d.ts.map +1 -1
- package/dist/infrastructure/storage/adapters/FileSystemStorage.js +24 -137
- package/dist/infrastructure/storage/adapters/FileSystemStorage.js.map +1 -1
- package/dist/infrastructure/storage/adapters/KuzuDBStorage.d.ts +10 -18
- package/dist/infrastructure/storage/adapters/KuzuDBStorage.d.ts.map +1 -1
- package/dist/infrastructure/storage/adapters/KuzuDBStorage.js +103 -146
- package/dist/infrastructure/storage/adapters/KuzuDBStorage.js.map +1 -1
- package/dist/infrastructure/storage/adapters/MemoryStorage.d.ts +0 -1
- package/dist/infrastructure/storage/adapters/MemoryStorage.d.ts.map +1 -1
- package/dist/infrastructure/storage/adapters/MemoryStorage.js +16 -136
- package/dist/infrastructure/storage/adapters/MemoryStorage.js.map +1 -1
- package/dist/infrastructure/storage/graph-helpers.d.ts +16 -0
- package/dist/infrastructure/storage/graph-helpers.d.ts.map +1 -0
- package/dist/infrastructure/storage/graph-helpers.js +161 -0
- package/dist/infrastructure/storage/graph-helpers.js.map +1 -0
- package/dist/infrastructure/storage/index.d.ts.map +1 -1
- package/dist/interface/config/index.d.ts +10 -1
- package/dist/interface/config/index.d.ts.map +1 -1
- package/dist/interface/types/index.d.ts +13 -0
- package/dist/interface/types/index.d.ts.map +1 -1
- package/dist/interface/types/storage.d.ts +1 -4
- package/dist/interface/types/storage.d.ts.map +1 -1
- package/dist/orchestrator/confidence.d.ts +9 -9
- package/dist/orchestrator/confidence.d.ts.map +1 -1
- package/dist/orchestrator/confidence.js +44 -67
- package/dist/orchestrator/confidence.js.map +1 -1
- package/dist/orchestrator/file-header-scanner.d.ts.map +1 -1
- package/dist/orchestrator/file-header-scanner.js +22 -31
- package/dist/orchestrator/file-header-scanner.js.map +1 -1
- package/dist/orchestrator/intent-router.d.ts +2 -11
- package/dist/orchestrator/intent-router.d.ts.map +1 -1
- package/dist/orchestrator/intent-router.js +58 -49
- package/dist/orchestrator/intent-router.js.map +1 -1
- package/dist/orchestrator/tool-orchestrator.d.ts.map +1 -1
- package/dist/orchestrator/tool-orchestrator.js +6 -4
- package/dist/orchestrator/tool-orchestrator.js.map +1 -1
- package/dist/orchestrator/types.d.ts +113 -2
- package/dist/orchestrator/types.d.ts.map +1 -1
- package/dist/orchestrator/types.js +29 -0
- package/dist/orchestrator/types.js.map +1 -1
- package/dist/orchestrator/workflow/config.d.ts +4 -12
- package/dist/orchestrator/workflow/config.d.ts.map +1 -1
- package/dist/orchestrator/workflow/config.js +4 -6
- package/dist/orchestrator/workflow/config.js.map +1 -1
- package/dist/orchestrator/workflow/git-analyzer.d.ts.map +1 -1
- package/dist/orchestrator/workflow/git-analyzer.js +9 -19
- package/dist/orchestrator/workflow/git-analyzer.js.map +1 -1
- package/dist/orchestrator/workflow/phase-inheritance.d.ts.map +1 -1
- package/dist/orchestrator/workflow/phase-inheritance.js +14 -23
- package/dist/orchestrator/workflow/phase-inheritance.js.map +1 -1
- package/dist/orchestrator/workflow/result-fusion.d.ts.map +1 -1
- package/dist/orchestrator/workflow/result-fusion.js +9 -11
- package/dist/orchestrator/workflow/result-fusion.js.map +1 -1
- package/dist/orchestrator/workflow/templates.d.ts +4 -1
- package/dist/orchestrator/workflow/templates.d.ts.map +1 -1
- package/dist/orchestrator/workflow/templates.js +49 -207
- package/dist/orchestrator/workflow/templates.js.map +1 -1
- package/dist/orchestrator/workflow/test-linker.d.ts.map +1 -1
- package/dist/orchestrator/workflow/test-linker.js +12 -24
- package/dist/orchestrator/workflow/test-linker.js.map +1 -1
- package/dist/orchestrator/workflow/types.d.ts +11 -8
- package/dist/orchestrator/workflow/types.d.ts.map +1 -1
- package/dist/orchestrator/workflow/types.js +8 -1
- package/dist/orchestrator/workflow/types.js.map +1 -1
- package/dist/orchestrator/workflow/visualizer.d.ts.map +1 -1
- package/dist/orchestrator/workflow/visualizer.js +7 -9
- package/dist/orchestrator/workflow/visualizer.js.map +1 -1
- package/dist/orchestrator/workflow/workflow-context.d.ts.map +1 -1
- package/dist/orchestrator/workflow/workflow-context.js +3 -5
- package/dist/orchestrator/workflow/workflow-context.js.map +1 -1
- package/dist/orchestrator/workflow/workflow-orchestrator.d.ts +0 -4
- package/dist/orchestrator/workflow/workflow-orchestrator.d.ts.map +1 -1
- package/dist/orchestrator/workflow/workflow-orchestrator.js +7 -99
- package/dist/orchestrator/workflow/workflow-orchestrator.js.map +1 -1
- package/dist/parser/index.d.ts.map +1 -1
- package/dist/parser/index.js +2 -2
- package/dist/parser/index.js.map +1 -1
- package/dist/plugins/index.d.ts +5 -3
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +19 -8
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/plugin-loader.d.ts +21 -6
- package/dist/plugins/plugin-loader.d.ts.map +1 -1
- package/dist/plugins/plugin-loader.js +170 -54
- package/dist/plugins/plugin-loader.js.map +1 -1
- package/dist/plugins/plugin-registry.d.ts +7 -4
- package/dist/plugins/plugin-registry.d.ts.map +1 -1
- package/dist/plugins/plugin-registry.js +62 -14
- package/dist/plugins/plugin-registry.js.map +1 -1
- package/dist/plugins/types.d.ts +16 -6
- package/dist/plugins/types.d.ts.map +1 -1
- package/dist/plugins/types.js +2 -0
- package/dist/plugins/types.js.map +1 -1
- package/dist/server/handlers/AnalysisHandler.d.ts +16 -2
- package/dist/server/handlers/AnalysisHandler.d.ts.map +1 -1
- package/dist/server/handlers/AnalysisHandler.js +31 -47
- package/dist/server/handlers/AnalysisHandler.js.map +1 -1
- package/dist/server/routes/api.d.ts.map +1 -1
- package/dist/server/routes/api.js +31 -12
- package/dist/server/routes/api.js.map +1 -1
- package/docs/AI_ASSISTANT_SETUP.md +3 -1
- package/docs/PUBLISHING.md +18 -4
- package/docs/SETUP_GUIDE.md +41 -17
- package/docs/ai-guide/COMMANDS.md +107 -103
- package/docs/ai-guide/INTEGRATION.md +23 -21
- package/docs/ai-guide/OUTPUT.md +206 -10
- package/docs/ai-guide/PATTERNS.md +64 -15
- package/docs/ai-guide/PROMPTS.md +50 -12
- package/docs/ai-guide/QUICKSTART.md +35 -19
- package/docs/ai-guide/README.md +22 -4
- package/docs/product-specs/MVP3-ARCHITECTURE-COMPARISON.md +159 -434
- package/docs/product-specs/MVP3-ARCHITECTURE-REDESIGN-PRD.md +169 -261
- package/docs/product-specs/MVP3-ARCHITECTURE-REDESIGN-TECH-PRD.md +201 -1259
- package/docs/product-specs/README.md +8 -1
- package/docs/rules/architecture-guardrails.md +1 -2
- package/docs/rules/engineering-with-codex-openai.md +15 -9
- package/docs/rules/validation.md +26 -4
- package/mycodemap.config.schema.json +76 -5
- package/package.json +1 -1
- package/scripts/pre-release-check.js +21 -3
- package/scripts/sync-analyze-docs.js +500 -0
- package/scripts/validate-ai-docs.js +54 -1
- package/scripts/validate-docs.js +746 -26
- 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 -68
- 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 -94
- package/dist/cli-new/commands/server.js.map +0 -1
- package/dist/infrastructure/storage/adapters/Neo4jStorage.d.ts +0 -49
- package/dist/infrastructure/storage/adapters/Neo4jStorage.d.ts.map +0 -1
- package/dist/infrastructure/storage/adapters/Neo4jStorage.js +0 -222
- package/dist/infrastructure/storage/adapters/Neo4jStorage.js.map +0 -1
package/scripts/validate-docs.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { existsSync, readFileSync } from 'node:fs';
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
|
+
import { collectAnalyzeDocSyncFailures } from './sync-analyze-docs.js';
|
|
7
8
|
|
|
8
9
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
10
|
const defaultRootDir = path.resolve(__dirname, '..');
|
|
@@ -45,6 +46,20 @@ function expectNotIncludes(text, snippet, label, failures) {
|
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
|
|
49
|
+
function validateSnippets(text, label, requiredSnippets, outdatedSnippets, failures) {
|
|
50
|
+
if (!text) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
for (const snippet of requiredSnippets) {
|
|
55
|
+
expectIncludes(text, snippet, label, failures);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
for (const snippet of outdatedSnippets) {
|
|
59
|
+
expectNotIncludes(text, snippet, label, failures);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
48
63
|
function validatePackageScripts(rootDir, failures) {
|
|
49
64
|
const packageJsonText = readText(rootDir, 'package.json', failures);
|
|
50
65
|
if (!packageJsonText) {
|
|
@@ -67,43 +82,553 @@ function validatePackageScripts(rootDir, failures) {
|
|
|
67
82
|
|
|
68
83
|
function validateAnalyzeDocs(rootDir, failures) {
|
|
69
84
|
const readme = readText(rootDir, 'README.md', failures);
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
85
|
+
const aiGuide = readText(rootDir, 'AI_GUIDE.md', failures);
|
|
86
|
+
const claudeGuide = readText(rootDir, 'CLAUDE.md', failures);
|
|
87
|
+
const commandsGuide = readText(rootDir, 'docs/ai-guide/COMMANDS.md', failures);
|
|
88
|
+
const outputGuide = readText(rootDir, 'docs/ai-guide/OUTPUT.md', failures);
|
|
89
|
+
const engineeringGuide = readText(rootDir, 'docs/rules/engineering-with-codex-openai.md', failures);
|
|
90
|
+
const analyzeOptionsSource = readText(rootDir, 'src/cli/commands/analyze-options.ts', failures);
|
|
91
|
+
const cliIndexSource = readText(rootDir, 'src/cli/index.ts', failures);
|
|
92
|
+
|
|
93
|
+
if (!analyzeOptionsSource || !cliIndexSource) {
|
|
73
94
|
return;
|
|
74
95
|
}
|
|
75
96
|
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
97
|
+
const requiredAnalyzeOptionSnippets = [
|
|
98
|
+
'ANALYZE_OPTION_DEFINITIONS',
|
|
99
|
+
"flags: '-i, --intent <type>'",
|
|
100
|
+
"flags: '-t, --targets <paths...>'",
|
|
101
|
+
"flags: '-k, --keywords <words...>'",
|
|
102
|
+
"flags: '--include-tests'",
|
|
103
|
+
'docDescription:',
|
|
104
|
+
'docDefaultValue:',
|
|
105
|
+
'getAnalyzeHelpText'
|
|
81
106
|
];
|
|
82
107
|
|
|
83
|
-
for (const snippet of
|
|
84
|
-
expectIncludes(
|
|
108
|
+
for (const snippet of requiredAnalyzeOptionSnippets) {
|
|
109
|
+
expectIncludes(
|
|
110
|
+
analyzeOptionsSource,
|
|
111
|
+
snippet,
|
|
112
|
+
'src/cli/commands/analyze-options.ts',
|
|
113
|
+
failures
|
|
114
|
+
);
|
|
85
115
|
}
|
|
86
116
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
'
|
|
92
|
-
|
|
117
|
+
expectIncludes(cliIndexSource, 'configureAnalyzeCommand(', 'src/cli/index.ts', failures);
|
|
118
|
+
|
|
119
|
+
validateSnippets(
|
|
120
|
+
readme,
|
|
121
|
+
'README.md analyze examples',
|
|
122
|
+
[
|
|
123
|
+
'mycodemap analyze -i find -k SourceLocation',
|
|
124
|
+
'mycodemap analyze -i read -t src/cli/index.ts --include-tests --json',
|
|
125
|
+
'mycodemap analyze -i link -t src/cli/index.ts',
|
|
126
|
+
'mycodemap analyze -i show -t src/orchestrator',
|
|
127
|
+
'`refactor` 会返回 `E0001_INVALID_INTENT`'
|
|
128
|
+
],
|
|
129
|
+
[
|
|
130
|
+
'mycodemap analyze -i overview -t src/orchestrator',
|
|
131
|
+
'mycodemap analyze -i impact -t src/cli/index.ts --include-tests',
|
|
132
|
+
'mycodemap analyze -i dependency -t src/cli/index.ts',
|
|
133
|
+
'mycodemap analyze -i search -k UnifiedResult',
|
|
134
|
+
'mycodemap analyze --intent impact --file src/cli/index.ts'
|
|
135
|
+
],
|
|
136
|
+
failures
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
validateSnippets(
|
|
140
|
+
aiGuide,
|
|
141
|
+
'AI_GUIDE.md analyze baseline',
|
|
142
|
+
[
|
|
143
|
+
'analyze -i show -t "src/" --json',
|
|
144
|
+
'node dist/cli/index.js analyze -i read -t "{{FILE}}" --scope transitive --json',
|
|
145
|
+
'intent: "find" | "read" | "link" | "show";'
|
|
146
|
+
],
|
|
147
|
+
[
|
|
148
|
+
'analyze -i overview -t "src/" --json',
|
|
149
|
+
'node dist/cli/index.js analyze -i impact -t "{{FILE}}" --transitive --json',
|
|
150
|
+
'analyze -i refactor'
|
|
151
|
+
],
|
|
152
|
+
failures
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
validateSnippets(
|
|
156
|
+
commandsGuide,
|
|
157
|
+
'docs/ai-guide/COMMANDS.md analyze baseline',
|
|
158
|
+
[
|
|
159
|
+
'### 当前公共契约:4 种分析意图',
|
|
160
|
+
'mycodemap analyze -i find -k "UnifiedResult"',
|
|
161
|
+
'mycodemap analyze -i read -t "src/index.ts" --scope transitive',
|
|
162
|
+
'mycodemap analyze -i link -t "src/orchestrator"',
|
|
163
|
+
'mycodemap analyze -i show -t "src/"',
|
|
164
|
+
'### legacy 兼容映射'
|
|
165
|
+
],
|
|
166
|
+
[
|
|
167
|
+
'### 当前实现:8 种分析意图(过渡态)',
|
|
168
|
+
'mycodemap analyze -i impact -t "src/index.ts"',
|
|
169
|
+
'mycodemap analyze -i dependency -t "src/orchestrator"',
|
|
170
|
+
'mycodemap analyze -i complexity -t "src/domain"',
|
|
171
|
+
'mycodemap analyze -i search -k "UnifiedResult"',
|
|
172
|
+
'mycodemap analyze -i overview -t "src/"',
|
|
173
|
+
'mycodemap analyze -i refactor -t "src/cache"',
|
|
174
|
+
'mycodemap analyze -i reference -t "src/interface/types"',
|
|
175
|
+
'mycodemap analyze -i documentation -t "src/domain/services"'
|
|
176
|
+
],
|
|
177
|
+
failures
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
validateSnippets(
|
|
181
|
+
outputGuide,
|
|
182
|
+
'docs/ai-guide/OUTPUT.md analyze schema',
|
|
183
|
+
[
|
|
184
|
+
'当前公共契约已固定为 `find` / `read` / `link` / `show`',
|
|
185
|
+
'type AnalyzeIntent = "find" | "read" | "link" | "show";',
|
|
186
|
+
'warnings?: AnalyzeWarning[];',
|
|
187
|
+
'analysis?: ReadAnalysis | LinkAnalysis | ShowAnalysis;',
|
|
188
|
+
'"intent": "read"',
|
|
189
|
+
'"code": "deprecated-intent"'
|
|
190
|
+
],
|
|
191
|
+
[
|
|
192
|
+
'当前仍是 8 意图过渡态,本文件先记录真实 schema',
|
|
193
|
+
'intent: "impact" | "dependency" | "search" | "documentation" | "complexity" | "overview" | "refactor" | "reference";'
|
|
194
|
+
],
|
|
195
|
+
failures
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
validateSnippets(
|
|
199
|
+
claudeGuide,
|
|
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
|
+
);
|
|
209
|
+
|
|
210
|
+
validateSnippets(
|
|
211
|
+
engineeringGuide,
|
|
212
|
+
'docs/rules/engineering-with-codex-openai.md analyze guardrail',
|
|
213
|
+
[
|
|
214
|
+
'node dist/cli/index.js analyze --help',
|
|
215
|
+
'`find` / `read` / `link` / `show`',
|
|
216
|
+
'`warnings[]`',
|
|
217
|
+
'`--structured --json`'
|
|
218
|
+
],
|
|
219
|
+
[
|
|
220
|
+
'`--output-mode machine --json`',
|
|
221
|
+
'analyze documentation'
|
|
222
|
+
],
|
|
223
|
+
failures
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
failures.push(...collectAnalyzeDocSyncFailures(rootDir));
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function validatePositioningBaselineDocs(rootDir, failures) {
|
|
230
|
+
const readme = readText(rootDir, 'README.md', failures);
|
|
231
|
+
const aiGuide = readText(rootDir, 'AI_GUIDE.md', failures);
|
|
232
|
+
const aiGuideIndex = readText(rootDir, 'docs/ai-guide/README.md', failures);
|
|
233
|
+
const outputGuide = readText(rootDir, 'docs/ai-guide/OUTPUT.md', failures);
|
|
234
|
+
const architecture = readText(rootDir, 'ARCHITECTURE.md', failures);
|
|
235
|
+
|
|
236
|
+
if (readme) {
|
|
237
|
+
const requiredReadmeSnippets = [
|
|
238
|
+
'AI-first 代码地图工具',
|
|
239
|
+
'AI/Agent 是主要消费者',
|
|
240
|
+
'`server`、`watch`、`report`、`logs` 已从 public CLI 移除,并在调用时给出迁移提示。'
|
|
241
|
+
];
|
|
242
|
+
|
|
243
|
+
for (const snippet of requiredReadmeSnippets) {
|
|
244
|
+
expectIncludes(readme, snippet, 'README.md positioning baseline', failures);
|
|
245
|
+
}
|
|
93
246
|
|
|
94
|
-
|
|
95
|
-
|
|
247
|
+
expectNotIncludes(
|
|
248
|
+
readme,
|
|
249
|
+
'当前公共 CLI 仍包含 `workflow`、`ship`、`server`、`watch`、`report`、`logs` 等过渡能力',
|
|
250
|
+
'README.md positioning baseline',
|
|
251
|
+
failures
|
|
252
|
+
);
|
|
96
253
|
}
|
|
97
254
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
255
|
+
if (aiGuide) {
|
|
256
|
+
const requiredAiGuideSnippets = [
|
|
257
|
+
'CodeMap 是一个 AI-first 代码地图工具',
|
|
258
|
+
'当前 CLI 过渡现实',
|
|
259
|
+
'`Server Layer` 是内部架构层,不等于公共 `mycodemap server` 命令',
|
|
260
|
+
'后者已从 public CLI 移除'
|
|
261
|
+
];
|
|
262
|
+
|
|
263
|
+
for (const snippet of requiredAiGuideSnippets) {
|
|
264
|
+
expectIncludes(aiGuide, snippet, 'AI_GUIDE.md positioning baseline', failures);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if (aiGuideIndex) {
|
|
269
|
+
const requiredIndexSnippets = [
|
|
270
|
+
'AI-first 代码地图工具',
|
|
271
|
+
'AI/Agent 是主要消费者',
|
|
272
|
+
'`server`、`watch`、`report`、`logs` 已从 public CLI 移除'
|
|
273
|
+
];
|
|
274
|
+
|
|
275
|
+
for (const snippet of requiredIndexSnippets) {
|
|
276
|
+
expectIncludes(aiGuideIndex, snippet, 'docs/ai-guide/README.md positioning baseline', failures);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
if (outputGuide) {
|
|
281
|
+
const requiredOutputSnippets = [
|
|
282
|
+
'目标态',
|
|
283
|
+
'当前 CLI 现实',
|
|
284
|
+
'机器可读优先'
|
|
285
|
+
];
|
|
286
|
+
|
|
287
|
+
for (const snippet of requiredOutputSnippets) {
|
|
288
|
+
expectIncludes(outputGuide, snippet, 'docs/ai-guide/OUTPUT.md contract baseline', failures);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (architecture) {
|
|
293
|
+
expectIncludes(
|
|
294
|
+
architecture,
|
|
295
|
+
'`Server Layer` 是内部架构层,不等于公共 `mycodemap server` 命令',
|
|
296
|
+
'ARCHITECTURE.md naming boundary',
|
|
297
|
+
failures
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function validateCliSurfaceDocs(rootDir, failures) {
|
|
303
|
+
const readme = readText(rootDir, 'README.md', failures);
|
|
304
|
+
const aiGuide = readText(rootDir, 'AI_GUIDE.md', failures);
|
|
305
|
+
const aiGuideIndex = readText(rootDir, 'docs/ai-guide/README.md', failures);
|
|
306
|
+
const commandsGuide = readText(rootDir, 'docs/ai-guide/COMMANDS.md', failures);
|
|
307
|
+
const setupGuide = readText(rootDir, 'docs/SETUP_GUIDE.md', failures);
|
|
308
|
+
const assistantGuide = readText(rootDir, 'docs/AI_ASSISTANT_SETUP.md', failures);
|
|
309
|
+
const quickstart = readText(rootDir, 'docs/ai-guide/QUICKSTART.md', failures);
|
|
310
|
+
const integration = readText(rootDir, 'docs/ai-guide/INTEGRATION.md', failures);
|
|
311
|
+
|
|
312
|
+
if (readme) {
|
|
313
|
+
expectIncludes(readme, '### 已移除的公共 CLI 命令', 'README.md cli surface', failures);
|
|
314
|
+
|
|
315
|
+
const outdatedReadmeSnippets = [
|
|
316
|
+
'### `mycodemap watch`',
|
|
317
|
+
'### `mycodemap report`(当前过渡能力)',
|
|
318
|
+
'### `mycodemap logs`(当前过渡能力)',
|
|
319
|
+
'### `mycodemap server`(当前过渡能力,且不等于 Server Layer)',
|
|
320
|
+
];
|
|
321
|
+
|
|
322
|
+
for (const snippet of outdatedReadmeSnippets) {
|
|
323
|
+
expectNotIncludes(readme, snippet, 'README.md cli surface', failures);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
if (aiGuide) {
|
|
328
|
+
expectNotIncludes(aiGuide, '后者当前仍公开', 'AI_GUIDE.md cli surface', failures);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (aiGuideIndex) {
|
|
332
|
+
expectNotIncludes(
|
|
333
|
+
aiGuideIndex,
|
|
334
|
+
'`workflow`、`server`、`watch`、`report`、`logs`、`ship` 仍是当前公开的过渡能力',
|
|
335
|
+
'docs/ai-guide/README.md cli surface',
|
|
336
|
+
failures
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
if (commandsGuide) {
|
|
341
|
+
expectIncludes(commandsGuide, '## 已移除的公共命令', 'docs/ai-guide/COMMANDS.md cli surface', failures);
|
|
342
|
+
|
|
343
|
+
const outdatedCommandSnippets = [
|
|
344
|
+
'## server - HTTP 服务器(当前过渡能力)',
|
|
345
|
+
'### watch - 监听模式',
|
|
346
|
+
'### report - 生成报告',
|
|
347
|
+
'### logs - 日志管理',
|
|
348
|
+
];
|
|
349
|
+
|
|
350
|
+
for (const snippet of outdatedCommandSnippets) {
|
|
351
|
+
expectNotIncludes(commandsGuide, snippet, 'docs/ai-guide/COMMANDS.md cli surface', failures);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
if (setupGuide) {
|
|
356
|
+
expectIncludes(setupGuide, '### 已移除的公共 CLI 命令', 'docs/SETUP_GUIDE.md cli surface', failures);
|
|
357
|
+
expectNotIncludes(setupGuide, '### 监听模式', 'docs/SETUP_GUIDE.md cli surface', failures);
|
|
358
|
+
expectNotIncludes(setupGuide, 'mycodemap watch', 'docs/SETUP_GUIDE.md cli surface', failures);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
if (assistantGuide) {
|
|
362
|
+
expectIncludes(
|
|
363
|
+
assistantGuide,
|
|
364
|
+
'若文档或提示词仍把 `server`、`watch`、`report`、`logs` 当成当前 public CLI',
|
|
365
|
+
'docs/AI_ASSISTANT_SETUP.md cli surface',
|
|
366
|
+
failures
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
if (quickstart) {
|
|
371
|
+
expectIncludes(
|
|
372
|
+
quickstart,
|
|
373
|
+
'公共 `mycodemap server` 命令已从 public CLI 移除',
|
|
374
|
+
'docs/ai-guide/QUICKSTART.md cli surface',
|
|
375
|
+
failures
|
|
376
|
+
);
|
|
377
|
+
expectNotIncludes(
|
|
378
|
+
quickstart,
|
|
379
|
+
'公共 `mycodemap server` 命令仍存在',
|
|
380
|
+
'docs/ai-guide/QUICKSTART.md cli surface',
|
|
381
|
+
failures
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
if (integration) {
|
|
386
|
+
expectNotIncludes(integration, 'mycodemap watch', 'docs/ai-guide/INTEGRATION.md cli surface', failures);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function validateConfigDocs(rootDir, failures) {
|
|
391
|
+
const readme = readText(rootDir, 'README.md', failures);
|
|
392
|
+
const setupGuide = readText(rootDir, 'docs/SETUP_GUIDE.md', failures);
|
|
393
|
+
const assistantGuide = readText(rootDir, 'docs/AI_ASSISTANT_SETUP.md', failures);
|
|
104
394
|
|
|
105
|
-
|
|
106
|
-
|
|
395
|
+
if (readme) {
|
|
396
|
+
validateSnippets(
|
|
397
|
+
readme,
|
|
398
|
+
'README.md config contract',
|
|
399
|
+
[
|
|
400
|
+
'执行后会在项目根目录生成 `mycodemap.config.json` 配置文件。',
|
|
401
|
+
'通过 `mycodemap init` 生成的 `mycodemap.config.json` 配置文件支持以下选项:',
|
|
402
|
+
'"$schema": "https://mycodemap.dev/schema/config.json"',
|
|
403
|
+
'"mode": "hybrid"',
|
|
404
|
+
'"plugins": {',
|
|
405
|
+
'| `plugins.builtInPlugins` | `boolean` | 是否启用内置插件 | `true` |'
|
|
406
|
+
],
|
|
407
|
+
[
|
|
408
|
+
'执行后会在项目根目录生成 `codemap.config.json` 配置文件。',
|
|
409
|
+
'通过 `codemap init` 生成的 `codemap.config.json` 配置文件支持以下选项:',
|
|
410
|
+
'"$schema": "https://codemap.dev/schema.json"',
|
|
411
|
+
'"mode": "fast"'
|
|
412
|
+
],
|
|
413
|
+
failures
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
if (setupGuide) {
|
|
418
|
+
validateSnippets(
|
|
419
|
+
setupGuide,
|
|
420
|
+
'docs/SETUP_GUIDE.md config contract',
|
|
421
|
+
[
|
|
422
|
+
'生成的配置文件 `mycodemap.config.json`:',
|
|
423
|
+
'"include": ["src/**/*.ts"]',
|
|
424
|
+
'"watch": false',
|
|
425
|
+
'"plugins": {',
|
|
426
|
+
'| `plugins.debug` | boolean | `false` | 是否输出插件调试日志 |'
|
|
427
|
+
],
|
|
428
|
+
[
|
|
429
|
+
'"include": ["src/**/*"]'
|
|
430
|
+
],
|
|
431
|
+
failures
|
|
432
|
+
);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
if (assistantGuide) {
|
|
436
|
+
validateSnippets(
|
|
437
|
+
assistantGuide,
|
|
438
|
+
'docs/AI_ASSISTANT_SETUP.md config contract',
|
|
439
|
+
[
|
|
440
|
+
'- `mycodemap.config.json` - CodeMap 配置文件'
|
|
441
|
+
],
|
|
442
|
+
[
|
|
443
|
+
'- `codemap.config.json` - CodeMap 配置文件'
|
|
444
|
+
],
|
|
445
|
+
failures
|
|
446
|
+
);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
function validatePluginRuntimeDocs(rootDir, failures) {
|
|
451
|
+
const readme = readText(rootDir, 'README.md', failures);
|
|
452
|
+
const aiGuide = readText(rootDir, 'AI_GUIDE.md', failures);
|
|
453
|
+
const commandsGuide = readText(rootDir, 'docs/ai-guide/COMMANDS.md', failures);
|
|
454
|
+
const outputGuide = readText(rootDir, 'docs/ai-guide/OUTPUT.md', failures);
|
|
455
|
+
const quickstartGuide = readText(rootDir, 'docs/ai-guide/QUICKSTART.md', failures);
|
|
456
|
+
|
|
457
|
+
if (readme) {
|
|
458
|
+
validateSnippets(
|
|
459
|
+
readme,
|
|
460
|
+
'README.md plugin runtime contract',
|
|
461
|
+
[
|
|
462
|
+
'只有**显式声明了** `plugins` 段时,`generate` 才会启用插件 runtime;没有该段的旧项目保持原有行为。',
|
|
463
|
+
'`AI_MAP.md` 的 `Plugin Summary` 与 `codemap.json` 的 `pluginReport`',
|
|
464
|
+
'已加载插件、插件生成文件数量与插件诊断摘要'
|
|
465
|
+
],
|
|
466
|
+
[],
|
|
467
|
+
failures
|
|
468
|
+
);
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
if (aiGuide) {
|
|
472
|
+
validateSnippets(
|
|
473
|
+
aiGuide,
|
|
474
|
+
'AI_GUIDE.md plugin runtime contract',
|
|
475
|
+
[
|
|
476
|
+
'`codemap.json.pluginReport`',
|
|
477
|
+
'`pluginReport.diagnostics[]` 用统一结构暴露 `load / initialize / analyze / generate` 四个阶段'
|
|
478
|
+
],
|
|
479
|
+
[],
|
|
480
|
+
failures
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
if (commandsGuide) {
|
|
485
|
+
validateSnippets(
|
|
486
|
+
commandsGuide,
|
|
487
|
+
'docs/ai-guide/COMMANDS.md plugin runtime contract',
|
|
488
|
+
[
|
|
489
|
+
'`generate` 不提供独立 `--plugin` flags;插件通过 `mycodemap.config.json` 的 `plugins` 段声明。',
|
|
490
|
+
'`AI_MAP.md` 会增加 `Plugin Summary`,`codemap.json` 会增加 `pluginReport`'
|
|
491
|
+
],
|
|
492
|
+
[],
|
|
493
|
+
failures
|
|
494
|
+
);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
if (outputGuide) {
|
|
498
|
+
validateSnippets(
|
|
499
|
+
outputGuide,
|
|
500
|
+
'docs/ai-guide/OUTPUT.md plugin runtime contract',
|
|
501
|
+
[
|
|
502
|
+
'interface PluginExecutionReport {',
|
|
503
|
+
'pluginReport?: PluginExecutionReport;',
|
|
504
|
+
'stage: "load" | "initialize" | "analyze" | "generate";'
|
|
505
|
+
],
|
|
506
|
+
[],
|
|
507
|
+
failures
|
|
508
|
+
);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
if (quickstartGuide) {
|
|
512
|
+
validateSnippets(
|
|
513
|
+
quickstartGuide,
|
|
514
|
+
'docs/ai-guide/QUICKSTART.md plugin runtime contract',
|
|
515
|
+
[
|
|
516
|
+
'若显式配置了 plugins,也要看 Plugin Summary',
|
|
517
|
+
'解析 `.mycodemap/codemap.json` 的 `pluginReport`'
|
|
518
|
+
],
|
|
519
|
+
[],
|
|
520
|
+
failures
|
|
521
|
+
);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
function validateGraphStorageDocs(rootDir, failures) {
|
|
526
|
+
const readme = readText(rootDir, 'README.md', failures);
|
|
527
|
+
const aiGuide = readText(rootDir, 'AI_GUIDE.md', failures);
|
|
528
|
+
const commandsGuide = readText(rootDir, 'docs/ai-guide/COMMANDS.md', failures);
|
|
529
|
+
const quickstartGuide = readText(rootDir, 'docs/ai-guide/QUICKSTART.md', failures);
|
|
530
|
+
const setupGuide = readText(rootDir, 'docs/SETUP_GUIDE.md', failures);
|
|
531
|
+
const validationRule = readText(rootDir, 'docs/rules/validation.md', failures);
|
|
532
|
+
const schema = readText(rootDir, 'mycodemap.config.schema.json', failures);
|
|
533
|
+
|
|
534
|
+
if (readme) {
|
|
535
|
+
validateSnippets(
|
|
536
|
+
readme,
|
|
537
|
+
'README.md graph storage contract',
|
|
538
|
+
[
|
|
539
|
+
'"storage": {',
|
|
540
|
+
'| `storage.type` | `"filesystem" \\| "kuzudb" \\| "memory" \\| "auto"` | 图存储后端类型 | `"filesystem"` |',
|
|
541
|
+
'`neo4j` 已不再是正式支持的 backend;旧配置会返回显式迁移错误,不会静默 fallback 到 `filesystem`。',
|
|
542
|
+
'图存储后端生产化不等于重新开放公共 HTTP API 产品面;`Server Layer` 仍是内部架构层。'
|
|
543
|
+
],
|
|
544
|
+
[],
|
|
545
|
+
failures
|
|
546
|
+
);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
if (aiGuide) {
|
|
550
|
+
validateSnippets(
|
|
551
|
+
aiGuide,
|
|
552
|
+
'AI_GUIDE.md graph storage contract',
|
|
553
|
+
[
|
|
554
|
+
'| "需要切换/排查图存储后端" | 编辑 `mycodemap.config.json.storage` → 运行 `generate` / `export` |',
|
|
555
|
+
'`generate` 会写入配置的图存储后端;`export` 与内部 `Server Layer` handler 会读取同一份后端数据。',
|
|
556
|
+
'`neo4j` 已不再是正式支持的 backend;旧配置会暴露显式迁移错误,不会静默 fallback。'
|
|
557
|
+
],
|
|
558
|
+
[],
|
|
559
|
+
failures
|
|
560
|
+
);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
if (commandsGuide) {
|
|
564
|
+
validateSnippets(
|
|
565
|
+
commandsGuide,
|
|
566
|
+
'docs/ai-guide/COMMANDS.md graph storage contract',
|
|
567
|
+
[
|
|
568
|
+
'`generate` 会读取 `mycodemap.config.json.storage`,并把 CodeGraph 写入所选后端。',
|
|
569
|
+
'`export json|graphml|dot` 会从 `mycodemap.config.json.storage` 指定的后端读取 CodeGraph。',
|
|
570
|
+
'图存储后端收口不等于重新开放公共 `mycodemap server` 产品面;`Server Layer` 仍是内部层。'
|
|
571
|
+
],
|
|
572
|
+
[],
|
|
573
|
+
failures
|
|
574
|
+
);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
if (quickstartGuide) {
|
|
578
|
+
validateSnippets(
|
|
579
|
+
quickstartGuide,
|
|
580
|
+
'docs/ai-guide/QUICKSTART.md graph storage contract',
|
|
581
|
+
[
|
|
582
|
+
'stdout 还会显示当前写入的 `MVP3 Storage (...)`',
|
|
583
|
+
'| "需要切换/排查图存储后端" | 编辑 `mycodemap.config.json.storage` 后运行 `generate` | `export json` 验证是否能从同一 backend 读回 | 文本 + 机器可读 |'
|
|
584
|
+
],
|
|
585
|
+
[],
|
|
586
|
+
failures
|
|
587
|
+
);
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
if (setupGuide) {
|
|
591
|
+
validateSnippets(
|
|
592
|
+
setupGuide,
|
|
593
|
+
'docs/SETUP_GUIDE.md graph storage contract',
|
|
594
|
+
[
|
|
595
|
+
'"storage": {',
|
|
596
|
+
'| `storage.type` | string | `"filesystem"` | 图存储后端类型:`filesystem` / `kuzudb` / `memory` / `auto` |',
|
|
597
|
+
'旧的 `neo4j` 配置已不再受支持,会返回显式迁移错误,不会静默 fallback 到 `filesystem`。'
|
|
598
|
+
],
|
|
599
|
+
[],
|
|
600
|
+
failures
|
|
601
|
+
);
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
if (validationRule) {
|
|
605
|
+
validateSnippets(
|
|
606
|
+
validationRule,
|
|
607
|
+
'docs/rules/validation.md graph storage guardrail',
|
|
608
|
+
[
|
|
609
|
+
'若改动涉及 `mycodemap.config.json.storage` 或图数据库适配器',
|
|
610
|
+
'schema / README / AI 文档没同步',
|
|
611
|
+
'旧的 `neo4j` 配置已经不受支持,但文档还把它写成正式 backend'
|
|
612
|
+
],
|
|
613
|
+
[],
|
|
614
|
+
failures
|
|
615
|
+
);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
if (schema) {
|
|
619
|
+
validateSnippets(
|
|
620
|
+
schema,
|
|
621
|
+
'mycodemap.config.schema.json storage contract',
|
|
622
|
+
[
|
|
623
|
+
'"storage"',
|
|
624
|
+
'"enum": ["filesystem", "kuzudb", "memory", "auto"]',
|
|
625
|
+
'"outputPath"',
|
|
626
|
+
'"databasePath"',
|
|
627
|
+
'"autoThresholds"'
|
|
628
|
+
],
|
|
629
|
+
[],
|
|
630
|
+
failures
|
|
631
|
+
);
|
|
107
632
|
}
|
|
108
633
|
}
|
|
109
634
|
|
|
@@ -133,6 +658,194 @@ function validateTestingDocs(rootDir, failures) {
|
|
|
133
658
|
expectIncludes(testingRule, '`vitest.benchmark.config.ts`', 'docs/rules/testing.md', failures);
|
|
134
659
|
}
|
|
135
660
|
|
|
661
|
+
function validateWorkflowAndDiscoveryDocs(rootDir, failures) {
|
|
662
|
+
const readme = readText(rootDir, 'README.md', failures);
|
|
663
|
+
const aiGuide = readText(rootDir, 'AI_GUIDE.md', failures);
|
|
664
|
+
const commandsGuide = readText(rootDir, 'docs/ai-guide/COMMANDS.md', failures);
|
|
665
|
+
const outputGuide = readText(rootDir, 'docs/ai-guide/OUTPUT.md', failures);
|
|
666
|
+
const engineeringRule = readText(rootDir, 'docs/rules/engineering-with-codex-openai.md', failures);
|
|
667
|
+
const validationRule = readText(rootDir, 'docs/rules/validation.md', failures);
|
|
668
|
+
|
|
669
|
+
if (readme) {
|
|
670
|
+
validateSnippets(
|
|
671
|
+
readme,
|
|
672
|
+
'README.md workflow/discovery boundary',
|
|
673
|
+
[
|
|
674
|
+
'`workflow` 是公开的 analysis-only 工作流能力,只编排分析阶段:`find → read → link → show`。',
|
|
675
|
+
'共享同一套 `.gitignore` 感知排除规则',
|
|
676
|
+
'"coverage/**"',
|
|
677
|
+
'"**/*.test.ts"',
|
|
678
|
+
'"**/*.spec.ts"',
|
|
679
|
+
'"**/*.d.ts"',
|
|
680
|
+
'`mycodemap ship` 的 CHECK 阶段现在复用 `ci check-working-tree`、`ci check-branch`、`ci check-scripts`'
|
|
681
|
+
],
|
|
682
|
+
[
|
|
683
|
+
' "*.test.ts",',
|
|
684
|
+
' "*.spec.ts",'
|
|
685
|
+
],
|
|
686
|
+
failures
|
|
687
|
+
);
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
if (aiGuide) {
|
|
691
|
+
validateSnippets(
|
|
692
|
+
aiGuide,
|
|
693
|
+
'AI_GUIDE.md discovery baseline',
|
|
694
|
+
[
|
|
695
|
+
'| 文件发现契约 | 扫描类命令共享 `.gitignore` 感知排除模块;无 `.gitignore` 时回退到默认 `exclude` |'
|
|
696
|
+
],
|
|
697
|
+
[],
|
|
698
|
+
failures
|
|
699
|
+
);
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
if (commandsGuide) {
|
|
703
|
+
validateSnippets(
|
|
704
|
+
commandsGuide,
|
|
705
|
+
'docs/ai-guide/COMMANDS.md workflow/ci boundary',
|
|
706
|
+
[
|
|
707
|
+
'`ship` 的 CHECK 阶段会复用 `ci check-working-tree`、`ci check-branch`、`ci check-scripts`',
|
|
708
|
+
'`ci check-branch --allow` 支持 `*` 通配',
|
|
709
|
+
'`ci check-headers -d` 与 `generate` / `analyze` 共享同一套 `.gitignore` 感知排除规则',
|
|
710
|
+
'`workflow` 只保留 `find → read → link → show` 四个分析阶段'
|
|
711
|
+
],
|
|
712
|
+
[],
|
|
713
|
+
failures
|
|
714
|
+
);
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
if (outputGuide) {
|
|
718
|
+
validateSnippets(
|
|
719
|
+
outputGuide,
|
|
720
|
+
'docs/ai-guide/OUTPUT.md discovery contract',
|
|
721
|
+
[
|
|
722
|
+
'| 文件发现 | 扫描类命令共享一个文件发现模块 | 先尊重仓库 `.gitignore`,无 `.gitignore` 时回退到默认 `exclude` |',
|
|
723
|
+
'type DiscoveryFallbackExclude =',
|
|
724
|
+
'"coverage/**"',
|
|
725
|
+
'"**/*.test.ts"',
|
|
726
|
+
'"**/*.spec.ts"',
|
|
727
|
+
'"**/*.d.ts"',
|
|
728
|
+
'sharedBy: ["generate", "analyze", "ci check-headers -d"];'
|
|
729
|
+
],
|
|
730
|
+
[],
|
|
731
|
+
failures
|
|
732
|
+
);
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
if (engineeringRule) {
|
|
736
|
+
validateSnippets(
|
|
737
|
+
engineeringRule,
|
|
738
|
+
'docs/rules/engineering-with-codex-openai.md workflow/ci boundary',
|
|
739
|
+
[
|
|
740
|
+
'`ci check-branch --allow` 支持 `*` 通配;在 CI / PR 环境中,分支识别会回退到 `GITHUB_HEAD_REF` / `GITHUB_REF_NAME`。',
|
|
741
|
+
'`generate`、`analyze` 与 `ci check-headers -d` 共享 `.gitignore` 感知文件发现模块;没有 `.gitignore` 时回退到统一默认 `exclude`。',
|
|
742
|
+
'`check-working-tree`、`check-branch`、`check-scripts` 作为共享发布前 gate checks,由本地 `ci` 命令提供,`ship` 的 CHECK 阶段直接复用它们。'
|
|
743
|
+
],
|
|
744
|
+
[
|
|
745
|
+
'然后再通过 `node dist/cli/index.js ci ...` 执行 `check-working-tree`、`check-branch`、`check-scripts`'
|
|
746
|
+
],
|
|
747
|
+
failures
|
|
748
|
+
);
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
if (validationRule) {
|
|
752
|
+
validateSnippets(
|
|
753
|
+
validationRule,
|
|
754
|
+
'docs/rules/validation.md workflow/discovery boundary',
|
|
755
|
+
[
|
|
756
|
+
'若改动涉及产品定位、输出契约、共享文件发现规则或 `Server Layer` / `mycodemap server` 边界',
|
|
757
|
+
'当前 CI Gateway 直接执行 `check-docs-sync`、commit 格式、文件头、risk、output contract;`ship` 的本地 CHECK 阶段复用 `check-working-tree`、`check-branch`、`check-scripts`',
|
|
758
|
+
'文档声称扫描类命令会尊重 `.gitignore`,但实现仍保留手写跳过规则',
|
|
759
|
+
'把 `workflow` 重新扩回非分析阶段,却没同步 README / AI 命令文档 / guardrail 脚本'
|
|
760
|
+
],
|
|
761
|
+
[],
|
|
762
|
+
failures
|
|
763
|
+
);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
function validateProductSpecsDocs(rootDir, failures) {
|
|
768
|
+
const productSpecsReadme = readText(rootDir, 'docs/product-specs/README.md', failures);
|
|
769
|
+
const comparison = readText(rootDir, 'docs/product-specs/MVP3-ARCHITECTURE-COMPARISON.md', failures);
|
|
770
|
+
const prd = readText(rootDir, 'docs/product-specs/MVP3-ARCHITECTURE-REDESIGN-PRD.md', failures);
|
|
771
|
+
const techPrd = readText(rootDir, 'docs/product-specs/MVP3-ARCHITECTURE-REDESIGN-TECH-PRD.md', failures);
|
|
772
|
+
|
|
773
|
+
if (productSpecsReadme) {
|
|
774
|
+
validateSnippets(
|
|
775
|
+
productSpecsReadme,
|
|
776
|
+
'docs/product-specs/README.md active specs index',
|
|
777
|
+
[
|
|
778
|
+
'## 当前有效规格',
|
|
779
|
+
'`MVP3-ARCHITECTURE-COMPARISON.md`',
|
|
780
|
+
'`MVP3-ARCHITECTURE-REDESIGN-PRD.md`',
|
|
781
|
+
'`MVP3-ARCHITECTURE-REDESIGN-TECH-PRD.md`'
|
|
782
|
+
],
|
|
783
|
+
[
|
|
784
|
+
'当前活跃产品规格暂为空'
|
|
785
|
+
],
|
|
786
|
+
failures
|
|
787
|
+
);
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
if (comparison) {
|
|
791
|
+
validateSnippets(
|
|
792
|
+
comparison,
|
|
793
|
+
'docs/product-specs/MVP3-ARCHITECTURE-COMPARISON.md baseline',
|
|
794
|
+
[
|
|
795
|
+
'# MVP3 架构对比:历史设计目标 vs v1.3 已落地基线',
|
|
796
|
+
'`src/server/` 保留为**内部架构层**;公共 `server` 命令已移除',
|
|
797
|
+
'`filesystem` / `memory` / `kuzudb` / `auto` 为正式 surface;`neo4j` 已退出正式支持',
|
|
798
|
+
'当前公开能力仅保留 analysis-only:`find → read → link → show`',
|
|
799
|
+
'Java / Rust / C/C++ 等更多 parser 实现 | 接口预留,未作为当前 shipped reality |'
|
|
800
|
+
],
|
|
801
|
+
[
|
|
802
|
+
'# MVP3 架构对比:Before vs After',
|
|
803
|
+
'cli/commands/viz.ts',
|
|
804
|
+
'支持 14 种语言'
|
|
805
|
+
],
|
|
806
|
+
failures
|
|
807
|
+
);
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
if (prd) {
|
|
811
|
+
validateSnippets(
|
|
812
|
+
prd,
|
|
813
|
+
'docs/product-specs/MVP3-ARCHITECTURE-REDESIGN-PRD.md shipped baseline',
|
|
814
|
+
[
|
|
815
|
+
'# CodeMap MVP3 架构重构产品需求文档(PRD,v1.3 同步版)',
|
|
816
|
+
'公共 CLI 不再暴露 `server`、`watch`、`report`、`logs`',
|
|
817
|
+
'| `neo4j` | removed | 不再是正式支持 backend;旧配置返回显式迁移错误 |',
|
|
818
|
+
'`workflow` 是 **analysis-only** 能力,只编排 `find → read → link → show`',
|
|
819
|
+
'| 公共 HTTP API / `mycodemap server` 产品面 | Deferred |'
|
|
820
|
+
],
|
|
821
|
+
[
|
|
822
|
+
'支持 14 种语言',
|
|
823
|
+
'neo4j | shipped'
|
|
824
|
+
],
|
|
825
|
+
failures
|
|
826
|
+
);
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
if (techPrd) {
|
|
830
|
+
validateSnippets(
|
|
831
|
+
techPrd,
|
|
832
|
+
'docs/product-specs/MVP3-ARCHITECTURE-REDESIGN-TECH-PRD.md technical baseline',
|
|
833
|
+
[
|
|
834
|
+
'# CodeMap MVP3 架构重构技术需求文档(Tech-PRD,v1.3 同步版)',
|
|
835
|
+
'`neo4j` 已不再是正式支持 backend。',
|
|
836
|
+
'`auto` 是稳定配置面',
|
|
837
|
+
'但“按规模自动切到图数据库”的更强启发式仍是未来候选,而不是当前完成能力',
|
|
838
|
+
'| analyze / refresh / incremental update 作为公共能力 | 明确返回 `501` unsupported |',
|
|
839
|
+
'`workflow` 当前是 analysis-only 能力:'
|
|
840
|
+
],
|
|
841
|
+
[
|
|
842
|
+
'TypeScriptParser, GoParser, PythonParser, ParserRegistry'
|
|
843
|
+
],
|
|
844
|
+
failures
|
|
845
|
+
);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
|
|
136
849
|
function validateGuardrailDocs(rootDir, failures) {
|
|
137
850
|
const readme = readText(rootDir, 'README.md', failures);
|
|
138
851
|
const engineeringRule = readText(rootDir, 'docs/rules/engineering-with-codex-openai.md', failures);
|
|
@@ -219,8 +932,15 @@ function validateDocs(rootDir) {
|
|
|
219
932
|
const failures = [];
|
|
220
933
|
|
|
221
934
|
validatePackageScripts(rootDir, failures);
|
|
935
|
+
validatePositioningBaselineDocs(rootDir, failures);
|
|
936
|
+
validateCliSurfaceDocs(rootDir, failures);
|
|
937
|
+
validateConfigDocs(rootDir, failures);
|
|
938
|
+
validatePluginRuntimeDocs(rootDir, failures);
|
|
939
|
+
validateGraphStorageDocs(rootDir, failures);
|
|
222
940
|
validateAnalyzeDocs(rootDir, failures);
|
|
223
941
|
validateTestingDocs(rootDir, failures);
|
|
942
|
+
validateWorkflowAndDiscoveryDocs(rootDir, failures);
|
|
943
|
+
validateProductSpecsDocs(rootDir, failures);
|
|
224
944
|
validateGuardrailDocs(rootDir, failures);
|
|
225
945
|
validateAssistantDocs(rootDir, failures);
|
|
226
946
|
|