@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.
Files changed (246) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +214 -221
  3. package/dist/cli/commands/analyze-options.d.ts +36 -0
  4. package/dist/cli/commands/analyze-options.d.ts.map +1 -0
  5. package/dist/cli/commands/analyze-options.js +147 -0
  6. package/dist/cli/commands/analyze-options.js.map +1 -0
  7. package/dist/cli/commands/analyze.d.ts +93 -4
  8. package/dist/cli/commands/analyze.d.ts.map +1 -1
  9. package/dist/cli/commands/analyze.js +592 -176
  10. package/dist/cli/commands/analyze.js.map +1 -1
  11. package/dist/cli/commands/ci.d.ts +47 -1
  12. package/dist/cli/commands/ci.d.ts.map +1 -1
  13. package/dist/cli/commands/ci.js +208 -1
  14. package/dist/cli/commands/ci.js.map +1 -1
  15. package/dist/cli/commands/export.d.ts.map +1 -1
  16. package/dist/cli/commands/export.js +2 -2
  17. package/dist/cli/commands/export.js.map +1 -1
  18. package/dist/cli/commands/generate.d.ts +8 -2
  19. package/dist/cli/commands/generate.d.ts.map +1 -1
  20. package/dist/cli/commands/generate.js +151 -22
  21. package/dist/cli/commands/generate.js.map +1 -1
  22. package/dist/cli/commands/init.d.ts.map +1 -1
  23. package/dist/cli/commands/init.js +2 -13
  24. package/dist/cli/commands/init.js.map +1 -1
  25. package/dist/cli/commands/ship/analyzer.d.ts +1 -1
  26. package/dist/cli/commands/ship/analyzer.d.ts.map +1 -1
  27. package/dist/cli/commands/ship/analyzer.js +8 -1
  28. package/dist/cli/commands/ship/analyzer.js.map +1 -1
  29. package/dist/cli/commands/ship/checker.d.ts +1 -1
  30. package/dist/cli/commands/ship/checker.d.ts.map +1 -1
  31. package/dist/cli/commands/ship/checker.js +17 -6
  32. package/dist/cli/commands/ship/checker.js.map +1 -1
  33. package/dist/cli/commands/ship/index.js +2 -2
  34. package/dist/cli/commands/ship/index.js.map +1 -1
  35. package/dist/cli/commands/ship/monitor.d.ts +17 -2
  36. package/dist/cli/commands/ship/monitor.d.ts.map +1 -1
  37. package/dist/cli/commands/ship/monitor.js +116 -29
  38. package/dist/cli/commands/ship/monitor.js.map +1 -1
  39. package/dist/cli/commands/ship/pipeline.d.ts.map +1 -1
  40. package/dist/cli/commands/ship/pipeline.js +97 -18
  41. package/dist/cli/commands/ship/pipeline.js.map +1 -1
  42. package/dist/cli/commands/ship/publisher.d.ts +12 -2
  43. package/dist/cli/commands/ship/publisher.d.ts.map +1 -1
  44. package/dist/cli/commands/ship/publisher.js +217 -37
  45. package/dist/cli/commands/ship/publisher.js.map +1 -1
  46. package/dist/cli/commands/ship/rules/quality-rules.d.ts +2 -2
  47. package/dist/cli/commands/ship/rules/quality-rules.d.ts.map +1 -1
  48. package/dist/cli/commands/ship/rules/quality-rules.js +53 -54
  49. package/dist/cli/commands/ship/rules/quality-rules.js.map +1 -1
  50. package/dist/cli/commands/ship/versioner.d.ts +1 -1
  51. package/dist/cli/commands/ship/versioner.d.ts.map +1 -1
  52. package/dist/cli/commands/ship/versioner.js +4 -2
  53. package/dist/cli/commands/ship/versioner.js.map +1 -1
  54. package/dist/cli/commands/workflow.js +4 -4
  55. package/dist/cli/commands/workflow.js.map +1 -1
  56. package/dist/cli/config-loader.d.ts +31 -0
  57. package/dist/cli/config-loader.d.ts.map +1 -0
  58. package/dist/cli/config-loader.js +235 -0
  59. package/dist/cli/config-loader.js.map +1 -0
  60. package/dist/cli/index.js +19 -64
  61. package/dist/cli/index.js.map +1 -1
  62. package/dist/cli/removed-commands.d.ts +9 -0
  63. package/dist/cli/removed-commands.d.ts.map +1 -0
  64. package/dist/cli/removed-commands.js +48 -0
  65. package/dist/cli/removed-commands.js.map +1 -0
  66. package/dist/cli/storage-runtime.d.ts +8 -0
  67. package/dist/cli/storage-runtime.d.ts.map +1 -0
  68. package/dist/cli/storage-runtime.js +14 -0
  69. package/dist/cli/storage-runtime.js.map +1 -0
  70. package/dist/cli/tree-sitter-check.d.ts.map +1 -1
  71. package/dist/cli/tree-sitter-check.js +0 -1
  72. package/dist/cli/tree-sitter-check.js.map +1 -1
  73. package/dist/cli-new/commands/export.d.ts.map +1 -1
  74. package/dist/cli-new/commands/export.js +2 -2
  75. package/dist/cli-new/commands/export.js.map +1 -1
  76. package/dist/cli-new/commands/query.d.ts.map +1 -1
  77. package/dist/cli-new/commands/query.js +5 -4
  78. package/dist/cli-new/commands/query.js.map +1 -1
  79. package/dist/cli-new/index.d.ts.map +1 -1
  80. package/dist/cli-new/index.js +0 -2
  81. package/dist/cli-new/index.js.map +1 -1
  82. package/dist/core/analyzer.d.ts.map +1 -1
  83. package/dist/core/analyzer.js +7 -39
  84. package/dist/core/analyzer.js.map +1 -1
  85. package/dist/core/file-discovery.d.ts +17 -0
  86. package/dist/core/file-discovery.d.ts.map +1 -0
  87. package/dist/core/file-discovery.js +75 -0
  88. package/dist/core/file-discovery.js.map +1 -0
  89. package/dist/core/global-index.d.ts +5 -0
  90. package/dist/core/global-index.d.ts.map +1 -1
  91. package/dist/core/global-index.js +71 -21
  92. package/dist/core/global-index.js.map +1 -1
  93. package/dist/generator/index.d.ts.map +1 -1
  94. package/dist/generator/index.js +8 -0
  95. package/dist/generator/index.js.map +1 -1
  96. package/dist/infrastructure/parser/implementations/GoParser.d.ts +2 -5
  97. package/dist/infrastructure/parser/implementations/GoParser.d.ts.map +1 -1
  98. package/dist/infrastructure/parser/implementations/GoParser.js +2 -5
  99. package/dist/infrastructure/parser/implementations/GoParser.js.map +1 -1
  100. package/dist/infrastructure/parser/implementations/PythonParser.d.ts +1 -5
  101. package/dist/infrastructure/parser/implementations/PythonParser.d.ts.map +1 -1
  102. package/dist/infrastructure/parser/implementations/PythonParser.js +1 -5
  103. package/dist/infrastructure/parser/implementations/PythonParser.js.map +1 -1
  104. package/dist/infrastructure/parser/implementations/TypeScriptParser.d.ts +1 -5
  105. package/dist/infrastructure/parser/implementations/TypeScriptParser.d.ts.map +1 -1
  106. package/dist/infrastructure/parser/implementations/TypeScriptParser.js +1 -5
  107. package/dist/infrastructure/parser/implementations/TypeScriptParser.js.map +1 -1
  108. package/dist/infrastructure/storage/StorageFactory.d.ts +0 -1
  109. package/dist/infrastructure/storage/StorageFactory.d.ts.map +1 -1
  110. package/dist/infrastructure/storage/StorageFactory.js +4 -29
  111. package/dist/infrastructure/storage/StorageFactory.js.map +1 -1
  112. package/dist/infrastructure/storage/adapters/FileSystemStorage.d.ts.map +1 -1
  113. package/dist/infrastructure/storage/adapters/FileSystemStorage.js +24 -137
  114. package/dist/infrastructure/storage/adapters/FileSystemStorage.js.map +1 -1
  115. package/dist/infrastructure/storage/adapters/KuzuDBStorage.d.ts +10 -18
  116. package/dist/infrastructure/storage/adapters/KuzuDBStorage.d.ts.map +1 -1
  117. package/dist/infrastructure/storage/adapters/KuzuDBStorage.js +103 -146
  118. package/dist/infrastructure/storage/adapters/KuzuDBStorage.js.map +1 -1
  119. package/dist/infrastructure/storage/adapters/MemoryStorage.d.ts +0 -1
  120. package/dist/infrastructure/storage/adapters/MemoryStorage.d.ts.map +1 -1
  121. package/dist/infrastructure/storage/adapters/MemoryStorage.js +16 -136
  122. package/dist/infrastructure/storage/adapters/MemoryStorage.js.map +1 -1
  123. package/dist/infrastructure/storage/graph-helpers.d.ts +16 -0
  124. package/dist/infrastructure/storage/graph-helpers.d.ts.map +1 -0
  125. package/dist/infrastructure/storage/graph-helpers.js +161 -0
  126. package/dist/infrastructure/storage/graph-helpers.js.map +1 -0
  127. package/dist/infrastructure/storage/index.d.ts.map +1 -1
  128. package/dist/interface/config/index.d.ts +10 -1
  129. package/dist/interface/config/index.d.ts.map +1 -1
  130. package/dist/interface/types/index.d.ts +13 -0
  131. package/dist/interface/types/index.d.ts.map +1 -1
  132. package/dist/interface/types/storage.d.ts +1 -4
  133. package/dist/interface/types/storage.d.ts.map +1 -1
  134. package/dist/orchestrator/confidence.d.ts +9 -9
  135. package/dist/orchestrator/confidence.d.ts.map +1 -1
  136. package/dist/orchestrator/confidence.js +44 -67
  137. package/dist/orchestrator/confidence.js.map +1 -1
  138. package/dist/orchestrator/file-header-scanner.d.ts.map +1 -1
  139. package/dist/orchestrator/file-header-scanner.js +22 -31
  140. package/dist/orchestrator/file-header-scanner.js.map +1 -1
  141. package/dist/orchestrator/intent-router.d.ts +2 -11
  142. package/dist/orchestrator/intent-router.d.ts.map +1 -1
  143. package/dist/orchestrator/intent-router.js +58 -49
  144. package/dist/orchestrator/intent-router.js.map +1 -1
  145. package/dist/orchestrator/tool-orchestrator.d.ts.map +1 -1
  146. package/dist/orchestrator/tool-orchestrator.js +6 -4
  147. package/dist/orchestrator/tool-orchestrator.js.map +1 -1
  148. package/dist/orchestrator/types.d.ts +113 -2
  149. package/dist/orchestrator/types.d.ts.map +1 -1
  150. package/dist/orchestrator/types.js +29 -0
  151. package/dist/orchestrator/types.js.map +1 -1
  152. package/dist/orchestrator/workflow/config.d.ts +4 -12
  153. package/dist/orchestrator/workflow/config.d.ts.map +1 -1
  154. package/dist/orchestrator/workflow/config.js +4 -6
  155. package/dist/orchestrator/workflow/config.js.map +1 -1
  156. package/dist/orchestrator/workflow/git-analyzer.d.ts.map +1 -1
  157. package/dist/orchestrator/workflow/git-analyzer.js +9 -19
  158. package/dist/orchestrator/workflow/git-analyzer.js.map +1 -1
  159. package/dist/orchestrator/workflow/phase-inheritance.d.ts.map +1 -1
  160. package/dist/orchestrator/workflow/phase-inheritance.js +14 -23
  161. package/dist/orchestrator/workflow/phase-inheritance.js.map +1 -1
  162. package/dist/orchestrator/workflow/result-fusion.d.ts.map +1 -1
  163. package/dist/orchestrator/workflow/result-fusion.js +9 -11
  164. package/dist/orchestrator/workflow/result-fusion.js.map +1 -1
  165. package/dist/orchestrator/workflow/templates.d.ts +4 -1
  166. package/dist/orchestrator/workflow/templates.d.ts.map +1 -1
  167. package/dist/orchestrator/workflow/templates.js +49 -207
  168. package/dist/orchestrator/workflow/templates.js.map +1 -1
  169. package/dist/orchestrator/workflow/test-linker.d.ts.map +1 -1
  170. package/dist/orchestrator/workflow/test-linker.js +12 -24
  171. package/dist/orchestrator/workflow/test-linker.js.map +1 -1
  172. package/dist/orchestrator/workflow/types.d.ts +11 -8
  173. package/dist/orchestrator/workflow/types.d.ts.map +1 -1
  174. package/dist/orchestrator/workflow/types.js +8 -1
  175. package/dist/orchestrator/workflow/types.js.map +1 -1
  176. package/dist/orchestrator/workflow/visualizer.d.ts.map +1 -1
  177. package/dist/orchestrator/workflow/visualizer.js +7 -9
  178. package/dist/orchestrator/workflow/visualizer.js.map +1 -1
  179. package/dist/orchestrator/workflow/workflow-context.d.ts.map +1 -1
  180. package/dist/orchestrator/workflow/workflow-context.js +3 -5
  181. package/dist/orchestrator/workflow/workflow-context.js.map +1 -1
  182. package/dist/orchestrator/workflow/workflow-orchestrator.d.ts +0 -4
  183. package/dist/orchestrator/workflow/workflow-orchestrator.d.ts.map +1 -1
  184. package/dist/orchestrator/workflow/workflow-orchestrator.js +7 -99
  185. package/dist/orchestrator/workflow/workflow-orchestrator.js.map +1 -1
  186. package/dist/parser/index.d.ts.map +1 -1
  187. package/dist/parser/index.js +2 -2
  188. package/dist/parser/index.js.map +1 -1
  189. package/dist/plugins/index.d.ts +5 -3
  190. package/dist/plugins/index.d.ts.map +1 -1
  191. package/dist/plugins/index.js +19 -8
  192. package/dist/plugins/index.js.map +1 -1
  193. package/dist/plugins/plugin-loader.d.ts +21 -6
  194. package/dist/plugins/plugin-loader.d.ts.map +1 -1
  195. package/dist/plugins/plugin-loader.js +170 -54
  196. package/dist/plugins/plugin-loader.js.map +1 -1
  197. package/dist/plugins/plugin-registry.d.ts +7 -4
  198. package/dist/plugins/plugin-registry.d.ts.map +1 -1
  199. package/dist/plugins/plugin-registry.js +62 -14
  200. package/dist/plugins/plugin-registry.js.map +1 -1
  201. package/dist/plugins/types.d.ts +16 -6
  202. package/dist/plugins/types.d.ts.map +1 -1
  203. package/dist/plugins/types.js +2 -0
  204. package/dist/plugins/types.js.map +1 -1
  205. package/dist/server/handlers/AnalysisHandler.d.ts +16 -2
  206. package/dist/server/handlers/AnalysisHandler.d.ts.map +1 -1
  207. package/dist/server/handlers/AnalysisHandler.js +31 -47
  208. package/dist/server/handlers/AnalysisHandler.js.map +1 -1
  209. package/dist/server/routes/api.d.ts.map +1 -1
  210. package/dist/server/routes/api.js +31 -12
  211. package/dist/server/routes/api.js.map +1 -1
  212. package/docs/AI_ASSISTANT_SETUP.md +3 -1
  213. package/docs/PUBLISHING.md +18 -4
  214. package/docs/SETUP_GUIDE.md +41 -17
  215. package/docs/ai-guide/COMMANDS.md +107 -103
  216. package/docs/ai-guide/INTEGRATION.md +23 -21
  217. package/docs/ai-guide/OUTPUT.md +206 -10
  218. package/docs/ai-guide/PATTERNS.md +64 -15
  219. package/docs/ai-guide/PROMPTS.md +50 -12
  220. package/docs/ai-guide/QUICKSTART.md +35 -19
  221. package/docs/ai-guide/README.md +22 -4
  222. package/docs/product-specs/MVP3-ARCHITECTURE-COMPARISON.md +159 -434
  223. package/docs/product-specs/MVP3-ARCHITECTURE-REDESIGN-PRD.md +169 -261
  224. package/docs/product-specs/MVP3-ARCHITECTURE-REDESIGN-TECH-PRD.md +201 -1259
  225. package/docs/product-specs/README.md +8 -1
  226. package/docs/rules/architecture-guardrails.md +1 -2
  227. package/docs/rules/engineering-with-codex-openai.md +15 -9
  228. package/docs/rules/validation.md +26 -4
  229. package/mycodemap.config.schema.json +76 -5
  230. package/package.json +1 -1
  231. package/scripts/pre-release-check.js +21 -3
  232. package/scripts/sync-analyze-docs.js +500 -0
  233. package/scripts/validate-ai-docs.js +54 -1
  234. package/scripts/validate-docs.js +746 -26
  235. package/dist/cli/commands/server.d.ts +0 -9
  236. package/dist/cli/commands/server.d.ts.map +0 -1
  237. package/dist/cli/commands/server.js +0 -68
  238. package/dist/cli/commands/server.js.map +0 -1
  239. package/dist/cli-new/commands/server.d.ts +0 -13
  240. package/dist/cli-new/commands/server.d.ts.map +0 -1
  241. package/dist/cli-new/commands/server.js +0 -94
  242. package/dist/cli-new/commands/server.js.map +0 -1
  243. package/dist/infrastructure/storage/adapters/Neo4jStorage.d.ts +0 -49
  244. package/dist/infrastructure/storage/adapters/Neo4jStorage.d.ts.map +0 -1
  245. package/dist/infrastructure/storage/adapters/Neo4jStorage.js +0 -222
  246. package/dist/infrastructure/storage/adapters/Neo4jStorage.js.map +0 -1
