@colbymchenry/codegraph-win32-arm64 1.6.0 → 1.6.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 (622) hide show
  1. package/bin/codegraph +5 -0
  2. package/lib/dist/.test-build-engine.json +1 -0
  3. package/lib/dist/.test-build-viewer.json +1 -0
  4. package/lib/dist/bin/codegraph.d.ts +1 -0
  5. package/lib/dist/bin/codegraph.d.ts.map +1 -1
  6. package/lib/dist/bin/codegraph.js +599 -291
  7. package/lib/dist/bin/codegraph.js.map +1 -1
  8. package/lib/dist/bin/viewer-gate.d.ts +17 -0
  9. package/lib/dist/bin/viewer-gate.d.ts.map +1 -0
  10. package/lib/dist/bin/viewer-gate.js +31 -0
  11. package/lib/dist/bin/viewer-gate.js.map +1 -0
  12. package/lib/dist/context/index.d.ts.map +1 -1
  13. package/lib/dist/context/index.js +43 -2
  14. package/lib/dist/context/index.js.map +1 -1
  15. package/lib/dist/db/index.d.ts +21 -2
  16. package/lib/dist/db/index.d.ts.map +1 -1
  17. package/lib/dist/db/index.js +86 -31
  18. package/lib/dist/db/index.js.map +1 -1
  19. package/lib/dist/db/migrations.d.ts +1 -1
  20. package/lib/dist/db/migrations.d.ts.map +1 -1
  21. package/lib/dist/db/migrations.js +40 -1
  22. package/lib/dist/db/migrations.js.map +1 -1
  23. package/lib/dist/db/queries.d.ts +423 -3
  24. package/lib/dist/db/queries.d.ts.map +1 -1
  25. package/lib/dist/db/queries.js +1026 -33
  26. package/lib/dist/db/queries.js.map +1 -1
  27. package/lib/dist/db/schema.sql +11 -1
  28. package/lib/dist/db/sqlite-adapter.d.ts +2 -0
  29. package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
  30. package/lib/dist/db/sqlite-adapter.js +56 -7
  31. package/lib/dist/db/sqlite-adapter.js.map +1 -1
  32. package/lib/dist/db/synthesis-stage.d.ts +12 -0
  33. package/lib/dist/db/synthesis-stage.d.ts.map +1 -0
  34. package/lib/dist/db/synthesis-stage.js +89 -0
  35. package/lib/dist/db/synthesis-stage.js.map +1 -0
  36. package/lib/dist/db/wal-valve.d.ts +32 -12
  37. package/lib/dist/db/wal-valve.d.ts.map +1 -1
  38. package/lib/dist/db/wal-valve.js +65 -22
  39. package/lib/dist/db/wal-valve.js.map +1 -1
  40. package/lib/dist/db/wsl-shared-index.d.ts +53 -0
  41. package/lib/dist/db/wsl-shared-index.d.ts.map +1 -0
  42. package/lib/dist/db/wsl-shared-index.js +121 -0
  43. package/lib/dist/db/wsl-shared-index.js.map +1 -0
  44. package/lib/dist/directory.d.ts +101 -2
  45. package/lib/dist/directory.d.ts.map +1 -1
  46. package/lib/dist/directory.js +254 -23
  47. package/lib/dist/directory.js.map +1 -1
  48. package/lib/dist/errors.d.ts +14 -0
  49. package/lib/dist/errors.d.ts.map +1 -1
  50. package/lib/dist/errors.js +16 -1
  51. package/lib/dist/errors.js.map +1 -1
  52. package/lib/dist/extraction/cfml-extractor.d.ts +1 -0
  53. package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -1
  54. package/lib/dist/extraction/cfml-extractor.js +15 -3
  55. package/lib/dist/extraction/cfml-extractor.js.map +1 -1
  56. package/lib/dist/extraction/dfm-extractor.d.ts.map +1 -1
  57. package/lib/dist/extraction/dfm-extractor.js +14 -10
  58. package/lib/dist/extraction/dfm-extractor.js.map +1 -1
  59. package/lib/dist/extraction/extraction-version.d.ts +1 -1
  60. package/lib/dist/extraction/extraction-version.js +1 -1
  61. package/lib/dist/extraction/function-ref.d.ts +6 -4
  62. package/lib/dist/extraction/function-ref.d.ts.map +1 -1
  63. package/lib/dist/extraction/function-ref.js +35 -14
  64. package/lib/dist/extraction/function-ref.js.map +1 -1
  65. package/lib/dist/extraction/grammars.d.ts +38 -0
  66. package/lib/dist/extraction/grammars.d.ts.map +1 -1
  67. package/lib/dist/extraction/grammars.js +77 -1
  68. package/lib/dist/extraction/grammars.js.map +1 -1
  69. package/lib/dist/extraction/index.d.ts +113 -15
  70. package/lib/dist/extraction/index.d.ts.map +1 -1
  71. package/lib/dist/extraction/index.js +599 -132
  72. package/lib/dist/extraction/index.js.map +1 -1
  73. package/lib/dist/extraction/languages/c-cpp.d.ts +58 -0
  74. package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
  75. package/lib/dist/extraction/languages/c-cpp.js +291 -15
  76. package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
  77. package/lib/dist/extraction/languages/dart.d.ts.map +1 -1
  78. package/lib/dist/extraction/languages/dart.js +8 -3
  79. package/lib/dist/extraction/languages/dart.js.map +1 -1
  80. package/lib/dist/extraction/languages/javascript.js +1 -1
  81. package/lib/dist/extraction/languages/javascript.js.map +1 -1
  82. package/lib/dist/extraction/languages/kotlin.d.ts.map +1 -1
  83. package/lib/dist/extraction/languages/kotlin.js +169 -36
  84. package/lib/dist/extraction/languages/kotlin.js.map +1 -1
  85. package/lib/dist/extraction/languages/lua.d.ts.map +1 -1
  86. package/lib/dist/extraction/languages/lua.js +4 -1
  87. package/lib/dist/extraction/languages/lua.js.map +1 -1
  88. package/lib/dist/extraction/languages/python.d.ts.map +1 -1
  89. package/lib/dist/extraction/languages/python.js +71 -0
  90. package/lib/dist/extraction/languages/python.js.map +1 -1
  91. package/lib/dist/extraction/languages/rust.d.ts.map +1 -1
  92. package/lib/dist/extraction/languages/rust.js +3 -0
  93. package/lib/dist/extraction/languages/rust.js.map +1 -1
  94. package/lib/dist/extraction/languages/scala.d.ts.map +1 -1
  95. package/lib/dist/extraction/languages/scala.js +18 -3
  96. package/lib/dist/extraction/languages/scala.js.map +1 -1
  97. package/lib/dist/extraction/languages/typescript.d.ts.map +1 -1
  98. package/lib/dist/extraction/languages/typescript.js +9 -2
  99. package/lib/dist/extraction/languages/typescript.js.map +1 -1
  100. package/lib/dist/extraction/liquid-extractor.d.ts +18 -0
  101. package/lib/dist/extraction/liquid-extractor.d.ts.map +1 -1
  102. package/lib/dist/extraction/liquid-extractor.js +98 -22
  103. package/lib/dist/extraction/liquid-extractor.js.map +1 -1
  104. package/lib/dist/extraction/mybatis-extractor.d.ts.map +1 -1
  105. package/lib/dist/extraction/mybatis-extractor.js +6 -4
  106. package/lib/dist/extraction/mybatis-extractor.js.map +1 -1
  107. package/lib/dist/extraction/syntax-tokens.d.ts +103 -0
  108. package/lib/dist/extraction/syntax-tokens.d.ts.map +1 -0
  109. package/lib/dist/extraction/syntax-tokens.js +381 -0
  110. package/lib/dist/extraction/syntax-tokens.js.map +1 -0
  111. package/lib/dist/extraction/tree-sitter-helpers.d.ts +5 -0
  112. package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
  113. package/lib/dist/extraction/tree-sitter-helpers.js +17 -0
  114. package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
  115. package/lib/dist/extraction/tree-sitter-types.d.ts +29 -3
  116. package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
  117. package/lib/dist/extraction/tree-sitter.d.ts +96 -17
  118. package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
  119. package/lib/dist/extraction/tree-sitter.js +820 -82
  120. package/lib/dist/extraction/tree-sitter.js.map +1 -1
  121. package/lib/dist/extraction/wasm/tree-sitter-scala.wasm +0 -0
  122. package/lib/dist/file-limits.d.ts +40 -0
  123. package/lib/dist/file-limits.d.ts.map +1 -0
  124. package/lib/dist/file-limits.js +147 -0
  125. package/lib/dist/file-limits.js.map +1 -0
  126. package/lib/dist/graph/branch-guards.d.ts +248 -0
  127. package/lib/dist/graph/branch-guards.d.ts.map +1 -0
  128. package/lib/dist/graph/branch-guards.js +2231 -0
  129. package/lib/dist/graph/branch-guards.js.map +1 -0
  130. package/lib/dist/graph/dead-code.d.ts +251 -0
  131. package/lib/dist/graph/dead-code.d.ts.map +1 -0
  132. package/lib/dist/graph/dead-code.js +776 -0
  133. package/lib/dist/graph/dead-code.js.map +1 -0
  134. package/lib/dist/graph/dynamic-boundary-report.d.ts +121 -0
  135. package/lib/dist/graph/dynamic-boundary-report.d.ts.map +1 -0
  136. package/lib/dist/graph/dynamic-boundary-report.js +283 -0
  137. package/lib/dist/graph/dynamic-boundary-report.js.map +1 -0
  138. package/lib/dist/graph/index.d.ts +4 -0
  139. package/lib/dist/graph/index.d.ts.map +1 -1
  140. package/lib/dist/graph/index.js +16 -1
  141. package/lib/dist/graph/index.js.map +1 -1
  142. package/lib/dist/graph/named-symbol-flow.d.ts +125 -0
  143. package/lib/dist/graph/named-symbol-flow.d.ts.map +1 -0
  144. package/lib/dist/graph/named-symbol-flow.js +552 -0
  145. package/lib/dist/graph/named-symbol-flow.js.map +1 -0
  146. package/lib/dist/graph/symbol-lookup.d.ts +83 -0
  147. package/lib/dist/graph/symbol-lookup.d.ts.map +1 -0
  148. package/lib/dist/graph/symbol-lookup.js +181 -0
  149. package/lib/dist/graph/symbol-lookup.js.map +1 -0
  150. package/lib/dist/graph/traversal.d.ts +9 -0
  151. package/lib/dist/graph/traversal.d.ts.map +1 -1
  152. package/lib/dist/graph/traversal.js +61 -35
  153. package/lib/dist/graph/traversal.js.map +1 -1
  154. package/lib/dist/graph/type-hierarchy.d.ts +155 -0
  155. package/lib/dist/graph/type-hierarchy.d.ts.map +1 -0
  156. package/lib/dist/graph/type-hierarchy.js +382 -0
  157. package/lib/dist/graph/type-hierarchy.js.map +1 -0
  158. package/lib/dist/index.d.ts +251 -11
  159. package/lib/dist/index.d.ts.map +1 -1
  160. package/lib/dist/index.js +395 -34
  161. package/lib/dist/index.js.map +1 -1
  162. package/lib/dist/installer/index.d.ts.map +1 -1
  163. package/lib/dist/installer/index.js +3 -2
  164. package/lib/dist/installer/index.js.map +1 -1
  165. package/lib/dist/installer/targets/antigravity.d.ts.map +1 -1
  166. package/lib/dist/installer/targets/antigravity.js +14 -2
  167. package/lib/dist/installer/targets/antigravity.js.map +1 -1
  168. package/lib/dist/installer/targets/claude.d.ts +3 -0
  169. package/lib/dist/installer/targets/claude.d.ts.map +1 -1
  170. package/lib/dist/installer/targets/claude.js +35 -7
  171. package/lib/dist/installer/targets/claude.js.map +1 -1
  172. package/lib/dist/installer/targets/codex.d.ts +2 -1
  173. package/lib/dist/installer/targets/codex.d.ts.map +1 -1
  174. package/lib/dist/installer/targets/codex.js +14 -4
  175. package/lib/dist/installer/targets/codex.js.map +1 -1
  176. package/lib/dist/installer/targets/copilot-cli.d.ts.map +1 -1
  177. package/lib/dist/installer/targets/copilot-cli.js +7 -1
  178. package/lib/dist/installer/targets/copilot-cli.js.map +1 -1
  179. package/lib/dist/installer/targets/opencode.d.ts +16 -5
  180. package/lib/dist/installer/targets/opencode.d.ts.map +1 -1
  181. package/lib/dist/installer/targets/opencode.js +73 -22
  182. package/lib/dist/installer/targets/opencode.js.map +1 -1
  183. package/lib/dist/installer/targets/shared.d.ts +14 -3
  184. package/lib/dist/installer/targets/shared.d.ts.map +1 -1
  185. package/lib/dist/installer/targets/shared.js +39 -11
  186. package/lib/dist/installer/targets/shared.js.map +1 -1
  187. package/lib/dist/installer/targets/types.d.ts +7 -0
  188. package/lib/dist/installer/targets/types.d.ts.map +1 -1
  189. package/lib/dist/mcp/answer-freshness.d.ts +10 -0
  190. package/lib/dist/mcp/answer-freshness.d.ts.map +1 -0
  191. package/lib/dist/mcp/answer-freshness.js +68 -0
  192. package/lib/dist/mcp/answer-freshness.js.map +1 -0
  193. package/lib/dist/mcp/daemon-manager.d.ts.map +1 -1
  194. package/lib/dist/mcp/daemon-manager.js +16 -0
  195. package/lib/dist/mcp/daemon-manager.js.map +1 -1
  196. package/lib/dist/mcp/daemon-paths.d.ts +2 -0
  197. package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
  198. package/lib/dist/mcp/daemon-paths.js +12 -3
  199. package/lib/dist/mcp/daemon-paths.js.map +1 -1
  200. package/lib/dist/mcp/daemon-registry.d.ts +7 -4
  201. package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
  202. package/lib/dist/mcp/daemon-registry.js +91 -29
  203. package/lib/dist/mcp/daemon-registry.js.map +1 -1
  204. package/lib/dist/mcp/daemon.d.ts +17 -7
  205. package/lib/dist/mcp/daemon.d.ts.map +1 -1
  206. package/lib/dist/mcp/daemon.js +116 -24
  207. package/lib/dist/mcp/daemon.js.map +1 -1
  208. package/lib/dist/mcp/dynamic-boundaries.d.ts +1 -10
  209. package/lib/dist/mcp/dynamic-boundaries.d.ts.map +1 -1
  210. package/lib/dist/mcp/dynamic-boundaries.js +46 -42
  211. package/lib/dist/mcp/dynamic-boundaries.js.map +1 -1
  212. package/lib/dist/mcp/engine.d.ts +28 -9
  213. package/lib/dist/mcp/engine.d.ts.map +1 -1
  214. package/lib/dist/mcp/engine.js +146 -62
  215. package/lib/dist/mcp/engine.js.map +1 -1
  216. package/lib/dist/mcp/explore-dedup.d.ts +5 -2
  217. package/lib/dist/mcp/explore-dedup.d.ts.map +1 -1
  218. package/lib/dist/mcp/explore-dedup.js +8 -5
  219. package/lib/dist/mcp/explore-dedup.js.map +1 -1
  220. package/lib/dist/mcp/index-freshness-worker.d.ts +2 -0
  221. package/lib/dist/mcp/index-freshness-worker.d.ts.map +1 -0
  222. package/lib/dist/mcp/index-freshness-worker.js +30 -0
  223. package/lib/dist/mcp/index-freshness-worker.js.map +1 -0
  224. package/lib/dist/mcp/index-freshness.d.ts +7 -0
  225. package/lib/dist/mcp/index-freshness.d.ts.map +1 -0
  226. package/lib/dist/mcp/index-freshness.js +94 -0
  227. package/lib/dist/mcp/index-freshness.js.map +1 -0
  228. package/lib/dist/mcp/index.d.ts +3 -1
  229. package/lib/dist/mcp/index.d.ts.map +1 -1
  230. package/lib/dist/mcp/index.js +95 -11
  231. package/lib/dist/mcp/index.js.map +1 -1
  232. package/lib/dist/mcp/liveness-watchdog.d.ts +4 -1
  233. package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
  234. package/lib/dist/mcp/liveness-watchdog.js +11 -2
  235. package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
  236. package/lib/dist/mcp/project-lifecycle.d.ts +9 -0
  237. package/lib/dist/mcp/project-lifecycle.d.ts.map +1 -0
  238. package/lib/dist/mcp/project-lifecycle.js +181 -0
  239. package/lib/dist/mcp/project-lifecycle.js.map +1 -0
  240. package/lib/dist/mcp/proxy.d.ts.map +1 -1
  241. package/lib/dist/mcp/proxy.js +9 -0
  242. package/lib/dist/mcp/proxy.js.map +1 -1
  243. package/lib/dist/mcp/query-pool.d.ts +2 -2
  244. package/lib/dist/mcp/query-pool.d.ts.map +1 -1
  245. package/lib/dist/mcp/query-pool.js +9 -7
  246. package/lib/dist/mcp/query-pool.js.map +1 -1
  247. package/lib/dist/mcp/query-worker.js +2 -2
  248. package/lib/dist/mcp/query-worker.js.map +1 -1
  249. package/lib/dist/mcp/server-instructions.d.ts +1 -1
  250. package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
  251. package/lib/dist/mcp/server-instructions.js +6 -3
  252. package/lib/dist/mcp/server-instructions.js.map +1 -1
  253. package/lib/dist/mcp/startup-handshake.d.ts +3 -1
  254. package/lib/dist/mcp/startup-handshake.d.ts.map +1 -1
  255. package/lib/dist/mcp/startup-handshake.js +10 -2
  256. package/lib/dist/mcp/startup-handshake.js.map +1 -1
  257. package/lib/dist/mcp/tools.d.ts +276 -36
  258. package/lib/dist/mcp/tools.d.ts.map +1 -1
  259. package/lib/dist/mcp/tools.js +2295 -980
  260. package/lib/dist/mcp/tools.js.map +1 -1
  261. package/lib/dist/mcp/writer-lock.d.ts +61 -0
  262. package/lib/dist/mcp/writer-lock.d.ts.map +1 -0
  263. package/lib/dist/mcp/writer-lock.js +260 -0
  264. package/lib/dist/mcp/writer-lock.js.map +1 -0
  265. package/lib/dist/resolution/alias-binding.d.ts +56 -0
  266. package/lib/dist/resolution/alias-binding.d.ts.map +1 -0
  267. package/lib/dist/resolution/alias-binding.js +127 -0
  268. package/lib/dist/resolution/alias-binding.js.map +1 -0
  269. package/lib/dist/resolution/callback-synthesizer.d.ts +23 -1
  270. package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
  271. package/lib/dist/resolution/callback-synthesizer.js +291 -143
  272. package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
  273. package/lib/dist/resolution/cpp-constructor.d.ts +4 -0
  274. package/lib/dist/resolution/cpp-constructor.d.ts.map +1 -0
  275. package/lib/dist/resolution/cpp-constructor.js +123 -0
  276. package/lib/dist/resolution/cpp-constructor.js.map +1 -0
  277. package/lib/dist/resolution/cpp-macro-visibility.d.ts +12 -0
  278. package/lib/dist/resolution/cpp-macro-visibility.d.ts.map +1 -0
  279. package/lib/dist/resolution/cpp-macro-visibility.js +342 -0
  280. package/lib/dist/resolution/cpp-macro-visibility.js.map +1 -0
  281. package/lib/dist/resolution/expo-router-synthesizer.d.ts +32 -0
  282. package/lib/dist/resolution/expo-router-synthesizer.d.ts.map +1 -0
  283. package/lib/dist/resolution/expo-router-synthesizer.js +189 -0
  284. package/lib/dist/resolution/expo-router-synthesizer.js.map +1 -0
  285. package/lib/dist/resolution/frameworks/csharp.d.ts.map +1 -1
  286. package/lib/dist/resolution/frameworks/csharp.js +96 -2
  287. package/lib/dist/resolution/frameworks/csharp.js.map +1 -1
  288. package/lib/dist/resolution/frameworks/expo-router.d.ts +189 -0
  289. package/lib/dist/resolution/frameworks/expo-router.d.ts.map +1 -0
  290. package/lib/dist/resolution/frameworks/expo-router.js +785 -0
  291. package/lib/dist/resolution/frameworks/expo-router.js.map +1 -0
  292. package/lib/dist/resolution/frameworks/express.d.ts.map +1 -1
  293. package/lib/dist/resolution/frameworks/express.js +251 -16
  294. package/lib/dist/resolution/frameworks/express.js.map +1 -1
  295. package/lib/dist/resolution/frameworks/index.d.ts +5 -0
  296. package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
  297. package/lib/dist/resolution/frameworks/index.js +29 -1
  298. package/lib/dist/resolution/frameworks/index.js.map +1 -1
  299. package/lib/dist/resolution/frameworks/java.d.ts.map +1 -1
  300. package/lib/dist/resolution/frameworks/java.js +79 -47
  301. package/lib/dist/resolution/frameworks/java.js.map +1 -1
  302. package/lib/dist/resolution/frameworks/nestjs.d.ts.map +1 -1
  303. package/lib/dist/resolution/frameworks/nestjs.js +6 -14
  304. package/lib/dist/resolution/frameworks/nestjs.js.map +1 -1
  305. package/lib/dist/resolution/frameworks/nextjs.d.ts +76 -0
  306. package/lib/dist/resolution/frameworks/nextjs.d.ts.map +1 -0
  307. package/lib/dist/resolution/frameworks/nextjs.js +328 -0
  308. package/lib/dist/resolution/frameworks/nextjs.js.map +1 -0
  309. package/lib/dist/resolution/frameworks/object-literal.d.ts +32 -0
  310. package/lib/dist/resolution/frameworks/object-literal.d.ts.map +1 -0
  311. package/lib/dist/resolution/frameworks/object-literal.js +139 -0
  312. package/lib/dist/resolution/frameworks/object-literal.js.map +1 -0
  313. package/lib/dist/resolution/frameworks/package-deps.d.ts +14 -0
  314. package/lib/dist/resolution/frameworks/package-deps.d.ts.map +1 -0
  315. package/lib/dist/resolution/frameworks/package-deps.js +78 -0
  316. package/lib/dist/resolution/frameworks/package-deps.js.map +1 -0
  317. package/lib/dist/resolution/frameworks/python.d.ts.map +1 -1
  318. package/lib/dist/resolution/frameworks/python.js +166 -0
  319. package/lib/dist/resolution/frameworks/python.js.map +1 -1
  320. package/lib/dist/resolution/frameworks/react-native.d.ts +26 -0
  321. package/lib/dist/resolution/frameworks/react-native.d.ts.map +1 -1
  322. package/lib/dist/resolution/frameworks/react-native.js +153 -14
  323. package/lib/dist/resolution/frameworks/react-native.js.map +1 -1
  324. package/lib/dist/resolution/frameworks/react-router.d.ts +46 -0
  325. package/lib/dist/resolution/frameworks/react-router.d.ts.map +1 -0
  326. package/lib/dist/resolution/frameworks/react-router.js +187 -0
  327. package/lib/dist/resolution/frameworks/react-router.js.map +1 -0
  328. package/lib/dist/resolution/frameworks/react.d.ts +2 -1
  329. package/lib/dist/resolution/frameworks/react.d.ts.map +1 -1
  330. package/lib/dist/resolution/frameworks/react.js +188 -139
  331. package/lib/dist/resolution/frameworks/react.js.map +1 -1
  332. package/lib/dist/resolution/frameworks/svelte.d.ts.map +1 -1
  333. package/lib/dist/resolution/frameworks/svelte.js +6 -1
  334. package/lib/dist/resolution/frameworks/svelte.js.map +1 -1
  335. package/lib/dist/resolution/frameworks/sveltekit-router.d.ts +36 -0
  336. package/lib/dist/resolution/frameworks/sveltekit-router.d.ts.map +1 -0
  337. package/lib/dist/resolution/frameworks/sveltekit-router.js +156 -0
  338. package/lib/dist/resolution/frameworks/sveltekit-router.js.map +1 -0
  339. package/lib/dist/resolution/frameworks/tanstack-router.d.ts +84 -0
  340. package/lib/dist/resolution/frameworks/tanstack-router.d.ts.map +1 -0
  341. package/lib/dist/resolution/frameworks/tanstack-router.js +437 -0
  342. package/lib/dist/resolution/frameworks/tanstack-router.js.map +1 -0
  343. package/lib/dist/resolution/frameworks/vue-router.d.ts +82 -0
  344. package/lib/dist/resolution/frameworks/vue-router.d.ts.map +1 -0
  345. package/lib/dist/resolution/frameworks/vue-router.js +377 -0
  346. package/lib/dist/resolution/frameworks/vue-router.js.map +1 -0
  347. package/lib/dist/resolution/import-resolver.d.ts +38 -0
  348. package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
  349. package/lib/dist/resolution/import-resolver.js +376 -26
  350. package/lib/dist/resolution/import-resolver.js.map +1 -1
  351. package/lib/dist/resolution/index.d.ts +89 -25
  352. package/lib/dist/resolution/index.d.ts.map +1 -1
  353. package/lib/dist/resolution/index.js +552 -145
  354. package/lib/dist/resolution/index.js.map +1 -1
  355. package/lib/dist/resolution/js-builtins.d.ts +13 -0
  356. package/lib/dist/resolution/js-builtins.d.ts.map +1 -0
  357. package/lib/dist/resolution/js-builtins.js +46 -0
  358. package/lib/dist/resolution/js-builtins.js.map +1 -0
  359. package/lib/dist/resolution/name-matcher.d.ts +69 -22
  360. package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
  361. package/lib/dist/resolution/name-matcher.js +1902 -87
  362. package/lib/dist/resolution/name-matcher.js.map +1 -1
  363. package/lib/dist/resolution/next-router-synthesizer.d.ts +27 -0
  364. package/lib/dist/resolution/next-router-synthesizer.d.ts.map +1 -0
  365. package/lib/dist/resolution/next-router-synthesizer.js +113 -0
  366. package/lib/dist/resolution/next-router-synthesizer.js.map +1 -0
  367. package/lib/dist/resolution/react-router-synthesizer.d.ts +33 -0
  368. package/lib/dist/resolution/react-router-synthesizer.d.ts.map +1 -0
  369. package/lib/dist/resolution/react-router-synthesizer.js +126 -0
  370. package/lib/dist/resolution/react-router-synthesizer.js.map +1 -0
  371. package/lib/dist/resolution/resolver-pool.d.ts +2 -0
  372. package/lib/dist/resolution/resolver-pool.d.ts.map +1 -1
  373. package/lib/dist/resolution/resolver-pool.js +4 -0
  374. package/lib/dist/resolution/resolver-pool.js.map +1 -1
  375. package/lib/dist/resolution/strip-comments.d.ts +6 -0
  376. package/lib/dist/resolution/strip-comments.d.ts.map +1 -1
  377. package/lib/dist/resolution/strip-comments.js +58 -0
  378. package/lib/dist/resolution/strip-comments.js.map +1 -1
  379. package/lib/dist/resolution/sveltekit-synthesizer.d.ts +58 -0
  380. package/lib/dist/resolution/sveltekit-synthesizer.d.ts.map +1 -0
  381. package/lib/dist/resolution/sveltekit-synthesizer.js +173 -0
  382. package/lib/dist/resolution/sveltekit-synthesizer.js.map +1 -0
  383. package/lib/dist/resolution/synth-utils.d.ts +26 -0
  384. package/lib/dist/resolution/synth-utils.d.ts.map +1 -0
  385. package/lib/dist/resolution/synth-utils.js +75 -0
  386. package/lib/dist/resolution/synth-utils.js.map +1 -0
  387. package/lib/dist/resolution/tanstack-router-synthesizer.d.ts +31 -0
  388. package/lib/dist/resolution/tanstack-router-synthesizer.d.ts.map +1 -0
  389. package/lib/dist/resolution/tanstack-router-synthesizer.js +114 -0
  390. package/lib/dist/resolution/tanstack-router-synthesizer.js.map +1 -0
  391. package/lib/dist/resolution/tier-synthesizer.d.ts +49 -0
  392. package/lib/dist/resolution/tier-synthesizer.d.ts.map +1 -0
  393. package/lib/dist/resolution/tier-synthesizer.js +931 -0
  394. package/lib/dist/resolution/tier-synthesizer.js.map +1 -0
  395. package/lib/dist/resolution/types.d.ts +78 -2
  396. package/lib/dist/resolution/types.d.ts.map +1 -1
  397. package/lib/dist/resolution/types.js +64 -0
  398. package/lib/dist/resolution/types.js.map +1 -1
  399. package/lib/dist/resolution/vue-router-synthesizer.d.ts +30 -0
  400. package/lib/dist/resolution/vue-router-synthesizer.d.ts.map +1 -0
  401. package/lib/dist/resolution/vue-router-synthesizer.js +115 -0
  402. package/lib/dist/resolution/vue-router-synthesizer.js.map +1 -0
  403. package/lib/dist/search/query-paths.d.ts +50 -1
  404. package/lib/dist/search/query-paths.d.ts.map +1 -1
  405. package/lib/dist/search/query-paths.js +227 -12
  406. package/lib/dist/search/query-paths.js.map +1 -1
  407. package/lib/dist/search/query-utils.d.ts +15 -0
  408. package/lib/dist/search/query-utils.d.ts.map +1 -1
  409. package/lib/dist/search/query-utils.js +35 -7
  410. package/lib/dist/search/query-utils.js.map +1 -1
  411. package/lib/dist/sync/watch-policy.d.ts +14 -0
  412. package/lib/dist/sync/watch-policy.d.ts.map +1 -1
  413. package/lib/dist/sync/watch-policy.js +19 -0
  414. package/lib/dist/sync/watch-policy.js.map +1 -1
  415. package/lib/dist/sync/watcher.d.ts +52 -35
  416. package/lib/dist/sync/watcher.d.ts.map +1 -1
  417. package/lib/dist/sync/watcher.js +236 -100
  418. package/lib/dist/sync/watcher.js.map +1 -1
  419. package/lib/dist/telemetry/index.d.ts +4 -2
  420. package/lib/dist/telemetry/index.d.ts.map +1 -1
  421. package/lib/dist/telemetry/index.js +92 -41
  422. package/lib/dist/telemetry/index.js.map +1 -1
  423. package/lib/dist/types.d.ts +1 -1
  424. package/lib/dist/types.d.ts.map +1 -1
  425. package/lib/dist/types.js +1 -0
  426. package/lib/dist/types.js.map +1 -1
  427. package/lib/dist/ui-server/api/deadcode.d.ts +84 -0
  428. package/lib/dist/ui-server/api/deadcode.d.ts.map +1 -0
  429. package/lib/dist/ui-server/api/deadcode.js +136 -0
  430. package/lib/dist/ui-server/api/deadcode.js.map +1 -0
  431. package/lib/dist/ui-server/api/effects.d.ts +87 -0
  432. package/lib/dist/ui-server/api/effects.d.ts.map +1 -0
  433. package/lib/dist/ui-server/api/effects.js +499 -0
  434. package/lib/dist/ui-server/api/effects.js.map +1 -0
  435. package/lib/dist/ui-server/api/entrypoints.d.ts +86 -0
  436. package/lib/dist/ui-server/api/entrypoints.d.ts.map +1 -0
  437. package/lib/dist/ui-server/api/entrypoints.js +279 -0
  438. package/lib/dist/ui-server/api/entrypoints.js.map +1 -0
  439. package/lib/dist/ui-server/api/events.d.ts +183 -0
  440. package/lib/dist/ui-server/api/events.d.ts.map +1 -0
  441. package/lib/dist/ui-server/api/events.js +430 -0
  442. package/lib/dist/ui-server/api/events.js.map +1 -0
  443. package/lib/dist/ui-server/api/file.d.ts +66 -0
  444. package/lib/dist/ui-server/api/file.d.ts.map +1 -0
  445. package/lib/dist/ui-server/api/file.js +235 -0
  446. package/lib/dist/ui-server/api/file.js.map +1 -0
  447. package/lib/dist/ui-server/api/filecode.d.ts +126 -0
  448. package/lib/dist/ui-server/api/filecode.d.ts.map +1 -0
  449. package/lib/dist/ui-server/api/filecode.js +205 -0
  450. package/lib/dist/ui-server/api/filecode.js.map +1 -0
  451. package/lib/dist/ui-server/api/flow.d.ts +226 -0
  452. package/lib/dist/ui-server/api/flow.d.ts.map +1 -0
  453. package/lib/dist/ui-server/api/flow.js +612 -0
  454. package/lib/dist/ui-server/api/flow.js.map +1 -0
  455. package/lib/dist/ui-server/api/hierarchy.d.ts +81 -0
  456. package/lib/dist/ui-server/api/hierarchy.d.ts.map +1 -0
  457. package/lib/dist/ui-server/api/hierarchy.js +92 -0
  458. package/lib/dist/ui-server/api/hierarchy.js.map +1 -0
  459. package/lib/dist/ui-server/api/index.d.ts +90 -0
  460. package/lib/dist/ui-server/api/index.d.ts.map +1 -0
  461. package/lib/dist/ui-server/api/index.js +332 -0
  462. package/lib/dist/ui-server/api/index.js.map +1 -0
  463. package/lib/dist/ui-server/api/map.d.ts +238 -0
  464. package/lib/dist/ui-server/api/map.d.ts.map +1 -0
  465. package/lib/dist/ui-server/api/map.js +681 -0
  466. package/lib/dist/ui-server/api/map.js.map +1 -0
  467. package/lib/dist/ui-server/api/node.d.ts +81 -0
  468. package/lib/dist/ui-server/api/node.d.ts.map +1 -0
  469. package/lib/dist/ui-server/api/node.js +388 -0
  470. package/lib/dist/ui-server/api/node.js.map +1 -0
  471. package/lib/dist/ui-server/api/nodes.d.ts +25 -0
  472. package/lib/dist/ui-server/api/nodes.d.ts.map +1 -0
  473. package/lib/dist/ui-server/api/nodes.js +45 -0
  474. package/lib/dist/ui-server/api/nodes.js.map +1 -0
  475. package/lib/dist/ui-server/api/program.d.ts +139 -0
  476. package/lib/dist/ui-server/api/program.d.ts.map +1 -0
  477. package/lib/dist/ui-server/api/program.js +315 -0
  478. package/lib/dist/ui-server/api/program.js.map +1 -0
  479. package/lib/dist/ui-server/api/respond.d.ts +76 -0
  480. package/lib/dist/ui-server/api/respond.d.ts.map +1 -0
  481. package/lib/dist/ui-server/api/respond.js +186 -0
  482. package/lib/dist/ui-server/api/respond.js.map +1 -0
  483. package/lib/dist/ui-server/api/route-roots.d.ts +39 -0
  484. package/lib/dist/ui-server/api/route-roots.d.ts.map +1 -0
  485. package/lib/dist/ui-server/api/route-roots.js +96 -0
  486. package/lib/dist/ui-server/api/route-roots.js.map +1 -0
  487. package/lib/dist/ui-server/api/routes.d.ts +59 -0
  488. package/lib/dist/ui-server/api/routes.d.ts.map +1 -0
  489. package/lib/dist/ui-server/api/routes.js +108 -0
  490. package/lib/dist/ui-server/api/routes.js.map +1 -0
  491. package/lib/dist/ui-server/api/screens.d.ts +117 -0
  492. package/lib/dist/ui-server/api/screens.d.ts.map +1 -0
  493. package/lib/dist/ui-server/api/screens.js +611 -0
  494. package/lib/dist/ui-server/api/screens.js.map +1 -0
  495. package/lib/dist/ui-server/api/search.d.ts +29 -0
  496. package/lib/dist/ui-server/api/search.d.ts.map +1 -0
  497. package/lib/dist/ui-server/api/search.js +232 -0
  498. package/lib/dist/ui-server/api/search.js.map +1 -0
  499. package/lib/dist/ui-server/api/session.d.ts +52 -0
  500. package/lib/dist/ui-server/api/session.d.ts.map +1 -0
  501. package/lib/dist/ui-server/api/session.js +196 -0
  502. package/lib/dist/ui-server/api/session.js.map +1 -0
  503. package/lib/dist/ui-server/api/source.d.ts +200 -0
  504. package/lib/dist/ui-server/api/source.d.ts.map +1 -0
  505. package/lib/dist/ui-server/api/source.js +422 -0
  506. package/lib/dist/ui-server/api/source.js.map +1 -0
  507. package/lib/dist/ui-server/api/stats.d.ts +27 -0
  508. package/lib/dist/ui-server/api/stats.d.ts.map +1 -0
  509. package/lib/dist/ui-server/api/stats.js +164 -0
  510. package/lib/dist/ui-server/api/stats.js.map +1 -0
  511. package/lib/dist/ui-server/api/steps.d.ts +274 -0
  512. package/lib/dist/ui-server/api/steps.d.ts.map +1 -0
  513. package/lib/dist/ui-server/api/steps.js +1446 -0
  514. package/lib/dist/ui-server/api/steps.js.map +1 -0
  515. package/lib/dist/ui-server/api/trail-store.d.ts +142 -0
  516. package/lib/dist/ui-server/api/trail-store.d.ts.map +1 -0
  517. package/lib/dist/ui-server/api/trail-store.js +323 -0
  518. package/lib/dist/ui-server/api/trail-store.js.map +1 -0
  519. package/lib/dist/ui-server/api/trails.d.ts +163 -0
  520. package/lib/dist/ui-server/api/trails.d.ts.map +1 -0
  521. package/lib/dist/ui-server/api/trails.js +369 -0
  522. package/lib/dist/ui-server/api/trails.js.map +1 -0
  523. package/lib/dist/ui-server/api/when.d.ts +125 -0
  524. package/lib/dist/ui-server/api/when.d.ts.map +1 -0
  525. package/lib/dist/ui-server/api/when.js +251 -0
  526. package/lib/dist/ui-server/api/when.js.map +1 -0
  527. package/lib/dist/ui-server/api/wire.d.ts +179 -0
  528. package/lib/dist/ui-server/api/wire.d.ts.map +1 -0
  529. package/lib/dist/ui-server/api/wire.js +231 -0
  530. package/lib/dist/ui-server/api/wire.js.map +1 -0
  531. package/lib/dist/ui-server/assets.d.ts +40 -0
  532. package/lib/dist/ui-server/assets.d.ts.map +1 -0
  533. package/lib/dist/ui-server/assets.js +110 -0
  534. package/lib/dist/ui-server/assets.js.map +1 -0
  535. package/lib/dist/ui-server/constants.d.ts +32 -0
  536. package/lib/dist/ui-server/constants.d.ts.map +1 -0
  537. package/lib/dist/ui-server/constants.js +35 -0
  538. package/lib/dist/ui-server/constants.js.map +1 -0
  539. package/lib/dist/ui-server/highlight/index.d.ts +113 -0
  540. package/lib/dist/ui-server/highlight/index.d.ts.map +1 -0
  541. package/lib/dist/ui-server/highlight/index.js +307 -0
  542. package/lib/dist/ui-server/highlight/index.js.map +1 -0
  543. package/lib/dist/ui-server/highlight/languages.d.ts +36 -0
  544. package/lib/dist/ui-server/highlight/languages.d.ts.map +1 -0
  545. package/lib/dist/ui-server/highlight/languages.js +50 -0
  546. package/lib/dist/ui-server/highlight/languages.js.map +1 -0
  547. package/lib/dist/ui-server/index.d.ts +92 -0
  548. package/lib/dist/ui-server/index.d.ts.map +1 -0
  549. package/lib/dist/ui-server/index.js +399 -0
  550. package/lib/dist/ui-server/index.js.map +1 -0
  551. package/lib/dist/ui-server/open-browser.d.ts +31 -0
  552. package/lib/dist/ui-server/open-browser.d.ts.map +1 -0
  553. package/lib/dist/ui-server/open-browser.js +79 -0
  554. package/lib/dist/ui-server/open-browser.js.map +1 -0
  555. package/lib/dist/ui-server/security.d.ts +127 -0
  556. package/lib/dist/ui-server/security.d.ts.map +1 -0
  557. package/lib/dist/ui-server/security.js +332 -0
  558. package/lib/dist/ui-server/security.js.map +1 -0
  559. package/lib/dist/ui-server/static.d.ts +45 -0
  560. package/lib/dist/ui-server/static.d.ts.map +1 -0
  561. package/lib/dist/ui-server/static.js +165 -0
  562. package/lib/dist/ui-server/static.js.map +1 -0
  563. package/lib/dist/utils.d.ts +14 -2
  564. package/lib/dist/utils.d.ts.map +1 -1
  565. package/lib/dist/utils.js +25 -10
  566. package/lib/dist/utils.js.map +1 -1
  567. package/lib/dist/viewer/assets/archivo-latin-ext-wght-normal-C4zznr8T.woff2 +0 -0
  568. package/lib/dist/viewer/assets/archivo-latin-wght-normal-E0tuGl4L.woff2 +0 -0
  569. package/lib/dist/viewer/assets/archivo-vietnamese-wght-normal-XAtsl5Q_.woff2 +0 -0
  570. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-2syK4fUT.woff +0 -0
  571. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-italic-CBJ8pzag.woff2 +0 -0
  572. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
  573. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
  574. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
  575. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
  576. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-CTOM6hUh.woff2 +0 -0
  577. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-600-normal-fLZuRloM.woff +0 -0
  578. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-B4oTjJdl.woff +0 -0
  579. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-italic-CBjNughH.woff2 +0 -0
  580. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
  581. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
  582. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
  583. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
  584. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-9HEixskS.woff +0 -0
  585. package/lib/dist/viewer/assets/ibm-plex-mono-cyrillic-ext-600-normal-V-xxqcpd.woff2 +0 -0
  586. package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-italic-66oory27.woff +0 -0
  587. package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-italic-BqAiT5Ww.woff2 +0 -0
  588. package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  589. package/lib/dist/viewer/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  590. package/lib/dist/viewer/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
  591. package/lib/dist/viewer/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
  592. package/lib/dist/viewer/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
  593. package/lib/dist/viewer/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
  594. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-B7_fu1kp.woff2 +0 -0
  595. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-italic-Bg0ZHwF4.woff +0 -0
  596. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
  597. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
  598. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
  599. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
  600. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-D38SheWl.woff2 +0 -0
  601. package/lib/dist/viewer/assets/ibm-plex-mono-latin-ext-600-normal-DmB0ttJJ.woff +0 -0
  602. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-D6eaYXMU.woff +0 -0
  603. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-italic-DRuN92E5.woff2 +0 -0
  604. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
  605. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
  606. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
  607. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
  608. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-D2EvbN8M.woff2 +0 -0
  609. package/lib/dist/viewer/assets/ibm-plex-mono-vietnamese-600-normal-iLQfcSjf.woff +0 -0
  610. package/lib/dist/viewer/assets/index-CF9yvio6.css +1 -0
  611. package/lib/dist/viewer/assets/index-D4S7YUPf.js +97 -0
  612. package/lib/dist/viewer/index.html +16 -0
  613. package/lib/kernel/codegraph-kernel.node +2 -2
  614. package/lib/node_modules/.package-lock.json +4 -4
  615. package/lib/node_modules/picomatch/README.md +56 -51
  616. package/lib/node_modules/picomatch/lib/constants.js +4 -0
  617. package/lib/node_modules/picomatch/lib/parse.js +341 -1
  618. package/lib/node_modules/picomatch/lib/picomatch.js +25 -5
  619. package/lib/node_modules/picomatch/lib/scan.js +30 -18
  620. package/lib/node_modules/picomatch/package.json +4 -4
  621. package/lib/package.json +9 -2
  622. package/package.json +1 -1
