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
package/src/types.ts ADDED
@@ -0,0 +1,2871 @@
1
+ /**
2
+ * Core type definitions for codegraph.
3
+ *
4
+ * These interfaces serve as the migration contract — each module is migrated
5
+ * to satisfy its interface. They capture every abstraction in the codebase:
6
+ * symbol/edge kinds, database shapes, repository contracts, extractors,
7
+ * parsers, builders, visitors, features, config, and the graph model.
8
+ */
9
+
10
+ // ════════════════════════════════════════════════════════════════════════
11
+ // §1 Symbol & Edge Kind Enumerations
12
+ // ════════════════════════════════════════════════════════════════════════
13
+
14
+ /** The original 10 symbol kinds — default query scope. */
15
+ export type CoreSymbolKind =
16
+ | 'function'
17
+ | 'method'
18
+ | 'class'
19
+ | 'interface'
20
+ | 'type'
21
+ | 'struct'
22
+ | 'enum'
23
+ | 'trait'
24
+ | 'record'
25
+ | 'module'
26
+ | 'namespace';
27
+
28
+ /** Sub-declaration kinds (Phase 1). Includes 'method' for class child nodes. */
29
+ export type ExtendedSymbolKind = 'parameter' | 'property' | 'constant' | 'variable' | 'method';
30
+
31
+ /** All queryable symbol kinds. */
32
+ export type SymbolKind = CoreSymbolKind | ExtendedSymbolKind;
33
+
34
+ /** Special kind used for file-level nodes in the graph. */
35
+ export type FileNodeKind = 'file';
36
+
37
+ /** Union of every kind that can appear in a node row. */
38
+ export type AnyNodeKind = SymbolKind | FileNodeKind;
39
+
40
+ /** Coupling and dependency edge kinds. */
41
+ export type CoreEdgeKind =
42
+ | 'imports'
43
+ | 'imports-type'
44
+ | 'dynamic-imports'
45
+ | 'reexports'
46
+ | 'calls'
47
+ | 'extends'
48
+ | 'implements'
49
+ | 'contains';
50
+
51
+ /** Parent/child and type relationship edges. */
52
+ export type StructuralEdgeKind = 'parameter_of' | 'receiver';
53
+
54
+ /** Dataflow-specific edge kinds. */
55
+ export type DataflowEdgeKind =
56
+ | 'flows_to'
57
+ | 'returns'
58
+ | 'mutates'
59
+ | 'def_use'
60
+ | 'arg_in'
61
+ | 'return_out';
62
+
63
+ /** All edge kinds that can appear in the graph. */
64
+ export type EdgeKind = CoreEdgeKind | StructuralEdgeKind;
65
+
66
+ /** Extended edge kinds including dataflow. */
67
+ export type AnyEdgeKind = EdgeKind | DataflowEdgeKind;
68
+
69
+ /** AST node kinds extracted during analysis. */
70
+ export type ASTNodeKind = 'new' | 'string' | 'regex' | 'throw' | 'await';
71
+
72
+ /** Coarse role classifications for symbols based on connectivity. */
73
+ export type CoreRole = 'entry' | 'core' | 'utility' | 'adapter' | 'dead' | 'test-only' | 'leaf';
74
+
75
+ /** Dead sub-roles — refine the coarse "dead" bucket. */
76
+ export type DeadSubRole = 'dead-leaf' | 'dead-entry' | 'dead-ffi' | 'dead-unresolved';
77
+
78
+ /** Every valid role. */
79
+ export type Role = CoreRole | DeadSubRole;
80
+
81
+ /** Supported language identifiers (from LANGUAGE_REGISTRY). */
82
+ export type LanguageId =
83
+ | 'javascript'
84
+ | 'typescript'
85
+ | 'tsx'
86
+ | 'python'
87
+ | 'go'
88
+ | 'rust'
89
+ | 'java'
90
+ | 'csharp'
91
+ | 'ruby'
92
+ | 'php'
93
+ | 'hcl'
94
+ | 'c'
95
+ | 'cpp'
96
+ | 'kotlin'
97
+ | 'swift'
98
+ | 'scala'
99
+ | 'bash'
100
+ | 'elixir'
101
+ | 'lua'
102
+ | 'dart'
103
+ | 'zig'
104
+ | 'haskell'
105
+ | 'ocaml'
106
+ | 'ocaml-interface'
107
+ | 'fsharp'
108
+ | 'fsharp-signature'
109
+ | 'gleam'
110
+ | 'clojure'
111
+ | 'julia'
112
+ | 'r'
113
+ | 'erlang'
114
+ | 'solidity'
115
+ | 'objc'
116
+ | 'cuda'
117
+ | 'groovy'
118
+ | 'verilog';
119
+
120
+ /** Engine mode selector. */
121
+ export type EngineMode = 'native' | 'wasm' | 'auto';
122
+
123
+ /** Graph export formats. */
124
+ export type ExportFormat = 'dot' | 'mermaid' | 'json' | 'graphml' | 'graphson' | 'neo4j-csv';
125
+
126
+ // ════════════════════════════════════════════════════════════════════════
127
+ // §2 Database Row Shapes
128
+ // ════════════════════════════════════════════════════════════════════════
129
+
130
+ /** A node row as stored in (and returned from) SQLite. */
131
+ export interface NodeRow {
132
+ id: number;
133
+ name: string;
134
+ kind: AnyNodeKind;
135
+ file: string;
136
+ line: number;
137
+ end_line: number | null;
138
+ parent_id: number | null;
139
+ exported: 0 | 1 | null;
140
+ qualified_name: string | null;
141
+ scope: string | null;
142
+ visibility: 'public' | 'private' | 'protected' | null;
143
+ role: Role | null;
144
+ }
145
+
146
+ /** A node row augmented with fan-in count (from findNodesWithFanIn). */
147
+ export interface NodeRowWithFanIn extends NodeRow {
148
+ fan_in: number;
149
+ }
150
+
151
+ /** A node row augmented with triage signals (from findNodesForTriage). */
152
+ export interface TriageNodeRow extends NodeRow {
153
+ fan_in: number;
154
+ cognitive: number;
155
+ mi: number;
156
+ cyclomatic: number;
157
+ max_nesting: number;
158
+ churn: number;
159
+ }
160
+
161
+ /** Compact node ID row (from bulkNodeIdsByFile). */
162
+ export interface NodeIdRow {
163
+ id: number;
164
+ name: string;
165
+ kind: string;
166
+ line: number;
167
+ }
168
+
169
+ /** A child node row (from findNodeChildren). */
170
+ export interface ChildNodeRow {
171
+ name: string;
172
+ kind: SymbolKind;
173
+ line: number;
174
+ end_line: number | null;
175
+ qualified_name: string | null;
176
+ scope: string | null;
177
+ visibility: 'public' | 'private' | 'protected' | null;
178
+ file?: string;
179
+ }
180
+
181
+ /** An edge row as stored in SQLite. */
182
+ export interface EdgeRow {
183
+ id: number;
184
+ source_id: number;
185
+ target_id: number;
186
+ kind: EdgeKind;
187
+ confidence: number | null;
188
+ dynamic: 0 | 1;
189
+ dynamic_kind?: string | null;
190
+ }
191
+
192
+ /** Callee/caller node shape (from findCallees / findCallers). */
193
+ export interface RelatedNodeRow {
194
+ id: number;
195
+ name: string;
196
+ kind: string;
197
+ file: string;
198
+ line: number;
199
+ end_line?: number | null;
200
+ }
201
+
202
+ /** An incoming/outgoing edge with the related node info. */
203
+ export interface AdjacentEdgeRow {
204
+ name: string;
205
+ kind: string;
206
+ file: string;
207
+ line: number;
208
+ edge_kind: EdgeKind;
209
+ }
210
+
211
+ /** Import target/source row. */
212
+ export interface ImportEdgeRow {
213
+ file: string;
214
+ edge_kind: EdgeKind;
215
+ }
216
+
217
+ /** Intra-file call edge (from findIntraFileCallEdges). */
218
+ export interface IntraFileCallEdge {
219
+ caller_name: string;
220
+ callee_name: string;
221
+ }
222
+
223
+ /** Callable node row (for graph-read queries). */
224
+ export interface CallableNodeRow {
225
+ id: number;
226
+ name: string;
227
+ kind: string;
228
+ file: string;
229
+ }
230
+
231
+ /** Call edge row (for graph-read queries). */
232
+ export interface CallEdgeRow {
233
+ source_id: number;
234
+ target_id: number;
235
+ confidence: number | null;
236
+ }
237
+
238
+ /** File node row (for graph-read queries). */
239
+ export interface FileNodeRow {
240
+ id: number;
241
+ name: string;
242
+ file: string;
243
+ }
244
+
245
+ /** Import edge row (for graph-read queries). */
246
+ export interface ImportGraphEdgeRow {
247
+ source_id: number;
248
+ target_id: number;
249
+ }
250
+
251
+ /** Complexity metrics (from getComplexityForNode). */
252
+ export interface ComplexityMetrics {
253
+ cognitive: number;
254
+ cyclomatic: number;
255
+ max_nesting: number;
256
+ maintainability_index: number | null;
257
+ halstead_volume: number | null;
258
+ }
259
+
260
+ // ════════════════════════════════════════════════════════════════════════
261
+ // §3 Repository Interface
262
+ // ════════════════════════════════════════════════════════════════════════
263
+
264
+ /** Query options common across many repository methods. */
265
+ export interface QueryOpts {
266
+ kind?: SymbolKind;
267
+ kinds?: SymbolKind[];
268
+ file?: string;
269
+ noTests?: boolean;
270
+ }
271
+
272
+ /** Options for listFunctionNodes / iterateFunctionNodes. */
273
+ export interface ListFunctionOpts {
274
+ file?: string;
275
+ pattern?: string;
276
+ noTests?: boolean;
277
+ }
278
+
279
+ /** Options for findNodesForTriage. */
280
+ export interface TriageQueryOpts {
281
+ kind?: string;
282
+ role?: Role;
283
+ noTests?: boolean;
284
+ file?: string;
285
+ }
286
+
287
+ /**
288
+ * Abstract Repository contract — defines all graph data access methods.
289
+ * Concrete implementations: SqliteRepository, InMemoryRepository.
290
+ */
291
+ export interface Repository {
292
+ // ── Node lookups ──────────────────────────────────────────────────
293
+ findNodeById(id: number): NodeRow | undefined;
294
+ findNodesByFile(file: string): NodeRow[];
295
+ findFileNodes(fileLike: string): NodeRow[];
296
+ findNodesWithFanIn(namePattern: string, opts?: QueryOpts): NodeRowWithFanIn[];
297
+ countNodes(): number;
298
+ countEdges(): number;
299
+ countFiles(): number;
300
+ getNodeId(name: string, kind: string, file: string, line: number): number | undefined;
301
+ getFunctionNodeId(name: string, file: string, line: number): number | undefined;
302
+ bulkNodeIdsByFile(file: string): NodeIdRow[];
303
+ findNodeChildren(parentId: number): ChildNodeRow[];
304
+ findNodesByScope(scopeName: string, opts?: QueryOpts): NodeRow[];
305
+ findNodeByQualifiedName(qualifiedName: string, opts?: { file?: string }): NodeRow[];
306
+ listFunctionNodes(opts?: ListFunctionOpts): NodeRow[];
307
+ iterateFunctionNodes(opts?: ListFunctionOpts): IterableIterator<NodeRow>;
308
+ findNodesForTriage(opts?: TriageQueryOpts): TriageNodeRow[];
309
+
310
+ // ── Edge queries ──────────────────────────────────────────────────
311
+ findCallees(nodeId: number): RelatedNodeRow[];
312
+ findCallers(nodeId: number): RelatedNodeRow[];
313
+ findCallersBatch(nodeIds: number[]): Map<number, RelatedNodeRow[]>;
314
+ findDistinctCallers(nodeId: number): RelatedNodeRow[];
315
+ findAllOutgoingEdges(nodeId: number): AdjacentEdgeRow[];
316
+ findAllIncomingEdges(nodeId: number): AdjacentEdgeRow[];
317
+ findCalleeNames(nodeId: number): string[];
318
+ findCallerNames(nodeId: number): string[];
319
+ findImportTargets(nodeId: number): ImportEdgeRow[];
320
+ findImportSources(nodeId: number): ImportEdgeRow[];
321
+ findImportDependents(nodeId: number): NodeRow[];
322
+ findCrossFileCallTargets(file: string): Set<number>;
323
+ countCrossFileCallers(nodeId: number, file: string): number;
324
+ getClassHierarchy(classNodeId: number): Set<number>;
325
+ findImplementors(nodeId: number): RelatedNodeRow[];
326
+ findInterfaces(nodeId: number): RelatedNodeRow[];
327
+ findIntraFileCallEdges(file: string): IntraFileCallEdge[];
328
+
329
+ // ── Graph-read queries ────────────────────────────────────────────
330
+ getCallableNodes(): CallableNodeRow[];
331
+ getCallEdges(): CallEdgeRow[];
332
+ getFileNodesAll(): FileNodeRow[];
333
+ getImportEdges(): ImportGraphEdgeRow[];
334
+
335
+ // ── Optional table checks ─────────────────────────────────────────
336
+ hasCfgTables(): boolean;
337
+ hasEmbeddings(): boolean;
338
+ hasDataflowTable(): boolean;
339
+ getComplexityForNode(nodeId: number): ComplexityMetrics | undefined;
340
+
341
+ // ── Convenience queries ──────────────────────────────────────────
342
+ getFileHash(file: string): string | null;
343
+ hasImplementsEdges(): boolean;
344
+ hasCoChangesTable(): boolean;
345
+
346
+ // ── Composite queries ──────────────────────────────────────────────
347
+ fnDeps(
348
+ name: string,
349
+ opts?: { depth?: number; noTests?: boolean; file?: string; kind?: string },
350
+ ): {
351
+ name: string;
352
+ results: Array<{
353
+ name: string;
354
+ kind: string;
355
+ file: string;
356
+ line: number | null;
357
+ endLine: number | null;
358
+ role: string | null;
359
+ fileHash: string | null;
360
+ callees: Array<{ name: string; kind: string; file: string; line: number | null }>;
361
+ callers: Array<{
362
+ name: string;
363
+ kind: string;
364
+ file: string;
365
+ line: number | null;
366
+ viaHierarchy?: string;
367
+ }>;
368
+ transitiveCallers: Record<
369
+ number,
370
+ Array<{ name: string; kind: string; file: string; line: number | null }>
371
+ >;
372
+ }>;
373
+ } | null;
374
+ }
375
+
376
+ /**
377
+ * In-memory repository — mutable, used for testing and incremental builds.
378
+ * Extends Repository with mutation methods.
379
+ */
380
+ export interface MutableRepository extends Repository {
381
+ addNode(attrs: {
382
+ name: string;
383
+ kind: AnyNodeKind;
384
+ file: string;
385
+ line: number;
386
+ end_line?: number;
387
+ parent_id?: number;
388
+ exported?: 0 | 1;
389
+ qualified_name?: string;
390
+ scope?: string;
391
+ visibility?: 'public' | 'private' | 'protected';
392
+ role?: Role;
393
+ }): number;
394
+
395
+ addEdge(attrs: {
396
+ source_id: number;
397
+ target_id: number;
398
+ kind: AnyEdgeKind;
399
+ confidence?: number;
400
+ dynamic?: 0 | 1;
401
+ }): number;
402
+
403
+ addComplexity(
404
+ nodeId: number,
405
+ metrics: {
406
+ cognitive: number;
407
+ cyclomatic: number;
408
+ max_nesting: number;
409
+ maintainability_index?: number;
410
+ halstead_volume?: number;
411
+ },
412
+ ): void;
413
+ }
414
+
415
+ // ════════════════════════════════════════════════════════════════════════
416
+ // §4 Extractor Types
417
+ // ════════════════════════════════════════════════════════════════════════
418
+
419
+ /** A symbol definition produced by any extractor. */
420
+ export interface Definition {
421
+ name: string;
422
+ kind: SymbolKind;
423
+ line: number;
424
+ endLine?: number;
425
+ children?: SubDeclaration[];
426
+ visibility?: 'public' | 'private' | 'protected';
427
+ decorators?: string[];
428
+ /** Populated post-analysis by the complexity visitor. */
429
+ complexity?: DefinitionComplexity;
430
+ /** Populated post-analysis by the CFG visitor. */
431
+ cfg?: { blocks: CfgBlock[]; edges: CfgEdge[] } | null;
432
+ }
433
+
434
+ /** Sub-declaration (child) within a definition. */
435
+ export interface SubDeclaration {
436
+ name: string;
437
+ kind: 'parameter' | 'property' | 'constant' | 'method';
438
+ line: number;
439
+ endLine?: number;
440
+ visibility?: 'public' | 'private' | 'protected';
441
+ decorators?: string[];
442
+ }
443
+
444
+ /** Complexity metrics attached to a definition post-analysis. */
445
+ export interface DefinitionComplexity {
446
+ cognitive: number;
447
+ cyclomatic: number;
448
+ maxNesting: number;
449
+ halstead?: HalsteadDerivedMetrics | HalsteadMetrics;
450
+ loc?: LOCMetrics;
451
+ maintainabilityIndex?: number;
452
+ }
453
+
454
+ /** Halstead software science metrics. */
455
+ export interface HalsteadMetrics {
456
+ volume: number;
457
+ difficulty: number;
458
+ effort: number;
459
+ bugs: number;
460
+ }
461
+
462
+ /** Halstead derived metrics including raw counts. */
463
+ export interface HalsteadDerivedMetrics extends HalsteadMetrics {
464
+ n1: number;
465
+ n2: number;
466
+ bigN1: number;
467
+ bigN2: number;
468
+ vocabulary: number;
469
+ length: number;
470
+ }
471
+
472
+ /** Lines-of-code metrics. */
473
+ export interface LOCMetrics {
474
+ loc: number;
475
+ sloc: number;
476
+ commentLines: number;
477
+ }
478
+
479
+ /**
480
+ * Taxonomy for dynamic/computed call sites — distinguishes resolvable kinds
481
+ * (computed-literal, reflection) from flag-only kinds (eval, computed-key,
482
+ * unresolved-dynamic) that cannot be resolved statically.
483
+ */
484
+ export type DynamicKind =
485
+ | 'computed-literal' // obj["foo"]() — resolvable; already emitted as normal edge
486
+ | 'computed-key' // obj[k]() — potentially resolvable via pts; else flagged
487
+ | 'reflection' // .call/.apply/.bind / Reflect.* — usually resolved; not flagged (drops silently if unresolved)
488
+ | 'eval' // eval() / new Function() — undecidable; always flagged
489
+ | 'unresolved-dynamic'; // any other detected dynamic pattern; flagged
490
+
491
+ /** A function/method call detected by an extractor. */
492
+ export interface Call {
493
+ name: string;
494
+ line: number;
495
+ receiver?: string;
496
+ dynamic?: boolean;
497
+ dynamicKind?: DynamicKind;
498
+ /** Raw key/arg text — used for diagnostics and future RES-1 const-string resolution. */
499
+ keyExpr?: string;
500
+ }
501
+
502
+ /** An import statement detected by an extractor. */
503
+ export interface Import {
504
+ source: string;
505
+ names: string[];
506
+ line: number;
507
+ // Standard flags
508
+ typeOnly?: boolean;
509
+ reexport?: boolean;
510
+ wildcardReexport?: boolean;
511
+ dynamicImport?: boolean;
512
+ // Language-specific flags (mutually exclusive at runtime)
513
+ pythonImport?: boolean;
514
+ goImport?: boolean;
515
+ rustUse?: boolean;
516
+ javaImport?: boolean;
517
+ csharpUsing?: boolean;
518
+ rubyRequire?: boolean;
519
+ phpUse?: boolean;
520
+ cInclude?: boolean;
521
+ kotlinImport?: boolean;
522
+ swiftImport?: boolean;
523
+ scalaImport?: boolean;
524
+ bashSource?: boolean;
525
+ }
526
+
527
+ /** A class/struct/trait relationship (extends or implements). */
528
+ export interface ClassRelation {
529
+ name: string;
530
+ extends?: string;
531
+ implements?: string;
532
+ line: number;
533
+ }
534
+
535
+ /** A named export from a module. */
536
+ export interface Export {
537
+ name: string;
538
+ kind: SymbolKind;
539
+ line: number;
540
+ }
541
+
542
+ /** A type-map entry for call resolution confidence scoring. */
543
+ export interface TypeMapEntry {
544
+ type: string;
545
+ confidence: number;
546
+ }
547
+
548
+ /**
549
+ * A variable assignment from a call expression, recorded during extraction for
550
+ * cross-file return-type propagation (Phase 8.2).
551
+ */
552
+ export interface CallAssignment {
553
+ /** Variable being assigned to. */
554
+ varName: string;
555
+ /** Name of the function or method being called. */
556
+ calleeName: string;
557
+ /** Resolved receiver type, if the call is a method call (e.g. service.getRepo()). */
558
+ receiverTypeName?: string;
559
+ }
560
+
561
+ /**
562
+ * A function-reference binding recorded during extraction for points-to analysis (Phase 8.3).
563
+ * Captures `const fn = handler` or `const fn = obj.method` patterns where the right-hand
564
+ * side is a named function reference (not a call expression or literal).
565
+ */
566
+ export interface FnRefBinding {
567
+ /** Variable being assigned (the left-hand side identifier). */
568
+ lhs: string;
569
+ /** Named function/property on the right-hand side. */
570
+ rhs: string;
571
+ /** If rhs is a member expression (obj.method), the receiver object name. */
572
+ rhsReceiver?: string;
573
+ }
574
+
575
+ /**
576
+ * An argument-to-parameter binding at a call site, recorded for parameter-flow
577
+ * points-to analysis (Phase 8.3c). Captures `f(x)` where `x` is an identifier
578
+ * that may carry a function reference into `f`'s parameter.
579
+ */
580
+ export interface ParamBinding {
581
+ /** The function being called at the call site. */
582
+ callee: string;
583
+ /** Zero-based index of the argument. */
584
+ argIndex: number;
585
+ /** Identifier name of the argument being passed. */
586
+ argName: string;
587
+ }
588
+
589
+ /**
590
+ * A this-context binding recorded when `fn.call(namedCtx, ...)` or
591
+ * `fn.apply(namedCtx, ...)` is seen. Seeds `fn::this → namedCtx` in the
592
+ * points-to map so that `this()` calls inside `fn` resolve to `namedCtx`.
593
+ */
594
+ export interface ThisCallBinding {
595
+ /** The function being invoked via .call() or .apply(). */
596
+ callee: string;
597
+ /** The identifier passed as the `this` context (first argument). */
598
+ thisArg: string;
599
+ }
600
+
601
+ /**
602
+ * An array-element binding: `const arr = [fn1, fn2]` records each named function
603
+ * stored at a specific index. Phase 8.3e: array-element pts tracking.
604
+ */
605
+ export interface ArrayElemBinding {
606
+ arrayName: string;
607
+ index: number;
608
+ elemName: string;
609
+ }
610
+
611
+ /**
612
+ * A spread-argument binding: `f(...arr)` records that `arr` is spread into `f`'s
613
+ * parameter list starting at `startIndex`. Phase 8.3e.
614
+ */
615
+ export interface SpreadArgBinding {
616
+ callee: string;
617
+ arrayName: string;
618
+ startIndex: number;
619
+ }
620
+
621
+ /**
622
+ * A for-of iteration binding: `for (const x of arr)` records that `x` receives
623
+ * each element of `arr` within `enclosingFunc`. Phase 8.3e.
624
+ */
625
+ export interface ForOfBinding {
626
+ varName: string;
627
+ sourceName: string;
628
+ enclosingFunc: string;
629
+ }
630
+
631
+ /**
632
+ * An array-callback binding: `Array.from(arr, cb)` records that `cb`'s first
633
+ * parameter receives each element of `arr`. Phase 8.3e.
634
+ */
635
+ export interface ArrayCallbackBinding {
636
+ sourceName: string;
637
+ calleeName: string;
638
+ }
639
+
640
+ /**
641
+ * An object-rest parameter binding: `function f({ a, ...rest })` records that
642
+ * `rest` is the rest of the object passed as argument `argIndex` to `f`.
643
+ * Phase 8.3f: object destructuring rest dispatch.
644
+ */
645
+ export interface ObjectRestParamBinding {
646
+ /** Function that owns this rest parameter, e.g. "f3" */
647
+ callee: string;
648
+ /** Name of the rest binding, e.g. "eerest" */
649
+ restName: string;
650
+ /** Zero-based index of the argument whose rest is bound, e.g. 0 */
651
+ argIndex: number;
652
+ }
653
+
654
+ /**
655
+ * An object-property binding: `const obj = { e4 }` or `const obj = { e4: fn }` records
656
+ * that `obj.e4` points to the named function `fn`. Phase 8.3f.
657
+ */
658
+ export interface ObjectPropBinding {
659
+ /** Variable holding the object, e.g. "obj" */
660
+ objectName: string;
661
+ /** Property name, e.g. "e4" */
662
+ propName: string;
663
+ /** Named function value, e.g. "e4" or "fn" */
664
+ valueName: string;
665
+ }
666
+
667
+ /** The normalized output shape returned by every language extractor. */
668
+ export interface ExtractorOutput {
669
+ definitions: Definition[];
670
+ calls: Call[];
671
+ imports: Import[];
672
+ classes: ClassRelation[];
673
+ exports: Export[];
674
+ typeMap: Map<string, TypeMapEntry>;
675
+ /**
676
+ * Maps function/method names to their declared or inferred return types.
677
+ * Keys: plain name (e.g. "createUser") or qualified name (e.g. "UserService.getUser").
678
+ * Populated by JS/TS extractor; used for inter-procedural type propagation (Phase 8.2).
679
+ */
680
+ returnTypeMap?: Map<string, TypeMapEntry>;
681
+ /**
682
+ * Variable assignments from call expressions that could not be resolved from the
683
+ * per-file returnTypeMap. Consumed by build-edges.ts to propagate cross-file return types.
684
+ */
685
+ callAssignments?: CallAssignment[];
686
+ /**
687
+ * Function-reference bindings for points-to analysis (Phase 8.3).
688
+ * Records `const fn = handler` and `const fn = obj.method` patterns so the
689
+ * edge builder can follow aliases when a call target has no direct definition.
690
+ */
691
+ fnRefBindings?: FnRefBinding[];
692
+ /**
693
+ * Argument-to-parameter bindings for parameter-flow points-to analysis (Phase 8.3c).
694
+ * Records `f(x)` call sites where `x` is an identifier, enabling the pts solver
695
+ * to propagate function references through function parameters.
696
+ */
697
+ paramBindings?: ParamBinding[];
698
+ /** Phase 8.3e: array-element bindings from `const arr = [fn1, fn2]` patterns. */
699
+ arrayElemBindings?: ArrayElemBinding[];
700
+ /** Phase 8.3e: spread-argument bindings from `f(...arr)` call sites. */
701
+ spreadArgBindings?: SpreadArgBinding[];
702
+ /** Phase 8.3e: for-of iteration variable bindings. */
703
+ forOfBindings?: ForOfBinding[];
704
+ /** Phase 8.3e: array callback bindings from Array.from/forEach/etc. */
705
+ arrayCallbackBindings?: ArrayCallbackBinding[];
706
+ /** Phase 8.3f: object-rest parameter bindings from `function f({ ...rest })` patterns. */
707
+ objectRestParamBindings?: ObjectRestParamBinding[];
708
+ /** Phase 8.3f: object-property bindings from `const obj = { fn }` patterns. */
709
+ objectPropBindings?: ObjectPropBinding[];
710
+ /**
711
+ * This-context bindings from `fn.call(namedCtx, ...)` / `fn.apply(namedCtx, ...)`.
712
+ * Seeds `fn::this → namedCtx` in the points-to map so that `this()` calls inside
713
+ * `fn` resolve to `namedCtx` when `fn` is invoked via `.call()`/`.apply()`.
714
+ */
715
+ thisCallBindings?: ThisCallBinding[];
716
+ /**
717
+ * Phase 8.5 (RTA): constructor names from all `new X()` expressions in the file,
718
+ * including unassigned ones (e.g. `doSomething(new Foo())`). Used to build the
719
+ * project-wide instantiated-types set for Rapid Type Analysis filtering.
720
+ */
721
+ newExpressions?: readonly string[];
722
+ /**
723
+ * Object.defineProperty receiver bindings: maps function name → target object name.
724
+ * Records `Object.defineProperty(obj, "bar", { get: getter })` so the edge builder
725
+ * can resolve `this.X()` calls inside `getter` as `obj.X()` (this === obj when the
726
+ * accessor is invoked through the property).
727
+ *
728
+ * Example: `Object.defineProperty(obj, "bar", { get: getter })` emits
729
+ * `definePropertyReceivers.set("getter", "obj")`.
730
+ */
731
+ definePropertyReceivers?: Map<string, string>;
732
+ /** WASM tree retained for downstream analysis (complexity, CFG, dataflow). */
733
+ _tree?: TreeSitterTree;
734
+ /** Language identifier. */
735
+ _langId?: LanguageId;
736
+ /** Line count for metrics. */
737
+ _lineCount?: number;
738
+ /** Dataflow results, populated post-analysis. */
739
+ dataflow?: DataflowResult;
740
+ /** AST node rows, populated post-analysis. */
741
+ astNodes?: ASTNodeRow[];
742
+ /** Set when typeMap was backfilled from WASM for a native parse result. */
743
+ _typeMapBackfilled?: boolean;
744
+ }
745
+
746
+ /** Extractor function signature. */
747
+ export type ExtractorFn = (
748
+ tree: TreeSitterTree,
749
+ filePath: string,
750
+ query?: TreeSitterQuery,
751
+ ) => ExtractorOutput;
752
+
753
+ // ════════════════════════════════════════════════════════════════════════
754
+ // §5 Parser & Language Registry
755
+ // ════════════════════════════════════════════════════════════════════════
756
+
757
+ /** A single entry in the LANGUAGE_REGISTRY. */
758
+ export interface LanguageRegistryEntry {
759
+ id: LanguageId;
760
+ extensions: string[];
761
+ grammarFile: string;
762
+ extractor: ExtractorFn;
763
+ required: boolean;
764
+ }
765
+
766
+ /** tree-sitter opaque types (thin wrappers — real impl is WASM). */
767
+ export interface TreeSitterNode {
768
+ id: number;
769
+ type: string;
770
+ text: string;
771
+ startPosition: { row: number; column: number };
772
+ endPosition: { row: number; column: number };
773
+ childCount: number;
774
+ namedChildCount: number;
775
+ child(index: number): TreeSitterNode | null;
776
+ namedChild(index: number): TreeSitterNode | null;
777
+ childForFieldName(name: string): TreeSitterNode | null;
778
+ fieldNameForChild(index: number): string | null;
779
+ parent: TreeSitterNode | null;
780
+ previousSibling: TreeSitterNode | null;
781
+ nextSibling: TreeSitterNode | null;
782
+ children: TreeSitterNode[];
783
+ namedChildren: TreeSitterNode[];
784
+ }
785
+
786
+ export interface TreeSitterTree {
787
+ rootNode: TreeSitterNode;
788
+ }
789
+
790
+ export interface TreeSitterQuery {
791
+ matches(node: TreeSitterNode): TreeSitterQueryMatch[];
792
+ captures(node: TreeSitterNode): TreeSitterQueryCapture[];
793
+ }
794
+
795
+ export interface TreeSitterQueryMatch {
796
+ pattern: number;
797
+ captures: TreeSitterQueryCapture[];
798
+ }
799
+
800
+ export interface TreeSitterQueryCapture {
801
+ name: string;
802
+ node: TreeSitterNode;
803
+ }
804
+
805
+ // ════════════════════════════════════════════════════════════════════════
806
+ // §6 Import Resolution
807
+ // ════════════════════════════════════════════════════════════════════════
808
+
809
+ /** A single import to resolve. */
810
+ export interface ImportBatchItem {
811
+ fromFile: string;
812
+ importSource: string;
813
+ }
814
+
815
+ /** Batch of imports to resolve. */
816
+ export type ImportBatch = ImportBatchItem[];
817
+
818
+ /** Result of resolveImportsBatch: Map<"fromFile|importSource", resolvedPath>. */
819
+ export type BatchResolvedMap = Map<string, string>;
820
+
821
+ /** Path aliases from tsconfig/jsconfig. */
822
+ export interface PathAliases {
823
+ baseUrl: string | null;
824
+ paths: Record<string, string[]>;
825
+ }
826
+
827
+ /** Parsed bare specifier. */
828
+ export interface BareSpecifier {
829
+ packageName: string;
830
+ subpath: string;
831
+ }
832
+
833
+ // ════════════════════════════════════════════════════════════════════════
834
+ // §7 AST Visitor System
835
+ // ════════════════════════════════════════════════════════════════════════
836
+
837
+ /** Shared context mutated during the DFS walk. */
838
+ export interface VisitorContext {
839
+ nestingLevel: number;
840
+ currentFunction: TreeSitterNode | null;
841
+ langId: string;
842
+ scopeStack: ScopeEntry[];
843
+ }
844
+
845
+ /** An entry on the scope stack. */
846
+ export interface ScopeEntry {
847
+ funcName: string | null;
848
+ funcNode: TreeSitterNode;
849
+ params: Map<string, unknown>;
850
+ locals: Map<string, unknown>;
851
+ }
852
+
853
+ /** Return value from enterNode — request skip of descendants. */
854
+ export interface EnterNodeResult {
855
+ skipChildren?: boolean;
856
+ }
857
+
858
+ /** A pluggable analysis visitor for the unified DFS walker. */
859
+ export interface Visitor {
860
+ name: string;
861
+ init?(langId: string): void;
862
+ enterNode?(node: TreeSitterNode, context: VisitorContext): EnterNodeResult | undefined;
863
+ exitNode?(node: TreeSitterNode, context: VisitorContext): void;
864
+ enterFunction?(funcNode: TreeSitterNode, funcName: string | null, context: VisitorContext): void;
865
+ exitFunction?(funcNode: TreeSitterNode, funcName: string | null, context: VisitorContext): void;
866
+ finish?(): unknown;
867
+ functionNodeTypes?: Set<string>;
868
+ }
869
+
870
+ /** Options for walkWithVisitors. */
871
+ export interface WalkOptions {
872
+ functionNodeTypes?: Set<string>;
873
+ nestingNodeTypes?: Set<string>;
874
+ getFunctionName?: (node: TreeSitterNode) => string | null;
875
+ }
876
+
877
+ /** Result of walkWithVisitors: Map of visitor.name → finish() result. */
878
+ export type WalkResults = Record<string, unknown>;
879
+
880
+ // ════════════════════════════════════════════════════════════════════════
881
+ // §8 AST Analysis Engine
882
+ // ════════════════════════════════════════════════════════════════════════
883
+
884
+ /** Toggles for runAnalyses. */
885
+ export interface AnalysisOpts {
886
+ ast?: boolean;
887
+ complexity?: boolean;
888
+ cfg?: boolean;
889
+ dataflow?: boolean;
890
+ }
891
+
892
+ /** Timing output from runAnalyses. */
893
+ export interface AnalysisTiming {
894
+ astMs: number;
895
+ complexityMs: number;
896
+ cfgMs: number;
897
+ dataflowMs: number;
898
+ /**
899
+ * Diagnostic: total wall-clock time for the unified walk loop (includes
900
+ * setupVisitors overhead). Walk time is already distributed equally into
901
+ * the per-phase timers above, so this overlaps — it is not an additive
902
+ * bucket. Useful for cross-checking that Σ phase timers ≈ this value.
903
+ */
904
+ _unifiedWalkMs?: number;
905
+ }
906
+
907
+ /** An AST node row stored in the database. */
908
+ export interface ASTNodeRow {
909
+ node_id: number;
910
+ kind: ASTNodeKind;
911
+ line: number;
912
+ text: string;
913
+ }
914
+
915
+ /** AST type mapping: tree-sitter node type → analysis kind. */
916
+ export type ASTTypeMap = Map<string, ASTNodeKind>;
917
+
918
+ /** Complexity rules for a language. */
919
+ export interface ComplexityRules {
920
+ branchNodes: Set<string>;
921
+ caseNodes: Set<string>;
922
+ logicalOperators: Set<string>;
923
+ logicalNodeType: string | null;
924
+ optionalChainType: string | null;
925
+ nestingNodes: Set<string>;
926
+ functionNodes: Set<string>;
927
+ ifNodeType: string | null;
928
+ elseNodeType: string | null;
929
+ elifNodeType: string | null;
930
+ elseViaAlternative: boolean;
931
+ switchLikeNodes: Set<string>;
932
+ }
933
+
934
+ /** Halstead rules for a language. */
935
+ export interface HalsteadRules {
936
+ operatorLeafTypes: Set<string>;
937
+ operandLeafTypes: Set<string>;
938
+ compoundOperators: Set<string>;
939
+ skipTypes: Set<string>;
940
+ }
941
+
942
+ /** CFG rules for a language (merged result of CFG_DEFAULTS + overrides). */
943
+ export interface CfgRulesConfig {
944
+ ifNode: string | null;
945
+ ifNodes: Set<string> | null;
946
+ elifNode: string | null;
947
+ elseClause: string | null;
948
+ elseViaAlternative: boolean;
949
+ ifConsequentField: string | null;
950
+ forNodes: Set<string>;
951
+ whileNode: string | null;
952
+ whileNodes: Set<string> | null;
953
+ doNode: string | null;
954
+ infiniteLoopNode: string | null;
955
+ unlessNode: string | null;
956
+ untilNode: string | null;
957
+ switchNode: string | null;
958
+ switchNodes: Set<string> | null;
959
+ caseNode: string | null;
960
+ caseNodes: Set<string> | null;
961
+ defaultNode: string | null;
962
+ tryNode: string | null;
963
+ catchNode: string | null;
964
+ finallyNode: string | null;
965
+ returnNode: string | null;
966
+ throwNode: string | null;
967
+ breakNode: string | null;
968
+ continueNode: string | null;
969
+ blockNode: string | null;
970
+ blockNodes: Set<string> | null;
971
+ labeledNode: string | null;
972
+ functionNodes: Set<string>;
973
+ }
974
+
975
+ /** Dataflow rules for a language (merged result of DATAFLOW_DEFAULTS + overrides). */
976
+ export interface DataflowRulesConfig {
977
+ functionNodes: Set<string>;
978
+ nameField: string;
979
+ /** Override for languages with nested function name structures (e.g. C/C++). */
980
+ nameExtractor: ((node: TreeSitterNode) => string | null) | null;
981
+ varAssignedFnParent: string | null;
982
+ assignmentFnParent: string | null;
983
+ pairFnParent: string | null;
984
+ paramListField: string;
985
+ /** Override for languages where the param list is nested (e.g. C: function_definition → declarator → parameters). */
986
+ getParamListNode: ((funcNode: TreeSitterNode) => TreeSitterNode | null) | null;
987
+ paramIdentifier: string;
988
+ paramWrapperTypes: Set<string>;
989
+ defaultParamType: string | null;
990
+ restParamType: string | null;
991
+ objectDestructType: string | null;
992
+ arrayDestructType: string | null;
993
+ shorthandPropPattern: string | null;
994
+ pairPatternType: string | null;
995
+ extractParamName: ((node: TreeSitterNode) => string[] | null) | null;
996
+ returnNode: string | null;
997
+ varDeclaratorNode: string | null;
998
+ varDeclaratorNodes: Set<string> | null;
999
+ varNameField: string;
1000
+ varValueField: string;
1001
+ assignmentNode: string | null;
1002
+ assignLeftField: string;
1003
+ assignRightField: string;
1004
+ callNode: string | null;
1005
+ callNodes: Set<string> | null;
1006
+ callFunctionField: string;
1007
+ callArgsField: string;
1008
+ spreadType: string | null;
1009
+ memberNode: string | null;
1010
+ memberObjectField: string;
1011
+ memberPropertyField: string;
1012
+ optionalChainNode: string | null;
1013
+ awaitNode: string | null;
1014
+ mutatingMethods: Set<string>;
1015
+ expressionStmtNode: string;
1016
+ callObjectField: string | null;
1017
+ expressionListType: string | null;
1018
+ equalsClauseType: string | null;
1019
+ argumentWrapperType: string | null;
1020
+ extraIdentifierTypes: Set<string> | null;
1021
+ }
1022
+
1023
+ /** Language rule module: exports from each language rule file. */
1024
+ export interface LanguageRuleModule {
1025
+ complexity: ComplexityRules;
1026
+ halstead: HalsteadRules;
1027
+ cfg: CfgRulesConfig;
1028
+ dataflow: DataflowRulesConfig;
1029
+ astTypes: Record<string, string> | null;
1030
+ }
1031
+
1032
+ /** A basic block in a control flow graph. */
1033
+ export interface CfgBlock {
1034
+ id: number;
1035
+ label: string;
1036
+ startLine: number;
1037
+ endLine: number;
1038
+ }
1039
+
1040
+ /** An edge in a control flow graph. */
1041
+ export interface CfgEdge {
1042
+ from: number;
1043
+ to: number;
1044
+ label?: string;
1045
+ }
1046
+
1047
+ /**
1048
+ * A dataflow vertex: an addressable data location within a function.
1049
+ * Populated during extraction (P1+); persisted to `dataflow_vertices`.
1050
+ */
1051
+ export interface DataflowVertex {
1052
+ /** Name of the enclosing function (used to resolve func_id at insert time). */
1053
+ funcName: string;
1054
+ /** Vertex kind: 'param' | 'local' | 'return' | 'receiver'. */
1055
+ kind: 'param' | 'local' | 'return' | 'receiver';
1056
+ name?: string;
1057
+ paramIndex?: number;
1058
+ line?: number;
1059
+ }
1060
+
1061
+ /** Dataflow extraction result. */
1062
+ export interface DataflowResult {
1063
+ parameters: DataflowParam[];
1064
+ returns: DataflowReturn[];
1065
+ assignments: DataflowAssignment[];
1066
+ argFlows: DataflowArgFlow[];
1067
+ mutations: DataflowMutation[];
1068
+ }
1069
+
1070
+ export interface DataflowParam {
1071
+ name: string;
1072
+ funcName: string;
1073
+ line: number;
1074
+ typeHint?: string;
1075
+ }
1076
+
1077
+ export interface DataflowReturn {
1078
+ funcName: string;
1079
+ line: number;
1080
+ expression: string;
1081
+ }
1082
+
1083
+ export interface DataflowAssignment {
1084
+ name: string;
1085
+ line: number;
1086
+ expression: string;
1087
+ }
1088
+
1089
+ export interface DataflowArgFlow {
1090
+ callerFunc: string;
1091
+ callee: string;
1092
+ argIndex: number;
1093
+ binding: { name: string; type: 'param' | 'local' | 'unknown' };
1094
+ line: number;
1095
+ }
1096
+
1097
+ export interface DataflowMutation {
1098
+ binding: { name: string; type: 'param' | 'local' | 'unknown' };
1099
+ mutatingExpr: string;
1100
+ line: number;
1101
+ }
1102
+
1103
+ // ════════════════════════════════════════════════════════════════════════
1104
+ // §9 Graph Model (CodeGraph)
1105
+ // ════════════════════════════════════════════════════════════════════════
1106
+
1107
+ /** Node attributes stored in the in-memory graph. */
1108
+ export interface GraphNodeAttrs {
1109
+ label?: string;
1110
+ kind?: string;
1111
+ file?: string;
1112
+ name?: string;
1113
+ line?: number;
1114
+ dbId?: number;
1115
+ [key: string]: unknown;
1116
+ }
1117
+
1118
+ /** Edge attributes stored in the in-memory graph. */
1119
+ export interface GraphEdgeAttrs {
1120
+ kind?: string;
1121
+ confidence?: number;
1122
+ weight?: number;
1123
+ [key: string]: unknown;
1124
+ }
1125
+
1126
+ /** The unified in-memory graph model. */
1127
+ export interface CodeGraph {
1128
+ readonly directed: boolean;
1129
+ readonly nodeCount: number;
1130
+ readonly edgeCount: number;
1131
+
1132
+ // Node operations
1133
+ addNode(id: string, attrs?: GraphNodeAttrs): CodeGraph;
1134
+ hasNode(id: string): boolean;
1135
+ getNodeAttrs(id: string): GraphNodeAttrs | undefined;
1136
+ nodes(): IterableIterator<[string, GraphNodeAttrs]>;
1137
+ nodeIds(): string[];
1138
+
1139
+ // Edge operations
1140
+ addEdge(source: string, target: string, attrs?: GraphEdgeAttrs): CodeGraph;
1141
+ hasEdge(source: string, target: string): boolean;
1142
+ getEdgeAttrs(source: string, target: string): GraphEdgeAttrs | undefined;
1143
+ edges(): Generator<[string, string, GraphEdgeAttrs]>;
1144
+
1145
+ // Adjacency
1146
+ successors(id: string): string[];
1147
+ predecessors(id: string): string[];
1148
+ neighbors(id: string): string[];
1149
+ outDegree(id: string): number;
1150
+ inDegree(id: string): number;
1151
+
1152
+ // Filtering
1153
+ subgraph(predicate: (id: string, attrs: GraphNodeAttrs) => boolean): CodeGraph;
1154
+ filterEdges(predicate: (src: string, tgt: string, attrs: GraphEdgeAttrs) => boolean): CodeGraph;
1155
+
1156
+ // Conversion
1157
+ toEdgeArray(): Array<{ source: string; target: string }>;
1158
+ toGraphology(opts?: { type?: string }): unknown;
1159
+
1160
+ // Utilities
1161
+ clone(): CodeGraph;
1162
+ merge(other: CodeGraph): CodeGraph;
1163
+ }
1164
+
1165
+ // ════════════════════════════════════════════════════════════════════════
1166
+ // §10 Build Pipeline
1167
+ // ════════════════════════════════════════════════════════════════════════
1168
+
1169
+ /** Engine options for the build pipeline. */
1170
+ export interface EngineOpts {
1171
+ engine: EngineMode;
1172
+ dataflow: boolean;
1173
+ ast: boolean;
1174
+ /** Persistent NativeDatabase connection for build writes (Phase 6.15). */
1175
+ nativeDb?: NativeDatabase;
1176
+ /**
1177
+ * Suspend the JS (better-sqlite3) connection before a native write to avoid
1178
+ * dual-connection WAL corruption. Call `resumeJsDb()` after the write completes.
1179
+ * Only set during pipeline builds where both connections coexist.
1180
+ */
1181
+ suspendJsDb?: () => void;
1182
+ resumeJsDb?: () => void;
1183
+ }
1184
+
1185
+ /** A file change detected during incremental builds. */
1186
+ export interface ParseChange {
1187
+ file: string;
1188
+ relPath?: string;
1189
+ content?: string;
1190
+ hash?: string;
1191
+ stat?: { mtime: number; size: number };
1192
+ _reverseDepOnly?: boolean;
1193
+ }
1194
+
1195
+ /** Metadata-only self-heal update. */
1196
+ export interface MetadataUpdate {
1197
+ relPath: string;
1198
+ hash: string;
1199
+ stat: { mtime: number; size: number };
1200
+ }
1201
+
1202
+ /** A file queued for parsing. */
1203
+ export interface FileToParse {
1204
+ file: string;
1205
+ relPath?: string;
1206
+ }
1207
+
1208
+ /** Shared mutable state threaded through all build stages. */
1209
+ export interface PipelineContext {
1210
+ // Inputs (set during setup)
1211
+ rootDir: string;
1212
+ db: unknown; // better-sqlite3.Database
1213
+ dbPath: string;
1214
+ config: CodegraphConfig;
1215
+ opts: BuildGraphOpts;
1216
+ engineOpts: EngineOpts;
1217
+ engineName: 'native' | 'wasm';
1218
+ engineVersion: string | null;
1219
+ aliases: PathAliases;
1220
+ incremental: boolean;
1221
+ forceFullRebuild: boolean;
1222
+ schemaVersion: number;
1223
+
1224
+ // File collection
1225
+ allFiles: string[];
1226
+ discoveredDirs: Set<string>;
1227
+
1228
+ // Change detection
1229
+ isFullBuild: boolean;
1230
+ parseChanges: ParseChange[];
1231
+ metadataUpdates: MetadataUpdate[];
1232
+ removed: string[];
1233
+ earlyExit: boolean;
1234
+
1235
+ // Parsing
1236
+ allSymbols: Map<string, ExtractorOutput>;
1237
+ fileSymbols: Map<string, ExtractorOutput>;
1238
+ filesToParse: FileToParse[];
1239
+
1240
+ // Import resolution
1241
+ batchResolved: BatchResolvedMap | null;
1242
+ reexportMap: Map<string, unknown[]>;
1243
+ barrelOnlyFiles: Set<string>;
1244
+
1245
+ // Node lookup
1246
+ nodesByName: Map<string, NodeRow[]>;
1247
+ nodesByNameAndFile: Map<string, NodeRow[]>;
1248
+
1249
+ // Misc state
1250
+ hasEmbeddings: boolean;
1251
+ lineCountMap: Map<string, number>;
1252
+
1253
+ // Phase timing
1254
+ timing: {
1255
+ setupMs?: number;
1256
+ collectMs?: number;
1257
+ detectMs?: number;
1258
+ parseMs?: number;
1259
+ insertMs?: number;
1260
+ resolveMs?: number;
1261
+ edgesMs?: number;
1262
+ structureMs?: number;
1263
+ rolesMs?: number;
1264
+ astMs?: number;
1265
+ complexityMs?: number;
1266
+ cfgMs?: number;
1267
+ dataflowMs?: number;
1268
+ finalizeMs?: number;
1269
+ [key: string]: number | undefined;
1270
+ };
1271
+ buildStart: number;
1272
+ }
1273
+
1274
+ /** Options for buildGraph. */
1275
+ export interface BuildGraphOpts {
1276
+ incremental?: boolean;
1277
+ engine?: EngineMode;
1278
+ dataflow?: boolean;
1279
+ ast?: boolean;
1280
+ complexity?: boolean;
1281
+ cfg?: boolean;
1282
+ scope?: string[];
1283
+ /**
1284
+ * Glob patterns merged on top of `config.exclude` for this build only.
1285
+ * Lets callers extend exclusion programmatically without writing a config
1286
+ * file — used by the benchmark scripts to skip resolution-benchmark
1287
+ * fixtures that aren't representative of real code.
1288
+ */
1289
+ exclude?: string[];
1290
+ skipRegistry?: boolean;
1291
+ /**
1292
+ * Override the graph.db location. Resolved absolute. When omitted, the
1293
+ * pipeline writes to `<rootDir>/.codegraph/graph.db` — same default as
1294
+ * `findDbPath` for every other DB-scoped command.
1295
+ */
1296
+ dbPath?: string;
1297
+ /**
1298
+ * User-config override for this build (from --user-config / --no-user-config).
1299
+ * - false → --no-user-config: skip global layer for this run
1300
+ * - string → --user-config <path>: apply the given file
1301
+ * - true → --user-config (bare): apply the default global file
1302
+ * - undefined → honour per-repo consent from the registry (normal)
1303
+ */
1304
+ userConfig?: string | boolean;
1305
+ /**
1306
+ * When true, an interactive consent prompt may fire on first build for
1307
+ * repos whose global-config consent is undecided. Only set by the CLI
1308
+ * build command when stdin/stdout are TTYs and CI is not set.
1309
+ */
1310
+ promptForConsent?: boolean;
1311
+ }
1312
+
1313
+ /** Build timing result from buildGraph. */
1314
+ export interface BuildResult {
1315
+ phases: {
1316
+ setupMs: number;
1317
+ collectMs: number;
1318
+ detectMs: number;
1319
+ parseMs: number;
1320
+ insertMs: number;
1321
+ resolveMs: number;
1322
+ edgesMs: number;
1323
+ structureMs: number;
1324
+ rolesMs: number;
1325
+ /** Wall-clock time for the CHA expansion post-pass (native path only). */
1326
+ chaMs?: number;
1327
+ /** Wall-clock time for the this/super dispatch WASM post-pass (native path only). */
1328
+ thisDispatchMs?: number;
1329
+ /** Wall-clock time for the dropped-language gap detection + backfill (native path only). */
1330
+ gapDetectMs?: number;
1331
+ /** Wall-clock time for role re-classification after JS edge-writing post-passes (native path only). */
1332
+ reclassifyMs?: number;
1333
+ /** Wall-clock time for the technique-column backfill on native-written edges (native path only). */
1334
+ techniqueBackfillMs?: number;
1335
+ astMs: number;
1336
+ complexityMs: number;
1337
+ cfgMs: number;
1338
+ dataflowMs: number;
1339
+ finalizeMs: number;
1340
+ };
1341
+ }
1342
+
1343
+ /** A pipeline stage function. */
1344
+ export type PipelineStage = (ctx: PipelineContext) => Promise<void>;
1345
+
1346
+ // ════════════════════════════════════════════════════════════════════════
1347
+ // §11 Configuration
1348
+ // ════════════════════════════════════════════════════════════════════════
1349
+
1350
+ export interface CodegraphConfig {
1351
+ include: string[];
1352
+ exclude: string[];
1353
+ ignoreDirs: string[];
1354
+ extensions: string[];
1355
+ aliases: Record<string, unknown>;
1356
+
1357
+ build: {
1358
+ incremental: boolean;
1359
+ dbPath: string;
1360
+ driftThreshold: number;
1361
+ smallFilesThreshold: number;
1362
+ /**
1363
+ * Use the TypeScript compiler API to enrich typeMap for .ts/.tsx files.
1364
+ * Improves method-call edge accuracy for patterns like `const svc = container.get<MyService>()`.
1365
+ * Disabled by default because `ts.createProgram` adds ~1s overhead per build;
1366
+ * enable in `.codegraphrc.json` when you need accurate type-resolved call edges.
1367
+ * Default: false.
1368
+ */
1369
+ typescriptResolver: boolean;
1370
+ /**
1371
+ * Engine selection override. Values: `'auto'` (default), `'native'`, `'wasm'`.
1372
+ *
1373
+ * **Current wiring (partial):** This field is populated by `applyEnvOverrides`
1374
+ * from `CODEGRAPH_ENGINE` env var — env var → `config.build.engine`. The
1375
+ * `--engine` CLI flag is also forwarded. However, `connection.ts` and
1376
+ * `pipeline.ts` still read `process.env.CODEGRAPH_ENGINE` / `ctx.opts.engine`
1377
+ * directly, so a value set only in `.codegraphrc.json` (not via env var or CLI)
1378
+ * is silently ignored by the pipeline.
1379
+ *
1380
+ * Full config-file wiring is tracked in issue #1596.
1381
+ */
1382
+ engine: 'auto' | 'native' | 'wasm';
1383
+ /**
1384
+ * Enable diagnostic logging for the native fast-skip pre-flight check.
1385
+ * Equivalent to `CODEGRAPH_FAST_SKIP_DIAG=1`. When true, logs why the
1386
+ * fast-skip gate was skipped (e.g. forceFullRebuild, engineName mismatch).
1387
+ * Default: false.
1388
+ */
1389
+ fastSkipDiag: boolean;
1390
+ };
1391
+
1392
+ query: {
1393
+ defaultDepth: number;
1394
+ defaultLimit: number;
1395
+ excludeTests: boolean;
1396
+ };
1397
+
1398
+ embeddings: {
1399
+ model: string | null;
1400
+ llmProvider: string | null;
1401
+ };
1402
+
1403
+ llm: {
1404
+ provider: string | null;
1405
+ model: string | null;
1406
+ baseUrl: string | null;
1407
+ apiKey: string | null;
1408
+ /**
1409
+ * Command that prints the API key to stdout. Must be a single string —
1410
+ * it is split on whitespace and executed via `execFileSync` with no shell,
1411
+ * so shell features like `$(...)`, pipes, globs, or variable expansion are
1412
+ * not supported. Example: `"op read op://vault/openai/api-key"`. Non-string
1413
+ * values are rejected with a `ConfigError` at load time.
1414
+ */
1415
+ apiKeyCommand: string | null;
1416
+ };
1417
+
1418
+ search: {
1419
+ defaultMinScore: number;
1420
+ rrfK: number;
1421
+ topK: number;
1422
+ similarityWarnThreshold: number;
1423
+ };
1424
+
1425
+ ci: {
1426
+ failOnCycles: boolean;
1427
+ impactThreshold: number | null;
1428
+ };
1429
+
1430
+ manifesto: {
1431
+ rules: ManifestoRules;
1432
+ boundaries: unknown | null;
1433
+ };
1434
+
1435
+ check: {
1436
+ cycles: boolean;
1437
+ blastRadius: number | null;
1438
+ signatures: boolean;
1439
+ boundaries: boolean;
1440
+ depth: number;
1441
+ };
1442
+
1443
+ coChange: {
1444
+ since: string;
1445
+ minSupport: number;
1446
+ minJaccard: number;
1447
+ maxFilesPerCommit: number;
1448
+ };
1449
+
1450
+ analysis: {
1451
+ impactDepth: number;
1452
+ fnImpactDepth: number;
1453
+ auditDepth: number;
1454
+ sequenceDepth: number;
1455
+ falsePositiveCallers: number;
1456
+ briefCallerDepth: number;
1457
+ briefImporterDepth: number;
1458
+ briefHighRiskCallers: number;
1459
+ briefMediumRiskCallers: number;
1460
+ /** Maximum chain depth for inter-procedural return-type propagation (Phase 8.2). */
1461
+ typePropagationDepth: number;
1462
+ /**
1463
+ * Maximum fixed-point iterations for the Phase 8.3 points-to solver.
1464
+ * @reserved — currently not wired to either solver; both use a hardcoded
1465
+ * constant of 50. See TODO in `src/infrastructure/config.ts`.
1466
+ */
1467
+ pointsToMaxIterations: number;
1468
+ /**
1469
+ * Confidence score for a return type inferred from `return new Constructor()`
1470
+ * with no explicit TypeScript annotation.
1471
+ * Mirrors `INFERRED_RETURN_TYPE_CONFIDENCE` in `src/extractors/javascript.ts`.
1472
+ * @reserved — not yet wired; see TODO in `src/infrastructure/config.ts`.
1473
+ */
1474
+ typeInferenceConfidence: number;
1475
+ };
1476
+
1477
+ community: {
1478
+ resolution: number;
1479
+ maxLevels: number;
1480
+ maxLocalPasses: number;
1481
+ refinementTheta: number;
1482
+ };
1483
+ structure: { cohesionThreshold: number };
1484
+
1485
+ risk: {
1486
+ weights: RiskWeights;
1487
+ roleWeights: Record<Role, number>;
1488
+ defaultRoleWeight: number;
1489
+ };
1490
+
1491
+ display: {
1492
+ maxColWidth: number;
1493
+ excerptLines: number;
1494
+ summaryMaxChars: number;
1495
+ jsdocEndScanLines: number;
1496
+ jsdocOpenScanLines: number;
1497
+ signatureGatherLines: number;
1498
+ };
1499
+
1500
+ mcp: {
1501
+ defaults: McpDefaults;
1502
+ disabledTools?: string[];
1503
+ };
1504
+ }
1505
+
1506
+ export interface ManifestoRules {
1507
+ cognitive: ThresholdRule;
1508
+ cyclomatic: ThresholdRule;
1509
+ maxNesting: ThresholdRule;
1510
+ maintainabilityIndex: ThresholdRule;
1511
+ importCount: ThresholdRule;
1512
+ exportCount: ThresholdRule;
1513
+ lineCount: ThresholdRule;
1514
+ fanIn: ThresholdRule;
1515
+ fanOut: ThresholdRule;
1516
+ noCycles: ThresholdRule;
1517
+ boundaries: ThresholdRule;
1518
+ }
1519
+
1520
+ export interface ThresholdRule {
1521
+ warn: number | null;
1522
+ fail?: number | null;
1523
+ }
1524
+
1525
+ export interface RiskWeights {
1526
+ fanIn: number;
1527
+ complexity: number;
1528
+ churn: number;
1529
+ role: number;
1530
+ mi: number;
1531
+ }
1532
+
1533
+ export interface McpDefaults {
1534
+ [key: string]: number;
1535
+ list_functions: number;
1536
+ query: number;
1537
+ where: number;
1538
+ node_roles: number;
1539
+ export_graph: number;
1540
+ fn_impact: number;
1541
+ context: number;
1542
+ explain: number;
1543
+ file_deps: number;
1544
+ file_exports: number;
1545
+ diff_impact: number;
1546
+ impact_analysis: number;
1547
+ semantic_search: number;
1548
+ execution_flow: number;
1549
+ hotspots: number;
1550
+ co_changes: number;
1551
+ complexity: number;
1552
+ manifesto: number;
1553
+ communities: number;
1554
+ structure: number;
1555
+ triage: number;
1556
+ ast_query: number;
1557
+ implementations: number;
1558
+ interfaces: number;
1559
+ }
1560
+
1561
+ /** Per-repo consent decision for the user-level global config. */
1562
+ export type ConsentDecision = 'enabled' | 'disabled';
1563
+
1564
+ /** Which layer contributed a resolved config value. */
1565
+ export type ConfigSource = 'default' | 'user' | 'project' | 'env';
1566
+
1567
+ /** Maps config key paths (dot notation) to the layer that supplied the value. */
1568
+ export type ConfigProvenance = Record<string, ConfigSource>;
1569
+
1570
+ /** Result of loadConfigWithProvenance. */
1571
+ export interface ConfigWithProvenance {
1572
+ config: CodegraphConfig;
1573
+ provenance: ConfigProvenance;
1574
+ /** Absolute path of the applied global file, or null if none was applied. */
1575
+ appliedGlobalPath: string | null;
1576
+ /** This repo's recorded consent decision (may be undefined if undecided). */
1577
+ consentDecision: ConsentDecision | undefined;
1578
+ }
1579
+
1580
+ // ════════════════════════════════════════════════════════════════════════
1581
+ // §12 Pagination
1582
+ // ════════════════════════════════════════════════════════════════════════
1583
+
1584
+ export interface PaginationOpts {
1585
+ limit?: number;
1586
+ offset?: number;
1587
+ }
1588
+
1589
+ export interface PaginationMeta {
1590
+ total: number;
1591
+ offset: number;
1592
+ limit: number;
1593
+ hasMore: boolean;
1594
+ returned: number;
1595
+ }
1596
+
1597
+ export interface PaginatedItems<T> {
1598
+ items: T[];
1599
+ pagination?: PaginationMeta;
1600
+ }
1601
+
1602
+ /** A result object with optional _pagination metadata. */
1603
+ export type Paginated<T> = T & { _pagination?: PaginationMeta };
1604
+
1605
+ // ════════════════════════════════════════════════════════════════════════
1606
+ // §13 Error Hierarchy
1607
+ // ════════════════════════════════════════════════════════════════════════
1608
+
1609
+ export type ErrorCode =
1610
+ | 'CODEGRAPH_ERROR'
1611
+ | 'PARSE_FAILED'
1612
+ | 'DB_ERROR'
1613
+ | 'CONFIG_INVALID'
1614
+ | 'RESOLUTION_FAILED'
1615
+ | 'ENGINE_UNAVAILABLE'
1616
+ | 'ANALYSIS_FAILED'
1617
+ | 'BOUNDARY_VIOLATION';
1618
+
1619
+ export interface CodegraphErrorOpts {
1620
+ code?: ErrorCode;
1621
+ file?: string;
1622
+ cause?: Error;
1623
+ }
1624
+
1625
+ // ════════════════════════════════════════════════════════════════════════
1626
+ // §14 Feature Module Result Shapes
1627
+ // ════════════════════════════════════════════════════════════════════════
1628
+
1629
+ // ── Audit ────────────────────────────────────────────────────────────
1630
+
1631
+ export interface AuditResult {
1632
+ target: string;
1633
+ kind: 'function' | 'file';
1634
+ functions: AuditFunctionEntry[];
1635
+ }
1636
+
1637
+ export interface AuditFunctionEntry {
1638
+ name: string;
1639
+ kind: SymbolKind;
1640
+ file: string;
1641
+ line: number;
1642
+ endLine: number | null;
1643
+ role: Role | null;
1644
+ lineCount: number;
1645
+ summary: string | null;
1646
+ signature: string | null;
1647
+ callees: string[];
1648
+ callers: string[];
1649
+ relatedTests: string[];
1650
+ impact: {
1651
+ totalDependents: number;
1652
+ levels: Record<number, ImpactLevelEntry[]>;
1653
+ };
1654
+ health: {
1655
+ cognitive: number;
1656
+ cyclomatic: number;
1657
+ maxNesting: number;
1658
+ maintainabilityIndex: number | null;
1659
+ halstead: HalsteadMetrics | null;
1660
+ loc: number;
1661
+ sloc: number;
1662
+ commentLines: number;
1663
+ thresholdBreaches: string[];
1664
+ };
1665
+ riskScore: number;
1666
+ complexityNotes: string[];
1667
+ sideEffects: string[];
1668
+ }
1669
+
1670
+ export interface ImpactLevelEntry {
1671
+ name: string;
1672
+ kind: string;
1673
+ file: string;
1674
+ line: number;
1675
+ viaImplements?: boolean;
1676
+ }
1677
+
1678
+ // ── Complexity ───────────────────────────────────────────────────────
1679
+
1680
+ export interface ComplexityResult {
1681
+ functions: ComplexityEntry[];
1682
+ summary: {
1683
+ analyzed: number;
1684
+ avgCognitive: number;
1685
+ maxCognitive: number;
1686
+ avgCyclomatic: number;
1687
+ maxCyclomatic: number;
1688
+ avgMI: number;
1689
+ minMI: number;
1690
+ aboveWarn: number;
1691
+ };
1692
+ thresholds: ManifestoRules;
1693
+ hasGraph: boolean;
1694
+ }
1695
+
1696
+ export interface ComplexityEntry {
1697
+ name: string;
1698
+ kind: SymbolKind;
1699
+ file: string;
1700
+ line: number;
1701
+ endLine: number | null;
1702
+ cognitive: number;
1703
+ cyclomatic: number;
1704
+ maxNesting: number;
1705
+ loc: number;
1706
+ sloc: number;
1707
+ maintainabilityIndex: number;
1708
+ halstead: HalsteadMetrics;
1709
+ exceeds?: Array<'cognitive' | 'cyclomatic' | 'maxNesting' | 'maintainabilityIndex'>;
1710
+ }
1711
+
1712
+ // ── Diff Impact ──────────────────────────────────────────────────────
1713
+
1714
+ export interface DiffImpactResult {
1715
+ error?: string;
1716
+ changedFiles: number;
1717
+ newFiles: string[];
1718
+ affectedFunctions: AffectedFunction[];
1719
+ affectedFiles: string[];
1720
+ historicallyCoupled?: CoChangeEntry[];
1721
+ ownership?: Record<string, string>;
1722
+ boundaryViolations?: BoundaryViolation[];
1723
+ boundaryViolationCount: number;
1724
+ summary?: DiffImpactSummary;
1725
+ }
1726
+
1727
+ export interface AffectedFunction {
1728
+ name: string;
1729
+ kind: string;
1730
+ file: string;
1731
+ line: number;
1732
+ totalDependents: number;
1733
+ levels: Record<number, ImpactLevelEntry[]>;
1734
+ }
1735
+
1736
+ export interface CoChangeEntry {
1737
+ file: string;
1738
+ support: number;
1739
+ jaccard: number;
1740
+ }
1741
+
1742
+ export interface BoundaryViolation {
1743
+ from: string;
1744
+ to: string;
1745
+ rule: string;
1746
+ }
1747
+
1748
+ export interface DiffImpactSummary {
1749
+ changedFiles: number;
1750
+ newFiles: number;
1751
+ affectedFunctions: number;
1752
+ totalDependents: number;
1753
+ boundaryViolations: number;
1754
+ }
1755
+
1756
+ // ── Triage ───────────────────────────────────────────────────────────
1757
+
1758
+ export interface TriageResult {
1759
+ items: TriageEntry[];
1760
+ summary: {
1761
+ total: number;
1762
+ analyzed: number;
1763
+ avgScore: number;
1764
+ maxScore: number;
1765
+ weights: RiskWeights;
1766
+ signalCoverage: {
1767
+ complexity: number;
1768
+ churn: number;
1769
+ fanIn: number;
1770
+ mi: number;
1771
+ };
1772
+ };
1773
+ _pagination?: PaginationMeta;
1774
+ }
1775
+
1776
+ export interface TriageEntry {
1777
+ name: string;
1778
+ kind: SymbolKind;
1779
+ file: string;
1780
+ line: number;
1781
+ role: Role | null;
1782
+ fanIn: number;
1783
+ cognitive: number;
1784
+ churn: number;
1785
+ maintainabilityIndex: number;
1786
+ normFanIn: number;
1787
+ normComplexity: number;
1788
+ normChurn: number;
1789
+ normMI: number;
1790
+ roleWeight: number;
1791
+ riskScore: number;
1792
+ }
1793
+
1794
+ // ── Communities ───────────────────────────────────────────────────────
1795
+
1796
+ export interface CommunitiesResult {
1797
+ communities: CommunityEntry[];
1798
+ modularity: number;
1799
+ drift: {
1800
+ splitCandidates: Array<{ directory: string; communityCount: number }>;
1801
+ mergeCandidates: Array<{
1802
+ communityId: number;
1803
+ size: number;
1804
+ directoryCount: number;
1805
+ directories: string[];
1806
+ }>;
1807
+ };
1808
+ summary: {
1809
+ communityCount: number;
1810
+ modularity: number;
1811
+ nodeCount: number;
1812
+ driftScore: number;
1813
+ };
1814
+ _pagination?: PaginationMeta;
1815
+ }
1816
+
1817
+ export interface CommunityEntry {
1818
+ id: number;
1819
+ size: number;
1820
+ directories: Record<string, number>;
1821
+ members?: Array<{ name: string; file: string; kind?: string }>;
1822
+ }
1823
+
1824
+ // ── Check ────────────────────────────────────────────────────────────
1825
+
1826
+ export interface CheckResult {
1827
+ predicates: CheckPredicate[];
1828
+ summary: {
1829
+ total: number;
1830
+ passed: number;
1831
+ failed: number;
1832
+ changedFiles: number;
1833
+ newFiles: number;
1834
+ };
1835
+ passed: boolean;
1836
+ error?: string;
1837
+ }
1838
+
1839
+ export interface CheckPredicate {
1840
+ name: string;
1841
+ passed: boolean;
1842
+ violations: unknown[];
1843
+ maxFound?: number;
1844
+ threshold?: number;
1845
+ note?: string;
1846
+ }
1847
+
1848
+ // ── Batch ────────────────────────────────────────────────────────────
1849
+
1850
+ export type BatchCommand =
1851
+ | 'fn-impact'
1852
+ | 'context'
1853
+ | 'explain'
1854
+ | 'where'
1855
+ | 'query'
1856
+ | 'impact'
1857
+ | 'deps'
1858
+ | 'exports'
1859
+ | 'flow'
1860
+ | 'dataflow'
1861
+ | 'complexity';
1862
+
1863
+ export interface BatchResult {
1864
+ command: BatchCommand;
1865
+ total: number;
1866
+ succeeded: number;
1867
+ failed: number;
1868
+ results: BatchResultEntry[];
1869
+ }
1870
+
1871
+ export interface BatchResultEntry {
1872
+ target: string;
1873
+ ok: boolean;
1874
+ data?: unknown;
1875
+ error?: string;
1876
+ }
1877
+
1878
+ export interface MultiBatchItem {
1879
+ command: BatchCommand;
1880
+ target: string;
1881
+ opts?: Record<string, unknown>;
1882
+ }
1883
+
1884
+ export interface MultiBatchResult {
1885
+ mode: 'multi';
1886
+ total: number;
1887
+ succeeded: number;
1888
+ failed: number;
1889
+ results: BatchResultEntry[];
1890
+ }
1891
+
1892
+ // ── Flow ─────────────────────────────────────────────────────────────
1893
+
1894
+ export interface FlowResult {
1895
+ entry: FlowEntry | null;
1896
+ depth: number;
1897
+ steps: Array<{
1898
+ depth: number;
1899
+ nodes: Array<{ name: string; kind: string; file: string; line: number }>;
1900
+ }>;
1901
+ leaves: Array<{ name: string; kind: string; file: string; line: number; depth: number }>;
1902
+ cycles: Array<{ from: string; to: string; depth: number }>;
1903
+ totalReached: number;
1904
+ truncated: boolean;
1905
+ _pagination?: PaginationMeta;
1906
+ }
1907
+
1908
+ export interface FlowEntry {
1909
+ name: string;
1910
+ kind: string;
1911
+ file: string;
1912
+ line: number;
1913
+ type: string;
1914
+ role: Role | null;
1915
+ }
1916
+
1917
+ // ── Manifesto ────────────────────────────────────────────────────────
1918
+
1919
+ export type ManifestoRuleLevel = 'function' | 'file' | 'graph';
1920
+
1921
+ export interface ManifestoRuleDef {
1922
+ name: string;
1923
+ level: ManifestoRuleLevel;
1924
+ metric: string;
1925
+ defaults: ThresholdRule;
1926
+ reportOnly?: boolean;
1927
+ }
1928
+
1929
+ export interface ManifestoResult {
1930
+ rules: ManifestoRuleStatus[];
1931
+ violations: ManifestoViolation[];
1932
+ summary: { total: number; passed: number; warned: number; failed: number };
1933
+ _pagination?: PaginationMeta;
1934
+ }
1935
+
1936
+ export interface ManifestoRuleStatus {
1937
+ name: string;
1938
+ level: ManifestoRuleLevel;
1939
+ status: 'pass' | 'warn' | 'fail';
1940
+ thresholds: ThresholdRule;
1941
+ violationCount: number;
1942
+ }
1943
+
1944
+ export interface ManifestoViolation {
1945
+ rule: string;
1946
+ level: ManifestoRuleLevel;
1947
+ value: number;
1948
+ threshold: number;
1949
+ name?: string;
1950
+ kind?: string;
1951
+ file?: string;
1952
+ line?: number;
1953
+ }
1954
+
1955
+ // ── Exports (file) ───────────────────────────────────────────────────
1956
+
1957
+ export interface FileExportsResult {
1958
+ file: string;
1959
+ results: FileExportEntry[];
1960
+ reexports: Array<{ file: string }>;
1961
+ totalExported: number;
1962
+ totalInternal: number;
1963
+ totalUnused: number;
1964
+ }
1965
+
1966
+ export interface FileExportEntry {
1967
+ name: string;
1968
+ kind: SymbolKind;
1969
+ line: number;
1970
+ endLine: number | null;
1971
+ role: Role | null;
1972
+ signature: string | null;
1973
+ summary: string | null;
1974
+ consumers: Array<{ name: string; file: string; line: number }>;
1975
+ consumerCount: number;
1976
+ }
1977
+
1978
+ // ── Path ─────────────────────────────────────────────────────────────
1979
+
1980
+ export interface PathResult {
1981
+ from: string;
1982
+ to: string;
1983
+ fromCandidates: NodeRow[];
1984
+ toCandidates: NodeRow[];
1985
+ found: boolean;
1986
+ hops: number | null;
1987
+ path: PathStep[];
1988
+ alternateCount: number;
1989
+ edgeKinds: string[];
1990
+ reverse: boolean;
1991
+ maxDepth: number;
1992
+ }
1993
+
1994
+ export interface PathStep {
1995
+ name: string;
1996
+ kind: string;
1997
+ file: string;
1998
+ line: number;
1999
+ edgeKind: AnyEdgeKind | null;
2000
+ }
2001
+
2002
+ // ── Stats ────────────────────────────────────────────────────────────
2003
+
2004
+ export interface StatsResult {
2005
+ nodes: { total: number; byKind: Record<string, number> };
2006
+ edges: { total: number; byKind: Record<string, number> };
2007
+ files: Record<string, unknown>;
2008
+ cycles: { fileLevel: number; functionLevel: number };
2009
+ hotspots: unknown[];
2010
+ embeddings?: unknown;
2011
+ quality?: unknown;
2012
+ roles: Record<Role, number>;
2013
+ complexity?: unknown;
2014
+ }
2015
+
2016
+ // ── Module Map ───────────────────────────────────────────────────────
2017
+
2018
+ export interface ModuleMapResult {
2019
+ limit: number;
2020
+ topNodes: ModuleMapEntry[];
2021
+ stats: { totalFiles: number; totalNodes: number; totalEdges: number };
2022
+ }
2023
+
2024
+ export interface ModuleMapEntry {
2025
+ file: string;
2026
+ dir: string;
2027
+ inEdges: number;
2028
+ outEdges: number;
2029
+ coupling: number;
2030
+ }
2031
+
2032
+ // ── Roles ────────────────────────────────────────────────────────────
2033
+
2034
+ export interface RolesResult {
2035
+ count: number;
2036
+ summary: Record<Role, number>;
2037
+ symbols: NodeRow[];
2038
+ }
2039
+
2040
+ // ── Implementations / Interfaces ─────────────────────────────────
2041
+
2042
+ export interface ImplementationsResult {
2043
+ name: string;
2044
+ results: Array<{
2045
+ name: string;
2046
+ kind: string;
2047
+ file: string;
2048
+ line: number;
2049
+ implementors: Array<{ name: string; kind: string; file: string; line: number }>;
2050
+ }>;
2051
+ _pagination?: PaginationMeta;
2052
+ }
2053
+
2054
+ export interface InterfacesResult {
2055
+ name: string;
2056
+ results: Array<{
2057
+ name: string;
2058
+ kind: string;
2059
+ file: string;
2060
+ line: number;
2061
+ interfaces: Array<{ name: string; kind: string; file: string; line: number }>;
2062
+ }>;
2063
+ _pagination?: PaginationMeta;
2064
+ }
2065
+
2066
+ // ════════════════════════════════════════════════════════════════════════
2067
+ // §15 Registry (Multi-repo)
2068
+ // ════════════════════════════════════════════════════════════════════════
2069
+
2070
+ export interface RegistryEntry {
2071
+ path: string;
2072
+ dbPath: string;
2073
+ addedAt: string;
2074
+ lastAccessedAt: string;
2075
+ }
2076
+
2077
+ export interface Registry {
2078
+ repos: Record<string, RegistryEntry>;
2079
+ }
2080
+
2081
+ export interface RegistryListItem {
2082
+ name: string;
2083
+ path: string;
2084
+ dbPath: string;
2085
+ addedAt: string;
2086
+ lastAccessedAt: string;
2087
+ }
2088
+
2089
+ // ════════════════════════════════════════════════════════════════════════
2090
+ // §16 MCP Server
2091
+ // ════════════════════════════════════════════════════════════════════════
2092
+
2093
+ export interface MCPServerOptions {
2094
+ multiRepo?: boolean;
2095
+ allowedRepos?: string[];
2096
+ }
2097
+
2098
+ // ════════════════════════════════════════════════════════════════════════
2099
+ // §17 Command Interface (CLI)
2100
+ // ════════════════════════════════════════════════════════════════════════
2101
+
2102
+ export interface OptionDef {
2103
+ flags: string;
2104
+ description: string;
2105
+ default?: unknown;
2106
+ }
2107
+
2108
+ export interface Command {
2109
+ name: string;
2110
+ description: string;
2111
+ options: OptionDef[];
2112
+ validate?(args: unknown, opts: unknown): void;
2113
+ execute(args: unknown, opts: unknown): Promise<void>;
2114
+ }
2115
+
2116
+ // ════════════════════════════════════════════════════════════════════════
2117
+ // §18 Risk Scoring
2118
+ // ════════════════════════════════════════════════════════════════════════
2119
+
2120
+ export interface RiskInput {
2121
+ fan_in: number;
2122
+ cognitive: number;
2123
+ churn: number;
2124
+ mi: number;
2125
+ role?: Role;
2126
+ }
2127
+
2128
+ export interface RiskScored {
2129
+ normFanIn: number;
2130
+ normComplexity: number;
2131
+ normChurn: number;
2132
+ normMI: number;
2133
+ roleWeight: number;
2134
+ riskScore: number;
2135
+ }
2136
+
2137
+ // ════════════════════════════════════════════════════════════════════════
2138
+ // §19 Sequence Diagrams
2139
+ // ════════════════════════════════════════════════════════════════════════
2140
+
2141
+ export interface SequenceStep {
2142
+ caller: string;
2143
+ callee: string;
2144
+ depth: number;
2145
+ }
2146
+
2147
+ export interface SequenceResult {
2148
+ entry: string;
2149
+ steps: SequenceStep[];
2150
+ participants: string[];
2151
+ }
2152
+
2153
+ // ════════════════════════════════════════════════════════════════════════
2154
+ // §20 Graph Export
2155
+ // ════════════════════════════════════════════════════════════════════════
2156
+
2157
+ export interface ExportOpts {
2158
+ fileLevel?: boolean;
2159
+ noTests?: boolean;
2160
+ minConfidence?: number;
2161
+ limit?: number;
2162
+ offset?: number;
2163
+ direction?: string;
2164
+ }
2165
+
2166
+ export interface ExportJSONResult {
2167
+ nodes: NodeRow[];
2168
+ edges: EdgeRow[];
2169
+ _pagination?: PaginationMeta;
2170
+ }
2171
+
2172
+ export interface ExportGraphSONResult {
2173
+ vertices: unknown[];
2174
+ edges: unknown[];
2175
+ _pagination?: PaginationMeta;
2176
+ }
2177
+
2178
+ export interface ExportNeo4jCSVResult {
2179
+ nodes: string;
2180
+ relationships: string;
2181
+ }
2182
+
2183
+ // ════════════════════════════════════════════════════════════════════════
2184
+ // §21 SQLite Database (better-sqlite3 surface)
2185
+ // ════════════════════════════════════════════════════════════════════════
2186
+
2187
+ /** Minimal prepared-statement interface matching better-sqlite3. */
2188
+ export interface SqliteStatement<TRow = unknown> {
2189
+ get(...params: unknown[]): TRow | undefined;
2190
+ all(...params: unknown[]): TRow[];
2191
+ run(...params: unknown[]): { changes: number; lastInsertRowid: number | bigint };
2192
+ iterate(...params: unknown[]): IterableIterator<TRow>;
2193
+ raw(toggle?: boolean): this;
2194
+ }
2195
+
2196
+ /** Minimal database interface matching the better-sqlite3 surface we use. */
2197
+ export interface BetterSqlite3Database {
2198
+ prepare<TRow = unknown>(sql: string): SqliteStatement<TRow>;
2199
+ exec(sql: string): this;
2200
+ close(): void;
2201
+ pragma(sql: string): unknown;
2202
+ transaction<F extends (...args: any[]) => any>(
2203
+ fn: F,
2204
+ ): (...args: F extends (...a: infer A) => unknown ? A : never) => ReturnType<F>;
2205
+ readonly open: boolean;
2206
+ readonly name: string;
2207
+ }
2208
+
2209
+ /** WeakMap-based statement cache: one prepared statement per db instance. */
2210
+ export type StmtCache<TRow = unknown> = WeakMap<BetterSqlite3Database, SqliteStatement<TRow>>;
2211
+
2212
+ // ════════════════════════════════════════════════════════════════════════
2213
+ // §22 Native Addon (napi-rs FFI boundary)
2214
+ // ════════════════════════════════════════════════════════════════════════
2215
+
2216
+ /** The native napi-rs addon interface (crates/codegraph-core). */
2217
+ export interface NativeAddon {
2218
+ parseFile(filePath: string, source: string, dataflow: boolean, ast: boolean): unknown;
2219
+ parseFiles(files: string[], rootDir: string, dataflow: boolean, ast: boolean): unknown[];
2220
+ parseFilesFull?(files: string[], rootDir: string): unknown[];
2221
+ resolveImport(fromFile: string, importSource: string, rootDir: string, aliases: unknown): string;
2222
+ resolveImports(
2223
+ items: Array<{ fromFile: string; importSource: string }>,
2224
+ rootDir: string,
2225
+ aliases: unknown,
2226
+ knownFiles: string[] | null,
2227
+ ): Array<{ fromFile: string; importSource: string; resolvedPath: string }>;
2228
+ computeConfidence(callerFile: string, targetFile: string, importedFrom: string | null): number;
2229
+ detectCycles(edges: Array<{ source: string; target: string }>): string[][];
2230
+ bfsTraversal(
2231
+ edges: Array<{ source: string; target: string }>,
2232
+ startIds: string[],
2233
+ maxDepth?: number | null,
2234
+ direction?: string | null,
2235
+ ): Array<{ node: string; depth: number }>;
2236
+ shortestPath(
2237
+ edges: Array<{ source: string; target: string }>,
2238
+ fromId: string,
2239
+ toId: string,
2240
+ ): string[];
2241
+ fanInOut(
2242
+ edges: Array<{ source: string; target: string }>,
2243
+ ): Array<{ node: string; fanIn: number; fanOut: number }>;
2244
+ louvainCommunities(
2245
+ edges: Array<{ source: string; target: string }>,
2246
+ nodeIds: string[],
2247
+ resolution?: number | null,
2248
+ randomSeed?: number | null,
2249
+ ): {
2250
+ assignments: Array<{ node: string; community: number }>;
2251
+ modularity: number;
2252
+ };
2253
+ buildCallEdges(files: unknown[], nodes: unknown[], builtinReceivers: string[]): unknown[];
2254
+ buildImportEdges?(
2255
+ files: unknown[],
2256
+ resolvedImports: unknown[],
2257
+ fileReexports: unknown[],
2258
+ fileNodeIds: unknown[],
2259
+ barrelFiles: string[],
2260
+ rootDir: string,
2261
+ symbolNodes?: Array<{ name: string; file: string; nodeId: number }>,
2262
+ ): unknown[];
2263
+ engineVersion(): string;
2264
+ analyzeComplexity(
2265
+ source: string,
2266
+ filePath: string,
2267
+ langId?: string | null,
2268
+ ): NativeFunctionComplexityResult[];
2269
+ buildCfgAnalysis(
2270
+ source: string,
2271
+ filePath: string,
2272
+ langId?: string | null,
2273
+ ): NativeFunctionCfgResult[];
2274
+ extractDataflowAnalysis(
2275
+ source: string,
2276
+ filePath: string,
2277
+ langId?: string | null,
2278
+ ): DataflowResult | null;
2279
+ ParseTreeCache: new () => NativeParseTreeCache;
2280
+ NativeDatabase: {
2281
+ openReadWrite(dbPath: string): NativeDatabase;
2282
+ openReadonly(dbPath: string): NativeDatabase;
2283
+ };
2284
+ }
2285
+
2286
+ /** Per-function complexity result from native standalone analysis (napi output shape). */
2287
+ export interface NativeFunctionComplexityResult {
2288
+ name: string;
2289
+ line: number;
2290
+ endLine: number | null;
2291
+ complexity: {
2292
+ cognitive: number;
2293
+ cyclomatic: number;
2294
+ maxNesting: number;
2295
+ halstead?: {
2296
+ n1: number;
2297
+ n2: number;
2298
+ bigN1: number;
2299
+ bigN2: number;
2300
+ vocabulary: number;
2301
+ length: number;
2302
+ volume: number;
2303
+ difficulty: number;
2304
+ effort: number;
2305
+ bugs: number;
2306
+ };
2307
+ loc?: { loc: number; sloc: number; commentLines: number };
2308
+ maintainabilityIndex?: number | null;
2309
+ };
2310
+ }
2311
+
2312
+ /** Per-function CFG result from native standalone analysis. */
2313
+ export interface NativeFunctionCfgResult {
2314
+ name: string;
2315
+ line: number;
2316
+ endLine: number | null;
2317
+ cfg: { blocks: CfgBlock[]; edges: CfgEdge[] };
2318
+ }
2319
+
2320
+ /** Native parse-tree cache instance. */
2321
+ export interface NativeParseTreeCache {
2322
+ get(filePath: string): unknown;
2323
+ set(filePath: string, tree: unknown): void;
2324
+ delete(filePath: string): void;
2325
+ clear(): void;
2326
+ }
2327
+
2328
+ /** Row types returned by NativeDatabase query methods (auto-generated by napi-rs). */
2329
+ export interface NativeNodeRow {
2330
+ id: number;
2331
+ name: string;
2332
+ kind: string;
2333
+ file: string;
2334
+ line: number | null;
2335
+ endLine: number | null;
2336
+ parentId: number | null;
2337
+ exported: number | null;
2338
+ qualifiedName: string | null;
2339
+ scope: string | null;
2340
+ visibility: string | null;
2341
+ role: string | null;
2342
+ }
2343
+
2344
+ export interface NativeNodeRowWithFanIn extends NativeNodeRow {
2345
+ fanIn: number;
2346
+ }
2347
+
2348
+ export interface NativeTriageNodeRow extends NativeNodeRow {
2349
+ fanIn: number;
2350
+ cognitive: number;
2351
+ mi: number;
2352
+ cyclomatic: number;
2353
+ maxNesting: number;
2354
+ churn: number;
2355
+ }
2356
+
2357
+ export interface NativeNodeIdRow {
2358
+ id: number;
2359
+ name: string;
2360
+ kind: string;
2361
+ line: number | null;
2362
+ }
2363
+
2364
+ export interface NativeChildNodeRow {
2365
+ name: string;
2366
+ kind: string;
2367
+ line: number | null;
2368
+ endLine: number | null;
2369
+ qualifiedName: string | null;
2370
+ scope: string | null;
2371
+ visibility: string | null;
2372
+ }
2373
+
2374
+ export interface NativeRelatedNodeRow {
2375
+ id: number;
2376
+ name: string;
2377
+ kind: string;
2378
+ file: string;
2379
+ line: number | null;
2380
+ endLine: number | null;
2381
+ }
2382
+
2383
+ export interface NativeAdjacentEdgeRow {
2384
+ name: string;
2385
+ kind: string;
2386
+ file: string;
2387
+ line: number | null;
2388
+ edgeKind: string;
2389
+ }
2390
+
2391
+ export interface NativeImportEdgeRow {
2392
+ file: string;
2393
+ edgeKind: string;
2394
+ }
2395
+
2396
+ export interface NativeIntraFileCallEdge {
2397
+ callerName: string;
2398
+ calleeName: string;
2399
+ }
2400
+
2401
+ export interface NativeCallableNodeRow {
2402
+ id: number;
2403
+ name: string;
2404
+ kind: string;
2405
+ file: string;
2406
+ }
2407
+
2408
+ export interface NativeCallEdgeRow {
2409
+ sourceId: number;
2410
+ targetId: number;
2411
+ confidence: number | null;
2412
+ }
2413
+
2414
+ export interface NativeFileNodeRow {
2415
+ id: number;
2416
+ name: string;
2417
+ file: string;
2418
+ }
2419
+
2420
+ export interface NativeImportGraphEdgeRow {
2421
+ sourceId: number;
2422
+ targetId: number;
2423
+ }
2424
+
2425
+ export interface NativeComplexityMetrics {
2426
+ cognitive: number;
2427
+ cyclomatic: number;
2428
+ maxNesting: number;
2429
+ maintainabilityIndex: number | null;
2430
+ halsteadVolume: number | null;
2431
+ }
2432
+
2433
+ // ── Native composite query types (fnDeps) ──────────────────────────────
2434
+
2435
+ export interface NativeFnDepsNode {
2436
+ name: string;
2437
+ kind: string;
2438
+ file: string;
2439
+ line: number | null;
2440
+ }
2441
+
2442
+ export interface NativeFnDepsCallerNode {
2443
+ name: string;
2444
+ kind: string;
2445
+ file: string;
2446
+ line: number | null;
2447
+ viaHierarchy: string | null;
2448
+ }
2449
+
2450
+ export interface NativeFnDepsTransitiveGroup {
2451
+ depth: number;
2452
+ callers: NativeFnDepsNode[];
2453
+ }
2454
+
2455
+ export interface NativeFnDepsEntry {
2456
+ name: string;
2457
+ kind: string;
2458
+ file: string;
2459
+ line: number | null;
2460
+ endLine: number | null;
2461
+ role: string | null;
2462
+ fileHash: string | null;
2463
+ callees: NativeFnDepsNode[];
2464
+ callers: NativeFnDepsCallerNode[];
2465
+ transitiveCallers: NativeFnDepsTransitiveGroup[];
2466
+ }
2467
+
2468
+ export interface NativeFnDepsResult {
2469
+ name: string;
2470
+ results: NativeFnDepsEntry[];
2471
+ }
2472
+
2473
+ /** Native rusqlite database wrapper instance (Phase 6.13 + 6.14 + 6.15). */
2474
+ export interface NativeDatabase {
2475
+ // ── Lifecycle (6.13) ────────────────────────────────────────────────
2476
+ initSchema(): void;
2477
+ getBuildMeta(key: string): string | null;
2478
+ setBuildMeta(entries: Array<{ key: string; value: string }>): void;
2479
+ exec(sql: string): void;
2480
+ pragma(sql: string): string | null;
2481
+ close(): void;
2482
+ readonly dbPath: string;
2483
+ readonly isOpen: boolean;
2484
+
2485
+ // ── Node lookups (6.14) ──────────────────────────────────────────────
2486
+ countNodes(): number;
2487
+ countEdges(): number;
2488
+ countFiles(): number;
2489
+ findNodeById(id: number): NativeNodeRow | null;
2490
+ getNodeId(name: string, kind: string, file: string, line: number): number | null;
2491
+ getFunctionNodeId(name: string, file: string, line: number): number | null;
2492
+ bulkNodeIdsByFile(file: string): NativeNodeIdRow[];
2493
+ findNodeChildren(parentId: number): NativeChildNodeRow[];
2494
+ findNodesByFile(file: string): NativeNodeRow[];
2495
+ findFileNodes(fileLike: string): NativeNodeRow[];
2496
+ findNodesByScope(
2497
+ scopeName: string,
2498
+ kind: string | null | undefined,
2499
+ file: string | null | undefined,
2500
+ ): NativeNodeRow[];
2501
+ findNodeByQualifiedName(qualifiedName: string, file: string | null | undefined): NativeNodeRow[];
2502
+ findNodesWithFanIn(
2503
+ namePattern: string,
2504
+ kinds: string[] | null | undefined,
2505
+ file: string | null | undefined,
2506
+ ): NativeNodeRowWithFanIn[];
2507
+ findNodesForTriage(
2508
+ kind: string | null | undefined,
2509
+ role: string | null | undefined,
2510
+ file: string | null | undefined,
2511
+ noTests: boolean | null | undefined,
2512
+ ): NativeTriageNodeRow[];
2513
+ listFunctionNodes(
2514
+ file: string | null | undefined,
2515
+ pattern: string | null | undefined,
2516
+ noTests: boolean | null | undefined,
2517
+ ): NativeNodeRow[];
2518
+ iterateFunctionNodes(
2519
+ file: string | null | undefined,
2520
+ pattern: string | null | undefined,
2521
+ noTests: boolean | null | undefined,
2522
+ ): NativeNodeRow[];
2523
+
2524
+ // ── Edge queries (6.14) ──────────────────────────────────────────────
2525
+ findCallees(nodeId: number): NativeRelatedNodeRow[];
2526
+ findCallers(nodeId: number): NativeRelatedNodeRow[];
2527
+ findDistinctCallers(nodeId: number): NativeRelatedNodeRow[];
2528
+ findAllOutgoingEdges(nodeId: number): NativeAdjacentEdgeRow[];
2529
+ findAllIncomingEdges(nodeId: number): NativeAdjacentEdgeRow[];
2530
+ findCalleeNames(nodeId: number): string[];
2531
+ findCallerNames(nodeId: number): string[];
2532
+ findImportTargets(nodeId: number): NativeImportEdgeRow[];
2533
+ findImportSources(nodeId: number): NativeImportEdgeRow[];
2534
+ findImportDependents(nodeId: number): NativeNodeRow[];
2535
+ findCrossFileCallTargets(file: string): number[];
2536
+ countCrossFileCallers(nodeId: number, file: string): number;
2537
+ getClassHierarchy(classNodeId: number): number[];
2538
+ findImplementors(nodeId: number): NativeRelatedNodeRow[];
2539
+ findInterfaces(nodeId: number): NativeRelatedNodeRow[];
2540
+ findIntraFileCallEdges(file: string): NativeIntraFileCallEdge[];
2541
+
2542
+ // ── Graph-read queries (6.14) ────────────────────────────────────────
2543
+ getCallableNodes(): NativeCallableNodeRow[];
2544
+ getCallEdges(): NativeCallEdgeRow[];
2545
+ getFileNodesAll(): NativeFileNodeRow[];
2546
+ getImportEdges(): NativeImportGraphEdgeRow[];
2547
+
2548
+ // ── Table checks (6.14) ──────────────────────────────────────────────
2549
+ hasCfgTables(): boolean;
2550
+ hasEmbeddings(): boolean;
2551
+ hasDataflowTable(): boolean;
2552
+ hasImplementsEdges(): boolean;
2553
+ hasCoChangesTable(): boolean;
2554
+ getComplexityForNode(nodeId: number): NativeComplexityMetrics | null;
2555
+ getFileHash(file: string): string | null;
2556
+
2557
+ // ── Composite queries ──────────────────────────────────────────────
2558
+ fnDeps(
2559
+ name: string,
2560
+ depth: number | null | undefined,
2561
+ noTests: boolean | null | undefined,
2562
+ file: string | null | undefined,
2563
+ kind: string | null | undefined,
2564
+ ): NativeFnDepsResult;
2565
+
2566
+ // ── Build pipeline writes (6.15) ───────────────────────────────────
2567
+ bulkInsertNodes(
2568
+ batches: Array<{
2569
+ file: string;
2570
+ definitions: Array<{
2571
+ name: string;
2572
+ kind: string;
2573
+ line: number;
2574
+ endLine?: number;
2575
+ visibility?: string;
2576
+ children: Array<{
2577
+ name: string;
2578
+ kind: string;
2579
+ line: number;
2580
+ endLine?: number;
2581
+ visibility?: string;
2582
+ }>;
2583
+ }>;
2584
+ exports: Array<{ name: string; kind: string; line: number }>;
2585
+ }>,
2586
+ fileHashes: Array<{ file: string; hash: string; mtime: number; size: number }>,
2587
+ removedFiles: string[],
2588
+ ): boolean;
2589
+ bulkInsertEdges(
2590
+ edges: Array<{
2591
+ sourceId: number;
2592
+ targetId: number;
2593
+ kind: string;
2594
+ confidence: number;
2595
+ dynamic: number;
2596
+ }>,
2597
+ ): boolean;
2598
+ bulkInsertAstNodes(
2599
+ batches: Array<{
2600
+ file: string;
2601
+ nodes: Array<{
2602
+ line: number;
2603
+ kind: string;
2604
+ name: string;
2605
+ text?: string | null;
2606
+ receiver?: string | null;
2607
+ }>;
2608
+ }>,
2609
+ ): number;
2610
+ bulkInsertComplexity?(
2611
+ rows: Array<{
2612
+ nodeId: number;
2613
+ cognitive: number;
2614
+ cyclomatic: number;
2615
+ maxNesting: number;
2616
+ loc: number;
2617
+ sloc: number;
2618
+ commentLines: number;
2619
+ halsteadN1: number;
2620
+ halsteadN2: number;
2621
+ halsteadBigN1: number;
2622
+ halsteadBigN2: number;
2623
+ halsteadVocabulary: number;
2624
+ halsteadLength: number;
2625
+ halsteadVolume: number;
2626
+ halsteadDifficulty: number;
2627
+ halsteadEffort: number;
2628
+ halsteadBugs: number;
2629
+ maintainabilityIndex: number;
2630
+ }>,
2631
+ ): number;
2632
+ bulkInsertCfg?(
2633
+ entries: Array<{
2634
+ nodeId: number;
2635
+ blocks: Array<{
2636
+ index: number;
2637
+ blockType: string;
2638
+ startLine?: number | null;
2639
+ endLine?: number | null;
2640
+ label?: string | null;
2641
+ }>;
2642
+ edges: Array<{
2643
+ sourceIndex: number;
2644
+ targetIndex: number;
2645
+ kind: string;
2646
+ }>;
2647
+ }>,
2648
+ ): number;
2649
+ bulkInsertDataflow?(
2650
+ edges: Array<{
2651
+ sourceId: number;
2652
+ targetId: number;
2653
+ kind: string;
2654
+ paramIndex?: number;
2655
+ expression?: string | null;
2656
+ line?: number | null;
2657
+ confidence: number;
2658
+ }>,
2659
+ ): number;
2660
+ classifyRolesFull(): {
2661
+ entry: number;
2662
+ core: number;
2663
+ utility: number;
2664
+ adapter: number;
2665
+ dead: number;
2666
+ deadLeaf: number;
2667
+ deadEntry: number;
2668
+ deadFfi: number;
2669
+ deadUnresolved: number;
2670
+ testOnly: number;
2671
+ leaf: number;
2672
+ } | null;
2673
+ classifyRolesIncremental(changedFiles: string[]): {
2674
+ entry: number;
2675
+ core: number;
2676
+ utility: number;
2677
+ adapter: number;
2678
+ dead: number;
2679
+ deadLeaf: number;
2680
+ deadEntry: number;
2681
+ deadFfi: number;
2682
+ deadUnresolved: number;
2683
+ testOnly: number;
2684
+ leaf: number;
2685
+ } | null;
2686
+ purgeFilesData(files: string[], purgeHashes?: boolean, reverseDepFiles?: string[]): void;
2687
+
2688
+ // ── Batched query methods ────────────────────────────────────────────
2689
+ /** All graph statistics in a single napi call (replaces ~11 queries in module-map). */
2690
+ getGraphStats?(noTests: boolean): {
2691
+ totalNodes: number;
2692
+ totalEdges: number;
2693
+ nodesByKind: Array<{ kind: string; count: number }>;
2694
+ edgesByKind: Array<{ kind: string; count: number }>;
2695
+ roleCounts: Array<{ role: string; count: number }>;
2696
+ quality: {
2697
+ callableTotal: number;
2698
+ callableWithCallers: number;
2699
+ callEdges: number;
2700
+ highConfCallEdges: number;
2701
+ };
2702
+ hotspots: Array<{ file: string; fanIn: number; fanOut: number }>;
2703
+ complexity: {
2704
+ analyzed: number;
2705
+ avgCognitive: number;
2706
+ avgCyclomatic: number;
2707
+ maxCognitive: number;
2708
+ maxCyclomatic: number;
2709
+ avgMi: number;
2710
+ minMi: number;
2711
+ } | null;
2712
+ embeddings: {
2713
+ count: number;
2714
+ model: string | null;
2715
+ dim: number | null;
2716
+ builtAt: string | null;
2717
+ } | null;
2718
+ };
2719
+ /** All 6 directional dataflow edge sets for a node in one call. */
2720
+ getDataflowEdges?(nodeId: number): {
2721
+ flowsToOut: Array<{
2722
+ name: string;
2723
+ kind: string;
2724
+ file: string;
2725
+ line: number | null;
2726
+ paramIndex: number | null;
2727
+ expression: string | null;
2728
+ confidence: number | null;
2729
+ }>;
2730
+ flowsToIn: Array<{
2731
+ name: string;
2732
+ kind: string;
2733
+ file: string;
2734
+ line: number | null;
2735
+ paramIndex: number | null;
2736
+ expression: string | null;
2737
+ confidence: number | null;
2738
+ }>;
2739
+ returnsOut: Array<{
2740
+ name: string;
2741
+ kind: string;
2742
+ file: string;
2743
+ line: number | null;
2744
+ paramIndex: number | null;
2745
+ expression: string | null;
2746
+ confidence: number | null;
2747
+ }>;
2748
+ returnsIn: Array<{
2749
+ name: string;
2750
+ kind: string;
2751
+ file: string;
2752
+ line: number | null;
2753
+ paramIndex: number | null;
2754
+ expression: string | null;
2755
+ confidence: number | null;
2756
+ }>;
2757
+ mutatesOut: Array<{
2758
+ name: string;
2759
+ kind: string;
2760
+ file: string;
2761
+ line: number | null;
2762
+ paramIndex: number | null;
2763
+ expression: string | null;
2764
+ confidence: number | null;
2765
+ }>;
2766
+ mutatesIn: Array<{
2767
+ name: string;
2768
+ kind: string;
2769
+ file: string;
2770
+ line: number | null;
2771
+ paramIndex: number | null;
2772
+ expression: string | null;
2773
+ confidence: number | null;
2774
+ }>;
2775
+ };
2776
+ /** Hotspot rows for a metric/kind/limit in one call. */
2777
+ getHotspots?(
2778
+ kind: string,
2779
+ metric: string,
2780
+ noTests: boolean,
2781
+ limit: number,
2782
+ ): Array<{
2783
+ name: string;
2784
+ kind: string;
2785
+ lineCount: number | null;
2786
+ symbolCount: number | null;
2787
+ importCount: number | null;
2788
+ exportCount: number | null;
2789
+ fanIn: number | null;
2790
+ fanOut: number | null;
2791
+ cohesion: number | null;
2792
+ fileCount: number | null;
2793
+ }>;
2794
+ /** Batch fan-in/fan-out for multiple node IDs in one call. */
2795
+ batchFanMetrics?(nodeIds: number[]): Array<{
2796
+ nodeId: number;
2797
+ fanIn: number;
2798
+ fanOut: number;
2799
+ }>;
2800
+
2801
+ // ── Batched build-glue queries (6.18) ────────────────────────────────
2802
+ /** All file_hashes rows + table existence + max mtime in one call. */
2803
+ getFileHashData?(): {
2804
+ exists: boolean;
2805
+ rows: Array<{ file: string; hash: string; mtime: number; size: number }>;
2806
+ maxMtime: number;
2807
+ };
2808
+ /** CFG and dataflow table counts (-1 = table missing). */
2809
+ checkPendingAnalysis?(): { cfgCount: number; dataflowCount: number };
2810
+ /** Batch upsert file_hashes for metadata healing. */
2811
+ healFileMetadata?(
2812
+ entries: Array<{ file: string; hash: string; mtime: number; size: number }>,
2813
+ ): number;
2814
+ /** Find files with edges pointing to changed files. */
2815
+ findReverseDependencies?(changedFiles: string[]): string[];
2816
+ /** Node + edge counts in one call. */
2817
+ getFinalizeCounts?(): { nodeCount: number; edgeCount: number };
2818
+ /** Orphaned embeddings, stale embeddings, unused exports in one call. */
2819
+ runAdvisoryChecks?(hasEmbeddings: boolean): {
2820
+ orphanedEmbeddings: number;
2821
+ embedBuiltAt: string | null;
2822
+ unusedExports: number;
2823
+ };
2824
+ /** File_hashes count + all file paths in one call. */
2825
+ getCollectFilesData?(): { count: number; files: string[] };
2826
+
2827
+ // ── Generic query execution & version validation (6.16) ─────────────
2828
+ /** Execute a parameterized SELECT and return all rows as objects. */
2829
+ queryAll(sql: string, params: Array<string | number | null>): Record<string, unknown>[];
2830
+ /** Execute a parameterized SELECT and return the first row, or null. */
2831
+ queryGet(sql: string, params: Array<string | number | null>): Record<string, unknown> | null;
2832
+ /** Validate DB codegraph_version matches expected. Warns on mismatch. */
2833
+ validateSchemaVersion(expectedVersion: string): boolean;
2834
+
2835
+ // ── Full Rust build orchestration (#695) ─────────────────────────────
2836
+ /**
2837
+ * Run the entire build pipeline in Rust with zero napi boundary crossings.
2838
+ * Returns a JSON string with timing and build result data.
2839
+ * When unavailable, the JS pipeline (runPipelineStages) is used as fallback.
2840
+ */
2841
+ buildGraph?(rootDir: string, configJson: string, aliasesJson: string, optsJson: string): string;
2842
+ }
2843
+
2844
+ // ════════════════════════════════════════════════════════════════════════
2845
+ // §14 CLI Command Framework
2846
+ // ════════════════════════════════════════════════════════════════════════
2847
+
2848
+ /** Shared context passed to every CLI command's execute/validate functions. */
2849
+ export interface CommandContext {
2850
+ config: Record<string, any>;
2851
+ resolveNoTests: (opts: any) => boolean;
2852
+ resolveQueryOpts: (opts: any) => any;
2853
+ formatSize: (bytes: number) => string;
2854
+ outputResult: (data: any, key: string, opts: any) => boolean;
2855
+ program: import('commander').Command;
2856
+ }
2857
+
2858
+ /** Shape of a CLI command definition used by the registerCommand framework. */
2859
+ export interface CommandDefinition {
2860
+ name: string;
2861
+ description: string;
2862
+ queryOpts?: boolean;
2863
+ options?: Array<
2864
+ | [string, string]
2865
+ | [string, string, string | boolean | number]
2866
+ | [string, string, (val: string) => any, string | boolean | number]
2867
+ >;
2868
+ validate?: (args: any[], opts: any, ctx: CommandContext) => string | undefined;
2869
+ execute?: (args: any[], opts: any, ctx: CommandContext) => void | Promise<void>;
2870
+ subcommands?: CommandDefinition[];
2871
+ }