@@ -1,322 +1,230 @@
1
- # CodeMap MVP3 架构重构产品需求文档 (PRD)
1
+ # CodeMap MVP3 架构重构产品需求文档(PRD,v1.3 同步版)
2
2
 
3
- > **版本**: v1.0.0
4
- > **状态**: Draft
5
- > **日期**: 2026-03-17
3
+ > **版本**: v1.3-sync
4
+ > **状态**: Shipped baseline / archived design synced
5
+ > **日期**: 2026-03-25
6
6
  > **负责人**: Architecture Team
7
7
 
8
8
  ---
9
9
 
10
- ## 1. 背景与目标
10
+ ## 1. 文档目的
11
11
 
12
- ### 1.1 现状痛点
12
+ 本文档不再把早期 MVP3 设计稿中的所有目标都视为“当前已实现”,而是明确区分:
13
13
 
14
- | 痛点 | 影响 | 示例 |
15
- |------|------|------|
16
- | 层间耦合度高 | `cli/` 直接依赖 `core/analyzer`,难以测试 | CLI 命令难以 mock 分析器 |
17
- | 存储层硬编码 | 输出只能是 JSON/Markdown,无法扩展 | 无法支持图数据库查询 |
18
- | 语言支持受限 | 仅支持 TS/JS/Go,错失 Python/Java 用户 | 用户流失到 CodeGraphContext |
19
- | 缺少服务层 | 业务逻辑分散在 CLI 命令中 | 难以复用核心能力 |
14
+ - **已交付基线**:当前仓库在 `v1.3` 已落地的架构与产品边界
15
+ - **Deferred**:仍保留为未来候选、但尚未成为当前产品事实的内容
20
16
 
