@mycodemap/mycodemap 0.5.2-beta.1 → 2.0.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 (272) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +138 -854
  3. package/README.zh-CN.md +1096 -0
  4. package/dist/cli/commands/analyze-options.d.ts.map +1 -1
  5. package/dist/cli/commands/analyze-options.js +8 -0
  6. package/dist/cli/commands/analyze-options.js.map +1 -1
  7. package/dist/cli/commands/analyze.d.ts.map +1 -1
  8. package/dist/cli/commands/analyze.js +60 -41
  9. package/dist/cli/commands/analyze.js.map +1 -1
  10. package/dist/cli/commands/benchmark.d.ts +8 -0
  11. package/dist/cli/commands/benchmark.d.ts.map +1 -0
  12. package/dist/cli/commands/benchmark.js +150 -0
  13. package/dist/cli/commands/benchmark.js.map +1 -0
  14. package/dist/cli/commands/deps.d.ts +2 -1
  15. package/dist/cli/commands/deps.d.ts.map +1 -1
  16. package/dist/cli/commands/deps.js +107 -78
  17. package/dist/cli/commands/deps.js.map +1 -1
  18. package/dist/cli/commands/doctor.d.ts +3 -0
  19. package/dist/cli/commands/doctor.d.ts.map +1 -0
  20. package/dist/cli/commands/doctor.js +34 -0
  21. package/dist/cli/commands/doctor.js.map +1 -0
  22. package/dist/cli/commands/init.d.ts +7 -2
  23. package/dist/cli/commands/init.d.ts.map +1 -1
  24. package/dist/cli/commands/init.js +22 -34
  25. package/dist/cli/commands/init.js.map +1 -1
  26. package/dist/cli/commands/publish-status.d.ts +31 -0
  27. package/dist/cli/commands/publish-status.d.ts.map +1 -0
  28. package/dist/cli/commands/publish-status.js +101 -0
  29. package/dist/cli/commands/publish-status.js.map +1 -0
  30. package/dist/cli/commands/query.d.ts +1 -0
  31. package/dist/cli/commands/query.d.ts.map +1 -1
  32. package/dist/cli/commands/query.js +123 -140
  33. package/dist/cli/commands/query.js.map +1 -1
  34. package/dist/cli/commands/readiness-gate.d.ts +25 -0
  35. package/dist/cli/commands/readiness-gate.d.ts.map +1 -0
  36. package/dist/cli/commands/readiness-gate.js +197 -0
  37. package/dist/cli/commands/readiness-gate.js.map +1 -0
  38. package/dist/cli/commands/ship/checker.d.ts +4 -9
  39. package/dist/cli/commands/ship/checker.d.ts.map +1 -1
  40. package/dist/cli/commands/ship/checker.js +60 -22
  41. package/dist/cli/commands/ship/checker.js.map +1 -1
  42. package/dist/cli/commands/ship/monitor.d.ts +6 -1
  43. package/dist/cli/commands/ship/monitor.d.ts.map +1 -1
  44. package/dist/cli/commands/ship/monitor.js +223 -46
  45. package/dist/cli/commands/ship/monitor.js.map +1 -1
  46. package/dist/cli/commands/ship/pipeline.d.ts.map +1 -1
  47. package/dist/cli/commands/ship/pipeline.js +14 -5
  48. package/dist/cli/commands/ship/pipeline.js.map +1 -1
  49. package/dist/cli/commands/ship/rules/quality-rules.d.ts +12 -8
  50. package/dist/cli/commands/ship/rules/quality-rules.d.ts.map +1 -1
  51. package/dist/cli/commands/ship/rules/quality-rules.js +49 -34
  52. package/dist/cli/commands/ship/rules/quality-rules.js.map +1 -1
  53. package/dist/cli/config-loader.js +1 -1
  54. package/dist/cli/config-loader.js.map +1 -1
  55. package/dist/cli/doctor/check-agent.d.ts +3 -0
  56. package/dist/cli/doctor/check-agent.d.ts.map +1 -0
  57. package/dist/cli/doctor/check-agent.js +60 -0
  58. package/dist/cli/doctor/check-agent.js.map +1 -0
  59. package/dist/cli/doctor/check-ghost-commands.d.ts +3 -0
  60. package/dist/cli/doctor/check-ghost-commands.d.ts.map +1 -0
  61. package/dist/cli/doctor/check-ghost-commands.js +86 -0
  62. package/dist/cli/doctor/check-ghost-commands.js.map +1 -0
  63. package/dist/cli/doctor/check-native-deps.d.ts +3 -0
  64. package/dist/cli/doctor/check-native-deps.d.ts.map +1 -0
  65. package/dist/cli/doctor/check-native-deps.js +54 -0
  66. package/dist/cli/doctor/check-native-deps.js.map +1 -0
  67. package/dist/cli/doctor/check-workspace-drift.d.ts +3 -0
  68. package/dist/cli/doctor/check-workspace-drift.d.ts.map +1 -0
  69. package/dist/cli/doctor/check-workspace-drift.js +83 -0
  70. package/dist/cli/doctor/check-workspace-drift.js.map +1 -0
  71. package/dist/cli/doctor/formatter.d.ts +20 -0
  72. package/dist/cli/doctor/formatter.d.ts.map +1 -0
  73. package/dist/cli/doctor/formatter.js +91 -0
  74. package/dist/cli/doctor/formatter.js.map +1 -0
  75. package/dist/cli/doctor/index.d.ts +8 -0
  76. package/dist/cli/doctor/index.d.ts.map +1 -0
  77. package/dist/cli/doctor/index.js +9 -0
  78. package/dist/cli/doctor/index.js.map +1 -0
  79. package/dist/cli/doctor/orchestrator.d.ts +3 -0
  80. package/dist/cli/doctor/orchestrator.d.ts.map +1 -0
  81. package/dist/cli/doctor/orchestrator.js +37 -0
  82. package/dist/cli/doctor/orchestrator.js.map +1 -0
  83. package/dist/cli/doctor/types.d.ts +19 -0
  84. package/dist/cli/doctor/types.d.ts.map +1 -0
  85. package/dist/cli/doctor/types.js +4 -0
  86. package/dist/cli/doctor/types.js.map +1 -0
  87. package/dist/cli/first-run-guide.d.ts.map +1 -1
  88. package/dist/cli/first-run-guide.js +10 -12
  89. package/dist/cli/first-run-guide.js.map +1 -1
  90. package/dist/cli/index.js +80 -21
  91. package/dist/cli/index.js.map +1 -1
  92. package/dist/cli/init/hooks.d.ts +17 -0
  93. package/dist/cli/init/hooks.d.ts.map +1 -0
  94. package/dist/cli/init/hooks.js +220 -0
  95. package/dist/cli/init/hooks.js.map +1 -0
  96. package/dist/cli/init/receipt.d.ts +4 -0
  97. package/dist/cli/init/receipt.d.ts.map +1 -0
  98. package/dist/cli/init/receipt.js +117 -0
  99. package/dist/cli/init/receipt.js.map +1 -0
  100. package/dist/cli/init/reconciler.d.ts +44 -0
  101. package/dist/cli/init/reconciler.d.ts.map +1 -0
  102. package/dist/cli/init/reconciler.js +377 -0
  103. package/dist/cli/init/reconciler.js.map +1 -0
  104. package/dist/cli/init/rule-templates.d.ts +9 -0
  105. package/dist/cli/init/rule-templates.d.ts.map +1 -0
  106. package/dist/cli/init/rule-templates.js +105 -0
  107. package/dist/cli/init/rule-templates.js.map +1 -0
  108. package/dist/cli/init/rules.d.ts +13 -0
  109. package/dist/cli/init/rules.d.ts.map +1 -0
  110. package/dist/cli/init/rules.js +113 -0
  111. package/dist/cli/init/rules.js.map +1 -0
  112. package/dist/cli/interface-contract/commands/analyze.d.ts +3 -0
  113. package/dist/cli/interface-contract/commands/analyze.d.ts.map +1 -0
  114. package/dist/cli/interface-contract/commands/analyze.js +138 -0
  115. package/dist/cli/interface-contract/commands/analyze.js.map +1 -0
  116. package/dist/cli/interface-contract/commands/benchmark.d.ts +3 -0
  117. package/dist/cli/interface-contract/commands/benchmark.d.ts.map +1 -0
  118. package/dist/cli/interface-contract/commands/benchmark.js +107 -0
  119. package/dist/cli/interface-contract/commands/benchmark.js.map +1 -0
  120. package/dist/cli/interface-contract/commands/deps.d.ts +3 -0
  121. package/dist/cli/interface-contract/commands/deps.d.ts.map +1 -0
  122. package/dist/cli/interface-contract/commands/deps.js +129 -0
  123. package/dist/cli/interface-contract/commands/deps.js.map +1 -0
  124. package/dist/cli/interface-contract/commands/doctor.d.ts +3 -0
  125. package/dist/cli/interface-contract/commands/doctor.d.ts.map +1 -0
  126. package/dist/cli/interface-contract/commands/doctor.js +59 -0
  127. package/dist/cli/interface-contract/commands/doctor.js.map +1 -0
  128. package/dist/cli/interface-contract/commands/index.d.ts +9 -0
  129. package/dist/cli/interface-contract/commands/index.d.ts.map +1 -0
  130. package/dist/cli/interface-contract/commands/index.js +18 -0
  131. package/dist/cli/interface-contract/commands/index.js.map +1 -0
  132. package/dist/cli/interface-contract/commands/init.d.ts +3 -0
  133. package/dist/cli/interface-contract/commands/init.d.ts.map +1 -0
  134. package/dist/cli/interface-contract/commands/init.js +87 -0
  135. package/dist/cli/interface-contract/commands/init.js.map +1 -0
  136. package/dist/cli/interface-contract/commands/query.d.ts +3 -0
  137. package/dist/cli/interface-contract/commands/query.d.ts.map +1 -0
  138. package/dist/cli/interface-contract/commands/query.js +185 -0
  139. package/dist/cli/interface-contract/commands/query.js.map +1 -0
  140. package/dist/cli/interface-contract/index.d.ts +22 -0
  141. package/dist/cli/interface-contract/index.d.ts.map +1 -0
  142. package/dist/cli/interface-contract/index.js +41 -0
  143. package/dist/cli/interface-contract/index.js.map +1 -0
  144. package/dist/cli/interface-contract/schema.d.ts +30 -0
  145. package/dist/cli/interface-contract/schema.d.ts.map +1 -0
  146. package/dist/cli/interface-contract/schema.js +72 -0
  147. package/dist/cli/interface-contract/schema.js.map +1 -0
  148. package/dist/cli/interface-contract/types.d.ts +76 -0
  149. package/dist/cli/interface-contract/types.d.ts.map +1 -0
  150. package/dist/cli/interface-contract/types.js +4 -0
  151. package/dist/cli/interface-contract/types.js.map +1 -0
  152. package/dist/cli/output/apply-suggestion.d.ts +12 -0
  153. package/dist/cli/output/apply-suggestion.d.ts.map +1 -0
  154. package/dist/cli/output/apply-suggestion.js +29 -0
  155. package/dist/cli/output/apply-suggestion.js.map +1 -0
  156. package/dist/cli/output/error-codes.d.ts +22 -0
  157. package/dist/cli/output/error-codes.d.ts.map +1 -0
  158. package/dist/cli/output/error-codes.js +82 -0
  159. package/dist/cli/output/error-codes.js.map +1 -0
  160. package/dist/cli/output/errors.d.ts +14 -0
  161. package/dist/cli/output/errors.d.ts.map +1 -0
  162. package/dist/cli/output/errors.js +170 -0
  163. package/dist/cli/output/errors.js.map +1 -0
  164. package/dist/cli/output/index.d.ts +13 -0
  165. package/dist/cli/output/index.d.ts.map +1 -0
  166. package/dist/cli/output/index.js +11 -0
  167. package/dist/cli/output/index.js.map +1 -0
  168. package/dist/cli/output/mode.d.ts +12 -0
  169. package/dist/cli/output/mode.d.ts.map +1 -0
  170. package/dist/cli/output/mode.js +23 -0
  171. package/dist/cli/output/mode.js.map +1 -0
  172. package/dist/cli/output/progress.d.ts +9 -0
  173. package/dist/cli/output/progress.d.ts.map +1 -0
  174. package/dist/cli/output/progress.js +65 -0
  175. package/dist/cli/output/progress.js.map +1 -0
  176. package/dist/cli/output/render.d.ts +11 -0
  177. package/dist/cli/output/render.d.ts.map +1 -0
  178. package/dist/cli/output/render.js +18 -0
  179. package/dist/cli/output/render.js.map +1 -0
  180. package/dist/cli/output/types.d.ts +53 -0
  181. package/dist/cli/output/types.d.ts.map +1 -0
  182. package/dist/cli/output/types.js +14 -0
  183. package/dist/cli/output/types.js.map +1 -0
  184. package/dist/cli/output/wasm-fallback.d.ts +13 -0
  185. package/dist/cli/output/wasm-fallback.d.ts.map +1 -0
  186. package/dist/cli/output/wasm-fallback.js +92 -0
  187. package/dist/cli/output/wasm-fallback.js.map +1 -0
  188. package/dist/cli/paths.d.ts +4 -2
  189. package/dist/cli/paths.d.ts.map +1 -1
  190. package/dist/cli/paths.js +13 -5
  191. package/dist/cli/paths.js.map +1 -1
  192. package/dist/cli/tree-sitter-check.d.ts +6 -1
  193. package/dist/cli/tree-sitter-check.d.ts.map +1 -1
  194. package/dist/cli/tree-sitter-check.js +23 -1
  195. package/dist/cli/tree-sitter-check.js.map +1 -1
  196. package/dist/infrastructure/storage/adapters/SQLiteStorage.d.ts.map +1 -1
  197. package/dist/infrastructure/storage/adapters/SQLiteStorage.js +2 -2
  198. package/dist/infrastructure/storage/adapters/SQLiteStorage.js.map +1 -1
  199. package/dist/infrastructure/storage/adapters/sqlite-loader.d.ts +23 -0
  200. package/dist/infrastructure/storage/adapters/sqlite-loader.d.ts.map +1 -0
  201. package/dist/infrastructure/storage/adapters/sqlite-loader.js +210 -0
  202. package/dist/infrastructure/storage/adapters/sqlite-loader.js.map +1 -0
  203. package/dist/orchestrator/test-linker.d.ts.map +1 -1
  204. package/dist/orchestrator/test-linker.js +5 -36
  205. package/dist/orchestrator/test-linker.js.map +1 -1
  206. package/dist/orchestrator/types.d.ts +2 -0
  207. package/dist/orchestrator/types.d.ts.map +1 -1
  208. package/dist/orchestrator/types.js.map +1 -1
  209. package/dist/parser/implementations/tree-sitter-loader.d.ts +16 -0
  210. package/dist/parser/implementations/tree-sitter-loader.d.ts.map +1 -0
  211. package/dist/parser/implementations/tree-sitter-loader.js +105 -0
  212. package/dist/parser/implementations/tree-sitter-loader.js.map +1 -0
  213. package/dist/parser/implementations/tree-sitter-parser.d.ts +3 -0
  214. package/dist/parser/implementations/tree-sitter-parser.d.ts.map +1 -1
  215. package/dist/parser/implementations/tree-sitter-parser.js +8 -3
  216. package/dist/parser/implementations/tree-sitter-parser.js.map +1 -1
  217. package/dist/server/mcp/schema-adapter.d.ts +45 -0
  218. package/dist/server/mcp/schema-adapter.d.ts.map +1 -0
  219. package/dist/server/mcp/schema-adapter.js +290 -0
  220. package/dist/server/mcp/schema-adapter.js.map +1 -0
  221. package/dist/server/mcp/server.d.ts.map +1 -1
  222. package/dist/server/mcp/server.js +32 -2
  223. package/dist/server/mcp/server.js.map +1 -1
  224. package/docs/AI_ASSISTANT_SETUP.md +173 -14
  225. package/docs/README.md +40 -1
  226. package/docs/SETUP_GUIDE.md +23 -26
  227. package/docs/agents/domain.md +36 -0
  228. package/docs/agents/issue-tracker.md +22 -0
  229. package/docs/agents/triage-labels.md +15 -0
  230. package/docs/ai-guide/COMMANDS.md +125 -13
  231. package/docs/ai-guide/INTEGRATION.md +78 -11
  232. package/docs/ai-guide/OUTPUT.md +295 -2
  233. package/docs/ai-guide/PATTERNS.md +3 -3
  234. package/docs/ai-guide/PROMPTS.md +2 -2
  235. package/docs/ai-guide/QUICKSTART.md +41 -5
  236. package/docs/ai-guide/README.md +9 -9
  237. package/docs/archive/ideation/2026-04-15-executable-architecture-constitution-ideation-archive.md +70 -0
  238. package/docs/archive/ideation/2026-04-20-mycodemap-init-enhancements-ideation-archive.md +109 -0
  239. package/docs/archive/ideation/2026-04-22-harness-rules-entry-docs-optimization-ideation.md +102 -0
  240. package/docs/archive/ideation/2026-04-22-rules-claude-agents-optimization-ideation.md +107 -0
  241. package/docs/archive/ideation/2026-04-22-rules-entry-docs-optimization-consolidated-ideation-archive.md +54 -0
  242. package/docs/brainstorms/2026-04-22-rules-entry-docs-phase1-structure-consolidation-requirements.md +110 -0
  243. package/docs/brainstorms/999.1-mycodemap-init-enhancements-requirements.md +166 -0
  244. package/docs/exec-plans/README.md +3 -0
  245. package/docs/ideation/2026-04-15-executable-architecture-constitution-ideation.md +10 -22
  246. package/docs/ideation/2026-04-20-mycodemap-init-enhancements-ideation.md +51 -0
  247. package/docs/ideation/2026-04-22-rules-entry-docs-optimization-consolidated-ideation.md +114 -0
  248. package/docs/ideation/2026-04-29-ux-install-agent-experience-ideation.md +256 -0
  249. package/docs/lesson-learn/2026-04-19-prerelease-trusted-publishing-fix.md +119 -0
  250. package/docs/lesson-learn/image.png +0 -0
  251. package/docs/plans/2026-04-30-install-guide-and-repo-analyzer-design.md +394 -0
  252. package/docs/rules/README.md +5 -1
  253. package/docs/rules/architecture-guardrails.md +2 -1
  254. package/docs/rules/deployment.md +7 -0
  255. package/docs/rules/engineering-with-codex-openai.md +48 -9
  256. package/docs/rules/harness.md +106 -0
  257. package/docs/rules/pre-release-checklist.md +72 -33
  258. package/docs/rules/release.md +303 -0
  259. package/docs/rules/testing.md +70 -0
  260. package/docs/rules/validation.md +16 -7
  261. package/examples/claude/skills/mycodemap-repo-analyzer/SKILL.md +294 -0
  262. package/examples/claude/skills/mycodemap-repo-analyzer/references/analysis-guide.md +166 -0
  263. package/examples/claude/skills/mycodemap-repo-analyzer/references/module-analysis-guide.md +150 -0
  264. package/mycodemap.config.schema.json +1 -1
  265. package/package.json +9 -6
  266. package/scripts/hooks/templates/commit-msg +38 -0
  267. package/scripts/hooks/templates/pre-commit +224 -0
  268. package/scripts/pre-release-check.js +4 -4
  269. package/scripts/release.sh +1 -1
  270. package/scripts/sync-analyze-docs.js +2 -2
  271. package/scripts/validate-docs.js +395 -29
  272. package/docs/references/tmp.md +0 -527
