scip-query 0.10.12 → 0.11.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 (353) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/{vendor/scip/LICENSE.scip → LICENSE} +1 -0
  3. package/README.md +141 -49
  4. package/dist/augment-vue-worker.js +1 -1
  5. package/dist/chunk-2VSDXOG5.js +2 -0
  6. package/dist/chunk-343O6EVV.js +2 -0
  7. package/dist/{chunk-RUV5IY25.js → chunk-3KDUITBE.js} +2 -2
  8. package/dist/chunk-3T2FNHIU.js +2 -0
  9. package/dist/{chunk-EOLGSSDR.js → chunk-3V6JQQM5.js} +2 -2
  10. package/dist/chunk-5AAAEZ2Z.js +2 -0
  11. package/dist/chunk-6Q6OFLFQ.js +8 -0
  12. package/dist/chunk-6XA4LDHY.js +2 -0
  13. package/dist/chunk-75X52JTA.js +2 -0
  14. package/dist/{chunk-LEHVP4DY.js → chunk-7HB3CZFD.js} +2 -2
  15. package/dist/chunk-7JZRFDCU.js +2 -0
  16. package/dist/{chunk-SQNHOOJ5.js → chunk-7XL7J7PT.js} +2 -2
  17. package/dist/{chunk-GKB4JJDU.js → chunk-ALHNAPS2.js} +2 -2
  18. package/dist/{chunk-TBCHRDAC.js → chunk-BDRBPG7Y.js} +2 -2
  19. package/dist/chunk-BN5SXXQS.js +40 -0
  20. package/dist/chunk-C4ICAIJ4.js +3 -0
  21. package/dist/{chunk-2GLNBCHB.js → chunk-CMHYBXJB.js} +2 -2
  22. package/dist/{chunk-S2MRVIJ5.js → chunk-DRPAQAFM.js} +6 -6
  23. package/dist/chunk-FERAXG6Y.js +72 -0
  24. package/dist/chunk-FLJJLSGB.js +2 -0
  25. package/dist/chunk-FXG3PHVW.js +9 -0
  26. package/dist/{chunk-JS6B76AQ.js → chunk-GCN2P4EJ.js} +2 -2
  27. package/dist/chunk-GHXRVCIY.js +21 -0
  28. package/dist/chunk-GNG622H3.js +3 -0
  29. package/dist/chunk-H4LUPLEJ.js +2 -0
  30. package/dist/{chunk-XUCZ3RQ5.js → chunk-H56MGERE.js} +4 -4
  31. package/dist/chunk-H7NSJ7L2.js +5 -0
  32. package/dist/chunk-HINMXZ6J.js +2 -0
  33. package/dist/chunk-HXXMPYEF.js +2 -0
  34. package/dist/{chunk-A4UTLKHU.js → chunk-HZKMEXA3.js} +2 -2
  35. package/dist/{chunk-T3AEVJBG.js → chunk-IFSX6YVU.js} +2 -2
  36. package/dist/chunk-ISLWJ4PY.js +10 -0
  37. package/dist/chunk-J5WVNZ6O.js +2 -0
  38. package/dist/chunk-K2HYR5A7.js +3 -0
  39. package/dist/{chunk-UVPY3RUZ.js → chunk-K6UI6EBZ.js} +2 -2
  40. package/dist/{chunk-MNCQPMCH.js → chunk-KJCDEDQW.js} +2 -2
  41. package/dist/{chunk-KZ4MG5NY.js → chunk-KKMOB3OJ.js} +2 -2
  42. package/dist/{chunk-ELC77ZDE.js → chunk-KMVGRIO2.js} +2 -2
  43. package/dist/chunk-LWOOTRHC.js +2 -0
  44. package/dist/{chunk-DQ6433ZG.js → chunk-LZNLRE4X.js} +17 -8
  45. package/dist/{chunk-7C6JBBE4.js → chunk-M2YXL62V.js} +2 -2
  46. package/dist/chunk-MNEJYEHW.js +3 -0
  47. package/dist/chunk-MTDBHTSF.js +2 -0
  48. package/dist/{chunk-VB2EZZPA.js → chunk-N2Z3CU7X.js} +2 -2
  49. package/dist/{chunk-2UVCH7CQ.js → chunk-N7PNFLGY.js} +2 -2
  50. package/dist/chunk-NAH5EAZS.js +6 -0
  51. package/dist/{chunk-XHMVZFA6.js → chunk-NBXK32I6.js} +2 -2
  52. package/dist/chunk-NJJ7AS4F.js +2 -0
  53. package/dist/{chunk-ANUEY5WV.js → chunk-NLMRJ7SI.js} +2 -2
  54. package/dist/chunk-ODVITBYU.js +26 -0
  55. package/dist/chunk-ORBRX2QJ.js +2 -0
  56. package/dist/{chunk-NTSR6SRP.js → chunk-P36UR5II.js} +2 -2
  57. package/dist/chunk-PYZZBIEU.js +3 -0
  58. package/dist/chunk-PZS6J5YG.js +16 -0
  59. package/dist/{chunk-3XSNW5XB.js → chunk-QARYU7R3.js} +2 -2
  60. package/dist/chunk-QJ3FK4TB.js +38 -0
  61. package/dist/{chunk-4ISHQ7UW.js → chunk-QXGTGE2C.js} +4 -4
  62. package/dist/chunk-QZ4JVECJ.js +2 -0
  63. package/dist/{chunk-63CI3IXR.js → chunk-R3JY4EZ4.js} +10 -10
  64. package/dist/{chunk-FX6ULETZ.js → chunk-R5336VHZ.js} +2 -2
  65. package/dist/chunk-RJMXSHKM.js +2 -0
  66. package/dist/chunk-STBXCPKY.js +5 -0
  67. package/dist/chunk-T2FQ4GHD.js +9 -0
  68. package/dist/chunk-TFWDJDGO.js +2 -0
  69. package/dist/chunk-TG7QSYCJ.js +2 -0
  70. package/dist/{chunk-ZUUNREKS.js → chunk-TTS75UF2.js} +5 -5
  71. package/dist/{chunk-DDQONX6B.js → chunk-U7I373V4.js} +2 -2
  72. package/dist/chunk-UIKLA3F5.js +2 -0
  73. package/dist/{chunk-6BN3EHQE.js → chunk-UMPNL7T6.js} +2 -2
  74. package/dist/chunk-URSSPS5H.js +2 -0
  75. package/dist/chunk-VGMUFW3J.js +2 -0
  76. package/dist/chunk-VXTNADIW.js +18 -0
  77. package/dist/{chunk-PWAK75BU.js → chunk-VYF5HA76.js} +2 -2
  78. package/dist/chunk-WFGOH2UI.js +43 -0
  79. package/dist/chunk-WGA5BBTA.js +4 -0
  80. package/dist/chunk-WIBFXSYB.js +6 -0
  81. package/dist/chunk-WPSS37EW.js +2 -0
  82. package/dist/chunk-WQHWIVA7.js +3 -0
  83. package/dist/chunk-WS3Z6W3M.js +65 -0
  84. package/dist/chunk-WXVGNFAO.js +2 -0
  85. package/dist/{chunk-RXINFVBN.js → chunk-WZLPXFZU.js} +2 -2
  86. package/dist/chunk-X4O6K47U.js +2 -0
  87. package/dist/chunk-X6OGDTQH.js +2 -0
  88. package/dist/chunk-XEMQUN3Z.js +20 -0
  89. package/dist/{chunk-OFXN2BCT.js → chunk-XHWLNQVZ.js} +2 -2
  90. package/dist/chunk-XMR747CP.js +2 -0
  91. package/dist/{chunk-JJ5SAWBT.js → chunk-Y6L4LXPG.js} +2 -2
  92. package/dist/chunk-YCPASUCX.js +2 -0
  93. package/dist/chunk-YZXV3CU3.js +60 -0
  94. package/dist/{chunk-XRUGSM76.js → chunk-ZEKBR4OK.js} +2 -2
  95. package/dist/chunk-ZMGBWSFZ.js +2 -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 +3 -3
  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 +56 -13
  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 +21 -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 +138 -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-7EK7OSWS.js +0 -2
  291. package/dist/chunk-7IWIMNHI.js +0 -2
  292. package/dist/chunk-7XTO4YXB.js +0 -8
  293. package/dist/chunk-AOWFUGDL.js +0 -2
  294. package/dist/chunk-AREANYIA.js +0 -3
  295. package/dist/chunk-AZBELWZQ.js +0 -7
  296. package/dist/chunk-B32FX5KB.js +0 -2
  297. package/dist/chunk-B6MJ5VQV.js +0 -2
  298. package/dist/chunk-CXWCLVYL.js +0 -2
  299. package/dist/chunk-CYHIKTJN.js +0 -3
  300. package/dist/chunk-DFSEARAU.js +0 -2
  301. package/dist/chunk-DVFP6PZI.js +0 -2
  302. package/dist/chunk-E3ADDB43.js +0 -2
  303. package/dist/chunk-F6IXELII.js +0 -20
  304. package/dist/chunk-FMGVZBS2.js +0 -2
  305. package/dist/chunk-GG5LHT27.js +0 -2
  306. package/dist/chunk-H7JF2CKK.js +0 -2
  307. package/dist/chunk-HHOMJCP5.js +0 -4
  308. package/dist/chunk-HRDSU5FN.js +0 -9
  309. package/dist/chunk-HWVYTJOV.js +0 -2
  310. package/dist/chunk-JNMLBL36.js +0 -2
  311. package/dist/chunk-L446VQYQ.js +0 -2
  312. package/dist/chunk-LDJUB7XW.js +0 -2
  313. package/dist/chunk-MYTUWXHK.js +0 -4
  314. package/dist/chunk-N25HPUOK.js +0 -2
  315. package/dist/chunk-NABVR6B7.js +0 -2
  316. package/dist/chunk-NBNEVLRC.js +0 -3
  317. package/dist/chunk-ONPCQ2PM.js +0 -6
  318. package/dist/chunk-Q5P7NOVM.js +0 -2
  319. package/dist/chunk-RGKRYO22.js +0 -4
  320. package/dist/chunk-RM2WQ75T.js +0 -2
  321. package/dist/chunk-ROGZXWN2.js +0 -2
  322. package/dist/chunk-RSSXKJ6J.js +0 -38
  323. package/dist/chunk-RVGEZYMQ.js +0 -2
  324. package/dist/chunk-SA3DPTHT.js +0 -7
  325. package/dist/chunk-SGTKURU6.js +0 -52
  326. package/dist/chunk-T4N2ZRVY.js +0 -21
  327. package/dist/chunk-THB6AM3V.js +0 -11
  328. package/dist/chunk-ULHLDOD6.js +0 -4
  329. package/dist/chunk-UQ73QF5D.js +0 -43
  330. package/dist/chunk-UUBMFL3F.js +0 -59
  331. package/dist/chunk-V5FGK3DZ.js +0 -2
  332. package/dist/chunk-WTY5FERW.js +0 -2
  333. package/dist/chunk-WUOB4DHH.js +0 -6
  334. package/dist/chunk-YFQIKYOP.js +0 -2
  335. package/dist/chunk-Z2LDWIJV.js +0 -5
  336. package/dist/chunk-ZNWWVYQL.js +0 -3
  337. package/skills/concrete-plan/SKILL.md +0 -372
  338. package/skills/concrete-plan/agents/openai.yaml +0 -4
  339. package/skills/scip-adoption/SKILL.md +0 -122
  340. package/skills/scip-adoption/agents/openai.yaml +0 -4
  341. package/skills/scip-ai-cleanup/SKILL.md +0 -153
  342. package/skills/scip-ai-cleanup/agents/openai.yaml +0 -4
  343. package/skills/scip-debloat/SKILL.md +0 -439
  344. package/skills/scip-debloat/agents/openai.yaml +0 -4
  345. package/skills/scip-health-audit/SKILL.md +0 -162
  346. package/skills/scip-health-audit/agents/openai.yaml +0 -4
  347. package/skills/scip-health-improve/SKILL.md +0 -155
  348. package/skills/scip-health-improve/agents/openai.yaml +0 -4
  349. package/skills/scip-query-setup/SKILL.md +0 -170
  350. package/skills/scip-query-setup/agents/openai.yaml +0 -3
  351. package/vendor/scip/README.md +0 -6
  352. package/vendor/scip/win32-arm64/scip.exe +0 -0
  353. 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 X}from"./chunk-TFWDJDGO.js";import{execFileSync as Kt}from"child_process";import{closeSync as Qt,copyFileSync as Yt,existsSync as R,mkdirSync as J,mkdtempSync as Vt,openSync as Zt,readFileSync as I,renameSync as h,rmSync as y,writeFileSync as be}from"fs";import{basename as j,dirname as g,extname as en,join as f}from"path";import{platform as tn}from"os";import{execFileSync as Ne}from"child_process";import{existsSync as Ae,readdirSync as K}from"fs";import{extname as Q,join as Y}from"path";var Fe=new Set([".git",".hg",".svn",".idea",".vscode","node_modules","vendor","dist","build","target","bin","obj",".dart_tool",".gradle",".next",".venv","venv","__pycache__"]),Te=[{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 V(e){let t=[],n=Be(e),r=qe(e);for(let i of Te){if(_e(e,i.files)){t.push(i.language);continue}if(Ue(n,i.globs)){t.push(i.language);continue}ze(r,i.extensions)&&t.push(i.language)}return t.includes("typescript")&&H(t,"javascript"),t.includes("cpp")&&!r.has(".c")&&H(t,"c"),t}function Be(e){try{return K(e)}catch{return[]}}function _e(e,t){return t?.length?t.some(n=>Ae(Y(e,n))):!1}function Ue(e,t){return t?.length?e.some(n=>t.some(r=>We(n,r))):!1}function We(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 qe(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=K(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=Y(i,s.name);if(s.isDirectory()){Fe.has(s.name)||r.push(o);continue}let c=Q(s.name).toLowerCase();c&&n.add(c)}}return n}function Je(e){try{let t=Ne("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=Q(r).toLowerCase();i&&n.add(i)}return n}catch{return null}}function ze(e,t){return t?.length?t.some(n=>e.has(n)):!1}function H(e,t){let n=e.indexOf(t);n!==-1&&e.splice(n,1)}import{existsSync as Z,readdirSync as Ge}from"fs";import{isAbsolute as Xe,join as D,resolve as He}from"path";var Ke={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",Xe(r)?r:He(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",ee(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",ee(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",Z(r)?r:Z(n)?n:t]}},defaultOutputPath:"index.scip",markerFiles:["composer.json"],installMethods:[],installUrl:"https://github.com/davidrjenni/scip-php/releases"}};function O(e){return Ke[e]}function ee(e,t){let n;try{n=Ge(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 Qe,writeFileSync as Ye}from"fs";import{create as E}from"@bufbuild/protobuf";import{deserializeSCIP as Ve,serializeSCIP as Ze,DocumentSchema as et,IndexSchema as tt,SymbolInformationSchema as nt}from"@c4312/scip";function rt(e){if(e.length===0)throw new Error("Cannot merge zero SCIP indexes");if(e.length===1)return e[0];let t=it(e),n=at(e.flatMap(i=>i.documents??[])),r=te(e.flatMap(i=>i.externalSymbols??[]));return E(tt,{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=>Ve(Qe(i))),r=rt(n);return Ye(t,Buffer.from(Ze(r))),{documentCount:r.documents.length,externalSymbolCount:r.externalSymbols.length,inputCount:e.length}}function it(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 at(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(et,{language:r.language||n.language,relativePath:r.relativePath||n.relativePath,occurrences:st([...r.occurrences,...n.occurrences]),symbols:te([...r.symbols,...n.symbols]),text:ut(r.text,n.text),positionEncoding:r.positionEncoding||n.positionEncoding}))}return[...t.values()]}function st(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 te(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(nt,{symbol:r.symbol,documentation:ct([...r.documentation,...n.documentation]),relationships:ot([...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 ot(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 ut(e,t){return e?t?e.length>=t.length?e:t:e:t}function ct(e){return[...new Set(e)]}import{readFileSync as lt,writeFileSync as pt}from"fs";import{create as ne}from"@bufbuild/protobuf";import{deserializeSCIP as gt,DocumentSchema as dt,IndexSchema as ft,serializeSCIP as mt,SymbolRole as ht}from"@c4312/scip";function re(e){let t;try{t=gt(lt(e))}catch{return{removedDefinitionOccurrences:0,touchedDocuments:0}}let n=yt(t);return n.removedDefinitionOccurrences>0&&pt(e,Buffer.from(mt(n.index))),{removedDefinitionOccurrences:n.removedDefinitionOccurrences,touchedDocuments:n.touchedDocuments}}function yt(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&ht.Definition)===0||t.has(o.symbol)?!0:(n+=1,!1));if(s.length===a.occurrences.length){i.push(a);continue}r+=1,i.push(ne(dt,{language:a.language,relativePath:a.relativePath,occurrences:s,symbols:a.symbols,text:a.text,positionEncoding:a.positionEncoding}))}return{index:n===0?e:ne(ft,{metadata:e.metadata,documents:i,externalSymbols:e.externalSymbols}),removedDefinitionOccurrences:n,touchedDocuments:r}}import{existsSync as Pt,readFileSync as St,readdirSync as vt,statSync as jt}from"fs";import p from"path";import{isAbsolute as xt,relative as bt}from"path";function ie(e,t){let n=bt(e,t);return n===""||!n.startsWith("..")&&!xt(n)}var Rt=new Set([".cache",".git",".next",".nuxt",".turbo",".nx","build","coverage","dist","node_modules","tmp","vendor"]);function ae(e,t=[]){let n=p.resolve(e),r=It(n),i=t.flatMap(c=>kt(n,c)),a=Ct([...r,...i]),s=Lt(n,a)?[n,...a]:a,o=s.length>0?s:[n];return[...new Set(o.map(c=>Dt(n,c)))].sort((c,u)=>c.localeCompare(u))}function It(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()){!Rt.has(a.name)&&!a.name.startsWith(".")&&n.push(s);continue}a.isFile()&&wt(s)&&t.push(p.dirname(s))}}return t}function kt(e,t){let n=t.trim();if(!n)return[];let r=p.resolve(e,n);if(!ie(e,r))return[];try{let i=jt(r);if(i.isDirectory())return[r];if(i.isFile()&&se(p.basename(r)))return[p.dirname(r)]}catch{return[]}return[]}function wt(e){if(!se(p.basename(e)))return!1;let t=oe(e);return t?p.basename(e)==="tsconfig.json"||"include"in t||"files"in t||"references"in t:!1}function se(e){return e.startsWith("tsconfig")&&e.endsWith(".json")}function Ct(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&&Ot(n,r)))}function Lt(e,t){if(t.length===0||t.some(r=>p.resolve(r)===e))return!1;let n=p.join(e,"tsconfig.json");return Pt(n)&&Mt(n)}function Mt(e){let n=oe(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 oe(e){try{let t=JSON.parse(St(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}}function Dt(e,t){let n=p.relative(e,t);return n?n.split(p.sep).join("/"):"."}function Ot(e,t){let n=p.relative(e,t);return!!n&&!n.startsWith("..")&&!p.isAbsolute(n)}import{execFile as Et}from"child_process";import{existsSync as P,renameSync as A,rmSync as F}from"fs";import{cpus as $t}from"os";import{join as ue}from"path";function Nt(e,t,n){if(!e.defaultOutputPath)return;let r=ue(t,e.defaultOutputPath);n!==r&&P(r)&&A(r,n)}function At(e,t,n){if(!e.defaultOutputPath)return null;let r=ue(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 Ft(e){e&&(F(e.defaultOutputPath,{force:!0}),e.backupPath&&P(e.backupPath)&&A(e.backupPath,e.defaultOutputPath))}function Tt(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,$t().length));return Math.max(1,Math.min(e,Math.floor(r)))}async function ce(e,t,n,r){let i=e.filter(u=>u.config.defaultOutputPath),a=e.filter(u=>!u.config.defaultOutputPath),s=[],o=Tt(a.length,r),c=await _t(a,o,u=>N(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 N(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 N(u,t,n));return s.sort((u,d)=>e.findIndex(l=>l.id===u.id)-e.findIndex(l=>l.id===d.id))}async function N(e,t,n){n(`Indexing ${e.label} with ${e.resolvedBinary}...`),F(e.scipPath,{force:!0});let r=At(e.config,t,e.scipPath);try{await Bt(e.binary,e.args,{cwd:t,env:e.env,maxBuffer:50*1024*1024}),Nt(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{Ft(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 Bt(e,t,n){return new Promise((r,i)=>{Et(e,[...t],n,a=>{a?i(a):r()})})}async function _t(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 Ut}from"fs";import{createRequire as Wt}from"module";import{platform as qt}from"os";import{dirname as le,join as S}from"path";var Jt=Wt(import.meta.url);function _(e){return[e.indexerBinary,...e.binaryAliases??[]]}function U(e){let t=_(e);return t.length===1?t[0]:t.join(" or ")}function v(e){for(let t of _(e))if(b(t))return t;return Gt(e)}function pe(e){return v(e)!==null||zt(e)}function zt(e){return ge(e)!==null}function Gt(e){let t=ge(e);if(!t)return null;let r=JSON.parse(Ut(t,"utf8")).bin;if(!r)return null;if(typeof r=="string")return S(le(t),r);for(let i of _(e)){let a=r[i];if(a)return S(le(t),a)}return null}function ge(e){if(!e.bundledNpmPackage)return null;try{return Jt.resolve(`${e.bundledNpmPackage}/package.json`)}catch{return null}}function de(e,t){for(let n of e.projectLocalBinaries??[]){let r=S(t,n);if(T(r))return r}return null}function fe(e,t=process.env,n=e.indexerBinary){if(e.indexerBinary!=="scip-dotnet"||he(n,t))return t;let r=Xt(n,t);return r?{...t,DOTNET_ROOT:r}:t}function me(e,t){let n=e.installMethods,r=U(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=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 Xt(e,t){for(let n of Ht(t))if(he(e,{...t,DOTNET_ROOT:n}))return n;return null}function Ht(e){let t=[],n=e.DOTNET_ROOT;if(n&&T(n)&&t.push(n),qt()==="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 he(e,t){try{return B(e,["--version"],{stdio:"pipe",env:t}),!0}catch{return!1}}async function Pe(e){let{projectRoot:t,maxHeapMb:n=8192,onStatus:r=console.log,skipAutoInstall:i=!1}=e,a=nn(e),s=Date.now();J(g(a.outputScip),{recursive:!0}),J(g(a.outputDb),{recursive:!0});let o=e.languages??V(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=kn(t,o,{pnpmWorkspaces:e.pnpmWorkspaces,typescriptProjectMode:e.typescriptProjectMode,typescriptProjects:e.typescriptProjects,clojureConfigPath:e.clojureConfigPath}),u=await xn(f(g(a.outputDb),"index.lock"),{projectRoot:t,trigger:e.trigger,onStatus:r}),d=null;try{let l=rn({opts:e,paths:a,languages:o,fingerprint:c,start:s,onStatus:r});if(l)return l;await pn(i,r);let x=an(a);return d=x.runDir,await sn({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,G({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 nn(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 rn(e){if(e.opts.skipIfUnchanged===!1||!R(e.paths.outputScip)||!R(e.paths.outputDb)||!wn(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=G({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 an(e){let t=Vt(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 sn(e){let t={...process.env,NODE_OPTIONS:`--max-old-space-size=${e.maxHeapMb}`},{indexedOutputs:n,skippedLanguages:r,reusedLanguages:i}=await on(e,t);i.length>0&&e.onStatus(`Reused ${i.length} cached language shard(s): ${i.join(", ")}`);let a=un(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 on(e,t){let n=cn(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}=gn({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 ce(i,e.projectRoot,e.onStatus,e.opts.indexerConcurrency),{indexedOutputs:o}=fn(s,a),c=[...n,...o];return mn(c,a,e.languages,e.opts.allowPartial,e.onStatus),{indexedOutputs:c,skippedLanguages:a,reusedLanguages:[...r]}}function un(e,t,n,r){ln(e.paths.outputDb,n),hn(n,e.tempPaths.tempOutputScip,e.onStatus),yn(e.tempPaths.tempOutputScip,e.tempPaths.tempOutputDb,t,e.onStatus),C(w(),{projectRoot:e.projectRoot,dbPath:e.tempPaths.tempOutputDb,onStatus:e.onStatus});let i=G({trigger:e.opts.trigger,result:"rebuilt",start:e.start,languages:n.map(a=>a.language),skipped:[...r]});return we(e.tempPaths.tempMetaPath,{version:3,status:r.length===0?"complete":"partial",updatedAt:new Date().toISOString(),fingerprint:e.fingerprint,languageFingerprints:je(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}),In({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 cn(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=je(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=ke(e.paths.outputDb,i);R(a)&&m(t.languageFingerprints[i])===m(r[i])&&n.push({language:i,scipPath:a})}return n}function ln(e,t){for(let n of t){let r=ke(e,n.language);J(g(r),{recursive:!0}),n.scipPath!==r&&Yt(n.scipPath,r)}}async function pn(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(tn()==="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..."),!X(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 gn(e){let t=[],n=[],r=e.languages.map((i,a)=>({language:i,scipPath:e.languages.length>1?ve(e.tempOutputScip,i,a):e.tempOutputScip}));for(let{language:i,scipPath:a}of r){let s=dn({...e,language:i,scipPath:a});for(let o of s)"skipped"in o?Se(n,o.skipped):t.push(o.prepared)}return{preparedRuns:t,skippedLanguages:n}}function dn(e){if(e.language!=="typescript"||e.typescriptProjectMode!=="workspace")return[W({...e,id:e.language,label:e.language,outputScipPath:e.scipPath})];let t=ae(e.projectRoot,e.typescriptProjects);return t.length===0?[W({...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)=>W({...e,id:`typescript:${n}`,label:`typescript (${n})`,scipPath:ve(e.tempOutputScip,"typescript-project",r),outputScipPath:e.scipPath,pnpmWorkspaces:!1,projectPath:n})))}function W(e){let t=O(e.language),n=U(t),r=de(t,e.projectRoot);if(!r&&!pe(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...`),!me(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:fe(t,e.env,i)}}}function fn(e,t){let n=new Map;for(let i of e)if(i.skipped)Se(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&&h(a,i.outputScipPath),r.push({language:i.language,scipPath:i.outputScipPath})}return{indexedOutputs:r}}function Se(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 mn(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 hn(e,t,n){e.length>1?(n(`Merging ${e.length} language indexes...`),$(e.map(r=>r.scipPath),t)):e[0].scipPath!==t&&h(e[0].scipPath,t)}function yn(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=re(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");Kt(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 ve(e,t,n){let r=en(e)||".scip",i=j(e,r);return f(g(e),`${i}.${n+1}.${t}${r}`)}async function xn(e,t){for(let n=0;n<2;n++){let r=bn(e,t);if(r)return r;let i=Pn(e);if(i&&Sn(t.trigger,i)){if(t.onStatus(`Manual reindex preempting watcher refresh started at ${i.startedAt}.`),!await jn(i.pid))throw new Error(`Could not confirm the watcher's in-progress reindex (pid ${i.pid}) terminated for ${g(e)}; refusing to steal an active lock.`);y(e,{force:!0});continue}if(i&&!z(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 bn(e,t){let n;try{n=Zt(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 be(n,JSON.stringify(r)+`
10
+ `),()=>{try{Qt(n)}finally{y(e,{force:!0})}}}function Pn(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 Sn(e,t){return e?.kind==="manual-cli"&&vn(t?.trigger)}function vn(e){return e?.kind==="watch-source"||e?.kind==="watch-git-head"||e?.kind==="watch-git-index"||e?.kind==="watch-git-state"}async function jn(e){return ye(e,"SIGTERM"),await xe(e,2e3)?!0:(ye(e,"SIGKILL"),xe(e,1e3))}function ye(e,t){try{process.kill(-e,t)}catch{try{process.kill(e,t)}catch{}}}async function xe(e,t){let n=Date.now()+t;for(;Date.now()<n;){if(!z(e))return!0;await Rn(50)}return!z(e)}function z(e){try{return process.kill(e,0),!0}catch{return!1}}function Rn(e){return new Promise(t=>setTimeout(t,e))}function In(e){q(e.tempOutputScip,e.outputScip),q(e.tempOutputDb,e.outputDb),q(e.tempMetaPath,e.metaPath)}function q(e,t){y(`${t}.tmp-replace`,{force:!0}),h(e,`${t}.tmp-replace`),h(`${t}.tmp-replace`,t)}function kn(e,t,n){return{version:2,languages:[...t].sort(),pnpmWorkspaces:Ie(n),typescriptProjectMode:n.typescriptProjectMode??"single",typescriptProjects:L(n.typescriptProjects),clojureConfigPath:Re(n.clojureConfigPath),files:M(e)}}function je(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"?Re(n.clojureConfigPath):void 0;return[r,{version:2,languages:[r],pnpmWorkspaces:r==="typescript"&&Ie(n),...a,clojureConfigPath:s,files:M(e,{language:r,markerFiles:i})}]}))}function Re(e){return e?.trim()||void 0}function Ie(e){return e.typescriptProjectMode!=="workspace"&&e.pnpmWorkspaces===!0}function ke(e,t){return f(g(e),"language-indexes",`${t}.scip`)}function wn(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 we(e,t){let n=`${e}.tmp-${process.pid}-${Date.now()}`;be(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;we(e,{...n,lastRefresh:t})}catch{}}function G(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 Oe=process.env.SCIP_REINDEX_PROJECT_ROOT,Ee=process.env.SCIP_REINDEX_OUTPUT_SCIP,$e=process.env.SCIP_REINDEX_OUTPUT_DB,Le=process.env.SCIP_REINDEX_LANGUAGES,Cn=Nn(process.env.SCIP_REINDEX_INDEXER_CONCURRENCY),Ln=process.env.SCIP_REINDEX_PNPM_WORKSPACES==="1",Me=$n(process.env.SCIP_REINDEX_TYPESCRIPT_CONFIG),Mn=process.env.SCIP_REINDEX_CLOJURE_CONFIG_PATH||void 0,Dn=En(process.env.SCIP_REINDEX_TRIGGER_KIND),On=process.env.SCIP_REINDEX_TRIGGER_DETAIL;(!Oe||!Ee||!$e)&&(console.error("reindex-worker: missing required env vars"),process.exit(1));var De=Le?Le.split(",").filter(Boolean):void 0;Pe({projectRoot:Oe,outputScip:Ee,outputDb:$e,languages:De?.length?De:void 0,pnpmWorkspaces:Ln,typescriptProjectMode:Me.projectMode,typescriptProjects:Me.projects,clojureConfigPath:Mn,indexerConcurrency:Cn,trigger:{kind:Dn,detail:On||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 En(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 $n(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 Nn(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
  /**