@@ -41,13 +41,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
41
41
  return (mod && mod.__esModule) ? mod : { "default": mod };
42
42
  };
43
43
  Object.defineProperty(exports, "__esModule", { value: true });
44
- exports.loadAllGrammars = exports.loadGrammarsForLanguages = exports.initGrammars = exports.getSupportedLanguages = exports.isGrammarLoaded = exports.isLanguageSupported = exports.isSourceFile = exports.detectLanguage = exports.extractFromSource = exports.ExtractionOrchestrator = exports.ScopeIgnore = void 0;
44
+ exports.loadAllGrammars = exports.loadGrammarsForLanguages = exports.initGrammars = exports.getSupportedLanguages = exports.isGrammarLoaded = exports.isLanguageSupported = exports.isSourceFile = exports.detectLanguage = exports.extractFromSource = exports.ExtractionOrchestrator = exports.INDEXED_AT_COMMIT_KEY = exports.ScopeIgnore = exports.oversizeStamp = void 0;
45
45
  exports.hashContent = hashContent;
46
46
  exports.buildDefaultIgnore = buildDefaultIgnore;
47
+ exports.preloadLanguagesForFiles = preloadLanguagesForFiles;
47
48
  exports.buildScopeIgnore = buildScopeIgnore;
48
49
  exports.discoverEmbeddedRepoRoots = discoverEmbeddedRepoRoots;