package/README.md CHANGED
@@ -1,80 +1,98 @@
1
1
  # CodeMap
2
2
 
3
- > AI-first 代码地图工具 - AI/Agent 提供结构化、可预测的代码上下文
3
+ > AI-Native, Human-Friendly Code Architecture Governance Infrastructure — `v2.0` Milestone
4
4
 
5
- CodeMap 是一个面向 TypeScript/JavaScript/Go 项目的 AI-first 代码地图工具。它通过静态分析生成稳定的项目地图、依赖关系和结构化结果,帮助 AI/Agent 更快理解代码结构、定位影响范围,并把分析结果交给人类开发者继续判断与维护。
5
+ [中文版本](./README.zh-CN.md)
6
6
 
7
- ## 特性
7
+ CodeMap is an AI-Native-first, human-friendly code architecture governance infrastructure for TypeScript/JavaScript/Go projects. `v2.0` upgraded the CLI surface to a schema-driven self-describing unified interface: a single contract schema simultaneously generates the parser, MCP tool definitions, `--help-json`, and shell completions. `codemap doctor` provides continuous health diagnostics, the `Failure-to-Action Protocol` turns errors into structured state transitions, and the WASM-first build foundation eliminates the #1 installation drop-off caused by native dependency compilation failures. Human users get table/color output via `--human` or TTY auto-detection; AI/Agents receive JSON/NDJSON by default.
8
8
 
