scip-query 0.10.12 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (354) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/{vendor/scip/LICENSE.scip → LICENSE} +1 -0
  3. package/README.md +164 -49
  4. package/dist/augment-vue-worker.js +1 -1
  5. package/dist/{chunk-RUV5IY25.js → chunk-2LQWMYG4.js} +2 -2
  6. package/dist/{chunk-KZ4MG5NY.js → chunk-2QGE5AEP.js} +2 -2
  7. package/dist/chunk-4D54JIU3.js +2 -0
  8. package/dist/{chunk-2GLNBCHB.js → chunk-52Q4JFDW.js} +2 -2
  9. package/dist/chunk-5AAAEZ2Z.js +2 -0
  10. package/dist/chunk-64PRNLKP.js +2 -0
  11. package/dist/chunk-6XA4LDHY.js +2 -0
  12. package/dist/chunk-72MFTCU5.js +38 -0
  13. package/dist/chunk-75X52JTA.js +2 -0
  14. package/dist/{chunk-LEHVP4DY.js → chunk-7ITCOJGD.js} +2 -2
  15. package/dist/chunk-7JZRFDCU.js +2 -0
  16. package/dist/{chunk-XRUGSM76.js → chunk-AZLKLZ5S.js} +2 -2
  17. package/dist/chunk-B4VYXRCQ.js +26 -0
  18. package/dist/chunk-BCNT6ODA.js +5 -0
  19. package/dist/chunk-BP2NAIAZ.js +2 -0
  20. package/dist/chunk-BVNO67DB.js +2 -0
  21. package/dist/{chunk-XHMVZFA6.js → chunk-CW3KZ7UF.js} +2 -2
  22. package/dist/{chunk-6BN3EHQE.js → chunk-D64L53WX.js} +2 -2
  23. package/dist/{chunk-T3AEVJBG.js → chunk-D7J6GZAG.js} +2 -2
  24. package/dist/chunk-ECVXWZ4Q.js +3 -0
  25. package/dist/chunk-EDB7Y442.js +2 -0
  26. package/dist/{chunk-4ISHQ7UW.js → chunk-ETU2I5JM.js} +4 -4
  27. package/dist/chunk-EXKLAEB4.js +18 -0
  28. package/dist/chunk-EZ5WDZ2Q.js +3 -0
  29. package/dist/{chunk-S2MRVIJ5.js → chunk-F5BJSNU5.js} +6 -6
  30. package/dist/chunk-FBCOFKEC.js +2 -0
  31. package/dist/chunk-FERAXG6Y.js +72 -0
  32. package/dist/chunk-FXG3PHVW.js +9 -0
  33. package/dist/{chunk-XUCZ3RQ5.js → chunk-G2UBOONK.js} +4 -4
  34. package/dist/chunk-GNG622H3.js +3 -0
  35. package/dist/{chunk-JS6B76AQ.js → chunk-H2NMIZFD.js} +2 -2
  36. package/dist/chunk-H7NSJ7L2.js +5 -0
  37. package/dist/chunk-HSU3M25J.js +21 -0
  38. package/dist/chunk-HXXMPYEF.js +2 -0
  39. package/dist/chunk-IRJDYTNZ.js +3 -0
  40. package/dist/chunk-ISLWJ4PY.js +10 -0
  41. package/dist/chunk-J5WVNZ6O.js +2 -0
  42. package/dist/{chunk-UVPY3RUZ.js → chunk-K6UI6EBZ.js} +2 -2
  43. package/dist/{chunk-MNCQPMCH.js → chunk-KJCDEDQW.js} +2 -2
  44. package/dist/{chunk-ELC77ZDE.js → chunk-KMVGRIO2.js} +2 -2
  45. package/dist/chunk-KSUZS77X.js +16 -0
  46. package/dist/{chunk-A4UTLKHU.js → chunk-L2CX5GHZ.js} +2 -2
  47. package/dist/chunk-LFM3O5KX.js +2 -0
  48. package/dist/{chunk-ZUUNREKS.js → chunk-M72ZFN6E.js} +5 -5
  49. package/dist/chunk-MBKJ7GHT.js +102 -0
  50. package/dist/chunk-MJKJMWIM.js +2 -0
  51. package/dist/chunk-MKM7NBZK.js +43 -0
  52. package/dist/chunk-MTDBHTSF.js +2 -0
  53. package/dist/chunk-NAH5EAZS.js +6 -0
  54. package/dist/chunk-NJJ7AS4F.js +2 -0
  55. package/dist/{chunk-EOLGSSDR.js → chunk-NKT5EMEX.js} +2 -2
  56. package/dist/{chunk-ANUEY5WV.js → chunk-NLMRJ7SI.js} +2 -2
  57. package/dist/chunk-NQ75OVUU.js +40 -0
  58. package/dist/{chunk-TBCHRDAC.js → chunk-O3WDE26W.js} +2 -2
  59. package/dist/{chunk-VB2EZZPA.js → chunk-OPE5YXFE.js} +2 -2
  60. package/dist/chunk-ORBRX2QJ.js +2 -0
  61. package/dist/{chunk-OFXN2BCT.js → chunk-OSWF3HSF.js} +2 -2
  62. package/dist/{chunk-JJ5SAWBT.js → chunk-OVMUVXKQ.js} +2 -2
  63. package/dist/{chunk-NTSR6SRP.js → chunk-PH7ZFK6L.js} +2 -2
  64. package/dist/chunk-PXHPCWX5.js +2 -0
  65. package/dist/chunk-Q3B3FNCU.js +3 -0
  66. package/dist/{chunk-SQNHOOJ5.js → chunk-Q7S2DADC.js} +2 -2
  67. package/dist/{chunk-3XSNW5XB.js → chunk-QARYU7R3.js} +2 -2
  68. package/dist/chunk-QZ4JVECJ.js +2 -0
  69. package/dist/{chunk-FX6ULETZ.js → chunk-R5336VHZ.js} +2 -2
  70. package/dist/chunk-RA5MTIOO.js +2 -0
  71. package/dist/{chunk-RXINFVBN.js → chunk-RIQED5OU.js} +2 -2
  72. package/dist/chunk-T2FQ4GHD.js +9 -0
  73. package/dist/chunk-T6NGEV5I.js +2 -0
  74. package/dist/chunk-T7VQG55Q.js +2 -0
  75. package/dist/chunk-TFWDJDGO.js +2 -0
  76. package/dist/chunk-TG7QSYCJ.js +2 -0
  77. package/dist/{chunk-DQ6433ZG.js → chunk-TTMKELT7.js} +17 -8
  78. package/dist/{chunk-DDQONX6B.js → chunk-U7I373V4.js} +2 -2
  79. package/dist/chunk-UAHZ57BR.js +2 -0
  80. package/dist/chunk-URSSPS5H.js +2 -0
  81. package/dist/chunk-V3Z3IOWO.js +2 -0
  82. package/dist/{chunk-7C6JBBE4.js → chunk-V7CVBPWX.js} +2 -2
  83. package/dist/{chunk-PWAK75BU.js → chunk-VYF5HA76.js} +2 -2
  84. package/dist/chunk-WIBFXSYB.js +6 -0
  85. package/dist/chunk-WS3Z6W3M.js +65 -0
  86. package/dist/chunk-WXVGNFAO.js +2 -0
  87. package/dist/chunk-XEMQUN3Z.js +20 -0
  88. package/dist/chunk-YCPASUCX.js +2 -0
  89. package/dist/chunk-YDDGCJJG.js +3 -0
  90. package/dist/{chunk-2UVCH7CQ.js → chunk-YPKBZ77R.js} +2 -2
  91. package/dist/chunk-YZXV3CU3.js +60 -0
  92. package/dist/chunk-Z3IPJKJP.js +4 -0
  93. package/dist/chunk-ZMGBWSFZ.js +2 -0
  94. package/dist/{chunk-GKB4JJDU.js → chunk-ZOIPAYRP.js} +2 -2
  95. package/dist/chunk-ZRIOGL7F.js +8 -0
  96. package/dist/cli.js +446 -280
  97. package/dist/{config-types-dvHOz0zU.d.ts → config-types-BrHl3Bge.d.ts} +57 -0
  98. package/dist/{db-rMZO5JFK.d.ts → db-_Bdx0E1W.d.ts} +1 -1
  99. package/dist/diff-gate-types-CG2YQ_ei.d.ts +4 -0
  100. package/dist/{frontend-behavior-evidence-BxKpKWUu.d.ts → frontend-behavior-evidence-EfM4_9bc.d.ts} +1 -1
  101. package/dist/{health-CtTIGh6H.d.ts → health-BEZ1Rt0S.d.ts} +54 -2
  102. package/dist/index.d.ts +4 -68
  103. package/dist/index.js +1 -1
  104. package/dist/postinstall.js +1 -4
  105. package/dist/queries/affected.d.ts +2 -2
  106. package/dist/queries/affected.js +1 -1
  107. package/dist/queries/bottlenecks.d.ts +2 -2
  108. package/dist/queries/bottlenecks.js +1 -1
  109. package/dist/queries/by-kind.d.ts +2 -2
  110. package/dist/queries/by-kind.js +1 -1
  111. package/dist/queries/call-graph.d.ts +2 -2
  112. package/dist/queries/call-graph.js +1 -1
  113. package/dist/queries/change-surface.d.ts +2 -2
  114. package/dist/queries/change-surface.js +1 -1
  115. package/dist/queries/cleanup-plan.d.ts +2 -2
  116. package/dist/queries/cleanup-plan.js +1 -1
  117. package/dist/queries/co-change.d.ts +12 -2
  118. package/dist/queries/co-change.js +1 -1
  119. package/dist/queries/code.d.ts +2 -2
  120. package/dist/queries/code.js +1 -1
  121. package/dist/queries/complexity-hotspots.d.ts +7 -3
  122. package/dist/queries/complexity-hotspots.js +1 -1
  123. package/dist/queries/complexity.d.ts +42 -4
  124. package/dist/queries/complexity.js +1 -1
  125. package/dist/queries/convergence.d.ts +2 -2
  126. package/dist/queries/convergence.js +1 -1
  127. package/dist/queries/coupling.d.ts +2 -2
  128. package/dist/queries/coupling.js +1 -1
  129. package/dist/queries/cycles.d.ts +12 -3
  130. package/dist/queries/cycles.js +1 -1
  131. package/dist/queries/dataflow.d.ts +2 -2
  132. package/dist/queries/dataflow.js +1 -1
  133. package/dist/queries/dead.d.ts +3 -3
  134. package/dist/queries/dead.js +1 -1
  135. package/dist/queries/deep-chains.d.ts +2 -2
  136. package/dist/queries/deep-chains.js +1 -1
  137. package/dist/queries/deps.d.ts +2 -2
  138. package/dist/queries/deps.js +1 -1
  139. package/dist/queries/diff-gate.d.ts +65 -8
  140. package/dist/queries/diff-gate.js +1 -1
  141. package/dist/queries/diff-impact.d.ts +21 -3
  142. package/dist/queries/diff-impact.js +1 -1
  143. package/dist/queries/doc-drift.d.ts +29 -2
  144. package/dist/queries/doc-drift.js +1 -1
  145. package/dist/queries/drift.d.ts +15 -3
  146. package/dist/queries/drift.js +1 -1
  147. package/dist/queries/duplicate-bodies.d.ts +55 -0
  148. package/dist/queries/duplicate-bodies.js +2 -0
  149. package/dist/queries/extract-candidates.d.ts +2 -2
  150. package/dist/queries/extract-candidates.js +1 -1
  151. package/dist/queries/fan.d.ts +2 -2
  152. package/dist/queries/fan.js +1 -1
  153. package/dist/queries/files.d.ts +4 -3
  154. package/dist/queries/files.js +1 -1
  155. package/dist/queries/health.d.ts +3 -3
  156. package/dist/queries/health.js +1 -1
  157. package/dist/queries/hierarchy.d.ts +2 -2
  158. package/dist/queries/hierarchy.js +1 -1
  159. package/dist/queries/hotspots.d.ts +2 -2
  160. package/dist/queries/hotspots.js +1 -1
  161. package/dist/queries/imports.d.ts +2 -2
  162. package/dist/queries/imports.js +1 -1
  163. package/dist/queries/incomplete-migration.d.ts +3 -2
  164. package/dist/queries/incomplete-migration.js +1 -1
  165. package/dist/queries/index.d.ts +12 -7
  166. package/dist/queries/index.js +1 -1
  167. package/dist/queries/isolated.d.ts +2 -2
  168. package/dist/queries/isolated.js +1 -1
  169. package/dist/queries/locality-candidates.d.ts +2 -2
  170. package/dist/queries/locality-candidates.js +1 -1
  171. package/dist/queries/members.d.ts +2 -2
  172. package/dist/queries/members.js +1 -1
  173. package/dist/queries/methods.d.ts +2 -2
  174. package/dist/queries/methods.js +1 -1
  175. package/dist/queries/outline.d.ts +2 -2
  176. package/dist/queries/outline.js +1 -1
  177. package/dist/queries/passthrough-candidates.d.ts +11 -3
  178. package/dist/queries/passthrough-candidates.js +1 -1
  179. package/dist/queries/plan-context.d.ts +3 -2
  180. package/dist/queries/plan-context.js +1 -1
  181. package/dist/queries/react-component-duplicates.d.ts +7 -2
  182. package/dist/queries/react-component-duplicates.js +1 -1
  183. package/dist/queries/react-hook-candidates.d.ts +3 -3
  184. package/dist/queries/react-hook-candidates.js +1 -1
  185. package/dist/queries/react-large-component-pressure.d.ts +2 -2
  186. package/dist/queries/react-large-component-pressure.js +1 -1
  187. package/dist/queries/recent-duplicates.d.ts +2 -2
  188. package/dist/queries/recent-duplicates.js +1 -1
  189. package/dist/queries/redundant-reexports.d.ts +2 -2
  190. package/dist/queries/redundant-reexports.js +1 -1
  191. package/dist/queries/refs.d.ts +2 -2
  192. package/dist/queries/refs.js +1 -1
  193. package/dist/queries/self-audit.d.ts +4 -2
  194. package/dist/queries/self-audit.js +1 -1
  195. package/dist/queries/similar-chains.d.ts +2 -2
  196. package/dist/queries/similar-chains.js +1 -1
  197. package/dist/queries/similar-files.d.ts +2 -2
  198. package/dist/queries/similar-files.js +1 -1
  199. package/dist/queries/similar-signatures.d.ts +17 -10
  200. package/dist/queries/similar-signatures.js +1 -1
  201. package/dist/queries/similar.d.ts +42 -3
  202. package/dist/queries/similar.js +1 -1
  203. package/dist/queries/slice.d.ts +2 -2
  204. package/dist/queries/slice.js +1 -1
  205. package/dist/queries/stale-abstractions.d.ts +2 -2
  206. package/dist/queries/stale-abstractions.js +1 -1
  207. package/dist/queries/stats.d.ts +2 -2
  208. package/dist/queries/surface.d.ts +2 -2
  209. package/dist/queries/surface.js +1 -1
  210. package/dist/queries/symbols.d.ts +2 -2
  211. package/dist/queries/symbols.js +1 -1
  212. package/dist/queries/system.d.ts +2 -2
  213. package/dist/queries/system.js +1 -1
  214. package/dist/queries/trace.d.ts +2 -2
  215. package/dist/queries/trace.js +1 -1
  216. package/dist/queries/twin-ab.d.ts +55 -0
  217. package/dist/queries/twin-ab.js +2 -0
  218. package/dist/queries/twin-drift.d.ts +97 -0
  219. package/dist/queries/twin-drift.js +2 -0
  220. package/dist/queries/unused-imports.d.ts +2 -2
  221. package/dist/queries/unused-imports.js +1 -1
  222. package/dist/queries/unused-params.d.ts +2 -2
  223. package/dist/queries/unused-params.js +1 -1
  224. package/dist/queries/vue-component-duplicates.d.ts +7 -2
  225. package/dist/queries/vue-component-duplicates.js +1 -1
  226. package/dist/queries/vue-composable-candidates.d.ts +3 -3
  227. package/dist/queries/vue-composable-candidates.js +1 -1
  228. package/dist/queries/vue-large-view-pressure.d.ts +6 -2
  229. package/dist/queries/vue-large-view-pressure.js +1 -1
  230. package/dist/queries/wrapper-candidates.d.ts +2 -2
  231. package/dist/queries/wrapper-candidates.js +1 -1
  232. package/dist/reindex-worker.js +9 -9
  233. package/dist/reindex.d.ts +23 -4
  234. package/dist/reindex.js +19 -19
  235. package/dist/runtime.d.ts +11 -6
  236. package/dist/runtime.js +2 -2
  237. package/dist/{scip-cli-trnNvymv.d.ts → scip-cli-C7cg4ZHR.d.ts} +1 -1
  238. package/dist/symbol-types-DaoeXKUt.d.ts +66 -0
  239. package/docs/AGENT_GUIDE.md +20 -18
  240. package/docs/AI_FAILURE_MODES.md +36 -13
  241. package/docs/API.md +1 -1
  242. package/docs/COMMAND_REFERENCE.md +57 -14
  243. package/docs/DETECTOR_GUIDE.md +20 -3
  244. package/docs/REGEX_POLICY.md +34 -0
  245. package/docs/analyzer-inventory.md +40 -3
  246. package/docs/analyzer-validation-ledger.md +34 -6
  247. package/package.json +39 -7
  248. package/scripts/build-scip-windows.mjs +10 -7
  249. package/skills/_shared/SKILL.md +243 -0
  250. package/skills/_shared/agents/openai.yaml +4 -0
  251. package/skills/scip-api-impact/SKILL.md +55 -71
  252. package/skills/scip-claim-audit/SKILL.md +105 -0
  253. package/skills/scip-claim-audit/agents/openai.yaml +4 -0
  254. package/skills/scip-cleanup-audit/SKILL.md +122 -0
  255. package/skills/scip-cleanup-audit/agents/openai.yaml +4 -0
  256. package/skills/scip-cleanup-improve/SKILL.md +84 -0
  257. package/skills/scip-cleanup-improve/agents/openai.yaml +4 -0
  258. package/skills/scip-concrete-plan/SKILL.md +181 -0
  259. package/skills/scip-concrete-plan/agents/openai.yaml +4 -0
  260. package/skills/scip-conductor/SKILL.md +133 -0
  261. package/skills/scip-conductor/agents/openai.yaml +4 -0
  262. package/skills/scip-debug/SKILL.md +60 -58
  263. package/skills/scip-diagram/SKILL.md +64 -94
  264. package/skills/scip-directory-architecture/SKILL.md +65 -107
  265. package/skills/scip-doc-reconcile/SKILL.md +56 -67
  266. package/skills/scip-explore/SKILL.md +78 -210
  267. package/skills/scip-hyper-optimization/SKILL.md +124 -198
  268. package/skills/scip-integrity-audit/SKILL.md +103 -0
  269. package/skills/scip-integrity-audit/agents/openai.yaml +4 -0
  270. package/skills/scip-language-playbook/SKILL.md +56 -326
  271. package/skills/scip-maintainability/SKILL.md +80 -219
  272. package/skills/scip-probe-reachability/SKILL.md +92 -0
  273. package/skills/scip-probe-reachability/agents/openai.yaml +4 -0
  274. package/skills/scip-query/SKILL.md +108 -124
  275. package/skills/scip-react-maintainability/SKILL.md +64 -82
  276. package/skills/scip-setup/SKILL.md +121 -0
  277. package/skills/scip-setup/agents/openai.yaml +4 -0
  278. package/skills/scip-tla-model-system/SKILL.md +150 -0
  279. package/skills/scip-tla-model-system/agents/openai.yaml +4 -0
  280. package/skills/scip-triage-issue/SKILL.md +53 -41
  281. package/skills/scip-twin-drift/SKILL.md +107 -0
  282. package/skills/scip-twin-drift/agents/openai.yaml +4 -0
  283. package/skills/scip-verify/SKILL.md +70 -88
  284. package/skills/scip-vue-maintainability/SKILL.md +67 -94
  285. package/dist/chunk-2DOW7QCA.js +0 -71
  286. package/dist/chunk-2FMFF4RI.js +0 -2
  287. package/dist/chunk-5GXTUANY.js +0 -2
  288. package/dist/chunk-5JHEN5VN.js +0 -25
  289. package/dist/chunk-62ULXMQ7.js +0 -18
  290. package/dist/chunk-63CI3IXR.js +0 -102
  291. package/dist/chunk-7EK7OSWS.js +0 -2
  292. package/dist/chunk-7IWIMNHI.js +0 -2
  293. package/dist/chunk-7XTO4YXB.js +0 -8
  294. package/dist/chunk-AOWFUGDL.js +0 -2
  295. package/dist/chunk-AREANYIA.js +0 -3
  296. package/dist/chunk-AZBELWZQ.js +0 -7
  297. package/dist/chunk-B32FX5KB.js +0 -2
  298. package/dist/chunk-B6MJ5VQV.js +0 -2
  299. package/dist/chunk-CXWCLVYL.js +0 -2
  300. package/dist/chunk-CYHIKTJN.js +0 -3
  301. package/dist/chunk-DFSEARAU.js +0 -2
  302. package/dist/chunk-DVFP6PZI.js +0 -2
  303. package/dist/chunk-E3ADDB43.js +0 -2
  304. package/dist/chunk-F6IXELII.js +0 -20
  305. package/dist/chunk-FMGVZBS2.js +0 -2
  306. package/dist/chunk-GG5LHT27.js +0 -2
  307. package/dist/chunk-H7JF2CKK.js +0 -2
  308. package/dist/chunk-HHOMJCP5.js +0 -4
  309. package/dist/chunk-HRDSU5FN.js +0 -9
  310. package/dist/chunk-HWVYTJOV.js +0 -2
  311. package/dist/chunk-JNMLBL36.js +0 -2
  312. package/dist/chunk-L446VQYQ.js +0 -2
  313. package/dist/chunk-LDJUB7XW.js +0 -2
  314. package/dist/chunk-MYTUWXHK.js +0 -4
  315. package/dist/chunk-N25HPUOK.js +0 -2
  316. package/dist/chunk-NABVR6B7.js +0 -2
  317. package/dist/chunk-NBNEVLRC.js +0 -3
  318. package/dist/chunk-ONPCQ2PM.js +0 -6
  319. package/dist/chunk-Q5P7NOVM.js +0 -2
  320. package/dist/chunk-RGKRYO22.js +0 -4
  321. package/dist/chunk-RM2WQ75T.js +0 -2
  322. package/dist/chunk-ROGZXWN2.js +0 -2
  323. package/dist/chunk-RSSXKJ6J.js +0 -38
  324. package/dist/chunk-RVGEZYMQ.js +0 -2
  325. package/dist/chunk-SA3DPTHT.js +0 -7
  326. package/dist/chunk-SGTKURU6.js +0 -52
  327. package/dist/chunk-T4N2ZRVY.js +0 -21
  328. package/dist/chunk-THB6AM3V.js +0 -11
  329. package/dist/chunk-ULHLDOD6.js +0 -4
  330. package/dist/chunk-UQ73QF5D.js +0 -43
  331. package/dist/chunk-UUBMFL3F.js +0 -59
  332. package/dist/chunk-V5FGK3DZ.js +0 -2
  333. package/dist/chunk-WTY5FERW.js +0 -2
  334. package/dist/chunk-WUOB4DHH.js +0 -6
  335. package/dist/chunk-YFQIKYOP.js +0 -2
  336. package/dist/chunk-Z2LDWIJV.js +0 -5
  337. package/dist/chunk-ZNWWVYQL.js +0 -3
  338. package/skills/concrete-plan/SKILL.md +0 -372
  339. package/skills/concrete-plan/agents/openai.yaml +0 -4
  340. package/skills/scip-adoption/SKILL.md +0 -122
  341. package/skills/scip-adoption/agents/openai.yaml +0 -4
  342. package/skills/scip-ai-cleanup/SKILL.md +0 -153
  343. package/skills/scip-ai-cleanup/agents/openai.yaml +0 -4
  344. package/skills/scip-debloat/SKILL.md +0 -439
  345. package/skills/scip-debloat/agents/openai.yaml +0 -4
  346. package/skills/scip-health-audit/SKILL.md +0 -162
  347. package/skills/scip-health-audit/agents/openai.yaml +0 -4
  348. package/skills/scip-health-improve/SKILL.md +0 -155
  349. package/skills/scip-health-improve/agents/openai.yaml +0 -4
  350. package/skills/scip-query-setup/SKILL.md +0 -170
  351. package/skills/scip-query-setup/agents/openai.yaml +0 -3
  352. package/vendor/scip/README.md +0 -6
  353. package/vendor/scip/win32-arm64/scip.exe +0 -0
  354. package/vendor/scip/win32-x64/scip.exe +0 -0
