homegraph 1.5.1 → 1.5.3

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 (382) hide show
  1. package/CHANGELOG.md +131 -0
  2. package/LICENSE +21 -21
  3. package/README.md +312 -305
  4. package/dist/arkui/index.d.ts +4 -0
  5. package/dist/arkui/index.d.ts.map +1 -0
  6. package/dist/arkui/index.js +23 -0
  7. package/dist/arkui/index.js.map +1 -0
  8. package/dist/arkui/migrate-passage.d.ts +28 -0
  9. package/dist/arkui/migrate-passage.d.ts.map +1 -0
  10. package/dist/arkui/migrate-passage.js +310 -0
  11. package/dist/arkui/migrate-passage.js.map +1 -0
  12. package/dist/arkui/migrate-semantics.d.ts +47 -0
  13. package/dist/arkui/migrate-semantics.d.ts.map +1 -0
  14. package/dist/arkui/migrate-semantics.js +229 -0
  15. package/dist/arkui/migrate-semantics.js.map +1 -0
  16. package/dist/arkui/migrate-snapshot.d.ts +79 -0
  17. package/dist/arkui/migrate-snapshot.d.ts.map +1 -0
  18. package/dist/arkui/migrate-snapshot.js +340 -0
  19. package/dist/arkui/migrate-snapshot.js.map +1 -0
  20. package/dist/bin/fatal-handler.js +2 -2
  21. package/dist/bin/homegraph.js +111 -162
  22. package/dist/bin/homegraph.js.map +1 -1
  23. package/dist/bin/node-version-check.d.ts +6 -15
  24. package/dist/bin/node-version-check.d.ts.map +1 -1
  25. package/dist/bin/node-version-check.js +8 -37
  26. package/dist/bin/node-version-check.js.map +1 -1
  27. package/dist/db/index.d.ts +36 -1
  28. package/dist/db/index.d.ts.map +1 -1
  29. package/dist/db/index.js +124 -38
  30. package/dist/db/index.js.map +1 -1
  31. package/dist/db/migrations.d.ts +1 -1
  32. package/dist/db/migrations.d.ts.map +1 -1
  33. package/dist/db/migrations.js +52 -38
  34. package/dist/db/migrations.js.map +1 -1
  35. package/dist/db/queries.d.ts +42 -0
  36. package/dist/db/queries.d.ts.map +1 -1
  37. package/dist/db/queries.js +330 -163
  38. package/dist/db/queries.js.map +1 -1
  39. package/dist/db/schema.sql +208 -203
  40. package/dist/db/sqlite-adapter.d.ts +8 -3
  41. package/dist/db/sqlite-adapter.d.ts.map +1 -1
  42. package/dist/db/sqlite-adapter.js +45 -3
  43. package/dist/db/sqlite-adapter.js.map +1 -1
  44. package/dist/directory.js +5 -5
  45. package/dist/extraction/extraction-version.d.ts +1 -1
  46. package/dist/extraction/extraction-version.js +1 -1
  47. package/dist/extraction/generated-detection.d.ts +42 -11
  48. package/dist/extraction/generated-detection.d.ts.map +1 -1
  49. package/dist/extraction/generated-detection.js +141 -20
  50. package/dist/extraction/generated-detection.js.map +1 -1
  51. package/dist/extraction/index.d.ts +43 -1
  52. package/dist/extraction/index.d.ts.map +1 -1
  53. package/dist/extraction/index.js +150 -43
  54. package/dist/extraction/index.js.map +1 -1
  55. package/dist/extraction/languages/arkts.d.ts +70 -6
  56. package/dist/extraction/languages/arkts.d.ts.map +1 -1
  57. package/dist/extraction/languages/arkts.js +958 -108
  58. package/dist/extraction/languages/arkts.js.map +1 -1
  59. package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
  60. package/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
  61. package/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
  62. package/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
  63. package/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
  64. package/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
  65. package/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
  66. package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  67. package/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
  68. package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
  69. package/dist/extraction/wasm-runtime-flags.js +9 -6
  70. package/dist/extraction/wasm-runtime-flags.js.map +1 -1
  71. package/dist/graph-sources.d.ts +41 -0
  72. package/dist/graph-sources.d.ts.map +1 -0
  73. package/dist/graph-sources.js +82 -0
  74. package/dist/graph-sources.js.map +1 -0
  75. package/dist/index.d.ts +19 -1
  76. package/dist/index.d.ts.map +1 -1
  77. package/dist/index.js +80 -9
  78. package/dist/index.js.map +1 -1
  79. package/dist/installer/index.d.ts.map +1 -1
  80. package/dist/installer/index.js +0 -48
  81. package/dist/installer/index.js.map +1 -1
  82. package/dist/installer/instructions-template.js +9 -9
  83. package/dist/installer/targets/antigravity.js +1 -1
  84. package/dist/installer/targets/antigravity.js.map +1 -1
  85. package/dist/installer/targets/deveco.js +1 -1
  86. package/dist/installer/targets/deveco.js.map +1 -1
  87. package/dist/installer/targets/hermes.d.ts +1 -1
  88. package/dist/installer/targets/hermes.js +2 -2
  89. package/dist/installer/targets/hermes.js.map +1 -1
  90. package/dist/installer/targets/opencode.js +1 -1
  91. package/dist/installer/targets/opencode.js.map +1 -1
  92. package/dist/installer/targets/shared.js +1 -1
  93. package/dist/installer/targets/shared.js.map +1 -1
  94. package/dist/mcp/daemon-paths.d.ts +5 -4
  95. package/dist/mcp/daemon-paths.d.ts.map +1 -1
  96. package/dist/mcp/daemon-paths.js +28 -13
  97. package/dist/mcp/daemon-paths.js.map +1 -1
  98. package/dist/mcp/daemon-registry.d.ts.map +1 -1
  99. package/dist/mcp/daemon-registry.js +4 -1
  100. package/dist/mcp/daemon-registry.js.map +1 -1
  101. package/dist/mcp/daemon.d.ts +1 -1
  102. package/dist/mcp/daemon.js +1 -1
  103. package/dist/mcp/diff-impact.d.ts +131 -0
  104. package/dist/mcp/diff-impact.d.ts.map +1 -0
  105. package/dist/mcp/diff-impact.js +385 -0
  106. package/dist/mcp/diff-impact.js.map +1 -0
  107. package/dist/mcp/engine.d.ts.map +1 -1
  108. package/dist/mcp/engine.js +12 -3
  109. package/dist/mcp/engine.js.map +1 -1
  110. package/dist/mcp/explore-dedup.d.ts +137 -0
  111. package/dist/mcp/explore-dedup.d.ts.map +1 -0
  112. package/dist/mcp/explore-dedup.js +236 -0
  113. package/dist/mcp/explore-dedup.js.map +1 -0
  114. package/dist/mcp/explore-session-state.d.ts +217 -0
  115. package/dist/mcp/explore-session-state.d.ts.map +1 -0
  116. package/dist/mcp/explore-session-state.js +322 -0
  117. package/dist/mcp/explore-session-state.js.map +1 -0
  118. package/dist/mcp/index.d.ts.map +1 -1
  119. package/dist/mcp/index.js +4 -7
  120. package/dist/mcp/index.js.map +1 -1
  121. package/dist/mcp/liveness-watchdog.js +51 -51
  122. package/dist/mcp/proxy.d.ts.map +1 -1
  123. package/dist/mcp/proxy.js +5 -14
  124. package/dist/mcp/proxy.js.map +1 -1
  125. package/dist/mcp/query-worker.d.ts +1 -1
  126. package/dist/mcp/query-worker.js +1 -1
  127. package/dist/mcp/server-instructions.d.ts +7 -2
  128. package/dist/mcp/server-instructions.d.ts.map +1 -1
  129. package/dist/mcp/server-instructions.js +125 -47
  130. package/dist/mcp/server-instructions.js.map +1 -1
  131. package/dist/mcp/session.d.ts +14 -3
  132. package/dist/mcp/session.d.ts.map +1 -1
  133. package/dist/mcp/session.js +17 -14
  134. package/dist/mcp/session.js.map +1 -1
  135. package/dist/mcp/startup-handshake.d.ts +1 -1
  136. package/dist/mcp/startup-handshake.js +1 -1
  137. package/dist/mcp/tools.d.ts +138 -12
  138. package/dist/mcp/tools.d.ts.map +1 -1
  139. package/dist/mcp/tools.js +3279 -476
  140. package/dist/mcp/tools.js.map +1 -1
  141. package/dist/resolution/callback-synthesizer.d.ts +2 -1
  142. package/dist/resolution/callback-synthesizer.d.ts.map +1 -1
  143. package/dist/resolution/callback-synthesizer.js +153 -53
  144. package/dist/resolution/callback-synthesizer.js.map +1 -1
  145. package/dist/resolution/frameworks/arkts-entry.d.ts.map +1 -1
  146. package/dist/resolution/frameworks/arkts-entry.js +20 -9
  147. package/dist/resolution/frameworks/arkts-entry.js.map +1 -1
  148. package/dist/resolution/frameworks/arkts-napi.d.ts +14 -0
  149. package/dist/resolution/frameworks/arkts-napi.d.ts.map +1 -1
  150. package/dist/resolution/frameworks/arkts-napi.js +169 -49
  151. package/dist/resolution/frameworks/arkts-napi.js.map +1 -1
  152. package/dist/resolution/index.d.ts.map +1 -1
  153. package/dist/resolution/index.js +1 -1
  154. package/dist/resolution/index.js.map +1 -1
  155. package/dist/resolution/memory-budget.d.ts +33 -0
  156. package/dist/resolution/memory-budget.d.ts.map +1 -1
  157. package/dist/resolution/memory-budget.js +58 -0
  158. package/dist/resolution/memory-budget.js.map +1 -1
  159. package/dist/resolution/resolver-pool.d.ts +2 -0
  160. package/dist/resolution/resolver-pool.d.ts.map +1 -1
  161. package/dist/resolution/resolver-pool.js +4 -0
  162. package/dist/resolution/resolver-pool.js.map +1 -1
  163. package/dist/search/query-utils.d.ts +116 -4
  164. package/dist/search/query-utils.d.ts.map +1 -1
  165. package/dist/search/query-utils.js +869 -60
  166. package/dist/search/query-utils.js.map +1 -1
  167. package/dist/spec/db/commit-node.js +4 -4
  168. package/dist/spec/db/fragment-node.js +10 -10
  169. package/dist/spec/db/fts.js +8 -8
  170. package/dist/spec/db/relations.js +88 -88
  171. package/dist/spec/db/schema.js +6 -6
  172. package/dist/spec/db/schema.sql +121 -121
  173. package/dist/spec/db/spec-node.js +4 -4
  174. package/dist/spec/llm/prompts.js +53 -53
  175. package/dist/types.d.ts +8 -0
  176. package/dist/types.d.ts.map +1 -1
  177. package/dist/ui/shimmer-progress.d.ts.map +1 -1
  178. package/dist/ui/shimmer-progress.js +4 -1
  179. package/dist/ui/shimmer-progress.js.map +1 -1
  180. package/dist/upgrade/index.d.ts +14 -26
  181. package/dist/upgrade/index.d.ts.map +1 -1
  182. package/dist/upgrade/index.js +28 -123
  183. package/dist/upgrade/index.js.map +1 -1
  184. package/dist/upgrade/remove-binary.d.ts +19 -19
  185. package/dist/upgrade/remove-binary.d.ts.map +1 -1
  186. package/dist/upgrade/remove-binary.js +20 -21
  187. package/dist/upgrade/remove-binary.js.map +1 -1
  188. package/dist/upgrade/update-check.d.ts +4 -3
  189. package/dist/upgrade/update-check.d.ts.map +1 -1
  190. package/dist/upgrade/update-check.js +4 -3
  191. package/dist/upgrade/update-check.js.map +1 -1
  192. package/package.json +65 -62
  193. package/dist/extraction/languages/arkts-viewtree.d.ts +0 -22
  194. package/dist/extraction/languages/arkts-viewtree.d.ts.map +0 -1
  195. package/dist/extraction/languages/arkts-viewtree.js +0 -133
  196. package/dist/extraction/languages/arkts-viewtree.js.map +0 -1
  197. package/dist/reasoning/config.d.ts +0 -45
  198. package/dist/reasoning/config.d.ts.map +0 -1
  199. package/dist/reasoning/config.js +0 -171
  200. package/dist/reasoning/config.js.map +0 -1
  201. package/dist/reasoning/credentials.d.ts +0 -5
  202. package/dist/reasoning/credentials.d.ts.map +0 -1
  203. package/dist/reasoning/credentials.js +0 -83
  204. package/dist/reasoning/credentials.js.map +0 -1
  205. package/dist/reasoning/login.d.ts +0 -21
  206. package/dist/reasoning/login.d.ts.map +0 -1
  207. package/dist/reasoning/login.js +0 -85
  208. package/dist/reasoning/login.js.map +0 -1
  209. package/dist/reasoning/reasoner.d.ts +0 -43
  210. package/dist/reasoning/reasoner.d.ts.map +0 -1
  211. package/dist/reasoning/reasoner.js +0 -308
  212. package/dist/reasoning/reasoner.js.map +0 -1
  213. package/dist/spec/evolve/llm-client.d.ts +0 -50
  214. package/dist/spec/evolve/llm-client.d.ts.map +0 -1
  215. package/dist/spec/evolve/llm-client.js +0 -176
  216. package/dist/spec/evolve/llm-client.js.map +0 -1
  217. package/dist/spec/evolve/logic-checker.d.ts +0 -12
  218. package/dist/spec/evolve/logic-checker.d.ts.map +0 -1
  219. package/dist/spec/evolve/logic-checker.js +0 -24
  220. package/dist/spec/evolve/logic-checker.js.map +0 -1
  221. package/dist/spec/llm/index.d.ts +0 -3
  222. package/dist/spec/llm/index.d.ts.map +0 -1
  223. package/dist/spec/llm/index.js +0 -11
  224. package/dist/spec/llm/index.js.map +0 -1
  225. package/dist/spec/mining/diff-parser.d.ts +0 -33
  226. package/dist/spec/mining/diff-parser.d.ts.map +0 -1
  227. package/dist/spec/mining/diff-parser.js +0 -166
  228. package/dist/spec/mining/diff-parser.js.map +0 -1
  229. package/dist/spec/mining/git-scanner.d.ts +0 -103
  230. package/dist/spec/mining/git-scanner.d.ts.map +0 -1
  231. package/dist/spec/mining/git-scanner.js +0 -307
  232. package/dist/spec/mining/git-scanner.js.map +0 -1
  233. package/dist/spec/mining/pipeline.d.ts +0 -53
  234. package/dist/spec/mining/pipeline.d.ts.map +0 -1
  235. package/dist/spec/mining/pipeline.js +0 -178
  236. package/dist/spec/mining/pipeline.js.map +0 -1
  237. package/dist/spec/mining/scope-resolver.d.ts +0 -45
  238. package/dist/spec/mining/scope-resolver.d.ts.map +0 -1
  239. package/dist/spec/mining/scope-resolver.js +0 -103
  240. package/dist/spec/mining/scope-resolver.js.map +0 -1
  241. package/dist/spec/mining/spec-extractor.d.ts +0 -69
  242. package/dist/spec/mining/spec-extractor.d.ts.map +0 -1
  243. package/dist/spec/mining/spec-extractor.js +0 -369
  244. package/dist/spec/mining/spec-extractor.js.map +0 -1
  245. package/dist/spec/utils.d.ts +0 -167
  246. package/dist/spec/utils.d.ts.map +0 -1
  247. package/dist/spec/utils.js +0 -463
  248. package/dist/spec/utils.js.map +0 -1
  249. package/dist/telemetry/index.d.ts +0 -143
  250. package/dist/telemetry/index.d.ts.map +0 -1
  251. package/dist/telemetry/index.js +0 -541
  252. package/dist/telemetry/index.js.map +0 -1
  253. package/scripts/_tmp-cfwk-resolve.log +0 -0
  254. package/scripts/_tmp-cfwk-sig.log +0 -0
  255. package/scripts/_tmp-cfwk-vt.log +0 -0
  256. package/scripts/add-lang/bench.sh +0 -60
  257. package/scripts/add-lang/check-grammar.mjs +0 -75
  258. package/scripts/add-lang/dump-ast.mjs +0 -103
  259. package/scripts/add-lang/verify-extraction.mjs +0 -70
  260. package/scripts/agent-eval/ab-adoption.sh +0 -91
  261. package/scripts/agent-eval/ab-hook.sh +0 -86
  262. package/scripts/agent-eval/ab-impl.sh +0 -78
  263. package/scripts/agent-eval/ab-new-vs-baseline.sh +0 -102
  264. package/scripts/agent-eval/ab-sufficiency.sh +0 -78
  265. package/scripts/agent-eval/arms-F.sh +0 -21
  266. package/scripts/agent-eval/arms-matrix.sh +0 -37
  267. package/scripts/agent-eval/audit.sh +0 -68
  268. package/scripts/agent-eval/bench-readme.sh +0 -28
  269. package/scripts/agent-eval/bench-why-repo.sh +0 -22
  270. package/scripts/agent-eval/block-read-hook.sh +0 -19
  271. package/scripts/agent-eval/hook-settings.json +0 -15
  272. package/scripts/agent-eval/itrun.sh +0 -120
  273. package/scripts/agent-eval/offload-eval-3arm.sh +0 -72
  274. package/scripts/agent-eval/offload-eval-cost.mjs +0 -133
  275. package/scripts/agent-eval/offload-eval-effort.mjs +0 -108
  276. package/scripts/agent-eval/offload-eval-frontload-matrix.sh +0 -25
  277. package/scripts/agent-eval/offload-eval-frontload.sh +0 -47
  278. package/scripts/agent-eval/offload-eval-ground-truth.json +0 -18
  279. package/scripts/agent-eval/offload-eval-hook.mjs +0 -84
  280. package/scripts/agent-eval/offload-eval-judge.mjs +0 -103
  281. package/scripts/agent-eval/offload-eval-matrix.sh +0 -20
  282. package/scripts/agent-eval/offload-eval-metrics.mjs +0 -94
  283. package/scripts/agent-eval/offload-eval-refs1.sh +0 -50
  284. package/scripts/agent-eval/offload-eval-setup.sh +0 -24
  285. package/scripts/agent-eval/offload-eval-styles.sh +0 -72
  286. package/scripts/agent-eval/offload-eval-summarize.mjs +0 -68
  287. package/scripts/agent-eval/offload-eval.md +0 -76
  288. package/scripts/agent-eval/parse-arms.mjs +0 -116
  289. package/scripts/agent-eval/parse-bench-readme.mjs +0 -84
  290. package/scripts/agent-eval/parse-run.mjs +0 -45
  291. package/scripts/agent-eval/parse-session.mjs +0 -93
  292. package/scripts/agent-eval/probe-context.mjs +0 -21
  293. package/scripts/agent-eval/probe-explore.mjs +0 -40
  294. package/scripts/agent-eval/probe-node.mjs +0 -20
  295. package/scripts/agent-eval/probe-sweep.mjs +0 -119
  296. package/scripts/agent-eval/probe-trace.mjs +0 -20
  297. package/scripts/agent-eval/redirect-read-hook.sh +0 -38
  298. package/scripts/agent-eval/repro-concurrent-explore.mjs +0 -119
  299. package/scripts/agent-eval/repro-daemon-clients.mjs +0 -125
  300. package/scripts/agent-eval/run-agent.sh +0 -34
  301. package/scripts/agent-eval/run-all.sh +0 -75
  302. package/scripts/agent-eval/run-arms.sh +0 -56
  303. package/scripts/agent-eval/seq-matrix.mjs +0 -137
  304. package/scripts/bench-arkts-init-rss.log +0 -0
  305. package/scripts/build-bundle.sh +0 -123
  306. package/scripts/exp_boundary_eval/README.md +0 -247
  307. package/scripts/exp_boundary_eval/__pycache__/_utils.cpython-310.pyc +0 -0
  308. package/scripts/exp_boundary_eval/__pycache__/_utils.cpython-38.pyc +0 -0
  309. package/scripts/exp_boundary_eval/__pycache__/analyze.cpython-310.pyc +0 -0
  310. package/scripts/exp_boundary_eval/__pycache__/analyze.cpython-38.pyc +0 -0
  311. package/scripts/exp_boundary_eval/__pycache__/deveco_arm.cpython-38.pyc +0 -0
  312. package/scripts/exp_boundary_eval/__pycache__/run_all.cpython-310.pyc +0 -0
  313. package/scripts/exp_boundary_eval/__pycache__/run_all.cpython-38.pyc +0 -0
  314. package/scripts/exp_boundary_eval/__pycache__/run_one.cpython-310.pyc +0 -0
  315. package/scripts/exp_boundary_eval/__pycache__/run_one.cpython-38.pyc +0 -0
  316. package/scripts/exp_boundary_eval/__pycache__/run_session.cpython-310.pyc +0 -0
  317. package/scripts/exp_boundary_eval/__pycache__/run_session.cpython-38.pyc +0 -0
  318. package/scripts/exp_boundary_eval/__pycache__/setup.cpython-310.pyc +0 -0
  319. package/scripts/exp_boundary_eval/__pycache__/setup.cpython-38.pyc +0 -0
  320. package/scripts/exp_boundary_eval/__pycache__/win_mcp_launcher.cpython-38.pyc +0 -0
  321. package/scripts/exp_boundary_eval/_test_mcp_chain.py +0 -78
  322. package/scripts/exp_boundary_eval/_test_stdin.py +0 -8
  323. package/scripts/exp_boundary_eval/_utils.py +0 -1116
  324. package/scripts/exp_boundary_eval/analyze.py +0 -1313
  325. package/scripts/exp_boundary_eval/deveco_arm.py +0 -519
  326. package/scripts/exp_boundary_eval/run_all.py +0 -378
  327. package/scripts/exp_boundary_eval/run_one.py +0 -165
  328. package/scripts/exp_boundary_eval/run_session.py +0 -158
  329. package/scripts/exp_boundary_eval/setup.py +0 -120
  330. package/scripts/exp_boundary_eval/win_mcp_launcher.py +0 -73
  331. package/scripts/exp_boundary_eval/win_mcp_stdio_wrap.js +0 -36
  332. package/scripts/exp_boundary_eval/win_node_launcher.py +0 -24
  333. package/scripts/extract-release-notes.mjs +0 -130
  334. package/scripts/local-install.sh +0 -41
  335. package/scripts/npm-sdk.js +0 -75
  336. package/scripts/npm-shim.js +0 -275
  337. package/scripts/ohos-sdk-publish.mjs +0 -133
  338. package/scripts/pack-npm.sh +0 -119
  339. package/scripts/prepare-release.mjs +0 -270
  340. package/scripts/probe-arkts-mem-why-run.log +0 -0
  341. package/scripts/probe-banner-livecard-ir.log +0 -0
  342. package/scripts/probe-cfwk-ast.stderr.log +0 -0
  343. package/scripts/probe-cfwk-ast.stdout.log +0 -0
  344. package/scripts/probe-cfwk-attr-shape.log +0 -0
  345. package/scripts/probe-cfwk-cfgdump.stderr.log +0 -0
  346. package/scripts/probe-cfwk-cfgdump.stdout.log +0 -0
  347. package/scripts/probe-cfwk-cvc.stderr.log +0 -0
  348. package/scripts/probe-cfwk-cvc.stdout.log +0 -0
  349. package/scripts/probe-cfwk-diag2.log +0 -0
  350. package/scripts/probe-cfwk-diag3.log +0 -0
  351. package/scripts/probe-cfwk-fedbg.stderr.log +0 -0
  352. package/scripts/probe-cfwk-fedbg.stdout.log +0 -0
  353. package/scripts/probe-cfwk-fileresult.log +0 -0
  354. package/scripts/probe-cfwk-fix.stderr.log +0 -0
  355. package/scripts/probe-cfwk-fix.stdout.log +0 -0
  356. package/scripts/probe-cfwk-fix2.stderr.log +0 -0
  357. package/scripts/probe-cfwk-fix2.stdout.log +0 -0
  358. package/scripts/probe-cfwk-fix3.stderr.log +0 -0
  359. package/scripts/probe-cfwk-fix3.stdout.log +0 -0
  360. package/scripts/probe-cfwk-foreach.log +0 -0
  361. package/scripts/probe-cfwk-getmethod-throw.log +0 -0
  362. package/scripts/probe-cfwk-hg-extract.log +0 -0
  363. package/scripts/probe-cfwk-pr1003-noprior.stderr.log +0 -0
  364. package/scripts/probe-cfwk-pr1003-noprior.stdout.log +0 -0
  365. package/scripts/probe-cfwk-pr1003.stderr.log +0 -0
  366. package/scripts/probe-cfwk-pr1003.stdout.log +0 -0
  367. package/scripts/probe-cfwk-preroot-noprior.stderr.log +0 -0
  368. package/scripts/probe-cfwk-preroot-noprior.stdout.log +0 -0
  369. package/scripts/probe-cfwk-preroot-prior.stderr.log +0 -0
  370. package/scripts/probe-cfwk-preroot-prior.stdout.log +0 -0
  371. package/scripts/probe-cfwk-preroot-skipstate.stderr.log +0 -0
  372. package/scripts/probe-cfwk-preroot-skipstate.stdout.log +0 -0
  373. package/scripts/probe-cfwk-resolve-sim.log +0 -0
  374. package/scripts/probe-cfwk-tree-shape.log +0 -0
  375. package/scripts/probe-cfwk-walk-abort.log +0 -0
  376. package/scripts/probe-cfwk.log +0 -0
  377. package/scripts/probe-force-index.log +0 -0
  378. package/scripts/probe-no-force-index.log +0 -0
  379. package/scripts/probe-samefile-ir.stderr.log +0 -0
  380. package/scripts/probe-samefile-ir.stdout.log +0 -224
  381. package/scripts/probe-sdk-vs-project.log +0 -0
  382. package/scripts/probe-viewtree-downgrade.log +0 -0