9
- - **AI-first 代码地图** - 生成 `AI_MAP.md`、`CONTEXT.md`、`codemap.json` 等 AI/Agent 可直接消费的上下文
10
- - **核心分析命令** - 提供 `generate`、`query`、`deps`、`impact`、`complexity`、`cycles`、`analyze`、`design`、`export`、`ci`,并提供 experimental `mcp`
11
- - **机器可读优先** - 结构化输出是产品基线;当前 CLI 过渡期仍主要通过 `--json` 暴露机器可读结果
12
- - **分层架构 (MVP3)** - 保持 `Interface → Infrastructure → Domain → Server → CLI` 的明确边界
13
- - **双层解析模式** - 提供 `fast`(快速正则)和 `smart`(TypeScript AST)两种解析模式
14
- - **多语言支持** - 支持 TypeScript/JavaScript、Go、Python(可扩展架构)
15
- - **依赖/影响/复杂度分析** - 适合变更影响评估、重构盘点和架构回溯
16
- - **CI 门禁与文档护栏** - 提供提交格式、文件头、风险评估、文档/输出契约检查
17
- - **多格式导出与存储抽象** - 支持导出图数据,并保留文件系统/内存/图数据库后端接口
9
+ ---
18
10
 
19
- ## 产品定位
11
+ ## Features
20
12
 
21
- | 维度 | 当前基线 |
22
- |------|----------|
23
- | 产品是谁 | `CodeMap` 是 AI-first 代码地图工具,而不是泛化的实现/发布/HTTP 工具箱 |
24
- | 主要消费者 | `AI/Agent 是主要消费者`;人类开发者负责配置、维护与按需阅读输出 |
25
- | 输出契约 | 目标是机器可读优先;`当前 CLI 现实` 是多数命令通过 `--json` 提供结构化结果,`analyze` 额外支持 `--output-mode machine|human` |
26
- | 架构边界 | `Server Layer` 是内部架构层,不等于公共 `mycodemap server` 命令 |
13
+ ### v2.0 Core Features
27
14
 
28
- 当前公共 CLI 聚焦 `init`、`generate`、`query`、`deps`、`cycles`、`complexity`、`impact`、`analyze`、`design`、`ci`、`workflow`、`export`、`ship`,以及 experimental `mcp`;`server`、`watch`、`report`、`logs` 已从 public CLI 移除,并在调用时给出迁移提示。
15
+ - **Interface Contract Schema** A single machine-readable schema defines the entire CLI surface; `codemap --schema` outputs the full contract JSON for agent introspection and dynamic adaptation
16
+ - **CLI-as-MCP Automatic Gateway** — All schema-defined CLI commands are automatically exposed as MCP tools with zero handwritten maintenance; new commands automatically get MCP exposure
17
+ - **AI-First Default Output** — JSON/NDJSON by default; `--human` flag renders tables/colors on demand; TTY auto-detection preserves interactive experience; progress events go to stderr
18
+ - **`codemap doctor`** — Continuous health diagnostics detecting ghost commands, native dependency issues, workspace drift, and agent connectivity
19
+ - **Failure-to-Action Protocol** — Every error returns structured `rootCause` + `remediationPlan` + `confidence` + `nextCommand`; agents can attempt automatic remediation
20
+ - **Validation Router** — Routes minimal verification by change type; docs guardrail validates that referenced commands are real and runnable
21
+ - **WASM-First Build Foundation** — `tree-sitter` / `better-sqlite3` provide WASM fallback paths; `--native` forces native mode; `codemap benchmark` compares WASM vs Native performance
29
22
 
30
- ## 安装
23
+ ### Core Capabilities
24
+
25
+ - **AI-first code map** — Generates `AI_MAP.md`, `CONTEXT.md`, `codemap.json`, and other AI/Agent-consumable context
26
+ - **Core analysis commands** — `generate`, `query`, `deps`, `impact`, `complexity`, `cycles`, `analyze`, `design`, `export`, `ci`
27
+ - **Layered architecture (MVP3)** — Clear boundaries: `Interface → Infrastructure → Domain → Server → CLI`
28
+ - **Dual parsing modes** — `fast` (regex) and `smart` (TypeScript AST)
29
+ - **Multi-language support** — TypeScript/JavaScript, Go, Python (extensible architecture)
30
+ - **Dependency / impact / complexity analysis** — For change impact assessment, refactoring inventory, and architecture retrospectives
31
+ - **CI gate and docs guardrail** — Commit format, file headers, risk assessment, docs/output contract checks
32
+ - **Multi-format export and storage abstraction** — Export graph data with filesystem / memory / sqlite backends
33
+
34
+ ---
35
+
36
+ ## Installation
31
37
 
32
38
  ```bash
33
- # 使用 npm
39
+ # Using npm
34
40
  npm install @mycodemap/mycodemap
35
41
 
36
- # 使用 yarn
42
+ # Using yarn
37
43
  yarn add @mycodemap/mycodemap
38
44
 
39
- # 使用 pnpm
45
+ # Using pnpm
40
46
  pnpm add @mycodemap/mycodemap
41
47
 
42
- # 全局安装(推荐,可直接使用 CLI
48
+ # Global install (recommended for CLI access)
43
49
  npm install -g @mycodemap/mycodemap
44
50
  ```
45
51
 
46
- **环境要求**: Node.js >= 18.0.0
52
+ **Requirements**: Node.js >= 20.0.0
53
+
54
+ ### No Build Tools? No Problem
55
+
56
+ CodeMap ships with WASM-first fallback. If your system lacks `python`, `make`, or `gcc`:
57
+ - `tree-sitter` automatically falls back to `web-tree-sitter` (WASM)
58
+ - `better-sqlite3` automatically falls back to `node:sqlite` (Node.js 22+) or `sql.js` (WASM)
59
+ - No manual intervention required — fallback activates on first run
60
+
61
+ ### Force Native (Performance)
62
+
63
+ If you have build tools installed and want maximum performance:
64
+ ```bash
65
+ mycodemap --native <command>
66
+ ```
47
67
 
48
- **MVP3 新依赖**:
49
- - `hono` - HTTP 服务器框架
50
- - `@hono/node-server` - Node.js 适配器
68
+ ---
51
69
 
52
- ## 快速开始
70
+ ## Quick Start
53
71
 
54
72
  ```bash
55
- # 1. 在项目根目录初始化配置
73
+ # 1. Initialize configuration in project root
56
74
  mycodemap init
57
75
 
58
- # 2. 生成代码地图
76
+ # 2. Generate code map
59
77
  mycodemap generate
60
78
 
61
- # 3. 查看生成的文件
79
+ # 3. View generated files
62
80
  ls .mycodemap/
63
- # AI_MAP.md - 项目全局概览(供 AI 使用)
64
- # CONTEXT.md - 上下文入口(跳转到 context/README.md
65
- # context/ - 各模块的详细上下文
66
- # codemap.json - 结构化 JSON 数据
67
- # dependency-graph.md - Mermaid 依赖图
81
+ # AI_MAP.md - Project overview (for AI)
82
+ # CONTEXT.md - Context entry (links to context/README.md)
83
+ # context/ - Detailed module contexts
84
+ # codemap.json - Structured JSON data
85
+ # dependency-graph.md - Mermaid dependency graph
68
86
  ```
69
87
 
70
88
  ```bash
71
- # 4. 当前 CLI 过渡现实:给 AI/Agent 时优先请求机器可读结果
89
+ # 4. For AI/Agent: structured output is the default
72
90
  mycodemap impact -f src/cli/index.ts -j
73
91
 
74
- # analyze 额外支持显式 machine/human 模式
75
- mycodemap analyze -i read -t src/cli/index.ts --output-mode human
92
+ # Human-readable output on demand
93
+ mycodemap analyze -i read -t src/cli/index.ts --human
76
94
 
77
- # 人类设计先落成 design contract,再交给 AI/Agent 消费
95
+ # Human design → design contract AI/Agent consumption
78
96
  cp docs/product-specs/DESIGN_CONTRACT_TEMPLATE.md mycodemap.design.md
79
97
  mycodemap design validate mycodemap.design.md --json
80
98
  mycodemap design map mycodemap.design.md --json
@@ -82,876 +100,142 @@ mycodemap design handoff mycodemap.design.md --json
82
100
  mycodemap design verify mycodemap.design.md --json
83
101
  ```