21
- ### 1.2 目标
17
+ ---
22
18
 
23
- ```
24
- ┌─────────────────────────────────────────────────────────────────┐
25
- MVP3 核心目标 │
26
- ├─────────────────────────────────────────────────────────────────┤
27
- │ │
28
- │ ✅ 架构清晰分层: 5 层架构,每层职责单一,接口隔离 │
29
- │ ✅ 存储可插拔: 文件系统(默认) + 图数据库(可选) │
30
- │ ✅ 语言扩展: 从 3 种扩展到 14 种主流语言 │
31
- │ ✅ CLI 增强: 基础可视化 + 交互式查询 │
32
- │ ✅ 向后兼容: 现有用户零成本迁移 │
33
- │ │
34
- └─────────────────────────────────────────────────────────────────┘
35
- ```
19
+ ## 2. 背景
20
+
21
+ MVP3 重构的原始目的,是把 CodeMap 从“CLI 直接拼接分析逻辑的 brownfield 工具”收敛为:
22
+
23
+ 1. 有清晰层次边界的 AI-first 代码地图工具
24
+ 2. 有稳定存储契约的分析系统
25
+ 3. 有可扩展 parser 注册机制的多语言基础设施
26
+ 4. 有统一文档和验证护栏的可维护产品面
36
27
 
