@lzehrung/codegraph 2.3.20 → 2.3.22

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 (1386) hide show
  1. package/README.md +6 -5
  2. package/THIRD_PARTY_NOTICES +4 -4
  3. package/codegraph-skill/codegraph/SKILL.md +97 -281
  4. package/dist/agent/call-hierarchy.d.ts +28 -0
  5. package/dist/agent/call-hierarchy.d.ts.map +1 -0
  6. package/dist/agent/call-hierarchy.js +82 -0
  7. package/dist/agent/call-hierarchy.js.map +1 -0
  8. package/dist/agent/candidate-tests.d.ts +12 -0
  9. package/dist/agent/candidate-tests.d.ts.map +1 -0
  10. package/dist/agent/candidate-tests.js +17 -0
  11. package/dist/agent/candidate-tests.js.map +1 -0
  12. package/dist/agent/explain.d.ts +8 -2
  13. package/dist/agent/explain.d.ts.map +1 -1
  14. package/dist/agent/explain.js +17 -3
  15. package/dist/agent/explain.js.map +1 -1
  16. package/dist/agent/explore.d.ts +3 -3
  17. package/dist/agent/explore.d.ts.map +1 -1
  18. package/dist/agent/explore.js +2 -2
  19. package/dist/agent/explore.js.map +1 -1
  20. package/dist/agent/file-view.d.ts +55 -0
  21. package/dist/agent/file-view.d.ts.map +1 -0
  22. package/dist/agent/file-view.js +521 -0
  23. package/dist/agent/file-view.js.map +1 -0
  24. package/dist/agent/follow-ups.d.ts +10 -0
  25. package/dist/agent/follow-ups.d.ts.map +1 -0
  26. package/dist/agent/follow-ups.js +175 -0
  27. package/dist/agent/follow-ups.js.map +1 -0
  28. package/dist/agent/normalize.d.ts +1 -1
  29. package/dist/agent/normalize.d.ts.map +1 -1
  30. package/dist/agent/normalize.js +2 -2
  31. package/dist/agent/normalize.js.map +1 -1
  32. package/dist/agent/orient.d.ts +1 -1
  33. package/dist/agent/orient.d.ts.map +1 -1
  34. package/dist/agent/orient.js +2 -2
  35. package/dist/agent/orient.js.map +1 -1
  36. package/dist/agent/packet.d.ts +1 -1
  37. package/dist/agent/packet.d.ts.map +1 -1
  38. package/dist/agent/packet.js +1 -1
  39. package/dist/agent/packet.js.map +1 -1
  40. package/dist/agent/query-index/candidates.d.ts +8 -2
  41. package/dist/agent/query-index/candidates.d.ts.map +1 -1
  42. package/dist/agent/query-index/candidates.js +12 -5
  43. package/dist/agent/query-index/candidates.js.map +1 -1
  44. package/dist/agent/query-index/content.js +2 -2
  45. package/dist/agent/query-index/content.js.map +1 -1
  46. package/dist/agent/query-index/query-index-worker.d.ts +8 -0
  47. package/dist/agent/query-index/query-index-worker.d.ts.map +1 -0
  48. package/dist/agent/query-index/query-index-worker.js +11 -0
  49. package/dist/agent/query-index/query-index-worker.js.map +1 -0
  50. package/dist/agent/query-index/session-store.d.ts +5 -0
  51. package/dist/agent/query-index/session-store.d.ts.map +1 -0
  52. package/dist/agent/query-index/session-store.js +69 -0
  53. package/dist/agent/query-index/session-store.js.map +1 -0
  54. package/dist/agent/query-index/source-identity.d.ts +3 -0
  55. package/dist/agent/query-index/source-identity.d.ts.map +1 -0
  56. package/dist/agent/query-index/source-identity.js +12 -0
  57. package/dist/agent/query-index/source-identity.js.map +1 -0
  58. package/dist/agent/query-index/store.d.ts +5 -1
  59. package/dist/agent/query-index/store.d.ts.map +1 -1
  60. package/dist/agent/query-index/store.js +98 -31
  61. package/dist/agent/query-index/store.js.map +1 -1
  62. package/dist/agent/query-index/update.js +3 -3
  63. package/dist/agent/query-index/update.js.map +1 -1
  64. package/dist/agent/query-index/worker-pool.d.ts +27 -0
  65. package/dist/agent/query-index/worker-pool.d.ts.map +1 -0
  66. package/dist/agent/query-index/worker-pool.js +114 -0
  67. package/dist/agent/query-index/worker-pool.js.map +1 -0
  68. package/dist/agent/refactor-plan.d.ts +40 -0
  69. package/dist/agent/refactor-plan.d.ts.map +1 -0
  70. package/dist/agent/refactor-plan.js +226 -0
  71. package/dist/agent/refactor-plan.js.map +1 -0
  72. package/dist/agent/rename-preview.d.ts +57 -0
  73. package/dist/agent/rename-preview.d.ts.map +1 -0
  74. package/dist/agent/rename-preview.js +1062 -0
  75. package/dist/agent/rename-preview.js.map +1 -0
  76. package/dist/agent/search.d.ts +8 -2
  77. package/dist/agent/search.d.ts.map +1 -1
  78. package/dist/agent/search.js +26 -9
  79. package/dist/agent/search.js.map +1 -1
  80. package/dist/agent/semantic-symbols.d.ts +16 -0
  81. package/dist/agent/semantic-symbols.d.ts.map +1 -0
  82. package/dist/agent/semantic-symbols.js +97 -0
  83. package/dist/agent/semantic-symbols.js.map +1 -0
  84. package/dist/agent/semantic.d.ts +1 -1
  85. package/dist/agent/semantic.d.ts.map +1 -1
  86. package/dist/agent/session-lifecycle.d.ts +5 -0
  87. package/dist/agent/session-lifecycle.d.ts.map +1 -0
  88. package/dist/agent/session-lifecycle.js +18 -0
  89. package/dist/agent/session-lifecycle.js.map +1 -0
  90. package/dist/agent/session.d.ts +3 -3
  91. package/dist/agent/session.d.ts.map +1 -1
  92. package/dist/agent/session.js +73 -26
  93. package/dist/agent/session.js.map +1 -1
  94. package/dist/agent/symbol-lookup.d.ts +12 -0
  95. package/dist/agent/symbol-lookup.d.ts.map +1 -0
  96. package/dist/agent/symbol-lookup.js +26 -0
  97. package/dist/agent/symbol-lookup.js.map +1 -0
  98. package/dist/agent/type-hierarchy.d.ts +39 -0
  99. package/dist/agent/type-hierarchy.d.ts.map +1 -0
  100. package/dist/agent/type-hierarchy.js +125 -0
  101. package/dist/agent/type-hierarchy.js.map +1 -0
  102. package/dist/agent/workspace-symbols.d.ts +18 -0
  103. package/dist/agent/workspace-symbols.d.ts.map +1 -0
  104. package/dist/agent/workspace-symbols.js +75 -0
  105. package/dist/agent/workspace-symbols.js.map +1 -0
  106. package/dist/agent-tools.d.ts +6 -6
  107. package/dist/agent-tools.d.ts.map +1 -1
  108. package/dist/agent-tools.js +6 -6
  109. package/dist/agent-tools.js.map +1 -1
  110. package/dist/agent.d.ts +18 -18
  111. package/dist/agent.d.ts.map +1 -1
  112. package/dist/agent.js +10 -10
  113. package/dist/agent.js.map +1 -1
  114. package/dist/analysis-summary.d.ts +19 -0
  115. package/dist/analysis-summary.d.ts.map +1 -0
  116. package/dist/analysis-summary.js +80 -0
  117. package/dist/analysis-summary.js.map +1 -0
  118. package/dist/bin/cli.js +37347 -36812
  119. package/dist/bin/query-index-worker.js +4382 -0
  120. package/dist/bin/raw-query-worker.js +383 -0
  121. package/dist/bootstrap/tree-sitter-languages.d.ts +5 -0
  122. package/dist/bootstrap/tree-sitter-languages.d.ts.map +1 -0
  123. package/dist/bootstrap/tree-sitter-languages.js +41 -0
  124. package/dist/bootstrap/tree-sitter-languages.js.map +1 -0
  125. package/dist/chunking/chunk-blocks.d.ts +9 -0
  126. package/dist/chunking/chunk-blocks.d.ts.map +1 -0
  127. package/dist/chunking/chunk-blocks.js +60 -0
  128. package/dist/chunking/chunk-blocks.js.map +1 -0
  129. package/dist/chunking/chunk-file.d.ts +39 -0
  130. package/dist/chunking/chunk-file.d.ts.map +1 -0
  131. package/dist/chunking/chunk-file.js +152 -0
  132. package/dist/chunking/chunk-file.js.map +1 -0
  133. package/dist/chunking/chunk-id.d.ts +7 -0
  134. package/dist/chunking/chunk-id.d.ts.map +1 -0
  135. package/dist/chunking/chunk-id.js +30 -0
  136. package/dist/chunking/chunk-id.js.map +1 -0
  137. package/dist/chunking/chunk-matches.d.ts +4 -0
  138. package/dist/chunking/chunk-matches.d.ts.map +1 -0
  139. package/dist/chunking/chunk-matches.js +65 -0
  140. package/dist/chunking/chunk-matches.js.map +1 -0
  141. package/dist/chunking/chunk-merge.d.ts +4 -0
  142. package/dist/chunking/chunk-merge.d.ts.map +1 -0
  143. package/dist/chunking/chunk-merge.js +144 -0
  144. package/dist/chunking/chunk-merge.js.map +1 -0
  145. package/dist/chunking/chunk-sfc.d.ts +18 -0
  146. package/dist/chunking/chunk-sfc.d.ts.map +1 -0
  147. package/dist/chunking/chunk-sfc.js +165 -0
  148. package/dist/chunking/chunk-sfc.js.map +1 -0
  149. package/dist/chunking/chunk-split.d.ts +6 -0
  150. package/dist/chunking/chunk-split.d.ts.map +1 -0
  151. package/dist/chunking/chunk-split.js +155 -0
  152. package/dist/chunking/chunk-split.js.map +1 -0
  153. package/dist/chunking/chunk-text-file.d.ts +28 -0
  154. package/dist/chunking/chunk-text-file.d.ts.map +1 -0
  155. package/dist/chunking/chunk-text-file.js +107 -0
  156. package/dist/chunking/chunk-text-file.js.map +1 -0
  157. package/dist/chunking/language-config.d.ts +35 -0
  158. package/dist/chunking/language-config.d.ts.map +1 -0
  159. package/dist/chunking/language-config.js +24 -0
  160. package/dist/chunking/language-config.js.map +1 -0
  161. package/dist/cli/affected.js +1 -1
  162. package/dist/cli/affected.js.map +1 -1
  163. package/dist/cli/call-hierarchy.d.ts +6 -0
  164. package/dist/cli/call-hierarchy.d.ts.map +1 -0
  165. package/dist/cli/call-hierarchy.js +72 -0
  166. package/dist/cli/call-hierarchy.js.map +1 -0
  167. package/dist/cli/chunk.js +5 -5
  168. package/dist/cli/chunk.js.map +1 -1
  169. package/dist/cli/command-catalog.d.ts +14 -0
  170. package/dist/cli/command-catalog.d.ts.map +1 -0
  171. package/dist/cli/command-catalog.js +118 -0
  172. package/dist/cli/command-catalog.js.map +1 -0
  173. package/dist/cli/command-table.d.ts +16 -0
  174. package/dist/cli/command-table.d.ts.map +1 -0
  175. package/dist/cli/command-table.js +758 -0
  176. package/dist/cli/command-table.js.map +1 -0
  177. package/dist/cli/compile-cache.d.ts +22 -0
  178. package/dist/cli/compile-cache.d.ts.map +1 -0
  179. package/dist/cli/compile-cache.js +81 -0
  180. package/dist/cli/compile-cache.js.map +1 -0
  181. package/dist/cli/discovery-globs.d.ts +11 -0
  182. package/dist/cli/discovery-globs.d.ts.map +1 -0
  183. package/dist/cli/discovery-globs.js +74 -0
  184. package/dist/cli/discovery-globs.js.map +1 -0
  185. package/dist/cli/doctor.d.ts +1 -1
  186. package/dist/cli/doctor.d.ts.map +1 -1
  187. package/dist/cli/doctor.js +3 -3
  188. package/dist/cli/doctor.js.map +1 -1
  189. package/dist/cli/drift.d.ts +1 -1
  190. package/dist/cli/drift.d.ts.map +1 -1
  191. package/dist/cli/duplicate-similarity.d.ts +10 -0
  192. package/dist/cli/duplicate-similarity.d.ts.map +1 -0
  193. package/dist/cli/duplicate-similarity.js +20 -0
  194. package/dist/cli/duplicate-similarity.js.map +1 -0
  195. package/dist/cli/file.js +2 -2
  196. package/dist/cli/file.js.map +1 -1
  197. package/dist/cli/graph-delta.d.ts +25 -0
  198. package/dist/cli/graph-delta.d.ts.map +1 -0
  199. package/dist/cli/graph-delta.js +80 -0
  200. package/dist/cli/graph-delta.js.map +1 -0
  201. package/dist/cli/graph-queries.d.ts +23 -0
  202. package/dist/cli/graph-queries.d.ts.map +1 -0
  203. package/dist/cli/graph-queries.js +265 -0
  204. package/dist/cli/graph-queries.js.map +1 -0
  205. package/dist/cli/graph.d.ts +2 -2
  206. package/dist/cli/graph.d.ts.map +1 -1
  207. package/dist/cli/graph.js +2 -2
  208. package/dist/cli/graph.js.map +1 -1
  209. package/dist/cli/grep.d.ts +1 -1
  210. package/dist/cli/grep.d.ts.map +1 -1
  211. package/dist/cli/grep.js +1 -1
  212. package/dist/cli/grep.js.map +1 -1
  213. package/dist/cli/help.d.ts +1 -1
  214. package/dist/cli/help.d.ts.map +1 -1
  215. package/dist/cli/help.js +2 -2
  216. package/dist/cli/help.js.map +1 -1
  217. package/dist/cli/impact.d.ts +2 -2
  218. package/dist/cli/impact.d.ts.map +1 -1
  219. package/dist/cli/impact.js +4 -4
  220. package/dist/cli/impact.js.map +1 -1
  221. package/dist/cli/index-policy.d.ts +36 -0
  222. package/dist/cli/index-policy.d.ts.map +1 -0
  223. package/dist/cli/index-policy.js +169 -0
  224. package/dist/cli/index-policy.js.map +1 -0
  225. package/dist/cli/index.d.ts +2 -2
  226. package/dist/cli/index.d.ts.map +1 -1
  227. package/dist/cli/index.js +1 -1
  228. package/dist/cli/index.js.map +1 -1
  229. package/dist/cli/inspect.d.ts +2 -2
  230. package/dist/cli/inspect.d.ts.map +1 -1
  231. package/dist/cli/inspect.js +2 -2
  232. package/dist/cli/inspect.js.map +1 -1
  233. package/dist/cli/invocation-context.d.ts +77 -0
  234. package/dist/cli/invocation-context.d.ts.map +1 -0
  235. package/dist/cli/invocation-context.js +423 -0
  236. package/dist/cli/invocation-context.js.map +1 -0
  237. package/dist/cli/links.d.ts +2 -2
  238. package/dist/cli/links.d.ts.map +1 -1
  239. package/dist/cli/links.js +1 -1
  240. package/dist/cli/links.js.map +1 -1
  241. package/dist/cli/location.d.ts +1 -1
  242. package/dist/cli/location.d.ts.map +1 -1
  243. package/dist/cli/location.js +1 -1
  244. package/dist/cli/location.js.map +1 -1
  245. package/dist/cli/navigation.d.ts +2 -2
  246. package/dist/cli/navigation.d.ts.map +1 -1
  247. package/dist/cli/navigation.js +2 -2
  248. package/dist/cli/navigation.js.map +1 -1
  249. package/dist/cli/packet.js +1 -1
  250. package/dist/cli/packet.js.map +1 -1
  251. package/dist/cli/project-file.d.ts +13 -0
  252. package/dist/cli/project-file.d.ts.map +1 -0
  253. package/dist/cli/project-file.js +23 -0
  254. package/dist/cli/project-file.js.map +1 -0
  255. package/dist/cli/refactor-plan.d.ts +6 -0
  256. package/dist/cli/refactor-plan.d.ts.map +1 -0
  257. package/dist/cli/refactor-plan.js +84 -0
  258. package/dist/cli/refactor-plan.js.map +1 -0
  259. package/dist/cli/rename-preview.d.ts +4 -0
  260. package/dist/cli/rename-preview.d.ts.map +1 -0
  261. package/dist/cli/rename-preview.js +92 -0
  262. package/dist/cli/rename-preview.js.map +1 -0
  263. package/dist/cli/review.d.ts +2 -2
  264. package/dist/cli/review.d.ts.map +1 -1
  265. package/dist/cli/review.js +4 -4
  266. package/dist/cli/review.js.map +1 -1
  267. package/dist/cli/root-policy.d.ts +53 -0
  268. package/dist/cli/root-policy.d.ts.map +1 -0
  269. package/dist/cli/root-policy.js +221 -0
  270. package/dist/cli/root-policy.js.map +1 -0
  271. package/dist/cli/server.js +5 -5
  272. package/dist/cli/server.js.map +1 -1
  273. package/dist/cli/skill.js +1 -1
  274. package/dist/cli/skill.js.map +1 -1
  275. package/dist/cli/symbols.js +1 -1
  276. package/dist/cli/symbols.js.map +1 -1
  277. package/dist/cli/type-hierarchy.d.ts +6 -0
  278. package/dist/cli/type-hierarchy.d.ts.map +1 -0
  279. package/dist/cli/type-hierarchy.js +90 -0
  280. package/dist/cli/type-hierarchy.js.map +1 -0
  281. package/dist/cli/viewer.js +2 -2
  282. package/dist/cli/viewer.js.map +1 -1
  283. package/dist/cli-bootstrap.d.ts +3 -0
  284. package/dist/cli-bootstrap.d.ts.map +1 -0
  285. package/dist/cli-bootstrap.js +10 -0
  286. package/dist/cli-bootstrap.js.map +1 -0
  287. package/dist/cli.d.ts +1 -1
  288. package/dist/cli.d.ts.map +1 -1
  289. package/dist/cli.js +5 -5
  290. package/dist/cli.js.map +1 -1
  291. package/dist/config.d.ts +1 -1
  292. package/dist/config.d.ts.map +1 -1
  293. package/dist/config.js +0 -1
  294. package/dist/config.js.map +1 -1
  295. package/dist/document-links/asciidoc.d.ts.map +1 -0
  296. package/dist/document-links/asciidoc.js.map +1 -0
  297. package/dist/document-links/check.d.ts +32 -0
  298. package/dist/document-links/check.d.ts.map +1 -0
  299. package/dist/document-links/check.js +286 -0
  300. package/dist/document-links/check.js.map +1 -0
  301. package/dist/document-links/html.d.ts.map +1 -0
  302. package/dist/document-links/html.js.map +1 -0
  303. package/dist/document-links/markdown.d.ts.map +1 -0
  304. package/dist/document-links/markdown.js.map +1 -0
  305. package/dist/document-links/rst.d.ts.map +1 -0
  306. package/dist/document-links/rst.js.map +1 -0
  307. package/dist/document-links/sfc.d.ts.map +1 -0
  308. package/dist/document-links/sfc.js.map +1 -0
  309. package/dist/document-links/shared.d.ts.map +1 -0
  310. package/dist/document-links/shared.js.map +1 -0
  311. package/dist/document-links.d.ts +12 -0
  312. package/dist/document-links.d.ts.map +1 -0
  313. package/dist/document-links.js +49 -0
  314. package/dist/document-links.js.map +1 -0
  315. package/dist/drift/snapshot.js +2 -2
  316. package/dist/drift/snapshot.js.map +1 -1
  317. package/dist/drift/types.d.ts +2 -2
  318. package/dist/drift/types.d.ts.map +1 -1
  319. package/dist/duplicates/unit-cache.d.ts +46 -0
  320. package/dist/duplicates/unit-cache.d.ts.map +1 -0
  321. package/dist/duplicates/unit-cache.js +512 -0
  322. package/dist/duplicates/unit-cache.js.map +1 -0
  323. package/dist/duplicates/units.d.ts +1 -1
  324. package/dist/duplicates/units.d.ts.map +1 -1
  325. package/dist/duplicates/units.js +6 -6
  326. package/dist/duplicates/units.js.map +1 -1
  327. package/dist/duplicates-leads.d.ts +39 -0
  328. package/dist/duplicates-leads.d.ts.map +1 -0
  329. package/dist/duplicates-leads.js +112 -0
  330. package/dist/duplicates-leads.js.map +1 -0
  331. package/dist/duplicates.d.ts +1 -1
  332. package/dist/duplicates.d.ts.map +1 -1
  333. package/dist/duplicates.js +2 -2
  334. package/dist/duplicates.js.map +1 -1
  335. package/dist/graph-builder.d.ts +1 -1
  336. package/dist/graph-builder.d.ts.map +1 -1
  337. package/dist/graph-builder.js +4 -4
  338. package/dist/graph-builder.js.map +1 -1
  339. package/dist/graph-edge-collector.d.ts +3 -3
  340. package/dist/graph-edge-collector.d.ts.map +1 -1
  341. package/dist/graph-edge-collector.js +6 -6
  342. package/dist/graph-edge-collector.js.map +1 -1
  343. package/dist/graphs/cycles.js +1 -1
  344. package/dist/graphs/cycles.js.map +1 -1
  345. package/dist/graphs/edge-resolution.d.ts +25 -0
  346. package/dist/graphs/edge-resolution.d.ts.map +1 -0
  347. package/dist/graphs/edge-resolution.js +97 -0
  348. package/dist/graphs/edge-resolution.js.map +1 -0
  349. package/dist/graphs/grep.d.ts +1 -1
  350. package/dist/graphs/grep.d.ts.map +1 -1
  351. package/dist/graphs/grep.js +4 -4
  352. package/dist/graphs/grep.js.map +1 -1
  353. package/dist/graphs/specifiers.d.ts +1 -1
  354. package/dist/graphs/specifiers.d.ts.map +1 -1
  355. package/dist/graphs/specifiers.js +5 -5
  356. package/dist/graphs/specifiers.js.map +1 -1
  357. package/dist/graphs/symbol-graph-detailed/ast.d.ts +0 -1
  358. package/dist/graphs/symbol-graph-detailed/ast.d.ts.map +1 -1
  359. package/dist/graphs/symbol-graph-detailed/ast.js +1 -8
  360. package/dist/graphs/symbol-graph-detailed/ast.js.map +1 -1
  361. package/dist/graphs/symbol-graph-detailed/edge-passes.d.ts +35 -0
  362. package/dist/graphs/symbol-graph-detailed/edge-passes.d.ts.map +1 -0
  363. package/dist/graphs/symbol-graph-detailed/edge-passes.js +676 -0
  364. package/dist/graphs/symbol-graph-detailed/edge-passes.js.map +1 -0
  365. package/dist/graphs/symbol-graph-detailed/import-aliases.d.ts +10 -0
  366. package/dist/graphs/symbol-graph-detailed/import-aliases.d.ts.map +1 -0
  367. package/dist/graphs/symbol-graph-detailed/import-aliases.js +44 -0
  368. package/dist/graphs/symbol-graph-detailed/import-aliases.js.map +1 -0
  369. package/dist/graphs/symbol-graph-detailed/member-chains.d.ts +17 -0
  370. package/dist/graphs/symbol-graph-detailed/member-chains.d.ts.map +1 -0
  371. package/dist/graphs/symbol-graph-detailed/member-chains.js +30 -0
  372. package/dist/graphs/symbol-graph-detailed/member-chains.js.map +1 -0
  373. package/dist/graphs/symbol-graph-detailed/receiver-calls.d.ts +69 -0
  374. package/dist/graphs/symbol-graph-detailed/receiver-calls.d.ts.map +1 -0
  375. package/dist/graphs/symbol-graph-detailed/receiver-calls.js +408 -0
  376. package/dist/graphs/symbol-graph-detailed/receiver-calls.js.map +1 -0
  377. package/dist/graphs/symbol-graph-detailed.d.ts.map +1 -1
  378. package/dist/graphs/symbol-graph-detailed.js +22 -12
  379. package/dist/graphs/symbol-graph-detailed.js.map +1 -1
  380. package/dist/graphs/types.d.ts +1 -1
  381. package/dist/graphs/types.d.ts.map +1 -1
  382. package/dist/graphs/unresolved.js +1 -1
  383. package/dist/graphs/unresolved.js.map +1 -1
  384. package/dist/impact/analyzer.js +4 -4
  385. package/dist/impact/analyzer.js.map +1 -1
  386. package/dist/impact/call-compatibility/text-scanner.d.ts +23 -0
  387. package/dist/impact/call-compatibility/text-scanner.d.ts.map +1 -0
  388. package/dist/impact/call-compatibility/text-scanner.js +615 -0
  389. package/dist/impact/call-compatibility/text-scanner.js.map +1 -0
  390. package/dist/impact/call-compatibility.d.ts +24 -0
  391. package/dist/impact/call-compatibility.d.ts.map +1 -0
  392. package/dist/impact/call-compatibility.js +1023 -0
  393. package/dist/impact/call-compatibility.js.map +1 -0
  394. package/dist/impact/context.js +1 -1
  395. package/dist/impact/context.js.map +1 -1
  396. package/dist/impact/direct.d.ts +1 -1
  397. package/dist/impact/direct.d.ts.map +1 -1
  398. package/dist/impact/index.d.ts +1 -1
  399. package/dist/impact/index.d.ts.map +1 -1
  400. package/dist/impact/index.js +1 -1
  401. package/dist/impact/index.js.map +1 -1
  402. package/dist/impact/map.js +1 -1
  403. package/dist/impact/map.js.map +1 -1
  404. package/dist/impact/member-resolution-coverage.d.ts +14 -0
  405. package/dist/impact/member-resolution-coverage.d.ts.map +1 -0
  406. package/dist/impact/member-resolution-coverage.js +42 -0
  407. package/dist/impact/member-resolution-coverage.js.map +1 -0
  408. package/dist/impact/reference-cache.d.ts +12 -0
  409. package/dist/impact/reference-cache.d.ts.map +1 -0
  410. package/dist/impact/reference-cache.js +101 -0
  411. package/dist/impact/reference-cache.js.map +1 -0
  412. package/dist/impact/report-compact.d.ts +8 -0
  413. package/dist/impact/report-compact.d.ts.map +1 -0
  414. package/dist/impact/report-compact.js +153 -0
  415. package/dist/impact/report-compact.js.map +1 -0
  416. package/dist/impact/report-full.d.ts +10 -0
  417. package/dist/impact/report-full.d.ts.map +1 -0
  418. package/dist/impact/report-full.js +67 -0
  419. package/dist/impact/report-full.js.map +1 -0
  420. package/dist/impact/report-parts.d.ts +51 -0
  421. package/dist/impact/report-parts.d.ts.map +1 -0
  422. package/dist/impact/report-parts.js +2 -0
  423. package/dist/impact/report-parts.js.map +1 -0
  424. package/dist/impact/report-shared.d.ts +76 -0
  425. package/dist/impact/report-shared.d.ts.map +1 -0
  426. package/dist/impact/report-shared.js +130 -0
  427. package/dist/impact/report-shared.js.map +1 -0
  428. package/dist/impact/report-suggestions.js +2 -2
  429. package/dist/impact/report-suggestions.js.map +1 -1
  430. package/dist/impact/report.js +5 -5
  431. package/dist/impact/report.js.map +1 -1
  432. package/dist/impact/streaming.d.ts +1 -1
  433. package/dist/impact/streaming.d.ts.map +1 -1
  434. package/dist/impact/streaming.js +2 -2
  435. package/dist/impact/streaming.js.map +1 -1
  436. package/dist/impact/test-patterns.d.ts +6 -0
  437. package/dist/impact/test-patterns.d.ts.map +1 -0
  438. package/dist/impact/test-patterns.js +65 -0
  439. package/dist/impact/test-patterns.js.map +1 -0
  440. package/dist/impact/transitive.js +1 -1
  441. package/dist/impact/transitive.js.map +1 -1
  442. package/dist/impact/types.d.ts +3 -3
  443. package/dist/impact/types.d.ts.map +1 -1
  444. package/dist/impact/types.js +1 -1
  445. package/dist/impact/types.js.map +1 -1
  446. package/dist/index.d.ts +10 -10
  447. package/dist/index.d.ts.map +1 -1
  448. package/dist/index.js +9 -9
  449. package/dist/index.js.map +1 -1
  450. package/dist/indexer/build-cache/manifest.d.ts +4 -4
  451. package/dist/indexer/build-cache/manifest.d.ts.map +1 -1
  452. package/dist/indexer/build-cache/manifest.js +9 -34
  453. package/dist/indexer/build-cache/manifest.js.map +1 -1
  454. package/dist/indexer/build-cache/module-cache.d.ts +1 -1
  455. package/dist/indexer/build-cache/module-cache.d.ts.map +1 -1
  456. package/dist/indexer/build-cache/module-cache.js +4 -4
  457. package/dist/indexer/build-cache/module-cache.js.map +1 -1
  458. package/dist/indexer/build-cache/options.d.ts +6 -4
  459. package/dist/indexer/build-cache/options.d.ts.map +1 -1
  460. package/dist/indexer/build-cache/options.js +9 -7
  461. package/dist/indexer/build-cache/options.js.map +1 -1
  462. package/dist/indexer/build-cache/project-snapshot.d.ts +1 -1
  463. package/dist/indexer/build-cache/project-snapshot.d.ts.map +1 -1
  464. package/dist/indexer/build-cache/project-snapshot.js +16 -19
  465. package/dist/indexer/build-cache/project-snapshot.js.map +1 -1
  466. package/dist/indexer/build-cache/reports.js +1 -1
  467. package/dist/indexer/build-cache/reports.js.map +1 -1
  468. package/dist/indexer/build-cache/resolver-environment.d.ts +6 -2
  469. package/dist/indexer/build-cache/resolver-environment.d.ts.map +1 -1
  470. package/dist/indexer/build-cache/resolver-environment.js +41 -5
  471. package/dist/indexer/build-cache/resolver-environment.js.map +1 -1
  472. package/dist/indexer/build-index.d.ts.map +1 -1
  473. package/dist/indexer/build-index.js +63 -29
  474. package/dist/indexer/build-index.js.map +1 -1
  475. package/dist/indexer/build-manifest.d.ts +3 -0
  476. package/dist/indexer/build-manifest.d.ts.map +1 -1
  477. package/dist/indexer/build-manifest.js +1 -1
  478. package/dist/indexer/build-manifest.js.map +1 -1
  479. package/dist/indexer/build-workers.d.ts +1 -1
  480. package/dist/indexer/build-workers.d.ts.map +1 -1
  481. package/dist/indexer/build-workers.js +6 -6
  482. package/dist/indexer/build-workers.js.map +1 -1
  483. package/dist/indexer/finalize.d.ts +3 -2
  484. package/dist/indexer/finalize.d.ts.map +1 -1
  485. package/dist/indexer/finalize.js +2 -1
  486. package/dist/indexer/finalize.js.map +1 -1
  487. package/dist/indexer/imports/graph-only.d.ts +13 -0
  488. package/dist/indexer/imports/graph-only.d.ts.map +1 -0
  489. package/dist/indexer/imports/graph-only.js +40 -0
  490. package/dist/indexer/imports/graph-only.js.map +1 -0
  491. package/dist/indexer/imports/js-text-imports.d.ts +9 -0
  492. package/dist/indexer/imports/js-text-imports.d.ts.map +1 -0
  493. package/dist/indexer/imports/js-text-imports.js +181 -0
  494. package/dist/indexer/imports/js-text-imports.js.map +1 -0
  495. package/dist/indexer/imports/language-specific.d.ts +26 -0
  496. package/dist/indexer/imports/language-specific.d.ts.map +1 -0
  497. package/dist/indexer/imports/language-specific.js +449 -0
  498. package/dist/indexer/imports/language-specific.js.map +1 -0
  499. package/dist/indexer/imports/native-captures.d.ts +16 -0
  500. package/dist/indexer/imports/native-captures.d.ts.map +1 -0
  501. package/dist/indexer/imports/native-captures.js +142 -0
  502. package/dist/indexer/imports/native-captures.js.map +1 -0
  503. package/dist/indexer/imports.d.ts +1 -1
  504. package/dist/indexer/imports.d.ts.map +1 -1
  505. package/dist/indexer/imports.js +7 -7
  506. package/dist/indexer/imports.js.map +1 -1
  507. package/dist/indexer/incremental-plan.d.ts +4 -3
  508. package/dist/indexer/incremental-plan.d.ts.map +1 -1
  509. package/dist/indexer/incremental-plan.js +9 -5
  510. package/dist/indexer/incremental-plan.js.map +1 -1
  511. package/dist/indexer/locals-and-exports.d.ts +1 -1
  512. package/dist/indexer/locals-and-exports.d.ts.map +1 -1
  513. package/dist/indexer/locals-and-exports.js +5 -5
  514. package/dist/indexer/locals-and-exports.js.map +1 -1
  515. package/dist/indexer/navigation-goto.js +1 -1
  516. package/dist/indexer/navigation-goto.js.map +1 -1
  517. package/dist/indexer/navigation-local.d.ts +2 -1
  518. package/dist/indexer/navigation-local.d.ts.map +1 -1
  519. package/dist/indexer/navigation-local.js +26 -21
  520. package/dist/indexer/navigation-local.js.map +1 -1
  521. package/dist/indexer/navigation.js +1 -1
  522. package/dist/indexer/navigation.js.map +1 -1
  523. package/dist/indexer/parse-context.d.ts +2 -2
  524. package/dist/indexer/parse-context.d.ts.map +1 -1
  525. package/dist/indexer/parse-context.js +5 -5
  526. package/dist/indexer/parse-context.js.map +1 -1
  527. package/dist/indexer/scope.d.ts +1 -1
  528. package/dist/indexer/scope.d.ts.map +1 -1
  529. package/dist/indexer/scope.js +2 -2
  530. package/dist/indexer/scope.js.map +1 -1
  531. package/dist/indexer/shared.d.ts +1 -1
  532. package/dist/indexer/shared.d.ts.map +1 -1
  533. package/dist/indexer/shared.js +1 -1
  534. package/dist/indexer/shared.js.map +1 -1
  535. package/dist/indexer/symbols.js +1 -1
  536. package/dist/indexer/symbols.js.map +1 -1
  537. package/dist/indexer/types.d.ts +4 -2
  538. package/dist/indexer/types.d.ts.map +1 -1
  539. package/dist/indexer.d.ts +2 -2
  540. package/dist/indexer.d.ts.map +1 -1
  541. package/dist/installer/locks.js +1 -1
  542. package/dist/installer/locks.js.map +1 -1
  543. package/dist/installer/registry.js +1 -1
  544. package/dist/installer/registry.js.map +1 -1
  545. package/dist/languages/definitions/adoc.js +1 -1
  546. package/dist/languages/definitions/adoc.js.map +1 -1
  547. package/dist/languages/definitions/astro.js +1 -1
  548. package/dist/languages/definitions/astro.js.map +1 -1
  549. package/dist/languages/definitions/c-family.d.ts +34 -0
  550. package/dist/languages/definitions/c-family.d.ts.map +1 -0
  551. package/dist/languages/definitions/c-family.js +177 -0
  552. package/dist/languages/definitions/c-family.js.map +1 -0
  553. package/dist/languages/definitions/c.js +1 -1
  554. package/dist/languages/definitions/c.js.map +1 -1
  555. package/dist/languages/definitions/cpp.js +1 -1
  556. package/dist/languages/definitions/cpp.js.map +1 -1
  557. package/dist/languages/definitions/css-like.d.ts +5 -0
  558. package/dist/languages/definitions/css-like.d.ts.map +1 -0
  559. package/dist/languages/definitions/css-like.js +32 -0
  560. package/dist/languages/definitions/css-like.js.map +1 -0
  561. package/dist/languages/definitions/css.js +1 -1
  562. package/dist/languages/definitions/css.js.map +1 -1
  563. package/dist/languages/definitions/hbs.js +1 -1
  564. package/dist/languages/definitions/hbs.js.map +1 -1
  565. package/dist/languages/definitions/html-stub.d.ts +18 -0
  566. package/dist/languages/definitions/html-stub.d.ts.map +1 -0
  567. package/dist/languages/definitions/html-stub.js +36 -0
  568. package/dist/languages/definitions/html-stub.js.map +1 -0
  569. package/dist/languages/definitions/javascript.js +1 -1
  570. package/dist/languages/definitions/javascript.js.map +1 -1
  571. package/dist/languages/definitions/js-family.d.ts +5 -0
  572. package/dist/languages/definitions/js-family.d.ts.map +1 -0
  573. package/dist/languages/definitions/js-family.js +75 -0
  574. package/dist/languages/definitions/js-family.js.map +1 -0
  575. package/dist/languages/definitions/less.js +1 -1
  576. package/dist/languages/definitions/less.js.map +1 -1
  577. package/dist/languages/definitions/markdown.js +1 -1
  578. package/dist/languages/definitions/markdown.js.map +1 -1
  579. package/dist/languages/definitions/mdx.js +1 -1
  580. package/dist/languages/definitions/mdx.js.map +1 -1
  581. package/dist/languages/definitions/rst.js +1 -1
  582. package/dist/languages/definitions/rst.js.map +1 -1
  583. package/dist/languages/definitions/typescript.js +1 -1
  584. package/dist/languages/definitions/typescript.js.map +1 -1
  585. package/dist/languages/file-prep.d.ts +36 -0
  586. package/dist/languages/file-prep.d.ts.map +1 -0
  587. package/dist/languages/file-prep.js +76 -0
  588. package/dist/languages/file-prep.js.map +1 -0
  589. package/dist/languages/import-statement-parsers.d.ts +57 -0
  590. package/dist/languages/import-statement-parsers.d.ts.map +1 -0
  591. package/dist/languages/import-statement-parsers.js +383 -0
  592. package/dist/languages/import-statement-parsers.js.map +1 -0
  593. package/dist/languages/query-generator.d.ts +6 -0
  594. package/dist/languages/query-generator.d.ts.map +1 -0
  595. package/dist/languages/query-generator.js +46 -0
  596. package/dist/languages/query-generator.js.map +1 -0
  597. package/dist/lifecycle/manifest.d.ts +1 -1
  598. package/dist/lifecycle/manifest.d.ts.map +1 -1
  599. package/dist/lifecycle/manifest.js +6 -4
  600. package/dist/lifecycle/manifest.js.map +1 -1
  601. package/dist/mcp/handlers.d.ts +7 -7
  602. package/dist/mcp/handlers.d.ts.map +1 -1
  603. package/dist/mcp/handlers.js +12 -15
  604. package/dist/mcp/handlers.js.map +1 -1
  605. package/dist/mcp/http-transport.d.ts +14 -0
  606. package/dist/mcp/http-transport.d.ts.map +1 -0
  607. package/dist/mcp/http-transport.js +185 -0
  608. package/dist/mcp/http-transport.js.map +1 -0
  609. package/dist/mcp/legacy-sessions.d.ts +38 -0
  610. package/dist/mcp/legacy-sessions.d.ts.map +1 -0
  611. package/dist/mcp/legacy-sessions.js +264 -0
  612. package/dist/mcp/legacy-sessions.js.map +1 -0
  613. package/dist/mcp/lifecycle-health.d.ts +12 -0
  614. package/dist/mcp/lifecycle-health.d.ts.map +1 -0
  615. package/dist/mcp/lifecycle-health.js +37 -0
  616. package/dist/mcp/lifecycle-health.js.map +1 -0
  617. package/dist/mcp/protocol.d.ts +1 -1
  618. package/dist/mcp/protocol.d.ts.map +1 -1
  619. package/dist/mcp/protocol.js +3 -3
  620. package/dist/mcp/protocol.js.map +1 -1
  621. package/dist/mcp/security.js +1 -1
  622. package/dist/mcp/security.js.map +1 -1
  623. package/dist/mcp/server.d.ts +4 -4
  624. package/dist/mcp/server.d.ts.map +1 -1
  625. package/dist/mcp/server.js +6 -6
  626. package/dist/mcp/server.js.map +1 -1
  627. package/dist/mcp/sqlite-guard.d.ts +3 -0
  628. package/dist/mcp/sqlite-guard.d.ts.map +1 -0
  629. package/dist/mcp/sqlite-guard.js +35 -0
  630. package/dist/mcp/sqlite-guard.js.map +1 -0
  631. package/dist/mcp/stdio-lifecycle.d.ts +23 -0
  632. package/dist/mcp/stdio-lifecycle.d.ts.map +1 -0
  633. package/dist/mcp/stdio-lifecycle.js +83 -0
  634. package/dist/mcp/stdio-lifecycle.js.map +1 -0
  635. package/dist/mcp/tools.js +2 -2
  636. package/dist/mcp/tools.js.map +1 -1
  637. package/dist/native/binding-loader.d.ts +51 -0
  638. package/dist/native/binding-loader.d.ts.map +1 -0
  639. package/dist/native/binding-loader.js +223 -0
  640. package/dist/native/binding-loader.js.map +1 -0
  641. package/dist/native/byte-index.d.ts +26 -0
  642. package/dist/native/byte-index.d.ts.map +1 -0
  643. package/dist/native/byte-index.js +70 -0
  644. package/dist/native/byte-index.js.map +1 -0
  645. package/dist/native/execution.js +1 -1
  646. package/dist/native/execution.js.map +1 -1
  647. package/dist/native/js-bridge.d.ts +7 -0
  648. package/dist/native/js-bridge.d.ts.map +1 -0
  649. package/dist/native/js-bridge.js +20 -0
  650. package/dist/native/js-bridge.js.map +1 -0
  651. package/dist/native/native-backend-report.d.ts +22 -0
  652. package/dist/native/native-backend-report.d.ts.map +1 -0
  653. package/dist/native/native-backend-report.js +102 -0
  654. package/dist/native/native-backend-report.js.map +1 -0
  655. package/dist/native/projected-tree.d.ts +53 -0
  656. package/dist/native/projected-tree.d.ts.map +1 -0
  657. package/dist/native/projected-tree.js +180 -0
  658. package/dist/native/projected-tree.js.map +1 -0
  659. package/dist/native/query-results.d.ts +12 -0
  660. package/dist/native/query-results.d.ts.map +1 -0
  661. package/dist/native/query-results.js +34 -0
  662. package/dist/native/query-results.js.map +1 -0
  663. package/dist/native/runtime-cache.d.ts +128 -0
  664. package/dist/native/runtime-cache.d.ts.map +1 -0
  665. package/dist/native/runtime-cache.js +667 -0
  666. package/dist/native/runtime-cache.js.map +1 -0
  667. package/dist/native/runtime.js +3 -3
  668. package/dist/native/runtime.js.map +1 -1
  669. package/dist/native/tree-shape.d.ts +21 -0
  670. package/dist/native/tree-shape.d.ts.map +1 -0
  671. package/dist/native/tree-shape.js +28 -0
  672. package/dist/native/tree-shape.js.map +1 -0
  673. package/dist/native/tree-sitter-native.d.ts +6 -0
  674. package/dist/native/tree-sitter-native.d.ts.map +1 -0
  675. package/dist/native/tree-sitter-native.js +5 -0
  676. package/dist/native/tree-sitter-native.js.map +1 -0
  677. package/dist/review/deleted.js +2 -2
  678. package/dist/review/deleted.js.map +1 -1
  679. package/dist/review/report.d.ts +3 -3
  680. package/dist/review/report.d.ts.map +1 -1
  681. package/dist/review/report.js +2 -2
  682. package/dist/review/report.js.map +1 -1
  683. package/dist/review/summaries.js +3 -3
  684. package/dist/review/summaries.js.map +1 -1
  685. package/dist/review/types.d.ts +3 -3
  686. package/dist/review/types.d.ts.map +1 -1
  687. package/dist/review.js +3 -3
  688. package/dist/review.js.map +1 -1
  689. package/dist/runtime-identity.d.ts +27 -0
  690. package/dist/runtime-identity.d.ts.map +1 -0
  691. package/dist/runtime-identity.js +75 -0
  692. package/dist/runtime-identity.js.map +1 -0
  693. package/dist/session.js +1 -1
  694. package/dist/session.js.map +1 -1
  695. package/dist/sql/classify-sql-file.d.ts +3 -0
  696. package/dist/sql/classify-sql-file.d.ts.map +1 -0
  697. package/dist/sql/classify-sql-file.js +42 -0
  698. package/dist/sql/classify-sql-file.js.map +1 -0
  699. package/dist/sql/extract-facts.d.ts +4 -0
  700. package/dist/sql/extract-facts.d.ts.map +1 -0
  701. package/dist/sql/extract-facts.js +511 -0
  702. package/dist/sql/extract-facts.js.map +1 -0
  703. package/dist/sql/graph.js +1 -1
  704. package/dist/sql/graph.js.map +1 -1
  705. package/dist/sql/index.d.ts +2 -2
  706. package/dist/sql/index.d.ts.map +1 -1
  707. package/dist/sql/index.js +2 -2
  708. package/dist/sql/index.js.map +1 -1
  709. package/dist/sql/navigation.js +1 -1
  710. package/dist/sql/navigation.js.map +1 -1
  711. package/dist/sql/review.js +2 -2
  712. package/dist/sql/review.js.map +1 -1
  713. package/dist/sql/source-graph.d.ts +19 -0
  714. package/dist/sql/source-graph.d.ts.map +1 -0
  715. package/dist/sql/source-graph.js +195 -0
  716. package/dist/sql/source-graph.js.map +1 -0
  717. package/dist/sqlite/query.d.ts +2 -2
  718. package/dist/sqlite/query.d.ts.map +1 -1
  719. package/dist/sqlite/query.js +3 -3
  720. package/dist/sqlite/query.js.map +1 -1
  721. package/dist/sqlite/raw-query-worker-pool.d.ts +66 -0
  722. package/dist/sqlite/raw-query-worker-pool.d.ts.map +1 -0
  723. package/dist/sqlite/raw-query-worker-pool.js +146 -0
  724. package/dist/sqlite/raw-query-worker-pool.js.map +1 -0
  725. package/dist/sqlite/raw-query-worker.d.ts +22 -0
  726. package/dist/sqlite/raw-query-worker.d.ts.map +1 -0
  727. package/dist/sqlite/raw-query-worker.js +31 -0
  728. package/dist/sqlite/raw-query-worker.js.map +1 -0
  729. package/dist/sqlite/row-bounds.d.ts +24 -0
  730. package/dist/sqlite/row-bounds.d.ts.map +1 -0
  731. package/dist/sqlite/row-bounds.js +95 -0
  732. package/dist/sqlite/row-bounds.js.map +1 -0
  733. package/dist/sqlite-driver.js +1 -1
  734. package/dist/sqlite-driver.js.map +1 -1
  735. package/dist/util/bloom-filter.d.ts +100 -0
  736. package/dist/util/bloom-filter.d.ts.map +1 -0
  737. package/dist/util/bloom-filter.js +206 -0
  738. package/dist/util/bloom-filter.js.map +1 -0
  739. package/dist/util/confined-file.d.ts +48 -0
  740. package/dist/util/confined-file.d.ts.map +1 -0
  741. package/dist/util/confined-file.js +164 -0
  742. package/dist/util/confined-file.js.map +1 -0
  743. package/dist/util/discovery-path.d.ts +3 -0
  744. package/dist/util/discovery-path.d.ts.map +1 -0
  745. package/dist/util/discovery-path.js +19 -0
  746. package/dist/util/discovery-path.js.map +1 -0
  747. package/dist/util/git.d.ts +13 -10
  748. package/dist/util/git.d.ts.map +1 -1
  749. package/dist/util/git.js +29 -25
  750. package/dist/util/git.js.map +1 -1
  751. package/dist/util/graph-edges.d.ts +5 -0
  752. package/dist/util/graph-edges.d.ts.map +1 -0
  753. package/dist/util/graph-edges.js +42 -0
  754. package/dist/util/graph-edges.js.map +1 -0
  755. package/dist/util/graph-only-extensions.d.ts +5 -0
  756. package/dist/util/graph-only-extensions.d.ts.map +1 -0
  757. package/dist/util/graph-only-extensions.js +12 -0
  758. package/dist/util/graph-only-extensions.js.map +1 -0
  759. package/dist/util/include-roots.d.ts +6 -0
  760. package/dist/util/include-roots.d.ts.map +1 -0
  761. package/dist/util/include-roots.js +53 -0
  762. package/dist/util/include-roots.js.map +1 -0
  763. package/dist/util/lazy-symbols.d.ts +166 -0
  764. package/dist/util/lazy-symbols.d.ts.map +1 -0
  765. package/dist/util/lazy-symbols.js +365 -0
  766. package/dist/util/lazy-symbols.js.map +1 -0
  767. package/dist/util/lru-map.d.ts +3 -0
  768. package/dist/util/lru-map.d.ts.map +1 -0
  769. package/dist/util/lru-map.js +22 -0
  770. package/dist/util/lru-map.js.map +1 -0
  771. package/dist/util/member-access.d.ts +26 -0
  772. package/dist/util/member-access.d.ts.map +1 -0
  773. package/dist/util/member-access.js +185 -0
  774. package/dist/util/member-access.js.map +1 -0
  775. package/dist/util/package-exports.d.ts +25 -0
  776. package/dist/util/package-exports.d.ts.map +1 -0
  777. package/dist/util/package-exports.js +79 -0
  778. package/dist/util/package-exports.js.map +1 -0
  779. package/dist/util/package-info.d.ts +12 -0
  780. package/dist/util/package-info.d.ts.map +1 -0
  781. package/dist/util/package-info.js +57 -0
  782. package/dist/util/package-info.js.map +1 -0
  783. package/dist/util/partial-results.d.ts +81 -0
  784. package/dist/util/partial-results.d.ts.map +1 -0
  785. package/dist/util/partial-results.js +290 -0
  786. package/dist/util/partial-results.js.map +1 -0
  787. package/dist/util/project-files/definitions.d.ts +40 -0
  788. package/dist/util/project-files/definitions.d.ts.map +1 -0
  789. package/dist/util/project-files/definitions.js.map +1 -0
  790. package/dist/util/project-files/parsers.d.ts.map +1 -0
  791. package/dist/util/project-files/parsers.js.map +1 -0
  792. package/dist/util/project-files.d.ts +153 -0
  793. package/dist/util/project-files.d.ts.map +1 -0
  794. package/dist/util/project-files.js +1460 -0
  795. package/dist/util/project-files.js.map +1 -0
  796. package/dist/util/resolution/find-first-existing.d.ts +2 -0
  797. package/dist/util/resolution/find-first-existing.d.ts.map +1 -0
  798. package/dist/util/resolution/find-first-existing.js +13 -0
  799. package/dist/util/resolution/find-first-existing.js.map +1 -0
  800. package/dist/util/resolution/jvm.js +1 -1
  801. package/dist/util/resolution/jvm.js.map +1 -1
  802. package/dist/util/resolution/node.d.ts +1 -1
  803. package/dist/util/resolution/node.d.ts.map +1 -1
  804. package/dist/util/resolution/node.js +2 -2
  805. package/dist/util/resolution/node.js.map +1 -1
  806. package/dist/util/resolution/php-composer.d.ts +17 -0
  807. package/dist/util/resolution/php-composer.d.ts.map +1 -0
  808. package/dist/util/resolution/php-composer.js +269 -0
  809. package/dist/util/resolution/php-composer.js.map +1 -0
  810. package/dist/util/resolution/php.d.ts +1 -1
  811. package/dist/util/resolution/php.d.ts.map +1 -1
  812. package/dist/util/resolution/php.js +4 -4
  813. package/dist/util/resolution/php.js.map +1 -1
  814. package/dist/util/resolution/project-symbols.d.ts +14 -0
  815. package/dist/util/resolution/project-symbols.d.ts.map +1 -0
  816. package/dist/util/resolution/project-symbols.js +70 -0
  817. package/dist/util/resolution/project-symbols.js.map +1 -0
  818. package/dist/util/resolution/tsconfig.d.ts +7 -0
  819. package/dist/util/resolution/tsconfig.d.ts.map +1 -1
  820. package/dist/util/resolution/tsconfig.js +23 -8
  821. package/dist/util/resolution/tsconfig.js.map +1 -1
  822. package/dist/util/resolution-candidates.d.ts +5 -0
  823. package/dist/util/resolution-candidates.d.ts.map +1 -0
  824. package/dist/util/resolution-candidates.js +70 -0
  825. package/dist/util/resolution-candidates.js.map +1 -0
  826. package/dist/util/resolution.d.ts +2 -2
  827. package/dist/util/resolution.d.ts.map +1 -1
  828. package/dist/util/resolution.js +6 -6
  829. package/dist/util/resolution.js.map +1 -1
  830. package/dist/util/rust-test-modules.d.ts +3 -0
  831. package/dist/util/rust-test-modules.d.ts.map +1 -0
  832. package/dist/util/rust-test-modules.js +71 -0
  833. package/dist/util/rust-test-modules.js.map +1 -0
  834. package/dist/util/source-location.d.ts +8 -0
  835. package/dist/util/source-location.d.ts.map +1 -0
  836. package/dist/util/source-location.js +19 -0
  837. package/dist/util/source-location.js.map +1 -0
  838. package/dist/util/sqlite-schema.d.ts +28 -0
  839. package/dist/util/sqlite-schema.d.ts.map +1 -0
  840. package/dist/util/sqlite-schema.js +75 -0
  841. package/dist/util/sqlite-schema.js.map +1 -0
  842. package/dist/util/symbol-hash.d.ts +59 -0
  843. package/dist/util/symbol-hash.d.ts.map +1 -0
  844. package/dist/util/symbol-hash.js +84 -0
  845. package/dist/util/symbol-hash.js.map +1 -0
  846. package/dist/util/windows-process-drain.d.ts +23 -0
  847. package/dist/util/windows-process-drain.d.ts.map +1 -0
  848. package/dist/util/windows-process-drain.js +51 -0
  849. package/dist/util/windows-process-drain.js.map +1 -0
  850. package/dist/util/worker-threads.d.ts +12 -0
  851. package/dist/util/worker-threads.d.ts.map +1 -0
  852. package/dist/util/worker-threads.js +19 -0
  853. package/dist/util/worker-threads.js.map +1 -0
  854. package/dist/util/workspace.d.ts +1 -1
  855. package/dist/util/workspace.d.ts.map +1 -1
  856. package/dist/util/workspace.js +2 -2
  857. package/dist/util/workspace.js.map +1 -1
  858. package/dist/util.d.ts +2 -2
  859. package/dist/util.d.ts.map +1 -1
  860. package/dist/util.js +1 -1
  861. package/dist/util.js.map +1 -1
  862. package/dist/worker/native-extract-worker.d.ts +77 -0
  863. package/dist/worker/native-extract-worker.d.ts.map +1 -0
  864. package/dist/worker/native-extract-worker.js +272 -0
  865. package/dist/worker/native-extract-worker.js.map +1 -0
  866. package/dist/worker/native-worker-pool.d.ts +16 -0
  867. package/dist/worker/native-worker-pool.d.ts.map +1 -0
  868. package/dist/worker/native-worker-pool.js +54 -0
  869. package/dist/worker/native-worker-pool.js.map +1 -0
  870. package/docs/mcp.md +2 -2
  871. package/package.json +4 -4
  872. package/dist/agent/callHierarchy.d.ts +0 -28
  873. package/dist/agent/callHierarchy.d.ts.map +0 -1
  874. package/dist/agent/callHierarchy.js +0 -82
  875. package/dist/agent/callHierarchy.js.map +0 -1
  876. package/dist/agent/candidateTests.d.ts +0 -12
  877. package/dist/agent/candidateTests.d.ts.map +0 -1
  878. package/dist/agent/candidateTests.js +0 -17
  879. package/dist/agent/candidateTests.js.map +0 -1
  880. package/dist/agent/fileView.d.ts +0 -55
  881. package/dist/agent/fileView.d.ts.map +0 -1
  882. package/dist/agent/fileView.js +0 -521
  883. package/dist/agent/fileView.js.map +0 -1
  884. package/dist/agent/followUps.d.ts +0 -10
  885. package/dist/agent/followUps.d.ts.map +0 -1
  886. package/dist/agent/followUps.js +0 -175
  887. package/dist/agent/followUps.js.map +0 -1
  888. package/dist/agent/query-index/queryIndexWorker.d.ts +0 -8
  889. package/dist/agent/query-index/queryIndexWorker.d.ts.map +0 -1
  890. package/dist/agent/query-index/queryIndexWorker.js +0 -11
  891. package/dist/agent/query-index/queryIndexWorker.js.map +0 -1
  892. package/dist/agent/query-index/sessionStore.d.ts +0 -5
  893. package/dist/agent/query-index/sessionStore.d.ts.map +0 -1
  894. package/dist/agent/query-index/sessionStore.js +0 -69
  895. package/dist/agent/query-index/sessionStore.js.map +0 -1
  896. package/dist/agent/query-index/sourceIdentity.d.ts +0 -3
  897. package/dist/agent/query-index/sourceIdentity.d.ts.map +0 -1
  898. package/dist/agent/query-index/sourceIdentity.js +0 -12
  899. package/dist/agent/query-index/sourceIdentity.js.map +0 -1
  900. package/dist/agent/query-index/workerPool.d.ts +0 -27
  901. package/dist/agent/query-index/workerPool.d.ts.map +0 -1
  902. package/dist/agent/query-index/workerPool.js +0 -114
  903. package/dist/agent/query-index/workerPool.js.map +0 -1
  904. package/dist/agent/refactorPlan.d.ts +0 -40
  905. package/dist/agent/refactorPlan.d.ts.map +0 -1
  906. package/dist/agent/refactorPlan.js +0 -226
  907. package/dist/agent/refactorPlan.js.map +0 -1
  908. package/dist/agent/renamePreview.d.ts +0 -57
  909. package/dist/agent/renamePreview.d.ts.map +0 -1
  910. package/dist/agent/renamePreview.js +0 -1062
  911. package/dist/agent/renamePreview.js.map +0 -1
  912. package/dist/agent/semanticSymbols.d.ts +0 -16
  913. package/dist/agent/semanticSymbols.d.ts.map +0 -1
  914. package/dist/agent/semanticSymbols.js +0 -97
  915. package/dist/agent/semanticSymbols.js.map +0 -1
  916. package/dist/agent/sessionLifecycle.d.ts +0 -5
  917. package/dist/agent/sessionLifecycle.d.ts.map +0 -1
  918. package/dist/agent/sessionLifecycle.js +0 -18
  919. package/dist/agent/sessionLifecycle.js.map +0 -1
  920. package/dist/agent/symbolLookup.d.ts +0 -12
  921. package/dist/agent/symbolLookup.d.ts.map +0 -1
  922. package/dist/agent/symbolLookup.js +0 -26
  923. package/dist/agent/symbolLookup.js.map +0 -1
  924. package/dist/agent/typeHierarchy.d.ts +0 -39
  925. package/dist/agent/typeHierarchy.d.ts.map +0 -1
  926. package/dist/agent/typeHierarchy.js +0 -125
  927. package/dist/agent/typeHierarchy.js.map +0 -1
  928. package/dist/agent/workspaceSymbols.d.ts +0 -18
  929. package/dist/agent/workspaceSymbols.d.ts.map +0 -1
  930. package/dist/agent/workspaceSymbols.js +0 -75
  931. package/dist/agent/workspaceSymbols.js.map +0 -1
  932. package/dist/analysisSummary.d.ts +0 -19
  933. package/dist/analysisSummary.d.ts.map +0 -1
  934. package/dist/analysisSummary.js +0 -80
  935. package/dist/analysisSummary.js.map +0 -1
  936. package/dist/bin/queryIndexWorker.js +0 -4382
  937. package/dist/bin/rawQueryWorker.js +0 -383
  938. package/dist/bootstrap/treeSitterLanguages.d.ts +0 -5
  939. package/dist/bootstrap/treeSitterLanguages.d.ts.map +0 -1
  940. package/dist/bootstrap/treeSitterLanguages.js +0 -41
  941. package/dist/bootstrap/treeSitterLanguages.js.map +0 -1
  942. package/dist/chunking/chunkBlocks.d.ts +0 -9
  943. package/dist/chunking/chunkBlocks.d.ts.map +0 -1
  944. package/dist/chunking/chunkBlocks.js +0 -60
  945. package/dist/chunking/chunkBlocks.js.map +0 -1
  946. package/dist/chunking/chunkFile.d.ts +0 -39
  947. package/dist/chunking/chunkFile.d.ts.map +0 -1
  948. package/dist/chunking/chunkFile.js +0 -152
  949. package/dist/chunking/chunkFile.js.map +0 -1
  950. package/dist/chunking/chunkId.d.ts +0 -7
  951. package/dist/chunking/chunkId.d.ts.map +0 -1
  952. package/dist/chunking/chunkId.js +0 -30
  953. package/dist/chunking/chunkId.js.map +0 -1
  954. package/dist/chunking/chunkMatches.d.ts +0 -4
  955. package/dist/chunking/chunkMatches.d.ts.map +0 -1
  956. package/dist/chunking/chunkMatches.js +0 -65
  957. package/dist/chunking/chunkMatches.js.map +0 -1
  958. package/dist/chunking/chunkMerge.d.ts +0 -4
  959. package/dist/chunking/chunkMerge.d.ts.map +0 -1
  960. package/dist/chunking/chunkMerge.js +0 -144
  961. package/dist/chunking/chunkMerge.js.map +0 -1
  962. package/dist/chunking/chunkSFC.d.ts +0 -18
  963. package/dist/chunking/chunkSFC.d.ts.map +0 -1
  964. package/dist/chunking/chunkSFC.js +0 -165
  965. package/dist/chunking/chunkSFC.js.map +0 -1
  966. package/dist/chunking/chunkSplit.d.ts +0 -6
  967. package/dist/chunking/chunkSplit.d.ts.map +0 -1
  968. package/dist/chunking/chunkSplit.js +0 -155
  969. package/dist/chunking/chunkSplit.js.map +0 -1
  970. package/dist/chunking/chunkTextFile.d.ts +0 -28
  971. package/dist/chunking/chunkTextFile.d.ts.map +0 -1
  972. package/dist/chunking/chunkTextFile.js +0 -107
  973. package/dist/chunking/chunkTextFile.js.map +0 -1
  974. package/dist/chunking/languageConfig.d.ts +0 -35
  975. package/dist/chunking/languageConfig.d.ts.map +0 -1
  976. package/dist/chunking/languageConfig.js +0 -24
  977. package/dist/chunking/languageConfig.js.map +0 -1
  978. package/dist/cli/callHierarchy.d.ts +0 -6
  979. package/dist/cli/callHierarchy.d.ts.map +0 -1
  980. package/dist/cli/callHierarchy.js +0 -72
  981. package/dist/cli/callHierarchy.js.map +0 -1
  982. package/dist/cli/commandCatalog.d.ts +0 -14
  983. package/dist/cli/commandCatalog.d.ts.map +0 -1
  984. package/dist/cli/commandCatalog.js +0 -118
  985. package/dist/cli/commandCatalog.js.map +0 -1
  986. package/dist/cli/commandTable.d.ts +0 -16
  987. package/dist/cli/commandTable.d.ts.map +0 -1
  988. package/dist/cli/commandTable.js +0 -758
  989. package/dist/cli/commandTable.js.map +0 -1
  990. package/dist/cli/compileCache.d.ts +0 -22
  991. package/dist/cli/compileCache.d.ts.map +0 -1
  992. package/dist/cli/compileCache.js +0 -81
  993. package/dist/cli/compileCache.js.map +0 -1
  994. package/dist/cli/discoveryGlobs.d.ts +0 -11
  995. package/dist/cli/discoveryGlobs.d.ts.map +0 -1
  996. package/dist/cli/discoveryGlobs.js +0 -74
  997. package/dist/cli/discoveryGlobs.js.map +0 -1
  998. package/dist/cli/duplicateSimilarity.d.ts +0 -10
  999. package/dist/cli/duplicateSimilarity.d.ts.map +0 -1
  1000. package/dist/cli/duplicateSimilarity.js +0 -20
  1001. package/dist/cli/duplicateSimilarity.js.map +0 -1
  1002. package/dist/cli/graphDelta.d.ts +0 -25
  1003. package/dist/cli/graphDelta.d.ts.map +0 -1
  1004. package/dist/cli/graphDelta.js +0 -80
  1005. package/dist/cli/graphDelta.js.map +0 -1
  1006. package/dist/cli/graphQueries.d.ts +0 -23
  1007. package/dist/cli/graphQueries.d.ts.map +0 -1
  1008. package/dist/cli/graphQueries.js +0 -265
  1009. package/dist/cli/graphQueries.js.map +0 -1
  1010. package/dist/cli/indexPolicy.d.ts +0 -36
  1011. package/dist/cli/indexPolicy.d.ts.map +0 -1
  1012. package/dist/cli/indexPolicy.js +0 -169
  1013. package/dist/cli/indexPolicy.js.map +0 -1
  1014. package/dist/cli/invocationContext.d.ts +0 -77
  1015. package/dist/cli/invocationContext.d.ts.map +0 -1
  1016. package/dist/cli/invocationContext.js +0 -423
  1017. package/dist/cli/invocationContext.js.map +0 -1
  1018. package/dist/cli/projectFile.d.ts +0 -13
  1019. package/dist/cli/projectFile.d.ts.map +0 -1
  1020. package/dist/cli/projectFile.js +0 -23
  1021. package/dist/cli/projectFile.js.map +0 -1
  1022. package/dist/cli/refactorPlan.d.ts +0 -6
  1023. package/dist/cli/refactorPlan.d.ts.map +0 -1
  1024. package/dist/cli/refactorPlan.js +0 -84
  1025. package/dist/cli/refactorPlan.js.map +0 -1
  1026. package/dist/cli/renamePreview.d.ts +0 -4
  1027. package/dist/cli/renamePreview.d.ts.map +0 -1
  1028. package/dist/cli/renamePreview.js +0 -92
  1029. package/dist/cli/renamePreview.js.map +0 -1
  1030. package/dist/cli/rootPolicy.d.ts +0 -53
  1031. package/dist/cli/rootPolicy.d.ts.map +0 -1
  1032. package/dist/cli/rootPolicy.js +0 -221
  1033. package/dist/cli/rootPolicy.js.map +0 -1
  1034. package/dist/cli/typeHierarchy.d.ts +0 -6
  1035. package/dist/cli/typeHierarchy.d.ts.map +0 -1
  1036. package/dist/cli/typeHierarchy.js +0 -90
  1037. package/dist/cli/typeHierarchy.js.map +0 -1
  1038. package/dist/cliBootstrap.d.ts +0 -3
  1039. package/dist/cliBootstrap.d.ts.map +0 -1
  1040. package/dist/cliBootstrap.js +0 -10
  1041. package/dist/cliBootstrap.js.map +0 -1
  1042. package/dist/documentLinks/asciidoc.d.ts.map +0 -1
  1043. package/dist/documentLinks/asciidoc.js.map +0 -1
  1044. package/dist/documentLinks/check.d.ts +0 -32
  1045. package/dist/documentLinks/check.d.ts.map +0 -1
  1046. package/dist/documentLinks/check.js +0 -286
  1047. package/dist/documentLinks/check.js.map +0 -1
  1048. package/dist/documentLinks/html.d.ts.map +0 -1
  1049. package/dist/documentLinks/html.js.map +0 -1
  1050. package/dist/documentLinks/markdown.d.ts.map +0 -1
  1051. package/dist/documentLinks/markdown.js.map +0 -1
  1052. package/dist/documentLinks/rst.d.ts.map +0 -1
  1053. package/dist/documentLinks/rst.js.map +0 -1
  1054. package/dist/documentLinks/sfc.d.ts.map +0 -1
  1055. package/dist/documentLinks/sfc.js.map +0 -1
  1056. package/dist/documentLinks/shared.d.ts.map +0 -1
  1057. package/dist/documentLinks/shared.js.map +0 -1
  1058. package/dist/documentLinks.d.ts +0 -12
  1059. package/dist/documentLinks.d.ts.map +0 -1
  1060. package/dist/documentLinks.js +0 -49
  1061. package/dist/documentLinks.js.map +0 -1
  1062. package/dist/duplicates/unitCache.d.ts +0 -46
  1063. package/dist/duplicates/unitCache.d.ts.map +0 -1
  1064. package/dist/duplicates/unitCache.js +0 -512
  1065. package/dist/duplicates/unitCache.js.map +0 -1
  1066. package/dist/duplicatesLeads.d.ts +0 -39
  1067. package/dist/duplicatesLeads.d.ts.map +0 -1
  1068. package/dist/duplicatesLeads.js +0 -112
  1069. package/dist/duplicatesLeads.js.map +0 -1
  1070. package/dist/graphs/edgeResolution.d.ts +0 -25
  1071. package/dist/graphs/edgeResolution.d.ts.map +0 -1
  1072. package/dist/graphs/edgeResolution.js +0 -97
  1073. package/dist/graphs/edgeResolution.js.map +0 -1
  1074. package/dist/graphs/symbol-graph-detailed/edgePasses.d.ts +0 -35
  1075. package/dist/graphs/symbol-graph-detailed/edgePasses.d.ts.map +0 -1
  1076. package/dist/graphs/symbol-graph-detailed/edgePasses.js +0 -586
  1077. package/dist/graphs/symbol-graph-detailed/edgePasses.js.map +0 -1
  1078. package/dist/graphs/symbol-graph-detailed/importAliases.d.ts +0 -10
  1079. package/dist/graphs/symbol-graph-detailed/importAliases.d.ts.map +0 -1
  1080. package/dist/graphs/symbol-graph-detailed/importAliases.js +0 -44
  1081. package/dist/graphs/symbol-graph-detailed/importAliases.js.map +0 -1
  1082. package/dist/graphs/symbol-graph-detailed/memberChains.d.ts +0 -17
  1083. package/dist/graphs/symbol-graph-detailed/memberChains.d.ts.map +0 -1
  1084. package/dist/graphs/symbol-graph-detailed/memberChains.js +0 -30
  1085. package/dist/graphs/symbol-graph-detailed/memberChains.js.map +0 -1
  1086. package/dist/graphs/symbol-graph-detailed/receiverCalls.d.ts +0 -69
  1087. package/dist/graphs/symbol-graph-detailed/receiverCalls.d.ts.map +0 -1
  1088. package/dist/graphs/symbol-graph-detailed/receiverCalls.js +0 -408
  1089. package/dist/graphs/symbol-graph-detailed/receiverCalls.js.map +0 -1
  1090. package/dist/impact/call-compatibility/textScanner.d.ts +0 -23
  1091. package/dist/impact/call-compatibility/textScanner.d.ts.map +0 -1
  1092. package/dist/impact/call-compatibility/textScanner.js +0 -615
  1093. package/dist/impact/call-compatibility/textScanner.js.map +0 -1
  1094. package/dist/impact/callCompatibility.d.ts +0 -24
  1095. package/dist/impact/callCompatibility.d.ts.map +0 -1
  1096. package/dist/impact/callCompatibility.js +0 -1023
  1097. package/dist/impact/callCompatibility.js.map +0 -1
  1098. package/dist/impact/memberResolutionCoverage.d.ts +0 -14
  1099. package/dist/impact/memberResolutionCoverage.d.ts.map +0 -1
  1100. package/dist/impact/memberResolutionCoverage.js +0 -42
  1101. package/dist/impact/memberResolutionCoverage.js.map +0 -1
  1102. package/dist/impact/referenceCache.d.ts +0 -12
  1103. package/dist/impact/referenceCache.d.ts.map +0 -1
  1104. package/dist/impact/referenceCache.js +0 -101
  1105. package/dist/impact/referenceCache.js.map +0 -1
  1106. package/dist/impact/reportCompact.d.ts +0 -8
  1107. package/dist/impact/reportCompact.d.ts.map +0 -1
  1108. package/dist/impact/reportCompact.js +0 -153
  1109. package/dist/impact/reportCompact.js.map +0 -1
  1110. package/dist/impact/reportFull.d.ts +0 -10
  1111. package/dist/impact/reportFull.d.ts.map +0 -1
  1112. package/dist/impact/reportFull.js +0 -67
  1113. package/dist/impact/reportFull.js.map +0 -1
  1114. package/dist/impact/reportParts.d.ts +0 -51
  1115. package/dist/impact/reportParts.d.ts.map +0 -1
  1116. package/dist/impact/reportParts.js +0 -2
  1117. package/dist/impact/reportParts.js.map +0 -1
  1118. package/dist/impact/reportShared.d.ts +0 -76
  1119. package/dist/impact/reportShared.d.ts.map +0 -1
  1120. package/dist/impact/reportShared.js +0 -130
  1121. package/dist/impact/reportShared.js.map +0 -1
  1122. package/dist/impact/testPatterns.d.ts +0 -6
  1123. package/dist/impact/testPatterns.d.ts.map +0 -1
  1124. package/dist/impact/testPatterns.js +0 -65
  1125. package/dist/impact/testPatterns.js.map +0 -1
  1126. package/dist/indexer/imports/graphOnly.d.ts +0 -13
  1127. package/dist/indexer/imports/graphOnly.d.ts.map +0 -1
  1128. package/dist/indexer/imports/graphOnly.js +0 -40
  1129. package/dist/indexer/imports/graphOnly.js.map +0 -1
  1130. package/dist/indexer/imports/jsTextImports.d.ts +0 -9
  1131. package/dist/indexer/imports/jsTextImports.d.ts.map +0 -1
  1132. package/dist/indexer/imports/jsTextImports.js +0 -181
  1133. package/dist/indexer/imports/jsTextImports.js.map +0 -1
  1134. package/dist/indexer/imports/languageSpecific.d.ts +0 -26
  1135. package/dist/indexer/imports/languageSpecific.d.ts.map +0 -1
  1136. package/dist/indexer/imports/languageSpecific.js +0 -449
  1137. package/dist/indexer/imports/languageSpecific.js.map +0 -1
  1138. package/dist/indexer/imports/nativeCaptures.d.ts +0 -16
  1139. package/dist/indexer/imports/nativeCaptures.d.ts.map +0 -1
  1140. package/dist/indexer/imports/nativeCaptures.js +0 -142
  1141. package/dist/indexer/imports/nativeCaptures.js.map +0 -1
  1142. package/dist/languages/definitions/cFamily.d.ts +0 -34
  1143. package/dist/languages/definitions/cFamily.d.ts.map +0 -1
  1144. package/dist/languages/definitions/cFamily.js +0 -177
  1145. package/dist/languages/definitions/cFamily.js.map +0 -1
  1146. package/dist/languages/definitions/cssLike.d.ts +0 -5
  1147. package/dist/languages/definitions/cssLike.d.ts.map +0 -1
  1148. package/dist/languages/definitions/cssLike.js +0 -32
  1149. package/dist/languages/definitions/cssLike.js.map +0 -1
  1150. package/dist/languages/definitions/htmlStub.d.ts +0 -18
  1151. package/dist/languages/definitions/htmlStub.d.ts.map +0 -1
  1152. package/dist/languages/definitions/htmlStub.js +0 -36
  1153. package/dist/languages/definitions/htmlStub.js.map +0 -1
  1154. package/dist/languages/definitions/jsFamily.d.ts +0 -5
  1155. package/dist/languages/definitions/jsFamily.d.ts.map +0 -1
  1156. package/dist/languages/definitions/jsFamily.js +0 -75
  1157. package/dist/languages/definitions/jsFamily.js.map +0 -1
  1158. package/dist/languages/filePrep.d.ts +0 -36
  1159. package/dist/languages/filePrep.d.ts.map +0 -1
  1160. package/dist/languages/filePrep.js +0 -76
  1161. package/dist/languages/filePrep.js.map +0 -1
  1162. package/dist/languages/importStatementParsers.d.ts +0 -57
  1163. package/dist/languages/importStatementParsers.d.ts.map +0 -1
  1164. package/dist/languages/importStatementParsers.js +0 -383
  1165. package/dist/languages/importStatementParsers.js.map +0 -1
  1166. package/dist/languages/queryGenerator.d.ts +0 -6
  1167. package/dist/languages/queryGenerator.d.ts.map +0 -1
  1168. package/dist/languages/queryGenerator.js +0 -46
  1169. package/dist/languages/queryGenerator.js.map +0 -1
  1170. package/dist/mcp/httpTransport.d.ts +0 -14
  1171. package/dist/mcp/httpTransport.d.ts.map +0 -1
  1172. package/dist/mcp/httpTransport.js +0 -185
  1173. package/dist/mcp/httpTransport.js.map +0 -1
  1174. package/dist/mcp/legacySessions.d.ts +0 -38
  1175. package/dist/mcp/legacySessions.d.ts.map +0 -1
  1176. package/dist/mcp/legacySessions.js +0 -264
  1177. package/dist/mcp/legacySessions.js.map +0 -1
  1178. package/dist/mcp/lifecycleHealth.d.ts +0 -12
  1179. package/dist/mcp/lifecycleHealth.d.ts.map +0 -1
  1180. package/dist/mcp/lifecycleHealth.js +0 -37
  1181. package/dist/mcp/lifecycleHealth.js.map +0 -1
  1182. package/dist/mcp/sqliteGuard.d.ts +0 -3
  1183. package/dist/mcp/sqliteGuard.d.ts.map +0 -1
  1184. package/dist/mcp/sqliteGuard.js +0 -35
  1185. package/dist/mcp/sqliteGuard.js.map +0 -1
  1186. package/dist/mcp/stdioLifecycle.d.ts +0 -23
  1187. package/dist/mcp/stdioLifecycle.d.ts.map +0 -1
  1188. package/dist/mcp/stdioLifecycle.js +0 -83
  1189. package/dist/mcp/stdioLifecycle.js.map +0 -1
  1190. package/dist/native/bindingLoader.d.ts +0 -51
  1191. package/dist/native/bindingLoader.d.ts.map +0 -1
  1192. package/dist/native/bindingLoader.js +0 -223
  1193. package/dist/native/bindingLoader.js.map +0 -1
  1194. package/dist/native/byteIndex.d.ts +0 -26
  1195. package/dist/native/byteIndex.d.ts.map +0 -1
  1196. package/dist/native/byteIndex.js +0 -70
  1197. package/dist/native/byteIndex.js.map +0 -1
  1198. package/dist/native/jsBridge.d.ts +0 -7
  1199. package/dist/native/jsBridge.d.ts.map +0 -1
  1200. package/dist/native/jsBridge.js +0 -25
  1201. package/dist/native/jsBridge.js.map +0 -1
  1202. package/dist/native/nativeBackendReport.d.ts +0 -22
  1203. package/dist/native/nativeBackendReport.d.ts.map +0 -1
  1204. package/dist/native/nativeBackendReport.js +0 -102
  1205. package/dist/native/nativeBackendReport.js.map +0 -1
  1206. package/dist/native/projectedTree.d.ts +0 -53
  1207. package/dist/native/projectedTree.d.ts.map +0 -1
  1208. package/dist/native/projectedTree.js +0 -180
  1209. package/dist/native/projectedTree.js.map +0 -1
  1210. package/dist/native/queryResults.d.ts +0 -12
  1211. package/dist/native/queryResults.d.ts.map +0 -1
  1212. package/dist/native/queryResults.js +0 -34
  1213. package/dist/native/queryResults.js.map +0 -1
  1214. package/dist/native/runtimeCache.d.ts +0 -128
  1215. package/dist/native/runtimeCache.d.ts.map +0 -1
  1216. package/dist/native/runtimeCache.js +0 -667
  1217. package/dist/native/runtimeCache.js.map +0 -1
  1218. package/dist/native/treeShape.d.ts +0 -21
  1219. package/dist/native/treeShape.d.ts.map +0 -1
  1220. package/dist/native/treeShape.js +0 -28
  1221. package/dist/native/treeShape.js.map +0 -1
  1222. package/dist/native/treeSitterNative.d.ts +0 -6
  1223. package/dist/native/treeSitterNative.d.ts.map +0 -1
  1224. package/dist/native/treeSitterNative.js +0 -5
  1225. package/dist/native/treeSitterNative.js.map +0 -1
  1226. package/dist/runtimeIdentity.d.ts +0 -27
  1227. package/dist/runtimeIdentity.d.ts.map +0 -1
  1228. package/dist/runtimeIdentity.js +0 -75
  1229. package/dist/runtimeIdentity.js.map +0 -1
  1230. package/dist/sql/classifySqlFile.d.ts +0 -3
  1231. package/dist/sql/classifySqlFile.d.ts.map +0 -1
  1232. package/dist/sql/classifySqlFile.js +0 -42
  1233. package/dist/sql/classifySqlFile.js.map +0 -1
  1234. package/dist/sql/extractFacts.d.ts +0 -4
  1235. package/dist/sql/extractFacts.d.ts.map +0 -1
  1236. package/dist/sql/extractFacts.js +0 -511
  1237. package/dist/sql/extractFacts.js.map +0 -1
  1238. package/dist/sql/sourceGraph.d.ts +0 -19
  1239. package/dist/sql/sourceGraph.d.ts.map +0 -1
  1240. package/dist/sql/sourceGraph.js +0 -195
  1241. package/dist/sql/sourceGraph.js.map +0 -1
  1242. package/dist/sqlite/rawQueryWorker.d.ts +0 -22
  1243. package/dist/sqlite/rawQueryWorker.d.ts.map +0 -1
  1244. package/dist/sqlite/rawQueryWorker.js +0 -31
  1245. package/dist/sqlite/rawQueryWorker.js.map +0 -1
  1246. package/dist/sqlite/rawQueryWorkerPool.d.ts +0 -66
  1247. package/dist/sqlite/rawQueryWorkerPool.d.ts.map +0 -1
  1248. package/dist/sqlite/rawQueryWorkerPool.js +0 -146
  1249. package/dist/sqlite/rawQueryWorkerPool.js.map +0 -1
  1250. package/dist/sqlite/rowBounds.d.ts +0 -24
  1251. package/dist/sqlite/rowBounds.d.ts.map +0 -1
  1252. package/dist/sqlite/rowBounds.js +0 -95
  1253. package/dist/sqlite/rowBounds.js.map +0 -1
  1254. package/dist/util/bloomFilter.d.ts +0 -100
  1255. package/dist/util/bloomFilter.d.ts.map +0 -1
  1256. package/dist/util/bloomFilter.js +0 -206
  1257. package/dist/util/bloomFilter.js.map +0 -1
  1258. package/dist/util/confinedFile.d.ts +0 -48
  1259. package/dist/util/confinedFile.d.ts.map +0 -1
  1260. package/dist/util/confinedFile.js +0 -164
  1261. package/dist/util/confinedFile.js.map +0 -1
  1262. package/dist/util/discoveryPath.d.ts +0 -3
  1263. package/dist/util/discoveryPath.d.ts.map +0 -1
  1264. package/dist/util/discoveryPath.js +0 -19
  1265. package/dist/util/discoveryPath.js.map +0 -1
  1266. package/dist/util/graphEdges.d.ts +0 -5
  1267. package/dist/util/graphEdges.d.ts.map +0 -1
  1268. package/dist/util/graphEdges.js +0 -42
  1269. package/dist/util/graphEdges.js.map +0 -1
  1270. package/dist/util/graphOnlyExtensions.d.ts +0 -5
  1271. package/dist/util/graphOnlyExtensions.d.ts.map +0 -1
  1272. package/dist/util/graphOnlyExtensions.js +0 -12
  1273. package/dist/util/graphOnlyExtensions.js.map +0 -1
  1274. package/dist/util/includeRoots.d.ts +0 -6
  1275. package/dist/util/includeRoots.d.ts.map +0 -1
  1276. package/dist/util/includeRoots.js +0 -53
  1277. package/dist/util/includeRoots.js.map +0 -1
  1278. package/dist/util/lazySymbols.d.ts +0 -166
  1279. package/dist/util/lazySymbols.d.ts.map +0 -1
  1280. package/dist/util/lazySymbols.js +0 -365
  1281. package/dist/util/lazySymbols.js.map +0 -1
  1282. package/dist/util/lruMap.d.ts +0 -3
  1283. package/dist/util/lruMap.d.ts.map +0 -1
  1284. package/dist/util/lruMap.js +0 -22
  1285. package/dist/util/lruMap.js.map +0 -1
  1286. package/dist/util/memberAccess.d.ts +0 -26
  1287. package/dist/util/memberAccess.d.ts.map +0 -1
  1288. package/dist/util/memberAccess.js +0 -185
  1289. package/dist/util/memberAccess.js.map +0 -1
  1290. package/dist/util/packageExports.d.ts +0 -25
  1291. package/dist/util/packageExports.d.ts.map +0 -1
  1292. package/dist/util/packageExports.js +0 -79
  1293. package/dist/util/packageExports.js.map +0 -1
  1294. package/dist/util/packageInfo.d.ts +0 -12
  1295. package/dist/util/packageInfo.d.ts.map +0 -1
  1296. package/dist/util/packageInfo.js +0 -57
  1297. package/dist/util/packageInfo.js.map +0 -1
  1298. package/dist/util/partialResults.d.ts +0 -81
  1299. package/dist/util/partialResults.d.ts.map +0 -1
  1300. package/dist/util/partialResults.js +0 -290
  1301. package/dist/util/partialResults.js.map +0 -1
  1302. package/dist/util/projectFiles/definitions.d.ts +0 -21
  1303. package/dist/util/projectFiles/definitions.d.ts.map +0 -1
  1304. package/dist/util/projectFiles/definitions.js.map +0 -1
  1305. package/dist/util/projectFiles/parsers.d.ts.map +0 -1
  1306. package/dist/util/projectFiles/parsers.js.map +0 -1
  1307. package/dist/util/projectFiles.d.ts +0 -102
  1308. package/dist/util/projectFiles.d.ts.map +0 -1
  1309. package/dist/util/projectFiles.js +0 -1209
  1310. package/dist/util/projectFiles.js.map +0 -1
  1311. package/dist/util/resolution/findFirstExisting.d.ts +0 -2
  1312. package/dist/util/resolution/findFirstExisting.d.ts.map +0 -1
  1313. package/dist/util/resolution/findFirstExisting.js +0 -13
  1314. package/dist/util/resolution/findFirstExisting.js.map +0 -1
  1315. package/dist/util/resolution/phpComposer.d.ts +0 -17
  1316. package/dist/util/resolution/phpComposer.d.ts.map +0 -1
  1317. package/dist/util/resolution/phpComposer.js +0 -269
  1318. package/dist/util/resolution/phpComposer.js.map +0 -1
  1319. package/dist/util/resolution/projectSymbols.d.ts +0 -14
  1320. package/dist/util/resolution/projectSymbols.d.ts.map +0 -1
  1321. package/dist/util/resolution/projectSymbols.js +0 -70
  1322. package/dist/util/resolution/projectSymbols.js.map +0 -1
  1323. package/dist/util/resolutionCandidates.d.ts +0 -5
  1324. package/dist/util/resolutionCandidates.d.ts.map +0 -1
  1325. package/dist/util/resolutionCandidates.js +0 -70
  1326. package/dist/util/resolutionCandidates.js.map +0 -1
  1327. package/dist/util/rustTestModules.d.ts +0 -3
  1328. package/dist/util/rustTestModules.d.ts.map +0 -1
  1329. package/dist/util/rustTestModules.js +0 -71
  1330. package/dist/util/rustTestModules.js.map +0 -1
  1331. package/dist/util/sourceLocation.d.ts +0 -8
  1332. package/dist/util/sourceLocation.d.ts.map +0 -1
  1333. package/dist/util/sourceLocation.js +0 -19
  1334. package/dist/util/sourceLocation.js.map +0 -1
  1335. package/dist/util/sqliteSchema.d.ts +0 -28
  1336. package/dist/util/sqliteSchema.d.ts.map +0 -1
  1337. package/dist/util/sqliteSchema.js +0 -75
  1338. package/dist/util/sqliteSchema.js.map +0 -1
  1339. package/dist/util/symbolHash.d.ts +0 -59
  1340. package/dist/util/symbolHash.d.ts.map +0 -1
  1341. package/dist/util/symbolHash.js +0 -84
  1342. package/dist/util/symbolHash.js.map +0 -1
  1343. package/dist/util/windowsProcessDrain.d.ts +0 -23
  1344. package/dist/util/windowsProcessDrain.d.ts.map +0 -1
  1345. package/dist/util/windowsProcessDrain.js +0 -51
  1346. package/dist/util/windowsProcessDrain.js.map +0 -1
  1347. package/dist/util/workerThreads.d.ts +0 -12
  1348. package/dist/util/workerThreads.d.ts.map +0 -1
  1349. package/dist/util/workerThreads.js +0 -16
  1350. package/dist/util/workerThreads.js.map +0 -1
  1351. package/dist/worker/nativeExtractWorker.d.ts +0 -77
  1352. package/dist/worker/nativeExtractWorker.d.ts.map +0 -1
  1353. package/dist/worker/nativeExtractWorker.js +0 -272
  1354. package/dist/worker/nativeExtractWorker.js.map +0 -1
  1355. package/dist/worker/nativeWorkerPool.d.ts +0 -16
  1356. package/dist/worker/nativeWorkerPool.d.ts.map +0 -1
  1357. package/dist/worker/nativeWorkerPool.js +0 -54
  1358. package/dist/worker/nativeWorkerPool.js.map +0 -1
  1359. package/docs/graph-visualization/viewer-selected-node.webp +0 -0
  1360. /package/dist/{documentLinks → document-links}/asciidoc.d.ts +0 -0
  1361. /package/dist/{documentLinks → document-links}/asciidoc.js +0 -0
  1362. /package/dist/{documentLinks → document-links}/html.d.ts +0 -0
  1363. /package/dist/{documentLinks → document-links}/html.js +0 -0
  1364. /package/dist/{documentLinks → document-links}/markdown.d.ts +0 -0
  1365. /package/dist/{documentLinks → document-links}/markdown.js +0 -0
  1366. /package/dist/{documentLinks → document-links}/rst.d.ts +0 -0
  1367. /package/dist/{documentLinks → document-links}/rst.js +0 -0
  1368. /package/dist/{documentLinks → document-links}/sfc.d.ts +0 -0
  1369. /package/dist/{documentLinks → document-links}/sfc.js +0 -0
  1370. /package/dist/{documentLinks → document-links}/shared.d.ts +0 -0
  1371. /package/dist/{documentLinks → document-links}/shared.js +0 -0
  1372. /package/dist/util/{projectFiles → project-files}/definitions.js +0 -0
  1373. /package/dist/util/{projectFiles → project-files}/parsers.d.ts +0 -0
  1374. /package/dist/util/{projectFiles → project-files}/parsers.js +0 -0
  1375. /package/{docs/graph-visualization → src/viewer}/app.js +0 -0
  1376. /package/{docs/graph-visualization → src/viewer}/file-tree-filters.js +0 -0
  1377. /package/{docs/graph-visualization → src/viewer}/file-tree-model.js +0 -0
  1378. /package/{docs/graph-visualization → src/viewer}/graph-builder.js +0 -0
  1379. /package/{docs/graph-visualization → src/viewer}/index.html +0 -0
  1380. /package/{docs/graph-visualization → src/viewer}/styles.css +0 -0
  1381. /package/{docs/graph-visualization → src/viewer}/vendor/LICENSE.graphology-layout-forceatlas2.txt +0 -0
  1382. /package/{docs/graph-visualization → src/viewer}/vendor/LICENSE.graphology.txt +0 -0
  1383. /package/{docs/graph-visualization → src/viewer}/vendor/LICENSE.sigma.txt +0 -0
  1384. /package/{docs/graph-visualization → src/viewer}/vendor/graphology-layout-forceatlas2.js +0 -0
  1385. /package/{docs/graph-visualization → src/viewer}/vendor/graphology.js +0 -0
  1386. /package/{docs/graph-visualization → src/viewer}/vendor/sigma.js +0 -0