84
102
 
85
- 生成后,将 `.mycodemap/AI_MAP.md` 的内容提供给 AI 助手即可让其快速理解你的项目结构;需要结构化结果继续处理时,优先使用 JSON / machine 模式。
86
-
87
- ## 文档导航
88
-
89
- ### 人类用户
90
-
91
- | 文档 | 目标读者 | 内容 |
92
- |------|----------|------|
93
- | [🧭 文档索引](docs/README.md) | 所有读者 | 文档分层、阅读顺序与迁移状态 |
94
- | [🏗️ 架构总图](ARCHITECTURE.md) | 开发者 | 系统地图、模块边界、主执行流 |
95
- | [📋 MVP3 实施路线图](docs/exec-plans/MVP3-IMPLEMENTATION-ROADMAP.md) | 开发者 | 分层架构重构完整计划与状态 |
96
- | [📖 安装配置指南](docs/SETUP_GUIDE.md) | 人类开发者 | 完整的安装、配置和使用指南 |
97
- | [📁 配置示例](examples/) | 所有用户 | 各平台的现成配置文件 |
98
-
99
- ### 🤖 AI / Agent 专属文档
100
-
101
- > 如果你是 AI 助手或 Agent,**请优先阅读以下文档**:
103
+ After generation, provide `.mycodemap/AI_MAP.md` to your AI assistant for rapid project understanding. For structured results, use JSON/machine mode.
102
104
 
103
- | 文档 | 说明 |
104
- |------|------|
105
- | **[📘 AI_GUIDE.md](AI_GUIDE.md)** | **AI 主指南** - 快速参考、命令选择决策树、提示词模板速用 |
106
- | **[🚀 docs/ai-guide/QUICKSTART.md](docs/ai-guide/QUICKSTART.md)** | 快速开始、场景-命令映射表 |
107
- | **[📚 docs/ai-guide/COMMANDS.md](docs/ai-guide/COMMANDS.md)** | 完整 CLI 命令参考 |
108
- | **[📊 docs/ai-guide/OUTPUT.md](docs/ai-guide/OUTPUT.md)** | JSON 输出结构解析 |
109
- | **[🔄 docs/ai-guide/PATTERNS.md](docs/ai-guide/PATTERNS.md)** | 标准工作流模式 |
110
- | **[💬 docs/ai-guide/PROMPTS.md](docs/ai-guide/PROMPTS.md)** | 即用型提示词模板 |
111
- | **[🔧 docs/ai-guide/INTEGRATION.md](docs/ai-guide/INTEGRATION.md)** | 集成指南、错误处理 |
112
- | **[🛡️ AGENTS.md](AGENTS.md)** | 仓库级强约束、任务分级、代码红线 |
113
- | **[⚡ CLAUDE.md](CLAUDE.md)** | AI 执行手册、验收清单 |
114
- | **[🤖 docs/AI_ASSISTANT_SETUP.md](docs/AI_ASSISTANT_SETUP.md)** | AI 助手配置指引 |
115
- | **[🛠️ docs/rules/engineering-with-codex-openai.md](docs/rules/engineering-with-codex-openai.md)** | 面向 agent 的工程约束 |
105
+ ---
116
106
 
117
- **AI 快速入口**: `.cursorrules` | `.github/copilot-instructions.md`
118
-
119
- ## CLI 命令
120
-
121
- > 说明:以下章节记录当前公开的公共命令面。`workflow` 是公开的 analysis-only 工作流能力,`ship` 仍是过渡能力;`server`、`watch`、`report`、`logs` 已从 public CLI 移除,并在调用时输出迁移提示。
107
+ ## CLI Commands
122
108
 
123
109
  ### `mycodemap init`
124
110
 
125
- 初始化项目的 CodeMap 配置文件。
111
+ Initialize and reconcile the project's CodeMap workspace / config / hooks / rules state.
126
112
 
127
113
  ```bash
128
- mycodemap init # 创建默认配置文件
129
- mycodemap init -y # 使用默认配置直接创建
130
-
131
- # 别名:codemap init 也可以使用
114
+ mycodemap init # Show reconciliation preview (default: no write)
115
+ mycodemap init --interactive # Explicitly show preview (same as default)
116
+ mycodemap init -y # Write with defaults
132
117
  ```
133
118
 
134
- | 选项 | 说明 |
135
- |------|------|
136
- | `-y, --yes` | 使用默认配置 |
137
-
138
- 执行后会在项目根目录生成 `mycodemap.config.json` 配置文件。
139
-
140
119
  ### `mycodemap generate`
141
120
 
142
- 分析项目并生成代码地图文件。
121
+ Analyze the project and generate code map files.
143
122
 
144
123
  ```bash
145
- mycodemap generate # 使用默认 hybrid 模式
146
- mycodemap generate -m smart # 使用 smart 模式(AST 深度分析)
147
- mycodemap generate -o ./docs/codemap # 指定输出目录
148
- mycodemap generate --symbol-level # 额外 materialize symbol-level 调用依赖(实验性首期切片)
149
-
150
- # 别名:codemap generate 也可以使用
124
+ mycodemap generate # Default hybrid mode
125
+ mycodemap generate -m smart # Smart mode (AST deep analysis)
126
+ mycodemap generate -o ./docs/codemap # Custom output directory
127
+ mycodemap generate --symbol-level # Extra symbol-level call deps
151
128
  ```
152
129
 
153
- | 选项 | 说明 | 默认值 |
154
- |------|------|--------|
155
- | `-m, --mode <mode>` | 分析模式:`fast`(正则匹配)、`smart`(TypeScript AST)或 `hybrid`(自动选择) | `hybrid` |
156
- | `-o, --output <dir>` | 输出目录 | `.mycodemap` |
157
- | `--symbol-level` | 额外把可解析的 symbol-level `call` 依赖写入图存储;默认 generate 行为不变 | `false` |
158
- | `--ai-context` | 为每个文件生成描述 | - |
159
-
160
- - `codemap.json` 现在会显式写出 `graphStatus`、`failedFileCount` 与可选 `parseFailureFiles`。
161
- - 当某些发现到的文件没有成功进入最终图时,`graphStatus` 会降级为 `partial`;不要把这种结果当成完整图继续做自动化决策。
162
-
163
- **模式说明:**
164
-
165
- | 模式 | 速度 | 精度 | 适用场景 |
166
- |------|------|------|----------|
167
- | `fast` | 极快 | 基本结构 | 日常开发、大型项目快速预览 |
168
- | `smart` | 较慢 | 完整语义 | 深度分析、复杂度评估、类型推导 |
169
- | `hybrid` | 自动 | 自适应 | **推荐** - 文件数<50用fast,≥50用smart |
130
+ | Option | Description | Default |
131
+ |--------|-------------|---------|
132
+ | `-m, --mode <mode>` | Analysis mode: `fast`, `smart`, or `hybrid` | `hybrid` |
133
+ | `-o, --output <dir>` | Output directory | `.mycodemap` |
134
+ | `--symbol-level` | Materialize symbol-level `call` deps | `false` |
170
135
 
171
136
  ### `mycodemap query`
172
137
 
