@mycodemap/mycodemap 0.1.1 → 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 (243) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/README.md +241 -67
  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/export.d.ts +6 -0
  8. package/dist/cli/commands/export.d.ts.map +1 -0
  9. package/dist/cli/commands/export.js +108 -0
  10. package/dist/cli/commands/export.js.map +1 -0
  11. package/dist/cli/commands/generate.d.ts.map +1 -1
  12. package/dist/cli/commands/generate.js +96 -0
  13. package/dist/cli/commands/generate.js.map +1 -1
  14. package/dist/cli/commands/server.d.ts +9 -0
  15. package/dist/cli/commands/server.d.ts.map +1 -0
  16. package/dist/cli/commands/server.js +68 -0
  17. package/dist/cli/commands/server.js.map +1 -0
  18. package/dist/cli/index.js +22 -1
  19. package/dist/cli/index.js.map +1 -1
  20. package/dist/cli-new/commands/export.d.ts +15 -0
  21. package/dist/cli-new/commands/export.d.ts.map +1 -0
  22. package/dist/cli-new/commands/export.js +107 -0
  23. package/dist/cli-new/commands/export.js.map +1 -0
  24. package/dist/cli-new/commands/query.d.ts +14 -0
  25. package/dist/cli-new/commands/query.d.ts.map +1 -0
  26. package/dist/cli-new/commands/query.js +120 -0
  27. package/dist/cli-new/commands/query.js.map +1 -0
  28. package/dist/cli-new/commands/server.d.ts +13 -0
  29. package/dist/cli-new/commands/server.d.ts.map +1 -0
  30. package/dist/cli-new/commands/server.js +94 -0
  31. package/dist/cli-new/commands/server.js.map +1 -0
  32. package/dist/cli-new/index.d.ts +11 -0
  33. package/dist/cli-new/index.d.ts.map +1 -0
  34. package/dist/cli-new/index.js +63 -0
  35. package/dist/cli-new/index.js.map +1 -0
  36. package/dist/cli-new/types/index.d.ts +88 -0
  37. package/dist/cli-new/types/index.d.ts.map +1 -0
  38. package/dist/cli-new/types/index.js +7 -0
  39. package/dist/cli-new/types/index.js.map +1 -0
  40. package/dist/domain/entities/CodeGraph.d.ts +134 -0
  41. package/dist/domain/entities/CodeGraph.d.ts.map +1 -0
  42. package/dist/domain/entities/CodeGraph.js +316 -0
  43. package/dist/domain/entities/CodeGraph.js.map +1 -0
  44. package/dist/domain/entities/Dependency.d.ts +78 -0
  45. package/dist/domain/entities/Dependency.d.ts.map +1 -0
  46. package/dist/domain/entities/Dependency.js +132 -0
  47. package/dist/domain/entities/Dependency.js.map +1 -0
  48. package/dist/domain/entities/Module.d.ts +75 -0
  49. package/dist/domain/entities/Module.d.ts.map +1 -0
  50. package/dist/domain/entities/Module.js +151 -0
  51. package/dist/domain/entities/Module.js.map +1 -0
  52. package/dist/domain/entities/Project.d.ts +50 -0
  53. package/dist/domain/entities/Project.d.ts.map +1 -0
  54. package/dist/domain/entities/Project.js +99 -0
  55. package/dist/domain/entities/Project.js.map +1 -0
  56. package/dist/domain/entities/Symbol.d.ts +75 -0
  57. package/dist/domain/entities/Symbol.d.ts.map +1 -0
  58. package/dist/domain/entities/Symbol.js +130 -0
  59. package/dist/domain/entities/Symbol.js.map +1 -0
  60. package/dist/domain/events/DomainEvent.d.ts +76 -0
  61. package/dist/domain/events/DomainEvent.d.ts.map +1 -0
  62. package/dist/domain/events/DomainEvent.js +153 -0
  63. package/dist/domain/events/DomainEvent.js.map +1 -0
  64. package/dist/domain/index.d.ts +10 -0
  65. package/dist/domain/index.d.ts.map +1 -0
  66. package/dist/domain/index.js +18 -0
  67. package/dist/domain/index.js.map +1 -0
  68. package/dist/domain/repositories/CodeGraphRepository.d.ts +58 -0
  69. package/dist/domain/repositories/CodeGraphRepository.d.ts.map +1 -0
  70. package/dist/domain/repositories/CodeGraphRepository.js +37 -0
  71. package/dist/domain/repositories/CodeGraphRepository.js.map +1 -0
  72. package/dist/domain/services/CodeGraphBuilder.d.ts +50 -0
  73. package/dist/domain/services/CodeGraphBuilder.d.ts.map +1 -0
  74. package/dist/domain/services/CodeGraphBuilder.js +121 -0
  75. package/dist/domain/services/CodeGraphBuilder.js.map +1 -0
  76. package/dist/infrastructure/parser/implementations/GoParser.d.ts +25 -0
  77. package/dist/infrastructure/parser/implementations/GoParser.d.ts.map +1 -0
  78. package/dist/infrastructure/parser/implementations/GoParser.js +158 -0
  79. package/dist/infrastructure/parser/implementations/GoParser.js.map +1 -0
  80. package/dist/infrastructure/parser/implementations/PythonParser.d.ts +30 -0
  81. package/dist/infrastructure/parser/implementations/PythonParser.d.ts.map +1 -0
  82. package/dist/infrastructure/parser/implementations/PythonParser.js +201 -0
  83. package/dist/infrastructure/parser/implementations/PythonParser.js.map +1 -0
  84. package/dist/infrastructure/parser/implementations/TypeScriptParser.d.ts +63 -0
  85. package/dist/infrastructure/parser/implementations/TypeScriptParser.d.ts.map +1 -0
  86. package/dist/infrastructure/parser/implementations/TypeScriptParser.js +420 -0
  87. package/dist/infrastructure/parser/implementations/TypeScriptParser.js.map +1 -0
  88. package/dist/infrastructure/parser/index.d.ts +13 -0
  89. package/dist/infrastructure/parser/index.d.ts.map +1 -0
  90. package/dist/infrastructure/parser/index.js +32 -0
  91. package/dist/infrastructure/parser/index.js.map +1 -0
  92. package/dist/infrastructure/parser/interfaces/ParserBase.d.ts +124 -0
  93. package/dist/infrastructure/parser/interfaces/ParserBase.d.ts.map +1 -0
  94. package/dist/infrastructure/parser/interfaces/ParserBase.js +200 -0
  95. package/dist/infrastructure/parser/interfaces/ParserBase.js.map +1 -0
  96. package/dist/infrastructure/parser/registry/ParserRegistry.d.ts +68 -0
  97. package/dist/infrastructure/parser/registry/ParserRegistry.d.ts.map +1 -0
  98. package/dist/infrastructure/parser/registry/ParserRegistry.js +116 -0
  99. package/dist/infrastructure/parser/registry/ParserRegistry.js.map +1 -0
  100. package/dist/infrastructure/repositories/CodeGraphRepositoryImpl.d.ts +44 -0
  101. package/dist/infrastructure/repositories/CodeGraphRepositoryImpl.d.ts.map +1 -0
  102. package/dist/infrastructure/repositories/CodeGraphRepositoryImpl.js +129 -0
  103. package/dist/infrastructure/repositories/CodeGraphRepositoryImpl.js.map +1 -0
  104. package/dist/infrastructure/repositories/index.d.ts +3 -0
  105. package/dist/infrastructure/repositories/index.d.ts.map +1 -0
  106. package/dist/infrastructure/repositories/index.js +7 -0
  107. package/dist/infrastructure/repositories/index.js.map +1 -0
  108. package/dist/infrastructure/storage/StorageFactory.d.ts +53 -0
  109. package/dist/infrastructure/storage/StorageFactory.d.ts.map +1 -0
  110. package/dist/infrastructure/storage/StorageFactory.js +150 -0
  111. package/dist/infrastructure/storage/StorageFactory.js.map +1 -0
  112. package/dist/infrastructure/storage/adapters/FileSystemStorage.d.ts +52 -0
  113. package/dist/infrastructure/storage/adapters/FileSystemStorage.d.ts.map +1 -0
  114. package/dist/infrastructure/storage/adapters/FileSystemStorage.js +315 -0
  115. package/dist/infrastructure/storage/adapters/FileSystemStorage.js.map +1 -0
  116. package/dist/infrastructure/storage/adapters/KuzuDBStorage.d.ts +52 -0
  117. package/dist/infrastructure/storage/adapters/KuzuDBStorage.d.ts.map +1 -0
  118. package/dist/infrastructure/storage/adapters/KuzuDBStorage.js +235 -0
  119. package/dist/infrastructure/storage/adapters/KuzuDBStorage.js.map +1 -0
  120. package/dist/infrastructure/storage/adapters/MemoryStorage.d.ts +37 -0
  121. package/dist/infrastructure/storage/adapters/MemoryStorage.d.ts.map +1 -0
  122. package/dist/infrastructure/storage/adapters/MemoryStorage.js +229 -0
  123. package/dist/infrastructure/storage/adapters/MemoryStorage.js.map +1 -0
  124. package/dist/infrastructure/storage/adapters/Neo4jStorage.d.ts +49 -0
  125. package/dist/infrastructure/storage/adapters/Neo4jStorage.d.ts.map +1 -0
  126. package/dist/infrastructure/storage/adapters/Neo4jStorage.js +222 -0
  127. package/dist/infrastructure/storage/adapters/Neo4jStorage.js.map +1 -0
  128. package/dist/infrastructure/storage/index.d.ts +6 -0
  129. package/dist/infrastructure/storage/index.d.ts.map +1 -0
  130. package/dist/infrastructure/storage/index.js +13 -0
  131. package/dist/infrastructure/storage/index.js.map +1 -0
  132. package/dist/infrastructure/storage/interfaces/StorageBase.d.ts +76 -0
  133. package/dist/infrastructure/storage/interfaces/StorageBase.d.ts.map +1 -0
  134. package/dist/infrastructure/storage/interfaces/StorageBase.js +116 -0
  135. package/dist/infrastructure/storage/interfaces/StorageBase.js.map +1 -0
  136. package/dist/interface/config/index.d.ts +102 -0
  137. package/dist/interface/config/index.d.ts.map +1 -0
  138. package/dist/interface/config/index.js +7 -0
  139. package/dist/interface/config/index.js.map +1 -0
  140. package/dist/interface/types/index.d.ts +425 -0
  141. package/dist/interface/types/index.d.ts.map +1 -0
  142. package/dist/interface/types/index.js +8 -0
  143. package/dist/interface/types/index.js.map +1 -0
  144. package/dist/interface/types/parser.d.ts +103 -0
  145. package/dist/interface/types/parser.d.ts.map +1 -0
  146. package/dist/interface/types/parser.js +7 -0
  147. package/dist/interface/types/parser.js.map +1 -0
  148. package/dist/interface/types/storage.d.ts +98 -0
  149. package/dist/interface/types/storage.d.ts.map +1 -0
  150. package/dist/interface/types/storage.js +7 -0
  151. package/dist/interface/types/storage.js.map +1 -0
  152. package/dist/orchestrator/test-linker.js +1 -1
  153. package/dist/orchestrator/test-linker.js.map +1 -1
  154. package/dist/server/CodeMapServer.d.ts +51 -0
  155. package/dist/server/CodeMapServer.d.ts.map +1 -0
  156. package/dist/server/CodeMapServer.js +146 -0
  157. package/dist/server/CodeMapServer.js.map +1 -0
  158. package/dist/server/handlers/AnalysisHandler.d.ts +82 -0
  159. package/dist/server/handlers/AnalysisHandler.d.ts.map +1 -0
  160. package/dist/server/handlers/AnalysisHandler.js +196 -0
  161. package/dist/server/handlers/AnalysisHandler.js.map +1 -0
  162. package/dist/server/handlers/QueryHandler.d.ts +57 -0
  163. package/dist/server/handlers/QueryHandler.d.ts.map +1 -0
  164. package/dist/server/handlers/QueryHandler.js +260 -0
  165. package/dist/server/handlers/QueryHandler.js.map +1 -0
  166. package/dist/server/index.d.ts +7 -0
  167. package/dist/server/index.d.ts.map +1 -0
  168. package/dist/server/index.js +13 -0
  169. package/dist/server/index.js.map +1 -0
  170. package/dist/server/routes/api.d.ts +8 -0
  171. package/dist/server/routes/api.d.ts.map +1 -0
  172. package/dist/server/routes/api.js +372 -0
  173. package/dist/server/routes/api.js.map +1 -0
  174. package/dist/server/types/index.d.ts +171 -0
  175. package/dist/server/types/index.d.ts.map +1 -0
  176. package/dist/server/types/index.js +7 -0
  177. package/dist/server/types/index.js.map +1 -0
  178. package/dist/types/index.d.ts +6 -372
  179. package/dist/types/index.d.ts.map +1 -1
  180. package/dist/types/index.js +9 -3
  181. package/dist/types/index.js.map +1 -1
  182. package/docs/AI_ASSISTANT_SETUP.md +68 -0
  183. package/docs/PUBLISHING.md +162 -0
  184. package/docs/README.md +37 -0
  185. package/docs/SETUP_GUIDE.md +91 -5
  186. package/docs/ai-guide/COMMANDS.md +369 -0
  187. package/docs/ai-guide/INTEGRATION.md +513 -0
  188. package/docs/ai-guide/OUTPUT.md +465 -0
  189. package/docs/ai-guide/PATTERNS.md +409 -0
  190. package/docs/ai-guide/PROMPTS.md +414 -0
  191. package/docs/ai-guide/QUICKSTART.md +114 -0
  192. package/docs/ai-guide/README.md +66 -0
  193. package/docs/archive/AI_INTEGRATION_GUIDE_ARCHIVED.md +7 -1
  194. package/docs/archive/ARCHIVE.md +39 -0
  195. package/docs/archive/MYCLAUDE_GUIDE.md +305 -0
  196. package/docs/archive/PUBLISH_NPM_DESIGN_V1.md +6 -0
  197. package/docs/archive/PUBLISH_NPM_DESIGN_V2.md +6 -0
  198. package/docs/archive/README.md +29 -0
  199. package/docs/archive/TASK_DESIGN_COVERAGE_REPORT.md +6 -0
  200. package/docs/archive/TEST_SUMMARY.md +140 -0
  201. package/docs/archive/comprehensive_test_report.md +337 -0
  202. package/docs/{CI_GATEWAY_DESIGN.md → archive/design-docs/CI_GATEWAY_DESIGN.md} +6 -0
  203. package/docs/{PUBLISH_NPM_DESIGN_FINAL.md → archive/design-docs/PUBLISH_NPM_DESIGN_FINAL.md} +7 -1
  204. package/docs/{REFACTOR_ARCHITECTURE_OVERVIEW.md → archive/design-docs/REFACTOR_ARCHITECTURE_OVERVIEW.md} +8 -2
  205. package/docs/{REFACTOR_CONFIDENCE_DESIGN.md → archive/design-docs/REFACTOR_CONFIDENCE_DESIGN.md} +6 -0
  206. package/docs/{REFACTOR_GIT_ANALYZER_DESIGN.md → archive/design-docs/REFACTOR_GIT_ANALYZER_DESIGN.md} +8 -2
  207. package/docs/{REFACTOR_ORCHESTRATOR_DESIGN.md → archive/design-docs/REFACTOR_ORCHESTRATOR_DESIGN.md} +6 -0
  208. package/docs/{REFACTOR_RESULT_FUSION_DESIGN.md → archive/design-docs/REFACTOR_RESULT_FUSION_DESIGN.md} +6 -0
  209. package/docs/{REFACTOR_TEST_LINKER_DESIGN.md → archive/design-docs/REFACTOR_TEST_LINKER_DESIGN.md} +6 -0
  210. package/docs/archive/myclaude.md +1084 -0
  211. package/docs/archive/plans/2026-03-14-go-language-support-design.md +92 -0
  212. package/docs/{REFACTOR_REQUIREMENTS.md → archive/product-specs/REFACTOR_REQUIREMENTS.md} +11 -5
  213. package/docs/archive/scenario-2-deps-analysis.md +353 -0
  214. package/docs/archive/test-report-symbol-search.md +384 -0
  215. package/docs/archive/test-scenario-4-complexity-analysis.md +460 -0
  216. package/docs/archive/test_report_scenario5.md +615 -0
  217. package/docs/archive/test_scenario_3_impact_analysis_report.md +520 -0
  218. package/docs/design-docs/README.md +26 -0
  219. package/docs/exec-plans/MVP3-IMPLEMENTATION-ROADMAP.md +524 -0
  220. package/docs/exec-plans/README.md +29 -0
  221. package/docs/exec-plans/active/.gitkeep +0 -0
  222. package/docs/exec-plans/completed/.gitkeep +0 -0
  223. package/docs/{plans/POST_TASK_PLAN.md → exec-plans/completed/2026-03-03-post-task-plan.md} +9 -3
  224. package/docs/exec-plans/completed/harness-engineering-rollout.md +184 -0
  225. package/docs/exec-plans/tech-debt/.gitkeep +0 -0
  226. package/docs/exec-plans/tech-debt/2026-03-15-lint-guardrail-gap.md +30 -0
  227. package/docs/generated/README.md +19 -0
  228. package/docs/product-specs/MVP3-ARCHITECTURE-COMPARISON.md +504 -0
  229. package/docs/product-specs/MVP3-ARCHITECTURE-REDESIGN-PRD.md +322 -0
  230. package/docs/product-specs/MVP3-ARCHITECTURE-REDESIGN-TECH-PRD.md +1374 -0
  231. package/docs/product-specs/README.md +22 -0
  232. package/docs/references/README.md +15 -0
  233. package/docs/references/tmp.md +527 -0
  234. package/docs/rules/README.md +16 -0
  235. package/docs/rules/architecture-guardrails.md +349 -0
  236. package/docs/rules/code-quality-redlines.md +321 -0
  237. package/docs/rules/deployment.md +23 -0
  238. package/docs/rules/engineering-with-codex-openai.md +202 -0
  239. package/docs/rules/testing.md +73 -0
  240. package/docs/rules/validation.md +39 -0
  241. package/package.json +19 -6
  242. package/docs/OMC_TEAM_DEBUG_REPORT.md +0 -285
  243. /package/docs/{plans/archive → exec-plans/completed}/2026-03-03-deps-path-extension-fix.md +0 -0
