codebaseiq 0.1.0 → 0.3.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 +89 -0
- package/README.md +1 -1
- package/dist/augment-vue-worker.js +1 -1
- package/dist/{chunk-ZMI2JSX2.js → chunk-23C5AD3B.js} +2 -2
- package/dist/chunk-2E6OUPCF.js +2 -0
- package/dist/chunk-2EDX3JT5.js +3 -0
- package/dist/chunk-2I2UHZET.js +2 -0
- package/dist/{chunk-T3DGWPXM.js → chunk-2OMXFE64.js} +2 -2
- package/dist/chunk-2PRONPAS.js +3 -0
- package/dist/{chunk-GW6Z3WGY.js → chunk-356EZBIP.js} +2 -2
- package/dist/{chunk-UDS562V4.js → chunk-36JC5BG2.js} +2 -2
- package/dist/chunk-3RR2K7EZ.js +20 -0
- package/dist/{chunk-JE3WZ6II.js → chunk-3RSBGWGL.js} +2 -2
- package/dist/{chunk-VE5AVNMP.js → chunk-3VJ3OCRE.js} +2 -2
- package/dist/{chunk-FDGD5AB5.js → chunk-4LK5OIPW.js} +2 -2
- package/dist/chunk-5DSL3NT2.js +17 -0
- package/dist/chunk-5FWR5HLG.js +90 -0
- package/dist/chunk-5IC2WZAL.js +22 -0
- package/dist/{chunk-MVB3DAEY.js → chunk-5IZRKWTZ.js} +2 -2
- package/dist/{chunk-Q65CQ4XL.js → chunk-5LL4KEHO.js} +2 -2
- package/dist/chunk-5T44HG5Y.js +88 -0
- package/dist/{chunk-TRRC4ZJ7.js → chunk-5ZI2PPI7.js} +2 -2
- package/dist/{chunk-7XAN6GKB.js → chunk-67VJAYVR.js} +2 -2
- package/dist/{chunk-MOVBWNIP.js → chunk-6BF3VYEF.js} +2 -2
- package/dist/chunk-6JMAVFL4.js +3 -0
- package/dist/chunk-6O3KXIDL.js +2 -0
- package/dist/{chunk-JOIRNPPY.js → chunk-6VREELBC.js} +2 -2
- package/dist/chunk-6WAPPQ5F.js +82 -0
- package/dist/{chunk-FW53T7EB.js → chunk-75KJGYX7.js} +2 -2
- package/dist/chunk-7GAK2F3H.js +77 -0
- package/dist/{chunk-UBGWN7I4.js → chunk-7JELP5YE.js} +2 -2
- package/dist/chunk-7UCDGXRW.js +8 -0
- package/dist/{chunk-L57ZKWVG.js → chunk-AEXQYQD7.js} +2 -2
- package/dist/chunk-AQI4N64O.js +22 -0
- package/dist/{chunk-ICFDQHAM.js → chunk-AURCQHSG.js} +2 -2
- package/dist/{chunk-I2T2LLK2.js → chunk-BBP7HVBJ.js} +2 -2
- package/dist/{chunk-OFBE4NGP.js → chunk-BFBIMTCJ.js} +2 -2
- package/dist/{chunk-JEJLSICM.js → chunk-BGGB5N53.js} +2 -2
- package/dist/{chunk-TIIC3ZE7.js → chunk-BRQL7AFJ.js} +2 -2
- package/dist/{chunk-YSNONTJ2.js → chunk-BWL3PMPT.js} +2 -2
- package/dist/chunk-C6WKPKCF.js +127 -0
- package/dist/{chunk-YESXMKX3.js → chunk-C7OUW52M.js} +2 -2
- package/dist/chunk-C7QWUBR2.js +545 -0
- package/dist/{chunk-4WKDMDEW.js → chunk-CCIYWXX6.js} +2 -2
- package/dist/{chunk-FAJQ7LWY.js → chunk-CIYA2KZN.js} +2 -2
- package/dist/{chunk-VEXUL62T.js → chunk-CR3OG6SQ.js} +2 -2
- package/dist/{chunk-JSOYNVWH.js → chunk-CVHOQONG.js} +2 -2
- package/dist/{chunk-LU3BMVH2.js → chunk-CW6AXOLR.js} +2 -2
- package/dist/{chunk-TXXOEMZJ.js → chunk-D53LWANR.js} +2 -2
- package/dist/{chunk-DO6WQD2T.js → chunk-D62CTZX6.js} +2 -2
- package/dist/{chunk-N3IQCBCF.js → chunk-D7AZAOZX.js} +2 -2
- package/dist/{chunk-RDBI2RXU.js → chunk-D7DOB27N.js} +7 -7
- package/dist/chunk-DAKIGMIK.js +21 -0
- package/dist/chunk-DDN2F6GB.js +2 -0
- package/dist/chunk-DUKHVPU5.js +4 -0
- package/dist/chunk-DVWO7RBC.js +2 -0
- package/dist/{chunk-HKQUXIFO.js → chunk-E52K4L2W.js} +2 -2
- package/dist/chunk-EIBGSU2R.js +2 -0
- package/dist/chunk-EN4AHLL3.js +3 -0
- package/dist/chunk-EQNMD62X.js +51 -0
- package/dist/{chunk-ENCCHKM6.js → chunk-EXZ7VLRY.js} +4 -4
- package/dist/{chunk-NEDP5RFQ.js → chunk-F3QSL4W2.js} +2 -2
- package/dist/{chunk-O6QTXQPJ.js → chunk-F74LZWCE.js} +2 -2
- package/dist/{chunk-BH5F2Q4O.js → chunk-FEIZXBLH.js} +2 -2
- package/dist/chunk-FH5WG4LE.js +2 -0
- package/dist/{chunk-BVAJLC5A.js → chunk-FOZ74V56.js} +2 -2
- package/dist/{chunk-L4NRUAGJ.js → chunk-FQTIFWLR.js} +2 -2
- package/dist/chunk-FTTV7IRX.js +355 -0
- package/dist/chunk-FWQGH2N2.js +2 -0
- package/dist/{chunk-CAUCPUOF.js → chunk-GDHWOA57.js} +2 -2
- package/dist/{chunk-6MUIJMVL.js → chunk-GIDCP7KV.js} +2 -2
- package/dist/{chunk-ZV3JV5G5.js → chunk-GL6UTNUB.js} +2 -2
- package/dist/chunk-GP7C5VAE.js +2 -0
- package/dist/{chunk-FQKZWM4L.js → chunk-GQLDYCWS.js} +5 -5
- package/dist/chunk-GQXXOS55.js +2 -0
- package/dist/{chunk-H3LGFZVK.js → chunk-GUFPEFBG.js} +2 -2
- package/dist/{chunk-NNOKTMZT.js → chunk-GV2CEZCW.js} +2 -2
- package/dist/{chunk-FETNQCFO.js → chunk-GVAF222T.js} +2 -2
- package/dist/chunk-GWYZVVKY.js +21 -0
- package/dist/{chunk-7FND7D7N.js → chunk-HENP2O4A.js} +2 -2
- package/dist/{chunk-LZYFLFEH.js → chunk-HINZQKSY.js} +2 -2
- package/dist/{chunk-RR7SX44N.js → chunk-HQA7EBSK.js} +2 -2
- package/dist/{chunk-XMQ23E27.js → chunk-HVFB3PME.js} +2 -2
- package/dist/chunk-I22IZYDI.js +2 -0
- package/dist/chunk-ICUL7XRT.js +21 -0
- package/dist/{chunk-CQP3THUZ.js → chunk-IHSLIIL3.js} +2 -2
- package/dist/{chunk-34WBMAYK.js → chunk-ITSJMNUD.js} +2 -2
- package/dist/{chunk-PX4RYAAK.js → chunk-IZDPGOZR.js} +2 -2
- package/dist/chunk-J3GLP7Q5.js +3 -0
- package/dist/{chunk-CVYSU6BX.js → chunk-J7AMBVWF.js} +2 -2
- package/dist/{chunk-Y6KHROC3.js → chunk-JCMFBF4Z.js} +2 -2
- package/dist/chunk-JFIA2JI3.js +3 -0
- package/dist/chunk-JLZLLLW5.js +3 -0
- package/dist/{chunk-5PUWMSDU.js → chunk-JSNTHRLQ.js} +2 -2
- package/dist/{chunk-C6SBF2WH.js → chunk-JX6ZWDOS.js} +2 -2
- package/dist/{chunk-4XTAUQFD.js → chunk-JYI7CV25.js} +2 -2
- package/dist/chunk-K7JLSGCJ.js +8 -0
- package/dist/{chunk-XWUOUWYI.js → chunk-KPZGTB2O.js} +2 -2
- package/dist/{chunk-VXYS3FZD.js → chunk-LKUTSP4G.js} +2 -2
- package/dist/{chunk-GTXSJDCO.js → chunk-LMTSB3TB.js} +2 -2
- package/dist/chunk-LONKINMJ.js +543 -0
- package/dist/{chunk-WMPRTGH2.js → chunk-LQHYYIOB.js} +2 -2
- package/dist/{chunk-VUIYB2V3.js → chunk-LZSQ6X7E.js} +2 -2
- package/dist/{chunk-ST7V3SKN.js → chunk-M2Y6PCFE.js} +2 -2
- package/dist/chunk-MEUHIDI3.js +7 -0
- package/dist/{chunk-OZYRSMSH.js → chunk-MHWMEZDA.js} +2 -2
- package/dist/{chunk-RKEJ6VTF.js → chunk-MQW6SJ4P.js} +2 -2
- package/dist/{chunk-J77SU6VA.js → chunk-MSI3K7PJ.js} +2 -2
- package/dist/chunk-MVRGB4KJ.js +278 -0
- package/dist/{chunk-DQMDCD24.js → chunk-MZNMASFM.js} +2 -2
- package/dist/{chunk-ID63777H.js → chunk-NBCQZSGR.js} +2 -2
- package/dist/chunk-NBZKSTXP.js +2 -0
- package/dist/{chunk-SZD2KF7Q.js → chunk-NCJILOAK.js} +2 -2
- package/dist/{chunk-C7QOQX32.js → chunk-NDKOVQFG.js} +2 -2
- package/dist/{chunk-UNBY47BC.js → chunk-NEWHKGVD.js} +2 -2
- package/dist/{chunk-PYAB5SM6.js → chunk-O2M3VNDY.js} +2 -2
- package/dist/chunk-OFGOOL6U.js +3 -0
- package/dist/{chunk-SWHMHUKF.js → chunk-OQUCBKOI.js} +2 -2
- package/dist/{chunk-7MGU3HPH.js → chunk-P4NVCOM7.js} +2 -2
- package/dist/{chunk-ANFVSJWQ.js → chunk-PFC44E6D.js} +2 -2
- package/dist/{chunk-EZNMUY67.js → chunk-PHNCEUXX.js} +2 -2
- package/dist/{chunk-4FC325IF.js → chunk-PTQPPPG2.js} +2 -2
- package/dist/chunk-PUVNH4PO.js +3 -0
- package/dist/chunk-Q23IMHXS.js +343 -0
- package/dist/chunk-Q3ZCQY2Y.js +3 -0
- package/dist/{chunk-KMITESMT.js → chunk-Q4XEU3UH.js} +2 -2
- package/dist/{chunk-QKPLA6IC.js → chunk-QEOWONKY.js} +2 -2
- package/dist/{chunk-BJ6SQAEN.js → chunk-QMOZZ2VX.js} +2 -2
- package/dist/chunk-RCIGX23V.js +60 -0
- package/dist/{chunk-IOP6FWIM.js → chunk-RIYJ4L33.js} +2 -2
- package/dist/chunk-RJVAPMHF.js +14 -0
- package/dist/chunk-SB7NASHU.js +2 -0
- package/dist/{chunk-UZGZB3VB.js → chunk-SGMNWYTH.js} +2 -2
- package/dist/chunk-SMDIEDM4.js +27 -0
- package/dist/chunk-SV2LEFVM.js +2 -0
- package/dist/chunk-SX72EVMY.js +3 -0
- package/dist/chunk-T5X7DK6C.js +3 -0
- package/dist/{chunk-6NW7MU72.js → chunk-T6MQNNAC.js} +2 -2
- package/dist/chunk-T75DS2E6.js +21 -0
- package/dist/{chunk-HRWGYWRJ.js → chunk-TEANKHUU.js} +2 -2
- package/dist/chunk-TJBOJUVN.js +3 -0
- package/dist/{chunk-XLQ3GLWZ.js → chunk-TJWVT4DO.js} +2 -2
- package/dist/{chunk-7NVGT435.js → chunk-TNJGTQWO.js} +2 -2
- package/dist/{chunk-NE6IU5ZD.js → chunk-TOTWJZIX.js} +2 -2
- package/dist/{chunk-PBI2LFKH.js → chunk-TPO7XC5Z.js} +2 -2
- package/dist/{chunk-HPJRBHVT.js → chunk-U33PMPNW.js} +2 -2
- package/dist/{chunk-QHRNXP3C.js → chunk-U7NUXDQO.js} +2 -2
- package/dist/chunk-UC2FD2PS.js +4 -0
- package/dist/{chunk-PIOMTC27.js → chunk-UQE4XFSA.js} +2 -2
- package/dist/chunk-UQYQBLJX.js +5 -0
- package/dist/{chunk-KWVHSKHK.js → chunk-USOAJHY7.js} +2 -2
- package/dist/{chunk-GCHRX4YW.js → chunk-UW6KD57C.js} +2 -2
- package/dist/{chunk-PTAWHLVJ.js → chunk-VGWZ4MOY.js} +2 -2
- package/dist/{chunk-XME3HPXZ.js → chunk-VWYGCMV5.js} +2 -2
- package/dist/{chunk-AKB7V7TV.js → chunk-W7YLRXZE.js} +2 -2
- package/dist/{chunk-SYDJMPES.js → chunk-WK2IQJPK.js} +2 -2
- package/dist/{chunk-RBAS5ZHI.js → chunk-WWCV4E6J.js} +2 -2
- package/dist/{chunk-OL6KJP3N.js → chunk-XMJ53WG4.js} +2 -2
- package/dist/chunk-XN3EKMLI.js +4 -0
- package/dist/chunk-XQAVQVIL.js +3 -0
- package/dist/{chunk-IJ4HMYBE.js → chunk-XQPPURLQ.js} +2 -2
- package/dist/{chunk-OVTS4DKB.js → chunk-YHPG3S2U.js} +2 -2
- package/dist/{chunk-WOQBZPIF.js → chunk-YRKP7PM7.js} +2 -2
- package/dist/chunk-YT4DVWUV.js +11 -0
- package/dist/chunk-YTJHCGYB.js +61 -0
- package/dist/chunk-Z35GOVEH.js +2 -0
- package/dist/{chunk-OLF4MA5W.js → chunk-Z6RL7XOE.js} +4 -4
- package/dist/{chunk-UP3BUZR5.js → chunk-ZAFGY22Q.js} +2 -2
- package/dist/{chunk-CO5R3UNA.js → chunk-ZB4C5TTR.js} +2 -2
- package/dist/{chunk-ZZXSWSN6.js → chunk-ZNH33XIB.js} +2 -2
- package/dist/{chunk-EMNIHCRB.js → chunk-ZQ62NNKN.js} +2 -2
- package/dist/cli-context-FJL2JHOE.js +3 -0
- package/dist/cli-context-PQNWHMCQ.js +2 -0
- package/dist/cli-program-UO7PZD6V.js +7 -0
- package/dist/cli.js +1 -1
- package/dist/{code-DlqpBDd0.d.ts → code-DfX3xeWy.d.ts} +1 -1
- package/dist/code-viewer-KIXEYQNJ.js +12 -0
- package/dist/code-viewer-VHLBLIUM.js +11 -0
- package/dist/command-descriptors-F5P2V3NW.js +335 -0
- package/dist/command-descriptors-YCLATF5I.js +337 -0
- package/dist/{config-types-BNoC96J3.d.ts → config-types-D6X5S68_.d.ts} +50 -0
- package/dist/{db-D7sauVFH.d.ts → db-BoG_PWYH.d.ts} +2 -2
- package/dist/direct-navigation-4XJTXIDT.js +2 -0
- package/dist/direct-navigation-J5MVYYAD.js +3 -0
- package/dist/{graph-evidence-BIFqyisO.d.ts → graph-evidence-D1jx1Cql.d.ts} +1 -1
- package/dist/{health-DJaZXg8I.d.ts → health-DkYBS5BI.d.ts} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/invocation-command-descriptors-RWV4VAI4.js +2 -0
- package/dist/invocation-command-descriptors-U76PN7IY.js +3 -0
- package/dist/{scip-cli-B7N3haxa.d.ts → maintenance-types-CdL5eQii.d.ts} +2 -21
- package/dist/output-continuation-command-BL25S26S.js +3 -0
- package/dist/output-continuation-command-BTETTXEC.js +2 -0
- package/dist/postinstall.js +1 -1
- package/dist/project-reindex-CRJU3IFG.js +2 -0
- package/dist/project-reindex-TQFCOA2O.js +3 -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 +2 -2
- package/dist/reindex.d.ts +3 -5
- package/dist/reindex.js +72 -33
- package/dist/runtime.d.ts +23 -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/sentinel-ensure-command-OSWGCFFL.js +3 -0
- package/dist/sentinel-ensure-command-SPW7XQLB.js +2 -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/INDEX_GENERATIONS.md +2 -2
- package/docs/NPM_RELEASE.md +323 -0
- package/docs/schemas/npm-release-state.schema.json +4 -13
- package/docs/schemas/project-config.schema.json +159 -0
- package/package.json +10 -14
- 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-2Q2LW5JW.js +0 -14
- 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-6BQ3DSPK.js +0 -2
- package/dist/chunk-6CS3UQTN.js +0 -3
- package/dist/chunk-6OAHRI2D.js +0 -6
- 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-EF2R3WNQ.js +0 -2
- 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-NCZUNH3E.js +0 -109
- package/dist/chunk-NNJ2KZZG.js +0 -4
- package/dist/chunk-NNO6A2PO.js +0 -2
- package/dist/chunk-OGTFJ3XD.js +0 -2
- package/dist/chunk-Q5ELPRKQ.js +0 -2
- package/dist/chunk-Q72QSKXC.js +0 -308
- 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-SMRBZ6EC.js +0 -2
- package/dist/chunk-SNNWPCN7.js +0 -4
- package/dist/chunk-TFZB6XTM.js +0 -239
- package/dist/chunk-UCD3H3UZ.js +0 -5
- package/dist/chunk-UXM43C7T.js +0 -3
- package/dist/chunk-VFY6Y2H6.js +0 -61
- package/dist/chunk-WE5RZHZ7.js +0 -5
- package/dist/chunk-YMGZZEW4.js +0 -2
- package/dist/chunk-YVCIMIOC.js +0 -12
- package/dist/chunk-Z54RD7VL.js +0 -3
- package/dist/chunk-ZKX2FRS6.js +0 -15
- 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
- package/docs/WINDOWS_SIDECAR_RELEASE.md +0 -424
- package/docs/schemas/windows-sidecar-provenance.schema.json +0 -137
- package/scripts/build-codebaseiq-windows.mjs +0 -197
- package/scripts/codebaseiq-windows-provenance.mjs +0 -364
- package/scripts/verify-codebaseiq-windows.mjs +0 -29
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d}from"./chunk-OTOKVOJ3.js";import{M as p}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{d}from"./chunk-OTOKVOJ3.js";import{M as p}from"./chunk-ICUL7XRT.js";function y(t,e={}){let{minTotalLines:i=800,minTemplateLines:n=300,minScriptLines:r=300,minStyleLines:u=500,limit:o=20,scope:a,scanLimit:l,filePattern:m}=e;return p(t).vueProfiles({scope:a,scanLimit:l}).filter(s=>!m||s.file.includes(m)).map(s=>L(s,{minTotalLines:i,minTemplateLines:n,minScriptLines:r,minStyleLines:u})).filter(s=>s!==null).sort((s,c)=>c.totalLines-s.totalLines||s.file.localeCompare(c.file)).slice(0,o)}function L(t,e){let i=d(t,b(e),"total"),{reasons:n}=i;if(n.length===0)return null;let r=i.dominantPressure,u=i.pressureKinds.includes("total")?[...new Set([...i.pressureKinds,r])]:i.pressureKinds,o=g(t.file),a=x(r,o),l=t.totalLines+t.delegatedComposableLines;return{file:t.file,totalLines:l,sfcLines:t.sfcLines,templateLines:t.templateLines,scriptLines:t.scriptLines,styleLines:t.styleLines,externalScriptLines:t.externalScriptLines,externalScriptPaths:t.externalScriptPaths,customBlockLines:t.customBlockLines,delegatedComposableLines:t.delegatedComposableLines,delegatedComposablePaths:t.delegatedComposablePaths,dominantPressure:r,pressureKinds:u,contextKind:o,recommendationKind:a,recommendation:f(a,o),reasons:n,loc:l}}function b(t){return[{axis:"total",value:e=>e.totalLines+e.delegatedComposableLines,qualifies:(e,i)=>i>=t.minTotalLines,reason:(e,i)=>e.delegatedComposableLines>0?`${i} total line(s) (${e.totalLines} component + ${e.delegatedComposableLines} delegated composable line(s) across ${e.delegatedComposablePaths.length} file(s))`:`${i} total component line(s)`,dominantEligible:!1},{axis:"template",value:e=>e.templateLines,qualifies:(e,i)=>i>=t.minTemplateLines,reason:(e,i)=>`${i} template line(s)`},{axis:"script",value:e=>e.scriptLines-e.externalScriptLines,qualifies:e=>e.scriptLines>=t.minScriptLines,reason:e=>`${e.scriptLines} script line(s)`},{axis:"style",value:e=>e.styleLines,qualifies:(e,i)=>i>=t.minStyleLines,reason:(e,i)=>`${i} style line(s)`},{axis:"external-script",value:e=>e.externalScriptLines,qualifies:(e,i)=>i>=t.minScriptLines},{axis:"custom-block",value:e=>e.customBlockLines,qualifies:()=>!1}]}function g(t){return t.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).some(n=>w.has(n))||/(?:view|page|route)\.vue$/i.test(t)||/(?:^|\/)(views|pages|routes)\//i.test(t)?"route-page":"component"}function x(t,e){return t==="style"?"style-decomposition":t==="template"?"template-decomposition":t==="external-script"?"external-script-boundary":t==="custom-block"?"custom-block-review":e==="route-page"?"route-page-decomposition":t==="script"?"script-behavior-extraction":"total-size-review"}function f(t,e){switch(t){case"template-decomposition":return e==="route-page"?"Split route template sections into named panels before extracting script behavior.":"Split repeated template sections into named presentational components.";case"script-behavior-extraction":return"Extract independent script behavior into composables, controllers, or feature modules.";case"style-decomposition":return"Review UI/style decomposition; move repeated styling to component or style primitives, not composables.";case"external-script-boundary":return"Review the external script boundary and split controller/composable modules by workflow.";case"custom-block-review":return"Review custom block ownership before splitting template or script code.";case"route-page-decomposition":return"Split route/page orchestration from reusable panels and feature controllers.";case"total-size-review":return"Review the largest block first, then split by the dominant reason to change."}}var w=new Set(["landing","page","pages","route","routes","view","views"]);export{y as a};
|
|
2
|
+
//# sourceMappingURL=chunk-ZNH33XIB.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as S}from"./chunk-
|
|
1
|
+
import{c as S}from"./chunk-LQHYYIOB.js";import{c as m}from"./chunk-HENP2O4A.js";import{h as y}from"./chunk-J3GLP7Q5.js";import{a as h}from"./chunk-BRQL7AFJ.js";import{p}from"./chunk-F74LZWCE.js";import{a as g}from"./chunk-ICUL7XRT.js";import f from"path";function W(e,t){let{scope:i,minDeviation:r=5,limit:n=50}=t??{},a=t?.semantic!==!1,u=t?.includePatternDeviations===!0,o=new m(e).fileDependencyGraph(i),l=S(e,{scope:i}),c=x([...D(e,o,{scope:i,semantic:a}),...R(l.forbiddenEdges),...u?E(o,r):[]]);return t?.includeArchitecture===!0&&(c.architecture=l),n<=0||c.results.length<=n?c:{...c,results:c.results.slice(0,n),totalResults:c.results.length}}function D(e,t,i){let r=_(e,i.scope),n=[],a=new Set;for(let[s,o]of t){if(d(s))continue;let l=r.get(s)??new Set;for(let c of o)d(c)||l.has(c)||v(e,s,c,i)||(n.push({file:s,dep:c}),a.add(s))}a.size>0&&w(e,r,{paths:[...a]});let u=[];for(let{file:s,dep:o}of n)(r.get(s)??new Set).has(o)||u.push({file:s,kind:"unused-import",description:`Depends on ${o} but references none of its symbols`,dep:o,actionTier:"direct",evidenceReasons:[`dependency edge exists from ${s} to ${o}`,"no semantic, source, type-only, side-effect, or Vue-template usage survived the conservative skip gates"],recommendation:"Remove the unused import or dependency edge after running the project checks."});return u}function v(e,t,i,r){return C(e,t,i)||M(e,t,i)||O(i)||P(e,t,i)||N(i)?!0:r.semantic&&A(e,t,i)}function R(e){return e.flatMap(t=>{let i=t.examples[0];return i?[{file:i.fromFile,kind:"architecture-violation",description:`${t.from} depends on forbidden boundary ${t.to} through ${t.fileEdgeCount} file edge(s)`,dep:i.toFile,detail:`${t.from} may not depend on ${t.to}`,actionTier:"direct",policyBasis:"explicit",architecture:{fromBoundary:t.from,toBoundary:t.to,fileEdgeCount:t.fileEdgeCount,importerCount:t.importerCount,importedFileCount:t.importedFileCount,examples:t.examples},evidenceReasons:[`configured dependency row for ${t.from} does not allow ${t.to}`,`${t.fileEdgeCount} file edge(s) connect ${t.importerCount} importer(s) to ${t.importedFileCount} imported file(s)`,...t.examples.map(r=>`${r.fromFile} imports ${r.toFile}`)],recommendation:"Move the dependency behind an allowed boundary, reverse the dependency through an owned interface, or deliberately update the project architecture rule."}]:[]})}function E(e,t){let i=[];for(let[r,n]of k(e)){let a=n.filter(s=>!d(s));if(a.length<t)continue;let u=I(e,a);for(let s of a)for(let o of e.get(s)??[])d(o)||(u.get(o)??0)===1&&f.dirname(o)!==r&&f.dirname(o)!==f.dirname(r)&&i.push({file:s,kind:"pattern-deviation",description:`Only file in ${r}/ that depends on ${o}`,dep:o,actionTier:"signal",evidenceReasons:[`${a.length} sibling file(s) in ${r}/ were compared`,`${s} is the only non-skipped sibling depending on ${o}`],recommendation:"Review sibling ownership before changing this import; unique dependency shape can be intentional specialization."})}return i}function x(e){let t=e.filter(i=>i.kind==="architecture-violation").length;return{results:e,unusedImports:e.filter(i=>i.kind==="unused-import").length,architectureViolations:t,layerViolations:t,patternDeviations:e.filter(i=>i.kind==="pattern-deviation").length}}function k(e){let t=new Map;for(let i of e.keys()){let r=f.dirname(i),n=t.get(r);n||(n=[],t.set(r,n)),n.push(i)}return t}function I(e,t){let i=new Map;for(let r of t)for(let n of e.get(r)??[])d(n)||i.set(n,(i.get(n)??0)+1);return i}function _(e,t){let i=new Map;return $(e,i,t),i}function $(e,t,i){for(let r of F(e,i))b(e,t,r.from_file,r.to_file)}function F(e,t){let i=t?"AND d1.relative_path LIKE ?":"",r=t?[`%${t}%`]:[];return e.all(`SELECT DISTINCT d1.relative_path AS from_file, d2.relative_path AS to_file
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents d1 ON c.document_id = d1.id
|
|
@@ -15,4 +15,4 @@ import{c as S}from"./chunk-WMPRTGH2.js";import{c as m}from"./chunk-7FND7D7N.js";
|
|
|
15
15
|
AND m.role != 1
|
|
16
16
|
${e.pathExclusionsFor("d1","d2")}
|
|
17
17
|
${i}`,...r)}function w(e,t,i={}){new m(e).scanSourceReferences({paths:i.paths??g(e,{includeIgnored:!1}),includeRustAttributeNames:!0,identifierResolution:"permissive"},n=>{n.target.relativePath!==n.sourceFile&&(e.isIgnored(n.target.relativePath)||b(e,t,n.sourceFile,n.target.relativePath))})}function b(e,t,i,r){if(e.isIgnored(i)||e.isIgnored(r))return;let n=t.get(i);n||(n=new Set,t.set(i,n)),n.add(r)}function O(e){return e.includes("types")||e.endsWith(".d.ts")}function A(e,t,i){let r=y(e,t).filter(n=>n.sourcePath===i);return r.length>0&&r.some(n=>n.isUsed)}function C(e,t,i){let r=p(e,t).filter(n=>n.sourcePath===i);return r.length>0&&r.some(n=>n.used)}function M(e,t,i){let r=p(e,t).filter(n=>n.sourcePath===i);return r.length>0&&r.every(n=>n.isTypeOnly===!0)}function N(e){return e.endsWith(".vue")}function P(e,t,i){let r=p(e,t).filter(n=>n.sourcePath===i);return r.length===0?!1:r.every(n=>n.kind==="side-effect"||n.kind==="namespace"&&n.usedMembers.length===0&&!n.used)}function d(e){let t=h(e);return!!(t==="entry"||t==="barrel"||t==="test"||t==="worker"||T(f.basename(e)))}function T(e){return!!(e==="index.ts"||e==="index.js"||e==="cli.ts"||e==="main.ts"||e==="main.rs"||e.includes("worker.")||e.includes("postinstall.")||e==="health.ts"||e==="health.js")}export{W as a};
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
18
|
+
//# sourceMappingURL=chunk-ZQ62NNKN.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{$ as b,_ as a,aa as c,ba as d,ca as e,da as f,ea as g,fa as h,ga as i,ha as j,ia as k,ja as l,ka as m,la as n,ma as o,na as p}from"./chunk-7UCDGXRW.js";import"./chunk-5T44HG5Y.js";import"./chunk-DUKHVPU5.js";export{b as activateCliProjectContext,n as collect,c as currentCliDatabase,o as formatBytes,p as formatStatus,i as openDb,j as openProjectDb,f as prepareWorktreeIndex,h as residentQueryLaneEligible,e as resolveActiveDbPath,d as resolveCliProjectContext,a as resolveProjectRoot,k as rootIndexFallbackWarning,l as setResidentDatabaseProvider,g as sharedCachePreparationEligible,m as withDb};
|
|
3
|
+
//# sourceMappingURL=cli-context-FJL2JHOE.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{da as a,ea as b,fa as c,ga as d,ha as e,ia as f,ja as g,ka as h,la as i,ma as j,na as k,oa as l,pa as m,qa as n,ra as o,sa as p}from"./chunk-MEUHIDI3.js";import"./chunk-T75DS2E6.js";import"./chunk-RCIGX23V.js";import"./chunk-D7DOB27N.js";import"./chunk-R2NOK63J.js";import"./chunk-6O3KXIDL.js";import"./chunk-UQYQBLJX.js";export{b as activateCliProjectContext,n as collect,c as currentCliDatabase,o as formatBytes,p as formatStatus,i as openDb,j as openProjectDb,f as prepareWorktreeIndex,h as residentQueryLaneEligible,e as resolveActiveDbPath,d as resolveCliProjectContext,a as resolveProjectRoot,k as rootIndexFallbackWarning,l as setResidentDatabaseProvider,g as sharedCachePreparationEligible,m as withDb};
|
|
2
|
+
//# sourceMappingURL=cli-context-PQNWHMCQ.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{c as K}from"./chunk-2EDX3JT5.js";import{c as Q}from"./chunk-B3UYV66Z.js";import{a as J}from"./chunk-TJBOJUVN.js";import{a as h}from"./chunk-Q3ZCQY2Y.js";import"./chunk-362QOSFD.js";import{c as F,d as H,e as q,f as W,g as B,h as G}from"./chunk-JLZLLLW5.js";import{j as _,l as V,n as U}from"./chunk-AQI4N64O.js";import{p as L,q as z}from"./chunk-5IC2WZAL.js";import"./chunk-C7QWUBR2.js";import"./chunk-B2OB55RR.js";import{a as v,b as I}from"./chunk-XZEE23VG.js";import{$ as p,N as A,O as R,_ as j,ba as $,ea as k,ka as T}from"./chunk-7UCDGXRW.js";import{e as M}from"./chunk-FTTV7IRX.js";import"./chunk-D62CTZX6.js";import{aa as P,ba as O,ca as N,da as S,ea as D,l as s}from"./chunk-5T44HG5Y.js";import{d as E,r as x}from"./chunk-DUKHVPU5.js";import{Command as Pe,Help as Oe}from"commander";import{Option as se}from"commander";function y(e){return e.evidence?e.evidence:ae.has(e.id)?"mixed":e.heuristic?"heuristic":"graph-fact"}var ae=new Set(["health","context","co-change"]);function X(e){if(e.claims){if(e.claims.origin==="mixed"&&!e.claims.families?.length)throw new Error(`Mixed command ${e.id} must declare at least one claim family.`);return e.claims}let t=y(e);if(t==="mixed")throw new Error(`Mixed command ${e.id} must declare claim families.`);let n=e.agent?H(e.agent.operation):[];return n.length>0&&n.every(o=>o==="repository-observation"||o==="repository-preview")?{origin:t==="heuristic"?"heuristic":"compiler-graph",observedSources:["index-generation"],producerValidation:{status:"not-evaluated"}}:{origin:"unknown",observedSources:["process"],producerValidation:{status:"not-evaluated"}}}var Y;function Z(){return Y||{argv:process.argv.slice(2),execPath:process.execPath,...process.argv[1]!==void 0?{scriptPath:process.argv[1]}:{},cwd:process.cwd()}}function ee(e,t){return W(new Map(t.map(n=>[n.id,y(n)]))),G(new Map(t.map(n=>[n.id,X(n)]))),B(new Map(t.flatMap(n=>n.agent?[[n.id,{...n.agent,resultUnits:me(n)}]]:[]))),t.map(n=>{let i=n.hidden?e.command(n.command,{hidden:!0}):e.command(n.command);i.description(n.description),n.helpAfter&&i.addHelpText("after",`
|
|
3
|
+
${n.helpAfter.trim()}
|
|
4
|
+
`);for(let o of n.arguments??[])i.argument(o.name);for(let o of n.options??[])if(o.hidden){let r=new se(o.flags,o.description).hideHelp();o.parser&&r.argParser(o.parser),Object.hasOwn(o,"defaultValue")&&r.default(o.defaultValue),i.addOption(r)}else o.parser&&Object.hasOwn(o,"defaultValue")?i.option(o.flags,o.description,o.parser,o.defaultValue):o.parser?i.option(o.flags,o.description,o.parser):Object.hasOwn(o,"defaultValue")?i.option(o.flags,o.description,o.defaultValue):i.option(o.flags,o.description);return i.action(async(...o)=>{try{let r=i.optsWithGlobals();ce(r);let a=Z(),d=()=>n.id===_?n.handler(...o):V({command:n.id,producerVersion:s,invocationPrefix:a.scriptPath?[a.execPath,a.scriptPath]:["codebaseiq"],argv:[...a.argv],cwd:a.cwd,json:r.json===!0,sourceSession:r.session!==!1,reemitSource:r.reemit===!0,...typeof r.outputPageSize=="number"?{pageSize:r.outputPageSize}:{},...typeof r.outputCursor=="string"?{cursor:r.outputCursor}:{}},()=>n.handler(...o)),c=n.agent?F(n.agent.operation,{args:o.slice(0,-1),options:r}):void 0;await(c?q(c,d):d())}catch(r){de(r)}finally{p(void 0),R()}}),{descriptor:n,command:i}})}function ce(e){if(e.resultOnly===!0&&e.json!==!0)throw new Error("--result-only requires --json.");if(e.compact===!0&&e.json!==!0)throw new Error("--compact requires --json.")}function me(e){let t=e.agent?.resultUnits;if(t?.kind==="field"&&t.field.trim()==="")throw new Error(`Command ${e.id} declares an empty result-unit field.`);return t||(e.renderShape==="list"||e.renderShape==="table"||e.renderShape==="grouped-by-file"?{kind:"rows"}:{kind:"report"})}function de(e){let t=e instanceof Error?e.message:String(e);console.error(`error: ${I(t)}`),process.exitCode=1}import{existsSync as le,mkdirSync as pe,writeFileSync as ue}from"fs";import{homedir as fe}from"os";import{join as g}from"path";var he=1440*60*1e3,ne="update-check.json",ge="https://registry.npmjs.org/codebaseiq/latest";async function oe(e={}){let t=e.env??process.env;if(t.CODEBASEIQ_UPDATE_CHECK==="0"||t.NO_UPDATE_NOTIFIER)return;let n=e.cacheDir??ye(t),i=e.now??Date.now(),o=e.currentVersion??s,r=be(n),a=r&&i-r.checkedAt<he?r.latestVersion:await we(n,e.fetchLatestVersion??xe,i);if(!a||!ve(a,o))return;(e.writeNotice??(c=>console.error(c)))(Ce(o,a))}function Ce(e,t){return[`codebaseiq update available: ${e} -> ${t}.`,"Agent: tell your human to update with: npm install -g codebaseiq@latest",""].join(`
|
|
5
|
+
`)}function ve(e,t){let n=te(e),i=te(t);if(!n||!i)return e!==t;for(let o=0;o<n.length;o++){let r=n[o]-i[o];if(r>0)return!0;if(r<0)return!1}return!1}function ye(e){let t=e.XDG_CACHE_HOME||g(fe(),".cache");return g(t,"codebaseiq")}function be(e){let t=g(e,ne);if(!le(t))return null;try{let n=JSON.parse(x(t,"update notice cache"));return typeof n.checkedAt=="number"&&(typeof n.latestVersion=="string"||n.latestVersion===null)?{checkedAt:n.checkedAt,latestVersion:n.latestVersion}:null}catch{return null}}async function we(e,t,n){let i;try{i=await t()}catch{i=null}return Ee(e,{checkedAt:n,latestVersion:i}),i}function Ee(e,t){try{pe(e,{recursive:!0}),ue(g(e,ne),`${JSON.stringify(t,null,2)}
|
|
6
|
+
`)}catch{}}async function xe(){let e=await fetch(ge,{signal:AbortSignal.timeout(1e3)});if(!e.ok)return null;let t=await e.json();return typeof t.version=="string"?t.version:null}function te(e){let t=/^v?(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(e);return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}async function ct(e={}){let t=new Pe;e.resident&&t.exitOverride(),e.terminalOutput&&t.configureOutput({writeOut:o=>process.stdout.write(v(o)),writeErr:o=>process.stderr.write(v(o))}),t.name("codebaseiq").description("Language-agnostic code intelligence CLI powered by SCIP indexes").version(s).option("--output-page-size <characters>","Return bounded output pages with an exact continuation command",U).option("--output-cursor <cursor>","Continue a bounded output page").option("--no-session","Disable the explicit exploration evidence ledger").option("--reemit","Recovery only: render source and graph evidence again instead of citing session receipts").option("--help-all","Display every command, including compatibility and deprecated controls");let n=await K(e.invocationCommand);ee(t,n);let i=new Oe;return t.configureHelp({formatHelp:(o,r)=>o===t?Q(t,n):i.formatHelp(o,r)}),t.hook("preAction",async(o,r)=>{let a=r.name();if(e.resident){await e.resident.preAction(a);return}let d=k(a),c=L(a);if(!d&&!c){ie(),await re(a);return}let m=j(),u=E(m);A(u);let C=$(m,u);p(C),ie(),await re(a);let{config:b,paths:w}=C;if(d){let l=await J({commandName:a,projectRoot:m,config:b,paths:w,dbPathSource:C.dbPathSource,gitContext:u});process.env.CODEBASEIQ_DEBUG&&console.error(`evidence-freshness: ${l.source}`),l.service.kind==="failed"&&console.error(`warning: codebaseiq watch service did not start: ${l.service.message}`),(l.service.kind==="failed"||l.service.kind==="skipped")&&h(m,s);return}if(!c){h(m,s);return}let f=z({commandName:a,projectRoot:m,cacheDir:w.cacheDir,cliVersion:s,config:b,gitContext:u});f.kind==="failed"&&console.error(`warning: codebaseiq watch service did not start: ${f.message}`),(f.kind==="failed"||f.kind==="skipped")&&h(m,s)}),t.hook("postAction",()=>p(void 0)),{program:t,descriptors:n}}async function re(e){e.startsWith("__")||await oe({commandName:e})}function ie(){if(N(),!P()||S())return;let e=null;try{e=T(t=>M(t))}catch{}D({command:O()??`codebaseiq ${process.argv.slice(2).join(" ")}`,toolVersion:s,projectFingerprint:e})}export{ct as createCliProgram};
|
|
7
|
+
//# sourceMappingURL=cli-program-UO7PZD6V.js.map
|
package/dist/cli.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{b as n}from"./chunk-
|
|
2
|
+
import{b as n}from"./chunk-JFIA2JI3.js";import{d as s}from"./chunk-XZEE23VG.js";import"./chunk-D62CTZX6.js";import"./chunk-DUKHVPU5.js";import{realpathSync as p}from"fs";import{fileURLToPath as y}from"url";import{constants as a,setPriority as u}from"os";var m="CODEBASEIQ_PROCESS_PRIORITY";function P(r=process.env){let o=r[m]?.trim().toLowerCase();return o==="low"||o==="idle"?o:null}function c(r=process.env,o=u){let e=P(r);if(e===null)return null;let t=e==="idle"?a.priority.PRIORITY_LOW:a.priority.PRIORITY_BELOW_NORMAL;try{o(t)}catch{}return e}f()&&(c(),s(),await d());async function d(){let r=process.argv.includes("--help-all");if(!r){let i=await n(process.argv.slice(2));if(i.served)return;process.env.CODEBASEIQ_DEBUG&&console.error(`query-lane: ${i.reason}`)}let{normalizeLegacyEvidenceInvocation:o}=await import("./invocation-command-descriptors-U76PN7IY.js");o(process.argv);let{createCliProgram:e}=await import("./cli-program-UO7PZD6V.js"),{program:t,descriptors:l}=await e({...process.argv[2]!==void 0?{invocationCommand:process.argv[2]}:{},terminalOutput:!0});if(r){let{renderRootCommandHelp:i}=await import("./command-panels-SZONPMLJ.js");process.stdout.write(i(t,l,{includeCompatibility:!0}));return}await t.parseAsync()}function f(){if(!process.argv[1])return!1;let r=y(import.meta.url);try{return p(r)===p(process.argv[1])}catch{return r===process.argv[1]}}
|
|
3
3
|
//# sourceMappingURL=cli.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { S as SourceObservationFreshness } from './repository-text-C0Q8VYdN.js';
|
|
2
|
-
import { S as ScipDatabase } from './db-
|
|
2
|
+
import { S as ScipDatabase } from './db-BoG_PWYH.js';
|
|
3
3
|
import { OutlineNode } from './queries/outline.js';
|
|
4
4
|
|
|
5
5
|
interface BindingDefinitionEvidence {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as ke}from"./chunk-TJBOJUVN.js";import{a as Me,b as Fe}from"./chunk-5DSL3NT2.js";import{r as xe}from"./chunk-5IC2WZAL.js";import{H as ee,X as Ee,f as ve,v as Re,w as Z}from"./chunk-C7QWUBR2.js";import"./chunk-B2OB55RR.js";import"./chunk-XZEE23VG.js";import{K as ge,_ as be,a as I,b as pe,ba as X,c as me,ha as he}from"./chunk-7UCDGXRW.js";import"./chunk-EN4AHLL3.js";import{Ha as Se,ca as Q,ga as q,ha as C,ia as U,k as O,m as ye,ta as we}from"./chunk-FTTV7IRX.js";import"./chunk-D62CTZX6.js";import{E as ue,F as le,X as de,Z as fe,l as z}from"./chunk-5T44HG5Y.js";import{d as oe,i as Y,j as se,k as ie,p as ae,r as ce}from"./chunk-DUKHVPU5.js";import{rmSync as En}from"fs";import{createConnection as xn}from"net";import{basename as Mn,join as Fn,resolve as dt}from"path";import{spawn as wt}from"child_process";var St=/^https?:\/\//iu,vt=2e3;function Le(e,t={}){let n=t.platform??process.platform,r=t.env??process.env;if(!St.test(e))return Promise.resolve({launched:!1});if(Et(r.CI))return Promise.resolve({launched:!1});if(n!=="win32"&&n!=="darwin"&&!r.DISPLAY&&!r.WAYLAND_DISPLAY)return Promise.resolve({launched:!1});let{command:s,args:o}=Rt(n,e);return new Promise(i=>{let a;try{a=(t.spawn??wt)(s,o,{detached:!0,stdio:"ignore",windowsHide:!0})}catch{i({launched:!1});return}let d=m=>{clearTimeout(p),i({launched:m})},p=setTimeout(()=>d(!0),vt);a.once("spawn",()=>d(!0)),a.on("error",()=>d(!1)),a.unref()})}function Rt(e,t){return e==="win32"?{command:"rundll32.exe",args:["url.dll,FileProtocolHandler",t]}:e==="darwin"?{command:"open",args:[t]}:{command:"xdg-open",args:[t]}}function Et(e){return e!==void 0&&e!==""&&e!=="0"&&e.toLowerCase()!=="false"}var xt=5;function j(e){let t=e.trim().replace(/\\/g,"/");for(;t.startsWith("./");)t=t.slice(2);return t=t.replace(/^\/+/,"").replace(/\/+$/,""),t==="."?"":t}function Mt(e,t,n,r){let s=j(n),o=s?`${s}/`:"",i=[...new Set(e)].filter(l=>l.startsWith(o)).sort(F);if(i.length===0)return null;let a=new Set(i),d=new Map;for(let l of i){let f=l.slice(o.length),w=f.indexOf("/"),c=w<0?l:`${o}${f.slice(0,w)}`,u=d.get(c)??{kind:w<0?"file":"dir",files:[]};u.files.push(l),d.set(c,u)}let p=new Map,m=[];for(let[l,f]of d){let w=f.kind==="dir"?Ft(f.files):l;for(let c of f.files)p.set(c,w);m.push({id:w,kind:f.kind,name:f.kind==="dir"?w.slice(o.length):l.slice(o.length),path:w,files:f.files.length,internalEdges:0,cycle:null})}m.sort((l,f)=>(l.kind===f.kind?0:l.kind==="dir"?-1:1)||F(l.name,f.name));let b=new Map(m.map(l=>[l.id,l])),M=s?s.split("/"):[],y=new Map,R=new Map,x=0,E=(l,f,w)=>{x+=1;let c=`${l}\0${f}`,u=y.get(c)??{from:l,to:f,count:0,cycle:!1,samples:[]};u.count+=1,u.samples.length<xt&&u.samples.push(w),y.set(c,u)},P=l=>{let f=kt(M,l);return R.has(f)||R.set(f,{id:f,kind:"external",path:f}),f};for(let l of[...t.keys()].sort(F)){let f=a.has(l);for(let w of[...t.get(l)].sort(F)){let c=a.has(w);if(!f&&!c||!f&&l.startsWith(o)||!c&&w.startsWith(o))continue;let u={from:l,to:w};if(f&&c){let g=p.get(l),h=p.get(w);g===h?(x+=1,b.get(g).internalEdges+=1):E(g,h,u)}else f?E(p.get(l),P(w),u):E(P(l),p.get(w),u)}}let S=Lt(m,y);for(let l of m)l.cycle=S.get(l.id)??null;for(let l of y.values()){let f=S.get(l.from);l.cycle=f!==void 0&&f===S.get(l.to)}return{scope:s,basis:r,breadcrumbs:Dt(M),nodes:m,external:[...R.values()].sort((l,f)=>F(l.path,f.path)),edges:[...y.values()].sort((l,f)=>F(l.from,f.from)||F(l.to,f.to)),totals:{files:i.length,edges:x}}}function De(e,t){return Mt(O(e,{includeIgnored:!1}),Oe(e,t.basis),t.scope,t.basis)}function Pe(e,t){let n=O(e,{includeIgnored:!1}),r=j(t);for(;r;){let s=`${r}/`;if(n.some(i=>i.startsWith(s)))return r;let o=r.lastIndexOf("/");r=o<0?"":r.slice(0,o)}return""}function Ve(e,t,n){let r=j(t);if(!O(e,{includeIgnored:!1}).includes(r))return null;let s=Oe(e,n),o=[];for(let[i,a]of s)a.has(r)&&o.push(i);return{file:r,dependsOn:[...s.get(r)??[]].sort(F),dependedOnBy:o.sort(F)}}function Oe(e,t){return t==="imports"?Q(e,void 0,{scipEdges:"imports-only",sourceEdges:"imports-and-reexports"}):Q(e)}function Ft(e){let t=e.map(r=>r.split("/").slice(0,-1)),n=[...t[0]];for(let r of t){let s=0;for(;s<n.length&&s<r.length&&n[s]===r[s];)s+=1;n.length=s}return n.join("/")}function kt(e,t){let n=t.split("/"),r=0;for(;r<e.length&&r<n.length&&e[r]===n[r];)r+=1;return n.slice(0,r+1).join("/")}function Lt(e,t){let n=new Map(e.map(o=>[o.id,new Set]));for(let o of t.values())n.has(o.from)&&n.has(o.to)&&n.get(o.from).add(o.to);let r=Ee(n).components.filter(o=>o.length>1).map(o=>[...o].sort(F)).sort((o,i)=>F(o[0],i[0])),s=new Map;return r.forEach((o,i)=>{for(let a of o)s.set(a,i+1)}),s}function Dt(e){return[{name:"root",path:""},...e.map((t,n)=>({name:t,path:e.slice(0,n+1).join("/")}))]}function F(e,t){return e<t?-1:e>t?1:0}var Ce=["callers","callees","contracts","data","state","runtime"],Pt={families:["execution","identity","contract","dataflow","state","runtime"],subtypes:["call","result-callback","references","uses-contract-symbol","argument-to-parameter","constant-to-parameter","property-to-parameter","return-to-parameter","return-to-call-result","reads-resource","writes-resource","deletes-resource","enqueues-resource","consumes-resource","runtime-handoff","discriminator-dispatch"],direction:"both",maxDepth:1,maxEdges:2e3},Ne={exact:0,derived:1,mixed:2,candidate:3,unknown:4},N="root",Vt=new Set(["source-construct","runtime-boundary-participant","call-result","argument-expression","static-value"]);function _e(e,t){let n=t.trim();if(!n)return{status:"missing"};let r=Se(e,n),s=r.match;if(!s)return{status:"missing"};let o=new Map,i=(a,d,p)=>{o.has(a)||o.set(a,{symbol:a,name:q(a),file:d,line:p})};i(s.symbol,s.relativePath,s.startLine);for(let a of r.candidates)i(a.symbol,a.relativePath,a.startLine);return o.size===1&&At(n,s)?{status:"matched",symbol:s.symbol}:{status:"ambiguous",candidates:[...o.values()],total:r.total}}function $e(e,t,n={}){let r=ee(e,{symbols:[t]},Pt),s=r.targets[0]?.nodeIds[0],o=s?Bt(r,s):null,i=s&&o?qe(r,s,It(o)):Tt(r);if(!n.statements)return i;let a=ee(e,{symbols:[t]},{view:"complete",maxDepth:1,maxEdges:400});return{...i,statements:{inventory:a.inventory??[],edges:a.edges.map(jt)}}}function qe(e,t,n){let r=new Map(Ce.map(i=>[i,new Map])),s=[];for(let i of e.edges){let a=Te(i.from,t,n),d=Te(i.to,t,n);if(!a||!d)continue;let p,m;if(a===N&&d!==N)p=!1,m=d;else if(d===N&&a!==N)p=!0,m=a;else continue;if(i.family==="identity"){p&&i.subtype==="references"&&s.push({target:m,edge:i});continue}let b=Ot(i,p);b&&je(r.get(b),m,i,!1)}let o=r.get("callers");for(let{target:i,edge:a}of s){let d=o.get(i.key);(!d||d.reference)&&je(o,i,a,!0)}return{lanes:Object.fromEntries(Ce.map(i=>[i,Nt(r.get(i))])),coverage:{status:e.coverage.status,omittedEdges:e.coverage.omittedEdges}}}function Ot(e,t){let{family:n,subtype:r}=e;return n==="execution"&&(r==="call"||r==="result-callback")?t?"callers":"callees":n==="contract"&&r==="uses-contract-symbol"?t?null:"contracts":n==="dataflow"&&(r.endsWith("-to-parameter")||r==="return-to-call-result")?"data":n==="state"?"state":n==="runtime"?"runtime":null}function Te(e,t,n){if(e.id===t)return N;if(e.kind==="symbol"&&e.symbol)return Be(e.symbol,e.label,e);if(e.kind==="structural-region")return{key:`region:${e.id}`,kind:"region",label:e.label};if(e.kind==="program-resource"||e.kind==="runtime-state-resource")return{key:`resource:${e.id}`,kind:"resource",label:e.label,...te(e),...e.kind==="program-resource"&&Ie(e,n)?{local:!0}:{}};if(Ie(e,n))return N;if(e.location&&Vt.has(e.kind))return{key:`location:${e.id}`,kind:"location",label:e.label,...te(e)};let r=Ct(e);return r?Be(r,q(r),e):null}function Be(e,t,n){return{key:`symbol:${e}`,kind:"symbol",label:t,symbol:e,...te(n)}}function te(e){return e.location?{file:e.location.file,line:e.location.line}:{}}function Ie(e,t){return e.location!==null&&e.location.file===t.file&&e.location.line>=t.startLine&&e.location.line<=t.endLine}function Ct(e){if(e.kind!=="parameter")return null;let[t,n]=e.id.split(":");return t==="parameter"&&n?decodeURIComponent(n):null}function je(e,t,n,r){let s=e.get(t.key);if(!s){e.set(t.key,{kind:t.kind,label:t.label,...t.symbol?{symbol:t.symbol}:{},...t.file!==void 0?{file:t.file,line:t.line}:{},subtypes:[n.subtype],count:1,strength:n.evidenceStrength,...t.local?{local:!0}:{},...r?{reference:!0}:{}});return}s.count+=1,s.subtypes.includes(n.subtype)||s.subtypes.push(n.subtype),Ne[n.evidenceStrength]<Ne[s.strength]&&(s.strength=n.evidenceStrength)}function Nt(e){return[...e.values()].map(t=>({...t,subtypes:[...t.subtypes].sort()})).sort((t,n)=>Ae(t.label,n.label)||Ae(t.file??"",n.file??"")||(t.line??0)-(n.line??0))}function Tt(e){return qe({...e,edges:[]},"",{file:"",startLine:0,endLine:-1})}function Bt(e,t){for(let n of e.edges){if(n.from.id===t)return n.from;if(n.to.id===t)return n.to}return null}function It(e){return e.location?{file:e.location.file,startLine:e.location.line,endLine:e.location.endLine??e.location.line}:{file:"",startLine:0,endLine:-1}}function jt(e){return{id:e.id,family:e.family,subtype:e.subtype,from:e.from,to:e.to,strength:e.evidenceStrength,methods:e.evidenceMethods}}function At(e,t){if(e===t.symbol)return!0;let n=e.replace(/\\/g,"/").replace(/\(\)$/u,""),r=C(t.symbol);if(n===q(t.symbol).replace(/\(\)$/u,"")||n===r)return!0;let s=e.match(/^(.+):(\d+)(?:-(\d+))?$/);if(s){let i=ye(s[1]);return t.relativePath===i||t.relativePath.endsWith(`/${i}`)}let o=n.lastIndexOf("/");return o>0&&n.slice(o+1)===r&&t.relativePath.toLowerCase().includes(n.slice(0,o).toLowerCase())}function Ae(e,t){return e<t?-1:e>t?1:0}function Ue(e){let t=e.published??fe,n=e.open(),r=null,s=o=>{try{o.close()}catch{}};return{acquire(){if(!n)throw new Error("The viewer database is closed.");let o=t(e.dbPath);if(o!==null&&o!==n.generation.identity&&o!==r)try{let i=e.open();s(n),n=i,r=o}catch{}return n},generation(){return n?.generation.identity??null},close(){let o=n;n=void 0,o&&s(o)}}}import{posix as Ge,resolve as _t}from"path";var He=400,We=2e3,$t=["callers","callees","contracts","data","state","runtime"],qt=4096,Ut=/:\d+(?:-\d+)?$/u,Gt=/^\s*```[^\n]*\n[\s\S]*?```[^\S\n]*(?:\n|$)/u;function Ye(e,t){return{status:200,body:{projectRoot:t.projectRoot,projectName:t.meta.projectName,cliVersion:t.meta.cliVersion,generation:D(e),watcher:{state:t.meta.watcherState()},builder:{available:t.meta.builder.available,modes:[...I],defaultMode:t.meta.builder.defaultMode}}}}function ze(e,t,n){let r=rt(t.get("basis"));if(r===null)return k(e,'basis must be "references" or "imports".');let s=t.get("path")??"",o=B(s);if(o===null)return L(e,`Path is outside the project: ${T(s)}`,{nearest:""});let i=n.queries.normalizeMapScope(o),a=n.queries.codeMapScope(e,{scope:i,basis:r});return a?{status:200,body:{...a,generation:D(e)}}:L(e,`No indexed files under "${i}".`,{nearest:n.queries.nearestMapScope(e,i)})}function Xe(e,t,n){let r=rt(t.get("basis"));if(r===null)return k(e,'basis must be "references" or "imports".');let s=t.get("path");if(!s)return k(e,"path is required.");let o=B(s);if(o===null||o===""||!n.queries.isIndexedFile(e,o))return L(e,`No indexed file at "${T(s)}".`);let i=n.queries.codeMapFile(e,o,r);return{status:200,body:{file:o,breadcrumbs:Yt(o),editorUri:ne(n.projectRoot,o,1),outline:tt(e,o,n),dependsOn:i?.dependsOn??[],dependedOnBy:i?.dependedOnBy??[],stale:n.queries.fileIsStale(e,o),generation:D(e)}}}function Qe(e,t,n){let r=t.get("symbol"),s=t.get("focus"),o=r||s;if(!o)return k(e,"symbol or focus is required.");if(o.length>qt)return k(e,"The selector is too long.");let i=r||"";if(!r){let S=n.queries.resolveFocus(e,o);if(S.status==="ambiguous")return{status:200,body:{status:"ambiguous",candidates:S.candidates.map(l=>({symbol:l.symbol,name:l.name,file:l.file,line:l.line+1})),total:S.total,generation:D(e)}};if(S.status==="missing")return L(e,`No symbol matches "${T(o)}".`);i=S.symbol}let a=Ut.test(i)?null:n.queries.code(e,i);if(!a||a.symbol!==i||a.symbol===a.relativePath||!n.queries.isIndexedFile(e,a.relativePath))return L(e,`No indexed definition for "${T(i)}".`);let d=a.relativePath,p=nt(tt(e,d,n),i),m=n.queries.fileSymbolFacts(e,d);if(!p&&!m.has(i))return L(e,`No indexed definition for "${T(i)}".`);let b=m.get(i),M=t.get("statements")==="1",y=n.queries.symbolFocusLanes(e,i,M?{statements:!0}:void 0),R=a.startLine+1,x=a.source.split(`
|
|
3
|
+
`),E=x.length>He,P=E?x.slice(0,He):x;return{status:200,body:{status:"matched",definition:{symbol:i,name:C(i),file:d,startLine:R,endLine:a.endLine+1,signature:p?.entry.signature??null,documentation:Wt(b?.documentation),editorUri:ne(n.projectRoot,d,R)},parent:p?.parent?{symbol:p.parent.symbol,name:p.parent.name}:null,members:(p?.entry.children??[]).map(S=>({symbol:S.symbol,name:S.name,line:S.startLine})),lanes:Qt(y.lanes,n.projectRoot),fileImports:n.queries.codeMapFile(e,d,"imports")?.dependsOn??[],coverage:y.coverage,source:{startLine:R,endLine:R+P.length-1,text:P.join(`
|
|
4
|
+
`),truncated:E,stale:et(a)},...M&&y.statements?{statements:Jt(y.statements)}:{},generation:D(e)}}}function Ze(e,t,n){let r=t.get("file");if(!r)return k(e,"file is required.");let s=t.get("start"),o=t.get("end"),i=s===null?1:Ke(s);if(i===null)return k(e,"start must be a positive integer.");let a=o===null?i+We-1:Ke(o);if(a===null||a<i)return k(e,"end must be an integer at or after start.");let d=B(r);if(d===null||d===""||!n.queries.isIndexedFile(e,d))return L(e,`No indexed file at "${T(r)}".`);let p=Math.min(a,i+We-1),m=n.queries.code(e,`${d}:${i}-${p}`);return m?{status:200,body:{file:d,startLine:m.startLine+1,endLine:m.endLine+1,text:m.source,stale:et(m),generation:D(e)}}:L(e,`Lines ${i}-${p} are outside "${d}".`)}function B(e){if([...e].some(r=>r.charCodeAt(0)<32))return null;let t=e.replaceAll("\\","/");if(t.startsWith("/")||/^[A-Za-z]:/u.test(t))return null;let n=t.split("/").filter(r=>r!==""&&r!==".");return n.includes("..")?null:n.join("/")}function ne(e,t,n){return Ht(_t(e,t),n)}function Ht(e,t){let r=e.replaceAll("\\","/").replace(/[%#? ]/gu,s=>encodeURIComponent(s));return`vscode://file${r.startsWith("/")?"":"/"}${r}:${t}`}function Wt(e){if(!e)return null;let t=e.replace(Gt,"").trim();return t===""?null:t}function et(e){return e.freshness?.semantic.state==="stale"}function Jt(e){return{...e,edges:e.edges.map(Kt)}}function Kt(e){return{...e,from:Je(e.from),to:Je(e.to)}}function Je(e){let{location:t}=e;return t?{...e,location:{...t,line:t.line+1,...t.endLine!==void 0?{endLine:t.endLine+1}:{}}}:e}function Yt(e){let t=[{name:"root",path:""}],n="";for(let r of e.split("/"))n=n===""?r:`${n}/${r}`,t.push({name:r,path:n});return t}function tt(e,t,n){let r=n.queries.fileSymbolFacts(e,t),s=Xt(t),o=n.queries.outline(e,t).flatMap(a=>U(a.symbol)==="namespace"&&s.has(C(a.symbol))?a.children:[a]),i=(a,d)=>({symbol:a.symbol,name:C(a.symbol),kind:r.get(a.symbol)?.kind??zt(a.symbol,d),startLine:a.startLine+1,endLine:a.endLine+1,signature:a.signature,children:a.children.map(p=>i(p,a.symbol))});return o.map(a=>i(a))}function zt(e,t){let n=U(e);return n==="method"?t!==void 0&&U(t)==="type"?"method":"function":n==="term"?"variable":n??"unknown"}function Xt(e){let t=Ge.basename(e);return new Set([t,t.slice(0,Math.max(0,t.length-Ge.extname(t).length))])}function nt(e,t,n=null){for(let r of e){if(r.symbol===t)return{entry:r,parent:n};let s=nt(r.children,t,r);if(s)return s}return null}function Qt(e,t){let n={};for(let r of $t)n[r]=(e[r]??[]).map(s=>{let{line:o,...i}=s,a={...i};return o!==void 0&&(a.line=o+1),s.file!==void 0&&(a.editorUri=ne(t,s.file,(o??0)+1)),a});return n}function rt(e){return e===null||e===""?"references":e==="references"||e==="imports"?e:null}function Ke(e){if(!/^\d{1,9}$/u.test(e))return null;let t=Number(e);return t>=1?t:null}function D(e){return e.generation.identity}function k(e,t){return{status:400,body:{error:t,generation:D(e)}}}function L(e,t,n={}){return{status:404,body:{error:t,...n,generation:D(e)}}}function T(e){return e.length>200?`${e.slice(0,200)}...`:e}import{createHash as ct,randomBytes as Zt,timingSafeEqual as en}from"crypto";import{existsSync as A}from"fs";import{createServer as tn}from"http";import{createRequire as nn}from"module";import{dirname as rn,join as H}from"path";import{fileURLToPath as on}from"url";var _="127.0.0.1",sn=80,an="__CODEBASEIQ_TOKEN__",cn="x-codebaseiq-token",ot=64*1024,un=18e4,st=50,it=["reuse","rework","compose"],ln="cytoscape.esm.min.mjs",dn=["index.html","styles.css","app.js","api.js","map.js","file-panel.js","focus.js","builder.js"],fn={".html":"text/html; charset=utf-8",".css":"text/css; charset=utf-8",".js":"text/javascript; charset=utf-8"},pn=["default-src 'self'","script-src 'self'","style-src 'self' 'unsafe-inline'","img-src 'self' data:","connect-src 'self'","frame-ancestors 'none'"].join("; ");function mn(){for(let e of["../ui/view/","../../../ui/view/"]){let t=on(new URL(e,import.meta.url));if(A(H(t,"index.html")))return t}}function gn(){try{let e=nn(import.meta.url).resolve("cytoscape"),t=H(rn(e),ln);return A(t)?t:void 0}catch{return}}function at(e,t){return{body:ae(e,{maxBytes:ie,inputKind:"viewer asset"}),contentType:t}}function bn(e,t){let n=e.uiDirectory??mn();if(!n||!A(H(n,"index.html")))throw new Error("The viewer UI files were not found; reinstall codebaseiq or rebuild the package.");let r=new Map;for(let i of dn){let a=H(n,i);if(!A(a))continue;let d=at(a,fn[i.slice(i.lastIndexOf("."))]??"application/octet-stream");r.set(i,i==="index.html"?{...d,body:Buffer.from(d.body.toString("utf8").replaceAll(an,t),"utf8")}:d)}let s=e.cytoscapePath??gn(),o=s&&A(s)?at(s,"text/javascript"):void 0;return{assets:r,...o?{vendor:o}:{}}}async function ut(e){let t=e.token??Zt(24).toString("base64url"),{assets:n,vendor:r}=bn(e,t),s=e.builderTimeoutMs??un,o=ct("sha256").update(t).digest(),i=0,a=!1,d=new Set,p=()=>lt(i),m=()=>yn(i),b=(c,u,g)=>{let h=JSON.stringify({generation:e.database.generation(),...g});c.writeHead(u,{...G(),"Content-Type":"application/json; charset=utf-8","Content-Length":Buffer.byteLength(h)}),c.end(h)},M=(c,u)=>{c.writeHead(200,{...G(),"Content-Type":u.contentType,"Content-Length":u.body.byteLength,...u.contentType.startsWith("text/html")?{"Content-Security-Policy":pn}:{}}),c.end(u.body)},y=(c,u,g,h={})=>{c.writeHead(u,{...G(),"Content-Type":"text/plain; charset=utf-8","Content-Length":Buffer.byteLength(g),...h}),c.end(g)},R=(c,u,g)=>{let h=hn.get(u);if(!h){b(c,404,{error:"Not found."});return}let v=h(e.database.acquire(),g,e.routes);b(c,v.status,v.body)},x=(c,u)=>{if(u==="/"){let v=n.get("index.html");v?M(c,v):y(c,404,"Not found.");return}if(u==="/favicon.ico"){c.writeHead(204,G()),c.end();return}if(u==="/vendor/cytoscape.mjs"&&r){M(c,r);return}let g=u.startsWith("/assets/")?u.slice(8):void 0,h=g===void 0?void 0:n.get(g);h?M(c,h):y(c,404,"Not found.")},E=async(c,u)=>{let g=c.headers.origin;if(g!==void 0&&!m().has(g)){b(u,403,{error:"Origin is not allowed."});return}if(!wn(c.headers["content-type"])){b(u,415,{error:"Content-Type must be application/json."});return}if(!Sn(o,c.headers[cn])){b(u,403,{error:"The viewer token is missing or wrong; reload the page."});return}let h=e.builder;if(!h){b(u,501,{error:"The symbol builder is not available in this viewer."});return}if(a){b(u,409,{error:"A builder query is already running."});return}a=!0;try{let v=await vn(c,ot);if(v===void 0){b(u,400,{error:`The request body must be at most ${ot/1024} KiB.`});return}let V=Rn(v);if(!V.ok){b(u,400,{error:V.error});return}await P(u,h,V.request,V.diagnostics)}finally{a=!1}},P=async(c,u,g,h)=>{let v=new AbortController;d.add(v);let V=()=>{c.writableEnded||v.abort(new Error("The client disconnected."))};c.on("close",V);let W;try{let $=await new Promise(J=>{W=setTimeout(()=>{v.abort(new Error("The builder query timed out.")),J({kind:"timeout"})},s),u(g,v.signal).then(K=>J({kind:"done",response:K}),K=>J({kind:"failed",error:K}))});if(c.destroyed)return;$.kind==="timeout"?b(c,504,{error:`The builder query took longer than ${Math.round(s/1e3)} s.`}):$.kind==="failed"?b(c,502,{error:re($.error)}):b(c,200,{...$.response,...h.length>0?{probeDiagnostics:h}:{}})}finally{W&&clearTimeout(W),c.off("close",V),d.delete(v)}},S=async(c,u)=>{if(!p().has((c.headers.host??"").toLowerCase())){y(u,403,"Forbidden host.");return}let g;try{g=new URL(c.url??"/",`http://${_}`)}catch{y(u,400,"Bad request.");return}let h=c.method??"GET";if(g.pathname==="/api/builder"){h==="POST"?await E(c,u):b(u,405,{error:"Use POST."});return}if(h!=="GET"&&h!=="HEAD"){y(u,405,"Method not allowed.",{Allow:"GET, HEAD"});return}g.pathname.startsWith("/api/")?R(u,g.pathname,g.searchParams):x(u,g.pathname)},l=tn((c,u)=>{S(c,u).catch(g=>{if(u.headersSent){u.destroy();return}b(u,500,{error:re(g)})})});await new Promise((c,u)=>{l.once("error",u),l.listen({host:_,port:e.port??0},()=>{l.off("error",u),c()})}),l.on("error",c=>{process.stderr.write(`codebaseiq view: server error: ${re(c)}
|
|
5
|
+
`)});let f=l.address();i=typeof f=="object"&&f?f.port:0;let w=`http://${_}:${i}`;return{port:i,origin:w,url:`${w}/`,token:t,close(){for(let c of d)c.abort(new Error("The viewer is shutting down."));return new Promise(c=>{l.close(()=>c()),l.closeAllConnections()})}}}var hn=new Map([["/api/meta",(e,t,n)=>Ye(e,n)],["/api/scope",ze],["/api/file",Xe],["/api/symbol",Qe],["/api/source",Ze]]);function lt(e){let t=new Set([`${_}:${e}`,`localhost:${e}`]);return e===sn&&(t.add(_),t.add("localhost")),t}function yn(e){return new Set([...lt(e)].map(t=>`http://${t}`))}function G(){return{"Cache-Control":"no-store","X-Content-Type-Options":"nosniff","Referrer-Policy":"no-referrer"}}function wn(e){return e!==void 0&&e.split(";")[0].trim().toLowerCase()==="application/json"}function Sn(e,t){return typeof t!="string"||t===""?!1:en(ct("sha256").update(t).digest(),e)}function vn(e,t){return new Promise((n,r)=>{let s=[],o=0,i=!1;e.on("data",a=>{o+=a.byteLength,o>t?(i=!0,s.length=0):i||s.push(a)}),e.on("end",()=>n(i?void 0:Buffer.concat(s).toString("utf8"))),e.on("error",r)})}function Rn(e){let t;try{t=JSON.parse(e)}catch{return{ok:!1,error:"The request body must be valid JSON."}}if(typeof t!="object"||t===null||Array.isArray(t))return{ok:!1,error:"The request body must be a JSON object."};let n=t,r={},s=[];if(n.description!==void 0){if(typeof n.description!="string")return{ok:!1,error:"description must be a string."};n.description.trim()!==""&&(r.description=n.description)}if(n.probes!==void 0){let o=me(n.probes);s=o.diagnostics,(pe(o.probes)||o.probes.kinds.length>0)&&(r.probes=o.probes)}if(n.mode!==void 0){if(typeof n.mode!="string"||!I.includes(n.mode))return{ok:!1,error:`mode must be one of ${I.join(", ")}.`};r.mode=n.mode}if(n.bucket!==void 0){if(typeof n.bucket!="string"||!it.includes(n.bucket))return{ok:!1,error:`bucket must be one of ${it.join(", ")}.`};r.bucket=n.bucket}if(n.limit!==void 0){let o=n.limit;if(typeof o!="number"||!Number.isInteger(o)||o<1||o>st)return{ok:!1,error:`limit must be an integer from 1 to ${st}.`};r.limit=o}return r.description===void 0&&r.probes===void 0?{ok:!1,error:"Give a description or at least one probe."}:{ok:!0,request:r,diagnostics:s}}function re(e){return e instanceof Error?e.message:String(e)}var kn="view-server.json",ft="127.0.0.1",Ln=1e3,Dn=5e3,Pn=2e3,gt={isProcessAlive:se,canConnect(e,t){return new Promise(n=>{let r=xn({host:ft,port:e}),s=o=>{r.destroy(),n(o)};r.setTimeout(t,()=>s(!1)),r.once("connect",()=>s(!0)),r.once("error",()=>s(!1))})},async fetchProjectRoot(e,t){try{let n=await fetch(`http://${ft}:${e}/api/meta`,{signal:AbortSignal.timeout(t)});if(!n.ok)return{kind:"answered",projectRoot:void 0};let r=await n.json();return{kind:"answered",projectRoot:typeof r.projectRoot=="string"?r.projectRoot:void 0}}catch{return{kind:"unanswered"}}}};function pt(e,t){let n=new URL(e);return t.focus!==void 0?n.searchParams.set("focus",t.focus):t.file!==void 0?n.searchParams.set("file",t.file):t.scope!==void 0&&n.searchParams.set("scope",t.scope),n.toString()}async function bt(e,t,n=gt){let r=ht(e);if(!r||!n.isProcessAlive(r.pid)||!await n.canConnect(r.port,Ln))return;let s=await n.fetchProjectRoot(r.port,Dn);if(s.kind==="unanswered")return r;let o=s.projectRoot;if(!(o===void 0||Y(dt(o))!==Y(dt(t))))return r}async function Vn(e,t,n=gt){let r=await bt(e,t.projectRoot,n);if(r&&r.pid!==t.pid)return process.stderr.write(`warning: a viewer (pid ${r.pid}, ${r.url}) is already recorded for this project, so this one is not.
|
|
6
|
+
`),!1;try{return de(e,t,{spacing:2,trailingNewline:!0}),!0}catch(s){return process.stderr.write(`warning: could not record the running viewer, so another \`codebaseiq view\` will start its own: ${yt(s)}
|
|
7
|
+
`),!1}}function ht(e){try{let{pid:t,port:n,url:r,projectRoot:s,startedAt:o}=JSON.parse(ce(e,"viewer state"));if(typeof t=="number"&&Number.isSafeInteger(t)&&t>0&&typeof n=="number"&&Number.isSafeInteger(n)&&n>0&&n<65536&&typeof r=="string"&&typeof s=="string"&&typeof o=="string")return{pid:t,port:n,url:r,projectRoot:s,startedAt:o}}catch{}}async function jr(e,t=Le){let n=On(e),r=be(),s=oe(r),o=X(r,s),i=Fn(o.paths.cacheDir,kn),a=await bt(i,r);if(a){let E=pt(`http://127.0.0.1:${a.port}/`,n);console.log(`Viewer already running (pid ${a.pid}): ${E}`),e.open&&mt(await t(E));return}process.stderr.write(`codebaseiq view: preparing index
|
|
8
|
+
`),await ke({commandName:"view",projectRoot:r,config:o.config,paths:o.paths,dbPathSource:o.dbPathSource,gitContext:s});let d=X(r,s),p=Ue({dbPath:d.dbPath,open:()=>he(r)}),m=Nn(d,p),b=In(r,d,s),M={queries:jn(),projectRoot:r,meta:{projectName:Mn(r),cliVersion:z,watcherState:b,builder:{available:m.run!==void 0,defaultMode:m.defaultMode}}},y;try{y=await ut({database:p,routes:M,...m.run?{builder:m.run}:{},...e.port!==void 0?{port:e.port}:{}})}catch(E){throw m.close(),p.close(),Cn(E,e.port)}let R={pid:process.pid,port:y.port,url:y.url,projectRoot:r,startedAt:new Date().toISOString()};await Vn(i,R),_n({server:y,database:p,builder:m,stateFile:i,state:R});let x=pt(y.url,n);console.log(`Viewer running at ${x}`),console.log("Press Ctrl+C to stop."),e.open&&mt(await t(x))}function On(e){if([e.focus,e.scope,e.file].filter(n=>n!==void 0).length>1)throw new Error("Use at most one of --focus, --scope, and --file.");if(e.port!==void 0&&(!Number.isInteger(e.port)||e.port<0||e.port>65535))throw new Error("--port must be an integer from 0 to 65535.");if(e.focus!==void 0){if(e.focus.trim()==="")throw new Error("--focus needs a symbol selector.");return{focus:e.focus}}if(e.scope!==void 0){let n=B(e.scope);if(n===null)throw new Error("--scope must be a directory inside the project.");return{scope:n}}if(e.file!==void 0){let n=B(e.file);if(n===null||n==="")throw new Error("--file must be a file path inside the project.");return{file:n}}return{}}function mt(e){e.launched||process.stderr.write(`codebaseiq view: no browser was opened; open the address above.
|
|
9
|
+
`)}function Cn(e,t){return e?.code==="EADDRINUSE"&&t?new Error(`Port ${t} is already in use; choose another with --port.`):e instanceof Error?e:new Error(String(e))}function Nn(e,t){try{let n=ge(e.projectRoot,e.config),r=Fe({settings:n,storeRoot:Me(e.paths.cacheDir),languages:Bn(t.acquire()),openDb:()=>t.acquire(),env:Tn(process.env)});return{run:(s,o)=>r.query(s,{signal:o}),defaultMode:n.mode,close:()=>r.close()}}catch(n){return process.stderr.write(`codebaseiq view: the symbol builder is unavailable: ${yt(n)}
|
|
10
|
+
`),{defaultMode:"agent",close:()=>{}}}}function Tn(e){return Object.fromEntries(Object.entries(e).filter(([t])=>t!=="CLAUDECODE"&&!t.startsWith("CODEX_")))}function Bn(e){let t=e.generation.metadataRaw;return(t?le(ue(t))?.indexedLanguages:void 0)??[]}function In(e,t,n){let r;return()=>{let s=Date.now();if(r&&s-r.at<Pn)return r.value;let o;try{let{classification:i}=xe({projectRoot:e,cacheDir:t.paths.cacheDir,cliVersion:z,...n?{gitContext:n}:{}});o=i.kind==="live"?i.state.watcher.state:i.kind}catch{o="unknown"}return r={at:s,value:o},o}}function jn(){let e=new WeakMap;return{normalizeMapScope:j,codeMapScope:De,nearestMapScope:Pe,codeMapFile:Ve,isIndexedFile(t,n){let r=e.get(t);return r||(r=new Set(O(t,{includeIgnored:!1})),e.set(t,r)),r.has(n)},outline:Re,fileSymbolFacts(t,n){let r=new Map;for(let s of we(t,n))r.set(s.symbol,{kind:s.kind===null?null:An(s.kind),documentation:s.documentation});return r},resolveFocus:_e,symbolFocusLanes:$e,code:Z,fileIsStale(t,n){return Z(t,`${n}:1-1`)?.freshness?.semantic.state==="stale"}}}function An(e){let t=ve(e).toLowerCase();return t==="unknown"||t==="unspecifiedkind"?null:t}function _n(e){let t=()=>{let s=ht(e.stateFile);s?.pid===e.state.pid&&s.startedAt===e.state.startedAt&&En(e.stateFile,{force:!0})},n=!1,r=()=>{n||(n=!0,e.server.close().finally(()=>{e.builder.close(),e.database.close(),t(),console.log(`
|
|
11
|
+
Stopped.`),process.exit(0)}))};process.on("SIGINT",r),process.on("SIGTERM",r),process.on("exit",t)}function yt(e){return e instanceof Error?e.message:String(e)}export{kn as VIEW_STATE_FILE,jn as createViewerQueries,bt as findRunningViewer,ht as readViewerState,Vn as recordRunningViewer,jr as runCodeViewer,Tn as viewerBuilderEnvironment,pt as viewerDeepLink};
|
|
12
|
+
//# sourceMappingURL=code-viewer-KIXEYQNJ.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{a as Me,b as Fe}from"./chunk-RJVAPMHF.js";import"./chunk-ILMHV3KM.js";import"./chunk-XN3EKMLI.js";import{a as ke}from"./chunk-DVWO7RBC.js";import{l as ve}from"./chunk-GWYZVVKY.js";import{D as ee,T as xe,a as Re,n as Ee,o as Z}from"./chunk-LONKINMJ.js";import"./chunk-ZZ3MWF33.js";import{a as X,o as ge}from"./chunk-6WAPPQ5F.js";import"./chunk-YUKYB54I.js";import"./chunk-DDN2F6GB.js";import"./chunk-P5XHIJHI.js";import"./chunk-EQNMD62X.js";import"./chunk-2PRONPAS.js";import"./chunk-P4NVCOM7.js";import"./chunk-CIYA2KZN.js";import{H as me}from"./chunk-C6WKPKCF.js";import"./chunk-XQAVQVIL.js";import{c as q,d as C,e as U}from"./chunk-DRENNWRG.js";import"./chunk-SV2LEFVM.js";import{N as ye,a as I,b as be,c as he,da as we,ga as Q,ma as Se}from"./chunk-MEUHIDI3.js";import"./chunk-5FWR5HLG.js";import{d as ae,e as ce,n as fe}from"./chunk-T75DS2E6.js";import{e as O,g as pe}from"./chunk-YT4DVWUV.js";import"./chunk-RCIGX23V.js";import{j as ue,r as de}from"./chunk-D7DOB27N.js";import"./chunk-R2NOK63J.js";import"./chunk-6O3KXIDL.js";import{G as Y,T as le,Y as z,a as oe,f as se,h as ie}from"./chunk-UQYQBLJX.js";import{rmSync as En}from"fs";import{createConnection as xn}from"net";import{basename as Mn,join as Fn,resolve as dt}from"path";import{spawn as wt}from"child_process";var St=/^https?:\/\//iu,vt=2e3;function Le(e,t={}){let n=t.platform??process.platform,r=t.env??process.env;if(!St.test(e))return Promise.resolve({launched:!1});if(Et(r.CI))return Promise.resolve({launched:!1});if(n!=="win32"&&n!=="darwin"&&!r.DISPLAY&&!r.WAYLAND_DISPLAY)return Promise.resolve({launched:!1});let{command:s,args:o}=Rt(n,e);return new Promise(i=>{let a;try{a=(t.spawn??wt)(s,o,{detached:!0,stdio:"ignore",windowsHide:!0})}catch{i({launched:!1});return}let d=m=>{clearTimeout(p),i({launched:m})},p=setTimeout(()=>d(!0),vt);a.once("spawn",()=>d(!0)),a.on("error",()=>d(!1)),a.unref()})}function Rt(e,t){return e==="win32"?{command:"rundll32.exe",args:["url.dll,FileProtocolHandler",t]}:e==="darwin"?{command:"open",args:[t]}:{command:"xdg-open",args:[t]}}function Et(e){return e!==void 0&&e!==""&&e!=="0"&&e.toLowerCase()!=="false"}var xt=5;function j(e){let t=e.trim().replace(/\\/g,"/");for(;t.startsWith("./");)t=t.slice(2);return t=t.replace(/^\/+/,"").replace(/\/+$/,""),t==="."?"":t}function Mt(e,t,n,r){let s=j(n),o=s?`${s}/`:"",i=[...new Set(e)].filter(l=>l.startsWith(o)).sort(F);if(i.length===0)return null;let a=new Set(i),d=new Map;for(let l of i){let f=l.slice(o.length),w=f.indexOf("/"),c=w<0?l:`${o}${f.slice(0,w)}`,u=d.get(c)??{kind:w<0?"file":"dir",files:[]};u.files.push(l),d.set(c,u)}let p=new Map,m=[];for(let[l,f]of d){let w=f.kind==="dir"?Ft(f.files):l;for(let c of f.files)p.set(c,w);m.push({id:w,kind:f.kind,name:f.kind==="dir"?w.slice(o.length):l.slice(o.length),path:w,files:f.files.length,internalEdges:0,cycle:null})}m.sort((l,f)=>(l.kind===f.kind?0:l.kind==="dir"?-1:1)||F(l.name,f.name));let b=new Map(m.map(l=>[l.id,l])),M=s?s.split("/"):[],y=new Map,R=new Map,x=0,E=(l,f,w)=>{x+=1;let c=`${l}\0${f}`,u=y.get(c)??{from:l,to:f,count:0,cycle:!1,samples:[]};u.count+=1,u.samples.length<xt&&u.samples.push(w),y.set(c,u)},P=l=>{let f=kt(M,l);return R.has(f)||R.set(f,{id:f,kind:"external",path:f}),f};for(let l of[...t.keys()].sort(F)){let f=a.has(l);for(let w of[...t.get(l)].sort(F)){let c=a.has(w);if(!f&&!c||!f&&l.startsWith(o)||!c&&w.startsWith(o))continue;let u={from:l,to:w};if(f&&c){let g=p.get(l),h=p.get(w);g===h?(x+=1,b.get(g).internalEdges+=1):E(g,h,u)}else f?E(p.get(l),P(w),u):E(P(l),p.get(w),u)}}let S=Lt(m,y);for(let l of m)l.cycle=S.get(l.id)??null;for(let l of y.values()){let f=S.get(l.from);l.cycle=f!==void 0&&f===S.get(l.to)}return{scope:s,basis:r,breadcrumbs:Dt(M),nodes:m,external:[...R.values()].sort((l,f)=>F(l.path,f.path)),edges:[...y.values()].sort((l,f)=>F(l.from,f.from)||F(l.to,f.to)),totals:{files:i.length,edges:x}}}function De(e,t){return Mt(O(e,{includeIgnored:!1}),Oe(e,t.basis),t.scope,t.basis)}function Pe(e,t){let n=O(e,{includeIgnored:!1}),r=j(t);for(;r;){let s=`${r}/`;if(n.some(i=>i.startsWith(s)))return r;let o=r.lastIndexOf("/");r=o<0?"":r.slice(0,o)}return""}function Ve(e,t,n){let r=j(t);if(!O(e,{includeIgnored:!1}).includes(r))return null;let s=Oe(e,n),o=[];for(let[i,a]of s)a.has(r)&&o.push(i);return{file:r,dependsOn:[...s.get(r)??[]].sort(F),dependedOnBy:o.sort(F)}}function Oe(e,t){return t==="imports"?X(e,void 0,{scipEdges:"imports-only",sourceEdges:"imports-and-reexports"}):X(e)}function Ft(e){let t=e.map(r=>r.split("/").slice(0,-1)),n=[...t[0]];for(let r of t){let s=0;for(;s<n.length&&s<r.length&&n[s]===r[s];)s+=1;n.length=s}return n.join("/")}function kt(e,t){let n=t.split("/"),r=0;for(;r<e.length&&r<n.length&&e[r]===n[r];)r+=1;return n.slice(0,r+1).join("/")}function Lt(e,t){let n=new Map(e.map(o=>[o.id,new Set]));for(let o of t.values())n.has(o.from)&&n.has(o.to)&&n.get(o.from).add(o.to);let r=xe(n).components.filter(o=>o.length>1).map(o=>[...o].sort(F)).sort((o,i)=>F(o[0],i[0])),s=new Map;return r.forEach((o,i)=>{for(let a of o)s.set(a,i+1)}),s}function Dt(e){return[{name:"root",path:""},...e.map((t,n)=>({name:t,path:e.slice(0,n+1).join("/")}))]}function F(e,t){return e<t?-1:e>t?1:0}var Ce=["callers","callees","contracts","data","state","runtime"],Pt={families:["execution","identity","contract","dataflow","state","runtime"],subtypes:["call","result-callback","references","uses-contract-symbol","argument-to-parameter","constant-to-parameter","property-to-parameter","return-to-parameter","return-to-call-result","reads-resource","writes-resource","deletes-resource","enqueues-resource","consumes-resource","runtime-handoff","discriminator-dispatch"],direction:"both",maxDepth:1,maxEdges:2e3},Ne={exact:0,derived:1,mixed:2,candidate:3,unknown:4},N="root",Vt=new Set(["source-construct","runtime-boundary-participant","call-result","argument-expression","static-value"]);function _e(e,t){let n=t.trim();if(!n)return{status:"missing"};let r=ge(e,n),s=r.match;if(!s)return{status:"missing"};let o=new Map,i=(a,d,p)=>{o.has(a)||o.set(a,{symbol:a,name:q(a),file:d,line:p})};i(s.symbol,s.relativePath,s.startLine);for(let a of r.candidates)i(a.symbol,a.relativePath,a.startLine);return o.size===1&&At(n,s)?{status:"matched",symbol:s.symbol}:{status:"ambiguous",candidates:[...o.values()],total:r.total}}function $e(e,t,n={}){let r=ee(e,{symbols:[t]},Pt),s=r.targets[0]?.nodeIds[0],o=s?Bt(r,s):null,i=s&&o?qe(r,s,It(o)):Tt(r);if(!n.statements)return i;let a=ee(e,{symbols:[t]},{view:"complete",maxDepth:1,maxEdges:400});return{...i,statements:{inventory:a.inventory??[],edges:a.edges.map(jt)}}}function qe(e,t,n){let r=new Map(Ce.map(i=>[i,new Map])),s=[];for(let i of e.edges){let a=Te(i.from,t,n),d=Te(i.to,t,n);if(!a||!d)continue;let p,m;if(a===N&&d!==N)p=!1,m=d;else if(d===N&&a!==N)p=!0,m=a;else continue;if(i.family==="identity"){p&&i.subtype==="references"&&s.push({target:m,edge:i});continue}let b=Ot(i,p);b&&je(r.get(b),m,i,!1)}let o=r.get("callers");for(let{target:i,edge:a}of s){let d=o.get(i.key);(!d||d.reference)&&je(o,i,a,!0)}return{lanes:Object.fromEntries(Ce.map(i=>[i,Nt(r.get(i))])),coverage:{status:e.coverage.status,omittedEdges:e.coverage.omittedEdges}}}function Ot(e,t){let{family:n,subtype:r}=e;return n==="execution"&&(r==="call"||r==="result-callback")?t?"callers":"callees":n==="contract"&&r==="uses-contract-symbol"?t?null:"contracts":n==="dataflow"&&(r.endsWith("-to-parameter")||r==="return-to-call-result")?"data":n==="state"?"state":n==="runtime"?"runtime":null}function Te(e,t,n){if(e.id===t)return N;if(e.kind==="symbol"&&e.symbol)return Be(e.symbol,e.label,e);if(e.kind==="structural-region")return{key:`region:${e.id}`,kind:"region",label:e.label};if(e.kind==="program-resource"||e.kind==="runtime-state-resource")return{key:`resource:${e.id}`,kind:"resource",label:e.label,...te(e),...e.kind==="program-resource"&&Ie(e,n)?{local:!0}:{}};if(Ie(e,n))return N;if(e.location&&Vt.has(e.kind))return{key:`location:${e.id}`,kind:"location",label:e.label,...te(e)};let r=Ct(e);return r?Be(r,q(r),e):null}function Be(e,t,n){return{key:`symbol:${e}`,kind:"symbol",label:t,symbol:e,...te(n)}}function te(e){return e.location?{file:e.location.file,line:e.location.line}:{}}function Ie(e,t){return e.location!==null&&e.location.file===t.file&&e.location.line>=t.startLine&&e.location.line<=t.endLine}function Ct(e){if(e.kind!=="parameter")return null;let[t,n]=e.id.split(":");return t==="parameter"&&n?decodeURIComponent(n):null}function je(e,t,n,r){let s=e.get(t.key);if(!s){e.set(t.key,{kind:t.kind,label:t.label,...t.symbol?{symbol:t.symbol}:{},...t.file!==void 0?{file:t.file,line:t.line}:{},subtypes:[n.subtype],count:1,strength:n.evidenceStrength,...t.local?{local:!0}:{},...r?{reference:!0}:{}});return}s.count+=1,s.subtypes.includes(n.subtype)||s.subtypes.push(n.subtype),Ne[n.evidenceStrength]<Ne[s.strength]&&(s.strength=n.evidenceStrength)}function Nt(e){return[...e.values()].map(t=>({...t,subtypes:[...t.subtypes].sort()})).sort((t,n)=>Ae(t.label,n.label)||Ae(t.file??"",n.file??"")||(t.line??0)-(n.line??0))}function Tt(e){return qe({...e,edges:[]},"",{file:"",startLine:0,endLine:-1})}function Bt(e,t){for(let n of e.edges){if(n.from.id===t)return n.from;if(n.to.id===t)return n.to}return null}function It(e){return e.location?{file:e.location.file,startLine:e.location.line,endLine:e.location.endLine??e.location.line}:{file:"",startLine:0,endLine:-1}}function jt(e){return{id:e.id,family:e.family,subtype:e.subtype,from:e.from,to:e.to,strength:e.evidenceStrength,methods:e.evidenceMethods}}function At(e,t){if(e===t.symbol)return!0;let n=e.replace(/\\/g,"/").replace(/\(\)$/u,""),r=C(t.symbol);if(n===q(t.symbol).replace(/\(\)$/u,"")||n===r)return!0;let s=e.match(/^(.+):(\d+)(?:-(\d+))?$/);if(s){let i=pe(s[1]);return t.relativePath===i||t.relativePath.endsWith(`/${i}`)}let o=n.lastIndexOf("/");return o>0&&n.slice(o+1)===r&&t.relativePath.toLowerCase().includes(n.slice(0,o).toLowerCase())}function Ae(e,t){return e<t?-1:e>t?1:0}function Ue(e){let t=e.published??fe,n=e.open(),r=null,s=o=>{try{o.close()}catch{}};return{acquire(){if(!n)throw new Error("The viewer database is closed.");let o=t(e.dbPath);if(o!==null&&o!==n.generation.identity&&o!==r)try{let i=e.open();s(n),n=i,r=o}catch{}return n},generation(){return n?.generation.identity??null},close(){let o=n;n=void 0,o&&s(o)}}}import{posix as Ge,resolve as _t}from"path";var He=400,We=2e3,$t=["callers","callees","contracts","data","state","runtime"],qt=4096,Ut=/:\d+(?:-\d+)?$/u,Gt=/^\s*```[^\n]*\n[\s\S]*?```[^\S\n]*(?:\n|$)/u;function Ye(e,t){return{status:200,body:{projectRoot:t.projectRoot,projectName:t.meta.projectName,cliVersion:t.meta.cliVersion,generation:D(e),watcher:{state:t.meta.watcherState()},builder:{available:t.meta.builder.available,modes:[...I],defaultMode:t.meta.builder.defaultMode}}}}function ze(e,t,n){let r=rt(t.get("basis"));if(r===null)return k(e,'basis must be "references" or "imports".');let s=t.get("path")??"",o=B(s);if(o===null)return L(e,`Path is outside the project: ${T(s)}`,{nearest:""});let i=n.queries.normalizeMapScope(o),a=n.queries.codeMapScope(e,{scope:i,basis:r});return a?{status:200,body:{...a,generation:D(e)}}:L(e,`No indexed files under "${i}".`,{nearest:n.queries.nearestMapScope(e,i)})}function Xe(e,t,n){let r=rt(t.get("basis"));if(r===null)return k(e,'basis must be "references" or "imports".');let s=t.get("path");if(!s)return k(e,"path is required.");let o=B(s);if(o===null||o===""||!n.queries.isIndexedFile(e,o))return L(e,`No indexed file at "${T(s)}".`);let i=n.queries.codeMapFile(e,o,r);return{status:200,body:{file:o,breadcrumbs:Yt(o),editorUri:ne(n.projectRoot,o,1),outline:tt(e,o,n),dependsOn:i?.dependsOn??[],dependedOnBy:i?.dependedOnBy??[],stale:n.queries.fileIsStale(e,o),generation:D(e)}}}function Qe(e,t,n){let r=t.get("symbol"),s=t.get("focus"),o=r||s;if(!o)return k(e,"symbol or focus is required.");if(o.length>qt)return k(e,"The selector is too long.");let i=r||"";if(!r){let S=n.queries.resolveFocus(e,o);if(S.status==="ambiguous")return{status:200,body:{status:"ambiguous",candidates:S.candidates.map(l=>({symbol:l.symbol,name:l.name,file:l.file,line:l.line+1})),total:S.total,generation:D(e)}};if(S.status==="missing")return L(e,`No symbol matches "${T(o)}".`);i=S.symbol}let a=Ut.test(i)?null:n.queries.code(e,i);if(!a||a.symbol!==i||a.symbol===a.relativePath||!n.queries.isIndexedFile(e,a.relativePath))return L(e,`No indexed definition for "${T(i)}".`);let d=a.relativePath,p=nt(tt(e,d,n),i),m=n.queries.fileSymbolFacts(e,d);if(!p&&!m.has(i))return L(e,`No indexed definition for "${T(i)}".`);let b=m.get(i),M=t.get("statements")==="1",y=n.queries.symbolFocusLanes(e,i,M?{statements:!0}:void 0),R=a.startLine+1,x=a.source.split(`
|
|
2
|
+
`),E=x.length>He,P=E?x.slice(0,He):x;return{status:200,body:{status:"matched",definition:{symbol:i,name:C(i),file:d,startLine:R,endLine:a.endLine+1,signature:p?.entry.signature??null,documentation:Wt(b?.documentation),editorUri:ne(n.projectRoot,d,R)},parent:p?.parent?{symbol:p.parent.symbol,name:p.parent.name}:null,members:(p?.entry.children??[]).map(S=>({symbol:S.symbol,name:S.name,line:S.startLine})),lanes:Qt(y.lanes,n.projectRoot),fileImports:n.queries.codeMapFile(e,d,"imports")?.dependsOn??[],coverage:y.coverage,source:{startLine:R,endLine:R+P.length-1,text:P.join(`
|
|
3
|
+
`),truncated:E,stale:et(a)},...M&&y.statements?{statements:Jt(y.statements)}:{},generation:D(e)}}}function Ze(e,t,n){let r=t.get("file");if(!r)return k(e,"file is required.");let s=t.get("start"),o=t.get("end"),i=s===null?1:Ke(s);if(i===null)return k(e,"start must be a positive integer.");let a=o===null?i+We-1:Ke(o);if(a===null||a<i)return k(e,"end must be an integer at or after start.");let d=B(r);if(d===null||d===""||!n.queries.isIndexedFile(e,d))return L(e,`No indexed file at "${T(r)}".`);let p=Math.min(a,i+We-1),m=n.queries.code(e,`${d}:${i}-${p}`);return m?{status:200,body:{file:d,startLine:m.startLine+1,endLine:m.endLine+1,text:m.source,stale:et(m),generation:D(e)}}:L(e,`Lines ${i}-${p} are outside "${d}".`)}function B(e){if([...e].some(r=>r.charCodeAt(0)<32))return null;let t=e.replaceAll("\\","/");if(t.startsWith("/")||/^[A-Za-z]:/u.test(t))return null;let n=t.split("/").filter(r=>r!==""&&r!==".");return n.includes("..")?null:n.join("/")}function ne(e,t,n){return Ht(_t(e,t),n)}function Ht(e,t){let r=e.replaceAll("\\","/").replace(/[%#? ]/gu,s=>encodeURIComponent(s));return`vscode://file${r.startsWith("/")?"":"/"}${r}:${t}`}function Wt(e){if(!e)return null;let t=e.replace(Gt,"").trim();return t===""?null:t}function et(e){return e.freshness?.semantic.state==="stale"}function Jt(e){return{...e,edges:e.edges.map(Kt)}}function Kt(e){return{...e,from:Je(e.from),to:Je(e.to)}}function Je(e){let{location:t}=e;return t?{...e,location:{...t,line:t.line+1,...t.endLine!==void 0?{endLine:t.endLine+1}:{}}}:e}function Yt(e){let t=[{name:"root",path:""}],n="";for(let r of e.split("/"))n=n===""?r:`${n}/${r}`,t.push({name:r,path:n});return t}function tt(e,t,n){let r=n.queries.fileSymbolFacts(e,t),s=Xt(t),o=n.queries.outline(e,t).flatMap(a=>U(a.symbol)==="namespace"&&s.has(C(a.symbol))?a.children:[a]),i=(a,d)=>({symbol:a.symbol,name:C(a.symbol),kind:r.get(a.symbol)?.kind??zt(a.symbol,d),startLine:a.startLine+1,endLine:a.endLine+1,signature:a.signature,children:a.children.map(p=>i(p,a.symbol))});return o.map(a=>i(a))}function zt(e,t){let n=U(e);return n==="method"?t!==void 0&&U(t)==="type"?"method":"function":n==="term"?"variable":n??"unknown"}function Xt(e){let t=Ge.basename(e);return new Set([t,t.slice(0,Math.max(0,t.length-Ge.extname(t).length))])}function nt(e,t,n=null){for(let r of e){if(r.symbol===t)return{entry:r,parent:n};let s=nt(r.children,t,r);if(s)return s}return null}function Qt(e,t){let n={};for(let r of $t)n[r]=(e[r]??[]).map(s=>{let{line:o,...i}=s,a={...i};return o!==void 0&&(a.line=o+1),s.file!==void 0&&(a.editorUri=ne(t,s.file,(o??0)+1)),a});return n}function rt(e){return e===null||e===""?"references":e==="references"||e==="imports"?e:null}function Ke(e){if(!/^\d{1,9}$/u.test(e))return null;let t=Number(e);return t>=1?t:null}function D(e){return e.generation.identity}function k(e,t){return{status:400,body:{error:t,generation:D(e)}}}function L(e,t,n={}){return{status:404,body:{error:t,...n,generation:D(e)}}}function T(e){return e.length>200?`${e.slice(0,200)}...`:e}import{createHash as ct,randomBytes as Zt,timingSafeEqual as en}from"crypto";import{existsSync as A}from"fs";import{createServer as tn}from"http";import{createRequire as nn}from"module";import{dirname as rn,join as H}from"path";import{fileURLToPath as on}from"url";var _="127.0.0.1",sn=80,an="__CODEBASEIQ_TOKEN__",cn="x-codebaseiq-token",ot=64*1024,un=18e4,st=50,it=["reuse","rework","compose"],ln="cytoscape.esm.min.mjs",dn=["index.html","styles.css","app.js","api.js","map.js","file-panel.js","focus.js","builder.js"],fn={".html":"text/html; charset=utf-8",".css":"text/css; charset=utf-8",".js":"text/javascript; charset=utf-8"},pn=["default-src 'self'","script-src 'self'","style-src 'self' 'unsafe-inline'","img-src 'self' data:","connect-src 'self'","frame-ancestors 'none'"].join("; ");function mn(){for(let e of["../ui/view/","../../../ui/view/"]){let t=on(new URL(e,import.meta.url));if(A(H(t,"index.html")))return t}}function gn(){try{let e=nn(import.meta.url).resolve("cytoscape"),t=H(rn(e),ln);return A(t)?t:void 0}catch{return}}function at(e,t){return{body:se(e,{maxBytes:oe,inputKind:"viewer asset"}),contentType:t}}function bn(e,t){let n=e.uiDirectory??mn();if(!n||!A(H(n,"index.html")))throw new Error("The viewer UI files were not found; reinstall codebaseiq or rebuild the package.");let r=new Map;for(let i of dn){let a=H(n,i);if(!A(a))continue;let d=at(a,fn[i.slice(i.lastIndexOf("."))]??"application/octet-stream");r.set(i,i==="index.html"?{...d,body:Buffer.from(d.body.toString("utf8").replaceAll(an,t),"utf8")}:d)}let s=e.cytoscapePath??gn(),o=s&&A(s)?at(s,"text/javascript"):void 0;return{assets:r,...o?{vendor:o}:{}}}async function ut(e){let t=e.token??Zt(24).toString("base64url"),{assets:n,vendor:r}=bn(e,t),s=e.builderTimeoutMs??un,o=ct("sha256").update(t).digest(),i=0,a=!1,d=new Set,p=()=>lt(i),m=()=>yn(i),b=(c,u,g)=>{let h=JSON.stringify({generation:e.database.generation(),...g});c.writeHead(u,{...G(),"Content-Type":"application/json; charset=utf-8","Content-Length":Buffer.byteLength(h)}),c.end(h)},M=(c,u)=>{c.writeHead(200,{...G(),"Content-Type":u.contentType,"Content-Length":u.body.byteLength,...u.contentType.startsWith("text/html")?{"Content-Security-Policy":pn}:{}}),c.end(u.body)},y=(c,u,g,h={})=>{c.writeHead(u,{...G(),"Content-Type":"text/plain; charset=utf-8","Content-Length":Buffer.byteLength(g),...h}),c.end(g)},R=(c,u,g)=>{let h=hn.get(u);if(!h){b(c,404,{error:"Not found."});return}let v=h(e.database.acquire(),g,e.routes);b(c,v.status,v.body)},x=(c,u)=>{if(u==="/"){let v=n.get("index.html");v?M(c,v):y(c,404,"Not found.");return}if(u==="/favicon.ico"){c.writeHead(204,G()),c.end();return}if(u==="/vendor/cytoscape.mjs"&&r){M(c,r);return}let g=u.startsWith("/assets/")?u.slice(8):void 0,h=g===void 0?void 0:n.get(g);h?M(c,h):y(c,404,"Not found.")},E=async(c,u)=>{let g=c.headers.origin;if(g!==void 0&&!m().has(g)){b(u,403,{error:"Origin is not allowed."});return}if(!wn(c.headers["content-type"])){b(u,415,{error:"Content-Type must be application/json."});return}if(!Sn(o,c.headers[cn])){b(u,403,{error:"The viewer token is missing or wrong; reload the page."});return}let h=e.builder;if(!h){b(u,501,{error:"The symbol builder is not available in this viewer."});return}if(a){b(u,409,{error:"A builder query is already running."});return}a=!0;try{let v=await vn(c,ot);if(v===void 0){b(u,400,{error:`The request body must be at most ${ot/1024} KiB.`});return}let V=Rn(v);if(!V.ok){b(u,400,{error:V.error});return}await P(u,h,V.request,V.diagnostics)}finally{a=!1}},P=async(c,u,g,h)=>{let v=new AbortController;d.add(v);let V=()=>{c.writableEnded||v.abort(new Error("The client disconnected."))};c.on("close",V);let W;try{let $=await new Promise(J=>{W=setTimeout(()=>{v.abort(new Error("The builder query timed out.")),J({kind:"timeout"})},s),u(g,v.signal).then(K=>J({kind:"done",response:K}),K=>J({kind:"failed",error:K}))});if(c.destroyed)return;$.kind==="timeout"?b(c,504,{error:`The builder query took longer than ${Math.round(s/1e3)} s.`}):$.kind==="failed"?b(c,502,{error:re($.error)}):b(c,200,{...$.response,...h.length>0?{probeDiagnostics:h}:{}})}finally{W&&clearTimeout(W),c.off("close",V),d.delete(v)}},S=async(c,u)=>{if(!p().has((c.headers.host??"").toLowerCase())){y(u,403,"Forbidden host.");return}let g;try{g=new URL(c.url??"/",`http://${_}`)}catch{y(u,400,"Bad request.");return}let h=c.method??"GET";if(g.pathname==="/api/builder"){h==="POST"?await E(c,u):b(u,405,{error:"Use POST."});return}if(h!=="GET"&&h!=="HEAD"){y(u,405,"Method not allowed.",{Allow:"GET, HEAD"});return}g.pathname.startsWith("/api/")?R(u,g.pathname,g.searchParams):x(u,g.pathname)},l=tn((c,u)=>{S(c,u).catch(g=>{if(u.headersSent){u.destroy();return}b(u,500,{error:re(g)})})});await new Promise((c,u)=>{l.once("error",u),l.listen({host:_,port:e.port??0},()=>{l.off("error",u),c()})}),l.on("error",c=>{process.stderr.write(`codebaseiq view: server error: ${re(c)}
|
|
4
|
+
`)});let f=l.address();i=typeof f=="object"&&f?f.port:0;let w=`http://${_}:${i}`;return{port:i,origin:w,url:`${w}/`,token:t,close(){for(let c of d)c.abort(new Error("The viewer is shutting down."));return new Promise(c=>{l.close(()=>c()),l.closeAllConnections()})}}}var hn=new Map([["/api/meta",(e,t,n)=>Ye(e,n)],["/api/scope",ze],["/api/file",Xe],["/api/symbol",Qe],["/api/source",Ze]]);function lt(e){let t=new Set([`${_}:${e}`,`localhost:${e}`]);return e===sn&&(t.add(_),t.add("localhost")),t}function yn(e){return new Set([...lt(e)].map(t=>`http://${t}`))}function G(){return{"Cache-Control":"no-store","X-Content-Type-Options":"nosniff","Referrer-Policy":"no-referrer"}}function wn(e){return e!==void 0&&e.split(";")[0].trim().toLowerCase()==="application/json"}function Sn(e,t){return typeof t!="string"||t===""?!1:en(ct("sha256").update(t).digest(),e)}function vn(e,t){return new Promise((n,r)=>{let s=[],o=0,i=!1;e.on("data",a=>{o+=a.byteLength,o>t?(i=!0,s.length=0):i||s.push(a)}),e.on("end",()=>n(i?void 0:Buffer.concat(s).toString("utf8"))),e.on("error",r)})}function Rn(e){let t;try{t=JSON.parse(e)}catch{return{ok:!1,error:"The request body must be valid JSON."}}if(typeof t!="object"||t===null||Array.isArray(t))return{ok:!1,error:"The request body must be a JSON object."};let n=t,r={},s=[];if(n.description!==void 0){if(typeof n.description!="string")return{ok:!1,error:"description must be a string."};n.description.trim()!==""&&(r.description=n.description)}if(n.probes!==void 0){let o=he(n.probes);s=o.diagnostics,(be(o.probes)||o.probes.kinds.length>0)&&(r.probes=o.probes)}if(n.mode!==void 0){if(typeof n.mode!="string"||!I.includes(n.mode))return{ok:!1,error:`mode must be one of ${I.join(", ")}.`};r.mode=n.mode}if(n.bucket!==void 0){if(typeof n.bucket!="string"||!it.includes(n.bucket))return{ok:!1,error:`bucket must be one of ${it.join(", ")}.`};r.bucket=n.bucket}if(n.limit!==void 0){let o=n.limit;if(typeof o!="number"||!Number.isInteger(o)||o<1||o>st)return{ok:!1,error:`limit must be an integer from 1 to ${st}.`};r.limit=o}return r.description===void 0&&r.probes===void 0?{ok:!1,error:"Give a description or at least one probe."}:{ok:!0,request:r,diagnostics:s}}function re(e){return e instanceof Error?e.message:String(e)}var kn="view-server.json",ft="127.0.0.1",Ln=1e3,Dn=5e3,Pn=2e3,gt={isProcessAlive:ue,canConnect(e,t){return new Promise(n=>{let r=xn({host:ft,port:e}),s=o=>{r.destroy(),n(o)};r.setTimeout(t,()=>s(!1)),r.once("connect",()=>s(!0)),r.once("error",()=>s(!1))})},async fetchProjectRoot(e,t){try{let n=await fetch(`http://${ft}:${e}/api/meta`,{signal:AbortSignal.timeout(t)});if(!n.ok)return{kind:"answered",projectRoot:void 0};let r=await n.json();return{kind:"answered",projectRoot:typeof r.projectRoot=="string"?r.projectRoot:void 0}}catch{return{kind:"unanswered"}}}};function pt(e,t){let n=new URL(e);return t.focus!==void 0?n.searchParams.set("focus",t.focus):t.file!==void 0?n.searchParams.set("file",t.file):t.scope!==void 0&&n.searchParams.set("scope",t.scope),n.toString()}async function bt(e,t,n=gt){let r=ht(e);if(!r||!n.isProcessAlive(r.pid)||!await n.canConnect(r.port,Ln))return;let s=await n.fetchProjectRoot(r.port,Dn);if(s.kind==="unanswered")return r;let o=s.projectRoot;if(!(o===void 0||z(dt(o))!==z(dt(t))))return r}async function Vn(e,t,n=gt){let r=await bt(e,t.projectRoot,n);if(r&&r.pid!==t.pid)return process.stderr.write(`warning: a viewer (pid ${r.pid}, ${r.url}) is already recorded for this project, so this one is not.
|
|
5
|
+
`),!1;try{return de(e,t,{spacing:2,trailingNewline:!0}),!0}catch(s){return process.stderr.write(`warning: could not record the running viewer, so another \`codebaseiq view\` will start its own: ${yt(s)}
|
|
6
|
+
`),!1}}function ht(e){try{let{pid:t,port:n,url:r,projectRoot:s,startedAt:o}=JSON.parse(ie(e,"viewer state"));if(typeof t=="number"&&Number.isSafeInteger(t)&&t>0&&typeof n=="number"&&Number.isSafeInteger(n)&&n>0&&n<65536&&typeof r=="string"&&typeof s=="string"&&typeof o=="string")return{pid:t,port:n,url:r,projectRoot:s,startedAt:o}}catch{}}async function jr(e,t=Le){let n=On(e),r=we(),s=le(r),o=Q(r,s),i=Fn(o.paths.cacheDir,kn),a=await bt(i,r);if(a){let E=pt(`http://127.0.0.1:${a.port}/`,n);console.log(`Viewer already running (pid ${a.pid}): ${E}`),e.open&&mt(await t(E));return}process.stderr.write(`codebaseiq view: preparing index
|
|
7
|
+
`),await ke({commandName:"view",projectRoot:r,config:o.config,paths:o.paths,dbPathSource:o.dbPathSource,gitContext:s});let d=Q(r,s),p=Ue({dbPath:d.dbPath,open:()=>Se(r)}),m=Nn(d,p),b=In(r,d,s),M={queries:jn(),projectRoot:r,meta:{projectName:Mn(r),cliVersion:Y,watcherState:b,builder:{available:m.run!==void 0,defaultMode:m.defaultMode}}},y;try{y=await ut({database:p,routes:M,...m.run?{builder:m.run}:{},...e.port!==void 0?{port:e.port}:{}})}catch(E){throw m.close(),p.close(),Cn(E,e.port)}let R={pid:process.pid,port:y.port,url:y.url,projectRoot:r,startedAt:new Date().toISOString()};await Vn(i,R),_n({server:y,database:p,builder:m,stateFile:i,state:R});let x=pt(y.url,n);console.log(`Viewer running at ${x}`),console.log("Press Ctrl+C to stop."),e.open&&mt(await t(x))}function On(e){if([e.focus,e.scope,e.file].filter(n=>n!==void 0).length>1)throw new Error("Use at most one of --focus, --scope, and --file.");if(e.port!==void 0&&(!Number.isInteger(e.port)||e.port<0||e.port>65535))throw new Error("--port must be an integer from 0 to 65535.");if(e.focus!==void 0){if(e.focus.trim()==="")throw new Error("--focus needs a symbol selector.");return{focus:e.focus}}if(e.scope!==void 0){let n=B(e.scope);if(n===null)throw new Error("--scope must be a directory inside the project.");return{scope:n}}if(e.file!==void 0){let n=B(e.file);if(n===null||n==="")throw new Error("--file must be a file path inside the project.");return{file:n}}return{}}function mt(e){e.launched||process.stderr.write(`codebaseiq view: no browser was opened; open the address above.
|
|
8
|
+
`)}function Cn(e,t){return e?.code==="EADDRINUSE"&&t?new Error(`Port ${t} is already in use; choose another with --port.`):e instanceof Error?e:new Error(String(e))}function Nn(e,t){try{let n=ye(e.projectRoot,e.config),r=Fe({settings:n,storeRoot:Me(e.paths.cacheDir),languages:Bn(t.acquire()),openDb:()=>t.acquire(),env:Tn(process.env)});return{run:(s,o)=>r.query(s,{signal:o}),defaultMode:n.mode,close:()=>r.close()}}catch(n){return process.stderr.write(`codebaseiq view: the symbol builder is unavailable: ${yt(n)}
|
|
9
|
+
`),{defaultMode:"agent",close:()=>{}}}}function Tn(e){return Object.fromEntries(Object.entries(e).filter(([t])=>t!=="CLAUDECODE"&&!t.startsWith("CODEX_")))}function Bn(e){let t=e.generation.metadataRaw;return(t?ce(ae(t))?.indexedLanguages:void 0)??[]}function In(e,t,n){let r;return()=>{let s=Date.now();if(r&&s-r.at<Pn)return r.value;let o;try{let{classification:i}=ve({projectRoot:e,cacheDir:t.paths.cacheDir,cliVersion:Y,...n?{gitContext:n}:{}});o=i.kind==="live"?i.state.watcher.state:i.kind}catch{o="unknown"}return r={at:s,value:o},o}}function jn(){let e=new WeakMap;return{normalizeMapScope:j,codeMapScope:De,nearestMapScope:Pe,codeMapFile:Ve,isIndexedFile(t,n){let r=e.get(t);return r||(r=new Set(O(t,{includeIgnored:!1})),e.set(t,r)),r.has(n)},outline:Ee,fileSymbolFacts(t,n){let r=new Map;for(let s of me(t,n))r.set(s.symbol,{kind:s.kind===null?null:An(s.kind),documentation:s.documentation});return r},resolveFocus:_e,symbolFocusLanes:$e,code:Z,fileIsStale(t,n){return Z(t,`${n}:1-1`)?.freshness?.semantic.state==="stale"}}}function An(e){let t=Re(e).toLowerCase();return t==="unknown"||t==="unspecifiedkind"?null:t}function _n(e){let t=()=>{let s=ht(e.stateFile);s?.pid===e.state.pid&&s.startedAt===e.state.startedAt&&En(e.stateFile,{force:!0})},n=!1,r=()=>{n||(n=!0,e.server.close().finally(()=>{e.builder.close(),e.database.close(),t(),console.log(`
|
|
10
|
+
Stopped.`),process.exit(0)}))};process.on("SIGINT",r),process.on("SIGTERM",r),process.on("exit",t)}function yt(e){return e instanceof Error?e.message:String(e)}export{kn as VIEW_STATE_FILE,jn as createViewerQueries,bt as findRunningViewer,ht as readViewerState,Vn as recordRunningViewer,jr as runCodeViewer,Tn as viewerBuilderEnvironment,pt as viewerDeepLink};
|
|
11
|
+
//# sourceMappingURL=code-viewer-VHLBLIUM.js.map
|