@@ -1,176 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.LLMClient = void 0;
7
- /**
8
- * Provider-agnostic LLM client for spec self-evolution.
9
- *
10
- * Replaces `commit4spec/utils/llm_client.py`. Supports OpenAI-compatible chat
11
- * completions API with mock mode for testing. Mock responses are consumed
12
- * FIFO: each `setMockResponse` call adds one response, each `chat` call
13
- * consumes one. When the mock queue is empty, pattern-based fallback responses
14
- * are returned.
15
- *
16
- * @module spec/evolve/llm-client
17
- */
18
- const openai_1 = __importDefault(require("openai"));
19
- const errors_1 = require("../../errors");
20
- // =============================================================================
21
- // LLMClient
22
- // =============================================================================
23
- class LLMClient {
24
- config;
25
- mockResponses;
26
- constructor(config) {
27
- this.config = config;
28
- this.mockResponses = [];
29
- }
30
- /**
31
- * Append a mock response to the FIFO queue.
32
- *
33
- * When provider is `"mock"`, `chat()` dequeues the first response.
34
- * Responses are consumed in insertion order; each call to `chat()` removes
35
- * and returns the front element.
36
- */
37
- setMockResponse(_key, response) {
38
- this.mockResponses.push(response);
39
- }
40
- /**
41
- * Clear all mock responses.
42
- */
43
- clearMockResponses() {
44
- this.mockResponses = [];
45
- }
46
- // ===========================================================================
47
- // chat
48
- // ===========================================================================
49
- /**
50
- * Send a chat completion request and return the message content string.
51
- *
52
- * **Mock mode** (`provider === "mock"`):
53
- * 1. If mockResponses has entries, consumes the first one (FIFO).
54
- * 2. Otherwise matches `userPrompt` against known patterns (case-insensitive):
55
- * - `"logic change"` or `"logic_change"` → no-op JSON.
56
- * - `"spec evolution"` or `"evolve"` → UNCHANGED JSON.
57
- * - Default → UNCHANGED JSON.
58
- *
59
- * **OpenAI / Anthropic mode**:
60
- * Calls the OpenAI-compatible chat completions API and returns
61
- * `choices[0].message.content`. On any error, returns an empty string.
62
- */
63
- async chat(systemPrompt, userPrompt) {
64
- // --- Mock mode -------------------------------------------------------
65
- if (this.config.provider === 'mock') {
66
- if (this.mockResponses.length > 0) {
67
- return this.mockResponses.shift();
68
- }
69
- const lower = userPrompt.toLowerCase();
70
- if (lower.includes('logic change') || lower.includes('logic_change')) {
71
- return JSON.stringify({
72
- is_logic_change: false,
73
- reason: 'Mock: no logic change detected',
74
- });
75
- }
76
- if (lower.includes('spec evolution') || lower.includes('evolve')) {
77
- return JSON.stringify({
78
- action: 'UNCHANGED',
79
- reason: 'Mock: no changes needed',
80
- });
81
- }
82
- return JSON.stringify({
83
- action: 'UNCHANGED',
84
- reason: 'Mock: default no-op response',
85
- });
86
- }
87
- // --- OpenAI / Anthropic mode -----------------------------------------
88
- const baseURL = this.config.baseUrl
89
- ? this.config.baseUrl
90
- : this.config.provider === 'anthropic'
91
- ? 'https://api.anthropic.com/v1'
92
- : undefined;
93
- const client = new openai_1.default({
94
- apiKey: this.config.apiKey || 'sk-placeholder',
95
- baseURL,
96
- });
97
- try {
98
- const completion = await client.chat.completions.create({
99
- model: this.config.model,
100
- temperature: this.config.temperature,
101
- max_tokens: this.config.maxTokens,
102
- messages: [
103
- { role: 'system', content: systemPrompt },
104
- { role: 'user', content: userPrompt },
105
- ],
106
- });
107
- const content = completion.choices[0]?.message?.content;
108
- return content ?? '';
109
- }
110
- catch {
111
- return '';
112
- }
113
- }
114
- // ===========================================================================
115
- // chatJson
116
- // ===========================================================================
117
- /**
118
- * Same as `chat()`, but parses the response as JSON.
119
- *
120
- * Parsing strategy (tried in order):
121
- * 1. Direct `JSON.parse(content)`.
122
- * 2. Extract from `` ```json ... ``` `` fenced block.
123
- * 3. Extract from `` ``` ... ``` `` fenced block.
124
- * 4. Fallback: log a debug warning and return `{}`.
125
- *
126
- * Empty or null content from `chat()` also returns `{}`.
127
- */
128
- async chatJson(systemPrompt, userPrompt) {
129
- const raw = await this.chat(systemPrompt, userPrompt);
130
- if (!raw)
131
- return {};
132
- // 1. Direct parse
133
- try {
134
- const parsed = JSON.parse(raw);
135
- if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
136
- return parsed;
137
- }
138
- }
139
- catch {
140
- // Fall through to fence extraction
141
- }
142
- // 2. ```json ... ``` fence
143
- const jsonFenceMatch = /```json\s*([\s\S]*?)```/.exec(raw);
144
- if (jsonFenceMatch) {
145
- try {
146
- const parsed = JSON.parse(jsonFenceMatch[1].trim());
147
- if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
148
- return parsed;
149
- }
150
- }
151
- catch {
152
- // Fall through
153
- }
154
- }
155
- // 3. ``` ... ``` fence
156
- const fenceMatch = /```\s*([\s\S]*?)```/.exec(raw);
157
- if (fenceMatch) {
158
- try {
159
- const parsed = JSON.parse(fenceMatch[1].trim());
160
- if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
161
- return parsed;
162
- }
163
- }
164
- catch {
165
- // Fall through
166
- }
167
- }
168
- // 4. Fallback
169
- (0, errors_1.logDebug)('chatJson: could not parse response as JSON', {
170
- raw: raw.length > 200 ? raw.slice(0, 200) + '…' : raw,
171
- });
172
- return {};
173
- }
174
- }
175
- exports.LLMClient = LLMClient;
176
- //# sourceMappingURL=llm-client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"llm-client.js","sourceRoot":"","sources":["../../../src/spec/evolve/llm-client.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;GAUG;AACH,oDAA4B;AAE5B,yCAAwC;AAWxC,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,MAAa,SAAS;IACZ,MAAM,CAAY;IAClB,aAAa,CAAW;IAEhC,YAAY,MAAiB;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED;;;;;;OAMG;IACH,eAAe,CAAC,IAAY,EAAE,QAAgB;QAC5C,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,kBAAkB;QAChB,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED,8EAA8E;IAC9E,OAAO;IACP,8EAA8E;IAE9E;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,IAAI,CAAC,YAAoB,EAAE,UAAkB;QACjD,wEAAwE;QACxE,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;Y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K,CAAC,cAAc,CAAC,CAAC,CAAE,CAAC,IAAI,EAAE,CAAC,CAAC;gBACrD,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;oBACnE,OAAO,MAAiC,CAAC;gBAC3C,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,eAAe;YACjB,CAAC;QACH,CAAC;QAED,uBAAuB;QACvB,MAAM,UAAU,GAAG,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnD,IAAI,UAAU,EAAE,CAAC;YACf,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAE,CAAC,IAAI,EAAE,CAAC,CAAC;gBACjD,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;oBACnE,OAAO,MAAiC,CAAC;gBAC3C,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,eAAe;YACjB,CAAC;QACH,CAAC;QAED,cAAc;QACd,IAAA,iBAAQ,EAAC,4CAA4C,EAAE;YACrD,GAAG,EAAE,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG;SACtD,CAAC,CAAC;QACH,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAzKD,8BAyKC"}
@@ -1,12 +0,0 @@
1
- import { LlmClient } from '../llm/client';
2
- export interface LogicCheckResult {
3
- isLogic: boolean;
4
- reason: string;
5
- }
6
- /**
7
- * Determine if a commit represents a business-logic change.
8
- * Uses LLM to analyze the commit message and diff.
9
- * If no LLM client is available, returns false.
10
- */
11
- export declare function isLogicChange(commitMessage: string, commitDiff: string, client?: LlmClient): Promise<LogicCheckResult>;
12
- //# sourceMappingURL=logic-checker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logic-checker.d.ts","sourceRoot":"","sources":["../../../src/spec/evolve/logic-checker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI1C,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,SAAS,GACjB,OAAO,CAAC,gBAAgB,CAAC,CAgB3B"}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isLogicChange = isLogicChange;
4
- const prompts_1 = require("../llm/prompts");
5
- const utils_1 = require("../utils");
6
- /**
7
- * Determine if a commit represents a business-logic change.
8
- * Uses LLM to analyze the commit message and diff.
9
- * If no LLM client is available, returns false.
10
- */
11
- async function isLogicChange(commitMessage, commitDiff, client) {
12
- if (!client) {
13
- return { isLogic: false, reason: 'LLM unavailable' };
14
- }
15
- // Truncate diff to 6000 chars for prompt budget
16
- const truncatedDiff = (0, utils_1.truncateText)(commitDiff, 6000);
17
- const userPrompt = (0, prompts_1.buildLogicCheckUserPrompt)(commitMessage, truncatedDiff);
18
- const result = await client.chatJson(prompts_1.LOGIC_CHECK_SYSTEM_PROMPT, userPrompt);
19
- return {
20
- isLogic: result.is_logic_change === true,
21
- reason: typeof result.reason === 'string' ? result.reason : '',
22
- };
23
- }
24
- //# sourceMappingURL=logic-checker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logic-checker.js","sourceRoot":"","sources":["../../../src/spec/evolve/logic-checker.ts"],"names":[],"mappings":";;AAcA,sCAoBC;AAjCD,4CAAsF;AACtF,oCAAwC;AAOxC;;;;GAIG;AACI,KAAK,UAAU,aAAa,CACjC,aAAqB,EACrB,UAAkB,EAClB,MAAkB;IAElB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC;IACvD,CAAC;IAED,gDAAgD;IAChD,MAAM,aAAa,GAAG,IAAA,oBAAY,EAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAErD,MAAM,UAAU,GAAG,IAAA,mCAAyB,EAAC,aAAa,EAAE,aAAa,CAAC,CAAC;IAE3E,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,mCAAyB,EAAE,UAAU,CAAC,CAAC;IAE5E,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,eAAe,KAAK,IAAI;QACxC,MAAM,EAAE,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;KAC/D,CAAC;AACJ,CAAC"}
@@ -1,3 +0,0 @@
1
- export { LlmClient, OpenAiLlmClient } from './client';
2
- export { LOGIC_CHECK_SYSTEM_PROMPT, buildLogicCheckUserPrompt, SPEC_EVALUATION_SYSTEM_PROMPT, buildSpecEvaluationUserPrompt, } from './prompts';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spec/llm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,6BAA6B,EAC7B,6BAA6B,GAC9B,MAAM,WAAW,CAAC"}
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildSpecEvaluationUserPrompt = exports.SPEC_EVALUATION_SYSTEM_PROMPT = exports.buildLogicCheckUserPrompt = exports.LOGIC_CHECK_SYSTEM_PROMPT = exports.OpenAiLlmClient = void 0;
4
- var client_1 = require("./client");
5
- Object.defineProperty(exports, "OpenAiLlmClient", { enumerable: true, get: function () { return client_1.OpenAiLlmClient; } });
6
- var prompts_1 = require("./prompts");
7
- Object.defineProperty(exports, "LOGIC_CHECK_SYSTEM_PROMPT", { enumerable: true, get: function () { return prompts_1.LOGIC_CHECK_SYSTEM_PROMPT; } });
8
- Object.defineProperty(exports, "buildLogicCheckUserPrompt", { enumerable: true, get: function () { return prompts_1.buildLogicCheckUserPrompt; } });
9
- Object.defineProperty(exports, "SPEC_EVALUATION_SYSTEM_PROMPT", { enumerable: true, get: function () { return prompts_1.SPEC_EVALUATION_SYSTEM_PROMPT; } });
10
- Object.defineProperty(exports, "buildSpecEvaluationUserPrompt", { enumerable: true, get: function () { return prompts_1.buildSpecEvaluationUserPrompt; } });
11
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/spec/llm/index.ts"],"names":[],"mappings":";;;AAAA,mCAAsD;AAAlC,yGAAA,eAAe,OAAA;AACnC,qCAKmB;AAJjB,oHAAA,yBAAyB,OAAA;AACzB,oHAAA,yBAAyB,OAAA;AACzB,wHAAA,6BAA6B,OAAA;AAC7B,wHAAA,6BAA6B,OAAA"}
@@ -1,33 +0,0 @@
1
- /**
2
- * Unified diff parser — converts `git diff` output into structured code
3
- * fragments.
4
- *
5
- * Replaces `commit4spec/reverse_engineer/change_analyzer.py`. Parses
6
- * unified diff output and extracts file-level change information (change
7
- * type, line range, diff text).
8
- *
9
- * @module spec/mining/diff-parser
10
- */
11
- export interface DiffFragment {
12
- /** Path of the changed file (no `a/` / `b/` prefix). */
13
- filePath: string;
14
- /** Kind of change: added, modified, or deleted. */
15
- changeType: 'ADD' | 'MODIFY' | 'DELETE';
16
- /** First new-line number in this diff fragment (1-based). */
17
- startLine: number;
18
- /** Last new-line number covered by this fragment (1-based). */
19
- endLine: number;
20
- /** Raw unified diff text for this file. */
21
- codeDiff: string;
22
- }
23
- /**
24
- * Retrieve and parse the diff for a single commit.
25
- *
26
- * 1. Call `getCommitDiff(repoPath, commitHash)` to get raw diff text.
27
- * 2. Parse the diff into structured `DiffFragment` objects.
28
- * 3. Return the fragments.
29
- *
30
- * Returns an empty array when the diff cannot be retrieved or is empty.
31
- */
32
- export declare function analyzeCommitDiff(repoPath: string, commitHash: string, preFetchedDiff?: string): DiffFragment[];
33
- //# sourceMappingURL=diff-parser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"diff-parser.d.ts","sourceRoot":"","sources":["../../../src/spec/mining/diff-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,MAAM,WAAW,YAAY;IAC3B,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,UAAU,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACxC,6DAA6D;IAC7D,SAAS,EAAE,MAAM,CAAC;IAClB,+DAA+D;IAC/D,OAAO,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;CAClB;AAMD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,cAAc,CAAC,EAAE,MAAM,GACtB,YAAY,EAAE,CAMhB"}
@@ -1,166 +0,0 @@
1
- "use strict";
2
- /**
3
- * Unified diff parser — converts `git diff` output into structured code
4
- * fragments.
5
- *
6
- * Replaces `commit4spec/reverse_engineer/change_analyzer.py`. Parses
7
- * unified diff output and extracts file-level change information (change
8
- * type, line range, diff text).
9
- *
10
- * @module spec/mining/diff-parser
11
- */
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.analyzeCommitDiff = analyzeCommitDiff;
14
- const git_scanner_1 = require("./git-scanner");
15
- // ---------------------------------------------------------------------------
16
- // analyzeCommitDiff
17
- // ---------------------------------------------------------------------------
18
- /**
19
- * Retrieve and parse the diff for a single commit.
20
- *
21
- * 1. Call `getCommitDiff(repoPath, commitHash)` to get raw diff text.
22
- * 2. Parse the diff into structured `DiffFragment` objects.
23
- * 3. Return the fragments.
24
- *
25
- * Returns an empty array when the diff cannot be retrieved or is empty.
26
- */
27
- function analyzeCommitDiff(repoPath, commitHash, preFetchedDiff) {
28
- const diff = preFetchedDiff ?? (0, git_scanner_1.getCommitDiff)(repoPath, commitHash);
29
- if (!diff) {
30
- return [];
31
- }
32
- return _parseDiff(diff);
33
- }
34
- // ---------------------------------------------------------------------------
35
- // _parseDiff
36
- // ---------------------------------------------------------------------------
37
- /**
38
- * State-machine parser for unified diff format.
39
- *
40
- * Walks through the diff line-by-line, tracking the current file, change
41
- * type, and line-number range. Accumulates lines into a buffer and emits a
42
- * `DiffFragment` each time a new `diff --git` section begins (or when the
43
- * input is exhausted).
44
- */
45
- function _parseDiff(diff) {
46
- const lines = diff.split('\n');
47
- // ---- state ----
48
- const fragments = [];
49
- let buf = [];
50
- let currentFilePath = null;
51
- let currentChangeType = 'MODIFY';
52
- let currentStartLine = 0;
53
- let currentEndLine = 0;
54
- let inHunk = false;
55
- // ---- flush helper ----
56
- const _flush = () => {
57
- if (buf.length === 0 || currentFilePath === null) {
58
- buf = [];
59
- return;
60
- }
61
- // DELETE files have no lines in the new version — use [0, 0].
62
- let startLine;
63
- let endLine;
64
- if (currentChangeType === 'DELETE') {
65
- startLine = 0;
66
- endLine = 0;
67
- }
68
- else {
69
- // When no hunk was ever encountered, default startLine to 1.
70
- startLine = currentStartLine === 0 ? 1 : currentStartLine;
71
- endLine = currentEndLine;
72
- }
73
- fragments.push({
74
- filePath: currentFilePath,
75
- changeType: currentChangeType,
76
- startLine,
77
- endLine,
78
- codeDiff: buf.join('\n'),
79
- });
80
- buf = [];
81
- };
82
- // ---- line-by-line parser ----
83
- for (const line of lines) {
84
- // Rule 1 — new file section: flush the previous file.
85
- if (line.startsWith('diff --git ')) {
86
- _flush();
87
- buf = [line];
88
- currentFilePath = null;
89
- currentChangeType = 'MODIFY';
90
- currentStartLine = 0;
91
- currentEndLine = 0;
92
- inHunk = false;
93
- continue;
94
- }
95
- // Rule 2 — new file mode → change type is ADD.
96
- if (line.startsWith('new file mode ')) {
97
- currentChangeType = 'ADD';
98
- buf.push(line);
99
- continue;
100
- }
101
- // Rule 3 — deleted file mode → change type is DELETE.
102
- if (line.startsWith('deleted file mode ')) {
103
- currentChangeType = 'DELETE';
104
- buf.push(line);
105
- continue;
106
- }
107
- // Rule 4 — file path lines (--- a/path or +++ b/path).
108
- if (line.startsWith('--- a/') || line.startsWith('+++ b/')) {
109
- const isPlus = line.startsWith('+++ b/');
110
- // Extract the path, skipping `/dev/null`.
111
- let pathPart = '';
112
- if (isPlus) {
113
- pathPart = line.slice(6); // '+++ b/'.length
114
- }
115
- else {
116
- pathPart = line.slice(6); // '--- a/'.length
117
- }
118
- if (pathPart !== '/dev/null') {
119
- currentFilePath = pathPart;
120
- }
121
- buf.push(line);
122
- continue;
123
- }
124
- // Rule 5 — hunk header: @@ -oldStart[,oldCount] +newStart[,newCount] @@
125
- const hunkMatch = line.match(/^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/);
126
- if (hunkMatch) {
127
- const newStart = parseInt(hunkMatch[1], 10);
128
- if (currentStartLine === 0) {
129
- currentStartLine = newStart;
130
- }
131
- currentEndLine = newStart;
132
- inHunk = true;
133
- buf.push(line);
134
- continue;
135
- }
136
- // Rule 6 — added lines (start with '+', but not '+++').
137
- if (line.startsWith('+') && !line.startsWith('+++')) {
138
- if (inHunk) {
139
- currentEndLine++;
140
- }
141
- buf.push(line);
142
- continue;
143
- }
144
- // Rule 7 — removed lines (start with '-', but not '---').
145
- if (line.startsWith('-') && !line.startsWith('---')) {
146
- buf.push(line);
147
- continue;
148
- }
149
- // Rule 8 — context lines (start with a space).
150
- if (line.startsWith(' ')) {
151
- if (inHunk) {
152
- currentEndLine++;
153
- }
154
- buf.push(line);
155
- continue;
156
- }
157
- // Rule 9 — all other lines (e.g. `rename from` / `rename to`,
158
- // `similarity index`, `Binary files differ`, `\ No newline at end of
159
- // file`, blank lines between sections, etc.).
160
- buf.push(line);
161
- }
162
- // Flush the final file.
163
- _flush();
164
- return fragments;
165
- }
166
- //# sourceMappingURL=diff-parser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"diff-parser.js","sourceRoot":"","sources":["../../../src/spec/mining/diff-parser.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAkCH,8CAUC;AA1CD,+CAA8C;AAmB9C,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E;;;;;;;;GAQG;AACH,SAAgB,iBAAiB,CAC/B,QAAgB,EAChB,UAAkB,EAClB,cAAuB;IAEvB,MAAM,IAAI,GAAG,cAAc,IAAI,IAAA,2BAAa,EAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACnE,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E;;;;;;;GAOG;AACH,SAAS,UAAU,CAAC,IAAY;IAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE/B,kBAAkB;IAClB,MAAM,SAAS,GAAmB,EAAE,CAAC;IACrC,IAAI,GAAG,GAAa,EAAE,CAAC;IACvB,IAAI,eAAe,GAAkB,IAAI,CAAC;IAC1C,IAAI,iBAAiB,GAAgC,QAAQ,CAAC;IAC9D,IAAI,gBAAgB,GAAG,CAAC,CAAC;IACzB,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,IAAI,MAAM,GAAG,KAAK,CAAC;IAEnB,yBAAyB;IACzB,MAAM,MAAM,GAAG,GAAS,EAAE;QACxB,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,eAAe,KAA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AAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YACpD,IAAI,MAAM,EAAE,CAAC;gBACX,cAAc,EAAE,CAAC;YACnB,CAAC;YACD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACf,SAAS;QACX,CAAC;QAED,0DAA0D;QAC1D,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YACpD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACf,SAAS;QACX,CAAC;QAED,+CAA+C;QAC/C,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,IAAI,MAAM,EAAE,CAAC;gBACX,cAAc,EAAE,CAAC;YACnB,CAAC;YACD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACf,SAAS;QACX,CAAC;QAED,8DAA8D;QAC9D,qEAAqE;QACrE,8CAA8C;QAC9C,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC;IAED,wBAAwB;IACxB,MAAM,EAAE,CAAC;IAET,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -1,103 +0,0 @@
1
- /**
2
- * Git commit history scanning and spec↔commit pairing.
3
- *
4
- * Replaces `commit4spec/reverse_engineer/git_scanner.py` and
5
- * `commit4spec/reverse_engineer/git_utils.py`. Discovers spec↔commit pairs via
6
- * two strategies:
7
- *
8
- * - **Strategy A — commit message scope:** extract conventional-commit scopes
9
- * from commit messages and resolve them to spec IDs on disk.
10
- * - **Strategy B — commit-info.md:** discover specs on disk, read their
11
- * `commit-info.md` for linked commit hashes, and verify those commits exist.
12
- *
13
- * All Git operations use `execFileSync` with an args array (never template
14
- * strings) to avoid shell injection risks — matching the HomeGraph convention
15
- * in `src/sync/git-hooks.ts` and `src/sync/worktree.ts`.
16
- *
17
- * @module spec/mining/git-scanner
18
- */
19
- import { SpecConfig } from '../config';
20
- import { SpecMetadata } from './spec-extractor';
21
- export interface CommitInfo {
22
- /** Full 40-char commit hash */
23
- hash: string;
24
- /** First line of commit message */
25
- message: string;
26
- /** Author name */
27
- author: string;
28
- /** Unix epoch milliseconds */
29
- timestamp: number;
30
- }
31
- export interface SpecCommitPair {
32
- specId: string;
33
- commitHash: string;
34
- specMetadata: SpecMetadata | null;
35
- commitMetadata: CommitInfo | null;
36
- }
37
- /**
38
- * Check whether `repoPath` is a git repository.
39
- *
40
- * Runs `git rev-parse --git-dir` and returns `true` on success, `false`
41
- * when the command fails (not a repo, git not installed, etc.).
42
- */
43
- export declare function isGitRepo(repoPath: string): boolean;
44
- /**
45
- * Return every commit in `repoPath` as `CommitInfo` objects.
46
- *
47
- * Runs `git log --format='%H%n%aI%n%an%n%s%n---END---'` and parses the
48
- * output one five-line block per commit. Commits are returned in reverse
49
- * chronological order (most recent first), matching Git's default.
50
- *
51
- * An empty repo yields an empty array.
52
- */
53
- export declare function getAllCommits(repoPath: string): CommitInfo[];
54
- /**
55
- * Retrieve metadata for a single commit.
56
- *
57
- * Runs `git show -s --format='%H%n%aI%n%an%n%s' <commitHash>`. Returns
58
- * `null` when the command fails (hash not found, invalid repo, etc.).
59
- */
60
- export declare function getCommitInfo(repoPath: string, commitHash: string): CommitInfo | null;
61
- /**
62
- * Return the full unified diff introduced by `commitHash`.
63
- *
64
- * Strategy:
65
- * 1. Query the parent hash(es) via `git log --pretty=%P -n 1 <commitHash>`.
66
- * 2. If a parent exists, diff it against the commit: `git diff <parent> <commitHash>`.
67
- * 3. For an initial (root) commit with no parent, use `git diff <commitHash>`
68
- * which shows all files added in that commit.
69
- *
70
- * Returns an empty string when any Git command fails.
71
- */
72
- export declare function getCommitDiff(repoPath: string, commitHash: string): string;
73
- /**
74
- * Return every commit between `fromHash` (exclusive) and `toHash`
75
- * (inclusive) in chronological order (oldest first).
76
- *
77
- * Runs `git log --reverse --format="..." fromHash..toHash`. Returns an empty
78
- * array when either hash is not found or the range is empty.
79
- *
80
- * Callers should validate that `fromHash` is an ancestor of `toHash` before
81
- * calling this function (use `git merge-base --is-ancestor`). Results are
82
- * undefined when the two hashes are on unrelated branches.
83
- */
84
- export declare function getCommitRange(repoPath: string, fromHash: string, toHash: string): CommitInfo[];
85
- /**
86
- * Main scanning function — discovers spec↔commit pairs using two strategies.
87
- *
88
- * **Strategy A — commit message scope:**
89
- * Iterates every commit in the repo, extracts a conventional-commit scope from
90
- * its message, normalizes it, and checks whether the resulting spec ID exists
91
- * on disk. When a match is found the pair is recorded with full spec and
92
- * commit metadata.
93
- *
94
- * **Strategy B — commit-info.md:**
95
- * Discovers all specs on disk that were **not** already paired by Strategy A,
96
- * reads their metadata (which may include a commit hash from `commit-info.md`),
97
- * and verifies the commit exists in the repo. Verified pairs are added.
98
- *
99
- * Duplicates (identical specId + commitHash) are de-duplicated via a
100
- * `Map` keyed on `"${specId}|${commitHash}"`.
101
- */
102
- export declare function scan(repoPath: string, specStoragePath: string, config: SpecConfig): SpecCommitPair[];
103
- //# sourceMappingURL=git-scanner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git-scanner.d.ts","sourceRoot":"","sources":["../../../src/spec/mining/git-scanner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvC,OAAO,EAAuB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAOrE,MAAM,WAAW,UAAU;IACzB,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC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