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,3 +1,3 @@
|
|
|
1
|
-
import{B as Q,c as N,d as _,e as w,g as k,h as A,i as z,n as f,o as S,r as R}from"./chunk-
|
|
1
|
+
import{B as Q,c as N,d as _,e as w,g as k,h as A,i as z,n as f,o as S,r as R}from"./chunk-TNLOX4TN.js";import{b as B}from"./chunk-NRNVMB2R.js";import{g as O}from"./chunk-23AD24QZ.js";var T=O("symbol-resolution",{clearGroups:[]});function he(e,n){return G(e,n).match}function G(e,n){return T.get(e,n,()=>{let t=W(e,n.trim()).filter(i=>!e.isIgnored(i.relative_path));if(t.length>0)return L(e,t);let o=P(e,n);if(o&&!e.isIgnored(o.relative_path))return L(e,[o]);let r=H(e,n);if(r.length>0)return L(e,r);let s=U(e,n);return s.length>0?L(e,s):J(e,n)})}function H(e,n){let t=n.trim().replace(/\(\)$/u,""),o=t.lastIndexOf(":");if(o<=0||o===t.length-1||t.startsWith("local:"))return[];let r=t.slice(o+1);if(!/^[\p{L}_$][\p{L}\p{N}_$]*$/u.test(r))return[];let s=[`/${r}().`,`/${r}.`,`/${r}#`,`#${r}().`,`#${r}.`,`/${r}/`],i=`gs.display_name = ? OR ${s.map(()=>"instr(gs.symbol, ?) > 0").join(" OR ")}`,a=[r,...s],l=f(e,{where:i,params:a,orderBy:"d.relative_path, der.start_line",limit:200}),m=l.length>0?[]:S(e,{where:i,params:a,orderBy:"d.relative_path, start_line",limit:200}),p=R(l,m).filter(u=>!e.isIgnored(u.relative_path)).filter(u=>_(u.symbol).replace(/\(\)$/u,"")===t);return[...new Map(p.map(u=>[`${u.symbol}\0${u.relative_path}`,u])).values()]}function U(e,n){let t=M(n),o=E(t);if(!o)return[];let r=`%${o.path}%`,s=o.leaf;return X(e,r,s,t)}function X(e,n,t,o){let r=R([],[...Y(e,n,t),...Z(e,n,t)]).filter(s=>!e.isIgnored(s.relative_path)).filter(s=>C(s,o)>1);return r.sort((s,i)=>C(i,o)-C(s,o)||s.end_line-s.start_line-(i.end_line-i.start_line)||s.start_line-i.start_line||s.symbol.localeCompare(i.symbol)),r}function Y(e,n,t){return f(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function Z(e,n,t){return S(e,{where:"d.relative_path LIKE ? AND (gs.display_name = ? OR gs.symbol LIKE ?)",params:[n,t,`%/${t}.%`]})}function J(e,n){let t=M(n),o=ae(n),r=oe(e,o),s=se(r,n,t).filter(a=>!e.isIgnored(a.relative_path));if(s.length>0)return L(e,s);let i=[];for(let a of r){if(e.isIgnored(a.relative_path))continue;let l=re(a,n,t,o);l<=0||i.push({row:a,score:l})}return i.sort((a,l)=>l.score-a.score||a.row.end_line-a.row.start_line-(l.row.end_line-l.row.start_line)||a.row.relative_path.localeCompare(l.row.relative_path)||a.row.symbol.localeCompare(l.row.symbol)),L(e,i.map(a=>a.row))}function L(e,n){let t=n.map(r=>Q(e,r)),o=t[0]??null;return{match:o,candidates:o?V(t,o):[],total:t.length}}function V(e,n){let t=new Set([`${n.symbolId}:${n.relativePath}:${n.startLine}`]),o=[];for(let r of e){let s=`${r.symbolId}:${r.relativePath}:${r.startLine}`;if(!t.has(s)&&(t.add(s),o.push({symbol:r.symbol,shortName:_(r.symbol),relativePath:r.relativePath,startLine:r.startLine}),o.length>=5))break}return o}function P(e,n){let t=n.match(/^(.+):(\d+)(?:-(\d+))?$/);if(!t)return;let[,o,r,s]=t,i=B(e,o,{allowMultiple:!1})[0]?.relativePath;if(!i)return;let a=Math.max(0,parseInt(r,10)-1),l=s?Math.max(a,parseInt(s,10)-1):a;return ee(e,i,a,l)??te(e,i,a,l)}function ee(e,n,t,o){return f(e,{where:"d.relative_path = ? AND der.start_line <= ? AND der.end_line >= ?",params:[n,t,o],orderBy:"(der.end_line - der.start_line) ASC",limit:1})[0]}function te(e,n,t,o){return S(e,{where:"d.relative_path = ? AND c.start_line <= ? AND c.end_line >= ?",params:[n,t,o],orderBy:"(MAX(c.end_line) - MIN(c.start_line)) ASC",limit:1})[0]}function be(e,n){let t=W(e,n).find(o=>!e.isIgnored(o.relative_path));return t?Q(e,t):null}function W(e,n){let t=f(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, der.start_line"}),o=t.length>0?[]:S(e,{where:"gs.symbol = ?",params:[n],orderBy:"d.relative_path, start_line"});return R(t,o)}function Se(e,n){if("symbol"in n&&"relativePath"in n)return n;let t=ne(e,n.symbolId)[0];return t?Q(e,t):null}function ne(e,n){let t=f(e,{where:"gs.id = ?",params:[n],orderBy:"der.start_line, der.end_line"}),o=S(e,{where:"gs.id = ?",params:[n],orderBy:"start_line, end_line"});return R(t,o)}function oe(e,n){let t=n.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),o=n.flatMap(a=>{let l=`%${a}%`;return[l,l,l]}),r=t.join(`
|
|
2
2
|
AND `),s=f(e,{where:r,params:o,limit:200}),i=S(e,{where:r,params:o,limit:200});return R(s,i)}function re(e,n,t,o){let r=n.trim(),s=t,i=s.replace(/\(\)$/,""),a=n.toLowerCase(),l=t.toLowerCase(),m=l.replace(/\(\)$/,""),p=e.symbol,u=_(e.symbol),y=w(e.symbol),g=e.display_name??"",$=e.symbol.toLowerCase(),d=u.toLowerCase(),h=y.toLowerCase(),x=g.toLowerCase(),b=e.relative_path.toLowerCase(),j=/[/:.]/.test(t),I=E(t),v=I?.leaf.toLowerCase(),c=0;return(p===r||p===s)&&(c+=1150),(u===r||u===s)&&(c+=1100),g===i&&(c+=1180),y===i&&(c+=1160),(`${y}()`===r||`${y}()`===s)&&(c+=955),($===a||$===l)&&(c+=1e3),(d===a||d===l)&&(c+=950),(b===a||b===l)&&(c+=925),(b.endsWith(`/${l}`)||b.endsWith(`/${a}`))&&(c+=875),x===m&&(c+=850),h===m&&(c+=825),(`${h}()`===a||`${h}()`===l)&&(c+=820),(d.endsWith(`:${l}`)||d.endsWith(`:${m}`)||d.endsWith(`:${m}()`))&&(c+=800),$.includes(l)&&(c+=120),d.includes(l)&&(c+=140),b.includes(l)&&(c+=140),x.includes(l)&&(c+=110),o.every(q=>{let D=q.toLowerCase();return $.includes(D)||d.includes(D)||b.includes(D)||x.includes(D)})&&(c+=100+o.length*15),I&&b.includes(I.path.toLowerCase())&&(c+=360,v&&(h===v||`${h}()`===v||`${h}()`==`${v}()`)&&(c+=700),k(e.symbol)&&(c+=180)),A(e.symbol)&&h===m&&(c+=60),!j&&z(e.symbol)&&(c-=160),c-=Math.min(50,Math.max(0,e.end_line-e.start_line)),c}function E(e){let n=e.trim().replace(/\\/g,"/"),t=n.lastIndexOf("/");if(t<=0||t===n.length-1)return null;let o=n.slice(t+1).replace(/\(\)$/,"");return!o||o.includes(".")?null:{path:n.slice(0,t),leaf:o}}function M(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function ae(e){let n=M(e),t=n.split(/[^A-Za-z0-9_]+/).map(o=>o.trim()).filter(o=>o.length>0);return t.length>0?[...new Set(t)]:[n]}function se(e,n,t){let o=n.trim(),r=e.filter(a=>{let l=_(a.symbol),m=w(a.symbol),p=(a.display_name??"").trim();return a.symbol===o||l===o||l===t||m===o||m===t||`${m}()`===o||p===o||p===t||`${p}()`===o||C(a,t)>1||a.relative_path===o});if(r.length===0)return[];let s=t.replace(/\(\)$/u,""),i=r.filter(a=>w(a.symbol)===s);if(i.length>0){i.sort((l,m)=>F(l,m,t));let a=i.filter(l=>A(l.symbol));return a.length>0?a:i}return r.sort((a,l)=>F(a,l,t)),r}function F(e,n,t){return C(n,t)-C(e,t)||e.end_line-e.start_line-(n.end_line-n.start_line)||e.relative_path.localeCompare(n.relative_path)||e.symbol.localeCompare(n.symbol)}function C(e,n){let t=E(n);if(!t)return 0;let o=e.relative_path.toLowerCase(),r=w(e.symbol).toLowerCase(),s=t.path.toLowerCase(),i=t.leaf.toLowerCase();return o.includes(s)?r!==i?1:k(e.symbol)?N(e.symbol)===null?5:4:N(e.symbol)===null?3:2:0}function ge(e,n,t=5){let o=K(n);if(!o)return[];let r=f(e,{where:"1 = 1",orderBy:"d.relative_path, der.start_line",limit:5e3}),s=new Map;for(let i of r){if(e.isIgnored(i.relative_path))continue;let a=_(i.symbol),l=w(i.symbol),m=i.display_name??l,p=[a,l,m].filter(g=>g.trim().length>0),u=Math.min(...p.map(g=>ie(K(g),o))),y=s.get(a);(!y||u<y.distance)&&s.set(a,{shortName:a,distance:u})}return[...s.values()].sort((i,a)=>i.distance-a.distance||i.shortName.localeCompare(a.shortName)).slice(0,t).map(i=>i.shortName)}function K(e){return M(e).toLowerCase().replace(/[^a-z0-9_]+/g,"")}function ie(e,n){if(e===n)return 0;if(e.length===0)return n.length;if(n.length===0)return e.length;let t=Array.from({length:n.length+1},(o,r)=>r);for(let o=0;o<e.length;o++){let r=[o+1];for(let s=0;s<n.length;s++){let i=e[o]===n[s]?0:1;r[s+1]=Math.min(r[s]+1,t[s+1]+1,t[s]+i)}t=r}return t[n.length]}export{he as a,G as b,be as c,Se as d,ge as e};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-DOQLO74K.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{c as S}from"./chunk-
|
|
1
|
+
import{c as S}from"./chunk-GC4I33OD.js";import{a as y,b as h}from"./chunk-4UXDBRIF.js";import{a as f}from"./chunk-6EBUAKJT.js";import{d as v}from"./chunk-XRH7R5SX.js";import{c as p}from"./chunk-RVBRPBLQ.js";import{b as d}from"./chunk-DOQLO74K.js";import{d as l,t as m}from"./chunk-TNLOX4TN.js";import{x as u}from"./chunk-23AD24QZ.js";function B(i,r,c={}){let t=g(i,r,c);if(t.kind!=="matched")return t;let{referenceEvidence:n,claimSupport:e,...s}=t;return s}function g(i,r,c={}){let t=d(i,r);if(!t.match)return{kind:"missing",query:r};if(t.total>1)return{kind:"ambiguous",query:r,total:t.total,candidates:[{symbol:t.match.symbol,shortName:l(t.match.symbol),relativePath:t.match.relativePath,startLine:t.match.startLine},...t.candidates]};let n=t.match,e=R(c.parts),s=e.includes("definition")||e.includes("references")?S(i,n.symbol,{semantic:c.semantic,referenceContext:c.referenceContext}):{definitions:[],referencedBy:[],referenceEvidence:[],claimSupport:null},o=e.includes("callers")||e.includes("callees")?f(i,n.symbol,{semantic:c.semantic}):null,a=c.relatedSourceLines??80;return{kind:"matched",query:r,symbol:n.symbol,shortName:l(n.symbol),file:n.relativePath,parts:e,definition:e.includes("definition")?v(i,n.symbol):null,referenceWindows:e.includes("references")?L(i,s.referencedBy):[],callers:e.includes("callers")?E(i,o?.callers??[],a):[],callees:e.includes("callees")?E(i,o?.callees??[],a):[],dependencies:e.includes("dependencies")?y(i,n.relativePath):[],consumers:e.includes("consumers")?h(i,n.relativePath):[],referenceEvidence:s.referenceEvidence,claimSupport:s.claimSupport}}function L(i,r){let c=r.filter(n=>n.sourceStartLine!==null&&n.sourceEndLine!==null&&n.source!==null).sort((n,e)=>n.relativePath.localeCompare(e.relativePath)||n.sourceStartLine-e.sourceStartLine||n.line-e.line),t=[];for(let n of c){let e=t[t.length-1];if(e&&e.relativePath===n.relativePath&&n.sourceStartLine<=e.endLine+1){e.endLine=Math.max(e.endLine,n.sourceEndLine),e.references.push(b(n)),e.source=u(i,e.relativePath).slice(e.startLine,e.endLine+1).join(`
|
|
2
2
|
`);continue}t.push({relativePath:n.relativePath,startLine:n.sourceStartLine,endLine:n.sourceEndLine,source:n.source,references:[b(n)]})}return t}function b(i){return{line:i.line,enclosingSymbol:i.enclosingSymbol,enclosingShort:i.enclosingShort}}function R(i){let r=i&&i.length>0?i:["definition","references"];return[...new Set(r)]}function E(i,r,c){let t=[],n=new Set;for(let e of r){if(n.has(e.symbol))continue;n.add(e.symbol);let s=(e.file?m(i,e.file).find(a=>a.symbol===e.symbol):void 0)??d(i,e.symbol).match;if(!s)continue;let o=p(i,s.relativePath,s.startLine,s.endLine,c);o&&t.push({...o,symbol:e.symbol,shortName:e.shortName,omittedLines:Math.max(0,s.endLine-o.endLine)})}return t}export{B as a,g as b};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-DP3EJ6XL.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{c as Qf,e as Zf,f as qt}from"./chunk-B2OB55RR.js";import{b as kt,c as Zl}from"./chunk-XZEE23VG.js";import{
|
|
2
|
+
import{c as Qf,e as Zf,f as qt}from"./chunk-B2OB55RR.js";import{b as kt,c as Zl}from"./chunk-XZEE23VG.js";import{D as Ql,F as ff,h as Rs,i as df,r as mf,t as Is}from"./chunk-OSZ7PW5K.js";import{$ as $r,$a as Kn,A as xn,Aa as Ke,Ab as Ur,B as Or,Ba as ks,C as Sf,Ca as J,Cb as ic,D as vf,Da as Rn,Db as rc,E as ye,Ea as er,Eb as oc,F as Cf,Fa as Ff,Fb as Wn,Ga as pe,Gb as Jf,Ha as at,Hb as Yf,I as ae,Ia as Si,Ib as Xf,Ja as Ns,Ka as kf,La as Nf,Ma as Af,Mb as zr,N as te,Na as As,Nb as js,O as xf,Oa as nn,Ob as ep,P as Ms,Pa as qn,Pb as tp,Q as At,Qa as rn,Qb as np,R as tn,Ra as _f,S as Rf,Sa as Bf,Ta as Of,Ua as nc,V as Ji,Va as $f,W as Ps,X as _t,Y as Yi,Ya as jf,Z as If,Za as Hr,_a as Hf,a as Hn,aa as Ce,ab as Uf,b as Fe,ba as Ts,c as zt,ca as $e,d as Nt,da as Un,e as Cn,ea as zn,fa as Ef,fb as zf,g as pf,ga as A,h as gf,ha as Y,i as ec,ia as Bt,j as hf,ja as st,k as me,ka as _e,l as Es,la as De,ma as Xe,n as yf,na as Xi,nb as qf,o as bf,oa as wf,pa as Lf,q as tc,qa as Qi,qb as _s,r as Ct,ra as Zi,rb as Kf,s as Br,sa as Df,sb as Gf,t as Ye,ta as W,tb as Bs,u as se,ua as Ue,ub as Gn,v as re,va as Mf,vb as Os,w as ws,wa as Pf,wb as Wf,x as Ls,xa as jr,xb as $s,y as Ds,ya as Fs,yb as Vf,z as Oe,za as Tf}from"./chunk-FPUJRBHL.js";import{d as Xm,e as Wl}from"./chunk-RS6UYNEP.js";import{$a as ot,A as tf,E as bs,J as en,La as Ae,Ra as sf,Sa as B,Ua as vs,Wa as Jl,X as nf,Ya as Cs,Za as Yl,_a as rt,ab as Ft,bb as af,cb as lf,f as Qm,g as ys,h as ht,i as Tt,k as vn,kb as cf,l as hi,lb as Xl,mb as bi,nb as Vi,ob as uf,pa as rf,pb as Ar,qa as yi,qb as _r,ra as of,rb as xs,ua as Ss,w as Zm,x as ef,y as Vl}from"./chunk-AZDY3EKD.js";import{C as jn,E as Pt,d as ql,e as Kl,j as Jm,k as Gi,l as Ym,m as pi,r as Zt,s as gi,w as Gl,x as gs,y as hs,z as Wi}from"./chunk-KPMMOAV5.js";function ip(e){return e+1}function hI(e,t){return`${ip(e)}-${ip(t)}`}function A2(e,t,n){return`${kt(e)}:${hI(t,n)}`}function _2(e,t=180){let n=kt(e).replace(/\s+/g," ").trim();return n.length>t?`${n.slice(0,t-3)}...`:n}var sc={empty(e){console.log(kt(e))},list(e,t){for(let n of e)console.log(kt(t(n)))},groupedByFile(e,t,n=i=>i.relativePath){let i="";for(let r of e){let o=n(r);o!==i&&(i&&console.log(""),console.log(kt(o)),i=o),console.log(kt(t(r)))}},sectionedReport(e){let t=!0;for(let n of e)if(!(n.skipIfEmpty&&n.rows.length===0)){t||console.log(""),t=!1,n.title!==void 0&&console.log(`\u2550\u2550\u2550 ${kt(n.title)} \u2550\u2550\u2550`),n.explanation!==void 0&&console.log(kt(n.explanation));for(let i of n.rows)console.log(kt(i))}},table(e,t,n){console.log(` ${e.map(kt).join(" ")}`);let i=n??e.map(r=>r.length);console.log(` ${i.map(r=>"\u2500".repeat(r)).join(" ")}`);for(let r of t)console.log(kt(r))}};import{SymbolInformation_Kind as Ie}from"@c4312/scip";var Hs=new Map(Object.entries(Ie).filter(([e,t])=>Number.isInteger(Number(e))&&typeof t=="string").map(([e,t])=>[Number(e),t])),rp=new Map([...Hs.entries()].map(([e,t])=>[t.toLowerCase(),e]));function qr(e){return Hs.get(e)??"Unknown"}function on(){return[Ie.Function,Ie.Method,Ie.Macro,Ie.Constructor,Ie.Getter,Ie.Setter,Ie.StaticMethod,Ie.SingletonMethod,Ie.AbstractMethod,Ie.ProtocolMethod,Ie.TraitMethod]}function op(){return[Ie.Class,Ie.Interface,Ie.Struct,Ie.Trait,Ie.Type,Ie.TypeAlias,Ie.Enum,Ie.Union,Ie.Protocol]}function $2(){return[Ie.Constant,Ie.Variable,Ie.Value,Ie.Field,Ie.Property,Ie.StaticDataMember,Ie.StaticField,Ie.StaticProperty,Ie.StaticVariable,Ie.EnumMember]}import{existsSync as yI}from"fs";import{isAbsolute as bI,join as SI}from"path";function dt(e,t){let n=ap(e,t,{allowMultiple:!1})[0]?.relativePath;return n||sp(e,t)}function In(e,t){return ap(e,t,{allowMultiple:!0}).map(n=>n.relativePath)}function sp(e,t){if(!t)return null;let n=t.replace(/\\/g,"/").replace(/^\.\//,""),i=bI(n)&&n.startsWith(e.config.projectRoot)?n.slice(e.config.projectRoot.length).replace(/^\/+/,""):n,r=SI(e.config.projectRoot,i);return yI(r)?i:null}function ap(e,t,n){let i=Es(e,t,n);if(i.length===0){if(sp(e,t))return[];let r=pe(e,t);return!r||e.isIgnored(r.relativePath)?[]:[{relativePath:r.relativePath,score:700}]}return i}function ac(e,t){let n=In(e,t),i=Fs(e,n,{sort:!0});if(i.length===0)return[];let r=i.map(a=>({symbol:a.symbol,shortName:a.shortName,startLine:a.startLine,endLine:a.endLine,signature:a.signature,children:[]})),o=new Map;for(let a of r)o.set(a.symbol,a);let s=[];for(let a=0;a<i.length;a++){let l=i[a],c=r[a];if(l.enclosingSymbol&&o.has(l.enclosingSymbol)){o.get(l.enclosingSymbol).children.push(c);continue}let u=null,d=1/0;for(let m of r)if(m!==c&&m.startLine<=c.startLine&&m.endLine>=c.endLine){if(m.startLine===c.startLine&&m.endLine===c.endLine&&!Lf(m.symbol,c.symbol))continue;let p=m.endLine-m.startLine;p<d&&(d=p,u=m)}u?u.children.push(c):s.push(c)}return s}import{basename as LE,extname as _p}from"path";function xt(e,t){let n=re(e,t.relativePath);if(n.length===0)return!1;let i=Y(t.symbol);if(!i)return!1;let r=n.slice(Math.max(0,t.startLine-2),t.startLine+1).join(`
|
|
3
3
|
`),o=Oe(i);return new RegExp(`^\\s*export\\s+(?:default\\s+)?(?:(?:async\\s+)?function\\s+${o}\\b|(?:abstract\\s+)?class\\s+${o}\\b|(?:interface|type|enum|namespace|module)\\s+${o}\\b|(?:const|let|var)\\s+${o}\\b)`,"m").test(r)?!0:vI(n,i)}function vI(e,t){if(!t)return!1;let n=new RegExp(`^\\s*export\\s*\\{[^}\\n]*\\b${Oe(t)}\\b`);return e.some(i=>n.test(i))}import{createHash as CI}from"crypto";import{TextDecoder as xI}from"util";var RI=new xI("utf-8",{fatal:!0});function lc(e){return af(e.config.projectRoot)}function Us(e,t){let n=vn(t),i;try{i=Yl(e.config.projectRoot,n,{inputKind:"repository text file"})}catch(o){if(ot(o)||o instanceof Jl)return null;throw o}let r=mp(i);return r===null?null:cp(n,i,r,dp(e),up(e))}function zs(e,t={}){let n=lc(e).filter(u=>!t.scope||u.includes(t.scope)),i=dp(e),r=up(e),o=[],s=[],a=[],l=[],c=0;for(let u of n){let d;try{d=Yl(e.config.projectRoot,u,{inputKind:"repository text file"})}catch(f){if(f instanceof Jl){l.push(u);continue}if(ot(f))continue;a.push(u);continue}let m=mp(d);if(m===null){s.push(u);continue}c+=d.byteLength,o.push(cp(u,d,m,i,r))}return{files:o,candidateFiles:n.length,scannedBytes:c,skippedBinaryPaths:s,skippedUnreadablePaths:a,skippedOversizedPaths:l}}function cp(e,t,n,i,r){let o=CI("sha256").update(t).digest("hex");return{relativePath:e,text:n,bytes:t.byteLength,freshness:{exactText:{state:"current",basis:"working-tree-read",sha256:o},semantic:II(e,o,i,r)}}}function II(e,t,n,i){if(!i.has(e))return{state:"unavailable",basis:"no-compiler-document"};let r=n.get(e);return r?{state:r===t?"aligned":"stale",basis:"indexed-input-fingerprint"}:{state:"unavailable",basis:"fingerprint-unavailable"}}function up(e){return new Set(e.all(`SELECT documents.relative_path FROM documents WHERE 1 = 1 ${e.pathExclusionsFor("documents")}`).map(t=>t.relative_path))}function dp(e){let t=new Map;if(!e.generation.metadataRaw)return t;let n=bs(e.generation.metadataRaw);if(n.kind!=="legacy"&&n.kind!=="supported")return t;let i=n.metadata.fingerprint;if(!lp(i)||!Array.isArray(i.files))return t;for(let r of i.files)!lp(r)||typeof r.path!="string"||typeof r.hash!="string"||t.set(r.path,r.hash);return t}function mp(e){if(e.includes(0))return null;try{return RI.decode(e)}catch{return null}}function lp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qs(e,t,n={}){return vi(e,t,n).rows}function vi(e,t,n={}){let i=Kr(e,[t],{additive:n.additive,semantic:n.semantic,semanticEvidence:n.semanticEvidence}),r=n.callableOnly?(i.rows.get(t.symbolId)??[]).filter(o=>st(o.symbol)||o.source==="ast-callsite"):i.rows.get(t.symbolId)??[];return{rows:typeof n.limit=="number"?r.slice(0,n.limit):r,semanticIncomplete:i.incompleteSymbolIds.has(t.symbolId),semanticUnavailable:i.unavailableSymbolIds.has(t.symbolId)}}function Ks(e,t,n){return uc(e,t,n).rows}function uc(e,t,n){let i=sn(e,[t],n);return{rows:i.rows.get(t.symbolId)??[],semanticIncomplete:i.incompleteSymbolIds.has(t.symbolId),semanticUnavailable:i.unavailableSymbolIds.has(t.symbolId)}}function pp(e,t,n){return sn(e,t,n).rows}function sn(e,t,n){let i=MI(e)?TI(e,t,{semantic:n.semantic!==!1,semanticEvidence:n.semanticEvidence}):PI(e,n.semanticEvidence,{semantic:n.semantic!==!1});return{rows:new Map(t.map(o=>[o.symbolId,typeof n.limit=="number"?(i.rows.get(o.symbolId)??[]).slice(0,n.limit):i.rows.get(o.symbolId)??[]])),incompleteSymbolIds:new Set(t.filter(o=>i.incompleteSymbolIds.has(o.symbolId)).map(o=>o.symbolId)),unavailableSymbolIds:new Set(t.filter(o=>i.unavailableSymbolIds.has(o.symbolId)).map(o=>o.symbolId))}}var EI=Fe("caller-rows",{clearGroups:["whole-project"]}),wI=Fe("caller-rows-non-semantic",{clearGroups:["whole-project"]}),LI=Fe("targeted-caller-strategy",{clearGroups:["whole-project"]}),DI=2e4;function MI(e){return LI.get(e,()=>(e.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>DI)}function PI(e,t,n={}){return(n.semantic===!1?wI:EI).get(e,()=>{let r=Ue(e),o=Kr(e,r,{semantic:n.semantic!==!1,semanticEvidence:t}),s=new Map;for(let c of r)s.set(c.symbol,c.symbolId);let a=new Map,l=new Map;for(let c of r){let u=o.rows.get(c.symbolId);if(!(!u||u.length===0))for(let d of u){let m=s.get(d.symbol);if(m===void 0||m===c.symbolId)continue;let f=a.get(m);f||(f=[],a.set(m,f),l.set(m,new Set));let p=`${c.symbol}|${c.relativePath}`;l.get(m).has(p)||(l.get(m).add(p),f.push({symbol:c.symbol,file:c.relativePath,source:"caller-map-inversion",callEvidence:d.source}))}}return{rows:a,incompleteSymbolIds:o.incompleteSymbolIds.size===0?new Set:new Set(r.map(c=>c.symbolId)),unavailableSymbolIds:o.unavailableSymbolIds.size===0?new Set:new Set(r.map(c=>c.symbolId))}})}function TI(e,t,n){let i=n.semantic&&n.semanticEvidence?t.flatMap(u=>{let d=FI(e,u);return d?[d]:[]}):[],r=new Map(i.map(u=>[u.symbolId,u])),o=n.semantic&&n.semanticEvidence?n.semanticEvidence.referenceEvidenceMap(e,i):{rows:new Map,incompleteSymbolIds:new Set,unavailableSymbolIds:new Set},s=Hf(e,t),a=new Map;for(let u of t){let d=[],m=new Set,f=g=>{if(g.symbol===u.symbol)return;let h=`${g.symbol}|${g.file}`;m.has(h)||(m.add(h),d.push(g))};for(let g of s.get(u.symbolId)??[])g.file!==u.relativePath&&f({symbol:g.enclosingSymbol??g.file,file:g.file,source:"resolved-reference"});let p=r.get(u.symbolId);if(p)for(let g of o.rows.get(p.symbolId)??[]){if(g.file===u.relativePath||e.isIgnored(g.file))continue;let h=Ke(W(e,g.file),g.line);f({symbol:h?.symbol??g.file,file:g.file,source:"semantic-reference"})}a.set(u.symbolId,d)}let l=new Set(o.incompleteSymbolIds),c=new Set(o.unavailableSymbolIds);if(n.semantic)for(let u of t)r.has(u.symbolId)||l.add(u.symbolId);return{rows:a,incompleteSymbolIds:l,unavailableSymbolIds:c}}function FI(e,t){let n=on().join(", "),i=op().join(", ");return e.get(`SELECT
|
|
4
4
|
d.id AS documentId,
|
|
5
5
|
gs.id AS symbolId,
|
|
@@ -542,4 +542,4 @@ ${r}`:""}`);return $W(i.stdout,e)})}function $W(e,t){let n;try{n=JSON.parse(e)}c
|
|
|
542
542
|
Maintenance Pressure:`);for(let t of e.pressure)console.log(` ${t.category}: ${t.count} / ${t.threshold} threshold (${t.ratio}x, -${t.extraPenalty} ${t.kind})`)}}function D2(e){let t=e.axes;if(console.log(`
|
|
543
543
|
Axes:`),console.log(` Zero-reference candidates: ${t.deletable.loc} LOC across ${t.deletable.symbols} symbols`),t.changeAmplification){let i=t.changeAmplification;console.log(` Change amplification: ${i.medianFilesPerCommit} files/commit median, ${i.p90FilesPerCommit} p90 (${i.commitsAnalyzed} commits)`)}if(t.hiddenCoupling&&t.hiddenCoupling.pairCount>0){console.log(` Hidden coupling: ${t.hiddenCoupling.pairCount} co-changing pair(s) without a dependency edge`);for(let i of t.hiddenCoupling.top.slice(0,3))console.log(` ${i.fileA} <-> ${i.fileB} (${i.together}x together, ${Math.round(i.confidence*100)}%)`)}if(t.churnWeightedComplexity&&t.churnWeightedComplexity.length>0){let i=t.churnWeightedComplexity[0];i.weighted>0&&console.log(` Churn x complexity: hottest is ${i.symbol} (${i.changes} changes, weighted ${i.weighted})`)}let n=t.evidenceQuality;if(console.log(` Evidence quality: ${n.graphFindings} graph-fact finding(s), ${n.heuristicFindings} heuristic finding(s), ${n.userSuppressed} user-suppressed`),e.validation&&e.validation.flaggedFiles>0){let i=e.validation,r=i.ratio===null?"n/a":`${i.ratio}x`;console.log(` Validation: flagged files fix-density ${i.flaggedFixDensity} vs baseline ${i.baselineFixDensity} (${r})`),console.log(` fix-commit signal: subject-keyword heuristic over ${i.validationBasis.commitsScanned} commits`)}}async function Xce(e){let t=Ol(o=>{let s=Pr(o,{base:e.base});return s.note?{kind:"complete",result:pl(o,{base:e.base})}:s.changedFiles.length===0?{kind:"complete",result:pl(o,{base:e.base})}:{kind:"batched",plan:s}}),n=t.value;if(n.kind==="complete")return{result:n.result,observationReceipt:jl([t.anchor],[],["index-generation","live-workspace"])};let i=UR(n.plan.changedFiles,t2),r=await Am(i,M2(i.length),(o,s)=>k2(o,e,s));return{result:gl(n.plan.changedFiles,r.map(o=>o.result)),observationReceipt:jl([t.anchor],r.map(o=>o.observationReceipt),["index-generation","live-workspace"])}}var M2=iI({envKey:"CODEBASEIQ_DIFF_IMPACT_CONCURRENCY",defaultMinimum:n2,defaultMaximum:i2});function iI(e){return(t,n=process.env,i=ZW)=>P2(t,n,i,e)}function P2(e,t,n,i){let r=t[i.envKey],o=F2(n,i),s=r?parseInt(r,10):o,a=!Number.isFinite(s)||s<1?Math.min(o,e):Math.min(s,e),l=T2(t);return l===null?a:Math.min(l,a)}function T2(e){let t=e.CODEBASEIQ_MAX_CONCURRENCY;if(!t)return null;let n=parseInt(t,10);return Number.isFinite(n)&&n>=1?n:null}function F2(e,t){let n=e(),i=Number.isFinite(n)?Math.max(t.defaultMinimum,n-1):0;return Math.min(t.defaultMaximum,Math.max(t.defaultMinimum,i))}function k2(e,t,n){let i=process.argv[1]??$m(import.meta.url),r=[];return t.base&&r.push("--base",t.base),_l({cliPath:i,command:e2,args:r,env:{...process.env,CODEBASEIQ_DIFF_IMPACT_FILES:JSON.stringify(e)},label:"Diff-impact batch",signal:n})}function Qce(e){console.log(`Changed files: ${e.summary.totalChangedFiles}`),console.log(`Changed symbols: ${e.summary.totalChangedSymbols}`),console.log(`Affected consumer files: ${e.summary.totalAffectedFiles}`),e.summary.note&&console.log(`Note: ${e.summary.note}`);for(let n of e.evidenceTiers.filter(i=>i.state==="failed"))console.log(`WARNING: ${n.tier} evidence failed for ${n.attemptedSymbols} candidate symbol(s): ${n.reason}`);let t=e.attributionNotes.filter(n=>n.method==="unattributed");if(t.length>0){let n=[...new Set(t.map(i=>i.file))];for(let i of n){let r=t.filter(o=>o.file===i).length;console.log(`note: ${r} changed line-range(s) in ${i} belong to no indexed symbol`)}}console.log(""),e.changedSymbols.length>0&&(console.log("Changed symbols:"),sc.list(e.changedSymbols,n=>` ${n.file} ${n.shortName} (fan-in: ${n.fanIn})`)),e.affectedConsumers.length>0&&(console.log(`
|
|
544
544
|
Affected consumer files:`),sc.list(e.affectedConsumers,n=>` ${n.file} (${n.consumedSymbols} symbol(s))`))}export{ip as a,hI as b,A2 as c,_2 as d,sc as e,qr as f,on as g,op as h,$2 as i,sa as j,EY as k,CL as l,Li as m,SD as n,pu as o,gu as p,yo as q,hu as r,Ia as s,BP as t,Eo as u,ac as v,Ec as w,DE as x,wo as y,Lo as z,_a as A,ib as B,XT as C,vF as D,qX as E,b0 as F,hN as G,jo as H,pd as I,$N as J,iv as K,ji as L,wA as M,MA as N,PA as O,TA as P,qA as Q,WA as R,VA as S,JA as T,XA as U,QA as V,ZA as W,Hi as X,yv as Y,zo as Z,Cd as _,x_ as $,qo as aa,w_ as ba,L_ as ca,N_ as da,$_ as ea,j_ as fa,H_ as ga,Wo as ha,Ld as ia,Vo as ja,GB as ka,Jo as la,Yo as ma,Md as na,Xo as oa,Qo as pa,Pd as qa,OO as ra,Zo as sa,q$ as ta,Od as ua,$d as va,D1 as wa,Pr as xa,NC as ya,lj as za,ts as Aa,$H as Ba,is as Ca,lU as Da,rs as Ea,ZU as Fa,ez as Ga,lz as Ha,xz as Ia,Mz as Ja,Gz as Ka,dm as La,Wx as Ma,fm as Na,Vx as Oa,Ll as Pa,xq as Qa,cs as Ra,us as Sa,ds as Ta,PK as Ua,TK as Va,FK as Wa,xm as Xa,kl as Ya,Im as Za,dG as _a,GG as $a,WG as ab,JG as bb,XG as cb,lW as db,gW as eb,zi as fb,uce as gb,Cce as hb,ZR as ib,e2 as jb,Wce as kb,Vce as lb,Jce as mb,b2 as nb,Yce as ob,Xce as pb,Qce as qb};
|
|
545
|
-
//# sourceMappingURL=chunk-
|
|
545
|
+
//# sourceMappingURL=chunk-DQZF7MP6.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as de}from"./chunk-ZNH33XIB.js";import{a as me}from"./chunk-GDHWOA57.js";import{a as he}from"./chunk-BBP7HVBJ.js";import{a as ge}from"./chunk-6YTSKJJ3.js";import{a as fe}from"./chunk-2E6OUPCF.js";import{a as ce}from"./chunk-TNJGTQWO.js";import{a as le}from"./chunk-MZNMASFM.js";import{a as ue}from"./chunk-WWCV4E6J.js";import{a as ae}from"./chunk-KPZGTB2O.js";import{a as se}from"./chunk-WK2IQJPK.js";import{a as ne}from"./chunk-UQE4XFSA.js";import{a as pe}from"./chunk-3RSBGWGL.js";import{a as oe}from"./chunk-BFBIMTCJ.js";import{a as ie}from"./chunk-ZQ62NNKN.js";import{a as ee}from"./chunk-IZDPGOZR.js";import{b as re}from"./chunk-YRKP7PM7.js";import{a as te}from"./chunk-2OMXFE64.js";import{a as T,b as Y}from"./chunk-MHWMEZDA.js";import{b as Q}from"./chunk-OQUCBKOI.js";import{a as X}from"./chunk-CCIYWXX6.js";import{b as J}from"./chunk-JX6ZWDOS.js";import{f as Z}from"./chunk-36JC5BG2.js";import{b as K}from"./chunk-QDCCHMVZ.js";import{d as q,e as U}from"./chunk-J3GLP7Q5.js";import{f as M,h as A}from"./chunk-NDKOVQFG.js";import{a as j}from"./chunk-F74LZWCE.js";import{C as W,z as G}from"./chunk-ICUL7XRT.js";import{w as k}from"./chunk-7GAK2F3H.js";import{f as z,g as O}from"./chunk-SX72EVMY.js";import{readdirSync as Ye}from"fs";import{basename as Xe,join as Ce}from"path";function Qe(e,r,t={}){let i=new Set(e),o=new Set(r),n=[...o].filter(s=>!i.has(s)).sort(),a=t.allowExtra?[]:[...i].filter(s=>!o.has(s)).sort();return{missing:n,extra:a}}function Je(e,r){let t=Ze(e,r.file,r.keys);if(!t.ok)return{name:r.name,file:r.file,status:"unavailable",missing:[],extra:[],unavailableReason:t.reason};let i=nt(e.config.projectRoot,r.mustEqual),o=Qe(t.keys,i,{allowExtra:r.allowExtra??!1}),n=o.missing.length>0||o.extra.length>0?"violated":"ok";return{name:r.name,file:r.file,status:n,missing:o.missing,extra:o.extra}}function be(e,r){return r.map(t=>Je(e,t))}function Ze(e,r,t){return t.type==="markdown-list"?ot(e,r,t.marker):et(e,r,t)}function et(e,r,t){if(!k(e,r))return{ok:!1,reason:`file not found: ${r}`};let o=G(r);if(!o)return{ok:!1,reason:`unsupported file type for ${t.type} extraction: ${r}`};let n=W(e,r);if(!n)return{ok:!1,reason:`tree-sitter parser unavailable for ${o} (${r}) \u2014 contract skipped, not silently passed`,disclosedUnavailable:{language:o,reason:"parser-unavailable"}};let a=t.type==="object-literal-keys"?tt(n,t.identifier):it(n,t.identifier);return a===null?{ok:!1,reason:`no ${t.type==="object-literal-keys"?"object literal":"string array"} named "${t.identifier}" found in ${r}`}:{ok:!0,keys:a}}function Se(e){let r=e.childForFieldName("value");return r?r.type==="as_expression"||r.type==="satisfies_expression"?r.namedChild(0):r:null}function tt(e,r){for(let t of e.rootNode.descendantsOfType("variable_declarator")){if(t.childForFieldName("name")?.text!==r)continue;let o=Se(t);if(o?.type==="object")return rt(o)}return null}function rt(e){let r=new Set;for(let t of e.namedChildren)if(t.type==="pair"){let i=t.childForFieldName("key");i&&r.add(ye(i.text))}else t.type==="shorthand_property_identifier"&&r.add(t.text);return[...r].sort()}function it(e,r){for(let t of e.rootNode.descendantsOfType("variable_declarator")){if(t.childForFieldName("name")?.text!==r)continue;let o=Se(t);if(o?.type!=="array")continue;let n=new Set;for(let a of o.namedChildren)a.type==="string"&&n.add(ye(a.text));return[...n].sort()}return null}function ye(e){return e.length>=2&&(e[0]==="'"&&e.endsWith("'")||e[0]==='"'&&e.endsWith('"'))?e.slice(1,-1):e}function ot(e,r,t){let i=k(e,r);if(!i)return{ok:!1,reason:`file not found: ${r}`};let o=xe(i,t);return o===null?{ok:!1,reason:`no <!-- BEGIN GENERATED ${t} --> ... <!-- END GENERATED ${t} --> block in ${r}`}:{ok:!0,keys:we(o)}}function xe(e,r){let t=j(r),o=new RegExp(`<!--\\s*BEGIN GENERATED ${t}\\s*-->([\\s\\S]*?)<!--\\s*END GENERATED ${t}\\s*-->`).exec(e);return o?o[1]:null}function we(e){let r=new Set;for(let t of e.matchAll(/`([a-z][a-z0-9-]*)`/g))r.add(t[1]);for(let t of e.matchAll(/\[([a-z][a-z0-9-]*)\]\([^)]*\)/g))r.add(t[1]);return[...r].sort()}function nt(e,r){switch(r.type){case"top-level-dirs":return ve(Ce(e,r.path));case"file-glob":return[...new Set(K(e,r.pattern).map(t=>Xe(t)))].sort();case"registered-commands":return at(e);case"builtin-skills":return ve(Ce(e,"skills"))}}function ve(e){let r;try{r=Ye(e,{withFileTypes:!0})}catch{return[]}return r.filter(t=>t.isDirectory()&&!t.name.startsWith(".")).map(t=>t.name).sort()}function at(e){let r;try{r=z(e,"docs/COMMAND_REFERENCE.md",{maxBytes:8*1024*1024,inputKind:"generated command reference"})}catch(i){if(!O(i))throw i;return[]}let t=xe(r,"COMMAND REFERENCE");return t?we(t):[]}function g(e){return e.scoreCount??e.count}function B(e){let r=dt(e),{breakdown:t,pressure:i}=mt(e),o=Le(t,"risk"),n=Le(t,"hygiene"),a=st(e),s=[...e.warnings];e.complexity.coverage.semanticEvidence.excludedSymbolCount>0&&s.push(`Complexity scoring excluded ${e.complexity.coverage.semanticEvidence.excludedSymbolCount} symbol(s) with incomplete or unavailable compiler evidence.`);let l=e.evidenceCoverage.filter(d=>d.semanticEvidence.status!=="complete"&&d.semanticEvidence.status!=="disabled");return l.length>0&&s.push(`Compiler-resolved evidence was incomplete or unavailable in health phase(s): ${l.map(d=>d.phase).join(", ")}.`),{score:Math.min(o,n),riskScore:o,hygieneScore:n,scoreBreakdown:t,overview:{documents:e.statsResult.documents,symbols:e.statsResult.symbols,indexSizeBytes:e.statsResult.indexSizeBytes},findings:{deadSymbols:e.dead.count,deadLoc:e.dead.loc,isolatedSymbols:e.isolated.count,isolatedLoc:e.isolated.loc,cycles:e.realCycleCount,similarPairs:e.similarCount,duplicateBodyGroups:e.duplicateBodies.count,duplicateBodyLoc:e.duplicateBodies.loc,twinDriftGroups:e.twinDrift.count,twinDriftLoc:e.twinDrift.loc,reactComponentDuplicatePairs:e.reactComponentDuplicates.count,reactHookCandidatePairs:e.reactHookCandidates.count,reactHookCandidateScoreCount:g(e.reactHookCandidates),reactLargeComponentPressureFiles:e.reactLargeComponentPressure.count,vueComponentDuplicatePairs:e.vueComponentDuplicates.count,vueComposableCandidatePairs:e.vueComposableCandidates.count,vueComposableCandidateScoreCount:g(e.vueComposableCandidates),vueLargeViewPressureFiles:e.vueLargeViewPressure.count,extractionCandidates:e.extractCount,wrappers:e.wrappers.count,wrapperScoreCount:g(e.wrappers),passthroughs:e.passthroughs.count,staleTypes:e.stale.count,driftedFiles:e.drift.count,complexityHotspotCount:e.complexity.extremeCount,hiddenCouplingPairs:e.gitEvidence?.hiddenCoupling.pairCount??null,hiddenCouplingScoreCount:e.gitEvidence?.hiddenCoupling.scoreCount??null,coverageContractViolations:e.coverageContracts.count},axes:ct(e),validation:lt(e),suppressions:e.suppressions,actions:r,pressure:i,topComplexity:e.complexity.top,coverage:a,warnings:s.length>0?s:void 0}}function st(e){let r=e.complexity.coverage.semanticEvidence.status;return{status:e.evidenceCoverage.some(i=>i.semanticEvidence.status!=="complete"&&i.semanticEvidence.status!=="disabled")?"incomplete":r==="disabled"?"semantic-disabled":r==="complete"?"complete":"incomplete",complexity:e.complexity.coverage,phases:e.evidenceCoverage}}function ct(e){return{deletable:{loc:e.dead.loc+e.isolated.loc,symbols:e.dead.count+e.isolated.count},cycles:{count:e.realCycleCount},changeAmplification:e.gitEvidence?.amplification??null,hiddenCoupling:e.gitEvidence?.hiddenCoupling??null,churnWeightedComplexity:ut(e),evidenceQuality:{graphFindings:e.dead.count+e.isolated.count+e.realCycleCount,heuristicFindings:e.similarCount+e.duplicateBodies.count+e.twinDrift.count+e.reactComponentDuplicates.count+e.reactHookCandidates.count+e.reactLargeComponentPressure.count+e.vueComponentDuplicates.count+e.vueComposableCandidates.count+e.vueLargeViewPressure.count+e.extractCount+e.wrappers.count+e.passthroughs.count+e.stale.count+e.drift.count,userSuppressed:e.suppressions?.total??0}}}function ut(e){let r=e.gitEvidence?.fileStats;return r?e.complexity.top.map(t=>{let i=t.file?r[t.file]?.changes??0:0;return{...t,changes:i,weighted:h(t.score*Math.log2(1+i))}}).sort((t,i)=>i.weighted-t.weighted):null}function lt(e){let r=e.gitEvidence?.fileStats;if(!r)return null;let t={dead:e.dead.files??[],isolated:e.isolated.files??[],twinDrift:e.twinDrift.files??[],wrappers:e.wrappers.files??[],passthroughs:e.passthroughs.files??[],stale:e.stale.files??[],reactComponents:e.reactComponentDuplicates.files??[],reactHooks:e.reactHookCandidates.files??[],reactLargeComponents:e.reactLargeComponentPressure.files??[],vueComponents:e.vueComponentDuplicates.files??[],vueComposables:e.vueComposableCandidates.files??[],vueLargeViews:e.vueLargeViewPressure.files??[]},i=new Set(Object.values(t).flat()),o=0,n=0,a=0;for(let[b,f]of Object.entries(r))i.has(b)?o+=f.fixChanges:(n+=f.fixChanges,a+=1);let s=i.size>0?h(o/i.size):0,l=a>0?h(n/a):0,d={};for(let[b,f]of Object.entries(t)){let C=new Set(f);if(C.size===0)continue;let S=0;for(let D of C)S+=r[D]?.fixChanges??0;let x=h(S/C.size);d[b]={flaggedFiles:C.size,fixDensity:x,lift:l>0?h(x/l):null}}return{flaggedFiles:i.size,flaggedFixDensity:s,baselineFixDensity:l,ratio:i.size>0&&l>0?h(s/l):null,byCategory:d,validationBasis:{method:"subject-regex",commitsScanned:e.gitEvidence?.commitsScanned??0}}}function h(e){return Math.round(e*100)/100}function Ee(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/0+$/,"").replace(/\.$/,"")}function L(e,r="existing shared infrastructure discount"){let t=g(e);return Math.abs(t-e.count)<.01?"":` (${Ee(t)} score-weighted after ${r})`}function y(e,r){let t=g(e),i=`${e.count} ${r}`;return Math.abs(t-e.count)<.01?i:`${i} (${Ee(t)} score-weighted)`}function dt(e){let r=[];if(e.dead.count>0&&r.push({category:"Dead code",evidence:"graph-fact",description:`${e.dead.count} indexed symbols with no visible repository references \u2014 review runtime/framework roots and the capability disclosure, then verify any deletion with cleanup-plan --verify`,effort:"low",impact:"high",count:e.dead.count,locRecoverable:e.dead.loc}),e.isolated.count>0&&r.push({category:"Isolated symbols",evidence:"graph-fact",description:`${e.isolated.count} symbols completely disconnected from the codebase graph`,effort:"low",impact:"medium",count:e.isolated.count,locRecoverable:e.isolated.loc}),e.realCycleCount>0&&r.push({category:"Circular dependencies",evidence:"graph-fact",description:`${e.realCycleCount} indexed dependency cycle(s) \u2014 inspect ownership and runtime order before choosing whether or how to break them`,effort:"medium",impact:"high",count:e.realCycleCount,locRecoverable:0}),e.similarCount>0&&r.push({category:"Similar functions",evidence:"heuristic",description:`${e.similarCount} pairs share disclosed call or source-token evidence beyond imports \u2014 review domain identity before considering consolidation`,effort:"medium",impact:"medium",count:e.similarCount,locRecoverable:0}),e.duplicateBodies.count>0&&r.push({category:"Duplicate function bodies",evidence:"heuristic",description:`${e.duplicateBodies.count} exact small-body group(s) across files \u2014 consolidate only when the domain concept matches`,effort:"low",impact:"medium",count:e.duplicateBodies.count,locRecoverable:e.duplicateBodies.loc}),e.twinDrift.count>0&&r.push({category:"Drifted twin implementations",evidence:"heuristic",description:`${e.twinDrift.count} same-name (or near-name) function group(s) across files with diverged or identical bodies \u2014 determine whether they represent the same concept before acting`,effort:"medium",impact:"medium",count:e.twinDrift.count,locRecoverable:0}),e.reactComponentDuplicates.count>0&&r.push({category:"Duplicated React components",evidence:"heuristic",description:`${e.reactComponentDuplicates.count} React component pair(s) share JSX structure \u2014 review whether local product intent justifies reuse`,effort:"medium",impact:"medium",count:e.reactComponentDuplicates.count,locRecoverable:e.reactComponentDuplicates.loc}),e.reactHookCandidates.count>0&&r.push({category:"Duplicated React hook behavior",evidence:"heuristic",description:`${e.reactHookCandidates.count} React component pair(s) share state/effect/request behavior${L(e.reactHookCandidates)} \u2014 review whether a common hook would preserve ownership and lifecycle semantics`,effort:"medium",impact:"medium",count:e.reactHookCandidates.count,locRecoverable:e.reactHookCandidates.loc}),e.reactLargeComponentPressure.count>0&&r.push({category:"Large React components",evidence:"heuristic",description:`${e.reactLargeComponentPressure.count} React component(s) concentrate JSX/behavior pressure \u2014 split by reason to change`,effort:"medium",impact:"medium",count:e.reactLargeComponentPressure.count,locRecoverable:0}),e.vueComponentDuplicates.count>0&&r.push({category:"Duplicated Vue components",evidence:"heuristic",description:`${e.vueComponentDuplicates.count} Vue component pair(s) share template structure \u2014 review whether local product intent justifies reuse`,effort:"medium",impact:"medium",count:e.vueComponentDuplicates.count,locRecoverable:e.vueComponentDuplicates.loc}),e.vueComposableCandidates.count>0&&r.push({category:"Duplicated Vue behavior",evidence:"heuristic",description:`${e.vueComposableCandidates.count} Vue component pair(s) share state/effect/request behavior${L(e.vueComposableCandidates)} \u2014 review whether a common composable would preserve ownership and lifecycle semantics`,effort:"medium",impact:"medium",count:e.vueComposableCandidates.count,locRecoverable:e.vueComposableCandidates.loc}),e.vueLargeViewPressure.count>0&&r.push({category:"Large Vue views",evidence:"heuristic",description:`${e.vueLargeViewPressure.count} Vue file(s) concentrate template/script/style pressure \u2014 split by reason to change`,effort:"medium",impact:"medium",count:e.vueLargeViewPressure.count,locRecoverable:0}),e.extractCount>0&&r.push({category:"Extraction candidates",evidence:"heuristic",description:`${e.extractCount} large functions with isolated callee clusters \u2014 review same-file or feature-local extraction seams`,effort:"medium",impact:"medium",count:e.extractCount,locRecoverable:0}),e.wrappers.count>0&&r.push({category:"Wrapper functions",evidence:"heuristic",description:`${e.wrappers.count} single-consumer symbols${L(e.wrappers,"boundary-evidence discount")} \u2014 inspect whether each is indirection or an intentional API, framework, or ownership boundary`,effort:"low",impact:"low",count:e.wrappers.count,locRecoverable:e.wrappers.loc}),e.passthroughs.count>0&&r.push({category:"Passthrough functions",evidence:"heuristic",description:`${e.passthroughs.count} functions that literally forward to one callee \u2014 inspect whether each is unnecessary indirection or an intentional boundary`,effort:"low",impact:"low",count:e.passthroughs.count,locRecoverable:e.passthroughs.loc}),e.stale.count>0){let o=[];e.stale.unused>0&&o.push(`${e.stale.unused} unused`),e.stale.singleUse>0&&o.push(`${e.stale.singleUse} single-consumer (not in types file)`),r.push({category:"Stale abstractions",evidence:"heuristic",description:`${o.join(", ")} \u2014 review public, runtime-registration, and ownership evidence before removing, moving, or inlining`,effort:"low",impact:"medium",count:e.stale.count,locRecoverable:e.stale.loc})}if(e.drift.count>0){let o=[];e.drift.unusedImports>0&&o.push(`${e.drift.unusedImports} unused imports`),e.drift.architectureViolations>0&&o.push(`${e.drift.architectureViolations} declared architecture violations`),r.push({category:"Structural drift",evidence:"heuristic",description:`${o.join(", ")} \u2014 repair direct dependency-rule breaks; inspect boundary signals with \`drift --architecture\``,effort:e.drift.architectureViolations>0?"medium":"low",impact:e.drift.architectureViolations>0?"medium":"low",count:e.drift.count,locRecoverable:0})}if(e.coverageContracts.count>0&&r.push({category:"Coverage contract drift",evidence:"graph-fact",description:`${e.coverageContracts.count} configured coverage contract(s) drifted from their ground-truth source (enumeration rot) \u2014 run \`codebaseiq health --json\` for the missing/extra keys`,effort:"low",impact:"medium",count:e.coverageContracts.count,locRecoverable:0}),e.gitEvidence&&e.gitEvidence.hiddenCoupling.pairCount>0){let o=e.gitEvidence.hiddenCoupling.top[0];r.push({category:"Hidden coupling",evidence:"change-graph",description:`${e.gitEvidence.hiddenCoupling.pairCount} file pair(s) co-change without a structural link`+L({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:e.gitEvidence.hiddenCoupling.scoreCount},"broad/stale-history discount")+(o?` (e.g. ${o.fileA} \u2194 ${o.fileB})`:"")+" \u2014 inspect whether a shared concept, generated artifact, or coordinated contract explains the history",effort:"medium",impact:"high",count:e.gitEvidence.hiddenCoupling.pairCount,locRecoverable:0})}let t={high:3,medium:2,low:1},i={low:3,medium:2,high:1};return r.sort((o,n)=>{let a=t[o.impact]*i[o.effort];return t[n.impact]*i[n.effort]-a}),r}var He={"dead-code":"risk",isolated:"risk",cycles:"risk",complexity:"risk","hidden-coupling":"risk","cycles-pressure":"risk","complexity-pressure":"risk","hidden-coupling-pressure":"risk",similar:"hygiene","duplicate-bodies":"hygiene","twin-drift":"hygiene","react-component-duplicates":"hygiene","react-hook-candidates":"hygiene","react-large-component-pressure":"hygiene","vue-component-duplicates":"hygiene","vue-composable-candidates":"hygiene","vue-large-view-pressure":"hygiene",extract:"hygiene",wrappers:"hygiene",passthroughs:"hygiene","stale-abstractions":"hygiene",drift:"hygiene","similar-pressure":"hygiene","duplicate-bodies-pressure":"hygiene","twin-drift-pressure":"hygiene","react-component-duplicates-pressure":"hygiene","react-hook-candidates-pressure":"hygiene","react-large-component-pressure-pressure":"hygiene","vue-component-duplicates-pressure":"hygiene","vue-composable-candidates-pressure":"hygiene","vue-large-view-pressure-pressure":"hygiene","extract-pressure":"hygiene","wrappers-pressure":"hygiene","passthroughs-pressure":"hygiene","stale-abstractions-pressure":"hygiene","drift-pressure":"hygiene"};function Le(e,r){let t=e.filter(i=>i.kind===r).reduce((i,o)=>i+o.points,0);return Math.max(0,Math.min(100,100-t))}function mt(e){let r=Math.max(e.statsResult.documents,1),t=Math.max(e.statsResult.symbols,1),i=[],o=[],n=(m,w,v)=>{w>0&&i.push({axis:m,points:w,detail:v,kind:He[m]??"hygiene"})},a=(m,w,v,Ge,We,qe,Ue)=>{let H=Math.max(Ge,1);if(v<=H)return;let P=v/H,R=Math.min(We,Math.ceil(Math.log2(P)*qe));if(R<=0)return;let Ke=He[m]??"hygiene";o.push({axis:m,category:w,kind:Ke,count:v,threshold:h(H),ratio:h(P),extraPenalty:R}),n(m,R,`${v} ${Ue} exceed pressure threshold ${h(H)} (${h(P)}x)`)},s=e.dead.count/t;n("dead-code",Math.min(20,Math.round(s*200)),`${e.dead.count} dead symbols (${e.dead.loc} LOC deletable)`);let l=e.isolated.count/t;n("isolated",Math.min(10,Math.round(l*200)),`${e.isolated.count} isolated symbols (${e.isolated.loc} LOC deletable)`),n("cycles",Math.min(15,e.realCycleCount*5),`${e.realCycleCount} real dependency cycle(s)`);let d=e.similarCount/t*1e3;n("similar",Math.min(10,Math.round(d)),`${e.similarCount} similar function pair(s)`);let b=e.duplicateBodies.count/t*1e3;n("duplicate-bodies",Math.min(10,Math.round(b*2)),`${e.duplicateBodies.count} exact duplicate small-body group(s) (${e.duplicateBodies.loc} duplicate LOC)`);let f=e.twinDrift.count/t*1e3;n("twin-drift",Math.min(10,Math.round(f*2)),`${e.twinDrift.count} drifted twin implementation group(s) (same or near-same name, diverged or identical bodies)`);let C=e.reactComponentDuplicates.count/r*1e3;n("react-component-duplicates",Math.min(10,Math.round(C)),`${e.reactComponentDuplicates.count} duplicated React component pair(s)`);let S=g(e.reactHookCandidates),x=S/r*1e3;n("react-hook-candidates",Math.min(10,Math.round(x)),y(e.reactHookCandidates,"duplicated React behavior pair(s)"));let D=e.reactLargeComponentPressure.count/r*1e3;n("react-large-component-pressure",Math.min(5,Math.round(D/2)),`${e.reactLargeComponentPressure.count} large React component pressure file(s)`);let Ie=e.vueComponentDuplicates.count/r*1e3;n("vue-component-duplicates",Math.min(10,Math.round(Ie)),`${e.vueComponentDuplicates.count} duplicated Vue component pair(s)`);let _=g(e.vueComposableCandidates),ze=_/r*1e3;n("vue-composable-candidates",Math.min(10,Math.round(ze)),y(e.vueComposableCandidates,"duplicated Vue behavior pair(s)"));let Oe=e.vueLargeViewPressure.count/r*1e3;n("vue-large-view-pressure",Math.min(5,Math.round(Oe/2)),`${e.vueLargeViewPressure.count} large Vue view pressure file(s)`);let F=g(e.wrappers);n("wrappers",Math.min(3,F),y(e.wrappers,"wrapper candidate(s)"));let I=g(e.passthroughs);n("passthroughs",Math.min(3,I),y(e.passthroughs,"passthrough candidate(s)")),n("stale-abstractions",Math.min(8,e.stale.unused),`${e.stale.unused} unused stale abstraction(s); ${e.stale.singleUse} single-consumer signal(s)`);let je=e.drift.direct/r;if(n("drift",Math.min(5,Math.round(je*50)),`${e.drift.direct} direct drift finding(s); ${e.drift.signal} signal drift finding(s)`),n("complexity",Math.min(5,e.complexity.extremeCount*2),`${e.complexity.extremeCount} extreme complexity hotspot(s)`),e.gitEvidence){let m=e.gitEvidence.hiddenCoupling.scoreCount;n("hidden-coupling",Math.min(5,Math.ceil(m/10)),y({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:m},"co-changing pair(s) without a structural link"))}if(a("cycles-pressure","Circular dependencies",e.realCycleCount,3,10,3,"cycle(s)"),a("complexity-pressure","Extreme complexity",e.complexity.extremeCount,3,5,2,"extreme complexity hotspot(s)"),e.gitEvidence){let m=e.gitEvidence.hiddenCoupling.scoreCount;a("hidden-coupling-pressure","Hidden coupling",m,50,10,4,"score-weighted co-changing pair(s)")}return a("similar-pressure","Similar functions",e.similarCount,Math.max(50,t*.01),8,4,"similar function pair(s)"),a("duplicate-bodies-pressure","Duplicate function bodies",e.duplicateBodies.count,Math.max(20,t*.005),8,4,"exact duplicate small-body group(s)"),a("twin-drift-pressure","Drifted twin implementations",e.twinDrift.count,Math.max(20,t*.005),8,4,"drifted twin implementation group(s)"),a("react-component-duplicates-pressure","Duplicated React components",e.reactComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated React component pair(s)"),a("react-hook-candidates-pressure","Duplicated React hook behavior",S,Math.max(10,r*.01),8,4,"duplicated React behavior pair(s)"),a("react-large-component-pressure-pressure","Large React components",e.reactLargeComponentPressure.count,Math.max(10,r*.01),4,2,"large React component pressure file(s)"),a("vue-component-duplicates-pressure","Duplicated Vue components",e.vueComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated Vue component pair(s)"),a("vue-composable-candidates-pressure","Duplicated Vue behavior",_,Math.max(10,r*.01),8,4,"duplicated Vue behavior pair(s)"),a("vue-large-view-pressure-pressure","Large Vue views",e.vueLargeViewPressure.count,Math.max(10,r*.01),4,2,"large Vue view pressure file(s)"),a("extract-pressure","Extraction candidates",e.extractCount,Math.max(50,t*.01),4,2,"extraction candidate(s)"),a("wrappers-pressure","Wrapper functions",F,50,4,2,"wrapper candidate(s)"),a("passthroughs-pressure","Passthrough functions",I,50,4,2,"passthrough candidate(s)"),a("stale-abstractions-pressure","Single-consumer stale abstraction signals",e.stale.singleUse,Math.max(50,t*.02),4,2,"single-consumer stale abstraction signal(s)"),a("drift-pressure","Structural drift signals",e.drift.signal,Math.max(10,r*.1),4,2,"signal drift finding(s)"),{breakdown:i,pressure:o}}var p={dead:{minLoc:3,skipBarrels:!0,deadCodeOnly:!0},isolated:{minLoc:3},similar:{minSimilarity:.6,limit:50,minCallees:4},duplicateBodies:{maxLoc:15,limit:50},extract:{minLoc:15,minCallees:5,limit:50},wrappers:{maxLoc:15,limit:50},passthroughs:{maxLoc:15,limit:50},stale:{minLoc:3,limit:50},drift:{},twinDrift:{minSimilarity:.3}};import{getHeapStatistics as pt}from"v8";var ht=64*1024*1024;function $(){let e=globalThis.gc;if(!e)return;let r=pt();r.heap_size_limit-r.used_heap_size<ht||e()}var gt=50,ft=25e3,Ct=2500,De=2500,Pe=50,vt=10,bt=["overview","dead","isolated","cycles","similar","duplicate-bodies","twin-drift","react-component-duplicates","react-hook-candidates","react-large-component-pressure","vue-component-duplicates","vue-composable-candidates","vue-large-view-pressure","extract-candidates","wrapper-candidates","passthrough-candidates","stale-abstractions","drift","complexity-hotspots","git-evidence","suppressions","coverage-contracts"],St={overview:(e,r,t,i)=>({phase:"overview",statsResult:i,warnings:t.warnings}),dead:(e,r,t)=>({phase:"dead",dead:wt(e,r,t)}),isolated:(e,r,t)=>({phase:"isolated",isolated:Ht(e,r,t)}),cycles:(e,r,t)=>({phase:"cycles",realCycleCount:Lt(e,r,t)}),similar:(e,r,t)=>({phase:"similar",similarCount:Et(e,r,t)}),"duplicate-bodies":(e,r,t)=>({phase:"duplicate-bodies",duplicateBodies:Pt(e,r,t)}),"twin-drift":(e,r,t)=>({phase:"twin-drift",twinDrift:Rt(e,r,t)}),"react-component-duplicates":(e,r,t)=>({phase:"react-component-duplicates",reactComponentDuplicates:kt(e,r,t)}),"react-hook-candidates":(e,r,t)=>({phase:"react-hook-candidates",reactHookCandidates:Mt(e,r,t)}),"react-large-component-pressure":(e,r,t)=>({phase:"react-large-component-pressure",reactLargeComponentPressure:At(e,r,t)}),"vue-component-duplicates":(e,r,t)=>({phase:"vue-component-duplicates",vueComponentDuplicates:Tt(e,r,t)}),"vue-composable-candidates":(e,r,t)=>({phase:"vue-composable-candidates",vueComposableCandidates:Bt(e,r,t)}),"vue-large-view-pressure":(e,r,t)=>({phase:"vue-large-view-pressure",vueLargeViewPressure:$t(e,r,t)}),"extract-candidates":(e,r,t)=>({phase:"extract-candidates",extractCount:Dt(e,r,t)}),"wrapper-candidates":(e,r,t)=>({phase:"wrapper-candidates",wrappers:Vt(e,r,t)}),"passthrough-candidates":(e,r,t)=>({phase:"passthrough-candidates",passthroughs:Nt(e,r,t)}),"stale-abstractions":(e,r,t)=>({phase:"stale-abstractions",stale:_t(e,r,t)}),drift:(e,r,t)=>({phase:"drift",drift:Ot(e,r,t)}),"complexity-hotspots":(e,r,t)=>({phase:"complexity-hotspots",complexity:jt(e,r,t)}),"git-evidence":(e,r,t)=>({phase:"git-evidence",gitEvidence:Ft(e,t)}),suppressions:(e,r,t)=>({phase:"suppressions",suppressions:It(e,t)}),"coverage-contracts":(e,r,t)=>({phase:"coverage-contracts",coverageContracts:zt(e,t)})};function Or(e,r={}){return Me(e,r.full!==!1,(t,i)=>{let o=xt(e,r.scope,t,i);return B(o)})}function jr(e,r,t={}){return yt(e,[r],t)[0]}function yt(e,r,t={}){return Me(e,t.full!==!1,(i,o)=>{let n={...o,releaseCachesBetweenPhases:!1};return r.map(a=>Te(e,a,t.scope,n,i))})}function Me(e,r,t){let i=ge(e),o=Gt(i,r);try{return t(i,o)}finally{T(e,{semanticProvider:!0}),$()}}function Gr(e){return B(Ae(e))}function Ae(e){let r=u(e,"overview");return{statsResult:r.statsResult,warnings:r.warnings,evidenceCoverage:e.map(i=>({phase:i.phase,semanticEvidence:i.evidenceCoverage})),dead:u(e,"dead").dead,isolated:u(e,"isolated").isolated,realCycleCount:u(e,"cycles").realCycleCount,similarCount:u(e,"similar").similarCount,duplicateBodies:u(e,"duplicate-bodies").duplicateBodies,twinDrift:u(e,"twin-drift").twinDrift,reactComponentDuplicates:u(e,"react-component-duplicates").reactComponentDuplicates,reactHookCandidates:u(e,"react-hook-candidates").reactHookCandidates,reactLargeComponentPressure:u(e,"react-large-component-pressure").reactLargeComponentPressure,vueComponentDuplicates:u(e,"vue-component-duplicates").vueComponentDuplicates,vueComposableCandidates:u(e,"vue-composable-candidates").vueComposableCandidates,vueLargeViewPressure:u(e,"vue-large-view-pressure").vueLargeViewPressure,extractCount:u(e,"extract-candidates").extractCount,wrappers:u(e,"wrapper-candidates").wrappers,passthroughs:u(e,"passthrough-candidates").passthroughs,stale:u(e,"stale-abstractions").stale,drift:u(e,"drift").drift,complexity:u(e,"complexity-hotspots").complexity,gitEvidence:Re(e,"git-evidence")?.gitEvidence??null,suppressions:Re(e,"suppressions")?.suppressions??null,coverageContracts:u(e,"coverage-contracts").coverageContracts}}function Re(e,r){return e.find(t=>t.phase===r)}function u(e,r){let t=e.find(i=>i.phase===r);if(!t)throw new Error(`Missing health phase result: ${r}`);return t}function xt(e,r,t,i){return Ae(bt.map(o=>Te(e,o,r,i,t)))}function Te(e,r,t,i,o){q(e);let n=St[r](e,t,i,o),a=U(e),s=a.incompleteSymbolIds.size,l=a.unavailableSymbolIds.size,d=i.semantic?s>0&&l>0?"incomplete-and-unavailable":s>0?"incomplete":l>0?"unavailable":"complete":"disabled";return{...n,evidenceCoverage:{enabled:i.semantic,status:d,incompleteSymbolCount:s,unavailableSymbolCount:l}}}function wt(e,r,t){return c(e,t,"dead",()=>{let i=Y(e,{scope:r,...p.dead,scanLimit:t.candidateScanLimit,semantic:t.semantic});return E(Ut(e,i.symbols))})}function Ht(e,r,t){return c(e,t,"isolated",()=>{let i=ne(e,{scope:r,...p.isolated,scanLimit:t.candidateScanLimit,semantic:t.semantic});return E(Kt(e,i))})}function Lt(e,r,t){return c(e,t,"cycles",()=>ee(e,{scope:r}).filter(o=>o.kind==="real").length)}function Et(e,r,t){let i=c(e,t,"similar",()=>Z(e,{scope:r,...p.similar,scanLimit:t.candidateScanLimit,semantic:t.semantic}));return Math.min(i,t.candidateResultLimit)}function Dt(e,r,t){return c(e,t,"extract-candidates",()=>oe(e,{scope:r,...p.extract,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic}).length)}function Pt(e,r,t){return c(e,t,"duplicate-bodies",()=>{let i=te(e,{scope:r,...p.duplicateBodies,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}),o=new Set,n=0;for(let a of i)for(let s of a.functions.slice(1))o.add(s.file),n+=s.loc;return{count:i.length,loc:n,files:[...o]}})}function Rt(e,r,t){return c(e,t,"twin-drift",()=>{let i=re(e,{scope:r,...p.twinDrift,scanLimit:t.candidateScanLimit}).filter(a=>a.relationship==="divergent"||a.relationship==="identical"),o=new Set,n=0;for(let a of i)for(let s of a.members)o.add(s.file),n+=s.loc;return{count:i.length,loc:n,files:[...o].sort()}})}function kt(e,r,t){return c(e,t,"react-component-duplicates",()=>{let i=ae(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return V(i)})}function Mt(e,r,t){return c(e,t,"react-hook-candidates",()=>{let i=se(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return $e(i,Xt)})}function At(e,r,t){return c(e,t,"react-large-component-pressure",()=>{let i=ce(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return Yt(i)})}function Tt(e,r,t){return c(e,t,"vue-component-duplicates",()=>{let i=ue(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return V(i)})}function Bt(e,r,t){return c(e,t,"vue-composable-candidates",()=>{let i=le(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return $e(i,Qt)})}function $t(e,r,t){return c(e,t,"vue-large-view-pressure",()=>{let i=de(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return E(i)})}function Vt(e,r,t){return c(e,t,"wrapper-candidates",()=>{let i=me(e,{scope:r,...p.wrappers,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return Be(i,Jt)})}function Nt(e,r,t){return c(e,t,"passthrough-candidates",()=>{let i=pe(e,{scope:r,...p.passthroughs,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return Be(i,Zt)})}function _t(e,r,t){return c(e,t,"stale-abstractions",()=>{let i=he(e,{scope:r,...p.stale,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic}),o=i.filter(n=>n.consumers===0).length;return{count:i.length,loc:i.reduce((n,a)=>n+a.loc,0),files:[...new Set(i.map(n=>n.file))],unused:o,singleUse:i.length-o}})}function Ft(e,r){return c(e,r,"git-evidence",()=>{let t=X(e,{historyMode:r.gitHistoryMode}),i=t.fileChurn();if(!i)return null;let o=t.commitHistory(),n=Q(e,void 0,{limit:r.candidateResultLimit,historyMode:r.gitHistoryMode}),a={};for(let[s,l]of i)a[s]={changes:l.changes,fixChanges:l.fixChanges};return{amplification:t.changeAmplification(),hiddenCoupling:{pairCount:n.findings.length,scoreCount:N(n.findings.reduce((s,l)=>s+ke(l),0)),top:n.findings.slice(0,5).map(s=>({fileA:s.fileA,fileB:s.fileB,together:s.together,confidence:s.confidence,focusedTogether:s.focusedTogether,broadTogether:s.broadTogether,broadCommitRatio:s.broadCommitRatio,lastTogetherAt:s.lastTogetherAt,recentTogether:s.recentTogether,commitScope:s.commitScope,recency:s.recency,scoreWeight:ke(s),subjectContext:s.subjectContext}))},fileStats:a,commitsScanned:o?.commits.length??0}})}function It(e,r){return c(e,r,"suppressions",()=>{let t=fe(e);return{total:t.total,byCategory:{...t.byCategory}}})}function zt(e,r){return c(e,r,"coverage-contracts",()=>{let t=e.config.coverageContracts??[],o=be(e,t).filter(n=>n.status!=="ok");return{count:o.length,loc:0,files:[...new Set(o.map(n=>n.file))].sort()}})}function Ot(e,r,t){return c(e,t,"drift",()=>{let i=ie(e,{scope:r,...p.drift,includePatternDeviations:!1,limit:Number.POSITIVE_INFINITY,semantic:t.semantic}),o=i.results.filter(s=>s.kind!=="pattern-deviation"),n=o.filter(s=>s.actionTier==="direct").length,a=o.length-n;return{count:o.length,unusedImports:i.unusedImports,architectureViolations:i.architectureViolations,layerViolations:i.layerViolations,direct:n,signal:a}})}function jt(e,r,t){return c(e,t,"complexity-hotspots",()=>{let i=J(e,{scope:r,minLoc:10,limit:t.complexityResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return{top:i.rows.slice(0,5).map(o=>({symbol:o.shortName,score:o.score,file:o.file})),extremeCount:i.rows.filter(o=>o.score>gt).length,coverage:i.coverage}})}function Gt(e,r){let t=e.symbols>=ft||e.documents>=Ct,i=r?Number.POSITIVE_INFINITY:Pe,o=r?Number.POSITIVE_INFINITY:vt;return!t||r?{candidateScanLimit:void 0,candidateResultLimit:i,complexityResultLimit:o,semantic:!0,gitHistoryMode:r?"full":"bounded",releaseCachesBetweenPhases:!0,warnings:r&&t?["Large index detected; running health without candidate scan or result caps because full mode is enabled."]:[]}:{candidateScanLimit:De,candidateResultLimit:i,complexityResultLimit:o,semantic:!1,gitHistoryMode:"bounded",releaseCachesBetweenPhases:!0,warnings:[`Large index detected; candidate-style health checks scanned their highest-priority ${De} symbols and reported their top ${Pe} findings. Enable full mode for unbounded candidate counts.`]}}function Wt(e,r){r.releaseCachesBetweenPhases&&(T(e),$())}function c(e,r,t,i){qt(t);try{return i()}finally{Wt(e,r)}}function qt(e){process.env.CODEBASEIQ_HEALTH_TRACE==="1"&&console.error(`[health] ${e}`)}function Ut(e,r){return r.filter(t=>!M(e,t.relativePath)&&!A(e,t.symbol,t.relativePath)&&t.kind==="dead-code")}function Kt(e,r){return r.filter(t=>!M(e,t.relativePath)&&!A(e,t.symbol,t.relativePath))}function E(e){let r=new Set;for(let t of e){let i=t.relativePath??t.file;i&&r.add(i)}return{count:e.length,loc:e.reduce((t,i)=>t+i.loc,0),files:[...r]}}function Be(e,r){return{...E(e),scoreCount:N(e.reduce((i,o)=>i+r(o),0))}}function Yt(e){let r=new Map;for(let t of e)r.set(t.file,Math.max(r.get(t.file)??0,t.loc));return{count:r.size,loc:[...r.values()].reduce((t,i)=>t+i,0),files:[...r.keys()]}}function V(e){let r=new Map;for(let t of e)r.set(t.fileA,Math.max(r.get(t.fileA)??0,t.locA)),r.set(t.fileB,Math.max(r.get(t.fileB)??0,t.locB));return{count:e.length,loc:[...r.values()].reduce((t,i)=>t+i,0),files:[...r.keys()]}}function $e(e,r){return{...V(e),scoreCount:N(e.reduce((i,o)=>i+r(o),0))}}function Xt(e){let r=e.sharedHooks.length>0,t=Ve({namedState:e.sharedState,requests:e.sharedRequests,lifecycle:e.sharedEffects,functions:e.sharedHandlers});return r&&t<=2?0:r?.5:Ne(e.sharedState,e.sharedHandlers,e.sharedHandlerVerbs)?.25:t>=2?1:.5}function Qt(e){let r=e.sharedComposables.length+e.sharedStores.length>0,t=Ve({namedState:e.sharedBindings,requests:e.sharedRequests,lifecycle:e.sharedLifecycle,functions:e.sharedFunctions});return r&&t<=2?0:r?.5:Ne(e.sharedBindings,e.sharedFunctions,e.sharedFunctionVerbs)?.25:t>=2?1:.5}function Ve(e){return e.requests.length*2+e.lifecycle.length+e.namedState.filter(r=>!Fe.has(_e(r))).length+Math.min(e.functions.length,3)}function Ne(e,r,t){let i=[...e,...r,...t].map(_e);return i.length>0&&i.every(o=>Fe.has(o))}function _e(e){return e.replace(/^handle/,"").replace(/^is/,"").replace(/^has/,"").toLowerCase()}function Jt(e){return e.actionTier==="signal"?.25:1}function Zt(e){return e.actionTier==="signal"?.25:1}function ke(e){return e.commitScope==="broad-sweep"?e.recency==="recent"?.25:0:e.commitScope==="mixed"?e.recency==="recent"?.5:.25:e.recency==="recent"?1:.5}function N(e){return Math.round(e*100)/100}var Fe=new Set(["add","apply","cancel","change","clear","close","create","delete","draft","edit","error","filter","form","load","loading","name","open","refresh","remove","reset","save","saving","search","select","selected","submit","toggle","update","value"]);export{p as a,bt as b,Or as c,jr as d,yt as e,Gr as f};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as de}from"./chunk-QEWN7BLP.js";import{a as me}from"./chunk-LKJZNGMA.js";import{a as he}from"./chunk-XVJ2E7W7.js";import{a as ge}from"./chunk-6YTSKJJ3.js";import{a as fe}from"./chunk-QPQWR6CW.js";import{a as ce}from"./chunk-D3KE26FS.js";import{a as le}from"./chunk-YRAGNEBZ.js";import{a as ue}from"./chunk-KOVUXHIZ.js";import{a as ae}from"./chunk-OAJYNPRU.js";import{a as se}from"./chunk-KAXBWTSX.js";import{a as ne}from"./chunk-HSJLK5MC.js";import{a as pe}from"./chunk-7WG57A5X.js";import{a as oe}from"./chunk-ITA3N7G6.js";import{a as ie}from"./chunk-RWDIONS7.js";import{a as ee}from"./chunk-CZVSQQDU.js";import{b as re}from"./chunk-DUM7GR6B.js";import{a as te}from"./chunk-R7PXHYMY.js";import{a as T,b as Y}from"./chunk-6P5QMOM7.js";import{b as Q}from"./chunk-QFJ46F6F.js";import{a as X}from"./chunk-G2UU6PQP.js";import{b as J}from"./chunk-UUT5P3V7.js";import{f as Z}from"./chunk-66Q5VLH6.js";import{b as K}from"./chunk-QDCCHMVZ.js";import{d as q,e as U}from"./chunk-R2F2CTBA.js";import{f as M,h as A}from"./chunk-GLXEWYQY.js";import{a as j}from"./chunk-RGBZDOUO.js";import{C as W,z as G}from"./chunk-NRNVMB2R.js";import{w as k}from"./chunk-23AD24QZ.js";import{f as z,g as O}from"./chunk-YMAGXBLT.js";import{readdirSync as Ye}from"fs";import{basename as Xe,join as Ce}from"path";function Qe(e,r,t={}){let i=new Set(e),o=new Set(r),n=[...o].filter(s=>!i.has(s)).sort(),a=t.allowExtra?[]:[...i].filter(s=>!o.has(s)).sort();return{missing:n,extra:a}}function Je(e,r){let t=Ze(e,r.file,r.keys);if(!t.ok)return{name:r.name,file:r.file,status:"unavailable",missing:[],extra:[],unavailableReason:t.reason};let i=nt(e.config.projectRoot,r.mustEqual),o=Qe(t.keys,i,{allowExtra:r.allowExtra??!1}),n=o.missing.length>0||o.extra.length>0?"violated":"ok";return{name:r.name,file:r.file,status:n,missing:o.missing,extra:o.extra}}function be(e,r){return r.map(t=>Je(e,t))}function Ze(e,r,t){return t.type==="markdown-list"?ot(e,r,t.marker):et(e,r,t)}function et(e,r,t){if(!k(e,r))return{ok:!1,reason:`file not found: ${r}`};let o=G(r);if(!o)return{ok:!1,reason:`unsupported file type for ${t.type} extraction: ${r}`};let n=W(e,r);if(!n)return{ok:!1,reason:`tree-sitter parser unavailable for ${o} (${r}) \u2014 contract skipped, not silently passed`,disclosedUnavailable:{language:o,reason:"parser-unavailable"}};let a=t.type==="object-literal-keys"?tt(n,t.identifier):it(n,t.identifier);return a===null?{ok:!1,reason:`no ${t.type==="object-literal-keys"?"object literal":"string array"} named "${t.identifier}" found in ${r}`}:{ok:!0,keys:a}}function Se(e){let r=e.childForFieldName("value");return r?r.type==="as_expression"||r.type==="satisfies_expression"?r.namedChild(0):r:null}function tt(e,r){for(let t of e.rootNode.descendantsOfType("variable_declarator")){if(t.childForFieldName("name")?.text!==r)continue;let o=Se(t);if(o?.type==="object")return rt(o)}return null}function rt(e){let r=new Set;for(let t of e.namedChildren)if(t.type==="pair"){let i=t.childForFieldName("key");i&&r.add(ye(i.text))}else t.type==="shorthand_property_identifier"&&r.add(t.text);return[...r].sort()}function it(e,r){for(let t of e.rootNode.descendantsOfType("variable_declarator")){if(t.childForFieldName("name")?.text!==r)continue;let o=Se(t);if(o?.type!=="array")continue;let n=new Set;for(let a of o.namedChildren)a.type==="string"&&n.add(ye(a.text));return[...n].sort()}return null}function ye(e){return e.length>=2&&(e[0]==="'"&&e.endsWith("'")||e[0]==='"'&&e.endsWith('"'))?e.slice(1,-1):e}function ot(e,r,t){let i=k(e,r);if(!i)return{ok:!1,reason:`file not found: ${r}`};let o=xe(i,t);return o===null?{ok:!1,reason:`no <!-- BEGIN GENERATED ${t} --> ... <!-- END GENERATED ${t} --> block in ${r}`}:{ok:!0,keys:we(o)}}function xe(e,r){let t=j(r),o=new RegExp(`<!--\\s*BEGIN GENERATED ${t}\\s*-->([\\s\\S]*?)<!--\\s*END GENERATED ${t}\\s*-->`).exec(e);return o?o[1]:null}function we(e){let r=new Set;for(let t of e.matchAll(/`([a-z][a-z0-9-]*)`/g))r.add(t[1]);for(let t of e.matchAll(/\[([a-z][a-z0-9-]*)\]\([^)]*\)/g))r.add(t[1]);return[...r].sort()}function nt(e,r){switch(r.type){case"top-level-dirs":return ve(Ce(e,r.path));case"file-glob":return[...new Set(K(e,r.pattern).map(t=>Xe(t)))].sort();case"registered-commands":return at(e);case"builtin-skills":return ve(Ce(e,"skills"))}}function ve(e){let r;try{r=Ye(e,{withFileTypes:!0})}catch{return[]}return r.filter(t=>t.isDirectory()&&!t.name.startsWith(".")).map(t=>t.name).sort()}function at(e){let r;try{r=z(e,"docs/COMMAND_REFERENCE.md",{maxBytes:8*1024*1024,inputKind:"generated command reference"})}catch(i){if(!O(i))throw i;return[]}let t=xe(r,"COMMAND REFERENCE");return t?we(t):[]}function g(e){return e.scoreCount??e.count}function B(e){let r=dt(e),{breakdown:t,pressure:i}=mt(e),o=Le(t,"risk"),n=Le(t,"hygiene"),a=st(e),s=[...e.warnings];e.complexity.coverage.semanticEvidence.excludedSymbolCount>0&&s.push(`Complexity scoring excluded ${e.complexity.coverage.semanticEvidence.excludedSymbolCount} symbol(s) with incomplete or unavailable compiler evidence.`);let l=e.evidenceCoverage.filter(d=>d.semanticEvidence.status!=="complete"&&d.semanticEvidence.status!=="disabled");return l.length>0&&s.push(`Compiler-resolved evidence was incomplete or unavailable in health phase(s): ${l.map(d=>d.phase).join(", ")}.`),{score:Math.min(o,n),riskScore:o,hygieneScore:n,scoreBreakdown:t,overview:{documents:e.statsResult.documents,symbols:e.statsResult.symbols,indexSizeBytes:e.statsResult.indexSizeBytes},findings:{deadSymbols:e.dead.count,deadLoc:e.dead.loc,isolatedSymbols:e.isolated.count,isolatedLoc:e.isolated.loc,cycles:e.realCycleCount,similarPairs:e.similarCount,duplicateBodyGroups:e.duplicateBodies.count,duplicateBodyLoc:e.duplicateBodies.loc,twinDriftGroups:e.twinDrift.count,twinDriftLoc:e.twinDrift.loc,reactComponentDuplicatePairs:e.reactComponentDuplicates.count,reactHookCandidatePairs:e.reactHookCandidates.count,reactHookCandidateScoreCount:g(e.reactHookCandidates),reactLargeComponentPressureFiles:e.reactLargeComponentPressure.count,vueComponentDuplicatePairs:e.vueComponentDuplicates.count,vueComposableCandidatePairs:e.vueComposableCandidates.count,vueComposableCandidateScoreCount:g(e.vueComposableCandidates),vueLargeViewPressureFiles:e.vueLargeViewPressure.count,extractionCandidates:e.extractCount,wrappers:e.wrappers.count,wrapperScoreCount:g(e.wrappers),passthroughs:e.passthroughs.count,staleTypes:e.stale.count,driftedFiles:e.drift.count,complexityHotspotCount:e.complexity.extremeCount,hiddenCouplingPairs:e.gitEvidence?.hiddenCoupling.pairCount??null,hiddenCouplingScoreCount:e.gitEvidence?.hiddenCoupling.scoreCount??null,coverageContractViolations:e.coverageContracts.count},axes:ct(e),validation:lt(e),suppressions:e.suppressions,actions:r,pressure:i,topComplexity:e.complexity.top,coverage:a,warnings:s.length>0?s:void 0}}function st(e){let r=e.complexity.coverage.semanticEvidence.status;return{status:e.evidenceCoverage.some(i=>i.semanticEvidence.status!=="complete"&&i.semanticEvidence.status!=="disabled")?"incomplete":r==="disabled"?"semantic-disabled":r==="complete"?"complete":"incomplete",complexity:e.complexity.coverage,phases:e.evidenceCoverage}}function ct(e){return{deletable:{loc:e.dead.loc+e.isolated.loc,symbols:e.dead.count+e.isolated.count},cycles:{count:e.realCycleCount},changeAmplification:e.gitEvidence?.amplification??null,hiddenCoupling:e.gitEvidence?.hiddenCoupling??null,churnWeightedComplexity:ut(e),evidenceQuality:{graphFindings:e.dead.count+e.isolated.count+e.realCycleCount,heuristicFindings:e.similarCount+e.duplicateBodies.count+e.twinDrift.count+e.reactComponentDuplicates.count+e.reactHookCandidates.count+e.reactLargeComponentPressure.count+e.vueComponentDuplicates.count+e.vueComposableCandidates.count+e.vueLargeViewPressure.count+e.extractCount+e.wrappers.count+e.passthroughs.count+e.stale.count+e.drift.count,userSuppressed:e.suppressions?.total??0}}}function ut(e){let r=e.gitEvidence?.fileStats;return r?e.complexity.top.map(t=>{let i=t.file?r[t.file]?.changes??0:0;return{...t,changes:i,weighted:h(t.score*Math.log2(1+i))}}).sort((t,i)=>i.weighted-t.weighted):null}function lt(e){let r=e.gitEvidence?.fileStats;if(!r)return null;let t={dead:e.dead.files??[],isolated:e.isolated.files??[],twinDrift:e.twinDrift.files??[],wrappers:e.wrappers.files??[],passthroughs:e.passthroughs.files??[],stale:e.stale.files??[],reactComponents:e.reactComponentDuplicates.files??[],reactHooks:e.reactHookCandidates.files??[],reactLargeComponents:e.reactLargeComponentPressure.files??[],vueComponents:e.vueComponentDuplicates.files??[],vueComposables:e.vueComposableCandidates.files??[],vueLargeViews:e.vueLargeViewPressure.files??[]},i=new Set(Object.values(t).flat()),o=0,n=0,a=0;for(let[b,f]of Object.entries(r))i.has(b)?o+=f.fixChanges:(n+=f.fixChanges,a+=1);let s=i.size>0?h(o/i.size):0,l=a>0?h(n/a):0,d={};for(let[b,f]of Object.entries(t)){let C=new Set(f);if(C.size===0)continue;let S=0;for(let D of C)S+=r[D]?.fixChanges??0;let x=h(S/C.size);d[b]={flaggedFiles:C.size,fixDensity:x,lift:l>0?h(x/l):null}}return{flaggedFiles:i.size,flaggedFixDensity:s,baselineFixDensity:l,ratio:i.size>0&&l>0?h(s/l):null,byCategory:d,validationBasis:{method:"subject-regex",commitsScanned:e.gitEvidence?.commitsScanned??0}}}function h(e){return Math.round(e*100)/100}function Ee(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/0+$/,"").replace(/\.$/,"")}function L(e,r="existing shared infrastructure discount"){let t=g(e);return Math.abs(t-e.count)<.01?"":` (${Ee(t)} score-weighted after ${r})`}function y(e,r){let t=g(e),i=`${e.count} ${r}`;return Math.abs(t-e.count)<.01?i:`${i} (${Ee(t)} score-weighted)`}function dt(e){let r=[];if(e.dead.count>0&&r.push({category:"Dead code",evidence:"graph-fact",description:`${e.dead.count} indexed symbols with no visible repository references \u2014 review runtime/framework roots and the capability disclosure, then verify any deletion with cleanup-plan --verify`,effort:"low",impact:"high",count:e.dead.count,locRecoverable:e.dead.loc}),e.isolated.count>0&&r.push({category:"Isolated symbols",evidence:"graph-fact",description:`${e.isolated.count} symbols completely disconnected from the codebase graph`,effort:"low",impact:"medium",count:e.isolated.count,locRecoverable:e.isolated.loc}),e.realCycleCount>0&&r.push({category:"Circular dependencies",evidence:"graph-fact",description:`${e.realCycleCount} indexed dependency cycle(s) \u2014 inspect ownership and runtime order before choosing whether or how to break them`,effort:"medium",impact:"high",count:e.realCycleCount,locRecoverable:0}),e.similarCount>0&&r.push({category:"Similar functions",evidence:"heuristic",description:`${e.similarCount} pairs share disclosed call or source-token evidence beyond imports \u2014 review domain identity before considering consolidation`,effort:"medium",impact:"medium",count:e.similarCount,locRecoverable:0}),e.duplicateBodies.count>0&&r.push({category:"Duplicate function bodies",evidence:"heuristic",description:`${e.duplicateBodies.count} exact small-body group(s) across files \u2014 consolidate only when the domain concept matches`,effort:"low",impact:"medium",count:e.duplicateBodies.count,locRecoverable:e.duplicateBodies.loc}),e.twinDrift.count>0&&r.push({category:"Drifted twin implementations",evidence:"heuristic",description:`${e.twinDrift.count} same-name (or near-name) function group(s) across files with diverged or identical bodies \u2014 determine whether they represent the same concept before acting`,effort:"medium",impact:"medium",count:e.twinDrift.count,locRecoverable:0}),e.reactComponentDuplicates.count>0&&r.push({category:"Duplicated React components",evidence:"heuristic",description:`${e.reactComponentDuplicates.count} React component pair(s) share JSX structure \u2014 review whether local product intent justifies reuse`,effort:"medium",impact:"medium",count:e.reactComponentDuplicates.count,locRecoverable:e.reactComponentDuplicates.loc}),e.reactHookCandidates.count>0&&r.push({category:"Duplicated React hook behavior",evidence:"heuristic",description:`${e.reactHookCandidates.count} React component pair(s) share state/effect/request behavior${L(e.reactHookCandidates)} \u2014 review whether a common hook would preserve ownership and lifecycle semantics`,effort:"medium",impact:"medium",count:e.reactHookCandidates.count,locRecoverable:e.reactHookCandidates.loc}),e.reactLargeComponentPressure.count>0&&r.push({category:"Large React components",evidence:"heuristic",description:`${e.reactLargeComponentPressure.count} React component(s) concentrate JSX/behavior pressure \u2014 split by reason to change`,effort:"medium",impact:"medium",count:e.reactLargeComponentPressure.count,locRecoverable:0}),e.vueComponentDuplicates.count>0&&r.push({category:"Duplicated Vue components",evidence:"heuristic",description:`${e.vueComponentDuplicates.count} Vue component pair(s) share template structure \u2014 review whether local product intent justifies reuse`,effort:"medium",impact:"medium",count:e.vueComponentDuplicates.count,locRecoverable:e.vueComponentDuplicates.loc}),e.vueComposableCandidates.count>0&&r.push({category:"Duplicated Vue behavior",evidence:"heuristic",description:`${e.vueComposableCandidates.count} Vue component pair(s) share state/effect/request behavior${L(e.vueComposableCandidates)} \u2014 review whether a common composable would preserve ownership and lifecycle semantics`,effort:"medium",impact:"medium",count:e.vueComposableCandidates.count,locRecoverable:e.vueComposableCandidates.loc}),e.vueLargeViewPressure.count>0&&r.push({category:"Large Vue views",evidence:"heuristic",description:`${e.vueLargeViewPressure.count} Vue file(s) concentrate template/script/style pressure \u2014 split by reason to change`,effort:"medium",impact:"medium",count:e.vueLargeViewPressure.count,locRecoverable:0}),e.extractCount>0&&r.push({category:"Extraction candidates",evidence:"heuristic",description:`${e.extractCount} large functions with isolated callee clusters \u2014 review same-file or feature-local extraction seams`,effort:"medium",impact:"medium",count:e.extractCount,locRecoverable:0}),e.wrappers.count>0&&r.push({category:"Wrapper functions",evidence:"heuristic",description:`${e.wrappers.count} single-consumer symbols${L(e.wrappers,"boundary-evidence discount")} \u2014 inspect whether each is indirection or an intentional API, framework, or ownership boundary`,effort:"low",impact:"low",count:e.wrappers.count,locRecoverable:e.wrappers.loc}),e.passthroughs.count>0&&r.push({category:"Passthrough functions",evidence:"heuristic",description:`${e.passthroughs.count} functions that literally forward to one callee \u2014 inspect whether each is unnecessary indirection or an intentional boundary`,effort:"low",impact:"low",count:e.passthroughs.count,locRecoverable:e.passthroughs.loc}),e.stale.count>0){let o=[];e.stale.unused>0&&o.push(`${e.stale.unused} unused`),e.stale.singleUse>0&&o.push(`${e.stale.singleUse} single-consumer (not in types file)`),r.push({category:"Stale abstractions",evidence:"heuristic",description:`${o.join(", ")} \u2014 review public, runtime-registration, and ownership evidence before removing, moving, or inlining`,effort:"low",impact:"medium",count:e.stale.count,locRecoverable:e.stale.loc})}if(e.drift.count>0){let o=[];e.drift.unusedImports>0&&o.push(`${e.drift.unusedImports} unused imports`),e.drift.architectureViolations>0&&o.push(`${e.drift.architectureViolations} declared architecture violations`),r.push({category:"Structural drift",evidence:"heuristic",description:`${o.join(", ")} \u2014 repair direct dependency-rule breaks; inspect boundary signals with \`drift --architecture\``,effort:e.drift.architectureViolations>0?"medium":"low",impact:e.drift.architectureViolations>0?"medium":"low",count:e.drift.count,locRecoverable:0})}if(e.coverageContracts.count>0&&r.push({category:"Coverage contract drift",evidence:"graph-fact",description:`${e.coverageContracts.count} configured coverage contract(s) drifted from their ground-truth source (enumeration rot) \u2014 run \`codebaseiq health --json\` for the missing/extra keys`,effort:"low",impact:"medium",count:e.coverageContracts.count,locRecoverable:0}),e.gitEvidence&&e.gitEvidence.hiddenCoupling.pairCount>0){let o=e.gitEvidence.hiddenCoupling.top[0];r.push({category:"Hidden coupling",evidence:"change-graph",description:`${e.gitEvidence.hiddenCoupling.pairCount} file pair(s) co-change without a structural link`+L({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:e.gitEvidence.hiddenCoupling.scoreCount},"broad/stale-history discount")+(o?` (e.g. ${o.fileA} \u2194 ${o.fileB})`:"")+" \u2014 inspect whether a shared concept, generated artifact, or coordinated contract explains the history",effort:"medium",impact:"high",count:e.gitEvidence.hiddenCoupling.pairCount,locRecoverable:0})}let t={high:3,medium:2,low:1},i={low:3,medium:2,high:1};return r.sort((o,n)=>{let a=t[o.impact]*i[o.effort];return t[n.impact]*i[n.effort]-a}),r}var He={"dead-code":"risk",isolated:"risk",cycles:"risk",complexity:"risk","hidden-coupling":"risk","cycles-pressure":"risk","complexity-pressure":"risk","hidden-coupling-pressure":"risk",similar:"hygiene","duplicate-bodies":"hygiene","twin-drift":"hygiene","react-component-duplicates":"hygiene","react-hook-candidates":"hygiene","react-large-component-pressure":"hygiene","vue-component-duplicates":"hygiene","vue-composable-candidates":"hygiene","vue-large-view-pressure":"hygiene",extract:"hygiene",wrappers:"hygiene",passthroughs:"hygiene","stale-abstractions":"hygiene",drift:"hygiene","similar-pressure":"hygiene","duplicate-bodies-pressure":"hygiene","twin-drift-pressure":"hygiene","react-component-duplicates-pressure":"hygiene","react-hook-candidates-pressure":"hygiene","react-large-component-pressure-pressure":"hygiene","vue-component-duplicates-pressure":"hygiene","vue-composable-candidates-pressure":"hygiene","vue-large-view-pressure-pressure":"hygiene","extract-pressure":"hygiene","wrappers-pressure":"hygiene","passthroughs-pressure":"hygiene","stale-abstractions-pressure":"hygiene","drift-pressure":"hygiene"};function Le(e,r){let t=e.filter(i=>i.kind===r).reduce((i,o)=>i+o.points,0);return Math.max(0,Math.min(100,100-t))}function mt(e){let r=Math.max(e.statsResult.documents,1),t=Math.max(e.statsResult.symbols,1),i=[],o=[],n=(m,w,v)=>{w>0&&i.push({axis:m,points:w,detail:v,kind:He[m]??"hygiene"})},a=(m,w,v,Ge,We,qe,Ue)=>{let H=Math.max(Ge,1);if(v<=H)return;let P=v/H,R=Math.min(We,Math.ceil(Math.log2(P)*qe));if(R<=0)return;let Ke=He[m]??"hygiene";o.push({axis:m,category:w,kind:Ke,count:v,threshold:h(H),ratio:h(P),extraPenalty:R}),n(m,R,`${v} ${Ue} exceed pressure threshold ${h(H)} (${h(P)}x)`)},s=e.dead.count/t;n("dead-code",Math.min(20,Math.round(s*200)),`${e.dead.count} dead symbols (${e.dead.loc} LOC deletable)`);let l=e.isolated.count/t;n("isolated",Math.min(10,Math.round(l*200)),`${e.isolated.count} isolated symbols (${e.isolated.loc} LOC deletable)`),n("cycles",Math.min(15,e.realCycleCount*5),`${e.realCycleCount} real dependency cycle(s)`);let d=e.similarCount/t*1e3;n("similar",Math.min(10,Math.round(d)),`${e.similarCount} similar function pair(s)`);let b=e.duplicateBodies.count/t*1e3;n("duplicate-bodies",Math.min(10,Math.round(b*2)),`${e.duplicateBodies.count} exact duplicate small-body group(s) (${e.duplicateBodies.loc} duplicate LOC)`);let f=e.twinDrift.count/t*1e3;n("twin-drift",Math.min(10,Math.round(f*2)),`${e.twinDrift.count} drifted twin implementation group(s) (same or near-same name, diverged or identical bodies)`);let C=e.reactComponentDuplicates.count/r*1e3;n("react-component-duplicates",Math.min(10,Math.round(C)),`${e.reactComponentDuplicates.count} duplicated React component pair(s)`);let S=g(e.reactHookCandidates),x=S/r*1e3;n("react-hook-candidates",Math.min(10,Math.round(x)),y(e.reactHookCandidates,"duplicated React behavior pair(s)"));let D=e.reactLargeComponentPressure.count/r*1e3;n("react-large-component-pressure",Math.min(5,Math.round(D/2)),`${e.reactLargeComponentPressure.count} large React component pressure file(s)`);let Ie=e.vueComponentDuplicates.count/r*1e3;n("vue-component-duplicates",Math.min(10,Math.round(Ie)),`${e.vueComponentDuplicates.count} duplicated Vue component pair(s)`);let _=g(e.vueComposableCandidates),ze=_/r*1e3;n("vue-composable-candidates",Math.min(10,Math.round(ze)),y(e.vueComposableCandidates,"duplicated Vue behavior pair(s)"));let Oe=e.vueLargeViewPressure.count/r*1e3;n("vue-large-view-pressure",Math.min(5,Math.round(Oe/2)),`${e.vueLargeViewPressure.count} large Vue view pressure file(s)`);let F=g(e.wrappers);n("wrappers",Math.min(3,F),y(e.wrappers,"wrapper candidate(s)"));let I=g(e.passthroughs);n("passthroughs",Math.min(3,I),y(e.passthroughs,"passthrough candidate(s)")),n("stale-abstractions",Math.min(8,e.stale.unused),`${e.stale.unused} unused stale abstraction(s); ${e.stale.singleUse} single-consumer signal(s)`);let je=e.drift.direct/r;if(n("drift",Math.min(5,Math.round(je*50)),`${e.drift.direct} direct drift finding(s); ${e.drift.signal} signal drift finding(s)`),n("complexity",Math.min(5,e.complexity.extremeCount*2),`${e.complexity.extremeCount} extreme complexity hotspot(s)`),e.gitEvidence){let m=e.gitEvidence.hiddenCoupling.scoreCount;n("hidden-coupling",Math.min(5,Math.ceil(m/10)),y({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:m},"co-changing pair(s) without a structural link"))}if(a("cycles-pressure","Circular dependencies",e.realCycleCount,3,10,3,"cycle(s)"),a("complexity-pressure","Extreme complexity",e.complexity.extremeCount,3,5,2,"extreme complexity hotspot(s)"),e.gitEvidence){let m=e.gitEvidence.hiddenCoupling.scoreCount;a("hidden-coupling-pressure","Hidden coupling",m,50,10,4,"score-weighted co-changing pair(s)")}return a("similar-pressure","Similar functions",e.similarCount,Math.max(50,t*.01),8,4,"similar function pair(s)"),a("duplicate-bodies-pressure","Duplicate function bodies",e.duplicateBodies.count,Math.max(20,t*.005),8,4,"exact duplicate small-body group(s)"),a("twin-drift-pressure","Drifted twin implementations",e.twinDrift.count,Math.max(20,t*.005),8,4,"drifted twin implementation group(s)"),a("react-component-duplicates-pressure","Duplicated React components",e.reactComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated React component pair(s)"),a("react-hook-candidates-pressure","Duplicated React hook behavior",S,Math.max(10,r*.01),8,4,"duplicated React behavior pair(s)"),a("react-large-component-pressure-pressure","Large React components",e.reactLargeComponentPressure.count,Math.max(10,r*.01),4,2,"large React component pressure file(s)"),a("vue-component-duplicates-pressure","Duplicated Vue components",e.vueComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated Vue component pair(s)"),a("vue-composable-candidates-pressure","Duplicated Vue behavior",_,Math.max(10,r*.01),8,4,"duplicated Vue behavior pair(s)"),a("vue-large-view-pressure-pressure","Large Vue views",e.vueLargeViewPressure.count,Math.max(10,r*.01),4,2,"large Vue view pressure file(s)"),a("extract-pressure","Extraction candidates",e.extractCount,Math.max(50,t*.01),4,2,"extraction candidate(s)"),a("wrappers-pressure","Wrapper functions",F,50,4,2,"wrapper candidate(s)"),a("passthroughs-pressure","Passthrough functions",I,50,4,2,"passthrough candidate(s)"),a("stale-abstractions-pressure","Single-consumer stale abstraction signals",e.stale.singleUse,Math.max(50,t*.02),4,2,"single-consumer stale abstraction signal(s)"),a("drift-pressure","Structural drift signals",e.drift.signal,Math.max(10,r*.1),4,2,"signal drift finding(s)"),{breakdown:i,pressure:o}}var p={dead:{minLoc:3,skipBarrels:!0,deadCodeOnly:!0},isolated:{minLoc:3},similar:{minSimilarity:.6,limit:50,minCallees:4},duplicateBodies:{maxLoc:15,limit:50},extract:{minLoc:15,minCallees:5,limit:50},wrappers:{maxLoc:15,limit:50},passthroughs:{maxLoc:15,limit:50},stale:{minLoc:3,limit:50},drift:{},twinDrift:{minSimilarity:.3}};import{getHeapStatistics as pt}from"v8";var ht=64*1024*1024;function $(){let e=globalThis.gc;if(!e)return;let r=pt();r.heap_size_limit-r.used_heap_size<ht||e()}var gt=50,ft=25e3,Ct=2500,De=2500,Pe=50,vt=10,bt=["overview","dead","isolated","cycles","similar","duplicate-bodies","twin-drift","react-component-duplicates","react-hook-candidates","react-large-component-pressure","vue-component-duplicates","vue-composable-candidates","vue-large-view-pressure","extract-candidates","wrapper-candidates","passthrough-candidates","stale-abstractions","drift","complexity-hotspots","git-evidence","suppressions","coverage-contracts"],St={overview:(e,r,t,i)=>({phase:"overview",statsResult:i,warnings:t.warnings}),dead:(e,r,t)=>({phase:"dead",dead:wt(e,r,t)}),isolated:(e,r,t)=>({phase:"isolated",isolated:Ht(e,r,t)}),cycles:(e,r,t)=>({phase:"cycles",realCycleCount:Lt(e,r,t)}),similar:(e,r,t)=>({phase:"similar",similarCount:Et(e,r,t)}),"duplicate-bodies":(e,r,t)=>({phase:"duplicate-bodies",duplicateBodies:Pt(e,r,t)}),"twin-drift":(e,r,t)=>({phase:"twin-drift",twinDrift:Rt(e,r,t)}),"react-component-duplicates":(e,r,t)=>({phase:"react-component-duplicates",reactComponentDuplicates:kt(e,r,t)}),"react-hook-candidates":(e,r,t)=>({phase:"react-hook-candidates",reactHookCandidates:Mt(e,r,t)}),"react-large-component-pressure":(e,r,t)=>({phase:"react-large-component-pressure",reactLargeComponentPressure:At(e,r,t)}),"vue-component-duplicates":(e,r,t)=>({phase:"vue-component-duplicates",vueComponentDuplicates:Tt(e,r,t)}),"vue-composable-candidates":(e,r,t)=>({phase:"vue-composable-candidates",vueComposableCandidates:Bt(e,r,t)}),"vue-large-view-pressure":(e,r,t)=>({phase:"vue-large-view-pressure",vueLargeViewPressure:$t(e,r,t)}),"extract-candidates":(e,r,t)=>({phase:"extract-candidates",extractCount:Dt(e,r,t)}),"wrapper-candidates":(e,r,t)=>({phase:"wrapper-candidates",wrappers:Vt(e,r,t)}),"passthrough-candidates":(e,r,t)=>({phase:"passthrough-candidates",passthroughs:Nt(e,r,t)}),"stale-abstractions":(e,r,t)=>({phase:"stale-abstractions",stale:_t(e,r,t)}),drift:(e,r,t)=>({phase:"drift",drift:Ot(e,r,t)}),"complexity-hotspots":(e,r,t)=>({phase:"complexity-hotspots",complexity:jt(e,r,t)}),"git-evidence":(e,r,t)=>({phase:"git-evidence",gitEvidence:Ft(e,t)}),suppressions:(e,r,t)=>({phase:"suppressions",suppressions:It(e,t)}),"coverage-contracts":(e,r,t)=>({phase:"coverage-contracts",coverageContracts:zt(e,t)})};function Or(e,r={}){return Me(e,r.full!==!1,(t,i)=>{let o=xt(e,r.scope,t,i);return B(o)})}function jr(e,r,t={}){return yt(e,[r],t)[0]}function yt(e,r,t={}){return Me(e,t.full!==!1,(i,o)=>{let n={...o,releaseCachesBetweenPhases:!1};return r.map(a=>Te(e,a,t.scope,n,i))})}function Me(e,r,t){let i=ge(e),o=Gt(i,r);try{return t(i,o)}finally{T(e,{semanticProvider:!0}),$()}}function Gr(e){return B(Ae(e))}function Ae(e){let r=u(e,"overview");return{statsResult:r.statsResult,warnings:r.warnings,evidenceCoverage:e.map(i=>({phase:i.phase,semanticEvidence:i.evidenceCoverage})),dead:u(e,"dead").dead,isolated:u(e,"isolated").isolated,realCycleCount:u(e,"cycles").realCycleCount,similarCount:u(e,"similar").similarCount,duplicateBodies:u(e,"duplicate-bodies").duplicateBodies,twinDrift:u(e,"twin-drift").twinDrift,reactComponentDuplicates:u(e,"react-component-duplicates").reactComponentDuplicates,reactHookCandidates:u(e,"react-hook-candidates").reactHookCandidates,reactLargeComponentPressure:u(e,"react-large-component-pressure").reactLargeComponentPressure,vueComponentDuplicates:u(e,"vue-component-duplicates").vueComponentDuplicates,vueComposableCandidates:u(e,"vue-composable-candidates").vueComposableCandidates,vueLargeViewPressure:u(e,"vue-large-view-pressure").vueLargeViewPressure,extractCount:u(e,"extract-candidates").extractCount,wrappers:u(e,"wrapper-candidates").wrappers,passthroughs:u(e,"passthrough-candidates").passthroughs,stale:u(e,"stale-abstractions").stale,drift:u(e,"drift").drift,complexity:u(e,"complexity-hotspots").complexity,gitEvidence:Re(e,"git-evidence")?.gitEvidence??null,suppressions:Re(e,"suppressions")?.suppressions??null,coverageContracts:u(e,"coverage-contracts").coverageContracts}}function Re(e,r){return e.find(t=>t.phase===r)}function u(e,r){let t=e.find(i=>i.phase===r);if(!t)throw new Error(`Missing health phase result: ${r}`);return t}function xt(e,r,t,i){return Ae(bt.map(o=>Te(e,o,r,i,t)))}function Te(e,r,t,i,o){q(e);let n=St[r](e,t,i,o),a=U(e),s=a.incompleteSymbolIds.size,l=a.unavailableSymbolIds.size,d=i.semantic?s>0&&l>0?"incomplete-and-unavailable":s>0?"incomplete":l>0?"unavailable":"complete":"disabled";return{...n,evidenceCoverage:{enabled:i.semantic,status:d,incompleteSymbolCount:s,unavailableSymbolCount:l}}}function wt(e,r,t){return c(e,t,"dead",()=>{let i=Y(e,{scope:r,...p.dead,scanLimit:t.candidateScanLimit,semantic:t.semantic});return E(Ut(e,i.symbols))})}function Ht(e,r,t){return c(e,t,"isolated",()=>{let i=ne(e,{scope:r,...p.isolated,scanLimit:t.candidateScanLimit,semantic:t.semantic});return E(Kt(e,i))})}function Lt(e,r,t){return c(e,t,"cycles",()=>ee(e,{scope:r}).filter(o=>o.kind==="real").length)}function Et(e,r,t){let i=c(e,t,"similar",()=>Z(e,{scope:r,...p.similar,scanLimit:t.candidateScanLimit,semantic:t.semantic}));return Math.min(i,t.candidateResultLimit)}function Dt(e,r,t){return c(e,t,"extract-candidates",()=>oe(e,{scope:r,...p.extract,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic}).length)}function Pt(e,r,t){return c(e,t,"duplicate-bodies",()=>{let i=te(e,{scope:r,...p.duplicateBodies,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}),o=new Set,n=0;for(let a of i)for(let s of a.functions.slice(1))o.add(s.file),n+=s.loc;return{count:i.length,loc:n,files:[...o]}})}function Rt(e,r,t){return c(e,t,"twin-drift",()=>{let i=re(e,{scope:r,...p.twinDrift,scanLimit:t.candidateScanLimit}).filter(a=>a.relationship==="divergent"||a.relationship==="identical"),o=new Set,n=0;for(let a of i)for(let s of a.members)o.add(s.file),n+=s.loc;return{count:i.length,loc:n,files:[...o].sort()}})}function kt(e,r,t){return c(e,t,"react-component-duplicates",()=>{let i=ae(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return V(i)})}function Mt(e,r,t){return c(e,t,"react-hook-candidates",()=>{let i=se(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return $e(i,Xt)})}function At(e,r,t){return c(e,t,"react-large-component-pressure",()=>{let i=ce(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return Yt(i)})}function Tt(e,r,t){return c(e,t,"vue-component-duplicates",()=>{let i=ue(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return V(i)})}function Bt(e,r,t){return c(e,t,"vue-composable-candidates",()=>{let i=le(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return $e(i,Qt)})}function $t(e,r,t){return c(e,t,"vue-large-view-pressure",()=>{let i=de(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return E(i)})}function Vt(e,r,t){return c(e,t,"wrapper-candidates",()=>{let i=me(e,{scope:r,...p.wrappers,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return Be(i,Jt)})}function Nt(e,r,t){return c(e,t,"passthrough-candidates",()=>{let i=pe(e,{scope:r,...p.passthroughs,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return Be(i,Zt)})}function _t(e,r,t){return c(e,t,"stale-abstractions",()=>{let i=he(e,{scope:r,...p.stale,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic}),o=i.filter(n=>n.consumers===0).length;return{count:i.length,loc:i.reduce((n,a)=>n+a.loc,0),files:[...new Set(i.map(n=>n.file))],unused:o,singleUse:i.length-o}})}function Ft(e,r){return c(e,r,"git-evidence",()=>{let t=X(e,{historyMode:r.gitHistoryMode}),i=t.fileChurn();if(!i)return null;let o=t.commitHistory(),n=Q(e,void 0,{limit:r.candidateResultLimit,historyMode:r.gitHistoryMode}),a={};for(let[s,l]of i)a[s]={changes:l.changes,fixChanges:l.fixChanges};return{amplification:t.changeAmplification(),hiddenCoupling:{pairCount:n.findings.length,scoreCount:N(n.findings.reduce((s,l)=>s+ke(l),0)),top:n.findings.slice(0,5).map(s=>({fileA:s.fileA,fileB:s.fileB,together:s.together,confidence:s.confidence,focusedTogether:s.focusedTogether,broadTogether:s.broadTogether,broadCommitRatio:s.broadCommitRatio,lastTogetherAt:s.lastTogetherAt,recentTogether:s.recentTogether,commitScope:s.commitScope,recency:s.recency,scoreWeight:ke(s),subjectContext:s.subjectContext}))},fileStats:a,commitsScanned:o?.commits.length??0}})}function It(e,r){return c(e,r,"suppressions",()=>{let t=fe(e);return{total:t.total,byCategory:{...t.byCategory}}})}function zt(e,r){return c(e,r,"coverage-contracts",()=>{let t=e.config.coverageContracts??[],o=be(e,t).filter(n=>n.status!=="ok");return{count:o.length,loc:0,files:[...new Set(o.map(n=>n.file))].sort()}})}function Ot(e,r,t){return c(e,t,"drift",()=>{let i=ie(e,{scope:r,...p.drift,includePatternDeviations:!1,limit:Number.POSITIVE_INFINITY,semantic:t.semantic}),o=i.results.filter(s=>s.kind!=="pattern-deviation"),n=o.filter(s=>s.actionTier==="direct").length,a=o.length-n;return{count:o.length,unusedImports:i.unusedImports,architectureViolations:i.architectureViolations,layerViolations:i.layerViolations,direct:n,signal:a}})}function jt(e,r,t){return c(e,t,"complexity-hotspots",()=>{let i=J(e,{scope:r,minLoc:10,limit:t.complexityResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return{top:i.rows.slice(0,5).map(o=>({symbol:o.shortName,score:o.score,file:o.file})),extremeCount:i.rows.filter(o=>o.score>gt).length,coverage:i.coverage}})}function Gt(e,r){let t=e.symbols>=ft||e.documents>=Ct,i=r?Number.POSITIVE_INFINITY:Pe,o=r?Number.POSITIVE_INFINITY:vt;return!t||r?{candidateScanLimit:void 0,candidateResultLimit:i,complexityResultLimit:o,semantic:!0,gitHistoryMode:r?"full":"bounded",releaseCachesBetweenPhases:!0,warnings:r&&t?["Large index detected; running health without candidate scan or result caps because full mode is enabled."]:[]}:{candidateScanLimit:De,candidateResultLimit:i,complexityResultLimit:o,semantic:!1,gitHistoryMode:"bounded",releaseCachesBetweenPhases:!0,warnings:[`Large index detected; candidate-style health checks scanned their highest-priority ${De} symbols and reported their top ${Pe} findings. Enable full mode for unbounded candidate counts.`]}}function Wt(e,r){r.releaseCachesBetweenPhases&&(T(e),$())}function c(e,r,t,i){qt(t);try{return i()}finally{Wt(e,r)}}function qt(e){process.env.CODEBASEIQ_HEALTH_TRACE==="1"&&console.error(`[health] ${e}`)}function Ut(e,r){return r.filter(t=>!M(e,t.relativePath)&&!A(e,t.symbol,t.relativePath)&&t.kind==="dead-code")}function Kt(e,r){return r.filter(t=>!M(e,t.relativePath)&&!A(e,t.symbol,t.relativePath))}function E(e){let r=new Set;for(let t of e){let i=t.relativePath??t.file;i&&r.add(i)}return{count:e.length,loc:e.reduce((t,i)=>t+i.loc,0),files:[...r]}}function Be(e,r){return{...E(e),scoreCount:N(e.reduce((i,o)=>i+r(o),0))}}function Yt(e){let r=new Map;for(let t of e)r.set(t.file,Math.max(r.get(t.file)??0,t.loc));return{count:r.size,loc:[...r.values()].reduce((t,i)=>t+i,0),files:[...r.keys()]}}function V(e){let r=new Map;for(let t of e)r.set(t.fileA,Math.max(r.get(t.fileA)??0,t.locA)),r.set(t.fileB,Math.max(r.get(t.fileB)??0,t.locB));return{count:e.length,loc:[...r.values()].reduce((t,i)=>t+i,0),files:[...r.keys()]}}function $e(e,r){return{...V(e),scoreCount:N(e.reduce((i,o)=>i+r(o),0))}}function Xt(e){let r=e.sharedHooks.length>0,t=Ve({namedState:e.sharedState,requests:e.sharedRequests,lifecycle:e.sharedEffects,functions:e.sharedHandlers});return r&&t<=2?0:r?.5:Ne(e.sharedState,e.sharedHandlers,e.sharedHandlerVerbs)?.25:t>=2?1:.5}function Qt(e){let r=e.sharedComposables.length+e.sharedStores.length>0,t=Ve({namedState:e.sharedBindings,requests:e.sharedRequests,lifecycle:e.sharedLifecycle,functions:e.sharedFunctions});return r&&t<=2?0:r?.5:Ne(e.sharedBindings,e.sharedFunctions,e.sharedFunctionVerbs)?.25:t>=2?1:.5}function Ve(e){return e.requests.length*2+e.lifecycle.length+e.namedState.filter(r=>!Fe.has(_e(r))).length+Math.min(e.functions.length,3)}function Ne(e,r,t){let i=[...e,...r,...t].map(_e);return i.length>0&&i.every(o=>Fe.has(o))}function _e(e){return e.replace(/^handle/,"").replace(/^is/,"").replace(/^has/,"").toLowerCase()}function Jt(e){return e.actionTier==="signal"?.25:1}function Zt(e){return e.actionTier==="signal"?.25:1}function ke(e){return e.commitScope==="broad-sweep"?e.recency==="recent"?.25:0:e.commitScope==="mixed"?e.recency==="recent"?.5:.25:e.recency==="recent"?1:.5}function N(e){return Math.round(e*100)/100}var Fe=new Set(["add","apply","cancel","change","clear","close","create","delete","draft","edit","error","filter","form","load","loading","name","open","refresh","remove","reset","save","saving","search","select","selected","submit","toggle","update","value"]);export{p as a,bt as b,Or as c,jr as d,yt as e,Gr as f};
|
|
2
|
+
//# sourceMappingURL=chunk-DTM4EHD2.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{f as B,g as S}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{f as B,g as S}from"./chunk-R7PXHYMY.js";import{b as O}from"./chunk-B75HZHUP.js";import{a as E}from"./chunk-BGBBVSH4.js";import{c as k}from"./chunk-GLXEWYQY.js";import{a as L}from"./chunk-NMKQOIYZ.js";import{d as P}from"./chunk-SGX43S2L.js";import{d as I,g as z,j as D,u as $}from"./chunk-TNLOX4TN.js";import{b as T,k as v,p as A}from"./chunk-RGBZDOUO.js";import{A as _}from"./chunk-23AD24QZ.js";import{d as p}from"./chunk-3LCDIREB.js";import{d as b}from"./chunk-6I55VYFG.js";var U=new Set(P());function $e(e,t={}){let{includeHomonyms:n=!1,limit:i}=t,s=X(e,t).filter(r=>r.relationship==="divergent"||n&&r.relationship==="homonym");return i?s.slice(0,i):s}function X(e,t={}){let{scope:n,minSimilarity:i=.3,scanLimit:s}=t,r=Q(e,{scope:n,scanLimit:s});return Y(r,{minSimilarity:i,isDelegatePair:De(e)}).filter(a=>!a.members.some(o=>_(e,o.file,o.startLine,"twin")))}function Y(e,t={}){let n=t.minSimilarity??.3,i=t.isDelegatePair,s=e.filter(c=>!V(c.leaf)&&!fe(c.leaf)&&L(c.file)!=="test"&&!D(c.symbol)&&!Z(c.symbol)&&!j(c.symbol,c.leaf)),{recordsByLeaf:r,recordOrder:a}=p("twin-drift.group-by-leaf",()=>q(s),()=>({records:s.length})),o=p("twin-drift.cluster-leaf-names",()=>W([...r.keys()]),()=>({leaves:r.size}));return p("twin-drift.compare-clusters",()=>{let c=[];for(let h of o){let u=J(h,r,a);if(u.length<2||new Set(u.map(f=>f.file)).size<2)continue;let m=null,R=!1,C=!1,y=new Set;for(let f=0;f<u.length;f+=1)for(let w=f+1;w<u.length;w+=1){let d=u[f],g=u[w];if(d.file===g.file||!ge(d,g)||i?.(d,g,u)||i?.(g,d,u))continue;if(R=!0,y.add(d.symbol),y.add(g.symbol),d.normalizedBody===g.normalizedBody){C=!0;continue}let M=oe(d.tokens,g.tokens);(!m||M>m.similarity)&&(m={a:d,b:g,similarity:M})}if(!R)continue;let x=u.filter(f=>y.has(f.symbol)).sort((f,w)=>f.file.localeCompare(w.file)||f.startLine-w.startLine).map(se);if(!m){c.push({leaf:G(h),relationship:C?"identical":"homonym",maxDivergence:0,members:x});continue}let N=m.similarity>=n?"divergent":"homonym";c.push({leaf:G(h),relationship:N,maxDivergence:Math.round((1-m.similarity)*1e3)/1e3,members:x,...N==="divergent"?{firstDivergentTokens:ae(m.a.tokens,m.b.tokens)}:{}})}return c},()=>({clusters:o.length,records:s.length})).sort((c,h)=>h.members.length-c.members.length||h.maxDivergence-c.maxDivergence||c.leaf.localeCompare(h.leaf))}function q(e){let t=new Map,n=new Map;for(let[i,s]of e.entries()){let r=t.get(s.leaf)??[];r.push(s),t.set(s.leaf,r),n.set(s,i)}return{recordsByLeaf:t,recordOrder:n}}function J(e,t,n){let i=[...e].flatMap(s=>t.get(s)??[]);return e.size>1&&i.sort((s,r)=>(n.get(s)??0)-(n.get(r)??0)),i}function Q(e,t){let n=p("twin-drift.load-definitions",()=>$(e,{scope:t.scope}).filter(r=>ee(r)&&!e.isIgnored(r.relativePath)).filter(r=>!k(r.relativePath)));p("twin-drift.sort-definitions",()=>n.sort((r,a)=>r.relativePath.localeCompare(a.relativePath)||r.startLine-a.startLine),()=>({definitions:n.length}));let i=O(n,t.scanLimit),s=p("twin-drift.select-candidates",()=>te(i),()=>({scanned:i.length}));return p("twin-drift.build-records",()=>{let r=[];for(let a of s){let o=ne(e,a);o&&r.push(o)}return r},()=>({candidates:s.length,scanned:i.length}))}function ee(e){return e.isFunctionLike?e.symbol.startsWith("rust-analyzer ")?typeof e.kind=="number"&&U.has(e.kind):!0:!1}function te(e){let t=e.filter(r=>r.leaf&&!V(r.leaf)&&!D(r.symbol)&&!Z(r.symbol)&&!j(r.symbol,r.leaf)),n=new Map;for(let r of t){let a=n.get(r.leaf)??[];a.push(r),n.set(r.leaf,a)}let i=W([...n.keys()]),s=new Set;for(let r of i){let a=[...r].flatMap(o=>n.get(o)??[]);if(!(a.length<2)&&!(new Set(a.map(o=>o.relativePath)).size<2)&&!a.every(o=>L(o.relativePath)==="test"))for(let o of a)s.add(o)}return e.filter(r=>s.has(r))}function ne(e,t){if(!t.leaf)return null;let n=B(e,t);if(!n||!z(t.symbol)&&!re(n,t.leaf))return null;let i=T(S(n)),s=i.replace(/\s+/g,"");if(!s||s.length<8)return null;let r=i.match(ie)??[];return r.length===0?null:{leaf:t.leaf,symbol:t.symbol,shortName:I(t.symbol),file:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:E(t),normalizedBody:s,tokens:r,isThinForwarder:H(i)}}function re(e,t){let n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`\\b(?:const|let|var)\\s+${n}(?:\\s*:[^=]+)?\\s*=\\s*(?:async\\s*)?(?:\\([^)]*\\)|[A-Za-z_$][\\w$]*)\\s*=>`,"s").test(e)}var ie=/[A-Za-z_$][A-Za-z0-9_$]*|\d+(?:\.\d+)?|[^\sA-Za-z0-9_$]/g;function se(e){return{symbol:e.symbol,shortName:e.shortName,file:e.file,startLine:e.startLine,endLine:e.endLine,loc:e.loc}}function oe(e,t){let n=new Set(e),i=new Set(t);if(n.size===0&&i.size===0)return 1;if(n.size===0||i.size===0)return 0;let s=0;for(let a of n)i.has(a)&&(s+=1);let r=n.size+i.size-s;return r===0?0:s/r}function ae(e,t){let n=Math.min(e.length,t.length),i=0;for(;i<n&&e[i]===t[i];)i+=1;let s=e.slice(i,i+6).join(" "),r=t.slice(i,i+6).join(" ");return!s&&!r?"(bodies differ only in trailing length)":`A: ${s||"(end)"} | B: ${r||"(end)"}`}function W(e){let t=new Map;for(let a of e)t.set(a,a);let n=a=>{let o=a;for(;t.get(o)!==o;)o=t.get(o);let l=a;for(;t.get(l)!==o;){let c=t.get(l);t.set(l,o),l=c}return o},i=(a,o)=>{let l=n(a),c=n(o);l!==c&&t.set(l,c)},s=new Map;for(let a of e){let o=a.slice(0,2).toLowerCase(),l=s.get(o)??[];l.push(a),s.set(o,l)}for(let a of s.values())for(let o=0;o<a.length;o+=1)for(let l=o+1;l<a.length;l+=1)le(a[o],a[l])&&i(a[o],a[l]);let r=new Map;for(let a of e){let o=n(a),l=r.get(o)??new Set;l.add(a),r.set(o,l)}return[...r.values()]}function le(e,t){return e===t||e.toLowerCase()===t.toLowerCase()?!0:e.length<8||t.length<8||Math.abs(e.length-t.length)>2||ce(e.toLowerCase(),t.toLowerCase())/Math.max(e.length,t.length)<.8?!1:pe(e.toLowerCase(),t.toLowerCase(),2)}function ce(e,t){let n=Math.min(e.length,t.length),i=0;for(;i<n&&e[i]===t[i];)i+=1;return i}function fe(e){return/^[A-Z][A-Z0-9_]*$/.test(e)||/^__[^_].*__$/.test(e)||ue.has(e.toLowerCase())}var ue=new Set(["main","row"]),me=new Set(["app","component","components","feature","features","impl","index","lib","route","routes","shared","src","tsx","typescript","ui"]);function Z(e){return e.startsWith("rust-analyzer ")&&/\/(?:tests?|benches?)\//.test(e)}var de=new Set(["default","new","reset"]);function j(e,t){return e.startsWith("rust-analyzer ")&&de.has(t.toLowerCase())}function ge(e,t){if(e.leaf.toLowerCase()!==t.leaf.toLowerCase()||e.leaf.length>4)return!0;let n=F(e);return[...F(t)].some(i=>n.has(i))}function F(e){let t=e.leaf.toLowerCase();return new Set(`${e.file}/${e.shortName}`.replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(n=>n.length>2&&n!==t&&!me.has(n)))}function pe(e,t,n){if(Math.abs(e.length-t.length)>n)return!1;let i=Array.from({length:t.length+1},(s,r)=>r);for(let s=1;s<=e.length;s+=1){let r=[s],a=r[0];for(let o=1;o<=t.length;o+=1){let l=e[s-1]===t[o-1]?0:1,c=Math.min(i[o]+1,r[o-1]+1,i[o-1]+l);r.push(c),a=Math.min(a,c)}if(a>n)return!1;i=r}return i[t.length]<=n}function ke(e){return H(T(S(e)))}function H(e){let t=e.trim();if(!t||he.test(t))return!1;let n=be(t);return n.length===0||n.length>2?!1:ye(n[n.length-1])}var he=/\b(?:if|else|for|while|switch|try|catch|do)\b/,we=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\[[^[\]]*\])*\((?:[^()]|\([^()]*\))*\)$/;function ye(e){let t=e.trim().replace(/^return\s+/,"").replace(/^await\s+/,"").replace(/;\s*$/,"").trim();return we.test(t)}function be(e){let t=[],n=0,i="";for(let s of e){if(s==="("||s==="["||s==="{"?n+=1:(s===")"||s==="]"||s==="}")&&(n=Math.max(0,n-1)),s===";"&&n===0){t.push(i),i="";continue}i+=s}return i.trim()&&t.push(i),t.map(s=>s.trim()).filter(s=>s.length>0)}var Te=3;function De(e){let t=new Map;return(n,i,s)=>{if(!n.isThinForwarder)return!1;let r=`${n.symbol}\0${i.symbol}`,a=t.get(r);if(a!==void 0)return a;let o=K(e,n,i,s,Te,new Set);return t.set(r,o),o}}function K(e,t,n,i,s,r){if(s<=0||r.has(t.symbol)||(r.add(t.symbol),(v(e,t.file)??[]).filter(l=>l.line>=t.startLine&&l.line<=t.endLine&&l.calleeLeaf===n.leaf).length===0))return!1;let o=new Set(A(e,t.file).filter(l=>l.sourcePath&&(l.kind!=="namespace"||l.usedMembers.includes(n.leaf))).map(l=>l.sourcePath));if([...o].some(l=>b(l,n.file)))return!0;for(let l of i)if(!(l.symbol===t.symbol||l.symbol===n.symbol||!l.isThinForwarder)&&[...o].some(c=>b(c,l.file))&&K(e,l,n,i,s-1,r))return!0;return!1}function V(e){return e.startsWith("<")&&e.endsWith(">")}function G(e){return[...e].sort()[0]}export{$e as a,X as b,Y as c,ke as d,be as e};
|
|
2
|
+
//# sourceMappingURL=chunk-DUM7GR6B.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{m as o}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{m as o}from"./chunk-5AJQCOZZ.js";import{G as n}from"./chunk-C3PPB2T5.js";async function i(t){if(typeof t!="string"||t.length===0)throw new Error("Output continuation requires a cursor.");await o(t,n)}var u={id:"continue",command:"continue <cursor>",hidden:!0,description:"Continue an immutable output snapshot",renderShape:"custom",handler:i};export{u as a};
|
|
2
|
+
//# sourceMappingURL=chunk-DZ4QOIRY.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{a as Ue}from"./chunk-
|
|
1
|
+
import{a as Ue}from"./chunk-GRHNPFHT.js";import{b as xe,c as Se}from"./chunk-7XHZX6FX.js";import{c as ze}from"./chunk-JGXLB7PR.js";import{d as Te}from"./chunk-3GKKCVKK.js";import{i as Be}from"./chunk-ZQ6GAIUV.js";import{c as We}from"./chunk-UHFZDQZJ.js";import{d as Xe,e as Ke,f as qe}from"./chunk-NB2DAVPP.js";import{a as z}from"./chunk-NMKQOIYZ.js";import{A as $e,d as te,i as oe,t as ge}from"./chunk-TNLOX4TN.js";import{f as Q}from"./chunk-RGBZDOUO.js";import{x as we}from"./chunk-23AD24QZ.js";var Pe=new Set(["a","an","and","are","as","at","be","become","becomes","by","can","does","for","from","how","in","into","is","it","its","of","on","or","that","the","their","then","this","through","to","what","when","where","which","with"]);function le(e){return e.replace(/([\p{Ll}\d])([\p{Lu}])/gu,"$1 $2").replace(/([\p{Lu}]+)([\p{Lu}][\p{Ll}])/gu,"$1 $2").match(/[\p{L}\d]+/gu)??[]}function T(e){return new Set(le(e).flatMap(Ie).filter(n=>n.length>=3))}function Ie(e){let n=ve(e);return n.length>4&&n.endsWith("e")?[n,n.slice(0,-1)]:[n]}function ve(e){let n=e.toLocaleLowerCase();return n.length>5&&n.endsWith("ies")?`${n.slice(0,-3)}y`:n.length>4&&n.endsWith("ied")?`${n.slice(0,-3)}y`:n.length>4&&n.endsWith("ed")?je(n.slice(0,-2)):n.length>5&&n.endsWith("ing")?je(n.slice(0,-3)):n.length>4&&n.endsWith("ers")||n.length>3&&n.endsWith("s")&&!n.endsWith("ss")?n.slice(0,-1):n}function je(e){if(e.length<2)return e;let n=e.at(-1),s=e.at(-2);return n===s&&!"aeiou".includes(n)?e.slice(0,-1):e}var He=4,yn=3,fn=12,pn=48,bn=64,J=10,V=6,gn=24,Sn=320,Ee=6,vn=12,An=1,Mn=4,Ln=7,Dn=12,Ne="source-construct:",Cn=96,Rn=32,Ye=4,wn=32,Tn=8;function $t(e,n,s={}){let a=xn(n),r=ft(n);if(a.length===0)throw new Error("Anchor discovery requires at least one non-trivial repository term.");let o=s.limit??He,t=s.full===!0;if(!Number.isSafeInteger(o)||o<=0)throw new RangeError(`anchor group limit must be a positive safe integer; received ${o}`);let i=new We(e),d=i.scopedDefinitions(s.scope).filter(g=>!oe(g.symbol)),l=[...d],c=new Map(l.map(g=>[g.symbol,g])),m=new Map;for(let g of d)Qe(m,g,a);let u=ze(e,{scope:s.scope});for(let g of u.files){let pe=ge(e,g.relativePath).filter(_=>!oe(_.symbol));if(pe.length===0)continue;let ne=ln(g.text);for(let _=0;_<ne.length;_+=1){let be=T(ne[_]??""),ae=a.filter(O=>be.has(O));if(ae.length===0)continue;let D=$e(pe,_);if(!(!D||oe(D.symbol)))for(let O of ae)de(m,D,O,"source",g.relativePath,_)}}let h=Ve(m),y=[...m.values()].map(g=>Ae(g,h,r)).sort(R),b=In(u.files,y,a),v=-1;for(let g of b){let B=ge(e,g.relativePath),pe=B.filter(D=>!oe(D.symbol)),ne=Q(e,g.relativePath)?.callables??[],_=new Map,be=D=>{let O=`${D.startLine}\0${D.endLine}\0${D.name}`,Y=_.get(O);if(Y)return Y;let N=Pn(g.relativePath,B,D,()=>v--);return N?(_.set(O,N),l.push(N),c.set(N.symbol,N),Qe(m,N,a),N):null};for(let D of ne){let O=T(D.name);a.some(Y=>O.has(Y))&&be(D)}if(ne.length===0)continue;let ae=ln(g.text);for(let D=0;D<ae.length;D+=1){let O=T(ae[D]??""),Y=a.filter(Re=>O.has(Re));if(Y.length===0)continue;let N=En(ne,D),ce=N?be(N):null;if(!ce)continue;let Ge=Ze(pe,D);if(Ze(Ge?[Ge,ce]:[ce],D)?.symbol===ce.symbol)for(let Re of Y)de(m,ce,Re,"source",g.relativePath,D)}}let S=Ve(m),M=new Map(u.files.map(g=>[g.relativePath,g.text.split(/\r?\n/u)]));for(let g of m.values()){let B=M.get(g.definition.relativePath);B&&(g.sourceCharacters=B.slice(g.definition.startLine,g.definition.endLine+1).join(`
|
|
2
2
|
`).length)}let f=[...m.values()].map(g=>Ae(g,S,r)).sort(R),C=Math.min(f.length,Math.max(fn,o*yn)),A=t?f:re([...f.slice(0,C),...[...f].sort(ke).slice(0,Math.max(pn,C)),...ct(f,a),...lt(f,a,S)]),x=A.length,P=A.map(g=>c.get(g.symbol)).filter(g=>g?.isFunctionLike===!0),H=Fn(l),E=kn(e,i,A,P,c,H,new Set(m.keys()),s.semantic!==!1),W=Nn(E,A,m,S,c),F=Gn(W,S,a),K=Zn(e,i,E,m,S,l,c,s.semantic!==!1),L=[...Xn(e,i,W,c,S,s.semantic!==!1),...F,...W,...K].map(g=>({...g,queryPathMatches:mt(g)})).sort((g,B)=>Z(g,B,S)),k=t?L:ut(L,o,S),p=a.filter(g=>S.has(g)),w=a.filter(g=>!S.has(g)),ee=Math.max(0,f.length-x),fe=Math.max(0,L.length-k.length)+ee,hn=t?f.length:Math.min(f.length,o+He);return{query:n,queryPathFragments:r,normalizedTerms:a,matchedTerms:p,unmatchedTerms:w,groups:k,candidateRoots:f,candidateRootCount:f.length,analyzedRootCount:x,omittedRootCount:ee,omittedGroupCount:fe,scannedFiles:u.files.length,scannedBytes:u.scannedBytes,recoveryCommand:fe===0?null:`codebaseiq anchors ${Ce(n)}${s.scope?` --scope ${Ce(s.scope)}`:""} --limit ${hn}`}}function xn(e){let n=le(e).filter(s=>!Pe.has(s.toLocaleLowerCase())).map(ve).filter(s=>s.length>=3&&!Pe.has(s));return[...new Set(n)]}function Qe(e,n,s){let a=T(n.leaf),r=T(n.relativePath),o=T(n.documentation??"");for(let i of s)a.has(i)&&de(e,n,i,"symbol"),r.has(i)&&de(e,n,i,"path"),o.has(i)&&de(e,n,i,"documentation");let t=e.get(n.symbol);t&&(t.symbolPhraseLength=bt(n.leaf,s))}function de(e,n,s,a,r,o){let t=e.get(n.symbol)??{definition:n,matches:new Map,symbolPhraseLength:0},i=t.matches.get(s)??{sources:new Set,locations:new Map};i.sources.add(a),r!==void 0&&o!==void 0&&i.locations.set(`${r}\0${o}`,{file:r,line:o}),t.matches.set(s,i),e.set(n.symbol,t)}function Ve(e){let n=new Map;for(let s of e.values())for(let a of s.matches.keys())n.set(a,(n.get(a)??0)+1);return n}function Pn(e,n,s,a){let r=n[0]?.documentId;if(r===void 0||n.find(i=>i.isFunctionLike&&i.leaf===s.name&&i.startLine===s.startLine&&i.endLine===s.endLine))return null;let t=a();return{documentId:r,symbolId:t,symbol:`${Ne}${e}:${s.startLine}:${s.endLine}:${s.name}`,relativePath:e,startLine:s.startLine,startChar:0,endLine:s.endLine,endChar:0,leaf:s.name,parentTypeName:null,isFunctionLike:!0,isTypeLike:!1,kind:null,documentation:null,enclosingSymbol:null}}function In(e,n,s){let a=new Set(n.slice(0,Cn).map(t=>t.file)),r=new Set(s),o=e.map(t=>{let i=T(t.relativePath),d=t.relativePath.slice(t.relativePath.lastIndexOf("/")+1).replace(/\.[^.]+$/u,""),l=T(d),c=[...i].filter(u=>r.has(u)).length,m=[...l].filter(u=>r.has(u)).length;return{file:t,score:m*4+c}}).filter(t=>t.score>0).sort((t,i)=>i.score-t.score||I(z(t.file.relativePath))-I(z(i.file.relativePath))||t.file.relativePath.localeCompare(i.file.relativePath)).slice(0,Rn);for(let t of o)a.add(t.file.relativePath);return e.filter(t=>a.has(t.relativePath))}function En(e,n){return e.filter(s=>s.startLine<=n&&s.endLine>=n).sort((s,a)=>s.endLine-s.startLine-(a.endLine-a.startLine)||s.startLine-a.startLine)[0]}function Fn(e){let n=new Map;for(let s of e){if(!G(s))continue;let a=`${s.relativePath}\0${$(s.leaf)}`,r=n.get(a)??[];r.push(s),n.set(a,r)}return n}function Ze(e,n){return e.filter(s=>s.startLine<=n&&s.endLine>=n).sort((s,a)=>s.endLine-s.startLine-(a.endLine-a.startLine)||Number(G(a))-Number(G(s))||s.startLine-a.startLine||s.symbol.localeCompare(a.symbol))[0]}function G(e){return e.symbol.startsWith(Ne)}function U(e){return G(e)?e.leaf:te(e.symbol)}function Ae(e,n,s=[]){let a=e.definition,r=[...e.matches.entries()].map(([l,c])=>({term:l,sources:[...c.sources].sort(gt),locations:[...c.locations.values()].sort(un).slice(0,3)})).sort((l,c)=>l.term.localeCompare(c.term)),o=r.filter(l=>l.sources.some(c=>c!=="source")).map(l=>l.term),t=r.filter(l=>l.sources.includes("symbol")).map(l=>l.term),i=r.reduce((l,c)=>l+1/Math.max(1,n.get(c.term)??1),0),d=r.filter(l=>l.sources.includes("symbol")).reduce((l,c)=>l+1/Math.max(1,n.get(c.term)??1),0);return{symbol:a.symbol,label:U(a),leaf:a.leaf,file:a.relativePath,line:a.startLine,endLine:a.endLine,kind:a.isFunctionLike?"callable":a.isTypeLike?"type":"symbol",fileKind:z(a.relativePath),matches:r,focusLocations:At(e,n),matchedTerms:r.map(l=>l.term),symbolMatchedTerms:t,symbolPhraseLength:e.symbolPhraseLength,identityMatchedTerms:o,rarity:i,symbolRarity:d,queryPathMatches:pt(a.relativePath,s),...e.sourceCharacters===void 0?{}:{sourceCharacters:e.sourceCharacters}}}function kn(e,n,s,a,r,o,t,i){let d=a.filter(b=>!G(b)),l=n.calleeMap(d,{additive:!1,semantic:i}),c=new Map,m=new Map;for(let b of s){let v=r.get(b.symbol),S=v?G(v)?Je(e,v,r,o,1):Me(e,v,l.get(v.symbolId)??[],r,1,t):[];c.set(b.symbol,S);for(let M of S){let f=r.get(M.toSymbol);f?.isFunctionLike&&(!v||!G(v)||G(f))&&m.set(f.symbol,f)}}let u=[...m.values()],h=n.calleeMap(u.filter(b=>!G(b)),{additive:!1,semantic:i}),y=new Map;for(let b of u)y.set(b.symbol,G(b)?Je(e,b,r,o,2):Me(e,b,h.get(b.symbolId)??[],r,2,t));return s.map(b=>{let v=c.get(b.symbol)??[],S=v.flatMap(f=>y.get(f.toSymbol)??[]),M=q([...v,...S]);return{root:b,relations:M,nodeSymbols:new Set([b.symbol,...M.flatMap(f=>[f.fromSymbol,f.toSymbol])])}})}function Me(e,n,s,a,r,o=new Set){let t=new Map;for(let i of s){let d=a.get(i.symbol);if(!d?.isFunctionLike||d.symbol===n.symbol||i.source==="ast-callsite"&&!On(e,n,d,i.callsiteLine))continue;let l=t.get(d.symbol);(!l||yt(i,l)<0)&&t.set(d.symbol,i)}return[...t.entries()].map(([i,d])=>{let l=a.get(i);return{kind:"call",fromSymbol:n.symbol,fromLabel:te(n.symbol),fromFile:n.relativePath,toSymbol:l.symbol,toLabel:te(l.symbol),toFile:l.relativePath,depth:r,strength:Oe(d.source),evidence:d.source,callsiteLine:d.callsiteLine??_n(e,n,l)}}).sort((i,d)=>Number(o.has(d.toSymbol))-Number(o.has(i.toSymbol))||X(i,d)).slice(0,bn)}function Je(e,n,s,a,r){let o=Se(e,n.relativePath,n.startLine,n.endLine).targets.flatMap(t=>{let i=s.get(t.definition.symbol)??t.definition;return!i.isFunctionLike||i.symbol===n.symbol?[]:[{kind:"call",fromSymbol:n.symbol,fromLabel:U(n),fromFile:n.relativePath,toSymbol:i.symbol,toLabel:U(i),toFile:i.relativePath,depth:r,strength:"exact",evidence:"scip-occurrence-callsite",callsiteLine:t.sourceLine}]});for(let t of xe(e,n.relativePath,{ranges:[{startLine:n.startLine,endLine:n.endLine}],excludeIndexedTargets:!1}).targets){let i=[...a.get(`${t.targetFile}\0${$(t.calleeLeaf)}`)??[],...ge(e,t.targetFile).filter(d=>d.isFunctionLike&&$(d.leaf)===t.calleeLeaf)].find(d=>d.startLine===t.targetStartLine&&d.endLine===t.targetEndLine);!i||i.symbol===n.symbol||o.push({kind:"call",fromSymbol:n.symbol,fromLabel:U(n),fromFile:n.relativePath,toSymbol:i.symbol,toLabel:U(i),toFile:i.relativePath,depth:r,strength:t.strength==="exact"?"exact":"derived",evidence:"ast-member-import-candidate",callsiteLine:t.line})}for(let t of Q(e,n.relativePath)?.callSites??[]){if(t.line<n.startLine||t.line>n.endLine||t.memberAccess)continue;let i=(a.get(`${n.relativePath}\0${$(t.calleeLeaf)}`)??[]).filter(l=>l.symbol!==n.symbol);if(i.length!==1)continue;let d=i[0];o.push({kind:"call",fromSymbol:n.symbol,fromLabel:U(n),fromFile:n.relativePath,toSymbol:d.symbol,toLabel:U(d),toFile:d.relativePath,depth:r,strength:"derived",evidence:"ast-callsite",callsiteLine:t.line})}return q(o).sort(X)}function _n(e,n,s){let a=$(s.leaf);return Q(e,n.relativePath)?.callSites.find(r=>r.line>=n.startLine&&r.line<=n.endLine&&$(r.calleeLeaf)===a)?.line??null}function On(e,n,s,a){if(a===void 0)return!1;let r=$(s.leaf);return Q(e,n.relativePath)?.callSites.some(o=>o.line===a&&$(o.calleeLeaf)===r)??!1}function $(e){return e.replace(/^#/u,"").replace(/\(\)$/u,"")}function Nn(e,n,s,a,r){let o=new Map(n.map((c,m)=>[c.symbol,m])),t=n.map((c,m)=>m),i=c=>{let m=c;for(;t[m]!==m;)m=t[m];for(;t[c]!==c;){let u=t[c];t[c]=m,c=u}return m},d=(c,m)=>{let u=i(c),h=i(m);u!==h&&(t[h]=u)};for(let c of e){let m=o.get(c.root.symbol);if(m!==void 0)for(let u of c.nodeSymbols){let h=o.get(u);h!==void 0&&d(m,h)}}let l=new Map;for(let c=0;c<n.length;c+=1){let m=i(c),u=l.get(m)??[];u.push(n[c]),l.set(m,u)}return[...l.values()].map((c,m)=>{let u=new Set(c.map(f=>f.symbol)),h=q(e.filter(f=>u.has(f.root.symbol)).flatMap(f=>f.relations)).sort(X),y=new Map(c.map(f=>[f.symbol,f]));for(let f of new Set(h.flatMap(C=>[C.fromSymbol,C.toSymbol]))){let C=s.get(f);if(C)y.has(f)||y.set(f,Ae(C,a));else{let A=r.get(f);A&&y.set(f,mn(A))}}let b=st(c,h,y),v=c.filter(f=>h.some(C=>C.fromSymbol===f.symbol)).length,S=[...new Set(c.flatMap(f=>f.matchedTerms))].sort(),M=rt(h,b,u,y);return{id:`anchor-set:${m+1}:${ue(c[0])}`,kind:"connected-flow",roots:[...c].sort(R),keyAnchors:b,candidateOwnerCount:b.length,omittedCandidateOwners:[],ownerRecoveryCommands:[],upstreamEntries:[],matchedTerms:S,relations:M,relationCount:h.length,orchestrationRootCount:v,omittedRelations:Math.max(0,h.length-J),systemMapCommand:ye(b,h,S)}})}function Gn(e,n,s){let a=new Map(s.map((o,t)=>[o,t])),r=[];for(let o=0;o<e.length;o+=1){let t=e[o],i=en(t);if(i.size!==0)for(let d=o+1;d<e.length;d+=1){let l=e[d],c=en(l),m=[...i].filter(A=>c.has(A));if(m.length===0||![...i].some(A=>!c.has(A))||![...c].some(A=>!i.has(A)))continue;let u=$n(t,l);if(u.length<2)continue;let h=q([...t.relations,...l.relations]).sort(X),y=h.slice(0,J),b=re([...t.roots,...l.roots]).sort(R),v=[...new Set([...t.matchedTerms,...l.matchedTerms])].sort(),S=m.sort((A,x)=>(a.get(A)??Number.MAX_SAFE_INTEGER)-(a.get(x)??Number.MAX_SAFE_INTEGER)||A.localeCompare(x)),M=+(t.relationCount>0)+ +(l.relationCount>0),f=+((t.orchestrationRootCount??0)>0)+ +((l.orchestrationRootCount??0)>0),C=Math.min(...S.map(A=>n.get(A)??Number.MAX_SAFE_INTEGER));r.push({sharedOrder:Math.min(...S.map(A=>a.get(A)??Number.MAX_SAFE_INTEGER)),sharedFrequency:C,connectedSides:M,orchestrationSides:f,group:{id:`parallel-paths:${ue(t.roots[0])}:${ue(l.roots[0])}`,kind:"parallel-paths",roots:b,keyAnchors:u,candidateOwnerCount:u.length,omittedCandidateOwners:[],ownerRecoveryCommands:[],upstreamEntries:[...t.upstreamEntries,...l.upstreamEntries],matchedTerms:v,relations:y,relationCount:h.length,parallelConnectedSides:M,parallelOrchestrationSides:f,parallelSharedPathTerms:S,parallelSharedPathFrequency:C,orchestrationRootCount:(t.orchestrationRootCount??0)+(l.orchestrationRootCount??0),omittedRelations:Math.max(0,h.length-y.length),systemMapCommand:ye(u,h,v)}})}}return r.sort((o,t)=>o.sharedFrequency-t.sharedFrequency||t.orchestrationSides-o.orchestrationSides||t.connectedSides-o.connectedSides||o.sharedOrder-t.sharedOrder||t.group.matchedTerms.length-o.group.matchedTerms.length||Z(o.group,t.group,n)).slice(0,Dn).map(o=>o.group)}function en(e){return new Set(e.roots.flatMap(n=>n.matches.filter(s=>s.sources.includes("path")).map(s=>s.term)))}function $n(e,n){return re([nn(e),nn(n)].filter(s=>s!==void 0))}function nn(e){let n=new Set(e.keyAnchors.map(a=>a.symbol)),s=new Map;for(let a of e.relations)!n.has(a.fromSymbol)||!n.has(a.toSymbol)||s.set(a.fromSymbol,(s.get(a.fromSymbol)??0)+1);return[...e.keyAnchors].sort((a,r)=>+((s.get(r.symbol)??0)>0)-+((s.get(a.symbol)??0)>0)||tn(r)-tn(a)||r.identityMatchedTerms.length-a.identityMatchedTerms.length||r.symbolMatchedTerms.length-a.symbolMatchedTerms.length||(s.get(r.symbol)??0)-(s.get(a.symbol)??0)||R(a,r))[0]}function tn(e){return e.matchedTerms.length+e.identityMatchedTerms.length*2+(e.queryPathMatches?.length??0)*4}function Xn(e,n,s,a,r,o){let t=Be(e);if(!t||t.links.length===0||s.length<2)return[];let i=new Map(t.observations.map(h=>[h.id,h])),d=new Map,l=new Map,c=[...s].sort((h,y)=>Z(h,y,r)).slice(0,vn),m=t.links.filter(h=>h.strength!=="candidate").sort((h,y)=>j(y.strength)-j(h.strength)||y.matchedKeyParts.length-h.matchedKeyParts.length||h.id.localeCompare(y.id));for(let h of c)for(let y of m){let b=i.get(y.from),v=i.get(y.to);if(!b||!v||!Kn(h,b,a))continue;let S=qn(h,b,a);if(!S)continue;let M=d.get(v.id)??zn(e,n,v,a,o,Mn);if(d.set(v.id,M),M.reachedSymbols.size===0)continue;let f=s.filter(L=>L.id!==h.id&&Wn(L).some(k=>M.reachedSymbols.has(k))&&Fe(S,L)>=2).sort((L,k)=>Fe(S,k)-Fe(S,L)||Z(L,k,r)).slice(0,An);if(f.length===0)continue;let C=[h.id,b.id,...f.map(L=>L.id).sort()].join("\0");if(l.has(C))continue;let A=new Set(f.flatMap(he)),x=Qn(me(v),A,M.relations);if(x.length===0)continue;let P=Yn(b,v,y.joinRule,y.matchedKeyParts,y.strength),H=q([P,...M.relations,...h.relations,...f.flatMap(L=>L.relations)]),E=Vn([P,...x],H,h,f),W=re([S,...f.flatMap(L=>L.roots)]).sort(R),F=re([S,...f.flatMap(L=>L.keyAnchors)]).slice(0,Ln),K=[...new Set([...S.matchedTerms,...f.flatMap(L=>L.matchedTerms)])].sort(),ie=Bn(e,n,S,a,o);W.length===0||F.length<2||l.set(C,{id:`cross-boundary-set:${ue(S)}:${l.size+1}`,kind:"cross-boundary-flow",roots:W,keyAnchors:F,candidateOwnerCount:F.length,omittedCandidateOwners:[],ownerRecoveryCommands:[],upstreamEntries:ie,matchedTerms:K,relations:E,relationCount:H.length,omittedRelations:Math.max(0,H.length-E.length),systemMapCommand:ye(F,H,K)})}let u=new Map;for(let[h,y]of l){let b=h.slice(0,h.indexOf("\0")),v=u.get(b);(!v||Z(y,v,r)<0)&&u.set(b,y)}return[...u.values()]}function Kn(e,n,s){let a=new Set(he(e));return n.owner.symbol&&a.has(n.owner.symbol)?!0:[...a].map(r=>s.get(r)).some(r=>r?.relativePath===n.source.file&&r.startLine<=n.source.startLine&&r.endLine>=n.source.endLine)}function qn(e,n,s){let a=re([...e.roots,...e.keyAnchors]);if(n.owner.symbol){let r=a.find(o=>o.symbol===n.owner.symbol);if(r)return r}return a.find(r=>{let o=s.get(r.symbol);return o?.relativePath===n.source.file&&o.startLine<=n.source.startLine&&o.endLine>=n.source.endLine})??null}function he(e){return[...new Set([...e.roots.map(n=>n.symbol),...e.keyAnchors.map(n=>n.symbol),...e.relations.flatMap(n=>[n.fromSymbol,n.toSymbol])])]}function Wn(e){return[...new Set([...e.roots,...e.keyAnchors].map(n=>n.symbol))]}function Fe(e,n){let s=T(e.leaf),a=[...n.roots,...n.keyAnchors].map(o=>T(o.leaf)),r=0;for(let o of a){let t=0;for(let i of s)o.has(i)&&(t+=1);r=Math.max(r,t)}return r}function Bn(e,n,s,a,r){let o=a.get(s.symbol);if(!o?.isFunctionLike)return[];let t=n.callerFileMap([o],{semantic:r,sourceFallback:!0}).get(o.symbolId);if(!t)return[];let i=T(s.leaf);return[...t].filter(d=>d!==s.file&&z(d)!=="test").flatMap(d=>{let l=Q(e,d);return(l?.callSites??[]).filter(c=>$(c.calleeLeaf)===$(s.leaf)).flatMap(c=>{let m=(l?.callables??[]).filter(h=>h.startLine<=c.line&&h.endLine>=c.line).sort((h,y)=>h.endLine-h.startLine-(y.endLine-y.startLine)||h.startLine-y.startLine)[0];if(!m)return[];let u=[...T(m.name)].filter(h=>i.has(h)).length;return u>=2?[{name:m.name,file:d,line:m.startLine,endLine:m.endLine,callsiteLine:c.line,overlap:u}]:[]})}).sort((d,l)=>l.overlap-d.overlap||d.file.localeCompare(l.file)||d.line-l.line).slice(0,1).map(({name:d,file:l,line:c,endLine:m,callsiteLine:u})=>({name:d,file:l,line:c,endLine:m,callsiteLine:u}))}function zn(e,n,s,a,r,o){let t=Un(e,s,a),i=t.map(({definition:u,evidence:h,line:y})=>({kind:"call",fromSymbol:me(s),fromLabel:Le(s),fromFile:s.source.file,toSymbol:u.symbol,toLabel:te(u.symbol),toFile:u.relativePath,depth:1,strength:h==="scip-occurrence-callsite"?"exact":"derived",evidence:h,callsiteLine:y})),d=jn(e,s);i.push(...d.relations);let l=dn([...t.map(u=>u.definition),...d.definitions]),c=l,m=new Set(c.map(u=>u.symbol));for(let u=2;u<=o+1&&c.length>0;u+=1){let h=n.calleeMap(c,{additive:!1,semantic:r}),y=new Map;for(let b of c){let v=Me(e,b,h.get(b.symbolId)??[],a,u);i.push(...v);for(let S of v){let M=a.get(S.toSymbol);M?.isFunctionLike&&!m.has(M.symbol)&&y.set(M.symbol,M)}}c=[...y.values()];for(let b of c)m.add(b.symbol)}return{entryDefinitions:l,relations:q(i),reachedSymbols:new Set([...l.map(u=>u.symbol),...i.flatMap(u=>[u.fromSymbol,u.toSymbol])])}}function Un(e,n,s){let a=n.owner.symbol?s.get(n.owner.symbol):void 0;if(a?.isFunctionLike&&!oe(a.symbol))return[{definition:a,evidence:"scip-occurrence-callsite",line:n.source.startLine}];let r=we(e,n.source.file),o=Te(e,n.source.file,0,Math.max(0,r.length-1),[n.source.startLine]),t=Se(e,n.source.file,o.startLine,o.endLine).targets.map(c=>({definition:c.definition,evidence:"scip-occurrence-callsite",line:c.sourceLine})),i=Q(e,n.source.file),d=qe(e),l=(i?.callSites??[]).flatMap(c=>{if(c.line<o.startLine||c.line>o.endLine)return[];let m=Xe(n.source.file,d.get(c.calleeLeaf)??[]),u=Ke(e,n.source.file,m,c.memberAccess,c.calleeQualifier),h=u?s.get(u.symbol):void 0;return h?.isFunctionLike?[{definition:h,evidence:"ast-callsite",line:c.line}]:[]});return Hn([...t,...l])}function jn(e,n){let s=we(e,n.source.file),a=Te(e,n.source.file,0,Math.max(0,s.length-1),[n.source.startLine]),r=xe(e,n.source.file,{ranges:[a],excludeIndexedTargets:!1}).targets,o=[],t=[];for(let i of r){let d=`source-construct:${i.targetFile}:${i.targetStartLine}:${i.targetEndLine}:${i.calleeLeaf}`;t.push({kind:"call",fromSymbol:me(n),fromLabel:Le(n),fromFile:n.source.file,toSymbol:d,toLabel:i.calleeLeaf,toFile:i.targetFile,depth:1,strength:"derived",evidence:"ast-member-import-candidate",callsiteLine:i.line});let l=Se(e,i.targetFile,i.targetStartLine,i.targetEndLine).targets;for(let c of l)o.push(c.definition),t.push({kind:"call",fromSymbol:d,fromLabel:i.calleeLeaf,fromFile:i.targetFile,toSymbol:c.definition.symbol,toLabel:te(c.definition.symbol),toFile:c.definition.relativePath,depth:2,strength:"exact",evidence:"scip-occurrence-callsite",callsiteLine:c.sourceLine})}return{definitions:dn(o),relations:q(t)}}function Hn(e){return[...new Map(e.map(n=>[n.definition.symbol,n])).values()]}function dn(e){return[...new Map(e.map(n=>[n.symbol,n])).values()]}function me(e){return e.owner.symbol??e.id}function Le(e){return e.owner.name??`${e.source.file}:${e.source.startLine+1}`}function Yn(e,n,s,a,r){return{kind:"runtime-boundary",fromSymbol:me(e),fromLabel:Le(e),fromFile:e.source.file,toSymbol:me(n),toLabel:Le(n),toFile:n.source.file,depth:1,strength:r,evidence:`runtime-boundary:${s}`,callsiteLine:e.source.startLine,runtimeBoundaryKey:a.map(o=>`${o.name}=${o.value}`).join(" ")}}function Qn(e,n,s){let a=new Map;for(let t of s){let i=a.get(t.fromSymbol)??[];i.push(t),a.set(t.fromSymbol,i)}let r=[{symbol:e,path:[]}],o=new Set([e]);for(;r.length>0;){let t=r.shift();if(t.path.length>0&&n.has(t.symbol))return t.path;for(let i of(a.get(t.symbol)??[]).sort(X))o.has(i.toSymbol)||(o.add(i.toSymbol),r.push({symbol:i.toSymbol,path:[...t.path,i]}))}return[]}function Vn(e,n,s,a){let r=q(e),o=new Set([s,...a].flatMap(t=>[...he(t),...t.keyAnchors.map(i=>i.symbol)]));for(let t of n){if(r.length>=J)break;!o.has(t.fromSymbol)&&!o.has(t.toSymbol)||r.some(i=>i.fromSymbol===t.fromSymbol&&i.toSymbol===t.toSymbol)||r.push(t)}return r.slice(0,J)}function Zn(e,n,s,a,r,o,t,i){let d=s.filter(c=>!c.root.symbol.startsWith(Ne)).map(c=>({root:c.root,relations:c.relations.filter(m=>m.depth===1&&m.fromSymbol===c.root.symbol)}));return Jn(d).flatMap((c,m)=>{let u=new Set(c.map(p=>p.root.symbol)),h=new Map;for(let p of c)for(let w of new Set(p.relations.map(ee=>ee.toSymbol)))h.set(w,(h.get(w)??0)+1);let y=[...h].filter(([,p])=>p>=2).sort(([p,w],[ee,fe])=>fe-w||et(p,ee,a,r,t)).map(([p])=>t.get(p)).filter(p=>p?.isFunctionLike===!0).slice(0,gn);if(y.length===0)return[];let b=n.callerFileMap(y,{semantic:i,sourceFallback:!0}),v=new Set;for(let p of y){v.add(p.relativePath);for(let w of b.get(p.symbolId)??[])v.add(w)}let S=o.filter(p=>p.isFunctionLike&&v.has(p.relativePath)).sort(nt).slice(0,Sn),M=n.calleeMap(S,{additive:!1,semantic:i}),f=new Set(y.map(p=>p.symbol)),C=q(S.flatMap(p=>Me(e,p,M.get(p.symbolId)??[],t,1,f).filter(w=>f.has(w.toSymbol)))),A=new Map;for(let p of C){let w=A.get(p.fromSymbol)??new Set;w.add(p.toSymbol),A.set(p.fromSymbol,w)}let x=new Set([...A].filter(([p,w])=>w.size>=2||u.has(p)).map(([p])=>p)),P=C.filter(p=>x.has(p.fromSymbol));if(x.size<2||P.length===0)return[];let E=[...new Set(P.map(p=>p.toSymbol))].map(p=>De(p,a,r,t)).filter(p=>p!==null).sort(R),W=[...x].map(p=>De(p,a,r,t)).filter(p=>p!==null),F=tt(W,P),K=F.slice(0,Ee),ie=F.slice(Ee);if(E.length===0||K.length===0)return[];let L=[...new Set([...E.flatMap(p=>p.matchedTerms),...c.flatMap(p=>p.root.matchedTerms)])].sort(),k=ot(P,K);return[{id:`effect-owner-set:${m+1}:${ue(E[0])}`,kind:"shared-callee-owners",roots:E,keyAnchors:K,candidateOwnerCount:F.length,omittedCandidateOwners:ie,ownerRecoveryCommands:Mt(ie,Ee),upstreamEntries:[],matchedTerms:L,relations:k,relationCount:P.length,omittedRelations:Math.max(0,P.length-k.length),systemMapCommand:ye(K,P,L)}]})}function Jn(e){let n=e.map((t,i)=>i),s=t=>{for(;n[t]!==t;)n[t]=n[n[t]],t=n[t];return t},a=(t,i)=>{let d=s(t),l=s(i);d!==l&&(n[l]=d)},r=e.map(t=>new Set(t.relations.map(i=>i.toSymbol)));for(let t=0;t<e.length;t+=1)for(let i=t+1;i<e.length;i+=1){let d=0;for(let l of r[t]??[])if((r[i]??new Set).has(l)&&(d+=1),d>=2)break;d>=2&&a(t,i)}let o=new Map;for(let t=0;t<e.length;t+=1){let i=s(t),d=o.get(i)??[];d.push(e[t]),o.set(i,d)}return[...o.values()].filter(t=>t.length>=2)}function et(e,n,s,a,r){let o=De(e,s,a,r),t=De(n,s,a,r);return o?t?R(o,t):-1:t?1:e.localeCompare(n)}function nt(e,n){return I(z(e.relativePath))-I(z(n.relativePath))||e.relativePath.localeCompare(n.relativePath)||e.startLine-n.startLine}function De(e,n,s,a){let r=n.get(e);if(r)return Ae(r,s);let o=a.get(e);return o?mn(o):null}function tt(e,n){let s=new Map;for(let r of n){let o=s.get(r.toSymbol)??new Set;o.add(r.fromSymbol),s.set(r.toSymbol,o)}let a=new Map;for(let r of n){let o=s.get(r.toSymbol)?.size??1;a.set(r.fromSymbol,(a.get(r.fromSymbol)??0)+o*o)}return[...e].sort((r,o)=>Number(r.leaf.startsWith("#"))-Number(o.leaf.startsWith("#"))||o.identityMatchedTerms.length-r.identityMatchedTerms.length||(a.get(o.symbol)??0)-(a.get(r.symbol)??0)||R(r,o))}function ot(e,n){let s=new Map(n.map((t,i)=>[t.symbol,i])),a=n.map(t=>e.filter(i=>i.fromSymbol===t.symbol).sort(X)),r=[],o=0;for(;r.length<J&&a.some(t=>o<t.length);){for(let t of a){let i=t[o];if(i&&r.push(i),r.length>=J)break}o+=1}return r.sort((t,i)=>s.get(t.fromSymbol)-s.get(i.fromSymbol)||X(t,i))}function rt(e,n,s,a){let r=new Map(n.map((i,d)=>[i.symbol,d])),o=new Map;for(let i of e)o.set(i.fromSymbol,(o.get(i.fromSymbol)??0)+1);return[...e].sort((i,d)=>{let l=c=>{let m=0;return r.has(c.fromSymbol)&&(m+=100),s.has(c.toSymbol)&&(m+=60),m+=Math.min(40,(o.get(c.toSymbol)??0)*8),(a.get(c.toSymbol)?.matchedTerms.length??0)>0&&(m+=25),c.fromFile!==c.toFile&&(m+=15),c.strength==="exact"&&(m+=5),m};return l(d)-l(i)||X(i,d)}).slice(0,J).sort((i,d)=>(r.get(i.fromSymbol)??V)-(r.get(d.fromSymbol)??V)||i.depth-d.depth||(i.callsiteLine??Number.MAX_SAFE_INTEGER)-(d.callsiteLine??Number.MAX_SAFE_INTEGER)||X(i,d))}function mn(e){return{symbol:e.symbol,label:U(e),leaf:e.leaf,file:e.relativePath,line:e.startLine,endLine:e.endLine,kind:e.isFunctionLike?"callable":e.isTypeLike?"type":"symbol",fileKind:z(e.relativePath),matches:[],focusLocations:[],matchedTerms:[],symbolMatchedTerms:[],symbolPhraseLength:0,identityMatchedTerms:[],rarity:0,symbolRarity:0}}function st(e,n,s){let a=[...e].sort(R),r=[],o=new Map;for(let c of n)o.set(c.fromSymbol,(o.get(c.fromSymbol)??0)+1);let t=new Set,i=new Set,d=c=>{if(!(!c||r.some(m=>m.symbol===c.symbol))){r.push(c);for(let m of c.matchedTerms)t.add(m);for(let m of c.symbolMatchedTerms)i.add(m)}},l=a.filter(c=>c.symbolPhraseLength>=2&&(o.get(c.symbol)??0)>=2);for(;r.length<Math.min(2,V);){let c=l.filter(m=>!r.some(u=>u.symbol===m.symbol)).sort((m,u)=>u.symbolMatchedTerms.filter(h=>!i.has(h)).length-m.symbolMatchedTerms.filter(h=>!i.has(h)).length||u.symbolPhraseLength-m.symbolPhraseLength||(o.get(u.symbol)??0)-(o.get(m.symbol)??0)||ke(m,u))[0];if(!c||r.length>0&&c.symbolMatchedTerms.every(m=>i.has(m)))break;d(c)}if(d(a[0]),r.length>=2){let c=it(r[0].symbol,r[1].symbol,n,s);for(let m of c?.slice(1,-1)??[]){if(r.length>=V)break;d(s.get(m))}if(r.length<V){let m=new Set(r.map(y=>y.symbol)),u=new Set(n.filter(y=>y.depth===1&&m.has(y.fromSymbol)&&m.has(y.toSymbol)).map(y=>y.fromSymbol)),h=n.filter(y=>y.depth===1&&u.has(y.fromSymbol)&&!m.has(y.toSymbol)).map(y=>({relation:y,candidate:s.get(y.toSymbol)})).filter(y=>y.candidate!==void 0&&y.candidate.symbolPhraseLength>=2&&y.candidate.symbolMatchedTerms.length>=2).sort((y,b)=>(o.get(y.relation.fromSymbol)??0)-(o.get(b.relation.fromSymbol)??0)||ke(y.candidate,b.candidate))[0]?.candidate;d(h)}}else for(;r.length<Math.min(3,V);){let c=a.filter(m=>!r.some(u=>u.symbol===m.symbol)).sort((m,u)=>u.matchedTerms.filter(h=>!t.has(h)).length-m.matchedTerms.filter(h=>!t.has(h)).length||R(m,u))[0];if(!c||c.matchedTerms.every(m=>t.has(m)))break;d(c)}for(;r.length>=2&&r.length<V;){let c=new Set(r.map(u=>u.symbol)),m=[...s.values()].filter(u=>!c.has(u.symbol)&&(o.get(u.symbol)??0)>0&&n.some(h=>c.has(h.fromSymbol)&&h.toSymbol===u.symbol)).sort((u,h)=>h.identityMatchedTerms.length-u.identityMatchedTerms.length||h.symbolMatchedTerms.length-u.symbolMatchedTerms.length||h.matchedTerms.length-u.matchedTerms.length||(o.get(h.symbol)??0)-(o.get(u.symbol)??0)||R(u,h))[0];if(!m)break;d(m)}if(r.length<2){let c=r[0],m=c?a.filter(u=>u.symbol!==c.symbol).map(u=>({root:u,path:at(u.symbol,c.symbol,n)})).filter(u=>u.path!==null).sort((u,h)=>+(h.root.file!==c.file)-+(u.root.file!==c.file)||u.path.length-h.path.length||R(u.root,h.root))[0]?.root:void 0;d(m)}return r}function it(e,n,s,a){let r=new Map;for(let i of s){let d=r.get(i.fromSymbol)??new Set;d.add(i.toSymbol),r.set(i.fromSymbol,d);let l=r.get(i.toSymbol)??new Set;l.add(i.fromSymbol),r.set(i.toSymbol,l)}let o=[{path:[e],cost:0}],t=new Map([[e,0]]);for(;o.length>0;){o.sort((c,m)=>c.cost-m.cost||c.path.length-m.path.length);let{path:i,cost:d}=o.shift(),l=i.at(-1);if(l===n)return i;for(let c of r.get(l)??[]){let m=a.get(c),u=c===n?1:!m||m.matchedTerms.length===0?9:m.symbolPhraseLength>=2?1:m.identityMatchedTerms.length>=2?2:4,h=d+u;h>=(t.get(c)??Number.POSITIVE_INFINITY)||(t.set(c,h),o.push({path:[...i,c],cost:h}))}}return null}function at(e,n,s){let a=new Map;for(let t of s){let i=a.get(t.fromSymbol)??[];i.push(t.toSymbol),a.set(t.fromSymbol,i)}let r=[[e]],o=new Set([e]);for(;r.length>0;){let t=r.shift(),i=t.at(-1);if(i===n)return t;for(let d of a.get(i)??[])o.has(d)||(o.add(d),r.push([...t,d]))}return null}function R(e,n){return(n.queryPathMatches?.length??0)-(e.queryPathMatches?.length??0)||n.identityMatchedTerms.length-e.identityMatchedTerms.length||n.matchedTerms.length-e.matchedTerms.length||n.rarity-e.rarity||se(e.kind)-se(n.kind)||I(e.fileKind)-I(n.fileKind)||e.file.localeCompare(n.file)||e.line-n.line}function ke(e,n){return n.symbolPhraseLength-e.symbolPhraseLength||n.symbolMatchedTerms.length-e.symbolMatchedTerms.length||se(e.kind)-se(n.kind)||n.symbolRarity-e.symbolRarity||R(e,n)}function ct(e,n){return n.flatMap(s=>{let a=e.filter(t=>t.matchedTerms.includes(s)).sort((t,i)=>dt(t,i,s)),r=[],o=new Set;for(let t of a)if(!o.has(t.file)&&(r.push(t),o.add(t.file),r.length>=Ye))return r;for(let t of a)if(!r.some(i=>i.symbol===t.symbol)&&(r.push(t),r.length>=Ye))break;return r})}function lt(e,n,s){let a=new Set(n),r=new Map;for(let o of e){if(o.kind!=="callable")continue;let t=o.file.slice(o.file.lastIndexOf("/")+1).replace(/\.[^.]+$/u,"");if(![...T(t)].some(d=>a.has(d)))continue;let i=r.get(o.file)??[];i.push(o),r.set(o.file,i)}return[...r.entries()].map(([o,t])=>{let i=o.slice(o.lastIndexOf("/")+1).replace(/\.[^.]+$/u,""),d=[...T(i)].filter(l=>a.has(l));return{file:o,fileCandidates:t,sharedFrequency:Math.min(...d.map(l=>s.get(l)??Number.MAX_SAFE_INTEGER))}}).sort((o,t)=>I(o.fileCandidates[0].fileKind)-I(t.fileCandidates[0].fileKind)||o.sharedFrequency-t.sharedFrequency||o.file.localeCompare(t.file)).flatMap(({fileCandidates:o})=>[...o].sort(R).slice(0,Tn)).slice(0,wn)}function dt(e,n,s){return on(e,s)-on(n,s)||I(e.fileKind)-I(n.fileKind)||n.symbolPhraseLength-e.symbolPhraseLength||se(e.kind)-se(n.kind)||R(e,n)}function on(e,n){let s=e.matches.find(a=>a.term===n)?.sources??[];return Math.min(...s.map(_e),Number.MAX_SAFE_INTEGER)}function re(e){return[...new Map(e.map(n=>[n.symbol,n])).values()]}function Z(e,n,s){let a=new Set(e.roots.flatMap(o=>o.symbolMatchedTerms)),r=new Set(n.roots.flatMap(o=>o.symbolMatchedTerms));return(n.queryPathMatches?.length??0)-(e.queryPathMatches?.length??0)||cn(e.kind)-cn(n.kind)||sn(e)-sn(n)||an(e)-an(n)||(e.kind==="parallel-paths"&&n.kind==="parallel-paths"?(e.parallelSharedPathFrequency??Number.MAX_SAFE_INTEGER)-(n.parallelSharedPathFrequency??Number.MAX_SAFE_INTEGER)||(n.parallelOrchestrationSides??0)-(e.parallelOrchestrationSides??0)||(n.parallelSharedPathTerms?.length??0)-(e.parallelSharedPathTerms?.length??0):0)||rn(n,s)-rn(e,s)||n.matchedTerms.length-e.matchedTerms.length||Math.max(...n.roots.map(o=>o.symbolPhraseLength))-Math.max(...e.roots.map(o=>o.symbolPhraseLength))||r.size-a.size||R(e.roots[0],n.roots[0])||n.roots.length-e.roots.length||e.relationCount-n.relationCount||e.id.localeCompare(n.id)}function rn(e,n){return e.matchedTerms.reduce((s,a)=>s+1/Math.max(1,n.get(a)??1),0)}function mt(e){return[...new Set(e.roots.flatMap(n=>n.queryPathMatches??[]))].sort()}function sn(e){let n=e.keyAnchors.length>0?e.keyAnchors:e.roots;return Math.max(...n.map(s=>I(s.fileKind)))}function an(e){return e.kind==="parallel-paths"?2-(e.parallelConnectedSides??0):e.kind!=="connected-flow"||e.relationCount>0?0:1}function ut(e,n,s){let a=e.slice(0,n);if(n<2||a.some(o=>o.kind==="shared-callee-owners"))return a;let r=e.filter(o=>o.kind==="shared-callee-owners");for(let o of a){if(o.kind==="shared-callee-owners"||o.kind==="parallel-paths")continue;let t=new Set(he(o)),i=r.map(l=>({group:l,overlap:ht(l,t)})).filter(({overlap:l})=>l>0).sort(({group:l,overlap:c},{group:m,overlap:u})=>u-c||Z(l,m,s))[0]?.group;if(!i)continue;let d=a.length-1;for(;d>=0&&a[d]===o;)d-=1;return d<0?a:(a[d]=i,[...a].sort((l,c)=>Z(l,c,s)))}return a}function ht(e,n){return he(e).filter(s=>n.has(s)).length}function cn(e){switch(e){case"cross-boundary-flow":return 0;case"parallel-paths":case"connected-flow":return 1;case"shared-callee-owners":return 2}}function X(e,n){return e.depth-n.depth||j(n.strength)-j(e.strength)||e.fromLabel.localeCompare(n.fromLabel)||e.toLabel.localeCompare(n.toLabel)||(e.callsiteLine??Number.MAX_SAFE_INTEGER)-(n.callsiteLine??Number.MAX_SAFE_INTEGER)}function yt(e,n){return j(Oe(n.source))-j(Oe(e.source))||(e.callsiteLine??Number.MAX_SAFE_INTEGER)-(n.callsiteLine??Number.MAX_SAFE_INTEGER)||e.symbol.localeCompare(n.symbol)}function q(e){let n=new Map;for(let s of e){let a=`${s.fromSymbol}\0${s.toSymbol}`,r=n.get(a);(!r||X(s,r)<0)&&n.set(a,s)}return[...n.values()]}function ft(e){let n=e.match(/[\p{L}\d_.-]+(?:\/[\p{L}\d_.-]+)+/gu)??[];return[...new Set(n.map(s=>s.replace(/[.;:!?]+$/gu,"").toLocaleLowerCase()))]}function pt(e,n){let s=e.replace(/\\/gu,"/").toLocaleLowerCase();return n.filter(a=>{let r=s.indexOf(a);if(r<0)return!1;let o=r===0?"/":s[r-1],t=s[r+a.length];return o==="/"&&(t===void 0||t==="/")})}function bt(e,n){let s=le(e).map(ve),a=0;for(let r=0;r<s.length;r+=1)for(let o=0;o<n.length;o+=1){let t=0;for(;r+t<s.length&&o+t<n.length&&s[r+t]===n[o+t];)t+=1;a=Math.max(a,t)}return a}function ln(e){if(e.length===0)return[];let n=e.split(`
|
|
3
3
|
`);return e.endsWith(`
|
|
4
4
|
`)&&n.pop(),n}function gt(e,n){return _e(e)-_e(n)}function _e(e){switch(e){case"symbol":return 0;case"path":return 1;case"documentation":return 2;case"source":return 3}}function se(e){return e==="callable"?0:e==="type"?1:2}function I(e){switch(e){case"entry":case"source":case"worker":return 0;case"barrel":return 1;case"test":return 2}}function Oe(e){return e==="semantic-callee"||e==="scip-chunk"?"exact":"derived"}function j(e){return e==="exact"?2:1}function un(e,n){return e.file.localeCompare(n.file)||e.line-n.line}function ue(e){return`${e.file}:${e.line+1}`}function ye(e,n=[],s=[]){let a=e.map(t=>`--symbol ${Ce(`${t.file}:${t.line+1}-${t.endLine+1}`)}`),r=new Set(e.map(t=>t.symbol)),o=e.flatMap(t=>(t.sourceCharacters??0)>Ue?St(t,n,s,r).map(i=>`--focus-at ${Ce(`${i.file}:${i.line+1}`)}`):[]);return`codebaseiq system-map ${[...a,...o,"--relation call","--relation runtime-boundary"].join(" ")}`}function St(e,n,s,a){let r=new Set(s),o=n.filter(l=>l.fromSymbol===e.symbol&&l.callsiteLine!==null&&l.callsiteLine>=e.line&&l.callsiteLine<=e.endLine).map(l=>({file:e.file,line:l.callsiteLine,connectsAnchor:a.has(l.toSymbol),overlap:new Set(le(vt(l.toLabel)).flatMap(Ie).filter(c=>r.has(c))).size,strength:l.strength})).filter(l=>l.overlap>0).sort((l,c)=>Number(c.connectsAnchor)-Number(l.connectsAnchor)||c.overlap-l.overlap||l.line-c.line||j(c.strength)-j(l.strength)),t=o.filter(l=>l.connectsAnchor),i=[...t.length>0?t:o,...t.length>0?[]:e.focusLocations.map(l=>({...l,connectsAnchor:!1,overlap:0,strength:"derived"}))],d=[];for(let l of i)if(!d.some(c=>c.file===l.file&&c.line===l.line)&&(d.push({file:l.file,line:l.line}),d.length>=3))break;return d}function vt(e){return e.slice(Math.max(e.lastIndexOf(":"),e.lastIndexOf("."))+1)}function At(e,n){let s=new Map;for(let[o,t]of e.matches)for(let i of t.locations.values()){if(i.file!==e.definition.relativePath||i.line<e.definition.startLine||i.line>e.definition.endLine)continue;let d=`${i.file}\0${i.line}`,l=s.get(d)??{...i,matchedTerms:new Set};l.matchedTerms.add(o),s.set(d,l)}let a=[...s.values()].sort((o,t)=>t.matchedTerms.size-o.matchedTerms.size||[...t.matchedTerms].reduce((i,d)=>i+1/Math.max(1,n.get(d)??1),0)-[...o.matchedTerms].reduce((i,d)=>i+1/Math.max(1,n.get(d)??1),0)||un(o,t)),r=[];for(let o of a)if(!r.some(t=>t.file===o.file&&Math.abs(t.line-o.line)<8)&&(r.push(o),r.length>=3))break;return r.map(o=>({file:o.file,line:o.line,matchedTerms:[...o.matchedTerms].sort()}))}function Mt(e,n){let s=[];for(let a=0;a<e.length;a+=n)s.push(ye(e.slice(a,a+n)));return s}function Ce(e){return`'${e.replaceAll("'",`'"'"'`)}'`}export{$t as a,xn as b};
|
|
5
|
-
//# sourceMappingURL=chunk-
|
|
5
|
+
//# sourceMappingURL=chunk-E3R6TJ5T.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{f as m,r as h,s as y}from"./chunk-JG5OWAEB.js";import{l as d,r as p,xa as g}from"./chunk-AZDY3EKD.js";import{j as l,s as f}from"./chunk-KPMMOAV5.js";import{statSync as A}from"fs";import{join as O,resolve as T}from"path";import{createHash as C,randomUUID as N}from"crypto";import{mkdirSync as H,realpathSync as x,renameSync as M,unlinkSync as V,writeFileSync as U}from"fs";import{homedir as w,tmpdir as K,userInfo as F}from"os";import{dirname as Y,join as a}from"path";var G=1*1024*1024,Q=4*1024*1024;function S(e=process.env){return a(e.XDG_CACHE_HOME||a(w(),".cache"),"codebaseiq")}function E(e){let r=x.native(e).replaceAll("\\","/");return process.platform==="win32"&&(r=r.toLowerCase()),C("sha256").update(r).digest("hex").slice(0,16)}var P=16,X=P+5;function k(e,r){return a(e,"sentinel","registry",`${r}.json`)}function R(e,r){try{let t=JSON.parse(f(k(e,r),"sentinel registry record")),{pid:n,socketPath:i,serviceVersion:o,projectRoot:s,startedAt:u,token:c}=t;if(typeof n=="number"&&Number.isInteger(n)&&n>0&&typeof i=="string"&&i.length>0&&typeof o=="string"&&typeof s=="string"&&typeof u=="string"&&typeof c=="string"&&c.length>0)return{pid:n,socketPath:i,serviceVersion:o,projectRoot:s,startedAt:u,token:c}}catch{}}function v(e){try{return process.kill(e,0),!0}catch(r){return r.code==="EPERM"}}var D=3e3,b=250,j={env:process.env,cliVersion:d,loadConfig:g,cacheDir:(e,r)=>p(e,r).cacheDir,registryRecord:e=>R(S(),E(e)),isProcessAlive:v,configChangedAtMs:e=>A(O(e,".codebaseiq.json")).mtimeMs,refreshHookBinary:e=>{m(e)},ensure:h,stop:y,sleep:e=>new Promise(r=>setTimeout(r,e))};async function I(e,r=j){let t=l(T(e)),n=r.loadConfig(t);if(n.sentinel?.enabled!==!0)return"sentinel-disabled";if(r.refreshHookBinary(r.cliVersion),n.watch?.enabled!==!0)return"watch-disabled";if(r.env.CODEBASEIQ_SKIP_WATCH_SERVICE==="1")return"environment";if(_(r,t))return"already-running";let i={projectRoot:t,cacheDir:r.cacheDir(t,n),cliVersion:r.cliVersion,spawnEnv:{CODEBASEIQ_SENTINEL_ENSURE:"1"}},o=r.ensure(i);if(o.disposition==="started")return"started";for(let s=0;s<D;s+=b)if(await r.sleep(b),_(r,t))return"reused";return Date.parse(o.state.startedAt)>=r.configChangedAtMs(t)?"reused-without-sentinel":(r.stop(i),r.ensure(i),"restarted")}function _(e,r){let t=e.registryRecord(r);return t!==void 0&&e.isProcessAlive(t.pid)&&t.serviceVersion===e.cliVersion}async function L(e){if(typeof e!="string"||e.length===0)throw new Error("A project root is required.");await I(e)}var ae={id:"__sentinel-ensure-service",command:"__sentinel-ensure-service <projectRoot>",hidden:!0,description:"Internal: start the resident service that hosts the trailing sentinel",renderShape:"custom",handler:L};export{E as a,R as b,v as c,I as d,ae as e};
|
|
3
|
+
//# sourceMappingURL=chunk-E4DP45YU.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{h as d}from"./chunk-
|
|
1
|
+
import{h as d}from"./chunk-C3PPB2T5.js";import{createHash as f,randomUUID as m}from"crypto";import{mkdirSync as h,realpathSync as S,renameSync as E,unlinkSync as b,writeFileSync as R}from"fs";import{homedir as x,tmpdir as l,userInfo as k}from"os";import{dirname as _,join as c}from"path";var C=1*1024*1024,I=4*1024*1024;function U(r=process.env){return c(r.XDG_CACHE_HOME||c(x(),".cache"),"codebaseiq")}function F(r){let t=S.native(r).replaceAll("\\","/");return process.platform==="win32"&&(t=t.toLowerCase()),f("sha256").update(t).digest("hex").slice(0,16)}function J(){try{return k().username}catch{return`uid-${typeof process.getuid=="function"?process.getuid():"unknown"}`}}var $=100,y=16,v=y+5,T="/tmp";function w(r,t=l()){let e=`codebaseiq-${f("sha256").update(r).digest("hex").slice(0,8)}`,i=c(t,e);return Buffer.byteLength(i)+1+v<=$?i:c(T,e)}function K(r,t,n=l()){let e=f("sha256").update(`${t}\0${r}`).digest("hex");return process.platform==="win32"?`\\\\.\\pipe\\codebaseiq-sentinel-${e.slice(0,32)}`:c(w(t,n),`${e.slice(0,y)}.sock`)}function g(r,t){return c(r,"sentinel","registry",`${t}.json`)}function j(r,t){return c(r,"sentinel","inbox",`${t}.jsonl`)}function L(r,t){try{let n=JSON.parse(d(g(r,t),"sentinel registry record")),{pid:e,socketPath:i,serviceVersion:a,projectRoot:s,startedAt:o,token:u}=n;if(typeof e=="number"&&Number.isInteger(e)&&e>0&&typeof i=="string"&&i.length>0&&typeof a=="string"&&typeof s=="string"&&typeof o=="string"&&typeof u=="string"&&u.length>0)return{pid:e,socketPath:i,serviceVersion:a,projectRoot:s,startedAt:o,token:u}}catch{}}function H(r,t,n){let e=g(r,t);h(_(e),{recursive:!0});let i=`${e}.tmp-${process.pid}-${m()}`;R(i,`${JSON.stringify(n)}
|
|
2
2
|
`,{mode:384}),E(i,e)}function Y(r,t,n){if(L(r,t)?.pid!==n)return!1;try{return b(g(r,t)),!0}catch{return!1}}function D(r){try{return process.kill(r,0),!0}catch(t){return t.code==="EPERM"}}function M(r,t){let n=Buffer.from(JSON.stringify(r),"utf8");if(n.byteLength>t)throw new Error(`sentinel frame of ${n.byteLength} bytes exceeds the ${t}-byte limit`);let e=Buffer.allocUnsafe(4+n.byteLength);return e.writeUInt32LE(n.byteLength,0),n.copy(e,4),e}function q(r,t,n){let e=Buffer.alloc(0),i=!1,a=s=>{i||(i=!0,n(new Error(s)))};return{push(s){if(!i)for(e=e.byteLength===0?s:Buffer.concat([e,s]);e.byteLength>=4;){let o=e.readUInt32LE(0);if(o>r){a(`sentinel frame of ${o} bytes exceeds the ${r}-byte limit`);return}if(e.byteLength<4+o)return;let u=e.subarray(4,4+o);e=e.subarray(4+o);let p;try{p=JSON.parse(u.toString("utf8"))}catch{a("sentinel frame carried invalid JSON");return}if(t(p),i)return}}}}export{C as a,I as b,U as c,F as d,J as e,K as f,j as g,L as h,H as i,Y as j,D as k,M as l,q as m};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-E5U6N5WI.js.map
|