37
28
  ---
38
29
 
39
- ## 2. 用户故事
30
+ ## 3. 当前已交付基线(`v1.3`)
40
31
 
41
- ### 2.1 开发者 persona: 小李 (Python 后端工程师)
32
+ ### 3.1 架构边界
42
33
 
43
- > "我是 Python 开发者,想用 CodeMap 分析我的 Django 项目,但发现不支持 Python,只能用 CodeGraphContext。"
34
+ 当前仓库已经形成如下稳定层次:
44
35
 
45
- **需求**:
46
- - 支持 Python 代码分析
47
- - 能看到 Django 项目的依赖关系
48
- - 能检测循环依赖
36
+ | 层级 | 路径 | 当前职责 |
37
+ |------|------|----------|
38
+ | Interface | `src/interface/` | 类型定义、配置契约 |
39
+ | Infrastructure | `src/infrastructure/` | storage、parser、repositories 等技术实现 |
40
+ | Domain | `src/domain/` | 实体、领域服务、仓储接口 |
41
+ | Server | `src/server/` | **内部** transport / handler 层 |
42
+ | CLI | `src/cli/` | 公共命令面、参数解析、输出编排 |
49
43
 
50
- ### 2.2 架构师 persona: 老王 (大型系统架构师)
44
+ **边界要求**:
51
45
 