49
50
  exports.findUnindexedIgnoredRepos = findUnindexedIgnoredRepos;
50
51
  exports.getGitChangedFiles = getGitChangedFiles;
52
+ exports.getGitHeadSha = getGitHeadSha;
53
+ exports.canTrustGitFastPath = canTrustGitFastPath;
51
54
  exports.scanDirectory = scanDirectory;
52
55
  exports.scanDirectoryAsync = scanDirectoryAsync;
53
56
  const fs = __importStar(require("fs"));
@@ -69,6 +72,8 @@ const utils_1 = require("../utils");
69
72
  const ignore_1 = __importDefault(require("ignore"));
70
73
  const frameworks_1 = require("../resolution/frameworks");
71
74
  const cooperative_yield_1 = require("../resolution/cooperative-yield");
75
+ const file_limits_1 = require("../file-limits");
76
+ Object.defineProperty(exports, "oversizeStamp", { enumerable: true, get: function () { return file_limits_1.oversizeStamp; } });
72
77
  /**
73
78
  * Number of files to read in parallel during indexing.
74
79
  * File reads are I/O-bound; batching overlaps I/O wait with CPU parse work.
@@ -108,11 +113,26 @@ function hashContent(content) {
108
113
  return crypto.createHash('sha256').update(content).digest('hex');
109
114
  }
110
115
  /**
111
- * Skip files larger than this (bytes). Generated bundles, minified JS, and
112
- * vendored blobs blow the WASM heap and the worker-recycle budget for no useful
113
- * symbols. 1 MB covers essentially all hand-written source.
116
+ * What change detection hashes for a file: its text when it is under the size
117
+ * limit, the size stamp when it is over — an oversize file is never decoded.
118
+ * `null` when the bytes show a `.ts` file is an MPEG transport stream, not
119
+ * TypeScript (#1910): decided from the bytes already read, so it costs no I/O
120
+ * and runs only for a file that is new or changed — never once per `.ts` file
121
+ * at discovery, which on a slow disk is a random read per file per scan.
114
122
  */