package/docs/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # docs/ - 文档信息架构
2
+
3
+ 本目录采用“入口文档短、细节文档分层”的结构。
4
+
5
+ ## 目录职责
6
+
7
+ - `docs/rules/`:开发、测试、验证、发布规则。
8
+ - `docs/design-docs/`:当前仍有效的设计文档。
9
+ - `docs/exec-plans/`:活跃计划、已完成计划、技术债跟踪。
10
+ - `docs/generated/`:生成内容与归档说明。
11
+ - `docs/product-specs/`:当前仍有效的产品规格与验收边界。
12
+ - `docs/references/`:外部参考、设计系统、工具链资料。
13
+ - `docs/archive/`:历史方案、迁移遗留、过期文档索引。
14
+
15
+ ## 当前状态
16
+
17
+ - `docs/` 根层当前只保留仍在使用的操作指南:`AI_ASSISTANT_SETUP.md`、`SETUP_GUIDE.md`。
18
+ - 2026-03-15 已把历史重构设计、历史需求草稿、Go 支持计划和过期计划统一移入 `docs/archive/`。
19
+ - `docs/design-docs/` 与 `docs/product-specs/` 当前不再保留旧稿;历史内容请从 `docs/archive/README.md` 进入。
20
+ - 新增内容优先写入分层目录,不再把新设计或新计划继续堆到根层。
21
+
22
+ ## 建议阅读顺序
23
+
24
+ 1. `../AGENTS.md`
25
+ 2. `../CLAUDE.md`
26
+ 3. `../ARCHITECTURE.md`
27
+ 4. 与任务最相关的 `docs/rules/*`
28
+ 5. 与任务最相关的现行文档;如需历史背景,再看 `docs/archive/README.md`
29
+ 6. 如需过程信息,再看 `docs/exec-plans/*`
30
+
31
+ ## 维护规则
32
+
33
+ - 入口文档只做导航,不复述大段细节。
34
+ - 规则进 `docs/rules/`,设计理由进 `docs/design-docs/`,计划进 `docs/exec-plans/`。
35
+ - 需求与验收进 `docs/product-specs/`,生成物说明进 `docs/generated/`,外部资料进 `docs/references/`。
36
+ - 历史文档进入 `docs/archive/`,并补全归档时间、归档原因、当前依据。
37
+ - 若文档更新影响执行协议或入口路径,要同步检查 `AGENTS.md`、`CLAUDE.md`、`ARCHITECTURE.md`、`README.md`。
@@ -178,6 +178,71 @@ mycodemap impact -f src/cli/index.ts
178
178
  mycodemap impact -f src/cli/index.ts --transitive
