codebaseiq 0.3.0 → 0.4.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 +80 -0
- package/dist/augment-vue-worker.js +1 -1
- package/dist/{chunk-7GAK2F3H.js → chunk-23AD24QZ.js} +12 -12
- package/dist/chunk-24TEZJST.js +2 -0
- package/dist/{chunk-356EZBIP.js → chunk-26EDDGAX.js} +2 -2
- package/dist/{chunk-O2M3VNDY.js → chunk-26EZWQ24.js} +2 -2
- package/dist/{chunk-U33PMPNW.js → chunk-2L3NCI52.js} +2 -2
- package/dist/{chunk-MSI3K7PJ.js → chunk-2QJAVISG.js} +2 -2
- package/dist/{chunk-4LK5OIPW.js → chunk-2ZBZRYX4.js} +2 -2
- package/dist/chunk-33AXWMO2.js +2 -0
- package/dist/{chunk-EQNMD62X.js → chunk-37K55EG3.js} +2 -2
- package/dist/{chunk-ITSJMNUD.js → chunk-3EFZ5KQ4.js} +2 -2
- package/dist/{chunk-D7DOB27N.js → chunk-3F23W57G.js} +2 -2
- package/dist/{chunk-BGGB5N53.js → chunk-3GKKCVKK.js} +2 -2
- package/dist/{chunk-MQW6SJ4P.js → chunk-3SYRGMCL.js} +2 -2
- package/dist/{chunk-PFC44E6D.js → chunk-3VDL7GTY.js} +2 -2
- package/dist/{chunk-7JELP5YE.js → chunk-3XBZ5PKL.js} +2 -2
- package/dist/{chunk-75KJGYX7.js → chunk-42PXSE74.js} +2 -2
- package/dist/{chunk-FEIZXBLH.js → chunk-4GIERC2P.js} +2 -2
- package/dist/{chunk-W7YLRXZE.js → chunk-4UXDBRIF.js} +2 -2
- package/dist/chunk-4XMZYLW5.js +2 -0
- package/dist/{chunk-6BF3VYEF.js → chunk-55NUXP2V.js} +2 -2
- package/dist/chunk-5AJQCOZZ.js +21 -0
- package/dist/{chunk-5DSL3NT2.js → chunk-5NUPFZFA.js} +2 -2
- package/dist/{chunk-RJVAPMHF.js → chunk-65QIFIF6.js} +2 -2
- package/dist/{chunk-36JC5BG2.js → chunk-66Q5VLH6.js} +2 -2
- package/dist/{chunk-D7AZAOZX.js → chunk-6CQPIIS7.js} +2 -2
- package/dist/{chunk-GV2CEZCW.js → chunk-6CTSFS7R.js} +2 -2
- package/dist/{chunk-Q4XEU3UH.js → chunk-6EBUAKJT.js} +2 -2
- package/dist/chunk-6I55VYFG.js +4 -0
- package/dist/chunk-6NUURWPF.js +3 -0
- package/dist/{chunk-MHWMEZDA.js → chunk-6P5QMOM7.js} +2 -2
- package/dist/{chunk-LZSQ6X7E.js → chunk-6S5FE4ZF.js} +2 -2
- package/dist/chunk-74LRKLNC.js +22 -0
- package/dist/chunk-75A23IID.js +3 -0
- package/dist/chunk-75VNTSO6.js +7 -0
- package/dist/chunk-7HBBVZJ6.js +3 -0
- package/dist/{chunk-VWYGCMV5.js → chunk-7PPBMBH6.js} +2 -2
- package/dist/{chunk-3RSBGWGL.js → chunk-7WG57A5X.js} +2 -2
- package/dist/{chunk-FWQGH2N2.js → chunk-7XHZX6FX.js} +2 -2
- package/dist/{chunk-RIYJ4L33.js → chunk-A5HJ3CJW.js} +2 -2
- package/dist/{chunk-LONKINMJ.js → chunk-AJ5HVC5Z.js} +2 -2
- package/dist/{chunk-ZAFGY22Q.js → chunk-AYRHOFLV.js} +2 -2
- package/dist/chunk-AZDY3EKD.js +93 -0
- package/dist/{chunk-CW6AXOLR.js → chunk-AZZNG5Z2.js} +2 -2
- package/dist/chunk-BEKCTUPY.js +3 -0
- package/dist/{chunk-CR3OG6SQ.js → chunk-BKKX2OU5.js} +2 -2
- package/dist/{chunk-5LL4KEHO.js → chunk-BQKRYKDD.js} +2 -2
- package/dist/{chunk-FOZ74V56.js → chunk-BVDQU2XJ.js} +2 -2
- package/dist/chunk-C3PPB2T5.js +5 -0
- package/dist/chunk-CABIZQXQ.js +21 -0
- package/dist/{chunk-M2Y6PCFE.js → chunk-CAH322MC.js} +2 -2
- package/dist/{chunk-EIBGSU2R.js → chunk-CBOOHUK4.js} +2 -2
- package/dist/chunk-CFIICAOM.js +2 -0
- package/dist/{chunk-XMJ53WG4.js → chunk-CPWYEPWQ.js} +2 -2
- package/dist/{chunk-LQHYYIOB.js → chunk-CRT7I7RJ.js} +2 -2
- package/dist/{chunk-IZDPGOZR.js → chunk-CZVSQQDU.js} +2 -2
- package/dist/{chunk-TNJGTQWO.js → chunk-D3KE26FS.js} +2 -2
- package/dist/{chunk-GP7C5VAE.js → chunk-DNRHRVKS.js} +2 -2
- package/dist/{chunk-SGMNWYTH.js → chunk-DOQLO74K.js} +2 -2
- package/dist/{chunk-AURCQHSG.js → chunk-DP3EJ6XL.js} +2 -2
- package/dist/{chunk-C7QWUBR2.js → chunk-DQZF7MP6.js} +2 -2
- package/dist/{chunk-E52K4L2W.js → chunk-DTM4EHD2.js} +2 -2
- package/dist/{chunk-YRKP7PM7.js → chunk-DUM7GR6B.js} +2 -2
- package/dist/{chunk-I22IZYDI.js → chunk-DZ4QOIRY.js} +2 -2
- package/dist/{chunk-EXZ7VLRY.js → chunk-E3R6TJ5T.js} +2 -2
- package/dist/chunk-E4DP45YU.js +3 -0
- package/dist/{chunk-PUVNH4PO.js → chunk-E5U6N5WI.js} +2 -2
- package/dist/chunk-E7T22WET.js +21 -0
- package/dist/{chunk-QEOWONKY.js → chunk-ED7ZAZ5V.js} +2 -2
- package/dist/{chunk-RCIGX23V.js → chunk-EDMG5CSO.js} +2 -2
- package/dist/{chunk-IHSLIIL3.js → chunk-EOSUV7H5.js} +2 -2
- package/dist/{chunk-FQTIFWLR.js → chunk-ESWVTSHU.js} +2 -2
- package/dist/{chunk-6VREELBC.js → chunk-ETZBIG6K.js} +2 -2
- package/dist/chunk-EYSJHKX6.js +3 -0
- package/dist/{chunk-Q23IMHXS.js → chunk-F4AGM7ZE.js} +37 -37
- package/dist/{chunk-FTTV7IRX.js → chunk-FPUJRBHL.js} +50 -50
- package/dist/{chunk-CCIYWXX6.js → chunk-G2UU6PQP.js} +2 -2
- package/dist/{chunk-C6WKPKCF.js → chunk-G3KRXNNT.js} +2 -2
- package/dist/{chunk-TEANKHUU.js → chunk-G3ZBP72R.js} +2 -2
- package/dist/{chunk-NBCQZSGR.js → chunk-GC4I33OD.js} +2 -2
- package/dist/{chunk-NDKOVQFG.js → chunk-GLXEWYQY.js} +2 -2
- package/dist/{chunk-AEXQYQD7.js → chunk-GRHNPFHT.js} +2 -2
- package/dist/{chunk-NBZKSTXP.js → chunk-GWESWURK.js} +2 -2
- package/dist/{chunk-Q3ZCQY2Y.js → chunk-GXOFPAIR.js} +2 -2
- package/dist/{chunk-USOAJHY7.js → chunk-H4FGIFEU.js} +2 -2
- package/dist/{chunk-LKUTSP4G.js → chunk-HOGS6JFP.js} +2 -2
- package/dist/{chunk-UQE4XFSA.js → chunk-HSJLK5MC.js} +2 -2
- package/dist/{chunk-BWL3PMPT.js → chunk-HTPEUJ42.js} +2 -2
- package/dist/{chunk-3RR2K7EZ.js → chunk-IBPXUGJV.js} +2 -2
- package/dist/{chunk-BFBIMTCJ.js → chunk-ITA3N7G6.js} +2 -2
- package/dist/chunk-JG5OWAEB.js +22 -0
- package/dist/{chunk-2PRONPAS.js → chunk-JGJKRTTB.js} +2 -2
- package/dist/{chunk-TJWVT4DO.js → chunk-JGXLB7PR.js} +2 -2
- package/dist/{chunk-K7JLSGCJ.js → chunk-JKUF2UG6.js} +3 -3
- package/dist/{chunk-CIYA2KZN.js → chunk-JOYASZRF.js} +2 -2
- package/dist/{chunk-U7NUXDQO.js → chunk-K3PFL5QQ.js} +2 -2
- package/dist/{chunk-WK2IQJPK.js → chunk-KAXBWTSX.js} +2 -2
- package/dist/{chunk-5ZI2PPI7.js → chunk-KHHAGHAW.js} +2 -2
- package/dist/{chunk-UW6KD57C.js → chunk-KJLUQVBG.js} +2 -2
- package/dist/{chunk-WWCV4E6J.js → chunk-KOVUXHIZ.js} +2 -2
- package/dist/chunk-KPMMOAV5.js +4 -0
- package/dist/{chunk-GDHWOA57.js → chunk-LKJZNGMA.js} +2 -2
- package/dist/{chunk-3VJ3OCRE.js → chunk-LMPOC372.js} +2 -2
- package/dist/{chunk-F3QSL4W2.js → chunk-LTPNP6D5.js} +2 -2
- package/dist/{chunk-MVRGB4KJ.js → chunk-M3IBH6C3.js} +9 -9
- package/dist/{chunk-PHNCEUXX.js → chunk-MAGBSB6E.js} +2 -2
- package/dist/{chunk-QMOZZ2VX.js → chunk-MFMHD36E.js} +2 -2
- package/dist/{chunk-LMTSB3TB.js → chunk-MJX2J5QE.js} +2 -2
- package/dist/{chunk-PTQPPPG2.js → chunk-N26LGGSF.js} +2 -2
- package/dist/{chunk-J7AMBVWF.js → chunk-NB2DAVPP.js} +2 -2
- package/dist/{chunk-JYI7CV25.js → chunk-NJDXNYLG.js} +2 -2
- package/dist/{chunk-BRQL7AFJ.js → chunk-NMKQOIYZ.js} +2 -2
- package/dist/{chunk-ICUL7XRT.js → chunk-NRNVMB2R.js} +2 -2
- package/dist/{chunk-DDN2F6GB.js → chunk-O5BWFNIH.js} +2 -2
- package/dist/{chunk-HVFB3PME.js → chunk-O7PCDZ5B.js} +2 -2
- package/dist/{chunk-KPZGTB2O.js → chunk-OAJYNPRU.js} +2 -2
- package/dist/{chunk-2EDX3JT5.js → chunk-OFUC6R46.js} +2 -2
- package/dist/chunk-OSZ7PW5K.js +5 -0
- package/dist/{chunk-B3UYV66Z.js → chunk-OZ2M2X7A.js} +2 -2
- package/dist/{chunk-6O3KXIDL.js → chunk-OZI44VCR.js} +2 -2
- package/dist/{chunk-XN3EKMLI.js → chunk-PCKIKOUA.js} +2 -2
- package/dist/{chunk-NCJILOAK.js → chunk-PFMQRHC6.js} +2 -2
- package/dist/chunk-PVKSZBX5.js +82 -0
- package/dist/{chunk-NEWHKGVD.js → chunk-QANCT4MO.js} +2 -2
- package/dist/{chunk-ZNH33XIB.js → chunk-QEWN7BLP.js} +2 -2
- package/dist/{chunk-OQUCBKOI.js → chunk-QFJ46F6F.js} +2 -2
- package/dist/{chunk-2E6OUPCF.js → chunk-QPQWR6CW.js} +2 -2
- package/dist/{chunk-YTJHCGYB.js → chunk-QX4HDF2I.js} +2 -2
- package/dist/{chunk-J3GLP7Q5.js → chunk-R2F2CTBA.js} +2 -2
- package/dist/{chunk-2OMXFE64.js → chunk-R7PXHYMY.js} +2 -2
- package/dist/{chunk-F74LZWCE.js → chunk-RGBZDOUO.js} +2 -2
- package/dist/{chunk-362QOSFD.js → chunk-RNPG5P4P.js} +2 -2
- package/dist/{chunk-D62CTZX6.js → chunk-RS6UYNEP.js} +2 -2
- package/dist/{chunk-VGWZ4MOY.js → chunk-RVBRPBLQ.js} +2 -2
- package/dist/{chunk-5IZRKWTZ.js → chunk-RWAZCEJD.js} +2 -2
- package/dist/{chunk-ZQ62NNKN.js → chunk-RWDIONS7.js} +2 -2
- package/dist/{chunk-HQA7EBSK.js → chunk-S3CJYDXP.js} +2 -2
- package/dist/{chunk-GL6UTNUB.js → chunk-S6UTKCBT.js} +2 -2
- package/dist/chunk-SLLFJXTW.js +27 -0
- package/dist/{chunk-TOTWJZIX.js → chunk-T3KTMLQT.js} +2 -2
- package/dist/{chunk-67VJAYVR.js → chunk-TB575ZGO.js} +2 -2
- package/dist/{chunk-YHPG3S2U.js → chunk-TG4GMU73.js} +2 -2
- package/dist/{chunk-CVHOQONG.js → chunk-THKM7OXM.js} +2 -2
- package/dist/{chunk-GVAF222T.js → chunk-TNLOX4TN.js} +2 -2
- package/dist/{chunk-HENP2O4A.js → chunk-UHFZDQZJ.js} +2 -2
- package/dist/{chunk-YT4DVWUV.js → chunk-UUMAM5LM.js} +2 -2
- package/dist/{chunk-JX6ZWDOS.js → chunk-UUT5P3V7.js} +2 -2
- package/dist/{chunk-Z6RL7XOE.js → chunk-VEPK6M5C.js} +2 -2
- package/dist/{chunk-C7OUW52M.js → chunk-VPCHKZ3I.js} +2 -2
- package/dist/{chunk-GIDCP7KV.js → chunk-VZY3XOBU.js} +2 -2
- package/dist/{chunk-XQAVQVIL.js → chunk-W6E6ME7G.js} +2 -2
- package/dist/{chunk-XQPPURLQ.js → chunk-WGYZBS5S.js} +2 -2
- package/dist/{chunk-GUFPEFBG.js → chunk-WUP24Q4U.js} +2 -2
- package/dist/chunk-WXUHXSLN.js +2 -0
- package/dist/{chunk-HINZQKSY.js → chunk-X4YZD2MP.js} +2 -2
- package/dist/chunk-XARPGCTL.js +2 -0
- package/dist/{chunk-5FWR5HLG.js → chunk-XDQ6QJF5.js} +20 -20
- package/dist/{chunk-JCMFBF4Z.js → chunk-XRH7R5SX.js} +2 -2
- package/dist/{chunk-BBP7HVBJ.js → chunk-XVJ2E7W7.js} +2 -2
- package/dist/{chunk-D53LWANR.js → chunk-Y7GFAU5N.js} +2 -2
- package/dist/{chunk-T6MQNNAC.js → chunk-YBDLHFZZ.js} +2 -2
- package/dist/{chunk-ZB4C5TTR.js → chunk-YI3CJPOY.js} +2 -2
- package/dist/chunk-YMAGXBLT.js +3 -0
- package/dist/{chunk-MZNMASFM.js → chunk-YRAGNEBZ.js} +2 -2
- package/dist/chunk-YXZAAQHZ.js +3 -0
- package/dist/chunk-Z2L5H2HF.js +3 -0
- package/dist/{chunk-JSNTHRLQ.js → chunk-ZHK7TVAJ.js} +2 -2
- package/dist/chunk-ZJNV27DZ.js +4 -0
- package/dist/{chunk-GQLDYCWS.js → chunk-ZQ6GAIUV.js} +2 -2
- package/dist/{chunk-TPO7XC5Z.js → chunk-ZQE2QYAC.js} +2 -2
- package/dist/chunk-ZUQ2MDFT.js +2 -0
- package/dist/cli-context-4R2LREXQ.js +3 -0
- package/dist/cli-context-6X7JYARX.js +2 -0
- package/dist/cli-failure-RECEHOM2.js +3 -0
- package/dist/cli-program-MXA3WTAO.js +7 -0
- package/dist/cli.js +1 -1
- package/dist/{code-viewer-VHLBLIUM.js → code-viewer-C6HE4DFC.js} +2 -2
- package/dist/{code-viewer-KIXEYQNJ.js → code-viewer-XHSSAMBX.js} +2 -2
- package/dist/{command-descriptors-YCLATF5I.js → command-descriptors-NWW34Z54.js} +171 -171
- package/dist/{command-descriptors-F5P2V3NW.js → command-descriptors-XHK3PK2I.js} +116 -116
- package/dist/{command-panels-SZONPMLJ.js → command-panels-OXMCJ2QZ.js} +2 -2
- package/dist/direct-navigation-236VXYBZ.js +3 -0
- package/dist/direct-navigation-36YSILY6.js +2 -0
- package/dist/index.js +1 -1
- package/dist/invocation-command-descriptors-35JULLNR.js +3 -0
- package/dist/invocation-command-descriptors-FEWSFUO2.js +2 -0
- package/dist/output-continuation-command-MJBVH3A5.js +2 -0
- package/dist/output-continuation-command-TBXIOPHQ.js +3 -0
- package/dist/project-reindex-5TCGOVSK.js +2 -0
- package/dist/project-reindex-BUNTSYKM.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.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/reindex-worker.js +1 -1
- package/dist/reindex.js +30 -30
- package/dist/runtime.js +1 -1
- 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/sentinel-ensure-command-3MZCLPQY.js +2 -0
- package/dist/sentinel-ensure-command-LEWHIRLL.js +3 -0
- package/dist/sentinel-worker.js +1 -1
- package/dist/typescript-mailbox-worker.js +1 -1
- package/dist/watch-server.js +6 -6
- package/docs/COMMAND_REFERENCE.md +2 -2
- package/docs/SECURITY_MODEL.md +3 -0
- package/package.json +1 -1
- package/skills/codebaseiq/SKILL.md +15 -3
- package/dist/chunk-23C5AD3B.js +0 -2
- package/dist/chunk-2I2UHZET.js +0 -2
- package/dist/chunk-5IC2WZAL.js +0 -22
- package/dist/chunk-5T44HG5Y.js +0 -88
- package/dist/chunk-6JMAVFL4.js +0 -3
- package/dist/chunk-6WAPPQ5F.js +0 -82
- package/dist/chunk-7UCDGXRW.js +0 -8
- package/dist/chunk-AQI4N64O.js +0 -22
- package/dist/chunk-DAKIGMIK.js +0 -21
- package/dist/chunk-DUKHVPU5.js +0 -4
- package/dist/chunk-DVWO7RBC.js +0 -2
- package/dist/chunk-FH5WG4LE.js +0 -2
- package/dist/chunk-GQXXOS55.js +0 -2
- package/dist/chunk-GWYZVVKY.js +0 -21
- package/dist/chunk-JFIA2JI3.js +0 -3
- package/dist/chunk-JLZLLLW5.js +0 -3
- package/dist/chunk-MEUHIDI3.js +0 -7
- package/dist/chunk-OFGOOL6U.js +0 -3
- package/dist/chunk-P4NVCOM7.js +0 -2
- package/dist/chunk-SMDIEDM4.js +0 -27
- package/dist/chunk-SX72EVMY.js +0 -3
- package/dist/chunk-T5X7DK6C.js +0 -3
- package/dist/chunk-T75DS2E6.js +0 -21
- package/dist/chunk-TJBOJUVN.js +0 -3
- package/dist/chunk-UC2FD2PS.js +0 -4
- package/dist/chunk-UQYQBLJX.js +0 -5
- package/dist/chunk-Z35GOVEH.js +0 -2
- package/dist/cli-context-FJL2JHOE.js +0 -3
- package/dist/cli-context-PQNWHMCQ.js +0 -2
- package/dist/cli-program-UO7PZD6V.js +0 -7
- package/dist/direct-navigation-4XJTXIDT.js +0 -2
- package/dist/direct-navigation-J5MVYYAD.js +0 -3
- package/dist/invocation-command-descriptors-RWV4VAI4.js +0 -2
- package/dist/invocation-command-descriptors-U76PN7IY.js +0 -3
- package/dist/output-continuation-command-BL25S26S.js +0 -3
- package/dist/output-continuation-command-BTETTXEC.js +0 -2
- package/dist/project-reindex-CRJU3IFG.js +0 -2
- package/dist/project-reindex-TQFCOA2O.js +0 -3
- package/dist/sentinel-ensure-command-OSWGCFFL.js +0 -3
- package/dist/sentinel-ensure-command-SPW7XQLB.js +0 -2
package/dist/chunk-T75DS2E6.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{a as Ee,b as We,e as Kt}from"./chunk-RCIGX23V.js";import{a as _,b as Wt,i as b,j as ie,l as Ce,o as Ae,r as F,s as G}from"./chunk-D7DOB27N.js";import{a as te,c as Ut,d as Jt,e as ne}from"./chunk-6O3KXIDL.js";import{C as Vt,D as K,F as Ge,G as Qt,J as Ht,K as Ve,L as Te,M as Qe,P as He,T as oe,V as Yt,a as R,b as J,c as E,f as w,g as v,h as S,ha as Ue,ia as Je,l as $t,m as Y,q as zt,v as Pe,w as j,x as re}from"./chunk-UQYQBLJX.js";var Xt=["typescript","javascript","java","scala","kotlin","rust","python","ruby","go","cpp","c","csharp","vb","dart","php","clojure"],mo=["entry-surface","generated-code","compatibility-shim","reflection-or-registration","test-fixture","intentional-twin","historical-coupling-ended","detector-counterexample"];var Ye=2,z=3;var Ke=new Set(Xt);function ke(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch(a){return{kind:"malformed",reason:`invalid JSON: ${Pn(a)}`}}if(!_(t))return{kind:"malformed",reason:"metadata must be a JSON object"};let r=t.version;if(!Number.isInteger(r))return{kind:"malformed",reason:"version must be an integer"};if(r!==Ye&&r!==z)return{kind:"unsupported",version:r,direction:r<Ye?"older":"future"};let n=xn(t,r);if(n)return{kind:"malformed",reason:n};let i=t,o={metadata:i,capabilities:In(i)};return r===Ye?{kind:"legacy",...o,metadata:i}:{kind:"supported",...o,metadata:i}}function xo(e){return e.kind==="legacy"||e.kind==="supported"?e.metadata:null}function Zt(e){if(e.kind!=="legacy"&&e.kind!=="supported"||!e.capabilities.stableGenerationIdentity)return null;let t=e.metadata;return JSON.stringify({version:t.version,status:t.status,updatedAt:t.updatedAt,fingerprint:t.fingerprint,indexedLanguages:t.indexedLanguages,scipCompanion:t.scipCompanion,sqliteLayoutVersion:t.version===z?t.sqliteLayoutVersion:void 0})}function In(e){let t=e.fingerprint!==void 0,r=_(e.fingerprint),n=e.indexedLanguages!==void 0,i=e.status==="complete",o=e.version===z?e:null;return{usableForQuery:n,usableForEvidenceCache:t,publishableGeneration:i&&r&&n,stableGenerationIdentity:i&&t&&typeof e.updatedAt=="string",languageShardReuse:!!o?.languageFingerprints,typescriptProjectShardReuse:!!o?.typescriptProjectShards}}function xn(e,t){if(e.status!=="complete"&&e.status!=="partial")return"status must be complete or partial";if(e.updatedAt!==void 0&&!Wt(e.updatedAt))return"updatedAt must be a valid timestamp";for(let r of["requestedLanguages","indexedLanguages"])if(e[r]!==void 0&&!wn(e[r]))return`${r} must contain unique supported languages`;return e.skipped!==void 0&&!Rn(e.skipped)?"skipped must contain supported language/reason pairs":e.scipCompanion!==void 0&&e.scipCompanion!=="current"&&e.scipCompanion!=="deferred"?"scipCompanion must be current or deferred":t===z&&e.sqliteLayoutVersion!==void 0&&(!Number.isSafeInteger(e.sqliteLayoutVersion)||e.sqliteLayoutVersion<1)?"sqliteLayoutVersion must be a positive safe integer":t===z&&e.languageFingerprints!==void 0&&!vn(e.languageFingerprints)?"languageFingerprints must map supported languages to fingerprint objects":t===z&&e.typescriptProjectShards!==void 0&&!En(e.typescriptProjectShards)?"typescriptProjectShards must map project names to file fingerprints":null}function wo(e){return e.version===z&&e.sqliteLayoutVersion===2}function wn(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string"&&Ke.has(t))?!1:new Set(e).size===e.length}function Rn(e){return Array.isArray(e)&&e.every(t=>_(t)&&typeof t.language=="string"&&Ke.has(t.language)&&typeof t.reason=="string")}function vn(e){return _(e)&&Object.entries(e).every(([t,r])=>Ke.has(t)&&_(r))}function En(e){return _(e)&&Object.values(e).every(t=>_(t)&&Array.isArray(t.files)&&t.files.every(zt))}function Pn(e){return e instanceof Error?e.message:String(e)}import Qn from"better-sqlite3";import{createHash as kn,randomUUID as Dn}from"crypto";import{existsSync as W,mkdirSync as Ln,readdirSync as On,rmSync as or,statSync as ar}from"fs";import{basename as Mn,dirname as se,join as I}from"path";import{join as Gn}from"path";function De(e,t){return e.reason instanceof Error?e.reason:new Error(t)}function er(e,t){if(e?.aborted)throw De(e,t)}var Tn=e=>{if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e.pid;return typeof t=="number"&&Number.isSafeInteger(t)&&t>0?{pid:t}:null};function tr(e,t={}){return T(Gn(e,"gc.lock"),t)}function T(e,t={}){let r=t.waitMs??0,n=t.pollMs??10,i=t.now??te,o=i()+r;do{let a=rr(e);if(a)return nr(a);let s=o-i();if(s<=0)return null;Cn(Math.min(n,s))}while(i()<=o);return null}async function Co(e,t={}){let r=t.waitMs??0,n=t.pollMs??10,i=t.now??te,o=i()+r;do{er(t.signal,"Lock acquisition was aborted.");let a=rr(e);if(a)return nr(a);let s=o-i();if(s<=0)return null;await An(Math.min(n,s),t.signal)}while(i()<=o);return null}function rr(e){let t=Ce(e,{kind:"generic",parseLegacy:Tn});return t.kind==="acquired"?t.lock:null}function nr(e){return{release:()=>{e.release()}}}function Cn(e){let t=new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));Atomics.wait(t,0,0,e)}function An(e,t){return t?.aborted?Promise.reject(De(t,"Lock acquisition was aborted.")):new Promise((r,n)=>{let i=setTimeout(()=>{t?.removeEventListener("abort",o),r()},e),o=()=>{clearTimeout(i),t?.removeEventListener("abort",o),n(t?De(t,"Lock acquisition was aborted."):new Error("Lock acquisition was aborted."))};t?.addEventListener("abort",o,{once:!0})})}var V=1,tt=1,ce=".codebaseiq-generations",Le="manifest.json",sr="readers",_n="gc.lock",jn=128,ae=new Map,cr={pid:process.pid,now:()=>new Date,randomToken:()=>Dn(),isProcessAlive:ie,readProcessIdentity:ne,resolveImmutableGeneration:lr};function m(e){return I(se(e),ce)}function de(e){return I(m(e),_n)}function dr(e,t=cr){let r=T(de(e.dbPath),{waitMs:5e3});if(!r)throw new Error("SQLite generation retention is busy; retry opening the index.");let n;try{let o=C(e.dbPath);if(!o||!le(e.dbPath,o.currentGeneration))return{generation:nt(e),release(){}};let a=t.randomToken();if(!/^[A-Za-z0-9._-]+$/.test(a))throw new Error("SQLite generation reader token is unsafe.");let s=I(m(e.dbPath),sr);Ln(s,{recursive:!0});let c=I(s,`${t.pid}-${a}.json`),d=t.readProcessIdentity(t.pid);F(c,{version:1,token:a,generationIdentity:o.currentGeneration,pid:t.pid,...d?{processIdentity:d}:{},acquiredAt:t.now().toISOString()},{spacing:2,trailingNewline:!0});let l=!1;n={identity:o.currentGeneration,required:o.artifactSet==="immutable-v1",release(){l||(l=!0,or(c,{force:!0}))}}}finally{r.release()}let i;try{i=t.resolveImmutableGeneration(e,n.identity)}catch(o){throw n.release(),o}if(i?.source==="immutable"&&i.identity===n.identity)return{generation:i,release:n.release};if(n.release(),n.required)throw new Error(`Published SQLite generation ${n.identity} is missing or invalid.`);return Fn(e,n.identity)}function Fn(e,t){let r=T(de(e.dbPath),{waitMs:5e3});if(!r)throw new Error("SQLite generation retention is busy; retry opening the index.");try{let n=C(e.dbPath);if(n?.currentGeneration!==t)throw new Error("SQLite index publication changed while opening a legacy generation.");if(W(I(se(e.dbPath),"index.lock")))throw new Error("Legacy SQLite publication is in progress; retry after the reindex lock is released.");return{generation:ur(e,n.currentGeneration),release(){}}}finally{r.release()}}function rt(e,t,r=cr,n={}){let i=I(m(e),sr);if(!W(i))return{protectedGenerations:new Set,activeLeases:0,staleLeasesRemoved:0,malformedLeases:0};let o=new Set,a=0,s=0,c=0;for(let d of On(i,{withFileTypes:!0})){if(!d.isFile()||!d.name.endsWith(".json"))continue;let l=I(i,d.name),p;try{p=Nn(JSON.parse(S(l,"SQLite generation reader lease")))}catch{p=null}if(!p){c+=1;for(let h of t)o.add(h);continue}if(!qn(p,r)){n.removeStale!==!1&&(or(l,{force:!0}),s+=1);continue}a+=1,o.add(p.generationIdentity)}return{protectedGenerations:o,activeLeases:a,staleLeasesRemoved:s,malformedLeases:c}}function Nn(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,r=t.processIdentity===void 0?null:Ut(t.processIdentity);return t.version!==1||typeof t.token!="string"||t.token.trim()===""||typeof t.generationIdentity!="string"||!/^[a-f0-9]{64}$/.test(t.generationIdentity)||typeof t.pid!="number"||!Number.isSafeInteger(t.pid)||t.pid<=0||typeof t.acquiredAt!="string"||!Number.isFinite(Date.parse(t.acquiredAt))||t.processIdentity!==void 0&&(!r||r.pid!==t.pid)?null:{version:1,token:t.token,generationIdentity:t.generationIdentity,pid:t.pid,...r?{processIdentity:r}:{},acquiredAt:t.acquiredAt}}function qn(e,t){if(!t.isProcessAlive(e.pid))return!1;if(!e.processIdentity)return!0;let r=t.readProcessIdentity(e.pid);return r===null||Jt(e.processIdentity,r)}function C(e){try{let t=JSON.parse(S(I(m(e),"state.json"),"SQLite generation state"));return $n(t)?t:null}catch{return null}}function le(e,t){return ue(m(e),t)}function ue(e,t){try{let r=JSON.parse(S(I(e,t,Le),"SQLite generation manifest"));return Bn(r,t)?r:null}catch{return null}}function nt(e){let t=C(e.dbPath);if(t){let r=lr(e,t.currentGeneration);if(r)return r;if(t.artifactSet==="immutable-v1")throw new Error(`Published SQLite generation ${t.currentGeneration} is missing or invalid.`)}if(W(I(se(e.dbPath),"index.lock")))throw new Error("Legacy SQLite publication is in progress; retry after the reindex lock is released.");return ur(e,t?.currentGeneration)}function Bo(e){let t=C(e);if(t)return t.currentGeneration;try{let r=I(se(e),"meta.json"),n=W(r)?S(r,"reindex metadata"):void 0;return pr(e,n)}catch{return null}}function N(e){return Zt(ke(e))??e}function lr(e,t){try{let r=I(m(e.dbPath),t),n=le(e.dbPath,t);if(!n)return null;let i=Xe(r,n.database),o=n.index?Xe(r,n.index):void 0,a=n.metadata?Xe(r,n.metadata):void 0;return!Ze(i,n.database)||n.index&&(!o||!Ze(o,n.index))||n.metadata&&(!a||!Ze(a,n.metadata))?null:{identity:t,databasePath:i,...o?{indexPath:o}:{},...a?{metadataPath:a,metadataRaw:S(a,"reindex metadata")}:{},source:"immutable"}}catch{return null}}function ur(e,t){let r=O(e.dbPath),n=I(se(e.dbPath),"meta.json"),i=W(n)?S(n,"reindex metadata"):void 0,o=W(e.indexPath)?e.indexPath:void 0;return{identity:t??pr(e.dbPath,i),databasePath:e.dbPath,...o?{indexPath:o}:{},...i===void 0?{}:{metadataPath:n,metadataRaw:i},source:"legacy",databaseFileIdentity:r}}function pr(e,t){let r=kn("sha256").update("sqlite-generation-legacy-v1\0");return t!==void 0&&r.update(N(t)),r.update(`\0${O(e)}`),r.digest("hex")}function O(e){let t=ar(e);return`${t.dev}:${t.ino}:${t.size}:${t.mtimeMs}`}function Xe(e,t){if(Mn(t.file)!==t.file||t.file==="."||t.file==="..")throw new Error("SQLite generation manifest contains an unsafe artifact path");return I(e,t.file)}function Ze(e,t){if(!W(e))return!1;let r=ir(e);if(!r||r.size!==t.size)return!1;let n=`${e}\0${t.sha256}\0${r.identity}`;if(ae.has(n))return!0;let i=Y(e,{inputKind:"immutable SQLite generation artifact",maxBytes:t.size}),o=ir(e);if(!o||o.identity!==r.identity||i!==t.sha256)return!1;for(ae.set(n,!0);ae.size>jn;){let a=ae.keys().next().value;if(a===void 0)break;ae.delete(a)}return!0}function ir(e){let t=ar(e,{bigint:!0});return t.isFile()?{identity:`${t.dev}:${t.ino}:${t.size}:${t.mtimeNs}:${t.ctimeNs}`,size:Number(t.size)}:null}function Bn(e,t){return e.version===tt&&e.identity===t&&et(e.database)&&(e.index===void 0||et(e.index))&&(e.metadata===void 0||et(e.metadata))}function et(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.file=="string"&&!!t.file&&Number.isSafeInteger(t.size)&&(t.size??-1)>=0&&typeof t.sha256=="string"&&/^[a-f0-9]{64}$/.test(t.sha256)}function $n(e){return e.version===V&&typeof e.currentGeneration=="string"&&!!e.currentGeneration&&typeof e.publishedAt=="string"&&Number.isFinite(Date.parse(e.publishedAt))&&(e.artifactSet===void 0||e.artifactSet==="immutable-v1")&&zn(e.stableMirrors)&&Wn(e.previousGeneration)&&Vn(e.publication)}function zn(e){if(e===void 0)return!0;if(!e||typeof e!="object")return!1;let t=e;return typeof t.databaseFileIdentity=="string"&&!!t.databaseFileIdentity&&(t.indexFileIdentity===void 0||typeof t.indexFileIdentity=="string"&&!!t.indexFileIdentity)}function Wn(e){if(e===void 0)return!0;if(!e||typeof e!="object")return!1;let t=e;return typeof t.generationIdentity=="string"&&!!t.generationIdentity&&typeof t.databasePath=="string"&&!!t.databasePath&&(t.metadataPath===void 0||typeof t.metadataPath=="string"&&!!t.metadataPath)}function Vn(e){if(e===void 0)return!0;if(!e||typeof e!="object")return!1;let t=e,r=[t.converterDurationMs,t.affectedDocumentCount,t.changedDocumentCount,t.producerDurationMs,t.materializationDurationMs,t.patchDurationMs].filter(n=>n!==void 0);return(t.mode==="incremental"||t.mode==="full")&&t.validation==="passed"&&t.converterDurationMs!==void 0&&r.every(n=>typeof n=="number"&&Number.isFinite(n)&&n>=0)&&(t.scipCompanion===void 0||t.scipCompanion==="current"||t.scipCompanion==="deferred")&&(t.typescriptOverlayGeneration===void 0||typeof t.typescriptOverlayGeneration=="string"&&!!t.typescriptOverlayGeneration)&&(t.scipCompanion!=="deferred"||!!t.typescriptOverlayGeneration)&&(t.fallbackReason===void 0||typeof t.fallbackReason=="string")}var Hn=["busy_timeout = 5000","query_only = ON","temp_store = MEMORY","cache_size = -64000","mmap_size = 268435456"],it=class{constructor(t,r){this.connection=t;this.releaseGenerationReader=r}connection;releaseGenerationReader;active=!0;initialize(t){try{for(let r of Hn)this.connection.pragma(r);t(this.connection)}catch(r){try{this.close()}catch(n){throw new AggregateError([r,n],"SQLite initialization and rollback both failed.",{cause:n})}throw r}}close(){if(!this.active)return;this.active=!1;let t,r;try{this.connection.close()}catch(n){t=n}try{this.releaseGenerationReader()}catch(n){r=n}if(t!==void 0&&r!==void 0)throw new AggregateError([t,r],"SQLite connection close and generation-reader release both failed.");if(t!==void 0)throw t;if(r!==void 0)throw r}},Un=["node_modules",".git","dist","build","out","coverage","target",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs",".codebaseiq-cache","__pycache__",".venv","venv"],fr=class{db;config;generation;pathFilter;connection;connectionOwnership;statementCache=new Map;closed=!1;constructor(t,r){this.config=t,this.pathFilter=r??null;let n=Xn(t),i=new it(n.db,n.release);try{i.initialize(Kn),this.generation=n.generation,this.connection=n.db,this.connectionOwnership=i,this.db=Jn(n.db)}catch(o){try{i.close()}catch(a){throw new AggregateError([o,a],"SQLite construction and rollback both failed.",{cause:a})}throw o}}isIgnored(t){return this.pathFilter?.isIgnored(t)??!1}get localSymbolPredicate(){return`(
|
|
2
|
-
EXISTS (
|
|
3
|
-
SELECT 1
|
|
4
|
-
FROM defn_enclosing_ranges local_der
|
|
5
|
-
JOIN documents local_d ON local_der.document_id = local_d.id
|
|
6
|
-
WHERE local_der.symbol_id = gs.id
|
|
7
|
-
${this.pathExclusionsFor("local_d").trimStart()}
|
|
8
|
-
)
|
|
9
|
-
OR EXISTS (
|
|
10
|
-
SELECT 1
|
|
11
|
-
FROM mentions local_m
|
|
12
|
-
JOIN chunks local_c ON local_m.chunk_id = local_c.id
|
|
13
|
-
JOIN documents local_d ON local_c.document_id = local_d.id
|
|
14
|
-
WHERE local_m.symbol_id = gs.id
|
|
15
|
-
AND local_m.role = 1
|
|
16
|
-
${this.pathExclusionsFor("local_d").trimStart()}
|
|
17
|
-
)
|
|
18
|
-
)`}get pathExclusions(){return this.pathExclusionsFor("d")}get symbolNoise(){return this.symbolNoiseFor("gs")}pathExclusionsFor(...t){return t.flatMap(r=>Un.flatMap(n=>[`AND ${r}.relative_path NOT LIKE '${n}/%'`,`AND ${r}.relative_path NOT LIKE '%/${n}/%'`])).join(`
|
|
19
|
-
`)}symbolNoiseFor(t){return`AND ${t}.symbol NOT LIKE '%().(%' AND ${t}.symbol NOT LIKE '%typeLiteral%'`}all(t,...r){return this.statement(t).all(...r)}get(t,...r){return this.statement(t).get(...r)}close(){if(this.closed)return;this.closed=!0,this.statementCache.clear();let t,r;try{Kt(this)}catch(n){t=n}try{this.connectionOwnership.close()}catch(n){r=n}if(t!==void 0&&r!==void 0)throw new AggregateError([t,r],"Database-owned resource and SQLite connection cleanup both failed.");if(t!==void 0)throw t;if(r!==void 0)throw r}statement(t){let r=this.statementCache.get(t);return r||(r=this.connection.prepare(t),this.statementCache.set(t,r)),r}};function Jn(e){return Object.freeze({prepare(t){let r=e.prepare(t);if(!r.readonly||!r.reader)throw new Error("ScipDatabase.db only permits read-only statements that return rows.");return Yn(r)}})}function Yn(e){let t={get:(...r)=>e.get(...r),all:(...r)=>e.all(...r),iterate:(...r)=>e.iterate(...r),pluck(r){return r===void 0?e.pluck():e.pluck(r),t},expand(r){return r===void 0?e.expand():e.expand(r),t},raw(r){return r===void 0?e.raw():e.raw(r),t},bind(...r){return e.bind(...r),t},columns:()=>e.columns(),safeIntegers(r){return r===void 0?e.safeIntegers():e.safeIntegers(r),t}};return Object.freeze(t)}function Kn(e){if(!e.prepare("SELECT 1 AS present FROM sqlite_master WHERE type = 'table' AND name = 'documents'").get())return;let r=e.prepare("SELECT relative_path FROM documents").iterate();for(let n of r)Ge(n.relative_path)}function Xn(e){for(let t=0;t<4;t+=1){let r=dr(e),n=r.generation,i;try{i=new Qn(Ee(n.databasePath),{readonly:!0,fileMustExist:!0})}catch(o){throw r.release(),o}if(n.source==="immutable")return{db:i,generation:n,release:r.release};try{let o=nt(e);if(n.databaseFileIdentity===O(n.databasePath)&&o.source==="legacy"&&o.identity===n.identity&&o.databaseFileIdentity===n.databaseFileIdentity&&o.metadataRaw===n.metadataRaw)return{db:i,generation:n,release:r.release}}catch(o){throw i.close(),r.release(),o}i.close(),r.release()}throw new Error("SQLite index publication changed repeatedly while opening a coherent generation.")}import{createHash as ln,randomUUID as to}from"crypto";import{existsSync as B,lstatSync as Ct,mkdirSync as ee,readdirSync as un,realpathSync as pn,renameSync as U,rmSync as q,statSync as $e}from"fs";import{dirname as At,join as u,resolve as we}from"path";import{setTimeout as ro}from"timers/promises";import{pathToFileURL as an}from"url";import{deserializeSCIP as fn}from"@c4312/scip";import no from"better-sqlite3";import{execFileSync as Zn}from"child_process";import{existsSync as ei,readdirSync as mr}from"fs";import{extname as yr,join as hr}from"path";var Sr=new Set([".git",".hg",".svn",".idea",".vscode","node_modules","vendor","dist","build","target","bin","obj",".dart_tool",".gradle",".next",".venv","venv","__pycache__"]),ti=[{language:"typescript",files:["tsconfig.json","tsconfig.base.json"],extensions:[".ts",".tsx",".mts",".cts"]},{language:"rust",files:["Cargo.toml"],extensions:[".rs"]},{language:"go",files:["go.mod"],extensions:[".go"]},{language:"java",files:["pom.xml","build.gradle","build.gradle.kts"],extensions:[".java"]},{language:"kotlin",files:["build.gradle.kts"],extensions:[".kt",".kts"]},{language:"scala",files:["build.sbt"],extensions:[".scala"]},{language:"clojure",files:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"],extensions:[".clj",".cljs",".cljc"]},{language:"python",files:["pyproject.toml","setup.py","setup.cfg","Pipfile"],extensions:[".py",".pyi"]},{language:"ruby",files:["Gemfile"],extensions:[".rb"]},{language:"cpp",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"]},{language:"c",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".c",".h"]},{language:"csharp",globs:["*.csproj","*.sln"],extensions:[".cs"]},{language:"vb",globs:["*.vbproj"],extensions:[".vb"]},{language:"dart",files:["pubspec.yaml"],extensions:[".dart"]},{language:"php",files:["composer.json"],extensions:[".php"]},{language:"javascript",files:["package.json"],extensions:[".js",".jsx",".mjs",".cjs"]}];function ot(e){let t=[],r=ri(e),n=ai(e);for(let i of ti){if(ni(e,i.files)){t.push(i.language);continue}if(ii(r,i.globs)){t.push(i.language);continue}ci(n,i.extensions)&&t.push(i.language)}return t.includes("typescript")&&gr(t,"javascript"),t.includes("cpp")&&!n.has(".c")&&gr(t,"c"),t}function ri(e){try{return mr(e)}catch{return[]}}function ni(e,t){return t?.length?t.some(r=>ei(hr(e,r))):!1}function ii(e,t){return t?.length?e.some(r=>t.some(n=>oi(r,n))):!1}function oi(e,t){if(t==="*")return!0;if(!t.includes("*"))return e===t;let[r,n]=t.split("*");return e.startsWith(r??"")&&e.endsWith(n??"")}function ai(e){let t=si(e);if(t)return t;let r=new Set,n=[e];for(;n.length>0;){let i=n.pop();if(!i)continue;let o;try{o=mr(i,{withFileTypes:!0})}catch{continue}for(let a of o){if(a.name.startsWith(".")&&!a.name.endsWith("proj")&&!a.name.endsWith("sln")&&a.isDirectory())continue;let s=hr(i,a.name);if(a.isDirectory()){Sr.has(a.name)||n.push(s);continue}let c=yr(a.name).toLowerCase();c&&r.add(c)}}return r}function si(e){try{let t=Zn("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL"}),r=new Set;for(let n of t.split(`
|
|
20
|
-
`)){if(!n||n.split("/").some(o=>Sr.has(o)))continue;let i=yr(n).toLowerCase();i&&r.add(i)}return r}catch{return null}}function ci(e,t){return t?.length?t.some(r=>e.has(r)):!1}function gr(e,t){let r=e.indexOf(t);r!==-1&&e.splice(r,1)}import{lstatSync as wi,readdirSync as Ri}from"fs";import{join as vi,relative as Ei,resolve as gt,sep as Pi}from"path";import{createHash as di}from"crypto";import{existsSync as pe,mkdirSync as li,readdirSync as br,renameSync as ui,rmSync as Ir,writeFileSync as pi}from"fs";import{join as M}from"path";import{create as wr,fromBinary as Rr,toBinary as fi}from"@bufbuild/protobuf";import{deserializeSCIP as Oe,DocumentSchema as st,IndexSchema as vr,serializeSCIP as Er}from"@c4312/scip";var Me=1,fe="typescript-scip-fragments";function aa(e){if(e.length===0)throw new Error("affected TypeScript mini index requires documents");let t=new Set,r=[];for(let o of e){let a=Q(o.relativePath);if(t.has(a))throw new Error(`duplicate TypeScript fragment replacement: ${a}`);if(t.add(a),o.bytes===null)throw new Error(`affected TypeScript mini index cannot contain a deleted document: ${a}`);let s=Rr(st,o.bytes);if(s.relativePath!==a)throw new Error(`TypeScript fragment path mismatch: expected ${a}, got ${s.relativePath}`);r.push(s)}let n=Er(wr(vr,{documents:r,externalSymbols:[]})),i=Oe(n);if(i.documents.length!==r.length||i.externalSymbols.length!==0)throw new Error("affected TypeScript SCIP index failed structural verification");return n}function ge(e){let t=M(e,fe);return{rootDir:t,blobDir:M(t,"blobs"),generationDir:M(t,"generations")}}function gi(e){let t=Oe(e.indexBytes);Or(t.metadata,Mr(e)),Lr(t.externalSymbols);let r=new Set,n=[];for(let o of t.documents){let a=Q(o.relativePath);if(r.has(a))throw new Error(`duplicate TypeScript SCIP document path: ${a}`);r.add(a);let s=fi(st,o),c=e.documentIdentities.get(a)??(e.allowUntrackedDocuments?H(JSON.stringify({version:1,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,untrackedDocument:a,contentHash:H(s)})):null);if(!c)throw new Error(`missing TypeScript document identity: ${a}`);n.push(Cr(e.cacheDir,{relativePath:a,bytes:s,occurrences:o.occurrences.length,symbols:o.symbols.length,referenceFragments:[]},c))}let i=Ar(e,n);return kr(e.cacheDir,i),i}function sa(e){let t=ge(e.cacheDir);if(!pe(dt(t,e.generationIdentity)))return gi(e);let r=Pr({cacheDir:e.cacheDir,generationIdentity:e.generationIdentity,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity});if(!e.allowUntrackedDocuments&&r.manifest.documents.length!==e.documentIdentities.size)throw new Error("TypeScript fragment generation document identities changed");for(let n of r.manifest.documents){let i=e.documentIdentities.get(n.relativePath);if(!(i===void 0&&e.allowUntrackedDocuments)&&i!==n.documentIdentity)throw new Error(`TypeScript fragment generation document identity changed: ${n.relativePath}`)}return r.manifest}function ca(e){let t=Pr({cacheDir:e.cacheDir,generationIdentity:e.previousGenerationIdentity,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity}).manifest,r=new Map(t.documents.map(o=>[o.relativePath,o])),n=new Set;for(let o of e.fragments){let a=Q(o.relativePath);if(n.has(a))throw new Error(`duplicate TypeScript fragment replacement: ${a}`);if(n.add(a),!r.has(a))throw new Error(`TypeScript fragment replacement has no prior document: ${a}`);let s=e.documentIdentities.get(a);if(!s)throw new Error(`missing TypeScript document identity: ${a}`);o.bytes===null?r.delete(a):r.set(a,Cr(e.cacheDir,o,s))}if(n.size===0)throw new Error("TypeScript fragment generation requires at least one replacement");let i=Ar(e,[...r.values()]);return kr(e.cacheDir,i),i}function Pr(e){let t=ge(e.cacheDir),r=dt(t,e.generationIdentity),n;try{n=ct(v(r,{maxBytes:R,inputKind:"TypeScript fragment manifest"}))}catch(o){throw new Error(`TypeScript fragment generation is unavailable: ${o instanceof Error?o.message:String(o)}`,{cause:o})}if(n.generationIdentity!==e.generationIdentity)throw new Error("TypeScript fragment generation identity does not match its manifest path");if(e.producerIdentity&&n.producerIdentity!==e.producerIdentity)throw new Error("TypeScript fragment producer identity changed");if(e.projectIdentity&&n.projectIdentity!==e.projectIdentity)throw new Error("TypeScript fragment project identity changed");let i=new Map;for(let o of n.documents){let a=M(t.blobDir,`${o.blobHash}.scipdoc`),s=w(a,{maxBytes:J,inputKind:"TypeScript fragment blob"});if(s.byteLength!==o.byteLength||H(s)!==o.blobHash)throw new Error(`TypeScript fragment blob is corrupt: ${o.relativePath}`);i.set(o.relativePath,s)}return{manifest:n,fragments:i}}function Gr(e){let t=Tr(e);return at(t.baseIndex,t.completeDocuments,"assembled")}function da(e){let t=Tr(e);return mi(t.deletedAffectedPaths),{completeIndexBytes:at(t.baseIndex,t.completeDocuments,"assembled"),affectedIndexBytes:at(t.baseIndex,t.affectedDocuments,"affected")}}function Tr(e){let t=Oe(e.baseIndexBytes);Or(t.metadata,Mr(e)),Lr(t.externalSymbols);let r=new Map;for(let s of e.fragments){let c=Q(s.relativePath);if(r.has(c))throw new Error(`duplicate TypeScript fragment replacement: ${c}`);r.set(c,s)}if(r.size===0)throw new Error("TypeScript index assembly requires at least one replacement");let n=new Set,i=[],o=[],a=[];for(let s of t.documents){let c=Q(s.relativePath);if(n.has(c))throw new Error(`duplicate TypeScript SCIP document path: ${c}`);n.add(c);let d=r.get(c);if(!d){i.push(s);continue}if(r.delete(c),d.bytes===null){a.push(c);continue}let l=Rr(st,d.bytes);if(l.relativePath!==c)throw new Error(`TypeScript fragment path mismatch: expected ${c}, got ${l.relativePath}`);i.push(l),o.push(l)}if(r.size>0)throw new Error(`TypeScript fragment replacement has no prior document: ${[...r.keys()].sort()[0]}`);return{baseIndex:t,completeDocuments:i,affectedDocuments:o,deletedAffectedPaths:a}}function at(e,t,r){let n=Er(wr(vr,{metadata:e.metadata,documents:t,externalSymbols:[]})),i=Oe(n);if(i.documents.length!==t.length||i.externalSymbols.length!==0)throw new Error(`${r} TypeScript SCIP index failed structural verification`);return n}function mi(e){if(e.length>0)throw new Error(`affected TypeScript mini index cannot contain a deleted document: ${e[0]}`)}function la(e,t){let r=ge(e);if(!pe(r.generationDir))return;let n=new Set(t.map(a=>Dr(a))),i=br(r.generationDir).filter(a=>a.endsWith(".json")),o=new Set;for(let a of i.filter(s=>n.has(s))){let s=ct(v(M(r.generationDir,a),{maxBytes:R,inputKind:"TypeScript fragment manifest"}));for(let c of s.documents)o.add(`${c.blobHash}.scipdoc`)}for(let a of i)n.has(a)||Ir(M(r.generationDir,a),{force:!0});if(pe(r.blobDir))for(let a of br(r.blobDir))o.has(a)||Ir(M(r.blobDir,a),{force:!0})}function Cr(e,t,r){if(t.bytes===null)throw new Error(`cannot persist an empty TypeScript fragment: ${t.relativePath}`);let n=Q(t.relativePath),i=Buffer.from(t.bytes),o=H(i),a=ge(e);li(a.blobDir,{recursive:!0});let s=M(a.blobDir,`${o}.scipdoc`);if(pe(s)){let c=w(s,{maxBytes:J,inputKind:"TypeScript fragment blob"});if(c.byteLength!==i.byteLength||H(c)!==o)throw new Error(`existing TypeScript fragment blob is corrupt: ${n}`)}else{let c=`${s}.${process.pid}.${Date.now()}.tmp`;pi(c,i),ui(c,s)}return{relativePath:n,blobHash:o,byteLength:i.byteLength,documentIdentity:r}}function Ar(e,t){if(!e.producerIdentity||!e.projectIdentity||!e.generationIdentity)throw new Error("TypeScript fragment generation identities must be non-empty");let r=[...t].sort((n,i)=>n.relativePath.localeCompare(i.relativePath));if(new Set(r.map(n=>n.relativePath)).size!==r.length)throw new Error("TypeScript fragment generation contains duplicate document paths");return{version:Me,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,generationIdentity:e.generationIdentity,createdAt:(e.now??(()=>new Date))().toISOString(),documents:r}}function kr(e,t){let r=ge(e),n=dt(r,t.generationIdentity);if(pe(n)){let i=ct(v(n,{maxBytes:R,inputKind:"TypeScript fragment manifest"}));if(xr(i)!==xr(t))throw new Error(`TypeScript fragment generation is immutable: ${t.generationIdentity}`);return}F(n,t,{spacing:2,trailingNewline:!0})}function xr(e){return H(JSON.stringify({version:e.version,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,generationIdentity:e.generationIdentity,documents:e.documents}))}function ct(e){let t=JSON.parse(e);if(t.version!==Me||typeof t.producerIdentity!="string"||typeof t.projectIdentity!="string"||typeof t.generationIdentity!="string"||typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))||!Array.isArray(t.documents))throw new Error("invalid TypeScript fragment generation manifest");let r=new Set;for(let n of t.documents){if(!n||typeof n.relativePath!="string"||typeof n.blobHash!="string"||!/^[a-f0-9]{64}$/.test(n.blobHash)||typeof n.byteLength!="number"||!Number.isInteger(n.byteLength)||n.byteLength<0||typeof n.documentIdentity!="string"||!n.documentIdentity)throw new Error("invalid TypeScript fragment record");if(Q(n.relativePath),r.has(n.relativePath))throw new Error("duplicate TypeScript fragment record");r.add(n.relativePath)}return t}function dt(e,t){return M(e.generationDir,Dr(t))}function Dr(e){if(!e)throw new Error("TypeScript fragment generation identity must be non-empty");return`${H(e)}.json`}function Lr(e){if(e.length>0)throw new Error("scip-typescript emitted external symbols; incremental document assembly is unsupported")}function Or(e,t){if(!e||typeof e!="object")throw new Error("TypeScript SCIP shard has no producer metadata");let r=e,n=r.toolInfo??r.tool_info;if(!n||typeof n!="object")throw new Error("TypeScript SCIP shard has no producer tool identity");let i=n;if(i.name!=="scip-typescript"||i.version!==t)throw new Error("TypeScript SCIP shard producer identity changed")}function Mr(e){let t=e.packageVersion??e.runtime?.packageVersion;if(!t)throw new Error("scip-typescript package version is unavailable");return t}function Q(e){if(!e||e.startsWith("/")||e.startsWith("\\")||e.includes("\\"))throw new Error(`invalid TypeScript SCIP document path: ${e}`);let t=e.split("/");if(t.includes("")||t.includes(".")||t.includes(".."))throw new Error(`invalid TypeScript SCIP document path: ${e}`);return e}function H(e){return di("sha256").update(e).digest("hex")}import{createHash as yi}from"crypto";import{existsSync as me,mkdirSync as hi,readdirSync as lt,renameSync as Si,rmSync as _r,writeFileSync as bi}from"fs";import{join as P}from"path";var _e=1,Sa=64*1024*1024,he="typescript-scip-overlays";function ba(e){let t=Fr(e.cacheDir,e.previousGenerationIdentity);if(!t&&!e.baseShardCurrent)throw new Error("deferred TypeScript SCIP base has no matching overlay generation");if(t&&(t.producerIdentity!==e.producerIdentity||t.projectIdentity!==e.projectIdentity))throw new Error("TypeScript overlay producer or project identity changed");let r=new Map((t?.overlays??[]).map(o=>[o.relativePath,o])),n=new Set;for(let o of e.fragments){let a=ft(o.relativePath);if(n.has(a))throw new Error(`duplicate TypeScript overlay: ${a}`);n.add(a),r.set(a,Ii(e.cacheDir,o))}if(n.size===0)throw new Error("TypeScript overlay generation requires affected documents");let i={version:_e,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,baseGenerationIdentity:t?.baseGenerationIdentity??e.previousGenerationIdentity,generationIdentity:e.nextGenerationIdentity,createdAt:(e.now??(()=>new Date))().toISOString(),overlays:[...r.values()].sort((o,a)=>o.relativePath.localeCompare(a.relativePath))};return xi(e.cacheDir,i),i}function Ia(e){let t=Fr(e.cacheDir,e.generationIdentity);if(!t)throw new Error("TypeScript overlay generation is unavailable");let r=t.overlays.map(n=>{if(n.blobHash===null)return{relativePath:n.relativePath,bytes:null,occurrences:0,symbols:0,referenceFragments:[]};let i=w(P(Se(e.cacheDir),"blobs",`${n.blobHash}.scipdoc`),{maxBytes:J,inputKind:"TypeScript overlay blob"});if(i.byteLength!==n.byteLength||ye(i)!==n.blobHash)throw new Error(`TypeScript overlay blob is corrupt: ${n.relativePath}`);return{relativePath:n.relativePath,bytes:i,occurrences:0,symbols:0,referenceFragments:[]}});return Gr({packageVersion:e.packageVersion,baseIndexBytes:e.baseIndexBytes,fragments:r})}function xa(e,t){let r=Se(e),n=P(r,"generations");if(!me(n))return;let i=new Set(t.map(pt)),o=new Set;for(let s of lt(n).filter(c=>i.has(c))){let c=ut(v(P(n,s),{maxBytes:R,inputKind:"TypeScript overlay manifest"}));for(let d of c.overlays)d.blobHash&&o.add(`${d.blobHash}.scipdoc`)}for(let s of lt(n))i.has(s)||_r(P(n,s),{force:!0});let a=P(r,"blobs");if(me(a))for(let s of lt(a))o.has(s)||_r(P(a,s),{force:!0})}function Fr(e,t){let r=P(Se(e),"generations",pt(t));if(!me(r))return null;let n=ut(v(r,{maxBytes:R,inputKind:"TypeScript overlay manifest"}));if(n.generationIdentity!==t)throw new Error("TypeScript overlay generation identity does not match its path");return n}function Ii(e,t){let r=ft(t.relativePath);if(t.bytes===null)return{relativePath:r,blobHash:null,byteLength:0};let n=Buffer.from(t.bytes),i=ye(n),o=P(Se(e),"blobs");hi(o,{recursive:!0});let a=P(o,`${i}.scipdoc`);if(me(a)){let s=w(a,{maxBytes:J,inputKind:"TypeScript overlay blob"});if(s.byteLength!==n.byteLength||ye(s)!==i)throw new Error(`existing TypeScript overlay blob is corrupt: ${r}`)}else{let s=`${a}.${process.pid}.${Date.now()}.tmp`;bi(s,n),Si(s,a)}return{relativePath:r,blobHash:i,byteLength:n.byteLength}}function xi(e,t){let r=P(Se(e),"generations",pt(t.generationIdentity));if(me(r)){let n=ut(v(r,{maxBytes:R,inputKind:"TypeScript overlay manifest"}));if(jr(n)!==jr(t))throw new Error(`TypeScript overlay generation is immutable: ${t.generationIdentity}`);return}F(r,t,{spacing:2,trailingNewline:!0})}function ut(e){let t=JSON.parse(e);if(t.version!==_e||typeof t.producerIdentity!="string"||!t.producerIdentity||typeof t.projectIdentity!="string"||!t.projectIdentity||typeof t.baseGenerationIdentity!="string"||!t.baseGenerationIdentity||typeof t.generationIdentity!="string"||!t.generationIdentity||typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))||!Array.isArray(t.overlays))throw new Error("invalid TypeScript overlay manifest");let r=new Set;for(let n of t.overlays){if(!n||typeof n.relativePath!="string"||n.blobHash!==null&&(typeof n.blobHash!="string"||!/^[a-f0-9]{64}$/.test(n.blobHash))||!Number.isInteger(n.byteLength)||n.byteLength<0||n.blobHash===null&&n.byteLength!==0)throw new Error("invalid TypeScript overlay record");if(ft(n.relativePath),r.has(n.relativePath))throw new Error("duplicate TypeScript overlay record");r.add(n.relativePath)}return t}function Se(e){return P(e,he)}function pt(e){if(!e)throw new Error("TypeScript overlay generation identity must be non-empty");return`${ye(e)}.json`}function jr(e){return ye(JSON.stringify({version:e.version,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,baseGenerationIdentity:e.baseGenerationIdentity,generationIdentity:e.generationIdentity,overlays:e.overlays}))}function ft(e){if(!e||e.startsWith("/")||e.includes("\\")||e.split("/").some(t=>!t||t==="."))throw new Error(`invalid TypeScript overlay path: ${e}`);if(e.split("/").includes(".."))throw new Error(`invalid TypeScript overlay path: ${e}`);return e}function ye(e){return yi("sha256").update(e).digest("hex")}var be=1,mt="language-indexes",Nr=["index.db","index.scip","meta.json"],qr=[mt,fe,he];function je(e){let t=[];for(let r of Nr)Gi(e,r),t.push(r);for(let r of qr)Br(e,r,t);return{version:be,files:t.sort()}}function Fe(e){if(!e||e.includes("\0")||e.startsWith("/")||e.includes("\\"))throw new Error(`invalid index artifact path: ${e||"<empty>"}`);let t=e.split("/");if(t.some(n=>!n||n==="."||n===".."))throw new Error(`invalid index artifact path: ${e}`);let r=t[0];if(!Nr.includes(e)&&!qr.includes(r))throw new Error(`index artifact path is not shareable: ${e}`);return e}function A(e,t){let r=Fe(t),n=gt(e),i=gt(n,...r.split("/"));if(i!==n&&!i.startsWith(`${n}${Pi}`))throw new Error(`index artifact escapes cache: ${t}`);return i}function Br(e,t,r){let n=vi(e,t),i;try{i=Ri(n,{withFileTypes:!0,encoding:"utf8"})}catch{return}for(let o of i){let a=`${t}/${o.name}`;if(o.isSymbolicLink())throw new Error(`index artifact cannot be a symlink: ${a}`);o.isDirectory()?Br(e,a,r):o.isFile()&&r.push(Fe(a))}}function Gi(e,t){let r=A(e,t),n;try{n=wi(r)}catch{throw new Error(`required index artifact is missing: ${t}`)}if(!n.isFile()||n.isSymbolicLink())throw new Error(`required index artifact is not a regular file: ${t}`);if(Ei(gt(e),r).startsWith(".."))throw new Error(`index artifact escapes cache: ${t}`)}import{writeFileSync as yt}from"fs";import{create as X}from"@bufbuild/protobuf";import{deserializeSCIP as ht,serializeSCIP as St,DocumentSchema as ki,IndexSchema as Wr,MetadataSchema as Vr,SymbolInformationSchema as Di}from"@c4312/scip";import{create as $r}from"@bufbuild/protobuf";import{DocumentSchema as Ti,IndexSchema as Ci,SymbolRole as Ai}from"@c4312/scip";function zr(e){let t=new Set,r=new Map;for(let a of e.documents){r.set(a,Ge(a.relativePath));for(let s of a.symbols)s.symbol&&t.add(s.symbol)}for(let a of e.externalSymbols)a.symbol&&t.add(a.symbol);let n=0,i=0,o=[];for(let a of e.documents){let s=r.get(a),c=a.occurrences.filter(d=>(d.symbolRoles&Ai.Definition)===0||t.has(d.symbol)?!0:(n+=1,!1));if(s===a.relativePath&&c.length===a.occurrences.length){o.push(a);continue}i+=1,o.push($r(Ti,{language:a.language,relativePath:s,occurrences:c,symbols:a.symbols,text:a.text,positionEncoding:a.positionEncoding}))}return{index:i===0?e:$r(Ci,{metadata:e.metadata,documents:o,externalSymbols:e.externalSymbols}),removedDefinitionOccurrences:n,touchedDocuments:i}}function Qr(e){if(e.length===0)throw new Error("Cannot merge zero SCIP indexes");if(e.length===1)return e[0];let t=Oi(e),r=Mi(e.flatMap(i=>i.documents??[])),n=Ur(e.flatMap(i=>i.externalSymbols??[]));return X(Wr,{metadata:t,documents:r,externalSymbols:n})}function Fa(e,t){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let r=e.map(i=>ht(w(i,{inputKind:"SCIP merge input",maxBytes:E}))),n=Qr(r);return yt(t,Buffer.from(St(n))),{documentCount:n.documents.length,externalSymbolCount:n.externalSymbols.length,inputCount:e.length}}function Na(e,t){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let r=e.map(i=>ht(w(i,{inputKind:"SCIP merge input",maxBytes:E}))),n=zr(Qr(r));return yt(t,Buffer.from(St(n.index))),{documentCount:n.index.documents.length,externalSymbolCount:n.index.externalSymbols.length,inputCount:e.length,removedDefinitionOccurrences:n.removedDefinitionOccurrences,touchedDocuments:n.touchedDocuments}}function Li(e,t,r){let n=e.metadata;if(!n)throw new Error("Cannot rebase a SCIP index without metadata");if(!K(n.projectRoot,t))throw new Error(`Cannot rebase SCIP project root: expected ${t}, got ${n.projectRoot}`);return X(Wr,{metadata:X(Vr,{...n,projectRoot:r}),documents:e.documents,externalSymbols:e.externalSymbols})}function Hr(e,t,r){let n=ht(w(e,{inputKind:"SCIP normalization input",maxBytes:E})),i=Li(n,t,r);yt(e,Buffer.from(St(i)))}function Oi(e){let t=e[0]?.metadata;if(!t)return;let r=t.projectRoot;for(let i of e.slice(1)){let o=i.metadata?.projectRoot;if(r&&o&&!K(o,r))throw new Error(`Cannot merge SCIP indexes with different project roots: ${r} vs ${o}`)}let n=r&&Vt(r);return n===r?t:X(Vr,{...t,projectRoot:n})}function Mi(e){let t=new Map;for(let r of e){let n=t.get(r.relativePath);if(!n){t.set(r.relativePath,r);continue}t.set(r.relativePath,X(ki,{language:n.language||r.language,relativePath:n.relativePath||r.relativePath,occurrences:_i([...n.occurrences,...r.occurrences]),symbols:Ur([...n.symbols,...r.symbols]),text:Fi(n.text,r.text),positionEncoding:n.positionEncoding||r.positionEncoding}))}return[...t.values()]}function _i(e){let t=new Set,r=[];for(let n of e){let i=JSON.stringify(n);t.has(i)||(t.add(i),r.push(n))}return r}function Ur(e){let t=new Map;for(let r of e){let n=t.get(r.symbol);if(!n){t.set(r.symbol,r);continue}t.set(r.symbol,X(Di,{symbol:n.symbol,documentation:Ni([...n.documentation,...r.documentation]),relationships:ji([...n.relationships,...r.relationships]),kind:n.kind||r.kind,displayName:n.displayName||r.displayName,enclosingSymbol:n.enclosingSymbol||r.enclosingSymbol,signatureDocumentation:n.signatureDocumentation??r.signatureDocumentation}))}return[...t.values()]}function ji(e){let t=new Set,r=[];for(let n of e){let i=[n.symbol,n.isReference?"1":"0",n.isImplementation?"1":"0",n.isTypeDefinition?"1":"0",n.isDefinition?"1":"0"].join("|");t.has(i)||(t.add(i),r.push(n))}return r}function Fi(e,t){return e?t?e.length>=t.length?e:t:e:t}function Ni(e){return[...new Set(e)]}import{createHash as vt}from"crypto";import{closeSync as qi,existsSync as g,mkdirSync as Bi,openSync as $i,readSync as zi,readdirSync as Et,renameSync as wt,rmSync as Ie,statSync as Z}from"fs";import{basename as Xr,dirname as k,join as f,relative as Jr}from"path";var Rt=Object.freeze({maxGenerations:2,maxLogicalBytes:2*1024*1024*1024});function Zr(e){let t=m(e.outputDb),r=Ui(e);e.onStage?.("after-recovery-retained");let n=e.preserveOutputScip?e.outputScip:e.tempOutputScip,i=Tt({generationRoot:t,databasePath:e.tempOutputDb,indexPath:g(n)?n:void 0,metadataPath:g(e.tempMetaPath)?e.tempMetaPath:void 0}),o=(e.now??(()=>new Date))().toISOString(),a={version:V,currentGeneration:i.identity,artifactSet:"immutable-v1",...r?{previousGeneration:r}:{},...e.publication?{publication:e.publication}:{},publishedAt:o},s=G(f(t,"state.json"),a,{spacing:2,trailingNewline:!0});e.onStage?.("after-pointer-handoff"),e.preserveOutputScip||xt(e.tempOutputScip,e.outputScip),e.onStage?.("after-scip-handoff"),xt(e.tempOutputDb,e.outputDb),e.onStage?.("after-database-handoff"),xt(e.tempMetaPath,e.metaPath),e.onStage?.("after-metadata-handoff");let c=i.identity,d={...a,stableMirrors:Gt(e.outputDb,e.outputScip)};G(f(t,"state.json"),d,{spacing:2,trailingNewline:!0});let l=en(e.outputDb,{now:e.now}),p=re(i.directorySync,s.directorySync);return{currentGeneration:c,...r?{previousGeneration:r}:{},retention:l,achievedDurability:p==="synced"?"directory-durable":"file-flushed",directorySync:p}}function Wi(e,t,r,n=()=>new Date){if(!g(e))return null;let i=C(e),o=f(m(e),"state.json");if(i?.artifactSet==="immutable-v1"&&le(e,i.currentGeneration))return i;let a=m(e),s=!i&&g(o)?Yi(r,e,t):void 0;if(s&&!ue(a,s))return null;let c=Tt({generationRoot:a,databasePath:e,indexPath:g(t)?t:void 0,metadataPath:g(r)?r:void 0,forcedIdentity:i?.currentGeneration??s}),d={version:V,currentGeneration:c.identity,artifactSet:"immutable-v1",stableMirrors:Gt(e,t),...i?.previousGeneration?{previousGeneration:i.previousGeneration}:{},...i?.publication?{publication:i.publication}:{},publishedAt:i?.publishedAt??n().toISOString()};return G(f(a,"state.json"),d,{spacing:2,trailingNewline:!0}),d}function Xa(e,t,r=()=>new Date){if(!g(e)||!g(t))throw new Error("metadata-only generation refresh requires stable database and metadata files");let n=C(e),i=m(e),o=Tt({generationRoot:i,databasePath:e,indexPath:g(f(k(e),"index.scip"))?f(k(e),"index.scip"):void 0,metadataPath:t}),a=n&&n.currentGeneration!==o.identity?nn(e,n.currentGeneration):void 0,s={version:V,currentGeneration:o.identity,artifactSet:"immutable-v1",stableMirrors:Gt(e,f(k(e),"index.scip")),...a?{previousGeneration:a}:{},...n?.publication?{publication:n.publication}:{},publishedAt:r().toISOString()};return G(f(m(e),"state.json"),s,{spacing:2,trailingNewline:!0}),en(e,{now:r}),s}function en(e,t={}){let r=Vi(t.limits),i=(t.now??(()=>new Date))().toISOString(),o=T(de(e),{waitMs:0});if(!o)return{state:"deferred",generationCount:0,logicalBytes:0,protectedGenerations:0,activeReaderLeases:0,staleReaderLeasesRemoved:0,malformedReaderLeases:0,removedGenerations:0,removedLogicalBytes:0,limits:r,at:i,reason:"another process owns local generation retention"};try{let a=C(e),s=tn(e),c=rt(e,s.map(x=>x.identity),{isProcessAlive:t.isProcessAlive??ie,readProcessIdentity:t.readProcessIdentity??ne}),d=new Set(c.protectedGenerations);a?.currentGeneration&&d.add(a.currentGeneration),a?.previousGeneration?.generationIdentity&&d.add(a.previousGeneration.generationIdentity);let l=s.length,p=s.reduce((x,ze)=>x+ze.logicalBytes,0),h=0,D=0;for(let x of s){if(l<=r.maxGenerations&&p<=r.maxLogicalBytes)break;d.has(x.identity)||(t.onBeforeRemove?.(x.identity),Ie(x.path,{recursive:!0,force:!0}),l-=1,p-=x.logicalBytes,h+=1,D+=x.logicalBytes)}let y=l>r.maxGenerations||p>r.maxLogicalBytes,L={state:y?"protected":h>0?"collected":"within-bounds",generationCount:l,logicalBytes:p,protectedGenerations:d.size,activeReaderLeases:c.activeLeases,staleReaderLeasesRemoved:c.staleLeasesRemoved,malformedReaderLeases:c.malformedLeases,removedGenerations:h,removedLogicalBytes:D,limits:r,at:i,...y?{reason:c.malformedLeases>0?"malformed reader ownership evidence fails closed":"retention bounds cannot be met without deleting a protected generation"}:{}};return Yr(e,L),L}catch(a){let s={state:"error",generationCount:0,logicalBytes:0,protectedGenerations:0,activeReaderLeases:0,staleReaderLeasesRemoved:0,malformedReaderLeases:0,removedGenerations:0,removedLogicalBytes:0,limits:r,at:i,reason:a instanceof Error?a.message:String(a)};try{Yr(e,s)}catch{}return s}finally{o.release()}}function Za(e){let t=m(e);if(!g(t))return{state:"absent",generationCount:0,logicalBytes:0,protectedGenerations:0,activeReaderLeases:0,malformedReaderLeases:0,limits:{...Rt},reason:"local immutable generation store does not exist"};let r=Qi(e),n=r?.limits??{...Rt},i=T(de(e),{waitMs:0});if(!i)return{state:"deferred",generationCount:r?.generationCount??0,logicalBytes:r?.logicalBytes??0,protectedGenerations:r?.protectedGenerations??0,activeReaderLeases:r?.activeReaderLeases??0,malformedReaderLeases:r?.malformedReaderLeases??0,limits:n,...r?{lastCollection:r}:{},reason:"another process owns local generation retention"};try{let o=tn(e),a=C(e),s=rt(e,o.map(d=>d.identity),{isProcessAlive:ie,readProcessIdentity:ne},{removeStale:!1}),c=new Set(s.protectedGenerations);return a?.currentGeneration&&c.add(a.currentGeneration),a?.previousGeneration?.generationIdentity&&c.add(a.previousGeneration.generationIdentity),{state:"managed",generationCount:o.length,logicalBytes:o.reduce((d,l)=>d+l.logicalBytes,0),...o[0]?{oldestGenerationAt:new Date(o[0].modifiedAtMs).toISOString()}:{},protectedGenerations:c.size,activeReaderLeases:s.activeLeases,malformedReaderLeases:s.malformedLeases,limits:n,...r?{lastCollection:r}:{},...s.malformedLeases>0?{reason:"malformed reader ownership evidence prevents unsafe collection"}:{}}}catch(o){return{state:"error",generationCount:0,logicalBytes:0,protectedGenerations:0,activeReaderLeases:0,malformedReaderLeases:0,limits:n,...r?{lastCollection:r}:{},reason:o instanceof Error?o.message:String(o)}}finally{i.release()}}function Vi(e={}){let t={...Rt,...e};if(!Number.isSafeInteger(t.maxGenerations)||t.maxGenerations<2)throw new Error("Local SQLite generation retention must keep at least current and previous generations.");if(!Number.isSafeInteger(t.maxLogicalBytes)||t.maxLogicalBytes<=0)throw new Error("Local SQLite generation byte retention must be a positive safe integer.");return t}function tn(e){let t=m(e);return g(t)?Et(t,{withFileTypes:!0}).filter(r=>r.isDirectory()&&/^[a-f0-9]{64}$/.test(r.name)).map(r=>{let n=f(t,r.name),i=ue(t,r.name),o=i?i.database.size+(i.index?.size??0)+(i.metadata?.size??0):rn(n);return{identity:r.name,path:n,logicalBytes:o,modifiedAtMs:Z(n).mtimeMs}}).sort((r,n)=>r.modifiedAtMs-n.modifiedAtMs||r.identity.localeCompare(n.identity)):[]}function rn(e){let t=0;for(let r of Et(e,{withFileTypes:!0})){let n=f(e,r.name);r.isDirectory()?t+=rn(n):r.isFile()&&(t+=Z(n).size)}return t}function Yr(e,t){F(f(m(e),"gc.json"),t,{spacing:2,trailingNewline:!0})}function Qi(e){try{let t=JSON.parse(S(f(m(e),"gc.json"),"local SQLite generation GC status"));return!t||t.state!=="within-bounds"&&t.state!=="collected"&&t.state!=="protected"&&t.state!=="deferred"&&t.state!=="error"||!Number.isSafeInteger(t.generationCount)||t.generationCount<0||!Number.isFinite(t.logicalBytes)||t.logicalBytes<0||!Number.isFinite(Date.parse(t.at))?void 0:t}catch{return}}function Pt(e,t=f(k(e),"meta.json")){let r=f(m(e),"state.json");if(!g(r))return{state:"legacy",statePath:r};let n=C(e);if(!n)return{state:"invalid",statePath:r,reason:"generation state is malformed"};try{let i=le(e,n.currentGeneration),o=i!==null,a=i?Hi(e,t,i,n):!1,s=n.previousGeneration?g(f(k(e),n.previousGeneration.databasePath)):!0;return!a||!o||!s?{state:"drifted",statePath:r,currentMatches:a,recoveryExists:s,generation:n,reason:o?a?"retained recovery database is missing":"stable database or metadata no longer matches the published generation":"published immutable generation is missing"}:{state:"current",statePath:r,currentMatches:a,recoveryExists:s,generation:n}}catch(i){return{state:"drifted",statePath:r,currentMatches:!1,recoveryExists:!1,generation:n,reason:i instanceof Error?i.message:String(i)}}}function Hi(e,t,r,n){if(n.stableMirrors&&(n.stableMirrors.databaseFileIdentity!==O(e)||n.stableMirrors.indexFileIdentity!==void 0&&n.stableMirrors.indexFileIdentity!==O(f(k(e),"index.scip")))||!Kr(e,r.database))return!1;let i=f(k(e),"index.scip");if(r.index&&!Kr(i,r.index))return!1;if(!r.metadata)return!g(t);if(!g(t))return!1;let o=f(m(e),r.identity,r.metadata.file);return g(o)&&N(S(t,"reindex metadata"))===N(S(o,"immutable reindex metadata"))}function Kr(e,t){return g(e)&&Z(e).isFile()&&Z(e).size===t.size}function Ui(e){let t=Wi(e.outputDb,e.outputScip,e.metaPath);return t?nn(e.outputDb,t.currentGeneration):void 0}function Gt(e,t){return{databaseFileIdentity:O(e),...g(t)?{indexFileIdentity:O(t)}:{}}}function nn(e,t){let r=f(m(e),t),n=f(r,Xr(e)),i=f(r,"meta.json");return{generationIdentity:t,databasePath:Jr(k(e),n),...g(i)?{metadataPath:Jr(k(e),i)}:{}}}function Ji(e){if(g(e)){for(let t of Et(e,{withFileTypes:!0}))if(t.isDirectory()&&t.name.endsWith(".tmp"))try{Ie(f(e,t.name),{recursive:!0,force:!0})}catch{}}}function Yi(e,t,r=f(k(t),"index.scip")){let n=vt("sha256").update("sqlite-generation-artifacts-v1\0");return n.update(Ne(t)),g(r)&&n.update(`\0${Ne(r)}`),g(e)&&n.update(`\0${N(S(e,"reindex metadata"))}`),n.digest("hex")}function Tt(e){let t=bt(e.databasePath),r=e.indexPath?bt(e.indexPath):void 0,n=e.metadataPath?bt(e.metadataPath):void 0,i=e.forcedIdentity??Ki(t,r,e.metadataPath),o=f(e.generationRoot,i),a=f(o,Le);if(g(a)){let d=ue(e.generationRoot,i);if(d&&on(o,d.database,t)&&Zi(o,d.index,r)&&eo(o,d.metadata,e.metadataPath))return{identity:i,directorySync:j(e.generationRoot)};throw new Error(`SQLite generation ${i} already exists with different or corrupt artifacts.`)}let s=[Pe(e.generationRoot)];Ji(e.generationRoot);let c=`${o}.${process.pid}.${Date.now()}.tmp`;Ie(c,{recursive:!0,force:!0}),Bi(c,{recursive:!0});try{s.push(It(e.databasePath,f(c,t.file))),r&&e.indexPath&&s.push(It(e.indexPath,f(c,r.file))),n&&e.metadataPath&&s.push(It(e.metadataPath,f(c,n.file)));let d=G(f(c,Le),{version:tt,identity:i,database:t,...r?{index:r}:{},...n?{metadata:n}:{}},{spacing:2,trailingNewline:!0});d.directorySync!=="not-requested"&&s.push(d.directorySync),s.push(j(c)),b(()=>wt(c,o)),s.push(j(e.generationRoot))}finally{try{Ie(c,{recursive:!0,force:!0})}catch{}}return{identity:i,directorySync:re(...s)}}function Ki(e,t,r){let n=vt("sha256").update("sqlite-generation-artifacts-v1\0");return n.update(e.sha256),t&&n.update(`\0${t.sha256}`),r&&n.update(`\0${N(S(r,"reindex metadata"))}`),n.digest("hex")}function bt(e){return{file:Xr(e),size:Z(e).size,sha256:Ne(e)}}function Ne(e){let t=vt("sha256"),r=$i(e,"r"),n=Buffer.allocUnsafe(1024*1024);try{for(;;){let i=Xi(r,n);if(i===0)break;t.update(n.subarray(0,i))}}finally{qi(r)}return t.digest("hex")}function Xi(e,t){let r=0;for(;r<t.length;){let n=zi(e,t,r,t.length-r,null);if(r+=n,n===0)break}return r}function It(e,t){return Ae(e,t,{mode:292})}function on(e,t,r){let n=f(e,t.file);return t.file===r.file&&t.size===r.size&&t.sha256===r.sha256&&g(n)&&Z(n).size===t.size&&Ne(n)===t.sha256}function Zi(e,t,r){return!t||!r?t===r:on(e,t,r)}function eo(e,t,r){if(!t||!r)return t===void 0&&r===void 0;let n=f(e,t.file);return g(n)&&N(S(n,"stored reindex metadata"))===N(S(r,"candidate reindex metadata"))}function xt(e,t){b(()=>Ie(`${t}.tmp-replace`,{force:!0})),b(()=>wt(e,`${t}.tmp-replace`)),b(()=>wt(`${t}.tmp-replace`,t))}var Ot=1,sn="CODEBASEIQ_SHARED_CACHE",io=2,qe=JSON.stringify({cliVersion:Qt,artifactCatalogVersion:be,postIndexAugmentationSchemaVersion:io,sqliteGenerationStoreVersion:V,typescriptFragmentStoreVersion:Me,typescriptOverlayStoreVersion:_e}),Mt="manifest.json",oo="shared-cache.json",_t=[mt,fe,he];function kt(e,t){if(!e.clean||!e.treeOid)return;let r=bn(JSON.stringify({version:Ot,repositoryId:e.repositoryId,treeOid:e.treeOid,fingerprint:t,producerIdentity:qe}));return{repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,fingerprint:t,producerIdentity:qe,generationId:r,repositoryCacheDir:Te(e.repositoryId)}}function gn(e,t,r){if(process.env[sn]==="0")return`${sn}=0`;if(!Qe(r))return"explicit cache or database override";if(He(At(t))!==He(Ve(e))||t!==u(At(t),"index.db"))return"index database is outside the managed worktree cache"}function Ts(e,t,r){if(!Qe(t))return;let n=r??oe(e);return n?u(Te(n.repositoryId),"evidence.db"):void 0}function $(e,t=!0){let r=Nt(e),n;try{n=yn(v(u(r,Mt),{inputKind:"shared-generation manifest",maxBytes:R}))}catch{return null}if(n.generationId!==e.generationId||n.repositoryId!==e.repositoryId||n.treeOid!==e.treeOid||n.producerIdentity!==e.producerIdentity||JSON.stringify(n.fingerprint)!==JSON.stringify(e.fingerprint))return null;if(!t)return n;try{for(let i of n.artifacts){let o=A(r,i.path),a=$e(o);if(!a.isFile()||a.size!==i.size||Y(o,{inputKind:"shared-generation artifact",maxBytes:E})!==i.sha256)return null}}catch{return null}return n}function Cs(e,t,r){if(!e.treeOid)return null;let n=Je(t,r),i=u(Ht(),"repositories",e.repositoryId),o;try{let c=Ct(i);if(!c.isDirectory()||c.isSymbolicLink())return null;o=pn(i)}catch{return null}let a=u(o,"generations"),s=[];try{for(let c of un(a)){if(!/^[a-f0-9]{64}$/.test(c))continue;let d=u(a,c),l;try{l=Ct(d)}catch{continue}if(!(!l.isDirectory()||l.isSymbolicLink()))try{let p=yn(v(u(d,Mt),{inputKind:"shared-generation baseline manifest",maxBytes:R}));p.generationId===c&&p.repositoryId===e.repositoryId&&p.treeOid===e.treeOid&&p.producerIdentity===qe&&lo(p.fingerprint,n)&&s.push(p)}catch{continue}}}catch{return null}s.sort((c,d)=>Date.parse(d.createdAt)-Date.parse(c.createdAt)||c.generationId.localeCompare(d.generationId));for(let c of s){let d={repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,fingerprint:c.fingerprint,producerIdentity:c.producerIdentity,generationId:c.generationId,repositoryCacheDir:o},l=$(d);if(l)return{snapshot:d,manifest:l}}return null}function mn(e){let t=T(u(e.snapshot.repositoryCacheDir,"locks",`${e.snapshot.generationId}.publish.lock`));if(!t)throw new Error(`shared generation publication is already in progress for ${e.snapshot.generationId}`);try{return ao(e)}finally{t.release()}}function ao(e){let t=$(e.snapshot);if(t)return cn(e.snapshot,t);if(!Re(e.sourceCacheDir,e.sourceProjectRoot,e.snapshot.fingerprint))throw new Error("source index is incomplete, incompatible, or corrupt");let r=dn(e.sourceCacheDir);if(!r)throw new Error("source index artifacts are incomplete");let n=je(e.sourceCacheDir),i=u(e.snapshot.repositoryCacheDir,"generations"),o=[Pe(i)],a=We(u(i,`.tmp-${process.pid}-`));try{let s=[];for(let y of n.files){let L=A(e.sourceCacheDir,y),x=A(a,y);o.push(ve(L,x,292)),e.onPublicationStage?.("after-artifact-flushed",y);let ze=$e(x).size;s.push({path:y,size:ze,sha256:Y(x,{inputKind:"staged shared-generation artifact",maxBytes:E})})}let c=fn(w(u(a,"index.scip"),{inputKind:"staged shared SCIP index",maxBytes:E})).metadata?.projectRoot;if(!c)throw new Error("shared SCIP generation has no project root metadata");let d=Bt(e.sourceProjectRoot);if(!K(c,d))throw new Error("shared SCIP generation root does not match its source worktree");if(dn(e.sourceCacheDir)!==r||e.sourceStillValid&&!e.sourceStillValid())throw new Error("source index changed while staging a shared generation");let l={version:Ot,artifactCatalogVersion:be,generationId:e.snapshot.generationId,repositoryId:e.snapshot.repositoryId,treeOid:e.snapshot.treeOid,fingerprint:e.snapshot.fingerprint,producerIdentity:e.snapshot.producerIdentity,sourceProjectRoot:e.sourceProjectRoot,scipProjectRoot:c,createdAt:(e.now??(()=>new Date))().toISOString(),artifacts:s.sort((y,L)=>y.path.localeCompare(L.path))},p=G(u(a,Mt),l,{spacing:2,trailingNewline:!0});p.directorySync!=="not-requested"&&o.push(p.directorySync),e.onPublicationStage?.("after-manifest-flushed"),o.push(j(a)),e.onPublicationStage?.("after-staging-directory-synced");let h=Nt(e.snapshot);try{if(B(h)&&!$(e.snapshot)){let y=`${h}.corrupt-${process.pid}-${Date.now()}`;b(()=>U(h,y)),q(y,{recursive:!0,force:!0})}b(()=>U(a,h))}catch(y){let L=$(e.snapshot);if(L)return cn(e.snapshot,L);throw y}e.onPublicationStage?.("after-generation-renamed"),o.push(j(i)),e.onPublicationStage?.("after-generations-directory-synced");let D=re(...o);return{kind:"published",manifest:l,achievedDurability:D==="synced"?"directory-durable":"file-flushed",directorySync:D}}finally{q(a,{recursive:!0,force:!0})}}function cn(e,t){let r=j(u(e.repositoryCacheDir,"generations"));return{kind:"existing",manifest:t,achievedDurability:r==="synced"?"directory-durable":"file-flushed",directorySync:r}}function Dt(e){let t=Nt(e.snapshot);ee(e.targetCacheDir,{recursive:!0});let r=T(u(e.targetCacheDir,"cache-lifecycle.lock"),{waitMs:3e4});if(!r)throw new Error("timed out waiting for another cache hydration");let n,i,o=!1;try{n=We(u(e.targetCacheDir,".shared-hydrate-")),go(e.manifest,e.snapshot);for(let c of e.manifest.artifacts){let d=A(t,c.path),l=A(n,c.path);if(ve(d,l),$e(l).size!==c.size||Y(l,{inputKind:"hydrated shared-generation artifact",maxBytes:E})!==c.sha256)throw new Error(`shared artifact is corrupt: ${c.path}`)}let a=Bt(e.targetProjectRoot);if(a!==e.manifest.scipProjectRoot)for(let c of e.manifest.artifacts)c.path.endsWith(".scip")&&Hr(A(n,c.path),e.manifest.scipProjectRoot,a);if(!Re(n,e.targetProjectRoot,e.snapshot.fingerprint,!1))throw new Error("staged shared generation failed completeness or integrity validation");i=uo(e.targetCacheDir,n),o=!0,po(n,e.targetCacheDir,i),Zr({tempOutputScip:u(n,"index.scip"),tempOutputDb:u(n,"index.db"),tempMetaPath:u(n,"meta.json"),outputScip:u(e.targetCacheDir,"index.scip"),outputDb:u(e.targetCacheDir,"index.db"),metaPath:u(e.targetCacheDir,"meta.json"),now:e.now});let s=Pt(u(e.targetCacheDir,"index.db"),u(e.targetCacheDir,"meta.json"));if(s.state==="invalid"||s.state==="drifted")throw new Error(`hydrated SQLite generation failed validation: ${s.reason}`);e.persistLease!==!1&&Lt(e.snapshot,e.targetCacheDir,e.action??"attached",e.now)}catch(a){throw o&&i&&fo(e.targetCacheDir,i),a}finally{n&&q(n,{recursive:!0,force:!0}),r.release()}}function As(e,t,r,n){let i=gn(e,r.dbPath,t);if(i)return{kind:"bypassed",reason:i};try{let o=n??oe(e);if(!o)return{kind:"missed",reason:"Git worktree identity is unavailable"};if(!o.clean)return Be(o,r.cacheDir,"missed",void 0,"worktree has uncommitted changes"),{kind:"missed",reason:"worktree has uncommitted changes"};let a=t.languages??ot(e),s=Ue(e,a,hn(t)),c=kt(o,s);if(!c)return{kind:"missed",reason:"clean committed snapshot is unavailable"};let d=$(c);if(d)return Dt({snapshot:c,manifest:d,targetCacheDir:r.cacheDir,targetProjectRoot:e}),{kind:"attached",generationId:c.generationId};let l=so(c,e);return l?(d=l.manifest,Dt({snapshot:c,manifest:d,targetCacheDir:r.cacheDir,targetProjectRoot:e,action:"peer-imported"}),{kind:"peer-imported",generationId:c.generationId,sourceProjectRoot:l.sourceProjectRoot}):(Be(o,r.cacheDir,"missed",void 0,"no exact shared or peer generation exists"),{kind:"missed",reason:"no exact shared or peer generation exists"})}catch(o){return{kind:"failed",reason:o instanceof Error?o.message:String(o)}}}function ks(e,t,r,n){let i=gn(e,r.dbPath,t);if(i)return{kind:"bypassed",reason:i};try{let o=n??oe(e);if(!o)return{kind:"missed",reason:"Git worktree identity is unavailable"};if(!o.clean)return Be(o,r.cacheDir,"missed",void 0,"worktree is not a clean committed snapshot"),{kind:"missed",reason:"worktree is not a clean committed snapshot"};let a=t.languages??ot(e),s=Ue(e,a,hn(t)),c=kt(o,s);if(!c)return Be(o,r.cacheDir,"missed",void 0,"worktree is not a clean committed snapshot"),{kind:"missed",reason:"worktree is not a clean committed snapshot"};let d=$(c);if(d)return Re(r.cacheDir,e,s)?(Lt(c,r.cacheDir,"local-fresh"),{kind:"local-fresh"}):(Dt({snapshot:c,manifest:d,targetCacheDir:r.cacheDir,targetProjectRoot:e}),{kind:"attached",generationId:c.generationId});let l=Ft(r.cacheDir);return!l||JSON.stringify(l.fingerprint)!==JSON.stringify(s)||JSON.stringify([...l.indexedLanguages??[]].sort())!==JSON.stringify([...a].sort())?{kind:"missed",reason:"local metadata does not match the clean worktree snapshot"}:Re(r.cacheDir,e,s)?(mn({snapshot:c,sourceCacheDir:r.cacheDir,sourceProjectRoot:e,sourceStillValid:()=>{let p=oe(e);return(p?kt(p,s):void 0)?.generationId===c.generationId}}),Lt(c,r.cacheDir,"built"),{kind:"built",generationId:c.generationId}):{kind:"missed",reason:"local index artifacts are incomplete or incompatible"}}catch(o){return{kind:"failed",reason:o instanceof Error?o.message:String(o)}}}async function Ds(e,t={}){let r=t.timeoutMs??3e4,n=t.pollMs??100,i=t.now??te,o=i()+r,a=u(e.repositoryCacheDir,"locks"),s=u(a,`${e.generationId}.lock`),c=d=>{if(!d||typeof d!="object"||Array.isArray(d))return null;let l=d.pid;return typeof l=="number"&&Number.isSafeInteger(l)&&l>0?{pid:l}:null};for(;i()<=o;){if($(e))return{kind:"generation-ready"};let d=Ce(s,{kind:"shared-generation-build",detail:{generationId:e.generationId},parseLegacy:c});if(d.kind==="acquired")return{kind:"owner",release:()=>d.lock.release()};let l=o-i();if(l<=0)break;await ro(Math.min(n,l))}return $(e)?{kind:"generation-ready"}:{kind:"timeout"}}function Lt(e,t,r,n=void 0){let i={version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,localCacheDir:t,baseGenerationId:e.generationId,activeGenerationId:e.generationId,lastAction:r,lastSeenAt:(n??(()=>new Date))().toISOString()},o={...i,ownershipChecksum:jt(i)};return qt(e.repositoryCacheDir,o,!0),o}function Ls(e,t,r=void 0){let n={version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,localCacheDir:t,baseGenerationId:e.generationId,lastAction:"overlay",lastReason:`private cache forked from shared baseline ${e.generationId}`,lastSeenAt:(r??(()=>new Date))().toISOString()},i={...n,ownershipChecksum:jt(n)};return qt(e.repositoryCacheDir,i,!0),i}function Be(e,t,r,n=void 0,i=void 0){let o={version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,localCacheDir:t,lastAction:r,...i?{lastReason:i}:{},lastSeenAt:(n??(()=>new Date))().toISOString()},a={...o,ownershipChecksum:jt(o)};return qt(Te(e.repositoryId),a,!1),a}function jt(e){return bn(JSON.stringify({version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:we(e.projectRoot),localCacheDir:we(e.localCacheDir)}))}function yn(e){let t=JSON.parse(e);if(t.version!==Ot||t.artifactCatalogVersion!==be||typeof t.generationId!="string"||!/^[a-f0-9]{64}$/.test(t.generationId)||typeof t.repositoryId!="string"||!/^[a-f0-9]{24}$/.test(t.repositoryId)||typeof t.treeOid!="string"||!t.treeOid||typeof t.producerIdentity!="string"||t.producerIdentity!==qe||typeof t.sourceProjectRoot!="string"||typeof t.scipProjectRoot!="string"||typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))||!t.fingerprint||!Array.isArray(t.artifacts))throw new Error("invalid shared generation manifest");let r=new Set;for(let n of t.artifacts){if(!n||typeof n.path!="string"||typeof n.size!="number"||n.size<0||typeof n.sha256!="string"||!/^[a-f0-9]{64}$/.test(n.sha256))throw new Error("invalid shared generation artifact");if(Fe(n.path),r.has(n.path))throw new Error(`duplicate shared generation artifact: ${n.path}`);r.add(n.path)}for(let n of["index.db","index.scip","meta.json"])if(!r.has(n))throw new Error(`shared generation is missing ${n}`);return t}function ve(e,t,r=384){return Ae(e,t,{mode:r})}function so(e,t){for(let r of Yt(t)){if(we(r.path)===we(t))continue;let n=Ve(r.path),i=Ft(n);if(!(!i||JSON.stringify(i.fingerprint)!==JSON.stringify(e.fingerprint)||JSON.stringify([...i.indexedLanguages??[]].sort())!==JSON.stringify([...e.fingerprint.languages].sort()))&&Re(n,r.path,e.fingerprint))try{return{manifest:mn({snapshot:e,sourceCacheDir:n,sourceProjectRoot:r.path}).manifest,sourceProjectRoot:r.path}}catch{continue}}return null}function co(e,t,r){ee(e,{recursive:!0}),G(u(e,oo),{version:1,repositoryId:t,worktreeId:r},{spacing:2,trailingNewline:!0})}function dn(e){try{let t=je(e),r=ln("sha256");for(let n of t.files){let i=A(e,n),o=$e(i).size;r.update(n).update("\0").update(String(o)).update("\0"),$t(i,{inputKind:"source-generation artifact",maxBytes:E},a=>r.update(a)),r.update("\0")}return r.digest("hex")}catch{return null}}function Ft(e){try{let t=ke(v(u(e,"meta.json"),{inputKind:"reindex metadata",maxBytes:R}));return(t.kind==="legacy"||t.kind==="supported")&&t.capabilities.publishableGeneration?t.metadata:void 0}catch{return}}function hn(e){return{pnpmWorkspaces:e.indexer?.typescript?.pnpmWorkspaces,typescriptProjectMode:e.indexer?.typescript?.projectMode,typescriptProjects:e.indexer?.typescript?.projects,clojureConfigPath:e.indexer?.clojure?.configPath}}function lo(e,t){let r=Je(e.languages,e);return JSON.stringify(r)===JSON.stringify(t)}function Nt(e){return u(e.repositoryCacheDir,"generations",e.generationId)}function qt(e,t,r){let n=tr(e,{waitMs:5e3});if(!n)throw new Error("repository cache cleanup is busy");try{if(r){let o=t.activeGenerationId??t.baseGenerationId;if(!o||!B(u(e,"generations",o)))throw new Error("shared generation disappeared before its lease was attached")}let i=u(e,"worktrees");ee(i,{recursive:!0}),G(u(i,`${t.worktreeId}.json`),t,{spacing:2,trailingNewline:!0}),co(t.localCacheDir,t.repositoryId,t.worktreeId)}finally{n.release()}}function uo(e,t){let r=u(t,".rollback"),n=new Map,i=new Map;ee(r,{recursive:!0});for(let s of["index.scip","index.db","meta.json"]){let c=u(e,s),d=B(c);n.set(s,d),d&&ve(c,u(r,"stable",s))}for(let s of _t){let c=u(e,s),d=B(c);if(d){let l=Ct(c);if(!l.isDirectory()||l.isSymbolicLink())throw new Error(`managed artifact path is not a directory: ${s}`)}i.set(s,d)}let o=u(e,ce),a=B(o);return a&&Sn(o,u(r,"sqlite-generations")),{root:r,stableFiles:n,managedDirectories:i,generationStoreExisted:a}}function po(e,t,r){for(let n of _t){let i=u(t,n);if(r.managedDirectories.get(n)){let a=u(r.root,"managed",n);ee(At(a),{recursive:!0}),b(()=>U(i,a))}let o=u(e,n);B(o)&&b(()=>U(o,i))}}function fo(e,t){for(let i of _t){let o=u(e,i),a=u(t.root,"managed",i);t.managedDirectories.get(i)?B(a)&&(q(o,{recursive:!0,force:!0}),b(()=>U(a,o))):q(o,{recursive:!0,force:!0})}for(let[i,o]of t.stableFiles){let a=u(e,i);if(!o){q(a,{force:!0});continue}let s=`${a}.shared-restore-${to()}`;ve(u(t.root,"stable",i),s),b(()=>q(a,{force:!0})),b(()=>U(s,a))}let r=u(e,ce);q(r,{recursive:!0,force:!0});let n=u(t.root,"sqlite-generations");t.generationStoreExisted&&B(n)&&b(()=>U(n,r))}function Sn(e,t){ee(t,{recursive:!0});for(let r of un(e,{withFileTypes:!0})){let n=u(e,r.name),i=u(t,r.name);if(r.isSymbolicLink())throw new Error(`managed cache backup cannot contain a symlink: ${n}`);r.isDirectory()?Sn(n,i):r.isFile()&&ve(n,i)}}function go(e,t){if(e.generationId!==t.generationId||e.repositoryId!==t.repositoryId||e.treeOid!==t.treeOid||e.producerIdentity!==t.producerIdentity||JSON.stringify(e.fingerprint)!==JSON.stringify(t.fingerprint))throw new Error("shared generation manifest does not match the requested snapshot")}function Re(e,t,r,n=!0,i=!0){try{let o=Ft(e);if(!o||JSON.stringify(o.fingerprint)!==JSON.stringify(r)||JSON.stringify([...o.indexedLanguages??[]].sort())!==JSON.stringify([...r.languages].sort()))return xe("source validation rejected metadata"),!1;let a=je(e),s=Pt(u(e,"index.db"),u(e,"meta.json"));if(n?s.state!=="current":s.state==="invalid"||s.state==="drifted")return xe(`source validation rejected SQLite generation state ${s.state}`),!1;let c=new no(Ee(u(e,"index.db")),{readonly:!0,fileMustExist:!0});try{if(i){if(c.pragma("quick_check(1)",{simple:!0})!=="ok")return!1}else c.pragma("schema_version",{simple:!0})}finally{c.close()}let d=Bt(t),p=(i?a.files.filter(h=>h.endsWith(".scip")):["index.scip"]).every(h=>{let D=fn(w(A(e,h),{inputKind:"shared SCIP validation artifact",maxBytes:E})).metadata?.projectRoot,y=D!==void 0&&K(D,d);return y||xe(`source validation rejected SCIP root for ${h}: ${String(D)}`),y});return p||xe("source validation rejected SCIP project roots"),p}catch(o){return xe(`source validation failed: ${o instanceof Error?o.message:String(o)}`),!1}}function xe(e){process.env.CODEBASEIQ_DEBUG&&console.error(`shared-cache: ${e}`)}function Bt(e){try{return an(pn(e)).href}catch{return an(we(e)).href}}function bn(e){return ln("sha256").update(e).digest("hex")}function Ms(e){return typeof e=="object"&&e!==null}function _s(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")?e:null}export{Xt as a,mo as b,z as c,ke as d,xo as e,Zt as f,In as g,wo as h,De as i,er as j,tr as k,T as l,Co as m,Bo as n,fr as o,Ms as p,_s as q,ot as r,zr as s,Fa as t,Na as u,aa as v,sa as w,ca as x,da as y,la as z,Sa as A,ba as B,Ia as C,xa as D,Zr as E,Wi as F,Xa as G,Za as H,Pt as I,kt as J,gn as K,Ts as L,$ as M,Cs as N,mn as O,Dt as P,As as Q,ks as R,Ds as S,Lt as T,Ls as U,jt as V};
|
|
21
|
-
//# sourceMappingURL=chunk-T75DS2E6.js.map
|
package/dist/chunk-TJBOJUVN.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{e as p,o as x,q as l,r as g,u as v}from"./chunk-5IC2WZAL.js";import{M as h,P as u,da as f}from"./chunk-7UCDGXRW.js";import{d}from"./chunk-D62CTZX6.js";import{l as m}from"./chunk-5T44HG5Y.js";import{existsSync as C}from"fs";var E=5e3,S=100,R={prepare:f,freshness:h,ensureService:l,inspectService:g,requestRefresh:v,async reindex(e,t,n,o){let{reindexConfiguredProject:a}=await import("./project-reindex-TQFCOA2O.js");return a(e,t,n,o)},indexExists:C,wait(e){return new Promise(t=>setTimeout(t,e))},now:Date.now};async function I(e,t=R,n={}){if(e.dbPathSource==="env")return{source:"explicit-index",service:{kind:"skipped",reason:"environment"}};if(p(e.commandName,e.config)&&t.indexExists(e.paths.dbPath))return{source:"published-generation",service:{kind:"skipped",reason:"excluded-command"}};let o=y(e,t),a=t.prepare(e.projectRoot,e.config,e.paths,{gitContext:e.gitContext,...o?{watcherGeneration:o}:{}}),r=t.freshness(e.projectRoot,e.config,e.paths),i=t.ensureService({commandName:e.commandName,projectRoot:e.projectRoot,cacheDir:e.paths.cacheDir,cliVersion:m,config:e.config,gitContext:e.gitContext});if(r.state==="fresh")return{source:a.kind==="local-fresh"?"existing":"shared-generation",service:i};if((i.kind==="started"||i.kind==="reused")&&(t.requestRefresh(d(e.paths.cacheDir).activityPath,`evidence command ${e.commandName} requires a fresh generation`),r=await F(e,r,t,n,i),r.state==="fresh"))return{source:"watcher",service:i};try{await t.reindex(e.projectRoot,e.config,e.paths,{allowPartial:!1,skipAutoInstall:!0,trigger:{kind:"watch-demand",detail:`codebaseiq ${e.commandName}`},onStatus:()=>{}})}catch(s){throw new Error(`Could not prepare fresh evidence for codebaseiq ${e.commandName}: ${s instanceof Error?s.message:String(s)}`,{cause:s})}if(r=t.freshness(e.projectRoot,e.config,e.paths),r.state!=="fresh")throw new Error(`Could not prepare fresh evidence for codebaseiq ${e.commandName}: index remained ${r.state} (${r.reason})`);return{source:"synchronous-reindex",service:i}}function y(e,t){if(e.config.watch?.enabled===!0)try{return x(t.inspectService({projectRoot:e.projectRoot,cacheDir:e.paths.cacheDir,cliVersion:m,gitContext:e.gitContext}))}catch{return}}async function F(e,t,n,o,a){if(a.state.watcher.state==="budget-paused")return t;let r=Math.max(0,o.waitMs??E),i=Math.max(1,o.pollMs??S),s=n.now()+r,c=t;for(;n.now()<s;)if(await n.wait(Math.min(i,Math.max(1,s-n.now()))),u(),c=n.freshness(e.projectRoot,e.config,e.paths),c.state==="fresh")return c;return c}export{I as a};
|
|
3
|
-
//# sourceMappingURL=chunk-TJBOJUVN.js.map
|
package/dist/chunk-UC2FD2PS.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{isAbsolute as Z,relative as _e}from"path";var g=class extends Error{constructor(r,n){super(`refusing unsafe project file path ${JSON.stringify(r)} (${n})`);this.relativePath=r;this.reason=n;this.name="UnsafeProjectPathError"}relativePath;reason;code="CODEBASEIQ_UNSAFE_PROJECT_PATH"};function L(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function Ht(e){return e.replace(/\\/g,"/")}function Xt(e,t){return L(e)===L(t)}function Q(e){let t=e.trim();if(!/^file:/i.test(t))return t;let r;try{r=new URL(t)}catch{return t}if(r.protocol!=="file:")return t;let n;try{n=decodeURIComponent(r.pathname)}catch{return t}for(n=n.replace(/\\/g,"/");n.length>1&&n.endsWith("/");)n=n.slice(0,-1);let o=/^\/([A-Za-z]):(\/|$)/.exec(n);o&&(n=`/${o[1].toUpperCase()}:${n.slice(3)}`);let i=n.split("/").map(s=>encodeURIComponent(s).replace(/%3A/gi,":")).join("/");return`file://${r.host}${i}`}function Jt(e,t){return Q(e)===Q(t)}function _(e,t){let r=_e(e,t);return r===""||!r.startsWith("..")&&!Z(r)}function ee(e){if(!e)throw new g(e,"empty-path");if(e.includes("\0"))throw new g(e,"nul-byte");if(Z(e)||/^[A-Za-z]:/.test(e)||e.startsWith("//")||e.startsWith("\\\\"))throw new g(e,"absolute-path");let t=L(e);if(t.split("/").some(n=>n===".."))throw new g(e,"parent-traversal");if(!t||t===".")throw new g(e,"empty-path");return t}function Me(e,t,r=[]){let n=N(e);if(oe.has(n)||r.some(i=>k(n,i))||t.some(i=>se(n,i)))return"config";if(t.some(ce)&&/\.d\.(?:ts|mts|cts)$/.test(n.toLowerCase()))return"ambient";let o=ae(n);return t.some(i=>(ue[i]??[]).includes(o))?"source":"other"}function Yt(e,t,r){let n=N(e);if(oe.has(n)||r?.some(i=>k(n,i))||se(n,t)||ce(t)&&/\.d\.(?:ts|mts|cts)$/.test(n.toLowerCase()))return!0;let o=ae(n);return(ue[t]??[]).includes(o)}function Qt(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.version!="number"||!te(t.languages)||typeof t.pnpmWorkspaces!="boolean"||typeof t.typescriptProjectMode!="string"||!te(t.typescriptProjects)||t.clojureConfigPath!==void 0&&typeof t.clojureConfigPath!="string"||!Array.isArray(t.files)||!t.files.every(M)?null:t}function Zt(e,t){let r=new Map((e?.files??[]).map(a=>[a.path,a])),n=new Map(t.files.map(a=>[a.path,a])),o=new Set([...r.keys(),...n.keys()]),i=[];for(let a of[...o].sort()){let u=r.get(a),c=n.get(a),b=Me(a,t.languages);!u&&c?i.push({kind:"added",path:a,inputKind:b,after:c}):u&&!c?i.push({kind:"deleted",path:a,inputKind:b,before:u}):u&&c&&(u.hash!==c.hash||u.size!==c.size)&&i.push({kind:"modified",path:a,inputKind:b,before:u,after:c})}let s=new Set;return e||s.add("prior-snapshot-unavailable"),e&&e.version!==t.version&&s.add("snapshot-version-changed"),(re(e?.files??[])||re(t.files))&&s.add("duplicate-input-path"),[...e?.files??[],...t.files].some(Ne)&&s.add("unreadable-input"),{version:1,changes:i,projectIdentityChanged:e?!Te(e,t):!0,uncertainty:[...s].sort()}}function te(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function re(e){return new Set(e.map(t=>t.path)).size!==e.length}function M(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"}function Ne(e){return e.hash==="unreadable"||e.size<0}function Te(e,t){return ne(e.languages,t.languages)&&e.pnpmWorkspaces===t.pnpmWorkspaces&&e.typescriptProjectMode===t.typescriptProjectMode&&ne(e.typescriptProjects,t.typescriptProjects)&&e.clojureConfigPath===t.clojureConfigPath}function ne(e,t){if(e.length!==t.length)return!1;let r=[...e].sort(),n=[...t].sort();return r.every((o,i)=>o===n[i])}var oe=new Set([".codebaseiq.json"]),Be={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","*.slnx"],vb:["*.vbproj","*.sln","*.slnx"],dart:["pubspec.yaml"],php:["composer.json"],clojure:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"]},Ge={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:[]},ie=new Map;function se(e,t){return Be[t].some(r=>k(e,r))||Ge[t].some(r=>k(e,r))}function k(e,t){let r=N(t).replace(/^\.\//,"");if(!r)return!1;let n=e.split("/").at(-1)??e,o=r.includes("/")?e:n;if(!r.includes("*")&&!r.includes("?"))return o===r;let i=ie.get(r);if(!i){let s=r.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/\?/g,"[^/]");i=new RegExp(`^${s}$`),ie.set(r,i)}return i.test(o)}function N(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function ae(e){return e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:""}function ce(e){return e==="typescript"||e==="javascript"}var ue={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"]};function f(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function de(e){return typeof e=="string"&&Number.isFinite(Date.parse(e))}function tr(e){return typeof e=="string"&&e.length>0}function rr(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function nr(e){return typeof e=="string"&&e.length>0&&e.length<=256&&!/[\0\r\n]/u.test(e)}function ir(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}var pe=["typescript","javascript","java","scala","kotlin","rust","python","ruby","go","cpp","c","csharp","vb","dart","php","clojure"];var T=2,m=3;var B=new Set(pe);function pr(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch(s){return{kind:"malformed",reason:`invalid JSON: ${He(s)}`}}if(!f(t))return{kind:"malformed",reason:"metadata must be a JSON object"};let r=t.version;if(!Number.isInteger(r))return{kind:"malformed",reason:"version must be an integer"};if(r!==T&&r!==m)return{kind:"unsupported",version:r,direction:r<T?"older":"future"};let n=$e(t,r);if(n)return{kind:"malformed",reason:n};let o=t,i={metadata:o,capabilities:We(o)};return r===T?{kind:"legacy",...i,metadata:o}:{kind:"supported",...i,metadata:o}}function lr(e){return e.kind==="legacy"||e.kind==="supported"?e.metadata:null}function gr(e){if(e.kind!=="legacy"&&e.kind!=="supported"||!e.capabilities.stableGenerationIdentity)return null;let t=e.metadata;return JSON.stringify({version:t.version,status:t.status,updatedAt:t.updatedAt,fingerprint:t.fingerprint,indexedLanguages:t.indexedLanguages,scipCompanion:t.scipCompanion,sqliteLayoutVersion:t.version===m?t.sqliteLayoutVersion:void 0})}function We(e){let t=e.fingerprint!==void 0,r=f(e.fingerprint),n=e.indexedLanguages!==void 0,o=e.status==="complete",i=e.version===m?e:null;return{usableForQuery:n,usableForEvidenceCache:t,publishableGeneration:o&&r&&n,stableGenerationIdentity:o&&t&&typeof e.updatedAt=="string",languageShardReuse:!!i?.languageFingerprints,typescriptProjectShardReuse:!!i?.typescriptProjectShards}}function $e(e,t){if(e.status!=="complete"&&e.status!=="partial")return"status must be complete or partial";if(e.updatedAt!==void 0&&!de(e.updatedAt))return"updatedAt must be a valid timestamp";for(let r of["requestedLanguages","indexedLanguages"])if(e[r]!==void 0&&!Ue(e[r]))return`${r} must contain unique supported languages`;return e.skipped!==void 0&&!ze(e.skipped)?"skipped must contain supported language/reason pairs":e.scipCompanion!==void 0&&e.scipCompanion!=="current"&&e.scipCompanion!=="deferred"?"scipCompanion must be current or deferred":t===m&&e.sqliteLayoutVersion!==void 0&&(!Number.isSafeInteger(e.sqliteLayoutVersion)||e.sqliteLayoutVersion<1)?"sqliteLayoutVersion must be a positive safe integer":t===m&&e.languageFingerprints!==void 0&&!qe(e.languageFingerprints)?"languageFingerprints must map supported languages to fingerprint objects":t===m&&e.typescriptProjectShards!==void 0&&!Ve(e.typescriptProjectShards)?"typescriptProjectShards must map project names to file fingerprints":null}function fr(e){return e.version===m&&e.sqliteLayoutVersion===2}function Ue(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string"&&B.has(t))?!1:new Set(e).size===e.length}function ze(e){return Array.isArray(e)&&e.every(t=>f(t)&&typeof t.language=="string"&&B.has(t.language)&&typeof t.reason=="string")}function qe(e){return f(e)&&Object.entries(e).every(([t,r])=>B.has(t)&&f(r))}function Ve(e){return f(e)&&Object.values(e).every(t=>f(t)&&Array.isArray(t.files)&&t.files.every(M))}function He(e){return e instanceof Error?e.message:String(e)}import{closeSync as G,fstatSync as E,openSync as W,readFileSync as Xe,readSync as le}from"fs";import{createHash as Je}from"crypto";var ge=8*1024*1024,Ke=64*1024*1024,Ye=512*1024*1024,Qe=256*1024*1024,y=class extends Error{constructor(r,n,o,i,s){let a=o==="too-large"?`is ${i} bytes; the safety limit is ${s} bytes`:o==="not-regular"?"is not a regular file":"changed while it was being read";super(`${r} ${JSON.stringify(n)} ${a}`);this.inputKind=r;this.inputPath=n;this.reason=o;this.observedBytes=i;this.limitBytes=s;this.name="BoundedFileReadError"}inputKind;inputPath;reason;observedBytes;limitBytes;code="CODEBASEIQ_BOUNDED_FILE_READ"};function fe(e,t){z(t.maxBytes);let r=String(e),n=W(e,"r");try{let o=E(n);be(o,t,r);let i=Xe(n),s=E(n);if(s.dev!==o.dev||s.ino!==o.ino||s.size!==o.size||i.byteLength!==o.size)throw new y(t.inputKind,r,"changed-during-read",s.size,t.maxBytes);return i}finally{G(n)}}function ye(e,t,r="utf8"){return fe(e,t).toString(r)}function $(e,t){return ye(e,{maxBytes:ge,inputKind:t})}function U(e,t){z(t.maxBytes);let r=[],n=Buffer.allocUnsafe(64*1024),o=0;for(;;){let i=le(e,n,0,n.length,null);if(i===0)break;if(o+=i,!Number.isSafeInteger(o)||o>t.maxBytes)throw new y(t.inputKind,`file descriptor ${e}`,"too-large",o,t.maxBytes);r.push(Buffer.from(n.subarray(0,i)))}return Buffer.concat(r,o)}function Ze(e,t,r="utf8"){return U(e,t).toString(r)}function me(e,t){let r=W(e,"r");try{return U(r,t)}finally{G(r)}}function et(e,t,r="utf8"){return me(e,t).toString(r)}function he(e,t,r){z(t.maxBytes);let n=String(e),o=W(e,"r");try{let i=E(o);be(i,t,n);let s=Buffer.allocUnsafe(Math.min(1024*1024,Math.max(1,i.size))),a=0;for(;a<i.size;){let c=le(o,s,0,Math.min(s.length,i.size-a),a);if(c===0)break;r(s.subarray(0,c)),a+=c}let u=E(o);if(u.dev!==i.dev||u.ino!==i.ino||u.size!==i.size||a!==i.size)throw new y(t.inputKind,n,"changed-during-read",u.size,t.maxBytes);return a}finally{G(o)}}function tt(e,t){let r=Je("sha256");return he(e,t,n=>r.update(n)),r.digest("hex")}function be(e,t,r){if(!e.isFile())throw new y(t.inputKind,r,"not-regular",Number(e.size),t.maxBytes);if(e.size>t.maxBytes)throw new y(t.inputKind,r,"too-large",Number(e.size),t.maxBytes)}function z(e){if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`maxBytes must be a non-negative safe integer; received ${e}`)}import{createHash as we,randomUUID as dt}from"crypto";import{chmodSync as je,existsSync as h,linkSync as pt,lstatSync as D,readdirSync as H,realpathSync as p,unlinkSync as lt,writeSync as gt}from"fs";import{homedir as ft}from"os";import{basename as yt,dirname as A,isAbsolute as ke,join as d,resolve as v}from"path";import{closeSync as rt,existsSync as nt,fsyncSync as it,mkdirSync as ot,openSync as st}from"fs";import{dirname as Se}from"path";function xe(e,t,r,n){let o=0;for(;o<t.length;){let i=r.writeFile(e,t,o,t.length-o);if(!Number.isSafeInteger(i)||i<=0||i>t.length-o)throw new Error(`${n} write did not make valid forward progress`);o+=i}}function q(e,t){if(t!=="win32")return!1;let r=e.code;return r==="EACCES"||r==="EBADF"||r==="EINVAL"||r==="EISDIR"||r==="EPERM"}var S=Object.freeze({platform:process.platform,pathExists:e=>nt(e),makeDirectory:e=>ot(e,{recursive:!0}),openFile:(e,t,r)=>st(e,t,r),syncFile:e=>it(e),closeFile:e=>rt(e)});function Ce(e,t=S){let r=[],n=e;for(;!t.pathExists(n);){r.push(n);let i=Se(n);if(i===n)throw new Error(`Cannot establish a durable directory path without an existing ancestor: ${e}`);n=i}let o="synced";for(let i of r.reverse())t.makeDirectory(i),o=j(o,w(Se(i),t));return o}function w(e,t=S){let r;try{r=t.openFile(e,"r")}catch(n){if(q(n,t.platform))return"unsupported";throw n}try{t.syncFile(r)}catch(n){try{t.closeFile(r)}catch{}if(q(n,t.platform))return"unsupported";throw n}return t.closeFile(r),"synced"}function j(...e){return e.every(t=>t==="not-requested")?"not-requested":e.includes("unsupported")?"unsupported":"synced"}import{createRequire as at}from"module";var ct=at(import.meta.url),Re=ut().version;function ut(){for(let e of["../package.json","../../package.json"])try{return ct(e)}catch{}return{version:"0.0.0"}}var Pe=1,R=".codebaseiq-cache-owner.json",mt=16*1024,De=Object.freeze({...S,randomToken:()=>dt(),linkFile:(e,t)=>pt(e,t),removeFile:e=>lt(e),writeFile:(e,t,r,n)=>gt(e,t,r,n)});function P(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:"CODEBASEIQ_UNSAFE_CACHE_PATH",configuredPath:e,reason:t})}function l(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:"CODEBASEIQ_CACHE_OWNERSHIP",cacheDir:e,reason:t})}function ht(e,t){let r=p(e);return St(r,bt(r,t))}function bt(e,t){let r=p(e),n=process.env.CODEBASEIQ_CACHE_DIR;return n?v(n):t?.dbPath?Rt(r,t.dbPath):xt(r)}function Ae(){let e=process.env.XDG_CACHE_HOME;return d(e||d(ft(),".cache"),"codebaseiq")}function xt(e){let t=v(e);try{t=p(t)}catch{}let r=we("sha256").update(t).digest("hex").slice(0,12);return d(Ae(),"projects",r)}function Br(e){if(!/^[a-f0-9]{24}$/.test(e))throw new Error(`invalid repository cache identity: ${e}`);let t=d(Ae(),"repositories",e);return Fe(t),p(t)}function Gr(e){return process.env.CODEBASEIQ_SHARED_CACHE!=="0"&&!process.env.CODEBASEIQ_CACHE_DIR&&!process.env.CODEBASEIQ_INDEX_DB&&!e?.dbPath}function Wr(e,t){let r=ht(e,t);return{cacheDir:r,dbPath:d(r,"index.db"),indexPath:d(r,"index.scip"),metaPath:d(r,"meta.json")}}function St(e,t,r=De){return Ct(e,t,r).cacheDir}function Ct(e,t,r=De){let n=p(e),o=h(t)?"synced":Fe(t,r),i=p(t),s=d(i,R);if(h(s))return V(n,i),X(s),C(i),{kind:"existing",cacheDir:i};Ee(i),Pt(i),Ee(i);let u=`${JSON.stringify({schemaVersion:Pe,canonicalProjectRoot:n,canonicalCacheDir:i,creatorVersion:Re},null,2)}
|
|
2
|
-
`;try{let c=Dt(s,u,r),b=j(o,c);return{kind:"published",cacheDir:i,achievedDurability:b==="synced"?"directory-durable":"file-flushed",directorySync:b}}catch(c){if(vt(c))return V(n,i),{kind:"existing",cacheDir:i};throw c}}function V(e,t){let r=p(e),n=p(t);return Et(n,r,n)}function $r(e,t){return h(d(t,R))?(V(e,t),ve(t),!0):!1}function Rt(e,t){let r;try{r=ee(t)}catch(s){throw s instanceof g?P(t,s.reason):s}let n=v(e,...r.split("/"));if(n===e||!_(e,n))throw P(t,"outside-project");let o=kt(n),i=p(o);if(!_(e,i)&&i!==e)throw P(t,"symlink-escape");return n}function kt(e){let t=e;for(;!h(t);){let r=A(t);if(r===t)throw P(e,"no-existing-ancestor");t=r}return t}function Et(e,t,r){let n=d(e,R);if(!h(n)||D(n).isSymbolicLink())throw l(e,"missing regular ownership record");let o=D(n);if(!o.isFile()||o.size>mt)throw l(e,"invalid ownership record file");let i=$(n,"cache ownership record"),s=wt(i,e);if(s.canonicalProjectRoot!==t)throw l(e,"ownership record belongs to a different project");if(s.canonicalCacheDir!==r)throw l(e,"ownership record names a different cache directory");return{record:s,ownerSha256:we("sha256").update(i).digest("hex"),physicalCacheDir:e}}function wt(e,t){try{let r=JSON.parse(e);if(r.schemaVersion!==Pe||typeof r.canonicalProjectRoot!="string"||typeof r.canonicalCacheDir!="string"||typeof r.creatorVersion!="string"||!ke(r.canonicalProjectRoot)||!ke(r.canonicalCacheDir))throw new Error("invalid fields");return r}catch(r){throw l(t,`malformed ownership record: ${r instanceof Error?r.message:String(r)}`)}}function Ee(e){let t=H(e).filter(r=>r!==R&&!jt(r));if(t.length>0)throw l(e,`unrecognized existing entries: ${t.slice(0,3).join(", ")}`)}function jt(e){return e.startsWith(`${R}.tmp-`)||[".codebaseiq-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","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","watch-activity.json","watch-refresh-requests","watch-state.json","watch.lock"].includes(e)?!0:/^(?:reindex-|rust-|typescript-)/.test(e)}function Pt(e){for(let t of H(e)){let r=d(e,t);try{let n=D(r);if(n.isSymbolicLink())throw l(e,`legacy cache entry ${t} is a symlink`);if(n.isDirectory())C(r);else if(n.isFile())X(r);else throw l(e,`legacy cache entry ${t} is not a file or directory`)}catch(n){if(Ie(n))continue;throw n}}C(e)}function ve(e,t=!1){try{let r=D(e);if(r.isSymbolicLink())throw l(e,"managed cache tree contains a symlink");if(r.isFile()){X(e);return}if(!r.isDirectory())throw l(e,"managed cache tree contains a special file");C(e);for(let n of H(e))ve(d(e,n),!0)}catch(r){if(t&&Ie(r))return;throw r}}function Ie(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}function Fe(e,t=S){let r=Ce(e,t);return C(e),r}function Dt(e,t,r){let n=`${e}.tmp-${process.pid}-${r.randomToken()}`,o,i=!1;try{o=r.openFile(n,"wx",384),i=!0,xe(o,Buffer.from(t),r,"cache ownership record"),r.syncFile(o),r.closeFile(o),o=void 0,r.linkFile(n,e);let s=w(A(e),r);return r.removeFile(n),i=!1,j(s,w(A(e),r))}finally{if(o!==void 0)try{r.closeFile(o)}catch{}if(i)try{r.removeFile(n)}catch{}}}function C(e){process.platform!=="win32"&&je(e,448)}function X(e){process.platform!=="win32"&&je(e,384)}function At(e){if(h(e))return p(e);let t=[],r=e;for(;;){let n=A(r);if(n===r)return e;if(t.unshift(yt(r)),h(n))return d(p(n),...t);r=n}}function Ur(e){return At(v(e))}function vt(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="EEXIST"}import{spawnSync as It}from"child_process";import{createHash as Ft}from"crypto";import{existsSync as Ot,lstatSync as Lt,realpathSync as _t}from"fs";import{dirname as Mt,isAbsolute as Nt,join as Tt,resolve as F}from"path";function Bt(){return{...process.env,GIT_OPTIONAL_LOCKS:"0",LC_ALL:"C"}}var O={run(e,t){let r=Oe(e,t);return r.kind==="success"?r.output:void 0},runResult:Oe},Gt=["rev-parse","--show-toplevel","--absolute-git-dir","--git-common-dir","HEAD","HEAD^{tree}"],J=/^[0-9a-f]{40,64}$/;function Jr(e,t,r=O){if(!t||t.startsWith("-")||/[\0\r\n]/.test(t))throw new Error(`Invalid Git revision ${JSON.stringify(t)}.`);let n=r.runResult(e,["rev-parse","--verify","--end-of-options",`${t}^{commit}`]);if(n.kind!=="success"||!J.test(n.output))throw new Error(`Git revision ${JSON.stringify(t)} does not resolve to exactly one commit.`);return n.output}function Kr(e,t=O){let r=t.runResult(e,Gt);if(r.kind==="success"){let n=Wt(r.output);if(n)return $t(n,t)}return Ut(e,t)}function Wt(e){let t=e.split(`
|
|
3
|
-
`).map(u=>u.trim());if(t.length!==5)return;let[r,n,o,i,s]=t;if(!r||!n||!o||!i||!s||!J.test(i)||!J.test(s))return;let a=x(r);return{root:a,gitDir:x(I(a,n)),commonDir:x(I(a,o)),headCommit:i,treeOid:s}}function $t(e,t){let r=t.run(e.root,["status","--porcelain=v1","-z","--untracked-files=all"]);return r===void 0?void 0:{...Le(e.root,e.gitDir),commonDir:e.commonDir,repositoryId:Y("repository",e.commonDir),headCommit:e.headCommit,treeOid:e.treeOid,clean:r.length===0}}function Ut(e,t){let r=zt(e,t);if(r.kind!=="worktree")return;let n=r.identity,o=n.projectRoot,i=t.run(o,["rev-parse","--git-common-dir"])?.trim();if(!i)return;let s=x(I(o,i)),a=K(t.run(o,["rev-parse","--verify","HEAD"])),u=K(t.run(o,["rev-parse","--verify","HEAD^{tree}"])),c=t.run(o,["status","--porcelain=v1","-z","--untracked-files=all"]);if(c!==void 0)return{...n,commonDir:s,repositoryId:Y("repository",s),headCommit:a,treeOid:u,clean:c.length===0}}function zt(e,t=O){let r=t.runResult(e,["rev-parse","--show-toplevel"]);if(r.kind==="not-repository")return{kind:"non-git"};if(r.kind==="error")return r;let n=r.output.trim();if(!n)return{kind:"error",message:"Git returned an empty worktree root."};let o=x(n),i=t.run(o,["rev-parse","--absolute-git-dir"])?.trim();if(!i)return{kind:"error",message:"Git did not return an absolute worktree directory."};let s=x(I(o,i));return{kind:"worktree",identity:Le(o,s)}}function Le(e,t){return{projectRoot:e,gitDir:t,worktreeId:Y("worktree",`${e}\0${t}`)}}function Yr(e,t,r=O){return K(r.run(e,t))}function I(e,t){return Nt(t)?t:F(e,t)}function x(e){try{return _t(e)}catch{return F(e)}}function Y(e,t){return Ft("sha256").update(`${e}\0${t}`).digest("hex").slice(0,24)}function K(e){return e?.trim()||void 0}function Oe(e,t){let r=It("git",["-C",e,...t],{encoding:"utf-8",env:Bt(),maxBuffer:52428800,stdio:["ignore","pipe","pipe"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL"});if(r.status===0)return{kind:"success",output:r.stdout.trimEnd()};let o=(typeof r.stderr=="string"?r.stderr.trim():"")||r.error?.message||`git exited with status ${r.status??"unknown"}`,i=r.error?.code;return(/not a git repository/i.test(o)||i==="ENOENT"&&Ot(F(e)))&&!qt(e)?{kind:"not-repository"}:{kind:"error",message:o}}function qt(e){if(process.env.GIT_DIR||process.env.GIT_COMMON_DIR)return!0;let t=F(e);for(;;){try{return Lt(Tt(t,".git")),!0}catch(n){let o=n.code;if(o!=="ENOENT"&&o!=="ENOTDIR")return!0}let r=Mt(t);if(r===t)return!1;t=r}}export{g as a,L as b,Ht as c,Xt as d,Q as e,Jt as f,_ as g,ee as h,Me as i,Yt as j,Qt as k,Zt as l,Be as m,f as n,de as o,tr as p,rr as q,nr as r,ir as s,pe as t,m as u,pr as v,lr as w,gr as x,We as y,fr as z,ge as A,Ke as B,Ye as C,Qe as D,y as E,fe as F,ye as G,$ as H,Ze as I,et as J,he as K,tt as L,xe as M,q as N,S as O,Ce as P,w as Q,j as R,Re as S,bt as T,Ae as U,xt as V,Br as W,Gr as X,Wr as Y,$r as Z,Ur as _,Bt as $,O as aa,Jr as ba,Kr as ca,Yr as da,I as ea,x as fa};
|
|
4
|
-
//# sourceMappingURL=chunk-UC2FD2PS.js.map
|
package/dist/chunk-UQYQBLJX.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{closeSync as te,fstatSync as N,openSync as re,readFileSync as yt,readSync as ke}from"fs";import{createHash as St}from"crypto";var Fe=8*1024*1024,Ee=64*1024*1024,xt=512*1024*1024,bt=256*1024*1024,j=class extends Error{constructor(r,n,i,o,s){let a=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(`${r} ${JSON.stringify(n)} ${a}`);this.inputKind=r;this.inputPath=n;this.reason=i;this.observedBytes=o;this.limitBytes=s;this.name="BoundedFileReadError"}inputKind;inputPath;reason;observedBytes;limitBytes;code="CODEBASEIQ_BOUNDED_FILE_READ"};function ve(e,t){ie(t.maxBytes);let r=String(e),n=re(e,"r");try{let i=N(n);De(i,t,r);let o=yt(n),s=N(n);if(s.dev!==i.dev||s.ino!==i.ino||s.size!==i.size||o.byteLength!==i.size)throw new j(t.inputKind,r,"changed-during-read",s.size,t.maxBytes);return o}finally{te(n)}}function I(e,t,r="utf8"){return ve(e,t).toString(r)}function D(e,t){return I(e,{maxBytes:Fe,inputKind:t})}function Pt(e,t){return I(e,{maxBytes:Ee,inputKind:t})}function ne(e,t){ie(t.maxBytes);let r=[],n=Buffer.allocUnsafe(64*1024),i=0;for(;;){let o=ke(e,n,0,n.length,null);if(o===0)break;if(i+=o,!Number.isSafeInteger(i)||i>t.maxBytes)throw new j(t.inputKind,`file descriptor ${e}`,"too-large",i,t.maxBytes);r.push(Buffer.from(n.subarray(0,o)))}return Buffer.concat(r,i)}function jt(e,t,r="utf8"){return ne(e,t).toString(r)}function Ie(e,t){let r=re(e,"r");try{return ne(r,t)}finally{te(r)}}function wt(e,t,r="utf8"){return Ie(e,t).toString(r)}function z(e,t,r){ie(t.maxBytes);let n=String(e),i=re(e,"r");try{let o=N(i);De(o,t,n);let s=Buffer.allocUnsafe(Math.min(1024*1024,Math.max(1,o.size))),a=0;for(;a<o.size;){let u=ke(i,s,0,Math.min(s.length,o.size-a),a);if(u===0)break;r(s.subarray(0,u)),a+=u}let c=N(i);if(c.dev!==o.dev||c.ino!==o.ino||c.size!==o.size||a!==o.size)throw new j(t.inputKind,n,"changed-during-read",c.size,t.maxBytes);return a}finally{te(i)}}function Ct(e,t){let r=St("sha256");return z(e,t,n=>r.update(n)),r.digest("hex")}function De(e,t,r){if(!e.isFile())throw new j(t.inputKind,r,"not-regular",Number(e.size),t.maxBytes);if(e.size>t.maxBytes)throw new j(t.inputKind,r,"too-large",Number(e.size),t.maxBytes)}function ie(e){if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`maxBytes must be a non-negative safe integer; received ${e}`)}function oe(e,t,r=[]){let n=se(e);if(Be.has(n)||r.some(o=>M(n,o))||t.some(o=>Le(n,o)))return"config";if(t.some(ze)&&/\.d\.(?:ts|mts|cts)$/.test(n.toLowerCase()))return"ambient";let i=Ne(n);return t.some(o=>(Me[o]??[]).includes(i))?"source":"other"}function _e(e,t,r){let n=se(e);if(Be.has(n)||r?.some(o=>M(n,o))||Le(n,t)||ze(t)&&/\.d\.(?:ts|mts|cts)$/.test(n.toLowerCase()))return!0;let i=Ne(n);return(Me[t]??[]).includes(i)}function wn(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.version!="number"||!Re(t.languages)||typeof t.pnpmWorkspaces!="boolean"||typeof t.typescriptProjectMode!="string"||!Re(t.typescriptProjects)||t.clojureConfigPath!==void 0&&typeof t.clojureConfigPath!="string"||!Array.isArray(t.files)||!t.files.every(kt)?null:t}function Cn(e,t){let r=new Map((e?.files??[]).map(a=>[a.path,a])),n=new Map(t.files.map(a=>[a.path,a])),i=new Set([...r.keys(),...n.keys()]),o=[];for(let a of[...i].sort()){let c=r.get(a),u=n.get(a),l=oe(a,t.languages);!c&&u?o.push({kind:"added",path:a,inputKind:l,after:u}):c&&!u?o.push({kind:"deleted",path:a,inputKind:l,before:c}):c&&u&&(c.hash!==u.hash||c.size!==u.size)&&o.push({kind:"modified",path:a,inputKind:l,before:c,after:u})}let s=new Set;return e||s.add("prior-snapshot-unavailable"),e&&e.version!==t.version&&s.add("snapshot-version-changed"),(Oe(e?.files??[])||Oe(t.files))&&s.add("duplicate-input-path"),[...e?.files??[],...t.files].some(Ft)&&s.add("unreadable-input"),{version:1,changes:o,projectIdentityChanged:e?!Et(e,t):!0,uncertainty:[...s].sort()}}function Re(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function Oe(e){return new Set(e.map(t=>t.path)).size!==e.length}function kt(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"}function Ft(e){return e.hash==="unreadable"||e.size<0}function Et(e,t){return Ae(e.languages,t.languages)&&e.pnpmWorkspaces===t.pnpmWorkspaces&&e.typescriptProjectMode===t.typescriptProjectMode&&Ae(e.typescriptProjects,t.typescriptProjects)&&e.clojureConfigPath===t.clojureConfigPath}function Ae(e,t){if(e.length!==t.length)return!1;let r=[...e].sort(),n=[...t].sort();return r.every((i,o)=>i===n[o])}var Be=new Set([".codebaseiq.json"]),vt={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","*.slnx"],vb:["*.vbproj","*.sln","*.slnx"],dart:["pubspec.yaml"],php:["composer.json"],clojure:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"]},It={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:[]},Te=new Map;function Le(e,t){return vt[t].some(r=>M(e,r))||It[t].some(r=>M(e,r))}function M(e,t){let r=se(t).replace(/^\.\//,"");if(!r)return!1;let n=e.split("/").at(-1)??e,i=r.includes("/")?e:n;if(!r.includes("*")&&!r.includes("?"))return i===r;let o=Te.get(r);if(!o){let s=r.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/\?/g,"[^/]");o=new RegExp(`^${s}$`),Te.set(r,o)}return o.test(i)}function se(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function Ne(e){return e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:""}function ze(e){return e==="typescript"||e==="javascript"}var Me={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{createRequire as Dt}from"module";var Rt=Dt(import.meta.url),Ge=Ot().version;function Ot(){for(let e of["../package.json","../../package.json"])try{return Rt(e)}catch{}return{version:"0.0.0"}}import{createHash as Xe,randomUUID as zt}from"crypto";import{chmodSync as Ye,existsSync as k,linkSync as Mt,lstatSync as H,readdirSync as le,realpathSync as x,unlinkSync as Gt,writeSync as Wt}from"fs";import{homedir as $t}from"os";import{basename as Ht,dirname as U,isAbsolute as qe,join as y,resolve as J}from"path";import{closeSync as At,existsSync as Tt,fsyncSync as _t,mkdirSync as Bt,openSync as Lt}from"fs";import{dirname as $e}from"path";function We(e,t,r,n){let i=0;for(;i<t.length;){let o=r.writeFile(e,t,i,t.length-i);if(!Number.isSafeInteger(o)||o<=0||o>t.length-i)throw new Error(`${n} write did not make valid forward progress`);i+=o}}function ae(e,t){if(t!=="win32")return!1;let r=e.code;return r==="EACCES"||r==="EBADF"||r==="EINVAL"||r==="EISDIR"||r==="EPERM"}var R=Object.freeze({platform:process.platform,pathExists:e=>Tt(e),makeDirectory:e=>Bt(e,{recursive:!0}),openFile:(e,t,r)=>Lt(e,t,r),syncFile:e=>_t(e),closeFile:e=>At(e)});function He(e,t=R){let r=[],n=e;for(;!t.pathExists(n);){r.push(n);let o=$e(n);if(o===n)throw new Error(`Cannot establish a durable directory path without an existing ancestor: ${e}`);n=o}let i="synced";for(let o of r.reverse())t.makeDirectory(o),i=W(i,G($e(o),t));return i}function G(e,t=R){let r;try{r=t.openFile(e,"r")}catch(n){if(ae(n,t.platform))return"unsupported";throw n}try{t.syncFile(r)}catch(n){try{t.closeFile(r)}catch{}if(ae(n,t.platform))return"unsupported";throw n}return t.closeFile(r),"synced"}function W(...e){return e.every(t=>t==="not-requested")?"not-requested":e.includes("unsupported")?"unsupported":"synced"}import{isAbsolute as Je,relative as Nt}from"path";var m=class extends Error{constructor(r,n){super(`refusing unsafe project file path ${JSON.stringify(r)} (${n})`);this.relativePath=r;this.reason=n;this.name="UnsafeProjectPathError"}relativePath;reason;code="CODEBASEIQ_UNSAFE_PROJECT_PATH"};function ce(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function Tn(e){return e.replace(/\\/g,"/")}function _n(e,t){return ce(e)===ce(t)}function Ue(e){let t=e.trim();if(!/^file:/i.test(t))return t;let r;try{r=new URL(t)}catch{return t}if(r.protocol!=="file:")return t;let n;try{n=decodeURIComponent(r.pathname)}catch{return t}for(n=n.replace(/\\/g,"/");n.length>1&&n.endsWith("/");)n=n.slice(0,-1);let i=/^\/([A-Za-z]):(\/|$)/.exec(n);i&&(n=`/${i[1].toUpperCase()}:${n.slice(3)}`);let o=n.split("/").map(s=>encodeURIComponent(s).replace(/%3A/gi,":")).join("/");return`file://${r.host}${o}`}function Bn(e,t){return Ue(e)===Ue(t)}function S(e,t){let r=Nt(e,t);return r===""||!r.startsWith("..")&&!Je(r)}function C(e){if(!e)throw new m(e,"empty-path");if(e.includes("\0"))throw new m(e,"nul-byte");if(Je(e)||/^[A-Za-z]:/.test(e)||e.startsWith("//")||e.startsWith("\\\\"))throw new m(e,"absolute-path");let t=ce(e);if(t.split("/").some(n=>n===".."))throw new m(e,"parent-traversal");if(!t||t===".")throw new m(e,"empty-path");return t}var Ve=1,A=".codebaseiq-cache-owner.json",Ut=16*1024,Qe=Object.freeze({...R,randomToken:()=>zt(),linkFile:(e,t)=>Mt(e,t),removeFile:e=>Gt(e),writeFile:(e,t,r,n)=>Wt(e,t,r,n)});function $(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:"CODEBASEIQ_UNSAFE_CACHE_PATH",configuredPath:e,reason:t})}function b(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:"CODEBASEIQ_CACHE_OWNERSHIP",cacheDir:e,reason:t})}function Jt(e,t){let r=x(e);return Kt(r,de(r,t))}function de(e,t){let r=x(e),n=process.env.CODEBASEIQ_CACHE_DIR;return n?J(n):t?.dbPath?Yt(r,t.dbPath):qt(r)}function Ze(){let e=process.env.XDG_CACHE_HOME;return y(e||y($t(),".cache"),"codebaseiq")}function qt(e){let t=J(e);try{t=x(t)}catch{}let r=Xe("sha256").update(t).digest("hex").slice(0,12);return y(Ze(),"projects",r)}function qn(e){if(!/^[a-f0-9]{24}$/.test(e))throw new Error(`invalid repository cache identity: ${e}`);let t=y(Ze(),"repositories",e);return rt(t),x(t)}function Kn(e){return process.env.CODEBASEIQ_SHARED_CACHE!=="0"&&!process.env.CODEBASEIQ_CACHE_DIR&&!process.env.CODEBASEIQ_INDEX_DB&&!e?.dbPath}function Xn(e,t){let r=Jt(e,t);return{cacheDir:r,dbPath:y(r,"index.db"),indexPath:y(r,"index.scip"),metaPath:y(r,"meta.json")}}function Kt(e,t,r=Qe){return Xt(e,t,r).cacheDir}function Xt(e,t,r=Qe){let n=x(e),i=k(t)?"synced":rt(t,r),o=x(t),s=y(o,A);if(k(s))return ue(n,o),pe(s),O(o),{kind:"existing",cacheDir:o};Ke(o),tr(o),Ke(o);let c=`${JSON.stringify({schemaVersion:Ve,canonicalProjectRoot:n,canonicalCacheDir:o,creatorVersion:Ge},null,2)}
|
|
2
|
-
`;try{let u=rr(s,c,r),l=W(i,u);return{kind:"published",cacheDir:o,achievedDurability:l==="synced"?"directory-durable":"file-flushed",directorySync:l}}catch(u){if(ir(u))return ue(n,o),{kind:"existing",cacheDir:o};throw u}}function ue(e,t){let r=x(e),n=x(t);return Qt(n,r,n)}function Yn(e,t){return k(y(t,A))?(ue(e,t),et(t),!0):!1}function Yt(e,t){let r;try{r=C(t)}catch(s){throw s instanceof m?$(t,s.reason):s}let n=J(e,...r.split("/"));if(n===e||!S(e,n))throw $(t,"outside-project");let i=Vt(n),o=x(i);if(!S(e,o)&&o!==e)throw $(t,"symlink-escape");return n}function Vt(e){let t=e;for(;!k(t);){let r=U(t);if(r===t)throw $(e,"no-existing-ancestor");t=r}return t}function Qt(e,t,r){let n=y(e,A);if(!k(n)||H(n).isSymbolicLink())throw b(e,"missing regular ownership record");let i=H(n);if(!i.isFile()||i.size>Ut)throw b(e,"invalid ownership record file");let o=D(n,"cache ownership record"),s=Zt(o,e);if(s.canonicalProjectRoot!==t)throw b(e,"ownership record belongs to a different project");if(s.canonicalCacheDir!==r)throw b(e,"ownership record names a different cache directory");return{record:s,ownerSha256:Xe("sha256").update(o).digest("hex"),physicalCacheDir:e}}function Zt(e,t){try{let r=JSON.parse(e);if(r.schemaVersion!==Ve||typeof r.canonicalProjectRoot!="string"||typeof r.canonicalCacheDir!="string"||typeof r.creatorVersion!="string"||!qe(r.canonicalProjectRoot)||!qe(r.canonicalCacheDir))throw new Error("invalid fields");return r}catch(r){throw b(t,`malformed ownership record: ${r instanceof Error?r.message:String(r)}`)}}function Ke(e){let t=le(e).filter(r=>r!==A&&!er(r));if(t.length>0)throw b(e,`unrecognized existing entries: ${t.slice(0,3).join(", ")}`)}function er(e){return e.startsWith(`${A}.tmp-`)||[".codebaseiq-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","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","watch-activity.json","watch-refresh-requests","watch-state.json","watch.lock"].includes(e)?!0:/^(?:reindex-|rust-|typescript-)/.test(e)}function tr(e){for(let t of le(e)){let r=y(e,t);try{let n=H(r);if(n.isSymbolicLink())throw b(e,`legacy cache entry ${t} is a symlink`);if(n.isDirectory())O(r);else if(n.isFile())pe(r);else throw b(e,`legacy cache entry ${t} is not a file or directory`)}catch(n){if(tt(n))continue;throw n}}O(e)}function et(e,t=!1){try{let r=H(e);if(r.isSymbolicLink())throw b(e,"managed cache tree contains a symlink");if(r.isFile()){pe(e);return}if(!r.isDirectory())throw b(e,"managed cache tree contains a special file");O(e);for(let n of le(e))et(y(e,n),!0)}catch(r){if(t&&tt(r))return;throw r}}function tt(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}function rt(e,t=R){let r=He(e,t);return O(e),r}function rr(e,t,r){let n=`${e}.tmp-${process.pid}-${r.randomToken()}`,i,o=!1;try{i=r.openFile(n,"wx",384),o=!0,We(i,Buffer.from(t),r,"cache ownership record"),r.syncFile(i),r.closeFile(i),i=void 0,r.linkFile(n,e);let s=G(U(e),r);return r.removeFile(n),o=!1,W(s,G(U(e),r))}finally{if(i!==void 0)try{r.closeFile(i)}catch{}if(o)try{r.removeFile(n)}catch{}}}function O(e){process.platform!=="win32"&&Ye(e,448)}function pe(e){process.platform!=="win32"&&Ye(e,384)}function nr(e){if(k(e))return x(e);let t=[],r=e;for(;;){let n=U(r);if(n===r)return e;if(t.unshift(Ht(r)),k(n))return y(x(n),...t);r=n}}function Vn(e){return nr(J(e))}function ir(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="EEXIST"}import{spawnSync as or}from"child_process";import{createHash as sr}from"crypto";import{existsSync as ar,lstatSync as cr,realpathSync as ur}from"fs";import{dirname as lr,isAbsolute as dr,join as pr,resolve as K}from"path";function he(){return{...process.env,GIT_OPTIONAL_LOCKS:"0",LC_ALL:"C"}}var T={run(e,t){let r=nt(e,t);return r.kind==="success"?r.output:void 0},runResult:nt},fr=["rev-parse","--show-toplevel","--absolute-git-dir","--git-common-dir","HEAD","HEAD^{tree}"],fe=/^[0-9a-f]{40,64}$/;function ni(e,t,r=T){if(!t||t.startsWith("-")||/[\0\r\n]/.test(t))throw new Error(`Invalid Git revision ${JSON.stringify(t)}.`);let n=r.runResult(e,["rev-parse","--verify","--end-of-options",`${t}^{commit}`]);if(n.kind!=="success"||!fe.test(n.output))throw new Error(`Git revision ${JSON.stringify(t)} does not resolve to exactly one commit.`);return n.output}function ii(e,t=T){let r=t.runResult(e,fr);if(r.kind==="success"){let n=gr(r.output);if(n)return hr(n,t)}return mr(e,t)}function gr(e){let t=e.split(`
|
|
3
|
-
`).map(c=>c.trim());if(t.length!==5)return;let[r,n,i,o,s]=t;if(!r||!n||!i||!o||!s||!fe.test(o)||!fe.test(s))return;let a=P(r);return{root:a,gitDir:P(q(a,n)),commonDir:P(q(a,i)),headCommit:o,treeOid:s}}function hr(e,t){let r=t.run(e.root,["status","--porcelain=v1","-z","--untracked-files=all"]);return r===void 0?void 0:{...it(e.root,e.gitDir),commonDir:e.commonDir,repositoryId:me("repository",e.commonDir),headCommit:e.headCommit,treeOid:e.treeOid,clean:r.length===0}}function mr(e,t){let r=yr(e,t);if(r.kind!=="worktree")return;let n=r.identity,i=n.projectRoot,o=t.run(i,["rev-parse","--git-common-dir"])?.trim();if(!o)return;let s=P(q(i,o)),a=ge(t.run(i,["rev-parse","--verify","HEAD"])),c=ge(t.run(i,["rev-parse","--verify","HEAD^{tree}"])),u=t.run(i,["status","--porcelain=v1","-z","--untracked-files=all"]);if(u!==void 0)return{...n,commonDir:s,repositoryId:me("repository",s),headCommit:a,treeOid:c,clean:u.length===0}}function yr(e,t=T){let r=t.runResult(e,["rev-parse","--show-toplevel"]);if(r.kind==="not-repository")return{kind:"non-git"};if(r.kind==="error")return r;let n=r.output.trim();if(!n)return{kind:"error",message:"Git returned an empty worktree root."};let i=P(n),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=P(q(i,o));return{kind:"worktree",identity:it(i,s)}}function it(e,t){return{projectRoot:e,gitDir:t,worktreeId:me("worktree",`${e}\0${t}`)}}function oi(e,t=T){let r=t.run(e,["worktree","list","--porcelain","-z"]);return r===void 0?[]:Sr(r)}function Sr(e){let t=[],r;for(let n of e.split("\0")){if(n===""){r&&t.push(r),r=void 0;continue}let i=n.indexOf(" "),o=i<0?n:n.slice(0,i),s=i<0?"":n.slice(i+1);if(o==="worktree"){r&&t.push(r),r={path:P(s),detached:!1,bare:!1,prunable:!1,locked:!1};continue}r&&(o==="HEAD"?r.head=s:o==="branch"?r.branch=s:o==="detached"?r.detached=!0:o==="bare"?r.bare=!0:o==="prunable"?r.prunable=!0:o==="locked"&&(r.locked=!0))}return r&&t.push(r),t}function si(e,t,r=T){return ge(r.run(e,t))}function q(e,t){return dr(t)?t:K(e,t)}function P(e){try{return ur(e)}catch{return K(e)}}function me(e,t){return sr("sha256").update(`${e}\0${t}`).digest("hex").slice(0,24)}function ge(e){return e?.trim()||void 0}function nt(e,t){let r=or("git",["-C",e,...t],{encoding:"utf-8",env:he(),maxBuffer:52428800,stdio:["ignore","pipe","pipe"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL"});if(r.status===0)return{kind:"success",output:r.stdout.trimEnd()};let i=(typeof r.stderr=="string"?r.stderr.trim():"")||r.error?.message||`git exited with status ${r.status??"unknown"}`,o=r.error?.code;return(/not a git repository/i.test(i)||o==="ENOENT"&&ar(K(e)))&&!xr(e)?{kind:"not-repository"}:{kind:"error",message:i}}function xr(e){if(process.env.GIT_DIR||process.env.GIT_COMMON_DIR)return!0;let t=K(e);for(;;){try{return cr(pr(t,".git")),!0}catch(n){let i=n.code;if(i!=="ENOENT"&&i!=="ENOTDIR")return!0}let r=lr(t);if(r===t)return!1;t=r}}import{execFileSync as Xr}from"child_process";import{createHash as ft}from"crypto";import{closeSync as Yr,fstatSync as gt,lstatSync as be,openSync as Vr,readdirSync as Qr,readFileSync as Zr,readlinkSync as en,realpathSync as V}from"fs";import{isAbsolute as tn,join as Pe,relative as rn,resolve as nn,sep as on}from"path";import{execFileSync as ye}from"child_process";import{createHash as br}from"crypto";import{mkdirSync as Pr,renameSync as jr,writeFileSync as wr}from"fs";import{basename as Cr,dirname as kr,join as Fr}from"path";var Er="git-content-hashes.json",vr=32*1024*1024,Ir=2e5,X=3e4;function Se(){return{env:he(),encoding:"utf8",maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:X,killSignal:"SIGKILL"}}function ot(e){let t,r;try{t=ye("git",["-C",e,"ls-files","-s","-z","--","."],{...Se(),timeout:X}),r=ye("git",["-C",e,"status","--porcelain=v1","-z","--untracked-files=all","--no-renames","--","."],{...Se(),timeout:X})}catch{return null}let n=new Map,i=[];for(let l of t.split("\0")){if(!l)continue;let f=l.indexOf(" "),p=f>0?l.slice(0,f).split(" "):[];if(p.length!==3)continue;let[h,g,L]=p,w=l.slice(f+1);if(h!=="100644"&&h!=="100755"||L!=="0"){n.delete(w);continue}n.set(w,g),Cr(w)===".gitattributes"&&i.push(`${w}:${g}`)}let o=new Set;for(let l of r.split("\0"))l.length>=4&&l[2]===" "&&o.add(l.slice(3));let s=Dr(e,i),a=Fr(de(e),Er),c=Rr(a,s),u=new Map;return{lookup(l){if(o.has(l))return;let f=n.get(l);if(f)return u.get(f)??c.entries[f]},seed(l,f){if(o.has(l))return;let p=n.get(l);!p||c.entries[p]||u.has(p)||u.set(p,f)},persist(){if(u.size===0)return;let l=new Set(n.values()),f={};for(let[p,h]of Object.entries(c.entries))l.has(p)&&(f[p]=h);for(let[p,h]of u)f[p]=h;if(!(Object.keys(f).length>Ir))try{Pr(kr(a),{recursive:!0});let p=`${a}.${process.pid}.tmp`;wr(p,JSON.stringify({version:1,salt:s,entries:f})),jr(p,a)}catch{}}}}function Dr(e,t){let r="";try{r=ye("git",["-C",e,"config","--get-regexp","^core\\.(autocrlf|eol|safecrlf)$"],{...Se(),timeout:X})}catch{}return br("sha256").update(JSON.stringify([r.trim(),t.sort()])).digest("hex")}function Rr(e,t){let r={version:1,salt:t,entries:{}};try{let n=I(e,{maxBytes:vr,inputKind:"git-content-hash-store"}),i=JSON.parse(n);if(i.version!==1||i.salt!==t||!i.entries||typeof i.entries!="object")return r;let o={};for(let[s,a]of Object.entries(i.entries))/^[0-9a-f]{40,64}$/.test(s)&&a&&typeof a.size=="number"&&Number.isInteger(a.size)&&a.size>=0&&typeof a.hash=="string"&&/^[0-9a-f]{64}$/.test(a.hash)&&(o[s]={size:a.size,hash:a.hash});return{version:1,salt:t,entries:o}}catch{return r}}import{AsyncLocalStorage as Or}from"async_hooks";var Ar=new Or;function E(e,t){let r=Y(e);if(!r||r.missing.has(t))return;let n=r.files.get(t);if(n)return n;let i=r.readBaseFile?.(t);return i&&r.files.set(t,i),i}function v(e,t){let r=Y(e);if(r)return r.missing.has(t)?"missing":r.paths.includes(t)?"present":"missing"}function st(e,t){return Y(e)?.fingerprints.get(t)}function F(e){return Y(e)?.paths}function Y(e){let t=Ar.getStore();if(t)return t.projectRoot===P(e)?t:void 0}import{createRequire as Tr}from"module";import{existsSync as _r,readdirSync as Br,statSync as Lr}from"fs";import d from"path";var Nr=Tr(import.meta.url),at=new Set([".cache",".git",".next",".nuxt",".turbo",".nx","build","coverage","dist","node_modules","tmp","vendor"]);function zr(e,t=[]){let r=d.resolve(e),n=t.flatMap(c=>Gr(r,c));if(n.length>0)return ct(r,lt(n));let i=Mr(r),o=lt(i),s=Wr(r,o)?[r,...o]:o,a=s.length>0?s:[r];return ct(r,a)}function dt(e,t,r=[]){let n;try{n=Nr("ts-morph")}catch{return null}let i=d.resolve(e),o=t==="workspace"?zr(i,r):["."],s=new Set;for(let a of o){let c=a==="."?i:d.join(i,a),u=d.join(c,"tsconfig.json"),l=Jr(n.ts,i);if(!l.fileExists(u))return null;let f=n.ts.readConfigFile(u,l.readFile);if(f.error)return null;let p=n.ts.parseJsonConfigFileContent(f.config,l,c);if(p.errors.length>0)return null;for(let h of p.fileNames){let g=d.resolve(h);S(i,g)&&s.add(d.relative(i,g).split(d.sep).join("/"))}}return s}function ct(e,t){return[...new Set(t.map(r=>_(e,r)))].sort((r,n)=>r.localeCompare(n))}function Mr(e){let t=F(e);if(t)return t.flatMap(i=>{if(i.split("/").some(s=>at.has(s)))return[];let o=d.join(e,...i.split("/"));return ut(e,o)?[d.dirname(o)]:[]});let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=Br(i,{withFileTypes:!0})}catch{continue}for(let s of o){let a=d.join(i,s.name);if(s.isDirectory()){!at.has(s.name)&&!s.name.startsWith(".")&&n.push(a);continue}s.isFile()&&ut(e,a)&&r.push(d.dirname(a))}}return r}function Gr(e,t){let r=t.trim();if(!r)return[];let n=d.resolve(e,r);if(!S(e,n))return[];let i=F(e);if(i){let o=_(e,n);if(i.includes(o)&&xe(d.basename(n)))return[d.dirname(n)];let s=o==="."?"":`${o}/`;return i.some(a=>a.startsWith(s))?[n]:[]}try{let o=Lr(n);if(o.isDirectory())return[n];if(o.isFile()&&xe(d.basename(n)))return[d.dirname(n)]}catch{return[]}return[]}function ut(e,t){if(!xe(d.basename(t)))return!1;let r=pt(e,t);return r?d.basename(t)==="tsconfig.json"||"include"in r||"files"in r||"references"in r:!1}function xe(e){return e.startsWith("tsconfig")&&e.endsWith(".json")}function lt(e){let t=[...new Set(e.map(r=>d.resolve(r)))].sort((r,n)=>r.localeCompare(n));return t.length<=1?t:t.filter(r=>!t.some(n=>n!==r&&Kr(r,n)))}function Wr(e,t){if(t.length===0||t.some(n=>d.resolve(n)===e))return!1;let r=d.join(e,"tsconfig.json");return Hr(e,r)&&$r(e,r)}function $r(e,t){let n=pt(e,t)?.include;return Array.isArray(n)?n.some(i=>typeof i=="string"&&i.trim()!==""&&!i.startsWith("!")&&(i.includes("/")||i.includes("**")||!d.extname(i))):!1}function pt(e,t){try{let r=JSON.parse(Ur(e,t));return r&&typeof r=="object"&&!Array.isArray(r)?r:null}catch{return null}}function Hr(e,t){let r=_(e,t),n=v(e,r);return n?n==="present":_r(t)}function Ur(e,t){let r=_(e,t);if(F(e)){let i=E(e,r);if(!i)throw Object.assign(new Error(`Snapshot file ${r} is missing.`),{code:"ENOENT"});return i.content.toString("utf8")}return D(t,"TypeScript project config")}function Jr(e,t){let r=F(t);if(!r)return e.sys;let n=d.resolve(t),i=new Set(r),o=qr(n,r),s=e,a=c=>{let u=d.resolve(c);return S(n,u)?_(n,u):null};return{useCaseSensitiveFileNames:e.sys.useCaseSensitiveFileNames,fileExists(c){let u=a(c);return u===null?e.sys.fileExists(c):i.has(u)},readFile(c){let u=a(c);return u===null?e.sys.readFile(c):E(n,u)?.content.toString("utf8")},readDirectory(c,u,l,f,p){let h=d.resolve(c);return S(n,h)?s.matchFiles(h,u,l,f,e.sys.useCaseSensitiveFileNames,n,p,g=>o.get(d.resolve(g))??{files:[],directories:[]},g=>g):e.sys.readDirectory(c,u,l,f,p)}}}function qr(e,t){let r=new Map,n=new Map,i=o=>{r.has(o)||r.set(o,new Set),n.has(o)||n.set(o,new Set)};i(e);for(let o of t){let s=o.split("/"),a=e;for(let c=0;c<s.length-1;c+=1){let u=s[c];i(a),n.get(a).add(u),a=d.join(a,u),i(a)}r.get(a).add(s.at(-1))}return new Map([...r].map(([o,s])=>[o,{files:[...s].sort(),directories:[...n.get(o)??[]].sort()}]))}function _(e,t){let r=d.relative(e,t);return r?r.split(d.sep).join("/"):"."}function Kr(e,t){let r=d.relative(e,t);return!!r&&!r.startsWith("..")&&!d.isAbsolute(r)}var Q=64*1024*1024,B=class extends Error{constructor(r,n,i,o){super(`${r} ${JSON.stringify(n)} is ${i} bytes; the safety limit is ${o} bytes`);this.inputKind=r;this.inputPath=n;this.observedBytes=i;this.limitBytes=o;this.name="InputTooLargeError"}inputKind;inputPath;observedBytes;limitBytes;code="CODEBASEIQ_INPUT_TOO_LARGE"};function sn(e){return[...new Set((e??[]).map(t=>t.trim()).filter(Boolean))].sort((t,r)=>t.localeCompare(r))}function ht(e,t,r={}){let n=C(t),i=V(e),o=nn(i,...n.split("/"));if(!S(i,o)||o===i)throw new m(t,"outside-project");let s=V(o);if(!S(i,s)||s===i)throw new m(t,"outside-project");let a=be(s);if(!a.isFile())throw new m(t,"not-a-file");let c={projectRoot:i,relativePath:n,absolutePath:s,size:a.size,mtimeMs:a.mtimeMs,device:a.dev,inode:a.ino},u=r.maxBytes??Q;if(mt(u),c.size>u)throw new B(r.inputKind??"project file",c.relativePath,c.size,u);return c}function an(e,t,r={}){let n=C(t),i=v(e,n);if(i){if(i==="missing")throw Object.assign(new Error(`Snapshot project file ${JSON.stringify(n)} does not exist.`),{code:"ENOENT"});let c=E(e,n);if(!c)throw new m(n,"changed-during-read");let u=r.maxBytes??Q;if(mt(u),c.size>u)throw new B(r.inputKind??"project file",n,c.size,u);return Buffer.from(c.content)}let o=ht(e,t,r),s=r.maxBytes??Q,a=Vr(o.absolutePath,"r");try{let c=gt(a);if(!c.isFile()||c.dev!==o.device||c.ino!==o.inode||c.size!==o.size)throw new m(t,"changed-during-read");if(c.size>s)throw new B(r.inputKind??"project file",o.relativePath,c.size,s);let u=Zr(a),l=gt(a);if(l.dev!==c.dev||l.ino!==c.ino||l.size!==c.size||u.byteLength!==c.size)throw new m(t,"changed-during-read");return u}finally{Yr(a)}}function Bi(e,t,r={}){return an(e,t,r).toString("utf8")}function je(e){return typeof e=="object"&&e!==null&&"code"in e&&(e.code==="ENOENT"||e.code==="ENOTDIR")}function Li(e,t){try{return ht(e,t),!0}catch(r){if(je(r))return!1;throw r}}function mt(e){if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`maxBytes must be a non-negative safe integer; received ${e}`)}function cn(e){return(F(e)??gn(e)??hn(e)).filter(t=>t&&!we(t)).sort()}function un(e,t={}){let r=(t.includePaths??[]).map(C),n=[...new Set([...cn(e),...r])].filter(c=>!we(c)).filter(c=>!t.language||_e(c,t.language,t.markerFiles)).filter(c=>!t.includePath||t.includePath(c)).sort(),i=V(e),o,s=()=>o??=ot(i),a=n.flatMap(c=>{let u=st(e,c);if(u)return[{path:c,size:u.fingerprintSize??u.size,hash:u.sha256}];let l=v(e,c);if(l==="present"){let g=E(e,c);if(g)return[{path:c,size:g.fingerprintSize??g.size,hash:g.sha256}]}let f=l===void 0?s():null,p=f?.lookup(c);if(p)return[{path:c,size:p.size,hash:p.hash}];let h=Pe(e,c);try{if(be(h).isSymbolicLink()){let Z=V(h),ee=rn(i,Z);if(ee===".."||ee.startsWith(`..${on}`)||tn(ee))throw new Error("external symlink");let Ce=en(h);return[{path:c,size:Buffer.byteLength(Ce),hash:ft("sha256").update("symlink\0").update(Ce).digest("hex")}]}let g=ft("sha256"),L=z(h,{inputKind:"project fingerprint input",maxBytes:Q},Z=>g.update(Z)),w=g.digest("hex");return f?.seed(c,{size:L,hash:w}),[{path:c,size:L,hash:w}]}catch(g){return je(g)?[]:[{path:c,size:-1,hash:"unreadable"}]}});return o?.persist(),a}function Ni(e,t,r){let n=pn(t,r),i=[...n.typescriptProjects.filter(s=>dn(e,s)),...n.clojureConfigPath?[n.clojureConfigPath]:[]],o=n.languages.includes("typescript")?dt(e,n.typescriptProjectMode,n.typescriptProjects):null;return{...n,files:un(e,{includePath:s=>{let a=oe(s,t,i);return a==="other"?!1:a!=="source"||!ln(s)||!o?!0:o.has(s)},includePaths:i})}}function ln(e){return/\.(?:[cm]?[jt]sx?|vue)$/iu.test(e)}function dn(e,t){let r;try{r=C(t)}catch{return!1}let n=v(e,r);if(n)return n==="present";try{return be(Pe(e,r)).isFile()}catch(i){if(je(i))return!1;throw i}}function pn(e,t){return{version:3,languages:[...e].sort(),pnpmWorkspaces:t.typescriptProjectMode!=="workspace"&&t.pnpmWorkspaces===!0,typescriptProjectMode:t.typescriptProjectMode??"single",typescriptProjects:sn(t.typescriptProjects),clojureConfigPath:fn(t.clojureConfigPath)}}function fn(e){return e?.trim()||void 0}function gn(e){try{return Xr("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:50*1024*1024,stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL"}).split(`
|
|
4
|
-
`).filter(Boolean)}catch{return null}}function hn(e){let t=[],r=[""];for(;r.length>0;){let n=r.pop(),i=n?Pe(e,n):e,o;try{o=Qr(i,{withFileTypes:!0})}catch{continue}for(let s of o){let a=n?`${n}/${s.name}`:s.name;if(s.isDirectory()){we(a)||r.push(a);continue}t.push(a)}}return t}function we(e){let t=e.split("/");return e==="meta.json"||t[0]===".codebaseiq"&&(t[1]==="events"||t[1]==="ledger"||t[1]==="releases"||t[1]==="suppressions")||t.some(r=>mn.has(r))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var mn=new Set([".git","node_modules",".codebaseiq-cache",".codebaseiq-generations",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]);export{Fe as a,Ee as b,xt as c,bt as d,j as e,ve as f,I as g,D as h,Pt as i,jt as j,wt as k,z as l,Ct as m,oe as n,wn as o,Cn as p,kt as q,vt as r,We as s,ae as t,R as u,He as v,G as w,W as x,m as y,ce as z,Tn as A,_n as B,Ue as C,Bn as D,S as E,C as F,Ge as G,A as H,de as I,Ze as J,qt as K,qn as L,Kn as M,Xn as N,Yn as O,Vn as P,he as Q,T as R,ni as S,ii as T,yr as U,oi as V,si as W,q as X,P as Y,zr as Z,B as _,sn as $,ht as aa,an as ba,Bi as ca,je as da,Li as ea,cn as fa,un as ga,Ni as ha,pn as ia};
|
|
5
|
-
//# sourceMappingURL=chunk-UQYQBLJX.js.map
|
package/dist/chunk-Z35GOVEH.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{$ as b,_ as a,aa as c,ba as d,ca as e,da as f,ea as g,fa as h,ga as i,ha as j,ia as k,ja as l,ka as m,la as n,ma as o,na as p}from"./chunk-7UCDGXRW.js";import"./chunk-5T44HG5Y.js";import"./chunk-DUKHVPU5.js";export{b as activateCliProjectContext,n as collect,c as currentCliDatabase,o as formatBytes,p as formatStatus,i as openDb,j as openProjectDb,f as prepareWorktreeIndex,h as residentQueryLaneEligible,e as resolveActiveDbPath,d as resolveCliProjectContext,a as resolveProjectRoot,k as rootIndexFallbackWarning,l as setResidentDatabaseProvider,g as sharedCachePreparationEligible,m as withDb};
|
|
3
|
-
//# sourceMappingURL=cli-context-FJL2JHOE.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{da as a,ea as b,fa as c,ga as d,ha as e,ia as f,ja as g,ka as h,la as i,ma as j,na as k,oa as l,pa as m,qa as n,ra as o,sa as p}from"./chunk-MEUHIDI3.js";import"./chunk-T75DS2E6.js";import"./chunk-RCIGX23V.js";import"./chunk-D7DOB27N.js";import"./chunk-R2NOK63J.js";import"./chunk-6O3KXIDL.js";import"./chunk-UQYQBLJX.js";export{b as activateCliProjectContext,n as collect,c as currentCliDatabase,o as formatBytes,p as formatStatus,i as openDb,j as openProjectDb,f as prepareWorktreeIndex,h as residentQueryLaneEligible,e as resolveActiveDbPath,d as resolveCliProjectContext,a as resolveProjectRoot,k as rootIndexFallbackWarning,l as setResidentDatabaseProvider,g as sharedCachePreparationEligible,m as withDb};
|
|
2
|
-
//# sourceMappingURL=cli-context-PQNWHMCQ.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{c as K}from"./chunk-2EDX3JT5.js";import{c as Q}from"./chunk-B3UYV66Z.js";import{a as J}from"./chunk-TJBOJUVN.js";import{a as h}from"./chunk-Q3ZCQY2Y.js";import"./chunk-362QOSFD.js";import{c as F,d as H,e as q,f as W,g as B,h as G}from"./chunk-JLZLLLW5.js";import{j as _,l as V,n as U}from"./chunk-AQI4N64O.js";import{p as L,q as z}from"./chunk-5IC2WZAL.js";import"./chunk-C7QWUBR2.js";import"./chunk-B2OB55RR.js";import{a as v,b as I}from"./chunk-XZEE23VG.js";import{$ as p,N as A,O as R,_ as j,ba as $,ea as k,ka as T}from"./chunk-7UCDGXRW.js";import{e as M}from"./chunk-FTTV7IRX.js";import"./chunk-D62CTZX6.js";import{aa as P,ba as O,ca as N,da as S,ea as D,l as s}from"./chunk-5T44HG5Y.js";import{d as E,r as x}from"./chunk-DUKHVPU5.js";import{Command as Pe,Help as Oe}from"commander";import{Option as se}from"commander";function y(e){return e.evidence?e.evidence:ae.has(e.id)?"mixed":e.heuristic?"heuristic":"graph-fact"}var ae=new Set(["health","context","co-change"]);function X(e){if(e.claims){if(e.claims.origin==="mixed"&&!e.claims.families?.length)throw new Error(`Mixed command ${e.id} must declare at least one claim family.`);return e.claims}let t=y(e);if(t==="mixed")throw new Error(`Mixed command ${e.id} must declare claim families.`);let n=e.agent?H(e.agent.operation):[];return n.length>0&&n.every(o=>o==="repository-observation"||o==="repository-preview")?{origin:t==="heuristic"?"heuristic":"compiler-graph",observedSources:["index-generation"],producerValidation:{status:"not-evaluated"}}:{origin:"unknown",observedSources:["process"],producerValidation:{status:"not-evaluated"}}}var Y;function Z(){return Y||{argv:process.argv.slice(2),execPath:process.execPath,...process.argv[1]!==void 0?{scriptPath:process.argv[1]}:{},cwd:process.cwd()}}function ee(e,t){return W(new Map(t.map(n=>[n.id,y(n)]))),G(new Map(t.map(n=>[n.id,X(n)]))),B(new Map(t.flatMap(n=>n.agent?[[n.id,{...n.agent,resultUnits:me(n)}]]:[]))),t.map(n=>{let i=n.hidden?e.command(n.command,{hidden:!0}):e.command(n.command);i.description(n.description),n.helpAfter&&i.addHelpText("after",`
|
|
3
|
-
${n.helpAfter.trim()}
|
|
4
|
-
`);for(let o of n.arguments??[])i.argument(o.name);for(let o of n.options??[])if(o.hidden){let r=new se(o.flags,o.description).hideHelp();o.parser&&r.argParser(o.parser),Object.hasOwn(o,"defaultValue")&&r.default(o.defaultValue),i.addOption(r)}else o.parser&&Object.hasOwn(o,"defaultValue")?i.option(o.flags,o.description,o.parser,o.defaultValue):o.parser?i.option(o.flags,o.description,o.parser):Object.hasOwn(o,"defaultValue")?i.option(o.flags,o.description,o.defaultValue):i.option(o.flags,o.description);return i.action(async(...o)=>{try{let r=i.optsWithGlobals();ce(r);let a=Z(),d=()=>n.id===_?n.handler(...o):V({command:n.id,producerVersion:s,invocationPrefix:a.scriptPath?[a.execPath,a.scriptPath]:["codebaseiq"],argv:[...a.argv],cwd:a.cwd,json:r.json===!0,sourceSession:r.session!==!1,reemitSource:r.reemit===!0,...typeof r.outputPageSize=="number"?{pageSize:r.outputPageSize}:{},...typeof r.outputCursor=="string"?{cursor:r.outputCursor}:{}},()=>n.handler(...o)),c=n.agent?F(n.agent.operation,{args:o.slice(0,-1),options:r}):void 0;await(c?q(c,d):d())}catch(r){de(r)}finally{p(void 0),R()}}),{descriptor:n,command:i}})}function ce(e){if(e.resultOnly===!0&&e.json!==!0)throw new Error("--result-only requires --json.");if(e.compact===!0&&e.json!==!0)throw new Error("--compact requires --json.")}function me(e){let t=e.agent?.resultUnits;if(t?.kind==="field"&&t.field.trim()==="")throw new Error(`Command ${e.id} declares an empty result-unit field.`);return t||(e.renderShape==="list"||e.renderShape==="table"||e.renderShape==="grouped-by-file"?{kind:"rows"}:{kind:"report"})}function de(e){let t=e instanceof Error?e.message:String(e);console.error(`error: ${I(t)}`),process.exitCode=1}import{existsSync as le,mkdirSync as pe,writeFileSync as ue}from"fs";import{homedir as fe}from"os";import{join as g}from"path";var he=1440*60*1e3,ne="update-check.json",ge="https://registry.npmjs.org/codebaseiq/latest";async function oe(e={}){let t=e.env??process.env;if(t.CODEBASEIQ_UPDATE_CHECK==="0"||t.NO_UPDATE_NOTIFIER)return;let n=e.cacheDir??ye(t),i=e.now??Date.now(),o=e.currentVersion??s,r=be(n),a=r&&i-r.checkedAt<he?r.latestVersion:await we(n,e.fetchLatestVersion??xe,i);if(!a||!ve(a,o))return;(e.writeNotice??(c=>console.error(c)))(Ce(o,a))}function Ce(e,t){return[`codebaseiq update available: ${e} -> ${t}.`,"Agent: tell your human to update with: npm install -g codebaseiq@latest",""].join(`
|
|
5
|
-
`)}function ve(e,t){let n=te(e),i=te(t);if(!n||!i)return e!==t;for(let o=0;o<n.length;o++){let r=n[o]-i[o];if(r>0)return!0;if(r<0)return!1}return!1}function ye(e){let t=e.XDG_CACHE_HOME||g(fe(),".cache");return g(t,"codebaseiq")}function be(e){let t=g(e,ne);if(!le(t))return null;try{let n=JSON.parse(x(t,"update notice cache"));return typeof n.checkedAt=="number"&&(typeof n.latestVersion=="string"||n.latestVersion===null)?{checkedAt:n.checkedAt,latestVersion:n.latestVersion}:null}catch{return null}}async function we(e,t,n){let i;try{i=await t()}catch{i=null}return Ee(e,{checkedAt:n,latestVersion:i}),i}function Ee(e,t){try{pe(e,{recursive:!0}),ue(g(e,ne),`${JSON.stringify(t,null,2)}
|
|
6
|
-
`)}catch{}}async function xe(){let e=await fetch(ge,{signal:AbortSignal.timeout(1e3)});if(!e.ok)return null;let t=await e.json();return typeof t.version=="string"?t.version:null}function te(e){let t=/^v?(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(e);return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}async function ct(e={}){let t=new Pe;e.resident&&t.exitOverride(),e.terminalOutput&&t.configureOutput({writeOut:o=>process.stdout.write(v(o)),writeErr:o=>process.stderr.write(v(o))}),t.name("codebaseiq").description("Language-agnostic code intelligence CLI powered by SCIP indexes").version(s).option("--output-page-size <characters>","Return bounded output pages with an exact continuation command",U).option("--output-cursor <cursor>","Continue a bounded output page").option("--no-session","Disable the explicit exploration evidence ledger").option("--reemit","Recovery only: render source and graph evidence again instead of citing session receipts").option("--help-all","Display every command, including compatibility and deprecated controls");let n=await K(e.invocationCommand);ee(t,n);let i=new Oe;return t.configureHelp({formatHelp:(o,r)=>o===t?Q(t,n):i.formatHelp(o,r)}),t.hook("preAction",async(o,r)=>{let a=r.name();if(e.resident){await e.resident.preAction(a);return}let d=k(a),c=L(a);if(!d&&!c){ie(),await re(a);return}let m=j(),u=E(m);A(u);let C=$(m,u);p(C),ie(),await re(a);let{config:b,paths:w}=C;if(d){let l=await J({commandName:a,projectRoot:m,config:b,paths:w,dbPathSource:C.dbPathSource,gitContext:u});process.env.CODEBASEIQ_DEBUG&&console.error(`evidence-freshness: ${l.source}`),l.service.kind==="failed"&&console.error(`warning: codebaseiq watch service did not start: ${l.service.message}`),(l.service.kind==="failed"||l.service.kind==="skipped")&&h(m,s);return}if(!c){h(m,s);return}let f=z({commandName:a,projectRoot:m,cacheDir:w.cacheDir,cliVersion:s,config:b,gitContext:u});f.kind==="failed"&&console.error(`warning: codebaseiq watch service did not start: ${f.message}`),(f.kind==="failed"||f.kind==="skipped")&&h(m,s)}),t.hook("postAction",()=>p(void 0)),{program:t,descriptors:n}}async function re(e){e.startsWith("__")||await oe({commandName:e})}function ie(){if(N(),!P()||S())return;let e=null;try{e=T(t=>M(t))}catch{}D({command:O()??`codebaseiq ${process.argv.slice(2).join(" ")}`,toolVersion:s,projectFingerprint:e})}export{ct as createCliProgram};
|
|
7
|
-
//# sourceMappingURL=cli-program-UO7PZD6V.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{z as a}from"./chunk-PTQPPPG2.js";import"./chunk-FH5WG4LE.js";import"./chunk-DAKIGMIK.js";import"./chunk-LONKINMJ.js";import"./chunk-ZZ3MWF33.js";import"./chunk-6WAPPQ5F.js";import"./chunk-YUKYB54I.js";import"./chunk-DDN2F6GB.js";import"./chunk-P5XHIJHI.js";import"./chunk-EQNMD62X.js";import"./chunk-2PRONPAS.js";import"./chunk-P4NVCOM7.js";import"./chunk-CIYA2KZN.js";import"./chunk-C6WKPKCF.js";import"./chunk-XQAVQVIL.js";import"./chunk-DRENNWRG.js";import"./chunk-SV2LEFVM.js";import"./chunk-MEUHIDI3.js";import"./chunk-5FWR5HLG.js";import"./chunk-T75DS2E6.js";import"./chunk-YT4DVWUV.js";import"./chunk-RCIGX23V.js";import"./chunk-D7DOB27N.js";import"./chunk-R2NOK63J.js";import"./chunk-6O3KXIDL.js";import"./chunk-UQYQBLJX.js";export{a as directNavigationQueryCommandDescriptors};
|
|
2
|
-
//# sourceMappingURL=direct-navigation-4XJTXIDT.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{z as a}from"./chunk-USOAJHY7.js";import"./chunk-JLZLLLW5.js";import"./chunk-AQI4N64O.js";import"./chunk-C7QWUBR2.js";import"./chunk-B2OB55RR.js";import"./chunk-XZEE23VG.js";import"./chunk-7UCDGXRW.js";import"./chunk-FTTV7IRX.js";import"./chunk-D62CTZX6.js";import"./chunk-5T44HG5Y.js";import"./chunk-DUKHVPU5.js";export{a as directNavigationQueryCommandDescriptors};
|
|
3
|
-
//# sourceMappingURL=direct-navigation-J5MVYYAD.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{a}from"./chunk-CVHOQONG.js";import"./chunk-AQI4N64O.js";import"./chunk-C7QWUBR2.js";import"./chunk-B2OB55RR.js";import"./chunk-XZEE23VG.js";import"./chunk-7UCDGXRW.js";import"./chunk-FTTV7IRX.js";import"./chunk-D62CTZX6.js";import"./chunk-5T44HG5Y.js";import"./chunk-DUKHVPU5.js";export{a as outputContinuationCommandDescriptor};
|
|
3
|
-
//# sourceMappingURL=output-continuation-command-BL25S26S.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-I22IZYDI.js";import"./chunk-DAKIGMIK.js";import"./chunk-LONKINMJ.js";import"./chunk-ZZ3MWF33.js";import"./chunk-6WAPPQ5F.js";import"./chunk-YUKYB54I.js";import"./chunk-DDN2F6GB.js";import"./chunk-P5XHIJHI.js";import"./chunk-EQNMD62X.js";import"./chunk-2PRONPAS.js";import"./chunk-P4NVCOM7.js";import"./chunk-CIYA2KZN.js";import"./chunk-C6WKPKCF.js";import"./chunk-XQAVQVIL.js";import"./chunk-DRENNWRG.js";import"./chunk-SV2LEFVM.js";import"./chunk-MEUHIDI3.js";import"./chunk-5FWR5HLG.js";import"./chunk-T75DS2E6.js";import"./chunk-YT4DVWUV.js";import"./chunk-RCIGX23V.js";import"./chunk-D7DOB27N.js";import"./chunk-R2NOK63J.js";import"./chunk-6O3KXIDL.js";import"./chunk-UQYQBLJX.js";export{a as outputContinuationCommandDescriptor};
|
|
2
|
-
//# sourceMappingURL=output-continuation-command-BTETTXEC.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-23C5AD3B.js";import"./chunk-MVRGB4KJ.js";import"./chunk-YTJHCGYB.js";import"./chunk-ILMHV3KM.js";import"./chunk-O2M3VNDY.js";import"./chunk-6WAPPQ5F.js";import"./chunk-YUKYB54I.js";import"./chunk-EQNMD62X.js";import"./chunk-P4NVCOM7.js";import"./chunk-4LK5OIPW.js";import"./chunk-C6WKPKCF.js";import"./chunk-XQAVQVIL.js";import"./chunk-DRENNWRG.js";import"./chunk-5FWR5HLG.js";import"./chunk-T75DS2E6.js";import"./chunk-YT4DVWUV.js";import"./chunk-RCIGX23V.js";import"./chunk-D7DOB27N.js";import"./chunk-R2NOK63J.js";import"./chunk-6O3KXIDL.js";import"./chunk-UQYQBLJX.js";export{a as reindexConfiguredProject};
|
|
2
|
-
//# sourceMappingURL=project-reindex-CRJU3IFG.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{k as a}from"./chunk-Q23IMHXS.js";import"./chunk-EN4AHLL3.js";import"./chunk-FTTV7IRX.js";import"./chunk-D62CTZX6.js";import"./chunk-5T44HG5Y.js";import"./chunk-DUKHVPU5.js";export{a as reindexConfiguredProject};
|
|
3
|
-
//# sourceMappingURL=project-reindex-TQFCOA2O.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{d as a,e as b}from"./chunk-T5X7DK6C.js";import"./chunk-5IC2WZAL.js";import"./chunk-C7QWUBR2.js";import"./chunk-B2OB55RR.js";import"./chunk-XZEE23VG.js";import"./chunk-7UCDGXRW.js";import"./chunk-FTTV7IRX.js";import"./chunk-D62CTZX6.js";import"./chunk-5T44HG5Y.js";import"./chunk-DUKHVPU5.js";export{a as ensureSentinelService,b as sentinelEnsureCommandDescriptor};
|
|
3
|
-
//# sourceMappingURL=sentinel-ensure-command-OSWGCFFL.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./chunk-GQXXOS55.js";import"./chunk-GWYZVVKY.js";import"./chunk-LONKINMJ.js";import"./chunk-ZZ3MWF33.js";import"./chunk-6WAPPQ5F.js";import"./chunk-YUKYB54I.js";import"./chunk-DDN2F6GB.js";import"./chunk-P5XHIJHI.js";import"./chunk-EQNMD62X.js";import"./chunk-2PRONPAS.js";import"./chunk-P4NVCOM7.js";import"./chunk-CIYA2KZN.js";import"./chunk-C6WKPKCF.js";import"./chunk-XQAVQVIL.js";import"./chunk-DRENNWRG.js";import"./chunk-PUVNH4PO.js";import"./chunk-SV2LEFVM.js";import"./chunk-MEUHIDI3.js";import"./chunk-5FWR5HLG.js";import"./chunk-T75DS2E6.js";import"./chunk-YT4DVWUV.js";import"./chunk-RCIGX23V.js";import"./chunk-D7DOB27N.js";import"./chunk-R2NOK63J.js";import"./chunk-6O3KXIDL.js";import"./chunk-UQYQBLJX.js";export{a as ensureSentinelService,b as sentinelEnsureCommandDescriptor};
|
|
2
|
-
//# sourceMappingURL=sentinel-ensure-command-SPW7XQLB.js.map
|