@@ -0,0 +1,1460 @@
1
+ import fs from "node:fs";
2
+ import fsp from "node:fs/promises";
3
+ import path from "node:path";
4
+ import fg from "fast-glob";
5
+ import picomatch from "picomatch";
6
+ import { performance } from "node:perf_hooks";
7
+ import { logWithLevel } from "../logging.js";
8
+ import { stringifyUnknown } from "./ast.js";
9
+ import { fileIdentityKey, isFilePathWithinRoot, normalizePath } from "./paths.js";
10
+ import { isRelativePathInside, matchesDiscoveryGlob } from "./discovery-path.js";
11
+ export { isRelativePathInside, matchesDiscoveryGlob } from "./discovery-path.js";
12
+ import { PROJECT_FILE_DEFINITIONS, } from "./project-files/definitions.js";
13
+ import { trimToNull } from "./project-files/parsers.js";
14
+ import { mapLimitSemaphore } from "./concurrency.js";
15
+ import { CODEGRAPH_CONFIG_FILE } from "../config.js";
16
+ import { createGitDiscoveryCache, getGitRepositoryRoot, isGitProjectRootIgnored, isGitRepo, isGitTimeoutError, listGitExcludeFiles, listGitStageSpecialPaths, listGitSubmoduleDirectories, listTrackedFiles, listUntrackedFiles, } from "./git.js";
17
+ export const DEFAULT_PROJECT_FILE_IGNORES = [
18
+ "**/node_modules/**",
19
+ "**/.git/**",
20
+ // Never treat Codegraph's own on-disk state as project input. `.codegraph/` contains
21
+ // lifecycle metadata and the indexer disk cache. Keep the legacy cache ignore so
22
+ // pre-migration checkouts stay excluded from discovery.
23
+ "**/.codegraph/**",
24
+ "**/.codegraph-cache/**",
25
+ "**/dist/**",
26
+ "**/build/**",
27
+ "**/target/**",
28
+ "**/.venv/**",
29
+ "**/venv/**",
30
+ "**/site-packages/**",
31
+ "**/__pycache__/**",
32
+ "**/vendor/bundle/**",
33
+ "**/.build/**",
34
+ "**/Pods/**",
35
+ ];
36
+ export const DEFAULT_PROJECT_MANIFESTS = [
37
+ "package.json",
38
+ "package-lock.json",
39
+ "pnpm-lock.yaml",
40
+ "yarn.lock",
41
+ "bun.lockb",
42
+ "pnpm-workspace.yaml",
43
+ "lerna.json",
44
+ "nx.json",
45
+ "turbo.json",
46
+ "tsconfig.json",
47
+ "jsconfig.json",
48
+ "requirements.txt",
49
+ "requirements.in",
50
+ "pyproject.toml",
51
+ "Pipfile",
52
+ "Pipfile.lock",
53
+ "poetry.lock",
54
+ "setup.py",
55
+ "setup.cfg",
56
+ "Cargo.toml",
57
+ "Cargo.lock",
58
+ "rust-toolchain",
59
+ "rust-toolchain.toml",
60
+ "go.mod",
61
+ "go.sum",
62
+ "go.work",
63
+ "Gemfile",
64
+ "Gemfile.lock",
65
+ "*.gemspec",
66
+ "pom.xml",
67
+ "mvnw",
68
+ "build.gradle",
69
+ "build.gradle.kts",
70
+ "settings.gradle",
71
+ "settings.gradle.kts",
72
+ "gradle.properties",
73
+ "gradlew",
74
+ "*.csproj",
75
+ "*.fsproj",
76
+ "*.vbproj",
77
+ "*.sln",
78
+ "Directory.Build.props",
79
+ "Directory.Build.targets",
80
+ "global.json",
81
+ "composer.json",
82
+ "composer.lock",
83
+ "Package.swift",
84
+ "Package.resolved",
85
+ "CMakeLists.txt",
86
+ "CMakePresets.json",
87
+ "CMakeUserPresets.json",
88
+ "Makefile",
89
+ "makefile",
90
+ "GNUmakefile",
91
+ "configure.ac",
92
+ "configure.in",
93
+ "meson.build",
94
+ "meson_options.txt",
95
+ "conanfile.txt",
96
+ "conanfile.py",
97
+ "vcpkg.json",
98
+ ];
99
+ export const DEFAULT_PROJECT_PATTERNS = [
100
+ "**/*.{ts,tsx,js,jsx,mts,cts,mjs,cjs,py,pyi,php,vue,svelte,astro,hbs,handlebars,md,mdx,rst,adoc,asciidoc,go,java,cs,rb,rs,html,htm,css,scss,less,kt,kts,swift,zig,c,h,cc,cpp,cxx,c++,hpp,hh,hxx,ipp,tpp,inl,sql}",
101
+ ...DEFAULT_PROJECT_MANIFESTS.map((name) => `**/${name}`),
102
+ ];
103
+ const REALPATH_FILTER_CONCURRENCY = 64;
104
+ export function createProjectDiscoveryContext(projectRoot) {
105
+ return new DiscoveryContext(projectRoot);
106
+ }
107
+ function emitDiscoveryActivity(report, activity, current = 0, total = 0) {
108
+ report?.({ activity, current, total });
109
+ }
110
+ function emitDiscoveryTiming(record, name, startedAt) {
111
+ record?.({ name, ms: Math.round(performance.now() - startedAt) });
112
+ }
113
+ function createPathCheckProgressReporter(total, onProgress) {
114
+ onProgress?.(0, total);
115
+ let completed = 0;
116
+ return () => {
117
+ completed += 1;
118
+ if (completed === total || completed % 100 === 0)
119
+ onProgress?.(completed, total);
120
+ };
121
+ }
122
+ function isPresent(value) {
123
+ return value !== undefined;
124
+ }
125
+ function normalizeGlobPattern(globPattern) {
126
+ return globPattern.trim().replace(/\\/g, "/");
127
+ }
128
+ const ROOT_CONFIG_NAME_MATCHERS = [...DEFAULT_PROJECT_MANIFESTS, CODEGRAPH_CONFIG_FILE].map((pattern) => picomatch(normalizeGlobPattern(pattern), { dot: true }));
129
+ function isRootConfigFileName(fileName) {
130
+ return ROOT_CONFIG_NAME_MATCHERS.some((matcher) => matcher(fileName));
131
+ }
132
+ async function listRootConfigFiles(root, state, includeCodegraphConfig) {
133
+ const entries = await readDirectoryWithFileTypes(root, state);
134
+ const files = [];
135
+ for (const entry of entries) {
136
+ if (!isRootConfigFileName(entry.name))
137
+ continue;
138
+ if (!includeCodegraphConfig && entry.name === CODEGRAPH_CONFIG_FILE)
139
+ continue;
140
+ const file = normalizePath(path.join(root, entry.name));
141
+ if (!entry.isFile()) {
142
+ if (!entry.isSymbolicLink())
143
+ continue;
144
+ try {
145
+ if (!(await fsp.stat(file)).isFile())
146
+ continue;
147
+ }
148
+ catch (error) {
149
+ const code = error.code;
150
+ if (code === "ENOENT" || code === "ENOTDIR")
151
+ continue;
152
+ throw error;
153
+ }
154
+ }
155
+ files.push(file);
156
+ }
157
+ return files;
158
+ }
159
+ const DIRECTORY_METADATA_EXTENSIONS = new Set();
160
+ const DIRECTORY_METADATA_BASENAMES = new Set();
161
+ for (const definition of PROJECT_FILE_DEFINITIONS) {
162
+ if (definition.kind !== "dir")
163
+ continue;
164
+ for (const pattern of definition.patterns) {
165
+ if (!pattern.includes("*") && !pattern.includes("?")) {
166
+ DIRECTORY_METADATA_BASENAMES.add(pattern.toLowerCase());
167
+ continue;
168
+ }
169
+ const trimmed = pattern.replaceAll("*", "").replaceAll("?", "");
170
+ const lastDot = trimmed.lastIndexOf(".");
171
+ if (lastDot < 0)
172
+ continue;
173
+ DIRECTORY_METADATA_EXTENSIONS.add(trimmed.slice(lastDot).toLowerCase());
174
+ }
175
+ }
176
+ /**
177
+ * Git lists files, not directories. A directory symlink still appears as one path.
178
+ * Ordinary data files (`row.json`) are not directory links, so probing every Git
179
+ * candidate spent one lstat per JSON/CSV. Tracked symlinks are identified by Git
180
+ * mode 120000 regardless of extension. Untracked paths and Windows checkouts that
181
+ * do not record 120000 still need this name heuristic: no extension, a bundle
182
+ * directory marker such as `App.xcodeproj`, or a literal directory name such as `.idea`.
183
+ */
184
+ function couldBeDirectorySymlink(filePath) {
185
+ const basename = path.posix.basename(normalizePath(filePath));
186
+ if (DIRECTORY_METADATA_BASENAMES.has(basename.toLowerCase()))
187
+ return true;
188
+ const extension = path.posix.extname(basename);
189
+ if (!extension)
190
+ return true;
191
+ return DIRECTORY_METADATA_EXTENSIONS.has(extension.toLowerCase());
192
+ }
193
+ function isProjectMetadataDirectoryName(dirPath) {
194
+ const basename = path.posix.basename(normalizePath(dirPath));
195
+ if (DIRECTORY_METADATA_BASENAMES.has(basename.toLowerCase()))
196
+ return true;
197
+ const extension = path.posix.extname(basename);
198
+ return Boolean(extension) && DIRECTORY_METADATA_EXTENSIONS.has(extension.toLowerCase());
199
+ }
200
+ function globLiteralPrefix(globPattern) {
201
+ const prefix = [];
202
+ let seenLiteral = false;
203
+ for (const segment of globPattern.split("/")) {
204
+ if (!segment)
205
+ continue;
206
+ if (!seenLiteral && segment === "**")
207
+ continue;
208
+ if (segment.includes("*") || segment.includes("?"))
209
+ break;
210
+ seenLiteral = true;
211
+ prefix.push(segment);
212
+ }
213
+ return prefix;
214
+ }
215
+ function isSegmentPrefix(prefix, pathSegments) {
216
+ if (!prefix.length || prefix.length > pathSegments.length)
217
+ return false;
218
+ return prefix.every((segment, index) => pathSegments[index] === segment);
219
+ }
220
+ /**
221
+ * Whether an include glob explicitly re-opens a default-ignored root, so a default ignore
222
+ * should stay active for every OTHER root the includes never mention. A parent include
223
+ * such as vendor/ re-opens a nested ignore such as vendor/bundle. Compares
224
+ * literal path segments rather than attempting general glob-vs-glob intersection.
225
+ */
226
+ function isIgnoreGlobReopenedByIncludes(ignoreGlob, includeGlobs) {
227
+ const ignoreLiterals = ignoreGlob.split("/").filter((segment) => segment && !segment.includes("*"));
228
+ if (!ignoreLiterals.length)
229
+ return false;
230
+ return includeGlobs.some((includeGlob) => {
231
+ const includeSegments = includeGlob.split("/");
232
+ if (ignoreLiterals.every((segment) => includeSegments.includes(segment)))
233
+ return true;
234
+ const includePrefix = globLiteralPrefix(includeGlob);
235
+ return isSegmentPrefix(includePrefix, ignoreLiterals) || isSegmentPrefix(ignoreLiterals, includePrefix);
236
+ });
237
+ }
238
+ function isLocationIndependentGlob(globPattern) {
239
+ return globPattern.startsWith("**/");
240
+ }
241
+ export function translateGlobRootIgnoreGlobsForScanRoot(scanRoot, globRoot, ignoreGlobs) {
242
+ const relativeScanRoot = normalizePath(path.relative(globRoot, scanRoot));
243
+ if (!relativeScanRoot || !isRelativePathInside(relativeScanRoot)) {
244
+ return ignoreGlobs.map(normalizeGlobPattern).filter(Boolean);
245
+ }
246
+ const rootPrefix = `${relativeScanRoot}/`;
247
+ return ignoreGlobs
248
+ .map(normalizeGlobPattern)
249
+ .filter(Boolean)
250
+ .map((globPattern) => {
251
+ const rootRelativePattern = globPattern.startsWith("/") ? globPattern.slice(1) : globPattern;
252
+ if (isLocationIndependentGlob(rootRelativePattern))
253
+ return rootRelativePattern;
254
+ if (rootRelativePattern === relativeScanRoot || rootRelativePattern === `${relativeScanRoot}/**`)
255
+ return "**";
256
+ if (rootRelativePattern.startsWith(rootPrefix))
257
+ return rootRelativePattern.slice(rootPrefix.length) || "**";
258
+ return undefined;
259
+ })
260
+ .filter(isPresent);
261
+ }
262
+ function stripGitignoreTrailingSpaces(line) {
263
+ let end = line.length;
264
+ while (end > 0 && line[end - 1] === " ") {
265
+ let slashCount = 0;
266
+ for (let i = end - 2; i >= 0 && line[i] === "\\"; i -= 1) {
267
+ slashCount += 1;
268
+ }
269
+ if (slashCount % 2 === 1) {
270
+ break;
271
+ }
272
+ end -= 1;
273
+ }
274
+ return line.slice(0, end);
275
+ }
276
+ function parseGitignoreRule(baseDir, rawLine) {
277
+ const trimmedLine = stripGitignoreTrailingSpaces(rawLine);
278
+ if (!trimmedLine)
279
+ return null;
280
+ if (trimmedLine.startsWith("#"))
281
+ return null;
282
+ const negated = trimmedLine.startsWith("!");
283
+ let pattern = negated ? trimmedLine.slice(1) : trimmedLine;
284
+ if (!pattern || pattern === "/")
285
+ return null;
286
+ const dirOnly = pattern.endsWith("/");
287
+ if (dirOnly) {
288
+ pattern = pattern.slice(0, -1);
289
+ }
290
+ if (pattern.startsWith("/")) {
291
+ pattern = pattern.slice(1);
292
+ }
293
+ pattern = pattern.replace(/^\\([#!])/, "$1").replace(/\\/g, "/");
294
+ if (!pattern)
295
+ return null;
296
+ const anchored = trimmedLine.startsWith("/") || (negated && trimmedLine.startsWith("!/"));
297
+ const baseMatcherPattern = anchored || pattern.includes("/") ? pattern : `**/${pattern}`;
298
+ const matcherPattern = dirOnly ? `${baseMatcherPattern}/**` : [baseMatcherPattern, `${baseMatcherPattern}/**`];
299
+ const matches = picomatch(matcherPattern, { dot: true });
300
+ return {
301
+ baseDir: normalizePath(baseDir),
302
+ negated,
303
+ dirOnly,
304
+ matches,
305
+ };
306
+ }
307
+ const EMPTY_GITIGNORE_INDEX = {
308
+ hasRules: false,
309
+ repositoryRoots: [],
310
+ repositoryAliases: [],
311
+ byBaseDir: new Map(),
312
+ };
313
+ class DiscoveryContext {
314
+ projectRoot;
315
+ git;
316
+ gitCandidatesByRoot = new Map();
317
+ ignoreIndexByKey = new Map();
318
+ fileTextByPath = new Map();
319
+ readdirCache = new Map();
320
+ globFilesystem;
321
+ constructor(projectRoot) {
322
+ this.projectRoot = projectRoot;
323
+ this.git = createGitDiscoveryCache();
324
+ this.globFilesystem = { readdir: createSharedReaddir(this) };
325
+ }
326
+ }
327
+ function createSharedReaddir(state) {
328
+ function readdir(directory, optionsOrCallback, callback) {
329
+ const listing = readDirectoryWithFileTypes(directory, state);
330
+ if (typeof optionsOrCallback === "function") {
331
+ listing.then((entries) => optionsOrCallback(null, entries.map((entry) => entry.name)), (error) => optionsOrCallback(error, []));
332
+ }
333
+ else if (callback) {
334
+ listing.then((entries) => callback(null, entries), (error) => callback(error, []));
335
+ }
336
+ }
337
+ return readdir;
338
+ }
339
+ function globFilesystemOption(state) {
340
+ if (!state)
341
+ return {};
342
+ return { fs: state.globFilesystem };
343
+ }
344
+ function globFilesystemField(state) {
345
+ if (!state)
346
+ return {};
347
+ return { globFilesystem: state.globFilesystem };
348
+ }
349
+ async function readDirectoryWithFileTypes(directory, state) {
350
+ if (!state)
351
+ return fsp.readdir(directory, { withFileTypes: true });
352
+ const key = fileIdentityKey(directory);
353
+ const cached = state.readdirCache.get(key);
354
+ if (cached)
355
+ return cached;
356
+ const pending = fsp.readdir(directory, { withFileTypes: true });
357
+ state.readdirCache.set(key, pending);
358
+ return pending;
359
+ }
360
+ async function readDiscoveryFileResult(state, filePath) {
361
+ if (!state) {
362
+ try {
363
+ return { ok: true, text: await fsp.readFile(filePath, "utf8") };
364
+ }
365
+ catch (error) {
366
+ return { ok: false, error };
367
+ }
368
+ }
369
+ const key = fileIdentityKey(filePath);
370
+ const cached = state.fileTextByPath.get(key);
371
+ if (cached)
372
+ return await cached;
373
+ const pending = (async () => {
374
+ try {
375
+ return { ok: true, text: await fsp.readFile(filePath, "utf8") };
376
+ }
377
+ catch (error) {
378
+ return { ok: false, error };
379
+ }
380
+ })();
381
+ state.fileTextByPath.set(key, pending);
382
+ return await pending;
383
+ }
384
+ export async function readProjectDiscoveryFileText(discoveryContext, filePath) {
385
+ const result = await readDiscoveryFileResult(discoveryContext, filePath);
386
+ if (result.ok)
387
+ return result.text;
388
+ if (result.error instanceof Error)
389
+ throw result.error;
390
+ throw new Error(`Failed to read ${filePath}: ${stringifyUnknown(result.error)}`);
391
+ }
392
+ async function sharedGitignoreIndex(state, cacheKey, load) {
393
+ if (!state)
394
+ return await load();
395
+ const cached = state.ignoreIndexByKey.get(cacheKey);
396
+ if (cached)
397
+ return await cached;
398
+ const pending = load();
399
+ state.ignoreIndexByKey.set(cacheKey, pending);
400
+ return await pending;
401
+ }
402
+ function rememberGitCandidates(state, root, candidates) {
403
+ if (!state)
404
+ return;
405
+ const key = fileIdentityKey(root);
406
+ if (state.gitCandidatesByRoot.has(key))
407
+ return;
408
+ state.gitCandidatesByRoot.set(key, Promise.resolve(candidates));
409
+ }
410
+ async function getSharedGitCandidates(context, root, logLevel, callbacks) {
411
+ const state = context;
412
+ const gitCache = context?.git;
413
+ if (!state)
414
+ return await listGitCandidateFiles(root, logLevel, callbacks, gitCache);
415
+ const key = fileIdentityKey(root);
416
+ const cached = state.gitCandidatesByRoot.get(key);
417
+ if (cached)
418
+ return await cached;
419
+ const pending = listGitCandidateFiles(root, logLevel, callbacks, gitCache);
420
+ state.gitCandidatesByRoot.set(key, pending);
421
+ return await pending;
422
+ }
423
+ function gitExcludeListOptions(gitCache) {
424
+ if (!gitCache)
425
+ return undefined;
426
+ return { discoveryCache: gitCache };
427
+ }
428
+ function gitUntrackedListOptions(gitCache) {
429
+ if (!gitCache)
430
+ return { respectGitignore: true };
431
+ return { respectGitignore: true, discoveryCache: gitCache };
432
+ }
433
+ /**
434
+ * Parse `.gitignore` rules from an already-discovered set of `.gitignore` files.
435
+ *
436
+ * Ordered by path depth, not lexically: a directory segment collating before `.` (for
437
+ * example `-vendor` or `!keep`) would otherwise place a child's rule file ahead of its
438
+ * parent's, so a parent could no longer suppress a child whose rules it ignores, and a
439
+ * child negation could re-include files. Depth-first ordering also keeps the "last match
440
+ * wins" order deeper files depend on, and drops the locale sensitivity of `localeCompare`.
441
+ */
442
+ async function buildGitignoreIndex(sources, repositoryRoots = [], repositoryAliases = [], state) {
443
+ const sorted = [...sources]
444
+ .map(({ file, baseDir, repositoryRoot, priority }) => ({
445
+ file: normalizePath(file),
446
+ baseDir: normalizePath(baseDir),
447
+ priority: priority ?? 2,
448
+ ...(repositoryRoot === undefined ? {} : { repositoryRoot: normalizePath(repositoryRoot) }),
449
+ }))
450
+ .sort((left, right) => {
451
+ const baseDepthDelta = left.baseDir.split("/").length - right.baseDir.split("/").length;
452
+ if (baseDepthDelta !== 0)
453
+ return baseDepthDelta;
454
+ const priorityDelta = left.priority - right.priority;
455
+ if (priorityDelta !== 0)
456
+ return priorityDelta;
457
+ if (left.file < right.file)
458
+ return -1;
459
+ return left.file > right.file ? 1 : 0;
460
+ });
461
+ const gitignoreIndex = {
462
+ hasRules: false,
463
+ repositoryRoots: Array.from(new Set(repositoryRoots.map(normalizePath))).sort((left, right) => right.length - left.length),
464
+ repositoryAliases: Array.from(new Map(repositoryAliases.map(({ path: aliasPath, repositoryRoot }) => [
465
+ fileIdentityKey(aliasPath),
466
+ { path: normalizePath(aliasPath), repositoryRoot: normalizePath(repositoryRoot) },
467
+ ])).values()).sort((left, right) => right.path.length - left.path.length),
468
+ byBaseDir: new Map(),
469
+ };
470
+ for (const { file, baseDir, repositoryRoot } of sorted) {
471
+ if (isIgnoredByGitignore(path.dirname(file), gitignoreIndex, true)) {
472
+ continue;
473
+ }
474
+ const fileText = await readDiscoveryFileResult(state, file);
475
+ if (!fileText.ok)
476
+ continue;
477
+ const raw = fileText.text;
478
+ const baseKey = fileIdentityKey(baseDir);
479
+ for (const line of raw.split(/\r?\n/)) {
480
+ const rule = parseGitignoreRule(baseDir, line);
481
+ if (!rule)
482
+ continue;
483
+ const existing = gitignoreIndex.byBaseDir.get(baseKey);
484
+ if (existing)
485
+ existing.rules.push(rule);
486
+ else
487
+ gitignoreIndex.byBaseDir.set(baseKey, { baseDir, repositoryRoot, rules: [rule] });
488
+ gitignoreIndex.hasRules = true;
489
+ }
490
+ }
491
+ return gitignoreIndex;
492
+ }
493
+ async function findGitignoreFiles(projectRoot, state) {
494
+ return await fg(["**/.gitignore"], {
495
+ cwd: projectRoot,
496
+ absolute: true,
497
+ dot: true,
498
+ followSymbolicLinks: false,
499
+ ignore: DEFAULT_PROJECT_FILE_IGNORES,
500
+ ...globFilesystemOption(state),
501
+ });
502
+ }
503
+ async function loadGitignoreIndexForRootAliases(projectRoot, state) {
504
+ const roots = [projectRoot];
505
+ const realRoot = await fsp.realpath(projectRoot);
506
+ if (normalizePath(realRoot) !== normalizePath(projectRoot)) {
507
+ roots.push(realRoot);
508
+ }
509
+ const sources = [];
510
+ for (const root of roots) {
511
+ for (const file of await findGitignoreFiles(root, state)) {
512
+ sources.push({ file, baseDir: path.dirname(file) });
513
+ }
514
+ }
515
+ return await buildGitignoreIndex(sources, [], [], state);
516
+ }
517
+ /**
518
+ * Whether `.gitignore` rules ignore `absolutePath`.
519
+ *
520
+ * Only a `.gitignore` on the path's own ancestor chain can match it, so this walks that
521
+ * chain rather than testing every rule in the project. The skipped rules are exactly the
522
+ * ones whose relative-path check would have rejected them, and applying the chain
523
+ * shallowest-first reproduces the flat list's ordering, so the answer is unchanged.
524
+ * Testing every rule cost O(files x rules): on an Unreal project that meant 55,983
525
+ * candidates against 2,266 rules from 173 `.gitignore` files, or 253.7M evaluations and
526
+ * roughly 21.7s of a 26.1s discovery.
527
+ *
528
+ * The relative path is computed once per declaring directory rather than once per rule.
529
+ * Every rule in a group shares that directory, so the per-rule form repeated identical
530
+ * `path.relative` and normalization work; on the same project that repetition was the
531
+ * dominant remaining cost, at 2.6s of a 3.8s discovery.
532
+ */
533
+ function isIgnoredByGitignore(absolutePath, gitignoreIndex, isDirectory = false) {
534
+ if (!gitignoreIndex.hasRules)
535
+ return false;
536
+ const owningRepositoryRoot = gitignoreIndex.repositoryRoots.find((root) => isFilePathWithinRoot(root, absolutePath)) ??
537
+ gitignoreIndex.repositoryAliases.find(({ path: aliasPath }) => isFilePathWithinRoot(aliasPath, absolutePath))
538
+ ?.repositoryRoot;
539
+ const chain = [];
540
+ let current = normalizePath(path.dirname(absolutePath));
541
+ for (;;) {
542
+ const group = gitignoreIndex.byBaseDir.get(fileIdentityKey(current));
543
+ if (group)
544
+ chain.push(group);
545
+ const parent = normalizePath(path.dirname(current));
546
+ if (parent === current)
547
+ break;
548
+ current = parent;
549
+ }
550
+ let ignored = false;
551
+ for (let depth = chain.length - 1; depth >= 0; depth -= 1) {
552
+ const group = chain[depth];
553
+ if (group.repositoryRoot !== undefined &&
554
+ owningRepositoryRoot !== undefined &&
555
+ fileIdentityKey(group.repositoryRoot) !== fileIdentityKey(owningRepositoryRoot)) {
556
+ continue;
557
+ }
558
+ const relativePath = path.relative(group.baseDir, absolutePath);
559
+ if (!isRelativePathInside(relativePath)) {
560
+ continue;
561
+ }
562
+ const normalizedRelativePath = normalizePath(relativePath);
563
+ const hasSeparator = normalizedRelativePath.includes("/");
564
+ for (const rule of group.rules) {
565
+ if (rule.dirOnly && !hasSeparator && !isDirectory) {
566
+ continue;
567
+ }
568
+ const matchesDirectory = isDirectory && rule.dirOnly && rule.matches(`${normalizedRelativePath}/.directory`);
569
+ if (rule.matches(normalizedRelativePath) || matchesDirectory) {
570
+ ignored = !rule.negated;
571
+ }
572
+ }
573
+ }
574
+ return ignored;
575
+ }
576
+ async function ensureDirectoryReadable(directoryPath, label) {
577
+ const resolvedPath = path.resolve(directoryPath);
578
+ let stats;
579
+ try {
580
+ stats = await fsp.stat(resolvedPath);
581
+ }
582
+ catch (error) {
583
+ throw new Error(`${label} does not exist or is not readable: ${resolvedPath} (${stringifyUnknown(error)})`);
584
+ }
585
+ if (!stats.isDirectory()) {
586
+ throw new Error(`${label} is not a directory: ${resolvedPath}`);
587
+ }
588
+ return resolvedPath;
589
+ }
590
+ /**
591
+ * Every directory on the ancestor chain of `files`, up to and including `root`.
592
+ *
593
+ * The ignore matcher only consults rules declared at a path's own ancestors, so this is
594
+ * exactly the set of directories whose `.gitignore` can affect a candidate.
595
+ */
596
+ function collectCandidateAncestorDirectories(root, files) {
597
+ const rootKey = fileIdentityKey(root);
598
+ const seen = new Set([rootKey]);
599
+ const directories = [normalizePath(root)];
600
+ for (const file of files) {
601
+ let current = normalizePath(path.dirname(file));
602
+ while (fileIdentityKey(current) !== rootKey) {
603
+ if (seen.has(fileIdentityKey(current)))
604
+ break;
605
+ seen.add(fileIdentityKey(current));
606
+ directories.push(current);
607
+ const parent = normalizePath(path.dirname(current));
608
+ if (parent === current)
609
+ break;
610
+ current = parent;
611
+ }
612
+ }
613
+ return directories;
614
+ }
615
+ export function owningGitIgnoreSourceRoot(file, roots, realpathMemo) {
616
+ const normalized = normalizePath(file);
617
+ let owning;
618
+ for (const root of roots) {
619
+ if (!isFilePathWithinRoot(root.path, normalized, realpathMemo) &&
620
+ !isFilePathWithinRoot(root.repositoryRoot, normalized, realpathMemo)) {
621
+ continue;
622
+ }
623
+ if (!owning || root.repositoryRoot.length > owning.repositoryRoot.length) {
624
+ owning = root;
625
+ }
626
+ }
627
+ return owning;
628
+ }
629
+ /**
630
+ * Ownership is pure path containment, so every candidate in the same parent directory
631
+ * shares one answer. The lookup and its realpath memo live only for this discovery pass,
632
+ * so a long-lived process cannot serve a stale owner after the tree changes.
633
+ */
634
+ export function createGitIgnoreSourceOwnershipLookup(roots, realpathMemo) {
635
+ const ownershipByDirectory = new Map();
636
+ return (file) => {
637
+ const directory = normalizePath(path.dirname(file));
638
+ const key = fileIdentityKey(directory);
639
+ if (ownershipByDirectory.has(key)) {
640
+ return ownershipByDirectory.get(key);
641
+ }
642
+ const owning = owningGitIgnoreSourceRoot(directory, roots, realpathMemo);
643
+ ownershipByDirectory.set(key, owning);
644
+ return owning;
645
+ };
646
+ }
647
+ async function gitignoreFileIfPresent(directory) {
648
+ const file = normalizePath(path.join(directory, ".gitignore"));
649
+ try {
650
+ const stat = await fsp.stat(file);
651
+ return stat.isFile() ? file : undefined;
652
+ }
653
+ catch {
654
+ return undefined;
655
+ }
656
+ }
657
+ /**
658
+ * Locate the `.gitignore` files that can affect the Git candidates, plus Git's
659
+ * other ignore sources.
660
+ *
661
+ * A `.gitignore` only applies beneath its directory. After Git has listed tracked
662
+ * and untracked candidates, the ignore files that can affect those paths live on
663
+ * their ancestor chains up to the owning repository root, including parents of a
664
+ * nested scan root, and at each source root. Stopping at the scan root would miss
665
+ * `packages/.gitignore` when listing `packages/app`. Asking Git for ignored
666
+ * `.gitignore` files walks every gitignored tree looking for them, which times
667
+ * out on a large ignored data directory even after file listing already finished.
668
+ */
669
+ async function findGitIgnoreSources(sourceRoots, candidateFiles, gitCache) {
670
+ const roots = Array.from(new Map(sourceRoots.map(({ path: sourceRoot, repositoryRoot }) => [
671
+ fileIdentityKey(sourceRoot),
672
+ { path: normalizePath(sourceRoot), repositoryRoot: normalizePath(repositoryRoot) },
673
+ ])).values());
674
+ const directories = new Map();
675
+ const walkedDirectoryKeys = new Set();
676
+ const addDirectory = (directory, repositoryRoot) => {
677
+ const dir = normalizePath(directory);
678
+ const key = fileIdentityKey(dir);
679
+ if (!directories.has(key))
680
+ directories.set(key, { dir, repositoryRoot: normalizePath(repositoryRoot) });
681
+ };
682
+ for (const { path: sourceRoot, repositoryRoot } of roots) {
683
+ addDirectory(sourceRoot, repositoryRoot);
684
+ }
685
+ const realpathMemo = new Map();
686
+ const owningOf = createGitIgnoreSourceOwnershipLookup(roots, realpathMemo);
687
+ for (const file of candidateFiles) {
688
+ const owning = owningOf(file);
689
+ if (!owning)
690
+ continue;
691
+ let dir = normalizePath(path.dirname(file));
692
+ const stopKey = fileIdentityKey(owning.repositoryRoot);
693
+ while (true) {
694
+ const dirKey = fileIdentityKey(dir);
695
+ const walkKey = `${dirKey}\0${stopKey}`;
696
+ if (walkedDirectoryKeys.has(walkKey))
697
+ break;
698
+ addDirectory(dir, owning.repositoryRoot);
699
+ walkedDirectoryKeys.add(walkKey);
700
+ if (dirKey === stopKey)
701
+ break;
702
+ const parent = normalizePath(path.dirname(dir));
703
+ if (parent === dir ||
704
+ (!isFilePathWithinRoot(owning.path, parent, realpathMemo) &&
705
+ !isFilePathWithinRoot(owning.repositoryRoot, parent, realpathMemo))) {
706
+ break;
707
+ }
708
+ dir = parent;
709
+ }
710
+ }
711
+ const uniqueRepositoryRoots = Array.from(new Set(roots.map((root) => root.repositoryRoot)));
712
+ const [gitignoreHits, excludeLists] = await Promise.all([
713
+ mapLimitSemaphore(Array.from(directories.values()), REALPATH_FILTER_CONCURRENCY, async ({ dir, repositoryRoot }) => {
714
+ const file = await gitignoreFileIfPresent(dir);
715
+ return file ? [{ file, baseDir: dir, repositoryRoot, priority: 2 }] : [];
716
+ }),
717
+ Promise.all(uniqueRepositoryRoots.map((repositoryRoot) => listGitExcludeFiles(repositoryRoot, gitExcludeListOptions(gitCache)))),
718
+ ]);
719
+ return [
720
+ ...gitignoreHits.flat(),
721
+ ...excludeLists.flat().map((source) => ({
722
+ ...source,
723
+ repositoryRoot: source.baseDir,
724
+ })),
725
+ ];
726
+ }
727
+ /**
728
+ * Enumerate candidate project files through Git, or `null` when Git cannot answer.
729
+ *
730
+ * Tracked plus untracked-but-not-ignored files are Git candidates. Submodule files retain
731
+ * their own repository boundary, and source roots cover logical and physical aliases.
732
+ */
733
+ async function listGitCandidateFiles(root, logLevel, opts, gitCache) {
734
+ let gitListStart;
735
+ let gitIgnoreStart;
736
+ try {
737
+ const realRoot = normalizePath(await fsp.realpath(root));
738
+ const gitRoot = (await isGitRepo(root, gitCache)) ? root : realRoot;
739
+ if (!(await isGitRepo(gitRoot, gitCache)))
740
+ return null;
741
+ if (await isGitProjectRootIgnored(realRoot, gitCache))
742
+ return null;
743
+ const gitRepositoryRoot = await getGitRepositoryRoot(gitRoot);
744
+ if (!gitRepositoryRoot)
745
+ return null;
746
+ emitDiscoveryActivity(opts?.onDiscoveryProgress, "Listing Git files");
747
+ const listStartedAt = performance.now();
748
+ gitListStart = listStartedAt;
749
+ const untrackedOptions = gitUntrackedListOptions(gitCache);
750
+ const [tracked, untracked, stageSpecial] = await Promise.all([
751
+ listTrackedFiles(gitRoot, { recurseSubmodules: true, ...(logLevel === undefined ? {} : { logLevel }) }),
752
+ listUntrackedFiles(gitRoot, untrackedOptions),
753
+ listGitStageSpecialPaths(gitRoot, { recurse: true }),
754
+ ]);
755
+ const submoduleDirectories = stageSpecial.gitlinks;
756
+ const submoduleRoots = await Promise.all(submoduleDirectories.map(async (logicalPath) => ({
757
+ logicalPath: normalizePath(logicalPath),
758
+ physicalPath: normalizePath(await fsp.realpath(logicalPath).catch(() => logicalPath)),
759
+ })));
760
+ const submoduleUntracked = await Promise.all(submoduleRoots.map(async ({ physicalPath }) => await listUntrackedFiles(physicalPath, untrackedOptions)));
761
+ const rawFiles = Array.from(new Set([...tracked, ...untracked, ...submoduleUntracked.flat()])).sort();
762
+ const needsLogicalRemap = normalizePath(gitRoot) !== normalizePath(root);
763
+ const files = Array.from(new Set(rawFiles.map((file) => needsLogicalRemap && isFilePathWithinRoot(realRoot, file)
764
+ ? normalizePath(path.resolve(root, path.relative(realRoot, file)))
765
+ : normalizePath(file)))).sort();
766
+ const remapGitPath = (file) => needsLogicalRemap && isFilePathWithinRoot(realRoot, file)
767
+ ? normalizePath(path.resolve(root, path.relative(realRoot, file)))
768
+ : normalizePath(file);
769
+ const symlinkCandidatePaths = Array.from(new Set([...stageSpecial.symlinks.map(remapGitPath), ...files.filter((file) => couldBeDirectorySymlink(file))])).sort();
770
+ const gitignoreRoots = [gitRepositoryRoot, ...submoduleRoots.map(({ physicalPath }) => physicalPath)].map(normalizePath);
771
+ const sourceRoots = [
772
+ { path: root, repositoryRoot: gitRepositoryRoot },
773
+ { path: realRoot, repositoryRoot: gitRepositoryRoot },
774
+ { path: gitRepositoryRoot, repositoryRoot: gitRepositoryRoot },
775
+ ...submoduleRoots.flatMap(({ logicalPath, physicalPath }) => [
776
+ { path: logicalPath, repositoryRoot: physicalPath },
777
+ { path: physicalPath, repositoryRoot: physicalPath },
778
+ ]),
779
+ ];
780
+ emitDiscoveryTiming(opts?.onDiscoveryTiming, "git-list", listStartedAt);
781
+ gitListStart = undefined;
782
+ emitDiscoveryActivity(opts?.onDiscoveryProgress, "Listing Git files", files.length, files.length);
783
+ emitDiscoveryActivity(opts?.onDiscoveryProgress, "Listing Git ignore files");
784
+ const ignoreStartedAt = performance.now();
785
+ gitIgnoreStart = ignoreStartedAt;
786
+ const gitignoreFiles = await findGitIgnoreSources(sourceRoots, files, gitCache);
787
+ emitDiscoveryTiming(opts?.onDiscoveryTiming, "git-ignore", ignoreStartedAt);
788
+ gitIgnoreStart = undefined;
789
+ emitDiscoveryActivity(opts?.onDiscoveryProgress, "Listing Git ignore files", gitignoreFiles.length, gitignoreFiles.length);
790
+ return {
791
+ files,
792
+ symlinkCandidatePaths,
793
+ gitignoreFiles,
794
+ gitignoreRoots,
795
+ gitignoreAliases: sourceRoots,
796
+ };
797
+ }
798
+ catch (error) {
799
+ const listingTimedOut = isGitTimeoutError(error) && (gitIgnoreStart !== undefined || gitListStart !== undefined);
800
+ if (gitIgnoreStart !== undefined) {
801
+ emitDiscoveryTiming(opts?.onDiscoveryTiming, "git-ignore", gitIgnoreStart);
802
+ }
803
+ else if (gitListStart !== undefined) {
804
+ emitDiscoveryTiming(opts?.onDiscoveryTiming, "git-list", gitListStart);
805
+ }
806
+ if (listingTimedOut) {
807
+ logWithLevel(logLevel, "warn", "Warning: Git listing timed out; scanning the filesystem instead. Ignore large untracked trees in .gitignore to keep discovery fast.");
808
+ }
809
+ else {
810
+ logWithLevel(logLevel, "debug", `Git discovery unavailable for ${root}: ${stringifyUnknown(error)}`);
811
+ }
812
+ return null;
813
+ }
814
+ }
815
+ export async function listProjectFiles(projectRoot, patterns = DEFAULT_PROJECT_PATTERNS, options) {
816
+ return await listProjectFilesInternal(projectRoot, patterns, options);
817
+ }
818
+ export async function listProjectFilesWithGitCandidates(projectRoot, patterns = DEFAULT_PROJECT_PATTERNS, options) {
819
+ return await listProjectFilesInternal(projectRoot, patterns, options);
820
+ }
821
+ async function listProjectFilesInternal(projectRoot, patterns = DEFAULT_PROJECT_PATTERNS, options) {
822
+ const root = await ensureDirectoryReadable(projectRoot, "Project root");
823
+ const globRoot = options?.globRoot ? await ensureDirectoryReadable(options.globRoot, "Glob root") : root;
824
+ const includeGlobs = (options?.includeGlobs ?? []).map(normalizeGlobPattern).filter(Boolean);
825
+ const includeMatchers = includeGlobs.map((globPattern) => picomatch(globPattern, { dot: true }));
826
+ const userIgnoreGlobs = (options?.ignoreGlobs ?? []).map(normalizeGlobPattern).filter(Boolean);
827
+ const userIgnoreMatchers = userIgnoreGlobs.map((globPattern) => picomatch(globPattern, { dot: true }));
828
+ const defaultIgnoreMatchers = DEFAULT_PROJECT_FILE_IGNORES.map((globPattern) => picomatch(globPattern, { dot: true }));
829
+ const patternMatchers = patterns.map((pattern) => picomatch(normalizeGlobPattern(pattern), { dot: true }));
830
+ const translatedUserIgnoreGlobs = translateGlobRootIgnoreGlobsForScanRoot(root, globRoot, userIgnoreGlobs);
831
+ const fastGlobIgnoreGlobs = [...DEFAULT_PROJECT_FILE_IGNORES, ...translatedUserIgnoreGlobs];
832
+ // Include globs are an explicit request to re-open otherwise ignored roots. Probe
833
+ // those roots for safe directory links before the later filter reapplies the default
834
+ // ignores, so an included link is not lost before it can be traversed. Default ignores
835
+ // an include never mentions (e.g. node_modules when only src/** is included) stay
836
+ // active, so the probe does not walk unrelated large ignored trees.
837
+ const symlinkProbeIgnoreGlobs = includeGlobs.length
838
+ ? [
839
+ ...translatedUserIgnoreGlobs,
840
+ ...DEFAULT_PROJECT_FILE_IGNORES.filter((ignoreGlob) => !isIgnoreGlobReopenedByIncludes(ignoreGlob, includeGlobs)),
841
+ ]
842
+ : fastGlobIgnoreGlobs;
843
+ try {
844
+ const useGitignore = options?.useGitignore ?? true;
845
+ const realRoot = await fsp.realpath(root);
846
+ // Enumerate through Git when Git's ignore rules are the ones this call wants anyway.
847
+ // Git applies them while walking, so ignored trees are never descended into and never
848
+ // reach the realpath and gitignore checks below. Scanning instead costs O(files on
849
+ // disk): on an Unreal project holding 100,168 files (818 tracked) the scan produced
850
+ // 55,983 pattern-matching candidates, nearly all generated sources under a gitignored
851
+ // `Intermediate/` tree, and discovery took 26.1s. Git lists 4,010 in about 111ms.
852
+ // An aliased root or a gitignore-root override that points elsewhere means Git's notion
853
+ // of the project is not this call's, so those fall back to the scan. Passing
854
+ // `gitignoreRoot` equal to the scan root (the CLI's historical whole-project form) still
855
+ // wants this repository's ignore rules, so keep the Git candidate path. On a 501-file
856
+ // Git repo with a 20,000-file gitignored tree, `gitignoreRoot: scanRoot` otherwise
857
+ // forced a filesystem scan plus a full-tree symlink probe (~403ms) instead of Git
858
+ // listing (~66ms) of the 502 tracked paths.
859
+ // Compare by identity key, not slash normalization: on a case-insensitive filesystem a
860
+ // casing or drive-letter difference still names the same directory, and calling that a
861
+ // mismatch would silently drop back to the slow scan this fast path exists to avoid.
862
+ const scanRootKey = fileIdentityKey(root);
863
+ const gitignoreRootMatchesScanRoot = options?.gitignoreRoot === undefined || fileIdentityKey(options.gitignoreRoot) === scanRootKey;
864
+ const attemptedGitCandidates = useGitignore && gitignoreRootMatchesScanRoot && fileIdentityKey(realRoot) === scanRootKey;
865
+ const gitDiscoveryCallbacks = {
866
+ ...(options?.onDiscoveryProgress ? { onDiscoveryProgress: options.onDiscoveryProgress } : {}),
867
+ ...(options?.onDiscoveryTiming ? { onDiscoveryTiming: options.onDiscoveryTiming } : {}),
868
+ };
869
+ const discovery = options?.discoveryContext ?? createProjectDiscoveryContext(root);
870
+ const gitCandidates = attemptedGitCandidates
871
+ ? await getSharedGitCandidates(discovery, root, options?.logLevel, gitDiscoveryCallbacks)
872
+ : null;
873
+ // Report only when this call actually asked Git, including a null result. Callers that
874
+ // already enumerated candidates (build-index) can hand the same set to metadata discovery
875
+ // and skip a second Git spawn; omitting the callback keeps prior caller behavior.
876
+ if (attemptedGitCandidates) {
877
+ options?.onGitCandidatesDiscovered?.(gitCandidates);
878
+ }
879
+ let gitignoreIndex = EMPTY_GITIGNORE_INDEX;
880
+ if (useGitignore && gitCandidates) {
881
+ gitignoreIndex = await sharedGitignoreIndex(discovery, `git:${fileIdentityKey(root)}`, () => buildGitignoreIndex(gitCandidates.gitignoreFiles, gitCandidates.gitignoreRoots, gitCandidates.gitignoreAliases, discovery));
882
+ }
883
+ else if (useGitignore) {
884
+ const gitignoreRoot = options?.gitignoreRoot
885
+ ? await ensureDirectoryReadable(options.gitignoreRoot, "Gitignore root")
886
+ : root;
887
+ gitignoreIndex = await sharedGitignoreIndex(discovery, `fs:${fileIdentityKey(gitignoreRoot)}`, () => loadGitignoreIndexForRootAliases(gitignoreRoot, discovery));
888
+ }
889
+ // Git returns a candidate set, not a filtered result: the pattern, include,
890
+ // default-ignore, and gitignore checks below still decide what is indexable.
891
+ let files;
892
+ if (gitCandidates) {
893
+ files = gitCandidates.files;
894
+ }
895
+ else {
896
+ emitDiscoveryActivity(options?.onDiscoveryProgress, "Scanning project files");
897
+ const scanStart = performance.now();
898
+ files = await fg(patterns, {
899
+ cwd: root,
900
+ absolute: true,
901
+ dot: true,
902
+ followSymbolicLinks: false,
903
+ ignore: fastGlobIgnoreGlobs,
904
+ ...globFilesystemOption(discovery),
905
+ });
906
+ emitDiscoveryTiming(options?.onDiscoveryTiming, "filesystem-scan", scanStart);
907
+ emitDiscoveryActivity(options?.onDiscoveryProgress, "Scanning project files", files.length, files.length);
908
+ }
909
+ // Explicit includeGlobs may re-open default-ignored trees (for example vendored
910
+ // dependency dirs). Scan those include patterns without default ignores, then keep
911
+ // only paths that still match the project patterns and include globs below.
912
+ //
913
+ // Only needed on the scan path. Git never applied this project's default ignores, so
914
+ // its listing already contains those files and the include globs below re-open them.
915
+ // Running the scan anyway would also re-add paths Git excluded through its own
916
+ // exclude files, contradicting the rule that Git's ignores still win here.
917
+ const includedOverrideFiles = includeGlobs.length && !gitCandidates
918
+ ? await fg(translateGlobRootIgnoreGlobsForScanRoot(root, globRoot, includeGlobs), {
919
+ cwd: root,
920
+ absolute: true,
921
+ dot: true,
922
+ followSymbolicLinks: false,
923
+ ignore: translatedUserIgnoreGlobs,
924
+ ...globFilesystemOption(discovery),
925
+ })
926
+ : [];
927
+ const reportSourceSymlinkChecks = options?.onDiscoveryProgress
928
+ ? (current, total) => options.onDiscoveryProgress?.({ activity: "Checking source symlinks", current, total })
929
+ : undefined;
930
+ const reportSourcePathChecks = options?.onDiscoveryProgress
931
+ ? (current, total) => options.onDiscoveryProgress?.({ activity: "Checking source file paths", current, total })
932
+ : undefined;
933
+ const symlinkOptions = {
934
+ globRoot,
935
+ ...(gitCandidates ? { candidatePaths: gitCandidates.symlinkCandidatePaths } : {}),
936
+ ...(options?.knownSymlinkDirectories !== undefined
937
+ ? { knownSymlinkDirectories: options.knownSymlinkDirectories }
938
+ : {}),
939
+ ...(options?.onSymlinkDirectoriesDiscovered
940
+ ? { onSymlinkDirectoriesDiscovered: options.onSymlinkDirectoriesDiscovered }
941
+ : {}),
942
+ ...(reportSourceSymlinkChecks ? { onPathCheckProgress: reportSourceSymlinkChecks } : {}),
943
+ ...globFilesystemField(discovery),
944
+ };
945
+ const safeSymlinkDirectories = await resolveSafeSymlinkDirectories(root, realRoot, symlinkProbeIgnoreGlobs, symlinkOptions);
946
+ const linkedFiles = await listEntriesFromSafeSymlinkDirectories(root, realRoot, patterns, fastGlobIgnoreGlobs, {
947
+ ...symlinkOptions,
948
+ filterIgnoreGlobs: [...DEFAULT_PROJECT_FILE_IGNORES, ...userIgnoreGlobs],
949
+ resolvedSafeSymlinkDirectories: safeSymlinkDirectories,
950
+ });
951
+ const linkedOverrideFiles = includeGlobs.length === 0
952
+ ? []
953
+ : await listEntriesFromSafeSymlinkDirectories(root, realRoot, patterns, translatedUserIgnoreGlobs, {
954
+ globRoot,
955
+ filterIgnoreGlobs: userIgnoreGlobs,
956
+ resolvedSafeSymlinkDirectories: safeSymlinkDirectories,
957
+ ...globFilesystemField(discovery),
958
+ });
959
+ // Cheap path predicates run before the realpath confinement probe. Git enumerates
960
+ // every tracked and untracked file it knows about, including trees this project
961
+ // always ignores (virtualenvs, build output, caches), so probing first spent one
962
+ // realpath syscall per ignored candidate: a Python project with a 20k-file untracked
963
+ // virtualenv took 1.0s of syscalls to return 7 files. Only candidates that can still
964
+ // become project files need their physical path resolved.
965
+ const candidatePaths = [...files, ...includedOverrideFiles, ...linkedFiles, ...linkedOverrideFiles];
966
+ const seen = new Set();
967
+ const indexableCandidates = [];
968
+ for (const candidatePath of candidatePaths) {
969
+ const filePath = normalizePath(candidatePath);
970
+ if (seen.has(filePath))
971
+ continue;
972
+ seen.add(filePath);
973
+ const rootRelative = normalizePath(path.relative(root, filePath));
974
+ if (!isRelativePathInside(rootRelative))
975
+ continue;
976
+ if (!patternMatchers.some((matcher) => matcher(rootRelative)))
977
+ continue;
978
+ if (includeMatchers.length &&
979
+ !includeMatchers.some((matcher) => matchesDiscoveryGlob(filePath, globRoot, matcher))) {
980
+ continue;
981
+ }
982
+ if (userIgnoreMatchers.some((matcher) => matchesDiscoveryGlob(filePath, globRoot, matcher)))
983
+ continue;
984
+ // Explicit include globs are a deliberate request to re-open default-ignored trees.
985
+ if (!includeMatchers.length && defaultIgnoreMatchers.some((matcher) => matcher(rootRelative)))
986
+ continue;
987
+ if (isIgnoredByGitignore(filePath, gitignoreIndex))
988
+ continue;
989
+ indexableCandidates.push(filePath);
990
+ }
991
+ const rootSafeFiles = await filterRealPathsWithinRootEntries(indexableCandidates, realRoot, reportSourcePathChecks);
992
+ return rootSafeFiles
993
+ .filter(({ path: filePath, realPath }) =>
994
+ // The real path only differs when the entry was reached through a symlink, so
995
+ // testing it again for every ordinary file doubled the matcher work for nothing.
996
+ normalizePath(realPath) === filePath || !isIgnoredByGitignore(realPath, gitignoreIndex))
997
+ .map(({ path: filePath }) => filePath);
998
+ }
999
+ catch (error) {
1000
+ logWithLevel(options?.logLevel, "debug", `listProjectFiles failed for ${root}: ${stringifyUnknown(error)}`);
1001
+ throw new Error(`Failed to list files in ${root}: ${stringifyUnknown(error)}`);
1002
+ }
1003
+ }
1004
+ /**
1005
+ * Build a predicate that answers "does this absolute path belong in the project file
1006
+ * set" without walking the filesystem. Mirrors the pattern/ignore-glob filtering that
1007
+ * `listProjectFiles()` applies during its scan, so it can be reused to test candidate
1008
+ * paths sourced elsewhere (e.g. `git ls-files --others`) against the same discovery
1009
+ * rules. Does not evaluate `.gitignore`; callers sourcing candidates from Git already
1010
+ * get gitignore-aware filtering for free and should not reuse this for arbitrary,
1011
+ * non-Git-sourced candidate paths without also checking gitignore separately.
1012
+ */
1013
+ export function createDiscoveredFileMatcher(root, globRoot, patterns, options) {
1014
+ const patternMatchers = patterns.map((pattern) => picomatch(normalizeGlobPattern(pattern), { dot: true }));
1015
+ const defaultIgnoreMatchers = DEFAULT_PROJECT_FILE_IGNORES.map((pattern) => picomatch(normalizeGlobPattern(pattern), { dot: true }));
1016
+ const includeMatchers = (options?.includeGlobs ?? [])
1017
+ .map(normalizeGlobPattern)
1018
+ .filter(Boolean)
1019
+ .map((pattern) => picomatch(pattern, { dot: true }));
1020
+ const userIgnoreMatchers = (options?.ignoreGlobs ?? [])
1021
+ .map(normalizeGlobPattern)
1022
+ .filter(Boolean)
1023
+ .map((pattern) => picomatch(pattern, { dot: true }));
1024
+ return (absolutePath) => {
1025
+ const rootRelative = path.relative(root, absolutePath);
1026
+ if (!isRelativePathInside(rootRelative))
1027
+ return false;
1028
+ const normalizedRootRelative = normalizePath(rootRelative);
1029
+ if (!patternMatchers.some((matcher) => matcher(normalizedRootRelative)))
1030
+ return false;
1031
+ const matchesInclude = !includeMatchers.length ||
1032
+ includeMatchers.some((matcher) => matchesDiscoveryGlob(absolutePath, globRoot, matcher));
1033
+ if (!matchesInclude)
1034
+ return false;
1035
+ if (defaultIgnoreMatchers.some((matcher) => matcher(normalizedRootRelative))) {
1036
+ if (!(includeMatchers.length > 0 && matchesInclude))
1037
+ return false;
1038
+ }
1039
+ return !userIgnoreMatchers.some((matcher) => matchesDiscoveryGlob(absolutePath, globRoot, matcher));
1040
+ };
1041
+ }
1042
+ /**
1043
+ * Whether `linkPath` is a directory symlink that is safe to crawl for project files.
1044
+ *
1045
+ * `lstat` runs before `realpath` and `stat` so a candidate that is not a symlink costs
1046
+ * one syscall rather than three. That matters for callers screening a broad candidate
1047
+ * list, where nearly every entry is an ordinary file, and costs nothing for callers
1048
+ * passing entries a walk already identified as links.
1049
+ */
1050
+ async function isSafeSymlinkDirectory(root, linkPath, realRoot) {
1051
+ try {
1052
+ if (!isRelativePathInside(path.relative(root, linkPath)))
1053
+ return false;
1054
+ if (!(await fsp.lstat(linkPath)).isSymbolicLink())
1055
+ return false;
1056
+ const [realPath, targetStats] = await Promise.all([fsp.realpath(linkPath), fsp.stat(linkPath)]);
1057
+ if (!targetStats.isDirectory())
1058
+ return false;
1059
+ if (!isFilePathWithinRoot(realRoot, realPath))
1060
+ return false;
1061
+ return normalizePath(realPath) !== normalizePath(realRoot);
1062
+ }
1063
+ catch {
1064
+ return false;
1065
+ }
1066
+ }
1067
+ async function verifySafeSymlinkDirectories(root, realRoot, paths, onPathCheckProgress) {
1068
+ const reportPathCheck = createPathCheckProgressReporter(paths.length, onPathCheckProgress);
1069
+ const verified = await mapLimitSemaphore(Array.from(paths), REALPATH_FILTER_CONCURRENCY, async (linkPath) => {
1070
+ try {
1071
+ return (await isSafeSymlinkDirectory(root, linkPath, realRoot)) ? linkPath : null;
1072
+ }
1073
+ finally {
1074
+ reportPathCheck();
1075
+ }
1076
+ });
1077
+ return verified.filter((entry) => entry !== null);
1078
+ }
1079
+ /**
1080
+ * Resolve the symlinked directories under `root` that are safe to crawl.
1081
+ *
1082
+ * When `knownSymlinkDirectories` is provided, this re-verifies each previously
1083
+ * discovered path directly. Otherwise a Git-derived `candidatePaths` list avoids a
1084
+ * separate full-tree scan: Git already enumerated every tracked and non-ignored
1085
+ * untracked entry, including symlinks. Callers pass `symlinkCandidatePaths` so ordinary
1086
+ * data files are not lstat'd, while Git mode 120000 still screens extension-bearing
1087
+ * directory links. Non-Git discovery retains the existing
1088
+ * `fg(["**\/*"])` fallback. Every path still passes the same lstat, target-directory,
1089
+ * and realpath-confinement checks before it can be crawled.
1090
+ */
1091
+ async function resolveSafeSymlinkDirectories(root, realRoot, ignore, options) {
1092
+ if (options.knownSymlinkDirectories !== undefined) {
1093
+ const resolved = await verifySafeSymlinkDirectories(root, realRoot, Array.from(new Set(options.knownSymlinkDirectories)), options.onPathCheckProgress);
1094
+ options.onSymlinkDirectoriesDiscovered?.(resolved, "known");
1095
+ return resolved;
1096
+ }
1097
+ if (options.candidatePaths !== undefined) {
1098
+ const ignoreMatchers = ignore
1099
+ .map(normalizeGlobPattern)
1100
+ .filter(Boolean)
1101
+ .map((pattern) => picomatch(pattern, { dot: true }));
1102
+ const candidatePaths = Array.from(new Set(options.candidatePaths)).filter((candidatePath) => {
1103
+ const relativePath = normalizePath(path.relative(root, candidatePath));
1104
+ if (!isRelativePathInside(relativePath))
1105
+ return false;
1106
+ if (ignoreMatchers.some((matcher) => matcher(relativePath)))
1107
+ return false;
1108
+ return true;
1109
+ });
1110
+ const discovered = await verifySafeSymlinkDirectories(root, realRoot, candidatePaths, options.onPathCheckProgress);
1111
+ options.onSymlinkDirectoriesDiscovered?.(discovered, "git-candidates");
1112
+ return discovered;
1113
+ }
1114
+ const entries = (await fg(["**/*"], {
1115
+ cwd: root,
1116
+ absolute: true,
1117
+ dot: true,
1118
+ onlyFiles: false,
1119
+ followSymbolicLinks: false,
1120
+ objectMode: true,
1121
+ ignore,
1122
+ ...(options.globFilesystem ? { fs: options.globFilesystem } : {}),
1123
+ }));
1124
+ const discovered = await verifySafeSymlinkDirectories(root, realRoot, entries.filter((entry) => entry.dirent.isSymbolicLink()).map((entry) => entry.path), options.onPathCheckProgress);
1125
+ options.onSymlinkDirectoriesDiscovered?.(discovered, "filesystem");
1126
+ return discovered;
1127
+ }
1128
+ async function listEntriesFromSafeSymlinkDirectories(root, realRoot, patterns, ignore, options = {}) {
1129
+ const globRoot = options.globRoot ?? root;
1130
+ const filterIgnoreGlobs = options.filterIgnoreGlobs ?? ignore;
1131
+ const rootRelativeIgnoreMatchers = filterIgnoreGlobs
1132
+ .map(normalizeGlobPattern)
1133
+ .filter(Boolean)
1134
+ .map((globPattern) => picomatch(globPattern, { dot: true }));
1135
+ const locationIndependentIgnores = ignore.map(normalizeGlobPattern).filter(isLocationIndependentGlob);
1136
+ const safeSymlinkDirectories = options.resolvedSafeSymlinkDirectories ?? (await resolveSafeSymlinkDirectories(root, realRoot, ignore, options));
1137
+ if (!safeSymlinkDirectories.length)
1138
+ return [];
1139
+ const filesByPath = new Map();
1140
+ const filesByDirectory = await mapLimitSemaphore(Array.from(safeSymlinkDirectories), REALPATH_FILTER_CONCURRENCY, async (directory) => (await fg(patterns, {
1141
+ cwd: directory,
1142
+ absolute: true,
1143
+ dot: true,
1144
+ followSymbolicLinks: false,
1145
+ ignore: locationIndependentIgnores,
1146
+ ...(options.onlyFiles !== undefined ? { onlyFiles: options.onlyFiles } : {}),
1147
+ ...(options.markDirectories !== undefined ? { markDirectories: options.markDirectories } : {}),
1148
+ ...(options.globFilesystem ? { fs: options.globFilesystem } : {}),
1149
+ })).filter((filePath) => {
1150
+ const cleanPath = filePath.endsWith("/") ? filePath.slice(0, -1) : filePath;
1151
+ return !rootRelativeIgnoreMatchers.some((matcher) => matchesDiscoveryGlob(cleanPath, globRoot, matcher));
1152
+ }));
1153
+ for (const files of filesByDirectory) {
1154
+ for (const file of files) {
1155
+ filesByPath.set(normalizePath(file), file);
1156
+ }
1157
+ }
1158
+ return [...filesByPath.values()];
1159
+ }
1160
+ async function filterRealPathsWithinRootEntries(paths, realRoot, onPathCheckProgress) {
1161
+ const reportPathCheck = createPathCheckProgressReporter(paths.length, onPathCheckProgress);
1162
+ const filtered = await mapLimitSemaphore(paths, REALPATH_FILTER_CONCURRENCY, async (filePath) => {
1163
+ try {
1164
+ const realPath = await fsp.realpath(filePath);
1165
+ return isFilePathWithinRoot(realRoot, realPath) ? { path: filePath, realPath } : null;
1166
+ }
1167
+ catch {
1168
+ return null;
1169
+ }
1170
+ finally {
1171
+ reportPathCheck();
1172
+ }
1173
+ });
1174
+ return filtered.filter((entry) => entry !== null);
1175
+ }
1176
+ export async function filterRealPathsWithinRoot(paths, realRoot, onPathCheckProgress) {
1177
+ const entries = await filterRealPathsWithinRootEntries(paths, realRoot, onPathCheckProgress);
1178
+ return entries.map((entry) => entry.path);
1179
+ }
1180
+ function toProjectGlob(pattern) {
1181
+ return pattern.startsWith("**/") ? pattern : `**/${pattern}`;
1182
+ }
1183
+ async function buildProjectFileInfo(def, filePath, state) {
1184
+ const normalizedPath = normalizePath(filePath);
1185
+ const projectRoot = normalizePath(path.dirname(filePath));
1186
+ let name = null;
1187
+ if (def.parseName && def.kind === "file") {
1188
+ try {
1189
+ const text = await readProjectDiscoveryFileText(state, filePath);
1190
+ name = def.parseName(text, filePath);
1191
+ }
1192
+ catch {
1193
+ name = null;
1194
+ }
1195
+ }
1196
+ if (!name && def.nameFromPath) {
1197
+ if (def.nameFromPath === "file") {
1198
+ name = trimToNull(path.basename(filePath, path.extname(filePath)));
1199
+ }
1200
+ else {
1201
+ name = trimToNull(path.basename(projectRoot));
1202
+ }
1203
+ }
1204
+ return {
1205
+ path: normalizedPath,
1206
+ kind: def.kind,
1207
+ type: def.type,
1208
+ role: def.role,
1209
+ projectRoot,
1210
+ ...(name ? { name } : {}),
1211
+ };
1212
+ }
1213
+ export async function discoverProjectFiles(projectRoot, options) {
1214
+ return await discoverProjectFilesInternal(projectRoot, options);
1215
+ }
1216
+ export async function discoverProjectFilesWithGitCandidates(projectRoot, options) {
1217
+ return await discoverProjectFilesInternal(projectRoot, options);
1218
+ }
1219
+ async function discoverProjectFilesInternal(projectRoot, options) {
1220
+ const root = await ensureDirectoryReadable(projectRoot, "Project root");
1221
+ try {
1222
+ const realRoot = await fsp.realpath(root);
1223
+ const projectFileDefinitionMatchers = PROJECT_FILE_DEFINITIONS.map((definition) => definition.patterns.map((pattern) => pattern.includes("*") || pattern.includes("?")
1224
+ ? new RegExp("^" + pattern.replace(/\./g, "\\.").replace(/\*/g, ".*") + "$")
1225
+ : undefined));
1226
+ const matchesDefinition = (fileName, definitionIndex) => {
1227
+ const definition = PROJECT_FILE_DEFINITIONS[definitionIndex];
1228
+ return definition.patterns.some((pattern, patternIndex) => {
1229
+ const matcher = projectFileDefinitionMatchers[definitionIndex][patternIndex];
1230
+ return matcher ? matcher.test(fileName) : pattern === fileName;
1231
+ });
1232
+ };
1233
+ const discovery = options?.discoveryContext ?? createProjectDiscoveryContext(root);
1234
+ let gitCandidates;
1235
+ if (options?.knownGitCandidates !== undefined) {
1236
+ gitCandidates = options.knownGitCandidates;
1237
+ rememberGitCandidates(discovery, root, gitCandidates);
1238
+ }
1239
+ else {
1240
+ gitCandidates = await getSharedGitCandidates(discovery, root, options?.logLevel, {
1241
+ ...(options?.onDiscoveryProgress ? { onDiscoveryProgress: options.onDiscoveryProgress } : {}),
1242
+ ...(options?.onDiscoveryTiming ? { onDiscoveryTiming: options.onDiscoveryTiming } : {}),
1243
+ });
1244
+ }
1245
+ options?.onGitCandidatesDiscovered?.(gitCandidates);
1246
+ const reportMetadataSymlinkChecks = options?.onDiscoveryProgress
1247
+ ? (current, total) => options.onDiscoveryProgress?.({ activity: "Checking project metadata symlinks", current, total })
1248
+ : undefined;
1249
+ const reportMetadataFileChecks = options?.onDiscoveryProgress
1250
+ ? (current, total) => options.onDiscoveryProgress?.({ activity: "Checking project metadata files", current, total })
1251
+ : undefined;
1252
+ const reportMetadataDirectoryChecks = options?.onDiscoveryProgress
1253
+ ? (current, total) => options.onDiscoveryProgress?.({ activity: "Checking project metadata directories", current, total })
1254
+ : undefined;
1255
+ let rootSafeMatches;
1256
+ if (gitCandidates) {
1257
+ const gitignoreIndex = await sharedGitignoreIndex(discovery, `git:${fileIdentityKey(root)}`, () => buildGitignoreIndex(gitCandidates.gitignoreFiles, gitCandidates.gitignoreRoots, gitCandidates.gitignoreAliases, discovery));
1258
+ const defaultIgnoreMatchers = DEFAULT_PROJECT_FILE_IGNORES.map((globPattern) => picomatch(globPattern, { dot: true }));
1259
+ const filterGitIgnoredEntries = (entries, directoryKeys = new Set()) => entries
1260
+ .map(({ path: filePath, realPath }) => ({ filePath: normalizePath(filePath), realPath }))
1261
+ .filter(({ filePath, realPath }) => {
1262
+ const isDirectory = directoryKeys.has(fileIdentityKey(filePath));
1263
+ const rootRelative = normalizePath(path.relative(root, filePath));
1264
+ if (!isRelativePathInside(rootRelative))
1265
+ return false;
1266
+ if (defaultIgnoreMatchers.some((matcher) => matcher(rootRelative)))
1267
+ return false;
1268
+ if (isIgnoredByGitignore(filePath, gitignoreIndex, isDirectory))
1269
+ return false;
1270
+ return normalizePath(realPath) === filePath || !isIgnoredByGitignore(realPath, gitignoreIndex, isDirectory);
1271
+ })
1272
+ .map(({ filePath }) => filePath);
1273
+ const symlinkOptions = {
1274
+ candidatePaths: gitCandidates.symlinkCandidatePaths,
1275
+ ...(options?.knownSymlinkDirectories !== undefined
1276
+ ? { knownSymlinkDirectories: options.knownSymlinkDirectories }
1277
+ : {}),
1278
+ ...(options?.onSymlinkDirectoriesDiscovered
1279
+ ? { onSymlinkDirectoriesDiscovered: options.onSymlinkDirectoriesDiscovered }
1280
+ : {}),
1281
+ ...(reportMetadataSymlinkChecks ? { onPathCheckProgress: reportMetadataSymlinkChecks } : {}),
1282
+ ...globFilesystemField(discovery),
1283
+ };
1284
+ const safeSymlinkDirectories = await resolveSafeSymlinkDirectories(root, realRoot, DEFAULT_PROJECT_FILE_IGNORES, symlinkOptions);
1285
+ const allPatterns = PROJECT_FILE_DEFINITIONS.flatMap((definition) => definition.patterns.map(toProjectGlob));
1286
+ const linkedMatches = await listEntriesFromSafeSymlinkDirectories(root, realRoot, allPatterns, DEFAULT_PROJECT_FILE_IGNORES, {
1287
+ markDirectories: true,
1288
+ onlyFiles: false,
1289
+ resolvedSafeSymlinkDirectories: safeSymlinkDirectories,
1290
+ ...globFilesystemField(discovery),
1291
+ });
1292
+ const candidateFiles = Array.from(new Set(gitCandidates.files.map(normalizePath)));
1293
+ // Only a candidate whose basename can name a manifest becomes a metadata entry, so
1294
+ // resolve physical paths for those alone. Probing every Git candidate first cost a
1295
+ // realpath syscall per ignored file: the same 20k-file untracked virtualenv spent
1296
+ // 0.6s here. Ancestor directories come from the candidate paths themselves and are
1297
+ // confined by their own realpath check below.
1298
+ const metadataCandidates = candidateFiles.filter((file) => PROJECT_FILE_DEFINITIONS.some((definition, definitionIndex) => definition.kind === "file" && matchesDefinition(path.basename(file), definitionIndex)));
1299
+ const fileMatches = filterGitIgnoredEntries(await filterRealPathsWithinRootEntries(metadataCandidates, realRoot, reportMetadataFileChecks));
1300
+ // Directory metadata is identified by the directory name (.idea, App.xcodeproj).
1301
+ // Walking every Git-listed JSON or CSV still produced one realpath per data folder.
1302
+ const rawCandidateDirectories = collectCandidateAncestorDirectories(root, candidateFiles).filter(isProjectMetadataDirectoryName);
1303
+ const candidateDirectoryKeys = new Set(rawCandidateDirectories.map(fileIdentityKey));
1304
+ const safeSymlinkDirectoryKeys = new Set(safeSymlinkDirectories.map(fileIdentityKey));
1305
+ const directoryMatches = [
1306
+ ...filterGitIgnoredEntries(await filterRealPathsWithinRootEntries(rawCandidateDirectories, realRoot, reportMetadataDirectoryChecks), candidateDirectoryKeys),
1307
+ ...filterGitIgnoredEntries(await filterRealPathsWithinRootEntries(safeSymlinkDirectories, realRoot, reportMetadataDirectoryChecks), safeSymlinkDirectoryKeys),
1308
+ ].filter((directory) => PROJECT_FILE_DEFINITIONS.some((definition, definitionIndex) => definition.kind === "dir" && matchesDefinition(path.basename(directory), definitionIndex)));
1309
+ const linkedDirectoryKeys = new Set(linkedMatches.filter((match) => match.endsWith("/")).map((match) => fileIdentityKey(match.slice(0, -1))));
1310
+ const rootSafeLinked = filterGitIgnoredEntries(await filterRealPathsWithinRootEntries(linkedMatches.map((match) => (match.endsWith("/") ? match.slice(0, -1) : match)), realRoot, reportMetadataFileChecks), linkedDirectoryKeys);
1311
+ rootSafeMatches = [...fileMatches, ...directoryMatches, ...rootSafeLinked];
1312
+ }
1313
+ else {
1314
+ const allPatterns = PROJECT_FILE_DEFINITIONS.flatMap((definition) => definition.patterns.map(toProjectGlob));
1315
+ const matches = await fg(allPatterns, {
1316
+ cwd: root,
1317
+ absolute: true,
1318
+ dot: true,
1319
+ followSymbolicLinks: false,
1320
+ ignore: DEFAULT_PROJECT_FILE_IGNORES,
1321
+ markDirectories: true,
1322
+ onlyFiles: false,
1323
+ ...globFilesystemOption(discovery),
1324
+ });
1325
+ const linkedMatches = await listEntriesFromSafeSymlinkDirectories(root, realRoot, allPatterns, DEFAULT_PROJECT_FILE_IGNORES, {
1326
+ markDirectories: true,
1327
+ onlyFiles: false,
1328
+ ...(options?.knownSymlinkDirectories !== undefined
1329
+ ? { knownSymlinkDirectories: options.knownSymlinkDirectories }
1330
+ : {}),
1331
+ ...(options?.onSymlinkDirectoriesDiscovered
1332
+ ? { onSymlinkDirectoriesDiscovered: options.onSymlinkDirectoriesDiscovered }
1333
+ : {}),
1334
+ ...(reportMetadataSymlinkChecks ? { onPathCheckProgress: reportMetadataSymlinkChecks } : {}),
1335
+ ...globFilesystemField(discovery),
1336
+ });
1337
+ rootSafeMatches = await filterRealPathsWithinRoot([...matches, ...linkedMatches].map((match) => (match.endsWith("/") ? match.slice(0, -1) : match)), realRoot, reportMetadataFileChecks);
1338
+ }
1339
+ const entries = [];
1340
+ const matchTasks = rootSafeMatches.map(async (cleanMatch) => {
1341
+ const stats = await fsp.stat(cleanMatch);
1342
+ const isDir = stats.isDirectory();
1343
+ const fileName = path.basename(cleanMatch);
1344
+ for (let definitionIndex = 0; definitionIndex < PROJECT_FILE_DEFINITIONS.length; definitionIndex++) {
1345
+ const def = PROJECT_FILE_DEFINITIONS[definitionIndex];
1346
+ if (isDir && def.kind !== "dir")
1347
+ continue;
1348
+ if (!isDir && def.kind !== "file")
1349
+ continue;
1350
+ const matchesPattern = matchesDefinition(fileName, definitionIndex);
1351
+ if (matchesPattern) {
1352
+ entries.push(await buildProjectFileInfo(def, cleanMatch, discovery));
1353
+ }
1354
+ }
1355
+ });
1356
+ await Promise.all(matchTasks);
1357
+ const byKey = new Map();
1358
+ for (const entry of entries) {
1359
+ const key = `${entry.path}::${entry.type}::${entry.role}`;
1360
+ const existing = byKey.get(key);
1361
+ if (!existing || (!existing.name && entry.name)) {
1362
+ byKey.set(key, entry);
1363
+ }
1364
+ }
1365
+ return Array.from(byKey.values()).sort((a, b) => {
1366
+ if (a.path === b.path)
1367
+ return a.type.localeCompare(b.type);
1368
+ return a.path.localeCompare(b.path);
1369
+ });
1370
+ }
1371
+ catch (error) {
1372
+ logWithLevel(options?.logLevel, "debug", `discoverProjectFiles failed for ${root}: ${stringifyUnknown(error)}`);
1373
+ throw new Error(`Failed to discover project files in ${root}: ${stringifyUnknown(error)}`);
1374
+ }
1375
+ }
1376
+ async function addGitExcludeFiles(files, repositoryRoot, gitCache) {
1377
+ const excludes = await listGitExcludeFiles(repositoryRoot, gitExcludeListOptions(gitCache));
1378
+ for (const source of excludes) {
1379
+ files.add(normalizePath(source.file));
1380
+ }
1381
+ }
1382
+ async function collectAncestorGitignoreFiles(fromDir, stopDir) {
1383
+ const files = [];
1384
+ let current = normalizePath(fromDir);
1385
+ const stopKey = fileIdentityKey(stopDir);
1386
+ while (true) {
1387
+ const hit = await gitignoreFileIfPresent(current);
1388
+ if (hit)
1389
+ files.push(hit);
1390
+ if (fileIdentityKey(current) === stopKey)
1391
+ break;
1392
+ const parent = normalizePath(path.dirname(current));
1393
+ if (parent === current)
1394
+ break;
1395
+ if (!isFilePathWithinRoot(stopDir, parent) && fileIdentityKey(parent) !== stopKey)
1396
+ break;
1397
+ current = parent;
1398
+ }
1399
+ return files;
1400
+ }
1401
+ async function addGitignoreFilesForRoots(files, roots, state, scanned) {
1402
+ for (const ignoreRoot of roots) {
1403
+ const key = fileIdentityKey(ignoreRoot);
1404
+ if (scanned.has(key))
1405
+ continue;
1406
+ scanned.add(key);
1407
+ for (const file of await findGitignoreFiles(ignoreRoot, state)) {
1408
+ files.add(normalizePath(file));
1409
+ }
1410
+ }
1411
+ }
1412
+ export async function collectConfigHashInputFiles(projectRoot, discoveryContext, logLevel, callbacks, includeCodegraphConfig = true) {
1413
+ const root = await ensureDirectoryReadable(projectRoot, "Project root");
1414
+ const state = discoveryContext;
1415
+ const files = new Set(await listRootConfigFiles(root, state, includeCodegraphConfig));
1416
+ const gitCache = discoveryContext.git;
1417
+ const gitCandidates = await getSharedGitCandidates(discoveryContext, root, logLevel, callbacks);
1418
+ if (gitCandidates) {
1419
+ for (const source of gitCandidates.gitignoreFiles) {
1420
+ files.add(normalizePath(source.file));
1421
+ }
1422
+ return { files: Array.from(files).sort() };
1423
+ }
1424
+ const realRoot = normalizePath(await fsp.realpath(root));
1425
+ const gitRootCandidate = (await isGitRepo(root, gitCache)) ? root : realRoot;
1426
+ if (!(await isGitRepo(gitRootCandidate, gitCache))) {
1427
+ await addGitignoreFilesForRoots(files, [root], state, new Set());
1428
+ return { files: Array.from(files).sort() };
1429
+ }
1430
+ if (await isGitProjectRootIgnored(realRoot, gitCache)) {
1431
+ const scanned = new Set();
1432
+ await addGitignoreFilesForRoots(files, [root], state, scanned);
1433
+ const gitRoot = await getGitRepositoryRoot(gitRootCandidate);
1434
+ if (gitRoot) {
1435
+ await addGitExcludeFiles(files, gitRoot, gitCache);
1436
+ const submoduleDirectories = await listGitSubmoduleDirectories(gitRoot, { recurse: true });
1437
+ await addGitignoreFilesForRoots(files, [gitRoot, ...submoduleDirectories], state, scanned);
1438
+ for (const submodule of submoduleDirectories) {
1439
+ await addGitExcludeFiles(files, submodule, gitCache);
1440
+ }
1441
+ }
1442
+ return { files: Array.from(files).sort() };
1443
+ }
1444
+ const gitRoot = await getGitRepositoryRoot(gitRootCandidate);
1445
+ if (gitRoot) {
1446
+ for (const file of await collectAncestorGitignoreFiles(root, gitRoot)) {
1447
+ files.add(normalizePath(file));
1448
+ }
1449
+ await addGitExcludeFiles(files, gitRoot, gitCache);
1450
+ const submoduleDirectories = await listGitSubmoduleDirectories(gitRoot, { recurse: true });
1451
+ for (const submodule of submoduleDirectories) {
1452
+ await addGitExcludeFiles(files, submodule, gitCache);
1453
+ }
1454
+ }
1455
+ return {
1456
+ files: Array.from(files).sort(),
1457
+ error: "Failed to enumerate config files: Git listing unavailable",
1458
+ };
1459
+ }
1460
+ //# sourceMappingURL=project-files.js.map