codebaseiq 0.1.0 → 0.2.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 +47 -0
- package/dist/augment-vue-worker.js +1 -1
- package/dist/{chunk-DQMDCD24.js → chunk-27PHVDKL.js} +2 -2
- package/dist/{chunk-ZMI2JSX2.js → chunk-2DMVFAY7.js} +2 -2
- package/dist/{chunk-5PUWMSDU.js → chunk-2E6BTWER.js} +2 -2
- package/dist/{chunk-YESXMKX3.js → chunk-2F5ERMNI.js} +2 -2
- package/dist/chunk-2VKB5CMA.js +60 -0
- package/dist/{chunk-NNJ2KZZG.js → chunk-327YK6TB.js} +4 -4
- package/dist/chunk-347TXATM.js +2 -0
- package/dist/{chunk-VEXUL62T.js → chunk-35YYZD3D.js} +2 -2
- package/dist/chunk-36WRYYTE.js +3 -0
- package/dist/chunk-37TKC6MB.js +2 -0
- package/dist/{chunk-FAJQ7LWY.js → chunk-3AC56WAR.js} +2 -2
- package/dist/{chunk-JE3WZ6II.js → chunk-3NUZVLR7.js} +2 -2
- package/dist/{chunk-UZGZB3VB.js → chunk-3XFJUWJE.js} +2 -2
- package/dist/{chunk-OVTS4DKB.js → chunk-4AOOSCZ7.js} +2 -2
- package/dist/{chunk-LU3BMVH2.js → chunk-4IFISPQW.js} +2 -2
- package/dist/chunk-4NHWNAWQ.js +11 -0
- package/dist/chunk-4O52YNKL.js +5 -0
- package/dist/{chunk-HPJRBHVT.js → chunk-54K6556S.js} +2 -2
- package/dist/{chunk-HRWGYWRJ.js → chunk-57GCCPLS.js} +2 -2
- package/dist/{chunk-J77SU6VA.js → chunk-57KEZDPT.js} +2 -2
- package/dist/{chunk-OFBE4NGP.js → chunk-57KFVPVZ.js} +2 -2
- package/dist/{chunk-WOQBZPIF.js → chunk-5BDK6QC3.js} +2 -2
- package/dist/{chunk-7MGU3HPH.js → chunk-5IO2APSS.js} +2 -2
- package/dist/chunk-5NJPH3QZ.js +61 -0
- package/dist/{chunk-GW6Z3WGY.js → chunk-5WXOEJ4G.js} +2 -2
- package/dist/chunk-5XEVXVTK.js +3 -0
- package/dist/{chunk-RR7SX44N.js → chunk-6OVNYYY4.js} +2 -2
- package/dist/{chunk-ZV3JV5G5.js → chunk-6SDEQTVY.js} +2 -2
- package/dist/{chunk-EF2R3WNQ.js → chunk-6URCE5QY.js} +2 -2
- package/dist/{chunk-UCD3H3UZ.js → chunk-6ZV5EDUT.js} +2 -2
- package/dist/{chunk-C6SBF2WH.js → chunk-77GHPR2R.js} +2 -2
- package/dist/{chunk-YVCIMIOC.js → chunk-7R64XY4Y.js} +2 -2
- package/dist/{chunk-VXYS3FZD.js → chunk-7Z7HCZ7J.js} +2 -2
- package/dist/{chunk-CO5R3UNA.js → chunk-A67HT5FR.js} +2 -2
- package/dist/{chunk-UDS562V4.js → chunk-A7XQT7MH.js} +2 -2
- package/dist/{chunk-RDBI2RXU.js → chunk-ACZDU5GK.js} +2 -2
- package/dist/{chunk-FETNQCFO.js → chunk-AM5SUGHF.js} +2 -2
- package/dist/{chunk-NNOKTMZT.js → chunk-B2E3HZ2A.js} +2 -2
- package/dist/{chunk-CVYSU6BX.js → chunk-BH5CE4LN.js} +2 -2
- package/dist/chunk-BLKYYQ7C.js +543 -0
- package/dist/{chunk-4WKDMDEW.js → chunk-BX2U3QQV.js} +2 -2
- package/dist/{chunk-ZKX2FRS6.js → chunk-CANBLFVQ.js} +2 -2
- package/dist/{chunk-SMRBZ6EC.js → chunk-CCRZLRWJ.js} +2 -2
- package/dist/chunk-CDWSLAPN.js +21 -0
- package/dist/chunk-CIVYHK7U.js +22 -0
- package/dist/{chunk-L57ZKWVG.js → chunk-CMXW7MFV.js} +2 -2
- package/dist/{chunk-T3DGWPXM.js → chunk-CSZOQ7YO.js} +2 -2
- package/dist/{chunk-ZZXSWSN6.js → chunk-CWMHWD56.js} +2 -2
- package/dist/{chunk-6NW7MU72.js → chunk-CZEIHYMP.js} +2 -2
- package/dist/{chunk-DO6WQD2T.js → chunk-D62CTZX6.js} +2 -2
- package/dist/{chunk-XWUOUWYI.js → chunk-DFPAZXLU.js} +2 -2
- package/dist/{chunk-MOVBWNIP.js → chunk-DKJXK3HA.js} +2 -2
- package/dist/{chunk-XMQ23E27.js → chunk-DLC6JDN7.js} +2 -2
- package/dist/chunk-DUKHVPU5.js +4 -0
- package/dist/{chunk-ID63777H.js → chunk-DVYG3JTA.js} +2 -2
- package/dist/{chunk-NE6IU5ZD.js → chunk-EFFMFK7C.js} +2 -2
- package/dist/{chunk-I2T2LLK2.js → chunk-EM5UHLAM.js} +2 -2
- package/dist/chunk-EN4AHLL3.js +3 -0
- package/dist/chunk-EXMVF3JR.js +3 -0
- package/dist/{chunk-SWHMHUKF.js → chunk-FEBLLMTL.js} +2 -2
- package/dist/chunk-FIXYHQ3W.js +3 -0
- package/dist/{chunk-RKEJ6VTF.js → chunk-FLLXYUOL.js} +2 -2
- package/dist/{chunk-KWVHSKHK.js → chunk-FPDL2TUB.js} +2 -2
- package/dist/chunk-FQA3KIFX.js +17 -0
- package/dist/chunk-FWY2PRIF.js +3 -0
- package/dist/chunk-FY5V4V4F.js +2 -0
- package/dist/chunk-G2XUZCF2.js +88 -0
- package/dist/{chunk-QHRNXP3C.js → chunk-GXVDTHFC.js} +2 -2
- package/dist/{chunk-6MUIJMVL.js → chunk-H3CKAL6P.js} +2 -2
- package/dist/chunk-H5QXP63L.js +2 -0
- package/dist/{chunk-VUIYB2V3.js → chunk-HBQGKMM3.js} +2 -2
- package/dist/{chunk-PYAB5SM6.js → chunk-HBXZAGY6.js} +2 -2
- package/dist/{chunk-NNO6A2PO.js → chunk-HCMQZPEO.js} +2 -2
- package/dist/{chunk-Q65CQ4XL.js → chunk-HHBBGWES.js} +2 -2
- package/dist/{chunk-GTXSJDCO.js → chunk-HIEXRDJF.js} +2 -2
- package/dist/{chunk-4FC325IF.js → chunk-HYKSLTAR.js} +2 -2
- package/dist/{chunk-XLQ3GLWZ.js → chunk-I2KP4AGR.js} +2 -2
- package/dist/chunk-I5FCDTK2.js +2 -0
- package/dist/{chunk-QKPLA6IC.js → chunk-I645ZF75.js} +2 -2
- package/dist/{chunk-FDGD5AB5.js → chunk-IBM3F2BJ.js} +2 -2
- package/dist/{chunk-Q72QSKXC.js → chunk-IEL6Q5W3.js} +38 -38
- package/dist/{chunk-NCZUNH3E.js → chunk-IGQQUENU.js} +12 -12
- package/dist/chunk-IGYAZPRX.js +4 -0
- package/dist/chunk-IOVPAZWP.js +3 -0
- package/dist/{chunk-OL6KJP3N.js → chunk-IVJJNVSX.js} +2 -2
- package/dist/{chunk-AKB7V7TV.js → chunk-IWAMYGPN.js} +2 -2
- package/dist/chunk-IYBIBMPF.js +90 -0
- package/dist/{chunk-IOP6FWIM.js → chunk-J24VICI5.js} +2 -2
- package/dist/{chunk-C7QOQX32.js → chunk-JN5LIBT3.js} +2 -2
- package/dist/{chunk-O6QTXQPJ.js → chunk-JOALNFY3.js} +2 -2
- package/dist/{chunk-GCHRX4YW.js → chunk-JUO3Z644.js} +2 -2
- package/dist/{chunk-BJ6SQAEN.js → chunk-JXHLB7TP.js} +2 -2
- package/dist/{chunk-IJ4HMYBE.js → chunk-JYX5UZSZ.js} +2 -2
- package/dist/chunk-K2O7SBAU.js +2 -0
- package/dist/{chunk-OLF4MA5W.js → chunk-K5G7SPAG.js} +2 -2
- package/dist/{chunk-YSNONTJ2.js → chunk-KDYQQJ6X.js} +2 -2
- package/dist/{chunk-7NVGT435.js → chunk-KM4QRWI5.js} +2 -2
- package/dist/{chunk-HKQUXIFO.js → chunk-KNV5VFDV.js} +2 -2
- package/dist/chunk-L3YSDLNB.js +2 -0
- package/dist/{chunk-EZNMUY67.js → chunk-LAGDJXFY.js} +2 -2
- package/dist/{chunk-ENCCHKM6.js → chunk-LY2NB5XR.js} +4 -4
- package/dist/chunk-M4EVGA5S.js +14 -0
- package/dist/chunk-M7LAIM77.js +127 -0
- package/dist/{chunk-BVAJLC5A.js → chunk-MRGTCMDK.js} +2 -2
- package/dist/{chunk-OZYRSMSH.js → chunk-MT5W4DUG.js} +2 -2
- package/dist/{chunk-VE5AVNMP.js → chunk-MTMF4N7F.js} +2 -2
- package/dist/chunk-N3Q3AWGW.js +545 -0
- package/dist/{chunk-TXXOEMZJ.js → chunk-NDGTJHQN.js} +2 -2
- package/dist/chunk-NIO346UL.js +2 -0
- package/dist/chunk-NJA4MMBD.js +2 -0
- package/dist/{chunk-7FND7D7N.js → chunk-NK76RSB6.js} +2 -2
- package/dist/{chunk-H3LGFZVK.js → chunk-NTRW52UR.js} +2 -2
- package/dist/{chunk-JOIRNPPY.js → chunk-OJFLPVBP.js} +2 -2
- package/dist/{chunk-KMITESMT.js → chunk-OMBRP7BB.js} +2 -2
- package/dist/{chunk-UP3BUZR5.js → chunk-OVKZM2XI.js} +2 -2
- package/dist/{chunk-MVB3DAEY.js → chunk-PARCKE3Q.js} +2 -2
- package/dist/{chunk-CAUCPUOF.js → chunk-PFPHS4NO.js} +2 -2
- package/dist/chunk-PHPQ24UG.js +22 -0
- package/dist/chunk-PLZXWZHY.js +77 -0
- package/dist/{chunk-34WBMAYK.js → chunk-PNVZIJ57.js} +2 -2
- package/dist/{chunk-SYDJMPES.js → chunk-QKVTWODE.js} +2 -2
- package/dist/{chunk-FW53T7EB.js → chunk-QLTFXVUI.js} +2 -2
- package/dist/{chunk-PBI2LFKH.js → chunk-QMGWSEPL.js} +2 -2
- package/dist/{chunk-CQP3THUZ.js → chunk-QVHZB75Z.js} +2 -2
- package/dist/{chunk-6BQ3DSPK.js → chunk-QVWDQTMG.js} +2 -2
- package/dist/{chunk-ST7V3SKN.js → chunk-RCPZOPV6.js} +2 -2
- package/dist/chunk-RJWAB4VR.js +345 -0
- package/dist/chunk-RRPK327J.js +20 -0
- package/dist/chunk-RVYLJDXC.js +21 -0
- package/dist/chunk-RWKEXCHU.js +3 -0
- package/dist/{chunk-L4NRUAGJ.js → chunk-S5SKXCND.js} +2 -2
- package/dist/{chunk-RBAS5ZHI.js → chunk-S64NCE2Z.js} +2 -2
- package/dist/{chunk-WMPRTGH2.js → chunk-SF34QLK2.js} +2 -2
- package/dist/{chunk-ANFVSJWQ.js → chunk-SJZQ2PTZ.js} +2 -2
- package/dist/{chunk-4XTAUQFD.js → chunk-SRY26ITJ.js} +2 -2
- package/dist/chunk-SV2LEFVM.js +2 -0
- package/dist/{chunk-7XAN6GKB.js → chunk-T3YFIJ5P.js} +2 -2
- package/dist/chunk-T55YPJGB.js +3 -0
- package/dist/chunk-TAJ6UGCO.js +21 -0
- package/dist/{chunk-PIOMTC27.js → chunk-TUTSO7UZ.js} +2 -2
- package/dist/{chunk-FQKZWM4L.js → chunk-U24M5RQM.js} +5 -5
- package/dist/{chunk-XME3HPXZ.js → chunk-U2XX3BT4.js} +2 -2
- package/dist/{chunk-SZD2KF7Q.js → chunk-UWB5WMC2.js} +2 -2
- package/dist/{chunk-6CS3UQTN.js → chunk-VCL7FK3E.js} +2 -2
- package/dist/{chunk-N3IQCBCF.js → chunk-VCWAJPXQ.js} +2 -2
- package/dist/{chunk-LZYFLFEH.js → chunk-VG55NFXF.js} +2 -2
- package/dist/{chunk-PTAWHLVJ.js → chunk-VLTUX4IF.js} +2 -2
- package/dist/{chunk-JEJLSICM.js → chunk-VVCBMH5O.js} +2 -2
- package/dist/{chunk-JSOYNVWH.js → chunk-VYZQZ4ZN.js} +2 -2
- package/dist/chunk-W3FK73MD.js +8 -0
- package/dist/{chunk-UNBY47BC.js → chunk-W6C6QTXJ.js} +2 -2
- package/dist/chunk-WH5SYOMD.js +2 -0
- package/dist/chunk-WJOQC4P7.js +7 -0
- package/dist/chunk-WO47BIPY.js +3 -0
- package/dist/chunk-WOOTEWQT.js +239 -0
- package/dist/{chunk-UBGWN7I4.js → chunk-X5I2BQGX.js} +2 -2
- package/dist/{chunk-PX4RYAAK.js → chunk-XNUWRTYM.js} +2 -2
- package/dist/{chunk-ICFDQHAM.js → chunk-XUJM6474.js} +2 -2
- package/dist/chunk-XYLV727H.js +21 -0
- package/dist/{chunk-TRRC4ZJ7.js → chunk-YFQPWKHR.js} +2 -2
- package/dist/{chunk-NEDP5RFQ.js → chunk-YIOQJ45A.js} +2 -2
- package/dist/{chunk-Y6KHROC3.js → chunk-YXJ4IAHH.js} +2 -2
- package/dist/chunk-YYFV32WR.js +3 -0
- package/dist/{chunk-BH5F2Q4O.js → chunk-ZB3V5QM7.js} +2 -2
- package/dist/chunk-ZJZQ7Q2Q.js +3 -0
- package/dist/{chunk-EMNIHCRB.js → chunk-ZNQCR656.js} +2 -2
- package/dist/{chunk-TIIC3ZE7.js → chunk-ZOEDRCR4.js} +2 -2
- package/dist/cli-context-TSADTXLB.js +2 -0
- package/dist/cli-context-XEPPF4RX.js +3 -0
- package/dist/cli-program-KJGQEM72.js +7 -0
- package/dist/cli.js +1 -1
- package/dist/{code-DlqpBDd0.d.ts → code-CDe-mIjx.d.ts} +1 -1
- package/dist/code-viewer-YGDON6SY.js +12 -0
- package/dist/code-viewer-ZCTHXQ5C.js +11 -0
- package/dist/command-descriptors-5VAB2MZX.js +335 -0
- package/dist/command-descriptors-EAHKIRAG.js +337 -0
- package/dist/{config-types-BNoC96J3.d.ts → config-types-D6X5S68_.d.ts} +50 -0
- package/dist/{db-D7sauVFH.d.ts → db-DmRNdCtm.d.ts} +1 -1
- package/dist/direct-navigation-B3SGOOBW.js +2 -0
- package/dist/direct-navigation-ZL362KXF.js +3 -0
- package/dist/{graph-evidence-BIFqyisO.d.ts → graph-evidence-Bs54NWws.d.ts} +1 -1
- package/dist/{health-DJaZXg8I.d.ts → health-BnzbSLCE.d.ts} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/invocation-command-descriptors-CSUGUHTT.js +2 -0
- package/dist/invocation-command-descriptors-PPVZOIE5.js +3 -0
- package/dist/output-continuation-command-FTVVBVSN.js +2 -0
- package/dist/output-continuation-command-ITPRC3YV.js +3 -0
- package/dist/project-reindex-7HZSLLLY.js +3 -0
- package/dist/project-reindex-NGM3DYBN.js +2 -0
- package/dist/queries/affected.d.ts +2 -2
- package/dist/queries/affected.js +1 -1
- package/dist/queries/anchors.d.ts +2 -2
- package/dist/queries/anchors.js +1 -1
- package/dist/queries/architecture.d.ts +2 -2
- package/dist/queries/architecture.js +1 -1
- package/dist/queries/bottlenecks.d.ts +2 -2
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +2 -2
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +2 -2
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +2 -2
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +2 -2
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +2 -2
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.d.ts +3 -3
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +2 -2
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +2 -2
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/context.d.ts +2 -2
- package/dist/queries/context.js +1 -1
- package/dist/queries/convergence.d.ts +2 -2
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +2 -2
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +2 -2
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +2 -2
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +2 -2
- package/dist/queries/dead.js +1 -1
- package/dist/queries/decorative-checkers.d.ts +2 -2
- package/dist/queries/decorative-checkers.js +1 -1
- package/dist/queries/deep-chains.d.ts +2 -2
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/dependence-slice.d.ts +3 -3
- package/dist/queries/dependence-slice.js +1 -1
- package/dist/queries/dependency-depth.d.ts +2 -2
- package/dist/queries/dependency-depth.js +1 -1
- package/dist/queries/deps.d.ts +2 -2
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.d.ts +2 -2
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +2 -2
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +2 -2
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.d.ts +2 -2
- package/dist/queries/duplicate-bodies.js +1 -1
- package/dist/queries/entry-map.d.ts +2 -2
- package/dist/queries/entry-map.js +1 -1
- package/dist/queries/evidence.d.ts +3 -3
- package/dist/queries/evidence.js +1 -1
- package/dist/queries/extract-candidates.d.ts +2 -2
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +2 -2
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +2 -2
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +3 -3
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +2 -2
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +2 -2
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +2 -2
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +2 -2
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +5 -5
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +2 -2
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.d.ts +2 -2
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.d.ts +2 -2
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +2 -2
- package/dist/queries/methods.js +1 -1
- package/dist/queries/not-implemented.d.ts +2 -2
- package/dist/queries/not-implemented.js +1 -1
- package/dist/queries/outline.d.ts +2 -2
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +2 -2
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +2 -2
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +2 -2
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +2 -2
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +2 -2
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.d.ts +2 -2
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +2 -2
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/reference-neighborhood.d.ts +2 -2
- package/dist/queries/reference-neighborhood.js +1 -1
- package/dist/queries/reference-reachability.d.ts +2 -2
- package/dist/queries/reference-reachability.js +1 -1
- package/dist/queries/refs.d.ts +2 -2
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +2 -2
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.d.ts +2 -2
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +2 -2
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +2 -2
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +2 -2
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +2 -2
- package/dist/queries/slice.js +1 -1
- package/dist/queries/source-inspection.d.ts +4 -4
- package/dist/queries/source-inspection.js +1 -1
- package/dist/queries/source-search.d.ts +2 -2
- package/dist/queries/source-search.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +2 -2
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +2 -2
- package/dist/queries/surface.d.ts +2 -2
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +2 -2
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system-map.d.ts +2 -2
- package/dist/queries/system-map.js +1 -1
- package/dist/queries/system.d.ts +2 -2
- package/dist/queries/system.js +1 -1
- package/dist/queries/test-quality.d.ts +2 -2
- package/dist/queries/test-quality.js +1 -1
- package/dist/queries/trace.d.ts +2 -2
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.d.ts +2 -2
- package/dist/queries/twin-ab.js +1 -1
- package/dist/queries/twin-drift.d.ts +2 -2
- package/dist/queries/twin-drift.js +1 -1
- package/dist/queries/unused-imports.d.ts +2 -2
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.d.ts +2 -2
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/value-flow.d.ts +3 -3
- package/dist/queries/value-flow.js +1 -1
- package/dist/queries/vue-component-duplicates.d.ts +2 -2
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.d.ts +2 -2
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.d.ts +2 -2
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +2 -2
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +1 -1
- package/dist/reindex.d.ts +3 -3
- package/dist/reindex.js +31 -31
- package/dist/runtime.d.ts +24 -4
- package/dist/runtime.js +3 -3
- package/dist/rust-semantic-session-server.js +1 -1
- package/dist/rust-semantic-session-worker.js +1 -1
- package/dist/rust-semantic-worker.js +1 -1
- package/dist/{scip-cli-B7N3haxa.d.ts → scip-cli-BRFKkHQn.d.ts} +1 -1
- package/dist/sentinel-ensure-command-KYYULCFU.js +2 -0
- package/dist/sentinel-ensure-command-RIZA3RY7.js +3 -0
- package/dist/sentinel-hook.js +39 -0
- package/dist/sentinel-worker.js +16 -0
- package/dist/typescript-mailbox-worker.js +1 -1
- package/dist/watch-server.js +6 -6
- package/docs/COMMAND_REFERENCE.md +5 -3
- package/docs/schemas/project-config.schema.json +159 -0
- package/package.json +9 -5
- package/skills/codebaseiq/SKILL.md +1 -1
- package/skills/concrete-plan/SKILL.md +1 -1
- package/ui/view/api.js +450 -0
- package/ui/view/app.js +394 -0
- package/ui/view/builder.js +323 -0
- package/ui/view/file-panel.js +170 -0
- package/ui/view/focus.js +379 -0
- package/ui/view/index.html +54 -0
- package/ui/view/map.js +424 -0
- package/ui/view/styles.css +1125 -0
- package/dist/chunk-2X7V4HS4.js +0 -88
- package/dist/chunk-3IER7Q6H.js +0 -12
- package/dist/chunk-3JSXXYTZ.js +0 -345
- package/dist/chunk-476NR5B7.js +0 -2
- package/dist/chunk-5VKBFZZU.js +0 -3
- package/dist/chunk-ADTBPVUZ.js +0 -21
- package/dist/chunk-BFFZDZQV.js +0 -2
- package/dist/chunk-BMYOV5GP.js +0 -77
- package/dist/chunk-C74PPYLA.js +0 -3
- package/dist/chunk-CWONGW6P.js +0 -3
- package/dist/chunk-DDZ7VHWV.js +0 -20
- package/dist/chunk-DR2LURYU.js +0 -3
- package/dist/chunk-ECQBG7PW.js +0 -564
- package/dist/chunk-FM5BPL4V.js +0 -60
- package/dist/chunk-G6XFR4ZL.js +0 -4
- package/dist/chunk-GTIYTDRE.js +0 -562
- package/dist/chunk-HOA5YGOH.js +0 -3
- package/dist/chunk-KUW32IRO.js +0 -2
- package/dist/chunk-LTA3BRZX.js +0 -2
- package/dist/chunk-NAUD7LCA.js +0 -2
- package/dist/chunk-OGTFJ3XD.js +0 -2
- package/dist/chunk-Q5ELPRKQ.js +0 -2
- package/dist/chunk-QCN62RTF.js +0 -3
- package/dist/chunk-QW7EP6WI.js +0 -21
- package/dist/chunk-RU65DDUP.js +0 -215
- package/dist/chunk-SELM5MER.js +0 -2
- package/dist/chunk-SNNWPCN7.js +0 -4
- package/dist/chunk-TFZB6XTM.js +0 -239
- package/dist/chunk-UXM43C7T.js +0 -3
- package/dist/chunk-VFY6Y2H6.js +0 -61
- package/dist/chunk-WE5RZHZ7.js +0 -5
- package/dist/chunk-Z54RD7VL.js +0 -3
- package/dist/cli-context-3SNLDYBM.js +0 -3
- package/dist/cli-context-T3B7W6GG.js +0 -2
- package/dist/cli-program-YNOXO72B.js +0 -7
- package/dist/command-descriptors-6AOUKWW7.js +0 -346
- package/dist/command-descriptors-ZFKJSRUP.js +0 -344
- package/dist/direct-navigation-DP4LVMRX.js +0 -3
- package/dist/direct-navigation-FLUS3BT6.js +0 -2
- package/dist/invocation-command-descriptors-QT2JMY5J.js +0 -3
- package/dist/invocation-command-descriptors-YN4QJEAX.js +0 -2
- package/dist/output-continuation-command-2V2SL4TD.js +0 -2
- package/dist/output-continuation-command-65J5IP3O.js +0 -3
- package/dist/project-reindex-5JOKXAXT.js +0 -2
- package/dist/project-reindex-UQBIKO4M.js +0 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as de}from"./chunk-ZZXSWSN6.js";import{a as me}from"./chunk-CAUCPUOF.js";import{a as he}from"./chunk-I2T2LLK2.js";import{a as ge}from"./chunk-6YTSKJJ3.js";import{a as fe}from"./chunk-BFFZDZQV.js";import{a as ce}from"./chunk-7NVGT435.js";import{a as le}from"./chunk-DQMDCD24.js";import{a as ue}from"./chunk-RBAS5ZHI.js";import{a as ae}from"./chunk-XWUOUWYI.js";import{a as se}from"./chunk-SYDJMPES.js";import{a as ne}from"./chunk-PIOMTC27.js";import{a as pe}from"./chunk-JE3WZ6II.js";import{a as oe}from"./chunk-OFBE4NGP.js";import{a as ie}from"./chunk-EMNIHCRB.js";import{a as ee}from"./chunk-PX4RYAAK.js";import{b as re}from"./chunk-WOQBZPIF.js";import{a as te}from"./chunk-T3DGWPXM.js";import{a as T,b as Y}from"./chunk-OZYRSMSH.js";import{b as Q}from"./chunk-SWHMHUKF.js";import{a as X}from"./chunk-4WKDMDEW.js";import{b as J}from"./chunk-C6SBF2WH.js";import{f as Z}from"./chunk-UDS562V4.js";import{b as K}from"./chunk-QDCCHMVZ.js";import{d as q,e as U}from"./chunk-6CS3UQTN.js";import{f as M,h as A}from"./chunk-C7QOQX32.js";import{a as j}from"./chunk-O6QTXQPJ.js";import{C as W,z as G}from"./chunk-ADTBPVUZ.js";import{u as k}from"./chunk-BMYOV5GP.js";import{f as z,g as O}from"./chunk-CWONGW6P.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-CWMHWD56.js";import{a as me}from"./chunk-PFPHS4NO.js";import{a as he}from"./chunk-EM5UHLAM.js";import{a as ge}from"./chunk-6YTSKJJ3.js";import{a as fe}from"./chunk-WH5SYOMD.js";import{a as ce}from"./chunk-KM4QRWI5.js";import{a as le}from"./chunk-27PHVDKL.js";import{a as ue}from"./chunk-S64NCE2Z.js";import{a as ae}from"./chunk-DFPAZXLU.js";import{a as se}from"./chunk-QKVTWODE.js";import{a as ne}from"./chunk-TUTSO7UZ.js";import{a as pe}from"./chunk-3NUZVLR7.js";import{a as oe}from"./chunk-57KFVPVZ.js";import{a as ie}from"./chunk-ZNQCR656.js";import{a as ee}from"./chunk-XNUWRTYM.js";import{b as re}from"./chunk-5BDK6QC3.js";import{a as te}from"./chunk-CSZOQ7YO.js";import{a as T,b as Y}from"./chunk-MT5W4DUG.js";import{b as Q}from"./chunk-FEBLLMTL.js";import{a as X}from"./chunk-BX2U3QQV.js";import{b as J}from"./chunk-77GHPR2R.js";import{f as Z}from"./chunk-A7XQT7MH.js";import{b as K}from"./chunk-QDCCHMVZ.js";import{d as q,e as U}from"./chunk-VCL7FK3E.js";import{f as M,h as A}from"./chunk-JN5LIBT3.js";import{a as j}from"./chunk-JOALNFY3.js";import{C as W,z as G}from"./chunk-RVYLJDXC.js";import{w as k}from"./chunk-PLZXWZHY.js";import{f as z,g as O}from"./chunk-IOVPAZWP.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-KNV5VFDV.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{h as p,j as x,l,p as g,x as v}from"./chunk-TAJ6UGCO.js";import{X as d}from"./chunk-IGQQUENU.js";import{P as h,S as u,ia as f}from"./chunk-WJOQC4P7.js";import{G as m}from"./chunk-4O52YNKL.js";import{existsSync as C}from"fs";var E=5e3,S=100,R={prepare:f,freshness:h,ensureService:x,inspectService:l,requestRefresh:g,async reindex(e,t,n,o){let{reindexConfiguredProject:a}=await import("./project-reindex-NGM3DYBN.js");return a(e,t,n,o)},indexExists:C,wait(e){return new Promise(t=>setTimeout(t,e))},now:Date.now};async function I(e,t=R,n={}){if(e.dbPathSource==="env")return{source:"explicit-index",service:{kind:"skipped",reason:"environment"}};if(v(e.commandName,e.config)&&t.indexExists(e.paths.dbPath))return{source:"published-generation",service:{kind:"skipped",reason:"excluded-command"}};let o=y(e,t),a=t.prepare(e.projectRoot,e.config,e.paths,{gitContext:e.gitContext,...o?{watcherGeneration:o}:{}}),r=t.freshness(e.projectRoot,e.config,e.paths),i=t.ensureService({commandName:e.commandName,projectRoot:e.projectRoot,cacheDir:e.paths.cacheDir,cliVersion:m,config:e.config,gitContext:e.gitContext});if(r.state==="fresh")return{source:a.kind==="local-fresh"?"existing":"shared-generation",service:i};if((i.kind==="started"||i.kind==="reused")&&(t.requestRefresh(d(e.paths.cacheDir).activityPath,`evidence command ${e.commandName} requires a fresh generation`),r=await F(e,r,t,n,i),r.state==="fresh"))return{source:"watcher",service:i};try{await t.reindex(e.projectRoot,e.config,e.paths,{allowPartial:!1,skipAutoInstall:!0,trigger:{kind:"watch-demand",detail:`codebaseiq ${e.commandName}`},onStatus:()=>{}})}catch(s){throw new Error(`Could not prepare fresh evidence for codebaseiq ${e.commandName}: ${s instanceof Error?s.message:String(s)}`,{cause:s})}if(r=t.freshness(e.projectRoot,e.config,e.paths),r.state!=="fresh")throw new Error(`Could not prepare fresh evidence for codebaseiq ${e.commandName}: index remained ${r.state} (${r.reason})`);return{source:"synchronous-reindex",service:i}}function y(e,t){if(e.config.watch?.enabled===!0)try{return p(t.inspectService({projectRoot:e.projectRoot,cacheDir:e.paths.cacheDir,cliVersion:m,gitContext:e.gitContext}))}catch{return}}async function F(e,t,n,o,a){if(a.state.watcher.state==="budget-paused")return t;let r=Math.max(0,o.waitMs??E),i=Math.max(1,o.pollMs??S),s=n.now()+r,c=t;for(;n.now()<s;)if(await n.wait(Math.min(i,Math.max(1,s-n.now()))),u(),c=n.freshness(e.projectRoot,e.config,e.paths),c.state==="fresh")return c;return c}export{I as a};
|
|
2
|
+
//# sourceMappingURL=chunk-L3YSDLNB.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{a as Q,b as ee,c as ne}from"./chunk-CQP3THUZ.js";import{a as Z}from"./chunk-ICFDQHAM.js";import{c as Y}from"./chunk-MVB3DAEY.js";import{a as X,b as z,c as W}from"./chunk-Y6KHROC3.js";import{a as J,d as w}from"./chunk-PTAWHLVJ.js";import{a as K}from"./chunk-GTXSJDCO.js";import{a as H,d as V}from"./chunk-JEJLSICM.js";import{h as G}from"./chunk-FQKZWM4L.js";import{a as x}from"./chunk-TIIC3ZE7.js";import{p as q}from"./chunk-O6QTXQPJ.js";import{v as U}from"./chunk-BMYOV5GP.js";import{createHash as ue}from"crypto";var le=6,ve=12,be=48,Ce=2e4,te=12,L=Number.MAX_SAFE_INTEGER,ye=["definition","callers","callees"],_={search:12,"exact-source":24,definition:24,caller:8,callee:8,"production-reference":6,"test-reference":2,dependency:6,consumer:6};function tn(e,t){if(t.cursor)throw new Error("Inspect no longer accepts semantic packet cursors. Run the original inspect selectors again.");let n=xe(t),r=we(e,n),i=r.candidates.sort((c,p)=>M(c,p));n.view==="behavior"&&Pe(e,i),Re(e,i),n.view==="behavior"&&Ee(e,i);let o=Q(i.map(c=>O(c,n.view)),n.evidenceBudgets,(c,p)=>M(c.candidate,p.candidate)),{selected:u,omitted:a}=ee(o.selected,n.maxUnits,n.maxCharacters,(c,p)=>M(c.candidate,p.candidate),n.view==="source"),d=u.map(c=>c.candidate),s=[...o.omitted,...a].map(c=>c.candidate),l=d.map(Ae),m=z(d.map(c=>c.kind==="source"?c.bindingClosure:void 0),d.filter(c=>c.kind==="source").map(c=>({relativePath:c.relativePath,startLine:c.startLine,endLine:c.endLine}))),h=l.reduce((c,p)=>c+(p.kind==="source"?qe(p.source):0),0),g=l.reduce((c,p)=>c+(p.kind==="source"?p.source.length:0),0),y=l.reduce((c,p)=>c+he(p,n.view),0),v=l.filter(c=>c.kind==="source"&&(c.roles.includes("search")||c.roles.includes("location"))).map(De),b=i.filter(c=>c.kind==="source"&&(c.roles.includes("search")||c.roles.includes("location"))).length,fe=l.filter(c=>c.kind==="source"&&(c.roles.includes("search")||c.roles.includes("location"))).length,P=r.searches.map(c=>Me(c,i,d)),ge=Fe(s),N=r.locations.every(c=>c.matched)&&r.evidence.every(c=>c.kind==="matched")&&r.searches.every(c=>Te(c.textCoverage))&&s.every(c=>!c.roles.some(p=>p==="location"||p==="definition")),A=P.reduce((c,p)=>c+p.omittedMatches,0),R=s.length===0&&A===0,$=R?void 0:me(n,!0),D=$e(n,s),Se=Le(R,N,s.length+A,D,P,$),j=i.filter(c=>n.view==="behavior"&&c.kind==="source"&&c.roles.some(p=>p==="location"||p==="definition"||p==="search")).map(c=>({id:`inspect:${c.relativePath}:${c.startLine}-${c.endLine}`,label:c.ownerShort??`${c.relativePath}:${c.startLine+1}`,file:c.relativePath,startLine:c.startLine,endLine:c.endLine})),B=j.length>0?Y(e,j):void 0;return{searches:P,evidence:r.evidence,locations:r.locations,slices:v,candidateSlices:b,omittedSlices:b-fe,maxSlices:b,maxTotalLines:h,units:l,candidateUnits:i.length,omittedUnits:s.length,maxUnits:n.maxUnits,maxCharacters:n.maxCharacters,returnedLines:h,returnedCharacters:g,returnedViewCharacters:y,view:n.view,omissionGroups:D,packetCoverage:{mode:R?"complete":"bounded",candidateUnits:i.length,returnedUnits:l.length,omittedUnits:s.length,omittedByRole:ge,exactSelectorsComplete:N,maxUnits:n.maxUnits,maxCharacters:n.maxCharacters,channels:Oe(i,d,n.evidenceBudgets,n.view),...$?{expansionCommand:$}:{}},stoppingSummary:Se,...B&&B.candidateAnchors>0?{causalFrontier:B}:{},bindingClosure:m,continuation:null}}function Le(e,t,n,r,i,o){let u=f([...r.map(a=>a.drillCommand),...i.flatMap(a=>a.exactFollowup?[a.exactFollowup]:[]),...o?[o]:[]]);return e&&t?{queryStatus:"selection-complete",status:"stop-ready",openEvidence:0,guidance:"All evidence requested by this inspect query was materialized.",drillCommands:[]}:t?{queryStatus:"frontier-accounted",status:"relevance-check-required",openEvidence:n,guidance:"Withheld evidence is accounted for by recoverable groups; drill the groups relevant to the current decision.",drillCommands:u}:{queryStatus:"coverage-incomplete",status:"exact-evidence-withheld",openEvidence:n,guidance:"A requested identity, exact source unit, or current-text coverage requirement is unresolved; drill before relying on it.",drillCommands:u}}function xe(e){let t=F(e.searches),n=F(e.symbols),r=F(e.locations),i=t.length+n.length+r.length;if(i===0)throw new Error("inspect requires at least one --search, --symbol, or --at selector.");if(i>24)throw new RangeError(`inspect accepts at most ${24} selectors; received ${i}.`);let o=e.evidence??{};if(e.unitLines!==void 0&&C(e.unitLines,"unitLines"),e.totalLines!==void 0&&C(e.totalLines,"totalLines"),e.sliceLimit!==void 0&&C(e.sliceLimit,"sliceLimit"),e.maxCharacters!==void 0&&C(e.maxCharacters,"maxCharacters"),e.maxUnits!==void 0&&C(e.maxUnits,"maxUnits"),e.view!==void 0&&e.view!=="source"&&e.view!=="behavior")throw new Error(`Unknown inspect view: ${String(e.view)}. Use source or behavior.`);if(e.full&&(e.searchLimit!==void 0||e.maxUnits!==void 0||e.maxCharacters!==void 0||e.evidenceBudgets!==void 0))throw new Error("full inspect cannot be combined with searchLimit, maxUnits, maxCharacters, or evidenceBudgets.");let u=e.full??!1;return{searches:t,symbols:n,locations:r,...e.scope?.trim()?{scope:e.scope.trim()}:{},context:ae(e.context??le,"context"),searchLimit:C(e.searchLimit??(u?L:ve),"searchLimit"),maxUnits:C(u?L:e.maxUnits??be,"maxUnits"),maxCharacters:C(u?L:e.maxCharacters??Ce,"maxCharacters"),evidenceBudgets:u?Ue():Ie(e.evidenceBudgets??_),view:e.view??"source",evidence:{...o.parts?{parts:[...o.parts]}:n.length>0?{parts:[...ye]}:{},...o.referenceContext!==void 0?{referenceContext:ae(o.referenceContext,"referenceContext")}:{},relatedSourceLines:o.relatedSourceLines??60,...o.semantic!==void 0?{semantic:o.semantic}:{}}}}function Ie(e){let t={..._};for(let[n,r]of Object.entries(e)){if(!(n in t))throw new Error(`Unknown inspect evidence channel: ${n}.`);if(!Number.isSafeInteger(r)||(r??-1)<0)throw new RangeError(`Evidence budget ${n} must be a non-negative safe integer; received ${r}.`);t[n]=r}return t}function Ue(){return Object.fromEntries(Object.keys(_).map(e=>[e,L]))}function we(e,t){let n=[],r=0,i=t.searches.map(s=>{let l=ne(e,s,{scope:t.scope,context:0,limit:t.searchLimit,ranking:"structural"});return{pattern:s,result:l,matches:l.matches}}),o=Math.max(0,...i.map(s=>s.matches.length));for(let s=0;s<o;s+=1)for(let l of i){let m=l.matches[s];if(!m)continue;let h=w(e,m.relativePath,m.focusLine,L,t.context);h&&I(e,n,h,"search",`search:${l.pattern}`,m.ownerSymbol,m.ownerShort,1,r++)}let u=i.map(({pattern:s,result:l})=>{let m=l.omittedMatches>0?de(s,t.scope):void 0,h=l.fileCoverage??[],g=_e(s,h,t.scope);return{pattern:s,matchingLines:l.matchingLines,returnedMatches:l.matches.length,omittedMatches:l.omittedMatches,matchingFiles:h.length,returnedFiles:h.filter(y=>y.returnedMatches>0).length,omittedFiles:h.filter(y=>y.returnedMatches===0).length,candidateUnits:0,selectedUnits:0,omittedUnits:0,scopeHints:g.slice(0,te),omittedScopeHints:Math.max(0,g.length-te),textCoverage:l.textCoverage,...m?{exactFollowup:m}:{}}}),a=t.locations.map(s=>{let l=je(s),m=l?K(e,l.path):null,h=m?w(e,m,l.line-1,L,t.context):null;return h&&I(e,n,h,"location",`at:${s}`,null,null,0,r++),{target:s,matched:h!==null}}),d=t.symbols.map(s=>Z(e,s,t.evidence));for(let s of d)if(s.kind==="matched"){if(s.definition){let l=w(e,s.definition.relativePath,s.definition.startLine,L,t.context);l&&I(e,n,l,"definition",`definition:${s.shortName}`,s.symbol,s.shortName,0,r++)}for(let l of s.referenceWindows){let m=l.references[0];I(e,n,{...l,focusLine:m?.line??l.startLine,unitType:null,unitStartLine:l.startLine,unitEndLine:l.endLine,omittedLines:0},"reference",`reference:${s.shortName}`,m?.enclosingSymbol??null,m?.enclosingShort??null,x(l.relativePath)==="test"?5:4,r++,l.references.map(h=>h.line),s.symbol)}for(let l of s.callers)re(e,n,l,"caller",s,2,r++);for(let l of s.callees)re(e,n,l,"callee",s,3,r++);for(let l of s.dependencies)oe(e,n,"dependency",s.file,l.relativePath,s.symbol,t.context,6,r++);for(let l of s.consumers)oe(e,n,"consumer",l.relativePath,s.file,s.symbol,t.context,7,r++)}return{searches:u,evidence:d,locations:a,candidates:n}}function M(e,t){return e.priority-t.priority||t.roles.length-e.roles.length||t.reasons.length-e.reasons.length||ie(x(e.relativePath))-ie(x(t.relativePath))||e.sequence-t.sequence}function ie(e){switch(e){case"entry":case"source":case"worker":return 0;case"barrel":return 1;case"test":return 2}}function O(e,t){return{candidate:e,priority:e.priority,sequence:e.sequence,relativePath:e.relativePath,fileKind:x(e.relativePath),evidenceCharacters:he(e,t),roles:e.roles,reasons:e.reasons,symbols:e.symbols,behaviorSignals:e.kind==="source"?e.behavior?.signals??[]:[],channel:T(e)}}function T(e){let t=e.roles;return t.includes("location")?"exact-source":t.includes("definition")?"definition":t.includes("caller")?"caller":t.includes("callee")?"callee":t.includes("reference")?x(e.relativePath)==="test"?"test-reference":"production-reference":t.includes("dependency")?"dependency":t.includes("consumer")?"consumer":"search"}function Ee(e,t){let n=t.filter(i=>i.kind==="source"),r=G(e,{files:f(n.map(i=>i.relativePath))});for(let i of n){i.behavior=H(e,i.relativePath,i.startLine,i.endLine,i.focusLines)??void 0;let o=r.filter(a=>a.source.file===i.relativePath&&a.source.startLine<=i.endLine&&a.source.endLine>=i.startLine),u=o.filter(a=>!ke(a,o)).map(a=>({observationId:a.id,protocol:a.protocol,action:a.action,role:a.role,strength:a.strength,resolution:a.resolution,line:a.source.startLine,endLine:a.source.endLine,keyParts:a.keyParts.map(d=>({name:d.name,value:d.value,evidence:d.evidence})),derivation:{kind:a.derivation.kind,rule:a.derivation.rule,sourceSpans:a.derivation.sourceSpans.length}}));i.runtimeFacts=u.length>0?u:void 0}}function ke(e,t){if(e.strength!=="candidate"||e.protocol!=="http")return!1;let n=e.keyParts.find(i=>i.name==="path")?.value,r=e.keyParts.find(i=>i.name==="method")?.value;return n?t.some(i=>{if(i===e||i.action!==e.action||i.role!==e.role||i.source.startLine!==e.source.startLine||i.derivation.rule!=="http.mount-prefix")return!1;let o=i.keyParts.find(a=>a.name==="path")?.value,u=i.keyParts.find(a=>a.name==="method")?.value;return!!(o&&o!==n&&o.endsWith(n)&&(!r||r===u))}):!1}function Pe(e,t){for(let n of t){if(n.kind!=="source")continue;let r=V(e,n.relativePath,n.startLine,n.endLine,n.focusLines);r.startLine===n.startLine&&r.endLine===n.endLine||(n.startLine=r.startLine,n.endLine=r.endLine,n.source=U(e,n.relativePath).slice(r.startLine,r.endLine+1).join(`
|
|
1
|
+
import{a as Q,b as ee,c as ne}from"./chunk-QVHZB75Z.js";import{a as Z}from"./chunk-XUJM6474.js";import{c as Y}from"./chunk-PARCKE3Q.js";import{a as X,b as z,c as W}from"./chunk-YXJ4IAHH.js";import{a as J,d as w}from"./chunk-VLTUX4IF.js";import{a as K}from"./chunk-HIEXRDJF.js";import{a as H,d as V}from"./chunk-VVCBMH5O.js";import{h as G}from"./chunk-U24M5RQM.js";import{a as x}from"./chunk-ZOEDRCR4.js";import{p as q}from"./chunk-JOALNFY3.js";import{x as U}from"./chunk-PLZXWZHY.js";import{createHash as ue}from"crypto";var le=6,ve=12,be=48,Ce=2e4,te=12,L=Number.MAX_SAFE_INTEGER,ye=["definition","callers","callees"],_={search:12,"exact-source":24,definition:24,caller:8,callee:8,"production-reference":6,"test-reference":2,dependency:6,consumer:6};function tn(e,t){if(t.cursor)throw new Error("Inspect no longer accepts semantic packet cursors. Run the original inspect selectors again.");let n=xe(t),r=we(e,n),i=r.candidates.sort((c,p)=>M(c,p));n.view==="behavior"&&Pe(e,i),Re(e,i),n.view==="behavior"&&Ee(e,i);let o=Q(i.map(c=>O(c,n.view)),n.evidenceBudgets,(c,p)=>M(c.candidate,p.candidate)),{selected:u,omitted:a}=ee(o.selected,n.maxUnits,n.maxCharacters,(c,p)=>M(c.candidate,p.candidate),n.view==="source"),d=u.map(c=>c.candidate),s=[...o.omitted,...a].map(c=>c.candidate),l=d.map(Ae),m=z(d.map(c=>c.kind==="source"?c.bindingClosure:void 0),d.filter(c=>c.kind==="source").map(c=>({relativePath:c.relativePath,startLine:c.startLine,endLine:c.endLine}))),h=l.reduce((c,p)=>c+(p.kind==="source"?qe(p.source):0),0),g=l.reduce((c,p)=>c+(p.kind==="source"?p.source.length:0),0),y=l.reduce((c,p)=>c+he(p,n.view),0),v=l.filter(c=>c.kind==="source"&&(c.roles.includes("search")||c.roles.includes("location"))).map(De),b=i.filter(c=>c.kind==="source"&&(c.roles.includes("search")||c.roles.includes("location"))).length,fe=l.filter(c=>c.kind==="source"&&(c.roles.includes("search")||c.roles.includes("location"))).length,P=r.searches.map(c=>Me(c,i,d)),ge=Fe(s),N=r.locations.every(c=>c.matched)&&r.evidence.every(c=>c.kind==="matched")&&r.searches.every(c=>Te(c.textCoverage))&&s.every(c=>!c.roles.some(p=>p==="location"||p==="definition")),A=P.reduce((c,p)=>c+p.omittedMatches,0),R=s.length===0&&A===0,$=R?void 0:me(n,!0),D=$e(n,s),Se=Le(R,N,s.length+A,D,P,$),j=i.filter(c=>n.view==="behavior"&&c.kind==="source"&&c.roles.some(p=>p==="location"||p==="definition"||p==="search")).map(c=>({id:`inspect:${c.relativePath}:${c.startLine}-${c.endLine}`,label:c.ownerShort??`${c.relativePath}:${c.startLine+1}`,file:c.relativePath,startLine:c.startLine,endLine:c.endLine})),B=j.length>0?Y(e,j):void 0;return{searches:P,evidence:r.evidence,locations:r.locations,slices:v,candidateSlices:b,omittedSlices:b-fe,maxSlices:b,maxTotalLines:h,units:l,candidateUnits:i.length,omittedUnits:s.length,maxUnits:n.maxUnits,maxCharacters:n.maxCharacters,returnedLines:h,returnedCharacters:g,returnedViewCharacters:y,view:n.view,omissionGroups:D,packetCoverage:{mode:R?"complete":"bounded",candidateUnits:i.length,returnedUnits:l.length,omittedUnits:s.length,omittedByRole:ge,exactSelectorsComplete:N,maxUnits:n.maxUnits,maxCharacters:n.maxCharacters,channels:Oe(i,d,n.evidenceBudgets,n.view),...$?{expansionCommand:$}:{}},stoppingSummary:Se,...B&&B.candidateAnchors>0?{causalFrontier:B}:{},bindingClosure:m,continuation:null}}function Le(e,t,n,r,i,o){let u=f([...r.map(a=>a.drillCommand),...i.flatMap(a=>a.exactFollowup?[a.exactFollowup]:[]),...o?[o]:[]]);return e&&t?{queryStatus:"selection-complete",status:"stop-ready",openEvidence:0,guidance:"All evidence requested by this inspect query was materialized.",drillCommands:[]}:t?{queryStatus:"frontier-accounted",status:"relevance-check-required",openEvidence:n,guidance:"Withheld evidence is accounted for by recoverable groups; drill the groups relevant to the current decision.",drillCommands:u}:{queryStatus:"coverage-incomplete",status:"exact-evidence-withheld",openEvidence:n,guidance:"A requested identity, exact source unit, or current-text coverage requirement is unresolved; drill before relying on it.",drillCommands:u}}function xe(e){let t=F(e.searches),n=F(e.symbols),r=F(e.locations),i=t.length+n.length+r.length;if(i===0)throw new Error("inspect requires at least one --search, --symbol, or --at selector.");if(i>24)throw new RangeError(`inspect accepts at most ${24} selectors; received ${i}.`);let o=e.evidence??{};if(e.unitLines!==void 0&&C(e.unitLines,"unitLines"),e.totalLines!==void 0&&C(e.totalLines,"totalLines"),e.sliceLimit!==void 0&&C(e.sliceLimit,"sliceLimit"),e.maxCharacters!==void 0&&C(e.maxCharacters,"maxCharacters"),e.maxUnits!==void 0&&C(e.maxUnits,"maxUnits"),e.view!==void 0&&e.view!=="source"&&e.view!=="behavior")throw new Error(`Unknown inspect view: ${String(e.view)}. Use source or behavior.`);if(e.full&&(e.searchLimit!==void 0||e.maxUnits!==void 0||e.maxCharacters!==void 0||e.evidenceBudgets!==void 0))throw new Error("full inspect cannot be combined with searchLimit, maxUnits, maxCharacters, or evidenceBudgets.");let u=e.full??!1;return{searches:t,symbols:n,locations:r,...e.scope?.trim()?{scope:e.scope.trim()}:{},context:ae(e.context??le,"context"),searchLimit:C(e.searchLimit??(u?L:ve),"searchLimit"),maxUnits:C(u?L:e.maxUnits??be,"maxUnits"),maxCharacters:C(u?L:e.maxCharacters??Ce,"maxCharacters"),evidenceBudgets:u?Ue():Ie(e.evidenceBudgets??_),view:e.view??"source",evidence:{...o.parts?{parts:[...o.parts]}:n.length>0?{parts:[...ye]}:{},...o.referenceContext!==void 0?{referenceContext:ae(o.referenceContext,"referenceContext")}:{},relatedSourceLines:o.relatedSourceLines??60,...o.semantic!==void 0?{semantic:o.semantic}:{}}}}function Ie(e){let t={..._};for(let[n,r]of Object.entries(e)){if(!(n in t))throw new Error(`Unknown inspect evidence channel: ${n}.`);if(!Number.isSafeInteger(r)||(r??-1)<0)throw new RangeError(`Evidence budget ${n} must be a non-negative safe integer; received ${r}.`);t[n]=r}return t}function Ue(){return Object.fromEntries(Object.keys(_).map(e=>[e,L]))}function we(e,t){let n=[],r=0,i=t.searches.map(s=>{let l=ne(e,s,{scope:t.scope,context:0,limit:t.searchLimit,ranking:"structural"});return{pattern:s,result:l,matches:l.matches}}),o=Math.max(0,...i.map(s=>s.matches.length));for(let s=0;s<o;s+=1)for(let l of i){let m=l.matches[s];if(!m)continue;let h=w(e,m.relativePath,m.focusLine,L,t.context);h&&I(e,n,h,"search",`search:${l.pattern}`,m.ownerSymbol,m.ownerShort,1,r++)}let u=i.map(({pattern:s,result:l})=>{let m=l.omittedMatches>0?de(s,t.scope):void 0,h=l.fileCoverage??[],g=_e(s,h,t.scope);return{pattern:s,matchingLines:l.matchingLines,returnedMatches:l.matches.length,omittedMatches:l.omittedMatches,matchingFiles:h.length,returnedFiles:h.filter(y=>y.returnedMatches>0).length,omittedFiles:h.filter(y=>y.returnedMatches===0).length,candidateUnits:0,selectedUnits:0,omittedUnits:0,scopeHints:g.slice(0,te),omittedScopeHints:Math.max(0,g.length-te),textCoverage:l.textCoverage,...m?{exactFollowup:m}:{}}}),a=t.locations.map(s=>{let l=je(s),m=l?K(e,l.path):null,h=m?w(e,m,l.line-1,L,t.context):null;return h&&I(e,n,h,"location",`at:${s}`,null,null,0,r++),{target:s,matched:h!==null}}),d=t.symbols.map(s=>Z(e,s,t.evidence));for(let s of d)if(s.kind==="matched"){if(s.definition){let l=w(e,s.definition.relativePath,s.definition.startLine,L,t.context);l&&I(e,n,l,"definition",`definition:${s.shortName}`,s.symbol,s.shortName,0,r++)}for(let l of s.referenceWindows){let m=l.references[0];I(e,n,{...l,focusLine:m?.line??l.startLine,unitType:null,unitStartLine:l.startLine,unitEndLine:l.endLine,omittedLines:0},"reference",`reference:${s.shortName}`,m?.enclosingSymbol??null,m?.enclosingShort??null,x(l.relativePath)==="test"?5:4,r++,l.references.map(h=>h.line),s.symbol)}for(let l of s.callers)re(e,n,l,"caller",s,2,r++);for(let l of s.callees)re(e,n,l,"callee",s,3,r++);for(let l of s.dependencies)oe(e,n,"dependency",s.file,l.relativePath,s.symbol,t.context,6,r++);for(let l of s.consumers)oe(e,n,"consumer",l.relativePath,s.file,s.symbol,t.context,7,r++)}return{searches:u,evidence:d,locations:a,candidates:n}}function M(e,t){return e.priority-t.priority||t.roles.length-e.roles.length||t.reasons.length-e.reasons.length||ie(x(e.relativePath))-ie(x(t.relativePath))||e.sequence-t.sequence}function ie(e){switch(e){case"entry":case"source":case"worker":return 0;case"barrel":return 1;case"test":return 2}}function O(e,t){return{candidate:e,priority:e.priority,sequence:e.sequence,relativePath:e.relativePath,fileKind:x(e.relativePath),evidenceCharacters:he(e,t),roles:e.roles,reasons:e.reasons,symbols:e.symbols,behaviorSignals:e.kind==="source"?e.behavior?.signals??[]:[],channel:T(e)}}function T(e){let t=e.roles;return t.includes("location")?"exact-source":t.includes("definition")?"definition":t.includes("caller")?"caller":t.includes("callee")?"callee":t.includes("reference")?x(e.relativePath)==="test"?"test-reference":"production-reference":t.includes("dependency")?"dependency":t.includes("consumer")?"consumer":"search"}function Ee(e,t){let n=t.filter(i=>i.kind==="source"),r=G(e,{files:f(n.map(i=>i.relativePath))});for(let i of n){i.behavior=H(e,i.relativePath,i.startLine,i.endLine,i.focusLines)??void 0;let o=r.filter(a=>a.source.file===i.relativePath&&a.source.startLine<=i.endLine&&a.source.endLine>=i.startLine),u=o.filter(a=>!ke(a,o)).map(a=>({observationId:a.id,protocol:a.protocol,action:a.action,role:a.role,strength:a.strength,resolution:a.resolution,line:a.source.startLine,endLine:a.source.endLine,keyParts:a.keyParts.map(d=>({name:d.name,value:d.value,evidence:d.evidence})),derivation:{kind:a.derivation.kind,rule:a.derivation.rule,sourceSpans:a.derivation.sourceSpans.length}}));i.runtimeFacts=u.length>0?u:void 0}}function ke(e,t){if(e.strength!=="candidate"||e.protocol!=="http")return!1;let n=e.keyParts.find(i=>i.name==="path")?.value,r=e.keyParts.find(i=>i.name==="method")?.value;return n?t.some(i=>{if(i===e||i.action!==e.action||i.role!==e.role||i.source.startLine!==e.source.startLine||i.derivation.rule!=="http.mount-prefix")return!1;let o=i.keyParts.find(a=>a.name==="path")?.value,u=i.keyParts.find(a=>a.name==="method")?.value;return!!(o&&o!==n&&o.endsWith(n)&&(!r||r===u))}):!1}function Pe(e,t){for(let n of t){if(n.kind!=="source")continue;let r=V(e,n.relativePath,n.startLine,n.endLine,n.focusLines);r.startLine===n.startLine&&r.endLine===n.endLine||(n.startLine=r.startLine,n.endLine=r.endLine,n.source=U(e,n.relativePath).slice(r.startLine,r.endLine+1).join(`
|
|
2
2
|
`),n.unitStartLine=r.startLine,n.unitEndLine=r.endLine,n.omittedLines=0)}}function Re(e,t){for(let n of t)n.kind==="source"&&(n.bindingClosure=X(e,n.relativePath,n.startLine,n.endLine))}function $e(e,t){let n=new Map;for(let r of t){let i=k(r.relativePath),o=T(r),u=[...r.roles].sort().join(","),a=r.kind==="path"?r.relationship:"",d=`${i}|${o}|${u}|${a}`,s=n.get(d)??[];s.push(r),n.set(d,s)}return[...n.entries()].map(([r,i])=>{let o=i[0],u=f(i.flatMap(d=>[...d.roles])).sort(),a=f(i.flatMap(d=>d.kind==="source"?d.behavior?.signals??[]:[])).sort();return{id:`g-${ue("sha256").update(r).digest("hex").slice(0,8)}`,scope:k(o.relativePath),channel:T(o),roles:u,behaviorSignals:a,candidateUnits:i.length,sourceCharacters:i.reduce((d,s)=>d+(s.kind==="source"?s.source.length:0),0),anchors:i.map(d=>({relativePath:d.relativePath,line:d.kind==="source"?d.focusLine:0,ownerShort:d.kind==="source"?d.ownerShort:null,roles:[...d.roles],behaviorSignals:d.kind==="source"?[...d.behavior?.signals??[]]:[]})),drillCommand:Be(e,i)}}).sort((r,i)=>i.candidateUnits-r.candidateUnits||i.sourceCharacters-r.sourceCharacters||r.scope.localeCompare(i.scope)||r.id.localeCompare(i.id))}function Be(e,t){let n=f(t.flatMap(o=>o.reasons.filter(u=>u.startsWith("search:")).map(u=>u.slice(7)))),r=k(t[0].relativePath);if(n.length>0&&t.every(o=>o.kind==="source"&&o.roles.includes("search"))){let o=["codebaseiq inspect"];for(let u of n)o.push(`--search ${S(u)}`);return o.push(`--scope ${S(r)}`,"--full"),e.view==="behavior"&&o.push("--view behavior"),o.join(" ")}let i=t.filter(o=>o.kind==="source");if(i.length>0&&i.length<=24){let o=["codebaseiq inspect"];for(let u of i)o.push(`--at ${S(`${u.relativePath}:${u.focusLine+1}`)}`);return e.view==="behavior"&&o.push("--view behavior"),o.join(" ")}return t.length===1&&t[0].kind==="path"?t[0].exactFollowup:me(e,!0)}function Me(e,t,n){let r=`search:${e.pattern}`,i=t.filter(a=>a.reasons.includes(r)).length,o=new Set(n),u=t.filter(a=>a.reasons.includes(r)&&o.has(a)).length;return{...e,candidateUnits:i,selectedUnits:u,omittedUnits:i-u}}function Fe(e){let t={};for(let n of e)for(let r of n.roles)t[r]=(t[r]??0)+1;return t}function Oe(e,t,n,r){let i=e.map(u=>O(u,r).channel),o=t.map(u=>O(u,r).channel);return Object.fromEntries(Object.keys(n).map(u=>{let a=i.filter(s=>s===u).length,d=o.filter(s=>s===u).length;return[u,{candidateUnits:a,returnedUnits:d,omittedUnits:a-d,maxUnits:n[u]}]}))}function Te(e){return!!(e&&e.skippedUnreadablePaths.length===0&&e.skippedOversizedPaths.length===0)}function _e(e,t,n){let r=new Map;for(let i of t){let o=k(i.relativePath),u=r.get(o)??{matchingLines:0,returnedMatches:0};u.matchingLines+=i.matchingLines,u.returnedMatches+=i.returnedMatches,r.set(o,u)}return[...r.entries()].map(([i,o])=>({scope:i,...o,exactFollowup:de(e,i||n)})).sort((i,o)=>o.matchingLines-i.matchingLines||o.returnedMatches-i.returnedMatches||i.scope.localeCompare(o.scope))}function k(e){let t=e.lastIndexOf("/");return t<0?e:e.slice(0,t)}function de(e,t){return`codebaseiq inspect --search ${S(e)}${t?` --scope ${S(t)}`:""} --full`}function me(e,t){let n=["codebaseiq inspect"];for(let r of e.searches)n.push(`--search ${S(r)}`);for(let r of e.symbols)n.push(`--symbol ${S(r)}`);for(let r of e.locations)n.push(`--at ${S(r)}`);return e.scope&&n.push(`--scope ${S(e.scope)}`),e.context!==le&&n.push(`--context ${e.context}`),e.evidence.parts&&n.push(`--include ${S(e.evidence.parts.join(","))}`),t&&n.push("--full"),e.view==="behavior"&&n.push("--view behavior"),n.join(" ")}function re(e,t,n,r,i,o,u){I(e,t,{...n,unitType:null,unitStartLine:n.startLine,unitEndLine:n.endLine+n.omittedLines},r,`${r}:${i.shortName}`,n.symbol,n.shortName,o,u,[n.focusLine],i.symbol)}function oe(e,t,n,r,i,o,u,a,d){let s=`${r} -> ${i}`,l=q(e,r).filter(b=>b.sourcePath===i),m=U(e,r),h=Ne(m,l,i),g=h===null?null:J(e,r,h,Math.min(u,4));if(g){I(e,t,{...g,unitType:null,unitStartLine:g.startLine,unitEndLine:g.endLine,omittedLines:0},n,`${n}:${s}`,null,null,a,d,[g.focusLine],o);return}let y=`codebaseiq inspect --search ${S(pe(i))} --scope ${S(r)}`,v=t.find(b=>b.kind==="path"&&b.relativePath===r&&b.relationship===s);if(v){v.roles=f([...v.roles,n]),v.reasons=f([...v.reasons,`${n}:${s}`]),v.symbols=f([...v.symbols,o]),v.priority=Math.min(v.priority,a);return}t.push({kind:"path",roles:[n],relativePath:r,relationship:s,reasons:[`${n}:${s}`],symbols:[o],exactFollowup:y,priority:a,sequence:d})}function Ne(e,t,n){let r=f(t.flatMap(d=>[d.importedName,d.localName??""]).filter(d=>d.length>1)),i=pe(n).replace(/\.[^.]+$/u,""),o=f([...r,i]).filter(Boolean),u=/\b(?:from|import|include|require|use)\b/u,a=e.findIndex(d=>u.test(d)&&o.some(s=>d.includes(s)));return a>=0?a:null}function I(e,t,n,r,i,o,u,a,d,s=[n.focusLine],l){let m=t.find(h=>h.kind==="source"&&h.relativePath===n.relativePath&&h.startLine<=n.endLine&&n.startLine<=h.endLine);if(m){let h=Math.min(m.startLine,n.startLine),g=Math.max(m.endLine,n.endLine);m.startLine=h,m.endLine=g,m.source=U(e,n.relativePath).slice(h,g+1).join(`
|
|
3
3
|
`),m.focusLine=Math.min(m.focusLine,n.focusLine),m.focusLines=ce([...m.focusLines,...s]),m.unitStartLine=Math.min(m.unitStartLine,n.unitStartLine),m.unitEndLine=Math.max(m.unitEndLine,n.unitEndLine),m.omittedLines=Math.max(m.omittedLines,n.omittedLines),m.reasons=f([...m.reasons,i]),m.roles=f([...m.roles,r]),m.symbols=f([...m.symbols,...l?[l]:[]]),!m.ownerSymbol&&o&&(m.ownerSymbol=o),!m.ownerShort&&u&&(m.ownerShort=u),m.priority=Math.min(m.priority,a);return}t.push({kind:"source",...n,reasons:[i],focusLines:ce(s),ownerSymbol:o,ownerShort:u,roles:[r],symbols:l?[l]:[],priority:a,sequence:d})}function Ae(e){if(e.kind==="path"){let{priority:o,sequence:u,...a}=e;return{...a,id:se(a)}}let{priority:t,sequence:n,bindingClosure:r,...i}=e;return{...i,id:se(i),omittedCharacters:0}}function De(e){let{kind:t,id:n,roles:r,symbols:i,omittedCharacters:o,behavior:u,runtimeFacts:a,...d}=e;return d}function se(e){return ue("sha256").update(JSON.stringify(e)).digest("hex").slice(0,16)}function je(e){let t=e.match(/^(.+\.\w+):(\d+)$/u);if(!t)return null;let n=Number(t[2]);return Number.isSafeInteger(n)&&n>0?{path:t[1],line:n}:null}function F(e){return f((e??[]).map(t=>t.trim()).filter(Boolean))}function f(e){return[...new Set(e)]}function ce(e){return f(e).sort((t,n)=>t-n)}function qe(e){return e.length===0?0:e.split(`
|
|
4
4
|
`).length}function he(e,t){if(e.kind==="path")return e.relationship.length+e.exactFollowup.length;let n="bindingClosure"in e?W(e.bindingClosure):0,r=(e.runtimeFacts??[]).reduce((i,o)=>i+o.action.length+o.derivation.rule.length+o.keyParts.reduce((u,a)=>u+a.name.length+a.value.length+4,0)+24,0);return t!=="behavior"?e.source.length+n:e.behavior?e.behavior.lines.reduce((i,o)=>i+o.text.length+o.signals.join(",").length+12,0)+e.behavior.testCases.reduce((i,o)=>i+o.length+2,0)+r+n:e.source.length+n+r}function pe(e){return e.split("/").at(-1)??e}function S(e){return`'${e.replaceAll("'","'\\''")}'`}function C(e,t){if(!Number.isSafeInteger(e)||e<=0)throw new RangeError(`${t} must be a positive safe integer; received ${e}`);return e}function ae(e,t){if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`${t} must be a non-negative safe integer; received ${e}`);return e}export{tn as a};
|
|
5
|
-
//# sourceMappingURL=chunk-
|
|
5
|
+
//# sourceMappingURL=chunk-LAGDJXFY.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
`).length)}let f=[...m.values()].map(g=>Se(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(xe).slice(0,Math.max(pn,C)),...ct(f,a),...lt(f,a,S)]),P=A.length,I=A.map(g=>c.get(g.symbol)).filter(g=>g?.isFunctionLike===!0),H=Fn(l),E=kn(e,i,A,I,c,H,new Set(m.keys()),s.semantic!==!1),B=Nn(E,A,m,S,c),F=Gn(B,S,a),K=Zn(e,i,E,m,S,l,c,s.semantic!==!1),L=[...Xn(e,i,B,c,S,s.semantic!==!1),...F,...B,...K].map(g=>({...g,queryPathMatches:mt(g)})).sort((g,z)=>Z(g,z,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-P),ye=Math.max(0,L.length-k.length)+ee,hn=t?f.length:Math.min(f.length,o+Ue);return{query:n,queryPathFragments:r,normalizedTerms:a,matchedTerms:p,unmatchedTerms:w,groups:k,candidateRoots:f,candidateRootCount:f.length,analyzedRootCount:P,omittedRootCount:ee,omittedGroupCount:ye,scannedFiles:u.files.length,scannedBytes:u.scannedBytes,recoveryCommand:ye===0?null:`codebaseiq anchors ${Le(n)}${s.scope?` --scope ${Le(s.scope)}`:""} --limit ${hn}`}}function Pn(e){let n=De(e).filter(s=>!je.has(s.toLocaleLowerCase())).map(_e).filter(s=>s.length>=3&&!je.has(s));return[...new Set(n)]}function He(e,n,s){let a=T(n.leaf),r=T(n.relativePath),o=T(n.documentation??"");for(let i of s)a.has(i)&&le(e,n,i,"symbol"),r.has(i)&&le(e,n,i,"path"),o.has(i)&&le(e,n,i,"documentation");let t=e.get(n.symbol);t&&(t.symbolPhraseLength=bt(n.leaf,s))}function le(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 Ye(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 In(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:`${ke}${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 xn(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||x(U(t.file.relativePath))-x(U(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 Qe(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(ke)}function W(e){return G(e)?e.leaf:te(e.symbol)}function Se(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:W(a),leaf:a.leaf,file:a.relativePath,line:a.startLine,endLine:a.endLine,kind:a.isFunctionLike?"callable":a.isTypeLike?"type":"symbol",fileKind:U(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)?Ve(e,v,r,o,1):ve(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)?Ve(e,b,r,o,2):ve(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 ve(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:Fe(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 Ve(e,n,s,a,r){let o=ge(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:W(n),fromFile:n.relativePath,toSymbol:i.symbol,toLabel:W(i),toFile:i.relativePath,depth:r,strength:"exact",evidence:"scip-occurrence-callsite",callsiteLine:t.sourceLine}]});for(let t of Te(e,n.relativePath,{ranges:[{startLine:n.startLine,endLine:n.endLine}],excludeIndexedTargets:!1}).targets){let i=[...a.get(`${t.targetFile}\0${$(t.calleeLeaf)}`)??[],...be(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:W(n),fromFile:n.relativePath,toSymbol:i.symbol,toLabel:W(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:W(n),fromFile:n.relativePath,toSymbol:d.symbol,toLabel:W(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,Se(C,a));else{let A=r.get(f);A&&y.set(f,dn(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}:${me(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:he(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=Ze(t);if(i.size!==0)for(let d=o+1;d<e.length;d+=1){let l=e[d],c=Ze(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,P)=>(a.get(A)??Number.MAX_SAFE_INTEGER)-(a.get(P)??Number.MAX_SAFE_INTEGER)||A.localeCompare(P)),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:${me(t.roots[0])}:${me(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:he(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 Ze(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([Je(e),Je(n)].filter(s=>s!==void 0))}function Je(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)||en(r)-en(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 en(e){return e.matchedTerms.length+e.identityMatchedTerms.length*2+(e.queryPathMatches?.length??0)*4}function Xn(e,n,s,a,r,o){let t=qe(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)??Un(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&&Bn(L).some(k=>M.reachedSymbols.has(k))&&Ie(S,L)>=2).sort((L,k)=>Ie(S,k)-Ie(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(ue)),P=Qn(de(v),A,M.relations);if(P.length===0)continue;let I=Yn(b,v,y.joinRule,y.matchedKeyParts,y.strength),H=q([I,...M.relations,...h.relations,...f.flatMap(L=>L.relations)]),E=Vn([I,...P],H,h,f),B=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=zn(e,n,S,a,o);B.length===0||F.length<2||l.set(C,{id:`cross-boundary-set:${me(S)}:${l.size+1}`,kind:"cross-boundary-flow",roots:B,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:he(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(ue(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 ue(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 Bn(e){return[...new Set([...e.roots,...e.keyAnchors].map(n=>n.symbol))]}function Ie(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 zn(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&&U(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 Un(e,n,s,a,r,o){let t=Wn(e,s,a),i=t.map(({definition:u,evidence:h,line:y})=>({kind:"call",fromSymbol:de(s),fromLabel:Ae(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=ln([...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=ve(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 Wn(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=Re(e,n.source.file),o=we(e,n.source.file,0,Math.max(0,r.length-1),[n.source.startLine]),t=ge(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=Xe(e),l=(i?.callSites??[]).flatMap(c=>{if(c.line<o.startLine||c.line>o.endLine)return[];let m=Ge(n.source.file,d.get(c.calleeLeaf)??[]),u=$e(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=Re(e,n.source.file),a=we(e,n.source.file,0,Math.max(0,s.length-1),[n.source.startLine]),r=Te(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:de(n),fromLabel:Ae(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=ge(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:ln(o),relations:q(t)}}function Hn(e){return[...new Map(e.map(n=>[n.definition.symbol,n])).values()]}function ln(e){return[...new Map(e.map(n=>[n.symbol,n])).values()]}function de(e){return e.owner.symbol??e.id}function Ae(e){return e.owner.name??`${e.source.file}:${e.source.startLine+1}`}function Yn(e,n,s,a,r){return{kind:"runtime-boundary",fromSymbol:de(e),fromLabel:Ae(e),fromFile:e.source.file,toSymbol:de(n),toLabel:Ae(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=>[...ue(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(ke)).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,ye])=>ye-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=>ve(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 P=new Set([...A].filter(([p,w])=>w.size>=2||u.has(p)).map(([p])=>p)),I=C.filter(p=>P.has(p.fromSymbol));if(P.size<2||I.length===0)return[];let E=[...new Set(I.map(p=>p.toSymbol))].map(p=>Me(p,a,r,t)).filter(p=>p!==null).sort(R),B=[...P].map(p=>Me(p,a,r,t)).filter(p=>p!==null),F=tt(B,I),K=F.slice(0,Pe),ie=F.slice(Pe);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(I,K);return[{id:`effect-owner-set:${m+1}:${me(E[0])}`,kind:"shared-callee-owners",roots:E,keyAnchors:K,candidateOwnerCount:F.length,omittedCandidateOwners:ie,ownerRecoveryCommands:Mt(ie,Pe),upstreamEntries:[],matchedTerms:L,relations:k,relationCount:I.length,omittedRelations:Math.max(0,I.length-k.length),systemMapCommand:he(K,I,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=Me(e,s,a,r),t=Me(n,s,a,r);return o?t?R(o,t):-1:t?1:e.localeCompare(n)}function nt(e,n){return x(U(e.relativePath))-x(U(n.relativePath))||e.relativePath.localeCompare(n.relativePath)||e.startLine-n.startLine}function Me(e,n,s,a){let r=n.get(e);if(r)return Se(r,s);let o=a.get(e);return o?dn(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 dn(e){return{symbol:e.symbol,label:W(e),leaf:e.leaf,file:e.relativePath,line:e.startLine,endLine:e.endLine,kind:e.isFunctionLike?"callable":e.isTypeLike?"type":"symbol",fileKind:U(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)||xe(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)||xe(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)||x(e.fileKind)-x(n.fileKind)||e.file.localeCompare(n.file)||e.line-n.line}function xe(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>=We))return r;for(let t of a)if(!r.some(i=>i.symbol===t.symbol)&&(r.push(t),r.length>=We))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)=>x(o.fileCandidates[0].fileKind)-x(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 nn(e,s)-nn(n,s)||x(e.fileKind)-x(n.fileKind)||n.symbolPhraseLength-e.symbolPhraseLength||se(e.kind)-se(n.kind)||R(e,n)}function nn(e,n){let s=e.matches.find(a=>a.term===n)?.sources??[];return Math.min(...s.map(Ee),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)||sn(e.kind)-sn(n.kind)||on(e)-on(n)||rn(e)-rn(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)||tn(n,s)-tn(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 tn(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 on(e){let n=e.keyAnchors.length>0?e.keyAnchors:e.roots;return Math.max(...n.map(s=>x(s.fileKind)))}function rn(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(ue(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 ue(e).filter(s=>n.has(s)).length}function sn(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(Fe(n.source))-j(Fe(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 De(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 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=De(e).map(_e),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 T(e){return new Set(De(e).flatMap(mn).filter(n=>n.length>=3))}function mn(e){let n=_e(e);return n.length>4&&n.endsWith("e")?[n,n.slice(0,-1)]:[n]}function _e(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")?an(n.slice(0,-2)):n.length>5&&n.endsWith("ing")?an(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 an(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}function cn(e){if(e.length===0)return[];let n=e.split(`
|
|
1
|
+
import{a as Ue}from"./chunk-CMXW7MFV.js";import{b as xe,c as Se}from"./chunk-CCRZLRWJ.js";import{c as ze}from"./chunk-I2KP4AGR.js";import{d as Te}from"./chunk-VVCBMH5O.js";import{i as Be}from"./chunk-U24M5RQM.js";import{c as We}from"./chunk-NK76RSB6.js";import{d as Xe,e as Ke,f as qe}from"./chunk-BH5CE4LN.js";import{a as z}from"./chunk-ZOEDRCR4.js";import{A as $e,d as te,i as oe,t as ge}from"./chunk-AM5SUGHF.js";import{f as Q}from"./chunk-JOALNFY3.js";import{x as we}from"./chunk-PLZXWZHY.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
|
+
`).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
|
-
`)&&n.pop(),n}function gt(e,n){return
|
|
5
|
-
//# sourceMappingURL=chunk-
|
|
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-LY2NB5XR.js.map
|