@mycodemap/mycodemap 1.9.0 → 2.7.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 (527) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +63 -978
  3. package/README.zh-CN.md +1096 -0
  4. package/dist/cli/commands/agent-metrics/human.d.ts +4 -0
  5. package/dist/cli/commands/agent-metrics/human.d.ts.map +1 -0
  6. package/dist/cli/commands/agent-metrics/human.js +134 -0
  7. package/dist/cli/commands/agent-metrics/human.js.map +1 -0
  8. package/dist/cli/commands/agent-metrics/index.d.ts +15 -0
  9. package/dist/cli/commands/agent-metrics/index.d.ts.map +1 -0
  10. package/dist/cli/commands/agent-metrics/index.js +116 -0
  11. package/dist/cli/commands/agent-metrics/index.js.map +1 -0
  12. package/dist/cli/commands/analyze-options.d.ts.map +1 -1
  13. package/dist/cli/commands/analyze-options.js +8 -0
  14. package/dist/cli/commands/analyze-options.js.map +1 -1
  15. package/dist/cli/commands/analyze.d.ts +3 -196
  16. package/dist/cli/commands/analyze.d.ts.map +1 -1
  17. package/dist/cli/commands/analyze.js +27 -1162
  18. package/dist/cli/commands/analyze.js.map +1 -1
  19. package/dist/cli/commands/benchmark.d.ts +8 -0
  20. package/dist/cli/commands/benchmark.d.ts.map +1 -0
  21. package/dist/cli/commands/benchmark.js +153 -0
  22. package/dist/cli/commands/benchmark.js.map +1 -0
  23. package/dist/cli/commands/complexity.d.ts.map +1 -1
  24. package/dist/cli/commands/complexity.js +62 -95
  25. package/dist/cli/commands/complexity.js.map +1 -1
  26. package/dist/cli/commands/deps.d.ts +3 -59
  27. package/dist/cli/commands/deps.d.ts.map +1 -1
  28. package/dist/cli/commands/deps.js +25 -331
  29. package/dist/cli/commands/deps.js.map +1 -1
  30. package/dist/cli/commands/doctor.d.ts +3 -0
  31. package/dist/cli/commands/doctor.d.ts.map +1 -0
  32. package/dist/cli/commands/doctor.js +34 -0
  33. package/dist/cli/commands/doctor.js.map +1 -0
  34. package/dist/cli/commands/env-contract.d.ts +3 -0
  35. package/dist/cli/commands/env-contract.d.ts.map +1 -0
  36. package/dist/cli/commands/env-contract.js +221 -0
  37. package/dist/cli/commands/env-contract.js.map +1 -0
  38. package/dist/cli/commands/generate.d.ts +19 -1
  39. package/dist/cli/commands/generate.d.ts.map +1 -1
  40. package/dist/cli/commands/generate.js +735 -89
  41. package/dist/cli/commands/generate.js.map +1 -1
  42. package/dist/cli/commands/impact.d.ts +4 -38
  43. package/dist/cli/commands/impact.d.ts.map +1 -1
  44. package/dist/cli/commands/impact.js +133 -375
  45. package/dist/cli/commands/impact.js.map +1 -1
  46. package/dist/cli/commands/init.d.ts +1 -0
  47. package/dist/cli/commands/init.d.ts.map +1 -1
  48. package/dist/cli/commands/init.js +61 -2
  49. package/dist/cli/commands/init.js.map +1 -1
  50. package/dist/cli/commands/preview.d.ts +3 -0
  51. package/dist/cli/commands/preview.d.ts.map +1 -0
  52. package/dist/cli/commands/preview.js +216 -0
  53. package/dist/cli/commands/preview.js.map +1 -0
  54. package/dist/cli/commands/query.d.ts +2 -20
  55. package/dist/cli/commands/query.d.ts.map +1 -1
  56. package/dist/cli/commands/query.js +23 -708
  57. package/dist/cli/commands/query.js.map +1 -1
  58. package/dist/cli/commands/watch-foreground.d.ts.map +1 -1
  59. package/dist/cli/commands/watch-foreground.js +5 -1
  60. package/dist/cli/commands/watch-foreground.js.map +1 -1
  61. package/dist/cli/config-loader.d.ts.map +1 -1
  62. package/dist/cli/config-loader.js +51 -13
  63. package/dist/cli/config-loader.js.map +1 -1
  64. package/dist/cli/doctor/check-agent.d.ts +3 -0
  65. package/dist/cli/doctor/check-agent.d.ts.map +1 -0
  66. package/dist/cli/doctor/check-agent.js +60 -0
  67. package/dist/cli/doctor/check-agent.js.map +1 -0
  68. package/dist/cli/doctor/check-env-contract.d.ts +3 -0
  69. package/dist/cli/doctor/check-env-contract.d.ts.map +1 -0
  70. package/dist/cli/doctor/check-env-contract.js +96 -0
  71. package/dist/cli/doctor/check-env-contract.js.map +1 -0
  72. package/dist/cli/doctor/check-ghost-commands.d.ts +3 -0
  73. package/dist/cli/doctor/check-ghost-commands.d.ts.map +1 -0
  74. package/dist/cli/doctor/check-ghost-commands.js +86 -0
  75. package/dist/cli/doctor/check-ghost-commands.js.map +1 -0
  76. package/dist/cli/doctor/check-native-deps.d.ts +3 -0
  77. package/dist/cli/doctor/check-native-deps.d.ts.map +1 -0
  78. package/dist/cli/doctor/check-native-deps.js +70 -0
  79. package/dist/cli/doctor/check-native-deps.js.map +1 -0
  80. package/dist/cli/doctor/check-workspace-drift.d.ts +3 -0
  81. package/dist/cli/doctor/check-workspace-drift.d.ts.map +1 -0
  82. package/dist/cli/doctor/check-workspace-drift.js +83 -0
  83. package/dist/cli/doctor/check-workspace-drift.js.map +1 -0
  84. package/dist/cli/doctor/formatter.d.ts +20 -0
  85. package/dist/cli/doctor/formatter.d.ts.map +1 -0
  86. package/dist/cli/doctor/formatter.js +91 -0
  87. package/dist/cli/doctor/formatter.js.map +1 -0
  88. package/dist/cli/doctor/index.d.ts +8 -0
  89. package/dist/cli/doctor/index.d.ts.map +1 -0
  90. package/dist/cli/doctor/index.js +9 -0
  91. package/dist/cli/doctor/index.js.map +1 -0
  92. package/dist/cli/doctor/orchestrator.d.ts +3 -0
  93. package/dist/cli/doctor/orchestrator.d.ts.map +1 -0
  94. package/dist/cli/doctor/orchestrator.js +40 -0
  95. package/dist/cli/doctor/orchestrator.js.map +1 -0
  96. package/dist/cli/doctor/types.d.ts +19 -0
  97. package/dist/cli/doctor/types.d.ts.map +1 -0
  98. package/dist/cli/doctor/types.js +4 -0
  99. package/dist/cli/doctor/types.js.map +1 -0
  100. package/dist/cli/env-contract/check.d.ts +18 -0
  101. package/dist/cli/env-contract/check.d.ts.map +1 -0
  102. package/dist/cli/env-contract/check.js +118 -0
  103. package/dist/cli/env-contract/check.js.map +1 -0
  104. package/dist/cli/env-contract/discovery.d.ts +12 -0
  105. package/dist/cli/env-contract/discovery.d.ts.map +1 -0
  106. package/dist/cli/env-contract/discovery.js +249 -0
  107. package/dist/cli/env-contract/discovery.js.map +1 -0
  108. package/dist/cli/env-contract/filters.d.ts +10 -0
  109. package/dist/cli/env-contract/filters.d.ts.map +1 -0
  110. package/dist/cli/env-contract/filters.js +23 -0
  111. package/dist/cli/env-contract/filters.js.map +1 -0
  112. package/dist/cli/env-contract/index.d.ts +6 -0
  113. package/dist/cli/env-contract/index.d.ts.map +1 -0
  114. package/dist/cli/env-contract/index.js +8 -0
  115. package/dist/cli/env-contract/index.js.map +1 -0
  116. package/dist/cli/env-contract/reminder-engine.d.ts +34 -0
  117. package/dist/cli/env-contract/reminder-engine.d.ts.map +1 -0
  118. package/dist/cli/env-contract/reminder-engine.js +51 -0
  119. package/dist/cli/env-contract/reminder-engine.js.map +1 -0
  120. package/dist/cli/env-contract/reminder-hook-runner.d.ts +45 -0
  121. package/dist/cli/env-contract/reminder-hook-runner.d.ts.map +1 -0
  122. package/dist/cli/env-contract/reminder-hook-runner.js +273 -0
  123. package/dist/cli/env-contract/reminder-hook-runner.js.map +1 -0
  124. package/dist/cli/env-contract/reminder-ledger.d.ts +11 -0
  125. package/dist/cli/env-contract/reminder-ledger.d.ts.map +1 -0
  126. package/dist/cli/env-contract/reminder-ledger.js +37 -0
  127. package/dist/cli/env-contract/reminder-ledger.js.map +1 -0
  128. package/dist/cli/env-contract/types.d.ts +48 -0
  129. package/dist/cli/env-contract/types.d.ts.map +1 -0
  130. package/dist/cli/env-contract/types.js +22 -0
  131. package/dist/cli/env-contract/types.js.map +1 -0
  132. package/dist/cli/env-contract/validation.d.ts +10 -0
  133. package/dist/cli/env-contract/validation.d.ts.map +1 -0
  134. package/dist/cli/env-contract/validation.js +116 -0
  135. package/dist/cli/env-contract/validation.js.map +1 -0
  136. package/dist/cli/first-run-guide.d.ts.map +1 -1
  137. package/dist/cli/first-run-guide.js +8 -3
  138. package/dist/cli/first-run-guide.js.map +1 -1
  139. package/dist/cli/index.js +94 -22
  140. package/dist/cli/index.js.map +1 -1
  141. package/dist/cli/init/assistant-plan.d.ts +14 -0
  142. package/dist/cli/init/assistant-plan.d.ts.map +1 -0
  143. package/dist/cli/init/assistant-plan.js +208 -0
  144. package/dist/cli/init/assistant-plan.js.map +1 -0
  145. package/dist/cli/init/detect.d.ts +28 -0
  146. package/dist/cli/init/detect.d.ts.map +1 -0
  147. package/dist/cli/init/detect.js +63 -0
  148. package/dist/cli/init/detect.js.map +1 -0
  149. package/dist/cli/init/env-contract-plan.d.ts +28 -0
  150. package/dist/cli/init/env-contract-plan.d.ts.map +1 -0
  151. package/dist/cli/init/env-contract-plan.js +184 -0
  152. package/dist/cli/init/env-contract-plan.js.map +1 -0
  153. package/dist/cli/init/manifest-extractors.d.ts +22 -0
  154. package/dist/cli/init/manifest-extractors.d.ts.map +1 -0
  155. package/dist/cli/init/manifest-extractors.js +185 -0
  156. package/dist/cli/init/manifest-extractors.js.map +1 -0
  157. package/dist/cli/init/profile-loader.d.ts +49 -0
  158. package/dist/cli/init/profile-loader.d.ts.map +1 -0
  159. package/dist/cli/init/profile-loader.js +107 -0
  160. package/dist/cli/init/profile-loader.js.map +1 -0
  161. package/dist/cli/init/profile-plan.d.ts +38 -0
  162. package/dist/cli/init/profile-plan.d.ts.map +1 -0
  163. package/dist/cli/init/profile-plan.js +120 -0
  164. package/dist/cli/init/profile-plan.js.map +1 -0
  165. package/dist/cli/init/profiles/generic.json +16 -0
  166. package/dist/cli/init/profiles/go.json +12 -0
  167. package/dist/cli/init/profiles/nodejs.json +16 -0
  168. package/dist/cli/init/profiles/python.json +17 -0
  169. package/dist/cli/init/profiles/rust.json +12 -0
  170. package/dist/cli/init/receipt.d.ts.map +1 -1
  171. package/dist/cli/init/receipt.js +107 -7
  172. package/dist/cli/init/receipt.js.map +1 -1
  173. package/dist/cli/init/reconciler.d.ts +10 -1
  174. package/dist/cli/init/reconciler.d.ts.map +1 -1
  175. package/dist/cli/init/reconciler.js +85 -15
  176. package/dist/cli/init/reconciler.js.map +1 -1
  177. package/dist/cli/interface-contract/commands/agent-metrics.d.ts +3 -0
  178. package/dist/cli/interface-contract/commands/agent-metrics.d.ts.map +1 -0
  179. package/dist/cli/interface-contract/commands/agent-metrics.js +217 -0
  180. package/dist/cli/interface-contract/commands/agent-metrics.js.map +1 -0
  181. package/dist/cli/interface-contract/commands/analyze.d.ts +3 -0
  182. package/dist/cli/interface-contract/commands/analyze.d.ts.map +1 -0
  183. package/dist/cli/interface-contract/commands/analyze.js +139 -0
  184. package/dist/cli/interface-contract/commands/analyze.js.map +1 -0
  185. package/dist/cli/interface-contract/commands/benchmark.d.ts +3 -0
  186. package/dist/cli/interface-contract/commands/benchmark.d.ts.map +1 -0
  187. package/dist/cli/interface-contract/commands/benchmark.js +108 -0
  188. package/dist/cli/interface-contract/commands/benchmark.js.map +1 -0
  189. package/dist/cli/interface-contract/commands/deps.d.ts +3 -0
  190. package/dist/cli/interface-contract/commands/deps.d.ts.map +1 -0
  191. package/dist/cli/interface-contract/commands/deps.js +130 -0
  192. package/dist/cli/interface-contract/commands/deps.js.map +1 -0
  193. package/dist/cli/interface-contract/commands/doctor.d.ts +3 -0
  194. package/dist/cli/interface-contract/commands/doctor.d.ts.map +1 -0
  195. package/dist/cli/interface-contract/commands/doctor.js +60 -0
  196. package/dist/cli/interface-contract/commands/doctor.js.map +1 -0
  197. package/dist/cli/interface-contract/commands/env-contract.d.ts +3 -0
  198. package/dist/cli/interface-contract/commands/env-contract.d.ts.map +1 -0
  199. package/dist/cli/interface-contract/commands/env-contract.js +168 -0
  200. package/dist/cli/interface-contract/commands/env-contract.js.map +1 -0
  201. package/dist/cli/interface-contract/commands/index.d.ts +12 -0
  202. package/dist/cli/interface-contract/commands/index.d.ts.map +1 -0
  203. package/dist/cli/interface-contract/commands/index.js +24 -0
  204. package/dist/cli/interface-contract/commands/index.js.map +1 -0
  205. package/dist/cli/interface-contract/commands/init.d.ts +3 -0
  206. package/dist/cli/interface-contract/commands/init.d.ts.map +1 -0
  207. package/dist/cli/interface-contract/commands/init.js +96 -0
  208. package/dist/cli/interface-contract/commands/init.js.map +1 -0
  209. package/dist/cli/interface-contract/commands/preview.d.ts +3 -0
  210. package/dist/cli/interface-contract/commands/preview.d.ts.map +1 -0
  211. package/dist/cli/interface-contract/commands/preview.js +118 -0
  212. package/dist/cli/interface-contract/commands/preview.js.map +1 -0
  213. package/dist/cli/interface-contract/commands/query.d.ts +3 -0
  214. package/dist/cli/interface-contract/commands/query.d.ts.map +1 -0
  215. package/dist/cli/interface-contract/commands/query.js +186 -0
  216. package/dist/cli/interface-contract/commands/query.js.map +1 -0
  217. package/dist/cli/interface-contract/index.d.ts +22 -0
  218. package/dist/cli/interface-contract/index.d.ts.map +1 -0
  219. package/dist/cli/interface-contract/index.js +41 -0
  220. package/dist/cli/interface-contract/index.js.map +1 -0
  221. package/dist/cli/interface-contract/schema.d.ts +30 -0
  222. package/dist/cli/interface-contract/schema.d.ts.map +1 -0
  223. package/dist/cli/interface-contract/schema.js +73 -0
  224. package/dist/cli/interface-contract/schema.js.map +1 -0
  225. package/dist/cli/interface-contract/types.d.ts +77 -0
  226. package/dist/cli/interface-contract/types.d.ts.map +1 -0
  227. package/dist/cli/interface-contract/types.js +4 -0
  228. package/dist/cli/interface-contract/types.js.map +1 -0
  229. package/dist/cli/output/apply-suggestion.d.ts +12 -0
  230. package/dist/cli/output/apply-suggestion.d.ts.map +1 -0
  231. package/dist/cli/output/apply-suggestion.js +29 -0
  232. package/dist/cli/output/apply-suggestion.js.map +1 -0
  233. package/dist/cli/output/error-codes.d.ts +24 -0
  234. package/dist/cli/output/error-codes.d.ts.map +1 -0
  235. package/dist/cli/output/error-codes.js +94 -0
  236. package/dist/cli/output/error-codes.js.map +1 -0
  237. package/dist/cli/output/errors.d.ts +14 -0
  238. package/dist/cli/output/errors.d.ts.map +1 -0
  239. package/dist/cli/output/errors.js +182 -0
  240. package/dist/cli/output/errors.js.map +1 -0
  241. package/dist/cli/output/index.d.ts +13 -0
  242. package/dist/cli/output/index.d.ts.map +1 -0
  243. package/dist/cli/output/index.js +11 -0
  244. package/dist/cli/output/index.js.map +1 -0
  245. package/dist/cli/output/mode.d.ts +12 -0
  246. package/dist/cli/output/mode.d.ts.map +1 -0
  247. package/dist/cli/output/mode.js +23 -0
  248. package/dist/cli/output/mode.js.map +1 -0
  249. package/dist/cli/output/progress.d.ts +9 -0
  250. package/dist/cli/output/progress.d.ts.map +1 -0
  251. package/dist/cli/output/progress.js +65 -0
  252. package/dist/cli/output/progress.js.map +1 -0
  253. package/dist/cli/output/render.d.ts +11 -0
  254. package/dist/cli/output/render.d.ts.map +1 -0
  255. package/dist/cli/output/render.js +18 -0
  256. package/dist/cli/output/render.js.map +1 -0
  257. package/dist/cli/output/types.d.ts +53 -0
  258. package/dist/cli/output/types.d.ts.map +1 -0
  259. package/dist/cli/output/types.js +14 -0
  260. package/dist/cli/output/types.js.map +1 -0
  261. package/dist/cli/output/wasm-fallback.d.ts +14 -0
  262. package/dist/cli/output/wasm-fallback.d.ts.map +1 -0
  263. package/dist/cli/output/wasm-fallback.js +92 -0
  264. package/dist/cli/output/wasm-fallback.js.map +1 -0
  265. package/dist/cli/preview/complexity-scanner.d.ts +21 -0
  266. package/dist/cli/preview/complexity-scanner.d.ts.map +1 -0
  267. package/dist/cli/preview/complexity-scanner.js +52 -0
  268. package/dist/cli/preview/complexity-scanner.js.map +1 -0
  269. package/dist/cli/preview/dependency-extractor.d.ts +38 -0
  270. package/dist/cli/preview/dependency-extractor.d.ts.map +1 -0
  271. package/dist/cli/preview/dependency-extractor.js +140 -0
  272. package/dist/cli/preview/dependency-extractor.js.map +1 -0
  273. package/dist/cli/preview/preview-renderer.d.ts +32 -0
  274. package/dist/cli/preview/preview-renderer.d.ts.map +1 -0
  275. package/dist/cli/preview/preview-renderer.js +54 -0
  276. package/dist/cli/preview/preview-renderer.js.map +1 -0
  277. package/dist/cli/storage-runtime.d.ts +7 -0
  278. package/dist/cli/storage-runtime.d.ts.map +1 -1
  279. package/dist/cli/storage-runtime.js +22 -0
  280. package/dist/cli/storage-runtime.js.map +1 -1
  281. package/dist/cli/tree-sitter-check.d.ts +6 -1
  282. package/dist/cli/tree-sitter-check.d.ts.map +1 -1
  283. package/dist/cli/tree-sitter-check.js +23 -1
  284. package/dist/cli/tree-sitter-check.js.map +1 -1
  285. package/dist/cli-new/index.js +1 -1
  286. package/dist/cli-new/index.js.map +1 -1
  287. package/dist/composition/parser-composition.d.ts +7 -0
  288. package/dist/composition/parser-composition.d.ts.map +1 -0
  289. package/dist/composition/parser-composition.js +15 -0
  290. package/dist/composition/parser-composition.js.map +1 -0
  291. package/dist/core/analyzer.d.ts.map +1 -1
  292. package/dist/core/analyzer.js +83 -67
  293. package/dist/core/analyzer.js.map +1 -1
  294. package/dist/core/ast-complexity-analyzer.d.ts +12 -6
  295. package/dist/core/ast-complexity-analyzer.d.ts.map +1 -1
  296. package/dist/core/ast-complexity-analyzer.js +368 -209
  297. package/dist/core/ast-complexity-analyzer.js.map +1 -1
  298. package/dist/core/file-discovery.d.ts +1 -1
  299. package/dist/core/file-discovery.d.ts.map +1 -1
  300. package/dist/core/file-discovery.js +3 -0
  301. package/dist/core/file-discovery.js.map +1 -1
  302. package/dist/core/global-index.d.ts +3 -1
  303. package/dist/core/global-index.d.ts.map +1 -1
  304. package/dist/core/global-index.js +69 -4
  305. package/dist/core/global-index.js.map +1 -1
  306. package/dist/domain/entities/CodeGraph.d.ts +3 -0
  307. package/dist/domain/entities/CodeGraph.d.ts.map +1 -1
  308. package/dist/domain/entities/CodeGraph.js +19 -2
  309. package/dist/domain/entities/CodeGraph.js.map +1 -1
  310. package/dist/domain/entities/Dependency.d.ts +5 -2
  311. package/dist/domain/entities/Dependency.d.ts.map +1 -1
  312. package/dist/domain/entities/Dependency.js +49 -3
  313. package/dist/domain/entities/Dependency.js.map +1 -1
  314. package/dist/domain/repositories/CodeGraphRepository.d.ts +5 -0
  315. package/dist/domain/repositories/CodeGraphRepository.d.ts.map +1 -1
  316. package/dist/domain/repositories/CodeGraphRepository.js.map +1 -1
  317. package/dist/execution/contract-tools/analyze.d.ts +205 -0
  318. package/dist/execution/contract-tools/analyze.d.ts.map +1 -0
  319. package/dist/execution/contract-tools/analyze.js +1215 -0
  320. package/dist/execution/contract-tools/analyze.js.map +1 -0
  321. package/dist/execution/contract-tools/deps.d.ts +62 -0
  322. package/dist/execution/contract-tools/deps.d.ts.map +1 -0
  323. package/dist/execution/contract-tools/deps.js +234 -0
  324. package/dist/execution/contract-tools/deps.js.map +1 -0
  325. package/dist/execution/contract-tools/index.d.ts +5 -0
  326. package/dist/execution/contract-tools/index.d.ts.map +1 -0
  327. package/dist/execution/contract-tools/index.js +7 -0
  328. package/dist/execution/contract-tools/index.js.map +1 -0
  329. package/dist/execution/contract-tools/query.d.ts +60 -0
  330. package/dist/execution/contract-tools/query.d.ts.map +1 -0
  331. package/dist/execution/contract-tools/query.js +532 -0
  332. package/dist/execution/contract-tools/query.js.map +1 -0
  333. package/dist/execution/contract-tools/types.d.ts +26 -0
  334. package/dist/execution/contract-tools/types.d.ts.map +1 -0
  335. package/dist/execution/contract-tools/types.js +32 -0
  336. package/dist/execution/contract-tools/types.js.map +1 -0
  337. package/dist/generator/index.d.ts.map +1 -1
  338. package/dist/generator/index.js +0 -3
  339. package/dist/generator/index.js.map +1 -1
  340. package/dist/infrastructure/parser/enhancers/TypeScriptTypeEnhancer.d.ts +12 -0
  341. package/dist/infrastructure/parser/enhancers/TypeScriptTypeEnhancer.d.ts.map +1 -0
  342. package/dist/infrastructure/parser/enhancers/TypeScriptTypeEnhancer.js +55 -0
  343. package/dist/infrastructure/parser/enhancers/TypeScriptTypeEnhancer.js.map +1 -0
  344. package/dist/infrastructure/parser/implementations/GoParser.d.ts +2 -1
  345. package/dist/infrastructure/parser/implementations/GoParser.d.ts.map +1 -1
  346. package/dist/infrastructure/parser/implementations/GoParser.js +13 -1
  347. package/dist/infrastructure/parser/implementations/GoParser.js.map +1 -1
  348. package/dist/infrastructure/parser/implementations/PythonTreeSitterParser.d.ts +114 -0
  349. package/dist/infrastructure/parser/implementations/PythonTreeSitterParser.d.ts.map +1 -0
  350. package/dist/infrastructure/parser/implementations/PythonTreeSitterParser.js +1022 -0
  351. package/dist/infrastructure/parser/implementations/PythonTreeSitterParser.js.map +1 -0
  352. package/dist/infrastructure/parser/implementations/TreeSitterParser.d.ts +78 -0
  353. package/dist/infrastructure/parser/implementations/TreeSitterParser.d.ts.map +1 -0
  354. package/dist/infrastructure/parser/implementations/TreeSitterParser.js +648 -0
  355. package/dist/infrastructure/parser/implementations/TreeSitterParser.js.map +1 -0
  356. package/dist/infrastructure/parser/implementations/TypeScriptParser.d.ts +3 -55
  357. package/dist/infrastructure/parser/implementations/TypeScriptParser.d.ts.map +1 -1
  358. package/dist/infrastructure/parser/implementations/TypeScriptParser.js +4 -411
  359. package/dist/infrastructure/parser/implementations/TypeScriptParser.js.map +1 -1
  360. package/dist/infrastructure/parser/index.d.ts +2 -0
  361. package/dist/infrastructure/parser/index.d.ts.map +1 -1
  362. package/dist/infrastructure/parser/index.js +9 -6
  363. package/dist/infrastructure/parser/index.js.map +1 -1
  364. package/dist/infrastructure/parser/interfaces/ParserBase.d.ts.map +1 -1
  365. package/dist/infrastructure/parser/interfaces/ParserBase.js +1 -0
  366. package/dist/infrastructure/parser/interfaces/ParserBase.js.map +1 -1
  367. package/dist/infrastructure/repositories/CodeGraphRepositoryImpl.d.ts +2 -0
  368. package/dist/infrastructure/repositories/CodeGraphRepositoryImpl.d.ts.map +1 -1
  369. package/dist/infrastructure/repositories/CodeGraphRepositoryImpl.js +4 -0
  370. package/dist/infrastructure/repositories/CodeGraphRepositoryImpl.js.map +1 -1
  371. package/dist/infrastructure/storage/StorageFactory.d.ts +5 -18
  372. package/dist/infrastructure/storage/StorageFactory.d.ts.map +1 -1
  373. package/dist/infrastructure/storage/StorageFactory.js +30 -98
  374. package/dist/infrastructure/storage/StorageFactory.js.map +1 -1
  375. package/dist/infrastructure/storage/adapters/SQLiteStorage.d.ts +13 -1
  376. package/dist/infrastructure/storage/adapters/SQLiteStorage.d.ts.map +1 -1
  377. package/dist/infrastructure/storage/adapters/SQLiteStorage.js +322 -76
  378. package/dist/infrastructure/storage/adapters/SQLiteStorage.js.map +1 -1
  379. package/dist/infrastructure/storage/adapters/sqlite-loader.d.ts +45 -0
  380. package/dist/infrastructure/storage/adapters/sqlite-loader.d.ts.map +1 -0
  381. package/dist/infrastructure/storage/adapters/sqlite-loader.js +266 -0
  382. package/dist/infrastructure/storage/adapters/sqlite-loader.js.map +1 -0
  383. package/dist/infrastructure/storage/community-helpers.d.ts +4 -0
  384. package/dist/infrastructure/storage/community-helpers.d.ts.map +1 -0
  385. package/dist/infrastructure/storage/community-helpers.js +392 -0
  386. package/dist/infrastructure/storage/community-helpers.js.map +1 -0
  387. package/dist/infrastructure/storage/graph-helpers.d.ts +22 -5
  388. package/dist/infrastructure/storage/graph-helpers.d.ts.map +1 -1
  389. package/dist/infrastructure/storage/graph-helpers.js +496 -91
  390. package/dist/infrastructure/storage/graph-helpers.js.map +1 -1
  391. package/dist/infrastructure/storage/index.d.ts +1 -1
  392. package/dist/infrastructure/storage/index.d.ts.map +1 -1
  393. package/dist/infrastructure/storage/index.js +1 -1
  394. package/dist/infrastructure/storage/index.js.map +1 -1
  395. package/dist/infrastructure/storage/interfaces/StorageBase.d.ts +2 -2
  396. package/dist/infrastructure/storage/interfaces/StorageBase.d.ts.map +1 -1
  397. package/dist/infrastructure/storage/interfaces/StorageBase.js.map +1 -1
  398. package/dist/infrastructure/storage/sqlite/GovernanceGraphCache.d.ts +2 -0
  399. package/dist/infrastructure/storage/sqlite/GovernanceGraphCache.d.ts.map +1 -1
  400. package/dist/infrastructure/storage/sqlite/GovernanceGraphCache.js +52 -12
  401. package/dist/infrastructure/storage/sqlite/GovernanceGraphCache.js.map +1 -1
  402. package/dist/infrastructure/storage/sqlite/schema.d.ts +2 -2
  403. package/dist/infrastructure/storage/sqlite/schema.d.ts.map +1 -1
  404. package/dist/infrastructure/storage/sqlite/schema.js +49 -1
  405. package/dist/infrastructure/storage/sqlite/schema.js.map +1 -1
  406. package/dist/interface/config/index.d.ts +5 -3
  407. package/dist/interface/config/index.d.ts.map +1 -1
  408. package/dist/interface/types/index.d.ts +37 -6
  409. package/dist/interface/types/index.d.ts.map +1 -1
  410. package/dist/interface/types/parser.d.ts +85 -0
  411. package/dist/interface/types/parser.d.ts.map +1 -1
  412. package/dist/interface/types/storage.d.ts +227 -10
  413. package/dist/interface/types/storage.d.ts.map +1 -1
  414. package/dist/orchestrator/agent-metrics-service.d.ts +126 -0
  415. package/dist/orchestrator/agent-metrics-service.d.ts.map +1 -0
  416. package/dist/orchestrator/agent-metrics-service.js +444 -0
  417. package/dist/orchestrator/agent-metrics-service.js.map +1 -0
  418. package/dist/orchestrator/types.d.ts +2 -0
  419. package/dist/orchestrator/types.d.ts.map +1 -1
  420. package/dist/orchestrator/types.js.map +1 -1
  421. package/dist/parser/enhancers/PythonTypeEnhancer.d.ts +26 -0
  422. package/dist/parser/enhancers/PythonTypeEnhancer.d.ts.map +1 -0
  423. package/dist/parser/enhancers/PythonTypeEnhancer.js +440 -0
  424. package/dist/parser/enhancers/PythonTypeEnhancer.js.map +1 -0
  425. package/dist/parser/implementations/smart-parser.d.ts.map +1 -1
  426. package/dist/parser/implementations/smart-parser.js +7 -69
  427. package/dist/parser/implementations/smart-parser.js.map +1 -1
  428. package/dist/parser/implementations/tree-sitter-loader.d.ts +18 -0
  429. package/dist/parser/implementations/tree-sitter-loader.d.ts.map +1 -0
  430. package/dist/parser/implementations/tree-sitter-loader.js +136 -0
  431. package/dist/parser/implementations/tree-sitter-loader.js.map +1 -0
  432. package/dist/parser/index.d.ts +5 -3
  433. package/dist/parser/index.d.ts.map +1 -1
  434. package/dist/parser/index.js +68 -6
  435. package/dist/parser/index.js.map +1 -1
  436. package/dist/parser/interfaces/IParser.d.ts +19 -6
  437. package/dist/parser/interfaces/IParser.d.ts.map +1 -1
  438. package/dist/parser/interfaces/IParser.js +2 -3
  439. package/dist/parser/interfaces/IParser.js.map +1 -1
  440. package/dist/server/handlers/AnalysisHandler.d.ts +13 -2
  441. package/dist/server/handlers/AnalysisHandler.d.ts.map +1 -1
  442. package/dist/server/handlers/AnalysisHandler.js +24 -0
  443. package/dist/server/handlers/AnalysisHandler.js.map +1 -1
  444. package/dist/server/handlers/QueryHandler.d.ts.map +1 -1
  445. package/dist/server/handlers/QueryHandler.js +11 -30
  446. package/dist/server/handlers/QueryHandler.js.map +1 -1
  447. package/dist/server/mcp/context-tool.d.ts +9 -0
  448. package/dist/server/mcp/context-tool.d.ts.map +1 -0
  449. package/dist/server/mcp/context-tool.js +257 -0
  450. package/dist/server/mcp/context-tool.js.map +1 -0
  451. package/dist/server/mcp/schema-adapter.d.ts +55 -0
  452. package/dist/server/mcp/schema-adapter.d.ts.map +1 -0
  453. package/dist/server/mcp/schema-adapter.js +409 -0
  454. package/dist/server/mcp/schema-adapter.js.map +1 -0
  455. package/dist/server/mcp/server.d.ts +3 -3
  456. package/dist/server/mcp/server.d.ts.map +1 -1
  457. package/dist/server/mcp/server.js +134 -20
  458. package/dist/server/mcp/server.js.map +1 -1
  459. package/dist/server/mcp/service.d.ts +6 -2
  460. package/dist/server/mcp/service.d.ts.map +1 -1
  461. package/dist/server/mcp/service.js +138 -36
  462. package/dist/server/mcp/service.js.map +1 -1
  463. package/dist/server/mcp/stdio-transport.d.ts +23 -0
  464. package/dist/server/mcp/stdio-transport.d.ts.map +1 -0
  465. package/dist/server/mcp/stdio-transport.js +101 -0
  466. package/dist/server/mcp/stdio-transport.js.map +1 -0
  467. package/dist/server/mcp/types.d.ts +133 -8
  468. package/dist/server/mcp/types.d.ts.map +1 -1
  469. package/dist/server/routes/api.d.ts.map +1 -1
  470. package/dist/server/routes/api.js +11 -2
  471. package/dist/server/routes/api.js.map +1 -1
  472. package/docs/AI_ASSISTANT_SETUP.md +281 -12
  473. package/docs/API.md +170 -0
  474. package/docs/CONFIGURATION.md +141 -0
  475. package/docs/DEVELOPMENT.md +96 -0
  476. package/docs/GETTING-STARTED.md +114 -0
  477. package/docs/README.md +40 -1
  478. package/docs/SETUP_GUIDE.md +60 -14
  479. package/docs/TESTING.md +81 -0
  480. package/docs/ai-guide/COMMANDS.md +68 -10
  481. package/docs/ai-guide/INTEGRATION.md +77 -10
  482. package/docs/ai-guide/OUTPUT.md +345 -9
  483. package/docs/ai-guide/PROMPTS.md +2 -2
  484. package/docs/ai-guide/QUICKSTART.md +28 -1
  485. package/docs/ai-guide/README.md +2 -2
  486. package/docs/archive/ideation/2026-04-15-executable-architecture-constitution-ideation-archive.md +70 -0
  487. package/docs/archive/ideation/2026-04-20-mycodemap-init-enhancements-ideation-archive.md +109 -0
  488. package/docs/archive/ideation/2026-04-22-rules-entry-docs-optimization-consolidated-ideation-archive.md +54 -0
  489. package/docs/backlog.md +232 -144
  490. package/docs/brainstorms/2026-05-10-agent-effectiveness-validation-requirements.md +112 -0
  491. package/docs/generated/phase-58/subagent-evidence/claude-hook-example.json +15 -0
  492. package/docs/generated/phase-58/subagent-evidence/claude-session.md +146 -0
  493. package/docs/generated/phase-58/subagent-evidence/claude-subagent.json +28 -0
  494. package/docs/generated/phase-58/subagent-evidence/codex-agent-example.toml +19 -0
  495. package/docs/generated/phase-58/subagent-evidence/codex-session.md +150 -0
  496. package/docs/generated/phase-58/subagent-evidence/codex-subagent.json +20 -0
  497. package/docs/generated/phase-58/subagent-evidence/negative-no-retrieval.json +12 -0
  498. package/docs/generated/phase-58/subagent-evidence/verification-manifest.json +19 -0
  499. package/docs/ideation/2026-04-15-executable-architecture-constitution-ideation.md +10 -22
  500. package/docs/ideation/2026-04-20-mycodemap-init-enhancements-ideation.md +15 -60
  501. package/docs/ideation/2026-04-22-rules-entry-docs-optimization-consolidated-ideation.md +47 -52
  502. package/docs/ideation/2026-04-29-ux-install-agent-experience-ideation.md +256 -0
  503. package/docs/ideation/2026-05-02-subagent-environment-contract-injection-ideation.md +183 -0
  504. package/docs/ideation/2026-05-04-subagent-hooks-deep-dive-ideation.md +133 -0
  505. package/docs/ideation/2026-05-10-agent-effectiveness-validation-ideation.md +219 -0
  506. package/docs/plans/2026-04-30-install-guide-and-repo-analyzer-design.md +394 -0
  507. package/docs/rules/README.md +1 -0
  508. package/docs/rules/architecture-guardrails.md +2 -1
  509. package/docs/rules/engineering-with-codex-openai.md +1 -1
  510. package/docs/rules/harness.md +106 -0
  511. package/docs/rules/pre-release-checklist.md +28 -0
  512. package/docs/rules/testing.md +51 -0
  513. package/examples/claude/skills/mycodemap-repo-analyzer/SKILL.md +294 -0
  514. package/examples/claude/skills/mycodemap-repo-analyzer/references/analysis-guide.md +166 -0
  515. package/examples/claude/skills/mycodemap-repo-analyzer/references/module-analysis-guide.md +150 -0
  516. package/package.json +12 -4
  517. package/scripts/copy-build-assets.mjs +23 -0
  518. package/scripts/hooks/templates/pre-commit +33 -2
  519. package/scripts/sync-analyze-docs.js +2 -2
  520. package/scripts/tests/test_rule_control_workflow.py +15 -1
  521. package/scripts/validate-docs.js +113 -16
  522. package/scripts/verify-subagent-env-contract.mjs +279 -0
  523. package/dist/parser/implementations/tree-sitter-parser.d.ts +0 -57
  524. package/dist/parser/implementations/tree-sitter-parser.d.ts.map +0 -1
  525. package/dist/parser/implementations/tree-sitter-parser.js +0 -375
  526. package/dist/parser/implementations/tree-sitter-parser.js.map +0 -1
  527. package/docs/references/tmp.md +0 -527
