@vizalice/codegraph 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (821) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +872 -0
  3. package/dist/bin/codegraph.d.ts +26 -0
  4. package/dist/bin/codegraph.d.ts.map +1 -0
  5. package/dist/bin/codegraph.js +2324 -0
  6. package/dist/bin/codegraph.js.map +1 -0
  7. package/dist/bin/command-supervision.d.ts +49 -0
  8. package/dist/bin/command-supervision.d.ts.map +1 -0
  9. package/dist/bin/command-supervision.js +95 -0
  10. package/dist/bin/command-supervision.js.map +1 -0
  11. package/dist/bin/fatal-handler.d.ts +20 -0
  12. package/dist/bin/fatal-handler.d.ts.map +1 -0
  13. package/dist/bin/fatal-handler.js +118 -0
  14. package/dist/bin/fatal-handler.js.map +1 -0
  15. package/dist/bin/node-version-check.d.ts +37 -0
  16. package/dist/bin/node-version-check.d.ts.map +1 -0
  17. package/dist/bin/node-version-check.js +79 -0
  18. package/dist/bin/node-version-check.js.map +1 -0
  19. package/dist/bin/uninstall.d.ts +14 -0
  20. package/dist/bin/uninstall.d.ts.map +1 -0
  21. package/dist/bin/uninstall.js +36 -0
  22. package/dist/bin/uninstall.js.map +1 -0
  23. package/dist/context/formatter.d.ts +36 -0
  24. package/dist/context/formatter.d.ts.map +1 -0
  25. package/dist/context/formatter.js +269 -0
  26. package/dist/context/formatter.js.map +1 -0
  27. package/dist/context/index.d.ts +119 -0
  28. package/dist/context/index.d.ts.map +1 -0
  29. package/dist/context/index.js +1333 -0
  30. package/dist/context/index.js.map +1 -0
  31. package/dist/context/markers.d.ts +19 -0
  32. package/dist/context/markers.d.ts.map +1 -0
  33. package/dist/context/markers.js +22 -0
  34. package/dist/context/markers.js.map +1 -0
  35. package/dist/db/index.d.ts +378 -0
  36. package/dist/db/index.d.ts.map +1 -0
  37. package/dist/db/index.js +831 -0
  38. package/dist/db/index.js.map +1 -0
  39. package/dist/db/migrations.d.ts +44 -0
  40. package/dist/db/migrations.d.ts.map +1 -0
  41. package/dist/db/migrations.js +236 -0
  42. package/dist/db/migrations.js.map +1 -0
  43. package/dist/db/queries.d.ts +705 -0
  44. package/dist/db/queries.d.ts.map +1 -0
  45. package/dist/db/queries.js +2435 -0
  46. package/dist/db/queries.js.map +1 -0
  47. package/dist/db/schema.sql +207 -0
  48. package/dist/db/sqlite-adapter.d.ts +55 -0
  49. package/dist/db/sqlite-adapter.d.ts.map +1 -0
  50. package/dist/db/sqlite-adapter.js +135 -0
  51. package/dist/db/sqlite-adapter.js.map +1 -0
  52. package/dist/db/wal-valve.d.ts +119 -0
  53. package/dist/db/wal-valve.d.ts.map +1 -0
  54. package/dist/db/wal-valve.js +290 -0
  55. package/dist/db/wal-valve.js.map +1 -0
  56. package/dist/directory.d.ts +183 -0
  57. package/dist/directory.d.ts.map +1 -0
  58. package/dist/directory.js +797 -0
  59. package/dist/directory.js.map +1 -0
  60. package/dist/errors.d.ts +136 -0
  61. package/dist/errors.d.ts.map +1 -0
  62. package/dist/errors.js +219 -0
  63. package/dist/errors.js.map +1 -0
  64. package/dist/extraction/astro-extractor.d.ts +79 -0
  65. package/dist/extraction/astro-extractor.d.ts.map +1 -0
  66. package/dist/extraction/astro-extractor.js +320 -0
  67. package/dist/extraction/astro-extractor.js.map +1 -0
  68. package/dist/extraction/cfml-extractor.d.ts +107 -0
  69. package/dist/extraction/cfml-extractor.d.ts.map +1 -0
  70. package/dist/extraction/cfml-extractor.js +494 -0
  71. package/dist/extraction/cfml-extractor.js.map +1 -0
  72. package/dist/extraction/dfm-extractor.d.ts +31 -0
  73. package/dist/extraction/dfm-extractor.d.ts.map +1 -0
  74. package/dist/extraction/dfm-extractor.js +151 -0
  75. package/dist/extraction/dfm-extractor.js.map +1 -0
  76. package/dist/extraction/extraction-version.d.ts +25 -0
  77. package/dist/extraction/extraction-version.d.ts.map +1 -0
  78. package/dist/extraction/extraction-version.js +28 -0
  79. package/dist/extraction/extraction-version.js.map +1 -0
  80. package/dist/extraction/function-ref.d.ts +118 -0
  81. package/dist/extraction/function-ref.d.ts.map +1 -0
  82. package/dist/extraction/function-ref.js +733 -0
  83. package/dist/extraction/function-ref.js.map +1 -0
  84. package/dist/extraction/generated-detection.d.ts +66 -0
  85. package/dist/extraction/generated-detection.d.ts.map +1 -0
  86. package/dist/extraction/generated-detection.js +248 -0
  87. package/dist/extraction/generated-detection.js.map +1 -0
  88. package/dist/extraction/grammars.d.ts +138 -0
  89. package/dist/extraction/grammars.d.ts.map +1 -0
  90. package/dist/extraction/grammars.js +694 -0
  91. package/dist/extraction/grammars.js.map +1 -0
  92. package/dist/extraction/index.d.ts +308 -0
  93. package/dist/extraction/index.d.ts.map +1 -0
  94. package/dist/extraction/index.js +2711 -0
  95. package/dist/extraction/index.js.map +1 -0
  96. package/dist/extraction/kernel/decode.d.ts +9 -0
  97. package/dist/extraction/kernel/decode.d.ts.map +1 -0
  98. package/dist/extraction/kernel/decode.js +162 -0
  99. package/dist/extraction/kernel/decode.js.map +1 -0
  100. package/dist/extraction/kernel/index.d.ts +64 -0
  101. package/dist/extraction/kernel/index.d.ts.map +1 -0
  102. package/dist/extraction/kernel/index.js +279 -0
  103. package/dist/extraction/kernel/index.js.map +1 -0
  104. package/dist/extraction/kernel/layout.d.ts +101 -0
  105. package/dist/extraction/kernel/layout.d.ts.map +1 -0
  106. package/dist/extraction/kernel/layout.js +104 -0
  107. package/dist/extraction/kernel/layout.js.map +1 -0
  108. package/dist/extraction/kernel/loader.d.ts +103 -0
  109. package/dist/extraction/kernel/loader.d.ts.map +1 -0
  110. package/dist/extraction/kernel/loader.js +146 -0
  111. package/dist/extraction/kernel/loader.js.map +1 -0
  112. package/dist/extraction/languages/arkts.d.ts +3 -0
  113. package/dist/extraction/languages/arkts.d.ts.map +1 -0
  114. package/dist/extraction/languages/arkts.js +127 -0
  115. package/dist/extraction/languages/arkts.js.map +1 -0
  116. package/dist/extraction/languages/c-cpp.d.ts +124 -0
  117. package/dist/extraction/languages/c-cpp.d.ts.map +1 -0
  118. package/dist/extraction/languages/c-cpp.js +1689 -0
  119. package/dist/extraction/languages/c-cpp.js.map +1 -0
  120. package/dist/extraction/languages/cfquery.d.ts +12 -0
  121. package/dist/extraction/languages/cfquery.d.ts.map +1 -0
  122. package/dist/extraction/languages/cfquery.js +28 -0
  123. package/dist/extraction/languages/cfquery.js.map +1 -0
  124. package/dist/extraction/languages/cfscript.d.ts +3 -0
  125. package/dist/extraction/languages/cfscript.d.ts.map +1 -0
  126. package/dist/extraction/languages/cfscript.js +73 -0
  127. package/dist/extraction/languages/cfscript.js.map +1 -0
  128. package/dist/extraction/languages/cobol.d.ts +33 -0
  129. package/dist/extraction/languages/cobol.d.ts.map +1 -0
  130. package/dist/extraction/languages/cobol.js +499 -0
  131. package/dist/extraction/languages/cobol.js.map +1 -0
  132. package/dist/extraction/languages/csharp.d.ts +25 -0
  133. package/dist/extraction/languages/csharp.d.ts.map +1 -0
  134. package/dist/extraction/languages/csharp.js +175 -0
  135. package/dist/extraction/languages/csharp.js.map +1 -0
  136. package/dist/extraction/languages/dart.d.ts +3 -0
  137. package/dist/extraction/languages/dart.d.ts.map +1 -0
  138. package/dist/extraction/languages/dart.js +374 -0
  139. package/dist/extraction/languages/dart.js.map +1 -0
  140. package/dist/extraction/languages/erlang.d.ts +3 -0
  141. package/dist/extraction/languages/erlang.d.ts.map +1 -0
  142. package/dist/extraction/languages/erlang.js +350 -0
  143. package/dist/extraction/languages/erlang.js.map +1 -0
  144. package/dist/extraction/languages/go.d.ts +3 -0
  145. package/dist/extraction/languages/go.d.ts.map +1 -0
  146. package/dist/extraction/languages/go.js +111 -0
  147. package/dist/extraction/languages/go.js.map +1 -0
  148. package/dist/extraction/languages/index.d.ts +10 -0
  149. package/dist/extraction/languages/index.d.ts.map +1 -0
  150. package/dist/extraction/languages/index.js +71 -0
  151. package/dist/extraction/languages/index.js.map +1 -0
  152. package/dist/extraction/languages/java.d.ts +3 -0
  153. package/dist/extraction/languages/java.d.ts.map +1 -0
  154. package/dist/extraction/languages/java.js +315 -0
  155. package/dist/extraction/languages/java.js.map +1 -0
  156. package/dist/extraction/languages/javascript.d.ts +3 -0
  157. package/dist/extraction/languages/javascript.d.ts.map +1 -0
  158. package/dist/extraction/languages/javascript.js +106 -0
  159. package/dist/extraction/languages/javascript.js.map +1 -0
  160. package/dist/extraction/languages/kotlin.d.ts +3 -0
  161. package/dist/extraction/languages/kotlin.d.ts.map +1 -0
  162. package/dist/extraction/languages/kotlin.js +379 -0
  163. package/dist/extraction/languages/kotlin.js.map +1 -0
  164. package/dist/extraction/languages/lua.d.ts +3 -0
  165. package/dist/extraction/languages/lua.d.ts.map +1 -0
  166. package/dist/extraction/languages/lua.js +150 -0
  167. package/dist/extraction/languages/lua.js.map +1 -0
  168. package/dist/extraction/languages/luau.d.ts +3 -0
  169. package/dist/extraction/languages/luau.d.ts.map +1 -0
  170. package/dist/extraction/languages/luau.js +37 -0
  171. package/dist/extraction/languages/luau.js.map +1 -0
  172. package/dist/extraction/languages/nix.d.ts +3 -0
  173. package/dist/extraction/languages/nix.d.ts.map +1 -0
  174. package/dist/extraction/languages/nix.js +294 -0
  175. package/dist/extraction/languages/nix.js.map +1 -0
  176. package/dist/extraction/languages/objc.d.ts +3 -0
  177. package/dist/extraction/languages/objc.d.ts.map +1 -0
  178. package/dist/extraction/languages/objc.js +179 -0
  179. package/dist/extraction/languages/objc.js.map +1 -0
  180. package/dist/extraction/languages/pascal.d.ts +3 -0
  181. package/dist/extraction/languages/pascal.d.ts.map +1 -0
  182. package/dist/extraction/languages/pascal.js +77 -0
  183. package/dist/extraction/languages/pascal.js.map +1 -0
  184. package/dist/extraction/languages/php.d.ts +3 -0
  185. package/dist/extraction/languages/php.d.ts.map +1 -0
  186. package/dist/extraction/languages/php.js +196 -0
  187. package/dist/extraction/languages/php.js.map +1 -0
  188. package/dist/extraction/languages/python.d.ts +3 -0
  189. package/dist/extraction/languages/python.d.ts.map +1 -0
  190. package/dist/extraction/languages/python.js +56 -0
  191. package/dist/extraction/languages/python.js.map +1 -0
  192. package/dist/extraction/languages/r.d.ts +3 -0
  193. package/dist/extraction/languages/r.d.ts.map +1 -0
  194. package/dist/extraction/languages/r.js +314 -0
  195. package/dist/extraction/languages/r.js.map +1 -0
  196. package/dist/extraction/languages/ruby.d.ts +3 -0
  197. package/dist/extraction/languages/ruby.d.ts.map +1 -0
  198. package/dist/extraction/languages/ruby.js +149 -0
  199. package/dist/extraction/languages/ruby.js.map +1 -0
  200. package/dist/extraction/languages/rust.d.ts +3 -0
  201. package/dist/extraction/languages/rust.d.ts.map +1 -0
  202. package/dist/extraction/languages/rust.js +145 -0
  203. package/dist/extraction/languages/rust.js.map +1 -0
  204. package/dist/extraction/languages/scala.d.ts +3 -0
  205. package/dist/extraction/languages/scala.d.ts.map +1 -0
  206. package/dist/extraction/languages/scala.js +209 -0
  207. package/dist/extraction/languages/scala.js.map +1 -0
  208. package/dist/extraction/languages/solidity.d.ts +3 -0
  209. package/dist/extraction/languages/solidity.d.ts.map +1 -0
  210. package/dist/extraction/languages/solidity.js +293 -0
  211. package/dist/extraction/languages/solidity.js.map +1 -0
  212. package/dist/extraction/languages/swift.d.ts +3 -0
  213. package/dist/extraction/languages/swift.d.ts.map +1 -0
  214. package/dist/extraction/languages/swift.js +152 -0
  215. package/dist/extraction/languages/swift.js.map +1 -0
  216. package/dist/extraction/languages/terraform.d.ts +3 -0
  217. package/dist/extraction/languages/terraform.d.ts.map +1 -0
  218. package/dist/extraction/languages/terraform.js +641 -0
  219. package/dist/extraction/languages/terraform.js.map +1 -0
  220. package/dist/extraction/languages/typescript.d.ts +16 -0
  221. package/dist/extraction/languages/typescript.d.ts.map +1 -0
  222. package/dist/extraction/languages/typescript.js +167 -0
  223. package/dist/extraction/languages/typescript.js.map +1 -0
  224. package/dist/extraction/languages/vbnet.d.ts +11 -0
  225. package/dist/extraction/languages/vbnet.d.ts.map +1 -0
  226. package/dist/extraction/languages/vbnet.js +141 -0
  227. package/dist/extraction/languages/vbnet.js.map +1 -0
  228. package/dist/extraction/liquid-extractor.d.ts +59 -0
  229. package/dist/extraction/liquid-extractor.d.ts.map +1 -0
  230. package/dist/extraction/liquid-extractor.js +357 -0
  231. package/dist/extraction/liquid-extractor.js.map +1 -0
  232. package/dist/extraction/mybatis-extractor.d.ts +68 -0
  233. package/dist/extraction/mybatis-extractor.d.ts.map +1 -0
  234. package/dist/extraction/mybatis-extractor.js +300 -0
  235. package/dist/extraction/mybatis-extractor.js.map +1 -0
  236. package/dist/extraction/parse-pool.d.ts +160 -0
  237. package/dist/extraction/parse-pool.d.ts.map +1 -0
  238. package/dist/extraction/parse-pool.js +402 -0
  239. package/dist/extraction/parse-pool.js.map +1 -0
  240. package/dist/extraction/parse-worker.d.ts +8 -0
  241. package/dist/extraction/parse-worker.d.ts.map +1 -0
  242. package/dist/extraction/parse-worker.js +138 -0
  243. package/dist/extraction/parse-worker.js.map +1 -0
  244. package/dist/extraction/razor-extractor.d.ts +42 -0
  245. package/dist/extraction/razor-extractor.d.ts.map +1 -0
  246. package/dist/extraction/razor-extractor.js +285 -0
  247. package/dist/extraction/razor-extractor.js.map +1 -0
  248. package/dist/extraction/store-worker.d.ts +24 -0
  249. package/dist/extraction/store-worker.d.ts.map +1 -0
  250. package/dist/extraction/store-worker.js +139 -0
  251. package/dist/extraction/store-worker.js.map +1 -0
  252. package/dist/extraction/store-writer.d.ts +63 -0
  253. package/dist/extraction/store-writer.d.ts.map +1 -0
  254. package/dist/extraction/store-writer.js +174 -0
  255. package/dist/extraction/store-writer.js.map +1 -0
  256. package/dist/extraction/svelte-extractor.d.ts +56 -0
  257. package/dist/extraction/svelte-extractor.d.ts.map +1 -0
  258. package/dist/extraction/svelte-extractor.js +275 -0
  259. package/dist/extraction/svelte-extractor.js.map +1 -0
  260. package/dist/extraction/tree-sitter-helpers.d.ts +28 -0
  261. package/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
  262. package/dist/extraction/tree-sitter-helpers.js +153 -0
  263. package/dist/extraction/tree-sitter-helpers.js.map +1 -0
  264. package/dist/extraction/tree-sitter-types.d.ts +260 -0
  265. package/dist/extraction/tree-sitter-types.d.ts.map +1 -0
  266. package/dist/extraction/tree-sitter-types.js +10 -0
  267. package/dist/extraction/tree-sitter-types.js.map +1 -0
  268. package/dist/extraction/tree-sitter.d.ts +728 -0
  269. package/dist/extraction/tree-sitter.d.ts.map +1 -0
  270. package/dist/extraction/tree-sitter.js +6676 -0
  271. package/dist/extraction/tree-sitter.js.map +1 -0
  272. package/dist/extraction/vue-extractor.d.ts +51 -0
  273. package/dist/extraction/vue-extractor.d.ts.map +1 -0
  274. package/dist/extraction/vue-extractor.js +254 -0
  275. package/dist/extraction/vue-extractor.js.map +1 -0
  276. package/dist/extraction/wasm/tree-sitter-arkts.wasm +0 -0
  277. package/dist/extraction/wasm/tree-sitter-c.wasm +0 -0
  278. package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
  279. package/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
  280. package/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
  281. package/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
  282. package/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
  283. package/dist/extraction/wasm/tree-sitter-cpp.wasm +0 -0
  284. package/dist/extraction/wasm/tree-sitter-dart.wasm +0 -0
  285. package/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
  286. package/dist/extraction/wasm/tree-sitter-go.wasm +0 -0
  287. package/dist/extraction/wasm/tree-sitter-java.wasm +0 -0
  288. package/dist/extraction/wasm/tree-sitter-javascript.wasm +0 -0
  289. package/dist/extraction/wasm/tree-sitter-kotlin.wasm +0 -0
  290. package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
  291. package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
  292. package/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
  293. package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  294. package/dist/extraction/wasm/tree-sitter-php.wasm +0 -0
  295. package/dist/extraction/wasm/tree-sitter-python.wasm +0 -0
  296. package/dist/extraction/wasm/tree-sitter-r.wasm +0 -0
  297. package/dist/extraction/wasm/tree-sitter-ruby.wasm +0 -0
  298. package/dist/extraction/wasm/tree-sitter-rust.wasm +0 -0
  299. package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  300. package/dist/extraction/wasm/tree-sitter-swift.wasm +0 -0
  301. package/dist/extraction/wasm/tree-sitter-terraform.wasm +0 -0
  302. package/dist/extraction/wasm/tree-sitter-tsx.wasm +0 -0
  303. package/dist/extraction/wasm/tree-sitter-typescript.wasm +0 -0
  304. package/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
  305. package/dist/extraction/wasm-runtime-flags.d.ts +53 -0
  306. package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
  307. package/dist/extraction/wasm-runtime-flags.js +130 -0
  308. package/dist/extraction/wasm-runtime-flags.js.map +1 -0
  309. package/dist/graph/index.d.ts +8 -0
  310. package/dist/graph/index.d.ts.map +1 -0
  311. package/dist/graph/index.js +13 -0
  312. package/dist/graph/index.js.map +1 -0
  313. package/dist/graph/queries.d.ts +106 -0
  314. package/dist/graph/queries.d.ts.map +1 -0
  315. package/dist/graph/queries.js +341 -0
  316. package/dist/graph/queries.js.map +1 -0
  317. package/dist/graph/traversal.d.ts +127 -0
  318. package/dist/graph/traversal.d.ts.map +1 -0
  319. package/dist/graph/traversal.js +599 -0
  320. package/dist/graph/traversal.js.map +1 -0
  321. package/dist/index.d.ts +677 -0
  322. package/dist/index.d.ts.map +1 -0
  323. package/dist/index.js +1718 -0
  324. package/dist/index.js.map +1 -0
  325. package/dist/installer/beta-signup.d.ts +54 -0
  326. package/dist/installer/beta-signup.d.ts.map +1 -0
  327. package/dist/installer/beta-signup.js +178 -0
  328. package/dist/installer/beta-signup.js.map +1 -0
  329. package/dist/installer/config-writer.d.ts +28 -0
  330. package/dist/installer/config-writer.d.ts.map +1 -0
  331. package/dist/installer/config-writer.js +91 -0
  332. package/dist/installer/config-writer.js.map +1 -0
  333. package/dist/installer/index.d.ts +144 -0
  334. package/dist/installer/index.d.ts.map +1 -0
  335. package/dist/installer/index.js +634 -0
  336. package/dist/installer/index.js.map +1 -0
  337. package/dist/installer/instructions-template.d.ts +41 -0
  338. package/dist/installer/instructions-template.d.ts.map +1 -0
  339. package/dist/installer/instructions-template.js +53 -0
  340. package/dist/installer/instructions-template.js.map +1 -0
  341. package/dist/installer/targets/antigravity.d.ts +57 -0
  342. package/dist/installer/targets/antigravity.d.ts.map +1 -0
  343. package/dist/installer/targets/antigravity.js +308 -0
  344. package/dist/installer/targets/antigravity.js.map +1 -0
  345. package/dist/installer/targets/claude.d.ts +62 -0
  346. package/dist/installer/targets/claude.d.ts.map +1 -0
  347. package/dist/installer/targets/claude.js +486 -0
  348. package/dist/installer/targets/claude.js.map +1 -0
  349. package/dist/installer/targets/codex.d.ts +18 -0
  350. package/dist/installer/targets/codex.d.ts.map +1 -0
  351. package/dist/installer/targets/codex.js +185 -0
  352. package/dist/installer/targets/codex.js.map +1 -0
  353. package/dist/installer/targets/copilot-cli.d.ts +32 -0
  354. package/dist/installer/targets/copilot-cli.d.ts.map +1 -0
  355. package/dist/installer/targets/copilot-cli.js +209 -0
  356. package/dist/installer/targets/copilot-cli.js.map +1 -0
  357. package/dist/installer/targets/copilot-jetbrains.d.ts +42 -0
  358. package/dist/installer/targets/copilot-jetbrains.d.ts.map +1 -0
  359. package/dist/installer/targets/copilot-jetbrains.js +238 -0
  360. package/dist/installer/targets/copilot-jetbrains.js.map +1 -0
  361. package/dist/installer/targets/copilot-vscode.d.ts +47 -0
  362. package/dist/installer/targets/copilot-vscode.d.ts.map +1 -0
  363. package/dist/installer/targets/copilot-vscode.js +219 -0
  364. package/dist/installer/targets/copilot-vscode.js.map +1 -0
  365. package/dist/installer/targets/cursor.d.ts +35 -0
  366. package/dist/installer/targets/cursor.d.ts.map +1 -0
  367. package/dist/installer/targets/cursor.js +254 -0
  368. package/dist/installer/targets/cursor.js.map +1 -0
  369. package/dist/installer/targets/dsh.d.ts +97 -0
  370. package/dist/installer/targets/dsh.d.ts.map +1 -0
  371. package/dist/installer/targets/dsh.js +358 -0
  372. package/dist/installer/targets/dsh.js.map +1 -0
  373. package/dist/installer/targets/gemini.d.ts +26 -0
  374. package/dist/installer/targets/gemini.d.ts.map +1 -0
  375. package/dist/installer/targets/gemini.js +165 -0
  376. package/dist/installer/targets/gemini.js.map +1 -0
  377. package/dist/installer/targets/hermes.d.ts +18 -0
  378. package/dist/installer/targets/hermes.d.ts.map +1 -0
  379. package/dist/installer/targets/hermes.js +359 -0
  380. package/dist/installer/targets/hermes.js.map +1 -0
  381. package/dist/installer/targets/kiro.d.ts +27 -0
  382. package/dist/installer/targets/kiro.d.ts.map +1 -0
  383. package/dist/installer/targets/kiro.js +178 -0
  384. package/dist/installer/targets/kiro.js.map +1 -0
  385. package/dist/installer/targets/opencode.d.ts +38 -0
  386. package/dist/installer/targets/opencode.d.ts.map +1 -0
  387. package/dist/installer/targets/opencode.js +288 -0
  388. package/dist/installer/targets/opencode.js.map +1 -0
  389. package/dist/installer/targets/registry.d.ts +35 -0
  390. package/dist/installer/targets/registry.d.ts.map +1 -0
  391. package/dist/installer/targets/registry.js +101 -0
  392. package/dist/installer/targets/registry.js.map +1 -0
  393. package/dist/installer/targets/shared.d.ts +132 -0
  394. package/dist/installer/targets/shared.d.ts.map +1 -0
  395. package/dist/installer/targets/shared.js +314 -0
  396. package/dist/installer/targets/shared.js.map +1 -0
  397. package/dist/installer/targets/toml.d.ts +53 -0
  398. package/dist/installer/targets/toml.d.ts.map +1 -0
  399. package/dist/installer/targets/toml.js +226 -0
  400. package/dist/installer/targets/toml.js.map +1 -0
  401. package/dist/installer/targets/types.d.ts +109 -0
  402. package/dist/installer/targets/types.d.ts.map +1 -0
  403. package/dist/installer/targets/types.js +16 -0
  404. package/dist/installer/targets/types.js.map +1 -0
  405. package/dist/installer/targets/zcode.d.ts +106 -0
  406. package/dist/installer/targets/zcode.d.ts.map +1 -0
  407. package/dist/installer/targets/zcode.js +451 -0
  408. package/dist/installer/targets/zcode.js.map +1 -0
  409. package/dist/mcp/daemon-manager.d.ts +42 -0
  410. package/dist/mcp/daemon-manager.d.ts.map +1 -0
  411. package/dist/mcp/daemon-manager.js +129 -0
  412. package/dist/mcp/daemon-manager.js.map +1 -0
  413. package/dist/mcp/daemon-paths.d.ts +73 -0
  414. package/dist/mcp/daemon-paths.d.ts.map +1 -0
  415. package/dist/mcp/daemon-paths.js +165 -0
  416. package/dist/mcp/daemon-paths.js.map +1 -0
  417. package/dist/mcp/daemon-registry.d.ts +47 -0
  418. package/dist/mcp/daemon-registry.d.ts.map +1 -0
  419. package/dist/mcp/daemon-registry.js +233 -0
  420. package/dist/mcp/daemon-registry.js.map +1 -0
  421. package/dist/mcp/daemon.d.ts +290 -0
  422. package/dist/mcp/daemon.d.ts.map +1 -0
  423. package/dist/mcp/daemon.js +862 -0
  424. package/dist/mcp/daemon.js.map +1 -0
  425. package/dist/mcp/dynamic-boundaries.d.ts +41 -0
  426. package/dist/mcp/dynamic-boundaries.d.ts.map +1 -0
  427. package/dist/mcp/dynamic-boundaries.js +360 -0
  428. package/dist/mcp/dynamic-boundaries.js.map +1 -0
  429. package/dist/mcp/early-ppid.d.ts +26 -0
  430. package/dist/mcp/early-ppid.d.ts.map +1 -0
  431. package/dist/mcp/early-ppid.js +29 -0
  432. package/dist/mcp/early-ppid.js.map +1 -0
  433. package/dist/mcp/engine.d.ts +122 -0
  434. package/dist/mcp/engine.d.ts.map +1 -0
  435. package/dist/mcp/engine.js +350 -0
  436. package/dist/mcp/engine.js.map +1 -0
  437. package/dist/mcp/explore-dedup.d.ts +137 -0
  438. package/dist/mcp/explore-dedup.d.ts.map +1 -0
  439. package/dist/mcp/explore-dedup.js +236 -0
  440. package/dist/mcp/explore-dedup.js.map +1 -0
  441. package/dist/mcp/explore-diagnostics.d.ts +287 -0
  442. package/dist/mcp/explore-diagnostics.d.ts.map +1 -0
  443. package/dist/mcp/explore-diagnostics.js +555 -0
  444. package/dist/mcp/explore-diagnostics.js.map +1 -0
  445. package/dist/mcp/explore-session-state.d.ts +217 -0
  446. package/dist/mcp/explore-session-state.d.ts.map +1 -0
  447. package/dist/mcp/explore-session-state.js +322 -0
  448. package/dist/mcp/explore-session-state.js.map +1 -0
  449. package/dist/mcp/index.d.ts +137 -0
  450. package/dist/mcp/index.d.ts.map +1 -0
  451. package/dist/mcp/index.js +554 -0
  452. package/dist/mcp/index.js.map +1 -0
  453. package/dist/mcp/liveness-watchdog.d.ts +35 -0
  454. package/dist/mcp/liveness-watchdog.d.ts.map +1 -0
  455. package/dist/mcp/liveness-watchdog.js +269 -0
  456. package/dist/mcp/liveness-watchdog.js.map +1 -0
  457. package/dist/mcp/ppid-watchdog.d.ts +62 -0
  458. package/dist/mcp/ppid-watchdog.d.ts.map +1 -0
  459. package/dist/mcp/ppid-watchdog.js +64 -0
  460. package/dist/mcp/ppid-watchdog.js.map +1 -0
  461. package/dist/mcp/proxy.d.ts +87 -0
  462. package/dist/mcp/proxy.d.ts.map +1 -0
  463. package/dist/mcp/proxy.js +672 -0
  464. package/dist/mcp/proxy.js.map +1 -0
  465. package/dist/mcp/query-pool.d.ts +108 -0
  466. package/dist/mcp/query-pool.d.ts.map +1 -0
  467. package/dist/mcp/query-pool.js +315 -0
  468. package/dist/mcp/query-pool.js.map +1 -0
  469. package/dist/mcp/query-worker.d.ts +24 -0
  470. package/dist/mcp/query-worker.d.ts.map +1 -0
  471. package/dist/mcp/query-worker.js +87 -0
  472. package/dist/mcp/query-worker.js.map +1 -0
  473. package/dist/mcp/server-instructions.d.ts +34 -0
  474. package/dist/mcp/server-instructions.d.ts.map +1 -0
  475. package/dist/mcp/server-instructions.js +111 -0
  476. package/dist/mcp/server-instructions.js.map +1 -0
  477. package/dist/mcp/session.d.ts +109 -0
  478. package/dist/mcp/session.d.ts.map +1 -0
  479. package/dist/mcp/session.js +375 -0
  480. package/dist/mcp/session.js.map +1 -0
  481. package/dist/mcp/startup-handshake.d.ts +44 -0
  482. package/dist/mcp/startup-handshake.d.ts.map +1 -0
  483. package/dist/mcp/startup-handshake.js +73 -0
  484. package/dist/mcp/startup-handshake.js.map +1 -0
  485. package/dist/mcp/stdin-teardown.d.ts +27 -0
  486. package/dist/mcp/stdin-teardown.d.ts.map +1 -0
  487. package/dist/mcp/stdin-teardown.js +49 -0
  488. package/dist/mcp/stdin-teardown.js.map +1 -0
  489. package/dist/mcp/tools.d.ts +862 -0
  490. package/dist/mcp/tools.d.ts.map +1 -0
  491. package/dist/mcp/tools.js +6526 -0
  492. package/dist/mcp/tools.js.map +1 -0
  493. package/dist/mcp/transport.d.ts +188 -0
  494. package/dist/mcp/transport.d.ts.map +1 -0
  495. package/dist/mcp/transport.js +377 -0
  496. package/dist/mcp/transport.js.map +1 -0
  497. package/dist/mcp/version.d.ts +19 -0
  498. package/dist/mcp/version.d.ts.map +1 -0
  499. package/dist/mcp/version.js +71 -0
  500. package/dist/mcp/version.js.map +1 -0
  501. package/dist/project-config.d.ts +94 -0
  502. package/dist/project-config.d.ts.map +1 -0
  503. package/dist/project-config.js +374 -0
  504. package/dist/project-config.js.map +1 -0
  505. package/dist/prompt-hook-output.d.ts +23 -0
  506. package/dist/prompt-hook-output.d.ts.map +1 -0
  507. package/dist/prompt-hook-output.js +35 -0
  508. package/dist/prompt-hook-output.js.map +1 -0
  509. package/dist/resolution/c-fnptr-synthesizer.d.ts +6 -0
  510. package/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -0
  511. package/dist/resolution/c-fnptr-synthesizer.js +1506 -0
  512. package/dist/resolution/c-fnptr-synthesizer.js.map +1 -0
  513. package/dist/resolution/callback-synthesizer.d.ts +59 -0
  514. package/dist/resolution/callback-synthesizer.d.ts.map +1 -0
  515. package/dist/resolution/callback-synthesizer.js +4030 -0
  516. package/dist/resolution/callback-synthesizer.js.map +1 -0
  517. package/dist/resolution/cooperative-yield.d.ts +40 -0
  518. package/dist/resolution/cooperative-yield.d.ts.map +1 -0
  519. package/dist/resolution/cooperative-yield.js +44 -0
  520. package/dist/resolution/cooperative-yield.js.map +1 -0
  521. package/dist/resolution/frameworks/astro.d.ts +9 -0
  522. package/dist/resolution/frameworks/astro.d.ts.map +1 -0
  523. package/dist/resolution/frameworks/astro.js +169 -0
  524. package/dist/resolution/frameworks/astro.js.map +1 -0
  525. package/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
  526. package/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
  527. package/dist/resolution/frameworks/cargo-workspace.js +225 -0
  528. package/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
  529. package/dist/resolution/frameworks/cics.d.ts +20 -0
  530. package/dist/resolution/frameworks/cics.d.ts.map +1 -0
  531. package/dist/resolution/frameworks/cics.js +90 -0
  532. package/dist/resolution/frameworks/cics.js.map +1 -0
  533. package/dist/resolution/frameworks/csharp.d.ts +8 -0
  534. package/dist/resolution/frameworks/csharp.d.ts.map +1 -0
  535. package/dist/resolution/frameworks/csharp.js +241 -0
  536. package/dist/resolution/frameworks/csharp.js.map +1 -0
  537. package/dist/resolution/frameworks/drupal.d.ts +51 -0
  538. package/dist/resolution/frameworks/drupal.d.ts.map +1 -0
  539. package/dist/resolution/frameworks/drupal.js +367 -0
  540. package/dist/resolution/frameworks/drupal.js.map +1 -0
  541. package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
  542. package/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
  543. package/dist/resolution/frameworks/expo-modules.js +148 -0
  544. package/dist/resolution/frameworks/expo-modules.js.map +1 -0
  545. package/dist/resolution/frameworks/express.d.ts +8 -0
  546. package/dist/resolution/frameworks/express.d.ts.map +1 -0
  547. package/dist/resolution/frameworks/express.js +308 -0
  548. package/dist/resolution/frameworks/express.js.map +1 -0
  549. package/dist/resolution/frameworks/fabric.d.ts +3 -0
  550. package/dist/resolution/frameworks/fabric.d.ts.map +1 -0
  551. package/dist/resolution/frameworks/fabric.js +354 -0
  552. package/dist/resolution/frameworks/fabric.js.map +1 -0
  553. package/dist/resolution/frameworks/go.d.ts +8 -0
  554. package/dist/resolution/frameworks/go.d.ts.map +1 -0
  555. package/dist/resolution/frameworks/go.js +184 -0
  556. package/dist/resolution/frameworks/go.js.map +1 -0
  557. package/dist/resolution/frameworks/goframe.d.ts +41 -0
  558. package/dist/resolution/frameworks/goframe.d.ts.map +1 -0
  559. package/dist/resolution/frameworks/goframe.js +112 -0
  560. package/dist/resolution/frameworks/goframe.js.map +1 -0
  561. package/dist/resolution/frameworks/index.d.ts +50 -0
  562. package/dist/resolution/frameworks/index.d.ts.map +1 -0
  563. package/dist/resolution/frameworks/index.js +175 -0
  564. package/dist/resolution/frameworks/index.js.map +1 -0
  565. package/dist/resolution/frameworks/java.d.ts +8 -0
  566. package/dist/resolution/frameworks/java.d.ts.map +1 -0
  567. package/dist/resolution/frameworks/java.js +517 -0
  568. package/dist/resolution/frameworks/java.js.map +1 -0
  569. package/dist/resolution/frameworks/laravel.d.ts +13 -0
  570. package/dist/resolution/frameworks/laravel.d.ts.map +1 -0
  571. package/dist/resolution/frameworks/laravel.js +257 -0
  572. package/dist/resolution/frameworks/laravel.js.map +1 -0
  573. package/dist/resolution/frameworks/nestjs.d.ts +26 -0
  574. package/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
  575. package/dist/resolution/frameworks/nestjs.js +698 -0
  576. package/dist/resolution/frameworks/nestjs.js.map +1 -0
  577. package/dist/resolution/frameworks/play.d.ts +19 -0
  578. package/dist/resolution/frameworks/play.d.ts.map +1 -0
  579. package/dist/resolution/frameworks/play.js +111 -0
  580. package/dist/resolution/frameworks/play.js.map +1 -0
  581. package/dist/resolution/frameworks/python.d.ts +10 -0
  582. package/dist/resolution/frameworks/python.d.ts.map +1 -0
  583. package/dist/resolution/frameworks/python.js +400 -0
  584. package/dist/resolution/frameworks/python.js.map +1 -0
  585. package/dist/resolution/frameworks/react-native.d.ts +3 -0
  586. package/dist/resolution/frameworks/react-native.d.ts.map +1 -0
  587. package/dist/resolution/frameworks/react-native.js +410 -0
  588. package/dist/resolution/frameworks/react-native.js.map +1 -0
  589. package/dist/resolution/frameworks/react.d.ts +8 -0
  590. package/dist/resolution/frameworks/react.d.ts.map +1 -0
  591. package/dist/resolution/frameworks/react.js +334 -0
  592. package/dist/resolution/frameworks/react.js.map +1 -0
  593. package/dist/resolution/frameworks/ruby.d.ts +8 -0
  594. package/dist/resolution/frameworks/ruby.d.ts.map +1 -0
  595. package/dist/resolution/frameworks/ruby.js +302 -0
  596. package/dist/resolution/frameworks/ruby.js.map +1 -0
  597. package/dist/resolution/frameworks/rust.d.ts +8 -0
  598. package/dist/resolution/frameworks/rust.d.ts.map +1 -0
  599. package/dist/resolution/frameworks/rust.js +304 -0
  600. package/dist/resolution/frameworks/rust.js.map +1 -0
  601. package/dist/resolution/frameworks/svelte.d.ts +9 -0
  602. package/dist/resolution/frameworks/svelte.d.ts.map +1 -0
  603. package/dist/resolution/frameworks/svelte.js +253 -0
  604. package/dist/resolution/frameworks/svelte.js.map +1 -0
  605. package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
  606. package/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
  607. package/dist/resolution/frameworks/swift-objc.js +252 -0
  608. package/dist/resolution/frameworks/swift-objc.js.map +1 -0
  609. package/dist/resolution/frameworks/swift.d.ts +10 -0
  610. package/dist/resolution/frameworks/swift.d.ts.map +1 -0
  611. package/dist/resolution/frameworks/swift.js +400 -0
  612. package/dist/resolution/frameworks/swift.js.map +1 -0
  613. package/dist/resolution/frameworks/terraform.d.ts +38 -0
  614. package/dist/resolution/frameworks/terraform.d.ts.map +1 -0
  615. package/dist/resolution/frameworks/terraform.js +277 -0
  616. package/dist/resolution/frameworks/terraform.js.map +1 -0
  617. package/dist/resolution/frameworks/vue.d.ts +9 -0
  618. package/dist/resolution/frameworks/vue.d.ts.map +1 -0
  619. package/dist/resolution/frameworks/vue.js +303 -0
  620. package/dist/resolution/frameworks/vue.js.map +1 -0
  621. package/dist/resolution/go-module.d.ts +26 -0
  622. package/dist/resolution/go-module.d.ts.map +1 -0
  623. package/dist/resolution/go-module.js +78 -0
  624. package/dist/resolution/go-module.js.map +1 -0
  625. package/dist/resolution/goframe-synthesizer.d.ts +29 -0
  626. package/dist/resolution/goframe-synthesizer.d.ts.map +1 -0
  627. package/dist/resolution/goframe-synthesizer.js +163 -0
  628. package/dist/resolution/goframe-synthesizer.js.map +1 -0
  629. package/dist/resolution/import-resolver.d.ts +84 -0
  630. package/dist/resolution/import-resolver.d.ts.map +1 -0
  631. package/dist/resolution/import-resolver.js +2134 -0
  632. package/dist/resolution/import-resolver.js.map +1 -0
  633. package/dist/resolution/index.d.ts +343 -0
  634. package/dist/resolution/index.d.ts.map +1 -0
  635. package/dist/resolution/index.js +2339 -0
  636. package/dist/resolution/index.js.map +1 -0
  637. package/dist/resolution/lru-cache.d.ts +24 -0
  638. package/dist/resolution/lru-cache.d.ts.map +1 -0
  639. package/dist/resolution/lru-cache.js +62 -0
  640. package/dist/resolution/lru-cache.js.map +1 -0
  641. package/dist/resolution/memory-budget.d.ts +48 -0
  642. package/dist/resolution/memory-budget.d.ts.map +1 -0
  643. package/dist/resolution/memory-budget.js +162 -0
  644. package/dist/resolution/memory-budget.js.map +1 -0
  645. package/dist/resolution/name-matcher.d.ts +123 -0
  646. package/dist/resolution/name-matcher.d.ts.map +1 -0
  647. package/dist/resolution/name-matcher.js +2134 -0
  648. package/dist/resolution/name-matcher.js.map +1 -0
  649. package/dist/resolution/path-aliases.d.ts +68 -0
  650. package/dist/resolution/path-aliases.d.ts.map +1 -0
  651. package/dist/resolution/path-aliases.js +238 -0
  652. package/dist/resolution/path-aliases.js.map +1 -0
  653. package/dist/resolution/resolver-pool.d.ts +106 -0
  654. package/dist/resolution/resolver-pool.d.ts.map +1 -0
  655. package/dist/resolution/resolver-pool.js +344 -0
  656. package/dist/resolution/resolver-pool.js.map +1 -0
  657. package/dist/resolution/resolver-worker.d.ts +17 -0
  658. package/dist/resolution/resolver-worker.d.ts.map +1 -0
  659. package/dist/resolution/resolver-worker.js +141 -0
  660. package/dist/resolution/resolver-worker.js.map +1 -0
  661. package/dist/resolution/strip-comments.d.ts +27 -0
  662. package/dist/resolution/strip-comments.d.ts.map +1 -0
  663. package/dist/resolution/strip-comments.js +492 -0
  664. package/dist/resolution/strip-comments.js.map +1 -0
  665. package/dist/resolution/swift-objc-bridge.d.ts +134 -0
  666. package/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
  667. package/dist/resolution/swift-objc-bridge.js +256 -0
  668. package/dist/resolution/swift-objc-bridge.js.map +1 -0
  669. package/dist/resolution/types.d.ts +265 -0
  670. package/dist/resolution/types.d.ts.map +1 -0
  671. package/dist/resolution/types.js +8 -0
  672. package/dist/resolution/types.js.map +1 -0
  673. package/dist/resolution/workspace-packages.d.ts +58 -0
  674. package/dist/resolution/workspace-packages.d.ts.map +1 -0
  675. package/dist/resolution/workspace-packages.js +346 -0
  676. package/dist/resolution/workspace-packages.js.map +1 -0
  677. package/dist/search/identifier-segments.d.ts +60 -0
  678. package/dist/search/identifier-segments.d.ts.map +1 -0
  679. package/dist/search/identifier-segments.js +176 -0
  680. package/dist/search/identifier-segments.js.map +1 -0
  681. package/dist/search/query-parser.d.ts +57 -0
  682. package/dist/search/query-parser.d.ts.map +1 -0
  683. package/dist/search/query-parser.js +177 -0
  684. package/dist/search/query-parser.js.map +1 -0
  685. package/dist/search/query-utils.d.ts +87 -0
  686. package/dist/search/query-utils.d.ts.map +1 -0
  687. package/dist/search/query-utils.js +450 -0
  688. package/dist/search/query-utils.js.map +1 -0
  689. package/dist/sync/git-hooks.d.ts +45 -0
  690. package/dist/sync/git-hooks.d.ts.map +1 -0
  691. package/dist/sync/git-hooks.js +227 -0
  692. package/dist/sync/git-hooks.js.map +1 -0
  693. package/dist/sync/index.d.ts +19 -0
  694. package/dist/sync/index.d.ts.map +1 -0
  695. package/dist/sync/index.js +35 -0
  696. package/dist/sync/index.js.map +1 -0
  697. package/dist/sync/watch-policy.d.ts +48 -0
  698. package/dist/sync/watch-policy.d.ts.map +1 -0
  699. package/dist/sync/watch-policy.js +124 -0
  700. package/dist/sync/watch-policy.js.map +1 -0
  701. package/dist/sync/watcher.d.ts +379 -0
  702. package/dist/sync/watcher.d.ts.map +1 -0
  703. package/dist/sync/watcher.js +921 -0
  704. package/dist/sync/watcher.js.map +1 -0
  705. package/dist/sync/worktree.d.ts +63 -0
  706. package/dist/sync/worktree.d.ts.map +1 -0
  707. package/dist/sync/worktree.js +182 -0
  708. package/dist/sync/worktree.js.map +1 -0
  709. package/dist/telemetry/index.d.ts +143 -0
  710. package/dist/telemetry/index.d.ts.map +1 -0
  711. package/dist/telemetry/index.js +541 -0
  712. package/dist/telemetry/index.js.map +1 -0
  713. package/dist/types.d.ts +465 -0
  714. package/dist/types.d.ts.map +1 -0
  715. package/dist/types.js +117 -0
  716. package/dist/types.js.map +1 -0
  717. package/dist/ui/color.d.ts +21 -0
  718. package/dist/ui/color.d.ts.map +1 -0
  719. package/dist/ui/color.js +42 -0
  720. package/dist/ui/color.js.map +1 -0
  721. package/dist/ui/glyphs.d.ts +67 -0
  722. package/dist/ui/glyphs.d.ts.map +1 -0
  723. package/dist/ui/glyphs.js +125 -0
  724. package/dist/ui/glyphs.js.map +1 -0
  725. package/dist/ui/shimmer-progress.d.ts +11 -0
  726. package/dist/ui/shimmer-progress.d.ts.map +1 -0
  727. package/dist/ui/shimmer-progress.js +164 -0
  728. package/dist/ui/shimmer-progress.js.map +1 -0
  729. package/dist/ui/shimmer-worker.d.ts +2 -0
  730. package/dist/ui/shimmer-worker.d.ts.map +1 -0
  731. package/dist/ui/shimmer-worker.js +126 -0
  732. package/dist/ui/shimmer-worker.js.map +1 -0
  733. package/dist/ui/types.d.ts +15 -0
  734. package/dist/ui/types.d.ts.map +1 -0
  735. package/dist/ui/types.js +3 -0
  736. package/dist/ui/types.js.map +1 -0
  737. package/dist/upgrade/index.d.ts +171 -0
  738. package/dist/upgrade/index.d.ts.map +1 -0
  739. package/dist/upgrade/index.js +659 -0
  740. package/dist/upgrade/index.js.map +1 -0
  741. package/dist/upgrade/remove-binary.d.ts +87 -0
  742. package/dist/upgrade/remove-binary.d.ts.map +1 -0
  743. package/dist/upgrade/remove-binary.js +289 -0
  744. package/dist/upgrade/remove-binary.js.map +1 -0
  745. package/dist/upgrade/update-check.d.ts +92 -0
  746. package/dist/upgrade/update-check.d.ts.map +1 -0
  747. package/dist/upgrade/update-check.js +258 -0
  748. package/dist/upgrade/update-check.js.map +1 -0
  749. package/dist/utils.d.ts +224 -0
  750. package/dist/utils.d.ts.map +1 -0
  751. package/dist/utils.js +583 -0
  752. package/dist/utils.js.map +1 -0
  753. package/package.json +61 -0
  754. package/scripts/add-lang/bench.sh +60 -0
  755. package/scripts/add-lang/check-grammar.mjs +75 -0
  756. package/scripts/add-lang/dump-ast.mjs +103 -0
  757. package/scripts/add-lang/verify-extraction.mjs +70 -0
  758. package/scripts/agent-eval/ab-adoption.sh +91 -0
  759. package/scripts/agent-eval/ab-hook.sh +86 -0
  760. package/scripts/agent-eval/ab-impl.sh +78 -0
  761. package/scripts/agent-eval/ab-new-vs-baseline.sh +161 -0
  762. package/scripts/agent-eval/ab-sufficiency.sh +78 -0
  763. package/scripts/agent-eval/allocation-fixtures.json +344 -0
  764. package/scripts/agent-eval/arms-F.sh +21 -0
  765. package/scripts/agent-eval/arms-matrix.sh +37 -0
  766. package/scripts/agent-eval/audit.sh +68 -0
  767. package/scripts/agent-eval/bench-readme.sh +48 -0
  768. package/scripts/agent-eval/bench-why-repo.sh +22 -0
  769. package/scripts/agent-eval/block-read-hook.sh +19 -0
  770. package/scripts/agent-eval/compare-arms.mjs +209 -0
  771. package/scripts/agent-eval/diff-index-drift.mjs +102 -0
  772. package/scripts/agent-eval/hook-settings.json +15 -0
  773. package/scripts/agent-eval/itrun.sh +120 -0
  774. package/scripts/agent-eval/no-cli-shim.sh +96 -0
  775. package/scripts/agent-eval/offload-eval-3arm.sh +72 -0
  776. package/scripts/agent-eval/offload-eval-cost.mjs +133 -0
  777. package/scripts/agent-eval/offload-eval-effort.mjs +108 -0
  778. package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -0
  779. package/scripts/agent-eval/offload-eval-frontload.sh +47 -0
  780. package/scripts/agent-eval/offload-eval-ground-truth.json +18 -0
  781. package/scripts/agent-eval/offload-eval-hook.mjs +84 -0
  782. package/scripts/agent-eval/offload-eval-judge.mjs +103 -0
  783. package/scripts/agent-eval/offload-eval-matrix.sh +20 -0
  784. package/scripts/agent-eval/offload-eval-metrics.mjs +94 -0
  785. package/scripts/agent-eval/offload-eval-refs1.sh +50 -0
  786. package/scripts/agent-eval/offload-eval-setup.sh +24 -0
  787. package/scripts/agent-eval/offload-eval-styles.sh +72 -0
  788. package/scripts/agent-eval/offload-eval-summarize.mjs +68 -0
  789. package/scripts/agent-eval/offload-eval.md +76 -0
  790. package/scripts/agent-eval/parse-arms.mjs +116 -0
  791. package/scripts/agent-eval/parse-bench-readme.mjs +238 -0
  792. package/scripts/agent-eval/parse-run.mjs +1401 -0
  793. package/scripts/agent-eval/parse-session.mjs +130 -0
  794. package/scripts/agent-eval/probe-allocation.mjs +335 -0
  795. package/scripts/agent-eval/probe-context.mjs +21 -0
  796. package/scripts/agent-eval/probe-decl-only.mjs +198 -0
  797. package/scripts/agent-eval/probe-explore.mjs +40 -0
  798. package/scripts/agent-eval/probe-factory-closure.mjs +147 -0
  799. package/scripts/agent-eval/probe-file-spend.mjs +195 -0
  800. package/scripts/agent-eval/probe-named-symbol.mjs +163 -0
  801. package/scripts/agent-eval/probe-node.mjs +20 -0
  802. package/scripts/agent-eval/probe-suite-envelope.mjs +124 -0
  803. package/scripts/agent-eval/probe-sweep.mjs +119 -0
  804. package/scripts/agent-eval/probe-trace.mjs +20 -0
  805. package/scripts/agent-eval/redirect-read-hook.sh +38 -0
  806. package/scripts/agent-eval/repro-concurrent-explore.mjs +119 -0
  807. package/scripts/agent-eval/repro-daemon-clients.mjs +125 -0
  808. package/scripts/agent-eval/run-agent.sh +34 -0
  809. package/scripts/agent-eval/run-all.sh +149 -0
  810. package/scripts/agent-eval/run-arms.sh +56 -0
  811. package/scripts/agent-eval/seq-matrix.mjs +137 -0
  812. package/scripts/build-bundle.sh +145 -0
  813. package/scripts/build-kernel.sh +87 -0
  814. package/scripts/dump-graph.mjs +57 -0
  815. package/scripts/extract-release-notes.mjs +130 -0
  816. package/scripts/kernel-parity.mjs +283 -0
  817. package/scripts/local-install.sh +41 -0
  818. package/scripts/npm-sdk.js +75 -0
  819. package/scripts/npm-shim.js +279 -0
  820. package/scripts/pack-npm.sh +123 -0
  821. package/scripts/prepare-release.mjs +270 -0
