@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/docs/ai-guide/OUTPUT.md
CHANGED
|
@@ -4,7 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Phase 1 契约基线
|
|
8
|
+
|
|
9
|
+
| 维度 | 目标态 | 当前 CLI 现实 |
|
|
10
|
+
|------|--------|---------------|
|
|
11
|
+
| 机器可读 | 机器可读优先,适合 AI/Agent 继续处理 | 多数命令仍通过 `--json` 显式返回结构化结果 |
|
|
12
|
+
| 人类可读 | 显式的人类阅读入口 | `analyze` 当前支持 `--output-mode human`,其余命令多保留现有文本输出 |
|
|
13
|
+
| analyze 收敛 | 输出契约应逐步收敛 | 当前公共契约已固定为 `find` / `read` / `link` / `show`,legacy alias 通过 `warnings[]` 暴露迁移提示 |
|
|
14
|
+
| 文件发现 | 扫描类命令共享一个文件发现模块 | 先尊重仓库 `.gitignore`,无 `.gitignore` 时回退到默认 `exclude` |
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 当前 CLI 现实:何时使用 --json
|
|
8
19
|
|
|
9
20
|
| 场景 | 使用 `--json` | 原因 |
|
|
10
21
|
|------|--------------|------|
|
|
@@ -17,6 +28,88 @@
|
|
|
17
28
|
|
|
18
29
|
---
|
|
19
30
|
|
|
31
|
+
## 文件发现契约
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
type DiscoveryFallbackExclude =
|
|
35
|
+
| "node_modules/**"
|
|
36
|
+
| "dist/**"
|
|
37
|
+
| "build/**"
|
|
38
|
+
| "coverage/**"
|
|
39
|
+
| "**/*.test.ts"
|
|
40
|
+
| "**/*.spec.ts"
|
|
41
|
+
| "**/*.d.ts";
|
|
42
|
+
|
|
43
|
+
interface DiscoveryContract {
|
|
44
|
+
gitignore: true;
|
|
45
|
+
fallbackExclude: DiscoveryFallbackExclude[];
|
|
46
|
+
sharedBy: ["generate", "analyze", "ci check-headers -d"];
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
> `generate`、`analyze` 与 `ci check-headers -d` 会共享同一个文件发现模块;若仓库没有 `.gitignore`,则回退到上面的默认排除列表。
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## generate / codemap.json 插件扩展字段
|
|
55
|
+
|
|
56
|
+
> 仅当 `mycodemap.config.json` **显式声明** `plugins` 段时,`generate` 输出才会包含 `pluginReport`。
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
interface PluginDiagnostic {
|
|
60
|
+
plugin?: string;
|
|
61
|
+
stage: "load" | "initialize" | "analyze" | "generate";
|
|
62
|
+
level: "warning" | "error";
|
|
63
|
+
message: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
interface PluginExecutionReport {
|
|
67
|
+
loadedPlugins: string[];
|
|
68
|
+
generatedFiles: string[];
|
|
69
|
+
metrics: Record<string, unknown>;
|
|
70
|
+
diagnostics: PluginDiagnostic[];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
interface CodeMap {
|
|
74
|
+
version: string;
|
|
75
|
+
generatedAt: string;
|
|
76
|
+
project: ProjectInfo;
|
|
77
|
+
summary: ProjectSummary;
|
|
78
|
+
modules: ModuleInfo[];
|
|
79
|
+
dependencies: DependencyGraph;
|
|
80
|
+
actualMode?: "fast" | "smart";
|
|
81
|
+
pluginReport?: PluginExecutionReport;
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 示例
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"pluginReport": {
|
|
90
|
+
"loadedPlugins": ["complexity-analyzer", "my-local-plugin"],
|
|
91
|
+
"generatedFiles": ["plugins/good.txt"],
|
|
92
|
+
"metrics": {
|
|
93
|
+
"complexity-analyzer": {
|
|
94
|
+
"complexityAnalysis": {
|
|
95
|
+
"totalCyclomaticComplexity": 17
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"diagnostics": [
|
|
100
|
+
{
|
|
101
|
+
"plugin": "my-local-plugin",
|
|
102
|
+
"stage": "analyze",
|
|
103
|
+
"level": "warning",
|
|
104
|
+
"message": "my-local-plugin warning"
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
20
113
|
## query 命令输出结构
|
|
21
114
|
|
|
22
115
|
### JSON 输出 (-j)
|
|
@@ -101,18 +194,24 @@ interface ContextLine {
|
|
|
101
194
|
|
|
102
195
|
## analyze 命令输出结构
|
|
103
196
|
|
|
197
|
+
> 当前 `analyze` 的公共契约为 `find` / `read` / `link` / `show`;legacy alias 会在输出中返回 `warnings[]`,其中 `refactor` 不在兼容白名单内。
|
|
198
|
+
|
|
104
199
|
### 标准 JSON 输出 (--json)
|
|
105
200
|
|
|
106
201
|
```typescript
|
|
202
|
+
type AnalyzeIntent = "find" | "read" | "link" | "show";
|
|
203
|
+
|
|
107
204
|
interface AnalyzeOutput {
|
|
108
205
|
schemaVersion: "v1.0.0";
|
|
109
|
-
intent:
|
|
206
|
+
intent: AnalyzeIntent;
|
|
110
207
|
tool: string;
|
|
111
208
|
confidence: {
|
|
112
209
|
score: number; // 0.0 - 1.0
|
|
113
210
|
level: "high" | "medium" | "low";
|
|
114
211
|
};
|
|
115
212
|
results: AnalyzeResult[];
|
|
213
|
+
warnings?: AnalyzeWarning[];
|
|
214
|
+
analysis?: ReadAnalysis | LinkAnalysis | ShowAnalysis;
|
|
116
215
|
metadata: {
|
|
117
216
|
total: number;
|
|
118
217
|
scope: "direct" | "transitive";
|
|
@@ -120,6 +219,15 @@ interface AnalyzeOutput {
|
|
|
120
219
|
};
|
|
121
220
|
}
|
|
122
221
|
|
|
222
|
+
interface AnalyzeWarning {
|
|
223
|
+
code: "deprecated-intent";
|
|
224
|
+
severity: "warning";
|
|
225
|
+
message: string;
|
|
226
|
+
deprecatedIntent: "impact" | "dependency" | "search" | "documentation" | "complexity" | "overview" | "reference";
|
|
227
|
+
replacementIntent: AnalyzeIntent;
|
|
228
|
+
sunsetPolicy: "2-minor-window";
|
|
229
|
+
}
|
|
230
|
+
|
|
123
231
|
interface AnalyzeResult {
|
|
124
232
|
file: string;
|
|
125
233
|
location?: {
|
|
@@ -131,10 +239,66 @@ interface AnalyzeResult {
|
|
|
131
239
|
relevance: number; // 0.0 - 1.0
|
|
132
240
|
metadata?: {
|
|
133
241
|
testFile?: string; // 关联的测试文件
|
|
134
|
-
|
|
135
|
-
|
|
242
|
+
dependencies?: string[];
|
|
243
|
+
impactCount?: number;
|
|
244
|
+
complexityMetrics?: {
|
|
245
|
+
cyclomatic: number;
|
|
246
|
+
cognitive: number;
|
|
247
|
+
maintainability: number;
|
|
248
|
+
};
|
|
249
|
+
riskLevel?: "high" | "medium" | "low";
|
|
250
|
+
[key: string]: unknown;
|
|
136
251
|
};
|
|
137
252
|
}
|
|
253
|
+
|
|
254
|
+
interface ReadAnalysis {
|
|
255
|
+
intent: "read";
|
|
256
|
+
impact?: Array<{
|
|
257
|
+
file: string;
|
|
258
|
+
changedFiles: string[];
|
|
259
|
+
transitiveDependencies: string[];
|
|
260
|
+
impactCount: number;
|
|
261
|
+
risk: "high" | "medium" | "low";
|
|
262
|
+
}>;
|
|
263
|
+
complexity?: Array<{
|
|
264
|
+
file: string;
|
|
265
|
+
metrics: {
|
|
266
|
+
cyclomatic: number;
|
|
267
|
+
cognitive: number;
|
|
268
|
+
maintainability: number;
|
|
269
|
+
};
|
|
270
|
+
risk: "high" | "medium" | "low";
|
|
271
|
+
}>;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
interface LinkAnalysis {
|
|
275
|
+
intent: "link";
|
|
276
|
+
reference?: Array<{
|
|
277
|
+
target: string;
|
|
278
|
+
callers: string[];
|
|
279
|
+
callees: string[];
|
|
280
|
+
}>;
|
|
281
|
+
dependency?: Array<{
|
|
282
|
+
file: string;
|
|
283
|
+
imports: string[];
|
|
284
|
+
importedBy: string[];
|
|
285
|
+
}>;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
interface ShowAnalysis {
|
|
289
|
+
intent: "show";
|
|
290
|
+
overview?: Array<{
|
|
291
|
+
title: string;
|
|
292
|
+
file: string;
|
|
293
|
+
overview: string;
|
|
294
|
+
exports: string[];
|
|
295
|
+
}>;
|
|
296
|
+
documentation?: Array<{
|
|
297
|
+
title: string;
|
|
298
|
+
file: string;
|
|
299
|
+
content: string;
|
|
300
|
+
}>;
|
|
301
|
+
}
|
|
138
302
|
```
|
|
139
303
|
|
|
140
304
|
### 纯结构化输出 (--structured --json)
|
|
@@ -144,13 +308,15 @@ interface AnalyzeResult {
|
|
|
144
308
|
```typescript
|
|
145
309
|
interface StructuredAnalyzeOutput {
|
|
146
310
|
schemaVersion: "v1.0.0";
|
|
147
|
-
intent:
|
|
311
|
+
intent: AnalyzeIntent;
|
|
148
312
|
tool: string;
|
|
149
313
|
confidence: {
|
|
150
314
|
score: number;
|
|
151
315
|
level: "high" | "medium" | "low";
|
|
152
316
|
};
|
|
153
317
|
results: StructuredResult[];
|
|
318
|
+
warnings?: AnalyzeWarning[];
|
|
319
|
+
analysis?: ReadAnalysis | LinkAnalysis | ShowAnalysis;
|
|
154
320
|
metadata: {
|
|
155
321
|
total: number;
|
|
156
322
|
scope: string;
|
|
@@ -168,7 +334,7 @@ interface StructuredResult {
|
|
|
168
334
|
// 注意:没有 content 字段
|
|
169
335
|
relevance: number;
|
|
170
336
|
metadata?: {
|
|
171
|
-
[key: string]:
|
|
337
|
+
[key: string]: unknown;
|
|
172
338
|
};
|
|
173
339
|
}
|
|
174
340
|
```
|
|
@@ -178,12 +344,22 @@ interface StructuredResult {
|
|
|
178
344
|
```json
|
|
179
345
|
{
|
|
180
346
|
"schemaVersion": "v1.0.0",
|
|
181
|
-
"intent": "
|
|
182
|
-
"tool": "codemap-
|
|
347
|
+
"intent": "read",
|
|
348
|
+
"tool": "codemap-read",
|
|
183
349
|
"confidence": {
|
|
184
350
|
"score": 0.85,
|
|
185
351
|
"level": "high"
|
|
186
352
|
},
|
|
353
|
+
"warnings": [
|
|
354
|
+
{
|
|
355
|
+
"code": "deprecated-intent",
|
|
356
|
+
"severity": "warning",
|
|
357
|
+
"message": "legacy intent \"impact\" 已弃用,请改用 \"read\"",
|
|
358
|
+
"deprecatedIntent": "impact",
|
|
359
|
+
"replacementIntent": "read",
|
|
360
|
+
"sunsetPolicy": "2-minor-window"
|
|
361
|
+
}
|
|
362
|
+
],
|
|
187
363
|
"results": [
|
|
188
364
|
{
|
|
189
365
|
"file": "src/cli/commands/analyze.ts",
|
|
@@ -192,13 +368,33 @@ interface StructuredResult {
|
|
|
192
368
|
"line": 45,
|
|
193
369
|
"column": 1
|
|
194
370
|
},
|
|
195
|
-
"content": "
|
|
371
|
+
"content": "被 3 个模块依赖",
|
|
196
372
|
"relevance": 0.95,
|
|
197
373
|
"metadata": {
|
|
198
|
-
"
|
|
374
|
+
"impactCount": 3,
|
|
375
|
+
"dependencies": [
|
|
376
|
+
"src/orchestrator/intent-router.ts"
|
|
377
|
+
],
|
|
378
|
+
"riskLevel": "medium"
|
|
199
379
|
}
|
|
200
380
|
}
|
|
201
381
|
],
|
|
382
|
+
"analysis": {
|
|
383
|
+
"intent": "read",
|
|
384
|
+
"impact": [
|
|
385
|
+
{
|
|
386
|
+
"file": "src/cli/commands/analyze.ts",
|
|
387
|
+
"changedFiles": [
|
|
388
|
+
"src/cli/commands/analyze.ts"
|
|
389
|
+
],
|
|
390
|
+
"transitiveDependencies": [
|
|
391
|
+
"src/orchestrator/intent-router.ts"
|
|
392
|
+
],
|
|
393
|
+
"impactCount": 3,
|
|
394
|
+
"risk": "medium"
|
|
395
|
+
}
|
|
396
|
+
]
|
|
397
|
+
},
|
|
202
398
|
"metadata": {
|
|
203
399
|
"total": 8,
|
|
204
400
|
"scope": "transitive",
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
# AI Guide - 使用模式与最佳实践
|
|
2
2
|
|
|
3
3
|
> 标准工作流模式和输出处理最佳实践
|
|
4
|
+
>
|
|
5
|
+
> CodeMap 的首屏产品面是代码地图与代码分析。`workflow` 是当前公开的 analysis-only 工作流能力,本文件会明确区分核心分析模式与 workflow 编排模式。
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 使用边界速查
|
|
10
|
+
|
|
11
|
+
| 类别 | 说明 |
|
|
12
|
+
|------|------|
|
|
13
|
+
| 核心模式 | `generate`、`query`、`deps`、`impact`、`complexity`、`cycles`、`export`、`ci` |
|
|
14
|
+
| 工作流模式 | `workflow` 仍公开,但不是 AI-first 首次接触项目的主入口 |
|
|
15
|
+
| 输出契约 | 当前多数命令显式加 `--json` 获取机器可读结果;`analyze` 可切换 `--output-mode machine|human` |
|
|
4
16
|
|
|
5
17
|
---
|
|
6
18
|
|
|
@@ -48,13 +60,13 @@ node dist/cli/index.js deps -m "src" -j
|
|
|
48
60
|
|
|
49
61
|
```bash
|
|
50
62
|
# Step 1: 搜索相关代码
|
|
51
|
-
node dist/cli/index.js analyze -i
|
|
63
|
+
node dist/cli/index.js analyze -i find -k "相关关键词" --json
|
|
52
64
|
|
|
53
65
|
# Step 2: 分析影响范围(如果有修改现有代码)
|
|
54
|
-
node dist/cli/index.js analyze -i
|
|
66
|
+
node dist/cli/index.js analyze -i read -t "目标文件" --include-tests --json
|
|
55
67
|
|
|
56
68
|
# Step 3: 检查复杂度(选择最佳实现位置)
|
|
57
|
-
node dist/cli/index.js analyze -i
|
|
69
|
+
node dist/cli/index.js analyze -i read -t "候选目录" --json
|
|
58
70
|
|
|
59
71
|
# Step 4: 实现代码
|
|
60
72
|
# - 遵循文件头规范
|
|
@@ -85,13 +97,13 @@ npm test
|
|
|
85
97
|
node dist/cli/index.js cycles -j
|
|
86
98
|
|
|
87
99
|
# Step 2: 分析目标模块复杂度
|
|
88
|
-
node dist/cli/index.js analyze -i
|
|
100
|
+
node dist/cli/index.js analyze -i read -t "目标模块" --json
|
|
89
101
|
|
|
90
102
|
# Step 3: 评估影响范围
|
|
91
|
-
node dist/cli/index.js analyze -i
|
|
103
|
+
node dist/cli/index.js analyze -i read -t "目标文件" --scope transitive --json
|
|
92
104
|
|
|
93
|
-
# Step 4:
|
|
94
|
-
node dist/cli/index.js analyze -i
|
|
105
|
+
# Step 4: 补充依赖上下文
|
|
106
|
+
node dist/cli/index.js analyze -i link -t "目标模块" --json
|
|
95
107
|
|
|
96
108
|
# Step 5: 执行重构
|
|
97
109
|
|
|
@@ -99,7 +111,7 @@ node dist/cli/index.js analyze -i refactor -t "目标模块" --json
|
|
|
99
111
|
node dist/cli/index.js cycles -j
|
|
100
112
|
|
|
101
113
|
# Step 7: 验证复杂度降低
|
|
102
|
-
node dist/cli/index.js analyze -i
|
|
114
|
+
node dist/cli/index.js analyze -i read -t "目标模块" --json
|
|
103
115
|
|
|
104
116
|
# Step 8: 运行测试
|
|
105
117
|
npm test
|
|
@@ -129,7 +141,7 @@ node dist/cli/index.js impact -f "问题文件" --transitive -j
|
|
|
129
141
|
node dist/cli/index.js query -s "相关测试" --include-references -j
|
|
130
142
|
|
|
131
143
|
# Step 4: 搜索相似代码(防止同类问题)
|
|
132
|
-
node dist/cli/index.js analyze -i
|
|
144
|
+
node dist/cli/index.js analyze -i find -k "问题模式" --json
|
|
133
145
|
|
|
134
146
|
# Step 5: 修复 Bug
|
|
135
147
|
|
|
@@ -170,7 +182,7 @@ npm test
|
|
|
170
182
|
|
|
171
183
|
---
|
|
172
184
|
|
|
173
|
-
### 模式 F:
|
|
185
|
+
### 模式 F: 复杂分析任务(analysis-only workflow)
|
|
174
186
|
|
|
175
187
|
**适用场景**: 需要多步骤完成的复杂开发任务
|
|
176
188
|
|
|
@@ -197,14 +209,51 @@ node dist/cli/index.js workflow checkpoint
|
|
|
197
209
|
# Step 7: 重复直到完成
|
|
198
210
|
```
|
|
199
211
|
|
|
200
|
-
|
|
201
|
-
1. `
|
|
202
|
-
2. `
|
|
203
|
-
3. `
|
|
204
|
-
4. `
|
|
212
|
+
**当前工作流阶段**:
|
|
213
|
+
1. `find` - 查找候选符号、文件与关键词线索
|
|
214
|
+
2. `read` - 阅读影响范围、复杂度与上下文
|
|
215
|
+
3. `link` - 汇总依赖、引用与关联关系
|
|
216
|
+
4. `show` - 生成概览、摘要与展示型结果
|
|
205
217
|
5. `commit` - 提交验证
|
|
206
218
|
6. `ci` - CI 验证
|
|
207
219
|
|
|
220
|
+
> 说明:以上是当前公开实现,不代表最终收敛模型;如果只需要代码地图能力,优先使用前面几个核心分析模式。
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
### 模式 G: 切换图存储后端
|
|
225
|
+
|
|
226
|
+
**适用场景**: 需要把 CodeGraph 从默认文件系统存储切到 KùzuDB,或验证 graph backend 是否真正生效
|
|
227
|
+
|
|
228
|
+
**执行步骤**:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
# Step 1: 编辑配置文件
|
|
232
|
+
cat mycodemap.config.json
|
|
233
|
+
|
|
234
|
+
# Step 2: 选择后端
|
|
235
|
+
# {
|
|
236
|
+
# "storage": {
|
|
237
|
+
# "type": "kuzudb",
|
|
238
|
+
# "databasePath": ".codemap/kuzu"
|
|
239
|
+
# }
|
|
240
|
+
# }
|
|
241
|
+
|
|
242
|
+
# Step 3: 如需 Kùzu 图数据库后端,安装可选依赖
|
|
243
|
+
npm install kuzu
|
|
244
|
+
|
|
245
|
+
# Step 4: 重新生成代码地图
|
|
246
|
+
node dist/cli/index.js generate
|
|
247
|
+
|
|
248
|
+
# Step 5: 验证同一 backend 可被读取
|
|
249
|
+
node dist/cli/index.js export json -o /tmp/codemap.json
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**决策要点**:
|
|
253
|
+
- 旧的 `neo4j` 配置现在应该直接报迁移错误;缺少 `kuzu` 时也应看到显式错误,而不是静默 fallback。
|
|
254
|
+
- `storage.type = "auto"` 当前仍保守落到 `filesystem`,不要把阈值字段误读成已上线自动切换。
|
|
255
|
+
- 图存储生产化只收口存储面,不重新开放公共 HTTP API 产品面。
|
|
256
|
+
|
|
208
257
|
---
|
|
209
258
|
|
|
210
259
|
## 输出处理模式
|
package/docs/ai-guide/PROMPTS.md
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
3. **获取详细信息**
|
|
25
25
|
```bash
|
|
26
|
-
node dist/cli/index.js analyze -i
|
|
26
|
+
node dist/cli/index.js analyze -i show -t "src/" --json
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
4. **回答以下问题**
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
|
|
54
54
|
1. **影响分析**
|
|
55
55
|
```bash
|
|
56
|
-
node dist/cli/index.js analyze -i
|
|
56
|
+
node dist/cli/index.js analyze -i read -t "{{FILE_PATH}}" --scope transitive --include-tests --json
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
2. **分析结果**
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
|
|
104
104
|
3. **如果仍不足,使用统一搜索**
|
|
105
105
|
```bash
|
|
106
|
-
node dist/cli/index.js analyze -i
|
|
106
|
+
node dist/cli/index.js analyze -i find -k "{{KEYWORD}}" --topK 15 --json
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
4. **汇总结果**
|
|
@@ -137,17 +137,17 @@
|
|
|
137
137
|
1. **检测现有问题**
|
|
138
138
|
```bash
|
|
139
139
|
node dist/cli/index.js cycles -j
|
|
140
|
-
node dist/cli/index.js analyze -i
|
|
140
|
+
node dist/cli/index.js analyze -i read -t "{{MODULE_PATH}}" --json
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
2.
|
|
143
|
+
2. **补充模块上下文**
|
|
144
144
|
```bash
|
|
145
|
-
node dist/cli/index.js analyze -i
|
|
145
|
+
node dist/cli/index.js analyze -i link -t "{{MODULE_PATH}}" --json
|
|
146
146
|
```
|
|
147
147
|
|
|
148
148
|
3. **评估影响范围**
|
|
149
149
|
```bash
|
|
150
|
-
node dist/cli/index.js analyze -i
|
|
150
|
+
node dist/cli/index.js analyze -i read -t "{{MODULE_PATH}}" --scope transitive --json
|
|
151
151
|
```
|
|
152
152
|
|
|
153
153
|
4. **生成评估报告**
|
|
@@ -253,7 +253,7 @@
|
|
|
253
253
|
|
|
254
254
|
1. **依赖分析**
|
|
255
255
|
```bash
|
|
256
|
-
node dist/cli/index.js analyze -i
|
|
256
|
+
node dist/cli/index.js analyze -i link -t "{{MODULE_PATH}}" --json
|
|
257
257
|
```
|
|
258
258
|
|
|
259
259
|
2. **循环依赖检测**
|
|
@@ -301,7 +301,7 @@
|
|
|
301
301
|
|
|
302
302
|
1. **整体复杂度分析**
|
|
303
303
|
```bash
|
|
304
|
-
node dist/cli/index.js analyze -i
|
|
304
|
+
node dist/cli/index.js analyze -i read -t "src/" --json
|
|
305
305
|
```
|
|
306
306
|
|
|
307
307
|
2. **函数级复杂度**(针对复杂文件)
|
|
@@ -342,7 +342,7 @@
|
|
|
342
342
|
|
|
343
343
|
1. **相关代码搜索**
|
|
344
344
|
```bash
|
|
345
|
-
node dist/cli/index.js analyze -i
|
|
345
|
+
node dist/cli/index.js analyze -i find -k "{{RELATED_KEYWORD}}" --topK 10 --json
|
|
346
346
|
```
|
|
347
347
|
|
|
348
348
|
2. **参考现有实现**
|
|
@@ -350,13 +350,13 @@
|
|
|
350
350
|
|
|
351
351
|
3. **确定实现位置**
|
|
352
352
|
```bash
|
|
353
|
-
node dist/cli/index.js analyze -i
|
|
353
|
+
node dist/cli/index.js analyze -i read -t "候选目录" --json
|
|
354
354
|
```
|
|
355
355
|
选择复杂度最低的模块
|
|
356
356
|
|
|
357
357
|
4. **影响分析**(如果需要修改现有代码)
|
|
358
358
|
```bash
|
|
359
|
-
node dist/cli/index.js analyze -i
|
|
359
|
+
node dist/cli/index.js analyze -i read -t "目标文件" --json
|
|
360
360
|
```
|
|
361
361
|
|
|
362
362
|
5. **实现步骤**
|
|
@@ -394,6 +394,7 @@
|
|
|
394
394
|
| 看模块关系 | 模板 6: 依赖分析 |
|
|
395
395
|
| 找复杂代码 | 模板 7: 复杂度分析 |
|
|
396
396
|
| 做新功能 | 模板 8: 新功能实现 |
|
|
397
|
+
| 验证自动发布 | 模板 9: ship 发布验证 |
|
|
397
398
|
|
|
398
399
|
### 如何自定义模板
|
|
399
400
|
|
|
@@ -412,3 +413,40 @@
|
|
|
412
413
|
→ 变更影响分析 (模板 2)
|
|
413
414
|
→ 代码审查 (模板 5)
|
|
414
415
|
```
|
|
416
|
+
|
|
417
|
+
---
|
|
418
|
+
|
|
419
|
+
## 模板 9: ship 发布验证
|
|
420
|
+
|
|
421
|
+
**适用场景**: 需要验证 `codemap ship` 是否会通过 tag push 触发 GitHub Actions,而不是本地直接发布
|
|
422
|
+
|
|
423
|
+
```markdown
|
|
424
|
+
我需要验证 `codemap ship` 的自动发布链路是否完整。
|
|
425
|
+
|
|
426
|
+
请执行以下步骤:
|
|
427
|
+
|
|
428
|
+
1. **先做预检查**
|
|
429
|
+
```bash
|
|
430
|
+
npm run docs:check:pre-release
|
|
431
|
+
npm run build
|
|
432
|
+
npm test
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
2. **做无副作用预演**
|
|
436
|
+
```bash
|
|
437
|
+
node dist/cli/index.js ship --dry-run
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
3. **确认发布路径**
|
|
441
|
+
- 必须是:版本提交 → git tag → `git push` → GitHub Actions → OIDC 发布
|
|
442
|
+
- 不允许:本地直接执行 `npm publish`
|
|
443
|
+
|
|
444
|
+
4. **正式执行**
|
|
445
|
+
```bash
|
|
446
|
+
node dist/cli/index.js ship --yes
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
5. **核验结果**
|
|
450
|
+
- 记录 tag 名称、workflow run URL、GitHub Release URL
|
|
451
|
+
- 如果失败,记录失败的 job/step,并定位根因
|
|
452
|
+
```
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# AI Guide - 快速开始
|
|
2
2
|
|
|
3
3
|
> AI/Agent 使用 CodeMap 的快速入门和决策指南
|
|
4
|
+
>
|
|
5
|
+
> CodeMap 是一个 AI-first 代码地图工具:AI/Agent 是主要消费者,代码分析是首屏产品面。
|
|
4
6
|
|
|
5
7
|
---
|
|
6
8
|
|
|
@@ -10,7 +12,8 @@
|
|
|
10
12
|
# Step 1: 生成代码地图(必须在其他命令之前执行)
|
|
11
13
|
node dist/cli/index.js generate
|
|
12
14
|
|
|
13
|
-
# Step 2: 阅读生成的 AI_MAP.md
|
|
15
|
+
# Step 2: 阅读生成的 AI_MAP.md 获取项目概览(若显式配置了 plugins,也要看 Plugin Summary)
|
|
16
|
+
# stdout 还会显示当前写入的 `MVP3 Storage (...)`
|
|
14
17
|
cat .mycodemap/AI_MAP.md
|
|
15
18
|
|
|
16
19
|
# Step 3: 根据任务选择命令...
|
|
@@ -18,6 +21,16 @@ cat .mycodemap/AI_MAP.md
|
|
|
18
21
|
|
|
19
22
|
---
|
|
20
23
|
|
|
24
|
+
## 输出契约速查
|
|
25
|
+
|
|
26
|
+
| 维度 | 目标态 | 当前 CLI 现实 | 使用建议 |
|
|
27
|
+
|------|--------|---------------|----------|
|
|
28
|
+
| 机器可读 | 机器可读优先 | 多数命令显式使用 `--json`;`analyze` 也可 `--output-mode machine` | 交给 AI/Agent 继续处理时优先结构化结果 |
|
|
29
|
+
| 人类可读 | 显式人类阅读模式 | `analyze` 支持 `--output-mode human`;其余命令多保留现有文本输出 | 人工审阅时使用 |
|
|
30
|
+
| 边界命名 | `Server Layer` 是内部架构层 | 公共 `mycodemap server` 命令已从 public CLI 移除 | 不要把两者混为一谈 |
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
21
34
|
## 命令选择决策树
|
|
22
35
|
|
|
23
36
|
```
|
|
@@ -30,22 +43,22 @@ cat .mycodemap/AI_MAP.md
|
|
|
30
43
|
├── 是 → mycodemap query -s "SymbolName"
|
|
31
44
|
↓ 否
|
|
32
45
|
需要修改某个文件?
|
|
33
|
-
├── 是 → mycodemap impact -f "path/to/file" --transitive
|
|
46
|
+
├── 是 → mycodemap impact -f "path/to/file" --transitive -j
|
|
34
47
|
↓ 否
|
|
35
48
|
需要理解模块依赖关系?
|
|
36
|
-
├── 是 → mycodemap
|
|
49
|
+
├── 是 → mycodemap deps -m "src/module" -j
|
|
37
50
|
↓ 否
|
|
38
51
|
需要评估代码质量/复杂度?
|
|
39
|
-
├── 是 → mycodemap
|
|
52
|
+
├── 是 → mycodemap complexity -f "src/file.ts" -j
|
|
40
53
|
↓ 否
|
|
41
54
|
需要搜索包含特定关键词的代码?
|
|
42
|
-
├── 是 → mycodemap
|
|
55
|
+
├── 是 → mycodemap query -S "keyword" -j
|
|
43
56
|
↓ 否
|
|
44
|
-
|
|
57
|
+
需要执行复杂的多步骤分析?
|
|
45
58
|
├── 是 → mycodemap workflow start "任务描述"
|
|
46
59
|
↓ 否
|
|
47
60
|
需要验证代码是否符合规范?
|
|
48
|
-
└── 是 → mycodemap ci check-headers
|
|
61
|
+
└── 是 → mycodemap ci check-docs-sync / ci check-headers
|
|
49
62
|
```
|
|
50
63
|
|
|
51
64
|
---
|
|
@@ -54,14 +67,16 @@ cat .mycodemap/AI_MAP.md
|
|
|
54
67
|
|
|
55
68
|
| 用户意图 | 推荐命令 | 备选命令 | 输出格式 |
|
|
56
69
|
|---------|---------|---------|---------|
|
|
57
|
-
| "项目结构是什么" | `generate` + 读 `AI_MAP.md` | `analyze -i
|
|
70
|
+
| "项目结构是什么" | `generate` + 读 `AI_MAP.md` | `analyze -i show -t "src/" --json` | 文本 |
|
|
71
|
+
| "插件是否真的加载成功" | `generate` + 读 `AI_MAP.md` 的 `Plugin Summary` | 解析 `.mycodemap/codemap.json` 的 `pluginReport` | 机器可读优先 |
|
|
72
|
+
| "需要切换/排查图存储后端" | 编辑 `mycodemap.config.json.storage` 后运行 `generate` | `export json` 验证是否能从同一 backend 读回 | 文本 + 机器可读 |
|
|
58
73
|
| "XXX 在哪里定义" | `query -s "XXX"` | `query -S "XXX"` | 文本 |
|
|
59
|
-
| "修改 XXX 会影响什么" | `impact -f "XXX" -t` | `analyze -i
|
|
60
|
-
| "XXX 模块依赖什么" | `
|
|
61
|
-
| "代码质量如何" | `analyze -i
|
|
62
|
-
| "查找与 XXX 相关的代码" | `
|
|
63
|
-
| "这个改动安全吗" | `ci assess-risk` | `analyze -i
|
|
64
|
-
| "需要重构建议" | `analyze -i
|
|
74
|
+
| "修改 XXX 会影响什么" | `impact -f "XXX" -t -j` | `analyze -i read -t "XXX" --scope transitive --json` | 机器可读优先 |
|
|
75
|
+
| "XXX 模块依赖什么" | `deps -m "XXX" -j` | `analyze -i link -t "XXX" --json` | 机器可读优先 |
|
|
76
|
+
| "代码质量如何" | `complexity -f "src/file.ts" -j` | `analyze -i read -t "src/file.ts" --json` | 机器可读优先 |
|
|
77
|
+
| "查找与 XXX 相关的代码" | `query -S "XXX" -j` | `analyze -i find -k "XXX" --json` | 机器可读优先 |
|
|
78
|
+
| "这个改动安全吗" | `ci assess-risk` | `analyze -i read -t "目标文件" --scope transitive --json` | 文本 |
|
|
79
|
+
| "需要重构建议" | `cycles` + `complexity` | `analyze -i read -t "src/" --json` | 机器可读优先 |
|
|
65
80
|
| "查找循环依赖" | `cycles` | - | 文本 |
|
|
66
81
|
| "有哪些测试文件" | `query -S ".test.ts"` | - | 文本 |
|
|
67
82
|
|
|
@@ -96,14 +111,14 @@ cat .mycodemap/AI_MAP.md
|
|
|
96
111
|
|------|------|---------|
|
|
97
112
|
| 代码地图生成 | `generate` | 首次理解项目结构 |
|
|
98
113
|
| 符号查询 | `query -s` | 查找类/函数定义位置 |
|
|
99
|
-
| 依赖分析 | `deps` / `analyze -i
|
|
100
|
-
| 影响分析 | `impact` / `analyze -i
|
|
101
|
-
| 复杂度分析 | `complexity` / `analyze -i
|
|
114
|
+
| 依赖分析 | `deps` / `analyze -i link` | 理解模块关系 |
|
|
115
|
+
| 影响分析 | `impact` / `analyze -i read` | 评估变更范围 |
|
|
116
|
+
| 复杂度分析 | `complexity` / `analyze -i read` | 识别复杂代码 |
|
|
102
117
|
| 循环依赖检测 | `cycles` | 发现架构问题 |
|
|
103
118
|
| 统一分析 | `analyze` | 多意图智能路由 |
|
|
119
|
+
| 结果导出 | `export` | 导出 JSON / GraphML / Mermaid |
|
|
104
120
|
| CI 门禁 | `ci` | 代码质量检查 |
|
|
105
|
-
|
|
|
106
|
-
| HTTP API | `server` | 远程访问分析能力 |
|
|
121
|
+
| 工作流编排(analysis-only) | `workflow` | 复杂分析任务管理 |
|
|
107
122
|
|
|
108
123
|
---
|
|
109
124
|
|
|
@@ -112,3 +127,4 @@ cat .mycodemap/AI_MAP.md
|
|
|
112
127
|
- 需要完整命令参数?查看 [COMMANDS.md](./COMMANDS.md)
|
|
113
128
|
- 需要解析 JSON 输出?查看 [OUTPUT.md](./OUTPUT.md)
|
|
114
129
|
- 需要即用型提示词?查看 [PROMPTS.md](./PROMPTS.md)
|
|
130
|
+
- 需要理解哪些命令仍属边界/兼容 surface?查看 [COMMANDS.md](./COMMANDS.md) 中的边界说明
|