package/docs/API.md ADDED
@@ -0,0 +1,170 @@
1
+ <!-- generated-by: gsd-doc-writer -->
2
+
3
+ # API Reference
4
+
5
+ CodeMap exposes two runtime surfaces:
6
+
7
+ - a REST API mounted under `/api/v1`
8
+ - an experimental MCP server for stdio-based agent integrations
9
+
10
+ ## Server Configuration
11
+
12
+ `CodeMapServer` defaults to:
13
+
14
+ - `host: 0.0.0.0`
15
+ - `port: 3000`
16
+
17
+ Optional server config includes:
18
+
19
+ - `cors.origin`
20
+ - `cors.credentials`
21
+ - `auth.type` with `none`, `bearer`, or `api-key`
22
+
23
+ ## Authentication
24
+
25
+ The server configuration accepts an optional `auth` field, but authentication is **not enforced by middleware** in the current implementation. All endpoints are publicly accessible when the server is started with default settings.
26
+
27
+ When `auth.type` is set to `bearer` or `api-key`, consumers should include the credential in the `Authorization` header. <!-- VERIFY: actual header format and secret rotation are not implemented in route middleware -->
28
+
29
+ ## Endpoints Overview
30
+
31
+ All endpoints are mounted under `/api/v1`.
32
+
33
+ | Method | Path | Description | Auth Required |
34
+ |---|---|---|---|
35
+ | GET | `/health` | Basic health check | No |
36
+ | GET | `/search/symbols` | Search symbols by query string | No |
37
+ | GET | `/search/modules` | Search modules by query string | No |
38
+ | GET | `/modules/:id` | Module detail | No |
39
+ | GET | `/symbols/:id` | Symbol detail | No |
40
+ | GET | `/symbols/:id/callers` | Incoming callers for a symbol | No |
41
+ | GET | `/symbols/:id/callees` | Outgoing callees for a symbol | No |
42
+ | POST | `/analysis` | Run analysis for a project path | No |
43
+ | POST | `/analysis/refresh` | Refresh an existing project | No |
44
+ | POST | `/analysis/impact` | Analyze the impact of a module change | No |
45
+ | GET | `/analysis/cycles` | Detect circular dependencies | No |
46
+ | GET | `/analysis/validate` | Validate the current code graph | No |
47
+ | GET | `/stats` | Project statistics | No |
48
+ | GET | `/graph` | Dependency graph data for visualization | No |
49
+ | GET | `/export/:format` | Export graph data | No |
50
+
51
+ ### Query Parameters
52
+
53
+ Search endpoints accept:
54
+
55
+ - `q` — string, default empty
56
+ - `limit` — number, default `50`
57
+
58
+ The graph endpoint accepts:
59
+
60
+ - `page` — number, default `1`
61
+ - `limit` — number, default `100`
62
+
63
+ ### Export Formats
64
+
65
+ `export/:format` accepts `json`, `graphml`, and `dot`. The response is returned as a file download with the appropriate `Content-Type` and `Content-Disposition` headers.
66
+
67
+ ## Request/Response Formats
68
+
69
+ ### Response Envelope
70
+
71
+ Every JSON endpoint returns an `ApiResponse<T>` envelope:
72
+
73
+ ```json
74
+ {
75
+ "success": true,
76
+ "data": { ... },
77
+ "meta": {
78
+ "timestamp": "2026-05-11T08:49:11.768Z",
79
+ "requestId": "req_1746989351768_abc1234"
80
+ }
81
+ }
82
+ ```
83
+
84
+ On failure:
85
+
86
+ ```json
87
+ {
88
+ "success": false,
89
+ "error": {
90
+ "code": "NOT_FOUND",
91
+ "message": "Module xyz not found"
92
+ },
93
+ "meta": {
94
+ "timestamp": "2026-05-11T08:49:11.768Z",
95
+ "requestId": "req_1746989351768_abc1234"
96
+ }
97
+ }
98
+ ```
99
+
100
+ ### Request Bodies
101
+
102
+ **POST `/analysis`**
103
+
104
+ ```json
105
+ {
106
+ "projectPath": "/path/to/project",
107
+ "options": {
108
+ "mode": "tree-sitter"
109
+ }
110
+ }
111
+ ```
112
+
113
+ **POST `/analysis/refresh`**
114
+
115
+ ```json
116
+ {
117
+ "projectPath": "/path/to/project"
118
+ }
119
+ ```
120
+
121
+ **POST `/analysis/impact`**
122
+
123
+ ```json
124
+ {
125
+ "moduleId": "module-uuid",
126
+ "depth": 3
127
+ }
128
+ ```
129
+
130
+ For deprecated parser modes, the API returns the same actionable error shape used by the CLI, including `nextCommand` when available.
131
+
132
+ ## Error Codes
133
+
134
+ Standard HTTP status codes and their meanings in this API:
135
+
136
+ | Status | Code | Meaning |
137
+ |---|---|---|
138
+ | 200 | — | Success |
139
+ | 400 | `INVALID_FORMAT` | Unsupported export format or bad request parameter |
140
+ | 400 | `DEPRECATED_PARSER_MODE` | Requested parser mode is no longer supported |
141
+ | 404 | `NOT_FOUND` | Requested module or symbol does not exist |
142
+ | 500 | `INTERNAL_ERROR` | Unhandled server exception |
143
+ | 500 | `SEARCH_ERROR` | Search operation failed |
144
+ | 500 | `QUERY_ERROR` | Query operation failed |
145
+ | 500 | `ANALYSIS_ERROR` | Analysis operation failed |
146
+ | 500 | `EXPORT_ERROR` | Export operation failed |
147
+ | 500 | `VALIDATION_ERROR` | Validation operation failed |
148
+ | 501 | `ANALYSIS_NOT_SUPPORTED` | Analysis operation is not supported by the server layer |
149
+ | 501 | `INCREMENTAL_UPDATE_NOT_SUPPORTED` | Incremental update is not supported |
150
+ | 501 | `REFRESH_NOT_SUPPORTED` | Refresh operation is not supported by the server layer |
151
+
152
+ The 404 handler also returns a standard error envelope for unmatched routes:
153
+
154
+ ```json
155
+ {
156
+ "success": false,
157
+ "error": {
158
+ "code": "NOT_FOUND",
159
+ "message": "Route /api/v1/unknown not found"
160
+ }
161
+ }
162
+ ```
163
+
164
+ ## Rate Limits
165
+
166
+ No rate limiting is currently configured for the API.
167
+
168
+ ## MCP
169
+
170
+ The MCP server lives under `src/server/mcp/` and is started via the `mcp start` CLI path. It is intentionally experimental and uses the process' stdio transport rather than the REST API transport.
@@ -0,0 +1,141 @@
1
+ <!-- generated-by: gsd-doc-writer -->
2
+
3
+ # Configuration
4
+
5
+ ## Config File Resolution
6
+
7
+ CodeMap reads config files in this order:
8
+
9
+ 1. `.mycodemap/config.json`
10
+ 2. `mycodemap.config.json`
11
+ 3. `codemap.config.json`
12
+
13
+ `mycodemap init` writes the canonical config under `.mycodemap/config.json` unless you are explicitly using a legacy path.
14
+
15
+ ## Config File Format
16
+
17
+ The configuration file is JSON-based. The canonical location is `.mycodemap/config.json`, with fallback to `mycodemap.config.json` or `codemap.config.json` in the project root.
18
+
19
+ Top-level keys:
20
+
21
+ | Key | Type | Default | Description |
22
+ |---|---|---|---|
23
+ | `$schema` | string | `https://mycodemap.dev/schema/config.json` | JSON Schema reference for editor tooling |
24
+ | `mode` | string | `"tree-sitter"` | Parser mode. Only `"tree-sitter"` is valid; legacy values (`fast`, `smart`, `hybrid`) are rejected. |
25
+ | `include` | string[] | `["src/**/*.ts"]` | Glob patterns to include in analysis |
26
+ | `exclude` | string[] | See defaults below | Glob patterns to exclude from analysis |
27
+ | `output` | string | `".mycodemap"` | Output directory for generated files |
28
+ | `watch` | boolean | `false` | Enable watch mode for file changes |
29
+ | `storage` | object | See below | Storage backend configuration |
30
+ | `plugins` | object | See below | Plugin loading options |
31
+
32
+ Example:
33
+
34
+ ```json
35
+ {
36
+ "$schema": "https://mycodemap.dev/schema/config.json",
37
+ "mode": "tree-sitter",
38
+ "include": ["src/**/*.ts"],
39
+ "exclude": [
40
+ "node_modules/**",
41
+ "dist/**",
42
+ "build/**",
43
+ "coverage/**",
44
+ ".venv/**",
45
+ "**/__pycache__/**",
46
+ "vendor/**",
47
+ "**/*.test.ts",
48
+ "**/*.spec.ts",
49
+ "**/*.d.ts"
50
+ ],
51
+ "output": ".mycodemap",
52
+ "watch": false,
53
+ "storage": {
54
+ "type": "sqlite",
55
+ "databasePath": ".mycodemap/governance.sqlite"
56
+ },
57
+ "plugins": {
58
+ "builtInPlugins": true,
59
+ "plugins": [],
60
+ "debug": false
61
+ }
62
+ }
63
+ ```
64
+
65
+ ## Defaults
66
+
67
+ The following defaults are applied when a key is omitted from the config file or no config file exists:
68
+
69
+ | Key | Default | Source |
70
+ |---|---|---|
71
+ | `mode` | `"tree-sitter"` | `src/cli/config-loader.ts:42` |
72
+ | `include` | `["src/**/*.ts"]` | `src/cli/config-loader.ts:43` |
73
+ | `exclude` | `["node_modules/**", "dist/**", "build/**", "coverage/**", ".venv/**", "**/__pycache__/**", "vendor/**", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]` | `src/core/file-discovery.ts:8` |
74
+ | `output` | `".mycodemap"` | `src/cli/config-loader.ts:44` |
75
+ | `watch` | `false` | `src/cli/config-loader.ts:254` |
76
+ | `storage.type` | `"sqlite"` | `src/cli/config-loader.ts:243` |
77
+ | `storage.databasePath` | `".mycodemap/governance.sqlite"` | `src/cli/config-loader.ts:244` |
78
+ | `plugins.builtInPlugins` | `true` | `src/cli/config-loader.ts:235` |
79
+ | `plugins.plugins` | `[]` | `src/cli/config-loader.ts:236` |
80
+ | `plugins.debug` | `false` | `src/cli/config-loader.ts:237` |
81
+
82
+ ## Storage
83
+
84
+ Supported storage types:
85
+
86
+ - `sqlite` default persistent backend
87
+ - `memory` for tests and ephemeral runs
88
+ - `auto` as a SQLite-family alias
89
+
90
+ Unsupported legacy backends are rejected:
91
+
92
+ - `filesystem`
93
+ - `kuzudb`
94
+ - `neo4j`
95
+
96
+ The storage factory now routes persistent storage through the SQLite family only.
97
+
98
+ ## Parser Mode
99
+
100
+ The active parser mode is `tree-sitter`. Deprecated inputs `fast`, `smart`, and `hybrid` are rejected by the CLI and server entry points.
101
+
102
+ ## Environment Variables
103
+
104
+ | Variable | Required | Default | Description |
105
+ |---|---|---|---|
106
+ | `MYCODEMAP_RUNTIME_LOG_ENABLED` | Optional | `true` | Enable or disable runtime logs |
107
+ | `MYCODEMAP_RUNTIME_LOG_DIR` | Optional | `.mycodemap/logs` | Set the runtime log directory |
108
+ | `MYCODEMAP_RUNTIME_LOG_RETENTION_DAYS` | Optional | `14` | Retain logs for this many days |
109
+ | `MYCODEMAP_RUNTIME_LOG_MAX_FILES` | Optional | `30` | Cap the number of runtime log files |
110
+ | `MYCODEMAP_RUNTIME_LOG_MAX_SIZE_MB` | Optional | `10` | Cap the size of a single runtime log file |
111
+ | `CODEMAP_USE_WASM_TREE_SITTER` | Optional | — | Force the tree-sitter loader to use WASM when set to `1` |
112
+ | `CODEMAP_USE_WASM_BETTER_SQLITE3` | Optional | — | Force SQLite fallback behavior when set to `1` |
113
+ | `GITHUB_TOKEN` | Optional | — | Preferred token for release monitoring and GitHub API access |
114
+ | `GH_TOKEN` | Optional | — | Fallback token for release monitoring |
115
+ | `SHIP_IN_CI` | Optional | — | Skip local release checks inside CI when set to `1` |
116
+
117
+ The runtime logger accepts the `CODEMAP_*` legacy variables as fallbacks for the newer `MYCODEMAP_*` names:
118
+
119
+ - `CODEMAP_RUNTIME_LOG_ENABLED` → fallback for `MYCODEMAP_RUNTIME_LOG_ENABLED`
120
+ - `CODEMAP_RUNTIME_LOG_DIR` → fallback for `MYCODEMAP_RUNTIME_LOG_DIR`
121
+ - `CODEMAP_RUNTIME_LOG_RETENTION_DAYS` → fallback for `MYCODEMAP_RUNTIME_LOG_RETENTION_DAYS`
122
+ - `CODEMAP_RUNTIME_LOG_MAX_FILES` → fallback for `MYCODEMAP_RUNTIME_LOG_MAX_FILES`
123
+ - `CODEMAP_RUNTIME_LOG_MAX_SIZE_MB` → fallback for `MYCODEMAP_RUNTIME_LOG_MAX_SIZE_MB`
124
+
125
+ ## Required vs Optional Settings
126
+
127
+ All configuration settings are optional. CodeMap starts successfully with no configuration file and no environment variables set. If a config file is present, any omitted keys use the built-in defaults listed above. Invalid values (such as deprecated parser modes or unsupported storage types) cause the CLI to exit with an error rather than falling back silently.
128
+
129
+ ## Per-Environment Overrides
130
+
131
+ No per-environment config files (`.env.development`, `.env.production`, `.env.test`) are built into CodeMap. Environment-specific behavior is controlled through:
132
+
133
+ - **Environment variables** — set `MYCODEMAP_RUNTIME_LOG_ENABLED=false` in CI to disable log noise, or `SHIP_IN_CI=1` to skip local release checks.
134
+ - **WASM toggles** — `CODEMAP_USE_WASM_TREE_SITTER` and `CODEMAP_USE_WASM_BETTER_SQLITE3` can be set per environment to force fallback behavior.
135
+ - **Separate config files** — you can maintain distinct config files and point to them by placing the appropriate file in the project root, since CodeMap resolves `.mycodemap/config.json` → `mycodemap.config.json` → `codemap.config.json` in that order.
136
+
137
+ ## Operational Notes
138
+
139
+ - `mycodemap generate` writes to `.mycodemap/` unless the config overrides `output`.
140
+ - `mycodemap benchmark` toggles the WASM environment variables internally for each measurement.
141
+ - `mycodemap ship` and release monitoring use GitHub token settings from the environment.
@@ -0,0 +1,96 @@
1
+ <!-- generated-by: gsd-doc-writer -->
2
+
3
+ # Development Guide
4
+
5
+ ## Local setup
6
+
7
+ Fork and clone the repository, then install dependencies and build:
8
+
9
+ ```bash
10
+ git clone https://github.com/yuanyuanyuan/mycodemap.git
11
+ cd mycodemap
12
+ npm install
13
+ npm run build
14
+ ```
15
+
16
+ - **Node.js:** `>= 20.0.0` (required by `package.json` `engines`)
17
+ - No `.env` file is required for local development.
18
+
19
+ The build emits compiled output into `dist/`, and the package ships the CLI from `dist/cli/index.js`.
20
+
21
+ ## Build commands
22
+
23
+ | Command | Description |
24
+ |---|---|
25
+ | `npm run dev` | Watch TypeScript compilation |
26
+ | `npm run build` | Compile the project |
27
+ | `npm run postbuild` | Copy static build assets after compilation |
28
+ | `npm run typecheck` | Type-check without emitting files |
29
+ | `npm run lint` | Run ESLint on `src/` |
30
+ | `npm run fix:all` | Auto-fix lint issues |
31
+ | `npm test` | Run the Vitest suite |
32
+ | `npm run test:all` | Run tests and benchmarks together |
33
+ | `npm run test:e2e` | Run workflow and integration-style tests |
34
+ | `npm run benchmark` | Run benchmark checks |
35
+ | `npm run docs:check` | Validate human and AI documentation |
36
+ | `npm run docs:check:human` | Validate human-facing docs only |
37
+ | `npm run docs:check:ai` | Validate AI-facing docs only |
38
+ | `npm run docs:check:pre-release` | Pre-release docs validation |
39
+ | `npm run check:all` | Full local gate (typecheck + lint + test + docs) |
40
+ | `npm run check:security` | Run `npm audit` for security issues |
41
+ | `npm run validate-pack` | Validate the package before publish |
42
+ | `npm run release` | Run the release script |
43
+ | `npm run ai:pre-task` | Pre-task validation gate (same as `check:all`) |
44
+ | `npm run ai:post-task` | Auto-fix and re-run full validation gate |
45
+
46
+ ## Code style
47
+
48
+ The project uses **ESLint** with the TypeScript plugin for linting. Configuration lives in `eslint.config.js`.
49
+
50
+ - **Lint target:** `src/**/*.ts` (test files use relaxed rules)
51
+ - **Run lint:** `npm run lint`
52
+ - **Auto-fix:** `npm run fix:all`
53
+ - **Key rules:** duplicate enum values are errors; unused vars, `any`, and non-null assertions are warnings
54
+
55
+ There is no Prettier, Biome, or `.editorconfig` configured.
56
+
57
+ ## Branch conventions
58
+
59
+ No explicit branch naming convention is documented. The CI pipeline runs against `main` and `develop`:
60
+
61
+ - `main` — stable branch
62
+ - `develop` — integration branch
63
+
64
+ ## PR process
65
+
66
+ Follow these guidelines when opening a pull request:
67
+
68
+ - Keep each PR focused on a single concern.
69
+ - Include tests for any behavior changes.
70
+ - Run `npm run check:all` before opening the PR.
71
+ - Use the commit format `[TAG] scope: message`. Valid tags: `BUGFIX`, `FEATURE`, `REFACTOR`, `CONFIG`, `DOCS`, `DELETE`.
72
+ - For `FEATURE` or `BUGFIX` commits, include a `[证据]` trail (path references or command output) in the commit message or PR description when you have real-world validation evidence.
73
+ - Mention any remaining risks or skipped verification explicitly in the PR description.
74
+
75
+ ## Working Rules
76
+
77
+ - Keep TypeScript files in ESM style with explicit exports.
78
+ - Preserve the file headers that carry `[META]` and `[WHY]` annotations in source files.
79
+ - Prefer small, surgical changes that match the surrounding code.
80
+ - If a change touches CLI behavior, configuration, or public APIs, update the corresponding docs in the same change.
81
+
82
+ ## Local Feedback Loop
83
+
84
+ Recommended loop for most changes:
85
+
86
+ ```bash
87
+ npm run typecheck
88
+ npm test
89
+ npm run docs:check
90
+ ```
91
+
92
+ For agent-driven work, `npm run ai:pre-task` and `npm run ai:post-task` wrap the same validation gates used in CI.
93
+
94
+ ## Release Notes
95
+
96
+ `npm run release` invokes the release script, and `prepublishOnly` runs the pre-release docs check, build, and tests before publish. Treat those flows as gated operations, not casual dev commands.
@@ -0,0 +1,114 @@
1
+ <!-- generated-by: gsd-doc-writer -->
2
+
3
+ # Getting Started
4
+
5
+ ## Prerequisites
6
+
7
+ - Node.js `>= 20.0.0`
8
+ - npm, pnpm, or yarn
9
+ - A repository with source files to analyze
10
+
11
+ The tool can run without native build toolchains. When native dependencies are unavailable, the runtime falls back to WASM paths.
12
+
13
+ ## Installation
14
+
15
+ ### Install from npm (recommended for users)
16
+
17
+ ```bash
18
+ npm install -g @mycodemap/mycodemap
19
+ ```
20
+
21
+ `mycodemap` is the primary binary. `codemap` is kept as an alias.
22
+
23
+ ### Build from source (for contributors)
24
+
25
+ ```bash
26
+ git clone https://github.com/yuanyuanyuan/mycodemap.git
27
+ cd mycodemap
28
+ npm install
29
+ npm run build
30
+ ```
31
+
32
+ After building, run the CLI locally via `node dist/cli/index.js` or link it:
33
+
34
+ ```bash
35
+ npm link
36
+ mycodemap --help
37
+ ```
38
+
39
+ ## First Run
40
+
41
+ ```bash
42
+ mycodemap init
43
+ ```
44
+
45
+ By default, `init` prints a reconciliation preview. Use `--yes` to apply the plan immediately.
46
+
47
+ If the repository has a recognizable project marker, `init` can auto-detect a profile. Use `--profile <name>` to override that detection.
48
+
49
+ Next:
50
+
51
+ ```bash
52
+ mycodemap generate
53
+ mycodemap doctor
54
+ ```
55
+
56
+ `generate` writes analysis artifacts to `.mycodemap/`. `doctor` checks the runtime, workspace, and agent integrations.
57
+
58
+ ## What Gets Written
59
+
60
+ - `.mycodemap/config.json` as the canonical config file
61
+ - `.mycodemap/codemap.json` as the persisted graph data
62
+ - `.mycodemap/logs/` for runtime logs when enabled
63
+ - additional generated reports depending on the command you run
64
+
65
+ ## Minimal Workflow
66
+
67
+ 1. Install the package.
68
+ 2. Run `mycodemap init` or `mycodemap init --yes`.
69
+ 3. Run `mycodemap generate`.
70
+ 4. Inspect the output in `.mycodemap/`.
71
+ 5. Run `mycodemap doctor` if something looks off.
72
+
73
+ ## Common Setup Issues
74
+
75
+ ### Command not found after global install
76
+
77
+ If `mycodemap` is not recognized after `npm install -g`, refresh the shell hash or use `npx`:
78
+
79
+ ```bash
80
+ hash -r
81
+ npx mycodemap --help
82
+ ```
83
+
84
+ ### Native dependency build failures
85
+
86
+ Packages like `tree-sitter` and `better-sqlite3` may require a C++ compiler on your system. If the install fails:
87
+
88
+ ```bash
89
+ # Ubuntu/Debian
90
+ sudo apt-get install build-essential
91
+
92
+ # macOS
93
+ xcode-select --install
94
+ ```
95
+
96
+ When native modules are unavailable, CodeMap falls back to WASM equivalents automatically.
97
+
98
+ ### Node.js version mismatch
99
+
100
+ CodeMap requires Node.js `>= 20.0.0`. If you see an engine-unsupported error, upgrade Node.js or use a version manager such as `nvm`.
101
+
102
+ ## Common Follow-Up Commands
103
+
104
+ - `mycodemap query` to search symbols and modules
105
+ - `mycodemap deps` to inspect dependencies
106
+ - `mycodemap impact -f <file>` to estimate change impact
107
+ - `mycodemap benchmark` to compare native and WASM startup paths
108
+ - `mycodemap --schema` to inspect the CLI contract
109
+
110
+ ## Next Steps
111
+
112
+ - See [DEVELOPMENT.md](DEVELOPMENT.md) for local development setup, build commands, and contribution workflow.
113
+ - See [TESTING.md](TESTING.md) for how to run the test suite and write new tests.
114
+ - See [CONFIGURATION.md](CONFIGURATION.md) for the full config file format, environment variables, and per-environment overrides.
package/docs/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # docs/ - 文档信息架构
2
2
 
