codebaseiq 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/dist/augment-vue-worker.js +1 -1
- package/dist/{chunk-DQMDCD24.js → chunk-27PHVDKL.js} +2 -2
- package/dist/{chunk-ZMI2JSX2.js → chunk-2DMVFAY7.js} +2 -2
- package/dist/{chunk-5PUWMSDU.js → chunk-2E6BTWER.js} +2 -2
- package/dist/{chunk-YESXMKX3.js → chunk-2F5ERMNI.js} +2 -2
- package/dist/chunk-2VKB5CMA.js +60 -0
- package/dist/{chunk-NNJ2KZZG.js → chunk-327YK6TB.js} +4 -4
- package/dist/chunk-347TXATM.js +2 -0
- package/dist/{chunk-VEXUL62T.js → chunk-35YYZD3D.js} +2 -2
- package/dist/chunk-36WRYYTE.js +3 -0
- package/dist/chunk-37TKC6MB.js +2 -0
- package/dist/{chunk-FAJQ7LWY.js → chunk-3AC56WAR.js} +2 -2
- package/dist/{chunk-JE3WZ6II.js → chunk-3NUZVLR7.js} +2 -2
- package/dist/{chunk-UZGZB3VB.js → chunk-3XFJUWJE.js} +2 -2
- package/dist/{chunk-OVTS4DKB.js → chunk-4AOOSCZ7.js} +2 -2
- package/dist/{chunk-LU3BMVH2.js → chunk-4IFISPQW.js} +2 -2
- package/dist/chunk-4NHWNAWQ.js +11 -0
- package/dist/chunk-4O52YNKL.js +5 -0
- package/dist/{chunk-HPJRBHVT.js → chunk-54K6556S.js} +2 -2
- package/dist/{chunk-HRWGYWRJ.js → chunk-57GCCPLS.js} +2 -2
- package/dist/{chunk-J77SU6VA.js → chunk-57KEZDPT.js} +2 -2
- package/dist/{chunk-OFBE4NGP.js → chunk-57KFVPVZ.js} +2 -2
- package/dist/{chunk-WOQBZPIF.js → chunk-5BDK6QC3.js} +2 -2
- package/dist/{chunk-7MGU3HPH.js → chunk-5IO2APSS.js} +2 -2
- package/dist/chunk-5NJPH3QZ.js +61 -0
- package/dist/{chunk-GW6Z3WGY.js → chunk-5WXOEJ4G.js} +2 -2
- package/dist/chunk-5XEVXVTK.js +3 -0
- package/dist/{chunk-RR7SX44N.js → chunk-6OVNYYY4.js} +2 -2
- package/dist/{chunk-ZV3JV5G5.js → chunk-6SDEQTVY.js} +2 -2
- package/dist/{chunk-EF2R3WNQ.js → chunk-6URCE5QY.js} +2 -2
- package/dist/{chunk-UCD3H3UZ.js → chunk-6ZV5EDUT.js} +2 -2
- package/dist/{chunk-C6SBF2WH.js → chunk-77GHPR2R.js} +2 -2
- package/dist/{chunk-YVCIMIOC.js → chunk-7R64XY4Y.js} +2 -2
- package/dist/{chunk-VXYS3FZD.js → chunk-7Z7HCZ7J.js} +2 -2
- package/dist/{chunk-CO5R3UNA.js → chunk-A67HT5FR.js} +2 -2
- package/dist/{chunk-UDS562V4.js → chunk-A7XQT7MH.js} +2 -2
- package/dist/{chunk-RDBI2RXU.js → chunk-ACZDU5GK.js} +2 -2
- package/dist/{chunk-FETNQCFO.js → chunk-AM5SUGHF.js} +2 -2
- package/dist/{chunk-NNOKTMZT.js → chunk-B2E3HZ2A.js} +2 -2
- package/dist/{chunk-CVYSU6BX.js → chunk-BH5CE4LN.js} +2 -2
- package/dist/chunk-BLKYYQ7C.js +543 -0
- package/dist/{chunk-4WKDMDEW.js → chunk-BX2U3QQV.js} +2 -2
- package/dist/{chunk-ZKX2FRS6.js → chunk-CANBLFVQ.js} +2 -2
- package/dist/{chunk-SMRBZ6EC.js → chunk-CCRZLRWJ.js} +2 -2
- package/dist/chunk-CDWSLAPN.js +21 -0
- package/dist/chunk-CIVYHK7U.js +22 -0
- package/dist/{chunk-L57ZKWVG.js → chunk-CMXW7MFV.js} +2 -2
- package/dist/{chunk-T3DGWPXM.js → chunk-CSZOQ7YO.js} +2 -2
- package/dist/{chunk-ZZXSWSN6.js → chunk-CWMHWD56.js} +2 -2
- package/dist/{chunk-6NW7MU72.js → chunk-CZEIHYMP.js} +2 -2
- package/dist/{chunk-DO6WQD2T.js → chunk-D62CTZX6.js} +2 -2
- package/dist/{chunk-XWUOUWYI.js → chunk-DFPAZXLU.js} +2 -2
- package/dist/{chunk-MOVBWNIP.js → chunk-DKJXK3HA.js} +2 -2
- package/dist/{chunk-XMQ23E27.js → chunk-DLC6JDN7.js} +2 -2
- package/dist/chunk-DUKHVPU5.js +4 -0
- package/dist/{chunk-ID63777H.js → chunk-DVYG3JTA.js} +2 -2
- package/dist/{chunk-NE6IU5ZD.js → chunk-EFFMFK7C.js} +2 -2
- package/dist/{chunk-I2T2LLK2.js → chunk-EM5UHLAM.js} +2 -2
- package/dist/chunk-EN4AHLL3.js +3 -0
- package/dist/chunk-EXMVF3JR.js +3 -0
- package/dist/{chunk-SWHMHUKF.js → chunk-FEBLLMTL.js} +2 -2
- package/dist/chunk-FIXYHQ3W.js +3 -0
- package/dist/{chunk-RKEJ6VTF.js → chunk-FLLXYUOL.js} +2 -2
- package/dist/{chunk-KWVHSKHK.js → chunk-FPDL2TUB.js} +2 -2
- package/dist/chunk-FQA3KIFX.js +17 -0
- package/dist/chunk-FWY2PRIF.js +3 -0
- package/dist/chunk-FY5V4V4F.js +2 -0
- package/dist/chunk-G2XUZCF2.js +88 -0
- package/dist/{chunk-QHRNXP3C.js → chunk-GXVDTHFC.js} +2 -2
- package/dist/{chunk-6MUIJMVL.js → chunk-H3CKAL6P.js} +2 -2
- package/dist/chunk-H5QXP63L.js +2 -0
- package/dist/{chunk-VUIYB2V3.js → chunk-HBQGKMM3.js} +2 -2
- package/dist/{chunk-PYAB5SM6.js → chunk-HBXZAGY6.js} +2 -2
- package/dist/{chunk-NNO6A2PO.js → chunk-HCMQZPEO.js} +2 -2
- package/dist/{chunk-Q65CQ4XL.js → chunk-HHBBGWES.js} +2 -2
- package/dist/{chunk-GTXSJDCO.js → chunk-HIEXRDJF.js} +2 -2
- package/dist/{chunk-4FC325IF.js → chunk-HYKSLTAR.js} +2 -2
- package/dist/{chunk-XLQ3GLWZ.js → chunk-I2KP4AGR.js} +2 -2
- package/dist/chunk-I5FCDTK2.js +2 -0
- package/dist/{chunk-QKPLA6IC.js → chunk-I645ZF75.js} +2 -2
- package/dist/{chunk-FDGD5AB5.js → chunk-IBM3F2BJ.js} +2 -2
- package/dist/{chunk-Q72QSKXC.js → chunk-IEL6Q5W3.js} +38 -38
- package/dist/{chunk-NCZUNH3E.js → chunk-IGQQUENU.js} +12 -12
- package/dist/chunk-IGYAZPRX.js +4 -0
- package/dist/chunk-IOVPAZWP.js +3 -0
- package/dist/{chunk-OL6KJP3N.js → chunk-IVJJNVSX.js} +2 -2
- package/dist/{chunk-AKB7V7TV.js → chunk-IWAMYGPN.js} +2 -2
- package/dist/chunk-IYBIBMPF.js +90 -0
- package/dist/{chunk-IOP6FWIM.js → chunk-J24VICI5.js} +2 -2
- package/dist/{chunk-C7QOQX32.js → chunk-JN5LIBT3.js} +2 -2
- package/dist/{chunk-O6QTXQPJ.js → chunk-JOALNFY3.js} +2 -2
- package/dist/{chunk-GCHRX4YW.js → chunk-JUO3Z644.js} +2 -2
- package/dist/{chunk-BJ6SQAEN.js → chunk-JXHLB7TP.js} +2 -2
- package/dist/{chunk-IJ4HMYBE.js → chunk-JYX5UZSZ.js} +2 -2
- package/dist/chunk-K2O7SBAU.js +2 -0
- package/dist/{chunk-OLF4MA5W.js → chunk-K5G7SPAG.js} +2 -2
- package/dist/{chunk-YSNONTJ2.js → chunk-KDYQQJ6X.js} +2 -2
- package/dist/{chunk-7NVGT435.js → chunk-KM4QRWI5.js} +2 -2
- package/dist/{chunk-HKQUXIFO.js → chunk-KNV5VFDV.js} +2 -2
- package/dist/chunk-L3YSDLNB.js +2 -0
- package/dist/{chunk-EZNMUY67.js → chunk-LAGDJXFY.js} +2 -2
- package/dist/{chunk-ENCCHKM6.js → chunk-LY2NB5XR.js} +4 -4
- package/dist/chunk-M4EVGA5S.js +14 -0
- package/dist/chunk-M7LAIM77.js +127 -0
- package/dist/{chunk-BVAJLC5A.js → chunk-MRGTCMDK.js} +2 -2
- package/dist/{chunk-OZYRSMSH.js → chunk-MT5W4DUG.js} +2 -2
- package/dist/{chunk-VE5AVNMP.js → chunk-MTMF4N7F.js} +2 -2
- package/dist/chunk-N3Q3AWGW.js +545 -0
- package/dist/{chunk-TXXOEMZJ.js → chunk-NDGTJHQN.js} +2 -2
- package/dist/chunk-NIO346UL.js +2 -0
- package/dist/chunk-NJA4MMBD.js +2 -0
- package/dist/{chunk-7FND7D7N.js → chunk-NK76RSB6.js} +2 -2
- package/dist/{chunk-H3LGFZVK.js → chunk-NTRW52UR.js} +2 -2
- package/dist/{chunk-JOIRNPPY.js → chunk-OJFLPVBP.js} +2 -2
- package/dist/{chunk-KMITESMT.js → chunk-OMBRP7BB.js} +2 -2
- package/dist/{chunk-UP3BUZR5.js → chunk-OVKZM2XI.js} +2 -2
- package/dist/{chunk-MVB3DAEY.js → chunk-PARCKE3Q.js} +2 -2
- package/dist/{chunk-CAUCPUOF.js → chunk-PFPHS4NO.js} +2 -2
- package/dist/chunk-PHPQ24UG.js +22 -0
- package/dist/chunk-PLZXWZHY.js +77 -0
- package/dist/{chunk-34WBMAYK.js → chunk-PNVZIJ57.js} +2 -2
- package/dist/{chunk-SYDJMPES.js → chunk-QKVTWODE.js} +2 -2
- package/dist/{chunk-FW53T7EB.js → chunk-QLTFXVUI.js} +2 -2
- package/dist/{chunk-PBI2LFKH.js → chunk-QMGWSEPL.js} +2 -2
- package/dist/{chunk-CQP3THUZ.js → chunk-QVHZB75Z.js} +2 -2
- package/dist/{chunk-6BQ3DSPK.js → chunk-QVWDQTMG.js} +2 -2
- package/dist/{chunk-ST7V3SKN.js → chunk-RCPZOPV6.js} +2 -2
- package/dist/chunk-RJWAB4VR.js +345 -0
- package/dist/chunk-RRPK327J.js +20 -0
- package/dist/chunk-RVYLJDXC.js +21 -0
- package/dist/chunk-RWKEXCHU.js +3 -0
- package/dist/{chunk-L4NRUAGJ.js → chunk-S5SKXCND.js} +2 -2
- package/dist/{chunk-RBAS5ZHI.js → chunk-S64NCE2Z.js} +2 -2
- package/dist/{chunk-WMPRTGH2.js → chunk-SF34QLK2.js} +2 -2
- package/dist/{chunk-ANFVSJWQ.js → chunk-SJZQ2PTZ.js} +2 -2
- package/dist/{chunk-4XTAUQFD.js → chunk-SRY26ITJ.js} +2 -2
- package/dist/chunk-SV2LEFVM.js +2 -0
- package/dist/{chunk-7XAN6GKB.js → chunk-T3YFIJ5P.js} +2 -2
- package/dist/chunk-T55YPJGB.js +3 -0
- package/dist/chunk-TAJ6UGCO.js +21 -0
- package/dist/{chunk-PIOMTC27.js → chunk-TUTSO7UZ.js} +2 -2
- package/dist/{chunk-FQKZWM4L.js → chunk-U24M5RQM.js} +5 -5
- package/dist/{chunk-XME3HPXZ.js → chunk-U2XX3BT4.js} +2 -2
- package/dist/{chunk-SZD2KF7Q.js → chunk-UWB5WMC2.js} +2 -2
- package/dist/{chunk-6CS3UQTN.js → chunk-VCL7FK3E.js} +2 -2
- package/dist/{chunk-N3IQCBCF.js → chunk-VCWAJPXQ.js} +2 -2
- package/dist/{chunk-LZYFLFEH.js → chunk-VG55NFXF.js} +2 -2
- package/dist/{chunk-PTAWHLVJ.js → chunk-VLTUX4IF.js} +2 -2
- package/dist/{chunk-JEJLSICM.js → chunk-VVCBMH5O.js} +2 -2
- package/dist/{chunk-JSOYNVWH.js → chunk-VYZQZ4ZN.js} +2 -2
- package/dist/chunk-W3FK73MD.js +8 -0
- package/dist/{chunk-UNBY47BC.js → chunk-W6C6QTXJ.js} +2 -2
- package/dist/chunk-WH5SYOMD.js +2 -0
- package/dist/chunk-WJOQC4P7.js +7 -0
- package/dist/chunk-WO47BIPY.js +3 -0
- package/dist/chunk-WOOTEWQT.js +239 -0
- package/dist/{chunk-UBGWN7I4.js → chunk-X5I2BQGX.js} +2 -2
- package/dist/{chunk-PX4RYAAK.js → chunk-XNUWRTYM.js} +2 -2
- package/dist/{chunk-ICFDQHAM.js → chunk-XUJM6474.js} +2 -2
- package/dist/chunk-XYLV727H.js +21 -0
- package/dist/{chunk-TRRC4ZJ7.js → chunk-YFQPWKHR.js} +2 -2
- package/dist/{chunk-NEDP5RFQ.js → chunk-YIOQJ45A.js} +2 -2
- package/dist/{chunk-Y6KHROC3.js → chunk-YXJ4IAHH.js} +2 -2
- package/dist/chunk-YYFV32WR.js +3 -0
- package/dist/{chunk-BH5F2Q4O.js → chunk-ZB3V5QM7.js} +2 -2
- package/dist/chunk-ZJZQ7Q2Q.js +3 -0
- package/dist/{chunk-EMNIHCRB.js → chunk-ZNQCR656.js} +2 -2
- package/dist/{chunk-TIIC3ZE7.js → chunk-ZOEDRCR4.js} +2 -2
- package/dist/cli-context-TSADTXLB.js +2 -0
- package/dist/cli-context-XEPPF4RX.js +3 -0
- package/dist/cli-program-KJGQEM72.js +7 -0
- package/dist/cli.js +1 -1
- package/dist/{code-DlqpBDd0.d.ts → code-CDe-mIjx.d.ts} +1 -1
- package/dist/code-viewer-YGDON6SY.js +12 -0
- package/dist/code-viewer-ZCTHXQ5C.js +11 -0
- package/dist/command-descriptors-5VAB2MZX.js +335 -0
- package/dist/command-descriptors-EAHKIRAG.js +337 -0
- package/dist/{config-types-BNoC96J3.d.ts → config-types-D6X5S68_.d.ts} +50 -0
- package/dist/{db-D7sauVFH.d.ts → db-DmRNdCtm.d.ts} +1 -1
- package/dist/direct-navigation-B3SGOOBW.js +2 -0
- package/dist/direct-navigation-ZL362KXF.js +3 -0
- package/dist/{graph-evidence-BIFqyisO.d.ts → graph-evidence-Bs54NWws.d.ts} +1 -1
- package/dist/{health-DJaZXg8I.d.ts → health-BnzbSLCE.d.ts} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/invocation-command-descriptors-CSUGUHTT.js +2 -0
- package/dist/invocation-command-descriptors-PPVZOIE5.js +3 -0
- package/dist/output-continuation-command-FTVVBVSN.js +2 -0
- package/dist/output-continuation-command-ITPRC3YV.js +3 -0
- package/dist/project-reindex-7HZSLLLY.js +3 -0
- package/dist/project-reindex-NGM3DYBN.js +2 -0
- package/dist/queries/affected.d.ts +2 -2
- package/dist/queries/affected.js +1 -1
- package/dist/queries/anchors.d.ts +2 -2
- package/dist/queries/anchors.js +1 -1
- package/dist/queries/architecture.d.ts +2 -2
- package/dist/queries/architecture.js +1 -1
- package/dist/queries/bottlenecks.d.ts +2 -2
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +2 -2
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +2 -2
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +2 -2
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +2 -2
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +2 -2
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.d.ts +3 -3
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +2 -2
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +2 -2
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/context.d.ts +2 -2
- package/dist/queries/context.js +1 -1
- package/dist/queries/convergence.d.ts +2 -2
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +2 -2
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +2 -2
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +2 -2
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +2 -2
- package/dist/queries/dead.js +1 -1
- package/dist/queries/decorative-checkers.d.ts +2 -2
- package/dist/queries/decorative-checkers.js +1 -1
- package/dist/queries/deep-chains.d.ts +2 -2
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/dependence-slice.d.ts +3 -3
- package/dist/queries/dependence-slice.js +1 -1
- package/dist/queries/dependency-depth.d.ts +2 -2
- package/dist/queries/dependency-depth.js +1 -1
- package/dist/queries/deps.d.ts +2 -2
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.d.ts +2 -2
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +2 -2
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +2 -2
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.d.ts +2 -2
- package/dist/queries/duplicate-bodies.js +1 -1
- package/dist/queries/entry-map.d.ts +2 -2
- package/dist/queries/entry-map.js +1 -1
- package/dist/queries/evidence.d.ts +3 -3
- package/dist/queries/evidence.js +1 -1
- package/dist/queries/extract-candidates.d.ts +2 -2
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +2 -2
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +2 -2
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +3 -3
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +2 -2
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +2 -2
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +2 -2
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +2 -2
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +5 -5
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +2 -2
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.d.ts +2 -2
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.d.ts +2 -2
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +2 -2
- package/dist/queries/methods.js +1 -1
- package/dist/queries/not-implemented.d.ts +2 -2
- package/dist/queries/not-implemented.js +1 -1
- package/dist/queries/outline.d.ts +2 -2
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +2 -2
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +2 -2
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +2 -2
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +2 -2
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +2 -2
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.d.ts +2 -2
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +2 -2
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/reference-neighborhood.d.ts +2 -2
- package/dist/queries/reference-neighborhood.js +1 -1
- package/dist/queries/reference-reachability.d.ts +2 -2
- package/dist/queries/reference-reachability.js +1 -1
- package/dist/queries/refs.d.ts +2 -2
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +2 -2
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.d.ts +2 -2
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +2 -2
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +2 -2
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +2 -2
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +2 -2
- package/dist/queries/slice.js +1 -1
- package/dist/queries/source-inspection.d.ts +4 -4
- package/dist/queries/source-inspection.js +1 -1
- package/dist/queries/source-search.d.ts +2 -2
- package/dist/queries/source-search.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +2 -2
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +2 -2
- package/dist/queries/surface.d.ts +2 -2
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +2 -2
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system-map.d.ts +2 -2
- package/dist/queries/system-map.js +1 -1
- package/dist/queries/system.d.ts +2 -2
- package/dist/queries/system.js +1 -1
- package/dist/queries/test-quality.d.ts +2 -2
- package/dist/queries/test-quality.js +1 -1
- package/dist/queries/trace.d.ts +2 -2
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.d.ts +2 -2
- package/dist/queries/twin-ab.js +1 -1
- package/dist/queries/twin-drift.d.ts +2 -2
- package/dist/queries/twin-drift.js +1 -1
- package/dist/queries/unused-imports.d.ts +2 -2
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.d.ts +2 -2
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/value-flow.d.ts +3 -3
- package/dist/queries/value-flow.js +1 -1
- package/dist/queries/vue-component-duplicates.d.ts +2 -2
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.d.ts +2 -2
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.d.ts +2 -2
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +2 -2
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +1 -1
- package/dist/reindex.d.ts +3 -3
- package/dist/reindex.js +31 -31
- package/dist/runtime.d.ts +24 -4
- package/dist/runtime.js +3 -3
- package/dist/rust-semantic-session-server.js +1 -1
- package/dist/rust-semantic-session-worker.js +1 -1
- package/dist/rust-semantic-worker.js +1 -1
- package/dist/{scip-cli-B7N3haxa.d.ts → scip-cli-BRFKkHQn.d.ts} +1 -1
- package/dist/sentinel-ensure-command-KYYULCFU.js +2 -0
- package/dist/sentinel-ensure-command-RIZA3RY7.js +3 -0
- package/dist/sentinel-hook.js +39 -0
- package/dist/sentinel-worker.js +16 -0
- package/dist/typescript-mailbox-worker.js +1 -1
- package/dist/watch-server.js +6 -6
- package/docs/COMMAND_REFERENCE.md +5 -3
- package/docs/schemas/project-config.schema.json +159 -0
- package/package.json +9 -5
- package/skills/codebaseiq/SKILL.md +1 -1
- package/skills/concrete-plan/SKILL.md +1 -1
- package/ui/view/api.js +450 -0
- package/ui/view/app.js +394 -0
- package/ui/view/builder.js +323 -0
- package/ui/view/file-panel.js +170 -0
- package/ui/view/focus.js +379 -0
- package/ui/view/index.html +54 -0
- package/ui/view/map.js +424 -0
- package/ui/view/styles.css +1125 -0
- package/dist/chunk-2X7V4HS4.js +0 -88
- package/dist/chunk-3IER7Q6H.js +0 -12
- package/dist/chunk-3JSXXYTZ.js +0 -345
- package/dist/chunk-476NR5B7.js +0 -2
- package/dist/chunk-5VKBFZZU.js +0 -3
- package/dist/chunk-ADTBPVUZ.js +0 -21
- package/dist/chunk-BFFZDZQV.js +0 -2
- package/dist/chunk-BMYOV5GP.js +0 -77
- package/dist/chunk-C74PPYLA.js +0 -3
- package/dist/chunk-CWONGW6P.js +0 -3
- package/dist/chunk-DDZ7VHWV.js +0 -20
- package/dist/chunk-DR2LURYU.js +0 -3
- package/dist/chunk-ECQBG7PW.js +0 -564
- package/dist/chunk-FM5BPL4V.js +0 -60
- package/dist/chunk-G6XFR4ZL.js +0 -4
- package/dist/chunk-GTIYTDRE.js +0 -562
- package/dist/chunk-HOA5YGOH.js +0 -3
- package/dist/chunk-KUW32IRO.js +0 -2
- package/dist/chunk-LTA3BRZX.js +0 -2
- package/dist/chunk-NAUD7LCA.js +0 -2
- package/dist/chunk-OGTFJ3XD.js +0 -2
- package/dist/chunk-Q5ELPRKQ.js +0 -2
- package/dist/chunk-QCN62RTF.js +0 -3
- package/dist/chunk-QW7EP6WI.js +0 -21
- package/dist/chunk-RU65DDUP.js +0 -215
- package/dist/chunk-SELM5MER.js +0 -2
- package/dist/chunk-SNNWPCN7.js +0 -4
- package/dist/chunk-TFZB6XTM.js +0 -239
- package/dist/chunk-UXM43C7T.js +0 -3
- package/dist/chunk-VFY6Y2H6.js +0 -61
- package/dist/chunk-WE5RZHZ7.js +0 -5
- package/dist/chunk-Z54RD7VL.js +0 -3
- package/dist/cli-context-3SNLDYBM.js +0 -3
- package/dist/cli-context-T3B7W6GG.js +0 -2
- package/dist/cli-program-YNOXO72B.js +0 -7
- package/dist/command-descriptors-6AOUKWW7.js +0 -346
- package/dist/command-descriptors-ZFKJSRUP.js +0 -344
- package/dist/direct-navigation-DP4LVMRX.js +0 -3
- package/dist/direct-navigation-FLUS3BT6.js +0 -2
- package/dist/invocation-command-descriptors-QT2JMY5J.js +0 -3
- package/dist/invocation-command-descriptors-YN4QJEAX.js +0 -2
- package/dist/output-continuation-command-2V2SL4TD.js +0 -2
- package/dist/output-continuation-command-65J5IP3O.js +0 -3
- package/dist/project-reindex-5JOKXAXT.js +0 -2
- package/dist/project-reindex-UQBIKO4M.js +0 -3
package/dist/chunk-2X7V4HS4.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{A as J,B as In,c as Ae,e as yn,h as hn,i as te,j as A,k as me,l as L,n as Sn,o as D,p as R,q as S,t as it,u as ye,v as he,w as re,x as ne,y as bn}from"./chunk-SNNWPCN7.js";import{createRequire as is}from"module";var os=is(import.meta.url),ot=ss().version;function ss(){for(let e of["../package.json","../../package.json"])try{return os(e)}catch{}return{version:"0.0.0"}}import{createHash as Rn,randomUUID as fs}from"crypto";import{chmodSync as vn,existsSync as se,linkSync as gs,lstatSync as ct,readdirSync as qt,realpathSync as G,unlinkSync as ms,writeSync as ys}from"fs";import{homedir as hs}from"os";import{basename as Ss,dirname as dt,isAbsolute as Pn,join as T,resolve as lt}from"path";import{closeSync as as,existsSync as cs,fsyncSync as ds,mkdirSync as ls,openSync as us}from"fs";import{dirname as xn}from"path";function ie(e,t,r,n){let i=0;for(;i<t.length;){let o=r.writeFile(e,t,i,t.length-i);if(!Number.isSafeInteger(o)||o<=0||o>t.length-i)throw new Error(`${n} write did not make valid forward progress`);i+=o}}function Se(e,t){if(t!=="win32")return!1;let r=e.code;return r==="EACCES"||r==="EBADF"||r==="EINVAL"||r==="EISDIR"||r==="EPERM"}var oe=Object.freeze({platform:process.platform,pathExists:e=>cs(e),makeDirectory:e=>ls(e,{recursive:!0}),openFile:(e,t,r)=>us(e,t,r),syncFile:e=>ds(e),closeFile:e=>as(e)});function M(e,t=oe){let r=[],n=e;for(;!t.pathExists(n);){r.push(n);let o=xn(n);if(o===n)throw new Error(`Cannot establish a durable directory path without an existing ancestor: ${e}`);n=o}let i="synced";for(let o of r.reverse())t.makeDirectory(o),i=E(i,I(xn(o),t));return i}function I(e,t=oe){let r;try{r=t.openFile(e,"r")}catch(n){if(Se(n,t.platform))return"unsupported";throw n}try{t.syncFile(r)}catch(n){try{t.closeFile(r)}catch{}if(Se(n,t.platform))return"unsupported";throw n}return t.closeFile(r),"synced"}function E(...e){return e.every(t=>t==="not-requested")?"not-requested":e.includes("unsupported")?"unsupported":"synced"}import{isAbsolute as wn,relative as ps}from"path";var v=class extends Error{constructor(r,n){super(`refusing unsafe project file path ${JSON.stringify(r)} (${n})`);this.relativePath=r;this.reason=n;this.name="UnsafeProjectPathError"}relativePath;reason;code="CODEBASEIQ_UNSAFE_PROJECT_PATH"};function Nt(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}function Ql(e){return e.replace(/\\/g,"/")}function Yl(e,t){return Nt(e)===Nt(t)}function st(e){let t=e.trim();if(!/^file:/i.test(t))return t;let r;try{r=new URL(t)}catch{return t}if(r.protocol!=="file:")return t;let n;try{n=decodeURIComponent(r.pathname)}catch{return t}for(n=n.replace(/\\/g,"/");n.length>1&&n.endsWith("/");)n=n.slice(0,-1);let i=/^\/([A-Za-z]):(\/|$)/.exec(n);i&&(n=`/${i[1].toUpperCase()}:${n.slice(3)}`);let o=n.split("/").map(s=>encodeURIComponent(s).replace(/%3A/gi,":")).join("/");return`file://${r.host}${o}`}function be(e,t){return st(e)===st(t)}function O(e,t){let r=ps(e,t);return r===""||!r.startsWith("..")&&!wn(r)}function j(e){if(!e)throw new v(e,"empty-path");if(e.includes("\0"))throw new v(e,"nul-byte");if(wn(e)||/^[A-Za-z]:/.test(e)||e.startsWith("//")||e.startsWith("\\\\"))throw new v(e,"absolute-path");let t=Nt(e);if(t.split("/").some(n=>n===".."))throw new v(e,"parent-traversal");if(!t||t===".")throw new v(e,"empty-path");return t}var kn=1,Ce=".codebaseiq-cache-owner.json",bs=16*1024,Dn=Object.freeze({...oe,randomToken:()=>fs(),linkFile:(e,t)=>gs(e,t),removeFile:e=>ms(e),writeFile:(e,t,r,n)=>ys(e,t,r,n)});function at(e,t){return Object.assign(new Error(`refusing unsafe project dbPath ${JSON.stringify(e)} (${t}); use a repository-relative directory that remains inside the checkout`),{name:"UnsafeCachePathError",code:"CODEBASEIQ_UNSAFE_CACHE_PATH",configuredPath:e,reason:t})}function N(e,t){return Object.assign(new Error(`refusing unowned cache directory ${JSON.stringify(e)} (${t}); move unrelated data elsewhere or choose a new empty dbPath`),{name:"CacheOwnershipError",code:"CODEBASEIQ_CACHE_OWNERSHIP",cacheDir:e,reason:t})}function Is(e,t){let r=G(e);return xs(r,$t(r,t))}function $t(e,t){let r=G(e),n=process.env.CODEBASEIQ_CACHE_DIR;return n?lt(n):t?.dbPath?Ps(r,t.dbPath):pt(r)}function ut(){let e=process.env.XDG_CACHE_HOME;return T(e||T(hs(),".cache"),"codebaseiq")}function pt(e){let t=lt(e);try{t=G(t)}catch{}let r=Rn("sha256").update(t).digest("hex").slice(0,12);return T(ut(),"projects",r)}function ft(e){if(!/^[a-f0-9]{24}$/.test(e))throw new Error(`invalid repository cache identity: ${e}`);let t=T(ut(),"repositories",e);return Mn(t),G(t)}function zt(e){return process.env.CODEBASEIQ_SHARED_CACHE!=="0"&&!process.env.CODEBASEIQ_CACHE_DIR&&!process.env.CODEBASEIQ_INDEX_DB&&!e?.dbPath}function cu(e,t){let r=Is(e,t);return{cacheDir:r,dbPath:T(r,"index.db"),indexPath:T(r,"index.scip"),metaPath:T(r,"meta.json")}}function xs(e,t,r=Dn){return ws(e,t,r).cacheDir}function ws(e,t,r=Dn){let n=G(e),i=se(t)?"synced":Mn(t,r),o=G(t),s=T(o,Ce);if(se(s))return Bt(n,o),Wt(s),Me(o),{kind:"existing",cacheDir:o};En(o),Ds(o),En(o);let c=`${JSON.stringify({schemaVersion:kn,canonicalProjectRoot:n,canonicalCacheDir:o,creatorVersion:ot},null,2)}
|
|
3
|
-
`;try{let d=Fs(s,c,r),l=E(i,d);return{kind:"published",cacheDir:o,achievedDurability:l==="synced"?"directory-durable":"file-flushed",directorySync:l}}catch(d){if(Ms(d))return Bt(n,o),{kind:"existing",cacheDir:o};throw d}}function Bt(e,t){let r=G(e),n=G(t);return Rs(n,r,n)}function du(e,t){return se(T(t,Ce))?(Bt(e,t),Fn(t),!0):!1}function Ps(e,t){let r;try{r=j(t)}catch(s){throw s instanceof v?at(t,s.reason):s}let n=lt(e,...r.split("/"));if(n===e||!O(e,n))throw at(t,"outside-project");let i=Es(n),o=G(i);if(!O(e,o)&&o!==e)throw at(t,"symlink-escape");return n}function Es(e){let t=e;for(;!se(t);){let r=dt(t);if(r===t)throw at(e,"no-existing-ancestor");t=r}return t}function Rs(e,t,r){let n=T(e,Ce);if(!se(n)||ct(n).isSymbolicLink())throw N(e,"missing regular ownership record");let i=ct(n);if(!i.isFile()||i.size>bs)throw N(e,"invalid ownership record file");let o=S(n,"cache ownership record"),s=vs(o,e);if(s.canonicalProjectRoot!==t)throw N(e,"ownership record belongs to a different project");if(s.canonicalCacheDir!==r)throw N(e,"ownership record names a different cache directory");return{record:s,ownerSha256:Rn("sha256").update(o).digest("hex"),physicalCacheDir:e}}function vs(e,t){try{let r=JSON.parse(e);if(r.schemaVersion!==kn||typeof r.canonicalProjectRoot!="string"||typeof r.canonicalCacheDir!="string"||typeof r.creatorVersion!="string"||!Pn(r.canonicalProjectRoot)||!Pn(r.canonicalCacheDir))throw new Error("invalid fields");return r}catch(r){throw N(t,`malformed ownership record: ${r instanceof Error?r.message:String(r)}`)}}function En(e){let t=qt(e).filter(r=>r!==Ce&&!ks(r));if(t.length>0)throw N(e,`unrecognized existing entries: ${t.slice(0,3).join(", ")}`)}function ks(e){return e.startsWith(`${Ce}.tmp-`)||[".codebaseiq-generations","affected-shadow-latest.json","affected-shadow.jsonl","agent-hooks","augment-vue-meta.json","cache-lifecycle.lock","evidence.db","evidence.db-shm","evidence.db-wal","health-report-cache.json","index.db","index.db-shm","index.db-wal","index.lock","index.scip","language-indexes","meta.json","reindex-activity.jsonl","shared-cache.json","typescript-index","typescript-scip-fragments","typescript-scip-overlays","typescript-semantic","watch-activity.json","watch-refresh-requests","watch-state.json","watch.lock"].includes(e)?!0:/^(?:reindex-|rust-|typescript-)/.test(e)}function Ds(e){for(let t of qt(e)){let r=T(e,t);try{let n=ct(r);if(n.isSymbolicLink())throw N(e,`legacy cache entry ${t} is a symlink`);if(n.isDirectory())Me(r);else if(n.isFile())Wt(r);else throw N(e,`legacy cache entry ${t} is not a file or directory`)}catch(n){if(An(n))continue;throw n}}Me(e)}function Fn(e,t=!1){try{let r=ct(e);if(r.isSymbolicLink())throw N(e,"managed cache tree contains a symlink");if(r.isFile()){Wt(e);return}if(!r.isDirectory())throw N(e,"managed cache tree contains a special file");Me(e);for(let n of qt(e))Fn(T(e,n),!0)}catch(r){if(t&&An(r))return;throw r}}function An(e){let t=e?.code;return t==="ENOENT"||t==="ENOTDIR"}function Mn(e,t=oe){let r=M(e,t);return Me(e),r}function Fs(e,t,r){let n=`${e}.tmp-${process.pid}-${r.randomToken()}`,i,o=!1;try{i=r.openFile(n,"wx",384),o=!0,ie(i,Buffer.from(t),r,"cache ownership record"),r.syncFile(i),r.closeFile(i),i=void 0,r.linkFile(n,e);let s=I(dt(e),r);return r.removeFile(n),o=!1,E(s,I(dt(e),r))}finally{if(i!==void 0)try{r.closeFile(i)}catch{}if(o)try{r.removeFile(n)}catch{}}}function Me(e){process.platform!=="win32"&&vn(e,448)}function Wt(e){process.platform!=="win32"&&vn(e,384)}function As(e){if(se(e))return G(e);let t=[],r=e;for(;;){let n=dt(r);if(n===r)return e;if(t.unshift(Ss(r)),se(n))return T(G(n),...t);r=n}}function Ht(e){return As(lt(e))}function Ms(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="EEXIST"}import Ba from"better-sqlite3";var Cn=[],Ln=[];function uu(e){e.groups.length>0&&Cn.push(e)}function pu(e){Ln.push(e)}function Tn(e){let t=[];for(let r of Ln)try{r.close(e)}catch(n){t.push(n)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Multiple database-owned resources failed to close.")}function fu(e,t){let r=new Set(t.groups);for(let n of Cn)n.groups.some(i=>r.has(i))&&(t.file!==void 0&&n.clearFile?n.clearFile(e,t.file):n.clearAll(e))}import{createHash as Ra,randomUUID as va}from"crypto";import{existsSync as de,mkdirSync as ka,readdirSync as Da,rmSync as si,statSync as ai}from"fs";import{basename as Fa,dirname as Oe,join as C}from"path";function Ut(e,t,r=[]){let n=Vt(e);if(Bn.has(n)||r.some(o=>gt(n,o))||t.some(o=>qn(n,o)))return"config";if(t.some(zn)&&/\.d\.(?:ts|mts|cts)$/.test(n.toLowerCase()))return"ambient";let i=$n(n);return t.some(o=>(Wn[o]??[]).includes(i))?"source":"other"}function Nn(e,t,r){let n=Vt(e);if(Bn.has(n)||r?.some(o=>gt(n,o))||qn(n,t)||zn(t)&&/\.d\.(?:ts|mts|cts)$/.test(n.toLowerCase()))return!0;let i=$n(n);return(Wn[t]??[]).includes(i)}function mu(e){if(typeof e!="object"||e===null)return null;let t=e;return typeof t.version!="number"||!On(t.languages)||typeof t.pnpmWorkspaces!="boolean"||typeof t.typescriptProjectMode!="string"||!On(t.typescriptProjects)||t.clojureConfigPath!==void 0&&typeof t.clojureConfigPath!="string"||!Array.isArray(t.files)||!t.files.every(Jt)?null:t}function yu(e,t){let r=new Map((e?.files??[]).map(a=>[a.path,a])),n=new Map(t.files.map(a=>[a.path,a])),i=new Set([...r.keys(),...n.keys()]),o=[];for(let a of[...i].sort()){let c=r.get(a),d=n.get(a),l=Ut(a,t.languages);!c&&d?o.push({kind:"added",path:a,inputKind:l,after:d}):c&&!d?o.push({kind:"deleted",path:a,inputKind:l,before:c}):c&&d&&(c.hash!==d.hash||c.size!==d.size)&&o.push({kind:"modified",path:a,inputKind:l,before:c,after:d})}let s=new Set;return e||s.add("prior-snapshot-unavailable"),e&&e.version!==t.version&&s.add("snapshot-version-changed"),(jn(e?.files??[])||jn(t.files))&&s.add("duplicate-input-path"),[...e?.files??[],...t.files].some(Cs)&&s.add("unreadable-input"),{version:1,changes:o,projectIdentityChanged:e?!Ls(e,t):!0,uncertainty:[...s].sort()}}function On(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function jn(e){return new Set(e.map(t=>t.path)).size!==e.length}function Jt(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.path=="string"&&typeof t.size=="number"&&Number.isFinite(t.size)&&typeof t.hash=="string"}function Cs(e){return e.hash==="unreadable"||e.size<0}function Ls(e,t){return Gn(e.languages,t.languages)&&e.pnpmWorkspaces===t.pnpmWorkspaces&&e.typescriptProjectMode===t.typescriptProjectMode&&Gn(e.typescriptProjects,t.typescriptProjects)&&e.clojureConfigPath===t.clojureConfigPath}function Gn(e,t){if(e.length!==t.length)return!1;let r=[...e].sort(),n=[...t].sort();return r.every((i,o)=>i===n[o])}var Bn=new Set([".codebaseiq.json"]),Ts={typescript:["tsconfig.json"],javascript:["package.json"],java:["pom.xml","build.gradle"],scala:["build.sbt"],kotlin:["build.gradle.kts"],rust:["Cargo.toml"],python:["pyproject.toml","setup.py"],ruby:["Gemfile"],go:["go.mod"],cpp:["CMakeLists.txt","Makefile"],c:["CMakeLists.txt","Makefile"],csharp:["*.csproj","*.sln"],vb:["*.vbproj","*.sln"],dart:["pubspec.yaml"],php:["composer.json"],clojure:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"]},Os={typescript:["package.json","package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb","tsconfig.*.json","jsconfig.json","jsconfig.*.json"],javascript:["package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb","tsconfig.json","tsconfig.*.json","jsconfig.json","jsconfig.*.json"],java:["build.gradle.kts","settings.gradle","settings.gradle.kts","gradle.properties","gradle.lockfile","gradle-wrapper.properties"],scala:["plugins.sbt","build.properties"],kotlin:["pom.xml","build.gradle","settings.gradle","settings.gradle.kts","gradle.properties","gradle.lockfile","gradle-wrapper.properties"],rust:["Cargo.lock","rust-project.json","rust-toolchain","rust-toolchain.toml"],python:["setup.cfg","requirements*.txt","Pipfile","Pipfile.lock","poetry.lock","uv.lock"],ruby:["Gemfile.lock","gems.locked"],go:["go.sum","go.work","go.work.sum"],cpp:["compile_commands.json"],c:["compile_commands.json"],csharp:["Directory.Build.props","Directory.Build.targets","Directory.Packages.props","packages.lock.json","NuGet.Config","global.json"],vb:["Directory.Build.props","Directory.Build.targets","Directory.Packages.props","packages.lock.json","NuGet.Config","global.json"],dart:["pubspec.lock","analysis_options.yaml"],php:["composer.lock"],clojure:[]},_n=new Map;function qn(e,t){return Ts[t].some(r=>gt(e,r))||Os[t].some(r=>gt(e,r))}function gt(e,t){let r=Vt(t).replace(/^\.\//,"");if(!r)return!1;let n=e.split("/").at(-1)??e,i=r.includes("/")?e:n;if(!r.includes("*")&&!r.includes("?"))return i===r;let o=_n.get(r);if(!o){let s=r.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,"[^/]*").replace(/\?/g,"[^/]");o=new RegExp(`^${s}$`),_n.set(r,o)}return o.test(i)}function Vt(e){return e.replaceAll("\\","/").replace(/^\.\//,"")}function $n(e){return e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:""}function zn(e){return e==="typescript"||e==="javascript"}var Wn={typescript:[".ts",".tsx",".mts",".cts"],javascript:[".js",".jsx",".mjs",".cjs",".vue"],java:[".java"],scala:[".scala"],kotlin:[".kt",".kts"],rust:[".rs"],python:[".py",".pyi"],ruby:[".rb"],go:[".go"],cpp:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"],c:[".c",".h"],csharp:[".cs"],vb:[".vb"],dart:[".dart"],php:[".php"],clojure:[".clj",".cljs",".cljc"]};var Kt=2,ae=3;var Qt=new Set(bn);function mt(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch(s){return{kind:"malformed",reason:`invalid JSON: ${$s(s)}`}}if(!J(t))return{kind:"malformed",reason:"metadata must be a JSON object"};let r=t.version;if(!Number.isInteger(r))return{kind:"malformed",reason:"version must be an integer"};if(r!==Kt&&r!==ae)return{kind:"unsupported",version:r,direction:r<Kt?"older":"future"};let n=Gs(t,r);if(n)return{kind:"malformed",reason:n};let i=t,o={metadata:i,capabilities:js(i)};return r===Kt?{kind:"legacy",...o,metadata:i}:{kind:"supported",...o,metadata:i}}function wu(e){return e.kind==="legacy"||e.kind==="supported"?e.metadata:null}function Hn(e){if(e.kind!=="legacy"&&e.kind!=="supported"||!e.capabilities.stableGenerationIdentity)return null;let t=e.metadata;return JSON.stringify({version:t.version,status:t.status,updatedAt:t.updatedAt,fingerprint:t.fingerprint,indexedLanguages:t.indexedLanguages,scipCompanion:t.scipCompanion,sqliteLayoutVersion:t.version===ae?t.sqliteLayoutVersion:void 0})}function js(e){let t=e.fingerprint!==void 0,r=J(e.fingerprint),n=e.indexedLanguages!==void 0,i=e.status==="complete",o=e.version===ae?e:null;return{usableForQuery:n,usableForEvidenceCache:t,publishableGeneration:i&&r&&n,stableGenerationIdentity:i&&t&&typeof e.updatedAt=="string",languageShardReuse:!!o?.languageFingerprints,typescriptProjectShardReuse:!!o?.typescriptProjectShards}}function Gs(e,t){if(e.status!=="complete"&&e.status!=="partial")return"status must be complete or partial";if(e.updatedAt!==void 0&&!In(e.updatedAt))return"updatedAt must be a valid timestamp";for(let r of["requestedLanguages","indexedLanguages"])if(e[r]!==void 0&&!_s(e[r]))return`${r} must contain unique supported languages`;return e.skipped!==void 0&&!Ns(e.skipped)?"skipped must contain supported language/reason pairs":e.scipCompanion!==void 0&&e.scipCompanion!=="current"&&e.scipCompanion!=="deferred"?"scipCompanion must be current or deferred":t===ae&&e.sqliteLayoutVersion!==void 0&&(!Number.isSafeInteger(e.sqliteLayoutVersion)||e.sqliteLayoutVersion<1)?"sqliteLayoutVersion must be a positive safe integer":t===ae&&e.languageFingerprints!==void 0&&!Bs(e.languageFingerprints)?"languageFingerprints must map supported languages to fingerprint objects":t===ae&&e.typescriptProjectShards!==void 0&&!qs(e.typescriptProjectShards)?"typescriptProjectShards must map project names to file fingerprints":null}function Pu(e){return e.version===ae&&e.sqliteLayoutVersion===1}function _s(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string"&&Qt.has(t))?!1:new Set(e).size===e.length}function Ns(e){return Array.isArray(e)&&e.every(t=>J(t)&&typeof t.language=="string"&&Qt.has(t.language)&&typeof t.reason=="string")}function Bs(e){return J(e)&&Object.entries(e).every(([t,r])=>Qt.has(t)&&J(r))}function qs(e){return J(e)&&Object.values(e).every(t=>J(t)&&Array.isArray(t.files)&&t.files.every(Jt))}function $s(e){return e instanceof Error?e.message:String(e)}import{join as ra}from"path";function ce(){return performance.now()}function yt(e,t){return e.reason instanceof Error?e.reason:new Error(t)}function Un(e,t){if(e?.aborted)throw yt(e,t)}import{randomUUID as zs}from"crypto";import{closeSync as Ws,fsyncSync as Hs,linkSync as Us,mkdirSync as Js,openSync as Vs,statSync as Ks,unlinkSync as Qs,writeSync as Ys}from"fs";import{dirname as tr}from"path";var Xt="codebaseiq-process-lock",Zt=1,ht=Object.freeze({wallNow:()=>Date.now(),isProcessAlive:te,readProcessIdentity:ne,randomToken:()=>zs(),makeDirectory:e=>Js(e,{recursive:!0}),openFile:(e,t,r)=>Vs(e,t,r),writeFile:(e,t,r,n)=>Ys(e,t,r,n),syncFile:e=>Hs(e),closeFile:e=>Ws(e),linkFile:(e,t)=>Us(e,t),readFile:e=>S(e,"process lock record"),statFile:e=>{let t=Ks(e);return{dev:t.dev,ino:t.ino,size:t.size,mtimeMs:t.mtimeMs}},removeFile:e=>Qs(e)});function St(e,t){let r=t.runtime??ht;r.makeDirectory(tr(e));let n;for(let i=0;i<2;i+=1)try{return{kind:"acquired",lock:Vn(e,t,r),...n?{reclaimed:n}:{}}}catch(o){if(o.code!=="EEXIST")throw o;let s=Ie(e,{parseLegacy:t.parseLegacy,runtime:r});if(i===0&&Zs(e,s,{creationGraceMs:t.creationGraceMs,parseLegacy:t.parseLegacy,runtime:r})){n=s;continue}return{kind:"contended",observation:s}}return{kind:"contended",observation:Ie(e,{parseLegacy:t.parseLegacy,runtime:r})}}function Ie(e,t={}){let r=t.runtime??ht,n,i;try{n=r.statFile(e),i=r.readFile(e)}catch(c){return c.code==="ENOENT"?{state:"missing"}:{state:"malformed"}}let o;try{o=JSON.parse(i)}catch{return{state:"malformed",raw:i,identity:n}}let s=Xs(o);if(s)return{state:"valid",raw:i,identity:n,record:s,owner:ta(s),parsed:o};let a=t.parseLegacy?.(o)??null;return a?{state:"legacy",raw:i,identity:n,owner:a,parsed:o}:{state:"malformed",raw:i,identity:n,parsed:o}}function Xs(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e;if(t.protocol!==Xt||t.version!==Zt||typeof t.kind!="string"||t.kind.trim()===""||typeof t.pid!="number"||!Number.isSafeInteger(t.pid)||t.pid<=0||typeof t.token!="string"||t.token.trim()===""||typeof t.startedAt!="string"||!Number.isFinite(Date.parse(t.startedAt))||t.detail!==void 0&&(typeof t.detail!="object"||t.detail===null||Array.isArray(t.detail)))return null;let r=t.processIdentity===void 0?null:he(t.processIdentity);return t.processIdentity!==void 0&&(!r||r.pid!==t.pid)?null:{protocol:Xt,version:Zt,kind:t.kind,pid:t.pid,token:t.token,...r?{processIdentity:r}:{},startedAt:t.startedAt,...t.detail?{detail:t.detail}:{}}}function Zs(e,t,r={}){let n=r.runtime??ht;if(!er(t,n))return!1;let i=ea(`${e}.reclaim`,n);if(!i)return!1;try{let o=Ie(e,{parseLegacy:r.parseLegacy,runtime:n});return!Kn(t,o)||!er(o,n)?!1:rr(e,n)}finally{i.release()}}function Vn(e,t,r){let n=t.pid??process.pid,i=r.randomToken(),o=t.processIdentity===void 0?r.readProcessIdentity(n):t.processIdentity,s={protocol:Xt,version:Zt,kind:t.kind,pid:n,token:i,...o?{processIdentity:o}:{},startedAt:new Date(r.wallNow()).toISOString(),...t.detail?{detail:t.detail}:{}},a=`${e}.${i}.candidate`,c=r.openFile(a,"wx",384),d;try{ie(c,Buffer.from(`${JSON.stringify(s)}
|
|
4
|
-
`),r,"process lock"),r.syncFile(c)}catch(u){d=u}try{r.closeFile(c)}catch(u){d??=u}if(d!==void 0)throw Yt(a,r),d;try{r.linkFile(a,e)}catch(u){throw Yt(a,r),u}Yt(a,r);try{Qn(tr(e),r)}catch(u){throw Jn(e,s,r),u}let l=!1;return{path:e,record:s,release:()=>l?!1:(l=!0,Jn(e,s,r))}}function Jn(e,t,r=ht){let n=Ie(e,{runtime:r});return n.state!=="valid"||!n.record||n.record.pid!==t.pid||n.record.token!==t.token||t.processIdentity&&(!n.record.processIdentity||!re(t.processIdentity,n.record.processIdentity))?!1:rr(e,r)}function ea(e,t){for(let r=0;r<2;r+=1)try{return Vn(e,{kind:"reclaim-guard",runtime:t},t)}catch(n){if(n.code!=="EEXIST")return null;let i=Ie(e,{runtime:t});if(r>0||!er(i,t))return null;let o=Ie(e,{runtime:t});if(!Kn(i,o)||!rr(e,t))return null}return null}function er(e,t){if(e.state==="missing")return!1;if(e.owner){if(!t.isProcessAlive(e.owner.pid))return!0;if(!e.owner.processIdentity)return!1;let r=t.readProcessIdentity(e.owner.pid);return r!==null&&!re(e.owner.processIdentity,r)}return!1}function Kn(e,t){return e.state===t.state&&e.raw===t.raw&&e.identity!==void 0&&t.identity!==void 0&&e.identity.dev===t.identity.dev&&e.identity.ino===t.identity.ino&&e.identity.size===t.identity.size&&e.identity.mtimeMs===t.identity.mtimeMs}function ta(e){return{pid:e.pid,...e.processIdentity?{processIdentity:e.processIdentity}:{}}}function Qn(e,t){let r;try{r=t.openFile(e,"r")}catch(n){if(Se(n,process.platform))return;throw n}try{t.syncFile(r)}catch(n){if(!Se(n,process.platform))throw n}finally{t.closeFile(r)}}function rr(e,t){try{return t.removeFile(e),Qn(tr(e),t),!0}catch{return!1}}function Yt(e,t){try{t.removeFile(e)}catch{}}var na=e=>{if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e.pid;return typeof t=="number"&&Number.isSafeInteger(t)&&t>0?{pid:t}:null};function Yn(e,t={}){return B(ra(e,"gc.lock"),t)}function B(e,t={}){let r=t.waitMs??0,n=t.pollMs??10,i=t.now??ce,o=i()+r;do{let s=Xn(e);if(s)return Zn(s);let a=o-i();if(a<=0)return null;ia(Math.min(n,a))}while(i()<=o);return null}async function Nu(e,t={}){let r=t.waitMs??0,n=t.pollMs??10,i=t.now??ce,o=i()+r;do{Un(t.signal,"Lock acquisition was aborted.");let s=Xn(e);if(s)return Zn(s);let a=o-i();if(a<=0)return null;await oa(Math.min(n,a),t.signal)}while(i()<=o);return null}function Xn(e){let t=St(e,{kind:"generic",parseLegacy:na});return t.kind==="acquired"?t.lock:null}function Zn(e){return{release:()=>{e.release()}}}function ia(e){let t=new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));Atomics.wait(t,0,0,e)}function oa(e,t){return t?.aborted?Promise.reject(yt(t,"Lock acquisition was aborted.")):new Promise((r,n)=>{let i=setTimeout(()=>{t?.removeEventListener("abort",o),r()},e),o=()=>{clearTimeout(i),t?.removeEventListener("abort",o),n(t?yt(t,"Lock acquisition was aborted."):new Error("Lock acquisition was aborted."))};t?.addEventListener("abort",o,{once:!0})})}import{randomUUID as ma}from"crypto";import{closeSync as ya,existsSync as ha,fsyncSync as Sa,linkSync as ba,mkdirSync as Ia,openSync as xa,renameSync as wa,unlinkSync as Pa,writeSync as Ea}from"fs";import{dirname as ti}from"path";var sa=Object.freeze(["EPERM","EACCES","EBUSY"]),aa=Object.freeze([10,20,40,80,160,320,640,1e3,1e3,1e3]);function ca(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)}var nr=Object.freeze({platform:process.platform,sleep:ca});function da(e,t){if(t!=="win32")return!1;let r=e?.code;return typeof r=="string"&&sa.includes(r)}function k(e,t={}){let r=t.runtime??nr,n=t.delaysMs??aa;for(let i of n)try{return e()}catch(o){if(!da(o,r.platform))throw o;r.sleep(i)}return e()}import{chmodSync as la,constants as ua,copyFileSync as pa}from"fs";import{dirname as fa}from"path";var ei=Object.freeze({...oe,copyFile:(e,t)=>pa(e,t,ua.COPYFILE_FICLONE),chmodFile:(e,t)=>la(e,t)});function Le(e,t,r={}){let n=r.runtime??ei,i=fa(t),o=M(i,n);if(n.copyFile(e,t),n.platform==="win32")ga(t,r.mode,n);else{r.mode!==void 0&&n.chmodFile(t,r.mode);let s=n.openFile(t,"r");try{n.syncFile(s)}finally{n.closeFile(s)}}return E(o,I(i,n))}function ga(e,t,r){let n=!1,i;try{i=r.openFile(e,"r+")}catch(o){let s=o.code;if(s!=="EACCES"&&s!=="EPERM")throw o;r.chmodFile(e,384),n=!0,i=r.openFile(e,"r+")}try{r.syncFile(i)}finally{r.closeFile(i)}t!==void 0?r.chmodFile(e,t):n&&r.chmodFile(e,292)}var ri=Object.freeze({platform:process.platform,randomToken:()=>ma(),pathExists:e=>ha(e),makeDirectory:e=>Ia(e,{recursive:!0}),openFile:(e,t,r)=>xa(e,t,r),writeFile:(e,t,r,n)=>Ea(e,t,r,n),syncFile:e=>Sa(e),closeFile:e=>ya(e),renameFile:(e,t)=>wa(e,t),linkFile:(e,t)=>ba(e,t),removeFile:e=>Pa(e)});function ir(e,t,r={}){let n=r.durability??"visibility",i=r.runtime??ri,o=ti(e),s=n==="durable"?M(o,i):(i.makeDirectory(o),"not-requested"),a=`${e}.tmp-${i.randomToken()}`,c=typeof t=="string"?Buffer.from(t):t,d,l=!1;try{d=i.openFile(a,"wx",r.mode??384),l=!0,ie(d,c,i,"atomic file"),n==="durable"&&i.syncFile(d),i.closeFile(d),d=void 0,k(()=>i.renameFile(a,e),{runtime:{platform:i.platform,sleep:i.sleep??nr.sleep}}),l=!1;let u=n==="durable"?E(s,I(o,i)):"not-requested";return ni(n,u)}finally{if(d!==void 0)try{i.closeFile(d)}catch{}if(l)try{i.removeFile(a)}catch{}}}function or(e,t,r={}){let n=r.durability??"visibility",i=r.runtime??ri;if(!i.linkFile)throw new Error("Exclusive atomic file publication requires hard-link support.");let o=ti(e),s=n==="durable"?M(o,i):(i.makeDirectory(o),"not-requested"),a=`${e}.tmp-${i.randomToken()}`,c=typeof t=="string"?Buffer.from(t):t,d,l=!1;try{d=i.openFile(a,"wx",r.mode??384),l=!0,ie(d,c,i,"exclusive atomic file"),n==="durable"&&i.syncFile(d),i.closeFile(d),d=void 0,i.linkFile(a,e);let u=n==="durable"?I(o,i):"not-requested";i.removeFile(a),l=!1;let p=n==="durable"?E(s,u,I(o,i)):"not-requested";return ni(n,p)}finally{if(d!==void 0)try{i.closeFile(d)}catch{}if(l)try{i.removeFile(a)}catch{}}}function ni(e,t){return{requestedDurability:e,achievedDurability:e==="visibility"?"visibility":t==="synced"?"directory-durable":"file-flushed",directorySync:t}}function V(e,t,r={}){ir(e,ii(t,r),{durability:"visibility",runtime:r.runtime})}function q(e,t,r={}){return ir(e,ii(t,r),{durability:"durable",runtime:r.runtime})}function ii(e,t){let r=JSON.stringify(e,null,t.spacing);return t.trailingNewline?`${r}
|
|
5
|
-
`:r}var le=1,dr=1,je=".codebaseiq-generations",bt="manifest.json",ci="readers",Aa="gc.lock",Ma=128,Te=new Map,di={pid:process.pid,now:()=>new Date,randomToken:()=>va(),isProcessAlive:te,readProcessIdentity:ne,resolveImmutableGeneration:ui};function P(e){return C(Oe(e),je)}function Ge(e){return C(P(e),Aa)}function li(e,t=di){let r=B(Ge(e.dbPath),{waitMs:5e3});if(!r)throw new Error("SQLite generation retention is busy; retry opening the index.");let n;try{let o=$(e.dbPath);if(!o||!_e(e.dbPath,o.currentGeneration))return{generation:ur(e),release(){}};let s=t.randomToken();if(!/^[A-Za-z0-9._-]+$/.test(s))throw new Error("SQLite generation reader token is unsafe.");let a=C(P(e.dbPath),ci);ka(a,{recursive:!0});let c=C(a,`${t.pid}-${s}.json`),d=t.readProcessIdentity(t.pid);V(c,{version:1,token:s,generationIdentity:o.currentGeneration,pid:t.pid,...d?{processIdentity:d}:{},acquiredAt:t.now().toISOString()},{spacing:2,trailingNewline:!0});let l=!1;n={identity:o.currentGeneration,required:o.artifactSet==="immutable-v1",release(){l||(l=!0,si(c,{force:!0}))}}}finally{r.release()}let i;try{i=t.resolveImmutableGeneration(e,n.identity)}catch(o){throw n.release(),o}if(i?.source==="immutable"&&i.identity===n.identity)return{generation:i,release:n.release};if(n.release(),n.required)throw new Error(`Published SQLite generation ${n.identity} is missing or invalid.`);return Ca(e,n.identity)}function Ca(e,t){let r=B(Ge(e.dbPath),{waitMs:5e3});if(!r)throw new Error("SQLite generation retention is busy; retry opening the index.");try{let n=$(e.dbPath);if(n?.currentGeneration!==t)throw new Error("SQLite index publication changed while opening a legacy generation.");if(de(C(Oe(e.dbPath),"index.lock")))throw new Error("Legacy SQLite publication is in progress; retry after the reindex lock is released.");return{generation:pi(e,n.currentGeneration),release(){}}}finally{r.release()}}function lr(e,t,r=di,n={}){let i=C(P(e),ci);if(!de(i))return{protectedGenerations:new Set,activeLeases:0,staleLeasesRemoved:0,malformedLeases:0};let o=new Set,s=0,a=0,c=0;for(let d of Da(i,{withFileTypes:!0})){if(!d.isFile()||!d.name.endsWith(".json"))continue;let l=C(i,d.name),u;try{u=La(JSON.parse(S(l,"SQLite generation reader lease")))}catch{u=null}if(!u){c+=1;for(let p of t)o.add(p);continue}if(!Ta(u,r)){n.removeStale!==!1&&(si(l,{force:!0}),a+=1);continue}s+=1,o.add(u.generationIdentity)}return{protectedGenerations:o,activeLeases:s,staleLeasesRemoved:a,malformedLeases:c}}function La(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,r=t.processIdentity===void 0?null:he(t.processIdentity);return t.version!==1||typeof t.token!="string"||t.token.trim()===""||typeof t.generationIdentity!="string"||!/^[a-f0-9]{64}$/.test(t.generationIdentity)||typeof t.pid!="number"||!Number.isSafeInteger(t.pid)||t.pid<=0||typeof t.acquiredAt!="string"||!Number.isFinite(Date.parse(t.acquiredAt))||t.processIdentity!==void 0&&(!r||r.pid!==t.pid)?null:{version:1,token:t.token,generationIdentity:t.generationIdentity,pid:t.pid,...r?{processIdentity:r}:{},acquiredAt:t.acquiredAt}}function Ta(e,t){if(!t.isProcessAlive(e.pid))return!1;if(!e.processIdentity)return!0;let r=t.readProcessIdentity(e.pid);return r===null||re(e.processIdentity,r)}function $(e){try{let t=JSON.parse(S(C(P(e),"state.json"),"SQLite generation state"));return ja(t)?t:null}catch{return null}}function _e(e,t){return Ne(P(e),t)}function Ne(e,t){try{let r=JSON.parse(S(C(e,t,bt),"SQLite generation manifest"));return Oa(r,t)?r:null}catch{return null}}function ur(e){let t=$(e.dbPath);if(t){let r=ui(e,t.currentGeneration);if(r)return r;if(t.artifactSet==="immutable-v1")throw new Error(`Published SQLite generation ${t.currentGeneration} is missing or invalid.`)}if(de(C(Oe(e.dbPath),"index.lock")))throw new Error("Legacy SQLite publication is in progress; retry after the reindex lock is released.");return pi(e,t?.currentGeneration)}function fp(e){let t=$(e);if(t)return t.currentGeneration;try{let r=C(Oe(e),"meta.json"),n=de(r)?S(r,"reindex metadata"):void 0;return fi(e,n)}catch{return null}}function K(e){return Hn(mt(e))??e}function ui(e,t){try{let r=C(P(e.dbPath),t),n=_e(e.dbPath,t);if(!n)return null;let i=sr(r,n.database),o=n.index?sr(r,n.index):void 0,s=n.metadata?sr(r,n.metadata):void 0;return!ar(i,n.database)||n.index&&(!o||!ar(o,n.index))||n.metadata&&(!s||!ar(s,n.metadata))?null:{identity:t,databasePath:i,...o?{indexPath:o}:{},...s?{metadataPath:s,metadataRaw:S(s,"reindex metadata")}:{},source:"immutable"}}catch{return null}}function pi(e,t){let r=H(e.dbPath),n=C(Oe(e.dbPath),"meta.json"),i=de(n)?S(n,"reindex metadata"):void 0,o=de(e.indexPath)?e.indexPath:void 0;return{identity:t??fi(e.dbPath,i),databasePath:e.dbPath,...o?{indexPath:o}:{},...i===void 0?{}:{metadataPath:n,metadataRaw:i},source:"legacy",databaseFileIdentity:r}}function fi(e,t){let r=Ra("sha256").update("sqlite-generation-legacy-v1\0");return t!==void 0&&r.update(K(t)),r.update(`\0${H(e)}`),r.digest("hex")}function H(e){let t=ai(e);return`${t.dev}:${t.ino}:${t.size}:${t.mtimeMs}`}function sr(e,t){if(Fa(t.file)!==t.file||t.file==="."||t.file==="..")throw new Error("SQLite generation manifest contains an unsafe artifact path");return C(e,t.file)}function ar(e,t){if(!de(e))return!1;let r=oi(e);if(!r||r.size!==t.size)return!1;let n=`${e}\0${t.sha256}\0${r.identity}`;if(Te.has(n))return!0;let i=ye(e,{inputKind:"immutable SQLite generation artifact",maxBytes:t.size}),o=oi(e);if(!o||o.identity!==r.identity||i!==t.sha256)return!1;for(Te.set(n,!0);Te.size>Ma;){let s=Te.keys().next().value;if(s===void 0)break;Te.delete(s)}return!0}function oi(e){let t=ai(e,{bigint:!0});return t.isFile()?{identity:`${t.dev}:${t.ino}:${t.size}:${t.mtimeNs}:${t.ctimeNs}`,size:Number(t.size)}:null}function Oa(e,t){return e.version===dr&&e.identity===t&&cr(e.database)&&(e.index===void 0||cr(e.index))&&(e.metadata===void 0||cr(e.metadata))}function cr(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.file=="string"&&!!t.file&&Number.isSafeInteger(t.size)&&(t.size??-1)>=0&&typeof t.sha256=="string"&&/^[a-f0-9]{64}$/.test(t.sha256)}function ja(e){return e.version===le&&typeof e.currentGeneration=="string"&&!!e.currentGeneration&&typeof e.publishedAt=="string"&&Number.isFinite(Date.parse(e.publishedAt))&&(e.artifactSet===void 0||e.artifactSet==="immutable-v1")&&Ga(e.stableMirrors)&&_a(e.previousGeneration)&&Na(e.publication)}function Ga(e){if(e===void 0)return!0;if(!e||typeof e!="object")return!1;let t=e;return typeof t.databaseFileIdentity=="string"&&!!t.databaseFileIdentity&&(t.indexFileIdentity===void 0||typeof t.indexFileIdentity=="string"&&!!t.indexFileIdentity)}function _a(e){if(e===void 0)return!0;if(!e||typeof e!="object")return!1;let t=e;return typeof t.generationIdentity=="string"&&!!t.generationIdentity&&typeof t.databasePath=="string"&&!!t.databasePath&&(t.metadataPath===void 0||typeof t.metadataPath=="string"&&!!t.metadataPath)}function Na(e){if(e===void 0)return!0;if(!e||typeof e!="object")return!1;let t=e,r=[t.converterDurationMs,t.affectedDocumentCount,t.changedDocumentCount,t.producerDurationMs,t.materializationDurationMs,t.patchDurationMs].filter(n=>n!==void 0);return(t.mode==="incremental"||t.mode==="full")&&t.validation==="passed"&&t.converterDurationMs!==void 0&&r.every(n=>typeof n=="number"&&Number.isFinite(n)&&n>=0)&&(t.scipCompanion===void 0||t.scipCompanion==="current"||t.scipCompanion==="deferred")&&(t.typescriptOverlayGeneration===void 0||typeof t.typescriptOverlayGeneration=="string"&&!!t.typescriptOverlayGeneration)&&(t.scipCompanion!=="deferred"||!!t.typescriptOverlayGeneration)&&(t.fallbackReason===void 0||typeof t.fallbackReason=="string")}var qa=["busy_timeout = 5000","query_only = ON","temp_store = MEMORY","cache_size = -64000","mmap_size = 268435456"],pr=class{constructor(t,r){this.connection=t;this.releaseGenerationReader=r}connection;releaseGenerationReader;active=!0;initialize(t){try{for(let r of qa)this.connection.pragma(r);t(this.connection)}catch(r){try{this.close()}catch(n){throw new AggregateError([r,n],"SQLite initialization and rollback both failed.",{cause:n})}throw r}}close(){if(!this.active)return;this.active=!1;let t,r;try{this.connection.close()}catch(n){t=n}try{this.releaseGenerationReader()}catch(n){r=n}if(t!==void 0&&r!==void 0)throw new AggregateError([t,r],"SQLite connection close and generation-reader release both failed.");if(t!==void 0)throw t;if(r!==void 0)throw r}},$a=["node_modules",".git","dist","build","out","coverage","target",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs",".codebaseiq-cache","__pycache__",".venv","venv"],gi=class{db;config;generation;pathFilter;connection;connectionOwnership;statementCache=new Map;closed=!1;constructor(t,r){this.config=t,this.pathFilter=r??null;let n=Ua(t),i=new pr(n.db,n.release);try{i.initialize(Ha),this.generation=n.generation,this.connection=n.db,this.connectionOwnership=i,this.db=za(n.db)}catch(o){try{i.close()}catch(s){throw new AggregateError([o,s],"SQLite construction and rollback both failed.",{cause:s})}throw o}}isIgnored(t){return this.pathFilter?.isIgnored(t)??!1}get localSymbolPredicate(){return`(
|
|
6
|
-
EXISTS (
|
|
7
|
-
SELECT 1
|
|
8
|
-
FROM defn_enclosing_ranges local_der
|
|
9
|
-
JOIN documents local_d ON local_der.document_id = local_d.id
|
|
10
|
-
WHERE local_der.symbol_id = gs.id
|
|
11
|
-
${this.pathExclusionsFor("local_d").trimStart()}
|
|
12
|
-
)
|
|
13
|
-
OR EXISTS (
|
|
14
|
-
SELECT 1
|
|
15
|
-
FROM mentions local_m
|
|
16
|
-
JOIN chunks local_c ON local_m.chunk_id = local_c.id
|
|
17
|
-
JOIN documents local_d ON local_c.document_id = local_d.id
|
|
18
|
-
WHERE local_m.symbol_id = gs.id
|
|
19
|
-
AND local_m.role = 1
|
|
20
|
-
${this.pathExclusionsFor("local_d").trimStart()}
|
|
21
|
-
)
|
|
22
|
-
)`}get pathExclusions(){return this.pathExclusionsFor("d")}get symbolNoise(){return this.symbolNoiseFor("gs")}pathExclusionsFor(...t){return t.flatMap(r=>$a.flatMap(n=>[`AND ${r}.relative_path NOT LIKE '${n}/%'`,`AND ${r}.relative_path NOT LIKE '%/${n}/%'`])).join(`
|
|
23
|
-
`)}symbolNoiseFor(t){return`AND ${t}.symbol NOT LIKE '%().(%' AND ${t}.symbol NOT LIKE '%typeLiteral%'`}all(t,...r){return this.statement(t).all(...r)}get(t,...r){return this.statement(t).get(...r)}close(){if(this.closed)return;this.closed=!0,this.statementCache.clear();let t,r;try{Tn(this)}catch(n){t=n}try{this.connectionOwnership.close()}catch(n){r=n}if(t!==void 0&&r!==void 0)throw new AggregateError([t,r],"Database-owned resource and SQLite connection cleanup both failed.");if(t!==void 0)throw t;if(r!==void 0)throw r}statement(t){let r=this.statementCache.get(t);return r||(r=this.connection.prepare(t),this.statementCache.set(t,r)),r}};function za(e){return Object.freeze({prepare(t){let r=e.prepare(t);if(!r.readonly||!r.reader)throw new Error("ScipDatabase.db only permits read-only statements that return rows.");return Wa(r)}})}function Wa(e){let t={get:(...r)=>e.get(...r),all:(...r)=>e.all(...r),iterate:(...r)=>e.iterate(...r),pluck(r){return r===void 0?e.pluck():e.pluck(r),t},expand(r){return r===void 0?e.expand():e.expand(r),t},raw(r){return r===void 0?e.raw():e.raw(r),t},bind(...r){return e.bind(...r),t},columns:()=>e.columns(),safeIntegers(r){return r===void 0?e.safeIntegers():e.safeIntegers(r),t}};return Object.freeze(t)}function Ha(e){if(!e.prepare("SELECT 1 AS present FROM sqlite_master WHERE type = 'table' AND name = 'documents'").get())return;let r=e.prepare("SELECT relative_path FROM documents").iterate();for(let n of r)j(n.relative_path)}function Ua(e){for(let t=0;t<4;t+=1){let r=li(e),n=r.generation,i;try{i=new Ba(n.databasePath,{readonly:!0,fileMustExist:!0})}catch(o){throw r.release(),o}if(n.source==="immutable")return{db:i,generation:n,release:r.release};try{let o=ur(e);if(n.databaseFileIdentity===H(n.databasePath)&&o.source==="legacy"&&o.identity===n.identity&&o.databaseFileIdentity===n.databaseFileIdentity&&o.metadataRaw===n.metadataRaw)return{db:i,generation:n,release:r.release}}catch(o){throw i.close(),r.release(),o}i.close(),r.release()}throw new Error("SQLite index publication changed repeatedly while opening a coherent generation.")}import Ja from"ignore";import{existsSync as mi,readdirSync as Va}from"fs";import{dirname as fr,isAbsolute as yi,join as It,relative as Ka,resolve as Qa}from"path";function Ep(e){let t=Ja();return Ya(e,t)||t.add(ec),{isIgnored:n=>gr(t,e,n),filter:n=>n.filter(i=>!gr(t,e,i))}}function Ya(e,t){let r=new Set,n=(s,a)=>{if(!(r.has(s)||!mi(s)))try{let c=R(s,{maxBytes:A,inputKind:"gitignore file"});t.add(a?Xa(c,a):c),r.add(s)}catch{}},i=fr(e),o=0;for(;i!==fr(i)&&o<5&&(n(It(i,".gitignore"),""),!mi(It(i,".git")));)i=fr(i),o++;return hi(e,"",t,n),r.size>0}function hi(e,t,r,n){let i=t?It(e,t):e;n(It(i,".gitignore"),t);let o;try{o=Va(i,{withFileTypes:!0})}catch{return}for(let s of o){if(!s.isDirectory()||s.name===".git")continue;let a=t?`${t}/${s.name}`:s.name;gr(r,e,`${a}/`)||hi(e,a,r,n)}}function Xa(e,t){let r=t.replaceAll("\\","/").replace(/\/+$/,"");return e.split(/\r?\n/).map(n=>Za(n,r)).join(`
|
|
24
|
-
`)}function Za(e,t){let r=e.trimStart();if(!r||r.startsWith("#"))return e;let n=e.slice(0,e.length-r.length),i=r.startsWith("!"),o=i?r.slice(1):r;if(!o||o.startsWith("#"))return e;let s=o.startsWith("/"),a=s?o.slice(1):o,l=(a.endsWith("/")?a.slice(0,-1):a).includes("/")||s?`${t}/${a}`:`${t}/**/${a}`;return`${n}${i?"!":""}${l}`}var ec=`
|
|
25
|
-
# Dependencies
|
|
26
|
-
node_modules/
|
|
27
|
-
vendor/
|
|
28
|
-
.bundle/
|
|
29
|
-
|
|
30
|
-
# Build output
|
|
31
|
-
dist/
|
|
32
|
-
build/
|
|
33
|
-
out/
|
|
34
|
-
target/
|
|
35
|
-
bin/
|
|
36
|
-
obj/
|
|
37
|
-
|
|
38
|
-
# Python
|
|
39
|
-
__pycache__/
|
|
40
|
-
*.pyc
|
|
41
|
-
*.pyo
|
|
42
|
-
.venv/
|
|
43
|
-
venv/
|
|
44
|
-
.env/
|
|
45
|
-
env/
|
|
46
|
-
*.egg-info/
|
|
47
|
-
|
|
48
|
-
# Rust
|
|
49
|
-
target/
|
|
50
|
-
|
|
51
|
-
# Java / Kotlin / Scala
|
|
52
|
-
*.class
|
|
53
|
-
.gradle/
|
|
54
|
-
.mvn/
|
|
55
|
-
|
|
56
|
-
# C# / .NET
|
|
57
|
-
bin/
|
|
58
|
-
obj/
|
|
59
|
-
packages/
|
|
60
|
-
|
|
61
|
-
# Go
|
|
62
|
-
vendor/
|
|
63
|
-
|
|
64
|
-
# Dart
|
|
65
|
-
.dart_tool/
|
|
66
|
-
build/
|
|
67
|
-
|
|
68
|
-
# PHP
|
|
69
|
-
vendor/
|
|
70
|
-
|
|
71
|
-
# IDE / OS
|
|
72
|
-
.idea/
|
|
73
|
-
.vscode/
|
|
74
|
-
*.swp
|
|
75
|
-
*.swo
|
|
76
|
-
.DS_Store
|
|
77
|
-
Thumbs.db
|
|
78
|
-
|
|
79
|
-
# Type definitions (often noise in queries)
|
|
80
|
-
*.d.ts
|
|
81
|
-
`;function gr(e,t,r){let n=tc(t,r);if(!n)return!1;try{return e.ignores(n)}catch{return!1}}function tc(e,t){if(!t||t===".")return null;if(!yi(t)&&!t.startsWith(".."))return t.replaceAll("\\","/");let r=yi(t)?t:Qa(e,t),n=Ka(e,r).replaceAll("\\","/");return!n||n==="."||n.startsWith("..")?null:n}import{appendFileSync as rc,mkdirSync as nc}from"fs";import{createHash as ic,randomUUID as oc}from"crypto";import{dirname as sc}from"path";import{performance as xe}from"perf_hooks";var xi="CODEBASEIQ_PROFILE",wi="CODEBASEIQ_PROFILE_OUT",Pi="CODEBASEIQ_PROFILE_COMMAND",Ei="CODEBASEIQ_PROFILE_CACHE_STATE",mr="CODEBASEIQ_PROFILE_RUN_ID",yr="CODEBASEIQ_PROFILE_WORKLOAD_IDENTITY",hr="CODEBASEIQ_PROFILE_WORKLOAD_IDENTITY_KIND",Ri=[xi,wi,Pi,Ei,mr,yr,hr],Ap=new Set(Ri),Si=new Set,bi=new Map,Ii=!1;function Be(){let e=process.env[xi];return e==="1"||e==="true"}function ac(){return process.env[wi]}function vi(){return process.env[Pi]}function cc(){return process.env[Ei]}function ki(){let e=process.env[mr];if(e)return e;if(!Be())return;let t=oc();return process.env[mr]=t,t}function Di(){return process.env[yr]}function dc(e){let t=Di();if(t)return t;if(!Be())return;let r=ki();if(!r)return;let n=e.projectFingerprint?"published-project":"run-only",i=Fi(["profile-workload-v1",e.toolVersion,e.command,e.projectFingerprint??r]);return process.env[yr]=i,process.env[hr]=n,i}function Fi(e){return ic("sha256").update(JSON.stringify(e)).digest("hex").slice(0,24)}function Mp(){return Object.fromEntries(Ri.flatMap(e=>{let t=process.env[e];return t===void 0?[]:[[e,t]]}))}function Cp(e,t,r){if(!Be())return t();let n=xe.now();try{let i=t();return xt({type:"span",name:e,durationMs:Math.round(xe.now()-n),ok:!0,...wt(r)??{}}),i}catch(i){throw xt({type:"span",name:e,durationMs:Math.round(xe.now()-n),ok:!1,error:i instanceof Error?i.message:String(i),...wt(r)??{}}),i}}async function Lp(e,t,r){if(!Be())return t();let n=xe.now();try{let i=await t();return xt({type:"span",name:e,durationMs:Math.round(xe.now()-n),ok:!0,...wt(r)??{}}),i}catch(i){throw xt({type:"span",name:e,durationMs:Math.round(xe.now()-n),ok:!1,error:i instanceof Error?i.message:String(i),...wt(r)??{}}),i}}function xt(e,t=ac()){let r=lc(e),n={timestamp:new Date().toISOString(),pid:process.pid,runId:ki(),command:vi(),cacheState:cc(),...r,...e},i=`${JSON.stringify(n)}
|
|
82
|
-
`;if(t)try{let o=sc(t);Si.has(o)||(nc(o,{recursive:!0}),Si.add(o)),rc(t,i);return}catch(o){Ii||(Ii=!0,process.stderr.write(`[profile] failed to write ${t}: ${o instanceof Error?o.message:String(o)}
|
|
83
|
-
`));return}Be()&&process.stderr.write(i)}function lc(e){let t=Di()??dc({command:vi()??"unknown",toolVersion:"unknown",projectFingerprint:null});if(!t)return{};let r=process.env[hr],n=typeof e.name=="string"?e.name:void 0;if(!n)return{workloadIdentity:t,workloadIdentityKind:r};let i=n.split(/[.:]/,1)[0]??n,o=`${t}\0${n}`,s=bi.get(o);return s||(s=Fi(["profile-subsystem-v1",t,n]),bi.set(o,s)),{workloadIdentity:t,workloadIdentityKind:r,subsystem:i,subsystemWorkIdentity:s}}function wt(e){return typeof e=="function"?e():e}import{createHash as Go,randomUUID as ul}from"crypto";import{existsSync as Y,lstatSync as Yr,mkdirSync as ve,mkdtempSync as _o,readdirSync as No,realpathSync as Bo,renameSync as ge,rmSync as Q,statSync as jt}from"fs";import{dirname as Xr,join as f,resolve as Ze}from"path";import{setTimeout as pl}from"timers/promises";import{pathToFileURL as Lo}from"url";import{deserializeSCIP as qo}from"@c4312/scip";import fl from"better-sqlite3";import{execFileSync as Bc}from"child_process";import{createHash as _i}from"crypto";import{closeSync as qc,fstatSync as Ni,lstatSync as xr,openSync as $c,readdirSync as zc,readFileSync as Wc,readlinkSync as Hc,realpathSync as Rt}from"fs";import{isAbsolute as Uc,join as wr,relative as Jc,resolve as Vc,sep as Kc}from"path";import{execFileSync as Sr}from"child_process";import{createHash as uc}from"crypto";import{mkdirSync as pc,renameSync as fc,writeFileSync as gc}from"fs";import{basename as mc,dirname as yc,join as hc}from"path";var Sc="git-content-hashes.json",bc=32*1024*1024,Ic=2e5,Pt=3e4,br={encoding:"utf8",maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:Pt,killSignal:"SIGKILL"};function Ai(e){let t,r;try{t=Sr("git",["-C",e,"ls-files","-s","-z","--","."],{...br,timeout:Pt}),r=Sr("git",["-C",e,"status","--porcelain=v1","-z","--untracked-files=all","--no-renames","--","."],{...br,timeout:Pt})}catch{return null}let n=new Map,i=[];for(let l of t.split("\0")){if(!l)continue;let u=l.indexOf(" "),p=u>0?l.slice(0,u).split(" "):[];if(p.length!==3)continue;let[m,g,F]=p,x=l.slice(u+1);if(m!=="100644"&&m!=="100755"||F!=="0"){n.delete(x);continue}n.set(x,g),mc(x)===".gitattributes"&&i.push(`${x}:${g}`)}let o=new Set;for(let l of r.split("\0"))l.length>=4&&l[2]===" "&&o.add(l.slice(3));let s=xc(e,i),a=hc($t(e),Sc),c=wc(a,s),d=new Map;return{lookup(l){if(o.has(l))return;let u=n.get(l);if(u)return d.get(u)??c.entries[u]},seed(l,u){if(o.has(l))return;let p=n.get(l);!p||c.entries[p]||d.has(p)||d.set(p,u)},persist(){if(d.size===0)return;let l=new Set(n.values()),u={};for(let[p,m]of Object.entries(c.entries))l.has(p)&&(u[p]=m);for(let[p,m]of d)u[p]=m;if(!(Object.keys(u).length>Ic))try{pc(yc(a),{recursive:!0});let p=`${a}.${process.pid}.tmp`;gc(p,JSON.stringify({version:1,salt:s,entries:u})),fc(p,a)}catch{}}}}function xc(e,t){let r="";try{r=Sr("git",["-C",e,"config","--get-regexp","^core\\.(autocrlf|eol|safecrlf)$"],{...br,timeout:Pt})}catch{}return uc("sha256").update(JSON.stringify([r.trim(),t.sort()])).digest("hex")}function wc(e,t){let r={version:1,salt:t,entries:{}};try{let n=R(e,{maxBytes:bc,inputKind:"git-content-hash-store"}),i=JSON.parse(n);if(i.version!==1||i.salt!==t||!i.entries||typeof i.entries!="object")return r;let o={};for(let[s,a]of Object.entries(i.entries))/^[0-9a-f]{40,64}$/.test(s)&&a&&typeof a.size=="number"&&Number.isInteger(a.size)&&a.size>=0&&typeof a.hash=="string"&&/^[0-9a-f]{64}$/.test(a.hash)&&(o[s]={size:a.size,hash:a.hash});return{version:1,salt:t,entries:o}}catch{return r}}import{AsyncLocalStorage as Pc}from"async_hooks";var Ec=new Pc;function we(e,t){let r=Et(e);if(!r||r.missing.has(t))return;let n=r.files.get(t);if(n)return n;let i=r.readBaseFile?.(t);return i&&r.files.set(t,i),i}function Pe(e,t){let r=Et(e);if(r)return r.missing.has(t)?"missing":r.paths.includes(t)?"present":"missing"}function Mi(e,t){return Et(e)?.fingerprints.get(t)}function ue(e){return Et(e)?.paths}function Et(e){let t=Ec.getStore();if(t)return t.projectRoot===hn(e)?t:void 0}import{createRequire as Rc}from"module";import{existsSync as vc,readdirSync as kc,statSync as Dc}from"fs";import y from"path";var Fc=Rc(import.meta.url),Ci=new Set([".cache",".git",".next",".nuxt",".turbo",".nx","build","coverage","dist","node_modules","tmp","vendor"]);function Ac(e,t=[]){let r=y.resolve(e),n=t.flatMap(c=>Cc(r,c));if(n.length>0)return Li(r,Oi(n));let i=Mc(r),o=Oi(i),s=Lc(r,o)?[r,...o]:o,a=s.length>0?s:[r];return Li(r,a)}function ji(e,t,r=[]){let n;try{n=Fc("ts-morph")}catch{return null}let i=y.resolve(e),o=t==="workspace"?Ac(i,r):["."],s=new Set;for(let a of o){let c=a==="."?i:y.join(i,a),d=y.join(c,"tsconfig.json"),l=Gc(n.ts,i);if(!l.fileExists(d))return null;let u=n.ts.readConfigFile(d,l.readFile);if(u.error)return null;let p=n.ts.parseJsonConfigFileContent(u.config,l,c);if(p.errors.length>0)return null;for(let m of p.fileNames){let g=y.resolve(m);O(i,g)&&s.add(y.relative(i,g).split(y.sep).join("/"))}}return s}function Li(e,t){return[...new Set(t.map(r=>qe(e,r)))].sort((r,n)=>r.localeCompare(n))}function Mc(e){let t=ue(e);if(t)return t.flatMap(i=>{if(i.split("/").some(s=>Ci.has(s)))return[];let o=y.join(e,...i.split("/"));return Ti(e,o)?[y.dirname(o)]:[]});let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=kc(i,{withFileTypes:!0})}catch{continue}for(let s of o){let a=y.join(i,s.name);if(s.isDirectory()){!Ci.has(s.name)&&!s.name.startsWith(".")&&n.push(a);continue}s.isFile()&&Ti(e,a)&&r.push(y.dirname(a))}}return r}function Cc(e,t){let r=t.trim();if(!r)return[];let n=y.resolve(e,r);if(!O(e,n))return[];let i=ue(e);if(i){let o=qe(e,n);if(i.includes(o)&&Ir(y.basename(n)))return[y.dirname(n)];let s=o==="."?"":`${o}/`;return i.some(a=>a.startsWith(s))?[n]:[]}try{let o=Dc(n);if(o.isDirectory())return[n];if(o.isFile()&&Ir(y.basename(n)))return[y.dirname(n)]}catch{return[]}return[]}function Ti(e,t){if(!Ir(y.basename(t)))return!1;let r=Gi(e,t);return r?y.basename(t)==="tsconfig.json"||"include"in r||"files"in r||"references"in r:!1}function Ir(e){return e.startsWith("tsconfig")&&e.endsWith(".json")}function Oi(e){let t=[...new Set(e.map(r=>y.resolve(r)))].sort((r,n)=>r.localeCompare(n));return t.length<=1?t:t.filter(r=>!t.some(n=>n!==r&&Nc(r,n)))}function Lc(e,t){if(t.length===0||t.some(n=>y.resolve(n)===e))return!1;let r=y.join(e,"tsconfig.json");return Oc(e,r)&&Tc(e,r)}function Tc(e,t){let n=Gi(e,t)?.include;return Array.isArray(n)?n.some(i=>typeof i=="string"&&i.trim()!==""&&!i.startsWith("!")&&(i.includes("/")||i.includes("**")||!y.extname(i))):!1}function Gi(e,t){try{let r=JSON.parse(jc(e,t));return r&&typeof r=="object"&&!Array.isArray(r)?r:null}catch{return null}}function Oc(e,t){let r=qe(e,t),n=Pe(e,r);return n?n==="present":vc(t)}function jc(e,t){let r=qe(e,t);if(ue(e)){let i=we(e,r);if(!i)throw Object.assign(new Error(`Snapshot file ${r} is missing.`),{code:"ENOENT"});return i.content.toString("utf8")}return S(t,"TypeScript project config")}function Gc(e,t){let r=ue(t);if(!r)return e.sys;let n=y.resolve(t),i=new Set(r),o=_c(n,r),s=e,a=c=>{let d=y.resolve(c);return O(n,d)?qe(n,d):null};return{useCaseSensitiveFileNames:e.sys.useCaseSensitiveFileNames,fileExists(c){let d=a(c);return d===null?e.sys.fileExists(c):i.has(d)},readFile(c){let d=a(c);return d===null?e.sys.readFile(c):we(n,d)?.content.toString("utf8")},readDirectory(c,d,l,u,p){let m=y.resolve(c);return O(n,m)?s.matchFiles(m,d,l,u,e.sys.useCaseSensitiveFileNames,n,p,g=>o.get(y.resolve(g))??{files:[],directories:[]},g=>g):e.sys.readDirectory(c,d,l,u,p)}}}function _c(e,t){let r=new Map,n=new Map,i=o=>{r.has(o)||r.set(o,new Set),n.has(o)||n.set(o,new Set)};i(e);for(let o of t){let s=o.split("/"),a=e;for(let c=0;c<s.length-1;c+=1){let d=s[c];i(a),n.get(a).add(d),a=y.join(a,d),i(a)}r.get(a).add(s.at(-1))}return new Map([...r].map(([o,s])=>[o,{files:[...s].sort(),directories:[...n.get(o)??[]].sort()}]))}function qe(e,t){let r=y.relative(e,t);return r?r.split(y.sep).join("/"):"."}function Nc(e,t){let r=y.relative(e,t);return!!r&&!r.startsWith("..")&&!y.isAbsolute(r)}var vt=64*1024*1024,$e=class extends Error{constructor(r,n,i,o){super(`${r} ${JSON.stringify(n)} is ${i} bytes; the safety limit is ${o} bytes`);this.inputKind=r;this.inputPath=n;this.observedBytes=i;this.limitBytes=o;this.name="InputTooLargeError"}inputKind;inputPath;observedBytes;limitBytes;code="CODEBASEIQ_INPUT_TOO_LARGE"};function Qc(e){return[...new Set((e??[]).map(t=>t.trim()).filter(Boolean))].sort((t,r)=>t.localeCompare(r))}function Bi(e,t,r={}){let n=j(t),i=Rt(e),o=Vc(i,...n.split("/"));if(!O(i,o)||o===i)throw new v(t,"outside-project");let s=Rt(o);if(!O(i,s)||s===i)throw new v(t,"outside-project");let a=xr(s);if(!a.isFile())throw new v(t,"not-a-file");let c={projectRoot:i,relativePath:n,absolutePath:s,size:a.size,mtimeMs:a.mtimeMs,device:a.dev,inode:a.ino},d=r.maxBytes??vt;if(qi(d),c.size>d)throw new $e(r.inputKind??"project file",c.relativePath,c.size,d);return c}function Yc(e,t,r={}){let n=j(t),i=Pe(e,n);if(i){if(i==="missing")throw Object.assign(new Error(`Snapshot project file ${JSON.stringify(n)} does not exist.`),{code:"ENOENT"});let c=we(e,n);if(!c)throw new v(n,"changed-during-read");let d=r.maxBytes??vt;if(qi(d),c.size>d)throw new $e(r.inputKind??"project file",n,c.size,d);return Buffer.from(c.content)}let o=Bi(e,t,r),s=r.maxBytes??vt,a=$c(o.absolutePath,"r");try{let c=Ni(a);if(!c.isFile()||c.dev!==o.device||c.ino!==o.inode||c.size!==o.size)throw new v(t,"changed-during-read");if(c.size>s)throw new $e(r.inputKind??"project file",o.relativePath,c.size,s);let d=Wc(a),l=Ni(a);if(l.dev!==c.dev||l.ino!==c.ino||l.size!==c.size||d.byteLength!==c.size)throw new v(t,"changed-during-read");return d}finally{qc(a)}}function df(e,t,r={}){return Yc(e,t,r).toString("utf8")}function Pr(e){return typeof e=="object"&&e!==null&&"code"in e&&(e.code==="ENOENT"||e.code==="ENOTDIR")}function lf(e,t){try{return Bi(e,t),!0}catch(r){if(Pr(r))return!1;throw r}}function qi(e){if(!Number.isSafeInteger(e)||e<0)throw new RangeError(`maxBytes must be a non-negative safe integer; received ${e}`)}function Xc(e){return(ue(e)??nd(e)??id(e)).filter(t=>t&&!Rr(t)).sort()}function Zc(e,t={}){let r=(t.includePaths??[]).map(j),n=[...new Set([...Xc(e),...r])].filter(c=>!Rr(c)).filter(c=>!t.language||Nn(c,t.language,t.markerFiles)).filter(c=>!t.includePath||t.includePath(c)).sort(),i=Rt(e),o,s=()=>o??=Ai(i),a=n.flatMap(c=>{let d=Mi(e,c);if(d)return[{path:c,size:d.fingerprintSize??d.size,hash:d.sha256}];let l=Pe(e,c);if(l==="present"){let g=we(e,c);if(g)return[{path:c,size:g.fingerprintSize??g.size,hash:g.sha256}]}let u=l===void 0?s():null,p=u?.lookup(c);if(p)return[{path:c,size:p.size,hash:p.hash}];let m=wr(e,c);try{if(xr(m).isSymbolicLink()){let ee=Rt(m),_t=Jc(i,ee);if(_t===".."||_t.startsWith(`..${Kc}`)||Uc(_t))throw new Error("external symlink");let mn=Hc(m);return[{path:c,size:Buffer.byteLength(mn),hash:_i("sha256").update("symlink\0").update(mn).digest("hex")}]}let g=_i("sha256"),F=it(m,{inputKind:"project fingerprint input",maxBytes:vt},ee=>g.update(ee)),x=g.digest("hex");return u?.seed(c,{size:F,hash:x}),[{path:c,size:F,hash:x}]}catch(g){return Pr(g)?[]:[{path:c,size:-1,hash:"unreadable"}]}});return o?.persist(),a}function Er(e,t,r){let n=kt(t,r),i=[...n.typescriptProjects.filter(s=>td(e,s)),...n.clojureConfigPath?[n.clojureConfigPath]:[]],o=n.languages.includes("typescript")?ji(e,n.typescriptProjectMode,n.typescriptProjects):null;return{...n,files:Zc(e,{includePath:s=>{let a=Ut(s,t,i);return a==="other"?!1:a!=="source"||!ed(s)||!o?!0:o.has(s)},includePaths:i})}}function ed(e){return/\.(?:[cm]?[jt]sx?|vue)$/iu.test(e)}function td(e,t){let r;try{r=j(t)}catch{return!1}let n=Pe(e,r);if(n)return n==="present";try{return xr(wr(e,r)).isFile()}catch(i){if(Pr(i))return!1;throw i}}function kt(e,t){return{version:3,languages:[...e].sort(),pnpmWorkspaces:t.typescriptProjectMode!=="workspace"&&t.pnpmWorkspaces===!0,typescriptProjectMode:t.typescriptProjectMode??"single",typescriptProjects:Qc(t.typescriptProjects),clojureConfigPath:rd(t.clojureConfigPath)}}function rd(e){return e?.trim()||void 0}function nd(e){try{return Bc("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:50*1024*1024,stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL"}).split(`
|
|
84
|
-
`).filter(Boolean)}catch{return null}}function id(e){let t=[],r=[""];for(;r.length>0;){let n=r.pop(),i=n?wr(e,n):e,o;try{o=zc(i,{withFileTypes:!0})}catch{continue}for(let s of o){let a=n?`${n}/${s.name}`:s.name;if(s.isDirectory()){Rr(a)||r.push(a);continue}t.push(a)}}return t}function Rr(e){let t=e.split("/");return e==="meta.json"||t[0]===".codebaseiq"&&(t[1]==="events"||t[1]==="ledger"||t[1]==="releases"||t[1]==="suppressions")||t.some(r=>od.has(r))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var od=new Set([".git","node_modules",".codebaseiq-cache",".codebaseiq-generations",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]);import{execFileSync as sd}from"child_process";import{existsSync as ad,readdirSync as zi}from"fs";import{extname as Wi,join as Hi}from"path";var Ui=new Set([".git",".hg",".svn",".idea",".vscode","node_modules","vendor","dist","build","target","bin","obj",".dart_tool",".gradle",".next",".venv","venv","__pycache__"]),cd=[{language:"typescript",files:["tsconfig.json","tsconfig.base.json"],extensions:[".ts",".tsx",".mts",".cts"]},{language:"rust",files:["Cargo.toml"],extensions:[".rs"]},{language:"go",files:["go.mod"],extensions:[".go"]},{language:"java",files:["pom.xml","build.gradle","build.gradle.kts"],extensions:[".java"]},{language:"kotlin",files:["build.gradle.kts"],extensions:[".kt",".kts"]},{language:"scala",files:["build.sbt"],extensions:[".scala"]},{language:"clojure",files:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"],extensions:[".clj",".cljs",".cljc"]},{language:"python",files:["pyproject.toml","setup.py","setup.cfg","Pipfile"],extensions:[".py",".pyi"]},{language:"ruby",files:["Gemfile"],extensions:[".rb"]},{language:"cpp",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"]},{language:"c",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".c",".h"]},{language:"csharp",globs:["*.csproj","*.sln"],extensions:[".cs"]},{language:"vb",globs:["*.vbproj"],extensions:[".vb"]},{language:"dart",files:["pubspec.yaml"],extensions:[".dart"]},{language:"php",files:["composer.json"],extensions:[".php"]},{language:"javascript",files:["package.json"],extensions:[".js",".jsx",".mjs",".cjs"]}];function vr(e){let t=[],r=dd(e),n=fd(e);for(let i of cd){if(ld(e,i.files)){t.push(i.language);continue}if(ud(r,i.globs)){t.push(i.language);continue}md(n,i.extensions)&&t.push(i.language)}return t.includes("typescript")&&$i(t,"javascript"),t.includes("cpp")&&!n.has(".c")&&$i(t,"c"),t}function dd(e){try{return zi(e)}catch{return[]}}function ld(e,t){return t?.length?t.some(r=>ad(Hi(e,r))):!1}function ud(e,t){return t?.length?e.some(r=>t.some(n=>pd(r,n))):!1}function pd(e,t){if(t==="*")return!0;if(!t.includes("*"))return e===t;let[r,n]=t.split("*");return e.startsWith(r??"")&&e.endsWith(n??"")}function fd(e){let t=gd(e);if(t)return t;let r=new Set,n=[e];for(;n.length>0;){let i=n.pop();if(!i)continue;let o;try{o=zi(i,{withFileTypes:!0})}catch{continue}for(let s of o){if(s.name.startsWith(".")&&!s.name.endsWith("proj")&&!s.name.endsWith("sln")&&s.isDirectory())continue;let a=Hi(i,s.name);if(s.isDirectory()){Ui.has(s.name)||n.push(a);continue}let c=Wi(s.name).toLowerCase();c&&r.add(c)}}return r}function gd(e){try{let t=sd("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL"}),r=new Set;for(let n of t.split(`
|
|
85
|
-
`)){if(!n||n.split("/").some(o=>Ui.has(o)))continue;let i=Wi(n).toLowerCase();i&&r.add(i)}return r}catch{return null}}function md(e,t){return t?.length?t.some(r=>e.has(r)):!1}function $i(e,t){let r=e.indexOf(t);r!==-1&&e.splice(r,1)}import{lstatSync as Fd,readdirSync as Ad}from"fs";import{join as Md,relative as Cd,resolve as Or,sep as Ld}from"path";import{createHash as yd}from"crypto";import{existsSync as ze,mkdirSync as hd,readdirSync as Ji,renameSync as Sd,rmSync as Vi,writeFileSync as bd}from"fs";import{join as U}from"path";import{create as Qi,fromBinary as Yi,toBinary as Id}from"@bufbuild/protobuf";import{deserializeSCIP as Dt,DocumentSchema as Dr,IndexSchema as Xi,serializeSCIP as Zi}from"@c4312/scip";var Ft=1,We="typescript-scip-fragments";function Pf(e){if(e.length===0)throw new Error("affected TypeScript mini index requires documents");let t=new Set,r=[];for(let o of e){let s=pe(o.relativePath);if(t.has(s))throw new Error(`duplicate TypeScript fragment replacement: ${s}`);if(t.add(s),o.bytes===null)throw new Error(`affected TypeScript mini index cannot contain a deleted document: ${s}`);let a=Yi(Dr,o.bytes);if(a.relativePath!==s)throw new Error(`TypeScript fragment path mismatch: expected ${s}, got ${a.relativePath}`);r.push(a)}let n=Zi(Qi(Xi,{documents:r,externalSymbols:[]})),i=Dt(n);if(i.documents.length!==r.length||i.externalSymbols.length!==0)throw new Error("affected TypeScript SCIP index failed structural verification");return n}function He(e){let t=U(e,We);return{rootDir:t,blobDir:U(t,"blobs"),generationDir:U(t,"generations")}}function xd(e){let t=Dt(e.indexBytes);co(t.metadata,lo(e)),ao(t.externalSymbols);let r=new Set,n=[];for(let o of t.documents){let s=pe(o.relativePath);if(r.has(s))throw new Error(`duplicate TypeScript SCIP document path: ${s}`);r.add(s);let a=Id(Dr,o),c=e.documentIdentities.get(s)??(e.allowUntrackedDocuments?fe(JSON.stringify({version:1,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,untrackedDocument:s,contentHash:fe(a)})):null);if(!c)throw new Error(`missing TypeScript document identity: ${s}`);n.push(no(e.cacheDir,{relativePath:s,bytes:a,occurrences:o.occurrences.length,symbols:o.symbols.length,referenceFragments:[]},c))}let i=io(e,n);return oo(e.cacheDir,i),i}function Ef(e){let t=He(e.cacheDir);if(!ze(Ar(t,e.generationIdentity)))return xd(e);let r=eo({cacheDir:e.cacheDir,generationIdentity:e.generationIdentity,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity});if(!e.allowUntrackedDocuments&&r.manifest.documents.length!==e.documentIdentities.size)throw new Error("TypeScript fragment generation document identities changed");for(let n of r.manifest.documents){let i=e.documentIdentities.get(n.relativePath);if(!(i===void 0&&e.allowUntrackedDocuments)&&i!==n.documentIdentity)throw new Error(`TypeScript fragment generation document identity changed: ${n.relativePath}`)}return r.manifest}function Rf(e){let t=eo({cacheDir:e.cacheDir,generationIdentity:e.previousGenerationIdentity,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity}).manifest,r=new Map(t.documents.map(o=>[o.relativePath,o])),n=new Set;for(let o of e.fragments){let s=pe(o.relativePath);if(n.has(s))throw new Error(`duplicate TypeScript fragment replacement: ${s}`);if(n.add(s),!r.has(s))throw new Error(`TypeScript fragment replacement has no prior document: ${s}`);let a=e.documentIdentities.get(s);if(!a)throw new Error(`missing TypeScript document identity: ${s}`);o.bytes===null?r.delete(s):r.set(s,no(e.cacheDir,o,a))}if(n.size===0)throw new Error("TypeScript fragment generation requires at least one replacement");let i=io(e,[...r.values()]);return oo(e.cacheDir,i),i}function eo(e){let t=He(e.cacheDir),r=Ar(t,e.generationIdentity),n;try{n=Fr(R(r,{maxBytes:A,inputKind:"TypeScript fragment manifest"}))}catch(o){throw new Error(`TypeScript fragment generation is unavailable: ${o instanceof Error?o.message:String(o)}`,{cause:o})}if(n.generationIdentity!==e.generationIdentity)throw new Error("TypeScript fragment generation identity does not match its manifest path");if(e.producerIdentity&&n.producerIdentity!==e.producerIdentity)throw new Error("TypeScript fragment producer identity changed");if(e.projectIdentity&&n.projectIdentity!==e.projectIdentity)throw new Error("TypeScript fragment project identity changed");let i=new Map;for(let o of n.documents){let s=U(t.blobDir,`${o.blobHash}.scipdoc`),a=D(s,{maxBytes:me,inputKind:"TypeScript fragment blob"});if(a.byteLength!==o.byteLength||fe(a)!==o.blobHash)throw new Error(`TypeScript fragment blob is corrupt: ${o.relativePath}`);i.set(o.relativePath,a)}return{manifest:n,fragments:i}}function to(e){let t=ro(e);return kr(t.baseIndex,t.completeDocuments,"assembled")}function vf(e){let t=ro(e);return wd(t.deletedAffectedPaths),{completeIndexBytes:kr(t.baseIndex,t.completeDocuments,"assembled"),affectedIndexBytes:kr(t.baseIndex,t.affectedDocuments,"affected")}}function ro(e){let t=Dt(e.baseIndexBytes);co(t.metadata,lo(e)),ao(t.externalSymbols);let r=new Map;for(let a of e.fragments){let c=pe(a.relativePath);if(r.has(c))throw new Error(`duplicate TypeScript fragment replacement: ${c}`);r.set(c,a)}if(r.size===0)throw new Error("TypeScript index assembly requires at least one replacement");let n=new Set,i=[],o=[],s=[];for(let a of t.documents){let c=pe(a.relativePath);if(n.has(c))throw new Error(`duplicate TypeScript SCIP document path: ${c}`);n.add(c);let d=r.get(c);if(!d){i.push(a);continue}if(r.delete(c),d.bytes===null){s.push(c);continue}let l=Yi(Dr,d.bytes);if(l.relativePath!==c)throw new Error(`TypeScript fragment path mismatch: expected ${c}, got ${l.relativePath}`);i.push(l),o.push(l)}if(r.size>0)throw new Error(`TypeScript fragment replacement has no prior document: ${[...r.keys()].sort()[0]}`);return{baseIndex:t,completeDocuments:i,affectedDocuments:o,deletedAffectedPaths:s}}function kr(e,t,r){let n=Zi(Qi(Xi,{metadata:e.metadata,documents:t,externalSymbols:[]})),i=Dt(n);if(i.documents.length!==t.length||i.externalSymbols.length!==0)throw new Error(`${r} TypeScript SCIP index failed structural verification`);return n}function wd(e){if(e.length>0)throw new Error(`affected TypeScript mini index cannot contain a deleted document: ${e[0]}`)}function kf(e,t){let r=He(e);if(!ze(r.generationDir))return;let n=new Set(t.map(s=>so(s))),i=Ji(r.generationDir).filter(s=>s.endsWith(".json")),o=new Set;for(let s of i.filter(a=>n.has(a))){let a=Fr(R(U(r.generationDir,s),{maxBytes:A,inputKind:"TypeScript fragment manifest"}));for(let c of a.documents)o.add(`${c.blobHash}.scipdoc`)}for(let s of i)n.has(s)||Vi(U(r.generationDir,s),{force:!0});if(ze(r.blobDir))for(let s of Ji(r.blobDir))o.has(s)||Vi(U(r.blobDir,s),{force:!0})}function no(e,t,r){if(t.bytes===null)throw new Error(`cannot persist an empty TypeScript fragment: ${t.relativePath}`);let n=pe(t.relativePath),i=Buffer.from(t.bytes),o=fe(i),s=He(e);hd(s.blobDir,{recursive:!0});let a=U(s.blobDir,`${o}.scipdoc`);if(ze(a)){let c=D(a,{maxBytes:me,inputKind:"TypeScript fragment blob"});if(c.byteLength!==i.byteLength||fe(c)!==o)throw new Error(`existing TypeScript fragment blob is corrupt: ${n}`)}else{let c=`${a}.${process.pid}.${Date.now()}.tmp`;bd(c,i),Sd(c,a)}return{relativePath:n,blobHash:o,byteLength:i.byteLength,documentIdentity:r}}function io(e,t){if(!e.producerIdentity||!e.projectIdentity||!e.generationIdentity)throw new Error("TypeScript fragment generation identities must be non-empty");let r=[...t].sort((n,i)=>n.relativePath.localeCompare(i.relativePath));if(new Set(r.map(n=>n.relativePath)).size!==r.length)throw new Error("TypeScript fragment generation contains duplicate document paths");return{version:Ft,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,generationIdentity:e.generationIdentity,createdAt:(e.now??(()=>new Date))().toISOString(),documents:r}}function oo(e,t){let r=He(e),n=Ar(r,t.generationIdentity);if(ze(n)){let i=Fr(R(n,{maxBytes:A,inputKind:"TypeScript fragment manifest"}));if(Ki(i)!==Ki(t))throw new Error(`TypeScript fragment generation is immutable: ${t.generationIdentity}`);return}V(n,t,{spacing:2,trailingNewline:!0})}function Ki(e){return fe(JSON.stringify({version:e.version,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,generationIdentity:e.generationIdentity,documents:e.documents}))}function Fr(e){let t=JSON.parse(e);if(t.version!==Ft||typeof t.producerIdentity!="string"||typeof t.projectIdentity!="string"||typeof t.generationIdentity!="string"||typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))||!Array.isArray(t.documents))throw new Error("invalid TypeScript fragment generation manifest");let r=new Set;for(let n of t.documents){if(!n||typeof n.relativePath!="string"||typeof n.blobHash!="string"||!/^[a-f0-9]{64}$/.test(n.blobHash)||typeof n.byteLength!="number"||!Number.isInteger(n.byteLength)||n.byteLength<0||typeof n.documentIdentity!="string"||!n.documentIdentity)throw new Error("invalid TypeScript fragment record");if(pe(n.relativePath),r.has(n.relativePath))throw new Error("duplicate TypeScript fragment record");r.add(n.relativePath)}return t}function Ar(e,t){return U(e.generationDir,so(t))}function so(e){if(!e)throw new Error("TypeScript fragment generation identity must be non-empty");return`${fe(e)}.json`}function ao(e){if(e.length>0)throw new Error("scip-typescript emitted external symbols; incremental document assembly is unsupported")}function co(e,t){if(!e||typeof e!="object")throw new Error("TypeScript SCIP shard has no producer metadata");let r=e,n=r.toolInfo??r.tool_info;if(!n||typeof n!="object")throw new Error("TypeScript SCIP shard has no producer tool identity");let i=n;if(i.name!=="scip-typescript"||i.version!==t)throw new Error("TypeScript SCIP shard producer identity changed")}function lo(e){let t=e.packageVersion??e.runtime?.packageVersion;if(!t)throw new Error("scip-typescript package version is unavailable");return t}function pe(e){if(!e||e.startsWith("/")||e.startsWith("\\")||e.includes("\\"))throw new Error(`invalid TypeScript SCIP document path: ${e}`);let t=e.split("/");if(t.includes("")||t.includes(".")||t.includes(".."))throw new Error(`invalid TypeScript SCIP document path: ${e}`);return e}function fe(e){return yd("sha256").update(e).digest("hex")}import{createHash as Pd}from"crypto";import{existsSync as Ue,mkdirSync as Ed,readdirSync as Mr,renameSync as Rd,rmSync as uo,writeFileSync as vd}from"fs";import{join as _}from"path";var At=1,Of=64*1024*1024,Ve="typescript-scip-overlays";function jf(e){let t=fo(e.cacheDir,e.previousGenerationIdentity);if(!t&&!e.baseShardCurrent)throw new Error("deferred TypeScript SCIP base has no matching overlay generation");if(t&&(t.producerIdentity!==e.producerIdentity||t.projectIdentity!==e.projectIdentity))throw new Error("TypeScript overlay producer or project identity changed");let r=new Map((t?.overlays??[]).map(o=>[o.relativePath,o])),n=new Set;for(let o of e.fragments){let s=Tr(o.relativePath);if(n.has(s))throw new Error(`duplicate TypeScript overlay: ${s}`);n.add(s),r.set(s,kd(e.cacheDir,o))}if(n.size===0)throw new Error("TypeScript overlay generation requires affected documents");let i={version:At,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,baseGenerationIdentity:t?.baseGenerationIdentity??e.previousGenerationIdentity,generationIdentity:e.nextGenerationIdentity,createdAt:(e.now??(()=>new Date))().toISOString(),overlays:[...r.values()].sort((o,s)=>o.relativePath.localeCompare(s.relativePath))};return Dd(e.cacheDir,i),i}function Gf(e){let t=fo(e.cacheDir,e.generationIdentity);if(!t)throw new Error("TypeScript overlay generation is unavailable");let r=t.overlays.map(n=>{if(n.blobHash===null)return{relativePath:n.relativePath,bytes:null,occurrences:0,symbols:0,referenceFragments:[]};let i=D(_(Ke(e.cacheDir),"blobs",`${n.blobHash}.scipdoc`),{maxBytes:me,inputKind:"TypeScript overlay blob"});if(i.byteLength!==n.byteLength||Je(i)!==n.blobHash)throw new Error(`TypeScript overlay blob is corrupt: ${n.relativePath}`);return{relativePath:n.relativePath,bytes:i,occurrences:0,symbols:0,referenceFragments:[]}});return to({packageVersion:e.packageVersion,baseIndexBytes:e.baseIndexBytes,fragments:r})}function _f(e,t){let r=Ke(e),n=_(r,"generations");if(!Ue(n))return;let i=new Set(t.map(Lr)),o=new Set;for(let a of Mr(n).filter(c=>i.has(c))){let c=Cr(R(_(n,a),{maxBytes:A,inputKind:"TypeScript overlay manifest"}));for(let d of c.overlays)d.blobHash&&o.add(`${d.blobHash}.scipdoc`)}for(let a of Mr(n))i.has(a)||uo(_(n,a),{force:!0});let s=_(r,"blobs");if(Ue(s))for(let a of Mr(s))o.has(a)||uo(_(s,a),{force:!0})}function fo(e,t){let r=_(Ke(e),"generations",Lr(t));if(!Ue(r))return null;let n=Cr(R(r,{maxBytes:A,inputKind:"TypeScript overlay manifest"}));if(n.generationIdentity!==t)throw new Error("TypeScript overlay generation identity does not match its path");return n}function kd(e,t){let r=Tr(t.relativePath);if(t.bytes===null)return{relativePath:r,blobHash:null,byteLength:0};let n=Buffer.from(t.bytes),i=Je(n),o=_(Ke(e),"blobs");Ed(o,{recursive:!0});let s=_(o,`${i}.scipdoc`);if(Ue(s)){let a=D(s,{maxBytes:me,inputKind:"TypeScript overlay blob"});if(a.byteLength!==n.byteLength||Je(a)!==i)throw new Error(`existing TypeScript overlay blob is corrupt: ${r}`)}else{let a=`${s}.${process.pid}.${Date.now()}.tmp`;vd(a,n),Rd(a,s)}return{relativePath:r,blobHash:i,byteLength:n.byteLength}}function Dd(e,t){let r=_(Ke(e),"generations",Lr(t.generationIdentity));if(Ue(r)){let n=Cr(R(r,{maxBytes:A,inputKind:"TypeScript overlay manifest"}));if(po(n)!==po(t))throw new Error(`TypeScript overlay generation is immutable: ${t.generationIdentity}`);return}V(r,t,{spacing:2,trailingNewline:!0})}function Cr(e){let t=JSON.parse(e);if(t.version!==At||typeof t.producerIdentity!="string"||!t.producerIdentity||typeof t.projectIdentity!="string"||!t.projectIdentity||typeof t.baseGenerationIdentity!="string"||!t.baseGenerationIdentity||typeof t.generationIdentity!="string"||!t.generationIdentity||typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))||!Array.isArray(t.overlays))throw new Error("invalid TypeScript overlay manifest");let r=new Set;for(let n of t.overlays){if(!n||typeof n.relativePath!="string"||n.blobHash!==null&&(typeof n.blobHash!="string"||!/^[a-f0-9]{64}$/.test(n.blobHash))||!Number.isInteger(n.byteLength)||n.byteLength<0||n.blobHash===null&&n.byteLength!==0)throw new Error("invalid TypeScript overlay record");if(Tr(n.relativePath),r.has(n.relativePath))throw new Error("duplicate TypeScript overlay record");r.add(n.relativePath)}return t}function Ke(e){return _(e,Ve)}function Lr(e){if(!e)throw new Error("TypeScript overlay generation identity must be non-empty");return`${Je(e)}.json`}function po(e){return Je(JSON.stringify({version:e.version,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,baseGenerationIdentity:e.baseGenerationIdentity,generationIdentity:e.generationIdentity,overlays:e.overlays}))}function Tr(e){if(!e||e.startsWith("/")||e.includes("\\")||e.split("/").some(t=>!t||t==="."))throw new Error(`invalid TypeScript overlay path: ${e}`);if(e.split("/").includes(".."))throw new Error(`invalid TypeScript overlay path: ${e}`);return e}function Je(e){return Pd("sha256").update(e).digest("hex")}var Qe=1,jr="language-indexes",go=["index.db","index.scip","meta.json"],mo=[jr,We,Ve];function Mt(e){let t=[];for(let r of go)Td(e,r),t.push(r);for(let r of mo)yo(e,r,t);return{version:Qe,files:t.sort()}}function Ct(e){if(!e||e.includes("\0")||e.startsWith("/")||e.includes("\\"))throw new Error(`invalid index artifact path: ${e||"<empty>"}`);let t=e.split("/");if(t.some(n=>!n||n==="."||n===".."))throw new Error(`invalid index artifact path: ${e}`);let r=t[0];if(!go.includes(e)&&!mo.includes(r))throw new Error(`index artifact path is not shareable: ${e}`);return e}function z(e,t){let r=Ct(t),n=Or(e),i=Or(n,...r.split("/"));if(i!==n&&!i.startsWith(`${n}${Ld}`))throw new Error(`index artifact escapes cache: ${t}`);return i}function yo(e,t,r){let n=Md(e,t),i;try{i=Ad(n,{withFileTypes:!0,encoding:"utf8"})}catch{return}for(let o of i){let s=`${t}/${o.name}`;if(o.isSymbolicLink())throw new Error(`index artifact cannot be a symlink: ${s}`);o.isDirectory()?yo(e,s,r):o.isFile()&&r.push(Ct(s))}}function Td(e,t){let r=z(e,t),n;try{n=Fd(r)}catch{throw new Error(`required index artifact is missing: ${t}`)}if(!n.isFile()||n.isSymbolicLink())throw new Error(`required index artifact is not a regular file: ${t}`);if(Cd(Or(e),r).startsWith(".."))throw new Error(`index artifact escapes cache: ${t}`)}import{writeFileSync as _r}from"fs";import{create as Ee}from"@bufbuild/protobuf";import{deserializeSCIP as Nr,serializeSCIP as Br,DocumentSchema as qd,IndexSchema as So,MetadataSchema as bo,SymbolInformationSchema as $d}from"@c4312/scip";import{writeFileSync as Od}from"fs";import{create as ho}from"@bufbuild/protobuf";import{deserializeSCIP as jd,DocumentSchema as Gd,IndexSchema as _d,serializeSCIP as Nd,SymbolRole as Bd}from"@c4312/scip";function Qf(e){let t;try{t=jd(D(e,{inputKind:"SCIP sanitization input",maxBytes:L}))}catch{return{removedDefinitionOccurrences:0,touchedDocuments:0}}let r=Gr(t);return r.touchedDocuments>0&&Od(e,Buffer.from(Nd(r.index))),{removedDefinitionOccurrences:r.removedDefinitionOccurrences,touchedDocuments:r.touchedDocuments}}function Gr(e){let t=new Set,r=new Map;for(let s of e.documents){r.set(s,j(s.relativePath));for(let a of s.symbols)a.symbol&&t.add(a.symbol)}for(let s of e.externalSymbols)s.symbol&&t.add(s.symbol);let n=0,i=0,o=[];for(let s of e.documents){let a=r.get(s),c=s.occurrences.filter(d=>(d.symbolRoles&Bd.Definition)===0||t.has(d.symbol)?!0:(n+=1,!1));if(a===s.relativePath&&c.length===s.occurrences.length){o.push(s);continue}i+=1,o.push(ho(Gd,{language:s.language,relativePath:a,occurrences:c,symbols:s.symbols,text:s.text,positionEncoding:s.positionEncoding}))}return{index:i===0?e:ho(_d,{metadata:e.metadata,documents:o,externalSymbols:e.externalSymbols}),removedDefinitionOccurrences:n,touchedDocuments:i}}function Io(e){if(e.length===0)throw new Error("Cannot merge zero SCIP indexes");if(e.length===1)return e[0];let t=Wd(e),r=Hd(e.flatMap(i=>i.documents??[])),n=wo(e.flatMap(i=>i.externalSymbols??[]));return Ee(So,{metadata:t,documents:r,externalSymbols:n})}function ig(e,t){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let r=e.map(i=>Nr(D(i,{inputKind:"SCIP merge input",maxBytes:L}))),n=Io(r);return _r(t,Buffer.from(Br(n))),{documentCount:n.documents.length,externalSymbolCount:n.externalSymbols.length,inputCount:e.length}}function og(e,t){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let r=e.map(i=>Nr(D(i,{inputKind:"SCIP merge input",maxBytes:L}))),n=Gr(Io(r));return _r(t,Buffer.from(Br(n.index))),{documentCount:n.index.documents.length,externalSymbolCount:n.index.externalSymbols.length,inputCount:e.length,removedDefinitionOccurrences:n.removedDefinitionOccurrences,touchedDocuments:n.touchedDocuments}}function zd(e,t,r){let n=e.metadata;if(!n)throw new Error("Cannot rebase a SCIP index without metadata");if(!be(n.projectRoot,t))throw new Error(`Cannot rebase SCIP project root: expected ${t}, got ${n.projectRoot}`);return Ee(So,{metadata:Ee(bo,{...n,projectRoot:r}),documents:e.documents,externalSymbols:e.externalSymbols})}function xo(e,t,r){let n=Nr(D(e,{inputKind:"SCIP normalization input",maxBytes:L})),i=zd(n,t,r);_r(e,Buffer.from(Br(i)))}function Wd(e){let t=e[0]?.metadata;if(!t)return;let r=t.projectRoot;for(let i of e.slice(1)){let o=i.metadata?.projectRoot;if(r&&o&&!be(o,r))throw new Error(`Cannot merge SCIP indexes with different project roots: ${r} vs ${o}`)}let n=r&&st(r);return n===r?t:Ee(bo,{...t,projectRoot:n})}function Hd(e){let t=new Map;for(let r of e){let n=t.get(r.relativePath);if(!n){t.set(r.relativePath,r);continue}t.set(r.relativePath,Ee(qd,{language:n.language||r.language,relativePath:n.relativePath||r.relativePath,occurrences:Ud([...n.occurrences,...r.occurrences]),symbols:wo([...n.symbols,...r.symbols]),text:Vd(n.text,r.text),positionEncoding:n.positionEncoding||r.positionEncoding}))}return[...t.values()]}function Ud(e){let t=new Set,r=[];for(let n of e){let i=JSON.stringify(n);t.has(i)||(t.add(i),r.push(n))}return r}function wo(e){let t=new Map;for(let r of e){let n=t.get(r.symbol);if(!n){t.set(r.symbol,r);continue}t.set(r.symbol,Ee($d,{symbol:n.symbol,documentation:Kd([...n.documentation,...r.documentation]),relationships:Jd([...n.relationships,...r.relationships]),kind:n.kind||r.kind,displayName:n.displayName||r.displayName,enclosingSymbol:n.enclosingSymbol||r.enclosingSymbol,signatureDocumentation:n.signatureDocumentation??r.signatureDocumentation}))}return[...t.values()]}function Jd(e){let t=new Set,r=[];for(let n of e){let i=[n.symbol,n.isReference?"1":"0",n.isImplementation?"1":"0",n.isTypeDefinition?"1":"0",n.isDefinition?"1":"0"].join("|");t.has(i)||(t.add(i),r.push(n))}return r}function Vd(e,t){return e?t?e.length>=t.length?e:t:e:t}function Kd(e){return[...new Set(e)]}import{createHash as Ur}from"crypto";import{closeSync as Qd,existsSync as b,mkdirSync as Yd,openSync as Xd,readSync as Zd,readdirSync as Jr,renameSync as Wr,rmSync as Ye,statSync as Re}from"fs";import{basename as vo,dirname as W,join as h,relative as Po}from"path";var Hr=Object.freeze({maxGenerations:2,maxLogicalBytes:2*1024*1024*1024});function ko(e){let t=P(e.outputDb),r=il(e);e.onStage?.("after-recovery-retained");let n=e.preserveOutputScip?e.outputScip:e.tempOutputScip,i=Qr({generationRoot:t,databasePath:e.tempOutputDb,indexPath:b(n)?n:void 0,metadataPath:b(e.tempMetaPath)?e.tempMetaPath:void 0}),o=(e.now??(()=>new Date))().toISOString(),s={version:le,currentGeneration:i.identity,artifactSet:"immutable-v1",...r?{previousGeneration:r}:{},...e.publication?{publication:e.publication}:{},publishedAt:o},a=q(h(t,"state.json"),s,{spacing:2,trailingNewline:!0});e.onStage?.("after-pointer-handoff"),e.preserveOutputScip||zr(e.tempOutputScip,e.outputScip),e.onStage?.("after-scip-handoff"),zr(e.tempOutputDb,e.outputDb),e.onStage?.("after-database-handoff"),zr(e.tempMetaPath,e.metaPath),e.onStage?.("after-metadata-handoff");let c=i.identity,d={...s,stableMirrors:Kr(e.outputDb,e.outputScip)};q(h(t,"state.json"),d,{spacing:2,trailingNewline:!0});let l=Do(e.outputDb,{now:e.now}),u=E(i.directorySync,a.directorySync);return{currentGeneration:c,...r?{previousGeneration:r}:{},retention:l,achievedDurability:u==="synced"?"directory-durable":"file-flushed",directorySync:u}}function el(e,t,r,n=()=>new Date){if(!b(e))return null;let i=$(e),o=h(P(e),"state.json");if(i?.artifactSet==="immutable-v1"&&_e(e,i.currentGeneration))return i;let s=P(e),a=!i&&b(o)?sl(r,e,t):void 0;if(a&&!Ne(s,a))return null;let c=Qr({generationRoot:s,databasePath:e,indexPath:b(t)?t:void 0,metadataPath:b(r)?r:void 0,forcedIdentity:i?.currentGeneration??a}),d={version:le,currentGeneration:c.identity,artifactSet:"immutable-v1",stableMirrors:Kr(e,t),...i?.previousGeneration?{previousGeneration:i.previousGeneration}:{},...i?.publication?{publication:i.publication}:{},publishedAt:i?.publishedAt??n().toISOString()};return q(h(s,"state.json"),d,{spacing:2,trailingNewline:!0}),d}function Sg(e,t,r=()=>new Date){if(!b(e)||!b(t))throw new Error("metadata-only generation refresh requires stable database and metadata files");let n=$(e),i=P(e),o=Qr({generationRoot:i,databasePath:e,indexPath:b(h(W(e),"index.scip"))?h(W(e),"index.scip"):void 0,metadataPath:t}),s=n&&n.currentGeneration!==o.identity?Mo(e,n.currentGeneration):void 0,a={version:le,currentGeneration:o.identity,artifactSet:"immutable-v1",stableMirrors:Kr(e,h(W(e),"index.scip")),...s?{previousGeneration:s}:{},...n?.publication?{publication:n.publication}:{},publishedAt:r().toISOString()};return q(h(P(e),"state.json"),a,{spacing:2,trailingNewline:!0}),Do(e,{now:r}),a}function Do(e,t={}){let r=tl(t.limits),i=(t.now??(()=>new Date))().toISOString(),o=B(Ge(e),{waitMs:0});if(!o)return{state:"deferred",generationCount:0,logicalBytes:0,protectedGenerations:0,activeReaderLeases:0,staleReaderLeasesRemoved:0,malformedReaderLeases:0,removedGenerations:0,removedLogicalBytes:0,limits:r,at:i,reason:"another process owns local generation retention"};try{let s=$(e),a=Fo(e),c=lr(e,a.map(x=>x.identity),{isProcessAlive:t.isProcessAlive??te,readProcessIdentity:t.readProcessIdentity??ne}),d=new Set(c.protectedGenerations);s?.currentGeneration&&d.add(s.currentGeneration),s?.previousGeneration?.generationIdentity&&d.add(s.previousGeneration.generationIdentity);let l=a.length,u=a.reduce((x,ee)=>x+ee.logicalBytes,0),p=0,m=0;for(let x of a){if(l<=r.maxGenerations&&u<=r.maxLogicalBytes)break;d.has(x.identity)||(t.onBeforeRemove?.(x.identity),Ye(x.path,{recursive:!0,force:!0}),l-=1,u-=x.logicalBytes,p+=1,m+=x.logicalBytes)}let g=l>r.maxGenerations||u>r.maxLogicalBytes,F={state:g?"protected":p>0?"collected":"within-bounds",generationCount:l,logicalBytes:u,protectedGenerations:d.size,activeReaderLeases:c.activeLeases,staleReaderLeasesRemoved:c.staleLeasesRemoved,malformedReaderLeases:c.malformedLeases,removedGenerations:p,removedLogicalBytes:m,limits:r,at:i,...g?{reason:c.malformedLeases>0?"malformed reader ownership evidence fails closed":"retention bounds cannot be met without deleting a protected generation"}:{}};return Eo(e,F),F}catch(s){let a={state:"error",generationCount:0,logicalBytes:0,protectedGenerations:0,activeReaderLeases:0,staleReaderLeasesRemoved:0,malformedReaderLeases:0,removedGenerations:0,removedLogicalBytes:0,limits:r,at:i,reason:s instanceof Error?s.message:String(s)};try{Eo(e,a)}catch{}return a}finally{o.release()}}function bg(e){let t=P(e);if(!b(t))return{state:"absent",generationCount:0,logicalBytes:0,protectedGenerations:0,activeReaderLeases:0,malformedReaderLeases:0,limits:{...Hr},reason:"local immutable generation store does not exist"};let r=rl(e),n=r?.limits??{...Hr},i=B(Ge(e),{waitMs:0});if(!i)return{state:"deferred",generationCount:r?.generationCount??0,logicalBytes:r?.logicalBytes??0,protectedGenerations:r?.protectedGenerations??0,activeReaderLeases:r?.activeReaderLeases??0,malformedReaderLeases:r?.malformedReaderLeases??0,limits:n,...r?{lastCollection:r}:{},reason:"another process owns local generation retention"};try{let o=Fo(e),s=$(e),a=lr(e,o.map(d=>d.identity),{isProcessAlive:te,readProcessIdentity:ne},{removeStale:!1}),c=new Set(a.protectedGenerations);return s?.currentGeneration&&c.add(s.currentGeneration),s?.previousGeneration?.generationIdentity&&c.add(s.previousGeneration.generationIdentity),{state:"managed",generationCount:o.length,logicalBytes:o.reduce((d,l)=>d+l.logicalBytes,0),...o[0]?{oldestGenerationAt:new Date(o[0].modifiedAtMs).toISOString()}:{},protectedGenerations:c.size,activeReaderLeases:a.activeLeases,malformedReaderLeases:a.malformedLeases,limits:n,...r?{lastCollection:r}:{},...a.malformedLeases>0?{reason:"malformed reader ownership evidence prevents unsafe collection"}:{}}}catch(o){return{state:"error",generationCount:0,logicalBytes:0,protectedGenerations:0,activeReaderLeases:0,malformedReaderLeases:0,limits:n,...r?{lastCollection:r}:{},reason:o instanceof Error?o.message:String(o)}}finally{i.release()}}function tl(e={}){let t={...Hr,...e};if(!Number.isSafeInteger(t.maxGenerations)||t.maxGenerations<2)throw new Error("Local SQLite generation retention must keep at least current and previous generations.");if(!Number.isSafeInteger(t.maxLogicalBytes)||t.maxLogicalBytes<=0)throw new Error("Local SQLite generation byte retention must be a positive safe integer.");return t}function Fo(e){let t=P(e);return b(t)?Jr(t,{withFileTypes:!0}).filter(r=>r.isDirectory()&&/^[a-f0-9]{64}$/.test(r.name)).map(r=>{let n=h(t,r.name),i=Ne(t,r.name),o=i?i.database.size+(i.index?.size??0)+(i.metadata?.size??0):Ao(n);return{identity:r.name,path:n,logicalBytes:o,modifiedAtMs:Re(n).mtimeMs}}).sort((r,n)=>r.modifiedAtMs-n.modifiedAtMs||r.identity.localeCompare(n.identity)):[]}function Ao(e){let t=0;for(let r of Jr(e,{withFileTypes:!0})){let n=h(e,r.name);r.isDirectory()?t+=Ao(n):r.isFile()&&(t+=Re(n).size)}return t}function Eo(e,t){V(h(P(e),"gc.json"),t,{spacing:2,trailingNewline:!0})}function rl(e){try{let t=JSON.parse(S(h(P(e),"gc.json"),"local SQLite generation GC status"));return!t||t.state!=="within-bounds"&&t.state!=="collected"&&t.state!=="protected"&&t.state!=="deferred"&&t.state!=="error"||!Number.isSafeInteger(t.generationCount)||t.generationCount<0||!Number.isFinite(t.logicalBytes)||t.logicalBytes<0||!Number.isFinite(Date.parse(t.at))?void 0:t}catch{return}}function Vr(e,t=h(W(e),"meta.json")){let r=h(P(e),"state.json");if(!b(r))return{state:"legacy",statePath:r};let n=$(e);if(!n)return{state:"invalid",statePath:r,reason:"generation state is malformed"};try{let i=_e(e,n.currentGeneration),o=i!==null,s=i?nl(e,t,i,n):!1,a=n.previousGeneration?b(h(W(e),n.previousGeneration.databasePath)):!0;return!s||!o||!a?{state:"drifted",statePath:r,currentMatches:s,recoveryExists:a,generation:n,reason:o?s?"retained recovery database is missing":"stable database or metadata no longer matches the published generation":"published immutable generation is missing"}:{state:"current",statePath:r,currentMatches:s,recoveryExists:a,generation:n}}catch(i){return{state:"drifted",statePath:r,currentMatches:!1,recoveryExists:!1,generation:n,reason:i instanceof Error?i.message:String(i)}}}function nl(e,t,r,n){if(n.stableMirrors&&(n.stableMirrors.databaseFileIdentity!==H(e)||n.stableMirrors.indexFileIdentity!==void 0&&n.stableMirrors.indexFileIdentity!==H(h(W(e),"index.scip")))||!Ro(e,r.database))return!1;let i=h(W(e),"index.scip");if(r.index&&!Ro(i,r.index))return!1;if(!r.metadata)return!b(t);if(!b(t))return!1;let o=h(P(e),r.identity,r.metadata.file);return b(o)&&K(S(t,"reindex metadata"))===K(S(o,"immutable reindex metadata"))}function Ro(e,t){return b(e)&&Re(e).isFile()&&Re(e).size===t.size}function il(e){let t=el(e.outputDb,e.outputScip,e.metaPath);return t?Mo(e.outputDb,t.currentGeneration):void 0}function Kr(e,t){return{databaseFileIdentity:H(e),...b(t)?{indexFileIdentity:H(t)}:{}}}function Mo(e,t){let r=h(P(e),t),n=h(r,vo(e)),i=h(r,"meta.json");return{generationIdentity:t,databasePath:Po(W(e),n),...b(i)?{metadataPath:Po(W(e),i)}:{}}}function ol(e){if(b(e)){for(let t of Jr(e,{withFileTypes:!0}))if(t.isDirectory()&&t.name.endsWith(".tmp"))try{Ye(h(e,t.name),{recursive:!0,force:!0})}catch{}}}function sl(e,t,r=h(W(t),"index.scip")){let n=Ur("sha256").update("sqlite-generation-artifacts-v1\0");return n.update(Lt(t)),b(r)&&n.update(`\0${Lt(r)}`),b(e)&&n.update(`\0${K(S(e,"reindex metadata"))}`),n.digest("hex")}function Qr(e){let t=qr(e.databasePath),r=e.indexPath?qr(e.indexPath):void 0,n=e.metadataPath?qr(e.metadataPath):void 0,i=e.forcedIdentity??al(t,r,e.metadataPath),o=h(e.generationRoot,i),s=h(o,bt);if(b(s)){let d=Ne(e.generationRoot,i);if(d&&Co(o,d.database,t)&&dl(o,d.index,r)&&ll(o,d.metadata,e.metadataPath))return{identity:i,directorySync:I(e.generationRoot)};throw new Error(`SQLite generation ${i} already exists with different or corrupt artifacts.`)}let a=[M(e.generationRoot)];ol(e.generationRoot);let c=`${o}.${process.pid}.${Date.now()}.tmp`;Ye(c,{recursive:!0,force:!0}),Yd(c,{recursive:!0});try{a.push($r(e.databasePath,h(c,t.file))),r&&e.indexPath&&a.push($r(e.indexPath,h(c,r.file))),n&&e.metadataPath&&a.push($r(e.metadataPath,h(c,n.file)));let d=q(h(c,bt),{version:dr,identity:i,database:t,...r?{index:r}:{},...n?{metadata:n}:{}},{spacing:2,trailingNewline:!0});d.directorySync!=="not-requested"&&a.push(d.directorySync),a.push(I(c)),k(()=>Wr(c,o)),a.push(I(e.generationRoot))}finally{try{Ye(c,{recursive:!0,force:!0})}catch{}}return{identity:i,directorySync:E(...a)}}function al(e,t,r){let n=Ur("sha256").update("sqlite-generation-artifacts-v1\0");return n.update(e.sha256),t&&n.update(`\0${t.sha256}`),r&&n.update(`\0${K(S(r,"reindex metadata"))}`),n.digest("hex")}function qr(e){return{file:vo(e),size:Re(e).size,sha256:Lt(e)}}function Lt(e){let t=Ur("sha256"),r=Xd(e,"r"),n=Buffer.allocUnsafe(1024*1024);try{for(;;){let i=cl(r,n);if(i===0)break;t.update(n.subarray(0,i))}}finally{Qd(r)}return t.digest("hex")}function cl(e,t){let r=0;for(;r<t.length;){let n=Zd(e,t,r,t.length-r,null);if(r+=n,n===0)break}return r}function $r(e,t){return Le(e,t,{mode:292})}function Co(e,t,r){let n=h(e,t.file);return t.file===r.file&&t.size===r.size&&t.sha256===r.sha256&&b(n)&&Re(n).size===t.size&&Lt(n)===t.sha256}function dl(e,t,r){return!t||!r?t===r:Co(e,t,r)}function ll(e,t,r){if(!t||!r)return t===void 0&&r===void 0;let n=h(e,t.file);return b(n)&&K(S(n,"stored reindex metadata"))===K(S(r,"candidate reindex metadata"))}function zr(e,t){k(()=>Ye(`${t}.tmp-replace`,{force:!0})),k(()=>Wr(e,`${t}.tmp-replace`)),k(()=>Wr(`${t}.tmp-replace`,t))}var rn=1,To="CODEBASEIQ_SHARED_CACHE",gl=2,Tt=JSON.stringify({cliVersion:ot,artifactCatalogVersion:Qe,postIndexAugmentationSchemaVersion:gl,sqliteGenerationStoreVersion:le,typescriptFragmentStoreVersion:Ft,typescriptOverlayStoreVersion:At}),nn="manifest.json",ml="shared-cache.json",on=[jr,We,Ve];function Zr(e,t){if(!e.clean||!e.treeOid)return;let r=Jo(JSON.stringify({version:rn,repositoryId:e.repositoryId,treeOid:e.treeOid,fingerprint:t,producerIdentity:Tt}));return{repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,fingerprint:t,producerIdentity:Tt,generationId:r,repositoryCacheDir:ft(e.repositoryId)}}function $o(e,t,r){if(process.env[To]==="0")return`${To}=0`;if(!zt(r))return"explicit cache or database override";if(Ht(Xr(t))!==Ht(pt(e))||t!==f(Xr(t),"index.db"))return"index database is outside the managed worktree cache"}function Jg(e,t,r){if(!zt(t))return;let n=r??Ae(e);return n?f(ft(n.repositoryId),"evidence.db"):void 0}function X(e,t=!0){let r=cn(e),n;try{n=Wo(R(f(r,nn),{inputKind:"shared-generation manifest",maxBytes:A}))}catch{return null}if(n.generationId!==e.generationId||n.repositoryId!==e.repositoryId||n.treeOid!==e.treeOid||n.producerIdentity!==e.producerIdentity||JSON.stringify(n.fingerprint)!==JSON.stringify(e.fingerprint))return null;if(!t)return n;try{for(let i of n.artifacts){let o=z(r,i.path),s=jt(o);if(!s.isFile()||s.size!==i.size||ye(o,{inputKind:"shared-generation artifact",maxBytes:L})!==i.sha256)return null}}catch{return null}return n}function Vg(e,t,r){if(!e.treeOid)return null;let n=kt(t,r),i=f(ut(),"repositories",e.repositoryId),o;try{let c=Yr(i);if(!c.isDirectory()||c.isSymbolicLink())return null;o=Bo(i)}catch{return null}let s=f(o,"generations"),a=[];try{for(let c of No(s)){if(!/^[a-f0-9]{64}$/.test(c))continue;let d=f(s,c),l;try{l=Yr(d)}catch{continue}if(!(!l.isDirectory()||l.isSymbolicLink()))try{let u=Wo(R(f(d,nn),{inputKind:"shared-generation baseline manifest",maxBytes:A}));u.generationId===c&&u.repositoryId===e.repositoryId&&u.treeOid===e.treeOid&&u.producerIdentity===Tt&&bl(u.fingerprint,n)&&a.push(u)}catch{continue}}}catch{return null}a.sort((c,d)=>Date.parse(d.createdAt)-Date.parse(c.createdAt)||c.generationId.localeCompare(d.generationId));for(let c of a){let d={repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,fingerprint:c.fingerprint,producerIdentity:c.producerIdentity,generationId:c.generationId,repositoryCacheDir:o},l=X(d);if(l)return{snapshot:d,manifest:l}}return null}function zo(e){let t=B(f(e.snapshot.repositoryCacheDir,"locks",`${e.snapshot.generationId}.publish.lock`));if(!t)throw new Error(`shared generation publication is already in progress for ${e.snapshot.generationId}`);try{return yl(e)}finally{t.release()}}function yl(e){let t=X(e.snapshot);if(t)return Oo(e.snapshot,t);if(!et(e.sourceCacheDir,e.sourceProjectRoot,e.snapshot.fingerprint))throw new Error("source index is incomplete, incompatible, or corrupt");let r=jo(e.sourceCacheDir);if(!r)throw new Error("source index artifacts are incomplete");let n=Mt(e.sourceCacheDir),i=f(e.snapshot.repositoryCacheDir,"generations"),o=[M(i)],s=_o(f(i,`.tmp-${process.pid}-`));try{let a=[];for(let g of n.files){let F=z(e.sourceCacheDir,g),x=z(s,g);o.push(tt(F,x,292)),e.onPublicationStage?.("after-artifact-flushed",g);let ee=jt(x).size;a.push({path:g,size:ee,sha256:ye(x,{inputKind:"staged shared-generation artifact",maxBytes:L})})}let c=qo(D(f(s,"index.scip"),{inputKind:"staged shared SCIP index",maxBytes:L})).metadata?.projectRoot;if(!c)throw new Error("shared SCIP generation has no project root metadata");let d=ln(e.sourceProjectRoot);if(!be(c,d))throw new Error("shared SCIP generation root does not match its source worktree");if(jo(e.sourceCacheDir)!==r||e.sourceStillValid&&!e.sourceStillValid())throw new Error("source index changed while staging a shared generation");let l={version:rn,artifactCatalogVersion:Qe,generationId:e.snapshot.generationId,repositoryId:e.snapshot.repositoryId,treeOid:e.snapshot.treeOid,fingerprint:e.snapshot.fingerprint,producerIdentity:e.snapshot.producerIdentity,sourceProjectRoot:e.sourceProjectRoot,scipProjectRoot:c,createdAt:(e.now??(()=>new Date))().toISOString(),artifacts:a.sort((g,F)=>g.path.localeCompare(F.path))},u=q(f(s,nn),l,{spacing:2,trailingNewline:!0});u.directorySync!=="not-requested"&&o.push(u.directorySync),e.onPublicationStage?.("after-manifest-flushed"),o.push(I(s)),e.onPublicationStage?.("after-staging-directory-synced");let p=cn(e.snapshot);try{if(Y(p)&&!X(e.snapshot)){let g=`${p}.corrupt-${process.pid}-${Date.now()}`;k(()=>ge(p,g)),Q(g,{recursive:!0,force:!0})}k(()=>ge(s,p))}catch(g){let F=X(e.snapshot);if(F)return Oo(e.snapshot,F);throw g}e.onPublicationStage?.("after-generation-renamed"),o.push(I(i)),e.onPublicationStage?.("after-generations-directory-synced");let m=E(...o);return{kind:"published",manifest:l,achievedDurability:m==="synced"?"directory-durable":"file-flushed",directorySync:m}}finally{Q(s,{recursive:!0,force:!0})}}function Oo(e,t){let r=I(f(e.repositoryCacheDir,"generations"));return{kind:"existing",manifest:t,achievedDurability:r==="synced"?"directory-durable":"file-flushed",directorySync:r}}function en(e){let t=cn(e.snapshot);ve(e.targetCacheDir,{recursive:!0});let r=B(f(e.targetCacheDir,"cache-lifecycle.lock"),{waitMs:3e4});if(!r)throw new Error("timed out waiting for another cache hydration");let n,i,o=!1;try{n=_o(f(e.targetCacheDir,".shared-hydrate-")),Pl(e.manifest,e.snapshot);for(let c of e.manifest.artifacts){let d=z(t,c.path),l=z(n,c.path);if(tt(d,l),jt(l).size!==c.size||ye(l,{inputKind:"hydrated shared-generation artifact",maxBytes:L})!==c.sha256)throw new Error(`shared artifact is corrupt: ${c.path}`)}let s=ln(e.targetProjectRoot);if(s!==e.manifest.scipProjectRoot)for(let c of e.manifest.artifacts)c.path.endsWith(".scip")&&xo(z(n,c.path),e.manifest.scipProjectRoot,s);if(!et(n,e.targetProjectRoot,e.snapshot.fingerprint,!1))throw new Error("staged shared generation failed completeness or integrity validation");i=Il(e.targetCacheDir,n),o=!0,xl(n,e.targetCacheDir,i),ko({tempOutputScip:f(n,"index.scip"),tempOutputDb:f(n,"index.db"),tempMetaPath:f(n,"meta.json"),outputScip:f(e.targetCacheDir,"index.scip"),outputDb:f(e.targetCacheDir,"index.db"),metaPath:f(e.targetCacheDir,"meta.json"),now:e.now});let a=Vr(f(e.targetCacheDir,"index.db"),f(e.targetCacheDir,"meta.json"));if(a.state==="invalid"||a.state==="drifted")throw new Error(`hydrated SQLite generation failed validation: ${a.reason}`);e.persistLease!==!1&&tn(e.snapshot,e.targetCacheDir,e.action??"attached",e.now)}catch(s){throw o&&i&&wl(e.targetCacheDir,i),s}finally{n&&Q(n,{recursive:!0,force:!0}),r.release()}}function Kg(e,t,r,n){let i=$o(e,r.dbPath,t);if(i)return{kind:"bypassed",reason:i};try{let o=n??Ae(e);if(!o)return{kind:"missed",reason:"Git worktree identity is unavailable"};if(!o.clean)return Ot(o,r.cacheDir,"missed",void 0,"worktree has uncommitted changes"),{kind:"missed",reason:"worktree has uncommitted changes"};let s=t.languages??vr(e),a=Er(e,s,Ho(t)),c=Zr(o,a);if(!c)return{kind:"missed",reason:"clean committed snapshot is unavailable"};let d=X(c);if(d)return en({snapshot:c,manifest:d,targetCacheDir:r.cacheDir,targetProjectRoot:e}),{kind:"attached",generationId:c.generationId};let l=hl(c,e);return l?(d=l.manifest,en({snapshot:c,manifest:d,targetCacheDir:r.cacheDir,targetProjectRoot:e,action:"peer-imported"}),{kind:"peer-imported",generationId:c.generationId,sourceProjectRoot:l.sourceProjectRoot}):(Ot(o,r.cacheDir,"missed",void 0,"no exact shared or peer generation exists"),{kind:"missed",reason:"no exact shared or peer generation exists"})}catch(o){return{kind:"failed",reason:o instanceof Error?o.message:String(o)}}}function Qg(e,t,r,n){let i=$o(e,r.dbPath,t);if(i)return{kind:"bypassed",reason:i};try{let o=n??Ae(e);if(!o)return{kind:"missed",reason:"Git worktree identity is unavailable"};if(!o.clean)return Ot(o,r.cacheDir,"missed",void 0,"worktree is not a clean committed snapshot"),{kind:"missed",reason:"worktree is not a clean committed snapshot"};let s=t.languages??vr(e),a=Er(e,s,Ho(t)),c=Zr(o,a);if(!c)return Ot(o,r.cacheDir,"missed",void 0,"worktree is not a clean committed snapshot"),{kind:"missed",reason:"worktree is not a clean committed snapshot"};let d=X(c);if(d)return et(r.cacheDir,e,a)?(tn(c,r.cacheDir,"local-fresh"),{kind:"local-fresh"}):(en({snapshot:c,manifest:d,targetCacheDir:r.cacheDir,targetProjectRoot:e}),{kind:"attached",generationId:c.generationId});let l=an(r.cacheDir);return!l||JSON.stringify(l.fingerprint)!==JSON.stringify(a)||JSON.stringify([...l.indexedLanguages??[]].sort())!==JSON.stringify([...s].sort())?{kind:"missed",reason:"local metadata does not match the clean worktree snapshot"}:et(r.cacheDir,e,a)?(zo({snapshot:c,sourceCacheDir:r.cacheDir,sourceProjectRoot:e,sourceStillValid:()=>{let u=Ae(e);return(u?Zr(u,a):void 0)?.generationId===c.generationId}}),tn(c,r.cacheDir,"built"),{kind:"built",generationId:c.generationId}):{kind:"missed",reason:"local index artifacts are incomplete or incompatible"}}catch(o){return{kind:"failed",reason:o instanceof Error?o.message:String(o)}}}async function Yg(e,t={}){let r=t.timeoutMs??3e4,n=t.pollMs??100,i=t.now??ce,o=i()+r,s=f(e.repositoryCacheDir,"locks"),a=f(s,`${e.generationId}.lock`),c=d=>{if(!d||typeof d!="object"||Array.isArray(d))return null;let l=d.pid;return typeof l=="number"&&Number.isSafeInteger(l)&&l>0?{pid:l}:null};for(;i()<=o;){if(X(e))return{kind:"generation-ready"};let d=St(a,{kind:"shared-generation-build",detail:{generationId:e.generationId},parseLegacy:c});if(d.kind==="acquired")return{kind:"owner",release:()=>d.lock.release()};let l=o-i();if(l<=0)break;await pl(Math.min(n,l))}return X(e)?{kind:"generation-ready"}:{kind:"timeout"}}function tn(e,t,r,n=void 0){let i={version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,localCacheDir:t,baseGenerationId:e.generationId,activeGenerationId:e.generationId,lastAction:r,lastSeenAt:(n??(()=>new Date))().toISOString()},o={...i,ownershipChecksum:sn(i)};return dn(e.repositoryCacheDir,o,!0),o}function Xg(e,t,r=void 0){let n={version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,localCacheDir:t,baseGenerationId:e.generationId,lastAction:"overlay",lastReason:`private cache forked from shared baseline ${e.generationId}`,lastSeenAt:(r??(()=>new Date))().toISOString()},i={...n,ownershipChecksum:sn(n)};return dn(e.repositoryCacheDir,i,!0),i}function Ot(e,t,r,n=void 0,i=void 0){let o={version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,localCacheDir:t,lastAction:r,...i?{lastReason:i}:{},lastSeenAt:(n??(()=>new Date))().toISOString()},s={...o,ownershipChecksum:sn(o)};return dn(ft(e.repositoryId),s,!1),s}function sn(e){return Jo(JSON.stringify({version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:Ze(e.projectRoot),localCacheDir:Ze(e.localCacheDir)}))}function Wo(e){let t=JSON.parse(e);if(t.version!==rn||t.artifactCatalogVersion!==Qe||typeof t.generationId!="string"||!/^[a-f0-9]{64}$/.test(t.generationId)||typeof t.repositoryId!="string"||!/^[a-f0-9]{24}$/.test(t.repositoryId)||typeof t.treeOid!="string"||!t.treeOid||typeof t.producerIdentity!="string"||t.producerIdentity!==Tt||typeof t.sourceProjectRoot!="string"||typeof t.scipProjectRoot!="string"||typeof t.createdAt!="string"||!Number.isFinite(Date.parse(t.createdAt))||!t.fingerprint||!Array.isArray(t.artifacts))throw new Error("invalid shared generation manifest");let r=new Set;for(let n of t.artifacts){if(!n||typeof n.path!="string"||typeof n.size!="number"||n.size<0||typeof n.sha256!="string"||!/^[a-f0-9]{64}$/.test(n.sha256))throw new Error("invalid shared generation artifact");if(Ct(n.path),r.has(n.path))throw new Error(`duplicate shared generation artifact: ${n.path}`);r.add(n.path)}for(let n of["index.db","index.scip","meta.json"])if(!r.has(n))throw new Error(`shared generation is missing ${n}`);return t}function tt(e,t,r=384){return Le(e,t,{mode:r})}function hl(e,t){for(let r of yn(t)){if(Ze(r.path)===Ze(t))continue;let n=pt(r.path),i=an(n);if(!(!i||JSON.stringify(i.fingerprint)!==JSON.stringify(e.fingerprint)||JSON.stringify([...i.indexedLanguages??[]].sort())!==JSON.stringify([...e.fingerprint.languages].sort()))&&et(n,r.path,e.fingerprint))try{return{manifest:zo({snapshot:e,sourceCacheDir:n,sourceProjectRoot:r.path}).manifest,sourceProjectRoot:r.path}}catch{continue}}return null}function Sl(e,t,r){ve(e,{recursive:!0}),q(f(e,ml),{version:1,repositoryId:t,worktreeId:r},{spacing:2,trailingNewline:!0})}function jo(e){try{let t=Mt(e),r=Go("sha256");for(let n of t.files){let i=z(e,n),o=jt(i).size;r.update(n).update("\0").update(String(o)).update("\0"),it(i,{inputKind:"source-generation artifact",maxBytes:L},s=>r.update(s)),r.update("\0")}return r.digest("hex")}catch{return null}}function an(e){try{let t=mt(R(f(e,"meta.json"),{inputKind:"reindex metadata",maxBytes:A}));return(t.kind==="legacy"||t.kind==="supported")&&t.capabilities.publishableGeneration?t.metadata:void 0}catch{return}}function Ho(e){return{pnpmWorkspaces:e.indexer?.typescript?.pnpmWorkspaces,typescriptProjectMode:e.indexer?.typescript?.projectMode,typescriptProjects:e.indexer?.typescript?.projects,clojureConfigPath:e.indexer?.clojure?.configPath}}function bl(e,t){let r=kt(e.languages,e);return JSON.stringify(r)===JSON.stringify(t)}function cn(e){return f(e.repositoryCacheDir,"generations",e.generationId)}function dn(e,t,r){let n=Yn(e,{waitMs:5e3});if(!n)throw new Error("repository cache cleanup is busy");try{if(r){let o=t.activeGenerationId??t.baseGenerationId;if(!o||!Y(f(e,"generations",o)))throw new Error("shared generation disappeared before its lease was attached")}let i=f(e,"worktrees");ve(i,{recursive:!0}),q(f(i,`${t.worktreeId}.json`),t,{spacing:2,trailingNewline:!0}),Sl(t.localCacheDir,t.repositoryId,t.worktreeId)}finally{n.release()}}function Il(e,t){let r=f(t,".rollback"),n=new Map,i=new Map;ve(r,{recursive:!0});for(let a of["index.scip","index.db","meta.json"]){let c=f(e,a),d=Y(c);n.set(a,d),d&&tt(c,f(r,"stable",a))}for(let a of on){let c=f(e,a),d=Y(c);if(d){let l=Yr(c);if(!l.isDirectory()||l.isSymbolicLink())throw new Error(`managed artifact path is not a directory: ${a}`)}i.set(a,d)}let o=f(e,je),s=Y(o);return s&&Uo(o,f(r,"sqlite-generations")),{root:r,stableFiles:n,managedDirectories:i,generationStoreExisted:s}}function xl(e,t,r){for(let n of on){let i=f(t,n);if(r.managedDirectories.get(n)){let s=f(r.root,"managed",n);ve(Xr(s),{recursive:!0}),k(()=>ge(i,s))}let o=f(e,n);Y(o)&&k(()=>ge(o,i))}}function wl(e,t){for(let i of on){let o=f(e,i),s=f(t.root,"managed",i);t.managedDirectories.get(i)?Y(s)&&(Q(o,{recursive:!0,force:!0}),k(()=>ge(s,o))):Q(o,{recursive:!0,force:!0})}for(let[i,o]of t.stableFiles){let s=f(e,i);if(!o){Q(s,{force:!0});continue}let a=`${s}.shared-restore-${ul()}`;tt(f(t.root,"stable",i),a),k(()=>Q(s,{force:!0})),k(()=>ge(a,s))}let r=f(e,je);Q(r,{recursive:!0,force:!0});let n=f(t.root,"sqlite-generations");t.generationStoreExisted&&Y(n)&&k(()=>ge(n,r))}function Uo(e,t){ve(t,{recursive:!0});for(let r of No(e,{withFileTypes:!0})){let n=f(e,r.name),i=f(t,r.name);if(r.isSymbolicLink())throw new Error(`managed cache backup cannot contain a symlink: ${n}`);r.isDirectory()?Uo(n,i):r.isFile()&&tt(n,i)}}function Pl(e,t){if(e.generationId!==t.generationId||e.repositoryId!==t.repositoryId||e.treeOid!==t.treeOid||e.producerIdentity!==t.producerIdentity||JSON.stringify(e.fingerprint)!==JSON.stringify(t.fingerprint))throw new Error("shared generation manifest does not match the requested snapshot")}function et(e,t,r,n=!0,i=!0){try{let o=an(e);if(!o||JSON.stringify(o.fingerprint)!==JSON.stringify(r)||JSON.stringify([...o.indexedLanguages??[]].sort())!==JSON.stringify([...r.languages].sort()))return Xe("source validation rejected metadata"),!1;let s=Mt(e),a=Vr(f(e,"index.db"),f(e,"meta.json"));if(n?a.state!=="current":a.state==="invalid"||a.state==="drifted")return Xe(`source validation rejected SQLite generation state ${a.state}`),!1;let c=new fl(f(e,"index.db"),{readonly:!0,fileMustExist:!0});try{if(i){if(c.pragma("quick_check(1)",{simple:!0})!=="ok")return!1}else c.pragma("schema_version",{simple:!0})}finally{c.close()}let d=ln(t),u=(i?s.files.filter(p=>p.endsWith(".scip")):["index.scip"]).every(p=>{let m=qo(D(z(e,p),{inputKind:"shared SCIP validation artifact",maxBytes:L})).metadata?.projectRoot,g=m!==void 0&&be(m,d);return g||Xe(`source validation rejected SCIP root for ${p}: ${String(m)}`),g});return u||Xe("source validation rejected SCIP project roots"),u}catch(o){return Xe(`source validation failed: ${o instanceof Error?o.message:String(o)}`),!1}}function Xe(e){process.env.CODEBASEIQ_DEBUG&&console.error(`shared-cache: ${e}`)}function ln(e){try{return Lo(Bo(e)).href}catch{return Lo(Ze(e)).href}}function Jo(e){return Go("sha256").update(e).digest("hex")}function em(e){return typeof e=="object"&&e!==null}function tm(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")?e:null}import{createHash as El,randomUUID as Xo}from"crypto";import{existsSync as Fe,lstatSync as nt,readdirSync as De,renameSync as Zo,rmSync as Z}from"fs";import{basename as un,dirname as Rl,join as w}from"path";function Gt(e){return Array.isArray(e)?`[${e.map(Gt).join(",")}]`:e&&typeof e=="object"?`{${Object.entries(e).sort(([t],[r])=>t.localeCompare(r)).map(([t,r])=>`${JSON.stringify(t)}:${Gt(r)}`).join(",")}}`:JSON.stringify(e)}var vl=1,kl=Object.freeze({maxItems:1024,maxBytes:512*1024*1024,maxItemBytes:64*1024*1024,maxBatch:16,claimLeaseMs:5*6e4,responseRetentionMs:10*6e4,deadLetterRetentionMs:1440*6e4,temporaryRetentionMs:6e4,cleanupBatch:64}),ke=class extends Error{constructor(r,n,i,o){let s=r==="item-too-large"?`request is ${o} bytes; per-item limit is ${i.maxItemBytes}`:r==="item-capacity"?`mailbox has ${n.totalItems} retained items; limit is ${i.maxItems}`:r==="byte-capacity"?`mailbox retains ${n.totalBytes} bytes and the request adds ${o}; limit is ${i.maxBytes}`:"another writer held the admission coordinator through the bounded wait";super(`Mailbox backpressure: ${s}. Retry after the service drains or expires retained work.`);this.code=r;this.status=n;this.limits=i;this.attemptedBytes=o;this.name="MailboxBackpressureError"}code;status;limits;attemptedBytes},Dl=".owner.json",Fl={isProcessAlive:()=>!0,readProcessIdentity:()=>null};function pm(e){return{rootDir:e,pendingDir:w(e,"pending"),inflightDir:w(e,"inflight"),responseDir:w(e,"responses"),deadLetterDir:w(e,"dead-letter"),legacyRequestDir:w(e,"requests")}}function Al(e={}){let t={...kl,...e};for(let[r,n]of Object.entries(t))if(!Number.isFinite(n)||n<=0||!Number.isInteger(n))throw new Error(`Mailbox limit ${r} must be a positive integer.`);return t}function es(e){let t=[e.pendingDir,e.inflightDir,e.responseDir,e.deadLetterDir,e.legacyRequestDir].map(r=>M(r));return E(...t)}function fm(e,t){return El("sha256").update(Gt({namespace:e,payload:t})).digest("hex")}function Ml(e){if(!/^[a-f0-9]{64}$/.test(e))throw new Error("Mailbox operation keys must be lowercase SHA-256 identities.");return`op-${e}`}function gm(e,t,r={}){let n=Al(r.limits),i=r.nowMs??Date.now(),o=es(e);return Nl(t),Ll(e,n,r.admissionLockTimeoutMs??2e3,r.monotonicNow??ce,()=>{Cl(e,i,n);let s=w(e.pendingDir,`${t.id}.json`),a=w(e.responseDir,`${t.id}.json`),c=Vo(e,t.id);if(c){let p=Ko(c,t.operationKey,t.id);return{disposition:"duplicate",requestId:t.id,responsePath:a,authoritativeDeadlineAtMs:p.deadlineAtMs??t.deadlineAtMs}}let d=`${JSON.stringify(t)}
|
|
86
|
-
`,l=Buffer.byteLength(d),u=ts(e);if(l>n.maxItemBytes)throw new ke("item-too-large",u,n,l);if(u.totalItems+1>n.maxItems)throw new ke("item-capacity",u,n,l);if(u.totalBytes+l>n.maxBytes)throw new ke("byte-capacity",u,n,l);r.onBeforePublish?.();try{let p=or(s,d,{durability:"durable"}),m=E(o,p.directorySync);return{disposition:"accepted",requestId:t.id,responsePath:a,authoritativeDeadlineAtMs:t.deadlineAtMs,achievedDurability:m==="synced"?"directory-durable":"file-flushed",directorySync:m}}catch(p){if(p.code!=="EEXIST")throw p;let m=Vo(e,t.id);if(!m)throw p;let g=Ko(m,t.operationKey,t.id);return{disposition:"duplicate",requestId:t.id,responsePath:a,authoritativeDeadlineAtMs:g.deadlineAtMs??t.deadlineAtMs}}})}function Cl(e,t,r,n=Fl){let i={reclaimed:0,completedClaimsRemoved:0,responsesRemoved:0,deadLettersRemoved:0,temporaryFilesRemoved:0},o=r.cleanupBatch;for(let s of fn(e.inflightDir)){if(o<=0)break;let a=w(e.responseDir,`${s.requestId}.json`);if(Fe(a)){Z(s.path,{force:!0}),i.completedClaimsRemoved++,o--;continue}if(s.claimExpiresAtMs>t||Gl(e,s.ownerId,n)!=="dead")continue;let c=w(e.pendingDir,s.originalFile);try{Zo(s.path,c),i.reclaimed++}catch(d){if(d.code!=="EEXIST")throw d;Z(s.path,{force:!0})}I(Rl(s.path)),I(e.pendingDir),o--}o=Qo(e.responseDir,o,(s,a)=>a+r.responseRetentionMs,t,()=>{i.responsesRemoved++}),o=Qo(e.deadLetterDir,o,(s,a)=>a+r.deadLetterRetentionMs,t,()=>{i.deadLettersRemoved++});for(let s of[e.pendingDir,e.inflightDir,e.responseDir,e.deadLetterDir,e.legacyRequestDir]){if(o<=0)break;for(let a of rs(s)){if(o<=0)break;un(a).includes(".tmp-")&&(nt(a).mtimeMs+r.temporaryRetentionMs>t||(Z(a,{force:!0}),i.temporaryFilesRemoved++,o--))}}return Bl(e.inflightDir),i}function ts(e){es(e);let t=[...rt(e.pendingDir).map(c=>({path:c,pending:!0})),...rt(e.legacyRequestDir).map(c=>({path:c,pending:!0}))],r=fn(e.inflightDir).map(c=>({path:c.path,pending:!1})),n=rt(e.responseDir).map(c=>({path:c,pending:!1})),i=rt(e.deadLetterDir).map(c=>({path:c,pending:!1})),o=[...t,...r,...n,...i],s=0,a;for(let c of t){let d=gn(c.path);if(!d){s++;continue}let l=d.enqueuedAtMs??nt(c.path).mtimeMs;a=a===void 0?l:Math.min(a,l)}return{pending:t.length,inflight:r.length,responses:n.length,deadLetters:i.length,invalid:s,totalItems:o.length,totalBytes:o.reduce((c,d)=>c+ql(d.path),0),...a===void 0?{}:{oldestPendingAt:new Date(a).toISOString()}}}function Ll(e,t,r,n,i){let o=w(e.rootDir,".admission.lock"),s=`${process.pid}-${Xo()}`,a=n()+Math.max(0,r);for(;!Tl(e.rootDir,o,s);){if(Ol(o),n()>=a)throw new ke("admission-busy",ts(e),t,0);Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,5)}try{return i()}finally{try{pn(o).ownerToken===s&&(Z(o,{recursive:!0,force:!0}),I(e.rootDir))}catch{}}}function Tl(e,t,r){let n=`${JSON.stringify({ownerToken:r,pid:process.pid,acquiredAtMs:Date.now()})}
|
|
87
|
-
`;try{return or(t,n,{durability:"durable"}),!0}catch(i){if(i.code==="EEXIST")return!1;try{pn(t).ownerToken===r&&(Z(t,{force:!0}),I(e))}catch{}throw i}}function Ol(e){let t=null;try{let n=pn(e);typeof n.ownerToken=="string"&&Number.isSafeInteger(n.pid)&&Number(n.pid)>0&&(t=Number(n.pid))}catch{}if(t===null||jl(t))return;let r=`${e}.stale-${Xo()}`;try{Zo(e,r)}catch(n){let i=n.code;if(i==="ENOENT"||i==="EEXIST")return;throw n}Z(r,{recursive:!0,force:!0})}function pn(e){try{return JSON.parse(S(e,"mailbox lock record"))}catch(t){if(t.code!=="EISDIR"&&!(t instanceof Sn&&t.reason==="not-regular"))throw t;return JSON.parse(S(w(e,"owner.json"),"mailbox lock owner record"))}}function jl(e){try{return process.kill(e,0),!0}catch(t){let r=t.code;return r==="EPERM"||r!=="ESRCH"}}function Gl(e,t,r){let n=_l(w(e.inflightDir,ns(t),Dl));if(!n)return"unknown";if(!r.isProcessAlive(n.pid))return"dead";if(!n.processIdentity)return"live";let i=r.readProcessIdentity(n.pid);return i?re(n.processIdentity,i)?"live":"dead":"unknown"}function _l(e){try{let t=JSON.parse(S(e,"mailbox owner record"));if(t.version!==1||typeof t.ownerId!="string"||!t.ownerId||typeof t.pid!="number"||!Number.isSafeInteger(t.pid)||t.pid<=0)return null;let r=t.processIdentity===void 0?null:he(t.processIdentity);return t.processIdentity!==void 0&&(!r||r.pid!==t.pid)?null:{version:1,ownerId:t.ownerId,pid:t.pid,...r?{processIdentity:r}:{}}}catch{return null}}function Vo(e,t){for(let r of[w(e.pendingDir,`${t}.json`),w(e.legacyRequestDir,`${t}.json`),w(e.responseDir,`${t}.json`)])if(Fe(r))return r;for(let r of fn(e.inflightDir))if(r.requestId===t)return r.path;return null}function Ko(e,t,r){let n=gn(e);if(!n||n.operationKey!==t)throw new Error(`Mailbox operation ${r} conflicts with an existing retained record.`);return n}function Nl(e){if(e.mailboxVersion!==vl||e.id!==Ml(e.operationKey)||!e.clientId.trim()||!Number.isFinite(e.enqueuedAtMs)||!Number.isFinite(e.deadlineAtMs)||e.deadlineAtMs<e.enqueuedAtMs)throw new Error("Mailbox request has an invalid lifecycle identity.")}function fn(e){if(!Fe(e))return[];let t=[];for(let r of De(e,{withFileTypes:!0})){if(!r.isDirectory())continue;let n=Yo(r.name);if(n===null)continue;let i=w(e,r.name);for(let o of De(i,{withFileTypes:!0})){if(!o.isFile()||!o.name.endsWith(".claim"))continue;let s=/^(.*)\.(\d+)\.claim$/.exec(o.name);if(!s)continue;let a=Yo(s[1]),c=Number(s[2]);if(a===null||un(a)!==a||!a.endsWith(".json")||!Number.isSafeInteger(c))continue;let d=w(i,o.name),l=gn(d)??{id:un(a,".json")},u=nt(d);t.push({requestId:l.id,ownerId:n,path:d,originalFile:a,claimedAtMs:u.mtimeMs,claimExpiresAtMs:c,byteLength:u.size,...l.operationKey?{operationKey:l.operationKey}:{},...l.clientId?{clientId:l.clientId}:{},...l.enqueuedAtMs===void 0?{}:{enqueuedAtMs:l.enqueuedAtMs},...l.deadlineAtMs===void 0?{}:{deadlineAtMs:l.deadlineAtMs},legacy:l.operationKey===void 0})}}return t.sort((r,n)=>r.claimedAtMs-n.claimedAtMs||r.path.localeCompare(n.path))}function gn(e){try{let t=JSON.parse(S(e,"mailbox record"));return typeof t.id!="string"||!t.id?null:{id:t.id,...typeof t.operationKey=="string"?{operationKey:t.operationKey}:{},...typeof t.clientId=="string"?{clientId:t.clientId}:{},...typeof t.enqueuedAtMs=="number"?{enqueuedAtMs:t.enqueuedAtMs}:{},...typeof t.deadlineAtMs=="number"?{deadlineAtMs:t.deadlineAtMs}:{}}}catch{return null}}function Qo(e,t,r,n,i){for(let o of rt(e)){if(t<=0)break;let s=nt(o);r(o,s.mtimeMs)>n||(Z(o,{force:!0}),i(),t--)}return t}function rt(e){return Fe(e)?De(e,{withFileTypes:!0}).filter(t=>t.isFile()).map(t=>w(e,t.name)).sort():[]}function rs(e){if(!Fe(e))return[];let t=[];for(let r of De(e,{withFileTypes:!0})){let n=w(e,r.name);r.isFile()?t.push(n):r.isDirectory()&&t.push(...rs(n))}return t.sort()}function Bl(e){if(Fe(e))for(let t of De(e,{withFileTypes:!0})){if(!t.isDirectory())continue;let r=w(e,t.name);De(r).some(n=>n.endsWith(".claim"))||Z(r,{recursive:!0,force:!0})}}function ql(e){try{return nt(e).size}catch{return 0}}function ns(e){return Buffer.from(e,"utf8").toString("base64url")}function Yo(e){try{let t=Buffer.from(e,"base64url").toString("utf8");return ns(t)===e?t:null}catch{return null}}export{ie as a,Se as b,M as c,I as d,E as e,v as f,Nt as g,Ql as h,Yl as i,O as j,j as k,ot as l,Ce as m,$t as n,ut as o,pt as p,zt as q,cu as r,du as s,Ht as t,uu as u,pu as v,fu as w,Ut as x,mu as y,yu as z,Ts as A,ae as B,mt as C,wu as D,Hn as E,js as F,Pu as G,ce as H,yt as I,Un as J,ht as K,St as L,Ie as M,Zs as N,Yn as O,B as P,Nu as Q,k as R,ir as S,or as T,V as U,q as V,fp as W,gi as X,Ep as Y,Be as Z,vi as _,ki as $,Di as aa,dc as ba,Fi as ca,Mp as da,Cp as ea,Lp as fa,xt as ga,Ac as ha,$e as ia,Qc as ja,Bi as ka,Yc as la,df as ma,Pr as na,lf as oa,Xc as pa,Zc as qa,Er as ra,vr as sa,ko as ta,el as ua,Sg as va,bg as wa,Vr as xa,em as ya,tm as za,Gt as Aa,vl as Ba,pm as Ca,fm as Da,Ml as Ea,gm as Fa,Pf as Ga,Ef as Ha,Rf as Ia,vf as Ja,kf as Ka,Of as La,jf as Ma,Gf as Na,_f as Oa,Qf as Pa,ig as Qa,og as Ra,Zr as Sa,$o as Ta,Jg as Ua,X as Va,Vg as Wa,zo as Xa,en as Ya,Kg as Za,Qg as _a,Yg as $a,tn as ab,Xg as bb,sn as cb};
|
|
88
|
-
//# sourceMappingURL=chunk-2X7V4HS4.js.map
|
package/dist/chunk-3IER7Q6H.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{a as d}from"./chunk-FM5BPL4V.js";import{basename as m}from"path";function S(){let t=new WeakMap;return{cache:t,ensure(n){let r=t.get(n);return r||(r=new Map,t.set(n,r)),r}}}function p(t,n){let{cache:r,ensure:s}=S(),a={get(e,o,c){let i=s(e);if(i.has(o))return i.get(o);let l=c();return i.set(o,l),l},invalidate(e,o){r.get(e)?.delete(o)},invalidateAll(e){r.delete(e)},size(e){return r.get(e)?.size??0}};return d({name:t,groups:n.clearGroups,clearAll:e=>a.invalidateAll(e),clearFile:(e,o)=>a.invalidate(e,o)}),a}function G(t,n){let r=new WeakMap,s={get(a,e){let o=r.get(a);if(o)return o.value;let c=e();return r.set(a,{value:c}),c},invalidate(a){r.delete(a)},has(a){return r.has(a)}};return d({name:t,groups:n.clearGroups,clearAll:a=>s.invalidate(a)}),s}var _={clearGroups:["whole-project","source-file"]};function X(t){return y(t,_)}function y(t,n){let{cache:r,ensure:s}=S(),a={get(e,o,c,i){let l=s(e),u=l.get(o);if(u&&u.source===c)return u.value;let f=i();return l.set(o,{source:c,value:f}),f},invalidate(e,o){r.get(e)?.delete(o)},invalidateAll(e){r.delete(e)}};return d({name:t,groups:n.clearGroups,clearAll:e=>a.invalidateAll(e),clearFile:(e,o)=>a.invalidate(e,o)}),a}var I=p("indexed-document-paths",{clearGroups:["whole-project"]});function g(t,n={}){let r=P(n);return[...I.get(t,r,()=>{let a=n.scope?"AND relative_path LIKE ?":"",e=n.like?"AND relative_path LIKE ?":"",o=[...n.scope?[`%${n.scope}%`]:[],...n.like?[n.like]:[]],c=t.all(`SELECT relative_path
|
|
2
|
-
FROM documents
|
|
3
|
-
WHERE 1 = 1
|
|
4
|
-
${t.pathExclusionsFor("documents")}
|
|
5
|
-
${a}
|
|
6
|
-
${e}
|
|
7
|
-
ORDER BY relative_path`,...o).map(l=>l.relative_path),i=n.extensions?c.filter(l=>n.extensions.some(u=>l.toLowerCase().endsWith(u.toLowerCase()))):c;return n.includeIgnored===!1?i.filter(l=>!t.isIgnored(l)):i})]}function P(t){let n=t.extensions?[...new Set(t.extensions.map(r=>r.toLowerCase()))].sort():null;return JSON.stringify({scope:t.scope??null,like:t.like??null,extensions:n,includeIgnored:t.includeIgnored!==!1})}function B(t,n,r){let s=b(n);if(!s)return[];let a=t.all(`SELECT relative_path
|
|
8
|
-
FROM documents
|
|
9
|
-
WHERE relative_path = ?
|
|
10
|
-
${t.pathExclusionsFor("documents")}`,s).filter(i=>!t.isIgnored(i.relative_path)).map(i=>({relativePath:i.relative_path,score:x(i.relative_path,s)}));if(a.length>0)return a;let e=g(t,{includeIgnored:!1}).map(i=>({relativePath:i,score:x(i,s)})).filter(i=>i.score>0).sort((i,l)=>l.score-i.score||i.relativePath.localeCompare(l.relativePath)),o=e.filter(i=>i.score>=1100);if(o.length>0)return r.allowMultiple?o:[o[0]];let c=e.filter(i=>i.score>=800);return c.length>0?r.allowMultiple?c:[c[0]]:r.allowMultiple?e:e.slice(0,1)}function x(t,n){let r=b(t),s=m(r),a=m(n),e=0;return r===n&&(e+=1200),r.endsWith(`/${n}`)&&(e+=1100),s===a&&(e+=900),r.startsWith(`${n}/`)&&(e+=850),r.includes(n)&&(e+=250),e}function b(t){return t.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}import{readdirSync as V}from"fs";import{execFileSync as O}from"child_process";import{extname as h,join as w}from"path";var A=[".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".vue",".rs",".py",".pyi",".java",".kt",".kts",".scala",".sc",".clj",".cljs",".cljc",".rb",".c",".h",".cc",".cpp",".cxx",".hpp",".hh",".hxx",".cs",".vb",".php",".dart"],te=[".vue"],E=[".tsx",".jsx"],D=[".vue"],R=[...E,...D],N=new Set(E),L=new Set(D),v=new Set(A.map(t=>t.toLowerCase())),K=[...v].sort().join(","),C=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs","out","coverage",".codebaseiq-cache","__pycache__",".venv","venv",".idea",".vscode"]);function T(t,n={}){let r=n.includeIndexed??!0,s=n.includeAuxiliary??!0,a=n.extensions?.map(i=>i.toLowerCase()),e=a?new Set(a):v,o=a?[...e].sort().join(","):K,c=`${r?"1":"0"}|${s?"1":"0"}|${o}`;return F.get(t,c,()=>{let i=new Set;if(r)for(let l of g(t,{includeIgnored:!1}))e.has(h(l).toLowerCase())&&i.add(l);if(s)for(let l of j(t.config.projectRoot,e))t.isIgnored(l)||r&&i.has(l)||i.add(l);return[...i].sort()})}function ne(t,n={}){let r=!1,s=!1;for(let a of T(t,{extensions:R})){if(n.scope&&!a.includes(n.scope))continue;let e=h(a).toLowerCase();if(r||=N.has(e),s||=L.has(e),r&&s)break}return{react:r,vue:s}}var F=p("source-files",{clearGroups:[]});function j(t,n){return k(t,n)??$(t,n)}function k(t,n){try{let r=O("git",["ls-files","--cached","--others","--exclude-standard"],{cwd:t,encoding:"utf-8",timeout:1e4,killSignal:"SIGKILL",stdio:["ignore","pipe","ignore"],windowsHide:!0}),s=new Set;for(let a of r.split(`
|
|
11
|
-
`)){let e=a.trim();e&&(M(e)||n.has(h(e).toLowerCase())&&s.add(e))}return s}catch{return null}}function M(t){return t.split("/").some(n=>C.has(n))}function $(t,n){let r=new Set,s=a=>{let e=a?w(t,a):t,o;try{o=V(e,{withFileTypes:!0})}catch{return}for(let c of o)if(!C.has(c.name)){if(c.isDirectory()){s(a?`${a}/${c.name}`:c.name);continue}n.has(h(c.name).toLowerCase())&&r.add(a?`${a}/${c.name}`:c.name)}};return s(""),r}export{p as a,G as b,X as c,y as d,g as e,B as f,te as g,C as h,T as i,ne as j};
|
|
12
|
-
//# sourceMappingURL=chunk-3IER7Q6H.js.map
|