@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,811 @@
1
+ # AI 助手集成配置指南
2
+
3
+ > 配置 MyCodeMap 与各类 AI 编程助手的完整指南
4
+
5
+ ---
6
+
7
+ ## 目录
8
+
9
+ 1. [概述](#概述)
10
+ 2. [Kimi CLI 配置](#kimi-cli-配置)
11
+ 3. [Claude Code 配置](#claude-code-配置)
12
+ 4. [Codex CLI 配置](#codex-cli-配置)
13
+ 5. [GitHub Copilot 配置](#github-copilot-配置)
14
+ 6. [通用提示词模板](#通用提示词模板)
15
+ 7. [高级配置](#高级配置)
16
+
17
+ ---
18
+
19
+ ## 概述
20
+
21
+ MyCodeMap 可以与多种 AI 编程助手集成,让 AI 能够:
22
+
23
+ - 🔍 **智能查询** - 快速定位代码符号和模块
24
+ - 📊 **依赖分析** - 理解项目结构和模块关系
25
+ - ⚡ **影响评估** - 分析代码变更的影响范围
26
+ - 🛡️ **质量门禁** - 自动执行 CI 检查
27
+
28
+ ### 快速选择
29
+
30
+ | AI 助手 | 配置难度 | 功能支持 | 推荐场景 |
31
+ |---------|----------|----------|----------|
32
+ | Kimi CLI | ⭐ 简单 | 完整 | 中文环境、Kimi 用户 |
33
+ | Claude Code | ⭐ 简单 | 完整 | Claude 用户 |
34
+ | Codex CLI | ⭐⭐ 中等 | 完整 | OpenAI 生态 |
35
+ | Copilot | ⭐⭐⭐ 复杂 | 基础 | VS Code 用户 |
36
+ | Cursor | ⭐ 简单 | 基础 | Cursor 用户 |
37
+
38
+ ### MyCodeMap 输出文件说明
39
+
40
+ | 文件 | 说明 | AI 读取优先级 |
41
+ |------|------|--------------|
42
+ | `.mycodemap/AI_MAP.md` | 项目全局概览 | ⭐⭐⭐ 最高 |
43
+ | `.mycodemap/codemap.json` | 结构化数据 | ⭐⭐ |
44
+ | `.mycodemap/CONTEXT.md` | 上下文入口 | ⭐⭐ |
45
+ | `.mycodemap/context/` | 模块详细上下文 | ⭐ |
46
+ | `.mycodemap/dependency-graph.md` | Mermaid 依赖图 | ⭐ |
47
+
48
+ ### 当前仓库维护者附加护栏
49
+
50
+ 如果你在维护当前 CodeMap 仓库,而不是只在使用安装包:
51
+
52
+ - 修改 README、AI 助手提示、CLI 示例、测试事实后,先运行 `npm run docs:check`
53
+ - 也可以通过 `mycodemap ci check-docs-sync` 走统一的 CI 子命令入口
54
+ - 当前仓库的 agent 工程规则以 `docs/rules/engineering-with-codex-openai.md` 为准
55
+
56
+ ---
57
+
58
+ ## Kimi CLI 配置
59
+
60
+ ### 步骤 1:创建 Skill 目录
61
+
62
+ ```bash
63
+ mkdir -p .kimi/skills/codemap
64
+ ```
65
+
66
+ ### 步骤 2:创建 Skill 文件
67
+
68
+ 创建 `.kimi/skills/codemap/SKILL.md`:
69
+
70
+ ```markdown
71
+ ---
72
+ name: codemap
73
+ description: MyCodeMap 代码分析技能,用于项目结构分析、符号查询、依赖分析和影响评估。
74
+ ---
75
+
76
+ # MyCodeMap Skill
77
+
78
+ ## 环境检测
79
+
80
+ 首先检测 CLI 是否可用:
81
+
82
+ ```bash
83
+ # 检测全局安装的 mycodemap
84
+ if command -v mycodemap &> /dev/null; then
85
+ CODEMAP_CMD="mycodemap"
86
+ # 检测本地安装的 mycodemap
87
+ elif [ -f "./node_modules/.bin/mycodemap" ]; then
88
+ CODEMAP_CMD="./node_modules/.bin/mycodemap"
89
+ # 使用 npx
90
+ else
91
+ CODEMAP_CMD="npx @mycodemap/mycodemap"
92
+ fi
93
+ ```
94
+
95
+ ## 常用命令
96
+
97
+ ### 生成代码地图
98
+ ```bash
99
+ $CODEMAP_CMD generate
100
+ ```
101
+
102
+ ### 查询符号
103
+ ```bash
104
+ $CODEMAP_CMD query -s "<symbol-name>"
105
+ ```
106
+
107
+ ### 查询模块
108
+ ```bash
109
+ $CODEMAP_CMD query -m "<module-path>"
110
+ ```
111
+
112
+ ### 模糊搜索
113
+ ```bash
114
+ $CODEMAP_CMD query -S "<keyword>" -l 10
115
+ ```
116
+
117
+ ### 依赖分析
118
+ ```bash
119
+ $CODEMAP_CMD deps -m "<module-path>"
120
+ ```
121
+
122
+ ### 影响范围分析
123
+ ```bash
124
+ $CODEMAP_CMD impact -f "<file-path>"
125
+ ```
126
+
127
+ ### 循环依赖检测
128
+ ```bash
129
+ $CODEMAP_CMD cycles
130
+ ```
131
+
132
+ ### 复杂度分析
133
+ ```bash
134
+ $CODEMAP_CMD complexity -f "<file-path>"
135
+ ```
136
+
137
+ ### 统一分析入口(analyze)
138
+ ```bash
139
+ # 影响分析
140
+ $CODEMAP_CMD analyze -i impact -t "<file-path>"
141
+
142
+ # 依赖分析
143
+ $CODEMAP_CMD analyze -i dependency -t "<module-path>"
144
+
145
+ # 复杂度分析
146
+ $CODEMAP_CMD analyze -i complexity -t "<path>"
147
+
148
+ # 搜索分析
149
+ $CODEMAP_CMD analyze -i search -k "<keyword>"
150
+
151
+ # 项目概览
152
+ $CODEMAP_CMD analyze -i overview -t "<path>"
153
+
154
+ # JSON 输出
155
+ $CODEMAP_CMD analyze -i impact -t "<file>" --json
156
+ ```
157
+
158
+ ### CI 门禁(ci)
159
+ ```bash
160
+ # 检查提交格式
161
+ $CODEMAP_CMD ci check-commits
162
+
163
+ # 检查文件头
164
+ $CODEMAP_CMD ci check-headers
165
+
166
+ # 评估变更风险
167
+ $CODEMAP_CMD ci assess-risk
168
+
169
+ # 验证输出契约
170
+ $CODEMAP_CMD ci check-output-contract
171
+ ```
172
+
173
+ ### 工作流编排(workflow)
174
+ ```bash
175
+ # 启动工作流
176
+ $CODEMAP_CMD workflow start "<task-description>"
177
+
178
+ # 查看状态
179
+ $CODEMAP_CMD workflow status
180
+
181
+ # 推进到下一阶段
182
+ $CODEMAP_CMD workflow proceed
183
+
184
+ # 可视化工作流
185
+ $CODEMAP_CMD workflow visualize
186
+ ```
187
+
188
+ ## 使用场景
189
+
190
+ ### 场景 1:理解项目结构
191
+
192
+ 当用户询问项目结构或特定模块时:
193
+ 1. 运行 `$CODEMAP_CMD generate` 生成最新代码地图
194
+ 2. 阅读 `.mycodemap/AI_MAP.md` 获取项目概览
195
+ 3. 根据需要使用 `query` 或 `deps` 获取详细信息
196
+
197
+ ### 场景 2:代码变更影响分析
198
+
199
+ 当用户要修改某个文件时:
200
+ 1. 运行 `$CODEMAP_CMD impact -f "<file-path>" --transitive`
201
+ 2. 分析输出结果,告知用户受影响的模块和文件
202
+
203
+ ### 场景 3:查找代码定义
204
+
205
+ 当用户询问某个类/函数的位置时:
206
+ 1. 运行 `$CODEMAP_CMD query -s "<symbol-name>"`
207
+ 2. 根据结果提供精确的文件路径和行号
208
+
209
+ ## 输出处理
210
+
211
+ - 直接返回 CLI 输出给用户
212
+ - 使用 `-j` 参数获取 JSON 格式便于解析
213
+ - 复杂输出可重定向到临时文件分析
214
+ ```
215
+
216
+ ### 步骤 3:验证配置
217
+
218
+ ```bash
219
+ # 在 Kimi CLI 中测试
220
+ cat .kimi/skills/codemap/SKILL.md
221
+
222
+ # 启动对话后询问
223
+ "使用 codemap 查询 IntentRouter 类"
224
+ ```
225
+
226
+ ---
227
+
228
+ ## Claude Code 配置
229
+
230
+ ### 步骤 1:创建 Skill 目录
231
+
232
+ ```bash
233
+ mkdir -p .claude/skills/codemap
234
+ ```
235
+
236
+ ### 步骤 2:创建 Skill 文件
237
+
238
+ 创建 `.claude/skills/codemap/SKILL.md`:
239
+
240
+ ```markdown
241
+ # MyCodeMap Code Analysis
242
+
243
+ ## Overview
244
+
245
+ Use MyCodeMap to analyze TypeScript/JavaScript project structure, query symbols, analyze dependencies, and assess change impact.
246
+
247
+ ## CLI Detection
248
+
249
+ Detect MyCodeMap CLI availability:
250
+
251
+ ```bash
252
+ # Check global installation
253
+ if command -v mycodemap &> /dev/null; then
254
+ CODEMAP="mycodemap"
255
+ # Check local installation
256
+ elif [ -f "./node_modules/.bin/mycodemap" ]; then
257
+ CODEMAP="./node_modules/.bin/mycodemap"
258
+ # Fallback to npx
259
+ else
260
+ CODEMAP="npx @mycodemap/mycodemap"
261
+ fi
262
+ ```
263
+
264
+ ## Commands
265
+
266
+ ### Generate Code Map
267
+ ```bash
268
+ $CODEMAP generate
269
+ ```
270
+ Generates: `.mycodemap/AI_MAP.md`, `.mycodemap/CONTEXT.md`, `.mycodemap/codemap.json`
271
+
272
+ ### Query Symbol
273
+ ```bash
274
+ $CODEMAP query -s "<symbol-name>"
275
+ $CODEMAP query -s "<symbol-name>" -j # JSON output
276
+ ```
277
+
278
+ ### Query Module
279
+ ```bash
280
+ $CODEMAP query -m "<module-path>"
281
+ ```
282
+
283
+ ### Search
284
+ ```bash
285
+ $CODEMAP query -S "<keyword>" -l 10
286
+ ```
287
+
288
+ ### Dependency Analysis
289
+ ```bash
290
+ $CODEMAP deps -m "<module-path>"
291
+ $CODEMAP deps -m "<module-path>" -j
292
+ ```
293
+
294
+ ### Impact Analysis
295
+ ```bash
296
+ $CODEMAP impact -f "<file-path>"
297
+ $CODEMAP impact -f "<file-path>" --transitive
298
+ ```
299
+
300
+ ### Cycle Detection
301
+ ```bash
302
+ $CODEMAP cycles
303
+ ```
304
+
305
+ ### Complexity Analysis
306
+ ```bash
307
+ $CODEMAP complexity
308
+ $CODEMAP complexity -f "<file-path>"
309
+ ```
310
+
311
+ ## Workflows
312
+
313
+ ### Understanding Project Structure
314
+
315
+ 1. Generate code map: `$CODEMAP generate`
316
+ 2. Read `.mycodemap/AI_MAP.md` for overview
317
+ 3. Query specific modules as needed
318
+
319
+ ### Before Code Changes
320
+
321
+ 1. Run impact analysis: `$CODEMAP impact -f "<file>" --transitive`
322
+ 2. Review affected files
323
+ 3. Suggest test cases based on impact
324
+
325
+ ### Finding Code
326
+
327
+ 1. Search symbol: `$CODEMAP query -s "<name>"`
328
+ 2. If not found, fuzzy search: `$CODEMAP query -S "<name>"`
329
+ 3. Check module context: `$CODEMAP query -m "<path>"`
330
+
331
+ ## Output Format
332
+
333
+ - Default: Human-readable text
334
+ - JSON: Add `-j` flag for structured data
335
+ ```
336
+
337
+ ### 步骤 3:验证配置
338
+
339
+ ```bash
340
+ # 在 Claude Code 中测试
341
+ claude
342
+
343
+ # 然后询问
344
+ "analyze the impact of changing src/cache/index.ts"
345
+ ```
346
+
347
+ ### 替代配置方式
348
+
349
+ 除了 Skill 配置,还可以使用以下方式:
350
+
351
+ #### 方式二:CLAUDE.md 指引
352
+
353
+ 在项目根目录创建 `CLAUDE.md`:
354
+
355
+ ```markdown
356
+ # 项目 AI 集成
357
+
358
+ ## CodeMap 使用
359
+
360
+ 本项目使用 CodeMap 进行代码分析。
361
+
362
+ ### 常用命令
363
+
364
+ ```bash
365
+ # 生成代码地图
366
+ mycodemap generate
367
+
368
+ # 查询符号
369
+ mycodemap query -s "SymbolName"
370
+
371
+ # 分析影响
372
+ mycodemap impact -f src/xxx.ts
373
+
374
+ # 依赖分析
375
+ mycodemap deps -m src/parser
376
+ ```
377
+
378
+ ### 输出文件
379
+
380
+ - `.mycodemap/AI_MAP.md` - 项目全局概览,AI 首先读取此文件
381
+ - `.mycodemap/codemap.json` - 结构化数据
382
+ - `.mycodemap/context/` - 各模块详细上下文
383
+ ```
384
+
385
+ #### 方式三:AGENTS.md 指引(详细)
386
+
387
+ 在项目根目录创建 `AGENTS.md`,提供更详细的 AI 助手指南:
388
+
389
+ ```markdown
390
+ # AGENTS.md - 项目开发指南
391
+
392
+ > 本文档面向 AI 编程助手,介绍项目结构和开发规范
393
+
394
+ ## 项目概述
395
+
396
+ [项目简介]
397
+
398
+ ## 技术栈
399
+
400
+ - TypeScript 5.3+
401
+ - Node.js >= 18.0.0
402
+
403
+ ## 代码分析
404
+
405
+ 使用 CodeMap 进行代码分析:
406
+
407
+ ```bash
408
+ # 生成代码地图(首次使用)
409
+ mycodemap generate
410
+
411
+ # 查找符号定义
412
+ mycodemap query -s "SymbolName"
413
+
414
+ # 查看模块依赖
415
+ mycodemap deps -m "src/module"
416
+
417
+ # 分析变更影响
418
+ mycodemap impact -f "src/file.ts"
419
+ ```
420
+
421
+ ## 关键文件
422
+
423
+ - `codemap.config.json` - CodeMap 配置文件
424
+ - `.mycodemap/AI_MAP.md` - 项目全局概览
425
+
426
+ ## 开发规范
427
+
428
+ - 使用 TypeScript Strict Mode
429
+ - 所有非测试文件需要 `[META]` 和 `[WHY]` 头注释
430
+ - 提交格式:`[TAG] scope: message`
431
+ ```
432
+
433
+ #### 方式四:全局 Skill
434
+
435
+ ```bash
436
+ # 找到 Claude Code 全局 skills 目录
437
+ # macOS: ~/Library/Application Support/Claude/skills/
438
+ # Linux: ~/.config/Claude/skills/
439
+
440
+ mkdir -p "$HOME/.config/Claude/skills/codemap"
441
+ # 将上述 SKILL.md 复制进去
442
+ ```
443
+
444
+ ---
445
+
446
+ ## Cursor 配置
447
+
448
+ Cursor 支持 `.cursor/rules/` 目录下的规则文件。
449
+
450
+ ### 步骤 1:创建规则目录
451
+
452
+ ```bash
453
+ mkdir -p .cursor/rules
454
+ ```
455
+
456
+ ### 步骤 2:创建规则文件
457
+
458
+ 创建 `.cursor/rules/codemap.md`:
459
+
460
+ ```markdown
461
+ ## CodeMap
462
+
463
+ Use CodeMap CLI for code analysis:
464
+ - `mycodemap generate` - Generate/update code map
465
+ - `mycodemap query -s "symbol"` - Find symbol definition
466
+ - `mycodemap query -m "module"` - Get module info
467
+ - `mycodemap impact -f "file"` - Analyze change impact
468
+ - `mycodemap deps -m "module"` - Show dependency tree
469
+
470
+ Project structure is documented in `.mycodemap/AI_MAP.md`.
471
+ ```
472
+
473
+ ---
474
+
475
+ ## Codex CLI 配置
476
+
477
+ ### 步骤 1:创建 Agent 配置
478
+
479
+ ```bash
480
+ mkdir -p .agents/skills/codemap
481
+ ```
482
+
483
+ ### 步骤 2:创建 Skill 文件
484
+
485
+ 创建 `.agents/skills/codemap/SKILL.md`:
486
+
487
+ ```markdown
488
+ # MyCodeMap Skill
489
+
490
+ ## Description
491
+
492
+ Code analysis tool for TypeScript/JavaScript projects. Provides project structure analysis, symbol querying, dependency analysis, and impact assessment.
493
+
494
+ ## CLI Command Detection
495
+
496
+ ```bash
497
+ # Priority: global > local > npx
498
+ if command -v mycodemap &> /dev/null; then
499
+ CODEMAP_CMD="mycodemap"
500
+ elif [ -f "./node_modules/.bin/mycodemap" ]; then
501
+ CODEMAP_CMD="./node_modules/.bin/mycodemap"
502
+ else
503
+ CODEMAP_CMD="npx @mycodemap/mycodemap"
504
+ fi
505
+ ```
506
+
507
+ ## Available Commands
508
+
509
+ | Command | Purpose | Example |
510
+ |---------|---------|---------|
511
+ | `generate` | Generate code map | `$CODEMAP_CMD generate` |
512
+ | `query -s` | Query symbol | `$CODEMAP_CMD query -s "ClassName"` |
513
+ | `query -m` | Query module | `$CODEMAP_CMD query -m "src/parser"` |
514
+ | `query -S` | Fuzzy search | `$CODEMAP_CMD query -S "keyword"` |
515
+ | `deps` | Dependency analysis | `$CODEMAP_CMD deps -m "src/core"` |
516
+ | `impact` | Impact analysis | `$CODEMAP_CMD impact -f "src/index.ts"` |
517
+ | `cycles` | Cycle detection | `$CODEMAP_CMD cycles` |
518
+ | `complexity` | Complexity metrics | `$CODEMAP_CMD complexity` |
519
+
520
+ ## Usage Patterns
521
+
522
+ ### Pattern 1: Project Onboarding
523
+ ```
524
+ User: "Explain this project structure"
525
+ Agent:
526
+ 1. $CODEMAP_CMD generate
527
+ 2. Read .mycodemap/AI_MAP.md
528
+ 3. Summarize key components
529
+ ```
530
+
531
+ ### Pattern 2: Change Impact
532
+ ```
533
+ User: "What happens if I modify X?"
534
+ Agent:
535
+ 1. $CODEMAP_CMD impact -f "<path>" --transitive
536
+ 2. Analyze output
537
+ 3. List affected files and suggest tests
538
+ ```
539
+
540
+ ### Pattern 3: Code Navigation
541
+ ```
542
+ User: "Where is function Y defined?"
543
+ Agent:
544
+ 1. $CODEMAP_CMD query -s "Y"
545
+ 2. Report location
546
+ 3. Offer to show code context
547
+ ```
548
+
549
+ ## Best Practices
550
+
551
+ - Always generate code map before queries if `.mycodemap/` is stale
552
+ - Use `-j` flag for programmatic processing
553
+ - Use `--transitive` for complete impact analysis
554
+ ```
555
+
556
+ ### 步骤 3:验证配置
557
+
558
+ ```bash
559
+ codex
560
+
561
+ # 测试
562
+ "what's the project structure?"
563
+ ```
564
+
565
+ ---
566
+
567
+ ## GitHub Copilot 配置
568
+
569
+ Copilot 不支持自定义 skill,但可以通过以下方式集成:
570
+
571
+ ### 方法 1:项目级提示词(推荐)
572
+
573
+ 创建 `.github/copilot-instructions.md`:
574
+
575
+ ```markdown
576
+ # MyCodeMap Integration
577
+
578
+ This project uses MyCodeMap for code analysis.
579
+
580
+ ## Available Commands
581
+
582
+ Before answering questions about project structure, run:
583
+ ```bash
584
+ mycodemap generate
585
+ ```
586
+
587
+ Then read `.mycodemap/AI_MAP.md` for context.
588
+
589
+ ## Common Queries
590
+
591
+ - Find symbol: `mycodemap query -s "<name>"`
592
+ - Check dependencies: `mycodemap deps -m "<path>"`
593
+ - Impact analysis: `mycodemap impact -f "<path>"`
594
+
595
+ ## When Answering
596
+
597
+ 1. Always check the code map first for structural questions
598
+ 2. Use impact analysis before suggesting changes
599
+ 3. Reference specific files and line numbers
600
+ ```
601
+
602
+ ### 方法 2:VS Code 配置
603
+
604
+ 创建 `.vscode/copilot-instructions.md`:
605
+
606
+ ```markdown
607
+ # Code Analysis
608
+
609
+ ## CodeMap
610
+
611
+ Use CodeMap for code analysis:
612
+ - Run `mycodemap generate` to create/update code map
613
+ - Query symbols: `mycodemap query -s "SymbolName"`
614
+ - Check dependencies: `mycodemap deps -m "module"`
615
+ - Analyze impact: `mycodemap impact -f "file.ts"`
616
+
617
+ ## Key Files
618
+
619
+ - `.mycodemap/AI_MAP.md` - Project overview for AI
620
+ ```
621
+
622
+ 或在 `.vscode/settings.json`:
623
+
624
+ ```json
625
+ {
626
+ "github.copilot.chat.codeGeneration.instructions": [
627
+ {
628
+ "text": "This project uses MyCodeMap. Run 'mycodemap generate' to get project structure from .mycodemap/AI_MAP.md before answering structural questions."
629
+ }
630
+ ]
631
+ }
632
+ ```
633
+
634
+ ---
635
+
636
+ ## 通用提示词模板
637
+
638
+ ### 项目结构理解提示词
639
+
640
+ ```markdown
641
+ 请帮助我理解这个项目的结构。
642
+
643
+ 步骤:
644
+ 1. 运行 mycodemap generate 生成代码地图
645
+ 2. 阅读 .mycodemap/AI_MAP.md 了解项目概览
646
+ 3. 根据文件内容分析:
647
+ - 项目的主要模块有哪些?
648
+ - 模块之间的关系是什么?
649
+ - 核心功能分布在哪些文件中?
650
+ 4. 给出清晰的项目结构说明
651
+ ```
652
+
653
+ ### 代码变更影响提示词
654
+
655
+ ```markdown
656
+ 我要修改文件 <file-path>,请帮我分析影响范围。
657
+
658
+ 步骤:
659
+ 1. 运行 mycodemap impact -f "<file-path>" --transitive
660
+ 2. 分析输出结果中的:
661
+ - 直接依赖的文件
662
+ - 传递依赖的文件
663
+ - 可能受影响的测试
664
+ 3. 给出修改建议和注意事项
665
+ 4. 建议需要添加或更新的测试用例
666
+ ```
667
+
668
+ ### 查找代码提示词
669
+
670
+ ```markdown
671
+ 帮我找到 <symbol-name> 的定义位置。
672
+
673
+ 步骤:
674
+ 1. 运行 mycodemap query -s "<symbol-name>"
675
+ 2. 如果未找到,运行 mycodemap query -S "<symbol-name>" 进行模糊搜索
676
+ 3. 报告找到的位置(文件路径、行号)
677
+ 4. 如果需要,展示相关代码片段
678
+ ```
679
+
680
+ ---
681
+
682
+ ## 高级配置
683
+
684
+ ### 仓库级护栏
685
+
686
+ 当 AI 助手配置文档本身被修改时,建议在提交前执行:
687
+
688
+ ```bash
689
+ npm run docs:check
690
+ mycodemap ci check-docs-sync
691
+ ```
692
+
693
+ ### 自定义输出格式
694
+
695
+ 对于需要特定输出格式的场景,创建包装脚本:
696
+
697
+ ```bash
698
+ #!/bin/bash
699
+ # mycodemap-wrapper.sh
700
+
701
+ CMD=${1:-generate}
702
+ shift
703
+
704
+ case $CMD in
705
+ "json")
706
+ mycodemap generate -o /tmp/codemap && cat /tmp/codemap/codemap.json
707
+ ;;
708
+ "summary")
709
+ mycodemap generate && head -100 .mycodemap/AI_MAP.md
710
+ ;;
711
+ *)
712
+ mycodemap $CMD "$@"
713
+ ;;
714
+ esac
715
+ ```
716
+
717
+ ### 环境变量配置
718
+
719
+ ```bash
720
+ # .envrc (direnv) 或 .bashrc
721
+
722
+ # 设置 mycodemap 命令别名
723
+ alias cm='mycodemap'
724
+ alias cmg='mycodemap generate'
725
+ alias cmq='mycodemap query'
726
+ alias cmi='mycodemap impact'
727
+
728
+ # 自动检测本地 vs 全局
729
+ mycodemap() {
730
+ if [ -f "./node_modules/.bin/mycodemap" ]; then
731
+ ./node_modules/.bin/mycodemap "$@"
732
+ else
733
+ command mycodemap "$@"
734
+ fi
735
+ }
736
+ ```
737
+
738
+ ### CI/CD 中的 AI 助手集成
739
+
740
+ 在 CI 流程中生成代码地图供 AI 使用:
741
+
742
+ ```yaml
743
+ # .github/workflows/ai-context.yml
744
+ name: Generate AI Context
745
+
746
+ on:
747
+ push:
748
+ branches: [main]
749
+
750
+ jobs:
751
+ generate:
752
+ runs-on: ubuntu-latest
753
+ steps:
754
+ - uses: actions/checkout@v4
755
+
756
+ - run: npm ci
757
+
758
+ - run: npx @mycodemap/mycodemap generate
759
+
760
+ - name: Upload AI context
761
+ uses: actions/upload-artifact@v4
762
+ with:
763
+ name: ai-context
764
+ path: .mycodemap/
765
+ ```
766
+
767
+ ---
768
+
769
+ ## 故障排除
770
+
771
+ ### Skill 未生效
772
+
773
+ | 问题 | 解决方案 |
774
+ |------|----------|
775
+ | Kimi: Skill 未加载 | 检查 `.kimi/skills/codemap/SKILL.md` 是否存在 |
776
+ | Claude: Skill 未识别 | 确保文件在 `.claude/skills/codemap/SKILL.md` |
777
+ | Codex: Agent 未响应 | 检查 `.agents/skills/codemap/SKILL.md` 权限 |
778
+
779
+ ### CLI 未找到
780
+
781
+ 确保 `mycodemap` 可用:
782
+
783
+ ```bash
784
+ # 测试命令
785
+ which mycodemap || echo "Not found in PATH"
786
+
787
+ # 解决方案 1:全局安装
788
+ npm install -g @mycodemap/mycodemap
789
+
790
+ # 解决方案 2:使用 npx
791
+ alias mycodemap='npx @mycodemap/mycodemap'
792
+
793
+ # 解决方案 3:本地安装
794
+ npm install --save-dev @mycodemap/mycodemap
795
+ ```
796
+
797
+ ### 输出解析问题
798
+
799
+ 如果 AI 助手无法正确解析输出:
800
+
801
+ 1. 使用 `-j` 参数获取 JSON 输出
802
+ 2. 检查编码是否为 UTF-8
803
+ 3. 确保终端宽度足够(避免截断)
804
+
805
+ ---
806
+
807
+ ## 参考
808
+
809
+ - [SETUP_GUIDE.md](./SETUP_GUIDE.md) - 人类用户安装指南
810
+ - [项目示例配置](../examples/) - 完整的示例配置文件
811
+ - [MyCodeMap GitHub](https://github.com/mycodemap/mycodemap)