kirograph 0.19.0 → 0.20.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 (658) hide show
  1. package/README.md +10 -8
  2. package/dist/architecture/layers/dart.d.ts +10 -0
  3. package/dist/architecture/layers/dart.d.ts.map +1 -0
  4. package/dist/architecture/layers/elixir.d.ts +6 -0
  5. package/dist/architecture/layers/elixir.d.ts.map +1 -0
  6. package/dist/architecture/layers/index.d.ts.map +1 -1
  7. package/dist/architecture/layers/ocaml.d.ts +6 -0
  8. package/dist/architecture/layers/ocaml.d.ts.map +1 -0
  9. package/dist/architecture/layers/scala.d.ts +6 -0
  10. package/dist/architecture/layers/scala.d.ts.map +1 -0
  11. package/dist/architecture/layers/solidity.d.ts +6 -0
  12. package/dist/architecture/layers/solidity.d.ts.map +1 -0
  13. package/dist/architecture/layers/vue.d.ts +6 -0
  14. package/dist/architecture/layers/vue.d.ts.map +1 -0
  15. package/dist/architecture/manifest/elm.d.ts +3 -0
  16. package/dist/architecture/manifest/elm.d.ts.map +1 -0
  17. package/dist/architecture/manifest/index.d.ts.map +1 -1
  18. package/dist/architecture/manifest/ocaml.d.ts +3 -0
  19. package/dist/architecture/manifest/ocaml.d.ts.map +1 -0
  20. package/dist/architecture/manifest/scala.d.ts +3 -0
  21. package/dist/architecture/manifest/scala.d.ts.map +1 -0
  22. package/dist/bin/banner.d.ts.map +1 -1
  23. package/dist/bin/commands/affected.d.ts.map +1 -1
  24. package/dist/bin/commands/attack-surface.d.ts +3 -0
  25. package/dist/bin/commands/attack-surface.d.ts.map +1 -0
  26. package/dist/bin/commands/attack-surface.js +7 -0
  27. package/dist/bin/commands/attack-surface.js.map +2 -2
  28. package/dist/bin/commands/benchmark.d.ts +9 -0
  29. package/dist/bin/commands/benchmark.d.ts.map +1 -0
  30. package/dist/bin/commands/budget.d.ts +6 -0
  31. package/dist/bin/commands/budget.d.ts.map +1 -0
  32. package/dist/bin/commands/caveman.d.ts +7 -0
  33. package/dist/bin/commands/caveman.d.ts.map +1 -0
  34. package/dist/bin/commands/communities.d.ts +3 -0
  35. package/dist/bin/commands/communities.d.ts.map +1 -0
  36. package/dist/bin/commands/compression.d.ts +7 -0
  37. package/dist/bin/commands/compression.d.ts.map +1 -0
  38. package/dist/bin/commands/context.d.ts.map +1 -1
  39. package/dist/bin/commands/data.d.ts +3 -0
  40. package/dist/bin/commands/data.d.ts.map +1 -0
  41. package/dist/bin/commands/dead-code.d.ts +3 -0
  42. package/dist/bin/commands/dead-code.d.ts.map +1 -0
  43. package/dist/bin/commands/dep-confusion.d.ts +3 -0
  44. package/dist/bin/commands/dep-confusion.d.ts.map +1 -0
  45. package/dist/bin/commands/docs.d.ts +3 -0
  46. package/dist/bin/commands/docs.d.ts.map +1 -0
  47. package/dist/bin/commands/exec.d.ts +11 -0
  48. package/dist/bin/commands/exec.d.ts.map +1 -0
  49. package/dist/bin/commands/export.d.ts +3 -0
  50. package/dist/bin/commands/export.d.ts.map +1 -0
  51. package/dist/bin/commands/flows.d.ts +3 -0
  52. package/dist/bin/commands/flows.d.ts.map +1 -0
  53. package/dist/bin/commands/gain.d.ts +6 -0
  54. package/dist/bin/commands/gain.d.ts.map +1 -0
  55. package/dist/bin/commands/help.d.ts +7 -0
  56. package/dist/bin/commands/help.d.ts.map +1 -1
  57. package/dist/bin/commands/help.js +20 -3
  58. package/dist/bin/commands/help.js.map +2 -2
  59. package/dist/bin/commands/hotspots.d.ts +3 -0
  60. package/dist/bin/commands/hotspots.d.ts.map +1 -0
  61. package/dist/bin/commands/hotspots.js +94 -1
  62. package/dist/bin/commands/hotspots.js.map +3 -3
  63. package/dist/bin/commands/install.d.ts.map +1 -1
  64. package/dist/bin/commands/install.js +3 -3
  65. package/dist/bin/commands/install.js.map +2 -2
  66. package/dist/bin/commands/licenses.d.ts +3 -0
  67. package/dist/bin/commands/licenses.d.ts.map +1 -0
  68. package/dist/bin/commands/memory.d.ts +16 -0
  69. package/dist/bin/commands/memory.d.ts.map +1 -0
  70. package/dist/bin/commands/memory.js +151 -4
  71. package/dist/bin/commands/memory.js.map +2 -2
  72. package/dist/bin/commands/path.d.ts +3 -0
  73. package/dist/bin/commands/path.d.ts.map +1 -0
  74. package/dist/bin/commands/pattern.d.ts +3 -0
  75. package/dist/bin/commands/pattern.d.ts.map +1 -0
  76. package/dist/bin/commands/pattern.js +592 -0
  77. package/dist/bin/commands/pattern.js.map +7 -0
  78. package/dist/bin/commands/query.d.ts.map +1 -1
  79. package/dist/bin/commands/reachability.d.ts +3 -0
  80. package/dist/bin/commands/reachability.d.ts.map +1 -0
  81. package/dist/bin/commands/read.d.ts +6 -0
  82. package/dist/bin/commands/read.d.ts.map +1 -0
  83. package/dist/bin/commands/refactor.d.ts +3 -0
  84. package/dist/bin/commands/refactor.d.ts.map +1 -0
  85. package/dist/bin/commands/remediation.d.ts +3 -0
  86. package/dist/bin/commands/remediation.d.ts.map +1 -0
  87. package/dist/bin/commands/sbom.d.ts +3 -0
  88. package/dist/bin/commands/sbom.d.ts.map +1 -0
  89. package/dist/bin/commands/security-ci-report.d.ts +9 -0
  90. package/dist/bin/commands/security-ci-report.d.ts.map +1 -0
  91. package/dist/bin/commands/security-export.d.ts +2 -0
  92. package/dist/bin/commands/security-export.d.ts.map +1 -0
  93. package/dist/bin/commands/security-flows.d.ts +3 -0
  94. package/dist/bin/commands/security-flows.d.ts.map +1 -0
  95. package/dist/bin/commands/security-secrets.d.ts +3 -0
  96. package/dist/bin/commands/security-secrets.d.ts.map +1 -0
  97. package/dist/bin/commands/security.d.ts +3 -0
  98. package/dist/bin/commands/security.d.ts.map +1 -0
  99. package/dist/bin/commands/security.js +15 -0
  100. package/dist/bin/commands/security.js.map +2 -2
  101. package/dist/bin/commands/snapshot.d.ts +3 -0
  102. package/dist/bin/commands/snapshot.d.ts.map +1 -0
  103. package/dist/bin/commands/staleness.d.ts +3 -0
  104. package/dist/bin/commands/staleness.d.ts.map +1 -0
  105. package/dist/bin/commands/status.d.ts.map +1 -1
  106. package/dist/bin/commands/status.js +27 -0
  107. package/dist/bin/commands/status.js.map +2 -2
  108. package/dist/bin/commands/supply-chain.d.ts +3 -0
  109. package/dist/bin/commands/supply-chain.d.ts.map +1 -0
  110. package/dist/bin/commands/surprising.d.ts +3 -0
  111. package/dist/bin/commands/surprising.d.ts.map +1 -0
  112. package/dist/bin/commands/sync.d.ts.map +1 -1
  113. package/dist/bin/commands/uninit.d.ts.map +1 -1
  114. package/dist/bin/commands/utils.d.ts +5 -0
  115. package/dist/bin/commands/utils.d.ts.map +1 -1
  116. package/dist/bin/commands/vex.d.ts +3 -0
  117. package/dist/bin/commands/vex.d.ts.map +1 -0
  118. package/dist/bin/commands/vuln-suppress.d.ts +3 -0
  119. package/dist/bin/commands/vuln-suppress.d.ts.map +1 -0
  120. package/dist/bin/commands/vulns.d.ts +3 -0
  121. package/dist/bin/commands/vulns.d.ts.map +1 -0
  122. package/dist/bin/installer/archive.d.ts +47 -0
  123. package/dist/bin/installer/archive.d.ts.map +1 -0
  124. package/dist/bin/installer/auto-detect.d.ts +16 -0
  125. package/dist/bin/installer/auto-detect.d.ts.map +1 -0
  126. package/dist/bin/installer/caveman.d.ts +12 -0
  127. package/dist/bin/installer/caveman.d.ts.map +1 -0
  128. package/dist/bin/installer/cli-agent.d.ts +7 -2
  129. package/dist/bin/installer/cli-agent.d.ts.map +1 -1
  130. package/dist/bin/installer/cli-agent.js +6 -2
  131. package/dist/bin/installer/cli-agent.js.map +2 -2
  132. package/dist/bin/installer/common.d.ts +36 -0
  133. package/dist/bin/installer/common.d.ts.map +1 -0
  134. package/dist/bin/installer/common.js +2 -1
  135. package/dist/bin/installer/common.js.map +2 -2
  136. package/dist/bin/installer/config-prompt.d.ts +1 -1
  137. package/dist/bin/installer/config-prompt.d.ts.map +1 -1
  138. package/dist/bin/installer/config-prompt.js +74 -2
  139. package/dist/bin/installer/config-prompt.js.map +2 -2
  140. package/dist/bin/installer/dashboard.d.ts.map +1 -1
  141. package/dist/bin/installer/detect.d.ts +30 -0
  142. package/dist/bin/installer/detect.d.ts.map +1 -0
  143. package/dist/bin/installer/hooks.d.ts +4 -1
  144. package/dist/bin/installer/hooks.d.ts.map +1 -1
  145. package/dist/bin/installer/hooks.js +34 -0
  146. package/dist/bin/installer/hooks.js.map +2 -2
  147. package/dist/bin/installer/index.d.ts +5 -4
  148. package/dist/bin/installer/index.d.ts.map +1 -1
  149. package/dist/bin/installer/index.js +38 -8
  150. package/dist/bin/installer/index.js.map +2 -2
  151. package/dist/bin/installer/instructions.d.ts +14 -0
  152. package/dist/bin/installer/instructions.d.ts.map +1 -0
  153. package/dist/bin/installer/instructions.js +15 -1
  154. package/dist/bin/installer/instructions.js.map +2 -2
  155. package/dist/bin/installer/mcp.d.ts.map +1 -1
  156. package/dist/bin/installer/prompts.d.ts +17 -0
  157. package/dist/bin/installer/prompts.d.ts.map +1 -1
  158. package/dist/bin/installer/qdrant-dashboard.d.ts.map +1 -1
  159. package/dist/bin/installer/steering.d.ts +14 -2
  160. package/dist/bin/installer/steering.d.ts.map +1 -1
  161. package/dist/bin/installer/steering.js +81 -0
  162. package/dist/bin/installer/steering.js.map +2 -2
  163. package/dist/bin/installer/targets/aider.d.ts +6 -0
  164. package/dist/bin/installer/targets/aider.d.ts.map +1 -0
  165. package/dist/bin/installer/targets/aider.js +3 -3
  166. package/dist/bin/installer/targets/aider.js.map +2 -2
  167. package/dist/bin/installer/targets/amp.d.ts +6 -0
  168. package/dist/bin/installer/targets/amp.d.ts.map +1 -0
  169. package/dist/bin/installer/targets/amp.js +3 -3
  170. package/dist/bin/installer/targets/amp.js.map +2 -2
  171. package/dist/bin/installer/targets/antigravity.d.ts +13 -0
  172. package/dist/bin/installer/targets/antigravity.d.ts.map +1 -0
  173. package/dist/bin/installer/targets/antigravity.js +2 -2
  174. package/dist/bin/installer/targets/antigravity.js.map +2 -2
  175. package/dist/bin/installer/targets/augment.d.ts +6 -0
  176. package/dist/bin/installer/targets/augment.d.ts.map +1 -0
  177. package/dist/bin/installer/targets/augment.js +3 -3
  178. package/dist/bin/installer/targets/augment.js.map +2 -2
  179. package/dist/bin/installer/targets/claude.d.ts +6 -0
  180. package/dist/bin/installer/targets/claude.d.ts.map +1 -0
  181. package/dist/bin/installer/targets/claude.js +2 -2
  182. package/dist/bin/installer/targets/claude.js.map +2 -2
  183. package/dist/bin/installer/targets/cline.d.ts +13 -0
  184. package/dist/bin/installer/targets/cline.d.ts.map +1 -0
  185. package/dist/bin/installer/targets/cline.js +2 -2
  186. package/dist/bin/installer/targets/cline.js.map +2 -2
  187. package/dist/bin/installer/targets/codex.d.ts +6 -0
  188. package/dist/bin/installer/targets/codex.d.ts.map +1 -0
  189. package/dist/bin/installer/targets/codex.js +2 -2
  190. package/dist/bin/installer/targets/codex.js.map +2 -2
  191. package/dist/bin/installer/targets/continue.d.ts +12 -0
  192. package/dist/bin/installer/targets/continue.d.ts.map +1 -0
  193. package/dist/bin/installer/targets/continue.js +2 -2
  194. package/dist/bin/installer/targets/continue.js.map +2 -2
  195. package/dist/bin/installer/targets/copilot-cli.d.ts +12 -0
  196. package/dist/bin/installer/targets/copilot-cli.d.ts.map +1 -0
  197. package/dist/bin/installer/targets/copilot-cli.js +2 -2
  198. package/dist/bin/installer/targets/copilot-cli.js.map +2 -2
  199. package/dist/bin/installer/targets/copilot.d.ts +6 -0
  200. package/dist/bin/installer/targets/copilot.d.ts.map +1 -0
  201. package/dist/bin/installer/targets/copilot.js +2 -2
  202. package/dist/bin/installer/targets/copilot.js.map +2 -2
  203. package/dist/bin/installer/targets/cursor.d.ts +6 -0
  204. package/dist/bin/installer/targets/cursor.d.ts.map +1 -0
  205. package/dist/bin/installer/targets/cursor.js +2 -2
  206. package/dist/bin/installer/targets/cursor.js.map +2 -2
  207. package/dist/bin/installer/targets/devin.d.ts +13 -0
  208. package/dist/bin/installer/targets/devin.d.ts.map +1 -0
  209. package/dist/bin/installer/targets/devin.js +2 -2
  210. package/dist/bin/installer/targets/devin.js.map +2 -2
  211. package/dist/bin/installer/targets/gemini-cli.d.ts +16 -0
  212. package/dist/bin/installer/targets/gemini-cli.d.ts.map +1 -0
  213. package/dist/bin/installer/targets/gemini-cli.js +2 -2
  214. package/dist/bin/installer/targets/gemini-cli.js.map +2 -2
  215. package/dist/bin/installer/targets/generic.d.ts +59 -0
  216. package/dist/bin/installer/targets/generic.d.ts.map +1 -0
  217. package/dist/bin/installer/targets/generic.js +2 -2
  218. package/dist/bin/installer/targets/generic.js.map +2 -2
  219. package/dist/bin/installer/targets/goose.d.ts +6 -0
  220. package/dist/bin/installer/targets/goose.d.ts.map +1 -0
  221. package/dist/bin/installer/targets/goose.js +3 -3
  222. package/dist/bin/installer/targets/goose.js.map +2 -2
  223. package/dist/bin/installer/targets/index.d.ts +11 -0
  224. package/dist/bin/installer/targets/index.d.ts.map +1 -0
  225. package/dist/bin/installer/targets/index.js.map +1 -1
  226. package/dist/bin/installer/targets/junie.d.ts +13 -0
  227. package/dist/bin/installer/targets/junie.d.ts.map +1 -0
  228. package/dist/bin/installer/targets/junie.js +2 -2
  229. package/dist/bin/installer/targets/junie.js.map +2 -2
  230. package/dist/bin/installer/targets/kilo.d.ts +12 -0
  231. package/dist/bin/installer/targets/kilo.d.ts.map +1 -0
  232. package/dist/bin/installer/targets/kilo.js +2 -2
  233. package/dist/bin/installer/targets/kilo.js.map +2 -2
  234. package/dist/bin/installer/targets/kiro.d.ts +5 -0
  235. package/dist/bin/installer/targets/kiro.d.ts.map +1 -0
  236. package/dist/bin/installer/targets/kiro.js +4 -4
  237. package/dist/bin/installer/targets/kiro.js.map +2 -2
  238. package/dist/bin/installer/targets/opencode.d.ts +13 -0
  239. package/dist/bin/installer/targets/opencode.d.ts.map +1 -0
  240. package/dist/bin/installer/targets/opencode.js +2 -2
  241. package/dist/bin/installer/targets/opencode.js.map +2 -2
  242. package/dist/bin/installer/targets/openhands.d.ts +6 -0
  243. package/dist/bin/installer/targets/openhands.d.ts.map +1 -0
  244. package/dist/bin/installer/targets/openhands.js +3 -3
  245. package/dist/bin/installer/targets/openhands.js.map +2 -2
  246. package/dist/bin/installer/targets/qoder.d.ts +12 -0
  247. package/dist/bin/installer/targets/qoder.d.ts.map +1 -0
  248. package/dist/bin/installer/targets/qoder.js +2 -2
  249. package/dist/bin/installer/targets/qoder.js.map +2 -2
  250. package/dist/bin/installer/targets/qwen.d.ts +12 -0
  251. package/dist/bin/installer/targets/qwen.d.ts.map +1 -0
  252. package/dist/bin/installer/targets/qwen.js +2 -2
  253. package/dist/bin/installer/targets/qwen.js.map +2 -2
  254. package/dist/bin/installer/targets/replit.d.ts +6 -0
  255. package/dist/bin/installer/targets/replit.d.ts.map +1 -0
  256. package/dist/bin/installer/targets/replit.js +3 -3
  257. package/dist/bin/installer/targets/replit.js.map +2 -2
  258. package/dist/bin/installer/targets/roo.d.ts +13 -0
  259. package/dist/bin/installer/targets/roo.d.ts.map +1 -0
  260. package/dist/bin/installer/targets/roo.js +2 -2
  261. package/dist/bin/installer/targets/roo.js.map +2 -2
  262. package/dist/bin/installer/targets/tabnine.d.ts +6 -0
  263. package/dist/bin/installer/targets/tabnine.d.ts.map +1 -0
  264. package/dist/bin/installer/targets/tabnine.js +3 -3
  265. package/dist/bin/installer/targets/tabnine.js.map +2 -2
  266. package/dist/bin/installer/targets/trae.d.ts +6 -0
  267. package/dist/bin/installer/targets/trae.d.ts.map +1 -0
  268. package/dist/bin/installer/targets/trae.js +3 -3
  269. package/dist/bin/installer/targets/trae.js.map +2 -2
  270. package/dist/bin/installer/targets/warp.d.ts +12 -0
  271. package/dist/bin/installer/targets/warp.d.ts.map +1 -0
  272. package/dist/bin/installer/targets/warp.js +2 -2
  273. package/dist/bin/installer/targets/warp.js.map +2 -2
  274. package/dist/bin/installer/targets/windsurf.d.ts +13 -0
  275. package/dist/bin/installer/targets/windsurf.d.ts.map +1 -0
  276. package/dist/bin/installer/targets/windsurf.js +2 -2
  277. package/dist/bin/installer/targets/windsurf.js.map +2 -2
  278. package/dist/bin/kirograph.js +3 -1
  279. package/dist/bin/kirograph.js.map +3 -3
  280. package/dist/bin/progress.d.ts +16 -1
  281. package/dist/bin/progress.d.ts.map +1 -1
  282. package/dist/compression/filters/aws.d.ts +9 -0
  283. package/dist/compression/filters/aws.d.ts.map +1 -0
  284. package/dist/compression/filters/docker.d.ts +6 -0
  285. package/dist/compression/filters/docker.d.ts.map +1 -0
  286. package/dist/compression/filters/files.d.ts +6 -0
  287. package/dist/compression/filters/files.d.ts.map +1 -0
  288. package/dist/compression/filters/generic.d.ts +7 -0
  289. package/dist/compression/filters/generic.d.ts.map +1 -0
  290. package/dist/compression/filters/git.d.ts +6 -0
  291. package/dist/compression/filters/git.d.ts.map +1 -0
  292. package/dist/compression/filters/github.d.ts +6 -0
  293. package/dist/compression/filters/github.d.ts.map +1 -0
  294. package/dist/compression/filters/lint.d.ts +6 -0
  295. package/dist/compression/filters/lint.d.ts.map +1 -0
  296. package/dist/compression/filters/misc.d.ts +6 -0
  297. package/dist/compression/filters/misc.d.ts.map +1 -0
  298. package/dist/compression/filters/package.d.ts +6 -0
  299. package/dist/compression/filters/package.d.ts.map +1 -0
  300. package/dist/compression/filters/test.d.ts +6 -0
  301. package/dist/compression/filters/test.d.ts.map +1 -0
  302. package/dist/compression/index.d.ts +29 -0
  303. package/dist/compression/index.d.ts.map +1 -0
  304. package/dist/compression/naive-cost.d.ts +26 -0
  305. package/dist/compression/naive-cost.d.ts.map +1 -0
  306. package/dist/compression/tracker.d.ts +155 -0
  307. package/dist/compression/tracker.d.ts.map +1 -0
  308. package/dist/compression/types.d.ts +49 -0
  309. package/dist/compression/types.d.ts.map +1 -0
  310. package/dist/config.d.ts +90 -0
  311. package/dist/config.d.ts.map +1 -1
  312. package/dist/config.js +55 -1
  313. package/dist/config.js.map +2 -2
  314. package/dist/core/lock-manager.d.ts +2 -0
  315. package/dist/core/lock-manager.d.ts.map +1 -1
  316. package/dist/core/pipeline.d.ts +4 -1
  317. package/dist/core/pipeline.d.ts.map +1 -1
  318. package/dist/core/pipeline.js +42 -0
  319. package/dist/core/pipeline.js.map +2 -2
  320. package/dist/core/snapshot.d.ts +58 -0
  321. package/dist/core/snapshot.d.ts.map +1 -0
  322. package/dist/data/filters.d.ts +23 -0
  323. package/dist/data/filters.d.ts.map +1 -0
  324. package/dist/data/indexer.d.ts +25 -0
  325. package/dist/data/indexer.d.ts.map +1 -0
  326. package/dist/data/linker.d.ts +37 -0
  327. package/dist/data/linker.d.ts.map +1 -0
  328. package/dist/data/lint.d.ts +27 -0
  329. package/dist/data/lint.d.ts.map +1 -0
  330. package/dist/data/parsers/csv.d.ts +11 -0
  331. package/dist/data/parsers/csv.d.ts.map +1 -0
  332. package/dist/data/parsers/excel.d.ts +10 -0
  333. package/dist/data/parsers/excel.d.ts.map +1 -0
  334. package/dist/data/parsers/index.d.ts +28 -0
  335. package/dist/data/parsers/index.d.ts.map +1 -0
  336. package/dist/data/parsers/json-array.d.ts +9 -0
  337. package/dist/data/parsers/json-array.d.ts.map +1 -0
  338. package/dist/data/parsers/jsonl.d.ts +9 -0
  339. package/dist/data/parsers/jsonl.d.ts.map +1 -0
  340. package/dist/data/parsers/parquet.d.ts +10 -0
  341. package/dist/data/parsers/parquet.d.ts.map +1 -0
  342. package/dist/data/profiler.d.ts +29 -0
  343. package/dist/data/profiler.d.ts.map +1 -0
  344. package/dist/data/queries.d.ts +95 -0
  345. package/dist/data/queries.d.ts.map +1 -0
  346. package/dist/data/types.d.ts +103 -0
  347. package/dist/data/types.d.ts.map +1 -0
  348. package/dist/db/database.d.ts +57 -0
  349. package/dist/db/database.d.ts.map +1 -1
  350. package/dist/db/database.js +19 -0
  351. package/dist/db/database.js.map +2 -2
  352. package/dist/db/patterns-schema.sql +23 -0
  353. package/dist/docs/formats/asciidoc.d.ts +9 -0
  354. package/dist/docs/formats/asciidoc.d.ts.map +1 -0
  355. package/dist/docs/formats/html.d.ts +10 -0
  356. package/dist/docs/formats/html.d.ts.map +1 -0
  357. package/dist/docs/formats/index.d.ts +31 -0
  358. package/dist/docs/formats/index.d.ts.map +1 -0
  359. package/dist/docs/formats/markdown.d.ts +11 -0
  360. package/dist/docs/formats/markdown.d.ts.map +1 -0
  361. package/dist/docs/formats/openapi.d.ts +17 -0
  362. package/dist/docs/formats/openapi.d.ts.map +1 -0
  363. package/dist/docs/formats/org.d.ts +9 -0
  364. package/dist/docs/formats/org.d.ts.map +1 -0
  365. package/dist/docs/formats/plaintext.d.ts +11 -0
  366. package/dist/docs/formats/plaintext.d.ts.map +1 -0
  367. package/dist/docs/formats/rdoc.d.ts +10 -0
  368. package/dist/docs/formats/rdoc.d.ts.map +1 -0
  369. package/dist/docs/formats/rst.d.ts +11 -0
  370. package/dist/docs/formats/rst.d.ts.map +1 -0
  371. package/dist/docs/indexer.d.ts +49 -0
  372. package/dist/docs/indexer.d.ts.map +1 -0
  373. package/dist/docs/linker.d.ts +30 -0
  374. package/dist/docs/linker.d.ts.map +1 -0
  375. package/dist/docs/lint.d.ts +27 -0
  376. package/dist/docs/lint.d.ts.map +1 -0
  377. package/dist/docs/queries.d.ts +78 -0
  378. package/dist/docs/queries.d.ts.map +1 -0
  379. package/dist/docs/section-id.d.ts +48 -0
  380. package/dist/docs/section-id.d.ts.map +1 -0
  381. package/dist/docs/summarizer.d.ts +13 -0
  382. package/dist/docs/summarizer.d.ts.map +1 -0
  383. package/dist/docs/types.d.ts +71 -0
  384. package/dist/docs/types.d.ts.map +1 -0
  385. package/dist/docs/vectors.d.ts +54 -0
  386. package/dist/docs/vectors.d.ts.map +1 -0
  387. package/dist/extraction/extractor.d.ts +1 -1
  388. package/dist/extraction/extractor.d.ts.map +1 -1
  389. package/dist/extraction/grammars.d.ts +6 -0
  390. package/dist/extraction/grammars.d.ts.map +1 -1
  391. package/dist/extraction/languages.d.ts.map +1 -1
  392. package/dist/extraction/notebook.d.ts +14 -0
  393. package/dist/extraction/notebook.d.ts.map +1 -0
  394. package/dist/frameworks/amplify.d.ts +9 -0
  395. package/dist/frameworks/amplify.d.ts.map +1 -0
  396. package/dist/frameworks/angular.d.ts +9 -0
  397. package/dist/frameworks/angular.d.ts.map +1 -0
  398. package/dist/frameworks/ansible.d.ts +8 -0
  399. package/dist/frameworks/ansible.d.ts.map +1 -0
  400. package/dist/frameworks/cloudformation.d.ts +9 -0
  401. package/dist/frameworks/cloudformation.d.ts.map +1 -0
  402. package/dist/frameworks/docker.d.ts +9 -0
  403. package/dist/frameworks/docker.d.ts.map +1 -0
  404. package/dist/frameworks/elixir.d.ts +6 -0
  405. package/dist/frameworks/elixir.d.ts.map +1 -0
  406. package/dist/frameworks/flutter.d.ts +12 -0
  407. package/dist/frameworks/flutter.d.ts.map +1 -0
  408. package/dist/frameworks/iac.d.ts +10 -0
  409. package/dist/frameworks/iac.d.ts.map +1 -0
  410. package/dist/frameworks/index.d.ts +14 -0
  411. package/dist/frameworks/index.d.ts.map +1 -1
  412. package/dist/frameworks/kubernetes.d.ts +9 -0
  413. package/dist/frameworks/kubernetes.d.ts.map +1 -0
  414. package/dist/frameworks/pulumi.d.ts +9 -0
  415. package/dist/frameworks/pulumi.d.ts.map +1 -0
  416. package/dist/frameworks/scala.d.ts +6 -0
  417. package/dist/frameworks/scala.d.ts.map +1 -0
  418. package/dist/frameworks/solidity.d.ts +6 -0
  419. package/dist/frameworks/solidity.d.ts.map +1 -0
  420. package/dist/frameworks/terraform.d.ts +14 -0
  421. package/dist/frameworks/terraform.d.ts.map +1 -0
  422. package/dist/frameworks/vue.d.ts +7 -0
  423. package/dist/frameworks/vue.d.ts.map +1 -0
  424. package/dist/graph/communities.d.ts +43 -0
  425. package/dist/graph/communities.d.ts.map +1 -0
  426. package/dist/graph/flows.d.ts +55 -0
  427. package/dist/graph/flows.d.ts.map +1 -0
  428. package/dist/graph/refactor.d.ts +43 -0
  429. package/dist/graph/refactor.d.ts.map +1 -0
  430. package/dist/index.d.ts +36 -4
  431. package/dist/index.d.ts.map +1 -1
  432. package/dist/mcp/cache.d.ts +69 -0
  433. package/dist/mcp/cache.d.ts.map +1 -0
  434. package/dist/mcp/read-modes.d.ts +31 -0
  435. package/dist/mcp/read-modes.d.ts.map +1 -0
  436. package/dist/mcp/server.d.ts +1 -0
  437. package/dist/mcp/server.d.ts.map +1 -1
  438. package/dist/mcp/server.js +15 -2
  439. package/dist/mcp/server.js.map +2 -2
  440. package/dist/mcp/tool-names.d.ts +2 -0
  441. package/dist/mcp/tool-names.d.ts.map +1 -0
  442. package/dist/mcp/tool-names.js +4 -1
  443. package/dist/mcp/tool-names.js.map +2 -2
  444. package/dist/mcp/tools.d.ts +12 -0
  445. package/dist/mcp/tools.d.ts.map +1 -1
  446. package/dist/mcp/tools.js +397 -0
  447. package/dist/mcp/tools.js.map +2 -2
  448. package/dist/memory/compress.d.ts +19 -0
  449. package/dist/memory/compress.d.ts.map +1 -0
  450. package/dist/memory/database.d.ts +92 -0
  451. package/dist/memory/database.d.ts.map +1 -0
  452. package/dist/memory/database.js +38 -0
  453. package/dist/memory/database.js.map +2 -2
  454. package/dist/memory/index.d.ts +71 -0
  455. package/dist/memory/index.d.ts.map +1 -0
  456. package/dist/memory/index.js +12 -2
  457. package/dist/memory/index.js.map +2 -2
  458. package/dist/memory/symbols.d.ts +21 -0
  459. package/dist/memory/symbols.d.ts.map +1 -0
  460. package/dist/memory/types.d.ts +78 -0
  461. package/dist/memory/types.d.ts.map +1 -0
  462. package/dist/memory/types.js.map +1 -1
  463. package/dist/memory/vectors.d.ts +43 -0
  464. package/dist/memory/vectors.d.ts.map +1 -0
  465. package/dist/patterns/graph.d.ts +16 -0
  466. package/dist/patterns/graph.d.ts.map +1 -0
  467. package/dist/patterns/graph.js +45 -0
  468. package/dist/patterns/graph.js.map +7 -0
  469. package/dist/patterns/index.d.ts +4 -0
  470. package/dist/patterns/index.d.ts.map +1 -0
  471. package/dist/patterns/index.js +39 -0
  472. package/dist/patterns/index.js.map +7 -0
  473. package/dist/patterns/indexer.d.ts +15 -0
  474. package/dist/patterns/indexer.d.ts.map +1 -0
  475. package/dist/patterns/indexer.js +97 -0
  476. package/dist/patterns/indexer.js.map +7 -0
  477. package/dist/patterns/library/command-injection-go.yaml +11 -0
  478. package/dist/patterns/library/dangerous-eval-js.yaml +14 -0
  479. package/dist/patterns/library/dangerous-exec-py.yaml +13 -0
  480. package/dist/patterns/library/dangerous-reflection-java.yaml +8 -0
  481. package/dist/patterns/library/path-traversal-go.yaml +11 -0
  482. package/dist/patterns/library/path-traversal-py.yaml +12 -0
  483. package/dist/patterns/library/path-traversal-readfile-js.yaml +14 -0
  484. package/dist/patterns/library/prototype-pollution-js.yaml +12 -0
  485. package/dist/patterns/library/sql-injection-concat-js.yaml +12 -0
  486. package/dist/patterns/library/sql-injection-java.yaml +13 -0
  487. package/dist/patterns/library/sql-injection-py.yaml +12 -0
  488. package/dist/patterns/library/sql-injection-template-js.yaml +13 -0
  489. package/dist/patterns/library/weak-crypto-md5-js.yaml +13 -0
  490. package/dist/patterns/library/weak-crypto-py.yaml +13 -0
  491. package/dist/patterns/loader.d.ts +18 -0
  492. package/dist/patterns/loader.d.ts.map +1 -0
  493. package/dist/patterns/loader.js +277 -0
  494. package/dist/patterns/loader.js.map +7 -0
  495. package/dist/patterns/runner.d.ts +42 -0
  496. package/dist/patterns/runner.d.ts.map +1 -0
  497. package/dist/patterns/runner.js +277 -0
  498. package/dist/patterns/runner.js.map +7 -0
  499. package/dist/patterns/types.d.ts +27 -0
  500. package/dist/patterns/types.d.ts.map +1 -0
  501. package/dist/patterns/types.js +34 -0
  502. package/dist/patterns/types.js.map +7 -0
  503. package/dist/resolution/bridges/android-rn.d.ts +13 -0
  504. package/dist/resolution/bridges/android-rn.d.ts.map +1 -0
  505. package/dist/resolution/bridges/expo-modules.d.ts +10 -0
  506. package/dist/resolution/bridges/expo-modules.d.ts.map +1 -0
  507. package/dist/resolution/bridges/flutter-channel.d.ts +14 -0
  508. package/dist/resolution/bridges/flutter-channel.d.ts.map +1 -0
  509. package/dist/resolution/bridges/index.d.ts +40 -0
  510. package/dist/resolution/bridges/index.d.ts.map +1 -0
  511. package/dist/resolution/bridges/native-events.d.ts +10 -0
  512. package/dist/resolution/bridges/native-events.d.ts.map +1 -0
  513. package/dist/resolution/bridges/native-views.d.ts +13 -0
  514. package/dist/resolution/bridges/native-views.d.ts.map +1 -0
  515. package/dist/resolution/bridges/react-native.d.ts +9 -0
  516. package/dist/resolution/bridges/react-native.d.ts.map +1 -0
  517. package/dist/resolution/bridges/swift-objc.d.ts +14 -0
  518. package/dist/resolution/bridges/swift-objc.d.ts.map +1 -0
  519. package/dist/resolution/bridges/turbomodules.d.ts +10 -0
  520. package/dist/resolution/bridges/turbomodules.d.ts.map +1 -0
  521. package/dist/resolution/index.d.ts +28 -3
  522. package/dist/resolution/index.d.ts.map +1 -1
  523. package/dist/security/attack-surface.d.ts +46 -0
  524. package/dist/security/attack-surface.d.ts.map +1 -0
  525. package/dist/security/attack-surface.js +43 -1
  526. package/dist/security/attack-surface.js.map +2 -2
  527. package/dist/security/context-warnings.d.ts +40 -0
  528. package/dist/security/context-warnings.d.ts.map +1 -0
  529. package/dist/security/data-flows.d.ts +33 -0
  530. package/dist/security/data-flows.d.ts.map +1 -0
  531. package/dist/security/data-flows.js +65 -7
  532. package/dist/security/data-flows.js.map +2 -2
  533. package/dist/security/dep-confusion.d.ts +23 -0
  534. package/dist/security/dep-confusion.d.ts.map +1 -0
  535. package/dist/security/errors.d.ts +16 -0
  536. package/dist/security/errors.d.ts.map +1 -0
  537. package/dist/security/export/fix-suggestions.d.ts +21 -0
  538. package/dist/security/export/fix-suggestions.d.ts.map +1 -0
  539. package/dist/security/export/sbom.d.ts +33 -0
  540. package/dist/security/export/sbom.d.ts.map +1 -0
  541. package/dist/security/export/serialization.d.ts +62 -0
  542. package/dist/security/export/serialization.d.ts.map +1 -0
  543. package/dist/security/export/vex.d.ts +58 -0
  544. package/dist/security/export/vex.d.ts.map +1 -0
  545. package/dist/security/index.d.ts +21 -0
  546. package/dist/security/index.d.ts.map +1 -0
  547. package/dist/security/integrator.d.ts +63 -0
  548. package/dist/security/integrator.d.ts.map +1 -0
  549. package/dist/security/license.d.ts +33 -0
  550. package/dist/security/license.d.ts.map +1 -0
  551. package/dist/security/manifest/adapter.d.ts +92 -0
  552. package/dist/security/manifest/adapter.d.ts.map +1 -0
  553. package/dist/security/manifest/parser.d.ts +73 -0
  554. package/dist/security/manifest/parser.d.ts.map +1 -0
  555. package/dist/security/manifest/plugins/cargo.d.ts +11 -0
  556. package/dist/security/manifest/plugins/cargo.d.ts.map +1 -0
  557. package/dist/security/manifest/plugins/composer.d.ts +11 -0
  558. package/dist/security/manifest/plugins/composer.d.ts.map +1 -0
  559. package/dist/security/manifest/plugins/go.d.ts +12 -0
  560. package/dist/security/manifest/plugins/go.d.ts.map +1 -0
  561. package/dist/security/manifest/plugins/gradle.d.ts +12 -0
  562. package/dist/security/manifest/plugins/gradle.d.ts.map +1 -0
  563. package/dist/security/manifest/plugins/hex.d.ts +11 -0
  564. package/dist/security/manifest/plugins/hex.d.ts.map +1 -0
  565. package/dist/security/manifest/plugins/maven.d.ts +11 -0
  566. package/dist/security/manifest/plugins/maven.d.ts.map +1 -0
  567. package/dist/security/manifest/plugins/npm.d.ts +11 -0
  568. package/dist/security/manifest/plugins/npm.d.ts.map +1 -0
  569. package/dist/security/manifest/plugins/nuget.d.ts +12 -0
  570. package/dist/security/manifest/plugins/nuget.d.ts.map +1 -0
  571. package/dist/security/manifest/plugins/pip.d.ts +11 -0
  572. package/dist/security/manifest/plugins/pip.d.ts.map +1 -0
  573. package/dist/security/manifest/plugins/pubspec.d.ts +11 -0
  574. package/dist/security/manifest/plugins/pubspec.d.ts.map +1 -0
  575. package/dist/security/manifest/plugins/pyproject.d.ts +3 -0
  576. package/dist/security/manifest/plugins/pyproject.d.ts.map +1 -0
  577. package/dist/security/manifest/plugins/rubygems.d.ts +11 -0
  578. package/dist/security/manifest/plugins/rubygems.d.ts.map +1 -0
  579. package/dist/security/manifest/plugins/swift.d.ts +11 -0
  580. package/dist/security/manifest/plugins/swift.d.ts.map +1 -0
  581. package/dist/security/owasp.d.ts +16 -0
  582. package/dist/security/owasp.d.ts.map +1 -0
  583. package/dist/security/pipeline.d.ts +37 -0
  584. package/dist/security/pipeline.d.ts.map +1 -0
  585. package/dist/security/reachability.d.ts +67 -0
  586. package/dist/security/reachability.d.ts.map +1 -0
  587. package/dist/security/remediation.d.ts +51 -0
  588. package/dist/security/remediation.d.ts.map +1 -0
  589. package/dist/security/secrets.d.ts +38 -0
  590. package/dist/security/secrets.d.ts.map +1 -0
  591. package/dist/security/staleness.d.ts +43 -0
  592. package/dist/security/staleness.d.ts.map +1 -0
  593. package/dist/security/supply-chain.d.ts +34 -0
  594. package/dist/security/supply-chain.d.ts.map +1 -0
  595. package/dist/security/suppressions.d.ts +18 -0
  596. package/dist/security/suppressions.d.ts.map +1 -0
  597. package/dist/security/types.d.ts +144 -0
  598. package/dist/security/types.d.ts.map +1 -0
  599. package/dist/security/vuln/client.d.ts +90 -0
  600. package/dist/security/vuln/client.d.ts.map +1 -0
  601. package/dist/security/vuln/client.js.map +2 -2
  602. package/dist/security/vuln/epss-client.d.ts +26 -0
  603. package/dist/security/vuln/epss-client.d.ts.map +1 -0
  604. package/dist/security/vuln/index.d.ts +6 -0
  605. package/dist/security/vuln/index.d.ts.map +1 -0
  606. package/dist/security/vuln/osv-adapter.d.ts +58 -0
  607. package/dist/security/vuln/osv-adapter.d.ts.map +1 -0
  608. package/dist/security/vuln/types.d.ts +29 -0
  609. package/dist/security/vuln/types.d.ts.map +1 -0
  610. package/dist/sync/index.d.ts +4 -2
  611. package/dist/sync/index.d.ts.map +1 -1
  612. package/dist/types.d.ts +10 -4
  613. package/dist/types.d.ts.map +1 -1
  614. package/dist/types.js.map +1 -1
  615. package/dist/vectors/index.d.ts +11 -3
  616. package/dist/vectors/index.d.ts.map +1 -1
  617. package/dist/vectors/qdrant-index.d.ts +10 -3
  618. package/dist/vectors/qdrant-index.d.ts.map +1 -1
  619. package/dist/vectors/typesense-index.d.ts.map +1 -1
  620. package/dist/watchmen/index.js +83 -0
  621. package/dist/watchmen/index.js.map +7 -0
  622. package/dist/watchmen/synthesize.js +475 -0
  623. package/dist/watchmen/synthesize.js.map +7 -0
  624. package/package.json +5 -2
  625. package/dist/security/context-warnings.test.js +0 -300
  626. package/dist/security/context-warnings.test.js.map +0 -7
  627. package/dist/security/export/fix-suggestions.test.js +0 -74
  628. package/dist/security/export/fix-suggestions.test.js.map +0 -7
  629. package/dist/security/export/sbom.test.js +0 -288
  630. package/dist/security/export/sbom.test.js.map +0 -7
  631. package/dist/security/export/serialization.test.js +0 -310
  632. package/dist/security/export/serialization.test.js.map +0 -7
  633. package/dist/security/export/vex.test.js +0 -278
  634. package/dist/security/export/vex.test.js.map +0 -7
  635. package/dist/security/integrator-transitives.test.js +0 -359
  636. package/dist/security/integrator-transitives.test.js.map +0 -7
  637. package/dist/security/integrator.test.js +0 -237
  638. package/dist/security/integrator.test.js.map +0 -7
  639. package/dist/security/manifest/adapter.test.js +0 -272
  640. package/dist/security/manifest/adapter.test.js.map +0 -7
  641. package/dist/security/manifest/parser.test.js +0 -110
  642. package/dist/security/manifest/parser.test.js.map +0 -7
  643. package/dist/security/manifest/plugins/cargo.test.js +0 -304
  644. package/dist/security/manifest/plugins/cargo.test.js.map +0 -7
  645. package/dist/security/manifest/plugins/go.test.js +0 -341
  646. package/dist/security/manifest/plugins/go.test.js.map +0 -7
  647. package/dist/security/manifest/plugins/maven.test.js +0 -389
  648. package/dist/security/manifest/plugins/maven.test.js.map +0 -7
  649. package/dist/security/manifest/plugins/npm.test.js +0 -298
  650. package/dist/security/manifest/plugins/npm.test.js.map +0 -7
  651. package/dist/security/manifest/plugins/pip.test.js +0 -208
  652. package/dist/security/manifest/plugins/pip.test.js.map +0 -7
  653. package/dist/security/reachability.test.js +0 -394
  654. package/dist/security/reachability.test.js.map +0 -7
  655. package/dist/security/vuln/client.test.js +0 -288
  656. package/dist/security/vuln/client.test.js.map +0 -7
  657. package/dist/security/vuln/osv-adapter.test.js +0 -391
  658. package/dist/security/vuln/osv-adapter.test.js.map +0 -7
