@optave/codegraph 3.4.0 → 3.5.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 (453) hide show
  1. package/README.md +23 -22
  2. package/dist/ast-analysis/engine.d.ts.map +1 -1
  3. package/dist/ast-analysis/engine.js +3 -9
  4. package/dist/ast-analysis/engine.js.map +1 -1
  5. package/dist/ast-analysis/rules/javascript.d.ts.map +1 -1
  6. package/dist/ast-analysis/rules/javascript.js +1 -0
  7. package/dist/ast-analysis/rules/javascript.js.map +1 -1
  8. package/dist/ast-analysis/shared.d.ts.map +1 -1
  9. package/dist/ast-analysis/shared.js +0 -1
  10. package/dist/ast-analysis/shared.js.map +1 -1
  11. package/dist/ast-analysis/visitors/ast-store-visitor.d.ts.map +1 -1
  12. package/dist/ast-analysis/visitors/ast-store-visitor.js +103 -35
  13. package/dist/ast-analysis/visitors/ast-store-visitor.js.map +1 -1
  14. package/dist/ast-analysis/visitors/cfg-conditionals.d.ts +5 -0
  15. package/dist/ast-analysis/visitors/cfg-conditionals.d.ts.map +1 -0
  16. package/dist/ast-analysis/visitors/cfg-conditionals.js +166 -0
  17. package/dist/ast-analysis/visitors/cfg-conditionals.js.map +1 -0
  18. package/dist/ast-analysis/visitors/cfg-loops.d.ts +7 -0
  19. package/dist/ast-analysis/visitors/cfg-loops.d.ts.map +1 -0
  20. package/dist/ast-analysis/visitors/cfg-loops.js +73 -0
  21. package/dist/ast-analysis/visitors/cfg-loops.js.map +1 -0
  22. package/dist/ast-analysis/visitors/cfg-shared.d.ts +56 -0
  23. package/dist/ast-analysis/visitors/cfg-shared.d.ts.map +1 -0
  24. package/dist/ast-analysis/visitors/cfg-shared.js +107 -0
  25. package/dist/ast-analysis/visitors/cfg-shared.js.map +1 -0
  26. package/dist/ast-analysis/visitors/cfg-try-catch.d.ts +4 -0
  27. package/dist/ast-analysis/visitors/cfg-try-catch.d.ts.map +1 -0
  28. package/dist/ast-analysis/visitors/cfg-try-catch.js +100 -0
  29. package/dist/ast-analysis/visitors/cfg-try-catch.js.map +1 -0
  30. package/dist/ast-analysis/visitors/cfg-visitor.d.ts +2 -2
  31. package/dist/ast-analysis/visitors/cfg-visitor.d.ts.map +1 -1
  32. package/dist/ast-analysis/visitors/cfg-visitor.js +11 -445
  33. package/dist/ast-analysis/visitors/cfg-visitor.js.map +1 -1
  34. package/dist/ast-analysis/visitors/complexity-visitor.d.ts.map +1 -1
  35. package/dist/ast-analysis/visitors/complexity-visitor.js.map +1 -1
  36. package/dist/ast-analysis/visitors/dataflow-visitor.d.ts.map +1 -1
  37. package/dist/ast-analysis/visitors/dataflow-visitor.js.map +1 -1
  38. package/dist/cli/commands/batch.d.ts.map +1 -1
  39. package/dist/cli/commands/batch.js +4 -3
  40. package/dist/cli/commands/batch.js.map +1 -1
  41. package/dist/cli/commands/branch-compare.js +1 -1
  42. package/dist/cli/commands/branch-compare.js.map +1 -1
  43. package/dist/cli/commands/build.js +1 -1
  44. package/dist/cli/commands/build.js.map +1 -1
  45. package/dist/cli/commands/info.d.ts.map +1 -1
  46. package/dist/cli/commands/info.js +1 -2
  47. package/dist/cli/commands/info.js.map +1 -1
  48. package/dist/cli/commands/path.d.ts.map +1 -1
  49. package/dist/cli/commands/path.js +7 -2
  50. package/dist/cli/commands/path.js.map +1 -1
  51. package/dist/cli/commands/plot.d.ts.map +1 -1
  52. package/dist/cli/commands/plot.js +2 -2
  53. package/dist/cli/commands/plot.js.map +1 -1
  54. package/dist/cli/commands/watch.js +1 -1
  55. package/dist/cli/commands/watch.js.map +1 -1
  56. package/dist/cli/index.js +2 -2
  57. package/dist/cli/index.js.map +1 -1
  58. package/dist/cli/shared/open-graph.d.ts +2 -2
  59. package/dist/cli/shared/open-graph.d.ts.map +1 -1
  60. package/dist/cli/shared/open-graph.js.map +1 -1
  61. package/dist/cli/types.d.ts +1 -1
  62. package/dist/cli/types.d.ts.map +1 -1
  63. package/dist/cli.js +2 -3
  64. package/dist/cli.js.map +1 -1
  65. package/dist/db/better-sqlite3.d.ts +3 -0
  66. package/dist/db/better-sqlite3.d.ts.map +1 -0
  67. package/dist/db/better-sqlite3.js +19 -0
  68. package/dist/db/better-sqlite3.js.map +1 -0
  69. package/dist/db/connection.d.ts +30 -2
  70. package/dist/db/connection.d.ts.map +1 -1
  71. package/dist/db/connection.js +167 -4
  72. package/dist/db/connection.js.map +1 -1
  73. package/dist/db/index.d.ts +2 -2
  74. package/dist/db/index.d.ts.map +1 -1
  75. package/dist/db/index.js +1 -1
  76. package/dist/db/index.js.map +1 -1
  77. package/dist/db/migrations.d.ts.map +1 -1
  78. package/dist/db/migrations.js +9 -0
  79. package/dist/db/migrations.js.map +1 -1
  80. package/dist/db/query-builder.d.ts +5 -5
  81. package/dist/db/query-builder.d.ts.map +1 -1
  82. package/dist/db/query-builder.js +20 -4
  83. package/dist/db/query-builder.js.map +1 -1
  84. package/dist/db/repository/index.d.ts +1 -0
  85. package/dist/db/repository/index.d.ts.map +1 -1
  86. package/dist/db/repository/index.js +1 -0
  87. package/dist/db/repository/index.js.map +1 -1
  88. package/dist/db/repository/native-repository.d.ts +58 -0
  89. package/dist/db/repository/native-repository.d.ts.map +1 -0
  90. package/dist/db/repository/native-repository.js +261 -0
  91. package/dist/db/repository/native-repository.js.map +1 -0
  92. package/dist/db/repository/nodes.d.ts +4 -4
  93. package/dist/db/repository/nodes.d.ts.map +1 -1
  94. package/dist/db/repository/nodes.js +6 -6
  95. package/dist/db/repository/nodes.js.map +1 -1
  96. package/dist/domain/analysis/brief.d.ts.map +1 -1
  97. package/dist/domain/analysis/brief.js +1 -3
  98. package/dist/domain/analysis/brief.js.map +1 -1
  99. package/dist/domain/analysis/context.d.ts.map +1 -1
  100. package/dist/domain/analysis/context.js +2 -4
  101. package/dist/domain/analysis/context.js.map +1 -1
  102. package/dist/domain/analysis/dependencies.d.ts +49 -0
  103. package/dist/domain/analysis/dependencies.d.ts.map +1 -1
  104. package/dist/domain/analysis/dependencies.js +145 -0
  105. package/dist/domain/analysis/dependencies.js.map +1 -1
  106. package/dist/domain/analysis/diff-impact.d.ts +76 -0
  107. package/dist/domain/analysis/diff-impact.d.ts.map +1 -0
  108. package/dist/domain/analysis/diff-impact.js +282 -0
  109. package/dist/domain/analysis/diff-impact.js.map +1 -0
  110. package/dist/domain/analysis/exports.d.ts.map +1 -1
  111. package/dist/domain/analysis/exports.js +0 -1
  112. package/dist/domain/analysis/exports.js.map +1 -1
  113. package/dist/domain/analysis/fn-impact.d.ts +66 -0
  114. package/dist/domain/analysis/fn-impact.d.ts.map +1 -0
  115. package/dist/domain/analysis/fn-impact.js +189 -0
  116. package/dist/domain/analysis/fn-impact.js.map +1 -0
  117. package/dist/domain/analysis/impact.d.ts +8 -148
  118. package/dist/domain/analysis/impact.d.ts.map +1 -1
  119. package/dist/domain/analysis/impact.js +8 -568
  120. package/dist/domain/analysis/impact.js.map +1 -1
  121. package/dist/domain/analysis/module-map.d.ts.map +1 -1
  122. package/dist/domain/analysis/module-map.js +1 -3
  123. package/dist/domain/analysis/module-map.js.map +1 -1
  124. package/dist/domain/graph/builder/context.d.ts +3 -3
  125. package/dist/domain/graph/builder/context.d.ts.map +1 -1
  126. package/dist/domain/graph/builder/context.js +1 -0
  127. package/dist/domain/graph/builder/context.js.map +1 -1
  128. package/dist/domain/graph/builder/helpers.d.ts +4 -5
  129. package/dist/domain/graph/builder/helpers.d.ts.map +1 -1
  130. package/dist/domain/graph/builder/helpers.js +1 -2
  131. package/dist/domain/graph/builder/helpers.js.map +1 -1
  132. package/dist/domain/graph/builder/incremental.d.ts +2 -3
  133. package/dist/domain/graph/builder/incremental.d.ts.map +1 -1
  134. package/dist/domain/graph/builder/incremental.js.map +1 -1
  135. package/dist/domain/graph/builder/pipeline.d.ts.map +1 -1
  136. package/dist/domain/graph/builder/pipeline.js +34 -6
  137. package/dist/domain/graph/builder/pipeline.js.map +1 -1
  138. package/dist/domain/graph/builder/stages/build-edges.d.ts.map +1 -1
  139. package/dist/domain/graph/builder/stages/build-edges.js +113 -15
  140. package/dist/domain/graph/builder/stages/build-edges.js.map +1 -1
  141. package/dist/domain/graph/builder/stages/build-structure.d.ts.map +1 -1
  142. package/dist/domain/graph/builder/stages/build-structure.js +186 -62
  143. package/dist/domain/graph/builder/stages/build-structure.js.map +1 -1
  144. package/dist/domain/graph/builder/stages/collect-files.d.ts.map +1 -1
  145. package/dist/domain/graph/builder/stages/collect-files.js +71 -7
  146. package/dist/domain/graph/builder/stages/collect-files.js.map +1 -1
  147. package/dist/domain/graph/builder/stages/detect-changes.d.ts.map +1 -1
  148. package/dist/domain/graph/builder/stages/detect-changes.js +42 -20
  149. package/dist/domain/graph/builder/stages/detect-changes.js.map +1 -1
  150. package/dist/domain/graph/builder/stages/finalize.d.ts.map +1 -1
  151. package/dist/domain/graph/builder/stages/finalize.js +111 -64
  152. package/dist/domain/graph/builder/stages/finalize.js.map +1 -1
  153. package/dist/domain/graph/builder/stages/insert-nodes.d.ts.map +1 -1
  154. package/dist/domain/graph/builder/stages/insert-nodes.js +104 -9
  155. package/dist/domain/graph/builder/stages/insert-nodes.js.map +1 -1
  156. package/dist/domain/graph/builder/stages/resolve-imports.d.ts.map +1 -1
  157. package/dist/domain/graph/builder/stages/resolve-imports.js +58 -11
  158. package/dist/domain/graph/builder/stages/resolve-imports.js.map +1 -1
  159. package/dist/domain/graph/cycles.js +2 -2
  160. package/dist/domain/graph/cycles.js.map +1 -1
  161. package/dist/domain/graph/resolve.d.ts.map +1 -1
  162. package/dist/domain/graph/resolve.js +10 -8
  163. package/dist/domain/graph/resolve.js.map +1 -1
  164. package/dist/domain/graph/watcher.d.ts.map +1 -1
  165. package/dist/domain/graph/watcher.js +1 -3
  166. package/dist/domain/graph/watcher.js.map +1 -1
  167. package/dist/domain/parser.d.ts.map +1 -1
  168. package/dist/domain/parser.js +12 -12
  169. package/dist/domain/parser.js.map +1 -1
  170. package/dist/domain/queries.d.ts +3 -2
  171. package/dist/domain/queries.d.ts.map +1 -1
  172. package/dist/domain/queries.js +3 -2
  173. package/dist/domain/queries.js.map +1 -1
  174. package/dist/domain/search/generator.d.ts.map +1 -1
  175. package/dist/domain/search/generator.js.map +1 -1
  176. package/dist/extractors/csharp.js +2 -2
  177. package/dist/extractors/csharp.js.map +1 -1
  178. package/dist/extractors/go.js +2 -2
  179. package/dist/extractors/go.js.map +1 -1
  180. package/dist/extractors/helpers.d.ts +5 -0
  181. package/dist/extractors/helpers.d.ts.map +1 -1
  182. package/dist/extractors/helpers.js +5 -0
  183. package/dist/extractors/helpers.js.map +1 -1
  184. package/dist/extractors/javascript.js +111 -98
  185. package/dist/extractors/javascript.js.map +1 -1
  186. package/dist/extractors/php.js +2 -2
  187. package/dist/extractors/php.js.map +1 -1
  188. package/dist/extractors/python.js +2 -2
  189. package/dist/extractors/python.js.map +1 -1
  190. package/dist/extractors/rust.js +4 -3
  191. package/dist/extractors/rust.js.map +1 -1
  192. package/dist/features/ast.d.ts +14 -1
  193. package/dist/features/ast.d.ts.map +1 -1
  194. package/dist/features/ast.js +38 -1
  195. package/dist/features/ast.js.map +1 -1
  196. package/dist/features/audit.d.ts.map +1 -1
  197. package/dist/features/audit.js +1 -2
  198. package/dist/features/audit.js.map +1 -1
  199. package/dist/features/branch-compare.d.ts.map +1 -1
  200. package/dist/features/branch-compare.js +5 -4
  201. package/dist/features/branch-compare.js.map +1 -1
  202. package/dist/features/cfg.d.ts.map +1 -1
  203. package/dist/features/cfg.js +2 -4
  204. package/dist/features/cfg.js.map +1 -1
  205. package/dist/features/cochange.js +4 -4
  206. package/dist/features/cochange.js.map +1 -1
  207. package/dist/features/communities.js +4 -4
  208. package/dist/features/communities.js.map +1 -1
  209. package/dist/features/complexity-query.d.ts +37 -0
  210. package/dist/features/complexity-query.d.ts.map +1 -0
  211. package/dist/features/complexity-query.js +263 -0
  212. package/dist/features/complexity-query.js.map +1 -0
  213. package/dist/features/complexity.d.ts +2 -30
  214. package/dist/features/complexity.d.ts.map +1 -1
  215. package/dist/features/complexity.js +7 -261
  216. package/dist/features/complexity.js.map +1 -1
  217. package/dist/features/dataflow.d.ts.map +1 -1
  218. package/dist/features/dataflow.js +8 -24
  219. package/dist/features/dataflow.js.map +1 -1
  220. package/dist/features/export.d.ts +7 -8
  221. package/dist/features/export.d.ts.map +1 -1
  222. package/dist/features/export.js.map +1 -1
  223. package/dist/features/flow.d.ts.map +1 -1
  224. package/dist/features/flow.js.map +1 -1
  225. package/dist/features/graph-enrichment.d.ts.map +1 -1
  226. package/dist/features/graph-enrichment.js +1 -3
  227. package/dist/features/graph-enrichment.js.map +1 -1
  228. package/dist/features/manifesto.js +8 -8
  229. package/dist/features/manifesto.js.map +1 -1
  230. package/dist/features/snapshot.js +2 -2
  231. package/dist/features/snapshot.js.map +1 -1
  232. package/dist/features/structure-query.d.ts +76 -0
  233. package/dist/features/structure-query.d.ts.map +1 -0
  234. package/dist/features/structure-query.js +245 -0
  235. package/dist/features/structure-query.js.map +1 -0
  236. package/dist/features/structure.d.ts +12 -67
  237. package/dist/features/structure.d.ts.map +1 -1
  238. package/dist/features/structure.js +188 -244
  239. package/dist/features/structure.js.map +1 -1
  240. package/dist/features/triage.js +2 -2
  241. package/dist/features/triage.js.map +1 -1
  242. package/dist/graph/algorithms/leiden/adapter.d.ts.map +1 -1
  243. package/dist/graph/algorithms/leiden/adapter.js +2 -9
  244. package/dist/graph/algorithms/leiden/adapter.js.map +1 -1
  245. package/dist/graph/classifiers/roles.d.ts +5 -1
  246. package/dist/graph/classifiers/roles.d.ts.map +1 -1
  247. package/dist/graph/classifiers/roles.js +20 -12
  248. package/dist/graph/classifiers/roles.js.map +1 -1
  249. package/dist/index.d.ts +1 -0
  250. package/dist/index.d.ts.map +1 -1
  251. package/dist/index.js.map +1 -1
  252. package/dist/infrastructure/config.d.ts.map +1 -1
  253. package/dist/infrastructure/config.js +12 -11
  254. package/dist/infrastructure/config.js.map +1 -1
  255. package/dist/infrastructure/native.d.ts.map +1 -1
  256. package/dist/infrastructure/native.js +7 -3
  257. package/dist/infrastructure/native.js.map +1 -1
  258. package/dist/infrastructure/registry.d.ts.map +1 -1
  259. package/dist/infrastructure/registry.js +1 -1
  260. package/dist/infrastructure/registry.js.map +1 -1
  261. package/dist/infrastructure/update-check.js +3 -3
  262. package/dist/infrastructure/update-check.js.map +1 -1
  263. package/dist/mcp/server.d.ts.map +1 -1
  264. package/dist/mcp/server.js +4 -17
  265. package/dist/mcp/server.js.map +1 -1
  266. package/dist/mcp/tool-registry.d.ts.map +1 -1
  267. package/dist/mcp/tool-registry.js +9 -4
  268. package/dist/mcp/tool-registry.js.map +1 -1
  269. package/dist/mcp/tools/audit.js +1 -1
  270. package/dist/mcp/tools/audit.js.map +1 -1
  271. package/dist/mcp/tools/cfg.js +1 -1
  272. package/dist/mcp/tools/cfg.js.map +1 -1
  273. package/dist/mcp/tools/check.js +2 -2
  274. package/dist/mcp/tools/check.js.map +1 -1
  275. package/dist/mcp/tools/dataflow.js +2 -2
  276. package/dist/mcp/tools/dataflow.js.map +1 -1
  277. package/dist/mcp/tools/export-graph.js +1 -1
  278. package/dist/mcp/tools/export-graph.js.map +1 -1
  279. package/dist/mcp/tools/index.d.ts.map +1 -1
  280. package/dist/mcp/tools/index.js.map +1 -1
  281. package/dist/mcp/tools/path.d.ts +1 -0
  282. package/dist/mcp/tools/path.d.ts.map +1 -1
  283. package/dist/mcp/tools/path.js +9 -0
  284. package/dist/mcp/tools/path.js.map +1 -1
  285. package/dist/mcp/tools/query.js +1 -1
  286. package/dist/mcp/tools/query.js.map +1 -1
  287. package/dist/mcp/tools/semantic-search.js +1 -1
  288. package/dist/mcp/tools/semantic-search.js.map +1 -1
  289. package/dist/mcp/tools/sequence.js +1 -1
  290. package/dist/mcp/tools/sequence.js.map +1 -1
  291. package/dist/mcp/tools/symbol-children.js +1 -1
  292. package/dist/mcp/tools/symbol-children.js.map +1 -1
  293. package/dist/mcp/tools/triage.js +1 -1
  294. package/dist/mcp/tools/triage.js.map +1 -1
  295. package/dist/presentation/audit.d.ts.map +1 -1
  296. package/dist/presentation/audit.js +0 -1
  297. package/dist/presentation/audit.js.map +1 -1
  298. package/dist/presentation/diff-impact-mermaid.d.ts +11 -0
  299. package/dist/presentation/diff-impact-mermaid.d.ts.map +1 -0
  300. package/dist/presentation/diff-impact-mermaid.js +105 -0
  301. package/dist/presentation/diff-impact-mermaid.js.map +1 -0
  302. package/dist/presentation/flow.d.ts.map +1 -1
  303. package/dist/presentation/flow.js +0 -2
  304. package/dist/presentation/flow.js.map +1 -1
  305. package/dist/presentation/manifesto.d.ts.map +1 -1
  306. package/dist/presentation/manifesto.js +0 -1
  307. package/dist/presentation/manifesto.js.map +1 -1
  308. package/dist/presentation/queries-cli/inspect.d.ts.map +1 -1
  309. package/dist/presentation/queries-cli/inspect.js.map +1 -1
  310. package/dist/presentation/queries-cli/path.d.ts.map +1 -1
  311. package/dist/presentation/queries-cli/path.js +45 -1
  312. package/dist/presentation/queries-cli/path.js.map +1 -1
  313. package/dist/presentation/result-formatter.d.ts.map +1 -1
  314. package/dist/presentation/result-formatter.js +1 -3
  315. package/dist/presentation/result-formatter.js.map +1 -1
  316. package/dist/presentation/sequence.d.ts.map +1 -1
  317. package/dist/presentation/sequence.js +0 -1
  318. package/dist/presentation/sequence.js.map +1 -1
  319. package/dist/presentation/structure.d.ts.map +1 -1
  320. package/dist/presentation/structure.js.map +1 -1
  321. package/dist/presentation/triage.d.ts.map +1 -1
  322. package/dist/presentation/triage.js +0 -1
  323. package/dist/presentation/triage.js.map +1 -1
  324. package/dist/shared/constants.d.ts +9 -3
  325. package/dist/shared/constants.d.ts.map +1 -1
  326. package/dist/shared/constants.js +6 -3
  327. package/dist/shared/constants.js.map +1 -1
  328. package/dist/shared/errors.d.ts +2 -0
  329. package/dist/shared/errors.d.ts.map +1 -1
  330. package/dist/shared/errors.js +4 -0
  331. package/dist/shared/errors.js.map +1 -1
  332. package/dist/shared/version.d.ts +2 -0
  333. package/dist/shared/version.d.ts.map +1 -0
  334. package/dist/shared/version.js +5 -0
  335. package/dist/shared/version.js.map +1 -0
  336. package/dist/types.d.ts +230 -2
  337. package/dist/types.d.ts.map +1 -1
  338. package/package.json +62 -11
  339. package/src/ast-analysis/engine.ts +3 -9
  340. package/src/ast-analysis/rules/javascript.ts +1 -0
  341. package/src/ast-analysis/shared.ts +0 -1
  342. package/src/ast-analysis/visitors/ast-store-visitor.ts +102 -33
  343. package/src/ast-analysis/visitors/cfg-conditionals.ts +227 -0
  344. package/src/ast-analysis/visitors/cfg-loops.ts +136 -0
  345. package/src/ast-analysis/visitors/cfg-shared.ts +196 -0
  346. package/src/ast-analysis/visitors/cfg-try-catch.ts +142 -0
  347. package/src/ast-analysis/visitors/cfg-visitor.ts +34 -655
  348. package/src/ast-analysis/visitors/complexity-visitor.ts +0 -1
  349. package/src/ast-analysis/visitors/dataflow-visitor.ts +0 -1
  350. package/src/cli/commands/batch.ts +4 -3
  351. package/src/cli/commands/branch-compare.ts +1 -1
  352. package/src/cli/commands/build.ts +1 -1
  353. package/src/cli/commands/info.ts +1 -2
  354. package/src/cli/commands/path.ts +7 -2
  355. package/src/cli/commands/plot.ts +2 -2
  356. package/src/cli/commands/watch.ts +1 -1
  357. package/src/cli/index.ts +2 -2
  358. package/src/cli/shared/open-graph.ts +2 -2
  359. package/src/cli/types.ts +1 -1
  360. package/src/cli.ts +2 -3
  361. package/src/db/better-sqlite3.ts +20 -0
  362. package/src/db/connection.ts +191 -16
  363. package/src/db/index.ts +5 -1
  364. package/src/db/migrations.ts +9 -0
  365. package/src/db/query-builder.ts +30 -5
  366. package/src/db/repository/index.ts +1 -0
  367. package/src/db/repository/native-repository.ts +361 -0
  368. package/src/db/repository/nodes.ts +7 -3
  369. package/src/domain/analysis/brief.ts +0 -1
  370. package/src/domain/analysis/context.ts +2 -6
  371. package/src/domain/analysis/dependencies.ts +165 -0
  372. package/src/domain/analysis/diff-impact.ts +354 -0
  373. package/src/domain/analysis/exports.ts +0 -2
  374. package/src/domain/analysis/fn-impact.ts +241 -0
  375. package/src/domain/analysis/impact.ts +8 -718
  376. package/src/domain/analysis/module-map.ts +1 -5
  377. package/src/domain/graph/builder/context.ts +4 -2
  378. package/src/domain/graph/builder/helpers.ts +14 -11
  379. package/src/domain/graph/builder/incremental.ts +33 -28
  380. package/src/domain/graph/builder/pipeline.ts +37 -5
  381. package/src/domain/graph/builder/stages/build-edges.ts +131 -20
  382. package/src/domain/graph/builder/stages/build-structure.ts +245 -80
  383. package/src/domain/graph/builder/stages/collect-files.ts +84 -7
  384. package/src/domain/graph/builder/stages/detect-changes.ts +49 -32
  385. package/src/domain/graph/builder/stages/finalize.ts +132 -84
  386. package/src/domain/graph/builder/stages/insert-nodes.ts +141 -18
  387. package/src/domain/graph/builder/stages/resolve-imports.ts +75 -10
  388. package/src/domain/graph/cycles.ts +2 -2
  389. package/src/domain/graph/resolve.ts +14 -8
  390. package/src/domain/graph/watcher.ts +2 -4
  391. package/src/domain/parser.ts +12 -13
  392. package/src/domain/queries.ts +2 -2
  393. package/src/domain/search/generator.ts +3 -4
  394. package/src/extractors/csharp.ts +2 -2
  395. package/src/extractors/go.ts +2 -2
  396. package/src/extractors/helpers.ts +6 -0
  397. package/src/extractors/javascript.ts +112 -97
  398. package/src/extractors/php.ts +2 -2
  399. package/src/extractors/python.ts +2 -2
  400. package/src/extractors/rust.ts +4 -3
  401. package/src/features/ast.ts +66 -1
  402. package/src/features/audit.ts +1 -2
  403. package/src/features/branch-compare.ts +6 -10
  404. package/src/features/cfg.ts +2 -4
  405. package/src/features/cochange.ts +4 -4
  406. package/src/features/communities.ts +4 -4
  407. package/src/features/complexity-query.ts +370 -0
  408. package/src/features/complexity.ts +6 -365
  409. package/src/features/dataflow.ts +48 -70
  410. package/src/features/export.ts +12 -16
  411. package/src/features/flow.ts +0 -1
  412. package/src/features/graph-enrichment.ts +1 -3
  413. package/src/features/manifesto.ts +8 -8
  414. package/src/features/snapshot.ts +3 -3
  415. package/src/features/structure-query.ts +387 -0
  416. package/src/features/structure.ts +231 -376
  417. package/src/features/triage.ts +2 -2
  418. package/src/graph/algorithms/leiden/adapter.ts +2 -9
  419. package/src/graph/classifiers/roles.ts +22 -13
  420. package/src/index.ts +1 -0
  421. package/src/infrastructure/config.ts +12 -13
  422. package/src/infrastructure/native.ts +7 -3
  423. package/src/infrastructure/registry.ts +1 -1
  424. package/src/infrastructure/update-check.ts +3 -3
  425. package/src/mcp/server.ts +4 -20
  426. package/src/mcp/tool-registry.ts +11 -4
  427. package/src/mcp/tools/audit.ts +1 -1
  428. package/src/mcp/tools/cfg.ts +1 -1
  429. package/src/mcp/tools/check.ts +2 -2
  430. package/src/mcp/tools/dataflow.ts +2 -2
  431. package/src/mcp/tools/export-graph.ts +1 -1
  432. package/src/mcp/tools/index.ts +0 -1
  433. package/src/mcp/tools/path.ts +10 -0
  434. package/src/mcp/tools/query.ts +1 -1
  435. package/src/mcp/tools/semantic-search.ts +1 -1
  436. package/src/mcp/tools/sequence.ts +1 -1
  437. package/src/mcp/tools/symbol-children.ts +1 -1
  438. package/src/mcp/tools/triage.ts +1 -1
  439. package/src/presentation/audit.ts +0 -1
  440. package/src/presentation/diff-impact-mermaid.ts +127 -0
  441. package/src/presentation/flow.ts +0 -2
  442. package/src/presentation/manifesto.ts +0 -1
  443. package/src/presentation/queries-cli/inspect.ts +0 -1
  444. package/src/presentation/queries-cli/path.ts +71 -1
  445. package/src/presentation/result-formatter.ts +0 -1
  446. package/src/presentation/sequence.ts +0 -1
  447. package/src/presentation/structure.ts +0 -12
  448. package/src/presentation/triage.ts +0 -1
  449. package/src/shared/constants.ts +33 -19
  450. package/src/shared/errors.ts +5 -0
  451. package/src/shared/version.ts +10 -0
  452. package/src/types.ts +277 -10
  453. package/src/vendor.d.ts +0 -39