173
- 查询代码地图中的符号、模块和依赖信息。
174
-
175
- ```bash
176
- mycodemap query -s "ModuleInfo" # 精确查询符号
177
- mycodemap query -m "src/parser" # 查询模块信息
178
- mycodemap query -d "analyzer" # 查询依赖关系
179
- mycodemap query -S "cache" # 模糊搜索
180
- mycodemap query -S "parse" -j # JSON 格式输出
181
- mycodemap query -S "plugin" -l 5 # 限制结果数量
182
-
183
- # 别名:codemap query 也可以使用
184
- ```
185
-
186
- | 选项 | 说明 | 默认值 |
187
- |------|------|------|
188
- | `-s, --symbol <name>` | 精确查询符号 | - |
189
- | `-m, --module <path>` | 查询模块信息 | - |
190
- | `-d, --deps <name>` | 查询依赖关系 | - |
191
- | `-S, --search <word>` | 模糊搜索 | - |
192
- | `-l, --limit <number>` | 限制结果数量 | `50` |
193
- | `-j, --json` | 以 JSON 格式输出 | - |
194
-
195
- ### `mycodemap deps`
196
-
197
- 分析并输出模块的依赖关系树。
198
-
199
- ```bash
200
- mycodemap deps # 查看所有模块的依赖统计
201
- mycodemap deps -m "src/parser" # 查看指定模块的依赖树
202
- mycodemap deps -m "src/parser" -j # JSON 格式输出
203
- ```
204
-
205
- | 选项 | 说明 | 默认值 |
206
- |------|------|--------|
207
- | `-m, --module <path>` | 查询指定模块的依赖 | - |
208
- | `-j, --json` | 以 JSON 格式输出 | - |
209
-
210
- ### `mycodemap cycles`
211
-
212
- 检测项目中的循环依赖。
213
-
214
- ```bash
215
- mycodemap cycles # 检测所有循环依赖
216
- ```
217
-
218
- ### `mycodemap complexity`
219
-
220
- 分析代码复杂度,输出圈复杂度、认知复杂度和可维护性指数。
221
-
222
- ```bash
223
- mycodemap complexity # 分析整个项目的复杂度
224
- mycodemap complexity -f src/cli/index.ts # 分析指定文件的复杂度
225
- mycodemap complexity -j # JSON 格式输出
226
- ```
227
-
228
- | 选项 | 说明 | 默认值 |
229
- |------|------|--------|
230
- | `-f, --file <path>` | 查看指定文件的复杂度 | - |
231
- | `-j, --json` | 以 JSON 格式输出 | - |
232
-
233
- ### `mycodemap impact`
234
-
235
- 评估指定文件或模块变更的影响范围。
236
-
237
- ```bash
238
- mycodemap impact -f src/cli/index.ts # 分析指定文件的变更影响
239
- mycodemap impact -f src/cli/index.ts --transitive # 包含传递依赖
240
- mycodemap impact -f src/cli/index.ts -j # JSON 格式输出
241
- ```
242
-
243
- | 选项 | 说明 | 默认值 |
244
- |------|------|------|
245
- | `-f, --file <path>` | **必填** 指定要分析的文件 | - |
246
- | `-t, --transitive` | 包含传递依赖(间接影响) | - |
247
- | `-j, --json` | 以 JSON 格式输出 | - |
248
-
249
- ### `mycodemap mcp`(experimental)
250
-
251
- 本地只读的 stdio MCP 薄切片。当前只提供两个工具:`codemap_query`、`codemap_impact`。
252
-
253
- ```bash
254
- # 先生成 symbol-level 图
255
- mycodemap generate --symbol-level
256
-
257
- # 把当前仓库写入本地 MCP host 配置
258
- mycodemap mcp install
259
-
260
- # 由 MCP host 启动 stdio server
261
- mycodemap mcp start
262
- ```
263
-
264
- | 子命令 | 说明 |
265
- |--------|------|
266
- | `mcp install` | 把 experimental 本地 server 写入当前仓库 `.mcp.json` |
267
- | `mcp start` | 启动本地 stdio MCP server;`stdout` 仅承载协议帧 |
268
-
269
- - `mcp` 当前是 **experimental / local-only / read-only** surface,不是稳定长期 public API。
270
- - 使用前必须先执行 `mycodemap generate --symbol-level`;否则工具会返回 `GRAPH_NOT_FOUND`。
271
- - canonical 集成文档见 `docs/ai-guide/INTEGRATION.md`;若宿主暂时不支持真正 MCP,可先回退到传统 CLI wrapper 方式。
272
-
273
- ### 已移除的公共 CLI 命令
274
-
275
- 以下命令已从 public CLI 移除;直接调用时,CLI 会显式失败并给出迁移提示,而不是继续执行旧功能。
276
-
277
- | 已移除命令 | 当前迁移方式 |
278
- |------------|--------------|
279
- | `watch` | 改用一次性的 `mycodemap generate` 刷新代码地图 |
280
- | `report` | 直接读取 `.mycodemap/AI_MAP.md`,或使用 `mycodemap export <format>` 导出结果 |
281
- | `logs` | 直接读取 `.mycodemap/logs/` 下的日志文件 |
282
- | `server` | 公共 CLI 已移除;`Server Layer` 仍是内部架构层,不等于公开 `mycodemap server` 命令 |
283
-
284
- ### `mycodemap export` (MVP3)
285
-
286
- 导出代码图到各种格式。
287
-
288
- ```bash
289
- mycodemap export json # 导出为 JSON
290
- mycodemap export graphml # 导出为 GraphML (Gephi 兼容)
291
- mycodemap export dot # 导出为 DOT (Graphviz)
292
- mycodemap export mermaid # 导出为 Mermaid 语法
293
- mycodemap export json -o ./out # 指定输出路径
294
- ```
295
-
296
- | 选项 | 说明 | 默认值 |
297
- |------|------|--------|
298
- | `-o, --output <path>` | 输出文件路径 | 自动根据格式生成 |
299
-
300
- ## 工作流编排(分析型 workflow)
301
-
302
- `workflow` 是公开的 analysis-only 工作流能力,只编排分析阶段:`find → read → link → show`。
303
- 代码实现、commit 检查和 CI 运行不再属于 workflow phase;这些职责分别回到常规开发流程、`mycodemap ci` 与 `mycodemap ship`。
304
-
305
- ### 工作流阶段
306
-
307
- ```
308
- ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
309
- │ find │ → │ read │ → │ link │ → │ show │
310
- │ 查找代码线索 │ │ 阅读影响范围 │ │ 关联依赖引用 │ │ 展示概览结果 │
311
- └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
312
- ```
313
-
314
- | 阶段 | 对应意图 | 说明 | 典型产物 |
315
- |------|----------|------|----------|
316
- | **find** | `analyze --intent find` | 查找符号、关键词与候选文件 | 相关文件 / 符号列表 |
317
- | **read** | `analyze --intent read` | 阅读影响范围、复杂度与上下文 | 影响与复杂度摘要 |
318
- | **link** | `analyze --intent link` | 汇总依赖、引用与关联关系 | 依赖 / 引用结果 |
319
- | **show** | `analyze --intent show` | 生成模块概览与展示型摘要 | overview / summary 输出 |
320
-
321
- > 内置模板(`refactoring` / `bugfix` / `feature` / `hotfix`)共享同一 4 阶段顺序,只通过不同的阶段阈值和适用场景调整体验。
322
-
323
- ## 设计契约输入面
324
-
325
- `design` 是给“人类负责设计、AI 负责执行”协作链路准备的正式输入面。
326
- 先把设计写成 `mycodemap.design.md`,再用 CLI 校验必填 sections、空段、重复 heading 和未知 heading。
327
-
328
- ```bash
329
- # 从 canonical template 起步
330
- cp docs/product-specs/DESIGN_CONTRACT_TEMPLATE.md mycodemap.design.md
331
-
332
- # 使用默认文件名校验
333
- mycodemap design validate mycodemap.design.md --json
334
-
335
- # 校验通过后生成 candidate scope
336
- mycodemap design map mycodemap.design.md --json
337
-
338
- # 把 scope 打包成 handoff artifact,供 reviewer / AI agent 消费
339
- mycodemap design handoff mycodemap.design.md --json
340
-
341
- # 基于 reviewed handoff truth 做 verification / drift 检查
342
- mycodemap design verify mycodemap.design.md --json
343
-
344
- # 也可以显式传入其他路径
345
- mycodemap design validate docs/designs/login.design.md
346
- ```
347
-
348
- 必填 sections:
349
- - `## Goal`
350
- - `## Constraints`
351
- - `## Acceptance Criteria`
352
- - `## Non-Goals`
353
-
354
- > 建议最小工作流:`design validate → design map → design handoff → design verify`。`design map --json` 会返回 `summary`、`candidates`、`diagnostics` 与 `unknowns`;`design handoff --json` 会继续返回 `readyForExecution`、`approvals`、`assumptions` 与 `openQuestions`,默认 artifact 路径为 `.mycodemap/handoffs/{stem}.handoff.md|json`;`design verify --json` 会返回 `checklist`、`drift`、`diagnostics` 与 `readyForExecution`,其中 review-needed 不会直接变成非零退出,只有 blocker diagnostics 才会阻断。
355
-
356
- ### 工作流 CLI 命令
357
-
358
- ```bash
359
- # 启动工作流
360
- mycodemap workflow start "实现用户认证模块"
361
- # 启动工作流并指定模板(会保留 4 阶段顺序)
362
- mycodemap workflow start "修复登录接口 500" --template bugfix
363
-
364
- # 查看当前工作流状态
365
- mycodemap workflow status
366
-
367
- # 可视化当前工作流(支持 --timeline / --results)
368
- mycodemap workflow visualize
369
-
370
- # 推进到下一阶段
371
- mycodemap workflow proceed
372
-
373
- # 恢复当前活动工作流(可选传 workflow-id)
374
- mycodemap workflow resume
375
- mycodemap workflow resume <workflow-id>
376
-
377
- # 创建检查点
378
- mycodemap workflow checkpoint
379
-
380
- # 列出所有工作流
381
- mycodemap workflow list
382
-
383
- # 删除工作流
384
- mycodemap workflow delete <workflow-id>
385
-
386
- # 模板管理
387
- mycodemap workflow template list --all
388
- mycodemap workflow template info bugfix
389
- mycodemap workflow template apply bugfix
390
- mycodemap workflow template recommend "紧急修复支付超时"
391
- ```
392
-
393
- ### 工作流使用示例
394
-
395
- ```bash
396
- # 示例:围绕一个模块逐步收敛上下文
397
- $ mycodemap workflow start "梳理缓存模块上下文"
398
- [WORKFLOW STARTED]
399
- Task: 梳理缓存模块上下文
400
- Phase: find
401
-
402
- # 查看当前分析阶段与进度
403
- $ mycodemap workflow status
404
- Phase: find
405
-
406
- # 可视化 4 阶段分析流水线
407
- $ mycodemap workflow visualize
408
- ▶ 🔍 【Find】
409
-
410
- ○ 📖 Read
411
-
412
- ○ 🔗 Link
413
-
414
- ○ 🧭 Show
415
-
416
- # 当前阶段完成后推进到下一阶段
417
- $ mycodemap workflow proceed
418
- Next phase: read
419
-
420
- # 示例:对当前活动工作流应用模板(阶段顺序不变)
421
- $ mycodemap workflow template apply bugfix
422
- Applied template: bugfix
423
- Phases: find → read → link → show
424
- Current phase: find
425
- ```
426
-
427
- ## CI 门禁 (v2.5)
428
-
429
- CodeMap 提供 CI 阶段自动检查,确保代码质量。
430
-
431
- ```bash
432
- # 检查 README / docs / CLI 示例是否与仓库事实同步
433
- npm run docs:check
434
-
435
- # 通过统一 CLI 护栏入口复用同一检查
436
- mycodemap ci check-docs-sync
437
-
438
- # 检查提交格式 ([TAG] scope: message)
439
- mycodemap ci check-commits
440
-
441
- # 检查文件头注释 ([META], [WHY])
442
- mycodemap ci check-headers
443
-
444
- # 评估变更风险
445
- mycodemap ci assess-risk -f src/cache/lru-cache.ts
446
-
447
- # 检查输出契约
448
- mycodemap ci check-output-contract
449
- ```
450
-
451
- > `ci assess-risk` 现在输出 `status/confidence/freshness/source` 与统一 risk level;若 Git history 不可用,会显式打印 `unavailable` / warning,并说明阈值未被应用。
452
-
453
- ## 配置说明
454
-
455
- 通过 `mycodemap init` 生成的 `mycodemap.config.json` 配置文件支持以下选项:
456
-
457
- ```jsonc
458
- {
459
- // JSON Schema(可选,提供编辑器智能提示)
460
- "$schema": "https://mycodemap.dev/schema/config.json",
461
-
462
- // 分析模式:"fast"、"smart" 或 "hybrid"
463
- "mode": "hybrid",
464
-
465
- // 包含的文件 glob 模式
466
- "include": [
467
- "src/**/*.ts"
468
- ],
469
-
470
- // 排除的文件 glob 模式
471
- "exclude": [
472
- "node_modules/**",
473
- "dist/**",
474
- "build/**",
475
- "coverage/**",
476
- "**/*.test.ts",
477
- "**/*.spec.ts",
478
- "**/*.d.ts"
479
- ],
480
-
481
- // 输出目录
482
- "output": ".mycodemap",
483
-
484
- // 监听模式预留配置
485
- "watch": false,
486
-
487
- // 图存储后端配置
488
- "storage": {
489
- "type": "filesystem",
490
- "outputPath": ".codemap/storage"
491
- },
492
-
493
- // 插件加载配置
494
- "plugins": {
495
- "builtInPlugins": true,
496
- "plugins": [],
497
- "debug": false
498
- }
499
- }
500
- ```
501
-
502
- | 配置项 | 类型 | 说明 | 默认值 |
503
- |--------|------|------|--------|
504
- | `mode` | `"fast" \| "smart" \| "hybrid"` | 分析模式 | `"hybrid"` |
505
- | `include` | `string[]` | 包含的文件 glob 模式 | `["src/**/*.ts"]` |
506
- | `exclude` | `string[]` | 排除的文件 glob 模式 | `["node_modules/**", "dist/**", ...]` |
507
- | `output` | `string` | 输出目录路径 | `".mycodemap"` |
508
- | `watch` | `boolean` | 监听模式预留配置 | `false` |
509
- | `storage.type` | `"filesystem" \| "sqlite" \| "memory" \| "auto"` | 图存储后端类型 | `"filesystem"` |
510
- | `storage.outputPath` | `string` | 文件系统存储目录 | `".codemap/storage"` |
511
- | `storage.databasePath` | `string` | SQLite 数据目录(相对项目根目录) | `".codemap/governance.sqlite"` |
512
- | `storage.autoThresholds` | `object` | `auto` 后端选择阈值 | - |
513
- | `plugins.builtInPlugins` | `boolean` | 是否启用内置插件 | `true` |
514
- | `plugins.pluginDir` | `string` | 额外插件目录 | - |
515
- | `plugins.plugins` | `string[]` | 显式加载的插件名称列表 | `[]` |
516
- | `plugins.debug` | `boolean` | 是否输出插件调试日志 | `false` |
517
-
518
- ### 图存储后端说明
519
-
520
- ```jsonc
521
- {
522
- "storage": {
523
- "type": "sqlite",
524
- "databasePath": ".codemap/governance.sqlite"
525
- }
526
- }
527
- ```
528
-
529
- - `generate` 会把 CodeGraph 写入配置的 `storage` 后端,`export` 与内部 `Server Layer` handler 会读取同一份后端数据。
530
- - `neo4j` 与 `kuzudb` 已不再是正式支持的 backend;旧配置会返回显式迁移错误,不会静默 fallback 到 `filesystem`。
531
- - 显式选择 `sqlite` 且运行时缺少 `better-sqlite3` 或 Node.js `<20` 时,会返回显式错误。
532
- - `storage.type = "auto"` 当前优先选择 `sqlite`;若运行时缺少 `better-sqlite3` 或 Node.js `<20` 导致 SQLite 不可用,则 warning 后回退到 `filesystem`。
533
- - 图存储后端生产化不等于重新开放公共 HTTP API 产品面;`Server Layer` 仍是内部架构层。
534
-
535
- ### 插件运行时说明
536
-
537
- ```jsonc
538
- {
539
- "plugins": {
540
- "builtInPlugins": false,
541
- "pluginDir": "./codemap-plugins",
542
- "plugins": ["complexity-analyzer", "my-local-plugin"],
543
- "debug": true
544
- }
545
- }
546
- ```
547
-
548
- - 只有**显式声明了** `plugins` 段时,`generate` 才会启用插件 runtime;没有该段的旧项目保持原有行为。
549
- - 插件加载结果、诊断信息和插件生成文件会写入 `AI_MAP.md` 的 `Plugin Summary` 与 `codemap.json` 的 `pluginReport`。
550
- - 非法插件配置、插件初始化失败、generate hook 失败都会被收口为结构化 diagnostics,而不是静默忽略。
551
-
552
- > 文件发现契约:`generate`、`analyze` 与 `ci check-headers -d` 等扫描类命令共享同一套 `.gitignore` 感知排除规则;若仓库没有 `.gitignore`,则回退到默认 `exclude`(即 `node_modules/dist/build/coverage/**` 与 `**/*.test.ts` / `**/*.spec.ts` / `**/*.d.ts`),并在 Git worktree 场景下避免误扫描 `.git` 目录。
553
-
554
- ## 输出文件说明
555
-
556
- 运行 `mycodemap generate` 后,会在输出目录(默认 `.mycodemap/`)中生成以下文件:
557
-
558
- ### `AI_MAP.md`
559
-
560
- 项目全局概览文件,专为 AI 助手设计,包含:
561
- - 项目基本信息(文件数、代码行数、模块数等)
562
- - 已加载插件、插件生成文件数量与插件诊断摘要(仅当显式启用 plugins runtime)
563
- - 入口点列表
564
- - 模块组织表(导出数、依赖数、类型)
565
- - Mermaid 格式的依赖关系图
566
- - 类型摘要和导出统计
567
-
568
- ### `CONTEXT.md` 与 `context/`
569
-
570
- `CONTEXT.md` 是上下文入口文件,详细模块内容位于 `context/` 目录,包含:
571
- - 模块概述(类型、代码行数)
572
- - 导出列表(名称、类型、是否默认导出)
573
- - 导入列表(来源、引入的符号)
574
- - 符号列表(函数、类、接口等)
575
- - 依赖和被依赖关系
576
-
577
- ### `codemap.json`
578
-
579
- 完整的结构化 JSON 数据,包含所有分析结果,适用于程序化消费。数据结构包括:
580
- - `project` - 项目基本信息
581
- - `summary` - 统计摘要
582
- - `modules` - 模块详情数组(符号、导入、导出、复杂度等)
583
- - `dependencies` - 依赖图(节点和边)
584
- - `pluginReport` - 插件运行摘要(`loadedPlugins`、`generatedFiles`、`metrics`、`diagnostics`)
585
-
586
- ### `dependency-graph.md`
587
-
588
- 独立的 Mermaid 依赖关系图文件,可在支持 Mermaid 的 Markdown 渲染器中直接预览。
589
-
590
- ## MVP3 分层架构
591
-
592
- CodeMap 采用清晰的分层架构设计(MVP3),各层职责明确:
593
-
594
- ```
595
- ┌─────────────────────────────────────────────────────────────┐
596
- │ CLI Layer │
597
- │ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
598
- │ │workflow/ship│ │ export │ │ 原有命令(generate..)│ │
599
- │ └─────────────┘ └─────────────┘ └─────────────────────┘ │
600
- ├─────────────────────────────────────────────────────────────┤
601
- │ Server Layer │
602
- │ HTTP API / QueryHandler / AnalysisHandler │
603
- ├─────────────────────────────────────────────────────────────┤
604
- │ Domain Layer │
605
- │ Project / Module / Symbol / Dependency / CodeGraph │
606
- ├─────────────────────────────────────────────────────────────┤
607
- │ Infrastructure Layer │
608
- │ ┌──────────────────┐ ┌──────────────────┐ │
609
- │ │ Storage │ │ Parser │ │
610
- │ │ - FileSystem │ │ - TypeScript │ │
611
- │ │ - Memory │ │ - Go │ │
612
- │ │ - KùzuDB │ │ - Python │ │
613
- │ │ - Auto Select │ │ - Registry │ │
614
- │ └──────────────────┘ └──────────────────┘ │
615
- │ ┌──────────────────┐ │
616
- │ │ Repository │ CodeGraphRepositoryImpl │
617
- │ └──────────────────┘ │
618
- ├─────────────────────────────────────────────────────────────┤
619
- │ Interface Layer │
620
- │ 类型定义与契约 (Types, ILanguageParser, IStorage) │
621
- └─────────────────────────────────────────────────────────────┘
622
- ```
623
-
624
- > 命名边界:`Server Layer` 是内部架构层,不等于公共 `mycodemap server` 命令。
625
-
626
- ### 架构层说明
627
-
628
- | 层级 | 路径 | 职责 | 关键组件 |
629
- |------|------|------|----------|
630
- | **CLI** | `src/cli/` | 命令行接口(核心分析命令 + `workflow` / `ship` 扩展 surface) | `generate`, `query`, `impact`, `export` |
631
- | **Server** | `src/server/` | 内部 Server Layer / HTTP transport | `CodeMapServer`, `QueryHandler` |
632
- | **Domain** | `src/domain/` | 核心业务逻辑 | `Project`, `Module`, `CodeGraph` |
633
- | **Infrastructure** | `src/infrastructure/` | 技术实现 | `Storage`, `Parser`, `Repository` |
634
- | **Interface** | `src/interface/` | 类型契约 | `types/`, `config/` |
635
-
636
- ### 项目目录结构
637
-
638
- ```
639
- src/
640
- ├── cli/ # CLI 命令入口 (原有 + MVP3 新增)
641
- │ ├── commands/
642
- │ │ ├── server.ts # MVP3: HTTP API 服务器
643
- │ │ ├── export.ts # MVP3: 导出命令
644
- │ │ ├── generate.ts # 生成代码地图
645
- │ │ ├── query.ts # 查询命令
646
- │ │ └── ... # 其他命令
647
- │ └── index.ts
648
- ├── server/ # MVP3: HTTP API 服务器层
649
- │ ├── CodeMapServer.ts # 主服务器类
650
- │ ├── handlers/ # QueryHandler, AnalysisHandler
651
- │ └── routes/ # API 路由
652
- ├── domain/ # MVP3: 领域层
653
- │ ├── entities/ # Project, Module, Symbol, Dependency
654
- │ ├── services/ # CodeGraphBuilder
655
- │ ├── events/ # DomainEvent
656
- │ └── repositories/ # 仓库接口
657
- ├── infrastructure/ # MVP3: 基础设施层
658
- │ ├── storage/ # 存储适配器
659
- │ │ ├── adapters/ # FileSystem, Memory, KùzuDB
660
- │ │ └── StorageFactory.ts
661
- │ ├── parser/ # 解析器
662
- │ │ ├── interfaces/ # ParserBase
663
- │ │ ├── implementations/# TypeScript, Go, Python
664
- │ │ └── registry/ # ParserRegistry
665
- │ └── repositories/ # 仓库实现
666
- ├── interface/ # MVP3: 接口层
667
- │ ├── types/ # 核心类型定义
668
- │ └── config/ # 配置类型
669
- ├── core/ # 核心分析引擎 (原有)
670
- ├── parser/ # 原有解析器 (逐步迁移到 infrastructure/parser)
671
- ├── orchestrator/ # 编排层 (v2.5)
672
- └── ...
673
- ```
674
-
675
- ## AI 助手集成
676
-
677
- MyCodeMap 可与多种 AI 编程助手深度集成,提供智能代码分析能力:
678
-
679
- | AI 助手 | 配置方式 | 支持功能 |
680
- |---------|----------|----------|
681
- | **Kimi CLI** | Skill 配置 | 完整命令支持 |
682
- | **Claude Code** | Skill 配置 | 完整命令支持 |
683
- | **Codex CLI** | Agent 配置 | 完整命令支持 |
684
- | **GitHub Copilot** | 提示词配置 | 基础查询支持 |
685
-
686
- ### 快速配置
687
-
688
- ```bash
689
- # Kimi CLI
690
- mkdir -p .kimi/skills/codemap
691
- cp examples/kimi/codemap-skill.md .kimi/skills/codemap/SKILL.md
692
-
693
- # Claude Code
694
- mkdir -p .claude/skills/codemap
695
- cp examples/claude/codemap-skill.md .claude/skills/codemap/SKILL.md
696
-
697
- # Codex CLI
698
- mkdir -p .agents/skills/codemap
699
- cp examples/codex/codemap-agent.md .agents/skills/codemap/SKILL.md
700
- ```
701
-
702
- 详细配置请参考 [AI_ASSISTANT_SETUP.md](docs/AI_ASSISTANT_SETUP.md),设计与规则入口请先看 [docs/README.md](docs/README.md)。
703
-
704
- ## 新增 CLI 命令
705
-
706
- ### `mycodemap design`
707
-
708
- 校验、映射并验证 human-authored design contract,默认读取仓库根目录的 `mycodemap.design.md`。
138
+ Query symbols, modules, and dependencies in the code map.
709
139
 