@@ -1,359 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
- var import_vitest = require("vitest");
25
- var fs = __toESM(require("fs"));
26
- var path = __toESM(require("path"));
27
- var os = __toESM(require("os"));
28
- var import_integrator = require("./integrator");
29
- var import_database = require("../db/database");
30
- (0, import_vitest.describe)("DependencyGraphIntegrator.resolveTransitives()", () => {
31
- let db;
32
- let tmpDir;
33
- (0, import_vitest.beforeEach)(() => {
34
- tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "kirograph-transitives-test-"));
35
- db = new import_database.GraphDatabase(tmpDir);
36
- db.applySecuritySchema();
37
- });
38
- (0, import_vitest.afterEach)(() => {
39
- db.close();
40
- fs.rmSync(tmpDir, { recursive: true, force: true });
41
- });
42
- function createDepNode(name, ecosystem, version) {
43
- const nodeId = `dep:${ecosystem}:${name}`;
44
- const rawDb = db.getRawDb();
45
- const node = {
46
- id: nodeId,
47
- kind: "dependency",
48
- name,
49
- qualifiedName: `${ecosystem}/${name}`,
50
- filePath: "package.json",
51
- language: "unknown",
52
- startLine: 0,
53
- endLine: 0,
54
- startColumn: 0,
55
- endColumn: 0,
56
- isExported: false,
57
- isAsync: false,
58
- isStatic: false,
59
- isAbstract: false,
60
- updatedAt: Date.now()
61
- };
62
- db.upsertNode(node);
63
- rawDb.run(
64
- `INSERT OR REPLACE INTO sec_dependencies
65
- (node_id, ecosystem, package_name, declared_constraint,
66
- resolved_version, scope, source_manifests)
67
- VALUES (?, ?, ?, ?, ?, ?, ?)`,
68
- [
69
- nodeId,
70
- ecosystem,
71
- name,
72
- version ?? "^1.0.0",
73
- version ?? "1.0.0",
74
- "production",
75
- '["package.json"]'
76
- ]
77
- );
78
- return nodeId;
79
- }
80
- (0, import_vitest.it)("should create depends_on edges from npm package-lock.json", async () => {
81
- createDepNode("express", "npm");
82
- createDepNode("body-parser", "npm");
83
- createDepNode("accepts", "npm");
84
- const lockData = {
85
- name: "test-project",
86
- lockfileVersion: 3,
87
- packages: {
88
- "": { name: "test-project", version: "1.0.0" },
89
- "node_modules/express": {
90
- version: "4.18.2",
91
- dependencies: { "body-parser": "^1.20.0", accepts: "~1.3.8" }
92
- },
93
- "node_modules/body-parser": {
94
- version: "1.20.2",
95
- dependencies: {}
96
- },
97
- "node_modules/accepts": {
98
- version: "1.3.8",
99
- dependencies: {}
100
- }
101
- }
102
- };
103
- fs.writeFileSync(
104
- path.join(tmpDir, "package-lock.json"),
105
- JSON.stringify(lockData, null, 2)
106
- );
107
- const integrator = new import_integrator.DependencyGraphIntegrator(db, tmpDir);
108
- const result = await integrator.resolveTransitives(10);
109
- (0, import_vitest.expect)(result.dependsOnEdgesCreated).toBe(2);
110
- (0, import_vitest.expect)(result.incompleteNodes).toHaveLength(0);
111
- const edges = db.getAllEdges();
112
- const dependsOnEdges = edges.filter((e) => e.kind === "depends_on");
113
- (0, import_vitest.expect)(dependsOnEdges).toHaveLength(2);
114
- (0, import_vitest.expect)(dependsOnEdges).toContainEqual(
115
- import_vitest.expect.objectContaining({
116
- source: "dep:npm:express",
117
- target: "dep:npm:body-parser",
118
- kind: "depends_on"
119
- })
120
- );
121
- (0, import_vitest.expect)(dependsOnEdges).toContainEqual(
122
- import_vitest.expect.objectContaining({
123
- source: "dep:npm:express",
124
- target: "dep:npm:accepts",
125
- kind: "depends_on"
126
- })
127
- );
128
- });
129
- (0, import_vitest.it)("should mark dependencies as incomplete when no lock file exists", async () => {
130
- createDepNode("serde", "cargo");
131
- createDepNode("tokio", "cargo");
132
- const integrator = new import_integrator.DependencyGraphIntegrator(db, tmpDir);
133
- const result = await integrator.resolveTransitives(10);
134
- (0, import_vitest.expect)(result.dependsOnEdgesCreated).toBe(0);
135
- (0, import_vitest.expect)(result.incompleteNodes).toHaveLength(2);
136
- (0, import_vitest.expect)(result.incompleteNodes).toContain("dep:cargo:serde");
137
- (0, import_vitest.expect)(result.incompleteNodes).toContain("dep:cargo:tokio");
138
- const rawDb = db.getRawDb();
139
- const row = rawDb.get(
140
- "SELECT transitive_status FROM sec_dependencies WHERE node_id = ?",
141
- ["dep:cargo:serde"]
142
- );
143
- (0, import_vitest.expect)(row.transitive_status).toBe("incomplete");
144
- });
145
- (0, import_vitest.it)("should respect maxDepth limit", async () => {
146
- createDepNode("a", "npm");
147
- createDepNode("b", "npm");
148
- createDepNode("c", "npm");
149
- createDepNode("d", "npm");
150
- const lockData = {
151
- name: "test-project",
152
- lockfileVersion: 3,
153
- packages: {
154
- "": { name: "test-project", version: "1.0.0" },
155
- "node_modules/a": {
156
- version: "1.0.0",
157
- dependencies: { b: "^1.0.0" }
158
- },
159
- "node_modules/b": {
160
- version: "1.0.0",
161
- dependencies: { c: "^1.0.0" }
162
- },
163
- "node_modules/c": {
164
- version: "1.0.0",
165
- dependencies: { d: "^1.0.0" }
166
- },
167
- "node_modules/d": {
168
- version: "1.0.0",
169
- dependencies: {}
170
- }
171
- }
172
- };
173
- fs.writeFileSync(
174
- path.join(tmpDir, "package-lock.json"),
175
- JSON.stringify(lockData, null, 2)
176
- );
177
- const integrator = new import_integrator.DependencyGraphIntegrator(db, tmpDir);
178
- const result = await integrator.resolveTransitives(1);
179
- (0, import_vitest.expect)(result.dependsOnEdgesCreated).toBe(3);
180
- const edges = db.getAllEdges();
181
- const dependsOnEdges = edges.filter((e) => e.kind === "depends_on");
182
- const edgePairs = dependsOnEdges.map((e) => `${e.source}->${e.target}`);
183
- (0, import_vitest.expect)(edgePairs).toContain("dep:npm:a->dep:npm:b");
184
- (0, import_vitest.expect)(edgePairs).toContain("dep:npm:b->dep:npm:c");
185
- (0, import_vitest.expect)(edgePairs).toContain("dep:npm:c->dep:npm:d");
186
- (0, import_vitest.expect)(edgePairs).not.toContain("dep:npm:a->dep:npm:c");
187
- (0, import_vitest.expect)(edgePairs).not.toContain("dep:npm:a->dep:npm:d");
188
- });
189
- (0, import_vitest.it)("should handle Cargo.lock transitive dependencies", async () => {
190
- createDepNode("serde", "cargo");
191
- createDepNode("serde_derive", "cargo");
192
- const cargoLock = `[[package]]
193
- name = "serde"
194
- version = "1.0.193"
195
- dependencies = [
196
- "serde_derive",
197
- ]
198
-
199
- [[package]]
200
- name = "serde_derive"
201
- version = "1.0.193"
202
- `;
203
- fs.writeFileSync(path.join(tmpDir, "Cargo.lock"), cargoLock);
204
- const integrator = new import_integrator.DependencyGraphIntegrator(db, tmpDir);
205
- const result = await integrator.resolveTransitives(10);
206
- (0, import_vitest.expect)(result.dependsOnEdgesCreated).toBe(1);
207
- (0, import_vitest.expect)(result.incompleteNodes).toHaveLength(0);
208
- const edges = db.getAllEdges();
209
- const dependsOnEdges = edges.filter((e) => e.kind === "depends_on");
210
- (0, import_vitest.expect)(dependsOnEdges).toContainEqual(
211
- import_vitest.expect.objectContaining({
212
- source: "dep:cargo:serde",
213
- target: "dep:cargo:serde_derive",
214
- kind: "depends_on"
215
- })
216
- );
217
- });
218
- (0, import_vitest.it)("should mark Go dependencies as incomplete (no tree in go.sum)", async () => {
219
- createDepNode("github.com/gin-gonic/gin", "go");
220
- fs.writeFileSync(
221
- path.join(tmpDir, "go.sum"),
222
- "github.com/gin-gonic/gin v1.9.1 h1:abc=\n"
223
- );
224
- const integrator = new import_integrator.DependencyGraphIntegrator(db, tmpDir);
225
- const result = await integrator.resolveTransitives(10);
226
- (0, import_vitest.expect)(result.dependsOnEdgesCreated).toBe(0);
227
- (0, import_vitest.expect)(result.incompleteNodes).toHaveLength(1);
228
- (0, import_vitest.expect)(result.incompleteNodes).toContain("dep:go:github.com/gin-gonic/gin");
229
- });
230
- (0, import_vitest.it)("should return empty result when no dependencies exist", async () => {
231
- const integrator = new import_integrator.DependencyGraphIntegrator(db, tmpDir);
232
- const result = await integrator.resolveTransitives(10);
233
- (0, import_vitest.expect)(result.dependsOnEdgesCreated).toBe(0);
234
- (0, import_vitest.expect)(result.incompleteNodes).toHaveLength(0);
235
- });
236
- (0, import_vitest.it)("should not create duplicate depends_on edges", async () => {
237
- createDepNode("express", "npm");
238
- createDepNode("body-parser", "npm");
239
- const lockData = {
240
- name: "test-project",
241
- lockfileVersion: 3,
242
- packages: {
243
- "": { name: "test-project", version: "1.0.0" },
244
- "node_modules/express": {
245
- version: "4.18.2",
246
- dependencies: { "body-parser": "^1.20.0" }
247
- },
248
- "node_modules/body-parser": {
249
- version: "1.20.2",
250
- dependencies: {}
251
- }
252
- }
253
- };
254
- fs.writeFileSync(
255
- path.join(tmpDir, "package-lock.json"),
256
- JSON.stringify(lockData, null, 2)
257
- );
258
- const integrator = new import_integrator.DependencyGraphIntegrator(db, tmpDir);
259
- const result = await integrator.resolveTransitives(10);
260
- (0, import_vitest.expect)(result.dependsOnEdgesCreated).toBe(1);
261
- const edges = db.getAllEdges();
262
- const dependsOnEdges = edges.filter((e) => e.kind === "depends_on");
263
- (0, import_vitest.expect)(dependsOnEdges).toHaveLength(1);
264
- });
265
- (0, import_vitest.it)("should handle npm lockfileVersion 1 format", async () => {
266
- createDepNode("express", "npm");
267
- createDepNode("debug", "npm");
268
- const lockData = {
269
- name: "test-project",
270
- lockfileVersion: 1,
271
- dependencies: {
272
- express: {
273
- version: "4.18.2",
274
- requires: { debug: "2.6.9" }
275
- },
276
- debug: {
277
- version: "2.6.9"
278
- }
279
- }
280
- };
281
- fs.writeFileSync(
282
- path.join(tmpDir, "package-lock.json"),
283
- JSON.stringify(lockData, null, 2)
284
- );
285
- const integrator = new import_integrator.DependencyGraphIntegrator(db, tmpDir);
286
- const result = await integrator.resolveTransitives(10);
287
- (0, import_vitest.expect)(result.dependsOnEdgesCreated).toBe(1);
288
- const edges = db.getAllEdges();
289
- const dependsOnEdges = edges.filter((e) => e.kind === "depends_on");
290
- (0, import_vitest.expect)(dependsOnEdges).toContainEqual(
291
- import_vitest.expect.objectContaining({
292
- source: "dep:npm:express",
293
- target: "dep:npm:debug",
294
- kind: "depends_on"
295
- })
296
- );
297
- });
298
- (0, import_vitest.it)("should handle deep transitive chains with maxDepth=10", async () => {
299
- createDepNode("a", "npm");
300
- createDepNode("b", "npm");
301
- createDepNode("c", "npm");
302
- createDepNode("d", "npm");
303
- createDepNode("e", "npm");
304
- const lockData = {
305
- name: "test-project",
306
- lockfileVersion: 3,
307
- packages: {
308
- "": { name: "test-project", version: "1.0.0" },
309
- "node_modules/a": { version: "1.0.0", dependencies: { b: "1.0.0" } },
310
- "node_modules/b": { version: "1.0.0", dependencies: { c: "1.0.0" } },
311
- "node_modules/c": { version: "1.0.0", dependencies: { d: "1.0.0" } },
312
- "node_modules/d": { version: "1.0.0", dependencies: { e: "1.0.0" } },
313
- "node_modules/e": { version: "1.0.0", dependencies: {} }
314
- }
315
- };
316
- fs.writeFileSync(
317
- path.join(tmpDir, "package-lock.json"),
318
- JSON.stringify(lockData, null, 2)
319
- );
320
- const integrator = new import_integrator.DependencyGraphIntegrator(db, tmpDir);
321
- const result = await integrator.resolveTransitives(10);
322
- (0, import_vitest.expect)(result.dependsOnEdgesCreated).toBe(4);
323
- (0, import_vitest.expect)(result.incompleteNodes).toHaveLength(0);
324
- });
325
- (0, import_vitest.it)("should handle circular dependencies in lock file gracefully", async () => {
326
- createDepNode("a", "npm");
327
- createDepNode("b", "npm");
328
- const lockData = {
329
- name: "test-project",
330
- lockfileVersion: 3,
331
- packages: {
332
- "": { name: "test-project", version: "1.0.0" },
333
- "node_modules/a": { version: "1.0.0", dependencies: { b: "1.0.0" } },
334
- "node_modules/b": { version: "1.0.0", dependencies: { a: "1.0.0" } }
335
- }
336
- };
337
- fs.writeFileSync(
338
- path.join(tmpDir, "package-lock.json"),
339
- JSON.stringify(lockData, null, 2)
340
- );
341
- const integrator = new import_integrator.DependencyGraphIntegrator(db, tmpDir);
342
- const result = await integrator.resolveTransitives(10);
343
- (0, import_vitest.expect)(result.dependsOnEdgesCreated).toBe(2);
344
- (0, import_vitest.expect)(result.incompleteNodes).toHaveLength(0);
345
- });
346
- (0, import_vitest.it)("should log warning with dependency name when marking incomplete", async () => {
347
- createDepNode("flask", "python");
348
- const integrator = new import_integrator.DependencyGraphIntegrator(db, tmpDir);
349
- const result = await integrator.resolveTransitives(10);
350
- (0, import_vitest.expect)(result.incompleteNodes).toContain("dep:python:flask");
351
- const rawDb = db.getRawDb();
352
- const row = rawDb.get(
353
- "SELECT transitive_status FROM sec_dependencies WHERE node_id = ?",
354
- ["dep:python:flask"]
355
- );
356
- (0, import_vitest.expect)(row.transitive_status).toBe("incomplete");
357
- });
358
- });
359
- //# sourceMappingURL=integrator-transitives.test.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/security/integrator-transitives.test.ts"],
4
- "sourcesContent": ["/**\n * Tests for DependencyGraphIntegrator.resolveTransitives()\n *\n * Verifies transitive dependency resolution from lock files,\n * creation of depends_on edges, and incomplete status marking.\n *\n * Requirements: 2.3, 2.5\n */\nimport { describe, it, expect, beforeEach, afterEach } from 'vitest';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\nimport { DependencyGraphIntegrator } from './integrator';\nimport { GraphDatabase } from '../db/database';\nimport type { Node, Edge } from '../types';\n\ndescribe('DependencyGraphIntegrator.resolveTransitives()', () => {\n let db: GraphDatabase;\n let tmpDir: string;\n\n beforeEach(() => {\n tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'kirograph-transitives-test-'));\n db = new GraphDatabase(tmpDir);\n db.applySecuritySchema();\n });\n\n afterEach(() => {\n db.close();\n fs.rmSync(tmpDir, { recursive: true, force: true });\n });\n\n /**\n * Helper to create a dependency node in the database.\n */\n function createDepNode(\n name: string,\n ecosystem: string,\n version?: string,\n ): string {\n const nodeId = `dep:${ecosystem}:${name}`;\n const rawDb = db.getRawDb();\n\n const node: Node = {\n id: nodeId,\n kind: 'dependency',\n name,\n qualifiedName: `${ecosystem}/${name}`,\n filePath: 'package.json',\n language: 'unknown',\n startLine: 0,\n endLine: 0,\n startColumn: 0,\n endColumn: 0,\n isExported: false,\n isAsync: false,\n isStatic: false,\n isAbstract: false,\n updatedAt: Date.now(),\n };\n db.upsertNode(node);\n\n rawDb.run(\n `INSERT OR REPLACE INTO sec_dependencies\n (node_id, ecosystem, package_name, declared_constraint,\n resolved_version, scope, source_manifests)\n VALUES (?, ?, ?, ?, ?, ?, ?)`,\n [\n nodeId,\n ecosystem,\n name,\n version ?? '^1.0.0',\n version ?? '1.0.0',\n 'production',\n '[\"package.json\"]',\n ],\n );\n return nodeId;\n }\n\n it('should create depends_on edges from npm package-lock.json', async () => {\n createDepNode('express', 'npm');\n createDepNode('body-parser', 'npm');\n createDepNode('accepts', 'npm');\n\n // Create a package-lock.json with transitive relationships\n const lockData = {\n name: 'test-project',\n lockfileVersion: 3,\n packages: {\n '': { name: 'test-project', version: '1.0.0' },\n 'node_modules/express': {\n version: '4.18.2',\n dependencies: { 'body-parser': '^1.20.0', accepts: '~1.3.8' },\n },\n 'node_modules/body-parser': {\n version: '1.20.2',\n dependencies: {},\n },\n 'node_modules/accepts': {\n version: '1.3.8',\n dependencies: {},\n },\n },\n };\n fs.writeFileSync(\n path.join(tmpDir, 'package-lock.json'),\n JSON.stringify(lockData, null, 2),\n );\n\n const integrator = new DependencyGraphIntegrator(db, tmpDir);\n const result = await integrator.resolveTransitives(10);\n\n expect(result.dependsOnEdgesCreated).toBe(2);\n expect(result.incompleteNodes).toHaveLength(0);\n\n // Verify edges exist\n const edges = db.getAllEdges();\n const dependsOnEdges = edges.filter(e => e.kind === 'depends_on');\n expect(dependsOnEdges).toHaveLength(2);\n\n // express depends_on body-parser\n expect(dependsOnEdges).toContainEqual(\n expect.objectContaining({\n source: 'dep:npm:express',\n target: 'dep:npm:body-parser',\n kind: 'depends_on',\n }),\n );\n // express depends_on accepts\n expect(dependsOnEdges).toContainEqual(\n expect.objectContaining({\n source: 'dep:npm:express',\n target: 'dep:npm:accepts',\n kind: 'depends_on',\n }),\n );\n });\n\n it('should mark dependencies as incomplete when no lock file exists', async () => {\n createDepNode('serde', 'cargo');\n createDepNode('tokio', 'cargo');\n\n // No Cargo.lock in tmpDir\n const integrator = new DependencyGraphIntegrator(db, tmpDir);\n const result = await integrator.resolveTransitives(10);\n\n expect(result.dependsOnEdgesCreated).toBe(0);\n expect(result.incompleteNodes).toHaveLength(2);\n expect(result.incompleteNodes).toContain('dep:cargo:serde');\n expect(result.incompleteNodes).toContain('dep:cargo:tokio');\n\n // Verify transitive_status is set to incomplete in the database\n const rawDb = db.getRawDb();\n const row = rawDb.get(\n 'SELECT transitive_status FROM sec_dependencies WHERE node_id = ?',\n ['dep:cargo:serde'],\n );\n expect(row.transitive_status).toBe('incomplete');\n });\n\n it('should respect maxDepth limit', async () => {\n // Create a chain: a -> b -> c -> d\n createDepNode('a', 'npm');\n createDepNode('b', 'npm');\n createDepNode('c', 'npm');\n createDepNode('d', 'npm');\n\n const lockData = {\n name: 'test-project',\n lockfileVersion: 3,\n packages: {\n '': { name: 'test-project', version: '1.0.0' },\n 'node_modules/a': {\n version: '1.0.0',\n dependencies: { b: '^1.0.0' },\n },\n 'node_modules/b': {\n version: '1.0.0',\n dependencies: { c: '^1.0.0' },\n },\n 'node_modules/c': {\n version: '1.0.0',\n dependencies: { d: '^1.0.0' },\n },\n 'node_modules/d': {\n version: '1.0.0',\n dependencies: {},\n },\n },\n };\n fs.writeFileSync(\n path.join(tmpDir, 'package-lock.json'),\n JSON.stringify(lockData, null, 2),\n );\n\n // With maxDepth=1, each node resolves only 1 level of its own transitives\n const integrator = new DependencyGraphIntegrator(db, tmpDir);\n const result = await integrator.resolveTransitives(1);\n\n // a->b (depth 1 from a), b->c (depth 1 from b), c->d (depth 1 from c)\n expect(result.dependsOnEdgesCreated).toBe(3);\n\n // Verify that deeper transitive edges are NOT created\n // (e.g., a should NOT have a depends_on edge to c or d)\n const edges = db.getAllEdges();\n const dependsOnEdges = edges.filter(e => e.kind === 'depends_on');\n\n // Only direct transitive edges should exist\n const edgePairs = dependsOnEdges.map(e => `${e.source}->${e.target}`);\n expect(edgePairs).toContain('dep:npm:a->dep:npm:b');\n expect(edgePairs).toContain('dep:npm:b->dep:npm:c');\n expect(edgePairs).toContain('dep:npm:c->dep:npm:d');\n // a should NOT directly depend on c or d at depth 1\n expect(edgePairs).not.toContain('dep:npm:a->dep:npm:c');\n expect(edgePairs).not.toContain('dep:npm:a->dep:npm:d');\n });\n\n it('should handle Cargo.lock transitive dependencies', async () => {\n createDepNode('serde', 'cargo');\n createDepNode('serde_derive', 'cargo');\n\n // Create a Cargo.lock with dependency relationships\n const cargoLock = `[[package]]\nname = \"serde\"\nversion = \"1.0.193\"\ndependencies = [\n \"serde_derive\",\n]\n\n[[package]]\nname = \"serde_derive\"\nversion = \"1.0.193\"\n`;\n fs.writeFileSync(path.join(tmpDir, 'Cargo.lock'), cargoLock);\n\n const integrator = new DependencyGraphIntegrator(db, tmpDir);\n const result = await integrator.resolveTransitives(10);\n\n expect(result.dependsOnEdgesCreated).toBe(1);\n expect(result.incompleteNodes).toHaveLength(0);\n\n const edges = db.getAllEdges();\n const dependsOnEdges = edges.filter(e => e.kind === 'depends_on');\n expect(dependsOnEdges).toContainEqual(\n expect.objectContaining({\n source: 'dep:cargo:serde',\n target: 'dep:cargo:serde_derive',\n kind: 'depends_on',\n }),\n );\n });\n\n it('should mark Go dependencies as incomplete (no tree in go.sum)', async () => {\n createDepNode('github.com/gin-gonic/gin', 'go');\n\n // Create a go.sum file (doesn't encode dependency tree)\n fs.writeFileSync(\n path.join(tmpDir, 'go.sum'),\n 'github.com/gin-gonic/gin v1.9.1 h1:abc=\\n',\n );\n\n const integrator = new DependencyGraphIntegrator(db, tmpDir);\n const result = await integrator.resolveTransitives(10);\n\n expect(result.dependsOnEdgesCreated).toBe(0);\n expect(result.incompleteNodes).toHaveLength(1);\n expect(result.incompleteNodes).toContain('dep:go:github.com/gin-gonic/gin');\n });\n\n it('should return empty result when no dependencies exist', async () => {\n const integrator = new DependencyGraphIntegrator(db, tmpDir);\n const result = await integrator.resolveTransitives(10);\n\n expect(result.dependsOnEdgesCreated).toBe(0);\n expect(result.incompleteNodes).toHaveLength(0);\n });\n\n it('should not create duplicate depends_on edges', async () => {\n createDepNode('express', 'npm');\n createDepNode('body-parser', 'npm');\n\n const lockData = {\n name: 'test-project',\n lockfileVersion: 3,\n packages: {\n '': { name: 'test-project', version: '1.0.0' },\n 'node_modules/express': {\n version: '4.18.2',\n dependencies: { 'body-parser': '^1.20.0' },\n },\n 'node_modules/body-parser': {\n version: '1.20.2',\n dependencies: {},\n },\n },\n };\n fs.writeFileSync(\n path.join(tmpDir, 'package-lock.json'),\n JSON.stringify(lockData, null, 2),\n );\n\n const integrator = new DependencyGraphIntegrator(db, tmpDir);\n const result = await integrator.resolveTransitives(10);\n\n expect(result.dependsOnEdgesCreated).toBe(1);\n\n // Verify only one edge exists\n const edges = db.getAllEdges();\n const dependsOnEdges = edges.filter(e => e.kind === 'depends_on');\n expect(dependsOnEdges).toHaveLength(1);\n });\n\n it('should handle npm lockfileVersion 1 format', async () => {\n createDepNode('express', 'npm');\n createDepNode('debug', 'npm');\n\n const lockData = {\n name: 'test-project',\n lockfileVersion: 1,\n dependencies: {\n express: {\n version: '4.18.2',\n requires: { debug: '2.6.9' },\n },\n debug: {\n version: '2.6.9',\n },\n },\n };\n fs.writeFileSync(\n path.join(tmpDir, 'package-lock.json'),\n JSON.stringify(lockData, null, 2),\n );\n\n const integrator = new DependencyGraphIntegrator(db, tmpDir);\n const result = await integrator.resolveTransitives(10);\n\n expect(result.dependsOnEdgesCreated).toBe(1);\n\n const edges = db.getAllEdges();\n const dependsOnEdges = edges.filter(e => e.kind === 'depends_on');\n expect(dependsOnEdges).toContainEqual(\n expect.objectContaining({\n source: 'dep:npm:express',\n target: 'dep:npm:debug',\n kind: 'depends_on',\n }),\n );\n });\n\n it('should handle deep transitive chains with maxDepth=10', async () => {\n // Create a chain of 5 dependencies: a -> b -> c -> d -> e\n createDepNode('a', 'npm');\n createDepNode('b', 'npm');\n createDepNode('c', 'npm');\n createDepNode('d', 'npm');\n createDepNode('e', 'npm');\n\n const lockData = {\n name: 'test-project',\n lockfileVersion: 3,\n packages: {\n '': { name: 'test-project', version: '1.0.0' },\n 'node_modules/a': { version: '1.0.0', dependencies: { b: '1.0.0' } },\n 'node_modules/b': { version: '1.0.0', dependencies: { c: '1.0.0' } },\n 'node_modules/c': { version: '1.0.0', dependencies: { d: '1.0.0' } },\n 'node_modules/d': { version: '1.0.0', dependencies: { e: '1.0.0' } },\n 'node_modules/e': { version: '1.0.0', dependencies: {} },\n },\n };\n fs.writeFileSync(\n path.join(tmpDir, 'package-lock.json'),\n JSON.stringify(lockData, null, 2),\n );\n\n const integrator = new DependencyGraphIntegrator(db, tmpDir);\n const result = await integrator.resolveTransitives(10);\n\n // All edges in the chain should be created\n expect(result.dependsOnEdgesCreated).toBe(4);\n expect(result.incompleteNodes).toHaveLength(0);\n });\n\n it('should handle circular dependencies in lock file gracefully', async () => {\n createDepNode('a', 'npm');\n createDepNode('b', 'npm');\n\n // a depends on b, b depends on a (circular)\n const lockData = {\n name: 'test-project',\n lockfileVersion: 3,\n packages: {\n '': { name: 'test-project', version: '1.0.0' },\n 'node_modules/a': { version: '1.0.0', dependencies: { b: '1.0.0' } },\n 'node_modules/b': { version: '1.0.0', dependencies: { a: '1.0.0' } },\n },\n };\n fs.writeFileSync(\n path.join(tmpDir, 'package-lock.json'),\n JSON.stringify(lockData, null, 2),\n );\n\n const integrator = new DependencyGraphIntegrator(db, tmpDir);\n const result = await integrator.resolveTransitives(10);\n\n // Should create edges without infinite loop\n expect(result.dependsOnEdgesCreated).toBe(2);\n expect(result.incompleteNodes).toHaveLength(0);\n });\n\n it('should log warning with dependency name when marking incomplete', async () => {\n createDepNode('flask', 'python');\n\n // No pip lock file exists\n const integrator = new DependencyGraphIntegrator(db, tmpDir);\n const result = await integrator.resolveTransitives(10);\n\n expect(result.incompleteNodes).toContain('dep:python:flask');\n\n // Verify the database was updated\n const rawDb = db.getRawDb();\n const row = rawDb.get(\n 'SELECT transitive_status FROM sec_dependencies WHERE node_id = ?',\n ['dep:python:flask'],\n );\n expect(row.transitive_status).toBe('incomplete');\n });\n});\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAQA,oBAA4D;AAC5D,SAAoB;AACpB,WAAsB;AACtB,SAAoB;AACpB,wBAA0C;AAC1C,sBAA8B;AAAA,IAG9B,wBAAS,kDAAkD,MAAM;AAC/D,MAAI;AACJ,MAAI;AAEJ,gCAAW,MAAM;AACf,aAAS,GAAG,YAAY,KAAK,KAAK,GAAG,OAAO,GAAG,6BAA6B,CAAC;AAC7E,SAAK,IAAI,8BAAc,MAAM;AAC7B,OAAG,oBAAoB;AAAA,EACzB,CAAC;AAED,+BAAU,MAAM;AACd,OAAG,MAAM;AACT,OAAG,OAAO,QAAQ,EAAE,WAAW,MAAM,OAAO,KAAK,CAAC;AAAA,EACpD,CAAC;AAKD,WAAS,cACP,MACA,WACA,SACQ;AACR,UAAM,SAAS,OAAO,SAAS,IAAI,IAAI;AACvC,UAA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jB,UAAU;AAAA,QACR,IAAI,EAAE,MAAM,gBAAgB,SAAS,QAAQ;AAAA,QAC7C,kBAAkB,EAAE,SAAS,SAAS,cAAc,EAAE,GAAG,QAAQ,EAAE;AAAA,QACnE,kBAAkB,EAAE,SAAS,SAAS,cAAc,EAAE,GAAG,QAAQ,EAAE;AAAA,MACrE;AAAA,IACF;AACA,OAAG;AAAA,MACD,KAAK,KAAK,QAAQ,mBAAmB;AAAA,MACrC,KAAK,UAAU,UAAU,MAAM,CAAC;AAAA,IAClC;AAEA,UAAM,aAAa,IAAI,4CAA0B,IAAI,MAAM;AAC3D,UAAM,SAAS,MAAM,WAAW,mBAAmB,EAAE;AAGrD,8BAAO,OAAO,qBAAqB,EAAE,KAAK,CAAC;AAC3C,8BAAO,OAAO,eAAe,EAAE,aAAa,CAAC;AAAA,EAC/C,CAAC;AAED,wBAAG,mEAAmE,YAAY;AAChF,kBAAc,SAAS,QAAQ;AAG/B,UAAM,aAAa,IAAI,4CAA0B,IAAI,MAAM;AAC3D,UAAM,SAAS,MAAM,WAAW,mBAAmB,EAAE;AAErD,8BAAO,OAAO,eAAe,EAAE,UAAU,kBAAkB;AAG3D,UAAM,QAAQ,GAAG,SAAS;AAC1B,UAAM,MAAM,MAAM;AAAA,MAChB;AAAA,MACA,CAAC,kBAAkB;AAAA,IACrB;AACA,8BAAO,IAAI,iBAAiB,EAAE,KAAK,YAAY;AAAA,EACjD,CAAC;AACH,CAAC;",
6
- "names": []
7
- }
@@ -1,237 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
- var import_vitest = require("vitest");
25
- var fs = __toESM(require("fs"));
26
- var path = __toESM(require("path"));
27
- var os = __toESM(require("os"));
28
- var import_integrator = require("./integrator");
29
- var import_database = require("../db/database");
30
- (0, import_vitest.describe)("DependencyGraphIntegrator.cleanup()", () => {
31
- let db;
32
- let integrator;
33
- let tmpDir;
34
- const projectRoot = "/tmp/test-project";
35
- (0, import_vitest.beforeEach)(() => {
36
- tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "kirograph-integrator-test-"));
37
- db = new import_database.GraphDatabase(tmpDir);
38
- db.applySecuritySchema();
39
- integrator = new import_integrator.DependencyGraphIntegrator(db, projectRoot);
40
- });
41
- (0, import_vitest.afterEach)(() => {
42
- db.close();
43
- fs.rmSync(tmpDir, { recursive: true, force: true });
44
- });
45
- function createDependencyNode(name, ecosystem, sourceManifests, options) {
46
- const nodeId = `dep:${ecosystem}:${name}`;
47
- const rawDb = db.getRawDb();
48
- const node = {
49
- id: nodeId,
50
- kind: "dependency",
51
- name,
52
- qualifiedName: `${ecosystem}/${name}`,
53
- filePath: sourceManifests[0] ?? "",
54
- language: "unknown",
55
- startLine: 0,
56
- endLine: 0,
57
- startColumn: 0,
58
- endColumn: 0,
59
- isExported: false,
60
- isAsync: false,
61
- isStatic: false,
62
- isAbstract: false,
63
- updatedAt: Date.now()
64
- };
65
- db.upsertNode(node);
66
- rawDb.run(
67
- `INSERT OR REPLACE INTO sec_dependencies
68
- (node_id, ecosystem, package_name, declared_constraint, resolved_version, scope, source_manifests)
69
- VALUES (?, ?, ?, ?, ?, ?, ?)`,
70
- [nodeId, ecosystem, name, "^1.0.0", "1.0.0", "production", JSON.stringify(sourceManifests)]
71
- );
72
- if (options?.addDeclaredInEdge !== false) {
73
- for (const manifest of sourceManifests) {
74
- const edge = {
75
- source: nodeId,
76
- target: manifest,
77
- kind: "declared_in"
78
- };
79
- db.insertEdge(edge);
80
- }
81
- }
82
- return nodeId;
83
- }
84
- function createEdge(source, target, kind) {
85
- const edge = {
86
- source,
87
- target,
88
- kind
89
- };
90
- db.insertEdge(edge);
91
- }
92
- (0, import_vitest.it)("should return zero counts when no dependencies exist", async () => {
93
- const result = await integrator.cleanup(() => true);
94
- (0, import_vitest.expect)(result.nodesRemoved).toBe(0);
95
- (0, import_vitest.expect)(result.edgesRemoved).toBe(0);
96
- });
97
- (0, import_vitest.it)("should not remove dependencies whose manifests still exist and have declared_in edges", async () => {
98
- const manifestPath = "package.json";
99
- const nodeId = createDependencyNode("express", "npm", [manifestPath]);
100
- const manifestExists = () => true;
101
- const result = await integrator.cleanup(manifestExists);
102
- (0, import_vitest.expect)(result.nodesRemoved).toBe(0);
103
- (0, import_vitest.expect)(result.edgesRemoved).toBe(0);
104
- const node = db.getNode(nodeId);
105
- (0, import_vitest.expect)(node).not.toBeNull();
106
- });
107
- (0, import_vitest.it)("should remove dependencies with no declared_in edges", async () => {
108
- const manifestPath = "package.json";
109
- const nodeId = createDependencyNode("express", "npm", [manifestPath], {
110
- addDeclaredInEdge: false
111
- });
112
- const manifestExists = () => true;
113
- const result = await integrator.cleanup(manifestExists);
114
- (0, import_vitest.expect)(result.nodesRemoved).toBe(1);
115
- const node = db.getNode(nodeId);
116
- (0, import_vitest.expect)(node).toBeNull();
117
- });
118
- (0, import_vitest.it)("should remove dependencies whose manifests no longer exist on disk", async () => {
119
- const manifestPath = "package.json";
120
- const nodeId = createDependencyNode("express", "npm", [manifestPath]);
121
- const manifestExists = () => false;
122
- const result = await integrator.cleanup(manifestExists);
123
- (0, import_vitest.expect)(result.nodesRemoved).toBe(1);
124
- const node = db.getNode(nodeId);
125
- (0, import_vitest.expect)(node).toBeNull();
126
- });
127
- (0, import_vitest.it)("should remove edges connected to orphaned nodes", async () => {
128
- const manifestPath = "package.json";
129
- const depNodeId = createDependencyNode("lodash", "npm", [manifestPath], {
130
- addDeclaredInEdge: false
131
- });
132
- const codeNode = {
133
- id: "file:src/index.ts:import:lodash",
134
- kind: "import",
135
- name: "lodash",
136
- qualifiedName: "src/index.ts:lodash",
137
- filePath: "src/index.ts",
138
- language: "typescript",
139
- startLine: 1,
140
- endLine: 1,
141
- startColumn: 0,
142
- endColumn: 20,
143
- updatedAt: Date.now()
144
- };
145
- db.upsertNode(codeNode);
146
- createEdge(codeNode.id, depNodeId, "imports");
147
- const manifestExists = () => true;
148
- const result = await integrator.cleanup(manifestExists);
149
- (0, import_vitest.expect)(result.nodesRemoved).toBe(1);
150
- (0, import_vitest.expect)(result.edgesRemoved).toBe(1);
151
- });
152
- (0, import_vitest.it)("should keep dependency if at least one source manifest exists on disk", async () => {
153
- const manifests = ["packages/a/package.json", "packages/b/package.json"];
154
- const nodeId = createDependencyNode("react", "npm", manifests);
155
- const manifestExists = (p) => p.includes("packages/a/package.json");
156
- const result = await integrator.cleanup(manifestExists);
157
- (0, import_vitest.expect)(result.nodesRemoved).toBe(0);
158
- const node = db.getNode(nodeId);
159
- (0, import_vitest.expect)(node).not.toBeNull();
160
- });
161
- (0, import_vitest.it)("should remove transitive dependencies no longer reachable from direct deps", async () => {
162
- const manifest = "package.json";
163
- const directId = createDependencyNode("express", "npm", [manifest]);
164
- const reachableTransId = createDependencyNode("accepts", "npm", [manifest]);
165
- createEdge(directId, reachableTransId, "depends_on");
166
- const orphanedDirectId = createDependencyNode("lodash", "npm", ["old-package.json"], {
167
- addDeclaredInEdge: false
168
- });
169
- const unreachableTransId = createDependencyNode("lodash.merge", "npm", ["old-package.json"], {
170
- addDeclaredInEdge: false
171
- });
172
- createEdge(orphanedDirectId, unreachableTransId, "depends_on");
173
- const manifestExists = () => true;
174
- const result = await integrator.cleanup(manifestExists);
175
- (0, import_vitest.expect)(result.nodesRemoved).toBe(2);
176
- (0, import_vitest.expect)(db.getNode(directId)).not.toBeNull();
177
- (0, import_vitest.expect)(db.getNode(reachableTransId)).not.toBeNull();
178
- (0, import_vitest.expect)(db.getNode(orphanedDirectId)).toBeNull();
179
- (0, import_vitest.expect)(db.getNode(unreachableTransId)).toBeNull();
180
- });
181
- (0, import_vitest.it)("should handle transitive chains correctly \u2014 all reachable from direct dep", async () => {
182
- const manifest = "package.json";
183
- const directId = createDependencyNode("express", "npm", [manifest]);
184
- const bp = createDependencyNode("body-parser", "npm", [manifest]);
185
- const rb = createDependencyNode("raw-body", "npm", [manifest]);
186
- const bytes = createDependencyNode("bytes", "npm", [manifest]);
187
- createEdge(directId, bp, "depends_on");
188
- createEdge(bp, rb, "depends_on");
189
- createEdge(rb, bytes, "depends_on");
190
- const manifestExists = () => true;
191
- const result = await integrator.cleanup(manifestExists);
192
- (0, import_vitest.expect)(result.nodesRemoved).toBe(0);
193
- (0, import_vitest.expect)(result.edgesRemoved).toBe(0);
194
- });
195
- (0, import_vitest.it)("should count edges correctly when multiple edges connect to orphaned node", async () => {
196
- const orphanedManifest = "removed/package.json";
197
- const depId = createDependencyNode("old-pkg", "npm", [orphanedManifest], {
198
- addDeclaredInEdge: false
199
- });
200
- const codeNode1 = {
201
- id: "node:a",
202
- kind: "function",
203
- name: "funcA",
204
- qualifiedName: "funcA",
205
- filePath: "src/a.ts",
206
- language: "typescript",
207
- startLine: 1,
208
- endLine: 5,
209
- startColumn: 0,
210
- endColumn: 0,
211
- updatedAt: Date.now()
212
- };
213
- const codeNode2 = {
214
- id: "node:b",
215
- kind: "function",
216
- name: "funcB",
217
- qualifiedName: "funcB",
218
- filePath: "src/b.ts",
219
- language: "typescript",
220
- startLine: 1,
221
- endLine: 5,
222
- startColumn: 0,
223
- endColumn: 0,
224
- updatedAt: Date.now()
225
- };
226
- db.upsertNode(codeNode1);
227
- db.upsertNode(codeNode2);
228
- createEdge(codeNode1.id, depId, "imports");
229
- createEdge(codeNode2.id, depId, "references");
230
- createEdge(depId, "some-manifest", "declared_in");
231
- const manifestExists = () => false;
232
- const result = await integrator.cleanup(manifestExists);
233
- (0, import_vitest.expect)(result.nodesRemoved).toBe(1);
234
- (0, import_vitest.expect)(result.edgesRemoved).toBe(3);
235
- });
236
- });
237
- //# sourceMappingURL=integrator.test.js.map