@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
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# AI Guide - 命令参考
|
|
2
2
|
|
|
3
3
|
> 完整的 CLI 命令详解
|
|
4
|
+
>
|
|
5
|
+
> CodeMap 是 AI-first 代码地图工具。以下文档记录当前公开命令,并补充已移除命令的迁移提示。
|
|
6
|
+
> 当前 CLI 过渡现实:多数命令显式使用 `--json` 输出机器可读结果;`analyze` 额外支持 `--output-mode machine|human`。
|
|
4
7
|
|
|
5
8
|
---
|
|
6
9
|
|
|
@@ -27,6 +30,17 @@ mycodemap generate --ai-context # 生成 AI 描述
|
|
|
27
30
|
- `smart`: AST 分析,较慢,信息完整
|
|
28
31
|
- `hybrid`: 自动选择,文件<50用fast,≥50用smart
|
|
29
32
|
|
|
33
|
+
**插件运行时说明**:
|
|
34
|
+
- `generate` 不提供独立 `--plugin` flags;插件通过 `mycodemap.config.json` 的 `plugins` 段声明。
|
|
35
|
+
- 只有显式存在 `plugins` 段时,`generate` 才会加载插件并运行 analyze / generate hooks。
|
|
36
|
+
- `AI_MAP.md` 会增加 `Plugin Summary`,`codemap.json` 会增加 `pluginReport`,stdout 会输出插件诊断摘要。
|
|
37
|
+
|
|
38
|
+
**图存储运行时说明**:
|
|
39
|
+
- `generate` 会读取 `mycodemap.config.json.storage`,并把 CodeGraph 写入所选后端。
|
|
40
|
+
- `storage.type` 支持 `filesystem`、`kuzudb`、`memory`、`auto`;默认是 `filesystem`。
|
|
41
|
+
- 旧的 `neo4j` 配置会直接报迁移错误;缺少 `kuzu` 时也会直接报错,不会静默 fallback 到 `filesystem`。
|
|
42
|
+
- `storage.type = "auto"` 当前仍保守走 `filesystem`;阈值字段是配置契约,不代表自动切换已完成。
|
|
43
|
+
|
|
30
44
|
---
|
|
31
45
|
|
|
32
46
|
### query - 查询代码
|
|
@@ -127,67 +141,76 @@ mycodemap cycles -j # JSON 输出
|
|
|
127
141
|
|
|
128
142
|
## analyze - 统一分析入口
|
|
129
143
|
|
|
130
|
-
###
|
|
131
|
-
|
|
132
|
-
```bash
|
|
133
|
-
# 1. 影响分析
|
|
134
|
-
mycodemap analyze -i impact -t "src/index.ts"
|
|
135
|
-
mycodemap analyze -i impact -t "src/index.ts" --scope transitive
|
|
136
|
-
mycodemap analyze -i impact -t "src/index.ts" --include-tests
|
|
137
|
-
|
|
138
|
-
# 2. 依赖分析
|
|
139
|
-
mycodemap analyze -i dependency -t "src/orchestrator"
|
|
140
|
-
|
|
141
|
-
# 3. 复杂度分析
|
|
142
|
-
mycodemap analyze -i complexity -t "src/domain"
|
|
144
|
+
### 当前公共契约:4 种分析意图
|
|
143
145
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
146
|
+
| 维度 | 当前公共契约 | 兼容说明 |
|
|
147
|
+
|------|--------------|----------|
|
|
148
|
+
| 输出契约 | 多数命令显式 `--json`,`analyze` 额外提供 `--output-mode machine|human` | `--structured --json` 会移除自然语言 `content` |
|
|
149
|
+
| analyze 意图 | `find` / `read` / `link` / `show` | legacy alias 会在输出中返回 `warnings[]`;`refactor` 直接报 `E0001_INVALID_INTENT` |
|
|
147
150
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
mycodemap analyze -i
|
|
153
|
-
|
|
154
|
-
#
|
|
155
|
-
mycodemap analyze -i
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
151
|
+
<!-- BEGIN GENERATED: analyze-commands-intents -->
|
|
152
|
+
```bash
|
|
153
|
+
# 1. find - 查找符号 / 文本
|
|
154
|
+
mycodemap analyze -i find -k "UnifiedResult"
|
|
155
|
+
mycodemap analyze -i find -t "src/orchestrator" -k "IntentRouter" --topK 20
|
|
156
|
+
|
|
157
|
+
# 2. read - 阅读文件(影响 + 复杂度)
|
|
158
|
+
mycodemap analyze -i read -t "src/index.ts"
|
|
159
|
+
mycodemap analyze -i read -t "src/index.ts" --scope transitive
|
|
160
|
+
mycodemap analyze -i read -t "src/index.ts" --include-tests
|
|
161
|
+
|
|
162
|
+
# 3. link - 关联关系(依赖 + 引用)
|
|
163
|
+
mycodemap analyze -i link -t "src/orchestrator"
|
|
164
|
+
mycodemap analyze -i link -t "src/interface/types.ts" --json
|
|
165
|
+
|
|
166
|
+
# 4. show - 模块概览 / 文档
|
|
167
|
+
mycodemap analyze -i show -t "src/"
|
|
168
|
+
mycodemap analyze -i show -t "src/domain/services" --output-mode human
|
|
159
169
|
```
|
|
170
|
+
<!-- END GENERATED: analyze-commands-intents -->
|
|
160
171
|
|
|
161
172
|
### 输出选项
|
|
162
173
|
|
|
174
|
+
<!-- BEGIN GENERATED: analyze-commands-output -->
|
|
163
175
|
```bash
|
|
164
176
|
# JSON 输出
|
|
165
|
-
mycodemap analyze -i
|
|
177
|
+
mycodemap analyze -i read -t "src/index.ts" --json
|
|
166
178
|
|
|
167
179
|
# 纯结构化(移除自然语言字段)
|
|
168
|
-
mycodemap analyze -i
|
|
180
|
+
mycodemap analyze -i link -t "src/index.ts" --structured --json
|
|
169
181
|
|
|
170
182
|
# 机器可读模式
|
|
171
|
-
mycodemap analyze -i
|
|
183
|
+
mycodemap analyze -i show -t "src/index.ts" --output-mode machine
|
|
172
184
|
|
|
173
|
-
#
|
|
174
|
-
mycodemap analyze -i
|
|
185
|
+
# 人类可读模式
|
|
186
|
+
mycodemap analyze -i show -t "src/index.ts" --output-mode human
|
|
175
187
|
```
|
|
188
|
+
<!-- END GENERATED: analyze-commands-output -->
|
|
176
189
|
|
|
177
190
|
### 通用选项
|
|
178
191
|
|
|
192
|
+
<!-- BEGIN GENERATED: analyze-commands-options -->
|
|
179
193
|
| 选项 | 说明 | 默认值 |
|
|
180
194
|
|------|------|--------|
|
|
181
|
-
| `-i, --intent <type>` |
|
|
182
|
-
| `-t, --targets <paths...>` |
|
|
183
|
-
| `-k, --keywords <words...>` |
|
|
184
|
-
| `-s, --scope <scope>` |
|
|
195
|
+
| `-i, --intent <type>` | 分析类型:`find`/`read`/`link`/`show`(必填) | - |
|
|
196
|
+
| `-t, --targets <paths...>` | 目标路径(`read`/`link`/`show` 必填,`find` 可选) | - |
|
|
197
|
+
| `-k, --keywords <words...>` | 搜索关键词(主要用于 `find`) | - |
|
|
198
|
+
| `-s, --scope <scope>` | 范围:`direct`(直接)/`transitive`(传递) | `direct` |
|
|
185
199
|
| `-n, --topK <number>` | 返回结果数量 | `8` |
|
|
186
200
|
| `--include-tests` | 包含测试文件关联 | - |
|
|
187
|
-
| `--include-git-history` | 包含 Git
|
|
201
|
+
| `--include-git-history` | 包含 Git 历史分析 | - |
|
|
188
202
|
| `--json` | JSON 格式输出 | - |
|
|
189
|
-
| `--structured` |
|
|
190
|
-
| `--output-mode <mode>` |
|
|
203
|
+
| `--structured` | 纯结构化输出(移除自然语言字段,配合 `--json` 使用) | - |
|
|
204
|
+
| `--output-mode <mode>` | 输出模式:`machine`/`human` | `human` |
|
|
205
|
+
<!-- END GENERATED: analyze-commands-options -->
|
|
206
|
+
|
|
207
|
+
### legacy 兼容映射
|
|
208
|
+
|
|
209
|
+
- `search` → `find`
|
|
210
|
+
- `impact` / `complexity` → `read`
|
|
211
|
+
- `dependency` / `reference` → `link`
|
|
212
|
+
- `overview` / `documentation` → `show`
|
|
213
|
+
- `refactor` → `E0001_INVALID_INTENT`
|
|
191
214
|
|
|
192
215
|
---
|
|
193
216
|
|
|
@@ -196,6 +219,16 @@ mycodemap analyze -i impact -t "src/index.ts" --output-mode human
|
|
|
196
219
|
### 子命令
|
|
197
220
|
|
|
198
221
|
```bash
|
|
222
|
+
# 验证工作区是否干净
|
|
223
|
+
mycodemap ci check-working-tree
|
|
224
|
+
|
|
225
|
+
# 验证当前分支是否允许执行发布前检查
|
|
226
|
+
mycodemap ci check-branch
|
|
227
|
+
mycodemap ci check-branch --allow "main,release/*"
|
|
228
|
+
|
|
229
|
+
# 运行发布前脚本集合
|
|
230
|
+
mycodemap ci check-scripts
|
|
231
|
+
|
|
199
232
|
# 验证提交格式([TAG] scope: message)
|
|
200
233
|
mycodemap ci check-commits
|
|
201
234
|
mycodemap ci check-commits -c 5 # 最近 5 个提交
|
|
@@ -215,6 +248,8 @@ mycodemap ci assess-risk -f "changed.ts"
|
|
|
215
248
|
mycodemap ci check-docs-sync
|
|
216
249
|
mycodemap ci check-docs-sync --root "/path"
|
|
217
250
|
|
|
251
|
+
> `ci check-docs-sync` 会串联 `scripts/validate-docs.js` 与 `scripts/sync-analyze-docs.js --check`,同时校验文档护栏和 analyze generated block。
|
|
252
|
+
|
|
218
253
|
# 验证输出契约
|
|
219
254
|
mycodemap ci check-output-contract
|
|
220
255
|
mycodemap ci check-output-contract -s v1.0.0 -k 8 -t 160
|
|
@@ -224,13 +259,27 @@ mycodemap ci check-commit-size
|
|
|
224
259
|
mycodemap ci check-commit-size -m 15
|
|
225
260
|
```
|
|
226
261
|
|
|
262
|
+
> `ship` 的 CHECK 阶段会复用 `ci check-working-tree`、`ci check-branch`、`ci check-scripts` 这三条发布前 gate checks。
|
|
263
|
+
> `ci check-branch --allow` 支持 `*` 通配;`ci check-headers -d` 与 `generate` / `analyze` 共享同一套 `.gitignore` 感知排除规则,在没有 `.gitignore` 时回退到默认 `exclude`。
|
|
264
|
+
|
|
227
265
|
### 支持的提交 TAG
|
|
228
266
|
|
|
229
267
|
`[REFACTOR]`, `[TEST]`, `[DOCS]`, `[FEAT]`, `[FIX]`, `[CHORE]`, `[PERF]`, `[SECURITY]`, `[BREAKING]`, `[HOTFIX]`, `[MIGRATION]`, `[WIP]`
|
|
230
268
|
|
|
231
269
|
---
|
|
232
270
|
|
|
233
|
-
## workflow -
|
|
271
|
+
## workflow - 分析型工作流编排
|
|
272
|
+
|
|
273
|
+
> `workflow` 只保留 `find → read → link → show` 四个分析阶段;代码实现、commit 检查与 CI 运行不再作为 workflow phase 建模。
|
|
274
|
+
|
|
275
|
+
### 阶段模型
|
|
276
|
+
|
|
277
|
+
| 阶段 | 对应 analyze 意图 | 用途 |
|
|
278
|
+
|------|-------------------|------|
|
|
279
|
+
| `find` | `analyze -i find` | 查找候选符号、文件与关键词线索 |
|
|
280
|
+
| `read` | `analyze -i read` | 阅读影响范围、复杂度与上下文 |
|
|
281
|
+
| `link` | `analyze -i link` | 汇总依赖、引用与关联关系 |
|
|
282
|
+
| `show` | `analyze -i show` | 生成概览、摘要与展示型结果 |
|
|
234
283
|
|
|
235
284
|
### 生命周期管理
|
|
236
285
|
|
|
@@ -280,71 +329,20 @@ mycodemap workflow template recommend "任务" # 推荐模板
|
|
|
280
329
|
- `feature` - 新功能开发
|
|
281
330
|
- `hotfix` - 紧急修复
|
|
282
331
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
## server - HTTP 服务器
|
|
286
|
-
|
|
287
|
-
```bash
|
|
288
|
-
mycodemap server # 默认端口 3000
|
|
289
|
-
mycodemap server -p 8080 # 指定端口
|
|
290
|
-
mycodemap server -h 127.0.0.1 # 指定主机
|
|
291
|
-
mycodemap server --cors # 启用 CORS
|
|
292
|
-
mycodemap server --open # 自动打开浏览器
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
| 选项 | 说明 | 默认值 |
|
|
296
|
-
|------|------|--------|
|
|
297
|
-
| `-p, --port <number>` | 服务器端口 | `3000` |
|
|
298
|
-
| `-h, --host <string>` | 服务器主机 | `0.0.0.0` |
|
|
299
|
-
| `--cors` | 启用 CORS | `false` |
|
|
300
|
-
| `--open` | 自动打开浏览器 | `false` |
|
|
301
|
-
|
|
302
|
-
### API 端点
|
|
303
|
-
|
|
304
|
-
| 方法 | 端点 | 说明 |
|
|
305
|
-
|------|------|------|
|
|
306
|
-
| GET | `/api/v1/health` | 健康检查 |
|
|
307
|
-
| GET | `/api/v1/stats` | 项目统计 |
|
|
308
|
-
| GET | `/api/v1/search/symbols?q=` | 符号搜索 |
|
|
309
|
-
| GET | `/api/v1/modules/:id` | 模块详情 |
|
|
310
|
-
| GET | `/api/v1/symbols/:id` | 符号详情 |
|
|
311
|
-
| POST | `/api/v1/analysis/impact` | 影响分析 |
|
|
312
|
-
| GET | `/api/v1/analysis/cycles` | 循环依赖检测 |
|
|
313
|
-
| GET | `/api/v1/graph` | 依赖图数据 |
|
|
314
|
-
| GET | `/api/v1/export/:format` | 数据导出 |
|
|
332
|
+
> 所有内置模板复用同一 4 阶段顺序,只调整描述与阶段阈值。
|
|
315
333
|
|
|
316
334
|
---
|
|
317
335
|
|
|
318
|
-
##
|
|
319
|
-
|
|
320
|
-
### watch - 监听模式
|
|
321
|
-
|
|
322
|
-
```bash
|
|
323
|
-
mycodemap watch # 前台监听
|
|
324
|
-
mycodemap watch -d # 后台守护进程
|
|
325
|
-
mycodemap watch -s # 停止守护进程
|
|
326
|
-
mycodemap watch -t # 查看状态
|
|
327
|
-
mycodemap watch -m smart # 指定模式
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
### report - 生成报告
|
|
331
|
-
|
|
332
|
-
```bash
|
|
333
|
-
mycodemap report # 最近 7 天
|
|
334
|
-
mycodemap report -d 14 # 最近 14 天
|
|
335
|
-
mycodemap report -o ./reports # 输出目录
|
|
336
|
-
mycodemap report -j # JSON 输出
|
|
337
|
-
```
|
|
336
|
+
## 已移除的公共命令
|
|
338
337
|
|
|
339
|
-
|
|
338
|
+
以下命令已从 public CLI 移除;直接调用时,CLI 会显式失败并给出迁移提示,而不是继续执行旧功能。
|
|
340
339
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
```
|
|
340
|
+
| 命令 | 当前状态 | 迁移方式 |
|
|
341
|
+
|------|----------|----------|
|
|
342
|
+
| `server` | 已从 public CLI 移除 | `Server Layer` 仍是内部架构层,不等于公开 `mycodemap server` 命令 |
|
|
343
|
+
| `watch` | 已从 public CLI 移除 | 改用一次性的 `mycodemap generate` 刷新代码地图 |
|
|
344
|
+
| `report` | 已从 public CLI 移除 | 直接读取 `.mycodemap/AI_MAP.md`,或使用 `mycodemap export <format>` |
|
|
345
|
+
| `logs` | 已从 public CLI 移除 | 直接读取 `.mycodemap/logs/` 下的日志文件 |
|
|
348
346
|
|
|
349
347
|
### export - 导出代码图
|
|
350
348
|
|
|
@@ -356,9 +354,15 @@ mycodemap export mermaid # Mermaid 语法
|
|
|
356
354
|
mycodemap export json -o ./output.json # 指定输出
|
|
357
355
|
```
|
|
358
356
|
|
|
357
|
+
- `export json|graphml|dot` 会从 `mycodemap.config.json.storage` 指定的后端读取 CodeGraph。
|
|
358
|
+
- `export mermaid` 仍直接读取 `.mycodemap/codemap.json`,这是当前保留的文件出口,不代表 graph backend 未接入主路径。
|
|
359
|
+
- 图存储后端收口不等于重新开放公共 `mycodemap server` 产品面;`Server Layer` 仍是内部层。
|
|
360
|
+
|
|
359
361
|
---
|
|
360
362
|
|
|
361
|
-
### ship -
|
|
363
|
+
### ship - 一键智能发布(非代码地图首屏能力)
|
|
364
|
+
|
|
365
|
+
> `ship` 负责发布整合,不是 AI-first 代码地图工具的首屏入口;首次接触项目时优先使用分析命令而非发布命令。
|
|
362
366
|
|
|
363
367
|
```bash
|
|
364
368
|
mycodemap ship # 完整发布流程
|
|
@@ -377,7 +381,7 @@ mycodemap ship --yes # 置信度 60-75 时自动确认
|
|
|
377
381
|
1. **ANALYZE** - 分析 git commits,检测变更类型
|
|
378
382
|
2. **VERSION** - 基于 conventional commits 计算版本号
|
|
379
383
|
3. **CHECK** - mustPass/shouldPass 检查 + 置信度评分
|
|
380
|
-
4. **PUBLISH** -
|
|
384
|
+
4. **PUBLISH** - 创建版本提交 + git tag + push 触发 GitHub Actions
|
|
381
385
|
5. **MONITOR** - GitHub Actions CI 状态监控
|
|
382
386
|
|
|
383
387
|
**置信度判定:**
|
|
@@ -388,7 +392,7 @@ mycodemap ship --yes # 置信度 60-75 时自动确认
|
|
|
388
392
|
**前置条件:**
|
|
389
393
|
- 工作区干净
|
|
390
394
|
- 在 main/master 分支
|
|
391
|
-
-
|
|
395
|
+
- 所有检查通过(由 `ci check-working-tree`、`ci check-branch`、`ci check-scripts` 统一提供)
|
|
392
396
|
|
|
393
397
|
---
|
|
394
398
|
|
|
@@ -28,17 +28,17 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
|
-
"name": "
|
|
31
|
+
"name": "codemap_read",
|
|
32
32
|
"description": "分析文件变更的影响范围",
|
|
33
|
-
"command": "mycodemap analyze -i
|
|
33
|
+
"command": "mycodemap analyze -i read -t {target} --scope transitive --json",
|
|
34
34
|
"parameters": {
|
|
35
35
|
"target": { "type": "string", "description": "目标文件路径" }
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
|
-
"name": "
|
|
39
|
+
"name": "codemap_find",
|
|
40
40
|
"description": "搜索与关键词相关的代码",
|
|
41
|
-
"command": "mycodemap analyze -i
|
|
41
|
+
"command": "mycodemap analyze -i find -k {keyword} --json",
|
|
42
42
|
"parameters": {
|
|
43
43
|
"keyword": { "type": "string", "description": "搜索关键词" }
|
|
44
44
|
}
|
|
@@ -99,12 +99,12 @@ fi
|
|
|
99
99
|
|
|
100
100
|
3. **分析变更影响**
|
|
101
101
|
```bash
|
|
102
|
-
$CODEMAP analyze -i
|
|
102
|
+
$CODEMAP analyze -i read -t "file.ts" --scope transitive --json
|
|
103
103
|
```
|
|
104
104
|
|
|
105
105
|
4. **搜索代码**
|
|
106
106
|
```bash
|
|
107
|
-
$CODEMAP analyze -i
|
|
107
|
+
$CODEMAP analyze -i find -k "keyword" --json
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
## 完整文档
|
|
@@ -135,20 +135,20 @@ mycodemap query -s "SymbolName" -j
|
|
|
135
135
|
|
|
136
136
|
### Analyze Impact
|
|
137
137
|
```bash
|
|
138
|
-
mycodemap analyze -i
|
|
138
|
+
mycodemap analyze -i read -t "file.ts" --scope transitive --json
|
|
139
139
|
```
|
|
140
140
|
|
|
141
141
|
### Search Code
|
|
142
142
|
```bash
|
|
143
|
-
mycodemap analyze -i
|
|
143
|
+
mycodemap analyze -i find -k "keyword" --json
|
|
144
144
|
```
|
|
145
145
|
|
|
146
146
|
## Decision Tree
|
|
147
147
|
|
|
148
148
|
1. Understanding project structure → `generate` + read `AI_MAP.md`
|
|
149
149
|
2. Finding symbol location → `query -s`
|
|
150
|
-
3. Assessing change impact → `analyze -i
|
|
151
|
-
4. Searching related code → `analyze -i
|
|
150
|
+
3. Assessing change impact → `analyze -i read`
|
|
151
|
+
4. Searching related code → `analyze -i find`
|
|
152
152
|
|
|
153
153
|
## Reference
|
|
154
154
|
|
|
@@ -168,15 +168,15 @@ Code analysis tool for TypeScript projects.
|
|
|
168
168
|
|
|
169
169
|
- `codemap_generate`: Generate code map
|
|
170
170
|
- `codemap_query`: Query symbols
|
|
171
|
-
- `
|
|
172
|
-
- `
|
|
171
|
+
- `codemap_read`: Analyze change impact and surrounding context
|
|
172
|
+
- `codemap_find`: Search code
|
|
173
173
|
|
|
174
174
|
## Workflow
|
|
175
175
|
|
|
176
176
|
1. Always start with `codemap_generate`
|
|
177
177
|
2. Use `codemap_query` to find definitions
|
|
178
|
-
3. Use `
|
|
179
|
-
4. Use `
|
|
178
|
+
3. Use `codemap_read` before making changes
|
|
179
|
+
4. Use `codemap_find` to find related code
|
|
180
180
|
|
|
181
181
|
## Documentation
|
|
182
182
|
|
|
@@ -199,6 +199,8 @@ Full guide: `AI_GUIDE.md`
|
|
|
199
199
|
| `提交格式错误` | 不符合 [TAG] 格式 | 修改为 `[TAG] scope: message` |
|
|
200
200
|
| `风险评分过高` | 变更文件太多 | 拆分提交或添加解释 |
|
|
201
201
|
| `输出契约验证失败` | analyze 输出格式变更 | 检查 schemaVersion 和字段 |
|
|
202
|
+
| `pluginReport.diagnostics` 出现 `initialize` / `generate` 错误 | 插件加载或执行失败 | 检查 `mycodemap.config.json` 的 `plugins` 段、插件导出格式和生成路径 |
|
|
203
|
+
| `UNSUPPORTED_STORAGE_TYPE` / `ADAPTER_NOT_AVAILABLE` / `KUZU_INIT_FAILED` | 图存储后端配置不受支持或缺少依赖 | 检查 `mycodemap.config.json.storage`,确认未继续使用 `neo4j`,并安装 `kuzu` |
|
|
202
204
|
|
|
203
205
|
---
|
|
204
206
|
|
|
@@ -249,7 +251,7 @@ async function findSymbol(symbolName: string): Promise<any[]> {
|
|
|
249
251
|
|
|
250
252
|
// 尝试 3: 统一搜索
|
|
251
253
|
console.log('模糊搜索无结果,尝试统一搜索...');
|
|
252
|
-
result = await exec(`mycodemap analyze -i
|
|
254
|
+
result = await exec(`mycodemap analyze -i find -k "${symbolName}" --topK 20 --json`);
|
|
253
255
|
data = JSON.parse(result);
|
|
254
256
|
|
|
255
257
|
return data.results || [];
|
|
@@ -277,12 +279,12 @@ async function analyzeImpact(file: string, maxFiles: number = 50): Promise<any>
|
|
|
277
279
|
|
|
278
280
|
// 模式 4: 置信度太低,扩大搜索
|
|
279
281
|
async function searchWithFallback(keyword: string): Promise<any[]> {
|
|
280
|
-
let result = await exec(`mycodemap analyze -i
|
|
282
|
+
let result = await exec(`mycodemap analyze -i find -k "${keyword}" --topK 8 --json`);
|
|
281
283
|
let data = JSON.parse(result);
|
|
282
284
|
|
|
283
285
|
if (data.confidence?.level === 'low') {
|
|
284
286
|
console.log('置信度较低,扩大搜索范围...');
|
|
285
|
-
result = await exec(`mycodemap analyze -i
|
|
287
|
+
result = await exec(`mycodemap analyze -i find -k "${keyword}" --topK 20 --json`);
|
|
286
288
|
data = JSON.parse(result);
|
|
287
289
|
}
|
|
288
290
|
|
|
@@ -352,7 +354,7 @@ def find_symbol(symbol_name: str) -> List[Dict[str, Any]]:
|
|
|
352
354
|
# 尝试 3: 统一搜索
|
|
353
355
|
print('模糊搜索无结果,尝试统一搜索...')
|
|
354
356
|
result = subprocess.run(
|
|
355
|
-
['mycodemap', 'analyze', '-i', '
|
|
357
|
+
['mycodemap', 'analyze', '-i', 'find', '-k', symbol_name, '--topK', '20', '--json'],
|
|
356
358
|
capture_output=True, text=True
|
|
357
359
|
)
|
|
358
360
|
data = json.loads(result.stdout)
|
|
@@ -381,7 +383,7 @@ async function handleLargeProject() {
|
|
|
381
383
|
// 分块查询
|
|
382
384
|
const modules = ['src/cli', 'src/core', 'src/domain'];
|
|
383
385
|
for (const module of modules) {
|
|
384
|
-
await exec(`mycodemap analyze -i
|
|
386
|
+
await exec(`mycodemap analyze -i show -t "${module}" --json`);
|
|
385
387
|
}
|
|
386
388
|
}
|
|
387
389
|
|
|
@@ -508,6 +510,6 @@ npm rebuild
|
|
|
508
510
|
# 强制重新生成
|
|
509
511
|
mycodemap generate --force
|
|
510
512
|
|
|
511
|
-
#
|
|
512
|
-
mycodemap
|
|
513
|
+
# 或重新运行一次 generate 刷新输出
|
|
514
|
+
mycodemap generate
|
|
513
515
|
```
|