codebaseiq 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +80 -0
- package/dist/augment-vue-worker.js +1 -1
- package/dist/{chunk-7GAK2F3H.js → chunk-23AD24QZ.js} +12 -12
- package/dist/chunk-24TEZJST.js +2 -0
- package/dist/{chunk-356EZBIP.js → chunk-26EDDGAX.js} +2 -2
- package/dist/{chunk-O2M3VNDY.js → chunk-26EZWQ24.js} +2 -2
- package/dist/{chunk-U33PMPNW.js → chunk-2L3NCI52.js} +2 -2
- package/dist/{chunk-MSI3K7PJ.js → chunk-2QJAVISG.js} +2 -2
- package/dist/{chunk-4LK5OIPW.js → chunk-2ZBZRYX4.js} +2 -2
- package/dist/chunk-33AXWMO2.js +2 -0
- package/dist/{chunk-EQNMD62X.js → chunk-37K55EG3.js} +2 -2
- package/dist/{chunk-ITSJMNUD.js → chunk-3EFZ5KQ4.js} +2 -2
- package/dist/{chunk-D7DOB27N.js → chunk-3F23W57G.js} +2 -2
- package/dist/{chunk-BGGB5N53.js → chunk-3GKKCVKK.js} +2 -2
- package/dist/{chunk-MQW6SJ4P.js → chunk-3SYRGMCL.js} +2 -2
- package/dist/{chunk-PFC44E6D.js → chunk-3VDL7GTY.js} +2 -2
- package/dist/{chunk-7JELP5YE.js → chunk-3XBZ5PKL.js} +2 -2
- package/dist/{chunk-75KJGYX7.js → chunk-42PXSE74.js} +2 -2
- package/dist/{chunk-FEIZXBLH.js → chunk-4GIERC2P.js} +2 -2
- package/dist/{chunk-W7YLRXZE.js → chunk-4UXDBRIF.js} +2 -2
- package/dist/chunk-4XMZYLW5.js +2 -0
- package/dist/{chunk-6BF3VYEF.js → chunk-55NUXP2V.js} +2 -2
- package/dist/chunk-5AJQCOZZ.js +21 -0
- package/dist/{chunk-5DSL3NT2.js → chunk-5NUPFZFA.js} +2 -2
- package/dist/{chunk-RJVAPMHF.js → chunk-65QIFIF6.js} +2 -2
- package/dist/{chunk-36JC5BG2.js → chunk-66Q5VLH6.js} +2 -2
- package/dist/{chunk-D7AZAOZX.js → chunk-6CQPIIS7.js} +2 -2
- package/dist/{chunk-GV2CEZCW.js → chunk-6CTSFS7R.js} +2 -2
- package/dist/{chunk-Q4XEU3UH.js → chunk-6EBUAKJT.js} +2 -2
- package/dist/chunk-6I55VYFG.js +4 -0
- package/dist/chunk-6NUURWPF.js +3 -0
- package/dist/{chunk-MHWMEZDA.js → chunk-6P5QMOM7.js} +2 -2
- package/dist/{chunk-LZSQ6X7E.js → chunk-6S5FE4ZF.js} +2 -2
- package/dist/chunk-74LRKLNC.js +22 -0
- package/dist/chunk-75A23IID.js +3 -0
- package/dist/chunk-75VNTSO6.js +7 -0
- package/dist/chunk-7HBBVZJ6.js +3 -0
- package/dist/{chunk-VWYGCMV5.js → chunk-7PPBMBH6.js} +2 -2
- package/dist/{chunk-3RSBGWGL.js → chunk-7WG57A5X.js} +2 -2
- package/dist/{chunk-FWQGH2N2.js → chunk-7XHZX6FX.js} +2 -2
- package/dist/{chunk-RIYJ4L33.js → chunk-A5HJ3CJW.js} +2 -2
- package/dist/{chunk-LONKINMJ.js → chunk-AJ5HVC5Z.js} +2 -2
- package/dist/{chunk-ZAFGY22Q.js → chunk-AYRHOFLV.js} +2 -2
- package/dist/chunk-AZDY3EKD.js +93 -0
- package/dist/{chunk-CW6AXOLR.js → chunk-AZZNG5Z2.js} +2 -2
- package/dist/chunk-BEKCTUPY.js +3 -0
- package/dist/{chunk-CR3OG6SQ.js → chunk-BKKX2OU5.js} +2 -2
- package/dist/{chunk-5LL4KEHO.js → chunk-BQKRYKDD.js} +2 -2
- package/dist/{chunk-FOZ74V56.js → chunk-BVDQU2XJ.js} +2 -2
- package/dist/chunk-C3PPB2T5.js +5 -0
- package/dist/chunk-CABIZQXQ.js +21 -0
- package/dist/{chunk-M2Y6PCFE.js → chunk-CAH322MC.js} +2 -2
- package/dist/{chunk-EIBGSU2R.js → chunk-CBOOHUK4.js} +2 -2
- package/dist/chunk-CFIICAOM.js +2 -0
- package/dist/{chunk-XMJ53WG4.js → chunk-CPWYEPWQ.js} +2 -2
- package/dist/{chunk-LQHYYIOB.js → chunk-CRT7I7RJ.js} +2 -2
- package/dist/{chunk-IZDPGOZR.js → chunk-CZVSQQDU.js} +2 -2
- package/dist/{chunk-TNJGTQWO.js → chunk-D3KE26FS.js} +2 -2
- package/dist/{chunk-GP7C5VAE.js → chunk-DNRHRVKS.js} +2 -2
- package/dist/{chunk-SGMNWYTH.js → chunk-DOQLO74K.js} +2 -2
- package/dist/{chunk-AURCQHSG.js → chunk-DP3EJ6XL.js} +2 -2
- package/dist/{chunk-C7QWUBR2.js → chunk-DQZF7MP6.js} +2 -2
- package/dist/{chunk-E52K4L2W.js → chunk-DTM4EHD2.js} +2 -2
- package/dist/{chunk-YRKP7PM7.js → chunk-DUM7GR6B.js} +2 -2
- package/dist/{chunk-I22IZYDI.js → chunk-DZ4QOIRY.js} +2 -2
- package/dist/{chunk-EXZ7VLRY.js → chunk-E3R6TJ5T.js} +2 -2
- package/dist/chunk-E4DP45YU.js +3 -0
- package/dist/{chunk-PUVNH4PO.js → chunk-E5U6N5WI.js} +2 -2
- package/dist/chunk-E7T22WET.js +21 -0
- package/dist/{chunk-QEOWONKY.js → chunk-ED7ZAZ5V.js} +2 -2
- package/dist/{chunk-RCIGX23V.js → chunk-EDMG5CSO.js} +2 -2
- package/dist/{chunk-IHSLIIL3.js → chunk-EOSUV7H5.js} +2 -2
- package/dist/{chunk-FQTIFWLR.js → chunk-ESWVTSHU.js} +2 -2
- package/dist/{chunk-6VREELBC.js → chunk-ETZBIG6K.js} +2 -2
- package/dist/chunk-EYSJHKX6.js +3 -0
- package/dist/{chunk-Q23IMHXS.js → chunk-F4AGM7ZE.js} +37 -37
- package/dist/{chunk-FTTV7IRX.js → chunk-FPUJRBHL.js} +50 -50
- package/dist/{chunk-CCIYWXX6.js → chunk-G2UU6PQP.js} +2 -2
- package/dist/{chunk-C6WKPKCF.js → chunk-G3KRXNNT.js} +2 -2
- package/dist/{chunk-TEANKHUU.js → chunk-G3ZBP72R.js} +2 -2
- package/dist/{chunk-NBCQZSGR.js → chunk-GC4I33OD.js} +2 -2
- package/dist/{chunk-NDKOVQFG.js → chunk-GLXEWYQY.js} +2 -2
- package/dist/{chunk-AEXQYQD7.js → chunk-GRHNPFHT.js} +2 -2
- package/dist/{chunk-NBZKSTXP.js → chunk-GWESWURK.js} +2 -2
- package/dist/{chunk-Q3ZCQY2Y.js → chunk-GXOFPAIR.js} +2 -2
- package/dist/{chunk-USOAJHY7.js → chunk-H4FGIFEU.js} +2 -2
- package/dist/{chunk-LKUTSP4G.js → chunk-HOGS6JFP.js} +2 -2
- package/dist/{chunk-UQE4XFSA.js → chunk-HSJLK5MC.js} +2 -2
- package/dist/{chunk-BWL3PMPT.js → chunk-HTPEUJ42.js} +2 -2
- package/dist/{chunk-3RR2K7EZ.js → chunk-IBPXUGJV.js} +2 -2
- package/dist/{chunk-BFBIMTCJ.js → chunk-ITA3N7G6.js} +2 -2
- package/dist/chunk-JG5OWAEB.js +22 -0
- package/dist/{chunk-2PRONPAS.js → chunk-JGJKRTTB.js} +2 -2
- package/dist/{chunk-TJWVT4DO.js → chunk-JGXLB7PR.js} +2 -2
- package/dist/{chunk-K7JLSGCJ.js → chunk-JKUF2UG6.js} +3 -3
- package/dist/{chunk-CIYA2KZN.js → chunk-JOYASZRF.js} +2 -2
- package/dist/{chunk-U7NUXDQO.js → chunk-K3PFL5QQ.js} +2 -2
- package/dist/{chunk-WK2IQJPK.js → chunk-KAXBWTSX.js} +2 -2
- package/dist/{chunk-5ZI2PPI7.js → chunk-KHHAGHAW.js} +2 -2
- package/dist/{chunk-UW6KD57C.js → chunk-KJLUQVBG.js} +2 -2
- package/dist/{chunk-WWCV4E6J.js → chunk-KOVUXHIZ.js} +2 -2
- package/dist/chunk-KPMMOAV5.js +4 -0
- package/dist/{chunk-GDHWOA57.js → chunk-LKJZNGMA.js} +2 -2
- package/dist/{chunk-3VJ3OCRE.js → chunk-LMPOC372.js} +2 -2
- package/dist/{chunk-F3QSL4W2.js → chunk-LTPNP6D5.js} +2 -2
- package/dist/{chunk-MVRGB4KJ.js → chunk-M3IBH6C3.js} +9 -9
- package/dist/{chunk-PHNCEUXX.js → chunk-MAGBSB6E.js} +2 -2
- package/dist/{chunk-QMOZZ2VX.js → chunk-MFMHD36E.js} +2 -2
- package/dist/{chunk-LMTSB3TB.js → chunk-MJX2J5QE.js} +2 -2
- package/dist/{chunk-PTQPPPG2.js → chunk-N26LGGSF.js} +2 -2
- package/dist/{chunk-J7AMBVWF.js → chunk-NB2DAVPP.js} +2 -2
- package/dist/{chunk-JYI7CV25.js → chunk-NJDXNYLG.js} +2 -2
- package/dist/{chunk-BRQL7AFJ.js → chunk-NMKQOIYZ.js} +2 -2
- package/dist/{chunk-ICUL7XRT.js → chunk-NRNVMB2R.js} +2 -2
- package/dist/{chunk-DDN2F6GB.js → chunk-O5BWFNIH.js} +2 -2
- package/dist/{chunk-HVFB3PME.js → chunk-O7PCDZ5B.js} +2 -2
- package/dist/{chunk-KPZGTB2O.js → chunk-OAJYNPRU.js} +2 -2
- package/dist/{chunk-2EDX3JT5.js → chunk-OFUC6R46.js} +2 -2
- package/dist/chunk-OSZ7PW5K.js +5 -0
- package/dist/{chunk-B3UYV66Z.js → chunk-OZ2M2X7A.js} +2 -2
- package/dist/{chunk-6O3KXIDL.js → chunk-OZI44VCR.js} +2 -2
- package/dist/{chunk-XN3EKMLI.js → chunk-PCKIKOUA.js} +2 -2
- package/dist/{chunk-NCJILOAK.js → chunk-PFMQRHC6.js} +2 -2
- package/dist/chunk-PVKSZBX5.js +82 -0
- package/dist/{chunk-NEWHKGVD.js → chunk-QANCT4MO.js} +2 -2
- package/dist/{chunk-ZNH33XIB.js → chunk-QEWN7BLP.js} +2 -2
- package/dist/{chunk-OQUCBKOI.js → chunk-QFJ46F6F.js} +2 -2
- package/dist/{chunk-2E6OUPCF.js → chunk-QPQWR6CW.js} +2 -2
- package/dist/{chunk-YTJHCGYB.js → chunk-QX4HDF2I.js} +2 -2
- package/dist/{chunk-J3GLP7Q5.js → chunk-R2F2CTBA.js} +2 -2
- package/dist/{chunk-2OMXFE64.js → chunk-R7PXHYMY.js} +2 -2
- package/dist/{chunk-F74LZWCE.js → chunk-RGBZDOUO.js} +2 -2
- package/dist/{chunk-362QOSFD.js → chunk-RNPG5P4P.js} +2 -2
- package/dist/{chunk-D62CTZX6.js → chunk-RS6UYNEP.js} +2 -2
- package/dist/{chunk-VGWZ4MOY.js → chunk-RVBRPBLQ.js} +2 -2
- package/dist/{chunk-5IZRKWTZ.js → chunk-RWAZCEJD.js} +2 -2
- package/dist/{chunk-ZQ62NNKN.js → chunk-RWDIONS7.js} +2 -2
- package/dist/{chunk-HQA7EBSK.js → chunk-S3CJYDXP.js} +2 -2
- package/dist/{chunk-GL6UTNUB.js → chunk-S6UTKCBT.js} +2 -2
- package/dist/chunk-SLLFJXTW.js +27 -0
- package/dist/{chunk-TOTWJZIX.js → chunk-T3KTMLQT.js} +2 -2
- package/dist/{chunk-67VJAYVR.js → chunk-TB575ZGO.js} +2 -2
- package/dist/{chunk-YHPG3S2U.js → chunk-TG4GMU73.js} +2 -2
- package/dist/{chunk-CVHOQONG.js → chunk-THKM7OXM.js} +2 -2
- package/dist/{chunk-GVAF222T.js → chunk-TNLOX4TN.js} +2 -2
- package/dist/{chunk-HENP2O4A.js → chunk-UHFZDQZJ.js} +2 -2
- package/dist/{chunk-YT4DVWUV.js → chunk-UUMAM5LM.js} +2 -2
- package/dist/{chunk-JX6ZWDOS.js → chunk-UUT5P3V7.js} +2 -2
- package/dist/{chunk-Z6RL7XOE.js → chunk-VEPK6M5C.js} +2 -2
- package/dist/{chunk-C7OUW52M.js → chunk-VPCHKZ3I.js} +2 -2
- package/dist/{chunk-GIDCP7KV.js → chunk-VZY3XOBU.js} +2 -2
- package/dist/{chunk-XQAVQVIL.js → chunk-W6E6ME7G.js} +2 -2
- package/dist/{chunk-XQPPURLQ.js → chunk-WGYZBS5S.js} +2 -2
- package/dist/{chunk-GUFPEFBG.js → chunk-WUP24Q4U.js} +2 -2
- package/dist/chunk-WXUHXSLN.js +2 -0
- package/dist/{chunk-HINZQKSY.js → chunk-X4YZD2MP.js} +2 -2
- package/dist/chunk-XARPGCTL.js +2 -0
- package/dist/{chunk-5FWR5HLG.js → chunk-XDQ6QJF5.js} +20 -20
- package/dist/{chunk-JCMFBF4Z.js → chunk-XRH7R5SX.js} +2 -2
- package/dist/{chunk-BBP7HVBJ.js → chunk-XVJ2E7W7.js} +2 -2
- package/dist/{chunk-D53LWANR.js → chunk-Y7GFAU5N.js} +2 -2
- package/dist/{chunk-T6MQNNAC.js → chunk-YBDLHFZZ.js} +2 -2
- package/dist/{chunk-ZB4C5TTR.js → chunk-YI3CJPOY.js} +2 -2
- package/dist/chunk-YMAGXBLT.js +3 -0
- package/dist/{chunk-MZNMASFM.js → chunk-YRAGNEBZ.js} +2 -2
- package/dist/chunk-YXZAAQHZ.js +3 -0
- package/dist/chunk-Z2L5H2HF.js +3 -0
- package/dist/{chunk-JSNTHRLQ.js → chunk-ZHK7TVAJ.js} +2 -2
- package/dist/chunk-ZJNV27DZ.js +4 -0
- package/dist/{chunk-GQLDYCWS.js → chunk-ZQ6GAIUV.js} +2 -2
- package/dist/{chunk-TPO7XC5Z.js → chunk-ZQE2QYAC.js} +2 -2
- package/dist/chunk-ZUQ2MDFT.js +2 -0
- package/dist/cli-context-4R2LREXQ.js +3 -0
- package/dist/cli-context-6X7JYARX.js +2 -0
- package/dist/cli-failure-RECEHOM2.js +3 -0
- package/dist/cli-program-MXA3WTAO.js +7 -0
- package/dist/cli.js +1 -1
- package/dist/{code-viewer-VHLBLIUM.js → code-viewer-C6HE4DFC.js} +2 -2
- package/dist/{code-viewer-KIXEYQNJ.js → code-viewer-XHSSAMBX.js} +2 -2
- package/dist/{command-descriptors-YCLATF5I.js → command-descriptors-NWW34Z54.js} +171 -171
- package/dist/{command-descriptors-F5P2V3NW.js → command-descriptors-XHK3PK2I.js} +116 -116
- package/dist/{command-panels-SZONPMLJ.js → command-panels-OXMCJ2QZ.js} +2 -2
- package/dist/direct-navigation-236VXYBZ.js +3 -0
- package/dist/direct-navigation-36YSILY6.js +2 -0
- package/dist/index.js +1 -1
- package/dist/invocation-command-descriptors-35JULLNR.js +3 -0
- package/dist/invocation-command-descriptors-FEWSFUO2.js +2 -0
- package/dist/output-continuation-command-MJBVH3A5.js +2 -0
- package/dist/output-continuation-command-TBXIOPHQ.js +3 -0
- package/dist/project-reindex-5TCGOVSK.js +2 -0
- package/dist/project-reindex-BUNTSYKM.js +3 -0
- package/dist/queries/affected.js +1 -1
- package/dist/queries/anchors.js +1 -1
- package/dist/queries/architecture.js +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/context.js +1 -1
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.js +1 -1
- package/dist/queries/decorative-checkers.js +1 -1
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/dependence-slice.js +1 -1
- package/dist/queries/dependency-depth.js +1 -1
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.js +1 -1
- package/dist/queries/entry-map.js +1 -1
- package/dist/queries/evidence.js +1 -1
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/not-implemented.js +1 -1
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/reference-neighborhood.js +1 -1
- package/dist/queries/reference-reachability.js +1 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.js +1 -1
- package/dist/queries/source-inspection.js +1 -1
- package/dist/queries/source-search.js +1 -1
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system-map.js +1 -1
- package/dist/queries/system.js +1 -1
- package/dist/queries/test-quality.js +1 -1
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.js +1 -1
- package/dist/queries/twin-drift.js +1 -1
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/value-flow.js +1 -1
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +1 -1
- package/dist/reindex.js +30 -30
- package/dist/runtime.js +1 -1
- package/dist/rust-semantic-session-server.js +1 -1
- package/dist/rust-semantic-session-worker.js +1 -1
- package/dist/rust-semantic-worker.js +1 -1
- package/dist/sentinel-ensure-command-3MZCLPQY.js +2 -0
- package/dist/sentinel-ensure-command-LEWHIRLL.js +3 -0
- package/dist/sentinel-worker.js +1 -1
- package/dist/typescript-mailbox-worker.js +1 -1
- package/dist/watch-server.js +6 -6
- package/docs/COMMAND_REFERENCE.md +2 -2
- package/docs/SECURITY_MODEL.md +3 -0
- package/package.json +1 -1
- package/skills/codebaseiq/SKILL.md +15 -3
- package/dist/chunk-23C5AD3B.js +0 -2
- package/dist/chunk-2I2UHZET.js +0 -2
- package/dist/chunk-5IC2WZAL.js +0 -22
- package/dist/chunk-5T44HG5Y.js +0 -88
- package/dist/chunk-6JMAVFL4.js +0 -3
- package/dist/chunk-6WAPPQ5F.js +0 -82
- package/dist/chunk-7UCDGXRW.js +0 -8
- package/dist/chunk-AQI4N64O.js +0 -22
- package/dist/chunk-DAKIGMIK.js +0 -21
- package/dist/chunk-DUKHVPU5.js +0 -4
- package/dist/chunk-DVWO7RBC.js +0 -2
- package/dist/chunk-FH5WG4LE.js +0 -2
- package/dist/chunk-GQXXOS55.js +0 -2
- package/dist/chunk-GWYZVVKY.js +0 -21
- package/dist/chunk-JFIA2JI3.js +0 -3
- package/dist/chunk-JLZLLLW5.js +0 -3
- package/dist/chunk-MEUHIDI3.js +0 -7
- package/dist/chunk-OFGOOL6U.js +0 -3
- package/dist/chunk-P4NVCOM7.js +0 -2
- package/dist/chunk-SMDIEDM4.js +0 -27
- package/dist/chunk-SX72EVMY.js +0 -3
- package/dist/chunk-T5X7DK6C.js +0 -3
- package/dist/chunk-T75DS2E6.js +0 -21
- package/dist/chunk-TJBOJUVN.js +0 -3
- package/dist/chunk-UC2FD2PS.js +0 -4
- package/dist/chunk-UQYQBLJX.js +0 -5
- package/dist/chunk-Z35GOVEH.js +0 -2
- package/dist/cli-context-FJL2JHOE.js +0 -3
- package/dist/cli-context-PQNWHMCQ.js +0 -2
- package/dist/cli-program-UO7PZD6V.js +0 -7
- package/dist/direct-navigation-4XJTXIDT.js +0 -2
- package/dist/direct-navigation-J5MVYYAD.js +0 -3
- package/dist/invocation-command-descriptors-RWV4VAI4.js +0 -2
- package/dist/invocation-command-descriptors-U76PN7IY.js +0 -3
- package/dist/output-continuation-command-BL25S26S.js +0 -3
- package/dist/output-continuation-command-BTETTXEC.js +0 -2
- package/dist/project-reindex-CRJU3IFG.js +0 -2
- package/dist/project-reindex-TQFCOA2O.js +0 -3
- package/dist/sentinel-ensure-command-OSWGCFFL.js +0 -3
- package/dist/sentinel-ensure-command-SPW7XQLB.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{a as te,b as N,e as V,f as j,g as B,h as re,i as se}from"./chunk-NMTSZXCL.js";import{b as _}from"./chunk-B75HZHUP.js";import{c as q}from"./chunk-HENP2O4A.js";import{a as ie}from"./chunk-6VREELBC.js";import{b as ne}from"./chunk-MSI3K7PJ.js";import{a as D}from"./chunk-SGMNWYTH.js";import{d as v,e as K,h as $}from"./chunk-GVAF222T.js";import{a as E}from"./chunk-F74LZWCE.js";import{a as Y}from"./chunk-ICUL7XRT.js";import{h as z,l as J,t as Q,v as ee,w as U,x as H}from"./chunk-7GAK2F3H.js";import{a as A,d as y}from"./chunk-3LCDIREB.js";function Ie(e,n,t={}){let{minSimilarity:i=.4,limit:r=20}=t,s=()=>Ge(e,n,{minSimilarity:i,limit:r,scanLimit:t.scanLimit,candidateMode:t.sourceCandidateMode??"full"}),a=Be(e,n,{semantic:t.semantic!==!1});if(a.kind==="not-callable")return[];if(a.kind==="callee-evidence-unusable")return s();let o=a.target;if(!$(o.symbol))return[];if(o.callees.size===0)return s();let c=we(e,o,i,{scanLimit:t.scanLimit,semantic:t.semantic!==!1});return c.length>0?c.slice(0,r):s()}function Tn(e,n,t,i={}){let r=D(e,n),s=D(e,t);if(!r||!s)return null;let a=Ie(e,r.symbol,{minSimilarity:0,limit:Number.POSITIVE_INFINITY,semantic:i.semantic,scanLimit:i.scanLimit}).find(m=>m.symbolB===s.symbol||m.symbolA===s.symbol);if(!a)return null;let o=r.endLine-r.startLine+1,c=s.endLine-s.startLine+1;return{symbolA:{symbol:r.symbol,shortName:v(r.symbol),file:r.relativePath,loc:o},symbolB:{symbol:s.symbol,shortName:v(s.symbol),file:s.relativePath,loc:c},similarity:a.similarity,similarityBasis:a.similarityBasis??"callees",sharedEvidence:a.sharedCallees,uniqueToA:a.uniqueToA,uniqueToB:a.uniqueToB,evidenceClass:a.evidenceClass,actionTier:a.actionTier,recommendation:a.recommendation,consolidationStrategy:ve(a)}}function ve(e){let n=e.similarityBasis==="source-tokens"?"source-token":"tracked callee";return e.sharedCallees.length===0?`No shared ${n} evidence survived similar's weighting. Inspect the source before attempting consolidation.`:e.uniqueToA.length===0&&e.uniqueToB.length===0?`The functions have identical ${n} evidence under similar's weighting. Verify signatures, guards, and return values before consolidating.`:e.uniqueToA.length===0?`A's ${n} evidence is a subset of B's. B may subsume part of A's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToB.length===0?`B's ${n} evidence is a subset of A's. A may subsume part of B's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToA.length<=2&&e.uniqueToB.length<=2?`Create a shared helper around the ${e.sharedCallees.length} shared ${n}(s). Pass the ${e.uniqueToA.length+e.uniqueToB.length} divergent point(s) as parameters or callbacks.`:`Extract the ${e.sharedCallees.length} shared ${n}(s) into a common helper. Keep each function's unique logic outside that helper (${e.uniqueToA.length} item(s) in A, ${e.uniqueToB.length} in B).`}function we(e,n,t,i){let r=G(e).calleeIndex({minCallees:3,scanLimit:i.scanLimit,semantic:i.semantic}),s=_e(n,r.corpus),a=Pe(s,r),o=Te(s,r),c=j(o),m=B(s.callees,o),g=[];for(let f of a){if(f.callees.size<3)continue;let l=B(f.callees,o),u=ce(s,f,o,{minSimilarity:t,requireSignificantShared:1,requireSharedCount:0,medianIdf:c,magnitudeA:m,magnitudeB:l});u&&g.push(u)}return g.sort((f,l)=>l.similarity-f.similarity),g}function Te(e,n){let t=new Map(n.docFreq);for(let i of e.callees)t.set(i,(t.get(i)??0)+1);return V(t,n.corpus.length+1)}function ce(e,n,t,i){let r=Le(e,n,t,i);if(!Re(r,i))return null;let{similarity:s,significantShared:a,trivialShared:o}=r,c=a.length>0?a:o,m=pe(c,"callees");return{symbolA:e.symbol,shortNameA:v(e.symbol),fileA:e.file,symbolB:n.symbol,shortNameB:v(n.symbol),fileB:n.file,similarity:s,similarityBasis:"callees",sharedCallees:c.map(v),uniqueToA:[...N(e.callees,n.callees)].map(v),uniqueToB:[...N(n.callees,e.callees)].map(v),...m}}function Me(e,n,t,i){let r=i.magnitudeA??B(e.callees,t),s=i.magnitudeB??B(n.callees,t),a=0,o=0,c=0,m=i.medianIdf??j(t);for(let l of e.callees){if(!n.callees.has(l))continue;let u=t.get(l)??0;a+=u*u,c+=1,u>=m&&(o+=1)}if(c===0)return!1;let g=r*s;return(g>0?a/g:0)<i.minSimilarity?!1:o>=i.requireSignificantShared||c>=i.requireSharedCount}function Le(e,n,t,i){return i.magnitudeA===void 0||i.magnitudeB===void 0?re(e.callees,n.callees,t,{medianIdf:i.medianIdf}):se(e.callees,n.callees,t,{medianIdf:i.medianIdf,magnitudeA:i.magnitudeA,magnitudeB:i.magnitudeB})}function Re(e,n){if(e.similarity<n.minSimilarity)return!1;let t=e.significantShared.length+e.trivialShared.length;return e.significantShared.length>=n.requireSignificantShared||t>=n.requireSharedCount}function Mn(e,n={}){let{minSimilarity:t=.5,limit:i=20,scope:r,minCallees:s=4,crossFileOnly:a=!1,scanLimit:o}=n,c=n.semantic!==!1,m=A(),g=0,f=0,l=0,u=0,d=0,p=0,b=0;return y("similar.all",()=>{let h=G(e).calleeIndex({minCallees:s,scope:r,scanLimit:o,semantic:c}),S=h.corpus;g=S.length;let F=n.focusFiles,I=[],P=0;return y("similar.all.pair-scan",()=>{for(let k=0;k<S.length;k+=1){let x=S[k],M=F?.has(x.file)??!1,w=h.weightedMagnitudes[k],T=new Set;for(let O of x.callees){let L=h.candidateIndexesByCallee.get(O);if(L)for(let R of L)R<=k||F&&!M&&!F.has(S[R].file)||T.add(R)}m&&(l+=T.size,T.size>0&&(f+=1));for(let O of T){let L=S[O];if(a&&x.file===L.file){m&&(d+=1);continue}if(ue(x,L)){m&&(p+=1);continue}m&&(u+=1);let R=ce(x,L,h.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:h.medianIdf,magnitudeA:w,magnitudeB:h.weightedMagnitudes[O]});R&&(Ae(I,R,i,P),m&&(b+=1),P+=1)}}},()=>({corpusSize:g,candidateSets:f,candidatePairs:l,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:b,topResults:I.length})),y("similar.all.sort-project",()=>(I.sort((k,x)=>x.result.similarity-k.result.similarity||k.order-x.order),I.map(k=>k.result)),()=>({topResults:I.length}))},()=>({minSimilarity:t,limit:i,scope:r,minCallees:s,crossFileOnly:a,scanLimit:o,semantic:c,corpusSize:g,candidateSets:f,candidatePairs:l,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:b}))}function Ln(e,n={}){let{minSimilarity:t=.5,scope:i,minCallees:r=4,crossFileOnly:s=!1,scanLimit:a}=n,o=n.semantic!==!1,c=A(),m=0,g=0,f=0,l=0,u=0,d=0,p=0;return y("similar.all-count",()=>{let C=G(e).calleeIndex({minCallees:r,scope:i,scanLimit:a,semantic:o}),h=C.corpus;m=h.length;let S=n.focusFiles;return y("similar.all-count.pair-scan",()=>{for(let F=0;F<h.length;F+=1){let I=h[F],P=S?.has(I.file)??!1,k=C.weightedMagnitudes[F],x=new Set;for(let M of I.callees){let w=C.candidateIndexesByCallee.get(M);if(w)for(let T of w)T<=F||S&&!P&&!S.has(h[T].file)||x.add(T)}c&&(f+=x.size,x.size>0&&(g+=1));for(let M of x){let w=h[M];if(s&&I.file===w.file){c&&(u+=1);continue}if(ue(I,w)){c&&(d+=1);continue}c&&(l+=1),Me(I,w,C.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:C.medianIdf,magnitudeA:k,magnitudeB:C.weightedMagnitudes[M]})&&(p+=1)}}},()=>({corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:l,crossFileSkips:u,signatureSkips:d,insertedResults:p})),p},()=>({minSimilarity:t,scope:i,minCallees:r,crossFileOnly:s,scanLimit:a,semantic:o,corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:l,crossFileSkips:u,signatureSkips:d,insertedResults:p}))}function ue(e,n){if(e.paramCount<0||n.paramCount<0)return!1;let t=Math.abs(e.paramCount-n.paramCount),i=Math.max(2,Math.ceil(Math.max(e.paramCount,n.paramCount)*.5));return t>i}var me=Q({kind:"source-fingerprints",invalidation:ee("source-fingerprints"),serialize:cn,deserialize:ln});function Ae(e,n,t,i){if(t<=0)return;if(e.length<t){e.push({result:n,order:i});return}let r=0;for(let a=1;a<e.length;a+=1){let o=e[a],c=e[r];(o.result.similarity<c.result.similarity||o.result.similarity===c.result.similarity&&o.order>c.order)&&(r=a)}let s=e[r];n.similarity<=s.result.similarity||(e[r]={result:n,order:i})}var Ee=["ScipDatabase#all","ScipDatabase#get","ScipDatabase#prepare","ScipDatabase#pathExclusionsFor","ScipDatabase#isIgnored","ScipDatabase#symbolNoiseFor","PerDbValue#get","PerDbValue#has",":storage:db:ScipDatabase:all",":storage:db:ScipDatabase:get",":storage:db:ScipDatabase:prepare",":storage:db:ScipDatabase:pathExclusionsFor",":storage:db:ScipDatabase:isIgnored",":storage:db:ScipDatabase:symbolNoiseFor",":storage:per-db-cache:PerDbValue:get",":storage:per-db-cache:PerDbValue:has"];function Be(e,n,t){let i=D(e,n);if(!i)return{kind:"not-callable"};if(!$(i.symbol))return{kind:"not-callable"};let r=new q(e),s=ne(e,i,{semantic:t.semantic,semanticEvidence:ie});return s.semanticIncomplete||s.semanticUnavailable?{kind:"callee-evidence-unusable"}:{kind:"resolved",target:{symbol:i.symbol,file:i.relativePath,callees:ge(s.rows.map(a=>a.symbol)),paramCount:r.callableSignature(i)?.paramCount??-1}}}var ze=z("callee-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),De=z("callee-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function de(e,n){let{minCallees:t,scope:i,excludeSymbol:r,scanLimit:s}=n,a=n.semantic!==!1,o=ze.get(e,()=>new Map),c=`${t}|${i??""}|${s??""}|${a}`,m=!0,g=0,f=0;return y("similar.callee-fingerprints.resolve",()=>{let l=o.get(c);if(m=l!==void 0,l||(l=Oe(e,{minCallees:t,scope:i,scanLimit:s,semantic:a}),o.set(c,l)),g=l.length,r===void 0)return l;let u=l.filter(d=>d.symbol!==r);return f=l.length-u.length,u},()=>({minCallees:t,scope:i,scanLimit:s,semantic:a,cacheHit:m,corpusSize:g,excludeSymbol:r!==void 0,excludedSymbols:f}))}function qe(e,n){let{minCallees:t,scope:i,scanLimit:r}=n,s=n.semantic!==!1,a=De.get(e,()=>new Map),o=`${t}|${i??""}|${r??""}|${s}`,c=!0,m=0,g=0,f=0;return y("similar.callee-index.resolve",()=>{let l=a.get(o);return c=l!==void 0,l||(l=Ne(de(e,{minCallees:t,scope:i,scanLimit:r,semantic:s})),a.set(o,l)),m=l.corpus.length,g=l.docFreq.size,f=l.candidateIndexesByCallee.size,l},()=>({minCallees:t,scope:i,scanLimit:r,semantic:s,cacheHit:c,corpusSize:m,indexedCallees:g,candidateBuckets:f}))}function G(e){return{calleeCorpus:n=>de(e,n),calleeIndex:n=>qe(e,n),sourceCorpus:(n={})=>Ce(e,n),sourceIndex:(n={})=>le(e,n),sourceCandidates:(n,t)=>(t.candidateMode??"full")==="target-pruned"?Qe(e,n,{minSimilarity:t.minSimilarity,scanLimit:t.scanLimit}):Ye(n,le(e,{scanLimit:t.scanLimit}))}}function Ne(e){let n=A(),t=0,i=y("similar.callee-index.doc-frequency",()=>{let l=new Map;for(let u of e)for(let d of u.callees)l.set(d,(l.get(d)??0)+1);return t=l.size,l},()=>({corpusSize:e.length,uniqueCallees:t})),r=Math.max(8,Math.ceil(Math.sqrt(e.length))),s=y("similar.callee-index.idf-weights",()=>V(i,e.length),()=>({corpusSize:e.length,uniqueCallees:i.size})),a=y("similar.callee-index.weighted-magnitudes",()=>e.map(l=>B(l.callees,s)),()=>({corpusSize:e.length})),o=0,c=0,m=0,g=y("similar.callee-index.candidate-buckets",()=>{let l=new Map;for(let u=0;u<e.length;u+=1){let d=e[u];for(let p of d.callees){if((i.get(p)??0)>r){n&&(c+=1);continue}let b=l.get(p);b||(b=[],l.set(p,b)),b.push(u),n&&(o+=1)}}return n&&(m=l.size),l},()=>({corpusSize:e.length,buckets:m,candidateRefs:o,ubiquitousSkips:c,ubiquityThreshold:r})),f=y("similar.callee-index.median-idf",()=>j(s),()=>({uniqueCallees:s.size}));return{corpus:e,candidateIndexesByCallee:g,docFreq:i,idfWeights:s,weightedMagnitudes:a,medianIdf:f,ubiquityThreshold:r}}function Pe(e,n){let t=new Map;for(let i of e.callees)for(let r of n.candidateIndexesByCallee.get(i)??[]){let s=n.corpus[r];s.symbol!==e.symbol&&t.set(s.symbol,s)}return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Oe(e,n){let{minCallees:t,scope:i,scanLimit:r,semantic:s}=n,a=A(),o=new q(e),c=0,m=y("similar.callee-fingerprints.candidates",()=>{let p=_(o.productionCallableDefinitions({scope:i,minLoc:5,sortByLocDesc:typeof r=="number"&&r>0}),r);return c=p.length,p},()=>({scope:i,scanLimit:r,candidateCount:c})),g=0,f=y("similar.callee-fingerprints.callee-map",()=>{let p=o.calleeEvidenceMap(m,{semantic:s});if(a)for(let b of p.rows.values())g+=b.length;return p},()=>({candidateCount:c,semantic:s,calleeEdges:g})),l=0,u=0,d=0;return y("similar.callee-fingerprints.shape",()=>{let b=m.filter(S=>!f.incompleteSymbolIds.has(S.symbolId)&&!f.unavailableSymbolIds.has(S.symbolId)).map(S=>({symbol:S.symbol,file:S.relativePath,callees:ge((f.rows.get(S.symbolId)??[]).map(F=>F.symbol)),paramCount:o.callableSignature(S)?.paramCount??-1})),C=$e(b);a&&(d=C.filter((S,F)=>S.callees.size!==b[F].callees.size).length);let h=C.filter(S=>S.callees.size>=t);return l=h.length,a&&(u=h.reduce((S,F)=>S+F.callees.size,0)),h},()=>({candidateCount:c,fingerprintCount:l,retainedCalleeCount:u,minCallees:t,siblingSaturatedFingerprints:d}))}var fe=5;function $e(e){let n=new Map;for(let t of e){let i=n.get(t.file);i||(i=new Map,n.set(t.file,i));for(let r of t.callees)i.set(r,(i.get(r)??0)+1)}return e.map(t=>{let i=n.get(t.file);if(!i)return t;let r=[...t.callees].filter(a=>(i.get(a)??0)>=fe);if(r.length===0)return t;let s=new Set(t.callees);for(let a of r)s.delete(a);return{...t,callees:s}})}function _e(e,n){let t=new Map;for(let s of n)if(!(s.file!==e.file||s.symbol===e.symbol))for(let a of s.callees)t.set(a,(t.get(a)??0)+1);let i=[...e.callees].filter(s=>(t.get(s)??0)+1>=fe);if(i.length===0)return e;let r=new Set(e.callees);for(let s of i)r.delete(s);return{...e,callees:r}}function ge(e){return new Set([...e].filter(n=>!je(n)))}function je(e){return Ee.some(n=>e.includes(n))}function Ge(e,n,t){let i=Ve(e,n);if(!i||i.tokens.size<3)return[];let r=t.minSimilarity>=.5?t.minSimilarity:.3,s=[],a=t.candidateMode??"full",o=0,c=0,m=0,g=0;return y("similar.source-shape",()=>{let l=G(e).sourceCandidates(i,{minSimilarity:r,scanLimit:t.scanLimit,candidateMode:a});o=l.length;for(let u of l){if(u.symbol===i.symbol||u.tokens.size<3)continue;c+=1;let d=te(i.tokens,u.tokens);if(d.size<2){m+=1;continue}let p=new Set([...i.tokens,...u.tokens]),b=p.size>0?d.size/p.size:0;if(b<r){g+=1;continue}s.push({symbolA:i.symbol,shortNameA:v(i.symbol),fileA:i.file,symbolB:u.symbol,shortNameB:v(u.symbol),fileB:u.file,similarity:b,similarityBasis:"source-tokens",sharedCallees:[...d].sort(),uniqueToA:[...N(i.tokens,u.tokens)].sort(),uniqueToB:[...N(u.tokens,i.tokens)].sort(),...pe([...d],"source-tokens")})}return s.sort((u,d)=>d.similarity-u.similarity||u.shortNameB.localeCompare(d.shortNameB)),s.slice(0,t.limit)},()=>({symbol:i.symbol,file:i.file,targetTokens:i.tokens.size,candidateMode:a,candidates:o,comparedPairs:c,sharedSkips:m,similaritySkips:g,results:s.length}))}function pe(e,n){let t=e.flatMap(W),i=e.flatMap(b=>ae(b,n)),r=Z(t,be),s=Z(t,Se),a=Z(i,X),o=[...new Set(i.filter(oe))],c=e.filter(b=>{let C=ae(b,n);return C.some(h=>X.has(h))&&C.some(oe)}).length,m=[];r.length>0&&m.push(`access/query scaffolding: ${r.slice(0,5).join(", ")}`),s.length>0&&m.push(`framework/generic scaffolding: ${s.slice(0,5).join(", ")}`),a.length>0&&m.push(`domain behavior verbs: ${a.slice(0,5).join(", ")}`),a.length>0&&o.length>0&&m.push(`domain-specific terms: ${o.slice(0,5).join(", ")}`);let g=n==="source-tokens"&&t.length>0&&t.every(b=>ye.has(b));g&&m.push("shared source tokens are generic scaffolding");let f=a.length>0&&o.length>0,l=r.length+s.length>0,u=n==="callees"&&f&&e.length>=4&&o.length>=4&&c>=2,d=u?"domain-behavior":f?l?"mixed":"domain-behavior":r.length>0?"access-query-scaffolding":s.length>0||g?"framework-scaffolding":"structural-overlap";d==="structural-overlap"&&e.length>0&&m.push(`shared ${n} overlap has no recognized domain or scaffolding category`);let p=d==="domain-behavior"&&(e.length>=3||u)?"direct":"signal";return{evidenceClass:d,actionTier:p,evidenceClassReasons:m,recommendation:Ue(d,p)}}function Ue(e,n){return n==="direct"?"Shared domain behavior looks concrete; review for an extract/reuse opportunity.":e==="mixed"?"Shared evidence mixes domain behavior with scaffolding; review semantics before extracting anything.":e==="access-query-scaffolding"?"Shared evidence is mostly access/query scaffolding; compare product semantics before reusing code.":e==="structural-overlap"?"Shared structure has no domain or scaffolding classification; inspect names and behavior before reusing code.":"Shared evidence is mostly framework or generic scaffolding; treat as a contextual signal."}function Z(e,n){return[...new Set(e.filter(t=>n.has(t)))]}function W(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1)}function ae(e,n){if(n==="source-tokens")return W(e);let t=K(e);return W(t.length>0?t:He(e))}function He(e){return e.replace(/[()`]/g," ").replace(/\.[a-z][a-z0-9]+(?=\s|$)/gi," ").split(/[:/\\\s]+/).map(i=>i.trim()).filter(i=>/[A-Za-z]/.test(i)).at(-1)?.replace(/\.$/,"")??e}function oe(e){return e.length>3&&!X.has(e)&&!be.has(e)&&!Se.has(e)&&!ye.has(e)&&!Ke.has(e)}var X=new Set(["archive","assign","book","cancel","create","delete","ensure","export","import","notify","persist","publish","restore","schedule","send","set","submit","sync","update","upload","validate","write"]),be=new Set(["access","auth","authorize","cache","context","db","find","get","guard","list","permission","permissions","prisma","query","request","response","role","route","session","sql","where"]),Se=new Set(["bytes","computed","crypto","describe","effect","expect","fetch","filter","hex","hook","json","map","mounted","on","promise","random","react","reduce","ref","render","state","test","token","trim","uuid","vue","watch"]),ye=new Set(["bytes","crypto","data","false","get","hex","id","key","map","name","num","random","result","secret","set","string","to","token","true","type","value"]),Ke=new Set(["best","backend","conflict","database","effect","effects","error","errors","frontend","found","helpers","javascript","module","modules","scip","shared","source","typescript","utils","with","workflow","workflows"]);function Ve(e,n){let t=D(e,n);if(!t||!$(t.symbol))return null;let i=Ze(e,t);return i?{symbol:t.symbol,file:t.relativePath,tokens:i}:null}function Ze(e,n){let t=K(n.symbol),i=sn(e,n.relativePath,n.startLine,n.endLine,t),r=ke(i,t);return r.size>0?r:null}var We=z("source-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),Xe=z("source-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function he(e){return`${e.scanLimit??""}`}function Ce(e,n={}){let t=We.get(e,()=>new Map),i=he(n),r=t.get(i);return r||(r=rn(e,n),t.set(i,r)),r}function le(e,n={}){let t=Xe.get(e,()=>new Map),i=he(n),r=t.get(i);return r||(r=Je(Ce(e,n)),t.set(i,r)),r}function Je(e){let n=new Map;for(let r of e)for(let s of r.tokens)n.set(s,(n.get(s)??0)+1);let t=Math.max(8,Math.ceil(Math.sqrt(e.length))),i=new Map;for(let r of e)for(let s of r.tokens){if((n.get(s)??0)>t)continue;let a=i.get(s);a||(a=[],i.set(s,a)),a.push(r)}return{corpus:e,candidateByToken:i,docFreq:n,ubiquityThreshold:t}}function Ye(e,n){let t=new Map;for(let i of e.tokens)for(let r of n.candidateByToken.get(i)??[])r.symbol!==e.symbol&&t.set(r.symbol,r);return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Qe(e,n,t){let i=A(),r=new q(e),s=en(n.tokens.size,t.minSimilarity),a=0,o=0,c=0,m=y("similar.source-shape.target-files",()=>{let d=[...n.tokens],p=[];for(let b of Y(e,{includeIgnored:!1})){a+=1;let C=U(e,b);C&&(o+=1,nn(C,d,s)&&p.push(b))}return c=p.length,p},()=>({symbol:n.symbol,targetTokens:n.tokens.size,requiredSharedTokens:s,scannedFiles:a,readableFiles:o,candidateFiles:c})),g=0,f=y("similar.source-shape.target-definitions",()=>{let d=_(r.productionCallableDefinitions({files:m,sortByLocDesc:typeof t.scanLimit=="number"&&t.scanLimit>0}),t.scanLimit);return g=d.length,d},()=>({symbol:n.symbol,candidateFiles:c,scanLimit:t.scanLimit,definitionCount:g})),l=0;return y("similar.source-shape.target-fingerprints",()=>{let d=Fe(e,f);return i&&(l=d.length),d},()=>({symbol:n.symbol,definitionCount:g,fingerprintCount:l})).filter(d=>d.symbol!==n.symbol)}function en(e,n){return Math.max(2,Math.ceil(e*n))}function nn(e,n,t){if(n.length<t)return!1;let i=e.toLowerCase(),r=0;for(let s of n)if(tn(i,s)&&(r+=1,r>=t))return!0;return!1}function tn(e,n){return n==="num"?/\b\d+\b/.test(e):e.includes(n)}function rn(e,n={}){let t=new q(e),{scanLimit:i}=n,r=_(t.productionCallableDefinitions({sortByLocDesc:typeof i=="number"&&i>0}),i);return Fe(e,r)}function Fe(e,n){let t=new Map;for(let r of n){let s=t.get(r.relativePath)??[];s.push(r),t.set(r.relativePath,s)}let i=new Map;for(let[r,s]of t){let a=U(e,r);if(!a)continue;let o=J(e,r,a),c=on(e,r,o),m=!1,g=null;for(let f of s){let l=an(f),u=c.get(l),d=u?new Set(u.tokens):null;d||(g??=H(e,r),d=ke(xe(g,f.startLine,f.endLine,f.leaf),f.leaf),c.set(l,{key:l,symbol:f.symbol,startLine:f.startLine,endLine:f.endLine,leaf:f.leaf,tokens:[...d].sort()}),m=!0),d.size>0&&i.set(f.symbol,{symbol:f.symbol,file:f.relativePath,tokens:d})}m&&un(e,r,o,c)}return n.map(r=>i.get(r.symbol)).filter(r=>!!r)}function sn(e,n,t,i,r){let s=H(e,n);return s.length===0?"":xe(s,t,i,r)}function xe(e,n,t,i){if(t>=n&&t-n<=12)return e.slice(n,t+1).join(`
|
|
1
|
+
import{a as te,b as N,e as V,f as j,g as B,h as re,i as se}from"./chunk-NMTSZXCL.js";import{b as _}from"./chunk-B75HZHUP.js";import{c as q}from"./chunk-UHFZDQZJ.js";import{a as ie}from"./chunk-ETZBIG6K.js";import{b as ne}from"./chunk-2QJAVISG.js";import{a as D}from"./chunk-DOQLO74K.js";import{d as v,e as K,h as $}from"./chunk-TNLOX4TN.js";import{a as E}from"./chunk-RGBZDOUO.js";import{a as Y}from"./chunk-NRNVMB2R.js";import{h as z,l as J,t as Q,v as ee,w as U,x as H}from"./chunk-23AD24QZ.js";import{a as A,d as y}from"./chunk-3LCDIREB.js";function Ie(e,n,t={}){let{minSimilarity:i=.4,limit:r=20}=t,s=()=>Ge(e,n,{minSimilarity:i,limit:r,scanLimit:t.scanLimit,candidateMode:t.sourceCandidateMode??"full"}),a=Be(e,n,{semantic:t.semantic!==!1});if(a.kind==="not-callable")return[];if(a.kind==="callee-evidence-unusable")return s();let o=a.target;if(!$(o.symbol))return[];if(o.callees.size===0)return s();let c=we(e,o,i,{scanLimit:t.scanLimit,semantic:t.semantic!==!1});return c.length>0?c.slice(0,r):s()}function Tn(e,n,t,i={}){let r=D(e,n),s=D(e,t);if(!r||!s)return null;let a=Ie(e,r.symbol,{minSimilarity:0,limit:Number.POSITIVE_INFINITY,semantic:i.semantic,scanLimit:i.scanLimit}).find(m=>m.symbolB===s.symbol||m.symbolA===s.symbol);if(!a)return null;let o=r.endLine-r.startLine+1,c=s.endLine-s.startLine+1;return{symbolA:{symbol:r.symbol,shortName:v(r.symbol),file:r.relativePath,loc:o},symbolB:{symbol:s.symbol,shortName:v(s.symbol),file:s.relativePath,loc:c},similarity:a.similarity,similarityBasis:a.similarityBasis??"callees",sharedEvidence:a.sharedCallees,uniqueToA:a.uniqueToA,uniqueToB:a.uniqueToB,evidenceClass:a.evidenceClass,actionTier:a.actionTier,recommendation:a.recommendation,consolidationStrategy:ve(a)}}function ve(e){let n=e.similarityBasis==="source-tokens"?"source-token":"tracked callee";return e.sharedCallees.length===0?`No shared ${n} evidence survived similar's weighting. Inspect the source before attempting consolidation.`:e.uniqueToA.length===0&&e.uniqueToB.length===0?`The functions have identical ${n} evidence under similar's weighting. Verify signatures, guards, and return values before consolidating.`:e.uniqueToA.length===0?`A's ${n} evidence is a subset of B's. B may subsume part of A's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToB.length===0?`B's ${n} evidence is a subset of A's. A may subsume part of B's structure, but verify signatures, guards, and non-call logic first.`:e.uniqueToA.length<=2&&e.uniqueToB.length<=2?`Create a shared helper around the ${e.sharedCallees.length} shared ${n}(s). Pass the ${e.uniqueToA.length+e.uniqueToB.length} divergent point(s) as parameters or callbacks.`:`Extract the ${e.sharedCallees.length} shared ${n}(s) into a common helper. Keep each function's unique logic outside that helper (${e.uniqueToA.length} item(s) in A, ${e.uniqueToB.length} in B).`}function we(e,n,t,i){let r=G(e).calleeIndex({minCallees:3,scanLimit:i.scanLimit,semantic:i.semantic}),s=_e(n,r.corpus),a=Pe(s,r),o=Te(s,r),c=j(o),m=B(s.callees,o),g=[];for(let f of a){if(f.callees.size<3)continue;let l=B(f.callees,o),u=ce(s,f,o,{minSimilarity:t,requireSignificantShared:1,requireSharedCount:0,medianIdf:c,magnitudeA:m,magnitudeB:l});u&&g.push(u)}return g.sort((f,l)=>l.similarity-f.similarity),g}function Te(e,n){let t=new Map(n.docFreq);for(let i of e.callees)t.set(i,(t.get(i)??0)+1);return V(t,n.corpus.length+1)}function ce(e,n,t,i){let r=Le(e,n,t,i);if(!Re(r,i))return null;let{similarity:s,significantShared:a,trivialShared:o}=r,c=a.length>0?a:o,m=pe(c,"callees");return{symbolA:e.symbol,shortNameA:v(e.symbol),fileA:e.file,symbolB:n.symbol,shortNameB:v(n.symbol),fileB:n.file,similarity:s,similarityBasis:"callees",sharedCallees:c.map(v),uniqueToA:[...N(e.callees,n.callees)].map(v),uniqueToB:[...N(n.callees,e.callees)].map(v),...m}}function Me(e,n,t,i){let r=i.magnitudeA??B(e.callees,t),s=i.magnitudeB??B(n.callees,t),a=0,o=0,c=0,m=i.medianIdf??j(t);for(let l of e.callees){if(!n.callees.has(l))continue;let u=t.get(l)??0;a+=u*u,c+=1,u>=m&&(o+=1)}if(c===0)return!1;let g=r*s;return(g>0?a/g:0)<i.minSimilarity?!1:o>=i.requireSignificantShared||c>=i.requireSharedCount}function Le(e,n,t,i){return i.magnitudeA===void 0||i.magnitudeB===void 0?re(e.callees,n.callees,t,{medianIdf:i.medianIdf}):se(e.callees,n.callees,t,{medianIdf:i.medianIdf,magnitudeA:i.magnitudeA,magnitudeB:i.magnitudeB})}function Re(e,n){if(e.similarity<n.minSimilarity)return!1;let t=e.significantShared.length+e.trivialShared.length;return e.significantShared.length>=n.requireSignificantShared||t>=n.requireSharedCount}function Mn(e,n={}){let{minSimilarity:t=.5,limit:i=20,scope:r,minCallees:s=4,crossFileOnly:a=!1,scanLimit:o}=n,c=n.semantic!==!1,m=A(),g=0,f=0,l=0,u=0,d=0,p=0,b=0;return y("similar.all",()=>{let h=G(e).calleeIndex({minCallees:s,scope:r,scanLimit:o,semantic:c}),S=h.corpus;g=S.length;let F=n.focusFiles,I=[],P=0;return y("similar.all.pair-scan",()=>{for(let k=0;k<S.length;k+=1){let x=S[k],M=F?.has(x.file)??!1,w=h.weightedMagnitudes[k],T=new Set;for(let O of x.callees){let L=h.candidateIndexesByCallee.get(O);if(L)for(let R of L)R<=k||F&&!M&&!F.has(S[R].file)||T.add(R)}m&&(l+=T.size,T.size>0&&(f+=1));for(let O of T){let L=S[O];if(a&&x.file===L.file){m&&(d+=1);continue}if(ue(x,L)){m&&(p+=1);continue}m&&(u+=1);let R=ce(x,L,h.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:h.medianIdf,magnitudeA:w,magnitudeB:h.weightedMagnitudes[O]});R&&(Ae(I,R,i,P),m&&(b+=1),P+=1)}}},()=>({corpusSize:g,candidateSets:f,candidatePairs:l,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:b,topResults:I.length})),y("similar.all.sort-project",()=>(I.sort((k,x)=>x.result.similarity-k.result.similarity||k.order-x.order),I.map(k=>k.result)),()=>({topResults:I.length}))},()=>({minSimilarity:t,limit:i,scope:r,minCallees:s,crossFileOnly:a,scanLimit:o,semantic:c,corpusSize:g,candidateSets:f,candidatePairs:l,comparedPairs:u,crossFileSkips:d,signatureSkips:p,insertedResults:b}))}function Ln(e,n={}){let{minSimilarity:t=.5,scope:i,minCallees:r=4,crossFileOnly:s=!1,scanLimit:a}=n,o=n.semantic!==!1,c=A(),m=0,g=0,f=0,l=0,u=0,d=0,p=0;return y("similar.all-count",()=>{let C=G(e).calleeIndex({minCallees:r,scope:i,scanLimit:a,semantic:o}),h=C.corpus;m=h.length;let S=n.focusFiles;return y("similar.all-count.pair-scan",()=>{for(let F=0;F<h.length;F+=1){let I=h[F],P=S?.has(I.file)??!1,k=C.weightedMagnitudes[F],x=new Set;for(let M of I.callees){let w=C.candidateIndexesByCallee.get(M);if(w)for(let T of w)T<=F||S&&!P&&!S.has(h[T].file)||x.add(T)}c&&(f+=x.size,x.size>0&&(g+=1));for(let M of x){let w=h[M];if(s&&I.file===w.file){c&&(u+=1);continue}if(ue(I,w)){c&&(d+=1);continue}c&&(l+=1),Me(I,w,C.idfWeights,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4,medianIdf:C.medianIdf,magnitudeA:k,magnitudeB:C.weightedMagnitudes[M]})&&(p+=1)}}},()=>({corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:l,crossFileSkips:u,signatureSkips:d,insertedResults:p})),p},()=>({minSimilarity:t,scope:i,minCallees:r,crossFileOnly:s,scanLimit:a,semantic:o,corpusSize:m,candidateSets:g,candidatePairs:f,comparedPairs:l,crossFileSkips:u,signatureSkips:d,insertedResults:p}))}function ue(e,n){if(e.paramCount<0||n.paramCount<0)return!1;let t=Math.abs(e.paramCount-n.paramCount),i=Math.max(2,Math.ceil(Math.max(e.paramCount,n.paramCount)*.5));return t>i}var me=Q({kind:"source-fingerprints",invalidation:ee("source-fingerprints"),serialize:cn,deserialize:ln});function Ae(e,n,t,i){if(t<=0)return;if(e.length<t){e.push({result:n,order:i});return}let r=0;for(let a=1;a<e.length;a+=1){let o=e[a],c=e[r];(o.result.similarity<c.result.similarity||o.result.similarity===c.result.similarity&&o.order>c.order)&&(r=a)}let s=e[r];n.similarity<=s.result.similarity||(e[r]={result:n,order:i})}var Ee=["ScipDatabase#all","ScipDatabase#get","ScipDatabase#prepare","ScipDatabase#pathExclusionsFor","ScipDatabase#isIgnored","ScipDatabase#symbolNoiseFor","PerDbValue#get","PerDbValue#has",":storage:db:ScipDatabase:all",":storage:db:ScipDatabase:get",":storage:db:ScipDatabase:prepare",":storage:db:ScipDatabase:pathExclusionsFor",":storage:db:ScipDatabase:isIgnored",":storage:db:ScipDatabase:symbolNoiseFor",":storage:per-db-cache:PerDbValue:get",":storage:per-db-cache:PerDbValue:has"];function Be(e,n,t){let i=D(e,n);if(!i)return{kind:"not-callable"};if(!$(i.symbol))return{kind:"not-callable"};let r=new q(e),s=ne(e,i,{semantic:t.semantic,semanticEvidence:ie});return s.semanticIncomplete||s.semanticUnavailable?{kind:"callee-evidence-unusable"}:{kind:"resolved",target:{symbol:i.symbol,file:i.relativePath,callees:ge(s.rows.map(a=>a.symbol)),paramCount:r.callableSignature(i)?.paramCount??-1}}}var ze=z("callee-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),De=z("callee-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function de(e,n){let{minCallees:t,scope:i,excludeSymbol:r,scanLimit:s}=n,a=n.semantic!==!1,o=ze.get(e,()=>new Map),c=`${t}|${i??""}|${s??""}|${a}`,m=!0,g=0,f=0;return y("similar.callee-fingerprints.resolve",()=>{let l=o.get(c);if(m=l!==void 0,l||(l=Oe(e,{minCallees:t,scope:i,scanLimit:s,semantic:a}),o.set(c,l)),g=l.length,r===void 0)return l;let u=l.filter(d=>d.symbol!==r);return f=l.length-u.length,u},()=>({minCallees:t,scope:i,scanLimit:s,semantic:a,cacheHit:m,corpusSize:g,excludeSymbol:r!==void 0,excludedSymbols:f}))}function qe(e,n){let{minCallees:t,scope:i,scanLimit:r}=n,s=n.semantic!==!1,a=De.get(e,()=>new Map),o=`${t}|${i??""}|${r??""}|${s}`,c=!0,m=0,g=0,f=0;return y("similar.callee-index.resolve",()=>{let l=a.get(o);return c=l!==void 0,l||(l=Ne(de(e,{minCallees:t,scope:i,scanLimit:r,semantic:s})),a.set(o,l)),m=l.corpus.length,g=l.docFreq.size,f=l.candidateIndexesByCallee.size,l},()=>({minCallees:t,scope:i,scanLimit:r,semantic:s,cacheHit:c,corpusSize:m,indexedCallees:g,candidateBuckets:f}))}function G(e){return{calleeCorpus:n=>de(e,n),calleeIndex:n=>qe(e,n),sourceCorpus:(n={})=>Ce(e,n),sourceIndex:(n={})=>le(e,n),sourceCandidates:(n,t)=>(t.candidateMode??"full")==="target-pruned"?Qe(e,n,{minSimilarity:t.minSimilarity,scanLimit:t.scanLimit}):Ye(n,le(e,{scanLimit:t.scanLimit}))}}function Ne(e){let n=A(),t=0,i=y("similar.callee-index.doc-frequency",()=>{let l=new Map;for(let u of e)for(let d of u.callees)l.set(d,(l.get(d)??0)+1);return t=l.size,l},()=>({corpusSize:e.length,uniqueCallees:t})),r=Math.max(8,Math.ceil(Math.sqrt(e.length))),s=y("similar.callee-index.idf-weights",()=>V(i,e.length),()=>({corpusSize:e.length,uniqueCallees:i.size})),a=y("similar.callee-index.weighted-magnitudes",()=>e.map(l=>B(l.callees,s)),()=>({corpusSize:e.length})),o=0,c=0,m=0,g=y("similar.callee-index.candidate-buckets",()=>{let l=new Map;for(let u=0;u<e.length;u+=1){let d=e[u];for(let p of d.callees){if((i.get(p)??0)>r){n&&(c+=1);continue}let b=l.get(p);b||(b=[],l.set(p,b)),b.push(u),n&&(o+=1)}}return n&&(m=l.size),l},()=>({corpusSize:e.length,buckets:m,candidateRefs:o,ubiquitousSkips:c,ubiquityThreshold:r})),f=y("similar.callee-index.median-idf",()=>j(s),()=>({uniqueCallees:s.size}));return{corpus:e,candidateIndexesByCallee:g,docFreq:i,idfWeights:s,weightedMagnitudes:a,medianIdf:f,ubiquityThreshold:r}}function Pe(e,n){let t=new Map;for(let i of e.callees)for(let r of n.candidateIndexesByCallee.get(i)??[]){let s=n.corpus[r];s.symbol!==e.symbol&&t.set(s.symbol,s)}return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Oe(e,n){let{minCallees:t,scope:i,scanLimit:r,semantic:s}=n,a=A(),o=new q(e),c=0,m=y("similar.callee-fingerprints.candidates",()=>{let p=_(o.productionCallableDefinitions({scope:i,minLoc:5,sortByLocDesc:typeof r=="number"&&r>0}),r);return c=p.length,p},()=>({scope:i,scanLimit:r,candidateCount:c})),g=0,f=y("similar.callee-fingerprints.callee-map",()=>{let p=o.calleeEvidenceMap(m,{semantic:s});if(a)for(let b of p.rows.values())g+=b.length;return p},()=>({candidateCount:c,semantic:s,calleeEdges:g})),l=0,u=0,d=0;return y("similar.callee-fingerprints.shape",()=>{let b=m.filter(S=>!f.incompleteSymbolIds.has(S.symbolId)&&!f.unavailableSymbolIds.has(S.symbolId)).map(S=>({symbol:S.symbol,file:S.relativePath,callees:ge((f.rows.get(S.symbolId)??[]).map(F=>F.symbol)),paramCount:o.callableSignature(S)?.paramCount??-1})),C=$e(b);a&&(d=C.filter((S,F)=>S.callees.size!==b[F].callees.size).length);let h=C.filter(S=>S.callees.size>=t);return l=h.length,a&&(u=h.reduce((S,F)=>S+F.callees.size,0)),h},()=>({candidateCount:c,fingerprintCount:l,retainedCalleeCount:u,minCallees:t,siblingSaturatedFingerprints:d}))}var fe=5;function $e(e){let n=new Map;for(let t of e){let i=n.get(t.file);i||(i=new Map,n.set(t.file,i));for(let r of t.callees)i.set(r,(i.get(r)??0)+1)}return e.map(t=>{let i=n.get(t.file);if(!i)return t;let r=[...t.callees].filter(a=>(i.get(a)??0)>=fe);if(r.length===0)return t;let s=new Set(t.callees);for(let a of r)s.delete(a);return{...t,callees:s}})}function _e(e,n){let t=new Map;for(let s of n)if(!(s.file!==e.file||s.symbol===e.symbol))for(let a of s.callees)t.set(a,(t.get(a)??0)+1);let i=[...e.callees].filter(s=>(t.get(s)??0)+1>=fe);if(i.length===0)return e;let r=new Set(e.callees);for(let s of i)r.delete(s);return{...e,callees:r}}function ge(e){return new Set([...e].filter(n=>!je(n)))}function je(e){return Ee.some(n=>e.includes(n))}function Ge(e,n,t){let i=Ve(e,n);if(!i||i.tokens.size<3)return[];let r=t.minSimilarity>=.5?t.minSimilarity:.3,s=[],a=t.candidateMode??"full",o=0,c=0,m=0,g=0;return y("similar.source-shape",()=>{let l=G(e).sourceCandidates(i,{minSimilarity:r,scanLimit:t.scanLimit,candidateMode:a});o=l.length;for(let u of l){if(u.symbol===i.symbol||u.tokens.size<3)continue;c+=1;let d=te(i.tokens,u.tokens);if(d.size<2){m+=1;continue}let p=new Set([...i.tokens,...u.tokens]),b=p.size>0?d.size/p.size:0;if(b<r){g+=1;continue}s.push({symbolA:i.symbol,shortNameA:v(i.symbol),fileA:i.file,symbolB:u.symbol,shortNameB:v(u.symbol),fileB:u.file,similarity:b,similarityBasis:"source-tokens",sharedCallees:[...d].sort(),uniqueToA:[...N(i.tokens,u.tokens)].sort(),uniqueToB:[...N(u.tokens,i.tokens)].sort(),...pe([...d],"source-tokens")})}return s.sort((u,d)=>d.similarity-u.similarity||u.shortNameB.localeCompare(d.shortNameB)),s.slice(0,t.limit)},()=>({symbol:i.symbol,file:i.file,targetTokens:i.tokens.size,candidateMode:a,candidates:o,comparedPairs:c,sharedSkips:m,similaritySkips:g,results:s.length}))}function pe(e,n){let t=e.flatMap(W),i=e.flatMap(b=>ae(b,n)),r=Z(t,be),s=Z(t,Se),a=Z(i,X),o=[...new Set(i.filter(oe))],c=e.filter(b=>{let C=ae(b,n);return C.some(h=>X.has(h))&&C.some(oe)}).length,m=[];r.length>0&&m.push(`access/query scaffolding: ${r.slice(0,5).join(", ")}`),s.length>0&&m.push(`framework/generic scaffolding: ${s.slice(0,5).join(", ")}`),a.length>0&&m.push(`domain behavior verbs: ${a.slice(0,5).join(", ")}`),a.length>0&&o.length>0&&m.push(`domain-specific terms: ${o.slice(0,5).join(", ")}`);let g=n==="source-tokens"&&t.length>0&&t.every(b=>ye.has(b));g&&m.push("shared source tokens are generic scaffolding");let f=a.length>0&&o.length>0,l=r.length+s.length>0,u=n==="callees"&&f&&e.length>=4&&o.length>=4&&c>=2,d=u?"domain-behavior":f?l?"mixed":"domain-behavior":r.length>0?"access-query-scaffolding":s.length>0||g?"framework-scaffolding":"structural-overlap";d==="structural-overlap"&&e.length>0&&m.push(`shared ${n} overlap has no recognized domain or scaffolding category`);let p=d==="domain-behavior"&&(e.length>=3||u)?"direct":"signal";return{evidenceClass:d,actionTier:p,evidenceClassReasons:m,recommendation:Ue(d,p)}}function Ue(e,n){return n==="direct"?"Shared domain behavior looks concrete; review for an extract/reuse opportunity.":e==="mixed"?"Shared evidence mixes domain behavior with scaffolding; review semantics before extracting anything.":e==="access-query-scaffolding"?"Shared evidence is mostly access/query scaffolding; compare product semantics before reusing code.":e==="structural-overlap"?"Shared structure has no domain or scaffolding classification; inspect names and behavior before reusing code.":"Shared evidence is mostly framework or generic scaffolding; treat as a contextual signal."}function Z(e,n){return[...new Set(e.filter(t=>n.has(t)))]}function W(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>1)}function ae(e,n){if(n==="source-tokens")return W(e);let t=K(e);return W(t.length>0?t:He(e))}function He(e){return e.replace(/[()`]/g," ").replace(/\.[a-z][a-z0-9]+(?=\s|$)/gi," ").split(/[:/\\\s]+/).map(i=>i.trim()).filter(i=>/[A-Za-z]/.test(i)).at(-1)?.replace(/\.$/,"")??e}function oe(e){return e.length>3&&!X.has(e)&&!be.has(e)&&!Se.has(e)&&!ye.has(e)&&!Ke.has(e)}var X=new Set(["archive","assign","book","cancel","create","delete","ensure","export","import","notify","persist","publish","restore","schedule","send","set","submit","sync","update","upload","validate","write"]),be=new Set(["access","auth","authorize","cache","context","db","find","get","guard","list","permission","permissions","prisma","query","request","response","role","route","session","sql","where"]),Se=new Set(["bytes","computed","crypto","describe","effect","expect","fetch","filter","hex","hook","json","map","mounted","on","promise","random","react","reduce","ref","render","state","test","token","trim","uuid","vue","watch"]),ye=new Set(["bytes","crypto","data","false","get","hex","id","key","map","name","num","random","result","secret","set","string","to","token","true","type","value"]),Ke=new Set(["best","backend","conflict","database","effect","effects","error","errors","frontend","found","helpers","javascript","module","modules","scip","shared","source","typescript","utils","with","workflow","workflows"]);function Ve(e,n){let t=D(e,n);if(!t||!$(t.symbol))return null;let i=Ze(e,t);return i?{symbol:t.symbol,file:t.relativePath,tokens:i}:null}function Ze(e,n){let t=K(n.symbol),i=sn(e,n.relativePath,n.startLine,n.endLine,t),r=ke(i,t);return r.size>0?r:null}var We=z("source-fingerprint-corpus",{clearGroups:["whole-project","definition-catalog"]}),Xe=z("source-fingerprint-index",{clearGroups:["whole-project","definition-catalog"]});function he(e){return`${e.scanLimit??""}`}function Ce(e,n={}){let t=We.get(e,()=>new Map),i=he(n),r=t.get(i);return r||(r=rn(e,n),t.set(i,r)),r}function le(e,n={}){let t=Xe.get(e,()=>new Map),i=he(n),r=t.get(i);return r||(r=Je(Ce(e,n)),t.set(i,r)),r}function Je(e){let n=new Map;for(let r of e)for(let s of r.tokens)n.set(s,(n.get(s)??0)+1);let t=Math.max(8,Math.ceil(Math.sqrt(e.length))),i=new Map;for(let r of e)for(let s of r.tokens){if((n.get(s)??0)>t)continue;let a=i.get(s);a||(a=[],i.set(s,a)),a.push(r)}return{corpus:e,candidateByToken:i,docFreq:n,ubiquityThreshold:t}}function Ye(e,n){let t=new Map;for(let i of e.tokens)for(let r of n.candidateByToken.get(i)??[])r.symbol!==e.symbol&&t.set(r.symbol,r);return t.size>0?[...t.values()]:n.corpus.filter(i=>i.symbol!==e.symbol)}function Qe(e,n,t){let i=A(),r=new q(e),s=en(n.tokens.size,t.minSimilarity),a=0,o=0,c=0,m=y("similar.source-shape.target-files",()=>{let d=[...n.tokens],p=[];for(let b of Y(e,{includeIgnored:!1})){a+=1;let C=U(e,b);C&&(o+=1,nn(C,d,s)&&p.push(b))}return c=p.length,p},()=>({symbol:n.symbol,targetTokens:n.tokens.size,requiredSharedTokens:s,scannedFiles:a,readableFiles:o,candidateFiles:c})),g=0,f=y("similar.source-shape.target-definitions",()=>{let d=_(r.productionCallableDefinitions({files:m,sortByLocDesc:typeof t.scanLimit=="number"&&t.scanLimit>0}),t.scanLimit);return g=d.length,d},()=>({symbol:n.symbol,candidateFiles:c,scanLimit:t.scanLimit,definitionCount:g})),l=0;return y("similar.source-shape.target-fingerprints",()=>{let d=Fe(e,f);return i&&(l=d.length),d},()=>({symbol:n.symbol,definitionCount:g,fingerprintCount:l})).filter(d=>d.symbol!==n.symbol)}function en(e,n){return Math.max(2,Math.ceil(e*n))}function nn(e,n,t){if(n.length<t)return!1;let i=e.toLowerCase(),r=0;for(let s of n)if(tn(i,s)&&(r+=1,r>=t))return!0;return!1}function tn(e,n){return n==="num"?/\b\d+\b/.test(e):e.includes(n)}function rn(e,n={}){let t=new q(e),{scanLimit:i}=n,r=_(t.productionCallableDefinitions({sortByLocDesc:typeof i=="number"&&i>0}),i);return Fe(e,r)}function Fe(e,n){let t=new Map;for(let r of n){let s=t.get(r.relativePath)??[];s.push(r),t.set(r.relativePath,s)}let i=new Map;for(let[r,s]of t){let a=U(e,r);if(!a)continue;let o=J(e,r,a),c=on(e,r,o),m=!1,g=null;for(let f of s){let l=an(f),u=c.get(l),d=u?new Set(u.tokens):null;d||(g??=H(e,r),d=ke(xe(g,f.startLine,f.endLine,f.leaf),f.leaf),c.set(l,{key:l,symbol:f.symbol,startLine:f.startLine,endLine:f.endLine,leaf:f.leaf,tokens:[...d].sort()}),m=!0),d.size>0&&i.set(f.symbol,{symbol:f.symbol,file:f.relativePath,tokens:d})}m&&un(e,r,o,c)}return n.map(r=>i.get(r.symbol)).filter(r=>!!r)}function sn(e,n,t,i,r){let s=H(e,n);return s.length===0?"":xe(s,t,i,r)}function xe(e,n,t,i){if(t>=n&&t-n<=12)return e.slice(n,t+1).join(`
|
|
2
2
|
`);let r=[new RegExp(`\\bdef\\s+${E(i)}\\b`),new RegExp(`\\bfun\\s+${E(i)}\\b`),new RegExp(`\\bfn\\s+${E(i)}\\b`),new RegExp(`\\bfunction\\s+${E(i)}\\b`),new RegExp(`\\b${E(i)}\\s*\\(`)],s=e.findIndex(a=>r.some(o=>o.test(a)));if(s>=0){let a=s;for(let o=s+1;o<e.length&&o<=s+8;o++){let c=e[o]??"";if(o>s&&dn(c)||(a=o,c.trim()===""&&o>s+1))break}return e.slice(s,a+1).join(`
|
|
3
3
|
`)}return e.slice(n,Math.min(e.length,n+8)).join(`
|
|
4
4
|
`)}function an(e){return`${e.symbol}\0${e.startLine}\0${e.endLine}\0${e.leaf}`}function on(e,n,t){return me.read(e,n,t)??new Map}function ln(e){try{let n=JSON.parse(e);if(!Array.isArray(n.entries))return null;let t=new Map;for(let i of n.entries){if(!i||typeof i.key!="string"||typeof i.symbol!="string"||typeof i.startLine!="number"||typeof i.endLine!="number"||typeof i.leaf!="string"||!Array.isArray(i.tokens)||!i.tokens.every(r=>typeof r=="string"))return null;t.set(i.key,i)}return t}catch{return null}}function cn(e){let n={entries:[...e.values()].sort((t,i)=>t.key.localeCompare(i.key))};return JSON.stringify(n)}function un(e,n,t,i){me.write(e,n,t,new Map(i))}function ke(e,n){if(!e)return new Set;let t=new Set(["public","private","protected","final","static","class","def","fun","fn","function","return","string","bool","boolean","void","unit","self","this","new","const","let","var","end","pub"]),i=mn(n),s=e.replace(/["'`]/g," ").replace(/\b\d+\b/g," NUM ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9_]+/g," ").replace(/_/g," ").toLowerCase().split(/\s+/).map(a=>a.trim()).filter(a=>a.length>1).filter(a=>!t.has(a)).filter(a=>!i.has(a));return new Set(s)}function mn(e){return new Set(e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(n=>n.toLowerCase()).filter(n=>n.length>1))}function dn(e){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(e)}export{Ie as a,Tn as b,Te as c,ce as d,Mn as e,Ln as f,Ae as g,de as h,qe as i,G as j,Ne as k,Pe as l,fe as m,$e as n,ge as o,pe as p};
|
|
5
|
-
//# sourceMappingURL=chunk-
|
|
5
|
+
//# sourceMappingURL=chunk-66Q5VLH6.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as a}from"./chunk-
|
|
1
|
+
import{b as a}from"./chunk-MJX2J5QE.js";import{c as l}from"./chunk-UHFZDQZJ.js";import{d as o,g as i}from"./chunk-TNLOX4TN.js";function _(e,t){let r=a(e,t);return r.length===0?[]:u([...c(e,r),...f(e,r)]).filter(s=>!e.isIgnored(s.relative_path)).map(d)}function R(e,t){let r=a(e,t);return r.length===0?[]:u(c(e,r)).filter(s=>!e.isIgnored(s.relative_path)).map(s=>({...d(s),basis:"external-reference"}))}function c(e,t){let r=t.map(()=>"?").join(", ");return e.all(`SELECT DISTINCT d1.relative_path, gs.symbol
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents d1 ON c.document_id = d1.id
|
|
@@ -26,4 +26,4 @@ import{b as a}from"./chunk-LMTSB3TB.js";import{c as l}from"./chunk-HENP2O4A.js";
|
|
|
26
26
|
AND ${e.localSymbolPredicate}
|
|
27
27
|
${e.pathExclusionsFor("d1")}
|
|
28
28
|
ORDER BY d1.relative_path`,...t,...t,...t)}function f(e,t){let r=new l(e);return t.flatMap(s=>r.definitionsForFile(s).filter(n=>i(n.symbol)).map(n=>({relative_path:s,symbol:n.symbol})))}function u(e){let t=new Set;return e.filter(r=>{let s=`${r.relative_path}|${r.symbol}`;return t.has(s)?!1:(t.add(s),!0)})}function d(e){return{consumer:e.relative_path,symbol:e.symbol,shortName:o(e.symbol)}}export{_ as a,R as b};
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
29
|
+
//# sourceMappingURL=chunk-6CQPIIS7.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as O,p as A}from"./chunk-
|
|
1
|
+
import{o as O,p as A}from"./chunk-RGBZDOUO.js";import{a as P}from"./chunk-NRNVMB2R.js";import{g as F,k as S,m as _,u as C,v as N}from"./chunk-23AD24QZ.js";import{d as y}from"./chunk-3LCDIREB.js";var G=C({kind:"file-dependency-graph",invalidation:N("file-dependency-graph"),serialize:e=>JSON.stringify(e),deserialize:x}),I=F("file-dep-graph",{clearGroups:["whole-project"]});function U(e,n,t={}){let s=t.scipEdges??"all-references",i=t.sourceEdges??"imports-only",o=v(n,s,i);return I.get(e,o,()=>{let d=new Set(P(e,{includeIgnored:!1})),c=_(e),p=0,l=0,m=null,E=!1,a=0,h=0;return y("file-dep-graph.product",()=>{if(c){let r=G.read(e,o,c);if(r){E=!0;let f=R(r);return p=r.sourceFileCount,l=r.sourceEdgeCount,a=r.scipEdgeCount,h=f.size,m=r.sourceDependencyFingerprint,f}}let g=y("file-dep-graph.source-imports",()=>{let r=b(e,d,n,i);return p=r.files.length,l=r.edges.length,m=r.fingerprint,r},()=>({scope:n??null,sourceEdges:i,files:p,edges:l})),u=new Map,D=(r,f)=>j(e,u,d,r,f);y("file-dep-graph.scip-edges",()=>{for(let r of $(e,n,s))a+=1,D(r.from_file,r.to_file)},()=>({scope:n??null,edges:a}));for(let r of g.edges)D(r.fromFile,r.toFile);return h=u.size,c&&G.write(e,o,c,{sourceDependencyFingerprint:g.fingerprint,sourceFileCount:g.files.length,sourceEdgeCount:g.edges.length,scipEdgeCount:a,graph:w(u)}),u},()=>({scope:n??null,available:c!==null,hit:E,files:p,sourceEdges:l,sourceEdgeMode:i,scipEdges:a,graphFiles:h,sourceDependencyFingerprint:m}))})}function b(e,n,t,s){let i=[],o=[];for(let d of n)if(!(t&&!d.includes(t))){i.push(d);for(let c of A(e,d))c.sourcePath&&o.push({fromFile:d,toFile:c.sourcePath});if(s==="imports-and-reexports")for(let c of O(e,d))c.sourcePath&&o.push({fromFile:d,toFile:c.sourcePath})}return{files:i,edges:o,fingerprint:M(i,o)}}function M(e,n){let t=n.map(s=>`${s.fromFile}\0${s.toFile}`).sort();return S(JSON.stringify({files:e,edges:t}))}function v(e,n,t){return`edge-mode-v3:${n}:${t}:${e??"<all>"}`}function w(e){return[...e].map(([n,t])=>[n,[...t]])}function R(e){return new Map(e.graph.map(([n,t])=>[n,new Set(t)]))}function x(e){let n=JSON.parse(e);return k(n)?n:null}function k(e){if(!e||typeof e!="object")return!1;let n=e;return typeof n.sourceDependencyFingerprint=="string"&&typeof n.sourceFileCount=="number"&&typeof n.sourceEdgeCount=="number"&&typeof n.scipEdgeCount=="number"&&Array.isArray(n.graph)&&n.graph.every(J)}function J(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="string"&&Array.isArray(e[1])&&e[1].every(n=>typeof n=="string")}function $(e,n,t){let s=n?"AND d1.relative_path LIKE ?":"",i=n?[`%${n}%`]:[],o=t==="imports-only"?"AND m.role = 2":"AND m.role != 1";return e.all(`SELECT DISTINCT
|
|
2
2
|
d1.relative_path AS from_file,
|
|
3
3
|
d2.relative_path AS to_file
|
|
4
4
|
FROM mentions m
|
|
@@ -17,4 +17,4 @@ import{o as O,p as A}from"./chunk-F74LZWCE.js";import{a as P}from"./chunk-ICUL7X
|
|
|
17
17
|
${o}
|
|
18
18
|
${e.pathExclusionsFor("d1","d2")}
|
|
19
19
|
${s}`,...i)}function j(e,n,t,s,i){if(s===i||e.isIgnored(s)||e.isIgnored(i)||!t.has(i))return;let o=n.get(s);o||(o=new Set,n.set(s,o)),o.add(i)}export{U as a};
|
|
20
|
-
//# sourceMappingURL=chunk-
|
|
20
|
+
//# sourceMappingURL=chunk-6CTSFS7R.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as h}from"./chunk-B75HZHUP.js";import{a as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as h}from"./chunk-B75HZHUP.js";import{a as m}from"./chunk-ETZBIG6K.js";import{b,d as g}from"./chunk-2QJAVISG.js";import{a as u}from"./chunk-DOQLO74K.js";import{d as o,h as p}from"./chunk-TNLOX4TN.js";function N(n,a,f={}){let i=u(n,a);if(!i)return null;let l=f.semantic!==!1,c=g(n,i,{semantic:l,semanticEvidence:m}),S=c.rows.filter(e=>p(e.symbol)).slice(0,50),t=b(n,i,{limit:50,additive:!0,callableOnly:!0,semantic:l,semanticEvidence:m}),E=h(t.rows),d=S.map(e=>({symbol:e.symbol,shortName:o(e.symbol),file:e.file,relationship:e.source!=="caller-map-inversion"?"reference-candidate":e.callEvidence==="scip-chunk"?"chunk-candidate":"resolved-call",evidenceStrength:e.source==="caller-map-inversion"&&e.callEvidence!=="scip-chunk"?"exact":"candidate",evidenceSource:e.callEvidence??e.source})),v=E.map(e=>({symbol:e.symbol,shortName:o(e.symbol),file:e.file,relationship:e.source==="scip-chunk"?"chunk-candidate":"resolved-call",evidenceStrength:e.source==="scip-chunk"?"candidate":"exact",evidenceSource:e.source}));return{symbol:i.symbol,shortName:o(i.symbol),callers:d.map(({symbol:e,shortName:s,file:r})=>({symbol:e,shortName:s,file:r})),callees:v.map(({symbol:e,shortName:s,file:r})=>({symbol:e,shortName:s,file:r})),callerEvidence:d,calleeEvidence:v,coverage:{scope:"indexed-static-call-graph",blindSpots:["unresolved dynamic dispatch and reflection","external or unindexed callees without a resolved symbol identity","SCIP chunk co-occurrence is retained only as candidate call evidence",...c.semanticIncomplete?["compiler-resolved incoming evidence was incomplete; known callers are retained"]:[],...c.semanticUnavailable?["compiler-resolved incoming evidence was unavailable; known callers are retained"]:[],...t.semanticIncomplete?["compiler-resolved outgoing evidence was incomplete; known callees are retained"]:[],...t.semanticUnavailable?["compiler-resolved outgoing evidence was unavailable; known callees are retained"]:[]],semanticEvidence:{enabled:l,incoming:y(l,c),outgoing:y(l,t)}}}}function y(n,a){return n?a.semanticIncomplete&&a.semanticUnavailable?"incomplete-and-unavailable":a.semanticIncomplete?"incomplete":a.semanticUnavailable?"unavailable":"complete":"disabled"}export{N as a};
|
|
2
|
+
//# sourceMappingURL=chunk-6EBUAKJT.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{isAbsolute as ee,relative as Te}from"path";var g=class extends Error{constructor(r,n){super(`refusing unsafe project file path ${JSON.stringify(r)} (${n})`);this.relativePath=r;this.reason=n;this.name="UnsafeProjectPathError"}relativePath;reason;code="CODEBASEIQ_UNSAFE_PROJECT_PATH"};function _(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function Xt(e){return e.replace(/\\/g,"/")}function Kt(e,t){return _(e)===_(t)}function Z(e){let t=e.trim();if(!/^file:/i.test(t))return t;let r;try{r=new URL(t)}catch{return t}if(r.protocol!=="file:")return t;let n;try{n=decodeURIComponent(r.pathname)}catch{return t}for(n=n.replace(/\\/g,"/");n.length>1&&n.endsWith("/");)n=n.slice(0,-1);let o=/^\/([A-Za-z]):(\/|$)/.exec(n);o&&(n=`/${o[1].toUpperCase()}:${n.slice(3)}`);let i=n.split("/").map(s=>encodeURIComponent(s).replace(/%3A/gi,":")).join("/");return`file://${r.host}${i}`}function Yt(e,t){return Z(e)===Z(t)}function N(e,t){let r=Te(e,t);return r===""||!r.startsWith("..")&&!ee(r)}function te(e){if(!e)throw new g(e,"empty-path");if(e.includes("\0"))throw new g(e,"nul-byte");if(ee(e)||/^[A-Za-z]:/.test(e)||e.startsWith("//")||e.startsWith("\\\\"))throw new g(e,"absolute-path");let t=_(e);if(t.split("/").some(n=>n===".."))throw new g(e,"parent-traversal");if(!t||t===".")throw new g(e,"empty-path");return t}function Be(e,t,r=[]){let n=T(e);if(se.has(n)||r.some(i=>E(n,i))||t.some(i=>ae(n,i)))return"config";if(t.some(ue)&&/\.d\.(?:ts|mts|cts)$/.test(n.toLowerCase()))return"ambient";let o=ce(n);return t.some(i=>(de[i]??[]).includes(o))?"source":"other"}function Zt(e,t,r){let n=T(e);if(se.has(n)||r?.some(i=>E(n,i))||ae(n,t)||ue(t)&&/\.d\.(?:ts|mts|cts)$/.test(n.toLowerCase()))return!0;let o=ce(n);return(de[t]??[]).includes(o)}function er(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.version!="number"||!re(t.languages)||typeof t.pnpmWorkspaces!="boolean"||typeof t.typescriptProjectMode!="string"||!re(t.typescriptProjects)||t.clojureConfigPath!==void 0&&typeof t.clojureConfigPath!="string"||!Array.isArray(t.files)||!t.files.every(M)?null:t}function tr(e,t){let r=new Map((e?.files??[]).map(a=>[a.path,a])),n=new Map(t.files.map(a=>[a.path,a])),o=new Set([...r.keys(),...n.keys()]),i=[];for(let a of[...o].sort()){let u=r.get(a),c=n.get(a),x=Be(a,t.languages);!u&&c?i.push({kind:"added",path:a,inputKind:x,after:c}):u&&!c?i.push({kind:"deleted",path:a,inputKind:x,before:u}):u&&c&&(u.hash!==c.hash||u.size!==c.size)&&i.push({kind:"modified",path:a,inputKind:x,before:u,after:c})}let s=new Set;return e||s.add("prior-snapshot-unavailable"),e&&e.version!==t.version&&s.add("snapshot-version-changed"),(ne(e?.files??[])||ne(t.files))&&s.add("duplicate-input-path"),[...e?.files??[],...t.files].some(Ge)&&s.add("unreadable-input"),{version:1,changes:i,projectIdentityChanged:e?!We(e,t):!0,uncertainty:[...s].sort()}}function re(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function ne(e){return new Set(e.map(t=>t.path)).size!==e.length}function M(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.path=="string"&&typeof t.size=="number"&&Number.isFinite(t.size)&&typeof t.hash=="string"}function Ge(e){return e.hash==="unreadable"||e.size<0}function We(e,t){return ie(e.languages,t.languages)&&e.pnpmWorkspaces===t.pnpmWorkspaces&&e.typescriptProjectMode===t.typescriptProjectMode&&ie(e.typescriptProjects,t.typescriptProjects)&&e.clojureConfigPath===t.clojureConfigPath}function ie(e,t){if(e.length!==t.length)return!1;let r=[...e].sort(),n=[...t].sort();return r.every((o,i)=>o===n[i])}var se=new Set([".codebaseiq.json"]),$e={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"]},Ue={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:[]},oe=new Map;function ae(e,t){return $e[t].some(r=>E(e,r))||Ue[t].some(r=>E(e,r))}function E(e,t){let r=T(t).replace(/^\.\//,"");if(!r)return!1;let n=e.split("/").at(-1)??e,o=r.includes("/")?e:n;if(!r.includes("*")&&!r.includes("?"))return o===r;let i=oe.get(r);if(!i){let s=r.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/\?/g,"[^/]");i=new RegExp(`^${s}$`),oe.set(r,i)}return i.test(o)}function T(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function ce(e){return e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:""}function ue(e){return e==="typescript"||e==="javascript"}var de={typescript:[".ts",".tsx",".mts",".cts"],javascript:[".js",".jsx",".mjs",".cjs",".vue"],java:[".java"],scala:[".scala"],kotlin:[".kt",".kts"],rust:[".rs"],python:[".py",".pyi"],ruby:[".rb"],go:[".go"],cpp:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"],c:[".c",".h"],csharp:[".cs"],vb:[".vb"],dart:[".dart"],php:[".php"],clojure:[".clj",".cljs",".cljc"]};function f(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function pe(e){return typeof e=="string"&&Number.isFinite(Date.parse(e))}function nr(e){return typeof e=="string"&&e.length>0}function ir(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function or(e){return typeof e=="string"&&e.length>0&&e.length<=256&&!/[\0\r\n]/u.test(e)}function sr(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0}var le=["typescript","javascript","java","scala","kotlin","rust","python","ruby","go","cpp","c","csharp","vb","dart","php","clojure"];var B=2,m=3;var G=new Set(le);function gr(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch(s){return{kind:"malformed",reason:`invalid JSON: ${Ke(s)}`}}if(!f(t))return{kind:"malformed",reason:"metadata must be a JSON object"};let r=t.version;if(!Number.isInteger(r))return{kind:"malformed",reason:"version must be an integer"};if(r!==B&&r!==m)return{kind:"unsupported",version:r,direction:r<B?"older":"future"};let n=Ve(t,r);if(n)return{kind:"malformed",reason:n};let o=t,i={metadata:o,capabilities:ze(o)};return r===B?{kind:"legacy",...i,metadata:o}:{kind:"supported",...i,metadata:o}}function fr(e){return e.kind==="legacy"||e.kind==="supported"?e.metadata:null}function yr(e){if(e.kind!=="legacy"&&e.kind!=="supported"||!e.capabilities.stableGenerationIdentity)return null;let t=e.metadata;return JSON.stringify({version:t.version,status:t.status,updatedAt:t.updatedAt,fingerprint:t.fingerprint,indexedLanguages:t.indexedLanguages,scipCompanion:t.scipCompanion,sqliteLayoutVersion:t.version===m?t.sqliteLayoutVersion:void 0})}function ze(e){let t=e.fingerprint!==void 0,r=f(e.fingerprint),n=e.indexedLanguages!==void 0,o=e.status==="complete",i=e.version===m?e:null;return{usableForQuery:n,usableForEvidenceCache:t,publishableGeneration:o&&r&&n,stableGenerationIdentity:o&&t&&typeof e.updatedAt=="string",languageShardReuse:!!i?.languageFingerprints,typescriptProjectShardReuse:!!i?.typescriptProjectShards}}function Ve(e,t){if(e.status!=="complete"&&e.status!=="partial")return"status must be complete or partial";if(e.updatedAt!==void 0&&!pe(e.updatedAt))return"updatedAt must be a valid timestamp";for(let r of["requestedLanguages","indexedLanguages"])if(e[r]!==void 0&&!qe(e[r]))return`${r} must contain unique supported languages`;return e.skipped!==void 0&&!He(e.skipped)?"skipped must contain supported language/reason pairs":e.scipCompanion!==void 0&&e.scipCompanion!=="current"&&e.scipCompanion!=="deferred"?"scipCompanion must be current or deferred":t===m&&e.sqliteLayoutVersion!==void 0&&(!Number.isSafeInteger(e.sqliteLayoutVersion)||e.sqliteLayoutVersion<1)?"sqliteLayoutVersion must be a positive safe integer":t===m&&e.languageFingerprints!==void 0&&!Je(e.languageFingerprints)?"languageFingerprints must map supported languages to fingerprint objects":t===m&&e.typescriptProjectShards!==void 0&&!Xe(e.typescriptProjectShards)?"typescriptProjectShards must map project names to file fingerprints":null}function mr(e){return e.version===m&&e.sqliteLayoutVersion===2}function qe(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string"&&G.has(t))?!1:new Set(e).size===e.length}function He(e){return Array.isArray(e)&&e.every(t=>f(t)&&typeof t.language=="string"&&G.has(t.language)&&typeof t.reason=="string")}function Je(e){return f(e)&&Object.entries(e).every(([t,r])=>G.has(t)&&f(r))}function Xe(e){return f(e)&&Object.values(e).every(t=>f(t)&&Array.isArray(t.files)&&t.files.every(M))}function Ke(e){return e instanceof Error?e.message:String(e)}import{closeSync as W,fstatSync as w,openSync as $,readFileSync as Ye,readSync as ge}from"fs";import{createHash as Qe}from"crypto";var fe=8*1024*1024,Ze=64*1024*1024,et=512*1024*1024,tt=256*1024*1024,y=class extends Error{constructor(r,n,o,i,s){let a=o==="too-large"?`is ${i} bytes; the safety limit is ${s} bytes`:o==="not-regular"?"is not a regular file":"changed while it was being read";super(`${r} ${JSON.stringify(n)} ${a}`);this.inputKind=r;this.inputPath=n;this.reason=o;this.observedBytes=i;this.limitBytes=s;this.name="BoundedFileReadError"}inputKind;inputPath;reason;observedBytes;limitBytes;code="CODEBASEIQ_BOUNDED_FILE_READ"};function ye(e,t){V(t.maxBytes);let r=String(e),n=$(e,"r");try{let o=w(n);be(o,t,r);let i=Ye(n),s=w(n);if(s.dev!==o.dev||s.ino!==o.ino||s.size!==o.size||i.byteLength!==o.size)throw new y(t.inputKind,r,"changed-during-read",s.size,t.maxBytes);return i}finally{W(n)}}function me(e,t,r="utf8"){return ye(e,t).toString(r)}function U(e,t){return me(e,{maxBytes:fe,inputKind:t})}function z(e,t){V(t.maxBytes);let r=[],n=Buffer.allocUnsafe(64*1024),o=0;for(;;){let i=ge(e,n,0,n.length,null);if(i===0)break;if(o+=i,!Number.isSafeInteger(o)||o>t.maxBytes)throw new y(t.inputKind,`file descriptor ${e}`,"too-large",o,t.maxBytes);r.push(Buffer.from(n.subarray(0,i)))}return Buffer.concat(r,o)}function rt(e,t,r="utf8"){return z(e,t).toString(r)}function he(e,t){let r=$(e,"r");try{return z(r,t)}finally{W(r)}}function nt(e,t,r="utf8"){return he(e,t).toString(r)}function xe(e,t,r){V(t.maxBytes);let n=String(e),o=$(e,"r");try{let i=w(o);be(i,t,n);let s=Buffer.allocUnsafe(Math.min(1024*1024,Math.max(1,i.size))),a=0;for(;a<i.size;){let c=ge(o,s,0,Math.min(s.length,i.size-a),a);if(c===0)break;r(s.subarray(0,c)),a+=c}let u=w(o);if(u.dev!==i.dev||u.ino!==i.ino||u.size!==i.size||a!==i.size)throw new y(t.inputKind,n,"changed-during-read",u.size,t.maxBytes);return a}finally{W(o)}}function it(e,t){let r=Qe("sha256");return xe(e,t,n=>r.update(n)),r.digest("hex")}function be(e,t,r){if(!e.isFile())throw new y(t.inputKind,r,"not-regular",Number(e.size),t.maxBytes);if(e.size>t.maxBytes)throw new y(t.inputKind,r,"too-large",Number(e.size),t.maxBytes)}function V(e){if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`maxBytes must be a non-negative safe integer; received ${e}`)}import{createHash as Pe,randomUUID as ft}from"crypto";import{chmodSync as je,existsSync as h,linkSync as yt,lstatSync as A,readdirSync as X,realpathSync as p,unlinkSync as mt,writeSync as ht}from"fs";import{homedir as xt}from"os";import{basename as bt,dirname as v,isAbsolute as Ee,join as d,resolve as I}from"path";import{closeSync as ot,existsSync as st,fsyncSync as at,mkdirSync as ct,openSync as ut}from"fs";import{dirname as Ce}from"path";function Se(e,t,r,n){let o=0;for(;o<t.length;){let i=r.writeFile(e,t,o,t.length-o);if(!Number.isSafeInteger(i)||i<=0||i>t.length-o)throw new Error(`${n} write did not make valid forward progress`);o+=i}}function q(e,t){if(t!=="win32")return!1;let r=e.code;return r==="EACCES"||r==="EBADF"||r==="EINVAL"||r==="EISDIR"||r==="EPERM"}var S=Object.freeze({platform:process.platform,pathExists:e=>st(e),makeDirectory:e=>ct(e,{recursive:!0}),openFile:(e,t,r)=>ut(e,t,r),syncFile:e=>at(e),closeFile:e=>ot(e)});function Re(e,t=S){let r=[],n=e;for(;!t.pathExists(n);){r.push(n);let i=Ce(n);if(i===n)throw new Error(`Cannot establish a durable directory path without an existing ancestor: ${e}`);n=i}let o="synced";for(let i of r.reverse())t.makeDirectory(i),o=j(o,P(Ce(i),t));return o}function P(e,t=S){let r;try{r=t.openFile(e,"r")}catch(n){if(q(n,t.platform))return"unsupported";throw n}try{t.syncFile(r)}catch(n){try{t.closeFile(r)}catch{}if(q(n,t.platform))return"unsupported";throw n}return t.closeFile(r),"synced"}function j(...e){return e.every(t=>t==="not-requested")?"not-requested":e.includes("unsupported")?"unsupported":"synced"}import{createRequire as dt}from"module";var pt=dt(import.meta.url),ke=lt().version;function lt(){for(let e of["../package.json","../../package.json"])try{return pt(e)}catch{}return{version:"0.0.0"}}var gt="CODEBASEIQ_READ_ONLY";function H(e=process.env){let t=e[gt]?.trim().toLowerCase();return t==="1"||t==="true"}var De=1,R=".codebaseiq-cache-owner.json",St=16*1024,Ae=Object.freeze({...S,randomToken:()=>ft(),linkFile:(e,t)=>yt(e,t),removeFile:e=>mt(e),writeFile:(e,t,r,n)=>ht(e,t,r,n)});function D(e,t){return Object.assign(new Error(`refusing unsafe project dbPath ${JSON.stringify(e)} (${t}); use a repository-relative directory that remains inside the checkout`),{name:"UnsafeCachePathError",code:"CODEBASEIQ_UNSAFE_CACHE_PATH",configuredPath:e,reason:t})}function l(e,t){return Object.assign(new Error(`refusing unowned cache directory ${JSON.stringify(e)} (${t}); move unrelated data elsewhere or choose a new empty dbPath`),{name:"CacheOwnershipError",code:"CODEBASEIQ_CACHE_OWNERSHIP",cacheDir:e,reason:t})}function Ct(e,t){let r=p(e),n=Rt(r,t);return H()?n:Et(r,n)}function Rt(e,t){let r=p(e),n=process.env.CODEBASEIQ_CACHE_DIR;return n?I(n):t?.dbPath?Pt(r,t.dbPath):kt(r)}function ve(){let e=process.env.XDG_CACHE_HOME;return d(e||d(xt(),".cache"),"codebaseiq")}function kt(e){let t=I(e);try{t=p(t)}catch{}let r=Pe("sha256").update(t).digest("hex").slice(0,12);return d(ve(),"projects",r)}function Ur(e){if(!/^[a-f0-9]{24}$/.test(e))throw new Error(`invalid repository cache identity: ${e}`);let t=d(ve(),"repositories",e);return Fe(t),p(t)}function zr(e){return!H()&&process.env.CODEBASEIQ_SHARED_CACHE!=="0"&&!process.env.CODEBASEIQ_CACHE_DIR&&!process.env.CODEBASEIQ_INDEX_DB&&!e?.dbPath}function Vr(e,t){let r=Ct(e,t);return{cacheDir:r,dbPath:d(r,"index.db"),indexPath:d(r,"index.scip"),metaPath:d(r,"meta.json")}}function Et(e,t,r=Ae){return wt(e,t,r).cacheDir}function wt(e,t,r=Ae){let n=p(e),o=h(t)?"synced":Fe(t,r),i=p(t),s=d(i,R);if(h(s))return J(n,i),K(s),C(i),{kind:"existing",cacheDir:i};we(i),It(i),we(i);let u=`${JSON.stringify({schemaVersion:De,canonicalProjectRoot:n,canonicalCacheDir:i,creatorVersion:ke},null,2)}
|
|
2
|
+
`;try{let c=Ot(s,u,r),x=j(o,c);return{kind:"published",cacheDir:i,achievedDurability:x==="synced"?"directory-durable":"file-flushed",directorySync:x}}catch(c){if(Lt(c))return J(n,i),{kind:"existing",cacheDir:i};throw c}}function J(e,t){let r=p(e),n=p(t);return Dt(n,r,n)}function qr(e,t){return h(d(t,R))?(J(e,t),Ie(t),!0):!1}function Pt(e,t){let r;try{r=te(t)}catch(s){throw s instanceof g?D(t,s.reason):s}let n=I(e,...r.split("/"));if(n===e||!N(e,n))throw D(t,"outside-project");let o=jt(n),i=p(o);if(!N(e,i)&&i!==e)throw D(t,"symlink-escape");return n}function jt(e){let t=e;for(;!h(t);){let r=v(t);if(r===t)throw D(e,"no-existing-ancestor");t=r}return t}function Dt(e,t,r){let n=d(e,R);if(!h(n)||A(n).isSymbolicLink())throw l(e,"missing regular ownership record");let o=A(n);if(!o.isFile()||o.size>St)throw l(e,"invalid ownership record file");let i=U(n,"cache ownership record"),s=At(i,e);if(s.canonicalProjectRoot!==t)throw l(e,"ownership record belongs to a different project");if(s.canonicalCacheDir!==r)throw l(e,"ownership record names a different cache directory");return{record:s,ownerSha256:Pe("sha256").update(i).digest("hex"),physicalCacheDir:e}}function At(e,t){try{let r=JSON.parse(e);if(r.schemaVersion!==De||typeof r.canonicalProjectRoot!="string"||typeof r.canonicalCacheDir!="string"||typeof r.creatorVersion!="string"||!Ee(r.canonicalProjectRoot)||!Ee(r.canonicalCacheDir))throw new Error("invalid fields");return r}catch(r){throw l(t,`malformed ownership record: ${r instanceof Error?r.message:String(r)}`)}}function we(e){let t=X(e).filter(r=>r!==R&&!vt(r));if(t.length>0)throw l(e,`unrecognized existing entries: ${t.slice(0,3).join(", ")}`)}function vt(e){return e.startsWith(`${R}.tmp-`)||[".codebaseiq-generations","affected-shadow-latest.json","affected-shadow.jsonl","agent-hooks","augment-vue-meta.json","cache-lifecycle.lock","evidence.db","evidence.db-shm","evidence.db-wal","health-report-cache.json","index.db","index.db-shm","index.db-wal","index.lock","index.scip","language-indexes","meta.json","reindex-activity.jsonl","shared-cache.json","typescript-index","typescript-scip-fragments","typescript-scip-overlays","typescript-semantic","watch-activity.json","watch-refresh-requests","watch-state.json","watch.lock"].includes(e)?!0:/^(?:reindex-|rust-|typescript-)/.test(e)}function It(e){for(let t of X(e)){let r=d(e,t);try{let n=A(r);if(n.isSymbolicLink())throw l(e,`legacy cache entry ${t} is a symlink`);if(n.isDirectory())C(r);else if(n.isFile())K(r);else throw l(e,`legacy cache entry ${t} is not a file or directory`)}catch(n){if(Oe(n))continue;throw n}}C(e)}function Ie(e,t=!1){try{let r=A(e);if(r.isSymbolicLink())throw l(e,"managed cache tree contains a symlink");if(r.isFile()){K(e);return}if(!r.isDirectory())throw l(e,"managed cache tree contains a special file");C(e);for(let n of X(e))Ie(d(e,n),!0)}catch(r){if(t&&Oe(r))return;throw r}}function Oe(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}function Fe(e,t=S){let r=Re(e,t);return C(e),r}function Ot(e,t,r){let n=`${e}.tmp-${process.pid}-${r.randomToken()}`,o,i=!1;try{o=r.openFile(n,"wx",384),i=!0,Se(o,Buffer.from(t),r,"cache ownership record"),r.syncFile(o),r.closeFile(o),o=void 0,r.linkFile(n,e);let s=P(v(e),r);return r.removeFile(n),i=!1,j(s,P(v(e),r))}finally{if(o!==void 0)try{r.closeFile(o)}catch{}if(i)try{r.removeFile(n)}catch{}}}function C(e){process.platform!=="win32"&&je(e,448)}function K(e){process.platform!=="win32"&&je(e,384)}function Ft(e){if(h(e))return p(e);let t=[],r=e;for(;;){let n=v(r);if(n===r)return e;if(t.unshift(bt(r)),h(n))return d(p(n),...t);r=n}}function Hr(e){return Ft(I(e))}function Lt(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="EEXIST"}import{spawnSync as _e}from"child_process";import{createHash as _t}from"crypto";import{existsSync as Nt,lstatSync as Mt,realpathSync as Tt}from"fs";import{dirname as Bt,isAbsolute as Gt,join as Wt,resolve as F}from"path";function Ne(){return{...process.env,GIT_OPTIONAL_LOCKS:"0",LC_ALL:"C"}}var L={run(e,t){let r=Le(e,t);return r.kind==="success"?r.output:void 0},runResult:Le},$t=["rev-parse","--show-toplevel","--absolute-git-dir","--git-common-dir","HEAD","HEAD^{tree}"],k=/^[0-9a-f]{40,64}$/;function Zr(e,t,r){if(!k.test(t.replace(/\^$/,"")))return[];let n=_e("git",["log","--first-parent",`--max-count=${r}`,"--format=%T",t,"--"],{cwd:e,encoding:"utf8",env:Ne(),timeout:3e4,windowsHide:!0});return n.status!==0?[]:n.stdout.split(/\r?\n/).filter(o=>k.test(o))}function en(e,t,r=L){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"||!k.test(n.output))throw new Error(`Git revision ${JSON.stringify(t)} does not resolve to exactly one commit.`);return n.output}function tn(e,t=L){let r=t.runResult(e,$t);if(r.kind==="success"){let n=Ut(r.output);if(n)return zt(n,t)}return Vt(e,t)}function Ut(e){let t=e.split(`
|
|
3
|
+
`).map(u=>u.trim());if(t.length!==5)return;let[r,n,o,i,s]=t;if(!r||!n||!o||!i||!s||!k.test(i)||!k.test(s))return;let a=b(r);return{root:a,gitDir:b(O(a,n)),commonDir:b(O(a,o)),headCommit:i,treeOid:s}}function zt(e,t){let r=t.run(e.root,["status","--porcelain=v1","-z","--untracked-files=all"]);return r===void 0?void 0:{...Me(e.root,e.gitDir),commonDir:e.commonDir,repositoryId:Q("repository",e.commonDir),headCommit:e.headCommit,treeOid:e.treeOid,clean:r.length===0}}function Vt(e,t){let r=qt(e,t);if(r.kind!=="worktree")return;let n=r.identity,o=n.projectRoot,i=t.run(o,["rev-parse","--git-common-dir"])?.trim();if(!i)return;let s=b(O(o,i)),a=Y(t.run(o,["rev-parse","--verify","HEAD"])),u=Y(t.run(o,["rev-parse","--verify","HEAD^{tree}"])),c=t.run(o,["status","--porcelain=v1","-z","--untracked-files=all"]);if(c!==void 0)return{...n,commonDir:s,repositoryId:Q("repository",s),headCommit:a,treeOid:u,clean:c.length===0}}function qt(e,t=L){let r=t.runResult(e,["rev-parse","--show-toplevel"]);if(r.kind==="not-repository")return{kind:"non-git"};if(r.kind==="error")return r;let n=r.output.trim();if(!n)return{kind:"error",message:"Git returned an empty worktree root."};let o=b(n),i=t.run(o,["rev-parse","--absolute-git-dir"])?.trim();if(!i)return{kind:"error",message:"Git did not return an absolute worktree directory."};let s=b(O(o,i));return{kind:"worktree",identity:Me(o,s)}}function Me(e,t){return{projectRoot:e,gitDir:t,worktreeId:Q("worktree",`${e}\0${t}`)}}function rn(e,t,r=L){return Y(r.run(e,t))}function O(e,t){return Gt(t)?t:F(e,t)}function b(e){try{return Tt(e)}catch{return F(e)}}function Q(e,t){return _t("sha256").update(`${e}\0${t}`).digest("hex").slice(0,24)}function Y(e){return e?.trim()||void 0}function Le(e,t){let r=_e("git",["-C",e,...t],{encoding:"utf-8",env:Ne(),maxBuffer:52428800,stdio:["ignore","pipe","pipe"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL"});if(r.status===0)return{kind:"success",output:r.stdout.trimEnd()};let o=(typeof r.stderr=="string"?r.stderr.trim():"")||r.error?.message||`git exited with status ${r.status??"unknown"}`,i=r.error?.code;return(/not a git repository/i.test(o)||i==="ENOENT"&&Nt(F(e)))&&!Ht(e)?{kind:"not-repository"}:{kind:"error",message:o}}function Ht(e){if(process.env.GIT_DIR||process.env.GIT_COMMON_DIR)return!0;let t=F(e);for(;;){try{return Mt(Wt(t,".git")),!0}catch(n){let o=n.code;if(o!=="ENOENT"&&o!=="ENOTDIR")return!0}let r=Bt(t);if(r===t)return!1;t=r}}export{g as a,_ as b,Xt as c,Kt as d,Z as e,Yt as f,N as g,te as h,Be as i,Zt as j,er as k,tr as l,$e as m,f as n,pe as o,nr as p,ir as q,or as r,sr as s,le as t,m as u,gr as v,fr as w,yr as x,ze as y,mr as z,fe as A,Ze as B,et as C,tt as D,y as E,ye as F,me as G,U as H,rt as I,nt as J,xe as K,it as L,Se as M,q as N,S as O,Re as P,P as Q,j as R,H as S,ke as T,Rt as U,ve as V,kt as W,Ur as X,zr as Y,Vr as Z,qr as _,Hr as $,Ne as aa,L as ba,Zr as ca,en as da,tn as ea,rn as fa,O as ga,b as ha};
|
|
4
|
+
//# sourceMappingURL=chunk-6I55VYFG.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{d as k,e as b}from"./chunk-RS6UYNEP.js";import{j as f,k as L,x as v,y as R}from"./chunk-KPMMOAV5.js";import{b as E}from"./chunk-Z2L5H2HF.js";import{connect as $}from"net";import{performance as I}from"perf_hooks";import{createHash as Q}from"crypto";import{tmpdir as j,userInfo as Y}from"os";import{join as x}from"path";var c=1,_=1*1024*1024,h=64*1024*1024,y=12e4,O=["NO_COLOR","FORCE_COLOR","CLICOLOR","CLICOLOR_FORCE","TERM","CODEBASEIQ_DEBUG"],P=1500;function T(t){let e=A(),r=Q("sha256").update(`${e}\0${t}`).digest("hex");return process.platform==="win32"?`\\\\.\\pipe\\codebaseiq-lane-${r.slice(0,32)}`:x(D(),`lane-${r.slice(0,24)}.sock`)}function D(){let t=A(),e=Q("sha256").update(t).digest("hex").slice(0,16);return x(j(),`codebaseiq-${e}`)}function A(){try{return Y().username}catch{return`uid-${typeof process.getuid=="function"?process.getuid():"unknown"}`}}function w(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 N(t,e,r){let n=Buffer.alloc(0),u=!1,i=s=>{u||(u=!0,r(new Error(s)))};return{push(s){if(!u)for(n=n.byteLength===0?s:Buffer.concat([n,s]);n.byteLength>=4;){let a=n.readUInt32LE(0);if(a>t){i(`query-lane frame of ${a} bytes exceeds the ${t}-byte limit`);return}if(n.byteLength<4+a)return;let l=n.subarray(4,4+a);n=n.subarray(4+a);let o;try{o=JSON.parse(l.toString("utf8"))}catch{i("query-lane frame carried invalid JSON");return}if(e(o),u)return}}}}function S(t){if(!t||typeof t!="object")return null;let e=t;if(e.protocolVersion!==c)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:c,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:c,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:c,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=v(e.processIdentity);if(!n||n.pid!==e.serverPid)return null;r=n}return{ok:!0,kind:"pong",protocolVersion:c,serverPid:e.serverPid,...r?{processIdentity:r}:{},cliVersion:e.cliVersion,projectRoot:e.projectRoot,...e.indexGeneration!==void 0?{indexGeneration:e.indexGeneration}:{}}}var q=250,C=2e3,M="CODEBASEIQ_NO_DAEMON",F="CODEBASEIQ_DAEMON";async function ae(t,e={}){let r=await U(t,{protocolVersion:c,kind:"ping",projectRoot:f(t.projectRoot)},e);if(r.kind!=="ok")return r;let n=r.response;return n.ok!==!0?{kind:"incompatible",reason:`query lane refused ping: ${n.code}: ${n.message}`}:n.kind!=="pong"?{kind:"incompatible",reason:"query lane answered ping with a non-pong response"}:n.serverPid!==r.state.pid?{kind:"incompatible",reason:"query lane responder is not the advertised watch service process"}:n.processIdentity&&r.state.processIdentity&&!R(n.processIdentity,r.state.processIdentity)?{kind:"incompatible",reason:"query lane responder identity differs from the advertised service"}:{kind:"ok",pong:n,roundTripMs:r.roundTripMs,state:r.state}}async function ue(t){let e=t[0];if(!e||e.startsWith("-"))return{served:!1,reason:"no eligible command was invoked"};if(E())return{served:!1,reason:"read-only mode answers in-process from the existing index"};if(process.env.CODEBASEIQ_INDEX_DB)return{served:!1,reason:"an explicit index database is pinned by the environment"};if(process.env.CODEBASEIQ_SESSION)return{served:!1,reason:"session-ledger evidence runs in-process"};let r;try{let{resolveProjectRoot:d,resolveCliProjectContext:p,residentQueryLaneEligible:V}=await import("./cli-context-4R2LREXQ.js");if(!V(e))return{served:!1,reason:`command ${e} always executes in-process`};let m=d(),g=p(m);r={projectRoot:m,cacheDir:g.paths.cacheDir,enabled:process.env[F]==="1"||g.config.daemon?.enabled===!0}}catch(d){return{served:!1,reason:`project resolution failed: ${d instanceof Error?d.message:d}`}}if(!r.enabled)return{served:!1,reason:"resident execution is not enabled for this project"};let{normalizeLegacyEvidenceInvocation:n}=await import("./invocation-command-descriptors-35JULLNR.js"),u=["node","codebaseiq",...t];n(u);let i=u.slice(2),s={};for(let d of O){let p=process.env[d];p!==void 0&&(s[d]=p)}let a={protocolVersion:c,kind:"execute",projectRoot:f(r.projectRoot),argv:i,cwd:process.cwd(),envAllowlist:s,tty:{isTTY:process.stdout.isTTY===!0,...typeof process.stdout.columns=="number"?{columns:process.stdout.columns}:{}},deadlineMs:y,clientInvocation:{execPath:process.execPath,...process.argv[1]!==void 0?{scriptPath:process.argv[1]}:{}}},l=await U(r,a,{acceptTimeoutMs:P,responseTimeoutMs:y+5e3});if(l.kind!=="ok")return{served:!1,reason:l.reason};let o=l.response;return o.ok!==!0||o.kind!=="executed"?{served:!1,reason:o.ok===!1?`${o.code}: ${o.message}`:"the lane answered with a non-execution response"}:o.serverPid!==l.state.pid?{served:!1,reason:"the executing process is not the advertised watch service"}:(o.stdout.length>0&&process.stdout.write(o.stdout),o.stderr.length>0&&process.stderr.write(o.stderr),process.exitCode=o.exitCode,{served:!0,exitCode:o.exitCode})}async function U(t,e,r={}){if(process.env[M]==="1")return{kind:"unavailable",reason:`${M}=1 disables the query lane`};let n=W(t);if("reason"in n)return n;let u=r.socketPathOverride??T(t.cacheDir),i=I.now(),s=await G(u,e,r);if("reason"in s)return s;let a=S(s.value);return a?{kind:"ok",response:a,roundTripMs:I.now()-i,state:n.state}:{kind:"incompatible",reason:"query lane returned a response this client cannot validate"}}function B(t){return!!t&&typeof t=="object"&&t.kind==="accepted"&&t.ok===!0}function W(t){let e=b(k(t.cacheDir).statePath);return e?e.projectRoot!==f(t.projectRoot)?{kind:"unavailable",reason:"the published watch service serves a different project root"}:e.queryLane===void 0?{kind:"unavailable",reason:"the running watch service does not advertise a query lane"}:e.queryLane.protocolVersion!==c?{kind:"incompatible",reason:`query lane protocol ${e.queryLane.protocolVersion} does not match client protocol ${c}`}:L(e.pid)?{state:e}:{kind:"unavailable",reason:"the advertised watch service process is not alive"}:{kind:"unavailable",reason:"no watch service state is published for this cache"}}function G(t,e,r){return new Promise(n=>{let u=!1,i=o=>{u||(u=!0,clearTimeout(a),s.destroy(),n(o))},s=$({path:t,timeout:r.connectTimeoutMs??q}),a=setTimeout(()=>i({kind:"unavailable",reason:"query lane response timed out"}),(r.connectTimeoutMs??q)+(r.acceptTimeoutMs??r.responseTimeoutMs??C)),l=N(h,o=>{if(B(o)){clearTimeout(a),a=setTimeout(()=>i({kind:"unavailable",reason:"query lane response timed out after acknowledgement"}),r.responseTimeoutMs??C);return}i({value:o})},o=>i({kind:"unavailable",reason:`query lane response was malformed: ${o.message}`}));s.on("timeout",()=>i({kind:"unavailable",reason:"query lane connection timed out"})),s.on("error",o=>i({kind:"unavailable",reason:`query lane connection failed: ${o.message}`})),s.on("close",()=>i({kind:"unavailable",reason:"query lane closed before responding"})),s.on("data",o=>l.push(o)),s.on("connect",()=>{s.setTimeout(0);try{s.write(w(e,_))}catch(o){i({kind:"unavailable",reason:`query lane request could not be encoded: ${o instanceof Error?o.message:String(o)}`})}})})}export{ae as a,ue as b};
|
|
3
|
+
//# sourceMappingURL=chunk-6NUURWPF.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as de}from"./chunk-YHPG3S2U.js";import{b as ue}from"./chunk-B75HZHUP.js";import{c as I}from"./chunk-HENP2O4A.js";import{a as le}from"./chunk-6VREELBC.js";import{k as ce}from"./chunk-J3GLP7Q5.js";import{c as ae}from"./chunk-MSI3K7PJ.js";import{i as oe}from"./chunk-J7AMBVWF.js";import{a as ie,b as re,c as se}from"./chunk-ELNRLMC5.js";import{e as ee,f as te,h as ne}from"./chunk-NDKOVQFG.js";import{a as Q}from"./chunk-BRQL7AFJ.js";import{C as S,d as Z,e as $,g as G,h as J,i as q,j as V,k as K,s as X,x as Y}from"./chunk-GVAF222T.js";import{p as H}from"./chunk-F74LZWCE.js";import{C as x,a as L,z}from"./chunk-ICUL7XRT.js";import{f as w,l as B,t as U,v as j,w as P,x as W}from"./chunk-7GAK2F3H.js";import{d as y}from"./chunk-3LCDIREB.js";import{d as D}from"./chunk-UC2FD2PS.js";var _=new WeakMap,me=U({kind:"definition-exclusions",invalidation:j("definition-exclusions"),serialize:e=>JSON.stringify(e),deserialize:Ne});function pe(e,t){let n=z(t);if(!(n==="rust"||n==="typescript"||n==="tsx"||n==="javascript"))return[];let i=P(e,t);if(!i)return[];let o=B(e,t,i),c=me.read(e,t,o);if(c)return c;let u=n==="rust"?Ue(e,t):Fe(e,t);return me.write(e,t,o,u),u}function Ne(e){try{let t=JSON.parse(e);if(!Array.isArray(t))return null;let n=t.map(Te);return n.some(s=>s===null)?null:n}catch{return null}}function Te(e){if(!e||typeof e!="object")return null;let t=e;if(typeof t.startLine!="number"||!Number.isFinite(t.startLine)||typeof t.endLine!="number"||!Number.isFinite(t.endLine)||typeof t.reason!="string"||t.containerName!==void 0&&typeof t.containerName!="string")return null;let n=t.disposition===void 0?Xe(t.reason):t.disposition;return n!=="exclude"&&n!=="implicit-usage"?null:{startLine:t.startLine,endLine:t.endLine,reason:t.reason,disposition:n,...t.containerName?{containerName:t.containerName}:{}}}var be=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]),ke=/\b(?:describe|it|test|fdescribe|fit|xdescribe|xit|beforeEach|afterEach|beforeAll|afterAll|before|after|suite|bench|benchmark)\s*\(/,Ae=/\b(?:export\s+)?(?:async\s+)?function\s+use[A-Z][A-Za-z0-9_$]*\b|\b(?:const|let|var)\s+use[A-Z][A-Za-z0-9_$]*\s*(?::[^=;]+)?=\s*(?:async\s*)?(?:function\b|(?:<[^=;{]+>\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*=>)/;function Fe(e,t){let n=P(e,t);if(!n||!Me(n))return[];let s=x(e,t);if(!s)return[];let i=_.get(s);if(i)return i;let o=!1,c=s.rootNode;for(let l of c.namedChildren){if(l.type!=="expression_statement")continue;let d=l.namedChild(0);if(!d||d.type!=="call_expression")continue;let r=d.namedChild(0);if(!r)continue;let a=r.type==="member_expression"?r.namedChild(r.namedChildCount-1)?.text:r.text;if(a&&be.has(a)){o=!0;break}}let u=[];o&&u.push({startLine:0,endLine:c.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)",disposition:"exclude"});for(let l of c.namedChildren){let d=null,r=null;if(l.type==="function_declaration")d=l.namedChild(0)?.text??null,r=l;else if(l.type==="export_statement"){let a=l.namedChild(0);a?.type==="function_declaration"&&(d=a.namedChild(0)?.text??null,r=a)}else if(l.type==="lexical_declaration"){let a=l.namedChild(0);if(a?.type==="variable_declarator"){let p=a.namedChild(0)?.text,f=a.namedChild(1);p&&(f?.type==="arrow_function"||f?.type==="function_expression")&&(d=p,r=a)}}d&&/^use[A-Z]/.test(d)&&r&&u.push({startLine:r.startPosition.row,endLine:r.endPosition.row,reason:"React custom hook (use*)",disposition:"exclude"})}return u.push(...ye(s,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),_.set(s,u),u}function Me(e){if(e.includes("codebaseiq"))return!0;let t=!1;for(let n of be)if(e.includes(n)){t=!0;break}return t&&ke.test(e)?!0:e.includes("use")&&Ae.test(e)}var Oe=/codebaseiq[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function Be(e){return Oe.test(e)}function ye(e,t,n){let s=[],i=o=>{if(t.has(o.type)&&o.parent){let u=o.parent.children,l=-1;for(let d=0;d<u.length;d+=1)if(u[d].startIndex===o.startIndex&&u[d].type===o.type){l=d;break}if(l>0)for(let d=l-1;d>=0;d-=1){let r=u[d];if(n.has(r.type)){if(Be(r.text)){s.push({startLine:o.startPosition.row,endLine:o.endPosition.row,reason:"codebaseiq suppression comment",disposition:"exclude"});break}continue}if(!(r.type==="attribute_item"||r.type==="inner_attribute_item"))break}}for(let c of o.namedChildren)i(c)};return i(e.rootNode),s}function Ue(e,t){let n=x(e,t);if(!n)return[];let s=_.get(n);if(s)return s;let i=[],o=je(n);return o?(_.set(n,o),o):(ge(n.rootNode,i,!1,!1),i.push(...ye(n,new Set(["function_item","function_signature_item","struct_item","enum_item","union_item","impl_item","mod_item","static_item","const_item"]),new Set(["line_comment","block_comment"]))),i.push(...Ve(n.rootNode)),_.set(n,i),i)}function je(e){return Ye(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)",disposition:"exclude"}]:null}function ge(e,t,n,s){let i=n,o=s;e.type==="trait_item"&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)",disposition:"implicit-usage"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(o=!0,t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)",disposition:"implicit-usage"})),e.type==="function_item"||e.type==="function_signature_item"?We(e,t,n,s):s&&qe(e)?t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)",disposition:"implicit-usage"}):e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"?ze(e,t,n):e.type==="mod_item"&&N(e).some(c=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(c))&&(i=!0);for(let c of e.namedChildren)ge(c,t,i,o)}function We(e,t,n,s){let i=N(e),o=null;s?o={reason:"trait impl method (dynamic dispatch)",disposition:"implicit-usage"}:n&&(o={reason:"inside #[cfg(test)] mod",disposition:"exclude"});for(let c of i){if(he(c)){o={reason:"#[allow(dead_code)]",disposition:"exclude"};break}let u=Ge(c);if(u){o=u;break}}o&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:o.reason,disposition:o.disposition})}function ze(e,t,n){let s=N(e),i=e.namedChildren.find(o=>o.type==="type_identifier")?.text;s.some(Je)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(...)] - generated impl may access fields",disposition:"implicit-usage",containerName:i}),s.some(he)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",disposition:"exclude",containerName:i}),n&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",disposition:"exclude",containerName:i})}function N(e){let t=e.parent;if(!t)return[];let n=t.children,s=-1;for(let o=0;o<n.length;o+=1)if(n[o].startIndex===e.startIndex&&n[o].type===e.type){s=o;break}if(s<=0)return[];let i=[];for(let o=s-1;o>=0;o-=1){let c=n[o];if(c.type==="attribute_item"||c.type==="inner_attribute_item")i.push(c.text);else{if(c.type==="line_comment"||c.type==="block_comment")continue;break}}return i}var He=new Set(["test","bench","tokio::test","async_std::test"]),Ze=new Set(["no_mangle","export_name","link_name","used","macro_export","proc_macro","proc_macro_derive","proc_macro_attribute"]),$e=new Set(["allow","warn","deny","forbid","cfg","cfg_attr","doc","inline","cold","must_use","deprecated","repr","derive","automatically_derived","non_exhaustive","path","link","link_section","global_allocator","panic_handler"]);function Ge(e){if(/#\[\s*cfg\s*\(\s*test\s*\)/.test(e))return{reason:"#[cfg(test)]",disposition:"exclude"};let t=Ke(e);return t?He.has(t)?{reason:`#[${t}]`,disposition:"exclude"}:Ze.has(t)?{reason:`Rust ABI/export attribute #[${t}]`,disposition:"implicit-usage"}:$e.has(t)?null:{reason:`Rust attribute macro #[${t}]`,disposition:"implicit-usage"}:null}function Je(e){return/#\[\s*derive\s*\(/.test(e)}function he(e){return/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e)}function qe(e){return e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"}function Ve(e){let t=Qe(e);if(t.size===0)return[];let n=[];for(let s of e.descendantsOfType("mod_item")){let i=s.childForFieldName("name")?.text;i&&t.has(i)&&n.push({startLine:s.startPosition.row,endLine:s.endPosition.row,reason:'attribute `with = "..."` module - body may be invoked via reflection',disposition:"implicit-usage",containerName:i})}return n}function Ke(e){let t=/^#!?\[\s*([A-Za-z_][A-Za-z0-9_]*(?:\s*::\s*[A-Za-z_][A-Za-z0-9_]*)*)/.exec(e);return t?t[1].replace(/\s+/g,""):null}function Xe(e){return e==="#[tauri::command]"||e==="#[command]"||e==="#[wasm_bindgen]"||e==="#[no_mangle]"||e==="#[napi]"||e==="#[pyfunction]"||e==="#[pymethod]"||e==="#[pyo3]"||e==="#[doc(hidden)]"||e.startsWith("trait ")||e.startsWith("#[derive(<reflective>)]")||e.startsWith("#[derive(...)]")||e.startsWith('serde `with = "')||e.startsWith('attribute `with = "')||e.startsWith("Rust attribute macro #[")||e.startsWith("Rust ABI/export attribute #[")?"implicit-usage":"exclude"}function Ye(e){for(let t=0;t<Math.min(e.namedChildCount,12);t+=1){let n=e.namedChild(t);if(!n||n.type!=="line_comment"&&n.type!=="block_comment")break;if(/@generated\b/.test(n.text)||/This file is .*generated\b/i.test(n.text)||/Code generated by/i.test(n.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(n.text)||/openapi-generator/i.test(n.text)&&/Generated by/i.test(n.text))return!0}return!1}var fe=/\bwith\s*=\s*"([^"]+)"/g;function Qe(e){let t=new Set;for(let n of e.descendantsOfType("attribute_item")){fe.lastIndex=0;let s;for(;(s=fe.exec(n.text))!==null;){let i=s[1],o=i.split("::").pop()??i;o&&t.add(o)}}return t}function xe(e){let t=T(e);return(n,s,i,o)=>t(n,s,i,o)?.disposition==="exclude"}function T(e){let t=new Map,n=s=>{let i=t.get(s);if(i)return i;let o=pe(e,s),c=new Map;for(let u of o){if(!u.containerName)continue;let l=c.get(u.containerName)??[];l.push(u),c.set(u.containerName,l)}return i={ranges:o,containers:c},t.set(s,i),i};return(s,i,o,c)=>{let u=n(s),l=[];for(let r of u.ranges)i>=r.startLine&&i<=r.endLine&&l.push(r);let d=new Set;c&&d.add(c);for(let r of S(o))d.add(r);for(let r of d){let a=u.containers.get(r);a&&l.push(...a)}return et(l)}}function et(e){if(e.length===0)return null;let n=e.find(s=>s.disposition==="exclude")??e[0];return{disposition:n.disposition,reason:n.reason}}function Ct(e,t={}){w(e,{groups:t.semanticProvider===!0?["whole-project","semantic-provider"]:["whole-project"]})}function _e(e,t,n={}){w(e,{groups:n.definitions===!0?["source-file","definition-catalog"]:["source-file"],file:t.replace(/\\/g,"/")})}function Se(e,t){if(t.isIgnoredPath(e.relativePath))return b("ignored-file");if(q(e.symbol))return b("module-like-symbol");if(!E(e.symbol))return b("non-value-symbol");if(!e.isFunctionLike&&e.enclosingSymbol&&E(e.enclosingSymbol))return b("nested-non-callable-value");if(!t.includeTests&&!tt(e.relativePath))return b("test-file");if(!t.includeTests&&t.isExcludedRegion(e.relativePath,e.startLine,e.symbol,e.parentTypeName))return b("excluded-file-region");let n=$(e.symbol);if(n==="<constructor>")return b("implicit-constructor");if(e.symbol.startsWith("scip-python ")){if(n==="__all__")return b("python-runtime-metadata");if(/^__[^_].*__$/.test(n))return b("python-protocol-member")}return t.isDeclarationOnlyCallable()?b("declaration-only-callable"):t.isFrameworkContractCallable()?b("framework-contract-member"):V(e.symbol)?b("rust-trait-impl-member"):K(e.symbol)?b("rust-test-module"):!t.includeMembers&&!nt(e)?b("member"):e.endLine-e.startLine+1<t.minLoc?b("below-min-loc"):{accepted:!0}}function tt(e){return Q(e)!=="test"}function b(e){return{accepted:!1,rejectionReason:e}}function E(e){return J(e)||e.endsWith("().")||e.endsWith(".")}function nt(e){return G(e.symbol)||S(e.symbol).length===0}function Ee(){return new Map}function Re(e,t,n){let s=new Map;for(let i of ie(e,n))e.isIgnored(i.relative_path)||t.has(i.relative_path)||C(s,i.symbol_id,i.relative_path,i.ref_count,"scip-mention");return s}function Ce(e,t,n,s={}){let i=new Set;if(s.conservative||n.size===0){for(let o of se(e,t))i.add(o.symbol_id);return i}for(let o of re(e,t))e.isIgnored(o.relative_path)||n.has(o.relative_path)||i.add(o.symbol_id);return i}function k(e,t){let n=e.get(t);if(!n)return!1;for(let s of n.values())if(s.occurrences>0)return!0;return!1}function R(e,t,n){let s=e.get(t);if(!s)return!1;for(let[i,o]of s)if(i!==n&&o.occurrences>0)return!0;return!1}function ve(e){return e?.occurrences??0}function C(e,t,n,s,i="source-fallback"){if(s<=0)return;let o=we(e,t,n);o.occurrences+=s,o.sources.add(i)}function De(e,t,n,s,i){if(s<=0)return;let o=we(e,t,n);o.occurrences=Math.max(s,o.occurrences),o.sources.add(i)}function we(e,t,n){let s=e.get(t);s||(s=new Map,e.set(t,s));let i=s.get(n);return i||(i={occurrences:0,sources:new Set},s.set(n,i)),i}function Yt(e,t={}){let{scope:n,minLoc:s=1,includeTests:i=!1,skipBarrels:o=!1,includeMembers:c=!1,deadCodeOnly:u=!1,scanLimit:l,semantic:d=!0}=t,r=0,a=y("dead.candidates",()=>{let m=ue(it(e,{scope:n,minLoc:s,includeTests:i,includeMembers:c}),l);return r=m.length,m},()=>({definitions:r})),p=0,f=o?y("dead.inactive-barrels",()=>{let m=new Set(ee(e));return p=m.size,m},()=>({paths:p})):new Set,A=0,g=u?Ee():y("dead.mention-reference-counts",()=>{let m=Re(e,f,a.map(v=>v.symbolId));return A=m.size,m},()=>({definitions:a.length,symbolsWithReferences:A})),F=0,Pe=u?y("dead.mentioned-symbol-ids",()=>{let m=Ce(e,a.map(v=>v.symbolId),f,{conservative:f.size===0});return F=m.size,m},()=>({definitions:a.length,referencedSymbols:F})):new Set,h=u?a.filter(m=>!Pe.has(m.symbolId)):a.filter(m=>!R(g,m.symbolId,m.relativePath));u?y("dead.source-fallback.dead-code-only",()=>ut(e,h,g,{inactiveBarrelPaths:f}),()=>({definitions:h.length,testReferencesIncluded:!0})):y("dead.source-fallback.ast",()=>lt(e,h,g,{inactiveBarrelPaths:f}),()=>({definitions:h.length,testReferencesIncluded:!0}));let M=u?h.filter(m=>!k(g,m.symbolId)):h.filter(m=>!R(g,m.symbolId,m.relativePath)),O=new Set;y("dead.caller-map-supplement",()=>{O=pt(e,M,g,{inactiveBarrelPaths:f,includeSemantic:!u&&d})},()=>({definitions:M.length,semantic:!u&&d}));let Ie=u?h.filter(m=>!k(g,m.symbolId)):a.filter(m=>!O.has(m.symbolId));return ct(e,ot(Ie,g))}function it(e,t){let n=xe(e),s=[];for(let i of Y(e,{scope:t.scope,symbolMatches:E,sqlPrefilter:"function-like"}))Se(i,{minLoc:t.minLoc,includeTests:t.includeTests,includeMembers:t.includeMembers,isIgnoredPath:c=>e.isIgnored(c),isExcludedRegion:n,isDeclarationOnlyCallable:()=>st(e,i),isFrameworkContractCallable:()=>de(e,i)}).accepted&&s.push(i);return s}var rt=["method_signature","abstract_method_signature","call_signature","construct_signature"];function st(e,t){if(!t.parentTypeName||!/\.[cm]?[jt]sx?$/.test(t.relativePath))return!1;let n=x(e,t.relativePath);if(n)return n.rootNode.descendantsOfType([...rt]).some(i=>i.startPosition.row<=t.startLine&&i.endPosition.row>=t.endLine);let s=W(e,t.relativePath).slice(t.startLine,t.endLine+1).join(`
|
|
1
|
+
import{a as de}from"./chunk-TG4GMU73.js";import{b as ue}from"./chunk-B75HZHUP.js";import{c as I}from"./chunk-UHFZDQZJ.js";import{a as le}from"./chunk-ETZBIG6K.js";import{k as ce}from"./chunk-R2F2CTBA.js";import{c as ae}from"./chunk-2QJAVISG.js";import{i as oe}from"./chunk-NB2DAVPP.js";import{a as ie,b as re,c as se}from"./chunk-ELNRLMC5.js";import{e as ee,f as te,h as ne}from"./chunk-GLXEWYQY.js";import{a as Q}from"./chunk-NMKQOIYZ.js";import{C as S,d as Z,e as $,g as G,h as J,i as q,j as V,k as K,s as X,x as Y}from"./chunk-TNLOX4TN.js";import{p as H}from"./chunk-RGBZDOUO.js";import{C as x,a as L,z}from"./chunk-NRNVMB2R.js";import{f as w,l as B,t as U,v as j,w as P,x as W}from"./chunk-23AD24QZ.js";import{d as y}from"./chunk-3LCDIREB.js";import{d as D}from"./chunk-6I55VYFG.js";var _=new WeakMap,me=U({kind:"definition-exclusions",invalidation:j("definition-exclusions"),serialize:e=>JSON.stringify(e),deserialize:Ne});function pe(e,t){let n=z(t);if(!(n==="rust"||n==="typescript"||n==="tsx"||n==="javascript"))return[];let i=P(e,t);if(!i)return[];let o=B(e,t,i),c=me.read(e,t,o);if(c)return c;let u=n==="rust"?Ue(e,t):Fe(e,t);return me.write(e,t,o,u),u}function Ne(e){try{let t=JSON.parse(e);if(!Array.isArray(t))return null;let n=t.map(Te);return n.some(s=>s===null)?null:n}catch{return null}}function Te(e){if(!e||typeof e!="object")return null;let t=e;if(typeof t.startLine!="number"||!Number.isFinite(t.startLine)||typeof t.endLine!="number"||!Number.isFinite(t.endLine)||typeof t.reason!="string"||t.containerName!==void 0&&typeof t.containerName!="string")return null;let n=t.disposition===void 0?Xe(t.reason):t.disposition;return n!=="exclude"&&n!=="implicit-usage"?null:{startLine:t.startLine,endLine:t.endLine,reason:t.reason,disposition:n,...t.containerName?{containerName:t.containerName}:{}}}var be=new Set(["describe","it","test","fdescribe","fit","xdescribe","xit","beforeEach","afterEach","beforeAll","afterAll","before","after","suite","bench","benchmark"]),ke=/\b(?:describe|it|test|fdescribe|fit|xdescribe|xit|beforeEach|afterEach|beforeAll|afterAll|before|after|suite|bench|benchmark)\s*\(/,Ae=/\b(?:export\s+)?(?:async\s+)?function\s+use[A-Z][A-Za-z0-9_$]*\b|\b(?:const|let|var)\s+use[A-Z][A-Za-z0-9_$]*\s*(?::[^=;]+)?=\s*(?:async\s*)?(?:function\b|(?:<[^=;{]+>\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*=>)/;function Fe(e,t){let n=P(e,t);if(!n||!Me(n))return[];let s=x(e,t);if(!s)return[];let i=_.get(s);if(i)return i;let o=!1,c=s.rootNode;for(let l of c.namedChildren){if(l.type!=="expression_statement")continue;let d=l.namedChild(0);if(!d||d.type!=="call_expression")continue;let r=d.namedChild(0);if(!r)continue;let a=r.type==="member_expression"?r.namedChild(r.namedChildCount-1)?.text:r.text;if(a&&be.has(a)){o=!0;break}}let u=[];o&&u.push({startLine:0,endLine:c.endPosition.row,reason:"TS/JS test file (describe/it/test at top level)",disposition:"exclude"});for(let l of c.namedChildren){let d=null,r=null;if(l.type==="function_declaration")d=l.namedChild(0)?.text??null,r=l;else if(l.type==="export_statement"){let a=l.namedChild(0);a?.type==="function_declaration"&&(d=a.namedChild(0)?.text??null,r=a)}else if(l.type==="lexical_declaration"){let a=l.namedChild(0);if(a?.type==="variable_declarator"){let p=a.namedChild(0)?.text,f=a.namedChild(1);p&&(f?.type==="arrow_function"||f?.type==="function_expression")&&(d=p,r=a)}}d&&/^use[A-Z]/.test(d)&&r&&u.push({startLine:r.startPosition.row,endLine:r.endPosition.row,reason:"React custom hook (use*)",disposition:"exclude"})}return u.push(...ye(s,new Set(["function_declaration","method_definition","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","variable_declarator","export_statement"]),new Set(["comment"]))),_.set(s,u),u}function Me(e){if(e.includes("codebaseiq"))return!0;let t=!1;for(let n of be)if(e.includes(n)){t=!0;break}return t&&ke.test(e)?!0:e.includes("use")&&Ae.test(e)}var Oe=/codebaseiq[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale)?/i;function Be(e){return Oe.test(e)}function ye(e,t,n){let s=[],i=o=>{if(t.has(o.type)&&o.parent){let u=o.parent.children,l=-1;for(let d=0;d<u.length;d+=1)if(u[d].startIndex===o.startIndex&&u[d].type===o.type){l=d;break}if(l>0)for(let d=l-1;d>=0;d-=1){let r=u[d];if(n.has(r.type)){if(Be(r.text)){s.push({startLine:o.startPosition.row,endLine:o.endPosition.row,reason:"codebaseiq suppression comment",disposition:"exclude"});break}continue}if(!(r.type==="attribute_item"||r.type==="inner_attribute_item"))break}}for(let c of o.namedChildren)i(c)};return i(e.rootNode),s}function Ue(e,t){let n=x(e,t);if(!n)return[];let s=_.get(n);if(s)return s;let i=[],o=je(n);return o?(_.set(n,o),o):(ge(n.rootNode,i,!1,!1),i.push(...ye(n,new Set(["function_item","function_signature_item","struct_item","enum_item","union_item","impl_item","mod_item","static_item","const_item"]),new Set(["line_comment","block_comment"]))),i.push(...Ve(n.rootNode)),_.set(n,i),i)}function je(e){return Ye(e.rootNode)?[{startLine:0,endLine:e.rootNode.endPosition.row,reason:"generated file (@generated header)",disposition:"exclude"}]:null}function ge(e,t,n,s){let i=n,o=s;e.type==="trait_item"&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait declaration body (dynamic dispatch)",disposition:"implicit-usage"}),e.type==="impl_item"&&e.childForFieldName("trait")&&(o=!0,t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl block (dynamic dispatch)",disposition:"implicit-usage"})),e.type==="function_item"||e.type==="function_signature_item"?We(e,t,n,s):s&&qe(e)?t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"trait impl associated item (dynamic dispatch)",disposition:"implicit-usage"}):e.type==="struct_item"||e.type==="enum_item"||e.type==="union_item"?ze(e,t,n):e.type==="mod_item"&&N(e).some(c=>/#\[\s*cfg\s*\(\s*test\s*\)/.test(c))&&(i=!0);for(let c of e.namedChildren)ge(c,t,i,o)}function We(e,t,n,s){let i=N(e),o=null;s?o={reason:"trait impl method (dynamic dispatch)",disposition:"implicit-usage"}:n&&(o={reason:"inside #[cfg(test)] mod",disposition:"exclude"});for(let c of i){if(he(c)){o={reason:"#[allow(dead_code)]",disposition:"exclude"};break}let u=Ge(c);if(u){o=u;break}}o&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:o.reason,disposition:o.disposition})}function ze(e,t,n){let s=N(e),i=e.namedChildren.find(o=>o.type==="type_identifier")?.text;s.some(Je)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[derive(...)] - generated impl may access fields",disposition:"implicit-usage",containerName:i}),s.some(he)&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"#[allow(dead_code)]",disposition:"exclude",containerName:i}),n&&t.push({startLine:e.startPosition.row,endLine:e.endPosition.row,reason:"inside #[cfg(test)] mod",disposition:"exclude",containerName:i})}function N(e){let t=e.parent;if(!t)return[];let n=t.children,s=-1;for(let o=0;o<n.length;o+=1)if(n[o].startIndex===e.startIndex&&n[o].type===e.type){s=o;break}if(s<=0)return[];let i=[];for(let o=s-1;o>=0;o-=1){let c=n[o];if(c.type==="attribute_item"||c.type==="inner_attribute_item")i.push(c.text);else{if(c.type==="line_comment"||c.type==="block_comment")continue;break}}return i}var He=new Set(["test","bench","tokio::test","async_std::test"]),Ze=new Set(["no_mangle","export_name","link_name","used","macro_export","proc_macro","proc_macro_derive","proc_macro_attribute"]),$e=new Set(["allow","warn","deny","forbid","cfg","cfg_attr","doc","inline","cold","must_use","deprecated","repr","derive","automatically_derived","non_exhaustive","path","link","link_section","global_allocator","panic_handler"]);function Ge(e){if(/#\[\s*cfg\s*\(\s*test\s*\)/.test(e))return{reason:"#[cfg(test)]",disposition:"exclude"};let t=Ke(e);return t?He.has(t)?{reason:`#[${t}]`,disposition:"exclude"}:Ze.has(t)?{reason:`Rust ABI/export attribute #[${t}]`,disposition:"implicit-usage"}:$e.has(t)?null:{reason:`Rust attribute macro #[${t}]`,disposition:"implicit-usage"}:null}function Je(e){return/#\[\s*derive\s*\(/.test(e)}function he(e){return/#\[\s*allow\s*\(\s*dead_code\s*\)/.test(e)}function qe(e){return e.type==="const_item"||e.type==="type_item"||e.type==="static_item"||e.type==="associated_type"}function Ve(e){let t=Qe(e);if(t.size===0)return[];let n=[];for(let s of e.descendantsOfType("mod_item")){let i=s.childForFieldName("name")?.text;i&&t.has(i)&&n.push({startLine:s.startPosition.row,endLine:s.endPosition.row,reason:'attribute `with = "..."` module - body may be invoked via reflection',disposition:"implicit-usage",containerName:i})}return n}function Ke(e){let t=/^#!?\[\s*([A-Za-z_][A-Za-z0-9_]*(?:\s*::\s*[A-Za-z_][A-Za-z0-9_]*)*)/.exec(e);return t?t[1].replace(/\s+/g,""):null}function Xe(e){return e==="#[tauri::command]"||e==="#[command]"||e==="#[wasm_bindgen]"||e==="#[no_mangle]"||e==="#[napi]"||e==="#[pyfunction]"||e==="#[pymethod]"||e==="#[pyo3]"||e==="#[doc(hidden)]"||e.startsWith("trait ")||e.startsWith("#[derive(<reflective>)]")||e.startsWith("#[derive(...)]")||e.startsWith('serde `with = "')||e.startsWith('attribute `with = "')||e.startsWith("Rust attribute macro #[")||e.startsWith("Rust ABI/export attribute #[")?"implicit-usage":"exclude"}function Ye(e){for(let t=0;t<Math.min(e.namedChildCount,12);t+=1){let n=e.namedChild(t);if(!n||n.type!=="line_comment"&&n.type!=="block_comment")break;if(/@generated\b/.test(n.text)||/This file is .*generated\b/i.test(n.text)||/Code generated by/i.test(n.text)||/Generated by:\s*https?:\/\/openapi-generator/i.test(n.text)||/openapi-generator/i.test(n.text)&&/Generated by/i.test(n.text))return!0}return!1}var fe=/\bwith\s*=\s*"([^"]+)"/g;function Qe(e){let t=new Set;for(let n of e.descendantsOfType("attribute_item")){fe.lastIndex=0;let s;for(;(s=fe.exec(n.text))!==null;){let i=s[1],o=i.split("::").pop()??i;o&&t.add(o)}}return t}function xe(e){let t=T(e);return(n,s,i,o)=>t(n,s,i,o)?.disposition==="exclude"}function T(e){let t=new Map,n=s=>{let i=t.get(s);if(i)return i;let o=pe(e,s),c=new Map;for(let u of o){if(!u.containerName)continue;let l=c.get(u.containerName)??[];l.push(u),c.set(u.containerName,l)}return i={ranges:o,containers:c},t.set(s,i),i};return(s,i,o,c)=>{let u=n(s),l=[];for(let r of u.ranges)i>=r.startLine&&i<=r.endLine&&l.push(r);let d=new Set;c&&d.add(c);for(let r of S(o))d.add(r);for(let r of d){let a=u.containers.get(r);a&&l.push(...a)}return et(l)}}function et(e){if(e.length===0)return null;let n=e.find(s=>s.disposition==="exclude")??e[0];return{disposition:n.disposition,reason:n.reason}}function Ct(e,t={}){w(e,{groups:t.semanticProvider===!0?["whole-project","semantic-provider"]:["whole-project"]})}function _e(e,t,n={}){w(e,{groups:n.definitions===!0?["source-file","definition-catalog"]:["source-file"],file:t.replace(/\\/g,"/")})}function Se(e,t){if(t.isIgnoredPath(e.relativePath))return b("ignored-file");if(q(e.symbol))return b("module-like-symbol");if(!E(e.symbol))return b("non-value-symbol");if(!e.isFunctionLike&&e.enclosingSymbol&&E(e.enclosingSymbol))return b("nested-non-callable-value");if(!t.includeTests&&!tt(e.relativePath))return b("test-file");if(!t.includeTests&&t.isExcludedRegion(e.relativePath,e.startLine,e.symbol,e.parentTypeName))return b("excluded-file-region");let n=$(e.symbol);if(n==="<constructor>")return b("implicit-constructor");if(e.symbol.startsWith("scip-python ")){if(n==="__all__")return b("python-runtime-metadata");if(/^__[^_].*__$/.test(n))return b("python-protocol-member")}return t.isDeclarationOnlyCallable()?b("declaration-only-callable"):t.isFrameworkContractCallable()?b("framework-contract-member"):V(e.symbol)?b("rust-trait-impl-member"):K(e.symbol)?b("rust-test-module"):!t.includeMembers&&!nt(e)?b("member"):e.endLine-e.startLine+1<t.minLoc?b("below-min-loc"):{accepted:!0}}function tt(e){return Q(e)!=="test"}function b(e){return{accepted:!1,rejectionReason:e}}function E(e){return J(e)||e.endsWith("().")||e.endsWith(".")}function nt(e){return G(e.symbol)||S(e.symbol).length===0}function Ee(){return new Map}function Re(e,t,n){let s=new Map;for(let i of ie(e,n))e.isIgnored(i.relative_path)||t.has(i.relative_path)||C(s,i.symbol_id,i.relative_path,i.ref_count,"scip-mention");return s}function Ce(e,t,n,s={}){let i=new Set;if(s.conservative||n.size===0){for(let o of se(e,t))i.add(o.symbol_id);return i}for(let o of re(e,t))e.isIgnored(o.relative_path)||n.has(o.relative_path)||i.add(o.symbol_id);return i}function k(e,t){let n=e.get(t);if(!n)return!1;for(let s of n.values())if(s.occurrences>0)return!0;return!1}function R(e,t,n){let s=e.get(t);if(!s)return!1;for(let[i,o]of s)if(i!==n&&o.occurrences>0)return!0;return!1}function ve(e){return e?.occurrences??0}function C(e,t,n,s,i="source-fallback"){if(s<=0)return;let o=we(e,t,n);o.occurrences+=s,o.sources.add(i)}function De(e,t,n,s,i){if(s<=0)return;let o=we(e,t,n);o.occurrences=Math.max(s,o.occurrences),o.sources.add(i)}function we(e,t,n){let s=e.get(t);s||(s=new Map,e.set(t,s));let i=s.get(n);return i||(i={occurrences:0,sources:new Set},s.set(n,i)),i}function Yt(e,t={}){let{scope:n,minLoc:s=1,includeTests:i=!1,skipBarrels:o=!1,includeMembers:c=!1,deadCodeOnly:u=!1,scanLimit:l,semantic:d=!0}=t,r=0,a=y("dead.candidates",()=>{let m=ue(it(e,{scope:n,minLoc:s,includeTests:i,includeMembers:c}),l);return r=m.length,m},()=>({definitions:r})),p=0,f=o?y("dead.inactive-barrels",()=>{let m=new Set(ee(e));return p=m.size,m},()=>({paths:p})):new Set,A=0,g=u?Ee():y("dead.mention-reference-counts",()=>{let m=Re(e,f,a.map(v=>v.symbolId));return A=m.size,m},()=>({definitions:a.length,symbolsWithReferences:A})),F=0,Pe=u?y("dead.mentioned-symbol-ids",()=>{let m=Ce(e,a.map(v=>v.symbolId),f,{conservative:f.size===0});return F=m.size,m},()=>({definitions:a.length,referencedSymbols:F})):new Set,h=u?a.filter(m=>!Pe.has(m.symbolId)):a.filter(m=>!R(g,m.symbolId,m.relativePath));u?y("dead.source-fallback.dead-code-only",()=>ut(e,h,g,{inactiveBarrelPaths:f}),()=>({definitions:h.length,testReferencesIncluded:!0})):y("dead.source-fallback.ast",()=>lt(e,h,g,{inactiveBarrelPaths:f}),()=>({definitions:h.length,testReferencesIncluded:!0}));let M=u?h.filter(m=>!k(g,m.symbolId)):h.filter(m=>!R(g,m.symbolId,m.relativePath)),O=new Set;y("dead.caller-map-supplement",()=>{O=pt(e,M,g,{inactiveBarrelPaths:f,includeSemantic:!u&&d})},()=>({definitions:M.length,semantic:!u&&d}));let Ie=u?h.filter(m=>!k(g,m.symbolId)):a.filter(m=>!O.has(m.symbolId));return ct(e,ot(Ie,g))}function it(e,t){let n=xe(e),s=[];for(let i of Y(e,{scope:t.scope,symbolMatches:E,sqlPrefilter:"function-like"}))Se(i,{minLoc:t.minLoc,includeTests:t.includeTests,includeMembers:t.includeMembers,isIgnoredPath:c=>e.isIgnored(c),isExcludedRegion:n,isDeclarationOnlyCallable:()=>st(e,i),isFrameworkContractCallable:()=>de(e,i)}).accepted&&s.push(i);return s}var rt=["method_signature","abstract_method_signature","call_signature","construct_signature"];function st(e,t){if(!t.parentTypeName||!/\.[cm]?[jt]sx?$/.test(t.relativePath))return!1;let n=x(e,t.relativePath);if(n)return n.rootNode.descendantsOfType([...rt]).some(i=>i.startPosition.row<=t.startLine&&i.endPosition.row>=t.endLine);let s=W(e,t.relativePath).slice(t.startLine,t.endLine+1).join(`
|
|
2
2
|
`).trim();return s.endsWith(";")&&!s.includes("=>")&&!s.includes("{")}function ot(e,t){return e.map(n=>at(n,t)).filter(n=>n.cross_file_refs===0).sort((n,s)=>s.loc-n.loc||n.relative_path.localeCompare(s.relative_path)||n.start_line-s.start_line)}function at(e,t){let n=t.get(e.symbolId)??new Map,s=ve(n.get(e.relativePath)),i=0;for(let[o,c]of n)o!==e.relativePath&&(i+=c.occurrences);return{relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine,loc:e.endLine-e.startLine+1,symbol:e.symbol,parent_type_name:e.parentTypeName,same_file_refs:s,cross_file_refs:i}}function ct(e,t){let n=T(e),s=[],i=0,o=0,c=0,u=0,l=0,d=0;for(let r of t){if(e.isIgnored(r.relative_path))continue;if(te(e,r.relative_path)){u++;continue}if(ne(e,r.symbol,r.relative_path)){l++;continue}let a=n(r.relative_path,r.start_line,r.symbol,r.parent_type_name),p=a?.disposition==="implicit-usage"?a.reason:void 0,f=p?"implicit-usage":r.same_file_refs===0?"dead-code":"file-internal";f==="dead-code"?i++:f==="file-internal"?o++:c++,d+=r.loc,s.push({relativePath:r.relative_path,startLine:r.start_line,endLine:r.end_line,loc:r.loc,symbol:r.symbol,shortName:Z(r.symbol),sameFileRefs:r.same_file_refs,kind:f,...p?{implicitUsageReason:p}:{}})}return{symbols:s,counts:{total:s.length,deadCode:i,fileInternal:o,implicitUsage:c,loc:d},applicability:{entrySurfaceExcluded:u,externalRootExcluded:l,implicitUsageSignals:c},totalCount:s.length,deadCodeCount:i,fileInternalCount:o,implicitUsageCount:c,totalLoc:d}}function lt(e,t,n,s){if(t.length===0)return;let i=new I(e),o=new Set(t.map(l=>l.symbolId)),c=new Set(t.map(l=>l.leaf).filter(Boolean)),u=new Set(i.sourceFiles());for(let l of L(e))u.add(l);i.scanSourceReferences({paths:u,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:c,skipPath:l=>s.inactiveBarrelPaths.has(l)},l=>{o.has(l.target.symbolId)&&(mt(e,l)||C(n,l.target.symbolId,l.sourceFile,ft(l),"source-fallback"))})}function ut(e,t,n,s){if(t.length===0)return;let i=new I(e),o=X(t),c=new Set(i.sourceFiles());for(let r of L(e))c.add(r);let u=new Set(o.keys()),l=new Map,d=r=>{let a=l.get(r);return a||(a=oe(e,r),l.set(r,a)),a};i.scanSourceReferences({paths:c,includeVueSfc:!0,includeCrossLanguageDispatchNames:!0,includeRustAttributeNames:!0,identifierResolution:"permissive",candidateNames:u,skipPath:r=>s.inactiveBarrelPaths.has(r),resolveTargets:({sourceFile:r,name:a,kind:p})=>{let f=o.get(a);return f?dt(r,a,f,()=>d(r),{permissive:p!=="cross-language-dispatch"}):[]},afterPath:r=>{l.delete(r),_e(e,r)}},r=>{let a=r.kind==="identifier"&&r.sourceFile===r.target.relativePath?Math.max(0,r.occurrences-1):r.occurrences;r.kind==="identifier"&&Le(e,{sourceFile:r.sourceFile,name:r.name,target:r.target,occurrences:a})||C(n,r.target.symbolId,r.sourceFile,a,"source-fallback")})}function dt(e,t,n,s,i){let o=n.filter(d=>d.relativePath===e);if(o.length>0)return o;if(!i.permissive&&n.length===1)return[...n];let c=s(),u=c.get(t);if(u)for(let d of u){let r=n.filter(a=>D(d,a.relativePath));if(r.length>0)return r}let l=new Set;for(let d of c.values())for(let r of d)l.add(r);for(let d of l){let r=n.filter(a=>D(d,a.relativePath));if(r.length>0&&r.length===n.length)return r}return i.permissive?[...n]:[]}function mt(e,t){return t.kind==="cross-language-dispatch"&&t.target.relativePath===t.sourceFile?!0:t.kind==="identifier"&&Le(e,t)}function ft(e){return e.kind==="identifier"&&e.target.relativePath===e.sourceFile?Math.max(0,e.occurrences-1):e.occurrences}function Le(e,t){return t.occurrences>1?!1:H(e,t.sourceFile).some(n=>n.used||n.sourcePath!==t.target.relativePath?!1:n.importedName===t.name||n.localName===t.name)}function pt(e,t,n,s){let i=new Set,o=s.includeSemantic!==!1,c=(r,a)=>{a===r.relativePath||e.isIgnored(a)||s.inactiveBarrelPaths.has(a)||De(n,r.symbolId,a,1,"caller-map")};if(y("dead.caller-map.per-symbol-non-semantic",()=>{for(let r of t){let a=ae(e,r,{semantic:!1,semanticEvidence:le});for(let p of a)c(r,p.file)}},()=>({definitions:t.length,semantic:!1})),!o)return i;let u=0,l=y("dead.caller-map.semantic-candidates",()=>{let r=t.filter(a=>!R(n,a.symbolId,a.relativePath));return u=r.length,r},()=>({definitions:t.length,semanticCandidates:u}));if(l.length===0)return i;let d=ce(e,l);for(let r of d.incompleteSymbolIds)i.add(r);for(let r of d.unavailableSymbolIds)i.add(r);for(let r of l){let a=d.callers.get(r.symbolId);if(a)for(let p of a)c(r,p)}return i}export{Ct as a,Yt as b};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-6P5QMOM7.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as m}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as m}from"./chunk-PFMQRHC6.js";var v=/:\d+(?:-\d+)?$/u;function D(d,t,c={}){let p=c.direction??"backward",n=c.maxDepth??3;if(!Number.isSafeInteger(n)||n<0)throw new RangeError(`Dependence-slice depth must be a non-negative safe integer; received ${n}.`);let r=v.test(t),o=m(d,r?{locations:[t]}:{symbols:[t]},{families:["execution","runtime","dataflow","ownership"],maxDepth:n+1,maxEdges:c.maxEdges??200}),f=new Set(o.targets.flatMap(e=>e.nodeIds)),a=new Set(f),l=new Map;u(o.edges,a,l,0);for(let e=1;e<=n;e+=1){let s=[];for(let i of o.edges)if(p==="backward"?a.has(i.to.id):a.has(i.from.id)){let g=p==="backward"?i.from.id:i.to.id;if(a.has(g))continue;s.push(g),l.set(i.id,e)}if(s.length===0)break;for(let i of s)a.add(i);u(o.edges,a,l,e)}let h=o.edges.filter(e=>a.has(e.from.id)&&a.has(e.to.id)).filter(e=>l.has(e.id)||e.family==="ownership").map(e=>({...e,traversalDepth:l.get(e.id)??0,supporting:e.family!=="dataflow"&&!y(e)})).sort((e,s)=>e.traversalDepth-s.traversalDepth||e.family.localeCompare(s.family)||e.from.label.localeCompare(s.from.label)||e.to.label.localeCompare(s.to.label));return{kind:"dependence-slice",direction:p,criterion:t,targets:o.targets,nodeIds:[...a].sort(),edges:h,coverage:{status:o.coverage.status,criterionKind:r?"source-location-summary":"symbol-summary",basis:"partial-system-dependence-graph",analysisBasis:"typescript-cfg-reaching-definitions-plus-system-edges",providers:["typescript-local-dependence","bounded-static-value-flow"],graph:o.coverage,unsupportedRelations:["general heap alias and cross-instance field points-to flow","exceptional control and value flow","closure invocation order","downstream local definition-use after a call result","unresolved dynamic dispatch"]}}}function u(d,t,c,p){let n=!0;for(;n;){n=!1;for(let r of d)r.family!=="ownership"||!t.has(r.from.id)||t.has(r.to.id)||(t.add(r.to.id),c.set(r.id,p),n=!0)}}function y(d){return d.semanticFamily==="control"&&d.sourceKind==="control-dependence"}export{D as a};
|
|
2
|
+
//# sourceMappingURL=chunk-6S5FE4ZF.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as fe,c as z}from"./chunk-DQZF7MP6.js";import{b as me}from"./chunk-XZEE23VG.js";import{f as le,g as he}from"./chunk-OSZ7PW5K.js";import{O as x,W as v}from"./chunk-AZDY3EKD.js";import{k as de,s as b,x as pe,y as ge,z as D}from"./chunk-KPMMOAV5.js";import{AsyncLocalStorage as at}from"async_hooks";import{createHash as V}from"crypto";import{existsSync as ut,mkdirSync as ct}from"fs";import{tmpdir as dt}from"os";import{isAbsolute as pt,join as ve,resolve as Oe}from"path";var q=2,gt="CODEBASEIQ_SESSION",ye="CODEBASEIQ_SESSION_DIR",lt=128,w=new at;function be(e,t){let n=e.sessionEnabled===!1||e.json?void 0:xt(),r={enabled:n!==void 0,reemit:e.reemit===!0,command:e.command,projectRoot:Oe(e.cwd),sessionIdentity:n,staged:[],stagedEvidence:[],finalized:!1};return w.run(r,t)}function Wn(e){let t=w.getStore();!t||t.finalized||(t.generationIdentity=e)}function Gn(){return w.getStore()?.staged.length??0}function Fn(e){let t=w.getStore();!t||e<0||e>t.staged.length||(t.staged.length=e)}function W(e){let t=w.getStore();if(!t||t.finalized)return;t.finalized=!0;let n=t.state;if(!n){t.staged.length=0,t.stagedEvidence.length=0;return}try{if(e&&(t.staged.length>0||t.stagedEvidence.length>0)){let r=n.ledger.nextOrdinal,s=wt(t.staged).map(o=>({...o,ordinal:r,command:t.command})),i=Et(t.stagedEvidence).map(o=>({...o,ordinal:r,command:t.command}));n.ledger.ranges.push(...s),n.ledger.evidence.push(...i),n.ledger.nextOrdinal+=1,n.ledger.updatedAt=new Date().toISOString(),v(n.ledgerPath,n.ledger,{spacing:2,trailingNewline:!0})}}catch{}finally{n.lock.release(),t.state=null,t.staged.length=0,t.stagedEvidence.length=0}}function Qn(e){let t=e.source.split(`
|
|
3
|
+
`);if(t.length===0)return"";let n=ht(e.relativePath,e.startLine,t,e.ownerSymbol,e.sessionPolicy??"exact-unit"),r=e.indent??" ",s=e.sourceIndent??" ",i=e.focusLines??new Set;return n.map(o=>{let a=z(e.relativePath,o.startLine,o.endLine);if(o.kind==="covered"){let p=o.ordinal===null?"this command":`session #${o.ordinal} via ${o.command}`;return[`${r}${a} [source previously emitted: ${p}; not repeated]`,...e.afterHeader??[]].join(`
|
|
4
|
+
`)}let u=e.headerSuffix??"",d=o.lines.map((p,g)=>{let l=o.startLine+g,c=e.showFocusMarker===!1?"":i.has(l)?">":" ",m=e.lineNumberWidth??5;return`${s}${c}${String(fe(l)).padStart(m)} ${p}`});return[`${r}${a}${u}`,...e.blankAfterHeader?[""]:[],...e.afterHeader??[],...d].join(`
|
|
5
|
+
`)}).join(`
|
|
6
|
+
`)}function Jn(e){let t=w.getStore();if(!t||!t.enabled)return e.content;let n=G(t);if(!n)return e.content;let r=we(e.content),s=T(n.ledger.evidence,i=>i.kind===e.kind&&i.identity===e.identity&&i.contentHash===r);if(s&&!t.reemit){let i=e.label?`; ${Se(e.label)}`:"";return`${e.indent??""}[${e.kind} evidence previously emitted: receipt ${s.receiptId}; session #${s.ordinal} via ${s.command}${i}; not repeated]`}return t.stagedEvidence.push({kind:e.kind,identity:e.identity,contentHash:r,receiptId:At(e.kind,e.identity,r),...e.label?{label:Se(e.label)}:{}}),e.content}function Xn(e=!1){let t=w.getStore();if(!t?.enabled)return{enabled:!1,reason:"No explicit CODEBASEIQ_SESSION is active; source packets render independently.",uniqueLines:0,evidenceItems:0,emissions:0,rows:[]};let n=G(t);if(!n)return{enabled:!1,reason:"The exploration-session ledger was unavailable or contended; evidence output is fail-open for this command.",uniqueLines:0,evidenceItems:0,emissions:0,rows:[]};if(e){n.ledger.ranges=[],n.ledger.evidence=[],n.ledger.nextOrdinal=1,n.ledger.updatedAt=new Date().toISOString();try{v(n.ledgerPath,n.ledger,{spacing:2,trailingNewline:!0})}catch{return{enabled:!1,reason:"The exploration-session ledger could not be reset; evidence output remains fail-open.",uniqueLines:0,evidenceItems:0,emissions:0,rows:[]}}}let r=new Map;for(let a of n.ledger.ranges){let u=r.get(a.ordinal)??[];u.push(a),r.set(a.ordinal,u)}let s=new Map;for(let a of n.ledger.evidence){let u=s.get(a.ordinal)??[];u.push(a),s.set(a.ordinal,u)}let o=[...new Set([...r.keys(),...s.keys()])].sort((a,u)=>a-u).map(a=>{let u=r.get(a)??[],d=s.get(a)??[],p=u[0]?.command??d[0]?.command??"unknown",g=u.length===0?null:(()=>{let m=u.slice(0,8).map(h=>z(h.relativePath,h.startLine,h.endLine)).join(", "),f=u.length>8?`, ... ${u.length-8} more range(s)`:"";return` #${a} ${p}: ${m}${f}`})();if(d.length===0)return g;let l=d.slice(0,8).map(m=>`${m.receiptId} ${m.kind}${m.label?` ${m.label}`:""}`).join(", "),c=d.length>8?`, ... ${d.length-8} more item(s)`:"";return g?`${g}
|
|
7
|
+
evidence: ${l}${c}`:` #${a} ${p}: ${l}${c}`});return{enabled:!0,uniqueLines:Ct(n.ledger.ranges),evidenceItems:n.ledger.evidence.length,emissions:new Set([...r.keys(),...s.keys()]).size,rows:o}}function ht(e,t,n,r,s){let i=w.getStore(),o=t+n.length-1;if(!i)return[{kind:"source",startLine:t,endLine:o,lines:[...n]}];let u=(i.enabled?G(i):null)?.ledger.ranges??[],d=n.map(we),p=s==="exact-unit"&&!i.reemit?T(u,h=>h.policy==="exact-unit"&&h.relativePath===e&&h.startLine===t&&h.endLine===o&&h.ownerSymbol===r&&Nt(h.lineHashes,d)):void 0;if(p)return[{kind:"covered",startLine:t,endLine:o,ordinal:p.ordinal,command:p.command}];let g=s==="exact-unit"&&!i.reemit?ft(u,e,t,o,d):void 0;if(g)return[{kind:"covered",startLine:t,endLine:o,ordinal:g.ordinal,command:g.command}];let l=n.map((h,y)=>mt(u,e,t+y,d[y]));if(!(s==="preview"&&!i.reemit&&l.every(h=>h!==void 0)))return i.staged.push({relativePath:e,startLine:t,endLine:o,ownerSymbol:r,policy:s,lineHashes:d}),[{kind:"source",startLine:t,endLine:o,lines:[...n]}];let m=[],f=0;for(;f<n.length;){let h=l[f],y=f;for(;y+1<n.length&&yt(h,l[y+1]);)y+=1;let S=t+f,E=t+y;m.push({kind:"covered",startLine:S,endLine:E,ordinal:h.ordinal,command:h.command}),f=y+1}return m}function mt(e,t,n,r){let s=T(e,i=>i.relativePath===t&&i.startLine<=n&&n<=i.endLine&&i.lineHashes[n-i.startLine]===r);if(s)return{ordinal:s.ordinal,command:s.command}}function ft(e,t,n,r,s){let i=T(e,o=>o.policy==="exact-unit"&&o.relativePath===t&&o.startLine<=n&&o.endLine>=r&&s.every((a,u)=>o.lineHashes[n-o.startLine+u]===a));return i?{ordinal:i.ordinal,command:i.command}:void 0}function yt(e,t){return!e||!t?e===t:e.ordinal===t.ordinal&&e.command===t.command}function G(e){if(e.state!==void 0)return e.state;if(!e.sessionIdentity||!e.generationIdentity)return e.state=null,null;try{let t=Pt();ct(t,{recursive:!0,mode:448});let n=V("sha256").update(e.projectRoot).update("\0").update(e.generationIdentity).update("\0").update(e.sessionIdentity).digest("hex"),r=ve(t,`${n}.json`),s=x(`${r}.lock`,{kind:"source-emission-session",detail:{session:n.slice(0,12)}});if(s.kind!=="acquired")return e.state=null,null;let i;try{i=ut(r)?vt(JSON.parse(b(r,"source emission session ledger")),{projectRoot:e.projectRoot,generationIdentity:e.generationIdentity,sessionIdentity:e.sessionIdentity}):St(e)}catch{return s.lock.release(),e.state=null,null}return e.state={ledgerPath:r,lock:s.lock,ledger:i},e.state}catch{return e.state=null,null}}function St(e){return{version:q,projectRoot:e.projectRoot,generationIdentity:e.generationIdentity,sessionIdentity:e.sessionIdentity,nextOrdinal:1,updatedAt:new Date().toISOString(),ranges:[],evidence:[]}}function vt(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Invalid source emission ledger.");let n=e;if(e.version===1&&n.projectRoot===t.projectRoot&&n.generationIdentity===t.generationIdentity&&n.sessionIdentity===t.sessionIdentity&&Number.isSafeInteger(n.nextOrdinal)&&(n.nextOrdinal??0)>0)return{version:q,projectRoot:t.projectRoot,generationIdentity:t.generationIdentity,sessionIdentity:t.sessionIdentity,nextOrdinal:n.nextOrdinal,updatedAt:typeof n.updatedAt=="string"?n.updatedAt:new Date().toISOString(),ranges:[],evidence:[]};if(n.version!==q||n.projectRoot!==t.projectRoot||n.generationIdentity!==t.generationIdentity||n.sessionIdentity!==t.sessionIdentity||!Number.isSafeInteger(n.nextOrdinal)||(n.nextOrdinal??0)<=0||!Array.isArray(n.ranges)||!n.ranges.every(Ot)||!Array.isArray(n.evidence)||!n.evidence.every(bt))throw new Error("Invalid source emission ledger.");return n}function Ot(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return typeof t.relativePath=="string"&&t.relativePath!==""&&Number.isSafeInteger(t.startLine)&&(t.startLine??-1)>=0&&Number.isSafeInteger(t.endLine)&&(t.endLine??-1)>=(t.startLine??0)&&Number.isSafeInteger(t.ordinal)&&(t.ordinal??0)>0&&typeof t.command=="string"&&t.command!==""&&(t.policy==="exact-unit"||t.policy==="preview")&&Array.isArray(t.lineHashes)&&t.lineHashes.length===(t.endLine??0)-(t.startLine??0)+1&&t.lineHashes.every(Ie)&&(t.ownerSymbol===void 0||typeof t.ownerSymbol=="string")}function bt(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return(t.kind==="unit"||t.kind==="edge")&&typeof t.identity=="string"&&t.identity!==""&&typeof t.contentHash=="string"&&Ie(t.contentHash)&&typeof t.receiptId=="string"&&/^ev-[0-9a-f]{12}$/u.test(t.receiptId)&&Number.isSafeInteger(t.ordinal)&&(t.ordinal??0)>0&&typeof t.command=="string"&&t.command!==""&&(t.label===void 0||typeof t.label=="string")}function wt(e){let t=[...e].sort((r,s)=>r.relativePath.localeCompare(s.relativePath)||r.startLine-s.startLine||r.endLine-s.endLine),n=[];for(let r of t){let s=n[n.length-1];if(s&&s.relativePath===r.relativePath&&s.ownerSymbol===r.ownerSymbol&&s.policy===r.policy&&r.startLine<=s.endLine+1&&It(s,r)){let i=r.startLine-s.startLine;for(let o=0;o<r.lineHashes.length;o+=1)s.lineHashes[i+o]??=r.lineHashes[o];s.endLine=Math.max(s.endLine,r.endLine)}else n.push({...r,lineHashes:[...r.lineHashes]})}return n}function It(e,t){let n=Math.max(e.startLine,t.startLine),r=Math.min(e.endLine,t.endLine);for(let s=n;s<=r;s+=1)if(e.lineHashes[s-e.startLine]!==t.lineHashes[s-t.startLine])return!1;return!0}function Et(e){let t=new Set,n=[];for(let r of e){let s=`${r.kind}\0${r.identity}\0${r.contentHash}`;t.has(s)||(t.add(s),n.push(r))}return n}function Ct(e){let t=new Map;for(let r of e){let s=t.get(r.relativePath)??[];s.push(r),t.set(r.relativePath,s)}let n=0;for(let r of t.values()){r.sort((o,a)=>o.startLine-a.startLine||o.endLine-a.endLine);let s=-1,i=-1;for(let o of r)s<0?(s=o.startLine,i=o.endLine):o.startLine<=i+1?i=Math.max(i,o.endLine):(n+=i-s+1,s=o.startLine,i=o.endLine);s>=0&&(n+=i-s+1)}return n}function Pt(){let e=process.env[ye];if(!e)return ve(dt(),`codebaseiq-source-sessions-${process.getuid?.()??"user"}`);if(!pt(e))throw new Error(`${ye} must be an absolute path.`);return Oe(e)}function xt(){let e=process.env[gt]?.trim();if(e&&!(e.length>lt||!/^[A-Za-z0-9._:-]+$/.test(e)))return`explicit:${e}`}function At(e,t,n){return`ev-${V("sha256").update(e).update("\0").update(t).update("\0").update(n).digest("hex").slice(0,12)}`}function Se(e){let t=e.replace(/[\r\n\t]+/gu," ").replace(/\s+/gu," ").trim();return t.length<=160?t:`${t.slice(0,157)}...`}function we(e){return V("sha256").update(e).digest("hex")}function Nt(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function T(e,t){for(let n=e.length-1;n>=0;n-=1){let r=e[n];if(t(r))return r}}function Ie(e){return typeof e=="string"&&/^[0-9a-f]{64}$/u.test(e)}import{createHash as Lt}from"crypto";import{existsSync as Q,mkdirSync as _t,rmSync as Rt}from"fs";import{tmpdir as Tt}from"os";import{isAbsolute as kt,join as Ce,resolve as k}from"path";var Pe=1,$t="CODEBASEIQ_SESSION",Ee="CODEBASEIQ_SESSION_DIR",Mt=128,xe=8,Ae=32768,$=new Map;function ir(e,t,n=!0){if(!n)return;let r=M();if(!r)return;let s=Y(e),i=t.map(a=>a.trim()).filter(a=>a.startsWith("codebaseiq system-map ")&&a.length<=Ae).slice(0,xe),o=Ne(s,r);i.length===0?$.delete(o):$.set(o,i)}function J(e,t,n,r=!0,s){if(!r||e!=="anchors"&&e!=="system-map")return;let i=M();if(!i)return;let o=Y(t),a=K(o,i);if(e==="system-map"){n?Rt(a,{force:!0}):Q(a)&&s&&F(a,()=>{let u=Z(a,o,i);u&&v(a,{...u,pendingMapContinuation:s,mapExecution:void 0,updatedAt:new Date().toISOString()},{spacing:2,trailingNewline:!0})});return}F(a,()=>{let u=Ht(o,i),d={version:Pe,projectRoot:o,sessionIdentity:i,mapRequired:!0,...u.length>0?{recommendedMapCommands:u}:{},updatedAt:new Date().toISOString()};v(a,d,{spacing:2,trailingNewline:!0})})}function X(e,t=!0){if(!t)return;let n=M();if(!n)return;let r=Y(e),s=K(r,n);Q(s)&&F(s,()=>{let i=Z(s,r,n);if(i){if(i.pendingMapContinuation)throw new Error(["MAP TRANSPORT INCOMPLETE","The selected system map has already been computed. Restarting it would repeat the same repository work.",`Continue exactly: ${i.pendingMapContinuation}`].join(`
|
|
8
|
+
`));if(i.mapExecution&&Ut(i.mapExecution.processId))throw new Error(["NAVIGATION MAP ALREADY RUNNING","A selected system map is already computing in this CODEBASEIQ_SESSION.","Poll the existing terminal execution. Do not launch a duplicate map or inspect in parallel."].join(`
|
|
9
|
+
`));v(s,{...i,mapExecution:{processId:process.pid,startedAt:new Date().toISOString()},updatedAt:new Date().toISOString()},{spacing:2,trailingNewline:!0})}})}function or(e,t,n=!0){if(!n)return;let r=M();if(!r)return;let s=K(k(e),r);if(!Q(s))return;let i=Z(s,k(e),r);if(!i?.mapRequired)return;let o=i.recommendedMapCommands?.length?["This refusal is a recoverable protocol step, not evidence that the requested code cannot be explored.","Run exactly one of the ranked map commands below, then finish every emitted continuation:",...i.recommendedMapCommands.map((a,u)=>` [${u+1}] ${a}`)]:[`Do not retry ${t}. Run one printed next-abstraction system-map command and finish every emitted continuation first.`];throw new Error(["NAVIGATION MAP REQUIRED","An anchors locator completed in this CODEBASEIQ_SESSION, but its selected system map has not reached transport completion.",`Do not retry ${t}.`,...o,"The map must complete before the agent can choose source detail; map and detail exploration cannot run concurrently."].join(`
|
|
10
|
+
`))}function Z(e,t,n){try{let r=JSON.parse(b(e,"navigation session state"));return r.version===Pe&&r.projectRoot===t&&r.sessionIdentity===n&&r.mapRequired===!0&&(r.recommendedMapCommands===void 0||Array.isArray(r.recommendedMapCommands)&&r.recommendedMapCommands.length<=xe&&r.recommendedMapCommands.every(s=>typeof s=="string"&&s.startsWith("codebaseiq system-map ")&&s.length<=Ae))&&(r.pendingMapContinuation===void 0||typeof r.pendingMapContinuation=="string")&&(r.mapExecution===void 0||typeof r.mapExecution=="object"&&r.mapExecution!==null&&Number.isSafeInteger(r.mapExecution.processId)&&typeof r.mapExecution.startedAt=="string")?r:null}catch{return null}}function Ht(e,t){let n=Ne(e,t),r=$.get(n)??[];return $.delete(n),r}function Ne(e,t){return`${e}\0${t}`}function Ut(e){try{return process.kill(e,0),!0}catch(t){return t.code==="EPERM"}}function K(e,t){let n=Bt();_t(n,{recursive:!0,mode:448});let r=Lt("sha256").update(e).update("\0").update(t).digest("hex");return Ce(n,`navigation-${r}.json`)}function Bt(){let e=process.env[Ee];if(!e)return Ce(Tt(),`codebaseiq-source-sessions-${process.getuid?.()??"user"}`);if(!kt(e))throw new Error(`${Ee} must be an absolute path.`);return k(e)}function Y(e){let t=process.env.CODEBASEIQ_PROJECT_ROOT?.trim();return k(t||e)}function M(){let e=process.env[$t]?.trim();if(e&&!(e.length>Mt||!/^[A-Za-z0-9._:-]+$/u.test(e)))return`explicit:${e}`}function F(e,t){let n=x(`${e}.lock`,{kind:"navigation-session",detail:{state:e.slice(-17,-5)}});if(n.kind!=="acquired")throw new Error("Navigation session state is busy. Retry the completed command.");try{t()}finally{n.lock.release()}}import{createHash as U,randomBytes as Dt}from"crypto";import{chmodSync as zt,closeSync as te,fstatSync as _e,lstatSync as qt,mkdirSync as Vt,openSync as $e,readSync as Wt,readdirSync as Me,renameSync as Gt,rmSync as He,statSync as Ft,writeSync as Qt}from"fs";import{tmpdir as Jt}from"os";import{join as _}from"path";import{StringDecoder as Ue}from"string_decoder";import{InvalidArgumentError as Re}from"commander";var jt=/^[A-Za-z0-9_@%+=:,./-]+$/u;function Le(e,t={}){return t.omitSafeQuotes&&jt.test(e)?e:(t.platform??process.platform)==="win32"?`"${e.replaceAll("%","%%").replaceAll('"','\\"')}"`:`'${e.replaceAll("'",`'"'"'`)}'`}var Xt="codebaseiq-output-page",Zt=1,Kt="continue",H=32e3,A=256,N=1e5,B=4096,ne=32e6,Yt=64*1024*1024,en=256*1024*1024,tn=32,re=32768,Be=3600*1e3,je=3;function De(){return _(Jt(),`codebaseiq-output-pages-${typeof process.getuid=="function"?process.getuid():"user"}`)}var ae=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u,ze=/^[A-Za-z0-9_][A-Za-z0-9_-]{11}$/u,nn=/^4\.([A-Za-z0-9_-]{22})\.([0-9a-z]{1,10})$/u,rn=/^([A-Za-z0-9_][A-Za-z0-9_-]{11})(?:\.([0-9a-z]{1,10}))?$/u,qe=1,sn="quota.lock",on=2e3,an=5,Te=1024*1024,un=new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT)),ee,cn=Object.freeze({maxSnapshotBytes:Yt,maxAggregateBytes:en,maxSnapshotCount:tn});var Ve={writeStdout:e=>{process.stdout.write(e)},writeStderr:e=>{process.stderr.write(e)}};async function dn(e,t,n=Ve){return be({command:e.command,cwd:e.cwd,argv:e.argv,json:e.json,sessionEnabled:e.sourceSession,reemit:e.reemitSource},async()=>{try{await pn(e,t,n)}finally{W(!1)}})}async function pn(e,t,n){let r=e.pageSize??H,s=e.snapshotRoot??De(),i=Sn(e.snapshotLimits),o=e.maxOutputCharacters??ne;if(!Number.isSafeInteger(o)||o<=0)throw new Error("Output character safety limit must be a positive integer.");let a=Math.min(o,ne);if(We(r),e.cursor!==void 0&&e.cursor.length>B)throw new Error(`Output cursor exceeds the ${B}-character limit. Run the command again without --output-cursor.`);if(e.json&&e.pageSize===void 0&&e.cursor===void 0){e.command==="system-map"&&X(e.cwd,e.sourceSession!==!1),await gn(e,t,n);return}let u=tt(e.argv),d=rt(e.invocationPrefix),p=et(e.command,e.cwd,d,u),g=e.cursor===void 0?void 0:Nn(e.cursor,p);e.command==="system-map"&&!g&&X(e.cwd,e.sourceSession!==!1);let l=g?.snapshotId,c;if(g)try{c=hn(g,p,r,a,s,e.onSnapshotRead)}catch(S){let E=S instanceof Error?S.message:String(S);throw new Error(`${E} Restart with: ${nt(d,u,r)}`,{cause:S})}else{let S=new ie(p,d,e.command,e.cwd,u,r,a,s,i,!e.json),E=Ge(),ot=ln(R=>{E?.observe(R.toString("utf8")),S.write(R)}),ce=!1;try{await t(),E&&process.stdout.write(E.render()),ce=!0}finally{ot(),ce||S.abort()}let P;try{P=S.complete()}catch(R){throw S.abort(),R}l=P.snapshotId,c={content:P.content,offset:0,pageIndex:0,pageCount:P.pageCount,totalCharacters:P.totalCharacters,outputHash:P.outputHash}}let m=c.offset+c.content.length,f=c.pageIndex+1>=c.pageCount,h=f?void 0:xn({invocationPrefix:d,nextPageIndex:c.pageIndex+1,snapshotId:En(l)});if(J(e.command,e.cwd,f,e.sourceSession!==!1,h?.command),c.offset===0&&f&&e.cursor===void 0){n.writeStdout(c.content),W(!0),l&&C(l,s);return}let y={kind:Xt,schemaVersion:Zt,producer:{name:"codebaseiq",version:e.producerVersion},command:e.command,contentType:e.json?"application/json":"text/plain",agentInstruction:h?"INCOMPLETE EVIDENCE: do not draw conclusions or report completion from this partial page. Run page.continuation.command exactly, then repeat until page.complete is true.":"OUTPUT COMPLETE: all rendered characters have been retrieved. Evaluate the command result's own coverage separately.",page:h?{offset:c.offset,returnedCharacters:c.content.length,totalCharacters:c.totalCharacters,omittedCharacters:c.totalCharacters-c.content.length,remainingCharacters:c.totalCharacters-m,complete:!1,outputHash:c.outputHash,continuation:h}:{offset:c.offset,returnedCharacters:c.content.length,totalCharacters:c.totalCharacters,omittedCharacters:c.totalCharacters-c.content.length,remainingCharacters:c.totalCharacters-m,complete:!0,outputHash:c.outputHash},content:c.content};if(e.json){n.writeStdout(`${JSON.stringify(y)}
|
|
11
|
+
`),f&&l&&C(l,s);return}n.writeStdout($n(y)),f&&l&&C(l,s)}async function Cr(e,t,n=De(),r=Ve){if(e.length>B)throw new Error(`Output cursor exceeds the ${B}-character limit.`);let s=Ye(e);if(!s)throw new Error("Invalid output cursor. Run the original command again.");let i=Je(s.snapshotId,n);await dn({command:i.command,producerVersion:t,invocationPrefix:i.invocationPrefix,argv:[...i.argv,"--output-page-size",String(i.pageSize),"--output-cursor",e],cwd:i.cwd,json:i.argv.some(o=>o==="--json"||o.startsWith("--json=")),sourceSession:!i.argv.some(o=>o==="--no-session"),pageSize:i.pageSize,cursor:e,snapshotRoot:n},()=>{throw new Error("Output continuation attempted to rerun the original command.")},r)}function Pr(e){if(!/^\d+$/u.test(e))throw new Re(`Output page size must be an integer from ${A} through ${N}.`);let t=Number(e);try{We(t)}catch{throw new Re(`Output page size must be an integer from ${A} through ${N}.`)}return t}function We(e){if(!Number.isSafeInteger(e)||e<A||e>N)throw new Error(`Output page size must be an integer from ${A} through ${N}.`)}async function gn(e,t,n){let r=new se(H,e.maxOutputCharacters??ne),s=process.stdout.write,i=!1,o=`${me(`codebaseiq: JSON output exceeds ${H} characters and may be truncated by the client. Do not use possibly partial client output as evidence. Read every page with: ${nt(rt(e.invocationPrefix),tt(e.argv),H)}`)}
|
|
12
|
+
`,a=Ge();process.stdout.write=((u,d,p)=>{a?.observe(Fe(u,d).toString("utf8"));let g=r.push(u,d);return g!==void 0&&(i||(i=!0,n.writeStderr(o)),s.call(process.stdout,g)),Qe(d,p),!0});try{await t();let u=r.finish();u.crossedPageBoundary&&!i&&(i=!0,n.writeStderr(o)),u.bytes.length>0&&s.call(process.stdout,u.bytes),i&&n.writeStderr(o),a&&n.writeStderr(a.render()),J(e.command,e.cwd,!0,e.sourceSession!==!1)}finally{process.stdout.write=s}}function Ge(){let e=le();return e?he(e):void 0}function ln(e){let t=process.stdout.write;return process.stdout.write=((n,r,s)=>{let i=Fe(n,r);return e(i),Qe(r,s),!0}),()=>{process.stdout.write=t}}function Fe(e,t){return typeof e=="string"?Buffer.from(e,typeof t=="string"?t:"utf8"):Buffer.from(e)}function Qe(e,t){let n=typeof e=="function"?e:t;typeof n=="function"&&n()}var se=class{constructor(t,n){this.limit=t;this.maxOutputCharacters=n}limit;maxOutputCharacters;decoder=new Ue("utf8");chunks=[];overflowed=!1;totalCharacters=0;push(t,n){let r=typeof t=="string"?Buffer.from(t,typeof n=="string"?n:"utf8"):Buffer.from(t);if(this.addCharacters(this.decoder.write(r)),this.overflowed)return r;if(this.chunks.push(r),this.totalCharacters<=this.limit)return;this.overflowed=!0;let s=Buffer.concat(this.chunks);return this.chunks.length=0,s}finish(){this.addCharacters(this.decoder.end());let t=this.totalCharacters>this.limit,n=Buffer.concat(this.chunks);return this.chunks.length=0,{bytes:n,crossedPageBoundary:t}}addCharacters(t){if(this.totalCharacters+=t.length,!Number.isSafeInteger(this.totalCharacters)||this.totalCharacters>this.maxOutputCharacters)throw new Error(`Command output exceeds the ${this.maxOutputCharacters}-character safety limit. Narrow the query before retrying.`)}},ie=class{constructor(t,n,r,s,i,o,a,u,d,p){this.invocationHash=t;this.invocationPrefix=n;this.command=r;this.cwd=s;this.argv=i;this.pageSize=o;this.maxOutputCharacters=a;this.snapshotRoot=u;this.limits=d;this.preferLineBoundaries=p;ue(u);do this.snapshotId=Dt(9).toString("base64url");while(this.snapshotId.startsWith("-"));this.temporaryPath=O(u,this.snapshotId,"tmp")}invocationHash;invocationPrefix;command;cwd;argv;pageSize;maxOutputCharacters;snapshotRoot;limits;preferLineBoundaries;snapshotId;temporaryPath;decoder=new Ue("utf8");hash=U("sha256");pages=[];descriptor=null;pending="";firstPageContent="";totalCharacters=0;pageCharacterOffset=0;byteLength=0;reservedBytes=0;opened=!1;finished=!1;write(t){if(this.finished)throw new Error("Output snapshot writer is closed.");this.appendDecoded(this.decoder.write(t))}complete(){if(this.finished)throw new Error("Output snapshot writer is closed.");if(this.appendDecoded(this.decoder.end()),this.finished=!0,!this.opened){let s=this.pending,i=Buffer.from(s);return this.assertWithinByteLimit(i.length),this.hash.update(i),this.pending="",{content:s,totalCharacters:this.totalCharacters,outputHash:this.hash.digest("hex"),pageCount:1}}if((this.pending.length>0||this.pages.length===0)&&(this.flushPage(this.pending),this.pending=""),this.descriptor===null)throw new Error("Output snapshot writer is not open.");te(this.descriptor),this.descriptor=null;let t=this.hash.digest("hex"),n=O(this.snapshotRoot,this.snapshotId,"output"),r=O(this.snapshotRoot,this.snapshotId,"json");try{Gt(this.temporaryPath,n);let s={version:je,snapshotId:this.snapshotId,invocationHash:this.invocationHash,invocationPrefix:[...this.invocationPrefix],command:this.command,cwd:this.cwd,argv:[...this.argv],outputHash:t,pageSize:this.pageSize,pages:this.pages,totalCharacters:this.totalCharacters,byteLength:this.byteLength,createdAtMs:Date.now()};return v(r,s),ke(this.snapshotRoot,this.snapshotId,this.byteLength,"complete",this.limits),this.reservedBytes=this.byteLength,{content:this.firstPageContent,totalCharacters:this.totalCharacters,outputHash:t,pageCount:this.pages.length,snapshotId:this.snapshotId}}catch(s){throw C(this.snapshotId,this.snapshotRoot),s}}abort(){this.descriptor!==null&&(te(this.descriptor),this.descriptor=null),this.finished=!0,C(this.snapshotId,this.snapshotRoot)}appendDecoded(t){if(t.length===0)return;let n=this.totalCharacters+t.length;if(!Number.isSafeInteger(n)||n>this.maxOutputCharacters)throw new Error(`Command output exceeds the ${this.maxOutputCharacters}-character safety limit. Narrow the query before retrying.`);for(this.totalCharacters=n,this.pending+=t,this.assertWithinByteLimit(this.byteLength+Buffer.byteLength(this.pending));this.pending.length>this.pageSize;){this.open();let r=Pn(this.pending,this.pageSize,this.preferLineBoundaries),s=this.pending.slice(0,r);this.pending=this.pending.slice(r),this.flushPage(s)}}open(){if(!this.opened){vn(this.snapshotRoot,this.snapshotId,0,this.limits);try{this.descriptor=$e(this.temporaryPath,"wx",384),this.opened=!0}catch(t){throw On(this.snapshotRoot,this.snapshotId),t}}}flushPage(t){if(this.descriptor===null)throw new Error("Output snapshot writer is not open.");if(this.pages.length>=re)throw new Error(`Command output requires more than ${re} snapshot pages. Retry with a larger --output-page-size or narrow the query.`);let n=Buffer.from(t),r=this.byteLength+n.length;if(this.assertWithinByteLimit(r),r>this.reservedBytes){let o=Math.min(this.limits.maxSnapshotBytes,Math.ceil(r/Te)*Te);ke(this.snapshotRoot,this.snapshotId,o,"active",this.limits),this.reservedBytes=o}let s=0;for(;s<n.length;){let o=Qt(this.descriptor,n,s,n.length-s);if(o<=0)throw new Error("Output snapshot write made no progress.");s+=o}let i={characterOffset:this.pageCharacterOffset,characterLength:t.length,byteOffset:this.byteLength,byteLength:n.length,hash:U("sha256").update(n).digest("hex")};this.pages.length===0&&(this.firstPageContent=t),this.pages.push(i),this.hash.update(n),this.pageCharacterOffset+=t.length,this.byteLength=r}assertWithinByteLimit(t){if(!Number.isSafeInteger(t)||t>this.limits.maxSnapshotBytes)throw new Error(`Command output exceeds the ${this.limits.maxSnapshotBytes}-byte snapshot limit. Narrow the query before retrying.`)}};function hn(e,t,n,r,s,i){ue(s);let o=Je(e.snapshotId,s);if(o.invocationHash!==t)throw new Error("This output cursor belongs to a different command, working directory, or argument set. Run again without --output-cursor.");if(o.snapshotId!==e.snapshotId||e.version===3&&(o.invocationHash!==e.invocationHash||o.outputHash!==e.outputHash))throw new Error("Output snapshot identity does not match this cursor.");if(o.pageSize!==n||e.version===3&&e.pageSize!==n)throw new Error(`Output page size changed after this cursor was issued; use ${o.pageSize}.`);let a=o.pages[e.pageIndex];if(!a)throw new Error("Output cursor points past the current result.");if(o.totalCharacters>r)throw new Error(`Output snapshot exceeds the ${r}-character safety limit.`);if(Date.now()-o.createdAtMs>Be)throw C(e.snapshotId,s),new Error("Output snapshot expired before all pages were read.");let u=O(s,e.snapshotId,"output"),d=$e(u,"r");try{let p=_e(d);if(!p.isFile()||p.size!==o.byteLength)throw new Error("Output snapshot size or type changed.");let g=Buffer.allocUnsafe(a.byteLength),l=0;for(;l<g.length;){let f=Wt(d,g,l,g.length-l,a.byteOffset+l);if(f===0)break;l+=f,i?.(f)}let c=_e(d);if(c.dev!==p.dev||c.ino!==p.ino||c.size!==p.size||l!==a.byteLength)throw new Error("Output snapshot changed while it was being read.");if(U("sha256").update(g).digest("hex")!==a.hash)throw new Error("Output snapshot page no longer matches its metadata.");let m=g.toString("utf8");if(m.length!==a.characterLength)throw new Error("Output snapshot page character count changed.");return{content:m,offset:a.characterOffset,pageIndex:e.pageIndex,pageCount:o.pages.length,totalCharacters:o.totalCharacters,outputHash:o.outputHash}}catch(p){throw C(e.snapshotId,s),p}finally{te(d)}}function Je(e,t){if(!I(e))throw new Error("Output snapshot identifier is invalid.");let n;try{n=JSON.parse(b(O(t,e,"json"),"output snapshot metadata"))}catch(r){throw new Error("Output snapshot is unavailable.",{cause:r})}if(!mn(n))throw new Error("Output snapshot metadata is invalid.");return n}function mn(e){if(!e||typeof e!="object")return!1;let t=e;return t.version===je&&typeof t.snapshotId=="string"&&I(t.snapshotId)&&L(t.invocationHash)&&st(t.invocationPrefix)&&typeof t.command=="string"&&t.command.length>0&&t.command.length<=256&&typeof t.cwd=="string"&&t.cwd.length>0&&t.cwd.length<=8192&&kn(t.argv)&&et(t.command,t.cwd,t.invocationPrefix,t.argv)===t.invocationHash&&L(t.outputHash)&&Number.isSafeInteger(t.pageSize)&&(t.pageSize??0)>=A&&(t.pageSize??0)<=N&&Array.isArray(t.pages)&&t.pages.length>1&&t.pages.length<=re&&t.pages.every(fn)&&yn(t.pages)&&Number.isSafeInteger(t.totalCharacters)&&(t.totalCharacters??-1)>=0&&t.pages.reduce((n,r)=>n+r.characterLength,0)===t.totalCharacters&&Number.isSafeInteger(t.byteLength)&&(t.byteLength??-1)>=0&&t.pages.reduce((n,r)=>n+r.byteLength,0)===t.byteLength&&Number.isSafeInteger(t.createdAtMs)&&(t.createdAtMs??-1)>=0}function fn(e){if(!e||typeof e!="object")return!1;let t=e;return Number.isSafeInteger(t.characterOffset)&&(t.characterOffset??-1)>=0&&Number.isSafeInteger(t.characterLength)&&(t.characterLength??0)>0&&Number.isSafeInteger(t.byteOffset)&&(t.byteOffset??-1)>=0&&Number.isSafeInteger(t.byteLength)&&(t.byteLength??0)>0&&L(t.hash)}function yn(e){let t=0,n=0;for(let r of e){if(r.characterOffset!==t||r.byteOffset!==n)return!1;t+=r.characterLength,n+=r.byteLength}return!0}function ue(e){Vt(e,{recursive:!0,mode:448});let t=qt(e);if(!t.isDirectory()||t.isSymbolicLink())throw new Error(`Output snapshot root is not a private directory: ${e}`);if(typeof process.getuid=="function"&&t.uid!==process.getuid())throw new Error(`Output snapshot root is not owned by the current user: ${e}`);process.platform!=="win32"&&zt(e,448)}function Sn(e){let t={...cn,...e};for(let[n,r]of Object.entries(t))if(!Number.isSafeInteger(r)||r<=0)throw new Error(`Output snapshot ${n} must be a positive integer.`);if(t.maxSnapshotBytes>t.maxAggregateBytes)throw new Error("Output snapshot maxSnapshotBytes cannot exceed maxAggregateBytes.");return t}function vn(e,t,n,r){j(e,()=>{wn(e),Xe(e,t,n,"active",r)})}function ke(e,t,n,r,s){if(!Number.isSafeInteger(n)||n<0||n>s.maxSnapshotBytes)throw new Error(`Command output exceeds the ${s.maxSnapshotBytes}-byte snapshot limit.`);j(e,()=>{Xe(e,t,n,r,s)})}function Xe(e,t,n,r,s){if(!Number.isSafeInteger(n)||n<0||n>s.maxSnapshotBytes)throw new Error(`Command output exceeds the ${s.maxSnapshotBytes}-byte snapshot limit.`);let i=bn(e),o=i.find(g=>g.snapshotId===t),a=i.reduce((g,l)=>g+l.reservedBytes,0)-(o?.reservedBytes??0)+n,u=i.length+(o?0:1);if(u>s.maxSnapshotCount||a>s.maxAggregateBytes)throw new Error(`Output snapshot capacity is full (${u}/${s.maxSnapshotCount} snapshots, ${a}/${s.maxAggregateBytes} bytes). Narrow the query or finish an existing pagination sequence before retrying.`);let d=Date.now(),p={version:qe,snapshotId:t,pid:process.pid,...oe()?{processIdentity:oe()}:{},reservedBytes:n,state:r,createdAtMs:o?.createdAtMs??d,updatedAtMs:d};v(O(e,t,"reserve"),p)}function On(e,t){j(e,()=>{He(O(e,t,"reserve"),{force:!0})})}function bn(e){let t=[];for(let n of Me(e,{withFileTypes:!0})){if(!n.isFile()||!n.name.endsWith(".reserve"))continue;let r=n.name.slice(0,-8);if(I(r))try{let s=JSON.parse(b(_(e,n.name),"output snapshot reservation"));if(!Ze(s)||s.snapshotId!==r)throw new Error("reservation identity is invalid");t.push(s)}catch(s){throw new Error(`Output snapshot reservation ${n.name} is invalid; retry after its owning process or snapshot expires.`,{cause:s})}}return t}function Ze(e){if(!e||typeof e!="object")return!1;let t=e;return t.version===qe&&typeof t.snapshotId=="string"&&I(t.snapshotId)&&Number.isSafeInteger(t.pid)&&(t.pid??0)>0&&(t.processIdentity===void 0||pe(t.processIdentity)!==null&&t.processIdentity.pid===t.pid)&&Number.isSafeInteger(t.reservedBytes)&&(t.reservedBytes??-1)>=0&&(t.state==="active"||t.state==="complete")&&Number.isSafeInteger(t.createdAtMs)&&Number.isSafeInteger(t.updatedAtMs)}function wn(e){let t=Date.now();for(let n of Me(e,{withFileTypes:!0})){if(!n.isFile()||!n.name.endsWith(".reserve"))continue;let r=n.name.slice(0,-8);if(!I(r))continue;let s=null;try{let u=JSON.parse(b(_(e,n.name),"output snapshot reservation"));s=Ze(u)?u:null}catch{s=null}let i=In(O(e,r,"json")),o=s?.state==="active"&&de(s.pid)&&(s.processIdentity===void 0||(()=>{let u=D(s.pid);return u!==null&&ge(s.processIdentity,u)})()),a=s?t-s.updatedAtMs>Be:!1;o||i&&!a||!i&&s&&!a&&s.state==="complete"||Ke(r,e)}}function In(e){try{return Ft(e),!0}catch{return!1}}function j(e,t){ue(e);let n=_(e,sn),r=Date.now()+on;for(;;){let s=x(n,{kind:"output-snapshot-quota",processIdentity:oe()});if(s.kind==="acquired")try{return t()}finally{s.lock.release()}if(Date.now()>=r)throw new Error("Output snapshot quota is busy. Retry the command.");Atomics.wait(un,0,0,an)}}function oe(){return ee===void 0&&(ee=D(process.pid)),ee}function C(e,t){I(e)&&j(t,()=>Ke(e,t))}function Ke(e,t){for(let n of["json","output","tmp","reserve"])He(O(t,e,n),{force:!0})}function O(e,t,n){if(!I(t))throw new Error("Output snapshot identifier is invalid.");return _(e,`${t}.${n}`)}function En(e){if(!e)throw new Error("Incomplete output did not create a resumable snapshot.");return e}function Cn(e){return e>=55296&&e<=56319}function Pn(e,t,n){if(n){let r=e.lastIndexOf(`
|
|
13
|
+
`,t-1);if(r>=0)return r+1}return Cn(e.charCodeAt(t-1))?t-1:t}function xn(e){let t=An({pageIndex:e.nextPageIndex,snapshotId:e.snapshotId});return{cursor:t,command:Tn(e.invocationPrefix,t)}}function An(e){return ze.test(e.snapshotId)?e.pageIndex===1?e.snapshotId:`${e.snapshotId}.${e.pageIndex.toString(36)}`:`4.${_n(e.snapshotId)}.${e.pageIndex.toString(36)}`}function Nn(e,t){let n=Ye(e);if(!n)throw new Error("Invalid output cursor. Run the command again without --output-cursor.");if(n.version===3&&n.invocationHash!==t)throw new Error("This output cursor belongs to a different command, working directory, or argument set. Run again without --output-cursor.");return n}function Ye(e){let t=rn.exec(e);if(t){let r=t[2]??"1",s=Number.parseInt(r,36);return Number.isSafeInteger(s)&&s>=1&&s.toString(36)===r?{version:4,pageIndex:s,snapshotId:t[1]}:null}let n=nn.exec(e);if(n){let r=Rn(n[1]),s=Number.parseInt(n[2],36);return r&&Number.isSafeInteger(s)&&s>=1&&s.toString(36)===n[2]?{version:4,pageIndex:s,snapshotId:r}:null}try{let r=JSON.parse(Buffer.from(e,"base64url").toString("utf8"));return Ln(r)?r:null}catch{return null}}function Ln(e){if(!e||typeof e!="object")return!1;let t=e;return t.version===3&&L(t.invocationHash)&&Number.isSafeInteger(t.pageIndex)&&(t.pageIndex??-1)>=1&&Number.isSafeInteger(t.pageSize)&&(t.pageSize??0)>=A&&(t.pageSize??0)<=N&&L(t.outputHash)&&typeof t.snapshotId=="string"&&I(t.snapshotId)}function _n(e){if(!ae.test(e))throw new Error("Output snapshot identifier is invalid.");return Buffer.from(e.replaceAll("-",""),"hex").toString("base64url")}function Rn(e){let t=Buffer.from(e,"base64url");if(t.length!==16)return null;let n=t.toString("hex"),r=`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`;return ae.test(r)?r:null}function I(e){return typeof e=="string"&&(ze.test(e)||ae.test(e))}function L(e){return typeof e=="string"&&/^[a-f0-9]{64}$/u.test(e)}function et(e,t,n,r){return U("sha256").update(JSON.stringify({command:e,cwd:t,invocationPrefix:n,argv:r})).digest("hex")}function tt(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e[n];if(r==="--output-page-size"||r==="--output-cursor"){n+=1;continue}r.startsWith("--output-page-size=")||r.startsWith("--output-cursor=")||t.push(r)}return t}function nt(e,t,n){return it([...e,...t,"--output-page-size",String(n)])}function Tn(e,t){return it([...e,Kt,t])}function rt(e){let t=e===void 0?["codebaseiq"]:[...e];if(!st(t))throw new Error("Output pagination invocation prefix must contain one to sixteen non-empty shell arguments.");return t}function st(e){return Array.isArray(e)&&e.length>0&&e.length<=16&&e.every(t=>typeof t=="string"&&t.length>0&&t.length<=2048&&!t.includes("\0")&&!t.includes("\r")&&!t.includes(`
|
|
14
|
+
`))}function kn(e){return Array.isArray(e)&&e.length>0&&e.length<=256&&e.every(t=>typeof t=="string"&&t.length<=8192&&!t.includes("\0")&&!t.includes("\r")&&!t.includes(`
|
|
15
|
+
`))}function it(e){return e.map(t=>Le(t,{omitSafeQuotes:!0})).join(" ")}function $n(e){let t=e.page.continuation,n=Math.max(e.page.offset,e.page.offset+e.page.returnedCharacters-1),r=`[codebaseiq output page: characters ${e.page.offset}-${n} of ${e.page.totalCharacters}]
|
|
16
|
+
`,s=t?`
|
|
17
|
+
[Incomplete: ${e.page.remainingCharacters} characters remain. Continue exactly:
|
|
18
|
+
${t.command}]
|
|
19
|
+
`:`
|
|
20
|
+
[codebaseiq transport complete; evaluate command coverage separately]
|
|
21
|
+
`;return`${r}${e.content}${s}`}export{Le as a,Wn as b,Gn as c,Fn as d,Qn as e,Jn as f,Xn as g,ir as h,or as i,Kt as j,H as k,dn as l,Cr as m,Pr as n};
|
|
22
|
+
//# sourceMappingURL=chunk-74LRKLNC.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{H as x,J as h,M as P,N as g,O as _,P as y,Q as f,R as p}from"./chunk-6I55VYFG.js";var re=new Set(["aix","android","darwin","freebsd","haiku","linux","openbsd","sunos","win32","cygwin","netbsd"]);function S(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let r=e;return r.version!==1||typeof r.pid!="number"||!Number.isSafeInteger(r.pid)||r.pid<=0||typeof r.platform!="string"||!re.has(r.platform)||typeof r.startToken!="string"||r.startToken.trim()===""?null:{version:1,pid:r.pid,platform:r.platform,startToken:r.startToken}}function m(e,r){return e.version===r.version&&e.pid===r.pid&&e.platform===r.platform&&e.startToken===r.startToken}import{execFileSync as te}from"child_process";import{platform as ne}from"os";var N=new WeakMap,oe=1e3,A=16*1024;function k(e,r=ce){if(!Number.isSafeInteger(e)||e<=0)return null;if(e===process.pid){let t=N.get(r);if(t)return t}try{let t=ie(e,r);if(!t)return null;let n={version:1,pid:e,platform:r.platform,startToken:t};return e===process.pid&&N.set(r,n),n}catch{return null}}function ie(e,r){if(r.platform==="linux"||r.platform==="android")return se(r.readFile(`/proc/${e}/stat`));if(r.platform==="win32"){let t=`([DateTimeOffset](Get-Process -Id ${e} -ErrorAction Stop).StartTime).ToUnixTimeMilliseconds()`;return M(r.run("powershell.exe",["-NoProfile","-NonInteractive","-Command",t]))}return r.platform==="darwin"||r.platform==="freebsd"||r.platform==="openbsd"||r.platform==="netbsd"?M(r.run("ps",["-p",String(e),"-o","lstart="])):null}function se(e){let r=e.lastIndexOf(")");if(r<0)return null;let n=e.slice(r+1).trim().split(/\s+/)[19];return n&&/^\d+$/.test(n)?n:null}function M(e){let r=e.trim();return r===""?null:r}var ce={platform:ne(),readFile(e){return h(e,{maxBytes:A,inputKind:"process identity pseudo-file"})},run(e,r){return te(e,[...r],{encoding:"utf8",timeout:oe,maxBuffer:A,env:{...process.env,LC_ALL:"C",LANG:"C"},stdio:["ignore","pipe","ignore"],windowsHide:!0})}};function C(e){try{return process.kill(e,0),!0}catch(r){return typeof r=="object"&&r!==null&&"code"in r&&r.code==="EPERM"}}function Ze(){return performance.now()}import{randomUUID as le}from"crypto";import{closeSync as ae,fsyncSync as de,linkSync as ue,mkdirSync as me,openSync as fe,statSync as ye,unlinkSync as pe,writeSync as be}from"fs";import{dirname as L}from"path";var R="codebaseiq-process-lock",T=1,w=Object.freeze({wallNow:()=>Date.now(),isProcessAlive:C,readProcessIdentity:k,randomToken:()=>le(),makeDirectory:e=>me(e,{recursive:!0}),openFile:(e,r,t)=>fe(e,r,t),writeFile:(e,r,t,n)=>be(e,r,t,n),syncFile:e=>de(e),closeFile:e=>ae(e),linkFile:(e,r)=>ue(e,r),readFile:e=>x(e,"process lock record"),statFile:e=>{let r=ye(e);return{dev:r.dev,ino:r.ino,size:r.size,mtimeMs:r.mtimeMs}},removeFile:e=>pe(e)});function lr(e,r){let t=r.runtime??w;t.makeDirectory(L(e));let n;for(let o=0;o<2;o+=1)try{return{kind:"acquired",lock:B(e,r,t),...n?{reclaimed:n}:{}}}catch(i){if(i.code!=="EEXIST")throw i;let s=b(e,{parseLegacy:r.parseLegacy,runtime:t});if(o===0&&Fe(e,s,{creationGraceMs:r.creationGraceMs,parseLegacy:r.parseLegacy,runtime:t})){n=s;continue}return{kind:"contended",observation:s}}return{kind:"contended",observation:b(e,{parseLegacy:r.parseLegacy,runtime:t})}}function b(e,r={}){let t=r.runtime??w,n,o;try{n=t.statFile(e),o=t.readFile(e)}catch(a){return a.code==="ENOENT"?{state:"missing"}:{state:"malformed"}}let i;try{i=JSON.parse(o)}catch{return{state:"malformed",raw:o,identity:n}}let s=Pe(i);if(s)return{state:"valid",raw:o,identity:n,record:s,owner:we(s),parsed:i};let c=r.parseLegacy?.(i)??null;return c?{state:"legacy",raw:o,identity:n,owner:c,parsed:i}:{state:"malformed",raw:o,identity:n,parsed:i}}function Pe(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let r=e;if(r.protocol!==R||r.version!==T||typeof r.kind!="string"||r.kind.trim()===""||typeof r.pid!="number"||!Number.isSafeInteger(r.pid)||r.pid<=0||typeof r.token!="string"||r.token.trim()===""||typeof r.startedAt!="string"||!Number.isFinite(Date.parse(r.startedAt))||r.detail!==void 0&&(typeof r.detail!="object"||r.detail===null||Array.isArray(r.detail)))return null;let t=r.processIdentity===void 0?null:S(r.processIdentity);return r.processIdentity!==void 0&&(!t||t.pid!==r.pid)?null:{protocol:R,version:T,kind:r.kind,pid:r.pid,token:r.token,...t?{processIdentity:t}:{},startedAt:r.startedAt,...r.detail?{detail:r.detail}:{}}}function Fe(e,r,t={}){let n=t.runtime??w;if(!E(r,n))return!1;let o=ke(`${e}.reclaim`,n);if(!o)return!1;try{let i=b(e,{parseLegacy:t.parseLegacy,runtime:n});return!W(r,i)||!E(i,n)?!1:O(e,n)}finally{o.release()}}function B(e,r,t){let n=r.pid??process.pid,o=t.randomToken(),i=r.processIdentity===void 0?t.readProcessIdentity(n):r.processIdentity,s={protocol:R,version:T,kind:r.kind,pid:n,token:o,...i?{processIdentity:i}:{},startedAt:new Date(t.wallNow()).toISOString(),...r.detail?{detail:r.detail}:{}},c=`${e}.${o}.candidate`,a=t.openFile(c,"wx",384),l;try{P(a,Buffer.from(`${JSON.stringify(s)}
|
|
2
|
+
`),t,"process lock"),t.syncFile(a)}catch(u){l=u}try{t.closeFile(a)}catch(u){l??=u}if(l!==void 0)throw I(c,t),l;try{t.linkFile(c,e)}catch(u){throw I(c,t),u}I(c,t);try{J(L(e),t)}catch(u){throw U(e,s,t),u}let d=!1;return{path:e,record:s,release:()=>d?!1:(d=!0,U(e,s,t))}}function U(e,r,t=w){let n=b(e,{runtime:t});return n.state!=="valid"||!n.record||n.record.pid!==r.pid||n.record.token!==r.token||r.processIdentity&&(!n.record.processIdentity||!m(r.processIdentity,n.record.processIdentity))?!1:O(e,t)}function ke(e,r){for(let t=0;t<2;t+=1)try{return B(e,{kind:"reclaim-guard",runtime:r},r)}catch(n){if(n.code!=="EEXIST")return null;let o=b(e,{runtime:r});if(t>0||!E(o,r))return null;let i=b(e,{runtime:r});if(!W(o,i)||!O(e,r))return null}return null}function E(e,r){if(e.state==="missing")return!1;if(e.owner){if(!r.isProcessAlive(e.owner.pid))return!0;if(!e.owner.processIdentity)return!1;let t=r.readProcessIdentity(e.owner.pid);return t!==null&&!m(e.owner.processIdentity,t)}return!1}function W(e,r){return e.state===r.state&&e.raw===r.raw&&e.identity!==void 0&&r.identity!==void 0&&e.identity.dev===r.identity.dev&&e.identity.ino===r.identity.ino&&e.identity.size===r.identity.size&&e.identity.mtimeMs===r.identity.mtimeMs}function we(e){return{pid:e.pid,...e.processIdentity?{processIdentity:e.processIdentity}:{}}}function J(e,r){let t;try{t=r.openFile(e,"r")}catch(n){if(g(n,process.platform))return;throw n}try{r.syncFile(t)}catch(n){if(!g(n,process.platform))throw n}finally{r.closeFile(t)}}function O(e,r){try{return r.removeFile(e),J(L(e),r),!0}catch{return!1}}function I(e,r){try{r.removeFile(e)}catch{}}var ge=Object.freeze(["EPERM","EACCES","EBUSY"]),Se=Object.freeze([10,20,40,80,160,320,640,1e3,1e3,1e3]);function Ie(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)}var D=Object.freeze({platform:process.platform,sleep:Ie});function Re(e,r){if(r!=="win32")return!1;let t=e?.code;return typeof t=="string"&&ge.includes(t)}function q(e,r={}){let t=r.runtime??D,n=r.delaysMs??Se;for(let o of n)try{return e()}catch(i){if(!Re(i,t.platform))throw i;t.sleep(o)}return e()}import{chmodSync as Te,constants as Ee,copyFileSync as Le}from"fs";import{dirname as Oe}from"path";var $=Object.freeze({..._,copyFile:(e,r)=>Le(e,r,Ee.COPYFILE_FICLONE),chmodFile:(e,r)=>Te(e,r)});function De(e,r,t={}){let n=t.runtime??$,o=Oe(r),i=y(o,n);if(n.copyFile(e,r),n.platform==="win32")ve(r,t.mode,n);else{t.mode!==void 0&&n.chmodFile(r,t.mode);let s=n.openFile(r,"r");try{n.syncFile(s)}finally{n.closeFile(s)}}return p(i,f(o,n))}function ve(e,r,t){let n=!1,o;try{o=t.openFile(e,"r+")}catch(i){let s=i.code;if(s!=="EACCES"&&s!=="EPERM")throw i;t.chmodFile(e,384),n=!0,o=t.openFile(e,"r+")}try{t.syncFile(o)}finally{t.closeFile(o)}r!==void 0?t.chmodFile(e,r):n&&t.chmodFile(e,292)}import{randomUUID as xe}from"crypto";import{closeSync as he,existsSync as _e,fsyncSync as Ne,linkSync as Ae,mkdirSync as Me,openSync as Ce,renameSync as Ue,unlinkSync as Be,writeSync as We}from"fs";import{dirname as G}from"path";var j=Object.freeze({platform:process.platform,randomToken:()=>xe(),pathExists:e=>_e(e),makeDirectory:e=>Me(e,{recursive:!0}),openFile:(e,r,t)=>Ce(e,r,t),writeFile:(e,r,t,n)=>We(e,r,t,n),syncFile:e=>Ne(e),closeFile:e=>he(e),renameFile:(e,r)=>Ue(e,r),linkFile:(e,r)=>Ae(e,r),removeFile:e=>Be(e)});function gr(e,r,t={}){let n=t.durability??"visibility",o=t.runtime??j,i=G(e),s=n==="durable"?y(i,o):(o.makeDirectory(i),"not-requested"),c=`${e}.tmp-${o.randomToken()}`,a=typeof r=="string"?Buffer.from(r):r,l,d=!1;try{l=o.openFile(c,"wx",t.mode??384),d=!0,P(l,a,o,"atomic file"),n==="durable"&&o.syncFile(l),o.closeFile(l),l=void 0,q(()=>o.renameFile(c,e),{runtime:{platform:o.platform,sleep:o.sleep??D.sleep}}),d=!1;let u=n==="durable"?p(s,f(i,o)):"not-requested";return Y(n,u)}finally{if(l!==void 0)try{o.closeFile(l)}catch{}if(d)try{o.removeFile(c)}catch{}}}function Sr(e,r,t={}){let n=t.durability??"visibility",o=t.runtime??j;if(!o.linkFile)throw new Error("Exclusive atomic file publication requires hard-link support.");let i=G(e),s=n==="durable"?y(i,o):(o.makeDirectory(i),"not-requested"),c=`${e}.tmp-${o.randomToken()}`,a=typeof r=="string"?Buffer.from(r):r,l,d=!1;try{l=o.openFile(c,"wx",t.mode??384),d=!0,P(l,a,o,"exclusive atomic file"),n==="durable"&&o.syncFile(l),o.closeFile(l),l=void 0,o.linkFile(c,e);let u=n==="durable"?f(i,o):"not-requested";o.removeFile(c),d=!1;let ee=n==="durable"?p(s,u,f(i,o)):"not-requested";return Y(n,ee)}finally{if(l!==void 0)try{o.closeFile(l)}catch{}if(d)try{o.removeFile(c)}catch{}}}function Y(e,r){return{requestedDurability:e,achievedDurability:e==="visibility"?"visibility":r==="synced"?"directory-durable":"file-flushed",directorySync:r}}import{execFileSync as H}from"child_process";import{platform as Je}from"os";var qe=1e3,X=2*1024*1024,$e=1e4,Ge=25;function Dr(e,r,t=Z){let n=t.readIdentity(e),o=new Map;return n&&o.set(e,n),{rootPid:e,rootIdentity:n,ownsProcessGroup:r,knownMembers:o}}async function vr(e,r,t=Z){if(!e.rootIdentity){let a=await F(e,r.gracefulMs+r.forceMs,t);return{reaped:a,reason:a?"terminated":"identity-unavailable",detail:a?void 0:`Could not establish the birth identity of process ${e.rootPid}.`}}let n=V(e,t);if(n==="mismatch")return{reaped:!1,reason:"identity-mismatch",detail:`Process ${e.rootPid} no longer has the identity owned by this runner.`};if(n==="exited"&&!Q(e,t))return{reaped:!0,reason:"terminated"};if(t.platform==="win32"){try{t.terminateWindowsTree(e.rootPid)}catch(l){let d=await F(e,r.forceMs,t);return{reaped:d,reason:d?"terminated":"signal-failed",detail:d?void 0:v(l)}}let a=await F(e,r.forceMs,t);return{reaped:a,reason:a?"terminated":"deadline"}}let o=z(e,"SIGTERM",t);if(await F(e,r.gracefulMs,t))return{reaped:!0,reason:"terminated"};let s=z(e,"SIGKILL",t);return await F(e,r.forceMs,t)?{reaped:!0,reason:"terminated"}:s?{reaped:!1,reason:s.reason,detail:s.detail}:o?{reaped:!1,reason:o.reason,detail:o.detail}:{reaped:!1,reason:"deadline",detail:`Process tree ${e.rootPid} did not exit before its termination deadline.`}}function V(e,r){let t=r.readIdentity(e.rootPid);if(!t)return"exited";if(!e.rootIdentity||!m(e.rootIdentity,t))return"mismatch";e.knownMembers.set(e.rootPid,t);for(let n of r.listDescendantPids(e.rootPid)){let o=r.readIdentity(n);o&&e.knownMembers.set(n,o)}return"owned"}function z(e,r,t){let n=V(e,t);if(n==="mismatch")return{reason:"identity-mismatch",detail:`Process ${e.rootPid} changed identity before ${r}.`};if(n==="owned"&&e.ownsProcessGroup)try{return t.signal(-e.rootPid,r),null}catch(i){if(!K(i))return{reason:"signal-failed",detail:v(i)}}let o=null;for(let i of e.knownMembers.values()){let s=t.readIdentity(i.pid);if(!(!s||!m(i,s)))try{t.signal(i.pid,r)}catch(c){!K(c)&&o===null&&(o=v(c))}}return o===null?null:{reason:"signal-failed",detail:o}}async function F(e,r,t){let n=t.now()+r;for(;Q(e,t);){if(t.now()>=n)return!1;await t.sleep(Math.min(Ge,Math.max(1,n-t.now())))}return!0}function Q(e,r){if(!e.rootIdentity&&r.isProcessAlive(e.rootPid))return!0;for(let t of e.knownMembers.values()){let n=r.readIdentity(t.pid);if(n&&m(t,n))return!0}return!!(e.ownsProcessGroup&&r.isProcessGroupAlive(e.rootPid))}function je(e){let r=H("ps",["-axo","pid=,ppid="],{encoding:"utf8",timeout:qe,maxBuffer:X,env:{...process.env,LC_ALL:"C",LANG:"C"},stdio:["ignore","pipe","ignore"],windowsHide:!0}),t=new Map;for(let s of r.split(/\r?\n/)){let c=/^\s*(\d+)\s+(\d+)\s*$/.exec(s);if(!c)continue;let a=Number(c[1]),l=Number(c[2]),d=t.get(l)??[];d.push(a),t.set(l,d)}let n=[],o=[...t.get(e)??[]],i=new Set;for(;o.length>0;){let s=o.pop();i.has(s)||(i.add(s),n.push(s),o.push(...t.get(s)??[]))}return n}function K(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ESRCH"}function v(e){return e instanceof Error?e.message:String(e)}var Z={platform:Je(),now:Date.now,readIdentity:k,isProcessAlive(e){try{return process.kill(e,0),!0}catch(r){return typeof r=="object"&&r!==null&&"code"in r&&r.code==="EPERM"}},isProcessGroupAlive(e){if(this.platform==="win32")return!1;try{return process.kill(-e,0),!0}catch(r){return typeof r=="object"&&r!==null&&"code"in r&&r.code==="EPERM"}},listDescendantPids(e){if(this.platform==="win32")return[];try{return je(e)}catch{return[]}},signal(e,r){process.kill(e,r)},terminateWindowsTree(e){H("taskkill.exe",["/PID",String(e),"/T","/F"],{timeout:$e,maxBuffer:X,stdio:"ignore",windowsHide:!0})},async sleep(e){await new Promise(r=>setTimeout(r,e))}};export{S as a,m as b,k as c,C as d,Ze as e,lr as f,b as g,Fe as h,q as i,De as j,gr as k,Sr as l,Dr as m,vr as n};
|
|
3
|
+
//# sourceMappingURL=chunk-75A23IID.js.map
|