@@ -0,0 +1,921 @@
1
+ "use strict";
2
+ /**
3
+ * File Watcher
4
+ *
5
+ * Watches the project directory for file changes and triggers debounced sync
6
+ * operations to keep the code graph up-to-date.
7
+ *
8
+ * Uses Node's built-in `fs.watch` directly (no third-party watcher, no native
9
+ * addon) with a per-platform strategy chosen to keep the open-descriptor /
10
+ * kernel-watch cost BOUNDED rather than growing with the number of files:
11
+ *
12
+ * - macOS / Windows: a SINGLE recursive `fs.watch(root, {recursive:true})`.
13
+ * libuv maps this to one FSEvents stream (macOS) / one
14
+ * ReadDirectoryChangesW handle (Windows), so it costs O(1) descriptors no
15
+ * matter how large the tree. This is the fix for the macOS file-table
16
+ * exhaustion (#644 / #496 / #555 / #628): the previous watcher held one
17
+ * open fd PER WATCHED FILE on macOS (tens of thousands of REG fds), which
18
+ * exhausted `kern.maxfiles` and crashed unrelated processes system-wide.
19
+ *
20
+ * - Linux: recursive `fs.watch` is unsupported, so we watch each (non-ignored)
21
+ * DIRECTORY with one inotify watch — O(directories), NOT O(files). New
22
+ * directories are picked up dynamically and an overall watch cap bounds
23
+ * inotify usage on pathological monorepos (#579). A single inotify watch on
24
+ * a directory already reports create/modify/delete for its children, so
25
+ * per-file watches are never needed.
26
+ *
27
+ * Excluded trees (node_modules/, dist/, .git/, …) are filtered via the
28
+ * indexer's `buildScopeIgnore` (built-in default-ignore dirs + the project's
29
+ * .gitignore) — on Linux they're never descended into (so they cost no watch),
30
+ * and on macOS/Windows the single recursive stream still covers them but their
31
+ * events are dropped before any sync is scheduled. Either way the watcher's
32
+ * scope matches the indexer's (#276 / #407).
33
+ */
34
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
35
+ if (k2 === undefined) k2 = k;
36
+ var desc = Object.getOwnPropertyDescriptor(m, k);
37
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
38
+ desc = { enumerable: true, get: function() { return m[k]; } };
39
+ }
40
+ Object.defineProperty(o, k2, desc);
41
+ }) : (function(o, m, k, k2) {
42
+ if (k2 === undefined) k2 = k;
43
+ o[k2] = m[k];
44
+ }));
45
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
46
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
47
+ }) : function(o, v) {
48
+ o["default"] = v;
49
+ });
50
+ var __importStar = (this && this.__importStar) || (function () {
51
+ var ownKeys = function(o) {
52
+ ownKeys = Object.getOwnPropertyNames || function (o) {
53
+ var ar = [];
54
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
55
+ return ar;
56
+ };
57
+ return ownKeys(o);
58
+ };
59
+ return function (mod) {
60
+ if (mod && mod.__esModule) return mod;
61
+ var result = {};
62
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
63
+ __setModuleDefault(result, mod);
64
+ return result;
65
+ };
66
+ })();
67
+ Object.defineProperty(exports, "__esModule", { value: true });
68
+ exports.FileWatcher = exports.LockUnavailableError = void 0;
69
+ exports.__setFsWatchForTests = __setFsWatchForTests;
70
+ exports.__emitWatchEventForTests = __emitWatchEventForTests;
71
+ const fs = __importStar(require("fs"));
72
+ const path = __importStar(require("path"));
73
+ const extraction_1 = require("../extraction");
74
+ const project_config_1 = require("../project-config");
75
+ const errors_1 = require("../errors");
76
+ const utils_1 = require("../utils");
77
+ const directory_1 = require("../directory");
78
+ const watch_policy_1 = require("./watch-policy");
79
+ /**
80
+ * Number of consecutive lock-contention retries the watcher tolerates before
81
+ * it gives up and degrades auto-sync. Brief contention (another writer for a
82
+ * few cycles) stays under this; a long-lived external writer crosses it.
83
+ */
84
+ const MAX_LOCK_RETRIES = 5;
85
+ /**
86
+ * Number of consecutive GENERIC (non-lock) sync failures the watcher tolerates
87
+ * before it degrades auto-sync. A deterministic failure — a tree-sitter
88
+ * extractor that crashes on one file, DB corruption, `SQLITE_FULL`, an OOM in
89
+ * batched resolution — recurs every debounce cycle, so left unbounded it would
90
+ * retry forever (log + work spam) while the auto-update guarantee is silently
91
+ * dead (#1127). A single clean sync resets the streak, so a transient hiccup
92
+ * that recovers within the budget never degrades.
93
+ */
94
+ const MAX_SYNC_FAILURE_RETRIES = 5;
95
+ /** Cap on the exponential retry backoff (either mode) so it never sleeps absurdly long. */
96
+ const MAX_RETRY_BACKOFF_MS = 30_000;
97
+ /**
98
+ * Adaptive debounce: a pending set this small fires after the quick quiet
99
+ * window instead of the full debounce — a lone save (or editor + test file
100
+ * pair) syncs near-instantly, while larger bursts keep the full window and
101
+ * coalesce exactly as before.
102
+ */
103
+ const QUICK_SYNC_MAX_PENDING = 2;
104
+ const QUICK_SYNC_QUIET_MS = 300;
105
+ /**
106
+ * Scoped-sync ceiling: above this many pending files a full scan-diff is
107
+ * simpler and comparably fast (a branch checkout emits thousands of events),
108
+ * and it self-heals anything event coalescing dropped along the way.
109
+ */
110
+ const SCOPED_SYNC_MAX_PENDING = 500;
111
+ /** Actionable degrade message; both exhaustion paths share it verbatim. */
112
+ const EXHAUSTION_REASON = 'OS watch/file limit exhausted; auto-sync disabled. Run `codegraph sync` ' +
113
+ '(or install git sync hooks) to refresh the graph after changes.';
114
+ /**
115
+ * Actionable, NON-fatal warning for Linux inotify watch-count exhaustion.
116
+ * Unlike {@link EXHAUSTION_REASON} this does not disable the watcher — the
117
+ * watches already installed keep working — so it names the exact kernel knob to
118
+ * raise instead.
119
+ */
120
+ const INOTIFY_LIMIT_REASON = 'Linux inotify watch limit reached (fs.inotify.max_user_watches); live ' +
121
+ 'watching now covers only part of the project, so edits in unwatched ' +
122
+ 'directories will not auto-sync. Raise the limit (e.g. `sudo sysctl ' +
123
+ 'fs.inotify.max_user_watches=1048576`, persisted in /etc/sysctl.d) and ' +
124
+ 'restart, or run `codegraph sync` (or install git sync hooks) to refresh.';
125
+ /**
126
+ * True when an error is OS watch/file-descriptor exhaustion (EMFILE/ENFILE).
127
+ * Prefers the structured `err.code`; falls back to message matching ONLY when
128
+ * no code is present (some platforms surface a bare Error from `fs.watch`).
129
+ */
130
+ function isWatchResourceExhaustion(err) {
131
+ const e = err;
132
+ if (e?.code === 'EMFILE' || e?.code === 'ENFILE')
133
+ return true;
134
+ if (!e?.code && e?.message) {
135
+ return /EMFILE|ENFILE|too many open files/i.test(e.message);
136
+ }
137
+ return false;
138
+ }
139
+ /**
140
+ * True when an error is Linux inotify *watch-count* exhaustion. `fs.watch`
141
+ * surfaces a hit `fs.inotify.max_user_watches` as ENOSPC ("no space" = no watch
142
+ * descriptors left, NOT disk space). This only arises on the Linux
143
+ * per-directory path; it is non-fatal (raise the limit and partial watching
144
+ * keeps working), so it warns rather than degrading.
145
+ */
146
+ function isInotifyWatchExhaustion(err) {
147
+ return err?.code === 'ENOSPC';
148
+ }
149
+ /**
150
+ * Native recursive `fs.watch` is only reliable on macOS and Windows; on Linux
151
+ * (and AIX) it throws `ERR_FEATURE_UNAVAILABLE_ON_PLATFORM`. We branch on this
152
+ * to pick the recursive vs per-directory strategy.
153
+ */
154
+ function supportsRecursiveWatch() {
155
+ return process.platform === 'darwin' || process.platform === 'win32';
156
+ }
157
+ let watchImpl = fs.watch;
158
+ /** @internal Test-only seam to inject a fake fs.watch implementation. */
159
+ function __setFsWatchForTests(fn) {
160
+ watchImpl = fn ?? fs.watch;
161
+ }
162
+ /**
163
+ * Upper bound on simultaneously-watched directories on the Linux per-directory
164
+ * path. Each is one inotify watch; the kernel's `fs.inotify.max_user_watches`
165
+ * is the hard limit (commonly 8k–128k). We stop adding watches past this and
166
+ * log once — partial live-watch (with `codegraph sync` as the backstop) is far
167
+ * better than exhausting the user's inotify budget and breaking watching
168
+ * system-wide (#579). Tunable via CODEGRAPH_MAX_DIR_WATCHES.
169
+ */
170
+ const DEFAULT_MAX_DIR_WATCHES = 50_000;
171
+ function maxDirWatches() {
172
+ const raw = process.env.CODEGRAPH_MAX_DIR_WATCHES;
173
+ if (raw && /^\d+$/.test(raw)) {
174
+ const n = Number(raw);
175
+ if (n > 0)
176
+ return n;
177
+ }
178
+ return DEFAULT_MAX_DIR_WATCHES;
179
+ }
180
+ /**
181
+ * Test seam (see {@link __emitWatchEventForTests}). Maps a watcher's project
182
+ * root to its live instance so tests can synthesize a change event
183
+ * deterministically — real fs.watch delivery latency races under parallel
184
+ * vitest (the reason the previous chokidar mock existed). Only populated under
185
+ * a test runner, so production carries no bookkeeping or retained references.
186
+ */
187
+ const liveWatchersForTests = new Map();
188
+ const IS_TEST_RUNTIME = !!(process.env.VITEST || process.env.NODE_ENV === 'test');
189
+ /**
190
+ * Thrown by a `syncFn` to signal that the underlying sync couldn't acquire
191
+ * the cross-process write lock (#449). The watcher treats this as "no
192
+ * progress" — preserves `pendingFiles`, skips `onSyncComplete`, and the
193
+ * `finally` block reschedules. Quiet (debug-only) because a long-running
194
+ * external indexer can hit this every debounce cycle.
195
+ */
196
+ class LockUnavailableError extends Error {
197
+ constructor(message = 'CodeGraph file lock unavailable; another process is writing') {
198
+ super(message);
199
+ this.name = 'LockUnavailableError';
200
+ }
201
+ }
202
+ exports.LockUnavailableError = LockUnavailableError;
203
+ /**
204
+ * FileWatcher monitors a project directory for changes and triggers
205
+ * debounced sync operations via a provided callback.
206
+ *
207
+ * Design goals:
208
+ * - Bounded resource usage: O(1) descriptors on macOS/Windows (one recursive
209
+ * watch), O(directories) inotify watches on Linux — never O(files), which
210
+ * was the system-crashing fd leak on macOS (#644/#496/#555/#628).
211
+ * - Debounced to avoid thrashing on rapid saves
212
+ * - Filters to supported source files by extension
213
+ * - Ignores .codegraph/ and .git/ regardless of .gitignore
214
+ * - Tracks per-file pending state so MCP tools can flag stale results
215
+ * without blocking on a sync (issue #403)
216
+ */
217
+ class FileWatcher {
218
+ /** macOS/Windows: the single recursive watcher. Null on Linux. */
219
+ recursiveWatcher = null;
220
+ /** Linux: one watcher per watched directory (keyed by absolute path). */
221
+ dirWatchers = new Map();
222
+ /** Set once the per-directory watch cap is hit, so we log only once. */
223
+ dirCapWarned = false;
224
+ /**
225
+ * Set once the Linux inotify watch limit (ENOSPC) is hit. Double duty: we
226
+ * warn only once, AND we stop attempting new directory watches for the rest
227
+ * of the session — once the kernel budget is exhausted every further
228
+ * `inotify_add_watch` fails too, so trying the rest of the tree is pure
229
+ * waste. NON-fatal (does not degrade): installed watches keep working.
230
+ */
231
+ inotifyLimitWarned = false;
232
+ /**
233
+ * One-way latch: the reason live watching was permanently disabled at runtime
234
+ * (watch-resource exhaustion, lock contention past the retry budget, or a
235
+ * persistent generic sync failure past the retry budget), or null while
236
+ * healthy. Set by {@link degrade}; cleared only by a fresh start().
237
+ */
238
+ degradedReason = null;
239
+ /** Consecutive lock-contention retries for watcher-triggered syncs. */
240
+ lockRetryCount = 0;
241
+ /** Consecutive generic (non-lock) sync failures; reset only by a clean sync. */
242
+ syncFailureRetryCount = 0;
243
+ /** Test-only inert mode: started, but with no OS watcher installed. */
244
+ inert = false;
245
+ debounceTimer = null;
246
+ /**
247
+ * True when the pending set does NOT exactly describe the change (a
248
+ * directory removal's children are unknown from the event, #1285) — the
249
+ * next sync must be a full scan-diff. Cleared only after a successful FULL
250
+ * sync reconciles the tree.
251
+ */
252
+ needsFullScan = false;
253
+ /**
254
+ * Files seen by the watcher since the last successful sync — populated on
255
+ * every change event, cleared at the start of a sync, and re-populated by
256
+ * events that arrive mid-sync (or restored on sync failure). Keyed by the
257
+ * same project-relative POSIX path the rest of the codebase uses, so a
258
+ * caller can intersect tool-response file paths against this map cheaply.
259
+ */
260
+ pendingFiles = new Map();
261
+ /**
262
+ * Wall-clock ms at which the in-flight sync began. Combined with
263
+ * {@link pendingFiles}'s `lastSeenMs`, this distinguishes "still in the
264
+ * debounce window" (lastSeen > syncStarted, sync hasn't started yet for
265
+ * this edit) from "currently being indexed" (lastSeen <= syncStarted).
266
+ */
267
+ syncStartedMs = 0;
268
+ syncing = false;
269
+ stopped = false;
270
+ /**
271
+ * True once the initial watch set is established. Unlike the previous
272
+ * chokidar implementation there is no asynchronous initial "crawl" emitting
273
+ * an `add` per existing file — `fs.watch` only reports changes from the
274
+ * moment it's installed — so this flips to true synchronously at the end of
275
+ * `start()`. The startup reconcile against on-disk state is handled
276
+ * separately by the engine's catch-up sync, not by the watcher.
277
+ */
278
+ ready = false;
279
+ /**
280
+ * Callbacks that resolve when the watch set is established. Used by tests
281
+ * (and any production caller that cares about a clean baseline) to
282
+ * deterministically gate on watcher readiness.
283
+ */
284
+ readyWaiters = [];
285
+ // The shared scope matcher (built-in defaults + project .gitignore, with
286
+ // embedded child repos matched by their OWN rules — #514), built once at
287
+ // start(). Same source of truth the indexer uses, so watcher scope can
288
+ // never diverge from index scope. An embedded repo created after start()
289
+ // joins the scope on the next watcher restart / re-index.
290
+ ignoreMatcher = null;
291
+ projectRoot;
292
+ debounceMs;
293
+ syncFn;
294
+ onSyncComplete;
295
+ onSyncError;
296
+ onDegraded;
297
+ inertForTests;
298
+ constructor(projectRoot, syncFn, options = {}) {
299
+ this.projectRoot = projectRoot;
300
+ this.syncFn = syncFn;
301
+ this.debounceMs = options.debounceMs ?? 2000;
302
+ this.onSyncComplete = options.onSyncComplete;
303
+ this.onSyncError = options.onSyncError;
304
+ this.onDegraded = options.onDegraded;
305
+ this.inertForTests = options.inertForTests ?? false;
306
+ }
307
+ /**
308
+ * Start watching for file changes.
309
+ * Returns true if watching started successfully, false otherwise.
310
+ */
311
+ start() {
312
+ if (this.recursiveWatcher || this.dirWatchers.size > 0 || this.inert)
313
+ return true; // Already watching
314
+ this.stopped = false;
315
+ this.degradedReason = null;
316
+ this.lockRetryCount = 0;
317
+ this.syncFailureRetryCount = 0;
318
+ // Some environments make filesystem watching unusable — most notably
319
+ // WSL2 /mnt/ drives, where the underlying fs.watch calls block long
320
+ // enough to break MCP startup handshakes (issue #199). Skip watching
321
+ // there; callers fall back to manual `codegraph sync` or git sync hooks.
322
+ const disabledReason = (0, watch_policy_1.watchDisabledReason)(this.projectRoot);
323
+ if (disabledReason) {
324
+ (0, errors_1.logDebug)('File watcher disabled', { reason: disabledReason, projectRoot: this.projectRoot });
325
+ return false;
326
+ }
327
+ // Reuse the indexer's ignore set so the watcher and indexer agree on scope.
328
+ this.ignoreMatcher = (0, extraction_1.buildScopeIgnore)(this.projectRoot);
329
+ try {
330
+ if (this.inertForTests) {
331
+ // Test-only: install no OS watcher; the seam drives events instead.
332
+ this.inert = true;
333
+ }
334
+ else if (supportsRecursiveWatch()) {
335
+ this.startRecursive();
336
+ }
337
+ else {
338
+ this.startPerDirectory();
339
+ }
340
+ // The per-directory (Linux) path catches watch-resource exhaustion inside
341
+ // watchTree and degrades synchronously rather than throwing, so it never
342
+ // reaches the catch below. Surface that as a failed start here so both
343
+ // strategies report exhaustion identically (start() === false).
344
+ if (this.degradedReason)
345
+ return false;
346
+ // No async crawl to wait on: as soon as the watch set is installed we
347
+ // have a clean baseline (pendingFiles is only populated by post-start
348
+ // events). Clear defensively and flip ready.
349
+ this.pendingFiles.clear();
350
+ this.ready = true;
351
+ for (const cb of this.readyWaiters)
352
+ cb();
353
+ this.readyWaiters.length = 0;
354
+ if (IS_TEST_RUNTIME)
355
+ liveWatchersForTests.set(this.projectRoot, this);
356
+ (0, errors_1.logDebug)('File watcher started', {
357
+ projectRoot: this.projectRoot,
358
+ debounceMs: this.debounceMs,
359
+ mode: this.inertForTests ? 'inert' : supportsRecursiveWatch() ? 'recursive' : 'per-directory',
360
+ watchedDirs: this.dirWatchers.size || undefined,
361
+ });
362
+ return true;
363
+ }
364
+ catch (err) {
365
+ // Watcher setup failed. Watch-resource exhaustion (EMFILE/ENFILE on the
366
+ // recursive path) is terminal — degrade cleanly with one actionable
367
+ // warning instead of leaving a half-broken watcher. Everything else
368
+ // (permission denied, missing directory) keeps the prior quiet-stop.
369
+ if (isWatchResourceExhaustion(err)) {
370
+ this.degrade(EXHAUSTION_REASON, { error: String(err) });
371
+ }
372
+ else {
373
+ (0, errors_1.logWarn)('Could not start file watcher', { error: String(err) });
374
+ this.stop();
375
+ }
376
+ return false;
377
+ }
378
+ }
379
+ /**
380
+ * macOS/Windows: one recursive watcher for the whole tree. O(1) descriptors.
381
+ * `filename` arrives relative to the project root (with subdirectories), so
382
+ * it maps straight to a project-relative path.
383
+ */
384
+ startRecursive() {
385
+ this.recursiveWatcher = watchImpl(this.projectRoot, { recursive: true, persistent: true }, (_event, filename) => {
386
+ if (this.stopped || filename == null)
387
+ return;
388
+ this.handleChange((0, utils_1.normalizePath)(String(filename)));
389
+ });
390
+ this.recursiveWatcher.on('error', (err) => {
391
+ if (isWatchResourceExhaustion(err)) {
392
+ this.degrade(EXHAUSTION_REASON, { error: String(err) });
393
+ return;
394
+ }
395
+ (0, errors_1.logWarn)('File watcher error', { error: String(err) });
396
+ });
397
+ }
398
+ /**
399
+ * Linux: walk the (non-ignored) tree and watch each directory. One inotify
400
+ * watch per directory reports create/modify/delete for that directory's
401
+ * direct children, so we never watch individual files.
402
+ */
403
+ startPerDirectory() {
404
+ this.watchTree(this.projectRoot, /* markExisting */ false);
405
+ }
406
+ /**
407
+ * Add an inotify watch for `dir` and recurse into its non-ignored
408
+ * subdirectories. When `markExisting` is true (a directory that appeared
409
+ * AFTER startup), the source files already inside it are recorded as pending
410
+ * — this closes the `mkdir + write` race where files created before the new
411
+ * directory's watch is installed would otherwise be missed until the next
412
+ * full sync. The initial startup walk passes false (the engine's catch-up
413
+ * sync owns the baseline).
414
+ */
415
+ watchTree(dir, markExisting) {
416
+ // A degrade() mid-walk (exhaustion on an earlier directory) calls stop(),
417
+ // which sets `stopped`; bail so the recursion unwinds without adding more
418
+ // watches to a watcher that is shutting down. `inotifyLimitWarned` does the
419
+ // same after ENOSPC — the kernel budget is gone, so stop trying the rest of
420
+ // the tree (every add would fail) while keeping the watches already set.
421
+ if (this.stopped || this.degradedReason || this.inotifyLimitWarned)
422
+ return;
423
+ if (this.dirWatchers.has(dir))
424
+ return;
425
+ if (this.dirWatchers.size >= maxDirWatches()) {
426
+ if (!this.dirCapWarned) {
427
+ this.dirCapWarned = true;
428
+ (0, errors_1.logWarn)('File watcher hit directory-watch cap; remaining subtrees rely on manual/periodic sync', {
429
+ cap: maxDirWatches(),
430
+ });
431
+ }
432
+ return;
433
+ }
434
+ let w;
435
+ try {
436
+ w = watchImpl(dir, { persistent: true }, (_event, filename) => this.handleDirEvent(dir, filename));
437
+ }
438
+ catch (err) {
439
+ // EMFILE/ENFILE means the PROCESS is out of descriptors — every further
440
+ // directory would fail too, so degrade the whole watcher rather than
441
+ // limping along with a partial watch set.
442
+ if (isWatchResourceExhaustion(err)) {
443
+ this.degrade(EXHAUSTION_REASON, { error: String(err), dir });
444
+ }
445
+ else if (isInotifyWatchExhaustion(err)) {
446
+ // ENOSPC = inotify watch budget exhausted. NON-fatal: keep the watches
447
+ // we have and tell the user the knob to raise (warn once).
448
+ this.warnInotifyLimit({ error: String(err), dir });
449
+ }
450
+ // ENOENT / EACCES on a single directory stays non-fatal: skip it quietly.
451
+ return;
452
+ }
453
+ w.on('error', (err) => {
454
+ if (isWatchResourceExhaustion(err)) {
455
+ this.degrade(EXHAUSTION_REASON, { error: String(err), dir });
456
+ return;
457
+ }
458
+ if (isInotifyWatchExhaustion(err)) {
459
+ this.warnInotifyLimit({ error: String(err), dir });
460
+ }
461
+ this.unwatchDir(dir);
462
+ });
463
+ this.dirWatchers.set(dir, w);
464
+ let entries;
465
+ try {
466
+ entries = fs.readdirSync(dir, { withFileTypes: true });
467
+ }
468
+ catch {
469
+ return;
470
+ }
471
+ for (const entry of entries) {
472
+ const child = path.join(dir, entry.name);
473
+ if (entry.isDirectory()) {
474
+ if (this.shouldIgnoreDir(child))
475
+ continue;
476
+ this.watchTree(child, markExisting);
477
+ }
478
+ else if (markExisting && entry.isFile()) {
479
+ this.handleChange((0, utils_1.normalizePath)(path.relative(this.projectRoot, child)));
480
+ }
481
+ }
482
+ }
483
+ /**
484
+ * Linux per-directory event handler. `filename` is relative to `dir`. A new
485
+ * sub-directory is picked up by extending the watch tree; everything else is
486
+ * routed through the shared change handler.
487
+ */
488
+ handleDirEvent(dir, filename) {
489
+ if (this.stopped || filename == null)
490
+ return;
491
+ const full = path.join(dir, String(filename));
492
+ // A newly-created directory needs its own watch (recursive isn't available
493
+ // on Linux). statSync is cheap and these events are rare relative to file
494
+ // edits. If the path vanished (rapid create/delete) the stat throws and we
495
+ // fall through to the change handler, which no-ops on a non-source path.
496
+ try {
497
+ if (fs.statSync(full).isDirectory()) {
498
+ if (!this.shouldIgnoreDir(full))
499
+ this.watchTree(full, /* markExisting */ true);
500
+ return;
501
+ }
502
+ }
503
+ catch {
504
+ // deleted/inaccessible — treat as a normal change below
505
+ }
506
+ this.handleChange((0, utils_1.normalizePath)(path.relative(this.projectRoot, full)));
507
+ }
508
+ /**
509
+ * Shared change handler for both watch strategies. `rel` is a
510
+ * project-relative POSIX path. Applies the ignore + source-file filters and,
511
+ * for a real source change, records it as pending (#403) and schedules a
512
+ * debounced sync.
513
+ *
514
+ * The recursive (macOS/Windows) watcher reports events for ignored trees too
515
+ * (one stream covers the whole repo), so the ignore check here is load-bearing
516
+ * — it drops node_modules/dist/.git churn before any sync is scheduled.
517
+ */
518
+ handleChange(rel) {
519
+ if (!rel || rel === '.' || rel.startsWith('..'))
520
+ return;
521
+ if (this.isAlwaysIgnored(rel))
522
+ return;
523
+ if (this.ignoreMatcher && this.ignoreMatcher.ignores(rel))
524
+ return;
525
+ if (!(0, extraction_1.isSourceFile)(rel, (0, project_config_1.loadExtensionOverrides)(this.projectRoot))) {
526
+ this.maybeScheduleForRemovedDir(rel);
527
+ return;
528
+ }
529
+ (0, errors_1.logDebug)('File change detected', { file: rel });
530
+ if (this.ready) {
531
+ const now = Date.now();
532
+ const existing = this.pendingFiles.get(rel);
533
+ this.pendingFiles.set(rel, {
534
+ firstSeenMs: existing?.firstSeenMs ?? now,
535
+ lastSeenMs: now,
536
+ });
537
+ }
538
+ this.scheduleSync();
539
+ }
540
+ /**
541
+ * A deleted DIRECTORY arrives as one event on the directory's own path —
542
+ * no source extension, so the source-file filter drops it, and the files
543
+ * underneath may never get events of their own (Windows's recursive
544
+ * watcher reports only the top-most removed entry; macOS FSEvents can
545
+ * coalesce a tree deletion the same way). The index then kept every child
546
+ * record until some unrelated edit happened to trigger a sync (#1285).
547
+ *
548
+ * If a non-source path no longer exists on disk, treat it as a potential
549
+ * subtree removal and schedule the debounced sync — its scan-diff removes
550
+ * whatever is gone, which is the ground truth for what was underneath.
551
+ * pendingFiles is left alone (we can't know the children from the event).
552
+ * An event for an EXISTING non-source file stays fully ignored, so build
553
+ * churn on live files never schedules work; a deleted non-source file
554
+ * costs at most one no-op scan-diff, absorbed by the debounce.
555
+ */
556
+ maybeScheduleForRemovedDir(rel) {
557
+ try {
558
+ fs.statSync(path.join(this.projectRoot, rel));
559
+ return; // still on disk — an ordinary non-source change, ignore
560
+ }
561
+ catch {
562
+ /* gone — fall through */
563
+ }
564
+ (0, errors_1.logDebug)('Non-source path removed; scheduling sync for possible directory removal', {
565
+ path: rel,
566
+ });
567
+ this.needsFullScan = true;
568
+ this.scheduleSync();
569
+ }
570
+ /** Close and forget the watch for a directory that errored/was removed. */
571
+ unwatchDir(dir) {
572
+ const w = this.dirWatchers.get(dir);
573
+ if (w) {
574
+ try {
575
+ w.close();
576
+ }
577
+ catch {
578
+ /* already closed */
579
+ }
580
+ this.dirWatchers.delete(dir);
581
+ }
582
+ }
583
+ /** Our own dirs are always ignored, regardless of .gitignore. */
584
+ isAlwaysIgnored(rel) {
585
+ // First path segment. Ignore any CodeGraph data dir — the active one AND a
586
+ // sibling like `.codegraph-win` a second environment (Windows/WSL) created
587
+ // in the same tree, so neither side watches the other's index (#636).
588
+ const top = rel.split('/')[0] ?? rel;
589
+ return ((0, directory_1.isCodeGraphDataDir)(top) ||
590
+ rel === '.git' || rel.startsWith('.git/'));
591
+ }
592
+ /**
593
+ * True for any directory that should NOT be watched (used while building the
594
+ * Linux per-directory watch tree). Tests the directory form of the path so a
595
+ * dir-only ignore rule like `build/` matches.
596
+ */
597
+ shouldIgnoreDir(dirPath) {
598
+ const rel = (0, utils_1.normalizePath)(path.relative(this.projectRoot, dirPath));
599
+ if (!rel || rel === '.' || rel.startsWith('..'))
600
+ return false; // root / outside
601
+ if (this.isAlwaysIgnored(rel))
602
+ return true;
603
+ if (!this.ignoreMatcher)
604
+ return false;
605
+ return this.ignoreMatcher.ignores(rel + '/');
606
+ }
607
+ /**
608
+ * Permanently disable live watching after a terminal runtime failure
609
+ * (watch-resource exhaustion, lock contention past the retry budget, or a
610
+ * persistent generic sync failure past the retry budget).
611
+ * Idempotent: logs one actionable warning, fires {@link WatchOptions.onDegraded}
612
+ * once, and stops the watcher. A subsequent start() clears the latch.
613
+ */
614
+ degrade(reason, context = {}) {
615
+ if (this.degradedReason)
616
+ return;
617
+ this.degradedReason = reason;
618
+ (0, errors_1.logWarn)('File watcher disabled', { projectRoot: this.projectRoot, reason, ...context });
619
+ this.onDegraded?.(reason);
620
+ this.stop();
621
+ }
622
+ /**
623
+ * Warn ONCE that the Linux inotify watch budget is exhausted (ENOSPC), and
624
+ * stop adding new watches for the rest of this session — every further
625
+ * `inotify_add_watch` would fail too, so walking the rest of the tree is
626
+ * waste. Unlike {@link degrade} this is NON-fatal: the watches already
627
+ * installed keep firing, and `codegraph sync` covers the unwatched remainder.
628
+ * The message names the kernel knob to raise (`fs.inotify.max_user_watches`).
629
+ */
630
+ warnInotifyLimit(context = {}) {
631
+ if (this.inotifyLimitWarned)
632
+ return;
633
+ this.inotifyLimitWarned = true;
634
+ (0, errors_1.logWarn)(INOTIFY_LIMIT_REASON, { watchedDirs: this.dirWatchers.size, ...context });
635
+ }
636
+ /**
637
+ * Whether live watching has degraded permanently (until the next start()).
638
+ * Distinct from {@link isActive}: a degraded watcher is inactive, but an
639
+ * inactive watcher is not necessarily degraded (it may simply be stopped or
640
+ * never started). Hosts use this to tell the user auto-sync is off.
641
+ */
642
+ isDegraded() {
643
+ return this.degradedReason !== null;
644
+ }
645
+ /** The reason live watching degraded, or null if it is healthy. */
646
+ getDegradedReason() {
647
+ return this.degradedReason;
648
+ }
649
+ /**
650
+ * Stop watching for file changes.
651
+ */
652
+ stop() {
653
+ this.stopped = true;
654
+ if (this.debounceTimer) {
655
+ clearTimeout(this.debounceTimer);
656
+ this.debounceTimer = null;
657
+ }
658
+ if (this.recursiveWatcher) {
659
+ try {
660
+ this.recursiveWatcher.close();
661
+ }
662
+ catch {
663
+ /* already closed */
664
+ }
665
+ this.recursiveWatcher = null;
666
+ }
667
+ for (const w of this.dirWatchers.values()) {
668
+ try {
669
+ w.close();
670
+ }
671
+ catch {
672
+ /* already closed */
673
+ }
674
+ }
675
+ this.dirWatchers.clear();
676
+ this.dirCapWarned = false;
677
+ this.inotifyLimitWarned = false;
678
+ this.lockRetryCount = 0;
679
+ this.syncFailureRetryCount = 0;
680
+ // NB: degradedReason is intentionally NOT reset here — it must survive the
681
+ // stop() that degrade() triggers so isDegraded() stays true. start() clears it.
682
+ this.inert = false;
683
+ this.pendingFiles.clear();
684
+ this.ready = false;
685
+ this.ignoreMatcher = null;
686
+ if (IS_TEST_RUNTIME)
687
+ liveWatchersForTests.delete(this.projectRoot);
688
+ (0, errors_1.logDebug)('File watcher stopped');
689
+ }
690
+ /**
691
+ * @internal Test-only: feed a synthetic project-relative change through the
692
+ * same filter → pendingFiles → debounced-sync path a real fs.watch event
693
+ * takes. Lets the watcher / staleness-banner suites stay deterministic
694
+ * instead of racing on OS watch-delivery latency. See
695
+ * {@link __emitWatchEventForTests}.
696
+ */
697
+ ingestEventForTests(relPath) {
698
+ this.handleChange((0, utils_1.normalizePath)(relPath));
699
+ }
700
+ /**
701
+ * Whether the watcher is currently active.
702
+ */
703
+ isActive() {
704
+ return (this.recursiveWatcher !== null || this.dirWatchers.size > 0 || this.inert) && !this.stopped;
705
+ }
706
+ /**
707
+ * Resolves once the watch set has been installed (or immediately if it
708
+ * already has). Useful for tests that need a deterministic boundary before
709
+ * asserting on `pendingFiles`.
710
+ *
711
+ * Production callers don't need this: `pendingFiles` is read continuously,
712
+ * the staleness banner is always correct (empty or populated), and there is
713
+ * no asynchronous initial-scan window with `fs.watch`.
714
+ */
715
+ waitUntilReady(timeoutMs = 10000) {
716
+ if (this.ready)
717
+ return Promise.resolve();
718
+ return new Promise((resolve, reject) => {
719
+ const t = setTimeout(() => {
720
+ const idx = this.readyWaiters.indexOf(handler);
721
+ if (idx >= 0)
722
+ this.readyWaiters.splice(idx, 1);
723
+ reject(new Error(`FileWatcher.waitUntilReady timed out after ${timeoutMs}ms`));
724
+ }, timeoutMs);
725
+ const handler = () => { clearTimeout(t); resolve(); };
726
+ this.readyWaiters.push(handler);
727
+ });
728
+ }
729
+ /**
730
+ * Schedule a normal debounced sync after a source edit.
731
+ */
732
+ scheduleSync() {
733
+ if (this.debounceTimer) {
734
+ clearTimeout(this.debounceTimer);
735
+ }
736
+ // Adaptive quiet window: a lone save (or a pair — editor + its test file)
737
+ // fires fast so the graph feels instant; anything bigger keeps the full
738
+ // configured window so an agent's multi-file burst still coalesces into
739
+ // one sync exactly as before. Re-arming on each event preserves the
740
+ // trailing-edge semantics either way: if more events arrive inside the
741
+ // quick window, the reschedule sees the larger pending set and extends to
742
+ // the full window. Never exceeds the configured debounce (a user-lowered
743
+ // CODEGRAPH_WATCH_DEBOUNCE_MS stays authoritative), floor 100ms.
744
+ const quickMs = Math.max(100, Math.min(QUICK_SYNC_QUIET_MS, this.debounceMs));
745
+ const delay = this.pendingFiles.size <= QUICK_SYNC_MAX_PENDING ? quickMs : this.debounceMs;
746
+ this.debounceTimer = setTimeout(() => {
747
+ this.debounceTimer = null;
748
+ this.flush();
749
+ }, delay);
750
+ }
751
+ /**
752
+ * Schedule a retry after a recoverable sync failure (lock contention). Kept
753
+ * separate from {@link scheduleSync} so prolonged contention backs off
754
+ * exponentially instead of hammering the lock every debounce cycle.
755
+ */
756
+ scheduleRetrySync(delayMs) {
757
+ if (this.debounceTimer) {
758
+ clearTimeout(this.debounceTimer);
759
+ }
760
+ this.debounceTimer = setTimeout(() => {
761
+ this.debounceTimer = null;
762
+ this.flush();
763
+ }, delayMs);
764
+ }
765
+ /**
766
+ * Flush pending changes by running sync.
767
+ *
768
+ * pendingFiles is NOT cleared at the start of sync — entries are removed
769
+ * only after sync commits successfully, and only for entries whose
770
+ * lastSeenMs <= syncStartedMs. That way, a query that arrives mid-sync
771
+ * still sees the affected files marked stale (the DB hasn't been updated
772
+ * yet), and an event that lands mid-sync persists into the follow-up.
773
+ *
774
+ * On sync failure pendingFiles is left untouched — every edit is still
775
+ * unindexed, and the rescheduled sync will absorb the same set next time.
776
+ */
777
+ async flush() {
778
+ // If already syncing, the post-sync check will re-trigger
779
+ if (this.syncing || this.stopped)
780
+ return;
781
+ this.syncStartedMs = Date.now();
782
+ this.syncing = true;
783
+ // Scoped fast path: when every pending change is a known file event, hand
784
+ // the exact paths to sync and skip its O(repo) scan-diff. Anything the
785
+ // events can't fully describe — a directory removal, an empty pending set
786
+ // (retry paths), or an event storm past the ceiling — runs the full
787
+ // scan-diff, which remains the ground truth.
788
+ const scoped = !this.needsFullScan && this.pendingFiles.size > 0 && this.pendingFiles.size <= SCOPED_SYNC_MAX_PENDING
789
+ ? [...this.pendingFiles.keys()]
790
+ : undefined;
791
+ try {
792
+ const result = await this.syncFn(scoped);
793
+ if (!scoped)
794
+ this.needsFullScan = false;
795
+ this.lockRetryCount = 0; // a clean sync clears any contention backoff
796
+ this.syncFailureRetryCount = 0; // ...and any generic-failure backoff
797
+ // Remove entries whose most recent event predates this sync — those
798
+ // edits are now in the DB. Entries with lastSeenMs > syncStartedMs
799
+ // arrived mid-sync; whether the in-flight sync captured them depends
800
+ // on when sync read that file, so we keep them as pending and let
801
+ // the follow-up sync handle them. We prefer false positives ("shown
802
+ // stale, actually fresh" → at worst one extra Read) over false
803
+ // negatives ("shown fresh, actually stale" → misleads the agent).
804
+ for (const [filePath, info] of this.pendingFiles) {
805
+ if (info.lastSeenMs <= this.syncStartedMs) {
806
+ this.pendingFiles.delete(filePath);
807
+ }
808
+ }
809
+ this.onSyncComplete?.(result);
810
+ }
811
+ catch (err) {
812
+ if (err instanceof LockUnavailableError) {
813
+ this.lockRetryCount += 1;
814
+ // Lock-failure no-op (another writer holds the lock). pendingFiles
815
+ // stays intact and the `finally` block reschedules with backoff. Keep
816
+ // brief contention quiet (debug-only — a long external index would
817
+ // otherwise spam stderr every cycle), but stop retrying forever: once a
818
+ // writer holds the lock past the budget, degrade auto-sync explicitly.
819
+ (0, errors_1.logDebug)('Watch sync skipped: file lock unavailable', {
820
+ pendingFiles: this.pendingFiles.size,
821
+ retryCount: this.lockRetryCount,
822
+ });
823
+ if (this.lockRetryCount > MAX_LOCK_RETRIES) {
824
+ this.degrade('CodeGraph file lock held by another process past the retry budget; ' +
825
+ 'auto-sync disabled. Run `codegraph sync` once the other writer finishes ' +
826
+ '(or install git sync hooks) to refresh the graph.', { pendingFiles: this.pendingFiles.size, retryCount: this.lockRetryCount });
827
+ }
828
+ }
829
+ else {
830
+ this.lockRetryCount = 0; // a non-lock failure isn't contention; reset that streak
831
+ this.syncFailureRetryCount += 1;
832
+ const error = err instanceof Error ? err : new Error(String(err));
833
+ (0, errors_1.logWarn)('Watch sync failed', {
834
+ error: error.message,
835
+ retryCount: this.syncFailureRetryCount,
836
+ });
837
+ this.onSyncError?.(error);
838
+ // A persistent (deterministic) sync failure — a broken extractor on a
839
+ // specific file, DB corruption, SQLITE_FULL, an OOM in resolution —
840
+ // would otherwise retry forever at the debounce cadence, spamming logs
841
+ // and work while the auto-update guarantee is silently dead (#1127).
842
+ // Bound it exactly like lock contention: the `finally` block backs off
843
+ // exponentially, and past the budget we degrade so the dead guarantee
844
+ // is surfaced (onDegraded / isDegraded) instead of hidden. A single
845
+ // clean sync resets the streak, so a transient hiccup never degrades.
846
+ if (this.syncFailureRetryCount > MAX_SYNC_FAILURE_RETRIES) {
847
+ this.degrade(`CodeGraph auto-sync failed ${this.syncFailureRetryCount} times in a row; ` +
848
+ 'auto-sync disabled. Run `codegraph sync` (or install git sync hooks) to ' +
849
+ `refresh the graph after changes. Last error: ${error.message}`, { error: error.message, retryCount: this.syncFailureRetryCount });
850
+ }
851
+ }
852
+ // Failure: leave pendingFiles untouched. Every edit it tracks is
853
+ // still unindexed; the rescheduled sync sees the same set.
854
+ }
855
+ finally {
856
+ this.syncing = false;
857
+ // If pending files remain (mid-sync events, or this sync failed),
858
+ // schedule another pass. After EITHER failure mode — lock contention or a
859
+ // generic sync failure — back off exponentially (debounceMs · 2^(n-1),
860
+ // capped) instead of retrying at the normal debounce cadence; a clean
861
+ // sync resets both counters so normal edits keep the fast debounce. Use
862
+ // the larger streak so interleaved failures still back off. A degrade()
863
+ // above already set `stopped`, so this won't reschedule a watcher that
864
+ // has given up.
865
+ if (this.pendingFiles.size > 0 && !this.stopped) {
866
+ const retryCount = Math.max(this.lockRetryCount, this.syncFailureRetryCount);
867
+ if (retryCount > 0) {
868
+ const retryDelayMs = Math.min(this.debounceMs * 2 ** Math.max(0, retryCount - 1), MAX_RETRY_BACKOFF_MS);
869
+ this.scheduleRetrySync(retryDelayMs);
870
+ }
871
+ else {
872
+ this.scheduleSync();
873
+ }
874
+ }
875
+ }
876
+ }
877
+ /**
878
+ * Snapshot of files seen by the watcher since the last successful sync.
879
+ *
880
+ * Used by MCP tool responses to mark stale results without blocking on a
881
+ * sync: a tool that returns a hit in `src/foo.ts` while `src/foo.ts` is in
882
+ * this list tells the agent "Read this file directly, the index lags."
883
+ *
884
+ * `indexing` is true when a sync is currently in flight whose start time is
885
+ * AFTER this file's most recent event — i.e. that sync will absorb the
886
+ * edit. False means the file is still inside the debounce window and no
887
+ * sync has started yet (a follow-up call a few hundred ms later may show
888
+ * `indexing: true` or the file may have left the list entirely).
889
+ *
890
+ * Cheap: O(pendingFiles.size), no I/O, no locks.
891
+ */
892
+ getPendingFiles() {
893
+ const result = [];
894
+ for (const [filePath, info] of this.pendingFiles) {
895
+ result.push({
896
+ path: filePath,
897
+ firstSeenMs: info.firstSeenMs,
898
+ lastSeenMs: info.lastSeenMs,
899
+ indexing: this.syncing && this.syncStartedMs >= info.lastSeenMs,
900
+ });
901
+ }
902
+ return result;
903
+ }
904
+ }
905
+ exports.FileWatcher = FileWatcher;
906
+ /**
907
+ * Test-only: synthesize a source-file change for the live watcher running at
908
+ * `projectRoot`, exercising the real filter → pendingFiles → debounced-sync
909
+ * logic without depending on fs.watch delivery timing (which races under
910
+ * parallel vitest). `relPath` is project-relative POSIX (e.g. "src/foo.ts").
911
+ * Returns false if no live watcher is registered for that root (e.g. outside a
912
+ * test runtime, where the registry is intentionally not populated).
913
+ */
914
+ function __emitWatchEventForTests(projectRoot, relPath) {
915
+ const w = liveWatchersForTests.get(projectRoot);
916
+ if (!w)
917
+ return false;
918
+ w.ingestEventForTests(relPath);
919
+ return true;
920
+ }
921
+ //# sourceMappingURL=watcher.js.map