@@ -1,13 +1,13 @@
1
- import{a as C,b as w,c as L}from"./chunk-2DOW7QCA.js";import{a as b,b as k,f as G}from"./chunk-ONPCQ2PM.js";import{execFileSync as Xt}from"child_process";import{closeSync as Ht,copyFileSync as Kt,existsSync as R,mkdirSync as J,mkdtempSync as Qt,openSync as Yt,readFileSync as I,renameSync as h,rmSync as y,writeFileSync as ye}from"fs";import{basename as j,dirname as g,extname as Vt,join as f}from"path";import{execFileSync as $e}from"child_process";import{existsSync as Ae,readdirSync as H}from"fs";import{extname as K,join as Q}from"path";var Ne=new Set([".git",".hg",".svn",".idea",".vscode","node_modules","vendor","dist","build","target","bin","obj",".dart_tool",".gradle",".next",".venv","venv","__pycache__"]),Fe=[{language:"typescript",files:["tsconfig.json","tsconfig.base.json"],extensions:[".ts",".tsx",".mts",".cts"]},{language:"rust",files:["Cargo.toml"],extensions:[".rs"]},{language:"go",files:["go.mod"],extensions:[".go"]},{language:"java",files:["pom.xml","build.gradle","build.gradle.kts"],extensions:[".java"]},{language:"kotlin",files:["build.gradle.kts"],extensions:[".kt",".kts"]},{language:"scala",files:["build.sbt"],extensions:[".scala"]},{language:"clojure",files:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"],extensions:[".clj",".cljs",".cljc"]},{language:"python",files:["pyproject.toml","setup.py","setup.cfg","Pipfile"],extensions:[".py",".pyi"]},{language:"ruby",files:["Gemfile"],extensions:[".rb"]},{language:"cpp",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"]},{language:"c",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".c",".h"]},{language:"csharp",globs:["*.csproj","*.sln"],extensions:[".cs"]},{language:"vb",globs:["*.vbproj"],extensions:[".vb"]},{language:"dart",files:["pubspec.yaml"],extensions:[".dart"]},{language:"php",files:["composer.json"],extensions:[".php"]},{language:"javascript",files:["package.json"],extensions:[".js",".jsx",".mjs",".cjs"]}];function Y(e){let t=[],n=Te(e),r=We(e);for(let i of Fe){if(Be(e,i.files)){t.push(i.language);continue}if(_e(n,i.globs)){t.push(i.language);continue}qe(r,i.extensions)&&t.push(i.language)}return t.includes("typescript")&&X(t,"javascript"),t.includes("cpp")&&!r.has(".c")&&X(t,"c"),t}function Te(e){try{return H(e)}catch{return[]}}function Be(e,t){return t?.length?t.some(n=>Ae(Q(e,n))):!1}function _e(e,t){return t?.length?e.some(n=>t.some(r=>Ue(n,r))):!1}function Ue(e,t){if(t==="*")return!0;if(!t.includes("*"))return e===t;let[n,r]=t.split("*");return e.startsWith(n??"")&&e.endsWith(r??"")}function We(e){let t=Je(e);if(t)return t;let n=new Set,r=[e];for(;r.length>0;){let i=r.pop();if(!i)continue;let a;try{a=H(i,{withFileTypes:!0})}catch{continue}for(let s of a){if(s.name.startsWith(".")&&!s.name.endsWith("proj")&&!s.name.endsWith("sln")&&s.isDirectory())continue;let o=Q(i,s.name);if(s.isDirectory()){Ne.has(s.name)||r.push(o);continue}let c=K(s.name).toLowerCase();c&&n.add(c)}}return n}function Je(e){try{let t=$e("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"]}),n=new Set;for(let r of t.split(`
2
- `)){if(!r)continue;let i=K(r).toLowerCase();i&&n.add(i)}return n}catch{return null}}function qe(e,t){return t?.length?t.some(n=>e.has(n)):!1}function X(e,t){let n=e.indexOf(t);n!==-1&&e.splice(n,1)}import{existsSync as V,readdirSync as ze}from"fs";import{isAbsolute as Ge,join as M,resolve as Xe}from"path";var He={typescript:{language:"typescript",indexerBinary:"scip-typescript",checkCommand:"npx scip-typescript --version",indexArgs:({outputPath:e,pnpmWorkspaces:t,indexerBinary:n,projectPath:r})=>{let i=r?["index","--output",e,"--no-progress-bar",r]:["index","--infer-tsconfig","--output",e,"--no-progress-bar"];return t&&!r&&i.splice(1,0,"--pnpm-workspaces"),{binary:n,args:i}},markerFiles:["tsconfig.json"],installMethods:[{label:"npm",prerequisite:"npm",binary:"npm",args:["install","-g","@sourcegraph/scip-typescript"]}],installUrl:"https://github.com/sourcegraph/scip-typescript",bundledNpmPackage:"@sourcegraph/scip-typescript"},javascript:{language:"javascript",indexerBinary:"scip-typescript",checkCommand:"npx scip-typescript --version",indexArgs:({outputPath:e,indexerBinary:t})=>({binary:t,args:["index","--infer-tsconfig","--output",e,"--no-progress-bar"]}),markerFiles:["package.json"],installMethods:[{label:"npm",prerequisite:"npm",binary:"npm",args:["install","-g","@sourcegraph/scip-typescript"]}],installUrl:"https://github.com/sourcegraph/scip-typescript",bundledNpmPackage:"@sourcegraph/scip-typescript"},java:{language:"java",indexerBinary:"scip-java",checkCommand:"scip-java --version",indexArgs:({outputPath:e})=>({binary:"scip-java",args:["index","--output",e]}),markerFiles:["pom.xml","build.gradle"],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},scala:{language:"scala",indexerBinary:"scip-java",checkCommand:"scip-java --version",indexArgs:({outputPath:e})=>({binary:"scip-java",args:["index","--output",e]}),markerFiles:["build.sbt"],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},kotlin:{language:"kotlin",indexerBinary:"scip-java",checkCommand:"scip-java --version",indexArgs:({outputPath:e})=>({binary:"scip-java",args:["index","--output",e]}),markerFiles:["build.gradle.kts"],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},rust:{language:"rust",indexerBinary:"rust-analyzer",checkCommand:"rust-analyzer --version",indexArgs:({outputPath:e})=>({binary:"rust-analyzer",args:["scip",".","--output",e]}),markerFiles:["Cargo.toml"],installMethods:[{label:"rustup",prerequisite:"rustup",binary:"rustup",args:["component","add","rust-analyzer"]}],installUrl:"https://github.com/rust-lang/rust-analyzer"},python:{language:"python",indexerBinary:"scip-python-plus",binaryAliases:["scip-python"],checkCommand:"scip-python-plus --version",indexArgs:({outputPath:e,indexerBinary:t})=>({binary:t,args:["index","--output",e,"--project-name","project"]}),markerFiles:["pyproject.toml","setup.py"],installMethods:[{label:"npm",prerequisite:"npm",binary:"npm",args:["install","-g","scip-python-plus"]}],installUrl:"https://github.com/PlunderStruck/scip-python",bundledNpmPackage:"scip-python-plus"},clojure:{language:"clojure",indexerBinary:"scip-clojure",projectLocalBinaries:["node_modules/.bin/scip-clojure"],checkCommand:"scip-clojure -h",indexArgs:({projectRoot:e,outputPath:t,indexerBinary:n,configPath:r})=>{let i=["-root",e,"-output",t];return r&&i.push("-config",Ge(r)?r:Xe(e,r)),{binary:n,args:i}},markerFiles:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"],installMethods:[{label:"npm",prerequisite:"npm",binary:"npm",args:["install","-g","scip-clojure"]}],installUrl:"https://github.com/PlunderStruck/scip-clojure"},ruby:{language:"ruby",indexerBinary:"scip-ruby",checkCommand:"scip-ruby --version",indexArgs:({indexerBinary:e})=>({binary:e,args:["--dir","."]}),defaultOutputPath:"index.scip",markerFiles:["Gemfile"],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-ruby/releases"},go:{language:"go",indexerBinary:"scip-go",checkCommand:"scip-go --version",indexArgs:({outputPath:e})=>({binary:"scip-go",args:["--output",e]}),markerFiles:["go.mod"],installMethods:[{label:"go install",prerequisite:"go",binary:"go",args:["install","github.com/sourcegraph/scip-go@latest"]}],installUrl:"https://github.com/sourcegraph/scip-go"},cpp:{language:"cpp",indexerBinary:"scip-clang",checkCommand:"scip-clang --version",indexArgs:({outputPath:e})=>({binary:"scip-clang",args:["--compdb-path","compile_commands.json","--index-output-path",e]}),markerFiles:["CMakeLists.txt","Makefile"],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-clang/releases"},c:{language:"c",indexerBinary:"scip-clang",checkCommand:"scip-clang --version",indexArgs:({outputPath:e})=>({binary:"scip-clang",args:["--compdb-path","compile_commands.json","--index-output-path",e]}),markerFiles:["CMakeLists.txt","Makefile"],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-clang/releases"},csharp:{language:"csharp",indexerBinary:"scip-dotnet",checkCommand:"scip-dotnet --version",indexArgs:({projectRoot:e,outputPath:t})=>({binary:"scip-dotnet",args:["index",Z(e,[".sln",".csproj"])??e,"--output",t,"--working-directory",e]}),markerFiles:["*.csproj","*.sln"],installMethods:[{label:"dotnet",prerequisite:"dotnet",binary:"dotnet",args:["tool","install","--global","scip-dotnet"]}],installUrl:"https://github.com/sourcegraph/scip-dotnet/releases"},vb:{language:"vb",indexerBinary:"scip-dotnet",checkCommand:"scip-dotnet --version",indexArgs:({projectRoot:e,outputPath:t})=>({binary:"scip-dotnet",args:["index",Z(e,[".sln",".vbproj"])??e,"--output",t,"--working-directory",e]}),markerFiles:["*.vbproj","*.sln"],installMethods:[{label:"dotnet",prerequisite:"dotnet",binary:"dotnet",args:["tool","install","--global","scip-dotnet"]}],installUrl:"https://github.com/sourcegraph/scip-dotnet/releases"},dart:{language:"dart",indexerBinary:"scip-dart",checkCommand:"scip-dart --version",indexArgs:({indexerBinary:e,outputPath:t})=>({binary:e,args:["--output",t]}),markerFiles:["pubspec.yaml"],installMethods:[{label:"dart pub",prerequisite:"dart",binary:"dart",args:["pub","global","activate","scip_dart"]}],installUrl:"https://github.com/Workiva/scip-dart/releases"},php:{language:"php",indexerBinary:"scip-php",projectLocalBinaries:["vendor/davidrjenni/scip-php/bin/scip-php","vendor/bin/scip-php"],checkCommand:"scip-php --version",indexArgs:({projectRoot:e,indexerBinary:t})=>{let n=M(e,"vendor","bin","scip-php"),r=M(e,"vendor","davidrjenni","scip-php","bin","scip-php");return{binary:"php",args:["-d","error_reporting=E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED",V(r)?r:V(n)?n:t]}},defaultOutputPath:"index.scip",markerFiles:["composer.json"],installMethods:[],installUrl:"https://github.com/davidrjenni/scip-php/releases"}};function D(e){return He[e]}function Z(e,t){let n;try{n=ze(e)}catch{return null}for(let r of t)for(let i of n)if(i.endsWith(r))return M(e,i);return null}import{readFileSync as Ke,writeFileSync as Qe}from"fs";import{create as O}from"@bufbuild/protobuf";import{deserializeSCIP as Ye,serializeSCIP as Ve,DocumentSchema as Ze,IndexSchema as et,SymbolInformationSchema as tt}from"@c4312/scip";function nt(e){if(e.length===0)throw new Error("Cannot merge zero SCIP indexes");if(e.length===1)return e[0];let t=rt(e),n=it(e.flatMap(i=>i.documents??[])),r=ee(e.flatMap(i=>i.externalSymbols??[]));return O(et,{metadata:t,documents:n,externalSymbols:r})}function E(e,t){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let n=e.map(i=>Ye(Ke(i))),r=nt(n);return Qe(t,Buffer.from(Ve(r))),{documentCount:r.documents.length,externalSymbolCount:r.externalSymbols.length,inputCount:e.length}}function rt(e){let t=e[0]?.metadata;if(!t)return;let n=t.projectRoot;for(let r of e.slice(1)){let i=r.metadata?.projectRoot;if(n&&i&&i!==n)throw new Error(`Cannot merge SCIP indexes with different project roots: ${n} vs ${i}`)}return t}function it(e){let t=new Map;for(let n of e){let r=t.get(n.relativePath);if(!r){t.set(n.relativePath,n);continue}t.set(n.relativePath,O(Ze,{language:r.language||n.language,relativePath:r.relativePath||n.relativePath,occurrences:at([...r.occurrences,...n.occurrences]),symbols:ee([...r.symbols,...n.symbols]),text:ot(r.text,n.text),positionEncoding:r.positionEncoding||n.positionEncoding}))}return[...t.values()]}function at(e){let t=new Set,n=[];for(let r of e){let i=JSON.stringify(r);t.has(i)||(t.add(i),n.push(r))}return n}function ee(e){let t=new Map;for(let n of e){let r=t.get(n.symbol);if(!r){t.set(n.symbol,n);continue}t.set(n.symbol,O(tt,{symbol:r.symbol,documentation:ut([...r.documentation,...n.documentation]),relationships:st([...r.relationships,...n.relationships]),kind:r.kind||n.kind,displayName:r.displayName||n.displayName,enclosingSymbol:r.enclosingSymbol||n.enclosingSymbol,signatureDocumentation:r.signatureDocumentation??n.signatureDocumentation}))}return[...t.values()]}function st(e){let t=new Set,n=[];for(let r of e){let i=[r.symbol,r.isReference?"1":"0",r.isImplementation?"1":"0",r.isTypeDefinition?"1":"0",r.isDefinition?"1":"0"].join("|");t.has(i)||(t.add(i),n.push(r))}return n}function ot(e,t){return e?t?e.length>=t.length?e:t:e:t}function ut(e){return[...new Set(e)]}import{readFileSync as ct,writeFileSync as lt}from"fs";import{create as te}from"@bufbuild/protobuf";import{deserializeSCIP as pt,DocumentSchema as gt,IndexSchema as dt,serializeSCIP as ft,SymbolRole as mt}from"@c4312/scip";function ne(e){let t;try{t=pt(ct(e))}catch{return{removedDefinitionOccurrences:0,touchedDocuments:0}}let n=ht(t);return n.removedDefinitionOccurrences>0&&lt(e,Buffer.from(ft(n.index))),{removedDefinitionOccurrences:n.removedDefinitionOccurrences,touchedDocuments:n.touchedDocuments}}function ht(e){let t=new Set;for(let a of e.documents)for(let s of a.symbols)s.symbol&&t.add(s.symbol);for(let a of e.externalSymbols)a.symbol&&t.add(a.symbol);let n=0,r=0,i=[];for(let a of e.documents){let s=a.occurrences.filter(o=>(o.symbolRoles&mt.Definition)===0||t.has(o.symbol)?!0:(n+=1,!1));if(s.length===a.occurrences.length){i.push(a);continue}r+=1,i.push(te(gt,{language:a.language,relativePath:a.relativePath,occurrences:s,symbols:a.symbols,text:a.text,positionEncoding:a.positionEncoding}))}return{index:n===0?e:te(dt,{metadata:e.metadata,documents:i,externalSymbols:e.externalSymbols}),removedDefinitionOccurrences:n,touchedDocuments:r}}import{existsSync as yt,readFileSync as xt,readdirSync as bt,statSync as Pt}from"fs";import p from"path";var St=new Set([".cache",".git",".next",".nuxt",".turbo",".nx","build","coverage","dist","node_modules","tmp","vendor"]);function re(e,t=[]){let n=p.resolve(e),r=vt(n),i=t.flatMap(c=>jt(n,c)),a=It([...r,...i]),s=kt(n,a)?[n,...a]:a,o=s.length>0?s:[n];return[...new Set(o.map(c=>wt(n,c)))].sort((c,u)=>c.localeCompare(u))}function vt(e){let t=[],n=[e];for(;n.length>0;){let r=n.pop(),i;try{i=bt(r,{withFileTypes:!0})}catch{continue}for(let a of i){let s=p.join(r,a.name);if(a.isDirectory()){!St.has(a.name)&&!a.name.startsWith(".")&&n.push(s);continue}a.isFile()&&Rt(s)&&t.push(p.dirname(s))}}return t}function jt(e,t){let n=t.trim();if(!n)return[];let r=p.resolve(e,n);if(!Mt(e,r))return[];try{let i=Pt(r);if(i.isDirectory())return[r];if(i.isFile()&&ie(p.basename(r)))return[p.dirname(r)]}catch{return[]}return[]}function Rt(e){if(!ie(p.basename(e)))return!1;let t=ae(e);return t?p.basename(e)==="tsconfig.json"||"include"in t||"files"in t||"references"in t:!1}function ie(e){return e.startsWith("tsconfig")&&e.endsWith(".json")}function It(e){let t=[...new Set(e.map(n=>p.resolve(n)))].sort((n,r)=>n.localeCompare(r));return t.length<=1?t:t.filter(n=>!t.some(r=>r!==n&&Lt(n,r)))}function kt(e,t){if(t.length===0||t.some(r=>p.resolve(r)===e))return!1;let n=p.join(e,"tsconfig.json");return yt(n)&&Ct(n)}function Ct(e){let n=ae(e)?.include;return Array.isArray(n)?n.some(r=>typeof r=="string"&&r.trim()!==""&&!r.startsWith("!")&&(r.includes("/")||r.includes("**")||!p.extname(r))):!1}function ae(e){try{let t=JSON.parse(xt(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}}function wt(e,t){let n=p.relative(e,t);return n?n.split(p.sep).join("/"):"."}function Lt(e,t){let n=p.relative(e,t);return!!n&&!n.startsWith("..")&&!p.isAbsolute(n)}function Mt(e,t){let n=p.relative(e,t);return!n.startsWith("..")&&!p.isAbsolute(n)}import{execFile as Dt}from"child_process";import{existsSync as P,renameSync as A,rmSync as N}from"fs";import{cpus as Ot}from"os";import{join as se}from"path";function Et(e,t,n){if(!e.defaultOutputPath)return;let r=se(t,e.defaultOutputPath);n!==r&&P(r)&&A(r,n)}function $t(e,t,n){if(!e.defaultOutputPath)return null;let r=se(t,e.defaultOutputPath);if(r===n)return null;let i=`${n}.default-output-backup`;return N(i,{force:!0}),P(r)?(A(r,i),{defaultOutputPath:r,backupPath:i}):{defaultOutputPath:r,backupPath:null}}function At(e){e&&(N(e.defaultOutputPath,{force:!0}),e.backupPath&&P(e.backupPath)&&A(e.backupPath,e.defaultOutputPath))}function Nt(e,t){if(e<=1)return 1;let n=Number(process.env.SCIP_QUERY_INDEXER_CONCURRENCY??0),r=Number.isFinite(t)&&t&&t>0?t:Number.isFinite(n)&&n>0?n:Math.min(8,Math.max(1,Ot().length));return Math.max(1,Math.min(e,Math.floor(r)))}async function oe(e,t,n,r){let i=e.filter(u=>u.config.defaultOutputPath),a=e.filter(u=>!u.config.defaultOutputPath),s=[],o=Nt(a.length,r),c=await Tt(a,o,u=>$(u,t,n));if(o>1){let u=new Map;for(let d of c.filter(l=>l.skipped)){let l=a.find(x=>x.id===d.id);l&&(n(`Retrying ${l.label} indexer serially after parallel failure...`),u.set(l.id,await $(l,t,n)))}s.push(...c.map(d=>u.get(d.id)??d))}else s.push(...c);for(let u of i)s.push(await $(u,t,n));return s.sort((u,d)=>e.findIndex(l=>l.id===u.id)-e.findIndex(l=>l.id===d.id))}async function $(e,t,n){n(`Indexing ${e.label} with ${e.resolvedBinary}...`),N(e.scipPath,{force:!0});let r=$t(e.config,t,e.scipPath);try{await Ft(e.binary,e.args,{cwd:t,env:e.env,maxBuffer:50*1024*1024}),Et(e.config,t,e.scipPath)}catch(i){let a=i instanceof Error?i.message:String(i),s=`${e.resolvedBinary} indexer failed: ${a.split(`
3
- `)[0]}`,o=e.label===e.language?s:`${e.label}: ${s}`;return n(`Skipping ${e.label}: ${s}`),{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,skipped:{language:e.language,reason:o}}}finally{At(r)}if(!P(e.scipPath)){let i=`${e.resolvedBinary} indexer completed but did not produce ${e.scipPath}`,a=e.label===e.language?i:`${e.label}: ${i}`;return n(`Skipping ${e.label}: ${i}`),{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,skipped:{language:e.language,reason:a}}}return{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath}}function Ft(e,t,n){return new Promise((r,i)=>{Dt(e,[...t],n,a=>{a?i(a):r()})})}async function Tt(e,t,n){if(e.length===0)return[];let r=new Array(e.length),i=0,a=Math.max(1,Math.min(e.length,t)),s=Array.from({length:a},async()=>{for(;i<e.length;){let o=i++;r[o]=await n(e[o])}});return await Promise.all(s),r}import{execFileSync as T}from"child_process";import{existsSync as F,readFileSync as Bt}from"fs";import{createRequire as _t}from"module";import{platform as Ut}from"os";import{dirname as ue,join as S}from"path";var Wt=_t(import.meta.url);function B(e){return[e.indexerBinary,...e.binaryAliases??[]]}function _(e){let t=B(e);return t.length===1?t[0]:t.join(" or ")}function v(e){for(let t of B(e))if(b(t))return t;return qt(e)}function ce(e){return v(e)!==null||Jt(e)}function Jt(e){return le(e)!==null}function qt(e){let t=le(e);if(!t)return null;let r=JSON.parse(Bt(t,"utf8")).bin;if(!r)return null;if(typeof r=="string")return S(ue(t),r);for(let i of B(e)){let a=r[i];if(a)return S(ue(t),a)}return null}function le(e){if(!e.bundledNpmPackage)return null;try{return Wt.resolve(`${e.bundledNpmPackage}/package.json`)}catch{return null}}function pe(e,t){for(let n of e.projectLocalBinaries??[]){let r=S(t,n);if(F(r))return r}return null}function ge(e,t=process.env,n=e.indexerBinary){if(e.indexerBinary!=="scip-dotnet"||fe(n,t))return t;let r=zt(n,t);return r?{...t,DOTNET_ROOT:r}:t}function de(e,t){let n=e.installMethods,r=_(e);if(!n?.length)return t(`No auto-install method available for ${r}.`),e.installUrl&&t(`Install manually from: ${e.installUrl}`),!1;for(let i of n)if(b(i.prerequisite)){t(`Installing ${r} via ${i.label}...`);try{T(i.binary,i.args,{stdio:"inherit",timeout:3e5,env:process.env});let a=v(e);if(a){let s=a===e.indexerBinary?"":` (using ${a})`;return t(`Successfully installed ${r} via ${i.label}${s}`),!0}t(`${i.label} command completed but ${r} was not found on PATH`)}catch(a){let s=a instanceof Error?a.message:String(a);t(`${i.label} install failed: ${s}`)}}return t(`Could not auto-install ${r}.`),e.installUrl&&t(`Install manually from: ${e.installUrl}`),!1}function zt(e,t){for(let n of Gt(t))if(fe(e,{...t,DOTNET_ROOT:n}))return n;return null}function Gt(e){let t=[],n=e.DOTNET_ROOT;if(n&&F(n)&&t.push(n),Ut()==="darwin"&&b("brew"))try{let r=T("brew",["--prefix","dotnet@9"],{stdio:"pipe",env:e}).toString().trim(),i=S(r,"libexec");F(i)&&!t.includes(i)&&t.push(i)}catch{}return t}function fe(e,t){try{return T(e,["--version"],{stdio:"pipe",env:t}),!0}catch{return!1}}async function xe(e){let{projectRoot:t,maxHeapMb:n=8192,onStatus:r=console.log,skipAutoInstall:i=!1}=e,a=Zt(e),s=Date.now();J(g(a.outputScip),{recursive:!0}),J(g(a.outputDb),{recursive:!0});let o=e.languages??Y(t);if(o.length===0)throw new Error("No supported languages detected in this project. Looked for: tsconfig.json, Cargo.toml, go.mod, pyproject.toml, etc.");r(`Detected languages: ${o.join(", ")}`);let c=jn(t,o,{pnpmWorkspaces:e.pnpmWorkspaces,typescriptProjectMode:e.typescriptProjectMode,typescriptProjects:e.typescriptProjects,clojureConfigPath:e.clojureConfigPath}),u=await mn(f(g(a.outputDb),"index.lock"),{projectRoot:t,trigger:e.trigger,onStatus:r}),d=null;try{let l=en({opts:e,paths:a,languages:o,fingerprint:c,start:s,onStatus:r});if(l)return l;un(i,r);let x=tn(a);return d=x.runDir,await nn({opts:e,languages:o,projectRoot:t,paths:a,tempPaths:x,fingerprint:c,start:s,maxHeapMb:n,skipAutoInstall:i,onStatus:r})}catch(l){throw Ce(a.metaPath,z({trigger:e.trigger,result:"failed",start:s,error:l instanceof Error?l.message:String(l)})),l}finally{d&&y(d,{recursive:!0,force:!0}),u()}}function Zt(e){let t=e.outputScip??f(e.projectRoot,"index.scip"),n=e.outputDb??f(e.projectRoot,"index.db");return{outputScip:t,outputDb:n,metaPath:f(g(n),"meta.json")}}function en(e){if(e.opts.skipIfUnchanged===!1||!R(e.paths.outputScip)||!R(e.paths.outputDb)||!Rn(e.paths.metaPath,e.fingerprint))return null;w(C(),{projectRoot:e.opts.projectRoot,dbPath:e.paths.outputDb,onStatus:e.onStatus});let t=Date.now()-e.start,n=z({trigger:e.opts.trigger,result:"reused",start:e.start,languages:e.languages,skipped:[]});return Ce(e.paths.metaPath,n),e.onStatus(`Index unchanged; reused existing SQLite index in ${(t/1e3).toFixed(1)}s`),{languages:e.languages,indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:t,reused:!0,skipped:[],lastRefresh:n}}function tn(e){let t=Qt(f(g(e.outputDb),"reindex-"));return{runDir:t,tempOutputScip:f(t,j(e.outputScip)),tempOutputDb:f(t,j(e.outputDb)),tempMetaPath:f(t,j(e.metaPath))}}async function nn(e){let t={...process.env,NODE_OPTIONS:`--max-old-space-size=${e.maxHeapMb}`},{indexedOutputs:n,skippedLanguages:r,reusedLanguages:i}=await rn(e,t);i.length>0&&e.onStatus(`Reused ${i.length} cached language shard(s): ${i.join(", ")}`);let a=an(e,t,n,r),s=a.durationMs;return e.onStatus(`Done in ${(s/1e3).toFixed(1)}s`),{languages:n.map(o=>o.language),indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:s,reused:!1,skipped:r,lastRefresh:a}}async function rn(e,t){let n=sn(e),r=new Set(n.map(u=>u.language));for(let u of r)e.onStatus(`Reusing cached ${u} SCIP shard (language inputs unchanged).`);let{preparedRuns:i,skippedLanguages:a}=cn({languages:e.languages.filter(u=>!r.has(u)),tempOutputScip:e.tempPaths.tempOutputScip,projectRoot:e.projectRoot,env:t,skipAutoInstall:e.skipAutoInstall,pnpmWorkspaces:e.opts.pnpmWorkspaces,typescriptProjectMode:e.opts.typescriptProjectMode,typescriptProjects:e.opts.typescriptProjects,clojureConfigPath:e.opts.clojureConfigPath,onStatus:e.onStatus}),s=await oe(i,e.projectRoot,e.onStatus,e.opts.indexerConcurrency),{indexedOutputs:o}=pn(s,a),c=[...n,...o];return gn(c,a,e.languages,e.opts.allowPartial,e.onStatus),{indexedOutputs:c,skippedLanguages:a,reusedLanguages:[...r]}}function an(e,t,n,r){on(e.paths.outputDb,n),dn(n,e.tempPaths.tempOutputScip,e.onStatus),fn(e.tempPaths.tempOutputScip,e.tempPaths.tempOutputDb,t,e.onStatus),w(C(),{projectRoot:e.projectRoot,dbPath:e.tempPaths.tempOutputDb,onStatus:e.onStatus});let i=z({trigger:e.opts.trigger,result:"rebuilt",start:e.start,languages:n.map(a=>a.language),skipped:[...r]});return ke(e.tempPaths.tempMetaPath,{version:3,status:r.length===0?"complete":"partial",updatedAt:new Date().toISOString(),fingerprint:e.fingerprint,languageFingerprints:Se(e.projectRoot,e.languages,{pnpmWorkspaces:e.opts.pnpmWorkspaces,typescriptProjectMode:e.opts.typescriptProjectMode,typescriptProjects:e.opts.typescriptProjects,clojureConfigPath:e.opts.clojureConfigPath}),requestedLanguages:e.languages,indexedLanguages:n.map(a=>a.language),skipped:[...r],lastRefresh:i}),vn({tempOutputScip:e.tempPaths.tempOutputScip,tempOutputDb:e.tempPaths.tempOutputDb,tempMetaPath:e.tempPaths.tempMetaPath,outputScip:e.paths.outputScip,outputDb:e.paths.outputDb,metaPath:e.paths.metaPath}),i}function sn(e){let t;try{t=JSON.parse(I(e.paths.metaPath,"utf-8"))}catch{return[]}if(t.version!==3||!t.languageFingerprints)return[];let n=[],r=Se(e.projectRoot,e.languages,{pnpmWorkspaces:e.opts.pnpmWorkspaces,typescriptProjectMode:e.opts.typescriptProjectMode,typescriptProjects:e.opts.typescriptProjects,clojureConfigPath:e.opts.clojureConfigPath});for(let i of e.languages){let a=Ie(e.paths.outputDb,i);R(a)&&m(t.languageFingerprints[i])===m(r[i])&&n.push({language:i,scipPath:a})}return n}function on(e,t){for(let n of t){let r=Ie(e,n.language);J(g(r),{recursive:!0}),n.scipPath!==r&&Kt(n.scipPath,r)}}function un(e,t){if(!k()){if(e)throw new Error(`The scip CLI is required but not found on PATH.
4
- Install from: https://github.com/sourcegraph/scip/releases`);if(t("scip CLI not found on PATH. Attempting auto-install..."),!G(t))throw new Error(`The scip CLI is required but could not be installed.
5
- Install manually from: https://github.com/sourcegraph/scip/releases`)}}function cn(e){let t=[],n=[],r=e.languages.map((i,a)=>({language:i,scipPath:e.languages.length>1?Pe(e.tempOutputScip,i,a):e.tempOutputScip}));for(let{language:i,scipPath:a}of r){let s=ln({...e,language:i,scipPath:a});for(let o of s)"skipped"in o?be(n,o.skipped):t.push(o.prepared)}return{preparedRuns:t,skippedLanguages:n}}function ln(e){if(e.language!=="typescript"||e.typescriptProjectMode!=="workspace")return[U({...e,id:e.language,label:e.language,outputScipPath:e.scipPath})];let t=re(e.projectRoot,e.typescriptProjects);return t.length===0?[U({...e,id:e.language,label:e.language,outputScipPath:e.scipPath})]:(e.onStatus(`Indexing TypeScript workspace as ${t.length} project shard(s).`),t.map((n,r)=>U({...e,id:`typescript:${n}`,label:`typescript (${n})`,scipPath:Pe(e.tempOutputScip,"typescript-project",r),outputScipPath:e.scipPath,pnpmWorkspaces:!1,projectPath:n})))}function U(e){let t=D(e.language),n=_(t),r=pe(t,e.projectRoot);if(!r&&!ce(t)){if(e.skipAutoInstall){let o=`${n} not found on PATH (auto-install disabled). ${t.installUrl??""}`.trim();return e.onStatus(`Skipping ${e.language}: ${o}`),{skipped:{language:e.language,reason:o}}}if(e.onStatus(`${n} not found. Attempting auto-install...`),!de(t,e.onStatus)){let o=`${n} could not be auto-installed. ${t.installUrl?`Install manually from ${t.installUrl}`:`Install ${n} and put it on PATH.`}`;return e.onStatus(`Skipping ${e.language}: ${o}`),{skipped:{language:e.language,reason:o}}}}let i=r??v(t);if(!i){let o=`${n} was not found after installation checks.`;return e.onStatus(`Skipping ${e.language}: ${o}`),{skipped:{language:e.language,reason:o}}}let{binary:a,args:s}=t.indexArgs({projectRoot:e.projectRoot,outputPath:e.scipPath,pnpmWorkspaces:e.pnpmWorkspaces,indexerBinary:i,projectPath:e.projectPath,configPath:e.language==="clojure"?e.clojureConfigPath:void 0});return{prepared:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,config:t,resolvedBinary:i,binary:a,args:s,env:ge(t,e.env,i)}}}function pn(e,t){let n=new Map;for(let i of e)if(i.skipped)be(t,i.skipped);else{let a=`${i.language}\0${i.outputScipPath}`,s=n.get(a)??{language:i.language,outputScipPath:i.outputScipPath,scipPaths:[]};s.scipPaths.push(i.scipPath),n.set(a,s)}let r=[];for(let i of n.values())if(i.scipPaths.length>1)E(i.scipPaths,i.outputScipPath),r.push({language:i.language,scipPath:i.outputScipPath});else{let a=i.scipPaths[0];a!==i.outputScipPath&&h(a,i.outputScipPath),r.push({language:i.language,scipPath:i.outputScipPath})}return{indexedOutputs:r}}function be(e,t){let n=e.find(r=>r.language===t.language);if(!n){e.push(t);return}n.reason.includes(t.reason)||(n.reason=`${n.reason}; ${t.reason}`)}function gn(e,t,n,r,i){if(e.length===0){let a=t.map(s=>` - ${s.language}: ${s.reason}`).join(`
1
+ import{a as w,b as C,c as L,d as M}from"./chunk-FERAXG6Y.js";import{a as b,b as k,c as Q}from"./chunk-TFWDJDGO.js";import{execFileSync as Vt}from"child_process";import{createHash as Zt}from"crypto";import{closeSync as en,copyFileSync as tn,existsSync as v,mkdirSync as J,mkdtempSync as nn,openSync as rn,readFileSync as I,renameSync as y,rmSync as x,statSync as an,writeFileSync as Re}from"fs";import{basename as j,dirname as d,extname as sn,join as f}from"path";import{platform as on}from"os";import{execFileSync as Fe}from"child_process";import{existsSync as Te,readdirSync as V}from"fs";import{extname as Z,join as ee}from"path";var Be=new Set([".git",".hg",".svn",".idea",".vscode","node_modules","vendor","dist","build","target","bin","obj",".dart_tool",".gradle",".next",".venv","venv","__pycache__"]),_e=[{language:"typescript",files:["tsconfig.json","tsconfig.base.json"],extensions:[".ts",".tsx",".mts",".cts"]},{language:"rust",files:["Cargo.toml"],extensions:[".rs"]},{language:"go",files:["go.mod"],extensions:[".go"]},{language:"java",files:["pom.xml","build.gradle","build.gradle.kts"],extensions:[".java"]},{language:"kotlin",files:["build.gradle.kts"],extensions:[".kt",".kts"]},{language:"scala",files:["build.sbt"],extensions:[".scala"]},{language:"clojure",files:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"],extensions:[".clj",".cljs",".cljc"]},{language:"python",files:["pyproject.toml","setup.py","setup.cfg","Pipfile"],extensions:[".py",".pyi"]},{language:"ruby",files:["Gemfile"],extensions:[".rb"]},{language:"cpp",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"]},{language:"c",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".c",".h"]},{language:"csharp",globs:["*.csproj","*.sln"],extensions:[".cs"]},{language:"vb",globs:["*.vbproj"],extensions:[".vb"]},{language:"dart",files:["pubspec.yaml"],extensions:[".dart"]},{language:"php",files:["composer.json"],extensions:[".php"]},{language:"javascript",files:["package.json"],extensions:[".js",".jsx",".mjs",".cjs"]}];function te(e){let t=[],n=We(e),r=ze(e);for(let i of _e){if(Ue(e,i.files)){t.push(i.language);continue}if(qe(n,i.globs)){t.push(i.language);continue}Xe(r,i.extensions)&&t.push(i.language)}return t.includes("typescript")&&Y(t,"javascript"),t.includes("cpp")&&!r.has(".c")&&Y(t,"c"),t}function We(e){try{return V(e)}catch{return[]}}function Ue(e,t){return t?.length?t.some(n=>Te(ee(e,n))):!1}function qe(e,t){return t?.length?e.some(n=>t.some(r=>Je(n,r))):!1}function Je(e,t){if(t==="*")return!0;if(!t.includes("*"))return e===t;let[n,r]=t.split("*");return e.startsWith(n??"")&&e.endsWith(r??"")}function ze(e){let t=Ge(e);if(t)return t;let n=new Set,r=[e];for(;r.length>0;){let i=r.pop();if(!i)continue;let a;try{a=V(i,{withFileTypes:!0})}catch{continue}for(let s of a){if(s.name.startsWith(".")&&!s.name.endsWith("proj")&&!s.name.endsWith("sln")&&s.isDirectory())continue;let o=ee(i,s.name);if(s.isDirectory()){Be.has(s.name)||r.push(o);continue}let c=Z(s.name).toLowerCase();c&&n.add(c)}}return n}function Ge(e){try{let t=Fe("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"]}),n=new Set;for(let r of t.split(`
2
+ `)){if(!r)continue;let i=Z(r).toLowerCase();i&&n.add(i)}return n}catch{return null}}function Xe(e,t){return t?.length?t.some(n=>e.has(n)):!1}function Y(e,t){let n=e.indexOf(t);n!==-1&&e.splice(n,1)}import{existsSync as ne,readdirSync as He}from"fs";import{isAbsolute as Ke,join as D,resolve as Qe}from"path";var Ye={typescript:{language:"typescript",indexerBinary:"scip-typescript",checkCommand:"npx scip-typescript --version",indexArgs:({outputPath:e,pnpmWorkspaces:t,indexerBinary:n,projectPath:r})=>{let i=r?["index","--output",e,"--no-progress-bar",r]:["index","--infer-tsconfig","--output",e,"--no-progress-bar"];return t&&!r&&i.splice(1,0,"--pnpm-workspaces"),{binary:n,args:i}},markerFiles:["tsconfig.json"],installMethods:[{label:"npm",prerequisite:"npm",binary:"npm",args:["install","-g","@sourcegraph/scip-typescript"]}],installUrl:"https://github.com/sourcegraph/scip-typescript",bundledNpmPackage:"@sourcegraph/scip-typescript"},javascript:{language:"javascript",indexerBinary:"scip-typescript",checkCommand:"npx scip-typescript --version",indexArgs:({outputPath:e,indexerBinary:t})=>({binary:t,args:["index","--infer-tsconfig","--output",e,"--no-progress-bar"]}),markerFiles:["package.json"],installMethods:[{label:"npm",prerequisite:"npm",binary:"npm",args:["install","-g","@sourcegraph/scip-typescript"]}],installUrl:"https://github.com/sourcegraph/scip-typescript",bundledNpmPackage:"@sourcegraph/scip-typescript"},java:{language:"java",indexerBinary:"scip-java",checkCommand:"scip-java --version",indexArgs:({outputPath:e})=>({binary:"scip-java",args:["index","--output",e]}),markerFiles:["pom.xml","build.gradle"],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},scala:{language:"scala",indexerBinary:"scip-java",checkCommand:"scip-java --version",indexArgs:({outputPath:e})=>({binary:"scip-java",args:["index","--output",e]}),markerFiles:["build.sbt"],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},kotlin:{language:"kotlin",indexerBinary:"scip-java",checkCommand:"scip-java --version",indexArgs:({outputPath:e})=>({binary:"scip-java",args:["index","--output",e]}),markerFiles:["build.gradle.kts"],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},rust:{language:"rust",indexerBinary:"rust-analyzer",checkCommand:"rust-analyzer --version",indexArgs:({outputPath:e})=>({binary:"rust-analyzer",args:["scip",".","--output",e]}),markerFiles:["Cargo.toml"],installMethods:[{label:"rustup",prerequisite:"rustup",binary:"rustup",args:["component","add","rust-analyzer"]}],installUrl:"https://github.com/rust-lang/rust-analyzer"},python:{language:"python",indexerBinary:"scip-python-plus",binaryAliases:["scip-python"],checkCommand:"scip-python-plus --version",indexArgs:({outputPath:e,indexerBinary:t})=>({binary:t,args:["index","--output",e,"--project-name","project"]}),markerFiles:["pyproject.toml","setup.py"],installMethods:[{label:"npm",prerequisite:"npm",binary:"npm",args:["install","-g","scip-python-plus"]}],installUrl:"https://github.com/PlunderStruck/scip-python",bundledNpmPackage:"scip-python-plus"},clojure:{language:"clojure",indexerBinary:"scip-clojure",projectLocalBinaries:["node_modules/.bin/scip-clojure"],checkCommand:"scip-clojure -h",indexArgs:({projectRoot:e,outputPath:t,indexerBinary:n,configPath:r})=>{let i=["-root",e,"-output",t];return r&&i.push("-config",Ke(r)?r:Qe(e,r)),{binary:n,args:i}},markerFiles:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"],installMethods:[],installUrl:"https://github.com/PlunderStruck/scip-clojure"},ruby:{language:"ruby",indexerBinary:"scip-ruby",checkCommand:"scip-ruby --version",indexArgs:({indexerBinary:e})=>({binary:e,args:["--dir","."]}),defaultOutputPath:"index.scip",markerFiles:["Gemfile"],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-ruby/releases"},go:{language:"go",indexerBinary:"scip-go",checkCommand:"scip-go --version",indexArgs:({outputPath:e})=>({binary:"scip-go",args:["--output",e]}),markerFiles:["go.mod"],installMethods:[{label:"go install",prerequisite:"go",binary:"go",args:["install","github.com/sourcegraph/scip-go@latest"]}],installUrl:"https://github.com/sourcegraph/scip-go"},cpp:{language:"cpp",indexerBinary:"scip-clang",checkCommand:"scip-clang --version",indexArgs:({outputPath:e})=>({binary:"scip-clang",args:["--compdb-path","compile_commands.json","--index-output-path",e]}),markerFiles:["CMakeLists.txt","Makefile"],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-clang/releases"},c:{language:"c",indexerBinary:"scip-clang",checkCommand:"scip-clang --version",indexArgs:({outputPath:e})=>({binary:"scip-clang",args:["--compdb-path","compile_commands.json","--index-output-path",e]}),markerFiles:["CMakeLists.txt","Makefile"],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-clang/releases"},csharp:{language:"csharp",indexerBinary:"scip-dotnet",checkCommand:"scip-dotnet --version",indexArgs:({projectRoot:e,outputPath:t})=>({binary:"scip-dotnet",args:["index",re(e,[".sln",".csproj"])??e,"--output",t,"--working-directory",e]}),markerFiles:["*.csproj","*.sln"],installMethods:[{label:"dotnet",prerequisite:"dotnet",binary:"dotnet",args:["tool","install","--global","scip-dotnet"]}],installUrl:"https://github.com/sourcegraph/scip-dotnet/releases"},vb:{language:"vb",indexerBinary:"scip-dotnet",checkCommand:"scip-dotnet --version",indexArgs:({projectRoot:e,outputPath:t})=>({binary:"scip-dotnet",args:["index",re(e,[".sln",".vbproj"])??e,"--output",t,"--working-directory",e]}),markerFiles:["*.vbproj","*.sln"],installMethods:[{label:"dotnet",prerequisite:"dotnet",binary:"dotnet",args:["tool","install","--global","scip-dotnet"]}],installUrl:"https://github.com/sourcegraph/scip-dotnet/releases"},dart:{language:"dart",indexerBinary:"scip-dart",checkCommand:"scip-dart --version",indexArgs:({indexerBinary:e,outputPath:t})=>({binary:e,args:["--output",t]}),markerFiles:["pubspec.yaml"],installMethods:[{label:"dart pub",prerequisite:"dart",binary:"dart",args:["pub","global","activate","scip_dart"]}],installUrl:"https://github.com/Workiva/scip-dart/releases"},php:{language:"php",indexerBinary:"scip-php",projectLocalBinaries:["vendor/davidrjenni/scip-php/bin/scip-php","vendor/bin/scip-php"],checkCommand:"scip-php --version",indexArgs:({projectRoot:e,indexerBinary:t})=>{let n=D(e,"vendor","bin","scip-php"),r=D(e,"vendor","davidrjenni","scip-php","bin","scip-php");return{binary:"php",args:["-d","error_reporting=E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED",ne(r)?r:ne(n)?n:t]}},defaultOutputPath:"index.scip",markerFiles:["composer.json"],installMethods:[],installUrl:"https://github.com/davidrjenni/scip-php/releases"}};function O(e){return Ye[e]}function re(e,t){let n;try{n=He(e)}catch{return null}for(let r of t)for(let i of n)if(i.endsWith(r))return D(e,i);return null}import{readFileSync as Ve,writeFileSync as Ze}from"fs";import{create as E}from"@bufbuild/protobuf";import{deserializeSCIP as et,serializeSCIP as tt,DocumentSchema as nt,IndexSchema as rt,SymbolInformationSchema as it}from"@c4312/scip";function at(e){if(e.length===0)throw new Error("Cannot merge zero SCIP indexes");if(e.length===1)return e[0];let t=st(e),n=ot(e.flatMap(i=>i.documents??[])),r=ie(e.flatMap(i=>i.externalSymbols??[]));return E(rt,{metadata:t,documents:n,externalSymbols:r})}function $(e,t){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let n=e.map(i=>et(Ve(i))),r=at(n);return Ze(t,Buffer.from(tt(r))),{documentCount:r.documents.length,externalSymbolCount:r.externalSymbols.length,inputCount:e.length}}function st(e){let t=e[0]?.metadata;if(!t)return;let n=t.projectRoot;for(let r of e.slice(1)){let i=r.metadata?.projectRoot;if(n&&i&&i!==n)throw new Error(`Cannot merge SCIP indexes with different project roots: ${n} vs ${i}`)}return t}function ot(e){let t=new Map;for(let n of e){let r=t.get(n.relativePath);if(!r){t.set(n.relativePath,n);continue}t.set(n.relativePath,E(nt,{language:r.language||n.language,relativePath:r.relativePath||n.relativePath,occurrences:ut([...r.occurrences,...n.occurrences]),symbols:ie([...r.symbols,...n.symbols]),text:lt(r.text,n.text),positionEncoding:r.positionEncoding||n.positionEncoding}))}return[...t.values()]}function ut(e){let t=new Set,n=[];for(let r of e){let i=JSON.stringify(r);t.has(i)||(t.add(i),n.push(r))}return n}function ie(e){let t=new Map;for(let n of e){let r=t.get(n.symbol);if(!r){t.set(n.symbol,n);continue}t.set(n.symbol,E(it,{symbol:r.symbol,documentation:pt([...r.documentation,...n.documentation]),relationships:ct([...r.relationships,...n.relationships]),kind:r.kind||n.kind,displayName:r.displayName||n.displayName,enclosingSymbol:r.enclosingSymbol||n.enclosingSymbol,signatureDocumentation:r.signatureDocumentation??n.signatureDocumentation}))}return[...t.values()]}function ct(e){let t=new Set,n=[];for(let r of e){let i=[r.symbol,r.isReference?"1":"0",r.isImplementation?"1":"0",r.isTypeDefinition?"1":"0",r.isDefinition?"1":"0"].join("|");t.has(i)||(t.add(i),n.push(r))}return n}function lt(e,t){return e?t?e.length>=t.length?e:t:e:t}function pt(e){return[...new Set(e)]}import{readFileSync as gt,writeFileSync as dt}from"fs";import{create as ae}from"@bufbuild/protobuf";import{deserializeSCIP as ft,DocumentSchema as mt,IndexSchema as ht,serializeSCIP as yt,SymbolRole as xt}from"@c4312/scip";function se(e){let t;try{t=ft(gt(e))}catch{return{removedDefinitionOccurrences:0,touchedDocuments:0}}let n=bt(t);return n.removedDefinitionOccurrences>0&&dt(e,Buffer.from(yt(n.index))),{removedDefinitionOccurrences:n.removedDefinitionOccurrences,touchedDocuments:n.touchedDocuments}}function bt(e){let t=new Set;for(let a of e.documents)for(let s of a.symbols)s.symbol&&t.add(s.symbol);for(let a of e.externalSymbols)a.symbol&&t.add(a.symbol);let n=0,r=0,i=[];for(let a of e.documents){let s=a.occurrences.filter(o=>(o.symbolRoles&xt.Definition)===0||t.has(o.symbol)?!0:(n+=1,!1));if(s.length===a.occurrences.length){i.push(a);continue}r+=1,i.push(ae(mt,{language:a.language,relativePath:a.relativePath,occurrences:s,symbols:a.symbols,text:a.text,positionEncoding:a.positionEncoding}))}return{index:n===0?e:ae(ht,{metadata:e.metadata,documents:i,externalSymbols:e.externalSymbols}),removedDefinitionOccurrences:n,touchedDocuments:r}}import{existsSync as Rt,readFileSync as jt,readdirSync as vt,statSync as It}from"fs";import p from"path";import{isAbsolute as Pt,relative as St}from"path";function oe(e,t){let n=St(e,t);return n===""||!n.startsWith("..")&&!Pt(n)}var kt=new Set([".cache",".git",".next",".nuxt",".turbo",".nx","build","coverage","dist","node_modules","tmp","vendor"]);function ue(e,t=[]){let n=p.resolve(e),r=wt(n),i=t.flatMap(c=>Ct(n,c)),a=Mt([...r,...i]),s=Dt(n,a)?[n,...a]:a,o=s.length>0?s:[n];return[...new Set(o.map(c=>Et(n,c)))].sort((c,l)=>c.localeCompare(l))}function wt(e){let t=[],n=[e];for(;n.length>0;){let r=n.pop(),i;try{i=vt(r,{withFileTypes:!0})}catch{continue}for(let a of i){let s=p.join(r,a.name);if(a.isDirectory()){!kt.has(a.name)&&!a.name.startsWith(".")&&n.push(s);continue}a.isFile()&&Lt(s)&&t.push(p.dirname(s))}}return t}function Ct(e,t){let n=t.trim();if(!n)return[];let r=p.resolve(e,n);if(!oe(e,r))return[];try{let i=It(r);if(i.isDirectory())return[r];if(i.isFile()&&ce(p.basename(r)))return[p.dirname(r)]}catch{return[]}return[]}function Lt(e){if(!ce(p.basename(e)))return!1;let t=le(e);return t?p.basename(e)==="tsconfig.json"||"include"in t||"files"in t||"references"in t:!1}function ce(e){return e.startsWith("tsconfig")&&e.endsWith(".json")}function Mt(e){let t=[...new Set(e.map(n=>p.resolve(n)))].sort((n,r)=>n.localeCompare(r));return t.length<=1?t:t.filter(n=>!t.some(r=>r!==n&&$t(n,r)))}function Dt(e,t){if(t.length===0||t.some(r=>p.resolve(r)===e))return!1;let n=p.join(e,"tsconfig.json");return Rt(n)&&Ot(n)}function Ot(e){let n=le(e)?.include;return Array.isArray(n)?n.some(r=>typeof r=="string"&&r.trim()!==""&&!r.startsWith("!")&&(r.includes("/")||r.includes("**")||!p.extname(r))):!1}function le(e){try{let t=JSON.parse(jt(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}}function Et(e,t){let n=p.relative(e,t);return n?n.split(p.sep).join("/"):"."}function $t(e,t){let n=p.relative(e,t);return!!n&&!n.startsWith("..")&&!p.isAbsolute(n)}import{execFile as Nt}from"child_process";import{existsSync as P,renameSync as A,rmSync as F,statSync as At}from"fs";import{cpus as Ft}from"os";import{join as pe}from"path";function Tt(e,t,n){if(!e.defaultOutputPath)return;let r=pe(t,e.defaultOutputPath);n!==r&&P(r)&&A(r,n)}function Bt(e,t,n){if(!e.defaultOutputPath)return null;let r=pe(t,e.defaultOutputPath);if(r===n)return null;let i=`${n}.default-output-backup`;return F(i,{force:!0}),P(r)?(A(r,i),{defaultOutputPath:r,backupPath:i}):{defaultOutputPath:r,backupPath:null}}function _t(e){e&&(F(e.defaultOutputPath,{force:!0}),e.backupPath&&P(e.backupPath)&&A(e.backupPath,e.defaultOutputPath))}function Wt(e,t){if(e<=1)return 1;let n=Number(process.env.SCIP_QUERY_INDEXER_CONCURRENCY??0),r=Number.isFinite(t)&&t&&t>0?t:Number.isFinite(n)&&n>0?n:Math.min(8,Math.max(1,Ft().length));return Math.max(1,Math.min(e,Math.floor(r)))}async function ge(e,t,n,r){let i=e.filter(l=>l.config.defaultOutputPath),a=e.filter(l=>!l.config.defaultOutputPath),s=[],o=Wt(a.length,r),c=await qt(a,o,l=>N(l,t,n));if(o>1){let l=new Map;for(let g of c.filter(u=>u.skipped)){let u=a.find(m=>m.id===g.id);u&&(n(`Retrying ${u.label} indexer serially after parallel failure...`),l.set(u.id,await N(u,t,n)))}s.push(...c.map(g=>l.get(g.id)??g))}else s.push(...c);for(let l of i)s.push(await N(l,t,n));return s.sort((l,g)=>e.findIndex(u=>u.id===l.id)-e.findIndex(u=>u.id===g.id))}async function N(e,t,n){n(`Indexing ${e.label} with ${e.resolvedBinary}...`),F(e.scipPath,{force:!0});let r=Bt(e.config,t,e.scipPath),i=[e.binary,...e.args].join(" "),a=Date.now();try{await Ut(e.binary,e.args,{cwd:t,env:e.env,maxBuffer:50*1024*1024}),Tt(e.config,t,e.scipPath)}catch(o){let c=o instanceof Error?o.message:String(o),l=`${e.resolvedBinary} indexer failed: ${c.split(`
3
+ `)[0]}`,g=e.label===e.language?l:`${e.label}: ${l}`;return n(`Skipping ${e.label}: ${l}`),{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,durationMs:Date.now()-a,command:i,skipped:{language:e.language,reason:g}}}finally{_t(r)}if(!P(e.scipPath)){let o=`${e.resolvedBinary} indexer completed but did not produce ${e.scipPath}`,c=e.label===e.language?o:`${e.label}: ${o}`;return n(`Skipping ${e.label}: ${o}`),{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,durationMs:Date.now()-a,command:i,skipped:{language:e.language,reason:c}}}let s;try{s=At(e.scipPath).size}catch{s=void 0}return{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,durationMs:Date.now()-a,command:i,outputBytes:s}}function Ut(e,t,n){return new Promise((r,i)=>{Nt(e,[...t],n,a=>{a?i(a):r()})})}async function qt(e,t,n){if(e.length===0)return[];let r=new Array(e.length),i=0,a=Math.max(1,Math.min(e.length,t)),s=Array.from({length:a},async()=>{for(;i<e.length;){let o=i++;r[o]=await n(e[o])}});return await Promise.all(s),r}import{execFileSync as B}from"child_process";import{existsSync as T,readFileSync as Jt}from"fs";import{createRequire as zt}from"module";import{platform as Gt}from"os";import{dirname as de,join as S}from"path";var Xt=zt(import.meta.url);function _(e){return[e.indexerBinary,...e.binaryAliases??[]]}function W(e){let t=_(e);return t.length===1?t[0]:t.join(" or ")}function R(e){for(let t of _(e))if(b(t))return t;return Kt(e)}function fe(e){return R(e)!==null||Ht(e)}function Ht(e){return me(e)!==null}function Kt(e){let t=me(e);if(!t)return null;let r=JSON.parse(Jt(t,"utf8")).bin;if(!r)return null;if(typeof r=="string")return S(de(t),r);for(let i of _(e)){let a=r[i];if(a)return S(de(t),a)}return null}function me(e){if(!e.bundledNpmPackage)return null;try{return Xt.resolve(`${e.bundledNpmPackage}/package.json`)}catch{return null}}function he(e,t){for(let n of e.projectLocalBinaries??[]){let r=S(t,n);if(T(r))return r}return null}function ye(e,t=process.env,n=e.indexerBinary){if(e.indexerBinary!=="scip-dotnet"||be(n,t))return t;let r=Qt(n,t);return r?{...t,DOTNET_ROOT:r}:t}function xe(e,t){let n=e.installMethods,r=W(e);if(!n?.length)return t(`No auto-install method available for ${r}.`),e.installUrl&&t(`Install manually from: ${e.installUrl}`),!1;for(let i of n)if(b(i.prerequisite)){t(`Installing ${r} via ${i.label}...`);try{B(i.binary,i.args,{stdio:"inherit",timeout:3e5,env:process.env});let a=R(e);if(a){let s=a===e.indexerBinary?"":` (using ${a})`;return t(`Successfully installed ${r} via ${i.label}${s}`),!0}t(`${i.label} command completed but ${r} was not found on PATH`)}catch(a){let s=a instanceof Error?a.message:String(a);t(`${i.label} install failed: ${s}`)}}return t(`Could not auto-install ${r}.`),e.installUrl&&t(`Install manually from: ${e.installUrl}`),!1}function Qt(e,t){for(let n of Yt(t))if(be(e,{...t,DOTNET_ROOT:n}))return n;return null}function Yt(e){let t=[],n=e.DOTNET_ROOT;if(n&&T(n)&&t.push(n),Gt()==="darwin"&&b("brew"))try{let r=B("brew",["--prefix","dotnet@9"],{stdio:"pipe",env:e}).toString().trim(),i=S(r,"libexec");T(i)&&!t.includes(i)&&t.push(i)}catch{}return t}function be(e,t){try{return B(e,["--version"],{stdio:"pipe",env:t}),!0}catch{return!1}}async function je(e){let{projectRoot:t,maxHeapMb:n=8192,onStatus:r=console.log,skipAutoInstall:i=!1}=e,a=un(e),s=Date.now();J(d(a.outputScip),{recursive:!0}),J(d(a.outputDb),{recursive:!0});let o=e.languages??te(t);if(o.length===0)throw new Error("No supported languages detected in this project. Looked for: tsconfig.json, Cargo.toml, go.mod, pyproject.toml, etc.");r(`Detected languages: ${o.join(", ")}`);let c=En(t,o,{pnpmWorkspaces:e.pnpmWorkspaces,typescriptProjectMode:e.typescriptProjectMode,typescriptProjects:e.typescriptProjects,clojureConfigPath:e.clojureConfigPath}),l=await In(f(d(a.outputDb),"index.lock"),{projectRoot:t,trigger:e.trigger,onStatus:r}),g=null;try{let u=cn({opts:e,paths:a,languages:o,fingerprint:c,start:s,onStatus:r});if(u)return u;await xn(i,r);let m=pn(a);return g=m.runDir,await gn({opts:e,languages:o,projectRoot:t,paths:a,tempPaths:m,fingerprint:c,start:s,maxHeapMb:n,skipAutoInstall:i,onStatus:r})}catch(u){throw Me(a.metaPath,K({trigger:e.trigger,result:"failed",start:s,error:u instanceof Error?u.message:String(u)})),u}finally{g&&x(g,{recursive:!0,force:!0}),l()}}function un(e){let t=e.outputScip??f(e.projectRoot,"index.scip"),n=e.outputDb??f(e.projectRoot,"index.db");return{outputScip:t,outputDb:n,metaPath:f(d(n),"meta.json")}}function cn(e){if(e.opts.skipIfUnchanged===!1||!v(e.paths.outputScip)||!v(e.paths.outputDb)||!$n(e.paths.metaPath,e.fingerprint))return null;C(w(),{projectRoot:e.opts.projectRoot,dbPath:e.paths.outputDb,onStatus:e.onStatus});let t=Date.now()-e.start,n=K({trigger:e.opts.trigger,result:"reused",start:e.start,languages:e.languages,skipped:[]});return Me(e.paths.metaPath,n),e.onStatus(`Index unchanged; reused existing SQLite index in ${(t/1e3).toFixed(1)}s`),{languages:e.languages,indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:t,reused:!0,skipped:[],lastRefresh:n,shards:ln(e.paths,e.opts.projectRoot,e.languages,e.opts)}}function ln(e,t,n,r){let i=X(t,n,r);return n.map(a=>({id:a,language:a,reused:!0,fingerprint:z(i[a]),outputBytes:ve(H(e.outputDb,a)),durationMs:0}))}function pn(e){let t=nn(f(d(e.outputDb),"reindex-"));return{runDir:t,tempOutputScip:f(t,j(e.outputScip)),tempOutputDb:f(t,j(e.outputDb)),tempMetaPath:f(t,j(e.metaPath))}}async function gn(e){let t={...process.env,NODE_OPTIONS:`--max-old-space-size=${e.maxHeapMb}`},{indexedOutputs:n,skippedLanguages:r,reusedLanguages:i,shards:a}=await dn(e,t);i.length>0&&e.onStatus(`Reused ${i.length} cached language shard(s): ${i.join(", ")}`);let s=hn(e,t,n,r),o=s.durationMs;return e.onStatus(`Done in ${(o/1e3).toFixed(1)}s`),{languages:n.map(c=>c.language),indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:o,reused:!1,skipped:r,lastRefresh:s,shards:a}}async function dn(e,t){let n=fn({paths:e.paths,projectRoot:e.projectRoot,languages:e.languages,pnpmWorkspaces:e.opts.pnpmWorkspaces,typescriptProjectMode:e.opts.typescriptProjectMode,typescriptProjects:e.opts.typescriptProjects,clojureConfigPath:e.opts.clojureConfigPath}),r=[],i=new Set;for(let[u,m]of n)m.reused&&(r.push({language:u,scipPath:m.scipPath}),i.add(u));for(let u of i)e.onStatus(`Reusing cached ${u} SCIP shard (language inputs unchanged).`);let{preparedRuns:a,skippedLanguages:s}=bn({languages:e.languages.filter(u=>!i.has(u)),tempOutputScip:e.tempPaths.tempOutputScip,projectRoot:e.projectRoot,env:t,skipAutoInstall:e.skipAutoInstall,pnpmWorkspaces:e.opts.pnpmWorkspaces,typescriptProjectMode:e.opts.typescriptProjectMode,typescriptProjects:e.opts.typescriptProjects,clojureConfigPath:e.opts.clojureConfigPath,onStatus:e.onStatus}),o=await ge(a,e.projectRoot,e.onStatus,e.opts.indexerConcurrency),{indexedOutputs:c}=Sn(o,s),l=[...r,...c];Rn(l,s,e.languages,e.opts.allowPartial,e.onStatus);let g=mn(n,o);return{indexedOutputs:l,skippedLanguages:s,reusedLanguages:[...i],shards:g}}function fn(e){let t;try{t=JSON.parse(I(e.paths.metaPath,"utf-8"))}catch{t=null}let n=X(e.projectRoot,e.languages,e),r=new Map;for(let i of e.languages){let a=H(e.paths.outputDb,i),s=n[i];if(!t){r.set(i,{reused:!1,reason:"no reindex metadata found",fingerprint:s,scipPath:a});continue}if(t.version!==3){r.set(i,{reused:!1,reason:`metadata version ${String(t.version??"unknown")} predates per-language shard caching`,fingerprint:s,scipPath:a});continue}if(!t.languageFingerprints){r.set(i,{reused:!1,reason:"no per-language fingerprints recorded in metadata",fingerprint:s,scipPath:a});continue}let o=t.languageFingerprints[i];if(!o){r.set(i,{reused:!1,reason:"no cached fingerprint for this language",fingerprint:s,scipPath:a});continue}if(!v(a)){r.set(i,{reused:!1,reason:"cached shard file missing on disk",fingerprint:s,scipPath:a});continue}if(h(o)!==h(s)){r.set(i,{reused:!1,reason:"language inputs changed since last index",fingerprint:s,scipPath:a});continue}r.set(i,{reused:!0,fingerprint:s,scipPath:a})}return r}function mn(e,t){let n=[];for(let[r,i]of e)i.reused&&n.push({id:r,language:r,reused:!0,fingerprint:z(i.fingerprint),outputBytes:ve(i.scipPath),durationMs:0});for(let r of t){let i=e.get(r.language);n.push({id:r.id,language:r.language,reused:!1,missReason:i?.reason??r.skipped?.reason,fingerprint:i?z(i.fingerprint):"unknown",outputBytes:r.outputBytes??null,durationMs:r.durationMs,command:r.command})}return n}function z(e){return Zt("sha256").update(h(e)).digest("hex").slice(0,16)}function ve(e){try{return an(e).size}catch{return null}}function hn(e,t,n,r){yn(e.paths.outputDb,n),jn(n,e.tempPaths.tempOutputScip,e.onStatus),vn(e.tempPaths.tempOutputScip,e.tempPaths.tempOutputDb,t,e.onStatus),C(w(),{projectRoot:e.projectRoot,dbPath:e.tempPaths.tempOutputDb,onStatus:e.onStatus});let i=K({trigger:e.opts.trigger,result:"rebuilt",start:e.start,languages:n.map(a=>a.language),skipped:[...r]});return Le(e.tempPaths.tempMetaPath,{version:3,status:r.length===0?"complete":"partial",updatedAt:new Date().toISOString(),fingerprint:e.fingerprint,languageFingerprints:X(e.projectRoot,e.languages,{pnpmWorkspaces:e.opts.pnpmWorkspaces,typescriptProjectMode:e.opts.typescriptProjectMode,typescriptProjects:e.opts.typescriptProjects,clojureConfigPath:e.opts.clojureConfigPath}),requestedLanguages:e.languages,indexedLanguages:n.map(a=>a.language),skipped:[...r],lastRefresh:i}),On({tempOutputScip:e.tempPaths.tempOutputScip,tempOutputDb:e.tempPaths.tempOutputDb,tempMetaPath:e.tempPaths.tempMetaPath,outputScip:e.paths.outputScip,outputDb:e.paths.outputDb,metaPath:e.paths.metaPath}),i}function yn(e,t){for(let n of t){let r=H(e,n.language);J(d(r),{recursive:!0}),n.scipPath!==r&&tn(n.scipPath,r)}}async function xn(e,t){if(!k()){if(e)throw new Error(`The scip CLI is required but not found on PATH.
4
+ Install from: https://github.com/sourcegraph/scip/releases`);if(on()==="win32")throw new Error("The scip CLI was not found. On Windows it ships via the npm sidecar package scip-query-scip-windows (installed automatically with scip-query). Reinstall with optional dependencies enabled, run 'npm install -g scip-query-scip-windows', or set SCIP_QUERY_SCIP_BIN to a local scip.exe path.");if(t("scip CLI not found on PATH. Attempting auto-install..."),!Q(t))throw new Error(`The scip CLI is required but could not be installed.
5
+ Install manually from: https://github.com/sourcegraph/scip/releases`)}}function bn(e){let t=[],n=[],r=e.languages.map((i,a)=>({language:i,scipPath:e.languages.length>1?ke(e.tempOutputScip,i,a):e.tempOutputScip}));for(let{language:i,scipPath:a}of r){let s=Pn({...e,language:i,scipPath:a});for(let o of s)"skipped"in o?Ie(n,o.skipped):t.push(o.prepared)}return{preparedRuns:t,skippedLanguages:n}}function Pn(e){if(e.language!=="typescript"||e.typescriptProjectMode!=="workspace")return[U({...e,id:e.language,label:e.language,outputScipPath:e.scipPath})];let t=ue(e.projectRoot,e.typescriptProjects);return t.length===0?[U({...e,id:e.language,label:e.language,outputScipPath:e.scipPath})]:(e.onStatus(`Indexing TypeScript workspace as ${t.length} project shard(s).`),t.map((n,r)=>U({...e,id:`typescript:${n}`,label:`typescript (${n})`,scipPath:ke(e.tempOutputScip,"typescript-project",r),outputScipPath:e.scipPath,pnpmWorkspaces:!1,projectPath:n})))}function U(e){let t=O(e.language),n=W(t),r=he(t,e.projectRoot);if(!r&&!fe(t)){if(e.skipAutoInstall){let o=`${n} not found on PATH (auto-install disabled). ${t.installUrl??""}`.trim();return e.onStatus(`Skipping ${e.language}: ${o}`),{skipped:{language:e.language,reason:o}}}if(e.onStatus(`${n} not found. Attempting auto-install...`),!xe(t,e.onStatus)){let o=`${n} could not be auto-installed. ${t.installUrl?`Install manually from ${t.installUrl}`:`Install ${n} and put it on PATH.`}`;return e.onStatus(`Skipping ${e.language}: ${o}`),{skipped:{language:e.language,reason:o}}}}let i=r??R(t);if(!i){let o=`${n} was not found after installation checks.`;return e.onStatus(`Skipping ${e.language}: ${o}`),{skipped:{language:e.language,reason:o}}}let{binary:a,args:s}=t.indexArgs({projectRoot:e.projectRoot,outputPath:e.scipPath,pnpmWorkspaces:e.pnpmWorkspaces,indexerBinary:i,projectPath:e.projectPath,configPath:e.language==="clojure"?e.clojureConfigPath:void 0});return{prepared:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,config:t,resolvedBinary:i,binary:a,args:s,env:ye(t,e.env,i)}}}function Sn(e,t){let n=new Map;for(let i of e)if(i.skipped)Ie(t,i.skipped);else{let a=`${i.language}\0${i.outputScipPath}`,s=n.get(a)??{language:i.language,outputScipPath:i.outputScipPath,scipPaths:[]};s.scipPaths.push(i.scipPath),n.set(a,s)}let r=[];for(let i of n.values())if(i.scipPaths.length>1)$(i.scipPaths,i.outputScipPath),r.push({language:i.language,scipPath:i.outputScipPath});else{let a=i.scipPaths[0];a!==i.outputScipPath&&y(a,i.outputScipPath),r.push({language:i.language,scipPath:i.outputScipPath})}return{indexedOutputs:r}}function Ie(e,t){let n=e.find(r=>r.language===t.language);if(!n){e.push(t);return}n.reason.includes(t.reason)||(n.reason=`${n.reason}; ${t.reason}`)}function Rn(e,t,n,r,i){if(e.length===0){let a=t.map(s=>` - ${s.language}: ${s.reason}`).join(`
6
6
  `);throw new Error(`No language indexers ran successfully. Install at least one indexer for the languages in this project.
7
7
  `+a)}if(t.length!==0&&(i(`Indexed ${e.length} language output(s); skipped or incomplete: ${t.map(a=>a.language).join(", ")}.`),!r))throw new Error(`Failed to index all required languages; preserving the previous index. Pass --allow-partial to intentionally write an incomplete index.
8
8
  `+t.map(a=>` - ${a.language}: ${a.reason}`).join(`
9
- `))}function dn(e,t,n){e.length>1?(n(`Merging ${e.length} language indexes...`),E(e.map(r=>r.scipPath),t)):e[0].scipPath!==t&&h(e[0].scipPath,t)}function fn(e,t,n,r){if(r("Converting to SQLite..."),!R(e))throw new Error(`SCIP index not found at ${e} after indexing`);try{let i=ne(e);i.removedDefinitionOccurrences>0&&r(`Sanitized ${i.removedDefinitionOccurrences} invalid definition occurrences across ${i.touchedDocuments} documents before SQLite conversion.`);let a=k();if(!a)throw new Error("scip CLI is not available");Xt(a,["expt-convert","--output",t,e],{env:n,stdio:"pipe",maxBuffer:50*1024*1024})}catch(i){let a=i instanceof Error?i.message:String(i);throw new Error(`Failed to convert SCIP index to SQLite: ${a}`,{cause:i})}}function Pe(e,t,n){let r=Vt(e)||".scip",i=j(e,r);return f(g(e),`${i}.${n+1}.${t}${r}`)}async function mn(e,t){for(let n=0;n<2;n++){let r=hn(e,t);if(r)return r;let i=yn(e);if(i&&xn(t.trigger,i)){t.onStatus(`Manual reindex preempting watcher refresh started at ${i.startedAt}.`),await Pn(i.pid),y(e,{force:!0});continue}if(i&&!q(i.pid)){y(e,{force:!0});continue}throw new Error(`Another scip-query reindex is already running for ${g(e)}.`)}throw new Error(`Could not acquire scip-query reindex lock for ${g(e)}.`)}function hn(e,t){let n;try{n=Yt(e,"wx")}catch(i){if((typeof i=="object"&&i&&"code"in i?i.code:void 0)==="EEXIST")return null;throw i}let r={version:1,pid:process.pid,projectRoot:t.projectRoot,startedAt:new Date().toISOString(),trigger:t.trigger};return ye(n,JSON.stringify(r)+`
10
- `),()=>{try{Ht(n)}finally{y(e,{force:!0})}}}function yn(e){try{let t=JSON.parse(I(e,"utf-8"));return typeof t.pid!="number"||!Number.isInteger(t.pid)||t.pid<=0?null:{version:1,pid:t.pid,projectRoot:typeof t.projectRoot=="string"?t.projectRoot:g(e),startedAt:typeof t.startedAt=="string"?t.startedAt:"unknown",trigger:t.trigger}}catch{return null}}function xn(e,t){return e?.kind==="manual-cli"&&bn(t?.trigger)}function bn(e){return e?.kind==="watch-source"||e?.kind==="watch-git-head"||e?.kind==="watch-git-index"||e?.kind==="watch-git-state"}async function Pn(e){me(e,"SIGTERM"),!await he(e,2e3)&&(me(e,"SIGKILL"),await he(e,1e3))}function me(e,t){try{process.kill(-e,t)}catch{try{process.kill(e,t)}catch{}}}async function he(e,t){let n=Date.now()+t;for(;Date.now()<n;){if(!q(e))return!0;await Sn(50)}return!q(e)}function q(e){try{return process.kill(e,0),!0}catch{return!1}}function Sn(e){return new Promise(t=>setTimeout(t,e))}function vn(e){W(e.tempOutputScip,e.outputScip),W(e.tempOutputDb,e.outputDb),W(e.tempMetaPath,e.metaPath)}function W(e,t){y(`${t}.tmp-replace`,{force:!0}),h(e,`${t}.tmp-replace`),h(`${t}.tmp-replace`,t)}function jn(e,t,n){return{version:2,languages:[...t].sort(),pnpmWorkspaces:Re(n),typescriptProjectMode:n.typescriptProjectMode??"single",typescriptProjects:ve(n.typescriptProjects),clojureConfigPath:je(n.clojureConfigPath),files:L(e)}}function Se(e,t,n){return Object.fromEntries(t.map(r=>{let i=D(r).markerFiles,a=r==="typescript"?{typescriptProjectMode:n.typescriptProjectMode??"single",typescriptProjects:ve(n.typescriptProjects)}:{typescriptProjectMode:"single",typescriptProjects:[]},s=r==="clojure"?je(n.clojureConfigPath):void 0;return[r,{version:2,languages:[r],pnpmWorkspaces:r==="typescript"&&Re(n),...a,clojureConfigPath:s,files:L(e,{language:r,markerFiles:i})}]}))}function ve(e){return[...new Set((e??[]).map(t=>t.trim()).filter(Boolean))].sort((t,n)=>t.localeCompare(n))}function je(e){return e?.trim()||void 0}function Re(e){return e.typescriptProjectMode!=="workspace"&&e.pnpmWorkspaces===!0}function Ie(e,t){return f(g(e),"language-indexes",`${t}.scip`)}function Rn(e,t){try{let n=JSON.parse(I(e,"utf-8"));return(n.version===2||n.version===3)&&n.status==="complete"&&m(n.fingerprint)===m(t)&&m([...n.indexedLanguages??[]].sort())===m(t.languages)}catch{return!1}}function ke(e,t){let n=`${e}.tmp-${process.pid}-${Date.now()}`;ye(n,`${JSON.stringify(t,null,2)}
11
- `),h(n,e)}function Ce(e,t){try{let n=JSON.parse(I(e,"utf-8"));if(n.version!==2&&n.version!==3)return;ke(e,{...n,lastRefresh:t})}catch{}}function z(e){return{trigger:e.trigger??{kind:"unknown"},result:e.result,startedAt:new Date(e.start).toISOString(),completedAt:new Date().toISOString(),durationMs:Date.now()-e.start,indexedLanguages:e.languages?[...e.languages]:void 0,skipped:e.skipped?[...e.skipped]:void 0,error:e.error}}function m(e){return JSON.stringify(e)}var De=process.env.SCIP_REINDEX_PROJECT_ROOT,Oe=process.env.SCIP_REINDEX_OUTPUT_SCIP,Ee=process.env.SCIP_REINDEX_OUTPUT_DB,we=process.env.SCIP_REINDEX_LANGUAGES,In=On(process.env.SCIP_REINDEX_INDEXER_CONCURRENCY),kn=process.env.SCIP_REINDEX_PNPM_WORKSPACES==="1",Le=Dn(process.env.SCIP_REINDEX_TYPESCRIPT_CONFIG),Cn=process.env.SCIP_REINDEX_CLOJURE_CONFIG_PATH||void 0,wn=Mn(process.env.SCIP_REINDEX_TRIGGER_KIND),Ln=process.env.SCIP_REINDEX_TRIGGER_DETAIL;(!De||!Oe||!Ee)&&(console.error("reindex-worker: missing required env vars"),process.exit(1));var Me=we?we.split(",").filter(Boolean):void 0;xe({projectRoot:De,outputScip:Oe,outputDb:Ee,languages:Me?.length?Me:void 0,pnpmWorkspaces:kn,typescriptProjectMode:Le.projectMode,typescriptProjects:Le.projects,clojureConfigPath:Cn,indexerConcurrency:In,trigger:{kind:wn,detail:Ln||void 0},onStatus:e=>process.stderr.write(`[reindex] ${e}
12
- `)}).then(()=>{process.exit(0)}).catch(e=>{console.error(`reindex-worker error: ${e}`),process.exit(1)});function Mn(e){switch(e){case"manual-cli":case"setup":case"watch-source":case"watch-git-head":case"watch-git-index":case"watch-git-state":return e;default:return"unknown"}}function Dn(e){if(!e)return{};try{let t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};let n=t,r=n.projectMode==="single"||n.projectMode==="workspace"?n.projectMode:void 0,i=Array.isArray(n.projects)?n.projects.filter(a=>typeof a=="string"&&a.trim()!==""):void 0;return{projectMode:r,projects:i&&i.length>0?i:void 0}}catch{return{}}}function On(e){if(!e)return;let t=Number(e);return Number.isInteger(t)&&t>0?t:void 0}
9
+ `))}function jn(e,t,n){e.length>1?(n(`Merging ${e.length} language indexes...`),$(e.map(r=>r.scipPath),t)):e[0].scipPath!==t&&y(e[0].scipPath,t)}function vn(e,t,n,r){if(r("Converting to SQLite..."),!v(e))throw new Error(`SCIP index not found at ${e} after indexing`);try{let i=se(e);i.removedDefinitionOccurrences>0&&r(`Sanitized ${i.removedDefinitionOccurrences} invalid definition occurrences across ${i.touchedDocuments} documents before SQLite conversion.`);let a=k();if(!a)throw new Error("scip CLI is not available");Vt(a,["expt-convert","--output",t,e],{env:n,stdio:"pipe",maxBuffer:50*1024*1024})}catch(i){let a=i instanceof Error?i.message:String(i);throw new Error(`Failed to convert SCIP index to SQLite: ${a}`,{cause:i})}}function ke(e,t,n){let r=sn(e)||".scip",i=j(e,r);return f(d(e),`${i}.${n+1}.${t}${r}`)}async function In(e,t){for(let n=0;n<2;n++){let r=kn(e,t);if(r)return r;let i=wn(e);if(i&&Cn(t.trigger,i)){if(t.onStatus(`Manual reindex preempting watcher refresh started at ${i.startedAt}.`),!await Mn(i.pid))throw new Error(`Could not confirm the watcher's in-progress reindex (pid ${i.pid}) terminated for ${d(e)}; refusing to steal an active lock.`);x(e,{force:!0});continue}if(i&&!G(i.pid)){x(e,{force:!0});continue}throw new Error(`Another scip-query reindex is already running for ${d(e)}.`)}throw new Error(`Could not acquire scip-query reindex lock for ${d(e)}.`)}function kn(e,t){let n;try{n=rn(e,"wx")}catch(i){if((typeof i=="object"&&i&&"code"in i?i.code:void 0)==="EEXIST")return null;throw i}let r={version:1,pid:process.pid,projectRoot:t.projectRoot,startedAt:new Date().toISOString(),trigger:t.trigger};return Re(n,JSON.stringify(r)+`
10
+ `),()=>{try{en(n)}finally{x(e,{force:!0})}}}function wn(e){try{let t=JSON.parse(I(e,"utf-8"));return typeof t.pid!="number"||!Number.isInteger(t.pid)||t.pid<=0?null:{version:1,pid:t.pid,projectRoot:typeof t.projectRoot=="string"?t.projectRoot:d(e),startedAt:typeof t.startedAt=="string"?t.startedAt:"unknown",trigger:t.trigger}}catch{return null}}function Cn(e,t){return e?.kind==="manual-cli"&&Ln(t?.trigger)}function Ln(e){return e?.kind==="watch-source"||e?.kind==="watch-git-head"||e?.kind==="watch-git-index"||e?.kind==="watch-git-state"}async function Mn(e){return Pe(e,"SIGTERM"),await Se(e,2e3)?!0:(Pe(e,"SIGKILL"),Se(e,1e3))}function Pe(e,t){try{process.kill(-e,t)}catch{try{process.kill(e,t)}catch{}}}async function Se(e,t){let n=Date.now()+t;for(;Date.now()<n;){if(!G(e))return!0;await Dn(50)}return!G(e)}function G(e){try{return process.kill(e,0),!0}catch{return!1}}function Dn(e){return new Promise(t=>setTimeout(t,e))}function On(e){q(e.tempOutputScip,e.outputScip),q(e.tempOutputDb,e.outputDb),q(e.tempMetaPath,e.metaPath)}function q(e,t){x(`${t}.tmp-replace`,{force:!0}),y(e,`${t}.tmp-replace`),y(`${t}.tmp-replace`,t)}function En(e,t,n){return{version:2,languages:[...t].sort(),pnpmWorkspaces:Ce(n),typescriptProjectMode:n.typescriptProjectMode??"single",typescriptProjects:L(n.typescriptProjects),clojureConfigPath:we(n.clojureConfigPath),files:M(e)}}function X(e,t,n){return Object.fromEntries(t.map(r=>{let i=O(r).markerFiles,a=r==="typescript"?{typescriptProjectMode:n.typescriptProjectMode??"single",typescriptProjects:L(n.typescriptProjects)}:{typescriptProjectMode:"single",typescriptProjects:[]},s=r==="clojure"?we(n.clojureConfigPath):void 0;return[r,{version:2,languages:[r],pnpmWorkspaces:r==="typescript"&&Ce(n),...a,clojureConfigPath:s,files:M(e,{language:r,markerFiles:i})}]}))}function we(e){return e?.trim()||void 0}function Ce(e){return e.typescriptProjectMode!=="workspace"&&e.pnpmWorkspaces===!0}function H(e,t){return f(d(e),"language-indexes",`${t}.scip`)}function $n(e,t){try{let n=JSON.parse(I(e,"utf-8"));return(n.version===2||n.version===3)&&n.status==="complete"&&h(n.fingerprint)===h(t)&&h([...n.indexedLanguages??[]].sort())===h(t.languages)}catch{return!1}}function Le(e,t){let n=`${e}.tmp-${process.pid}-${Date.now()}`;Re(n,`${JSON.stringify(t,null,2)}
11
+ `),y(n,e)}function Me(e,t){try{let n=JSON.parse(I(e,"utf-8"));if(n.version!==2&&n.version!==3)return;Le(e,{...n,lastRefresh:t})}catch{}}function K(e){return{trigger:e.trigger??{kind:"unknown"},result:e.result,startedAt:new Date(e.start).toISOString(),completedAt:new Date().toISOString(),durationMs:Date.now()-e.start,indexedLanguages:e.languages?[...e.languages]:void 0,skipped:e.skipped?[...e.skipped]:void 0,error:e.error}}function h(e){return JSON.stringify(e)}var $e=process.env.SCIP_REINDEX_PROJECT_ROOT,Ne=process.env.SCIP_REINDEX_OUTPUT_SCIP,Ae=process.env.SCIP_REINDEX_OUTPUT_DB,De=process.env.SCIP_REINDEX_LANGUAGES,Nn=Un(process.env.SCIP_REINDEX_INDEXER_CONCURRENCY),An=process.env.SCIP_REINDEX_PNPM_WORKSPACES==="1",Oe=Wn(process.env.SCIP_REINDEX_TYPESCRIPT_CONFIG),Fn=process.env.SCIP_REINDEX_CLOJURE_CONFIG_PATH||void 0,Tn=_n(process.env.SCIP_REINDEX_TRIGGER_KIND),Bn=process.env.SCIP_REINDEX_TRIGGER_DETAIL;(!$e||!Ne||!Ae)&&(console.error("reindex-worker: missing required env vars"),process.exit(1));var Ee=De?De.split(",").filter(Boolean):void 0;je({projectRoot:$e,outputScip:Ne,outputDb:Ae,languages:Ee?.length?Ee:void 0,pnpmWorkspaces:An,typescriptProjectMode:Oe.projectMode,typescriptProjects:Oe.projects,clojureConfigPath:Fn,indexerConcurrency:Nn,trigger:{kind:Tn,detail:Bn||void 0},onStatus:e=>process.stderr.write(`[reindex] ${e}
12
+ `)}).then(()=>{process.exit(0)}).catch(e=>{console.error(`reindex-worker error: ${e}`),process.exit(1)});function _n(e){switch(e){case"manual-cli":case"setup":case"watch-source":case"watch-git-head":case"watch-git-index":case"watch-git-state":return e;default:return"unknown"}}function Wn(e){if(!e)return{};try{let t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};let n=t,r=n.projectMode==="single"||n.projectMode==="workspace"?n.projectMode:void 0,i=Array.isArray(n.projects)?n.projects.filter(a=>typeof a=="string"&&a.trim()!==""):void 0;return{projectMode:r,projects:i&&i.length>0?i:void 0}}catch{return{}}}function Un(e){if(!e)return;let t=Number(e);return Number.isInteger(t)&&t>0?t:void 0}
13
13
  //# sourceMappingURL=reindex-worker.js.map
