@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,162 @@
1
+ # NPM 自动发布指南
2
+
3
+ > 本文档说明如何配置和触发 @mycodemap/mycodemap 的自动发布流程
4
+
5
+ ## 📋 发布流程概览
6
+
7
+ ```
8
+ 本地执行 release.sh → 推送 tag → GitHub Actions → 发布到 NPM
9
+ ```
10
+
11
+ ## 🔧 前置配置
12
+
13
+ ### 方式一: NPM Token (推荐,简单)
14
+
15
+ 1. **获取 NPM Token**
16
+ - 登录 [npmjs.com](https://www.npmjs.com/)
17
+ - 进入 Access Tokens → Generate New Token → Classic Token
18
+ - 选择类型: **Automation** (用于 CI/CD)
19
+ - 复制生成的 token
20
+
21
+ 2. **配置 GitHub Secret**
22
+ - 进入仓库 Settings → Secrets and variables → Actions
23
+ - 点击 "New repository secret"
24
+ - Name: `NPM_TOKEN`
25
+ - Value: 粘贴刚才复制的 npm token
26
+ - 点击 "Add secret"
27
+
28
+ ### 方式二: OIDC Trusted Publishing (更安全)
29
+
30
+ 1. **在 NPM 上配置**
31
+ - 登录 [npmjs.com](https://www.npmjs.com/)
32
+ - 进入包页面 → Access → Grant Access
33
+ - 选择 "Automation" → "GitHub Actions"
34
+ - 配置:
35
+ - GitHub Organization: `yuanyuanyuan` (或你的组织名)
36
+ - GitHub Repository: `mycodemap`
37
+ - Workflow name: `publish.yml`
38
+
39
+ 2. **修改 workflow** (已默认支持)
40
+ - 当前 `publish.yml` 已同时支持两种方式
41
+ - 如使用 OIDC,确保不设置 `NPM_TOKEN` secret
42
+
43
+ ## 🚀 发布操作
44
+
45
+ ### 方法 1: 使用发布脚本 (推荐)
46
+
47
+ ```bash
48
+ # 进入项目目录
49
+ cd /path/to/mycodemap
50
+
51
+ # 发布 patch 版本 (0.2.0 -> 0.2.1)
52
+ ./scripts/release.sh patch
53
+
54
+ # 发布 minor 版本 (0.2.0 -> 0.3.0)
55
+ ./scripts/release.sh minor
56
+
57
+ # 发布 major 版本 (0.2.0 -> 1.0.0)
58
+ ./scripts/release.sh major
59
+
60
+ # 发布指定版本
61
+ ./scripts/release.sh 0.2.1
62
+ ```
63
+
64
+ 脚本会自动:
65
+ 1. 更新 `package.json` 和 `package-lock.json` 中的版本号
66
+ 2. 运行完整的代码检查
67
+ 3. 提交版本更新
68
+ 4. 创建 git tag
69
+ 5. 推送到远程仓库
70
+ 6. 触发 GitHub Actions 发布流程
71
+
72
+ ### 方法 2: 手动操作
73
+
74
+ ```bash
75
+ # 1. 更新版本号
76
+ npm version patch # 或 minor, major
77
+
78
+ # 2. 推送代码和标签
79
+ git push origin main --tags
80
+
81
+ # 或者直接推送特定标签
82
+ git push origin v0.2.1
83
+ ```
84
+
85
+ ### 方法 3: GitHub 网页手动触发
86
+
87
+ 1. 进入仓库 Actions → Publish to NPM
88
+ 2. 点击 "Run workflow"
89
+ 3. 可选择输入版本号,或直接运行使用当前 package.json 版本
90
+
91
+ ## ✅ 发布前检查清单
92
+
93
+ - [ ] 更新 `CHANGELOG.md` 记录本次变更
94
+ - [ ] 确保所有测试通过 (`npm test`)
95
+ - [ ] 确保代码检查通过 (`npm run check:all`)
96
+ - [ ] 更新 `README.md` 中的版本说明(如需要)
97
+ - [ ] 确认版本号符合 [semver](https://semver.org/lang/zh-CN/) 规范
98
+
99
+ ## 🔍 验证发布
100
+
101
+ 发布后验证:
102
+
103
+ ```bash
104
+ # 查看 npm 上的最新版本
105
+ npm view @mycodemap/mycodemap version
106
+
107
+ # 安装测试
108
+ npm install -g @mycodemap/mycodemap
109
+
110
+ # 验证 CLI 版本
111
+ mycodemap --version
112
+ ```
113
+
114
+ ## 🐛 故障排查
115
+
116
+ ### 发布失败: "ENEEDAUTH"
117
+
118
+ **原因**: NPM_TOKEN 未配置或已过期
119
+
120
+ **解决**:
121
+ 1. 检查 GitHub Secrets 中是否设置了 `NPM_TOKEN`
122
+ 2. 确认 token 未过期(npm 上可查看)
123
+ 3. 确认 token 有发布权限
124
+
125
+ ### 发布失败: "403 Forbidden"
126
+
127
+ **原因**: 没有包发布权限
128
+
129
+ **解决**:
130
+ 1. 确认你是该 npm 包的维护者
131
+ 2. 如果是 scoped package (@mycodemap/xxx),确认已设置 `--access public`
132
+
133
+ ### 发布失败: "版本已存在"
134
+
135
+ **原因**: npm 上已有相同版本
136
+
137
+ **解决**:
138
+ 1. 检查 package.json 中的版本号
139
+ 2. npm 版本号不可重复,需要递增
140
+
141
+ ### GitHub Actions 未触发
142
+
143
+ **原因**: tag 格式不正确或 workflow 配置错误
144
+
145
+ **解决**:
146
+ 1. 确保 tag 格式为 `v*` (例如: v0.2.1)
147
+ 2. 检查 `.github/workflows/publish.yml` 是否存在
148
+ 3. 查看 Actions 日志排查问题
149
+
150
+ ## 📚 相关文件
151
+
152
+ | 文件 | 说明 |
153
+ |------|------|
154
+ | `.github/workflows/publish.yml` | GitHub Actions 发布工作流 |
155
+ | `scripts/release.sh` | 本地发布助手脚本 |
156
+ | `package.json` | 版本号定义 |
157
+ | `CHANGELOG.md` | 版本变更记录 |
158
+
159
+ ## 🔗 相关链接
160
+
161
+ - NPM 包页面: https://www.npmjs.com/package/@mycodemap/mycodemap
162
+ - GitHub Actions: https://github.com/yuanyuanyuan/mycodemap/actions
package/docs/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # docs/ - 文档信息架构
2
+
3
+ 本目录采用“入口文档短、细节文档分层”的结构。
4
+
5
+ ## 目录职责
6
+
7
+ - `docs/rules/`:开发、测试、验证、发布规则。
8
+ - `docs/design-docs/`:当前仍有效的设计文档。
9
+ - `docs/exec-plans/`:活跃计划、已完成计划、技术债跟踪。
10
+ - `docs/generated/`:生成内容与归档说明。
11
+ - `docs/product-specs/`:当前仍有效的产品规格与验收边界。
12
+ - `docs/references/`:外部参考、设计系统、工具链资料。
13
+ - `docs/archive/`:历史方案、迁移遗留、过期文档索引。
14
+
15
+ ## 当前状态
16
+
17
+ - `docs/` 根层当前只保留仍在使用的操作指南:`AI_ASSISTANT_SETUP.md`、`SETUP_GUIDE.md`。
18
+ - 2026-03-15 已把历史重构设计、历史需求草稿、Go 支持计划和过期计划统一移入 `docs/archive/`。
19
+ - `docs/design-docs/` 与 `docs/product-specs/` 当前不再保留旧稿;历史内容请从 `docs/archive/README.md` 进入。
20
+ - 新增内容优先写入分层目录,不再把新设计或新计划继续堆到根层。
21
+
22
+ ## 建议阅读顺序
23
+
24
+ 1. `../AGENTS.md`
25
+ 2. `../CLAUDE.md`
26
+ 3. `../ARCHITECTURE.md`
27
+ 4. 与任务最相关的 `docs/rules/*`
28
+ 5. 与任务最相关的现行文档;如需历史背景,再看 `docs/archive/README.md`
29
+ 6. 如需过程信息,再看 `docs/exec-plans/*`
30
+
31
+ ## 维护规则
32
+
33
+ - 入口文档只做导航,不复述大段细节。
34
+ - 规则进 `docs/rules/`,设计理由进 `docs/design-docs/`,计划进 `docs/exec-plans/`。
35
+ - 需求与验收进 `docs/product-specs/`,生成物说明进 `docs/generated/`,外部资料进 `docs/references/`。
36
+ - 历史文档进入 `docs/archive/`,并补全归档时间、归档原因、当前依据。
37
+ - 若文档更新影响执行协议或入口路径,要同步检查 `AGENTS.md`、`CLAUDE.md`、`ARCHITECTURE.md`、`README.md`。
@@ -0,0 +1,493 @@
1
+ # MyCodeMap 安装与配置指南
2
+
3
+ > 面向人类开发者的完整安装、配置和使用指南
4
+
5
+ ---
6
+
7
+ ## 目录
8
+
9
+ 1. [快速开始](#快速开始)
10
+ 2. [安装方式](#安装方式)
11
+ 3. [初始化配置](#初始化配置)
12
+ 4. [日常使用](#日常使用)
13
+ 5. [AI 助手集成](#ai-助手集成)
14
+ 6. [CI/CD 集成](#cicd-集成)
15
+ 7. [故障排除](#故障排除)
16
+
17
+ ---
18
+
19
+ ## 快速开始
20
+
21
+ ### 5 分钟上手
22
+
23
+ ```bash
24
+ # 1. 安装
25
+ npm install -g @mycodemap/mycodemap
26
+
27
+ # 2. 在项目根目录初始化
28
+ mycodemap init -y
29
+
30
+ # 3. 生成代码地图
31
+ mycodemap generate
32
+
33
+ # 4. 查看结果
34
+ ls .mycodemap/
35
+ ```
36
+
37
+ ---
38
+
39
+ ## 安装方式
40
+
41
+ ### 方式一:全局安装(推荐)
42
+
43
+ ```bash
44
+ npm install -g @mycodemap/mycodemap
45
+ ```
46
+
47
+ **优点**:
48
+ - 所有项目可用
49
+ - 直接使用 `mycodemap` 命令
50
+
51
+ ### 方式二:项目本地安装
52
+
53
+ ```bash
54
+ npm install --save-dev @mycodemap/mycodemap
55
+ ```
56
+
57
+ **使用**:
58
+ ```bash
59
+ npx mycodemap --help
60
+ ```
61
+
62
+ **优点**:
63
+ - 版本锁定
64
+ - 团队协作一致
65
+ - 可作为 npm 脚本使用
66
+
67
+ ### 方式三:使用 npx(无需安装)
68
+
69
+ ```bash
70
+ npx @mycodemap/mycodemap --help
71
+ ```
72
+
73
+ **适用场景**:
74
+ - 临时使用
75
+ - CI/CD 环境
76
+
77
+ ---
78
+
79
+ ## 初始化配置
80
+
81
+ ### 交互式初始化
82
+
83
+ ```bash
84
+ mycodemap init
85
+ ```
86
+
87
+ 会询问以下问题:
88
+ - 分析模式(fast/smart/hybrid)
89
+ - 包含的文件路径
90
+ - 排除的文件路径
91
+ - 输出目录
92
+
93
+ ### 使用默认配置
94
+
95
+ ```bash
96
+ mycodemap init -y
97
+ ```
98
+
99
+ 生成的配置文件 `mycodemap.config.json`:
100
+
101
+ ```json
102
+ {
103
+ "$schema": "https://mycodemap.dev/schema/config.json",
104
+ "mode": "hybrid",
105
+ "include": ["src/**/*"],
106
+ "exclude": [
107
+ "node_modules/**",
108
+ "dist/**",
109
+ "**/*.test.ts",
110
+ "**/*.spec.ts"
111
+ ],
112
+ "output": ".mycodemap"
113
+ }
114
+ ```
115
+
116
+ ### 配置选项详解
117
+
118
+ | 配置项 | 类型 | 默认值 | 说明 |
119
+ |--------|------|--------|------|
120
+ | `mode` | string | `"hybrid"` | 分析模式:`fast`(快速正则)、`smart`(AST深度分析)、`hybrid`(自动选择) |
121
+ | `include` | string[] | `["src/**/*"]` | 包含的文件 glob 模式 |
122
+ | `exclude` | string[] | 见上 | 排除的文件 glob 模式 |
123
+ | `output` | string | `".mycodemap"` | 输出目录路径 |
124
+
125
+ ---
126
+
127
+ ## 日常使用
128
+
129
+ ### 生成代码地图
130
+
131
+ ```bash
132
+ # 默认 hybrid 模式
133
+ mycodemap generate
134
+
135
+ # 指定模式
136
+ mycodemap generate -m smart
137
+
138
+ # 指定输出目录
139
+ mycodemap generate -o ./docs/codemap
140
+ ```
141
+
142
+ ### 查询代码
143
+
144
+ ```bash
145
+ # 查询符号
146
+ mycodemap query -s "ModuleInfo"
147
+
148
+ # 查询模块
149
+ mycodemap query -m "src/parser"
150
+
151
+ # 模糊搜索
152
+ mycodemap query -S "cache" -l 10
153
+
154
+ # JSON 输出
155
+ mycodemap query -s "IntentRouter" -j
156
+ ```
157
+
158
+ ### 依赖分析
159
+
160
+ ```bash
161
+ # 查看所有依赖
162
+ mycodemap deps
163
+
164
+ # 查看指定模块依赖
165
+ mycodemap deps -m "src/parser"
166
+
167
+ # 检测循环依赖
168
+ mycodemap cycles
169
+ ```
170
+
171
+ ### 影响范围分析
172
+
173
+ ```bash
174
+ # 分析文件变更影响
175
+ mycodemap impact -f src/cli/index.ts
176
+
177
+ # 包含传递依赖
178
+ mycodemap impact -f src/cli/index.ts --transitive
179
+ ```
180
+
181
+ ### 统一分析(analyze)
182
+
183
+ ```bash
184
+ # 影响分析
185
+ mycodemap analyze -i impact -t src/cli/index.ts
186
+ mycodemap analyze -i impact -t src/cli/index.ts --scope transitive --include-tests
187
+
188
+ # 依赖分析
189
+ mycodemap analyze -i dependency -t src/orchestrator
190
+
191
+ # 复杂度分析
192
+ mycodemap analyze -i complexity -t src/domain
193
+
194
+ # 搜索分析
195
+ mycodemap analyze -i search -k "UnifiedResult" --topK 10
196
+
197
+ # 项目概览
198
+ mycodemap analyze -i overview -t src/
199
+
200
+ # JSON 输出
201
+ mycodemap analyze -i impact -t src/index.ts --json
202
+ ```
203
+
204
+ ### 工作流编排(workflow)
205
+
206
+ ```bash
207
+ # 启动工作流
208
+ mycodemap workflow start "实现用户认证模块"
209
+ mycodemap workflow start "修复登录接口 500" --template bugfix
210
+
211
+ # 查看当前状态
212
+ mycodemap workflow status
213
+
214
+ # 可视化工作流
215
+ mycodemap workflow visualize
216
+
217
+ # 推进到下一阶段
218
+ mycodemap workflow proceed
219
+
220
+ # 列出所有工作流
221
+ mycodemap workflow list
222
+ ```
223
+
224
+ ### CI 门禁(ci)
225
+
226
+ ```bash
227
+ # 检查提交格式
228
+ mycodemap ci check-commits
229
+ mycodemap ci check-commits -c 5
230
+
231
+ # 检查文件头注释
232
+ mycodemap ci check-headers
233
+ mycodemap ci check-headers -d src/domain
234
+
235
+ # 评估变更风险
236
+ mycodemap ci assess-risk
237
+ mycodemap ci assess-risk -t 0.5
238
+
239
+ # 验证输出契约
240
+ mycodemap ci check-output-contract
241
+
242
+ # 检查提交文件数量
243
+ mycodemap ci check-commit-size
244
+ ```
245
+
246
+ ### 监听模式
247
+
248
+ ```bash
249
+ # 前台监听
250
+ mycodemap watch
251
+
252
+ # 后台守护进程
253
+ mycodemap watch -d
254
+
255
+ # 查看状态
256
+ mycodemap watch -t
257
+
258
+ # 停止守护进程
259
+ mycodemap watch -s
260
+ ```
261
+
262
+ ---
263
+
264
+ ## AI 助手集成
265
+
266
+ MyCodeMap 可以与多种 AI 编程助手集成,提升代码理解效率。
267
+
268
+ ### 支持的 AI 助手
269
+
270
+ | AI 助手 | 配置方式 | 详细文档 |
271
+ |---------|----------|----------|
272
+ | Kimi CLI | Skill 配置 | [AI_ASSISTANT_SETUP.md](./AI_ASSISTANT_SETUP.md#kimi-cli) |
273
+ | Claude Code | Skill 配置 | [AI_ASSISTANT_SETUP.md](./AI_ASSISTANT_SETUP.md#claude-code) |
274
+ | Codex CLI | Agent 配置 | [AI_ASSISTANT_SETUP.md](./AI_ASSISTANT_SETUP.md#codex-cli) |
275
+ | GitHub Copilot | 提示词模板 | [AI_ASSISTANT_SETUP.md](./AI_ASSISTANT_SETUP.md#github-copilot) |
276
+
277
+ ### 快速配置
278
+
279
+ #### Kimi CLI
280
+
281
+ ```bash
282
+ # 复制示例配置到项目
283
+ cp node_modules/@mycodemap/mycodemap/examples/kimi/codemap-skill.md .kimi/skills/codemap/SKILL.md
284
+ ```
285
+
286
+ #### Claude Code
287
+
288
+ ```bash
289
+ # 复制示例配置
290
+ cp node_modules/@mycodemap/mycodemap/examples/claude/codemap-skill.md .claude/skills/codemap/SKILL.md
291
+ ```
292
+
293
+ #### Codex CLI
294
+
295
+ ```bash
296
+ # 复制示例配置
297
+ cp node_modules/@mycodemap/mycodemap/examples/codex/codemap-agent.md .agents/skills/codemap/SKILL.md
298
+ ```
299
+
300
+ 详细配置步骤请参考 [AI_ASSISTANT_SETUP.md](./AI_ASSISTANT_SETUP.md)。
301
+
302
+ ---
303
+
304
+ ## CI/CD 集成
305
+
306
+ ### Git Hooks(本地门禁)
307
+
308
+ #### 自动安装
309
+
310
+ ```bash
311
+ # 安装 Git hooks
312
+ npm run postinstall # 如果 package.json 中配置了
313
+
314
+ # 或手动安装
315
+ sh scripts/hooks/install-hooks.sh
316
+ ```
317
+
318
+ #### 手动配置
319
+
320
+ 如果项目没有提供 hooks 安装脚本,可以手动配置:
321
+
322
+ ```bash
323
+ # 创建 .githooks 目录
324
+ mkdir -p .githooks
325
+
326
+ # 创建 pre-commit hook
327
+ cat > .githooks/pre-commit << 'EOF'
328
+ #!/bin/sh
329
+ # MyCodeMap pre-commit check
330
+
331
+ if ! command -v mycodemap &> /dev/null; then
332
+ exit 0
333
+ fi
334
+
335
+ # 可选:运行测试
336
+ # npm test
337
+
338
+ # 可选:当改动 README / docs / CLI 示例时检查文档护栏
339
+ # npm run docs:check
340
+
341
+ # 可选:检查文件头
342
+ # mycodemap ci check-headers
343
+
344
+ exit 0
345
+ EOF
346
+
347
+ chmod +x .githooks/pre-commit
348
+
349
+ # 配置 git 使用自定义 hooks 目录
350
+ git config core.hookspath .githooks
351
+ ```
352
+
353
+ ### GitHub Actions
354
+
355
+ 创建 `.github/workflows/codemap.yml`:
356
+
357
+ ```yaml
358
+ name: CodeMap CI
359
+
360
+ on: [push, pull_request]
361
+
362
+ jobs:
363
+ codemap:
364
+ runs-on: ubuntu-latest
365
+ steps:
366
+ - uses: actions/checkout@v4
367
+
368
+ - name: Setup Node.js
369
+ uses: actions/setup-node@v4
370
+ with:
371
+ node-version: '20'
372
+
373
+ - name: Install dependencies
374
+ run: npm ci
375
+
376
+ - name: Validate docs sync
377
+ run: npm run docs:check
378
+
379
+ - name: Run typecheck
380
+ run: npm run typecheck
381
+
382
+ - name: Run tests
383
+ run: npm test
384
+
385
+ - name: Check commits
386
+ run: npx mycodemap ci check-commits --range origin/main..HEAD
387
+
388
+ - name: Check docs sync via CLI
389
+ run: npx mycodemap ci check-docs-sync
390
+
391
+ - name: Check commit size
392
+ run: npx mycodemap ci check-commit-size --range origin/main..HEAD
393
+
394
+ - name: Check headers
395
+ run: npx mycodemap ci check-headers
396
+
397
+ - name: Assess risk
398
+ run: npx mycodemap ci assess-risk --threshold=0.7
399
+
400
+ - name: Generate AI feed
401
+ run: npx mycodemap generate
402
+
403
+ - name: Check AI feed sync
404
+ run: git diff --exit-code .mycodemap/ai-feed.txt
405
+
406
+ - name: Check output contract
407
+ run: npx mycodemap ci check-output-contract --schema-version v1.0.0 --top-k 8 --max-tokens 160
408
+ ```
409
+
410
+ ### 其他 CI 平台
411
+
412
+ 参考 [CI_GATEWAY_DESIGN.md](./design-docs/CI_GATEWAY_DESIGN.md) 了解所有检查项。
413
+
414
+ ---
415
+
416
+ ## 故障排除
417
+
418
+ ### 常见问题
419
+
420
+ #### 1. 命令未找到
421
+
422
+ ```bash
423
+ # 检查是否安装
424
+ which mycodemap
425
+
426
+ # 全局安装后可能需要刷新 shell hash
427
+ hash -r
428
+
429
+ # 或使用 npx
430
+ npx mycodemap --help
431
+ ```
432
+
433
+ #### 2. 配置文件未找到
434
+
435
+ ```bash
436
+ # 确认配置文件存在
437
+ ls mycodemap.config.json
438
+
439
+ # 重新初始化
440
+ mycodemap init -y
441
+ ```
442
+
443
+ #### 3. 权限问题
444
+
445
+ ```bash
446
+ # 检查文件权限
447
+ ls -la .mycodemap/
448
+
449
+ # 修复权限
450
+ chmod -R u+rw .mycodemap/
451
+ ```
452
+
453
+ #### 4. tree-sitter 构建失败
454
+
455
+ 某些环境可能需要安装构建工具:
456
+
457
+ ```bash
458
+ # Ubuntu/Debian
459
+ sudo apt-get install build-essential
460
+
461
+ # macOS
462
+ xcode-select --install
463
+ ```
464
+
465
+ ### 获取帮助
466
+
467
+ ```bash
468
+ # 查看帮助
469
+ mycodemap --help
470
+
471
+ # 查看子命令帮助
472
+ mycodemap generate --help
473
+
474
+ # 查看版本
475
+ mycodemap --version
476
+ ```
477
+
478
+ ### 日志与调试
479
+
480
+ CLI 运行日志默认写入 `.mycodemap/logs/mycodemap-YYYY-MM-DD.log`
481
+
482
+ 环境变量:
483
+ - `CODEMAP_RUNTIME_LOG_ENABLED=false`:关闭运行日志
484
+ - `CODEMAP_RUNTIME_LOG_DIR=<dir>`:自定义日志目录
485
+ - `CODEMAP_RUNTIME_LOG_RETENTION_DAYS=<days>`:设置保留天数
486
+
487
+ ---
488
+
489
+ ## 下一步
490
+
491
+ - 了解 [AI 助手配置](./AI_ASSISTANT_SETUP.md)
492
+ - 查看 [CLI 完整命令参考](../README.md#cli-命令)
493
+ - 阅读 [架构设计文档](./design-docs/REFACTOR_ARCHITECTURE_OVERVIEW.md)