@mycodemap/mycodemap 0.4.1 → 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 +11 -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/checker.d.ts.map +1 -1
- package/dist/cli/commands/ship/checker.js +0 -3
- package/dist/cli/commands/ship/checker.js.map +1 -1
- package/dist/cli/commands/ship/rules/quality-rules.d.ts +0 -1
- package/dist/cli/commands/ship/rules/quality-rules.d.ts.map +1 -1
- package/dist/cli/commands/ship/rules/quality-rules.js +4 -76
- package/dist/cli/commands/ship/rules/quality-rules.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 +18 -63
- 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/SETUP_GUIDE.md +41 -17
- package/docs/ai-guide/COMMANDS.md +106 -102
- 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 +12 -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/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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.4.2] - 2026-03-25 - Test Infrastructure Fix
|
|
6
|
+
|
|
7
|
+
### 🐛 Bug Fixes
|
|
8
|
+
|
|
9
|
+
- **test**: 修复 validate-docs 测试缺少 product-specs 文件的问题
|
|
10
|
+
|
|
11
|
+
### 📚 Documentation
|
|
12
|
+
|
|
13
|
+
- **docs**: 同步 MVP3 产品规格文档基线
|
|
14
|
+
- **docs**: 完成 v1.3 milestone 归档
|
|
15
|
+
|
|
5
16
|
## [0.4.1] - 2026-03-23 - Ship Workflow Fixes
|
|
6
17
|
|
|
7
18
|
### 🐛 Bug Fixes
|
package/README.md
CHANGED
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
# CodeMap
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> AI-first 代码地图工具 - 为 AI/Agent 提供结构化、可预测的代码上下文
|
|
4
4
|
|
|
5
|
-
CodeMap
|
|
5
|
+
CodeMap 是一个面向 TypeScript/JavaScript/Go 项目的 AI-first 代码地图工具。它通过静态分析生成稳定的项目地图、依赖关系和结构化结果,帮助 AI/Agent 更快理解代码结构、定位影响范围,并把分析结果交给人类开发者继续判断与维护。
|
|
6
6
|
|
|
7
7
|
## 特性
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
9
|
+
- **AI-first 代码地图** - 生成 `AI_MAP.md`、`CONTEXT.md`、`codemap.json` 等 AI/Agent 可直接消费的上下文
|
|
10
|
+
- **核心分析命令** - 提供 `generate`、`query`、`deps`、`impact`、`complexity`、`cycles`、`analyze`、`export`、`ci`
|
|
11
|
+
- **机器可读优先** - 结构化输出是产品基线;当前 CLI 过渡期仍主要通过 `--json` 暴露机器可读结果
|
|
12
|
+
- **分层架构 (MVP3)** - 保持 `Interface → Infrastructure → Domain → Server → CLI` 的明确边界
|
|
13
|
+
- **双层解析模式** - 提供 `fast`(快速正则)和 `smart`(TypeScript AST)两种解析模式
|
|
11
14
|
- **多语言支持** - 支持 TypeScript/JavaScript、Go、Python(可扩展架构)
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
- **依赖/影响/复杂度分析** - 适合变更影响评估、重构盘点和架构回溯
|
|
16
|
+
- **CI 门禁与文档护栏** - 提供提交格式、文件头、风险评估、文档/输出契约检查
|
|
17
|
+
- **多格式导出与存储抽象** - 支持导出图数据,并保留文件系统/内存/图数据库后端接口
|
|
18
|
+
|
|
19
|
+
## 产品定位
|
|
20
|
+
|
|
21
|
+
| 维度 | 当前基线 |
|
|
22
|
+
|------|----------|
|
|
23
|
+
| 产品是谁 | `CodeMap` 是 AI-first 代码地图工具,而不是泛化的实现/发布/HTTP 工具箱 |
|
|
24
|
+
| 主要消费者 | `AI/Agent 是主要消费者`;人类开发者负责配置、维护与按需阅读输出 |
|
|
25
|
+
| 输出契约 | 目标是机器可读优先;`当前 CLI 现实` 是多数命令通过 `--json` 提供结构化结果,`analyze` 额外支持 `--output-mode machine|human` |
|
|
26
|
+
| 架构边界 | `Server Layer` 是内部架构层,不等于公共 `mycodemap server` 命令 |
|
|
27
|
+
|
|
28
|
+
当前公共 CLI 聚焦 `init`、`generate`、`query`、`deps`、`cycles`、`complexity`、`impact`、`analyze`、`ci`、`workflow`、`export`、`ship`;`server`、`watch`、`report`、`logs` 已从 public CLI 移除,并在调用时给出迁移提示。
|
|
24
29
|
|
|
25
30
|
## 安装
|
|
26
31
|
|
|
@@ -62,7 +67,15 @@ ls .mycodemap/
|
|
|
62
67
|
# dependency-graph.md - Mermaid 依赖图
|
|
63
68
|
```
|
|
64
69
|
|
|
65
|
-
|
|
70
|
+
```bash
|
|
71
|
+
# 4. 当前 CLI 过渡现实:给 AI/Agent 时优先请求机器可读结果
|
|
72
|
+
mycodemap impact -f src/cli/index.ts -j
|
|
73
|
+
|
|
74
|
+
# analyze 额外支持显式 machine/human 模式
|
|
75
|
+
mycodemap analyze -i read -t src/cli/index.ts --output-mode human
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
生成后,将 `.mycodemap/AI_MAP.md` 的内容提供给 AI 助手即可让其快速理解你的项目结构;需要结构化结果继续处理时,优先使用 JSON / machine 模式。
|
|
66
79
|
|
|
67
80
|
## 文档导航
|
|
68
81
|
|
|
@@ -92,18 +105,20 @@ ls .mycodemap/
|
|
|
92
105
|
| **[🛡️ AGENTS.md](AGENTS.md)** | 仓库级强约束、任务分级、代码红线 |
|
|
93
106
|
| **[⚡ CLAUDE.md](CLAUDE.md)** | AI 执行手册、验收清单 |
|
|
94
107
|
| **[🤖 docs/AI_ASSISTANT_SETUP.md](docs/AI_ASSISTANT_SETUP.md)** | AI 助手配置指引 |
|
|
95
|
-
| **[🛠️ docs/rules/engineering-with-codex-openai.md](docs/rules/engineering-with-codex-openai.md) | 面向 agent 的工程约束 |
|
|
108
|
+
| **[🛠️ docs/rules/engineering-with-codex-openai.md](docs/rules/engineering-with-codex-openai.md)** | 面向 agent 的工程约束 |
|
|
96
109
|
|
|
97
110
|
**AI 快速入口**: `.cursorrules` | `.github/copilot-instructions.md`
|
|
98
111
|
|
|
99
112
|
## CLI 命令
|
|
100
113
|
|
|
114
|
+
> 说明:以下章节记录当前公开的公共命令面。`workflow` 是公开的 analysis-only 工作流能力,`ship` 仍是过渡能力;`server`、`watch`、`report`、`logs` 已从 public CLI 移除,并在调用时输出迁移提示。
|
|
115
|
+
|
|
101
116
|
### `mycodemap init`
|
|
102
117
|
|
|
103
118
|
初始化项目的 CodeMap 配置文件。
|
|
104
119
|
|
|
105
120
|
```bash
|
|
106
|
-
mycodemap init #
|
|
121
|
+
mycodemap init # 创建默认配置文件
|
|
107
122
|
mycodemap init -y # 使用默认配置直接创建
|
|
108
123
|
|
|
109
124
|
# 别名:codemap init 也可以使用
|
|
@@ -111,9 +126,9 @@ mycodemap init -y # 使用默认配置直接创建
|
|
|
111
126
|
|
|
112
127
|
| 选项 | 说明 |
|
|
113
128
|
|------|------|
|
|
114
|
-
| `-y, --yes` |
|
|
129
|
+
| `-y, --yes` | 使用默认配置 |
|
|
115
130
|
|
|
116
|
-
执行后会在项目根目录生成 `
|
|
131
|
+
执行后会在项目根目录生成 `mycodemap.config.json` 配置文件。
|
|
117
132
|
|
|
118
133
|
### `mycodemap generate`
|
|
119
134
|
|
|
@@ -141,26 +156,6 @@ mycodemap generate -o ./docs/codemap # 指定输出目录
|
|
|
141
156
|
| `smart` | 较慢 | 完整语义 | 深度分析、复杂度评估、类型推导 |
|
|
142
157
|
| `hybrid` | 自动 | 自适应 | **推荐** - 文件数<50用fast,≥50用smart |
|
|
143
158
|
|
|
144
|
-
### `mycodemap watch`
|
|
145
|
-
|
|
146
|
-
监听文件变更并自动增量更新代码地图。
|
|
147
|
-
|
|
148
|
-
```bash
|
|
149
|
-
mycodemap watch # 前台运行
|
|
150
|
-
mycodemap watch -d # 以后台守护进程运行
|
|
151
|
-
mycodemap watch -s # 停止后台守护进程
|
|
152
|
-
mycodemap watch -t # 查看守护进程状态
|
|
153
|
-
mycodemap watch -m smart # 使用 smart 模式监听
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
| 选项 | 说明 | 默认值 |
|
|
157
|
-
|------|------|--------|
|
|
158
|
-
| `-m, --mode <mode>` | 分析模式 (fast/smart/hybrid) | `hybrid` |
|
|
159
|
-
| `-o, --output <dir>` | 输出目录 | `.mycodemap` |
|
|
160
|
-
| `-d, --detach` | 以后台守护进程方式运行 | - |
|
|
161
|
-
| `-s, --stop` | 停止后台守护进程 | - |
|
|
162
|
-
| `-t, --status` | 查看后台守护进程状态 | - |
|
|
163
|
-
|
|
164
159
|
### `mycodemap query`
|
|
165
160
|
|
|
166
161
|
查询代码地图中的符号、模块和依赖信息。
|
|
@@ -239,80 +234,16 @@ mycodemap impact -f src/cli/index.ts -j # JSON 格式输出
|
|
|
239
234
|
| `-t, --transitive` | 包含传递依赖(间接影响) | - |
|
|
240
235
|
| `-j, --json` | 以 JSON 格式输出 | - |
|
|
241
236
|
|
|
242
|
-
###
|
|
243
|
-
|
|
244
|
-
生成代码地图分析报告,汇总分析结果和运行日志。
|
|
245
|
-
|
|
246
|
-
```bash
|
|
247
|
-
mycodemap report # 生成最近 7 天的报告
|
|
248
|
-
mycodemap report -d 14 # 生成最近 14 天的报告
|
|
249
|
-
mycodemap report -o ./reports # 指定输出目录
|
|
250
|
-
mycodemap report -v # 显示详细信息
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
| 选项 | 说明 | 默认值 |
|
|
254
|
-
|------|------|------|
|
|
255
|
-
| `-o, --output <dir>` | 输出目录 | `.mycodemap` |
|
|
256
|
-
| `-d, --days <number>` | 报告覆盖的天数 | `7` |
|
|
257
|
-
| `-j, --json` | JSON 格式输出 | - |
|
|
258
|
-
| `-v, --verbose` | 显示详细信息 | - |
|
|
259
|
-
|
|
260
|
-
### `mycodemap logs`
|
|
261
|
-
|
|
262
|
-
管理代码地图运行时日志(列出、导出、清理)。
|
|
263
|
-
|
|
264
|
-
```bash
|
|
265
|
-
# 列出日志
|
|
266
|
-
mycodemap logs list # 列出最近 10 条日志
|
|
267
|
-
mycodemap logs list -l 20 # 列出最近 20 条
|
|
268
|
-
mycodemap logs list --level ERROR # 仅列出错误日志
|
|
269
|
-
mycodemap logs list -j # JSON 格式输出
|
|
270
|
-
|
|
271
|
-
# 导出日志
|
|
272
|
-
mycodemap logs export # 导出最近 7 天的日志
|
|
273
|
-
mycodemap logs export -d 30 # 导出最近 30 天的日志
|
|
274
|
-
mycodemap logs export -o ./logs.zip # 指定导出文件
|
|
275
|
-
mycodemap logs export --format txt # 导出为文本格式
|
|
276
|
-
|
|
277
|
-
# 清理日志
|
|
278
|
-
mycodemap logs clear -d 30 --confirm # 清理 30 天前的日志
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
| 选项 | 说明 | 默认值 |
|
|
282
|
-
|------|------|------|
|
|
283
|
-
| `-l, --limit <number>` | 限制显示数量 | `10` |
|
|
284
|
-
| `--level <level>` | 按级别过滤 (`INFO`/`WARN`/`ERROR`/`DEBUG`) | - |
|
|
285
|
-
| `-j, --json` | JSON 格式输出 | - |
|
|
286
|
-
| `-o, --output <file>` | 导出文件路径 | - |
|
|
287
|
-
| `-d, --days <number>` | 天数 | 视子命令而定 |
|
|
288
|
-
| `--format <format>` | 导出格式 (`json`/`txt`) | `json` |
|
|
289
|
-
| `-c, --confirm` | 确认清理操作 | - |
|
|
290
|
-
|
|
291
|
-
### `mycodemap server` (MVP3)
|
|
292
|
-
|
|
293
|
-
启动 CodeMap HTTP API 服务器。
|
|
237
|
+
### 已移除的公共 CLI 命令
|
|
294
238
|
|
|
295
|
-
|
|
296
|
-
mycodemap server # 启动服务器 (默认端口 3000)
|
|
297
|
-
mycodemap server -p 8080 # 指定端口
|
|
298
|
-
mycodemap server -p 3000 --open # 自动打开浏览器
|
|
299
|
-
mycodemap server --cors # 启用 CORS
|
|
300
|
-
```
|
|
239
|
+
以下命令已从 public CLI 移除;直接调用时,CLI 会显式失败并给出迁移提示,而不是继续执行旧功能。
|
|
301
240
|
|
|
302
|
-
|
|
|
303
|
-
|
|
304
|
-
|
|
|
305
|
-
|
|
|
306
|
-
|
|
|
307
|
-
|
|
|
308
|
-
|
|
309
|
-
**API 端点:**
|
|
310
|
-
- `GET /api/v1/health` - 健康检查
|
|
311
|
-
- `GET /api/v1/stats` - 项目统计
|
|
312
|
-
- `GET /api/v1/search/symbols?q=` - 符号搜索
|
|
313
|
-
- `GET /api/v1/modules/:id` - 模块详情
|
|
314
|
-
- `POST /api/v1/analysis/impact` - 影响分析
|
|
315
|
-
- `GET /api/v1/export/:format` - 导出数据
|
|
241
|
+
| 已移除命令 | 当前迁移方式 |
|
|
242
|
+
|------------|--------------|
|
|
243
|
+
| `watch` | 改用一次性的 `mycodemap generate` 刷新代码地图 |
|
|
244
|
+
| `report` | 直接读取 `.mycodemap/AI_MAP.md`,或使用 `mycodemap export <format>` 导出结果 |
|
|
245
|
+
| `logs` | 直接读取 `.mycodemap/logs/` 下的日志文件 |
|
|
246
|
+
| `server` | 公共 CLI 已移除;`Server Layer` 仍是内部架构层,不等于公开 `mycodemap server` 命令 |
|
|
316
247
|
|
|
317
248
|
### `mycodemap export` (MVP3)
|
|
318
249
|
|
|
@@ -330,39 +261,35 @@ mycodemap export json -o ./out # 指定输出路径
|
|
|
330
261
|
|------|------|--------|
|
|
331
262
|
| `-o, --output <path>` | 输出文件路径 | 自动根据格式生成 |
|
|
332
263
|
|
|
333
|
-
##
|
|
264
|
+
## 工作流编排(分析型 workflow)
|
|
334
265
|
|
|
335
|
-
|
|
266
|
+
`workflow` 是公开的 analysis-only 工作流能力,只编排分析阶段:`find → read → link → show`。
|
|
267
|
+
代码实现、commit 检查和 CI 运行不再属于 workflow phase;这些职责分别回到常规开发流程、`mycodemap ci` 与 `mycodemap ship`。
|
|
336
268
|
|
|
337
269
|
### 工作流阶段
|
|
338
270
|
|
|
339
271
|
```
|
|
340
|
-
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
341
|
-
│
|
|
342
|
-
│
|
|
343
|
-
└─────────────┘ └─────────────┘ └─────────────┘
|
|
344
|
-
↓
|
|
345
|
-
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
346
|
-
│ ci │ ← │ commit │ ← │implementation│
|
|
347
|
-
│ CI验证 │ │ 提交验证 │ │ 代码实现 │
|
|
348
|
-
└─────────────┘ └─────────────┘ └─────────────┘
|
|
272
|
+
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
273
|
+
│ find │ → │ read │ → │ link │ → │ show │
|
|
274
|
+
│ 查找代码线索 │ │ 阅读影响范围 │ │ 关联依赖引用 │ │ 展示概览结果 │
|
|
275
|
+
└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
|
|
349
276
|
```
|
|
350
277
|
|
|
351
|
-
| 阶段 |
|
|
352
|
-
|
|
353
|
-
| **
|
|
354
|
-
| **
|
|
355
|
-
| **
|
|
356
|
-
| **
|
|
357
|
-
|
|
358
|
-
|
|
278
|
+
| 阶段 | 对应意图 | 说明 | 典型产物 |
|
|
279
|
+
|------|----------|------|----------|
|
|
280
|
+
| **find** | `analyze --intent find` | 查找符号、关键词与候选文件 | 相关文件 / 符号列表 |
|
|
281
|
+
| **read** | `analyze --intent read` | 阅读影响范围、复杂度与上下文 | 影响与复杂度摘要 |
|
|
282
|
+
| **link** | `analyze --intent link` | 汇总依赖、引用与关联关系 | 依赖 / 引用结果 |
|
|
283
|
+
| **show** | `analyze --intent show` | 生成模块概览与展示型摘要 | overview / summary 输出 |
|
|
284
|
+
|
|
285
|
+
> 内置模板(`refactoring` / `bugfix` / `feature` / `hotfix`)共享同一 4 阶段顺序,只通过不同的阶段阈值和适用场景调整体验。
|
|
359
286
|
|
|
360
287
|
### 工作流 CLI 命令
|
|
361
288
|
|
|
362
289
|
```bash
|
|
363
290
|
# 启动工作流
|
|
364
291
|
mycodemap workflow start "实现用户认证模块"
|
|
365
|
-
#
|
|
292
|
+
# 启动工作流并指定模板(会保留 4 阶段顺序)
|
|
366
293
|
mycodemap workflow start "修复登录接口 500" --template bugfix
|
|
367
294
|
|
|
368
295
|
# 查看当前工作流状态
|
|
@@ -397,51 +324,35 @@ mycodemap workflow template recommend "紧急修复支付超时"
|
|
|
397
324
|
### 工作流使用示例
|
|
398
325
|
|
|
399
326
|
```bash
|
|
400
|
-
#
|
|
401
|
-
$ mycodemap workflow start "
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
#
|
|
407
|
-
$ mycodemap workflow
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
#
|
|
327
|
+
# 示例:围绕一个模块逐步收敛上下文
|
|
328
|
+
$ mycodemap workflow start "梳理缓存模块上下文"
|
|
329
|
+
[WORKFLOW STARTED]
|
|
330
|
+
Task: 梳理缓存模块上下文
|
|
331
|
+
Phase: find
|
|
332
|
+
|
|
333
|
+
# 查看当前分析阶段与进度
|
|
334
|
+
$ mycodemap workflow status
|
|
335
|
+
Phase: find
|
|
336
|
+
|
|
337
|
+
# 可视化 4 阶段分析流水线
|
|
338
|
+
$ mycodemap workflow visualize
|
|
339
|
+
▶ 🔍 【Find】
|
|
340
|
+
↓
|
|
341
|
+
○ 📖 Read
|
|
342
|
+
↓
|
|
343
|
+
○ 🔗 Link
|
|
344
|
+
↓
|
|
345
|
+
○ 🧭 Show
|
|
346
|
+
|
|
347
|
+
# 当前阶段完成后推进到下一阶段
|
|
421
348
|
$ mycodemap workflow proceed
|
|
422
|
-
|
|
423
|
-
✅ 代码实现完成
|
|
424
|
-
|
|
425
|
-
# 提交前验证
|
|
426
|
-
$ mycodemap workflow proceed
|
|
427
|
-
📍 进入阶段: commit
|
|
428
|
-
✅ Commit 格式验证通过
|
|
429
|
-
|
|
430
|
-
# CI 验证
|
|
431
|
-
$ mycodemap workflow proceed
|
|
432
|
-
📍 进入阶段: ci
|
|
433
|
-
✅ 所有检查通过
|
|
434
|
-
🎉 工作流完成!
|
|
435
|
-
|
|
436
|
-
# 示例:模板会改变阶段推进顺序
|
|
437
|
-
$ mycodemap workflow start "修复线上缓存失效" --template bugfix
|
|
438
|
-
$ mycodemap workflow proceed --force
|
|
439
|
-
📍 下一阶段: implementation # bugfix 模板: reference -> implementation
|
|
349
|
+
Next phase: read
|
|
440
350
|
|
|
441
|
-
#
|
|
351
|
+
# 示例:对当前活动工作流应用模板(阶段顺序不变)
|
|
442
352
|
$ mycodemap workflow template apply bugfix
|
|
443
353
|
Applied template: bugfix
|
|
444
|
-
|
|
354
|
+
Phases: find → read → link → show
|
|
355
|
+
Current phase: find
|
|
445
356
|
```
|
|
446
357
|
|
|
447
358
|
## CI 门禁 (v2.5)
|
|
@@ -470,15 +381,15 @@ mycodemap ci check-output-contract
|
|
|
470
381
|
|
|
471
382
|
## 配置说明
|
|
472
383
|
|
|
473
|
-
通过 `
|
|
384
|
+
通过 `mycodemap init` 生成的 `mycodemap.config.json` 配置文件支持以下选项:
|
|
474
385
|
|
|
475
386
|
```jsonc
|
|
476
387
|
{
|
|
477
388
|
// JSON Schema(可选,提供编辑器智能提示)
|
|
478
|
-
"$schema": "https://
|
|
389
|
+
"$schema": "https://mycodemap.dev/schema/config.json",
|
|
479
390
|
|
|
480
|
-
// 分析模式:"fast" 或 "
|
|
481
|
-
"mode": "
|
|
391
|
+
// 分析模式:"fast"、"smart" 或 "hybrid"
|
|
392
|
+
"mode": "hybrid",
|
|
482
393
|
|
|
483
394
|
// 包含的文件 glob 模式
|
|
484
395
|
"include": [
|
|
@@ -490,21 +401,84 @@ mycodemap ci check-output-contract
|
|
|
490
401
|
"node_modules/**",
|
|
491
402
|
"dist/**",
|
|
492
403
|
"build/**",
|
|
493
|
-
"
|
|
494
|
-
"
|
|
404
|
+
"coverage/**",
|
|
405
|
+
"**/*.test.ts",
|
|
406
|
+
"**/*.spec.ts",
|
|
407
|
+
"**/*.d.ts"
|
|
495
408
|
],
|
|
496
409
|
|
|
497
410
|
// 输出目录
|
|
498
|
-
"output": ".mycodemap"
|
|
411
|
+
"output": ".mycodemap",
|
|
412
|
+
|
|
413
|
+
// 监听模式预留配置
|
|
414
|
+
"watch": false,
|
|
415
|
+
|
|
416
|
+
// 图存储后端配置
|
|
417
|
+
"storage": {
|
|
418
|
+
"type": "filesystem",
|
|
419
|
+
"outputPath": ".codemap/storage"
|
|
420
|
+
},
|
|
421
|
+
|
|
422
|
+
// 插件加载配置
|
|
423
|
+
"plugins": {
|
|
424
|
+
"builtInPlugins": true,
|
|
425
|
+
"plugins": [],
|
|
426
|
+
"debug": false
|
|
427
|
+
}
|
|
499
428
|
}
|
|
500
429
|
```
|
|
501
430
|
|
|
502
431
|
| 配置项 | 类型 | 说明 | 默认值 |
|
|
503
432
|
|--------|------|------|--------|
|
|
504
|
-
| `mode` | `"fast" \| "smart"` | 分析模式 | `"
|
|
433
|
+
| `mode` | `"fast" \| "smart" \| "hybrid"` | 分析模式 | `"hybrid"` |
|
|
505
434
|
| `include` | `string[]` | 包含的文件 glob 模式 | `["src/**/*.ts"]` |
|
|
506
435
|
| `exclude` | `string[]` | 排除的文件 glob 模式 | `["node_modules/**", "dist/**", ...]` |
|
|
507
436
|
| `output` | `string` | 输出目录路径 | `".mycodemap"` |
|
|
437
|
+
| `watch` | `boolean` | 监听模式预留配置 | `false` |
|
|
438
|
+
| `storage.type` | `"filesystem" \| "kuzudb" \| "memory" \| "auto"` | 图存储后端类型 | `"filesystem"` |
|
|
439
|
+
| `storage.outputPath` | `string` | 文件系统存储目录 | `".codemap/storage"` |
|
|
440
|
+
| `storage.databasePath` | `string` | KùzuDB 数据目录(相对项目根目录) | - |
|
|
441
|
+
| `storage.autoThresholds` | `object` | `auto` 后端选择阈值 | - |
|
|
442
|
+
| `plugins.builtInPlugins` | `boolean` | 是否启用内置插件 | `true` |
|
|
443
|
+
| `plugins.pluginDir` | `string` | 额外插件目录 | - |
|
|
444
|
+
| `plugins.plugins` | `string[]` | 显式加载的插件名称列表 | `[]` |
|
|
445
|
+
| `plugins.debug` | `boolean` | 是否输出插件调试日志 | `false` |
|
|
446
|
+
|
|
447
|
+
### 图存储后端说明
|
|
448
|
+
|
|
449
|
+
```jsonc
|
|
450
|
+
{
|
|
451
|
+
"storage": {
|
|
452
|
+
"type": "kuzudb",
|
|
453
|
+
"databasePath": ".codemap/kuzu"
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
- `generate` 会把 CodeGraph 写入配置的 `storage` 后端,`export` 与内部 `Server Layer` handler 会读取同一份后端数据。
|
|
459
|
+
- `neo4j` 已不再是正式支持的 backend;旧配置会返回显式迁移错误,不会静默 fallback 到 `filesystem`。
|
|
460
|
+
- 选择 `kuzudb` 前先安装 `npm install kuzu`;缺少依赖时会返回显式错误。
|
|
461
|
+
- `storage.type = "auto"` 当前仍以 `filesystem` 为保守默认值;阈值字段先作为显式契约保留,不伪装成已完成的自动切换能力。
|
|
462
|
+
- 图存储后端生产化不等于重新开放公共 HTTP API 产品面;`Server Layer` 仍是内部架构层。
|
|
463
|
+
|
|
464
|
+
### 插件运行时说明
|
|
465
|
+
|
|
466
|
+
```jsonc
|
|
467
|
+
{
|
|
468
|
+
"plugins": {
|
|
469
|
+
"builtInPlugins": false,
|
|
470
|
+
"pluginDir": "./codemap-plugins",
|
|
471
|
+
"plugins": ["complexity-analyzer", "my-local-plugin"],
|
|
472
|
+
"debug": true
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
- 只有**显式声明了** `plugins` 段时,`generate` 才会启用插件 runtime;没有该段的旧项目保持原有行为。
|
|
478
|
+
- 插件加载结果、诊断信息和插件生成文件会写入 `AI_MAP.md` 的 `Plugin Summary` 与 `codemap.json` 的 `pluginReport`。
|
|
479
|
+
- 非法插件配置、插件初始化失败、generate hook 失败都会被收口为结构化 diagnostics,而不是静默忽略。
|
|
480
|
+
|
|
481
|
+
> 文件发现契约:`generate`、`analyze` 与 `ci check-headers -d` 等扫描类命令共享同一套 `.gitignore` 感知排除规则;若仓库没有 `.gitignore`,则回退到默认 `exclude`(即 `node_modules/dist/build/coverage/**` 与 `**/*.test.ts` / `**/*.spec.ts` / `**/*.d.ts`),并在 Git worktree 场景下避免误扫描 `.git` 目录。
|
|
508
482
|
|
|
509
483
|
## 输出文件说明
|
|
510
484
|
|
|
@@ -514,6 +488,7 @@ mycodemap ci check-output-contract
|
|
|
514
488
|
|
|
515
489
|
项目全局概览文件,专为 AI 助手设计,包含:
|
|
516
490
|
- 项目基本信息(文件数、代码行数、模块数等)
|
|
491
|
+
- 已加载插件、插件生成文件数量与插件诊断摘要(仅当显式启用 plugins runtime)
|
|
517
492
|
- 入口点列表
|
|
518
493
|
- 模块组织表(导出数、依赖数、类型)
|
|
519
494
|
- Mermaid 格式的依赖关系图
|
|
@@ -535,6 +510,7 @@ mycodemap ci check-output-contract
|
|
|
535
510
|
- `summary` - 统计摘要
|
|
536
511
|
- `modules` - 模块详情数组(符号、导入、导出、复杂度等)
|
|
537
512
|
- `dependencies` - 依赖图(节点和边)
|
|
513
|
+
- `pluginReport` - 插件运行摘要(`loadedPlugins`、`generatedFiles`、`metrics`、`diagnostics`)
|
|
538
514
|
|
|
539
515
|
### `dependency-graph.md`
|
|
540
516
|
|
|
@@ -548,7 +524,7 @@ CodeMap 采用清晰的分层架构设计(MVP3),各层职责明确:
|
|
|
548
524
|
┌─────────────────────────────────────────────────────────────┐
|
|
549
525
|
│ CLI Layer │
|
|
550
526
|
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
|
|
551
|
-
│ │
|
|
527
|
+
│ │workflow/ship│ │ export │ │ 原有命令(generate..)│ │
|
|
552
528
|
│ └─────────────┘ └─────────────┘ └─────────────────────┘ │
|
|
553
529
|
├─────────────────────────────────────────────────────────────┤
|
|
554
530
|
│ Server Layer │
|
|
@@ -563,7 +539,7 @@ CodeMap 采用清晰的分层架构设计(MVP3),各层职责明确:
|
|
|
563
539
|
│ │ - FileSystem │ │ - TypeScript │ │
|
|
564
540
|
│ │ - Memory │ │ - Go │ │
|
|
565
541
|
│ │ - KùzuDB │ │ - Python │ │
|
|
566
|
-
│ │ -
|
|
542
|
+
│ │ - Auto Select │ │ - Registry │ │
|
|
567
543
|
│ └──────────────────┘ └──────────────────┘ │
|
|
568
544
|
│ ┌──────────────────┐ │
|
|
569
545
|
│ │ Repository │ CodeGraphRepositoryImpl │
|
|
@@ -574,12 +550,14 @@ CodeMap 采用清晰的分层架构设计(MVP3),各层职责明确:
|
|
|
574
550
|
└─────────────────────────────────────────────────────────────┘
|
|
575
551
|
```
|
|
576
552
|
|
|
553
|
+
> 命名边界:`Server Layer` 是内部架构层,不等于公共 `mycodemap server` 命令。
|
|
554
|
+
|
|
577
555
|
### 架构层说明
|
|
578
556
|
|
|
579
557
|
| 层级 | 路径 | 职责 | 关键组件 |
|
|
580
558
|
|------|------|------|----------|
|
|
581
|
-
| **CLI** | `src/cli/` |
|
|
582
|
-
| **Server** | `src/server/` | HTTP
|
|
559
|
+
| **CLI** | `src/cli/` | 命令行接口(核心分析命令 + `workflow` / `ship` 扩展 surface) | `generate`, `query`, `impact`, `export` |
|
|
560
|
+
| **Server** | `src/server/` | 内部 Server Layer / HTTP transport | `CodeMapServer`, `QueryHandler` |
|
|
583
561
|
| **Domain** | `src/domain/` | 核心业务逻辑 | `Project`, `Module`, `CodeGraph` |
|
|
584
562
|
| **Infrastructure** | `src/infrastructure/` | 技术实现 | `Storage`, `Parser`, `Repository` |
|
|
585
563
|
| **Interface** | `src/interface/` | 类型契约 | `types/`, `config/` |
|
|
@@ -607,7 +585,7 @@ src/
|
|
|
607
585
|
│ └── repositories/ # 仓库接口
|
|
608
586
|
├── infrastructure/ # MVP3: 基础设施层
|
|
609
587
|
│ ├── storage/ # 存储适配器
|
|
610
|
-
│ │ ├── adapters/ # FileSystem, Memory, KùzuDB
|
|
588
|
+
│ │ ├── adapters/ # FileSystem, Memory, KùzuDB
|
|
611
589
|
│ │ └── StorageFactory.ts
|
|
612
590
|
│ ├── parser/ # 解析器
|
|
613
591
|
│ │ ├── interfaces/ # ParserBase
|
|
@@ -656,45 +634,41 @@ cp examples/codex/codemap-agent.md .agents/skills/codemap/SKILL.md
|
|
|
656
634
|
|
|
657
635
|
### `mycodemap analyze`
|
|
658
636
|
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
```bash
|
|
662
|
-
# 影响分析(查看文件变更影响范围)
|
|
663
|
-
mycodemap analyze -i impact -t src/cli/index.ts
|
|
664
|
-
mycodemap analyze -i impact -t src/cli/index.ts --scope transitive
|
|
665
|
-
mycodemap analyze -i impact -t src/cli/index.ts --include-tests
|
|
666
|
-
|
|
667
|
-
# 依赖分析
|
|
668
|
-
mycodemap analyze -i dependency -t src/cli/index.ts
|
|
669
|
-
|
|
670
|
-
# 项目概览
|
|
671
|
-
mycodemap analyze -i overview -t src/orchestrator
|
|
672
|
-
|
|
673
|
-
# 复杂度分析
|
|
674
|
-
mycodemap analyze -i complexity -t src/domain
|
|
637
|
+
统一分析入口,当前公共契约只暴露四个 intent,并统一返回结构化输出:
|
|
675
638
|
|
|
676
|
-
|
|
677
|
-
mycodemap analyze -i search -k UnifiedResult
|
|
639
|
+
> 当前 public analyze contract 为 `find` / `read` / `link` / `show`;兼容期内 legacy intent 会在输出中通过 `warnings[]` 提示迁移,其中 `refactor` 已不再接受。
|
|
678
640
|
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
mycodemap analyze -i
|
|
684
|
-
|
|
685
|
-
#
|
|
686
|
-
mycodemap analyze -i
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
641
|
+
<!-- BEGIN GENERATED: analyze-readme-examples -->
|
|
642
|
+
```bash
|
|
643
|
+
# 查找符号 / 文本
|
|
644
|
+
mycodemap analyze -i find -k SourceLocation
|
|
645
|
+
mycodemap analyze -i find -t src/orchestrator -k IntentRouter --json
|
|
646
|
+
|
|
647
|
+
# 阅读文件(影响 + 复杂度聚合)
|
|
648
|
+
mycodemap analyze -i read -t src/cli/index.ts
|
|
649
|
+
mycodemap analyze -i read -t src/cli/index.ts --scope transitive
|
|
650
|
+
mycodemap analyze -i read -t src/cli/index.ts --include-tests --json
|
|
651
|
+
|
|
652
|
+
# 关联关系(依赖 + 引用聚合)
|
|
653
|
+
mycodemap analyze -i link -t src/cli/index.ts
|
|
654
|
+
mycodemap analyze -i link -t src/interface/types.ts --json
|
|
655
|
+
|
|
656
|
+
# 展示模块概览 / 文档
|
|
657
|
+
mycodemap analyze -i show -t src/orchestrator
|
|
658
|
+
mycodemap analyze -i show -t src/domain/services --output-mode human
|
|
659
|
+
|
|
660
|
+
# 机器可读输出(JSON / structured)
|
|
661
|
+
mycodemap analyze -i read -t src/index.ts --json
|
|
662
|
+
mycodemap analyze -i link -t src/index.ts --structured --json
|
|
691
663
|
```
|
|
664
|
+
<!-- END GENERATED: analyze-readme-examples -->
|
|
692
665
|
|
|
666
|
+
<!-- BEGIN GENERATED: analyze-readme-options -->
|
|
693
667
|
| 选项 | 说明 | 默认值 |
|
|
694
668
|
|------|------|--------|
|
|
695
|
-
| `-i, --intent <type>` | 分析类型:`
|
|
696
|
-
| `-t, --targets <paths...>` |
|
|
697
|
-
| `-k, --keywords <words...>` |
|
|
669
|
+
| `-i, --intent <type>` | 分析类型:`find`/`read`/`link`/`show`(必填) | - |
|
|
670
|
+
| `-t, --targets <paths...>` | 目标路径(`read`/`link`/`show` 必填,`find` 可选) | - |
|
|
671
|
+
| `-k, --keywords <words...>` | 搜索关键词(主要用于 `find`) | - |
|
|
698
672
|
| `-s, --scope <scope>` | 范围:`direct`(直接)/`transitive`(传递) | `direct` |
|
|
699
673
|
| `-n, --topK <number>` | 返回结果数量 | `8` |
|
|
700
674
|
| `--include-tests` | 包含测试文件关联 | - |
|
|
@@ -702,12 +676,27 @@ mycodemap analyze -i impact -t src/index.ts --structured --json
|
|
|
702
676
|
| `--json` | JSON 格式输出 | - |
|
|
703
677
|
| `--structured` | 纯结构化输出(移除自然语言字段,配合 `--json` 使用) | - |
|
|
704
678
|
| `--output-mode <mode>` | 输出模式:`machine`/`human` | `human` |
|
|
679
|
+
<!-- END GENERATED: analyze-readme-options -->
|
|
680
|
+
|
|
681
|
+
> 产品目标是机器可读优先;当前实现仍以显式 `--json` / `--output-mode` 作为主要入口。
|
|
682
|
+
>
|
|
683
|
+
> legacy 兼容映射:`search → find`、`impact/complexity → read`、`dependency/reference → link`、`overview/documentation → show`;`refactor` 会返回 `E0001_INVALID_INTENT`。
|
|
705
684
|
|
|
706
685
|
### `mycodemap ci`
|
|
707
686
|
|
|
708
687
|
CI Gateway - 代码质量门禁工具:
|
|
709
688
|
|
|
710
689
|
```bash
|
|
690
|
+
# 验证工作区是否干净(ship 的发布前检查也复用这条规则)
|
|
691
|
+
mycodemap ci check-working-tree
|
|
692
|
+
|
|
693
|
+
# 验证当前分支是否允许执行发布前检查
|
|
694
|
+
mycodemap ci check-branch
|
|
695
|
+
mycodemap ci check-branch --allow main,release/*
|
|
696
|
+
|
|
697
|
+
# 运行发布前脚本集合(docs/typecheck/lint/test/build/pack)
|
|
698
|
+
mycodemap ci check-scripts
|
|
699
|
+
|
|
711
700
|
# 验证提交格式([TAG] scope: message)
|
|
712
701
|
mycodemap ci check-commits
|
|
713
702
|
mycodemap ci check-commits -c 5
|
|
@@ -722,7 +711,7 @@ mycodemap ci check-headers -f "src/index.ts,src/cli/index.ts"
|
|
|
722
711
|
mycodemap ci assess-risk
|
|
723
712
|
mycodemap ci assess-risk -t 0.5
|
|
724
713
|
|
|
725
|
-
#
|
|
714
|
+
# 验证文档同步(含 analyze generated block 校验)
|
|
726
715
|
mycodemap ci check-docs-sync
|
|
727
716
|
|
|
728
717
|
# 验证输出契约
|
|
@@ -733,6 +722,9 @@ mycodemap ci check-commit-size
|
|
|
733
722
|
mycodemap ci check-commit-size -m 15
|
|
734
723
|
```
|
|
735
724
|
|
|
725
|
+
> `mycodemap ship` 的 CHECK 阶段现在复用 `ci check-working-tree`、`ci check-branch`、`ci check-scripts` 作为 must-pass 事实源,而不是重复实现这些检查。
|
|
726
|
+
> `mycodemap ci check-headers -d <dir>` 与 `generate` / `analyze` 共享同一套 `.gitignore` 感知排除模块;若仓库没有 `.gitignore`,则回退到默认 `exclude` 列表。
|
|
727
|
+
|
|
736
728
|
支持的提交 TAG 类型:`[REFACTOR]`, `[TEST]`, `[DOCS]`, `[FEAT]`, `[FIX]`, `[CHORE]`, `[PERF]`, `[SECURITY]`, `[BREAKING]`, `[HOTFIX]`, `[MIGRATION]`, `[WIP]`
|
|
737
729
|
|
|
738
730
|
## 贡献指南
|
|
@@ -762,6 +754,7 @@ npm run test:all # 功能 + 基准(串联执行)
|
|
|
762
754
|
|
|
763
755
|
# 文档 / CLI 示例护栏
|
|
764
756
|
npm run docs:check
|
|
757
|
+
# `ci check-docs-sync` 会额外校验 analyze generated block
|
|
765
758
|
node dist/cli/index.js ci check-docs-sync
|
|
766
759
|
|
|
767
760
|
# 类型检查
|