package/dist/reindex.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { a as SupportedLanguage, I as IndexerConfig, T as TypeScriptProjectMode } from './config-types-dvHOz0zU.js';
2
- import { R as RefreshTrigger, L as LastRefreshMetadata } from './scip-cli-trnNvymv.js';
3
- export { t as tryInstallScipCli } from './scip-cli-trnNvymv.js';
1
+ import { a as SupportedLanguage, I as IndexerConfig, T as TypeScriptProjectMode } from './config-types-BrHl3Bge.js';
2
+ import { R as RefreshTrigger, L as LastRefreshMetadata } from './scip-cli-C7cg4ZHR.js';
3
+ export { t as tryInstallScipCli } from './scip-cli-C7cg4ZHR.js';
4
4
  import { Index } from '@c4312/scip';
5
5
 
6
6
  /**
@@ -160,6 +160,23 @@ interface ReindexOptions {
160
160
  /** Source that requested this refresh, persisted for status and setup diagnostics. */
161
161
  trigger?: RefreshTrigger;
162
162
  }
163
+ interface ReindexShardDiagnostic {
164
+ /** Unique id for this shard: the language, or `<language>:<projectPath>` for a TS workspace sub-project. */
165
+ id: string;
166
+ language: SupportedLanguage;
167
+ /** True when the cached shard was reused without rerunning its indexer. */
168
+ reused: boolean;
169
+ /** Present only when `reused` is false: why the cached shard could not be used. */
170
+ missReason?: string;
171
+ /** Short hash of this shard's fingerprint inputs (source content + indexer options). */
172
+ fingerprint: string;
173
+ /** Size in bytes of the shard's cached SCIP output, or null when unavailable. */
174
+ outputBytes: number | null;
175
+ /** Wall time spent producing this shard; 0 when reused. */
176
+ durationMs: number;
177
+ /** Indexer command invoked to produce this shard; absent when reused. */
178
+ command?: string;
179
+ }
163
180
  interface ReindexResult {
164
181
  /** Languages that were successfully indexed. */
165
182
  languages: SupportedLanguage[];
@@ -178,6 +195,8 @@ interface ReindexResult {
178
195
  }[];
179
196
  /** Persisted description of this refresh attempt. */
180
197
  lastRefresh?: LastRefreshMetadata;
198
+ /** Per-shard reuse diagnostics (plan6 6.5.2); one entry per language/workspace shard. */
199
+ shards?: ReindexShardDiagnostic[];
181
200
  }
