@mycodemap/mycodemap 0.1.0 → 0.2.0

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 (283) hide show
  1. package/CHANGELOG.md +164 -6
  2. package/README.md +407 -141
  3. package/dist/cli/commands/ci.d.ts +7 -1
  4. package/dist/cli/commands/ci.d.ts.map +1 -1
  5. package/dist/cli/commands/ci.js +38 -0
  6. package/dist/cli/commands/ci.js.map +1 -1
  7. package/dist/cli/commands/cycles.d.ts.map +1 -1
  8. package/dist/cli/commands/cycles.js +2 -0
  9. package/dist/cli/commands/cycles.js.map +1 -1
  10. package/dist/cli/commands/export.d.ts +6 -0
  11. package/dist/cli/commands/export.d.ts.map +1 -0
  12. package/dist/cli/commands/export.js +108 -0
  13. package/dist/cli/commands/export.js.map +1 -0
  14. package/dist/cli/commands/generate.d.ts.map +1 -1
  15. package/dist/cli/commands/generate.js +96 -0
  16. package/dist/cli/commands/generate.js.map +1 -1
  17. package/dist/cli/commands/init.d.ts.map +1 -1
  18. package/dist/cli/commands/init.js +3 -1
  19. package/dist/cli/commands/init.js.map +1 -1
  20. package/dist/cli/commands/logs.d.ts +5 -0
  21. package/dist/cli/commands/logs.d.ts.map +1 -0
  22. package/dist/cli/commands/logs.js +189 -0
  23. package/dist/cli/commands/logs.js.map +1 -0
  24. package/dist/cli/commands/report.d.ts +12 -0
  25. package/dist/cli/commands/report.d.ts.map +1 -0
  26. package/dist/cli/commands/report.js +158 -0
  27. package/dist/cli/commands/report.js.map +1 -0
  28. package/dist/cli/commands/server.d.ts +9 -0
  29. package/dist/cli/commands/server.d.ts.map +1 -0
  30. package/dist/cli/commands/server.js +68 -0
  31. package/dist/cli/commands/server.js.map +1 -0
  32. package/dist/cli/commands/watch-foreground.d.ts.map +1 -1
  33. package/dist/cli/commands/watch-foreground.js +2 -0
  34. package/dist/cli/commands/watch-foreground.js.map +1 -1
  35. package/dist/cli/commands/watch.d.ts.map +1 -1
  36. package/dist/cli/commands/watch.js +2 -0
  37. package/dist/cli/commands/watch.js.map +1 -1
  38. package/dist/cli/first-run-guide.d.ts +23 -0
  39. package/dist/cli/first-run-guide.d.ts.map +1 -0
  40. package/dist/cli/first-run-guide.js +83 -0
  41. package/dist/cli/first-run-guide.js.map +1 -0
  42. package/dist/cli/index.js +85 -1
  43. package/dist/cli/index.js.map +1 -1
  44. package/dist/cli/platform-check.d.ts +21 -0
  45. package/dist/cli/platform-check.d.ts.map +1 -0
  46. package/dist/cli/platform-check.js +94 -0
  47. package/dist/cli/platform-check.js.map +1 -0
  48. package/dist/cli/tree-sitter-check.d.ts +35 -0
  49. package/dist/cli/tree-sitter-check.d.ts.map +1 -0
  50. package/dist/cli/tree-sitter-check.js +133 -0
  51. package/dist/cli/tree-sitter-check.js.map +1 -0
  52. package/dist/cli/utils/sanitize.d.ts +54 -0
  53. package/dist/cli/utils/sanitize.d.ts.map +1 -0
  54. package/dist/cli/utils/sanitize.js +131 -0
  55. package/dist/cli/utils/sanitize.js.map +1 -0
  56. package/dist/cli-new/commands/export.d.ts +15 -0
  57. package/dist/cli-new/commands/export.d.ts.map +1 -0
  58. package/dist/cli-new/commands/export.js +107 -0
  59. package/dist/cli-new/commands/export.js.map +1 -0
  60. package/dist/cli-new/commands/query.d.ts +14 -0
  61. package/dist/cli-new/commands/query.d.ts.map +1 -0
  62. package/dist/cli-new/commands/query.js +120 -0
  63. package/dist/cli-new/commands/query.js.map +1 -0
  64. package/dist/cli-new/commands/server.d.ts +13 -0
  65. package/dist/cli-new/commands/server.d.ts.map +1 -0
  66. package/dist/cli-new/commands/server.js +94 -0
  67. package/dist/cli-new/commands/server.js.map +1 -0
  68. package/dist/cli-new/index.d.ts +11 -0
  69. package/dist/cli-new/index.d.ts.map +1 -0
  70. package/dist/cli-new/index.js +63 -0
  71. package/dist/cli-new/index.js.map +1 -0
  72. package/dist/cli-new/types/index.d.ts +88 -0
  73. package/dist/cli-new/types/index.d.ts.map +1 -0
  74. package/dist/cli-new/types/index.js +7 -0
  75. package/dist/cli-new/types/index.js.map +1 -0
  76. package/dist/domain/entities/CodeGraph.d.ts +134 -0
  77. package/dist/domain/entities/CodeGraph.d.ts.map +1 -0
  78. package/dist/domain/entities/CodeGraph.js +316 -0
  79. package/dist/domain/entities/CodeGraph.js.map +1 -0
  80. package/dist/domain/entities/Dependency.d.ts +78 -0
  81. package/dist/domain/entities/Dependency.d.ts.map +1 -0
  82. package/dist/domain/entities/Dependency.js +132 -0
  83. package/dist/domain/entities/Dependency.js.map +1 -0
  84. package/dist/domain/entities/Module.d.ts +75 -0
  85. package/dist/domain/entities/Module.d.ts.map +1 -0
  86. package/dist/domain/entities/Module.js +151 -0
  87. package/dist/domain/entities/Module.js.map +1 -0
  88. package/dist/domain/entities/Project.d.ts +50 -0
  89. package/dist/domain/entities/Project.d.ts.map +1 -0
  90. package/dist/domain/entities/Project.js +99 -0
  91. package/dist/domain/entities/Project.js.map +1 -0
  92. package/dist/domain/entities/Symbol.d.ts +75 -0
  93. package/dist/domain/entities/Symbol.d.ts.map +1 -0
  94. package/dist/domain/entities/Symbol.js +130 -0
  95. package/dist/domain/entities/Symbol.js.map +1 -0
  96. package/dist/domain/events/DomainEvent.d.ts +76 -0
  97. package/dist/domain/events/DomainEvent.d.ts.map +1 -0
  98. package/dist/domain/events/DomainEvent.js +153 -0
  99. package/dist/domain/events/DomainEvent.js.map +1 -0
  100. package/dist/domain/index.d.ts +10 -0
  101. package/dist/domain/index.d.ts.map +1 -0
  102. package/dist/domain/index.js +18 -0
  103. package/dist/domain/index.js.map +1 -0
  104. package/dist/domain/repositories/CodeGraphRepository.d.ts +58 -0
  105. package/dist/domain/repositories/CodeGraphRepository.d.ts.map +1 -0
  106. package/dist/domain/repositories/CodeGraphRepository.js +37 -0
  107. package/dist/domain/repositories/CodeGraphRepository.js.map +1 -0
  108. package/dist/domain/services/CodeGraphBuilder.d.ts +50 -0
  109. package/dist/domain/services/CodeGraphBuilder.d.ts.map +1 -0
  110. package/dist/domain/services/CodeGraphBuilder.js +121 -0
  111. package/dist/domain/services/CodeGraphBuilder.js.map +1 -0
  112. package/dist/infrastructure/parser/implementations/GoParser.d.ts +25 -0
  113. package/dist/infrastructure/parser/implementations/GoParser.d.ts.map +1 -0
  114. package/dist/infrastructure/parser/implementations/GoParser.js +158 -0
  115. package/dist/infrastructure/parser/implementations/GoParser.js.map +1 -0
  116. package/dist/infrastructure/parser/implementations/PythonParser.d.ts +30 -0
  117. package/dist/infrastructure/parser/implementations/PythonParser.d.ts.map +1 -0
  118. package/dist/infrastructure/parser/implementations/PythonParser.js +201 -0
  119. package/dist/infrastructure/parser/implementations/PythonParser.js.map +1 -0
  120. package/dist/infrastructure/parser/implementations/TypeScriptParser.d.ts +63 -0
  121. package/dist/infrastructure/parser/implementations/TypeScriptParser.d.ts.map +1 -0
  122. package/dist/infrastructure/parser/implementations/TypeScriptParser.js +420 -0
  123. package/dist/infrastructure/parser/implementations/TypeScriptParser.js.map +1 -0
  124. package/dist/infrastructure/parser/index.d.ts +13 -0
  125. package/dist/infrastructure/parser/index.d.ts.map +1 -0
  126. package/dist/infrastructure/parser/index.js +32 -0
  127. package/dist/infrastructure/parser/index.js.map +1 -0
  128. package/dist/infrastructure/parser/interfaces/ParserBase.d.ts +124 -0
  129. package/dist/infrastructure/parser/interfaces/ParserBase.d.ts.map +1 -0
  130. package/dist/infrastructure/parser/interfaces/ParserBase.js +200 -0
  131. package/dist/infrastructure/parser/interfaces/ParserBase.js.map +1 -0
  132. package/dist/infrastructure/parser/registry/ParserRegistry.d.ts +68 -0
  133. package/dist/infrastructure/parser/registry/ParserRegistry.d.ts.map +1 -0
  134. package/dist/infrastructure/parser/registry/ParserRegistry.js +116 -0
  135. package/dist/infrastructure/parser/registry/ParserRegistry.js.map +1 -0
  136. package/dist/infrastructure/repositories/CodeGraphRepositoryImpl.d.ts +44 -0
  137. package/dist/infrastructure/repositories/CodeGraphRepositoryImpl.d.ts.map +1 -0
  138. package/dist/infrastructure/repositories/CodeGraphRepositoryImpl.js +129 -0
  139. package/dist/infrastructure/repositories/CodeGraphRepositoryImpl.js.map +1 -0
  140. package/dist/infrastructure/repositories/index.d.ts +3 -0
  141. package/dist/infrastructure/repositories/index.d.ts.map +1 -0
  142. package/dist/infrastructure/repositories/index.js +7 -0
  143. package/dist/infrastructure/repositories/index.js.map +1 -0
  144. package/dist/infrastructure/storage/StorageFactory.d.ts +53 -0
  145. package/dist/infrastructure/storage/StorageFactory.d.ts.map +1 -0
  146. package/dist/infrastructure/storage/StorageFactory.js +150 -0
  147. package/dist/infrastructure/storage/StorageFactory.js.map +1 -0
  148. package/dist/infrastructure/storage/adapters/FileSystemStorage.d.ts +52 -0
  149. package/dist/infrastructure/storage/adapters/FileSystemStorage.d.ts.map +1 -0
  150. package/dist/infrastructure/storage/adapters/FileSystemStorage.js +315 -0
  151. package/dist/infrastructure/storage/adapters/FileSystemStorage.js.map +1 -0
  152. package/dist/infrastructure/storage/adapters/KuzuDBStorage.d.ts +52 -0
  153. package/dist/infrastructure/storage/adapters/KuzuDBStorage.d.ts.map +1 -0
  154. package/dist/infrastructure/storage/adapters/KuzuDBStorage.js +235 -0
  155. package/dist/infrastructure/storage/adapters/KuzuDBStorage.js.map +1 -0
  156. package/dist/infrastructure/storage/adapters/MemoryStorage.d.ts +37 -0
  157. package/dist/infrastructure/storage/adapters/MemoryStorage.d.ts.map +1 -0
  158. package/dist/infrastructure/storage/adapters/MemoryStorage.js +229 -0
  159. package/dist/infrastructure/storage/adapters/MemoryStorage.js.map +1 -0
  160. package/dist/infrastructure/storage/adapters/Neo4jStorage.d.ts +49 -0
  161. package/dist/infrastructure/storage/adapters/Neo4jStorage.d.ts.map +1 -0
  162. package/dist/infrastructure/storage/adapters/Neo4jStorage.js +222 -0
  163. package/dist/infrastructure/storage/adapters/Neo4jStorage.js.map +1 -0
  164. package/dist/infrastructure/storage/index.d.ts +6 -0
  165. package/dist/infrastructure/storage/index.d.ts.map +1 -0
  166. package/dist/infrastructure/storage/index.js +13 -0
  167. package/dist/infrastructure/storage/index.js.map +1 -0
  168. package/dist/infrastructure/storage/interfaces/StorageBase.d.ts +76 -0
  169. package/dist/infrastructure/storage/interfaces/StorageBase.d.ts.map +1 -0
  170. package/dist/infrastructure/storage/interfaces/StorageBase.js +116 -0
  171. package/dist/infrastructure/storage/interfaces/StorageBase.js.map +1 -0
  172. package/dist/interface/config/index.d.ts +102 -0
  173. package/dist/interface/config/index.d.ts.map +1 -0
  174. package/dist/interface/config/index.js +7 -0
  175. package/dist/interface/config/index.js.map +1 -0
  176. package/dist/interface/types/index.d.ts +425 -0
  177. package/dist/interface/types/index.d.ts.map +1 -0
  178. package/dist/interface/types/index.js +8 -0
  179. package/dist/interface/types/index.js.map +1 -0
  180. package/dist/interface/types/parser.d.ts +103 -0
  181. package/dist/interface/types/parser.d.ts.map +1 -0
  182. package/dist/interface/types/parser.js +7 -0
  183. package/dist/interface/types/parser.js.map +1 -0
  184. package/dist/interface/types/storage.d.ts +98 -0
  185. package/dist/interface/types/storage.d.ts.map +1 -0
  186. package/dist/interface/types/storage.js +7 -0
  187. package/dist/interface/types/storage.js.map +1 -0
  188. package/dist/orchestrator/test-linker.js +1 -1
  189. package/dist/orchestrator/test-linker.js.map +1 -1
  190. package/dist/server/CodeMapServer.d.ts +51 -0
  191. package/dist/server/CodeMapServer.d.ts.map +1 -0
  192. package/dist/server/CodeMapServer.js +146 -0
  193. package/dist/server/CodeMapServer.js.map +1 -0
  194. package/dist/server/handlers/AnalysisHandler.d.ts +82 -0
  195. package/dist/server/handlers/AnalysisHandler.d.ts.map +1 -0
  196. package/dist/server/handlers/AnalysisHandler.js +196 -0
  197. package/dist/server/handlers/AnalysisHandler.js.map +1 -0
  198. package/dist/server/handlers/QueryHandler.d.ts +57 -0
  199. package/dist/server/handlers/QueryHandler.d.ts.map +1 -0
  200. package/dist/server/handlers/QueryHandler.js +260 -0
  201. package/dist/server/handlers/QueryHandler.js.map +1 -0
  202. package/dist/server/index.d.ts +7 -0
  203. package/dist/server/index.d.ts.map +1 -0
  204. package/dist/server/index.js +13 -0
  205. package/dist/server/index.js.map +1 -0
  206. package/dist/server/routes/api.d.ts +8 -0
  207. package/dist/server/routes/api.d.ts.map +1 -0
  208. package/dist/server/routes/api.js +372 -0
  209. package/dist/server/routes/api.js.map +1 -0
  210. package/dist/server/types/index.d.ts +171 -0
  211. package/dist/server/types/index.d.ts.map +1 -0
  212. package/dist/server/types/index.js +7 -0
  213. package/dist/server/types/index.js.map +1 -0
  214. package/dist/types/index.d.ts +6 -372
  215. package/dist/types/index.d.ts.map +1 -1
  216. package/dist/types/index.js +9 -3
  217. package/dist/types/index.js.map +1 -1
  218. package/docs/AI_ASSISTANT_SETUP.md +811 -0
  219. package/docs/PUBLISHING.md +162 -0
  220. package/docs/README.md +37 -0
  221. package/docs/SETUP_GUIDE.md +493 -0
  222. package/docs/ai-guide/COMMANDS.md +369 -0
  223. package/docs/ai-guide/INTEGRATION.md +513 -0
  224. package/docs/ai-guide/OUTPUT.md +465 -0
  225. package/docs/ai-guide/PATTERNS.md +409 -0
  226. package/docs/ai-guide/PROMPTS.md +414 -0
  227. package/docs/ai-guide/QUICKSTART.md +114 -0
  228. package/docs/ai-guide/README.md +66 -0
  229. package/docs/archive/AI_INTEGRATION_GUIDE_ARCHIVED.md +391 -0
  230. package/docs/archive/ARCHIVE.md +39 -0
  231. package/docs/archive/MYCLAUDE_GUIDE.md +305 -0
  232. package/docs/archive/PUBLISH_NPM_DESIGN_V1.md +1699 -0
  233. package/docs/archive/PUBLISH_NPM_DESIGN_V2.md +396 -0
  234. package/docs/archive/README.md +29 -0
  235. package/docs/archive/TASK_DESIGN_COVERAGE_REPORT.md +320 -0
  236. package/docs/archive/TEST_SUMMARY.md +140 -0
  237. package/docs/archive/comprehensive_test_report.md +337 -0
  238. package/docs/archive/design-docs/CI_GATEWAY_DESIGN.md +790 -0
  239. package/docs/archive/design-docs/PUBLISH_NPM_DESIGN_FINAL.md +491 -0
  240. package/docs/archive/design-docs/REFACTOR_ARCHITECTURE_OVERVIEW.md +558 -0
  241. package/docs/archive/design-docs/REFACTOR_CONFIDENCE_DESIGN.md +250 -0
  242. package/docs/archive/design-docs/REFACTOR_GIT_ANALYZER_DESIGN.md +791 -0
  243. package/docs/archive/design-docs/REFACTOR_ORCHESTRATOR_DESIGN.md +1071 -0
  244. package/docs/archive/design-docs/REFACTOR_RESULT_FUSION_DESIGN.md +321 -0
  245. package/docs/archive/design-docs/REFACTOR_TEST_LINKER_DESIGN.md +317 -0
  246. package/docs/archive/myclaude.md +1084 -0
  247. package/docs/archive/plans/2026-03-14-go-language-support-design.md +92 -0
  248. package/docs/archive/product-specs/REFACTOR_REQUIREMENTS.md +976 -0
  249. package/docs/archive/scenario-2-deps-analysis.md +353 -0
  250. package/docs/archive/test-report-symbol-search.md +384 -0
  251. package/docs/archive/test-scenario-4-complexity-analysis.md +460 -0
  252. package/docs/archive/test_report_scenario5.md +615 -0
  253. package/docs/archive/test_scenario_3_impact_analysis_report.md +520 -0
  254. package/docs/design-docs/README.md +26 -0
  255. package/docs/exec-plans/MVP3-IMPLEMENTATION-ROADMAP.md +524 -0
  256. package/docs/exec-plans/README.md +29 -0
  257. package/docs/exec-plans/active/.gitkeep +0 -0
  258. package/docs/exec-plans/completed/.gitkeep +0 -0
  259. package/docs/exec-plans/completed/2026-03-03-deps-path-extension-fix.md +186 -0
  260. package/docs/exec-plans/completed/2026-03-03-post-task-plan.md +135 -0
  261. package/docs/exec-plans/completed/harness-engineering-rollout.md +184 -0
  262. package/docs/exec-plans/tech-debt/.gitkeep +0 -0
  263. package/docs/exec-plans/tech-debt/2026-03-15-lint-guardrail-gap.md +30 -0
  264. package/docs/generated/README.md +19 -0
  265. package/docs/product-specs/MVP3-ARCHITECTURE-COMPARISON.md +504 -0
  266. package/docs/product-specs/MVP3-ARCHITECTURE-REDESIGN-PRD.md +322 -0
  267. package/docs/product-specs/MVP3-ARCHITECTURE-REDESIGN-TECH-PRD.md +1374 -0
  268. package/docs/product-specs/README.md +22 -0
  269. package/docs/references/README.md +15 -0
  270. package/docs/references/tmp.md +527 -0
  271. package/docs/rules/README.md +16 -0
  272. package/docs/rules/architecture-guardrails.md +349 -0
  273. package/docs/rules/code-quality-redlines.md +321 -0
  274. package/docs/rules/deployment.md +23 -0
  275. package/docs/rules/engineering-with-codex-openai.md +202 -0
  276. package/docs/rules/testing.md +73 -0
  277. package/docs/rules/validation.md +39 -0
  278. package/examples/README.md +61 -0
  279. package/examples/claude/codemap-skill.md +94 -0
  280. package/examples/codex/codemap-agent.md +66 -0
  281. package/examples/copilot/copilot-instructions.md +24 -0
  282. package/examples/kimi/codemap-skill.md +92 -0
  283. package/package.json +22 -7