115
- const MAX_FILE_SIZE = 1024 * 1024;
123
+ function readSourceOrStamp(fullPath) {
124
+ const { stats, bytes } = (0, file_limits_1.readBoundedSourceSync)(fullPath);
125
+ if (bytes === null)
126
+ return (0, file_limits_1.oversizeStamp)(stats.size);
127
+ return isMpegTsBytes(fullPath, bytes) ? null : bytes.toString('utf8');
128
+ }
129
+ /** Whether these bytes, read from `filePath`, are a `.ts` MPEG transport stream (#1910). */
130
+ function isMpegTsBytes(filePath, bytes) {
131
+ if (!(0, grammars_1.hasMpegTsExtension)(filePath) || !(0, grammars_1.isMpegTransportStream)(bytes.subarray(0, grammars_1.MPEG_TS_SNIFF_BYTES)))
132
+ return false;
133
+ (0, errors_1.logDebug)('Skipping MPEG transport stream named .ts — not TypeScript', { filePath });
134
+ return true;
135
+ }
116
136
  /**
117
137
  * Directory names that are dependency, build, cache, or tooling output across the
118
138
  * languages/frameworks CodeGraph supports — curated from the canonical
@@ -192,6 +212,13 @@ const DEFAULT_IGNORE_PATTERNS = [
192
212
  'bazel-*/', // Bazel output symlink trees
193
213
  // Android resource dirs at any depth, with their qualifier variants (#1047).
194
214
  ...ANDROID_RES_TYPES.map((t) => `**/res/${t}*/`),
215
+ // `build` is also a legal JVM package segment. Keep it under conventional
216
+ // source roots (any source set: main, test, androidTest, ...) while continuing
217
+ // to exclude module/build output (#1642). Unignore only the directory, not its
218
+ // subtree: other defaults still apply.
219
+ '!**/src/*/java/**/build/',
220
+ '!**/src/*/kotlin/**/build/',
221
+ '!**/src/*/scala/**/build/',
195
222
  ];
196
223
  /** True if `buf` decodes as strict UTF-8 (no invalid byte sequences). */
197
224
  function isValidUtf8(buf) {
@@ -261,18 +288,119 @@ function readGitignorePatterns(giPath) {
261
288
  }
262
289
  return kept.join('\n');
263
290
  }
291
+ /**
292
+ * Resolve the repository GIT_DIR for `repoRoot` (a `.git` directory, or the
293
+ * target of a `.git` file pointer). Null when this isn't a git checkout.
294
+ */
295
+ function resolveGitDir(repoRoot) {
296
+ const gitPath = path.join(repoRoot, '.git');
297
+ let st;
298
+ try {
299
+ st = fs.statSync(gitPath);
300
+ }
301
+ catch {
302
+ return null;
303
+ }
304
+ if (st.isDirectory())
305
+ return gitPath;
306
+ if (!st.isFile())
307
+ return null;
308
+ try {
309
+ const raw = fs.readFileSync(gitPath, 'utf8').match(/^gitdir:\s*(.+)$/m)?.[1]?.trim();
310
+ if (!raw)
311
+ return null;
312
+ return path.isAbsolute(raw) ? path.normalize(raw) : path.resolve(repoRoot, raw);
313
+ }
314
+ catch {
315
+ return null;
316
+ }
317
+ }
318
+ /** Expand a leading `~/` the way git does for `core.excludesFile`. */
319
+ function expandUserPath(p) {
320
+ if (p === '~')
321
+ return os.homedir();
322
+ if (p.startsWith('~/'))
323
+ return path.join(os.homedir(), p.slice(2));
324
+ return p;
325
+ }
326
+ /**
327
+ * Root-relative exclude patterns from git sources that are NOT the root
328
+ * `.gitignore`: `.git/info/exclude` and `core.excludesFile`. Same semantics as
329
+ * the root `.gitignore`, so they merge into {@link buildDefaultIgnore}. Without
330
+ * these, the watcher / FS-walk scope silently diverged from
331
+ * `git ls-files --exclude-standard` (#1728).
332
+ */
333
+ function readGitExcludeExtraPatterns(rootDir) {
334
+ const chunks = [];
335
+ const gitDir = resolveGitDir(rootDir);
336
+ if (gitDir) {
337
+ const excludePath = path.join(gitDir, 'info', 'exclude');
338
+ if (fs.existsSync(excludePath)) {
339
+ const patterns = readGitignorePatterns(excludePath);
340
+ if (patterns)
341
+ chunks.push(patterns);
342
+ }
343
+ }
344
+ try {
345
+ const configured = (0, child_process_1.execFileSync)('git', ['-C', rootDir, 'config', '--get', 'core.excludesFile'], { encoding: 'utf8', timeout: 5_000, stdio: ['ignore', 'pipe', 'ignore'] }).trim();
346
+ if (configured) {
347
+ const abs = expandUserPath(configured);
348
+ if (fs.existsSync(abs)) {
349
+ const patterns = readGitignorePatterns(abs);
350
+ if (patterns)
351
+ chunks.push(patterns);
352
+ }
353
+ }
354
+ }
355
+ catch {
356
+ // No git, unset, or timeout — leave extras empty.
357
+ }
358
+ return chunks.join('\n');
359
+ }
360
+ /**
361
+ * Directories `git ls-files -o -i --exclude-standard --directory` reports as
362
+ * ignored-untracked. Seeded into {@link ScopeIgnore} so nested `.gitignore`
363
+ * effects (and any exclude-standard rule the flat matcher might miss) prune the
364
+ * watcher the same way the indexer skips them (#1728).
365
+ */
366
+ function listGitIgnoredDirectories(rootDir) {
367
+ try {
368
+ const out = (0, child_process_1.execFileSync)('git', ['-C', rootDir, 'ls-files', '-z', '-o', '-i', '--exclude-standard', '--directory'], {
369
+ encoding: 'utf8',
370
+ timeout: 60_000,
371
+ maxBuffer: 50 * 1024 * 1024,
372
+ stdio: ['ignore', 'pipe', 'ignore'],
373
+ });
374
+ const dirs = [];
375
+ for (const entry of out.split('\0')) {
376
+ if (!entry)
377
+ continue;
378
+ dirs.push(entry.endsWith('/') ? entry : `${entry}/`);
379
+ }
380
+ return dirs;
381
+ }
382
+ catch {
383
+ return [];
384
+ }
385
+ }
264
386
  /**
265
387
  * An `ignore` matcher seeded with the built-in defaults, merged with the project's
266
- * root .gitignore so a negation there (e.g. `!vendor/`) overrides a default. Shared
267
- * by both enumeration paths so behavior is identical with or without git — and so
268
- * the defaults apply to tracked files too (committing a dependency dir doesn't make
269
- * it project code; the explicit `.gitignore` negation is the only opt-in).
388
+ * root .gitignore so a negation there (e.g. `!vendor/`) overrides a default, plus
389
+ * git's other root-relative exclude files (`.git/info/exclude`, `core.excludesFile`)
390
+ * so watcher / FS-walk scope matches `git ls-files --exclude-standard` (#1728).
391
+ * Shared by both enumeration paths so behavior is identical with or without git —
392
+ * and so the defaults apply to tracked files too (committing a dependency dir
393
+ * doesn't make it project code; the explicit `.gitignore` negation is the only
394
+ * opt-in).
270
395
  */
271
396
  function buildDefaultIgnore(rootDir) {
272
397
  const ig = (0, ignore_1.default)().add(DEFAULT_IGNORE_PATTERNS);
273
398
  const rootGitignore = path.join(rootDir, '.gitignore');
274
399
  if (fs.existsSync(rootGitignore))
275
400
  ig.add(readGitignorePatterns(rootGitignore));
401
+ const extra = readGitExcludeExtraPatterns(rootDir);
402
+ if (extra)
403
+ ig.add(extra);
276
404
  return ig;
277
405
  }