182
201
  /**
183
202
  * Reindex a project: detect languages, run the appropriate SCIP indexer(s),
@@ -185,4 +204,4 @@ interface ReindexResult {
185
204
  */
186
205
  declare function reindex(opts: ReindexOptions): Promise<ReindexResult>;
187
206
 
188
- export { INDEXER_CONFIGS, type ReindexOptions, type ReindexResult, augmentAuxiliaryDocuments, augmentVueResolvedReferences, auxiliaryDocumentsAugmentationStage, describeIndexerBinary, detectLanguages, getIndexerConfig, getIndexerExecutionEnv, isBinaryAvailable, isIndexerInstalled, mergeScipFiles, mergeScipIndexes, reindex, resolveIndexerBinary, resolveProjectLocalIndexerBinary, runPostIndexAugmentation, tryInstallIndexer, vueResolvedReferencesAugmentationStage };
207
+ export { INDEXER_CONFIGS, type ReindexOptions, type ReindexResult, type ReindexShardDiagnostic, augmentAuxiliaryDocuments, augmentVueResolvedReferences, auxiliaryDocumentsAugmentationStage, describeIndexerBinary, detectLanguages, getIndexerConfig, getIndexerExecutionEnv, isBinaryAvailable, isIndexerInstalled, mergeScipFiles, mergeScipIndexes, reindex, resolveIndexerBinary, resolveProjectLocalIndexerBinary, runPostIndexAugmentation, tryInstallIndexer, vueResolvedReferencesAugmentationStage };