710
140
  ```bash
711
- # validate: 使用默认路径校验
712
- mycodemap design validate mycodemap.design.md --json
713
-
714
- # validate: 显式指定文件
715
- mycodemap design validate docs/designs/login.design.md
716
-
717
- # map: 生成 candidate code scope
718
- mycodemap design map mycodemap.design.md --json
719
-
720
- # handoff: 生成 reviewer + agent 共用的 handoff package
721
- mycodemap design handoff mycodemap.design.md --json
722
-
723
- # verify: 基于 reviewed handoff truth 做 checklist / drift 校验
724
- mycodemap design verify mycodemap.design.md --json
725
- ```
726
-
727
- | 选项 | 说明 |
728
- |------|------|
729
- | `-j, --json` | 输出纯 JSON diagnostics,适合 AI/CI 消费 |
730
-
731
- > canonical 模板位于 `docs/product-specs/DESIGN_CONTRACT_TEMPLATE.md`。
732
- > 缺失必填 section、重复 section、空 section 或未知 heading 时,CLI 会返回结构化 diagnostics,而不是继续猜测设计意图。
733
- > `design map` 会基于 design contract 返回 `candidates`、`diagnostics` 与 `unknowns`;若命中 `no-candidates`、`over-broad-scope` 或 `high-risk-scope`,命令会直接阻断。
734
- > `design handoff` 会基于 validated design contract + mapping truth 返回 `readyForExecution`、`approvals`、`assumptions`、`openQuestions`;human mode 默认写出 `.mycodemap/handoffs/{stem}.handoff.md|json`。
735
- > `design verify` 会把 `Acceptance Criteria` 固定映射为 `checklist`,并输出 `drift` / `diagnostics`;当结果只是 `needs-review` 时保持零退出码,只有 `ok=false` 或 blocker diagnostics 才返回非零 exit code。
736
-
737
- ### `mycodemap check`
738
-
739
- 执行 design contract contract gate,默认输出机器可读 JSON。
740
-
741
- ```bash
742
- # 默认 full scan
743
- mycodemap check --contract mycodemap.design.md --against src
744
-
745
- # GitHub PR annotations
746
- mycodemap check --contract mycodemap.design.md --against src --base origin/main --annotation-format github
747
-
748
- # GitLab code quality artifact
749
- mycodemap check --contract mycodemap.design.md --against src --base origin/main --annotation-format gitlab --annotation-file gl-code-quality-report.json
750
-
751
- # 校准当前仓库是否允许默认 hard gate
752
- node scripts/calibrate-contract-gate.mjs --max-changed-files 10 --max-false-positive-rate 0.10
753
- ```
754
-
755
- > PR 默认 hard gate 只在 calibration 通过且 `changed files <= 10` 时开启;超窗、`diff-scope-fallback` 或 `false-positive rate >10%` 时必须显式切回 `warn-only / fallback`。
756
-
757
- ### `mycodemap history`
758
-
759
- 符号级 Git history / risk 查询:
760
-
761
- ```bash
762
- # 默认输出 machine-first JSON
763
- mycodemap history --symbol createCheckCommand
764
-
765
- # 查询某个符号的历史轨迹与风险摘要
766
- mycodemap history --symbol createCheckCommand
767
-
768
- # 人类可读摘要
769
- mycodemap history --symbol createCheckCommand --human
141
+ mycodemap query -s "ModuleInfo" # Exact symbol query
142
+ mycodemap query -m "src/parser" # Module info
143
+ mycodemap query -S "cache" # Fuzzy search
144
+ mycodemap query -S "parse" -j # JSON output
770
145
  ```