@@ -0,0 +1,337 @@
1
+ # CodeMap 综合测试报告
2
+
3
+ **测试时间**: 2026年3月
4
+ **测试场景**: 5个核心功能场景
5
+ **测试目录**: /data/codemap
6
+ **项目规模**: 104个TypeScript文件,28,878行代码
7
+
8
+ ---
9
+
10
+ ## 1. 执行摘要
11
+
12
+ ### 1.1 测试覆盖范围
13
+
14
+ | 场景 | 测试功能 | 对比工具 | 测试重点 |
15
+ |-------|-------------------------|------------------------|----------------------------|
16
+ | 场景1 | 符号搜索 (-s/-S) | grep/rg | 精确/模糊匹配、类型识别 |
17
+ | 场景2 | 模块依赖分析 (deps) | grep/rg | 双向依赖、循环检测、排名统计 |
18
+ | 场景3 | 影响范围分析 (impact) | grep | 传递依赖、风险评估 |
19
+ | 场景4 | 复杂度分析 (complexity) | ESLint/SonarQube(理论) | 圈复杂度、可维护性指数 |
20
+ | 场景5 | 查询与JSON输出 (query) | grep/rg | 多模式查询、结构化输出 |
21
+
22
+ ### 1.2 关键发现总结
23
+
24
+ **✅ 核心优势**:
25
+ - **语义化理解**: 识别符号类型(interface/class/function),区分定义和引用
26
+ - **独有功能**: 传递依赖分析、循环依赖检测、风险评估
27
+ - **结构化输出**: JSON格式支持,便于工具链集成
28
+ - **双向分析**: 同时查看依赖和被依赖关系
29
+
30
+ **❌ 关键问题**:
31
+ - **性能严重落后**: 比rg/grep慢60-300倍
32
+ - **搜索算法缺陷**: 符号搜索遗漏关键类(如GitAnalyzer)
33
+ - **指标计算错误**: 可维护性指数全部为100(完全不可用)
34
+ - **re-export遗漏**: 未检测通过re-export模式的依赖
35
+
36
+ ### 1.3 整体评分
37
+
38
+ | 评估维度 | 评分 | 权重 | 加权得分 |
39
+ |------------|------------|----------|------------|
40
+ | 功能完整性 | ⭐⭐⭐⭐ (4/5) | 25% | 1.0 |
41
+ | 准确性 | ⭐⭐⭐ (3/5) | 25% | 0.75 |
42
+ | 性能 | ⭐⭐ (2/5) | 20% | 0.4 |
43
+ | 易用性 | ⭐⭐⭐⭐ (4/5) | 15% | 0.6 |
44
+ | 输出质量 | ⭐⭐⭐⭐ (4/5) | 15% | 0.6 |
45
+ | **总分** | | **100%** | **3.35/5** |
46
+
47
+ **综合评级**: ⭐⭐⭐ (良好,有显著改进空间)
48
+
49
+ ---
50
+
51
+ ## 2. CodeMap 优势(按场景)
52
+
53
+ ### 场景1: 符号搜索
54
+
55
+ | 优势 | 说明 |
56
+ |--------------|----------------------------------------|
57
+ | 符号类型识别 | 自动识别interface/variable/class等类型 |
58
+ | 导出信息 | 显示符号是否导出,便于理解模块API |
59
+ | 结构化输出 | 带类型标签的清晰格式 |
60
+ | 去重能力 | 符号级去重,避免重复显示 |
61
+
62
+ ### 场景2: 模块依赖分析
63
+
64
+ | 优势 | 说明 | 独有性 |
65
+ |--------------|------------------------------|--------|
66
+ | 双向依赖 | 同时显示导入(⬇️)和被导入(⬆️) | ✅ 独有 |
67
+ | 循环依赖检测 | 一键检测项目中的循环依赖 | ✅ 独有 |
68
+ | 依赖排名 | 自动按依赖数排名Top 20 | ✅ 独有 |
69
+ | 模块分类 | 自动区分source/test类型 | ✅ 独有 |
70
+
71
+ ### 场景3: 影响范围分析
72
+
73
+ | 优势 | 说明 | 独有性 |
74
+ |--------------|-------------------------------------|--------|
75
+ | 传递依赖分析 | 显示间接影响的所有模块(距离标记) | ✅ 独有 |
76
+ | 风险评估 | 量化风险等级(极高/高/中/低) | ✅ 独有 |
77
+ | 零误报率 | 依赖识别准确率100%,grep误报率20-60% | ✅ 优势 |
78
+ | 可视化树 | 树形结构展示依赖关系 | ✅ 独有 |
79
+
80
+ ### 场景4: 复杂度分析
81
+
82
+ | 优势 | 说明 |
83
+ |----------|--------------------------|
84
+ | 执行速度 | 0.6-0.8秒完成全项目分析 |
85
+ | 快速概览 | 快速识别最复杂的15个文件 |
86
+ | 风险分级 | 高/中/低风险分级展示 |
87
+ | JSON支持 | 便于CI/CD集成 |
88
+
89
+ ### 场景5: 查询与JSON输出
90
+
91
+ | 优势 | 说明 |
92
+ |------------|---------------------------------|
93
+ | 多模式查询 | 符号/模块/依赖/模糊搜索四种模式 |
94
+ | 语义化理解 | 理解代码结构,非纯文本匹配 |
95
+ | 边界处理 | 空结果、特殊字符处理得当 |
96
+ | 中文本地化 | 友好的中文错误提示和帮助 |
97
+
98
+ ---
99
+
100
+ ## 3. 发现的问题清单(按优先级)
101
+
102
+ ### P0 - 严重问题(阻碍使用)
103
+
104
+ | 优先级 | 问题 | 影响场景 | 修复难度 | 详细说明 |
105
+ |--------|--------------------------|----------|----------|---------------------------------------------------------------------------|
106
+ | P0 | **符号搜索严重遗漏** | 场景1, 5 | 高 | 搜索"Analyzer"未找到`GitAnalyzer`类,只返回不相关变量;子串匹配算法存在缺陷 |
107
+ | P0 | **可维护性指数计算错误** | 场景4 | 中 | 所有104个文件显示为100,计算公式`171 - 5.2*ln(loc) - 0.23*cyc`实现有误 |
108
+ | P0 | **性能严重落后** | 所有场景 | 高 | 比rg慢60-300倍:符号搜索70倍、依赖分析200倍、影响分析80倍 |
109
+ | P0 | **re-export依赖遗漏** | 场景2, 3 | 中 | 未检测`export { foo } from './module'`模式的依赖关系 |
110
+
111
+ ### P1 - 中等问题(影响体验)
112
+
113
+ | 优先级 | 问题 | 影响场景 | 修复难度 | 详细说明 |
114
+ |--------|------------------------------|----------|----------|----------------------------------------------------------------|
115
+ | P1 | **圈复杂度估算而非精确计算** | 场景4 | 中 | 基于`functions + classes + 1`估算,非真正分析控制流语句 |
116
+ | P1 | **认知复杂度过于简化** | 场景4 | 中 | 仅`cyclomatic * 1.5`,未考虑嵌套深度、递归等因素 |
117
+ | P1 | **JSON details字段非结构化** | 场景5 | 低 | "定义于 src/types/index.ts:154"为自然语言,需正则解析 |
118
+ | P1 | **大小写处理不一致** | 场景1, 5 | 低 | 搜索"ModuleInfo"返回"moduleInfo"变量,但"cache"搜索又区分大小写 |
119
+ | P1 | **路径扩展名不一致** | 场景2 | 低 | 显示`.js`而非源代码`.ts`扩展名 |
120
+ | P1 | **依赖查询结果重复** | 场景5 | 低 | `query -d`同时返回dependency和import类型,内容重复 |
121
+ | P1 | **命令输出格式不一致** | 场景5 | 低 | `deps -j`和`query -d -j`返回完全不同的JSON结构 |
122
+
123
+ ### P2 - 轻微问题(改进建议)
124
+
125
+ | 优先级 | 问题 | 影响场景 | 修复难度 | 详细说明 |
126
+ |--------|--------------------------|----------|----------|---------------------------------------|
127
+ | P2 | **缺少函数级复杂度详情** | 场景4 | 中 | 仅文件级分析,无法定位具体复杂函数 |
128
+ | P2 | **缺少正则表达式支持** | 场景5 | 低 | 模糊搜索仅支持子字符串,不支持regex |
129
+ | P2 | **dependents使用内部ID** | 场景2, 5 | 低 | 返回"iucg3n"等ID而非路径,可读性差 |
130
+ | P2 | **风险等级阈值跳跃** | 场景3 | 低 | 13和38依赖都被归为"极高",缺少中间等级 |
131
+ | P2 | **缺少代码上下文** | 场景1 | 低 | 不像rg显示匹配行的代码片段 |
132
+ | P2 | **缺少传递依赖深度控制** | 场景2, 3 | 低 | 不支持`--depth`参数限制依赖深度 |
133
+ | P2 | **复杂度数据未存储** | 场景4 | 低 | codemap.json中complexity字段为空对象 |
134
+
135
+ ---
136
+
137
+ ## 4. 与传统工具对比总结
138
+
139
+ ### 4.1 速度对比
140
+
141
+ | 场景 | CodeMap | rg | grep | 速度比 (rg/CodeMap) |
142
+ |------------|---------|--------|--------|---------------------|
143
+ | 符号搜索 | 0.538s | 0.008s | 0.003s | 67x / 179x |
144
+ | 模糊搜索 | 0.642s | 0.007s | - | 91x |
145
+ | 模块依赖 | 0.658s | 0.003s | - | 219x |
146
+ | 影响分析 | 0.800s | 0.010s | - | 80x |
147
+ | 复杂度分析 | 0.673s | N/A | N/A | - |
148
+ | 查询(平均) | 0.583s | 0.007s | 0.003s | 83x / 194x |
149
+
150
+ ### 4.2 功能对比
151
+
152
+ | 场景 | CodeMap 优势 | CodeMap 劣势 | 推荐工具 |
153
+ |----------------|----------------------------------|--------------------------------|--------------------------------|
154
+ | **符号搜索** | 符号类型识别、导出信息、结构化输出 | 速度慢、结果数量有限、遗漏类定义 | 查找定义用CodeMap,快速搜索用rg |
155
+ | **模块依赖** | 双向分析、循环检测、排名统计 | 速度慢、路径显示不一致 | 依赖分析用CodeMap,快速查看用rg |
156
+ | **影响分析** | 传递依赖、风险评估、零误报 | 遗漏re-export、速度慢 | 影响分析必用CodeMap |
157
+ | **复杂度分析** | 速度极快、风险分级 | 指标计算错误、缺少函数级详情 | 目前不推荐用于质量门禁 |
158
+ | **查询输出** | JSON结构化、多模式查询 | 速度慢、缺少正则支持 | API集成用CodeMap,实时搜索用rg |
159
+
160
+ ### 4.3 准确性对比
161
+
162
+ | 场景 | CodeMap 准确率 | grep/rg 准确率 | 说明 |
163
+ |--------------|----------------|----------------|---------------------------|
164
+ | 直接依赖识别 | 100% | 40-80% | CodeMap几乎零误报 |
165
+ | 传递依赖识别 | 独有功能 | 无法完成 | CodeMap独有优势 |
166
+ | 符号类型识别 | 部分问题 | 不支持 | CodeMap能识别类型但有遗漏 |
167
+ | 循环依赖检测 | 独有功能 | 几乎不可行 | CodeMap一键检测 |
168
+
169
+ ### 4.4 综合推荐
170
+
171
+ | 需求 | 推荐工具 | 原因 |
172
+ |--------------|----------------------|---------------------------------------|
173
+ | 快速文本搜索 | **rg/grep** | 速度快60-300倍,无需索引 |
174
+ | 符号定义查找 | **CodeMap** | 结构化输出,带类型信息(需修复搜索算法) |
175
+ | 依赖分析 | **CodeMap** | 双向分析、循环检测、传递依赖 |
176
+ | 影响范围评估 | **CodeMap** | 独有传递依赖分析,风险评估 |
177
+ | 复杂度监控 | **ESLint/SonarQube** | CodeMap指标计算不准确 |
178
+ | CI/CD集成 | **CodeMap** | JSON输出便于自动化(需修复格式问题) |
179
+ | IDE插件开发 | **CodeMap** | 语义化查询,结构化输出 |
180
+
181
+ ---
182
+
183
+ ## 5. 修复计划
184
+
185
+ ### 阶段1: P0问题修复(2-3周)
186
+
187
+ | 序号 | 修复项 | 具体措施 | 预期效果 |
188
+ |------|-------------------|---------------------------------------------------------------------|--------------------------|
189
+ | 1.1 | 修复符号搜索算法 | 实现正确的子串匹配;确保"Analyzer"匹配"GitAnalyzer";检查索引查询逻辑 | 搜索准确性提升至99%+ |
190
+ | 1.2 | 修复可维护性指数 | 修正计算公式;参考Microsoft Maintainability Index标准 | 指标恢复参考价值 |
191
+ | 1.3 | 实现缓存机制 | 添加内存缓存;支持守护进程模式;增量索引更新 | 性能提升5-10倍 |
192
+ | 1.4 | 支持re-export检测 | 解析`export { } from`和`export * from`语法 | 依赖分析完整性提升至100% |
193
+
194
+ ### 阶段2: P1问题修复(1-2周)
195
+
196
+ | 序号 | 修复项 | 具体措施 | 预期效果 |
197
+ |------|----------------------|---------------------------------------------------------------|----------------|
198
+ | 2.1 | 实现精确圈复杂度计算 | 基于AST分析if/for/while/case/catch等控制流语句 | 指标准确性提升 |
199
+ | 2.2 | 改进认知复杂度算法 | 参考SonarQube实现,考虑嵌套深度和递归 | 算法专业性提升 |
200
+ | 2.3 | 结构化JSON输出 | 添加`location: {file, line, column}`对象;分离`isExported`字段 | API可用性提升 |
201
+ | 2.4 | 统一大小写处理 | 添加`--case-sensitive`选项;默认大小写敏感 | 行为一致性 |
202
+ | 2.5 | 修复路径显示 | 默认显示`.ts`路径;添加`--build-paths`选项显示`.js` | 用户体验提升 |
203
+ | 2.6 | 统一命令输出格式 | 统一`deps`和`query -d`的JSON结构 | API一致性 |
204
+
205
+ ### 阶段3: P2功能增强(2-4周)
206
+
207
+ | 序号 | 增强项 | 具体措施 | 预期效果 |
208
+ |------|----------------------|-------------------------------------------|------------------------|
209
+ | 3.1 | 函数级复杂度分析 | 添加`--detail`选项显示函数级复杂度 | 支持代码审查 |
210
+ | 3.2 | 正则搜索支持 | 添加`--regex`选项 | 查询灵活性提升 |
211
+ | 3.3 | 修复dependents可读性 | 返回模块路径而非内部ID | 输出可读性提升 |
212
+ | 3.4 | 细化风险等级 | 增加阈值等级:0-2低/3-10中/11-25高/26+极高 | 风险评估更精确 |
213
+ | 3.5 | 添加代码上下文 | 显示匹配行的代码片段(类似rg) | 调试便利性提升 |
214
+ | 3.6 | 支持依赖深度控制 | 添加`--depth`参数限制传递依赖深度 | 性能与灵活性平衡 |
215
+ | 3.7 | 预计算复杂度数据 | 在generate阶段计算并存储复杂度数据 | complexity命令性能提升 |
216
+
217
+ ### 修复时间表
218
+
219
+ ```
220
+ 周次: 1 2 3 4 5 6 7 8
221
+ ├────P0修复────┤
222
+ ├────P1修复────┤
223
+ ├────P2增强────┤
224
+ ```
225
+
226
+ **里程碑**:
227
+ - **W3**: P0问题修复完成,发布v0.1.1
228
+ - **W5**: P1问题修复完成,发布v0.1.2
229
+ - **W8**: P2功能增强完成,发布v0.2.0
230
+
231
+ ---
232
+
233
+ ## 6. 使用建议
234
+
235
+ ### 6.1 推荐使用场景
236
+
237
+ | 场景 | 使用方式 | 示例命令 |
238
+ |--------------------|-------------------------|------------------------------------------------------------------------|
239
+ | **重构前影响分析** | 必用impact命令 | `npx codemap impact -f src/core/analyzer.ts --transitive` |
240
+ | **依赖架构审查** | 必用deps命令 | `npx codemap deps -m "src/parser"` |
241
+ | **循环依赖检测** | 必用cycles命令 | `npx codemap cycles` |
242
+ | **发布前风险评估** | impact + complexity组合 | `npx codemap impact -f changed.ts && npx codemap complexity -f changed.ts` |
243
+ | **IDE插件开发** | query + JSON输出 | `npx codemap query -s "SymbolName" -j` |
244
+ | **CI/CD依赖检查** | deps + cycles | `npx codemap deps && npx codemap cycles` |
245
+
246
+ ### 6.2 不推荐/需谨慎场景
247
+
248
+ | 场景 | 原因 | 替代方案 |
249
+ |------------------------|-----------------|---------------------------|
250
+ | 纯文本快速搜索 | 速度慢100-300倍 | 使用`rg`或`grep` |
251
+ | 高频实时监控 | 性能瓶颈 | 使用`rg`或文件系统监听 |
252
+ | 复杂度质量门禁 | 指标计算不准确 | 使用ESLint或SonarQube |
253
+ | 代码审查中定位复杂函数 | 缺少函数级详情 | 使用ESLint complexity规则 |
254
+
255
+ ### 6.3 混合使用策略
256
+
257
+ ```bash
258
+ # 场景1: 快速定位符号定义,然后理解上下文
259
+ npx codemap query -s "ModuleInfo" -j # 获取定义位置和类型
260
+ rg -n "ModuleInfo" src/ -A 3 -B 1 # 查看代码上下文
261
+
262
+ # 场景2: 分析变更影响范围
263
+ npx codemap impact -f src/core/analyzer.ts --transitive # 获取传递依赖
264
+ rg -l "analyzer" src/ # 快速文本验证
265
+
266
+ # 场景3: 依赖分析 + 复杂度检查
267
+ npx codemap deps -m "src/core" # 分析模块依赖
268
+ npx codemap complexity -f src/core/analyzer.ts # 检查复杂度(仅供参考)
269
+ eslint src/core/analyzer.ts --rule 'complexity: [error, 10]' # 精确复杂度检查
270
+ ```
271
+
272
+ ### 6.4 配置文件建议
273
+
274
+ 建议创建`codemap.config.json`:
275
+
276
+ ```json
277
+ {
278
+ "query": {
279
+ "defaultLimit": 20,
280
+ "caseSensitive": true
281
+ },
282
+ "deps": {
283
+ "showBuildPaths": false,
284
+ "maxDepth": 5
285
+ },
286
+ "complexity": {
287
+ "cyclomaticThresholds": { "low": 10, "medium": 20, "high": 30 },
288
+ "excludePatterns": ["*.test.ts", "*.spec.ts"]
289
+ },
290
+ "output": {
291
+ "defaultFormat": "human",
292
+ "jsonLocationStructured": true
293
+ }
294
+ }
295
+ ```
296
+
297
+ ---
298
+
299
+ ## 7. 附录
300
+
301
+ ### 7.1 测试原始数据
302
+
303
+ | 指标 | 数值 |
304
+ |------------|------------|
305
+ | 总文件数 | 104 |
306
+ | 总行数 | 28,878 |
307
+ | 总模块数 | 104 |
308
+ | 总导出 | 378 |
309
+ | 总类型 | 70 |
310
+ | 总依赖关系 | 350 |
311
+ | 高风险文件 | 6 (5.8%) |
312
+ | 中风险文件 | 15 (14.4%) |
313
+ | 低风险文件 | 83 (79.8%) |
314
+
315
+ ### 7.2 发现的符号清单
316
+
317
+ | 符号名 | 类型 | 位置 |
318
+ |----------------------------|-----------|------------------------------------------------|
319
+ | `ModuleInfo` | interface | src/types/index.ts:154 |
320
+ | `GitAnalyzer` | class | src/orchestrator/git-analyzer.ts:121 |
321
+ | `ComplexityAnalyzerPlugin` | class | src/plugins/built-in/complexity-analyzer.ts:96 |
322
+ | `analyze` | function | src/core/analyzer.ts |
323
+ | `LRUCache` | class | src/cache/lru-cache.ts |
324
+
325
+ ### 7.3 参考文档
326
+
327
+ - 场景1详细报告: `/data/codemap/test-report-symbol-search.md`
328
+ - 场景2详细报告: `/data/codemap/test-reports/scenario-2-deps-analysis.md`
329
+ - 场景3详细报告: `/data/codemap/test_scenario_3_impact_analysis_report.md`
330
+ - 场景4详细报告: `/data/codemap/test-scenario-4-complexity-analysis.md`
331
+ - 场景5详细报告: `/data/codemap/test_report_scenario5.md`
332
+
333
+ ---
334
+
335
+ *报告生成时间: 2026-03-02*
336
+ *报告生成者: 测试协调员*
337
+ *版本: v1.0*