scip-query 0.22.0 → 0.23.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 +257 -0
- package/README.md +11 -0
- package/dist/augment-vue-worker.js +1 -1
- package/dist/by-kind-XI2CSWEY.js +2 -0
- package/dist/call-graph-UONR6JR5.js +2 -0
- package/dist/{chunk-FGNCOQUX.js → chunk-2E7CX53V.js} +2 -2
- package/dist/chunk-2GRUZAQF.js +43 -0
- package/dist/{chunk-DPWKKNKI.js → chunk-2LDBDR6J.js} +2 -2
- package/dist/{chunk-JHH5SCZ3.js → chunk-2OOY75BW.js} +2 -2
- package/dist/{chunk-XGGBK66W.js → chunk-2R3V3PSD.js} +2 -2
- package/dist/chunk-2WC2OEDO.js +4 -0
- package/dist/{chunk-57N6LN2A.js → chunk-3AF4TUFK.js} +2 -2
- package/dist/{chunk-2RE5OCHZ.js → chunk-3D3QG236.js} +2 -2
- package/dist/{chunk-D2MVJSP4.js → chunk-3FHOF22C.js} +2 -2
- package/dist/{chunk-7XZGZBSQ.js → chunk-3JKSW6LJ.js} +2 -2
- package/dist/chunk-3L2ZBPEX.js +133 -0
- package/dist/{chunk-NVSZNESQ.js → chunk-3PJABJSU.js} +2 -2
- package/dist/{chunk-WOOAY3PA.js → chunk-3SVF22I5.js} +2 -2
- package/dist/{chunk-YAGYMBEX.js → chunk-3WR4E3A3.js} +2 -2
- package/dist/chunk-4FTZ4P5G.js +2 -0
- package/dist/{chunk-F24G5NBE.js → chunk-4ILJCCXV.js} +2 -2
- package/dist/chunk-4UX2F3JX.js +2 -0
- package/dist/chunk-4WNW27SX.js +2 -0
- package/dist/chunk-5ENOG4VP.js +61 -0
- package/dist/{chunk-RHHCLWQ6.js → chunk-64BFSI5I.js} +2 -2
- package/dist/chunk-66DVSJQG.js +455 -0
- package/dist/{chunk-ISWFRGJ6.js → chunk-6HFCYNYE.js} +2 -2
- package/dist/{chunk-Y2VM4CJC.js → chunk-6I6L7Z62.js} +2 -2
- package/dist/{chunk-CKRWA452.js → chunk-6PQNKL3G.js} +2 -2
- package/dist/{chunk-GPGRZJ3R.js → chunk-6V5CNXL6.js} +2 -2
- package/dist/chunk-6VVV4WRR.js +4 -0
- package/dist/{chunk-BDGTPN27.js → chunk-7BWFZPPZ.js} +2 -2
- package/dist/{chunk-25GWKRUZ.js → chunk-7CYG22FH.js} +2 -2
- package/dist/chunk-7F45LJKI.js +2 -0
- package/dist/{chunk-4TQU4TX2.js → chunk-7IWV2EG3.js} +2 -2
- package/dist/{chunk-UDY7MIAW.js → chunk-AFHTBORT.js} +2 -2
- package/dist/chunk-AVRYW5OZ.js +2 -0
- package/dist/chunk-B3PYOSCX.js +2 -0
- package/dist/{chunk-RNKPYYYE.js → chunk-B5D7QPBE.js} +2 -2
- package/dist/{chunk-FFJQZG6J.js → chunk-BBCIS4DX.js} +2 -2
- package/dist/chunk-BDUVI7TO.js +3 -0
- package/dist/{chunk-BVFYEEBH.js → chunk-BE7ZZTMC.js} +2 -2
- package/dist/{chunk-NEIQPFBI.js → chunk-BHVUJOCQ.js} +2 -2
- package/dist/chunk-BKVWUP7Y.js +2 -0
- package/dist/{chunk-IJMD6BRI.js → chunk-BQGB4HBD.js} +2 -2
- package/dist/{chunk-ERCYGVAM.js → chunk-BRV7PIFF.js} +2 -2
- package/dist/chunk-CEEZJXEF.js +2 -0
- package/dist/{chunk-BTVKZGWT.js → chunk-CIYLO6SI.js} +2 -2
- package/dist/chunk-CJZXN4NU.js +2 -0
- package/dist/{chunk-VXJJTQYE.js → chunk-CNO7TOKL.js} +2 -2
- package/dist/{chunk-ZZ3Z7D56.js → chunk-COF23M5F.js} +2 -2
- package/dist/{chunk-ZGW4HLPD.js → chunk-CWFP7GM5.js} +2 -2
- package/dist/chunk-D2DHWI3D.js +2 -0
- package/dist/{chunk-Q55NF3ZG.js → chunk-D4N5SQ2M.js} +2 -2
- package/dist/{chunk-LXQUF2RP.js → chunk-DBRSYFXR.js} +2 -2
- package/dist/{chunk-PXXYQK55.js → chunk-DHUIOLDT.js} +2 -2
- package/dist/{chunk-KZYID5KV.js → chunk-DIRJWYBM.js} +2 -2
- package/dist/{chunk-IKVNEGTW.js → chunk-DIUFNHRJ.js} +2 -2
- package/dist/{chunk-CLG6DWVS.js → chunk-DTZCKZEU.js} +2 -2
- package/dist/{chunk-Z2PZVKPR.js → chunk-DULC3QFP.js} +2 -2
- package/dist/{chunk-AYPDH2LU.js → chunk-DYGHBZ2N.js} +2 -2
- package/dist/{chunk-JJ62MTQH.js → chunk-E5R6AQ73.js} +2 -2
- package/dist/{chunk-BWVQP3LB.js → chunk-E73UNJTF.js} +2 -2
- package/dist/{chunk-GVOMSPGL.js → chunk-EG2CPZMJ.js} +2 -2
- package/dist/{chunk-56NQAEPJ.js → chunk-EKV5HX33.js} +2 -2
- package/dist/{chunk-GDRJB3SB.js → chunk-EQHFIL6T.js} +2 -2
- package/dist/{chunk-EWWY2ZFL.js → chunk-ESIQ66Z7.js} +2 -2
- package/dist/chunk-EVFUMY4R.js +3 -0
- package/dist/{chunk-ZYM4HOFA.js → chunk-F7DY272B.js} +2 -2
- package/dist/chunk-FBN2FGXG.js +2 -0
- package/dist/{chunk-AZS7YPCB.js → chunk-FDLOBR6P.js} +2 -2
- package/dist/chunk-FESCRNVV.js +5 -0
- package/dist/{chunk-URSGGIZX.js → chunk-FFRKR4EQ.js} +2 -2
- package/dist/chunk-FGA2U4OR.js +8 -0
- package/dist/{chunk-7YQOCABQ.js → chunk-FIQRSHVM.js} +2 -2
- package/dist/{chunk-KFVSJX25.js → chunk-FPYLNQPT.js} +2 -2
- package/dist/{chunk-FELGD32K.js → chunk-FRUSVINH.js} +2 -2
- package/dist/chunk-GAS2LJMP.js +3 -0
- package/dist/{chunk-OTSPRVNW.js → chunk-GSP44ENC.js} +2 -2
- package/dist/{chunk-K3XFWJI2.js → chunk-GUFSG5TX.js} +2 -2
- package/dist/chunk-GYIZ4NXB.js +2 -0
- package/dist/{chunk-2OXVP5U5.js → chunk-GZIUDL6G.js} +2 -2
- package/dist/chunk-HCXEQRFF.js +18 -0
- package/dist/{chunk-LO5JSW2C.js → chunk-HEHOQQKH.js} +2 -2
- package/dist/{chunk-U2N2KE7A.js → chunk-HKGFPJ4T.js} +2 -2
- package/dist/chunk-HLZTEXRA.js +2 -0
- package/dist/{chunk-EELPBR7E.js → chunk-HOENASQM.js} +2 -2
- package/dist/{chunk-VTCIYFEK.js → chunk-HVF5VBG6.js} +2 -2
- package/dist/{chunk-TH6IC56G.js → chunk-HYO3NP5Q.js} +2 -2
- package/dist/{chunk-OPSAW5DT.js → chunk-I55I7XXP.js} +2 -2
- package/dist/{chunk-DEAB5TGT.js → chunk-IDFEUFKS.js} +2 -2
- package/dist/{chunk-DJAO2OZJ.js → chunk-IHGQTTVW.js} +2 -2
- package/dist/{chunk-XU75YQN4.js → chunk-IICPE7B2.js} +2 -2
- package/dist/{chunk-GY7CCCEZ.js → chunk-IL676XCC.js} +2 -2
- package/dist/{chunk-4HE7MVWD.js → chunk-ILTDAWEF.js} +2 -2
- package/dist/chunk-IZDPJ2QI.js +2 -0
- package/dist/{chunk-5YRQIE2B.js → chunk-J66VOFW6.js} +2 -2
- package/dist/{chunk-SB25YMEQ.js → chunk-JFMEXGFE.js} +2 -2
- package/dist/{chunk-QLBSG7U5.js → chunk-JGKUET5J.js} +2 -2
- package/dist/{chunk-VZ7NXSHV.js → chunk-JS4PGXMV.js} +2 -2
- package/dist/{chunk-ZAZGGSM3.js → chunk-JTQVMR42.js} +2 -2
- package/dist/chunk-JWTGMPIT.js +80 -0
- package/dist/{chunk-5ZMBRQFC.js → chunk-JYR66JN5.js} +2 -2
- package/dist/chunk-KLFEXGQA.js +2 -0
- package/dist/chunk-KYSDI3GE.js +5 -0
- package/dist/{chunk-MSR2QRUE.js → chunk-L6PJPETJ.js} +2 -2
- package/dist/{chunk-VU6LIWHT.js → chunk-LDVT66YM.js} +2 -2
- package/dist/chunk-LEECKFCJ.js +2 -0
- package/dist/{chunk-H7CG6LOE.js → chunk-LMZ5PRUV.js} +2 -2
- package/dist/{chunk-ZPASRBLF.js → chunk-LQRQN2XA.js} +2 -2
- package/dist/{chunk-HISEUIL2.js → chunk-LXABEJX3.js} +2 -2
- package/dist/{chunk-WHADK6OS.js → chunk-M2O5NY6W.js} +2 -2
- package/dist/{chunk-Y334QQU5.js → chunk-MNV5FSBW.js} +2 -2
- package/dist/{chunk-RYOYJMGF.js → chunk-MPQ4OTBM.js} +2 -2
- package/dist/{chunk-6NC3YSPY.js → chunk-MV3CDXPI.js} +2 -2
- package/dist/{chunk-NRBNAECH.js → chunk-MWN53KRN.js} +2 -2
- package/dist/chunk-N2ZSIIGR.js +117 -0
- package/dist/chunk-N5B2NILC.js +5 -0
- package/dist/{chunk-Q6T2CAJL.js → chunk-NJITK2GP.js} +2 -2
- package/dist/{chunk-ENWQWA2R.js → chunk-NOGJXYFO.js} +2 -2
- package/dist/{chunk-V4NG5OMS.js → chunk-NOYBFVJA.js} +106 -106
- package/dist/chunk-NWQXSFFU.js +3 -0
- package/dist/chunk-ODDUPDP7.js +13 -0
- package/dist/{chunk-A77SCPW2.js → chunk-OLIWTZI3.js} +2 -2
- package/dist/{chunk-XFMVKFSF.js → chunk-OLNV6I6U.js} +2 -2
- package/dist/{chunk-QKT4UI2Y.js → chunk-OR2E3AGZ.js} +2 -2
- package/dist/chunk-OSR2GEHQ.js +2 -0
- package/dist/{chunk-5H5WTJSD.js → chunk-OSSESPDX.js} +2 -2
- package/dist/{chunk-KQHJEU6V.js → chunk-OWOOWNJ5.js} +2 -2
- package/dist/{chunk-GRX7JOXQ.js → chunk-P42EIXTA.js} +2 -2
- package/dist/{chunk-AQ2PORIO.js → chunk-PJFGPYTU.js} +2 -2
- package/dist/{chunk-LRI5OMPE.js → chunk-PP7KNN7L.js} +2 -2
- package/dist/{chunk-PLJUQFQN.js → chunk-PU7T5QYQ.js} +2 -2
- package/dist/{chunk-JUN5DOAK.js → chunk-PWWAJSKV.js} +2 -2
- package/dist/{chunk-7IQXARSQ.js → chunk-PZL5T7SU.js} +2 -2
- package/dist/{chunk-UAQ4T73O.js → chunk-QBE3YX64.js} +2 -2
- package/dist/{chunk-3TJY6M3B.js → chunk-QGVTFRY2.js} +2 -2
- package/dist/chunk-QOJONDS7.js +2 -0
- package/dist/chunk-QU5XRYB5.js +4 -0
- package/dist/{chunk-2KVU55CW.js → chunk-QUU5OBVK.js} +2 -2
- package/dist/{chunk-Q5TA4OY4.js → chunk-RBLQNW26.js} +2 -2
- package/dist/chunk-RTQ7NEKG.js +81 -0
- package/dist/{chunk-F24QUEQP.js → chunk-SQXRS7BG.js} +2 -2
- package/dist/chunk-SSK6LDPC.js +2 -0
- package/dist/chunk-SZHGTCPP.js +7 -0
- package/dist/chunk-T4N4P2K5.js +16 -0
- package/dist/chunk-TA3QKLLU.js +2 -0
- package/dist/chunk-TEBQMNVI.js +43 -0
- package/dist/{chunk-NK3JMP22.js → chunk-TPFHAQ2G.js} +2 -2
- package/dist/chunk-TQPCBMWT.js +5 -0
- package/dist/{chunk-HG722PO7.js → chunk-TRNAEQ6P.js} +2 -2
- package/dist/chunk-TY7CRN3Z.js +2 -0
- package/dist/{chunk-7XA3OM44.js → chunk-UHFYCMZO.js} +2 -2
- package/dist/{chunk-ARVO6TTW.js → chunk-UICY4GTQ.js} +2 -2
- package/dist/{chunk-SWK4XPUS.js → chunk-UVGEWT4Y.js} +2 -2
- package/dist/{chunk-GIQ6CSL4.js → chunk-UXW33INU.js} +2 -2
- package/dist/{chunk-RDULNRSJ.js → chunk-VMPRET3I.js} +2 -2
- package/dist/{chunk-I6UTXNHU.js → chunk-VNLGKHS6.js} +2 -2
- package/dist/{chunk-44T4DUAA.js → chunk-VQILFTEH.js} +2 -2
- package/dist/{chunk-N7FP5H5U.js → chunk-VUPHCS7Y.js} +8 -8
- package/dist/{chunk-JAT6C3VX.js → chunk-VVZSBTSU.js} +2 -2
- package/dist/{chunk-FBCVASUG.js → chunk-VZRNID6A.js} +2 -2
- package/dist/{chunk-TUQIPUDS.js → chunk-W5OXRYGE.js} +2 -2
- package/dist/chunk-W6STWDQI.js +57 -0
- package/dist/chunk-W7CXK74K.js +2 -0
- package/dist/chunk-WB3WYIRE.js +4 -0
- package/dist/{chunk-C76O5MDS.js → chunk-WDNVY4E7.js} +2 -2
- package/dist/{chunk-TAYD3AE7.js → chunk-WIWY3CRX.js} +2 -2
- package/dist/chunk-WK46TNUM.js +3 -0
- package/dist/chunk-WNTFFKAX.js +12 -0
- package/dist/{chunk-JFQBRL3J.js → chunk-WOIKCX6A.js} +2 -2
- package/dist/{chunk-PIFTZEEM.js → chunk-WUN6KBHV.js} +2 -2
- package/dist/chunk-WYCTJDVR.js +2 -0
- package/dist/chunk-WYPL7GF7.js +2 -0
- package/dist/{chunk-XN22RGSR.js → chunk-XBGWL66K.js} +2 -2
- package/dist/{chunk-R6M456QG.js → chunk-XDQMU3BT.js} +2 -2
- package/dist/{chunk-XJX6LGHL.js → chunk-XFA4SSO3.js} +2 -2
- package/dist/{chunk-2YC7YNKT.js → chunk-XGZEP6GR.js} +2 -2
- package/dist/chunk-XPDPNWTQ.js +368 -0
- package/dist/chunk-XRYABF57.js +8 -0
- package/dist/{chunk-YIHNPKWD.js → chunk-YBGKCQIS.js} +2 -2
- package/dist/{chunk-2XCGSDIT.js → chunk-YEN6CYC7.js} +2 -2
- package/dist/{chunk-VMWUV6WB.js → chunk-YF5IB2LF.js} +2 -2
- package/dist/{chunk-TNG2FYS5.js → chunk-YI2AWIHC.js} +2 -2
- package/dist/{chunk-EELG7D3Q.js → chunk-YPWBKGFU.js} +2 -2
- package/dist/{chunk-GQIDEID3.js → chunk-YPWHBBIS.js} +2 -2
- package/dist/{chunk-TKDNDQA7.js → chunk-YSH6U3L4.js} +2 -2
- package/dist/{chunk-BUTEIZKP.js → chunk-YU5DZUZI.js} +2 -2
- package/dist/chunk-YWO5DDRC.js +16 -0
- package/dist/{chunk-6HRZQLOI.js → chunk-Z4CDXYNQ.js} +2 -2
- package/dist/{chunk-XSWYJCAK.js → chunk-ZF5KHH7C.js} +2 -2
- package/dist/chunk-ZOHS7AQV.js +21 -0
- package/dist/{chunk-7U2YQSDE.js → chunk-ZTI4SBFV.js} +2 -2
- package/dist/cli-main.js +2 -2
- package/dist/code-MI6F2TTU.js +2 -0
- package/dist/code-result-json-FXALY4HE.js +2 -0
- package/dist/{command-descriptors-ORNTVNYV.js → command-descriptors-P34VABY5.js} +136 -135
- package/dist/dataflow-4KEMJPC6.js +2 -0
- package/dist/dependence-slice-R7FPWD5M.js +2 -0
- package/dist/deps-7EMQUYUT.js +2 -0
- package/dist/direct-navigation-6YO234F2.js +3 -0
- package/dist/entry-map-KOOLR26E.js +2 -0
- package/dist/files-OPIPJIGZ.js +2 -0
- package/dist/hierarchy-QPD2CAER.js +2 -0
- package/dist/imports-M6HUXRXC.js +2 -0
- package/dist/index.js +1 -1
- package/dist/members-I5MEFOCT.js +2 -0
- package/dist/methods-5JYGGHXA.js +2 -0
- package/dist/output-continuation-command-UPQAAKBP.js +3 -0
- package/dist/postinstall.js +1 -1
- package/dist/project-reindex-UKKQ5PLS.js +3 -0
- package/dist/queries/affected.js +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.js +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.js +1 -1
- 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.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.js +1 -1
- package/dist/queries/entry-map.js +1 -1
- package/dist/queries/evidence.js +1 -1
- 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.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.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.js +1 -1
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.js +1 -1
- 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.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.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.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.js +1 -1
- package/dist/query-service-server.js +3 -3
- package/dist/refs-PSU4JZZW.js +2 -0
- package/dist/refs-pagination-JG6CJMRC.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-HYRATV64.js +2 -0
- package/dist/surface-VTGDYWF5.js +2 -0
- package/dist/symbol-resolution-WD5EU5JE.js +2 -0
- package/dist/system-LRQNFOR2.js +2 -0
- package/dist/trace-F4B6OLL4.js +2 -0
- package/dist/typescript-mailbox-worker.js +1 -1
- package/dist/value-flow-VRPZY72V.js +2 -0
- package/dist/watch-server.js +3 -3
- package/package.json +1 -1
- package/dist/by-kind-4IYG2SKW.js +0 -2
- package/dist/call-graph-WQNXMNNN.js +0 -2
- package/dist/chunk-2BTJALUS.js +0 -454
- package/dist/chunk-3QXC54FQ.js +0 -3
- package/dist/chunk-42W3LFUK.js +0 -13
- package/dist/chunk-4GAQ6FI4.js +0 -43
- 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-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-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-D35XIZGN.js +0 -2
- package/dist/chunk-DKM723YF.js +0 -79
- 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-HCVJR2V4.js +0 -3
- package/dist/chunk-HXOU4XNH.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-JT6XX7QY.js +0 -8
- package/dist/chunk-MHIEP7EG.js +0 -4
- 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-PLYUVM4F.js +0 -2
- package/dist/chunk-Q7GBK5T7.js +0 -81
- 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-TUSPIVZ3.js +0 -4
- package/dist/chunk-UT7TADJX.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-Z2AWCTN6.js +0 -2
- package/dist/chunk-ZOXKSQQB.js +0 -2
- package/dist/code-EQJFDT6I.js +0 -2
- package/dist/code-result-json-7UWIWBOO.js +0 -2
- 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/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
package/dist/chunk-AK3PYTIK.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{isAbsolute as Qe,relative as hn}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 me(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function Ii(e){return e.replace(/\\/g,"/")}function Ri(e,t){return me(e)===me(t)}function b(e,t){let n=hn(e,t);return n===""||!n.startsWith("..")&&!Qe(n)}function E(e){if(!e)throw new g(e,"empty-path");if(e.includes("\0"))throw new g(e,"nul-byte");if(Qe(e)||/^[A-Za-z]:/.test(e)||e.startsWith("//")||e.startsWith("\\\\"))throw new g(e,"absolute-path");let t=me(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 lt,randomUUID as Tn}from"crypto";import{chmodSync as ft,existsSync as L,linkSync as On,lstatSync as oe,readdirSync as xe,realpathSync as F,unlinkSync as _n,writeSync as Bn}from"fs";import{homedir as Dn}from"os";import{basename as Ln,dirname as se,isAbsolute as at,join as y,resolve as ce}from"path";import{closeSync as mn,existsSync as yn,fsyncSync as Sn,mkdirSync as bn,openSync as Pn}from"fs";import{dirname as Ze}from"path";function Q(e,t,n,r){let i=0;for(;i<t.length;){let o=n.writeFile(e,t,i,t.length-i);if(!Number.isSafeInteger(o)||o<=0||o>t.length-i)throw new Error(`${r} write did not make valid forward progress`);i+=o}}function ye(e,t){if(t!=="win32")return!1;let n=e.code;return n==="EACCES"||n==="EBADF"||n==="EINVAL"||n==="EISDIR"||n==="EPERM"}var W=Object.freeze({platform:process.platform,pathExists:e=>yn(e),makeDirectory:e=>bn(e,{recursive:!0}),openFile:(e,t,n)=>Pn(e,t,n),syncFile:e=>Sn(e),closeFile:e=>mn(e)});function et(e,t=W){let n=[],r=e;for(;!t.pathExists(r);){n.push(r);let o=Ze(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=ee(i,Z(Ze(o),t));return i}function Z(e,t=W){let n;try{n=t.openFile(e,"r")}catch(r){if(ye(r,t.platform))return"unsupported";throw r}try{t.syncFile(n)}catch(r){try{t.closeFile(n)}catch{}if(ye(r,t.platform))return"unsupported";throw r}return t.closeFile(n),"synced"}function ee(...e){return e.every(t=>t==="not-requested")?"not-requested":e.includes("unsupported")?"unsupported":"synced"}import{createRequire as jn}from"module";var xn=jn(import.meta.url),tt=Fn().version;function Fn(){for(let e of["../package.json","../../package.json"])try{return xn(e)}catch{}return{version:"0.0.0"}}import{closeSync as Se,fstatSync as te,openSync as be,readFileSync as Cn,readSync as nt}from"fs";import{createHash as wn}from"crypto";var rt=8*1024*1024,it=64*1024*1024,kn=512*1024*1024,En=256*1024*1024,I=class extends Error{constructor(n,r,i,o,s){let c=i==="too-large"?`is ${o} bytes; the safety limit is ${s} bytes`:i==="not-regular"?"is not a regular file":"changed while it was being read";super(`${n} ${JSON.stringify(r)} ${c}`);this.inputKind=n;this.inputPath=r;this.reason=i;this.observedBytes=o;this.limitBytes=s;this.name="BoundedFileReadError"}inputKind;inputPath;reason;observedBytes;limitBytes;code="SCIP_QUERY_BOUNDED_FILE_READ"};function ne(e,t){T(t.maxBytes);let n=String(e),r=be(e,"r");try{let i=te(r);ct(i,t,n);let o=Cn(r),s=te(r);if(s.dev!==i.dev||s.ino!==i.ino||s.size!==i.size||o.byteLength!==i.size)throw new I(t.inputKind,n,"changed-during-read",s.size,t.maxBytes);return o}finally{Se(r)}}function Pe(e,t,n="utf8"){return ne(e,t).toString(n)}function H(e,t){return Pe(e,{maxBytes:rt,inputKind:t})}function In(e,t){return Pe(e,{maxBytes:it,inputKind:t})}function ot(e,t){T(t.maxBytes);let n=[],r=Buffer.allocUnsafe(64*1024),i=0;for(;;){let o=nt(e,r,0,r.length,null);if(o===0)break;if(i+=o,!Number.isSafeInteger(i)||i>t.maxBytes)throw new I(t.inputKind,`file descriptor ${e}`,"too-large",i,t.maxBytes);n.push(Buffer.from(r.subarray(0,o)))}return Buffer.concat(n,i)}function st(e,t){let n=be(e,"r");try{return ot(n,t)}finally{Se(n)}}function Rn(e,t,n="utf8"){return st(e,t).toString(n)}function re(e,t,n){T(t.maxBytes);let r=String(e),i=be(e,"r");try{let o=te(i);ct(o,t,r);let s=Buffer.allocUnsafe(Math.min(1024*1024,Math.max(1,o.size))),c=0;for(;c<o.size;){let u=nt(i,s,0,Math.min(s.length,o.size-c),c);if(u===0)break;n(s.subarray(0,u)),c+=u}let a=te(i);if(a.dev!==o.dev||a.ino!==o.ino||a.size!==o.size||c!==o.size)throw new I(t.inputKind,r,"changed-during-read",a.size,t.maxBytes);return c}finally{Se(i)}}function vn(e,t){let n=wn("sha256");return re(e,t,r=>n.update(r)),n.digest("hex")}function ct(e,t,n){if(!e.isFile())throw new I(t.inputKind,n,"not-regular",Number(e.size),t.maxBytes);if(e.size>t.maxBytes)throw new I(t.inputKind,n,"too-large",Number(e.size),t.maxBytes)}function T(e){if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`maxBytes must be a non-negative safe integer; received ${e}`)}var pt=1,U=".scip-query-cache-owner.json",An=16*1024,dt=Object.freeze({...W,randomToken:()=>Tn(),linkFile:(e,t)=>On(e,t),removeFile:e=>_n(e),writeFile:(e,t,n,r)=>Bn(e,t,n,r)});function ie(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 C(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 Nn(e,t){let n=F(e);return Mn(n,Fe(n,t))}function Fe(e,t){let n=F(e),r=process.env.SCIP_QUERY_CACHE_DIR;return r?ce(r):t?.dbPath?Wn(n,t.dbPath):Gn(n)}function gt(){let e=process.env.XDG_CACHE_HOME;return y(e||y(Dn(),".cache"),"scip-query")}function Gn(e){let t=ce(e);try{t=F(t)}catch{}let n=lt("sha256").update(t).digest("hex").slice(0,12);return y(gt(),"projects",n)}function eo(e){if(!/^[a-f0-9]{24}$/.test(e))throw new Error(`invalid repository cache identity: ${e}`);let t=y(gt(),"repositories",e);return yt(t),F(t)}function to(e){return process.env.SCIP_QUERY_SHARED_CACHE!=="0"&&!process.env.SCIP_QUERY_CACHE_DIR&&!process.env.SCIP_QUERY_INDEX_DB&&!e?.dbPath}function no(e,t){let n=Nn(e,t);return{cacheDir:n,dbPath:y(n,"index.db"),indexPath:y(n,"index.scip"),metaPath:y(n,"meta.json")}}function Mn(e,t,n=dt){return zn(e,t,n).cacheDir}function zn(e,t,n=dt){let r=F(e),i=L(t)?"synced":yt(t,n),o=F(t),s=y(o,U);if(L(s))return je(r,o),Ce(s),$(o),{kind:"existing",cacheDir:o};ut(o),qn(o),ut(o);let a=`${JSON.stringify({schemaVersion:pt,canonicalProjectRoot:r,canonicalCacheDir:o,creatorVersion:tt},null,2)}
|
|
2
|
-
`;try{let u=Kn(s,a,n),f=ee(i,u);return{kind:"published",cacheDir:o,achievedDurability:f==="synced"?"directory-durable":"file-flushed",directorySync:f}}catch(u){if(Xn(u))return je(r,o),{kind:"existing",cacheDir:o};throw u}}function je(e,t){let n=F(e),r=F(t);return $n(r,n,r)}function ro(e,t){return L(y(t,U))?(je(e,t),ht(t),!0):!1}function Wn(e,t){let n;try{n=E(t)}catch(s){throw s instanceof g?ie(t,s.reason):s}let r=ce(e,...n.split("/"));if(r===e||!b(e,r))throw ie(t,"outside-project");let i=Hn(r),o=F(i);if(!b(e,o)&&o!==e)throw ie(t,"symlink-escape");return r}function Hn(e){let t=e;for(;!L(t);){let n=se(t);if(n===t)throw ie(e,"no-existing-ancestor");t=n}return t}function $n(e,t,n){let r=y(e,U);if(!L(r)||oe(r).isSymbolicLink())throw C(e,"missing regular ownership record");let i=oe(r);if(!i.isFile()||i.size>An)throw C(e,"invalid ownership record file");let o=H(r,"cache ownership record"),s=Un(o,e);if(t!==void 0&&s.canonicalProjectRoot!==t)throw C(e,"ownership record belongs to a different project");if(s.canonicalCacheDir!==n)throw C(e,"ownership record names a different cache directory");return{record:s,ownerSha256:lt("sha256").update(o).digest("hex"),physicalCacheDir:e}}function Un(e,t){try{let n=JSON.parse(e);if(n.schemaVersion!==pt||typeof n.canonicalProjectRoot!="string"||typeof n.canonicalCacheDir!="string"||typeof n.creatorVersion!="string"||!at(n.canonicalProjectRoot)||!at(n.canonicalCacheDir))throw new Error("invalid fields");return n}catch(n){throw C(t,`malformed ownership record: ${n instanceof Error?n.message:String(n)}`)}}function ut(e){let t=xe(e).filter(n=>n!==U&&!Jn(n));if(t.length>0)throw C(e,`unrecognized existing entries: ${t.slice(0,3).join(", ")}`)}function Jn(e){return e.startsWith(`${U}.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 qn(e){for(let t of xe(e)){let n=y(e,t);try{let r=oe(n);if(r.isSymbolicLink())throw C(e,`legacy cache entry ${t} is a symlink`);if(r.isDirectory())$(n);else if(r.isFile())Ce(n);else throw C(e,`legacy cache entry ${t} is not a file or directory`)}catch(r){if(mt(r))continue;throw r}}$(e)}function ht(e,t=!1){try{let n=oe(e);if(n.isSymbolicLink())throw C(e,"managed cache tree contains a symlink");if(n.isFile()){Ce(e);return}if(!n.isDirectory())throw C(e,"managed cache tree contains a special file");$(e);for(let r of xe(e))ht(y(e,r),!0)}catch(n){if(t&&mt(n))return;throw n}}function mt(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}function yt(e,t=W){let n=et(e,t);return $(e),n}function Kn(e,t,n){let r=`${e}.tmp-${process.pid}-${n.randomToken()}`,i,o=!1;try{i=n.openFile(r,"wx",384),o=!0,Q(i,Buffer.from(t),n,"cache ownership record"),n.syncFile(i),n.closeFile(i),i=void 0,n.linkFile(r,e);let s=Z(se(e),n);return n.removeFile(r),o=!1,ee(s,Z(se(e),n))}finally{if(i!==void 0)try{n.closeFile(i)}catch{}if(o)try{n.removeFile(r)}catch{}}}function $(e){process.platform!=="win32"&&ft(e,448)}function Ce(e){process.platform!=="win32"&&ft(e,384)}function Yn(e){if(L(e))return F(e);let t=F(se(e));return y(t,Ln(e))}function io(e){return Yn(ce(e))}function Xn(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="EEXIST"}import{spawnSync as Qn}from"child_process";import{createHash as Zn}from"crypto";import{existsSync as er,lstatSync as tr,realpathSync as nr}from"fs";import{dirname as rr,isAbsolute as ir,join as or,relative as fo,resolve as ue,sep as po}from"path";var St=Symbol.for("scip-query.project-file-listing-context.v1"),bt=globalThis,we=bt[St],R=we&&typeof we=="object"?we:{};bt[St]=R;function Pt(e,t){let n=R.active?R.canonicalProjectRoots:void 0,r=n?.get(e);if(r!==void 0)return r;let i=t();return n?.set(e,i),i}function jt(){return R.sequence??0}function xt(e,t,n){let r=R.active,i=r?.get(e);if(i&&i.pathBytes<=t)return i;let o=Vn(n(),(R.sequence??0)+1);if(R.sequence=o.sequence,o.pathBytes>t)throw new RangeError(`Git project file listing exceeded ${t} path bytes.`);return r?.set(e,o),o}function Ft(e,t){let n=R.active?.get(e);return n&&n.sequence>t?n.indexAllowsTreeFingerprintReuse:void 0}function*Ct(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 Vn(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=kt(e,t);return n.kind==="success"?n.output:void 0},runResult:kt},sr=["rev-parse","--show-toplevel","--absolute-git-dir","--git-common-dir","HEAD","HEAD^{tree}"],Ie=["status","--porcelain=v2","--branch","-z","--untracked-files=all"],ke=/^[0-9a-f]{40,64}$/;function ho(e,t=v){return cr(e,t)?.context}function cr(e,t=v){let n=t.runResult(e,sr);if(n.kind==="success"){let i=ar(n.output);if(i){let o=ur(i,t);if(o)return wt(o)}}let r=lr(e,t);return r?wt(r):void 0}function mo(e,t=v){if(!e.headCommit)return;let n=t.run(e.projectRoot,Ie);if(n===void 0)return;let r=Re(n);if(!(!r?.headCommit||r.headCommit!==e.headCommit))return{...e,clean:r.clean}}function yo(e,t=v,n={}){let r=t===v&&n.cachedInventoryAfterSequence!==void 0?Ft(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 wt(e){return{context:e,projectFileInventorySequence:jt()}}function Re(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&&!ke.test(r))&&n!==void 0)return{headCommit:r,clean:t.every(i=>i.startsWith("# "))}}function ar(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||!ke.test(o)||!ke.test(s))return;let c=w(n);return{root:c,gitDir:w(ae(c,r)),commonDir:w(ae(c,i)),headCommit:o,treeOid:s}}function ur(e,t){let n=t.run(e.root,Ie);if(n===void 0)return;let r=Re(n);return r?.headCommit!==e.headCommit?void 0:{...Et(e.root,e.gitDir),commonDir:e.commonDir,repositoryId:ve("repository",e.commonDir),headCommit:e.headCommit,treeOid:e.treeOid,clean:r.clean}}function lr(e,t){let n=fr(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(ae(i,o)),c=Ee(t.run(i,["rev-parse","--verify","HEAD"])),a=Ee(t.run(i,["rev-parse","--verify","HEAD^{tree}"])),u=t.run(i,Ie);if(u===void 0)return;let f=Re(u);if(!(!f||f.headCommit!==c))return{...r,commonDir:s,repositoryId:ve("repository",s),headCommit:c,treeOid:a,clean:f.clean}}function fr(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(ae(i,o));return{kind:"worktree",identity:Et(i,s)}}function Et(e,t){return{projectRoot:e,gitDir:t,worktreeId:ve("worktree",`${e}\0${t}`)}}function So(e,t=v){let n=t.run(e,["worktree","list","--porcelain","-z"]);return n===void 0?[]:pr(n)}function pr(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 bo(e,t,n=v){return Ee(n.run(e,t))}function ae(e,t){return ir(t)?t:ue(e,t)}function w(e){try{return nr(e)}catch{return ue(e)}}function ve(e,t){return Zn("sha256").update(`${e}\0${t}`).digest("hex").slice(0,24)}function Ee(e){return e?.trim()||void 0}function kt(e,t){let n=Qn("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"&&er(ue(e)))&&!dr(e)?{kind:"not-repository"}:{kind:"error",message:i}}function dr(e){if(process.env.GIT_DIR||process.env.GIT_COMMON_DIR)return!0;let t=ue(e);for(;;){try{return tr(or(t,".git")),!0}catch(r){let i=r.code;if(i!=="ENOENT"&&i!=="ENOTDIR")return!0}let n=rr(t);if(n===t)return!1;t=n}}import{execFileSync as ti}from"child_process";import{isUtf8 as an}from"buffer";import{createHash as $e}from"crypto";import{closeSync as fn,fstatSync as q,lstatSync as Je,openSync as pn,readdirSync as ni,readFileSync as ri,readSync as un,readlinkSync as ii,realpathSync as Y}from"fs";import{isAbsolute as oi,join as qe,relative as si,resolve as ci,sep as ai}from"path";function fe(e,t,n=[]){let r=Te(e);if(Bt.has(r)||n.some(o=>le(r,o))||t.some(o=>Dt(r,o)))return"config";if(t.some(At)&&/\.d\.(?:ts|mts|cts)$/.test(r.toLowerCase()))return"ambient";let i=Lt(r);return t.some(o=>(Nt[o]??[]).includes(i))?"source":"other"}function _t(e,t,n){let r=Te(e);if(Bt.has(r)||n?.some(o=>le(r,o))||Dt(r,t)||At(t)&&/\.d\.(?:ts|mts|cts)$/.test(r.toLowerCase()))return!0;let i=Lt(r);return(Nt[t]??[]).includes(i)}function jo(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.version!="number"||!Rt(t.languages)||typeof t.pnpmWorkspaces!="boolean"||typeof t.typescriptProjectMode!="string"||!Rt(t.typescriptProjects)||t.clojureConfigPath!==void 0&&typeof t.clojureConfigPath!="string"||!Array.isArray(t.files)||!t.files.every(gr)?null:t}function It(e){return{...e,files:e.files.map(({semanticHash:t,...n})=>n)}}function xo(e,t){return!e||!t?e===t:JSON.stringify(It(e))===JSON.stringify(It(t))}function Fo(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),f=fe(c,t.languages);!a&&u?o.push({kind:"added",path:c,inputKind:f,after:u}):a&&!u?o.push({kind:"deleted",path:c,inputKind:f,before:a}):a&&u&&(a.hash!==u.hash||a.size!==u.size)&&o.push({kind:"modified",path:c,inputKind:f,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"),(vt(e?.files??[])||vt(t.files))&&s.add("duplicate-input-path"),[...e?.files??[],...t.files].some(hr)&&s.add("unreadable-input"),{version:1,changes:o,projectIdentityChanged:e?!mr(e,t):!0,uncertainty:[...s].sort()}}function Rt(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function vt(e){return new Set(e.map(t=>t.path)).size!==e.length}function gr(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 hr(e){return e.hash==="unreadable"||e.size<0}function mr(e,t){return Tt(e.languages,t.languages)&&e.pnpmWorkspaces===t.pnpmWorkspaces&&e.typescriptProjectMode===t.typescriptProjectMode&&Tt(e.typescriptProjects,t.typescriptProjects)&&e.clojureConfigPath===t.clojureConfigPath}function Tt(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 Bt=new Set([".scipquery.json"]),yr={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"]},Sr={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:[]},Ot=new Map;function Dt(e,t){return yr[t].some(n=>le(e,n))||Sr[t].some(n=>le(e,n))}function le(e,t){let n=Te(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=Ot.get(n);if(!o){let s=n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/\?/g,"[^/]");o=new RegExp(`^${s}$`),Ot.set(n,o)}return o.test(i)}function Te(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function Lt(e){return e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:""}function At(e){return e==="typescript"||e==="javascript"}var Nt={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 br}from"async_hooks";var Pr=new br;function O(e,t){let n=pe(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 _(e,t){let n=pe(e);if(n)return n.missing.has(t)?"missing":n.paths.includes(t)?"present":"missing"}function Gt(e,t){return pe(e)?.fingerprints.get(t)}function B(e){return pe(e)?.paths}function pe(e){let t=Pr.getStore();if(t)return t.projectRoot===w(e)?t:void 0}import{createRequire as jr}from"module";import{existsSync as xr,lstatSync as Mt,readdirSync as Fr,statSync as Cr}from"fs";import p from"path";var wr=jr(import.meta.url),zt=new Set([".cache",".git",".next",".nuxt",".turbo",".nx","build","coverage","dist","node_modules","tmp","vendor"]),kr=18003;function de(e,t=[]){let n=p.resolve(e),r=t.flatMap(a=>Rr(n,a));if(r.length>0)return Wt(n,$t(r));let i=Ir(n),o=$t(i),s=vr(n,o)?[n,...o]:o,c=s.length>0?s:[n];return Wt(n,c)}function Ut(e){return new Set(e.map(t=>t==="."?"tsconfig.json":`${t.replace(/\/$/u,"")}/tsconfig.json`))}function Jt(e){let t=e.split("/").at(-1)?.toLowerCase();return t?.startsWith("tsconfig")===!0&&t.endsWith(".json")}var Er=/^\.scipquery-compiler-shard-\d+\.tsconfig\.json$/;function Bo(e){return`.scipquery-compiler-shard-${e}.tsconfig.json`}function qt(e){return Er.test(e)}function Kt(e,t,n=[]){let r;try{r=wr("@ts-morph/common/dist/typescript.js")}catch{return null}let i=p.resolve(e),o=t==="workspace"?de(i,n):["."],s=new Set;for(let c of o){let a=c==="."?i:p.join(i,c),u=p.join(a,"tsconfig.json"),f=Or(r,i);if(!f.fileExists(u))return null;let l=r.readConfigFile(u,f.readFile);if(l.error)return null;let d=r.parseJsonConfigFileContent(l.config,f,a);if(d.errors.some(m=>m.code!==kr))return null;for(let m of d.fileNames){let h=p.resolve(m);b(i,h)&&s.add(p.relative(i,h).split(p.sep).join("/"))}}return s}function Do(e,t,n,r){let i=p.resolve(e),o=new Set(r);for(let c of n){let a=p.resolve(i,c);if(b(i,a))try{let u=Mt(a);if(u.isSymbolicLink()||u.isFile()&&!o.has(D(i,a)))return!1}catch{}}let s=t==="workspace"?de(i,n):["."];for(let c of s){let a=c==="."?i:p.join(i,c),u=p.join(a,"tsconfig.json");if(!Xt(i,u))continue;let f=D(i,u);if(!o.has(f))return!1;try{if(Mt(u).isSymbolicLink())return!1;let l=Vt(i,u);if(l.includes("extends")||l.includes("\\"))return!1}catch{return!1}}return!0}function Wt(e,t){return[...new Set(t.map(n=>D(e,n)))].sort((n,r)=>n.localeCompare(r))}function Ir(e){let t=B(e);if(t)return t.flatMap(i=>{if(i.split("/").some(s=>zt.has(s)))return[];let o=p.join(e,...i.split("/"));return Ht(e,o)?[p.dirname(o)]:[]});let n=[],r=[e];for(;r.length>0;){let i=r.pop(),o;try{o=Fr(i,{withFileTypes:!0})}catch{continue}for(let s of o){let c=p.join(i,s.name);if(s.isDirectory()){!zt.has(s.name)&&!s.name.startsWith(".")&&r.push(c);continue}s.isFile()&&Ht(e,c)&&n.push(p.dirname(c))}}return n}function Rr(e,t){let n=t.trim();if(!n)return[];let r=p.resolve(e,n);if(!b(e,r))return[];let i=B(e);if(i){let o=D(e,r);if(i.includes(o)&&Oe(p.basename(r)))return[p.dirname(r)];let s=o==="."?"":`${o}/`;return i.some(c=>c.startsWith(s))?[r]:[]}try{let o=Cr(r);if(o.isDirectory())return[r];if(o.isFile()&&Oe(p.basename(r)))return[p.dirname(r)]}catch{return[]}return[]}function Ht(e,t){if(!Oe(p.basename(t)))return!1;let n=Yt(e,t);return n?p.basename(t)==="tsconfig.json"||"include"in n||"files"in n||"references"in n:!1}function Oe(e){return e.startsWith("tsconfig")&&e.endsWith(".json")}function $t(e){let t=[...new Set(e.map(n=>p.resolve(n)))].sort((n,r)=>n.localeCompare(r));return t.length<=1?t:t.filter(n=>!t.some(r=>r!==n&&Br(n,r)))}function vr(e,t){if(t.length===0||t.some(r=>p.resolve(r)===e))return!1;let n=p.join(e,"tsconfig.json");return Xt(e,n)&&Tr(e,n)}function Tr(e,t){let r=Yt(e,t)?.include;return Array.isArray(r)?r.some(i=>typeof i=="string"&&i.trim()!==""&&!i.startsWith("!")&&(i.includes("/")||i.includes("**")||!p.extname(i))):!1}function Yt(e,t){try{let n=JSON.parse(Vt(e,t));return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}function Xt(e,t){let n=D(e,t),r=_(e,n);return r?r==="present":xr(t)}function Vt(e,t){let n=D(e,t);if(B(e)){let i=O(e,n);if(!i)throw Object.assign(new Error(`Snapshot file ${n} is missing.`),{code:"ENOENT"});return i.content.toString("utf8")}return H(t,"TypeScript project config")}function Or(e,t){let n=B(t);if(!n)return e.sys;let r=p.resolve(t),i=new Set(n),o=_r(r,n),s=e,c=a=>{let u=p.resolve(a);return b(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):O(r,u)?.content.toString("utf8")},readDirectory(a,u,f,l,d){let m=p.resolve(a);return b(r,m)?s.matchFiles(m,u,f,l,e.sys.useCaseSensitiveFileNames,r,d,h=>o.get(p.resolve(h))??{files:[],directories:[]},h=>h):e.sys.readDirectory(a,u,f,l,d)}}}function _r(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=p.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=p.relative(e,t);return n?n.split(p.sep).join("/"):"."}function Br(e,t){let n=p.relative(e,t);return!!n&&!n.startsWith("..")&&!p.isAbsolute(n)}import{createHash as De}from"crypto";import{execFileSync as Qt}from"child_process";import{createRequire as Dr}from"module";var Lr=Dr(import.meta.url),Ar=/\.(?:[cm]?[jt]sx?)$/iu,Nr=/\.[jt]sx$/iu,Zt=/(?:^|\/)package\.json$/iu,J,_e=new Map;function en(e,t){if(!Le(e))return;let n=Gr();if(n)try{let r=typeof t=="string"?t:t.toString("utf8"),i=Nr.test(e)?n.LanguageVariant.JSX:n.LanguageVariant.Standard,o=n.createScanner(n.ScriptTarget.Latest,!1,i,r),s=De("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 f=o.getTokenText();s.update(`${u}\0${Buffer.byteLength(f)}\0`).update(f).update("\0"),c=!0,a=!1}return s.digest("hex")}catch{return}}function Le(e){return Ar.test(e)}function Ae(e,t){if(Zt.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 De("sha256").update("typescript-package-json-v1\0").update(Be(i)).digest("hex")}catch{return}}function Ne(e){return Zt.test(e)}function Mo(e,t,n){if(!Ne(t)||!/^[a-f0-9]{64}$/u.test(n))return;let r=`${e}\0${t}\0${n}`;if(_e.has(r))return _e.get(r);let i;try{let o=Qt("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=Qt("git",["-C",e,"show",`${s}:${t}`],{encoding:null,maxBuffer:4194304,timeout:5e3});if(De("sha256").update(c).digest("hex")===n){i=Ae(t,c);break}}}catch{i=void 0}return _e.set(r,i),i}function Gr(){if(J!==void 0)return J;try{J=Lr("typescript")}catch{J=null}return J}function Be(e){return Array.isArray(e)?`[${e.map(Be).join(",")}]`:typeof e=="object"&&e!==null?`{${Object.entries(e).sort(([t],[n])=>t.localeCompare(n)).map(([t,n])=>`${JSON.stringify(t)}:${Be(n)}`).join(",")}}`:JSON.stringify(e)}import{closeSync as tn,existsSync as Me,openSync as Mr,realpathSync as zr,renameSync as Wr,unlinkSync as nn,writeSync as Hr}from"fs";import{dirname as $r,join as Ur}from"path";var Jr="fingerprint-stat-cache.json",rn=1,qr=8*1024*1024,Ge=new Map;function ze(e,t,n,r){let i=on(e),o=i.files.get(t);if(!(!o||!sn(o,n,r)))return i.hits+=1,{hash:o.hash,size:o.fingerprintSize,...o.semanticHash===void 0?{}:{semanticHash:o.semanticHash}}}function We(e,t,n,r,i){if(i.hash==="unreadable"||i.size<0||!Number.isFinite(i.size))return;let o=on(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&&Zr(c,s)||(o.files.set(t,s),o.stores+=1,o.dirty=!0)}function He(e){let t=Ge.get(cn(e));if(!(!t?.dirty||!t.cachePath))try{let n=$r(t.cachePath);if(!Me(n))return;ei(t.cachePath,Xr(t)),t.dirty=!1}catch{}}function on(e){let t=cn(e),n=Ge.get(t);if(n)return n;let r=Kr(t),i=Yr(r),o={cachePath:r,files:i,dirty:!1,hits:0,stores:0};return Ge.set(t,o),o}function Kr(e){try{let t=Fe(e);return Me(t)?Ur(t,Jr):null}catch{return null}}function Yr(e){let t=new Map;if(!e||!Me(e))return t;try{let n=JSON.parse(ne(e,{inputKind:"fingerprint stat cache",maxBytes:qr}).toString("utf8"));if(!Vr(n))return t;for(let[r,i]of Object.entries(n.files))i&&t.set(r,i)}catch{return t}return t}function Xr(e){return{version:rn,files:Object.fromEntries(e.files)}}function Vr(e){if(typeof e!="object"||e===null)return!1;let t=e;return t.version!==rn||typeof t.files!="object"||t.files===null?!1:Object.values(t.files).every(Qr)}function Qr(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 sn(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 Zr(e,t){return sn(e,t.kind,t)&&e.hash===t.hash&&e.fingerprintSize===t.fingerprintSize&&e.semanticHash===t.semanticHash}function ei(e,t){let n=`${e}.${process.pid}.tmp`;try{nn(n)}catch{}let r=Buffer.from(`${JSON.stringify(t)}
|
|
4
|
-
`,"utf8"),i=Mr(n,"wx",384);try{Q(i,r,{writeFile:(o,s,c,a)=>Hr(o,s,c,a)},"fingerprint stat cache")}catch(o){throw tn(i),nn(n),o}tn(i),Wr(n,e)}function cn(e){return zr(e)}var X=64*1024*1024,ui=1024*1024,li=1024,A=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 fi(e){return[...new Set((e??[]).map(t=>t.trim()).filter(Boolean))].sort((t,n)=>t.localeCompare(n))}function Ke(e,t,n={}){let r=E(t),i=Pt(e,()=>Y(e)),o=ci(i,...r.split("/"));if(!b(i,o)||o===i)throw new g(t,"outside-project");let s=Y(o);if(!b(i,s)||s===i)throw new g(t,"outside-project");let c=Je(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??X;if(T(u),a.size>u)throw new A(n.inputKind??"project file",a.relativePath,a.size,u);return a}function pi(e,t,n={}){let r=E(t),i=_(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=O(e,r);if(!a)throw new g(r,"changed-during-read");let u=n.maxBytes??X;if(T(u),a.size>u)throw new A(n.inputKind??"project file",r,a.size,u);return Buffer.from(a.content)}let o=Ke(e,t,n),s=n.maxBytes??X,c=pn(o.absolutePath,"r");try{let a=q(c);if(K(a,o,t),a.size>s)throw new A(n.inputKind??"project file",o.relativePath,a.size,s);let u=ri(c),f=q(c);if(K(f,o,t),u.byteLength!==a.size)throw new g(t,"changed-during-read");return u}finally{fn(c)}}function cs(e,t,n,r={}){if(n.byteLength===0)throw new Error("Project file probe literal must not be empty.");let{matchedLiteralIndexes:i,...o}=di(e,t,[n],r);return{...o,includesLiteral:i.length>0}}function di(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=E(t),o=_(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=O(e,i);if(!a)throw new g(i,"changed-during-read");let u=r.maxBytes??X;if(T(u),a.size>u)throw new A(r.inputKind??"project file",i,a.size,u);let f=!a.content.includes(0)&&an(a.content),l=n.map(ln),d=f?hi(a.content,n,l):[];return{byteLength:a.size,isUtf8Text:f,matchedLiteralIndexes:d,bytes:d.length>0?Buffer.from(a.content):null,...r.computeSha256?{sha256:a.sha256}:{}}}let s=Ke(e,t,r),c=pn(s.absolutePath,"r");try{let a=q(c);K(a,s,t);let u=r.computeSha256?$e("sha256"):null,f=r.scratchBuffer??Buffer.allocUnsafe(ui);if(f.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,P=Buffer.alloc(0),V=n.map(()=>Buffer.alloc(0)),N=n.map(ln);for(;l<a.size;){let j=un(c,f,0,Math.min(f.byteLength,a.size-l),l);if(j<=0)throw new g(t,"changed-during-read");let x=f.subarray(0,j);if(u?.update(x),m||=x.includes(0),h){let S=P.byteLength>0?Buffer.concat([P,x]):x,z=gi(S);h=an(S.subarray(0,z)),P=Buffer.from(S.subarray(z))}for(let S=0;S<n.length;S+=1){if(d[S])continue;let z=n[S],Ve=V[S];d[S]=mi(x,z,Ve,N[S]),V[S]=yi(x,z,Ve)}l+=j}h&&=P.byteLength===0,K(q(c),s,t);let G=!m&&h,M=G?d.flatMap((j,x)=>j?[x]:[]):[],k=null;if(M.length>0){k=Buffer.allocUnsafe(a.size);let j=0;for(;j<k.byteLength;){let x=un(c,k,j,k.byteLength-j,j);if(x<=0)throw new g(t,"changed-during-read");j+=x}K(q(c),s,t)}return{byteLength:a.size,isUtf8Text:G,matchedLiteralIndexes:M,bytes:k,...u?{sha256:u.digest("hex")}:{}}}finally{fn(c)}}function as(e,t,n={}){return pi(e,t,n).toString("utf8")}function K(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 gi(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 hi(e,t,n){return t.flatMap((r,i)=>Ue(e,r,n[i])?[i]:[])}function mi(e,t,n,r){if(Ue(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 Ue(Buffer.concat([n,i]),t,r)}function Ue(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>li)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 ln(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 yi(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 Ye(e){return typeof e=="object"&&e!==null&&"code"in e&&(e.code==="ENOENT"||e.code==="ENOTDIR")}function us(e,t){try{return Ke(e,t),!0}catch(n){if(Ye(n))return!1;throw n}}function Si(e){let t=B(e);return t?t.filter(n=>n&&!he(n)).sort():(Ci(e)??wi(e)).filter(n=>n&&!he(n)).sort()}function bi(e,t={}){let n=(t.includePaths??[]).map(E),r=[...new Set([...Si(e),...n])].filter(s=>!he(s)).filter(s=>!t.language||_t(s,t.language,t.markerFiles)).filter(s=>!t.includePath||t.includePath(s)).sort((s,c)=>s.localeCompare(c)),i=Y(e),o=r.flatMap(s=>dn(e,i,s));return He(i),o}function dn(e,t,n){let r=Gt(e,n);if(r)return[{path:n,size:r.fingerprintSize??r.size,hash:r.sha256}];if(_(e,n)==="present"){let o=O(e,n);if(o)return[{path:n,size:o.fingerprintSize??o.size,hash:o.sha256}]}let i=qe(e,n);try{let o=Je(i);if(o.isSymbolicLink()){let P=ze(t,n,"symlink",ge(o));if(P)return[{path:n,size:P.size,hash:P.hash}];let V=Y(i),N=si(t,V);if(N===".."||N.startsWith(`..${ai}`)||oi(N))throw new Error("external symlink");let G=ii(i),M=$e("sha256").update("symlink\0").update(G).digest("hex"),k=Buffer.byteLength(G);return We(t,n,"symlink",ge(o),{hash:M,size:k}),[{path:n,size:k,hash:M}]}let s=Le(n)||Ne(n),c=ze(t,n,"file",ge(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=$e("sha256"),u=s,f=[],l=re(i,{inputKind:"project fingerprint input",maxBytes:X},P=>{a.update(P),u&&f.push(Buffer.from(P))}),d=a.digest("hex"),m=u?Buffer.concat(f,l):void 0,h=m?en(n,m)??Ae(n,m):void 0;return We(t,n,"file",ge(o),{hash:d,size:l,...h===void 0?{}:{semanticHash:h}}),[{path:n,size:l,hash:d,...h===void 0?{}:{semanticHash:h}}]}catch(o){return Ye(o)?[]:[{path:n,size:-1,hash:"unreadable"}]}}function ge(e){return{dev:e.dev,ino:e.ino,mtimeMs:e.mtimeMs,ctimeMs:e.ctimeMs,size:e.size}}function gn(e,t,n){let r=Xe(t,n),i=[...r.typescriptProjects.filter(a=>xi(e,a)),...r.clojureConfigPath?[r.clojureConfigPath]:[]],o=r.languages.includes("typescript")?Kt(e,r.typescriptProjectMode,r.typescriptProjects):null,s=r.languages.includes("typescript")?r.typescriptProjectMode==="workspace"?de(e,r.typescriptProjects):["."]:[],c=Ut(s);return{...r,files:bi(e,{includePath:a=>{if(a===".scipquery.json")return!1;let u=fe(a,t,i);return u==="other"||u==="config"&&Jt(a)&&!c.has(a)?!1:u!=="source"||!ji(a)||!o?!0:o.has(a)},includePaths:i})}}function ls(e,t){let n=new Set(t.files.map(o=>o.path)),r=gn(e,t.languages,t),i=new Map(r.files.map(o=>[o.path,o]));return{...Xe(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 fs(e,t,n,r,i,o){let s=l=>({mode:"full",fingerprint:gn(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=Xe(t,n);if(!Pi(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(fe(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 f=Y(e);for(let l of i.entries){let d=dn(e,f,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 He(f),{mode:"delta",fingerprint:{...c,files:[...u.values()].sort((l,d)=>l.path.localeCompare(d.path))},changedPaths:i.entries.map(l=>l.path).sort()}}function Pi(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 ji(e){return/\.(?:[cm]?[jt]sx?|vue)$/iu.test(e)}function xi(e,t){let n;try{n=E(t)}catch{return!1}let r=_(e,n);if(r)return r==="present";try{return Je(qe(e,n)).isFile()}catch(i){if(Ye(i))return!1;throw i}}function Xe(e,t){return{version:3,languages:[...e].sort(),pnpmWorkspaces:t.typescriptProjectMode!=="workspace"&&t.pnpmWorkspaces===!0,typescriptProjectMode:t.typescriptProjectMode??"single",typescriptProjects:fi(t.typescriptProjects),clojureConfigPath:Fi(t.clojureConfigPath)}}function Fi(e){return e?.trim()||void 0}function Ci(e){try{let t=xt(e,52428800,()=>ti("git",["-C",e,"ls-files","-co","-v","-z","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:104857600,stdio:["ignore","pipe","ignore"],timeout:3e4,killSignal:"SIGKILL"}));return[...Ct(t)]}catch{return null}}function wi(e){let t=[],n=[""];for(;n.length>0;){let r=n.pop(),i=r?qe(e,r):e,o;try{o=ni(i,{withFileTypes:!0})}catch{continue}for(let s of o){let c=r?`${r}/${s.name}`:s.name;if(s.isDirectory()){he(c)||n.push(c);continue}t.push(c)}}return t}function he(e){let t=e.split("/");return e==="meta.json"||qt(e)||t[0]===".scipquery"&&(t[1]==="events"||t[1]==="ledger"||t[1]==="releases"||t[1]==="suppressions")||t.some(n=>ki.has(n))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var ki=new Set([".git","node_modules",".scipquery-cache",".scipquery-generations",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]);export{rt as a,it as b,kn as c,En as d,I as e,ne as f,Pe as g,H as h,In as i,Rn as j,re as k,vn as l,fe as m,_t as n,jo as o,It as p,xo as q,Fo as r,gr as s,yr as t,Q as u,ye as v,W as w,et as x,Z as y,ee as z,g as A,me as B,Ii as C,Ri as D,b as E,E as F,tt as G,Fe as H,gt as I,Gn as J,eo as K,to as L,no as M,ro as N,io as O,Mo as P,xt as Q,Ct as R,v as S,ho as T,mo as U,yo as V,fr as W,So as X,bo as Y,ae as Z,w as _,de as $,Ut as aa,Jt as ba,Bo as ca,qt as da,Kt as ea,Do as fa,A as ga,fi as ha,Ke as ia,pi as ja,cs as ka,di as la,as as ma,Ye as na,us as oa,Si as pa,bi as qa,gn as ra,ls as sa,fs as ta,Xe as ua};
|
|
5
|
-
//# sourceMappingURL=chunk-AK3PYTIK.js.map
|
package/dist/chunk-AMIMMNA4.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{c as Y}from"./chunk-ISIQLPJ2.js";import{e as j,k as w,m as H,n as Q,o as Z}from"./chunk-HG722PO7.js";import{F as A,G as D,H as V,J as X,o as K,q as M,u as b,v as $}from"./chunk-GH5YSGZL.js";import{spawn as Se}from"child_process";import{platform as ee}from"os";import{performance as te}from"perf_hooks";var ft={probe:1e4,git:3e4,analysis:18e4,install:3e5,indexer:6e5},h=class extends Error{constructor(n,r,s,a={}){super(s,a.cause===void 0?void 0:{cause:a.cause});this.kind=n;this.label=r;this.name="BoundedProcessError",this.timedOut=a.timedOut??!1,this.reaped=a.reaped??!1,this.stdout=a.stdout??"",this.stderr=a.stderr??"",this.stdoutTruncated=a.stdoutTruncated??!1,this.stderrTruncated=a.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 ne(e,t,n,r){let s=Math.max(0,r-n);s>0&&e.push(t.subarray(0,s))}function re(e,t,n){let r=Buffer.concat([...e,t]);e.length=0,e.push(r.subarray(Math.max(0,r.length-n)))}function mt(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,s)=>{let a=te.now(),i=ee()!=="win32"&&process.env.SCIP_REINDEX_PROCESS_GROUP_LEADER==="1",c=ee()!=="win32"&&!i,o;try{o=Se(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);s(new h("spawn",e.label,`${e.label} could not start: ${f}`,{cause:d,reaped:!0}));return}let u=[],g=[],l=0,m=0,R=!1,x=!1,p=null,y=!1,z=o.pid===void 0?null:Q(o.pid,c),P=()=>{clearTimeout(U),e.signal?.removeEventListener("abort",I)},E=d=>{if(y||!p)return;y=!0,P();let f=Buffer.concat(u).toString("utf8"),_=Buffer.concat(g).toString("utf8"),N=d.reaped||!d.detail?"":` Process-tree cleanup failed: ${d.detail}`;s(new h(p.kind,e.label,`${p.message}${N}`,{timedOut:p.timedOut,reaped:d.reaped,stdout:f,stderr:_,stdoutTruncated:R,stderrTruncated:x}))},B=d=>{if(!(p||y)){if(p=d,!z){E({reaped:o.pid===void 0,reason:o.pid===void 0?"terminated":"identity-unavailable"});return}Z(z,{gracefulMs:t,forceMs:n}).then(E,f=>{E({reaped:!1,reason:"signal-failed",detail:f instanceof Error?f.message:String(f)})})}},U=setTimeout(()=>{B({kind:"timeout",timedOut:!0,message:`${e.label} timed out after ${e.timeoutMs}ms.`})},e.timeoutMs);U.unref();let I=()=>{B({kind:"aborted",timedOut:!1,message:`${e.label} was cancelled.`})};e.signal?.addEventListener("abort",I,{once:!0}),e.signal?.aborted&&I(),o.stdout.on("data",d=>{let f=Buffer.isBuffer(d)?d:Buffer.from(d);e.outputLimitBehavior==="truncate-tail"?re(u,f,e.maxStdoutBytes):ne(u,f,l,e.maxStdoutBytes),l+=f.length,l>e.maxStdoutBytes&&(R=!0,e.outputLimitBehavior!=="truncate-tail"&&B({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"?re(g,f,e.maxStderrBytes):ne(g,f,m,e.maxStderrBytes),m+=f.length,m>e.maxStderrBytes&&(x=!0,e.outputLimitBehavior!=="truncate-tail"&&B({kind:"stderr-limit",timedOut:!1,message:`${e.label} exceeded stderr limit (${e.maxStderrBytes} bytes).`}))}),o.on("error",d=>{if(!y&&!p){if(o.pid===void 0){P(),y=!0,s(new h("spawn",e.label,`${e.label} could not start: ${d.message}`,{cause:d,reaped:!0}));return}B({kind:"spawn",timedOut:!1,message:`${e.label} failed after start: ${d.message}`})}}),o.on("close",(d,f)=>{if(y||p)return;y=!0,P();let _=Buffer.concat(u).toString("utf8"),N=Buffer.concat(g).toString("utf8");r({status:d,signal:f,stdout:_,stderr:N,timedOut:!1,durationMs:te.now()-a,stdoutTruncated:R,stderrTruncated:x})}),e.input===void 0?o.stdin.end():o.stdin.end(e.input)})}import{execFileSync as ie}from"child_process";import{createRequire as Le}from"module";import{existsSync as Ae}from"fs";import{platform as S,arch as se}from"os";var L="v0.8.1",J="https://github.com/sourcegraph/scip",T=`github.com/sourcegraph/scip/cmd/scip@${L}`,ae=Le(import.meta.url),oe="SCIP_QUERY_SCIP_BIN";function we(e){if(e.isOnPath("scip"))return{source:"path",path:"scip"};let t=e.env[oe];if(t&&e.fileExists(t))return{source:"env",path:t};if(e.platform==="win32"){let n=e.resolveSidecar(e.arch);if(n&&e.fileExists(n))return{source:"sidecar",path:n}}return null}function Te(e){for(let t of e==="arm64"?["arm64","x64"]:[e])try{return ae.resolve(`scip-query-scip-windows/scip-win32-${t}.exe`)}catch{}return null}function W(e=process.env){let t=we({platform:S(),arch:se(),env:e,isOnPath:w,fileExists:Ae,resolveSidecar:Te});return t?.source==="path"?H("scip")??t.path:t?.path??null}function vt(){return W()!==null}function Oe(){let e=W();if(!e)return null;try{return ie(e,["--version"],{stdio:"pipe",timeout:1e4,killSignal:"SIGKILL"}).toString().trim()}catch{return null}}function ke(){let e=S(),t=se(),n,r,s;switch(e){case"darwin":n="darwin",s="tar.gz";break;case"linux":n="linux",s="tar.gz";break;default:return null}switch(t){case"arm64":r="arm64";break;case"x64":r="amd64";break;default:return null}let a=`scip-${n}-${r}.${s}`;return{url:`${J}/releases/download/${L}/${a}`,filename:a}}function ht(){let e=ke();if(console.log("\nThe `scip` CLI is required but not found on PATH.\n"),S()==="darwin"||S()==="linux")console.log("Install the reviewed version with Go:"),console.log(` go install ${T}
|
|
2
|
-
`),console.log("Or download that exact release manually:");else if(S()==="win32"){let t=Pe();console.log("On Windows the scip binary ships via the npm sidecar package scip-query-scip-windows,"),console.log("installed automatically with scip-query. If it is missing:"),console.log(` npm install -g ${t}`),console.log(`Or set ${oe} to a local scip.exe path.
|
|
3
|
-
`),console.log("Upstream release page:")}else console.log("Download from:");console.log(e?` ${e.url}
|
|
4
|
-
`:` ${J}/releases/tag/${L}
|
|
5
|
-
`),console.log("After installing, ensure `scip` is on your PATH and run `scip-query reindex`.")}function Pe(){let t=ae("../../package.json").optionalDependencies?.["scip-query-scip-windows"];if(!t||!/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(t))throw new Error("scip-query package metadata does not declare an exact Windows sidecar version.");return`scip-query-scip-windows@${t}`}function St(e){if(w("go")){e(`Installing immutable ${T} via go install into the Go bin directory (GOBIN or GOPATH/bin); expected executable: scip.`);try{if(ie("go",["install",T],{stdio:"inherit",timeout:3e5,env:process.env}),w("scip")){let t=W(),n=Oe();if(t&&n&&n.includes(L))return e(`Successfully installed ${T}; resolved executable: ${t}; reported version: ${n}.`),!0;e(`go install completed, but the resolved scip executable did not report ${L} (executable: ${t??"unresolved"}; version: ${n??"unavailable"}).`)}}catch(t){let n=t instanceof Error?t.message:String(t);e(`go install failed: ${n}`)}}return e("Could not auto-install scip CLI."),e(`Install manually from: ${J}/releases`),!1}var ue=class extends Error{constructor(t){super(t),this.name="ReindexLockUnavailableError"}};import{existsSync as me,statSync as Ue}from"fs";import{dirname as be,join as xe}from"path";import{appendFileSync as Ee,existsSync as Ie,mkdirSync as _e,renameSync as Ne,rmSync as Me,statSync as $e,truncateSync as De}from"fs";import{basename as Je,dirname as We}from"path";var O=".previous",Ce=".rotation.lock",Fe=2e3,C=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"},F=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"},de=Object.freeze({monotonicNow:j,wait(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)},tryAcquireLock(e,t){let n=Y(e,{kind:"rotating-jsonl",detail:{target:Je(t)}});return n.kind==="acquired"?{kind:"acquired",lock:n.lock}:{kind:"contended"}},makeDirectory(e){_e(e,{recursive:!0})},exists:Ie,readBytes(e){return V(e,{maxBytes:A,inputKind:"rotating JSONL segment"})},size(e){return $e(e).size},truncate:De,remove(e){Me(e,{force:!0})},rename:Ne,append:Ee});function le(e,t,n){let r=n.runtime??de,s=JSON.stringify(t);if(s===void 0)throw new TypeError("Rotating JSONL records must be JSON-serializable values.");let a=Buffer.from(`${s}
|
|
6
|
-
`),i=Math.max(1,Math.floor(n.maxSegmentBytes),a.length);return ge(e,n.lockTimeoutMs,r,()=>{r.makeDirectory(We(e));let c=Ge(e,A,r);n.onPhase?.("tail-repaired");let o=`${e}${n.previousSuffix??O}`,u=!1,g=!1;return r.exists(e)&&r.size(e)+a.length>i&&(r.exists(o)&&(r.remove(o),g=!0),n.onPhase?.("previous-pruned"),r.rename(e,o),u=!0,n.onPhase?.("current-rotated")),r.append(e,a),n.onPhase?.("record-appended"),{lineBytes:a.length,segmentLimitBytes:i,repairedTailBytes:c,rotated:u,prunedPrevious:g}})}function ce(e,t={}){let n=t.runtime??de,r=qe(t.maxSegmentBytes);return ge(e,t.lockTimeoutMs,n,()=>{let s=[],a=0,i=`${e}${t.previousSuffix??O}`;for(let c of[i,e]){if(!n.exists(c))continue;let o=ze(fe(c,r,n));s.push(...o.lines),a+=o.partialTailBytes}return{lines:s,ignoredPartialTailBytes:a}})}function ge(e,t,n,r){let s=`${e}${Ce}`,a=Math.max(0,t??Fe),i=n.monotonicNow()+a,c;for(;;){let m=n.tryAcquireLock(s,e);if(m.kind==="acquired"){c=m.lock;break}let R=i-n.monotonicNow();if(R<=0)throw new C(s,a);n.wait(Math.min(5,R))}let o=!1,u,g;try{g=r()}catch(m){o=!0,u=m}let l=!1;try{l=c.release()}catch(m){if(!o)throw m}if(o)throw u;if(!l)throw new F(s);return g}function Ge(e,t,n){if(!n.exists(e))return 0;let r=fe(e,t,n);if(r.length===0||r[r.length-1]===10)return 0;let s=r.lastIndexOf(10),a=s<0?0:s+1;return n.truncate(e,a),r.length-a}function qe(e){let t=e??A;if(!Number.isSafeInteger(t)||t<=0)throw new RangeError(`maxSegmentBytes must be a positive safe integer; received ${t}`);return t}function fe(e,t,n){let r=n.size(e);if(r>t)throw new D("rotating JSONL segment",e,"too-large",r,t);let s=n.readBytes(e),a=n.size(e);if(a!==r||s.byteLength!==r)throw new D("rotating JSONL segment",e,"changed-during-read",a,t);return s}function ze(e){let t=e.lastIndexOf(10),n=t<0?0:t+1;return{lines:e.subarray(0,n).toString("utf8").split(`
|
|
7
|
-
`).filter(s=>s.length>0),partialTailBytes:e.length-n}}var Ke="reindex-activity.jsonl",k=O,Ve=1024*1024,Xe=1440*60*1e3,pe=e=>X(e,"reindex activity segment");function q(e){return xe(be(e),Ke)}function Be(e){if(e.reused)return 0;let n=(e.shards?.some(r=>!r.reused&&r.strategy==="incremental")??!1?0:G(e.indexPath))+G(e.dbPath);for(let r of e.shards??[]){if(r.reused)continue;let s=r.producedOutputBytes??r.outputBytes;s!==null&&(n+=s)}return n}function je(e){let t=Be(e),n=e.writeTelemetry;return n?Math.max(0,t-n.reflinkedBytes)+n.fallbackCopiedBytes+(n.incrementalWrittenBytes??0):t}function Jt(e,t){let n=t.lastRefresh;if(!n)return{state:"failed",reason:"reindex result has no refresh metadata"};let r=Be(t);return ve(q(e),{version:1,event:"run",recordedAt:n.completedAt,trigger:n.trigger,result:n.result,durationMs:n.durationMs,estimatedLogicalOutputBytes:r,estimatedWriteBytes:je(t),reflinkedBytes:t.writeTelemetry?.reflinkedBytes??0,fallbackCopiedBytes:t.writeTelemetry?.fallbackCopiedBytes??0,incrementalWrittenBytes:t.writeTelemetry?.incrementalWrittenBytes??0,byLanguage:nt(t)})}function Wt(e,t){return ve(q(e),{version:1,event:"run",recordedAt:t.completedAt,trigger:t.trigger,result:"failed",durationMs:t.durationMs,estimatedLogicalOutputBytes:0})}function Ye(e,t,n=Ve,r){le(e,t,{maxSegmentBytes:n,previousSuffix:k,...r?{runtime:r}:{}})}function He(e,t=new Date,n=Xe,r=pe){let s=t.getTime(),a=s-n,i={confidence:"complete",recordsRead:0,invalidRecords:0,skippedRecords:0,readErrors:0,ignoredPartialTailBytes:0,windowStartedAt:new Date(a).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:{}},c=q(e),o=[];if(r===pe){if(!me(c)&&!me(`${c}${k}`))return i;try{let u=ce(c,{previousSuffix:k});o=u.lines,i.ignoredPartialTailBytes=u.ignoredPartialTailBytes}catch{i.readErrors+=1,i.confidence="unavailable"}}else{let u=0;for(let g of[`${c}${k}`,c])try{o.push(...ut(r(g))),u+=1}catch{i.readErrors+=1}u===0?i.confidence="unavailable":i.readErrors>0&&(i.confidence="partial")}for(let u of o){i.recordsRead+=1;let g=Qe(u);if(!g){i.invalidRecords+=1,i.confidence!=="unavailable"&&(i.confidence="partial");continue}let{record:l}=g,m=Date.parse(l.recordedAt);if(m<a||m>s){i.skippedRecords+=1;continue}if(i.invalidLanguageDetails=(i.invalidLanguageDetails??0)+g.invalidLanguageDetails,i.byTrigger[l.trigger.kind]=(i.byTrigger[l.trigger.kind]??0)+1,l.event==="suppressed"){i.suppressed+=1;continue}i.runs+=1,i[l.result]+=1,i.estimatedLogicalOutputBytes+=l.estimatedLogicalOutputBytes;let R=Ze(l);i.estimatedWriteBytes=(i.estimatedWriteBytes??0)+R,i.reflinkedBytes=(i.reflinkedBytes??0)+(l.reflinkedBytes??0),i.fallbackCopiedBytes=(i.fallbackCopiedBytes??0)+(l.fallbackCopiedBytes??0),l.result!=="failed"&&(g.hasLanguageDetails?i.attributedRuns=(i.attributedRuns??0)+1:i.unattributedRuns=(i.unattributedRuns??0)+1);for(let[x,p]of he(l.byLanguage)){let y=(i.byLanguage??={})[x]??=at();y.runs+=1,y[p.result]+=1,y.producedOutputBytes+=p.producedOutputBytes,y.durationMs+=p.durationMs}ye(l)&&i.oldestRebuildAt===void 0&&(i.oldestRebuildAt=l.recordedAt),ye(l)&&(i.fullRebuilds=(i.fullRebuilds??0)+1),R>0&&i.oldestWriteAt===void 0&&(i.oldestWriteAt=l.recordedAt)}return i.ignoredPartialTailBytes>0&&i.confidence!=="unavailable"&&(i.confidence="partial"),i.languageAttribution=ot(i),i}function ve(e,t){try{return Ye(e,t),{state:"recorded"}}catch(n){return{state:"failed",reason:n instanceof Error?n.message:String(n)}}}function Qe(e){try{let t=JSON.parse(e);if(!t||typeof t!="object")return null;let n=t;if(n.version!==1||!K(n.recordedAt)||!n.trigger||!tt(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:s,...a}=r,i=rt(s);return{record:{...a,...i.byLanguage?{byLanguage:i.byLanguage}:{}},hasLanguageDetails:i.hasLanguageDetails,invalidLanguageDetails:i.invalidLanguageDetails}}catch{return null}}function Ze(e){return e.reflinkedBytes===void 0?e.estimatedWriteBytes??e.estimatedLogicalOutputBytes:Math.max(0,e.estimatedLogicalOutputBytes-e.reflinkedBytes)+(e.fallbackCopiedBytes??0)+(e.incrementalWrittenBytes??0)}function Ct(e,t,n=new Date){return t.enabled?et(He(e,n,t.windowMs),t,n.getTime()):{state:"allowed",rebuilt:0,estimatedWriteBytes:0}}function et(e,t,n){let r=e.estimatedWriteBytes??e.estimatedLogicalOutputBytes,s=e.fullRebuilds??e.rebuilt,a={rebuilt:s,estimatedWriteBytes:r};return t.enabled?e.confidence!==void 0&&e.confidence!=="complete"?{state:"paused",reason:"activity-evidence",until:n+t.windowMs,...a,detail:`reindex activity evidence is ${e.confidence}`}:s>=t.maxRebuilds?{state:"paused",reason:"rebuild-count",until:Re(e.oldestRebuildAt,t.windowMs,n),...a,detail:`${s}/${t.maxRebuilds} expensive full rebuild slots consumed`}:r>=t.maxEstimatedWriteBytes?{state:"paused",reason:"estimated-write-bytes",until:Re(e.oldestWriteAt,t.windowMs,n),...a,detail:`${r}/${t.maxEstimatedWriteBytes} estimated write bytes consumed`}:{state:"allowed",...a}:{state:"allowed",...a}}function ye(e){if(e.result!=="rebuilt")return!1;let t=he(e.byLanguage);return t.length===0?!0:t.some(([,n])=>n.result==="rebuilt"&&n.strategy!=="incremental"&&n.strategy!=="reused")}function Re(e,t,n){let r=e?Date.parse(e):Number.NaN;return Number.isFinite(r)&&r+t>n?r+t:n+t}function tt(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 G(e){try{return Ue(e).size}catch{return 0}}function nt(e){let t={};for(let n of e.languages){let r=(e.shards??[]).filter(u=>u.language===n),s=r.find(u=>u.id===n),a=e.reused||(s?s.reused:r.length>0&&r.every(u=>u.reused)),i=G(xe(be(e.dbPath),"language-indexes",`${n}.scip`)),c=i>0?i:s?.outputBytes??i,o=a?0:s?.durationMs??r.filter(u=>!u.reused).reduce((u,g)=>u+g.durationMs,0);t[n]={result:a?"reused":"rebuilt",strategy:a?"reused":s?.strategy??"full",...s?.strategy==="full"&&(s.fallbackReason??s.missReason)?{fallbackReason:s.fallbackReason??s.missReason}:{},outputBytes:c,producedOutputBytes:a?0:s?.producedOutputBytes??c,durationMs:o}}return t}function rt(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[s,a]of Object.entries(e)){if(!st(s)||!it(a)){n+=1;continue}t[s]=a}let r=Object.keys(t).length>0;return{...r?{byLanguage:t}:{},hasLanguageDetails:r,invalidLanguageDetails:n}}function it(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")&&M(t.outputBytes)&&M(t.producedOutputBytes)&&b(t.durationMs)&&(t.result!=="reused"||t.producedOutputBytes===0&&t.durationMs===0)&&t.producedOutputBytes<=t.outputBytes}function st(e){return $.includes(e)}function he(e){return e?$.flatMap(t=>{let n=e[t];return n?[[t,n]]:[]}):[]}function at(){return{runs:0,rebuilt:0,reused:0,producedOutputBytes:0,durationMs:0}}function ot(e){let t=e.invalidLanguageDetails??0,n=e.attributedRuns??0;return(e.unattributedRuns??0)===0&&t===0?"complete":n===0?"unavailable":"partial"}function ut(e){return e.endsWith(`
|
|
8
|
-
`)||(e=e.slice(0,Math.max(0,e.lastIndexOf(`
|
|
9
|
-
`)+1))),e.split(`
|
|
10
|
-
`).filter(t=>t.length>0)}export{ft as a,h as b,mt as c,W as d,vt as e,Oe as f,ht as g,St as h,ue as i,O as j,le as k,Ke as l,Jt as m,Wt as n,Ct as o};
|
|
11
|
-
//# sourceMappingURL=chunk-AMIMMNA4.js.map
|
package/dist/chunk-AUY5BL74.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as Q,d as Y,e as I}from"./chunk-BVFYEEBH.js";import{a as _,b as K,c as x,d as G}from"./chunk-57N6LN2A.js";import{a as C,c as J,d as W}from"./chunk-JT6XX7QY.js";import{b as v}from"./chunk-H5EXS3HM.js";import{a as j,b as R,c as A,d as P}from"./chunk-SB25YMEQ.js";import{W as U,_ as T,h as y,x as q,y as f,z as V}from"./chunk-AK3PYTIK.js";import{watch as fe}from"fs";function Le(e){let t=!1,r=!1,i,n=[],s=()=>{r=!0;let o=i;i=void 0,o?.()};for(let o of new Set(e))try{let a=fe(o,{persistent:!1},s);a.on("error",()=>{}),n.push(a)}catch{}return{wait(o){return t||o<=0?(r=!1,Promise.resolve()):new Promise(a=>{let c=setTimeout(()=>{i===d&&(i=void 0),a()},o),d=()=>{clearTimeout(c),i===d&&(i=void 0),a()};i=d,(r||t)&&(r=!1,d())})},close(){if(!t){t=!0;for(let o of n)try{o.close()}catch{}n.length=0}s()}}}import{spawn as qe}from"child_process";import{existsSync as Ce,rmSync as oe}from"fs";import{dirname as nt,resolve as F}from"path";import{fileURLToPath as ot}from"url";import{createHash as me,randomUUID as O}from"crypto";import{existsSync as ve,linkSync as Se,readdirSync as ge,rmSync as m}from"fs";import{basename as ye,dirname as Re,join as u}from"path";var p=1,We=10*6e4,Ie=10080*6e4,k="requests",S="claims",w="completions",B="staging";function Ge(e,t,r={}){let i=r.now?.()??new Date,n=Ee(r.ttlMs),s=be(r.idempotencyKey),o=s?`key-${me("sha256").update(s).digest("hex")}`:`request-${(r.randomId??O)()}`,a={version:p,requestId:o,...s?{idempotencyKey:s}:{},createdAt:i.toISOString(),deadlineAt:new Date(i.getTime()+n).toISOString(),detail:t.trim().slice(0,2048)||"stale index observed by a command"},c=ie(e,o),d=M(e,c,a,r.onStage);if(d.published)return{disposition:"accepted",request:a,achievedDurability:d.achievedDurability,directorySync:d.directorySync};let l=D(c);if(!l)throw new Error(`Watch refresh request identity ${o} exists but is malformed.`);return{disposition:"duplicate",request:l}}function Je(e,t={}){let r=t.now?.()??new Date,i=`claim-${(t.randomId??O)()}`,n=Math.max(1,Math.floor(t.limit??64)),s=ee(e).sort(Ae),o=[];for(let a of s){if(o.length>=n)break;if(z(e,a.requestId))continue;if(Date.parse(a.deadlineAt)<=r.getTime()){Z(e,{version:p,requestId:a.requestId,outcome:"expired",completedAt:r.toISOString()});continue}let c={version:p,requestId:a.requestId,claimId:i,claimedAt:r.toISOString()};if(M(e,ne(e,a.requestId),c).published){if(z(e,a.requestId)){te(e,a.requestId,i);continue}o.push(a)}}return{claimId:i,requests:o}}function Qe(e,t,r=()=>new Date,i){let n=r().toISOString();for(let s of t.requests)Z(e,{version:p,requestId:s.requestId,claimId:t.claimId,outcome:"completed",completedAt:n});i?.("after-completion"),we(e,t),i?.("after-claim-release")}function we(e,t){for(let r of t.requests)te(e,r.requestId,t.claimId)}function Ye(e){let t=0;for(let r of h(u(e,S)))m(r,{force:!0}),t++;return t>0&&f(u(e,S)),re(e),t}function ze(e){let t=ee(e),r=new Map,i=ke(u(e,k),D);for(let c of h(u(e,w))){let d=E(c);if(!d){i++;continue}r.set(d.requestId,d)}let n=new Set;for(let c of h(u(e,S))){let d=X(c);if(!d){i++;continue}n.add(d.requestId)}let s=t.filter(c=>!r.has(c.requestId)&&!n.has(c.requestId)),o=[...r.values()].filter(c=>c.outcome==="completed").length,a=[...r.values()].filter(c=>c.outcome==="expired").length;return{pending:s.length,claimed:t.filter(c=>!r.has(c.requestId)&&n.has(c.requestId)).length,completed:o,expired:a,invalid:i,...s.length>0?{oldestPendingAt:s.map(c=>c.createdAt).reduce((c,d)=>Pe(c,d))}:{}}}function Be(e,t={}){let r=(t.now?.()??new Date).getTime(),i=Math.max(0,t.retentionMs??Ie),n=0;for(let s of h(u(e,w))){let o=E(s);!o||r-Date.parse(o.completedAt)<i||(m(s,{force:!0}),m(ie(e,o.requestId),{force:!0}),n++)}return n>0&&(f(u(e,w)),f(u(e,k))),re(e),n}function D(e){return L(e,t=>{let r=t;return r.version===p&&g(r.requestId)&&(r.idempotencyKey===void 0||typeof r.idempotencyKey=="string")&&v(r.createdAt)&&v(r.deadlineAt)&&Date.parse(r.deadlineAt)>=Date.parse(r.createdAt)&&typeof r.detail=="string"&&r.detail.length>0})}function X(e){return L(e,t=>{let r=t;return r.version===p&&g(r.requestId)&&g(r.claimId)&&v(r.claimedAt)})}function E(e){return L(e,t=>{let r=t;return r.version===p&&g(r.requestId)&&(r.claimId===void 0||g(r.claimId))&&(r.outcome==="completed"||r.outcome==="expired")&&v(r.completedAt)})}function Z(e,t){let r=se(e,t.requestId);if(M(e,r,t).published)return;let i=E(r);if(!i||i.requestId!==t.requestId||i.outcome!==t.outcome)throw new Error(`Watch refresh completion ${t.requestId} conflicts with an existing record.`)}function M(e,t,r,i){let n=u(e,B),s=Re(t),o=q(n),a=q(s),c=u(n,`${ye(t)}.${process.pid}.${O()}.tmp`);try{let d=W(c,r,{spacing:2,trailingNewline:!0});i?.("after-staged");try{Se(c,t)}catch(H){if(H.code==="EEXIST")return{published:!1};throw H}let l=V(o,a,d.directorySync,f(s));return i?.("after-published"),{published:!0,achievedDurability:l==="synced"?"directory-durable":"file-flushed",directorySync:l}}finally{m(c,{force:!0})}}function ee(e){let t=[];for(let r of h(u(e,k))){let i=D(r);i&&t.push(i)}return t}function te(e,t,r){let i=ne(e,t),n=X(i);!n||n.claimId!==r||(m(i,{force:!0}),f(u(e,S)))}function re(e){for(let t of h(u(e,B),".tmp"))m(t,{force:!0})}function ke(e,t){return h(e).filter(r=>!t(r)).length}function h(e,t=".json"){return ve(e)?ge(e,{withFileTypes:!0}).filter(r=>r.isFile()&&r.name.endsWith(t)).map(r=>u(e,r.name)).sort():[]}function L(e,t){try{let r=JSON.parse(y(e,"watch refresh request record"));return t(r)?r:null}catch{return null}}function ie(e,t){return u(e,k,`${t}.json`)}function ne(e,t){return u(e,S,`${t}.json`)}function se(e,t){return u(e,w,`${t}.json`)}function z(e,t){return E(se(e,t))!==null}function Ee(e){if(e===void 0)return We;if(!Number.isFinite(e)||e<=0)throw new Error("Watch refresh request ttlMs must be positive.");return Math.floor(e)}function be(e){let t=e?.trim();return t?t.slice(0,512):void 0}function g(e){return typeof e=="string"&&/^[a-z0-9][a-z0-9-]{0,127}$/i.test(e)}function Ae(e,t){return Date.parse(e.createdAt)-Date.parse(t.createdAt)||e.requestId.localeCompare(t.requestId)}function Pe(e,t){return Date.parse(t)<Date.parse(e)?t:e}var Te=6e3,_e=1e3,ce=10;function mt(e,t,r){let i=T(F(e));if(r&&T(r.projectRoot)===i)return{projectRoot:i,worktreeKind:"git",worktreeId:r.worktreeId,cliVersion:t};let n=U(i);if(n.kind==="error")throw new Error(`Could not establish Git worktree identity for ${i}: ${n.message}`);return n.kind==="non-git"?{projectRoot:i,worktreeKind:"non-git",cliVersion:t}:{projectRoot:i,worktreeKind:"git",worktreeId:n.identity.worktreeId,cliVersion:t}}function vt(e){let t=e.runtime??De,r=Q(e.cacheDir),i=Y(r.statePath),n=i?de(i,t)?{kind:"live",state:i}:{kind:"stale",state:i,reason:"dead-process"}:{kind:"stopped"},s=xe("stop",n);if(s.kind==="signal-stop")return ae(s.state,e,t),N(r,s.state.pid,t),{disposition:"stopped",pid:s.state.pid};if(s.kind==="clean-stale")return N(r,s.state.pid,t),{disposition:"stopped",pid:s.state.pid};let o=le(r.lockPath);return s.kind==="already-stopped"&&o?(de(o,t)&&ae(o,e,t),N(r,o.pid,t),{disposition:"stopped",pid:o.pid}):{disposition:"already-stopped"}}function St(e,t,r={}){let{durability:i="durable",...n}=r;i==="durable"?W(e,t,n):J(e,t,n)}function gt(e){try{let t=JSON.parse(y(e,"watch activity record"));return t.version!==1||!I(t.at)||t.refreshRequestedAt!==void 0&&!I(t.refreshRequestedAt)||t.refreshDetail!==void 0&&typeof t.refreshDetail!="string"?null:{atMs:Date.parse(t.at),...t.refreshRequestedAt===void 0?{}:{refreshRequestedAtMs:Date.parse(t.refreshRequestedAt)},...t.refreshDetail===void 0?{}:{refreshDetail:t.refreshDetail}}}catch{return null}}function yt(e,t,r={}){let i=r.pid??process.pid,n=r.isProcessAlive??C,s=()=>{},o=r.readProcessIdentity??A,a=r.now??(()=>new Date),c={..._,wallNow:()=>a().getTime(),isProcessAlive:n,readProcessIdentity:o},d=K(e,{kind:"watch",pid:i,processIdentity:o(i),detail:{projectRoot:F(t)},parseLegacy:b,runtime:c});if(d.kind==="contended"){let l=pe(d.observation);return{acquired:!1,lockPath:e,message:Oe(e,t,l),release:s}}return{acquired:!0,lockPath:e,message:"",release:()=>{d.lock.release()}}}function le(e){return pe(x(e,{parseLegacy:b}))}var b=e=>{let t=he(e);return t?{pid:t.pid,...t.processIdentity?{processIdentity:t.processIdentity}:{}}:null};function pe(e){if(e.state==="valid"&&e.record?.kind==="watch"){let t=e.record.detail?.projectRoot;return typeof t!="string"?null:{version:1,pid:e.record.pid,...e.record.processIdentity?{processIdentity:e.record.processIdentity}:{},projectRoot:t,startedAt:e.record.startedAt}}return he(e.parsed)}function he(e){try{let t=e;if(t.version!==1||typeof t.pid!="number"||!Number.isInteger(t.pid)||t.pid<=0||typeof t.projectRoot!="string"||!I(t.startedAt))return null;let r=t.processIdentity===void 0?null:j(t.processIdentity);return t.processIdentity!==void 0&&(!r||r.pid!==t.pid)?null:{version:1,pid:t.pid,...r?{processIdentity:r}:{},projectRoot:t.projectRoot,startedAt:t.startedAt}}catch{return null}}function xe(e,t){switch(e){case"status":return{kind:"report",classification:t};case"ensure":switch(t.kind){case"stopped":return{kind:"start"};case"stale":return t.reason==="old-heartbeat"?{kind:"refuse-replace",state:t.state,reason:"old-heartbeat"}:{kind:"start"};case"live":return{kind:"reuse",state:t.state};case"incompatible":return{kind:"replace",state:t.state};default:return $(t)}case"stop":switch(t.kind){case"stopped":return{kind:"already-stopped"};case"stale":return t.reason==="old-heartbeat"?{kind:"signal-stop",state:t.state}:{kind:"clean-stale",state:t.state};case"live":case"incompatible":return{kind:"signal-stop",state:t.state};default:return $(t)}default:return $(e)}}function Rt(e){return e.idleTimeoutMs===0||e.watcher.state!=="idle"?!1:e.nowMs-e.lastActivityAtMs>=e.idleTimeoutMs}function ae(e,t,r){let{pid:i}=e;if(!r.isProcessAlive(i))return;ue(e,r),r.signalProcess(i);let n=t.stopTimeoutMs??Te,s=r.monotonicNow??P,o=s()+n;for(;s()<=o;){if(!r.isProcessAlive(i))return;r.sleep(ce)}if(!r.forceSignalProcess)throw new Error(`scip-query watch service pid ${i} did not stop within ${n}ms and forced termination is unavailable.`);ue(e,r),r.forceSignalProcess(i);let a=t.forceStopTimeoutMs??_e,c=s()+a;for(;s()<=c;){if(!r.isProcessAlive(i))return;let d=r.readProcessIdentity(i);if(e.processIdentity&&d&&!R(e.processIdentity,d))return;r.sleep(ce)}throw new Error(`scip-query watch service pid ${i} remained alive ${a}ms after forced termination.`)}function N(e,t,r){if(oe(e.statePath,{force:!0}),oe(e.activityPath,{force:!0}),le(e.lockPath)?.pid===t){let n={..._,wallNow:r.now,isProcessAlive:r.isProcessAlive,readProcessIdentity:r.readProcessIdentity},s=x(e.lockPath,{parseLegacy:b,runtime:n});G(e.lockPath,s,{parseLegacy:b,runtime:n})}}function de(e,t){if(!t.isProcessAlive(e.pid))return!1;if(!e.processIdentity)return!0;let r=t.readProcessIdentity(e.pid);return r===null||R(e.processIdentity,r)}function Oe(e,t,r){return`error: scip-query watch is already running for ${F(t)}${r?` (pid ${r.pid}, started ${r.startedAt}; lock: ${e})`:` (lock: ${e})`}. Stop that watcher before starting another.`}var De={now:Date.now,monotonicNow:P,isProcessAlive:C,readProcessIdentity:A,spawnServer(e,t,r,i){if(!Ce(e))throw new Error(`Watch service helper was not found at ${e}. Run npm run build first.`);qe(process.execPath,[e,t,r,JSON.stringify(i)],{detached:!0,stdio:"ignore",env:{...process.env,SCIP_QUERY_SKIP_WATCH_SERVICE:"1"}}).unref()},signalProcess(e){process.kill(e,"SIGTERM")},forceSignalProcess(e){process.kill(e,"SIGKILL")},sleep(e){let t=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(t,0,0,e)}};function ue(e,t){if(!e.processIdentity)throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its ownership record has no process identity.`);let r=t.readProcessIdentity(e.pid);if(!r)throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its process identity is unavailable.`);if(!R(e.processIdentity,r))throw new Error(`Refusing to signal scip-query watch pid ${e.pid}: its process identity does not match the ownership record.`)}function $(e){throw new Error(`Unhandled watch service value: ${JSON.stringify(e)}`)}export{Le as a,Ge as b,Je as c,Qe as d,we as e,Ye as f,ze as g,Be as h,mt as i,vt as j,St as k,gt as l,yt as m,Rt as n};
|
|
2
|
-
//# sourceMappingURL=chunk-AUY5BL74.js.map
|
package/dist/chunk-BDHFVH2M.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import{a as G}from"./chunk-QOKYJ33H.js";import{a as O,c as z}from"./chunk-PLYUVM4F.js";import{h as $}from"./chunk-PBUH2P5S.js";import{d as k,g as C,i as j}from"./chunk-TD7VKJ2Y.js";import{C as A}from"./chunk-7JYHQAH2.js";import{Y as R,f as N,xa as _}from"./chunk-GH5YSGZL.js";import{execFileSync as g}from"child_process";import{existsSync as ne}from"fs";import{basename as W}from"path";var ie="Unable to compute git diff.",se={semanticConsumers:$,sourceFallbackConsumers:O},I={resolveCommit:R,readBatch({projectRoot:e,resolvedBase:i,relativePaths:t}){let n=t.map(a=>`${i}:./${a}
|
|
2
|
-
`).join("");return g("git",["cat-file","--batch"],{cwd:e,input:n,maxBuffer:256*1024*1024,timeout:1e4,stdio:["pipe","pipe","ignore"]})}};function Ze(e,i={}){let t=i.plan??ae(e,i);return t.note?ce(t.note,t.changedFileLines):t.changedFiles.length===0?le(t.changedFileLines):oe(t.changedFiles,[re(e,t.changedFiles,t.changedFiles,t.changedRanges)])}function ae(e,i={}){let{base:t="HEAD"}=i;try{let n=R(e.config.projectRoot,t),a=de(e.config.projectRoot,n),s=a.changedFileLines,r=be(e,s),o=ye(e,a.changedRanges);return{changedFileLines:s,changedFiles:r,changedRanges:o,renamedFiles:ge(e.config.projectRoot,n,r,a),note:s.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],changedRanges:[],renamedFiles:[],note:ie}}}function re(e,i,t,n=[],a={}){let s=a.evidenceRuntime??se,r=new z(e),o=new Set(t),l=G(n),u=[],d=new Map,c=i.flatMap(f=>r.definitionsForFile(f)).filter(Ne),m=c.filter(f=>Ce(f,l)),p=ve(e,c,m,l),b=Ie([...m,...p.definitions]).sort((f,h)=>f.relativePath.localeCompare(h.relativePath)||f.startLine-h.startLine),B=b.map(f=>f.symbolId),w=Pe(e,B),ee=Ee(e,B,t),y=b.filter(f=>(w.get(f.symbolId)??0)===0),M=H("semantic-consumers",y.length,()=>s.semanticConsumers(e,y)),P=M.values,E=y.filter(f=>(P.get(f.symbolId)?.size??0)===0),T=H("source-fallback-consumers",E.length,()=>s.sourceFallbackConsumers(e,E)),te=T.values;for(let f of b)Be(e,f,o,u,d,P.get(f.symbolId)??new Set,te.get(f.symbolId)??new Set,w.get(f.symbolId)??0,ee.get(f.symbolId)??new Set);return{changedSymbols:u,consumerEntries:[...d.entries()].map(([f,h])=>({file:f,symbols:[...h].sort()})),attributionNotes:p.notes,evidenceTiers:[M.status,T.status]}}function oe(e,i){let t=new Map,n=i.flatMap(o=>o.changedSymbols),a=i.flatMap(o=>o.attributionNotes??[]),s=we(i);for(let o of i)for(let l of o.consumerEntries){let u=t.get(l.file);u||(u=new Set,t.set(l.file,u));for(let d of l.symbols)u.add(d)}let r=Te(t);return{changedFiles:[...e],changedSymbols:n,affectedConsumers:r,attributionNotes:a,evidenceTiers:s,summary:{totalChangedFiles:e.length,totalChangedSymbols:n.length,totalAffectedFiles:r.length}}}function ce(e,i=[]){return{changedFiles:i,changedSymbols:[],affectedConsumers:[],attributionNotes:[],evidenceTiers:X(),summary:{totalChangedFiles:i.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function le(e){return{changedFiles:e,changedSymbols:[],affectedConsumers:[],attributionNotes:[],evidenceTiers:X(),summary:{totalChangedFiles:e.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}}}function de(e,i){let t=g("git",["diff","--name-status","--find-renames",i,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:67108864}),n=g("git",["diff","--name-status","--find-renames","--cached",i,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),a=g("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),s=g("git",["diff","--unified=0",i,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),r=g("git",["diff","--unified=0","--cached",i,"--"],{encoding:"utf-8",cwd:e,timeout:3e4,maxBuffer:64*1024*1024}),o=pe([t,n]);return{changedFileLines:[...new Set([...o.changedFiles,...V(a)])],changedRanges:K([...q(s),...q(r)]),renamedFiles:o.renamedFiles,deletedFiles:o.deletedFiles}}function ue(e,i,t){let n=typeof e=="string"?{projectRoot:e,base:i,relativePath:t}:e;if(typeof n.projectRoot!="string"||typeof n.base!="string"||typeof n.relativePath!="string")throw new TypeError("fileContentAtBase requires projectRoot, base, and relativePath.");let a={projectRoot:n.projectRoot,base:n.base,relativePath:n.relativePath},{relativePath:s}=a,r=J(a);if(r.state==="unavailable")throw new Error(`Base content unavailable for ${s}: ${r.reason}`);return r.state==="present"?r.content:null}function J(e,i=I){return Z(e.relativePath),F({projectRoot:e.projectRoot,base:e.base,relativePaths:[e.relativePath]},i).get(e.relativePath)??{state:"unavailable",reason:`Base-content lookup omitted ${e.relativePath}.`}}function F(e,i=I){for(let r of e.relativePaths)Z(r);let t=[...new Set(e.relativePaths)];if(t.length===0)return new Map;let n;try{n=i.resolveCommit(e.projectRoot,e.base)}catch(r){return S(t,v(r))}let a;try{a=i.readBatch({projectRoot:e.projectRoot,resolvedBase:n,relativePaths:t})}catch(r){return S(t,v(r))}let s;try{s=me(a,t)}catch(r){return S(t,`Malformed git cat-file batch output: ${v(r)}`)}return new Map(t.map(r=>{let o=s.get(r)??null;return[r,o===null?{state:"absent"}:{state:"present",content:o}]}))}function fe(e,i=I){let t=F({projectRoot:e.projectRoot,base:e.base,relativePaths:e.preloadPaths??[]},i);return n=>(t.has(n)||t.set(n,J({projectRoot:e.projectRoot,base:e.base,relativePath:n},i)),t.get(n)??{state:"unavailable",reason:`Base-content reader omitted ${n}.`})}function Ve(e,i,t=[]){let n=typeof e=="string"?{projectRoot:e,base:i,preloadPaths:t}:e;if(typeof n.projectRoot!="string"||typeof n.base!="string")throw new TypeError("createBaseContentReader requires projectRoot and base.");let a={projectRoot:n.projectRoot,base:n.base,preloadPaths:n.preloadPaths},s=fe(a);return r=>{let o=s(r);if(o.state==="unavailable")throw new Error(`Base content unavailable for ${r}: ${o.reason}`);return o.state==="present"?o.content:null}}function Ye(e,i=e.changedFiles){let t=new Map(e.renamedFiles.map(n=>[n.to,n.from]));return[...new Set(i.map(n=>t.get(n)??n))]}function Ke(e,i,t){let n=typeof e=="string"?{projectRoot:e,base:i,relativePaths:t}:e;if(typeof n.projectRoot!="string"||typeof n.base!="string"||!Array.isArray(n.relativePaths))throw new TypeError("fileContentsAtBase requires projectRoot, base, and relativePaths.");let a=F(n),s=new Map;for(let[r,o]of a){if(o.state==="unavailable")throw new Error(`Base content unavailable for ${r}: ${o.reason}`);s.set(r,o.state==="present"?o.content:null)}return s}function Z(e){N(e)}function S(e,i){return new Map(e.map(t=>[t,{state:"unavailable",reason:i}]))}function v(e){let t=(e instanceof Error?e.message:String(e)).replaceAll(/\s+/g," ").trim().slice(0,500);return t===""?"Git base-content lookup failed without a reason.":t}function me(e,i){let t=new Map,n=0;for(let a of i){let s=e.indexOf(10,n);if(s<0)throw new Error("git cat-file batch output ended before object header");let r=e.subarray(n,s).toString("utf-8");if(n=s+1,r.endsWith(" missing")){t.set(a,null);continue}let o=/^[0-9a-f]+ ([^ ]+) (\d+)$/.exec(r);if(!o)throw new Error(`unexpected git cat-file batch header: ${r}`);let[,l,u]=o,d=Number(u);if(!Number.isFinite(d)||d<0)throw new Error(`unexpected git cat-file batch size: ${r}`);if(n+d>e.length)throw new Error("git cat-file batch output ended before blob payload");let c=e.subarray(n,n+d);t.set(a,l==="blob"?c.toString("utf-8"):null),n+=d,e[n]===10&&(n+=1)}return t}function ge(e,i,t,n){if(t.length===0)return[];let a=new Map,s=new Set;for(let o of n.renamedFiles)t.includes(o.to)&&(a.set(o.to,o),s.add(o.from));let r=n.deletedFiles;if(r.length===0)return[...a.values()].sort((o,l)=>o.to.localeCompare(l.to));for(let o of t){if(a.has(o)||!ne(`${e}/${o}`))continue;let l=r.filter(c=>!s.has(c)).filter(c=>W(c)===W(o));if(l.length===0)continue;let u=_(e,o),d=l.map(c=>({from:c,to:o,similarity:he(ue({projectRoot:e,base:i,relativePath:c})??"",u)})).sort((c,m)=>m.similarity-c.similarity)[0];d&&d.similarity>=.45&&(a.set(o,d),s.add(d.from))}return[...a.values()].sort((o,l)=>o.to.localeCompare(l.to))}function pe(e){let i=new Set,t=new Map,n=new Set;for(let a of e.flatMap(s=>V(s))){let[s,r,o]=a.split(" ");if(!(!s||!r)){if(s.startsWith("R")&&o){i.add(o),t.set(o,{from:r,to:o,similarity:Number(s.slice(1))/100});continue}i.add(r),s.startsWith("D")&&n.add(r)}}return{changedFiles:[...i],renamedFiles:[...t.values()],deletedFiles:[...n]}}function he(e,i){let t=new Set(U(e)),n=new Set(U(i));if(t.size===0&&n.size===0)return 1;if(t.size===0||n.size===0)return 0;let a=0;for(let s of t)n.has(s)&&(a+=1);return 2*a/(t.size+n.size)}function U(e){return e.match(/[A-Za-z_$][\w$]*|[{}()[\].,]/g)??[]}function V(e){return e.split(`
|
|
3
|
-
`).map(i=>i.trim()).filter(i=>i.length>0)}function be(e,i){let t=Y(e),n=[];for(let a of i){let s=t(a);s&&!e.isIgnored(s)&&n.push(s)}return n}function ye(e,i){let t=Y(e),n=[];for(let a of i){let s=t(a.file);s&&!e.isIgnored(s)&&n.push({...a,file:s})}return K(n)}function Y(e){let i=e.all(`SELECT relative_path FROM documents
|
|
4
|
-
ORDER BY id`).map(n=>n.relative_path),t=new Map(i.map(n=>[n,n]));return n=>{let a=n.replace(/\\/g,"/"),s=t.get(a);return s||(i.find(r=>r.endsWith(a))??null)}}function q(e){let i=[],t=null;for(let n of e.split(`
|
|
5
|
-
`)){if(n.startsWith("+++ ")){t=Re(n.slice(4).trim());continue}if(!t||!n.startsWith("@@ "))continue;let a=/@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/.exec(n);if(!a)continue;let s=Math.max(0,Number(a[1])-1),r=a[2]===void 0?1:Number(a[2]);i.push({file:t,startLine:s,endLine:Math.max(s,s+Math.max(r,1)-1)})}return i}function Re(e){return e==="/dev/null"?null:e.startsWith("a/")||e.startsWith("b/")?e.slice(2):e}function K(e){let i=new Set,t=[];for(let n of e){let a=`${n.file}:${n.startLine}:${n.endLine}`;i.has(a)||(i.add(a),t.push(n))}return t}function Ce(e,i){let t=i.get(e.relativePath);return!t||t.length===0?!0:t.some(n=>x(e.startLine,e.endLine,n.startLine,n.endLine))}function Se(e,i,t){let n=new Map,a=[],s=Q(e),r=Fe(t);for(let o of i){let l=s.get(o.file)??[];if(l.some(c=>x(c.startLine,c.endLine,o.startLine,o.endLine)))continue;let u=r.get(o.file)??[],d=xe(u,o);if(d){let c=l.find(m=>m.startLine>=d.startLine&&m.startLine<=d.endLine);if(c){n.set(c.symbolId,c),a.push(D(o,"ast-widened"));continue}}if(u.length===0){let c=[...l].filter(m=>m.startLine<=o.startLine).sort((m,p)=>p.startLine-m.startLine||m.endLine-p.endLine)[0];if(c){n.set(c.symbolId,c),a.push(D(o,"nearest-preceding"));continue}}a.push(D(o,"unattributed"))}return{definitions:[...n.values()],notes:a}}function ve(e,i,t,n){let a=Q(t),s=[],r=[],o=[...new Set(i.map(l=>l.relativePath))];for(let l of o){let u=n.get(l)??[];if(u.length===0)continue;let d=a.get(l)??[];for(let c of u)d.some(m=>x(m.startLine,m.endLine,c.startLine,c.endLine))||s.push(c);s.some(c=>c.file===l)&&r.push(...De(e,l))}return Se(i,s,r)}function De(e,i){let t=A(e,i);return t?t.rootNode.namedChildren.filter(Le).map(n=>({file:i,startLine:n.startPosition.row,endLine:n.endPosition.row})).filter(n=>n.endLine>=n.startLine):[]}function Le(e){return e.endPosition.row<e.startPosition.row?!1:!new Set(["import_statement","comment"]).has(e.type)}function Ie(e){let i=new Map;for(let t of e)i.set(t.symbolId,t);return[...i.values()]}function Q(e){let i=new Map;for(let t of e){let n=i.get(t.relativePath)??[];n.push(t),i.set(t.relativePath,n)}return i}function Fe(e){let i=new Map;for(let t of e){let n=i.get(t.file)??[];n.push(t),i.set(t.file,n)}return i}function xe(e,i){return e.filter(t=>t.startLine<=i.startLine&&t.endLine>=i.endLine).sort((t,n)=>t.endLine-t.startLine-(n.endLine-n.startLine))[0]}function D(e,i){return{file:e.file,startLine:e.startLine,endLine:e.endLine,method:i}}function x(e,i,t,n){return e<=n&&t<=i}function Be(e,i,t,n,a,s,r,o,l){let u=Math.max(o,s.size,r.size);if(!_e(i,u))return;let d=k(i.symbol);n.push({symbol:i.symbol,shortName:d,file:i.relativePath,startLine:i.startLine,endLine:i.endLine,fanIn:u});for(let c of l)L(e,t,a,c,d);for(let c of s)L(e,t,a,c,d);for(let c of r)L(e,t,a,c,d)}function H(e,i,t){try{return{values:t(),status:{tier:e,state:"complete",attemptedSymbols:i}}}catch(n){return{values:new Map,status:{tier:e,state:"failed",attemptedSymbols:i,reason:Me(n)}}}}function we(e){return["semantic-consumers","source-fallback-consumers"].map(i=>{let t=e.map(s=>s.evidenceTiers?.find(r=>r.tier===i)??{tier:i,state:"failed",attemptedSymbols:0,reason:"isolated diff-impact batch omitted its evidence-tier status"}),n=t.reduce((s,r)=>s+r.attemptedSymbols,0),a=[...new Set(t.filter(s=>s.state==="failed").map(s=>s.reason))];return a.length===0?{tier:i,state:"complete",attemptedSymbols:n}:{tier:i,state:"failed",attemptedSymbols:n,reason:a.join("; ").slice(0,500)}})}function X(){return[{tier:"semantic-consumers",state:"complete",attemptedSymbols:0},{tier:"source-fallback-consumers",state:"complete",attemptedSymbols:0}]}function Me(e){let t=(e instanceof Error?e.message:String(e)).replaceAll(/\s+/g," ").trim().slice(0,500);return t===""?"evidence provider failed without a reason":t}function Pe(e,i){if(i.length===0)return new Map;let t=e.all(`SELECT m.symbol_id, COUNT(DISTINCT c.document_id) AS fan_in
|
|
6
|
-
FROM mentions m
|
|
7
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
8
|
-
WHERE m.symbol_id IN (${i.map(()=>"?").join(",")})
|
|
9
|
-
AND m.role != 1
|
|
10
|
-
GROUP BY m.symbol_id`,...i);return new Map(t.map(n=>[n.symbol_id,n.fan_in]))}function Ee(e,i,t){if(i.length===0||t.length===0)return new Map;let n=e.all(`SELECT DISTINCT m.symbol_id, ref_d.relative_path
|
|
11
|
-
FROM mentions m
|
|
12
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
13
|
-
JOIN documents ref_d ON c.document_id = ref_d.id
|
|
14
|
-
WHERE m.symbol_id IN (${i.map(()=>"?").join(",")})
|
|
15
|
-
AND m.role != 1
|
|
16
|
-
AND ref_d.relative_path NOT IN (${t.map(()=>"?").join(",")})
|
|
17
|
-
${e.pathExclusionsFor("ref_d")}`,...i,...t),a=new Map;for(let s of n){let r=a.get(s.symbol_id);r||(r=new Set,a.set(s.symbol_id,r)),r.add(s.relative_path)}return a}function L(e,i,t,n,a){if(e.isIgnored(n)||i.has(n))return;let s=t.get(n);s||(s=new Set,t.set(n,s)),s.add(a)}function Te(e){return[...e.entries()].map(([i,t])=>({file:i,consumedSymbols:t.size})).sort((i,t)=>t.consumedSymbols-i.consumedSymbols)}function Ne(e){return!(j(e.symbol)||e.parentTypeName!==null&&!C(e.symbol))}function _e(e,i){return C(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&i>0}export{ie as a,Ze as b,ae as c,re as d,oe as e,ue as f,J as g,F as h,fe as i,Ve as j,Ye as k,Ke as l,Se as m};
|
|
18
|
-
//# sourceMappingURL=chunk-BDHFVH2M.js.map
|
package/dist/chunk-BECZLYNU.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{b as p}from"./chunk-Q6T2CAJL.js";import{a as T}from"./chunk-DHEQMPLW.js";import{b as N}from"./chunk-4GAQ6FI4.js";import{a as A,e as h,t as D}from"./chunk-TD7VKJ2Y.js";import{w as O}from"./chunk-42W3LFUK.js";import{a as m}from"./chunk-7JYHQAH2.js";import{E as j,d as u}from"./chunk-Q7GBK5T7.js";import{c as l,xa as S,ya as w,za as _}from"./chunk-GH5YSGZL.js";import{existsSync as b,readdirSync as M}from"fs";import{join as d}from"path";var it={files:new Set,pathPrefixes:[]},at={reasonsByFile:new Map},P=/^(?:dist|build|lib|out|output|esm|cjs|umd)\//,ot=/\.(?:d\.ts|d\.mts|d\.cts|ts|tsx|mts|cts|js|jsx|mjs|cjs)$/,C=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs"],ct=new Set([".git",".next",".turbo","build","coverage","dist","node_modules","out"]),ut=4,ft=u("package-surface",{clearGroups:["whole-project"]}),lt=u("package-operational-surface",{clearGroups:["whole-project"]});function $(t){return ft.get(t,()=>pt(t.config.projectRoot))}function x(t,e){let n=$(t);return n.files.has(e)?!0:n.pathPrefixes.some(r=>e.startsWith(r))}function I(t,e){return $(t).files.has(e)}function gt(t){return lt.get(t,()=>dt(t.config.projectRoot))}function ce(t,e){return gt(t).reasonsByFile.get(e)??[]}function pt(t){let e=new Set,n=[];for(let{manifest:r,packageRoot:s}of L(t))for(let i of St(r))U(t,s,i,e,n);return e.size===0&&n.length===0?it:{files:e,pathPrefixes:n}}function dt(t){let e=new Map;for(let{manifest:n,packageRoot:r}of L(t)){let s=mt(n);for(let a of s)v(t,r,a,"package binary",e);let i=n.scripts;if(!(!i||typeof i!="object")){for(let[a,o]of Object.entries(i))if(typeof o=="string")for(let c of ht(o))v(t,r,c,`package script "${a}"`,e)}}return e.size===0?at:{reasonsByFile:e}}function L(t){let e=[],n=X(t,"");return n&&e.push({manifest:n,packageRoot:""}),V(t,"",e,0),e}function V(t,e,n,r){if(r>=ut)return;let s=d(t,e);if(b(s))for(let i of M(s,{withFileTypes:!0})){if(!i.isDirectory()||ct.has(i.name))continue;let a=e?`${e}/${i.name}`:i.name,o=X(t,a);o&&n.push({manifest:o,packageRoot:a}),V(t,a,n,r+1)}}function X(t,e){let n;try{n=S(t,d(e,"package.json"),{maxBytes:8*1024*1024,inputKind:"package manifest"})}catch(r){if(!w(r))throw r;return null}try{let r=JSON.parse(n);return r&&typeof r=="object"?r:null}catch{return null}}function St(t){let e=[];for(let r of["main","module","types","browser"])typeof t[r]=="string"&&e.push(t[r]);let n=t.bin;if(typeof n=="string")e.push(n);else if(n&&typeof n=="object")for(let r of Object.values(n))typeof r=="string"&&e.push(r);return B(t.exports,e),e}function mt(t){let e=t.bin;return typeof e=="string"?[e]:!e||typeof e!="object"?[]:Object.values(e).filter(n=>typeof n=="string")}function ht(t){let e=[],n=/(?:^|&&|\|\||;)\s*(?:(?:cross-env|env)(?:\s+[A-Za-z_][A-Za-z0-9_]*=\S+)*\s+)?(?:node|bun|tsx|ts-node|vite-node|python3?|deno\s+run)\s+(?:(?:--?[A-Za-z0-9-]+(?:=\S+)?)\s+)*["']?([^"'`\s]+\.(?:ts|tsx|mts|cts|js|jsx|mjs|cjs|py))["']?/g;for(let r of t.matchAll(n)){let s=r[1];s&&!s.startsWith("node_modules/")&&!s.startsWith("./node_modules/")&&e.push(s)}return e}function v(t,e,n,r,s){let i=new Set;U(t,e,n,i,[]);for(let a of i){let o=s.get(a)??[];o.includes(r)||o.push(r),s.set(a,o)}}function B(t,e){if(typeof t=="string"){e.push(t);return}if(!(!t||typeof t!="object"))for(let n of Object.values(t))B(n,e)}function U(t,e,n,r,s){let i=n.replace(/\\/g,"/").replace(/^\.\//,"");if(i===""||i.startsWith(".."))return;let a=i.indexOf("*");if(a>=0){let c=i.slice(0,a);for(let g of F(c))g!==""&&s.push(f(e,g));return}let o=i.replace(ot,"");for(let c of F(o)){c===o&&c===i&&r.add(f(e,i));for(let g of C)bt(t,r,e,c+g)}r.add(f(e,i))}function F(t){let e=[t];return P.test(t)&&(e.push(t.replace(P,"src/")),e.push(t.replace(P,""))),e}function bt(t,e,n,r){let s=f(n,r);if(e.add(s),!r.startsWith("src/")||b(d(t,s)))return;let i=C.find(y=>r.endsWith(y));if(!i)return;let a=r.slice(0,-i.length);yt(t,e,n,a,i);let o=a.lastIndexOf("/");if(o<=4)return;let c=a.slice(0,o),g=a.slice(o+1);for(let y of G(t,n,c,`${g}${i}`))e.add(y)}function yt(t,e,n,r,s){let i=f(n,`${r}/index${s}`);b(d(t,i))&&e.add(i)}function G(t,e,n,r){let s=d(t,e,n);if(!b(s))return[];let i=[];for(let a of M(s,{withFileTypes:!0})){let o=`${n}/${a.name}`;a.isDirectory()?i.push(...G(t,e,o,r)):a.isFile()&&a.name===r&&i.push(f(e,o))}return i}function f(t,e){return t?`${t}/${e}`:e}import{existsSync as E,readdirSync as Pt}from"fs";import{dirname as xt,join as k}from"path";var Et={rootFiles:new Set,sourcePrefixes:[]},kt=new Set([".git",".scipquery","node_modules","target"]),Rt=6,Tt=u("rust-library-surface",{clearGroups:["whole-project"]});function W(t,e,n){if(!n.endsWith(".rs")||!jt(wt(t),n))return!1;let r=D(t,n).find(s=>s.symbol===e);return r?Ot(j(t,n)[r.startLine]??""):!1}function wt(t){return Tt.get(t,()=>_t(t.config.projectRoot))}function _t(t){let e=new Set,n=new Set;for(let r of Nt(t)){let s=S(t,k(r,"Cargo.toml"),{maxBytes:8388608,inputKind:"Cargo manifest"}),i=At(s),a=f(r,"src/lib.rs"),o=i?f(r,i):!Dt(s)&&_(t,a)?a:null;if(!o)continue;e.add(o);let c=xt(o).replaceAll("\\","/");n.add(c==="."?"":`${c}/`)}return e.size===0?Et:{rootFiles:e,sourcePrefixes:[...n].sort()}}function jt(t,e){return e.endsWith(".rs")?t.rootFiles.has(e)?!0:vt(e)?!1:t.sourcePrefixes.some(n=>e.startsWith(n)):!1}function Ot(t){return/^\s*pub\s+(?!\()/.test(t)}function Nt(t){if(!E(t))return[];let e=[];return H(t,"",e,0),e}function H(t,e,n,r){let s=k(t,e);if(E(s)&&(E(k(s,"Cargo.toml"))&&n.push(e),!(r>=Rt)))for(let i of Pt(s,{withFileTypes:!0})){if(!i.isDirectory()||kt.has(i.name))continue;let a=e?`${e}/${i.name}`:i.name;H(t,a,n,r+1)}}function At(t){let e=!1;for(let n of t.split(`
|
|
2
|
-
`)){let r=n.replace(/\s+#.*$/,"").trim(),s=/^\[([^\]]+)\]$/.exec(r);if(s){e=s[1]==="lib";continue}if(!e)continue;let i=/^path\s*=\s*["']([^"']+)["']/.exec(r)?.[1];if(i)return i.replaceAll("\\","/").replace(/^\.\//,"")}return null}function Dt(t){let e=!1;for(let n of t.split(`
|
|
3
|
-
`)){let r=n.replace(/\s+#.*$/,"").trim(),s=/^\[([^\]]+)\]$/.exec(r);if(s){e=s[1]==="package";continue}if(e&&/^autolib\s*=\s*false\b/.test(r))return!0}return!1}function vt(t){return/(?:^|\/)src\/main\.rs$/.test(t)||/(?:^|\/)src\/bin\//.test(t)||/(?:^|\/)(?:examples|tests|benches)\//.test(t)}function Ft(t){return p(t)==="barrel"}function q(t){return Mt.get(t,()=>{let n=m(t,{includeIgnored:!1}).filter(a=>{let o=p(a);return o==="entry"||o==="worker"});if(n.length===0)return new Set;let r=N(t),s=new Set,i=new Set;for(;n.length>0;){let a=n.shift();if(!s.has(a)){s.add(a),p(a)==="barrel"&&i.add(a);for(let o of r.get(a)??[])s.has(o)||n.push(o)}}return i})}var Mt=u("live-barrels",{clearGroups:["whole-project"]});function Ct(t,e){return q(t).has(l(e))}function Ne(t){let e=q(t);return m(t,{includeIgnored:!1}).filter(n=>Ft(n)&&!e.has(n)&&!$t(t,n))}function $t(t,e){let n=l(e),r=A(t).forFile(n,{facts:!0}).facts?.callables;return r&&r.length>0?!0:(t.get(`SELECT COUNT(*) AS n
|
|
4
|
-
FROM defn_enclosing_ranges der
|
|
5
|
-
JOIN documents d ON d.id = der.document_id
|
|
6
|
-
WHERE d.relative_path = ?
|
|
7
|
-
AND der.end_line - der.start_line >= 2`,n)?.n??0)>0}function Ae(t,e){let n=l(e),r=p(e);return r==="entry"||r==="worker"||ee(n)||Ct(t,n)}function It(t,e,n){let r=l(n),s=[];x(t,r)&&s.push("package-surface-file"),Xt(t,e,r)&&s.push("transitive-package-surface"),W(t,e,r)&&s.push("rust-public-library"),te(e,r)&&s.push("framework-entrypoint");let i=t.config.entryRoots;return i&&(i.files?.some(a=>l(a)===r)&&s.push("configured-file"),i.pathPrefixes?.some(a=>r.startsWith(l(a)))&&s.push("configured-path-prefix"),i.qualifiedVars?.some(a=>re(e,a))&&s.push("configured-qualified-var"),i.symbolPatterns?.some(a=>{try{return T(a,"entryRoots.symbolPatterns entry").test(e)}catch{return!1}})&&s.push("configured-symbol-pattern")),s}function De(t,e,n){return It(t,e,n).length>0}var Lt=u("package-surface-reachability",{clearGroups:["whole-project"]}),Vt=u("explicit-package-surface-reachability",{clearGroups:["whole-project"]});function Xt(t,e,n){let r=Bt(t).get(n);return r===void 0?!1:r===null||r.has(h(e))}function ve(t,e,n){let r=Ut(t).get(n);return r===void 0?!1:r===null||r.has(h(e))}function Bt(t){return Lt.get(t,()=>Y(t,e=>x(t,e)))}function Ut(t){return Vt.get(t,()=>Y(t,e=>I(t,e)))}function Y(t,e){let n=new Map,r=[];for(let s of m(t,{includeIgnored:!1}))e(s)&&(n.set(s,null),r.push(s));for(;r.length>0;){let s=r.shift(),i=n.get(s);if(i!==void 0)for(let a of O(t,s)){if(!a.sourcePath||t.isIgnored(a.sourcePath))continue;let o=Gt(i,a);o!==void 0&&Wt(n,a.sourcePath,o)&&r.push(a.sourcePath)}}return n}function Gt(t,e){if(t===null)return e.kind==="named"?new Set(e.names):null;if(e.kind==="star")return new Set(t);if(e.kind==="star-as")return e.names.some(r=>t.has(r))?null:void 0;let n=e.names.filter(r=>t.has(r));return n.length>0?new Set(n):void 0}function Wt(t,e,n){if(!t.has(e))return t.set(e,n),!0;let r=t.get(e);if(r===void 0)return!1;if(r===null||n===null)return r===null?!1:(t.set(e,null),!0);let s=!1;for(let i of n)r.has(i)||(r.add(i),s=!0);return s}var Z=new Set(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"]),Ht=new Set(["default","generateMetadata","generateStaticParams"]),Kt=new Set(["default","getStaticProps","getServerSideProps","getStaticPaths","config"]),qt=new Set(["default","middleware","config"]),Yt=new Set(["register","onRequestError"]),Zt=new Set(["onRouterTransitionStart"]),Jt=new Set(["default","loader","action","clientLoader","clientAction","headers","links","meta","shouldRevalidate","ErrorBoundary","HydrateFallback"]),Qt=new Set(["load","actions","entries",...Z]),zt=new Set(["default"]);function te(t,e){let n=h(t);return n===""?!1:J(e)?Z.has(n):Q(e)?Ht.has(n):z(e)?Kt.has(n):tt(e)?qt.has(n):et(e)?Yt.has(n):nt(e)?Zt.has(n):rt(e)?Jt.has(n):st(e)?Qt.has(n):ne(e)?zt.has(n):!1}function ee(t){return J(t)||Q(t)||z(t)||tt(t)||et(t)||nt(t)||rt(t)||st(t)}function J(t){return/(?:^|\/)app(?:\/[^/]+)*\/route\.(?:ts|tsx|js|jsx|mjs|cjs)$/.test(t)}function Q(t){return/(?:^|\/)app(?:\/[^/]+)*\/(?:page|layout|template|loading|error|not-found|global-error|head|default)\.(?:ts|tsx|js|jsx|mjs|cjs)$/.test(t)}function z(t){return/(?:^|\/)pages\/.+\.(?:ts|tsx|js|jsx|mjs|cjs)$/.test(t)}function tt(t){return R(t,"(?:middleware|proxy)\\.(?:ts|js|mts|mjs)")}function et(t){return R(t,"instrumentation\\.(?:ts|js|mts|mjs)")}function nt(t){return R(t,"instrumentation-client\\.(?:ts|js|mts|mjs)")}function R(t,e){return new RegExp(`^(?:src/)?${e}$`).test(t)||new RegExp(`(?:^|/)src/${e}$`).test(t)||new RegExp(`(?:^|/)(?:apps|services|packages)/[^/]+/(?:src/)?${e}$`).test(t)}function rt(t){return/(?:^|\/)app\/routes\/.+\.(?:ts|tsx|js|jsx|mjs|cjs)$/.test(t)}function st(t){return/(?:^|\/)src\/routes\/(?:.*\/)?\+(?:page|page\.server|layout|layout\.server|server)\.(?:ts|js)$/.test(t)}function ne(t){return/(?:^|\/)src\/(?:pages|views|routes)\/.+\.(?:ts|tsx|js|jsx|vue)$/.test(t)}function re(t,e){let n=e.lastIndexOf("/");if(n<0)return!1;let r=e.slice(0,n),s=e.slice(n+1);return t.includes(K(r)+"/")&&t.includes(K(s)+".")}function K(t){return/^[A-Za-z0-9_$+-]+$/.test(t)?t:"`"+t.replace(/`/g,"``")+"`"}export{x as a,ce as b,Ft as c,Ct as d,Ne as e,Ae as f,It as g,De as h,ve as i,ee as j};
|
|
8
|
-
//# sourceMappingURL=chunk-BECZLYNU.js.map
|
package/dist/chunk-BYDAFMSR.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import{a as Z}from"./chunk-RYOYJMGF.js";import{b as yt}from"./chunk-FELGD32K.js";import{q as gt}from"./chunk-2XCGSDIT.js";import{a as ht}from"./chunk-WRQXLNYE.js";import{c as Se}from"./chunk-BJT7LSPK.js";import{B as dt,C as pt,D as ft,H as mt,I as j,R as _,Y as xe,a as ie,c as ae,g as ot,h as he,i as Me,m as ge,o as ve,p as st,q as be,r as k,s as D,u as M,v as lt,w as X,x as O,y as ut,z as ct}from"./chunk-C7IJMOFP.js";import{c as re}from"./chunk-DKM723YF.js";import{c as Q}from"./chunk-IW5XQG5G.js";function Re(e){let t=e.replaceAll("\\","/");return yt(t)==="test"?/(?:^|\/)__fixtures__\//iu.test(t)?"fixture":"test":/(?:^|\/)(?:fixtures?|testdata)\//iu.test(t)?"fixture":/(?:^|\/)(?:examples?|demos?|previews?)\//iu.test(t)?"example":/(?:^|\/)(?:generated|dist|build|coverage)\//iu.test(t)||/\.generated\./iu.test(t)?"generated":/^(?:scripts?|tools?)\//iu.test(t)?"script":"production"}import{createHash as me}from"crypto";import{setImmediate as jr}from"timers/promises";import{createRequire as Gr}from"module";import{createHash as Tn}from"crypto";var Ce=8;function ee(e,t,n){return je(vt(e,t,Ue(n),0,new Set))}function ze(e,t,n){return He(e,t,n,0,new Set)}function vt(e,t,n,r,i){if(r>Ce)return[];let a=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(n);return a?bt(e,t,a[1],a[2],r,i):/^[A-Za-z_$][\w$]*$/u.test(n)?St(e,t,n,r,i):[]}function bt(e,t,n,r,i,a){let s=[];for(let o of He(e,t,n,i+1,new Set(a))){let l=M(o.initializer);for(let u of l.namedChildren){if(u.type==="pair"){let d=u.childForFieldName("key")??u.namedChild(0);if(vn(d)!==r)continue;let c=u.childForFieldName("value")??u.namedChild(1);c&&s.push(...vt(e,o.definition.relativePath,Ue(c.text),i+1,new Set(a)));continue}if(/(?:method|function)/u.test(u.type)){if((u.childForFieldName("name")??u.namedChild(0))?.text!==r)continue;let c=hn(e,o.definition.relativePath,r,u);s.push(...c.length>0?c:[mn(o.definition,r,u)]);continue}if(u.type==="spread_element"){let d=u.namedChild(0);if(!d)continue;for(let c of He(e,o.definition.relativePath,Ue(d.text),i+1,new Set(a)))s.push(...bt(e,c.definition.relativePath,c.definition.leaf,r,i+1,new Set(a)))}}}return je(s)}function mn(e,t,n){return{documentId:e.documentId,symbolId:-1,symbol:`source-callable:${e.relativePath}:${n.startPosition.row}:${t}`,relativePath:e.relativePath,startLine:n.startPosition.row,startChar:n.startPosition.column,endLine:n.endPosition.row,endChar:n.endPosition.column,leaf:t,parentTypeName:e.leaf,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:e.symbol}}function He(e,t,n,r,i){return r>Ce||!/^[A-Za-z_$][\w$]*$/u.test(n)?[]:St(e,t,n,r,i).flatMap(a=>{let s=O(e,a.relativePath)?.rootNode,o=s?gn(s,a.leaf):null;return o?[{definition:a,initializer:o}]:[]})}function St(e,t,n,r,i){if(r>Ce)return[];let a=`${t}\0${n}`;if(i.has(a))return[];i.add(a);let s=_(e,t).filter(u=>u.leaf===n);if(s.length>0)return s;let o=yn(e,t,n);if(o.length>0)return o;let l=j(e,t).find(u=>u.localName===n&&u.sourcePath);if(l?.sourcePath){let u=l.kind==="namespace"||l.importedName==="default"?n:l.importedName;return Ve(e,l.sourcePath,u,r+1,new Set(i))}return Ve(e,t,n,r+1,new Set(i))}function yn(e,t,n){let r=e.get("SELECT id FROM documents WHERE relative_path = ?",t)?.id;return r===void 0?[]:(dt(e,t)?.callables??[]).filter(i=>i.name===n).map(i=>({documentId:r,symbolId:-1,symbol:`source-callable:${t}:${i.startLine}:${n}`,relativePath:t,startLine:i.startLine,startChar:0,endLine:i.endLine,endChar:0,leaf:n,parentTypeName:null,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null}))}function Ve(e,t,n,r,i){if(r>Ce)return[];let a=_(e,t).filter(s=>s.leaf===n);return a.length>0?a:je(mt(e,t).flatMap(s=>s.sourcePath?s.kind==="named"&&!s.names.includes(n)?[]:Ve(e,s.sourcePath,n,r+1,new Set(i)):[]))}function hn(e,t,n,r){return _(e,t).filter(i=>i.leaf===n&&i.startLine<=r.startPosition.row&&i.endLine>=r.endPosition.row)}function gn(e,t){let n=null;return k(e,r=>{n||r.type!=="variable_declarator"||(r.childForFieldName("name")??r.namedChild(0))?.text.trim()!==t||(n=r.childForFieldName("value")??r.namedChild(1))}),n}function vn(e){return e?.text.replace(/^['"`]|['"`]$/gu,"")??null}function Ue(e){return e.replace(/\s+/gu,"").replace(/^\.\.\./u,"")}function je(e){return[...new Map(e.map(t=>[t.symbol,t])).values()]}var bn=8;function V(e,t){return t?te(e,t,0,new Set):null}function te(e,t,n,r){if(n>bn)return U(t,"value-evaluation-depth");let i=M(t),a=Bn(i);if(a)return In(e.file,i,a.term,a.value,a.precision);if(i.type==="binary_expression"&&/\+/u.test(i.text)){let l=i.namedChildren.map(u=>te(e,u,n+1,new Set(r)));if(l.length>=2&&l.every(u=>u!==null)){let u={kind:"concat",parts:l.map(c=>c.term)},d=l.map(c=>c.value).join("");return Pn(e.file,i,u,d,l.some(c=>c.precision!=="literal")?"constrained-pattern":"literal",l)}}let s=i.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(s))return Cn(e,s,i,n,r);let o=wn(i);return o?Nn(e,o.base,o.properties,i,n,r):i.type==="call_expression"||i.type==="call"?Sn(e,i,n,r):U(i,`unsupported-expression:${i.type}`)}function Sn(e,t,n,r){let a=(t.childForFieldName("function")??t.namedChild(0))?.text.replace(/\s+/gu,"").replace(/<.*>$/u,"")??"",s=xn(e,a);if(s.length!==1)return U(t,s.length===0?"call-target-unresolved":"call-target-ambiguous");let o=s[0],l=`${o.relativePath}\0${o.symbol}`;if(r.has(l))return U(t,"call-return-cycle");let u=O(e.db,o.relativePath)?.rootNode;if(!u)return U(t,"call-target-unparsed");let d=D(u,o.startLine,o.endLine);if(!d)return U(t,"call-target-syntax-unavailable");let c=Rn(d);if(!c)return U(t,"call-return-not-single-expression");let p=new Set(r);p.add(l);let f=te({db:e.db,file:o.relativePath,root:u},c,n+1,p);return f?Ne(t,"bounded-call-return",f,o.symbol):U(t,"call-return-unresolved")}function xn(e,t){if(/^[A-Za-z_$][\w$]*$/u.test(t)){let i=_(e.db,e.file).filter(s=>s.isFunctionLike&&s.leaf===t);if(i.length>0)return i;let a=j(e.db,e.file).find(s=>s.localName===t&&s.sourcePath&&s.kind!=="namespace");return a?.sourcePath?Z(e.db,a.sourcePath,a.importedName==="default"?t:a.importedName).filter(s=>s.isFunctionLike):[]}let n=/^([A-Za-z_$][\w$]*)\.([A-Za-z_$][\w$]*)$/u.exec(t);if(!n)return[];let r=j(e.db,e.file).find(i=>i.kind==="namespace"&&i.localName===n[1]&&i.sourcePath);return r?.sourcePath?Z(e.db,r.sourcePath,n[2]).filter(i=>i.isFunctionLike):[]}function Rn(e){let t=e.childForFieldName("body");if(e.type==="arrow_function"&&t&&t.type!=="statement_block")return t;let n=[];return Rt(t??e,t??e,n),n.length!==1?null:n[0].childForFieldName("argument")??n[0].namedChild(0)}function Rt(e,t,n){if(!(t!==e&&(/(?:function|method|lambda)/u.test(t.type)||t.type==="arrow_function"))){if(t.type==="return_statement"){n.push(t);return}for(let r of t.namedChildren)Rt(e,r,n)}}function Cn(e,t,n,r,i){let a=`${e.file}\0${t}`;if(i.has(a))return U(n,"value-cycle");i.add(a);let s=Ge(e.root,t);if(s){let g=te(e,s,r+1,i);return g?Ne(n,"local-constant",g):U(n,"non-foldable-local")}let o=j(e.db,e.file).find(g=>g.localName===t&&g.sourcePath);if(!o?.sourcePath)return H(n,t,"unresolved-identifier");if(o.kind==="namespace")return H(n,t,"namespace-import-requires-property");let l=o.importedName==="default"?t:o.importedName,u=Z(e.db,o.sourcePath,l);if(u.length!==1)return H(n,t,u.length===0?"import-definition-missing":"import-definition-ambiguous");let d=u[0],c=O(e.db,d.relativePath)?.rootNode;if(!c)return H(n,d.symbol,"import-definition-unparsed");let p=Ge(c,d.leaf);if(!p)return H(n,d.symbol,"import-definition-non-value");let f=te({db:e.db,file:d.relativePath,root:c},p,r+1,i);return f?Ne(n,"imported-constant",f,d.symbol):H(n,d.symbol,"import-value-unresolved")}function Nn(e,t,n,r,i,a){let s=j(e.db,e.file).find(f=>f.localName===t&&f.sourcePath),o=e.file,l=t,u;if(s?.sourcePath){s.kind==="namespace"?(l=n[0]??"",n=n.slice(1)):l=s.importedName==="default"?t:s.importedName;let f=Z(e.db,s.sourcePath,l);if(f.length!==1)return H(r,`${t}.${n.join(".")}`,f.length===0?"member-definition-missing":"member-definition-ambiguous");o=f[0].relativePath,l=f[0].leaf,u=f[0].symbol}let d=o===e.file?e.root:O(e.db,o)?.rootNode;if(!d)return H(r,u??t,"member-definition-unparsed");let c=Ge(d,l);if(!c)return H(r,u??t,"member-base-non-value");for(let f of n){let g=M(c);if(c=Fn(g,f),!c)return H(r,u??`${t}.${n.join(".")}`,`member-property-missing:${f}`)}let p=te({db:e.db,file:o,root:d},c,i+1,a);return p?Ne(r,"member-constant",p,u):H(r,u??t,"member-value-unresolved")}function Bn(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);if(n!=="`"||!r.includes("${"))return{term:{kind:"literal",value:r},value:r,precision:"literal"};let i=[],a=0,s=/\$\{([^}]*)\}/gu;for(let o of r.matchAll(s)){let l=o.index??0;l>a&&i.push({kind:"literal",value:r.slice(a,l)}),i.push({kind:"unknown",reason:`template-hole:${o[1]?.trim()||"expression"}`}),a=l+o[0].length}return a<r.length&&i.push({kind:"literal",value:r.slice(a)}),{term:{kind:"pattern",language:"template",value:r.replace(s,"{}")},value:r.replace(s,"{}"),precision:"constrained-pattern"}}function In(e,t,n,r,i){return{value:r,evidence:"literal",term:n,precision:i,derivation:Be("direct-literal","direct",e,t)}}function Pn(e,t,n,r,i,a){return{value:r,evidence:"constant",term:n,precision:i,derivation:{...Be("constant-concatenation","mechanically-derived",e,t),inputFactIds:a.flatMap(s=>s.derivation.inputFactIds),sourceSpans:a.flatMap(s=>s.derivation.sourceSpans)}}}function Ne(e,t,n,r){return n.evidence==="expression"?{...n,derivation:{kind:"heuristic",rule:t,ruleVersion:"1",inputFactIds:[...n.derivation.inputFactIds,...r?[r]:[]],sourceSpans:n.derivation.sourceSpans}}:{...n,evidence:"constant",derivation:{kind:"mechanically-derived",rule:t,ruleVersion:"1",inputFactIds:[...n.derivation.inputFactIds,...r?[r]:[]],sourceSpans:n.derivation.sourceSpans}}}function H(e,t,n){return{value:e.text.trim(),evidence:"expression",term:{kind:"symbol",symbol:t},precision:"symbolic",derivation:Be(n,"heuristic","",e)}}function U(e,t){return{value:e.text.trim(),evidence:"expression",term:{kind:"unknown",reason:t},precision:"unknown",derivation:Be(t,"heuristic","",e)}}function Be(e,t,n,r){return{kind:t,rule:e,ruleVersion:"1",inputFactIds:[],sourceSpans:n?[{file:n,startLine:r.startPosition.row,endLine:r.endPosition.row}]:[]}}function wn(e){let t=e.text.replace(/\s+/gu,"");if(!/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/u.test(t))return null;let[n,...r]=t.split(".");return n?{base:n,properties:r}:null}var xt=new WeakMap;function En(e){let t=xt.get(e);if(t)return t;let n=new Map;return k(e,r=>{if(r.type!=="variable_declarator")return;let a=(r.childForFieldName("name")??r.namedChild(0))?.text.trim();if(!a||n.has(a))return;let s=r.parent;if(!s||s.type!=="lexical_declaration"||!/^\s*(?:export\s+)?const\b/u.test(s.text))return;let o=r.childForFieldName("value")??r.namedChild(1);o&&n.set(a,o)}),xt.set(e,n),n}function Ge(e,t){return En(e).get(t)??null}function Fn(e,t){for(let n of e.namedChildren)if(!(n.type!=="pair"||(n.childForFieldName("key")??n.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")!==t))return n.childForFieldName("value")??n.namedChild(1);return null}var _n=new WeakMap,Ft=new Set(["delete","get","head","options","patch","post","put"]),$n=/(?:^|\.)(?:app|router|server)$/u,Ln=new Set(["findFirst","findMany","findUnique","from","get","select"]),kn=new Set(["create","delete","insert","remove","update","upsert"]),On=new Set(["execute","query","raw"]),Ct=/(?:\b(?:name|id)|['"`](?:name|id)['"`])\s*:/u,Nt=/(?:^\s*|[,{]\s*)(?:async\s+)?['"`]?(?:execute|handler|invoke|run)['"`]?\s*(?::|\([^)]*\)\s*\{)/mu,Bt=/\b[A-Za-z_$][\w$-]*[_-][\w$-]*\s*\(/u,It=/\b(?:use|call|invoke|run|via|with|read|stop)(?:\s+the)?(?:\s+(?:tool|capability|command))?\s+[A-Za-z_$][\w$-]*\s*\(/iu,Xe=[Hn(),Mn(),An(),Vn(),zn(),jn(),qn()],Ke=new Set(["exec","execFile","execFileSync","execSync","fork","spawn","spawnSync"]);function An(){return{id:"builtin.node-child-process",supports:e=>/(?:from\s*|require\s*\(\s*)['"](?:node:)?child_process['"]/u.test(e)&&/\b(?:exec|execFile|execFileSync|execSync|fork|spawn|spawnSync)\s*\(/u.test(e),extract:e=>{let t=Dn(e.source),n=[];return q(e.root,"call_expression",r=>{let i=ue(r);if(!i)return;let a=t.direct.get(i),s=/^(.*?)\.([A-Za-z_$][\w$]*)$/u.exec(i),o=s&&t.namespaces.has(s[1])?s[2]:null,l=a??o;if(!l||!Ke.has(l))return;let u=W(r),d=A(u[0],e)??{value:u[0]?.text.trim()||"<missing>",evidence:"expression"},c=["exec","execFile","execFileSync","execSync"].includes(l)?"process.exec":"process.spawn";n.push(T(e,r,"builtin.node-child-process",c,[{name:"operation",value:l,evidence:"literal"},{name:"executable",...d}],"exact","node-child-process-import"))}),n}}}function Dn(e){let t=new Map,n=new Set,r=String.raw`['"](?:node:)?child_process['"]`,i=new RegExp(String.raw`\bimport\s*\{([^}]*)\}\s*from\s*${r}`,"gu");for(let l of e.matchAll(i))for(let u of(l[1]??"").split(",")){let d=/^\s*([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?\s*$/u.exec(u);d&&Ke.has(d[1])&&t.set(d[2]??d[1],d[1])}let a=new RegExp(String.raw`\b(?:const|let)\s*\{([^}]*)\}\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let l of e.matchAll(a))for(let u of(l[1]??"").split(",")){let d=/^\s*([A-Za-z_$][\w$]*)(?:\s*:\s*([A-Za-z_$][\w$]*))?\s*$/u.exec(u);d&&Ke.has(d[1])&&t.set(d[2]??d[1],d[1])}let s=new RegExp(String.raw`\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*${r}`,"gu");for(let l of e.matchAll(s))n.add(l[1]);let o=new RegExp(String.raw`\b(?:const|let)\s+([A-Za-z_$][\w$]*)\s*=\s*require\s*\(\s*${r}\s*\)`,"gu");for(let l of e.matchAll(o))n.add(l[1]);return{direct:t,namespaces:n}}function L(e,t,n,r){let i=oe(r,"runtime-boundaries.context.ast",t,()=>n===void 0?O(e,t):ut(e,t,n));if(!i)return null;let a=i.rootNode;n!==void 0&&_n.set(a,i);let s=n??he(e,t),o,l,u,d=()=>(l!==void 0||(l=oe(r,"runtime-boundaries.context.callable-sites",t,()=>{let c=ve(t);return(c?ft(a,c):null)??pt(e,t)})),l);return{db:e,file:t,source:s,root:a,get constants(){return u??=oe(r,"runtime-boundaries.context.constants",t,()=>Jn(a)),u},ownerAt:c=>{let f=(o??=oe(r,"runtime-boundaries.context.definitions",t,()=>_(e,t,{rangeCorrectionEvidence:{source:s,callables:d()}},(m,y)=>oe(r,`runtime-boundaries.context.definitions.${m}`,t,y)))).filter(m=>m.startLine<=c&&m.endLine>=c).sort((m,y)=>m.endLine-m.startLine-(y.endLine-y.startLine)||m.startLine-y.startLine)[0];if(f)return{file:t,symbol:f.symbol,name:f.leaf,startLine:f.startLine,endLine:f.endLine};let b=(d()??[]).filter(m=>m.startLine<=c&&m.endLine>=c).sort((m,y)=>m.endLine-m.startLine-(y.endLine-y.startLine)||m.startLine-y.startLine)[0];return{file:t,symbol:null,name:b?.name??null,startLine:b?.startLine??c,endLine:b?.endLine??c}}}}function oe(e,t,n,r){return e?e(t,r,{file:n}):r()}function Mn(){return{id:"builtin.effect-httpapi",supports:e=>se(e,"HttpApiEndpoint").size>0||se(e,"HttpApiBuilder").size>0,extract:e=>{let t=[],n=se(e.source,"HttpApiEndpoint"),r=se(e.source,"HttpApiGroup"),i=se(e.source,"HttpApiBuilder");return q(e.root,"call_expression",a=>{let s=Tt(a);if(!s)return;let o=W(a);if(n.has(s.receiver)&&Ft.has(s.member)){let b=A(o[0],e),m=A(o[1],e),y=wt(a,r,"make",0,e);if(!b||!m||!y)return;let v=s.member.toUpperCase();t.push(T(e,a,"builtin.effect-httpapi","http.handle",[{name:"method",value:v,evidence:"literal"},{name:"path",...m}],z([{name:"path",...m}]),"effect-httpapi-endpoint-declaration")),t.push(T(e,a,"builtin.effect-httpapi","framework.declare",qe(y,b),z(qe(y,b)),"effect-httpapi-operation-declaration"));return}if(!["handle","handleRaw"].includes(s.member))return;let l=wt(a,i,"group",1,e),u=A(o[0],e),d=o[1];if(!l||!u||!d)return;let c=qe(l,u),p=ee(e.db,e.file,d.text),f=T(e,a,"builtin.effect-httpapi","framework.handle",c,p.length===1?z(c):"candidate","effect-httpapi-handler-registration"),g=p[0];p.length===1&&g&&(f.owner={file:g.relativePath,symbol:g.symbol,name:g.leaf,startLine:g.startLine,endLine:g.endLine}),t.push(f)}),t}}}function qe(e,t){return[{name:"adapter",value:"effect-httpapi",evidence:"literal"},{name:"group",...e},{name:"operation",...t}]}function se(e,t){let n=new Set,r=/\bimport\s*\{([\s\S]*?)\}\s*from\s*['"]([^'"]+)['"]/gu;for(let a of e.matchAll(r)){let s=a[2]??"";if(Pt(s))for(let o of(a[1]??"").split(",")){let l=o.trim().replace(/^type\s+/u,""),u=/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/u.exec(l);u?.[1]===t&&n.add(u[2]??u[1])}}let i=/\bimport\s*\*\s*as\s*([A-Za-z_$][\w$]*)\s*from\s*['"]([^'"]+)['"]/gu;for(let a of e.matchAll(i)){let s=a[2]??"";s.endsWith(`/${t}`)&&Pt(s)&&n.add(a[1])}return n}function Pt(e){return e==="effect/unstable/httpapi"||e==="@effect/platform"||e.startsWith("@effect/platform/HttpApi")}function wt(e,t,n,r,i){let a=e.parent;for(;a;){if(a.type==="call_expression"){let s=Et(a,t,n,r,i);if(s)return s;let o=a.childForFieldName("function")??a.namedChild(0),l=null;if(o&&We(o,u=>{!l&&u.type==="call_expression"&&(l=Et(u,t,n,r,i))}),l)return l}a=a.parent}return null}function Et(e,t,n,r,i){let a=Tt(e);return!a||a.member!==n||!t.has(a.receiver)?null:A(W(e)[r],i)}function Tt(e){let t=e.childForFieldName("function")??e.namedChild(0);if(!t||!["member_expression","subscript_expression"].includes(t.type))return null;let n=t.childForFieldName("object")??t.namedChild(0),r=t.childForFieldName("property")??t.childForFieldName("index")??t.namedChild(1);return!n||!r?null:{receiver:n.text.replace(/\s+/gu,""),member:r.text.replace(/^['"`]|['"`]$/gu,"")}}function Hn(){return{id:"builtin.http",supports:e=>/\bfetch\s*\(|\baxios\b|\b(?:app|router|server)\s*\.\s*(?:get|post|put|patch|delete|options|head)\s*\(/u.test(e)||le(e,["axios"])||/\b(?:FastAPI|Flask|APIRouter|axum|Router::new)\b/u.test(e),extract:e=>{let t=[];return q(e.root,["decorator","call_expression"],n=>{if(n.type==="decorator"){let p=/^@[^\s(]+\.(get|post|put|patch|delete|options|head)\s*\(\s*(['"`])([^'"`]+)\2/iu.exec(n.text.trim());if(!p||!le(e.source,["fastapi","flask"]))return;t.push(T(e,n,"builtin.http","http.handle",[{name:"method",value:p[1].toUpperCase(),evidence:"literal"},{name:"path",value:p[3],evidence:"literal"}],"exact","framework-decorator"));return}if(n.type!=="call_expression")return;let r=ue(n);if(!r)return;let i=r.split(".").at(-1)?.toLowerCase()??"",a=r.includes(".")?r.slice(0,r.lastIndexOf(".")):"",s=W(n);if(i==="route"&&le(e.source,["axum"])){let p=A(s[0],e),f=/^\s*(get|post|put|patch|delete|options|head)\s*\(/iu.exec(s[1]?.text??"")?.[1];if(!p||!f)return;t.push(T(e,n,"builtin.http","http.handle",[{name:"method",value:f.toUpperCase(),evidence:"literal"},{name:"path",...p}],z([{name:"path",...p}]),"framework-adapter"));return}if(r==="fetch"||r.endsWith(".fetch")){let p=A(s[0],e);if(!p)return;let g=/\bmethod\s*:\s*['"`]([A-Za-z]+)['"`]/u.exec(s[1]?.text??"")?.[1]?.toUpperCase()??(s[1]?null:"GET"),b=[...g?[{name:"method",value:g,evidence:"literal"}]:[],{name:"path",...p}];t.push(T(e,n,"builtin.http","http.request",b,g?z(b):"candidate","call-expression"));return}if(!Ft.has(i))return;let o=A(s[0],e);if(!o)return;let l=i.toUpperCase();if($n.test(a)&&le(e.source,["express","fastify","hono","koa-router","@koa/router"])){t.push(T(e,n,"builtin.http","http.handle",[{name:"method",value:l,evidence:"literal"},{name:"path",...o}],z([{name:"path",...o}]),"framework-adapter"));return}let d=Zn(e.source,["axios"]),c=a.split(".")[0]??"";d.has(c)&&t.push(T(e,n,"builtin.http","http.request",[{name:"method",value:l,evidence:"literal"},{name:"path",...o}],z([{name:"path",...o}]),"client-adapter"))}),t}}}function Vn(){return{id:"builtin.capability-registry",supports:e=>Ct.test(e)&&Nt.test(e)||Bt.test(e)||It.test(e),extract:e=>{let t=[],n=new Set,r=[];return Ct.test(e.source)&&Nt.test(e.source)&&r.push("pair"),(Bt.test(e.source)||It.test(e.source))&&r.push("string","string_literal","template_string"),q(e.root,r,i=>{if(i.type==="pair"){let s=i.childForFieldName("key")??i.namedChild(0),o=i.childForFieldName("value")??i.namedChild(1),l=s?.text.replace(/^['"`]|['"`]$/gu,"");if(l!=="name"&&l!=="id")return;let u=_t(o,e),d=er(i);if(!u||u.evidence!=="literal"||!d)return;let c=`handle\0${u.value}\0${d.startPosition.row}`;if(n.has(c))return;n.add(c),t.push(T(e,d,"builtin.capability-registry","registry.handle",[{name:"key",...u}],"exact","capability-descriptor"));return}if(!["string","string_literal","template_string"].includes(i.type))return;let a=i.text.replace(/^['"`]|['"`]$/gu,"");for(let s of a.matchAll(/\b([A-Za-z_$][\w$-]*)\s*\(/gu)){let o=s[1];if(!Un(a,o,s.index))continue;let l=`reference\0${o}\0${i.startPosition.row}`;n.has(l)||(n.add(l),t.push(T(e,i,"builtin.capability-registry","registry.reference",[{name:"key",value:o,evidence:"literal"}],"exact","capability-instruction-reference")))}}),t}}}function Un(e,t,n){if(t.includes("_")||t.includes("-"))return!0;let r=e.slice(Math.max(0,n-64),n);return/\b(?:use|call|invoke|run|via|with|read|stop)(?:\s+the)?(?:\s+(?:tool|capability|command))?\s*$/iu.test(r)}function zn(){return{id:"builtin.registry",supports:e=>/(?:Handlers?|Registry|Routes?)\b/iu.test(e),extract:e=>{let t=[];return q(e.root,["pair","call_expression"],n=>{if(n.type==="pair"){let a=Qn(n);if(!a)return;let s=n.childForFieldName("key")??n.namedChild(0),o=n.childForFieldName("value")??n.namedChild(1),l=_t(s,e);if(!l||!o||!$t(o))return;let u=Ze(o)?"exact":"candidate";t.push(T(e,n,"builtin.registry","registry.handle",[{name:"registry",value:a,evidence:"identifier"},{name:"key",...l}],z([{name:"key",...l}],u),"object-member"));return}if(n.type!=="call_expression")return;let r=n.childForFieldName("function")??n.namedChild(0);if(!r)return;let i=/^([A-Za-z_$][\w$]*)\s*\[\s*(['"`])([^'"`]+)\2\s*\]$/u.exec(r.text.trim());i&&t.push(T(e,n,"builtin.registry","registry.dispatch",[{name:"registry",value:i[1],evidence:"identifier"},{name:"key",value:i[3],evidence:"literal"}],"exact","indexed-access-call"))}),t}}}function jn(){return{id:"builtin.persistence",supports:e=>/\b(?:db|database|prisma|drizzle|[A-Za-z_$][\w$]*(?:Repository|Repo))\b[^;]{0,1024}?\.\s*(?:findFirst|findMany|findUnique|from|get|select|create|delete|insert|remove|update|upsert|execute|query|raw|transaction)(?:\s*<[^()]{1,512}>)?\s*\(/iu.test(e),extract:e=>{let t=[],n=nr(e.root);return q(e.root,"call_expression",r=>{let i=ue(r);if(!i)return;let a=i.split("."),s=a.at(-1)??"",o=W(r),l=o[0]?.text??"",u=tr(s,l);if(!u)return;let d=Lt(a,n);if(!d)return;let c=Gn(o[0],e)??rr(l),p=ir(d,a,s,c);if(!p)return;let f=s==="insert"?"persistence-insert":u==="database.read"&&/\bFOR\s+UPDATE\s+SKIP\s+LOCKED\b/iu.test(l)?"persistence-skip-locked-claim":"persistence-adapter";t.push(T(e,r,"builtin.persistence",u,[{name:"resource",...p}],z([{name:"resource",...p}]),f))}),t}}}function Gn(e,t){if(!e)return null;let n=e.text.replace(/\s+/gu,"");return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/u.test(n)?{value:n.split(".").at(-1),evidence:"identifier",term:{kind:"symbol",symbol:n}}:A(e,t)}function qn(){return{id:"builtin.queue",supports:e=>le(e,["amqplib","bullmq","kafkajs","@aws-sdk/client-sqs","rabbitmq"])&&/\.(?:sendToQueue|consume|send|subscribe)\s*\(/u.test(e),extract:e=>{let t=[];return q(e.root,"call_expression",n=>{let r=ue(n);if(!r)return;let i=r.split(".").at(-1)??"",a=W(n),s=i==="sendToQueue"||i==="send"?"queue.send":i==="consume"||i==="subscribe"?"queue.consume":null;if(!s)return;let o=i==="send"||i==="subscribe"?Wn(a[0],"topic",e):A(a[0],e);o&&t.push(T(e,n,"builtin.queue",s,[{name:"address",...o}],z([{name:"address",...o}]),"framework-adapter"))}),t}}}function T(e,t,n,r,i,a,s){let o=e.ownerAt(t.startPosition.row),l=JSON.stringify({extractor:n,action:r,file:e.file,line:t.startPosition.row,keyParts:i});return{id:`boundary:${Tn("sha256").update(l).digest("hex").slice(0,16)}`,extractor:n,action:r,owner:o,source:{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},keyParts:i,evidence:s,strength:a,protocol:r.split(".")[0]??r,role:Kn(r),executionDomain:Xn(e.file),derivation:{kind:a==="candidate"?"heuristic":a==="derived"?"mechanically-derived":"direct",rule:s,ruleVersion:"1",inputFactIds:i.flatMap(u=>u.derivation?.inputFactIds??[]),sourceSpans:[{file:e.file,startLine:t.startPosition.row,endLine:t.endPosition.row},...i.flatMap(u=>u.derivation?.sourceSpans??[])]},valuePrecision:i.some(u=>u.evidence==="expression")?"unknown":i.some(u=>u.evidence==="identifier")?"symbolic":"literal",modality:"may",resolution:"unresolved",sourceScope:Re(e.file)}}function Kn(e){let t=e.split(".").at(-1)??e;return["handle","subscribe","consume","read"].includes(t)?"consumer":["request","publish","send","write","dispatch","reference","invoke","spawn","exec"].includes(t)?"producer":"observe"}function Xn(e){let t=e.replaceAll("\\","/"),n=/^(apps|services|packages)\/([^/]+)/u.exec(t);return n?`${n[1]}/${n[2]}`:null}function le(e,t){return t.some(n=>{let r=n.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&");return new RegExp(`(?:\\bfrom\\s+${r}\\b|\\buse\\s+${r}\\b|(?:\\bfrom\\s*|\\brequire\\s*\\(\\s*)['"]${r}(?:[/']|"))`,"u").test(e)})}function Zn(e,t){let n=new Set;for(let r of t){let i=r.replace(/[.*+?^${}()|[\]\\]/gu,"\\$&"),a=new RegExp(`(?:import\\s+([A-Za-z_$][\\w$]*)[^;]*?\\sfrom\\s*|(?:const|let)\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*require\\s*\\(\\s*)['"]${i}(?:[/']|")`,"gu");for(let s of e.matchAll(a)){let o=s[1]??s[2];o&&n.add(o)}}return n}function Ie(e,t,n,r,i,a,s){return T(e,t,n,r,i,a,s)}function ue(e){return(e.childForFieldName("function")??e.namedChild(0))?.text.replace(/\s+/gu,"")??null}function W(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function A(e,t){let n=V(t,e);return n?{value:n.value,evidence:n.evidence,term:n.term,derivation:n.derivation}:null}function Wn(e,t,n){if(!e)return null;let r=e.namedChildren.find(a=>a.type!=="pair"?!1:(a.childForFieldName("key")??a.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")===t),i=r?.childForFieldName("value")??r?.namedChild(1);return A(i,n)}function _t(e,t){if(!e)return null;let n=A(e,t);if(n?.evidence==="literal"||n?.evidence==="constant")return n;let r=e.text.trim();return/^[A-Za-z_$][\w$]*$/u.test(r)?{value:r,evidence:"identifier",term:{kind:"symbol",symbol:r}}:n}function z(e,t="exact"){return t==="candidate"||e.some(n=>n.evidence==="expression")?"candidate":t==="derived"||e.some(n=>n.evidence==="constant")?"derived":"exact"}function Yn(e){let t=e.text.trim(),n=t[0];if(n!=="'"&&n!=='"'&&n!=="`"||t.at(-1)!==n)return null;let r=t.slice(1,-1);return n==="`"&&r.includes("${")?null:r}function Jn(e){let t=new Map;return We(e,n=>{if(n.type!=="variable_declarator")return;let r=n.childForFieldName("name")??n.namedChild(0),i=n.childForFieldName("value")??n.namedChild(1);if(!r||!i||!/^[A-Za-z_$][\w$]*$/u.test(r.text))return;let a=Yn(i);a!==null&&t.set(r.text,a)}),t}function Qn(e){let t=e.parent,n=t?.parent??null;for(;n&&["as_expression","satisfies_expression","type_assertion","parenthesized_expression"].includes(n.type);)n=n.parent;if(!t||!n||n.type!=="variable_declarator")return null;let i=(n.childForFieldName("name")??n.namedChild(0))?.text??"";return/(?:handlers?|registry|routes?)$/iu.test(i)?i:null}function Ze(e){return/(?:function|lambda|method)/u.test(e.type)||e.type==="arrow_function"}function $t(e){return Ze(e)||e.type==="member_expression"?!0:e.type==="identifier"&&/(?:command|controller|dispatch|handle|handler)/iu.test(e.text)}function er(e){let t=e.parent;for(;t&&t.type!=="variable_declarator";){if(["object","object_literal","dictionary"].includes(t.type))for(let n of t.namedChildren){if(n.type==="pair"){let i=n.childForFieldName("key")??n.namedChild(0),a=n.childForFieldName("value")??n.namedChild(1),s=i?.text.replace(/^['"`]|['"`]$/gu,"");if(s&&["execute","handler","invoke","run"].includes(s)&&a&&$t(a))return t}let r=n.childForFieldName("name")??n.namedChild(0);if(r&&["execute","handler","invoke","run"].includes(r.text.replace(/^['"`]|['"`]$/gu,""))&&/(?:function|method)/u.test(n.type))return t}t=t.parent}return null}function Lt(e,t=new Set){let n=e.slice(0,-1).map(r=>r.replace(/\([^)]*\)/gu,""));return n.some(r=>/^(?:prisma|drizzle)$/iu.test(r))?"orm":n.some(r=>/(?:Repository|Repo)$/u.test(r))?"repository":n.some(r=>/^(?:db|database)$/iu.test(r)||t.has(r))?"database":null}function tr(e,t){if(Ln.has(e))return"database.read";if(kn.has(e))return"database.write";if(!On.has(e))return null;let n=/\b(SELECT|INSERT|UPDATE|DELETE)\b/iu.exec(t)?.[1]?.toUpperCase();return n==="SELECT"?"database.read":n?"database.write":null}function nr(e){let t=new Set;return q(e,"call_expression",n=>{let r=ue(n);if(!r)return;let i=r.split(".");if(!(i.at(-1)!=="transaction"||!Lt(i)))for(let a of W(n)){if(!Ze(a))continue;let o=(a.childForFieldName("parameters")??a.namedChildren.find(u=>/parameters/u.test(u.type)))?.namedChildren[0],l=o?lt(o):null;l&&t.add(l)}}),t}function rr(e){let t=kt(e);return t?{value:t,evidence:"identifier",term:{kind:"symbol",symbol:t}}:null}function ir(e,t,n,r){if(e==="orm"&&t.length>=3)return{value:t.at(-2).replace(/\([^)]*\)/gu,""),evidence:"identifier"};if(e==="repository"){let a=t.at(-2)?.replace(/(?:Repository|Repo)$/u,"");return a?{value:a,evidence:"identifier"}:null}if(!r)return null;if(n==="from"||n==="insert")return r;let i=kt(r.value);return i?{value:i,evidence:r.evidence}:null}function kt(e){return/\b(?:from|into|update|table)\s+(?:\$\{\s*)?['"`]?([A-Za-z_$][\w$.-]*)/iu.exec(e)?.[1]??null}function We(e,t){t(e);for(let n of e.namedChildren)We(n,t)}function q(e,t,n){for(let r of be(e,t))n(r)}var ar=Q("resolved-call-syntax",{clearGroups:[]}),Ye=Q("resolved-call-sites",{clearGroups:[]}),or=Q("resolved-call-sites-reference-evidence",{clearGroups:[]});function Je(e,t){return Ye.get(e,t.symbolId,()=>At(e,t,sr(e,t)))}function Ot(e,t){let n=[...new Map(t.map(a=>[a.symbolId,a])).values()],r=n.filter(a=>!Ye.has(e,a.symbolId)),i=Dt(e,r);return new Map(n.map(a=>[a.symbolId,Ye.get(e,a.symbolId,()=>At(e,a,i.get(a.symbolId)??[]))]))}function At(e,t,n){let r=[],i=[],a=new Set,s=new Set;for(let o of n){a.add(o.file);let l=ar.get(e,o.file,()=>ur(e,o.file));if(!l){i.push({callee:t,file:o.file,line:o.startLine,reason:"ast-unavailable",candidates:0,referenceProvenance:o.provenance});continue}let u=(l.byLeaf.get(t.leaf)??[]).filter(({callNode:p})=>p.startPosition.row<=o.endLine&&p.endPosition.row>=o.startLine);if(u.length!==1){i.push({callee:t,file:o.file,line:o.startLine,reason:u.length===0?"call-not-found":"ambiguous-call",candidates:u.length,referenceProvenance:o.provenance});continue}let d=u[0],c=`${o.file}\0${d.callNode.startIndex}\0${d.callNode.endIndex}`;s.has(c)||(s.add(c),r.push({callee:t,caller:xe(_(e,o.file),d.callNode.startPosition.row),file:o.file,line:d.callNode.startPosition.row,startLine:d.callNode.startPosition.row,endLine:d.callNode.endPosition.row,targetText:d.targetNode.text,callNode:d.callNode,targetNode:d.targetNode,arguments:d.arguments,referenceProvenance:o.provenance}))}return{sites:r,unresolved:i,filesVisited:a.size}}function sr(e,t){return Dt(e,[t]).get(t.symbolId)??[]}function Dt(e,t){if(!lr(e))return new Map(t.map(r=>[r.symbolId,gt(e,r,{semantic:!1}).map(i=>({file:i.file,startLine:i.line,endLine:i.line,provenance:i.provenance}))]));let n=new Map;for(let r of ht(e,t.map(i=>i.symbolId))){let i=n.get(r.symbol_id)??[];i.push({file:r.relative_path,startLine:r.chunk_start,endLine:r.chunk_end,provenance:"scip-reference-chunk"}),n.set(r.symbol_id,i)}return new Map(t.map(r=>[r.symbolId,n.get(r.symbolId)??[]]))}function lr(e){return or.get(e,"project",()=>!!e.get("SELECT 1 AS present FROM mentions WHERE role != 1 LIMIT 1"))}function ur(e,t){let n=O(e,t)?.rootNode;if(!n)return null;let r=new Map;for(let i of be(n,["call_expression","call"])){let a=i.childForFieldName("function")??i.namedChild(0);if(!a)continue;let s=ct(a);if(!s)continue;let o=i.childForFieldName("arguments")??i.namedChildren.find(d=>d.type==="arguments"),l={callNode:i,targetNode:a,arguments:o?.namedChildren??[]},u=r.get(s);u?u.push(l):r.set(s,[l])}return{byLeaf:r}}var cr=Q("call-parameter-value-flow",{clearGroups:[]});function ce(e,t){let n=`${t.callee.symbolId}\0${t.file}\0${t.callNode.startIndex}\0${t.callNode.endIndex}`;return cr.get(e,n,()=>dr(e,t))}function de(e,t){let n=new Set(t);return[...new Set(e.transfers.flatMap(r=>n.has(r.calleePosition)?[r.callerPosition]:[]))].sort((r,i)=>r-i)}function dr(e,t){let n={file:t.file,startLine:t.startLine,endLine:t.endLine};if(!t.caller)return{callee:t.callee,caller:null,call:n,transfers:[],unknown:t.arguments.map((l,u)=>({calleePosition:u,argumentText:l.text.trim(),reason:"caller-unavailable",proof:n}))};let r=O(e,t.caller.relativePath)?.rootNode,i=r?D(r,t.caller.startLine,t.caller.endLine):null;if(!i)return{callee:t.callee,caller:t.caller,call:n,transfers:[],unknown:t.arguments.map((l,u)=>({calleePosition:u,argumentText:l.text.trim(),reason:"caller-syntax-unavailable",proof:n}))};let a=X(i),s=[],o=[];return t.arguments.forEach((l,u)=>{let d=l.text.trim(),c=a.indexOf(d);c>=0?s.push({calleePosition:u,callerPosition:c,argumentText:d,proof:n}):o.push({calleePosition:u,argumentText:d,reason:"argument-not-direct-parameter",proof:n})}),{callee:t.callee,caller:t.caller,call:n,transfers:s,unknown:o}}var pr=8,fr=8;function Ht(e,t,n=[]){let r=[],i=mr(e,n,r),a=i.summaries,s=yr(e,t,a,r),o=hr(e,t,r);return{observations:Ir([...s.observations,...o]),bodySummaries:a.size,discriminatorSummaries:s.summaries,filesInspected:i.filesInspected,errors:r}}function mr(e,t,n){let r=new Map,i=[],a=new Map,s=o=>{if(a.has(o))return a.get(o)??null;let l=L(e,o);return a.set(o,l),l};for(let o of t){let l={...o,depth:0,proofSpans:[{file:o.definition.relativePath,startLine:o.definition.startLine,endLine:o.definition.endLine}]};r.set(o.definition.symbol,l),i.push(l)}for(;i.length>0;){let o=i.shift();if(!(o.depth>=pr))try{for(let l of Je(e,o.definition).sites){if(!s(l.file))continue;let d=l.caller;if(!d)continue;let c=de(ce(e,l),o.parameterIndexes);if(c.length===0)continue;let p={definition:d,parameterIndexes:qt(c),depth:o.depth+1,proofSpans:[...o.proofSpans,{file:l.file,startLine:l.startLine,endLine:l.endLine}]};Sr(r,p)&&i.push(r.get(d.symbol))}}catch(l){n.push(`builtin.carrier body summary failed for ${o.definition.relativePath}: ${tt(l)}`)}}return{summaries:r,filesInspected:new Set(t.map(o=>o.definition.relativePath)).size}}function yr(e,t,n,r){let i=new Map,a=[],s=[];for(let o of t){if(o.action!=="http.request"||o.strength==="candidate"||o.sourceScope!=="production")continue;let l=Ut(o);if(!l)continue;let u=L(e,o.source.file);if(!u)continue;let d=zt(u.root,o.source.startLine),c=d.find(v=>v.startPosition.row===o.source.startLine)??d[0];if(!c)continue;let p=et(c);if(!p)continue;let f=ee(e,o.source.file,p.text);if(f.length!==1)continue;let g=n.get(f[0].symbol);if(!g)continue;let b=o.owner.symbol?_(e,o.owner.file).find(v=>v.symbol===o.owner.symbol):null;if(!b)continue;let m=xr(u,b),y=Pe(c);for(let v of g.parameterIndexes){let R=Cr(u,y[v]);if(R)for(let x of Nr(R)){let h=jt(x),S=Gt(x);if(!h||!S)continue;let B=m.indexOf(S.text.trim());if(B>=0){let N={definition:b,carrier:l,field:h,parameterIndex:B,depth:0,proofObservationIds:[o.id],proofSpans:[o.source,{file:o.source.file,startLine:x.startPosition.row,endLine:x.endPosition.row}]},F=Mt(N);i.has(F)||(i.set(F,N),a.push(N));continue}let I=V(u,S);!I||I.evidence==="expression"||s.push(Qe(u,x,"carrier.publish",l,h,I.value,[o.id]))}}}for(;a.length>0;){let o=a.shift();if(!(o.depth>=fr))try{for(let l of Je(e,o.definition).sites){let u=L(e,l.file);if(!u)continue;let d=l.callNode,c=Pe(d)[o.parameterIndex];if(!c)continue;let p=V(u,c);p&&p.evidence!=="expression"&&s.push(Qe(u,d,"carrier.publish",o.carrier,o.field,p.value,o.proofObservationIds));let f=l.caller;if(!f)continue;let g=ce(e,l).transfers.find(y=>y.calleePosition===o.parameterIndex)?.callerPosition;if(g===void 0)continue;let b={...o,definition:f,parameterIndex:g,depth:o.depth+1,proofSpans:[...o.proofSpans,{file:l.file,startLine:l.startLine,endLine:l.endLine}]},m=Mt(b);i.has(m)||(i.set(m,b),a.push(b))}}catch(l){r.push(`builtin.carrier discriminator summary failed for ${o.definition.relativePath}: ${tt(l)}`)}}return{observations:s,summaries:i.size}}function hr(e,t,n){let r=[],i=t.filter(a=>a.action==="registry.handle"&&a.strength!=="candidate"&&a.sourceScope==="production");for(let a of t){if(a.action!=="http.handle"||a.strength==="candidate"||a.sourceScope!=="production")continue;let s=Ut(a);if(!s)continue;let o=L(e,a.source.file);if(!o)continue;let l=zt(o.root,a.source.startLine)[0];if(l)for(let u of Pe(l).slice(1)){let d=ee(e,a.source.file,u.text);for(let c of d)try{let p=L(e,c.relativePath);if(!p)continue;let f=D(p.root,c.startLine,c.endLine);if(!f)continue;k(f,g=>{if(g.type!=="call_expression")return;let b=et(g);if(!b)return;let m=/^([A-Za-z_$][\w$]*)\s*\[\s*([A-Za-z_$][\w$]*)\s*\]$/u.exec(b.text.trim());if(!m)return;let y=m[1],v=m[2],R=vr(e,p,c,v);if(!R)return;let x=br(e,c.relativePath,y);for(let h of i){let S=h.keyParts.find(F=>F.name==="registry")?.value,B=h.keyParts.find(F=>F.name==="key")?.value;if(!S||!B||!x.some(F=>F.file===h.source.file&&F.binding===S))continue;let I=L(e,h.source.file),N=I?Rr(I.root,h.source.startLine):null;!I||!N||r.push(Qe(I,N,"carrier.consume",s,R,B,[a.id,h.id]))}})}catch(p){n.push(`builtin.carrier consumer analysis failed for ${c.relativePath}: ${tt(p)}`)}}}return r}function Vt(e){let t=_(e.db,e.file),n=new Map;return k(e.root,r=>{if(r.type!=="pair"||jt(r)?.toLowerCase()!=="body")return;let i=Gt(r);if(!i||!/\bJSON\.stringify\s*\(/u.test(i.text))return;let a=xe(t,r.startPosition.row),s=gr(r);if(!a||!s)return;let o=X(s),l=new Set;Br(i,o,l);let u=n.get(a.symbol)??new Set;o.forEach((d,c)=>{d&&l.has(d)&&u.add(c)}),u.size>0&&n.set(a.symbol,u)}),t.flatMap(r=>{let i=n.get(r.symbol);return i?[{definition:r,parameterIndexes:[...i].sort((a,s)=>a-s)}]:[]})}function gr(e){let t=e.parent;for(;t;){if(/(?:function|method|lambda)/u.test(t.type)||t.type==="arrow_function")return t;t=t.parent}return null}function vr(e,t,n,r){let i=D(t.root,n.startLine,n.endLine);if(!i)return null;let a=new RegExp(`\\.body\\??\\.${ge(r)}\\b`,"u");if(a.test(i.text))return r;let s=null;if(k(i,d=>{if(s||d.type!=="variable_declarator")return;let c=d.childForFieldName("name")??d.namedChild(0),p=d.childForFieldName("value")??d.namedChild(1);!c||!p||!new RegExp(`(?:^|[,{}])\\s*${ge(r)}\\s*(?:[,}]|$)`,"u").test(c.text)||p.type==="call_expression"&&(s=et(p)?.text??null)}),!s)return null;let o=ee(e,n.relativePath,s);if(o.length!==1)return null;let l=L(e,o[0].relativePath),u=l?D(l.root,o[0].startLine,o[0].endLine):null;return u&&a.test(u.text)&&new RegExp(`\\b${ge(r)}\\s*[,}]`,"u").test(u.text)?r:null}function br(e,t,n){let r=[];for(let i of ze(e,t,n)){let a=M(i.initializer);if(a.type==="call_expression")for(let s of Pe(a)){let o=s.text.trim();if(/^[A-Za-z_$][\w$]*$/u.test(o))for(let l of ze(e,i.definition.relativePath,o))r.push({file:l.definition.relativePath,binding:l.definition.leaf})}}return[...new Map(r.map(i=>[`${i.file}\0${i.binding}`,i])).values()]}function Qe(e,t,n,r,i,a,s){let l=Ie(e,t,"builtin.carrier",n,[{name:"carrier",value:r,evidence:"constant",term:{kind:"literal",value:r}},{name:"field",value:i,evidence:"literal",term:{kind:"literal",value:i}},{name:"value",value:a,evidence:"constant",term:{kind:"literal",value:a}}],"derived","http-body-registry-discriminator");return l.derivation={kind:"mechanically-derived",rule:"http-body-registry-discriminator",ruleVersion:"1",inputFactIds:[...s],sourceSpans:[l.source]},l}function Ut(e){let t=e.keyParts.find(r=>r.name==="method"&&r.evidence!=="expression")?.value,n=e.keyParts.find(r=>r.name==="path"&&r.evidence!=="expression")?.value;return t&&n?`${t.toUpperCase()} ${n}`:null}function Sr(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=qt([...n.parameterIndexes,...t.parameterIndexes]);return r.length===n.parameterIndexes.length&&t.depth>=n.depth?!1:(e.set(t.definition.symbol,{...n,parameterIndexes:r,depth:Math.min(n.depth,t.depth),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0)}function Mt(e){return`${e.definition.symbol}\0${e.carrier}\0${e.field}\0${e.parameterIndex}`}function xr(e,t){let n=D(e.root,t.startLine,t.endLine);return n?X(n):[]}function Rr(e,t){let n=null;return k(e,r=>{r.startPosition.row>t||r.endPosition.row<t||(!n||r.endIndex-r.startIndex<n.endIndex-n.startIndex)&&(n=r)}),n}function zt(e,t){let n=[];return k(e,r=>{r.type==="call_expression"&&r.startPosition.row<=t&&r.endPosition.row>=t&&n.push(r)}),n.sort((r,i)=>r.endIndex-r.startIndex-(i.endIndex-i.startIndex))}function et(e){return e.childForFieldName("function")??e.namedChild(0)}function Pe(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Cr(e,t){if(!t)return null;let n=t.text.trim();if(!/^[A-Za-z_$][\w$]*$/u.test(n))return M(t);let r=null;return k(e.root,i=>{r||i.type!=="variable_declarator"||(i.childForFieldName("name")??i.namedChild(0))?.text.trim()!==n||(r=i.childForFieldName("value")??i.namedChild(1))}),r?M(r):M(t)}function Nr(e){let t=M(e);return t.type==="object"?t.namedChildren.filter(n=>n.type==="pair"||n.type==="shorthand_property_identifier"):[]}function jt(e){return e.type==="shorthand_property_identifier"?e.text:(e.childForFieldName("key")??e.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"")??null}function Gt(e){return e.type==="shorthand_property_identifier"?e:e.childForFieldName("value")??e.namedChild(1)}function Br(e,t,n){let r=new Set(e.text.match(/[A-Za-z_$][\w$]*/gu)??[]);for(let i of t)i&&r.has(i)&&n.add(i)}function qt(e){return[...new Set(e)].sort((t,n)=>t-n)}function Ir(e){return[...new Map(e.map(t=>[t.id,t])).values()]}function tt(e){return e instanceof Error?e.message:String(e)}import{createHash as Pr}from"crypto";function Kt(e,t){let n=new Map;for(let a of t){if(a.action!=="http.handle"||a.sourceScope!=="production")continue;let s=n.get(a.source.file)??[];s.push(a),n.set(a.source.file,s)}let r=[],i=wr(e);for(let a of i.mounts)for(let s of a.targetFiles)for(let o of n.get(s)??[]){let l=o.keyParts.find(p=>p.name==="path");if(!l||l.evidence==="expression")continue;let u=Fr(a.prefix.value,l.value),d=o.keyParts.map(p=>p.name==="path"?{name:"path",value:u,evidence:"constant",term:{kind:"concat",parts:[a.prefix.term??{kind:"literal",value:a.prefix.value},l.term??{kind:"literal",value:l.value}]},derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[o.id],sourceSpans:[o.source,{file:a.file,startLine:a.line,endLine:a.line},...a.prefix.derivation?.sourceSpans??[],...l.derivation?.sourceSpans??[]]}}:p),c=`${o.id}\0${a.file}\0${a.line}\0${u}`;r.push({...o,id:`boundary:${Pr("sha256").update(c).digest("hex").slice(0,16)}`,keyParts:d,strength:"derived",evidence:"framework-mount-composition",derivation:{kind:"mechanically-derived",rule:"http.mount-prefix",ruleVersion:"1",inputFactIds:[o.id],sourceSpans:[o.source,{file:a.file,startLine:a.line,endLine:a.line}]},resolution:"unresolved"}),o.strength="candidate",o.resolution="unresolved"}return{observations:r,filesInspected:i.filesInspected,mounts:i.mounts.length}}function wr(e){let t=[],n=Se(e);for(let r of n){let i=he(e,r);if(!Tr(i))continue;let a=L(e,r);a&&Xt(a.root,s=>{if(s.type!=="call_expression")return;let o=s.childForFieldName("function")??s.namedChild(0);if(!o||!o.text.replace(/\s+/gu,"").endsWith(".use"))return;let l=_r(s);if(l.length<2)return;let u=V(a,l[0]);if(!u||u.evidence==="expression")return;let d=Er(e,r,l[1]);d.length!==0&&t.push({file:r,line:s.startPosition.row,prefix:{value:u.value,evidence:u.evidence,term:u.term,derivation:u.derivation},targetFiles:d})})}return{mounts:t,filesInspected:n.length}}function Er(e,t,n){let r=n.text.replace(/\s+/gu,""),i=/^([A-Za-z_$][\w$]*)/u.exec(r)?.[1];if(!i)return[];let a=j(e,t).find(l=>l.localName===i&&l.sourcePath);if(!a?.sourcePath)return[t];if(a.kind==="namespace")return[a.sourcePath];let s=a.importedName==="default"?i:a.importedName,o=Z(e,a.sourcePath,s);return[...new Set(o.map(l=>l.relativePath))]}function Fr(e,t){let n=e==="/"?"":e.replace(/\/+$/u,""),r=t.startsWith("/")?t:`/${t}`;return`${n}${r}`||"/"}function Tr(e){return/(?:\bfrom\s*|\brequire\s*\(\s*)['"](?:express|fastify|hono|koa-router|@koa\/router)(?:[/']|")/u.test(e)}function _r(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Xt(e,t){t(e);for(let n of e.namedChildren)Xt(n,t)}import{createHash as $r}from"crypto";function we(e){return[...new Map(e.map(t=>[t.observationId,t])).values()].sort((t,n)=>t.observationId.localeCompare(n.observationId))}var Fe=new Set(["DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT"]),Lr=8,Zt=ie({kind:"runtime-boundary-http-roles",invalidation:ae("runtime-boundary-http-roles"),serialize:Dr,deserialize:Mr});function Jt(e,t,n){let r=n??((m,y)=>y()),i=new Map,a=[],s=[],o=new Set,l=[],u=[],d=new Map,c=new Map,p=new Map,f=m=>{if(d.has(m))return d.get(m)??null;let y=L(e,m);return d.set(m,y),y},g=m=>{let y=c.get(m);if(y)return y;let v=_(e,m);return c.set(m,v),v},b=(m,y)=>{let v=p.get(m.file);if(!v){let h=re(e,m.file,m.source),S=Zt.read(e,m.file,h)??[];v={contentHash:h,roles:new Map(S.map(B=>[B.symbol,B])),dirty:!1},p.set(m.file,v)}let R=v.roles.get(y.symbol);if(R)return R;let x=Ar(m,y);return v.roles.set(y.symbol,{symbol:y.symbol,...x}),v.dirty=!0,x};for(r("runtime-boundaries.http-summary.seed",()=>{for(let m of t){if(m.action!=="http.request"||!m.owner.symbol||m.evidence!=="call-expression"&&m.evidence!=="client-adapter")continue;let y=g(m.owner.file).find(h=>h.symbol===m.owner.symbol);if(!y)continue;let v=f(y.relativePath);if(!v)continue;let R=b(v,y),x={definition:y,...R,constantMethods:m.keyParts.flatMap(h=>h.name==="method"&&h.evidence!=="expression"&&Fe.has(h.value.toUpperCase())?[h.value.toUpperCase()]:[]),depth:0,proofObservationIds:[m.id],proofSpans:[m.source]};Yt(i,x)&&a.push(i.get(y.symbol))}});a.length>0;){let m=a.splice(0,a.length),y=r("runtime-boundaries.http-summary.resolve-call-sites",()=>Ot(e,m.map(v=>v.definition)),{batchSize:m.length});r("runtime-boundaries.http-summary.process-call-sites",()=>{for(let v of m)if(!(v.depth>=Lr))try{let R=y.get(v.definition.symbolId);if(!R)continue;u.push(...R.unresolved.map(x=>kr(v,x)));for(let x of R.sites){let h=f(x.file);if(!h)continue;o.add(x.file);let S=x.callNode,B=Or(v,S,h);B&&s.push(B);let I=x.caller;if(!I)continue;let N=b(h,I),F=Hr(e,v,x),$={definition:I,pathParameterIndexes:Ee([...N.pathParameterIndexes,...F.pathParameterIndexes]),methodParameterIndexes:Ee([...N.methodParameterIndexes,...F.methodParameterIndexes]),constantMethods:ne([...v.constantMethods,...N.constantMethods]),depth:v.depth+1,proofObservationIds:ne([...v.proofObservationIds,...B?[B.id]:[]]),proofSpans:[...v.proofSpans,{file:x.file,startLine:x.startLine,endLine:x.endLine}]};Yt(i,$)&&a.push(i.get(I.symbol))}}catch(R){l.push(`builtin.http-summary failed for ${v.definition.relativePath}:${v.definition.startLine+1}: ${R instanceof Error?R.message:String(R)}`)}},{batchSize:m.length})}return Zt.writeBatch(e,[...p.entries()].flatMap(([m,y])=>y.dirty?[{relativePath:m,contentHash:y.contentHash,value:[...y.roles.values()].sort((v,R)=>v.symbol.localeCompare(R.symbol))}]:[])),{observations:s,frontiers:we(u),summaries:i.size,filesInspected:o.size,errors:l}}function kr(e,t){let n=ne([...e.pathParameterIndexes.length>0?["path"]:[],...e.methodParameterIndexes.length>0&&e.constantMethods.length!==1?["method"]:[]]),r=e.constantMethods.length===1?e.constantMethods[0]:"?",i=`${e.definition.symbol}\0${t.file}\0${t.line}\0${t.reason}`;return{observationId:`frontier:${$r("sha256").update(i).digest("hex").slice(0,16)}`,kind:"call-resolution",action:"http.request",strength:"candidate",source:{file:t.file,startLine:t.line,endLine:t.line},ownerShortName:null,address:`method=${r??"?"} path=?`,reason:`Compiler identity found a reference to ${e.definition.leaf}, but exact call recovery stopped with ${t.reason} (${t.candidates} syntax candidate(s)); HTTP value propagation did not cross this site.`,missingKeyParts:n.length>0?n:["call"],sourceScope:Re(t.file)}}function Or(e,t,n){let r=Qt(t),i=e.pathParameterIndexes.flatMap(c=>{let p=V(n,r[c]);return p&&p.evidence!=="expression"&&Ur(p.value)?[{index:c,value:p}]:[]}),a=e.methodParameterIndexes.flatMap(c=>{let p=V(n,r[c]),f=p?.value.toUpperCase();return p&&f&&p.evidence!=="expression"&&Fe.has(f)?[{index:c,value:{...p,value:f}}]:[]}),s=ne([...e.constantMethods,...a.map(c=>c.value.value)]);if(i.length!==1||s.length!==1)return null;let o=i[0].value,l=a.find(c=>c.value.value===s[0])?.value,u=[{name:"method",value:s[0],evidence:l?"constant":"literal",term:l?.term??{kind:"literal",value:s[0]},derivation:l?.derivation},{name:"path",value:o.value,evidence:"constant",term:o.term,derivation:o.derivation}],d=Ie(n,t,"builtin.http-summary","http.request",u,"derived","compiler-resolved-http-summary");return d.derivation={kind:"mechanically-derived",rule:"compiler-resolved-http-summary",ruleVersion:"1",inputFactIds:e.proofObservationIds,sourceSpans:[...e.proofSpans,d.source]},d}function Ar(e,t){let n=D(e.root,t.startLine,t.endLine);if(!n)return{pathParameterIndexes:[],methodParameterIndexes:[],constantMethods:[]};let r=X(n),i=new Set,a=new Set,s=new Set;return k(n,o=>{if(o.type==="call_expression"&&((o.childForFieldName("function")??o.namedChild(0))?.text.replace(/\s+/gu,"").split(".").at(-1)??"")==="fetch"){let f=Qt(o);pe(f[0],r,i);let g=Vr(f[1],"method");if(g){pe(g,r,a);let b=V(e,g),m=b?.value.toUpperCase();m&&b?.evidence!=="expression"&&Fe.has(m)&&s.add(m)}else pe(f[1],r,a)}if(o.type!=="pair")return;let l=o.childForFieldName("key")??o.namedChild(0),u=o.childForFieldName("value")??o.namedChild(1),d=l?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase();(d==="url"||d==="path"||d==="endpoint")&&pe(u,r,i),(d==="init"||d==="requestinit"||d==="options")&&pe(u,r,a)}),{pathParameterIndexes:r.flatMap((o,l)=>o&&i.has(o)?[l]:[]),methodParameterIndexes:r.flatMap((o,l)=>o&&a.has(o)?[l]:[]),constantMethods:[...s].sort()}}function Dr(e){return e.map(t=>[encodeURIComponent(t.symbol),t.pathParameterIndexes.join(","),t.methodParameterIndexes.join(","),t.constantMethods.join(",")].join(" ")).join(`
|
|
2
|
-
`)}function Mr(e){if(!e)return[];let t=[];for(let n of e.split(`
|
|
3
|
-
`)){let r=n.split(" ");if(r.length!==4)return null;let i=Wt(r[1]),a=Wt(r[2]),s=r[3]?r[3].split(","):[];if(i===null||a===null||s.some(o=>!Fe.has(o)))return null;t.push({symbol:decodeURIComponent(r[0]),pathParameterIndexes:i,methodParameterIndexes:a,constantMethods:s})}return t}function Wt(e){if(!e)return[];let t=e.split(",").map(Number);return t.every(n=>Number.isSafeInteger(n)&&n>=0)?t:null}function Hr(e,t,n){let r=ce(e,n);return{pathParameterIndexes:de(r,t.pathParameterIndexes),methodParameterIndexes:de(r,t.methodParameterIndexes)}}function Yt(e,t){let n=e.get(t.definition.symbol);if(!n)return e.set(t.definition.symbol,t),!0;let r=Ee([...n.pathParameterIndexes,...t.pathParameterIndexes]),i=Ee([...n.methodParameterIndexes,...t.methodParameterIndexes]),a=ne([...n.constantMethods,...t.constantMethods]);return r.length!==n.pathParameterIndexes.length||i.length!==n.methodParameterIndexes.length||a.length!==n.constantMethods.length||t.depth<n.depth?(e.set(t.definition.symbol,{...n,pathParameterIndexes:r,methodParameterIndexes:i,constantMethods:a,depth:Math.min(n.depth,t.depth),proofObservationIds:ne([...n.proofObservationIds,...t.proofObservationIds]),proofSpans:[...n.proofSpans,...t.proofSpans]}),!0):!1}function Vr(e,t){if(!e)return null;for(let n of e.namedChildren)if(!(n.type!=="pair"||(n.childForFieldName("key")??n.namedChild(0))?.text.replace(/^['"`]|['"`]$/gu,"").toLowerCase()!==t))return n.childForFieldName("value")??n.namedChild(1);return null}function pe(e,t,n){if(!e)return;let r=new Set(e.text.match(/[A-Za-z_$][\w$]*/gu)??[]);for(let i of t)i&&r.has(i)&&n.add(i)}function Qt(e){return(e.childForFieldName("arguments")??e.namedChildren.find(n=>n.type==="arguments"))?.namedChildren??[]}function Ur(e){return e.startsWith("/")||/^https?:\/\//iu.test(e)}function Ee(e){return[...new Set(e)].sort((t,n)=>t-n)}function ne(e){return[...new Set(e)].sort()}import{createHash as zr}from"crypto";function nn(e){let t=en(e.filter(r=>r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim")),n=en(e.filter(r=>r.action==="database.write"&&r.evidence==="persistence-insert"));return e.flatMap(r=>r.action==="database.write"&&r.evidence==="persistence-insert"?nt(r).flatMap(i=>{let a=t.get(i)?.[0];return a?[tn(r,a,i,"queue.send")]:[]}):r.action==="database.read"&&r.evidence==="persistence-skip-locked-claim"?nt(r).flatMap(i=>{let a=n.get(i)?.[0];return a?[tn(r,a,i,"queue.consume")]:[]}):[])}function en(e){let t=new Map;for(let n of e)for(let r of nt(n)){let i=t.get(r);i?i.push(n):t.set(r,[n])}for(let n of t.values())n.sort((r,i)=>r.id.localeCompare(i.id));return t}function nt(e){return e.keyParts.filter(t=>t.name==="resource").map(t=>t.value)}function tn(e,t,n,r){let i=`database:${n}`,a=r==="queue.send"?"database-queue-insert":"database-queue-skip-locked-claim",s=[e.id,r,i,a].join("\0");return{...e,id:`boundary:${zr("sha256").update(s).digest("hex").slice(0,16)}`,extractor:"builtin.database-queue",action:r,keyParts:[{name:"address",value:i,evidence:"identifier",term:{kind:"symbol",symbol:n},derivation:{kind:"mechanically-derived",rule:"database-work-queue.resource",ruleVersion:"1",inputFactIds:[e.id,t.id],sourceSpans:[e.source,t.source]}}],evidence:a,strength:"derived",protocol:"queue",role:r==="queue.send"?"producer":"consumer",derivation:{kind:"mechanically-derived",rule:"database-work-queue.insert-skip-locked",ruleVersion:"1",inputFactIds:[e.id,t.id],sourceSpans:[e.source,t.source]},valuePrecision:"symbolic",resolution:"unresolved"}}var ye="runtime-boundaries-v19",qr=Gr(import.meta.url),w=qr("typescript"),Kr=new Set([w.SyntaxKind.WhitespaceTrivia,w.SyntaxKind.NewLineTrivia,w.SyntaxKind.SingleLineCommentTrivia,w.SyntaxKind.MultiLineCommentTrivia]),Xr=new Set([w.SyntaxKind.NoSubstitutionTemplateLiteral,w.SyntaxKind.TemplateHead,w.SyntaxKind.TemplateMiddle,w.SyntaxKind.TemplateTail]),$e=[{id:"http.method-path",protocol:"http",producerActions:["http.request"],consumerActions:["http.handle"],keyNames:["method","path"],traversable:!0},{id:"registry.identity-key",protocol:"registry",producerActions:["registry.dispatch"],consumerActions:["registry.handle"],keyNames:["registry","key"],traversable:!0},{id:"registry.capability-key",protocol:"registry",producerActions:["registry.reference"],consumerActions:["registry.handle"],keyNames:["key"],traversable:!0,requireUniqueConsumer:!0},{id:"queue.address",protocol:"queue",producerActions:["queue.send"],consumerActions:["queue.consume"],keyNames:["address"],traversable:!0},{id:"carrier.discriminator",protocol:"carrier",producerActions:["carrier.publish"],consumerActions:["carrier.consume"],keyNames:["carrier","field","value"],traversable:!0},{id:"resource.identity",protocol:"database",producerActions:["database.write"],consumerActions:["database.read"],keyNames:["resource"],traversable:!1},{id:"framework.effect-httpapi-operation",protocol:"framework",producerActions:[],consumerActions:["framework.handle"],declarationActions:["framework.declare"],keyNames:["adapter","group","operation"],traversable:!0,linkFrom:"declaration",requireUniquePair:!0}],Zr=64,un="builtin.http-summary",Le={HTTP_HANDLE:"http.handle",HTTP_REQUEST:"http.request",REGISTRY_HANDLE:"registry.handle"},rt=new Set(Object.values(Le));async function Wr(e,t={}){let n=Se(e),r=new Set(n),i=new Set((t.affectedFiles??[]).map(gi)),a=t.previousGraph?.fileCoverage,s=i.size>0&&t.previousGraph?.extractorVersion===ye&&a!==void 0&&a.length===t.previousGraph.coverage.filesScanned,o=s?a.filter(C=>r.has(C.file)&&!i.has(C.file)):[],l=new Set(o.flatMap(C=>C.observationIds)),u=s?t.previousGraph.observations.filter(C=>l.has(C.id)&&r.has(C.source.file)):[],d=s?n.filter(C=>i.has(C)):n,c=[],p=a?.reduce((C,P)=>C+P.observationIds.length,0)??0,f=performance.now(),g=await di(e,d,t.profileSpan);G(c,"direct-extraction",f,d.length,g.observations.length,{filesVisited:d.length,filesReused:o.length,factsReused:u.length,factsInvalidated:Math.max(0,p-u.length)});let b=[...o,...g.fileCoverage].sort((C,P)=>C.file.localeCompare(P.file)),m=hi(b),y=b.flatMap(C=>C.extractionErrors),v=fe([...u,...g.observations]);if(s&&!t.forceDerivedRebuild&&t.previousGraph&&Yr(a,g.fileCoverage,i)&&(!ri(e,t.previousGraph,i)||oi(a,g.fileCoverage,i)&&!si(t.previousGraph,i))){for(let P of t.previousGraph.coverage.extractors)m.has(P.id)||m.set(P.id,P);let C=ui(t.previousGraph.coverage.phases);return c.push(...C),{...t.previousGraph,observations:t.previousGraph.observations,relationGroups:t.previousGraph.relationGroups,links:t.previousGraph.links,frontiers:t.previousGraph.frontiers,coverage:{filesScanned:n.length,filesWithAst:b.filter(P=>P.hasAst).length,filesWithoutAst:b.filter(P=>!P.hasAst).length,filesReused:o.length,extractors:[...m.values()],extractionErrors:t.previousGraph.coverage.extractionErrors,phases:c},fileCoverage:b}}let R=fe([...v,...nn(v)]),x=s&&t.previousGraph!==void 0?Jr(t.previousGraph,a,g.fileCoverage,i,v):{reuse:!1,shapeUnchanged:!1,proofFilesUnchanged:!1,seedUnchanged:!1},h=x.reuse;t.profileSpan?.("runtime-boundaries.http-summary.reuse-decision",()=>{},x),f=performance.now();let S;if(h){let C=t.previousGraph.coverage.phases?.find(E=>E.id==="http-summary"),P=t.previousGraph.coverage.extractors.find(E=>E.id==="builtin.wrapper");S={observations:t.previousGraph.observations.filter(E=>E.extractor===un),frontiers:t.previousGraph.frontiers.filter(E=>E.kind==="call-resolution"&&E.action===Le.HTTP_REQUEST),summaries:0,filesInspected:C?.filesVisited??P?.applicableFiles??0,errors:t.previousGraph.coverage.extractionErrors.filter(E=>E.startsWith("builtin.http-summary failed"))},G(c,"http-summary",f,R.length,S.observations.length,{filesVisited:0,filesReused:S.filesInspected,factsReused:S.observations.length+S.frontiers.length,factsInvalidated:0}),P&&m.set(P.id,P)}else S=Jt(e,R,t.profileSpan),G(c,"http-summary",f,R.length,S.observations.length,{filesVisited:S.filesInspected}),m.set("builtin.wrapper",{id:"builtin.wrapper",applicableFiles:S.filesInspected,observations:S.observations.length,errors:S.errors.length});y.push(...S.errors);let B=fe([...R,...S.observations]);f=performance.now();let I=Kt(e,B);G(c,"http-mount",f,B.length,I.observations.length,{filesVisited:I.filesInspected});let N=fe([...B,...I.observations]);f=performance.now();let F=h&&t.previousGraph!==void 0&&Qr(t.previousGraph,a,g.fileCoverage,i),$;if(F){let C=t.previousGraph.coverage.phases?.find(E=>E.id==="carrier"),P=t.previousGraph.coverage.extractors.find(E=>E.id==="builtin.carrier");$={observations:t.previousGraph.observations.filter(E=>E.extractor==="builtin.carrier"),bodySummaries:P?.applicableFiles??0,discriminatorSummaries:0,filesInspected:C?.filesVisited??0,errors:t.previousGraph.coverage.extractionErrors.filter(E=>E.startsWith("builtin.carrier"))},G(c,"carrier",f,N.length,$.observations.length,{filesVisited:0,filesReused:$.filesInspected,factsReused:$.observations.length,factsInvalidated:0}),P&&m.set(P.id,P)}else $=Ht(e,N,b.flatMap(C=>C.bodySummaries??[])),G(c,"carrier",f,N.length,$.observations.length,{filesVisited:$.filesInspected}),m.set("builtin.carrier",{id:"builtin.carrier",applicableFiles:$.bodySummaries,observations:$.observations.length,errors:$.errors.length});y.push(...$.errors);let K=fe([...N,...$.observations]);f=performance.now();let J=vi(K);G(c,"relations",f,K.length,J.length),f=performance.now();let it=Si(K,J);G(c,"links",f,J.length,it.length),xi(K,J),f=performance.now();let at=we([...Ri(K,J),...S.frontiers]);return G(c,"frontiers",f,K.length,at.length),{schemaVersion:2,extractorVersion:ye,observations:K,relationGroups:J,links:it,frontiers:at,coverage:{filesScanned:n.length,filesWithAst:b.filter(C=>C.hasAst).length,filesWithoutAst:b.filter(C=>!C.hasAst).length,...s?{filesReused:o.length}:{},extractors:[...m.values()],extractionErrors:y,phases:c},fileCoverage:b}}function Yr(e,t,n){if(!e)return!1;let r=e.filter(a=>n.has(a.file)).filter(rn).map(an).sort((a,s)=>a.file.localeCompare(s.file)),i=t.filter(rn).map(an).sort((a,s)=>a.file.localeCompare(s.file));return JSON.stringify(r)===JSON.stringify(i)}function rn(e){return e.observationIds.length>0||e.extractionErrors.length>0}function an(e){let{syntaxHash:t,shapeHash:n,bodySummaries:r,...i}=e;return i}function Jr(e,t,n,r,i){let a=ti(t,n,r),s=ni(e),l=![...cn(t,n)].some(p=>s.has(p)),u=new Set((t??[]).filter(p=>r.has(p.file)).flatMap(p=>p.observationIds)),d=new Set(n.flatMap(p=>p.observationIds)),c=on(e.observations,u)===on(i,d);return{reuse:a&&l&&c,shapeUnchanged:a,proofFilesUnchanged:l,seedUnchanged:c}}function cn(e,t){let n=new Map(e?.map(r=>[r.file,r.syntaxHash])??[]);return new Set(t.filter(r=>r.syntaxHash===void 0||n.get(r.file)!==r.syntaxHash).map(r=>r.file))}function Qr(e,t,n,r){if(!t)return!1;let i=t.filter(l=>r.has(l.file)).map(({file:l,bodySummaries:u})=>({file:l,bodySummaries:u??[]})).sort((l,u)=>l.file.localeCompare(u.file)),a=n.map(({file:l,bodySummaries:u})=>({file:l,bodySummaries:u??[]})).sort((l,u)=>l.file.localeCompare(u.file));if(JSON.stringify(i)!==JSON.stringify(a))return!1;let s=cn(t,n),o=ei(e,"builtin.carrier");return![...s].some(l=>o.has(l))}function ei(e,t){let n=new Set;for(let r of e.observations)if(r.extractor===t){n.add(r.source.file);for(let i of r.derivation.sourceSpans)n.add(i.file)}return n}function ti(e,t,n){if(!e)return!1;let r=new Map(e.filter(i=>n.has(i.file)).map(i=>[i.file,i.shapeHash]));return t.length===n.size&&t.every(i=>i.shapeHash!==void 0&&r.get(i.file)===i.shapeHash)}function ni(e){let t=new Set;for(let n of e.observations)if(n.extractor===un){t.add(n.source.file);for(let r of n.derivation.sourceSpans)t.add(r.file)}for(let n of e.frontiers)n.kind==="call-resolution"&&n.action===Le.HTTP_REQUEST&&n.source&&t.add(n.source.file);return t}function on(e,t){return JSON.stringify(e.filter(n=>t.has(n.id)&&n.action===Le.HTTP_REQUEST&&n.owner.symbol!==null&&(n.evidence==="call-expression"||n.evidence==="client-adapter")).map(n=>({ownerSymbol:n.owner.symbol,evidence:n.evidence,methods:n.keyParts.filter(r=>r.name==="method"&&r.evidence!=="expression").map(r=>r.value.toUpperCase()).sort()})).sort((n,r)=>`${n.ownerSymbol}\0${n.evidence}\0${n.methods.join(",")}`.localeCompare(`${r.ownerSymbol}\0${r.evidence}\0${r.methods.join(",")}`)))}function ri(e,t,n){let r=ii(t),i=ai(t);if([...n].some(o=>r.has(o)))return!0;if(i.size===0||n.size===0)return!1;if(!!!e.get("SELECT 1 AS present FROM mentions WHERE role != 1 LIMIT 1"))return!0;let s=[...n];for(let o=0;o<s.length;o+=750){let l=s.slice(o,o+750),u=l.map(()=>"?").join(",");if(e.all(`SELECT DISTINCT global_symbol.symbol
|
|
4
|
-
FROM mentions mention
|
|
5
|
-
JOIN chunks reference_chunk ON reference_chunk.id = mention.chunk_id
|
|
6
|
-
JOIN documents reference_document ON reference_document.id = reference_chunk.document_id
|
|
7
|
-
JOIN global_symbols global_symbol ON global_symbol.id = mention.symbol_id
|
|
8
|
-
WHERE mention.role != 1
|
|
9
|
-
AND reference_document.relative_path IN (${u})`,...l).some(c=>i.has(c.symbol)))return!0}return!1}function ii(e){let t=new Set;for(let n of e.observations)if(rt.has(n.action)){t.add(n.source.file);for(let r of n.derivation?.sourceSpans??[])t.add(r.file)}for(let n of e.frontiers)!n.action||!rt.has(n.action)||!n.source||t.add(n.source.file);return t}function ai(e){return new Set(e.observations.flatMap(t=>rt.has(t.action)&&t.owner.symbol?[t.owner.symbol]:[]))}function oi(e,t,n){if(!e)return!1;let r=new Map(e.filter(i=>n.has(i.file)).map(i=>[i.file,i.syntaxHash]));return t.length===n.size&&t.every(i=>i.syntaxHash!==void 0&&r.get(i.file)===i.syntaxHash)}function si(e,t){let n=li(e);return[...t].some(r=>n.has(r))}function li(e){let t=new Set;for(let n of e.observations){t.add(n.source.file);for(let r of n.derivation?.sourceSpans??[])t.add(r.file)}for(let n of e.frontiers)n.source&&t.add(n.source.file);return t}function ui(e){return(e??[]).filter(t=>t.id!=="direct-extraction").map(t=>({...t,durationMs:0,filesVisited:0,filesReused:t.filesVisited??0,factsReused:t.outputFacts,factsInvalidated:0}))}function G(e,t,n,r,i,a={}){e.push({id:t,durationMs:Math.max(0,performance.now()-n),inputFacts:r,outputFacts:i,...a})}var ci=256;async function di(e,t,n){let r=[],i=[],a=n??((c,p)=>p()),s=[],o=[],l=new Map,u=c=>{let p=l.get(c);if(p!==void 0)return p;let f=re(e,c,Me(e,c));return l.set(c,f),f},d=0;for(let c of t){d+=1,d>=ci&&(d=0,await jr());let p=a("runtime-boundaries.file.read",()=>Me(e,c)),f=re(e,c,p);l.set(c,f);let g=a("runtime-boundaries.file.direct-product",()=>{let h=ln.read(e,c,f);if(!h||h.extractorVersion!==ye)return null;for(let S of h.deps)if(u(S.path)!==S.contentHash)return null;return h});if(g){r.push(...g.observations),i.push(g.coverage);continue}let b=a("runtime-boundaries.file.supports",()=>Xe.filter(h=>h.supports(p))),m=/\bJSON\.stringify\s*\(/u.test(p)&&/\bbody\s*:/u.test(p),y=a("runtime-boundaries.file.hashes",()=>{let h=sn.read(e,c,f);if(h)return h;let S=pi(c,p);return s.push({relativePath:c,contentHash:f,value:S}),S}),v=new Set,R=[],x=ot(h=>v.add(h),()=>{let h=b.length>0||m?L(e,c,p,n):null,S={file:c,hasAst:h!==null||yi(c,p),syntaxHash:y.syntaxHash,shapeHash:y.shapeHash,bodySummaries:h&&m?Vt(h):[],observationIds:[],extractors:[],extractionErrors:[]};if(h)for(let B of b){let I={id:B.id,applicableFiles:1,observations:0,errors:0};try{let N=mi(n,`runtime-boundaries.extractor.${B.id}`,c,()=>B.extract(h));I.observations=N.length,R.push(...N),S.observationIds.push(...N.map(F=>F.id))}catch(N){I.errors=1,S.extractionErrors.push(`${B.id} failed for ${c}: ${N instanceof Error?N.message:String(N)}`)}S.extractors.push(I)}return S});r.push(...R),i.push(x),x.extractionErrors.length===0&&(v.delete(c),o.push({relativePath:c,contentHash:f,value:{extractorVersion:ye,deps:[...v].sort().map(h=>({path:h,contentHash:u(h)})),observations:R,coverage:x}}))}return s.length>0&&sn.writeBatch(e,s),o.length>0&&ln.writeBatch(e,o),{observations:r,fileCoverage:i}}var sn=ie({kind:"runtime-boundary-source-hashes",invalidation:ae("runtime-boundary-source-hashes"),serialize:e=>JSON.stringify(e),deserialize:e=>{try{let t=JSON.parse(e);return typeof t.syntaxHash=="string"&&typeof t.shapeHash=="string"?{syntaxHash:t.syntaxHash,shapeHash:t.shapeHash}:null}catch{return null}}}),ln=ie({kind:"runtime-boundary-direct-extraction",invalidation:ae("runtime-boundary-direct-extraction"),serialize:e=>JSON.stringify(e),deserialize:e=>{try{let t=JSON.parse(e);return typeof t.extractorVersion!="string"||!Array.isArray(t.deps)||!Array.isArray(t.observations)||typeof t.coverage!="object"||t.coverage===null||!t.deps.every(n=>typeof n=="object"&&n!==null&&typeof n.path=="string"&&typeof n.contentHash=="string")?null:t}catch{return null}}});function pi(e,t){if(!/\.(?:[cm]?[jt]sx?)$/iu.test(e)){let u=me("sha256").update(t).digest("hex");return{syntaxHash:u,shapeHash:u}}let n=/\.[jt]sx$/iu.test(e)?w.LanguageVariant.JSX:w.LanguageVariant.Standard,r=w.createScanner(w.ScriptTarget.Latest,!1,n,t),i=me("sha256"),a=me("sha256"),s=[],o=[0];for(let u=0;u<t.length;u+=1)t.charCodeAt(u)===10&&o.push(u+1);let l=0;for(let u=r.scan();u!==w.SyntaxKind.EndOfFileToken;u=r.scan()){if(u===w.SyntaxKind.CloseBraceToken&&s.length>0&&s.at(-1)===0&&(u=r.reScanTemplateToken(!1)),Kr.has(u))continue;let d=r.getTokenText();for(;o[l+1]!==void 0&&o[l+1]<=r.getTokenPos();)l+=1;i.update(String(u)),i.update("\0"),i.update(d),i.update("\0"),i.update(String(l)),i.update("\0"),a.update(String(u)),a.update("\0"),!Xr.has(u)&&!fi(u,d)&&a.update(d),a.update("\0"),a.update(String(l)),a.update("\0"),u===w.SyntaxKind.TemplateHead?s.push(0):u===w.SyntaxKind.TemplateTail?s.pop():u===w.SyntaxKind.OpenBraceToken&&s.length>0?s[s.length-1]+=1:u===w.SyntaxKind.CloseBraceToken&&s.length>0&&s.at(-1)>0&&(s[s.length-1]-=1)}return{syntaxHash:i.digest("hex"),shapeHash:a.digest("hex")}}function fi(e,t){if(e!==w.SyntaxKind.StringLiteral||t.length<2)return!1;let n=t.slice(1,-1);return n.startsWith("/")||n.includes("://")}function mi(e,t,n,r){return e?e(t,r,{file:n}):r()}function yi(e,t){return t?st(e)?/<script\b/iu.test(t):ve(e)!==null:!1}function hi(e){let t=new Map(Xe.map(n=>[n.id,{id:n.id,applicableFiles:0,observations:0,errors:0}]));for(let n of e)for(let r of n.extractors){let i=t.get(r.id);i&&(i.applicableFiles+=r.applicableFiles,i.observations+=r.observations,i.errors+=r.errors)}return t}function gi(e){return e.replaceAll("\\","/").replace(/^\.\//u,"")}function vi(e){let t=new Map;for(let n of $e){let r=new Set([...n.producerActions,...n.consumerActions,...n.declarationActions??[]]);for(let i of e){if(!r.has(i.action)||i.strength==="candidate")continue;let a=Ni(i,n.keyNames);if(!a)continue;let s=a.map(c=>`${c.name}=${pn(c.name,c.value)}`).join("\0"),o=i.sourceScope==="production"?"production":i.sourceScope,l=`${n.id}\0${o}\0${s}`,u=`boundary-group:${me("sha256").update(l).digest("hex").slice(0,16)}`,d=t.get(u)??{id:u,protocol:n.protocol,joinRule:n.id,normalizedKey:s,keyParts:a,producerIds:[],consumerIds:[],declarationIds:[],derivation:{kind:"mechanically-derived",rule:n.id,ruleVersion:"2",inputFactIds:[],sourceSpans:[]}};n.producerActions.includes(i.action)&&d.producerIds.push(i.id),n.consumerActions.includes(i.action)&&d.consumerIds.push(i.id),n.declarationActions?.includes(i.action)&&d.declarationIds.push(i.id),d.derivation.inputFactIds.push(i.id),d.derivation.sourceSpans.push(i.source),t.set(u,d)}}return[...t.values()].map(bi).sort(Ii)}function bi(e){return{...e,producerIds:Te(e.producerIds),consumerIds:Te(e.consumerIds),declarationIds:Te(e.declarationIds),derivation:{...e.derivation,inputFactIds:Te(e.derivation.inputFactIds),sourceSpans:[...new Map(e.derivation.sourceSpans.map(t=>[`${t.file}:${t.startLine}:${t.endLine}`,t])).values()]}}}function Si(e,t){let n=new Map(e.map(i=>[i.id,i])),r=new Map;for(let i of t){let a=$e.find(o=>o.id===i.joinRule);if(!a?.traversable)continue;let s=a.linkFrom==="declaration"?i.declarationIds:i.producerIds;if(!(s.length===0||i.consumerIds.length===0)&&!(a.requireUniquePair&&(s.length!==1||i.consumerIds.length!==1))&&!(a.requireUniqueConsumer&&i.consumerIds.length!==1)&&!(s.length*i.consumerIds.length>Zr))for(let o of s)for(let l of i.consumerIds){let u=n.get(o),d=n.get(l);if(!u||!d||Bi(u,d))continue;let c=u.strength==="derived"||d.strength==="derived"?"derived":"exact",p=`${i.joinRule}\0${o}\0${l}`,f={id:`boundary-link:${me("sha256").update(p).digest("hex").slice(0,16)}`,from:o,to:l,joinRule:i.joinRule,matchedKeyParts:i.keyParts,strength:c,derivation:{kind:"mechanically-derived",rule:i.joinRule,ruleVersion:"2",inputFactIds:[o,l],sourceSpans:[u.source,d.source]}};r.set(f.id,f)}}return[...r.values()].sort(Pi)}function xi(e,t){let n=new Set(t.filter(dn).flatMap(_e)),r=new Set(t.filter(Ci).flatMap(_e));for(let i of e)i.resolution=n.has(i.id)?"locally-linked":r.has(i.id)?"ambiguous":"unresolved"}function Ri(e,t){let n=new Set(e.filter(a=>a.strength!=="candidate").map(a=>`${a.action}\0${a.source.file}\0${a.source.startLine}\0${a.source.endLine}`)),r=new Set(t.flatMap(_e)),i=new Set(t.filter(dn).flatMap(_e));return e.filter(a=>a.sourceScope==="production").filter(a=>a.strength!=="candidate"||!n.has(`${a.action}\0${a.source.file}\0${a.source.startLine}\0${a.source.endLine}`)).filter(a=>!i.has(a.id)).map(a=>{let s=a.keyParts.filter(l=>l.evidence==="expression"||l.value.length===0).map(l=>l.name),o=s.length>0?`${a.extractor} observed ${a.action}, but ${s.join(", ")} remained symbolic or unknown.`:a.resolution==="ambiguous"?`${a.extractor} established the address for ${a.action}, but more than one indexed peer has the same runtime key.`:r.has(a.id)?`${a.extractor} established the address for ${a.action}, but the indexed production scope contains no counterpart role in that relation group.`:`${a.extractor} observed ${a.action}, but no supported factorization rule could establish its addressed relation.`;return{observationId:a.id,reason:o,missingKeyParts:s,sourceScope:a.sourceScope}}).sort((a,s)=>a.observationId.localeCompare(s.observationId))}function _e(e){return[...e.producerIds,...e.consumerIds,...e.declarationIds]}function dn(e){let t=$e.find(r=>r.id===e.joinRule);if(!t)return!1;let n=t.linkFrom==="declaration"?e.declarationIds:e.producerIds;return n.length===0||e.consumerIds.length===0?!1:!t.requireUniquePair||n.length===1&&e.consumerIds.length===1}function Ci(e){let t=$e.find(r=>r.id===e.joinRule);if(!t?.requireUniquePair)return!1;let n=t.linkFrom==="declaration"?e.declarationIds:e.producerIds;return n.length>0&&e.consumerIds.length>0&&(n.length!==1||e.consumerIds.length!==1)}function Ni(e,t){let n=[];for(let r of t){let i=e.keyParts.find(a=>a.name===r);if(!i||i.evidence==="expression"||i.value.length===0)return null;n.push({...i,value:pn(r,i.value)})}return n}function pn(e,t){if(e==="method")return t.toUpperCase();if(e!=="path")return t;let n=t.startsWith("/")?t:`/${t}`;return n.length>1?n.replace(/\/+$/u,""):n}function Bi(e,t){return e.source.file===t.source.file&&e.source.startLine===t.source.startLine}function fe(e){return[...new Map(e.map(t=>[t.id,t])).values()].sort((t,n)=>t.source.file.localeCompare(n.source.file)||t.source.startLine-n.source.startLine||t.action.localeCompare(n.action))}function Te(e){return[...new Set(e)].sort()}function Ii(e,t){return e.joinRule.localeCompare(t.joinRule)||e.normalizedKey.localeCompare(t.normalizedKey)}function Pi(e,t){return e.joinRule.localeCompare(t.joinRule)||e.from.localeCompare(t.from)||e.to.localeCompare(t.to)}import wi from"better-sqlite3";var Oe="scip_query_runtime_boundaries",Y="scip_query_runtime_observations",Ae="scip_query_runtime_relation_groups",De="scip_query_runtime_relation_participants";function Ei(e,t){let n=new wi(e);try{n.exec(`
|
|
10
|
-
CREATE TABLE IF NOT EXISTS ${Oe} (
|
|
11
|
-
singleton INTEGER PRIMARY KEY CHECK (singleton = 1),
|
|
12
|
-
schema_version INTEGER NOT NULL,
|
|
13
|
-
extractor_version TEXT NOT NULL,
|
|
14
|
-
payload TEXT NOT NULL
|
|
15
|
-
)
|
|
16
|
-
`),Ti(n),n.transaction(()=>{n.prepare(`INSERT OR REPLACE INTO ${Oe} (singleton, schema_version, extractor_version, payload) VALUES (1, ?, ?, ?)`).run(t.schemaVersion,t.extractorVersion,JSON.stringify(t)),n.prepare(`DELETE FROM ${Y}`).run(),n.prepare(`DELETE FROM ${De}`).run(),n.prepare(`DELETE FROM ${Ae}`).run();let r=n.prepare(`INSERT INTO ${Y}
|
|
17
|
-
(id, protocol, action, role, strength, source_scope, resolution, file, start_line, end_line, owner_symbol, payload)
|
|
18
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);for(let s of t.observations)r.run(s.id,s.protocol,s.action,s.role,s.strength,s.sourceScope,s.resolution,s.source.file,s.source.startLine,s.source.endLine,s.owner.symbol,JSON.stringify(s));let i=n.prepare(`INSERT INTO ${Ae} (id, protocol, join_rule, normalized_key, payload) VALUES (?, ?, ?, ?, ?)`),a=n.prepare(`INSERT INTO ${De} (group_id, observation_id, participant_role) VALUES (?, ?, ?)`);for(let s of t.relationGroups){i.run(s.id,s.protocol,s.joinRule,s.normalizedKey,JSON.stringify(s));for(let o of s.producerIds)a.run(s.id,o,"producer");for(let o of s.consumerIds)a.run(s.id,o,"consumer");for(let o of s.declarationIds)a.run(s.id,o,"declaration")}})()}finally{n.close()}}function Fi(e,t={}){if(!_i(e,Y))return fn(e)?.observations??[];let n=[],r=[];return ke(n,r,"protocol",t.protocols),ke(n,r,"action",t.actions),ke(n,r,"source_scope",t.sourceScopes),ke(n,r,"file",t.files),e.all(`SELECT payload FROM ${Y}${n.length>0?` WHERE ${n.join(" AND ")}`:""} ORDER BY file, start_line, id`,...r).flatMap(a=>$i(a.payload))}function Ti(e){e.exec(`
|
|
19
|
-
CREATE TABLE IF NOT EXISTS ${Y} (
|
|
20
|
-
id TEXT PRIMARY KEY,
|
|
21
|
-
protocol TEXT NOT NULL,
|
|
22
|
-
action TEXT NOT NULL,
|
|
23
|
-
role TEXT NOT NULL,
|
|
24
|
-
strength TEXT NOT NULL,
|
|
25
|
-
source_scope TEXT NOT NULL,
|
|
26
|
-
resolution TEXT NOT NULL,
|
|
27
|
-
file TEXT NOT NULL,
|
|
28
|
-
start_line INTEGER NOT NULL,
|
|
29
|
-
end_line INTEGER NOT NULL,
|
|
30
|
-
owner_symbol TEXT,
|
|
31
|
-
payload TEXT NOT NULL
|
|
32
|
-
);
|
|
33
|
-
CREATE INDEX IF NOT EXISTS idx_runtime_observations_protocol_action_scope
|
|
34
|
-
ON ${Y}(protocol, action, source_scope);
|
|
35
|
-
CREATE INDEX IF NOT EXISTS idx_runtime_observations_file_line
|
|
36
|
-
ON ${Y}(file, start_line);
|
|
37
|
-
|
|
38
|
-
CREATE TABLE IF NOT EXISTS ${Ae} (
|
|
39
|
-
id TEXT PRIMARY KEY,
|
|
40
|
-
protocol TEXT NOT NULL,
|
|
41
|
-
join_rule TEXT NOT NULL,
|
|
42
|
-
normalized_key TEXT NOT NULL,
|
|
43
|
-
payload TEXT NOT NULL
|
|
44
|
-
);
|
|
45
|
-
CREATE INDEX IF NOT EXISTS idx_runtime_groups_protocol_key
|
|
46
|
-
ON ${Ae}(protocol, join_rule, normalized_key);
|
|
47
|
-
|
|
48
|
-
CREATE TABLE IF NOT EXISTS ${De} (
|
|
49
|
-
group_id TEXT NOT NULL,
|
|
50
|
-
observation_id TEXT NOT NULL,
|
|
51
|
-
participant_role TEXT NOT NULL,
|
|
52
|
-
PRIMARY KEY (group_id, observation_id, participant_role)
|
|
53
|
-
);
|
|
54
|
-
CREATE INDEX IF NOT EXISTS idx_runtime_participants_observation
|
|
55
|
-
ON ${De}(observation_id, participant_role);
|
|
56
|
-
`)}function _i(e,t){return!!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",t)}function ke(e,t,n,r){!r||r.length===0||(e.push(`${n} IN (${r.map(()=>"?").join(", ")})`),t.push(...r))}function $i(e){try{return[JSON.parse(e)]}catch{return[]}}function fn(e){if(!e.get("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?",Oe))return null;let n=e.get(`SELECT schema_version, payload FROM ${Oe} WHERE singleton = 1`);if(!n||n.schema_version!==2)return null;try{let r=JSON.parse(n.payload);return r.schemaVersion===2&&Array.isArray(r.observations)&&Array.isArray(r.relationGroups)&&Array.isArray(r.links)?r:null}catch{return null}}export{Re as a,V as b,Je as c,ce as d,ye as e,Wr as f,Ei as g,Fi as h,fn as i};
|
|
57
|
-
//# sourceMappingURL=chunk-BYDAFMSR.js.map
|
package/dist/chunk-BZYSGZRK.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as i,c as s}from"./chunk-F4FNK44D.js";import{execFileSync as l}from"child_process";import{createRequire as c}from"module";import{existsSync as u}from"fs";import{platform as p,arch as d}from"os";var t="v0.8.1",g="https://github.com/sourcegraph/scip",o=`github.com/sourcegraph/scip/cmd/scip@${t}`,f=c(import.meta.url),m="SCIP_QUERY_SCIP_BIN";function h(e){if(e.isOnPath("scip"))return{source:"path",path:"scip"};let n=e.env[m];if(n&&e.fileExists(n))return{source:"env",path:n};if(e.platform==="win32"){let r=e.resolveSidecar(e.arch);if(r&&e.fileExists(r))return{source:"sidecar",path:r}}return null}function v(e){for(let n of e==="arm64"?["arm64","x64"]:[e])try{return f.resolve(`scip-query-scip-windows/scip-win32-${n}.exe`)}catch{}return null}function a(e=process.env){let n=h({platform:p(),arch:d(),env:e,isOnPath:i,fileExists:u,resolveSidecar:v});return n?.source==="path"?s("scip")??n.path:n?.path??null}function x(){let e=a();if(!e)return null;try{return l(e,["--version"],{stdio:"pipe",timeout:1e4,killSignal:"SIGKILL"}).toString().trim()}catch{return null}}function I(e){if(i("go")){e(`Installing immutable ${o} via go install into the Go bin directory (GOBIN or GOPATH/bin); expected executable: scip.`);try{if(l("go",["install",o],{stdio:"inherit",timeout:3e5,env:process.env}),i("scip")){let n=a(),r=x();if(n&&r&&r.includes(t))return e(`Successfully installed ${o}; resolved executable: ${n}; reported version: ${r}.`),!0;e(`go install completed, but the resolved scip executable did not report ${t} (executable: ${n??"unresolved"}; version: ${r??"unavailable"}).`)}}catch(n){let r=n instanceof Error?n.message:String(n);e(`go install failed: ${r}`)}}return e("Could not auto-install scip CLI."),e(`Install manually from: ${g}/releases`),!1}export{a,I as b};
|
|
2
|
-
//# sourceMappingURL=chunk-BZYSGZRK.js.map
|