179
179
  ```
180
180
 
181
+ ### 统一分析(analyze)
182
+
183
+ ```bash
184
+ # 影响分析
185
+ mycodemap analyze -i impact -t src/cli/index.ts
186
+ mycodemap analyze -i impact -t src/cli/index.ts --scope transitive --include-tests
187
+
188
+ # 依赖分析
189
+ mycodemap analyze -i dependency -t src/orchestrator
190
+
191
+ # 复杂度分析
192
+ mycodemap analyze -i complexity -t src/domain
193
+
194
+ # 搜索分析
195
+ mycodemap analyze -i search -k "UnifiedResult" --topK 10
196
+
197
+ # 项目概览
198
+ mycodemap analyze -i overview -t src/
199
+
200
+ # JSON 输出
201
+ mycodemap analyze -i impact -t src/index.ts --json
202
+ ```
203
+
204
+ ### 工作流编排(workflow)
205
+
206
+ ```bash
207
+ # 启动工作流
208
+ mycodemap workflow start "实现用户认证模块"
209
+ mycodemap workflow start "修复登录接口 500" --template bugfix
210
+
211
+ # 查看当前状态
212
+ mycodemap workflow status
213
+
214
+ # 可视化工作流
215
+ mycodemap workflow visualize
216
+
217
+ # 推进到下一阶段
218
+ mycodemap workflow proceed
219
+
220
+ # 列出所有工作流
221
+ mycodemap workflow list
222
+ ```
223
+
224
+ ### CI 门禁(ci)
225
+
226
+ ```bash
227
+ # 检查提交格式
228
+ mycodemap ci check-commits
229
+ mycodemap ci check-commits -c 5
230
+
231
+ # 检查文件头注释
232
+ mycodemap ci check-headers
233
+ mycodemap ci check-headers -d src/domain
234
+
235
+ # 评估变更风险
236
+ mycodemap ci assess-risk
237
+ mycodemap ci assess-risk -t 0.5
238
+
239
+ # 验证输出契约
240
+ mycodemap ci check-output-contract
241
+
242
+ # 检查提交文件数量
243
+ mycodemap ci check-commit-size
244
+ ```
245
+
181
246
  ### 监听模式
182
247
 
183
248
  ```bash
