optave-codegraph 3.13.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 (1672) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +984 -0
  3. package/dist/ast-analysis/engine.d.ts +19 -0
  4. package/dist/ast-analysis/engine.d.ts.map +1 -0
  5. package/dist/ast-analysis/engine.js +660 -0
  6. package/dist/ast-analysis/engine.js.map +1 -0
  7. package/dist/ast-analysis/metrics.d.ts +34 -0
  8. package/dist/ast-analysis/metrics.d.ts.map +1 -0
  9. package/dist/ast-analysis/metrics.js +123 -0
  10. package/dist/ast-analysis/metrics.js.map +1 -0
  11. package/dist/ast-analysis/rules/b2.d.ts +7 -0
  12. package/dist/ast-analysis/rules/b2.d.ts.map +1 -0
  13. package/dist/ast-analysis/rules/b2.js +240 -0
  14. package/dist/ast-analysis/rules/b2.js.map +1 -0
  15. package/dist/ast-analysis/rules/b3.d.ts +6 -0
  16. package/dist/ast-analysis/rules/b3.d.ts.map +1 -0
  17. package/dist/ast-analysis/rules/b3.js +105 -0
  18. package/dist/ast-analysis/rules/b3.js.map +1 -0
  19. package/dist/ast-analysis/rules/b4.d.ts +9 -0
  20. package/dist/ast-analysis/rules/b4.d.ts.map +1 -0
  21. package/dist/ast-analysis/rules/b4.js +361 -0
  22. package/dist/ast-analysis/rules/b4.js.map +1 -0
  23. package/dist/ast-analysis/rules/b5.d.ts +4 -0
  24. package/dist/ast-analysis/rules/b5.d.ts.map +1 -0
  25. package/dist/ast-analysis/rules/b5.js +52 -0
  26. package/dist/ast-analysis/rules/b5.js.map +1 -0
  27. package/dist/ast-analysis/rules/c.d.ts +4 -0
  28. package/dist/ast-analysis/rules/c.d.ts.map +1 -0
  29. package/dist/ast-analysis/rules/c.js +143 -0
  30. package/dist/ast-analysis/rules/c.js.map +1 -0
  31. package/dist/ast-analysis/rules/csharp.d.ts +7 -0
  32. package/dist/ast-analysis/rules/csharp.d.ts.map +1 -0
  33. package/dist/ast-analysis/rules/csharp.js +196 -0
  34. package/dist/ast-analysis/rules/csharp.js.map +1 -0
  35. package/dist/ast-analysis/rules/go.d.ts +7 -0
  36. package/dist/ast-analysis/rules/go.d.ts.map +1 -0
  37. package/dist/ast-analysis/rules/go.js +173 -0
  38. package/dist/ast-analysis/rules/go.js.map +1 -0
  39. package/dist/ast-analysis/rules/index.d.ts +13 -0
  40. package/dist/ast-analysis/rules/index.d.ts.map +1 -0
  41. package/dist/ast-analysis/rules/index.js +325 -0
  42. package/dist/ast-analysis/rules/index.js.map +1 -0
  43. package/dist/ast-analysis/rules/java.d.ts +7 -0
  44. package/dist/ast-analysis/rules/java.d.ts.map +1 -0
  45. package/dist/ast-analysis/rules/java.js +167 -0
  46. package/dist/ast-analysis/rules/java.js.map +1 -0
  47. package/dist/ast-analysis/rules/javascript.d.ts +7 -0
  48. package/dist/ast-analysis/rules/javascript.d.ts.map +1 -0
  49. package/dist/ast-analysis/rules/javascript.js +233 -0
  50. package/dist/ast-analysis/rules/javascript.js.map +1 -0
  51. package/dist/ast-analysis/rules/php.d.ts +7 -0
  52. package/dist/ast-analysis/rules/php.d.ts.map +1 -0
  53. package/dist/ast-analysis/rules/php.js +212 -0
  54. package/dist/ast-analysis/rules/php.js.map +1 -0
  55. package/dist/ast-analysis/rules/python.d.ts +7 -0
  56. package/dist/ast-analysis/rules/python.d.ts.map +1 -0
  57. package/dist/ast-analysis/rules/python.js +189 -0
  58. package/dist/ast-analysis/rules/python.js.map +1 -0
  59. package/dist/ast-analysis/rules/ruby.d.ts +7 -0
  60. package/dist/ast-analysis/rules/ruby.d.ts.map +1 -0
  61. package/dist/ast-analysis/rules/ruby.js +193 -0
  62. package/dist/ast-analysis/rules/ruby.js.map +1 -0
  63. package/dist/ast-analysis/rules/rust.d.ts +7 -0
  64. package/dist/ast-analysis/rules/rust.d.ts.map +1 -0
  65. package/dist/ast-analysis/rules/rust.js +166 -0
  66. package/dist/ast-analysis/rules/rust.js.map +1 -0
  67. package/dist/ast-analysis/shared.d.ts +12 -0
  68. package/dist/ast-analysis/shared.d.ts.map +1 -0
  69. package/dist/ast-analysis/shared.js +166 -0
  70. package/dist/ast-analysis/shared.js.map +1 -0
  71. package/dist/ast-analysis/visitor-utils.d.ts +70 -0
  72. package/dist/ast-analysis/visitor-utils.d.ts.map +1 -0
  73. package/dist/ast-analysis/visitor-utils.js +235 -0
  74. package/dist/ast-analysis/visitor-utils.js.map +1 -0
  75. package/dist/ast-analysis/visitor.d.ts +27 -0
  76. package/dist/ast-analysis/visitor.d.ts.map +1 -0
  77. package/dist/ast-analysis/visitor.js +178 -0
  78. package/dist/ast-analysis/visitor.js.map +1 -0
  79. package/dist/ast-analysis/visitors/ast-store-visitor.d.ts +4 -0
  80. package/dist/ast-analysis/visitors/ast-store-visitor.d.ts.map +1 -0
  81. package/dist/ast-analysis/visitors/ast-store-visitor.js +288 -0
  82. package/dist/ast-analysis/visitors/ast-store-visitor.js.map +1 -0
  83. package/dist/ast-analysis/visitors/cfg-conditionals.d.ts +5 -0
  84. package/dist/ast-analysis/visitors/cfg-conditionals.d.ts.map +1 -0
  85. package/dist/ast-analysis/visitors/cfg-conditionals.js +166 -0
  86. package/dist/ast-analysis/visitors/cfg-conditionals.js.map +1 -0
  87. package/dist/ast-analysis/visitors/cfg-loops.d.ts +7 -0
  88. package/dist/ast-analysis/visitors/cfg-loops.d.ts.map +1 -0
  89. package/dist/ast-analysis/visitors/cfg-loops.js +73 -0
  90. package/dist/ast-analysis/visitors/cfg-loops.js.map +1 -0
  91. package/dist/ast-analysis/visitors/cfg-shared.d.ts +56 -0
  92. package/dist/ast-analysis/visitors/cfg-shared.d.ts.map +1 -0
  93. package/dist/ast-analysis/visitors/cfg-shared.js +107 -0
  94. package/dist/ast-analysis/visitors/cfg-shared.js.map +1 -0
  95. package/dist/ast-analysis/visitors/cfg-try-catch.d.ts +4 -0
  96. package/dist/ast-analysis/visitors/cfg-try-catch.d.ts.map +1 -0
  97. package/dist/ast-analysis/visitors/cfg-try-catch.js +100 -0
  98. package/dist/ast-analysis/visitors/cfg-try-catch.js.map +1 -0
  99. package/dist/ast-analysis/visitors/cfg-visitor.d.ts +5 -0
  100. package/dist/ast-analysis/visitors/cfg-visitor.d.ts.map +1 -0
  101. package/dist/ast-analysis/visitors/cfg-visitor.js +231 -0
  102. package/dist/ast-analysis/visitors/cfg-visitor.js.map +1 -0
  103. package/dist/ast-analysis/visitors/complexity-visitor.d.ts +8 -0
  104. package/dist/ast-analysis/visitors/complexity-visitor.d.ts.map +1 -0
  105. package/dist/ast-analysis/visitors/complexity-visitor.js +233 -0
  106. package/dist/ast-analysis/visitors/complexity-visitor.js.map +1 -0
  107. package/dist/ast-analysis/visitors/dataflow-visitor.d.ts +5 -0
  108. package/dist/ast-analysis/visitors/dataflow-visitor.d.ts.map +1 -0
  109. package/dist/ast-analysis/visitors/dataflow-visitor.js +378 -0
  110. package/dist/ast-analysis/visitors/dataflow-visitor.js.map +1 -0
  111. package/dist/cli/commands/ast.d.ts +3 -0
  112. package/dist/cli/commands/ast.d.ts.map +1 -0
  113. package/dist/cli/commands/ast.js +23 -0
  114. package/dist/cli/commands/ast.js.map +1 -0
  115. package/dist/cli/commands/audit.d.ts +3 -0
  116. package/dist/cli/commands/audit.d.ts.map +1 -0
  117. package/dist/cli/commands/audit.js +47 -0
  118. package/dist/cli/commands/audit.js.map +1 -0
  119. package/dist/cli/commands/batch.d.ts +3 -0
  120. package/dist/cli/commands/batch.d.ts.map +1 -0
  121. package/dist/cli/commands/batch.js +66 -0
  122. package/dist/cli/commands/batch.js.map +1 -0
  123. package/dist/cli/commands/branch-compare.d.ts +3 -0
  124. package/dist/cli/commands/branch-compare.d.ts.map +1 -0
  125. package/dist/cli/commands/branch-compare.js +26 -0
  126. package/dist/cli/commands/branch-compare.js.map +1 -0
  127. package/dist/cli/commands/brief.d.ts +3 -0
  128. package/dist/cli/commands/brief.d.ts.map +1 -0
  129. package/dist/cli/commands/brief.js +12 -0
  130. package/dist/cli/commands/brief.js.map +1 -0
  131. package/dist/cli/commands/build.d.ts +3 -0
  132. package/dist/cli/commands/build.d.ts.map +1 -0
  133. package/dist/cli/commands/build.js +33 -0
  134. package/dist/cli/commands/build.js.map +1 -0
  135. package/dist/cli/commands/cfg.d.ts +3 -0
  136. package/dist/cli/commands/cfg.d.ts.map +1 -0
  137. package/dist/cli/commands/cfg.js +27 -0
  138. package/dist/cli/commands/cfg.js.map +1 -0
  139. package/dist/cli/commands/check.d.ts +3 -0
  140. package/dist/cli/commands/check.d.ts.map +1 -0
  141. package/dist/cli/commands/check.js +65 -0
  142. package/dist/cli/commands/check.js.map +1 -0
  143. package/dist/cli/commands/children.d.ts +3 -0
  144. package/dist/cli/commands/children.d.ts.map +1 -0
  145. package/dist/cli/commands/children.js +33 -0
  146. package/dist/cli/commands/children.js.map +1 -0
  147. package/dist/cli/commands/co-change.d.ts +3 -0
  148. package/dist/cli/commands/co-change.d.ts.map +1 -0
  149. package/dist/cli/commands/co-change.js +66 -0
  150. package/dist/cli/commands/co-change.js.map +1 -0
  151. package/dist/cli/commands/communities.d.ts +3 -0
  152. package/dist/cli/commands/communities.d.ts.map +1 -0
  153. package/dist/cli/commands/communities.js +20 -0
  154. package/dist/cli/commands/communities.js.map +1 -0
  155. package/dist/cli/commands/complexity.d.ts +3 -0
  156. package/dist/cli/commands/complexity.d.ts.map +1 -0
  157. package/dist/cli/commands/complexity.js +47 -0
  158. package/dist/cli/commands/complexity.js.map +1 -0
  159. package/dist/cli/commands/config.d.ts +3 -0
  160. package/dist/cli/commands/config.d.ts.map +1 -0
  161. package/dist/cli/commands/config.js +275 -0
  162. package/dist/cli/commands/config.js.map +1 -0
  163. package/dist/cli/commands/context.d.ts +3 -0
  164. package/dist/cli/commands/context.d.ts.map +1 -0
  165. package/dist/cli/commands/context.js +35 -0
  166. package/dist/cli/commands/context.js.map +1 -0
  167. package/dist/cli/commands/cycles.d.ts +3 -0
  168. package/dist/cli/commands/cycles.d.ts.map +1 -0
  169. package/dist/cli/commands/cycles.js +33 -0
  170. package/dist/cli/commands/cycles.js.map +1 -0
  171. package/dist/cli/commands/dataflow.d.ts +3 -0
  172. package/dist/cli/commands/dataflow.d.ts.map +1 -0
  173. package/dist/cli/commands/dataflow.js +29 -0
  174. package/dist/cli/commands/dataflow.js.map +1 -0
  175. package/dist/cli/commands/deps.d.ts +3 -0
  176. package/dist/cli/commands/deps.d.ts.map +1 -0
  177. package/dist/cli/commands/deps.js +18 -0
  178. package/dist/cli/commands/deps.js.map +1 -0
  179. package/dist/cli/commands/diff-impact.d.ts +3 -0
  180. package/dist/cli/commands/diff-impact.d.ts.map +1 -0
  181. package/dist/cli/commands/diff-impact.js +29 -0
  182. package/dist/cli/commands/diff-impact.js.map +1 -0
  183. package/dist/cli/commands/embed.d.ts +3 -0
  184. package/dist/cli/commands/embed.d.ts.map +1 -0
  185. package/dist/cli/commands/embed.js +75 -0
  186. package/dist/cli/commands/embed.js.map +1 -0
  187. package/dist/cli/commands/export.d.ts +3 -0
  188. package/dist/cli/commands/export.d.ts.map +1 -0
  189. package/dist/cli/commands/export.js +72 -0
  190. package/dist/cli/commands/export.js.map +1 -0
  191. package/dist/cli/commands/exports.d.ts +3 -0
  192. package/dist/cli/commands/exports.d.ts.map +1 -0
  193. package/dist/cli/commands/exports.js +14 -0
  194. package/dist/cli/commands/exports.js.map +1 -0
  195. package/dist/cli/commands/flow.d.ts +3 -0
  196. package/dist/cli/commands/flow.d.ts.map +1 -0
  197. package/dist/cli/commands/flow.js +32 -0
  198. package/dist/cli/commands/flow.js.map +1 -0
  199. package/dist/cli/commands/fn-impact.d.ts +3 -0
  200. package/dist/cli/commands/fn-impact.d.ts.map +1 -0
  201. package/dist/cli/commands/fn-impact.js +33 -0
  202. package/dist/cli/commands/fn-impact.js.map +1 -0
  203. package/dist/cli/commands/impact.d.ts +3 -0
  204. package/dist/cli/commands/impact.d.ts.map +1 -0
  205. package/dist/cli/commands/impact.js +12 -0
  206. package/dist/cli/commands/impact.js.map +1 -0
  207. package/dist/cli/commands/implementations.d.ts +3 -0
  208. package/dist/cli/commands/implementations.d.ts.map +1 -0
  209. package/dist/cli/commands/implementations.js +29 -0
  210. package/dist/cli/commands/implementations.js.map +1 -0
  211. package/dist/cli/commands/info.d.ts +3 -0
  212. package/dist/cli/commands/info.d.ts.map +1 -0
  213. package/dist/cli/commands/info.js +67 -0
  214. package/dist/cli/commands/info.js.map +1 -0
  215. package/dist/cli/commands/interfaces.d.ts +3 -0
  216. package/dist/cli/commands/interfaces.d.ts.map +1 -0
  217. package/dist/cli/commands/interfaces.js +29 -0
  218. package/dist/cli/commands/interfaces.js.map +1 -0
  219. package/dist/cli/commands/map.d.ts +3 -0
  220. package/dist/cli/commands/map.d.ts.map +1 -0
  221. package/dist/cli/commands/map.js +19 -0
  222. package/dist/cli/commands/map.js.map +1 -0
  223. package/dist/cli/commands/mcp.d.ts +3 -0
  224. package/dist/cli/commands/mcp.d.ts.map +1 -0
  225. package/dist/cli/commands/mcp.js +18 -0
  226. package/dist/cli/commands/mcp.js.map +1 -0
  227. package/dist/cli/commands/models.d.ts +3 -0
  228. package/dist/cli/commands/models.d.ts.map +1 -0
  229. package/dist/cli/commands/models.js +19 -0
  230. package/dist/cli/commands/models.js.map +1 -0
  231. package/dist/cli/commands/owners.d.ts +3 -0
  232. package/dist/cli/commands/owners.d.ts.map +1 -0
  233. package/dist/cli/commands/owners.js +27 -0
  234. package/dist/cli/commands/owners.js.map +1 -0
  235. package/dist/cli/commands/path.d.ts +3 -0
  236. package/dist/cli/commands/path.d.ts.map +1 -0
  237. package/dist/cli/commands/path.js +41 -0
  238. package/dist/cli/commands/path.js.map +1 -0
  239. package/dist/cli/commands/plot.d.ts +3 -0
  240. package/dist/cli/commands/plot.d.ts.map +1 -0
  241. package/dist/cli/commands/plot.js +96 -0
  242. package/dist/cli/commands/plot.js.map +1 -0
  243. package/dist/cli/commands/query.d.ts +3 -0
  244. package/dist/cli/commands/query.d.ts.map +1 -0
  245. package/dist/cli/commands/query.js +51 -0
  246. package/dist/cli/commands/query.js.map +1 -0
  247. package/dist/cli/commands/registry.d.ts +3 -0
  248. package/dist/cli/commands/registry.d.ts.map +1 -0
  249. package/dist/cli/commands/registry.js +95 -0
  250. package/dist/cli/commands/registry.js.map +1 -0
  251. package/dist/cli/commands/roles.d.ts +3 -0
  252. package/dist/cli/commands/roles.d.ts.map +1 -0
  253. package/dist/cli/commands/roles.js +36 -0
  254. package/dist/cli/commands/roles.js.map +1 -0
  255. package/dist/cli/commands/search.d.ts +3 -0
  256. package/dist/cli/commands/search.d.ts.map +1 -0
  257. package/dist/cli/commands/search.js +43 -0
  258. package/dist/cli/commands/search.js.map +1 -0
  259. package/dist/cli/commands/sequence.d.ts +3 -0
  260. package/dist/cli/commands/sequence.d.ts.map +1 -0
  261. package/dist/cli/commands/sequence.js +29 -0
  262. package/dist/cli/commands/sequence.js.map +1 -0
  263. package/dist/cli/commands/snapshot.d.ts +3 -0
  264. package/dist/cli/commands/snapshot.d.ts.map +1 -0
  265. package/dist/cli/commands/snapshot.js +61 -0
  266. package/dist/cli/commands/snapshot.js.map +1 -0
  267. package/dist/cli/commands/stats.d.ts +3 -0
  268. package/dist/cli/commands/stats.d.ts.map +1 -0
  269. package/dist/cli/commands/stats.js +15 -0
  270. package/dist/cli/commands/stats.js.map +1 -0
  271. package/dist/cli/commands/structure.d.ts +3 -0
  272. package/dist/cli/commands/structure.d.ts.map +1 -0
  273. package/dist/cli/commands/structure.js +50 -0
  274. package/dist/cli/commands/structure.js.map +1 -0
  275. package/dist/cli/commands/triage.d.ts +3 -0
  276. package/dist/cli/commands/triage.d.ts.map +1 -0
  277. package/dist/cli/commands/triage.js +89 -0
  278. package/dist/cli/commands/triage.js.map +1 -0
  279. package/dist/cli/commands/watch.d.ts +3 -0
  280. package/dist/cli/commands/watch.d.ts.map +1 -0
  281. package/dist/cli/commands/watch.js +28 -0
  282. package/dist/cli/commands/watch.js.map +1 -0
  283. package/dist/cli/commands/where.d.ts +3 -0
  284. package/dist/cli/commands/where.d.ts.map +1 -0
  285. package/dist/cli/commands/where.js +20 -0
  286. package/dist/cli/commands/where.js.map +1 -0
  287. package/dist/cli/index.d.ts +22 -0
  288. package/dist/cli/index.d.ts.map +1 -0
  289. package/dist/cli/index.js +139 -0
  290. package/dist/cli/index.js.map +1 -0
  291. package/dist/cli/shared/open-graph.d.ts +11 -0
  292. package/dist/cli/shared/open-graph.d.ts.map +1 -0
  293. package/dist/cli/shared/open-graph.js +9 -0
  294. package/dist/cli/shared/open-graph.js.map +1 -0
  295. package/dist/cli/shared/options.d.ts +25 -0
  296. package/dist/cli/shared/options.d.ts.map +1 -0
  297. package/dist/cli/shared/options.js +66 -0
  298. package/dist/cli/shared/options.js.map +1 -0
  299. package/dist/cli/shared/output.d.ts +2 -0
  300. package/dist/cli/shared/output.d.ts.map +1 -0
  301. package/dist/cli/shared/output.js +2 -0
  302. package/dist/cli/shared/output.js.map +1 -0
  303. package/dist/cli/types.d.ts +32 -0
  304. package/dist/cli/types.d.ts.map +1 -0
  305. package/dist/cli/types.js +2 -0
  306. package/dist/cli/types.js.map +1 -0
  307. package/dist/cli.d.ts +3 -0
  308. package/dist/cli.d.ts.map +1 -0
  309. package/dist/cli.js +38 -0
  310. package/dist/cli.js.map +1 -0
  311. package/dist/db/better-sqlite3.d.ts +4 -0
  312. package/dist/db/better-sqlite3.d.ts.map +1 -0
  313. package/dist/db/better-sqlite3.js +19 -0
  314. package/dist/db/better-sqlite3.js.map +1 -0
  315. package/dist/db/connection.d.ts +82 -0
  316. package/dist/db/connection.d.ts.map +1 -0
  317. package/dist/db/connection.js +444 -0
  318. package/dist/db/connection.js.map +1 -0
  319. package/dist/db/index.d.ts +6 -0
  320. package/dist/db/index.d.ts.map +1 -0
  321. package/dist/db/index.js +6 -0
  322. package/dist/db/index.js.map +1 -0
  323. package/dist/db/migrations.d.ts +11 -0
  324. package/dist/db/migrations.d.ts.map +1 -0
  325. package/dist/db/migrations.js +416 -0
  326. package/dist/db/migrations.js.map +1 -0
  327. package/dist/db/query-builder.d.ts +88 -0
  328. package/dist/db/query-builder.d.ts.map +1 -0
  329. package/dist/db/query-builder.js +321 -0
  330. package/dist/db/query-builder.js.map +1 -0
  331. package/dist/db/repository/base.d.ts +103 -0
  332. package/dist/db/repository/base.d.ts.map +1 -0
  333. package/dist/db/repository/base.js +172 -0
  334. package/dist/db/repository/base.js.map +1 -0
  335. package/dist/db/repository/build-stmts.d.ts +16 -0
  336. package/dist/db/repository/build-stmts.d.ts.map +1 -0
  337. package/dist/db/repository/build-stmts.js +76 -0
  338. package/dist/db/repository/build-stmts.js.map +1 -0
  339. package/dist/db/repository/cached-stmt.d.ts +9 -0
  340. package/dist/db/repository/cached-stmt.d.ts.map +1 -0
  341. package/dist/db/repository/cached-stmt.js +15 -0
  342. package/dist/db/repository/cached-stmt.js.map +1 -0
  343. package/dist/db/repository/cfg.d.ts +34 -0
  344. package/dist/db/repository/cfg.d.ts.map +1 -0
  345. package/dist/db/repository/cfg.js +46 -0
  346. package/dist/db/repository/cfg.js.map +1 -0
  347. package/dist/db/repository/cochange.d.ts +14 -0
  348. package/dist/db/repository/cochange.d.ts.map +1 -0
  349. package/dist/db/repository/cochange.js +38 -0
  350. package/dist/db/repository/cochange.js.map +1 -0
  351. package/dist/db/repository/complexity.d.ts +7 -0
  352. package/dist/db/repository/complexity.d.ts.map +1 -0
  353. package/dist/db/repository/complexity.js +12 -0
  354. package/dist/db/repository/complexity.js.map +1 -0
  355. package/dist/db/repository/dataflow.d.ts +11 -0
  356. package/dist/db/repository/dataflow.d.ts.map +1 -0
  357. package/dist/db/repository/dataflow.js +30 -0
  358. package/dist/db/repository/dataflow.js.map +1 -0
  359. package/dist/db/repository/edges.d.ts +66 -0
  360. package/dist/db/repository/edges.d.ts.map +1 -0
  361. package/dist/db/repository/edges.js +175 -0
  362. package/dist/db/repository/edges.js.map +1 -0
  363. package/dist/db/repository/embeddings.d.ts +14 -0
  364. package/dist/db/repository/embeddings.d.ts.map +1 -0
  365. package/dist/db/repository/embeddings.js +40 -0
  366. package/dist/db/repository/embeddings.js.map +1 -0
  367. package/dist/db/repository/graph-read.d.ts +18 -0
  368. package/dist/db/repository/graph-read.d.ts.map +1 -0
  369. package/dist/db/repository/graph-read.js +33 -0
  370. package/dist/db/repository/graph-read.js.map +1 -0
  371. package/dist/db/repository/in-memory-repository.d.ts +88 -0
  372. package/dist/db/repository/in-memory-repository.d.ts.map +1 -0
  373. package/dist/db/repository/in-memory-repository.js +541 -0
  374. package/dist/db/repository/in-memory-repository.js.map +1 -0
  375. package/dist/db/repository/index.d.ts +16 -0
  376. package/dist/db/repository/index.d.ts.map +1 -0
  377. package/dist/db/repository/index.js +16 -0
  378. package/dist/db/repository/index.js.map +1 -0
  379. package/dist/db/repository/native-repository.d.ts +70 -0
  380. package/dist/db/repository/native-repository.d.ts.map +1 -0
  381. package/dist/db/repository/native-repository.js +418 -0
  382. package/dist/db/repository/native-repository.js.map +1 -0
  383. package/dist/db/repository/nodes.d.ts +86 -0
  384. package/dist/db/repository/nodes.d.ts.map +1 -0
  385. package/dist/db/repository/nodes.js +203 -0
  386. package/dist/db/repository/nodes.js.map +1 -0
  387. package/dist/db/repository/sqlite-repository.d.ts +59 -0
  388. package/dist/db/repository/sqlite-repository.d.ts.map +1 -0
  389. package/dist/db/repository/sqlite-repository.js +199 -0
  390. package/dist/db/repository/sqlite-repository.js.map +1 -0
  391. package/dist/domain/analysis/brief.d.ts +25 -0
  392. package/dist/domain/analysis/brief.d.ts.map +1 -0
  393. package/dist/domain/analysis/brief.js +136 -0
  394. package/dist/domain/analysis/brief.js.map +1 -0
  395. package/dist/domain/analysis/context.d.ts +241 -0
  396. package/dist/domain/analysis/context.d.ts.map +1 -0
  397. package/dist/domain/analysis/context.js +361 -0
  398. package/dist/domain/analysis/context.js.map +1 -0
  399. package/dist/domain/analysis/dependencies.d.ts +158 -0
  400. package/dist/domain/analysis/dependencies.d.ts.map +1 -0
  401. package/dist/domain/analysis/dependencies.js +522 -0
  402. package/dist/domain/analysis/dependencies.js.map +1 -0
  403. package/dist/domain/analysis/diff-impact.d.ts +90 -0
  404. package/dist/domain/analysis/diff-impact.d.ts.map +1 -0
  405. package/dist/domain/analysis/diff-impact.js +301 -0
  406. package/dist/domain/analysis/diff-impact.js.map +1 -0
  407. package/dist/domain/analysis/exports.d.ts +8 -0
  408. package/dist/domain/analysis/exports.d.ts.map +1 -0
  409. package/dist/domain/analysis/exports.js +178 -0
  410. package/dist/domain/analysis/exports.js.map +1 -0
  411. package/dist/domain/analysis/fn-impact.d.ts +61 -0
  412. package/dist/domain/analysis/fn-impact.d.ts.map +1 -0
  413. package/dist/domain/analysis/fn-impact.js +190 -0
  414. package/dist/domain/analysis/fn-impact.js.map +1 -0
  415. package/dist/domain/analysis/impact.d.ts +11 -0
  416. package/dist/domain/analysis/impact.d.ts.map +1 -0
  417. package/dist/domain/analysis/impact.js +11 -0
  418. package/dist/domain/analysis/impact.js.map +1 -0
  419. package/dist/domain/analysis/implementations.d.ts +59 -0
  420. package/dist/domain/analysis/implementations.d.ts.map +1 -0
  421. package/dist/domain/analysis/implementations.js +65 -0
  422. package/dist/domain/analysis/implementations.js.map +1 -0
  423. package/dist/domain/analysis/module-map.d.ts +86 -0
  424. package/dist/domain/analysis/module-map.d.ts.map +1 -0
  425. package/dist/domain/analysis/module-map.js +468 -0
  426. package/dist/domain/analysis/module-map.js.map +1 -0
  427. package/dist/domain/analysis/query-helpers.d.ts +27 -0
  428. package/dist/domain/analysis/query-helpers.d.ts.map +1 -0
  429. package/dist/domain/analysis/query-helpers.js +41 -0
  430. package/dist/domain/analysis/query-helpers.js.map +1 -0
  431. package/dist/domain/analysis/roles.d.ts +20 -0
  432. package/dist/domain/analysis/roles.d.ts.map +1 -0
  433. package/dist/domain/analysis/roles.js +74 -0
  434. package/dist/domain/analysis/roles.js.map +1 -0
  435. package/dist/domain/analysis/symbol-lookup.d.ts +125 -0
  436. package/dist/domain/analysis/symbol-lookup.d.ts.map +1 -0
  437. package/dist/domain/analysis/symbol-lookup.js +206 -0
  438. package/dist/domain/analysis/symbol-lookup.js.map +1 -0
  439. package/dist/domain/graph/builder/call-resolver.d.ts +89 -0
  440. package/dist/domain/graph/builder/call-resolver.d.ts.map +1 -0
  441. package/dist/domain/graph/builder/call-resolver.js +212 -0
  442. package/dist/domain/graph/builder/call-resolver.js.map +1 -0
  443. package/dist/domain/graph/builder/cha.d.ts +69 -0
  444. package/dist/domain/graph/builder/cha.d.ts.map +1 -0
  445. package/dist/domain/graph/builder/cha.js +158 -0
  446. package/dist/domain/graph/builder/cha.js.map +1 -0
  447. package/dist/domain/graph/builder/context.d.ts +91 -0
  448. package/dist/domain/graph/builder/context.d.ts.map +1 -0
  449. package/dist/domain/graph/builder/context.js +66 -0
  450. package/dist/domain/graph/builder/context.js.map +1 -0
  451. package/dist/domain/graph/builder/helpers.d.ts +97 -0
  452. package/dist/domain/graph/builder/helpers.d.ts.map +1 -0
  453. package/dist/domain/graph/builder/helpers.js +558 -0
  454. package/dist/domain/graph/builder/helpers.js.map +1 -0
  455. package/dist/domain/graph/builder/incremental.d.ts +53 -0
  456. package/dist/domain/graph/builder/incremental.d.ts.map +1 -0
  457. package/dist/domain/graph/builder/incremental.js +647 -0
  458. package/dist/domain/graph/builder/incremental.js.map +1 -0
  459. package/dist/domain/graph/builder/native-db-proxy.d.ts +24 -0
  460. package/dist/domain/graph/builder/native-db-proxy.d.ts.map +1 -0
  461. package/dist/domain/graph/builder/native-db-proxy.js +91 -0
  462. package/dist/domain/graph/builder/native-db-proxy.js.map +1 -0
  463. package/dist/domain/graph/builder/pipeline.d.ts +9 -0
  464. package/dist/domain/graph/builder/pipeline.d.ts.map +1 -0
  465. package/dist/domain/graph/builder/pipeline.js +448 -0
  466. package/dist/domain/graph/builder/pipeline.js.map +1 -0
  467. package/dist/domain/graph/builder/stages/build-edges.d.ts +3 -0
  468. package/dist/domain/graph/builder/stages/build-edges.d.ts.map +1 -0
  469. package/dist/domain/graph/builder/stages/build-edges.js +1425 -0
  470. package/dist/domain/graph/builder/stages/build-edges.js.map +1 -0
  471. package/dist/domain/graph/builder/stages/build-structure.d.ts +3 -0
  472. package/dist/domain/graph/builder/stages/build-structure.d.ts.map +1 -0
  473. package/dist/domain/graph/builder/stages/build-structure.js +250 -0
  474. package/dist/domain/graph/builder/stages/build-structure.js.map +1 -0
  475. package/dist/domain/graph/builder/stages/collect-files.d.ts +3 -0
  476. package/dist/domain/graph/builder/stages/collect-files.d.ts.map +1 -0
  477. package/dist/domain/graph/builder/stages/collect-files.js +161 -0
  478. package/dist/domain/graph/builder/stages/collect-files.js.map +1 -0
  479. package/dist/domain/graph/builder/stages/detect-changes.d.ts +27 -0
  480. package/dist/domain/graph/builder/stages/detect-changes.d.ts.map +1 -0
  481. package/dist/domain/graph/builder/stages/detect-changes.js +593 -0
  482. package/dist/domain/graph/builder/stages/detect-changes.js.map +1 -0
  483. package/dist/domain/graph/builder/stages/finalize.d.ts +3 -0
  484. package/dist/domain/graph/builder/stages/finalize.d.ts.map +1 -0
  485. package/dist/domain/graph/builder/stages/finalize.js +274 -0
  486. package/dist/domain/graph/builder/stages/finalize.js.map +1 -0
  487. package/dist/domain/graph/builder/stages/insert-nodes.d.ts +35 -0
  488. package/dist/domain/graph/builder/stages/insert-nodes.d.ts.map +1 -0
  489. package/dist/domain/graph/builder/stages/insert-nodes.js +351 -0
  490. package/dist/domain/graph/builder/stages/insert-nodes.js.map +1 -0
  491. package/dist/domain/graph/builder/stages/native-db-lifecycle.d.ts +14 -0
  492. package/dist/domain/graph/builder/stages/native-db-lifecycle.d.ts.map +1 -0
  493. package/dist/domain/graph/builder/stages/native-db-lifecycle.js +77 -0
  494. package/dist/domain/graph/builder/stages/native-db-lifecycle.js.map +1 -0
  495. package/dist/domain/graph/builder/stages/native-orchestrator.d.ts +62 -0
  496. package/dist/domain/graph/builder/stages/native-orchestrator.d.ts.map +1 -0
  497. package/dist/domain/graph/builder/stages/native-orchestrator.js +1763 -0
  498. package/dist/domain/graph/builder/stages/native-orchestrator.js.map +1 -0
  499. package/dist/domain/graph/builder/stages/parse-files.d.ts +3 -0
  500. package/dist/domain/graph/builder/stages/parse-files.d.ts.map +1 -0
  501. package/dist/domain/graph/builder/stages/parse-files.js +22 -0
  502. package/dist/domain/graph/builder/stages/parse-files.js.map +1 -0
  503. package/dist/domain/graph/builder/stages/resolve-imports.d.ts +7 -0
  504. package/dist/domain/graph/builder/stages/resolve-imports.d.ts.map +1 -0
  505. package/dist/domain/graph/builder/stages/resolve-imports.js +231 -0
  506. package/dist/domain/graph/builder/stages/resolve-imports.js.map +1 -0
  507. package/dist/domain/graph/builder/stages/run-analyses.d.ts +3 -0
  508. package/dist/domain/graph/builder/stages/run-analyses.d.ts.map +1 -0
  509. package/dist/domain/graph/builder/stages/run-analyses.js +23 -0
  510. package/dist/domain/graph/builder/stages/run-analyses.js.map +1 -0
  511. package/dist/domain/graph/builder.d.ts +4 -0
  512. package/dist/domain/graph/builder.d.ts.map +1 -0
  513. package/dist/domain/graph/builder.js +6 -0
  514. package/dist/domain/graph/builder.js.map +1 -0
  515. package/dist/domain/graph/change-journal.d.ts +50 -0
  516. package/dist/domain/graph/change-journal.d.ts.map +1 -0
  517. package/dist/domain/graph/change-journal.js +97 -0
  518. package/dist/domain/graph/change-journal.js.map +1 -0
  519. package/dist/domain/graph/cycles.d.ts +19 -0
  520. package/dist/domain/graph/cycles.d.ts.map +1 -0
  521. package/dist/domain/graph/cycles.js +142 -0
  522. package/dist/domain/graph/cycles.js.map +1 -0
  523. package/dist/domain/graph/journal.d.ts +30 -0
  524. package/dist/domain/graph/journal.d.ts.map +1 -0
  525. package/dist/domain/graph/journal.js +360 -0
  526. package/dist/domain/graph/journal.js.map +1 -0
  527. package/dist/domain/graph/resolve.d.ts +67 -0
  528. package/dist/domain/graph/resolve.d.ts.map +1 -0
  529. package/dist/domain/graph/resolve.js +521 -0
  530. package/dist/domain/graph/resolve.js.map +1 -0
  531. package/dist/domain/graph/resolver/points-to.d.ts +53 -0
  532. package/dist/domain/graph/resolver/points-to.d.ts.map +1 -0
  533. package/dist/domain/graph/resolver/points-to.js +261 -0
  534. package/dist/domain/graph/resolver/points-to.js.map +1 -0
  535. package/dist/domain/graph/resolver/strategy.d.ts +61 -0
  536. package/dist/domain/graph/resolver/strategy.d.ts.map +1 -0
  537. package/dist/domain/graph/resolver/strategy.js +222 -0
  538. package/dist/domain/graph/resolver/strategy.js.map +1 -0
  539. package/dist/domain/graph/resolver/ts-resolver.d.ts +9 -0
  540. package/dist/domain/graph/resolver/ts-resolver.d.ts.map +1 -0
  541. package/dist/domain/graph/resolver/ts-resolver.js +476 -0
  542. package/dist/domain/graph/resolver/ts-resolver.js.map +1 -0
  543. package/dist/domain/graph/watcher.d.ts +23 -0
  544. package/dist/domain/graph/watcher.d.ts.map +1 -0
  545. package/dist/domain/graph/watcher.js +272 -0
  546. package/dist/domain/graph/watcher.js.map +1 -0
  547. package/dist/domain/parser.d.ts +128 -0
  548. package/dist/domain/parser.d.ts.map +1 -0
  549. package/dist/domain/parser.js +1246 -0
  550. package/dist/domain/parser.js.map +1 -0
  551. package/dist/domain/queries.d.ts +22 -0
  552. package/dist/domain/queries.d.ts.map +1 -0
  553. package/dist/domain/queries.js +26 -0
  554. package/dist/domain/queries.js.map +1 -0
  555. package/dist/domain/search/generator.d.ts +16 -0
  556. package/dist/domain/search/generator.d.ts.map +1 -0
  557. package/dist/domain/search/generator.js +181 -0
  558. package/dist/domain/search/generator.js.map +1 -0
  559. package/dist/domain/search/index.d.ts +15 -0
  560. package/dist/domain/search/index.d.ts.map +1 -0
  561. package/dist/domain/search/index.js +13 -0
  562. package/dist/domain/search/index.js.map +1 -0
  563. package/dist/domain/search/models.d.ts +63 -0
  564. package/dist/domain/search/models.d.ts.map +1 -0
  565. package/dist/domain/search/models.js +303 -0
  566. package/dist/domain/search/models.js.map +1 -0
  567. package/dist/domain/search/search/cli-formatter.d.ts +10 -0
  568. package/dist/domain/search/search/cli-formatter.d.ts.map +1 -0
  569. package/dist/domain/search/search/cli-formatter.js +134 -0
  570. package/dist/domain/search/search/cli-formatter.js.map +1 -0
  571. package/dist/domain/search/search/filters.d.ts +9 -0
  572. package/dist/domain/search/search/filters.d.ts.map +1 -0
  573. package/dist/domain/search/search/filters.js +31 -0
  574. package/dist/domain/search/search/filters.js.map +1 -0
  575. package/dist/domain/search/search/hybrid.d.ts +21 -0
  576. package/dist/domain/search/search/hybrid.d.ts.map +1 -0
  577. package/dist/domain/search/search/hybrid.js +122 -0
  578. package/dist/domain/search/search/hybrid.js.map +1 -0
  579. package/dist/domain/search/search/keyword.d.ts +18 -0
  580. package/dist/domain/search/search/keyword.d.ts.map +1 -0
  581. package/dist/domain/search/search/keyword.js +58 -0
  582. package/dist/domain/search/search/keyword.js.map +1 -0
  583. package/dist/domain/search/search/prepare.d.ts +25 -0
  584. package/dist/domain/search/search/prepare.d.ts.map +1 -0
  585. package/dist/domain/search/search/prepare.js +63 -0
  586. package/dist/domain/search/search/prepare.js.map +1 -0
  587. package/dist/domain/search/search/semantic.d.ts +41 -0
  588. package/dist/domain/search/search/semantic.d.ts.map +1 -0
  589. package/dist/domain/search/search/semantic.js +135 -0
  590. package/dist/domain/search/search/semantic.js.map +1 -0
  591. package/dist/domain/search/stores/fts5.d.ts +10 -0
  592. package/dist/domain/search/stores/fts5.d.ts.map +1 -0
  593. package/dist/domain/search/stores/fts5.js +27 -0
  594. package/dist/domain/search/stores/fts5.js.map +1 -0
  595. package/dist/domain/search/stores/sqlite-blob.d.ts +5 -0
  596. package/dist/domain/search/stores/sqlite-blob.d.ts.map +1 -0
  597. package/dist/domain/search/stores/sqlite-blob.js +16 -0
  598. package/dist/domain/search/stores/sqlite-blob.js.map +1 -0
  599. package/dist/domain/search/strategies/source.d.ts +6 -0
  600. package/dist/domain/search/strategies/source.d.ts.map +1 -0
  601. package/dist/domain/search/strategies/source.js +14 -0
  602. package/dist/domain/search/strategies/source.js.map +1 -0
  603. package/dist/domain/search/strategies/structured.d.ts +10 -0
  604. package/dist/domain/search/strategies/structured.d.ts.map +1 -0
  605. package/dist/domain/search/strategies/structured.js +35 -0
  606. package/dist/domain/search/strategies/structured.js.map +1 -0
  607. package/dist/domain/search/strategies/text-utils.d.ts +9 -0
  608. package/dist/domain/search/strategies/text-utils.d.ts.map +1 -0
  609. package/dist/domain/search/strategies/text-utils.js +45 -0
  610. package/dist/domain/search/strategies/text-utils.js.map +1 -0
  611. package/dist/domain/wasm-worker-entry.d.ts +24 -0
  612. package/dist/domain/wasm-worker-entry.d.ts.map +1 -0
  613. package/dist/domain/wasm-worker-entry.js +749 -0
  614. package/dist/domain/wasm-worker-entry.js.map +1 -0
  615. package/dist/domain/wasm-worker-pool.d.ts +59 -0
  616. package/dist/domain/wasm-worker-pool.d.ts.map +1 -0
  617. package/dist/domain/wasm-worker-pool.js +363 -0
  618. package/dist/domain/wasm-worker-pool.js.map +1 -0
  619. package/dist/domain/wasm-worker-protocol.d.ts +81 -0
  620. package/dist/domain/wasm-worker-protocol.d.ts.map +1 -0
  621. package/dist/domain/wasm-worker-protocol.js +13 -0
  622. package/dist/domain/wasm-worker-protocol.js.map +1 -0
  623. package/dist/extractors/bash.d.ts +6 -0
  624. package/dist/extractors/bash.d.ts.map +1 -0
  625. package/dist/extractors/bash.js +91 -0
  626. package/dist/extractors/bash.js.map +1 -0
  627. package/dist/extractors/c.d.ts +6 -0
  628. package/dist/extractors/c.d.ts.map +1 -0
  629. package/dist/extractors/c.js +223 -0
  630. package/dist/extractors/c.js.map +1 -0
  631. package/dist/extractors/clojure.d.ts +12 -0
  632. package/dist/extractors/clojure.d.ts.map +1 -0
  633. package/dist/extractors/clojure.js +245 -0
  634. package/dist/extractors/clojure.js.map +1 -0
  635. package/dist/extractors/cpp.d.ts +6 -0
  636. package/dist/extractors/cpp.d.ts.map +1 -0
  637. package/dist/extractors/cpp.js +365 -0
  638. package/dist/extractors/cpp.js.map +1 -0
  639. package/dist/extractors/csharp.d.ts +6 -0
  640. package/dist/extractors/csharp.d.ts.map +1 -0
  641. package/dist/extractors/csharp.js +430 -0
  642. package/dist/extractors/csharp.js.map +1 -0
  643. package/dist/extractors/cuda.d.ts +11 -0
  644. package/dist/extractors/cuda.d.ts.map +1 -0
  645. package/dist/extractors/cuda.js +419 -0
  646. package/dist/extractors/cuda.js.map +1 -0
  647. package/dist/extractors/dart.d.ts +6 -0
  648. package/dist/extractors/dart.d.ts.map +1 -0
  649. package/dist/extractors/dart.js +277 -0
  650. package/dist/extractors/dart.js.map +1 -0
  651. package/dist/extractors/elixir.d.ts +9 -0
  652. package/dist/extractors/elixir.d.ts.map +1 -0
  653. package/dist/extractors/elixir.js +327 -0
  654. package/dist/extractors/elixir.js.map +1 -0
  655. package/dist/extractors/erlang.d.ts +14 -0
  656. package/dist/extractors/erlang.d.ts.map +1 -0
  657. package/dist/extractors/erlang.js +275 -0
  658. package/dist/extractors/erlang.js.map +1 -0
  659. package/dist/extractors/fsharp.d.ts +20 -0
  660. package/dist/extractors/fsharp.d.ts.map +1 -0
  661. package/dist/extractors/fsharp.js +312 -0
  662. package/dist/extractors/fsharp.js.map +1 -0
  663. package/dist/extractors/gleam.d.ts +14 -0
  664. package/dist/extractors/gleam.d.ts.map +1 -0
  665. package/dist/extractors/gleam.js +225 -0
  666. package/dist/extractors/gleam.js.map +1 -0
  667. package/dist/extractors/go.d.ts +6 -0
  668. package/dist/extractors/go.d.ts.map +1 -0
  669. package/dist/extractors/go.js +460 -0
  670. package/dist/extractors/go.js.map +1 -0
  671. package/dist/extractors/groovy.d.ts +10 -0
  672. package/dist/extractors/groovy.d.ts.map +1 -0
  673. package/dist/extractors/groovy.js +403 -0
  674. package/dist/extractors/groovy.js.map +1 -0
  675. package/dist/extractors/haskell.d.ts +8 -0
  676. package/dist/extractors/haskell.d.ts.map +1 -0
  677. package/dist/extractors/haskell.js +261 -0
  678. package/dist/extractors/haskell.js.map +1 -0
  679. package/dist/extractors/hcl.d.ts +6 -0
  680. package/dist/extractors/hcl.d.ts.map +1 -0
  681. package/dist/extractors/hcl.js +114 -0
  682. package/dist/extractors/hcl.js.map +1 -0
  683. package/dist/extractors/helpers.d.ts +144 -0
  684. package/dist/extractors/helpers.d.ts.map +1 -0
  685. package/dist/extractors/helpers.js +360 -0
  686. package/dist/extractors/helpers.js.map +1 -0
  687. package/dist/extractors/index.d.ts +33 -0
  688. package/dist/extractors/index.d.ts.map +1 -0
  689. package/dist/extractors/index.js +33 -0
  690. package/dist/extractors/index.js.map +1 -0
  691. package/dist/extractors/java.d.ts +6 -0
  692. package/dist/extractors/java.d.ts.map +1 -0
  693. package/dist/extractors/java.js +390 -0
  694. package/dist/extractors/java.js.map +1 -0
  695. package/dist/extractors/javascript.d.ts +10 -0
  696. package/dist/extractors/javascript.d.ts.map +1 -0
  697. package/dist/extractors/javascript.js +3618 -0
  698. package/dist/extractors/javascript.js.map +1 -0
  699. package/dist/extractors/julia.d.ts +16 -0
  700. package/dist/extractors/julia.d.ts.map +1 -0
  701. package/dist/extractors/julia.js +411 -0
  702. package/dist/extractors/julia.js.map +1 -0
  703. package/dist/extractors/kotlin.d.ts +6 -0
  704. package/dist/extractors/kotlin.d.ts.map +1 -0
  705. package/dist/extractors/kotlin.js +340 -0
  706. package/dist/extractors/kotlin.js.map +1 -0
  707. package/dist/extractors/lua.d.ts +6 -0
  708. package/dist/extractors/lua.d.ts.map +1 -0
  709. package/dist/extractors/lua.js +162 -0
  710. package/dist/extractors/lua.js.map +1 -0
  711. package/dist/extractors/objc.d.ts +9 -0
  712. package/dist/extractors/objc.d.ts.map +1 -0
  713. package/dist/extractors/objc.js +543 -0
  714. package/dist/extractors/objc.js.map +1 -0
  715. package/dist/extractors/ocaml.d.ts +6 -0
  716. package/dist/extractors/ocaml.d.ts.map +1 -0
  717. package/dist/extractors/ocaml.js +310 -0
  718. package/dist/extractors/ocaml.js.map +1 -0
  719. package/dist/extractors/php.d.ts +6 -0
  720. package/dist/extractors/php.d.ts.map +1 -0
  721. package/dist/extractors/php.js +381 -0
  722. package/dist/extractors/php.js.map +1 -0
  723. package/dist/extractors/python.d.ts +6 -0
  724. package/dist/extractors/python.d.ts.map +1 -0
  725. package/dist/extractors/python.js +428 -0
  726. package/dist/extractors/python.js.map +1 -0
  727. package/dist/extractors/r.d.ts +13 -0
  728. package/dist/extractors/r.d.ts.map +1 -0
  729. package/dist/extractors/r.js +267 -0
  730. package/dist/extractors/r.js.map +1 -0
  731. package/dist/extractors/ruby.d.ts +6 -0
  732. package/dist/extractors/ruby.d.ts.map +1 -0
  733. package/dist/extractors/ruby.js +281 -0
  734. package/dist/extractors/ruby.js.map +1 -0
  735. package/dist/extractors/rust.d.ts +6 -0
  736. package/dist/extractors/rust.d.ts.map +1 -0
  737. package/dist/extractors/rust.js +354 -0
  738. package/dist/extractors/rust.js.map +1 -0
  739. package/dist/extractors/scala.d.ts +6 -0
  740. package/dist/extractors/scala.d.ts.map +1 -0
  741. package/dist/extractors/scala.js +315 -0
  742. package/dist/extractors/scala.js.map +1 -0
  743. package/dist/extractors/solidity.d.ts +9 -0
  744. package/dist/extractors/solidity.d.ts.map +1 -0
  745. package/dist/extractors/solidity.js +351 -0
  746. package/dist/extractors/solidity.js.map +1 -0
  747. package/dist/extractors/swift.d.ts +6 -0
  748. package/dist/extractors/swift.d.ts.map +1 -0
  749. package/dist/extractors/swift.js +326 -0
  750. package/dist/extractors/swift.js.map +1 -0
  751. package/dist/extractors/verilog.d.ts +9 -0
  752. package/dist/extractors/verilog.d.ts.map +1 -0
  753. package/dist/extractors/verilog.js +351 -0
  754. package/dist/extractors/verilog.js.map +1 -0
  755. package/dist/extractors/zig.d.ts +9 -0
  756. package/dist/extractors/zig.d.ts.map +1 -0
  757. package/dist/extractors/zig.js +274 -0
  758. package/dist/extractors/zig.js.map +1 -0
  759. package/dist/features/ast.d.ts +78 -0
  760. package/dist/features/ast.d.ts.map +1 -0
  761. package/dist/features/ast.js +228 -0
  762. package/dist/features/ast.js.map +1 -0
  763. package/dist/features/audit.d.ts +15 -0
  764. package/dist/features/audit.d.ts.map +1 -0
  765. package/dist/features/audit.js +275 -0
  766. package/dist/features/audit.js.map +1 -0
  767. package/dist/features/batch.d.ts +54 -0
  768. package/dist/features/batch.d.ts.map +1 -0
  769. package/dist/features/batch.js +97 -0
  770. package/dist/features/batch.js.map +1 -0
  771. package/dist/features/boundaries.d.ts +51 -0
  772. package/dist/features/boundaries.d.ts.map +1 -0
  773. package/dist/features/boundaries.js +248 -0
  774. package/dist/features/boundaries.js.map +1 -0
  775. package/dist/features/branch-compare.d.ts +71 -0
  776. package/dist/features/branch-compare.d.ts.map +1 -0
  777. package/dist/features/branch-compare.js +444 -0
  778. package/dist/features/branch-compare.js.map +1 -0
  779. package/dist/features/cfg.d.ts +79 -0
  780. package/dist/features/cfg.d.ts.map +1 -0
  781. package/dist/features/cfg.js +483 -0
  782. package/dist/features/cfg.js.map +1 -0
  783. package/dist/features/check.d.ts +84 -0
  784. package/dist/features/check.d.ts.map +1 -0
  785. package/dist/features/check.js +290 -0
  786. package/dist/features/check.js.map +1 -0
  787. package/dist/features/cochange.d.ts +68 -0
  788. package/dist/features/cochange.d.ts.map +1 -0
  789. package/dist/features/cochange.js +384 -0
  790. package/dist/features/cochange.js.map +1 -0
  791. package/dist/features/communities.d.ts +26 -0
  792. package/dist/features/communities.d.ts.map +1 -0
  793. package/dist/features/communities.js +149 -0
  794. package/dist/features/communities.js.map +1 -0
  795. package/dist/features/complexity-query.d.ts +37 -0
  796. package/dist/features/complexity-query.d.ts.map +1 -0
  797. package/dist/features/complexity-query.js +268 -0
  798. package/dist/features/complexity-query.js.map +1 -0
  799. package/dist/features/complexity.d.ts +52 -0
  800. package/dist/features/complexity.d.ts.map +1 -0
  801. package/dist/features/complexity.js +490 -0
  802. package/dist/features/complexity.js.map +1 -0
  803. package/dist/features/dataflow.d.ts +129 -0
  804. package/dist/features/dataflow.d.ts.map +1 -0
  805. package/dist/features/dataflow.js +1079 -0
  806. package/dist/features/dataflow.js.map +1 -0
  807. package/dist/features/export.d.ts +35 -0
  808. package/dist/features/export.d.ts.map +1 -0
  809. package/dist/features/export.js +340 -0
  810. package/dist/features/export.js.map +1 -0
  811. package/dist/features/flow.d.ts +21 -0
  812. package/dist/features/flow.d.ts.map +1 -0
  813. package/dist/features/flow.js +195 -0
  814. package/dist/features/flow.js.map +1 -0
  815. package/dist/features/graph-enrichment.d.ts +44 -0
  816. package/dist/features/graph-enrichment.d.ts.map +1 -0
  817. package/dist/features/graph-enrichment.js +312 -0
  818. package/dist/features/graph-enrichment.js.map +1 -0
  819. package/dist/features/manifesto.d.ts +23 -0
  820. package/dist/features/manifesto.d.ts.map +1 -0
  821. package/dist/features/manifesto.js +382 -0
  822. package/dist/features/manifesto.js.map +1 -0
  823. package/dist/features/owners.d.ts +60 -0
  824. package/dist/features/owners.d.ts.map +1 -0
  825. package/dist/features/owners.js +248 -0
  826. package/dist/features/owners.js.map +1 -0
  827. package/dist/features/sequence.d.ts +42 -0
  828. package/dist/features/sequence.d.ts.map +1 -0
  829. package/dist/features/sequence.js +271 -0
  830. package/dist/features/sequence.js.map +1 -0
  831. package/dist/features/shared/find-nodes.d.ts +7 -0
  832. package/dist/features/shared/find-nodes.d.ts.map +1 -0
  833. package/dist/features/shared/find-nodes.js +18 -0
  834. package/dist/features/shared/find-nodes.js.map +1 -0
  835. package/dist/features/snapshot.d.ts +25 -0
  836. package/dist/features/snapshot.d.ts.map +1 -0
  837. package/dist/features/snapshot.js +188 -0
  838. package/dist/features/snapshot.js.map +1 -0
  839. package/dist/features/structure-query.d.ts +76 -0
  840. package/dist/features/structure-query.d.ts.map +1 -0
  841. package/dist/features/structure-query.js +274 -0
  842. package/dist/features/structure-query.js.map +1 -0
  843. package/dist/features/structure.d.ts +39 -0
  844. package/dist/features/structure.d.ts.map +1 -0
  845. package/dist/features/structure.js +796 -0
  846. package/dist/features/structure.js.map +1 -0
  847. package/dist/features/triage.d.ts +47 -0
  848. package/dist/features/triage.d.ts.map +1 -0
  849. package/dist/features/triage.js +123 -0
  850. package/dist/features/triage.js.map +1 -0
  851. package/dist/graph/algorithms/bfs.d.ts +14 -0
  852. package/dist/graph/algorithms/bfs.d.ts.map +1 -0
  853. package/dist/graph/algorithms/bfs.js +72 -0
  854. package/dist/graph/algorithms/bfs.js.map +1 -0
  855. package/dist/graph/algorithms/centrality.d.ts +12 -0
  856. package/dist/graph/algorithms/centrality.d.ts.map +1 -0
  857. package/dist/graph/algorithms/centrality.js +42 -0
  858. package/dist/graph/algorithms/centrality.js.map +1 -0
  859. package/dist/graph/algorithms/index.d.ts +7 -0
  860. package/dist/graph/algorithms/index.d.ts.map +1 -0
  861. package/dist/graph/algorithms/index.js +7 -0
  862. package/dist/graph/algorithms/index.js.map +1 -0
  863. package/dist/graph/algorithms/leiden/adapter.d.ts +37 -0
  864. package/dist/graph/algorithms/leiden/adapter.d.ts.map +1 -0
  865. package/dist/graph/algorithms/leiden/adapter.js +173 -0
  866. package/dist/graph/algorithms/leiden/adapter.js.map +1 -0
  867. package/dist/graph/algorithms/leiden/cpm.d.ts +28 -0
  868. package/dist/graph/algorithms/leiden/cpm.d.ts.map +1 -0
  869. package/dist/graph/algorithms/leiden/cpm.js +48 -0
  870. package/dist/graph/algorithms/leiden/cpm.js.map +1 -0
  871. package/dist/graph/algorithms/leiden/index.d.ts +37 -0
  872. package/dist/graph/algorithms/leiden/index.d.ts.map +1 -0
  873. package/dist/graph/algorithms/leiden/index.js +157 -0
  874. package/dist/graph/algorithms/leiden/index.js.map +1 -0
  875. package/dist/graph/algorithms/leiden/modularity.d.ts +33 -0
  876. package/dist/graph/algorithms/leiden/modularity.d.ts.map +1 -0
  877. package/dist/graph/algorithms/leiden/modularity.js +80 -0
  878. package/dist/graph/algorithms/leiden/modularity.js.map +1 -0
  879. package/dist/graph/algorithms/leiden/optimiser.d.ts +62 -0
  880. package/dist/graph/algorithms/leiden/optimiser.d.ts.map +1 -0
  881. package/dist/graph/algorithms/leiden/optimiser.js +530 -0
  882. package/dist/graph/algorithms/leiden/optimiser.js.map +1 -0
  883. package/dist/graph/algorithms/leiden/partition.d.ts +44 -0
  884. package/dist/graph/algorithms/leiden/partition.d.ts.map +1 -0
  885. package/dist/graph/algorithms/leiden/partition.js +438 -0
  886. package/dist/graph/algorithms/leiden/partition.js.map +1 -0
  887. package/dist/graph/algorithms/leiden/rng.d.ts +9 -0
  888. package/dist/graph/algorithms/leiden/rng.d.ts.map +1 -0
  889. package/dist/graph/algorithms/leiden/rng.js +17 -0
  890. package/dist/graph/algorithms/leiden/rng.js.map +1 -0
  891. package/dist/graph/algorithms/louvain.d.ts +20 -0
  892. package/dist/graph/algorithms/louvain.d.ts.map +1 -0
  893. package/dist/graph/algorithms/louvain.js +52 -0
  894. package/dist/graph/algorithms/louvain.js.map +1 -0
  895. package/dist/graph/algorithms/shortest-path.d.ts +10 -0
  896. package/dist/graph/algorithms/shortest-path.d.ts.map +1 -0
  897. package/dist/graph/algorithms/shortest-path.js +55 -0
  898. package/dist/graph/algorithms/shortest-path.js.map +1 -0
  899. package/dist/graph/algorithms/tarjan.d.ts +9 -0
  900. package/dist/graph/algorithms/tarjan.d.ts.map +1 -0
  901. package/dist/graph/algorithms/tarjan.js +52 -0
  902. package/dist/graph/algorithms/tarjan.js.map +1 -0
  903. package/dist/graph/builders/dependency.d.ts +18 -0
  904. package/dist/graph/builders/dependency.d.ts.map +1 -0
  905. package/dist/graph/builders/dependency.js +101 -0
  906. package/dist/graph/builders/dependency.js.map +1 -0
  907. package/dist/graph/builders/index.d.ts +4 -0
  908. package/dist/graph/builders/index.d.ts.map +1 -0
  909. package/dist/graph/builders/index.js +4 -0
  910. package/dist/graph/builders/index.js.map +1 -0
  911. package/dist/graph/builders/structure.d.ts +10 -0
  912. package/dist/graph/builders/structure.d.ts.map +1 -0
  913. package/dist/graph/builders/structure.js +33 -0
  914. package/dist/graph/builders/structure.js.map +1 -0
  915. package/dist/graph/builders/temporal.d.ts +13 -0
  916. package/dist/graph/builders/temporal.d.ts.map +1 -0
  917. package/dist/graph/builders/temporal.js +29 -0
  918. package/dist/graph/builders/temporal.js.map +1 -0
  919. package/dist/graph/classifiers/index.d.ts +3 -0
  920. package/dist/graph/classifiers/index.d.ts.map +1 -0
  921. package/dist/graph/classifiers/index.js +3 -0
  922. package/dist/graph/classifiers/index.js.map +1 -0
  923. package/dist/graph/classifiers/risk.d.ts +39 -0
  924. package/dist/graph/classifiers/risk.d.ts.map +1 -0
  925. package/dist/graph/classifiers/risk.js +78 -0
  926. package/dist/graph/classifiers/risk.js.map +1 -0
  927. package/dist/graph/classifiers/roles.d.ts +48 -0
  928. package/dist/graph/classifiers/roles.d.ts.map +1 -0
  929. package/dist/graph/classifiers/roles.js +180 -0
  930. package/dist/graph/classifiers/roles.js.map +1 -0
  931. package/dist/graph/index.d.ts +5 -0
  932. package/dist/graph/index.d.ts.map +1 -0
  933. package/dist/graph/index.js +6 -0
  934. package/dist/graph/index.js.map +1 -0
  935. package/dist/graph/model.d.ts +57 -0
  936. package/dist/graph/model.d.ts.map +1 -0
  937. package/dist/graph/model.js +205 -0
  938. package/dist/graph/model.js.map +1 -0
  939. package/dist/index.cjs +16 -0
  940. package/dist/index.d.ts +37 -0
  941. package/dist/index.d.ts.map +1 -0
  942. package/dist/index.js +36 -0
  943. package/dist/index.js.map +1 -0
  944. package/dist/infrastructure/config.d.ts +281 -0
  945. package/dist/infrastructure/config.d.ts.map +1 -0
  946. package/dist/infrastructure/config.js +857 -0
  947. package/dist/infrastructure/config.js.map +1 -0
  948. package/dist/infrastructure/logger.d.ts +7 -0
  949. package/dist/infrastructure/logger.d.ts.map +1 -0
  950. package/dist/infrastructure/logger.js +21 -0
  951. package/dist/infrastructure/logger.js.map +1 -0
  952. package/dist/infrastructure/native.d.ts +38 -0
  953. package/dist/infrastructure/native.d.ts.map +1 -0
  954. package/dist/infrastructure/native.js +182 -0
  955. package/dist/infrastructure/native.js.map +1 -0
  956. package/dist/infrastructure/registry.d.ts +81 -0
  957. package/dist/infrastructure/registry.d.ts.map +1 -0
  958. package/dist/infrastructure/registry.js +229 -0
  959. package/dist/infrastructure/registry.js.map +1 -0
  960. package/dist/infrastructure/result-formatter.d.ts +2 -0
  961. package/dist/infrastructure/result-formatter.d.ts.map +1 -0
  962. package/dist/infrastructure/result-formatter.js +3 -0
  963. package/dist/infrastructure/result-formatter.js.map +1 -0
  964. package/dist/infrastructure/suppress.d.ts +25 -0
  965. package/dist/infrastructure/suppress.d.ts.map +1 -0
  966. package/dist/infrastructure/suppress.js +43 -0
  967. package/dist/infrastructure/suppress.js.map +1 -0
  968. package/dist/infrastructure/test-filter.d.ts +5 -0
  969. package/dist/infrastructure/test-filter.d.ts.map +1 -0
  970. package/dist/infrastructure/test-filter.js +7 -0
  971. package/dist/infrastructure/test-filter.js.map +1 -0
  972. package/dist/infrastructure/update-check.d.ts +26 -0
  973. package/dist/infrastructure/update-check.d.ts.map +1 -0
  974. package/dist/infrastructure/update-check.js +164 -0
  975. package/dist/infrastructure/update-check.js.map +1 -0
  976. package/dist/mcp/index.d.ts +3 -0
  977. package/dist/mcp/index.d.ts.map +1 -0
  978. package/dist/mcp/index.js +3 -0
  979. package/dist/mcp/index.js.map +1 -0
  980. package/dist/mcp/middleware.d.ts +26 -0
  981. package/dist/mcp/middleware.d.ts.map +1 -0
  982. package/dist/mcp/middleware.js +32 -0
  983. package/dist/mcp/middleware.js.map +1 -0
  984. package/dist/mcp/server.d.ts +14 -0
  985. package/dist/mcp/server.d.ts.map +1 -0
  986. package/dist/mcp/server.js +193 -0
  987. package/dist/mcp/server.js.map +1 -0
  988. package/dist/mcp/tool-registry.d.ts +21 -0
  989. package/dist/mcp/tool-registry.d.ts.map +1 -0
  990. package/dist/mcp/tool-registry.js +839 -0
  991. package/dist/mcp/tool-registry.js.map +1 -0
  992. package/dist/mcp/tools/ast-query.d.ts +14 -0
  993. package/dist/mcp/tools/ast-query.d.ts.map +1 -0
  994. package/dist/mcp/tools/ast-query.js +13 -0
  995. package/dist/mcp/tools/ast-query.js.map +1 -0
  996. package/dist/mcp/tools/audit.d.ts +15 -0
  997. package/dist/mcp/tools/audit.d.ts.map +1 -0
  998. package/dist/mcp/tools/audit.js +20 -0
  999. package/dist/mcp/tools/audit.js.map +1 -0
  1000. package/dist/mcp/tools/batch-query.d.ts +13 -0
  1001. package/dist/mcp/tools/batch-query.d.ts.map +1 -0
  1002. package/dist/mcp/tools/batch-query.js +11 -0
  1003. package/dist/mcp/tools/batch-query.js.map +1 -0
  1004. package/dist/mcp/tools/branch-compare.d.ts +12 -0
  1005. package/dist/mcp/tools/branch-compare.d.ts.map +1 -0
  1006. package/dist/mcp/tools/branch-compare.js +10 -0
  1007. package/dist/mcp/tools/branch-compare.js.map +1 -0
  1008. package/dist/mcp/tools/brief.d.ts +9 -0
  1009. package/dist/mcp/tools/brief.d.ts.map +1 -0
  1010. package/dist/mcp/tools/brief.js +8 -0
  1011. package/dist/mcp/tools/brief.js.map +1 -0
  1012. package/dist/mcp/tools/cfg.d.ts +14 -0
  1013. package/dist/mcp/tools/cfg.d.ts.map +1 -0
  1014. package/dist/mcp/tools/cfg.js +20 -0
  1015. package/dist/mcp/tools/cfg.js.map +1 -0
  1016. package/dist/mcp/tools/check.d.ts +20 -0
  1017. package/dist/mcp/tools/check.d.ts.map +1 -0
  1018. package/dist/mcp/tools/check.js +39 -0
  1019. package/dist/mcp/tools/check.js.map +1 -0
  1020. package/dist/mcp/tools/co-changes.d.ts +12 -0
  1021. package/dist/mcp/tools/co-changes.d.ts.map +1 -0
  1022. package/dist/mcp/tools/co-changes.js +19 -0
  1023. package/dist/mcp/tools/co-changes.js.map +1 -0
  1024. package/dist/mcp/tools/code-owners.d.ts +12 -0
  1025. package/dist/mcp/tools/code-owners.d.ts.map +1 -0
  1026. package/dist/mcp/tools/code-owners.js +12 -0
  1027. package/dist/mcp/tools/code-owners.js.map +1 -0
  1028. package/dist/mcp/tools/communities.d.ts +13 -0
  1029. package/dist/mcp/tools/communities.d.ts.map +1 -0
  1030. package/dist/mcp/tools/communities.js +14 -0
  1031. package/dist/mcp/tools/communities.js.map +1 -0
  1032. package/dist/mcp/tools/complexity.d.ts +16 -0
  1033. package/dist/mcp/tools/complexity.d.ts.map +1 -0
  1034. package/dist/mcp/tools/complexity.js +16 -0
  1035. package/dist/mcp/tools/complexity.js.map +1 -0
  1036. package/dist/mcp/tools/context.d.ts +16 -0
  1037. package/dist/mcp/tools/context.d.ts.map +1 -0
  1038. package/dist/mcp/tools/context.js +16 -0
  1039. package/dist/mcp/tools/context.js.map +1 -0
  1040. package/dist/mcp/tools/dataflow.d.ts +15 -0
  1041. package/dist/mcp/tools/dataflow.d.ts.map +1 -0
  1042. package/dist/mcp/tools/dataflow.js +25 -0
  1043. package/dist/mcp/tools/dataflow.js.map +1 -0
  1044. package/dist/mcp/tools/diff-impact.d.ts +14 -0
  1045. package/dist/mcp/tools/diff-impact.d.ts.map +1 -0
  1046. package/dist/mcp/tools/diff-impact.js +23 -0
  1047. package/dist/mcp/tools/diff-impact.js.map +1 -0
  1048. package/dist/mcp/tools/execution-flow.d.ts +15 -0
  1049. package/dist/mcp/tools/execution-flow.d.ts.map +1 -0
  1050. package/dist/mcp/tools/execution-flow.js +25 -0
  1051. package/dist/mcp/tools/execution-flow.js.map +1 -0
  1052. package/dist/mcp/tools/export-graph.d.ts +11 -0
  1053. package/dist/mcp/tools/export-graph.d.ts.map +1 -0
  1054. package/dist/mcp/tools/export-graph.js +57 -0
  1055. package/dist/mcp/tools/export-graph.js.map +1 -0
  1056. package/dist/mcp/tools/file-deps.d.ts +11 -0
  1057. package/dist/mcp/tools/file-deps.d.ts.map +1 -0
  1058. package/dist/mcp/tools/file-deps.js +11 -0
  1059. package/dist/mcp/tools/file-deps.js.map +1 -0
  1060. package/dist/mcp/tools/file-exports.d.ts +12 -0
  1061. package/dist/mcp/tools/file-exports.d.ts.map +1 -0
  1062. package/dist/mcp/tools/file-exports.js +12 -0
  1063. package/dist/mcp/tools/file-exports.js.map +1 -0
  1064. package/dist/mcp/tools/find-cycles.d.ts +7 -0
  1065. package/dist/mcp/tools/find-cycles.d.ts.map +1 -0
  1066. package/dist/mcp/tools/find-cycles.js +15 -0
  1067. package/dist/mcp/tools/find-cycles.js.map +1 -0
  1068. package/dist/mcp/tools/fn-impact.d.ts +14 -0
  1069. package/dist/mcp/tools/fn-impact.d.ts.map +1 -0
  1070. package/dist/mcp/tools/fn-impact.js +14 -0
  1071. package/dist/mcp/tools/fn-impact.js.map +1 -0
  1072. package/dist/mcp/tools/impact-analysis.d.ts +9 -0
  1073. package/dist/mcp/tools/impact-analysis.d.ts.map +1 -0
  1074. package/dist/mcp/tools/impact-analysis.js +8 -0
  1075. package/dist/mcp/tools/impact-analysis.js.map +1 -0
  1076. package/dist/mcp/tools/implementations.d.ts +13 -0
  1077. package/dist/mcp/tools/implementations.d.ts.map +1 -0
  1078. package/dist/mcp/tools/implementations.js +13 -0
  1079. package/dist/mcp/tools/implementations.js.map +1 -0
  1080. package/dist/mcp/tools/index.d.ts +7 -0
  1081. package/dist/mcp/tools/index.d.ts.map +1 -0
  1082. package/dist/mcp/tools/index.js +76 -0
  1083. package/dist/mcp/tools/index.js.map +1 -0
  1084. package/dist/mcp/tools/interfaces.d.ts +13 -0
  1085. package/dist/mcp/tools/interfaces.d.ts.map +1 -0
  1086. package/dist/mcp/tools/interfaces.js +13 -0
  1087. package/dist/mcp/tools/interfaces.js.map +1 -0
  1088. package/dist/mcp/tools/list-functions.d.ts +12 -0
  1089. package/dist/mcp/tools/list-functions.d.ts.map +1 -0
  1090. package/dist/mcp/tools/list-functions.js +13 -0
  1091. package/dist/mcp/tools/list-functions.js.map +1 -0
  1092. package/dist/mcp/tools/list-repos.d.ts +8 -0
  1093. package/dist/mcp/tools/list-repos.d.ts.map +1 -0
  1094. package/dist/mcp/tools/list-repos.js +11 -0
  1095. package/dist/mcp/tools/list-repos.js.map +1 -0
  1096. package/dist/mcp/tools/module-map.d.ts +9 -0
  1097. package/dist/mcp/tools/module-map.d.ts.map +1 -0
  1098. package/dist/mcp/tools/module-map.js +6 -0
  1099. package/dist/mcp/tools/module-map.js.map +1 -0
  1100. package/dist/mcp/tools/node-roles.d.ts +12 -0
  1101. package/dist/mcp/tools/node-roles.d.ts.map +1 -0
  1102. package/dist/mcp/tools/node-roles.js +13 -0
  1103. package/dist/mcp/tools/node-roles.js.map +1 -0
  1104. package/dist/mcp/tools/path.d.ts +15 -0
  1105. package/dist/mcp/tools/path.d.ts.map +1 -0
  1106. package/dist/mcp/tools/path.js +21 -0
  1107. package/dist/mcp/tools/path.js.map +1 -0
  1108. package/dist/mcp/tools/query.d.ts +20 -0
  1109. package/dist/mcp/tools/query.d.ts.map +1 -0
  1110. package/dist/mcp/tools/query.js +29 -0
  1111. package/dist/mcp/tools/query.js.map +1 -0
  1112. package/dist/mcp/tools/semantic-search.d.ts +13 -0
  1113. package/dist/mcp/tools/semantic-search.d.ts.map +1 -0
  1114. package/dist/mcp/tools/semantic-search.js +62 -0
  1115. package/dist/mcp/tools/semantic-search.js.map +1 -0
  1116. package/dist/mcp/tools/sequence.d.ts +16 -0
  1117. package/dist/mcp/tools/sequence.d.ts.map +1 -0
  1118. package/dist/mcp/tools/sequence.js +16 -0
  1119. package/dist/mcp/tools/sequence.js.map +1 -0
  1120. package/dist/mcp/tools/structure.d.ts +13 -0
  1121. package/dist/mcp/tools/structure.d.ts.map +1 -0
  1122. package/dist/mcp/tools/structure.js +14 -0
  1123. package/dist/mcp/tools/structure.js.map +1 -0
  1124. package/dist/mcp/tools/symbol-children.d.ts +13 -0
  1125. package/dist/mcp/tools/symbol-children.d.ts.map +1 -0
  1126. package/dist/mcp/tools/symbol-children.js +13 -0
  1127. package/dist/mcp/tools/symbol-children.js.map +1 -0
  1128. package/dist/mcp/tools/triage.d.ts +17 -0
  1129. package/dist/mcp/tools/triage.d.ts.map +1 -0
  1130. package/dist/mcp/tools/triage.js +34 -0
  1131. package/dist/mcp/tools/triage.js.map +1 -0
  1132. package/dist/mcp/tools/where.d.ts +12 -0
  1133. package/dist/mcp/tools/where.d.ts.map +1 -0
  1134. package/dist/mcp/tools/where.js +12 -0
  1135. package/dist/mcp/tools/where.js.map +1 -0
  1136. package/dist/mcp/types.d.ts +19 -0
  1137. package/dist/mcp/types.d.ts.map +1 -0
  1138. package/dist/mcp/types.js +6 -0
  1139. package/dist/mcp/types.js.map +1 -0
  1140. package/dist/presentation/audit.d.ts +15 -0
  1141. package/dist/presentation/audit.d.ts.map +1 -0
  1142. package/dist/presentation/audit.js +78 -0
  1143. package/dist/presentation/audit.js.map +1 -0
  1144. package/dist/presentation/batch.d.ts +20 -0
  1145. package/dist/presentation/batch.d.ts.map +1 -0
  1146. package/dist/presentation/batch.js +21 -0
  1147. package/dist/presentation/batch.js.map +1 -0
  1148. package/dist/presentation/branch-compare.d.ts +13 -0
  1149. package/dist/presentation/branch-compare.d.ts.map +1 -0
  1150. package/dist/presentation/branch-compare.js +91 -0
  1151. package/dist/presentation/branch-compare.js.map +1 -0
  1152. package/dist/presentation/brief.d.ts +9 -0
  1153. package/dist/presentation/brief.d.ts.map +1 -0
  1154. package/dist/presentation/brief.js +39 -0
  1155. package/dist/presentation/brief.js.map +1 -0
  1156. package/dist/presentation/cfg.d.ts +13 -0
  1157. package/dist/presentation/cfg.d.ts.map +1 -0
  1158. package/dist/presentation/cfg.js +62 -0
  1159. package/dist/presentation/cfg.js.map +1 -0
  1160. package/dist/presentation/check.d.ts +19 -0
  1161. package/dist/presentation/check.d.ts.map +1 -0
  1162. package/dist/presentation/check.js +74 -0
  1163. package/dist/presentation/check.js.map +1 -0
  1164. package/dist/presentation/cochange.d.ts +32 -0
  1165. package/dist/presentation/cochange.d.ts.map +1 -0
  1166. package/dist/presentation/cochange.js +33 -0
  1167. package/dist/presentation/cochange.js.map +1 -0
  1168. package/dist/presentation/colors.d.ts +12 -0
  1169. package/dist/presentation/colors.d.ts.map +1 -0
  1170. package/dist/presentation/colors.js +47 -0
  1171. package/dist/presentation/colors.js.map +1 -0
  1172. package/dist/presentation/communities.d.ts +11 -0
  1173. package/dist/presentation/communities.d.ts.map +1 -0
  1174. package/dist/presentation/communities.js +57 -0
  1175. package/dist/presentation/communities.js.map +1 -0
  1176. package/dist/presentation/complexity.d.ts +17 -0
  1177. package/dist/presentation/complexity.d.ts.map +1 -0
  1178. package/dist/presentation/complexity.js +59 -0
  1179. package/dist/presentation/complexity.js.map +1 -0
  1180. package/dist/presentation/dataflow.d.ts +14 -0
  1181. package/dist/presentation/dataflow.d.ts.map +1 -0
  1182. package/dist/presentation/dataflow.js +100 -0
  1183. package/dist/presentation/dataflow.js.map +1 -0
  1184. package/dist/presentation/diff-impact-mermaid.d.ts +11 -0
  1185. package/dist/presentation/diff-impact-mermaid.d.ts.map +1 -0
  1186. package/dist/presentation/diff-impact-mermaid.js +114 -0
  1187. package/dist/presentation/diff-impact-mermaid.js.map +1 -0
  1188. package/dist/presentation/export.d.ts +130 -0
  1189. package/dist/presentation/export.d.ts.map +1 -0
  1190. package/dist/presentation/export.js +311 -0
  1191. package/dist/presentation/export.js.map +1 -0
  1192. package/dist/presentation/flow.d.ts +16 -0
  1193. package/dist/presentation/flow.d.ts.map +1 -0
  1194. package/dist/presentation/flow.js +85 -0
  1195. package/dist/presentation/flow.js.map +1 -0
  1196. package/dist/presentation/manifesto.d.ts +13 -0
  1197. package/dist/presentation/manifesto.d.ts.map +1 -0
  1198. package/dist/presentation/manifesto.js +51 -0
  1199. package/dist/presentation/manifesto.js.map +1 -0
  1200. package/dist/presentation/owners.d.ts +16 -0
  1201. package/dist/presentation/owners.d.ts.map +1 -0
  1202. package/dist/presentation/owners.js +42 -0
  1203. package/dist/presentation/owners.js.map +1 -0
  1204. package/dist/presentation/queries-cli/exports.d.ts +12 -0
  1205. package/dist/presentation/queries-cli/exports.d.ts.map +1 -0
  1206. package/dist/presentation/queries-cli/exports.js +100 -0
  1207. package/dist/presentation/queries-cli/exports.js.map +1 -0
  1208. package/dist/presentation/queries-cli/impact.d.ts +23 -0
  1209. package/dist/presentation/queries-cli/impact.d.ts.map +1 -0
  1210. package/dist/presentation/queries-cli/impact.js +208 -0
  1211. package/dist/presentation/queries-cli/impact.js.map +1 -0
  1212. package/dist/presentation/queries-cli/index.d.ts +6 -0
  1213. package/dist/presentation/queries-cli/index.d.ts.map +1 -0
  1214. package/dist/presentation/queries-cli/index.js +6 -0
  1215. package/dist/presentation/queries-cli/index.js.map +1 -0
  1216. package/dist/presentation/queries-cli/inspect.d.ts +23 -0
  1217. package/dist/presentation/queries-cli/inspect.d.ts.map +1 -0
  1218. package/dist/presentation/queries-cli/inspect.js +376 -0
  1219. package/dist/presentation/queries-cli/inspect.js.map +1 -0
  1220. package/dist/presentation/queries-cli/overview.d.ts +19 -0
  1221. package/dist/presentation/queries-cli/overview.d.ts.map +1 -0
  1222. package/dist/presentation/queries-cli/overview.js +196 -0
  1223. package/dist/presentation/queries-cli/overview.js.map +1 -0
  1224. package/dist/presentation/queries-cli/path.d.ts +15 -0
  1225. package/dist/presentation/queries-cli/path.d.ts.map +1 -0
  1226. package/dist/presentation/queries-cli/path.js +101 -0
  1227. package/dist/presentation/queries-cli/path.js.map +1 -0
  1228. package/dist/presentation/queries-cli.d.ts +12 -0
  1229. package/dist/presentation/queries-cli.d.ts.map +1 -0
  1230. package/dist/presentation/queries-cli.js +12 -0
  1231. package/dist/presentation/queries-cli.js.map +1 -0
  1232. package/dist/presentation/query.d.ts +2 -0
  1233. package/dist/presentation/query.d.ts.map +1 -0
  1234. package/dist/presentation/query.js +2 -0
  1235. package/dist/presentation/query.js.map +1 -0
  1236. package/dist/presentation/result-formatter.d.ts +23 -0
  1237. package/dist/presentation/result-formatter.d.ts.map +1 -0
  1238. package/dist/presentation/result-formatter.js +122 -0
  1239. package/dist/presentation/result-formatter.js.map +1 -0
  1240. package/dist/presentation/sequence-renderer.d.ts +19 -0
  1241. package/dist/presentation/sequence-renderer.d.ts.map +1 -0
  1242. package/dist/presentation/sequence-renderer.js +23 -0
  1243. package/dist/presentation/sequence-renderer.js.map +1 -0
  1244. package/dist/presentation/sequence.d.ts +15 -0
  1245. package/dist/presentation/sequence.d.ts.map +1 -0
  1246. package/dist/presentation/sequence.js +26 -0
  1247. package/dist/presentation/sequence.js.map +1 -0
  1248. package/dist/presentation/structure.d.ts +46 -0
  1249. package/dist/presentation/structure.d.ts.map +1 -0
  1250. package/dist/presentation/structure.js +50 -0
  1251. package/dist/presentation/structure.js.map +1 -0
  1252. package/dist/presentation/table.d.ts +24 -0
  1253. package/dist/presentation/table.d.ts.map +1 -0
  1254. package/dist/presentation/table.js +33 -0
  1255. package/dist/presentation/table.js.map +1 -0
  1256. package/dist/presentation/triage.d.ts +19 -0
  1257. package/dist/presentation/triage.d.ts.map +1 -0
  1258. package/dist/presentation/triage.js +34 -0
  1259. package/dist/presentation/triage.js.map +1 -0
  1260. package/dist/presentation/viewer.d.ts +102 -0
  1261. package/dist/presentation/viewer.d.ts.map +1 -0
  1262. package/dist/presentation/viewer.js +618 -0
  1263. package/dist/presentation/viewer.js.map +1 -0
  1264. package/dist/shared/constants.d.ts +33 -0
  1265. package/dist/shared/constants.d.ts.map +1 -0
  1266. package/dist/shared/constants.js +54 -0
  1267. package/dist/shared/constants.js.map +1 -0
  1268. package/dist/shared/errors.d.ts +46 -0
  1269. package/dist/shared/errors.d.ts.map +1 -0
  1270. package/dist/shared/errors.js +69 -0
  1271. package/dist/shared/errors.js.map +1 -0
  1272. package/dist/shared/file-utils.d.ts +27 -0
  1273. package/dist/shared/file-utils.d.ts.map +1 -0
  1274. package/dist/shared/file-utils.js +186 -0
  1275. package/dist/shared/file-utils.js.map +1 -0
  1276. package/dist/shared/generators.d.ts +57 -0
  1277. package/dist/shared/generators.d.ts.map +1 -0
  1278. package/dist/shared/generators.js +106 -0
  1279. package/dist/shared/generators.js.map +1 -0
  1280. package/dist/shared/globs.d.ts +40 -0
  1281. package/dist/shared/globs.d.ts.map +1 -0
  1282. package/dist/shared/globs.js +126 -0
  1283. package/dist/shared/globs.js.map +1 -0
  1284. package/dist/shared/hierarchy.d.ts +9 -0
  1285. package/dist/shared/hierarchy.d.ts.map +1 -0
  1286. package/dist/shared/hierarchy.js +68 -0
  1287. package/dist/shared/hierarchy.js.map +1 -0
  1288. package/dist/shared/kinds.d.ts +12 -0
  1289. package/dist/shared/kinds.d.ts.map +1 -0
  1290. package/dist/shared/kinds.js +67 -0
  1291. package/dist/shared/kinds.js.map +1 -0
  1292. package/dist/shared/normalize.d.ts +49 -0
  1293. package/dist/shared/normalize.d.ts.map +1 -0
  1294. package/dist/shared/normalize.js +57 -0
  1295. package/dist/shared/normalize.js.map +1 -0
  1296. package/dist/shared/paginate.d.ts +32 -0
  1297. package/dist/shared/paginate.d.ts.map +1 -0
  1298. package/dist/shared/paginate.js +82 -0
  1299. package/dist/shared/paginate.js.map +1 -0
  1300. package/dist/shared/version.d.ts +2 -0
  1301. package/dist/shared/version.d.ts.map +1 -0
  1302. package/dist/shared/version.js +5 -0
  1303. package/dist/shared/version.js.map +1 -0
  1304. package/dist/types.d.ts +2468 -0
  1305. package/dist/types.d.ts.map +1 -0
  1306. package/dist/types.js +10 -0
  1307. package/dist/types.js.map +1 -0
  1308. package/grammars/tree-sitter-bash.wasm +0 -0
  1309. package/grammars/tree-sitter-c.wasm +0 -0
  1310. package/grammars/tree-sitter-c_sharp.wasm +0 -0
  1311. package/grammars/tree-sitter-clojure.wasm +0 -0
  1312. package/grammars/tree-sitter-cpp.wasm +0 -0
  1313. package/grammars/tree-sitter-cuda.wasm +0 -0
  1314. package/grammars/tree-sitter-dart.wasm +0 -0
  1315. package/grammars/tree-sitter-elixir.wasm +0 -0
  1316. package/grammars/tree-sitter-erlang.wasm +0 -0
  1317. package/grammars/tree-sitter-fsharp.wasm +0 -0
  1318. package/grammars/tree-sitter-fsharp_signature.wasm +0 -0
  1319. package/grammars/tree-sitter-gleam.wasm +0 -0
  1320. package/grammars/tree-sitter-go.wasm +0 -0
  1321. package/grammars/tree-sitter-groovy.wasm +0 -0
  1322. package/grammars/tree-sitter-haskell.wasm +0 -0
  1323. package/grammars/tree-sitter-hcl.wasm +0 -0
  1324. package/grammars/tree-sitter-java.wasm +0 -0
  1325. package/grammars/tree-sitter-javascript.wasm +0 -0
  1326. package/grammars/tree-sitter-julia.wasm +0 -0
  1327. package/grammars/tree-sitter-kotlin.wasm +0 -0
  1328. package/grammars/tree-sitter-lua.wasm +0 -0
  1329. package/grammars/tree-sitter-objc.wasm +0 -0
  1330. package/grammars/tree-sitter-ocaml.wasm +0 -0
  1331. package/grammars/tree-sitter-ocaml_interface.wasm +0 -0
  1332. package/grammars/tree-sitter-php.wasm +0 -0
  1333. package/grammars/tree-sitter-python.wasm +0 -0
  1334. package/grammars/tree-sitter-r.wasm +0 -0
  1335. package/grammars/tree-sitter-ruby.wasm +0 -0
  1336. package/grammars/tree-sitter-rust.wasm +0 -0
  1337. package/grammars/tree-sitter-scala.wasm +0 -0
  1338. package/grammars/tree-sitter-solidity.wasm +0 -0
  1339. package/grammars/tree-sitter-swift.wasm +0 -0
  1340. package/grammars/tree-sitter-tsx.wasm +0 -0
  1341. package/grammars/tree-sitter-typescript.wasm +0 -0
  1342. package/grammars/tree-sitter-verilog.wasm +0 -0
  1343. package/grammars/tree-sitter-zig.wasm +0 -0
  1344. package/package.json +188 -0
  1345. package/src/ast-analysis/engine.ts +926 -0
  1346. package/src/ast-analysis/metrics.ts +150 -0
  1347. package/src/ast-analysis/rules/b2.ts +263 -0
  1348. package/src/ast-analysis/rules/b3.ts +127 -0
  1349. package/src/ast-analysis/rules/b4.ts +378 -0
  1350. package/src/ast-analysis/rules/b5.ts +65 -0
  1351. package/src/ast-analysis/rules/c.ts +157 -0
  1352. package/src/ast-analysis/rules/csharp.ts +210 -0
  1353. package/src/ast-analysis/rules/go.ts +187 -0
  1354. package/src/ast-analysis/rules/index.ts +380 -0
  1355. package/src/ast-analysis/rules/java.ts +181 -0
  1356. package/src/ast-analysis/rules/javascript.ts +249 -0
  1357. package/src/ast-analysis/rules/php.ts +226 -0
  1358. package/src/ast-analysis/rules/python.ts +202 -0
  1359. package/src/ast-analysis/rules/ruby.ts +209 -0
  1360. package/src/ast-analysis/rules/rust.ts +179 -0
  1361. package/src/ast-analysis/shared.ts +223 -0
  1362. package/src/ast-analysis/visitor-utils.ts +278 -0
  1363. package/src/ast-analysis/visitor.ts +266 -0
  1364. package/src/ast-analysis/visitors/ast-store-visitor.ts +334 -0
  1365. package/src/ast-analysis/visitors/cfg-conditionals.ts +227 -0
  1366. package/src/ast-analysis/visitors/cfg-loops.ts +136 -0
  1367. package/src/ast-analysis/visitors/cfg-shared.ts +196 -0
  1368. package/src/ast-analysis/visitors/cfg-try-catch.ts +142 -0
  1369. package/src/ast-analysis/visitors/cfg-visitor.ts +367 -0
  1370. package/src/ast-analysis/visitors/complexity-visitor.ts +328 -0
  1371. package/src/ast-analysis/visitors/dataflow-visitor.ts +571 -0
  1372. package/src/cli/commands/ast.ts +24 -0
  1373. package/src/cli/commands/audit.ts +48 -0
  1374. package/src/cli/commands/batch.ts +66 -0
  1375. package/src/cli/commands/branch-compare.ts +27 -0
  1376. package/src/cli/commands/brief.ts +13 -0
  1377. package/src/cli/commands/build.ts +35 -0
  1378. package/src/cli/commands/cfg.ts +28 -0
  1379. package/src/cli/commands/check.ts +72 -0
  1380. package/src/cli/commands/children.ts +34 -0
  1381. package/src/cli/commands/co-change.ts +72 -0
  1382. package/src/cli/commands/communities.ts +21 -0
  1383. package/src/cli/commands/complexity.ts +48 -0
  1384. package/src/cli/commands/config.ts +353 -0
  1385. package/src/cli/commands/context.ts +36 -0
  1386. package/src/cli/commands/cycles.ts +33 -0
  1387. package/src/cli/commands/dataflow.ts +30 -0
  1388. package/src/cli/commands/deps.ts +18 -0
  1389. package/src/cli/commands/diff-impact.ts +30 -0
  1390. package/src/cli/commands/embed.ts +82 -0
  1391. package/src/cli/commands/export.ts +79 -0
  1392. package/src/cli/commands/exports.ts +15 -0
  1393. package/src/cli/commands/flow.ts +34 -0
  1394. package/src/cli/commands/fn-impact.ts +34 -0
  1395. package/src/cli/commands/impact.ts +13 -0
  1396. package/src/cli/commands/implementations.ts +30 -0
  1397. package/src/cli/commands/info.ts +79 -0
  1398. package/src/cli/commands/interfaces.ts +30 -0
  1399. package/src/cli/commands/map.ts +20 -0
  1400. package/src/cli/commands/mcp.ts +19 -0
  1401. package/src/cli/commands/models.ts +29 -0
  1402. package/src/cli/commands/owners.ts +28 -0
  1403. package/src/cli/commands/path.ts +42 -0
  1404. package/src/cli/commands/plot.ts +110 -0
  1405. package/src/cli/commands/query.ts +51 -0
  1406. package/src/cli/commands/registry.ts +106 -0
  1407. package/src/cli/commands/roles.ts +38 -0
  1408. package/src/cli/commands/search.ts +45 -0
  1409. package/src/cli/commands/sequence.ts +30 -0
  1410. package/src/cli/commands/snapshot.ts +67 -0
  1411. package/src/cli/commands/stats.ts +16 -0
  1412. package/src/cli/commands/structure.ts +55 -0
  1413. package/src/cli/commands/triage.ts +93 -0
  1414. package/src/cli/commands/watch.ts +29 -0
  1415. package/src/cli/commands/where.ts +21 -0
  1416. package/src/cli/index.ts +159 -0
  1417. package/src/cli/shared/open-graph.ts +13 -0
  1418. package/src/cli/shared/options.ts +69 -0
  1419. package/src/cli/shared/output.ts +1 -0
  1420. package/src/cli/types.ts +35 -0
  1421. package/src/cli.ts +37 -0
  1422. package/src/db/better-sqlite3.ts +21 -0
  1423. package/src/db/connection.ts +478 -0
  1424. package/src/db/index.ts +84 -0
  1425. package/src/db/migrations.ts +440 -0
  1426. package/src/db/query-builder.ts +371 -0
  1427. package/src/db/repository/base.ts +269 -0
  1428. package/src/db/repository/build-stmts.ts +126 -0
  1429. package/src/db/repository/cached-stmt.ts +20 -0
  1430. package/src/db/repository/cfg.ts +81 -0
  1431. package/src/db/repository/cochange.ts +48 -0
  1432. package/src/db/repository/complexity.ts +21 -0
  1433. package/src/db/repository/dataflow.ts +35 -0
  1434. package/src/db/repository/edges.ts +281 -0
  1435. package/src/db/repository/embeddings.ts +47 -0
  1436. package/src/db/repository/graph-read.ts +62 -0
  1437. package/src/db/repository/in-memory-repository.ts +657 -0
  1438. package/src/db/repository/index.ts +53 -0
  1439. package/src/db/repository/native-repository.ts +546 -0
  1440. package/src/db/repository/nodes.ts +322 -0
  1441. package/src/db/repository/sqlite-repository.ts +303 -0
  1442. package/src/domain/analysis/brief.ts +165 -0
  1443. package/src/domain/analysis/context.ts +537 -0
  1444. package/src/domain/analysis/dependencies.ts +738 -0
  1445. package/src/domain/analysis/diff-impact.ts +381 -0
  1446. package/src/domain/analysis/exports.ts +262 -0
  1447. package/src/domain/analysis/fn-impact.ts +311 -0
  1448. package/src/domain/analysis/impact.ts +11 -0
  1449. package/src/domain/analysis/implementations.ts +81 -0
  1450. package/src/domain/analysis/module-map.ts +576 -0
  1451. package/src/domain/analysis/query-helpers.ts +52 -0
  1452. package/src/domain/analysis/roles.ts +95 -0
  1453. package/src/domain/analysis/symbol-lookup.ts +284 -0
  1454. package/src/domain/graph/builder/call-resolver.ts +289 -0
  1455. package/src/domain/graph/builder/cha.ts +192 -0
  1456. package/src/domain/graph/builder/context.ts +120 -0
  1457. package/src/domain/graph/builder/helpers.ts +665 -0
  1458. package/src/domain/graph/builder/incremental.ts +987 -0
  1459. package/src/domain/graph/builder/native-db-proxy.ts +104 -0
  1460. package/src/domain/graph/builder/pipeline.ts +517 -0
  1461. package/src/domain/graph/builder/stages/build-edges.ts +1986 -0
  1462. package/src/domain/graph/builder/stages/build-structure.ts +330 -0
  1463. package/src/domain/graph/builder/stages/collect-files.ts +175 -0
  1464. package/src/domain/graph/builder/stages/detect-changes.ts +751 -0
  1465. package/src/domain/graph/builder/stages/finalize.ts +321 -0
  1466. package/src/domain/graph/builder/stages/insert-nodes.ts +489 -0
  1467. package/src/domain/graph/builder/stages/native-db-lifecycle.ts +74 -0
  1468. package/src/domain/graph/builder/stages/native-orchestrator.ts +2241 -0
  1469. package/src/domain/graph/builder/stages/parse-files.ts +26 -0
  1470. package/src/domain/graph/builder/stages/resolve-imports.ts +285 -0
  1471. package/src/domain/graph/builder/stages/run-analyses.ts +26 -0
  1472. package/src/domain/graph/builder.ts +11 -0
  1473. package/src/domain/graph/change-journal.ts +141 -0
  1474. package/src/domain/graph/cycles.ts +155 -0
  1475. package/src/domain/graph/journal.ts +377 -0
  1476. package/src/domain/graph/resolve.ts +579 -0
  1477. package/src/domain/graph/resolver/points-to.ts +377 -0
  1478. package/src/domain/graph/resolver/strategy.ts +265 -0
  1479. package/src/domain/graph/resolver/ts-resolver.ts +536 -0
  1480. package/src/domain/graph/watcher.ts +339 -0
  1481. package/src/domain/parser.ts +1437 -0
  1482. package/src/domain/queries.ts +50 -0
  1483. package/src/domain/search/generator.ts +260 -0
  1484. package/src/domain/search/index.ts +15 -0
  1485. package/src/domain/search/models.ts +356 -0
  1486. package/src/domain/search/search/cli-formatter.ts +179 -0
  1487. package/src/domain/search/search/filters.ts +38 -0
  1488. package/src/domain/search/search/hybrid.ts +197 -0
  1489. package/src/domain/search/search/keyword.ts +101 -0
  1490. package/src/domain/search/search/prepare.ts +95 -0
  1491. package/src/domain/search/search/semantic.ts +226 -0
  1492. package/src/domain/search/stores/fts5.ts +27 -0
  1493. package/src/domain/search/stores/sqlite-blob.ts +15 -0
  1494. package/src/domain/search/strategies/source.ts +19 -0
  1495. package/src/domain/search/strategies/structured.ts +48 -0
  1496. package/src/domain/search/strategies/text-utils.ts +41 -0
  1497. package/src/domain/wasm-worker-entry.ts +921 -0
  1498. package/src/domain/wasm-worker-pool.ts +375 -0
  1499. package/src/domain/wasm-worker-protocol.ts +98 -0
  1500. package/src/extractors/bash.ts +97 -0
  1501. package/src/extractors/c.ts +231 -0
  1502. package/src/extractors/clojure.ts +273 -0
  1503. package/src/extractors/cpp.ts +383 -0
  1504. package/src/extractors/csharp.ts +448 -0
  1505. package/src/extractors/cuda.ts +433 -0
  1506. package/src/extractors/dart.ts +304 -0
  1507. package/src/extractors/elixir.ts +350 -0
  1508. package/src/extractors/erlang.ts +295 -0
  1509. package/src/extractors/fsharp.ts +357 -0
  1510. package/src/extractors/gleam.ts +247 -0
  1511. package/src/extractors/go.ts +512 -0
  1512. package/src/extractors/groovy.ts +436 -0
  1513. package/src/extractors/haskell.ts +276 -0
  1514. package/src/extractors/hcl.ts +136 -0
  1515. package/src/extractors/helpers.ts +449 -0
  1516. package/src/extractors/index.ts +32 -0
  1517. package/src/extractors/java.ts +439 -0
  1518. package/src/extractors/javascript.ts +3844 -0
  1519. package/src/extractors/julia.ts +432 -0
  1520. package/src/extractors/kotlin.ts +358 -0
  1521. package/src/extractors/lua.ts +169 -0
  1522. package/src/extractors/objc.ts +555 -0
  1523. package/src/extractors/ocaml.ts +337 -0
  1524. package/src/extractors/php.ts +399 -0
  1525. package/src/extractors/python.ts +439 -0
  1526. package/src/extractors/r.ts +275 -0
  1527. package/src/extractors/ruby.ts +292 -0
  1528. package/src/extractors/rust.ts +371 -0
  1529. package/src/extractors/scala.ts +335 -0
  1530. package/src/extractors/solidity.ts +375 -0
  1531. package/src/extractors/swift.ts +337 -0
  1532. package/src/extractors/verilog.ts +383 -0
  1533. package/src/extractors/zig.ts +291 -0
  1534. package/src/features/ast.ts +405 -0
  1535. package/src/features/audit.ts +446 -0
  1536. package/src/features/batch.ts +182 -0
  1537. package/src/features/boundaries.ts +345 -0
  1538. package/src/features/branch-compare.ts +618 -0
  1539. package/src/features/cfg.ts +750 -0
  1540. package/src/features/check.ts +454 -0
  1541. package/src/features/cochange.ts +506 -0
  1542. package/src/features/communities.ts +232 -0
  1543. package/src/features/complexity-query.ts +388 -0
  1544. package/src/features/complexity.ts +753 -0
  1545. package/src/features/dataflow.ts +1654 -0
  1546. package/src/features/export.ts +486 -0
  1547. package/src/features/flow.ts +307 -0
  1548. package/src/features/graph-enrichment.ts +493 -0
  1549. package/src/features/manifesto.ts +508 -0
  1550. package/src/features/owners.ts +360 -0
  1551. package/src/features/sequence.ts +410 -0
  1552. package/src/features/shared/find-nodes.ts +28 -0
  1553. package/src/features/snapshot.ts +221 -0
  1554. package/src/features/structure-query.ts +456 -0
  1555. package/src/features/structure.ts +1100 -0
  1556. package/src/features/triage.ts +199 -0
  1557. package/src/graph/algorithms/bfs.ts +92 -0
  1558. package/src/graph/algorithms/centrality.ts +50 -0
  1559. package/src/graph/algorithms/index.ts +6 -0
  1560. package/src/graph/algorithms/leiden/LICENSE +24 -0
  1561. package/src/graph/algorithms/leiden/adapter.ts +252 -0
  1562. package/src/graph/algorithms/leiden/cpm.ts +77 -0
  1563. package/src/graph/algorithms/leiden/index.ts +224 -0
  1564. package/src/graph/algorithms/leiden/modularity.ts +122 -0
  1565. package/src/graph/algorithms/leiden/optimiser.ts +706 -0
  1566. package/src/graph/algorithms/leiden/partition.ts +577 -0
  1567. package/src/graph/algorithms/leiden/rng.ts +20 -0
  1568. package/src/graph/algorithms/louvain.ts +75 -0
  1569. package/src/graph/algorithms/shortest-path.ts +59 -0
  1570. package/src/graph/algorithms/tarjan.ts +55 -0
  1571. package/src/graph/builders/dependency.ts +148 -0
  1572. package/src/graph/builders/index.ts +3 -0
  1573. package/src/graph/builders/structure.ts +58 -0
  1574. package/src/graph/builders/temporal.ts +51 -0
  1575. package/src/graph/classifiers/index.ts +2 -0
  1576. package/src/graph/classifiers/risk.ts +123 -0
  1577. package/src/graph/classifiers/roles.ts +226 -0
  1578. package/src/graph/index.ts +13 -0
  1579. package/src/graph/model.ts +238 -0
  1580. package/src/index.cjs +16 -0
  1581. package/src/index.ts +72 -0
  1582. package/src/infrastructure/config.ts +954 -0
  1583. package/src/infrastructure/logger.ts +24 -0
  1584. package/src/infrastructure/native.ts +199 -0
  1585. package/src/infrastructure/registry.ts +313 -0
  1586. package/src/infrastructure/result-formatter.ts +2 -0
  1587. package/src/infrastructure/suppress.ts +47 -0
  1588. package/src/infrastructure/test-filter.ts +7 -0
  1589. package/src/infrastructure/update-check.ts +196 -0
  1590. package/src/mcp/index.ts +2 -0
  1591. package/src/mcp/middleware.ts +38 -0
  1592. package/src/mcp/server.ts +259 -0
  1593. package/src/mcp/tool-registry.ts +890 -0
  1594. package/src/mcp/tools/ast-query.ts +25 -0
  1595. package/src/mcp/tools/audit.ts +33 -0
  1596. package/src/mcp/tools/batch-query.ts +22 -0
  1597. package/src/mcp/tools/branch-compare.ts +22 -0
  1598. package/src/mcp/tools/brief.ts +15 -0
  1599. package/src/mcp/tools/cfg.ts +32 -0
  1600. package/src/mcp/tools/check.ts +60 -0
  1601. package/src/mcp/tools/co-changes.ts +29 -0
  1602. package/src/mcp/tools/code-owners.ts +22 -0
  1603. package/src/mcp/tools/communities.ts +25 -0
  1604. package/src/mcp/tools/complexity.ts +30 -0
  1605. package/src/mcp/tools/context.ts +30 -0
  1606. package/src/mcp/tools/dataflow.ts +38 -0
  1607. package/src/mcp/tools/diff-impact.ts +35 -0
  1608. package/src/mcp/tools/execution-flow.ts +38 -0
  1609. package/src/mcp/tools/export-graph.ts +67 -0
  1610. package/src/mcp/tools/file-deps.ts +20 -0
  1611. package/src/mcp/tools/file-exports.ts +22 -0
  1612. package/src/mcp/tools/find-cycles.ts +19 -0
  1613. package/src/mcp/tools/fn-impact.ts +26 -0
  1614. package/src/mcp/tools/impact-analysis.ts +15 -0
  1615. package/src/mcp/tools/implementations.ts +24 -0
  1616. package/src/mcp/tools/index.ts +81 -0
  1617. package/src/mcp/tools/interfaces.ts +24 -0
  1618. package/src/mcp/tools/list-functions.ts +23 -0
  1619. package/src/mcp/tools/list-repos.ts +17 -0
  1620. package/src/mcp/tools/module-map.ts +13 -0
  1621. package/src/mcp/tools/node-roles.ts +23 -0
  1622. package/src/mcp/tools/path.ts +34 -0
  1623. package/src/mcp/tools/query.ts +47 -0
  1624. package/src/mcp/tools/semantic-search.ts +76 -0
  1625. package/src/mcp/tools/sequence.ts +30 -0
  1626. package/src/mcp/tools/structure.ts +25 -0
  1627. package/src/mcp/tools/symbol-children.ts +24 -0
  1628. package/src/mcp/tools/triage.ts +50 -0
  1629. package/src/mcp/tools/where.ts +22 -0
  1630. package/src/mcp/types.ts +21 -0
  1631. package/src/presentation/audit.ts +109 -0
  1632. package/src/presentation/batch.ts +50 -0
  1633. package/src/presentation/branch-compare.ts +148 -0
  1634. package/src/presentation/brief.ts +63 -0
  1635. package/src/presentation/cfg.ts +103 -0
  1636. package/src/presentation/check.ts +138 -0
  1637. package/src/presentation/cochange.ts +57 -0
  1638. package/src/presentation/colors.ts +51 -0
  1639. package/src/presentation/communities.ts +114 -0
  1640. package/src/presentation/complexity.ts +127 -0
  1641. package/src/presentation/dataflow.ts +179 -0
  1642. package/src/presentation/diff-impact-mermaid.ts +169 -0
  1643. package/src/presentation/export.ts +509 -0
  1644. package/src/presentation/flow.ts +147 -0
  1645. package/src/presentation/manifesto.ts +92 -0
  1646. package/src/presentation/owners.ts +89 -0
  1647. package/src/presentation/queries-cli/exports.ts +152 -0
  1648. package/src/presentation/queries-cli/impact.ts +340 -0
  1649. package/src/presentation/queries-cli/index.ts +13 -0
  1650. package/src/presentation/queries-cli/inspect.ts +594 -0
  1651. package/src/presentation/queries-cli/overview.ts +375 -0
  1652. package/src/presentation/queries-cli/path.ts +187 -0
  1653. package/src/presentation/queries-cli.ts +30 -0
  1654. package/src/presentation/query.ts +17 -0
  1655. package/src/presentation/result-formatter.ts +161 -0
  1656. package/src/presentation/sequence-renderer.ts +46 -0
  1657. package/src/presentation/sequence.ts +43 -0
  1658. package/src/presentation/structure.ts +109 -0
  1659. package/src/presentation/table.ts +45 -0
  1660. package/src/presentation/triage.ts +84 -0
  1661. package/src/presentation/viewer.ts +715 -0
  1662. package/src/shared/constants.ts +70 -0
  1663. package/src/shared/errors.ts +85 -0
  1664. package/src/shared/file-utils.ts +233 -0
  1665. package/src/shared/generators.ts +176 -0
  1666. package/src/shared/globs.ts +121 -0
  1667. package/src/shared/hierarchy.ts +81 -0
  1668. package/src/shared/kinds.ts +85 -0
  1669. package/src/shared/normalize.ts +106 -0
  1670. package/src/shared/paginate.ts +93 -0
  1671. package/src/shared/version.ts +10 -0
  1672. package/src/types.ts +2871 -0