278
406
  /**
@@ -591,15 +719,38 @@ function findNestedGitRepos(absDir, relPrefix) {
591
719
  }
592
720
  /**
593
721
  * Workspace-scope ignore matcher. Ordinary paths get the root's matcher
594
- * (built-in defaults + root `.gitignore`); paths inside an EMBEDDED repo get
595
- * that repo's own matcher (defaults + its root `.gitignore`) — the parent's
596
- * `.gitignore` hides a child repo from git, not from the index (#514). A
597
- * directory path (trailing slash) that is an ANCESTOR of an embedded root is
598
- * never ignored, so directory-pruning callers (the Linux per-directory
599
- * watcher) still descend to reach the embedded repos.
722
+ * (built-in defaults + root `.gitignore` + `.git/info/exclude` +
723
+ * `core.excludesFile`, plus directories `git ls-files --exclude-standard`
724
+ * reports as ignored); paths inside an EMBEDDED repo get that repo's own
725
+ * matcher — the parent's `.gitignore` hides a child repo from git, not from
726
+ * the index (#514). A directory path (trailing slash) that is an ANCESTOR of
727
+ * an embedded root is never ignored, so directory-pruning callers (the Linux
728
+ * per-directory watcher) still descend to reach the embedded repos.
729
+ *
730
+ * Shared by the indexer (scoped sync / skip checks) and the watcher so their
731
+ * scope cannot diverge from each other or from `git ls-files --exclude-standard`
732
+ * (#1728).
733
+ */
734
+ /**
735
+ * The grammars to preload for a file set.
600
736
  *
601
- * Single source of truth for indexer and watcher scope — they must not diverge.
737
+ * Path-only detection calls every `.h` file C, but parse-time detection reads
738
+ * the source and can reclassify it as C++ or Objective-C (`detectLanguage`
739
+ * with a `source` argument). Workers only ever get the grammars named here, so
740
+ * a header that turns out to be Objective-C in a project with no `.m` file
741
+ * found no parser and failed with `Failed to get parser for language: objc`
742
+ * (#1628). C++ was already covered; Objective-C was not.
602
743
  */