52
- > "我的项目有 5000+ 文件,JSON 文件太大了,查询很慢,希望能用图数据库加速查询。"
46
+ - `Server Layer` 是内部架构层,不等于公共 `mycodemap server` 命令
47
+ - 公共 CLI 不再暴露 `server`、`watch`、`report`、`logs`
53
48
 
54
- **需求**:
55
- - 可选图数据库存储后端
56
- - 复杂查询性能 < 100ms
57
- - 支持跨语言调用链分析
49
+ ### 3.2 存储产品面
58
50
 
59
- ### 2.3 CLI 用户 persona: 小张 (命令行爱好者)
51
+ 当前正式存储 surface 为:
60
52
 
61
- > "我喜欢在终端工作,希望能有漂亮的 CLI 可视化,比如树形目录、依赖图字符画。"
53
+ | 类型 | 状态 | 说明 |
54
+ |------|------|------|
55
+ | `filesystem` | shipped | 默认、最稳定 |
56
+ | `memory` | shipped | 测试/内存场景 |
57
+ | `kuzudb` | shipped | 当前图存储主线 |
58
+ | `auto` | shipped surface | 配置面存在,但当前仍保守落到 `filesystem` |
59
+ | `neo4j` | removed | 不再是正式支持 backend;旧配置返回显式迁移错误 |
62
60
 
63
- **需求**:
64
- - CLI 字符画可视化
65
- - 交互式命令补全
66
- - 进度条和颜色输出
61
+ ### 3.3 解析器能力
67
62
 
68
- ---
63
+ 当前已落地的 parser 实现为:
69
64
 
70
- ## 3. 功能需求
65
+ | 语言族 | 当前实现 |
66
+ |--------|----------|
67
+ | TypeScript / JavaScript | `TypeScriptParser` |
68
+ | Go | `GoParser` |
69
+ | Python | `PythonParser` |
71
70
 
72
- ### 3.1 分层架构 (Server 层引入)
71
+ 说明:
73
72
 
74
- ```
75
- ┌─────────────────────────────────────────────────────────────────────────────┐
76
- │ MVP3 分层架构 │
77
- ├─────────────────────────────────────────────────────────────────────────────┤
78
- │ │
79
- │ ┌─────────────────────────────────────────────────────────────────────┐ │
80
- │ │ Layer 5: CLI Layer │ │
81
- │ │ - 命令解析、参数校验、输出格式化 │ │
82
- │ │ - 仅处理 stdin/stdout/stderr │ │
83
- │ └─────────────────────────────────────────────────────────────────────┘ │
84
- │ │ │
85
- │ ▼ │
86
- │ ┌─────────────────────────────────────────────────────────────────────┐ │
87
- │ │ Layer 4: Server Layer ⭐ 新增 │ │
88
- │ │ - 业务逻辑编排、用例实现 │ │
89
- │ │ - 协调 Domain 和 Infrastructure 层 │ │
90
- │ └─────────────────────────────────────────────────────────────────────┘ │
91
- │ │ │
92
- │ ▼ │
93
- │ ┌─────────────────────────────────────────────────────────────────────┐ │
94
- │ │ Layer 3: Domain Layer │ │
95
- │ │ - 核心业务逻辑、实体、值对象 │ │
96
- │ │ - 分析器、依赖图构建、符号索引 │ │
97
- │ └─────────────────────────────────────────────────────────────────────┘ │
98
- │ │ │
99
- │ ▼ │
100
- │ ┌─────────────────────────────────────────────────────────────────────┐ │
101
- │ │ Layer 2: Infrastructure Layer │ │
102
- │ │ - 存储抽象、解析器、缓存、文件系统 │ │
103
- │ │ - 技术实现细节 │ │
104
- │ └─────────────────────────────────────────────────────────────────────┘ │
105
- │ │ │
106
- │ ▼ │
107
- │ ┌─────────────────────────────────────────────────────────────────────┐ │
108
- │ │ Layer 1: Interface Layer │ │
109
- │ │ - 类型定义、配置接口、外部 API 抽象 │ │
110
- │ └─────────────────────────────────────────────────────────────────────┘ │
111
- │ │
112
- └─────────────────────────────────────────────────────────────────────────────┘
113
- ```
73
+ - `LanguageId` 仍保留未来扩展空间
74
+ - 但当前文档不再把 Java / Rust / C/C++ / 14 种语言描述成已交付事实
114
75
 
