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
package/dist/config.d.ts CHANGED
@@ -31,6 +31,96 @@ export interface KiroGraphConfig {
31
31
  * Example: { "api": ["src/routes/**", "src/controllers/**"] }
32
32
  */
33
33
  architectureLayers?: Record<string, string[]>;
34
+ /** Agent communication style injected at agentSpawn. Default: 'off'. */
35
+ cavemanMode: 'off' | 'lite' | 'full' | 'ultra';
36
+ /** Shell compression level for kirograph_exec. 'off' disables the hook/steering. Default: 'normal'. */
37
+ shellCompressionLevel: 'off' | 'normal' | 'aggressive' | 'ultra';
38
+ /**
39
+ * Number of pending (unindexed) files above which kirograph_status warns the agent.
40
+ * Set to 0 to disable the warning. Default: 10.
41
+ */
42
+ syncWarningThreshold: number;
43
+ /** Enable persistent cross-session memory. Default: false. */
44
+ enableMemory: boolean;
45
+ /** FTS/vector blend for memory search: 0 = FTS only, 1 = vector only. Default: 0.5. */
46
+ memorySearchAlpha: number;
47
+ /** Store uncompressed originals when caveman is on. Default: false. */
48
+ memoryKeepRaw: boolean;
49
+ /** Auto-prune threshold (max observations). 0 = no limit. Default: 10000. */
50
+ memoryMaxObservations: number;
51
+ /** Seconds of inactivity before auto-closing a session. Default: 7200. */
52
+ memorySessionTimeout: number;
53
+ /** Max observations shown in kirograph_context. Default: 3. */
54
+ memoryContextLimit: number;
55
+ /** Min relevance score to include memory in context. Default: 0.3. */
56
+ memoryContextThreshold: number;
57
+ /** Glob patterns for paths to never capture in memory. Default: []. */
58
+ memoryExcludePatterns: string[];
59
+ /** Enable documentation indexing and navigation. Default: false. */
60
+ enableDocs: boolean;
61
+ /** Glob patterns for documentation files to include. */
62
+ docsInclude: string[];
63
+ /** Glob patterns for documentation files to exclude. */
64
+ docsExclude: string[];
65
+ /** Enable auto-linking of doc sections to code symbols. Default: true. */
66
+ docsLinkCode: boolean;
67
+ /** Max doc sections to include in kirograph_context. 0 = disabled. Default: 0. */
68
+ docsContextLimit: number;
69
+ /** Min relevance score to include a doc section in context. Default: 0.3. */
70
+ docsContextThreshold: number;
71
+ /** Max file size for doc files (bytes). Default: 1MB. */
72
+ docsMaxFileSize: number;
73
+ /** Summarization strategy. Default: 'first-sentence'. */
74
+ docsSummarization: 'embedding' | 'first-sentence' | 'off';
75
+ /** Enable tabular data indexing and querying. Default: false. */
76
+ enableData: boolean;
77
+ /** Glob patterns for data files to include. */
78
+ dataInclude: string[];
79
+ /** Glob patterns for data files to exclude. */
80
+ dataExclude: string[];
81
+ /** Enable auto-linking of data files to code symbols. Default: true. */
82
+ dataLinkCode: boolean;
83
+ /** Max datasets to include in kirograph_context. 0 = disabled. Default: 0. */
84
+ dataContextLimit: number;
85
+ /** Max file size for data files (bytes). Default: 50MB. */
86
+ dataMaxFileSize: number;
87
+ /** Max rows to index per file. Default: 1,000,000. */
88
+ dataMaxRows: number;
89
+ /** Max rows returned per query. Default: 500. */
90
+ dataQueryLimit: number;
91
+ /** Max token budget per response. Default: 8000. */
92
+ dataMaxResponseTokens: number;
93
+ /** Enable security analysis (dependency scanning + vulnerability detection). Default: false. */
94
+ enableSecurity: boolean;
95
+ /** Vulnerability databases to query. Default: ['OSV']. */
96
+ securityDatabases: string[];
97
+ /** Enable AST-level structural pattern matching (SAST) during indexing. Default: false. */
98
+ enablePatterns: boolean;
99
+ /** Path to a directory of user-supplied YAML rule files. Merged with bundled library (user rules win on id conflict). Default: undefined. */
100
+ patternLibraryPath: string | undefined;
101
+ /** Minimum severity level for storing pattern matches during index-time analysis. Default: 'low'. */
102
+ patternSeverityThreshold: 'critical' | 'high' | 'medium' | 'low';
103
+ /** Auto-run vulnerability enrichment after manifest parsing. Default: true. */
104
+ securityAutoEnrich: boolean;
105
+ /** Max age in days for vulnerability data before showing a staleness warning. Default: 7. */
106
+ securityEnrichMaxAgeDays: number;
107
+ /**
108
+ * License policy for dependency compliance.
109
+ * deny: licenses to block (build fails / command exits non-zero).
110
+ * warn: licenses to flag as warnings.
111
+ * Patterns support wildcards: GPL-* matches GPL-2.0, GPL-3.0, etc.
112
+ * Default: { deny: [], warn: [] }.
113
+ */
114
+ securityLicensePolicy: {
115
+ deny: string[];
116
+ warn: string[];
117
+ };
118
+ /** Context budget governance settings. */
119
+ contextBudget?: {
120
+ maxTokensPerSession: number;
121
+ warnAt: number;
122
+ throttleAt: number;
123
+ };
34
124
  }