@@ -0,0 +1,1437 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import type { Tree } from 'web-tree-sitter';
5
+ import { Language, Parser, Query } from 'web-tree-sitter';
6
+ import { debug, warn } from '../infrastructure/logger.js';
7
+ import { getNative, getNativePackageVersion, loadNative } from '../infrastructure/native.js';
8
+ import { ParseError, toErrorMessage } from '../shared/errors.js';
9
+ import type {
10
+ EngineMode,
11
+ ExtractorOutput,
12
+ LanguageId,
13
+ LanguageRegistryEntry,
14
+ TypeMapEntry,
15
+ } from '../types.js';
16
+ import { disposeWasmWorkerPool, getWasmWorkerPool } from './wasm-worker-pool.js';
17
+ import type { WorkerAnalysisOpts } from './wasm-worker-protocol.js';
18
+
19
+ /** Default worker opts: run all analyses so output matches parseFilesFull. */
20
+ const FULL_ANALYSIS: WorkerAnalysisOpts = {
21
+ ast: true,
22
+ complexity: true,
23
+ cfg: true,
24
+ dataflow: true,
25
+ };
26
+
27
+ /** Extract-only opts: skip visitor walk for typeMap backfill / similar fast paths. */
28
+ const EXTRACT_ONLY: WorkerAnalysisOpts = {
29
+ ast: false,
30
+ complexity: false,
31
+ cfg: false,
32
+ dataflow: false,
33
+ };
34
+
35
+ // Re-export all extractors for backward compatibility
36
+ export {
37
+ extractBashSymbols,
38
+ extractClojureSymbols,
39
+ extractCppSymbols,
40
+ extractCSharpSymbols,
41
+ extractCSymbols,
42
+ extractCudaSymbols,
43
+ extractDartSymbols,
44
+ extractElixirSymbols,
45
+ extractErlangSymbols,
46
+ extractFSharpSymbols,
47
+ extractGleamSymbols,
48
+ extractGoSymbols,
49
+ extractGroovySymbols,
50
+ extractHaskellSymbols,
51
+ extractHCLSymbols,
52
+ extractJavaSymbols,
53
+ extractJuliaSymbols,
54
+ extractKotlinSymbols,
55
+ extractLuaSymbols,
56
+ extractObjCSymbols,
57
+ extractOCamlSymbols,
58
+ extractPHPSymbols,
59
+ extractPythonSymbols,
60
+ extractRSymbols,
61
+ extractRubySymbols,
62
+ extractRustSymbols,
63
+ extractScalaSymbols,
64
+ extractSoliditySymbols,
65
+ extractSwiftSymbols,
66
+ extractSymbols,
67
+ extractVerilogSymbols,
68
+ extractZigSymbols,
69
+ } from '../extractors/index.js';
70
+
71
+ import {
72
+ extractBashSymbols,
73
+ extractClojureSymbols,
74
+ extractCppSymbols,
75
+ extractCSharpSymbols,
76
+ extractCSymbols,
77
+ extractCudaSymbols,
78
+ extractDartSymbols,
79
+ extractElixirSymbols,
80
+ extractErlangSymbols,
81
+ extractFSharpSymbols,
82
+ extractGleamSymbols,
83
+ extractGoSymbols,
84
+ extractGroovySymbols,
85
+ extractHaskellSymbols,
86
+ extractHCLSymbols,
87
+ extractJavaSymbols,
88
+ extractJuliaSymbols,
89
+ extractKotlinSymbols,
90
+ extractLuaSymbols,
91
+ extractObjCSymbols,
92
+ extractOCamlSymbols,
93
+ extractPHPSymbols,
94
+ extractPythonSymbols,
95
+ extractRSymbols,
96
+ extractRubySymbols,
97
+ extractRustSymbols,
98
+ extractScalaSymbols,
99
+ extractSoliditySymbols,
100
+ extractSwiftSymbols,
101
+ extractSymbols,
102
+ extractVerilogSymbols,
103
+ extractZigSymbols,
104
+ } from '../extractors/index.js';
105
+
106
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
107
+
108
+ function grammarPath(name: string): string {
109
+ return path.join(__dirname, '..', '..', 'grammars', name);
110
+ }
111
+
112
+ let _initialized: boolean = false;
113
+
114
+ // Memoized parsers — avoids reloading WASM grammars on every createParsers() call
115
+ let _cachedParsers: Map<string, Parser | null> | null = null;
116
+
117
+ // Cached Language objects — WASM-backed, must be .delete()'d explicitly
118
+ let _cachedLanguages: Map<string, Language> | null = null;
119
+
120
+ // Query cache for JS/TS/TSX extractors (populated during createParsers)
121
+ const _queryCache: Map<string, Query> = new Map();
122
+
123
+ // Tracks whether ALL grammars have been loaded (vs. a lazy subset)
124
+ let _allParsersLoaded: boolean = false;
125
+
126
+ // In-flight grammar loads keyed by language id — prevents concurrent duplicate loads
127
+ const _loadingPromises: Map<string, Promise<void>> = new Map();
128
+
129
+ // Extensions that need typeMap backfill (type annotations only exist in TS/TSX)
130
+ const TS_BACKFILL_EXTS = new Set(['.ts', '.tsx']);
131
+
132
+ // Re-export for backward compatibility
133
+ export type { LanguageRegistryEntry } from '../types.js';
134
+
135
+ interface ParseEngineOpts {
136
+ engine?: EngineMode;
137
+ dataflow?: boolean;
138
+ ast?: boolean;
139
+ }
140
+
141
+ interface ResolvedEngine {
142
+ name: 'native' | 'wasm';
143
+ native: any;
144
+ }
145
+
146
+ interface WasmExtractResult {
147
+ symbols: ExtractorOutput;
148
+ tree: Tree;
149
+ langId: LanguageId;
150
+ }
151
+
152
+ // Shared patterns for all JS/TS/TSX (class_declaration excluded — name type differs)
153
+ const COMMON_QUERY_PATTERNS: string[] = [
154
+ '(function_declaration name: (identifier) @fn_name) @fn_node',
155
+ '(generator_function_declaration name: (identifier) @fn_name) @fn_node',
156
+ '(variable_declarator name: (identifier) @varfn_name value: (arrow_function) @varfn_value)',
157
+ '(variable_declarator name: (identifier) @varfn_name value: (function_expression) @varfn_value)',
158
+ '(variable_declarator name: (identifier) @varfn_name value: (generator_function) @varfn_value)',
159
+ '(method_definition name: (property_identifier) @meth_name) @meth_node',
160
+ '(method_definition name: (private_property_identifier) @meth_name) @meth_node',
161
+ '(method_definition name: (computed_property_name) @meth_name) @meth_node',
162
+ '(import_statement source: (string) @imp_source) @imp_node',
163
+ '(export_statement) @exp_node',
164
+ '(call_expression function: (identifier) @callfn_name) @callfn_node',
165
+ '(call_expression function: (member_expression) @callmem_fn) @callmem_node',
166
+ '(call_expression function: (subscript_expression) @callsub_fn) @callsub_node',
167
+ '(new_expression constructor: (identifier) @newfn_name) @newfn_node',
168
+ '(new_expression constructor: (member_expression) @newmem_fn) @newmem_node',
169
+ '(expression_statement (assignment_expression left: (member_expression) @assign_left right: (_) @assign_right)) @assign_node',
170
+ ];
171
+
172
+ // JS: class name is (identifier) — declarations and expressions
173
+ const JS_CLASS_PATTERNS: string[] = [
174
+ '(class_declaration name: (identifier) @cls_name) @cls_node',
175
+ // class expressions: `return class Foo extends Bar { ... }` or `const X = class Foo { ... }`
176
+ '(class name: (identifier) @cls_name) @cls_node',
177
+ ];
178
+
179
+ // TS/TSX: class name is (type_identifier), plus interface and type alias
180
+ // abstract_class_declaration is a separate node type in tree-sitter-typescript
181
+ const TS_EXTRA_PATTERNS: string[] = [
182
+ '(class_declaration name: (type_identifier) @cls_name) @cls_node',
183
+ '(abstract_class_declaration name: (type_identifier) @cls_name) @cls_node',
184
+ // class expressions: `return class Foo extends Bar { ... }`
185
+ '(class name: (type_identifier) @cls_name) @cls_node',
186
+ '(interface_declaration name: (type_identifier) @iface_name) @iface_node',
187
+ '(type_alias_declaration name: (type_identifier) @type_name) @type_node',
188
+ ];
189
+
190
+ /**
191
+ * Load a single language grammar and cache the parser + language + query.
192
+ * Uses in-flight deduplication so concurrent callers awaiting the same grammar
193
+ * share a single load rather than producing orphaned WASM instances.
194
+ * Assumes Parser.init() has already been called and _cachedParsers/_cachedLanguages exist.
195
+ */
196
+ async function loadLanguage(entry: LanguageRegistryEntry): Promise<void> {
197
+ if (_cachedParsers!.has(entry.id)) return;
198
+ const inflight = _loadingPromises.get(entry.id);
199
+ if (inflight) return inflight;
200
+ const p = doLoadLanguage(entry).finally(() => _loadingPromises.delete(entry.id));
201
+ _loadingPromises.set(entry.id, p);
202
+ return p;
203
+ }
204
+
205
+ async function doLoadLanguage(entry: LanguageRegistryEntry): Promise<void> {
206
+ try {
207
+ const lang = await Language.load(grammarPath(entry.grammarFile));
208
+ const parser = new Parser();
209
+ parser.setLanguage(lang);
210
+ _cachedParsers!.set(entry.id, parser);
211
+ _cachedLanguages!.set(entry.id, lang);
212
+ if (entry.extractor === extractSymbols && !_queryCache.has(entry.id)) {
213
+ const isTS = entry.id === 'typescript' || entry.id === 'tsx';
214
+ const patterns = isTS
215
+ ? [...COMMON_QUERY_PATTERNS, ...TS_EXTRA_PATTERNS]
216
+ : [...COMMON_QUERY_PATTERNS, ...JS_CLASS_PATTERNS];
217
+ _queryCache.set(entry.id, new Query(lang, patterns.join('\n')));
218
+ }
219
+ } catch (e: unknown) {
220
+ if (entry.required)
221
+ throw new ParseError(`Required parser ${entry.id} failed to initialize`, {
222
+ file: entry.grammarFile,
223
+ cause: e as Error,
224
+ });
225
+ const isEnoent = (e as NodeJS.ErrnoException).code === 'ENOENT';
226
+ const log = isEnoent ? debug : warn;
227
+ log(
228
+ `${entry.id} parser failed to initialize: ${(e as Error).message}. ${entry.id} files will be skipped.`,
229
+ );
230
+ _cachedParsers!.set(entry.id, null);
231
+ }
232
+ }
233
+
234
+ async function initParserRuntime(): Promise<void> {
235
+ if (!_initialized) {
236
+ await Parser.init();
237
+ _initialized = true;
238
+ }
239
+ if (!_cachedParsers) _cachedParsers = new Map();
240
+ if (!_cachedLanguages) _cachedLanguages = new Map();
241
+ }
242
+
243
+ /**
244
+ * Load only the WASM grammars needed for the given file paths.
245
+ * Grammars already in cache are reused. This avoids the ~500ms cold-start
246
+ * penalty of loading all 23+ grammars when only 1-2 are needed (e.g. incremental rebuilds).
247
+ */
248
+ async function ensureParsersForFiles(filePaths: string[]): Promise<Map<string, Parser | null>> {
249
+ await initParserRuntime();
250
+ const needed = new Set<LanguageRegistryEntry>();
251
+ for (const fp of filePaths) {
252
+ const ext = path.extname(fp).toLowerCase();
253
+ const entry = _extToLang.get(ext);
254
+ if (entry && !_cachedParsers!.has(entry.id)) needed.add(entry);
255
+ }
256
+ for (const entry of needed) {
257
+ await loadLanguage(entry);
258
+ }
259
+ return _cachedParsers!;
260
+ }
261
+
262
+ /**
263
+ * Load ALL WASM grammars. Used by full builds and feature modules (CFG, dataflow, complexity)
264
+ * that may process files of any language.
265
+ */
266
+ export async function createParsers(): Promise<Map<string, Parser | null>> {
267
+ if (_cachedParsers && _allParsersLoaded) return _cachedParsers;
268
+
269
+ await initParserRuntime();
270
+ for (const entry of LANGUAGE_REGISTRY) {
271
+ if (!_cachedParsers!.has(entry.id)) {
272
+ await loadLanguage(entry);
273
+ }
274
+ }
275
+ _allParsersLoaded = true;
276
+ return _cachedParsers!;
277
+ }
278
+
279
+ /**
280
+ * Dispose all cached WASM parsers and queries to free WASM linear memory.
281
+ * Call this between repeated builds in the same process (e.g. benchmarks)
282
+ * to prevent memory accumulation that can cause segfaults.
283
+ */
284
+ function disposeMapEntries(entries: Iterable<[string, any]>, label: string): void {
285
+ for (const [id, item] of entries) {
286
+ if (item && typeof item.delete === 'function') {
287
+ try {
288
+ item.delete();
289
+ } catch (e: unknown) {
290
+ debug(`Failed to dispose ${label} ${id}: ${(e as Error).message}`);
291
+ }
292
+ }
293
+ }
294
+ }
295
+
296
+ export async function disposeParsers(): Promise<void> {
297
+ if (_cachedParsers) {
298
+ disposeMapEntries(_cachedParsers, 'parser');
299
+ _cachedParsers = null;
300
+ }
301
+ disposeMapEntries(_queryCache, 'query');
302
+ _queryCache.clear();
303
+ if (_cachedLanguages) {
304
+ disposeMapEntries(_cachedLanguages, 'language');
305
+ _cachedLanguages = null;
306
+ }
307
+ _initialized = false;
308
+ _allParsersLoaded = false;
309
+ _loadingPromises.clear();
310
+ await disposeWasmWorkerPool();
311
+ }
312
+
313
+ export function getParser(parsers: Map<string, Parser | null>, filePath: string): Parser | null {
314
+ const ext = path.extname(filePath);
315
+ const entry = _extToLang.get(ext);
316
+ if (!entry) return null;
317
+ return parsers.get(entry.id) || null;
318
+ }
319
+
320
+ /**
321
+ * Backfill missing AST-analysis data (astNodes, dataflow, def.complexity,
322
+ * def.cfg) via the WASM worker pool for files that were parsed by the native
323
+ * engine but are missing one or more analyses.
324
+ *
325
+ * Historically this function populated `symbols._tree` so the main-thread
326
+ * visitor walk in `ast-analysis/engine.ts` could run. After the worker-isolation
327
+ * refactor (#965), the worker runs every visitor itself and returns pre-computed
328
+ * analysis data — `_tree` is never set on the main thread.
329
+ *
330
+ * Name is preserved for caller compatibility; the function now ensures
331
+ * *analysis data* rather than *trees*.
332
+ *
333
+ * `needsFn` (optional): when provided, only files for which it returns true are
334
+ * re-parsed. Without it the function falls back to "any WASM-parseable file
335
+ * without _tree", which was the source of #1036 — a single file missing one
336
+ * analysis triggered a full-build re-parse of every WASM-parseable file.
337
+ */
338
+ /**
339
+ * Select files from `fileSymbols` that still need analysis data and are
340
+ * parseable by an installed WASM grammar. Pure (no I/O) — safe to unit-test.
341
+ */
342
+ function collectBackfillPending(
343
+ fileSymbols: Map<string, any>,
344
+ rootDir: string,
345
+ needsFn?: (relPath: string, symbols: any) => boolean,
346
+ ): Array<{ relPath: string; absPath: string; symbols: any }> {
347
+ const pending: Array<{ relPath: string; absPath: string; symbols: any }> = [];
348
+ for (const [relPath, symbols] of fileSymbols) {
349
+ if (symbols._tree) continue; // legacy path — leave existing trees alone
350
+ if (!_extToLang.has(path.extname(relPath).toLowerCase())) continue;
351
+ if (needsFn && !needsFn(relPath, symbols)) continue;
352
+ pending.push({ relPath, absPath: path.join(rootDir, relPath), symbols });
353
+ }
354
+ return pending;
355
+ }
356
+
357
+ export async function ensureWasmTrees(
358
+ fileSymbols: Map<string, any>,
359
+ rootDir: string,
360
+ needsFn?: (relPath: string, symbols: any) => boolean,
361
+ ): Promise<void> {
362
+ const pending = collectBackfillPending(fileSymbols, rootDir, needsFn);
363
+ if (pending.length === 0) return;
364
+
365
+ const pool = getWasmWorkerPool();
366
+ for (const { relPath, absPath, symbols } of pending) {
367
+ let code: string;
368
+ try {
369
+ code = fs.readFileSync(absPath, 'utf-8');
370
+ } catch (e: unknown) {
371
+ debug(`ensureWasmTrees: cannot read ${relPath}: ${(e as Error).message}`);
372
+ continue;
373
+ }
374
+ const output = await pool.parse(absPath, code, FULL_ANALYSIS);
375
+ if (!output) continue; // worker crashed or returned null — skip silently
376
+ mergeAnalysisData(symbols, output);
377
+ }
378
+ }
379
+
380
+ /** Fill gap-only scalar metadata (`_langId`, `_lineCount`) from the worker output. */
381
+ function mergeScalarMetadata(symbols: any, worker: ExtractorOutput): void {
382
+ if (!symbols._langId && worker._langId) symbols._langId = worker._langId;
383
+ if (!symbols._lineCount && worker._lineCount) symbols._lineCount = worker._lineCount;
384
+ }
385
+
386
+ /** Fill gap-only analysis arrays (`astNodes`, `dataflow`) from the worker output. */
387
+ function mergeAnalysisArrays(symbols: any, worker: ExtractorOutput): void {
388
+ if (!Array.isArray(symbols.astNodes) && Array.isArray(worker.astNodes)) {
389
+ symbols.astNodes = worker.astNodes;
390
+ }
391
+ if (!symbols.dataflow && worker.dataflow) symbols.dataflow = worker.dataflow;
392
+ }
393
+
394
+ /** Merge worker typeMap into existing symbols.typeMap with first-wins semantics. */
395
+ function mergeTypeMap(symbols: any, worker: ExtractorOutput): void {
396
+ if (!worker.typeMap || worker.typeMap.size === 0) return;
397
+ if (!symbols.typeMap || !(symbols.typeMap instanceof Map)) {
398
+ symbols.typeMap = new Map(worker.typeMap);
399
+ return;
400
+ }
401
+ for (const [k, v] of worker.typeMap) {
402
+ if (!symbols.typeMap.has(k)) symbols.typeMap.set(k, v);
403
+ }
404
+ }
405
+
406
+ /** Patch existing definitions with worker complexity/cfg when absent. */
407
+ function mergeDefinitionAnalysis(symbols: any, worker: ExtractorOutput): void {
408
+ const existingDefs: any[] = Array.isArray(symbols.definitions) ? symbols.definitions : [];
409
+ const workerDefs: any[] = Array.isArray(worker.definitions) ? worker.definitions : [];
410
+ if (existingDefs.length === 0 || workerDefs.length === 0) return;
411
+ // Index existing defs by (kind, name, line) — mirrors engine.ts matching key.
412
+ const byKey = new Map<string, any>();
413
+ for (const d of existingDefs) byKey.set(`${d.kind}|${d.name}|${d.line}`, d);
414
+ for (const wd of workerDefs) {
415
+ const existing = byKey.get(`${wd.kind}|${wd.name}|${wd.line}`);
416
+ if (!existing) continue;
417
+ if (!existing.complexity && wd.complexity) existing.complexity = wd.complexity;
418
+ if ((!existing.cfg || !Array.isArray(existing.cfg.blocks)) && wd.cfg?.blocks) {
419
+ existing.cfg = wd.cfg;
420
+ }
421
+ }
422
+ }
423
+
424
+ /**
425
+ * Merge pre-computed analysis data from a worker result onto existing symbols.
426
+ * Only fills gaps — never overwrites fields the caller already populated.
427
+ * Used to patch native-parsed symbols with worker-produced astNodes / dataflow /
428
+ * per-definition complexity and cfg.
429
+ */
430
+ function mergeAnalysisData(symbols: any, worker: ExtractorOutput): void {
431
+ mergeScalarMetadata(symbols, worker);
432
+ mergeAnalysisArrays(symbols, worker);
433
+ mergeTypeMap(symbols, worker);
434
+ mergeDefinitionAnalysis(symbols, worker);
435
+ }
436
+
437
+ /**
438
+ * Check whether the required WASM grammar files exist on disk.
439
+ */
440
+ export function isWasmAvailable(): boolean {
441
+ return LANGUAGE_REGISTRY.filter((e) => e.required).every((e) =>
442
+ fs.existsSync(grammarPath(e.grammarFile)),
443
+ );
444
+ }
445
+
446
+ /**
447
+ * Return the set of lowercase file extensions whose WASM grammar is actually
448
+ * installed on disk. Used to scope engine-parity backfill to files that WASM
449
+ * can recover — languages without an installed grammar are skipped by both
450
+ * engines, so they don't represent a native-engine drop.
451
+ *
452
+ * Cached on first call; the grammars directory is shipped immutable.
453
+ */
454
+ let _installedWasmExts: Set<string> | null = null;
455
+ export function getInstalledWasmExtensions(): Set<string> {
456
+ if (_installedWasmExts) return _installedWasmExts;
457
+ const exts = new Set<string>();
458
+ for (const entry of LANGUAGE_REGISTRY) {
459
+ if (fs.existsSync(grammarPath(entry.grammarFile))) {
460
+ for (const ext of entry.extensions) exts.add(ext.toLowerCase());
461
+ }
462
+ }
463
+ _installedWasmExts = exts;
464
+ return exts;
465
+ }
466
+
467
+ /**
468
+ * Lowercase file extensions covered by the native Rust addon.
469
+ *
470
+ * Mirrors `LanguageKind::from_extension` in
471
+ * `crates/codegraph-core/src/domain/parser.rs`. Used to classify why the
472
+ * native orchestrator dropped a file: extensions outside this set are a
473
+ * legitimate parser limit (no Rust extractor exists), while extensions inside
474
+ * it indicate a real native bug (parse/read/extract failure).
475
+ *
476
+ * Keep this list in sync with the Rust enum — the native addon is a separate
477
+ * npm package, so JS has no runtime way to discover its language coverage.
478
+ */
479
+ export const NATIVE_SUPPORTED_EXTENSIONS: ReadonlySet<string> = new Set([
480
+ '.js',
481
+ '.jsx',
482
+ '.mjs',
483
+ '.cjs',
484
+ '.ts',
485
+ '.tsx',
486
+ '.py',
487
+ '.pyi',
488
+ '.tf',
489
+ '.hcl',
490
+ '.go',
491
+ '.rs',
492
+ '.java',
493
+ '.cs',
494
+ '.rb',
495
+ '.rake',
496
+ '.gemspec',
497
+ '.php',
498
+ '.phtml',
499
+ '.c',
500
+ '.h',
501
+ '.cpp',
502
+ '.cc',
503
+ '.cxx',
504
+ '.hpp',
505
+ '.cu',
506
+ '.cuh',
507
+ '.kt',
508
+ '.kts',
509
+ '.swift',
510
+ '.scala',
511
+ '.sh',
512
+ '.bash',
513
+ '.ex',
514
+ '.exs',
515
+ '.lua',
516
+ '.dart',
517
+ '.zig',
518
+ '.hs',
519
+ '.ml',
520
+ '.mli',
521
+ '.fs',
522
+ '.fsx',
523
+ '.fsi',
524
+ '.m',
525
+ '.gleam',
526
+ '.jl',
527
+ '.clj',
528
+ '.cljs',
529
+ '.cljc',
530
+ '.erl',
531
+ '.hrl',
532
+ '.groovy',
533
+ '.gvy',
534
+ '.r',
535
+ '.sol',
536
+ '.v',
537
+ '.sv',
538
+ ]);
539
+
540
+ /**
541
+ * Classification for a file the native orchestrator dropped.
542
+ * - `unsupported-by-native`: extension has no Rust extractor (legitimate parser limit).
543
+ * - `native-extractor-failure`: extension is supported by native but the file was
544
+ * still dropped — points at a real bug (read error, parse failure, extractor crash).
545
+ */
546
+ export type NativeDropReason = 'unsupported-by-native' | 'native-extractor-failure';
547
+
548
+ export interface NativeDropClassification {
549
+ /** Per-reason → per-extension → list of relative paths that hit that bucket. */
550
+ byReason: Record<NativeDropReason, Map<string, string[]>>;
551
+ /** Total file count per reason. */
552
+ totals: Record<NativeDropReason, number>;
553
+ }
554
+
555
+ /**
556
+ * Group the missing files (relative paths) by drop reason and extension so the
557
+ * caller can log per-extension counts and a sample path. Pure function — no
558
+ * I/O, safe to unit-test independently of the build pipeline.
559
+ */
560
+ export function classifyNativeDrops(relPaths: Iterable<string>): NativeDropClassification {
561
+ const byReason: Record<NativeDropReason, Map<string, string[]>> = {
562
+ 'unsupported-by-native': new Map(),
563
+ 'native-extractor-failure': new Map(),
564
+ };
565
+ const totals: Record<NativeDropReason, number> = {
566
+ 'unsupported-by-native': 0,
567
+ 'native-extractor-failure': 0,
568
+ };
569
+ for (const rel of relPaths) {
570
+ const ext = path.extname(rel).toLowerCase();
571
+ const reason: NativeDropReason = NATIVE_SUPPORTED_EXTENSIONS.has(ext)
572
+ ? 'native-extractor-failure'
573
+ : 'unsupported-by-native';
574
+ const bucket = byReason[reason];
575
+ let list = bucket.get(ext);
576
+ if (!list) {
577
+ list = [];
578
+ bucket.set(ext, list);
579
+ }
580
+ list.push(rel);
581
+ totals[reason]++;
582
+ }
583
+ return { byReason, totals };
584
+ }
585
+
586
+ /**
587
+ * Render `{ ext → paths[] }` as a multi-line tabular breakdown for log lines.
588
+ * Each extension occupies its own line so a long warning scans like a table
589
+ * instead of a wall of semicolon-separated slices. Caps at 3 sample paths per
590
+ * extension and 6 extensions total to keep output bounded when many languages
591
+ * are dropped at once. Extensions are sorted by descending file count so the
592
+ * loudest offender shows up first; ties keep insertion order.
593
+ *
594
+ * Returns the empty string for empty input, and otherwise a string that
595
+ * begins with `\n` so callers can append it directly after the header line
596
+ * (`"Backfilling via WASM:" + formatDropExtensionSummary(...)`).
597
+ *
598
+ * Pure function — safe to unit-test independently.
599
+ */
600
+ export function formatDropExtensionSummary(buckets: Map<string, string[]>): string {
601
+ const MAX_EXTS = 6;
602
+ const MAX_SAMPLES = 3;
603
+ const entries = Array.from(buckets.entries()).sort((a, b) => b[1].length - a[1].length);
604
+ if (entries.length === 0) return '';
605
+ const shown = entries.slice(0, MAX_EXTS);
606
+ const extWidth = Math.max(...shown.map(([ext]) => ext.length));
607
+ const countWidth = Math.max(...shown.map(([, paths]) => String(paths.length).length));
608
+ const lines = shown.map(([ext, paths]) => {
609
+ const sample = paths.slice(0, MAX_SAMPLES).join(', ');
610
+ const more = paths.length > MAX_SAMPLES ? ` (+${paths.length - MAX_SAMPLES} more)` : '';
611
+ return ` ${ext.padEnd(extWidth)} ${String(paths.length).padStart(countWidth)} ${sample}${more}`;
612
+ });
613
+ if (entries.length > MAX_EXTS) {
614
+ lines.push(` (+${entries.length - MAX_EXTS} more extension(s))`);
615
+ }
616
+ return `\n${lines.join('\n')}`;
617
+ }
618
+
619
+ // ── Unified API ──────────────────────────────────────────────────────────────
620
+
621
+ function resolveEngine(opts: ParseEngineOpts = {}): ResolvedEngine {
622
+ const pref = opts.engine || 'auto';
623
+ if (pref === 'wasm') return { name: 'wasm', native: null };
624
+ if (pref === 'native' || pref === 'auto') {
625
+ const native = loadNative();
626
+ if (native) return { name: 'native', native };
627
+ if (pref === 'native') {
628
+ getNative(); // throws with detailed error + install instructions
629
+ }
630
+ }
631
+ return { name: 'wasm', native: null };
632
+ }
633
+
634
+ /**
635
+ * Patch native engine output in-place for the few remaining semantic transforms.
636
+ * With #[napi(js_name)] on Rust types, most fields already arrive as camelCase.
637
+ * This only handles:
638
+ * - _lineCount compat for builder.js
639
+ * - Backward compat for older native binaries missing js_name annotations
640
+ * - dataflow argFlows/mutations bindingType -> binding wrapper
641
+ */
642
+ /** Patch definition fields for backward compat with older native binaries. */
643
+ function patchDefinitions(definitions: any[]): void {
644
+ for (const d of definitions) {
645
+ if (d.endLine === undefined && d.end_line !== undefined) {
646
+ d.endLine = d.end_line;
647
+ }
648
+ }
649
+ }
650
+
651
+ /**
652
+ * Field renames applied to each import record to bridge older native binaries
653
+ * that emit snake_case names. Each `[camel, snake]` pair becomes:
654
+ * `if (imp[camel] === undefined) imp[camel] = imp[snake];`
655
+ * Defined as data so the loop body stays trivially linear in cognitive complexity.
656
+ */
657
+ const IMPORT_FIELD_RENAMES: ReadonlyArray<readonly [string, string]> = [
658
+ ['typeOnly', 'type_only'],
659
+ ['wildcardReexport', 'wildcard_reexport'],
660
+ ['pythonImport', 'python_import'],
661
+ ['goImport', 'go_import'],
662
+ ['rustUse', 'rust_use'],
663
+ ['javaImport', 'java_import'],
664
+ ['csharpUsing', 'csharp_using'],
665
+ ['rubyRequire', 'ruby_require'],
666
+ ['phpUse', 'php_use'],
667
+ ['cInclude', 'c_include'],
668
+ ['kotlinImport', 'kotlin_import'],
669
+ ['swiftImport', 'swift_import'],
670
+ ['scalaImport', 'scala_import'],
671
+ ['bashSource', 'bash_source'],
672
+ ['dynamicImport', 'dynamic_import'],
673
+ ];
674
+
675
+ /** Patch import fields for backward compat with older native binaries. */
676
+ function patchImports(imports: any[]): void {
677
+ for (const i of imports) {
678
+ for (const [camel, snake] of IMPORT_FIELD_RENAMES) {
679
+ if (i[camel] === undefined) i[camel] = i[snake];
680
+ }
681
+ }
682
+ }
683
+
684
+ /** Normalize native typeMap array to a Map instance.
685
+ * Uses first-wins semantics at equal confidence to match the WASM/JS extractor. */
686
+ function patchTypeMap(r: any): void {
687
+ if (!r.typeMap) {
688
+ r.typeMap = new Map();
689
+ } else if (!(r.typeMap instanceof Map)) {
690
+ const map = new Map<string, TypeMapEntry>();
691
+ for (const e of r.typeMap as Array<{ name: string; typeName: string }>) {
692
+ if (!map.has(e.name)) {
693
+ map.set(e.name, { type: e.typeName, confidence: (e as any).confidence ?? 0.9 });
694
+ }
695
+ }
696
+ r.typeMap = map;
697
+ }
698
+ }
699
+
700
+ /** Normalize native returnTypeMap array to a Map instance, keeping highest-confidence entry per key. */
701
+ function patchReturnTypeMap(r: any): void {
702
+ if (!r.returnTypeMap || r.returnTypeMap instanceof Map) return;
703
+ const map = new Map<string, TypeMapEntry>();
704
+ for (const e of r.returnTypeMap as Array<{
705
+ name: string;
706
+ typeName: string;
707
+ confidence?: number;
708
+ }>) {
709
+ const conf = e.confidence ?? 1.0;
710
+ const existing = map.get(e.name);
711
+ if (!existing || conf > existing.confidence) {
712
+ map.set(e.name, { type: e.typeName, confidence: conf });
713
+ }
714
+ }
715
+ r.returnTypeMap = map.size > 0 ? map : new Map();
716
+ }
717
+
718
+ /** Wrap bindingType into binding object for dataflow argFlows and mutations. */
719
+ /**
720
+ * Normalise a DataflowResult from the native Rust extractor to the VisitorArgFlow
721
+ * shape expected by the TypeScript dataflow analysis layer.
722
+ *
723
+ * The Rust `DataflowArgFlow` emits `bindingType: string | null` as a flat field.
724
+ * The TS analysis layer (`buildDataflowVerticesAndEdges`, `collectCallerStitchCandidates`)
725
+ * expects `binding: { type: string; index?: number }` on each argFlow/mutation entry.
726
+ * This normalisation must be applied whenever `extractDataflowAnalysis` is called
727
+ * outside the standard `patchNativeResult` pipeline.
728
+ */
729
+ export function patchDataflowResult(dataflow: any): void {
730
+ if (dataflow.argFlows) {
731
+ for (const f of dataflow.argFlows) {
732
+ f.binding = f.bindingType ? { type: f.bindingType } : null;
733
+ }
734
+ }
735
+ if (dataflow.mutations) {
736
+ for (const m of dataflow.mutations) {
737
+ m.binding = m.bindingType ? { type: m.bindingType } : null;
738
+ }
739
+ }
740
+ }
741
+
742
+ function patchNativeResult(r: any): ExtractorOutput {
743
+ // lineCount: napi(js_name) emits "lineCount"; older binaries may emit "line_count"
744
+ r.lineCount = r.lineCount ?? r.line_count ?? null;
745
+ r._lineCount = r.lineCount;
746
+
747
+ if (r.definitions) patchDefinitions(r.definitions);
748
+ if (r.imports) patchImports(r.imports);
749
+ patchTypeMap(r);
750
+ patchReturnTypeMap(r);
751
+ if (r.dataflow) patchDataflowResult(r.dataflow);
752
+
753
+ return r;
754
+ }
755
+
756
+ /**
757
+ * Declarative registry of all supported languages.
758
+ * Adding a new language requires only a new entry here + its extractor function.
759
+ */
760
+ export const LANGUAGE_REGISTRY: LanguageRegistryEntry[] = [
761
+ {
762
+ id: 'javascript',
763
+ extensions: ['.js', '.jsx', '.mjs', '.cjs'],
764
+ grammarFile: 'tree-sitter-javascript.wasm',
765
+ extractor: extractSymbols,
766
+ required: true,
767
+ },
768
+ {
769
+ id: 'typescript',
770
+ extensions: ['.ts'],
771
+ grammarFile: 'tree-sitter-typescript.wasm',
772
+ extractor: extractSymbols,
773
+ required: true,
774
+ },
775
+ {
776
+ id: 'tsx',
777
+ extensions: ['.tsx'],
778
+ grammarFile: 'tree-sitter-tsx.wasm',
779
+ extractor: extractSymbols,
780
+ required: true,
781
+ },
782
+ {
783
+ id: 'hcl',
784
+ extensions: ['.tf', '.hcl'],
785
+ grammarFile: 'tree-sitter-hcl.wasm',
786
+ extractor: extractHCLSymbols,
787
+ required: false,
788
+ },
789
+ {
790
+ id: 'python',
791
+ extensions: ['.py', '.pyi'],
792
+ grammarFile: 'tree-sitter-python.wasm',
793
+ extractor: extractPythonSymbols,
794
+ required: false,
795
+ },
796
+ {
797
+ id: 'go',
798
+ extensions: ['.go'],
799
+ grammarFile: 'tree-sitter-go.wasm',
800
+ extractor: extractGoSymbols,
801
+ required: false,
802
+ },
803
+ {
804
+ id: 'rust',
805
+ extensions: ['.rs'],
806
+ grammarFile: 'tree-sitter-rust.wasm',
807
+ extractor: extractRustSymbols,
808
+ required: false,
809
+ },
810
+ {
811
+ id: 'java',
812
+ extensions: ['.java'],
813
+ grammarFile: 'tree-sitter-java.wasm',
814
+ extractor: extractJavaSymbols,
815
+ required: false,
816
+ },
817
+ {
818
+ id: 'csharp',
819
+ extensions: ['.cs'],
820
+ grammarFile: 'tree-sitter-c_sharp.wasm',
821
+ extractor: extractCSharpSymbols,
822
+ required: false,
823
+ },
824
+ {
825
+ id: 'ruby',
826
+ extensions: ['.rb', '.rake', '.gemspec'],
827
+ grammarFile: 'tree-sitter-ruby.wasm',
828
+ extractor: extractRubySymbols,
829
+ required: false,
830
+ },
831
+ {
832
+ id: 'php',
833
+ extensions: ['.php', '.phtml'],
834
+ grammarFile: 'tree-sitter-php.wasm',
835
+ extractor: extractPHPSymbols,
836
+ required: false,
837
+ },
838
+ {
839
+ id: 'c',
840
+ extensions: ['.c', '.h'],
841
+ grammarFile: 'tree-sitter-c.wasm',
842
+ extractor: extractCSymbols,
843
+ required: false,
844
+ },
845
+ {
846
+ id: 'cpp',
847
+ extensions: ['.cpp', '.cc', '.cxx', '.hpp'],
848
+ grammarFile: 'tree-sitter-cpp.wasm',
849
+ extractor: extractCppSymbols,
850
+ required: false,
851
+ },
852
+ {
853
+ id: 'kotlin',
854
+ extensions: ['.kt', '.kts'],
855
+ grammarFile: 'tree-sitter-kotlin.wasm',
856
+ extractor: extractKotlinSymbols,
857
+ required: false,
858
+ },
859
+ {
860
+ id: 'swift',
861
+ extensions: ['.swift'],
862
+ grammarFile: 'tree-sitter-swift.wasm',
863
+ extractor: extractSwiftSymbols,
864
+ required: false,
865
+ },
866
+ {
867
+ id: 'scala',
868
+ extensions: ['.scala'],
869
+ grammarFile: 'tree-sitter-scala.wasm',
870
+ extractor: extractScalaSymbols,
871
+ required: false,
872
+ },
873
+ {
874
+ id: 'bash',
875
+ extensions: ['.sh', '.bash'],
876
+ grammarFile: 'tree-sitter-bash.wasm',
877
+ extractor: extractBashSymbols,
878
+ required: false,
879
+ },
880
+ {
881
+ id: 'elixir',
882
+ extensions: ['.ex', '.exs'],
883
+ grammarFile: 'tree-sitter-elixir.wasm',
884
+ extractor: extractElixirSymbols,
885
+ required: false,
886
+ },
887
+ {
888
+ id: 'lua',
889
+ extensions: ['.lua'],
890
+ grammarFile: 'tree-sitter-lua.wasm',
891
+ extractor: extractLuaSymbols,
892
+ required: false,
893
+ },
894
+ {
895
+ id: 'dart',
896
+ extensions: ['.dart'],
897
+ grammarFile: 'tree-sitter-dart.wasm',
898
+ extractor: extractDartSymbols,
899
+ required: false,
900
+ },
901
+ {
902
+ id: 'zig',
903
+ extensions: ['.zig'],
904
+ grammarFile: 'tree-sitter-zig.wasm',
905
+ extractor: extractZigSymbols,
906
+ required: false,
907
+ },
908
+ {
909
+ id: 'haskell',
910
+ extensions: ['.hs'],
911
+ grammarFile: 'tree-sitter-haskell.wasm',
912
+ extractor: extractHaskellSymbols,
913
+ required: false,
914
+ },
915
+ {
916
+ id: 'ocaml',
917
+ extensions: ['.ml'],
918
+ grammarFile: 'tree-sitter-ocaml.wasm',
919
+ extractor: extractOCamlSymbols,
920
+ required: false,
921
+ },
922
+ {
923
+ id: 'ocaml-interface',
924
+ extensions: ['.mli'],
925
+ grammarFile: 'tree-sitter-ocaml_interface.wasm',
926
+ extractor: extractOCamlSymbols,
927
+ required: false,
928
+ },
929
+ {
930
+ id: 'fsharp',
931
+ extensions: ['.fs', '.fsx'],
932
+ grammarFile: 'tree-sitter-fsharp.wasm',
933
+ extractor: extractFSharpSymbols,
934
+ required: false,
935
+ },
936
+ {
937
+ id: 'fsharp-signature',
938
+ extensions: ['.fsi'],
939
+ grammarFile: 'tree-sitter-fsharp_signature.wasm',
940
+ extractor: extractFSharpSymbols,
941
+ required: false,
942
+ },
943
+ {
944
+ id: 'gleam',
945
+ extensions: ['.gleam'],
946
+ grammarFile: 'tree-sitter-gleam.wasm',
947
+ extractor: extractGleamSymbols,
948
+ required: false,
949
+ },
950
+ {
951
+ id: 'clojure',
952
+ extensions: ['.clj', '.cljs', '.cljc'],
953
+ grammarFile: 'tree-sitter-clojure.wasm',
954
+ extractor: extractClojureSymbols,
955
+ required: false,
956
+ },
957
+ {
958
+ id: 'julia',
959
+ extensions: ['.jl'],
960
+ grammarFile: 'tree-sitter-julia.wasm',
961
+ extractor: extractJuliaSymbols,
962
+ required: false,
963
+ },
964
+ {
965
+ id: 'r',
966
+ extensions: ['.r', '.R'],
967
+ grammarFile: 'tree-sitter-r.wasm',
968
+ extractor: extractRSymbols,
969
+ required: false,
970
+ },
971
+ {
972
+ id: 'erlang',
973
+ extensions: ['.erl', '.hrl'],
974
+ grammarFile: 'tree-sitter-erlang.wasm',
975
+ extractor: extractErlangSymbols,
976
+ required: false,
977
+ },
978
+ {
979
+ id: 'solidity',
980
+ extensions: ['.sol'],
981
+ grammarFile: 'tree-sitter-solidity.wasm',
982
+ extractor: extractSoliditySymbols,
983
+ required: false,
984
+ },
985
+ {
986
+ id: 'objc',
987
+ extensions: ['.m'],
988
+ grammarFile: 'tree-sitter-objc.wasm',
989
+ extractor: extractObjCSymbols,
990
+ required: false,
991
+ },
992
+ {
993
+ id: 'cuda',
994
+ extensions: ['.cu', '.cuh'],
995
+ grammarFile: 'tree-sitter-cuda.wasm',
996
+ extractor: extractCudaSymbols,
997
+ required: false,
998
+ },
999
+ {
1000
+ id: 'groovy',
1001
+ extensions: ['.groovy', '.gvy'],
1002
+ grammarFile: 'tree-sitter-groovy.wasm',
1003
+ extractor: extractGroovySymbols,
1004
+ required: false,
1005
+ },
1006
+ {
1007
+ id: 'verilog',
1008
+ extensions: ['.v', '.sv'],
1009
+ grammarFile: 'tree-sitter-verilog.wasm',
1010
+ extractor: extractVerilogSymbols,
1011
+ required: false,
1012
+ },
1013
+ ];
1014
+
1015
+ const _extToLang: Map<string, LanguageRegistryEntry> = new Map();
1016
+ for (const entry of LANGUAGE_REGISTRY) {
1017
+ for (const ext of entry.extensions) {
1018
+ _extToLang.set(ext, entry);
1019
+ }
1020
+ }
1021
+
1022
+ export const SUPPORTED_EXTENSIONS: Set<string> = new Set(_extToLang.keys());
1023
+
1024
+ /**
1025
+ * WASM-based typeMap backfill for TS/TSX files parsed by the native engine.
1026
+ * Serves two purposes:
1027
+ * 1. Compatibility with older native binaries that don't emit typeMap (< 3.2.0).
1028
+ * 2. Workaround for native parser scope-collision bugs — when the same variable
1029
+ * name appears at multiple scopes, native type extraction can produce
1030
+ * incorrect results. WASM's JS-based extractor handles scope traversal
1031
+ * more accurately. TODO: Remove purpose (2) once the Rust extractor handles
1032
+ * nested scopes correctly.
1033
+ *
1034
+ * Uses tree-sitter AST extraction instead of regex to avoid false positives from
1035
+ * matches inside comments and string literals.
1036
+ */
1037
+ async function backfillTypeMap(
1038
+ filePath: string,
1039
+ source?: string,
1040
+ ): Promise<{ typeMap: Map<string, TypeMapEntry>; backfilled: boolean }> {
1041
+ let code = source;
1042
+ if (!code) {
1043
+ try {
1044
+ code = fs.readFileSync(filePath, 'utf-8');
1045
+ } catch (e) {
1046
+ debug(`backfillTypeMap: failed to read ${filePath}: ${toErrorMessage(e)}`);
1047
+ return { typeMap: new Map(), backfilled: false };
1048
+ }
1049
+ }
1050
+ const pool = getWasmWorkerPool();
1051
+ // Extract-only — no visitor walk, we only need the typeMap from this pass.
1052
+ const output = await pool.parse(filePath, code, EXTRACT_ONLY);
1053
+ if (!output || output.typeMap.size === 0) {
1054
+ return { typeMap: new Map(), backfilled: false };
1055
+ }
1056
+ return { typeMap: output.typeMap, backfilled: true };
1057
+ }
1058
+
1059
+ /**
1060
+ * WASM extraction helper: picks the right extractor based on file extension.
1061
+ */
1062
+ function wasmExtractSymbols(
1063
+ parsers: Map<string, Parser | null>,
1064
+ filePath: string,
1065
+ code: string,
1066
+ ): WasmExtractResult | null {
1067
+ const parser = getParser(parsers, filePath);
1068
+ if (!parser) return null;
1069
+
1070
+ let tree: Tree | null;
1071
+ try {
1072
+ tree = parser.parse(code);
1073
+ } catch (e: unknown) {
1074
+ warn(`Parse error in ${filePath}: ${(e as Error).message}`);
1075
+ return null;
1076
+ }
1077
+ if (!tree) return null;
1078
+
1079
+ const ext = path.extname(filePath);
1080
+ const entry = _extToLang.get(ext);
1081
+ if (!entry) return null;
1082
+ const query = _queryCache.get(entry.id) ?? undefined;
1083
+ // Query (web-tree-sitter) is structurally compatible with TreeSitterQuery at runtime
1084
+ let symbols: ExtractorOutput | null;
1085
+ try {
1086
+ symbols = entry.extractor(tree as any, filePath, query as any);
1087
+ } catch (e: unknown) {
1088
+ warn(`Extractor error in ${filePath}: ${(e as Error).message}`);
1089
+ // Free WASM tree to prevent memory leak — web-tree-sitter trees are backed
1090
+ // by WASM linear memory and are not garbage-collected automatically.
1091
+ if (typeof (tree as any).delete === 'function') (tree as any).delete();
1092
+ return null;
1093
+ }
1094
+ return symbols ? { symbols, tree, langId: entry.id } : null;
1095
+ }
1096
+
1097
+ /**
1098
+ * Parse a single file and return normalized symbols.
1099
+ */
1100
+ export async function parseFileAuto(
1101
+ filePath: string,
1102
+ source: string,
1103
+ opts: ParseEngineOpts = {},
1104
+ ): Promise<ExtractorOutput | null> {
1105
+ const { native } = resolveEngine(opts);
1106
+
1107
+ if (native) {
1108
+ const result = native.parseFile(filePath, source, true, true);
1109
+ if (!result) return null;
1110
+ const patched = patchNativeResult(result);
1111
+ // Always backfill typeMap for TS/TSX from WASM — native parser's type
1112
+ // extraction can produce incorrect scope-collision results. Non-TS files
1113
+ // are skipped to stay consistent with the batch path (backfillTypeMapBatch).
1114
+ if (TS_BACKFILL_EXTS.has(path.extname(filePath))) {
1115
+ const { typeMap, backfilled } = await backfillTypeMap(filePath, source);
1116
+ if (backfilled) {
1117
+ patched.typeMap = typeMap;
1118
+ patched._typeMapBackfilled = true;
1119
+ }
1120
+ }
1121
+ return patched;
1122
+ }
1123
+
1124
+ // WASM path — dispatch to isolated worker
1125
+ const pool = getWasmWorkerPool();
1126
+ return pool.parse(filePath, source, FULL_ANALYSIS);
1127
+ }
1128
+
1129
+ /** Backfill typeMap via WASM for TS/TSX files parsed by the native engine. */
1130
+ async function backfillTypeMapBatch(
1131
+ needsTypeMap: { filePath: string; relPath: string }[],
1132
+ result: Map<string, ExtractorOutput>,
1133
+ ): Promise<void> {
1134
+ const tsFiles = needsTypeMap.filter(({ filePath }) =>
1135
+ TS_BACKFILL_EXTS.has(path.extname(filePath)),
1136
+ );
1137
+ if (tsFiles.length === 0) return;
1138
+
1139
+ const pool = getWasmWorkerPool();
1140
+ for (const { filePath, relPath } of tsFiles) {
1141
+ let code: string;
1142
+ try {
1143
+ code = fs.readFileSync(filePath, 'utf-8');
1144
+ } catch (e) {
1145
+ debug(`batchExtract: cannot read ${filePath}: ${toErrorMessage(e)}`);
1146
+ continue;
1147
+ }
1148
+ const output = await pool.parse(filePath, code, EXTRACT_ONLY);
1149
+ if (!output || output.typeMap.size === 0) continue;
1150
+ const symbols = result.get(relPath);
1151
+ if (!symbols) continue;
1152
+ symbols.typeMap = output.typeMap;
1153
+ symbols._typeMapBackfilled = true;
1154
+ }
1155
+ }
1156
+
1157
+ /**
1158
+ * Parse files via WASM engine, returning a Map<relPath, symbols>.
1159
+ *
1160
+ * Each file is dispatched to the WASM worker pool. The worker parses, extracts,
1161
+ * and runs all AST analyses (complexity, CFG, dataflow, ast-store) in its own
1162
+ * thread, returning fully pre-computed ExtractorOutput. V8 fatal errors from
1163
+ * tree-sitter WASM (#965) kill only the worker — the pool skips the file and
1164
+ * restarts the worker for the next one.
1165
+ *
1166
+ * `_tree` is NEVER set by this path. All downstream analyses operate on the
1167
+ * pre-computed `astNodes` / `dataflow` / `def.complexity` / `def.cfg` fields.
1168
+ */
1169
+ async function parseFilesWasm(
1170
+ filePaths: string[],
1171
+ rootDir: string,
1172
+ analysis: WorkerAnalysisOpts = FULL_ANALYSIS,
1173
+ ): Promise<Map<string, ExtractorOutput>> {
1174
+ const result = new Map<string, ExtractorOutput>();
1175
+ const pool = getWasmWorkerPool();
1176
+ for (const filePath of filePaths) {
1177
+ if (!_extToLang.has(path.extname(filePath).toLowerCase())) continue;
1178
+ let code: string;
1179
+ try {
1180
+ code = fs.readFileSync(filePath, 'utf-8');
1181
+ } catch (err: unknown) {
1182
+ warn(`Skipping ${path.relative(rootDir, filePath)}: ${(err as Error).message}`);
1183
+ continue;
1184
+ }
1185
+ const output = await pool.parse(filePath, code, analysis);
1186
+ if (output) {
1187
+ const relPath = path.relative(rootDir, filePath).split(path.sep).join('/');
1188
+ result.set(relPath, output);
1189
+ }
1190
+ }
1191
+ return result;
1192
+ }
1193
+
1194
+ /**
1195
+ * Files at or below this count use the inline parse path (no worker spawn).
1196
+ *
1197
+ * The worker pool exists for crash safety (#965): exotic (non-required) WASM
1198
+ * grammars can trigger uncatchable V8 fatal errors that would kill the main
1199
+ * process. Running them in a worker means only the worker dies; the pool
1200
+ * detects the exit, skips the file, respawns, and continues.
1201
+ *
1202
+ * JS/TS/TSX are required-tier grammars — they have never triggered the V8
1203
+ * fatal crash class and are safe to run inline. The primary hot caller
1204
+ * (this/super dispatch post-pass) exclusively handles JS/TS/TSX files and
1205
+ * measured ~55–64ms/file through the pool vs ~8–10ms/file inline (#1435);
1206
+ * IPC overhead scales linearly with file count, not amortised.
1207
+ *
1208
+ * The threshold is set high enough to keep typical this-dispatch batches
1209
+ * (≤ 18 files on the codegraph corpus) on the inline path, while still
1210
+ * routing truly large exotic-language drops (rare; typical HCL case is 4
1211
+ * files) through the pool for crash isolation. Exotic-language drops are
1212
+ * almost always well under this limit anyway, so they benefit from the
1213
+ * inline fast path too without meaningful crash risk increase.
1214
+ */
1215
+ const INLINE_BACKFILL_THRESHOLD = 32;
1216
+
1217
+ /**
1218
+ * Inline WASM parse (no worker) for small file batches.
1219
+ *
1220
+ * Used by the engine-parity backfill path when the native engine drops a
1221
+ * handful of files (typically test fixtures). The worker pool's per-call
1222
+ * IPC + grammar-init overhead can cost 1–2s on slow CI runners — for a
1223
+ * 4-file backfill, that dwarfs the ~10ms of actual parse work.
1224
+ *
1225
+ * Returns symbols with `_tree` set so `runAnalyses` can run AST/CFG/dataflow
1226
+ * visitors via the unified walker (mirrors how WASM-engine results behaved
1227
+ * before the worker pool was introduced), unless `symbolsOnly` is true — in
1228
+ * that case `_tree` is not set, skipping all analysis visitor walks. Use
1229
+ * `symbolsOnly` when only definitions/calls/typeMap are needed (e.g. the
1230
+ * this/super dispatch post-pass) to avoid the analysis overhead on the inline
1231
+ * path, matching the optimization already applied to the worker-pool path.
1232
+ */
1233
+ async function parseFilesWasmInline(
1234
+ filePaths: string[],
1235
+ rootDir: string,
1236
+ symbolsOnly = false,
1237
+ ): Promise<Map<string, ExtractorOutput>> {
1238
+ const result = new Map<string, ExtractorOutput>();
1239
+ if (filePaths.length === 0) return result;
1240
+ const parsers = await ensureParsersForFiles(filePaths);
1241
+ for (const filePath of filePaths) {
1242
+ if (!_extToLang.has(path.extname(filePath).toLowerCase())) continue;
1243
+ let code: string;
1244
+ try {
1245
+ code = fs.readFileSync(filePath, 'utf-8');
1246
+ } catch (err: unknown) {
1247
+ warn(`Skipping ${path.relative(rootDir, filePath)}: ${(err as Error).message}`);
1248
+ continue;
1249
+ }
1250
+ const extracted = wasmExtractSymbols(parsers, filePath, code);
1251
+ if (!extracted) continue;
1252
+ const relPath = path.relative(rootDir, filePath).split(path.sep).join('/');
1253
+ const symbols = extracted.symbols as ExtractorOutput & { _tree?: unknown; _langId?: string };
1254
+ // When symbolsOnly=true, skip setting _tree so runAnalyses does not run
1255
+ // AST/complexity/CFG/dataflow visitor walks — only definitions/calls/typeMap
1256
+ // are needed by callers like the this/super dispatch post-pass.
1257
+ if (!symbolsOnly) {
1258
+ symbols._tree = extracted.tree;
1259
+ } else if (typeof (extracted.tree as any)?.delete === 'function') {
1260
+ // Free the WASM-backed tree immediately — web-tree-sitter trees are backed
1261
+ // by WASM linear memory and require explicit disposal. When symbolsOnly is
1262
+ // true the tree is never stored anywhere, so we must delete it here to
1263
+ // avoid leaking WASM heap on every incremental rebuild.
1264
+ (extracted.tree as any).delete();
1265
+ }
1266
+ symbols._langId = extracted.langId;
1267
+ result.set(relPath, symbols);
1268
+ }
1269
+ return result;
1270
+ }
1271
+
1272
+ /**
1273
+ * Backfill helper: small batches use the inline (main-thread) path; larger
1274
+ * batches keep the worker-pool isolation against tree-sitter WASM crashes
1275
+ * (#965). See INLINE_BACKFILL_THRESHOLD for threshold rationale.
1276
+ *
1277
+ * `opts.symbolsOnly` skips the AST/complexity/CFG/dataflow visitors in the
1278
+ * worker (and their result serialization across the thread boundary) for
1279
+ * callers that only consume definitions/calls/typeMap — the native
1280
+ * orchestrator's this-dispatch post-pass. Callers that ingest the files into
1281
+ * the DB (dropped-language backfill) must keep
1282
+ * the default full analysis.
1283
+ */
1284
+ export async function parseFilesWasmForBackfill(
1285
+ filePaths: string[],
1286
+ rootDir: string,
1287
+ opts: { symbolsOnly?: boolean } = {},
1288
+ ): Promise<Map<string, ExtractorOutput>> {
1289
+ if (filePaths.length <= INLINE_BACKFILL_THRESHOLD) {
1290
+ return parseFilesWasmInline(filePaths, rootDir, opts.symbolsOnly);
1291
+ }
1292
+ return parseFilesWasm(filePaths, rootDir, opts.symbolsOnly ? EXTRACT_ONLY : FULL_ANALYSIS);
1293
+ }
1294
+
1295
+ /**
1296
+ * Run the native engine over `filePaths` and ingest the results into `result`.
1297
+ * Returns the set of file paths the native engine successfully parsed and the
1298
+ * TS/TSX files that need a typeMap backfill pass.
1299
+ */
1300
+ function ingestNativeResults(
1301
+ native: any,
1302
+ filePaths: string[],
1303
+ rootDir: string,
1304
+ result: Map<string, ExtractorOutput>,
1305
+ ): { nativeParsed: Set<string>; needsTypeMap: { filePath: string; relPath: string }[] } {
1306
+ // Always extract all analysis data (dataflow + AST nodes) during native parse.
1307
+ // This eliminates the need for any downstream WASM re-parse or native standalone calls.
1308
+ const nativeResults = native.parseFilesFull
1309
+ ? native.parseFilesFull(filePaths, rootDir)
1310
+ : native.parseFiles(filePaths, rootDir, true, true);
1311
+ const needsTypeMap: { filePath: string; relPath: string }[] = [];
1312
+ const nativeParsed = new Set<string>();
1313
+ for (const r of nativeResults) {
1314
+ if (!r) continue;
1315
+ nativeParsed.add(r.file);
1316
+ const patched = patchNativeResult(r);
1317
+ const relPath = path.relative(rootDir, r.file).split(path.sep).join('/');
1318
+ result.set(relPath, patched);
1319
+ // Always backfill TS/TSX type maps from WASM — the native parser's type
1320
+ // extraction can produce incorrect results when the same variable name
1321
+ // appears at multiple scopes (e.g. `node: TreeSitterNode` in one function
1322
+ // vs `node: NodeRow` in another). The WASM JS extractor handles scope
1323
+ // traversal order more accurately.
1324
+ if (TS_BACKFILL_EXTS.has(path.extname(r.file))) {
1325
+ needsTypeMap.push({ filePath: r.file, relPath });
1326
+ }
1327
+ }
1328
+ return { nativeParsed, needsTypeMap };
1329
+ }
1330
+
1331
+ /**
1332
+ * Engine parity: native may silently drop files whose extensions are in
1333
+ * SUPPORTED_EXTENSIONS (because a WASM grammar exists) but whose Rust
1334
+ * extractor/grammar is missing or fails. WASM handles these — fall back so
1335
+ * both engines process the same file set (#967). Restrict to installed WASM
1336
+ * grammars so we don't warn about files that neither engine can parse.
1337
+ */
1338
+ async function backfillNativeDrops(
1339
+ filePaths: string[],
1340
+ nativeParsed: Set<string>,
1341
+ rootDir: string,
1342
+ result: Map<string, ExtractorOutput>,
1343
+ ): Promise<void> {
1344
+ const installedExts = getInstalledWasmExtensions();
1345
+ const dropped = filePaths.filter(
1346
+ (f) => !nativeParsed.has(f) && installedExts.has(path.extname(f).toLowerCase()),
1347
+ );
1348
+ if (dropped.length === 0) return;
1349
+ warn(`Native engine dropped ${dropped.length} file(s); falling back to WASM for parity`);
1350
+ const wasmResults = await parseFilesWasmForBackfill(dropped, rootDir);
1351
+ for (const [relPath, symbols] of wasmResults) {
1352
+ result.set(relPath, symbols);
1353
+ }
1354
+ }
1355
+
1356
+ /**
1357
+ * Parse multiple files in bulk and return a Map<relPath, symbols>.
1358
+ */
1359
+ export async function parseFilesAuto(
1360
+ filePaths: string[],
1361
+ rootDir: string,
1362
+ opts: ParseEngineOpts = {},
1363
+ ): Promise<Map<string, ExtractorOutput>> {
1364
+ const { native } = resolveEngine(opts);
1365
+ if (!native) return parseFilesWasm(filePaths, rootDir);
1366
+
1367
+ const result = new Map<string, ExtractorOutput>();
1368
+ const { nativeParsed, needsTypeMap } = ingestNativeResults(native, filePaths, rootDir, result);
1369
+ if (needsTypeMap.length > 0) {
1370
+ await backfillTypeMapBatch(needsTypeMap, result);
1371
+ }
1372
+ await backfillNativeDrops(filePaths, nativeParsed, rootDir, result);
1373
+ return result;
1374
+ }
1375
+
1376
+ /**
1377
+ * Report which engine is active.
1378
+ */
1379
+ export function getActiveEngine(opts: ParseEngineOpts = {}): {
1380
+ name: 'native' | 'wasm';
1381
+ version: string | null;
1382
+ binaryVersion: string | null;
1383
+ } {
1384
+ const { name, native } = resolveEngine(opts);
1385
+ const binaryVersion: string | null =
1386
+ native && typeof native.engineVersion === 'function' ? native.engineVersion() : null;
1387
+ // The display version prefers the platform package.json so the "Using native
1388
+ // engine (vX)" log matches the npm release the user installed. The Rust
1389
+ // orchestrator's check_version_mismatch compares against CARGO_PKG_VERSION
1390
+ // (the binary's own value), so build_meta writes must use `binaryVersion`,
1391
+ // not this display value — see pipeline.ts and finalize.ts (#1066).
1392
+ let version: string | null = binaryVersion;
1393
+ if (native) {
1394
+ try {
1395
+ version = getNativePackageVersion() ?? version;
1396
+ } catch (e: unknown) {
1397
+ debug(`getNativePackageVersion failed: ${(e as Error).message}`);
1398
+ }
1399
+ }
1400
+ return { name, version, binaryVersion };
1401
+ }
1402
+
1403
+ /**
1404
+ * Create a native ParseTreeCache for incremental parsing.
1405
+ * Returns null if the native engine is unavailable (WASM fallback).
1406
+ */
1407
+ export function createParseTreeCache(): any {
1408
+ const native = loadNative();
1409
+ if (!native?.ParseTreeCache) return null;
1410
+ return new native.ParseTreeCache();
1411
+ }
1412
+
1413
+ /**
1414
+ * Parse a file incrementally using the cache, or fall back to full parse.
1415
+ */
1416
+ export async function parseFileIncremental(
1417
+ cache: any,
1418
+ filePath: string,
1419
+ source: string,
1420
+ opts: ParseEngineOpts = {},
1421
+ ): Promise<ExtractorOutput | null> {
1422
+ if (cache) {
1423
+ const result = cache.parseFile(filePath, source);
1424
+ if (!result) return null;
1425
+ const patched = patchNativeResult(result);
1426
+ // Always backfill typeMap for TS/TSX from WASM (see parseFileAuto comment).
1427
+ if (TS_BACKFILL_EXTS.has(path.extname(filePath))) {
1428
+ const { typeMap, backfilled } = await backfillTypeMap(filePath, source);
1429
+ if (backfilled) {
1430
+ patched.typeMap = typeMap;
1431
+ patched._typeMapBackfilled = true;
1432
+ }
1433
+ }
1434
+ return patched;
1435
+ }
1436
+ return parseFileAuto(filePath, source, opts);
1437
+ }