@kkvcrobatz107/codegraph 0.9.6-pkm.1

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 (501) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +595 -0
  3. package/dist/bin/codegraph.d.ts +25 -0
  4. package/dist/bin/codegraph.d.ts.map +1 -0
  5. package/dist/bin/codegraph.js +1563 -0
  6. package/dist/bin/codegraph.js.map +1 -0
  7. package/dist/bin/node-version-check.d.ts +37 -0
  8. package/dist/bin/node-version-check.d.ts.map +1 -0
  9. package/dist/bin/node-version-check.js +79 -0
  10. package/dist/bin/node-version-check.js.map +1 -0
  11. package/dist/bin/uninstall.d.ts +14 -0
  12. package/dist/bin/uninstall.d.ts.map +1 -0
  13. package/dist/bin/uninstall.js +36 -0
  14. package/dist/bin/uninstall.js.map +1 -0
  15. package/dist/context/formatter.d.ts +30 -0
  16. package/dist/context/formatter.d.ts.map +1 -0
  17. package/dist/context/formatter.js +244 -0
  18. package/dist/context/formatter.js.map +1 -0
  19. package/dist/context/index.d.ts +110 -0
  20. package/dist/context/index.d.ts.map +1 -0
  21. package/dist/context/index.js +1169 -0
  22. package/dist/context/index.js.map +1 -0
  23. package/dist/db/index.d.ts +101 -0
  24. package/dist/db/index.d.ts.map +1 -0
  25. package/dist/db/index.js +251 -0
  26. package/dist/db/index.js.map +1 -0
  27. package/dist/db/migrations.d.ts +44 -0
  28. package/dist/db/migrations.d.ts.map +1 -0
  29. package/dist/db/migrations.js +131 -0
  30. package/dist/db/migrations.js.map +1 -0
  31. package/dist/db/queries.d.ts +281 -0
  32. package/dist/db/queries.d.ts.map +1 -0
  33. package/dist/db/queries.js +1300 -0
  34. package/dist/db/queries.js.map +1 -0
  35. package/dist/db/schema.sql +151 -0
  36. package/dist/db/sqlite-adapter.d.ts +46 -0
  37. package/dist/db/sqlite-adapter.d.ts.map +1 -0
  38. package/dist/db/sqlite-adapter.js +114 -0
  39. package/dist/db/sqlite-adapter.js.map +1 -0
  40. package/dist/directory.d.ts +57 -0
  41. package/dist/directory.d.ts.map +1 -0
  42. package/dist/directory.js +264 -0
  43. package/dist/directory.js.map +1 -0
  44. package/dist/errors.d.ts +136 -0
  45. package/dist/errors.d.ts.map +1 -0
  46. package/dist/errors.js +219 -0
  47. package/dist/errors.js.map +1 -0
  48. package/dist/extraction/dfm-extractor.d.ts +31 -0
  49. package/dist/extraction/dfm-extractor.d.ts.map +1 -0
  50. package/dist/extraction/dfm-extractor.js +151 -0
  51. package/dist/extraction/dfm-extractor.js.map +1 -0
  52. package/dist/extraction/grammars.d.ts +90 -0
  53. package/dist/extraction/grammars.d.ts.map +1 -0
  54. package/dist/extraction/grammars.js +407 -0
  55. package/dist/extraction/grammars.js.map +1 -0
  56. package/dist/extraction/index.d.ts +138 -0
  57. package/dist/extraction/index.d.ts.map +1 -0
  58. package/dist/extraction/index.js +1378 -0
  59. package/dist/extraction/index.js.map +1 -0
  60. package/dist/extraction/languages/c-cpp.d.ts +4 -0
  61. package/dist/extraction/languages/c-cpp.d.ts.map +1 -0
  62. package/dist/extraction/languages/c-cpp.js +171 -0
  63. package/dist/extraction/languages/c-cpp.js.map +1 -0
  64. package/dist/extraction/languages/csharp.d.ts +3 -0
  65. package/dist/extraction/languages/csharp.d.ts.map +1 -0
  66. package/dist/extraction/languages/csharp.js +73 -0
  67. package/dist/extraction/languages/csharp.js.map +1 -0
  68. package/dist/extraction/languages/dart.d.ts +3 -0
  69. package/dist/extraction/languages/dart.d.ts.map +1 -0
  70. package/dist/extraction/languages/dart.js +192 -0
  71. package/dist/extraction/languages/dart.js.map +1 -0
  72. package/dist/extraction/languages/go.d.ts +3 -0
  73. package/dist/extraction/languages/go.d.ts.map +1 -0
  74. package/dist/extraction/languages/go.js +70 -0
  75. package/dist/extraction/languages/go.js.map +1 -0
  76. package/dist/extraction/languages/index.d.ts +10 -0
  77. package/dist/extraction/languages/index.d.ts.map +1 -0
  78. package/dist/extraction/languages/index.js +51 -0
  79. package/dist/extraction/languages/index.js.map +1 -0
  80. package/dist/extraction/languages/java.d.ts +3 -0
  81. package/dist/extraction/languages/java.d.ts.map +1 -0
  82. package/dist/extraction/languages/java.js +70 -0
  83. package/dist/extraction/languages/java.js.map +1 -0
  84. package/dist/extraction/languages/javascript.d.ts +3 -0
  85. package/dist/extraction/languages/javascript.d.ts.map +1 -0
  86. package/dist/extraction/languages/javascript.js +90 -0
  87. package/dist/extraction/languages/javascript.js.map +1 -0
  88. package/dist/extraction/languages/kotlin.d.ts +3 -0
  89. package/dist/extraction/languages/kotlin.d.ts.map +1 -0
  90. package/dist/extraction/languages/kotlin.js +259 -0
  91. package/dist/extraction/languages/kotlin.js.map +1 -0
  92. package/dist/extraction/languages/lua.d.ts +3 -0
  93. package/dist/extraction/languages/lua.d.ts.map +1 -0
  94. package/dist/extraction/languages/lua.js +150 -0
  95. package/dist/extraction/languages/lua.js.map +1 -0
  96. package/dist/extraction/languages/luau.d.ts +3 -0
  97. package/dist/extraction/languages/luau.d.ts.map +1 -0
  98. package/dist/extraction/languages/luau.js +37 -0
  99. package/dist/extraction/languages/luau.js.map +1 -0
  100. package/dist/extraction/languages/objc.d.ts +3 -0
  101. package/dist/extraction/languages/objc.d.ts.map +1 -0
  102. package/dist/extraction/languages/objc.js +133 -0
  103. package/dist/extraction/languages/objc.js.map +1 -0
  104. package/dist/extraction/languages/pascal.d.ts +3 -0
  105. package/dist/extraction/languages/pascal.d.ts.map +1 -0
  106. package/dist/extraction/languages/pascal.js +66 -0
  107. package/dist/extraction/languages/pascal.js.map +1 -0
  108. package/dist/extraction/languages/php.d.ts +3 -0
  109. package/dist/extraction/languages/php.d.ts.map +1 -0
  110. package/dist/extraction/languages/php.js +107 -0
  111. package/dist/extraction/languages/php.js.map +1 -0
  112. package/dist/extraction/languages/python.d.ts +3 -0
  113. package/dist/extraction/languages/python.d.ts.map +1 -0
  114. package/dist/extraction/languages/python.js +56 -0
  115. package/dist/extraction/languages/python.js.map +1 -0
  116. package/dist/extraction/languages/ruby.d.ts +3 -0
  117. package/dist/extraction/languages/ruby.d.ts.map +1 -0
  118. package/dist/extraction/languages/ruby.js +114 -0
  119. package/dist/extraction/languages/ruby.js.map +1 -0
  120. package/dist/extraction/languages/rust.d.ts +3 -0
  121. package/dist/extraction/languages/rust.d.ts.map +1 -0
  122. package/dist/extraction/languages/rust.js +109 -0
  123. package/dist/extraction/languages/rust.js.map +1 -0
  124. package/dist/extraction/languages/scala.d.ts +3 -0
  125. package/dist/extraction/languages/scala.d.ts.map +1 -0
  126. package/dist/extraction/languages/scala.js +139 -0
  127. package/dist/extraction/languages/scala.js.map +1 -0
  128. package/dist/extraction/languages/swift.d.ts +3 -0
  129. package/dist/extraction/languages/swift.d.ts.map +1 -0
  130. package/dist/extraction/languages/swift.js +91 -0
  131. package/dist/extraction/languages/swift.js.map +1 -0
  132. package/dist/extraction/languages/typescript.d.ts +3 -0
  133. package/dist/extraction/languages/typescript.d.ts.map +1 -0
  134. package/dist/extraction/languages/typescript.js +129 -0
  135. package/dist/extraction/languages/typescript.js.map +1 -0
  136. package/dist/extraction/liquid-extractor.d.ts +52 -0
  137. package/dist/extraction/liquid-extractor.d.ts.map +1 -0
  138. package/dist/extraction/liquid-extractor.js +313 -0
  139. package/dist/extraction/liquid-extractor.js.map +1 -0
  140. package/dist/extraction/mybatis-extractor.d.ts +48 -0
  141. package/dist/extraction/mybatis-extractor.d.ts.map +1 -0
  142. package/dist/extraction/mybatis-extractor.js +198 -0
  143. package/dist/extraction/mybatis-extractor.js.map +1 -0
  144. package/dist/extraction/parse-worker.d.ts +8 -0
  145. package/dist/extraction/parse-worker.d.ts.map +1 -0
  146. package/dist/extraction/parse-worker.js +94 -0
  147. package/dist/extraction/parse-worker.js.map +1 -0
  148. package/dist/extraction/svelte-extractor.d.ts +56 -0
  149. package/dist/extraction/svelte-extractor.d.ts.map +1 -0
  150. package/dist/extraction/svelte-extractor.js +272 -0
  151. package/dist/extraction/svelte-extractor.js.map +1 -0
  152. package/dist/extraction/tree-sitter-helpers.d.ts +28 -0
  153. package/dist/extraction/tree-sitter-helpers.d.ts.map +1 -0
  154. package/dist/extraction/tree-sitter-helpers.js +103 -0
  155. package/dist/extraction/tree-sitter-helpers.js.map +1 -0
  156. package/dist/extraction/tree-sitter-types.d.ts +193 -0
  157. package/dist/extraction/tree-sitter-types.d.ts.map +1 -0
  158. package/dist/extraction/tree-sitter-types.js +10 -0
  159. package/dist/extraction/tree-sitter-types.js.map +1 -0
  160. package/dist/extraction/tree-sitter.d.ts +291 -0
  161. package/dist/extraction/tree-sitter.d.ts.map +1 -0
  162. package/dist/extraction/tree-sitter.js +2961 -0
  163. package/dist/extraction/tree-sitter.js.map +1 -0
  164. package/dist/extraction/vue-extractor.d.ts +36 -0
  165. package/dist/extraction/vue-extractor.d.ts.map +1 -0
  166. package/dist/extraction/vue-extractor.js +163 -0
  167. package/dist/extraction/vue-extractor.js.map +1 -0
  168. package/dist/extraction/wasm/tree-sitter-lua.wasm +0 -0
  169. package/dist/extraction/wasm/tree-sitter-luau.wasm +0 -0
  170. package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  171. package/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  172. package/dist/extraction/wasm-runtime-flags.d.ts +38 -0
  173. package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -0
  174. package/dist/extraction/wasm-runtime-flags.js +105 -0
  175. package/dist/extraction/wasm-runtime-flags.js.map +1 -0
  176. package/dist/graph/index.d.ts +8 -0
  177. package/dist/graph/index.d.ts.map +1 -0
  178. package/dist/graph/index.js +13 -0
  179. package/dist/graph/index.js.map +1 -0
  180. package/dist/graph/queries.d.ts +106 -0
  181. package/dist/graph/queries.d.ts.map +1 -0
  182. package/dist/graph/queries.js +366 -0
  183. package/dist/graph/queries.js.map +1 -0
  184. package/dist/graph/traversal.d.ts +127 -0
  185. package/dist/graph/traversal.d.ts.map +1 -0
  186. package/dist/graph/traversal.js +528 -0
  187. package/dist/graph/traversal.js.map +1 -0
  188. package/dist/index.d.ts +460 -0
  189. package/dist/index.d.ts.map +1 -0
  190. package/dist/index.js +863 -0
  191. package/dist/index.js.map +1 -0
  192. package/dist/installer/claude-md-template.d.ts +14 -0
  193. package/dist/installer/claude-md-template.d.ts.map +1 -0
  194. package/dist/installer/claude-md-template.js +21 -0
  195. package/dist/installer/claude-md-template.js.map +1 -0
  196. package/dist/installer/config-writer.d.ts +29 -0
  197. package/dist/installer/config-writer.d.ts.map +1 -0
  198. package/dist/installer/config-writer.js +111 -0
  199. package/dist/installer/config-writer.js.map +1 -0
  200. package/dist/installer/index.d.ts +117 -0
  201. package/dist/installer/index.d.ts.map +1 -0
  202. package/dist/installer/index.js +528 -0
  203. package/dist/installer/index.js.map +1 -0
  204. package/dist/installer/instructions-template.d.ts +28 -0
  205. package/dist/installer/instructions-template.d.ts.map +1 -0
  206. package/dist/installer/instructions-template.js +65 -0
  207. package/dist/installer/instructions-template.js.map +1 -0
  208. package/dist/installer/targets/antigravity.d.ts +57 -0
  209. package/dist/installer/targets/antigravity.d.ts.map +1 -0
  210. package/dist/installer/targets/antigravity.js +307 -0
  211. package/dist/installer/targets/antigravity.js.map +1 -0
  212. package/dist/installer/targets/claude.d.ts +47 -0
  213. package/dist/installer/targets/claude.d.ts.map +1 -0
  214. package/dist/installer/targets/claude.js +401 -0
  215. package/dist/installer/targets/claude.js.map +1 -0
  216. package/dist/installer/targets/codex.d.ts +18 -0
  217. package/dist/installer/targets/codex.d.ts.map +1 -0
  218. package/dist/installer/targets/codex.js +185 -0
  219. package/dist/installer/targets/codex.js.map +1 -0
  220. package/dist/installer/targets/cursor.d.ts +35 -0
  221. package/dist/installer/targets/cursor.d.ts.map +1 -0
  222. package/dist/installer/targets/cursor.js +283 -0
  223. package/dist/installer/targets/cursor.js.map +1 -0
  224. package/dist/installer/targets/gemini.d.ts +26 -0
  225. package/dist/installer/targets/gemini.d.ts.map +1 -0
  226. package/dist/installer/targets/gemini.js +165 -0
  227. package/dist/installer/targets/gemini.js.map +1 -0
  228. package/dist/installer/targets/hermes.d.ts +18 -0
  229. package/dist/installer/targets/hermes.d.ts.map +1 -0
  230. package/dist/installer/targets/hermes.js +359 -0
  231. package/dist/installer/targets/hermes.js.map +1 -0
  232. package/dist/installer/targets/kiro.d.ts +27 -0
  233. package/dist/installer/targets/kiro.d.ts.map +1 -0
  234. package/dist/installer/targets/kiro.js +196 -0
  235. package/dist/installer/targets/kiro.js.map +1 -0
  236. package/dist/installer/targets/opencode.d.ts +30 -0
  237. package/dist/installer/targets/opencode.d.ts.map +1 -0
  238. package/dist/installer/targets/opencode.js +235 -0
  239. package/dist/installer/targets/opencode.js.map +1 -0
  240. package/dist/installer/targets/registry.d.ts +35 -0
  241. package/dist/installer/targets/registry.d.ts.map +1 -0
  242. package/dist/installer/targets/registry.js +91 -0
  243. package/dist/installer/targets/registry.js.map +1 -0
  244. package/dist/installer/targets/shared.d.ts +77 -0
  245. package/dist/installer/targets/shared.d.ts.map +1 -0
  246. package/dist/installer/targets/shared.js +246 -0
  247. package/dist/installer/targets/shared.js.map +1 -0
  248. package/dist/installer/targets/toml.d.ts +52 -0
  249. package/dist/installer/targets/toml.d.ts.map +1 -0
  250. package/dist/installer/targets/toml.js +147 -0
  251. package/dist/installer/targets/toml.js.map +1 -0
  252. package/dist/installer/targets/types.d.ts +116 -0
  253. package/dist/installer/targets/types.d.ts.map +1 -0
  254. package/dist/installer/targets/types.js +16 -0
  255. package/dist/installer/targets/types.js.map +1 -0
  256. package/dist/mcp/daemon-paths.d.ts +46 -0
  257. package/dist/mcp/daemon-paths.d.ts.map +1 -0
  258. package/dist/mcp/daemon-paths.js +125 -0
  259. package/dist/mcp/daemon-paths.js.map +1 -0
  260. package/dist/mcp/daemon.d.ts +161 -0
  261. package/dist/mcp/daemon.d.ts.map +1 -0
  262. package/dist/mcp/daemon.js +403 -0
  263. package/dist/mcp/daemon.js.map +1 -0
  264. package/dist/mcp/engine.d.ts +100 -0
  265. package/dist/mcp/engine.d.ts.map +1 -0
  266. package/dist/mcp/engine.js +291 -0
  267. package/dist/mcp/engine.js.map +1 -0
  268. package/dist/mcp/index.d.ts +109 -0
  269. package/dist/mcp/index.d.ts.map +1 -0
  270. package/dist/mcp/index.js +470 -0
  271. package/dist/mcp/index.js.map +1 -0
  272. package/dist/mcp/proxy.d.ts +46 -0
  273. package/dist/mcp/proxy.d.ts.map +1 -0
  274. package/dist/mcp/proxy.js +276 -0
  275. package/dist/mcp/proxy.js.map +1 -0
  276. package/dist/mcp/server-instructions.d.ts +19 -0
  277. package/dist/mcp/server-instructions.d.ts.map +1 -0
  278. package/dist/mcp/server-instructions.js +73 -0
  279. package/dist/mcp/server-instructions.js.map +1 -0
  280. package/dist/mcp/session.d.ts +67 -0
  281. package/dist/mcp/session.d.ts.map +1 -0
  282. package/dist/mcp/session.js +276 -0
  283. package/dist/mcp/session.js.map +1 -0
  284. package/dist/mcp/tools.d.ts +385 -0
  285. package/dist/mcp/tools.d.ts.map +1 -0
  286. package/dist/mcp/tools.js +2545 -0
  287. package/dist/mcp/tools.js.map +1 -0
  288. package/dist/mcp/transport.d.ts +188 -0
  289. package/dist/mcp/transport.d.ts.map +1 -0
  290. package/dist/mcp/transport.js +343 -0
  291. package/dist/mcp/transport.js.map +1 -0
  292. package/dist/mcp/version.d.ts +19 -0
  293. package/dist/mcp/version.d.ts.map +1 -0
  294. package/dist/mcp/version.js +71 -0
  295. package/dist/mcp/version.js.map +1 -0
  296. package/dist/resolution/callback-synthesizer.d.ts +10 -0
  297. package/dist/resolution/callback-synthesizer.d.ts.map +1 -0
  298. package/dist/resolution/callback-synthesizer.js +924 -0
  299. package/dist/resolution/callback-synthesizer.js.map +1 -0
  300. package/dist/resolution/frameworks/cargo-workspace.d.ts +18 -0
  301. package/dist/resolution/frameworks/cargo-workspace.d.ts.map +1 -0
  302. package/dist/resolution/frameworks/cargo-workspace.js +225 -0
  303. package/dist/resolution/frameworks/cargo-workspace.js.map +1 -0
  304. package/dist/resolution/frameworks/csharp.d.ts +8 -0
  305. package/dist/resolution/frameworks/csharp.d.ts.map +1 -0
  306. package/dist/resolution/frameworks/csharp.js +241 -0
  307. package/dist/resolution/frameworks/csharp.js.map +1 -0
  308. package/dist/resolution/frameworks/drupal.d.ts +51 -0
  309. package/dist/resolution/frameworks/drupal.d.ts.map +1 -0
  310. package/dist/resolution/frameworks/drupal.js +367 -0
  311. package/dist/resolution/frameworks/drupal.js.map +1 -0
  312. package/dist/resolution/frameworks/expo-modules.d.ts +3 -0
  313. package/dist/resolution/frameworks/expo-modules.d.ts.map +1 -0
  314. package/dist/resolution/frameworks/expo-modules.js +143 -0
  315. package/dist/resolution/frameworks/expo-modules.js.map +1 -0
  316. package/dist/resolution/frameworks/express.d.ts +8 -0
  317. package/dist/resolution/frameworks/express.d.ts.map +1 -0
  318. package/dist/resolution/frameworks/express.js +308 -0
  319. package/dist/resolution/frameworks/express.js.map +1 -0
  320. package/dist/resolution/frameworks/fabric.d.ts +3 -0
  321. package/dist/resolution/frameworks/fabric.d.ts.map +1 -0
  322. package/dist/resolution/frameworks/fabric.js +354 -0
  323. package/dist/resolution/frameworks/fabric.js.map +1 -0
  324. package/dist/resolution/frameworks/go.d.ts +8 -0
  325. package/dist/resolution/frameworks/go.d.ts.map +1 -0
  326. package/dist/resolution/frameworks/go.js +161 -0
  327. package/dist/resolution/frameworks/go.js.map +1 -0
  328. package/dist/resolution/frameworks/index.d.ts +48 -0
  329. package/dist/resolution/frameworks/index.d.ts.map +1 -0
  330. package/dist/resolution/frameworks/index.js +161 -0
  331. package/dist/resolution/frameworks/index.js.map +1 -0
  332. package/dist/resolution/frameworks/java.d.ts +8 -0
  333. package/dist/resolution/frameworks/java.d.ts.map +1 -0
  334. package/dist/resolution/frameworks/java.js +504 -0
  335. package/dist/resolution/frameworks/java.js.map +1 -0
  336. package/dist/resolution/frameworks/laravel.d.ts +13 -0
  337. package/dist/resolution/frameworks/laravel.d.ts.map +1 -0
  338. package/dist/resolution/frameworks/laravel.js +257 -0
  339. package/dist/resolution/frameworks/laravel.js.map +1 -0
  340. package/dist/resolution/frameworks/nestjs.d.ts +26 -0
  341. package/dist/resolution/frameworks/nestjs.d.ts.map +1 -0
  342. package/dist/resolution/frameworks/nestjs.js +698 -0
  343. package/dist/resolution/frameworks/nestjs.js.map +1 -0
  344. package/dist/resolution/frameworks/play.d.ts +19 -0
  345. package/dist/resolution/frameworks/play.d.ts.map +1 -0
  346. package/dist/resolution/frameworks/play.js +111 -0
  347. package/dist/resolution/frameworks/play.js.map +1 -0
  348. package/dist/resolution/frameworks/python.d.ts +10 -0
  349. package/dist/resolution/frameworks/python.d.ts.map +1 -0
  350. package/dist/resolution/frameworks/python.js +396 -0
  351. package/dist/resolution/frameworks/python.js.map +1 -0
  352. package/dist/resolution/frameworks/react-native.d.ts +3 -0
  353. package/dist/resolution/frameworks/react-native.d.ts.map +1 -0
  354. package/dist/resolution/frameworks/react-native.js +360 -0
  355. package/dist/resolution/frameworks/react-native.js.map +1 -0
  356. package/dist/resolution/frameworks/react.d.ts +8 -0
  357. package/dist/resolution/frameworks/react.d.ts.map +1 -0
  358. package/dist/resolution/frameworks/react.js +365 -0
  359. package/dist/resolution/frameworks/react.js.map +1 -0
  360. package/dist/resolution/frameworks/ruby.d.ts +8 -0
  361. package/dist/resolution/frameworks/ruby.d.ts.map +1 -0
  362. package/dist/resolution/frameworks/ruby.js +302 -0
  363. package/dist/resolution/frameworks/ruby.js.map +1 -0
  364. package/dist/resolution/frameworks/rust.d.ts +8 -0
  365. package/dist/resolution/frameworks/rust.d.ts.map +1 -0
  366. package/dist/resolution/frameworks/rust.js +304 -0
  367. package/dist/resolution/frameworks/rust.js.map +1 -0
  368. package/dist/resolution/frameworks/svelte.d.ts +9 -0
  369. package/dist/resolution/frameworks/svelte.d.ts.map +1 -0
  370. package/dist/resolution/frameworks/svelte.js +249 -0
  371. package/dist/resolution/frameworks/svelte.js.map +1 -0
  372. package/dist/resolution/frameworks/swift-objc.d.ts +37 -0
  373. package/dist/resolution/frameworks/swift-objc.d.ts.map +1 -0
  374. package/dist/resolution/frameworks/swift-objc.js +252 -0
  375. package/dist/resolution/frameworks/swift-objc.js.map +1 -0
  376. package/dist/resolution/frameworks/swift.d.ts +10 -0
  377. package/dist/resolution/frameworks/swift.d.ts.map +1 -0
  378. package/dist/resolution/frameworks/swift.js +400 -0
  379. package/dist/resolution/frameworks/swift.js.map +1 -0
  380. package/dist/resolution/frameworks/vue.d.ts +9 -0
  381. package/dist/resolution/frameworks/vue.d.ts.map +1 -0
  382. package/dist/resolution/frameworks/vue.js +306 -0
  383. package/dist/resolution/frameworks/vue.js.map +1 -0
  384. package/dist/resolution/go-module.d.ts +26 -0
  385. package/dist/resolution/go-module.d.ts.map +1 -0
  386. package/dist/resolution/go-module.js +78 -0
  387. package/dist/resolution/go-module.js.map +1 -0
  388. package/dist/resolution/import-resolver.d.ts +68 -0
  389. package/dist/resolution/import-resolver.d.ts.map +1 -0
  390. package/dist/resolution/import-resolver.js +1231 -0
  391. package/dist/resolution/import-resolver.js.map +1 -0
  392. package/dist/resolution/index.d.ts +116 -0
  393. package/dist/resolution/index.d.ts.map +1 -0
  394. package/dist/resolution/index.js +878 -0
  395. package/dist/resolution/index.js.map +1 -0
  396. package/dist/resolution/lru-cache.d.ts +24 -0
  397. package/dist/resolution/lru-cache.d.ts.map +1 -0
  398. package/dist/resolution/lru-cache.js +62 -0
  399. package/dist/resolution/lru-cache.js.map +1 -0
  400. package/dist/resolution/name-matcher.d.ts +32 -0
  401. package/dist/resolution/name-matcher.d.ts.map +1 -0
  402. package/dist/resolution/name-matcher.js +596 -0
  403. package/dist/resolution/name-matcher.js.map +1 -0
  404. package/dist/resolution/path-aliases.d.ts +68 -0
  405. package/dist/resolution/path-aliases.d.ts.map +1 -0
  406. package/dist/resolution/path-aliases.js +238 -0
  407. package/dist/resolution/path-aliases.js.map +1 -0
  408. package/dist/resolution/strip-comments.d.ts +27 -0
  409. package/dist/resolution/strip-comments.d.ts.map +1 -0
  410. package/dist/resolution/strip-comments.js +441 -0
  411. package/dist/resolution/strip-comments.js.map +1 -0
  412. package/dist/resolution/swift-objc-bridge.d.ts +134 -0
  413. package/dist/resolution/swift-objc-bridge.d.ts.map +1 -0
  414. package/dist/resolution/swift-objc-bridge.js +256 -0
  415. package/dist/resolution/swift-objc-bridge.js.map +1 -0
  416. package/dist/resolution/types.d.ts +209 -0
  417. package/dist/resolution/types.d.ts.map +1 -0
  418. package/dist/resolution/types.js +8 -0
  419. package/dist/resolution/types.js.map +1 -0
  420. package/dist/search/query-parser.d.ts +57 -0
  421. package/dist/search/query-parser.d.ts.map +1 -0
  422. package/dist/search/query-parser.js +177 -0
  423. package/dist/search/query-parser.js.map +1 -0
  424. package/dist/search/query-utils.d.ts +53 -0
  425. package/dist/search/query-utils.d.ts.map +1 -0
  426. package/dist/search/query-utils.js +350 -0
  427. package/dist/search/query-utils.js.map +1 -0
  428. package/dist/sync/git-hooks.d.ts +45 -0
  429. package/dist/sync/git-hooks.d.ts.map +1 -0
  430. package/dist/sync/git-hooks.js +223 -0
  431. package/dist/sync/git-hooks.js.map +1 -0
  432. package/dist/sync/index.d.ts +19 -0
  433. package/dist/sync/index.d.ts.map +1 -0
  434. package/dist/sync/index.js +35 -0
  435. package/dist/sync/index.js.map +1 -0
  436. package/dist/sync/watch-policy.d.ts +48 -0
  437. package/dist/sync/watch-policy.d.ts.map +1 -0
  438. package/dist/sync/watch-policy.js +124 -0
  439. package/dist/sync/watch-policy.js.map +1 -0
  440. package/dist/sync/watcher.d.ts +191 -0
  441. package/dist/sync/watcher.d.ts.map +1 -0
  442. package/dist/sync/watcher.js +398 -0
  443. package/dist/sync/watcher.js.map +1 -0
  444. package/dist/sync/worktree.d.ts +54 -0
  445. package/dist/sync/worktree.d.ts.map +1 -0
  446. package/dist/sync/worktree.js +136 -0
  447. package/dist/sync/worktree.js.map +1 -0
  448. package/dist/types.d.ts +369 -0
  449. package/dist/types.d.ts.map +1 -0
  450. package/dist/types.js +78 -0
  451. package/dist/types.js.map +1 -0
  452. package/dist/ui/glyphs.d.ts +42 -0
  453. package/dist/ui/glyphs.d.ts.map +1 -0
  454. package/dist/ui/glyphs.js +78 -0
  455. package/dist/ui/glyphs.js.map +1 -0
  456. package/dist/ui/shimmer-progress.d.ts +11 -0
  457. package/dist/ui/shimmer-progress.d.ts.map +1 -0
  458. package/dist/ui/shimmer-progress.js +90 -0
  459. package/dist/ui/shimmer-progress.js.map +1 -0
  460. package/dist/ui/shimmer-worker.d.ts +2 -0
  461. package/dist/ui/shimmer-worker.d.ts.map +1 -0
  462. package/dist/ui/shimmer-worker.js +118 -0
  463. package/dist/ui/shimmer-worker.js.map +1 -0
  464. package/dist/ui/types.d.ts +17 -0
  465. package/dist/ui/types.d.ts.map +1 -0
  466. package/dist/ui/types.js +3 -0
  467. package/dist/ui/types.js.map +1 -0
  468. package/dist/utils.d.ts +205 -0
  469. package/dist/utils.d.ts.map +1 -0
  470. package/dist/utils.js +549 -0
  471. package/dist/utils.js.map +1 -0
  472. package/package.json +59 -0
  473. package/scripts/add-lang/bench.sh +60 -0
  474. package/scripts/add-lang/check-grammar.mjs +75 -0
  475. package/scripts/add-lang/dump-ast.mjs +103 -0
  476. package/scripts/add-lang/verify-extraction.mjs +70 -0
  477. package/scripts/agent-eval/arms-F.sh +21 -0
  478. package/scripts/agent-eval/arms-matrix.sh +37 -0
  479. package/scripts/agent-eval/audit.sh +68 -0
  480. package/scripts/agent-eval/bench-readme.sh +28 -0
  481. package/scripts/agent-eval/block-read-hook.sh +19 -0
  482. package/scripts/agent-eval/hook-settings.json +15 -0
  483. package/scripts/agent-eval/itrun.sh +107 -0
  484. package/scripts/agent-eval/parse-arms.mjs +116 -0
  485. package/scripts/agent-eval/parse-bench-readme.mjs +67 -0
  486. package/scripts/agent-eval/parse-run.mjs +45 -0
  487. package/scripts/agent-eval/parse-session.mjs +93 -0
  488. package/scripts/agent-eval/probe-context.mjs +21 -0
  489. package/scripts/agent-eval/probe-explore.mjs +40 -0
  490. package/scripts/agent-eval/probe-node.mjs +20 -0
  491. package/scripts/agent-eval/probe-trace.mjs +20 -0
  492. package/scripts/agent-eval/run-agent.sh +34 -0
  493. package/scripts/agent-eval/run-all.sh +67 -0
  494. package/scripts/agent-eval/run-arms.sh +56 -0
  495. package/scripts/agent-eval/seq-matrix.mjs +137 -0
  496. package/scripts/build-bundle.sh +118 -0
  497. package/scripts/extract-release-notes.mjs +130 -0
  498. package/scripts/local-install.sh +41 -0
  499. package/scripts/npm-shim.js +246 -0
  500. package/scripts/pack-npm.sh +95 -0
  501. package/scripts/prepare-release.mjs +270 -0