744
+ function preloadLanguagesForFiles(files, overrides) {
745
+ const languages = [...new Set(files.map((f) => (0, grammars_1.detectLanguage)(f, undefined, overrides)))];
746
+ if (languages.includes('c')) {
747
+ for (const ambiguous of ['cpp', 'objc']) {
748
+ if (!languages.includes(ambiguous))
749
+ languages.push(ambiguous);
750
+ }
751
+ }
752
+ return languages;
753
+ }
603
754
  class ScopeIgnore {
604
755
  rootMatcher;
605
756
  exclude;
@@ -678,7 +829,14 @@ exports.ScopeIgnore = ScopeIgnore;
678
829
  function buildScopeIgnore(rootDir, embeddedRoots) {
679
830
  const roots = embeddedRoots ? [...embeddedRoots] : discoverEmbeddedRepoRoots(rootDir);
680
831
  const include = loadIncludeMatcher(rootDir);
681
- return new ScopeIgnore(buildDefaultIgnore(rootDir), roots.map((root) => ({ root, matcher: buildDefaultIgnore(path.join(rootDir, root)) })), loadExcludeMatcher(rootDir), include, include ? includeStaticRoots((0, project_config_1.loadIncludePatterns)(rootDir)) : []);
832
+ // Root matcher already has defaults + root `.gitignore` + info/exclude +
833
+ // core.excludesFile. Seed ignored-untracked directories from git so nested
834
+ // `.gitignore` effects prune the watcher identically to the indexer (#1728).
835
+ const rootMatcher = buildDefaultIgnore(rootDir);
836
+ for (const dir of listGitIgnoredDirectories(rootDir)) {
837
+ rootMatcher.add(dir);
838
+ }
839
+ return new ScopeIgnore(rootMatcher, roots.map((root) => ({ root, matcher: buildDefaultIgnore(path.join(rootDir, root)) })), loadExcludeMatcher(rootDir), include, include ? includeStaticRoots((0, project_config_1.loadIncludePatterns)(rootDir)) : []);
682
840
  }
683
841
  /**
684
842
  * Whether an embedded repo found as a tracked gitlink (mode 160000, #1031/#1033)
@@ -745,7 +903,7 @@ function discoverEmbeddedRepoRoots(rootDir) {
745
903
  // same way collectGitFiles does, keeping watcher scope == indexer scope.
746
904
  // (#1031, #1033)
747
905
  try {
748
- const staged = (0, child_process_1.execFileSync)('git', ['ls-files', '-z', '-s', '--recurse-submodules'], { cwd: repoAbs, encoding: 'utf-8', timeout: 30000, maxBuffer: 50 * 1024 * 1024, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });
906
+ const staged = lsFilesStaged({ cwd: repoAbs, encoding: 'utf-8', timeout: 30000, maxBuffer: 50 * 1024 * 1024, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });
749
907
  const repoIgnore = buildDefaultIgnore(repoAbs);
750
908
  for (const entry of staged.split('\0')) {
751
909
  if (!entry || entry.slice(0, 6) !== '160000')
@@ -865,6 +1023,30 @@ function findIgnoredEmbeddedRepos(repoDir, includeIgnored, prefix) {
865
1023
  }
866
1024
  return repos;
867
1025
  }
1026
+ /**
1027
+ * `git ls-files -z -s`, expanding submodules where git allows it.
1028
+ *
1029
+ * `--recurse-submodules` could not be combined with `-s` before git 2.36:
1030
+ * `builtin/ls-files.c` listed `show_stage` among the modes that die, and the
1031
+ * check is unconditional — it does not look at whether the repo actually has
1032
+ * submodules, so every call fails on older git. Ubuntu 22.04 LTS (2.34.1) and
1033
+ * Debian 11 (2.30.2) are both below that line.
1034
+ *
1035
+ * Letting the throw escape cost far more than submodule expansion: it unwound
1036
+ * the whole git-visible pass, so `includeIgnored`, gitlink recursion and the
1037
+ * `codegraph.json` include allowlist silently stopped applying and files went
1038
+ * missing from the index with no error (#1549). Retry without the flag instead
1039
+ * — `-s` is the part that matters here, since gitlink detection reads the mode
1040
+ * bits, and embedded repos are reached through the gitlink recursion anyway.
1041
+ */
1042
+ function lsFilesStaged(gitOpts) {
1043
+ try {
1044
+ return (0, child_process_1.execFileSync)('git', ['ls-files', '-z', '-s', '--recurse-submodules'], gitOpts);
1045
+ }
1046
+ catch {
1047
+ return (0, child_process_1.execFileSync)('git', ['ls-files', '-z', '-s'], gitOpts);
1048
+ }
1049
+ }
868
1050
  /**
869
1051
  * Collect git-visible files (tracked + untracked, .gitignore-respected) from the
870
1052
  * git repository rooted at `repoDir`, adding each to `files` with `prefix`
@@ -909,7 +1091,7 @@ function collectGitFiles(repoDir, prefix, files, embeddedRoots, includeIgnored =
909
1091
  // on disk → those files are silently dropped from the index. (#541) With -s the
910
1092
  // path follows a TAB after the `<mode> <object> <stage>` prefix.
911
1093
  const gitlinkRels = [];
912
- const tracked = (0, child_process_1.execFileSync)('git', ['ls-files', '-z', '-s', '--recurse-submodules'], gitOpts);
1094
+ const tracked = lsFilesStaged(gitOpts);
913
1095
  for (const entry of tracked.split('\0')) {
914
1096
  if (!entry)
915
1097
  continue;
@@ -1000,6 +1182,10 @@ function getGitVisibleFiles(rootDir) {
1000
1182
  // git check-ignore exits 0 if the path IS ignored, 1 if not
1001
1183
  (0, child_process_1.execFileSync)('git', ['check-ignore', '-q', path.resolve(rootDir)], { cwd: rootDir, encoding: 'utf-8', timeout: 5000, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });
1002
1184
  // Directory is gitignored by parent repo — fall back to filesystem walk
1185
+ (0, errors_1.logDebug)('project root is gitignored by a parent repo — falling back to filesystem walk', {
1186
+ rootDir,
1187
+ gitRoot,
1188
+ });
1003
1189
  return null;
1004
1190
  }
1005
1191
  catch {
@@ -1026,7 +1212,20 @@ function getGitVisibleFiles(rootDir) {
1026
1212
  visible.add(f);
1027
1213
  return visible;
1028
1214
  }
1029
- catch {
1215
+ catch (error) {
1216
+ // Any failure here (git missing, a `git rev-parse`/`ls-files` timeout or
1217
+ // buffer overrun under load, an unreadable repo, unsupported flag combo on
1218
+ // older git, etc.) silently sent every caller to `scanDirectoryWalk` with
1219
+ // zero signal that the fast git-delegated path was skipped — making reports
1220
+ // like #1567 (nested-`.gitignore`-excluded `node_modules` walked into)
1221
+ // hard to triage, since both ignore implementations look correct in
1222
+ // isolation but there was no way to tell which one ran. Log it under the
1223
+ // existing CODEGRAPH_DEBUG gate so a future report can confirm or rule out
1224
+ // the fallback in one step.
1225
+ (0, errors_1.logDebug)('git-based file listing unavailable — falling back to filesystem walk', {
1226
+ rootDir,
1227
+ error: error instanceof Error ? error.message : String(error),
1228
+ });
1030
1229
  return null;
1031
1230
  }
1032
1231
  }
@@ -1044,20 +1243,94 @@ function getGitVisibleFiles(rootDir) {
1044
1243
  * case this cannot see (the child status that would report the deletions is gone
1045
1244
  * with it); a full `codegraph index` reconciles that.
1046
1245
  */
1047
- function getGitChangedFiles(rootDir) {
1246
+ function getGitChangedFiles(rootDir, sinceCommit) {
1048
1247
  try {
1248
+ // `git status` only ever describes the WORKING TREE, so a change that has
1249
+ // been committed leaves no entry and never enters the candidate set — the
1250
+ // hash comparison in getChangedFiles is correct but is never reached for
1251
+ // it, and `pendingChanges` reads 0 while the index is genuinely behind
1252
+ // (#1829). `sinceCommit` — the commit the index was last brought up to
1253
+ // date at — adds the other half: what has been committed since. Callers
1254
+ // that hold no such stamp still get exactly what they always did, the
1255
+ // working-tree changes.
1049
1256
  const changes = { modified: [], added: [], deleted: [] };
1050
1257
  // Custom extension → language overrides from the project's codegraph.json,
1051
1258
  // so change detection sees the same custom-extension files the full index does.
1052
1259
  const overrides = (0, project_config_1.loadExtensionOverrides)(rootDir);
1053
- collectGitStatus(rootDir, '', changes, overrides, loadIncludeIgnoredMatcher(rootDir), loadExcludeMatcher(rootDir));
1260
+ collectGitStatus(rootDir, '', changes, overrides, loadIncludeIgnoredMatcher(rootDir), loadExcludeMatcher(rootDir), sinceCommit ?? undefined);
1054
1261
  return changes;
1055
1262
  }
1056
1263
  catch {
1057
1264
  return null;
1058
1265
  }
1059
1266
  }
1060
- function collectGitStatus(repoDir, prefix, out, overrides, includeIgnored = null, exclude = null) {
1267
+ /**
1268
+ * Metadata key: the commit the index was last brought up to date at. Written by
1269
+ * a full index AND by every successful sync — unlike the extraction stamp, which
1270
+ * a sync must not advance because it only touches a subset of files. This one is
1271
+ * about the tree; failed file paths remain explicit retry candidates. (#1829)
1272
+ */
1273
+ exports.INDEXED_AT_COMMIT_KEY = 'indexed_at_commit';
1274
+ /** HEAD's commit sha, or null in a non-git repo or one with no commits yet. */
1275
+ function getGitHeadSha(rootDir) {
1276
+ try {
1277
+ return (0, child_process_1.execFileSync)('git', ['rev-parse', 'HEAD'], {
1278
+ cwd: rootDir, encoding: 'utf-8', timeout: 5000, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true,
1279
+ }).trim() || null;
1280
+ }
1281
+ catch {
1282
+ return null;
1283
+ }
1284
+ }
1285
+ /**
1286
+ * NUL-delimited status/path pairs for every path committed
1287
+ * between `sinceCommit` and HEAD. Empty when the stamp IS HEAD, which is the
1288
+ * common case — one cheap git call on the hot path.
1289
+ */
1290
+ function gitCommittedChangesSince(repoDir, sinceCommit) {
1291
+ // NUL framing preserves Unicode, quotes, tabs and newlines in Git paths.
1292
+ // Let command failures reach getGitChangedFiles: [] would falsely mean clean.
1293
+ const out = (0, child_process_1.execFileSync)('git', ['diff', '--relative', '--name-status', '--no-renames', '-z', sinceCommit, 'HEAD', '--', '.'], {
1294
+ cwd: repoDir, encoding: 'utf-8', timeout: 10000, maxBuffer: 50 * 1024 * 1024, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true,
1295
+ });
1296
+ return out.split('\0');
1297
+ }
1298
+ /**
1299
+ * Can an INDEX trust the git fast path, given the commit it was built at?
1300
+ *
1301
+ * False means "fall back to the full scan" — the expensive path that compares
1302
+ * every file on disk against the DB, and the only correct read when git cannot
1303
+ * say what happened between the stamp and now:
1304
+ *
1305
+ * - stamp present but unknown to this repo (rebase, gc, shallow clone, a stamp
1306
+ * from a different checkout) — history moved under the index.
1307
+ * - stamp absent while the repo HAS commits — an index built before stamping
1308
+ * existed. One full scan; the next sync stamps it and the fast path returns.
1309
+ *
1310
+ * A repo with NO commits keeps the fast path with or without a stamp: every
1311
+ * file is untracked, so `git status` already sees all of them. Callers with no
1312
+ * index behind them (the exported `getGitChangedFiles`) never ask this — a
1313
+ * working-tree diff is the whole of what they wanted. (#1829)
1314
+ */
1315
+ function canTrustGitFastPath(rootDir, sinceCommit) {
1316
+ const head = getGitHeadSha(rootDir);
1317
+ if (head == null)
1318
+ return true; // no commits (or not a git repo — caller handles that)
1319
+ if (!sinceCommit)
1320
+ return false;
1321
+ if (sinceCommit === head)
1322
+ return true;
1323
+ try {
1324
+ (0, child_process_1.execFileSync)('git', ['cat-file', '-e', `${sinceCommit}^{commit}`], {
1325
+ cwd: rootDir, encoding: 'utf-8', timeout: 5000, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true,
1326
+ });
1327
+ return true;
1328
+ }
1329
+ catch {
1330
+ return false;
1331
+ }
1332
+ }
1333
+ function collectGitStatus(repoDir, prefix, out, overrides, includeIgnored = null, exclude = null, sinceCommit) {
1061
1334
  const output = (0, child_process_1.execFileSync)('git',
1062
1335
  // `-uall` lists individual untracked files instead of collapsing an
1063
1336
  // entirely-untracked directory into one `?? dir/` entry, which would
@@ -1065,7 +1338,7 @@ function collectGitStatus(repoDir, prefix, out, overrides, includeIgnored = null
1065
1338
  // below). Nested untracked git repos still collapse to `?? repo/` even
1066
1339
  // with `-uall` — git never crosses a repo boundary — so the recursion
1067
1340
  // still handles them. (#1213)
1068
- ['status', '--porcelain', '--no-renames', '-uall'], { cwd: repoDir, encoding: 'utf-8', timeout: 10000, maxBuffer: 50 * 1024 * 1024, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });
1341
+ ['status', '--porcelain', '--no-renames', '-z', '-uall'], { cwd: repoDir, encoding: 'utf-8', timeout: 10000, maxBuffer: 50 * 1024 * 1024, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });
1069
1342
  // This repo's own ignore rules — built-in defaults (#407) plus its .gitignore.
1070
1343
  // Change detection must exclude the SAME files the full index does, but git
1071
1344
  // status hides neither: it ignores nothing for *tracked* paths, and the
@@ -1077,45 +1350,63 @@ function collectGitStatus(repoDir, prefix, out, overrides, includeIgnored = null
1077
1350
  // ScopeIgnore: every embedded repo is judged by ITS OWN rules, never the
1078
1351
  // parent's. (#766)
1079
1352
  const ig = buildDefaultIgnore(repoDir);
1080
- const untrackedDirs = [];
1081
- for (const line of output.split('\n')) {
1082
- if (line.length < 4)
1083
- continue; // Minimum: "XY file"
1084
- const statusCode = line.substring(0, 2);
1085
- const rel = (0, utils_1.normalizePath)(line.substring(3));
1086
- // Untracked directory entries (trailing slash) may hide an embedded repo —
1087
- // collect for the recursion below instead of treating as a file.
1088
- if (statusCode === '??' && rel.endsWith('/')) {
1089
- untrackedDirs.push(rel);
1090
- continue;
1091
- }
1353
+ // One classifier for both candidate sources below, so a committed change is
1354
+ // filtered by exactly the rules a working-tree change is (#766, #999, #1829).
1355
+ const classify = (statusCode, rel) => {
1092
1356
  const filePath = (0, utils_1.normalizePath)(prefix + rel);
1093
1357
  if (!(0, grammars_1.isSourceFile)(filePath, overrides))
1094
- continue;
1358
+ return;
1095
1359
  if (statusCode.includes('D')) {
1096
1360
  // Deletions stay unfiltered: getChangedFiles acts on one only when the
1097
1361
  // path is already tracked in the DB, where removal is always correct — and
1098
1362
  // that lets a newly-excluded dir's stale rows clean themselves up. (#766)
1099
1363
  out.deleted.push(filePath);
1100
- continue;
1364
+ return;
1101
1365
  }
1102
1366
  // Added (`??`) / modified files inside an excluded dir must not enter the
1103
1367
  // index — match against the repo-relative path, same as the full scan. (#766)
1104
1368
  if (ig.ignores(rel))
1105
- continue;
1369
+ return;
1106
1370
  // User `codegraph.json` `exclude` (#999) is project-root-relative, so it's
1107
1371
  // matched against the full path — sync must not re-add a tracked file the
1108
1372
  // full index now keeps out. Deletions above stay unfiltered so a file that
1109
1373
  // WAS indexed before an exclude was added still cleans itself out.
1110
1374
  if (exclude && exclude.ignores(filePath))
1111
- continue;
1375
+ return;
1112
1376
  if (statusCode === '??') {
1113
1377
  out.added.push(filePath);
1114
1378
  }
1115
1379
  else {
1116
- // M, MM, AM, A (staged), etc. — treat as modified
1380
+ // M, MM, AM, A (staged), etc. — treat as modified. getChangedFiles
1381
+ // re-decides added-vs-modified from the DB, so a committed `A` that the
1382
+ // index never saw still lands in `added`.
1117
1383
  out.modified.push(filePath);
1118
1384
  }
1385
+ };
1386
+ const untrackedDirs = [];
1387
+ for (const line of output.split('\0')) {
1388
+ if (line.length < 4)
1389
+ continue; // Minimum: "XY file"
1390
+ const statusCode = line.substring(0, 2);
1391
+ const rel = (0, utils_1.normalizePath)(line.substring(3));
1392
+ // Untracked directory entries (trailing slash) may hide an embedded repo —
1393
+ // collect for the recursion below instead of treating as a file.
1394
+ if (statusCode === '??' && rel.endsWith('/')) {
1395
+ untrackedDirs.push(rel);
1396
+ continue;
1397
+ }
1398
+ classify(statusCode, rel);
1399
+ }
1400
+ // Committed but unindexed: everything between the commit this index was last
1401
+ // brought up to date at and HEAD. `git status` cannot see these — committing
1402
+ // is precisely what removes a file from its output — so without this pass a
1403
+ // `git commit` makes a real pending change read as zero (#1829). The stamp
1404
+ // belongs to the ROOT repo, so the embedded-repo recursion below passes none.
1405
+ if (sinceCommit) {
1406
+ const fields = gitCommittedChangesSince(repoDir, sinceCommit);
1407
+ for (let i = 0; i + 1 < fields.length; i += 2) {
1408
+ classify(`${fields[i].charAt(0)} `, (0, utils_1.normalizePath)(fields[i + 1]));
1409
+ }
1119
1410
  }
1120
1411
  // Recurse embedded repos found under untracked dirs (at the dir itself or
1121
1412
  // nested deeper). Gitignored dirs are walked only for the directories the
@@ -1157,11 +1448,16 @@ function scanDirectory(rootDir, onProgress) {
1157
1448
  // Fallback: walk filesystem for non-git projects
1158
1449
  return scanDirectoryWalk(rootDir, onProgress);
1159
1450
  }
1160
- /**
1161
- * Async variant of scanDirectory that yields to the event loop periodically,
1162
- * allowing worker threads to receive and render progress messages.
1163
- */
1164
- async function scanDirectoryAsync(rootDir, onProgress) {
1451
+ /** Record one file the scan declined to index. */
1452
+ function tallySkip(stats, rel) {
1453
+ if (!stats)
1454
+ return;
1455
+ const ext = path.extname(rel).toLowerCase();
1456
+ if (!ext)
1457
+ return;
1458
+ stats.unsupportedByExtension.set(ext, (stats.unsupportedByExtension.get(ext) ?? 0) + 1);
1459
+ }
1460
+ async function scanDirectoryAsync(rootDir, onProgress, stats) {
1165
1461
  // Custom extension → language overrides from the project's codegraph.json.
1166
1462
  const overrides = (0, project_config_1.loadExtensionOverrides)(rootDir);
1167
1463
  const gitFiles = getGitVisibleFiles(rootDir);
@@ -1178,15 +1474,18 @@ async function scanDirectoryAsync(rootDir, onProgress) {
1178
1474
  await new Promise(r => setImmediate(r));
1179
1475
  }
1180
1476
  }
1477
+ else {
1478
+ tallySkip(stats, filePath);
1479
+ }
1181
1480
  }
1182
1481
  return files;
1183
1482
  }
1184
- return scanDirectoryWalk(rootDir, onProgress);
1483
+ return scanDirectoryWalk(rootDir, onProgress, stats);
1185
1484
  }
1186
1485
  /**
1187
1486
  * Filesystem walk fallback for non-git projects.
1188
1487
  */
1189
- function scanDirectoryWalk(rootDir, onProgress) {
1488
+ function scanDirectoryWalk(rootDir, onProgress, stats) {
1190
1489
  const files = [];
1191
1490
  let count = 0;
1192
1491
  const visitedDirs = new Set();
@@ -1258,10 +1557,15 @@ function scanDirectoryWalk(rootDir, onProgress) {
1258
1557
  }
1259
1558
  }
1260
1559
  else if (stat.isFile()) {
1261
- if (!isIgnored(fullPath, false, active) && (0, grammars_1.isSourceFile)(relativePath, overrides)) {
1262
- files.push(relativePath);
1263
- count++;
1264
- onProgress?.(count, relativePath);
1560
+ if (!isIgnored(fullPath, false, active)) {
1561
+ if ((0, grammars_1.isSourceFile)(relativePath, overrides)) {
1562
+ files.push(relativePath);
1563
+ count++;
1564
+ onProgress?.(count, relativePath);
1565
+ }
1566
+ else {
1567
+ tallySkip(stats, relativePath);
1568
+ }
1265
1569
  }
1266
1570
  }
1267
1571
  }
@@ -1276,10 +1580,15 @@ function scanDirectoryWalk(rootDir, onProgress) {
1276
1580
  }
1277
1581
  }
1278
1582
  else if (entry.isFile()) {
1279
- if (!isIgnored(fullPath, false, active) && (0, grammars_1.isSourceFile)(relativePath, overrides)) {
1280
- files.push(relativePath);
1281
- count++;
1282
- onProgress?.(count, relativePath);
1583
+ if (!isIgnored(fullPath, false, active)) {
1584
+ if ((0, grammars_1.isSourceFile)(relativePath, overrides)) {
1585
+ files.push(relativePath);
1586
+ count++;
1587
+ onProgress?.(count, relativePath);
1588
+ }
1589
+ else {
1590
+ tallySkip(stats, relativePath);
1591
+ }
1283
1592
  }
1284
1593
  }
1285
1594
  }
@@ -1377,10 +1686,20 @@ class ExtractionOrchestrator {
1377
1686
  * same lifecycle the watcher's own matcher already has.
1378
1687
  */
1379
1688
  scopedSyncMatcher() {
1380
- const key = [project_config_1.PROJECT_CONFIG_FILENAME, '.gitignore']
1689
+ // Bust when any root-level exclude source the matcher reads may have
1690
+ // changed. Nested `.gitignore` edits force a full watcher sync, which
1691
+ // clears this cache (see the full-reconcile branch in sync()).
1692
+ const gitDir = resolveGitDir(this.rootDir);
1693
+ const key = [
1694
+ project_config_1.PROJECT_CONFIG_FILENAME,
1695
+ '.gitignore',
1696
+ gitDir ? path.join(gitDir, 'info', 'exclude') : '',
1697
+ ]
1381
1698
  .map((name) => {
1699
+ if (!name)
1700
+ return '-';
1382
1701
  try {
1383
- return String(fs.statSync(path.join(this.rootDir, name)).mtimeMs);
1702
+ return String(fs.statSync(path.isAbsolute(name) ? name : path.join(this.rootDir, name)).mtimeMs);
1384
1703
  }
1385
1704
  catch {
1386
1705
  return '-';
@@ -1426,7 +1745,9 @@ class ExtractionOrchestrator {
1426
1745
  if (!full)
1427
1746
  return null;
1428
1747
  try {
1429
- return fs.readFileSync(full, 'utf-8');
1748
+ // Framework detectors scan source by name; a file over the size
1749
+ // limit was never indexed and must not be decoded here either (#1910).
1750
+ return (0, file_limits_1.readBoundedSourceSync)(full).bytes?.toString('utf8') ?? null;
1430
1751
  }
1431
1752
  catch {
1432
1753
  return null;
@@ -1508,6 +1829,7 @@ class ExtractionOrchestrator {
1508
1829
  // early-run 5-10s single stalls were observed on 95k-file repos but never
1509
1830
  // attributed — these labels settle scan vs framework-detect vs grammars.
1510
1831
  const tScan = Date.now();
1832
+ const skipStats = { unsupportedByExtension: new Map() };
1511
1833
  const files = await scanDirectoryAsync(this.rootDir, (current, file) => {
1512
1834
  onProgress?.({
1513
1835
  phase: 'scanning',
@@ -1515,9 +1837,22 @@ class ExtractionOrchestrator {
1515
1837
  total: 0,
1516
1838
  currentFile: file,
1517
1839
  });
1518
- });
1840
+ }, skipStats);
1519
1841
  if (process.env.CODEGRAPH_SYNTH_TIMINGS)
1520
1842
  console.error(`[phase-timing] scan: ${Date.now() - tScan}ms (${files.length} files)`);
1843
+ /** Only meaningful when nothing was indexable — see IndexResult (#1502). */
1844
+ const skipSummary = () => {
1845
+ let total = 0;
1846
+ for (const n of skipStats.unsupportedByExtension.values())
1847
+ total += n;
1848
+ if (total === 0)
1849
+ return {};
1850
+ const top = [...skipStats.unsupportedByExtension.entries()]
1851
+ .map(([ext, count]) => ({ ext, count }))
1852
+ .sort((a, b) => b.count - a.count || a.ext.localeCompare(b.ext))
1853
+ .slice(0, 5);
1854
+ return { filesSkippedUnsupported: total, topUnsupportedExtensions: top };
1855
+ };
1521
1856
  // A re-index over an existing DB skips unchanged-hash files at the store,
1522
1857
  // which would preserve wiped zero-node rows (#1541) — drop them first so
1523
1858
  // this run stores their files fresh. No-op on a fresh DB.
@@ -1557,11 +1892,7 @@ class ExtractionOrchestrator {
1557
1892
  });
1558
1893
  await new Promise(resolve => setImmediate(resolve));
1559
1894
  // Detect needed languages and load grammars in the parse worker
1560
- const neededLanguages = [...new Set(files.map((f) => (0, grammars_1.detectLanguage)(f, undefined, overrides)))];
1561
- // .h files default to 'c' but may be C++ — ensure cpp grammar is loaded when c is needed
1562
- if (neededLanguages.includes('c') && !neededLanguages.includes('cpp')) {
1563
- neededLanguages.push('cpp');
1564
- }
1895
+ const neededLanguages = preloadLanguagesForFiles(files, overrides);
1565
1896
  // Parse files on a pool of worker threads (keeps the main thread free for UI
1566
1897
  // and uses every core). Falls back to in-process parsing when the compiled
1567
1898
  // worker is unavailable (e.g. running from source in tests).
@@ -1789,8 +2120,11 @@ class ExtractionOrchestrator {
1789
2120
  // window has room. When nothing is in flight but the window is still full,
1790
2121
  // the async commit chain is what's behind — await it so the cursor
1791
2122
  // advances (buffered items hold whole file contents, so this bound is
1792
- // load-bearing for memory).
1793
- while (nextSeq - nextToStore >= windowSize) {
2123
+ // load-bearing for memory). Once a store has failed the cursor never
2124
+ // moves again — flushOrdered returns at once — so stop waiting and let
2125
+ // the drain below rethrow; waiting would spin on microtasks forever,
2126
+ // pinning a core and starving every timer in the process.
2127
+ while (nextSeq - nextToStore >= windowSize && !flushError && !aborted) {
1794
2128
  if (inFlight.size > 0)
1795
2129
  await Promise.race(inFlight);
1796
2130
  else
@@ -1815,8 +2149,20 @@ class ExtractionOrchestrator {
1815
2149
  (0, errors_1.logWarn)('Path traversal blocked in batch reader', { filePath: fp });
1816
2150
  return { filePath: fp, content: null, stats: null, error: new Error('Path traversal blocked') };
1817
2151
  }
1818
- const content = await fsp.readFile(fullPath, 'utf-8');
1819
- const stats = await fsp.stat(fullPath);
2152
+ // Stat first: a file over the size limit is stored as skipped
2153
+ // without ever being read or decoded (#1910), so ten oversize
2154
+ // fixtures in one I/O batch no longer cost their size in RSS.
2155
+ const { stats, bytes } = await (0, file_limits_1.readBoundedSource)(fullPath);
2156
+ if (bytes === null) {
2157
+ return { filePath: fp, content: (0, file_limits_1.oversizeStamp)(stats.size), stats, error: null };
2158
+ }
2159
+ // Read bytes, not text: a `.ts` that is really an MPEG transport
2160
+ // stream (#1910) is recognised from its head here, at no extra I/O,
2161
+ // and never decoded or parsed.
2162
+ if (isMpegTsBytes(fp, bytes)) {
2163
+ return { filePath: fp, content: null, stats: null, error: null, skipped: true };
2164
+ }
2165
+ const content = bytes.toString('utf-8');
1820
2166
  return { filePath: fp, content, stats, error: null };
1821
2167
  }
1822
2168
  catch (err) {
@@ -1825,11 +2171,17 @@ class ExtractionOrchestrator {
1825
2171
  }));
1826
2172
  // Dispatch each readable file into the bounded parse window; the window
1827
2173
  // stores results on the main thread as they arrive.
1828
- for (const { filePath, content, stats, error } of fileContents) {
2174
+ for (const { filePath, content, stats, error, skipped } of fileContents) {
1829
2175
  if (signal?.aborted) {
1830
2176
  aborted = true;
1831
2177
  break;
1832
2178
  }
2179
+ if (skipped) {
2180
+ // Not a source file after all — counted as done, stored as nothing.
2181
+ processed++;
2182
+ onProgress?.({ phase: 'parsing', current: processed, total });
2183
+ continue;
2184
+ }
1833
2185
  if (error || content === null || stats === null) {
1834
2186
  processed++;
1835
2187
  filesErrored++;
@@ -1842,18 +2194,18 @@ class ExtractionOrchestrator {
1842
2194
  onProgress?.({ phase: 'parsing', current: processed, total });
1843
2195
  continue;
1844
2196
  }
1845
- // Honour MAX_FILE_SIZE. Without this check, vendored generated
2197
+ // Honour MAX_SOURCE_FILE_SIZE_BYTES. Without this check, vendored generated
1846
2198
  // headers, minified bundles, and other multi-MB files get indexed,
1847
2199
  // wasting WASM heap and the worker recycle budget on inputs with no
1848
2200
  // useful symbols. The single-file extractFile path already enforces
1849
2201
  // this; the bulk path used to silently skip the check.
1850
- if (stats.size > MAX_FILE_SIZE) {
2202
+ if (stats.size > file_limits_1.MAX_SOURCE_FILE_SIZE_BYTES) {
1851
2203
  await storeResult(filePath, content, stats, {
1852
2204
  nodes: [],
1853
2205
  edges: [],
1854
2206
  unresolvedReferences: [],
1855
2207
  errors: [{
1856
- message: `File exceeds max size (${stats.size} > ${MAX_FILE_SIZE})`,
2208
+ message: `File exceeds max size (${stats.size} > ${file_limits_1.MAX_SOURCE_FILE_SIZE_BYTES})`,
1857
2209
  filePath,
1858
2210
  severity: 'warning',
1859
2211
  code: 'size_exceeded',
@@ -1877,6 +2229,9 @@ class ExtractionOrchestrator {
1877
2229
  if (flushError) {
1878
2230
  if (storeWriter)
1879
2231
  await storeWriter.close();
2232
+ // Its worker threads would otherwise outlive the failed index.
2233
+ if (pool)
2234
+ await pool.destroy();
1880
2235
  throw flushError;
1881
2236
  }
1882
2237
  // All bundles are posted; wait for the writer to apply them, then close
@@ -1905,6 +2260,7 @@ class ExtractionOrchestrator {
1905
2260
  filesSkipped,
1906
2261
  filesErrored,
1907
2262
  filesDiscovered: total,
2263
+ ...skipSummary(),
1908
2264
  nodesCreated: totalNodes,
1909
2265
  edgesCreated: totalEdges,
1910
2266
  errors: [{ message: 'Aborted', severity: 'error' }, ...errors],
@@ -1947,7 +2303,11 @@ class ExtractionOrchestrator {
1947
2303
  const fullPath = (0, utils_1.validatePathWithinRoot)(this.rootDir, filePath);
1948
2304
  if (!fullPath)
1949
2305
  continue;
1950
- content = await fsp.readFile(fullPath, 'utf-8');
2306
+ // Bounded like the first read: the file may have grown since (#1910).
2307
+ const bytes = (await (0, file_limits_1.readBoundedSource)(fullPath)).bytes;
2308
+ if (bytes === null)
2309
+ continue;
2310
+ content = bytes.toString('utf8');
1951
2311
  }
1952
2312
  catch {
1953
2313
  continue;
@@ -1997,7 +2357,10 @@ class ExtractionOrchestrator {
1997
2357
  const fullPath = (0, utils_1.validatePathWithinRoot)(this.rootDir, filePath);
1998
2358
  if (!fullPath)
1999
2359
  continue;
2000
- fullContent = await fsp.readFile(fullPath, 'utf-8');
2360
+ const bytes = (await (0, file_limits_1.readBoundedSource)(fullPath)).bytes;
2361
+ if (bytes === null)
2362
+ continue;
2363
+ fullContent = bytes.toString('utf8');
2001
2364
  }
2002
2365
  catch {
2003
2366
  continue;
@@ -2047,6 +2410,7 @@ class ExtractionOrchestrator {
2047
2410
  filesSkipped,
2048
2411
  filesErrored,
2049
2412
  filesDiscovered: total,
2413
+ ...skipSummary(),
2050
2414
  nodesCreated: totalNodes,
2051
2415
  edgesCreated: totalEdges,
2052
2416
  errors,
@@ -2117,8 +2481,14 @@ class ExtractionOrchestrator {
2117
2481
  let content;
2118
2482
  let stats;
2119
2483
  try {
2120
- stats = await fsp.stat(fullPath);
2121
- content = await fsp.readFile(fullPath, 'utf-8');
2484
+ // An oversize file is stored as skipped; its bytes are never needed (#1910).
2485
+ const read = await (0, file_limits_1.readBoundedSource)(fullPath);
2486
+ stats = read.stats;
2487
+ // An MPEG transport stream named `.ts` is not TypeScript (#1910).
2488
+ if (read.bytes !== null && isMpegTsBytes(relativePath, read.bytes)) {
2489
+ return { nodes: [], edges: [], unresolvedReferences: [], errors: [], durationMs: 0 };
2490
+ }
2491
+ content = read.bytes === null ? (0, file_limits_1.oversizeStamp)(stats.size) : read.bytes.toString('utf8');
2122
2492
  }
2123
2493
  catch (error) {
2124
2494
  return {
@@ -2157,14 +2527,14 @@ class ExtractionOrchestrator {
2157
2527
  }
2158
2528
  const language = (0, grammars_1.detectLanguage)(relativePath, content, (0, project_config_1.loadExtensionOverrides)(this.rootDir));
2159
2529
  // Check file size
2160
- if (stats.size > MAX_FILE_SIZE) {
2530
+ if (stats.size > file_limits_1.MAX_SOURCE_FILE_SIZE_BYTES) {
2161
2531
  const result = {
2162
2532
  nodes: [],
2163
2533
  edges: [],
2164
2534
  unresolvedReferences: [],
2165
2535
  errors: [
2166
2536
  {
2167
- message: `File exceeds max size (${stats.size} > ${MAX_FILE_SIZE})`,
2537
+ message: `File exceeds max size (${stats.size} > ${file_limits_1.MAX_SOURCE_FILE_SIZE_BYTES})`,
2168
2538
  filePath: relativePath,
2169
2539
  severity: 'warning',
2170
2540
  code: 'size_exceeded',
@@ -2485,8 +2855,7 @@ class ExtractionOrchestrator {
2485
2855
  // rebind to the same target is a clean no-op, but leaving the old row in
2486
2856
  // place for a rebind ELSEWHERE would keep both, turning drift into
2487
2857
  // duplication.
2488
- this.queries.deleteEdgesByIds(edgeIds);
2489
- this.queries.insertUnresolvedRefsBatch(refs);
2858
+ this.queries.replaceResolutionEdgesWithUnresolvedRefs(edgeIds, refs);
2490
2859
  return refs.length;
2491
2860
  }
2492
2861
  /**
@@ -2507,7 +2876,15 @@ class ExtractionOrchestrator {
2507
2876
  * set is not exactly known (directory removals, event overflow): the full
2508
2877
  * scan-diff remains the ground truth those cases need (#1285).
2509
2878
  */
2510
- scopedPaths) {
2879
+ scopedPaths,
2880
+ /**
2881
+ * Writer-side WAL pressure valve (#1539). Called after every changed file
2882
+ * is stored, when no extraction transaction is open, so a checkpoint can
2883
+ * safely catch up before the next file grows the WAL further.
2884
+ */
2885
+ backpressure,
2886
+ /** Inspect changed inputs before deletion/re-extraction cascades their edges. */
2887
+ onFileChange) {
2511
2888
  await (0, grammars_1.initGrammars)(); // Initialize WASM runtime (grammars loaded lazily below)
2512
2889
  const startTime = Date.now();
2513
2890
  let filesChecked = 0;
@@ -2526,6 +2903,7 @@ class ExtractionOrchestrator {
2526
2903
  total: 0,
2527
2904
  });
2528
2905
  const filesToIndex = [];
2906
+ const failedFilePaths = [];
2529
2907
  // === Filesystem reconcile (git-independent) ===
2530
2908
  // The source of truth for "what changed" is the filesystem vs the indexed
2531
2909
  // state — never git. We enumerate the current source files and reconcile
@@ -2570,6 +2948,10 @@ class ExtractionOrchestrator {
2570
2948
  console.error(`[phase-timing] sync-scoped: ${Date.now() - tSyncScan}ms (${unique.length} paths, ${trackedFiles.length} tracked)`);
2571
2949
  }
2572
2950
  else {
2951
+ // Full reconcile: drop the memoized scope matcher so a nested
2952
+ // `.gitignore` / exclude-standard change that forced this full sync is
2953
+ // visible to the next scoped sync (#1728).
2954
+ this.scopedMatcher = null;
2573
2955
  currentFiles = await scanDirectoryAsync(this.rootDir);
2574
2956
  if (process.env.CODEGRAPH_SYNTH_TIMINGS)
2575
2957
  console.error(`[phase-timing] sync-scan: ${Date.now() - tSyncScan}ms (${currentFiles.length} files)`);
@@ -2593,30 +2975,34 @@ class ExtractionOrchestrator {
2593
2975
  // `reconcileChecks` drives the cooperative yield shared with the adds/mods loop
2594
2976
  // below (see SYNC_RECONCILE_YIELD_INTERVAL / issue #905).
2595
2977
  let reconcileChecks = 0;
2978
+ const removeTracked = (tracked) => {
2979
+ // Before the cascade deletes them, resurrect incoming cross-file
2980
+ // resolution edges as their original refs (#1240 removal case): the
2981
+ // callers live in files this sync will NOT revisit, so this is their
2982
+ // only chance to rebind to an alternative definition — or to park as
2983
+ // failed until the symbol reappears somewhere. (A deleted file whose
2984
+ // CALLERS are also being deleted is fine: their nodes cascade later
2985
+ // in this loop and take the resurrected rows with them.)
2986
+ // Every name this file defined is about to stop existing here, which
2987
+ // narrows the candidate set for that name repo-wide (CG-33).
2988
+ for (const pair of this.queries.getNodeNamePairsByFiles([tracked.path]))
2989
+ pairsBefore.add(pair);
2990
+ const incoming = this.queries.getCrossFileIncomingEdgesWithTarget(tracked.path);
2991
+ if (incoming.length > 0) {
2992
+ const resurrected = incoming
2993
+ .map((e) => resurrectRefFromDroppedEdge(e))
2994
+ .filter((r) => r !== null);
2995
+ if (resurrected.length > 0) {
2996
+ this.queries.insertUnresolvedRefsBatch(resurrected);
2997
+ }
2998
+ }
2999
+ onFileChange?.(tracked.path);
3000
+ this.queries.deleteFile(tracked.path);
3001
+ filesRemoved++;
3002
+ };
2596
3003
  for (const tracked of trackedFiles) {
2597
3004
  if (!currentSet.has(tracked.path) || !fs.existsSync(path.join(this.rootDir, tracked.path))) {
2598
- // Before the cascade deletes them, resurrect incoming cross-file
2599
- // resolution edges as their original refs (#1240 removal case): the
2600
- // callers live in files this sync will NOT revisit, so this is their
2601
- // only chance to rebind to an alternative definition — or to park as
2602
- // failed until the symbol reappears somewhere. (A deleted file whose
2603
- // CALLERS are also being deleted is fine: their nodes cascade later
2604
- // in this loop and take the resurrected rows with them.)
2605
- // Every name this file defined is about to stop existing here, which
2606
- // narrows the candidate set for that name repo-wide (CG-33).
2607
- for (const pair of this.queries.getNodeNamePairsByFiles([tracked.path]))
2608
- pairsBefore.add(pair);
2609
- const incoming = this.queries.getCrossFileIncomingEdgesWithTarget(tracked.path);
2610
- if (incoming.length > 0) {
2611
- const resurrected = incoming
2612
- .map((e) => resurrectRefFromDroppedEdge(e))
2613
- .filter((r) => r !== null);
2614
- if (resurrected.length > 0) {
2615
- this.queries.insertUnresolvedRefsBatch(resurrected);
2616
- }
2617
- }
2618
- this.queries.deleteFile(tracked.path);
2619
- filesRemoved++;
3005
+ removeTracked(tracked);
2620
3006
  }
2621
3007
  if (++reconcileChecks % SYNC_RECONCILE_YIELD_INTERVAL === 0) {
2622
3008
  await new Promise((resolve) => setImmediate(resolve));
@@ -2646,25 +3032,37 @@ class ExtractionOrchestrator {
2646
3032
  }
2647
3033
  catch (error) {
2648
3034
  (0, errors_1.logDebug)('Skipping unstattable file during sync', { filePath, error: String(error) });
3035
+ failedFilePaths.push(filePath);
2649
3036
  continue;
2650
3037
  }
2651
3038
  }
2652
3039
  // New, or size/mtime changed — read + hash to confirm a real content change.
3040
+ // (An oversize file hashes as its size stamp, unread — #1910.)
2653
3041
  let content;
2654
3042
  try {
2655
- content = fs.readFileSync(fullPath, 'utf-8');
3043
+ content = readSourceOrStamp(fullPath);
2656
3044
  }
2657
3045
  catch (error) {
2658
3046
  (0, errors_1.logDebug)('Skipping unreadable file during sync', { filePath, error: String(error) });
3047
+ failedFilePaths.push(filePath);
3048
+ continue;
3049
+ }
3050
+ // Not source after all — an MPEG transport stream named `.ts` (#1910):
3051
+ // a new one is ignored, a tracked file that became one is removed.
3052
+ if (content === null) {
3053
+ if (tracked)
3054
+ removeTracked(tracked);
2659
3055
  continue;
2660
3056
  }
2661
3057
  const contentHash = hashContent(content);
2662
3058
  if (!tracked) {
3059
+ onFileChange?.(filePath, content);
2663
3060
  filesToIndex.push(filePath);
2664
3061
  changedFilePaths.push(filePath);
2665
3062
  filesAdded++;
2666
3063
  }
2667
3064
  else if (tracked.contentHash !== contentHash) {
3065
+ onFileChange?.(filePath, content);
2668
3066
  filesToIndex.push(filePath);
2669
3067
  changedFilePaths.push(filePath);
2670
3068
  filesModified++;
@@ -2681,12 +3079,7 @@ class ExtractionOrchestrator {
2681
3079
  // Load only grammars needed for changed files
2682
3080
  if (filesToIndex.length > 0) {
2683
3081
  const overrides = (0, project_config_1.loadExtensionOverrides)(this.rootDir);
2684
- const neededLanguages = [...new Set(filesToIndex.map((f) => (0, grammars_1.detectLanguage)(f, undefined, overrides)))];
2685
- // .h files default to 'c' but may be C++ — ensure cpp grammar is loaded
2686
- if (neededLanguages.includes('c') && !neededLanguages.includes('cpp')) {
2687
- neededLanguages.push('cpp');
2688
- }
2689
- await (0, grammars_1.loadGrammarsForLanguages)(neededLanguages);
3082
+ await (0, grammars_1.loadGrammarsForLanguages)(preloadLanguagesForFiles(filesToIndex, overrides));
2690
3083
  }
2691
3084
  // Index changed files
2692
3085
  const total = filesToIndex.length;
@@ -2699,7 +3092,12 @@ class ExtractionOrchestrator {
2699
3092
  currentFile: filePath,
2700
3093
  });
2701
3094
  const result = await this.indexFile(filePath);
3095
+ if (result.errors.some(e => e.severity === 'error'))
3096
+ failedFilePaths.push(filePath);
2702
3097
  nodesUpdated += result.nodes.length;
3098
+ const pause = backpressure?.();
3099
+ if (pause)
3100
+ await pause;
2703
3101
  }
2704
3102
  // Names whose definition set this sync changed: a `file\0name` pair present
2705
3103
  // before but not after (removed/renamed away) or after but not before
@@ -2731,49 +3129,112 @@ class ExtractionOrchestrator {
2731
3129
  nodesUpdated,
2732
3130
  durationMs: Date.now() - startTime,
2733
3131
  changedFilePaths: changedFilePaths.length > 0 ? changedFilePaths : undefined,
3132
+ ...(failedFilePaths.length > 0 ? { failedFilePaths } : {}),
2734
3133
  definitionDelta: definitionDelta.length > 0 ? definitionDelta : undefined,
2735
3134
  };
2736
3135
  }
3136
+ indexedDirtyPaths(stamp) {
3137
+ try {
3138
+ const state = JSON.parse(this.queries.getMetadata('indexed_dirty_paths') ?? 'null');
3139
+ if (!state || state.commit !== (stamp ?? '') || !Array.isArray(state.paths))
3140
+ return null;
3141
+ if (!state.paths.every((p) => typeof p === 'string' && p.length > 0 &&
3142
+ !path.isAbsolute(p) && !p.split('/').includes('..')))
3143
+ return null;
3144
+ return state.paths;
3145
+ }
3146
+ catch {
3147
+ return null;
3148
+ }
3149
+ }
3150
+ /** Capture before file reads. In-flight/failed full writes must not claim freshness. */
3151
+ beginGitIndexState(full) {
3152
+ const head = getGitHeadSha(this.rootDir) ?? '';
3153
+ const stamp = this.queries.getMetadata(exports.INDEXED_AT_COMMIT_KEY) ?? '';
3154
+ const prior = this.indexedDirtyPaths(stamp);
3155
+ const status = getGitChangedFiles(this.rootDir);
3156
+ const dirty = status ? [...new Set([
3157
+ ...(full ? [] : prior ?? []), ...status.added, ...status.modified, ...status.deleted,
3158
+ ])] : null;
3159
+ if (full || prior === null || dirty === null) {
3160
+ this.queries.setMetadata(exports.INDEXED_AT_COMMIT_KEY, '');
3161
+ this.queries.setMetadata('indexed_dirty_paths', '');
3162
+ }
3163
+ else {
3164
+ // Scoped writes leave the commit alone and retain dirty paths before the
3165
+ // first write, so a crash cannot forget an indexed uncommitted edit.
3166
+ this.queries.setMetadata('indexed_dirty_paths', JSON.stringify({ commit: stamp, paths: dirty }));
3167
+ }
3168
+ return { head, stamp, dirty };
3169
+ }
3170
+ finishGitIndexState(snapshot, full, retries = []) {
3171
+ const after = getGitChangedFiles(this.rootDir);
3172
+ if (!snapshot.dirty || !after)
3173
+ return;
3174
+ const commit = full ? snapshot.head : snapshot.stamp;
3175
+ const paths = [...new Set([...snapshot.dirty, ...after.added, ...after.modified, ...after.deleted, ...retries])].sort();
3176
+ // The embedded commit makes a torn pair fail closed: readers reject a dirty
3177
+ // set that doesn't match the separately stored commit. Write the set first.
3178
+ this.queries.setMetadata('indexed_dirty_paths', JSON.stringify({ commit, paths }));
3179
+ if (full)
3180
+ this.queries.setMetadata(exports.INDEXED_AT_COMMIT_KEY, commit);
3181
+ }
2737
3182
  /**
2738
3183
  * Get files that have changed since last index.
2739
3184
  * Uses git status as a fast path when available, falling back to full scan.
2740
3185
  */
2741
3186
  getChangedFiles() {
2742
- const gitChanges = getGitChangedFiles(this.rootDir);
3187
+ // The commit this index was last brought up to date at. Absent on an index
3188
+ // built before stamping existed — getGitChangedFiles then declines the fast
3189
+ // path and the full scan below answers correctly, once, until a sync or a
3190
+ // full index writes the stamp. (#1829)
3191
+ let sinceCommit = null;
3192
+ try {
3193
+ sinceCommit = this.queries.getMetadata(exports.INDEXED_AT_COMMIT_KEY) ?? null;
3194
+ }
3195
+ catch { /* advisory */ }
3196
+ const dirtyPaths = this.indexedDirtyPaths(sinceCommit);
3197
+ const gitChanges = dirtyPaths !== null && canTrustGitFastPath(this.rootDir, sinceCommit)
3198
+ ? getGitChangedFiles(this.rootDir, sinceCommit)
3199
+ : null;
2743
3200
  if (gitChanges) {
2744
3201
  // === Git fast path ===
2745
3202
  const added = [];
2746
3203
  const modified = [];
2747
3204
  const removed = [];
2748
- // Deleted files — only report if tracked in DB
2749
- for (const filePath of gitChanges.deleted) {
3205
+ // Git supplies candidates, never the verdict. A committed deletion may
3206
+ // have been recreated locally; a previously indexed dirty path may have
3207
+ // vanished from git status after restore. Classify current disk vs DB once.
3208
+ const candidates = new Set([...gitChanges.deleted, ...gitChanges.modified, ...gitChanges.added, ...dirtyPaths]);
3209
+ const scope = this.scopedSyncMatcher();
3210
+ const overrides = (0, project_config_1.loadExtensionOverrides)(this.rootDir);
3211
+ for (const filePath of candidates) {
2750
3212
  const tracked = this.queries.getFileByPath(filePath);
2751
- if (tracked) {
2752
- removed.push(filePath);
2753
- }
2754
- }
2755
- // Modified + added files — read + hash, compare with DB. Untracked (`??`)
2756
- // files stay untracked in git even after indexing, so they must be
2757
- // hash-compared like modified files instead of always counting as added —
2758
- // otherwise status reports them as pending forever. (See issue #206.)
2759
- for (const filePath of [...gitChanges.modified, ...gitChanges.added]) {
2760
3213
  const fullPath = path.join(this.rootDir, filePath);
3214
+ if (!(0, grammars_1.isSourceFile)(filePath, overrides) || scope.ignores(filePath) || !fs.existsSync(fullPath)) {
3215
+ if (tracked)
3216
+ removed.push(filePath);
3217
+ continue;
3218
+ }
2761
3219
  let content;
2762
3220
  try {
2763
- content = fs.readFileSync(fullPath, 'utf-8');
3221
+ content = readSourceOrStamp(fullPath);
2764
3222
  }
2765
3223
  catch (error) {
2766
3224
  (0, errors_1.logDebug)('Skipping unreadable file while detecting changes', { filePath, error: String(error) });
2767
3225
  continue;
2768
3226
  }
2769
- const contentHash = hashContent(content);
2770
- const tracked = this.queries.getFileByPath(filePath);
2771
- if (!tracked) {
2772
- added.push(filePath);
3227
+ // A `.ts` that is an MPEG transport stream is not source (#1910), so an
3228
+ // untracked clip is never pending and a tracked file that became one is gone.
3229
+ if (content === null) {
3230
+ if (tracked)
3231
+ removed.push(filePath);
3232
+ continue;
2773
3233
  }
2774
- else if (tracked.contentHash !== contentHash) {
3234
+ if (!tracked)
3235
+ added.push(filePath);
3236
+ else if (tracked.contentHash !== hashContent(content))
2775
3237
  modified.push(filePath);
2776
- }
2777
3238
  }
2778
3239
  return { added, modified, removed };
2779
3240
  }
@@ -2799,14 +3260,20 @@ class ExtractionOrchestrator {
2799
3260
  const fullPath = path.join(this.rootDir, filePath);
2800
3261
  let content;
2801
3262
  try {
2802
- content = fs.readFileSync(fullPath, 'utf-8');
3263
+ content = readSourceOrStamp(fullPath);
2803
3264
  }
2804
3265
  catch (error) {
2805
3266
  (0, errors_1.logDebug)('Skipping unreadable file while detecting changes', { filePath, error: String(error) });
2806
3267
  continue;
2807
3268
  }
2808
- const contentHash = hashContent(content);
2809
3269
  const tracked = trackedMap.get(filePath);
3270
+ // An MPEG transport stream named `.ts` (#1910) is not source.
3271
+ if (content === null) {
3272
+ if (tracked)
3273
+ removed.push(filePath);
3274
+ continue;
3275
+ }
3276
+ const contentHash = hashContent(content);
2810
3277
  if (!tracked) {
2811
3278
  added.push(filePath);
2812
3279
  }