scip-query 0.19.4 → 0.19.6

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 (400) hide show
  1. package/CHANGELOG.md +75 -1
  2. package/README.md +242 -49
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/{chunk-2YU7I3QO.js → chunk-24QNP7MN.js} +2 -2
  5. package/dist/{chunk-CNKAGUPL.js → chunk-26X7KCJR.js} +2 -2
  6. package/dist/{chunk-GPBBJ5Y4.js → chunk-273W2U4Y.js} +3 -3
  7. package/dist/{chunk-7GXM52MI.js → chunk-2CVXCGL4.js} +2 -2
  8. package/dist/{chunk-ABMYA4TN.js → chunk-2EZSOTSY.js} +2 -2
  9. package/dist/{chunk-HKEHS2AS.js → chunk-2GSQR6YA.js} +2 -2
  10. package/dist/{chunk-FECYOO5O.js → chunk-2OXVAGGT.js} +2 -2
  11. package/dist/chunk-2ZOCHAL2.js +8 -0
  12. package/dist/{chunk-QGXBRIM5.js → chunk-336DC5NJ.js} +2 -2
  13. package/dist/chunk-35SQLYCQ.js +2 -0
  14. package/dist/{chunk-VXQNNXJE.js → chunk-3OIKRYU5.js} +2 -2
  15. package/dist/{chunk-52ZYCAEO.js → chunk-47X75ZKH.js} +2 -2
  16. package/dist/{chunk-NPKYOIFM.js → chunk-4CGVLUDP.js} +2 -2
  17. package/dist/chunk-4RI4BJGT.js +8 -0
  18. package/dist/{chunk-P2PC2WGR.js → chunk-52HQTTPB.js} +2 -2
  19. package/dist/{chunk-YNRNA5LK.js → chunk-5OC3HWP5.js} +2 -2
  20. package/dist/{chunk-STOL2BTL.js → chunk-6XFC7PQ5.js} +2 -2
  21. package/dist/{chunk-J77UIT3I.js → chunk-6XHTISLI.js} +2 -2
  22. package/dist/chunk-6YTSKJJ3.js +2 -0
  23. package/dist/{chunk-BTEE5NZQ.js → chunk-7E3TH5ZN.js} +2 -2
  24. package/dist/{chunk-X6D5IC6I.js → chunk-7LABSJSR.js} +2 -2
  25. package/dist/chunk-7Q6VYYCH.js +2 -0
  26. package/dist/{chunk-FWUUZTIO.js → chunk-A43URCQ3.js} +2 -2
  27. package/dist/chunk-A63U2W3P.js +3 -0
  28. package/dist/{chunk-3MJ5YA4Y.js → chunk-ADFSIJP2.js} +2 -2
  29. package/dist/chunk-AOLE4DYM.js +6 -0
  30. package/dist/chunk-APMMR5Y2.js +2 -0
  31. package/dist/chunk-B5MHCHP3.js +107 -0
  32. package/dist/{chunk-4RSI5EMG.js → chunk-CSTYYXKC.js} +2 -2
  33. package/dist/{chunk-25LPM4DG.js → chunk-CYJM7CYF.js} +2 -2
  34. package/dist/{chunk-S44IULR6.js → chunk-DD5BOU5I.js} +2 -2
  35. package/dist/{chunk-YGAGTIDK.js → chunk-DGMCFMPG.js} +7 -7
  36. package/dist/{chunk-UOAV44HR.js → chunk-E2ZXPB7J.js} +2 -2
  37. package/dist/{chunk-IZKFSVBV.js → chunk-EVOC5I5I.js} +2 -2
  38. package/dist/{chunk-XTX6QHOF.js → chunk-F42A3AKG.js} +2 -2
  39. package/dist/{chunk-Q4IIEGXJ.js → chunk-FHCTEANE.js} +2 -2
  40. package/dist/{chunk-3SVWW4PN.js → chunk-FKGN4A4E.js} +2 -2
  41. package/dist/{chunk-IG7N5ZIK.js → chunk-FQTPPXNA.js} +2 -2
  42. package/dist/{chunk-F6O7AAC3.js → chunk-G4UQL4CP.js} +2 -2
  43. package/dist/chunk-GA64UPMI.js +6 -0
  44. package/dist/{chunk-ZXJYMGD3.js → chunk-GK3GRUJX.js} +2 -2
  45. package/dist/chunk-HEBAY673.js +2 -0
  46. package/dist/chunk-HELS7KFF.js +2 -0
  47. package/dist/{chunk-B5NLK2B3.js → chunk-IPDCSB6N.js} +2 -2
  48. package/dist/{chunk-M7MTH5NR.js → chunk-IYAOX36F.js} +2 -2
  49. package/dist/{chunk-YVVCVR2L.js → chunk-J7VT2CRB.js} +2 -2
  50. package/dist/{chunk-4333ETTV.js → chunk-JELJLXEE.js} +2 -2
  51. package/dist/{chunk-LBMJEAEW.js → chunk-JERWGHQT.js} +2 -2
  52. package/dist/chunk-JJJCO4QC.js +945 -0
  53. package/dist/{chunk-6E7UTQY7.js → chunk-JZNLMHWY.js} +2 -2
  54. package/dist/{chunk-R4FQGQ4X.js → chunk-K42M2KWT.js} +2 -2
  55. package/dist/{chunk-H7UKLTWJ.js → chunk-KLVJABXA.js} +2 -2
  56. package/dist/chunk-KP4KBDVF.js +3 -0
  57. package/dist/{chunk-RV2FQIX3.js → chunk-LMFVTUW2.js} +2 -2
  58. package/dist/chunk-LRTP3DKL.js +3 -0
  59. package/dist/{chunk-U6WNH5GC.js → chunk-MGBJHRFB.js} +2 -2
  60. package/dist/{chunk-QDV6RDCP.js → chunk-MLGTCX56.js} +2 -2
  61. package/dist/{chunk-54HA4ZXH.js → chunk-N3SE646F.js} +2 -2
  62. package/dist/{chunk-KP6XRY5Z.js → chunk-NBRUH7OE.js} +2 -2
  63. package/dist/{chunk-M7AIS73L.js → chunk-NN4ZIRPK.js} +2 -2
  64. package/dist/{chunk-I5RJM53C.js → chunk-NQLSSVOB.js} +2 -2
  65. package/dist/{chunk-4SALD7RU.js → chunk-OBKDTVZ3.js} +2 -2
  66. package/dist/{chunk-GBQ5NYPR.js → chunk-OHWZKLVA.js} +6 -6
  67. package/dist/{chunk-6NSFJYRC.js → chunk-OP3MTFJR.js} +2 -2
  68. package/dist/{chunk-EOOJGLDU.js → chunk-OQ2A4G2G.js} +2 -2
  69. package/dist/{chunk-DLWR3NUU.js → chunk-P6HBYNBE.js} +2 -2
  70. package/dist/{chunk-QVWS2VWZ.js → chunk-PC44K7RF.js} +2 -2
  71. package/dist/{chunk-A2EZV2UM.js → chunk-QBYYWGAT.js} +2 -2
  72. package/dist/{chunk-QRGV2F7L.js → chunk-QHKUY4FW.js} +2 -2
  73. package/dist/chunk-QHRL4LKM.js +2 -0
  74. package/dist/{chunk-I5AWSI2G.js → chunk-QQWOFXNW.js} +2 -2
  75. package/dist/{chunk-WQTAC523.js → chunk-RBFFD4V2.js} +2 -2
  76. package/dist/{chunk-SOAT6NLA.js → chunk-RJHCPSZ7.js} +2 -2
  77. package/dist/{chunk-VGRICIQI.js → chunk-RWRLUZ6U.js} +2 -2
  78. package/dist/{chunk-4T3LTWUS.js → chunk-S2GP3CU3.js} +2 -2
  79. package/dist/{chunk-HEXVUYFQ.js → chunk-SHKZ7OVJ.js} +2 -2
  80. package/dist/{chunk-NSS46APD.js → chunk-TFUU5MQQ.js} +2 -2
  81. package/dist/{chunk-IUFDSKGG.js → chunk-TYQ76QHQ.js} +2 -2
  82. package/dist/{chunk-NRCXJDHL.js → chunk-U5CNPPTZ.js} +2 -2
  83. package/dist/{chunk-MITTUCEH.js → chunk-UQK5CRUK.js} +2 -2
  84. package/dist/{chunk-XLTP42QA.js → chunk-UUJBLG6J.js} +2 -2
  85. package/dist/chunk-UXP636P5.js +144 -0
  86. package/dist/{chunk-64RFXJT5.js → chunk-VEVBIAOJ.js} +6 -6
  87. package/dist/chunk-VKRQDBW5.js +9 -0
  88. package/dist/{chunk-C7NIYIQ4.js → chunk-VOQFGC2W.js} +4 -4
  89. package/dist/{chunk-DZ74OMG6.js → chunk-VP542C25.js} +2 -2
  90. package/dist/{chunk-Q3AFUTGB.js → chunk-WMXRRBII.js} +2 -2
  91. package/dist/{chunk-ZGZUZ7XE.js → chunk-WXAAURU7.js} +2 -2
  92. package/dist/chunk-X3NLZHPA.js +20 -0
  93. package/dist/{chunk-WER3B7MI.js → chunk-XF3KLXN3.js} +2 -2
  94. package/dist/{chunk-NH5ALKPW.js → chunk-XVJ3V7LM.js} +2 -2
  95. package/dist/{chunk-4XTA5OMB.js → chunk-YGQN3XGZ.js} +2 -2
  96. package/dist/{chunk-CFMXJPHH.js → chunk-YHXBD52M.js} +2 -2
  97. package/dist/{chunk-7B3UPBVA.js → chunk-YLVE3SXZ.js} +2 -2
  98. package/dist/{chunk-YIJ7ZAA4.js → chunk-YTUD45PU.js} +2 -2
  99. package/dist/{chunk-VTKGCT3V.js → chunk-YWB2EBNB.js} +2 -2
  100. package/dist/{chunk-UKZBVX4U.js → chunk-Z2LHPIOM.js} +2 -2
  101. package/dist/chunk-Z5QQPJ3U.js +30 -0
  102. package/dist/{chunk-NZL2DBT7.js → chunk-ZLJLE6LK.js} +2 -2
  103. package/dist/{chunk-XYADIZHU.js → chunk-ZTTISZ7J.js} +2 -2
  104. package/dist/cli.js +3 -3
  105. package/dist/command-descriptors-SJDZ7QGR.js +617 -0
  106. package/dist/{config-types-D20KuvvZ.d.ts → config-types-BWQ5xPGI.d.ts} +4 -0
  107. package/dist/{db-G_II8yXU.d.ts → db-B0r1o7Vt.d.ts} +18 -1
  108. package/dist/direct-navigation-HTKOZEOM.js +3 -0
  109. package/dist/{health-oblXYgkF.d.ts → health-CFnlCiTz.d.ts} +1 -1
  110. package/dist/index.d.ts +2 -2
  111. package/dist/index.js +1 -1
  112. package/dist/postinstall.js +1 -1
  113. package/dist/queries/affected.d.ts +2 -2
  114. package/dist/queries/affected.js +1 -1
  115. package/dist/queries/architecture.d.ts +2 -2
  116. package/dist/queries/architecture.js +1 -1
  117. package/dist/queries/bottlenecks.d.ts +2 -2
  118. package/dist/queries/bottlenecks.js +1 -1
  119. package/dist/queries/by-kind.d.ts +2 -2
  120. package/dist/queries/by-kind.js +1 -1
  121. package/dist/queries/call-graph.d.ts +2 -2
  122. package/dist/queries/call-graph.js +1 -1
  123. package/dist/queries/change-surface.d.ts +2 -2
  124. package/dist/queries/change-surface.js +1 -1
  125. package/dist/queries/cleanup-plan.d.ts +2 -2
  126. package/dist/queries/cleanup-plan.js +1 -1
  127. package/dist/queries/co-change.d.ts +2 -2
  128. package/dist/queries/co-change.js +1 -1
  129. package/dist/queries/code.d.ts +2 -2
  130. package/dist/queries/code.js +1 -1
  131. package/dist/queries/complexity-hotspots.d.ts +2 -2
  132. package/dist/queries/complexity-hotspots.js +1 -1
  133. package/dist/queries/complexity.d.ts +2 -2
  134. package/dist/queries/complexity.js +1 -1
  135. package/dist/queries/convergence.d.ts +2 -2
  136. package/dist/queries/convergence.js +1 -1
  137. package/dist/queries/coupling.d.ts +2 -2
  138. package/dist/queries/coupling.js +1 -1
  139. package/dist/queries/cycles.d.ts +2 -2
  140. package/dist/queries/cycles.js +1 -1
  141. package/dist/queries/dataflow.d.ts +2 -2
  142. package/dist/queries/dataflow.js +1 -1
  143. package/dist/queries/dead.d.ts +2 -2
  144. package/dist/queries/dead.js +1 -1
  145. package/dist/queries/decorative-checkers.d.ts +3 -3
  146. package/dist/queries/decorative-checkers.js +1 -1
  147. package/dist/queries/deep-chains.d.ts +2 -2
  148. package/dist/queries/deep-chains.js +1 -1
  149. package/dist/queries/deps.d.ts +2 -2
  150. package/dist/queries/deps.js +1 -1
  151. package/dist/queries/diff-gate.d.ts +30 -2
  152. package/dist/queries/diff-gate.js +1 -1
  153. package/dist/queries/diff-impact.d.ts +2 -2
  154. package/dist/queries/diff-impact.js +1 -1
  155. package/dist/queries/doc-drift.d.ts +2 -2
  156. package/dist/queries/doc-drift.js +1 -1
  157. package/dist/queries/drift.d.ts +2 -2
  158. package/dist/queries/drift.js +1 -1
  159. package/dist/queries/duplicate-bodies.d.ts +2 -2
  160. package/dist/queries/duplicate-bodies.js +1 -1
  161. package/dist/queries/extract-candidates.d.ts +2 -2
  162. package/dist/queries/extract-candidates.js +1 -1
  163. package/dist/queries/fan.d.ts +2 -2
  164. package/dist/queries/fan.js +1 -1
  165. package/dist/queries/files.d.ts +2 -2
  166. package/dist/queries/health.d.ts +3 -3
  167. package/dist/queries/health.js +1 -1
  168. package/dist/queries/hierarchy.d.ts +2 -2
  169. package/dist/queries/hierarchy.js +1 -1
  170. package/dist/queries/hotspots.d.ts +2 -2
  171. package/dist/queries/hotspots.js +1 -1
  172. package/dist/queries/imports.d.ts +2 -2
  173. package/dist/queries/imports.js +1 -1
  174. package/dist/queries/incomplete-migration.d.ts +2 -2
  175. package/dist/queries/incomplete-migration.js +1 -1
  176. package/dist/queries/index.d.ts +17 -3
  177. package/dist/queries/index.js +1 -1
  178. package/dist/queries/isolated.d.ts +2 -2
  179. package/dist/queries/isolated.js +1 -1
  180. package/dist/queries/locality-candidates.d.ts +2 -2
  181. package/dist/queries/locality-candidates.js +1 -1
  182. package/dist/queries/members.d.ts +2 -2
  183. package/dist/queries/members.js +1 -1
  184. package/dist/queries/methods.d.ts +2 -2
  185. package/dist/queries/methods.js +1 -1
  186. package/dist/queries/not-implemented.d.ts +3 -3
  187. package/dist/queries/not-implemented.js +1 -1
  188. package/dist/queries/outline.d.ts +2 -2
  189. package/dist/queries/outline.js +1 -1
  190. package/dist/queries/passthrough-candidates.d.ts +2 -2
  191. package/dist/queries/passthrough-candidates.js +1 -1
  192. package/dist/queries/plan-context.d.ts +2 -2
  193. package/dist/queries/plan-context.js +1 -1
  194. package/dist/queries/react-component-duplicates.d.ts +2 -2
  195. package/dist/queries/react-component-duplicates.js +1 -1
  196. package/dist/queries/react-hook-candidates.d.ts +2 -2
  197. package/dist/queries/react-hook-candidates.js +1 -1
  198. package/dist/queries/react-large-component-pressure.d.ts +2 -2
  199. package/dist/queries/react-large-component-pressure.js +1 -1
  200. package/dist/queries/recent-duplicates.d.ts +2 -2
  201. package/dist/queries/recent-duplicates.js +1 -1
  202. package/dist/queries/redundant-reexports.d.ts +2 -2
  203. package/dist/queries/redundant-reexports.js +1 -1
  204. package/dist/queries/refs.d.ts +2 -2
  205. package/dist/queries/refs.js +1 -1
  206. package/dist/queries/self-audit.d.ts +2 -2
  207. package/dist/queries/self-audit.js +1 -1
  208. package/dist/queries/similar-chains.d.ts +2 -2
  209. package/dist/queries/similar-chains.js +1 -1
  210. package/dist/queries/similar-files.d.ts +2 -2
  211. package/dist/queries/similar-files.js +1 -1
  212. package/dist/queries/similar-signatures.d.ts +2 -2
  213. package/dist/queries/similar-signatures.js +1 -1
  214. package/dist/queries/similar.d.ts +2 -2
  215. package/dist/queries/similar.js +1 -1
  216. package/dist/queries/slice.d.ts +2 -2
  217. package/dist/queries/slice.js +1 -1
  218. package/dist/queries/stale-abstractions.d.ts +2 -2
  219. package/dist/queries/stale-abstractions.js +1 -1
  220. package/dist/queries/stats.d.ts +2 -2
  221. package/dist/queries/stats.js +1 -1
  222. package/dist/queries/surface.d.ts +2 -2
  223. package/dist/queries/surface.js +1 -1
  224. package/dist/queries/symbols.d.ts +2 -2
  225. package/dist/queries/symbols.js +1 -1
  226. package/dist/queries/system.d.ts +2 -2
  227. package/dist/queries/system.js +1 -1
  228. package/dist/queries/test-quality.d.ts +2 -2
  229. package/dist/queries/test-quality.js +1 -1
  230. package/dist/queries/trace.d.ts +2 -2
  231. package/dist/queries/trace.js +1 -1
  232. package/dist/queries/twin-ab.d.ts +3 -3
  233. package/dist/queries/twin-ab.js +1 -1
  234. package/dist/queries/twin-drift.d.ts +2 -2
  235. package/dist/queries/twin-drift.js +1 -1
  236. package/dist/queries/unused-imports.d.ts +2 -2
  237. package/dist/queries/unused-imports.js +1 -1
  238. package/dist/queries/unused-params.d.ts +2 -2
  239. package/dist/queries/unused-params.js +1 -1
  240. package/dist/queries/vue-component-duplicates.d.ts +2 -2
  241. package/dist/queries/vue-component-duplicates.js +1 -1
  242. package/dist/queries/vue-composable-candidates.d.ts +2 -2
  243. package/dist/queries/vue-composable-candidates.js +1 -1
  244. package/dist/queries/vue-large-view-pressure.d.ts +2 -2
  245. package/dist/queries/vue-large-view-pressure.js +1 -1
  246. package/dist/queries/wrapper-candidates.d.ts +2 -2
  247. package/dist/queries/wrapper-candidates.js +1 -1
  248. package/dist/reindex-worker.js +23 -24
  249. package/dist/reindex.d.ts +10 -4
  250. package/dist/reindex.js +33 -38
  251. package/dist/runtime.d.ts +167 -11
  252. package/dist/runtime.js +3 -2
  253. package/dist/rust-semantic-session-server.js +1 -1
  254. package/dist/rust-semantic-session-worker.js +1 -1
  255. package/dist/rust-semantic-worker.js +1 -1
  256. package/dist/{scip-cli-kRpaexVJ.d.ts → scip-cli-DCvnlZCu.d.ts} +5 -1
  257. package/dist/watch-server.js +5 -5
  258. package/docs/AGENT_GUIDE.md +1 -1
  259. package/docs/AI_FAILURE_MODES.md +18 -18
  260. package/docs/API_EVOLUTION.md +71 -0
  261. package/docs/CLI_JSON_OUTPUT.md +83 -0
  262. package/docs/COMMAND_REFERENCE.md +10 -8
  263. package/docs/COMMITTED_RECORD_COMPATIBILITY.md +117 -0
  264. package/docs/CONFIGURATION_WRITE_SAFETY.md +130 -0
  265. package/docs/DETECTOR_GUIDE.md +47 -47
  266. package/docs/DURABILITY.md +103 -0
  267. package/docs/INDEX_GENERATIONS.md +121 -0
  268. package/docs/LOCK_PROTOCOL.md +133 -0
  269. package/docs/MAILBOX_LIFECYCLE.md +197 -0
  270. package/docs/REINDEX_METADATA_COMPATIBILITY.md +84 -0
  271. package/docs/RUST_DURABLE_SESSION_PROTOCOL.md +126 -0
  272. package/docs/TELEMETRY_RETENTION.md +72 -0
  273. package/docs/TIME_SEMANTICS.md +77 -0
  274. package/docs/WATCH_REFRESH_REQUESTS.md +110 -0
  275. package/docs/WINDOWS_SIDECAR_RELEASE.md +298 -0
  276. package/docs/analyzer-validation-ledger.md +24 -23
  277. package/docs/schemas/cli-json-envelope.schema.json +53 -0
  278. package/docs/schemas/npm-release-state.schema.json +146 -0
  279. package/docs/schemas/outcome-event-record.schema.json +39 -0
  280. package/docs/schemas/project-config.schema.json +247 -0
  281. package/docs/schemas/suppression-record.schema.json +31 -0
  282. package/docs/schemas/windows-sidecar-provenance.schema.json +137 -0
  283. package/package.json +15 -5
  284. package/scripts/build-scip-windows.mjs +180 -61
  285. package/scripts/scip-windows-provenance.mjs +364 -0
  286. package/scripts/verify-scip-windows.mjs +29 -0
  287. package/skills/_shared/SKILL.md +91 -242
  288. package/skills/_shared/agents/openai.yaml +1 -1
  289. package/skills/_shared/references/agent-contract-catalog.md +105 -0
  290. package/skills/_shared/references/command-catalog.md +118 -0
  291. package/skills/_shared/references/detector-precision-and-diffgate.md +59 -0
  292. package/skills/_shared/references/evidence-and-dead-code.md +25 -0
  293. package/skills/scip-audit/SKILL.md +76 -0
  294. package/skills/scip-audit/agents/openai.yaml +4 -0
  295. package/skills/scip-audit/references/claims.md +98 -0
  296. package/skills/scip-audit/references/cleanup.md +101 -0
  297. package/skills/scip-audit/references/directory.md +222 -0
  298. package/skills/scip-audit/references/frontend.md +130 -0
  299. package/skills/scip-audit/references/integrity.md +154 -0
  300. package/skills/scip-audit/references/maintainability.md +162 -0
  301. package/skills/scip-audit/references/twin-drift.md +104 -0
  302. package/skills/scip-diagnose/SKILL.md +52 -0
  303. package/skills/scip-diagnose/agents/openai.yaml +4 -0
  304. package/skills/scip-diagnose/references/debug.md +117 -0
  305. package/skills/{scip-probe-reachability/SKILL.md → scip-diagnose/references/probe-reachability.md} +12 -27
  306. package/skills/scip-diagnose/references/root-cause.md +145 -0
  307. package/skills/scip-diagnose/references/triage.md +119 -0
  308. package/skills/scip-explore/SKILL.md +53 -84
  309. package/skills/scip-explore/agents/openai.yaml +2 -2
  310. package/skills/scip-explore/references/diagrams.md +40 -0
  311. package/skills/scip-explore/references/language-playbook.md +49 -0
  312. package/skills/scip-improve/SKILL.md +56 -0
  313. package/skills/scip-improve/agents/openai.yaml +4 -0
  314. package/skills/scip-improve/references/cleanup-batches.md +53 -0
  315. package/skills/scip-improve/references/directory-moves.md +53 -0
  316. package/skills/scip-improve/references/doc-reconcile.md +30 -0
  317. package/skills/scip-improve/references/frontend-extraction.md +39 -0
  318. package/skills/scip-improve/references/maintainability-mechanism.md +43 -0
  319. package/skills/scip-improve/references/twin-drift.md +35 -0
  320. package/skills/scip-plan/SKILL.md +68 -0
  321. package/skills/scip-plan/agents/openai.yaml +4 -0
  322. package/skills/scip-plan/references/api-impact.md +19 -0
  323. package/skills/scip-plan/references/conductor.md +41 -0
  324. package/skills/scip-plan/references/high-assurance.md +43 -0
  325. package/skills/scip-plan/references/hyper-optimization.md +50 -0
  326. package/skills/scip-plan/references/tla-model.md +88 -0
  327. package/skills/scip-query/SKILL.md +52 -97
  328. package/skills/scip-query/agents/openai.yaml +2 -2
  329. package/skills/scip-setup/SKILL.md +65 -176
  330. package/skills/scip-setup/agents/openai.yaml +3 -3
  331. package/skills/scip-setup/references/bootstrap-workflow.md +120 -0
  332. package/skills/scip-setup/references/language-verification.md +61 -0
  333. package/skills/scip-setup/references/lifecycle-commands.md +119 -0
  334. package/skills/scip-setup/references/per-repo-triage.md +24 -0
  335. package/skills/scip-verify/SKILL.md +123 -70
  336. package/skills/scip-verify/agents/openai.yaml +2 -2
  337. package/skills/scip-verify/references/calibrate-detectors.md +170 -0
  338. package/dist/chunk-2CTX5CMX.js +0 -4
  339. package/dist/chunk-2Y373BDD.js +0 -2
  340. package/dist/chunk-C2QSK7E7.js +0 -2
  341. package/dist/chunk-D4U5Q3FT.js +0 -7
  342. package/dist/chunk-K2ERX4UT.js +0 -3
  343. package/dist/chunk-KHE7J5ZN.js +0 -3
  344. package/dist/chunk-L7SPDE73.js +0 -84
  345. package/dist/chunk-LHMNRHGV.js +0 -3
  346. package/dist/chunk-LM72NQ7T.js +0 -3
  347. package/dist/chunk-MSWVMDAH.js +0 -122
  348. package/dist/chunk-NH7WNNQC.js +0 -20
  349. package/dist/chunk-OMPZHGHO.js +0 -2
  350. package/dist/chunk-SVLTAG5O.js +0 -927
  351. package/dist/chunk-U7DSEKOM.js +0 -30
  352. package/dist/chunk-V27BEQJN.js +0 -7
  353. package/dist/chunk-VMNZB6WI.js +0 -4
  354. package/dist/chunk-XBN5VO53.js +0 -2
  355. package/dist/chunk-ZAIILQNP.js +0 -5
  356. package/dist/command-descriptors-MFU4BCJ7.js +0 -612
  357. package/dist/direct-navigation-MRMQFIRB.js +0 -3
  358. package/skills/scip-api-impact/SKILL.md +0 -139
  359. package/skills/scip-api-impact/agents/openai.yaml +0 -4
  360. package/skills/scip-calibrate/SKILL.md +0 -131
  361. package/skills/scip-calibrate/agents/openai.yaml +0 -4
  362. package/skills/scip-claim-audit/SKILL.md +0 -106
  363. package/skills/scip-claim-audit/agents/openai.yaml +0 -4
  364. package/skills/scip-cleanup-audit/SKILL.md +0 -126
  365. package/skills/scip-cleanup-audit/agents/openai.yaml +0 -4
  366. package/skills/scip-cleanup-improve/SKILL.md +0 -84
  367. package/skills/scip-cleanup-improve/agents/openai.yaml +0 -4
  368. package/skills/scip-concrete-plan/SKILL.md +0 -262
  369. package/skills/scip-concrete-plan/agents/openai.yaml +0 -4
  370. package/skills/scip-conductor/SKILL.md +0 -133
  371. package/skills/scip-conductor/agents/openai.yaml +0 -4
  372. package/skills/scip-debug/SKILL.md +0 -130
  373. package/skills/scip-debug/agents/openai.yaml +0 -4
  374. package/skills/scip-diagram/SKILL.md +0 -110
  375. package/skills/scip-diagram/agents/openai.yaml +0 -4
  376. package/skills/scip-directory-architecture/SKILL.md +0 -254
  377. package/skills/scip-directory-architecture/agents/openai.yaml +0 -4
  378. package/skills/scip-doc-reconcile/SKILL.md +0 -89
  379. package/skills/scip-doc-reconcile/agents/openai.yaml +0 -4
  380. package/skills/scip-hyper-optimization/SKILL.md +0 -156
  381. package/skills/scip-hyper-optimization/agents/openai.yaml +0 -4
  382. package/skills/scip-integrity-audit/SKILL.md +0 -152
  383. package/skills/scip-integrity-audit/agents/openai.yaml +0 -4
  384. package/skills/scip-language-playbook/SKILL.md +0 -106
  385. package/skills/scip-language-playbook/agents/openai.yaml +0 -4
  386. package/skills/scip-maintainability/SKILL.md +0 -158
  387. package/skills/scip-maintainability/agents/openai.yaml +0 -4
  388. package/skills/scip-probe-reachability/agents/openai.yaml +0 -4
  389. package/skills/scip-react-maintainability/SKILL.md +0 -101
  390. package/skills/scip-react-maintainability/agents/openai.yaml +0 -4
  391. package/skills/scip-root-cause/SKILL.md +0 -150
  392. package/skills/scip-root-cause/agents/openai.yaml +0 -4
  393. package/skills/scip-tla-model-system/SKILL.md +0 -148
  394. package/skills/scip-tla-model-system/agents/openai.yaml +0 -4
  395. package/skills/scip-triage-issue/SKILL.md +0 -126
  396. package/skills/scip-triage-issue/agents/openai.yaml +0 -4
  397. package/skills/scip-twin-drift/SKILL.md +0 -107
  398. package/skills/scip-twin-drift/agents/openai.yaml +0 -4
  399. package/skills/scip-vue-maintainability/SKILL.md +0 -107
  400. package/skills/scip-vue-maintainability/agents/openai.yaml +0 -4
