@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
@@ -0,0 +1,184 @@
1
+ // [META] since:2026-05-02 | owner:cli-team | stable:false
2
+ // [WHY] Phase 55/58 — generate .mycodemap/env-contract.json from discovery engine.
3
+ // Phase 55 produced env-contract.seed.v1; Phase 58 upgrades to env-contract.v1.
4
+ import { existsSync, readFileSync } from 'node:fs';
5
+ import { mkdir, writeFile } from 'node:fs/promises';
6
+ import path from 'node:path';
7
+ import { discoverProjectEnvironmentContract } from '../env-contract/discovery.js';
8
+ const ASSET_KEY = 'env-contract';
9
+ const ASSET_LABEL = 'env-contract';
10
+ const ASSET_ORIGIN = 'discovery-engine';
11
+ function makeAsset(status, details, options = {}) {
12
+ return {
13
+ key: ASSET_KEY,
14
+ label: ASSET_LABEL,
15
+ status,
16
+ ownership: 'tool-owned',
17
+ origin: ASSET_ORIGIN,
18
+ path: options.path,
19
+ details,
20
+ hash: options.hash,
21
+ rollbackHint: options.rollbackHint,
22
+ manualAction: options.manualAction,
23
+ };
24
+ }
25
+ function normalizeContractForComparison(contract) {
26
+ const normalized = JSON.parse(JSON.stringify(contract));
27
+ delete normalized.generatedAt;
28
+ return JSON.stringify(normalized);
29
+ }
30
+ /**
31
+ * Check if existing content is a Phase 55 seed contract (env-contract.seed.v1).
32
+ */
33
+ function isSeedContract(parsed) {
34
+ return (typeof parsed === 'object' &&
35
+ parsed !== null &&
36
+ parsed.schemaVersion === 'env-contract.seed.v1');
37
+ }
38
+ /**
39
+ * Build an EnvContractPlan describing the env-contract.json decision.
40
+ *
41
+ * States:
42
+ * - file exists + same content → already-synced
43
+ * - file exists + seed v1 → migrate + installed (deterministic)
44
+ * - file exists + different + not seed → conflict (manual review)
45
+ * - file missing + preview mode → skipped
46
+ * - file missing + apply mode → installed + write action
47
+ */
48
+ export function createEnvContractPlan(rootDir, profileName, mode = 'apply', options) {
49
+ const targetPath = path.join(rootDir, '.mycodemap', 'env-contract.json');
50
+ const contract = discoverProjectEnvironmentContract(rootDir, {
51
+ profileName,
52
+ generatedAt: options?.generatedAt ?? new Date().toISOString(),
53
+ });
54
+ const contractJson = JSON.stringify(contract, null, 2);
55
+ // File already exists — check if content matches
56
+ if (existsSync(targetPath)) {
57
+ try {
58
+ const currentContent = readFileSync(targetPath, 'utf8');
59
+ // Try to parse existing content
60
+ let parsed;
61
+ try {
62
+ parsed = JSON.parse(currentContent);
63
+ }
64
+ catch {
65
+ // Unparseable — conflict
66
+ return {
67
+ assets: [
68
+ makeAsset('conflict', [
69
+ '无法解析 .mycodemap/env-contract.json,需手动确认',
70
+ ], {
71
+ path: targetPath,
72
+ manualAction: '手动审阅 .mycodemap/env-contract.json 的内容,确认后可删除该文件再重跑 init',
73
+ }),
74
+ ],
75
+ writes: [],
76
+ };
77
+ }
78
+ if (typeof parsed === 'object' &&
79
+ parsed !== null &&
80
+ normalizeContractForComparison(parsed) ===
81
+ normalizeContractForComparison(contract)) {
82
+ return {
83
+ assets: [
84
+ makeAsset('already-synced', [
85
+ 'env-contract.json 内容已同步,无需更新',
86
+ ], { path: targetPath }),
87
+ ],
88
+ writes: [],
89
+ };
90
+ }
91
+ // Seed v1 migration — deterministic upgrade
92
+ if (isSeedContract(parsed)) {
93
+ return {
94
+ assets: [
95
+ makeAsset('installed', [
96
+ '从 env-contract.seed.v1 迁移至 env-contract.v1',
97
+ `发现 ${contract.items.length} 项契约`,
98
+ `发现 ${contract.sourceSnapshots.length} 个源快照`,
99
+ ], {
100
+ path: targetPath,
101
+ rollbackHint: '如需回退,可删除 `.mycodemap/env-contract.json`',
102
+ }),
103
+ ],
104
+ writes: [
105
+ {
106
+ targetPath,
107
+ content: contractJson,
108
+ },
109
+ ],
110
+ };
111
+ }
112
+ // Content differs and is not a recognized seed — conflict
113
+ return {
114
+ assets: [
115
+ makeAsset('conflict', [
116
+ '检测到 .mycodemap/env-contract.json 与当前提取结果不同,本次不会自动覆盖',
117
+ ], {
118
+ path: targetPath,
119
+ manualAction: '手动审阅 .mycodemap/env-contract.json 的内容,确认后可删除该文件再重跑 init',
120
+ }),
121
+ ],
122
+ writes: [],
123
+ };
124
+ }
125
+ catch {
126
+ // Read error — treat as conflict
127
+ return {
128
+ assets: [
129
+ makeAsset('conflict', [
130
+ '无法读取 .mycodemap/env-contract.json,需手动确认',
131
+ ], {
132
+ path: targetPath,
133
+ manualAction: '手动审阅 .mycodemap/env-contract.json 的内容,确认后可删除该文件再重跑 init',
134
+ }),
135
+ ],
136
+ writes: [],
137
+ };
138
+ }
139
+ }
140
+ // Preview mode — don't write
141
+ if (mode === 'preview') {
142
+ return {
143
+ assets: [
144
+ makeAsset('skipped', [
145
+ `schemaVersion: ${contract.schemaVersion}`,
146
+ `projectProfile: ${contract.projectProfile.name}`,
147
+ `items: ${contract.items.length} 项`,
148
+ `sourceSnapshots: ${contract.sourceSnapshots.length} 个`,
149
+ '预览模式不会写入 .mycodemap/env-contract.json;使用 --yes 应用',
150
+ ]),
151
+ ],
152
+ writes: [],
153
+ };
154
+ }
155
+ // Apply mode — write the file
156
+ return {
157
+ assets: [
158
+ makeAsset('installed', [
159
+ '将生成 .mycodemap/env-contract.json',
160
+ `发现 ${contract.items.length} 项契约`,
161
+ `发现 ${contract.sourceSnapshots.length} 个源快照`,
162
+ ], {
163
+ path: targetPath,
164
+ rollbackHint: '如需回退,可删除 `.mycodemap/env-contract.json`',
165
+ }),
166
+ ],
167
+ writes: [
168
+ {
169
+ targetPath,
170
+ content: contractJson,
171
+ },
172
+ ],
173
+ };
174
+ }
175
+ /**
176
+ * Apply the env-contract plan: write the JSON file to disk.
177
+ */
178
+ export async function applyEnvContractPlan(plan) {
179
+ for (const write of plan.writes) {
180
+ await mkdir(path.dirname(write.targetPath), { recursive: true });
181
+ await writeFile(write.targetPath, write.content, 'utf8');
182
+ }
183
+ }
184
+ //# sourceMappingURL=env-contract-plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-contract-plan.js","sourceRoot":"","sources":["../../../src/cli/init/env-contract-plan.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,mFAAmF;AACnF,gFAAgF;AAEhF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,kCAAkC,EAAE,MAAM,8BAA8B,CAAC;AAclF,MAAM,SAAS,GAAG,cAAc,CAAC;AACjC,MAAM,WAAW,GAAG,cAAc,CAAC;AACnC,MAAM,YAAY,GAAG,kBAAkB,C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;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,IAAqB;IAC9D,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAChC,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACjE,MAAM,SAAS,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ export interface ManifestItem {
2
+ category: 'execution' | 'commit' | 'retrieval' | 'validation' | 'style';
3
+ key: string;
4
+ value?: string;
5
+ status?: 'unknown';
6
+ source: string;
7
+ confidence: 'high' | 'medium' | 'low' | 'none';
8
+ }
9
+ export interface ManifestFacts {
10
+ projectType: string;
11
+ projectSource: string;
12
+ items: ManifestItem[];
13
+ }
14
+ /**
15
+ * Extract obvious project facts from manifest files in `rootDir`.
16
+ *
17
+ * Reads package.json, pyproject.toml, go.mod, Cargo.toml for basic
18
+ * project metadata. Returns typed ManifestFacts with items[].
19
+ * Missing items are represented as status: 'unknown' with source: 'not-detected'.
20
+ */
21
+ export declare function extractManifestFacts(rootDir: string, profileName?: string): ManifestFacts;
22
+ //# sourceMappingURL=manifest-extractors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest-extractors.d.ts","sourceRoot":"","sources":["../../../src/cli/init/manifest-extractors.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,YAAY,GAAG,OAAO,CAAC;IACxE,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;CAChD;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,YAAY,EAAE,CAAC;CACvB;AAqKD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,MAAM,GACnB,aAAa,CAoBf"}
@@ -0,0 +1,185 @@
1
+ // [META] since:2026-05-02 | owner:cli-team | stable:false
2
+ // [WHY] Phase 55 — extract obvious project facts from package.json, pyproject.toml,
3
+ // go.mod, Cargo.toml for env-contract seed generation.
4
+ import { existsSync, readFileSync } from 'node:fs';
5
+ import path from 'node:path';
6
+ import { parse as parseToml } from 'smol-toml';
7
+ function safeReadFile(filePath) {
8
+ if (!existsSync(filePath)) {
9
+ return undefined;
10
+ }
11
+ try {
12
+ return readFileSync(filePath, 'utf8');
13
+ }
14
+ catch {
15
+ return undefined;
16
+ }
17
+ }
18
+ function extractPackageJson(rootDir, items) {
19
+ const text = safeReadFile(path.join(rootDir, 'package.json'));
20
+ if (!text)
21
+ return;
22
+ try {
23
+ const pkg = JSON.parse(text);
24
+ const scripts = pkg.scripts;
25
+ if (scripts?.test) {
26
+ items.push({
27
+ category: 'execution',
28
+ key: 'testCommand',
29
+ value: scripts.test,
30
+ source: 'package.json:scripts.test',
31
+ confidence: 'high',
32
+ });
33
+ }
34
+ if (scripts?.build) {
35
+ items.push({
36
+ category: 'execution',
37
+ key: 'buildCommand',
38
+ value: scripts.build,
39
+ source: 'package.json:scripts.build',
40
+ confidence: 'high',
41
+ });
42
+ }
43
+ if (scripts?.lint) {
44
+ items.push({
45
+ category: 'execution',
46
+ key: 'lintCommand',
47
+ value: scripts.lint,
48
+ source: 'package.json:scripts.lint',
49
+ confidence: 'high',
50
+ });
51
+ }
52
+ if (typeof pkg.main === 'string') {
53
+ items.push({
54
+ category: 'execution',
55
+ key: 'entryPoint',
56
+ value: pkg.main,
57
+ source: 'package.json:main',
58
+ confidence: 'medium',
59
+ });
60
+ }
61
+ }
62
+ catch {
63
+ // skip malformed package.json
64
+ }
65
+ }
66
+ function extractPyprojectToml(rootDir, items) {
67
+ const text = safeReadFile(path.join(rootDir, 'pyproject.toml'));
68
+ if (!text)
69
+ return;
70
+ try {
71
+ const parsed = parseToml(text);
72
+ const project = parsed.project;
73
+ if (project?.name) {
74
+ items.push({
75
+ category: 'execution',
76
+ key: 'projectName',
77
+ value: String(project.name),
78
+ source: 'pyproject.toml:project.name',
79
+ confidence: 'high',
80
+ });
81
+ }
82
+ const tool = parsed.tool;
83
+ const pytest = tool?.pytest;
84
+ if (pytest?.ini_options) {
85
+ items.push({
86
+ category: 'execution',
87
+ key: 'testCommand',
88
+ value: 'pytest',
89
+ source: 'pyproject.toml:tool.pytest',
90
+ confidence: 'medium',
91
+ });
92
+ }
93
+ }
94
+ catch {
95
+ // skip malformed pyproject.toml
96
+ }
97
+ }
98
+ function extractGoMod(rootDir, items) {
99
+ const text = safeReadFile(path.join(rootDir, 'go.mod'));
100
+ if (!text)
101
+ return;
102
+ try {
103
+ const match = text.match(/^module\s+(.+)$/m);
104
+ if (match) {
105
+ items.push({
106
+ category: 'execution',
107
+ key: 'moduleName',
108
+ value: match[1].trim(),
109
+ source: 'go.mod:module',
110
+ confidence: 'high',
111
+ });
112
+ }
113
+ }
114
+ catch {
115
+ // skip malformed go.mod
116
+ }
117
+ }
118
+ function extractCargoToml(rootDir, items) {
119
+ const text = safeReadFile(path.join(rootDir, 'Cargo.toml'));
120
+ if (!text)
121
+ return;
122
+ try {
123
+ const parsed = parseToml(text);
124
+ const pkg = parsed.package;
125
+ if (pkg?.name) {
126
+ items.push({
127
+ category: 'execution',
128
+ key: 'packageName',
129
+ value: String(pkg.name),
130
+ source: 'Cargo.toml:package.name',
131
+ confidence: 'high',
132
+ });
133
+ }
134
+ }
135
+ catch {
136
+ // skip malformed Cargo.toml
137
+ }
138
+ }
139
+ function addMissingDefaults(items) {
140
+ const keys = new Set(items.map((item) => item.key));
141
+ if (!keys.has('testCommand')) {
142
+ items.push({
143
+ category: 'execution',
144
+ key: 'testCommand',
145
+ status: 'unknown',
146
+ source: 'not-detected',
147
+ confidence: 'none',
148
+ });
149
+ }
150
+ if (!keys.has('buildCommand')) {
151
+ items.push({
152
+ category: 'execution',
153
+ key: 'buildCommand',
154
+ status: 'unknown',
155
+ source: 'not-detected',
156
+ confidence: 'none',
157
+ });
158
+ }
159
+ }
160
+ /**
161
+ * Extract obvious project facts from manifest files in `rootDir`.
162
+ *
163
+ * Reads package.json, pyproject.toml, go.mod, Cargo.toml for basic
164
+ * project metadata. Returns typed ManifestFacts with items[].
165
+ * Missing items are represented as status: 'unknown' with source: 'not-detected'.
166
+ */
167
+ export function extractManifestFacts(rootDir, profileName) {
168
+ const items = [];
169
+ extractPackageJson(rootDir, items);
170
+ extractPyprojectToml(rootDir, items);
171
+ extractGoMod(rootDir, items);
172
+ extractCargoToml(rootDir, items);
173
+ addMissingDefaults(items);
174
+ // Determine project source from whichever manifest was detected
175
+ const sourceMap = {
176
+ nodejs: 'package.json',
177
+ python: 'pyproject.toml',
178
+ go: 'go.mod',
179
+ rust: 'Cargo.toml',
180
+ };
181
+ const projectType = profileName ?? 'generic';
182
+ const projectSource = sourceMap[projectType] ?? 'not-detected';
183
+ return { projectType, projectSource, items };
184
+ }
185
+ //# sourceMappingURL=manifest-extractors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest-extractors.js","sourceRoot":"","sources":["../../../src/cli/init/manifest-extractors.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,oFAAoF;AACpF,uDAAuD;AAEvD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAA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AQ;QACZ,IAAI,EAAE,YAAY;KACnB,CAAC;IACF,MAAM,WAAW,GAAG,WAAW,IAAI,SAAS,CAAC;IAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,WAAW,CAAC,IAAI,cAAc,CAAC;IAE/D,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { z } from 'zod';
2
+ export declare const bootstrapProfileSchema: z.ZodObject<{
3
+ parser: z.ZodObject<{
4
+ include: z.ZodArray<z.ZodString>;
5
+ extensions: z.ZodArray<z.ZodString>;
6
+ }, z.core.$strip>;
7
+ ignore: z.ZodArray<z.ZodString>;
8
+ analysis_depth: z.ZodEnum<{
9
+ deep: "deep";
10
+ shallow: "shallow";
11
+ standard: "standard";
12
+ }>;
13
+ }, z.core.$strip>;
14
+ export type BootstrapProfile = z.infer<typeof bootstrapProfileSchema>;
15
+ /**
16
+ * Map `analysis_depth` profile values to the canonical config `mode` field.
17
+ *
18
+ * Documented mapping (per RESOLVED open question 2 in 53-RESEARCH.md):
19
+ * shallow -> fast
20
+ * standard -> hybrid
21
+ * deep -> smart
22
+ *
23
+ * Consumed by `profile-plan.ts` in plan 53-02 when merging profile defaults
24
+ * into `.mycodemap/config.json`. Kept here so the mapping lives next to the
25
+ * schema that defines the source enum.
26
+ */
27
+ export declare const ANALYSIS_DEPTH_TO_MODE: Record<BootstrapProfile['analysis_depth'], 'fast' | 'hybrid' | 'smart'>;
28
+ /**
29
+ * Resolve the absolute filesystem path for a built-in profile JSON file.
30
+ *
31
+ * Throws on unknown names or any name containing path separators / parent-dir
32
+ * tokens (mitigation for T-53-01 path traversal).
33
+ */
34
+ export declare function resolveProfilePath(profileName: string): string;
35
+ /**
36
+ * Load and validate a built-in bootstrap profile by name.
37
+ *
38
+ * Errors:
39
+ * - Unknown / illegal name → from `resolveProfilePath`
40
+ * - File missing on disk → "Profile 文件未找到" (does NOT include full path
41
+ * in the message body to mitigate T-53-04 info leak;
42
+ * the path is appended only in the trailing detail)
43
+ * - JSON parse failure → re-thrown with profile name context
44
+ * - Schema validation fail → flattened ZodError → "Profile 验证失败 [name]: ..."
45
+ *
46
+ * Pure: no `process.exit`; callers handle exit codes at CLI entry.
47
+ */
48
+ export declare function loadProfile(profileName: string): BootstrapProfile;
49
+ //# sourceMappingURL=profile-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile-loader.d.ts","sourceRoot":"","sources":["../../../src/cli/init/profile-loader.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,sBAAsB;;;;;;;;;;;iBAOjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAQtE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAI1G,CAAC;AAUF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAQ9D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,gBAAgB,CAgCjE"}
@@ -0,0 +1,107 @@
1
+ // [META] since:2026-05-01 | owner:cli-team | stable:false
2
+ // [WHY] Phase 53 profile JSON loader with strict zod validation. Reads built-in
3
+ // bootstrap profiles from the package's `src/cli/init/profiles/` directory and
4
+ // validates them against `bootstrapProfileSchema` before returning a typed result.
5
+ import { z } from 'zod';
6
+ import { readFileSync } from 'node:fs';
7
+ import path from 'node:path';
8
+ import { fileURLToPath } from 'node:url';
9
+ export const bootstrapProfileSchema = z.object({
10
+ parser: z.object({
11
+ include: z.array(z.string()).min(1),
12
+ extensions: z.array(z.string()).min(1),
13
+ }),
14
+ ignore: z.array(z.string()),
15
+ analysis_depth: z.enum(['shallow', 'standard', 'deep']),
16
+ });
17
+ /**
18
+ * Allow-list of built-in profile names (security: prevents arbitrary file reads
19
+ * via `--profile ../../../etc/passwd`-style inputs; threat T-53-01).
20
+ */
21
+ const ALLOWED_PROFILE_NAMES = new Set(['nodejs', 'python', 'go', 'rust', 'generic']);
22
+ /**
23
+ * Map `analysis_depth` profile values to the canonical config `mode` field.
24
+ *
25
+ * Documented mapping (per RESOLVED open question 2 in 53-RESEARCH.md):
26
+ * shallow -> fast
27
+ * standard -> hybrid
28
+ * deep -> smart
29
+ *
30
+ * Consumed by `profile-plan.ts` in plan 53-02 when merging profile defaults
31
+ * into `.mycodemap/config.json`. Kept here so the mapping lives next to the
32
+ * schema that defines the source enum.
33
+ */
34
+ export const ANALYSIS_DEPTH_TO_MODE = {
35
+ shallow: 'fast',
36
+ standard: 'hybrid',
37
+ deep: 'smart',
38
+ };
39
+ function resolveProfilesDir() {
40
+ // Profile JSONs ship next to this loader (in src/ during dev, in dist/ after
41
+ // build). Resolving relative to `import.meta.url` keeps both layouts in sync
42
+ // without depending on the package layout above this directory, which is
43
+ // important because npm `files` only ships `dist/`, not `src/`.
44
+ return fileURLToPath(new URL('./profiles/', import.meta.url));
45
+ }
46
+ /**
47
+ * Resolve the absolute filesystem path for a built-in profile JSON file.
48
+ *
49
+ * Throws on unknown names or any name containing path separators / parent-dir
50
+ * tokens (mitigation for T-53-01 path traversal).
51
+ */
52
+ export function resolveProfilePath(profileName) {
53
+ if (!ALLOWED_PROFILE_NAMES.has(profileName)) {
54
+ throw new Error(`未知 profile: ${profileName}`);
55
+ }
56
+ if (profileName.includes('/') || profileName.includes('\\') || profileName.includes('..')) {
57
+ throw new Error(`非法 profile 名称: ${profileName}`);
58
+ }
59
+ return path.join(resolveProfilesDir(), `${profileName}.json`);
60
+ }
61
+ /**
62
+ * Load and validate a built-in bootstrap profile by name.
63
+ *
64
+ * Errors:
65
+ * - Unknown / illegal name → from `resolveProfilePath`
66
+ * - File missing on disk → "Profile 文件未找到" (does NOT include full path
67
+ * in the message body to mitigate T-53-04 info leak;
68
+ * the path is appended only in the trailing detail)
69
+ * - JSON parse failure → re-thrown with profile name context
70
+ * - Schema validation fail → flattened ZodError → "Profile 验证失败 [name]: ..."
71
+ *
72
+ * Pure: no `process.exit`; callers handle exit codes at CLI entry.
73
+ */
74
+ export function loadProfile(profileName) {
75
+ const filePath = resolveProfilePath(profileName);
76
+ let text;
77
+ try {
78
+ text = readFileSync(filePath, 'utf8');
79
+ }
80
+ catch (error) {
81
+ const code = error?.code;
82
+ if (code === 'ENOENT') {
83
+ throw new Error(`Profile 文件未找到 [${profileName}]: ${filePath}`);
84
+ }
85
+ throw new Error(`无法读取 profile [${profileName}]: ${error.message}`);
86
+ }
87
+ let parsed;
88
+ try {
89
+ parsed = JSON.parse(text);
90
+ }
91
+ catch (error) {
92
+ throw new Error(`Profile JSON 解析失败 [${profileName}]: ${error.message}`);
93
+ }
94
+ try {
95
+ return bootstrapProfileSchema.parse(parsed);
96
+ }
97
+ catch (error) {
98
+ if (error instanceof z.ZodError) {
99
+ const issues = error.issues
100
+ .map((issue) => `${issue.path.join('.')}: ${issue.message}`)
101
+ .join('; ');
102
+ throw new Error(`Profile 验证失败 [${profileName}]: ${issues}`);
103
+ }
104
+ throw error;
105
+ }
106
+ }
107
+ //# sourceMappingURL=profile-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile-loader.js","sourceRoot":"","sources":["../../../src/cli/init/profile-loader.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,gFAAgF;AAChF,+EAA+E;AAC/E,mFAAmF;AAEnF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,CAAC,MAAM,sBAAsB,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ACxB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;iBAC3D,IAAI,CAAC,IAAI,CAAC,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,iBAAiB,WAAW,MAAM,MAAM,EAAE,CAAC,CAAC;QAC9D,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { BootstrapProfile } from './profile-loader.js';
2
+ import type { InitAsset } from './reconciler.js';
3
+ interface FileWriteAction {
4
+ targetPath: string;
5
+ content: string;
6
+ }
7
+ /**
8
+ * Minimal scan shape consumed by createProfilePlan.
9
+ *
10
+ * Defined locally (not imported from reconciler.ts) to avoid a circular
11
+ * type import; reconciler.ts's full InitScan structurally satisfies this.
12
+ */
13
+ export interface ProfilePlanScan {
14
+ hasCanonicalConfig: boolean;
15
+ paths: {
16
+ canonicalConfigPath: string;
17
+ };
18
+ }
19
+ export interface ProfilePlan {
20
+ assets: InitAsset[];
21
+ writes: FileWriteAction[];
22
+ /** Serialized merged config for preview rendering. */
23
+ mergedConfigText?: string;
24
+ /** Profile name for display, when one was selected. */
25
+ profileName?: string;
26
+ }
27
+ /**
28
+ * Build a ProfilePlan describing the bootstrap profile decision.
29
+ *
30
+ * - profile === null → skipped (no marker detected, or detection bypassed)
31
+ * - scan.hasCanonicalConfig → already-synced (D-16: respect existing config)
32
+ * - mode === 'preview' → skipped with merged-config preview text
33
+ * - mode === 'apply' → installed; queues canonical config write
34
+ */
35
+ export declare function createProfilePlan(_rootDir: string, profile: BootstrapProfile | null, scan: ProfilePlanScan, mode: 'preview' | 'apply', profileName?: string): ProfilePlan;
36
+ export declare function applyProfilePlan(plan: ProfilePlan): Promise<void>;
37
+ export {};
38
+ //# sourceMappingURL=profile-plan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile-plan.d.ts","sourceRoot":"","sources":["../../../src/cli/init/profile-plan.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,UAAU,eAAe;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,KAAK,EAAE;QACL,mBAAmB,EAAE,MAAM,CAAC;KAC7B,CAAC;CACH;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,sDAAsD;IACtD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA0DD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,gBAAgB,GAAG,IAAI,EAChC,IAAI,EAAE,eAAe,EACrB,IAAI,EAAE,SAAS,GAAG,OAAO,EACzB,WAAW,CAAC,EAAE,MAAM,GACnB,WAAW,CAqEb;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAKvE"}