codebaseiq 0.3.1 → 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 +65 -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-JYRJYXUV.js → chunk-33AXWMO2.js} +2 -2
- package/dist/{chunk-EQNMD62X.js → chunk-37K55EG3.js} +2 -2
- package/dist/{chunk-LCW3PSGL.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-DWBAESVW.js → chunk-3VDL7GTY.js} +2 -2
- package/dist/{chunk-BFANZRQ5.js → chunk-3XBZ5PKL.js} +2 -2
- package/dist/{chunk-K6FNTQQW.js → chunk-42PXSE74.js} +2 -2
- package/dist/{chunk-ALOEHWJS.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-JSB43EX6.js → chunk-55NUXP2V.js} +2 -2
- package/dist/chunk-5AJQCOZZ.js +21 -0
- package/dist/{chunk-L37EQYAX.js → chunk-5NUPFZFA.js} +2 -2
- package/dist/{chunk-PIFYOWS4.js → chunk-65QIFIF6.js} +2 -2
- package/dist/{chunk-SUE7SHZL.js → chunk-66Q5VLH6.js} +2 -2
- package/dist/{chunk-KFTHI2R6.js → chunk-6CQPIIS7.js} +2 -2
- package/dist/{chunk-GV2CEZCW.js → chunk-6CTSFS7R.js} +2 -2
- package/dist/{chunk-SB53KPWA.js → chunk-6EBUAKJT.js} +2 -2
- package/dist/chunk-6I55VYFG.js +4 -0
- package/dist/chunk-6NUURWPF.js +3 -0
- package/dist/{chunk-TEMM2FEL.js → chunk-6P5QMOM7.js} +2 -2
- package/dist/{chunk-3LQJRS4I.js → chunk-6S5FE4ZF.js} +2 -2
- package/dist/chunk-74LRKLNC.js +22 -0
- package/dist/{chunk-NNG6M6XD.js → chunk-75A23IID.js} +2 -2
- package/dist/chunk-75VNTSO6.js +7 -0
- package/dist/chunk-7HBBVZJ6.js +3 -0
- package/dist/{chunk-AGGR2BKS.js → chunk-7PPBMBH6.js} +2 -2
- package/dist/{chunk-DECN422G.js → chunk-7WG57A5X.js} +2 -2
- package/dist/{chunk-ILGTMRMZ.js → chunk-7XHZX6FX.js} +2 -2
- package/dist/{chunk-OKAF4OQS.js → chunk-A5HJ3CJW.js} +2 -2
- package/dist/{chunk-JNXI6NQ7.js → chunk-AJ5HVC5Z.js} +2 -2
- package/dist/{chunk-SZ4P7MF7.js → chunk-AYRHOFLV.js} +2 -2
- package/dist/chunk-AZDY3EKD.js +93 -0
- package/dist/{chunk-SA7G6GJX.js → chunk-AZZNG5Z2.js} +2 -2
- package/dist/chunk-BEKCTUPY.js +3 -0
- package/dist/{chunk-PTR3EOXC.js → chunk-BKKX2OU5.js} +2 -2
- package/dist/{chunk-5LL4KEHO.js → chunk-BQKRYKDD.js} +2 -2
- package/dist/{chunk-UIAUPFBJ.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-UMEPSVKT.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-CB5AVJMM.js → chunk-DNRHRVKS.js} +2 -2
- package/dist/{chunk-SGMNWYTH.js → chunk-DOQLO74K.js} +2 -2
- package/dist/{chunk-DDRA3QKN.js → chunk-DP3EJ6XL.js} +2 -2
- package/dist/{chunk-OWJWOEDU.js → chunk-DQZF7MP6.js} +2 -2
- package/dist/{chunk-VSGOIZMQ.js → chunk-DTM4EHD2.js} +2 -2
- package/dist/{chunk-YRKP7PM7.js → chunk-DUM7GR6B.js} +2 -2
- package/dist/{chunk-HNXRVGMY.js → chunk-DZ4QOIRY.js} +2 -2
- package/dist/{chunk-CSPDQLLU.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-EHPOTEQX.js → chunk-ESWVTSHU.js} +2 -2
- package/dist/{chunk-57OPIQFM.js → chunk-ETZBIG6K.js} +2 -2
- package/dist/chunk-EYSJHKX6.js +3 -0
- package/dist/{chunk-MC46AL7B.js → chunk-F4AGM7ZE.js} +37 -37
- package/dist/{chunk-EOKVZXNF.js → chunk-FPUJRBHL.js} +55 -55
- 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-ELYMY5S2.js → chunk-GC4I33OD.js} +2 -2
- package/dist/{chunk-NDKOVQFG.js → chunk-GLXEWYQY.js} +2 -2
- package/dist/{chunk-CYJS33YX.js → chunk-GRHNPFHT.js} +2 -2
- package/dist/{chunk-QY7QB7I6.js → chunk-GWESWURK.js} +2 -2
- package/dist/{chunk-R4OJGTMP.js → chunk-GXOFPAIR.js} +2 -2
- package/dist/{chunk-OBC7HSSO.js → chunk-H4FGIFEU.js} +2 -2
- package/dist/{chunk-LKUTSP4G.js → chunk-HOGS6JFP.js} +2 -2
- package/dist/{chunk-RIO3JXHM.js → chunk-HSJLK5MC.js} +2 -2
- package/dist/{chunk-BWL3PMPT.js → chunk-HTPEUJ42.js} +2 -2
- package/dist/{chunk-DJKOXMNG.js → chunk-IBPXUGJV.js} +2 -2
- package/dist/{chunk-2XBJRZEM.js → chunk-ITA3N7G6.js} +2 -2
- package/dist/chunk-JG5OWAEB.js +22 -0
- package/dist/{chunk-LSZYMN2A.js → chunk-JGJKRTTB.js} +2 -2
- package/dist/{chunk-TJWVT4DO.js → chunk-JGXLB7PR.js} +2 -2
- package/dist/{chunk-5TZNHP4T.js → chunk-JKUF2UG6.js} +2 -2
- 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-2Z7K66D7.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-O2KWU34K.js → chunk-M3IBH6C3.js} +9 -9
- package/dist/{chunk-UJIXCI3L.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-WO6OFKUC.js → chunk-N26LGGSF.js} +2 -2
- package/dist/{chunk-J7AMBVWF.js → chunk-NB2DAVPP.js} +2 -2
- package/dist/{chunk-MDFT325O.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-JAFDMV5I.js → chunk-O5BWFNIH.js} +2 -2
- package/dist/{chunk-3H2H5ODK.js → chunk-O7PCDZ5B.js} +2 -2
- package/dist/{chunk-KPZGTB2O.js → chunk-OAJYNPRU.js} +2 -2
- package/dist/{chunk-KUKWHP4R.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-I3OK27P7.js → chunk-PFMQRHC6.js} +2 -2
- package/dist/{chunk-K4S2VH42.js → chunk-PVKSZBX5.js} +2 -2
- 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-KLX6NSWT.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-BGYRF5YX.js → chunk-RWAZCEJD.js} +2 -2
- package/dist/{chunk-Z66XYVLZ.js → chunk-RWDIONS7.js} +2 -2
- package/dist/{chunk-CJTKGAGH.js → chunk-S3CJYDXP.js} +2 -2
- package/dist/{chunk-53ELMZRF.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-HJTM3C4Y.js → chunk-TB575ZGO.js} +2 -2
- package/dist/{chunk-YHPG3S2U.js → chunk-TG4GMU73.js} +2 -2
- package/dist/{chunk-N2XDMNVI.js → chunk-THKM7OXM.js} +2 -2
- package/dist/{chunk-GVAF222T.js → chunk-TNLOX4TN.js} +2 -2
- package/dist/{chunk-BPKNP3KZ.js → chunk-UHFZDQZJ.js} +2 -2
- package/dist/{chunk-YT4DVWUV.js → chunk-UUMAM5LM.js} +2 -2
- package/dist/{chunk-TLTSESB4.js → chunk-UUT5P3V7.js} +2 -2
- package/dist/{chunk-W7QDASTN.js → chunk-VEPK6M5C.js} +2 -2
- package/dist/{chunk-XJBK3QDV.js → chunk-VPCHKZ3I.js} +2 -2
- package/dist/{chunk-3ON3A2QV.js → chunk-VZY3XOBU.js} +2 -2
- package/dist/{chunk-XQAVQVIL.js → chunk-W6E6ME7G.js} +2 -2
- package/dist/{chunk-KEJ2HLRW.js → chunk-WGYZBS5S.js} +2 -2
- package/dist/{chunk-5MPBSFZH.js → chunk-WUP24Q4U.js} +2 -2
- package/dist/chunk-WXUHXSLN.js +2 -0
- package/dist/{chunk-F5CJO5JN.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-T2M5HWBQ.js → chunk-XVJ2E7W7.js} +2 -2
- package/dist/{chunk-AXQCHG77.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-5CR4U5X2.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-4GWN76B2.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-AMRXV444.js → code-viewer-C6HE4DFC.js} +2 -2
- package/dist/{code-viewer-EXI5SFFR.js → code-viewer-XHSSAMBX.js} +2 -2
- package/dist/{command-descriptors-ROIOTCCW.js → command-descriptors-NWW34Z54.js} +171 -171
- package/dist/{command-descriptors-H6A4UY72.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-2I2UHZET.js +0 -2
- package/dist/chunk-5T44HG5Y.js +0 -88
- package/dist/chunk-5YBDBY5L.js +0 -2
- package/dist/chunk-6EYESTJM.js +0 -3
- package/dist/chunk-6FXXYYQM.js +0 -22
- package/dist/chunk-7UCDGXRW.js +0 -8
- package/dist/chunk-BIADXGC3.js +0 -22
- package/dist/chunk-CLPCFGRT.js +0 -3
- package/dist/chunk-DUKHVPU5.js +0 -4
- package/dist/chunk-G7GVV2TV.js +0 -27
- package/dist/chunk-KUKKLWJD.js +0 -3
- package/dist/chunk-KWRQVLPX.js +0 -3
- package/dist/chunk-MEUHIDI3.js +0 -7
- package/dist/chunk-OP6BUIV6.js +0 -2
- package/dist/chunk-OQ3DK7FW.js +0 -2
- package/dist/chunk-OT5ISJSR.js +0 -2
- package/dist/chunk-SX72EVMY.js +0 -3
- package/dist/chunk-T75DS2E6.js +0 -21
- package/dist/chunk-UC2FD2PS.js +0 -4
- package/dist/chunk-UQYQBLJX.js +0 -5
- package/dist/chunk-V4NGDIEA.js +0 -21
- package/dist/chunk-XUPFA6GH.js +0 -2
- package/dist/chunk-YPBKBYPS.js +0 -21
- package/dist/chunk-ZMA5HWXY.js +0 -3
- package/dist/cli-context-FJL2JHOE.js +0 -3
- package/dist/cli-context-PQNWHMCQ.js +0 -2
- package/dist/cli-program-SCHOHOQE.js +0 -7
- package/dist/direct-navigation-3JOYP2MO.js +0 -3
- package/dist/direct-navigation-SJMJLBY7.js +0 -2
- package/dist/invocation-command-descriptors-GMZX3UAD.js +0 -2
- package/dist/invocation-command-descriptors-HNMKDEF6.js +0 -3
- package/dist/output-continuation-command-5NWVDQT7.js +0 -2
- package/dist/output-continuation-command-RNEHNYPU.js +0 -3
- package/dist/project-reindex-MIW5CYEG.js +0 -3
- package/dist/project-reindex-VQ23LWDA.js +0 -2
- package/dist/sentinel-ensure-command-H66AZ3VE.js +0 -2
- package/dist/sentinel-ensure-command-R4YAUCJB.js +0 -3
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{n as fe}from"./chunk-CABIZQXQ.js";import{A as me,z as M}from"./chunk-AJ5HVC5Z.js";import{c as se,h as ae}from"./chunk-26EZWQ24.js";import{Q as N,R as ue,U as pe,V as he}from"./chunk-PVKSZBX5.js";import{B as D,D as ge}from"./chunk-75VNTSO6.js";import{d as ie}from"./chunk-XDQ6QJF5.js";import{K as ce,L as le,V as de,a as j,k as ne,l as k}from"./chunk-E7T22WET.js";import{g as oe}from"./chunk-EDMG5CSO.js";import{j as w,r as W}from"./chunk-3F23W57G.js";import{a as Y,c as Z,e as ee}from"./chunk-OZI44VCR.js";import{$ as A,K as H,L as z,M as R,N as X,P as J,Q as K,S as P,U as te,X as O,Z as re,_ as T,h as C,n as V}from"./chunk-C3PPB2T5.js";import{statSync as ye}from"fs";import{basename as He,isAbsolute as ze,join as L,relative as Xe}from"path";import{fileURLToPath as Je}from"url";import{watch as Ke}from"chokidar";import Ze from"ignore";var Ee=5e3,Re=class{projectRoot;config;watchConfig;outputDb;languages;pnpmWorkspaces;typescriptProjectMode;typescriptProjects;clojureConfigPath;indexerConcurrency;onStatus;onReindexComplete;onReindexError;onRefreshSuppressed;onFileChanged;onBulkChange;onError;reindexRunner;subscriptionFactory;budgetInspector;clock;activeOperation=null;stopPromise=null;stopInProgress=!1;status={state:"idle"};debounceTimer=null;cooldownTimer=null;budgetTimer=null;dirty=!1;changedFiles=0;pendingTrigger=null;reindexInFlight=!1;lastReindexEnd=0;fileChangeTimer=null;pendingFileChanges=new Set;bulkChangePending=!1;fsWatchers=[];sourcePollingFallbackStarted=!1;gitPollTimer=null;lastGitState=null;gitignoreFilter;extraIgnore;stopped=!1;observationEpoch=0;changeSequence=0;constructor(e){this.projectRoot=e.projectRoot,this.config=e.config,this.watchConfig=ge(e.config),this.outputDb=e.outputDb??L(z(this.projectRoot,e.config),"index.db"),this.languages=e.languages,this.pnpmWorkspaces=e.config.indexer?.typescript?.pnpmWorkspaces??!1,this.typescriptProjectMode=e.config.indexer?.typescript?.projectMode,this.typescriptProjects=e.config.indexer?.typescript?.projects,this.clojureConfigPath=e.config.indexer?.clojure?.configPath,this.indexerConcurrency=e.config.indexerConcurrency,this.onStatus=e.onStatus??(()=>{}),this.onReindexComplete=e.onReindexComplete??(()=>{}),this.onReindexError=e.onReindexError??(()=>{}),this.onRefreshSuppressed=e.onRefreshSuppressed??(()=>{}),this.onFileChanged=e.onFileChanged,this.onBulkChange=e.onBulkChange;let r=e.onError??(n=>console.error(n.message));this.onError=n=>{this.observationEpoch+=1,r(n)},this.clock=e.clock??it,Ie.set(this,gt(e.stopTimeoutMs??Ee,"watcher stop timeout")),this.reindexRunner=e.reindexRunner??pt(),this.subscriptionFactory=e.subscriptionFactory??ot,this.budgetInspector=e.budgetInspector??ae,Pe.set(this,{gitReader:e.gitReader??te,languages:Te(e.languages??e.config.languages),stagedIndexEntries:null,gitSignalPaths:null,lastGitSignal:null}),this.gitignoreFilter=oe(e.projectRoot),this.extraIgnore=Ze(),this.watchConfig.ignore.length>0&&this.extraIgnore.add(this.watchConfig.ignore)}start(){if(this.stopInProgress)throw new Error("Cannot restart a watcher while its previous ownership is still draining.");this.stopped=!1,this.stopPromise=null,G(this).errors=[],this.sourcePollingFallbackStarted=!1,this.observationEpoch+=1,this.setStatus({state:"idle"}),this.startGitStatePolling();try{this.startSourceWatcher()}catch(e){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(e)}`))}}stop(){if(this.stopPromise)return this.stopPromise;this.stopped=!0,this.stopInProgress=!0;let e=this.fsWatchers;this.fsWatchers=[],this.clearDebounceTimer(),this.clearCooldownTimer(),this.clearBudgetTimer(),this.clearGitPollTimer(),this.clearFileChangeWindow();let r=this.activeOperation;r&&this.setStatus({state:"draining",startedAt:this.wallNow(),reason:"waiting for the active reindex worker to exit"});let n=[...G(this).closures],i=tt(this),s=this.clock.now()+i;return this.stopPromise=this.finishStop(e,n,r,s,i).catch(a=>{throw this.stopInProgress=!1,a}),this.stopPromise}observation(){return{epoch:this.observationEpoch,changeSequence:this.changeSequence}}requestRefresh(e,r={}){if(!this.stopped){if(!r.immediate||this.reindexInFlight||this.status.state==="cooldown"||this.status.state==="budget-paused"){this.scheduleReindex(e);return}this.pendingTrigger=be(this.pendingTrigger,e),this.changedFiles+=1,this.changeSequence+=1,this.clearDebounceTimer(),this.triggerReindex()}}startSourceWatcher(e=!1){let r=this.subscriptionFactory(this.projectRoot,{ignoreInitial:!0,ignored:(n,i)=>this.isIgnoredWatchPath(n,i?.isDirectory()??!1),usePolling:e,...e?{interval:500,binaryInterval:1e3}:{}});r.on("all",(n,i)=>{!this.stopped&&n!=="addDir"&&n!=="unlinkDir"&&this.handleFileChange(i)}),r.on("error",n=>this.handleSourceWatcherError(r,n,e)),this.fsWatchers.push(r)}handleSourceWatcherError(e,r,n){if(n||this.sourcePollingFallbackStarted||!ht(r)||this.stopped){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(r)}`));return}this.observationEpoch+=1,this.sourcePollingFallbackStarted=!0,this.fsWatchers=this.fsWatchers.filter(i=>i!==e),rt(G(this),e,i=>this.onError(i));try{this.startSourceWatcher(!0)}catch(i){this.onError(new Error(`Failed to watch ${this.projectRoot}: ${String(i)}`))}}isIgnoredWatchPath(e,r){let n=this.relativeWatchPath(e);if(!n)return!1;let i=r?`${n}/`:n;return i===".git/"||i.startsWith(".git/")?!0:this.gitignoreFilter.isIgnored(i)||this.extraIgnore.ignores(i)}handleFileChange(e){let r=this.relativeWatchPath(e);!r||r===".."||r.startsWith("../")||r===".git"||r.startsWith(".git/")||this.gitignoreFilter.isIgnored(r)||this.extraIgnore.ignores(r)||r.endsWith("index.db")||r.endsWith("index.scip")||r.endsWith("index.db.tmp")||He(r).startsWith(se)||(r===".codebaseiq.json"&&Ce(this,this.projectRoot),we(this,r)&&(this.noteFileChange(r),this.scheduleReindex({kind:"watch-source",detail:r})))}noteFileChange(e){!this.onFileChanged&&!this.onBulkChange||(this.bulkChangePending||(this.pendingFileChanges.add(e),this.pendingFileChanges.size>at&&(this.pendingFileChanges.clear(),this.bulkChangePending=!0)),this.fileChangeTimer??=this.clock.setTimeout(()=>this.flushFileChangeWindow(),st))}flushFileChangeWindow(){if(this.fileChangeTimer=null,this.stopped)return;let e=[...this.pendingFileChanges],r=this.bulkChangePending;this.pendingFileChanges.clear(),this.bulkChangePending=!1;try{r?this.onBulkChange?.():this.onFileChanged?.(e)}catch{}}clearFileChangeWindow(){this.fileChangeTimer&&(this.clock.clearTimeout(this.fileChangeTimer),this.fileChangeTimer=null),this.pendingFileChanges.clear(),this.bulkChangePending=!1}relativeWatchPath(e){let r=ze(e)?e:L(this.projectRoot,e);return Xe(this.projectRoot,r).replaceAll("\\","/")}scheduleReindex(e){if(this.pendingTrigger=be(this.pendingTrigger,e),this.changedFiles++,this.changeSequence+=1,this.reindexInFlight){this.dirty=!0,this.setStatus({state:"indexing",startedAt:this.status.startedAt});return}if(this.status.state==="cooldown"){this.dirty=!0,this.setStatus({state:"cooldown",until:this.status.until,dirty:!0});return}if(this.status.state==="budget-paused"){this.dirty=!0,this.setStatus({...this.status,dirty:!0});return}this.clearDebounceTimer();let r=this.wallNow()+this.watchConfig.debounceMs;this.setStatus({state:"waiting",changedFiles:this.changedFiles,reindexAt:r}),this.debounceTimer=this.clock.setTimeout(()=>{this.debounceTimer=null,this.triggerReindex()},this.watchConfig.debounceMs)}triggerReindex(){if(this.reindexInFlight||this.stopped)return;let e=this.inspectBudget();if(e.state==="paused"){this.dirty=!0;let a=Math.max(this.wallNow()+1,e.until);this.setStatus({state:"budget-paused",until:a,dirty:!0,reason:e.detail,rebuilt:e.rebuilt,estimatedWriteBytes:e.estimatedWriteBytes}),this.clearBudgetTimer(),this.budgetTimer=this.clock.setTimeout(()=>{this.budgetTimer=null,this.dirty&&!this.stopped&&(this.dirty=!1,this.triggerReindex())},Math.min(2147483647,Math.max(1,a-this.wallNow())));return}let r=this.clock.now()-this.lastReindexEnd;if(this.lastReindexEnd>0&&r<this.watchConfig.cooldownMs){let a=this.watchConfig.cooldownMs-r;this.dirty=!0;let o=this.wallNow()+a;this.setStatus({state:"cooldown",until:o,dirty:!0}),this.cooldownTimer=this.clock.setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped&&(this.dirty=!1,this.triggerReindex())},a);return}this.reindexInFlight=!0,this.dirty=!1,this.changedFiles=0;let n=this.pendingTrigger??{kind:"watch-source"};this.pendingTrigger=null;let i=this.wallNow();this.setStatus({state:"indexing",startedAt:i});let s=this.reindexRunner.start(this.reindexRequest(n));this.activeOperation=s,s.completion.then(a=>{if(this.reindexInFlight=!1,this.lastReindexEnd=this.clock.now(),this.stopped)return;let o=!1;try{o=this.onReindexComplete(a,n)===!0}catch(l){this.onError(l instanceof Error?l:new Error(String(l)))}if(this.dirty&&!this.stopped){if(o){let c=this.pendingTrigger??{kind:"unknown"};this.dirty=!1,this.changedFiles=0,this.pendingTrigger=null,this.onRefreshSuppressed(c),this.setStatus({state:"idle"});return}let l=this.wallNow()+this.watchConfig.cooldownMs;this.setStatus({state:"cooldown",until:l,dirty:!0}),this.cooldownTimer=this.clock.setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped?(this.dirty=!1,this.triggerReindex()):this.setStatus({state:"idle"})},this.watchConfig.cooldownMs)}else this.setStatus({state:"idle"})}).catch(a=>{if(this.reindexInFlight=!1,this.lastReindexEnd=this.clock.now(),this.stopped)return;let o=a instanceof Error?a:new Error(String(a));this.onReindexError(o,n),this.onError(o),this.setStatus({state:"idle"})}).finally(()=>{this.activeOperation===s&&(this.activeOperation=null)})}async finishStop(e,r,n,i,s){let a=[],o=e.map(async p=>{try{await p.close()}catch(m){a.push(`watch subscription close failed: ${String(m)}`)}});o.push(...r),n&&o.push((async()=>{try{let p=await n.cancel();p.state==="degraded"&&a.push(p.reason)}catch(p){a.push(`reindex cancellation failed: ${p instanceof Error?p.message:String(p)}`)}})());let l=o.length,c=o.map(p=>p.finally(()=>{l-=1})),u=await et(c,i,this.clock),d=G(this);return a.push(...d.errors),d.errors=[],u?this.stopInProgress=!1:(a.push(`watch shutdown exceeded the ${s}ms deadline with ${l} operation(s) still pending`),Promise.all(c).then(()=>{this.stopInProgress=!1})),a.length>0?(this.setStatus({state:"draining",startedAt:this.wallNow(),reason:a.join("; ")}),{state:"degraded",reasons:a}):(this.setStatus({state:"idle"}),{state:"stopped"})}wallNow(){return this.clock.wallNow?.()??this.clock.now()}inspectBudget(){try{return this.budgetInspector(this.outputDb,this.watchConfig.resourceBudget,new Date(this.wallNow()))}catch(e){return{state:"paused",reason:"activity-evidence",until:this.wallNow()+this.watchConfig.resourceBudget.windowMs,rebuilt:0,estimatedWriteBytes:0,detail:`reindex activity evidence could not be read: ${e instanceof Error?e.message:String(e)}`}}}reindexRequest(e){return{projectRoot:this.projectRoot,config:this.config,languages:this.languages,pnpmWorkspaces:this.pnpmWorkspaces,typescriptProjectMode:this.typescriptProjectMode,typescriptProjects:this.typescriptProjects,clojureConfigPath:this.clojureConfigPath,indexerConcurrency:this.indexerConcurrency,trigger:e}}setStatus(e){this.status=e,this.onStatus(e)}clearDebounceTimer(){this.debounceTimer&&(this.clock.clearTimeout(this.debounceTimer),this.debounceTimer=null)}clearCooldownTimer(){this.cooldownTimer&&(this.clock.clearTimeout(this.cooldownTimer),this.cooldownTimer=null)}clearBudgetTimer(){this.budgetTimer&&(this.clock.clearTimeout(this.budgetTimer),this.budgetTimer=null)}startGitStatePolling(){if(this.lastGitState=this.readGitState(),!this.lastGitState)return;let e=y(this);e.gitSignalPaths=this.resolveGitSignalPaths(),e.lastGitSignal=this.gitActivitySignal(),e.stagedIndexEntries=xe(this.projectRoot,e.gitReader),this.gitPollTimer=this.clock.setInterval(()=>this.pollGitState(),this.watchConfig.gitPollMs),this.gitPollTimer.unref?.()}resolveGitSignalPaths(){let e=y(this).gitReader,r=T(this.projectRoot,["rev-parse","--git-dir"],e),n=T(this.projectRoot,["rev-parse","--git-common-dir"],e);if(!r)return null;let i=A(this.projectRoot,r),s=n?A(this.projectRoot,n):i,a=this.lastGitState?.indexPath;return[L(i,"HEAD"),L(s,"packed-refs"),L(s,"refs","heads"),...a?[a]:[]]}gitActivitySignal(){let e=y(this).gitSignalPaths;if(!e)return null;let r="";for(let n of e)try{let i=ye(n);r+=`${n}:${i.mtimeMs}:${i.size};`}catch{r+=`${n}:absent;`}return r}pollGitState(){let e=this.gitActivitySignal();if(e!==null){if(e===y(this).lastGitSignal)return;y(this).lastGitSignal=e}let r=this.lastGitState,n=this.readGitState();if(!r||!n||this.stopped){this.lastGitState=n;return}this.lastGitState=n;let i=r.head!==n.head,s=r.indexPath!==n.indexPath||r.indexMtimeMs!==n.indexMtimeMs||r.indexSize!==n.indexSize;if(!i&&!s)return;let a=y(this),o=a.stagedIndexEntries,l=xe(this.projectRoot,a.gitReader);a.stagedIndexEntries=l;let c=ft(this.projectRoot,a.gitReader,r,n,o,l,i,s),u=null;c!==null&&(c.includes(".codebaseiq.json")&&Ce(this,this.projectRoot),u=c.filter(d=>we(this,d)),u.length===0)||(i&&s?this.scheduleReindex({kind:"watch-git-state",detail:F("HEAD and index changed",u)}):i?this.scheduleReindex({kind:"watch-git-head",detail:F("HEAD changed",u)}):s&&this.scheduleReindex({kind:"watch-git-index",detail:F(n.indexPath??"index changed",u)}))}readGitState(){let e=y(this).gitReader,r=T(this.projectRoot,["rev-parse","--git-path","index"],e);if(!r)return null;let n=A(this.projectRoot,r),i={head:T(this.projectRoot,["rev-parse","--verify","HEAD"],e),indexPath:n};try{let s=ye(n);i.indexMtimeMs=s.mtimeMs,i.indexSize=s.size}catch{i.indexMtimeMs=void 0,i.indexSize=void 0}return i}clearGitPollTimer(){this.gitPollTimer&&(this.clock.clearInterval(this.gitPollTimer),this.gitPollTimer=null)}};async function et(t,e,r){if(t.length===0)return!0;let n=Promise.all(t).then(()=>!0),i=Math.max(0,e-r.now()),s=null,a=new Promise(l=>{s=r.setTimeout(()=>l(!1),i)}),o=await Promise.race([n,a]);return o&&s&&r.clearTimeout(s),o}var ve=new WeakMap,Ie=new WeakMap,Pe=new WeakMap;function G(t){let e=ve.get(t);if(e)return e;let r={closures:new Set,errors:[]};return ve.set(t,r),r}function tt(t){return Ie.get(t)??Ee}function y(t){let e=Pe.get(t);if(!e)throw new Error("Watcher input state was not initialized.");return e}function rt(t,e,r){let n=Promise.resolve().then(()=>e.close()).catch(i=>{let s=`watch subscription close failed during polling fallback: ${String(i)}`;t.errors.push(s),r(new Error(s))});t.closures.add(n),n.then(()=>t.closures.delete(n))}function nt(t,e=ee){let{projectRoot:r,config:n,languages:i,pnpmWorkspaces:s,typescriptProjectMode:a,typescriptProjects:o,clojureConfigPath:l,indexerConcurrency:c,trigger:u}=t,d=D(r),p=Object.keys(d).length>0?d:n,m=K(r,p),f=p.indexer?.typescript,g=p.indexer?.clojure,I=e(process.pid);if(!I)throw new Error(`Could not establish watcher process identity for reindex worker ownership (pid ${process.pid}).`);return{workerPath:Je(new URL("./reindex-worker.js",import.meta.url)),env:{...process.env,SCIP_REINDEX_PROJECT_ROOT:r,SCIP_REINDEX_OUTPUT_SCIP:m.indexPath,SCIP_REINDEX_OUTPUT_DB:m.dbPath,SCIP_REINDEX_LANGUAGES:(p.languages??i)?.join(",")??"",SCIP_REINDEX_INDEXER_CONCURRENCY:String(p.indexerConcurrency??c??""),SCIP_REINDEX_PNPM_WORKSPACES:f?.pnpmWorkspaces??s?"1":"",SCIP_REINDEX_TYPESCRIPT_CONFIG:JSON.stringify({projectMode:f?.projectMode??a,projects:f?.projects??o??[]}),SCIP_REINDEX_CLOJURE_CONFIG_PATH:g?.configPath??l??"",SCIP_REINDEX_TRIGGER_KIND:u.kind,SCIP_REINDEX_TRIGGER_DETAIL:u.detail??"",SCIP_REINDEX_PROCESS_GROUP_LEADER:"1",SCIP_REINDEX_PARENT_IDENTITY:JSON.stringify(I)}}}var it={now:Y,wallNow:()=>Date.now(),setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},ot=(t,e)=>Ke(t,e),st=120,at=200,ct=15*6e4,lt=1e3,dt=64*1024;function ut(){return{stdoutTail:"",stderrTail:"",stdoutTruncated:!1,stderrTruncated:!1}}function Se(t,e){let r=t instanceof Error?t.message:String(t),n=e.stderrTail.trim()||e.stdoutTail.trim();return n?`${r}
|
|
2
|
+
${n}`:r}function pt(t={}){let e=t.timeoutMs??ct,r=t.terminationGraceMs??lt,n=t.maxOutputBytes??dt,i=t.resolveLaunch??nt;return{start(s){let a=i(s),o=new AbortController,l=ut(),c=!1,u=he({command:process.execPath,args:[...process.execArgv,a.workerPath],label:"watch reindex worker",env:a.env,timeoutMs:e,terminationGraceMs:r,maxStdoutBytes:n,maxStderrBytes:n,outputLimitBehavior:"truncate-tail",signal:o.signal,detached:!0}).then(d=>{if(l={stdoutTail:d.stdout,stderrTail:d.stderr,stdoutTruncated:d.stdoutTruncated,stderrTruncated:d.stderrTruncated},d.status!==0)throw new Error(Se(new Error(`Reindex worker exited with ${d.signal?`signal ${d.signal}`:`code ${d.status}`}`),l));return d.durationMs}).catch(d=>{throw d instanceof pe&&(l={stdoutTail:d.stdout,stderrTail:d.stderr,stdoutTruncated:d.stdoutTruncated,stderrTruncated:d.stderrTruncated}),new Error(Se(d,l),{cause:d})}).finally(()=>{c=!0});return{completion:u,async cancel(){c||o.abort();try{await u}catch{}return{state:"exited",diagnostics:l}},diagnostics:()=>l}}}}function be(t,e){return t?t.kind===e.kind?t.detail===e.detail?t:{kind:t.kind,detail:"multiple changes"}:{kind:"watch-git-state",detail:`${t.kind}, ${e.kind}`}:e}function ht(t){return t instanceof Error&&"code"in t&&t.code==="EMFILE"||String(t).includes("EMFILE: too many open files")}function gt(t,e){if(!Number.isSafeInteger(t)||t<=0)throw new Error(`${e} must be a positive integer.`);return t}function Te(t){return t&&t.length>0?[...t]:j}function Ce(t,e){try{y(t).languages=Te(D(e).languages)}catch{y(t).languages=j}}function we(t,e){return V(e,y(t).languages)!=="other"}function ft(t,e,r,n,i,s,a,o){let l=new Set;if(a){if(!r.head||!n.head)return null;let c=e.runResult(t,["diff","--name-only","-z","--no-renames","--relative",r.head,n.head,"--"]);if(c.kind!=="success")return null;for(let u of mt(c.output))l.add(u)}if(o){if(i===null||s===null)return null;for(let c of Rt(i,s))l.add(c)}return[...l].sort()}function xe(t,e){let r=e.runResult(t,["diff","--cached","--raw","-z","--no-renames","--relative","--"]);return r.kind==="success"?yt(r.output):null}function mt(t){return t.split("\0").filter(e=>e.length>0)}function yt(t){let e=t.split("\0");if(e.at(-1)===""&&e.pop(),e.length%2!==0)return null;let r=new Map;for(let n=0;n<e.length;n+=2){let i=e[n],s=e[n+1];if(!i.startsWith(":")||!s)return null;r.set(s,i)}return r}function Rt(t,e){return[...new Set([...t.keys(),...e.keys()])].filter(n=>t.get(n)!==e.get(n))}function F(t,e){return e===null?`${t}; changed paths unavailable`:e.length===0?t:e.length===1?e[0]:`${e.length} compiler inputs changed`}import{existsSync as E,lstatSync as S,readdirSync as _e,realpathSync as ke,rmSync as v,statSync as Ae}from"fs";import{join as h,resolve as _,sep as We}from"path";var vt=3600*1e3,St=2*1024*1024*1024,q=300*1e3,bt="gc-state.json",Ct="gc.lock",wt="projects-gc-state.json",xt="projects-gc.lock",Et=1440*60*1e3;function It(t){let e=t.leases.filter(o=>o.managed&&!o.live&&!o.busy),r=Ge(t.leases,t.locks),n={};for(let o of t.generations)r.has(o.generationId)||(n[o.generationId]=o.unreferencedAt??t.nowMs);let i=t.generations.filter(o=>!r.has(o.generationId)).sort((o,l)=>n[o.generationId]-n[l.generationId]||o.generationId.localeCompare(l.generationId)),s=new Set;for(let o of i)t.nowMs-n[o.generationId]>=t.policy.generationTtlMs&&s.add(o.generationId);let a=t.generations.filter(o=>!s.has(o.generationId)).reduce((o,l)=>o+l.size,0);for(let o of i){if(a<=t.policy.budgetBytes)break;s.has(o.generationId)||(s.add(o.generationId),a-=o.size)}for(let o of s)delete n[o];return{deleteWorktrees:e,deleteGenerations:t.generations.filter(o=>s.has(o.generationId)),deleteLocks:t.locks.filter(o=>!o.live),deleteTemporaries:t.temporaries.filter(o=>!o.live),protectedGenerationIds:[...r].sort(),unreferencedSince:n}}function Ge(t,e){let r=new Set(t.filter(n=>n.managed&&(n.live||n.busy)).flatMap(n=>[n.lease.baseGenerationId,n.lease.activeGenerationId]).filter(n=>n!==void 0));for(let n of e)n.live&&r.add(n.generationId);return r}function lr(t,e,r={}){if(!J())return{kind:"disabled"};let n=O(t);if(!n)return{kind:"unavailable"};let i=h(R(),"repositories",n.repositoryId),s=(r.now??Date.now)(),a=E(i)?je(t,i,n.repositoryId,e,s,r):{kind:"unavailable"};return kt(t,n.repositoryId,e,s,r),Pt(s,r),a}function Pt(t,e){let r=h(R(),"projects"),n={examined:0,reclaimed:0};if(!E(r))return n;let i=h(r,wt),s=De(i);if(!e.force&&s!==void 0&&t-s<q)return n;let a=k(h(r,xt));if(!a)return n;try{for(let o of x(r)){let l=h(r,o),c;try{c=S(l)}catch{continue}if(!(!c.isDirectory()||c.isSymbolicLink())&&(n.examined+=1,!!Tt(l,t)))try{v(l,{recursive:!0,force:!0}),n.reclaimed+=1}catch{}}W(i,{version:1,lastSweepAt:new Date(t).toISOString()},{spacing:2,trailingNewline:!0})}finally{a.release()}return n}function Tt(t,e){let r=h(t,H),n;try{let a=JSON.parse(C(r,"cache-ownership"));if(typeof a.canonicalProjectRoot!="string"||a.canonicalProjectRoot.length===0)return!1;n=a.canonicalProjectRoot}catch{return!1}if(E(n))return!1;try{if(e-S(t).mtimeMs<Et)return!1}catch{return!1}let i=ue(N(t).statePath);if(i&&w(i.pid))return!1;let s=k(h(t,"cache-lifecycle.lock"));return s===null?!1:(s.release(),!0)}function je(t,e,r,n,i,s){let a=h(e,"gc-state.json"),o=Ne(a);if(!s.force&&o&&i-Date.parse(o.lastSweepAt)<q)return{kind:"throttled",sweptAt:o.lastSweepAt};let l=ne(e,{now:()=>i});if(!l)return{kind:"busy"};try{let c=Oe(t,e,r,o?.unreferencedSince??{}),u=It({nowMs:i,...c,policy:{generationTtlMs:s.policy?.generationTtlMs??vt,budgetBytes:s.policy?.budgetBytes??St}}),d=0,p=0;for(let g of u.deleteWorktrees){if(!Q(g.lease))continue;if(!E(g.lease.localCacheDir)){v(g.leasePath,{force:!0}),p+=1;continue}if(!_t(g.lease))continue;let I=k(h(g.lease.localCacheDir,"cache-lifecycle.lock"));if(I)try{if($(g.lease,!0))continue;try{fe({projectRoot:g.lease.projectRoot,cacheDir:g.lease.localCacheDir,cliVersion:n})}catch{continue}if($(g.lease,!0))continue;v(g.lease.localCacheDir,{recursive:!0,force:!0}),v(g.leasePath,{force:!0}),p+=1}finally{I.release()}}for(let g of u.deleteLocks)v(g.path,{force:!0});for(let g of u.deleteTemporaries)v(g.path,{recursive:!0,force:!0});for(let g of u.deleteGenerations)v(g.path,{recursive:!0,force:!0}),d+=g.size;ie(h(e,"evidence.db"));let m={kind:"swept",sweptAt:new Date(i).toISOString(),deletedWorktrees:p,deletedGenerations:u.deleteGenerations.length,deletedBytes:d,protectedGenerations:u.protectedGenerationIds.length},f={version:1,lastSweepAt:m.sweptAt,unreferencedSince:u.unreferencedSince,lastResult:m};return W(a,f,{spacing:2,trailingNewline:!0}),m}catch(c){return{kind:"failed",error:c instanceof Error?c.message:String(c)}}finally{l.release()}}function kt(t,e,r,n,i){let s=h(R(),"repositories");if(!E(s))return;let a=h(s,bt),o=De(a);if(!i.force&&o!==void 0&&n-o<q)return;let l=k(h(s,Ct));if(l)try{for(let c of x(s)){if(c===e||!/^[a-f0-9]{24}$/.test(c))continue;let u=h(s,c),d;try{d=S(u)}catch{continue}if(!d.isDirectory()||d.isSymbolicLink())continue;let p=At(u)??t;je(p,u,c,r,n,i)}W(a,{version:1,lastSweepAt:new Date(n).toISOString()},{spacing:2,trailingNewline:!0})}finally{l.release()}}function dr(t,e,r){let n=ce(t,r.dbPath,e);if(n)return{state:"bypassed",reason:n,localCacheDir:r.cacheDir,generations:0,generationBytes:0,protectedGenerations:0,unreferencedGenerations:0,unreferencedBytes:0,temporaryGenerations:0,sharedEvidence:{exists:!1,bytes:0}};let i=O(t);if(!i)return{state:"unavailable",reason:"Git worktree identity is unavailable",localCacheDir:r.cacheDir,generations:0,generationBytes:0,protectedGenerations:0,unreferencedGenerations:0,unreferencedBytes:0,temporaryGenerations:0,sharedEvidence:{exists:!1,bytes:0}};let s=h(R(),"repositories",i.repositoryId),a=U(h(s,"worktrees",`${i.worktreeId}.json`)),o=Ne(h(s,"gc-state.json")),l=Oe(t,s,i.repositoryId,o?.unreferencedSince??{}),c=Ge(l.leases,l.locks),u=l.generations.filter(f=>!c.has(f.generationId)),d=l.generations.reduce((f,g)=>f+g.size,0),p=le(t,e),m=0;return p&&(m=Lt(p)),{state:"managed",repositoryId:i.repositoryId,worktreeId:i.worktreeId,localCacheDir:r.cacheDir,...a?{baseGenerationId:a.baseGenerationId,activeGenerationId:a.activeGenerationId,lastAction:a.lastAction,reason:a.lastReason,lastSeenAt:a.lastSeenAt}:{},generations:l.generations.length,generationBytes:d,protectedGenerations:l.generations.filter(f=>c.has(f.generationId)).length,unreferencedGenerations:u.length,unreferencedBytes:u.reduce((f,g)=>f+g.size,0),temporaryGenerations:l.temporaries.length,sharedEvidence:{path:p,exists:m>0,bytes:m},cleanup:o?.lastResult}}function Lt(t){return[t,`${t}-wal`,`${t}-shm`].reduce((e,r)=>{try{return e+Ae(r).size}catch{return e}},0)}function Oe(t,e,r,n){let i=new Set(re(t).map(c=>_(c.path))),s=[];for(let c of x(h(e,"worktrees"))){if(!c.endsWith(".json"))continue;let u=h(e,"worktrees",c),d=U(u);if(!d)continue;let p=_(d.projectRoot);s.push({leasePath:u,lease:d,managed:d.repositoryId===r&&Q(d),live:i.has(p)||E(p),busy:$(d)})}let a=[];for(let c of x(h(e,"locks"))){let u=/^([a-f0-9]{64})\.lock$/.exec(c);if(!u)continue;let d=h(e,"locks",c),p=B(d),m=p!==void 0&&w(p),f=u[1];a.push({generationId:f,path:d,live:m})}let o=[],l=[];for(let c of x(h(e,"generations"))){let u=/^\.tmp-(\d+)-/.exec(c);if(u){let m=h(e,"generations",c),f=Number(u[1]);try{l.push({path:m,size:Le(m),live:Number.isSafeInteger(f)&&w(f)})}catch{}continue}if(!/^[a-f0-9]{64}$/.test(c))continue;let d=h(e,"generations",c),p;try{p=S(d)}catch{continue}!p.isDirectory()||p.isSymbolicLink()||o.push({generationId:c,path:d,size:Le(d),...n[c]===void 0?{}:{unreferencedAt:n[c]}})}return{leases:s,generations:o,locks:a,temporaries:l}}function Q(t){if(t.ownershipChecksum!==de(t)||P(t.localCacheDir)!==P(X(t.projectRoot)))return!1;let e=P(h(R(),"projects"));return P(t.localCacheDir).startsWith(`${e}${We}`)}function _t(t){if(!Q(t))return!1;let e=_(R()),r=_(h(e,"projects")),n=_(t.localCacheDir);try{let i=S(e),s=S(r),a=S(n);if(!i.isDirectory()||i.isSymbolicLink()||!s.isDirectory()||s.isSymbolicLink()||!a.isDirectory()||a.isSymbolicLink())return!1;let o=ke(r);return ke(n).startsWith(`${o}${We}`)}catch{return!1}}function At(t){for(let e of x(h(t,"worktrees"))){if(!e.endsWith(".json"))continue;let r=U(h(t,"worktrees",e));if(r)return r.projectRoot}}function $(t,e=!1){for(let n of e?["index.lock"]:["index.lock","cache-lifecycle.lock"]){let i=B(h(t.localCacheDir,n));if(i!==void 0&&w(i))return!0}let r=B(N(t.localCacheDir).lockPath);return r!==void 0&&w(r)}function U(t){try{let e=JSON.parse(C(t,"worktree cache lease"));return e.version!==1||typeof e.repositoryId!="string"||typeof e.worktreeId!="string"||typeof e.projectRoot!="string"||e.treeOid!==void 0&&typeof e.treeOid!="string"||typeof e.localCacheDir!="string"||e.baseGenerationId!==void 0&&typeof e.baseGenerationId!="string"||e.activeGenerationId!==void 0&&typeof e.activeGenerationId!="string"||typeof e.ownershipChecksum!="string"||!/^[a-f0-9]{64}$/.test(e.ownershipChecksum)||typeof e.lastAction!="string"||e.lastReason!==void 0&&typeof e.lastReason!="string"||typeof e.lastSeenAt!="string"?null:e}catch{return null}}function B(t){try{let e=JSON.parse(C(t,"watch lock record"));return typeof e.pid=="number"&&Number.isSafeInteger(e.pid)&&e.pid>0?e.pid:void 0}catch{return}}function Ne(t){try{let e=JSON.parse(C(t,"repository cache GC state"));return e.version!==1||typeof e.lastSweepAt!="string"||!Number.isFinite(Date.parse(e.lastSweepAt))||!e.unreferencedSince||typeof e.unreferencedSince!="object"||!e.lastResult?null:e}catch{return null}}function De(t){try{let e=JSON.parse(C(t,"global repository cache GC state"));if(e.version!==1||typeof e.lastSweepAt!="string")return;let r=Date.parse(e.lastSweepAt);return Number.isFinite(r)?r:void 0}catch{return}}function x(t){try{return _e(t)}catch{return[]}}function Le(t){let e=0,r=[t];for(;r.length>0;){let n=r.pop();for(let i of _e(n,{withFileTypes:!0})){let s=h(n,i.name);i.isDirectory()?r.push(s):i.isFile()&&(e+=Ae(s).size)}}return e}import{createHash as Me}from"crypto";import{tmpdir as Wt,userInfo as Gt}from"os";import{join as Fe}from"path";var b=1,mr=1*1024*1024,yr=64*1024*1024,Rr=12e4,vr=["NO_COLOR","FORCE_COLOR","CLICOLOR","CLICOLOR_FORCE","TERM","CODEBASEIQ_DEBUG"];function Sr(t){let e=$e(),r=Me("sha256").update(`${e}\0${t}`).digest("hex");return process.platform==="win32"?`\\\\.\\pipe\\codebaseiq-lane-${r.slice(0,32)}`:Fe(jt(),`lane-${r.slice(0,24)}.sock`)}function jt(){let t=$e(),e=Me("sha256").update(t).digest("hex").slice(0,16);return Fe(Wt(),`codebaseiq-${e}`)}function $e(){try{return Gt().username}catch{return`uid-${typeof process.getuid=="function"?process.getuid():"unknown"}`}}function br(t,e){let r=Buffer.from(JSON.stringify(t),"utf8");if(r.byteLength>e)throw new Error(`query-lane frame of ${r.byteLength} bytes exceeds the ${e}-byte limit`);let n=Buffer.allocUnsafe(4+r.byteLength);return n.writeUInt32LE(r.byteLength,0),r.copy(n,4),n}function Cr(t,e,r){let n=Buffer.alloc(0),i=!1,s=a=>{i||(i=!0,r(new Error(a)))};return{push(a){if(!i)for(n=n.byteLength===0?a:Buffer.concat([n,a]);n.byteLength>=4;){let o=n.readUInt32LE(0);if(o>t){s(`query-lane frame of ${o} bytes exceeds the ${t}-byte limit`);return}if(n.byteLength<4+o)return;let l=n.subarray(4,4+o);n=n.subarray(4+o);let c;try{c=JSON.parse(l.toString("utf8"))}catch{s("query-lane frame carried invalid JSON");return}if(e(c),i)return}}}}function wr(t){if(!t||typeof t!="object")return null;let e=t;return e.protocolVersion!==b||typeof e.projectRoot!="string"||e.projectRoot.length===0?null:e.kind==="ping"?{protocolVersion:b,kind:"ping",projectRoot:e.projectRoot}:e.kind!=="execute"||!Array.isArray(e.argv)||!e.argv.every(r=>typeof r=="string")||typeof e.cwd!="string"||e.deadlineMs!==void 0&&!Number.isFinite(e.deadlineMs)||e.envAllowlist!==void 0&&(typeof e.envAllowlist!="object"||e.envAllowlist===null||Array.isArray(e.envAllowlist)||!Object.values(e.envAllowlist).every(r=>typeof r=="string"))||e.tty!==void 0&&(typeof e.tty!="object"||e.tty===null||typeof e.tty.isTTY!="boolean"||e.tty.columns!==void 0&&!Number.isFinite(e.tty.columns))||e.clientInvocation!==void 0&&(typeof e.clientInvocation!="object"||e.clientInvocation===null||typeof e.clientInvocation.execPath!="string"||e.clientInvocation.execPath.length===0||e.clientInvocation.scriptPath!==void 0&&typeof e.clientInvocation.scriptPath!="string")?null:{...e,kind:"execute"}}function xr(t){if(!t||typeof t!="object")return null;let e=t;if(e.protocolVersion!==b)return null;if(e.ok===!1)return e.code!=="unsupported"&&e.code!=="invalid-request"&&e.code!=="wrong-project"&&e.code!=="busy"&&e.code!=="stale-index"&&e.code!=="ineligible-command"&&e.code!=="execution-error"||typeof e.message!="string"?null:{ok:!1,protocolVersion:b,code:e.code,message:e.message};if(e.ok!==!0)return null;if(e.kind==="accepted"){let n=e.serverPid;return typeof n!="number"||!Number.isInteger(n)||n<=0?null:{ok:!0,kind:"accepted",protocolVersion:b,serverPid:n}}if(e.kind==="executed"){let n=e;return typeof n.serverPid!="number"||!Number.isInteger(n.serverPid)||n.serverPid<=0||typeof n.exitCode!="number"||!Number.isInteger(n.exitCode)||typeof n.stdout!="string"||typeof n.stderr!="string"||typeof n.generation!="string"||!/^[a-f0-9]{64}$/.test(n.generation)||typeof n.durationMs!="number"||!Number.isFinite(n.durationMs)?null:{ok:!0,kind:"executed",protocolVersion:b,serverPid:n.serverPid,exitCode:n.exitCode,stdout:n.stdout,stderr:n.stderr,generation:n.generation,durationMs:n.durationMs}}if(e.kind!=="pong"||typeof e.serverPid!="number"||!Number.isInteger(e.serverPid)||e.serverPid<=0||typeof e.cliVersion!="string"||typeof e.projectRoot!="string"||e.indexGeneration!==void 0&&!/^[a-f0-9]{64}$/.test(e.indexGeneration))return null;let r;if(e.processIdentity!==void 0){let n=Z(e.processIdentity);if(!n||n.pid!==e.serverPid)return null;r=n}return{ok:!0,kind:"pong",protocolVersion:b,serverPid:e.serverPid,...r?{processIdentity:r}:{},cliVersion:e.cliVersion,projectRoot:e.projectRoot,...e.indexGeneration!==void 0?{indexGeneration:e.indexGeneration}:{}}}var Be=[{question:"Who can call or reach this?",family:"execution",direction:"incoming"},{question:"What can this call or reach?",family:"execution",direction:"outgoing"},{question:"Where can this value come from?",family:"dataflow",direction:"incoming"},{question:"Where can this value go?",family:"dataflow",direction:"outgoing"},{question:"Which producer and consumer rendezvous?",family:"runtime",direction:"both"},{question:"What resource is observed or changed?",family:"state",direction:"both"},{question:"What occurs before or after this?",family:"temporal",direction:"both"},{question:"What interface constrains this?",family:"contract",direction:"both"},{question:"Are these observations the same entity?",family:"identity",direction:"both"},{question:"What contains or owns this?",family:"ownership",direction:"both"},{question:"What does this statically rely on?",family:"dependencies",direction:"outgoing"}],qe={execution:{establishes:"Static may-call reachability between resolved program constructs.",nonClaims:["A may-call edge does not prove that a runtime invocation occurred."]},runtime:{establishes:"A source-grounded handoff between producer and consumer participants through a runtime mechanism.",nonClaims:["An unresolved or candidate join does not prove a runtime handoff."]},dataflow:{establishes:"A value, definition, argument, parameter, return, or statically resolved value may flow to another construct.",nonClaims:["Current partial providers do not establish general interprocedural definition-use coverage."]},state:{establishes:"A construct reads, writes, creates, deletes, or otherwise changes an identified state resource.",nonClaims:["A state edge does not prove transactionality, durability, or exclusive ownership unless qualified."]},temporal:{establishes:"One observed construct is locally ordered before or after another under the reported source evidence.",nonClaims:["Source order does not imply cross-process happens-before or durability."]},contract:{establishes:"A program construct implements, constrains, or is typed by an identified contract.",nonClaims:["Contract identity does not prove runtime invocation or conformance outside reported checks."]},identity:{establishes:"Two observations refer to the same compiler-owned or source-owned program entity.",nonClaims:["Shared identity does not establish execution or value transfer."]},ownership:{establishes:"A source construct, symbol, runtime observation, or state resource is contained or owned by another program entity.",nonClaims:["Structural ownership does not establish lifetime, singleton scope, or runtime execution unless qualified."]},dependencies:{establishes:"A file, module, or symbol statically relies on another indexed entity.",nonClaims:["A dependency edge does not establish that the depended-on code executes."]}};function Qe(t){return M.flatMap(e=>e.relations.filter(r=>r.family===t).map(r=>({...r,providerId:e.id,providerLabel:e.label})))}function Ue(t){return[...new Set(M.filter(e=>e.relations.some(r=>r.family===t)).map(e=>e.label))]}var Tr=me.map(t=>({family:t,...qe[t],providers:Ue(t),relations:Qe(t)}));function Ve(t){return{family:t,...qe[t],providers:Ue(t),relations:Qe(t)}}var _r=["search","outline","entrypoints","evidence","inspect","code"];function Ar(){return Be.map(t=>{let e=Ve(t.family);return{...t,establishes:e.establishes,evidenceStrengths:Ye(e.relations.flatMap(r=>r.evidenceStrengths)),supportCeilings:Ye(e.relations.map(r=>r.supportCeiling)),nonClaim:e.nonClaims.join(" ")}})}function Ye(t){return[...new Set(t)]}export{Re as a,lr as b,dr as c,b as d,mr as e,yr as f,Rr as g,vr as h,Sr as i,br as j,Cr as k,wr as l,xr as m,Tr as n,_r as o,Ar as p};
|
|
3
|
+
//# sourceMappingURL=chunk-BEKCTUPY.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as C}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as C}from"./chunk-UHFZDQZJ.js";import{a as k}from"./chunk-ETZBIG6K.js";import{f as w,m as P,n as Q}from"./chunk-R2F2CTBA.js";import{o as T}from"./chunk-NB2DAVPP.js";import{d as x}from"./chunk-TNLOX4TN.js";import{f as g}from"./chunk-RGBZDOUO.js";import{z as b}from"./chunk-NRNVMB2R.js";function Y(e,n={}){let{samples:o=50,scope:s,maxDisagreements:u=5}=n,c=new C(e),l=F(c.productionCallableDefinitions({scope:s,minLoc:2,requireFunctionLikeSymbol:!0}),o),a=U(e,l);if(l.length===0||!a)return{available:!1,sampleSize:l.length,oracleCoverage:0,scores:[],topDisagreements:[]};let t={references:M(),callees:M()},r=[],m=0,d=a==="semantic"?P(e,l):{rows:new Map,incompleteSymbolIds:new Set,unavailableSymbolIds:new Set},y=a==="semantic"?Q(e,l):{rows:new Map,incompleteSymbolIds:new Set,unavailableSymbolIds:new Set},O=a==="source"?N(e,c,l):null;for(let i of l){let p=S(i,a==="semantic"?(d.rows.get(i.symbolId)??[]).map(f=>f.file):[...O?.referencesBySymbolId.get(i.symbolId)??[]]),E=S(i,a==="semantic"?(y.rows.get(i.symbolId)??[]).map(f=>f.file):[...O?.calleesBySymbolId.get(i.symbolId)??[]]),A=a!=="semantic"||!d.incompleteSymbolIds.has(i.symbolId)&&!d.unavailableSymbolIds.has(i.symbolId),D=a!=="semantic"||!y.incompleteSymbolIds.has(i.symbolId)&&!y.unavailableSymbolIds.has(i.symbolId);A&&D&&(m+=1);let R=S(i,T(e,i,{semanticEvidence:k}).map(f=>f.file)),B=S(i,(c.calleeMap([i],{semantic:!1}).get(i.symbolId)??[]).map(f=>f.file)),K=h(a,"references"),z=h(a,"callees");A?j(t.references,i,"references",R,p,K,r):t.references.skippedOracleUnavailable+=1,D?j(t.callees,i,"callees",B,E,z,r):t.callees.skippedOracleUnavailable+=1}return r.sort((i,p)=>p.cheapOnly.length+p.oracleOnly.length-(i.cheapOnly.length+i.oracleOnly.length)),{available:!0,sampleSize:l.length,oracleCoverage:l.length>0?v(m/l.length):0,oracleKind:a,scores:["references","callees"].map(i=>q(i,t[i],a)),topDisagreements:r.slice(0,u)}}function M(){return{comparedSymbols:0,agreed:0,cheapTotal:0,oracleTotal:0,skippedOraclePartial:0,skippedOracleUnavailable:0}}function F(e,n){let o=[...e].sort((c,l)=>c.symbolId-l.symbolId);if(o.length<=n)return o;let s=o.length/n,u=[];for(let c=0;c<n;c++)u.push(o[Math.floor(c*s)]);return u}function U(e,n){let o=n[0];if(!o)return null;if(I(e,o))return"source";try{if(w(e).capability("semantic-references",o.relativePath).available)return"semantic"}catch{}return n.some(s=>I(e,s))?"source":null}function S(e,n){let o=new Set;for(let s of n)s!==e.relativePath&&o.add(s);return o}function j(e,n,o,s,u,c,l){if(!c&&u.size===0){e.skippedOraclePartial+=1;return}e.comparedSymbols+=1,e.cheapTotal+=s.size,e.oracleTotal+=u.size;let a=[],t=[];for(let r of s)u.has(r)?e.agreed+=1:a.push(r);for(let r of u)s.has(r)||t.push(r);(a.length>0||t.length>0)&&l.push({symbol:x(n.symbol),question:o,cheapOnly:a,oracleOnly:t})}var _={references:!0,callees:!1};function q(e,n,o){let s=n.oracleTotal>0?n.agreed/n.oracleTotal:1,u=n.cheapTotal-n.agreed,c=h(o,e);return{question:e,comparedSymbols:n.comparedSymbols,precision:c&&n.cheapTotal>0?v(n.agreed/n.cheapTotal):null,recall:v(s),unverified:u,skippedOraclePartial:n.skippedOraclePartial,skippedOracleUnavailable:n.skippedOracleUnavailable}}function h(e,n){return e==="semantic"?_[n]:!1}function I(e,n){return b(n.relativePath)==="clojure"&&g(e,n.relativePath)!==null}function N(e,n,o){let s=new Map,u=new Map,c=o.filter(t=>I(e,t)),l=new Map;for(let t of c){let r=l.get(t.leaf)??[];r.push(t),l.set(t.leaf,r)}for(let t of n.sourceFiles()){if(b(t)!=="clojure")continue;let r=g(e,t);if(r)for(let m of r.fileIdentifiers)for(let d of l.get(m)??[])L(s,d.symbolId,t)}let a=new Map;for(let t of n.scopedDefinitions()){if(b(t.relativePath)!=="clojure")continue;let r=a.get(t.leaf)??[];r.push(t),a.set(t.leaf,r)}for(let t of c){let r=g(e,t.relativePath);if(r){for(let m of r.callSites)if(!(m.line<t.startLine||m.line>t.endLine))for(let d of a.get(m.calleeLeaf)??[])L(u,t.symbolId,d.relativePath)}}return{referencesBySymbolId:s,calleesBySymbolId:u}}function L(e,n,o){let s=e.get(n);if(s){s.add(o);return}e.set(n,new Set([o]))}function v(e){return Math.round(e*1e3)/1e3}export{Y as a};
|
|
2
|
+
//# sourceMappingURL=chunk-BKKX2OU5.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as d,b as m}from"./chunk-IRQOAM5G.js";import{c as u}from"./chunk-NMTSZXCL.js";import{a as c}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as d,b as m}from"./chunk-IRQOAM5G.js";import{c as u}from"./chunk-NMTSZXCL.js";import{a as c}from"./chunk-6CTSFS7R.js";function y(t,e={}){let{minSimilarity:o=.5,limit:l=20,scope:n,filePattern:p}=e,r=e.minDeps??(p?1:3),{profiles:i,distinctiveDeps:f}=D(t,{scope:n,minDeps:r}),s=d(i,a=>a.deps);return m({profiles:i,limit:l,filePattern:p,overrunFactor:5,candidateIndex:s,profile:{name:"similar-files"},compare:(a,g)=>F(a,g,o,f)})}function D(t,e){let{scope:o,minDeps:l}=e,n=c(t,o),{universalDeps:p,distinctiveDeps:r}=S(n),i=[];for(let[f,s]of n)s.size>=l&&i.push({file:f,deps:new Set([...s].filter(a=>!p.has(a)))});return{profiles:i,distinctiveDeps:r}}function S(t){let e=new Set,o=new Set,l=t.size;if(l===0)return{universalDeps:e,distinctiveDeps:o};let n=new Map;for(let r of t.values())for(let i of r)n.set(i,(n.get(i)??0)+1);let p=Math.max(3,Math.ceil(l*.03));for(let[r,i]of n)i>=5&&i/l>.3?e.add(r):i<=p&&o.add(r);return{universalDeps:e,distinctiveDeps:o}}function F(t,e,o,l){let n=new Set;for(let s of t.deps)e.deps.has(s)&&n.add(s);if(n.size<3||t.deps.size<4||e.deps.size<4)return null;let p=0;for(let s of n)l.has(s)&&p++;if(p<2)return null;let r=u(t.deps,e.deps);if(r<o)return null;let i=[];for(let s of t.deps)e.deps.has(s)||i.push(s);let f=[];for(let s of e.deps)t.deps.has(s)||f.push(s);return{fileA:t.file,fileB:e.file,similarity:r,sharedDeps:[...n],uniqueToA:i,uniqueToB:f}}export{y as a};
|
|
2
|
+
//# sourceMappingURL=chunk-BQKRYKDD.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{b as k}from"./chunk-
|
|
1
|
+
import{b as k}from"./chunk-6P5QMOM7.js";import{c as D}from"./chunk-UHFZDQZJ.js";import{m as S}from"./chunk-NB2DAVPP.js";import{f as v,h as L}from"./chunk-GLXEWYQY.js";import{d as h,t as y}from"./chunk-TNLOX4TN.js";function z(e,n={}){let{scope:s,minLoc:c=1,maxDepth:a=5,scanLimit:f}=n,t=new D(e),i=_(e,s,c,f),o=new P;for(let r of i)o.add(r);let m=[],I=[];i.length>0&&m.push(C(e,0,i,o));let b=i.map(r=>r.definition).filter(r=>r!==null),x=new Set(i.map(r=>r.symbol));for(let r=1;r<=a&&b.length>0;r++){let u=t.calleeMap(b,{semantic:!1}),E=new Set;for(let d of b)for(let l of u.get(d.symbolId)??[])x.has(l.symbol)||E.add(l.symbol);let p=[];for(let d of E){x.add(d);let l=F(e,d);if(!l||e.isIgnored(l.relativePath)||v(e,l.relativePath)||L(e,l.symbol,l.relativePath)||t.fileKind(l.relativePath)==="test"||t.hasSuppressionComment(l))continue;let g=B(e,l,o);g.removable?p.push(w(l,"cascade")):g.blockingFiles.length>0&&I.push({shortName:h(l.symbol),file:l.relativePath,blockingFiles:g.blockingFiles.slice(0,3)})}if(p.length===0)break;for(let d of p)o.add(d);m.push(C(e,r,p,o)),b=p.map(d=>d.definition).filter(d=>d!==null)}let N=m.reduce((r,u)=>r+u.loc,0),R=m.reduce((r,u)=>r+u.entries.length,0);return{batches:m,totalSymbols:R,totalLoc:N,blocked:I}}function _(e,n,s,c){let a=k(e,{scope:n,minLoc:s,skipBarrels:!0,deadCodeOnly:!0,scanLimit:c,semantic:!1}),f=[];for(let t of a.symbols)t.kind==="dead-code"&&(v(e,t.relativePath)||L(e,t.symbol,t.relativePath)||f.push({symbol:t.symbol,shortName:t.shortName,file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:t.loc,evidence:"graph-fact",definition:F(e,t.symbol)}));return f}function w(e,n){return{symbol:e.symbol,shortName:h(e.symbol),file:e.relativePath,startLine:e.startLine,endLine:e.endLine,loc:e.endLine-e.startLine+1,evidence:n,definition:e}}function F(e,n){let s=e.get(`SELECT d.relative_path
|
|
2
2
|
FROM global_symbols gs
|
|
3
3
|
JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
4
4
|
JOIN documents d ON d.id = der.document_id
|
|
5
5
|
WHERE gs.symbol = ?
|
|
6
6
|
LIMIT 1`,n);return s?y(e,s.relative_path).find(c=>c.symbol===n)??null:null}function B(e,n,s){let c=S(e,n);if(c.length===0)return{removable:!1,blockingFiles:[]};let a=new Set;for(let f of c)f.file===n.relativePath&&f.line>=n.startLine&&f.line<=n.endLine||s.contains(f.file,f.line)||a.add(f.file);return{removable:a.size===0,blockingFiles:[...a]}}function C(e,n,s,c){let a=[...s].sort((i,o)=>i.file.localeCompare(o.file)||i.startLine-o.startLine),f=new Set(a.map(i=>i.file)),t=[];for(let i of f){let o=y(e,i);o.length>0&&o.every(m=>c.contains(i,m.startLine))&&t.push(i)}return{depth:n,entries:a.map(({definition:i,...o})=>o),loc:a.reduce((i,o)=>i+o.loc,0),filesEmptied:t.sort()}}var P=class{ranges=new Map;add(n){let s=this.ranges.get(n.file)??[];s.push({start:n.startLine,end:n.endLine}),this.ranges.set(n.file,s)}contains(n,s){let c=this.ranges.get(n);return c?c.some(a=>s>=a.start&&s<=a.end):!1}};export{z as a,P as b};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-BVDQU2XJ.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{closeSync as ie,fstatSync as z,openSync as oe,readFileSync as xt,readSync as ke}from"fs";import{createHash as bt}from"crypto";var Fe=8*1024*1024,ve=64*1024*1024,Pt=512*1024*1024,jt=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 De(e,t){ae(t.maxBytes);let r=String(e),n=oe(e,"r");try{let i=z(n);Re(i,t,r);let o=xt(n),s=z(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{ie(n)}}function I(e,t,r="utf8"){return De(e,t).toString(r)}function R(e,t){return I(e,{maxBytes:Fe,inputKind:t})}function wt(e,t){return I(e,{maxBytes:ve,inputKind:t})}function se(e,t){ae(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 Ct(e,t,r="utf8"){return se(e,t).toString(r)}function Ie(e,t){let r=oe(e,"r");try{return se(r,t)}finally{ie(r)}}function Et(e,t,r="utf8"){return Ie(e,t).toString(r)}function G(e,t,r){ae(t.maxBytes);let n=String(e),i=oe(e,"r");try{let o=z(i);Re(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=z(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{ie(i)}}function kt(e,t){let r=bt("sha256");return G(e,t,n=>r.update(n)),r.digest("hex")}function Re(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 ae(e){if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`maxBytes must be a non-negative safe integer; received ${e}`)}function ce(e,t,r=[]){let n=ue(e);if(Le.has(n)||r.some(o=>W(n,o))||t.some(o=>Ne(n,o)))return"config";if(t.some(ze)&&/\.d\.(?:ts|mts|cts)$/.test(n.toLowerCase()))return"ambient";let i=Me(n);return t.some(o=>(Ge[o]??[]).includes(i))?"source":"other"}function Be(e,t,r){let n=ue(e);if(Le.has(n)||r?.some(o=>W(n,o))||Ne(n,t)||ze(t)&&/\.d\.(?:ts|mts|cts)$/.test(n.toLowerCase()))return!0;let i=Me(n);return(Ge[t]??[]).includes(i)}function kn(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.version!="number"||!Oe(t.languages)||typeof t.pnpmWorkspaces!="boolean"||typeof t.typescriptProjectMode!="string"||!Oe(t.typescriptProjects)||t.clojureConfigPath!==void 0&&typeof t.clojureConfigPath!="string"||!Array.isArray(t.files)||!t.files.every(Ft)?null:t}function Fn(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=ce(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"),(Ae(e?.files??[])||Ae(t.files))&&s.add("duplicate-input-path"),[...e?.files??[],...t.files].some(vt)&&s.add("unreadable-input"),{version:1,changes:o,projectIdentityChanged:e?!Dt(e,t):!0,uncertainty:[...s].sort()}}function Oe(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function Ae(e){return new Set(e.map(t=>t.path)).size!==e.length}function Ft(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 vt(e){return e.hash==="unreadable"||e.size<0}function Dt(e,t){return Te(e.languages,t.languages)&&e.pnpmWorkspaces===t.pnpmWorkspaces&&e.typescriptProjectMode===t.typescriptProjectMode&&Te(e.typescriptProjects,t.typescriptProjects)&&e.clojureConfigPath===t.clojureConfigPath}function Te(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 Le=new Set([".codebaseiq.json"]),It={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"]},Rt={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:[]},_e=new Map;function Ne(e,t){return It[t].some(r=>W(e,r))||Rt[t].some(r=>W(e,r))}function W(e,t){let r=ue(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=_e.get(r);if(!o){let s=r.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/\?/g,"[^/]");o=new RegExp(`^${s}$`),_e.set(r,o)}return o.test(i)}function ue(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function Me(e){return e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:""}function ze(e){return e==="typescript"||e==="javascript"}var Ge={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 Ot}from"module";var At=Ot(import.meta.url),We=Tt().version;function Tt(){for(let e of["../package.json","../../package.json"])try{return At(e)}catch{}return{version:"0.0.0"}}import{createHash as Ye,randomUUID as $t}from"crypto";import{chmodSync as Ve,existsSync as E,linkSync as Ht,lstatSync as J,readdirSync as fe,realpathSync as x,unlinkSync as Ut,writeSync as Jt}from"fs";import{homedir as qt}from"os";import{basename as Kt,dirname as q,isAbsolute as Ke,join as y,resolve as K}from"path";import{closeSync as _t,existsSync as Bt,fsyncSync as Lt,mkdirSync as Nt,openSync as Mt}from"fs";import{dirname as He}from"path";function $e(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 le(e,t){if(t!=="win32")return!1;let r=e.code;return r==="EACCES"||r==="EBADF"||r==="EINVAL"||r==="EISDIR"||r==="EPERM"}var O=Object.freeze({platform:process.platform,pathExists:e=>Bt(e),makeDirectory:e=>Nt(e,{recursive:!0}),openFile:(e,t,r)=>Mt(e,t,r),syncFile:e=>Lt(e),closeFile:e=>_t(e)});function Ue(e,t=O){let r=[],n=e;for(;!t.pathExists(n);){r.push(n);let o=He(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=H(i,$(He(o),t));return i}function $(e,t=O){let r;try{r=t.openFile(e,"r")}catch(n){if(le(n,t.platform))return"unsupported";throw n}try{t.syncFile(r)}catch(n){try{t.closeFile(r)}catch{}if(le(n,t.platform))return"unsupported";throw n}return t.closeFile(r),"synced"}function H(...e){return e.every(t=>t==="not-requested")?"not-requested":e.includes("unsupported")?"unsupported":"synced"}import{isAbsolute as qe,relative as zt}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 de(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function Ln(e){return e.replace(/\\/g,"/")}function Nn(e,t){return de(e)===de(t)}function Je(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 Mn(e,t){return Je(e)===Je(t)}function S(e,t){let r=zt(e,t);return r===""||!r.startsWith("..")&&!qe(r)}function C(e){if(!e)throw new m(e,"empty-path");if(e.includes("\0"))throw new m(e,"nul-byte");if(qe(e)||/^[A-Za-z]:/.test(e)||e.startsWith("//")||e.startsWith("\\\\"))throw new m(e,"absolute-path");let t=de(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 Gt="CODEBASEIQ_READ_ONLY",Wt="CODEBASEIQ_ALLOW_STALE";function F(e=process.env){let t=e[Gt]?.trim().toLowerCase();return t==="1"||t==="true"}function Gn(e=process.env){let t=e[Wt]?.trim().toLowerCase();return t==="1"||t==="true"||F(e)}var Qe=1,T=".codebaseiq-cache-owner.json",Xt=16*1024,Ze=Object.freeze({...O,randomToken:()=>$t(),linkFile:(e,t)=>Ht(e,t),removeFile:e=>Ut(e),writeFile:(e,t,r,n)=>Jt(e,t,r,n)});function U(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 Yt(e,t){let r=x(e),n=ge(r,t);return F()?n:Qt(r,n)}function ge(e,t){let r=x(e),n=process.env.CODEBASEIQ_CACHE_DIR;return n?K(n):t?.dbPath?er(r,t.dbPath):Vt(r)}function et(){let e=process.env.XDG_CACHE_HOME;return y(e||y(qt(),".cache"),"codebaseiq")}function Vt(e){let t=K(e);try{t=x(t)}catch{}let r=Ye("sha256").update(t).digest("hex").slice(0,12);return y(et(),"projects",r)}function Zn(e){if(!/^[a-f0-9]{24}$/.test(e))throw new Error(`invalid repository cache identity: ${e}`);let t=y(et(),"repositories",e);return nt(t),x(t)}function ei(e){return!F()&&process.env.CODEBASEIQ_SHARED_CACHE!=="0"&&!process.env.CODEBASEIQ_CACHE_DIR&&!process.env.CODEBASEIQ_INDEX_DB&&!e?.dbPath}function ti(e,t){let r=Yt(e,t);return{cacheDir:r,dbPath:y(r,"index.db"),indexPath:y(r,"index.scip"),metaPath:y(r,"meta.json")}}function Qt(e,t,r=Ze){return Zt(e,t,r).cacheDir}function Zt(e,t,r=Ze){let n=x(e),i=E(t)?"synced":nt(t,r),o=x(t),s=y(o,T);if(E(s))return pe(n,o),he(s),A(o),{kind:"existing",cacheDir:o};Xe(o),or(o),Xe(o);let c=`${JSON.stringify({schemaVersion:Qe,canonicalProjectRoot:n,canonicalCacheDir:o,creatorVersion:We},null,2)}
|
|
2
|
+
`;try{let u=sr(s,c,r),l=H(i,u);return{kind:"published",cacheDir:o,achievedDurability:l==="synced"?"directory-durable":"file-flushed",directorySync:l}}catch(u){if(cr(u))return pe(n,o),{kind:"existing",cacheDir:o};throw u}}function pe(e,t){let r=x(e),n=x(t);return rr(n,r,n)}function ri(e,t){return E(y(t,T))?(pe(e,t),tt(t),!0):!1}function er(e,t){let r;try{r=C(t)}catch(s){throw s instanceof m?U(t,s.reason):s}let n=K(e,...r.split("/"));if(n===e||!S(e,n))throw U(t,"outside-project");let i=tr(n),o=x(i);if(!S(e,o)&&o!==e)throw U(t,"symlink-escape");return n}function tr(e){let t=e;for(;!E(t);){let r=q(t);if(r===t)throw U(e,"no-existing-ancestor");t=r}return t}function rr(e,t,r){let n=y(e,T);if(!E(n)||J(n).isSymbolicLink())throw b(e,"missing regular ownership record");let i=J(n);if(!i.isFile()||i.size>Xt)throw b(e,"invalid ownership record file");let o=R(n,"cache ownership record"),s=nr(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:Ye("sha256").update(o).digest("hex"),physicalCacheDir:e}}function nr(e,t){try{let r=JSON.parse(e);if(r.schemaVersion!==Qe||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 b(t,`malformed ownership record: ${r instanceof Error?r.message:String(r)}`)}}function Xe(e){let t=fe(e).filter(r=>r!==T&&!ir(r));if(t.length>0)throw b(e,`unrecognized existing entries: ${t.slice(0,3).join(", ")}`)}function ir(e){return e.startsWith(`${T}.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 or(e){for(let t of fe(e)){let r=y(e,t);try{let n=J(r);if(n.isSymbolicLink())throw b(e,`legacy cache entry ${t} is a symlink`);if(n.isDirectory())A(r);else if(n.isFile())he(r);else throw b(e,`legacy cache entry ${t} is not a file or directory`)}catch(n){if(rt(n))continue;throw n}}A(e)}function tt(e,t=!1){try{let r=J(e);if(r.isSymbolicLink())throw b(e,"managed cache tree contains a symlink");if(r.isFile()){he(e);return}if(!r.isDirectory())throw b(e,"managed cache tree contains a special file");A(e);for(let n of fe(e))tt(y(e,n),!0)}catch(r){if(t&&rt(r))return;throw r}}function rt(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}function nt(e,t=O){let r=Ue(e,t);return A(e),r}function sr(e,t,r){let n=`${e}.tmp-${process.pid}-${r.randomToken()}`,i,o=!1;try{i=r.openFile(n,"wx",384),o=!0,$e(i,Buffer.from(t),r,"cache ownership record"),r.syncFile(i),r.closeFile(i),i=void 0,r.linkFile(n,e);let s=$(q(e),r);return r.removeFile(n),o=!1,H(s,$(q(e),r))}finally{if(i!==void 0)try{r.closeFile(i)}catch{}if(o)try{r.removeFile(n)}catch{}}}function A(e){process.platform!=="win32"&&Ve(e,448)}function he(e){process.platform!=="win32"&&Ve(e,384)}function ar(e){if(E(e))return x(e);let t=[],r=e;for(;;){let n=q(r);if(n===r)return e;if(t.unshift(Kt(r)),E(n))return y(x(n),...t);r=n}}function ni(e){return ar(K(e))}function cr(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="EEXIST"}import{spawnSync as ot}from"child_process";import{createHash as ur}from"crypto";import{existsSync as lr,lstatSync as dr,realpathSync as pr}from"fs";import{dirname as fr,isAbsolute as gr,join as hr,resolve as Y}from"path";function V(){return{...process.env,GIT_OPTIONAL_LOCKS:"0",LC_ALL:"C"}}var B={run(e,t){let r=it(e,t);return r.kind==="success"?r.output:void 0},runResult:it},mr=["rev-parse","--show-toplevel","--absolute-git-dir","--git-common-dir","HEAD","HEAD^{tree}"],_=/^[0-9a-f]{40,64}$/;function ui(e,t,r){if(!_.test(t.replace(/\^$/,"")))return[];let n=ot("git",["log","--first-parent",`--max-count=${r}`,"--format=%T",t,"--"],{cwd:e,encoding:"utf8",env:V(),timeout:3e4,windowsHide:!0});return n.status!==0?[]:n.stdout.split(/\r?\n/).filter(i=>_.test(i))}function li(e,t,r=B){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"||!_.test(n.output))throw new Error(`Git revision ${JSON.stringify(t)} does not resolve to exactly one commit.`);return n.output}function di(e,t=B){let r=t.runResult(e,mr);if(r.kind==="success"){let n=yr(r.output);if(n)return Sr(n,t)}return xr(e,t)}function yr(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||!_.test(o)||!_.test(s))return;let a=P(r);return{root:a,gitDir:P(X(a,n)),commonDir:P(X(a,i)),headCommit:o,treeOid:s}}function Sr(e,t){let r=t.run(e.root,["status","--porcelain=v1","-z","--untracked-files=all"]);return r===void 0?void 0:{...st(e.root,e.gitDir),commonDir:e.commonDir,repositoryId:ye("repository",e.commonDir),headCommit:e.headCommit,treeOid:e.treeOid,clean:r.length===0}}function xr(e,t){let r=br(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(X(i,o)),a=me(t.run(i,["rev-parse","--verify","HEAD"])),c=me(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:ye("repository",s),headCommit:a,treeOid:c,clean:u.length===0}}function br(e,t=B){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(X(i,o));return{kind:"worktree",identity:st(i,s)}}function st(e,t){return{projectRoot:e,gitDir:t,worktreeId:ye("worktree",`${e}\0${t}`)}}function pi(e,t=B){let r=t.run(e,["worktree","list","--porcelain","-z"]);return r===void 0?[]:Pr(r)}function Pr(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 fi(e,t,r=B){return me(r.run(e,t))}function X(e,t){return gr(t)?t:Y(e,t)}function P(e){try{return pr(e)}catch{return Y(e)}}function ye(e,t){return ur("sha256").update(`${e}\0${t}`).digest("hex").slice(0,24)}function me(e){return e?.trim()||void 0}function it(e,t){let r=ot("git",["-C",e,...t],{encoding:"utf-8",env:V(),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"&&lr(Y(e)))&&!jr(e)?{kind:"not-repository"}:{kind:"error",message:i}}function jr(e){if(process.env.GIT_DIR||process.env.GIT_COMMON_DIR)return!0;let t=Y(e);for(;;){try{return dr(hr(t,".git")),!0}catch(n){let i=n.code;if(i!=="ENOENT"&&i!=="ENOTDIR")return!0}let r=fr(t);if(r===t)return!1;t=r}}import{execFileSync as Qr}from"child_process";import{createHash as ht}from"crypto";import{closeSync as Zr,fstatSync as mt,lstatSync as Pe,openSync as en,readdirSync as tn,readFileSync as rn,readlinkSync as nn,realpathSync as ee}from"fs";import{isAbsolute as on,join as je,relative as sn,resolve as an,sep as cn}from"path";import{execFileSync as Se}from"child_process";import{createHash as wr}from"crypto";import{mkdirSync as Cr,renameSync as Er,writeFileSync as kr}from"fs";import{basename as Fr,dirname as vr,join as Dr}from"path";var Ir="git-content-hashes.json",Rr=32*1024*1024,Or=2e5,Q=3e4;function xe(){return{env:V(),encoding:"utf8",maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:Q,killSignal:"SIGKILL"}}function at(e){let t,r;try{t=Se("git",["-C",e,"ls-files","-s","-z","--","."],{...xe(),timeout:Q}),r=Se("git",["-C",e,"status","--porcelain=v1","-z","--untracked-files=all","--no-renames","--","."],{...xe(),timeout:Q})}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,M]=p,w=l.slice(f+1);if(h!=="100644"&&h!=="100755"||M!=="0"){n.delete(w);continue}n.set(w,g),Fr(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=Ar(e,i),a=Dr(ge(e),Ir),c=Tr(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||F())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>Or))try{Cr(vr(a),{recursive:!0});let p=`${a}.${process.pid}.tmp`;kr(p,JSON.stringify({version:1,salt:s,entries:f})),Er(p,a)}catch{}}}}function Ar(e,t){let r="";try{r=Se("git",["-C",e,"config","--get-regexp","^core\\.(autocrlf|eol|safecrlf)$"],{...xe(),timeout:Q})}catch{}return wr("sha256").update(JSON.stringify([r.trim(),t.sort()])).digest("hex")}function Tr(e,t){let r={version:1,salt:t,entries:{}};try{let n=I(e,{maxBytes:Rr,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 _r}from"async_hooks";var Br=new _r;function v(e,t){let r=Z(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 D(e,t){let r=Z(e);if(r)return r.missing.has(t)?"missing":r.paths.includes(t)?"present":"missing"}function ct(e,t){return Z(e)?.fingerprints.get(t)}function k(e){return Z(e)?.paths}function Z(e){let t=Br.getStore();if(t)return t.projectRoot===P(e)?t:void 0}import{createRequire as Lr}from"module";import{existsSync as Nr,readdirSync as Mr,statSync as zr}from"fs";import d from"path";var Gr=Lr(import.meta.url),ut=new Set([".cache",".git",".next",".nuxt",".turbo",".nx","build","coverage","dist","node_modules","tmp","vendor"]);function Wr(e,t=[]){let r=d.resolve(e),n=t.flatMap(c=>Hr(r,c));if(n.length>0)return lt(r,pt(n));let i=$r(r),o=pt(i),s=Ur(r,o)?[r,...o]:o,a=s.length>0?s:[r];return lt(r,a)}function ft(e,t,r=[]){let n;try{n=Gr("ts-morph")}catch{return null}let i=d.resolve(e),o=t==="workspace"?Wr(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=Xr(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 lt(e,t){return[...new Set(t.map(r=>L(e,r)))].sort((r,n)=>r.localeCompare(n))}function $r(e){let t=k(e);if(t)return t.flatMap(i=>{if(i.split("/").some(s=>ut.has(s)))return[];let o=d.join(e,...i.split("/"));return dt(e,o)?[d.dirname(o)]:[]});let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=Mr(i,{withFileTypes:!0})}catch{continue}for(let s of o){let a=d.join(i,s.name);if(s.isDirectory()){!ut.has(s.name)&&!s.name.startsWith(".")&&n.push(a);continue}s.isFile()&&dt(e,a)&&r.push(d.dirname(a))}}return r}function Hr(e,t){let r=t.trim();if(!r)return[];let n=d.resolve(e,r);if(!S(e,n))return[];let i=k(e);if(i){let o=L(e,n);if(i.includes(o)&&be(d.basename(n)))return[d.dirname(n)];let s=o==="."?"":`${o}/`;return i.some(a=>a.startsWith(s))?[n]:[]}try{let o=zr(n);if(o.isDirectory())return[n];if(o.isFile()&&be(d.basename(n)))return[d.dirname(n)]}catch{return[]}return[]}function dt(e,t){if(!be(d.basename(t)))return!1;let r=gt(e,t);return r?d.basename(t)==="tsconfig.json"||"include"in r||"files"in r||"references"in r:!1}function be(e){return e.startsWith("tsconfig")&&e.endsWith(".json")}function pt(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&&Vr(r,n)))}function Ur(e,t){if(t.length===0||t.some(n=>d.resolve(n)===e))return!1;let r=d.join(e,"tsconfig.json");return qr(e,r)&&Jr(e,r)}function Jr(e,t){let n=gt(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 gt(e,t){try{let r=JSON.parse(Kr(e,t));return r&&typeof r=="object"&&!Array.isArray(r)?r:null}catch{return null}}function qr(e,t){let r=L(e,t),n=D(e,r);return n?n==="present":Nr(t)}function Kr(e,t){let r=L(e,t);if(k(e)){let i=v(e,r);if(!i)throw Object.assign(new Error(`Snapshot file ${r} is missing.`),{code:"ENOENT"});return i.content.toString("utf8")}return R(t,"TypeScript project config")}function Xr(e,t){let r=k(t);if(!r)return e.sys;let n=d.resolve(t),i=new Set(r),o=Yr(n,r),s=e,a=c=>{let u=d.resolve(c);return S(n,u)?L(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):v(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 Yr(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 L(e,t){let r=d.relative(e,t);return r?r.split(d.sep).join("/"):"."}function Vr(e,t){let r=d.relative(e,t);return!!r&&!r.startsWith("..")&&!d.isAbsolute(r)}var te=64*1024*1024,N=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 un(e){return[...new Set((e??[]).map(t=>t.trim()).filter(Boolean))].sort((t,r)=>t.localeCompare(r))}function yt(e,t,r={}){let n=C(t),i=ee(e),o=an(i,...n.split("/"));if(!S(i,o)||o===i)throw new m(t,"outside-project");let s=ee(o);if(!S(i,s)||s===i)throw new m(t,"outside-project");let a=Pe(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??te;if(St(u),c.size>u)throw new N(r.inputKind??"project file",c.relativePath,c.size,u);return c}function ln(e,t,r={}){let n=C(t),i=D(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=v(e,n);if(!c)throw new m(n,"changed-during-read");let u=r.maxBytes??te;if(St(u),c.size>u)throw new N(r.inputKind??"project file",n,c.size,u);return Buffer.from(c.content)}let o=yt(e,t,r),s=r.maxBytes??te,a=en(o.absolutePath,"r");try{let c=mt(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 N(r.inputKind??"project file",o.relativePath,c.size,s);let u=rn(a),l=mt(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{Zr(a)}}function Hi(e,t,r={}){return ln(e,t,r).toString("utf8")}function we(e){return typeof e=="object"&&e!==null&&"code"in e&&(e.code==="ENOENT"||e.code==="ENOTDIR")}function Ui(e,t){try{return yt(e,t),!0}catch(r){if(we(r))return!1;throw r}}function St(e){if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`maxBytes must be a non-negative safe integer; received ${e}`)}function dn(e){return(k(e)??yn(e)??Sn(e)).filter(t=>t&&!Ce(t)).sort()}function pn(e,t={}){let r=(t.includePaths??[]).map(C),n=[...new Set([...dn(e),...r])].filter(c=>!Ce(c)).filter(c=>!t.language||Be(c,t.language,t.markerFiles)).filter(c=>!t.includePath||t.includePath(c)).sort(),i=ee(e),o,s=()=>o??=at(i),a=n.flatMap(c=>{let u=ct(e,c);if(u)return[{path:c,size:u.fingerprintSize??u.size,hash:u.sha256}];let l=D(e,c);if(l==="present"){let g=v(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=je(e,c);try{if(Pe(h).isSymbolicLink()){let re=ee(h),ne=sn(i,re);if(ne===".."||ne.startsWith(`..${cn}`)||on(ne))throw new Error("external symlink");let Ee=nn(h);return[{path:c,size:Buffer.byteLength(Ee),hash:ht("sha256").update("symlink\0").update(Ee).digest("hex")}]}let g=ht("sha256"),M=G(h,{inputKind:"project fingerprint input",maxBytes:te},re=>g.update(re)),w=g.digest("hex");return f?.seed(c,{size:M,hash:w}),[{path:c,size:M,hash:w}]}catch(g){return we(g)?[]:[{path:c,size:-1,hash:"unreadable"}]}});return o?.persist(),a}function Ji(e,t,r){let n=hn(t,r),i=[...n.typescriptProjects.filter(s=>gn(e,s)),...n.clojureConfigPath?[n.clojureConfigPath]:[]],o=n.languages.includes("typescript")?ft(e,n.typescriptProjectMode,n.typescriptProjects):null;return{...n,files:pn(e,{includePath:s=>{let a=ce(s,t,i);return a==="other"?!1:a!=="source"||!fn(s)||!o?!0:o.has(s)},includePaths:i})}}function fn(e){return/\.(?:[cm]?[jt]sx?|vue)$/iu.test(e)}function gn(e,t){let r;try{r=C(t)}catch{return!1}let n=D(e,r);if(n)return n==="present";try{return Pe(je(e,r)).isFile()}catch(i){if(we(i))return!1;throw i}}function hn(e,t){return{version:3,languages:[...e].sort(),pnpmWorkspaces:t.typescriptProjectMode!=="workspace"&&t.pnpmWorkspaces===!0,typescriptProjectMode:t.typescriptProjectMode??"single",typescriptProjects:un(t.typescriptProjects),clojureConfigPath:mn(t.clojureConfigPath)}}function mn(e){return e?.trim()||void 0}function yn(e){try{return Qr("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 Sn(e){let t=[],r=[""];for(;r.length>0;){let n=r.pop(),i=n?je(e,n):e,o;try{o=tn(i,{withFileTypes:!0})}catch{continue}for(let s of o){let a=n?`${n}/${s.name}`:s.name;if(s.isDirectory()){Ce(a)||r.push(a);continue}t.push(a)}}return t}function Ce(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=>xn.has(r))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var xn=new Set([".git","node_modules",".codebaseiq-cache",".codebaseiq-generations",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]);export{Fe as a,ve as b,Pt as c,jt as d,j as e,De as f,I as g,R as h,wt as i,Ct as j,Et as k,G as l,kt as m,ce as n,kn as o,Fn as p,Ft as q,It as r,$e as s,le as t,O as u,Ue as v,$ as w,H as x,m as y,de as z,Ln as A,Nn as B,Je as C,Mn as D,S as E,C as F,We as G,Gt as H,F as I,Gn as J,T as K,ge as L,et as M,Vt as N,Zn as O,ei as P,ti as Q,ri as R,ni as S,V as T,B as U,ui as V,li as W,di as X,br as Y,pi as Z,fi as _,X as $,P as aa,Wr as ba,N as ca,un as da,yt as ea,ln as fa,Hi as ga,we as ha,Ui as ia,dn as ja,pn as ka,Ji as la,hn as ma};
|
|
5
|
+
//# sourceMappingURL=chunk-C3PPB2T5.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{V as Be,W as Ve}from"./chunk-AJ5HVC5Z.js";import{N as ae,O as de,Q as I,R as M,S as L}from"./chunk-PVKSZBX5.js";import{C as Ue,a as Ge}from"./chunk-ZJNV27DZ.js";import{A as je,B as Fe,K as N,l as ue,m as Le,n as W,p as Ne,q as $e,z as C}from"./chunk-75VNTSO6.js";import{b as E,j as re,k as ie,l as Oe,m as se,n as De,p as Me,r as ce,s as D}from"./chunk-3F23W57G.js";import{a as O,c as Pe,d as te,e as ne}from"./chunk-OZI44VCR.js";import{$ as _e,I as Te,M as k,Q as He,Y as qe,_ as oe,a as We,aa as v,f as Z,h as f,v as ee,w as b,x as Ce}from"./chunk-C3PPB2T5.js";import{spawn as Zt}from"child_process";import{existsSync as en,rmSync as ot}from"fs";import{dirname as tn,resolve as V}from"path";import{fileURLToPath as nn}from"url";import{createHash as Nt,randomUUID as le}from"crypto";import{existsSync as $t,linkSync as jt,readdirSync as Ft,rmSync as w}from"fs";import{basename as Gt,dirname as Ut,join as h}from"path";var y=1,Bt=10*6e4,Vt=10080*6e4,j="requests",T="claims",$="completions",Je="staging";function Qe(e,t,n={}){let r=n.now?.()??new Date,o=Qt(n.ttlMs),i=Yt(n.idempotencyKey),s=i?`key-${Nt("sha256").update(i).digest("hex")}`:`request-${(n.randomId??le)()}`,c={version:y,requestId:s,...i?{idempotencyKey:i}:{},createdAt:r.toISOString(),deadlineAt:new Date(r.getTime()+o).toISOString(),detail:t.trim().slice(0,2048)||"stale index observed by a command"},a=tt(e,s),d=he(e,a,c,n.onStage);if(d.published)return{disposition:"accepted",request:c,achievedDurability:d.achievedDurability,directorySync:d.directorySync};let p=pe(a);if(!p)throw new Error(`Watch refresh request identity ${s} exists but is malformed.`);return{disposition:"duplicate",request:p}}function er(e,t={}){let n=t.now?.()??new Date,r=`claim-${(t.randomId??le)()}`,o=Math.max(1,Math.floor(t.limit??64)),i=Xe(e).sort(zt),s=[];for(let c of i){if(s.length>=o)break;if(Ke(e,c.requestId))continue;if(Date.parse(c.deadlineAt)<=n.getTime()){ze(e,{version:y,requestId:c.requestId,outcome:"expired",completedAt:n.toISOString()});continue}let a={version:y,requestId:c.requestId,claimId:r,claimedAt:n.toISOString()};if(he(e,nt(e,c.requestId),a).published){if(Ke(e,c.requestId)){Ze(e,c.requestId,r);continue}s.push(c)}}return{claimId:r,requests:s}}function tr(e,t,n=()=>new Date,r){let o=n().toISOString();for(let i of t.requests)ze(e,{version:y,requestId:i.requestId,claimId:t.claimId,outcome:"completed",completedAt:o});r?.("after-completion"),Kt(e,t),r?.("after-claim-release")}function Kt(e,t){for(let n of t.requests)Ze(e,n.requestId,t.claimId)}function nr(e){let t=0;for(let n of R(h(e,T)))w(n,{force:!0}),t++;return t>0&&b(h(e,T)),et(e),t}function rr(e){let t=Xe(e),n=new Map,r=Jt(h(e,j),pe);for(let a of R(h(e,$))){let d=F(a);if(!d){r++;continue}n.set(d.requestId,d)}let o=new Set;for(let a of R(h(e,T))){let d=Ye(a);if(!d){r++;continue}o.add(d.requestId)}let i=t.filter(a=>!n.has(a.requestId)&&!o.has(a.requestId)),s=[...n.values()].filter(a=>a.outcome==="completed").length,c=[...n.values()].filter(a=>a.outcome==="expired").length;return{pending:i.length,claimed:t.filter(a=>!n.has(a.requestId)&&o.has(a.requestId)).length,completed:s,expired:c,invalid:r,...i.length>0?{oldestPendingAt:i.map(a=>a.createdAt).reduce((a,d)=>Xt(a,d))}:{}}}function or(e,t={}){let n=(t.now?.()??new Date).getTime(),r=Math.max(0,t.retentionMs??Vt),o=0;for(let i of R(h(e,$))){let s=F(i);!s||n-Date.parse(s.completedAt)<r||(w(i,{force:!0}),w(tt(e,s.requestId),{force:!0}),o++)}return o>0&&(b(h(e,$)),b(h(e,j))),et(e),o}function pe(e){return fe(e,t=>{let n=t;return n.version===y&&H(n.requestId)&&(n.idempotencyKey===void 0||typeof n.idempotencyKey=="string")&&E(n.createdAt)&&E(n.deadlineAt)&&Date.parse(n.deadlineAt)>=Date.parse(n.createdAt)&&typeof n.detail=="string"&&n.detail.length>0})}function Ye(e){return fe(e,t=>{let n=t;return n.version===y&&H(n.requestId)&&H(n.claimId)&&E(n.claimedAt)})}function F(e){return fe(e,t=>{let n=t;return n.version===y&&H(n.requestId)&&(n.claimId===void 0||H(n.claimId))&&(n.outcome==="completed"||n.outcome==="expired")&&E(n.completedAt)})}function ze(e,t){let n=rt(e,t.requestId);if(he(e,n,t).published)return;let r=F(n);if(!r||r.requestId!==t.requestId||r.outcome!==t.outcome)throw new Error(`Watch refresh completion ${t.requestId} conflicts with an existing record.`)}function he(e,t,n,r){let o=h(e,Je),i=Ut(t),s=ee(o),c=ee(i),a=h(o,`${Gt(t)}.${process.pid}.${le()}.tmp`);try{let d=D(a,n,{spacing:2,trailingNewline:!0});r?.("after-staged");try{jt(a,t)}catch(l){if(l.code==="EEXIST")return{published:!1};throw l}let p=Ce(s,c,d.directorySync,b(i));return r?.("after-published"),{published:!0,achievedDurability:p==="synced"?"directory-durable":"file-flushed",directorySync:p}}finally{w(a,{force:!0})}}function Xe(e){let t=[];for(let n of R(h(e,j))){let r=pe(n);r&&t.push(r)}return t}function Ze(e,t,n){let r=nt(e,t),o=Ye(r);!o||o.claimId!==n||(w(r,{force:!0}),b(h(e,T)))}function et(e){for(let t of R(h(e,Je),".tmp"))w(t,{force:!0})}function Jt(e,t){return R(e).filter(n=>!t(n)).length}function R(e,t=".json"){return $t(e)?Ft(e,{withFileTypes:!0}).filter(n=>n.isFile()&&n.name.endsWith(t)).map(n=>h(e,n.name)).sort():[]}function fe(e,t){try{let n=JSON.parse(f(e,"watch refresh request record"));return t(n)?n:null}catch{return null}}function tt(e,t){return h(e,j,`${t}.json`)}function nt(e,t){return h(e,T,`${t}.json`)}function rt(e,t){return h(e,$,`${t}.json`)}function Ke(e,t){return F(rt(e,t))!==null}function Qt(e){if(e===void 0)return Bt;if(!Number.isFinite(e)||e<=0)throw new Error("Watch refresh request ttlMs must be positive.");return Math.floor(e)}function Yt(e){let t=e?.trim();return t?t.slice(0,512):void 0}function H(e){return typeof e=="string"&&/^[a-z0-9][a-z0-9-]{0,127}$/i.test(e)}function zt(e,t){return Date.parse(e.createdAt)-Date.parse(t.createdAt)||e.requestId.localeCompare(t.requestId)}function Xt(e,t){return Date.parse(t)<Date.parse(e)?t:e}var it=5e3,rn=6e3,on=1e3,me=10,sn=new Set(["capabilities","check-deps","config-validate","doctor","init","install-skills","reindex","setup","setup-agent","status","suppress","uninstall","watch"]);function xr(e){let t=e.classification;if(t.kind!=="live")return;let{state:n}=t;return n.watcher.state==="idle"&&n.lastError===void 0?n.indexGeneration:void 0}function cn(e,t=process.env){return t.CODEBASEIQ_SKIP_WATCH_SERVICE!=="1"&&!Te(t)&&!e.startsWith("__")&&!sn.has(e)}function Er(e){let t=e.env??process.env;if(t.CODEBASEIQ_SKIP_WATCH_SERVICE==="1")return{kind:"skipped",reason:"environment"};if(!cn(e.commandName,t))return{kind:"skipped",reason:"excluded-command"};if(e.config.watch?.enabled!==!0)return{kind:"skipped",reason:"disabled"};try{let n=an({projectRoot:e.projectRoot,cacheDir:e.cacheDir,cliVersion:e.cliVersion,gitContext:e.gitContext,runtime:e.runtime});return{kind:n.disposition,state:n.state}}catch(n){return{kind:"failed",message:n instanceof Error?n.message:String(n)}}}function at(e,t,n){let r=v(V(e));if(n&&v(n.projectRoot)===r)return{projectRoot:r,worktreeKind:"git",worktreeId:n.worktreeId,cliVersion:t};let o=qe(r);if(o.kind==="error")throw new Error(`Could not establish Git worktree identity for ${r}: ${o.message}`);return o.kind==="non-git"?{projectRoot:r,worktreeKind:"non-git",cliVersion:t}:{projectRoot:r,worktreeKind:"git",worktreeId:o.identity.worktreeId,cliVersion:t}}function Ir(e){return U(e,at(e.projectRoot,e.cliVersion,e.gitContext))}function U(e,t){let n=e.runtime??ye,r=I(e.cacheDir),o=M(r.statePath),i=ve(r.lockPath);return{identity:t,classification:dn(o,t,n.now(),n.isProcessAlive),lock:i,lockIsLive:i!==null&&n.isProcessAlive(i.pid),paths:r}}function an(e){let t=e.runtime??ye,n=at(e.projectRoot,e.cliVersion,e.gitContext),r=U(e,n),o=ke("ensure",r.classification);if(o.kind==="reuse")return G(r.paths.activityPath,t),{disposition:"reused",state:o.state};if(o.kind==="refuse-replace")throw new Error(`codebaseiq watch service pid ${o.state.pid} is still alive but its heartbeat is old. Refusing automatic replacement because civil-clock age alone cannot authorize a process signal.`);if(o.kind==="replace")Se(o.state,e,t),P(r.paths,o.state.pid,t);else if(o.kind==="start"){if(r.lockIsLive){let c=st(e,n,t,Math.min(e.startupTimeoutMs??1e3,1e3));if(c)return G(r.paths.activityPath,t),{disposition:"reused",state:c};throw new Error(`codebaseiq watch is already running for ${V(e.projectRoot)} (pid ${r.lock?.pid}; lock: ${r.paths.lockPath}) without compatible daemon state. Stop the foreground watcher before starting the service.`)}r.classification.kind==="stale"&&P(r.paths,r.classification.state.pid,t)}else throw new Error(`Unexpected ensure action: ${o.kind}`);if(r=U(e,n),o=ke("ensure",r.classification),o.kind==="reuse")return G(r.paths.activityPath,t),{disposition:"reused",state:o.state};if(o.kind==="refuse-replace")throw new Error(`codebaseiq watch service pid ${o.state.pid} remains alive with an old heartbeat; automatic replacement is not authorized.`);let i=e.serverPath??nn(new URL("./watch-server.js",import.meta.url));t.spawnServer(i,n.projectRoot,e.cliVersion,e.watchOverrides??{},e.spawnEnv);let s=st(e,n,t,e.startupTimeoutMs??it);if(!s)throw new Error(`codebaseiq watch service did not become ready within ${e.startupTimeoutMs??it}ms.`);return G(r.paths.activityPath,t),{disposition:"started",state:s}}function Wr(e){let t=e.runtime??ye,n=I(e.cacheDir),r=M(n.statePath),o=r?t.isProcessAlive(r.pid)?{kind:"live",state:r}:{kind:"stale",state:r,reason:"dead-process"}:{kind:"stopped"},i=ke("stop",o);if(i.kind==="signal-stop")return Se(i.state,e,t),P(n,i.state.pid,t),{disposition:"stopped",pid:i.state.pid};if(i.kind==="clean-stale")return P(n,i.state.pid,t),{disposition:"stopped",pid:i.state.pid};let s=ve(n.lockPath);return i.kind==="already-stopped"&&s&&t.isProcessAlive(s.pid)?(Se(s,e,t),P(n,s.pid,t),{disposition:"stopped",pid:s.pid}):{disposition:"already-stopped"}}function Cr(e,t,n={}){let{durability:r="durable",...o}=n;r==="durable"?D(e,t,o):ce(e,t,o)}function dt(e,t=Date.now()){ce(e,{version:1,at:new Date(t).toISOString()})}function Tr(e,t,n=Date.now(),r={}){Qe(I(tn(e)).refreshRequestsPath,t,{...r,now:()=>new Date(n)}),dt(e,n)}function Hr(e){try{let t=JSON.parse(f(e,"watch activity record"));return t.version!==1||!L(t.at)||t.refreshRequestedAt!==void 0&&!L(t.refreshRequestedAt)||t.refreshDetail!==void 0&&typeof t.refreshDetail!="string"?null:{atMs:Date.parse(t.at),...t.refreshRequestedAt===void 0?{}:{refreshRequestedAtMs:Date.parse(t.refreshRequestedAt)},...t.refreshDetail===void 0?{}:{refreshDetail:t.refreshDetail}}}catch{return null}}function Pr(e,t,n={}){let r=n.pid??process.pid,o=n.isProcessAlive??re,i=()=>{},s=n.readProcessIdentity??ne,c=n.now??(()=>new Date),a={...ie,wallNow:()=>c().getTime(),isProcessAlive:o,readProcessIdentity:s},d=Oe(e,{kind:"watch",pid:r,processIdentity:s(r),detail:{projectRoot:V(t)},parseLegacy:B,runtime:a});if(d.kind==="contended"){let p=ut(d.observation);return{acquired:!1,lockPath:e,message:un(e,t,p),release:i}}return{acquired:!0,lockPath:e,message:"",release:()=>{d.lock.release()}}}function ve(e){return ut(se(e,{parseLegacy:B}))}var B=e=>{let t=lt(e);return t?{pid:t.pid,...t.processIdentity?{processIdentity:t.processIdentity}:{}}:null};function ut(e){if(e.state==="valid"&&e.record?.kind==="watch"){let t=e.record.detail?.projectRoot;return typeof t!="string"?null:{version:1,pid:e.record.pid,...e.record.processIdentity?{processIdentity:e.record.processIdentity}:{},projectRoot:t,startedAt:e.record.startedAt}}return lt(e.parsed)}function lt(e){try{let t=e;if(t.version!==1||typeof t.pid!="number"||!Number.isInteger(t.pid)||t.pid<=0||typeof t.projectRoot!="string"||!L(t.startedAt))return null;let n=t.processIdentity===void 0?null:Pe(t.processIdentity);return t.processIdentity!==void 0&&(!n||n.pid!==t.pid)?null:{version:1,pid:t.pid,...n?{processIdentity:n}:{},projectRoot:t.projectRoot,startedAt:t.startedAt}}catch{return null}}function dn(e,t,n,r){if(!e)return{kind:"stopped"};if(e.protocolVersion!==ae)return{kind:"incompatible",state:e,reason:"protocol"};if(e.projectRoot!==t.projectRoot)return{kind:"incompatible",state:e,reason:"project"};let o=t.worktreeKind==="git"?t.worktreeId:void 0;if(e.worktreeId!==o)return{kind:"incompatible",state:e,reason:"worktree"};if(e.cliVersion!==t.cliVersion)return{kind:"incompatible",state:e,reason:"cli-version"};if(!r(e.pid))return{kind:"stale",state:e,reason:"dead-process"};let i=Date.parse(e.heartbeatAt);return n-i>de?{kind:"stale",state:e,reason:"old-heartbeat"}:{kind:"live",state:e}}function ke(e,t){switch(e){case"status":return{kind:"report",classification:t};case"ensure":switch(t.kind){case"stopped":return{kind:"start"};case"stale":return t.reason==="old-heartbeat"?{kind:"refuse-replace",state:t.state,reason:"old-heartbeat"}:{kind:"start"};case"live":return{kind:"reuse",state:t.state};case"incompatible":return{kind:"replace",state:t.state};default:return ge(t)}case"stop":switch(t.kind){case"stopped":return{kind:"already-stopped"};case"stale":return t.reason==="old-heartbeat"?{kind:"signal-stop",state:t.state}:{kind:"clean-stale",state:t.state};case"live":case"incompatible":return{kind:"signal-stop",state:t.state};default:return ge(t)}default:return ge(e)}}function qr(e){return e.idleTimeoutMs===0||e.watcher.state!=="idle"||(e.liveSessions??0)>0?!1:e.nowMs-e.lastActivityAtMs>=e.idleTimeoutMs}function st(e,t,n,r){let o=n.monotonicNow??O,i=o()+r;for(;o()<=i;){let s=U(e,t).classification;if(s.kind==="live")return s.state;n.sleep(me)}return null}function Se(e,t,n){let{pid:r}=e;if(!n.isProcessAlive(r))return;ct(e,n),n.signalProcess(r);let o=t.stopTimeoutMs??rn,i=n.monotonicNow??O,s=i()+o;for(;i()<=s;){if(!n.isProcessAlive(r))return;n.sleep(me)}if(!n.forceSignalProcess)throw new Error(`codebaseiq watch service pid ${r} did not stop within ${o}ms and forced termination is unavailable.`);ct(e,n),n.forceSignalProcess(r);let c=t.forceStopTimeoutMs??on,a=i()+c;for(;i()<=a;){if(!n.isProcessAlive(r))return;let d=n.readProcessIdentity(r);if(e.processIdentity&&d&&!te(e.processIdentity,d))return;n.sleep(me)}throw new Error(`codebaseiq watch service pid ${r} remained alive ${c}ms after forced termination.`)}function P(e,t,n){if(ot(e.statePath,{force:!0}),ot(e.activityPath,{force:!0}),ve(e.lockPath)?.pid===t&&!n.isProcessAlive(t)){let o={...ie,wallNow:n.now,isProcessAlive:n.isProcessAlive,readProcessIdentity:n.readProcessIdentity},i=se(e.lockPath,{parseLegacy:B,runtime:o});De(e.lockPath,i,{parseLegacy:B,runtime:o})}}function un(e,t,n){return`error: codebaseiq watch is already running for ${V(t)}${n?` (pid ${n.pid}, started ${n.startedAt}; lock: ${e})`:` (lock: ${e})`}. Stop that watcher before starting another.`}function G(e,t){try{(t.recordActivity??dt)(e,t.now())}catch(n){let r=ln(n);if(r!=="EPERM"&&r!=="EACCES"&&r!=="EROFS")throw n}}function ln(e){return e.code}var ye={now:Date.now,monotonicNow:O,isProcessAlive:re,readProcessIdentity:ne,spawnServer(e,t,n,r,o){if(!en(e))throw new Error(`Watch service helper was not found at ${e}. Run npm run build first.`);Zt(process.execPath,[e,t,n,JSON.stringify(r)],{detached:!0,stdio:"ignore",windowsHide:!0,env:{...process.env,...o,CODEBASEIQ_SKIP_WATCH_SERVICE:"1"}}).unref()},signalProcess(e){process.kill(e,"SIGTERM")},forceSignalProcess(e){process.kill(e,"SIGKILL")},sleep(e){let t=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(t,0,0,e)}};function ct(e,t){if(!e.processIdentity)throw new Error(`Refusing to signal codebaseiq watch pid ${e.pid}: its ownership record has no process identity.`);let n=t.readProcessIdentity(e.pid);if(!n)throw new Error(`Refusing to signal codebaseiq watch pid ${e.pid}: its process identity is unavailable.`);if(!te(e.processIdentity,n))throw new Error(`Refusing to signal codebaseiq watch pid ${e.pid}: its process identity does not match the ownership record.`)}function ge(e){throw new Error(`Unhandled watch service value: ${JSON.stringify(e)}`)}import{existsSync as g,mkdirSync as pn,rmdirSync as hn,unlinkSync as fn}from"fs";import{homedir as gn}from"os";import{basename as St,dirname as Y,isAbsolute as mn,join as u,resolve as be}from"path";import{fileURLToPath as kn}from"url";var m="<!-- codebaseiq:agent-setup:begin -->",A="<!-- codebaseiq:agent-setup:end -->",Sn="# codebaseiq:agent-setup",z=[".codex/hooks.json",".claude/settings.local.json"],pt="# codebaseiq:local-agent-hooks:begin",ht="# codebaseiq:local-agent-hooks:end",we="hook-architecture-stop",vt=["claude","codex"],q={claude:".claude/settings.local.json",codex:".codex/hooks.json"},yt="sentinel-hook.mjs",vn=u("dist","sentinel-hook.js"),yn=u("dist","cli.js"),Rn="cli-path",bn="installed-projects.json";function Yr(e){let t=e.written.length+e.unchanged.length,n=e.skipped.length;return{verdict:n===0?"ready":t===0?"blocked":"partial",ready:t,skipped:n}}function zr(e,t={}){let n={written:[],unchanged:[],skipped:[]};return wn(e,n),t.architectureHook!==!1&&En(e,n,t.architectureHook),n}function Xr(e,t={}){let n={removed:[],unchanged:[],skipped:[]};return gt(e,"AGENTS.md",t,n),gt(e,"CLAUDE.md",t,n),bt(e,t,n,r=>Pt(Cn(r))),Ht(e,t,n),xn(e,t,n),n}function wn(e,t){let n=[m,"## codebaseiq","","This repository uses codebaseiq as its primary code exploration surface. Use it for repository exploration, including literal search and exact source reads; native tools are for applying edits, running checks, binary content, or a specific unsupported gap that codebaseiq has explicitly reported\u2014not a parallel exploration workflow.","","The agent decides what repository fact it needs; codebaseiq locates exact referents and reports typed evidence without guessing task relevance. Load the installed `codebaseiq` skill before exploring and `codebaseiq-explore` for an end-to-end explanation; they hold the operating rules.","","| Question | Command |","| --- | --- |","| Who references this symbol? | `codebaseiq refs <symbol>` |","| Who calls it, and what does it call? | `codebaseiq call-graph <symbol>` |","| What may break if it changes? | `codebaseiq affected <symbol>` |","| Where does this value come from or go? | `codebaseiq value-flow <symbol>` |","| What does this file import, and who imports a symbol? | `codebaseiq imports <file>`, `codebaseiq imported-by <symbol>` |","| Where does this exact text occur? | `codebaseiq search <exact-text>` (insert `--` before a literal that starts with a dash) |","| What is in this file? | `codebaseiq outline <file>` |","| What is the exact source? | `codebaseiq code <selectors...>` |","| What is the connected behavior at these points? | `codebaseiq inspect --symbol <symbol> --at <file:line> --view behavior` |","","- `codebaseiq evidence --symbol <symbol> --edge <family> --direction incoming|outgoing|both` combines relationship families or batches several roots (`--symbol`, `--at`, and `--search` repeat). `--edge` and `--direction` are required; `--depth` defaults to 2 and `--max-edges` to 32. Families: execution, runtime, dataflow, state, temporal, contract, identity, ownership, dependencies.","- Read coverage before claiming an absence: `bounded` or `incomplete` output is not evidence that no caller, branch, or consumer exists. Run the printed recovery command, or add `--full` when complete coverage can change the decision.","- After a nontrivial edit, run `codebaseiq diff-impact`. Use `codebaseiq architecture` for declared structural rules and `codebaseiq health` for cleanup candidates.","- If output emits `Continue exactly:`, run that command unchanged until transport is complete.","- Sandbox cannot write the cache? Set `CODEBASEIQ_READ_ONLY=1` to query the existing index read-only.","- Commit relevant `.codebaseiq/suppressions/*.json` records with the change; do not commit local agent-tool settings. When architecture rules are configured and clean, setup installs a checkout-local Stop hook that checks architecture after indexed source changes.",A].join(`
|
|
2
|
+
`);ft(e,"AGENTS.md",n,t);let r=[m,"@AGENTS.md",A].join(`
|
|
3
|
+
`);ft(e,"CLAUDE.md",r,t,o=>o.includes("@AGENTS.md")&&!o.includes(m))}function ft(e,t,n,r,o){let i=u(e,t),s=!1,c=Ae(i,t,r,a=>{if(o?.(a.text))return s=!0,{kind:"unchanged"};let d=An(a.text,n);return d===a.text?{kind:"unchanged"}:{kind:"write",text:d,...a.revision.exists?{}:{mode:420}}});c&&(!c.changed||s?r.unchanged.push(t):r.written.push(t))}function gt(e,t,n,r){let o=u(e,t);if(n.dryRun){if(!g(o)){r.unchanged.push(t);return}try{let s=f(o,"agent instruction file");s.includes(m)?(mt(s),r.removed.push(t)):r.unchanged.push(t)}catch(s){r.skipped.push({target:t,reason:s instanceof Error?s.message:String(s)})}return}let i=Ae(o,t,r,s=>{if(!s.revision.exists||!s.text.includes(m))return{kind:"unchanged"};let c=mt(s.text);return c.length===0?{kind:"delete"}:{kind:"write",text:c}});i&&(i.changed?r.removed.push(t):r.unchanged.push(t))}function An(e,t){if(Rt(e)==="present"){let r=new RegExp(`${m}[\\s\\S]*?${A}`);return e.replace(r,t)}return e.length>0?`${e.replace(/\n*$/,`
|
|
4
|
+
|
|
5
|
+
`)}${t}
|
|
6
|
+
`:`${t}
|
|
7
|
+
`}function mt(e){Rt(e);let t=new RegExp(`${m}[\\s\\S]*?${A}`),n=e.replace(t,"").replace(/\n{3,}/g,`
|
|
8
|
+
|
|
9
|
+
`).trim();return n.length===0?"":`${n}
|
|
10
|
+
`}function Rt(e){let t=e.split(m).length-1,n=e.split(A).length-1;if(t===0&&n===0)return"absent";if(t===1&&n===1&&e.indexOf(m)<e.indexOf(A))return"present";throw new Error("managed codebaseiq markers are incomplete, duplicated, or out of order")}function Ae(e,t,n,r){try{return C(e,r,{maxRetries:0})}catch(o){n.skipped.push({target:t,reason:o instanceof Error?o.message:String(o)});return}}function xn(e,t,n){let r=".git/hooks/pre-commit",o=u(e,r);if(!g(o)){n.unchanged.push(r);return}if(!f(o,"pre-commit hook").includes(Sn)){n.skipped.push({target:r,reason:"pre-commit hook is not managed by codebaseiq"});return}if(t.dryRun){n.removed.push(r);return}Ae(o,r,n,()=>({kind:"delete"}))?.changed&&n.removed.push(r)}function En(e,t,n={}){let r=(n.inspectReadiness??In)(e);if(r.state==="not-configured")return;if(r.state==="blocked"){t.skipped.push({target:"architecture Stop hook",reason:r.reason});return}let o=n.commandPrefix??"codebaseiq";for(let i of z){if(N(e,i)){t.skipped.push({target:i,reason:"tracked repository config; the checkout-local hook installer will not modify it"});continue}Ee(u(e,i),i,t,s=>Wn(s,o))}It(e,t)}function bt(e,t,n,r){for(let o of z){let i=u(e,o);if(g(i)){if(N(e,o)){n.skipped.push({target:o,reason:"tracked repository config; the checkout-local hook remover will not modify it"});continue}if(t.dryRun){try{let s=xt(i);JSON.stringify(r(s))!==JSON.stringify(s)&&n.removed.push(o)}catch(s){n.skipped.push({target:o,reason:S(s)})}continue}Ee(i,o,n,r,!0)}}}function In(e){let t=Fe(e);if(!t.architecture||t.architecture.boundaries.length===0)return{state:"not-configured"};let n=He(e,t),r=Ge(e,t,n);if(r.state!=="fresh")return{state:"blocked",reason:`the index is ${r.state}; refresh it before installing a persistent architecture grader`};let o;try{o=Ue(e);let i=Ve(Be(o));return i.length>0?{state:"blocked",reason:`the current architecture baseline has ${i.length} enforced violation(s); make the declared policy clean before installing the Stop hook`}:{state:"ready"}}catch(i){return{state:"blocked",reason:S(i)}}finally{o?.close()}}function Wn(e,t="codebaseiq"){let n=_(e.hooks),r=Array.isArray(n.Stop)?n.Stop:[],o={type:"command",command:`${t} ${we}`,timeout:120,statusMessage:"Checking architecture boundaries"};return{...e,hooks:{...n,Stop:wt(r,{hook:o},At)}}}function Zr(e,t){return e===we&&t.sentinel?.enabled===!0}function Cn(e){let t=_(e.hooks),n=Array.isArray(t.Stop)?t.Stop:[],r=Tn(n),o={...t};r.length>0?o.Stop=r:delete o.Stop;let i={...e};return Object.keys(o).length>0?i.hooks=o:delete i.hooks,i}function _(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function Tn(e){return e.map(t=>({...t,hooks:Array.isArray(t.hooks)?t.hooks.filter(n=>!At(n)):[]})).filter(t=>t.hooks.length>0)}function xe(e){return typeof e=="object"&&e!==null&&Array.isArray(e.hooks)}function wt(e,t,n){let r=!1,o=[];for(let i of e){if(!xe(i)||!i.hooks.some(n)){o.push(i);continue}let s=i.hooks.every(n),c=[],a=!1;for(let d of i.hooks)n(d)?r||(c.push(t.hook),r=!0,a=!0):c.push(d);c.length!==0&&o.push(a&&s?Hn({...i,hooks:c},t.matcher):{...i,hooks:c})}return r||o.push({...t.matcher!==void 0?{matcher:t.matcher}:{},hooks:[t.hook]}),o}function Hn(e,t){let{matcher:n,...r}=e;return t===void 0?r:{matcher:t,...r}}function At(e){if(!e||typeof e!="object")return!1;let t=e.command;return typeof t=="string"&&new RegExp(`(?:^|\\s)${we}$`,"u").test(t)}function Ee(e,t,n,r,o=!1){try{C(e,s=>{let c=s.revision.exists?Et(s.text,e):{},a=r(c);return JSON.stringify(a)===JSON.stringify(c)?{kind:"unchanged"}:o&&Object.keys(a).length===0?{kind:"delete"}:{kind:"write",text:`${JSON.stringify(a,null,2)}
|
|
11
|
+
`,mode:384}}).changed?"written"in n?n.written.push(t):n.removed.push(t):o||n.unchanged.push(t)}catch(i){n.skipped.push({target:t,reason:S(i)})}}function xt(e){return Et(f(e,"agent hook settings"),e)}function Et(e,t){let n=JSON.parse(e);if(!n||typeof n!="object"||Array.isArray(n))throw new Error(`Cannot update ${t}: the hook config is not a JSON object.`);return n}function It(e,t){let n=oe(e,["rev-parse","--git-path","info/exclude"]),r=n?_e(e,n):void 0;if(!r||!g(Y(r))){t.skipped.push({target:".git/info/exclude",reason:"Git metadata was not found; local hook files may appear as untracked"});return}let o=Pn(oe(e,["rev-parse","--show-prefix"])??"");try{C(r,i=>{let s=new RegExp(`${pt}([\\s\\S]*?)${ht}\\n?`,"gu"),c=[...i.text.matchAll(s)].flatMap(x=>x[1].split(`
|
|
12
|
+
`).filter(Lt=>Lt!=="")),a=i.text.replace(s,"").replace(/\n*$/u,""),d=[...z,je].map(x=>`/${o}${x}`),p=[pt,...new Set([...c,...d]),ht].join(`
|
|
13
|
+
`),l=`${a}${a?`
|
|
14
|
+
|
|
15
|
+
`:""}${p}
|
|
16
|
+
`;return l===i.text?{kind:"unchanged"}:{kind:"write",text:l,mode:420}})}catch(i){t.skipped.push({target:".git/info/exclude",reason:S(i)})}}function Pn(e){return e.replace(/[\\*?[]/gu,"\\$&")}function S(e){return e instanceof Error?e.message:String(e)}var Wt={claude:[{event:"SessionStart",timeout:5},{event:"UserPromptSubmit",timeout:5},{event:"PostToolUse",matcher:"Edit|Write|MultiEdit",timeout:15,async:!0},{event:"Stop",timeout:30},{event:"SessionEnd",timeout:2}],codex:[{event:"SessionStart",timeout:5},{event:"UserPromptSubmit",timeout:5},{event:"PostToolUse",matcher:"apply_patch|Edit|Write",timeout:15},{event:"Stop",timeout:30}]};function X(e){let t=u(e,"bin");return{directory:t,script:u(t,yt),version:u(t,"sentinel-hook.version"),manifest:u(t,"package.json"),cliPath:u(t,Rn)}}function Ct(e={}){let t=qn(e.packageRoot??Y(kn(import.meta.url)));if(!t)return{state:"skipped",reason:"the codebaseiq package root was not found"};let n=u(t.root,vn);if(!g(n))return{state:"skipped",reason:"build the package first (dist/sentinel-hook.js was not found)"};let r=X(e.cacheRoot??k());try{let o=`${JSON.stringify({name:"codebaseiq",version:t.version,private:!0},null,2)}
|
|
17
|
+
`,i=[K(r.script,Z(n,Tt("sentinel hook bundle"))),K(r.version,Buffer.from(`${t.version}
|
|
18
|
+
`)),K(r.manifest,Buffer.from(o)),K(r.cliPath,Buffer.from(`${be(t.root,yn)}
|
|
19
|
+
`))];return{state:"installed",script:r.script,version:t.version,changed:i.some(Boolean)}}catch(o){return{state:"skipped",reason:`the hook binary could not be installed: ${S(o)}`}}}function eo(e,t={}){let n=X(t.cacheRoot??k());if(!(Re(n.version,"sentinel hook version")===e&&g(n.cliPath)))return Ct(t)}function qn(e){let t=e;for(;;){try{let r=JSON.parse(f(u(t,"package.json"),"package manifest"));if(r.name==="codebaseiq"&&typeof r.version=="string")return{root:t,version:r.version}}catch{}let n=Y(t);if(n===t)return;t=n}}function Tt(e){return{maxBytes:We,inputKind:e}}function K(e,t){try{if(Z(e,Tt("sentinel hook file")).equals(t))return!1}catch{}return Me(e,t),!0}function to(e,t={}){let n=t.hosts??vt,r=t.cacheRoot??k(),o=Ct({packageRoot:t.packageRoot,cacheRoot:r}),i={written:[],unchanged:[],skipped:[],binary:o,notices:[]};if(o.state==="skipped")return i.skipped.push({target:"sentinel hook binary",reason:o.reason}),i;for(let c of n){let a=q[c];if(N(e,a)){i.skipped.push({target:a,reason:"tracked repository config; the checkout-local hook installer will not modify it"});continue}let d=[];Ee(u(e,a),a,i,p=>{let l=Dn(p,Mn(c,o.script,t.nodeExecutable));return d=_n(p,l),l}),c==="codex"&&d.length>0&&i.written.includes(a)&&i.notices.push(`Codex must re-approve the changed hooks (${d.join(", ")}): open Codex once in this project and approve them. The approval it recorded for the old command no longer applies, and codebaseiq can only see that an approval exists, not that it still matches.`)}if(It(e,i),n.map(c=>q[c]).some(c=>i.written.includes(c)||i.unchanged.includes(c)))try{Vn(r,e)}catch(c){i.skipped.push({target:"sentinel project registry",reason:S(c)})}return i}function _n(e,t){let n=o=>`${o.event}:${o.group}:${o.index}:${JSON.stringify(o.hook)}`,r=new Set(Q(t).map(n));return[...new Set(Q(e).filter(o=>!r.has(n(o))).map(o=>o.event))]}function On(e,t={}){let n={removed:[],unchanged:[],skipped:[]};return bt(e,t,n,Pt),Ht(e,t,n),n}function no(e={}){let t=e.cacheRoot??k(),n={removed:[],unchanged:[],skipped:[]};for(let o of Bn(t)){if(!g(o)){e.dryRun||Mt(t,o);continue}let i=On(o,{dryRun:e.dryRun,cacheRoot:t});n.removed.push(...i.removed.map(s=>u(o,s))),n.skipped.push(...i.skipped.map(s=>({...s,target:u(o,s.target)})))}let r=X(t);if(n.skipped.length>0)return g(r.script)&&n.skipped.push({target:r.script,reason:"kept: hooks that run it could not be removed from every project; run uninstall again once they can"}),n;for(let o of[r.script,r.version,r.manifest,r.cliPath])if(g(o)&&(n.removed.push(o),!e.dryRun))try{fn(o)}catch(i){n.skipped.push({target:o,reason:S(i)})}if(!e.dryRun)try{hn(r.directory)}catch{}return n}function Ht(e,t,n){let r=z;if(!(t.dryRun||n.skipped.some(o=>r.includes(o.target))))try{Mt(t.cacheRoot??k(),e)}catch(o){n.skipped.push({target:"sentinel project registry",reason:S(o)})}}function J(e){if(!e||typeof e!="object")return!1;let{command:t,args:n}=e;return Array.isArray(n)&&n.includes(W)?!0:typeof t=="string"&&t.split(/\s+/u).includes(W)}function Dn(e,t){let n={..._(e.hooks)};for(let{event:r,...o}of t){let i=n[r];n[r]=wt(Array.isArray(i)?i:[],o,J)}return{...e,hooks:n}}function Pt(e){let t=_(e.hooks),n={},r=!1;for(let[i,s]of Object.entries(t)){if(!Array.isArray(s)){n[i]=s;continue}let c=[];for(let a of s){if(!xe(a)||!a.hooks.some(J)){c.push(a);continue}r=!0;let d=a.hooks.filter(p=>!J(p));d.length>0&&c.push({...a,hooks:d})}(c.length>0||s.length===0)&&(n[i]=c)}if(!r)return e;let o={...e};return Object.keys(n).length>0?o.hooks=n:delete o.hooks,o}function Mn(e,t,n=process.execPath){return Wt[e].map(r=>({event:r.event,...r.matcher!==void 0?{matcher:r.matcher}:{},hook:e==="claude"?Ln(t,r):Nn(t,r,n)}))}function Ln(e,t){return{type:"command",command:"node",args:[e,"--host","claude",...t.async?["--async"]:[],W],...t.async?{async:!0,asyncRewake:!0}:{},timeout:t.timeout}}function Nn(e,t,n){let r=mn(n)&&/^node(?:\.exe)?$/iu.test(St(n))?n:"node";return{type:"command",command:`${process.platform==="win32"?"& ":""}${kt(r)} ${kt(e)} --host codex ${W}`,timeout:t.timeout}}function kt(e){if((process.platform==="win32"?/["\r\n%$`]/u:/["\r\n$`]/u).test(e))throw new Error(`${JSON.stringify(e)} cannot be quoted in a Codex hook command`);return`"${e}"`}function Q(e){let t=[];for(let[n,r]of Object.entries(_(e.hooks)))Array.isArray(r)&&r.forEach((o,i)=>{xe(o)&&o.hooks.forEach((s,c)=>{J(s)&&t.push({event:n,group:i,index:c,hook:s})})});return t}function qt(e){if(g(e))try{return xt(e)}catch{return}}function ro(e,t={}){let n=X(t.cacheRoot??k()),r=Re(n.version,"sentinel hook version"),o=Re(n.cliPath,"sentinel hook CLI path");return{binary:{script:n.script,present:g(n.script),...r?{version:r}:{},...o?{cliTarget:o}:{}},hosts:vt.map(i=>{let s=q[i],c=qt(u(e,s)),a=c?Q(c):[],d=Wt[i].map(l=>l.event),p=new Set(a.map(l=>l.event));return{host:i,file:s,events:d.filter(l=>p.has(l)),missing:d.filter(l=>!p.has(l)),scripts:[...new Set(a.flatMap(l=>$n(l.hook)))]}})}}function Re(e,t){try{return f(e,t).trim()||void 0}catch{return}}function $n(e){return(Array.isArray(e.args)?e.args.filter(n=>typeof n=="string"):[...e.command.matchAll(/"([^"]*)"|(\S+)/gu)].map(n=>n[1]??n[2]??"")).filter(n=>St(n)===yt)}function oo(e,t={}){let n=u(e,q.codex),r=qt(n),o=r?Q(r):[];if(o.length===0)return;let i=u(t.codexHome??process.env.CODEX_HOME??u(gn(),".codex"),"config.toml"),s=Gn(i),c=[...new Set([n,u(v(e),q.codex)])];return{configPath:i,hooks:o.map(({event:a,group:d,index:p})=>{let l=`:${Un(a)}:${d}:${p}`;return{event:a,key:`${n}${l}`,trusted:c.some(x=>s.has(_t(`${x}${l}`)))}})}}var jn=/^\s*\[hooks\.state\.(?:'([^']*)'|"((?:[^"\\]|\\.)*)")\]\s*(?:#.*)?$/u,Fn=/^\s*trusted_hash\s*=\s*"sha256:[0-9a-f]+"/u;function Gn(e){let t=new Set,n;try{n=f(e,"Codex config")}catch{return t}let r;for(let o of n.split(/\r?\n/u)){let i=jn.exec(o);i?r=_t(i[1]??(i[2]??"").replace(/\\(["\\])/gu,"$1")):/^\s*\[/u.test(o)?r=void 0:r!==void 0&&Fn.test(o)&&t.add(r)}return t}function Un(e){return e.replace(/([a-z])([A-Z])/gu,"$1_$2").toLowerCase()}function _t(e){return process.platform==="win32"?e.replaceAll("/","\\").toLowerCase():e}function io(e){let t={...$e.delivery};try{let n=JSON.parse(f(u(e,ue,Le),"sentinel settings")).delivery;for(let r of Ne){let o=n?.[r];(o==="shadow"||o==="live")&&(t[r]=o)}}catch{}return t}function Ie(e){return u(e,ue,bn)}function Bn(e=k()){try{return Ot(f(Ie(e),"sentinel project registry"))}catch{return[]}}function Ot(e){try{let{projects:t}=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function Dt(e,t){let n=Ie(e);pn(Y(n),{recursive:!0}),C(n,r=>{let o=t(r.revision.exists?Ot(r.text):[]);return o===void 0?{kind:"unchanged"}:{kind:"write",text:`${JSON.stringify({projects:o},null,2)}
|
|
20
|
+
`,mode:384}})}function Vn(e,t){let n=v(be(t));Dt(e,r=>r.includes(n)?void 0:[...r,n].sort())}function Mt(e,t){if(!g(Ie(e)))return;let n=v(be(t));Dt(e,r=>r.includes(n)?r.filter(o=>o!==n):void 0)}export{Qe as a,er as b,tr as c,Kt as d,nr as e,rr as f,or as g,xr as h,cn as i,Er as j,at as k,Ir as l,an as m,Wr as n,Cr as o,Tr as p,Hr as q,Pr as r,qr as s,Yr as t,zr as u,Xr as v,Zr as w,It as x,eo as y,to as z,On as A,no as B,ro as C,oo as D,io as E};
|
|
21
|
+
//# sourceMappingURL=chunk-CABIZQXQ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b}from"./chunk-MJX2J5QE.js";import{m as d,y as f}from"./chunk-TNLOX4TN.js";function S(a,g){let p=b(a,g),i=f(a,p,{sort:!0});if(i.length===0)return[];let o=i.map(e=>({symbol:e.symbol,shortName:e.shortName,startLine:e.startLine,endLine:e.endLine,signature:e.signature,children:[]})),s=new Map;for(let e of o)s.set(e.symbol,e);let c=[];for(let e=0;e<i.length;e++){let r=i[e],n=o[e];if(r.enclosingSymbol&&s.has(r.enclosingSymbol)){s.get(r.enclosingSymbol).children.push(n);continue}let l=null,m=1/0;for(let t of o)if(t!==n&&t.startLine<=n.startLine&&t.endLine>=n.endLine){if(t.startLine===n.startLine&&t.endLine===n.endLine&&!d(t.symbol,n.symbol))continue;let u=t.endLine-t.startLine;u<m&&(m=u,l=t)}l?l.children.push(n):c.push(n)}return c}export{S as a};
|
|
2
|
+
//# sourceMappingURL=chunk-CAH322MC.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as P,d as w}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as P,d as w}from"./chunk-JOYASZRF.js";import{b as g,c as T}from"./chunk-2ZBZRYX4.js";import{t as v,v as b,w as d}from"./chunk-G3KRXNNT.js";import{h as M}from"./chunk-ZJNV27DZ.js";import{d as f}from"./chunk-E7T22WET.js";import{w as l}from"./chunk-3F23W57G.js";import{a as y,e as c}from"./chunk-OZI44VCR.js";import{o as h,p as S}from"./chunk-C3PPB2T5.js";import{randomUUID as A}from"crypto";import{resolve as q}from"path";var E=class{projectRoot;currentGeneration;createEmitter;wallNow;monotonicNow;active=new Map;requests=0;sessionsCreated=0;sessionsReplaced=0;lastRequestAtMs=null;lastDurationMs=null;lastError=null;unavailable=!1;constructor(e){this.projectRoot=q(e.projectRoot),this.currentGeneration=e.currentGeneration,this.createEmitter=e.createEmitter??g,this.wallNow=e.wallNow??e.now??Date.now,this.monotonicNow=e.monotonicNow??e.now??y}handle(e,t){let r=this.monotonicNow();try{if(this.currentGeneration()!==e)throw new Error("TypeScript index request does not match the currently published generation.");let s=this.emitterFor(t);if(s.emitter.producerIdentity!==t.producerIdentity)throw new Error("TypeScript index producer identity changed.");let o=s.emitter.snapshotStats(),a=s.emitter.advance({modifiedFiles:t.modifiedFiles,affectedFiles:t.affectedFiles}),m=this.monotonicNow()-r;return this.requests+=1,this.lastRequestAtMs=this.wallNow(),this.lastDurationMs=m,this.lastError=null,this.unavailable=!1,{producerIdentity:a.producerIdentity,cold:a.stats.initializations>o.initializations,durationMs:m,fragments:a.fragments.map(n=>({relativePath:n.relativePath,bytesBase64:n.bytes===null?null:Buffer.from(n.bytes).toString("base64"),occurrences:n.occurrences,symbols:n.symbols,referenceFragments:n.referenceFragments}))}}catch(s){throw this.lastError=s instanceof Error?s.message:String(s),s}}status(e){let t=[...this.active.values()].map(s=>s.emitter.snapshotStats()),r=s=>t.reduce((o,a)=>o+a[s],0);return{protocolVersion:T,state:this.unavailable?"unavailable":this.lastError?"error":this.active.size>0?"ready":"idle",requests:this.requests,sessionsCreated:this.sessionsCreated,sessionsReplaced:this.sessionsReplaced,initializations:r("initializations"),programUpdates:r("programUpdates"),documentsEmitted:r("documentsEmitted"),documentsRemoved:r("documentsRemoved"),...this.lastRequestAtMs===null?{}:{lastRequestAt:new Date(this.lastRequestAtMs).toISOString()},...this.lastDurationMs===null?{}:{lastDurationMs:this.lastDurationMs},...this.lastError?{lastError:this.lastError}:{},...e?{mailbox:e}:{}}}close(){this.active.clear()}emitterFor(e){let t=`${e.tsconfigPath}\0${e.projectArgument}`,r=this.active.get(t);if(r?.projectIdentity===e.projectIdentity)return r;let s=this.createEmitter({workspaceRoot:this.projectRoot,tsconfigPath:e.tsconfigPath,projectRoot:e.projectArgument});if(!s.available)throw this.unavailable=!0,new Error(s.reason);r&&(this.sessionsReplaced+=1);let o={projectIdentity:e.projectIdentity,emitter:s.emitter};return this.active.set(t,o),this.sessionsCreated+=1,o}};function Q(i){l(i)}var Z=`typescript-index-${process.pid}-${A()}`,I=c(process.pid),ee={pid:process.pid,...I?{processIdentity:I}:{}};import{randomUUID as _}from"crypto";import{resolve as R}from"path";var p=class{loadModule;discoverTsconfigs;createProjects;createProvider;db;module=null;projects=null;provider=null;stats={providerRequests:0,sessionsCreated:0,sessionsReused:0,sessionsRefreshed:0,sessionsReplaced:0,projectsCreated:0};constructor(e,t={}){this.db=e,this.loadModule=t.loadModule??v,this.discoverTsconfigs=t.discoverTsconfigs??P,this.createProjects=t.createProjects??b,this.createProvider=t.createProvider??((r,s,o)=>w(r,s,o,{reusedProjects:!0}))}semanticProvider(){return this.stats.providerRequests+=1,this.provider?(this.stats.sessionsReused+=1,this.provider):this.createSession()}advanceGeneration(e,t){let r=O(t);return this.provider?.dispose?.(),this.provider=null,this.db=e,this.projects?r.mode==="replace"?(this.projects=null,this.module=null,this.stats.sessionsReplaced+=1,r):(r.mode==="refresh"&&(B(this.projects,e.config.projectRoot,r),this.stats.sessionsRefreshed+=1),r):r}snapshotStats(){return{...this.stats}}dispose(){this.provider?.dispose?.(),this.provider=null,this.projects=null,this.module=null}createSession(){let e=this.module??this.loadModule();if(!e)return this.provider=d("ts-morph is not installed"),this.provider;if(this.module=e,!this.projects){let t=this.discoverTsconfigs(this.db);if(t.length===0)return this.provider=d("no tsconfig found"),this.provider;this.projects=this.createProjects(e,t),this.stats.projectsCreated+=this.projects.length}return this.provider=this.createProvider(this.db,e,this.projects),this.stats.sessionsCreated+=1,this.provider}};function O(i){let e=new Set;i.projectIdentityChanged&&e.add("project-identity-changed");for(let o of i.uncertainty)e.add(o);for(let o of i.changes)o.inputKind!=="source"&&e.add(`${o.inputKind}-input-changed`);if(e.size>0)return{mode:"replace",addedFiles:[],modifiedFiles:[],deletedFiles:[],reasons:[...e].sort()};let t=u(i.changes,"added"),r=u(i.changes,"modified"),s=u(i.changes,"deleted");return{mode:t.length+r.length+s.length===0?"reuse":"refresh",addedFiles:t,modifiedFiles:r,deletedFiles:s,reasons:[]}}function u(i,e){return i.filter(t=>t.kind===e).map(t=>t.path).sort()}function B(i,e,t){for(let r of i){for(let s of t.deletedFiles)r.project.getSourceFile(R(e,s))?.forget();for(let s of t.modifiedFiles){let o=r.project.getSourceFile(R(e,s));o&&o.refreshFromFileSystemSync()}t.addedFiles.length>0&&r.project.addSourceFilesFromTsConfig(r.tsconfigPath)}}var j=class{openDb;createHost;generationIdentity;readSnapshot;now;db=null;host=null;generation=null;snapshot=null;requests=0;lastRequestAtMs=null;lastError=null;available=null;constructor(e){this.openDb=e.openDb,this.createHost=e.createHost??(t=>new p(t)),this.generationIdentity=e.generationIdentity?t=>e.generationIdentity(t.config.dbPath):t=>t.generation.identity,this.readSnapshot=e.readSnapshot?t=>e.readSnapshot(t.config.dbPath):k,this.now=e.now??Date.now}handle(e,t){try{this.syncGeneration(e);let r=this.host.semanticProvider();switch(this.available=r.availability().available,this.requests+=1,this.lastRequestAtMs=this.now(),this.lastError=null,t.kind){case"availability":return r.availability();case"import-usage":return r.importUsage(t.file);case"references":return[...H(r,t.definitions,{exact:t.exact===!0})];case"reference-fragments":if(!r.referenceFragmentsForFiles)throw new Error("TypeScript provider does not support reference fragments.");return[...r.referenceFragmentsForFiles(t.files)];case"callees":return[...L(r,t.definitions)];case"signature":return r.signatureFor(t.definition);default:return Y(t)}}catch(r){throw this.lastError=r instanceof Error?r.message:String(r),r}}status(e){let t=this.host?.snapshotStats();return{protocolVersion:M,state:this.lastError?"error":this.host?this.available?"ready":"unavailable":"idle",requests:this.requests,...this.lastRequestAtMs===null?{}:{lastRequestAt:new Date(this.lastRequestAtMs).toISOString()},...this.lastError?{lastError:this.lastError}:{},sessionsCreated:t?.sessionsCreated??0,sessionsReused:t?.sessionsReused??0,sessionsRefreshed:t?.sessionsRefreshed??0,sessionsReplaced:t?.sessionsReplaced??0,projectsCreated:t?.projectsCreated??0,...e?{mailbox:e}:{}}}closeTypeScriptService(){this.host?.dispose(),this.db?.close(),this.host=null,this.db=null,this.generation=null,this.snapshot=null,this.available=null}syncGeneration(e){if(this.generation===e&&this.host&&this.db)return;let t=this.openDb(),r=this.generationIdentity(t);if(!r||r!==e)throw t.close(),new Error("TypeScript semantic request does not match the currently published index generation.");let s=this.readSnapshot(t);if(!this.host||!this.db)this.db=t,this.host=this.createHost(t);else{let o=this.db;this.host.advanceGeneration(t,G(this.snapshot,s)),this.db=t,o.close()}this.generation=r,this.snapshot=s,this.available=null}};function Se(i){l(i)}function H(i,e,t){return i.referencesForDefinitions?.(e,t)??new Map(e.map(r=>[r.symbolId,i.referencesFor(r)]))}function L(i,e){return i.calleesForDefinitions?.(e)??new Map(e.map(t=>[t.symbolId,i.calleesFor(t)]))}function k(i){if(!i.generation.metadataRaw)return null;let e=f(i.generation.metadataRaw);return e.kind!=="legacy"&&e.kind!=="supported"||!e.capabilities.usableForEvidenceCache?null:h(e.metadata.fingerprint)}function G(i,e){return e?S(i,e):{version:1,changes:[],projectIdentityChanged:!0,uncertainty:["prior-snapshot-unavailable"]}}function Y(i){throw new Error(`Unhandled TypeScript semantic request: ${JSON.stringify(i)}`)}var fe=`typescript-semantic-${process.pid}-${_()}`,x=c(process.pid),ye={pid:process.pid,...x?{processIdentity:x}:{}};export{E as a,Q as b,j as c,Se as d};
|
|
2
|
+
//# sourceMappingURL=chunk-CBOOHUK4.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as x}from"./chunk-
|
|
1
|
+
import{c as x}from"./chunk-UHFZDQZJ.js";import{a as S}from"./chunk-DOQLO74K.js";import{d as g}from"./chunk-TNLOX4TN.js";import{b as p}from"./chunk-RGBZDOUO.js";import{C as u}from"./chunk-NRNVMB2R.js";import{f as h,g as y}from"./chunk-YMAGXBLT.js";function U(e,t,s={}){let n=S(e,t);if(!n)return null;let o=new x(e),a=w(e,n),r=n.endLine-n.startLine+1,i=o.calleeEvidenceMap([n],{additive:!0,semantic:s.semantic}),l=i.rows.get(n.symbolId)??[],c=new Set(l.map(L=>L.symbol)),m=i.incompleteSymbolIds.has(n.symbolId),b=i.unavailableSymbolIds.has(n.symbolId),N=s.semantic===!1?"disabled":m&&b?"incomplete-and-unavailable":m?"incomplete":b?"unavailable":"complete",d=!m&&!b;return{symbol:n.symbol,shortName:g(n.symbol),relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,loc:r,branches:a.branches,estimateBasis:a.estimateBasis,cyclomaticEstimate:a.branches+1,calleeCount:d?c.size:null,fanIn:C(e,n.symbolId),fanOut:d?D(l,n.relativePath):null,coverage:{semanticEvidence:N}}}function w(e,t){let s=u(e,t.relativePath);if(s){let n=v(s.rootNode,t.startLine,t.endLine);if(n)return{branches:M(n),estimateBasis:"ast"}}return{branches:P(E(e,t.relativePath,t.startLine,t.endLine),_(e,t.relativePath)),estimateBasis:"regex-fallback"}}function W(e,t){let s=new Map,n=new Map;for(let o of t){let a=n.get(o.relativePath)??[];a.push(o),n.set(o.relativePath,a)}for(let[o,a]of n){let r=u(e,o),i=r===null?[]:a.filter(c=>r.rootNode.startPosition.row<=c.startLine&&r.rootNode.endPosition.row>=c.endLine),l=new Set(i.map(c=>c.symbolId));if(r&&i.length>0){for(let c of i)s.set(c.symbolId,{branches:0,estimateBasis:"ast"});O(r.rootNode,i,s)}for(let c of a)l.has(c.symbolId)||s.set(c.symbolId,I(e,c))}return s}function I(e,t){return{branches:P(E(e,t.relativePath,t.startLine,t.endLine),_(e,t.relativePath)),estimateBasis:"regex-fallback"}}function _(e,t){return e.get("SELECT language FROM documents WHERE relative_path = ?",t)?.language??"unknown"}function E(e,t,s,n){try{return h(e.config.projectRoot,t,{inputKind:"indexed source file"}).split(`
|
|
2
2
|
`).slice(s,n+1).join(`
|
|
3
3
|
`)}catch(o){if(!y(o))throw o;return""}}function C(e,t){return e.get(`SELECT COUNT(DISTINCT c.document_id) AS c
|
|
4
4
|
FROM mentions m
|
|
@@ -13,4 +13,4 @@ import{c as x}from"./chunk-BPKNP3KZ.js";import{a as S}from"./chunk-SGMNWYTH.js";
|
|
|
13
13
|
WHERE m.symbol_id = ?
|
|
14
14
|
AND m.role != 1
|
|
15
15
|
AND sym_def.document_id != c.document_id`,t)?.c??0}function D(e,t){return new Set(e.filter(s=>s.file!==t).map(s=>s.symbol)).size}function M(e){let t=0;return f(e,s=>{t+=B(s)}),t}function O(e,t,s){let n=[...t].sort((o,a)=>o.startLine-a.startLine||a.endLine-o.endLine);f(e,o=>{let a=B(o);if(a===0)return;let r=o.startPosition.row,i=o.endPosition.row;for(let l of n){if(l.startLine>r)break;if(l.endLine<i)continue;let c=s.get(l.symbolId);c&&(c.branches+=a)}})}function f(e,t){t(e);for(let s of e.namedChildren)f(s,t)}function v(e,t,s){if(e.startPosition.row>t||e.endPosition.row<s)return null;for(let n of e.namedChildren){let o=v(n,t,s);if(o)return o}return e}var F=new Set(["if_statement","conditional_expression","ternary_expression","for_statement","for_in_statement","for_of_statement","while_statement","do_statement","switch_case","case_statement","catch_clause","except_clause","elif_clause","match_arm"]);function B(e){return F.has(e.type)?1:e.type==="binary_expression"&&e.parent?.type!=="binary_expression"&&(e.text.includes("&&")||e.text.includes("||"))?R(e.text):0}function R(e){return(e.match(/&&|\|\|/g)??[]).length}function P(e,t){let s=p(e),n=0,o=[/\bif\b/g,/\belse\s+if\b/g,/\belse\b/g,/\bfor\b/g,/\bwhile\b/g,/\bswitch\b/g,/\bcase\b/g,/\bcatch\b/g,/\?\s*[^?]/g,/&&/g,/\|\|/g];for(let a of o){let r=s.match(a);r&&(n+=r.length)}if(t==="python"){let a=[/\belif\b/g,/\bexcept\b/g,/\bfinally\b/g];for(let r of a){let i=s.match(r);i&&(n+=i.length)}}else if(t==="rust"){let a=[/\bmatch\b/g,/=>/g,/\bloop\b/g];for(let r of a){let i=s.match(r);i&&(n+=i.length)}}else if(t==="ruby"){let a=[/\belsif\b/g,/\bunless\b/g,/\brescue\b/g,/\bwhen\b/g];for(let r of a){let i=s.match(r);i&&(n+=i.length)}}else if(t==="go"){let a=[/\bselect\b/g,/\bdefer\b/g];for(let r of a){let i=s.match(r);i&&(n+=i.length)}}return n}export{U as a,w as b,W as c,M as d};
|
|
16
|
-
//# sourceMappingURL=chunk-
|
|
16
|
+
//# sourceMappingURL=chunk-CPWYEPWQ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as v,b as j}from"./chunk-QDCCHMVZ.js";import{a as M}from"./chunk-35NLDRZC.js";import{a as P}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as v,b as j}from"./chunk-QDCCHMVZ.js";import{a as M}from"./chunk-35NLDRZC.js";import{a as P}from"./chunk-NMKQOIYZ.js";import{a as q}from"./chunk-6CTSFS7R.js";import{t as I}from"./chunk-TNLOX4TN.js";import{p as x}from"./chunk-RGBZDOUO.js";import{a as U}from"./chunk-NRNVMB2R.js";var T=/\.(test|spec)\.(ts|tsx|js|jsx|mts|cts)$/,D=new Map;function V(e,r,t,o){if(!r?.testPaths?.length)return[];let c=k(r),s=[];for(let i of L(e,r.testPaths)){let a=z(e,i,o),l=a?t(a):null;if(l)for(let g of x(e,i)){let C=g.sourcePath;if(!C)continue;let d=t(C);d&&d!==l&&(c.get(l)?.has(d)||s.push({testFile:i,ownerBoundary:l,importedFile:C,importedBoundary:d,reason:"outside-owner-policy"}))}}return H(s)}function k(e){let r=e.allowedDependencies??{},t=e.boundaries.map(i=>i.name),o=new Map,c=(i,a)=>{for(let l of r[i]??[])a.has(l)||(a.add(l),c(l,a))};for(let i of t){let a=new Set;c(i,a),o.set(i,a)}let s=new Map;for(let i of t){let a=new Set(o.get(i));for(let l of t)l!==i&&o.get(l)?.has(i)&&a.add(l);s.set(i,a)}return s}function L(e,r){let t=`${e.config.projectRoot}\0${r.join("\0")}`,o=D.get(t);if(o)return o;let c=new Set;for(let i of r)for(let a of j(e.config.projectRoot,i))T.test(a)&&c.add(a);let s=[...c].sort();return D.set(t,s),s}function z(e,r,t){let o=r.replace(/^tests\//,"src/").replace(/\.(test|spec)\.(\w+)$/,".$2");if(o!==r&&t(o))return o;let c=r.split("/").pop().replace(/\.(test|spec)\.(\w+)$/,".$2"),s=x(e,r).map(i=>i.sourcePath).filter(i=>!!i&&t(i)&&i.split("/").pop()===c);return s.length===1?s[0]:null}function H(e){let r=new Map;for(let t of e){let o=`${t.testFile}\0${t.importedBoundary}`;r.has(o)||r.set(o,t)}return[...r.values()].sort((t,o)=>t.testFile.localeCompare(o.testFile)||t.importedBoundary.localeCompare(o.importedBoundary))}function O(e,r){let t=(e?.boundaries??[]).filter(o=>o.paths.some(c=>v(c,r)));return t.length===1?t[0].name:null}var b="architecture:";function G(e,r,t,o={}){let c=K(e,r);if(!t||t.boundaries.length===0)return{configured:!1,boundaries:[],edges:[],forbiddenEdges:[],reciprocalPairs:[],cycles:[],coarseBoundaries:[],staleAllowances:[],boundaryLimits:[],fragileEdges:[],testBoundaryViolations:[],coverage:{totalFiles:c.length,mappedFiles:0,unmappedFiles:[],ambiguousFiles:[]},policyCoverage:{declaredRows:0,totalBoundaries:0,missingRows:[],requiresCompletePolicy:!1,requiresCompleteCoverage:!1,requiresMinimalPolicy:!1}};let s=new Map,i=new Map(t.boundaries.map(n=>[n.name,new Set])),a=[],l=[];for(let n of c){let f=t.boundaries.filter(p=>p.paths.some(F=>v(F,n))).map(p=>p.name).sort();if(f.length===0)a.push(n);else if(f.length>1)l.push({file:n,boundaries:f});else{let p=f[0];s.set(n,p),i.get(p).add(n)}}let g=new Map;for(let[n,f]of e){let p=s.get(n);if(p)for(let F of f){let R=s.get(F);if(!R||p===R)continue;let $=w(p,R),B=g.get($);B||(B={from:p,to:R,fileEdges:[],importers:new Set,importedFiles:new Set},g.set($,B)),B.fileEdges.push({fromFile:n,toFile:F}),B.importers.add(n),B.importedFiles.add(F)}}let C=[...g.values()].map(n=>N(n,t)).sort(te),d=C,E=new Map(d.map(n=>[w(n.from,n.to),n])),S=new Map(t.boundaries.map(n=>[n.name,new Set]));for(let n of d)S.get(n.from).add(n.to);let m=[];for(let n of d){if(n.from>=n.to)continue;let f=E.get(w(n.to,n.from));f&&m.push({boundaries:[n.from,n.to],forward:n,reverse:f})}let{components:A}=M(S),y=A.filter(n=>n.length>1).map(n=>J(n,d,t.requireAcyclic===!0)).sort((n,f)=>f.boundaries.length-n.boundaries.length||n.boundaries.join("/").localeCompare(f.boundaries.join("/"))),h=t.allowedDependencies??{},u=t.boundaries.map(n=>n.name).filter(n=>!Object.hasOwn(h,n)).sort();return{configured:!0,boundaries:t.boundaries.map(n=>({name:n.name,paths:[...n.paths],fileCount:i.get(n.name).size,dependencyPolicyDeclared:Object.hasOwn(h,n.name)})).sort((n,f)=>n.name.localeCompare(f.name)),edges:C,forbiddenEdges:d.filter(n=>n.policyStatus==="forbidden"),reciprocalPairs:m,cycles:y,staleAllowances:W(t,d),boundaryLimits:Y(t,d,i),fragileEdges:d.filter(n=>n.fragile),testBoundaryViolations:o.testBoundaryViolations??[],coarseBoundaries:Q(e,i,o.isModuleHierarchyFile,t.requireResolvedBoundaries===!0,n=>t.boundaries.find(f=>f.name===n)?.subUnits??"directory"),coverage:{totalFiles:c.length,mappedFiles:s.size,unmappedFiles:a,ambiguousFiles:l},policyCoverage:{declaredRows:t.boundaries.length-u.length,totalBoundaries:t.boundaries.length,missingRows:u,requiresCompletePolicy:t.requireCompletePolicy===!0,requiresCompleteCoverage:t.requireCompleteCoverage===!0,requiresMinimalPolicy:t.requireMinimalPolicy===!0}}}function ge(e,r={}){let t=q(e,r.scope,{scipEdges:"imports-only",sourceEdges:"imports-and-reexports"}),o=U(e,{includeIgnored:!1}).filter(s=>!r.scope||s.includes(r.scope)),c=new Set(o);return G(t,o,e.config.architecture,{isModuleHierarchyFile:s=>_(e,s),testBoundaryViolations:V(e,e.config.architecture,s=>O(e.config.architecture,s),s=>c.has(s))})}function _(e,r){let t=P(r);return t==="test"||t==="entry"?!0:t!=="barrel"?!1:I(e,r).length===0}function ye(e){let r=e.forbiddenEdges.map(o=>`${b}forbidden-edge:${encodeURIComponent(o.from)}:${encodeURIComponent(o.to)}`);if(e.policyCoverage.requiresCompletePolicy)for(let o of e.policyCoverage.missingRows)r.push(`${b}missing-policy-row:${encodeURIComponent(o)}`);if(e.policyCoverage.requiresCompleteCoverage){for(let o of e.coverage.unmappedFiles)r.push(`${b}unmapped-file:${encodeURIComponent(o)}`);for(let o of e.coverage.ambiguousFiles)r.push(`${b}ambiguous-file:${encodeURIComponent(o.file)}:${o.boundaries.map(c=>encodeURIComponent(c)).sort().join("|")}`)}if(e.policyCoverage.requiresMinimalPolicy)for(let o of e.staleAllowances)r.push(`${b}stale-allowance:${encodeURIComponent(o.from)}:${encodeURIComponent(o.to)}`);for(let o of e.testBoundaryViolations)r.push(`${b}test-boundary:${encodeURIComponent(o.testFile)}:${encodeURIComponent(o.importedBoundary)}`);for(let o of e.boundaryLimits)r.push(`${b}boundary-limit:${o.kind}:${encodeURIComponent(o.boundary)}`);let t=new Map;for(let o of e.coarseBoundaries)o.violatesPolicy&&t.set(o.boundary,(t.get(o.boundary)??0)+1);for(let[o,c]of t){let s=`${b}coarse-boundary:${encodeURIComponent(o)}`;r.push(s);for(let i=2;i<=c;i+=1)r.push(`${s}:component:${i}`)}for(let o of e.cycles)o.violatesPolicy&&r.push(`${b}cycle:${o.boundaries.map(c=>encodeURIComponent(c)).sort().join("|")}`);return[...new Set(r)].sort()}function he(e){return!!e&&(Object.keys(e.allowedDependencies??{}).length>0||e.requireCompletePolicy===!0||e.requireCompleteCoverage===!0||e.requireAcyclic===!0||e.requireResolvedBoundaries===!0||e.requireMinimalPolicy===!0||e.maxBoundaryFanOut!==void 0||e.maxBoundaryFiles!==void 0||e.boundaries.some(r=>r.maxFiles!==void 0)||(e.testPaths?.length??0)>0)}function K(e,r){let t=new Set(r);for(let[o,c]of e){t.add(o);for(let s of c)t.add(s)}return[...t].sort()}function N(e,r){let t=[...e.fileEdges].sort((o,c)=>o.fromFile.localeCompare(c.fromFile)||o.toFile.localeCompare(c.toFile));return{from:e.from,to:e.to,policyStatus:X(r,e.from,e.to),fileEdgeCount:t.length,importerCount:e.importers.size,importedFileCount:e.importedFiles.size,examples:t.slice(0,5),fragile:t.length===1}}function X(e,r,t){return!e.allowedDependencies||!Object.hasOwn(e.allowedDependencies,r)?"undeclared":e.allowedDependencies[r].includes(t)?"allowed":"forbidden"}function J(e,r,t){let o=[...e].sort(),c=new Set(o),s=r.filter(a=>c.has(a.from)&&c.has(a.to)),i=Math.min(...s.map(a=>a.fileEdgeCount));return{boundaries:o,internalEdges:s,narrowestEdges:s.filter(a=>a.fileEdgeCount===i),violatesPolicy:t}}function Q(e,r,t=Z,o=!1,c=()=>"directory"){let s=[];for(let[i,a]of r){let l=c(i)==="file"?m=>m:ee,g=[...a].filter(m=>!t(m));if(g.length<2)continue;let C=new Set(g),d=new Map,E=new Map;for(let m of g)E.set(l(m),new Set);for(let m of g)for(let A of e.get(m)??[]){if(!C.has(A))continue;let y=l(m),h=l(A);if(y===h)continue;let u=w(y,h),n=d.get(u);n||(n={from:y,to:h,fileEdges:[]},d.set(u,n)),n.fileEdges.push({fromFile:m,toFile:A}),E.get(y).add(h)}let{components:S}=M(E);for(let m of S){if(m.length<2)continue;let A=new Set(m),y=[...d.values()].filter(u=>A.has(u.from)&&A.has(u.to)).map(u=>({from:u.from,to:u.to,fileEdgeCount:u.fileEdges.length,examples:u.fileEdges.slice(0,5)})).sort((u,n)=>u.from.localeCompare(n.from)||u.to.localeCompare(n.to)),h=Math.min(...y.map(u=>u.fileEdgeCount));s.push({boundary:i,violatesPolicy:o,subUnits:[...m].sort(),internalEdges:y,narrowestEdges:y.filter(u=>u.fileEdgeCount===h)})}}return s.sort((i,a)=>a.subUnits.length-i.subUnits.length||i.boundary.localeCompare(a.boundary))}function W(e,r){let t=new Set(r.map(i=>w(i.from,i.to))),o=e.allowedDependencies??{},c=new Set(e.boundaries.map(i=>i.name)),s=[];for(let[i,a]of Object.entries(o))if(c.has(i))for(let l of a)!c.has(l)||t.has(w(i,l))||s.push({from:i,to:l});return s.sort((i,a)=>i.from.localeCompare(a.from)||i.to.localeCompare(a.to))}function Y(e,r,t){let o=[],c=new Map;for(let s of r)c.set(s.from,(c.get(s.from)??0)+1);for(let s of e.boundaries){if(e.maxBoundaryFanOut!==void 0){let a=c.get(s.name)??0;a>e.maxBoundaryFanOut&&o.push({boundary:s.name,kind:"fan-out",observed:a,limit:e.maxBoundaryFanOut})}let i=s.maxFiles??e.maxBoundaryFiles;if(i!==void 0){let a=t.get(s.name)?.size??0;a>i&&o.push({boundary:s.name,kind:"files",observed:a,limit:i})}}return o.sort((s,i)=>s.boundary.localeCompare(i.boundary)||s.kind.localeCompare(i.kind))}function Z(e){let r=P(e);return r==="test"||r==="entry"}function ee(e){let r=e.lastIndexOf("/");return r===-1?".":e.slice(0,r)}function w(e,r){return`${e}\0${r}`}function te(e,r){return e.from.localeCompare(r.from)||e.to.localeCompare(r.to)}export{b as a,G as b,ge as c,ye as d,he as e,Q as f};
|
|
2
|
+
//# sourceMappingURL=chunk-CRT7I7RJ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as g}from"./chunk-35NLDRZC.js";import{c as p}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as g}from"./chunk-35NLDRZC.js";import{c as p}from"./chunk-GLXEWYQY.js";import{a as u}from"./chunk-NMKQOIYZ.js";import{a as f}from"./chunk-6CTSFS7R.js";function $(n,e={}){return C(n,e).cycles}function C(n,e={}){return b(n,e)}function w(n,e={}){return b(n,e).cycles}function b(n,e={}){let{scope:t,maxDepth:o=10,edgeBasis:r="symbol-references"}=e,s=f(n,t,r==="imports"?{scipEdges:"imports-only",sourceEdges:"imports-only"}:void 0),{components:a}=g(s),l=a.filter(i=>D(s,i)).map(i=>{let c=[...i].sort(),d=S(s,c),y=x(d);return{path:d,component:c,edgeBasis:r,witness:!0,classification:y==="real"?"dependency-cycle":"module-structure-candidate",kind:y}});return l.sort((i,c)=>i.kind!==c.kind?i.kind==="real"?-1:1:i.path.length-c.path.length),{cycles:l,truncated:!1,edgeBasis:r,maxDepth:o}}function D(n,e){if(e.length>1)return!0;let t=e[0];return t!==void 0&&n.get(t)?.has(t)===!0}function S(n,e){let t=e[0];if(!t)return[];let o=new Set(e);for(let r of[...n.get(t)??[]].filter(s=>o.has(s)).sort()){if(r===t)return[t,t];let s=B(n,r,t,o);if(s)return[t,...s]}throw new Error(`Cyclic component did not contain a witness path from ${t}.`)}function B(n,e,t,o){let r=[e],s=new Map([[e,null]]);for(let a=0;a<r.length;a+=1){let l=r[a];if(l===t){let i=[];for(let c=l;c!==null;c=s.get(c)??null)i.push(c);return i.reverse()}for(let i of[...n.get(l)??[]].filter(c=>o.has(c)).sort())s.has(i)||(s.set(i,l),r.push(i))}return null}function x(n){for(let o of n){let r=u(o);if(r==="test"||r==="barrel"||r==="entry")return"module-hierarchy"}if(n.length!==3)return"real";let[e,t]=n;return!e||!t?"real":p(e)||p(t)||m(e,t)||m(t,e)||h(e,t)||h(t,e)||u(e)==="entry"||u(t)==="entry"?"module-hierarchy":"real"}function m(n,e){if(!/\.rs$/.test(n)||!/\.rs$/.test(e))return!1;let t=e.replace(/\.rs$/,"/");return n.startsWith(t)?!n.slice(t.length).includes("/"):!1}function h(n,e){if(!/\.rs$/.test(n)||!/\.rs$/.test(e))return!1;let t=n.replace(/\.rs$/,""),o=e.replace(/\.rs$/,"");if(t===o+"_tests"||t===o+"/tests")return!0;let r=n.split("/"),s=e.split("/");if(r.length===s.length&&r.includes("tests")&&s.includes("src")){let a=r[r.length-1],l=s[s.length-1];if(a&&a===l)return!0}return!1}export{$ as a,C as b,w as c,b as d};
|
|
2
|
+
//# sourceMappingURL=chunk-CZVSQQDU.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as f}from"./chunk-OTOKVOJ3.js";import{M as d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{d as f}from"./chunk-OTOKVOJ3.js";import{M as d}from"./chunk-NRNVMB2R.js";function S(n,e={}){let{minComponentLines:o=300,minFileLines:i=800,minJsxTokens:u=80,minBehaviorTokens:s=40,limit:a=20,scope:m,scanLimit:c,filePattern:p}=e;return d(n).reactProfiles({scope:m,scanLimit:c}).filter(t=>t.kind==="component").filter(t=>!p||t.file.includes(p)||t.name.includes(p)).map(t=>C(t,{minComponentLines:o,minFileLines:i,minJsxTokens:u,minBehaviorTokens:s})).filter(t=>t!==null).sort((t,r)=>r.componentLines-t.componentLines||r.fileLines-t.fileLines||t.file.localeCompare(r.file)).slice(0,a)}function C(n,e){let o=Math.max(80,Math.floor(e.minComponentLines/2)),i=f(n,x({minComponentLines:e.minComponentLines,minFileLines:e.minFileLines,minJsxTokens:e.minJsxTokens,minBehaviorTokens:e.minBehaviorTokens,substantialComponentLines:o}),"component"),{reasons:u}=i;if(u.length===0)return null;let s=i.dominantPressure,a=i.pressureKinds,m=b(n),c=R(s,a,m);return{file:n.file,component:n.name,componentLines:n.loc,fileLines:n.fileLines,jsxTokens:n.jsxTokens.size,behaviorTokens:n.behaviorTokens.size,dominantPressure:s,pressureKinds:a,contextKind:m,recommendationKind:c,recommendation:v(c,m),reasons:u,loc:n.loc}}function x(n){return[{axis:"component",value:e=>e.loc,qualifies:(e,o)=>o>=n.minComponentLines,reason:(e,o)=>`${o} component line(s)`},{axis:"file",value:e=>e.fileLines,qualifies:(e,o)=>o>=n.minFileLines&&e.loc>=n.substantialComponentLines,reason:(e,o)=>`${o} file line(s)`},{axis:"jsx-structure",value:e=>e.jsxTokens.size,weightedValue:(e,o)=>o*3,qualifies:(e,o)=>o>=n.minJsxTokens,reason:(e,o)=>`${o} JSX structure token(s)`},{axis:"hook-behavior",value:e=>e.behaviorTokens.size,weightedValue:(e,o)=>o*4,qualifies:(e,o)=>o>=n.minBehaviorTokens,reason:(e,o)=>`${o} behavior token(s)`}]}function b(n){let e=n.file.split(/[\\/]+/).filter(Boolean),o=e.slice(0,-1).map(r=>r.toLowerCase()),i=(e.at(-1)??n.name).replace(/\.[^.]+$/,""),s=o.findIndex(r=>k.has(r))>=0,a=o.some(r=>h.has(r));if(L(i)||L(n.name))return"component";let c=T.has(i.toLowerCase()),p=/(?:Page|Route|Screen)$/.test(n.name),l=s&&/View$/.test(n.name),t=!a&&i.replace(/[^A-Za-z0-9]+/g,"").toLowerCase()===n.name.replace(/[^A-Za-z0-9]+/g,"").toLowerCase()&&/(?:Page|Route|Screen|View)$/.test(i);return c||p||l||t?"route-page":"component"}function L(n){let e=n.split(/[^A-Za-z0-9]+/).filter(Boolean).map(o=>o.toLowerCase());return e.at(-1)&&g.has(e.at(-1))?!0:[...g].some(o=>n.endsWith(P(o)))}function R(n,e,o){return n==="hook-behavior"?"behavior-extraction":o==="route-page"?"route-page-decomposition":e.includes("hook-behavior")?"behavior-extraction":e.includes("jsx-structure")?"jsx-decomposition":e.includes("file")?"file-decomposition":n==="jsx-structure"?"jsx-decomposition":n==="file"&&!e.includes("component")?"file-decomposition":"component-decomposition"}function v(n,e){switch(n){case"behavior-extraction":return"Extract independent state, effects, requests, or handlers into hooks, controllers, or feature modules.";case"route-page-decomposition":return"Split route/page orchestration from reusable panels and feature controllers.";case"jsx-decomposition":return e==="route-page"?"Split page JSX into named layout sections before extracting behavior.":"Split repeated JSX sections into named presentational components.";case"file-decomposition":return"Review file-level decomposition; split colocated panels or helpers before changing behavior.";case"component-decomposition":return"Review component boundaries around props, state ownership, and independently changing UI sections."}}var h=new Set(["component","components","panel","panels","partial","partials"]),g=new Set(["banner","button","card","dialog","drawer","filter","form","grid","header","item","list","menu","modal","nav","panel","picker","rail","row","section","selector","shell","sidebar","table","toolbar"]),k=new Set(["landing","page","pages","route","routes","screen","screens","view","views"]),T=new Set(["page","route","screen"]);function P(n){return n.charAt(0).toUpperCase()+n.slice(1)}export{S as a};
|
|
2
|
+
//# sourceMappingURL=chunk-D3KE26FS.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var s=new Set(["code","outline","refs"]),c=["--symbol","--at","--search","--view","--edge","--direction","--subtype","--connecting","--inventory-only","--fold","--depth","--max-edges"];function d(e){if(e[2]!=="evidence")return;let t=e[3];if(!t||t.startsWith("-"))return;if(e.slice(4).some(i=>c.some(r=>i===r||i.startsWith(`${r}=`)))){e.splice(3,1,"--symbol",t);return}e[2]="evidence-source"}function a(e){return e!==void 0&&s.has(e)}async function p(e){if(e==="continue"){let{outputContinuationCommandDescriptor:n}=await import("./output-continuation-command-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
var s=new Set(["code","outline","refs"]),c=["--symbol","--at","--search","--view","--edge","--direction","--subtype","--connecting","--inventory-only","--fold","--depth","--max-edges"];function d(e){if(e[2]!=="evidence")return;let t=e[3];if(!t||t.startsWith("-"))return;if(e.slice(4).some(i=>c.some(r=>i===r||i.startsWith(`${r}=`)))){e.splice(3,1,"--symbol",t);return}e[2]="evidence-source"}function a(e){return e!==void 0&&s.has(e)}async function p(e){if(e==="continue"){let{outputContinuationCommandDescriptor:n}=await import("./output-continuation-command-MJBVH3A5.js");return[n]}if(e==="__sentinel-ensure-service"){let{sentinelEnsureCommandDescriptor:n}=await import("./sentinel-ensure-command-3MZCLPQY.js");return[n]}if(a(e)){let{directNavigationQueryCommandDescriptors:n}=await import("./direct-navigation-36YSILY6.js"),o=n.find(i=>i.id===e);if(!o)throw new Error(`Direct navigation command descriptor is unavailable: ${e}`);return[o]}let{commandDescriptors:t}=await import("./command-descriptors-XHK3PK2I.js");return t}export{d as a,a as b,p as c};
|
|
2
|
+
//# sourceMappingURL=chunk-DNRHRVKS.js.map
|