@@ -0,0 +1,30 @@
1
+ import{a as Q}from"./chunk-P5XHIJHI.js";import{B as at,D as ct,E as rn,F as Ee,G as ee,H as ut,I as ft,J as Pe,K as pt,M as on,O as sn,P as an,l as it,r as ot,s as fe,v as H,w as Te,x as Z,y as X,z as we}from"./chunk-GA64UPMI.js";import{d as xe,e as st,f as Ce,g as ke,h as q,q as lt}from"./chunk-A63U2W3P.js";import{b as tt,e as K,f as De,h as rt,j as ue,s as W,t as ve}from"./chunk-ZTTISZ7J.js";import{a as le,f as Me,n as et,p as nt}from"./chunk-7LABSJSR.js";import{B as Zn,E as Xn,e as Jn,f as Gn,s as en}from"./chunk-DGMCFMPG.js";import{A as Qn,B as w,D as Ie,E as nn,F as tn,G as ce,j as Kn,l as Hn,m as $n,p as Ze,r as Xe,t as Vn,v as Yn,z as _}from"./chunk-B5MHCHP3.js";import{a as he}from"./chunk-64MNV6AB.js";import{a as ae,c as O}from"./chunk-35SQLYCQ.js";function dt(n){let e=new Map,t=Or(n),r=new Map;return i=>{let o=Lr(i),s=r.get(o);if(s!==void 0)return s;if(!t.has(i.file))return r.set(o,i.symbol),i.symbol;let a=e.get(i.file);a||(a=Ur(W(n,i.file)),e.set(i.file,a));let c=qr(a,i);return r.set(o,c),c}}function Lr(n){return`${n.file}\0${n.symbol}\0${n.line}`}function Or(n){return new Set(n.all("SELECT relative_path FROM documents").map(e=>e.relative_path))}function Ur(n){let e=new Map,t=new Map;for(let r of n){let i=e.get(r.leaf);i?i.push(r):e.set(r.leaf,[r]);let o=t.get(r.startLine);o?o.push(r):t.set(r.startLine,[r])}return{definitions:n,byLeaf:e,byStartLine:t}}function qr(n,e){if(n.definitions.length===0)return e.symbol;let t=Wr(e.symbol),r=Br(n.byLeaf,t),i=jr(r,e.line);if(i)return i.symbol;let o=n.byStartLine.get(e.line)??[];return o.length===1?o[0].symbol:e.symbol}function Br(n,e){let t=[],r=new Set;for(let i of e)for(let o of n.get(i)??[])r.has(o.symbolId)||(r.add(o.symbolId),t.push(o));return t}function jr(n,e){let t=null;for(let r of n)if(!(r.startLine>e||r.endLine<e)){if(r.startLine===e)return r;(!t||r.endLine-r.startLine<t.endLine-t.startLine)&&(t=r)}return t}function Wr(n){let e=new Set([n]),r=n.split(/::|\.|#/).filter(Boolean).at(-1);return r&&e.add(r),e}function mt(n,e){let r=nt(n,e).map(i=>Kr(e,i));return{usage:r,positions:Hr(n,e,r)}}function yt(n,e){return{importUsage(t){let r=n.importUsageFacts(t);if(!e||r.positions.length===0)return r.usage;let i=e.importDefinitionsForFile(t,r.positions);return i.available?zr(r.usage,i.sourcePaths):r.usage}}}function zr(n,e){return n.map((t,r)=>{let i=e.get(String(r));return i?{...t,sourcePath:i}:t})}function Kr(n,e){let t=e.isTypeOnly===!0,r=e.kind==="side-effect"||t||e.used;return{importer:n,sourcePath:e.sourcePath,importedName:e.importedName,localName:e.localName,kind:e.kind,isTypeOnly:t,isUsed:r,isTypeUsed:t,isValueUsed:e.kind==="side-effect"||!t&&e.used,references:[]}}function Hr(n,e,t){let r=Xn(n,e);if(!r)return[];let i=$r(r.rootNode),o=new Map;for(let a of i){let c=o.get(ln(a.importedName,a.localName));c?c.push(a.position):o.set(ln(a.importedName,a.localName),[a.position])}let s=[];return t.forEach((a,c)=>{let u=o.get(ln(a.importedName,a.localName??a.importedName))?.shift();u&&s.push({...u,id:String(c),file:e})}),s}function $r(n){let e=[];for(let t of n.descendantsOfType("use_declaration")){let r=t.namedChildren.find(i=>i.type!=="visibility_modifier");r&&e.push(...Fe(r,""))}return e.filter(t=>t.importedName!=="*")}function Fe(n,e){switch(n.type){case"identifier":case"super":case"self":case"crate":return[{importedName:n.text,localName:n.text,position:cn(n,n.text)}];case"scoped_identifier":{let t=n.text.split("::").pop()??n.text;return[{importedName:t,localName:t,position:cn(n,t)}]}case"scoped_use_list":{let t=n.namedChild(0),r=n.namedChild(1);if(!t||!r)return[];let i=et(e,t.text);return r.namedChildren.flatMap(o=>Fe(o,i))}case"use_list":return n.namedChildren.flatMap(t=>Fe(t,e));case"use_as_clause":{let t=n.namedChild(0),r=n.namedChild(1);return!t||!r?[]:Fe(t,e).map(i=>({...i,localName:r.text}))}case"use_wildcard":{let t=n.namedChild(0),r="*";return[{importedName:r,localName:r,position:cn(t??n,r)}]}default:return[]}}function cn(n,e){let t=Math.max(0,n.text.lastIndexOf(e));return{id:"",file:"",line:n.startPosition.row,column:n.startPosition.column+t+Vr(e)}}function Vr(n){return Math.max(0,Math.min(n.length-1,1))}function ln(n,e){return`${n}\0${e}`}import{spawnSync as hn}from"child_process";import{existsSync as In}from"fs";import{fileURLToPath as Ki}from"url";function Ae(n){let e=ot(it,n),t=e.runnable;return{available:t,dependencyAvailable:t,resolvedBinary:e.resolvedBinary??void 0,reason:t?"rust-analyzer semantic reference queries are enabled.":"rust-analyzer is not runnable; Rust semantic checks will use SCIP/source evidence only."}}import{existsSync as ki,mkdtempSync as Ot,readFileSync as Ut,rmSync as yn}from"fs";import{tmpdir as qt}from"os";import{join as Sn}from"path";import{fileURLToPath as We,pathToFileURL as Ti}from"url";import{SHARE_ENV as wi,Worker as Ei}from"worker_threads";function z(n,e,t=new Set){let r=new Map;for(let i of n)t.has(i.symbolId)||r.set(i.symbolId,e.get(i.symbolId)??[]);return r}function $(n,e,t){let r=Q(process.env.SCIP_RUST_SEMANTIC_BATCH_TIMEOUT_MS)??0;if(r>0)return r;let i=Math.max(1,Math.ceil(n/Math.max(1,t)));return Math.max(12e4,3e4+i*e)}import{spawn as di}from"child_process";import{createHash as mi,randomUUID as yi}from"crypto";import{existsSync as Et,readFileSync as qe,realpathSync as Si,rmSync as gi}from"fs";import{tmpdir as Ri}from"os";import{resolve as te}from"path";import{execFileSync as ti}from"child_process";import{existsSync as Yr,readFileSync as Jr}from"fs";import{deserializeSCIP as Gr,SymbolRole as Qr}from"@c4312/scip";import{existsSync as ks,readFileSync as Ts}from"fs";import{relative as Es,resolve as Ps,sep as Fs}from"path";import{fileURLToPath as Ns,pathToFileURL as _s}from"url";function Ne(n){let e=new Map;for(let t of n)e.set(`${t.file}\0${t.line}\0${t.column}`,t);return[...e.values()].sort((t,r)=>{let i=t.file.localeCompare(r.file);return i!==0?i:t.line!==r.line?t.line-r.line:t.column-r.column})}var un=new WeakMap,Zr="SCIP_RUST_SCIP_OCCURRENCE_REFERENCE_MODE";function St(n,e){let t=new Map,r=_e(),i=e.filter(s=>bt(s,r));if(i.length===0)return t;let o=ht(n);if(!o)return t;for(let s of i){let a=Rt(o,s);a!==null&&t.set(s.symbolId,a)}return t}function gt(n,e){if(!bt(e,_e()))return null;let t=ht(n);return t?Rt(t,e):null}function Rt(n,e){return n.referencesBySymbol.get(e.symbol)??[]}function bt(n,e="safe"){if(!n.symbol.startsWith("rust-analyzer ")||!n.relativePath.endsWith(".rs")||ue(n.symbol)||/impl#\[[^\]]+\]\[Default\]default\(\)\.$/.test(n.symbol))return!1;if(e==="all")return!0;let t=De(n.symbol);if(t==="method")return!0;if(t!=="term")return!1;let r=tt(n.symbol);return"kind"in r?!1:!Xr(r)}function Xr(n){for(let e=0;e<n.descriptors.length-1;e+=1)if(n.descriptors[e]?.suffix==="type")return!0;return!1}function ht(n){if(un.has(n))return un.get(n)??null;let e=ei(n);return un.set(n,e),e}function ei(n){if(!n.generation.indexPath||!Yr(n.generation.indexPath))return null;try{let e=Gr(Jr(n.generation.indexPath)),t=new Map;for(let r of e.documents??[]){let i=r.relativePath;if(!(!i||n.isIgnored(i)))for(let o of r.occurrences??[]){if(!o.symbol||(o.symbolRoles&Qr.Definition)!==0)continue;let s=ni(i,o.range);if(!s)continue;let a=t.get(o.symbol)??[];a.push(s),t.set(o.symbol,a)}}for(let[r,i]of t)t.set(r,Ne(i));return{referencesBySymbol:t}}catch{return null}}function ni(n,e){if(e.length<3)return null;let t=e[0],r=e[1];return!Number.isInteger(t)||!Number.isInteger(r)?null:{file:n,line:t,column:r}}function _e(){return process.env[Zr]==="all"?"all":"safe"}var It=new Map;function fn(n){let t=Ae(n).resolvedBinary??null;return{engine:"rust-analyzer",resolvedBinary:t,version:t?ri(n,t):"unavailable"}}function pn(n){return{...fn(n),scipOccurrenceReferenceMode:_e()}}function ri(n,e){let t=`${n}\0${e}`,r=It.get(t);if(r)return r;let i;try{i=ti(e,["--version"],{cwd:n,encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:2e3}).trim()}catch{i="unknown"}return It.set(t,i),i}import{createHash as ii}from"crypto";var oi=new Set(["Cargo.lock","Cargo.toml","rust-project.json","rust-toolchain","rust-toolchain.toml"]);function Mt(n){let e=at(n,{includePath:si});return ii("sha256").update(JSON.stringify(e)).digest("hex")}function si(n){let e=n.replaceAll("\\","/"),t=e.split("/").at(-1)??e;return e.endsWith(".rs")||oi.has(t)?!0:e===".cargo/config"||e===".cargo/config.toml"||e.endsWith("/.cargo/config")||e.endsWith("/.cargo/config.toml")}import{createHash as ai}from"crypto";import{resolve as ci}from"path";var ne=3;function mn(n){return ai("sha256").update(fe({kind:"scip-query-durable-rust-mailbox",protocolVersion:ne,sessionDir:ci(n)})).digest("hex")}function xt(n,e){return ae(n)?n.protocolVersion!==ne?vt(n.protocolVersion===void 0?"helper wrote a prior uncorrelated response protocol":`helper wrote unsupported response protocol ${String(n.protocolVersion)}`):n.mailboxVersion!==H||n.id!==e.requestId||n.operationKey!==e.operationKey||n.sessionIdentity!==e.sessionIdentity||n.deadlineAtMs!==e.deadlineAtMs?vt("helper wrote an incompatible response identity"):typeof n.completedAtMs!="number"||!Number.isFinite(n.completedAtMs)||n.completedAtMs>e.deadlineAtMs||e.nowMs>e.deadlineAtMs?{ok:!1,code:"expired-request",error:"helper response arrived after the durable request deadline"}:n.ok===!1?typeof n.error!="string"||!pi(n.errorCode)?dn("helper wrote an invalid rejection response"):{ok:!1,code:n.errorCode,error:n.error}:n.ok!==!0||n.session!=="created"&&n.session!=="reused"&&n.session!=="invalidated"||!li(n.response,e.requestKind)?dn("helper wrote an invalid success response"):{ok:!0,session:n.session,response:n.response}:dn("helper wrote an invalid response object")}function li(n,e){return!ae(n)||typeof n.available!="boolean"||n.reason!==void 0&&typeof n.reason!="string"?!1:e==="import-definitions"?Array.isArray(n.sourcePaths)&&n.sourcePaths.every(t=>Array.isArray(t)&&t.length===2&&typeof t[0]=="string"&&(t[1]===null||typeof t[1]=="string")):Dt(n.references,ui)&&(n.incompleteReferenceSymbolIds===void 0||Array.isArray(n.incompleteReferenceSymbolIds)&&n.incompleteReferenceSymbolIds.every(t=>Number.isSafeInteger(t)))&&(n.callees===void 0||Dt(n.callees,fi))&&(n.signatures===void 0||Array.isArray(n.signatures)&&n.signatures.every(t=>Array.isArray(t)&&t.length===2&&Number.isSafeInteger(t[0])&&(t[1]===null||typeof t[1]=="string")))}function Dt(n,e){return Array.isArray(n)&&n.every(t=>Array.isArray(t)&&t.length===2&&Number.isSafeInteger(t[0])&&Array.isArray(t[1])&&t[1].every(e))}function ui(n){return ae(n)&&typeof n.file=="string"&&O(n.line)&&O(n.column)}function fi(n){return ae(n)&&typeof n.symbol=="string"&&typeof n.file=="string"&&O(n.line)}function pi(n){return n==="unsupported-protocol"||n==="malformed-request"||n==="expired-request"||n==="handler-error"}function dn(n){return{ok:!1,code:"malformed-response",error:n}}function vt(n){return{ok:!1,code:"incompatible-response",error:n}}var bi=5e3,Pt=10,hi=3e4;function Ct(n,e,t,r=Lt){let i=r.engineIdentity(n),o={protocolVersion:ne,projectRoot:r.canonicalProjectRoot(n),projectFingerprint:r.projectFingerprint(n),engine:{engine:i.engine,resolvedBinary:i.resolvedBinary,version:i.version},workerFingerprint:r.fileFingerprint(e),environment:At(r.environment())};return{key:Ue(fe(o)),...o}}function Le(n,e,t,r){if(n.protocolVersion!==ne||!t(n.pid))return!1;if(!n.processIdentity)return!0;let i=r?.(n.pid);return i!=null&&Ce(n.processIdentity,i)}function Ft(n,e,t){let r;try{r=Ue(qe(e))}catch{r="missing"}let i=Ue(fe({projectRoot:te(n),serverPath:te(e),serverFingerprint:r})).slice(0,20);return te(t,`scip-query-rust-session-${i}`)}function kt(n){let e=n===void 0?Number.NaN:Number(n);return Number.isInteger(e)&&e>=0?e:0}function At(n){return Object.fromEntries(Object.entries(n).filter(([e])=>_t(e)).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>[e,t??null]))}function Nt(n,e){let t=e.runtime??Ci,r=e.identityRuntime??Lt,i=Ft(n,e.serverPath,e.tempRoot??Ri()),o=!1,s=(a,c)=>{if(o)throw new Error("Durable Rust semantic session was already disposed.");return Mi(i,e.serverPath,e.semanticWorkerPath,a,c,t,e.mailboxLimits)};return{requestSemantic(a,c){let u=Ct(n,e.semanticWorkerPath,a,r),{readinessDeadlineMs:f,...l}=a;return s({kind:"semantic",identityKey:u.key,workerEnvironment:wt(),request:{...l,referenceRetryTimeoutMs:Ii(process.env.SCIP_RUST_SEMANTIC_REFERENCE_RETRY_TIMEOUT_MS,a.referenceRetryTimeoutMs),settleDelayMs:process.env.SCIP_RUST_SEMANTIC_SETTLE_MS===void 0?a.settleDelayMs:kt(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS)},timeoutMs:c},c)},requestImportDefinitions(a,c){let u=Ct(n,e.semanticWorkerPath,a,r),{readinessDeadlineMs:f,...l}=a;return s({kind:"import-definitions",identityKey:u.key,workerEnvironment:wt(),request:{...l,settleDelayMs:process.env.SCIP_RUST_SEMANTIC_SETTLE_MS===void 0?a.settleDelayMs:kt(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS)},timeoutMs:c},c)},shutdown(){o=!0}}}function Ii(n,e){return e!==void 0?e:n===void 0?hi:void 0}function Mi(n,e,t,r,i,o,s={}){let a=o.now(),c=a+i,u=(o.monotonicNow??q)(),f=u+i,l=Z("rust-semantic-v3",r),p=X(l),d=Te(n),S=mn(n),h=we(d,{mailboxVersion:H,protocolVersion:ne,id:p,operationKey:l,clientId:o.randomId(),enqueuedAtMs:a,deadlineAtMs:c,sessionIdentity:S,request:r},{nowMs:a,limits:s});for(Tt(n,e,t,f,o);(o.monotonicNow??q)()<=f;){if(Et(h.responsePath)){let y=Di(qe(h.responsePath,"utf8"),{requestId:p,operationKey:l,sessionIdentity:S,deadlineAtMs:h.authoritativeDeadlineAtMs,requestKind:r.kind,nowMs:o.now()});if(!y.ok)throw new Error(y.error);return _()&&Ie({type:"span",name:"rust.semantic.durable-session.request",durationMs:(o.monotonicNow??q)()-u,ok:!0,session:y.session,kind:r.kind}),y.response}let g=Oe(n);(!g||!Le(g,o.now(),o.isProcessAlive,o.readProcessIdentity))&&Tt(n,e,t,f,o),o.sleep(Pt)}throw new Error(`Durable Rust semantic session timed out after ${(i/1e3).toFixed(0)}s.`)}function Tt(n,e,t,r,i){let o=Oe(n);if(o&&Le(o,i.now(),i.isProcessAlive,i.readProcessIdentity))return;gi(te(n,"server.json"),{force:!0}),i.spawnServer(e,n,t);let s=i.monotonicNow??q,a=Math.min(r,s()+bi);for(;s()<=a;){let c=Oe(n);if(c&&Le(c,i.now(),i.isProcessAlive,i.readProcessIdentity))return;i.sleep(Pt)}throw new Error("Durable Rust semantic session helper did not become ready within 5s.")}function Oe(n){try{let e=JSON.parse(qe(te(n,"server.json"),"utf8"));if(typeof e.protocolVersion!="number"||e.sessionIdentity!==void 0&&(typeof e.sessionIdentity!="string"||e.sessionIdentity!==mn(n))||typeof e.pid!="number"||typeof e.heartbeatAtMs!="number"||e.busyUntilMs!==void 0&&typeof e.busyUntilMs!="number"||e.mailbox!==void 0&&!vi(e.mailbox))return null;let t=e.processIdentity===void 0?null:st(e.processIdentity);return e.processIdentity!==void 0&&(!t||t.pid!==e.pid)?null:{protocolVersion:e.protocolVersion,...e.sessionIdentity===void 0?{}:{sessionIdentity:e.sessionIdentity},pid:e.pid,...t?{processIdentity:t}:{},heartbeatAtMs:e.heartbeatAtMs,...e.busyUntilMs===void 0?{}:{busyUntilMs:e.busyUntilMs},...e.mailbox===void 0?{}:{mailbox:e.mailbox}}}catch{return null}}function Di(n,e){try{return xt(JSON.parse(n),e)}catch(t){return{ok:!1,code:"malformed-response",error:`helper wrote malformed JSON: ${t instanceof Error?t.message:String(t)}`}}}function vi(n){if(!n||typeof n!="object")return!1;let e=n;return O(e.pending)&&O(e.inflight)&&O(e.responses)&&O(e.deadLetters)&&O(e.invalid)&&O(e.totalItems)&&typeof e.totalBytes=="number"&&Number.isFinite(e.totalBytes)&&e.totalBytes>=0&&(e.oldestPendingAt===void 0||Number.isFinite(Date.parse(e.oldestPendingAt)))}function wt(){return Object.fromEntries(Object.entries(process.env).filter(([n])=>xi(n)).sort(([n],[e])=>n.localeCompare(e)).map(([n,e])=>[n,e??null]))}function _t(n){return n==="HOME"||n==="PATH"||n.startsWith("CARGO_")||n.startsWith("RA_")||n.startsWith("RUST")}function xi(n){return _t(n)||n.startsWith("SCIP_RUST_")||n==="SCIP_QUERY_PROFILE"||n==="SCIP_QUERY_PROFILE_CACHE_STATE"||n==="SCIP_QUERY_PROFILE_COMMAND"||n==="SCIP_QUERY_PROFILE_OUT"||n==="SCIP_QUERY_PROFILE_RUN_ID"||n==="SCIP_QUERY_PROFILE_WORKLOAD_IDENTITY"||n==="SCIP_QUERY_PROFILE_WORKLOAD_IDENTITY_KIND"||n==="SCIP_QUERY_PROFILE_MIN_MS"}var Lt={canonicalProjectRoot(n){try{return Si(n)}catch{return te(n)}},projectFingerprint(n){return Mt(n)},engineIdentity:fn,fileFingerprint(n){return Ue(qe(n))},environment(){return At(process.env)}},Ci={now:Date.now,monotonicNow:q,randomId:yi,isProcessAlive:xe,readProcessIdentity:ke,spawnServer(n,e,t){if(!Et(n))throw new Error(`Durable Rust semantic session helper was not found at ${n}. Run npm run build first.`);di(process.execPath,[n,e,t],{detached:!0,stdio:"ignore"}).unref()},sleep(n){let e=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(e,0,0,n)}};function Ue(n){return mi("sha256").update(n).digest("hex")}var Bt=15e3,jt=8,zt=5e3,Pi=64,Fi=96,Rn=class{constructor(e,t,r={}){this.projectRoot=e;this.status=t;this.opts=r;this.requester=r.requester??Li(e,process.env.SCIP_RUST_SEMANTIC_DURABLE_SESSION)}projectRoot;status;opts;requester;referencesForDefinitions(e){let t=this.status(this.projectRoot);if(!t.available||!t.resolvedBinary)return{available:!1,resolvedBinary:t.resolvedBinary,reason:t.reason,references:pe(e)};try{let r=this.requestSession(t.resolvedBinary,e,{includeReferences:!0});return{available:r.available,resolvedBinary:t.resolvedBinary,reason:r.reason,references:z(e,new Map(r.references),new Set(r.incompleteReferenceSymbolIds??[]))}}catch(r){return this.opts.fallbackReferenceResolver?.referencesForDefinitions(e)??{available:!1,resolvedBinary:t.resolvedBinary,reason:r instanceof Error?r.message:String(r),references:pe(e)}}}calleesForDefinitions(e){let t=this.status(this.projectRoot);if(!t.available||!t.resolvedBinary)return{available:!1,resolvedBinary:t.resolvedBinary,reason:t.reason,callees:de(e)};try{let r=this.requestSession(t.resolvedBinary,e,{includeReferences:!1,includeCallees:!0});return{available:r.available,resolvedBinary:t.resolvedBinary,reason:r.reason,callees:gn(e,new Map(r.callees??[]))}}catch(r){return this.opts.fallbackCalleeResolver?.calleesForDefinitions(e)??{available:!1,resolvedBinary:t.resolvedBinary,reason:r instanceof Error?r.message:String(r),callees:de(e)}}}referencesAndCalleesForDefinitions(e,t){let r=this.status(this.projectRoot);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:r.reason,references:pe(e),callees:de(t)};let i=[...e,...t];try{let o=this.requestSession(r.resolvedBinary,i,{includeReferences:e.length>0,includeCallees:t.length>0,referenceDefinitions:e,calleeDefinitions:t});return{available:o.available,resolvedBinary:r.resolvedBinary,reason:o.reason,references:z(e,new Map(o.references),new Set(o.incompleteReferenceSymbolIds??[])),callees:gn(t,new Map(o.callees??[]))}}catch(o){return this.fallbackReferencesAndCallees(r,e,t,o)}}signaturesForDefinitions(e){let t=this.status(this.projectRoot);if(!t.available||!t.resolvedBinary)return{available:!1,resolvedBinary:t.resolvedBinary,reason:t.reason,signatures:Wt(e)};try{let r=this.requestSession(t.resolvedBinary,e,{includeReferences:!1,includeCallees:!1,includeSignatures:!0});return{available:r.available,resolvedBinary:t.resolvedBinary,reason:r.reason,signatures:ji(e,new Map(r.signatures??[]))}}catch(r){return this.opts.fallbackSignatureResolver?.signaturesForDefinitions(e)??{available:!1,resolvedBinary:t.resolvedBinary,reason:r instanceof Error?r.message:String(r),signatures:Wt(e)}}}importDefinitionsForFile(e,t){let r=this.status(this.projectRoot);if(t.length===0)return{available:r.available,resolvedBinary:r.resolvedBinary,reason:r.reason,sourcePaths:new Map};if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:r.reason,sourcePaths:new Map(t.map(i=>[i.id,null]))};try{let i=this.requestImportDefinitions(r.resolvedBinary,e,t);return{available:i.available,resolvedBinary:r.resolvedBinary,reason:i.reason,sourcePaths:new Map(i.sourcePaths)}}catch(i){return{available:!1,resolvedBinary:r.resolvedBinary,reason:i instanceof Error?i.message:String(i),sourcePaths:new Map(t.map(o=>[o.id,null]))}}}dispose(){this.requester.shutdown()}requestSession(e,t,r){let i=Be(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,Bt),o=je(process.env.SCIP_RUST_SEMANTIC_REFERENCE_RETRY_TIMEOUT_MS,0),s=Be(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,jt),a=je(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(i,1e4)),c=r.referenceDefinitions?[...r.referenceDefinitions]:void 0,u=r.calleeDefinitions?[...r.calleeDefinitions]:void 0,f=r.signatureDefinitions?[...r.signatureDefinitions]:void 0,l=me(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:t.length,...r}),p={projectRoot:this.projectRoot,rustAnalyzerBinary:e,definitions:[...t],...c?{referenceDefinitions:c}:{},...u?{calleeDefinitions:u}:{},...f?{signatureDefinitions:f}:{},requestTimeoutMs:i,...r.includeReferences!==!1&&o>0?{referenceRetryTimeoutMs:o}:{},diagnosticsTimeoutMs:a,settleDelayMs:l,concurrency:s,includeReferences:r.includeReferences,includeCallees:r.includeCallees,includeSignatures:r.includeSignatures},d=Wi(p);return w("rust.semantic.session.request",()=>this.requester.requestSemantic(p,$(d,bn(i,p.referenceRetryTimeoutMs),s)),()=>({definitions:t.length,operationDefinitions:d,referenceDefinitions:p.referenceDefinitions?.length,calleeDefinitions:p.calleeDefinitions?.length,signatureDefinitions:p.signatureDefinitions?.length,references:p.includeReferences!==!1,callees:p.includeCallees===!0,signatures:p.includeSignatures===!0,referenceRetryTimeoutMs:p.referenceRetryTimeoutMs}))}fallbackReferencesAndCallees(e,t,r,i){let o=t.length===0?{available:!0,references:pe(t)}:this.opts.fallbackReferenceResolver?.referencesForDefinitions(t),s=r.length===0?{available:!0,callees:de(r)}:this.opts.fallbackCalleeResolver?.calleesForDefinitions(r);return o&&s?{available:o.available&&s.available,resolvedBinary:o.resolvedBinary??s.resolvedBinary??e.resolvedBinary,reason:o.reason??s.reason,references:z(t,o.references),callees:gn(r,s.callees)}:{available:!1,resolvedBinary:e.resolvedBinary,reason:i instanceof Error?i.message:String(i),references:pe(t),callees:de(r)}}requestImportDefinitions(e,t,r){let i=Be(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,Bt),o=Be(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,jt),s=je(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(i,1e4)),a=je(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,zt),c={projectRoot:this.projectRoot,rustAnalyzerBinary:e,file:t,positions:[...r],requestTimeoutMs:i,diagnosticsTimeoutMs:s,settleDelayMs:a,concurrency:o};return w("rust.semantic.import-definitions.session.request",()=>this.requester.requestImportDefinitions(c,$(r.length,i,o)),()=>({file:t,positions:r.length}))}};function Kt(n,e,t={}){return new Rn(n,e,t)}function me(n,e){let t=$t(n);if(t!==null)return t;let r=e.includeReferences!==!1;return r&&e.includeCallees!==!0&&e.includeSignatures!==!0&&e.definitionCount<=Pi||r&&e.includeCallees===!0&&e.includeSignatures!==!0&&e.definitionCount<=Fi?0:zt}function Ai(n){let e=n?.trim().toLowerCase(),t=e==="0"||e==="false"||e==="off"||e==="worker",r=e==="1"||e==="true"||e==="on"||e==="durable",i=e===void 0||e==="";return{transport:t||!i&&!r?"worker":"durable",source:i?"default":"environment",fallback:"worker",valid:i||t||r,optOut:"SCIP_RUST_SEMANTIC_DURABLE_SESSION=0"}}function Ni(n){return Ai(n).transport}function _i(n,e){let t=null,r=!1,i=!1,o=!1,s=()=>t??=e(),a=()=>{i||(n.shutdown(),i=!0)},c=(f,l,p)=>{let d=Bi(f);r=!0;try{a()}catch{}_()&&Ie({type:"span",name:"rust.semantic.durable-session.request",durationMs:p,ok:!1,kind:l,session:"worker-fallback",reason:d})},u=(f,l,p)=>{if(o)throw new Error("Rust semantic failover session was already disposed.");if(r)return p(s());let d=performance.now();try{return l(n)}catch(S){c(S,f,performance.now()-d)}return p(s())};return{requestSemantic(f,l){return u("semantic",p=>p.requestSemantic(f,l),p=>p.requestSemantic(f,l))},requestImportDefinitions(f,l){return u("import-definitions",p=>p.requestImportDefinitions(f,l),p=>p.requestImportDefinitions(f,l))},shutdown(){if(o)return;o=!0;let f=[];try{a()}catch(l){f.push(l)}try{t?.shutdown()}catch(l){f.push(l)}if(f.length>0)throw f[0]}}}function Li(n,e,t={worker:()=>Oi(),durable:()=>Nt(n,{serverPath:We(zi()),semanticWorkerPath:We(Ht())})}){return Ni(e)==="durable"?_i(t.durable(),t.worker):t.worker()}function Oi(n={}){let e=null,t=null,r=1,i=!1,o=()=>{t&&(yn(t,{recursive:!0,force:!0}),t=null)},s=()=>{let u=e;e=null,u&&u.terminate(),o()},a=()=>{if(e)return e;let u=n.semanticWorkerPath?Ti(n.semanticWorkerPath):Ht();if(!ki(We(u)))throw new Error(`Rust semantic session worker was not found at ${We(u)}. Run npm run build before using built semantic Rust queries.`);return t=Ot(Sn(qt(),"scip-query-rust-session-")),e=new Ei(u,n.shareEnvironment?{env:wi}:void 0),e.unref(),e},c=()=>{let u=t??Ot(Sn(qt(),"scip-query-rust-session-"));return t=u,Sn(u,`${r++}.json`)};return{requestSemantic(u,f){if(i)throw new Error("Rust semantic session was already disposed.");let l=a(),p=c(),d=new SharedArrayBuffer(4),S=new Int32Array(d);if(l.postMessage({kind:"semantic",request:u,responsePath:p,sharedBuffer:d}),Atomics.wait(S,0,0,f)==="timed-out")throw s(),new Error(`Rust semantic session worker timed out after ${(f/1e3).toFixed(0)}s`);try{let g=Ui(Ut(p,"utf8"));if(!g.ok)throw new Error(g.error);return g.response}finally{yn(p,{force:!0})}},requestImportDefinitions(u,f){if(i)throw new Error("Rust semantic session was already disposed.");let l=a(),p=c(),d=new SharedArrayBuffer(4),S=new Int32Array(d);if(l.postMessage({kind:"import-definitions",request:u,responsePath:p,sharedBuffer:d}),Atomics.wait(S,0,0,f)==="timed-out")throw s(),new Error(`Rust semantic import-definition session worker timed out after ${(f/1e3).toFixed(0)}s`);try{let g=qi(Ut(p,"utf8"));if(!g.ok)throw new Error(g.error);return g.response}finally{yn(p,{force:!0})}},shutdown(){if(i)return;if(i=!0,!e){o();return}let u=c(),f=new SharedArrayBuffer(4),l=new Int32Array(f);e.postMessage({kind:"shutdown",responsePath:u,sharedBuffer:f}),Atomics.wait(l,0,0,5e3),s()}}}function Ui(n){let e=JSON.parse(n);if(!e||typeof e!="object")return{ok:!1,error:"Rust semantic session worker wrote a non-object response."};let t=e;return t.ok===!0&&"response"in t?{ok:!0,response:t.response}:{ok:!1,error:typeof e.error=="string"?e.error:"Rust semantic session worker failed."}}function qi(n){let e=JSON.parse(n);if(!e||typeof e!="object")return{ok:!1,error:"Rust semantic session worker wrote a non-object response."};let t=e;return t.ok===!0&&"response"in t?{ok:!0,response:t.response}:{ok:!1,error:typeof e.error=="string"?e.error:"Rust semantic session worker failed."}}function Bi(n){let e=n instanceof Error?`${n.name} ${n.message}`.toLowerCase():String(n).toLowerCase();return e.includes("readiness")?"readiness":e.includes("timeout")||e.includes("timed out")?"timeout":e.includes("helper")?"helper":"request"}function pe(n){return new Map(n.map(e=>[e.symbolId,[]]))}function de(n){return new Map(n.map(e=>[e.symbolId,[]]))}function Wt(n){return new Map(n.map(e=>[e.symbolId,null]))}function gn(n,e){return new Map(n.map(t=>[t.symbolId,e.get(t.symbolId)??[]]))}function ji(n,e){return new Map(n.map(t=>[t.symbolId,e.get(t.symbolId)??null]))}function Wi(n){let e=0;return n.includeReferences!==!1&&(e+=(n.referenceDefinitions??n.definitions).length),n.includeCallees===!0&&(e+=(n.calleeDefinitions??n.definitions).length),n.includeSignatures===!0&&(e+=(n.signatureDefinitions??n.definitions).length),Math.max(1,e)}function bn(n,e){return e&&e>0?Math.max(n,e):n}function Ht(){return new URL("./rust-semantic-session-worker.js",import.meta.url)}function zi(){return new URL("./rust-semantic-session-server.js",import.meta.url)}function Be(n,e){return Q(n)??e}function je(n,e){return $t(n)??e}function $t(n){if(!n)return null;let e=Number(n);return Number.isInteger(e)&&e>=0?e:null}var Mn=15e3,Dn=8;function Gt(n,e={}){let t=e.status??Ae,r=Vi(n,t),i=Yi(n,t),o=Ji(n,t),s=e.referenceResolver||e.calleeResolver||e.signatureResolver||!Hi(e)?null:Kt(n,t,{fallbackReferenceResolver:r,fallbackCalleeResolver:i,fallbackSignatureResolver:o}),a=e.referenceResolver??s??r,c=e.calleeResolver??s??i,u=e.signatureResolver??s??o,f=e.importUsageResolver??yt(e.sourceImportUsageResolver??$i(),e.importDefinitionResolver??s),l=e.calleeSymbolResolver,p=e.sourceZeroCalleeOracle,d=e.scipOccurrenceCalleeOracle,S=new Map,h=new Map,g=null,y=null,T=()=>(g??=t(n),g),P=()=>{let R=T();return R.dependencyAvailable?y??R:R},I=R=>{if(R.length===0)return new Map;let m=ye(R);try{let b=a.referencesForDefinitions(m),k=T();return y={...k,available:b.available,resolvedBinary:b.resolvedBinary??k.resolvedBinary,reason:b.reason??k.reason},b.available?new Map(b.references):z(m,b.references)}catch(b){return y={...T(),available:!1,reason:b instanceof Error?b.message:String(b)},V(m)}},C=R=>{if(R.length===0)return new Map;let m=ye(R),b=m.filter(Vt);if(b.length===0)return Y(m);let k=new Map,j=Jt(b,d),A=[];for(let D of b)h.has(D.symbolId)?k.set(D.symbolId,h.get(D.symbolId)??[]):j.has(D.symbolId)?k.set(D.symbolId,j.get(D.symbolId)??[]):Yt(D,p)?k.set(D.symbolId,[]):A.push(D);if(A.length===0)return re(m,k,void 0);try{let D=c.calleesForDefinitions(A),N=T();y={...N,available:D.available,resolvedBinary:D.resolvedBinary??N.resolvedBinary,reason:D.reason??N.reason};let E=re(A,D.callees,l);for(let[G,Je]of E)k.set(G,Je);return re(m,k,void 0)}catch(D){return y={...T(),available:!1,reason:D instanceof Error?D.message:String(D)},Y(m)}},x=(R,m)=>{let b=ye(R),k=ye(m),j=k.filter(Vt),A=new Map,D=Jt(j,d),N=[];for(let E of j)D.has(E.symbolId)?A.set(E.symbolId,D.get(E.symbolId)??[]):Yt(E,p)?A.set(E.symbolId,[]):N.push(E);if(b.length===0&&N.length===0)return{references:V(b),callees:re(k,A,void 0)};try{let E=s?s.referencesAndCalleesForDefinitions(b,N):Xi(a,c,{referenceDefinitions:b,calleeDefinitions:N}),G=T();y={...G,available:E.available,resolvedBinary:E.resolvedBinary??G.resolvedBinary,reason:E.reason??G.reason};let Je=E.available?new Map(E.references):z(b,E.references);for(let[Ge,Qe]of E.callees)A.set(Ge,Qe);let zn=re(k,A,l);for(let[Ge,Qe]of zn)h.set(Ge,Qe);return{references:Je,callees:zn}}catch(E){return y={...T(),available:!1,reason:E instanceof Error?E.message:String(E)},{references:V(b),callees:Y(k)}}},M=R=>{if(R.length===0)return new Map;let m=ye(R);try{let b=u.signaturesForDefinitions(m),k=T();return y={...k,available:b.available,resolvedBinary:b.resolvedBinary??k.resolvedBinary,reason:b.reason??k.reason},Qt(m,b.signatures)}catch(b){return y={...T(),available:!1,reason:b instanceof Error?b.message:String(b)},ze(m)}};return{language:"rust",availability:P,dispose:()=>{s?.dispose()},importUsage:R=>{let m=S.get(R);if(m)return m;try{let b=f.importUsage(R);return S.set(R,b),b}catch(b){return y={...T(),available:!1,reason:b instanceof Error?b.message:String(b)},[]}},referencesFor:R=>I([R]).get(R.symbolId)??[],referencesForDefinitions:I,referencesAndCalleesForDefinitions:x,calleesFor:R=>C([R]).get(R.symbolId)??[],calleesForDefinitions:C,signatureFor:R=>M([R]).get(R.symbolId)??null}}function Hi(n){if(n.usePersistentSession!==void 0)return n.usePersistentSession;let e=process.env.SCIP_RUST_SEMANTIC_SESSION;return e!=="0"&&e!=="false"}function $i(){return{importUsageFacts:()=>({usage:[],positions:[]})}}function ye(n){return n.map(e=>{let t=e;return{...e,leaf:typeof t.leaf=="string"?t.leaf:K(e.symbol),parentTypeName:t.parentTypeName??null,isFunctionLike:typeof t.isFunctionLike=="boolean"?t.isFunctionLike:rt(e.symbol),isTypeLike:t.isTypeLike??!1,kind:t.kind??null,documentation:t.documentation??null,enclosingSymbol:t.enclosingSymbol??null}})}function Vt(n){return n.isFunctionLike}function Yt(n,e){if(!e)return!1;try{return e(n)}catch{return!1}}function Jt(n,e){if(!e||n.length===0)return new Map;try{return e(n)}catch{return new Map}}function Vi(n,e){return{referencesForDefinitions:t=>Gi(n,e,t)}}function Yi(n,e){return{calleesForDefinitions:t=>Qi(n,e,t)}}function Ji(n,e){return{signaturesForDefinitions:t=>Zi(n,e,t)}}function Gi(n,e,t){let r=e(n);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:r.reason,references:V(t)};let i=vn();if(!In(i))return{available:!1,resolvedBinary:r.resolvedBinary,reason:`Rust semantic worker was not found at ${i}. Run npm run build before using built semantic Rust queries.`,references:V(t)};let o=ie(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,Mn),s=Ke(process.env.SCIP_RUST_SEMANTIC_REFERENCE_RETRY_TIMEOUT_MS,0),a=ie(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,Dn),c=Ke(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(o,1e4)),u=me(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:t.length,includeReferences:!0}),f={projectRoot:n,rustAnalyzerBinary:r.resolvedBinary,definitions:[...t],requestTimeoutMs:o,...s>0?{referenceRetryTimeoutMs:s}:{},diagnosticsTimeoutMs:c,settleDelayMs:u,concurrency:a},l=hn(process.execPath,[i],{cwd:n,input:JSON.stringify(f),encoding:"utf8",maxBuffer:50*1024*1024,timeout:$(t.length,bn(o,f.referenceRetryTimeoutMs),a)}),p=xn(l.stdout);if(p)return{available:p.available,resolvedBinary:r.resolvedBinary,reason:p.reason,references:z(t,new Map(p.references),new Set(p.incompleteReferenceSymbolIds??[]))};let d=l.error instanceof Error?l.error.message:l.stderr.trim()||`Rust semantic worker exited with status ${l.status??"unknown"}.`;return{available:!1,resolvedBinary:r.resolvedBinary,reason:d,references:V(t)}}function Qi(n,e,t){let r=e(n);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:r.reason,callees:Y(t)};let i=vn();if(!In(i))return{available:!1,resolvedBinary:r.resolvedBinary,reason:`Rust semantic worker was not found at ${i}. Run npm run build before using built semantic Rust queries.`,callees:Y(t)};let o=ie(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,Mn),s=ie(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,Dn),a=Ke(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(o,1e4)),c=me(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:t.length,includeReferences:!1,includeCallees:!0}),u={projectRoot:n,rustAnalyzerBinary:r.resolvedBinary,definitions:[...t],requestTimeoutMs:o,diagnosticsTimeoutMs:a,settleDelayMs:c,concurrency:s,includeReferences:!1,includeCallees:!0},f=hn(process.execPath,[i],{cwd:n,input:JSON.stringify(u),encoding:"utf8",maxBuffer:50*1024*1024,timeout:$(t.length,o,s)}),l=xn(f.stdout);if(l)return{available:l.available,resolvedBinary:r.resolvedBinary,reason:l.reason,callees:re(t,new Map(l.callees??[]),void 0)};let p=f.error instanceof Error?f.error.message:f.stderr.trim()||`Rust semantic worker exited with status ${f.status??"unknown"}.`;return{available:!1,resolvedBinary:r.resolvedBinary,reason:p,callees:Y(t)}}function Zi(n,e,t){let r=e(n);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:r.reason,signatures:ze(t)};let i=vn();if(!In(i))return{available:!1,resolvedBinary:r.resolvedBinary,reason:`Rust semantic worker was not found at ${i}. Run npm run build before using built semantic Rust queries.`,signatures:ze(t)};let o=ie(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,Mn),s=ie(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,Dn),a=Ke(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(o,1e4)),c=me(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:t.length,includeReferences:!1,includeCallees:!1,includeSignatures:!0}),u={projectRoot:n,rustAnalyzerBinary:r.resolvedBinary,definitions:[...t],requestTimeoutMs:o,diagnosticsTimeoutMs:a,settleDelayMs:c,concurrency:s,includeReferences:!1,includeCallees:!1,includeSignatures:!0},f=hn(process.execPath,[i],{cwd:n,input:JSON.stringify(u),encoding:"utf8",maxBuffer:50*1024*1024,timeout:$(t.length,o,s)}),l=xn(f.stdout);if(l)return{available:l.available,resolvedBinary:r.resolvedBinary,reason:l.reason,signatures:Qt(t,new Map(l.signatures??[]))};let p=f.error instanceof Error?f.error.message:f.stderr.trim()||`Rust semantic worker exited with status ${f.status??"unknown"}.`;return{available:!1,resolvedBinary:r.resolvedBinary,reason:p,signatures:ze(t)}}function Xi(n,e,t){let r=t.referenceDefinitions.length>0?n.referencesForDefinitions(t.referenceDefinitions):{available:!0,references:V(t.referenceDefinitions)},i=t.calleeDefinitions.length>0?e.calleesForDefinitions(t.calleeDefinitions):{available:!0,callees:Y(t.calleeDefinitions)};return{available:r.available&&i.available,resolvedBinary:r.resolvedBinary??i.resolvedBinary,reason:r.reason??i.reason,references:r.references,callees:i.callees}}function V(n){return new Map(n.map(e=>[e.symbolId,[]]))}function Y(n){return new Map(n.map(e=>[e.symbolId,[]]))}function ze(n){return new Map(n.map(e=>[e.symbolId,null]))}function re(n,e,t){let r=0,i=0;return w("rust.semantic.callees.complete-map",()=>{let o=new Map;for(let s of n){let a=e.get(s.symbolId)??[];a.length>0&&(r+=1),i+=a.length,o.set(s.symbolId,a.map(c=>({...c,symbol:t?t(c):c.symbol})))}return o},()=>({definitions:n.length,rows:r,callees:i,resolveSymbols:!!t}))}function Qt(n,e){return new Map(n.map(t=>[t.symbolId,e.get(t.symbolId)??null]))}function vn(){return Ki(new URL("./rust-semantic-worker.js",import.meta.url))}function xn(n){try{let e=JSON.parse(n);if(!e||typeof e!="object")return null;let t=e;return typeof t.available!="boolean"||!Array.isArray(t.references)?null:{available:t.available,reason:typeof t.reason=="string"?t.reason:void 0,references:t.references,incompleteReferenceSymbolIds:Array.isArray(t.incompleteReferenceSymbolIds)?t.incompleteReferenceSymbolIds.filter(r=>typeof r=="number"):void 0,callees:Array.isArray(t.callees)?t.callees:void 0,signatures:Array.isArray(t.signatures)?t.signatures:void 0}}catch{return null}}function ie(n,e){return Q(n)??e}function Ke(n,e){if(!n)return e;let t=Number(n);return Number.isInteger(t)&&t>=0?t:e}import{existsSync as eo,readFileSync as no}from"fs";import{deserializeSCIP as to,SymbolRole as ro}from"@c4312/scip";var Cn=new WeakMap;function Xt(n,e){let t=e.filter(io);if(t.length===0)return new Map;let r=!1,i=0,o=0;return w("rust.scip-occurrence.callees",()=>{let s=ao(n);if(r=!!s,!s)return new Map;let a=new Map;for(let c of t){let u=oo(n,s,c);u!==null&&(a.set(c.symbolId,u),i+=1,o+=u.length)}return a},()=>({definitions:e.length,candidates:t.length,indexAvailable:r,resolvedDefinitions:i,resolvedCallees:o}))}function io(n){return!(!n.symbol.startsWith("rust-analyzer ")||!n.relativePath.endsWith(".rs")||!n.isFunctionLike||n.leaf==="main"||ue(n.symbol))}function oo(n,e,t){let r=Me(n,t.relativePath);if(!r||r.language!=="rust")return null;let i=r.callables.find(u=>u.startLine!==t.startLine||u.endLine!==t.endLine?!1:u.name===t.leaf||t.leaf.endsWith(u.name)||u.name.endsWith(t.leaf));if(!i)return null;let o=r.callSites.filter(u=>u.line>=i.startLine&&u.line<=i.endLine);if(o.length===0)return null;let s=(e.occurrencesByFile.get(t.relativePath)??[]).filter(u=>u.line>=i.startLine&&u.line<=i.endLine&&u.callee.symbol!==t.symbol);if(s.some(u=>u.traitImplMember)||!so(o,s))return null;let a=[],c=new Set;for(let u of s){let f=`${u.callee.symbol}\0${u.callee.file}\0${u.callee.line}`;c.has(f)||(c.add(f),a.push(u.callee))}return a}function so(n,e){let t=Zt(n),r=Zt(e);if(t.size!==r.size)return!1;for(let[i,o]of t)if(r.get(i)!==o)return!1;return!0}function Zt(n){let e=new Map;for(let t of n){let r=t.calleeLeaf??t.leaf;if(!r)continue;let i=`${t.line}\0${r}`;e.set(i,(e.get(i)??0)+1)}return e}function ao(n){if(Cn.has(n))return Cn.get(n)??null;let e=co(n);return Cn.set(n,e),e}function co(n){if(!n.generation.indexPath||!eo(n.generation.indexPath))return null;try{let e=ve(n).filter(o=>o.symbol.startsWith("rust-analyzer ")&&o.relativePath.endsWith(".rs")&&o.isFunctionLike),t=new Map(e.map(o=>[o.symbol,o])),r=to(no(n.generation.indexPath)),i=new Map;for(let o of r.documents??[]){let s=o.relativePath;if(!s||!s.endsWith(".rs")||n.isIgnored(s))continue;let a=[];for(let c of o.occurrences??[]){if(!c.symbol||(c.symbolRoles&ro.Definition)!==0)continue;let u=t.get(c.symbol);if(!u)continue;let f=c.range?.[0];Number.isInteger(f)&&a.push({line:f,leaf:u.leaf,traitImplMember:ue(u.symbol),callee:{symbol:u.symbol,file:u.relativePath,line:u.startLine}})}i.set(s,a)}return{occurrencesByFile:i}}catch{return null}}var He=class{sessions=new WeakMap;getOrCreate(e,t,r){let i=lo(e,t),o=this.sessions.get(e);o||(o=new Map,this.sessions.set(e,o));let s=o.get(i);if(s)return s.hits+=1,s.lastUsedAtMs=Date.now(),s.provider;let a=Date.now(),c=r();return o.set(i,{key:i,language:t,projectRoot:e.config.projectRoot,provider:c,createdAtMs:a,lastUsedAtMs:a,hits:1}),c}sessionsFor(e){return[...this.sessions.get(e)?.values()??[]]}clear(e){let t=this.sessions.get(e);if(t)for(let r of t.values())r.provider.dispose?.();this.sessions.delete(e)}};function lo(n,e){return`${n.config.projectRoot}:${e}-workspace`}import{randomUUID as _o}from"crypto";import{existsSync as Lo,readFileSync as Oo}from"fs";import{dirname as Uo}from"path";import{performance as v}from"perf_hooks";function L(n,e,t){if(n.has(e))return n.get(e);let r=t();return n.set(e,r),r}import er from"path";function uo(n,e){return n.getReferences().map(t=>{let r=t.getNode();return $e(r,e)})}function fo(n){let e=n;return typeof e.findReferences=="function"?e.findReferences():[]}function nr(n,e,t,r){let i=[];for(let o of fo(n))for(let s of uo(o,r))s.file===e.relativePath&&s.line>=e.startLine&&s.line<=e.endLine||i.push(s);for(let o of t)i.push(o);return oe(i)}function tr(n,e,t,r){let i=[],o=t?.getStart();for(let s of n.getReferences()){let a=s.getNode();se(r,a.getSourceFile().getFilePath())===e&&(o!==void 0&&a.getStart()===o||i.push({location:$e(a,r),node:a}))}return i}function $e(n,e){let t=n.getSourceFile(),r=t.getLineAndColumnAtPos(n.getStart());return{file:se(e,t.getFilePath())??t.getBaseName(),line:r.line-1,column:r.column-1}}function rr(n,e,t){let r=n.getSourceFile(),i=Tn(r,n),o=n.getText(),s=new RegExp(`\\b${le(o)}\\b`,"g"),a=r.getFullText().split(`
2
+ `),c=[];for(let u=0;u<a.length;u++){if(u===i)continue;let f=a[u]??"";s.lastIndex=0;let l;for(;(l=s.exec(f))!==null;)c.push({file:e,line:u,column:l.index})}return oe(c.filter(u=>se(t,er.join(t,u.file))===e))}function kn(n){for(let e=n;e;e=e.getParent()){let t=e.getKindName();if(t.includes("Type")||t==="InterfaceDeclaration"||t==="TypeAliasDeclaration")return!0;if(t==="CallExpression"||t==="NewExpression"||t==="ExpressionStatement")return!1}return!1}function Tn(n,e){return n.getLineAndColumnAtPos(e.getStart()).line-1}function oe(n){let e=new Set,t=[];for(let r of n){let i=`${r.file}:${r.line}:${r.column}`;e.has(i)||(e.add(i),t.push(r))}return t}function se(n,e){let t=er.relative(n||process.cwd(),e).replace(/\\/g,"/");return!t||t.startsWith("..")?null:t}function ir(n,e,t,r){let i=po(e,r);return i.size===0?new Map:mo(n,t,i)}function po(n,e){let t=new Map;for(let r of W(n,e)){let i=K(r.symbol)??r.leaf;if(!i)continue;let o=t.get(i);o||(o=[],t.set(i,o)),o.push(r)}return t}function mo(n,e,t){let r=new Map,i=new Map;return e.forEachDescendant(o=>{for(let s of yo(n,o)){let a=t.get(s);if(!a)continue;let c=Tn(e,o);for(let u of a){if(c<u.startLine-1||c>u.endLine+1)continue;let f=Math.abs(c-u.startLine),l=i.get(u.symbolId);l!==void 0&&l<=f||(i.set(u.symbolId,f),r.set(u.symbolId,o))}}}),r}function yo(n,e){let t=[],r=i=>{i&&!t.includes(i)&&t.push(i)};if("getNameNode"in e&&typeof e.getNameNode=="function"){let i=e.getNameNode();r(i?.getText())}if("getName"in e&&typeof e.getName=="function"){let i=e.getName();r(i)}return n.Node.isIdentifier(e)&&r(e.getText()),t}var So=Hn("ts-definition-leaf-candidates",{clearGroups:["definition-catalog"]});function or(n,e,t,r){let i=Pn(n,e),o=wn(i.get(r)??[],t);if(o)return o;let s=[];for(let a of i.values())for(let c of a)((c.leaf||K(c.symbol)||"").includes(r)||c.symbol.includes(r))&&s.push(c);return wn(s,t)}function En(n,e,t,r){return wn(Pn(n,e).get(r)??[],t)}function sr(n,e){let t=new Map;for(let[r,i]of Pn(n,e)){let o=i[0];o&&t.set(r,o)}return t}function Pn(n,e){return So.get(n,e,()=>{let t=new Map;for(let r of W(n,e)){let i=r.leaf||K(r.symbol);if(!i)continue;let o=t.get(i);o||(o=[],t.set(i,o)),o.push({...r,leaf:i})}for(let r of t.values())r.sort((i,o)=>i.startLine-o.startLine||i.endLine-o.endLine||i.symbolId-o.symbolId);return t})}function wn(n,e){let t=null,r=Number.POSITIVE_INFINITY;for(let i of n){let o=Math.abs(i.startLine-e);(o<r||o===r&&t&&i.startLine<t.startLine)&&(t=i,r=o)}return t}import Fn from"path";function ar(n,e){let t=new Map,r=null,i=null,o=()=>(i??=he(n,{extensions:Ee}),i),s=()=>(r??=w("typescript.source-file-index",()=>go(n.config.projectRoot,e,o()),()=>({projects:e.length,indexedDocuments:o().length})),r),a=c=>ee(c)?L(t,c,()=>{let u=Se(Fn.resolve(n.config.projectRoot,c));for(let{project:f,sourceFiles:l}of s()){let p=l.get(u)??null;if(p||(p=f.addSourceFileAtPathIfExists(u)??null,p&&l.set(Se(p.getFilePath()),p)),p)return{project:f,sourceFile:p}}return null}):null;return{sourceFile:c=>a(c)?.sourceFile??null,sourceFileMatch:a,indexedTypeScriptLikeDocuments:o}}function go(n,e,t){let r=e.map(({project:i})=>({project:i,sourceFiles:new Map(i.getSourceFiles().map(o=>[Se(o.getFilePath()),o]))}));for(let i of t){let o=Se(Fn.resolve(n,i));for(let s of r){if(s.sourceFiles.has(o))break;let a=s.project.addSourceFileAtPathIfExists(o)??null;if(a){s.sourceFiles.set(Se(a.getFilePath()),a);break}}}return r}function Se(n){return Fn.resolve(n)}function An(n,e){for(let t of n)if(e===t.name||e.startsWith(`${t.name}/`))return t.name;return null}function cr(n){let e=`${n.relativeDir}/src`;return[`${e}/index.ts`,`${e}/index.tsx`,`${e}/index.mts`,`${e}/index.cts`]}import{existsSync as ge,readFileSync as Ro}from"fs";import F from"path";var Nn=["tsconfig.json","tsconfig.app.json","tsconfig.node.json","tsconfig.base.json"];function _n(n,e){let r=e?F.dirname(F.join(n,e)):n,i=F.resolve(n);for(;r.startsWith(i);){for(let s of Nn){let a=F.join(r,s);if(ge(a))return a}let o=F.dirname(r);if(o===r)break;r=o}for(let o of Nn){let s=F.join(n,o);if(ge(s))return s}return null}function lr(n){let e=n.config.projectRoot,t=new Set(bo(e,n.config.semantic?.typescript?.tsconfigs)),r=he(n,{includeIgnored:!1,extensions:Ee});for(let i of r){let o=_n(e,i);o&&t.add(F.resolve(o))}if(t.size===0){let i=_n(e);i&&t.add(F.resolve(i))}return[...t].filter(i=>!ur(e,i)).sort((i,o)=>i.localeCompare(o))}function bo(n,e=[]){let t=new Set;for(let r of e){let i=F.isAbsolute(r)?r:F.join(n,r);ge(i)&&t.add(F.resolve(i))}for(let r of ho(n))for(let i of Nn){let o=F.join(r,i);ge(o)&&t.add(F.resolve(o))}if(t.size===0){let r=_n(n);r&&t.add(F.resolve(r))}return[...t].filter(r=>!ur(n,r)).sort((r,i)=>r.localeCompare(i))}function ho(n){let e=F.join(n,"package.json");if(!ge(e))return[];let t;try{t=JSON.parse(Ro(e,"utf8"))}catch{return[]}return(Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[]).flatMap(i=>Gn(n,i))}function ur(n,e){let t=F.relative(n,e).replace(/\\/g,"/");return t.startsWith("..")||t.includes("/node_modules/")||t.startsWith("node_modules/")||t.includes("/dist/")||t.startsWith("dist/")}var Io=32;function Sr(n,e){let t=w("typescript.provider.load",()=>ut());if(!t)return Pe("ts-morph is not installed");let r=w("typescript.provider.tsconfig-discovery",()=>lr(n));if(r.length===0)return Pe("no tsconfig found");try{let i=w("typescript.provider.project-bundles",()=>ft(t,r),()=>({tsconfigs:r.length}));return Mo(n,t,i)}catch(i){return Pe(i instanceof Error?i.message:String(i),r[0],r)}}function Mo(n,e,t,r={}){return w("typescript.provider.construct",()=>new On(n,e,t),()=>({tsconfigs:t.length,reusedProjects:r.reusedProjects===!0}))}var On=class{constructor(e,t,r){this.db=e;this.tsMorph=t;this.projects=r;this.workspacePackages=Jn(e.config.projectRoot),this.sourceFiles=ar(e,r)}db;tsMorph;projects;language="typescript";importUsageCache=new Map;referencesCache=new Map;calleesCache=new Map;fileCalleesCache=new Map;signatureCache=new Map;definitionNodeCache=new Map;fileDefinitionNodeCache=new Map;indexedDefinitionLeafCache=new Map;compilerCheckerCache=new WeakMap;packageImportReferenceIndex=null;packageExportIndex=null;workspacePackages;sourceFiles;availability(){return{available:!0,tsconfigPath:this.projects[0]?.tsconfigPath,tsconfigPaths:this.projects.map(e=>e.tsconfigPath)}}importUsage(e){return L(this.importUsageCache,e,()=>{let t=this.sourceFiles.sourceFile(e);if(!t)return[];let r=vo();return w("typescript.import-usage.file",()=>this.importUsageForSourceFile(e,t,r),()=>({file:e,...r}))})}referencesFor(e){return L(this.referencesCache,e.symbolId,()=>{let t=this.nodeForDefinition(e);return this.referencesForDefinitionNode(e,t)})}referencesForDefinitions(e,t={}){let r=new Map,i=_(),o=[];for(let f of e){let l=this.referencesCache.get(f.symbolId);l?r.set(f.symbolId,l):o.push(f)}if(o.length===0)return r;let s=o,a=t.exact?[]:o.filter(f=>!pr(f));if(a.length>=Io){let f=this.referencesForDefinitionsBySymbolScan(a);for(let l of a){let p=f.get(l.symbolId)??[];this.referencesCache.set(l.symbolId,p),r.set(l.symbolId,p)}if(s=o.filter(l=>pr(l)),s.length===0)return r}let c=new Map;for(let f of s){let l=c.get(f.relativePath);l?l.push(f):c.set(f.relativePath,[f])}let u=[];for(let[f,l]of c){let p=dr();w("typescript.references-map.file",()=>{let d=this.definitionNodesForFile(f);for(let S of l){i&&(p.cacheMisses+=1);let h=d.get(S.symbolId)??null;i&&(h?p.nodeHits+=1:p.nodeMisses+=1);try{let g=this.referencesForDefinitionNode(S,h,i?p:void 0);this.referencesCache.set(S.symbolId,g),r.set(S.symbolId,g)}catch{p.preciseSearchFailures+=1,u.push(S)}}},()=>({relativePath:f,definitions:l.length,...mr(p)}))}if(u.length>0){let f=this.referencesForDefinitionsBySymbolScan(u);for(let l of u){let p=f.get(l.symbolId)??[];this.referencesCache.set(l.symbolId,p),r.set(l.symbolId,p)}}return r}referenceFragmentsForFiles(e){let t=ve(this.db).filter(o=>ee(o.relativePath)),r=e.filter(o=>this.sourceFiles.sourceFile(o)!==null),i=this.referencesForDefinitionsBySymbolScan(t,r);return pt(t,i,r)}referencesForDefinitionsBySymbolScan(e,t){let r=_(),i=dr(),o=new Map,s=new Set(e.map(c=>c.symbolId)),a=new Map(e.map(c=>[c.symbolId,c]));for(let c of e)o.set(c.symbolId,[]);return w("typescript.references-map.inverted-scan",()=>{let c=r?v.now():0,u=t?this.packageImportReferencesForFiles(t):this.packageImportReferences();for(let g of e){let y=u.get(g.symbolId)??[];if(y.length>0){let T=o.get(g.symbolId)??[];T.push(...y),o.set(g.symbolId,T)}r&&(i.packageReferenceCount+=y.length)}r&&(i.packageRefsMs+=v.now()-c);let f=new Map,l=new Map,p=this.hierarchyTargetsForDefinitions(e),d=new Set(e.map(g=>g.leaf).filter(Boolean)),S=r?v.now():0;for(let g of t??this.sourceFiles.indexedTypeScriptLikeDocuments()){if(this.db.isIgnored(g))continue;let y=this.sourceFiles.sourceFile(g);y&&(r&&(i.scanFiles+=1),this.addReferencesFromSourceFileScan(y,g,s,a,p,d,f,l,o,r?i:void 0))}r&&(i.scanMs+=v.now()-S);let h=r?v.now():0;this.addHierarchyMemberReferences(e,o,r?i:void 0),r&&(i.hierarchyMs+=v.now()-h);for(let[g,y]of o){let T=oe(y);o.set(g,T),r&&(i.referenceCount+=T.length)}},()=>({definitions:e.length,...mr(i)})),o}addReferencesFromSourceFileScan(e,t,r,i,o,s,a,c,u,f){let l=this.compilerCheckerForSourceFile(e),p=e.compilerNode,d=ko(e),S=h=>{if(this.tsMorph.ts.isIdentifier(h)){if(f&&(f.identifiers+=1),!s.has(h.text)&&!d.has(h.text)){this.tsMorph.ts.forEachChild(h,S);return}let g=this.compilerReferenceSymbol(l,h,f);if(g){let y;a.has(g)?y=a.get(g)??null:(y=this.referenceDefinitionFromCompilerSymbol(g),a.set(g,y)),f&&(y?f.targetHits+=1:f.targetMisses+=1);let T=L(c,g,()=>this.compilerSymbolKeys(g)),P=null,I=null,C=y&&r.has(y.symbolId)?i.get(y.symbolId):void 0;if(C&&(P=Ln(p,h),!fr(C,t,P))){let x=p.getLineAndCharacterOfPosition(h.getStart(p));I={file:t,line:x.line,column:x.character};let M=u.get(C.symbolId)??[];M.push(I),u.set(C.symbolId,M),f&&(f.requestedHits+=1)}for(let x of T)for(let M of o.get(x)?.values()??[]){if(P??=Ln(p,h),fr(M,t,P))continue;if(!I){let m=p.getLineAndCharacterOfPosition(h.getStart(p));I={file:t,line:m.line,column:m.character}}let R=u.get(M.symbolId)??[];R.push(I),u.set(M.symbolId,R),f&&(f.requestedHits+=1)}}}this.tsMorph.ts.forEachChild(h,S)};S(p)}hierarchyTargetsForDefinitions(e){let t=new Map;for(let r of e){let i=this.nodeForDefinition(r),o=i?.compilerNode;if(!o||!this.isHierarchyMethod(o))continue;let s=o.parent;if(!this.isHierarchyContainer(s))continue;let a=this.compilerCheckerForSourceFile(i.getSourceFile()),c=a.getSymbolAtLocation(o.name);if(c)for(let u of this.hierarchyMemberSymbols(a,s,c))for(let f of this.compilerSymbolKeys(u)){let l=t.get(f)??new Map;l.set(r.symbolId,r),t.set(f,l)}}return t}hierarchyMemberSymbols(e,t,r){let i=new Set,o=new Set,s=(a,c,u)=>{if(!o.has(a)){o.add(a),i.add(c);for(let f of u){let l=f.getProperty(r.name);l&&s(f,l,this.hierarchyAncestorTypesForType(e,f))}}};return s(e.getTypeAtLocation(t),r,this.hierarchyAncestorTypes(e,t)),i}addHierarchyMemberReferences(e,t,r){let i=new Map;for(let o of e){let s=this.nodeForDefinition(o),a=s?.compilerNode;if(!a||!this.isHierarchyMethod(a))continue;let c=a.parent;if(!this.isHierarchyContainer(c))continue;let u=this.compilerCheckerForSourceFile(s.getSourceFile()),f=u.getSymbolAtLocation(a.name);if(!f)continue;let l=a.getSourceFile(),p=l.getLineAndCharacterOfPosition(a.name.getStart(l)),d={definition:o,location:{file:o.relativePath,line:p.line,column:p.character}},S=t.get(o.symbolId)??[];for(let g of this.hierarchyMemberSymbols(u,c,f))if(g!==f)for(let y of this.compilerSymbolLocations(g))S.push(y),r&&(r.hierarchyReferences+=1);t.set(o.symbolId,S);let h=this.hierarchyRootMemberSymbols(u,c,f);for(let g of h){let y=i.get(g)??new Map;y.set(o.symbolId,d),i.set(g,y)}r&&(r.hierarchyDefinitions+=1)}for(let o of i.values())if(!(o.size<2)){r&&(r.hierarchyFamilies+=1);for(let{definition:s}of o.values()){let a=t.get(s.symbolId)??[];for(let c of o.values())c.definition.symbolId!==s.symbolId&&(a.push(c.location),r&&(r.hierarchyReferences+=1));t.set(s.symbolId,a)}}}hierarchyRootMemberSymbols(e,t,r){let i=new Set,o=new Set,s=(a,c,u)=>{if(o.has(a))return;o.add(a);let f=!1;for(let l of u){let p=l.getProperty(r.name);p&&(f=!0,s(l,p,this.hierarchyAncestorTypesForType(e,l)))}if(!f)for(let l of this.compilerSymbolKeys(c))i.add(l)};return s(e.getTypeAtLocation(t),r,this.hierarchyAncestorTypes(e,t)),i}compilerSymbolKeys(e){return(e.declarations??[]).map(t=>{let r=t.getSourceFile();return`${r.fileName}\0${t.getStart(r)}\0${e.name}`})}compilerSymbolLocations(e){let t=[];for(let r of e.declarations??[]){let i=r.getSourceFile(),o=se(this.db.config.projectRoot,i.fileName);if(!o)continue;let s=r.name,a=i.getLineAndCharacterOfPosition((s??r).getStart(i));t.push({file:o,line:a.line,column:a.character})}return t}baseTypes(e,t){try{return e.getBaseTypes(t)??[]}catch{return[]}}hierarchyAncestorTypes(e,t){let r=new Set(this.hierarchyAncestorTypesForType(e,e.getTypeAtLocation(t)));for(let i of t.heritageClauses??[])for(let o of i.types)r.add(e.getTypeAtLocation(o));return[...r]}hierarchyAncestorTypesForType(e,t){let r=new Set(this.baseTypes(e,t));for(let i of t.getSymbol()?.declarations??[])if(this.isHierarchyContainer(i))for(let o of i.heritageClauses??[])for(let s of o.types)r.add(e.getTypeAtLocation(s));return[...r]}isHierarchyMethod(e){return this.tsMorph.ts.isMethodDeclaration(e)||this.tsMorph.ts.isMethodSignature(e)}isHierarchyContainer(e){return this.tsMorph.ts.isClassDeclaration(e)||this.tsMorph.ts.isClassExpression(e)||this.tsMorph.ts.isInterfaceDeclaration(e)}compilerReferenceSymbol(e,t,r){r&&(r.symbolLookups+=1);let i=e.getSymbolAtLocation(t);if(i){if((i.flags&this.tsMorph.ts.SymbolFlags.Alias)===0)return i;try{return r&&(r.aliasResolutions+=1),e.getAliasedSymbol(i)}catch{return i}}}calleesFor(e){return L(this.calleesCache,e.symbolId,()=>L(this.fileCalleesCache,e.relativePath,()=>this.calleeMapForFile(e.relativePath)).get(e.symbolId)??[])}calleesForDefinitions(e){let t=new Map,r=new Map;for(let i of e){let o=r.get(i.relativePath);o?o.push(i):r.set(i.relativePath,[i])}for(let[i,o]of r){let s=this.fileCalleesCache.get(i),a=new Set(o.map(u=>u.symbolId)),c=s??this.calleeMapForFile(i,a);for(let u of o){let f=c.get(u.symbolId)??[];this.calleesCache.set(u.symbolId,f),t.set(u.symbolId,f)}}return t}referencesForDefinitionNode(e,t,r){let i=r?v.now():0,o=this.packageImportReferencesForDefinition(e);if(r&&(r.packageRefsMs+=v.now()-i,r.packageReferenceCount+=o.length),!t)return o;let s=r?v.now():0,a=nr(t,e,o,this.db.config.projectRoot);return r&&(r.semanticRefsMs+=v.now()-s,r.referenceCount+=a.length),a}signatureFor(e){return L(this.signatureCache,e.symbolId,()=>{let t=this.nodeForDefinition(e);if(!t||!this.tsMorph.Node.isFunctionDeclaration(t)&&!this.tsMorph.Node.isMethodDeclaration(t)&&!this.tsMorph.Node.isArrowFunction(t)&&!this.tsMorph.Node.isFunctionExpression(t)&&!this.tsMorph.Node.isConstructorDeclaration(t))return null;let r=t.getType().getCallSignatures()[0];if(!r)return null;let i=r.getParameters().map(s=>{let a=s.getDeclarations()[0],c=a?s.getTypeAtLocation(a).getText(a):s.getValueDeclaration()?.getType().getText()??"unknown";return yr(c)}),o=r.getReturnType().getText(t);return`(${i.join(",")})=>${yr(o)}`})}importUsageForSourceFile(e,t,r){let i=[],o=new Map;for(let s of t.getImportDeclarations()){r.declarations+=1;let a=en(this.db,e,s.getModuleSpecifierValue()),c=s.getImportClause()?.isTypeOnly()??!1;for(let u of Un(s)){r.entries+=1;let f=c?null:u.identifier?.getSymbol()?.compilerSymbol??null;!c&&u.identifier&&(f?r.bindingSymbols+=1:r.missingBindingSymbols+=1);let l={sourcePath:a,entry:u,typeOnlyDeclaration:c,bindingSymbol:f,references:[]};if(i.push(l),c||!u.localName||!f)continue;let p=o.get(u.localName);p?p.push(l):o.set(u.localName,[l])}}return o.size>0&&t.forEachDescendant(s=>{if(s.getKindName()!=="Identifier")return;let a=o.get(s.getText());if(!a||xo(s))return;r.scannedIdentifiers+=1;let c=s.getSymbol()?.compilerSymbol;if(r.symbolLookups+=1,!!c){for(let u of a)if(u.bindingSymbol===c){u.references.push({location:$e(s,this.db.config.projectRoot),node:s}),r.matchedReferences+=1;break}}}),i.map(s=>s.typeOnlyDeclaration?Do(e,s.sourcePath,s.entry):s.entry.identifier&&!s.bindingSymbol?(r.fallbackEntries+=1,this.valueImportUsageForEntry(e,s.sourcePath,s.entry)):this.valueImportUsageFromLocations(e,s.sourcePath,s.entry,s.references))}valueImportUsageForEntry(e,t,r){let i=r.identifier?r.identifier.findReferences():[],o=[];for(let s of i)for(let a of tr(s,e,r.identifier,this.db.config.projectRoot))o.push(a);return this.valueImportUsageFromLocations(e,t,r,o)}valueImportUsageFromLocations(e,t,r,i){let o=i.some(c=>!kn(c.node)),s=i.some(c=>kn(c.node)),a=r.isTypeOnly;return{importer:e,sourcePath:t,importedName:r.importedName,localName:r.localName,kind:r.kind,isTypeOnly:a,isUsed:a||i.length>0,isTypeUsed:a||s,isValueUsed:o,references:i.map(c=>c.location)}}packageImportReferencesForDefinition(e){return this.packageImportReferences().get(e.symbolId)??[]}packageImportReferencesForFiles(e){let t=new Map,r=new Set;for(let o of e){let s=this.sourceFiles.sourceFile(o);if(s)for(let a of s.getImportDeclarations()){let c=An(this.workspacePackages,a.getModuleSpecifierValue());c&&r.add(c)}}if(r.size===0)return t;let i=this.packageExportsForNames(r);for(let o of e)this.addPackageImportReferencesForDocument(t,i,o);for(let[o,s]of t)t.set(o,oe(s));return t}packageImportReferences(){if(this.packageImportReferenceIndex)return this.packageImportReferenceIndex;let e=new Map,t=this.packageExports();for(let r of this.sourceFiles.indexedTypeScriptLikeDocuments())this.addPackageImportReferencesForDocument(e,t,r);for(let[r,i]of e)e.set(r,oe(i));return this.packageImportReferenceIndex=e,e}addPackageImportReferencesForDocument(e,t,r){if(this.db.isIgnored(r))return;let i=this.sourceFiles.sourceFileMatch(r);if(i)for(let o of i.sourceFile.getImportDeclarations())this.addPackageImportReferencesForDeclaration(e,t,r,o)}addPackageImportReferencesForDeclaration(e,t,r,i){let o=An(this.workspacePackages,i.getModuleSpecifierValue());if(!o)return;let s=t.get(o);if(s)for(let a of Un(i)){if(a.kind!=="named"||!a.identifier)continue;let c=s.get(a.importedName);if(!c||c.size===0)continue;let u=rr(a.identifier,r,this.db.config.projectRoot);u.length>0&&Po(e,c,u)}}packageExports(){return this.packageExportIndex?this.packageExportIndex:(this.packageExportIndex=this.packageExportsForNames(new Set(this.workspacePackages.map(e=>e.name))),this.packageExportIndex)}packageExportsForNames(e){let t=new Map;for(let r of this.workspacePackages){if(!e.has(r.name))continue;let i=new Map;for(let o of cr(r))this.collectPackageExports(r,o,i,new Set);i.size>0&&t.set(r.name,i)}return t}collectPackageExports(e,t,r,i){if(i.has(t))return;i.add(t);let o=this.sourceFiles.sourceFile(t);if(o)for(let s of o.getExportDeclarations()){let a=s.getModuleSpecifierValue(),c=a?en(this.db,t,a):t;if(!c||!c.startsWith(`${e.relativeDir}/src/`))continue;let u=s.getNamedExports();if(u.length===0){if(s.isNamespaceExport())continue;this.collectPackageExports(e,c,r,i);continue}for(let f of u){let l=f.getNameNode().getText(),p=f.getAliasNode()?.getText()??l,d=this.indexedDefinitionByLeaf(c,l);if(!d)continue;let S=r.get(p);S||(S=new Set,r.set(p,S)),S.add(d.symbolId)}}}indexedDefinitionByLeaf(e,t){return L(this.indexedDefinitionLeafCache,e,()=>sr(this.db,e)).get(t)??null}nodeForDefinition(e){return L(this.definitionNodeCache,e.symbolId,()=>this.definitionNodesForFile(e.relativePath).get(e.symbolId)??null)}definitionNodesForFile(e){return L(this.fileDefinitionNodeCache,e,()=>{let t=this.sourceFiles.sourceFile(e);return t?ir(this.tsMorph,this.db,t,e):new Map})}referenceDefinitionFromCompilerSymbol(e){return this.definitionFromCompilerSymbol(e,void 0,!0)}definitionFromCompilerSymbol(e,t,r=!1){let i=e.name,o=t?v.now():0,s=e.declarations??[];t&&(t.declarationsMs+=v.now()-o,t.declarationChecks+=s.length);for(let a of s){let c=t?v.now():0,u=a.getSourceFile(),f=se(this.db.config.projectRoot,u.fileName),l=u.getLineAndCharacterOfPosition(a.getStart(u)).line;if(t&&(t.declarationLocationMs+=v.now()-c),!f||this.db.isIgnored(f))continue;let p=t?v.now():0,d=this.compilerDeclarationName(a),S=r?En(this.db,f,l,i)??(d&&d!==i?En(this.db,f,l,d):null):or(this.db,f,l,i);if(t&&(t.indexedLookupMs+=v.now()-p),S)return{symbolId:S.symbolId,symbol:S.symbol,file:S.relativePath,line:S.startLine}}return null}compilerDeclarationName(e){let t=e.name;return t&&this.tsMorph.ts.isIdentifier(t)?t.text:null}calleeMapForFile(e,t){let r=_(),i=0,o=0,s=0,a=0,c=0,u=0,f=0,l=0,p=r?wo():void 0;return w("typescript.callee-map.file",()=>{let d=r?v.now():0,S=this.sourceFiles.sourceFile(e);if(r&&(c=Math.round(v.now()-d)),!S)return new Map;let h=r?v.now():0,g=W(this.db,e).sort((R,m)=>R.startLine-m.startLine||m.endLine-R.endLine);if(r&&(u=Math.round(v.now()-h)),i=g.length,g.length===0)return new Map;let y=new Map,T=r?v.now():0,P=this.compilerCheckerForSourceFile(S),I=S.compilerNode;r&&(f=Math.round(v.now()-T));let C=new Map,x=R=>{if(this.tsMorph.ts.isCallExpression(R)||this.tsMorph.ts.isNewExpression(R)){r&&(o+=1);let m=this.semanticCalleeForCallNode(P,I,g,R,C,t,p);m&&(r&&(s+=1),Co(y,m.callerId,m.target))}this.tsMorph.ts.forEachChild(R,x)},M=r?v.now():0;x(I),r&&(l=Math.round(v.now()-M));for(let[R,m]of y)y.set(R,Fo(m));return a=y.size,y},()=>({relativePath:e,definitions:i,callNodes:o,resolvedCallees:s,outputRows:a,requestedDefinitions:t?.size??i,sourceFileLookupMs:c,definitionsLoadMs:u,checkerLookupMs:f,traversalMs:l,...p?Eo(p):{}}))}semanticCalleeForCallNode(e,t,r,i,o,s,a){let c=a?v.now():0,u=To(r,Ln(t,i));if(a&&(a.callerLookupMs+=v.now()-c),!u)return null;if(s&&!s.has(u.symbolId))return a&&(a.skippedUnrequestedCallers+=1),null;let f=i.expression,l=this.compilerSymbolForExpression(e,f,a),p=null;if(l)if(a&&(a.targetSymbolHits+=1),o.has(l))a&&(a.compilerSymbolCacheHits+=1),p=o.get(l)??null;else{a&&(a.compilerSymbolCacheMisses+=1);let d=a?v.now():0;p=this.definitionFromCompilerSymbol(l,a),a&&(a.targetLookupMs+=v.now()-d),o.set(l,p)}else a&&(a.targetMisses+=1);return p?{callerId:u.symbolId,target:{symbol:p.symbol,file:p.file,line:p.line}}:null}compilerSymbolForExpression(e,t,r){let i=r?v.now():0,o=e.getSymbolAtLocation(t);if(r&&(r.expressionSymbolMs+=v.now()-i),o)return o;r&&(r.typeFallbacks+=1);let s=r?v.now():0,a=e.getTypeAtLocation(t).getSymbol();return r&&(r.typeSymbolMs+=v.now()-s),a}compilerCheckerForSourceFile(e){let t=e.getProject(),r=this.compilerCheckerCache.get(t);return r||(r=t.getTypeChecker().compilerObject,this.compilerCheckerCache.set(t,r)),r}};function Un(n){let e=[],t=n.getDefaultImport();t&&e.push({identifier:t,importedName:"default",localName:t.getText(),kind:"default",isTypeOnly:n.getImportClause()?.isTypeOnly()??!1});let r=n.getNamespaceImport();r&&e.push({identifier:r,importedName:"*",localName:r.getText(),kind:"namespace",isTypeOnly:n.getImportClause()?.isTypeOnly()??!1});for(let i of n.getNamedImports()){let o=i.getNameNode(),a=i.getAliasNode()??(o.getKindName()==="Identifier"?o:null);e.push({identifier:a,importedName:o.getText(),localName:a?.getText()??o.getText(),kind:"named",isTypeOnly:i.isTypeOnly()||(n.getImportClause()?.isTypeOnly()??!1)})}return e.length===0&&e.push({identifier:null,importedName:"*",localName:null,kind:"side-effect",isTypeOnly:!1}),e}function Do(n,e,t){return{importer:n,sourcePath:e,importedName:t.importedName,localName:t.localName,kind:t.kind,isTypeOnly:!0,isUsed:!0,isTypeUsed:!0,isValueUsed:!1,references:[]}}function vo(){return{declarations:0,entries:0,bindingSymbols:0,missingBindingSymbols:0,scannedIdentifiers:0,symbolLookups:0,matchedReferences:0,fallbackEntries:0}}function xo(n){for(let e=n;e;e=e.getParent())if(e.getKindName()==="ImportDeclaration")return!0;return!1}function Co(n,e,t){let r=n.get(e);r||(r=[],n.set(e,r)),r.push(t)}function ko(n){let e=new Set;for(let t of n.getImportDeclarations())for(let r of Un(t))r.localName&&e.add(r.localName);return e}function To(n,e){let t=null;for(let r of n)e<r.startLine||e>r.endLine||(!t||r.startLine>=t.startLine)&&(t=r);return t}function Ln(n,e){return n.getLineAndCharacterOfPosition(e.getStart(n)).line}function fr(n,e,t){return e===n.relativePath&&t>=n.startLine&&t<=n.endLine}function pr(n){return n.symbol.includes("#")?De(n.symbol)==="type"&&n.relativePath.endsWith(".d.ts"):!1}function wo(){return{callerLookupMs:0,expressionSymbolMs:0,typeSymbolMs:0,targetLookupMs:0,declarationsMs:0,declarationLocationMs:0,indexedLookupMs:0,compilerSymbolCacheHits:0,compilerSymbolCacheMisses:0,targetSymbolHits:0,targetMisses:0,typeFallbacks:0,declarationChecks:0,skippedUnrequestedCallers:0}}function Eo(n){return{...n,callerLookupMs:Math.round(n.callerLookupMs),expressionSymbolMs:Math.round(n.expressionSymbolMs),typeSymbolMs:Math.round(n.typeSymbolMs),targetLookupMs:Math.round(n.targetLookupMs),declarationsMs:Math.round(n.declarationsMs),declarationLocationMs:Math.round(n.declarationLocationMs),indexedLookupMs:Math.round(n.indexedLookupMs)}}function dr(){return{cacheHits:0,cacheMisses:0,nodeHits:0,nodeMisses:0,scanFiles:0,identifiers:0,symbolLookups:0,aliasResolutions:0,targetHits:0,targetMisses:0,requestedHits:0,scanMs:0,packageRefsMs:0,semanticRefsMs:0,packageReferenceCount:0,referenceCount:0,preciseSearchFailures:0,hierarchyDefinitions:0,hierarchyFamilies:0,hierarchyReferences:0,hierarchyMs:0}}function mr(n){return{...n,scanMs:Math.round(n.scanMs),packageRefsMs:Math.round(n.packageRefsMs),semanticRefsMs:Math.round(n.semanticRefsMs),hierarchyMs:Math.round(n.hierarchyMs)}}function Po(n,e,t){for(let r of e){let i=n.get(r)??[];i.push(...t),n.set(r,i)}}function Fo(n){let e=new Set,t=[];for(let r of n){let i=`${r.symbol}|${r.file}|${r.line}`;e.has(i)||(e.add(i),t.push(r))}return t}function yr(n){return n.replace(/\s+/g," ").replace(/\bimport\("[^"]+"\)\./g,"").trim()}import{join as Ao}from"path";var Ve=3;var No="typescript-semantic";function gr(n){let e=Ao(n,No),t=Te(e);return{...t,requestDir:t.legacyRequestDir}}var qo=12e4,Bo=5;function hr(n,e,t={}){let r=new qn(n,t),i=null,o=null,s=process.env.SCIP_QUERY_SKIP_WATCH_SERVICE==="1",a=()=>(i??=Sr(n,e),i),c=(l,p,d)=>{if(s)return d();try{return p(r.request(l))}catch{return s=!0,d()}},u=(l,p)=>c({kind:"references",definitions:[...l],...p?.exact?{exact:!0}:{}},d=>br(d),()=>a().referencesForDefinitions?.(l,p)??new Map(l.map(d=>[d.symbolId,a().referencesFor(d)]))),f=l=>c({kind:"callees",definitions:[...l]},p=>br(p),()=>a().calleesForDefinitions?.(l)??new Map(l.map(p=>[p.symbolId,a().calleesFor(p)])));return{language:"typescript",availability:()=>(o??=c({kind:"availability"},zo,()=>a().availability()),o),importUsage:l=>c({kind:"import-usage",file:l},p=>p,()=>a().importUsage(l)),referencesFor:l=>u([l]).get(l.symbolId)??[],referencesForDefinitions:u,referenceFragmentsForFiles:l=>c({kind:"reference-fragments",files:[...l]},p=>Wo(p),()=>a().referenceFragmentsForFiles?.(l)??new Map),calleesFor:l=>f([l]).get(l.symbolId)??[],calleesForDefinitions:f,signatureFor:l=>c({kind:"signature",definition:l},Ko,()=>a().signatureFor(l)),dispose:()=>i?.dispose?.()}}var qn=class{constructor(e,t={}){this.db=e;this.runtime=t.runtime??$o,this.timeoutMs=t.timeoutMs??Ho(),this.mailboxLimits=t.mailboxLimits??{},this.cacheDir=Uo(e.config.dbPath),this.projectRoot=lt(e.config.projectRoot)}db;runtime;timeoutMs;cacheDir;projectRoot;mailboxLimits;request(e){let t=ct(this.cacheDir),r=gr(this.cacheDir),i=rn(t.statePath);if(!Rr(i,this.projectRoot,this.runtime))throw new Error("Compatible TypeScript semantic service is not running.");let o=this.db.generation.identity;if(!o)throw new Error("Published TypeScript generation identity is unavailable.");let s=this.runtime.now(),a=s+this.timeoutMs,c=(this.runtime.monotonicNow??q)()+this.timeoutMs,u=Qn(),f=Z("typescript-semantic-v3",{generation:o,profileEnvironment:u,request:e}),l=X(f),p=we(r,{mailboxVersion:H,operationKey:f,clientId:this.runtime.randomId(),enqueuedAtMs:s,deadlineAtMs:a,protocolVersion:Ve,id:l,generation:o,profileEnvironment:u,request:e},{nowMs:s,limits:this.mailboxLimits});for(;(this.runtime.monotonicNow??q)()<=c;){if(Lo(p.responsePath))return jo(Oo(p.responsePath,"utf8"),l,o,f);let d=rn(t.statePath);if(!Rr(d,this.projectRoot,this.runtime))throw new Error("TypeScript semantic service stopped while processing a request.");this.runtime.sleep(Bo)}throw new Error(`TypeScript semantic service timed out after ${this.timeoutMs}ms.`)}};function Rr(n,e,t){let r=n?.processIdentity?t.readProcessIdentity?.(n.pid):null;return n!==null&&n.projectRoot===e&&n.typescriptSemantic?.protocolVersion===Ve&&t.isProcessAlive(n.pid)&&(!n.processIdentity||r!=null&&Ce(n.processIdentity,r))}function jo(n,e,t,r){let i=JSON.parse(n);if(i.protocolVersion!==Ve||i.id!==e||i.operationKey!==r||i.ok===!0&&i.generation!==t)throw new Error("TypeScript semantic service wrote an incompatible response.");if(i.ok===!0)return i.response;throw new Error(typeof i.error=="string"?i.error:"TypeScript semantic service request failed.")}function br(n){if(!Array.isArray(n))throw new Error("TypeScript semantic service wrote an invalid numeric map.");return new Map(n)}function Wo(n){if(!Array.isArray(n))throw new Error("TypeScript semantic service wrote an invalid string map.");return new Map(n)}function zo(n){if(!n||typeof n!="object"||typeof n.available!="boolean")throw new Error("TypeScript semantic service wrote invalid availability.");return n}function Ko(n){if(n!==null&&typeof n!="string")throw new Error("TypeScript semantic service wrote an invalid signature.");return n}function Ho(){let n=Number(process.env.SCIP_TYPESCRIPT_SEMANTIC_TIMEOUT_MS);return Number.isInteger(n)&&n>0?n:qo}var $o={now:Date.now,monotonicNow:q,randomId:_o,sleep(n){let e=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(e,0,0,n)},isProcessAlive:xe,readProcessIdentity:ke};var Ir=new He;Kn({name:"semantic-provider",groups:["semantic-provider"],clearAll:n=>Ir.clear(n)});function J(n,e){let t=U(e)??"typescript";return Ir.getOrCreate(n,t,()=>t==="rust"?Gt(n.config.projectRoot,{sourceImportUsageResolver:{importUsageFacts:r=>mt(n,r)},calleeSymbolResolver:dt(n),sourceZeroCalleeOracle:r=>Vo(n,r),scipOccurrenceCalleeOracle:r=>Xt(n,r)}):hr(n,e))}function U(n){return n?Zn(n)==="rust"?"rust":ee(n)?"typescript":null:"typescript"}function Vo(n,e){let t=Me(n,e.relativePath);if(!t||t.language!=="rust")return!1;let r=t.callables.find(i=>i.startLine===e.startLine&&i.endLine===e.endLine&&i.name===e.leaf)??t.callables.find(i=>i.startLine===e.startLine&&i.endLine===e.endLine);return r?!t.callSites.some(i=>i.line>=r.startLine&&i.line<=r.endLine):!1}import{existsSync as Yo,readFileSync as Jo}from"fs";import{resolve as Go}from"path";function ul(n,e){return Ye(n,e,t=>{let r=t?`AND m.symbol_id IN (${t.map(()=>"?").join(",")})`:"";return n.all(`SELECT
3
+ m.symbol_id,
4
+ d.relative_path,
5
+ COUNT(*) AS ref_count
6
+ FROM mentions m
7
+ JOIN chunks c ON m.chunk_id = c.id
8
+ JOIN documents d ON c.document_id = d.id
9
+ WHERE m.role != 1
10
+ ${r}
11
+ ${n.pathExclusionsFor("d")}
12
+ GROUP BY m.symbol_id, d.relative_path`,...t??[])})}function fl(n,e){return Ye(n,e,t=>{let r=t?`AND m.symbol_id IN (${t.map(()=>"?").join(",")})`:"";return n.all(`SELECT DISTINCT m.symbol_id, d.relative_path
13
+ FROM mentions m
14
+ JOIN chunks c ON m.chunk_id = c.id
15
+ JOIN documents d ON c.document_id = d.id
16
+ WHERE m.role != 1
17
+ ${r}
18
+ ${n.pathExclusionsFor("d")}`,...t??[])}).filter(t=>t.symbol_id!==null)}function pl(n,e){return Ye(n,e,t=>{let r=t?`AND m.symbol_id IN (${t.map(()=>"?").join(",")})`:"";return n.all(`SELECT DISTINCT m.symbol_id
19
+ FROM mentions m
20
+ WHERE m.role != 1
21
+ ${r}`,...t??[])}).filter(t=>t.symbol_id!==null)}function Mr(n,e){return Ye(n,e,t=>{let r=t?`AND m.symbol_id IN (${t.map(()=>"?").join(",")})`:"";return n.all(`SELECT DISTINCT m.symbol_id, d.relative_path, c.document_id,
22
+ c.start_line AS chunk_start, c.end_line AS chunk_end
23
+ FROM mentions m
24
+ JOIN chunks c ON m.chunk_id = c.id
25
+ JOIN documents d ON c.document_id = d.id
26
+ WHERE m.role != 1
27
+ ${r}
28
+ ${n.pathExclusionsFor("d")}
29
+ ORDER BY d.relative_path, c.start_line`,...t??[])})}function Ye(n,e,t){if(!e)return t();if(e.length===0)return[];let r=[];for(let i=0;i<e.length;i+=750)r.push(...t(e.slice(i,i+750)));return r}var Qo=/^[A-Za-z_][A-Za-z0-9_]*$/,Dr=/\bDefault::default\b/g,Zo=/^\.\.\s*Default::default\b/;function vr(n,e){let t=new Map,r=new Map;for(let i of e){let o=Bn(n,i,r);o!==null&&t.set(i.symbolId,o)}return t}function Bn(n,e,t=new Map){let r=es(e.symbol);if(!r)return null;let i=Mr(n,[e.symbolId]);if(i.length===0)return null;let o=new RegExp(`(^|[^A-Za-z0-9_])${le(r)}::default\\b`,"g"),s=new RegExp(`(^|[^A-Za-z0-9_])${le(r)}\\s*$`),a=Xo(n,e.symbolId),c=[];for(let u of i){let f=ns(n,u.relative_path,t);if(f===null)return null;let l=f.split(/\r?\n/),p=0,d=[],S=0;for(let h=u.chunk_start;h<=u.chunk_end&&h<l.length;h+=1){let y=l[h]??"",T=new Set;o.lastIndex=0;let P;for(;P=o.exec(y);)c.push({file:u.relative_path,line:h,column:P.index+P[1].length+r.length+2}),S+=1;for(let I=0;I<y.length;I+=1){let C=Zo.exec(y.slice(I));if(C){if(a&&d.includes(p)){let M=I+C[0].lastIndexOf("default");c.push({file:u.relative_path,line:h,column:M}),T.add(M),S+=1}I+=C[0].length-1;continue}let x=y[I];if(x==="{"){let M=s.test(y.slice(0,I));p+=1,M&&d.push(p);continue}if(x==="}")for(p=Math.max(0,p-1);d.length>0&&d[d.length-1]>p;)d.pop()}for(Dr.lastIndex=0;P=Dr.exec(y);){let I=P.index+9;if(!T.has(I))return null}}if(S===0)return null}return Ne(c)}function Xo(n,e){return n.get("SELECT 1 AS present FROM mentions WHERE symbol_id = ? AND role = 1 LIMIT 1",e)?.present===1}function es(n){let e=/impl#\[([^\]]+)\]\[Default\]default\(\)\./.exec(n)?.[1]??null;return!e||!Qo.test(e)?null:e}function ns(n,e,t){if(t.has(e))return t.get(e)??null;let r=n.get("SELECT text FROM documents WHERE relative_path = ?",e),i=typeof r?.text=="string"?r.text:ts(n,e);return t.set(e,i),i}function ts(n,e){let t=Go(n.config.projectRoot,e);if(!Yo(t))return null;try{return Jo(t,"utf8")}catch{return null}}function xr(n){let e=new Map;for(let t of n){let r=e.get(t.relativePath)??[];r.push(t),e.set(t.relativePath,r)}return e}var rs="typescript-import-usage-v1",is="typescript-signatures-v1",jn=$n("semantic-prefetched-callees",{clearGroups:["whole-project","source-file","semantic-provider"]}),Cr=tn({kind:"semantic-import-usage",invalidation:ce("semantic-import-usage"),serialize:n=>JSON.stringify(n),deserialize:Nr}),kr=tn({kind:"semantic-signatures",invalidation:ce("semantic-signatures"),serialize:n=>JSON.stringify(n),deserialize:ms}),Tr=nn({kind:"typescript-import-usage",invalidation:ce("typescript-import-usage"),serialize:n=>JSON.stringify(n),deserialize:Nr}),wr=nn({kind:"typescript-signatures",invalidation:ce("typescript-signatures"),serialize:n=>JSON.stringify(n),deserialize:ys});function be(n){let e=new Map,t=new Set;return{capability:(r,i)=>_r(n,r,i),importUsage:r=>ss(n,r),references:r=>Pr(n,r),materializeReferences:(r,i)=>Fr(n,r,e,t,i),callerMap:r=>as(n,r,e,t),calleeMap:r=>fs(n,r),signature:r=>ps(n,r)}}function os(n,e){if(e.size===0)return;let t=jn.get(n,()=>new Map);for(let[r,i]of e)t.set(r,[...i])}function Fl(n,e){if(!jn.has(n))return{hits:[],misses:[...e]};let t=jn.get(n,()=>new Map),r=[],i=[];for(let o of e)t.has(o.symbolId)?r.push({definition:o,callees:t.get(o.symbolId)??[]}):i.push(o);return{hits:r,misses:i}}function Al(n,e){return be(n).importUsage(e)}function ss(n,e){if(U(e)==="typescript"){let o="fallback",s=0,a=0,c=0,u=0;return w("typescript.import-usage.materialize",()=>{let f=on(n,e,rs);if(f?.key){s=1;let p=Tr.read(n,e,f.key);if(p)return o="hit",a=1,p;c=1;let d=B(n,e);if(!d)return o="unavailable",[];let S=d.importUsage(e);return Tr.write(n,e,f.key,S),o="computed",S}u=1;let l=B(n,e);return l?(o="direct-fallback",l.importUsage(e)):(o="unavailable",[])},()=>({state:o,eligible:s,cacheHits:a,cacheMisses:c,fallbacks:u}))}let t=Ar(n,"semantic-import-usage",e);if(t){let o=Cr.read(n,e,t);if(o)return o}let r=B(n,e);if(!r)return[];let i=r.importUsage(e);return t&&Cr.write(n,e,t,i),i}function Nl(n,e){return be(n).references(e)}function Pr(n,e){let t=Bn(n,e);if(t)return t;let r=gt(n,e);if(r)return r;let i=B(n,e.relativePath);return i?i.referencesFor(e):[]}function _l(n,e){return be(n).callerMap(e)}function Ll(n,e){let t=new Map,r=new Map;for(let i of e){if(U(i.relativePath)==="typescript"){let o=B(n,i.relativePath);if(!o)continue;let s=r.get(o)??[];s.push(i),r.set(o,s);continue}Wn(n,t,i,Pr(n,i))}for(let[i,o]of r){let s=an(n,o,c=>J(n,c)),a=s?.references??(i.referencesForDefinitions?i.referencesForDefinitions(o,{exact:!0}):new Map(o.map(c=>[c.symbolId,i.referencesFor(c)])));!s&&_()&&sn(n,o,a,c=>J(n,c));for(let c of o)Wn(n,t,c,a.get(c.symbolId)??[])}return t}function as(n,e,t=new Map,r=new Set){let i=new Map,o=Fr(n,e,t,r),s=0;return w("semantic.callers.from-references",()=>{for(let a of e)s+=Wn(n,i,a,t.get(a.symbolId)??[])},()=>({definitions:e.length,materialized:o.definitions,inMemoryHits:o.inMemoryHits,incompleteInMemoryHits:o.incompleteInMemoryHits,resultRows:i.size,callerFiles:s})),i}function Fr(n,e,t,r,i={}){let o=Xe(n),s=[],a=[],c=[],u=0,f=0,l=0,p=0,d=0,S=0,h=0,g=0,y=0,T=0,P=0,I=0,C=[],x=new Map,M=e.filter(m=>U(m.relativePath)==="typescript"&&!t.has(m.symbolId)&&!r.has(m.symbolId)),R=an(n,M,m=>J(n,m));if(R){y=M.length,T=R.cacheHits,P=R.cacheMisses,I=R.computedFiles;for(let m of M)t.set(m.symbolId,R.references.get(m.symbolId)??[])}if(w("semantic.references.cache-scan",()=>{for(let[m,b]of xr(e)){let k=[];for(let D of b)t.has(D.symbolId)?f+=1:r.has(D.symbolId)?g+=1:k.push(D);if(k.length===0){h+=1;continue}let j=cs(n,o,m);if(!j){for(let D of k)U(D.relativePath)||(u+=1),c.push(D);continue}S+=1;let A=Vn(n,m,j);for(let D of k){let N=A.get(D.symbol)??null;if(N!==null){let E=us(N);if(E){l+=1,t.set(D.symbolId,E);continue}p+=1}a.push({definition:D,cacheFingerprint:j})}}},()=>({definitions:e.length,skippedUnsupportedLanguage:u,cacheHits:l,parseFailures:p,misses:a.length,unkeyed:c.length,inMemoryHits:f,incompleteInMemoryHits:g,fullyInMemoryFiles:h,cacheReadFiles:S})),a.length>0||c.length>0){C=[...c,...a.map(m=>m.definition)],x=w("semantic.references.compute-misses",()=>{let m=ls(n,C,i);return d=m.size,m},()=>({definitions:C.length,misses:a.length,unkeyed:c.length,rows:d}));for(let m of C)x.has(m.symbolId)?(t.set(m.symbolId,x.get(m.symbolId)??[]),r.delete(m.symbolId)):r.add(m.symbolId);for(let{definition:m,cacheFingerprint:b}of a)x.has(m.symbolId)&&_r(n,"semantic-references",m.relativePath).available&&s.push({relativePath:m.relativePath,symbol:m.symbol,projectFingerprint:b,payload:JSON.stringify(x.get(m.symbolId)??[])})}return s.length>0&&w("semantic.references.cache-write",()=>Yn(n,s),()=>({entries:s.length})),x.size>0&&sn(n,C,x,m=>J(n,m)),{definitions:e.length,inMemoryHits:f,incompleteInMemoryHits:g,cacheHits:l,misses:a.length,unkeyed:c.length,skippedUnsupportedLanguage:u,parseFailures:p,computed:d,incomplete:r.size,cacheWrites:s.length,fragmentDefinitions:y,fragmentCacheHits:T,fragmentCacheMisses:P,fragmentComputedFiles:I}}function cs(n,e,t){if(!e)return null;let r=U(t);return r==="typescript"?e:r==="rust"?Ze(JSON.stringify({kind:"semantic-references",language:r,engine:pn(n.config.projectRoot),projectFingerprint:e})):null}function ls(n,e,t={}){let r=_(),i=new Map,o=0,s=0,a=0,c=0,u=0,f=0,l=0,p=0,d=0;return w("semantic.references.provider-loop",()=>{let S=vr(n,e),h=St(n,e),g=new Map,y=t.prefetchCallees?new Map:null,T=[];for(let I of e){let C,x=()=>(C??=B(n,I.relativePath),C);if(y){let b=x();if(b?.referencesAndCalleesForDefinitions){let k=y.get(b);k?k.push(I):y.set(b,[I]),d+=1}}let M=S.get(I.symbolId);if(M){a+=1,c+=M.length,Re(i,I.symbolId,M,r,b=>{l+=1,p+=b});continue}let R=h.get(I.symbolId);if(R){u+=1,f+=R.length,Re(i,I.symbolId,R,r,b=>{l+=1,p+=b});continue}let m=x();if(!m){r&&(s+=1);continue}if(r&&(o+=1),m.referencesForDefinitions){let b=g.get(m);b?b.push(I):g.set(m,[I])}else T.push({provider:m,definition:I})}let P=new Set;if(y)for(let[I,C]of y){if(!I.referencesAndCalleesForDefinitions)continue;let x=g.get(I)??[],M=I.referencesAndCalleesForDefinitions(x,C);P.add(I),os(n,M.callees);for(let R of x){if(!M.references.has(R.symbolId))continue;let m=M.references.get(R.symbolId)??[];Re(i,R.symbolId,m,r,b=>{l+=1,p+=b})}}for(let[I,C]of g){if(P.has(I))continue;let x=I.referencesForDefinitions(C);for(let M of C){if(!x.has(M.symbolId))continue;let R=x.get(M.symbolId)??[];Re(i,M.symbolId,R,r,m=>{l+=1,p+=m})}}for(let{provider:I,definition:C}of T){let x=I.referencesFor(C);Re(i,C.symbolId,x,r,M=>{l+=1,p+=M})}return i},()=>({definitions:e.length,providerHits:o,providerMisses:s,rustDefaultFastPathRows:a,rustDefaultFastPathReferences:c,rustScipOccurrenceFastPathRows:u,rustScipOccurrenceFastPathReferences:f,prefetchCalleeDefinitions:d,definitionsWithReferences:l,referenceCount:p,rows:i.size}))}function Re(n,e,t,r,i){n.set(e,t),r&&t.length>0&&i(t.length)}function Wn(n,e,t,r){let i=0;for(let o of r){if(o.file===t.relativePath||n.isIgnored(o.file))continue;let s=e.get(t.symbolId);s||(s=new Set,e.set(t.symbolId,s));let a=s.size;s.add(o.file),s.size!==a&&(i+=1)}return i}function us(n){try{return JSON.parse(n)}catch{return null}}function Ol(n,e){return be(n).calleeMap(e)}function fs(n,e){let t=_(),r=new Map,i=0,o=0,s=0,a=0;return w("semantic.callees.provider-loop",()=>{let c=new Map,u=[];for(let f of e){let l=B(n,f.relativePath);if(!l){t&&(o+=1);continue}t&&(i+=1);let p=f;if(l.calleesForDefinitions){let d=c.get(l);d?d.push(p):c.set(l,[p])}else u.push({provider:l,definition:p})}for(let[f,l]of c){let p=f.calleesForDefinitions(l);for(let d of l){let S=p.get(d.symbolId)??[];Er(r,d.symbolId,S,t,h=>{s+=1,a+=h})}}for(let{provider:f,definition:l}of u){let p=f.calleesFor(l);Er(r,l.symbolId,p,t,d=>{s+=1,a+=d})}return r},()=>({definitions:e.length,providerHits:i,providerMisses:o,definitionsWithCallees:s,calleeCount:a,rows:r.size}))}function Er(n,e,t,r,i){t.length>0&&(n.set(e,t),r&&i(t.length))}function Ul(n,e){return be(n).signature(e)}function ps(n,e){if(U(e.relativePath)==="typescript"){let s="fallback",a=0,c=0,u=0,f=0;return w("typescript.signature.materialize",()=>{let l=on(n,e.relativePath,is);if(l?.key){a=1;let d=wr.read(n,e.relativePath,l.key)??{};if(Object.prototype.hasOwnProperty.call(d,e.symbol))return s="hit",c=1,d[e.symbol]??null;u=1;let S=B(n,e.relativePath);if(!S)return s="unavailable",null;let h=S.signatureFor(e);return wr.write(n,e.relativePath,l.key,{...d,[e.symbol]:h}),s="computed",h}f=1;let p=B(n,e.relativePath);return p?(s="direct-fallback",p.signatureFor(e)):(s="unavailable",null)},()=>({state:s,eligible:a,cacheHits:c,cacheMisses:u,fallbacks:f}))}let t=Ar(n,"semantic-signatures",e.relativePath),r=ds(e);if(t){let s=kr.read(n,r,t);if(s)return s.signature}let i=B(n,e.relativePath);if(!i)return null;let o=i.signatureFor(e);return t&&kr.write(n,r,t,{signature:o}),o}function Ar(n,e,t){let r=Xe(n);if(!r)return null;let i=U(t);return i!=="rust"?null:Ze(JSON.stringify({kind:e,language:i,engine:pn(n.config.projectRoot),projectFingerprint:r}))}function ds(n){return`${n.relativePath}\0${n.symbol}`}function Nr(n){try{let e=JSON.parse(n);return Array.isArray(e)?e:null}catch{return null}}function ms(n){try{let e=JSON.parse(n);if(!e||typeof e!="object")return null;let t=e.signature;return t!==null&&typeof t!="string"?null:{signature:t}}catch{return null}}function ys(n){try{let e=JSON.parse(n);if(!e||typeof e!="object"||Array.isArray(e))return null;for(let t of Object.values(e))if(t!==null&&typeof t!="string")return null;return e}catch{return null}}function _r(n,e,t){let r=U(t);if(!r)return{slot:e,language:"typescript",available:!1,reason:"semantic evidence is only available for TypeScript or Rust files"};try{return{slot:e,language:r,...J(n,t).availability()}}catch(i){return{slot:e,language:r,available:!1,reason:i instanceof Error?i.message:String(i)}}}function B(n,e){if(!U(e))return null;let t=J(n,e);return t.availability().available?t:null}export{ul as a,fl as b,pl as c,Mr as d,xr as e,pn as f,U as g,be as h,Fl as i,Al as j,Nl as k,_l as l,Ll as m,ls as n,Ol as o,Ul as p};
30
+ //# sourceMappingURL=chunk-Z5QQPJ3U.js.map
@@ -1,2 +1,2 @@
1
- import{a as y}from"./chunk-MITTUCEH.js";import{a as F}from"./chunk-25LPM4DG.js";import{a as B}from"./chunk-HEXVUYFQ.js";import{a as j}from"./chunk-4RSI5EMG.js";import{a as z}from"./chunk-F6O7AAC3.js";import{a as $}from"./chunk-I5AWSI2G.js";import{a as v,b as G}from"./chunk-BTEE5NZQ.js";import{a as O}from"./chunk-WER3B7MI.js";import{b as k}from"./chunk-QRGV2F7L.js";import{a as T}from"./chunk-GBQ5NYPR.js";import{a as E}from"./chunk-3MJ5YA4Y.js";import{a as I}from"./chunk-YIJ7ZAA4.js";import{a as H}from"./chunk-4T3LTWUS.js";import{s as A}from"./chunk-L7SPDE73.js";function ne(n,e,o={}){let i=o.impactDepth??3,r=o.sliceDepth??3,c=o.semantic,a=!N(e),u=a?l("trace",e,()=>j(n,e,{semantic:c}),t=>({definitions:t.definitions.length,references:t.referencedBy.length})):{definitions:[],referencedBy:[]},s=a?l("call-graph",e,()=>H(n,e,{semantic:c}),t=>({callers:t?.callers.length??0,callees:t?.callees.length??0})):null,d=a?l("complexity",e,()=>E(n,e,{semantic:c}),t=>({callees:t?.calleeCount??0})):null,g=a?l("dataflow",e,()=>$(n,e,{semantic:c}),t=>({references:t?.usageSites.length??0,producers:t?.producers.length??0,consumers:t?.consumers.length??0})):null,C=a?l("backward-slice",e,()=>y(n,e,{direction:"backward",maxDepth:r,semantic:c}),t=>({maxDepth:r,connectedSymbols:t?.connectedSymbols.length??0})):null,x=a?l("forward-slice",e,()=>y(n,e,{direction:"forward",maxDepth:r,semantic:c}),t=>({maxDepth:r,connectedSymbols:t?.connectedSymbols.length??0})):null,R=a?l("affected",e,()=>I(n,e,{maxDepth:i,scope:o.scope}),t=>({maxDepth:i,affectedSymbols:t.length})):[],h=l("change-surface",e,()=>O(n,e,{semantic:c}),t=>({symbols:t?.symbols.length??0,externalConsumers:t?.totalExternalConsumers??0})),p=l("system",e,()=>B(n,e),t=>({files:t.files.length,symbols:t.symbols.length})),m=p.files.length===1,b=l("deps",e,()=>m?p.dependsOn.map(t=>({relativePath:t})):v(n,e),t=>({files:t.length,reusedSystem:m})),S=l("rdeps",e,()=>m?p.dependedOnBy.map(t=>({relativePath:t})):G(n,e),t=>({files:t.length,reusedSystem:m})),w=l("surface",e,()=>F(n,e),t=>({consumers:t.length})),f={symbol:u.definitions.length>0||u.referencedBy.length>0||s!==null||d!==null||g!==null||C!==null||x!==null||R.length>0,file:h!==null||b.length>0||S.length>0,module:p.files.length>0||p.symbols.length>0||w.length>0},D=[];!f.symbol&&!f.file&&!f.module&&D.push("No symbol, file, or module matched target.");let P=h?.file??u.definitions[0]?.relativePath??null;return{target:e,matched:f,history:l("history",P??e,()=>L(n,P,o.gitHead)),trace:u,callGraph:s,complexity:d,dataflow:g,backwardSlice:C,forwardSlice:x,affected:R,changeSurface:h,deps:b,rdeps:S,system:p,surface:w,warnings:D}}function l(n,e,o,i=()=>({})){let r;return A(`plan-context.${n}`,()=>(r=o(),r),()=>({target:e,...i(r)}))}function L(n,e,o){let i={available:!1,file:e,churn:null,coChangePartners:[],suppressionsInFile:0};if(!e)return i;let r=T(n,o?{head:o}:{}),c=l("history.churn",e,()=>r.fileChurn(),s=>({files:s?.size??0}));if(!c)return i;let a=l("history.co-change",e,()=>k(n,e,{limit:5,...o?{head:o}:{}}),s=>({commits:s.commitsAnalyzed,partners:s.findings.length})),u=l("history.suppressions",e,()=>z(n).byFile.get(e)??0,s=>({suppressions:s}));return{available:!0,file:e,churn:c.get(e)??{changes:0,fixChanges:0,lastChangedAt:0},coChangePartners:a.findings.map(s=>({file:s.fileA===e?s.fileB:s.fileA,together:s.together,confidence:s.confidence,subjectContext:s.subjectContext})),suppressionsInFile:u}}function N(n){return n.includes("/")||n.includes("\\")||/\.[A-Za-z0-9]+(?::\d+(?:-\d+)?)?$/.test(n)}export{ne as a};
2
- //# sourceMappingURL=chunk-NZL2DBT7.js.map
1
+ import{a as y}from"./chunk-UQK5CRUK.js";import{a as F}from"./chunk-CYJM7CYF.js";import{a as B}from"./chunk-SHKZ7OVJ.js";import{a as j}from"./chunk-CSTYYXKC.js";import{a as z}from"./chunk-G4UQL4CP.js";import{a as $}from"./chunk-QQWOFXNW.js";import{a as v,b as G}from"./chunk-7E3TH5ZN.js";import{a as O}from"./chunk-XF3KLXN3.js";import{b as k}from"./chunk-QHKUY4FW.js";import{a as T}from"./chunk-OHWZKLVA.js";import{a as E}from"./chunk-ADFSIJP2.js";import{a as I}from"./chunk-YTUD45PU.js";import{a as H}from"./chunk-S2GP3CU3.js";import{B as A}from"./chunk-B5MHCHP3.js";function ne(n,e,o={}){let i=o.impactDepth??3,r=o.sliceDepth??3,c=o.semantic,a=!N(e),u=a?l("trace",e,()=>j(n,e,{semantic:c}),t=>({definitions:t.definitions.length,references:t.referencedBy.length})):{definitions:[],referencedBy:[]},s=a?l("call-graph",e,()=>H(n,e,{semantic:c}),t=>({callers:t?.callers.length??0,callees:t?.callees.length??0})):null,d=a?l("complexity",e,()=>E(n,e,{semantic:c}),t=>({callees:t?.calleeCount??0})):null,g=a?l("dataflow",e,()=>$(n,e,{semantic:c}),t=>({references:t?.usageSites.length??0,producers:t?.producers.length??0,consumers:t?.consumers.length??0})):null,C=a?l("backward-slice",e,()=>y(n,e,{direction:"backward",maxDepth:r,semantic:c}),t=>({maxDepth:r,connectedSymbols:t?.connectedSymbols.length??0})):null,x=a?l("forward-slice",e,()=>y(n,e,{direction:"forward",maxDepth:r,semantic:c}),t=>({maxDepth:r,connectedSymbols:t?.connectedSymbols.length??0})):null,R=a?l("affected",e,()=>I(n,e,{maxDepth:i,scope:o.scope}),t=>({maxDepth:i,affectedSymbols:t.length})):[],h=l("change-surface",e,()=>O(n,e,{semantic:c}),t=>({symbols:t?.symbols.length??0,externalConsumers:t?.totalExternalConsumers??0})),p=l("system",e,()=>B(n,e),t=>({files:t.files.length,symbols:t.symbols.length})),m=p.files.length===1,b=l("deps",e,()=>m?p.dependsOn.map(t=>({relativePath:t})):v(n,e),t=>({files:t.length,reusedSystem:m})),S=l("rdeps",e,()=>m?p.dependedOnBy.map(t=>({relativePath:t})):G(n,e),t=>({files:t.length,reusedSystem:m})),w=l("surface",e,()=>F(n,e),t=>({consumers:t.length})),f={symbol:u.definitions.length>0||u.referencedBy.length>0||s!==null||d!==null||g!==null||C!==null||x!==null||R.length>0,file:h!==null||b.length>0||S.length>0,module:p.files.length>0||p.symbols.length>0||w.length>0},D=[];!f.symbol&&!f.file&&!f.module&&D.push("No symbol, file, or module matched target.");let P=h?.file??u.definitions[0]?.relativePath??null;return{target:e,matched:f,history:l("history",P??e,()=>L(n,P,o.gitHead)),trace:u,callGraph:s,complexity:d,dataflow:g,backwardSlice:C,forwardSlice:x,affected:R,changeSurface:h,deps:b,rdeps:S,system:p,surface:w,warnings:D}}function l(n,e,o,i=()=>({})){let r;return A(`plan-context.${n}`,()=>(r=o(),r),()=>({target:e,...i(r)}))}function L(n,e,o){let i={available:!1,file:e,churn:null,coChangePartners:[],suppressionsInFile:0};if(!e)return i;let r=T(n,o?{head:o}:{}),c=l("history.churn",e,()=>r.fileChurn(),s=>({files:s?.size??0}));if(!c)return i;let a=l("history.co-change",e,()=>k(n,e,{limit:5,...o?{head:o}:{}}),s=>({commits:s.commitsAnalyzed,partners:s.findings.length})),u=l("history.suppressions",e,()=>z(n).byFile.get(e)??0,s=>({suppressions:s}));return{available:!0,file:e,churn:c.get(e)??{changes:0,fixChanges:0,lastChangedAt:0},coChangePartners:a.findings.map(s=>({file:s.fileA===e?s.fileB:s.fileA,together:s.together,confidence:s.confidence,subjectContext:s.subjectContext})),suppressionsInFile:u}}function N(n){return n.includes("/")||n.includes("\\")||/\.[A-Za-z0-9]+(?::\d+(?:-\d+)?)?$/.test(n)}export{ne as a};
2
+ //# sourceMappingURL=chunk-ZLJLE6LK.js.map
@@ -1,4 +1,4 @@
1
- import{a as _,g as O,j as C,o as $,p as T}from"./chunk-X6D5IC6I.js";import{E as N}from"./chunk-YGAGTIDK.js";import{c as y,h as S,i as x,o as D,v as R,x as E,y as k,z as M}from"./chunk-L7SPDE73.js";import{a as h}from"./chunk-64MNV6AB.js";var V={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function u(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let n=e.split(" ");if(n.length<4)return{scheme:n[0]??"",manager:n[1]??"",packageName:n[2]??"",version:"",descriptors:[],raw:e};let t=n[0],i=n[1],r=e.slice(t.length+1+i.length+1),s;if(r.startsWith("`")){let l=r.indexOf("`",1);l===-1?(s=r.slice(1),r=""):(s=r.slice(1,l),r=r.slice(l+2))}else{let l=r.indexOf(" ");l===-1?(s=r,r=""):(s=r.slice(0,l),r=r.slice(l+1))}let o,a=r.indexOf(" ");a===-1?(o=r,r=""):(o=r.slice(0,a),r=r.slice(a+1));let c=ee(r);return{scheme:t,manager:i,packageName:s,version:o,descriptors:c,raw:e}}function m(e){let n=u(e);if("kind"in n)return null;for(let t=n.descriptors.length-2;t>=0;t--){let i=n.descriptors[t];if(i?.suffix==="type")return i.name}return null}function ee(e){let n=[],t=0;for(;t<e.length;){if(e[t]==="["){let s=e.indexOf("]",t+1);if(s===-1){n.push({name:e.slice(t+1),suffix:"type-param"});break}n.push({name:e.slice(t+1,s),suffix:"type-param"}),t=s+1;continue}if(e[t]==="("&&(n.length===0||t===0||w(e[t-1]))){let s=e.indexOf(")",t+1);if(s!==-1&&e[s+1]!=="."){n.push({name:e.slice(t+1,s),suffix:"parameter"}),t=s+1;continue}}let i;if(e[t]==="`"){let s=e.indexOf("`",t+1);if(s===-1){i=e.slice(t+1),n.push({name:i,suffix:"term"});break}i=e.slice(t+1,s),t=s+1}else{let s=t;for(;t<e.length&&!w(e[t]);)t++;i=e.slice(s,t)}if(t>=e.length){i&&n.push({name:i,suffix:"term"});break}let r=e[t];if(r==="("){let s=e.indexOf(")",t+1);s!==-1&&e[s+1]==="."?(n.push({name:i,suffix:"method"}),t=s+2):s!==-1?(n.push({name:i,suffix:"method"}),t=s+1):(n.push({name:i,suffix:"term"}),t++)}else{let s=V[r];s&&n.push({name:i,suffix:s}),t+=1}}return n}function w(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function A(e){let n=u(e);if("kind"in n&&n.kind==="local")return`local:${n.id}`;let t=n;if(t.descriptors.length===0)return t.raw;let i=[];for(let r of t.descriptors){let s=ne(r);s&&i.push(s)}return i.join(":")}function ne(e){let n=e.suffix==="namespace"?te(e.name):e.name;return n?e.suffix==="method"?`${n}()`:n:""}function te(e){return e.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/,"").replace(/\.(py|pyi)$/,"").replace(/\.(rs)$/,"").replace(/\.(java|scala|kt|kts)$/,"").replace(/\.(rb)$/,"").replace(/\.(go)$/,"").replace(/\.(cs|vb)$/,"").replace(/\.(dart)$/,"").replace(/\.(php)$/,"").replace(/\.(c|cc|cpp|cxx|h|hpp)$/,"")}function v(e){let n=u(e);if("kind"in n&&n.kind==="local")return n.id;let t=n;return t.descriptors.length===0?"":t.descriptors[t.descriptors.length-1].name}function p(e){let n=u(e);if("kind"in n&&n.kind==="local")return null;let t=n;return t.descriptors[t.descriptors.length-1]?.suffix??null}function Ae(e){return e.endsWith("().")||p(e)==="method"}function P(e){let n=p(e);return n==="method"?!0:n!=="term"?!1:e.endsWith("().")?!0:e.startsWith("rust-analyzer ")&&e.includes("#")?!1:e.startsWith("scip-typescript ")?!/#[A-Za-z0-9_$]+\.$/.test(e):!0}function ve(e){return p(e)==="namespace"}var ie=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function Pe(e){return ie.test(e)}var re=new Set(["test","tests","_tests"]);function Qe(e){let n=u(e);if("kind"in n)return!1;for(let t=0;t<n.descriptors.length-1;t+=1){let i=n.descriptors[t];if(i?.suffix==="namespace"&&i.name&&re.has(i.name))return!0}return!1}function je(e,n){let t=u(e),i=u(n);if("kind"in t||"kind"in i)return!1;let r=t.descriptors,s=i.descriptors;if(s.length!==r.length+1)return!1;for(let o=0;o<r.length;o++){let a=r[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function Be(e,n){let t=u(e),i=u(n);if("kind"in t||"kind"in i)return!1;let r=t.descriptors,s=i.descriptors;if(s.length<=r.length)return!1;for(let o=0;o<r.length;o++){let a=r[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function Je(e,n){return e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.start_char, der.end_line, der.end_char, d.relative_path, gs.display_name, gs.documentation
1
+ import{a as _,g as O,j as C,o as $,p as T}from"./chunk-7LABSJSR.js";import{E as N}from"./chunk-DGMCFMPG.js";import{E as R,G as E,H as k,I as M,l as y,q as S,r as x,x as D}from"./chunk-B5MHCHP3.js";import{a as h}from"./chunk-64MNV6AB.js";var V={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function u(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let n=e.split(" ");if(n.length<4)return{scheme:n[0]??"",manager:n[1]??"",packageName:n[2]??"",version:"",descriptors:[],raw:e};let t=n[0],i=n[1],r=e.slice(t.length+1+i.length+1),s;if(r.startsWith("`")){let l=r.indexOf("`",1);l===-1?(s=r.slice(1),r=""):(s=r.slice(1,l),r=r.slice(l+2))}else{let l=r.indexOf(" ");l===-1?(s=r,r=""):(s=r.slice(0,l),r=r.slice(l+1))}let o,a=r.indexOf(" ");a===-1?(o=r,r=""):(o=r.slice(0,a),r=r.slice(a+1));let c=ee(r);return{scheme:t,manager:i,packageName:s,version:o,descriptors:c,raw:e}}function m(e){let n=u(e);if("kind"in n)return null;for(let t=n.descriptors.length-2;t>=0;t--){let i=n.descriptors[t];if(i?.suffix==="type")return i.name}return null}function ee(e){let n=[],t=0;for(;t<e.length;){if(e[t]==="["){let s=e.indexOf("]",t+1);if(s===-1){n.push({name:e.slice(t+1),suffix:"type-param"});break}n.push({name:e.slice(t+1,s),suffix:"type-param"}),t=s+1;continue}if(e[t]==="("&&(n.length===0||t===0||w(e[t-1]))){let s=e.indexOf(")",t+1);if(s!==-1&&e[s+1]!=="."){n.push({name:e.slice(t+1,s),suffix:"parameter"}),t=s+1;continue}}let i;if(e[t]==="`"){let s=e.indexOf("`",t+1);if(s===-1){i=e.slice(t+1),n.push({name:i,suffix:"term"});break}i=e.slice(t+1,s),t=s+1}else{let s=t;for(;t<e.length&&!w(e[t]);)t++;i=e.slice(s,t)}if(t>=e.length){i&&n.push({name:i,suffix:"term"});break}let r=e[t];if(r==="("){let s=e.indexOf(")",t+1);s!==-1&&e[s+1]==="."?(n.push({name:i,suffix:"method"}),t=s+2):s!==-1?(n.push({name:i,suffix:"method"}),t=s+1):(n.push({name:i,suffix:"term"}),t++)}else{let s=V[r];s&&n.push({name:i,suffix:s}),t+=1}}return n}function w(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function A(e){let n=u(e);if("kind"in n&&n.kind==="local")return`local:${n.id}`;let t=n;if(t.descriptors.length===0)return t.raw;let i=[];for(let r of t.descriptors){let s=ne(r);s&&i.push(s)}return i.join(":")}function ne(e){let n=e.suffix==="namespace"?te(e.name):e.name;return n?e.suffix==="method"?`${n}()`:n:""}function te(e){return e.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/,"").replace(/\.(py|pyi)$/,"").replace(/\.(rs)$/,"").replace(/\.(java|scala|kt|kts)$/,"").replace(/\.(rb)$/,"").replace(/\.(go)$/,"").replace(/\.(cs|vb)$/,"").replace(/\.(dart)$/,"").replace(/\.(php)$/,"").replace(/\.(c|cc|cpp|cxx|h|hpp)$/,"")}function v(e){let n=u(e);if("kind"in n&&n.kind==="local")return n.id;let t=n;return t.descriptors.length===0?"":t.descriptors[t.descriptors.length-1].name}function p(e){let n=u(e);if("kind"in n&&n.kind==="local")return null;let t=n;return t.descriptors[t.descriptors.length-1]?.suffix??null}function Ae(e){return e.endsWith("().")||p(e)==="method"}function P(e){let n=p(e);return n==="method"?!0:n!=="term"?!1:e.endsWith("().")?!0:e.startsWith("rust-analyzer ")&&e.includes("#")?!1:e.startsWith("scip-typescript ")?!/#[A-Za-z0-9_$]+\.$/.test(e):!0}function ve(e){return p(e)==="namespace"}var ie=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function Pe(e){return ie.test(e)}var re=new Set(["test","tests","_tests"]);function Qe(e){let n=u(e);if("kind"in n)return!1;for(let t=0;t<n.descriptors.length-1;t+=1){let i=n.descriptors[t];if(i?.suffix==="namespace"&&i.name&&re.has(i.name))return!0}return!1}function je(e,n){let t=u(e),i=u(n);if("kind"in t||"kind"in i)return!1;let r=t.descriptors,s=i.descriptors;if(s.length!==r.length+1)return!1;for(let o=0;o<r.length;o++){let a=r[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function Be(e,n){let t=u(e),i=u(n);if("kind"in t||"kind"in i)return!1;let r=t.descriptors,s=i.descriptors;if(s.length<=r.length)return!1;for(let o=0;o<r.length;o++){let a=r[o],c=s[o];if(a.name!==c.name||a.suffix!==c.suffix)return!1}return!0}function Je(e,n){return e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.start_char, der.end_line, der.end_char, d.relative_path, gs.display_name, gs.documentation
2
2
  FROM global_symbols gs
3
3
  JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
4
4
  JOIN documents d ON der.document_id = d.id
@@ -109,4 +109,4 @@ import{a as _,g as O,j as C,o as $,p as T}from"./chunk-X6D5IC6I.js";import{E as
109
109
  ${e.symbolNoiseFor("gs")}
110
110
  GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
111
111
  ORDER BY d.relative_path, start_line, end_line`,...s)}function Se(e){return`(${e}.symbol LIKE '%().' OR ${e}.symbol LIKE '%()')`}function Z(e,n){return n==="callable"?Se(e):xe(e)}function xe(e){return`(${e}.symbol LIKE '%.' OR ${e}.symbol LIKE '%()')`}function U(e){let n=new Map;for(let t of e){let i=n.get(t.relative_path);i?i.push(t):n.set(t.relative_path,[t])}return n}function pn(e,n,t={}){if(n.length===0)return[];let i=n.flatMap(r=>F(e,r)).filter(r=>!e.isIgnored(r.relativePath));return t.onlyDocumented&&(i=i.filter(r=>r.documentation!==null&&r.documentation!=="")),t.sort&&(i=i.sort((r,s)=>r.relativePath.localeCompare(s.relativePath)||r.startLine-s.startLine||r.endLine-s.endLine)),i.map(r=>({startLine:r.startLine,endLine:r.endLine,symbol:r.symbol,shortName:A(r.symbol),signature:z(J(r.documentation)),relativePath:r.relativePath,enclosingSymbol:r.enclosingSymbol}))}function he(e){let n=new Map,t=e.map((i,r)=>({definition:i,index:r,span:i.endLine-i.startLine})).sort((i,r)=>i.span-r.span||i.index-r.index);for(let{definition:i}of t)for(let r=i.startLine;r<=i.endLine;r+=1)n.has(r)||n.set(r,i);return n}function gn(e,n){let t=H.get(e);return t||(t=he(e),H.set(e,t)),t.get(n)??null}function bn(e,n){let t=F(e,n.relative_path).find(i=>i.symbolId===n.id);return t?{symbolId:t.symbolId,symbol:t.symbol,documentId:t.documentId,startLine:t.startLine,startChar:t.startChar,endLine:t.endLine,endChar:t.endChar,relativePath:t.relativePath}:{symbolId:n.id,symbol:n.symbol,documentId:n.document_id,startLine:n.start_line,startChar:n.start_char??0,endLine:n.end_line,endChar:n.end_char??0,relativePath:n.relative_path}}function q(e,n,t){let i=g(e).forFile(n,{text:!0}).text,r=C(e,n);return r?Re(t,r,i):i?De(t,i):t}function De(e,n){let t=n.split(/\r?\n/),i=_e(e,t),r=Ie(e,i),s=Le(r,t);return Fe(e,s)}function _e(e,n){let t=e.some(r=>b(r.symbol))?$e(n):null,i=new Map;for(let r of e)i.set(r.symbolId,Ce(n,t,r));return i}function Ie(e,n){return e.filter(t=>b(t.symbol)).map(t=>({definition:t,startLine:n.get(t.symbolId)??t.startLine})).sort((t,i)=>t.startLine-i.startLine||t.definition.startLine-i.definition.startLine||t.definition.symbol.localeCompare(i.definition.symbol))}function Le(e,n){let t=new Map;for(let i=0;i<e.length;i+=1){let r=e[i],s=e[i+1],o=s?Math.max(r.startLine,s.startLine-1):n.length-1;t.set(r.definition.symbolId,{startLine:r.startLine,endLine:Te(n,r.definition,r.startLine,o)})}return t}function Fe(e,n){return e.map(t=>{let i=n.get(t.symbolId);return i?{...t,startLine:i.startLine,endLine:i.endLine}:t})}function Re(e,n,t=null){let i=new Map;for(let r of n){let s=i.get(r.name);s?s.push(r):i.set(r.name,[r])}return e.map(r=>{if(!Oe(r)||!r.leaf)return G(r,t);let s=i.get(r.leaf);if(!s||s.length===0)return G(r,t);let o=t?Ee(r,s,t):null;if(o)return{...r,startLine:o.startLine,endLine:o.endLine};let a=s[0],c=Math.abs(a.startLine-r.startLine);for(let l=1;l<s.length;l+=1){let d=s[l],f=Math.abs(d.startLine-r.startLine);f<c&&(a=d,c=f)}return{...r,startLine:a.startLine,endLine:a.endLine}})}function Ee(e,n,t){let i=ke(e.symbol);if(!i)return null;let r=t.split(/\r?\n/),s=new RegExp(`\\b${_(i)}\\b`);for(let o of n){let a=Me(r,o.startLine);if(a&&s.test(a))return o}return null}function ke(e){return e.match(/\/impl#\[([^\]]+)\]/)?.[1]??null}function Me(e,n){for(let t=n;t>=0;t-=1){let i=e[t]?.trim()??"";if(i){if(/^impl\b/.test(i))return Ne(e,t,n);if(/^(?:struct|enum|trait|mod)\b/.test(i))return null}}return null}function Ne(e,n,t){let i=[];for(let r=n;r<=t;r+=1){let s=e[r]??"";if(i.push(s),s.includes("{"))break}return i.join(" ")}function Oe(e){return b(e.symbol)?!0:p(e.symbol)==="term"&&m(e.symbol)===null}function G(e,n){if(!n||!e.leaf||p(e.symbol)!=="term"||m(e.symbol)!==null)return e;let t=_(e.leaf),i=new RegExp(`\\b(?:export\\s+)?(?:const|let|var)\\s+${t}\\b`),s=n.split(/\r?\n/).findIndex(o=>i.test(o));return s>=0?{...e,startLine:s,endLine:s}:e}function Ce(e,n,t){if(!b(t.symbol))return t.startLine;let i=Math.max(0,Math.min(t.startLine,e.length-1));if(!n)return i;let r=n.get(t.leaf);if(!r||r.length===0)return i;let s=null;for(let o of r){let a=Math.abs(o-t.startLine);(!s||a<s.distance)&&(s={line:o,distance:a})}return s?.line??i}function $e(e){let n=/\b(?:function|def|fn)\s+([A-Za-z_$][\w$]*)/g,t=/\b([A-Za-z_$][\w$]*)\s*[:=]\s*(?:async\s*)?(?:function\b|\()/g,i=/^\s*(?:(?:export|public|private|protected|static|readonly|async|abstract|get|set)\s+)*([A-Za-z_$][\w$]*)\s*(?:<[^(]*>)?\s*\(/,r=/\b([A-Za-z_$][\w$]*)\s*\(/g,s=new Map,o=(a,c)=>{let l=s.get(a);if(!l){s.set(a,[c]);return}l[l.length-1]!==c&&l.push(c)};for(let a=0;a<e.length;a+=1){let c=e[a]??"";for(let d of c.matchAll(n))d[1]&&o(d[1],a);for(let d of c.matchAll(t))d[1]&&o(d[1],a);let l=c.match(i);l?.[1]&&o(l[1],a);for(let d of c.matchAll(r))d[1]&&o(d[1],a)}return s}function Te(e,n,t,i){let r=Math.max(t,Math.min(e.length-1,i)),s=Math.max(t,Math.min(r,n.endLine)),o=0,a=0,c=!1;for(let l=t;l<=r;l+=1){let d=we(e[l]??"");for(let f of d)f==="{"?(o+=1,c=!0):f==="}"?o=Math.max(0,o-1):f==="("?a+=1:f===")"&&(a=Math.max(0,a-1));if(c&&o===0||!c&&a===0&&l>=s)return l}return s}function we(e){let n="",t=null,i=!1;for(let r=0;r<e.length;r+=1){let s=e[r],o=e[r+1];if(!t&&s==="/"&&o==="/"){n+=" ".repeat(e.length-r);break}if(t){if(i){i=!1,n+=" ";continue}if(s==="\\"){i=!0,n+=" ";continue}s===t&&(t=null),n+=" ";continue}if(s==='"'||s==="'"||s==="`"){t=s,n+=" ";continue}n+=s}return n}function b(e){return e.includes("().")}function yn(e){let n=u(e);if("kind"in n)return[];let t=[];for(let i=n.descriptors.length-2;i>=0;i-=1){let r=n.descriptors[i];r?.suffix==="type"&&r.name&&t.push(r.name)}return t}export{g as a,u as b,m as c,A as d,v as e,p as f,Ae as g,P as h,ve as i,Pe as j,Qe as k,je as l,Be as m,Je as n,We as o,z as p,J as q,I as r,F as s,un as t,ge as u,fn as v,mn as w,pn as x,he as y,gn as z,bn as A,yn as B};
112
- //# sourceMappingURL=chunk-XYADIZHU.js.map
112
+ //# sourceMappingURL=chunk-ZTTISZ7J.js.map
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{a as U,b as _,c as j,d as T,i as g}from"./chunk-VMNZB6WI.js";import{$c as x,Ac as a,Xc as k,Yc as f,Zc as P,a as E,ad as S,bd as V,h as v,i as D,j as w,ja as A,k as N,l as b,md as W,td as I}from"./chunk-SVLTAG5O.js";import{program as m}from"commander";import{realpathSync as F}from"fs";import{fileURLToPath as de}from"url";var H=new Set(["code","outline","refs"]);function B(e){return e!==void 0&&H.has(e)}async function R(e){if(B(e)){let{directNavigationQueryCommandDescriptors:t}=await import("./direct-navigation-MRMQFIRB.js"),o=t.find(r=>r.id===e);if(!o)throw new Error(`Direct navigation command descriptor is unavailable: ${e}`);return[o]}let{commandDescriptors:n}=await import("./command-descriptors-MFU4BCJ7.js");return n}function O(e){return e.evidence?e.evidence:J.has(e.id)?"mixed":e.heuristic?"heuristic":"graph-fact"}var J=new Set(["diff-gate","health","plan-context","co-change"]);function M(e,n){return I(new Map(n.map(t=>[t.id,O(t)]))),n.map(t=>{let o=t.hidden?e.command(t.command,{hidden:!0}):e.command(t.command);o.description(t.description);for(let r of t.arguments??[])o.argument(r.name);for(let r of t.options??[])r.parser&&Object.hasOwn(r,"defaultValue")?o.option(r.flags,r.description,r.parser,r.defaultValue):r.parser?o.option(r.flags,r.description,r.parser):Object.hasOwn(r,"defaultValue")?o.option(r.flags,r.description,r.defaultValue):o.option(r.flags,r.description);return o.action(async(...r)=>{try{await t.handler(...r)}catch(i){z(i)}}),{descriptor:t,command:o}})}function z(e){let n=e instanceof Error?e.message:String(e);console.error(`error: ${n}`),process.exitCode=1}import{existsSync as K,mkdirSync as Q,readFileSync as X,writeFileSync as Y}from"fs";import{homedir as Z}from"os";import{join as p}from"path";var ee=1440*60*1e3,L="update-check.json",ne="https://registry.npmjs.org/scip-query/latest";async function h(e={}){let n=e.env??process.env;if(n.SCIP_QUERY_UPDATE_CHECK==="0"||n.NO_UPDATE_NOTIFIER||e.commandName&&te(e.commandName))return;let t=e.cacheDir??ie(n),o=e.now??Date.now(),r=e.currentVersion??a,i=ae(t),c=i&&o-i.checkedAt<ee?i.latestVersion:await ce(t,e.fetchLatestVersion??me,o);if(!c||!oe(c,r))return;(e.writeNotice??(s=>console.error(s)))(re(r,c))}function te(e){return e==="hook-context"||e==="hook-stop"}function re(e,n){return[`scip-query update available: ${e} -> ${n}.`,"Agent: tell your human to update with: npm install -g scip-query@latest",""].join(`
3
- `)}function oe(e,n){let t=$(e),o=$(n);if(!t||!o)return e!==n;for(let r=0;r<t.length;r++){let i=t[r]-o[r];if(i>0)return!0;if(i<0)return!1}return!1}function ie(e){let n=e.XDG_CACHE_HOME||p(Z(),".cache");return p(n,"scip-query")}function ae(e){let n=p(e,L);if(!K(n))return null;try{let t=JSON.parse(X(n,"utf8"));return typeof t.checkedAt=="number"&&(typeof t.latestVersion=="string"||t.latestVersion===null)?{checkedAt:t.checkedAt,latestVersion:t.latestVersion}:null}catch{return null}}async function ce(e,n,t){let o;try{o=await n()}catch{o=null}return se(e,{checkedAt:t,latestVersion:o}),o}function se(e,n){try{Q(e,{recursive:!0}),Y(p(e,L),`${JSON.stringify(n,null,2)}
4
- `)}catch{}}async function me(){let e=await fetch(ne,{signal:AbortSignal.timeout(1e3)});if(!e.ok)return null;let n=await e.json();return typeof n.version=="string"?n.version:null}function $(e){let n=/^v?(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(e);return n?[Number(n[1]),Number(n[2]),Number(n[3])]:null}m.name("scip-query").description("Language-agnostic code intelligence CLI powered by SCIP indexes").version(a);var pe=await R(q()?process.argv[2]:void 0);M(m,pe);m.hook("preAction",async(e,n)=>{let t=n.name(),o=S(t),r=_(t);if(!o&&!r){G(),await h({commandName:t});return}let i=k(),c=A(i),l=P(i,c);f(l),G(),await h({commandName:t});let{config:s,paths:u}=l,C;if(r&&s.watch?.enabled===!0)try{C=U(T({projectRoot:i,cacheDir:u.cacheDir,cliVersion:a,gitContext:c}))}catch{}if(o){let y=x(i,s,u,{gitContext:c,watcherGeneration:C});y.kind==="failed"&&process.env.SCIP_QUERY_DEBUG&&console.error(`shared-cache: ${y.reason}`)}if(!r){g(i,a);return}let d=j({commandName:t,projectRoot:i,cacheDir:u.cacheDir,cliVersion:a,config:s,gitContext:c});d.kind==="failed"&&console.error(`warning: scip-query watch service did not start: ${d.message}`),(d.kind==="failed"||d.kind==="skipped")&&g(i,a)});m.hook("postAction",()=>f(void 0));function G(){if(w(),!v()||N())return;let e=null;try{e=V(n=>E(n))}catch{}b({command:D()??`scip-query ${process.argv.slice(2).join(" ")}`,toolVersion:a,projectFingerprint:e})}q()&&await m.parseAsync();function q(){if(!process.argv[1])return!1;let e=de(import.meta.url);try{return F(e)===F(process.argv[1])}catch{return e===process.argv[1]}}export{m as program,W as renderHeuristicNotice};
2
+ import{b as _,c as T,d as j,e as O,j as g}from"./chunk-KP4KBDVF.js";import{Dd as P,Ea as A,Ed as f,Fd as S,Hd as k,Id as x,Jd as V,Yd as H,de as I,ee as U,fd as a,l as E,s as v,t as w,u as D,v as N,w as b}from"./chunk-JJJCO4QC.js";import{program as m}from"commander";import{realpathSync as G}from"fs";import{fileURLToPath as pe}from"url";var J=new Set(["code","outline","refs"]);function B(e){return e!==void 0&&J.has(e)}async function R(e){if(B(e)){let{directNavigationQueryCommandDescriptors:n}=await import("./direct-navigation-HTKOZEOM.js"),o=n.find(r=>r.id===e);if(!o)throw new Error(`Direct navigation command descriptor is unavailable: ${e}`);return[o]}let{commandDescriptors:t}=await import("./command-descriptors-SJDZ7QGR.js");return t}function M(e){return e.evidence?e.evidence:z.has(e.id)?"mixed":e.heuristic?"heuristic":"graph-fact"}var z=new Set(["diff-gate","health","plan-context","co-change"]);function L(e,t){return I(new Map(t.map(n=>[n.id,M(n)]))),U(new Map(t.flatMap(n=>n.agent?[[n.id,n.agent]]:[]))),t.map(n=>{let o=n.hidden?e.command(n.command,{hidden:!0}):e.command(n.command);o.description(n.description);for(let r of n.arguments??[])o.argument(r.name);for(let r of n.options??[])r.parser&&Object.hasOwn(r,"defaultValue")?o.option(r.flags,r.description,r.parser,r.defaultValue):r.parser?o.option(r.flags,r.description,r.parser):Object.hasOwn(r,"defaultValue")?o.option(r.flags,r.description,r.defaultValue):o.option(r.flags,r.description);return o.action(async(...r)=>{try{await n.handler(...r)}catch(i){K(i)}}),{descriptor:n,command:o}})}function K(e){let t=e instanceof Error?e.message:String(e);console.error(`error: ${t}`),process.exitCode=1}import{existsSync as Q,mkdirSync as X,readFileSync as Y,writeFileSync as Z}from"fs";import{homedir as ee}from"os";import{join as p}from"path";var ne=1440*60*1e3,F="update-check.json",te="https://registry.npmjs.org/scip-query/latest";async function h(e={}){let t=e.env??process.env;if(t.SCIP_QUERY_UPDATE_CHECK==="0"||t.NO_UPDATE_NOTIFIER||e.commandName&&re(e.commandName))return;let n=e.cacheDir??ae(t),o=e.now??Date.now(),r=e.currentVersion??a,i=ce(n),c=i&&o-i.checkedAt<ne?i.latestVersion:await se(n,e.fetchLatestVersion??de,o);if(!c||!ie(c,r))return;(e.writeNotice??(s=>console.error(s)))(oe(r,c))}function re(e){return e==="hook-context"||e==="hook-stop"}function oe(e,t){return[`scip-query update available: ${e} -> ${t}.`,"Agent: tell your human to update with: npm install -g scip-query@latest",""].join(`
3
+ `)}function ie(e,t){let n=$(e),o=$(t);if(!n||!o)return e!==t;for(let r=0;r<n.length;r++){let i=n[r]-o[r];if(i>0)return!0;if(i<0)return!1}return!1}function ae(e){let t=e.XDG_CACHE_HOME||p(ee(),".cache");return p(t,"scip-query")}function ce(e){let t=p(e,F);if(!Q(t))return null;try{let n=JSON.parse(Y(t,"utf8"));return typeof n.checkedAt=="number"&&(typeof n.latestVersion=="string"||n.latestVersion===null)?{checkedAt:n.checkedAt,latestVersion:n.latestVersion}:null}catch{return null}}async function se(e,t,n){let o;try{o=await t()}catch{o=null}return me(e,{checkedAt:n,latestVersion:o}),o}function me(e,t){try{X(e,{recursive:!0}),Z(p(e,F),`${JSON.stringify(t,null,2)}
4
+ `)}catch{}}async function de(){let e=await fetch(te,{signal:AbortSignal.timeout(1e3)});if(!e.ok)return null;let t=await e.json();return typeof t.version=="string"?t.version:null}function $(e){let t=/^v?(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(e);return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}m.name("scip-query").description("Language-agnostic code intelligence CLI powered by SCIP indexes").version(a);var le=await R(W()?process.argv[2]:void 0);L(m,le);m.hook("preAction",async(e,t)=>{let n=t.name(),o=x(n),r=T(n);if(!o&&!r){q(),await h({commandName:n});return}let i=P(),c=A(i),l=S(i,c);f(l),q(),await h({commandName:n});let{config:s,paths:u}=l,C;if(r&&s.watch?.enabled===!0)try{C=_(O({projectRoot:i,cacheDir:u.cacheDir,cliVersion:a,gitContext:c}))}catch{}if(o){let y=k(i,s,u,{gitContext:c,watcherGeneration:C});y.kind==="failed"&&process.env.SCIP_QUERY_DEBUG&&console.error(`shared-cache: ${y.reason}`)}if(!r){g(i,a);return}let d=j({commandName:n,projectRoot:i,cacheDir:u.cacheDir,cliVersion:a,config:s,gitContext:c});d.kind==="failed"&&console.error(`warning: scip-query watch service did not start: ${d.message}`),(d.kind==="failed"||d.kind==="skipped")&&g(i,a)});m.hook("postAction",()=>f(void 0));function q(){if(D(),!v()||N())return;let e=null;try{e=V(t=>E(t))}catch{}b({command:w()??`scip-query ${process.argv.slice(2).join(" ")}`,toolVersion:a,projectFingerprint:e})}W()&&await m.parseAsync();function W(){if(!process.argv[1])return!1;let e=pe(import.meta.url);try{return G(e)===G(process.argv[1])}catch{return e===process.argv[1]}}export{m as program,H as renderHeuristicNotice};
5
5
  //# sourceMappingURL=cli.js.map