3
- 本目录采用“入口文档短、细节文档分层”的结构。
3
+ > **v2.0 里程碑上下文**:当前文档体系对应 CodeMap v2.0(”agent-native-foundation”)。v2.0 引入了 CLI-as-MCP 自动网关、接口契约 Schema、WASM-first 构建基础等核心能力。详见下方 [v2.0 文档索引](#v20-文档索引)。
4
+
5
+ 本目录采用”入口文档短、细节文档分层”的结构。
4
6
 
5
7
  ## 目录职责
6
8
 
@@ -11,6 +13,8 @@
11
13
  - `docs/product-specs/`:当前仍有效的产品规格与验收边界。
12
14
  - `docs/references/`:外部参考、设计系统、工具链资料。
13
15
  - `docs/archive/`:历史方案、迁移遗留、过期文档索引。
16
+ - `docs/ai-guide/`:AI / Agent 集成指南(v2.0 新增)。
17
+ - `src/cli/interface-contract/`:接口契约 Schema 定义(单一 Schema 生成 parser、MCP tool 定义、`--help-json`、shell 补全)。
14
18
 
15
19
  ## 当前状态
16
20
 
@@ -19,6 +23,20 @@
19
23
  - `docs/design-docs/` 与 `docs/product-specs/` 当前不再保留旧稿;历史内容请从 `docs/archive/README.md` 进入。
20
24
  - 新增内容优先写入分层目录,不再把新设计或新计划继续堆到根层。
21
25
 
26
+ ### v2.0 功能状态
27
+
28
+ v2.0("agent-native-foundation")已引入以下核心能力,相关文档已就位:
29
+
30
+ | 功能 | 状态 | 文档位置 |
31
+ |------|------|----------|
32
+ | **CLI-as-MCP 自动网关** | 已交付 | `docs/ai-guide/INTEGRATION.md` |
33
+ | `codemap doctor` 持续健康诊断 | 已交付 | `AI_GUIDE.md` + `src/cli/doctor/` |
34
+ | `codemap benchmark` WASM/Native 性能对比 | 已交付 | `AI_GUIDE.md` |
35
+ | `--schema` 接口契约输出 | 已交付 | `AI_GUIDE.md` + `src/cli/interface-contract/` |
36
+ | WASM-first 构建基础 | 已交付 | `AI_GUIDE.md` + `src/cli/loaders/` |
37
+ | AI-First 默认输出(JSON/NDJSON) | 已交付 | `AI_GUIDE.md` |
38
+ | Failure-to-Action 协议 | 已交付 | `docs/rules/harness.md` |
39
+
22
40
  ## 建议阅读顺序
23
41
 
24
42
  1. `../AGENTS.md`
@@ -28,6 +46,27 @@
28
46
  5. 与任务最相关的现行文档;如需历史背景,再看 `docs/archive/README.md`
29
47
  6. 如需过程信息,再看 `docs/exec-plans/*`
30
48
 
49
+ ## v2.0 文档索引
50
+
51
+ 以下文档涵盖 v2.0 核心功能,按主题分类:
52
+
53
+ ### AI / Agent 集成
54
+ - `docs/ai-guide/INTEGRATION.md` — CLI-as-MCP 自动网关配置指南(动态 tool 注册、20+ 命令自动暴露)
55
+ - `docs/ai-guide/AI_ASSISTANT_SETUP.md` — AI 助手(Kimi、Claude、Codex、Cursor、Copilot)集成配置
56
+ - `AI_GUIDE.md` — CodeMap CLI / MCP / AI 使用总览(含 `doctor`、`benchmark`、`--schema` 用法)
57
+
58
+ ### 接口契约与 Schema
59
+ - `src/cli/interface-contract/` — 单一 Schema 源文件(生成 parser、MCP tool 定义、`--help-json`、shell 补全)
60
+ - 运行 `codemap --schema` 可输出完整契约 JSON,供 Agent 自省
61
+
62
+ ### Harness 与 Agent 控制
63
+ - `docs/rules/harness.md` — Harness 设计、Agent 控制、上下文分层、权限升级策略
64
+ - `docs/rules/harness.md` — Failure-to-Action 协议(每个错误返回 `rootCause` + `remediationPlan` + `confidence` + `nextCommand`)
65
+
66
+ ### 架构与构建
67
+ - `ARCHITECTURE.md` — 架构分层、依赖方向、模块边界
68
+ - `src/cli/loaders/` — WASM-first 构建基础(`tree-sitter` → `web-tree-sitter`;`better-sqlite3` → `node:sqlite` / `sql.js`)
69
+
31
70
  ## 维护规则
32
71
 
33
72
  - 入口文档只做导航,不复述大段细节。
@@ -96,6 +96,55 @@ mycodemap init -y
96
96
 
97
97
  `init` 会同步 `.mycodemap/hooks/` 与 `.mycodemap/rules/`,但不会自动改写 `CLAUDE.md` / `AGENTS.md`;相关引用片段会通过 receipt 提示你手动加入。
98
98
 
99
+ #### 理解 Init 收据
100
+
101
+ `mycodemap init` 完成后会输出一份收据,分为两个部分:
102
+
103
+ **Main Agent(主 Agent 上下文)**
104
+ - 报告已生成的上下文文件路径(如 `claude-context.md`、`agents-context.md`)
105
+ - 指导你将相关内容手动合并到项目根目录的 `CLAUDE.md` / `AGENTS.md`
106
+ - 检测已同步状态:如果 `CLAUDE.md` 已包含 `.mycodemap/` 引用,标记为 `already-synced`
107
+
108
+ **Subagent(子 Agent 配置)**
109
+ - 报告平台配置示例文件(如 `claude-hook-example.json`、`codex-agent-example.toml`)
110
+ - 指导你将配置复制到对应平台设置目录
111
+
112
+ 收据还会显示**个性化下一步**,基于实际安装的资产生成,而非固定的三步欢迎信息。
113
+
114
+ > 注意:`init` 不会自动改写 `CLAUDE.md`、`AGENTS.md` 等团队共管文件。所有需要手动操作的步骤都会在收据中明确标注。
115
+
116
+ #### 环境契约(Environment Contract)
117
+
118
+ `mycodemap init` 还会生成 `.mycodemap/env-contract.json`,这是一个结构化的项目规则索引,包含:
119
+
120
+ - **执行规则**:shell 命令包装(rtk)、测试入口命令(vitest run)
121
+ - **提交规则**:commit message 格式(`[TAG] scope: message`)、有效标签列表
122
+ - **验证规则**:真实场景验证要求、代码质量标准
123
+ - **来源追踪**:每条规则的源文件和 hash,用于漂移检测
124
+
125
+ 子代理(Claude Code / Codex CLI 的委托代理)通过以下方式检索契约:
126
+
127
+ ```bash
128
+ # CLI 检索(按代理类型过滤)
129
+ mycodemap env-contract --for worker --json
130
+ mycodemap env-contract --for explore --json
131
+
132
+ # MCP 检索
133
+ codemap_env_contract(agentType="worker")
134
+ ```
135
+
136
+ 检查契约一致性和源文件漂移:
137
+
138
+ ```bash
139
+ # 检查契约是否过期或缺失关键项
140
+ mycodemap env-contract --check
141
+
142
+ # 全面健康诊断(包含 env-contract 状态)
143
+ mycodemap doctor
144
+ ```
145
+
146
+ > 冲突(如 hook 要求大写标签但文档示例写小写)会被报告为警告,不会阻断。源文件漂移会导致 `--check` 返回非零退出码,需要运行 `mycodemap env-contract --update` 重新生成。
147
+
99
148
  生成的 canonical 配置文件 `.mycodemap/config.json`:
100
149
 
101
150
  ```json
@@ -210,24 +259,21 @@ mycodemap impact -f src/cli/index.ts --transitive
210
259
  ### 统一分析(analyze)
211
260
 
212
261
  ```bash
213
- # 影响分析
214
- mycodemap analyze -i impact -t src/cli/index.ts
215
- mycodemap analyze -i impact -t src/cli/index.ts --scope transitive --include-tests
262
+ # 搜索符号或文件
263
+ mycodemap analyze -i find -k "UnifiedResult" --topK 10
216
264
 
217
- # 依赖分析
218
- mycodemap analyze -i dependency -t src/orchestrator
265
+ # 读取代码范围
266
+ mycodemap analyze -i read -t src/cli/index.ts
267
+ mycodemap analyze -i read -t src/cli/index.ts --scope transitive --include-tests
219
268
 
220
- # 复杂度分析
221
- mycodemap analyze -i complexity -t src/domain
269
+ # 查看模块依赖关系
270
+ mycodemap analyze -i link -t src/orchestrator
222
271
 
223
- # 搜索分析
224
- mycodemap analyze -i search -k "UnifiedResult" --topK 10
272
+ # 展示项目概览或复杂度
273
+ mycodemap analyze -i show -t src/
225
274
 
226
- # 项目概览
227
- mycodemap analyze -i overview -t src/
228
-
229
- # JSON 输出
230
- mycodemap analyze -i impact -t src/index.ts --json
275
+ # JSON 结构化输出
276
+ mycodemap analyze -i find -k "UnifiedResult" --json --structured
231
277
  ```
232
278
 
233
279
  ### 工作流编排(workflow)