@@ -270,6 +335,9 @@ fi
270
335
  # 可选:运行测试
271
336
  # npm test
272
337
 
338
+ # 可选:当改动 README / docs / CLI 示例时检查文档护栏
339
+ # npm run docs:check
340
+
273
341
  # 可选:检查文件头
274
342
  # mycodemap ci check-headers
275
343
 
@@ -304,26 +372,44 @@ jobs:
304
372
 
305
373
  - name: Install dependencies
306
374
  run: npm ci
375
+
376
+ - name: Validate docs sync
377
+ run: npm run docs:check
378
+
379
+ - name: Run typecheck
380
+ run: npm run typecheck
307
381
 
308
382
  - name: Run tests
309
383
  run: npm test
310
384
 
311
385
  - name: Check commits
312
386
  run: npx mycodemap ci check-commits --range origin/main..HEAD
387
+
388
+ - name: Check docs sync via CLI
389
+ run: npx mycodemap ci check-docs-sync
390
+
391
+ - name: Check commit size
392
+ run: npx mycodemap ci check-commit-size --range origin/main..HEAD
313
393
 
314
394
  - name: Check headers
315
395
  run: npx mycodemap ci check-headers
396
+
397
+ - name: Assess risk
398
+ run: npx mycodemap ci assess-risk --threshold=0.7
316
399
 
