scip-query 0.22.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +500 -0
- package/README.md +13 -0
- package/dist/augment-vue-worker.js +1 -1
- package/dist/by-kind-H3P6BR5G.js +2 -0
- package/dist/call-graph-VTG2CUOQ.js +2 -0
- package/dist/call-graph-evidence-BociKRpF.d.ts +19 -0
- package/dist/chunk-2BMSSRBH.js +2 -0
- package/dist/{chunk-TAYD3AE7.js → chunk-2GJSD5GY.js} +2 -2
- package/dist/{chunk-TUQIPUDS.js → chunk-2M2LSIMY.js} +3 -3
- package/dist/{chunk-GIQ6CSL4.js → chunk-2N6WBNDC.js} +2 -2
- package/dist/{chunk-JHH5SCZ3.js → chunk-2OOY75BW.js} +2 -2
- package/dist/{chunk-EELPBR7E.js → chunk-2USA3S3P.js} +2 -2
- package/dist/chunk-2VAHDDLM.js +133 -0
- package/dist/chunk-2XWIUW5Z.js +455 -0
- package/dist/{chunk-57N6LN2A.js → chunk-3AF4TUFK.js} +2 -2
- package/dist/chunk-3D4BOXW6.js +20 -0
- package/dist/{chunk-FFJQZG6J.js → chunk-3LO4FST5.js} +2 -2
- package/dist/{chunk-HXOU4XNH.js → chunk-3WTY4LP2.js} +2 -2
- package/dist/{chunk-DPWKKNKI.js → chunk-3Z5AMSK6.js} +2 -2
- package/dist/{chunk-F24G5NBE.js → chunk-44IETFOU.js} +2 -2
- package/dist/chunk-4FR6GQIT.js +2 -0
- package/dist/chunk-4KBTHJLP.js +2 -0
- package/dist/chunk-5BIKR67W.js +2 -0
- package/dist/{chunk-DJAO2OZJ.js → chunk-5PROPLHI.js} +2 -2
- package/dist/chunk-5V7EPTII.js +2 -0
- package/dist/{chunk-VZ7NXSHV.js → chunk-62LPZCBQ.js} +2 -2
- package/dist/{chunk-LXQUF2RP.js → chunk-64O2JHQA.js} +2 -2
- package/dist/chunk-6D4F5VWG.js +10 -0
- package/dist/{chunk-NEIQPFBI.js → chunk-6ERFBC3X.js} +2 -2
- package/dist/{chunk-4HE7MVWD.js → chunk-6ILKOOGH.js} +2 -2
- package/dist/chunk-6MFXCMZC.js +2 -0
- package/dist/chunk-6O7FACKB.js +2 -0
- package/dist/{chunk-R6M456QG.js → chunk-6TS3KOXR.js} +2 -2
- package/dist/{chunk-7U2YQSDE.js → chunk-76QOU4PK.js} +2 -2
- package/dist/{chunk-25GWKRUZ.js → chunk-7DUI77BN.js} +2 -2
- package/dist/chunk-7F45LJKI.js +2 -0
- package/dist/{chunk-DEAB5TGT.js → chunk-7F7T6DCR.js} +2 -2
- package/dist/chunk-7H6VHWWJ.js +2 -0
- package/dist/chunk-7HXT6YLU.js +5 -0
- package/dist/{chunk-KZYID5KV.js → chunk-7R4V5ES6.js} +4 -4
- package/dist/chunk-7RIRIADH.js +7 -0
- package/dist/chunk-7ZLWLOGT.js +2 -0
- package/dist/{chunk-WHADK6OS.js → chunk-A4WEAK35.js} +2 -2
- package/dist/chunk-AADQLOQ4.js +38 -0
- package/dist/{chunk-XFMVKFSF.js → chunk-AN76MGUE.js} +2 -2
- package/dist/chunk-ANLNLY66.js +2 -0
- package/dist/chunk-ATXPTSEI.js +81 -0
- package/dist/{chunk-EELG7D3Q.js → chunk-AX7IDVFT.js} +2 -2
- package/dist/chunk-B3PYOSCX.js +2 -0
- package/dist/chunk-B7MPDEAK.js +3 -0
- package/dist/chunk-BBB5FBX4.js +2 -0
- package/dist/{chunk-Y2VM4CJC.js → chunk-BHKK5RJY.js} +2 -2
- package/dist/chunk-BJWFVAA5.js +2 -0
- package/dist/chunk-BKVWUP7Y.js +2 -0
- package/dist/{chunk-7XA3OM44.js → chunk-BKZYTLGE.js} +2 -2
- package/dist/chunk-BL6DCHQP.js +2 -0
- package/dist/chunk-BOW7SSQH.js +43 -0
- package/dist/{chunk-KQHJEU6V.js → chunk-C4RHHCKL.js} +2 -2
- package/dist/chunk-C7C6AKAT.js +117 -0
- package/dist/chunk-CD6M6LS2.js +16 -0
- package/dist/chunk-CFE6PSG6.js +2 -0
- package/dist/{chunk-GPGRZJ3R.js → chunk-CFNIGQMT.js} +2 -2
- package/dist/{chunk-K3XFWJI2.js → chunk-CKBUBRYD.js} +2 -2
- package/dist/chunk-CZW5MZ5B.js +2 -0
- package/dist/chunk-DBBZ63ZX.js +2 -0
- package/dist/chunk-DBN7DMJB.js +18 -0
- package/dist/{chunk-CKRWA452.js → chunk-DUULLZHZ.js} +2 -2
- package/dist/{chunk-6HRZQLOI.js → chunk-DV5Y5NOS.js} +2 -2
- package/dist/chunk-DZOIKCTM.js +3 -0
- package/dist/chunk-E4PKTOL3.js +2 -0
- package/dist/{chunk-GVOMSPGL.js → chunk-E65ELFKU.js} +2 -2
- package/dist/{chunk-VXJJTQYE.js → chunk-E7QR35ST.js} +2 -2
- package/dist/{chunk-2RE5OCHZ.js → chunk-EFSXAINW.js} +2 -2
- package/dist/{chunk-GY7CCCEZ.js → chunk-EHVEIEQN.js} +2 -2
- package/dist/{chunk-BVFYEEBH.js → chunk-EHYDXE3Z.js} +2 -2
- package/dist/{chunk-HISEUIL2.js → chunk-EP63Y6LD.js} +2 -2
- package/dist/chunk-EPX6NQN6.js +4 -0
- package/dist/chunk-ETC674NS.js +5 -0
- package/dist/{chunk-5H5WTJSD.js → chunk-F5GSBHC6.js} +2 -2
- package/dist/chunk-FH3DGXC6.js +2 -0
- package/dist/{chunk-2XCGSDIT.js → chunk-FI7VGOR4.js} +2 -2
- package/dist/chunk-FJF6VO2P.js +2 -0
- package/dist/{chunk-FELGD32K.js → chunk-FLMTCX5R.js} +2 -2
- package/dist/chunk-FVFDOIM3.js +2 -0
- package/dist/{chunk-AQ2PORIO.js → chunk-G2HU5WRN.js} +2 -2
- package/dist/{chunk-7YQOCABQ.js → chunk-G4ALYS4J.js} +2 -2
- package/dist/{chunk-SWK4XPUS.js → chunk-G56I7K4W.js} +2 -2
- package/dist/{chunk-JFQBRL3J.js → chunk-GC4DG2V5.js} +2 -2
- package/dist/chunk-GG45PK4S.js +4 -0
- package/dist/{chunk-XN22RGSR.js → chunk-GHNPACNP.js} +2 -2
- package/dist/{chunk-XU75YQN4.js → chunk-GINH3YQU.js} +2 -2
- package/dist/chunk-GTZZVLKJ.js +2 -0
- package/dist/chunk-GXXW5ZHH.js +2 -0
- package/dist/{chunk-RNKPYYYE.js → chunk-HAXXKRTD.js} +2 -2
- package/dist/chunk-HEZWBAZY.js +2 -0
- package/dist/chunk-HMEWLMML.js +2 -0
- package/dist/{chunk-2KVU55CW.js → chunk-HOBOVYPO.js} +2 -2
- package/dist/{chunk-2YC7YNKT.js → chunk-HRFQ6GW5.js} +2 -2
- package/dist/{chunk-RYOYJMGF.js → chunk-HX4X7KG3.js} +2 -2
- package/dist/{chunk-AZS7YPCB.js → chunk-HYT2R7LX.js} +2 -2
- package/dist/chunk-IKQVBVQL.js +40 -0
- package/dist/chunk-J6GLBBRK.js +4 -0
- package/dist/{chunk-TNG2FYS5.js → chunk-J7A4PWFX.js} +2 -2
- package/dist/chunk-JCSAZ35V.js +2 -0
- package/dist/{chunk-EWWY2ZFL.js → chunk-JDU2IV3A.js} +2 -2
- package/dist/{chunk-SB25YMEQ.js → chunk-JFMEXGFE.js} +2 -2
- package/dist/chunk-JFMI5SGB.js +4 -0
- package/dist/chunk-JJP37RGX.js +57 -0
- package/dist/chunk-JZ2A7LDM.js +5 -0
- package/dist/chunk-KNLQGXVH.js +80 -0
- package/dist/chunk-KVQCECPR.js +2 -0
- package/dist/{chunk-F24QUEQP.js → chunk-KXXORBZ2.js} +2 -2
- package/dist/{chunk-IKVNEGTW.js → chunk-L5KYH6U3.js} +2 -2
- package/dist/chunk-L6XHYJPZ.js +21 -0
- package/dist/chunk-L7KTFEAV.js +43 -0
- package/dist/{chunk-UAQ4T73O.js → chunk-LDXHR5EL.js} +2 -2
- package/dist/chunk-LEECKFCJ.js +2 -0
- package/dist/{chunk-LO5JSW2C.js → chunk-MHGDSBFX.js} +2 -2
- package/dist/{chunk-JUN5DOAK.js → chunk-MLQVVDG3.js} +2 -2
- package/dist/chunk-MOKUWRHO.js +3 -0
- package/dist/{chunk-44T4DUAA.js → chunk-MPYAPMNE.js} +2 -2
- package/dist/{chunk-ARVO6TTW.js → chunk-MV6SPXCR.js} +2 -2
- package/dist/{chunk-NRBNAECH.js → chunk-MWN53KRN.js} +2 -2
- package/dist/{chunk-TH6IC56G.js → chunk-MZPXPSUJ.js} +2 -2
- package/dist/{chunk-FBCVASUG.js → chunk-N55KIE46.js} +2 -2
- package/dist/{chunk-VMWUV6WB.js → chunk-NB4D3BNM.js} +2 -2
- package/dist/{chunk-JAT6C3VX.js → chunk-NGKBOT6G.js} +2 -2
- package/dist/{chunk-Q6T2CAJL.js → chunk-NJGKXKQF.js} +2 -2
- package/dist/chunk-NJQISBL4.js +8 -0
- package/dist/chunk-NJT3ZEKY.js +16 -0
- package/dist/{chunk-KFVSJX25.js → chunk-NKMKZP6A.js} +2 -2
- package/dist/chunk-NODFZ6ED.js +2 -0
- package/dist/{chunk-ERCYGVAM.js → chunk-NSM5IEVW.js} +2 -2
- package/dist/{chunk-YAGYMBEX.js → chunk-NTGUVNR2.js} +2 -2
- package/dist/{chunk-N7FP5H5U.js → chunk-NU3KFF2O.js} +8 -8
- package/dist/chunk-NWLVNU66.js +557 -0
- package/dist/{chunk-Q55NF3ZG.js → chunk-NYKZMCRC.js} +2 -2
- package/dist/{chunk-I6UTXNHU.js → chunk-O6BUXZEH.js} +2 -2
- package/dist/chunk-ODPDP7A4.js +3 -0
- package/dist/{chunk-ZAZGGSM3.js → chunk-OHIV323X.js} +2 -2
- package/dist/chunk-OIAPEKMT.js +3 -0
- package/dist/chunk-OIOC5EHF.js +3 -0
- package/dist/{chunk-YIHNPKWD.js → chunk-ONPPQM4G.js} +2 -2
- package/dist/{chunk-RHHCLWQ6.js → chunk-OUHEZBYI.js} +2 -2
- package/dist/{chunk-MSR2QRUE.js → chunk-OVGYW7UD.js} +2 -2
- package/dist/{chunk-OPSAW5DT.js → chunk-OYKU4B3Y.js} +2 -2
- package/dist/{chunk-5YRQIE2B.js → chunk-POBJ6FR2.js} +2 -2
- package/dist/{chunk-ZGW4HLPD.js → chunk-PSZPMMWN.js} +2 -2
- package/dist/chunk-PXTRBKRK.js +3 -0
- package/dist/{chunk-U2N2KE7A.js → chunk-Q5JRIHT3.js} +2 -2
- package/dist/{chunk-GRX7JOXQ.js → chunk-Q7ATHARX.js} +2 -2
- package/dist/{chunk-5ZMBRQFC.js → chunk-Q7CSKIDM.js} +2 -2
- package/dist/{chunk-HG722PO7.js → chunk-QBQE7ZJ5.js} +2 -2
- package/dist/{chunk-Z2PZVKPR.js → chunk-QH22UIXP.js} +2 -2
- package/dist/chunk-QXCKQTKR.js +60 -0
- package/dist/chunk-RBAD4GJ2.js +13 -0
- package/dist/chunk-RMDPFPNW.js +2 -0
- package/dist/chunk-ROPJDEJZ.js +4 -0
- package/dist/{chunk-56NQAEPJ.js → chunk-RVZC6TJE.js} +2 -2
- package/dist/{chunk-XJX6LGHL.js → chunk-S4QZBKSR.js} +2 -2
- package/dist/chunk-SCPMZ73U.js +2 -0
- package/dist/{chunk-7IQXARSQ.js → chunk-SIAP5RGI.js} +2 -2
- package/dist/{chunk-4TQU4TX2.js → chunk-SIX4RFR3.js} +2 -2
- package/dist/{chunk-AYPDH2LU.js → chunk-SKKXTABJ.js} +2 -2
- package/dist/{chunk-ZYM4HOFA.js → chunk-SSRFUQBD.js} +2 -2
- package/dist/chunk-SYVJEEUJ.js +3 -0
- package/dist/chunk-T3CZAZSI.js +8 -0
- package/dist/chunk-T3I6NHBH.js +2 -0
- package/dist/{chunk-GDRJB3SB.js → chunk-T6DWDI5E.js} +2 -2
- package/dist/chunk-T6HRIROJ.js +7 -0
- package/dist/{chunk-OTSPRVNW.js → chunk-TAA7HXHE.js} +2 -2
- package/dist/{chunk-IJMD6BRI.js → chunk-TJ2JQYT3.js} +2 -2
- package/dist/chunk-TULNMD5T.js +368 -0
- package/dist/chunk-U2FPY5XA.js +3 -0
- package/dist/chunk-U3SXIMII.js +38 -0
- package/dist/{chunk-ENWQWA2R.js → chunk-U6KCHXJ4.js} +2 -2
- package/dist/chunk-UH3XSKS5.js +9 -0
- package/dist/{chunk-UDY7MIAW.js → chunk-UIFUZVCC.js} +2 -2
- package/dist/{chunk-BDGTPN27.js → chunk-UXKURIVI.js} +2 -2
- package/dist/{chunk-FGNCOQUX.js → chunk-V2RBODHL.js} +2 -2
- package/dist/chunk-VBKUWB6N.js +2 -0
- package/dist/{chunk-PIFTZEEM.js → chunk-VBV6ALJE.js} +2 -2
- package/dist/{chunk-2OXVP5U5.js → chunk-VDGFWCQV.js} +2 -2
- package/dist/chunk-VDSDOEWF.js +2 -0
- package/dist/{chunk-C76O5MDS.js → chunk-VZPWVCLN.js} +2 -2
- package/dist/chunk-WDSFQDPN.js +2 -0
- package/dist/{chunk-BTVKZGWT.js → chunk-WFA35BGR.js} +2 -2
- package/dist/{chunk-H7CG6LOE.js → chunk-WLMP3OCW.js} +2 -2
- package/dist/{chunk-WOOAY3PA.js → chunk-WSA52GOR.js} +2 -2
- package/dist/chunk-WYPL7GF7.js +2 -0
- package/dist/{chunk-RDULNRSJ.js → chunk-X3YVZAKZ.js} +2 -2
- package/dist/chunk-X6OGVFIT.js +2 -0
- package/dist/{chunk-ISWFRGJ6.js → chunk-XKXTR6ZI.js} +2 -2
- package/dist/chunk-Y5DFAW5W.js +4 -0
- package/dist/chunk-YSYPDRD5.js +3 -0
- package/dist/chunk-ZFVPWH62.js +5 -0
- package/dist/chunk-ZGIHTH27.js +2 -0
- package/dist/{chunk-QKT4UI2Y.js → chunk-ZGIQN2SX.js} +2 -2
- package/dist/chunk-ZHG4WAHR.js +12 -0
- package/dist/{chunk-CLG6DWVS.js → chunk-ZKB2XUEN.js} +2 -2
- package/dist/chunk-ZLMXIQLC.js +21 -0
- package/dist/chunk-ZMCQIHI4.js +2 -0
- package/dist/cli-main.js +2 -2
- package/dist/code-TAVIKWJI.js +2 -0
- package/dist/code-result-json-5FEFQCAQ.js +2 -0
- package/dist/command-descriptors-7BKH53Y3.js +343 -0
- package/dist/dataflow-GFBTVDH3.js +2 -0
- package/dist/dependence-slice-GWGQCODG.js +2 -0
- package/dist/deps-4QHVDPYA.js +2 -0
- package/dist/direct-navigation-4UBC6HNW.js +3 -0
- package/dist/entry-map-QCTF4RVY.js +2 -0
- package/dist/files-M2UBF5HJ.js +2 -0
- package/dist/frontend-profile-roles-D7eCum8P.d.ts +10 -0
- package/dist/{health-CPp2Jf1Z.d.ts → health-BI2a9WPy.d.ts} +60 -2
- package/dist/hierarchy-2UIHRLW4.js +2 -0
- package/dist/imports-WIE3YZOB.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/members-YKD636DA.js +2 -0
- package/dist/methods-VDF4IMYG.js +2 -0
- package/dist/output-continuation-command-4UMDOOLO.js +3 -0
- package/dist/output-pagination-2GME6OPY.js +19 -0
- package/dist/postinstall.js +1 -1
- package/dist/project-reindex-XEQTRCV5.js +3 -0
- package/dist/queries/affected.js +1 -1
- package/dist/queries/anchors.d.ts +1 -1
- package/dist/queries/anchors.js +1 -1
- package/dist/queries/architecture.js +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +2 -0
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +20 -2
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/context.js +1 -1
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +2 -0
- package/dist/queries/dead.js +1 -1
- package/dist/queries/decorative-checkers.js +1 -1
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/dependence-slice.js +1 -1
- package/dist/queries/dependency-depth.js +1 -1
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.d.ts +9 -0
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.d.ts +28 -1
- package/dist/queries/duplicate-bodies.js +1 -1
- package/dist/queries/entry-map.d.ts +1 -1
- package/dist/queries/entry-map.js +1 -1
- package/dist/queries/evidence.js +1 -1
- package/dist/queries/extract-candidates.d.ts +50 -23
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +1 -1
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +4 -3
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/not-implemented.js +1 -1
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +9 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +19 -3
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +22 -3
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +17 -3
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/reference-neighborhood.js +1 -1
- package/dist/queries/reference-reachability.js +1 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +7 -1
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.js +1 -1
- package/dist/queries/source-inspection.js +1 -1
- package/dist/queries/source-search.js +1 -1
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system-map.d.ts +1 -1
- package/dist/queries/system-map.js +1 -1
- package/dist/queries/system.js +1 -1
- package/dist/queries/test-quality.js +1 -1
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.js +1 -1
- package/dist/queries/twin-drift.d.ts +22 -6
- package/dist/queries/twin-drift.js +1 -1
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/value-flow.js +1 -1
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +16 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/query-service-fastpath.js +5 -5
- package/dist/query-service-server.js +3 -3
- package/dist/refs-JNK5CLM7.js +2 -0
- package/dist/refs-pagination-6BLRYGMV.js +2 -0
- package/dist/reindex-worker.js +25 -25
- package/dist/reindex.d.ts +3 -2
- package/dist/reindex.js +35 -35
- package/dist/runtime.d.ts +34 -2
- package/dist/runtime.js +4 -4
- package/dist/rust-semantic-session-server.js +1 -1
- package/dist/rust-semantic-session-worker.js +1 -1
- package/dist/rust-semantic-worker.js +1 -1
- package/dist/{scip-cli-H-n59izO.d.ts → scip-cli-DOerTq-R.d.ts} +42 -4
- package/dist/slice-PHPVNCWX.js +2 -0
- package/dist/surface-MQX5MPIV.js +2 -0
- package/dist/symbol-resolution-DBLVXLBC.js +2 -0
- package/dist/system-JOPKV4OG.js +2 -0
- package/dist/trace-I2P2YFH4.js +2 -0
- package/dist/typescript-mailbox-worker.js +1 -1
- package/dist/value-flow-JJVMF7NP.js +2 -0
- package/dist/watch-server.js +3 -3
- package/docs/COMMAND_REFERENCE.md +2 -2
- package/docs/DETECTOR_GUIDE.md +51 -12
- package/docs/accuracy-audit-checklist.md +36 -13
- package/docs/locality-analyzer-design.md +9 -9
- package/package.json +2 -2
- package/skills/conductor/SKILL.md +110 -0
- package/skills/conductor/agents/openai.yaml +4 -0
- package/skills/principal-maintainability-review/SKILL.md +273 -0
- package/skills/principal-maintainability-review/agents/openai.yaml +4 -0
- package/skills/scip-calibrate/SKILL.md +102 -0
- package/skills/scip-calibrate/agents/openai.yaml +4 -0
- package/skills/scip-claim-audit/SKILL.md +113 -0
- package/skills/scip-claim-audit/agents/openai.yaml +4 -0
- package/skills/scip-probe-reachability/SKILL.md +93 -0
- package/skills/scip-probe-reachability/agents/openai.yaml +4 -0
- package/skills/scip-root-cause/SKILL.md +160 -0
- package/skills/scip-root-cause/agents/openai.yaml +4 -0
- package/skills/scip-system-compression/SKILL.md +252 -0
- package/skills/scip-system-compression/agents/openai.yaml +4 -0
- package/skills/scip-system-compression/references/compression-atlas.md +116 -0
- package/skills/scip-system-compression/references/compression-patterns.md +87 -0
- package/skills/scip-twin-drift/SKILL.md +109 -0
- package/skills/scip-twin-drift/agents/openai.yaml +4 -0
- package/dist/by-kind-4IYG2SKW.js +0 -2
- package/dist/call-graph-WQNXMNNN.js +0 -2
- package/dist/call-graph-evidence-lZa2dwQA.d.ts +0 -11
- package/dist/chunk-2BTJALUS.js +0 -454
- package/dist/chunk-3QXC54FQ.js +0 -3
- package/dist/chunk-3TJY6M3B.js +0 -7
- package/dist/chunk-42W3LFUK.js +0 -13
- package/dist/chunk-4GAQ6FI4.js +0 -43
- package/dist/chunk-6NC3YSPY.js +0 -38
- package/dist/chunk-6VEFRPTD.js +0 -5
- package/dist/chunk-7C26EKLZ.js +0 -4
- package/dist/chunk-7JYHQAH2.js +0 -22
- package/dist/chunk-7KSO2OAP.js +0 -2
- package/dist/chunk-7XZGZBSQ.js +0 -2
- package/dist/chunk-A77SCPW2.js +0 -3
- package/dist/chunk-AK3PYTIK.js +0 -5
- package/dist/chunk-AMIMMNA4.js +0 -11
- package/dist/chunk-AUY5BL74.js +0 -2
- package/dist/chunk-BDHFVH2M.js +0 -18
- package/dist/chunk-BECZLYNU.js +0 -8
- package/dist/chunk-BUTEIZKP.js +0 -10
- package/dist/chunk-BWVQP3LB.js +0 -38
- package/dist/chunk-BYDAFMSR.js +0 -57
- package/dist/chunk-BZYSGZRK.js +0 -2
- package/dist/chunk-C7IJMOFP.js +0 -134
- package/dist/chunk-CBBHFNLX.js +0 -2
- package/dist/chunk-D2MVJSP4.js +0 -21
- package/dist/chunk-D35XIZGN.js +0 -2
- package/dist/chunk-DKM723YF.js +0 -79
- package/dist/chunk-DRENNWRG.js +0 -2
- package/dist/chunk-E44IVWIJ.js +0 -367
- package/dist/chunk-EDMB6SSO.js +0 -7
- package/dist/chunk-EETGXQY7.js +0 -3
- package/dist/chunk-FKGQOTKD.js +0 -2
- package/dist/chunk-GH5YSGZL.js +0 -5
- package/dist/chunk-GQIDEID3.js +0 -2
- package/dist/chunk-HCVJR2V4.js +0 -3
- package/dist/chunk-IMKZEXZG.js +0 -2
- package/dist/chunk-ISIQLPJ2.js +0 -61
- package/dist/chunk-IXESDH3J.js +0 -2
- package/dist/chunk-JJ62MTQH.js +0 -40
- package/dist/chunk-JT6XX7QY.js +0 -8
- package/dist/chunk-KFOYCQAJ.js +0 -9
- package/dist/chunk-LRI5OMPE.js +0 -2
- package/dist/chunk-MHIEP7EG.js +0 -4
- package/dist/chunk-NK3JMP22.js +0 -2
- package/dist/chunk-NVSZNESQ.js +0 -2
- package/dist/chunk-OJNK5ALA.js +0 -2
- package/dist/chunk-OXYAWIEA.js +0 -2
- package/dist/chunk-OZETODHH.js +0 -2
- package/dist/chunk-PBUH2P5S.js +0 -3
- package/dist/chunk-PLJUQFQN.js +0 -2
- package/dist/chunk-PLYUVM4F.js +0 -2
- package/dist/chunk-PXXYQK55.js +0 -2
- package/dist/chunk-Q5TA4OY4.js +0 -20
- package/dist/chunk-Q7GBK5T7.js +0 -81
- package/dist/chunk-QLBSG7U5.js +0 -3
- package/dist/chunk-QWKHW6VZ.js +0 -2
- package/dist/chunk-RPL3ARU7.js +0 -16
- package/dist/chunk-SVHTMVA4.js +0 -4
- package/dist/chunk-T6QD2ZQB.js +0 -43
- package/dist/chunk-TD7VKJ2Y.js +0 -117
- package/dist/chunk-TKDNDQA7.js +0 -3
- package/dist/chunk-TQZV7KV4.js +0 -2
- package/dist/chunk-TUSPIVZ3.js +0 -4
- package/dist/chunk-URSGGIZX.js +0 -2
- package/dist/chunk-UT7TADJX.js +0 -2
- package/dist/chunk-V4NG5OMS.js +0 -554
- package/dist/chunk-VTCIYFEK.js +0 -2
- package/dist/chunk-VU6LIWHT.js +0 -2
- package/dist/chunk-VUSKPCUB.js +0 -2
- package/dist/chunk-WN3TCGJ4.js +0 -2
- package/dist/chunk-WSLEJSFR.js +0 -2
- package/dist/chunk-WYZIHUPZ.js +0 -16
- package/dist/chunk-XE33FV5W.js +0 -2
- package/dist/chunk-XGGBK66W.js +0 -4
- package/dist/chunk-XSWYJCAK.js +0 -2
- package/dist/chunk-Y334QQU5.js +0 -3
- package/dist/chunk-Z2AWCTN6.js +0 -2
- package/dist/chunk-ZOXKSQQB.js +0 -2
- package/dist/chunk-ZPASRBLF.js +0 -2
- package/dist/chunk-ZZ3Z7D56.js +0 -2
- package/dist/code-EQJFDT6I.js +0 -2
- package/dist/code-result-json-7UWIWBOO.js +0 -2
- package/dist/command-descriptors-ORNTVNYV.js +0 -342
- package/dist/dataflow-6VL54GX5.js +0 -2
- package/dist/dependence-slice-DT2NUHD2.js +0 -2
- package/dist/deps-DB7H5IKC.js +0 -2
- package/dist/direct-navigation-O3LUAYWQ.js +0 -3
- package/dist/entry-map-6K62RV3D.js +0 -2
- package/dist/files-MSLD7MO6.js +0 -2
- package/dist/hierarchy-IVBXAKFA.js +0 -2
- package/dist/imports-FRAVZ3Y2.js +0 -2
- package/dist/members-KJOJDYGO.js +0 -2
- package/dist/methods-2AYABBT3.js +0 -2
- package/dist/output-continuation-command-JHMPH6NC.js +0 -3
- package/dist/output-pagination-3OFL2MJV.js +0 -19
- package/dist/project-reindex-HYO4WD7Z.js +0 -3
- package/dist/refs-ARMA6XUJ.js +0 -2
- package/dist/refs-pagination-VUGIWN6U.js +0 -2
- package/dist/slice-YOB5YFAM.js +0 -2
- package/dist/surface-VY5EFWTW.js +0 -2
- package/dist/symbol-resolution-DGQN4XIV.js +0 -2
- package/dist/system-2KQ3QD2P.js +0 -2
- package/dist/trace-HTIPTXAE.js +0 -2
- package/dist/value-flow-5FV3VQI7.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as k}from"./chunk-GC4DG2V5.js";import{d as q,e as G,f as K,m as Z}from"./chunk-SKKXTABJ.js";import{c as W,v as M}from"./chunk-C7C6AKAT.js";import{f as T,h as D,r as v,t as j,y as I}from"./chunk-RBAD4GJ2.js";import{E as w}from"./chunk-ZLMXIQLC.js";import{h as V}from"./chunk-ETC674NS.js";import{d as R}from"./chunk-JZ2A7LDM.js";var X=new WeakMap,Y=new WeakMap,H=new WeakMap,J=new WeakMap,U=new WeakMap;function Ie(t,e){let n=Y.get(t);n||(n=new Map,Y.set(t,n));let i=n.get(e);if(i)return i;let r=w(t,e)?.rootNode;if(!r)return n.set(e,[]),[];let p=new Set;$(r,o=>{if(o.type!=="call_expression")return;let g=o.childForFieldName("function")??o.namedChild(0),a=/^([A-Za-z_$][\w$]*(?:\.Service)?)\.of$/u.exec(g?.text.replace(/\s+/gu,"")??"");a&&p.add(a[1])});let d=I(t,e).filter(o=>!!o.sourcePath),u=new Set;for(let o of p){let g=/^([A-Za-z_$][\w$]*)\.Service$/u.exec(o);if(g){for(let a of d)a.localName===g[1]&&u.add(a.sourcePath);continue}if(o==="Service"){M(t,e).some(a=>a.leaf==="Service")&&u.add(e);for(let a of d)(a.localName??a.importedName)==="Service"&&u.add(a.sourcePath)}}let l=Q([...u]).sort();return n.set(e,l),l}function Me(t,e,n={}){let r=j(t,e)?.filter(s=>!n.ranges||n.ranges.some(f=>s.line>=f.startLine&&s.line<=f.endLine));if(!r)return{targets:[],unresolvedCallsites:0};let p=I(t,e).filter(s=>!!s.sourcePath),d=xe(V(t,e)??""),u=w(t,e)?.rootNode??null,l=u?se(u):ee(),o=new Map,g=K(t),a=[],c=0;for(let s of r){if(!s.memberAccess)continue;let f=q(e,g.get(s.calleeLeaf)??[]);if(n.excludeIndexedTargets!==!1&&G(t,e,f,!0,s.calleeQualifier))continue;let h=s.calleeQualifier,L=Ne(t,e,s,p);if(L){a.push(L);continue}let N=ae(t,e,s,p,oe(l,s.calleeQualifier,s.line));if(N.length>0){a.push(...N);continue}let S=le(t,e,s);if(S.length>0){a.push(...S);continue}let y=h?d.get(h)??h:null,P=(y?Q(p.filter(m=>(m.localName??m.importedName)===y).map(m=>m.sourcePath)):[]).flatMap(m=>{let C=o.get(m);return C||(C=v(t,m)??[],o.set(m,C)),C.filter(x=>x.name===s.calleeLeaf).map(x=>({file:m,callable:x}))});if(P.length!==1){c+=1;continue}let A=P[0];a.push({calleeLeaf:s.calleeLeaf,line:s.line,sourceFile:e,targetFile:A.file,targetStartLine:A.callable.startLine,targetEndLine:A.callable.endLine,resolution:"direct-import-receiver",strength:"candidate"})}return{targets:a,unresolvedCallsites:c}}function ae(t,e,n,i,r){let p=n.calleeQualifier;if(!p||!/^[A-Za-z_$][\w$]*$/u.test(p))return[];if(r.size!==1)return[];let d=[...r][0],u=Q(i.filter(g=>g.localName===d||g.importedName===d).map(g=>g.sourcePath));if(u.length!==1)return[];let l=u[0],o=me(t,l,n.calleeLeaf);return o.map(g=>({calleeLeaf:g.name,line:n.line,sourceFile:e,targetFile:g.file,targetStartLine:g.startLine,targetEndLine:g.endLine,serviceFile:l,resolutionAlternativeCount:o.length,resolution:"imported-service-object-member",strength:"candidate"}))}function ee(){return{declarations:new Map,callbacks:[]}}function se(t){let e=ee();return $(t,n=>{if(n.type==="variable_declarator"){let l=n.childForFieldName("name")??n.namedChild(0),o=n.childForFieldName("value")??n.namedChild(1);if(l?.type!=="identifier"||!o)return;let g=new Set;if($(o,a=>{if(a.type!=="member_expression")return;let c=a.childForFieldName("object")??a.namedChild(0),s=a.childForFieldName("property")??a.namedChild(1);c?.type==="identifier"&&s?.text==="Service"&&g.add(c.text)}),g.size===1){let a=e.declarations.get(l.text)??[];a.push({line:n.startPosition.row,alias:[...g][0]}),e.declarations.set(l.text,a)}return}if(!["arrow_function","function_expression","generator_function"].includes(n.type))return;let i=n.childForFieldName("parameters")??n.childForFieldName("parameter");if(!i)return;let r=n.parent;for(;r&&r.type!=="call_expression";)r=r.parent;if(!r)return;let p=r.childForFieldName("function")??r.namedChild(0),d=/^([A-Za-z_$][\w$]*)\.Service\.use$/u.exec(p?.text??"");if(!d)return;let u=new Set;$(i,l=>{l.type==="identifier"&&u.add(l.text)}),u.size!==0&&e.callbacks.push({startLine:n.startPosition.row,endLine:n.endPosition.row,receivers:u,alias:d[1]})}),e}function oe(t,e,n){if(!e||!/^[A-Za-z_$][\w$]*$/u.test(e))return new Set;let i=new Set((t.declarations.get(e)??[]).filter(r=>r.line<=n).map(r=>r.alias));for(let r of t.callbacks)r.startLine<=n&&r.endLine>=n&&r.receivers.has(e)&&i.add(r.alias);return i}function le(t,e,n){let i=n.calleeQualifier;if(!i||!/^[A-Za-z_$][\w$]*$/u.test(i))return[];let r=w(t,e)?.rootNode;if(!r)return[];let p=ce(t,e,r,n.line,n.calleeLeaf,i),d=p?fe(p,i):null;if(!d)return[];if(!ue(d))return[];let u=(v(t,e)??[]).filter(s=>s.startLine<=d.startPosition.row&&s.endLine>=d.endPosition.row).sort((s,f)=>s.endLine-s.startLine-(f.endLine-f.startLine))[0];if(!u)return[];let l=M(t,e).filter(s=>s.isFunctionLike&&s.leaf===u.name);if(l.length!==1)return[];let o=l[0],g=J.get(t);g||(g=new Map,J.set(t,g));let a=`${o.symbol}\0${n.calleeLeaf}`,c=g.get(a);if(!c){let s=[];for(let f of Z(t,o)){let h=w(t,f.file)?.rootNode;if(!h)continue;let L=T(h,"call_expression").filter(y=>y.startPosition.row>f.line||y.endPosition.row<f.line?!1:(y.childForFieldName("function")??y.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<[^<>]*>$/u,"").match(/[A-Za-z_$][\w$]*$/u)?.[0]===o.leaf);if(L.length!==1)continue;let S=L[0].childForFieldName("arguments")?.namedChildren.find(y=>F(y).type==="object");if(S)for(let y of F(S).namedChildren){if(y.type==="shorthand_property_identifier"&&y.text===n.calleeLeaf){s.push(...z(t,f.file,n.calleeLeaf,y,y));continue}if(y.type!=="pair")continue;let _=y.childForFieldName("key")??y.namedChild(0),P=y.childForFieldName("value")??y.namedChild(1);E(_?.text)!==n.calleeLeaf||!P||s.push(...z(t,f.file,n.calleeLeaf,P,y))}}c=s.filter((f,h,L)=>L.findIndex(N=>N.file===f.file&&N.startLine===f.startLine&&N.endLine===f.endLine&&N.name===f.name)===h),g.set(a,c)}return c.map(s=>({calleeLeaf:s.name,line:n.line,sourceFile:e,targetFile:s.file,targetStartLine:s.startLine,targetEndLine:s.endLine,resolutionAlternativeCount:c.length,resolution:"factory-callback-member",strength:c.length===1?"exact":"candidate"}))}function ce(t,e,n,i,r,p){let d=H.get(t);d||(d=new Map,H.set(t,d));let u=d.get(e);if(!u){u=new Map;for(let l of T(n,"call_expression")){let o=l.childForFieldName("function")??l.namedChild(0),g=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(o?.text.replace(/\s+/gu,"")??"");if(g)for(let a=l.startPosition.row;a<=l.endPosition.row;a+=1){let c=`${a}\0${g[1]}\0${g[2]}`,s=u.get(c);(!s||l.endIndex-l.startIndex<s.endIndex-s.startIndex)&&u.set(c,l)}}d.set(e,u)}return u.get(`${i}\0${p}\0${r}`)??null}function ue(t){return t.descendantsOfType("return_statement").some(e=>{let n=e.childForFieldName("argument")??e.namedChild(0);return!!(n&&F(n).type==="object")})}function fe(t,e){let n=t.parent;for(;n;){if(/(?:function|method|lambda)/u.test(n.type)||n.type==="arrow_function"){let i=n.childForFieldName("parameters")??n.childForFieldName("parameter"),r=!1;if(i&&$(i,p=>{p.type==="identifier"&&p.text===e&&(r=!0)}),r)return n}n=n.parent}return null}function z(t,e,n,i,r){if(i.type==="identifier")return(v(t,e)??[]).filter(l=>l.name===i.text).map(l=>({...l,file:e}));let p=O(t,e,i.text);if(p.length>0)return p;if(!B(i))return[];let u=(v(t,e)??[]).filter(l=>l.startLine>=r.startPosition.row&&l.endLine<=r.endPosition.row&&(l.name===n||l.name.startsWith("source@"))).sort((l,o)=>l.endLine-l.startLine-(o.endLine-o.startLine))[0];return[u?{...u,file:e}:{name:n,file:e,startLine:r.startPosition.row,endLine:r.endPosition.row}]}function me(t,e,n){let i=U.get(t);i||(i=new Map,U.set(t,i));let r=`${e}\0${n}`,p=i.get(r);if(p)return p;let d=ge(t,e).flatMap(u=>de(t,u,e,n));return i.set(r,d),d}function de(t,e,n,i){let r=w(t,e)?.rootNode,p=v(t,e)??[];if(!r)return[];let d=he(t,e,n);if(d.size===0)return[];let u=new Set,l=[],o=[],g=[];return $(r,c=>{if(pe(c,d)){if(c.type==="pair"){let s=c.childForFieldName("key")??c.namedChild(0),f=c.childForFieldName("value")??c.namedChild(1);if(E(s?.text)!==i||!f)return;if(f.type==="identifier")u.add(f.text);else if(B(f))l.push({name:i,startLine:c.startPosition.row,endLine:c.endPosition.row});else{let h=ye(t,e,f.text),L=O(t,e,f.text);if(h.length>0)g.push(...h);else if(L.length>0)g.push(...L);else{let N=Le(c);N&&o.push(N)}}return}c.type==="shorthand_property_identifier"&&c.text===i&&u.add(i)}}),[...p.filter(c=>u.has(c.name)).map(c=>({...c,file:e})),...l.map(c=>({...c,file:e})),...o.map(c=>({...c,file:e})),...g].filter((c,s,f)=>f.findIndex(h=>h.file===c.file&&h.name===c.name&&h.startLine===c.startLine&&h.endLine===c.endLine)===s)}function pe(t,e){let n=t,i=null;for(;n;){if(n.type==="object"&&(i=n),n.type==="call_expression"){if(!i)return!1;let r=n.childForFieldName("function")??n.namedChild(0);return r?e.has(r.text.replace(/\.of$/u,""))&&r.text.endsWith(".of"):!1}n=n.parent}return!1}function ge(t,e){let n=X.get(t);n||(n=new Map,X.set(t,n));let i=n.get(e);if(i)return i;let r=new Set([e]),p=M(t,e).filter(u=>u.leaf==="Service"&&u.isTypeLike);for(let u of p)for(let l of Z(t,u))r.add(l.file);let d=[...r].sort();return n.set(e,d),d}function he(t,e,n){let i=new Set;R(e,n)&&i.add("Service");for(let r of I(t,e)){if(!r.sourcePath||!R(r.sourcePath,n))continue;if(r.kind==="namespace"&&r.localName){i.add(`${r.localName}.Service`);continue}(r.importedName==="default"?r.localName:r.importedName)==="Service"?i.add(r.localName??r.importedName):r.localName&&r.importedName!=="default"&&i.add(`${r.localName}.Service`)}return i}function O(t,e,n){let i=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n.replace(/\s+/gu,""));if(!i)return[];let r=w(t,e)?.rootNode;if(!r)return[];let p=te(r,i[1]),d=p?ne(p):null;if(!d)return[];let u=d.childForFieldName("function")??d.namedChild(0),l=u?re(t,e,u.text):[];if(l.length!==1)return[];let o=l[0],g=w(t,o.relativePath)?.rootNode;if(!g)return[];let a=D(g,o.startLine,o.endLine);if(!a)return[];let c=[];for(let s of a.descendantsOfType("return_statement")){let f=s.childForFieldName("argument")??s.namedChild(0);if(!f)continue;let h=F(f);if(h.type==="object")for(let L of h.namedChildren){if(L.type==="shorthand_property_identifier"&&L.text===i[2]){for(let y of v(t,o.relativePath)??[])y.name===i[2]&&c.push({...y,file:o.relativePath});continue}if(L.type!=="pair")continue;let N=L.childForFieldName("key")??L.namedChild(0),S=L.childForFieldName("value")??L.namedChild(1);if(!(E(N?.text)!==i[2]||!S))if(S.type==="identifier")for(let y of v(t,o.relativePath)??[])y.name===S.text&&c.push({...y,file:o.relativePath});else B(S)&&c.push({name:i[2],startLine:L.startPosition.row,endLine:L.endPosition.row,file:o.relativePath})}}return c.filter((s,f,h)=>h.findIndex(L=>L.file===s.file&&L.name===s.name&&L.startLine===s.startLine&&L.endLine===s.endLine)===f)}function ye(t,e,n){let i=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n.replace(/\s+/gu,""));if(!i)return[];let r=w(t,e)?.rootNode;if(!r)return[];let p=te(r,i[1]),d=p?ne(p):null,u=d?.childForFieldName("function")??d?.namedChild(0),l=u?re(t,e,u.text):[];if(l.length!==1||!d)return[];let o=l[0],g=w(t,o.relativePath)?.rootNode;if(!g)return[];let a=D(g,o.startLine,o.endLine);if(!a)return[];let c=new Set,s=a.childForFieldName("parameters")??a.childForFieldName("parameter");if(s&&$(s,m=>{m.type==="identifier"&&c.add(m.text)}),c.size===0)return[];let f=O(t,e,n);if(f.length===0)return[];let h=(v(t,o.relativePath)??[]).filter(m=>m.startLine>=o.startLine&&m.endLine<=o.endLine),L=(j(t,o.relativePath)??[]).filter(m=>m.line>=o.startLine&&m.line<=o.endLine),N=new Set,S=f.map(m=>({name:m.name,startLine:m.startLine,endLine:m.endLine})),y=new Set;for(;S.length>0&&y.size<32;){let m=S.shift(),C=`${m.name}\0${m.startLine}\0${m.endLine}`;if(!y.has(C)){y.add(C);for(let x of L.filter(b=>b.line>=m.startLine&&b.line<=m.endLine)){if(x.memberAccess&&x.calleeQualifier&&c.has(x.calleeQualifier)){N.add(x.calleeLeaf);continue}if(x.memberAccess)continue;let b=h.filter(ie=>ie.name===x.calleeLeaf);b.length===1&&S.push(b[0])}}}if(N.size===0)return[];let P=d.childForFieldName("arguments")?.namedChildren.find(m=>F(m).type==="object");if(!P)return[];let A=[];for(let m of F(P).namedChildren){if(m.type==="shorthand_property_identifier"&&N.has(m.text)){A.push(...z(t,e,m.text,m,m));continue}if(m.type!=="pair")continue;let C=m.childForFieldName("key")??m.namedChild(0),x=m.childForFieldName("value")??m.namedChild(1),b=E(C?.text);!b||!N.has(b)||!x||A.push(...z(t,e,b,x,m))}return A.filter((m,C,x)=>x.findIndex(b=>b.file===m.file&&b.name===m.name&&b.startLine===m.startLine&&b.endLine===m.endLine)===C)}function te(t,e){for(let n of T(t,"variable_declarator"))if((n.childForFieldName("name")??n.namedChild(0))?.text===e)return n.childForFieldName("value")??n.namedChild(1);return null}function ne(t){return t.type==="call_expression"?t:t.descendantsOfType("call_expression")[0]??null}function re(t,e,n){let i=n.replace(/\s+/gu,"").replace(/<[^<>]*>$/u,""),r=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(i);if(r){let a=I(t,e).filter(f=>f.localName===r[1]&&f.sourcePath);if(a.length!==1||!a[0].sourcePath)return[];let c=a[0].sourcePath,s=k(t,c,r[2]).filter(f=>f.isFunctionLike);return s.length>0?s:(v(t,c)??[]).filter(f=>f.name===r[2]).map(f=>({...f,relativePath:c}))}if(!/^[A-Za-z_$][\w$]*$/u.test(i))return[];let p=M(t,e).filter(a=>a.leaf===i&&a.isFunctionLike);if(p.length>0)return p;let d=(v(t,e)??[]).filter(a=>a.name===i).map(a=>({...a,relativePath:e}));if(d.length>0)return d;let u=I(t,e).filter(a=>a.localName===i&&a.sourcePath&&a.kind!=="namespace");if(u.length!==1||!u[0].sourcePath)return[];let l=u[0].sourcePath,o=u[0].importedName==="default"?i:u[0].importedName,g=k(t,l,o).filter(a=>a.isFunctionLike);return g.length>0?g:(v(t,l)??[]).filter(a=>a.name===o).map(a=>({...a,relativePath:l}))}function B(t){return["arrow_function","function_expression","generator_function"].includes(t.type)||t.descendantsOfType(["arrow_function","function_expression","generator_function"]).length>0}function Le(t){let e=t.parent;for(;e;){if(e.type==="variable_declarator"){let n=e.childForFieldName("name")??e.namedChild(0);if(n?.type==="identifier")return{name:n.text,startLine:e.startPosition.row,endLine:e.endPosition.row}}e=e.parent}return null}function E(t){return t?t.replace(/^(?:['"])(.*)(?:['"])$/u,"$1"):null}function Ne(t,e,n,i){let r=/^this\.([A-Za-z_$][\w$]*)$/u.exec(n.calleeQualifier??"");if(!r)return null;let p=w(t,e)?.rootNode;if(!p)return null;let d=Se(p,n.line);if(!d)return null;let u=new Set;if($(d,h=>{if(h.type!=="assignment_expression")return;let L=h.childForFieldName("left")??h.namedChild(0),N=h.childForFieldName("right")??h.namedChild(h.namedChildCount-1);if(L?.text.replace(/\s+/gu,"")!==`this.${r[1]}`||!N)return;let S=F(N);if(S.type!=="new_expression")return;let _=(S.childForFieldName("constructor")??S.namedChild(0))?.text.match(/[A-Za-z_$][\w$]*$/u)?.[0];_&&u.add(_)}),u.size!==1)return null;let l=[...u][0],o=i.filter(h=>h.localName===l);if(o.length!==1)return null;let g=o[0].importedName==="default"?l:o[0].importedName,a=o[0].importedName==="default"?k(t,o[0].sourcePath,l):[],c=a.length===1?a[0].leaf:g,s=M(t,o[0].sourcePath).filter(h=>h.isFunctionLike&&h.leaf===n.calleeLeaf&&W(h.symbol)===c);if(s.length!==1)return null;let f=s[0];return{calleeLeaf:n.calleeLeaf,line:n.line,sourceFile:e,targetFile:f.relativePath,targetStartLine:f.startLine,targetEndLine:f.endLine,targetSymbol:f.symbol,resolution:"constructed-member-receiver",strength:"exact"}}function Se(t,e){let n=[];return $(t,i=>{["class","class_declaration","class_definition"].includes(i.type)&&i.startPosition.row<=e&&i.endPosition.row>=e&&n.push(i)}),n.sort((i,r)=>i.endPosition.row-i.startPosition.row-(r.endPosition.row-r.startPosition.row))[0]??null}function F(t){let e=t;for(;["parenthesized_expression","as_expression","type_assertion","satisfies_expression"].includes(e.type)&&e.namedChildCount===1;)e=e.namedChild(0);return e}function $(t,e){e(t);for(let n of t.namedChildren)$(n,e)}function xe(t){let e=new Map,n=/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*([A-Za-z_$][\w$]*)\s*;/gu;for(let i of t.matchAll(n)){let r=i[1],p=i[2];r&&p&&e.set(r,p)}return e}function Q(t){let e=[];for(let n of t)e.some(i=>R(i,n))||e.push(n);return e}export{Ie as a,Me as b};
|
|
2
|
+
//# sourceMappingURL=chunk-7H6VHWWJ.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as Je,f as V,h as X,k as Ke,m as Q,n as Z,o as ge}from"./chunk-7F45LJKI.js";import{isAbsolute as Ye,relative as sn}from"path";var g=class extends Error{constructor(n,r){super(`refusing unsafe project file path ${JSON.stringify(n)} (${r})`);this.relativePath=n;this.reason=r;this.name="UnsafeProjectPathError"}relativePath;reason;code="SCIP_QUERY_UNSAFE_PROJECT_PATH"};function he(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function di(e){return e.replace(/\\/g,"/")}function gi(e,t){return he(e)===he(t)}function j(e,t){let n=sn(e,t);return n===""||!n.startsWith("..")&&!Ye(n)}function I(e){if(!e)throw new g(e,"empty-path");if(e.includes("\0"))throw new g(e,"nul-byte");if(Ye(e)||/^[A-Za-z]:/.test(e)||e.startsWith("//")||e.startsWith("\\\\"))throw new g(e,"absolute-path");let t=he(e);if(t.split("/").some(r=>r===".."))throw new g(e,"parent-traversal");if(!t||t===".")throw new g(e,"empty-path");return t}import{createHash as tt,randomUUID as mn}from"crypto";import{chmodSync as nt,existsSync as _,linkSync as yn,lstatSync as re,readdirSync as ye,realpathSync as C,unlinkSync as Sn,writeSync as jn}from"fs";import{homedir as bn}from"os";import{basename as Pn,dirname as ie,isAbsolute as Ze,join as y,resolve as oe}from"path";import{closeSync as cn,existsSync as an,fsyncSync as un,mkdirSync as ln,openSync as pn}from"fs";import{dirname as Ve}from"path";var M=Object.freeze({platform:process.platform,pathExists:e=>an(e),makeDirectory:e=>ln(e,{recursive:!0}),openFile:(e,t,n)=>pn(e,t,n),syncFile:e=>un(e),closeFile:e=>cn(e)});function Xe(e,t=M){let n=[],r=e;for(;!t.pathExists(r);){n.push(r);let o=Ve(r);if(o===r)throw new Error(`Cannot establish a durable directory path without an existing ancestor: ${e}`);r=o}let i="synced";for(let o of n.reverse())t.makeDirectory(o),i=te(i,ee(Ve(o),t));return i}function ee(e,t=M){let n;try{n=t.openFile(e,"r")}catch(r){if(ge(r,t.platform))return"unsupported";throw r}try{t.syncFile(n)}catch(r){try{t.closeFile(n)}catch{}if(ge(r,t.platform))return"unsupported";throw r}return t.closeFile(n),"synced"}function te(...e){return e.every(t=>t==="not-requested")?"not-requested":e.includes("unsupported")?"unsupported":"synced"}import{createHash as fn}from"crypto";import{createRequire as dn}from"module";var gn=dn(import.meta.url),Qe=hn().version,z;function Ci(){if(z!==void 0)return z;let e=process.argv[1];try{z=e?fn("sha256").update(V(e,{maxBytes:Je,inputKind:"CLI entry bundle"})).digest("hex").slice(0,16):"source"}catch{z="source"}return z}function hn(){for(let e of["../package.json","../../package.json"])try{return gn(e)}catch{}return{version:"0.0.0"}}var rt=1,H=".scip-query-cache-owner.json",xn=16*1024,it=Object.freeze({...M,randomToken:()=>mn(),linkFile:(e,t)=>yn(e,t),removeFile:e=>Sn(e),writeFile:(e,t,n,r)=>jn(e,t,n,r)});function ne(e,t){return Object.assign(new Error(`refusing unsafe project dbPath ${JSON.stringify(e)} (${t}); use a repository-relative directory that remains inside the checkout`),{name:"UnsafeCachePathError",code:"SCIP_QUERY_UNSAFE_CACHE_PATH",configuredPath:e,reason:t})}function F(e,t){return Object.assign(new Error(`refusing unowned cache directory ${JSON.stringify(e)} (${t}); move unrelated data elsewhere or choose a new empty dbPath`),{name:"CacheOwnershipError",code:"SCIP_QUERY_CACHE_OWNERSHIP",cacheDir:e,reason:t})}function Cn(e,t){let n=C(e);return wn(n,Se(n,t))}function Se(e,t){let n=C(e),r=process.env.SCIP_QUERY_CACHE_DIR;return r?oe(r):t?.dbPath?In(n,t.dbPath):Fn(n)}function ot(){let e=process.env.XDG_CACHE_HOME;return y(e||y(bn(),".cache"),"scip-query")}function Fn(e){let t=oe(e);try{t=C(t)}catch{}let n=tt("sha256").update(t).digest("hex").slice(0,12);return y(ot(),"projects",n)}function _i(e){if(!/^[a-f0-9]{24}$/.test(e))throw new Error(`invalid repository cache identity: ${e}`);let t=y(ot(),"repositories",e);return at(t),C(t)}function Li(e){return process.env.SCIP_QUERY_SHARED_CACHE!=="0"&&!process.env.SCIP_QUERY_CACHE_DIR&&!process.env.SCIP_QUERY_INDEX_DB&&!e?.dbPath}function Ni(e,t){let n=Cn(e,t);return{cacheDir:n,dbPath:y(n,"index.db"),indexPath:y(n,"index.scip"),metaPath:y(n,"meta.json")}}function wn(e,t,n=it){return kn(e,t,n).cacheDir}function kn(e,t,n=it){let r=C(e),i=_(t)?"synced":at(t,n),o=C(t),s=y(o,H);if(_(s))return me(r,o),je(s),W(o),{kind:"existing",cacheDir:o};et(o),On(o),et(o);let a=`${JSON.stringify({schemaVersion:rt,canonicalProjectRoot:r,canonicalCacheDir:o,creatorVersion:Qe},null,2)}
|
|
2
|
+
`;try{let u=Dn(s,a,n),p=te(i,u);return{kind:"published",cacheDir:o,achievedDurability:p==="synced"?"directory-durable":"file-flushed",directorySync:p}}catch(u){if(Ln(u))return me(r,o),{kind:"existing",cacheDir:o};throw u}}function me(e,t){let n=C(e),r=C(t);return vn(r,n,r)}function Gi(e,t){return _(y(t,H))?(me(e,t),st(t),!0):!1}function In(e,t){let n;try{n=I(t)}catch(s){throw s instanceof g?ne(t,s.reason):s}let r=oe(e,...n.split("/"));if(r===e||!j(e,r))throw ne(t,"outside-project");let i=En(r),o=C(i);if(!j(e,o)&&o!==e)throw ne(t,"symlink-escape");return r}function En(e){let t=e;for(;!_(t);){let n=ie(t);if(n===t)throw ne(e,"no-existing-ancestor");t=n}return t}function vn(e,t,n){let r=y(e,H);if(!_(r)||re(r).isSymbolicLink())throw F(e,"missing regular ownership record");let i=re(r);if(!i.isFile()||i.size>xn)throw F(e,"invalid ownership record file");let o=X(r,"cache ownership record"),s=Rn(o,e);if(t!==void 0&&s.canonicalProjectRoot!==t)throw F(e,"ownership record belongs to a different project");if(s.canonicalCacheDir!==n)throw F(e,"ownership record names a different cache directory");return{record:s,ownerSha256:tt("sha256").update(o).digest("hex"),physicalCacheDir:e}}function Rn(e,t){try{let n=JSON.parse(e);if(n.schemaVersion!==rt||typeof n.canonicalProjectRoot!="string"||typeof n.canonicalCacheDir!="string"||typeof n.creatorVersion!="string"||!Ze(n.canonicalProjectRoot)||!Ze(n.canonicalCacheDir))throw new Error("invalid fields");return n}catch(n){throw F(t,`malformed ownership record: ${n instanceof Error?n.message:String(n)}`)}}function et(e){let t=ye(e).filter(n=>n!==H&&!Tn(n));if(t.length>0)throw F(e,`unrecognized existing entries: ${t.slice(0,3).join(", ")}`)}function Tn(e){return e.startsWith(`${H}.tmp-`)||e.startsWith("git-worktree-context.json.tmp-")||[".scipquery-generations","affected-shadow-latest.json","affected-shadow.jsonl","agent-hooks","augment-vue-meta.json","cache-lifecycle.lock","evidence.db","evidence.db-shm","evidence.db-wal","health-report-cache.json","git-worktree-context.json","index.db","index.db-shm","index.db-wal","index.lock","index.scip","language-indexes","meta.json","reindex-activity.jsonl","shared-cache.json","typescript-index","typescript-scip-fragments","typescript-scip-overlays","typescript-semantic","typescript-shard-costs.json","watch-activity.json","watch-refresh-requests","watch-state.json","watch.lock"].includes(e)?!0:/^(?:reindex-|rust-|typescript-)/.test(e)}function On(e){for(let t of ye(e)){let n=y(e,t);try{let r=re(n);if(r.isSymbolicLink())throw F(e,`legacy cache entry ${t} is a symlink`);if(r.isDirectory())W(n);else if(r.isFile())je(n);else throw F(e,`legacy cache entry ${t} is not a file or directory`)}catch(r){if(ct(r))continue;throw r}}W(e)}function st(e,t=!1){try{let n=re(e);if(n.isSymbolicLink())throw F(e,"managed cache tree contains a symlink");if(n.isFile()){je(e);return}if(!n.isDirectory())throw F(e,"managed cache tree contains a special file");W(e);for(let r of ye(e))st(y(e,r),!0)}catch(n){if(t&&ct(n))return;throw n}}function ct(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}function at(e,t=M){let n=Xe(e,t);return W(e),n}function Dn(e,t,n){let r=`${e}.tmp-${process.pid}-${n.randomToken()}`,i,o=!1;try{i=n.openFile(r,"wx",384),o=!0,Z(i,Buffer.from(t),n,"cache ownership record"),n.syncFile(i),n.closeFile(i),i=void 0,n.linkFile(r,e);let s=ee(ie(e),n);return n.removeFile(r),o=!1,te(s,ee(ie(e),n))}finally{if(i!==void 0)try{n.closeFile(i)}catch{}if(o)try{n.removeFile(r)}catch{}}}function W(e){process.platform!=="win32"&&nt(e,448)}function je(e){process.platform!=="win32"&&nt(e,384)}function _n(e){if(_(e))return C(e);let t=C(ie(e));return y(t,Pn(e))}function Ai(e){return _n(oe(e))}function Ln(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="EEXIST"}import{spawnSync as Gn}from"child_process";import{createHash as An}from"crypto";import{existsSync as Bn,lstatSync as Mn,realpathSync as zn}from"fs";import{dirname as Wn,isAbsolute as Hn,join as $n,relative as Ui,resolve as ce,sep as qi}from"path";var ut=Symbol.for("scip-query.project-file-listing-context.v1"),lt=globalThis,be=lt[ut],E=be&&typeof be=="object"?be:{};lt[ut]=E;function pt(e,t){let n=E.active?E.canonicalProjectRoots:void 0,r=n?.get(e);if(r!==void 0)return r;let i=t();return n?.set(e,i),i}function ft(){return E.sequence??0}function dt(e,t,n){let r=E.active,i=r?.get(e);if(i&&i.pathBytes<=t)return i;let o=Nn(n(),(E.sequence??0)+1);if(E.sequence=o.sequence,o.pathBytes>t)throw new RangeError(`Git project file listing exceeded ${t} path bytes.`);return r?.set(e,o),o}function gt(e,t){let n=E.active?.get(e);return n&&n.sequence>t?n.indexAllowsTreeFingerprintReuse:void 0}function*ht(e){let t=0;for(;t<e.taggedOutput.length;){let n=e.taggedOutput.indexOf("\0",t);if(n<0)return;yield e.taggedOutput.slice(t+2,n),t=n+1}}function Nn(e,t){let n=0,r=0,i=!0;for(;n<e.length;){let o=e.indexOf("\0",n);if(o<0||o<=n+2||e[n+1]!==" ")throw new Error("Git returned a malformed tagged project file listing.");let s=e[n];i&&=s==="H"||s==="?",r+=1,n=o+1}return{taggedOutput:e,pathBytes:Buffer.byteLength(e,"utf8")-r*2,indexAllowsTreeFingerprintReuse:i,sequence:t}}var v={run(e,t){let n=yt(e,t);return n.kind==="success"?n.output:void 0},runResult:yt},Un=["rev-parse","--show-toplevel","--absolute-git-dir","--git-common-dir","HEAD","HEAD^{tree}"],Ce=["status","--porcelain=v2","--branch","-z","--untracked-files=all"],Pe=/^[0-9a-f]{40,64}$/;function Ki(e,t=v){return qn(e,t)?.context}function qn(e,t=v){let n=t.runResult(e,Un);if(n.kind==="success"){let i=Jn(n.output);if(i){let o=Kn(i,t);if(o)return mt(o)}}let r=Yn(e,t);return r?mt(r):void 0}function Yi(e,t=v){if(!e.headCommit)return;let n=t.run(e.projectRoot,Ce);if(n===void 0)return;let r=Fe(n);if(!(!r?.headCommit||r.headCommit!==e.headCommit))return{...e,clean:r.clean}}function Vi(e,t=v,n={}){let r=t===v&&n.cachedInventoryAfterSequence!==void 0?gt(e,n.cachedInventoryAfterSequence):void 0;if(r!==void 0)return r;let i=t.run(e,["ls-files","-v","-z"]);return i===void 0?!1:i.split("\0").filter(Boolean).every(o=>o.startsWith("H "))}function mt(e){return{context:e,projectFileInventorySequence:ft()}}function Fe(e){let t=e.split("\0").filter(Boolean),n=t.find(i=>i.startsWith("# branch.oid "))?.slice(13),r=n==="(initial)"?void 0:n;if(!(r!==void 0&&!Pe.test(r))&&n!==void 0)return{headCommit:r,clean:t.every(i=>i.startsWith("# "))}}function Jn(e){let t=e.split(`
|
|
3
|
+
`).map(a=>a.trim());if(t.length!==5)return;let[n,r,i,o,s]=t;if(!n||!r||!i||!o||!s||!Pe.test(o)||!Pe.test(s))return;let c=w(n);return{root:c,gitDir:w(se(c,r)),commonDir:w(se(c,i)),headCommit:o,treeOid:s}}function Kn(e,t){let n=t.run(e.root,Ce);if(n===void 0)return;let r=Fe(n);return r?.headCommit!==e.headCommit?void 0:{...St(e.root,e.gitDir),commonDir:e.commonDir,repositoryId:we("repository",e.commonDir),headCommit:e.headCommit,treeOid:e.treeOid,clean:r.clean}}function Yn(e,t){let n=Vn(e,t);if(n.kind!=="worktree")return;let r=n.identity,i=r.projectRoot,o=t.run(i,["rev-parse","--git-common-dir"])?.trim();if(!o)return;let s=w(se(i,o)),c=xe(t.run(i,["rev-parse","--verify","HEAD"])),a=xe(t.run(i,["rev-parse","--verify","HEAD^{tree}"])),u=t.run(i,Ce);if(u===void 0)return;let p=Fe(u);if(!(!p||p.headCommit!==c))return{...r,commonDir:s,repositoryId:we("repository",s),headCommit:c,treeOid:a,clean:p.clean}}function Vn(e,t=v){let n=t.runResult(e,["rev-parse","--show-toplevel"]);if(n.kind==="not-repository")return{kind:"non-git"};if(n.kind==="error")return n;let r=n.output.trim();if(!r)return{kind:"error",message:"Git returned an empty worktree root."};let i=w(r),o=t.run(i,["rev-parse","--absolute-git-dir"])?.trim();if(!o)return{kind:"error",message:"Git did not return an absolute worktree directory."};let s=w(se(i,o));return{kind:"worktree",identity:St(i,s)}}function St(e,t){return{projectRoot:e,gitDir:t,worktreeId:we("worktree",`${e}\0${t}`)}}function Xi(e,t=v){let n=t.run(e,["worktree","list","--porcelain","-z"]);return n===void 0?[]:Xn(n)}function Xn(e){let t=[],n;for(let r of e.split("\0")){if(r===""){n&&t.push(n),n=void 0;continue}let i=r.indexOf(" "),o=i<0?r:r.slice(0,i),s=i<0?"":r.slice(i+1);if(o==="worktree"){n&&t.push(n),n={path:w(s),detached:!1,bare:!1,prunable:!1,locked:!1};continue}n&&(o==="HEAD"?n.head=s:o==="branch"?n.branch=s:o==="detached"?n.detached=!0:o==="bare"?n.bare=!0:o==="prunable"?n.prunable=!0:o==="locked"&&(n.locked=!0))}return n&&t.push(n),t}function Qi(e,t,n=v){return xe(n.run(e,t))}function se(e,t){return Hn(t)?t:ce(e,t)}function w(e){try{return zn(e)}catch{return ce(e)}}function we(e,t){return An("sha256").update(`${e}\0${t}`).digest("hex").slice(0,24)}function xe(e){return e?.trim()||void 0}function yt(e,t){let n=Gn("git",["-C",e,...t],{encoding:"utf-8",env:{...process.env,LC_ALL:"C"},maxBuffer:52428800,stdio:["ignore","pipe","pipe"],timeout:3e4,killSignal:"SIGKILL"});if(n.status===0)return{kind:"success",output:n.stdout.trimEnd()};let i=(typeof n.stderr=="string"?n.stderr.trim():"")||n.error?.message||`git exited with status ${n.status??"unknown"}`,o=n.error?.code;return(/not a git repository/i.test(i)||o==="ENOENT"&&Bn(ce(e)))&&!Qn(e)?{kind:"not-repository"}:{kind:"error",message:i}}function Qn(e){if(process.env.GIT_DIR||process.env.GIT_COMMON_DIR)return!0;let t=ce(e);for(;;){try{return Mn($n(t,".git")),!0}catch(r){let i=r.code;if(i!=="ENOENT"&&i!=="ENOTDIR")return!0}let n=Wn(t);if(n===t)return!1;t=n}}import{execFileSync as Mr}from"child_process";import{isUtf8 as Qt}from"buffer";import{createHash as Be}from"crypto";import{closeSync as tn,fstatSync as U,lstatSync as ze,openSync as nn,readdirSync as zr,readFileSync as Wr,readSync as Zt,readlinkSync as Hr,realpathSync as J}from"fs";import{isAbsolute as $r,join as We,relative as Ur,resolve as qr,sep as Jr}from"path";function ue(e,t,n=[]){let r=ke(e);if(wt.has(r)||n.some(o=>ae(r,o))||t.some(o=>kt(r,o)))return"config";if(t.some(Et)&&/\.d\.(?:ts|mts|cts)$/.test(r.toLowerCase()))return"ambient";let i=It(r);return t.some(o=>(vt[o]??[]).includes(i))?"source":"other"}function Ft(e,t,n){let r=ke(e);if(wt.has(r)||n?.some(o=>ae(r,o))||kt(r,t)||Et(t)&&/\.d\.(?:ts|mts|cts)$/.test(r.toLowerCase()))return!0;let i=It(r);return(vt[t]??[]).includes(i)}function eo(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.version!="number"||!bt(t.languages)||typeof t.pnpmWorkspaces!="boolean"||typeof t.typescriptProjectMode!="string"||!bt(t.typescriptProjects)||t.clojureConfigPath!==void 0&&typeof t.clojureConfigPath!="string"||!Array.isArray(t.files)||!t.files.every(Zn)?null:t}function jt(e){return{...e,files:e.files.map(({semanticHash:t,...n})=>n)}}function to(e,t){return!e||!t?e===t:JSON.stringify(jt(e))===JSON.stringify(jt(t))}function no(e,t){let n=new Map((e?.files??[]).map(c=>[c.path,c])),r=new Map(t.files.map(c=>[c.path,c])),i=new Set([...n.keys(),...r.keys()]),o=[];for(let c of[...i].sort()){let a=n.get(c),u=r.get(c),p=ue(c,t.languages);!a&&u?o.push({kind:"added",path:c,inputKind:p,after:u}):a&&!u?o.push({kind:"deleted",path:c,inputKind:p,before:a}):a&&u&&(a.hash!==u.hash||a.size!==u.size)&&o.push({kind:"modified",path:c,inputKind:p,before:a,after:u})}let s=new Set;return e||s.add("prior-snapshot-unavailable"),e&&e.version!==t.version&&s.add("snapshot-version-changed"),(Pt(e?.files??[])||Pt(t.files))&&s.add("duplicate-input-path"),[...e?.files??[],...t.files].some(er)&&s.add("unreadable-input"),{version:1,changes:o,projectIdentityChanged:e?!tr(e,t):!0,uncertainty:[...s].sort()}}function bt(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function Pt(e){return new Set(e.map(t=>t.path)).size!==e.length}function Zn(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.path=="string"&&typeof t.size=="number"&&Number.isFinite(t.size)&&typeof t.hash=="string"&&(t.semanticHash===void 0||typeof t.semanticHash=="string")}function er(e){return e.hash==="unreadable"||e.size<0}function tr(e,t){return xt(e.languages,t.languages)&&e.pnpmWorkspaces===t.pnpmWorkspaces&&e.typescriptProjectMode===t.typescriptProjectMode&&xt(e.typescriptProjects,t.typescriptProjects)&&e.clojureConfigPath===t.clojureConfigPath}function xt(e,t){if(e.length!==t.length)return!1;let n=[...e].sort(),r=[...t].sort();return n.every((i,o)=>i===r[o])}var wt=new Set([".scipquery.json"]),nr={typescript:["tsconfig.json"],javascript:["package.json"],java:["pom.xml","build.gradle"],scala:["build.sbt"],kotlin:["build.gradle.kts"],rust:["Cargo.toml"],python:["pyproject.toml","setup.py"],ruby:["Gemfile"],go:["go.mod"],cpp:["CMakeLists.txt","Makefile"],c:["CMakeLists.txt","Makefile"],csharp:["*.csproj","*.sln"],vb:["*.vbproj","*.sln"],dart:["pubspec.yaml"],php:["composer.json"],clojure:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"]},rr={typescript:["package.json","package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb","tsconfig.*.json","jsconfig.json","jsconfig.*.json"],javascript:["package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb","tsconfig.json","tsconfig.*.json","jsconfig.json","jsconfig.*.json"],java:["build.gradle.kts","settings.gradle","settings.gradle.kts","gradle.properties","gradle.lockfile","gradle-wrapper.properties"],scala:["plugins.sbt","build.properties"],kotlin:["pom.xml","build.gradle","settings.gradle","settings.gradle.kts","gradle.properties","gradle.lockfile","gradle-wrapper.properties"],rust:["Cargo.lock","rust-project.json","rust-toolchain","rust-toolchain.toml"],python:["setup.cfg","requirements*.txt","Pipfile","Pipfile.lock","poetry.lock","uv.lock"],ruby:["Gemfile.lock","gems.locked"],go:["go.sum","go.work","go.work.sum"],cpp:["compile_commands.json"],c:["compile_commands.json"],csharp:["Directory.Build.props","Directory.Build.targets","Directory.Packages.props","packages.lock.json","NuGet.Config","global.json"],vb:["Directory.Build.props","Directory.Build.targets","Directory.Packages.props","packages.lock.json","NuGet.Config","global.json"],dart:["pubspec.lock","analysis_options.yaml"],php:["composer.lock"],clojure:[]},Ct=new Map;function kt(e,t){return nr[t].some(n=>ae(e,n))||rr[t].some(n=>ae(e,n))}function ae(e,t){let n=ke(t).replace(/^\.\//,"");if(!n)return!1;let r=e.split("/").at(-1)??e,i=n.includes("/")?e:r;if(!n.includes("*")&&!n.includes("?"))return i===n;let o=Ct.get(n);if(!o){let s=n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/\?/g,"[^/]");o=new RegExp(`^${s}$`),Ct.set(n,o)}return o.test(i)}function ke(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function It(e){return e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:""}function Et(e){return e==="typescript"||e==="javascript"}var vt={typescript:[".ts",".tsx",".mts",".cts"],javascript:[".js",".jsx",".mjs",".cjs",".vue"],java:[".java"],scala:[".scala"],kotlin:[".kt",".kts"],rust:[".rs"],python:[".py",".pyi"],ruby:[".rb"],go:[".go"],cpp:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"],c:[".c",".h"],csharp:[".cs"],vb:[".vb"],dart:[".dart"],php:[".php"],clojure:[".clj",".cljs",".cljc"]};import{AsyncLocalStorage as ir}from"async_hooks";var or=new ir;function R(e,t){let n=le(e);if(!n||n.missing.has(t))return;let r=n.files.get(t);if(r)return r;let i=n.readBaseFile?.(t);return i&&n.files.set(t,i),i}function T(e,t){let n=le(e);if(n)return n.missing.has(t)?"missing":n.paths.includes(t)?"present":"missing"}function Rt(e,t){return le(e)?.fingerprints.get(t)}function O(e){return le(e)?.paths}function le(e){let t=or.getStore();if(t)return t.projectRoot===w(e)?t:void 0}import{createRequire as sr}from"module";import{existsSync as cr,lstatSync as Tt,readdirSync as ar,statSync as ur}from"fs";import f from"path";var lr=sr(import.meta.url),Ot=new Set([".cache",".git",".next",".nuxt",".turbo",".nx","build","coverage","dist","node_modules","tmp","vendor"]),pr=18003;function pe(e,t=[]){let n=f.resolve(e),r=t.flatMap(a=>gr(n,a));if(r.length>0)return Dt(n,Lt(r));let i=dr(n),o=Lt(i),s=hr(n,o)?[n,...o]:o,c=s.length>0?s:[n];return Dt(n,c)}function Nt(e){return new Set(e.map(t=>t==="."?"tsconfig.json":`${t.replace(/\/$/u,"")}/tsconfig.json`))}function Gt(e){let t=e.split("/").at(-1)?.toLowerCase();return t?.startsWith("tsconfig")===!0&&t.endsWith(".json")}var fr=/^\.scipquery-compiler-shard-\d+\.tsconfig\.json$/;function go(e){return`.scipquery-compiler-shard-${e}.tsconfig.json`}function At(e){return fr.test(e)}function Bt(e,t,n=[]){let r;try{r=lr("@ts-morph/common/dist/typescript.js")}catch{return null}let i=f.resolve(e),o=t==="workspace"?pe(i,n):["."],s=new Set;for(let c of o){let a=c==="."?i:f.join(i,c),u=f.join(a,"tsconfig.json"),p=yr(r,i);if(!p.fileExists(u))return null;let l=r.readConfigFile(u,p.readFile);if(l.error)return null;let d=r.parseJsonConfigFileContent(l.config,p,a);if(d.errors.some(m=>m.code!==pr))return null;for(let m of d.fileNames){let h=f.resolve(m);j(i,h)&&s.add(f.relative(i,h).split(f.sep).join("/"))}}return s}function ho(e,t,n,r){let i=f.resolve(e),o=new Set(r);for(let c of n){let a=f.resolve(i,c);if(j(i,a))try{let u=Tt(a);if(u.isSymbolicLink()||u.isFile()&&!o.has(D(i,a)))return!1}catch{}}let s=t==="workspace"?pe(i,n):["."];for(let c of s){let a=c==="."?i:f.join(i,c),u=f.join(a,"tsconfig.json");if(!zt(i,u))continue;let p=D(i,u);if(!o.has(p))return!1;try{if(Tt(u).isSymbolicLink())return!1;let l=Wt(i,u);if(l.includes("extends")||l.includes("\\"))return!1}catch{return!1}}return!0}function Dt(e,t){return[...new Set(t.map(n=>D(e,n)))].sort((n,r)=>n.localeCompare(r))}function dr(e){let t=O(e);if(t)return t.flatMap(i=>{if(i.split("/").some(s=>Ot.has(s)))return[];let o=f.join(e,...i.split("/"));return _t(e,o)?[f.dirname(o)]:[]});let n=[],r=[e];for(;r.length>0;){let i=r.pop(),o;try{o=ar(i,{withFileTypes:!0})}catch{continue}for(let s of o){let c=f.join(i,s.name);if(s.isDirectory()){!Ot.has(s.name)&&!s.name.startsWith(".")&&r.push(c);continue}s.isFile()&&_t(e,c)&&n.push(f.dirname(c))}}return n}function gr(e,t){let n=t.trim();if(!n)return[];let r=f.resolve(e,n);if(!j(e,r))return[];let i=O(e);if(i){let o=D(e,r);if(i.includes(o)&&Ie(f.basename(r)))return[f.dirname(r)];let s=o==="."?"":`${o}/`;return i.some(c=>c.startsWith(s))?[r]:[]}try{let o=ur(r);if(o.isDirectory())return[r];if(o.isFile()&&Ie(f.basename(r)))return[f.dirname(r)]}catch{return[]}return[]}function _t(e,t){if(!Ie(f.basename(t)))return!1;let n=Mt(e,t);return n?f.basename(t)==="tsconfig.json"||"include"in n||"files"in n||"references"in n:!1}function Ie(e){return e.startsWith("tsconfig")&&e.endsWith(".json")}function Lt(e){let t=[...new Set(e.map(n=>f.resolve(n)))].sort((n,r)=>n.localeCompare(r));return t.length<=1?t:t.filter(n=>!t.some(r=>r!==n&&jr(n,r)))}function hr(e,t){if(t.length===0||t.some(r=>f.resolve(r)===e))return!1;let n=f.join(e,"tsconfig.json");return zt(e,n)&&mr(e,n)}function mr(e,t){let r=Mt(e,t)?.include;return Array.isArray(r)?r.some(i=>typeof i=="string"&&i.trim()!==""&&!i.startsWith("!")&&(i.includes("/")||i.includes("**")||!f.extname(i))):!1}function Mt(e,t){try{let n=JSON.parse(Wt(e,t));return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}function zt(e,t){let n=D(e,t),r=T(e,n);return r?r==="present":cr(t)}function Wt(e,t){let n=D(e,t);if(O(e)){let i=R(e,n);if(!i)throw Object.assign(new Error(`Snapshot file ${n} is missing.`),{code:"ENOENT"});return i.content.toString("utf8")}return X(t,"TypeScript project config")}function yr(e,t){let n=O(t);if(!n)return e.sys;let r=f.resolve(t),i=new Set(n),o=Sr(r,n),s=e,c=a=>{let u=f.resolve(a);return j(r,u)?D(r,u):null};return{useCaseSensitiveFileNames:e.sys.useCaseSensitiveFileNames,fileExists(a){let u=c(a);return u===null?e.sys.fileExists(a):i.has(u)},readFile(a){let u=c(a);return u===null?e.sys.readFile(a):R(r,u)?.content.toString("utf8")},readDirectory(a,u,p,l,d){let m=f.resolve(a);return j(r,m)?s.matchFiles(m,u,p,l,e.sys.useCaseSensitiveFileNames,r,d,h=>o.get(f.resolve(h))??{files:[],directories:[]},h=>h):e.sys.readDirectory(a,u,p,l,d)}}}function Sr(e,t){let n=new Map,r=new Map,i=o=>{n.has(o)||n.set(o,new Set),r.has(o)||r.set(o,new Set)};i(e);for(let o of t){let s=o.split("/"),c=e;for(let a=0;a<s.length-1;a+=1){let u=s[a];i(c),r.get(c).add(u),c=f.join(c,u),i(c)}n.get(c).add(s.at(-1))}return new Map([...n].map(([o,s])=>[o,{files:[...s].sort(),directories:[...r.get(o)??[]].sort()}]))}function D(e,t){let n=f.relative(e,t);return n?n.split(f.sep).join("/"):"."}function jr(e,t){let n=f.relative(e,t);return!!n&&!n.startsWith("..")&&!f.isAbsolute(n)}import{createHash as Re}from"crypto";import{execFileSync as Ht}from"child_process";import{createRequire as br}from"module";var Pr=br(import.meta.url),xr=/\.(?:[cm]?[jt]sx?)$/iu,Cr=/\.[jt]sx$/iu,$t=/(?:^|\/)package\.json$/iu,$,Ee=new Map;function Ut(e,t){if(!Te(e))return;let n=Fr();if(n)try{let r=typeof t=="string"?t:t.toString("utf8"),i=Cr.test(e)?n.LanguageVariant.JSX:n.LanguageVariant.Standard,o=n.createScanner(n.ScriptTarget.Latest,!1,i,r),s=Re("sha256").update(`typescript-semantic-v1\0${i}\0`),c=!1,a=!1;for(;;){let u=o.scan();if(u===n.SyntaxKind.EndOfFileToken)break;if(u===n.SyntaxKind.WhitespaceTrivia)continue;if(u===n.SyntaxKind.NewLineTrivia){c&&(a=!0);continue}a&&s.update("line-break\0");let p=o.getTokenText();s.update(`${u}\0${Buffer.byteLength(p)}\0`).update(p).update("\0"),c=!0,a=!1}return s.digest("hex")}catch{return}}function Te(e){return xr.test(e)}function Oe(e,t){if($t.test(e))try{let n=JSON.parse(typeof t=="string"?t:t.toString("utf8"));if(typeof n!="object"||n===null||Array.isArray(n))return;let{scripts:r,...i}=n;return Re("sha256").update("typescript-package-json-v1\0").update(ve(i)).digest("hex")}catch{return}}function De(e){return $t.test(e)}function bo(e,t,n){if(!De(t)||!/^[a-f0-9]{64}$/u.test(n))return;let r=`${e}\0${t}\0${n}`;if(Ee.has(r))return Ee.get(r);let i;try{let o=Ht("git",["-C",e,"log","--all","--format=%H","--max-count=64","--",t],{encoding:"utf8",maxBuffer:1048576,timeout:5e3}).split(/\r?\n/u).filter(Boolean);for(let s of o){let c=Ht("git",["-C",e,"show",`${s}:${t}`],{encoding:null,maxBuffer:4194304,timeout:5e3});if(Re("sha256").update(c).digest("hex")===n){i=Oe(t,c);break}}}catch{i=void 0}return Ee.set(r,i),i}function Fr(){if($!==void 0)return $;try{$=Pr("typescript")}catch{$=null}return $}function ve(e){return Array.isArray(e)?`[${e.map(ve).join(",")}]`:typeof e=="object"&&e!==null?`{${Object.entries(e).sort(([t],[n])=>t.localeCompare(n)).map(([t,n])=>`${JSON.stringify(t)}:${ve(n)}`).join(",")}}`:JSON.stringify(e)}import{closeSync as qt,existsSync as Le,openSync as wr,realpathSync as kr,renameSync as Ir,unlinkSync as Jt,writeSync as Er}from"fs";import{dirname as vr,join as Rr}from"path";var Tr="fingerprint-stat-cache.json",Kt=1,Or=8*1024*1024,_e=new Map;function Ne(e,t,n,r){let i=Yt(e),o=i.files.get(t);if(!(!o||!Vt(o,n,r)))return i.hits+=1,{hash:o.hash,size:o.fingerprintSize,...o.semanticHash===void 0?{}:{semanticHash:o.semanticHash}}}function Ge(e,t,n,r,i){if(i.hash==="unreadable"||i.size<0||!Number.isFinite(i.size))return;let o=Yt(e),s={kind:n,dev:r.dev,ino:r.ino,mtimeMs:r.mtimeMs,ctimeMs:r.ctimeMs,size:r.size,hash:i.hash,fingerprintSize:i.size,...i.semanticHash===void 0?{}:{semanticHash:i.semanticHash}},c=o.files.get(t);c&&Ar(c,s)||(o.files.set(t,s),o.stores+=1,o.dirty=!0)}function Ae(e){let t=_e.get(Xt(e));if(!(!t?.dirty||!t.cachePath))try{let n=vr(t.cachePath);if(!Le(n))return;Br(t.cachePath,Lr(t)),t.dirty=!1}catch{}}function Yt(e){let t=Xt(e),n=_e.get(t);if(n)return n;let r=Dr(t),i=_r(r),o={cachePath:r,files:i,dirty:!1,hits:0,stores:0};return _e.set(t,o),o}function Dr(e){try{let t=Se(e);return Le(t)?Rr(t,Tr):null}catch{return null}}function _r(e){let t=new Map;if(!e||!Le(e))return t;try{let n=JSON.parse(V(e,{inputKind:"fingerprint stat cache",maxBytes:Or}).toString("utf8"));if(!Nr(n))return t;for(let[r,i]of Object.entries(n.files))i&&t.set(r,i)}catch{return t}return t}function Lr(e){return{version:Kt,files:Object.fromEntries(e.files)}}function Nr(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.version!==Kt||typeof t.files!="object"||t.files===null?!1:Object.values(t.files).every(Gr)}function Gr(e){if(typeof e!="object"||e===null)return!1;let t=e;return(t.kind==="file"||t.kind==="symlink")&&Number.isFinite(t.dev)&&Number.isFinite(t.ino)&&Number.isFinite(t.mtimeMs)&&Number.isFinite(t.ctimeMs)&&Number.isFinite(t.size)&&Number.isFinite(t.fingerprintSize)&&typeof t.hash=="string"&&t.hash!=="unreadable"&&(t.semanticHash===void 0||typeof t.semanticHash=="string")}function Vt(e,t,n){return e.kind===t&&e.dev===n.dev&&e.ino===n.ino&&e.mtimeMs===n.mtimeMs&&e.ctimeMs===n.ctimeMs&&e.size===n.size}function Ar(e,t){return Vt(e,t.kind,t)&&e.hash===t.hash&&e.fingerprintSize===t.fingerprintSize&&e.semanticHash===t.semanticHash}function Br(e,t){let n=`${e}.${process.pid}.tmp`;try{Jt(n)}catch{}let r=Buffer.from(`${JSON.stringify(t)}
|
|
4
|
+
`,"utf8"),i=wr(n,"wx",384);try{Z(i,r,{writeFile:(o,s,c,a)=>Er(o,s,c,a)},"fingerprint stat cache")}catch(o){throw qt(i),Jt(n),o}qt(i),Ir(n,e)}function Xt(e){return kr(e)}var K=64*1024*1024,Kr=1024*1024,Yr=1024,L=class extends Error{constructor(n,r,i,o){super(`${n} ${JSON.stringify(r)} is ${i} bytes; the safety limit is ${o} bytes`);this.inputKind=n;this.inputPath=r;this.observedBytes=i;this.limitBytes=o;this.name="InputTooLargeError"}inputKind;inputPath;observedBytes;limitBytes;code="SCIP_QUERY_INPUT_TOO_LARGE"};function Vr(e){return[...new Set((e??[]).map(t=>t.trim()).filter(Boolean))].sort((t,n)=>t.localeCompare(n))}function He(e,t,n={}){let r=I(t),i=pt(e,()=>J(e)),o=qr(i,...r.split("/"));if(!j(i,o)||o===i)throw new g(t,"outside-project");let s=J(o);if(!j(i,s)||s===i)throw new g(t,"outside-project");let c=ze(s);if(!c.isFile())throw new g(t,"not-a-file");let a={projectRoot:i,relativePath:r,absolutePath:s,size:c.size,mtimeMs:c.mtimeMs,device:c.dev,inode:c.ino},u=n.maxBytes??K;if(Q(u),a.size>u)throw new L(n.inputKind??"project file",a.relativePath,a.size,u);return a}function Xr(e,t,n={}){let r=I(t),i=T(e,r);if(i){if(i==="missing")throw Object.assign(new Error(`Snapshot project file ${JSON.stringify(r)} does not exist.`),{code:"ENOENT"});let a=R(e,r);if(!a)throw new g(r,"changed-during-read");let u=n.maxBytes??K;if(Q(u),a.size>u)throw new L(n.inputKind??"project file",r,a.size,u);return Buffer.from(a.content)}let o=He(e,t,n),s=n.maxBytes??K,c=nn(o.absolutePath,"r");try{let a=U(c);if(q(a,o,t),a.size>s)throw new L(n.inputKind??"project file",o.relativePath,a.size,s);let u=Wr(c),p=U(c);if(q(p,o,t),u.byteLength!==a.size)throw new g(t,"changed-during-read");return u}finally{tn(c)}}function zo(e,t,n,r={}){if(n.byteLength===0)throw new Error("Project file probe literal must not be empty.");let{matchedLiteralIndexes:i,...o}=Qr(e,t,[n],r);return{...o,includesLiteral:i.length>0}}function Qr(e,t,n,r={}){if(n.length===0||n.some(a=>a.byteLength===0))throw new Error("Project file probe literals must not be empty.");let i=I(t),o=T(e,i);if(o){if(o==="missing")throw Object.assign(new Error(`Snapshot project file ${JSON.stringify(i)} does not exist.`),{code:"ENOENT"});let a=R(e,i);if(!a)throw new g(i,"changed-during-read");let u=r.maxBytes??K;if(Q(u),a.size>u)throw new L(r.inputKind??"project file",i,a.size,u);let p=!a.content.includes(0)&&Qt(a.content),l=n.map(en),d=p?ei(a.content,n,l):[];return{byteLength:a.size,isUtf8Text:p,matchedLiteralIndexes:d,bytes:d.length>0?Buffer.from(a.content):null,...r.computeSha256?{sha256:a.sha256}:{}}}let s=He(e,t,r),c=nn(s.absolutePath,"r");try{let a=U(c);q(a,s,t);let u=r.computeSha256?Be("sha256"):null,p=r.scratchBuffer??Buffer.allocUnsafe(Kr);if(p.byteLength===0)throw new Error("Project file probe scratch buffer must not be empty.");let l=0,d=n.map(()=>!1),m=!1,h=!0,b=Buffer.alloc(0),Y=n.map(()=>Buffer.alloc(0)),N=n.map(en);for(;l<a.size;){let P=Zt(c,p,0,Math.min(p.byteLength,a.size-l),l);if(P<=0)throw new g(t,"changed-during-read");let x=p.subarray(0,P);if(u?.update(x),m||=x.includes(0),h){let S=b.byteLength>0?Buffer.concat([b,x]):x,B=Zr(S);h=Qt(S.subarray(0,B)),b=Buffer.from(S.subarray(B))}for(let S=0;S<n.length;S+=1){if(d[S])continue;let B=n[S],qe=Y[S];d[S]=ti(x,B,qe,N[S]),Y[S]=ni(x,B,qe)}l+=P}h&&=b.byteLength===0,q(U(c),s,t);let G=!m&&h,A=G?d.flatMap((P,x)=>P?[x]:[]):[],k=null;if(A.length>0){k=Buffer.allocUnsafe(a.size);let P=0;for(;P<k.byteLength;){let x=Zt(c,k,P,k.byteLength-P,P);if(x<=0)throw new g(t,"changed-during-read");P+=x}q(U(c),s,t)}return{byteLength:a.size,isUtf8Text:G,matchedLiteralIndexes:A,bytes:k,...u?{sha256:u.digest("hex")}:{}}}finally{tn(c)}}function Wo(e,t,n={}){return Xr(e,t,n).toString("utf8")}function q(e,t,n){if(!e.isFile()||e.dev!==t.device||e.ino!==t.inode||e.size!==t.size)throw new g(n,"changed-during-read")}function Zr(e){if(e.byteLength===0)return 0;let t=e.byteLength-1,n=0;for(;t>=0&&n<3&&(e[t]&192)===128;)n+=1,t-=1;if(t<0)return e.byteLength;let r=e[t];return((r&128)===0?1:(r&224)===192?2:(r&240)===224?3:(r&248)===240?4:0)>e.byteLength-t?t:e.byteLength}function ei(e,t,n){return t.flatMap((r,i)=>Me(e,r,n[i])?[i]:[])}function ti(e,t,n,r){if(Me(e,t,r))return!0;if(n.byteLength===0||t.byteLength===1)return!1;let i=e.subarray(0,Math.min(e.byteLength,t.byteLength-1));return Me(Buffer.concat([n,i]),t,r)}function Me(e,t,n){if(n<0)return e.includes(t);let r=t[n],i=e.indexOf(r),o=0;for(;i>=0;){if(o+=1,o>Yr)return e.includes(t);let s=i-n;if(s>=0&&s+t.byteLength<=e.byteLength&&e.compare(t,0,t.byteLength,s,s+t.byteLength)===0)return!0;i=e.indexOf(r,i+1)}return!1}function en(e){for(let n=1;n<e.byteLength;n+=1){let r=e[n];if(r>=65&&r<=90)return n}let t=e[0];return t>=65&&t<=90?0:-1}function ni(e,t,n){let r=t.byteLength-1;if(r===0)return Buffer.alloc(0);if(e.byteLength>=r)return Buffer.from(e.subarray(e.byteLength-r));let i=Buffer.concat([n,e]);return Buffer.from(i.subarray(Math.max(0,i.byteLength-r)))}function $e(e){return typeof e=="object"&&e!==null&&"code"in e&&(e.code==="ENOENT"||e.code==="ENOTDIR")}function Ho(e,t){try{return He(e,t),!0}catch(n){if($e(n))return!1;throw n}}function ri(e){let t=O(e);return t?t.filter(n=>n&&!de(n)).sort():(ui(e)??li(e)).filter(n=>n&&!de(n)).sort()}function ii(e,t={}){let n=(t.includePaths??[]).map(I),r=[...new Set([...ri(e),...n])].filter(s=>!de(s)).filter(s=>!t.language||Ft(s,t.language,t.markerFiles)).filter(s=>!t.includePath||t.includePath(s)).sort((s,c)=>s.localeCompare(c)),i=J(e),o=r.flatMap(s=>rn(e,i,s));return Ae(i),o}function rn(e,t,n){let r=Rt(e,n);if(r)return[{path:n,size:r.fingerprintSize??r.size,hash:r.sha256}];if(T(e,n)==="present"){let o=R(e,n);if(o)return[{path:n,size:o.fingerprintSize??o.size,hash:o.sha256}]}let i=We(e,n);try{let o=ze(i);if(o.isSymbolicLink()){let b=Ne(t,n,"symlink",fe(o));if(b)return[{path:n,size:b.size,hash:b.hash}];let Y=J(i),N=Ur(t,Y);if(N===".."||N.startsWith(`..${Jr}`)||$r(N))throw new Error("external symlink");let G=Hr(i),A=Be("sha256").update("symlink\0").update(G).digest("hex"),k=Buffer.byteLength(G);return Ge(t,n,"symlink",fe(o),{hash:A,size:k}),[{path:n,size:k,hash:A}]}let s=Te(n)||De(n),c=Ne(t,n,"file",fe(o));if(c&&(!s||c.semanticHash!==void 0))return[{path:n,size:c.size,hash:c.hash,...c.semanticHash===void 0?{}:{semanticHash:c.semanticHash}}];let a=Be("sha256"),u=s,p=[],l=Ke(i,{inputKind:"project fingerprint input",maxBytes:K},b=>{a.update(b),u&&p.push(Buffer.from(b))}),d=a.digest("hex"),m=u?Buffer.concat(p,l):void 0,h=m?Ut(n,m)??Oe(n,m):void 0;return Ge(t,n,"file",fe(o),{hash:d,size:l,...h===void 0?{}:{semanticHash:h}}),[{path:n,size:l,hash:d,...h===void 0?{}:{semanticHash:h}}]}catch(o){return $e(o)?[]:[{path:n,size:-1,hash:"unreadable"}]}}function fe(e){return{dev:e.dev,ino:e.ino,mtimeMs:e.mtimeMs,ctimeMs:e.ctimeMs,size:e.size}}function on(e,t,n){let r=Ue(t,n),i=[...r.typescriptProjects.filter(a=>ci(e,a)),...r.clojureConfigPath?[r.clojureConfigPath]:[]],o=r.languages.includes("typescript")?Bt(e,r.typescriptProjectMode,r.typescriptProjects):null,s=r.languages.includes("typescript")?r.typescriptProjectMode==="workspace"?pe(e,r.typescriptProjects):["."]:[],c=Nt(s);return{...r,files:ii(e,{includePath:a=>{if(a===".scipquery.json")return!1;let u=ue(a,t,i);return u==="other"||u==="config"&&Gt(a)&&!c.has(a)?!1:u!=="source"||!si(a)||!o?!0:o.has(a)},includePaths:i})}}function $o(e,t){let n=new Set(t.files.map(o=>o.path)),r=on(e,t.languages,t),i=new Map(r.files.map(o=>[o.path,o]));return{...Ue(t.languages,t),files:[...t.files.flatMap(o=>{let s=i.get(o.path);return s?[s]:[]}),...r.files.filter(o=>!n.has(o.path))]}}function Uo(e,t,n,r,i,o){let s=l=>({mode:"full",fingerprint:on(e,t,n),reason:l});if(!i)return s("change-journal-unavailable");if(!i.complete)return s(`change-journal-incomplete:${i.incompleteReason??"unknown"}`);if(!o)return s("accepted-generation-unavailable");if(i.baseGeneration!==o)return s("change-journal-base-mismatch");if(!r)return s("prior-project-input-snapshot-unavailable");let c=Ue(t,n);if(!oi(r,c))return s("project-input-configuration-changed");if(new Set(r.files.map(l=>l.path)).size!==r.files.length)return s("prior-project-input-snapshot-has-duplicate-paths");if(i.entries.length===0)return{mode:"delta",fingerprint:{...c,files:[...r.files].sort((l,d)=>l.path.localeCompare(d.path))},changedPaths:[]};let a=[...c.typescriptProjects,...c.clojureConfigPath?[c.clojureConfigPath]:[]],u=new Map(r.files.map(l=>[l.path,l]));for(let l of i.entries){let d=u.get(l.path);if(ue(l.path,t,a)!=="source")return s("non-source-project-input-changed");if(l.kind==="add"&&d)return s("added-path-already-in-prior-project-input-snapshot");if(l.kind==="delete"&&!d)return s("deleted-path-not-in-prior-project-input-snapshot");if(l.kind==="change"&&!d)return s("changed-path-not-in-prior-project-input-snapshot");if(d&&(d.hash==="unreadable"||d.size<0))return s("changed-path-was-unreadable")}let p=J(e);for(let l of i.entries){let d=rn(e,p,l.path);if(l.kind==="delete"){if(d.length!==0)return s("deleted-source-is-still-readable");u.delete(l.path);continue}if(d.length!==1||d[0].hash==="unreadable"||d[0].size<0)return s(l.kind==="add"?"added-source-is-not-readable":"changed-source-no-longer-readable");u.set(l.path,d[0])}return Ae(p),{mode:"delta",fingerprint:{...c,files:[...u.values()].sort((l,d)=>l.path.localeCompare(d.path))},changedPaths:i.entries.map(l=>l.path).sort()}}function oi(e,t){return e.version===t.version&&JSON.stringify([...e.languages].sort())===JSON.stringify(t.languages)&&e.pnpmWorkspaces===t.pnpmWorkspaces&&e.typescriptProjectMode===t.typescriptProjectMode&&JSON.stringify([...e.typescriptProjects].sort())===JSON.stringify(t.typescriptProjects)&&e.clojureConfigPath===t.clojureConfigPath}function si(e){return/\.(?:[cm]?[jt]sx?|vue)$/iu.test(e)}function ci(e,t){let n;try{n=I(t)}catch{return!1}let r=T(e,n);if(r)return r==="present";try{return ze(We(e,n)).isFile()}catch(i){if($e(i))return!1;throw i}}function Ue(e,t){return{version:3,languages:[...e].sort(),pnpmWorkspaces:t.typescriptProjectMode!=="workspace"&&t.pnpmWorkspaces===!0,typescriptProjectMode:t.typescriptProjectMode??"single",typescriptProjects:Vr(t.typescriptProjects),clojureConfigPath:ai(t.clojureConfigPath)}}function ai(e){return e?.trim()||void 0}function ui(e){try{let t=dt(e,52428800,()=>Mr("git",["-C",e,"ls-files","-co","-v","-z","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:104857600,stdio:["ignore","pipe","ignore"],timeout:3e4,killSignal:"SIGKILL"}));return[...ht(t)]}catch{return null}}function li(e){let t=[],n=[""];for(;n.length>0;){let r=n.pop(),i=r?We(e,r):e,o;try{o=zr(i,{withFileTypes:!0})}catch{continue}for(let s of o){let c=r?`${r}/${s.name}`:s.name;if(s.isDirectory()){de(c)||n.push(c);continue}t.push(c)}}return t}function de(e){let t=e.split("/");return e==="meta.json"||At(e)||t[0]===".scipquery"&&(t[1]==="events"||t[1]==="ledger"||t[1]==="releases"||t[1]==="suppressions")||t.some(n=>pi.has(n))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var pi=new Set([".git","node_modules",".scipquery-cache",".scipquery-generations",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]);export{ue as a,Ft as b,eo as c,jt as d,to as e,no as f,Zn as g,nr as h,M as i,Xe as j,ee as k,te as l,g as m,he as n,di as o,gi as p,j as q,I as r,Qe as s,Ci as t,Se as u,ot as v,Fn as w,_i as x,Li as y,Ni as z,Gi as A,Ai as B,bo as C,dt as D,ht as E,v as F,Ki as G,Yi as H,Vi as I,Vn as J,Xi as K,Qi as L,se as M,w as N,pe as O,Nt as P,Gt as Q,go as R,At as S,Bt as T,ho as U,L as V,Vr as W,He as X,Xr as Y,zo as Z,Qr as _,Wo as $,$e as aa,Ho as ba,ri as ca,ii as da,on as ea,$o as fa,Uo as ga,Ue as ha};
|
|
5
|
+
//# sourceMappingURL=chunk-7HXT6YLU.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as J,b as se,d as ee,e as ne,f as H}from"./chunk-Y5DFAW5W.js";import{h as re}from"./chunk-NU3KFF2O.js";import{c as W,e as Z}from"./chunk-U3SXIMII.js";import{a as G}from"./chunk-SKKXTABJ.js";import{n as Y}from"./chunk-RBAD4GJ2.js";import{E as ae}from"./chunk-ZLMXIQLC.js";import{k as X}from"./chunk-ETC674NS.js";var he=16,Se=4,Le=3e3,be=800,ve=new Set(["assignment","const_declaration","const_item","field_declaration","lexical_declaration","local_declaration_statement","local_variable_declaration","static_item","variable_declaration"]);function Xe(t,n,r={}){let c=r.maxSteps??he;if(!Number.isSafeInteger(c)||c<=0)throw new RangeError(`maxSteps must be a positive safe integer; received ${c}`);let g=new Map(n.nodes.map(e=>[e.id,e])),f=we(r.focusLocations??[]),s=new Set,d=new Map(n.edges.map(e=>[e.id,e])),u=O(n.paths.flatMap(e=>e.nodeIds)),h=O(n.anchors.filter(e=>e.status==="matched").flatMap(e=>e.nodeIds)),v=n.nodes.filter(e=>e.disposition==="emitted"&&e.attributes.upstreamCausalPath===!0).sort((e,L)=>Number(L.attributes.upstreamCausalDistance??0)-Number(e.attributes.upstreamCausalDistance??0)||e.id.localeCompare(L.id)).map(e=>e.id),a=new Set(v),y=Math.max(0,c-h.length),w=Ne(n,h,f,y).slice(0,y),k=new Set(w),P=new Set(w),b=new Set([...u,...v,...h]),l=n.edges.filter(e=>e.disposition==="emitted"&&e.kind!=="structural-membership"),p=n.edges.filter(e=>e.disposition!=="excluded"&&e.disposition!=="unsupported"&&e.kind!=="structural-membership"),x=new Set([...n.paths.flatMap(e=>e.edgeIds),...l.filter(e=>a.has(e.fromNodeId)&&a.has(e.toNodeId)).map(e=>e.id)]),C=n.paths.some(e=>e.edgeIds.length>0),N=new Set(h);for(let e of w)N.add(e);for(let e of n.paths){let L=e.nodeIds[0],I=d.get(e.edgeIds[0]??""),$=e.nodeIds[1];L&&$&&I?.fromNodeId===L&&I.toNodeId===$&&N.add(L)}if(n.paths.every(e=>e.nodeIds.length===0))for(let e of n.anchors)for(let L of e.nodeIds)N.add(L);let R=ke(h,p,g,Se),E=O(l.filter(e=>e.kind==="call"&&h.includes(e.fromNodeId)).map(e=>e.toNodeId)),S=new Set(O([...R,...C?[]:E]));for(let e of S)N.add(e);let T=O(l.flatMap(e=>b.has(e.fromNodeId)||b.has(e.toNodeId)?[e.fromNodeId,e.toNodeId]:[])),_=n.nodes.filter(e=>e.disposition==="emitted"&&e.kind!=="structural-region"&&l.some(L=>L.fromNodeId===e.id||L.toNodeId===e.id)).map(e=>e.id),A=O([...v,...u,...h,...w,...S,...T,..._]).filter(e=>g.has(e)),F=[];for(let e of A)C&&!b.has(e)&&!k.has(e)&&!S.has(e)||F.length>=c&&!b.has(e)||F.push(e);let o=new Set(F),i=new Map(F.map(e=>[e,Pe(e)])),m=new Set([...u,...v]),j=new Set(n.anchors.flatMap(e=>e.nodeIds)),D=F.map((e,L)=>{let I=g.get(e),$=Ee(I,f);for(let z of $)s.add(V(I.location.file,z));return{id:i.get(e),nodeId:e,order:L,role:j.has(e)?"anchor":m.has(e)?"connector":"junction",kind:I.kind,label:I.label,location:I.location,behavior:Ie(t,I,j.has(e),[...new Set([...$,...Ce(t,I,p,g,x,N)])],$,N.has(I.id)&&($.length===0||j.has(I.id)),S.has(I.id),P.has(I.id)&&$.length===0)}}),U=new Map;for(let e of n.paths)for(let L=0;L<e.edgeIds.length;L+=1){let I=d.get(e.edgeIds[L]),$=e.nodeIds[L],z=e.nodeIds[L+1];!I||!$||!z||U.set(I.id,I.fromNodeId===$&&I.toNodeId===z?"forward":"reverse")}let B=p.filter(e=>o.has(e.fromNodeId)&&o.has(e.toNodeId)).sort((e,L)=>_e(e,L,n)).map((e,L)=>({id:Ae(e.id),edgeId:e.id,order:L,kind:e.kind,fromStepId:i.get(e.fromNodeId),toStepId:i.get(e.toNodeId),directed:!0,pathTraversal:U.get(e.id)??"adjacent",evidence:e.evidence})),q=new Map(B.map(e=>[e.edgeId,e.id])),K=n.paths.map(e=>({id:e.id,status:e.status,stepIds:e.nodeIds.flatMap(L=>{let I=i.get(L);return I?[I]:[]}),transitionIds:e.edgeIds.flatMap(L=>{let I=q.get(L);return I?[I]:[]})})),oe=D.flatMap(e=>e.location?[`${e.location.file}:${e.location.line+1}`]:[]),me=n.anchors.some(e=>e.status==="ambiguous"),ge=K.some(e=>e.status==="connected"||e.status==="candidate"),ie=K.some(e=>e.status==="partial");return{status:D.length===0?"unavailable":me?"ambiguous":ge&&!ie?"connected":ie?"partial":"connected",steps:D,transitions:B,paths:K,coverage:{candidateNodes:A.length,returnedNodes:F.length,omittedNodeIds:A.filter(e=>!o.has(e)),returnedTransitions:B.length,withheldStatements:D.reduce((e,L)=>e+(L.behavior?.coverage.omittedStatements??0),0),requestedFocusLocations:f,matchedFocusLocations:f.filter(e=>s.has(V(e.file,e.line))),unmatchedFocusLocations:f.filter(e=>!s.has(V(e.file,e.line)))},behaviorCommand:pe(oe,"behavior"),exactSourceCommand:pe(oe,"source")}}function Ne(t,n,r,c){if(c<=0||r.length===0)return[];let g=new Set(n),f=new Set(r.map(s=>V(s.file,s.line)));return O(t.edges.filter(s=>s.disposition!=="excluded"&&s.disposition!=="unsupported"&&["call","runtime-boundary"].includes(s.kind)&&g.has(s.fromNodeId)&&s.evidence.some(d=>!["candidate","unknown"].includes(d.strength)&&d.location&&f.has(V(d.location.file,d.location.line)))).sort((s,d)=>{let u=s.evidence.find(v=>v.location)?.location,h=d.evidence.find(v=>v.location)?.location;return(u?.file??"").localeCompare(h?.file??"")||(u?.line??Number.MAX_SAFE_INTEGER)-(h?.line??Number.MAX_SAFE_INTEGER)||s.id.localeCompare(d.id)}).map(s=>s.toNodeId)).slice(0,c)}function Ie(t,n,r,c,g,f,s,d){if(!n.location||!["symbol","source-construct","runtime-boundary-participant"].includes(n.kind))return null;let u=n.location.endLine??n.location.line,h=X(t,n.location.file),v=c.length>0?c:[n.location.line],a=n.kind==="runtime-boundary-participant"?ee(t,n.location.file,0,Math.max(0,h.length-1),[n.location.line]):ee(t,n.location.file,n.location.line,u,v),y=c.filter(S=>S>=a.startLine&&S<=a.endLine),M=J(t,n.location.file,a.startLine,a.endLine,y),w=M??(y.length>0?J(t,n.location.file,a.startLine,a.endLine,y,{requireSavings:!1}):null),k=y.length>0?Te(t,n,a.startLine,a.endLine,y,w,f):null,P=h.slice(a.startLine,a.endLine+1).join(`
|
|
2
2
|
`).length,b=H(t,n.location.file,a.startLine,a.endLine),l=h.slice(a.startLine,a.endLine+1).some((S,T)=>S.length>be&&(b.get(a.startLine+T)??[]).some(_=>["binding","branch","loop","call","return","throw","mutation"].includes(_))),p=S=>ye(t,n,a.startLine,a.endLine,g.filter(T=>T>=a.startLine&&T<=a.endLine),S),x=(s||n.kind==="runtime-boundary-participant"||n.anchorIds.length>0)&&P<=Le,C=r&&(y.length===0||x);if(M&&(d||C))return p(ce(M));if(!d&&!C&&k&&!l&&!x&&k.renderedCharacters<(w?.outlineCharacters??P))return p(k);if(M)return p(ce(M));let N=h.slice(a.startLine,a.endLine+1),R=N.join(`
|
|
3
|
-
`),E=H(t,n.location.file,a.startLine,a.endLine);return p({kind:"source",constructKind:"source construct",signature:N.find(S=>S.trim().length>0)?.trim()??n.label,lines:N.map((S,T)=>({line:a.startLine+T,endLine:a.startLine+T,depth:0,signals:E.get(a.startLine+T)??[],text:S,copied:!0})),coverage:{sourceStatements:N.length,representedStatements:N.length,copiedStatements:N.length,omittedStatements:0},rawCharacters:R.length,renderedCharacters:R.length})}function ye(t,n,r,c,g,f){if(!n.location)return f;let s=
|
|
4
|
-
`),N=p==="compiler-referenced-declaration"?null:J(t,l.relativePath,l.startLine,l.endLine,[]),R=N?[N.signature,...N.lines.map(A=>`${A.line+1}${A.signals.length>0?`[${A.signals.join(",")}]`:""} ${A.text}`)].join(" | "):null,E=R&&R.length<C.length?R:C,S={symbol:l.symbol,label:l.leaf,file:l.relativePath,line:x.startLine,endLine:x.endLine},T=p==="compiler-referenced-declaration"?1e3:8e3,_=p==="compiler-referenced-declaration"?12:120;if(E.length>T||x.endLine-x.startLine>_){b.push({...S,reason:"source-too-large"});continue}P.push({kind:p,...S,text:E})}return{...f,...P.length===0?{}:{supportingDeclarations:P},...b.length===0?{}:{omittedSupportingDeclarations:b}}}function xe(t,n,r,c){let g=ae(t,n);if(!g)return{startLine:r,endLine:c};let f=[];fe(g.rootNode,d=>{ve.has(d.type)&&d.startPosition.row<=r&&d.endPosition.row>=c&&f.push(d)});let s=f.sort((d,u)=>d.endPosition.row-d.startPosition.row-(u.endPosition.row-u.startPosition.row)||d.endIndex-d.startIndex-(u.endIndex-u.startIndex))[0];return s?{startLine:s.startPosition.row,endLine:s.endPosition.row}:{startLine:r,endLine:c}}function fe(t,n){n(t);for(let r of t.namedChildren)fe(r,n)}function ce(t){return{kind:"outline",constructKind:t.constructKind,signature:t.signature,lines:t.lines,coverage:t.coverage,rawCharacters:t.rawCharacters,renderedCharacters:t.outlineCharacters}}function Ce(t,n,r,c,g,f){if(!n.location||!["symbol","source-construct","runtime-boundary-participant"].includes(n.kind))return[];let s=new Set,d=new Set(Y(t,n.location.file)?.callSites.map(u=>u.line)??[]);if(n.kind==="runtime-boundary-participant"&&s.add(n.location.line),f.has(n.id))for(let u of re(t,{files:[n.location.file]}))u.source.startLine>=n.location.line&&u.source.startLine<=(n.location.endLine??n.location.line)&&s.add(u.source.startLine);for(let u of r){if(u.fromNodeId!==n.id&&u.toNodeId!==n.id)continue;let h=c.get(u.fromNodeId===n.id?u.toNodeId:u.fromNodeId),v=f.has(n.id)&&["call","reference","runtime-boundary"].includes(u.kind)&&u.fromNodeId===n.id,a=(h?.anchorIds.length??0)>0;if(!g.has(u.id)&&!v&&!a)continue;let y=u.evidence.flatMap(b=>b.location?.file===n.location.file?[b.location.line]:[]),M=y.filter(b=>d.has(b));for(let b of M.length>0?M:y)s.add(b);let w=h?.attributes.leaf;if(typeof w!="string"||w.length===0)continue;let k=G(t,n.location.file,w).filter(b=>b>=n.location.line&&b<=(n.location.endLine??n.location.line)),P=k.find(b=>d.has(b))??k[0];P!==void 0&&s.add(P)}return[...s].sort((u,h)=>u-h)}function Ee(t,n){if(!t.location)return[];let r=t.location.endLine??t.location.line;return n.filter(c=>c.file===t.location.file&&c.line>=t.location.line&&c.line<=r).map(c=>c.line)}function we(t){let n=new Map;for(let r of t){if(!r.file||!Number.isSafeInteger(r.line)||r.line<0)throw new RangeError(`Behavior focus locations require a repository file and non-negative line; received ${JSON.stringify(r)}.`);n.set(V(r.file,r.line),{file:r.file,line:r.line})}return[...n.values()].sort((r,c)=>r.file.localeCompare(c.file)||r.line-c.line)}function V(t,n){return`${t}\0${n}`}function Te(t,n,r,c,g,f,s){if(!n.location)return null;let d=X(t,n.location.file),u=H(t,n.location.file,r,c),h=[...u].filter(([,o])=>o.length>0).map(([o])=>o).sort((o,i)=>o-i),v=g.map(o=>(u.get(o)??[]).length>0?o:h.find(i=>i>o&&i-o<=8)??o),a=new Set([...g,...v]),y=s?
|
|
3
|
+
`),E=H(t,n.location.file,a.startLine,a.endLine);return p({kind:"source",constructKind:"source construct",signature:N.find(S=>S.trim().length>0)?.trim()??n.label,lines:N.map((S,T)=>({line:a.startLine+T,endLine:a.startLine+T,depth:0,signals:E.get(a.startLine+T)??[],text:S,copied:!0})),coverage:{sourceStatements:N.length,representedStatements:N.length,copiedStatements:N.length,omittedStatements:0},rawCharacters:R.length,renderedCharacters:R.length})}function ye(t,n,r,c,g,f){if(!n.location)return f;let s=W(t,n.location.file,r,c);if(!s.available)return f;let d=H(t,n.location.file,r,c),u=X(t,n.location.file),h=new Set(g);for(let l of g){let p=Q(u[l]??"");if(!p)continue;let x=G(t,n.location.file,p).find(C=>C>l&&C<=c);x!==void 0&&h.add(x)}let v=[...new Map(s.targets.flatMap(l=>{let p=l.definition,x=p.relativePath===n.location.file&&p.startLine<=c&&p.endLine>=r;if(p.isTypeLike||x)return[];let C=Z(t,p),N=g.length>0&&C&&d.get(l.sourceLine)?.includes("return"),R=C&&h.has(l.sourceLine);return C&&!N&&!R?[]:[[p.symbol,{definition:p,kind:N?"return-value-transformer":R?"focused-causal-target":"compiler-referenced-declaration"}]]})).values()].sort((l,p)=>l.definition.relativePath.localeCompare(p.definition.relativePath)||l.definition.startLine-p.definition.startLine||l.definition.symbol.localeCompare(p.definition.symbol)),a=[],y=v.filter(({kind:l})=>l!=="compiler-referenced-declaration").map(({definition:l})=>({owner:l,depth:1})),M=new Set,w=new Set(v.map(({definition:l})=>l.symbol));for(;y.length>0;){let l=y.shift();if(!l||M.has(l.owner.symbol))continue;M.add(l.owner.symbol);let{owner:p,depth:x}=l,C=W(t,p.relativePath,p.startLine,p.endLine);if(!C.available)continue;let N=H(t,p.relativePath,p.startLine,p.endLine),R=X(t,p.relativePath);for(let E of C.targets){let S=E.definition,T=S.relativePath===p.relativePath&&S.startLine<=p.endLine&&S.endLine>=p.startLine;if(S.isTypeLike||T)continue;let _=Z(t,S),A=Q(R[E.sourceLine]??""),F=_&&A!==null&&G(t,p.relativePath,A).some(i=>i>E.sourceLine&&i<=p.endLine&&(N.get(i)??[]).some(m=>["branch","return","throw"].includes(m))),o=_&&((N.get(E.sourceLine)??[]).some(i=>["branch","return","throw"].includes(i))||F);_&&!o||(w.has(S.symbol)||(w.add(S.symbol),a.push({definition:S,kind:_?"focused-causal-target":"compiler-referenced-declaration"})),_&&x<2&&y.push({owner:S,depth:x+1}))}}let k=[...new Map([...v,...a].map(l=>[l.definition.symbol,l])).values()].sort((l,p)=>l.definition.relativePath.localeCompare(p.definition.relativePath)||l.definition.startLine-p.definition.startLine||l.definition.symbol.localeCompare(p.definition.symbol)),P=[],b=[];for(let{definition:l,kind:p}of k){let x=p==="compiler-referenced-declaration"?xe(t,l.relativePath,l.startLine,l.endLine):{startLine:l.startLine,endLine:l.endLine},C=X(t,l.relativePath).slice(x.startLine,x.endLine+1).join(`
|
|
4
|
+
`),N=p==="compiler-referenced-declaration"?null:J(t,l.relativePath,l.startLine,l.endLine,[]),R=N?[N.signature,...N.lines.map(A=>`${A.line+1}${A.signals.length>0?`[${A.signals.join(",")}]`:""} ${A.text}`)].join(" | "):null,E=R&&R.length<C.length?R:C,S={symbol:l.symbol,label:l.leaf,file:l.relativePath,line:x.startLine,endLine:x.endLine},T=p==="compiler-referenced-declaration"?1e3:8e3,_=p==="compiler-referenced-declaration"?12:120;if(E.length>T||x.endLine-x.startLine>_){b.push({...S,reason:"source-too-large"});continue}P.push({kind:p,...S,text:E})}return{...f,...P.length===0?{}:{supportingDeclarations:P},...b.length===0?{}:{omittedSupportingDeclarations:b}}}function xe(t,n,r,c){let g=ae(t,n);if(!g)return{startLine:r,endLine:c};let f=[];fe(g.rootNode,d=>{ve.has(d.type)&&d.startPosition.row<=r&&d.endPosition.row>=c&&f.push(d)});let s=f.sort((d,u)=>d.endPosition.row-d.startPosition.row-(u.endPosition.row-u.startPosition.row)||d.endIndex-d.startIndex-(u.endIndex-u.startIndex))[0];return s?{startLine:s.startPosition.row,endLine:s.endPosition.row}:{startLine:r,endLine:c}}function fe(t,n){n(t);for(let r of t.namedChildren)fe(r,n)}function ce(t){return{kind:"outline",constructKind:t.constructKind,signature:t.signature,lines:t.lines,coverage:t.coverage,rawCharacters:t.rawCharacters,renderedCharacters:t.outlineCharacters}}function Ce(t,n,r,c,g,f){if(!n.location||!["symbol","source-construct","runtime-boundary-participant"].includes(n.kind))return[];let s=new Set,d=new Set(Y(t,n.location.file)?.callSites.map(u=>u.line)??[]);if(n.kind==="runtime-boundary-participant"&&s.add(n.location.line),f.has(n.id))for(let u of re(t,{files:[n.location.file]}))u.source.startLine>=n.location.line&&u.source.startLine<=(n.location.endLine??n.location.line)&&s.add(u.source.startLine);for(let u of r){if(u.fromNodeId!==n.id&&u.toNodeId!==n.id)continue;let h=c.get(u.fromNodeId===n.id?u.toNodeId:u.fromNodeId),v=f.has(n.id)&&["call","reference","runtime-boundary"].includes(u.kind)&&u.fromNodeId===n.id,a=(h?.anchorIds.length??0)>0;if(!g.has(u.id)&&!v&&!a)continue;let y=u.evidence.flatMap(b=>b.location?.file===n.location.file?[b.location.line]:[]),M=y.filter(b=>d.has(b));for(let b of M.length>0?M:y)s.add(b);let w=h?.attributes.leaf;if(typeof w!="string"||w.length===0)continue;let k=G(t,n.location.file,w).filter(b=>b>=n.location.line&&b<=(n.location.endLine??n.location.line)),P=k.find(b=>d.has(b))??k[0];P!==void 0&&s.add(P)}return[...s].sort((u,h)=>u-h)}function Ee(t,n){if(!t.location)return[];let r=t.location.endLine??t.location.line;return n.filter(c=>c.file===t.location.file&&c.line>=t.location.line&&c.line<=r).map(c=>c.line)}function we(t){let n=new Map;for(let r of t){if(!r.file||!Number.isSafeInteger(r.line)||r.line<0)throw new RangeError(`Behavior focus locations require a repository file and non-negative line; received ${JSON.stringify(r)}.`);n.set(V(r.file,r.line),{file:r.file,line:r.line})}return[...n.values()].sort((r,c)=>r.file.localeCompare(c.file)||r.line-c.line)}function V(t,n){return`${t}\0${n}`}function Te(t,n,r,c,g,f,s){if(!n.location)return null;let d=X(t,n.location.file),u=H(t,n.location.file,r,c),h=[...u].filter(([,o])=>o.length>0).map(([o])=>o).sort((o,i)=>o-i),v=g.map(o=>(u.get(o)??[]).length>0?o:h.find(i=>i>o&&i-o<=8)??o),a=new Set([...g,...v]),y=s?ne(t,n.location.file,r,c,{minimumBodyLines:0}):null,M=f?[...new Map(v.flatMap(o=>f.lines.filter(i=>i.text.length<=500&&i.signals.some(m=>["branch","loop","catch","finally"].includes(m))&&o>=i.line&&o<=i.endLine).sort((i,m)=>i.endLine-i.line-(m.endLine-m.line)||i.line-m.line).slice(0,2).map(i=>[`${i.line}\0${i.endLine}`,i]))).values()]:se(t,n.location.file,r,c,v);for(let o of y?.lines??[])a.add(o.line);for(let o of M)a.add(o.line);for(let[o,i]of u)i.includes("call")&&i.includes("shape")&&a.add(o);let w=[];for(let o of v){let i=Q(d[o]??"");if(!i)continue;let m=G(t,n.location.file,i).filter(B=>B>o&&B<=c),j=m[0];j!==void 0&&a.add(j);let D=m.find(B=>(u.get(B)??[]).some(q=>q==="branch"||q==="loop"));if(D===void 0)continue;a.add(D);let U=(f?.lines??[]).find(B=>B.line===D)??{line:D,endLine:Math.min(c,D+40),depth:0,signals:u.get(D)??[],text:(d[D]??"").trim(),copied:!0},te=f?.lines??d.slice(U.line,U.endLine+1).map((B,q)=>{let K=U.line+q;return{line:K,endLine:K,depth:0,signals:u.get(K)??[],text:B.trim(),copied:!0}});w.push({focusLine:o,governingUse:D,lines:te.filter(B=>B.line>=U.line&&B.line<=U.endLine&&B.text.length<=500&&B.signals.some(q=>["binding","branch","call","mutation"].includes(q)))})}for(let o of w.sort((i,m)=>m.governingUse-m.focusLine-(i.governingUse-i.focusLine)||i.focusLine-m.focusLine).slice(0,2))for(let i of o.lines.slice(0,14))a.add(i.line);let k=new Set(["binding","branch","loop","call","return","throw","mutation"]);for(let o of M)for(let i of f?.lines??[])i.line<o.line||i.line>o.endLine||i.signals.some(m=>k.has(m))&&a.add(i.line);let P=d.slice(r,c+1).flatMap((o,i)=>{let m=Q(o);return m?[{name:m,line:r+i}]:[]}),b=!0;for(;b;){b=!1;for(let o of P)if([...a].some(m=>Me(d[m]??"",o.name))){a.has(o.line)||(a.add(o.line),b=!0);for(let m of G(t,n.location.file,o.name))m<r||m>c||a.has(m)||(u.get(m)??[]).some(j=>k.has(j))&&(a.add(m),b=!0)}}for(let o of f?.lines??[])if(o.signals.some(i=>["branch","loop","catch","finally"].includes(i))&&a.has(o.line))for(let i of f?.lines??[])i.line<o.line||i.line>o.endLine||i.signals.some(m=>k.has(m))&&a.add(i.line);let l=Y(t,n.location.file),p=new Set(l?.callSites.map(o=>o.line)??[]),x=u,C=new Map([...f?.lines??[],...M].filter(o=>o.signals.some(i=>["branch","loop","catch","finally"].includes(i))).map(o=>[o.line,o])),N=new Map((f?.lines??[]).filter(o=>o.text.length<=500&&o.signals.includes("shape")&&(o.signals.includes("call")||o.signals.includes("mutation")||o.signals.includes("return"))).sort((o,i)=>o.endLine-o.line-(i.endLine-i.line)||o.line-i.line).map(o=>[o.line,o])),R=new Map((y?.lines??[]).map(o=>[o.line,o.signals.filter(i=>i!=="lifecycle")])),E=[...a].filter(o=>o>=r&&o<=c).sort((o,i)=>o-i).map(o=>{let i=C.get(o)??N.get(o);return{line:o,endLine:i?.endLine??o,depth:i?.depth??0,signals:Be([...x.get(o)??[],...f?.lines.filter(m=>o>=m.line&&o<=m.endLine).flatMap(m=>m.signals)??[],...R.get(o)??[],...g.includes(o)?["anchor"]:[],...p.has(o)?["call"]:[]]),text:i?.text??(d[o]??"").trim(),copied:i?.copied??!0}}).filter(o=>o.text.length>0);if(E.length===0)return null;let S=y?.candidateLines??ne(t,n.location.file,r,c,{minimumBodyLines:0})?.candidateLines??0,T=Math.max(f?.coverage.sourceStatements??0,S,E.length),_=f?.signature??(d[r]??n.label).trim(),A=_.length+E.reduce((o,i)=>o+i.text.length+i.signals.join(",").length+12,0),F=d.slice(r,c+1).join(`
|
|
5
5
|
`).length;return{kind:"connector-slice",constructKind:f?.constructKind??"source construct",signature:_,lines:E,coverage:{sourceStatements:T,representedStatements:E.length,copiedStatements:E.length,omittedStatements:Math.max(0,T-E.length)},rawCharacters:F,renderedCharacters:A}}function Be(t){let n=["anchor","signature","binding","branch","loop","call","await","return","throw","mutation","shape","spread","catch","finally"],r=new Set(t);return n.filter(c=>r.has(c))}function Q(t){return/\b(?:const|let|var)\s+([\p{L}_$][\p{L}\p{N}_$]*)\s*(?:=|\bof\b|\bin\b)/u.exec(t)?.[1]??null}function Me(t,n){let r=n.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`(?:^|[^\\p{L}\\p{N}_$])${r}(?:$|[^\\p{L}\\p{N}_$])`,"u").test(t)}function Re(t,n,r){return O(t.flatMap(c=>{let g=r.get(c),f=n.filter(s=>s.kind==="call"&&s.toNodeId===c).map(s=>({edge:s,node:r.get(s.fromNodeId)})).filter(s=>s.node!==void 0&&["symbol","source-construct","runtime-boundary-participant"].includes(s.node.kind)&&s.node.location!==null).sort((s,d)=>{let u=le(d.edge)-le(s.edge);if(u!==0)return u;let h=de(s.node,g)?0:1,v=de(d.node,g)?0:1,a=(s.node.location?.endLine??s.node.location?.line??0)-(s.node.location?.line??0),y=(d.node.location?.endLine??d.node.location?.line??0)-(d.node.location?.line??0);return h-v||a-y||s.node.label.localeCompare(d.node.label)});return f[0]?[f[0].node.id]:[]}))}function le(t){let n={exact:4,mixed:3,derived:2,candidate:1,unknown:0};return Math.max(0,...t.evidence.map(r=>n[r.strength]))}function de(t,n){return!t.location||!n?.location?!1:ue(t.location.file)===ue(n.location.file)}function ue(t){return t.split("/").filter(Boolean).slice(0,2).join("/")}function ke(t,n,r,c){let g=new Set(t),f=new Set,s=[],d=O(t);for(let u=0;u<c&&d.length>0;u+=1){let h=d.filter(a=>!f.has(a));for(let a of h)f.add(a);let v=Re(h,n,r);d=[];for(let a of v)!g.has(a)&&!s.includes(a)&&s.push(a),f.has(a)||d.push(a)}return s}function _e(t,n,r){let c=new Map(r.paths.flatMap(g=>g.edgeIds).map((g,f)=>[g,f]));return(c.get(t.id)??Number.MAX_SAFE_INTEGER)-(c.get(n.id)??Number.MAX_SAFE_INTEGER)||t.id.localeCompare(n.id)}function Pe(t){return`step:${t}`}function Ae(t){return`transition:${t}`}function pe(t,n){return t.length===0?null:`scip-query inspect ${t.map(r=>`--at ${De(r)}`).join(" ")} --view ${n}`}function De(t){return`'${t.replace(/'/gu,`'"'"'`)}'`}function O(t){return[...new Set(t)]}export{Le as a,Xe as b};
|
|
6
|
-
//# sourceMappingURL=chunk-
|
|
6
|
+
//# sourceMappingURL=chunk-7R4V5ES6.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{a as U,b as j}from"./chunk-2OOY75BW.js";import{a as J}from"./chunk-CKBUBRYD.js";import{b as K}from"./chunk-3AF4TUFK.js";import{b as z,e as I,i as B}from"./chunk-H5EXS3HM.js";import{d as X}from"./chunk-JFMEXGFE.js";import{d as S,e as N,f as F,h as G}from"./chunk-7F45LJKI.js";var V=class extends Error{constructor(t){super(t),this.name="ReindexLockUnavailableError"}};import{existsSync as ee,statSync as Se}from"fs";import{dirname as re,join as ie}from"path";import{appendFileSync as ce,existsSync as ge,mkdirSync as fe,renameSync as me,rmSync as pe,statSync as ye,truncateSync as Re}from"fs";import{basename as be,dirname as xe}from"path";var T=".previous",Be=".rotation.lock",Ae=2e3,M=class extends Error{constructor(n,r){super(`Timed out after ${r}ms waiting for rotating JSONL lock: ${n}`);this.lockPath=n;this.timeoutMs=r;this.name="RotatingJsonlLockTimeoutError"}lockPath;timeoutMs;code="ROTATING_JSONL_LOCK_TIMEOUT"},C=class extends Error{constructor(n){super(`Rotating JSONL lock ownership changed before release: ${n}`);this.lockPath=n;this.name="RotatingJsonlLockReleaseError"}lockPath;code="ROTATING_JSONL_LOCK_RELEASE_FAILED"},q=Object.freeze({monotonicNow:X,wait(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)},tryAcquireLock(e,t){let n=K(e,{kind:"rotating-jsonl",detail:{target:be(t)}});return n.kind==="acquired"?{kind:"acquired",lock:n.lock}:{kind:"contended"}},makeDirectory(e){fe(e,{recursive:!0})},exists:ge,readBytes(e){return F(e,{maxBytes:S,inputKind:"rotating JSONL segment"})},size(e){return ye(e).size},truncate:Re,remove(e){pe(e,{force:!0})},rename:me,append:ce});function Y(e,t,n){let r=n.runtime??q,a=JSON.stringify(t);if(a===void 0)throw new TypeError("Rotating JSONL records must be JSON-serializable values.");let s=Buffer.from(`${a}
|
|
2
|
+
`),i=Math.max(1,Math.floor(n.maxSegmentBytes),s.length);return Z(e,n.lockTimeoutMs,r,()=>{r.makeDirectory(xe(e));let c=he(e,S,r);n.onPhase?.("tail-repaired");let o=`${e}${n.previousSuffix??T}`,l=!1,g=!1;return r.exists(e)&&r.size(e)+s.length>i&&(r.exists(o)&&(r.remove(o),g=!0),n.onPhase?.("previous-pruned"),r.rename(e,o),l=!0,n.onPhase?.("current-rotated")),r.append(e,s),n.onPhase?.("record-appended"),{lineBytes:s.length,segmentLimitBytes:i,repairedTailBytes:c,rotated:l,prunedPrevious:g}})}function H(e,t={}){let n=t.runtime??q,r=ve(t.maxSegmentBytes);return Z(e,t.lockTimeoutMs,n,()=>{let a=[],s=0,i=`${e}${t.previousSuffix??T}`;for(let c of[i,e]){if(!n.exists(c))continue;let o=Le(Q(c,r,n));a.push(...o.lines),s+=o.partialTailBytes}return{lines:a,ignoredPartialTailBytes:s}})}function Z(e,t,n,r){let a=`${e}${Be}`,s=Math.max(0,t??Ae),i=n.monotonicNow()+s,c;for(;;){let u=n.tryAcquireLock(a,e);if(u.kind==="acquired"){c=u.lock;break}let y=i-n.monotonicNow();if(y<=0)throw new M(a,s);n.wait(Math.min(5,y))}let o=!1,l,g;try{g=r()}catch(u){o=!0,l=u}let m=!1;try{m=c.release()}catch(u){if(!o)throw u}if(o)throw l;if(!m)throw new C(a);return g}function he(e,t,n){if(!n.exists(e))return 0;let r=Q(e,t,n);if(r.length===0||r[r.length-1]===10)return 0;let a=r.lastIndexOf(10),s=a<0?0:a+1;return n.truncate(e,s),r.length-s}function ve(e){let t=e??S;if(!Number.isSafeInteger(t)||t<=0)throw new RangeError(`maxSegmentBytes must be a positive safe integer; received ${t}`);return t}function Q(e,t,n){let r=n.size(e);if(r>t)throw new N("rotating JSONL segment",e,"too-large",r,t);let a=n.readBytes(e),s=n.size(e);if(s!==r||a.byteLength!==r)throw new N("rotating JSONL segment",e,"changed-during-read",s,t);return a}function Le(e){let t=e.lastIndexOf(10),n=t<0?0:t+1;return{lines:e.subarray(0,n).toString("utf8").split(`
|
|
3
|
+
`).filter(a=>a.length>0),partialTailBytes:e.length-n}}var Te="reindex-activity.jsonl",O=T,Oe=1024*1024,ke=1440*60*1e3,te=e=>G(e,"reindex activity segment");function k(e){return ie(re(e),Te)}function ae(e){if(e.reused)return 0;let n=(e.shards?.some(r=>!r.reused&&r.strategy==="incremental")??!1?0:W(e.indexPath))+W(e.dbPath);for(let r of e.shards??[]){if(r.reused)continue;let a=r.producedOutputBytes??r.outputBytes;a!==null&&(n+=a)}return n}function Pe(e){let t=ae(e),n=e.writeTelemetry;return n?Math.max(0,t-n.reflinkedBytes)+n.fallbackCopiedBytes+(n.incrementalWrittenBytes??0):t}function ot(e,t){let n=t.lastRefresh;if(!n)return{state:"failed",reason:"reindex result has no refresh metadata"};let r=ae(t);return D(k(e),{version:1,event:"run",recordedAt:n.completedAt,trigger:n.trigger,result:n.result,durationMs:n.durationMs,estimatedLogicalOutputBytes:r,estimatedWriteBytes:Pe(t),reflinkedBytes:t.writeTelemetry?.reflinkedBytes??0,fallbackCopiedBytes:t.writeTelemetry?.fallbackCopiedBytes??0,incrementalWrittenBytes:t.writeTelemetry?.incrementalWrittenBytes??0,byLanguage:We(t)})}function ut(e,t){return D(k(e),{version:1,event:"run",recordedAt:t.completedAt,trigger:t.trigger,result:"failed",durationMs:t.durationMs,estimatedLogicalOutputBytes:0})}function dt(e,t,n=new Date){return D(k(e),{version:1,event:"suppressed",recordedAt:n.toISOString(),trigger:t,reason:"completed-index-is-fresh"})}function Ee(e,t,n=Oe,r){Y(e,t,{maxSegmentBytes:n,previousSuffix:O,...r?{runtime:r}:{}})}function _e(e,t=new Date,n=ke,r=te){let a=t.getTime(),s=a-n,i={confidence:"complete",recordsRead:0,invalidRecords:0,skippedRecords:0,readErrors:0,ignoredPartialTailBytes:0,windowStartedAt:new Date(s).toISOString(),windowEndedAt:t.toISOString(),runs:0,rebuilt:0,fullRebuilds:0,reused:0,failed:0,suppressed:0,estimatedLogicalOutputBytes:0,estimatedWriteBytes:0,reflinkedBytes:0,fallbackCopiedBytes:0,languageAttribution:"complete",attributedRuns:0,unattributedRuns:0,invalidLanguageDetails:0,byLanguage:{},byTrigger:{},automatic:{runs:0,rebuilt:0,fullRebuilds:0,estimatedWriteBytes:0}},c=i.automatic,o=k(e),l=[];if(r===te){if(!ee(o)&&!ee(`${o}${O}`))return i;try{let g=H(o,{previousSuffix:O});l=g.lines,i.ignoredPartialTailBytes=g.ignoredPartialTailBytes}catch{i.readErrors+=1,i.confidence="unavailable"}}else{let g=0;for(let m of[`${o}${O}`,o])try{l.push(...je(r(m))),g+=1}catch{i.readErrors+=1}g===0?i.confidence="unavailable":i.readErrors>0&&(i.confidence="partial")}for(let g of l){i.recordsRead+=1;let m=we(g);if(!m){i.invalidRecords+=1,i.confidence!=="unavailable"&&(i.confidence="partial");continue}let{record:u}=m,y=Date.parse(u.recordedAt);if(y<s||y>a){i.skippedRecords+=1;continue}if(i.invalidLanguageDetails=(i.invalidLanguageDetails??0)+m.invalidLanguageDetails,i.byTrigger[u.trigger.kind]=(i.byTrigger[u.trigger.kind]??0)+1,u.event==="suppressed"){i.suppressed+=1;continue}i.runs+=1,i[u.result]+=1,i.estimatedLogicalOutputBytes+=u.estimatedLogicalOutputBytes;let b=Ne(u);i.estimatedWriteBytes=(i.estimatedWriteBytes??0)+b,i.reflinkedBytes=(i.reflinkedBytes??0)+(u.reflinkedBytes??0),i.fallbackCopiedBytes=(i.fallbackCopiedBytes??0)+(u.fallbackCopiedBytes??0),u.result!=="failed"&&(m.hasLanguageDetails?i.attributedRuns=(i.attributedRuns??0)+1:i.unattributedRuns=(i.unattributedRuns??0)+1);for(let[R,A]of se(u.byLanguage)){let x=(i.byLanguage??={})[R]??=Ge();x.runs+=1,x[A.result]+=1,x.producedOutputBytes+=A.producedOutputBytes,x.durationMs+=A.durationMs}let p=Me(u);p&&i.oldestRebuildAt===void 0&&(i.oldestRebuildAt=u.recordedAt),p&&(i.fullRebuilds=(i.fullRebuilds??0)+1),b>0&&i.oldestWriteAt===void 0&&(i.oldestWriteAt=u.recordedAt),Ie(u.trigger)&&(c.runs+=1,u.result==="rebuilt"&&(c.rebuilt+=1),p&&(c.fullRebuilds+=1,c.oldestRebuildAt??=u.recordedAt),c.estimatedWriteBytes+=b,b>0&&(c.oldestWriteAt??=u.recordedAt))}return i.ignoredPartialTailBytes>0&&i.confidence!=="unavailable"&&(i.confidence="partial"),i.languageAttribution=Ue(i),i}function D(e,t){try{return Ee(e,t),{state:"recorded"}}catch(n){return{state:"failed",reason:n instanceof Error?n.message:String(n)}}}function we(e){try{let t=JSON.parse(e);if(!t||typeof t!="object")return null;let n=t;if(n.version!==1||!z(n.recordedAt)||!n.trigger||!Ce(n.trigger.kind))return null;if(n.event==="suppressed")return n.reason==="completed-index-is-fresh"?{record:n,hasLanguageDetails:!1,invalidLanguageDetails:0}:null;if(n.event!=="run"||n.result!=="rebuilt"&&n.result!=="reused"&&n.result!=="failed"||!B(n.durationMs)||!B(n.estimatedLogicalOutputBytes)||n.estimatedWriteBytes!==void 0&&!B(n.estimatedWriteBytes)||n.reflinkedBytes!==void 0&&!B(n.reflinkedBytes)||n.fallbackCopiedBytes!==void 0&&!B(n.fallbackCopiedBytes)||n.incrementalWrittenBytes!==void 0&&!B(n.incrementalWrittenBytes))return null;let r=n,{byLanguage:a,...s}=r,i=De(a);return{record:{...s,...i.byLanguage?{byLanguage:i.byLanguage}:{}},hasLanguageDetails:i.hasLanguageDetails,invalidLanguageDetails:i.invalidLanguageDetails}}catch{return null}}function Ne(e){return e.reflinkedBytes===void 0?e.estimatedWriteBytes??e.estimatedLogicalOutputBytes:Math.max(0,e.estimatedLogicalOutputBytes-e.reflinkedBytes)+(e.fallbackCopiedBytes??0)+(e.incrementalWrittenBytes??0)}function lt(e,t,n=new Date){return t.enabled?Je(_e(e,n,t.windowMs),t,n.getTime()):{state:"allowed",rebuilt:0,estimatedWriteBytes:0}}function Ie(e){return e.kind.startsWith("watch-")}function Je(e,t,n){let r=e.automatic??{fullRebuilds:e.fullRebuilds??e.rebuilt,estimatedWriteBytes:e.estimatedWriteBytes??e.estimatedLogicalOutputBytes,oldestRebuildAt:e.oldestRebuildAt,oldestWriteAt:e.oldestWriteAt},a=r.estimatedWriteBytes,s=r.fullRebuilds,i={rebuilt:s,estimatedWriteBytes:a};return t.enabled?e.confidence!==void 0&&e.confidence!=="complete"?{state:"paused",reason:"activity-evidence",until:n+t.windowMs,...i,detail:`reindex activity evidence is ${e.confidence}`}:s>=t.maxRebuilds?{state:"paused",reason:"rebuild-count",until:ne(r.oldestRebuildAt,t.windowMs,n),...i,detail:`${s}/${t.maxRebuilds} expensive full rebuild slots consumed by automatic refreshes`}:a>=t.maxEstimatedWriteBytes?{state:"paused",reason:"estimated-write-bytes",until:ne(r.oldestWriteAt,t.windowMs,n),...i,detail:`${a}/${t.maxEstimatedWriteBytes} estimated write bytes consumed by automatic refreshes`}:{state:"allowed",...i}:{state:"allowed",...i}}function Me(e){if(e.result!=="rebuilt")return!1;let t=se(e.byLanguage);return t.length===0?!0:t.some(([,n])=>n.result==="rebuilt"&&n.strategy!=="incremental"&&n.strategy!=="reused")}function ne(e,t,n){let r=e?Date.parse(e):Number.NaN;return Number.isFinite(r)&&r+t>n?r+t:n+t}function Ce(e){return e==="manual-cli"||e==="setup"||e==="watch-source"||e==="watch-startup"||e==="watch-demand"||e==="watch-git-head"||e==="watch-git-index"||e==="watch-git-state"||e==="unknown"}function W(e){try{return Se(e).size}catch{return 0}}function We(e){let t={};for(let n of e.languages){let r=(e.shards??[]).filter(l=>l.language===n),a=r.find(l=>l.id===n),s=e.reused||(a?a.reused:r.length>0&&r.every(l=>l.reused)),i=W(ie(re(e.dbPath),"language-indexes",`${n}.scip`)),c=i>0?i:a?.outputBytes??i,o=s?0:a?.durationMs??r.filter(l=>!l.reused).reduce((l,g)=>l+g.durationMs,0);t[n]={result:s?"reused":"rebuilt",strategy:s?"reused":a?.strategy??"full",...a?.strategy==="full"&&(a.fallbackReason??a.missReason)?{fallbackReason:a.fallbackReason??a.missReason}:{},outputBytes:c,producedOutputBytes:s?0:a?.producedOutputBytes??c,durationMs:o}}return t}function De(e){if(e===void 0)return{hasLanguageDetails:!1,invalidLanguageDetails:0};if(!e||typeof e!="object"||Array.isArray(e))return{hasLanguageDetails:!1,invalidLanguageDetails:1};let t={},n=0;for(let[a,s]of Object.entries(e)){if(!Fe(a)||!$e(s)){n+=1;continue}t[a]=s}let r=Object.keys(t).length>0;return{...r?{byLanguage:t}:{},hasLanguageDetails:r,invalidLanguageDetails:n}}function $e(e){if(!e||typeof e!="object")return!1;let t=e;return(t.result==="rebuilt"||t.result==="reused")&&(t.strategy===void 0||t.strategy==="reused"||t.strategy==="incremental"||t.strategy==="full")&&(t.fallbackReason===void 0||typeof t.fallbackReason=="string")&&I(t.outputBytes)&&I(t.producedOutputBytes)&&B(t.durationMs)&&(t.result!=="reused"||t.producedOutputBytes===0&&t.durationMs===0)&&t.producedOutputBytes<=t.outputBytes}function Fe(e){return J.includes(e)}function se(e){return e?J.flatMap(t=>{let n=e[t];return n?[[t,n]]:[]}):[]}function Ge(){return{runs:0,rebuilt:0,reused:0,producedOutputBytes:0,durationMs:0}}function Ue(e){let t=e.invalidLanguageDetails??0,n=e.attributedRuns??0;return(e.unattributedRuns??0)===0&&t===0?"complete":n===0?"unavailable":"partial"}function je(e){return e.endsWith(`
|
|
4
|
+
`)||(e=e.slice(0,Math.max(0,e.lastIndexOf(`
|
|
5
|
+
`)+1))),e.split(`
|
|
6
|
+
`).filter(t=>t.length>0)}function gt(e){let t=JSON.stringify(e);return Buffer.byteLength(t)<=65536?t:void 0}function ft(e){if(!(!e||Buffer.byteLength(e)>65536))try{return ze(JSON.parse(e))}catch{return}}function ze(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e;if(t.version!==1||t.baseGeneration!==null&&typeof t.baseGeneration!="string"||typeof t.complete!="boolean"||!Array.isArray(t.entries)||t.entries.length>1024||t.incompleteReason!==void 0&&typeof t.incompleteReason!="string")return;let n=[],r=new Set;for(let a of t.entries){if(!a||typeof a!="object"||Array.isArray(a))return;let s=a;if(typeof s.path!="string"||!Xe(s.path)||s.kind!=="add"&&s.kind!=="change"&&s.kind!=="delete"||r.has(s.path))return;r.add(s.path),n.push({path:s.path,kind:s.kind})}if(!(t.complete&&t.incompleteReason!==void 0)&&!(!t.complete&&(!t.incompleteReason||t.incompleteReason.trim()==="")))return{version:1,baseGeneration:t.baseGeneration,complete:t.complete,...t.incompleteReason===void 0?{}:{incompleteReason:t.incompleteReason},entries:n}}function Xe(e){return!e||e.includes("\0")||e.includes("\\")||e.startsWith("/")||/^[A-Za-z]:\//.test(e)?!1:e.split("/").every(t=>t!==""&&t!=="."&&t!=="..")}import{spawn as Ke}from"child_process";import{platform as oe}from"os";import{performance as ue}from"perf_hooks";var xt={probe:1e4,git:3e4,analysis:18e4,install:3e5,indexer:6e5},L=class extends Error{constructor(n,r,a,s={}){super(a,s.cause===void 0?void 0:{cause:s.cause});this.kind=n;this.label=r;this.name="BoundedProcessError",this.timedOut=s.timedOut??!1,this.reaped=s.reaped??!1,this.stdout=s.stdout??"",this.stderr=s.stderr??"",this.stdoutTruncated=s.stdoutTruncated??!1,this.stderrTruncated=s.stderrTruncated??!1}kind;label;timedOut;reaped;stdout;stderr;stdoutTruncated;stderrTruncated};function v(e,t){if(!Number.isFinite(e)||e<=0)throw new TypeError(`${t} must be a positive finite number.`)}function de(e,t,n,r){let a=Math.max(0,r-n);a>0&&e.push(t.subarray(0,a))}function le(e,t,n){let r=Buffer.concat([...e,t]);e.length=0,e.push(r.subarray(Math.max(0,r.length-n)))}function Bt(e){v(e.timeoutMs,"timeoutMs"),v(e.maxStdoutBytes,"maxStdoutBytes"),v(e.maxStderrBytes,"maxStderrBytes");let t=e.terminationGraceMs??1e3;v(t,"terminationGraceMs");let n=e.terminationForceMs??t;return v(n,"terminationForceMs"),new Promise((r,a)=>{let s=ue.now(),i=oe()!=="win32"&&process.env.SCIP_REINDEX_PROCESS_GROUP_LEADER==="1",c=oe()!=="win32"&&!i,o;try{o=Ke(e.command,[...e.args??[]],{cwd:e.cwd,env:e.env,detached:c?!0:e.detached,stdio:["pipe","pipe","pipe"]})}catch(d){let f=d instanceof Error?d.message:String(d);a(new L("spawn",e.label,`${e.label} could not start: ${f}`,{cause:d,reaped:!0}));return}let l=[],g=[],m=0,u=0,y=!1,b=!1,p=null,R=!1,A=o.pid===void 0?null:U(o.pid,c),x=()=>{clearTimeout($),e.signal?.removeEventListener("abort",E)},P=d=>{if(R||!p)return;R=!0,x();let f=Buffer.concat(l).toString("utf8"),_=Buffer.concat(g).toString("utf8"),w=d.reaped||!d.detail?"":` Process-tree cleanup failed: ${d.detail}`;a(new L(p.kind,e.label,`${p.message}${w}`,{timedOut:p.timedOut,reaped:d.reaped,stdout:f,stderr:_,stdoutTruncated:y,stderrTruncated:b}))},h=d=>{if(!(p||R)){if(p=d,!A){P({reaped:o.pid===void 0,reason:o.pid===void 0?"terminated":"identity-unavailable"});return}j(A,{gracefulMs:t,forceMs:n}).then(P,f=>{P({reaped:!1,reason:"signal-failed",detail:f instanceof Error?f.message:String(f)})})}},$=setTimeout(()=>{h({kind:"timeout",timedOut:!0,message:`${e.label} timed out after ${e.timeoutMs}ms.`})},e.timeoutMs);$.unref();let E=()=>{h({kind:"aborted",timedOut:!1,message:`${e.label} was cancelled.`})};e.signal?.addEventListener("abort",E,{once:!0}),e.signal?.aborted&&E(),o.stdout.on("data",d=>{let f=Buffer.isBuffer(d)?d:Buffer.from(d);e.outputLimitBehavior==="truncate-tail"?le(l,f,e.maxStdoutBytes):de(l,f,m,e.maxStdoutBytes),m+=f.length,m>e.maxStdoutBytes&&(y=!0,e.outputLimitBehavior!=="truncate-tail"&&h({kind:"stdout-limit",timedOut:!1,message:`${e.label} exceeded stdout limit (${e.maxStdoutBytes} bytes).`}))}),o.stderr.on("data",d=>{let f=Buffer.isBuffer(d)?d:Buffer.from(d);e.outputLimitBehavior==="truncate-tail"?le(g,f,e.maxStderrBytes):de(g,f,u,e.maxStderrBytes),u+=f.length,u>e.maxStderrBytes&&(b=!0,e.outputLimitBehavior!=="truncate-tail"&&h({kind:"stderr-limit",timedOut:!1,message:`${e.label} exceeded stderr limit (${e.maxStderrBytes} bytes).`}))}),o.on("error",d=>{if(!R&&!p){if(o.pid===void 0){x(),R=!0,a(new L("spawn",e.label,`${e.label} could not start: ${d.message}`,{cause:d,reaped:!0}));return}h({kind:"spawn",timedOut:!1,message:`${e.label} failed after start: ${d.message}`})}}),o.on("close",(d,f)=>{if(R||p)return;R=!0,x();let _=Buffer.concat(l).toString("utf8"),w=Buffer.concat(g).toString("utf8");r({status:d,signal:f,stdout:_,stderr:w,timedOut:!1,durationMs:ue.now()-s,stdoutTruncated:y,stderrTruncated:b})}),e.input===void 0?o.stdin.end():o.stdin.end(e.input)})}export{xt as a,L as b,Bt as c,V as d,T as e,Y as f,Te as g,ot as h,ut as i,dt as j,_e as k,lt as l,gt as m,ft as n};
|
|
7
|
+
//# sourceMappingURL=chunk-7RIRIADH.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as D,b}from"./chunk-V2RBODHL.js";import{a as E,b as F,c as R,d as w}from"./chunk-ZMCQIHI4.js";import{a as A,c as B,e as l,f as g}from"./chunk-B3X6KU75.js";import{a as T,b as k,c as x}from"./chunk-KMVGRIO2.js";import{Q as y}from"./chunk-ZLMXIQLC.js";function K(e,t={}){return O(e,t).results}function O(e,t={}){let{minSimilarity:i=.62,minTokens:o=8,limit:s=20,scope:d,scanLimit:u,filePattern:m,focusFiles:f}=t,p=E(e),c=new F,a=y(e).reactProfiles({scope:d,minJsxTokens:o,scanLimit:u}).filter(n=>n.kind==="component").filter(n=>p.roleOf(n.file)!=="test"?!0:(c.record("test-files",R.testFiles),!1)).map(n=>({file:n.file,component:n.name,tokens:n.jsxTokens,profile:n})),v=D(a,n=>n.tokens);return{results:b({profiles:a,limit:s,filePattern:m,focusFiles:f,candidateIndex:v,profile:{name:"react-component-duplicates"},compare:(n,r)=>{let h=p.pairContext(n.file,r.file),P=N(n,r,i,h);return P?h==="ui-kit-pair"?(c.record("ui-kit-pairs",R.uiKitPairs),null):P:null},sort:(n,r)=>S(n.actionTier)-S(r.actionTier)||r.similarity-n.similarity||n.fileA.localeCompare(r.fileA)||n.componentA.localeCompare(r.componentA)||n.fileB.localeCompare(r.fileB)||n.componentB.localeCompare(r.componentB)}),exclusions:c.list()}}function S(e){return e==="signal"?0:1}function N(e,t,i,o){let s=T(e.tokens,t.tokens);if(s.size<6||!j(s))return null;let d=x(e.tokens,t.tokens);if(d<i)return null;let u=l(s,"component:"),m=l(s,"native:"),f=l(s,"prop:"),p=l(s,"event:"),c=l(s,"binding:"),a=M({sharedComponents:u,sharedNativeTags:m,sharedProps:f,sharedEvents:p,sharedBindings:c}),v=w(o),C=_(e.component,t.component,u),n=C?{actionTier:"support",recommendation:W}:I(o,a.actionTier,a.recommendation),r=[v,C].filter(h=>h!==null);return{fileA:e.file,componentA:e.component,fileB:t.file,componentB:t.component,similarity:d,tokenCountA:e.tokens.size,tokenCountB:t.tokens.size,sharedTokens:g(s),sharedComponents:u,sharedNativeTags:m,sharedProps:f,sharedEvents:p,sharedBindings:c,evidenceClass:a.evidenceClass,actionTier:n.actionTier,evidenceClassReasons:[...r,...a.reasons],recommendation:n.recommendation,pairContext:o,uniqueToA:g(k(e.tokens,t.tokens)).slice(0,25),uniqueToB:g(k(t.tokens,e.tokens)).slice(0,25),locA:e.profile.loc,locB:t.profile.loc}}function I(e,t,i){switch(e){case"framework-route-pair":return{actionTier:"support",recommendation:"Framework route entries share routing scaffolding by design; consolidate only a repeated non-routing body, and keep each route file as the framework entry."};case"intercepting-route-pair":return{actionTier:t,recommendation:"Render one shared view component from both the intercepting route and its target route; the routes are meant to show the same content, not to duplicate its body."};case"ui-kit-pair":case"product":return{actionTier:t,recommendation:i}}}function _(e,t,i){return!L.test(e)||!L.test(t)||!i.every(o=>G.has(o))?null:"both components are loading placeholders sharing only skeleton primitives"}var L=/(?:Skeleton|Loading|Placeholder|Fallback)(?:[A-Z][A-Za-z0-9]*)?$|^Loading[A-Z]/,G=new Set(["Skeleton","Spinner","Loader","Loader2","Placeholder"]),W="Loading placeholders mirror the surface they stand in for; share a skeleton primitive only if the covered layouts are themselves shared.";function j(e){let t=0,i=0;for(let o of e)o.startsWith("component:")&&(t+=1),(o.startsWith("prop:")||o.startsWith("event:")||o.startsWith("native:")||o.startsWith("jsx:"))&&(i+=1);return B([{name:"component",count:t},{name:"shape",count:i}],[{min:{component:1},reason:"shared custom component"},{min:{shape:4},reason:"shared JSX structure"}]).pass}function M(e){return A({genericWords:z,primitiveGroups:[{values:e.sharedNativeTags,reasonPrefix:"shared native tags",bucket:"generic"},{values:e.sharedProps,reasonPrefix:"shared props",bucket:"generic"},{values:e.sharedEvents,reasonPrefix:"shared events",bucket:"generic"}],nameGroups:[{names:e.sharedComponents,label:"shared component",fallbackBucket:"generic"},{names:e.sharedBindings,label:"shared binding",fallbackBucket:"generic"}],recommendation:q})}function q(e){switch(e){case"domain-behavior":case"mixed":return"Review for a shared component or feature-specific UI primitive around the named domain structure.";case"shared-abstraction":return"Review the existing shared component usage first; extract only if duplicated structure remains outside it.";case"generic-workflow-scaffolding":return"Generic structural overlap \u2014 verify intent before consolidating."}}var z=new Set(["actions","app","button","card","children","content","container","dialog","field","form","header","input","item","label","layout","list","modal","page","panel","row","section","shell","table","text","toolbar","ui","value","view","wrapper"]);export{K as a,O as b};
|
|
2
|
+
//# sourceMappingURL=chunk-7ZLWLOGT.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{a as x}from"./chunk-
|
|
1
|
+
import{a as x}from"./chunk-WSA52GOR.js";import{E as b}from"./chunk-ZLMXIQLC.js";import{k as p}from"./chunk-ETC674NS.js";var y=new Set(["call","call_expression","command","command_call","function_call_expression","invocation_expression","macro_invocation","method_call","method_invocation","new_expression","object_creation_expression"]);function h(e,t,n,r){if(!Number.isSafeInteger(n)||n<0)return null;if(!Number.isSafeInteger(r)||r<0)throw new RangeError(`contextLines must be a non-negative safe integer; received ${r}`);let i=p(e,t);if(i.length===0||n>=i.length)return null;let o=Math.max(0,n-r),c=Math.min(i.length-1,n+r);return{relativePath:t,startLine:o,endLine:c,focusLine:n,source:i.slice(o,c+1).join(`
|
|
2
2
|
`)}}function F(e,t,n,r,i){let o=h(e,t,n,r);if(!o)return null;let c=b(e,t)?.rootNode??null;if(!c)return{...o,kind:"bounded-context"};let s=_(c,n,i);if(s.length!==1)return{...o,kind:s.length===0?"non-call-reference":"bounded-context"};let l=s[0],a=p(e,t),u=Math.max(0,l.startPosition.row),S=l.endPosition.column===0?l.endPosition.row-1:l.endPosition.row,d=Math.min(a.length-1,Math.max(u,S));return{relativePath:t,startLine:u,endLine:d,focusLine:n,source:a.slice(u,d+1).join(`
|
|
3
3
|
`),kind:"complete-call-expression"}}function L(e,t,n,r,i){if(!Number.isSafeInteger(i)||i<=0)throw new RangeError(`maxLines must be a positive safe integer; received ${i}`);let o=p(e,t);if(o.length===0||n<0||n>=o.length)return null;let c=Math.min(o.length-1,r,n+i-1);return{relativePath:t,startLine:n,endLine:c,focusLine:n,source:o.slice(n,c+1).join(`
|
|
4
4
|
`)}}function k(e,t,n,r,i=6){if(!Number.isSafeInteger(r)||r<=0)throw new RangeError(`maxLines must be a positive safe integer; received ${r}`);let o=p(e,t);if(o.length===0||n<0||n>=o.length)return null;let c=x(e,t,n);if(!c){let m=h(e,t,n,i);return m?{...m,unitType:null,unitStartLine:m.startLine,unitEndLine:m.endLine,omittedLines:0}:null}let s=c.startLine,l=c.endLine,a=l-s+1,u=Math.min(a,r),S=n-s-Math.floor(u/2),d=Math.max(0,Math.min(a-u,S)),f=s+d,g=f+u-1;return{relativePath:t,startLine:f,endLine:g,focusLine:n,source:o.slice(f,g+1).join(`
|
|
5
5
|
`),unitType:c.type,unitStartLine:s,unitEndLine:l,omittedLines:a-u}}function _(e,t,n){let r=[];return N(e,t,n,r),r.filter(i=>!r.some(o=>o!==i&&o.startIndex>=i.startIndex&&o.endIndex<=i.endIndex))}function N(e,t,n,r){if(M(e,t)){y.has(e.type)&&w(e)===n&&r.push(e);for(let i of e.namedChildren)N(i,t,n,r)}}function w(e){let t=e.childForFieldName("function")??e.childForFieldName("constructor")??e.childForFieldName("method")??e.childForFieldName("name")??e.namedChild(0);return t?t.text.match(/[\p{L}_$][\p{L}\p{N}_$!?-]*/gu)?.at(-1)??null:null}function M(e,t){return e.startPosition.row<=t&&e.endPosition.row>=t}export{h as a,F as b,L as c,k as d};
|
|
6
|
-
//# sourceMappingURL=chunk-
|
|
6
|
+
//# sourceMappingURL=chunk-A4WEAK35.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import{d as re,e as ie}from"./chunk-MTDBHTSF.js";import{c as ee,d as P,e as ne,f as te,o as oe}from"./chunk-FI7VGOR4.js";import{a as X}from"./chunk-L7KTFEAV.js";import{C as A,G as F,K as z,M as Q,T as N,U as _,Z,_ as q,p as k}from"./chunk-2VAHDDLM.js";import{d as w,f as V}from"./chunk-BL6DCHQP.js";import{c as Y,d as R}from"./chunk-IW5XQG5G.js";import{p as T}from"./chunk-7HXT6YLU.js";import{c as U,f as J}from"./chunk-7F45LJKI.js";import{existsSync as Me}from"fs";import{SymbolRole as Oe}from"@c4312/scip";import{deserializeSCIP as ge}from"@c4312/scip";function ce(n,e){return ge(J(n,{inputKind:e,maxBytes:U}))}import{fromBinary as ye}from"@bufbuild/protobuf";import{DocumentSchema as Se,SymbolRole as j}from"@c4312/scip";import{zstdDecompressSync as Ce}from"zlib";var he=Y("scip-chunk-occurrence-targets",{clearGroups:["whole-project","definition-catalog","source-file"],maxEntries:256}),Le=R("scip-chunk-occurrence-definitions",{clearGroups:["whole-project","definition-catalog"]}),le=1,Ee=R("scip-chunk-occurrence-data-present",{clearGroups:["whole-project"]});function B(n){return Ee.get(n,()=>{let e=n.get("SELECT length(occurrences) AS size FROM chunks LIMIT 1");return e!==void 0&&(e.size??0)>le})}function ae(n,e){return he.get(n,e,()=>Ie(n,e))}function K(n,e){return`${n}\0${e}`}function Ie(n,e){let t=n.get("SELECT id FROM documents WHERE relative_path = ?",e);if(!t)return{available:!1,reason:"no-document"};let r=n.all("SELECT occurrences FROM chunks WHERE document_id = ? ORDER BY chunk_index",t.id);if(r.length===0)return B(n)?{available:!0,targets:[],externalLeafKeys:new Set,locals:[]}:{available:!1,reason:"no-occurrence-data"};let i=Le.get(n,()=>new Map(_(n).map(u=>[u.symbol,u]))),c=[],a=new Set,s=[];try{for(let u of r){let d=u.occurrences;if(!d||d.length<=le)return{available:!1,reason:"no-occurrence-data"};let l=ye(Se,new Uint8Array(Ce(d)));for(let m of l.occurrences){if(!m.symbol)continue;let b=m.range[0];if(!Number.isInteger(b))continue;if(m.symbol.startsWith("local ")){s.push(Re(m.symbol,m.range,m.symbolRoles));continue}if((m.symbolRoles&j.Definition)!==0)continue;let o=i.get(m.symbol);if(o){c.push({sourceLine:b,definition:o});continue}let f=_e(m.symbol);f&&a.add(K(b,f))}}}catch{return{available:!1,reason:"no-occurrence-data"}}return{available:!0,targets:c,externalLeafKeys:a,locals:s}}function Re(n,e,t){let r=e.length===4;return{symbol:n,line:e[0],startChar:e[1]??0,endLine:r?e[2]:e[0],endChar:r?e[3]??0:e[2]??0,definition:(t&j.Definition)!==0,write:(t&j.WriteAccess)!==0}}function _e(n){if(n.startsWith("local "))return null;try{let e=w(n);return e.length>0?e:null}catch{return null}}var $=new WeakMap;function M(n,e){let t=ae(n,e);if(t.available)return{targets:t.targets,externalLeafKeys:t.externalLeafKeys,locals:t.locals};if(t.reason==="no-document")return null;if(B(n))return{targets:[],externalLeafKeys:new Set,locals:[]};let r=ve(n);return r?{targets:r.byFile.get(e)??[],externalLeafKeys:new Set,locals:[]}:null}function mn(n,e,t,r){let i=A(n,e),c=(i?.callSites??[]).filter(o=>o.line>=t&&o.line<=r);if(!i||c.length===0)return{available:!!i,targets:[],resolvedCallsites:0,unresolvedCallsites:0};let a=M(n,e);if(!a)return{available:!1,targets:[],resolvedCallsites:0,unresolvedCallsites:c.length};let s=a.targets.filter(o=>o.sourceLine>=t&&o.sourceLine<=r).map(o=>({...o,calleeLeaf:o.definition.leaf})),u=se(c.map(o=>({line:o.line,leaf:o.calleeLeaf}))),d=se(s.map(o=>({line:o.sourceLine,leaf:o.calleeLeaf}))),l=new Set([...u].flatMap(([o,f])=>d.get(o)===f?[o]:[])),m=s.filter(o=>l.has(ue(o.sourceLine,o.calleeLeaf))),b=[...l].reduce((o,f)=>o+(u.get(f)??0),0);return{available:!0,targets:m,resolvedCallsites:b,unresolvedCallsites:Math.max(0,c.length-b)}}function fn(n,e,t,r){let i=M(n,e);return i?{available:!0,targets:i.targets.filter(c=>c.sourceLine>=t&&c.sourceLine<=r)}:{available:!1,targets:[]}}function dn(n,e,t,r){let i=M(n,e);return i?{available:!0,targets:i.targets.filter(c=>c.sourceLine>=t&&c.sourceLine<=r&&xe(n,c.definition)).map(c=>({...c,calleeLeaf:c.definition.leaf}))}:{available:!1,targets:[]}}function ve(n){if($.has(n))return $.get(n)??null;let e=we(n);return $.set(n,e),e}function we(n){if(!n.generation.indexPath||!Me(n.generation.indexPath))return null;try{let e=_(n),t=new Map(e.map(c=>[c.symbol,c])),r=ce(n.generation.indexPath,"SCIP source-range call-target index"),i=new Map;for(let c of r.documents??[]){let a=c.relativePath;if(!a||n.isIgnored(a))continue;let s=[];for(let u of c.occurrences??[]){if(!u.symbol||(u.symbolRoles&Oe.Definition)!==0)continue;let d=t.get(u.symbol),l=u.range?.[0];!d||!Number.isInteger(l)||s.push({sourceLine:l,definition:d})}i.set(a,s)}return{byFile:i}}catch{return null}}function xe(n,e){if(!e.isFunctionLike)return!1;let t=A(n,e.relativePath);return!t||t.callables.some(r=>r.name===e.leaf&&r.startLine===e.startLine&&r.endLine===e.endLine)?!0:De(e)}function De(n){let e=n.documentation;if(!e)return!1;let t=n.leaf.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`\\bfunction\\s+${t}\\s*(?:<[^>]*>)?\\s*\\(`,"u").test(e)||new RegExp(`\\b(?:const|let|var)\\s+${t}\\s*:\\s*(?:<[^>]*>\\s*)?\\([^\\n]*\\)\\s*=>`,"u").test(e)}function se(n){let e=new Map;for(let t of n){let r=ue(t.line,t.leaf);e.set(r,(e.get(r)??0)+1)}return e}function ue(n,e){return`${n}\0${e}`}function vn(n,e,t={}){let r=fe(n,[e],{additive:t.additive,semantic:t.semantic,semanticEvidence:t.semanticEvidence}),i=t.callableOnly?(r.get(e.symbolId)??[]).filter(c=>V(c.symbol)||c.source==="ast-callsite"||c.source==="scip-occurrence"):r.get(e.symbolId)??[];return typeof t.limit=="number"?i.slice(0,t.limit):i}function wn(n,e,t){return Te(n,[e],t).get(e.symbolId)??[]}function Te(n,e,t){let r=Ne(n)?je(n,e,{semantic:t.semantic!==!1,semanticEvidence:t.semanticEvidence}):Pe(n,t.semanticEvidence);return typeof t.limit!="number"?new Map(e.map(i=>[i.symbolId,r.get(i.symbolId)??[]])):new Map(e.map(i=>[i.symbolId,(r.get(i.symbolId)??[]).slice(0,t.limit)]))}var ke=R("caller-rows",{clearGroups:["whole-project"]}),Ae=R("targeted-caller-strategy",{clearGroups:["whole-project"]}),Fe=2e4;function Ne(n){return Ae.get(n,()=>(n.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>Fe)}function Pe(n,e){return ke.get(n,()=>{let t=_(n),r=fe(n,t,{semanticEvidence:e}),i=new Map;for(let s of t)i.set(s.symbol,s.symbolId);let c=new Map,a=new Map;for(let s of t){let u=r.get(s.symbolId);if(!(!u||u.length===0))for(let d of u){let l=i.get(d.symbol);if(l===void 0||l===s.symbolId)continue;let m=c.get(l);m||(m=[],c.set(l,m),a.set(l,new Set));let b=`${s.symbol}|${s.relativePath}`;a.get(l).has(b)||(a.get(l).add(b),m.push({symbol:s.symbol,file:s.relativePath,source:"caller-map-inversion",callEvidence:d.source}))}}return c})}function je(n,e,t){let r=t.semantic&&t.semanticEvidence?e.flatMap(o=>{let f=Be(n,o);return f?[f]:[]}):[],i=new Map(r.map(o=>[o.symbolId,o])),c=t.semanticEvidence?.referenceMap(n,r)??new Map,a=oe(n,e),s=new Set(e.map(o=>o.symbol)),d=[...new Set(e.flatMap(o=>X(n,"reverse",[o.relativePath])))].flatMap(o=>N(n,o)),l=new Map,m=de(n,d);for(let o of d)for(let f of m.get(o.symbolId)??[]){if(!s.has(f.symbol))continue;let S=l.get(f.symbol)??[];S.push({symbol:o.symbol,file:o.relativePath,source:"caller-map-inversion",callEvidence:f.source}),l.set(f.symbol,S)}let b=new Map;for(let o of e){let f=[],S=new Set,C=p=>{if(p.symbol===o.symbol)return;let h=`${p.symbol}|${p.file}`;S.has(h)||(S.add(h),f.push(p))};for(let p of l.get(o.symbol)??[])C(p);for(let p of a.get(o.symbolId)??[])p.file!==o.relativePath&&C({symbol:p.enclosingSymbol??p.file,file:p.file,source:"resolved-reference"});let O=i.get(o.symbolId);if(O)for(let p of c.get(O.symbolId)??[]){if(p.file===o.relativePath||n.isIgnored(p.file))continue;let h=q(N(n,p.file),p.line);C({symbol:h?.symbol??p.file,file:p.file,source:"semantic-reference"})}b.set(o.symbolId,f)}return b}function Be(n,e){let t=re().join(", "),r=ie().join(", ");return n.get(`SELECT
|
|
2
|
+
d.id AS documentId,
|
|
3
|
+
gs.id AS symbolId,
|
|
4
|
+
gs.symbol,
|
|
5
|
+
d.relative_path AS relativePath,
|
|
6
|
+
COALESCE(der.start_line, c.start_line) AS startLine,
|
|
7
|
+
COALESCE(der.end_line, c.end_line) AS endLine,
|
|
8
|
+
COALESCE(gs.display_name, '') AS leaf,
|
|
9
|
+
NULL AS parentTypeName,
|
|
10
|
+
CASE WHEN gs.kind IN (${t}) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
|
|
11
|
+
CASE WHEN gs.kind IN (${r}) THEN 1 ELSE 0 END AS isTypeLike,
|
|
12
|
+
gs.kind AS kind,
|
|
13
|
+
gs.documentation AS documentation,
|
|
14
|
+
gs.enclosing_symbol AS enclosingSymbol
|
|
15
|
+
FROM global_symbols gs
|
|
16
|
+
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
17
|
+
LEFT JOIN chunks c ON c.document_id = der.document_id
|
|
18
|
+
JOIN documents d ON d.id = COALESCE(der.document_id, c.document_id)
|
|
19
|
+
WHERE gs.id = ?
|
|
20
|
+
LIMIT 1`,e.symbolId)??null}function fe(n,e,t={}){if(e.length===0)return new Map;let r=t.additive??!1,i=[],c=[];for(let l of e)k(l.relativePath)&&F(n,l.relativePath)!==null?i.push(l):c.push(l);let a=new Map,s=new Map,u=l=>{for(let[m,b]of l){let o=a.get(m);o||(o=[],a.set(m,o));let f=s.get(m);f||(f=new Set,s.set(m,f));for(let S of b){let C=`${S.symbol}|${S.chunkId}`;f.has(C)||(f.add(C),o.push(S))}}};i.length>0&&u(de(n,i)),t.semantic!==!1&&t.semanticEvidence&&u(Ye(t.semanticEvidence.calleeMap(n,e)));let d=r?e:c;return d.length>0&&u(Ue(n,d)),a}function de(n,e){let t=new Map,r=He(e,t),i=te(n);for(let[c,a]of r){let s=F(n,c);if(!s)continue;let u=Z(a),d=Ke(M(n,c));for(let l of s){let m=u.get(l.line);if(!m)continue;let b=d?$e(d,l):null,o=b??(d?.externalLeafKeys.has(K(l.line,l.calleeLeaf))?null:We(n,c,i,l));o&&o.symbol!==m.symbol&&t.get(m.symbolId).push({symbol:o.symbol,file:o.file,chunkId:l.line,source:b?"scip-occurrence":"ast-callsite",callsiteLine:l.line,...l.kind==="jsx-render"?{kind:"jsx-render"}:{}})}}return t}function Ke(n){if(!n)return null;let e=new Map;for(let t of n.targets){let r=e.get(t.sourceLine);r?r.push(t.definition):e.set(t.sourceLine,[t.definition])}return{targetsByLine:e,externalLeafKeys:n.externalLeafKeys}}function $e(n,e){let t=n.targetsByLine.get(e.line);if(!t)return null;let r=null;for(let i of t)if(i.leaf===e.calleeLeaf){if(r&&r.symbol!==i.symbol)return null;r=i}return r?{symbol:r.symbol,file:r.relativePath}:null}function He(n,e){let t=new Map;for(let r of n){let i=t.get(r.relativePath);i?i.push(r):t.set(r.relativePath,[r]),e.set(r.symbolId,[])}for(let r of t.values())r.sort((i,c)=>i.endLine-i.startLine-(c.endLine-c.startLine));return t}function We(n,e,t,r){let i=Q(n,e,r.calleeLeaf);if(i){let s=P(e,t.get(i.importedName)??[]).filter(u=>T(i.sourcePath,u.file));return s.length===1?s[0]:null}let c=P(e,t.get(r.calleeLeaf)??[]);if(c.length===0)return null;let a=Ge(n,e,c,r.calleeQualifier);return a||ne(n,e,c,r.memberAccess,r.calleeQualifier)}function Ge(n,e,t,r){if(!r||k(e)!=="clojure")return null;let c=z(n,e).filter(a=>a.kind==="namespace"&&a.localName===r&&a.sourcePath).map(a=>a.sourcePath);for(let a of c){let s=t.find(u=>T(a,u.file));if(s)return s}return t.find(a=>/`([^`]+)`\//.exec(a.symbol)?.[1]===r)??null}function Ue(n,e){if(e.length===0)return new Map;let r=H(e.map(o=>o.documentId)).flatMap(o=>n.all(`SELECT c.document_id, c.id AS chunk_id, c.start_line, c.end_line, m.symbol_id
|
|
21
|
+
FROM mentions m
|
|
22
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
23
|
+
WHERE m.role != 1
|
|
24
|
+
AND c.document_id IN (${o.map(()=>"?").join(",")})`,...o)),i=new Map;for(let o of r)i.has(o.document_id)||i.set(o.document_id,[]),i.get(o.document_id).push(o);let a=H(r.map(o=>o.symbol_id)).flatMap(o=>n.all(`SELECT gs.id AS symbol_id, gs.symbol,
|
|
25
|
+
COALESCE(der.document_id, def_chunk.document_id) AS document_id
|
|
26
|
+
FROM global_symbols gs
|
|
27
|
+
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
28
|
+
LEFT JOIN (
|
|
29
|
+
SELECT m.symbol_id, MIN(c.document_id) AS document_id
|
|
30
|
+
FROM mentions m
|
|
31
|
+
JOIN chunks c ON m.chunk_id = c.id
|
|
32
|
+
WHERE m.role = 1
|
|
33
|
+
AND m.symbol_id IN (${o.map(()=>"?").join(",")})
|
|
34
|
+
GROUP BY m.symbol_id
|
|
35
|
+
) def_chunk ON def_chunk.symbol_id = gs.id
|
|
36
|
+
WHERE gs.id IN (${o.map(()=>"?").join(",")})`,...o,...o)),s=H([...e.map(o=>o.documentId),...a.flatMap(o=>o.document_id===null?[]:[o.document_id])]),u=new Map(s.flatMap(o=>n.all(`SELECT id, relative_path FROM documents
|
|
37
|
+
WHERE id IN (${o.map(()=>"?").join(",")})`,...o).map(f=>[f.id,f.relative_path]))),d=new Map;for(let o of a)d.has(o.symbol_id)||d.set(o.symbol_id,{symbol:o.symbol,file:o.document_id!==null?u.get(o.document_id)??"":""});let l=new Map,m=u,b=Je(e);for(let[o,f]of b){let C=[...i.get(o)??[]].sort((g,L)=>g.start_line-L.start_line||g.end_line-L.end_line),O=[...f].sort((g,L)=>g.startLine-L.startLine||g.endLine-L.endLine),p=new Set,h=0;for(let g of O){for(;h<C.length&&C[h].start_line<=g.endLine;)p.add(C[h]),h+=1;for(let y of p)y.end_line<g.startLine&&p.delete(y);let L=new Set,W=[],x=null,pe=()=>{if(x)return x;let y=m.get(g.documentId)??"",E=new Set;if(y){let D=ee(n,y),v=Math.max(0,g.startLine),G=Math.min(D.length-1,g.endLine);for(let I=v;I<=G;I+=1)for(let be of D[I])E.add(be)}return x=E,E};for(let y of p){if(y.symbol_id===g.symbolId)continue;let E=d.get(y.symbol_id);if(!E)continue;if(!(y.start_line>=g.startLine&&y.end_line<=g.endLine)){if(!(y.start_line<=g.endLine&&y.end_line>=g.startLine))continue;let I=w(E.symbol);if(!I||!pe().has(I))continue}let v=`${E.symbol}|${y.chunk_id}`;L.has(v)||(L.add(v),W.push({...E,chunkId:y.chunk_id,source:"scip-chunk"}))}l.set(g.symbolId,W)}}return l}var me=500;function H(n){let e=[...new Set(n)],t=[];for(let r=0;r<e.length;r+=me)t.push(e.slice(r,r+me));return t}function Je(n){let e=new Map;for(let t of n){let r=e.get(t.documentId);r?r.push(t):e.set(t.documentId,[t])}return e}function Ye(n){let e=new Map;for(let[t,r]of n){let i=[];for(let c of r)i.push({symbol:c.symbol,file:c.file,chunkId:-1,source:"semantic-callee",...c.callsiteLine===void 0?{}:{callsiteLine:c.callsiteLine},...c.kind==="jsx-render"?{kind:"jsx-render"}:{}});e.set(t,i)}return e}export{mn as a,fn as b,dn as c,xe as d,vn as e,wn as f,Te as g,fe as h};
|
|
38
|
+
//# sourceMappingURL=chunk-AADQLOQ4.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{e as p}from"./chunk-JFMI5SGB.js";import{e as h}from"./chunk-AADQLOQ4.js";import{a as y}from"./chunk-WDSFQDPN.js";import{p as u}from"./chunk-FI7VGOR4.js";import{a as S,c as b}from"./chunk-2USA3S3P.js";import{_ as d}from"./chunk-2VAHDDLM.js";import{c as m}from"./chunk-BL6DCHQP.js";function x(e,o,r={}){let{direction:c="backward",maxDepth:s=3}=r,l=S(e,o);return l?c==="backward"?k(e,l,s,{semantic:r.semantic!==!1}):D(e,l,{semantic:r.semantic!==!1}):null}function j(e,o,r={}){return x(e,o,r)}function k(e,o,r,c){let s=[],l=new Set([o.symbol]),t=[o];for(let n=1;n<=r&&t.length!==0;n++){let i=[];for(let g of t){let w=h(e,g,{semantic:c.semantic,semanticEvidence:y});for(let a of w){if(l.has(a.symbol))continue;l.add(a.symbol),s.push({symbol:a.symbol,shortName:m(a.symbol),file:a.file,relationship:n===1?"referenced within definition (callee)":`depth ${n} callee`});let f=b(e,a.symbol);f&&!e.isIgnored(f.relativePath)&&i.push(f)}}t=i}return{symbol:o.symbol,shortName:m(o.symbol),direction:"backward",connectedSymbols:s}}function D(e,o,r){let c=new Set,s=[],l=new p(e);for(let t of u(e,o,{semantic:r.semantic,semanticEvidence:y})){if(s.length>=30)break;let n=t.enclosingSymbol??d(l.definitionsForFile(t.file),t.line)?.symbol??null;if(!n||n===o.symbol)continue;let i=b(e,n);!i||e.isIgnored(i.relativePath)||c.has(i.symbol)||(c.add(i.symbol),s.push({symbol:i.symbol,shortName:m(i.symbol),file:i.relativePath,relationship:`references target at ${t.file}:${t.line+1}`}))}return s.sort((t,n)=>t.file.localeCompare(n.file)),{symbol:o.symbol,shortName:m(o.symbol),direction:"forward",connectedSymbols:s}}export{x as a,j as b};
|
|
2
|
+
//# sourceMappingURL=chunk-AN76MGUE.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as de,c as Xe,d as et}from"./chunk-JCSAZ35V.js";import{a as it}from"./chunk-WRQXLNYE.js";import{a as ft,b as pt,c as dt,d as ye,i as V,j as Z,k as St,l as Q,n as gt}from"./chunk-5BIKR67W.js";import{j as ut}from"./chunk-CZW5MZ5B.js";import{h as mt}from"./chunk-ODPDP7A4.js";import{b as yt}from"./chunk-MOKUWRHO.js";import{b as Qe}from"./chunk-FVFDOIM3.js";import{C as G,I as Ve,K as Ze,T as rt,U as K,b as me,c as fe,d as q,n as pe,p as Ge,y as Ke}from"./chunk-2VAHDDLM.js";import{d as tt,g as nt,i as Se}from"./chunk-BL6DCHQP.js";import{c as lt,d as ge}from"./chunk-EHYDXE3Z.js";import{a as X,b as bt}from"./chunk-U6KCHXJ4.js";import{b as ue,d as Y,n as Je,p as Ye}from"./chunk-ATXPTSEI.js";import{a as $e,d as le}from"./chunk-IW5XQG5G.js";import{f as st,j as ot,k as at,l as ct}from"./chunk-T3CZAZSI.js";import{a as qe}from"./chunk-B3PYOSCX.js";import{a as ce,c as je,e as E}from"./chunk-HGFDYOVB.js";import{b as Ne,c as Be,d as J}from"./chunk-JFMEXGFE.js";import{$ as ze,N as We,aa as He}from"./chunk-7HXT6YLU.js";import{c as Ue,f as Le,g as Oe}from"./chunk-7F45LJKI.js";import{randomUUID as Yt}from"crypto";import{existsSync as Gt}from"fs";import{dirname as Kt}from"path";function Rt(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e;if(typeof t.available!="boolean"||t.dependencyAvailable!==void 0&&typeof t.dependencyAvailable!="boolean"||t.tsconfigPath!==void 0&&typeof t.tsconfigPath!="string"||t.tsconfigPaths!==void 0&&(!Array.isArray(t.tsconfigPaths)||!t.tsconfigPaths.every(n=>typeof n=="string"))||t.resolvedBinary!==void 0&&typeof t.resolvedBinary!="string"||t.note!==void 0&&typeof t.note!="string")return null;if(t.available===!0){if(t.reason!==void 0)return null}else if(typeof t.reason!="string"||t.reason.length===0)return null;return t}var Vt=12e4,Zt=5;function Ct(e,t,n={}){let r=n.requester??new Re(e,n),i=null,s=null,o=process.env.SCIP_QUERY_SKIP_WATCH_SERVICE==="1",a=null,c=()=>(i??=yt(e,t),i),l=(p,S,h)=>(o=!0,nn(e)?S():(a=p instanceof Error?p.message:String(p),console.error(`TypeScript semantic service request failed (${a}); semantic enrichment is disabled for the rest of this run because the index is too large for an in-process compiler.`),h())),m=(p,S,h,v=h)=>{if(a!==null)return v();if(o)return h();try{return S(r.request(p))}catch(M){return vt(M)?v():l(M,h,v)}},f=(p,S,h,v)=>{if(a!==null)return new Map;if(o)return v();let M=w=>{try{return h(r.request(S(w)))}catch(b){if(!Qt(b))throw b;let D=Xt(w);if(!D)throw b;return new Map([...M(D[0]),...M(D[1])])}};try{return M(p)}catch(w){return vt(w)?new Map:l(w,v,()=>new Map)}},d=(p,S)=>f(p,h=>({kind:"references",definitions:[...h],...S?.exact?{exact:!0}:{}}),h=>be(h),()=>c().referencesForDefinitions?.(p,S)??new Map(p.map(h=>[h.symbolId,c().referencesFor(h)]))),R=p=>f(p,S=>({kind:"callees",definitions:[...S]}),S=>be(S),()=>c().calleesForDefinitions?.(p)??new Map(p.map(S=>[S.symbolId,c().calleesFor(S)])));return{language:"typescript",availability:()=>(s??=m({kind:"availability"},an,()=>c().availability(),()=>({available:!1,reason:`TypeScript semantic service declined: ${a??"unknown"}`})),s),importUsage:p=>m({kind:"import-usage",file:p},S=>S,()=>c().importUsage(p),()=>[]),referencesFor:p=>d([p]).get(p.symbolId)??[],referencesForDefinitions:d,referenceFragmentsForFiles:p=>m({kind:"reference-fragments",files:[...p]},S=>on(S),()=>c().referenceFragmentsForFiles?.(p)??new Map,()=>new Map),calleesFor:p=>R([p]).get(p.symbolId)??[],calleesForDefinitions:R,calleeCoverageForDefinitions:p=>f(p,S=>({kind:"callee-coverage",definitions:[...S]}),S=>be(S),()=>c().calleeCoverageForDefinitions?.(p)??new Map),signatureFor:p=>m({kind:"signature",definition:p},cn,()=>c().signatureFor(p),()=>null),dispose:()=>i?.dispose?.()}}function Qt(e){let t=e instanceof Error?e.message:String(e);return/memory limit|heap out of memory|worker terminated|worker failed/iu.test(t)}function Xt(e){let t=[...new Set(e.map(r=>r.relativePath))].sort();if(t.length<2)return null;let n=new Set(t.slice(0,Math.ceil(t.length/2)));return[e.filter(r=>n.has(r.relativePath)),e.filter(r=>!n.has(r.relativePath))]}function vt(e){let t=e instanceof Error?e.message:String(e);return t.includes("invalid mailbox request")||t.includes("Unhandled TypeScript semantic request")||t.includes("compiler project is file-scoped")}var en=2500,tn=25e3,ht=new WeakMap;function nn(e){let t=ht.get(e);if(t!==void 0)return t;let n=rn(e);return ht.set(e,n),n}function rn(e){try{let t=e.get("SELECT (SELECT count(*) FROM documents) AS documents, (SELECT count(*) FROM global_symbols) AS symbols");return!t||t.documents<en&&t.symbols<tn}catch{return!0}}var Re=class{constructor(t,n={}){this.db=t;this.runtime=n.runtime??un,this.timeoutMs=n.timeoutMs??ln(),this.mailboxLimits=n.mailboxLimits??{},this.cacheDir=Kt(t.config.dbPath),this.projectRoot=We(t.config.projectRoot)}db;runtime;timeoutMs;cacheDir;projectRoot;mailboxLimits;request(t){let n=lt(this.cacheDir),r=bt(this.cacheDir),i=ge(n.statePath);if(!It(i,this.projectRoot,this.runtime))throw new Error("Compatible TypeScript semantic service is not running.");let s=this.db.generation.identity;if(!s)throw new Error("Published TypeScript generation identity is unavailable.");let o=this.runtime.now(),a=o+this.timeoutMs,c=(this.runtime.monotonicNow??J)()+this.timeoutMs,l=je(),m=ot("typescript-semantic-v3",{generation:s,profileEnvironment:l,request:t}),f=at(m),d=ct(r,{mailboxVersion:st,operationKey:m,clientId:this.runtime.randomId(),enqueuedAtMs:o,deadlineAtMs:a,protocolVersion:X,id:f,generation:s,profileEnvironment:l,request:t},{nowMs:o,limits:this.mailboxLimits});for(;(this.runtime.monotonicNow??J)()<=c;){if(Gt(d.responsePath))return sn(Oe(d.responsePath,{maxBytes:this.mailboxLimits.maxItemBytes??64*1024*1024,inputKind:"TypeScript semantic mailbox response"}),f,s,m);let R=ge(n.statePath);if(!It(R,this.projectRoot,this.runtime))throw new Error("TypeScript semantic service stopped while processing a request.");this.runtime.sleep(Zt)}throw new Error(`TypeScript semantic service timed out after ${this.timeoutMs}ms.`)}};function It(e,t,n){let r=e?.processIdentity?n.readProcessIdentity?.(e.pid):null;return e!==null&&e.projectRoot===t&&e.typescriptSemantic?.protocolVersion===X&&n.isProcessAlive(e.pid)&&(!e.processIdentity||r!=null&&Ne(e.processIdentity,r))}function sn(e,t,n,r){let i=JSON.parse(e);if(i.protocolVersion!==X||i.id!==t||i.operationKey!==r||i.ok===!0&&i.generation!==n)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 be(e){if(!Array.isArray(e))throw new Error("TypeScript semantic service wrote an invalid numeric map.");return new Map(e)}function on(e){if(!Array.isArray(e))throw new Error("TypeScript semantic service wrote an invalid string map.");return new Map(e)}function an(e){let t=Rt(e);if(!t)throw new Error("TypeScript semantic service wrote invalid availability.");return t}function cn(e){if(e!==null&&typeof e!="string")throw new Error("TypeScript semantic service wrote an invalid signature.");return e}function ln(){let e=Number(process.env.SCIP_TYPESCRIPT_SEMANTIC_TIMEOUT_MS);return Number.isInteger(e)&&e>0?e:Vt}var un={now:Date.now,monotonicNow:J,randomId:Yt,sleep(e){let t=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(t,0,0,e)},isProcessAlive:qe,readProcessIdentity:Be};function Dt(e){let t=new Map,n=fn(e),r=new Map;return i=>{let s=mn(i),o=r.get(s);if(o!==void 0)return o;if(!n.has(i.file))return r.set(s,i.symbol),i.symbol;let a=t.get(i.file);a||(a=pn(rt(e,i.file)),t.set(i.file,a));let c=dn(a,i);return r.set(s,c),c}}function mn(e){return`${e.file}\0${e.symbol}\0${e.line}`}function fn(e){return new Set(e.all("SELECT relative_path FROM documents").map(t=>t.relative_path))}function pn(e){let t=new Map,n=new Map;for(let r of e){let i=t.get(r.leaf);i?i.push(r):t.set(r.leaf,[r]);let s=n.get(r.startLine);s?s.push(r):n.set(r.startLine,[r])}return{definitions:e,byLeaf:t,byStartLine:n}}function dn(e,t){if(e.definitions.length===0)return t.symbol;let n=yn(t.symbol),r=Sn(e.byLeaf,n),i=gn(r,t.line);if(i)return i.symbol;let s=e.byStartLine.get(t.line)??[];return s.length===1?s[0].symbol:t.symbol}function Sn(e,t){let n=[],r=new Set;for(let i of t)for(let s of e.get(i)??[])r.has(s.symbolId)||(r.add(s.symbolId),n.push(s));return n}function gn(e,t){let n=null;for(let r of e)if(!(r.startLine>t||r.endLine<t)){if(r.startLine===t)return r;(!n||r.endLine-r.startLine<n.endLine-n.startLine)&&(n=r)}return n}function yn(e){let t=new Set([e]),r=e.split(/::|\.|#/).filter(Boolean).at(-1);return r&&t.add(r),t}function Mt(e,t){let r=Ze(e,t).map(i=>Rn(t,i));return{usage:r,positions:vn(e,t,r)}}function xt(e,t){return{importUsage(n){let r=e.importUsageFacts(n);if(!t||r.positions.length===0)return r.usage;let i=t.importDefinitionsForFile(n,r.positions);return i.available?bn(r.usage,i.sourcePaths):r.usage}}}function bn(e,t){return e.map((n,r)=>{let i=t.get(String(r));return i?{...n,sourcePath:i}:n})}function Rn(e,t){let n=t.isTypeOnly===!0,r=t.kind==="side-effect"||n||t.used;return{importer:e,sourcePath:t.sourcePath,importedName:t.importedName,localName:t.localName,kind:t.kind,isTypeOnly:n,isUsed:r,isTypeUsed:n,isValueUsed:t.kind==="side-effect"||!n&&t.used,references:[]}}function vn(e,t,n){let r=Ke(e,t);if(!r)return[];let i=hn(r.rootNode),s=new Map;for(let a of i){let c=s.get(he(a.importedName,a.localName));c?c.push(a.position):s.set(he(a.importedName,a.localName),[a.position])}let o=[];return n.forEach((a,c)=>{let l=s.get(he(a.importedName,a.localName??a.importedName))?.shift();l&&o.push({...l,id:String(c),file:t})}),o}function hn(e){let t=[];for(let n of e.descendantsOfType("use_declaration")){let r=n.namedChildren.find(i=>i.type!=="visibility_modifier");r&&t.push(...ee(r,""))}return t.filter(n=>n.importedName!=="*")}function ee(e,t){switch(e.type){case"identifier":case"super":case"self":case"crate":return[{importedName:e.text,localName:e.text,position:ve(e,e.text)}];case"scoped_identifier":{let n=e.text.split("::").pop()??e.text;return[{importedName:n,localName:n,position:ve(e,n)}]}case"scoped_use_list":{let n=e.namedChild(0),r=e.namedChild(1);if(!n||!r)return[];let i=Ve(t,n.text);return r.namedChildren.flatMap(s=>ee(s,i))}case"use_list":return e.namedChildren.flatMap(n=>ee(n,t));case"use_as_clause":{let n=e.namedChild(0),r=e.namedChild(1);return!n||!r?[]:ee(n,t).map(i=>({...i,localName:r.text}))}case"use_wildcard":{let n=e.namedChild(0),r="*";return[{importedName:r,localName:r,position:ve(n??e,r)}]}default:return[]}}function ve(e,t){let n=Math.max(0,e.text.lastIndexOf(t));return{id:"",file:"",line:e.startPosition.row,column:e.startPosition.column+n+In(t)}}function In(e){return Math.max(0,Math.min(e.length-1,1))}function he(e,t){return`${e}\0${t}`}import{spawnSync as Ie}from"child_process";import{existsSync as Ce}from"fs";import{fileURLToPath as Cn}from"url";var De=15e3,Me=8;function Et(e,t={}){let n=t.status??dt,r=xn(e,n),i=Pn(e,n),s=wn(e,n),o=t.referenceResolver||t.calleeResolver||t.signatureResolver||!Dn(t)?null:St(e,n,{fallbackReferenceResolver:r,fallbackCalleeResolver:i,fallbackSignatureResolver:s}),a=t.referenceResolver??o??r,c=t.calleeResolver??o??i,l=t.signatureResolver??o??s,m=t.importUsageResolver??xt(t.sourceImportUsageResolver??Mn(),t.importDefinitionResolver??o),f=t.calleeSymbolResolver,d=t.sourceZeroCalleeOracle,R=t.scipOccurrenceCalleeOracle,p=new Map,S=new Map,h=null,v=null,M=()=>(h??=n(e),h),w=()=>{let y=M();return y.dependencyAvailable?v??y:y},b=y=>{if(y.length===0)return new Map;let u=z(y);try{let g=a.referencesForDefinitions(u),I=M();return v=te(I,g),g.available?new Map(g.references):V(u,g.references)}catch(g){let I=M();return v=W(I,g),L(u)}},D=y=>{if(y.length===0)return new Map;let u=z(y),g=u.filter(Pt);if(g.length===0)return O(u);let I=new Map,k=Tt(g,R),A=[];for(let C of g)S.has(C.symbolId)?I.set(C.symbolId,S.get(C.symbolId)??[]):k.has(C.symbolId)?I.set(C.symbolId,k.get(C.symbolId)??[]):wt(C,d)?I.set(C.symbolId,[]):A.push(C);if(A.length===0)return N(u,I,void 0);try{let C=c.calleesForDefinitions(A),F=M();v=te(F,C);let T=N(A,C.callees,f);for(let[j,se]of T)I.set(j,se);return N(u,I,void 0)}catch(C){let F=M();return v=W(F,C),O(u)}},P=(y,u)=>{let g=z(y),I=z(u),k=I.filter(Pt),A=new Map,C=Tt(k,R),F=[];for(let T of k)C.has(T.symbolId)?A.set(T.symbolId,C.get(T.symbolId)??[]):wt(T,d)?A.set(T.symbolId,[]):F.push(T);if(g.length===0&&F.length===0)return{references:L(g),callees:N(I,A,void 0)};try{let T=o?o.referencesAndCalleesForDefinitions(g,F):Fn(a,c,{referenceDefinitions:g,calleeDefinitions:F}),j=M();v=te(j,T);let se=T.available?new Map(T.references):V(g,T.references);for(let[oe,ae]of T.callees)A.set(oe,ae);let ke=N(I,A,f);for(let[oe,ae]of ke)S.set(oe,ae);return{references:se,callees:ke}}catch(T){let j=M();return v=W(j,T),{references:L(g),callees:O(I)}}},x=y=>{if(y.length===0)return new Map;let u=z(y);try{let g=l.signaturesForDefinitions(u),I=M();return v=te(I,g),At(u,g.signatures)}catch(g){let I=M();return v=W(I,g),ne(u)}};return{language:"rust",availability:w,dispose:()=>{o?.dispose()},importUsage:y=>{let u=p.get(y);if(u)return u;try{let g=m.importUsage(y);return p.set(y,g),g}catch(g){let I=M();return v=W(I,g),[]}},referencesFor:y=>b([y]).get(y.symbolId)??[],referencesForDefinitions:b,referencesAndCalleesForDefinitions:P,calleesFor:y=>D([y]).get(y.symbolId)??[],calleesForDefinitions:D,signatureFor:y=>x([y]).get(y.symbolId)??null}}function te(e,t){let n={dependencyAvailable:e.dependencyAvailable,resolvedBinary:t.resolvedBinary??e.resolvedBinary,...e.note?{note:e.note}:{}};return t.available?{available:!0,...n}:{available:!1,reason:t.reason,...n}}function W(e,t){return{available:!1,dependencyAvailable:e.dependencyAvailable,resolvedBinary:e.resolvedBinary,...e.note?{note:e.note}:{},reason:t instanceof Error?t.message:String(t)}}function Dn(e){if(e.usePersistentSession!==void 0)return e.usePersistentSession;let t=process.env.SCIP_RUST_SEMANTIC_SESSION;return t!=="0"&&t!=="false"}function Mn(){return{importUsageFacts:()=>({usage:[],positions:[]})}}function z(e){return e.map(t=>{let n=t;return{...t,leaf:typeof n.leaf=="string"?n.leaf:tt(t.symbol),parentTypeName:n.parentTypeName??null,isFunctionLike:typeof n.isFunctionLike=="boolean"?n.isFunctionLike:nt(t.symbol),isTypeLike:n.isTypeLike??!1,kind:n.kind??null,documentation:n.documentation??null,enclosingSymbol:n.enclosingSymbol??null}})}function Pt(e){return e.isFunctionLike}function wt(e,t){if(!t)return!1;try{return t(e)}catch{return!1}}function Tt(e,t){if(!t||e.length===0)return new Map;try{return t(e)}catch{return new Map}}function xn(e,t){return{referencesForDefinitions:n=>Tn(e,t,n)}}function Pn(e,t){return{calleesForDefinitions:n=>En(e,t,n)}}function wn(e,t){return{signaturesForDefinitions:n=>An(e,t,n)}}function Tn(e,t,n){let r=t(e);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:we(r),references:L(n)};let i=xe();if(!Ce(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:L(n)};let s=B(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,De),o=re(process.env.SCIP_RUST_SEMANTIC_REFERENCE_RETRY_TIMEOUT_MS,0),a=B(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,Me),c=re(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(s,1e4)),l=Q(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:n.length,includeReferences:!0}),m={projectRoot:e,rustAnalyzerBinary:r.resolvedBinary,definitions:[...n],requestTimeoutMs:s,...o>0?{referenceRetryTimeoutMs:o}:{},diagnosticsTimeoutMs:c,settleDelayMs:l,concurrency:a},f=Ie(process.execPath,[i],{cwd:e,input:JSON.stringify(m),encoding:"utf8",maxBuffer:50*1024*1024,timeout:Z(n.length,gt(s,m.referenceRetryTimeoutMs),a)}),d=Te(f.stdout);if(d)return{...Pe(d),resolvedBinary:r.resolvedBinary,references:V(n,new Map(d.references),new Set(d.incompleteReferenceSymbolIds??[]))};let R=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:R,references:L(n)}}function En(e,t,n){let r=t(e);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:we(r),callees:O(n)};let i=xe();if(!Ce(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:O(n)};let s=B(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,De),o=B(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,Me),a=re(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(s,1e4)),c=Q(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:n.length,includeReferences:!1,includeCallees:!0}),l={projectRoot:e,rustAnalyzerBinary:r.resolvedBinary,definitions:[...n],requestTimeoutMs:s,diagnosticsTimeoutMs:a,settleDelayMs:c,concurrency:o,includeReferences:!1,includeCallees:!0},m=Ie(process.execPath,[i],{cwd:e,input:JSON.stringify(l),encoding:"utf8",maxBuffer:50*1024*1024,timeout:Z(n.length,s,o)}),f=Te(m.stdout);if(f)return{...Pe(f),resolvedBinary:r.resolvedBinary,callees:N(n,new Map(f.callees??[]),void 0)};let d=m.error instanceof Error?m.error.message:m.stderr.trim()||`Rust semantic worker exited with status ${m.status??"unknown"}.`;return{available:!1,resolvedBinary:r.resolvedBinary,reason:d,callees:O(n)}}function An(e,t,n){let r=t(e);if(!r.available||!r.resolvedBinary)return{available:!1,resolvedBinary:r.resolvedBinary,reason:we(r),signatures:ne(n)};let i=xe();if(!Ce(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:ne(n)};let s=B(process.env.SCIP_RUST_SEMANTIC_REQUEST_TIMEOUT_MS,De),o=B(process.env.SCIP_RUST_SEMANTIC_CONCURRENCY,Me),a=re(process.env.SCIP_RUST_SEMANTIC_DIAGNOSTICS_TIMEOUT_MS,Math.min(s,1e4)),c=Q(process.env.SCIP_RUST_SEMANTIC_SETTLE_MS,{definitionCount:n.length,includeReferences:!1,includeCallees:!1,includeSignatures:!0}),l={projectRoot:e,rustAnalyzerBinary:r.resolvedBinary,definitions:[...n],requestTimeoutMs:s,diagnosticsTimeoutMs:a,settleDelayMs:c,concurrency:o,includeReferences:!1,includeCallees:!1,includeSignatures:!0},m=Ie(process.execPath,[i],{cwd:e,input:JSON.stringify(l),encoding:"utf8",maxBuffer:50*1024*1024,timeout:Z(n.length,s,o)}),f=Te(m.stdout);if(f)return{...Pe(f),resolvedBinary:r.resolvedBinary,signatures:At(n,new Map(f.signatures??[]))};let d=m.error instanceof Error?m.error.message:m.stderr.trim()||`Rust semantic worker exited with status ${m.status??"unknown"}.`;return{available:!1,resolvedBinary:r.resolvedBinary,reason:d,signatures:ne(n)}}function Fn(e,t,n){let r=n.referenceDefinitions.length>0?e.referencesForDefinitions(n.referenceDefinitions):{available:!0,references:L(n.referenceDefinitions)},i=n.calleeDefinitions.length>0?t.calleesForDefinitions(n.calleeDefinitions):{available:!0,callees:O(n.calleeDefinitions)},s={resolvedBinary:r.resolvedBinary??i.resolvedBinary,references:r.references,callees:i.callees};return r.available&&i.available?{available:!0,...s}:{available:!1,reason:(r.available?void 0:r.reason)??(i.available?void 0:i.reason)??"Rust semantic resolution was unavailable.",...s}}function L(e){return new Map(e.map(t=>[t.symbolId,[]]))}function O(e){return new Map(e.map(t=>[t.symbolId,[]]))}function ne(e){return new Map(e.map(t=>[t.symbolId,null]))}function N(e,t,n){let r=0,i=0;return E("rust.semantic.callees.complete-map",()=>{let s=new Map;for(let o of e){let a=t.get(o.symbolId)??[];a.length>0&&(r+=1),i+=a.length,s.set(o.symbolId,a.map(c=>({...c,symbol:n?n(c):c.symbol})))}return s},()=>({definitions:e.length,rows:r,callees:i,resolveSymbols:!!n}))}function At(e,t){return new Map(e.map(n=>[n.symbolId,t.get(n.symbolId)??null]))}function xe(){return Cn(new URL("./rust-semantic-worker.js",import.meta.url))}function Pe(e){return e.available?{available:!0}:{available:!1,reason:e.reason}}function we(e){return e.available?"rust-analyzer binary path is unavailable.":e.reason}function Te(e){try{let t=JSON.parse(e);if(!t||typeof t!="object")return null;let n=t;if(typeof n.available!="boolean"||!Array.isArray(n.references)||n.available===!1&&typeof n.reason!="string"||n.available===!0&&n.reason!==void 0)return null;let r={references:n.references,incompleteReferenceSymbolIds:Array.isArray(n.incompleteReferenceSymbolIds)?n.incompleteReferenceSymbolIds.filter(i=>typeof i=="number"):void 0,callees:Array.isArray(n.callees)?n.callees:void 0,signatures:Array.isArray(n.signatures)?n.signatures:void 0};return n.available===!0?{available:!0,...r}:{available:!1,reason:String(n.reason),...r}}catch{return null}}function B(e,t){return ut(e)??t}function re(e,t){if(!e)return t;let n=Number(e);return Number.isInteger(n)&&n>=0?n:t}import{existsSync as _n}from"fs";import{deserializeSCIP as kn,SymbolRole as Un}from"@c4312/scip";var Ee=new WeakMap;function _t(e,t){let n=t.filter(Ln);if(n.length===0)return new Map;let r=!1,i=0,s=0;return E("rust.scip-occurrence.callees",()=>{let o=Bn(e);if(r=!!o,!o)return new Map;let a=new Map;for(let c of n){let l=On(e,o,c);l!==null&&(a.set(c.symbolId,l),i+=1,s+=l.length)}return a},()=>({definitions:t.length,candidates:n.length,indexAvailable:r,resolvedDefinitions:i,resolvedCallees:s}))}function Ln(e){return!(!e.symbol.startsWith("rust-analyzer ")||!e.relativePath.endsWith(".rs")||!e.isFunctionLike||e.leaf==="main"||Se(e.symbol))}function On(e,t,n){let r=G(e,n.relativePath);if(!r||r.language!=="rust")return null;let i=r.callables.find(l=>l.startLine!==n.startLine||l.endLine!==n.endLine?!1:l.name===n.leaf||n.leaf.endsWith(l.name)||l.name.endsWith(n.leaf));if(!i)return null;let s=r.callSites.filter(l=>l.line>=i.startLine&&l.line<=i.endLine);if(s.length===0)return null;let o=(t.occurrencesByFile.get(n.relativePath)??[]).filter(l=>l.line>=i.startLine&&l.line<=i.endLine&&l.callee.symbol!==n.symbol);if(o.some(l=>l.traitImplMember)||!Nn(s,o))return null;let a=[],c=new Set;for(let l of o){let m=`${l.callee.symbol}\0${l.callee.file}\0${l.callee.line}`;c.has(m)||(c.add(m),a.push(l.callee))}return a}function Nn(e,t){let n=Ft(e),r=Ft(t);if(n.size!==r.size)return!1;for(let[i,s]of n)if(r.get(i)!==s)return!1;return!0}function Ft(e){let t=new Map;for(let n of e){let r=n.calleeLeaf??n.leaf;if(!r)continue;let i=`${n.line}\0${r}`;t.set(i,(t.get(i)??0)+1)}return t}function Bn(e){if(Ee.has(e))return Ee.get(e)??null;let t=jn(e);return Ee.set(e,t),t}function jn(e){if(!e.generation.indexPath||!_n(e.generation.indexPath))return null;try{let t=K(e).filter(s=>s.symbol.startsWith("rust-analyzer ")&&s.relativePath.endsWith(".rs")&&s.isFunctionLike),n=new Map(t.map(s=>[s.symbol,s])),r=kn(Le(e.generation.indexPath,{inputKind:"SCIP occurrence-callee index",maxBytes:Ue})),i=new Map;for(let s of r.documents??[]){let o=s.relativePath;if(!o||!o.endsWith(".rs")||e.isIgnored(o))continue;let a=[];for(let c of s.occurrences??[]){if(!c.symbol||(c.symbolRoles&Un.Definition)!==0)continue;let l=n.get(c.symbol);if(!l)continue;let m=c.range?.[0];Number.isInteger(m)&&a.push({line:m,leaf:l.leaf,traitImplMember:Se(l.symbol),callee:{symbol:l.symbol,file:l.relativePath,line:l.startLine,callsiteLine:m}})}i.set(o,a)}return{occurrencesByFile:i}}catch{return null}}var ie=class{sessions=new WeakMap;getOrCreate(t,n,r){let i=qn(t,n),s=this.sessions.get(t);s||(s=new Map,this.sessions.set(t,s));let o=s.get(i);if(o)return o.hits+=1,o.lastUsedAtMs=Date.now(),o.provider;let a=Date.now(),c=r();return s.set(i,{key:i,language:n,projectRoot:t.config.projectRoot,provider:c,createdAtMs:a,lastUsedAtMs:a,hits:1}),c}sessionsFor(t){return[...this.sessions.get(t)?.values()??[]]}clear(t){let n=this.sessions.get(t);if(n)for(let r of n.values())r.provider.dispose?.();this.sessions.delete(t)}};function qn(e,t){return`${e.config.projectRoot}:${t}-workspace`}var kt=new ie;$e({name:"semantic-provider",groups:["semantic-provider"],clearAll:e=>kt.clear(e)});function H(e,t){let n=_(t)??"typescript";return kt.getOrCreate(e,n,()=>n==="rust"?Et(e.config.projectRoot,{sourceImportUsageResolver:{importUsageFacts:r=>Mt(e,r)},calleeSymbolResolver:Dt(e),sourceZeroCalleeOracle:r=>Wn(e,r),scipOccurrenceCalleeOracle:r=>_t(e,r)}):Ct(e,t))}function _(e){return e?Ge(e)==="rust"?"rust":Qe(e)?"typescript":null:"typescript"}function Wn(e,t){let n=G(e,t.relativePath);if(!n||n.language!=="rust")return!1;let r=n.callables.find(i=>i.startLine===t.startLine&&i.endLine===t.endLine&&i.name===t.leaf)??n.callables.find(i=>i.startLine===t.startLine&&i.endLine===t.endLine);return r?!n.callSites.some(i=>i.line>=r.startLine&&i.line<=r.endLine):!1}import{resolve as Di}from"path";var zn=/^[A-Za-z_][A-Za-z0-9_]*$/,Ut=/\bDefault::default\b/g,Hn=/^\.\.\s*Default::default\b/;function Lt(e,t){let n=new Map,r=new Map;for(let i of t){let s=Ae(e,i,r);s!==null&&n.set(i.symbolId,s)}return n}function Ae(e,t,n=new Map){let r=Jn(t.symbol);if(!r)return null;let i=it(e,[t.symbolId]);if(i.length===0)return null;let s=new RegExp(`(^|[^A-Za-z0-9_])${pe(r)}::default\\b`,"g"),o=new RegExp(`(^|[^A-Za-z0-9_])${pe(r)}\\s*$`),a=$n(e,t.symbolId),c=[];for(let l of i){let m=Yn(e,l.relative_path,n);if(m===null)return null;let f=m.split(/\r?\n/),d=0,R=[],p=0;for(let S=l.chunk_start;S<=l.chunk_end&&S<f.length;S+=1){let v=f[S]??"",M=new Set;s.lastIndex=0;let w;for(;w=s.exec(v);)c.push({file:l.relative_path,line:S,column:w.index+w[1].length+r.length+2}),p+=1;for(let b=0;b<v.length;b+=1){let D=Hn.exec(v.slice(b));if(D){if(a&&R.includes(d)){let x=b+D[0].lastIndexOf("default");c.push({file:l.relative_path,line:S,column:x}),M.add(x),p+=1}b+=D[0].length-1;continue}let P=v[b];if(P==="{"){let x=o.test(v.slice(0,b));d+=1,x&&R.push(d);continue}if(P==="}")for(d=Math.max(0,d-1);R.length>0&&R[R.length-1]>d;)R.pop()}for(Ut.lastIndex=0;w=Ut.exec(v);){let b=w.index+9;if(!M.has(b))return null}}if(p===0)return null}return mt(c)}function $n(e,t){return e.get("SELECT 1 AS present FROM mentions WHERE symbol_id = ? AND role = 1 LIMIT 1",t)?.present===1}function Jn(e){let t=/impl#\[([^\]]+)\]\[Default\]default\(\)\./.exec(e)?.[1]??null;return!t||!zn.test(t)?null:t}function Yn(e,t,n){if(n.has(t))return n.get(t)??null;let r=e.get("SELECT text FROM documents WHERE relative_path = ?",t),i=typeof r?.text=="string"?r.text:Gn(e,t);return n.set(t,i),i}function Gn(e,t){try{return ze(e.config.projectRoot,t,{inputKind:"indexed Rust source file"})}catch(n){if(!He(n))throw n;return null}}function Ot(e){let t=new Map;for(let n of e){let r=t.get(n.relativePath)??[];r.push(n),t.set(n.relativePath,r)}return t}var Kn="typescript-import-usage-v1",Vn="typescript-signatures-v1",Fe=le("semantic-prefetched-callees",{clearGroups:["whole-project","source-file","semantic-provider"]}),Nt=fe({kind:"semantic-import-usage",invalidation:q("semantic-import-usage"),serialize:e=>JSON.stringify(e),deserialize:$t}),Bt=fe({kind:"semantic-signatures",invalidation:q("semantic-signatures"),serialize:e=>JSON.stringify(e),deserialize:fr}),jt=me({kind:"typescript-import-usage",invalidation:q("typescript-import-usage"),serialize:e=>JSON.stringify(e),deserialize:$t}),qt=me({kind:"typescript-signatures",invalidation:q("typescript-signatures"),serialize:e=>JSON.stringify(e),deserialize:pr});var Zn=le("typescript-reference-map",{clearGroups:["whole-project"]});function Qn(e){return Zn.get(e,()=>{let t=Y(e);if(!t)return null;let n=K(e).filter(i=>_(i.relativePath)==="typescript"),r=et(e,n,i=>H(e,i));return r?{projectFingerprint:t,references:r.references,files:r.files,cacheHits:r.cacheHits,cacheMisses:r.cacheMisses,computedFiles:r.computedFiles}:null})}function _e(e){let t=new Map,n=new Set;return{capability:(r,i)=>Jt(e,r,i),importUsage:r=>er(e,r),references:r=>tr(e,r),materializeReferences:(r,i)=>zt(e,r,t,n,i),callerMap:r=>nr(e,r,t,n),calleeMap:r=>ar(e,r),signature:r=>ur(e,r)}}function Xn(e,t){if(t.size===0)return;let n=Fe.get(e,()=>new Map);for(let[r,i]of t)n.set(r,[...i])}function ki(e,t){if(!Fe.has(e))return{hits:[],misses:[...t]};let n=Fe.get(e,()=>new Map),r=[],i=[];for(let s of t)n.has(s.symbolId)?r.push({definition:s,callees:n.get(s.symbolId)??[]}):i.push(s);return{hits:r,misses:i}}function Ui(e,t){return _e(e).importUsage(t)}function er(e,t){if(_(t)==="typescript"){let s="fallback",o=0,a=0,c=0,l=0;return E("typescript.import-usage.materialize",()=>{let m=de(e,t,Kn);if(m?.key){o=1;let d=jt.read(e,t,m.key);if(d)return s="hit",a=1,d;c=1;let R=U(e,t);if(!R)return s="unavailable",[];let p=R.importUsage(t);return jt.write(e,t,m.key,p),s="computed",p}l=1;let f=U(e,t);return f?(s="direct-fallback",f.importUsage(t)):(s="unavailable",[])},()=>({state:s,eligible:o,cacheHits:a,cacheMisses:c,fallbacks:l}))}let n=Ht(e,"semantic-import-usage",t);if(n){let s=Nt.read(e,t,n);if(s)return s}let r=U(e,t);if(!r)return[];let i=r.importUsage(t);return n&&Nt.write(e,t,n,i),i}function Li(e,t){return _e(e).references(t)}function tr(e,t){let n=Ae(e,t);if(n)return n;let r=pt(e,t);if(r)return r;let i=U(e,t.relativePath);return i?i.referencesFor(t):[]}function nr(e,t,n=new Map,r=new Set){let i=new Map,s=zt(e,t,n,r),o=0;return E("semantic.callers.from-references",()=>{for(let a of t)o+=sr(e,i,a,n.get(a.symbolId)??[])},()=>({definitions:t.length,materialized:s.definitions,inMemoryHits:s.inMemoryHits,incompleteInMemoryHits:s.incompleteInMemoryHits,resultRows:i.size,callerFiles:o})),i}function zt(e,t,n,r,i={}){let s=Y(e),o=[],a=[],c=[],l=0,m=0,f=0,d=0,R=0,p=0,S=0,h=0,v=0,M=0,w=0,b=0,D=[],P=new Map,x=t.filter(u=>_(u.relativePath)==="typescript"&&!n.has(u.symbolId)&&!r.has(u.symbolId)),y=x.length>0?Qn(e):null;if(y){v=x.length,M=y.cacheHits,w=y.cacheMisses,b=y.computedFiles;for(let u of x)n.set(u.symbolId,y.references.get(u.symbolId)??[])}if(E("semantic.references.cache-scan",()=>{for(let[u,g]of Ot(t)){let I=[];for(let C of g)n.has(C.symbolId)?m+=1:r.has(C.symbolId)?h+=1:I.push(C);if(I.length===0){S+=1;continue}let k=rr(e,s,u);if(!k){for(let C of I)_(C.relativePath)||(l+=1),c.push(C);continue}p+=1;let A=Je(e,u,k);for(let C of I){let F=A.get(C.symbol)??null;if(F!==null){let T=or(F);if(T){f+=1,n.set(C.symbolId,T);continue}d+=1}a.push({definition:C,cacheFingerprint:k})}}},()=>({definitions:t.length,skippedUnsupportedLanguage:l,cacheHits:f,parseFailures:d,misses:a.length,unkeyed:c.length,inMemoryHits:m,incompleteInMemoryHits:h,fullyInMemoryFiles:S,cacheReadFiles:p})),a.length>0||c.length>0){D=[...c,...a.map(u=>u.definition)],P=E("semantic.references.compute-misses",()=>{let u=ir(e,D,i);return R=u.size,u},()=>({definitions:D.length,misses:a.length,unkeyed:c.length,rows:R}));for(let u of D)P.has(u.symbolId)?(n.set(u.symbolId,P.get(u.symbolId)??[]),r.delete(u.symbolId)):r.add(u.symbolId);for(let{definition:u,cacheFingerprint:g}of a)P.has(u.symbolId)&&Jt(e,"semantic-references",u.relativePath).available&&o.push({relativePath:u.relativePath,symbol:u.symbol,projectFingerprint:g,payload:JSON.stringify(P.get(u.symbolId)??[])})}return o.length>0&&E("semantic.references.cache-write",()=>Ye(e,o),()=>({entries:o.length})),P.size>0&&Xe(e,D,P,u=>H(e,u)),{definitions:t.length,inMemoryHits:m,incompleteInMemoryHits:h,cacheHits:f,misses:a.length,unkeyed:c.length,skippedUnsupportedLanguage:l,parseFailures:d,computed:R,incomplete:r.size,cacheWrites:o.length,fragmentDefinitions:v,fragmentCacheHits:M,fragmentCacheMisses:w,fragmentComputedFiles:b}}function rr(e,t,n){if(!t)return null;let r=_(n);return r==="typescript"?t:r==="rust"?ue(JSON.stringify({kind:"semantic-references",language:r,engine:ye(e.config.projectRoot),projectFingerprint:t})):null}function ir(e,t,n={}){let r=ce(),i=new Map,s=0,o=0,a=0,c=0,l=0,m=0,f=0,d=0,R=0;return E("semantic.references.provider-loop",()=>{let p=Lt(e,t),S=ft(e,t),h=new Map,v=n.prefetchCallees?new Map:null,M=[];for(let b of t){let D,P=()=>(D??=U(e,b.relativePath),D);if(v){let g=P();if(g?.referencesAndCalleesForDefinitions){let I=v.get(g);I?I.push(b):v.set(g,[b]),R+=1}}let x=p.get(b.symbolId);if(x){a+=1,c+=x.length,$(i,b.symbolId,x,r,g=>{f+=1,d+=g});continue}let y=S.get(b.symbolId);if(y){l+=1,m+=y.length,$(i,b.symbolId,y,r,g=>{f+=1,d+=g});continue}let u=P();if(!u){r&&(o+=1);continue}if(r&&(s+=1),u.referencesForDefinitions){let g=h.get(u);g?g.push(b):h.set(u,[b])}else M.push({provider:u,definition:b})}let w=new Set;if(v)for(let[b,D]of v){if(!b.referencesAndCalleesForDefinitions)continue;let P=h.get(b)??[],x=b.referencesAndCalleesForDefinitions(P,D);w.add(b),Xn(e,x.callees);for(let y of P){if(!x.references.has(y.symbolId))continue;let u=x.references.get(y.symbolId)??[];$(i,y.symbolId,u,r,g=>{f+=1,d+=g})}}for(let[b,D]of h){if(w.has(b))continue;let P=b.referencesForDefinitions(D);for(let x of D){if(!P.has(x.symbolId))continue;let y=P.get(x.symbolId)??[];$(i,x.symbolId,y,r,u=>{f+=1,d+=u})}}for(let{provider:b,definition:D}of M){let P=b.referencesFor(D);$(i,D.symbolId,P,r,x=>{f+=1,d+=x})}return i},()=>({definitions:t.length,providerHits:s,providerMisses:o,rustDefaultFastPathRows:a,rustDefaultFastPathReferences:c,rustScipOccurrenceFastPathRows:l,rustScipOccurrenceFastPathReferences:m,prefetchCalleeDefinitions:R,definitionsWithReferences:f,referenceCount:d,rows:i.size}))}function $(e,t,n,r,i){e.set(t,n),r&&n.length>0&&i(n.length)}function sr(e,t,n,r){let i=0;for(let s of r){if(s.file===n.relativePath||e.isIgnored(s.file))continue;let o=t.get(n.symbolId);o||(o=new Set,t.set(n.symbolId,o));let a=o.size;o.add(s.file),o.size!==a&&(i+=1)}return i}function or(e){try{return JSON.parse(e)}catch{return null}}function Oi(e,t){return _e(e).calleeMap(t)}function ar(e,t){let n=ce(),r=new Map,i=0,s=0,o=0,a=0;return E("semantic.callees.provider-loop",()=>{let c=new Map,l=[];for(let m of t){let f=U(e,m.relativePath);if(!f){n&&(s+=1);continue}n&&(i+=1);let d=m;if(f.calleesForDefinitions){let R=c.get(f);R?R.push(d):c.set(f,[d])}else l.push({provider:f,definition:d})}for(let[m,f]of c)for(let d of lr(f)){let R=m.calleesForDefinitions(d);for(let p of d){let S=R.get(p.symbolId)??[];Wt(r,p.symbolId,S,n,h=>{o+=1,a+=h})}}for(let{provider:m,definition:f}of l){let d=m.calleesFor(f);Wt(r,f.symbolId,d,n,R=>{o+=1,a+=R})}return r},()=>({definitions:t.length,providerHits:i,providerMisses:s,definitionsWithCallees:o,calleeCount:a,rows:r.size}))}var cr=256;function lr(e){let t=new Map;for(let i of e){let s=t.get(i.relativePath);s?s.push(i):t.set(i.relativePath,[i])}let n=[],r=[];for(let i of t.values())r.length>0&&r.length+i.length>cr&&(n.push(r),r=[]),r.push(...i);return r.length>0&&n.push(r),n}function Wt(e,t,n,r,i){n.length>0&&(e.set(t,n),r&&i(n.length))}function ur(e,t){if(_(t.relativePath)==="typescript"){let o="fallback",a=0,c=0,l=0,m=0;return E("typescript.signature.materialize",()=>{let f=de(e,t.relativePath,Vn);if(f?.key){a=1;let R=qt.read(e,t.relativePath,f.key)??{};if(Object.prototype.hasOwnProperty.call(R,t.symbol))return o="hit",c=1,R[t.symbol]??null;l=1;let p=U(e,t.relativePath);if(!p)return o="unavailable",null;let S=p.signatureFor(t);return qt.write(e,t.relativePath,f.key,{...R,[t.symbol]:S}),o="computed",S}m=1;let d=U(e,t.relativePath);return d?(o="direct-fallback",d.signatureFor(t)):(o="unavailable",null)},()=>({state:o,eligible:a,cacheHits:c,cacheMisses:l,fallbacks:m}))}let n=Ht(e,"semantic-signatures",t.relativePath),r=mr(t);if(n){let o=Bt.read(e,r,n);if(o)return o.signature}let i=U(e,t.relativePath);if(!i)return null;let s=i.signatureFor(t);return n&&Bt.write(e,r,n,{signature:s}),s}function Ht(e,t,n){let r=Y(e);if(!r)return null;let i=_(n);return i!=="rust"?null:ue(JSON.stringify({kind:t,language:i,engine:ye(e.config.projectRoot),projectFingerprint:r}))}function mr(e){return`${e.relativePath}\0${e.symbol}`}function $t(e){try{let t=JSON.parse(e);return Array.isArray(t)?t:null}catch{return null}}function fr(e){try{let t=JSON.parse(e);if(!t||typeof t!="object")return null;let n=t.signature;return n!==null&&typeof n!="string"?null:{signature:n}}catch{return null}}function pr(e){try{let t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return null;for(let n of Object.values(t))if(n!==null&&typeof n!="string")return null;return t}catch{return null}}function Jt(e,t,n){let r=_(n);if(!r)return{slot:t,language:"typescript",available:!1,reason:"semantic evidence is only available for TypeScript or Rust files"};try{return{slot:t,language:r,...H(e,n).availability()}}catch(i){return{slot:t,language:r,available:!1,reason:i instanceof Error?i.message:String(i)}}}function U(e,t){if(!_(t))return null;let n=H(e,t);return n.availability().available?n:null}export{Ot as a,H as b,_ as c,_e as d,ki as e,Ui as f,Li as g,ir as h,Oi as i};
|
|
2
|
+
//# sourceMappingURL=chunk-ANLNLY66.js.map
|