115
- ### 3.2 存储抽象层 (Storage Abstraction)
116
-
117
- ```typescript
118
- // 用户配置示例
119
- type StorageConfig =
120
- | { type: 'filesystem'; path: string }
121
- | { type: 'kuzudb'; path: string }
122
- | { type: 'neo4j'; uri: string; username: string; password: string };
123
-
124
- // 自动选择策略
125
- interface AutoStorageConfig {
126
- type: 'auto';
127
- thresholds: {
128
- useGraphDBWhenFileCount: number; // 默认 500
129
- useGraphDBWhenNodeCount: number; // 默认 10000
130
- };
131
- }
76
+ ### 3.4 公共 CLI
77
+
78
+ 当前公共命令面聚焦于代码地图与代码分析:
79
+
80
+ ```text
81
+ init / generate / query / deps / cycles / complexity / impact
82
+ analyze / ci / workflow / export / ship
132
83
  ```
133
84
 
134
- **功能需求**:
85
+ 其中:
135
86
 
136
- | 需求 ID | 需求描述 | 优先级 | 验收标准 |
137
- |---------|----------|--------|----------|
138
- | SA-01 | 文件系统存储 (默认) | P0 | 与现有 JSON/Md 输出完全兼容 |
139
- | SA-02 | KùzuDB 嵌入式存储 | P1 | 查询性能比文件系统快 10x |
140
- | SA-03 | Neo4j 远程存储 | P2 | 支持企业级部署 |
141
- | SA-04 | 自动选择策略 | P1 | 根据项目规模自动选择后端 |
142
- | SA-05 | 存储迁移工具 | P2 | FS ↔ GraphDB 双向迁移 |
87
+ - `analyze` 的公共契约固定为 `find` / `read` / `link` / `show`
88
+ - `workflow` 是 **analysis-only** 能力,只编排 `find → read → link → show`
89
+ - `ship` 仍是公开的过渡能力,但 must-pass 检查已复用 `ci`
143
90
 
144
- ### 3.3 多语言支持 (14 种语言)
91
+ ### 3.5 文档与验证护栏
145
92
 
146
- ```
147
- ┌─────────────────────────────────────────────────────────────────┐
148
- │ 语言支持路线图 │
149
- ├─────────────────────────────────────────────────────────────────┤
150
- │ │
151
- │ Phase 1 (P0): 当前已支持 │
152
- │ ├── TypeScript ⭐ │
153
- │ ├── JavaScript │
154
- │ └── Go │
155
- │ │
156
- │ Phase 2 (P1): 扩展语言 (MVP3 目标) │
157
- │ ├── Python 🐍 (最高优先级) │
158
- │ ├── Java ☕ │
159
- │ ├── Rust 🦀 │
160
- │ └── C/C++ │
161
- │ │
162
- │ Phase 3 (P2): 后续扩展 │
163
- │ ├── C# │
164
- │ ├── Ruby │
165
- │ ├── PHP │
166
- │ ├── Swift │
167
- │ ├── Kotlin │
168
- │ ├── Dart │
169
- │ └── Perl │
170
- │ │
171
- └─────────────────────────────────────────────────────────────────┘
172
- ```
93
+ 当前已交付的验证基线:
94
+
95
+ - `npm run docs:check`
96
+ - `npm run typecheck`
97
+ - `npm run lint`(当前允许 warning baseline,只阻断 error)
98
+ - `npm test`
99
+ - `npm run build`
100
+ - `node dist/cli/index.js ci check-docs-sync`
173
101
 
174
- **语言实现策略**:
102
+ ---
175
103
 
176
- | 语言 | 解析器 | 复杂度 | 优先级 |
177
- |------|--------|--------|--------|
178
- | Python | Tree-sitter | 中 | P0 |
179
- | Java | Tree-sitter | 中 | P1 |
180
- | Rust | Tree-sitter | 中 | P1 |
181
- | C/C++ | Tree-sitter | 高 | P1 |
182
- | C# | Tree-sitter | 中 | P2 |
183
- | Ruby | Tree-sitter | 低 | P2 |
184
- | PHP | Tree-sitter | 低 | P2 |
185
- | Swift | Tree-sitter | 中 | P2 |
186
- | Kotlin | Tree-sitter | 中 | P2 |
187
- | Dart | Tree-sitter | 低 | P2 |
188
- | Perl | Tree-sitter | 低 | P2 |
104
+ ## 4. 产品需求状态
189
105
 
190
- ### 3.4 CLI 可视化增强
106
+ ### 4.1 已满足
191
107
 
192
- ```
193
- ┌─────────────────────────────────────────────────────────────────┐
194
- │ CLI 可视化功能 │
195
- ├─────────────────────────────────────────────────────────────────┤
196
- │ │
197
- │ 1. 树形目录可视化 (tree view) │
198
- │ $ mycodemap viz tree --depth 3 │
199
- │ 📁 src/
200
- │ ├── 📁 cli/ │
201
- │ │ ├── 📄 index.ts │
202
- │ │ └── 📄 commands/ │
203
- │ └── 📁 core/ │
204
- │ └── 📄 analyzer.ts │
205
- │ │
206
- │ 2. 依赖图字符画 (ascii graph) │
207
- │ $ mycodemap viz deps --format ascii │
208
- │ src/index.ts │
209
- │ ├── src/cli/index.ts │
210
- │ ├── src/core/analyzer.ts │
211
- │ └── src/parser/index.ts │
212
- │ │
213
- │ 3. 热力图 (heatmap) │
214
- │ $ mycodemap viz heatmap --metric complexity │
215
- │ 🔴 src/orchestrator/workflow.ts (复杂度: 45) │
216
- │ 🟡 src/cli/commands/query.ts (复杂度: 28) │
217
- │ 🟢 src/cache/lru-cache.ts (复杂度: 12) │
218
- │ │
219
- │ 4. 进度条和 Spinner │
220
- │ $ mycodemap generate │
221
- │ [████████████████████] 85% | 正在分析 src/core/analyzer.ts │
222
- │ │
223
- └─────────────────────────────────────────────────────────────────┘
224
- ```
108
+ | 需求 | 当前状态 |
109
+ |------|----------|
110
+ | 五层架构与命名边界稳定 | 已满足 |
111
+ | Kùzu-only 图存储主线 | 已满足 |
112
+ | 历史 `neo4j` 配置迁移诊断 | 已满足 |
113
+ | 解析器注册机制与 3 类实现 | 已满足 |
114
+ | `analyze` / `workflow` / `server` 边界收口 | 已满足 |
115
+ | docs/CI guardrail 自动化 | 已满足 |
116
+
117
+ ### 4.2 Deferred
118
+
119
+ | 候选项 | 当前状态 |
120
+ |--------|----------|
121
+ | 更丰富的 auto heuristic 存储切换 | Deferred |
122
+ | Java / Rust / C/C++ 等更多 parser 实现 | Deferred |
123
+ | `viz` / `tui` / 更丰富 CLI 可视化 | Deferred |
124
+ | 公共 HTTP API / `mycodemap server` 产品面 | Deferred |
125
+ | 更深的 Kùzu-native 查询优化 | Deferred |
225
126
 
226
- **CLI 可视化需求**:
127
+ ### 4.3 明确不在当前基线内
227
128
 
228
- | 需求 ID | 功能 | 优先级 | 说明 |
229
- |---------|------|--------|------|
230
- | VIZ-01 | 树形目录视图 | P1 | `--viz tree` |
231
- | VIZ-02 | ASCII 依赖图 | P1 | `--viz deps` |
232
- | VIZ-03 | 复杂度热力图 | P2 | `--viz heatmap` |
233
- | VIZ-04 | 进度条/Spinner | P0 | 所有耗时命令 |
234
- | VIZ-05 | 颜色主题 | P2 | `--theme dark/light` |
235
- | VIZ-06 | 交互式 TUI | P2 | `mycodemap tui` |
129
+ | 项目 | 处理原则 |
130
+ |------|----------|
131
+ | 恢复 `neo4j` 正式支持 | 不在当前范围 |
132
+ | `Server Layer` 重新包装成公共产品面 | 不在当前范围 |
133
+ | workflow 扩回实现/提交/CI 编排 | 不在当前范围 |
236
134
 
237
135
  ---
238
136
 
239
- ## 4. 非功能需求
137
+ ## 5. 用户价值
240
138
 
241
- ### 4.1 性能目标
139
+ ### 5.1 AI / Agent 用户
242
140
 
243
- | 指标 | 当前 | MVP3 目标 | 测试场景 |
244
- |------|------|-----------|----------|
245
- | 首次索引 (1000 文件) | ~30s | < 20s | Fast 模式 |
246
- | 查询响应时间 | ~500ms | < 100ms (GraphDB) | 符号查询 |
247
- | 内存占用 | ~500MB | < 1GB | 5000 文件项目 |
248
- | 增量更新 | ~5s | < 3s | 修改 1 个文件 |
141
+ 需求:
249
142
 
250
- ### 4.2 兼容性
143
+ - 拿到稳定、机器可读、边界清晰的代码上下文
144
+ - 不被不稳定的命令面和文档漂移误导
251
145
 
252
- - **向后兼容**: 现有 `codemap.config.json` 无需修改
253
- - **输出兼容**: `AI_MAP.md` / `CONTEXT.md` 格式保持不变
254
- - **CLI 兼容**: 所有现有命令和参数保持不变
146
+ 当前交付:
255
147
 
256
- ### 4.3 可扩展性
148
+ - 公共命令面已收口
149
+ - 输出契约已固定
150
+ - docs guardrail 与 CI 能阻止高信号漂移
257
151
 
258
- - **新存储后端**: 实现 `StorageAdapter` 接口即可添加
259
- - **新语言**: 实现 `LanguageParser` 接口即可添加
260
- - **新可视化**: 实现 `Visualizer` 接口即可添加
152
+ ### 5.2 Python / Go / TypeScript 团队
153
+
154
+ 需求:
155
+
156
+ - 能在当前主流仓库里复用统一代码地图能力
157
+ - 不需要等到“14 种语言全部完成”才使用 MVP3
158
+
159
+ 当前交付:
160
+
161
+ - TypeScript/JavaScript、Go、Python 已有 parser 实现
162
+ - 解析器接口保留未来扩展余地
163
+
164
+ ### 5.3 大仓库维护者
165
+
166
+ 需求:
167
+
168
+ - 能切换到图存储后端
169
+ - 遇到旧配置时有清晰迁移语义
170
+
171
+ 当前交付:
172
+
173
+ - `filesystem` / `memory` / `kuzudb` / `auto` 为正式配置面
174
+ - 旧 `neo4j` 配置会显式报错,不再静默 fallback
261
175
 
262
176
  ---
263
177
 
264
- ## 5. 发布计划
178
+ ## 6. 非功能基线
265
179
 
266
- ```
267
- ┌─────────────────────────────────────────────────────────────────┐
268
- │ MVP3 发布路线图 │
269
- ├─────────────────────────────────────────────────────────────────┤
270
- │ │
271
- │ v3.0.0-alpha (4 周) │
272
- │ ├── 架构重构: Server 层 + 分层隔离 │
273
- │ └── 存储抽象层基础接口 │
274
- │ │
275
- │ v3.0.0-beta (4 周) │
276
- │ ├── Python 语言支持 │
277
- │ ├── KùzuDB 存储后端 │
278
- │ └── CLI 可视化基础功能 │
279
- │ │
280
- │ v3.0.0-rc (2 周) │
281
- │ ├── Java/Rust/C/C++ 语言支持 │
282
- │ ├── 自动存储选择策略 │
283
- │ └── 性能优化 │
284
- │ │
285
- │ v3.0.0-stable │
286
- │ └── 正式发布 │
287
- │ │
288
- │ v3.1.0+ │
289
- │ └── 剩余 6 种语言 + Neo4j 后端 │
290
- │ │
291
- └─────────────────────────────────────────────────────────────────┘
292
- ```
180
+ ### 6.1 兼容性
181
+
182
+ - 当前正式配置文件名为 `mycodemap.config.json`
183
+ - 对旧 `codemap.config.json` 保留兼容读取与迁移提示
184
+ - 输出仍围绕 `AI_MAP.md`、`codemap.json` 及相关导出格式组织
185
+
186
+ ### 6.2 可维护性
187
+
188
+ - 文档、实现、测试、CI 必须使用同一套边界措辞
189
+ - 架构文档必须持续区分“内部 Server Layer”与“公共 CLI surface”
190
+
191
+ ### 6.3 性能表述
192
+
193
+ 当前文档不再把早期草案中的 `<100ms` GraphDB 指标写成现成 SLA。
194
+
195
+ 更准确的当前表达是:
196
+
197
+ - Kùzu 路径已接入正式产品面
198
+ - 更激进的 DB-native 查询优化属于后续候选项,而非 `v1.3` 既成事实
293
199
 
294
200
  ---
295
201
 
296
- ## 6. 风险与缓解
202
+ ## 7. 发布历史(按已交付里程碑)
297
203
 
298
- | 风险 | 概率 | 影响 | 缓解措施 |
299
- |------|------|------|----------|
300
- | Tree-sitter 性能瓶颈 | | | 预编译 grammar,Worker 线程解析 |
301
- | KùzuDB 稳定性 | | 高 | 保留文件系统作为 fallback |
302
- | 向后兼容性破坏 | | 高 | 完整集成测试,灰度发布 |
303
- | 开发周期延期 | | | 分阶段发布,先核心后扩展 |
204
+ | 里程碑 | 交付重点 |
205
+ |--------|----------|
206
+ | `v1.0` | AI-first 定位、公共 CLI 收口、analyze/workflow/ship/docs guardrail 基线 |
207
+ | `v1.1` | 插件扩展点产品化 |
208
+ | `v1.2` | 图数据库后端生产化 |
209
+ | `v1.3` | Kùzu-only 收敛、高信号 debt 清偿、docs/CI 自动验证闭环 |
304
210
 
305
211
  ---
306
212
 
307
- ## 7. 附录
213
+ ## 8. 风险与缓解
308
214
 
309
- ### 7.1 术语表
215
+ | 风险 | 当前状态 | 缓解策略 |
216
+ |------|----------|----------|
217
+ | 文档继续把历史设计写成当前现实 | 高信号风险 | 持续运行 `docs:check` 与 `ci check-docs-sync` |
218
+ | `Server Layer` 与公共 `server` 命令再次混淆 | 高信号风险 | 在 README / AI docs / 架构文档统一措辞 |
219
+ | `auto` 被误读为“已完成智能切换” | 中 | 文档明确写明当前仍保守落到 `filesystem` |
220
+ | repo-wide lint warnings 演变成阻断项 | 中 | 单独开新 milestone 清理 warning baseline |
310
221
 
311
- | 术语 | 定义 |
312
- |------|------|
313
- | Server Layer | 业务逻辑层,协调 Domain 和 Infrastructure |
314
- | Storage Abstraction | 存储抽象接口,支持多种后端实现 |
315
- | Tree-sitter | 增量解析库,支持多语言 |
316
- | KùzuDB | 高性能嵌入式图数据库 |
222
+ ---
317
223
 
318
- ### 7.2 参考文档
224
+ ## 9. 参考文档
319
225
 
320
- - [MVP3 Tech-PRD](./MVP3-ARCHITECTURE-REDESIGN-TECH-PRD.md)
321
- - [Storage Abstraction Design](../design-docs/storage-abstraction.md)
322
- - [Multi-Language Support Plan](../design-docs/multi-language-support.md)
226
+ - `docs/product-specs/MVP3-ARCHITECTURE-COMPARISON.md`
227
+ - `docs/product-specs/MVP3-ARCHITECTURE-REDESIGN-TECH-PRD.md`
228
+ - `.planning/PROJECT.md`
229
+ - `.planning/REQUIREMENTS.md`
230
+ - `.planning/v1.3-MILESTONE-AUDIT.md`