@@ -1,4 +1,4 @@
1
- import { kindIcon, pathData } from '../../domain/queries.js';
1
+ import { filePathData, kindIcon, pathData } from '../../domain/queries.js';
2
2
  import { outputResult } from '../../infrastructure/result-formatter.js';
3
3
 
4
4
  interface PathCandidate {
@@ -80,6 +80,11 @@ export function symbolPath(
80
80
  customDbPath: string,
81
81
  opts: PathOpts = {},
82
82
  ): void {
83
+ if (opts.file) {
84
+ filePath(from, to, customDbPath, opts);
85
+ return;
86
+ }
87
+
83
88
  const data = pathData(from, to, customDbPath, opts) as PathDataResult;
84
89
  if (outputResult(data as unknown as Record<string, unknown>, null, opts)) return;
85
90
 
@@ -107,3 +112,68 @@ export function symbolPath(
107
112
  printPathSteps(data);
108
113
  console.log();
109
114
  }
115
+
116
+ // ── File-level path ──────────────────────────────────────────────────────
117
+
118
+ interface FilePathDataResult {
119
+ error?: string;
120
+ found?: boolean;
121
+ hops?: number | null;
122
+ reverse?: boolean;
123
+ maxDepth?: number;
124
+ path: string[];
125
+ fromCandidates: string[];
126
+ toCandidates: string[];
127
+ alternateCount: number;
128
+ }
129
+
130
+ function filePath(from: string, to: string, customDbPath: string, opts: PathOpts = {}): void {
131
+ const data = filePathData(from, to, customDbPath, opts) as FilePathDataResult;
132
+ if (outputResult(data as unknown as Record<string, unknown>, null, opts)) return;
133
+
134
+ if (data.error) {
135
+ console.log(data.error);
136
+ return;
137
+ }
138
+
139
+ if (!data.found) {
140
+ const dir = data.reverse ? 'reverse ' : '';
141
+ console.log(`No ${dir}file path from "${from}" to "${to}" within ${data.maxDepth} hops.`);
142
+ if (data.fromCandidates.length > 1) {
143
+ console.log(
144
+ `\n "${from}" matched ${data.fromCandidates.length} files — using: ${data.fromCandidates[0]}`,
145
+ );
146
+ }
147
+ if (data.toCandidates.length > 1) {
148
+ console.log(
149
+ ` "${to}" matched ${data.toCandidates.length} files — using: ${data.toCandidates[0]}`,
150
+ );
151
+ }
152
+ return;
153
+ }
154
+
155
+ if (data.hops === 0) {
156
+ console.log(`\n"${from}" and "${to}" resolve to the same file (0 hops):`);
157
+ console.log(` ${data.path[0]}\n`);
158
+ return;
159
+ }
160
+
161
+ const dir = data.reverse ? ' (reverse)' : '';
162
+ console.log(
163
+ `\nFile path from ${from} to ${to} (${data.hops} ${data.hops === 1 ? 'hop' : 'hops'})${dir}:\n`,
164
+ );
165
+ for (let i = 0; i < data.path.length; i++) {
166
+ const indent = ' '.repeat(i + 1);
167
+ if (i === 0) {
168
+ console.log(`${indent}${data.path[i]}`);
169
+ } else {
170
+ console.log(`${indent}→ ${data.path[i]}`);
171
+ }
172
+ }
173
+ if (data.alternateCount > 0) {
174
+ console.log(
175
+ `\n (${data.alternateCount} alternate shortest ${data.alternateCount === 1 ? 'path' : 'paths'} at same depth)`,
176
+ );
177
+ }
178
+ console.log();
179
+ }
@@ -115,7 +115,6 @@ export interface OutputOpts {
115
115
  }
116
116
 
117
117
  export function outputResult(
118
- // biome-ignore lint/suspicious/noExplicitAny: accepts any data shape from features
119
118
  data: Record<string, any>,
120
119
  field: string | null,
121
120
  opts: OutputOpts,
@@ -16,7 +16,6 @@ interface SequenceOpts {
16
16
  }
17
17
 
18
18
  export function sequence(name: string, dbPath: string | undefined, opts: SequenceOpts = {}): void {
19
- // biome-ignore lint/suspicious/noExplicitAny: dynamic shape from sequenceData
20
19
  const data = sequenceData(name, dbPath, opts) as any;
21
20
 
22
21
  if (outputResult(data, 'messages', opts)) return;
@@ -49,22 +49,10 @@ export function formatStructure(data: StructureResult): string {
49
49
  return lines.join('\n');
50
50
  }
51
51
 
52
- interface HotspotEntry {
53
- name: string;
54
- kind: string;
55
- fileCount?: number;
56
- cohesion?: number | null;
57
- lineCount?: number;
58
- symbolCount?: number;
59
- fanIn?: number;
60
- fanOut?: number;
61
- }
62
-
63
52
  interface HotspotsResult {
64
53
  metric: string;
65
54
  level: string;
66
55
  limit: number;
67
- // biome-ignore lint/suspicious/noExplicitAny: hotspots shape varies by level
68
56
  hotspots: any[];
69
57
  }
70
58
 
@@ -37,7 +37,6 @@ interface TriageSummary {
37
37
  }
38
38
 
39
39
  export function triage(customDbPath: string | undefined, opts: TriageOpts = {}): void {
40
- // biome-ignore lint/suspicious/noExplicitAny: dynamic shape from triageData
41
40
  const data = triageData(customDbPath, opts as any) as {
42
41
  items: TriageItem[];
43
42
  summary: TriageSummary;
@@ -1,26 +1,40 @@
1
1
  import path from 'node:path';
2
2
  import { SUPPORTED_EXTENSIONS } from '../domain/parser.js';
3
3
 
4
- export const IGNORE_DIRS: Set<string> = new Set([
5
- 'node_modules',
6
- '.git',
7
- 'dist',
8
- 'build',
9
- '.next',
10
- '.nuxt',
11
- '.svelte-kit',
12
- 'coverage',
13
- '.codegraph',
14
- '__pycache__',
15
- '.tox',
16
- 'vendor',
17
- '.venv',
18
- 'venv',
19
- 'env',
20
- '.env',
21
- ]);
4
+ /**
5
+ * Set with a `.toArray()` convenience method for consumers migrating from
6
+ * the pre-3.4 Array-based API (where `.includes()` / `.indexOf()` worked).
7
+ */
8
+ export interface ArrayCompatSet<T> extends Set<T> {
9
+ toArray(): T[];
10
+ }
11
+
12
+ function withArrayCompat<T>(s: Set<T>): ArrayCompatSet<T> {
13
+ return Object.assign(s, { toArray: () => [...s] });
14
+ }
15
+
16
+ export const IGNORE_DIRS: ArrayCompatSet<string> = withArrayCompat(
17
+ new Set([
18
+ 'node_modules',
19
+ '.git',
20
+ 'dist',
21
+ 'build',
22
+ '.next',
23
+ '.nuxt',
24
+ '.svelte-kit',
25
+ 'coverage',
26
+ '.codegraph',
27
+ '__pycache__',
28
+ '.tox',
29
+ 'vendor',
30
+ '.venv',
31
+ 'venv',
32
+ 'env',
33
+ '.env',
34
+ ]),
35
+ );
22
36
 
23
- export { SUPPORTED_EXTENSIONS as EXTENSIONS };
37
+ export const EXTENSIONS: ArrayCompatSet<string> = withArrayCompat(new Set(SUPPORTED_EXTENSIONS));
24
38
 
25
39
  export function shouldIgnore(dirName: string): boolean {
26
40
  return IGNORE_DIRS.has(dirName) || dirName.startsWith('.');
@@ -72,3 +72,8 @@ export class BoundaryError extends CodegraphError {
72
72
  this.name = 'BoundaryError';
73
73
  }
74
74
  }
75
+
76
+ /** Safely extract a string message from an unknown thrown value. */
77
+ export function toErrorMessage(e: unknown): string {
78
+ return e instanceof Error ? e.message : String(e);
79
+ }
@@ -0,0 +1,10 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+
4
+ const __sharedDir = path.dirname(new URL(import.meta.url).pathname.replace(/^\/([A-Z]:)/i, '$1'));
5
+
6
+ export const CODEGRAPH_VERSION: string = (
7
+ JSON.parse(fs.readFileSync(path.join(__sharedDir, '..', '..', 'package.json'), 'utf-8')) as {
8
+ version: string;
9
+ }
10
+ ).version;
package/src/types.ts CHANGED
@@ -881,6 +881,8 @@ export interface EngineOpts {
881
881
  engine: EngineMode;
882
882
  dataflow: boolean;
883
883
  ast: boolean;
884
+ /** Persistent NativeDatabase connection for build writes (Phase 6.15). */
885
+ nativeDb?: NativeDatabase;
884
886
  }
885
887
 
886
888
  /** A file change detected during incremental builds. */
@@ -1774,8 +1776,9 @@ export interface BetterSqlite3Database {
1774
1776
  exec(sql: string): this;
1775
1777
  close(): void;
1776
1778
  pragma(sql: string): unknown;
1777
- // biome-ignore lint/suspicious/noExplicitAny: must be compatible with better-sqlite3's generic Transaction<F> return type
1778
- transaction<F extends (...args: any[]) => any>(fn: F): F;
1779
+ transaction<F extends (...args: any[]) => any>(
1780
+ fn: F,
1781
+ ): (...args: F extends (...a: infer A) => unknown ? A : never) => ReturnType<F>;
1779
1782
  readonly open: boolean;
1780
1783
  readonly name: string;
1781
1784
  }
@@ -1803,6 +1806,10 @@ export interface NativeAddon {
1803
1806
  buildCallEdges(files: unknown[], nodes: unknown[], builtinReceivers: string[]): unknown[];
1804
1807
  engineVersion(): string;
1805
1808
  ParseTreeCache: new () => NativeParseTreeCache;
1809
+ NativeDatabase: {
1810
+ openReadWrite(dbPath: string): NativeDatabase;
1811
+ openReadonly(dbPath: string): NativeDatabase;
1812
+ };
1806
1813
  }
1807
1814
 
1808
1815
  /** Native parse-tree cache instance. */
@@ -1813,20 +1820,283 @@ export interface NativeParseTreeCache {
1813
1820
  clear(): void;
1814
1821
  }
1815
1822
 
1823
+ /** Row types returned by NativeDatabase query methods (auto-generated by napi-rs). */
1824
+ export interface NativeNodeRow {
1825
+ id: number;
1826
+ name: string;
1827
+ kind: string;
1828
+ file: string;
1829
+ line: number | null;
1830
+ endLine: number | null;
1831
+ parentId: number | null;
1832
+ exported: number | null;
1833
+ qualifiedName: string | null;
1834
+ scope: string | null;
1835
+ visibility: string | null;
1836
+ role: string | null;
1837
+ }
1838
+
1839
+ export interface NativeNodeRowWithFanIn extends NativeNodeRow {
1840
+ fanIn: number;
1841
+ }
1842
+
1843
+ export interface NativeTriageNodeRow extends NativeNodeRow {
1844
+ fanIn: number;
1845
+ cognitive: number;
1846
+ mi: number;
1847
+ cyclomatic: number;
1848
+ maxNesting: number;
1849
+ churn: number;
1850
+ }
1851
+
1852
+ export interface NativeNodeIdRow {
1853
+ id: number;
1854
+ name: string;
1855
+ kind: string;
1856
+ line: number | null;
1857
+ }
1858
+
1859
+ export interface NativeChildNodeRow {
1860
+ name: string;
1861
+ kind: string;
1862
+ line: number | null;
1863
+ endLine: number | null;
1864
+ qualifiedName: string | null;
1865
+ scope: string | null;
1866
+ visibility: string | null;
1867
+ }
1868
+
1869
+ export interface NativeRelatedNodeRow {
1870
+ id: number;
1871
+ name: string;
1872
+ kind: string;
1873
+ file: string;
1874
+ line: number | null;
1875
+ endLine: number | null;
1876
+ }
1877
+
1878
+ export interface NativeAdjacentEdgeRow {
1879
+ name: string;
1880
+ kind: string;
1881
+ file: string;
1882
+ line: number | null;
1883
+ edgeKind: string;
1884
+ }
1885
+
1886
+ export interface NativeImportEdgeRow {
1887
+ file: string;
1888
+ edgeKind: string;
1889
+ }
1890
+
1891
+ export interface NativeIntraFileCallEdge {
1892
+ callerName: string;
1893
+ calleeName: string;
1894
+ }
1895
+
1896
+ export interface NativeCallableNodeRow {
1897
+ id: number;
1898
+ name: string;
1899
+ kind: string;
1900
+ file: string;
1901
+ }
1902
+
1903
+ export interface NativeCallEdgeRow {
1904
+ sourceId: number;
1905
+ targetId: number;
1906
+ confidence: number | null;
1907
+ }
1908
+
1909
+ export interface NativeFileNodeRow {
1910
+ id: number;
1911
+ name: string;
1912
+ file: string;
1913
+ }
1914
+
1915
+ export interface NativeImportGraphEdgeRow {
1916
+ sourceId: number;
1917
+ targetId: number;
1918
+ }
1919
+
1920
+ export interface NativeComplexityMetrics {
1921
+ cognitive: number;
1922
+ cyclomatic: number;
1923
+ maxNesting: number;
1924
+ maintainabilityIndex: number | null;
1925
+ halsteadVolume: number | null;
1926
+ }
1927
+
1928
+ /** Native rusqlite database wrapper instance (Phase 6.13 + 6.14 + 6.15). */
1929
+ export interface NativeDatabase {
1930
+ // ── Lifecycle (6.13) ────────────────────────────────────────────────
1931
+ initSchema(): void;
1932
+ getBuildMeta(key: string): string | null;
1933
+ setBuildMeta(entries: Array<{ key: string; value: string }>): void;
1934
+ exec(sql: string): void;
1935
+ pragma(sql: string): string | null;
1936
+ close(): void;
1937
+ readonly dbPath: string;
1938
+ readonly isOpen: boolean;
1939
+
1940
+ // ── Node lookups (6.14) ──────────────────────────────────────────────
1941
+ countNodes(): number;
1942
+ countEdges(): number;
1943
+ countFiles(): number;
1944
+ findNodeById(id: number): NativeNodeRow | null;
1945
+ getNodeId(name: string, kind: string, file: string, line: number): number | null;
1946
+ getFunctionNodeId(name: string, file: string, line: number): number | null;
1947
+ bulkNodeIdsByFile(file: string): NativeNodeIdRow[];
1948
+ findNodeChildren(parentId: number): NativeChildNodeRow[];
1949
+ findNodesByFile(file: string): NativeNodeRow[];
1950
+ findFileNodes(fileLike: string): NativeNodeRow[];
1951
+ findNodesByScope(
1952
+ scopeName: string,
1953
+ kind: string | null | undefined,
1954
+ file: string | null | undefined,
1955
+ ): NativeNodeRow[];
1956
+ findNodeByQualifiedName(qualifiedName: string, file: string | null | undefined): NativeNodeRow[];
1957
+ findNodesWithFanIn(
1958
+ namePattern: string,
1959
+ kinds: string[] | null | undefined,
1960
+ file: string | null | undefined,
1961
+ ): NativeNodeRowWithFanIn[];
1962
+ findNodesForTriage(
1963
+ kind: string | null | undefined,
1964
+ role: string | null | undefined,
1965
+ file: string | null | undefined,
1966
+ noTests: boolean | null | undefined,
1967
+ ): NativeTriageNodeRow[];
1968
+ listFunctionNodes(
1969
+ file: string | null | undefined,
1970
+ pattern: string | null | undefined,
1971
+ noTests: boolean | null | undefined,
1972
+ ): NativeNodeRow[];
1973
+ iterateFunctionNodes(
1974
+ file: string | null | undefined,
1975
+ pattern: string | null | undefined,
1976
+ noTests: boolean | null | undefined,
1977
+ ): NativeNodeRow[];
1978
+
1979
+ // ── Edge queries (6.14) ──────────────────────────────────────────────
1980
+ findCallees(nodeId: number): NativeRelatedNodeRow[];
1981
+ findCallers(nodeId: number): NativeRelatedNodeRow[];
1982
+ findDistinctCallers(nodeId: number): NativeRelatedNodeRow[];
1983
+ findAllOutgoingEdges(nodeId: number): NativeAdjacentEdgeRow[];
1984
+ findAllIncomingEdges(nodeId: number): NativeAdjacentEdgeRow[];
1985
+ findCalleeNames(nodeId: number): string[];
1986
+ findCallerNames(nodeId: number): string[];
1987
+ findImportTargets(nodeId: number): NativeImportEdgeRow[];
1988
+ findImportSources(nodeId: number): NativeImportEdgeRow[];
1989
+ findImportDependents(nodeId: number): NativeNodeRow[];
1990
+ findCrossFileCallTargets(file: string): number[];
1991
+ countCrossFileCallers(nodeId: number, file: string): number;
1992
+ getClassHierarchy(classNodeId: number): number[];
1993
+ findImplementors(nodeId: number): NativeRelatedNodeRow[];
1994
+ findInterfaces(nodeId: number): NativeRelatedNodeRow[];
1995
+ findIntraFileCallEdges(file: string): NativeIntraFileCallEdge[];
1996
+
1997
+ // ── Graph-read queries (6.14) ────────────────────────────────────────
1998
+ getCallableNodes(): NativeCallableNodeRow[];
1999
+ getCallEdges(): NativeCallEdgeRow[];
2000
+ getFileNodesAll(): NativeFileNodeRow[];
2001
+ getImportEdges(): NativeImportGraphEdgeRow[];
2002
+
2003
+ // ── Table checks (6.14) ──────────────────────────────────────────────
2004
+ hasCfgTables(): boolean;
2005
+ hasEmbeddings(): boolean;
2006
+ hasDataflowTable(): boolean;
2007
+ getComplexityForNode(nodeId: number): NativeComplexityMetrics | null;
2008
+
2009
+ // ── Build pipeline writes (6.15) ───────────────────────────────────
2010
+ bulkInsertNodes(
2011
+ batches: Array<{
2012
+ file: string;
2013
+ definitions: Array<{
2014
+ name: string;
2015
+ kind: string;
2016
+ line: number;
2017
+ endLine?: number | null;
2018
+ visibility?: string | null;
2019
+ children: Array<{
2020
+ name: string;
2021
+ kind: string;
2022
+ line: number;
2023
+ endLine?: number | null;
2024
+ visibility?: string | null;
2025
+ }>;
2026
+ }>;
2027
+ exports: Array<{ name: string; kind: string; line: number }>;
2028
+ }>,
2029
+ fileHashes: Array<{ file: string; hash: string; mtime: number; size: number }>,
2030
+ removedFiles: string[],
2031
+ ): boolean;
2032
+ bulkInsertEdges(
2033
+ edges: Array<{
2034
+ sourceId: number;
2035
+ targetId: number;
2036
+ kind: string;
2037
+ confidence: number;
2038
+ dynamic: number;
2039
+ }>,
2040
+ ): boolean;
2041
+ bulkInsertAstNodes(
2042
+ batches: Array<{
2043
+ file: string;
2044
+ nodes: Array<{
2045
+ line: number;
2046
+ kind: string;
2047
+ name: string;
2048
+ text?: string | null;
2049
+ receiver?: string | null;
2050
+ }>;
2051
+ }>,
2052
+ ): number;
2053
+ classifyRolesFull(): {
2054
+ entry: number;
2055
+ core: number;
2056
+ utility: number;
2057
+ adapter: number;
2058
+ dead: number;
2059
+ deadLeaf: number;
2060
+ deadEntry: number;
2061
+ deadFfi: number;
2062
+ deadUnresolved: number;
2063
+ testOnly: number;
2064
+ leaf: number;
2065
+ } | null;
2066
+ classifyRolesIncremental(changedFiles: string[]): {
2067
+ entry: number;
2068
+ core: number;
2069
+ utility: number;
2070
+ adapter: number;
2071
+ dead: number;
2072
+ deadLeaf: number;
2073
+ deadEntry: number;
2074
+ deadFfi: number;
2075
+ deadUnresolved: number;
2076
+ testOnly: number;
2077
+ leaf: number;
2078
+ } | null;
2079
+ purgeFilesData(files: string[], purgeHashes?: boolean, reverseDepFiles?: string[]): void;
2080
+
2081
+ // ── Generic query execution & version validation (6.16) ─────────────
2082
+ /** Execute a parameterized SELECT and return all rows as objects. */
2083
+ queryAll(sql: string, params: Array<string | number | null>): Record<string, unknown>[];
2084
+ /** Execute a parameterized SELECT and return the first row, or null. */
2085
+ queryGet(sql: string, params: Array<string | number | null>): Record<string, unknown> | null;
2086
+ /** Validate DB codegraph_version matches expected. Warns on mismatch. */
2087
+ validateSchemaVersion(expectedVersion: string): boolean;
2088
+ }
2089
+
1816
2090
  // ════════════════════════════════════════════════════════════════════════
1817
2091
  // §14 CLI Command Framework
1818
2092
  // ════════════════════════════════════════════════════════════════════════
1819
2093
 
1820
2094
  /** Shared context passed to every CLI command's execute/validate functions. */
1821
2095
  export interface CommandContext {
1822
- // biome-ignore lint/suspicious/noExplicitAny: config is a deeply nested dynamic object
1823
2096
  config: Record<string, any>;
1824
- // biome-ignore lint/suspicious/noExplicitAny: Commander options are dynamically typed
1825
2097
  resolveNoTests: (opts: any) => boolean;
1826
- // biome-ignore lint/suspicious/noExplicitAny: Commander options are dynamically typed
1827
2098
  resolveQueryOpts: (opts: any) => any;
1828
2099
  formatSize: (bytes: number) => string;
1829
- // biome-ignore lint/suspicious/noExplicitAny: data shapes vary per command
1830
2100
  outputResult: (data: any, key: string, opts: any) => boolean;
1831
2101
  program: import('commander').Command;
1832
2102
  }
@@ -1839,12 +2109,9 @@ export interface CommandDefinition {
1839
2109
  options?: Array<
1840
2110
  | [string, string]
1841
2111
  | [string, string, string | boolean | number]
1842
- // biome-ignore lint/suspicious/noExplicitAny: Commander parse functions accept arbitrary return types
1843
2112
  | [string, string, (val: string) => any, string | boolean | number]
1844
2113
  >;
1845
- // biome-ignore lint/suspicious/noExplicitAny: Commander options are dynamically typed
1846
- validate?: (args: any[], opts: any, ctx: CommandContext) => string | undefined | void;
1847
- // biome-ignore lint/suspicious/noExplicitAny: Commander options are dynamically typed
2114
+ validate?: (args: any[], opts: any, ctx: CommandContext) => string | undefined;
1848
2115
  execute?: (args: any[], opts: any, ctx: CommandContext) => void | Promise<void>;
1849
2116
  subcommands?: CommandDefinition[];
1850
2117
  }
package/src/vendor.d.ts DELETED
@@ -1,39 +0,0 @@
1
- /**
2
- * Ambient type declarations for third-party modules without bundled types.
3
- * Used by the TS migration — keeps @types/* out of devDeps to avoid
4
- * declaration-emit conflicts with allowJs.
5
- */
6
-
7
- declare module 'better-sqlite3' {
8
- namespace BetterSqlite3 {
9
- interface Database {
10
- prepare<TRow = unknown>(sql: string): Statement<TRow>;
11
- exec(sql: string): Database;
12
- // biome-ignore lint/suspicious/noExplicitAny: must match better-sqlite3's generic Transaction<F>
13
- transaction<F extends (...args: any[]) => any>(fn: F): F;
14
- close(): void;
15
- pragma(pragma: string, options?: { simple?: boolean }): unknown;
16
- readonly open: boolean;
17
- readonly name: string;
18
- }
19
-
20
- interface Statement<TRow = unknown> {
21
- run(...params: unknown[]): RunResult;
22
- get(...params: unknown[]): TRow | undefined;
23
- all(...params: unknown[]): TRow[];
24
- iterate(...params: unknown[]): IterableIterator<TRow>;
25
- raw(toggle?: boolean): this;
26
- }
27
-
28
- interface RunResult {
29
- changes: number;
30
- lastInsertRowid: number | bigint;
31
- }
32
- }
33
-
34
- function BetterSqlite3(
35
- filename: string,
36
- options?: Record<string, unknown>,
37
- ): BetterSqlite3.Database;
38
- export = BetterSqlite3;
39
- }