@@ -0,0 +1,223 @@
1
+ "use strict";
2
+ /**
3
+ * Git Sync Hooks
4
+ *
5
+ * When the live file watcher is disabled (e.g. on WSL2 `/mnt/*` drives,
6
+ * see watch-policy.ts), the CodeGraph index would otherwise go stale until
7
+ * the user runs `codegraph sync` by hand. As an opt-in alternative, we can
8
+ * install git hooks that refresh the index after the operations that change
9
+ * files on disk: commit, merge (covers `git pull`), and checkout.
10
+ *
11
+ * The hooks run `codegraph sync` in the background so they never block git,
12
+ * and are guarded by `command -v codegraph` so they no-op cleanly when the
13
+ * CLI isn't on PATH. Our snippet is delimited by marker comments so install
14
+ * is idempotent and removal preserves any user-authored hook content.
15
+ */
16
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ var desc = Object.getOwnPropertyDescriptor(m, k);
19
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
20
+ desc = { enumerable: true, get: function() { return m[k]; } };
21
+ }
22
+ Object.defineProperty(o, k2, desc);
23
+ }) : (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ o[k2] = m[k];
26
+ }));
27
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
28
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
29
+ }) : function(o, v) {
30
+ o["default"] = v;
31
+ });
32
+ var __importStar = (this && this.__importStar) || (function () {
33
+ var ownKeys = function(o) {
34
+ ownKeys = Object.getOwnPropertyNames || function (o) {
35
+ var ar = [];
36
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
37
+ return ar;
38
+ };
39
+ return ownKeys(o);
40
+ };
41
+ return function (mod) {
42
+ if (mod && mod.__esModule) return mod;
43
+ var result = {};
44
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
45
+ __setModuleDefault(result, mod);
46
+ return result;
47
+ };
48
+ })();
49
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ exports.DEFAULT_SYNC_HOOKS = void 0;
51
+ exports.isGitRepo = isGitRepo;
52
+ exports.installGitSyncHook = installGitSyncHook;
53
+ exports.removeGitSyncHook = removeGitSyncHook;
54
+ exports.isSyncHookInstalled = isSyncHookInstalled;
55
+ const fs = __importStar(require("fs"));
56
+ const path = __importStar(require("path"));
57
+ const child_process_1 = require("child_process");
58
+ const MARKER_BEGIN = '# >>> codegraph sync hook >>>';
59
+ const MARKER_END = '# <<< codegraph sync hook <<<';
60
+ /** Hooks installed by default: commit, merge (git pull), and checkout. */
61
+ exports.DEFAULT_SYNC_HOOKS = ['post-commit', 'post-merge', 'post-checkout'];
62
+ /**
63
+ * Whether `projectRoot` is inside a git working tree. Returns false if git
64
+ * isn't installed or the path isn't a repo.
65
+ */
66
+ function isGitRepo(projectRoot) {
67
+ try {
68
+ const out = (0, child_process_1.execFileSync)('git', ['rev-parse', '--is-inside-work-tree'], {
69
+ cwd: projectRoot,
70
+ encoding: 'utf8',
71
+ stdio: ['ignore', 'pipe', 'ignore'],
72
+ }).trim();
73
+ return out === 'true';
74
+ }
75
+ catch {
76
+ return false;
77
+ }
78
+ }
79
+ /**
80
+ * Resolve the git hooks directory for a project, honoring `core.hooksPath`
81
+ * and git worktrees. Returns an absolute path, or null when not a repo.
82
+ */
83
+ function gitHooksDir(projectRoot) {
84
+ try {
85
+ const out = (0, child_process_1.execFileSync)('git', ['rev-parse', '--git-path', 'hooks'], {
86
+ cwd: projectRoot,
87
+ encoding: 'utf8',
88
+ stdio: ['ignore', 'pipe', 'ignore'],
89
+ }).trim();
90
+ if (!out)
91
+ return null;
92
+ return path.isAbsolute(out) ? out : path.resolve(projectRoot, out);
93
+ }
94
+ catch {
95
+ return null;
96
+ }
97
+ }
98
+ /** The shell snippet (between markers) injected into each hook. */
99
+ function markerBlock() {
100
+ return [
101
+ MARKER_BEGIN,
102
+ '# Keeps the CodeGraph index fresh while the live file watcher is off',
103
+ '# (e.g. WSL2 /mnt drives). Runs in the background so it never blocks git.',
104
+ '# Managed by codegraph; remove with `codegraph uninit` or delete this block.',
105
+ 'if command -v codegraph >/dev/null 2>&1; then',
106
+ ' ( codegraph sync >/dev/null 2>&1 & ) >/dev/null 2>&1',
107
+ 'fi',
108
+ MARKER_END,
109
+ ].join('\n');
110
+ }
111
+ /** Remove our marker block (and the marker lines) from hook content. */
112
+ function stripMarkerBlock(content) {
113
+ const lines = content.split('\n');
114
+ const kept = [];
115
+ let inBlock = false;
116
+ for (const line of lines) {
117
+ const trimmed = line.trim();
118
+ if (trimmed === MARKER_BEGIN) {
119
+ inBlock = true;
120
+ continue;
121
+ }
122
+ if (trimmed === MARKER_END) {
123
+ inBlock = false;
124
+ continue;
125
+ }
126
+ if (!inBlock)
127
+ kept.push(line);
128
+ }
129
+ return kept.join('\n');
130
+ }
131
+ /** Whether a hook body is just a shebang / blank lines (i.e. only ever ours). */
132
+ function isEffectivelyEmpty(content) {
133
+ return content
134
+ .split('\n')
135
+ .map((l) => l.trim())
136
+ .every((l) => l.length === 0 || l.startsWith('#!'));
137
+ }
138
+ function chmodExecutable(file) {
139
+ try {
140
+ fs.chmodSync(file, 0o755);
141
+ }
142
+ catch {
143
+ /* chmod is a no-op / unsupported on some platforms (e.g. Windows) */
144
+ }
145
+ }
146
+ /**
147
+ * Install (or update) the CodeGraph sync hooks in a git repository.
148
+ * Idempotent: re-running replaces our marker block rather than duplicating
149
+ * it, and any user-authored hook content is preserved.
150
+ */
151
+ function installGitSyncHook(projectRoot, hooks = exports.DEFAULT_SYNC_HOOKS) {
152
+ const hooksDir = gitHooksDir(projectRoot);
153
+ if (!hooksDir) {
154
+ return { installed: [], hooksDir: null, skipped: 'not a git repository' };
155
+ }
156
+ try {
157
+ fs.mkdirSync(hooksDir, { recursive: true });
158
+ }
159
+ catch {
160
+ return { installed: [], hooksDir, skipped: 'could not access the git hooks directory' };
161
+ }
162
+ const block = markerBlock();
163
+ const installed = [];
164
+ for (const hook of hooks) {
165
+ const file = path.join(hooksDir, hook);
166
+ let content;
167
+ if (fs.existsSync(file)) {
168
+ // Strip any prior block, then re-append the current one.
169
+ const base = stripMarkerBlock(fs.readFileSync(file, 'utf8')).replace(/\s*$/, '');
170
+ content = base.length > 0
171
+ ? `${base}\n\n${block}\n`
172
+ : `#!/bin/sh\n${block}\n`;
173
+ }
174
+ else {
175
+ content = `#!/bin/sh\n${block}\n`;
176
+ }
177
+ fs.writeFileSync(file, content);
178
+ chmodExecutable(file);
179
+ installed.push(hook);
180
+ }
181
+ return { installed, hooksDir };
182
+ }
183
+ /**
184
+ * Remove the CodeGraph sync hooks. Strips only our marker block; deletes the
185
+ * hook file entirely when nothing but a shebang remains, otherwise rewrites
186
+ * the user's content untouched.
187
+ */
188
+ function removeGitSyncHook(projectRoot, hooks = exports.DEFAULT_SYNC_HOOKS) {
189
+ const hooksDir = gitHooksDir(projectRoot);
190
+ if (!hooksDir) {
191
+ return { installed: [], hooksDir: null, skipped: 'not a git repository' };
192
+ }
193
+ const removed = [];
194
+ for (const hook of hooks) {
195
+ const file = path.join(hooksDir, hook);
196
+ if (!fs.existsSync(file))
197
+ continue;
198
+ const original = fs.readFileSync(file, 'utf8');
199
+ if (!original.includes(MARKER_BEGIN))
200
+ continue;
201
+ const stripped = stripMarkerBlock(original);
202
+ if (isEffectivelyEmpty(stripped)) {
203
+ fs.unlinkSync(file);
204
+ }
205
+ else {
206
+ fs.writeFileSync(file, `${stripped.replace(/\s*$/, '')}\n`);
207
+ chmodExecutable(file);
208
+ }
209
+ removed.push(hook);
210
+ }
211
+ return { installed: removed, hooksDir };
212
+ }
213
+ /** Whether any CodeGraph sync hook is currently installed. */
214
+ function isSyncHookInstalled(projectRoot, hooks = exports.DEFAULT_SYNC_HOOKS) {
215
+ const hooksDir = gitHooksDir(projectRoot);
216
+ if (!hooksDir)
217
+ return false;
218
+ return hooks.some((hook) => {
219
+ const file = path.join(hooksDir, hook);
220
+ return fs.existsSync(file) && fs.readFileSync(file, 'utf8').includes(MARKER_BEGIN);
221
+ });
222
+ }
223
+ //# sourceMappingURL=git-hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-hooks.js","sourceRoot":"","sources":["../../src/sync/git-hooks.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BH,8BAWC;AAqED,gDAsCC;AAOD,8CA6BC;AAGD,kDAUC;AAhMD,uCAAyB;AACzB,2CAA6B;AAC7B,iDAA6C;AAE7C,MAAM,YAAY,GAAG,+BAA+B,CAAC;AACrD,MAAM,UAAU,GAAG,+BAA+B,CAAC;AAInD,0EAA0E;AAC7D,QAAA,kBAAkB,GAAkB,CAAC,aAAa,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC;AAWhG;;;GAGG;AACH,SAAgB,SAAS,CAAC,WAAmB;IAC3C,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAA,4BAAY,EAAC,KAAK,EAAE,CAAC,WAAW,EAAE,uBAAuB,CAAC,EAAE;YACtE,GAAG,EAAE,WAAW;YAChB,QAAQ,EAAE,MAAM;YAChB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;SACpC,CAAC,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,GAAG,KAAK,MAAM,CAA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AAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IACrF,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Sync Module
3
+ *
4
+ * Provides synchronization functionality for keeping the code graph
5
+ * up-to-date with file system changes.
6
+ *
7
+ * Components:
8
+ * - FileWatcher: Debounced fs.watch that auto-triggers sync on file changes
9
+ * - Watch policy: decides when the watcher must be disabled (e.g. WSL2 /mnt)
10
+ * - Git sync hooks: opt-in commit/merge/checkout hooks when watching is off
11
+ * - Git worktree awareness: detect when a query borrows another tree's index
12
+ * - Content hashing for change detection (in extraction module)
13
+ * - Incremental reindexing (in extraction module)
14
+ */
15
+ export { FileWatcher, WatchOptions, PendingFile, LockUnavailableError } from './watcher';
16
+ export { watchDisabledReason, detectWsl } from './watch-policy';
17
+ export { installGitSyncHook, removeGitSyncHook, isSyncHookInstalled, isGitRepo, DEFAULT_SYNC_HOOKS, type GitHookName, type GitHookResult, } from './git-hooks';
18
+ export { gitWorktreeRoot, detectWorktreeIndexMismatch, worktreeMismatchWarning, worktreeMismatchNotice, type WorktreeIndexMismatch, } from './worktree';
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sync/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,kBAAkB,EAClB,KAAK,WAAW,EAChB,KAAK,aAAa,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,eAAe,EACf,2BAA2B,EAC3B,uBAAuB,EACvB,sBAAsB,EACtB,KAAK,qBAAqB,GAC3B,MAAM,YAAY,CAAC"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ /**
3
+ * Sync Module
4
+ *
5
+ * Provides synchronization functionality for keeping the code graph
6
+ * up-to-date with file system changes.
7
+ *
8
+ * Components:
9
+ * - FileWatcher: Debounced fs.watch that auto-triggers sync on file changes
10
+ * - Watch policy: decides when the watcher must be disabled (e.g. WSL2 /mnt)
11
+ * - Git sync hooks: opt-in commit/merge/checkout hooks when watching is off
12
+ * - Git worktree awareness: detect when a query borrows another tree's index
13
+ * - Content hashing for change detection (in extraction module)
14
+ * - Incremental reindexing (in extraction module)
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.worktreeMismatchNotice = exports.worktreeMismatchWarning = exports.detectWorktreeIndexMismatch = exports.gitWorktreeRoot = exports.DEFAULT_SYNC_HOOKS = exports.isGitRepo = exports.isSyncHookInstalled = exports.removeGitSyncHook = exports.installGitSyncHook = exports.detectWsl = exports.watchDisabledReason = exports.LockUnavailableError = exports.FileWatcher = void 0;
18
+ var watcher_1 = require("./watcher");
19
+ Object.defineProperty(exports, "FileWatcher", { enumerable: true, get: function () { return watcher_1.FileWatcher; } });
20
+ Object.defineProperty(exports, "LockUnavailableError", { enumerable: true, get: function () { return watcher_1.LockUnavailableError; } });
21
+ var watch_policy_1 = require("./watch-policy");
22
+ Object.defineProperty(exports, "watchDisabledReason", { enumerable: true, get: function () { return watch_policy_1.watchDisabledReason; } });
23
+ Object.defineProperty(exports, "detectWsl", { enumerable: true, get: function () { return watch_policy_1.detectWsl; } });
24
+ var git_hooks_1 = require("./git-hooks");
25
+ Object.defineProperty(exports, "installGitSyncHook", { enumerable: true, get: function () { return git_hooks_1.installGitSyncHook; } });
26
+ Object.defineProperty(exports, "removeGitSyncHook", { enumerable: true, get: function () { return git_hooks_1.removeGitSyncHook; } });
27
+ Object.defineProperty(exports, "isSyncHookInstalled", { enumerable: true, get: function () { return git_hooks_1.isSyncHookInstalled; } });
28
+ Object.defineProperty(exports, "isGitRepo", { enumerable: true, get: function () { return git_hooks_1.isGitRepo; } });
29
+ Object.defineProperty(exports, "DEFAULT_SYNC_HOOKS", { enumerable: true, get: function () { return git_hooks_1.DEFAULT_SYNC_HOOKS; } });
30
+ var worktree_1 = require("./worktree");
31
+ Object.defineProperty(exports, "gitWorktreeRoot", { enumerable: true, get: function () { return worktree_1.gitWorktreeRoot; } });
32
+ Object.defineProperty(exports, "detectWorktreeIndexMismatch", { enumerable: true, get: function () { return worktree_1.detectWorktreeIndexMismatch; } });
33
+ Object.defineProperty(exports, "worktreeMismatchWarning", { enumerable: true, get: function () { return worktree_1.worktreeMismatchWarning; } });
34
+ Object.defineProperty(exports, "worktreeMismatchNotice", { enumerable: true, get: function () { return worktree_1.worktreeMismatchNotice; } });
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sync/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAEH,qCAAyF;AAAhF,sGAAA,WAAW,OAAA;AAA6B,+GAAA,oBAAoB,OAAA;AACrE,+CAAgE;AAAvD,mHAAA,mBAAmB,OAAA;AAAE,yGAAA,SAAS,OAAA;AACvC,yCAQqB;AAPnB,+GAAA,kBAAkB,OAAA;AAClB,8GAAA,iBAAiB,OAAA;AACjB,gHAAA,mBAAmB,OAAA;AACnB,sGAAA,SAAS,OAAA;AACT,+GAAA,kBAAkB,OAAA;AAIpB,uCAMoB;AALlB,2GAAA,eAAe,OAAA;AACf,uHAAA,2BAA2B,OAAA;AAC3B,mHAAA,uBAAuB,OAAA;AACvB,kHAAA,sBAAsB,OAAA"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Watch Policy
3
+ *
4
+ * Decides whether the live file watcher should run for a given project.
5
+ *
6
+ * Native recursive `fs.watch` is pathologically slow on WSL2 `/mnt/*`
7
+ * drives (NTFS exposed over the 9p/drvfs bridge): setting up the recursive
8
+ * watch walks the directory tree, and every readdir/stat crosses the
9
+ * Windows boundary. Inside an MCP server this stalls the event loop during
10
+ * startup long enough to blow past host handshake timeouts (opencode's 30s),
11
+ * so the tools never appear. See issue #199.
12
+ *
13
+ * This module centralizes the on/off decision so the watcher, the MCP
14
+ * server (for diagnostics), and the installer all agree.
15
+ */
16
+ /**
17
+ * Detect whether the current process is running under WSL (Windows
18
+ * Subsystem for Linux). Result is cached after the first call.
19
+ *
20
+ * Checks the WSL-specific env vars first (no I/O), then falls back to
21
+ * `/proc/version`, which contains "microsoft" on WSL kernels.
22
+ */
23
+ export declare function detectWsl(): boolean;
24
+ /**
25
+ * Inputs that can be overridden in tests so the decision is deterministic
26
+ * without touching real env vars or `/proc/version`.
27
+ */
28
+ export interface WatchProbe {
29
+ /** Defaults to `process.env`. */
30
+ env?: NodeJS.ProcessEnv;
31
+ /** Defaults to `detectWsl()`. */
32
+ isWsl?: boolean;
33
+ }
34
+ /**
35
+ * Decide whether the file watcher should be disabled for a project, and why.
36
+ *
37
+ * Returns a short human-readable reason when watching should be skipped, or
38
+ * `null` when it should run normally.
39
+ *
40
+ * Precedence (first match wins):
41
+ * 1. `CODEGRAPH_NO_WATCH=1` → off (explicit opt-out always wins)
42
+ * 2. `CODEGRAPH_FORCE_WATCH=1` → on (overrides auto-detection)
43
+ * 3. WSL2 + `/mnt/*` drive → off (recursive fs.watch is too slow; #199)
44
+ */
45
+ export declare function watchDisabledReason(projectRoot: string, probe?: WatchProbe): string | null;
46
+ /** Test-only: reset the cached WSL detection. */
47
+ export declare function __resetWslCacheForTests(): void;
48
+ //# sourceMappingURL=watch-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch-policy.d.ts","sourceRoot":"","sources":["../../src/sync/watch-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAQH;;;;;;GAMG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAmBnC;AAWD;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,iCAAiC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,iCAAiC;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,GAAE,UAAe,GAAG,MAAM,GAAG,IAAI,CAgB9F;AAED,iDAAiD;AACjD,wBAAgB,uBAAuB,IAAI,IAAI,CAG9C"}
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ /**
3
+ * Watch Policy
4
+ *
5
+ * Decides whether the live file watcher should run for a given project.
6
+ *
7
+ * Native recursive `fs.watch` is pathologically slow on WSL2 `/mnt/*`
8
+ * drives (NTFS exposed over the 9p/drvfs bridge): setting up the recursive
9
+ * watch walks the directory tree, and every readdir/stat crosses the
10
+ * Windows boundary. Inside an MCP server this stalls the event loop during
11
+ * startup long enough to blow past host handshake timeouts (opencode's 30s),
12
+ * so the tools never appear. See issue #199.
13
+ *
14
+ * This module centralizes the on/off decision so the watcher, the MCP
15
+ * server (for diagnostics), and the installer all agree.
16
+ */
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ var desc = Object.getOwnPropertyDescriptor(m, k);
20
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
+ desc = { enumerable: true, get: function() { return m[k]; } };
22
+ }
23
+ Object.defineProperty(o, k2, desc);
24
+ }) : (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ o[k2] = m[k];
27
+ }));
28
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
30
+ }) : function(o, v) {
31
+ o["default"] = v;
32
+ });
33
+ var __importStar = (this && this.__importStar) || (function () {
34
+ var ownKeys = function(o) {
35
+ ownKeys = Object.getOwnPropertyNames || function (o) {
36
+ var ar = [];
37
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
38
+ return ar;
39
+ };
40
+ return ownKeys(o);
41
+ };
42
+ return function (mod) {
43
+ if (mod && mod.__esModule) return mod;
44
+ var result = {};
45
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
46
+ __setModuleDefault(result, mod);
47
+ return result;
48
+ };
49
+ })();
50
+ Object.defineProperty(exports, "__esModule", { value: true });
51
+ exports.detectWsl = detectWsl;
52
+ exports.watchDisabledReason = watchDisabledReason;
53
+ exports.__resetWslCacheForTests = __resetWslCacheForTests;
54
+ const fs = __importStar(require("fs"));
55
+ const utils_1 = require("../utils");
56
+ let wslChecked = false;
57
+ let wslValue = false;
58
+ /**
59
+ * Detect whether the current process is running under WSL (Windows
60
+ * Subsystem for Linux). Result is cached after the first call.
61
+ *
62
+ * Checks the WSL-specific env vars first (no I/O), then falls back to
63
+ * `/proc/version`, which contains "microsoft" on WSL kernels.
64
+ */
65
+ function detectWsl() {
66
+ if (wslChecked)
67
+ return wslValue;
68
+ wslChecked = true;
69
+ if (process.platform !== 'linux') {
70
+ wslValue = false;
71
+ return wslValue;
72
+ }
73
+ if (process.env.WSL_DISTRO_NAME || process.env.WSL_INTEROP) {
74
+ wslValue = true;
75
+ return wslValue;
76
+ }
77
+ try {
78
+ const version = fs.readFileSync('/proc/version', 'utf8').toLowerCase();
79
+ wslValue = version.includes('microsoft') || version.includes('wsl');
80
+ }
81
+ catch {
82
+ wslValue = false;
83
+ }
84
+ return wslValue;
85
+ }
86
+ /**
87
+ * True for WSL Windows-drive mounts like `/mnt/c` or `/mnt/d/project`.
88
+ * Deliberately matches only single-letter drive mounts, so genuinely fast
89
+ * Linux mounts such as `/mnt/wsl/...` are not flagged.
90
+ */
91
+ function isWindowsDriveMount(projectRoot) {
92
+ return /^\/mnt\/[a-z](\/|$)/i.test((0, utils_1.normalizePath)(projectRoot));
93
+ }
94
+ /**
95
+ * Decide whether the file watcher should be disabled for a project, and why.
96
+ *
97
+ * Returns a short human-readable reason when watching should be skipped, or
98
+ * `null` when it should run normally.
99
+ *
100
+ * Precedence (first match wins):
101
+ * 1. `CODEGRAPH_NO_WATCH=1` → off (explicit opt-out always wins)
102
+ * 2. `CODEGRAPH_FORCE_WATCH=1` → on (overrides auto-detection)
103
+ * 3. WSL2 + `/mnt/*` drive → off (recursive fs.watch is too slow; #199)
104
+ */
105
+ function watchDisabledReason(projectRoot, probe = {}) {
106
+ const env = probe.env ?? process.env;
107
+ if (env.CODEGRAPH_NO_WATCH === '1') {
108
+ return 'CODEGRAPH_NO_WATCH=1 is set';
109
+ }
110
+ if (env.CODEGRAPH_FORCE_WATCH === '1') {
111
+ return null;
112
+ }
113
+ const isWsl = probe.isWsl ?? detectWsl();
114
+ if (isWsl && isWindowsDriveMount(projectRoot)) {
115
+ return 'project is on a WSL2 /mnt/ drive, where recursive fs.watch is too slow to be reliable';
116
+ }
117
+ return null;
118
+ }
119
+ /** Test-only: reset the cached WSL detection. */
120
+ function __resetWslCacheForTests() {
121
+ wslChecked = false;
122
+ wslValue = false;
123
+ }
124
+ //# sourceMappingURL=watch-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch-policy.js","sourceRoot":"","sources":["../../src/sync/watch-policy.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeH,8BAmBC;AAiCD,kDAgBC;AAGD,0DAGC;AAvFD,uCAAyB;AACzB,oCAAyC;AAEzC,IAAI,UAAU,GAAG,KAAK,CAAC;AACvB,IAAI,QAAQ,GAAG,KAAK,CAAC;AAErB;;;;;;GAMG;AACH,SAAgB,SAAS;IACvB,IAAI,UAAU;QAAE,OAAO,QAAQ,CAAC;IAChC,UAAU,GAAG,IAAI,CAAC;IAElB,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,QAAQ,GAA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,SAAgB,uBAAuB;IACrC,UAAU,GAAG,KAAK,CAAC;IACnB,QAAQ,GAAG,KAAK,CAAC;AACnB,CAAC"}
@@ -0,0 +1,191 @@
1
+ /**
2
+ * File Watcher
3
+ *
4
+ * Watches the project directory for file changes and triggers debounced sync
5
+ * operations to keep the code graph up-to-date.
6
+ *
7
+ * Uses chokidar, whose `ignored` callback filters directories BEFORE they are
8
+ * watched — so we never register inotify watches on excluded trees like
9
+ * node_modules/, dist/, .git/ (fixes #276: recursive fs.watch exhausted the
10
+ * kernel watch budget on large repos). The ignore decision reuses the indexer's
11
+ * `buildDefaultIgnore` (built-in default-ignore dirs + the project's .gitignore)
12
+ * so the watcher watches exactly the set the indexer indexes — in particular,
13
+ * node_modules/build/cache dirs are excluded even when the repo has no
14
+ * .gitignore (#407), which a .gitignore-only filter would miss.
15
+ */
16
+ /**
17
+ * Options for the file watcher
18
+ */
19
+ export interface WatchOptions {
20
+ /**
21
+ * Debounce delay in milliseconds.
22
+ * After the last file change, wait this long before triggering sync.
23
+ * Default: 2000ms
24
+ */
25
+ debounceMs?: number;
26
+ /**
27
+ * Callback when a sync completes (for logging/diagnostics).
28
+ */
29
+ onSyncComplete?: (result: {
30
+ filesChanged: number;
31
+ durationMs: number;
32
+ }) => void;
33
+ /**
34
+ * Callback when a sync errors (for logging/diagnostics).
35
+ */
36
+ onSyncError?: (error: Error) => void;
37
+ }
38
+ /**
39
+ * Thrown by a `syncFn` to signal that the underlying sync couldn't acquire
40
+ * the cross-process write lock (#449). The watcher treats this as "no
41
+ * progress" — preserves `pendingFiles`, skips `onSyncComplete`, and the
42
+ * `finally` block reschedules. Quiet (debug-only) because a long-running
43
+ * external indexer can hit this every debounce cycle.
44
+ */
45
+ export declare class LockUnavailableError extends Error {
46
+ constructor(message?: string);
47
+ }
48
+ /**
49
+ * Per-file pending entry — tracks a source file the watcher saw an event for
50
+ * but hasn't yet synced into the index. Exposed via {@link FileWatcher.getPendingFiles}
51
+ * so MCP tool responses can mark stale results without forcing a wait.
52
+ */
53
+ export interface PendingFile {
54
+ /** Project-relative POSIX path (e.g. "src/foo.ts"). */
55
+ path: string;
56
+ /** Wall-clock ms at the first event we saw for this path since the last sync. */
57
+ firstSeenMs: number;
58
+ /** Wall-clock ms at the most recent event we saw for this path. */
59
+ lastSeenMs: number;
60
+ /**
61
+ * True when a sync is currently in flight that began AFTER this file's most
62
+ * recent event — i.e. the next successful sync will pick it up. False when
63
+ * the file is still in the debounce window (no sync running yet).
64
+ */
65
+ indexing: boolean;
66
+ }
67
+ /**
68
+ * FileWatcher monitors a project directory for changes and triggers
69
+ * debounced sync operations via a provided callback.
70
+ *
71
+ * Design goals:
72
+ * - Minimal resource usage (chokidar filters excluded directories before
73
+ * registering an inotify watch — see module docs / #276)
74
+ * - Debounced to avoid thrashing on rapid saves
75
+ * - Filters to supported source files by extension
76
+ * - Ignores .codegraph/ and .git/ regardless of .gitignore
77
+ * - Tracks per-file pending state so MCP tools can flag stale results
78
+ * without blocking on a sync (issue #403)
79
+ */
80
+ export declare class FileWatcher {
81
+ private watcher;
82
+ private debounceTimer;
83
+ /**
84
+ * Files seen by the watcher since the last successful sync — populated on
85
+ * every chokidar event, cleared at the start of a sync, and re-populated by
86
+ * events that arrive mid-sync (or restored on sync failure). Keyed by the
87
+ * same project-relative POSIX path the rest of the codebase uses, so a
88
+ * caller can intersect tool-response file paths against this map cheaply.
89
+ */
90
+ private pendingFiles;
91
+ /**
92
+ * Wall-clock ms at which the in-flight sync began. Combined with
93
+ * {@link pendingFiles}'s `lastSeenMs`, this distinguishes "still in the
94
+ * debounce window" (lastSeen > syncStarted, sync hasn't started yet for
95
+ * this edit) from "currently being indexed" (lastSeen <= syncStarted).
96
+ */
97
+ private syncStartedMs;
98
+ private syncing;
99
+ private stopped;
100
+ /**
101
+ * False until chokidar fires its `ready` event. Gates `pendingFiles`
102
+ * insertion so the initial crawl's `add` events (one per pre-existing
103
+ * source file) don't pollute the per-file staleness signal. The events
104
+ * still flow into `scheduleSync()` to preserve the previous "initial
105
+ * scan triggers a reconciling sync" behavior.
106
+ */
107
+ private chokidarReady;
108
+ /**
109
+ * Callbacks that resolve when chokidar fires `ready`. Used by tests (and
110
+ * any production caller that cares about a clean baseline) to deterministically
111
+ * gate on the end of the initial scan instead of guessing at a sleep duration.
112
+ */
113
+ private readyWaiters;
114
+ private ignoreMatcher;
115
+ private readonly projectRoot;
116
+ private readonly debounceMs;
117
+ private readonly syncFn;
118
+ private readonly onSyncComplete?;
119
+ private readonly onSyncError?;
120
+ constructor(projectRoot: string, syncFn: () => Promise<{
121
+ filesChanged: number;
122
+ durationMs: number;
123
+ }>, options?: WatchOptions);
124
+ /**
125
+ * Start watching for file changes.
126
+ * Returns true if watching started successfully, false otherwise.
127
+ */
128
+ start(): boolean;
129
+ /** Our own dirs are always ignored, regardless of .gitignore. */
130
+ private isAlwaysIgnored;
131
+ /**
132
+ * chokidar `ignored` predicate — true for any path that should NOT be watched.
133
+ * Uses chokidar's provided `stats` to decide directory-vs-file so a dir-only
134
+ * rule like `build/` matches, without an extra `statSync` per path.
135
+ */
136
+ private shouldIgnore;
137
+ /**
138
+ * Stop watching for file changes.
139
+ */
140
+ stop(): void;
141
+ /**
142
+ * Whether the watcher is currently active.
143
+ */
144
+ isActive(): boolean;
145
+ /**
146
+ * Resolves once chokidar has fired its `ready` event (or immediately if
147
+ * it has already done so). Useful for tests that need a deterministic
148
+ * boundary before asserting on `pendingFiles` — guessing a sleep duration
149
+ * is flaky under load because chokidar can take longer than expected to
150
+ * finish its initial crawl on slow filesystems / parallel test runs.
151
+ *
152
+ * Production callers don't need this: `pendingFiles` is read continuously,
153
+ * the staleness banner is always correct (empty or populated), and the
154
+ * initial-scan window is a small one-time startup cost.
155
+ */
156
+ waitUntilReady(timeoutMs?: number): Promise<void>;
157
+ /**
158
+ * Schedule a debounced sync.
159
+ */
160
+ private scheduleSync;
161
+ /**
162
+ * Flush pending changes by running sync.
163
+ *
164
+ * pendingFiles is NOT cleared at the start of sync — entries are removed
165
+ * only after sync commits successfully, and only for entries whose
166
+ * lastSeenMs <= syncStartedMs. That way, a query that arrives mid-sync
167
+ * still sees the affected files marked stale (the DB hasn't been updated
168
+ * yet), and an event that lands mid-sync persists into the follow-up.
169
+ *
170
+ * On sync failure pendingFiles is left untouched — every edit is still
171
+ * unindexed, and the rescheduled sync will absorb the same set next time.
172
+ */
173
+ private flush;
174
+ /**
175
+ * Snapshot of files seen by the watcher since the last successful sync.
176
+ *
177
+ * Used by MCP tool responses to mark stale results without blocking on a
178
+ * sync: a tool that returns a hit in `src/foo.ts` while `src/foo.ts` is in
179
+ * this list tells the agent "Read this file directly, the index lags."
180
+ *
181
+ * `indexing` is true when a sync is currently in flight whose start time is
182
+ * AFTER this file's most recent event — i.e. that sync will absorb the
183
+ * edit. False means the file is still inside the debounce window and no
184
+ * sync has started yet (a follow-up call a few hundred ms later may show
185
+ * `indexing: true` or the file may have left the list entirely).
186
+ *
187
+ * Cheap: O(pendingFiles.size), no I/O, no locks.
188
+ */
189
+ getPendingFiles(): PendingFile[];
190
+ }
191
+ //# sourceMappingURL=watcher.d.ts.map