771
146
 
772
147
  ### `mycodemap analyze`
773
148
 
774
- 统一分析入口,当前公共契约只暴露四个 intent,并统一返回结构化输出:
775
-
776
- > 当前 public analyze contract 为 `find` / `read` / `link` / `show`;兼容期内 legacy intent 会在输出中通过 `warnings[]` 提示迁移,其中 `refactor` 已不再接受。
149
+ Unified analysis entry with four intents: `find`, `read`, `link`, `show`.
777
150
 
778
- <!-- BEGIN GENERATED: analyze-readme-examples -->
779
151
  ```bash
780
- # 查找符号 / 文本
781
152
  mycodemap analyze -i find -k SourceLocation
782
- mycodemap analyze -i find -t src/orchestrator -k IntentRouter --json
783
-
784
- # 阅读文件(影响 + 复杂度聚合)
785
- mycodemap analyze -i read -t src/cli/index.ts
786
153
  mycodemap analyze -i read -t src/cli/index.ts --scope transitive
787
- mycodemap analyze -i read -t src/cli/index.ts --include-tests --json
788
-
789
- # 关联关系(依赖 + 引用聚合)
790
154
  mycodemap analyze -i link -t src/cli/index.ts
791
- mycodemap analyze -i link -t src/interface/types.ts --json
792
-
793
- # 展示模块概览 / 文档
794
155
  mycodemap analyze -i show -t src/orchestrator
795
- mycodemap analyze -i show -t src/domain/services --output-mode human
796
-
797
- # 机器可读输出(JSON / structured)
798
- mycodemap analyze -i read -t src/index.ts --json
799
- mycodemap analyze -i link -t src/index.ts --structured --json
800
156
  ```
801
- <!-- END GENERATED: analyze-readme-examples -->
802
-
803
- <!-- BEGIN GENERATED: analyze-readme-options -->
804
- | 选项 | 说明 | 默认值 |
805
- |------|------|--------|
806
- | `-i, --intent <type>` | 分析类型:`find`/`read`/`link`/`show`(必填) | - |
807
- | `-t, --targets <paths...>` | 目标路径(`read`/`link`/`show` 必填,`find` 可选) | - |
808
- | `-k, --keywords <words...>` | 搜索关键词(主要用于 `find`) | - |
809
- | `-s, --scope <scope>` | 范围:`direct`(直接)/`transitive`(传递) | `direct` |
810
- | `-n, --topK <number>` | 返回结果数量 | `8` |
811
- | `--include-tests` | 包含测试文件关联 | - |
812
- | `--include-git-history` | 包含 Git 历史分析 | - |
813
- | `--json` | JSON 格式输出 | - |
814
- | `--structured` | 纯结构化输出(移除自然语言字段,配合 `--json` 使用) | - |
815
- | `--output-mode <mode>` | 输出模式:`machine`/`human` | `human` |
816
- <!-- END GENERATED: analyze-readme-options -->
817
-
818
- > 产品目标是机器可读优先;当前实现仍以显式 `--json` / `--output-mode` 作为主要入口。
819
- >
820
- > legacy 兼容映射:`search → find`、`impact/complexity → read`、`dependency/reference → link`、`overview/documentation → show`;`refactor` 会返回 `E0001_INVALID_INTENT`。
821
- >
822
- > `--include-git-history` 现在只会在 `read` intent 上附加统一的 Git history enrichment;其他 intent 会显式给出 warning,而不是 silent noop。
823
-
824
157
 