317
- - name: Generate codemap
400
+ - name: Generate AI feed
318
401
  run: npx mycodemap generate
319
402
 
320
- - name: Check codemap sync
321
- run: git diff --exit-code .mycodemap/
403
+ - name: Check AI feed sync
404
+ run: git diff --exit-code .mycodemap/ai-feed.txt
405
+
406
+ - name: Check output contract
407
+ run: npx mycodemap ci check-output-contract --schema-version v1.0.0 --top-k 8 --max-tokens 160
322
408
  ```
323
409
 
324
410
  ### 其他 CI 平台
325
411
 
326
- 参考 [CI_GATEWAY_DESIGN.md](./CI_GATEWAY_DESIGN.md) 了解所有检查项。
412
+ 参考 [CI_GATEWAY_DESIGN.md](./design-docs/CI_GATEWAY_DESIGN.md) 了解所有检查项。
327
413
 
328
414
  ---
329
415
 
@@ -404,4 +490,4 @@ CLI 运行日志默认写入 `.mycodemap/logs/mycodemap-YYYY-MM-DD.log`
404
490
 
405
491
  - 了解 [AI 助手配置](./AI_ASSISTANT_SETUP.md)
406
492
  - 查看 [CLI 完整命令参考](../README.md#cli-命令)
407
- - 阅读 [架构设计文档](./REFACTOR_ARCHITECTURE_OVERVIEW.md)
493
+ - 阅读 [架构设计文档](./design-docs/REFACTOR_ARCHITECTURE_OVERVIEW.md)
@@ -0,0 +1,369 @@
1
+ # AI Guide - 命令参考
2
+
3
+ > 完整的 CLI 命令详解
4
+
5
+ ---
6
+
7
+ ## 核心命令
8
+
9
+ ### generate - 生成代码地图
10
+
11
+ ```bash
12
+ mycodemap generate # hybrid 模式(推荐)
13
+ mycodemap generate -m smart # AST 深度分析
14
+ mycodemap generate -m fast # 快速正则分析
15
+ mycodemap generate -o ./output # 指定输出目录
16
+ mycodemap generate --ai-context # 生成 AI 描述
17
+ ```
18
+
19
+ | 选项 | 说明 | 默认值 |
20
+ |------|------|--------|
21
+ | `-m, --mode <mode>` | 分析模式: fast/smart/hybrid | `hybrid` |
22
+ | `-o, --output <dir>` | 输出目录 | `.mycodemap` |
23
+ | `--ai-context` | 为每个文件生成描述 | - |
24
+
25
+ **模式说明**:
26
+ - `fast`: 正则匹配,极快,适合大型项目
27
+ - `smart`: AST 分析,较慢,信息完整
28
+ - `hybrid`: 自动选择,文件<50用fast,≥50用smart
29
+
30
+ ---
31
+
32
+ ### query - 查询代码
33
+
34
+ ```bash
35
+ mycodemap query -s "SymbolName" # 精确查询符号
36
+ mycodemap query -m "src/parser" # 查询模块
37
+ mycodemap query -d "analyzer" # 查询依赖
38
+ mycodemap query -S "cache" -l 10 # 模糊搜索
39
+ mycodemap query -s "Symbol" -j # JSON 输出
40
+ mycodemap query -s "Symbol" --include-references # 包含引用
41
+ mycodemap query -S "pattern" -r # 正则搜索
42
+ mycodemap query -c 5 # 显示上下文5行
43
+ ```
44
+
45
+ | 选项 | 说明 | 默认值 |
46
+ |------|------|--------|
47
+ | `-s, --symbol <name>` | 精确查询符号 | - |
48
+ | `-m, --module <path>` | 查询模块 | - |
49
+ | `-d, --deps <name>` | 查询依赖 | - |
50
+ | `-S, --search <word>` | 模糊搜索 | - |
51
+ | `-l, --limit <number>` | 限制结果数量 | `50` |
52
+ | `-j, --json` | JSON 格式输出 | - |
53
+ | `--structured` | 纯结构化输出 | - |
54
+ | `-r, --regex` | 使用正则表达式 | - |
55
+ | `-c, --context <lines>` | 显示代码上下文 | `0` |
56
+ | `--include-references` | 包含引用位置 | - |
57
+
58
+ ---
59
+
60
+ ### deps - 依赖分析
61
+
62
+ ```bash
63
+ mycodemap deps # 全部依赖
64
+ mycodemap deps -m "src/domain" # 指定模块
65
+ mycodemap deps -m "src/domain" -j # JSON 输出
66
+ mycodemap deps -m "src/domain" --structured # 纯结构化
67
+ ```
68
+
69
+ | 选项 | 说明 | 默认值 |
70
+ |------|------|--------|
71
+ | `-m, --module <path>` | 查询指定模块 | - |
72
+ | `-j, --json` | JSON 格式输出 | - |
73
+ | `--structured` | 纯结构化输出 | - |
74
+
75
+ ---
76
+
77
+ ### impact - 影响分析
78
+
79
+ ```bash
80
+ mycodemap impact -f "src/cli/index.ts" # 文件变更影响
81
+ mycodemap impact -f "src/cli/index.ts" -t # 包含传递依赖
82
+ mycodemap impact -f "src/cli/index.ts" -j # JSON 输出
83
+ ```
84
+
85
+ | 选项 | 说明 | 默认值 |
86
+ |------|------|--------|
87
+ | `-f, --file <path>` | **必填** 指定文件 | - |
88
+ | `-t, --transitive` | 包含传递依赖 | - |
89
+ | `-j, --json` | JSON 格式输出 | - |
90
+ | `--structured` | 纯结构化输出 | - |
91
+
92
+ ---
93
+
94
+ ### complexity - 复杂度分析
95
+
96
+ ```bash
97
+ mycodemap complexity # 项目整体
98
+ mycodemap complexity -f "src/cli/index.ts" # 指定文件
99
+ mycodemap complexity -d # 函数级详情
100
+ mycodemap complexity -j # JSON 输出
101
+ ```
102
+
103
+ | 选项 | 说明 | 默认值 |
104
+ |------|------|--------|
105
+ | `-f, --file <path>` | 指定文件 | - |
106
+ | `-d, --detail` | 函数级详情 | - |
107
+ | `-j, --json` | JSON 格式输出 | - |
108
+ | `--structured` | 纯结构化输出 | - |
109
+
110
+ ---
111
+
112
+ ### cycles - 循环依赖检测
113
+
114
+ ```bash
115
+ mycodemap cycles # 检测所有循环依赖
116
+ mycodemap cycles -d 5 # 指定检测深度
117
+ mycodemap cycles -j # JSON 输出
118
+ ```
119
+
120
+ | 选项 | 说明 | 默认值 |
121
+ |------|------|--------|
122
+ | `-d, --depth <number>` | 检测深度 | `5` |
123
+ | `-j, --json` | JSON 格式输出 | - |
124
+ | `--structured` | 纯结构化输出 | - |
125
+
126
+ ---
127
+
128
+ ## analyze - 统一分析入口
129
+
130
+ ### 8 种分析意图
131
+
132
+ ```bash
133
+ # 1. 影响分析
134
+ mycodemap analyze -i impact -t "src/index.ts"
135
+ mycodemap analyze -i impact -t "src/index.ts" --scope transitive
136
+ mycodemap analyze -i impact -t "src/index.ts" --include-tests
137
+
138
+ # 2. 依赖分析
139
+ mycodemap analyze -i dependency -t "src/orchestrator"
140
+
141
+ # 3. 复杂度分析
142
+ mycodemap analyze -i complexity -t "src/domain"
143
+
144
+ # 4. 搜索分析
145
+ mycodemap analyze -i search -k "UnifiedResult"
146
+ mycodemap analyze -i search -k "keyword" --topK 20
147
+
148
+ # 5. 项目概览
149
+ mycodemap analyze -i overview -t "src/"
150
+
151
+ # 6. 重构建议
152
+ mycodemap analyze -i refactor -t "src/cache"
153
+
154
+ # 7. 引用查找
155
+ mycodemap analyze -i reference -t "src/interface/types"
156
+
157
+ # 8. 文档生成
158
+ mycodemap analyze -i documentation -t "src/domain/services"
159
+ ```
160
+
161
+ ### 输出选项
162
+
163
+ ```bash
164
+ # JSON 输出
165
+ mycodemap analyze -i impact -t "src/index.ts" --json
166
+
167
+ # 纯结构化(移除自然语言字段)
168
+ mycodemap analyze -i impact -t "src/index.ts" --structured --json
169
+
170
+ # 机器可读模式
171
+ mycodemap analyze -i impact -t "src/index.ts" --output-mode machine
172
+
173
+ # 人类可读模式(默认)
174
+ mycodemap analyze -i impact -t "src/index.ts" --output-mode human
175
+ ```
176
+
177
+ ### 通用选项
178
+
179
+ | 选项 | 说明 | 默认值 |
180
+ |------|------|--------|
181
+ | `-i, --intent <type>` | 分析类型 | `impact` |
182
+ | `-t, --targets <paths...>` | 目标路径(必填) | - |
183
+ | `-k, --keywords <words...>` | 搜索关键词 | - |
184
+ | `-s, --scope <scope>` | 范围: direct/transitive | `direct` |
185
+ | `-n, --topK <number>` | 返回结果数量 | `8` |
186
+ | `--include-tests` | 包含测试文件关联 | - |
187
+ | `--include-git-history` | 包含 Git 历史 | - |
188
+ | `--json` | JSON 格式输出 | - |
189
+ | `--structured` | 纯结构化输出 | - |
190
+ | `--output-mode <mode>` | 输出模式: machine/human | `human` |
191
+
192
+ ---
193
+
194
+ ## ci - CI 门禁
195
+
196
+ ### 子命令
197
+
198
+ ```bash
199
+ # 验证提交格式([TAG] scope: message)
200
+ mycodemap ci check-commits
201
+ mycodemap ci check-commits -c 5 # 最近 5 个提交
202
+ mycodemap ci check-commits -r "origin/main..HEAD"
203
+
204
+ # 验证文件头注释([META] [WHY])
205
+ mycodemap ci check-headers
206
+ mycodemap ci check-headers -d "src/domain" # 指定目录
207
+ mycodemap ci check-headers -f "file1.ts,file2.ts"
208
+
209
+ # 评估变更风险
210
+ mycodemap ci assess-risk
211
+ mycodemap ci assess-risk -t 0.5 # 设置阈值 0.5
212
+ mycodemap ci assess-risk -f "changed.ts"
213
+
214
+ # 验证文档同步
215
+ mycodemap ci check-docs-sync
216
+ mycodemap ci check-docs-sync --root "/path"
217
+
218
+ # 验证输出契约
219
+ mycodemap ci check-output-contract
220
+ mycodemap ci check-output-contract -s v1.0.0 -k 8 -t 160
221
+
222
+ # 检查提交文件数量
223
+ mycodemap ci check-commit-size
224
+ mycodemap ci check-commit-size -m 15
225
+ ```
226
+
227
+ ### 支持的提交 TAG
228
+
229
+ `[REFACTOR]`, `[TEST]`, `[DOCS]`, `[FEAT]`, `[FIX]`, `[CHORE]`, `[PERF]`, `[SECURITY]`, `[BREAKING]`, `[HOTFIX]`, `[MIGRATION]`, `[WIP]`
230
+
231
+ ---
232
+
233
+ ## workflow - 工作流编排
234
+
235
+ ### 生命周期管理
236
+
237
+ ```bash
238
+ # 启动工作流
239
+ mycodemap workflow start "实现用户认证模块"
240
+ mycodemap workflow start "修复登录接口" --template bugfix
241
+
242
+ # 查看状态
243
+ mycodemap workflow status
244
+
245
+ # 可视化
246
+ mycodemap workflow visualize
247
+ mycodemap workflow visualize --timeline
248
+ mycodemap workflow visualize --results
249
+
250
+ # 推进阶段
251
+ mycodemap workflow proceed
252
+ mycodemap workflow proceed --force
253
+
254
+ # 检查点
255
+ mycodemap workflow checkpoint
256
+
257
+ # 列出/删除
258
+ mycodemap workflow list
259
+ mycodemap workflow delete "workflow-id"
260
+
261
+ # 恢复
262
+ mycodemap workflow resume
263
+ mycodemap workflow resume "workflow-id"
264
+ ```
265
+
266
+ ### 模板管理
267
+
268
+ ```bash
269
+ mycodemap workflow template list # 列出模板
270
+ mycodemap workflow template list --all # 包含内置模板
271
+ mycodemap workflow template info bugfix # 模板详情
272
+ mycodemap workflow template apply bugfix # 应用模板
273
+ mycodemap workflow template recommend "任务" # 推荐模板
274
+ ```
275
+
276
+ ### 内置模板
277
+
278
+ - `refactoring` - 重构任务
279
+ - `bugfix` - 缺陷修复
280
+ - `feature` - 新功能开发
281
+ - `hotfix` - 紧急修复
282
+
283
+ ---
284
+
285
+ ## server - HTTP 服务器
286
+
287
+ ```bash
288
+ mycodemap server # 默认端口 3000
289
+ mycodemap server -p 8080 # 指定端口
290
+ mycodemap server -h 127.0.0.1 # 指定主机
291
+ mycodemap server --cors # 启用 CORS
292
+ mycodemap server --open # 自动打开浏览器
293
+ ```
294
+
295
+ | 选项 | 说明 | 默认值 |
296
+ |------|------|--------|
297
+ | `-p, --port <number>` | 服务器端口 | `3000` |
298
+ | `-h, --host <string>` | 服务器主机 | `0.0.0.0` |
299
+ | `--cors` | 启用 CORS | `false` |
300
+ | `--open` | 自动打开浏览器 | `false` |
301
+
302
+ ### API 端点
303
+
304
+ | 方法 | 端点 | 说明 |
305
+ |------|------|------|
306
+ | GET | `/api/v1/health` | 健康检查 |
307
+ | GET | `/api/v1/stats` | 项目统计 |
308
+ | GET | `/api/v1/search/symbols?q=` | 符号搜索 |
309
+ | GET | `/api/v1/modules/:id` | 模块详情 |
310
+ | GET | `/api/v1/symbols/:id` | 符号详情 |
311
+ | POST | `/api/v1/analysis/impact` | 影响分析 |
312
+ | GET | `/api/v1/analysis/cycles` | 循环依赖检测 |
313
+ | GET | `/api/v1/graph` | 依赖图数据 |
314
+ | GET | `/api/v1/export/:format` | 数据导出 |
315
+
316
+ ---
317
+
318
+ ## 其他命令
319
+
320
+ ### watch - 监听模式
321
+
322
+ ```bash
323
+ mycodemap watch # 前台监听
324
+ mycodemap watch -d # 后台守护进程
325
+ mycodemap watch -s # 停止守护进程
326
+ mycodemap watch -t # 查看状态
327
+ mycodemap watch -m smart # 指定模式
328
+ ```
329
+
330
+ ### report - 生成报告
331
+
332
+ ```bash
333
+ mycodemap report # 最近 7 天
334
+ mycodemap report -d 14 # 最近 14 天
335
+ mycodemap report -o ./reports # 输出目录
336
+ mycodemap report -j # JSON 输出
337
+ ```
338
+
339
+ ### logs - 日志管理
340
+
341
+ ```bash
342
+ mycodemap logs list # 列出日志
343
+ mycodemap logs list -l 20 # 限制 20 条
344
+ mycodemap logs list --level ERROR # 仅错误
345
+ mycodemap logs export -d 30 # 导出 30 天
346
+ mycodemap logs clear -d 30 --confirm # 清理 30 天前
347
+ ```
348
+
349
+ ### export - 导出代码图
350
+
351
+ ```bash
352
+ mycodemap export json # JSON 格式
353
+ mycodemap export graphml # GraphML (Gephi)
354
+ mycodemap export dot # DOT (Graphviz)
355
+ mycodemap export mermaid # Mermaid 语法
356
+ mycodemap export json -o ./output.json # 指定输出
357
+ ```
358
+
359
+ ---
360
+
361
+ ## 全局选项
362
+
363
+ 所有命令支持:
364
+
365
+ | 选项 | 说明 |
366
+ |------|------|
367
+ | `-V, --version` | 显示版本号 |
368
+ | `-h, --help` | 显示帮助信息 |
369
+ | `--no-cache` | 禁用缓存(部分命令) |