35
125
  /**
36
126
  * Returns false if the pattern is potentially dangerous (ReDoS risk) or too long.
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;IAExB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,QAAQ,GAAG,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAC;IAClG,kBAAkB,EAAE,OAAO,CAAC;IAC5B,eAAe,EAAE,OAAO,CAAC;IACzB,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACjD,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,wBAAwB,EAAE,MAAM,CAAC;IACjC,sFAAsF;IACtF,kBAAkB,EAAE,OAAO,CAAC;IAC5B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAC/C;AAmBD;;;GAGG;AACH,wBAAgB,W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aAAa,CAAC,EAAE;QACd,mBAAmB,EAAE,MAAM,CAAC;QAC5B,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AA8BD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAOpD;AAID,wBAAgB,mBAAmB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,eAAe,CAyD1E;AAID,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,eAAe,CA0V/D;AAiDD,wBAAsB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAgC9E;AAED,wBAAsB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAK5F;AAUD,wBAAsB,YAAY,CAChC,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,OAAO,CAAC,eAAe,CAAC,GAC9B,OAAO,CAAC,eAAe,CAAC,CAK1B;AAED,wBAAsB,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAM/F;AAED,wBAAsB,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAM/F;AAID,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAUnF"}
package/dist/config.js CHANGED
@@ -76,6 +76,10 @@ const KNOWN_FIELDS = /* @__PURE__ */ new Set([
76
76
  "memoryContextLimit",
77
77
  "memoryContextThreshold",
78
78
  "memoryExcludePatterns",
79
+ "enableWatchmen",
80
+ "watchmenThreshold",
81
+ "watchmenSynthesisMode",
82
+ "watchmenLocalModel",
79
83
  "enableDocs",
80
84
  "docsInclude",
81
85
  "docsExclude",
@@ -98,6 +102,9 @@ const KNOWN_FIELDS = /* @__PURE__ */ new Set([
98
102
  "securityAutoEnrich",
99
103
  "securityEnrichMaxAgeDays",
100
104
  "securityLicensePolicy",
105
+ "enablePatterns",
106
+ "patternLibraryPath",
107
+ "patternSeverityThreshold",
101
108
  "contextBudget",
102
109
  // Legacy aliases (still accepted, mapped during validation)
103
110
  "enableCompression",
@@ -141,6 +148,10 @@ function createDefaultConfig(_projectRoot) {
141
148
  memoryContextLimit: 3,
142
149
  memoryContextThreshold: 0.3,
143
150
  memoryExcludePatterns: [],
151
+ enableWatchmen: false,
152
+ watchmenThreshold: 5,
153
+ watchmenSynthesisMode: "local",
154
+ watchmenLocalModel: "onnx-community/gemma-4-E4B-it-ONNX",
144
155
  enableDocs: false,
145
156
  docsInclude: ["**/*.md", "**/*.mdx", "**/*.rst", "**/*.adoc", "**/*.asciidoc", "**/*.rdoc", "**/*.org", "**/*.cheatmd", "docs/**/*.txt", "docs/**/*.html"],
146
157
  docsExclude: ["node_modules/**", "**/CHANGELOG*", "**/LICENSE*", "**/CHANGES*", "dist/**", "build/**", "coverage/**", ".git/**", "**/generated/**", "**/auto-generated/**", "**/vendor/**", "_build/**"],
@@ -162,7 +173,10 @@ function createDefaultConfig(_projectRoot) {
162
173
  securityDatabases: ["OSV"],
163
174
  securityAutoEnrich: true,
164
175
  securityEnrichMaxAgeDays: 7,
165
- securityLicensePolicy: { deny: [], warn: [] }
176
+ securityLicensePolicy: { deny: [], warn: [] },
177
+ enablePatterns: false,
178
+ patternLibraryPath: void 0,
179
+ patternSeverityThreshold: "low"
166
180
  };
167
181
  }
168
182
  function validateConfig(config) {
@@ -216,6 +230,11 @@ function validateConfig(config) {
216
230
  const memoryContextLimit = typeof raw.memoryContextLimit === "number" && raw.memoryContextLimit >= 0 ? Math.round(raw.memoryContextLimit) : defaults.memoryContextLimit;
217
231
  const memoryContextThreshold = typeof raw.memoryContextThreshold === "number" && raw.memoryContextThreshold >= 0 && raw.memoryContextThreshold <= 1 ? raw.memoryContextThreshold : defaults.memoryContextThreshold;
218
232
  const memoryExcludePatterns = Array.isArray(raw.memoryExcludePatterns) && raw.memoryExcludePatterns.every((p) => typeof p === "string") ? raw.memoryExcludePatterns : defaults.memoryExcludePatterns;
233
+ const enableWatchmen = typeof raw.enableWatchmen === "boolean" ? raw.enableWatchmen : defaults.enableWatchmen;
234
+ const watchmenThreshold = typeof raw.watchmenThreshold === "number" && raw.watchmenThreshold > 0 ? Math.round(raw.watchmenThreshold) : defaults.watchmenThreshold;
235
+ const WATCHMEN_SYNTHESIS_MODES = /* @__PURE__ */ new Set(["local", "agent"]);
236
+ const watchmenSynthesisMode = typeof raw.watchmenSynthesisMode === "string" && WATCHMEN_SYNTHESIS_MODES.has(raw.watchmenSynthesisMode) ? raw.watchmenSynthesisMode : defaults.watchmenSynthesisMode;
237
+ const watchmenLocalModel = typeof raw.watchmenLocalModel === "string" && raw.watchmenLocalModel.length > 0 ? raw.watchmenLocalModel : defaults.watchmenLocalModel;
219
238
  const enableDocs = typeof raw.enableDocs === "boolean" ? raw.enableDocs : defaults.enableDocs;
220
239
  const docsInclude = Array.isArray(raw.docsInclude) && raw.docsInclude.every((p) => typeof p === "string") ? raw.docsInclude : defaults.docsInclude;
221
240
  const docsExclude = Array.isArray(raw.docsExclude) && raw.docsExclude.every((p) => typeof p === "string") ? raw.docsExclude : defaults.docsExclude;
@@ -290,6 +309,34 @@ function validateConfig(config) {
290
309
  }
291
310
  securityLicensePolicy = defaults.securityLicensePolicy;
292
311
  }
312
+ let enablePatterns;
313
+ if (typeof raw.enablePatterns === "boolean") {
314
+ enablePatterns = raw.enablePatterns;
315
+ } else {
316
+ if (raw.enablePatterns !== void 0) {
317
+ (0, import_errors.logWarn)("Invalid config field enablePatterns: expected boolean, applying default (false)");
318
+ }
319
+ enablePatterns = defaults.enablePatterns;
320
+ }
321
+ let patternLibraryPath;
322
+ if (raw.patternLibraryPath === void 0 || raw.patternLibraryPath === null) {
323
+ patternLibraryPath = void 0;
324
+ } else if (typeof raw.patternLibraryPath === "string") {
325
+ patternLibraryPath = raw.patternLibraryPath;
326
+ } else {
327
+ (0, import_errors.logWarn)("Invalid config field patternLibraryPath: expected string or undefined, applying default (undefined)");
328
+ patternLibraryPath = defaults.patternLibraryPath;
329
+ }
330
+ const PATTERN_SEVERITY_LEVELS = /* @__PURE__ */ new Set(["critical", "high", "medium", "low"]);
331
+ let patternSeverityThreshold;
332
+ if (typeof raw.patternSeverityThreshold === "string" && PATTERN_SEVERITY_LEVELS.has(raw.patternSeverityThreshold)) {
333
+ patternSeverityThreshold = raw.patternSeverityThreshold;
334
+ } else {
335
+ if (raw.patternSeverityThreshold !== void 0) {
336
+ (0, import_errors.logWarn)("Invalid config field patternSeverityThreshold: expected critical|high|medium|low, applying default (low)");
337
+ }
338
+ patternSeverityThreshold = defaults.patternSeverityThreshold;
339
+ }
293
340
  let finalEnableArchitecture = enableArchitecture;
294
341
  if (enableSecurity && !enableArchitecture) {
295
342
  (0, import_errors.logWarn)("enableSecurity requires enableArchitecture \u2014 auto-enabling architecture analysis");
@@ -336,6 +383,10 @@ function validateConfig(config) {
336
383
  memoryContextLimit,
337
384
  memoryContextThreshold,
338
385
  memoryExcludePatterns,
386
+ enableWatchmen: enableWatchmen && enableMemory,
387
+ watchmenThreshold,
388
+ watchmenSynthesisMode,
389
+ watchmenLocalModel,
339
390
  enableDocs,
340
391
  docsInclude,
341
392
  docsExclude,
@@ -358,6 +409,9 @@ function validateConfig(config) {
358
409
  securityAutoEnrich,
359
410
  securityEnrichMaxAgeDays,
360
411
  securityLicensePolicy,
412
+ enablePatterns,
413
+ patternLibraryPath,
414
+ patternSeverityThreshold,
361
415
  ...architectureLayers !== void 0 ? { architectureLayers } : {},
362
416
  ...contextBudget !== void 0 ? { contextBudget } : {}
363
417
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/config.ts"],
4
- "sourcesContent": ["/**\n * KiroGraph Config System\n *\n * Mirrors CodeGraph src/config.ts \u2014 load, save, validate, and provide defaults\n * for KiroGraph configuration.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport picomatch from 'picomatch';\nimport { logWarn, logError } from './errors';\n\n// \u2500\u2500 Types \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface KiroGraphConfig {\n version: number;\n languages: string[];\n include: string[];\n exclude: string[];\n maxFileSize: number;\n extractDocstrings: boolean;\n trackCallSites: boolean;\n // Parity fields:\n enableEmbeddings: boolean;\n embeddingModel: string;\n embeddingDim: number;\n /** @deprecated Use semanticEngine instead. Kept for backwards compatibility. */\n useVecIndex: boolean;\n semanticEngine: 'cosine' | 'sqlite-vec' | 'orama' | 'pglite' | 'lancedb' | 'qdrant' | 'typesense';\n typesenseDashboard: boolean;\n qdrantDashboard: boolean;\n minLogLevel: 'debug' | 'info' | 'warn' | 'error';\n frameworkHints: string[];\n fuzzyResolutionThreshold: number; // 0.0\u20131.0\n /** Enable architecture analysis (package graph + layer detection). Default: false. */\n enableArchitecture: boolean;\n /**\n * User-defined layer \u2192 glob pattern overrides.\n * When set, config-defined layers win over auto-detected ones.\n * Example: { \"api\": [\"src/routes/**\", \"src/controllers/**\"] }\n */\n architectureLayers?: Record<string, string[]>;\n /** Agent communication style injected at agentSpawn. Default: 'off'. */\n cavemanMode: 'off' | 'lite' | 'full' | 'ultra';\n /** Shell compression level for kirograph_exec. 'off' disables the hook/steering. Default: 'normal'. */\n shellCompressionLevel: 'off' | 'normal' | 'aggressive' | 'ultra';\n /**\n * Number of pending (unindexed) files above which kirograph_status warns the agent.\n * Set to 0 to disable the warning. Default: 10.\n */\n syncWarningThreshold: number;\n /** Enable persistent cross-session memory. Default: false. */\n enableMemory: boolean;\n /** FTS/vector blend for memory search: 0 = FTS only, 1 = vector only. Default: 0.5. */\n memorySearchAlpha: number;\n /** Store uncompressed originals when caveman is on. Default: false. */\n memoryKeepRaw: boolean;\n /** Auto-prune threshold (max observations). 0 = no limit. Default: 10000. */\n memoryMaxObservations: number;\n /** Seconds of inactivity before auto-closing a session. Default: 7200. */\n memorySessionTimeout: number;\n /** Max observations shown in kirograph_context. Default: 3. */\n memoryContextLimit: number;\n /** Min relevance score to include memory in context. Default: 0.3. */\n memoryContextThreshold: number;\n /** Glob patterns for paths to never capture in memory. Default: []. */\n memoryExcludePatterns: string[];\n /** Enable documentation indexing and navigation. Default: false. */\n enableDocs: boolean;\n /** Glob patterns for documentation files to include. */\n docsInclude: string[];\n /** Glob patterns for documentation files to exclude. */\n docsExclude: string[];\n /** Enable auto-linking of doc sections to code symbols. Default: true. */\n docsLinkCode: boolean;\n /** Max doc sections to include in kirograph_context. 0 = disabled. Default: 0. */\n docsContextLimit: number;\n /** Min relevance score to include a doc section in context. Default: 0.3. */\n docsContextThreshold: number;\n /** Max file size for doc files (bytes). Default: 1MB. */\n docsMaxFileSize: number;\n /** Summarization strategy. Default: 'first-sentence'. */\n docsSummarization: 'embedding' | 'first-sentence' | 'off';\n /** Enable tabular data indexing and querying. Default: false. */\n enableData: boolean;\n /** Glob patterns for data files to include. */\n dataInclude: string[];\n /** Glob patterns for data files to exclude. */\n dataExclude: string[];\n /** Enable auto-linking of data files to code symbols. Default: true. */\n dataLinkCode: boolean;\n /** Max datasets to include in kirograph_context. 0 = disabled. Default: 0. */\n dataContextLimit: number;\n /** Max file size for data files (bytes). Default: 50MB. */\n dataMaxFileSize: number;\n /** Max rows to index per file. Default: 1,000,000. */\n dataMaxRows: number;\n /** Max rows returned per query. Default: 500. */\n dataQueryLimit: number;\n /** Max token budget per response. Default: 8000. */\n dataMaxResponseTokens: number;\n /** Enable security analysis (dependency scanning + vulnerability detection). Default: false. */\n enableSecurity: boolean;\n /** Vulnerability databases to query. Default: ['OSV']. */\n securityDatabases: string[];\n /** Auto-run vulnerability enrichment after manifest parsing. Default: true. */\n securityAutoEnrich: boolean;\n /** Max age in days for vulnerability data before showing a staleness warning. Default: 7. */\n securityEnrichMaxAgeDays: number;\n /**\n * License policy for dependency compliance.\n * deny: licenses to block (build fails / command exits non-zero).\n * warn: licenses to flag as warnings.\n * Patterns support wildcards: GPL-* matches GPL-2.0, GPL-3.0, etc.\n * Default: { deny: [], warn: [] }.\n */\n securityLicensePolicy: {\n deny: string[];\n warn: string[];\n };\n /** Context budget governance settings. */\n contextBudget?: {\n maxTokensPerSession: number;\n warnAt: number;\n throttleAt: number;\n };\n}\n\n// \u2500\u2500 Constants \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nconst KIROGRAPH_DIR = '.kirograph';\nconst CONFIG_FILE = 'config.json';\n\nconst KNOWN_FIELDS = new Set<string>([\n 'version', 'languages', 'include', 'exclude', 'maxFileSize',\n 'extractDocstrings', 'trackCallSites', 'enableEmbeddings', 'embeddingModel', 'embeddingDim',\n 'useVecIndex', 'semanticEngine', 'typesenseDashboard', 'qdrantDashboard',\n 'minLogLevel', 'frameworkHints', 'fuzzyResolutionThreshold',\n 'enableArchitecture', 'architectureLayers', 'cavemanMode', 'shellCompressionLevel', 'syncWarningThreshold',\n 'enableMemory', 'memorySearchAlpha', 'memoryKeepRaw', 'memoryMaxObservations',\n 'memorySessionTimeout', 'memoryContextLimit', 'memoryContextThreshold', 'memoryExcludePatterns',\n 'enableDocs', 'docsInclude', 'docsExclude', 'docsLinkCode',\n 'docsContextLimit', 'docsContextThreshold', 'docsMaxFileSize', 'docsSummarization',\n 'enableData', 'dataInclude', 'dataExclude', 'dataLinkCode',\n 'dataContextLimit', 'dataMaxFileSize', 'dataMaxRows', 'dataQueryLimit', 'dataMaxResponseTokens',\n 'enableSecurity', 'securityDatabases', 'securityAutoEnrich', 'securityEnrichMaxAgeDays', 'securityLicensePolicy',\n 'contextBudget',\n // Legacy aliases (still accepted, mapped during validation)\n 'enableCompression', 'compressionLevel',\n]);\n\nconst LOG_LEVELS = new Set(['debug', 'info', 'warn', 'error']);\n\n// \u2500\u2500 ReDoS-safe regex check \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * Returns false if the pattern is potentially dangerous (ReDoS risk) or too long.\n * Checks for catastrophic backtracking patterns like (a+)+ or (a|a)+.\n */\nexport function isSafeRegex(pattern: string): boolean {\n if (pattern.length > 100) return false;\n // Detect nested quantifiers: (x+)+ or (x*)+ or (x+)* etc.\n if (/\\([^)]*[+*][^)]*\\)[+*?]/.test(pattern)) return false;\n // Detect alternation with overlap: (a|a)+ style\n if (/\\([^)]*\\|[^)]*\\)[+*]/.test(pattern)) return false;\n return true;\n}\n\n// \u2500\u2500 Default config \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport function createDefaultConfig(_projectRoot?: string): KiroGraphConfig {\n return {\n version: 2,\n languages: [],\n include: [],\n exclude: ['**/node_modules/**', '**/dist/**', '**/build/**', '**/.git/**', '*.min.js', '**/.kirograph/**'],\n maxFileSize: 1_048_576,\n extractDocstrings: true,\n trackCallSites: true,\n enableEmbeddings: false,\n embeddingModel: 'nomic-ai/nomic-embed-text-v1.5',\n embeddingDim: 768,\n useVecIndex: false,\n semanticEngine: 'cosine',\n typesenseDashboard: false,\n qdrantDashboard: false,\n minLogLevel: 'warn',\n frameworkHints: [],\n fuzzyResolutionThreshold: 0.5,\n enableArchitecture: false,\n cavemanMode: 'off',\n shellCompressionLevel: 'normal',\n syncWarningThreshold: 10,\n enableMemory: false,\n memorySearchAlpha: 0.5,\n memoryKeepRaw: false,\n memoryMaxObservations: 10000,\n memorySessionTimeout: 7200,\n memoryContextLimit: 3,\n memoryContextThreshold: 0.3,\n memoryExcludePatterns: [],\n enableDocs: false,\n docsInclude: ['**/*.md', '**/*.mdx', '**/*.rst', '**/*.adoc', '**/*.asciidoc', '**/*.rdoc', '**/*.org', '**/*.cheatmd', 'docs/**/*.txt', 'docs/**/*.html'],\n docsExclude: ['node_modules/**', '**/CHANGELOG*', '**/LICENSE*', '**/CHANGES*', 'dist/**', 'build/**', 'coverage/**', '.git/**', '**/generated/**', '**/auto-generated/**', '**/vendor/**', '_build/**'],\n docsLinkCode: true,\n docsContextLimit: 0,\n docsContextThreshold: 0.3,\n docsMaxFileSize: 1_048_576,\n docsSummarization: 'first-sentence',\n enableData: false,\n dataInclude: ['**/*.csv', '**/*.tsv', '**/*.jsonl', '**/*.ndjson', '**/*.xlsx', '**/*.xls', '**/*.parquet', 'data/**/*.json'],\n dataExclude: ['node_modules/**', 'dist/**', 'build/**', '.git/**', '**/package-lock.json', '**/yarn.lock', '**/pnpm-lock.yaml', '**/tsconfig.json', '**/jsconfig.json', 'coverage/**', '**/generated/**'],\n dataLinkCode: true,\n dataContextLimit: 0,\n dataMaxFileSize: 52_428_800,\n dataMaxRows: 1_000_000,\n dataQueryLimit: 500,\n dataMaxResponseTokens: 8000,\n enableSecurity: false,\n securityDatabases: ['OSV'],\n securityAutoEnrich: true,\n securityEnrichMaxAgeDays: 7,\n securityLicensePolicy: { deny: [], warn: [] },\n };\n}\n\n// \u2500\u2500 Validation \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport function validateConfig(config: unknown): KiroGraphConfig {\n const defaults = createDefaultConfig();\n\n if (typeof config !== 'object' || config === null) {\n return defaults;\n }\n\n const raw = config as Record<string, unknown>;\n\n // Warn about unknown fields\n for (const key of Object.keys(raw)) {\n if (!KNOWN_FIELDS.has(key)) {\n logWarn(`Unknown config field: ${key}`);\n }\n }\n\n // Validate and coerce each field\n const version = typeof raw.version === 'number' ? raw.version : defaults.version;\n const languages = Array.isArray(raw.languages) && raw.languages.every(l => typeof l === 'string')\n ? (raw.languages as string[])\n : defaults.languages;\n const maxFileSize = typeof raw.maxFileSize === 'number' && raw.maxFileSize > 0\n ? raw.maxFileSize\n : defaults.maxFileSize;\n const extractDocstrings = typeof raw.extractDocstrings === 'boolean'\n ? raw.extractDocstrings\n : defaults.extractDocstrings;\n const trackCallSites = typeof raw.trackCallSites === 'boolean'\n ? raw.trackCallSites\n : defaults.trackCallSites;\n const enableEmbeddings = typeof raw.enableEmbeddings === 'boolean'\n ? raw.enableEmbeddings\n : defaults.enableEmbeddings;\n const embeddingModel = typeof raw.embeddingModel === 'string' && raw.embeddingModel.length > 0\n ? raw.embeddingModel\n : defaults.embeddingModel;\n const embeddingDim = typeof raw.embeddingDim === 'number' && raw.embeddingDim > 0\n ? raw.embeddingDim\n : defaults.embeddingDim;\n const useVecIndex = typeof raw.useVecIndex === 'boolean'\n ? raw.useVecIndex\n : defaults.useVecIndex;\n const SEMANTIC_ENGINES = new Set(['cosine', 'sqlite-vec', 'orama', 'pglite', 'lancedb', 'qdrant', 'typesense']);\n // useVecIndex is a legacy alias: if set and no explicit semanticEngine, map it\n const semanticEngine = typeof raw.semanticEngine === 'string' && SEMANTIC_ENGINES.has(raw.semanticEngine)\n ? (raw.semanticEngine as KiroGraphConfig['semanticEngine'])\n : useVecIndex ? 'sqlite-vec' : defaults.semanticEngine;\n const typesenseDashboard = typeof raw.typesenseDashboard === 'boolean'\n ? raw.typesenseDashboard\n : defaults.typesenseDashboard;\n const qdrantDashboard = typeof raw.qdrantDashboard === 'boolean'\n ? raw.qdrantDashboard\n : defaults.qdrantDashboard;\n const minLogLevel = typeof raw.minLogLevel === 'string' && LOG_LEVELS.has(raw.minLogLevel)\n ? (raw.minLogLevel as KiroGraphConfig['minLogLevel'])\n : defaults.minLogLevel;\n const frameworkHints = Array.isArray(raw.frameworkHints) && raw.frameworkHints.every(h => typeof h === 'string')\n ? (raw.frameworkHints as string[])\n : defaults.frameworkHints;\n const fuzzyResolutionThreshold = typeof raw.fuzzyResolutionThreshold === 'number'\n && raw.fuzzyResolutionThreshold >= 0\n && raw.fuzzyResolutionThreshold <= 1\n ? raw.fuzzyResolutionThreshold\n : defaults.fuzzyResolutionThreshold;\n const enableArchitecture = typeof raw.enableArchitecture === 'boolean'\n ? raw.enableArchitecture\n : defaults.enableArchitecture;\n const architectureLayers = _validateArchitectureLayers(raw.architectureLayers);\n const CAVEMAN_MODES = new Set(['off', 'lite', 'full', 'ultra']);\n const cavemanMode = typeof raw.cavemanMode === 'string' && CAVEMAN_MODES.has(raw.cavemanMode)\n ? (raw.cavemanMode as KiroGraphConfig['cavemanMode'])\n : defaults.cavemanMode;\n const COMPRESSION_LEVELS = new Set(['off', 'normal', 'aggressive', 'ultra']);\n // Support legacy field names: enableCompression (boolean) and compressionLevel (string)\n let shellCompressionLevel: KiroGraphConfig['shellCompressionLevel'];\n if (typeof raw.shellCompressionLevel === 'string' && COMPRESSION_LEVELS.has(raw.shellCompressionLevel)) {\n shellCompressionLevel = raw.shellCompressionLevel as KiroGraphConfig['shellCompressionLevel'];\n } else if (typeof raw.compressionLevel === 'string' && COMPRESSION_LEVELS.has(raw.compressionLevel)) {\n shellCompressionLevel = raw.compressionLevel as KiroGraphConfig['shellCompressionLevel'];\n } else if (typeof raw.enableCompression === 'boolean') {\n shellCompressionLevel = raw.enableCompression ? 'normal' : 'off';\n } else {\n shellCompressionLevel = defaults.shellCompressionLevel;\n }\n const syncWarningThreshold = typeof raw.syncWarningThreshold === 'number' && raw.syncWarningThreshold >= 0\n ? Math.round(raw.syncWarningThreshold)\n : defaults.syncWarningThreshold;\n\n // \u2500\u2500 Memory config \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const enableMemory = typeof raw.enableMemory === 'boolean'\n ? raw.enableMemory\n : defaults.enableMemory;\n const memorySearchAlpha = typeof raw.memorySearchAlpha === 'number'\n && raw.memorySearchAlpha >= 0 && raw.memorySearchAlpha <= 1\n ? raw.memorySearchAlpha\n : defaults.memorySearchAlpha;\n const memoryKeepRaw = typeof raw.memoryKeepRaw === 'boolean'\n ? raw.memoryKeepRaw\n : defaults.memoryKeepRaw;\n const memoryMaxObservations = typeof raw.memoryMaxObservations === 'number' && raw.memoryMaxObservations >= 0\n ? Math.round(raw.memoryMaxObservations)\n : defaults.memoryMaxObservations;\n const memorySessionTimeout = typeof raw.memorySessionTimeout === 'number' && raw.memorySessionTimeout > 0\n ? Math.round(raw.memorySessionTimeout)\n : defaults.memorySessionTimeout;\n const memoryContextLimit = typeof raw.memoryContextLimit === 'number' && raw.memoryContextLimit >= 0\n ? Math.round(raw.memoryContextLimit)\n : defaults.memoryContextLimit;\n const memoryContextThreshold = typeof raw.memoryContextThreshold === 'number'\n && raw.memoryContextThreshold >= 0 && raw.memoryContextThreshold <= 1\n ? raw.memoryContextThreshold\n : defaults.memoryContextThreshold;\n const memoryExcludePatterns = Array.isArray(raw.memoryExcludePatterns)\n && raw.memoryExcludePatterns.every((p: unknown) => typeof p === 'string')\n ? (raw.memoryExcludePatterns as string[])\n : defaults.memoryExcludePatterns;\n\n // \u2500\u2500 Docs config \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const enableDocs = typeof raw.enableDocs === 'boolean'\n ? raw.enableDocs\n : defaults.enableDocs;\n const docsInclude = Array.isArray(raw.docsInclude)\n && raw.docsInclude.every((p: unknown) => typeof p === 'string')\n ? (raw.docsInclude as string[])\n : defaults.docsInclude;\n const docsExclude = Array.isArray(raw.docsExclude)\n && raw.docsExclude.every((p: unknown) => typeof p === 'string')\n ? (raw.docsExclude as string[])\n : defaults.docsExclude;\n const docsLinkCode = typeof raw.docsLinkCode === 'boolean'\n ? raw.docsLinkCode\n : defaults.docsLinkCode;\n const docsContextLimit = typeof raw.docsContextLimit === 'number' && raw.docsContextLimit >= 0\n ? Math.round(raw.docsContextLimit)\n : defaults.docsContextLimit;\n const docsContextThreshold = typeof raw.docsContextThreshold === 'number'\n && raw.docsContextThreshold >= 0 && raw.docsContextThreshold <= 1\n ? raw.docsContextThreshold\n : defaults.docsContextThreshold;\n const docsMaxFileSize = typeof raw.docsMaxFileSize === 'number' && raw.docsMaxFileSize > 0\n ? raw.docsMaxFileSize\n : defaults.docsMaxFileSize;\n const DOCS_SUMMARIZATION_MODES = new Set(['embedding', 'first-sentence', 'off']);\n const docsSummarization = typeof raw.docsSummarization === 'string' && DOCS_SUMMARIZATION_MODES.has(raw.docsSummarization)\n ? (raw.docsSummarization as KiroGraphConfig['docsSummarization'])\n : defaults.docsSummarization;\n\n // \u2500\u2500 Data config \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const enableData = typeof raw.enableData === 'boolean' ? raw.enableData : defaults.enableData;\n const dataInclude = Array.isArray(raw.dataInclude) && raw.dataInclude.every((p: unknown) => typeof p === 'string')\n ? (raw.dataInclude as string[]) : defaults.dataInclude;\n const dataExclude = Array.isArray(raw.dataExclude) && raw.dataExclude.every((p: unknown) => typeof p === 'string')\n ? (raw.dataExclude as string[]) : defaults.dataExclude;\n const dataLinkCode = typeof raw.dataLinkCode === 'boolean' ? raw.dataLinkCode : defaults.dataLinkCode;\n const dataContextLimit = typeof raw.dataContextLimit === 'number' && raw.dataContextLimit >= 0\n ? Math.round(raw.dataContextLimit) : defaults.dataContextLimit;\n const dataMaxFileSize = typeof raw.dataMaxFileSize === 'number' && raw.dataMaxFileSize > 0\n ? raw.dataMaxFileSize : defaults.dataMaxFileSize;\n const dataMaxRows = typeof raw.dataMaxRows === 'number' && raw.dataMaxRows > 0\n ? Math.round(raw.dataMaxRows) : defaults.dataMaxRows;\n const dataQueryLimit = typeof raw.dataQueryLimit === 'number' && raw.dataQueryLimit > 0\n ? Math.min(Math.round(raw.dataQueryLimit), 500) : defaults.dataQueryLimit;\n const dataMaxResponseTokens = typeof raw.dataMaxResponseTokens === 'number' && raw.dataMaxResponseTokens > 0\n ? Math.round(raw.dataMaxResponseTokens) : defaults.dataMaxResponseTokens;\n\n // \u2500\u2500 Security config \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n let enableSecurity: boolean;\n if (typeof raw.enableSecurity === 'boolean') {\n enableSecurity = raw.enableSecurity;\n } else {\n if (raw.enableSecurity !== undefined) {\n logWarn('Invalid config field enableSecurity: expected boolean, applying default (false)');\n }\n enableSecurity = defaults.enableSecurity;\n }\n\n let securityAutoEnrich: boolean;\n if (typeof raw.securityAutoEnrich === 'boolean') {\n securityAutoEnrich = raw.securityAutoEnrich;\n } else {\n if (raw.securityAutoEnrich !== undefined) {\n logWarn('Invalid config field securityAutoEnrich: expected boolean, applying default (true)');\n }\n securityAutoEnrich = defaults.securityAutoEnrich;\n }\n\n let securityEnrichMaxAgeDays: number;\n if (typeof raw.securityEnrichMaxAgeDays === 'number' && raw.securityEnrichMaxAgeDays > 0) {\n securityEnrichMaxAgeDays = raw.securityEnrichMaxAgeDays;\n } else {\n if (raw.securityEnrichMaxAgeDays !== undefined) {\n logWarn('Invalid config field securityEnrichMaxAgeDays: expected positive number, applying default (7)');\n }\n securityEnrichMaxAgeDays = defaults.securityEnrichMaxAgeDays;\n }\n\n const SUPPORTED_SECURITY_DATABASES = new Set(['OSV']);\n let securityDatabases: string[];\n if (Array.isArray(raw.securityDatabases) && raw.securityDatabases.every((d: unknown) => typeof d === 'string')) {\n const valid = (raw.securityDatabases as string[]).filter(d => {\n if (!SUPPORTED_SECURITY_DATABASES.has(d)) {\n logWarn(`Unsupported security database \"${d}\" in securityDatabases, ignoring`);\n return false;\n }\n return true;\n });\n securityDatabases = valid.length > 0 ? valid : defaults.securityDatabases;\n } else {\n if (raw.securityDatabases !== undefined) {\n logWarn('Invalid config field securityDatabases: expected array of strings, applying default ([\"OSV\"])');\n }\n securityDatabases = defaults.securityDatabases;\n }\n\n let securityLicensePolicy: KiroGraphConfig['securityLicensePolicy'];\n if (raw.securityLicensePolicy && typeof raw.securityLicensePolicy === 'object' && !Array.isArray(raw.securityLicensePolicy)) {\n const rawPolicy = raw.securityLicensePolicy as Record<string, unknown>;\n const deny = Array.isArray(rawPolicy.deny) && rawPolicy.deny.every((p: unknown) => typeof p === 'string')\n ? (rawPolicy.deny as string[])\n : defaults.securityLicensePolicy.deny;\n const warn = Array.isArray(rawPolicy.warn) && rawPolicy.warn.every((p: unknown) => typeof p === 'string')\n ? (rawPolicy.warn as string[])\n : defaults.securityLicensePolicy.warn;\n securityLicensePolicy = { deny, warn };\n } else {\n if (raw.securityLicensePolicy !== undefined) {\n logWarn('Invalid config field securityLicensePolicy: expected object with deny/warn arrays, applying default');\n }\n securityLicensePolicy = defaults.securityLicensePolicy;\n }\n\n // Dependency constraint: enableSecurity requires enableArchitecture\n let finalEnableArchitecture = enableArchitecture;\n if (enableSecurity && !enableArchitecture) {\n logWarn('enableSecurity requires enableArchitecture \\u2014 auto-enabling architecture analysis');\n finalEnableArchitecture = true;\n }\n\n // \u2500\u2500 Context budget config \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n let contextBudget: KiroGraphConfig['contextBudget'] | undefined;\n if (raw.contextBudget && typeof raw.contextBudget === 'object' && !Array.isArray(raw.contextBudget)) {\n const cb = raw.contextBudget as Record<string, unknown>;\n contextBudget = {\n maxTokensPerSession: typeof cb.maxTokensPerSession === 'number' && cb.maxTokensPerSession > 0\n ? Math.round(cb.maxTokensPerSession) : 100_000,\n warnAt: typeof cb.warnAt === 'number' && cb.warnAt > 0\n ? Math.round(cb.warnAt) : 80_000,\n throttleAt: typeof cb.throttleAt === 'number' && cb.throttleAt > 0\n ? Math.round(cb.throttleAt) : 95_000,\n };\n }\n\n // Validate glob patterns \u2014 exclude unsafe regex patterns\n const include = _validatePatterns(raw.include, defaults.include);\n const exclude = _validatePatterns(raw.exclude, defaults.exclude);\n\n return {\n version,\n languages,\n include,\n exclude,\n maxFileSize,\n extractDocstrings,\n trackCallSites,\n enableEmbeddings,\n embeddingModel,\n embeddingDim,\n useVecIndex,\n semanticEngine,\n typesenseDashboard,\n qdrantDashboard,\n minLogLevel,\n frameworkHints,\n fuzzyResolutionThreshold,\n enableArchitecture: finalEnableArchitecture,\n cavemanMode,\n shellCompressionLevel,\n syncWarningThreshold,\n enableMemory,\n memorySearchAlpha,\n memoryKeepRaw,\n memoryMaxObservations,\n memorySessionTimeout,\n memoryContextLimit,\n memoryContextThreshold,\n memoryExcludePatterns,\n enableDocs,\n docsInclude,\n docsExclude,\n docsLinkCode,\n docsContextLimit,\n docsContextThreshold,\n docsMaxFileSize,\n docsSummarization,\n enableData,\n dataInclude,\n dataExclude,\n dataLinkCode,\n dataContextLimit,\n dataMaxFileSize,\n dataMaxRows,\n dataQueryLimit,\n dataMaxResponseTokens,\n enableSecurity,\n securityDatabases,\n securityAutoEnrich,\n securityEnrichMaxAgeDays,\n securityLicensePolicy,\n ...(architectureLayers !== undefined ? { architectureLayers } : {}),\n ...(contextBudget !== undefined ? { contextBudget } : {}),\n };\n}\n\nfunction _validateArchitectureLayers(raw: unknown): Record<string, string[]> | undefined {\n if (raw === undefined || raw === null) return undefined;\n if (typeof raw !== 'object' || Array.isArray(raw)) return undefined;\n const result: Record<string, string[]> = {};\n for (const [key, val] of Object.entries(raw as Record<string, unknown>)) {\n if (typeof key !== 'string') continue;\n if (!Array.isArray(val)) continue;\n const patterns = val.filter((p): p is string => typeof p === 'string' && isSafeRegex(p));\n if (patterns.length > 0) result[key] = patterns;\n }\n return Object.keys(result).length > 0 ? result : undefined;\n}\n\nfunction _validatePatterns(raw: unknown, fallback: string[]): string[] {\n if (!Array.isArray(raw)) return fallback;\n const valid: string[] = [];\n for (const p of raw) {\n if (typeof p !== 'string') continue;\n if (!isSafeRegex(p)) {\n logWarn(`Unsafe regex pattern skipped: ${p}`);\n continue;\n }\n valid.push(p);\n }\n return valid;\n}\n\n// \u2500\u2500 Migration helpers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * Upgrades shallow exclude patterns (e.g. \"node_modules/**\") to recursive ones\n * (e.g. \"** /node_modules/**\") so nested directories are excluded at any depth.\n */\nconst SHALLOW_TO_RECURSIVE: Record<string, string> = {\n 'node_modules/**': '**/node_modules/**',\n 'dist/**': '**/dist/**',\n 'build/**': '**/build/**',\n '.git/**': '**/.git/**',\n '.kirograph/**': '**/.kirograph/**',\n};\n\nfunction migrateExcludePatterns(patterns: string[]): string[] {\n return patterns.map(p => SHALLOW_TO_RECURSIVE[p] ?? p);\n}\n\n// \u2500\u2500 Load / Save \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport async function loadConfig(projectRoot: string): Promise<KiroGraphConfig> {\n const dir = path.join(projectRoot, KIROGRAPH_DIR);\n const cfgPath = path.join(dir, CONFIG_FILE);\n\n if (!fs.existsSync(cfgPath)) {\n // Create default config file\n const defaults = createDefaultConfig(projectRoot);\n await fs.promises.mkdir(dir, { recursive: true });\n await _writeAtomic(cfgPath, defaults);\n return defaults;\n }\n\n let raw: unknown;\n try {\n const text = await fs.promises.readFile(cfgPath, 'utf8');\n raw = JSON.parse(text);\n } catch (err) {\n logError('Config parse error', { path: cfgPath, error: err instanceof Error ? err.message : String(err) });\n return createDefaultConfig(projectRoot);\n }\n\n const config = validateConfig(raw);\n\n // Migrate v1 \u2192 v2: upgrade shallow exclude patterns to recursive\n if (config.version < 2) {\n config.version = 2;\n config.exclude = migrateExcludePatterns(config.exclude);\n await fs.promises.mkdir(dir, { recursive: true });\n await _writeAtomic(cfgPath, config);\n }\n\n return config;\n}\n\nexport async function saveConfig(projectRoot: string, config: KiroGraphConfig): Promise<void> {\n const dir = path.join(projectRoot, KIROGRAPH_DIR);\n const cfgPath = path.join(dir, CONFIG_FILE);\n await fs.promises.mkdir(dir, { recursive: true });\n await _writeAtomic(cfgPath, config);\n}\n\nasync function _writeAtomic(cfgPath: string, config: KiroGraphConfig): Promise<void> {\n const tmp = cfgPath + '.tmp';\n await fs.promises.writeFile(tmp, JSON.stringify(config, null, 2), 'utf8');\n await fs.promises.rename(tmp, cfgPath);\n}\n\n// \u2500\u2500 Update helpers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport async function updateConfig(\n projectRoot: string,\n patch: Partial<KiroGraphConfig>\n): Promise<KiroGraphConfig> {\n const current = await loadConfig(projectRoot);\n const updated = validateConfig({ ...current, ...patch });\n await saveConfig(projectRoot, updated);\n return updated;\n}\n\nexport async function addIncludePatterns(projectRoot: string, patterns: string[]): Promise<void> {\n const config = await loadConfig(projectRoot);\n const existing = new Set(config.include);\n const toAdd = patterns.filter(p => isSafeRegex(p) && !existing.has(p));\n if (toAdd.length === 0) return;\n await saveConfig(projectRoot, { ...config, include: [...config.include, ...toAdd] });\n}\n\nexport async function addExcludePatterns(projectRoot: string, patterns: string[]): Promise<void> {\n const config = await loadConfig(projectRoot);\n const existing = new Set(config.exclude);\n const toAdd = patterns.filter(p => isSafeRegex(p) && !existing.has(p));\n if (toAdd.length === 0) return;\n await saveConfig(projectRoot, { ...config, exclude: [...config.exclude, ...toAdd] });\n}\n\n// \u2500\u2500 File inclusion check \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport function shouldIncludeFile(config: KiroGraphConfig, relPath: string): boolean {\n // Check exclude patterns first\n for (const pattern of config.exclude) {\n if (picomatch(pattern)(relPath)) return false;\n }\n // If include patterns are specified, file must match at least one\n if (config.include.length > 0) {\n return config.include.some(pattern => picomatch(pattern)(relPath));\n }\n return true;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,SAAoB;AACpB,WAAsB;AACtB,uBAAsB;AACtB,oBAAkC;AAwHlC,MAAM,gBAAgB;AACtB,MAAM,cAAc;AAEpB,MAAM,eAAe,oBAAI,IAAY;AAAA,EACnC;AAAA,EAAW;AAAA,EAAa;AAAA,EAAW;AAAA,EAAW;AAAA,EAC9C;AAAA,EAAqB;AAAA,EAAkB;AAAA,EAAoB;AAAA,EAAkB;AAAA,EAC7E;AAAA,EAAe;AAAA,EAAkB;AAAA,EAAsB;AAAA,EACvD;AAAA,EAAe;AAAA,EAAkB;AAAA,EACjC;AAAA,EAAsB;AAAA,EAAsB;AAAA,EAAe;AAAA,EAAyB;AAAA,EACpF;AAAA,EAAgB;AAAA,EAAqB;AAAA,EAAiB;AAAA,EACtD;AAAA,EAAwB;AAAA,EAAsB;AAAA,EAA0B;AAAA,EACxE;AAAA,EAAc;AAAA,EAAe;AAAA,EAAe;AAAA,EAC5C;AAAA,EAAoB;AAAA,EAAwB;AAAA,EAAmB;AAAA,EAC/D;AAAA,EAAc;AAAA,EAAe;AAAA,EAAe;AAAA,EAC5C;AAAA,EAAoB;AAAA,EAAmB;AAAA,EAAe;AAAA,EAAkB;AAAA,EACxE;AAAA,EAAkB;AAAA,EAAqB;AAAA,EAAsB;AAAA,EAA4B;AAAA,EACzF;AAAA;AAAA,EAEA;AAAA,EAAqB;AACvB,CAAC;AAED,MAAM,aAAa,oBAAI,IAAI,CAAC,SAAS,QAA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;AACrF;AAEA,eAAsB,mBAAmB,aAAqB,UAAmC;AAC/F,QAAM,SAAS,MAAM,WAAW,WAAW;AAC3C,QAAM,WAAW,IAAI,IAAI,OAAO,OAAO;AACvC,QAAM,QAAQ,SAAS,OAAO,OAAK,YAAY,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,CAAC;AACrE,MAAI,MAAM,WAAW,EAAG;AACxB,QAAM,WAAW,aAAa,EAAE,GAAG,QAAQ,SAAS,CAAC,GAAG,OAAO,SAAS,GAAG,KAAK,EAAE,CAAC;AACrF;AAIO,SAAS,kBAAkB,QAAyB,SAA0B;AAEnF,aAAW,WAAW,OAAO,SAAS;AACpC,YAAI,iBAAAA,SAAU,OAAO,EAAE,OAAO,EAAG,QAAO;AAAA,EAC1C;AAEA,MAAI,OAAO,QAAQ,SAAS,GAAG;AAC7B,WAAO,OAAO,QAAQ,KAAK,iBAAW,iBAAAA,SAAU,OAAO,EAAE,OAAO,CAAC;AAAA,EACnE;AACA,SAAO;AACT;",
4
+ "sourcesContent": ["/**\n * KiroGraph Config System\n *\n * Mirrors CodeGraph src/config.ts \u2014 load, save, validate, and provide defaults\n * for KiroGraph configuration.\n */\n\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport picomatch from 'picomatch';\nimport { logWarn, logError } from './errors';\n\n// \u2500\u2500 Types \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport interface KiroGraphConfig {\n version: number;\n languages: string[];\n include: string[];\n exclude: string[];\n maxFileSize: number;\n extractDocstrings: boolean;\n trackCallSites: boolean;\n // Parity fields:\n enableEmbeddings: boolean;\n embeddingModel: string;\n embeddingDim: number;\n /** @deprecated Use semanticEngine instead. Kept for backwards compatibility. */\n useVecIndex: boolean;\n semanticEngine: 'cosine' | 'sqlite-vec' | 'orama' | 'pglite' | 'lancedb' | 'qdrant' | 'typesense';\n typesenseDashboard: boolean;\n qdrantDashboard: boolean;\n minLogLevel: 'debug' | 'info' | 'warn' | 'error';\n frameworkHints: string[];\n fuzzyResolutionThreshold: number; // 0.0\u20131.0\n /** Enable architecture analysis (package graph + layer detection). Default: false. */\n enableArchitecture: boolean;\n /**\n * User-defined layer \u2192 glob pattern overrides.\n * When set, config-defined layers win over auto-detected ones.\n * Example: { \"api\": [\"src/routes/**\", \"src/controllers/**\"] }\n */\n architectureLayers?: Record<string, string[]>;\n /** Agent communication style injected at agentSpawn. Default: 'off'. */\n cavemanMode: 'off' | 'lite' | 'full' | 'ultra';\n /** Shell compression level for kirograph_exec. 'off' disables the hook/steering. Default: 'normal'. */\n shellCompressionLevel: 'off' | 'normal' | 'aggressive' | 'ultra';\n /**\n * Number of pending (unindexed) files above which kirograph_status warns the agent.\n * Set to 0 to disable the warning. Default: 10.\n */\n syncWarningThreshold: number;\n /** Enable persistent cross-session memory. Default: false. */\n enableMemory: boolean;\n /** FTS/vector blend for memory search: 0 = FTS only, 1 = vector only. Default: 0.5. */\n memorySearchAlpha: number;\n /** Store uncompressed originals when caveman is on. Default: false. */\n memoryKeepRaw: boolean;\n /** Auto-prune threshold (max observations). 0 = no limit. Default: 10000. */\n memoryMaxObservations: number;\n /** Seconds of inactivity before auto-closing a session. Default: 7200. */\n memorySessionTimeout: number;\n /** Max observations shown in kirograph_context. Default: 3. */\n memoryContextLimit: number;\n /** Min relevance score to include memory in context. Default: 0.3. */\n memoryContextThreshold: number;\n /** Glob patterns for paths to never capture in memory. Default: []. */\n memoryExcludePatterns: string[];\n /** Enable watchmen \u2014 auto-synthesize workspace briefs from memory observations. Requires enableMemory. Default: false. */\n enableWatchmen: boolean;\n /** Minimum new observations since last synthesis before watchmenReady fires. Default: 5. */\n watchmenThreshold: number;\n /**\n * How synthesis is performed.\n * 'local' \u2014 runs a local HuggingFace model via @huggingface/transformers (no API cost, works for all tools).\n * 'agent' \u2014 delegates to the active AI agent via askAgent hook (Kiro only, consumes agent tokens).\n * Default: 'local'.\n */\n watchmenSynthesisMode: 'local' | 'agent';\n /** HuggingFace model ID for local synthesis. Only used when watchmenSynthesisMode is 'local'. Default: 'onnx-community/gemma-4-E4B-it-ONNX'. */\n watchmenLocalModel: string;\n /** Enable documentation indexing and navigation. Default: false. */\n enableDocs: boolean;\n /** Glob patterns for documentation files to include. */\n docsInclude: string[];\n /** Glob patterns for documentation files to exclude. */\n docsExclude: string[];\n /** Enable auto-linking of doc sections to code symbols. Default: true. */\n docsLinkCode: boolean;\n /** Max doc sections to include in kirograph_context. 0 = disabled. Default: 0. */\n docsContextLimit: number;\n /** Min relevance score to include a doc section in context. Default: 0.3. */\n docsContextThreshold: number;\n /** Max file size for doc files (bytes). Default: 1MB. */\n docsMaxFileSize: number;\n /** Summarization strategy. Default: 'first-sentence'. */\n docsSummarization: 'embedding' | 'first-sentence' | 'off';\n /** Enable tabular data indexing and querying. Default: false. */\n enableData: boolean;\n /** Glob patterns for data files to include. */\n dataInclude: string[];\n /** Glob patterns for data files to exclude. */\n dataExclude: string[];\n /** Enable auto-linking of data files to code symbols. Default: true. */\n dataLinkCode: boolean;\n /** Max datasets to include in kirograph_context. 0 = disabled. Default: 0. */\n dataContextLimit: number;\n /** Max file size for data files (bytes). Default: 50MB. */\n dataMaxFileSize: number;\n /** Max rows to index per file. Default: 1,000,000. */\n dataMaxRows: number;\n /** Max rows returned per query. Default: 500. */\n dataQueryLimit: number;\n /** Max token budget per response. Default: 8000. */\n dataMaxResponseTokens: number;\n /** Enable security analysis (dependency scanning + vulnerability detection). Default: false. */\n enableSecurity: boolean;\n /** Vulnerability databases to query. Default: ['OSV']. */\n securityDatabases: string[];\n /** Enable AST-level structural pattern matching (SAST) during indexing. Default: false. */\n enablePatterns: boolean;\n /** Path to a directory of user-supplied YAML rule files. Merged with bundled library (user rules win on id conflict). Default: undefined. */\n patternLibraryPath: string | undefined;\n /** Minimum severity level for storing pattern matches during index-time analysis. Default: 'low'. */\n patternSeverityThreshold: 'critical' | 'high' | 'medium' | 'low';\n /** Auto-run vulnerability enrichment after manifest parsing. Default: true. */\n securityAutoEnrich: boolean;\n /** Max age in days for vulnerability data before showing a staleness warning. Default: 7. */\n securityEnrichMaxAgeDays: number;\n /**\n * License policy for dependency compliance.\n * deny: licenses to block (build fails / command exits non-zero).\n * warn: licenses to flag as warnings.\n * Patterns support wildcards: GPL-* matches GPL-2.0, GPL-3.0, etc.\n * Default: { deny: [], warn: [] }.\n */\n securityLicensePolicy: {\n deny: string[];\n warn: string[];\n };\n /** Context budget governance settings. */\n contextBudget?: {\n maxTokensPerSession: number;\n warnAt: number;\n throttleAt: number;\n };\n}\n\n// \u2500\u2500 Constants \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nconst KIROGRAPH_DIR = '.kirograph';\nconst CONFIG_FILE = 'config.json';\n\nconst KNOWN_FIELDS = new Set<string>([\n 'version', 'languages', 'include', 'exclude', 'maxFileSize',\n 'extractDocstrings', 'trackCallSites', 'enableEmbeddings', 'embeddingModel', 'embeddingDim',\n 'useVecIndex', 'semanticEngine', 'typesenseDashboard', 'qdrantDashboard',\n 'minLogLevel', 'frameworkHints', 'fuzzyResolutionThreshold',\n 'enableArchitecture', 'architectureLayers', 'cavemanMode', 'shellCompressionLevel', 'syncWarningThreshold',\n 'enableMemory', 'memorySearchAlpha', 'memoryKeepRaw', 'memoryMaxObservations',\n 'memorySessionTimeout', 'memoryContextLimit', 'memoryContextThreshold', 'memoryExcludePatterns',\n 'enableWatchmen', 'watchmenThreshold', 'watchmenSynthesisMode', 'watchmenLocalModel',\n 'enableDocs', 'docsInclude', 'docsExclude', 'docsLinkCode',\n 'docsContextLimit', 'docsContextThreshold', 'docsMaxFileSize', 'docsSummarization',\n 'enableData', 'dataInclude', 'dataExclude', 'dataLinkCode',\n 'dataContextLimit', 'dataMaxFileSize', 'dataMaxRows', 'dataQueryLimit', 'dataMaxResponseTokens',\n 'enableSecurity', 'securityDatabases', 'securityAutoEnrich', 'securityEnrichMaxAgeDays', 'securityLicensePolicy',\n 'enablePatterns', 'patternLibraryPath', 'patternSeverityThreshold',\n 'contextBudget',\n // Legacy aliases (still accepted, mapped during validation)\n 'enableCompression', 'compressionLevel',\n]);\n\nconst LOG_LEVELS = new Set(['debug', 'info', 'warn', 'error']);\n\n// \u2500\u2500 ReDoS-safe regex check \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * Returns false if the pattern is potentially dangerous (ReDoS risk) or too long.\n * Checks for catastrophic backtracking patterns like (a+)+ or (a|a)+.\n */\nexport function isSafeRegex(pattern: string): boolean {\n if (pattern.length > 100) return false;\n // Detect nested quantifiers: (x+)+ or (x*)+ or (x+)* etc.\n if (/\\([^)]*[+*][^)]*\\)[+*?]/.test(pattern)) return false;\n // Detect alternation with overlap: (a|a)+ style\n if (/\\([^)]*\\|[^)]*\\)[+*]/.test(pattern)) return false;\n return true;\n}\n\n// \u2500\u2500 Default config \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport function createDefaultConfig(_projectRoot?: string): KiroGraphConfig {\n return {\n version: 2,\n languages: [],\n include: [],\n exclude: ['**/node_modules/**', '**/dist/**', '**/build/**', '**/.git/**', '*.min.js', '**/.kirograph/**'],\n maxFileSize: 1_048_576,\n extractDocstrings: true,\n trackCallSites: true,\n enableEmbeddings: false,\n embeddingModel: 'nomic-ai/nomic-embed-text-v1.5',\n embeddingDim: 768,\n useVecIndex: false,\n semanticEngine: 'cosine',\n typesenseDashboard: false,\n qdrantDashboard: false,\n minLogLevel: 'warn',\n frameworkHints: [],\n fuzzyResolutionThreshold: 0.5,\n enableArchitecture: false,\n cavemanMode: 'off',\n shellCompressionLevel: 'normal',\n syncWarningThreshold: 10,\n enableMemory: false,\n memorySearchAlpha: 0.5,\n memoryKeepRaw: false,\n memoryMaxObservations: 10000,\n memorySessionTimeout: 7200,\n memoryContextLimit: 3,\n memoryContextThreshold: 0.3,\n memoryExcludePatterns: [],\n enableWatchmen: false,\n watchmenThreshold: 5,\n watchmenSynthesisMode: 'local',\n watchmenLocalModel: 'onnx-community/gemma-4-E4B-it-ONNX',\n enableDocs: false,\n docsInclude: ['**/*.md', '**/*.mdx', '**/*.rst', '**/*.adoc', '**/*.asciidoc', '**/*.rdoc', '**/*.org', '**/*.cheatmd', 'docs/**/*.txt', 'docs/**/*.html'],\n docsExclude: ['node_modules/**', '**/CHANGELOG*', '**/LICENSE*', '**/CHANGES*', 'dist/**', 'build/**', 'coverage/**', '.git/**', '**/generated/**', '**/auto-generated/**', '**/vendor/**', '_build/**'],\n docsLinkCode: true,\n docsContextLimit: 0,\n docsContextThreshold: 0.3,\n docsMaxFileSize: 1_048_576,\n docsSummarization: 'first-sentence',\n enableData: false,\n dataInclude: ['**/*.csv', '**/*.tsv', '**/*.jsonl', '**/*.ndjson', '**/*.xlsx', '**/*.xls', '**/*.parquet', 'data/**/*.json'],\n dataExclude: ['node_modules/**', 'dist/**', 'build/**', '.git/**', '**/package-lock.json', '**/yarn.lock', '**/pnpm-lock.yaml', '**/tsconfig.json', '**/jsconfig.json', 'coverage/**', '**/generated/**'],\n dataLinkCode: true,\n dataContextLimit: 0,\n dataMaxFileSize: 52_428_800,\n dataMaxRows: 1_000_000,\n dataQueryLimit: 500,\n dataMaxResponseTokens: 8000,\n enableSecurity: false,\n securityDatabases: ['OSV'],\n securityAutoEnrich: true,\n securityEnrichMaxAgeDays: 7,\n securityLicensePolicy: { deny: [], warn: [] },\n enablePatterns: false,\n patternLibraryPath: undefined,\n patternSeverityThreshold: 'low',\n };\n}\n\n// \u2500\u2500 Validation \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport function validateConfig(config: unknown): KiroGraphConfig {\n const defaults = createDefaultConfig();\n\n if (typeof config !== 'object' || config === null) {\n return defaults;\n }\n\n const raw = config as Record<string, unknown>;\n\n // Warn about unknown fields\n for (const key of Object.keys(raw)) {\n if (!KNOWN_FIELDS.has(key)) {\n logWarn(`Unknown config field: ${key}`);\n }\n }\n\n // Validate and coerce each field\n const version = typeof raw.version === 'number' ? raw.version : defaults.version;\n const languages = Array.isArray(raw.languages) && raw.languages.every(l => typeof l === 'string')\n ? (raw.languages as string[])\n : defaults.languages;\n const maxFileSize = typeof raw.maxFileSize === 'number' && raw.maxFileSize > 0\n ? raw.maxFileSize\n : defaults.maxFileSize;\n const extractDocstrings = typeof raw.extractDocstrings === 'boolean'\n ? raw.extractDocstrings\n : defaults.extractDocstrings;\n const trackCallSites = typeof raw.trackCallSites === 'boolean'\n ? raw.trackCallSites\n : defaults.trackCallSites;\n const enableEmbeddings = typeof raw.enableEmbeddings === 'boolean'\n ? raw.enableEmbeddings\n : defaults.enableEmbeddings;\n const embeddingModel = typeof raw.embeddingModel === 'string' && raw.embeddingModel.length > 0\n ? raw.embeddingModel\n : defaults.embeddingModel;\n const embeddingDim = typeof raw.embeddingDim === 'number' && raw.embeddingDim > 0\n ? raw.embeddingDim\n : defaults.embeddingDim;\n const useVecIndex = typeof raw.useVecIndex === 'boolean'\n ? raw.useVecIndex\n : defaults.useVecIndex;\n const SEMANTIC_ENGINES = new Set(['cosine', 'sqlite-vec', 'orama', 'pglite', 'lancedb', 'qdrant', 'typesense']);\n // useVecIndex is a legacy alias: if set and no explicit semanticEngine, map it\n const semanticEngine = typeof raw.semanticEngine === 'string' && SEMANTIC_ENGINES.has(raw.semanticEngine)\n ? (raw.semanticEngine as KiroGraphConfig['semanticEngine'])\n : useVecIndex ? 'sqlite-vec' : defaults.semanticEngine;\n const typesenseDashboard = typeof raw.typesenseDashboard === 'boolean'\n ? raw.typesenseDashboard\n : defaults.typesenseDashboard;\n const qdrantDashboard = typeof raw.qdrantDashboard === 'boolean'\n ? raw.qdrantDashboard\n : defaults.qdrantDashboard;\n const minLogLevel = typeof raw.minLogLevel === 'string' && LOG_LEVELS.has(raw.minLogLevel)\n ? (raw.minLogLevel as KiroGraphConfig['minLogLevel'])\n : defaults.minLogLevel;\n const frameworkHints = Array.isArray(raw.frameworkHints) && raw.frameworkHints.every(h => typeof h === 'string')\n ? (raw.frameworkHints as string[])\n : defaults.frameworkHints;\n const fuzzyResolutionThreshold = typeof raw.fuzzyResolutionThreshold === 'number'\n && raw.fuzzyResolutionThreshold >= 0\n && raw.fuzzyResolutionThreshold <= 1\n ? raw.fuzzyResolutionThreshold\n : defaults.fuzzyResolutionThreshold;\n const enableArchitecture = typeof raw.enableArchitecture === 'boolean'\n ? raw.enableArchitecture\n : defaults.enableArchitecture;\n const architectureLayers = _validateArchitectureLayers(raw.architectureLayers);\n const CAVEMAN_MODES = new Set(['off', 'lite', 'full', 'ultra']);\n const cavemanMode = typeof raw.cavemanMode === 'string' && CAVEMAN_MODES.has(raw.cavemanMode)\n ? (raw.cavemanMode as KiroGraphConfig['cavemanMode'])\n : defaults.cavemanMode;\n const COMPRESSION_LEVELS = new Set(['off', 'normal', 'aggressive', 'ultra']);\n // Support legacy field names: enableCompression (boolean) and compressionLevel (string)\n let shellCompressionLevel: KiroGraphConfig['shellCompressionLevel'];\n if (typeof raw.shellCompressionLevel === 'string' && COMPRESSION_LEVELS.has(raw.shellCompressionLevel)) {\n shellCompressionLevel = raw.shellCompressionLevel as KiroGraphConfig['shellCompressionLevel'];\n } else if (typeof raw.compressionLevel === 'string' && COMPRESSION_LEVELS.has(raw.compressionLevel)) {\n shellCompressionLevel = raw.compressionLevel as KiroGraphConfig['shellCompressionLevel'];\n } else if (typeof raw.enableCompression === 'boolean') {\n shellCompressionLevel = raw.enableCompression ? 'normal' : 'off';\n } else {\n shellCompressionLevel = defaults.shellCompressionLevel;\n }\n const syncWarningThreshold = typeof raw.syncWarningThreshold === 'number' && raw.syncWarningThreshold >= 0\n ? Math.round(raw.syncWarningThreshold)\n : defaults.syncWarningThreshold;\n\n // \u2500\u2500 Memory config \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const enableMemory = typeof raw.enableMemory === 'boolean'\n ? raw.enableMemory\n : defaults.enableMemory;\n const memorySearchAlpha = typeof raw.memorySearchAlpha === 'number'\n && raw.memorySearchAlpha >= 0 && raw.memorySearchAlpha <= 1\n ? raw.memorySearchAlpha\n : defaults.memorySearchAlpha;\n const memoryKeepRaw = typeof raw.memoryKeepRaw === 'boolean'\n ? raw.memoryKeepRaw\n : defaults.memoryKeepRaw;\n const memoryMaxObservations = typeof raw.memoryMaxObservations === 'number' && raw.memoryMaxObservations >= 0\n ? Math.round(raw.memoryMaxObservations)\n : defaults.memoryMaxObservations;\n const memorySessionTimeout = typeof raw.memorySessionTimeout === 'number' && raw.memorySessionTimeout > 0\n ? Math.round(raw.memorySessionTimeout)\n : defaults.memorySessionTimeout;\n const memoryContextLimit = typeof raw.memoryContextLimit === 'number' && raw.memoryContextLimit >= 0\n ? Math.round(raw.memoryContextLimit)\n : defaults.memoryContextLimit;\n const memoryContextThreshold = typeof raw.memoryContextThreshold === 'number'\n && raw.memoryContextThreshold >= 0 && raw.memoryContextThreshold <= 1\n ? raw.memoryContextThreshold\n : defaults.memoryContextThreshold;\n const memoryExcludePatterns = Array.isArray(raw.memoryExcludePatterns)\n && raw.memoryExcludePatterns.every((p: unknown) => typeof p === 'string')\n ? (raw.memoryExcludePatterns as string[])\n : defaults.memoryExcludePatterns;\n\n // \u2500\u2500 Watchmen config \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const enableWatchmen = typeof raw.enableWatchmen === 'boolean'\n ? raw.enableWatchmen\n : defaults.enableWatchmen;\n const watchmenThreshold = typeof raw.watchmenThreshold === 'number' && raw.watchmenThreshold > 0\n ? Math.round(raw.watchmenThreshold)\n : defaults.watchmenThreshold;\n const WATCHMEN_SYNTHESIS_MODES = new Set(['local', 'agent']);\n const watchmenSynthesisMode = typeof raw.watchmenSynthesisMode === 'string' && WATCHMEN_SYNTHESIS_MODES.has(raw.watchmenSynthesisMode)\n ? (raw.watchmenSynthesisMode as KiroGraphConfig['watchmenSynthesisMode'])\n : defaults.watchmenSynthesisMode;\n const watchmenLocalModel = typeof raw.watchmenLocalModel === 'string' && raw.watchmenLocalModel.length > 0\n ? raw.watchmenLocalModel\n : defaults.watchmenLocalModel;\n\n // \u2500\u2500 Docs config \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const enableDocs = typeof raw.enableDocs === 'boolean'\n ? raw.enableDocs\n : defaults.enableDocs;\n const docsInclude = Array.isArray(raw.docsInclude)\n && raw.docsInclude.every((p: unknown) => typeof p === 'string')\n ? (raw.docsInclude as string[])\n : defaults.docsInclude;\n const docsExclude = Array.isArray(raw.docsExclude)\n && raw.docsExclude.every((p: unknown) => typeof p === 'string')\n ? (raw.docsExclude as string[])\n : defaults.docsExclude;\n const docsLinkCode = typeof raw.docsLinkCode === 'boolean'\n ? raw.docsLinkCode\n : defaults.docsLinkCode;\n const docsContextLimit = typeof raw.docsContextLimit === 'number' && raw.docsContextLimit >= 0\n ? Math.round(raw.docsContextLimit)\n : defaults.docsContextLimit;\n const docsContextThreshold = typeof raw.docsContextThreshold === 'number'\n && raw.docsContextThreshold >= 0 && raw.docsContextThreshold <= 1\n ? raw.docsContextThreshold\n : defaults.docsContextThreshold;\n const docsMaxFileSize = typeof raw.docsMaxFileSize === 'number' && raw.docsMaxFileSize > 0\n ? raw.docsMaxFileSize\n : defaults.docsMaxFileSize;\n const DOCS_SUMMARIZATION_MODES = new Set(['embedding', 'first-sentence', 'off']);\n const docsSummarization = typeof raw.docsSummarization === 'string' && DOCS_SUMMARIZATION_MODES.has(raw.docsSummarization)\n ? (raw.docsSummarization as KiroGraphConfig['docsSummarization'])\n : defaults.docsSummarization;\n\n // \u2500\u2500 Data config \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const enableData = typeof raw.enableData === 'boolean' ? raw.enableData : defaults.enableData;\n const dataInclude = Array.isArray(raw.dataInclude) && raw.dataInclude.every((p: unknown) => typeof p === 'string')\n ? (raw.dataInclude as string[]) : defaults.dataInclude;\n const dataExclude = Array.isArray(raw.dataExclude) && raw.dataExclude.every((p: unknown) => typeof p === 'string')\n ? (raw.dataExclude as string[]) : defaults.dataExclude;\n const dataLinkCode = typeof raw.dataLinkCode === 'boolean' ? raw.dataLinkCode : defaults.dataLinkCode;\n const dataContextLimit = typeof raw.dataContextLimit === 'number' && raw.dataContextLimit >= 0\n ? Math.round(raw.dataContextLimit) : defaults.dataContextLimit;\n const dataMaxFileSize = typeof raw.dataMaxFileSize === 'number' && raw.dataMaxFileSize > 0\n ? raw.dataMaxFileSize : defaults.dataMaxFileSize;\n const dataMaxRows = typeof raw.dataMaxRows === 'number' && raw.dataMaxRows > 0\n ? Math.round(raw.dataMaxRows) : defaults.dataMaxRows;\n const dataQueryLimit = typeof raw.dataQueryLimit === 'number' && raw.dataQueryLimit > 0\n ? Math.min(Math.round(raw.dataQueryLimit), 500) : defaults.dataQueryLimit;\n const dataMaxResponseTokens = typeof raw.dataMaxResponseTokens === 'number' && raw.dataMaxResponseTokens > 0\n ? Math.round(raw.dataMaxResponseTokens) : defaults.dataMaxResponseTokens;\n\n // \u2500\u2500 Security config \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n let enableSecurity: boolean;\n if (typeof raw.enableSecurity === 'boolean') {\n enableSecurity = raw.enableSecurity;\n } else {\n if (raw.enableSecurity !== undefined) {\n logWarn('Invalid config field enableSecurity: expected boolean, applying default (false)');\n }\n enableSecurity = defaults.enableSecurity;\n }\n\n let securityAutoEnrich: boolean;\n if (typeof raw.securityAutoEnrich === 'boolean') {\n securityAutoEnrich = raw.securityAutoEnrich;\n } else {\n if (raw.securityAutoEnrich !== undefined) {\n logWarn('Invalid config field securityAutoEnrich: expected boolean, applying default (true)');\n }\n securityAutoEnrich = defaults.securityAutoEnrich;\n }\n\n let securityEnrichMaxAgeDays: number;\n if (typeof raw.securityEnrichMaxAgeDays === 'number' && raw.securityEnrichMaxAgeDays > 0) {\n securityEnrichMaxAgeDays = raw.securityEnrichMaxAgeDays;\n } else {\n if (raw.securityEnrichMaxAgeDays !== undefined) {\n logWarn('Invalid config field securityEnrichMaxAgeDays: expected positive number, applying default (7)');\n }\n securityEnrichMaxAgeDays = defaults.securityEnrichMaxAgeDays;\n }\n\n const SUPPORTED_SECURITY_DATABASES = new Set(['OSV']);\n let securityDatabases: string[];\n if (Array.isArray(raw.securityDatabases) && raw.securityDatabases.every((d: unknown) => typeof d === 'string')) {\n const valid = (raw.securityDatabases as string[]).filter(d => {\n if (!SUPPORTED_SECURITY_DATABASES.has(d)) {\n logWarn(`Unsupported security database \"${d}\" in securityDatabases, ignoring`);\n return false;\n }\n return true;\n });\n securityDatabases = valid.length > 0 ? valid : defaults.securityDatabases;\n } else {\n if (raw.securityDatabases !== undefined) {\n logWarn('Invalid config field securityDatabases: expected array of strings, applying default ([\"OSV\"])');\n }\n securityDatabases = defaults.securityDatabases;\n }\n\n let securityLicensePolicy: KiroGraphConfig['securityLicensePolicy'];\n if (raw.securityLicensePolicy && typeof raw.securityLicensePolicy === 'object' && !Array.isArray(raw.securityLicensePolicy)) {\n const rawPolicy = raw.securityLicensePolicy as Record<string, unknown>;\n const deny = Array.isArray(rawPolicy.deny) && rawPolicy.deny.every((p: unknown) => typeof p === 'string')\n ? (rawPolicy.deny as string[])\n : defaults.securityLicensePolicy.deny;\n const warn = Array.isArray(rawPolicy.warn) && rawPolicy.warn.every((p: unknown) => typeof p === 'string')\n ? (rawPolicy.warn as string[])\n : defaults.securityLicensePolicy.warn;\n securityLicensePolicy = { deny, warn };\n } else {\n if (raw.securityLicensePolicy !== undefined) {\n logWarn('Invalid config field securityLicensePolicy: expected object with deny/warn arrays, applying default');\n }\n securityLicensePolicy = defaults.securityLicensePolicy;\n }\n\n // \u2500\u2500 Patterns config \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n let enablePatterns: boolean;\n if (typeof raw.enablePatterns === 'boolean') {\n enablePatterns = raw.enablePatterns;\n } else {\n if (raw.enablePatterns !== undefined) {\n logWarn('Invalid config field enablePatterns: expected boolean, applying default (false)');\n }\n enablePatterns = defaults.enablePatterns;\n }\n\n let patternLibraryPath: string | undefined;\n if (raw.patternLibraryPath === undefined || raw.patternLibraryPath === null) {\n patternLibraryPath = undefined;\n } else if (typeof raw.patternLibraryPath === 'string') {\n patternLibraryPath = raw.patternLibraryPath;\n } else {\n logWarn('Invalid config field patternLibraryPath: expected string or undefined, applying default (undefined)');\n patternLibraryPath = defaults.patternLibraryPath;\n }\n\n const PATTERN_SEVERITY_LEVELS = new Set(['critical', 'high', 'medium', 'low']);\n let patternSeverityThreshold: KiroGraphConfig['patternSeverityThreshold'];\n if (typeof raw.patternSeverityThreshold === 'string' && PATTERN_SEVERITY_LEVELS.has(raw.patternSeverityThreshold)) {\n patternSeverityThreshold = raw.patternSeverityThreshold as KiroGraphConfig['patternSeverityThreshold'];\n } else {\n if (raw.patternSeverityThreshold !== undefined) {\n logWarn('Invalid config field patternSeverityThreshold: expected critical|high|medium|low, applying default (low)');\n }\n patternSeverityThreshold = defaults.patternSeverityThreshold;\n }\n\n // Dependency constraint: enableSecurity requires enableArchitecture\n let finalEnableArchitecture = enableArchitecture;\n if (enableSecurity && !enableArchitecture) {\n logWarn('enableSecurity requires enableArchitecture \\u2014 auto-enabling architecture analysis');\n finalEnableArchitecture = true;\n }\n\n // \u2500\u2500 Context budget config \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n let contextBudget: KiroGraphConfig['contextBudget'] | undefined;\n if (raw.contextBudget && typeof raw.contextBudget === 'object' && !Array.isArray(raw.contextBudget)) {\n const cb = raw.contextBudget as Record<string, unknown>;\n contextBudget = {\n maxTokensPerSession: typeof cb.maxTokensPerSession === 'number' && cb.maxTokensPerSession > 0\n ? Math.round(cb.maxTokensPerSession) : 100_000,\n warnAt: typeof cb.warnAt === 'number' && cb.warnAt > 0\n ? Math.round(cb.warnAt) : 80_000,\n throttleAt: typeof cb.throttleAt === 'number' && cb.throttleAt > 0\n ? Math.round(cb.throttleAt) : 95_000,\n };\n }\n\n // Validate glob patterns \u2014 exclude unsafe regex patterns\n const include = _validatePatterns(raw.include, defaults.include);\n const exclude = _validatePatterns(raw.exclude, defaults.exclude);\n\n return {\n version,\n languages,\n include,\n exclude,\n maxFileSize,\n extractDocstrings,\n trackCallSites,\n enableEmbeddings,\n embeddingModel,\n embeddingDim,\n useVecIndex,\n semanticEngine,\n typesenseDashboard,\n qdrantDashboard,\n minLogLevel,\n frameworkHints,\n fuzzyResolutionThreshold,\n enableArchitecture: finalEnableArchitecture,\n cavemanMode,\n shellCompressionLevel,\n syncWarningThreshold,\n enableMemory,\n memorySearchAlpha,\n memoryKeepRaw,\n memoryMaxObservations,\n memorySessionTimeout,\n memoryContextLimit,\n memoryContextThreshold,\n memoryExcludePatterns,\n enableWatchmen: enableWatchmen && enableMemory,\n watchmenThreshold,\n watchmenSynthesisMode,\n watchmenLocalModel,\n enableDocs,\n docsInclude,\n docsExclude,\n docsLinkCode,\n docsContextLimit,\n docsContextThreshold,\n docsMaxFileSize,\n docsSummarization,\n enableData,\n dataInclude,\n dataExclude,\n dataLinkCode,\n dataContextLimit,\n dataMaxFileSize,\n dataMaxRows,\n dataQueryLimit,\n dataMaxResponseTokens,\n enableSecurity,\n securityDatabases,\n securityAutoEnrich,\n securityEnrichMaxAgeDays,\n securityLicensePolicy,\n enablePatterns,\n patternLibraryPath,\n patternSeverityThreshold,\n ...(architectureLayers !== undefined ? { architectureLayers } : {}),\n ...(contextBudget !== undefined ? { contextBudget } : {}),\n };\n}\n\nfunction _validateArchitectureLayers(raw: unknown): Record<string, string[]> | undefined {\n if (raw === undefined || raw === null) return undefined;\n if (typeof raw !== 'object' || Array.isArray(raw)) return undefined;\n const result: Record<string, string[]> = {};\n for (const [key, val] of Object.entries(raw as Record<string, unknown>)) {\n if (typeof key !== 'string') continue;\n if (!Array.isArray(val)) continue;\n const patterns = val.filter((p): p is string => typeof p === 'string' && isSafeRegex(p));\n if (patterns.length > 0) result[key] = patterns;\n }\n return Object.keys(result).length > 0 ? result : undefined;\n}\n\nfunction _validatePatterns(raw: unknown, fallback: string[]): string[] {\n if (!Array.isArray(raw)) return fallback;\n const valid: string[] = [];\n for (const p of raw) {\n if (typeof p !== 'string') continue;\n if (!isSafeRegex(p)) {\n logWarn(`Unsafe regex pattern skipped: ${p}`);\n continue;\n }\n valid.push(p);\n }\n return valid;\n}\n\n// \u2500\u2500 Migration helpers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/**\n * Upgrades shallow exclude patterns (e.g. \"node_modules/**\") to recursive ones\n * (e.g. \"** /node_modules/**\") so nested directories are excluded at any depth.\n */\nconst SHALLOW_TO_RECURSIVE: Record<string, string> = {\n 'node_modules/**': '**/node_modules/**',\n 'dist/**': '**/dist/**',\n 'build/**': '**/build/**',\n '.git/**': '**/.git/**',\n '.kirograph/**': '**/.kirograph/**',\n};\n\nfunction migrateExcludePatterns(patterns: string[]): string[] {\n return patterns.map(p => SHALLOW_TO_RECURSIVE[p] ?? p);\n}\n\n// \u2500\u2500 Load / Save \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport async function loadConfig(projectRoot: string): Promise<KiroGraphConfig> {\n const dir = path.join(projectRoot, KIROGRAPH_DIR);\n const cfgPath = path.join(dir, CONFIG_FILE);\n\n if (!fs.existsSync(cfgPath)) {\n // Create default config file\n const defaults = createDefaultConfig(projectRoot);\n await fs.promises.mkdir(dir, { recursive: true });\n await _writeAtomic(cfgPath, defaults);\n return defaults;\n }\n\n let raw: unknown;\n try {\n const text = await fs.promises.readFile(cfgPath, 'utf8');\n raw = JSON.parse(text);\n } catch (err) {\n logError('Config parse error', { path: cfgPath, error: err instanceof Error ? err.message : String(err) });\n return createDefaultConfig(projectRoot);\n }\n\n const config = validateConfig(raw);\n\n // Migrate v1 \u2192 v2: upgrade shallow exclude patterns to recursive\n if (config.version < 2) {\n config.version = 2;\n config.exclude = migrateExcludePatterns(config.exclude);\n await fs.promises.mkdir(dir, { recursive: true });\n await _writeAtomic(cfgPath, config);\n }\n\n return config;\n}\n\nexport async function saveConfig(projectRoot: string, config: KiroGraphConfig): Promise<void> {\n const dir = path.join(projectRoot, KIROGRAPH_DIR);\n const cfgPath = path.join(dir, CONFIG_FILE);\n await fs.promises.mkdir(dir, { recursive: true });\n await _writeAtomic(cfgPath, config);\n}\n\nasync function _writeAtomic(cfgPath: string, config: KiroGraphConfig): Promise<void> {\n const tmp = cfgPath + '.tmp';\n await fs.promises.writeFile(tmp, JSON.stringify(config, null, 2), 'utf8');\n await fs.promises.rename(tmp, cfgPath);\n}\n\n// \u2500\u2500 Update helpers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport async function updateConfig(\n projectRoot: string,\n patch: Partial<KiroGraphConfig>\n): Promise<KiroGraphConfig> {\n const current = await loadConfig(projectRoot);\n const updated = validateConfig({ ...current, ...patch });\n await saveConfig(projectRoot, updated);\n return updated;\n}\n\nexport async function addIncludePatterns(projectRoot: string, patterns: string[]): Promise<void> {\n const config = await loadConfig(projectRoot);\n const existing = new Set(config.include);\n const toAdd = patterns.filter(p => isSafeRegex(p) && !existing.has(p));\n if (toAdd.length === 0) return;\n await saveConfig(projectRoot, { ...config, include: [...config.include, ...toAdd] });\n}\n\nexport async function addExcludePatterns(projectRoot: string, patterns: string[]): Promise<void> {\n const config = await loadConfig(projectRoot);\n const existing = new Set(config.exclude);\n const toAdd = patterns.filter(p => isSafeRegex(p) && !existing.has(p));\n if (toAdd.length === 0) return;\n await saveConfig(projectRoot, { ...config, exclude: [...config.exclude, ...toAdd] });\n}\n\n// \u2500\u2500 File inclusion check \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport function shouldIncludeFile(config: KiroGraphConfig, relPath: string): boolean {\n // Check exclude patterns first\n for (const pattern of config.exclude) {\n if (picomatch(pattern)(relPath)) return false;\n }\n // If include patterns are specified, file must match at least one\n if (config.include.length > 0) {\n return config.include.some(pattern => picomatch(pattern)(relPath));\n }\n return true;\n}\n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EAAE,CAAC;AACrF;AAEA,eAAsB,mBAAmB,aAAqB,UAAmC;AAC/F,QAAM,SAAS,MAAM,WAAW,WAAW;AAC3C,QAAM,WAAW,IAAI,IAAI,OAAO,OAAO;AACvC,QAAM,QAAQ,SAAS,OAAO,OAAK,YAAY,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,CAAC;AACrE,MAAI,MAAM,WAAW,EAAG;AACxB,QAAM,WAAW,aAAa,EAAE,GAAG,QAAQ,SAAS,CAAC,GAAG,OAAO,SAAS,GAAG,KAAK,EAAE,CAAC;AACrF;AAIO,SAAS,kBAAkB,QAAyB,SAA0B;AAEnF,aAAW,WAAW,OAAO,SAAS;AACpC,YAAI,iBAAAA,SAAU,OAAO,EAAE,OAAO,EAAG,QAAO;AAAA,EAC1C;AAEA,MAAI,OAAO,QAAQ,SAAS,GAAG;AAC7B,WAAO,OAAO,QAAQ,KAAK,iBAAW,iBAAAA,SAAU,OAAO,EAAE,OAAO,CAAC;AAAA,EACnE;AACA,SAAO;AACT;",
6
6
  "names": ["picomatch"]
7
7
  }
@@ -16,5 +16,7 @@ export declare class LockManager {
16
16
  markDirty(): void;
17
17
  clearDirty(): void;
18
18
  isDirty(): boolean;
19
+ /** Returns true if a sync/index is currently running (lock file held by another process). */
20
+ isLocked(): boolean;
19
21
  }
20
22
  //# sourceMappingURL=lock-manager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lock-manager.d.ts","sourceRoot":"","sources":["../../src/core/lock-manager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,qBAAa,WAAW;IAIV,OAAO,CAAC,QAAQ,CAAC,WAAW;IAHxC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEN,WAAW,EAAE,MAAM;IAQhD,OAAO,IAAI,IAAI;IA4Bf,OAAO,IAAI,IAAI;IAIf,YAAY,IAAI,IAAI;IAMpB,SAAS,IAAI,IAAI;IAIjB,UAAU,IAAI,IAAI;IAIlB,OAAO,IAAI,OAAO;CAGnB"}
1
+ {"version":3,"file":"lock-manager.d.ts","sourceRoot":"","sources":["../../src/core/lock-manager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH,qBAAa,WAAW;IAIV,OAAO,CAAC,QAAQ,CAAC,WAAW;IAHxC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEN,WAAW,EAAE,MAAM;IAQhD,OAAO,IAAI,IAAI;IA4Bf,OAAO,IAAI,IAAI;IAIf,YAAY,IAAI,IAAI;IAMpB,SAAS,IAAI,IAAI;IAIjB,UAAU,IAAI,IAAI;IAIlB,OAAO,IAAI,OAAO;IAIlB,6FAA6F;IAC7F,QAAQ,IAAI,OAAO;CAapB"}
@@ -32,6 +32,9 @@ export declare class IndexPipeline {
32
32
  force?: boolean;
33
33
  signal?: AbortSignal;
34
34
  }): Promise<IndexResult>;
35
- sync(changedFiles?: string[]): Promise<SyncResult>;
35
+ sync(opts?: {
36
+ changedFiles?: string[];
37
+ onProgress?: (p: IndexProgress) => void;
38
+ }): Promise<SyncResult>;
36
39
  }
37
40
  //# sourceMappingURL=pipeline.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/core/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAI/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,UAAU,C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jD,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAK7C,qBAAa,aAAa;IAItB,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAT9B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAe;gBAGlB,EAAE,EAAE,aAAa,EACjB,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,iBAAiB,EAC3B,IAAI,EAAE,oBAAoB,EAC1B,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,eAAe,EACvB,WAAW,EAAE,MAAM;IAGhC,QAAQ,CAAC,IAAI,CAAC,EAAE;QACpB,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;QACxC,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GAAG,OAAO,CAAC,WAAW,CAAC;IAqQlB,IAAI,CAAC,IAAI,CAAC,EAAE;QAChB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;QACxB,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;KACzC,GAAG,OAAO,CAAC,UAAU,CAAC;CA+QxB"}
@@ -256,6 +256,20 @@ class IndexPipeline {
256
256
  } catch {
257
257
  }
258
258
  }
259
+ if (this.config.enablePatterns) {
260
+ try {
261
+ this.db.applyPatternsSchema();
262
+ const { PatternIndexer } = await Promise.resolve().then(() => require("../patterns/indexer.js"));
263
+ const indexer = new PatternIndexer(this.db.getRawDb(), this.config, this.projectRoot);
264
+ await indexer.indexAll((phase, current, total) => {
265
+ opts?.onProgress?.({ phase: "patterns", current, total });
266
+ });
267
+ } catch (err) {
268
+ const { logWarn } = await Promise.resolve().then(() => require("../errors.js"));
269
+ const msg = err instanceof Error ? err.message : String(err);
270
+ logWarn(`[patterns] Pattern indexing failed (non-critical): ${msg}`);
271
+ }
272
+ }
259
273
  this.lock.clearDirty();
260
274
  return { success: errors.length === 0, filesIndexed, nodesCreated, edgesCreated, errors, duration: Date.now() - start };
261
275
  } finally {
@@ -291,6 +305,7 @@ class IndexPipeline {
291
305
  await this.vectors.deleteEmbeddings(oldNodes.map((n) => n.id));
292
306
  this.db.deleteFile(rel);
293
307
  this.db.deleteUnresolvedRefsByFile(rel);
308
+ this.db.getRawDb().run("DELETE FROM pattern_matches WHERE file_path = ?", [rel]);
294
309
  result.removed.push(rel);
295
310
  };
296
311
  const allIndexed = this.db.getAllFiles();
@@ -470,6 +485,33 @@ class IndexPipeline {
470
485
  } catch {
471
486
  }
472
487
  }
488
+ if (this.config.enablePatterns) {
489
+ try {
490
+ const tableExists = this.db.getRawDb().get(
491
+ "SELECT name FROM sqlite_master WHERE type='table' AND name='pattern_matches'"
492
+ );
493
+ if (tableExists) {
494
+ const { PatternIndexer } = await Promise.resolve().then(() => require("../patterns/indexer.js"));
495
+ const { PatternLibraryLoader } = await Promise.resolve().then(() => require("../patterns/loader.js"));
496
+ const { PatternRunner } = await Promise.resolve().then(() => require("../patterns/runner.js"));
497
+ const runner = new PatternRunner();
498
+ if (runner.isAvailable()) {
499
+ const loader = new PatternLibraryLoader();
500
+ const builtinPath = require("path").join(__dirname, "../patterns/library");
501
+ const rules = loader.load(builtinPath, this.config.patternLibraryPath);
502
+ const threshold = this.config.patternSeverityThreshold ?? "low";
503
+ const indexer = new PatternIndexer(this.db.getRawDb(), this.config, this.projectRoot);
504
+ const changedPaths = [...result.added, ...result.modified];
505
+ for (const filePath of changedPaths) {
506
+ const fileRecord = this.db.getFile(filePath);
507
+ const language = fileRecord?.language ?? "unknown";
508
+ await indexer.indexFile(filePath, language, rules, runner, threshold, Date.now());
509
+ }
510
+ }
511
+ }
512
+ } catch {
513
+ }
514
+ }
473
515
  this.lock.clearDirty();
474
516
  result.duration = Date.now() - start;
475
517
  return result;