825
- ## 贡献指南
158
+ ### `mycodemap --schema`
826
159
 
827
- 欢迎提交 Issue Pull Request!
828
-
829
- ### 开发环境搭建
160
+ Output the full Interface Contract Schema JSON for agent introspection.
830
161
 
831
162
  ```bash
832
- # 克隆仓库
833
- git clone <repo-url>
834
- cd codemap
835
-
836
- # 安装依赖
837
- npm install
838
-
839
- # 编译
840
- npm run build
841
-
842
- # 开发模式(监听编译)
843
- npm run dev
844
-
845
- # 运行测试
846
- npm test # 功能测试(src/**/*.test.ts)
847
- npm run benchmark # 性能基准测试(refer/benchmark-quality.test.ts)
848
- npm run test:all # 功能 + 基准(串联执行)
849
-
850
- # 文档 / CLI 示例护栏
851
- npm run docs:check
852
- # `ci check-docs-sync` 会额外校验 analyze generated block
853
- node dist/cli/index.js ci check-docs-sync
854
-
855
- # 类型检查
856
- npm run typecheck
857
-
858
- # 代码检查
859
- npm run lint
163
+ mycodemap --schema # Full contract output
164
+ mycodemap --schema | jq '.' # Pretty-print with jq
860
165
  ```
861
166
 
862
- ### 提交规范
167
+ ### `mycodemap doctor`
863
168
 
864
- 请遵循以下 commit message 格式:
169
+ Continuous health diagnostics for the CodeMap ecosystem.
865
170
 
866
- ```
867
- [TAG] scope: message
868
-
869
- BUGFIX Bug 修复
870
- FEATURE 新功能
871
- REFACTOR 代码重构
872
- CONFIG 配置/构建变更
873
- DOCS 文档变更
874
- DELETE 删除代码/文件
171
+ ```bash
172
+ mycodemap doctor # Human-readable report
173
+ mycodemap doctor --json # Machine-readable JSON
875
174
  ```
876
175
 
877
- 示例:`[FEATURE] cli: add new command`
176
+ | Category | Checks |
177
+ |----------|--------|
178
+ | **install** | Native deps (`tree-sitter`, `better-sqlite3`) load status |
179
+ | **config** | `.mycodemap/` workspace configuration integrity |
180
+ | **runtime** | Ghost commands, command stubs, package.json consistency |
181
+ | **agent** | MCP connectivity, schema validity, tool registration |
878
182
 
879
- ### 文件规范
183
+ ### `mycodemap benchmark`
880
184
 
881
- 所有 TypeScript 源文件(除测试文件和类型定义外)头部必须包含以下注释:
185
+ Compare WASM vs Native performance.
882
186
 
883
- ```typescript
884
- // [META] since:YYYY-MM | owner:team | stable:false
885
- // [WHY] 说明该文件存在的原因和业务价值
187
+ ```bash
188
+ mycodemap benchmark # Default benchmark
189
+ mycodemap benchmark --wasm # Force WASM mode
190
+ mycodemap benchmark --native # Force Native mode
886
191
  ```
887
192
 
888
- - `[META]`:元数据注释,包含创建时间、负责团队、稳定性状态
889
- - `[WHY]`:解释文件存在的业务理由,帮助 AI 理解上下文
890
-
891
- ### 开发注意事项
892
-
893
- - 项目使用 ESM 模块格式(`"type": "module"`)
894
- - TypeScript 严格模式
895
- - 使用 Vitest 作为测试框架
896
- - **提交前会自动运行与变更相关的测试,失败将阻断提交**
897
- - **提交前会检查文件头注释规范([META]/[WHY])**
898
- - 新增功能请同步补充测试和文档
899
-
900
- ### 运行日志(调试追踪)
193
+ ### MCP Integration (CLI-as-MCP Gateway)
901
194
 
902
- - CLI 运行日志默认写入 `.mycodemap/logs/codemap-YYYY-MM-DD.log`
903
- - 默认保留 14 天、最多保留 30 个日志文件(自动清理)
904
- - 可通过环境变量调整:
905
- - `CODEMAP_RUNTIME_LOG_ENABLED=false`:关闭运行日志
906
- - `CODEMAP_RUNTIME_LOG_DIR=<dir>`:自定义日志目录
907
- - `CODEMAP_RUNTIME_LOG_RETENTION_DAYS=<days>`:设置保留天数
908
- - `CODEMAP_RUNTIME_LOG_MAX_FILES=<n>`:设置最大保留文件数
909
- - `CODEMAP_RUNTIME_LOG_MAX_SIZE_MB=<mb>`:单个日志文件大小上限(超限后自动轮转并 gzip)
195
+ v2.0 MCP integration has upgraded from an experimental 2-tool slice to the **CLI-as-MCP Automatic Gateway**: all schema-defined CLI commands are automatically exposed as MCP tools.
910
196
 
911
- ## 许可证
197
+ ```bash
198
+ mycodemap mcp install # Write local server config to `.mcp.json`
199
+ mycodemap mcp start # Start local stdio MCP server
200
+ ```
912
201
 
913
- [MIT](LICENSE)
914
- ### `mycodemap ci`
202
+ - All 20+ schema-defined CLI commands are callable via MCP
203
+ - Dynamic tool registration: add command to schema → restart MCP server → new tool appears automatically
204
+ - See `docs/ai-guide/INTEGRATION.md` for details
915
205
 
916
- CI Gateway - 代码质量门禁工具:
206
+ ---
917
207
 
918
- ```bash
919
- # 验证工作区是否干净(ship 的发布前检查也复用这条规则)
920
- mycodemap ci check-working-tree
208
+ ## Documentation
921
209
 
922
- # 验证当前分支是否允许执行发布前检查
923
- mycodemap ci check-branch
924
- mycodemap ci check-branch --allow main,release/*
210
+ ### For Human Users
925
211
 
926
- # 运行发布前脚本集合(docs/typecheck/lint/test/build/pack)
927
- mycodemap ci check-scripts
212
+ | Document | Audience | Content |
213
+ |----------|----------|---------|
214
+ | [🧭 Docs Index](docs/README.md) | All readers | Document layers, reading order, migration status |
215
+ | [🏗️ Architecture](ARCHITECTURE.md) | Developers | System map, module boundaries, main execution flows |
216
+ | [📖 Setup Guide](docs/SETUP_GUIDE.md) | Human developers | Full installation, configuration, and usage guide |
217
+ | [📁 Examples](examples/) | All users | Ready-to-use configuration files |
928
218
 
929
- # 验证提交格式([TAG] scope: message)
930
- mycodemap ci check-commits
931
- mycodemap ci check-commits -c 5
932
- mycodemap ci check-commits -r origin/main..HEAD
219
+ ### 🤖 AI / Agent Docs
933
220
 
934
- # 验证文件头注释([META], [WHY])
935
- mycodemap ci check-headers
936
- mycodemap ci check-headers -d src/domain
937
- mycodemap ci check-headers -f "src/index.ts,src/cli/index.ts"
221
+ | Document | Description |
222
+ |----------|-------------|
223
+ | **[📘 AI_GUIDE.md](AI_GUIDE.md)** | **AI main guide** — quick reference, command decision tree, prompt templates |
224
+ | **[🚀 Quick Start](docs/ai-guide/QUICKSTART.md)** | Scenario-to-command mapping |
225
+ | **[📚 Commands](docs/ai-guide/COMMANDS.md)** | Full CLI command reference |
226
+ | **[📊 Output Schema](docs/ai-guide/OUTPUT.md)** | JSON output structure parsing |
227
+ | **[🔧 Integration](docs/ai-guide/INTEGRATION.md)** | MCP/Agent integration, error handling |
228
+ | **[🛡️ AGENTS.md](AGENTS.md)** | Repository-level constraints |
229
+ | **[⚡ CLAUDE.md](CLAUDE.md)** | AI entry routing |
938
230
 
939
- # 评估变更风险
940
- mycodemap ci assess-risk
941
- mycodemap ci assess-risk -t 0.5
231
+ ---
942
232
 
943
- # 验证文档同步(含 analyze generated block 校验)
944
- mycodemap ci check-docs-sync
233
+ ## Contributing
945
234
 
946
- # 验证输出契约
947
- mycodemap ci check-output-contract
235
+ See [README.zh-CN.md](./README.zh-CN.md) for full development setup, commit conventions, and coding standards (中文版本包含完整的开发环境搭建、提交规范和代码规范).
948
236
 
949
- # 检查提交文件数量(限制 10 个文件)
950
- mycodemap ci check-commit-size
951
- mycodemap ci check-commit-size -m 15
952
- ```
237
+ ---
953
238
 
954
- > `mycodemap ship` 的 CHECK 阶段现在复用 `ci check-working-tree`、`ci check-branch`、`ci check-scripts` 作为 must-pass 事实源,而不是重复实现这些检查。
955
- > `mycodemap ci check-headers -d <dir>` 与 `generate` / `analyze` 共享同一套 `.gitignore` 感知排除模块;若仓库没有 `.gitignore`,则回退到默认 `exclude` 列表。
239
+ ## License
956
240
 
957
- 支持的提交 TAG 类型:`[REFACTOR]`, `[TEST]`, `[DOCS]`, `[FEAT]`, `[FIX]`, `[CHORE]`, `[PERF]`, `[SECURITY]`, `[BREAKING]`, `[HOTFIX]`, `[MIGRATION]`, `[WIP]`
241
+ [MIT](LICENSE)