codebaseiq 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +89 -0
- package/README.md +1 -1
- package/dist/augment-vue-worker.js +1 -1
- package/dist/{chunk-ZMI2JSX2.js → chunk-23C5AD3B.js} +2 -2
- package/dist/chunk-2E6OUPCF.js +2 -0
- package/dist/chunk-2EDX3JT5.js +3 -0
- package/dist/chunk-2I2UHZET.js +2 -0
- package/dist/{chunk-T3DGWPXM.js → chunk-2OMXFE64.js} +2 -2
- package/dist/chunk-2PRONPAS.js +3 -0
- package/dist/{chunk-GW6Z3WGY.js → chunk-356EZBIP.js} +2 -2
- package/dist/{chunk-UDS562V4.js → chunk-36JC5BG2.js} +2 -2
- package/dist/chunk-3RR2K7EZ.js +20 -0
- package/dist/{chunk-JE3WZ6II.js → chunk-3RSBGWGL.js} +2 -2
- package/dist/{chunk-VE5AVNMP.js → chunk-3VJ3OCRE.js} +2 -2
- package/dist/{chunk-FDGD5AB5.js → chunk-4LK5OIPW.js} +2 -2
- package/dist/chunk-5DSL3NT2.js +17 -0
- package/dist/chunk-5FWR5HLG.js +90 -0
- package/dist/chunk-5IC2WZAL.js +22 -0
- package/dist/{chunk-MVB3DAEY.js → chunk-5IZRKWTZ.js} +2 -2
- package/dist/{chunk-Q65CQ4XL.js → chunk-5LL4KEHO.js} +2 -2
- package/dist/chunk-5T44HG5Y.js +88 -0
- package/dist/{chunk-TRRC4ZJ7.js → chunk-5ZI2PPI7.js} +2 -2
- package/dist/{chunk-7XAN6GKB.js → chunk-67VJAYVR.js} +2 -2
- package/dist/{chunk-MOVBWNIP.js → chunk-6BF3VYEF.js} +2 -2
- package/dist/chunk-6JMAVFL4.js +3 -0
- package/dist/chunk-6O3KXIDL.js +2 -0
- package/dist/{chunk-JOIRNPPY.js → chunk-6VREELBC.js} +2 -2
- package/dist/chunk-6WAPPQ5F.js +82 -0
- package/dist/{chunk-FW53T7EB.js → chunk-75KJGYX7.js} +2 -2
- package/dist/chunk-7GAK2F3H.js +77 -0
- package/dist/{chunk-UBGWN7I4.js → chunk-7JELP5YE.js} +2 -2
- package/dist/chunk-7UCDGXRW.js +8 -0
- package/dist/{chunk-L57ZKWVG.js → chunk-AEXQYQD7.js} +2 -2
- package/dist/chunk-AQI4N64O.js +22 -0
- package/dist/{chunk-ICFDQHAM.js → chunk-AURCQHSG.js} +2 -2
- package/dist/{chunk-I2T2LLK2.js → chunk-BBP7HVBJ.js} +2 -2
- package/dist/{chunk-OFBE4NGP.js → chunk-BFBIMTCJ.js} +2 -2
- package/dist/{chunk-JEJLSICM.js → chunk-BGGB5N53.js} +2 -2
- package/dist/{chunk-TIIC3ZE7.js → chunk-BRQL7AFJ.js} +2 -2
- package/dist/{chunk-YSNONTJ2.js → chunk-BWL3PMPT.js} +2 -2
- package/dist/chunk-C6WKPKCF.js +127 -0
- package/dist/{chunk-YESXMKX3.js → chunk-C7OUW52M.js} +2 -2
- package/dist/chunk-C7QWUBR2.js +545 -0
- package/dist/{chunk-4WKDMDEW.js → chunk-CCIYWXX6.js} +2 -2
- package/dist/{chunk-FAJQ7LWY.js → chunk-CIYA2KZN.js} +2 -2
- package/dist/{chunk-VEXUL62T.js → chunk-CR3OG6SQ.js} +2 -2
- package/dist/{chunk-JSOYNVWH.js → chunk-CVHOQONG.js} +2 -2
- package/dist/{chunk-LU3BMVH2.js → chunk-CW6AXOLR.js} +2 -2
- package/dist/{chunk-TXXOEMZJ.js → chunk-D53LWANR.js} +2 -2
- package/dist/{chunk-DO6WQD2T.js → chunk-D62CTZX6.js} +2 -2
- package/dist/{chunk-N3IQCBCF.js → chunk-D7AZAOZX.js} +2 -2
- package/dist/{chunk-RDBI2RXU.js → chunk-D7DOB27N.js} +7 -7
- package/dist/chunk-DAKIGMIK.js +21 -0
- package/dist/chunk-DDN2F6GB.js +2 -0
- package/dist/chunk-DUKHVPU5.js +4 -0
- package/dist/chunk-DVWO7RBC.js +2 -0
- package/dist/{chunk-HKQUXIFO.js → chunk-E52K4L2W.js} +2 -2
- package/dist/chunk-EIBGSU2R.js +2 -0
- package/dist/chunk-EN4AHLL3.js +3 -0
- package/dist/chunk-EQNMD62X.js +51 -0
- package/dist/{chunk-ENCCHKM6.js → chunk-EXZ7VLRY.js} +4 -4
- package/dist/{chunk-NEDP5RFQ.js → chunk-F3QSL4W2.js} +2 -2
- package/dist/{chunk-O6QTXQPJ.js → chunk-F74LZWCE.js} +2 -2
- package/dist/{chunk-BH5F2Q4O.js → chunk-FEIZXBLH.js} +2 -2
- package/dist/chunk-FH5WG4LE.js +2 -0
- package/dist/{chunk-BVAJLC5A.js → chunk-FOZ74V56.js} +2 -2
- package/dist/{chunk-L4NRUAGJ.js → chunk-FQTIFWLR.js} +2 -2
- package/dist/chunk-FTTV7IRX.js +355 -0
- package/dist/chunk-FWQGH2N2.js +2 -0
- package/dist/{chunk-CAUCPUOF.js → chunk-GDHWOA57.js} +2 -2
- package/dist/{chunk-6MUIJMVL.js → chunk-GIDCP7KV.js} +2 -2
- package/dist/{chunk-ZV3JV5G5.js → chunk-GL6UTNUB.js} +2 -2
- package/dist/chunk-GP7C5VAE.js +2 -0
- package/dist/{chunk-FQKZWM4L.js → chunk-GQLDYCWS.js} +5 -5
- package/dist/chunk-GQXXOS55.js +2 -0
- package/dist/{chunk-H3LGFZVK.js → chunk-GUFPEFBG.js} +2 -2
- package/dist/{chunk-NNOKTMZT.js → chunk-GV2CEZCW.js} +2 -2
- package/dist/{chunk-FETNQCFO.js → chunk-GVAF222T.js} +2 -2
- package/dist/chunk-GWYZVVKY.js +21 -0
- package/dist/{chunk-7FND7D7N.js → chunk-HENP2O4A.js} +2 -2
- package/dist/{chunk-LZYFLFEH.js → chunk-HINZQKSY.js} +2 -2
- package/dist/{chunk-RR7SX44N.js → chunk-HQA7EBSK.js} +2 -2
- package/dist/{chunk-XMQ23E27.js → chunk-HVFB3PME.js} +2 -2
- package/dist/chunk-I22IZYDI.js +2 -0
- package/dist/chunk-ICUL7XRT.js +21 -0
- package/dist/{chunk-CQP3THUZ.js → chunk-IHSLIIL3.js} +2 -2
- package/dist/{chunk-34WBMAYK.js → chunk-ITSJMNUD.js} +2 -2
- package/dist/{chunk-PX4RYAAK.js → chunk-IZDPGOZR.js} +2 -2
- package/dist/chunk-J3GLP7Q5.js +3 -0
- package/dist/{chunk-CVYSU6BX.js → chunk-J7AMBVWF.js} +2 -2
- package/dist/{chunk-Y6KHROC3.js → chunk-JCMFBF4Z.js} +2 -2
- package/dist/chunk-JFIA2JI3.js +3 -0
- package/dist/chunk-JLZLLLW5.js +3 -0
- package/dist/{chunk-5PUWMSDU.js → chunk-JSNTHRLQ.js} +2 -2
- package/dist/{chunk-C6SBF2WH.js → chunk-JX6ZWDOS.js} +2 -2
- package/dist/{chunk-4XTAUQFD.js → chunk-JYI7CV25.js} +2 -2
- package/dist/chunk-K7JLSGCJ.js +8 -0
- package/dist/{chunk-XWUOUWYI.js → chunk-KPZGTB2O.js} +2 -2
- package/dist/{chunk-VXYS3FZD.js → chunk-LKUTSP4G.js} +2 -2
- package/dist/{chunk-GTXSJDCO.js → chunk-LMTSB3TB.js} +2 -2
- package/dist/chunk-LONKINMJ.js +543 -0
- package/dist/{chunk-WMPRTGH2.js → chunk-LQHYYIOB.js} +2 -2
- package/dist/{chunk-VUIYB2V3.js → chunk-LZSQ6X7E.js} +2 -2
- package/dist/{chunk-ST7V3SKN.js → chunk-M2Y6PCFE.js} +2 -2
- package/dist/chunk-MEUHIDI3.js +7 -0
- package/dist/{chunk-OZYRSMSH.js → chunk-MHWMEZDA.js} +2 -2
- package/dist/{chunk-RKEJ6VTF.js → chunk-MQW6SJ4P.js} +2 -2
- package/dist/{chunk-J77SU6VA.js → chunk-MSI3K7PJ.js} +2 -2
- package/dist/chunk-MVRGB4KJ.js +278 -0
- package/dist/{chunk-DQMDCD24.js → chunk-MZNMASFM.js} +2 -2
- package/dist/{chunk-ID63777H.js → chunk-NBCQZSGR.js} +2 -2
- package/dist/chunk-NBZKSTXP.js +2 -0
- package/dist/{chunk-SZD2KF7Q.js → chunk-NCJILOAK.js} +2 -2
- package/dist/{chunk-C7QOQX32.js → chunk-NDKOVQFG.js} +2 -2
- package/dist/{chunk-UNBY47BC.js → chunk-NEWHKGVD.js} +2 -2
- package/dist/{chunk-PYAB5SM6.js → chunk-O2M3VNDY.js} +2 -2
- package/dist/chunk-OFGOOL6U.js +3 -0
- package/dist/{chunk-SWHMHUKF.js → chunk-OQUCBKOI.js} +2 -2
- package/dist/{chunk-7MGU3HPH.js → chunk-P4NVCOM7.js} +2 -2
- package/dist/{chunk-ANFVSJWQ.js → chunk-PFC44E6D.js} +2 -2
- package/dist/{chunk-EZNMUY67.js → chunk-PHNCEUXX.js} +2 -2
- package/dist/{chunk-4FC325IF.js → chunk-PTQPPPG2.js} +2 -2
- package/dist/chunk-PUVNH4PO.js +3 -0
- package/dist/chunk-Q23IMHXS.js +343 -0
- package/dist/chunk-Q3ZCQY2Y.js +3 -0
- package/dist/{chunk-KMITESMT.js → chunk-Q4XEU3UH.js} +2 -2
- package/dist/{chunk-QKPLA6IC.js → chunk-QEOWONKY.js} +2 -2
- package/dist/{chunk-BJ6SQAEN.js → chunk-QMOZZ2VX.js} +2 -2
- package/dist/chunk-RCIGX23V.js +60 -0
- package/dist/{chunk-IOP6FWIM.js → chunk-RIYJ4L33.js} +2 -2
- package/dist/chunk-RJVAPMHF.js +14 -0
- package/dist/chunk-SB7NASHU.js +2 -0
- package/dist/{chunk-UZGZB3VB.js → chunk-SGMNWYTH.js} +2 -2
- package/dist/chunk-SMDIEDM4.js +27 -0
- package/dist/chunk-SV2LEFVM.js +2 -0
- package/dist/chunk-SX72EVMY.js +3 -0
- package/dist/chunk-T5X7DK6C.js +3 -0
- package/dist/{chunk-6NW7MU72.js → chunk-T6MQNNAC.js} +2 -2
- package/dist/chunk-T75DS2E6.js +21 -0
- package/dist/{chunk-HRWGYWRJ.js → chunk-TEANKHUU.js} +2 -2
- package/dist/chunk-TJBOJUVN.js +3 -0
- package/dist/{chunk-XLQ3GLWZ.js → chunk-TJWVT4DO.js} +2 -2
- package/dist/{chunk-7NVGT435.js → chunk-TNJGTQWO.js} +2 -2
- package/dist/{chunk-NE6IU5ZD.js → chunk-TOTWJZIX.js} +2 -2
- package/dist/{chunk-PBI2LFKH.js → chunk-TPO7XC5Z.js} +2 -2
- package/dist/{chunk-HPJRBHVT.js → chunk-U33PMPNW.js} +2 -2
- package/dist/{chunk-QHRNXP3C.js → chunk-U7NUXDQO.js} +2 -2
- package/dist/chunk-UC2FD2PS.js +4 -0
- package/dist/{chunk-PIOMTC27.js → chunk-UQE4XFSA.js} +2 -2
- package/dist/chunk-UQYQBLJX.js +5 -0
- package/dist/{chunk-KWVHSKHK.js → chunk-USOAJHY7.js} +2 -2
- package/dist/{chunk-GCHRX4YW.js → chunk-UW6KD57C.js} +2 -2
- package/dist/{chunk-PTAWHLVJ.js → chunk-VGWZ4MOY.js} +2 -2
- package/dist/{chunk-XME3HPXZ.js → chunk-VWYGCMV5.js} +2 -2
- package/dist/{chunk-AKB7V7TV.js → chunk-W7YLRXZE.js} +2 -2
- package/dist/{chunk-SYDJMPES.js → chunk-WK2IQJPK.js} +2 -2
- package/dist/{chunk-RBAS5ZHI.js → chunk-WWCV4E6J.js} +2 -2
- package/dist/{chunk-OL6KJP3N.js → chunk-XMJ53WG4.js} +2 -2
- package/dist/chunk-XN3EKMLI.js +4 -0
- package/dist/chunk-XQAVQVIL.js +3 -0
- package/dist/{chunk-IJ4HMYBE.js → chunk-XQPPURLQ.js} +2 -2
- package/dist/{chunk-OVTS4DKB.js → chunk-YHPG3S2U.js} +2 -2
- package/dist/{chunk-WOQBZPIF.js → chunk-YRKP7PM7.js} +2 -2
- package/dist/chunk-YT4DVWUV.js +11 -0
- package/dist/chunk-YTJHCGYB.js +61 -0
- package/dist/chunk-Z35GOVEH.js +2 -0
- package/dist/{chunk-OLF4MA5W.js → chunk-Z6RL7XOE.js} +4 -4
- package/dist/{chunk-UP3BUZR5.js → chunk-ZAFGY22Q.js} +2 -2
- package/dist/{chunk-CO5R3UNA.js → chunk-ZB4C5TTR.js} +2 -2
- package/dist/{chunk-ZZXSWSN6.js → chunk-ZNH33XIB.js} +2 -2
- package/dist/{chunk-EMNIHCRB.js → chunk-ZQ62NNKN.js} +2 -2
- package/dist/cli-context-FJL2JHOE.js +3 -0
- package/dist/cli-context-PQNWHMCQ.js +2 -0
- package/dist/cli-program-UO7PZD6V.js +7 -0
- package/dist/cli.js +1 -1
- package/dist/{code-DlqpBDd0.d.ts → code-DfX3xeWy.d.ts} +1 -1
- package/dist/code-viewer-KIXEYQNJ.js +12 -0
- package/dist/code-viewer-VHLBLIUM.js +11 -0
- package/dist/command-descriptors-F5P2V3NW.js +335 -0
- package/dist/command-descriptors-YCLATF5I.js +337 -0
- package/dist/{config-types-BNoC96J3.d.ts → config-types-D6X5S68_.d.ts} +50 -0
- package/dist/{db-D7sauVFH.d.ts → db-BoG_PWYH.d.ts} +2 -2
- package/dist/direct-navigation-4XJTXIDT.js +2 -0
- package/dist/direct-navigation-J5MVYYAD.js +3 -0
- package/dist/{graph-evidence-BIFqyisO.d.ts → graph-evidence-D1jx1Cql.d.ts} +1 -1
- package/dist/{health-DJaZXg8I.d.ts → health-DkYBS5BI.d.ts} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/invocation-command-descriptors-RWV4VAI4.js +2 -0
- package/dist/invocation-command-descriptors-U76PN7IY.js +3 -0
- package/dist/{scip-cli-B7N3haxa.d.ts → maintenance-types-CdL5eQii.d.ts} +2 -21
- package/dist/output-continuation-command-BL25S26S.js +3 -0
- package/dist/output-continuation-command-BTETTXEC.js +2 -0
- package/dist/postinstall.js +1 -1
- package/dist/project-reindex-CRJU3IFG.js +2 -0
- package/dist/project-reindex-TQFCOA2O.js +3 -0
- package/dist/queries/affected.d.ts +2 -2
- package/dist/queries/affected.js +1 -1
- package/dist/queries/anchors.d.ts +2 -2
- package/dist/queries/anchors.js +1 -1
- package/dist/queries/architecture.d.ts +2 -2
- package/dist/queries/architecture.js +1 -1
- package/dist/queries/bottlenecks.d.ts +2 -2
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +2 -2
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +2 -2
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +2 -2
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +2 -2
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +2 -2
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.d.ts +3 -3
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +2 -2
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +2 -2
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/context.d.ts +2 -2
- package/dist/queries/context.js +1 -1
- package/dist/queries/convergence.d.ts +2 -2
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +2 -2
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +2 -2
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +2 -2
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +2 -2
- package/dist/queries/dead.js +1 -1
- package/dist/queries/decorative-checkers.d.ts +2 -2
- package/dist/queries/decorative-checkers.js +1 -1
- package/dist/queries/deep-chains.d.ts +2 -2
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/dependence-slice.d.ts +3 -3
- package/dist/queries/dependence-slice.js +1 -1
- package/dist/queries/dependency-depth.d.ts +2 -2
- package/dist/queries/dependency-depth.js +1 -1
- package/dist/queries/deps.d.ts +2 -2
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.d.ts +2 -2
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +2 -2
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +2 -2
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.d.ts +2 -2
- package/dist/queries/duplicate-bodies.js +1 -1
- package/dist/queries/entry-map.d.ts +2 -2
- package/dist/queries/entry-map.js +1 -1
- package/dist/queries/evidence.d.ts +3 -3
- package/dist/queries/evidence.js +1 -1
- package/dist/queries/extract-candidates.d.ts +2 -2
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +2 -2
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +2 -2
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +3 -3
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +2 -2
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +2 -2
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +2 -2
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +2 -2
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +5 -5
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +2 -2
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.d.ts +2 -2
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.d.ts +2 -2
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +2 -2
- package/dist/queries/methods.js +1 -1
- package/dist/queries/not-implemented.d.ts +2 -2
- package/dist/queries/not-implemented.js +1 -1
- package/dist/queries/outline.d.ts +2 -2
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +2 -2
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +2 -2
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +2 -2
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +2 -2
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +2 -2
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.d.ts +2 -2
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +2 -2
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/reference-neighborhood.d.ts +2 -2
- package/dist/queries/reference-neighborhood.js +1 -1
- package/dist/queries/reference-reachability.d.ts +2 -2
- package/dist/queries/reference-reachability.js +1 -1
- package/dist/queries/refs.d.ts +2 -2
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +2 -2
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.d.ts +2 -2
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +2 -2
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +2 -2
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +2 -2
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +2 -2
- package/dist/queries/slice.js +1 -1
- package/dist/queries/source-inspection.d.ts +4 -4
- package/dist/queries/source-inspection.js +1 -1
- package/dist/queries/source-search.d.ts +2 -2
- package/dist/queries/source-search.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +2 -2
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +2 -2
- package/dist/queries/surface.d.ts +2 -2
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +2 -2
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system-map.d.ts +2 -2
- package/dist/queries/system-map.js +1 -1
- package/dist/queries/system.d.ts +2 -2
- package/dist/queries/system.js +1 -1
- package/dist/queries/test-quality.d.ts +2 -2
- package/dist/queries/test-quality.js +1 -1
- package/dist/queries/trace.d.ts +2 -2
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.d.ts +2 -2
- package/dist/queries/twin-ab.js +1 -1
- package/dist/queries/twin-drift.d.ts +2 -2
- package/dist/queries/twin-drift.js +1 -1
- package/dist/queries/unused-imports.d.ts +2 -2
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.d.ts +2 -2
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/value-flow.d.ts +3 -3
- package/dist/queries/value-flow.js +1 -1
- package/dist/queries/vue-component-duplicates.d.ts +2 -2
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.d.ts +2 -2
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.d.ts +2 -2
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +2 -2
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +2 -2
- package/dist/reindex.d.ts +3 -5
- package/dist/reindex.js +72 -33
- package/dist/runtime.d.ts +23 -4
- package/dist/runtime.js +3 -3
- package/dist/rust-semantic-session-server.js +1 -1
- package/dist/rust-semantic-session-worker.js +1 -1
- package/dist/rust-semantic-worker.js +1 -1
- package/dist/sentinel-ensure-command-OSWGCFFL.js +3 -0
- package/dist/sentinel-ensure-command-SPW7XQLB.js +2 -0
- package/dist/sentinel-hook.js +39 -0
- package/dist/sentinel-worker.js +16 -0
- package/dist/typescript-mailbox-worker.js +1 -1
- package/dist/watch-server.js +6 -6
- package/docs/COMMAND_REFERENCE.md +5 -3
- package/docs/INDEX_GENERATIONS.md +2 -2
- package/docs/NPM_RELEASE.md +323 -0
- package/docs/schemas/npm-release-state.schema.json +4 -13
- package/docs/schemas/project-config.schema.json +159 -0
- package/package.json +10 -14
- package/skills/codebaseiq/SKILL.md +1 -1
- package/skills/concrete-plan/SKILL.md +1 -1
- package/ui/view/api.js +450 -0
- package/ui/view/app.js +394 -0
- package/ui/view/builder.js +323 -0
- package/ui/view/file-panel.js +170 -0
- package/ui/view/focus.js +379 -0
- package/ui/view/index.html +54 -0
- package/ui/view/map.js +424 -0
- package/ui/view/styles.css +1125 -0
- package/dist/chunk-2Q2LW5JW.js +0 -14
- package/dist/chunk-2X7V4HS4.js +0 -88
- package/dist/chunk-3IER7Q6H.js +0 -12
- package/dist/chunk-3JSXXYTZ.js +0 -345
- package/dist/chunk-476NR5B7.js +0 -2
- package/dist/chunk-5VKBFZZU.js +0 -3
- package/dist/chunk-6BQ3DSPK.js +0 -2
- package/dist/chunk-6CS3UQTN.js +0 -3
- package/dist/chunk-6OAHRI2D.js +0 -6
- package/dist/chunk-ADTBPVUZ.js +0 -21
- package/dist/chunk-BFFZDZQV.js +0 -2
- package/dist/chunk-BMYOV5GP.js +0 -77
- package/dist/chunk-C74PPYLA.js +0 -3
- package/dist/chunk-CWONGW6P.js +0 -3
- package/dist/chunk-DDZ7VHWV.js +0 -20
- package/dist/chunk-DR2LURYU.js +0 -3
- package/dist/chunk-ECQBG7PW.js +0 -564
- package/dist/chunk-EF2R3WNQ.js +0 -2
- package/dist/chunk-FM5BPL4V.js +0 -60
- package/dist/chunk-G6XFR4ZL.js +0 -4
- package/dist/chunk-GTIYTDRE.js +0 -562
- package/dist/chunk-HOA5YGOH.js +0 -3
- package/dist/chunk-KUW32IRO.js +0 -2
- package/dist/chunk-LTA3BRZX.js +0 -2
- package/dist/chunk-NAUD7LCA.js +0 -2
- package/dist/chunk-NCZUNH3E.js +0 -109
- package/dist/chunk-NNJ2KZZG.js +0 -4
- package/dist/chunk-NNO6A2PO.js +0 -2
- package/dist/chunk-OGTFJ3XD.js +0 -2
- package/dist/chunk-Q5ELPRKQ.js +0 -2
- package/dist/chunk-Q72QSKXC.js +0 -308
- package/dist/chunk-QCN62RTF.js +0 -3
- package/dist/chunk-QW7EP6WI.js +0 -21
- package/dist/chunk-RU65DDUP.js +0 -215
- package/dist/chunk-SELM5MER.js +0 -2
- package/dist/chunk-SMRBZ6EC.js +0 -2
- package/dist/chunk-SNNWPCN7.js +0 -4
- package/dist/chunk-TFZB6XTM.js +0 -239
- package/dist/chunk-UCD3H3UZ.js +0 -5
- package/dist/chunk-UXM43C7T.js +0 -3
- package/dist/chunk-VFY6Y2H6.js +0 -61
- package/dist/chunk-WE5RZHZ7.js +0 -5
- package/dist/chunk-YMGZZEW4.js +0 -2
- package/dist/chunk-YVCIMIOC.js +0 -12
- package/dist/chunk-Z54RD7VL.js +0 -3
- package/dist/chunk-ZKX2FRS6.js +0 -15
- package/dist/cli-context-3SNLDYBM.js +0 -3
- package/dist/cli-context-T3B7W6GG.js +0 -2
- package/dist/cli-program-YNOXO72B.js +0 -7
- package/dist/command-descriptors-6AOUKWW7.js +0 -346
- package/dist/command-descriptors-ZFKJSRUP.js +0 -344
- package/dist/direct-navigation-DP4LVMRX.js +0 -3
- package/dist/direct-navigation-FLUS3BT6.js +0 -2
- package/dist/invocation-command-descriptors-QT2JMY5J.js +0 -3
- package/dist/invocation-command-descriptors-YN4QJEAX.js +0 -2
- package/dist/output-continuation-command-2V2SL4TD.js +0 -2
- package/dist/output-continuation-command-65J5IP3O.js +0 -3
- package/dist/project-reindex-5JOKXAXT.js +0 -2
- package/dist/project-reindex-UQBIKO4M.js +0 -3
- package/docs/WINDOWS_SIDECAR_RELEASE.md +0 -424
- package/docs/schemas/windows-sidecar-provenance.schema.json +0 -137
- package/scripts/build-codebaseiq-windows.mjs +0 -197
- package/scripts/codebaseiq-windows-provenance.mjs +0 -364
- package/scripts/verify-codebaseiq-windows.mjs +0 -29
package/dist/chunk-QCN62RTF.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{d as R,e as k}from"./chunk-DO6WQD2T.js";import{h as f,i as L,v as E,w as v}from"./chunk-SNNWPCN7.js";import{connect as D}from"net";import{performance as S}from"perf_hooks";import{createHash as b}from"crypto";import{tmpdir as V,userInfo as j}from"os";import{join as h}from"path";var c=1,Q=1*1024*1024,_=64*1024*1024,y=12e4,x=["NO_COLOR","FORCE_COLOR","CLICOLOR","CLICOLOR_FORCE","TERM","CODEBASEIQ_DEBUG"],P=1500;function O(t){let e=T(),r=b("sha256").update(`${e}\0${t}`).digest("hex");return process.platform==="win32"?`\\\\.\\pipe\\codebaseiq-lane-${r.slice(0,32)}`:h(Y(),`lane-${r.slice(0,24)}.sock`)}function Y(){let t=T(),e=b("sha256").update(t).digest("hex").slice(0,16);return h(V(),`codebaseiq-${e}`)}function T(){try{return j().username}catch{return`uid-${typeof process.getuid=="function"?process.getuid():"unknown"}`}}function A(t,e){let r=Buffer.from(JSON.stringify(t),"utf8");if(r.byteLength>e)throw new Error(`query-lane frame of ${r.byteLength} bytes exceeds the ${e}-byte limit`);let n=Buffer.allocUnsafe(4+r.byteLength);return n.writeUInt32LE(r.byteLength,0),r.copy(n,4),n}function w(t,e,r){let n=Buffer.alloc(0),u=!1,i=s=>{u||(u=!0,r(new Error(s)))};return{push(s){if(!u)for(n=n.byteLength===0?s:Buffer.concat([n,s]);n.byteLength>=4;){let a=n.readUInt32LE(0);if(a>t){i(`query-lane frame of ${a} bytes exceeds the ${t}-byte limit`);return}if(n.byteLength<4+a)return;let l=n.subarray(4,4+a);n=n.subarray(4+a);let o;try{o=JSON.parse(l.toString("utf8"))}catch{i("query-lane frame carried invalid JSON");return}if(e(o),u)return}}}}function N(t){if(!t||typeof t!="object")return null;let e=t;if(e.protocolVersion!==c)return null;if(e.ok===!1)return e.code!=="unsupported"&&e.code!=="invalid-request"&&e.code!=="wrong-project"&&e.code!=="busy"&&e.code!=="stale-index"&&e.code!=="ineligible-command"&&e.code!=="execution-error"||typeof e.message!="string"?null:{ok:!1,protocolVersion:c,code:e.code,message:e.message};if(e.ok!==!0)return null;if(e.kind==="accepted"){let n=e.serverPid;return typeof n!="number"||!Number.isInteger(n)||n<=0?null:{ok:!0,kind:"accepted",protocolVersion:c,serverPid:n}}if(e.kind==="executed"){let n=e;return typeof n.serverPid!="number"||!Number.isInteger(n.serverPid)||n.serverPid<=0||typeof n.exitCode!="number"||!Number.isInteger(n.exitCode)||typeof n.stdout!="string"||typeof n.stderr!="string"||typeof n.generation!="string"||!/^[a-f0-9]{64}$/.test(n.generation)||typeof n.durationMs!="number"||!Number.isFinite(n.durationMs)?null:{ok:!0,kind:"executed",protocolVersion:c,serverPid:n.serverPid,exitCode:n.exitCode,stdout:n.stdout,stderr:n.stderr,generation:n.generation,durationMs:n.durationMs}}if(e.kind!=="pong"||typeof e.serverPid!="number"||!Number.isInteger(e.serverPid)||e.serverPid<=0||typeof e.cliVersion!="string"||typeof e.projectRoot!="string"||e.indexGeneration!==void 0&&!/^[a-f0-9]{64}$/.test(e.indexGeneration))return null;let r;if(e.processIdentity!==void 0){let n=E(e.processIdentity);if(!n||n.pid!==e.serverPid)return null;r=n}return{ok:!0,kind:"pong",protocolVersion:c,serverPid:e.serverPid,...r?{processIdentity:r}:{},cliVersion:e.cliVersion,projectRoot:e.projectRoot,...e.indexGeneration!==void 0?{indexGeneration:e.indexGeneration}:{}}}var I=250,C=2e3,q="CODEBASEIQ_NO_DAEMON",$="CODEBASEIQ_DAEMON";async function se(t,e={}){let r=await M(t,{protocolVersion:c,kind:"ping",projectRoot:f(t.projectRoot)},e);if(r.kind!=="ok")return r;let n=r.response;return n.ok!==!0?{kind:"incompatible",reason:`query lane refused ping: ${n.code}: ${n.message}`}:n.kind!=="pong"?{kind:"incompatible",reason:"query lane answered ping with a non-pong response"}:n.serverPid!==r.state.pid?{kind:"incompatible",reason:"query lane responder is not the advertised watch service process"}:n.processIdentity&&r.state.processIdentity&&!v(n.processIdentity,r.state.processIdentity)?{kind:"incompatible",reason:"query lane responder identity differs from the advertised service"}:{kind:"ok",pong:n,roundTripMs:r.roundTripMs,state:r.state}}async function ie(t){let e=t[0];if(!e||e.startsWith("-"))return{served:!1,reason:"no eligible command was invoked"};if(process.env.CODEBASEIQ_INDEX_DB)return{served:!1,reason:"an explicit index database is pinned by the environment"};if(process.env.CODEBASEIQ_SESSION)return{served:!1,reason:"session-ledger evidence runs in-process"};let r;try{let{resolveProjectRoot:d,resolveCliProjectContext:p,sharedCachePreparationEligible:U}=await import("./cli-context-3SNLDYBM.js");if(!U(e))return{served:!1,reason:`command ${e} always executes in-process`};let m=d(),g=p(m);r={projectRoot:m,cacheDir:g.paths.cacheDir,enabled:process.env[$]==="1"||g.config.daemon?.enabled===!0}}catch(d){return{served:!1,reason:`project resolution failed: ${d instanceof Error?d.message:d}`}}if(!r.enabled)return{served:!1,reason:"resident execution is not enabled for this project"};let{normalizeLegacyEvidenceInvocation:n}=await import("./invocation-command-descriptors-QT2JMY5J.js"),u=["node","codebaseiq",...t];n(u);let i=u.slice(2),s={};for(let d of x){let p=process.env[d];p!==void 0&&(s[d]=p)}let a={protocolVersion:c,kind:"execute",projectRoot:f(r.projectRoot),argv:i,cwd:process.cwd(),envAllowlist:s,tty:{isTTY:process.stdout.isTTY===!0,...typeof process.stdout.columns=="number"?{columns:process.stdout.columns}:{}},deadlineMs:y,clientInvocation:{execPath:process.execPath,...process.argv[1]!==void 0?{scriptPath:process.argv[1]}:{}}},l=await M(r,a,{acceptTimeoutMs:P,responseTimeoutMs:y+5e3});if(l.kind!=="ok")return{served:!1,reason:l.reason};let o=l.response;return o.ok!==!0||o.kind!=="executed"?{served:!1,reason:o.ok===!1?`${o.code}: ${o.message}`:"the lane answered with a non-execution response"}:o.serverPid!==l.state.pid?{served:!1,reason:"the executing process is not the advertised watch service"}:(o.stdout.length>0&&process.stdout.write(o.stdout),o.stderr.length>0&&process.stderr.write(o.stderr),process.exitCode=o.exitCode,{served:!0,exitCode:o.exitCode})}async function M(t,e,r={}){if(process.env[q]==="1")return{kind:"unavailable",reason:`${q}=1 disables the query lane`};let n=B(t);if("reason"in n)return n;let u=r.socketPathOverride??O(t.cacheDir),i=S.now(),s=await W(u,e,r);if("reason"in s)return s;let a=N(s.value);return a?{kind:"ok",response:a,roundTripMs:S.now()-i,state:n.state}:{kind:"incompatible",reason:"query lane returned a response this client cannot validate"}}function F(t){return!!t&&typeof t=="object"&&t.kind==="accepted"&&t.ok===!0}function B(t){let e=k(R(t.cacheDir).statePath);return e?e.projectRoot!==f(t.projectRoot)?{kind:"unavailable",reason:"the published watch service serves a different project root"}:e.queryLane===void 0?{kind:"unavailable",reason:"the running watch service does not advertise a query lane"}:e.queryLane.protocolVersion!==c?{kind:"incompatible",reason:`query lane protocol ${e.queryLane.protocolVersion} does not match client protocol ${c}`}:L(e.pid)?{state:e}:{kind:"unavailable",reason:"the advertised watch service process is not alive"}:{kind:"unavailable",reason:"no watch service state is published for this cache"}}function W(t,e,r){return new Promise(n=>{let u=!1,i=o=>{u||(u=!0,clearTimeout(a),s.destroy(),n(o))},s=D({path:t,timeout:r.connectTimeoutMs??I}),a=setTimeout(()=>i({kind:"unavailable",reason:"query lane response timed out"}),(r.connectTimeoutMs??I)+(r.acceptTimeoutMs??r.responseTimeoutMs??C)),l=w(_,o=>{if(F(o)){clearTimeout(a),a=setTimeout(()=>i({kind:"unavailable",reason:"query lane response timed out after acknowledgement"}),r.responseTimeoutMs??C);return}i({value:o})},o=>i({kind:"unavailable",reason:`query lane response was malformed: ${o.message}`}));s.on("timeout",()=>i({kind:"unavailable",reason:"query lane connection timed out"})),s.on("error",o=>i({kind:"unavailable",reason:`query lane connection failed: ${o.message}`})),s.on("close",()=>i({kind:"unavailable",reason:"query lane closed before responding"})),s.on("data",o=>l.push(o)),s.on("connect",()=>{s.setTimeout(0);try{s.write(A(e,Q))}catch(o){i({kind:"unavailable",reason:`query lane request could not be encoded: ${o instanceof Error?o.message:String(o)}`})}})})}export{se as a,ie as b};
|
|
3
|
-
//# sourceMappingURL=chunk-QCN62RTF.js.map
|
package/dist/chunk-QW7EP6WI.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{c as Yt}from"./chunk-FM5BPL4V.js";import{a as _,b as Vt,i as I,j as ie,l as Te,o as Ce,r as F,s as G}from"./chunk-RDBI2RXU.js";import{a as $t,b as zt,c as te,d as re}from"./chunk-EF2R3WNQ.js";import{C as Qt,D as K,F as Pe,G as Ht,J as Ut,K as ze,L as Ge,M as We,P as Ve,S as oe,U as Jt,a as v,b as J,c as R,f as S,g as E,ga as Qe,h as b,ha as He,l as Bt,m as Y,q as Wt,v as Ee,w as j,x as ne}from"./chunk-WE5RZHZ7.js";var Kt=["typescript","javascript","java","scala","kotlin","rust","python","ruby","go","cpp","c","csharp","vb","dart","php","clojure"],ho=["entry-surface","generated-code","compatibility-shim","reflection-or-registration","test-fixture","intentional-twin","historical-coupling-ended","detector-counterexample"];var Ue=2,z=3;var Je=new Set(Kt);function Ae(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch(a){return{kind:"malformed",reason:`invalid JSON: ${En(a)}`}}if(!_(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!==Ue&&r!==z)return{kind:"unsupported",version:r,direction:r<Ue?"older":"future"};let n=In(t,r);if(n)return{kind:"malformed",reason:n};let i=t,o={metadata:i,capabilities:bn(i)};return r===Ue?{kind:"legacy",...o,metadata:i}:{kind:"supported",...o,metadata:i}}function Ro(e){return e.kind==="legacy"||e.kind==="supported"?e.metadata:null}function Xt(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===z?t.sqliteLayoutVersion:void 0})}function bn(e){let t=e.fingerprint!==void 0,r=_(e.fingerprint),n=e.indexedLanguages!==void 0,i=e.status==="complete",o=e.version===z?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 In(e,t){if(e.status!=="complete"&&e.status!=="partial")return"status must be complete or partial";if(e.updatedAt!==void 0&&!Vt(e.updatedAt))return"updatedAt must be a valid timestamp";for(let r of["requestedLanguages","indexedLanguages"])if(e[r]!==void 0&&!xn(e[r]))return`${r} must contain unique supported languages`;return e.skipped!==void 0&&!wn(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===z&&e.sqliteLayoutVersion!==void 0&&(!Number.isSafeInteger(e.sqliteLayoutVersion)||e.sqliteLayoutVersion<1)?"sqliteLayoutVersion must be a positive safe integer":t===z&&e.languageFingerprints!==void 0&&!Rn(e.languageFingerprints)?"languageFingerprints must map supported languages to fingerprint objects":t===z&&e.typescriptProjectShards!==void 0&&!vn(e.typescriptProjectShards)?"typescriptProjectShards must map project names to file fingerprints":null}function vo(e){return e.version===z&&e.sqliteLayoutVersion===1}function xn(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string"&&Je.has(t))?!1:new Set(e).size===e.length}function wn(e){return Array.isArray(e)&&e.every(t=>_(t)&&typeof t.language=="string"&&Je.has(t.language)&&typeof t.reason=="string")}function Rn(e){return _(e)&&Object.entries(e).every(([t,r])=>Je.has(t)&&_(r))}function vn(e){return _(e)&&Object.values(e).every(t=>_(t)&&Array.isArray(t.files)&&t.files.every(Wt))}function En(e){return e instanceof Error?e.message:String(e)}import Vn from"better-sqlite3";import{createHash as An,randomUUID as kn}from"crypto";import{existsSync as W,mkdirSync as Dn,readdirSync as Ln,rmSync as ir,statSync as or}from"fs";import{basename as On,dirname as se,join as x}from"path";import{join as Pn}from"path";function ke(e,t){return e.reason instanceof Error?e.reason:new Error(t)}function Zt(e,t){if(e?.aborted)throw ke(e,t)}var Gn=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 er(e,t={}){return T(Pn(e,"gc.lock"),t)}function T(e,t={}){let r=t.waitMs??0,n=t.pollMs??10,i=t.now??re,o=i()+r;do{let a=tr(e);if(a)return rr(a);let s=o-i();if(s<=0)return null;Tn(Math.min(n,s))}while(i()<=o);return null}async function ko(e,t={}){let r=t.waitMs??0,n=t.pollMs??10,i=t.now??re,o=i()+r;do{Zt(t.signal,"Lock acquisition was aborted.");let a=tr(e);if(a)return rr(a);let s=o-i();if(s<=0)return null;await Cn(Math.min(n,s),t.signal)}while(i()<=o);return null}function tr(e){let t=Te(e,{kind:"generic",parseLegacy:Gn});return t.kind==="acquired"?t.lock:null}function rr(e){return{release:()=>{e.release()}}}function Tn(e){let t=new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));Atomics.wait(t,0,0,e)}function Cn(e,t){return t?.aborted?Promise.reject(ke(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?ke(t,"Lock acquisition was aborted."):new Error("Lock acquisition was aborted."))};t?.addEventListener("abort",o,{once:!0})})}var V=1,Ze=1,ce=".codebaseiq-generations",De="manifest.json",ar="readers",Mn="gc.lock",_n=128,ae=new Map,sr={pid:process.pid,now:()=>new Date,randomToken:()=>kn(),isProcessAlive:ie,readProcessIdentity:te,resolveImmutableGeneration:dr};function m(e){return x(se(e),ce)}function de(e){return x(m(e),Mn)}function cr(e,t=sr){let r=T(de(e.dbPath),{waitMs:5e3});if(!r)throw new Error("SQLite generation retention is busy; retry opening the index.");let n;try{let o=C(e.dbPath);if(!o||!le(e.dbPath,o.currentGeneration))return{generation:tt(e),release(){}};let a=t.randomToken();if(!/^[A-Za-z0-9._-]+$/.test(a))throw new Error("SQLite generation reader token is unsafe.");let s=x(m(e.dbPath),ar);Dn(s,{recursive:!0});let c=x(s,`${t.pid}-${a}.json`),d=t.readProcessIdentity(t.pid);F(c,{version:1,token:a,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,ir(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 jn(e,n.identity)}function jn(e,t){let r=T(de(e.dbPath),{waitMs:5e3});if(!r)throw new Error("SQLite generation retention is busy; retry opening the index.");try{let n=C(e.dbPath);if(n?.currentGeneration!==t)throw new Error("SQLite index publication changed while opening a legacy generation.");if(W(x(se(e.dbPath),"index.lock")))throw new Error("Legacy SQLite publication is in progress; retry after the reindex lock is released.");return{generation:lr(e,n.currentGeneration),release(){}}}finally{r.release()}}function et(e,t,r=sr,n={}){let i=x(m(e),ar);if(!W(i))return{protectedGenerations:new Set,activeLeases:0,staleLeasesRemoved:0,malformedLeases:0};let o=new Set,a=0,s=0,c=0;for(let d of Ln(i,{withFileTypes:!0})){if(!d.isFile()||!d.name.endsWith(".json"))continue;let l=x(i,d.name),p;try{p=Fn(JSON.parse(b(l,"SQLite generation reader lease")))}catch{p=null}if(!p){c+=1;for(let h of t)o.add(h);continue}if(!Nn(p,r)){n.removeStale!==!1&&(ir(l,{force:!0}),s+=1);continue}a+=1,o.add(p.generationIdentity)}return{protectedGenerations:o,activeLeases:a,staleLeasesRemoved:s,malformedLeases:c}}function Fn(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e,r=t.processIdentity===void 0?null:$t(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 Nn(e,t){if(!t.isProcessAlive(e.pid))return!1;if(!e.processIdentity)return!0;let r=t.readProcessIdentity(e.pid);return r===null||zt(e.processIdentity,r)}function C(e){try{let t=JSON.parse(b(x(m(e),"state.json"),"SQLite generation state"));return Bn(t)?t:null}catch{return null}}function le(e,t){return ue(m(e),t)}function ue(e,t){try{let r=JSON.parse(b(x(e,t,De),"SQLite generation manifest"));return qn(r,t)?r:null}catch{return null}}function tt(e){let t=C(e.dbPath);if(t){let r=dr(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(W(x(se(e.dbPath),"index.lock")))throw new Error("Legacy SQLite publication is in progress; retry after the reindex lock is released.");return lr(e,t?.currentGeneration)}function zo(e){let t=C(e);if(t)return t.currentGeneration;try{let r=x(se(e),"meta.json"),n=W(r)?b(r,"reindex metadata"):void 0;return ur(e,n)}catch{return null}}function N(e){return Xt(Ae(e))??e}function dr(e,t){try{let r=x(m(e.dbPath),t),n=le(e.dbPath,t);if(!n)return null;let i=Ye(r,n.database),o=n.index?Ye(r,n.index):void 0,a=n.metadata?Ye(r,n.metadata):void 0;return!Ke(i,n.database)||n.index&&(!o||!Ke(o,n.index))||n.metadata&&(!a||!Ke(a,n.metadata))?null:{identity:t,databasePath:i,...o?{indexPath:o}:{},...a?{metadataPath:a,metadataRaw:b(a,"reindex metadata")}:{},source:"immutable"}}catch{return null}}function lr(e,t){let r=O(e.dbPath),n=x(se(e.dbPath),"meta.json"),i=W(n)?b(n,"reindex metadata"):void 0,o=W(e.indexPath)?e.indexPath:void 0;return{identity:t??ur(e.dbPath,i),databasePath:e.dbPath,...o?{indexPath:o}:{},...i===void 0?{}:{metadataPath:n,metadataRaw:i},source:"legacy",databaseFileIdentity:r}}function ur(e,t){let r=An("sha256").update("sqlite-generation-legacy-v1\0");return t!==void 0&&r.update(N(t)),r.update(`\0${O(e)}`),r.digest("hex")}function O(e){let t=or(e);return`${t.dev}:${t.ino}:${t.size}:${t.mtimeMs}`}function Ye(e,t){if(On(t.file)!==t.file||t.file==="."||t.file==="..")throw new Error("SQLite generation manifest contains an unsafe artifact path");return x(e,t.file)}function Ke(e,t){if(!W(e))return!1;let r=nr(e);if(!r||r.size!==t.size)return!1;let n=`${e}\0${t.sha256}\0${r.identity}`;if(ae.has(n))return!0;let i=Y(e,{inputKind:"immutable SQLite generation artifact",maxBytes:t.size}),o=nr(e);if(!o||o.identity!==r.identity||i!==t.sha256)return!1;for(ae.set(n,!0);ae.size>_n;){let a=ae.keys().next().value;if(a===void 0)break;ae.delete(a)}return!0}function nr(e){let t=or(e,{bigint:!0});return t.isFile()?{identity:`${t.dev}:${t.ino}:${t.size}:${t.mtimeNs}:${t.ctimeNs}`,size:Number(t.size)}:null}function qn(e,t){return e.version===Ze&&e.identity===t&&Xe(e.database)&&(e.index===void 0||Xe(e.index))&&(e.metadata===void 0||Xe(e.metadata))}function Xe(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 Bn(e){return e.version===V&&typeof e.currentGeneration=="string"&&!!e.currentGeneration&&typeof e.publishedAt=="string"&&Number.isFinite(Date.parse(e.publishedAt))&&(e.artifactSet===void 0||e.artifactSet==="immutable-v1")&&$n(e.stableMirrors)&&zn(e.previousGeneration)&&Wn(e.publication)}function $n(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 zn(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 Wn(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 Qn=["busy_timeout = 5000","query_only = ON","temp_store = MEMORY","cache_size = -64000","mmap_size = 268435456"],rt=class{constructor(t,r){this.connection=t;this.releaseGenerationReader=r}connection;releaseGenerationReader;active=!0;initialize(t){try{for(let r of Qn)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}},Hn=["node_modules",".git","dist","build","out","coverage","target",".next",".nuxt",".cache",".turbo",".nbb",".cpcache",".shadow-cljs",".codebaseiq-cache","__pycache__",".venv","venv"],pr=class{db;config;generation;pathFilter;connection;connectionOwnership;statementCache=new Map;closed=!1;constructor(t,r){this.config=t,this.pathFilter=r??null;let n=Kn(t),i=new rt(n.db,n.release);try{i.initialize(Yn),this.generation=n.generation,this.connection=n.db,this.connectionOwnership=i,this.db=Un(n.db)}catch(o){try{i.close()}catch(a){throw new AggregateError([o,a],"SQLite construction and rollback both failed.",{cause:a})}throw o}}isIgnored(t){return this.pathFilter?.isIgnored(t)??!1}get localSymbolPredicate(){return`(
|
|
2
|
-
EXISTS (
|
|
3
|
-
SELECT 1
|
|
4
|
-
FROM defn_enclosing_ranges local_der
|
|
5
|
-
JOIN documents local_d ON local_der.document_id = local_d.id
|
|
6
|
-
WHERE local_der.symbol_id = gs.id
|
|
7
|
-
${this.pathExclusionsFor("local_d").trimStart()}
|
|
8
|
-
)
|
|
9
|
-
OR EXISTS (
|
|
10
|
-
SELECT 1
|
|
11
|
-
FROM mentions local_m
|
|
12
|
-
JOIN chunks local_c ON local_m.chunk_id = local_c.id
|
|
13
|
-
JOIN documents local_d ON local_c.document_id = local_d.id
|
|
14
|
-
WHERE local_m.symbol_id = gs.id
|
|
15
|
-
AND local_m.role = 1
|
|
16
|
-
${this.pathExclusionsFor("local_d").trimStart()}
|
|
17
|
-
)
|
|
18
|
-
)`}get pathExclusions(){return this.pathExclusionsFor("d")}get symbolNoise(){return this.symbolNoiseFor("gs")}pathExclusionsFor(...t){return t.flatMap(r=>Hn.flatMap(n=>[`AND ${r}.relative_path NOT LIKE '${n}/%'`,`AND ${r}.relative_path NOT LIKE '%/${n}/%'`])).join(`
|
|
19
|
-
`)}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{Yt(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 Un(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 Jn(r)}})}function Jn(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 Yn(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)Pe(n.relative_path)}function Kn(e){for(let t=0;t<4;t+=1){let r=cr(e),n=r.generation,i;try{i=new Vn(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=tt(e);if(n.databaseFileIdentity===O(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{createHash as cn,randomUUID as no}from"crypto";import{existsSync as B,lstatSync as Tt,mkdirSync as ee,mkdtempSync as dn,readdirSync as ln,realpathSync as un,renameSync as U,rmSync as q,statSync as Be}from"fs";import{dirname as Ct,join as u,resolve as we}from"path";import{setTimeout as io}from"timers/promises";import{pathToFileURL as nn}from"url";import{deserializeSCIP as pn}from"@c4312/scip";import oo from"better-sqlite3";import{execFileSync as Xn}from"child_process";import{existsSync as Zn,readdirSync as gr}from"fs";import{extname as mr,join as yr}from"path";var hr=new Set([".git",".hg",".svn",".idea",".vscode","node_modules","vendor","dist","build","target","bin","obj",".dart_tool",".gradle",".next",".venv","venv","__pycache__"]),ei=[{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 nt(e){let t=[],r=ti(e),n=oi(e);for(let i of ei){if(ri(e,i.files)){t.push(i.language);continue}if(ni(r,i.globs)){t.push(i.language);continue}si(n,i.extensions)&&t.push(i.language)}return t.includes("typescript")&&fr(t,"javascript"),t.includes("cpp")&&!n.has(".c")&&fr(t,"c"),t}function ti(e){try{return gr(e)}catch{return[]}}function ri(e,t){return t?.length?t.some(r=>Zn(yr(e,r))):!1}function ni(e,t){return t?.length?e.some(r=>t.some(n=>ii(r,n))):!1}function ii(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 oi(e){let t=ai(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=gr(i,{withFileTypes:!0})}catch{continue}for(let a of o){if(a.name.startsWith(".")&&!a.name.endsWith("proj")&&!a.name.endsWith("sln")&&a.isDirectory())continue;let s=yr(i,a.name);if(a.isDirectory()){hr.has(a.name)||n.push(s);continue}let c=mr(a.name).toLowerCase();c&&r.add(c)}}return r}function ai(e){try{let t=Xn("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(`
|
|
20
|
-
`)){if(!n||n.split("/").some(o=>hr.has(o)))continue;let i=mr(n).toLowerCase();i&&r.add(i)}return r}catch{return null}}function si(e,t){return t?.length?t.some(r=>e.has(r)):!1}function fr(e,t){let r=e.indexOf(t);r!==-1&&e.splice(r,1)}import{lstatSync as xi,readdirSync as wi}from"fs";import{join as Ri,relative as vi,resolve as pt,sep as Ei}from"path";import{createHash as ci}from"crypto";import{existsSync as pe,mkdirSync as di,readdirSync as Sr,renameSync as li,rmSync as br,writeFileSync as ui}from"fs";import{join as M}from"path";import{create as xr,fromBinary as wr,toBinary as pi}from"@bufbuild/protobuf";import{deserializeSCIP as Le,DocumentSchema as ot,IndexSchema as Rr,serializeSCIP as vr}from"@c4312/scip";var Oe=1,fe="typescript-scip-fragments";function sa(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 a=Q(o.relativePath);if(t.has(a))throw new Error(`duplicate TypeScript fragment replacement: ${a}`);if(t.add(a),o.bytes===null)throw new Error(`affected TypeScript mini index cannot contain a deleted document: ${a}`);let s=wr(ot,o.bytes);if(s.relativePath!==a)throw new Error(`TypeScript fragment path mismatch: expected ${a}, got ${s.relativePath}`);r.push(s)}let n=vr(xr(Rr,{documents:r,externalSymbols:[]})),i=Le(n);if(i.documents.length!==r.length||i.externalSymbols.length!==0)throw new Error("affected TypeScript SCIP index failed structural verification");return n}function ge(e){let t=M(e,fe);return{rootDir:t,blobDir:M(t,"blobs"),generationDir:M(t,"generations")}}function fi(e){let t=Le(e.indexBytes);Lr(t.metadata,Or(e)),Dr(t.externalSymbols);let r=new Set,n=[];for(let o of t.documents){let a=Q(o.relativePath);if(r.has(a))throw new Error(`duplicate TypeScript SCIP document path: ${a}`);r.add(a);let s=pi(ot,o),c=e.documentIdentities.get(a)??(e.allowUntrackedDocuments?H(JSON.stringify({version:1,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,untrackedDocument:a,contentHash:H(s)})):null);if(!c)throw new Error(`missing TypeScript document identity: ${a}`);n.push(Tr(e.cacheDir,{relativePath:a,bytes:s,occurrences:o.occurrences.length,symbols:o.symbols.length,referenceFragments:[]},c))}let i=Cr(e,n);return Ar(e.cacheDir,i),i}function ca(e){let t=ge(e.cacheDir);if(!pe(st(t,e.generationIdentity)))return fi(e);let r=Er({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 da(e){let t=Er({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 a=Q(o.relativePath);if(n.has(a))throw new Error(`duplicate TypeScript fragment replacement: ${a}`);if(n.add(a),!r.has(a))throw new Error(`TypeScript fragment replacement has no prior document: ${a}`);let s=e.documentIdentities.get(a);if(!s)throw new Error(`missing TypeScript document identity: ${a}`);o.bytes===null?r.delete(a):r.set(a,Tr(e.cacheDir,o,s))}if(n.size===0)throw new Error("TypeScript fragment generation requires at least one replacement");let i=Cr(e,[...r.values()]);return Ar(e.cacheDir,i),i}function Er(e){let t=ge(e.cacheDir),r=st(t,e.generationIdentity),n;try{n=at(E(r,{maxBytes:v,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 a=M(t.blobDir,`${o.blobHash}.scipdoc`),s=S(a,{maxBytes:J,inputKind:"TypeScript fragment blob"});if(s.byteLength!==o.byteLength||H(s)!==o.blobHash)throw new Error(`TypeScript fragment blob is corrupt: ${o.relativePath}`);i.set(o.relativePath,s)}return{manifest:n,fragments:i}}function Pr(e){let t=Gr(e);return it(t.baseIndex,t.completeDocuments,"assembled")}function la(e){let t=Gr(e);return gi(t.deletedAffectedPaths),{completeIndexBytes:it(t.baseIndex,t.completeDocuments,"assembled"),affectedIndexBytes:it(t.baseIndex,t.affectedDocuments,"affected")}}function Gr(e){let t=Le(e.baseIndexBytes);Lr(t.metadata,Or(e)),Dr(t.externalSymbols);let r=new Map;for(let s of e.fragments){let c=Q(s.relativePath);if(r.has(c))throw new Error(`duplicate TypeScript fragment replacement: ${c}`);r.set(c,s)}if(r.size===0)throw new Error("TypeScript index assembly requires at least one replacement");let n=new Set,i=[],o=[],a=[];for(let s of t.documents){let c=Q(s.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(s);continue}if(r.delete(c),d.bytes===null){a.push(c);continue}let l=wr(ot,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:a}}function it(e,t,r){let n=vr(xr(Rr,{metadata:e.metadata,documents:t,externalSymbols:[]})),i=Le(n);if(i.documents.length!==t.length||i.externalSymbols.length!==0)throw new Error(`${r} TypeScript SCIP index failed structural verification`);return n}function gi(e){if(e.length>0)throw new Error(`affected TypeScript mini index cannot contain a deleted document: ${e[0]}`)}function ua(e,t){let r=ge(e);if(!pe(r.generationDir))return;let n=new Set(t.map(a=>kr(a))),i=Sr(r.generationDir).filter(a=>a.endsWith(".json")),o=new Set;for(let a of i.filter(s=>n.has(s))){let s=at(E(M(r.generationDir,a),{maxBytes:v,inputKind:"TypeScript fragment manifest"}));for(let c of s.documents)o.add(`${c.blobHash}.scipdoc`)}for(let a of i)n.has(a)||br(M(r.generationDir,a),{force:!0});if(pe(r.blobDir))for(let a of Sr(r.blobDir))o.has(a)||br(M(r.blobDir,a),{force:!0})}function Tr(e,t,r){if(t.bytes===null)throw new Error(`cannot persist an empty TypeScript fragment: ${t.relativePath}`);let n=Q(t.relativePath),i=Buffer.from(t.bytes),o=H(i),a=ge(e);di(a.blobDir,{recursive:!0});let s=M(a.blobDir,`${o}.scipdoc`);if(pe(s)){let c=S(s,{maxBytes:J,inputKind:"TypeScript fragment blob"});if(c.byteLength!==i.byteLength||H(c)!==o)throw new Error(`existing TypeScript fragment blob is corrupt: ${n}`)}else{let c=`${s}.${process.pid}.${Date.now()}.tmp`;ui(c,i),li(c,s)}return{relativePath:n,blobHash:o,byteLength:i.byteLength,documentIdentity:r}}function Cr(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:Oe,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,generationIdentity:e.generationIdentity,createdAt:(e.now??(()=>new Date))().toISOString(),documents:r}}function Ar(e,t){let r=ge(e),n=st(r,t.generationIdentity);if(pe(n)){let i=at(E(n,{maxBytes:v,inputKind:"TypeScript fragment manifest"}));if(Ir(i)!==Ir(t))throw new Error(`TypeScript fragment generation is immutable: ${t.generationIdentity}`);return}F(n,t,{spacing:2,trailingNewline:!0})}function Ir(e){return H(JSON.stringify({version:e.version,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,generationIdentity:e.generationIdentity,documents:e.documents}))}function at(e){let t=JSON.parse(e);if(t.version!==Oe||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(Q(n.relativePath),r.has(n.relativePath))throw new Error("duplicate TypeScript fragment record");r.add(n.relativePath)}return t}function st(e,t){return M(e.generationDir,kr(t))}function kr(e){if(!e)throw new Error("TypeScript fragment generation identity must be non-empty");return`${H(e)}.json`}function Dr(e){if(e.length>0)throw new Error("scip-typescript emitted external symbols; incremental document assembly is unsupported")}function Lr(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 Or(e){let t=e.packageVersion??e.runtime?.packageVersion;if(!t)throw new Error("scip-typescript package version is unavailable");return t}function Q(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 H(e){return ci("sha256").update(e).digest("hex")}import{createHash as mi}from"crypto";import{existsSync as me,mkdirSync as yi,readdirSync as ct,renameSync as hi,rmSync as Mr,writeFileSync as Si}from"fs";import{join as P}from"path";var Me=1,ba=64*1024*1024,he="typescript-scip-overlays";function Ia(e){let t=jr(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 a=ut(o.relativePath);if(n.has(a))throw new Error(`duplicate TypeScript overlay: ${a}`);n.add(a),r.set(a,bi(e.cacheDir,o))}if(n.size===0)throw new Error("TypeScript overlay generation requires affected documents");let i={version:Me,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,a)=>o.relativePath.localeCompare(a.relativePath))};return Ii(e.cacheDir,i),i}function xa(e){let t=jr(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=S(P(Se(e.cacheDir),"blobs",`${n.blobHash}.scipdoc`),{maxBytes:J,inputKind:"TypeScript overlay blob"});if(i.byteLength!==n.byteLength||ye(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 Pr({packageVersion:e.packageVersion,baseIndexBytes:e.baseIndexBytes,fragments:r})}function wa(e,t){let r=Se(e),n=P(r,"generations");if(!me(n))return;let i=new Set(t.map(lt)),o=new Set;for(let s of ct(n).filter(c=>i.has(c))){let c=dt(E(P(n,s),{maxBytes:v,inputKind:"TypeScript overlay manifest"}));for(let d of c.overlays)d.blobHash&&o.add(`${d.blobHash}.scipdoc`)}for(let s of ct(n))i.has(s)||Mr(P(n,s),{force:!0});let a=P(r,"blobs");if(me(a))for(let s of ct(a))o.has(s)||Mr(P(a,s),{force:!0})}function jr(e,t){let r=P(Se(e),"generations",lt(t));if(!me(r))return null;let n=dt(E(r,{maxBytes:v,inputKind:"TypeScript overlay manifest"}));if(n.generationIdentity!==t)throw new Error("TypeScript overlay generation identity does not match its path");return n}function bi(e,t){let r=ut(t.relativePath);if(t.bytes===null)return{relativePath:r,blobHash:null,byteLength:0};let n=Buffer.from(t.bytes),i=ye(n),o=P(Se(e),"blobs");yi(o,{recursive:!0});let a=P(o,`${i}.scipdoc`);if(me(a)){let s=S(a,{maxBytes:J,inputKind:"TypeScript overlay blob"});if(s.byteLength!==n.byteLength||ye(s)!==i)throw new Error(`existing TypeScript overlay blob is corrupt: ${r}`)}else{let s=`${a}.${process.pid}.${Date.now()}.tmp`;Si(s,n),hi(s,a)}return{relativePath:r,blobHash:i,byteLength:n.byteLength}}function Ii(e,t){let r=P(Se(e),"generations",lt(t.generationIdentity));if(me(r)){let n=dt(E(r,{maxBytes:v,inputKind:"TypeScript overlay manifest"}));if(_r(n)!==_r(t))throw new Error(`TypeScript overlay generation is immutable: ${t.generationIdentity}`);return}F(r,t,{spacing:2,trailingNewline:!0})}function dt(e){let t=JSON.parse(e);if(t.version!==Me||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(ut(n.relativePath),r.has(n.relativePath))throw new Error("duplicate TypeScript overlay record");r.add(n.relativePath)}return t}function Se(e){return P(e,he)}function lt(e){if(!e)throw new Error("TypeScript overlay generation identity must be non-empty");return`${ye(e)}.json`}function _r(e){return ye(JSON.stringify({version:e.version,producerIdentity:e.producerIdentity,projectIdentity:e.projectIdentity,baseGenerationIdentity:e.baseGenerationIdentity,generationIdentity:e.generationIdentity,overlays:e.overlays}))}function ut(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 ye(e){return mi("sha256").update(e).digest("hex")}var be=1,ft="language-indexes",Fr=["index.db","index.scip","meta.json"],Nr=[ft,fe,he];function _e(e){let t=[];for(let r of Fr)Pi(e,r),t.push(r);for(let r of Nr)qr(e,r,t);return{version:be,files:t.sort()}}function je(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(!Fr.includes(e)&&!Nr.includes(r))throw new Error(`index artifact path is not shareable: ${e}`);return e}function A(e,t){let r=je(t),n=pt(e),i=pt(n,...r.split("/"));if(i!==n&&!i.startsWith(`${n}${Ei}`))throw new Error(`index artifact escapes cache: ${t}`);return i}function qr(e,t,r){let n=Ri(e,t),i;try{i=wi(n,{withFileTypes:!0,encoding:"utf8"})}catch{return}for(let o of i){let a=`${t}/${o.name}`;if(o.isSymbolicLink())throw new Error(`index artifact cannot be a symlink: ${a}`);o.isDirectory()?qr(e,a,r):o.isFile()&&r.push(je(a))}}function Pi(e,t){let r=A(e,t),n;try{n=xi(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(vi(pt(e),r).startsWith(".."))throw new Error(`index artifact escapes cache: ${t}`)}import{writeFileSync as mt}from"fs";import{create as X}from"@bufbuild/protobuf";import{deserializeSCIP as yt,serializeSCIP as ht,DocumentSchema as Li,IndexSchema as $r,MetadataSchema as zr,SymbolInformationSchema as Oi}from"@c4312/scip";import{writeFileSync as Gi}from"fs";import{create as Br}from"@bufbuild/protobuf";import{deserializeSCIP as Ti,DocumentSchema as Ci,IndexSchema as Ai,serializeSCIP as ki,SymbolRole as Di}from"@c4312/scip";function Oa(e){let t;try{t=Ti(S(e,{inputKind:"SCIP sanitization input",maxBytes:R}))}catch{return{removedDefinitionOccurrences:0,touchedDocuments:0}}let r=gt(t);return r.touchedDocuments>0&&Gi(e,Buffer.from(ki(r.index))),{removedDefinitionOccurrences:r.removedDefinitionOccurrences,touchedDocuments:r.touchedDocuments}}function gt(e){let t=new Set,r=new Map;for(let a of e.documents){r.set(a,Pe(a.relativePath));for(let s of a.symbols)s.symbol&&t.add(s.symbol)}for(let a of e.externalSymbols)a.symbol&&t.add(a.symbol);let n=0,i=0,o=[];for(let a of e.documents){let s=r.get(a),c=a.occurrences.filter(d=>(d.symbolRoles&Di.Definition)===0||t.has(d.symbol)?!0:(n+=1,!1));if(s===a.relativePath&&c.length===a.occurrences.length){o.push(a);continue}i+=1,o.push(Br(Ci,{language:a.language,relativePath:s,occurrences:c,symbols:a.symbols,text:a.text,positionEncoding:a.positionEncoding}))}return{index:i===0?e:Br(Ai,{metadata:e.metadata,documents:o,externalSymbols:e.externalSymbols}),removedDefinitionOccurrences:n,touchedDocuments:i}}function Wr(e){if(e.length===0)throw new Error("Cannot merge zero SCIP indexes");if(e.length===1)return e[0];let t=_i(e),r=ji(e.flatMap(i=>i.documents??[])),n=Qr(e.flatMap(i=>i.externalSymbols??[]));return X($r,{metadata:t,documents:r,externalSymbols:n})}function $a(e,t){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let r=e.map(i=>yt(S(i,{inputKind:"SCIP merge input",maxBytes:R}))),n=Wr(r);return mt(t,Buffer.from(ht(n))),{documentCount:n.documents.length,externalSymbolCount:n.externalSymbols.length,inputCount:e.length}}function za(e,t){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let r=e.map(i=>yt(S(i,{inputKind:"SCIP merge input",maxBytes:R}))),n=gt(Wr(r));return mt(t,Buffer.from(ht(n.index))),{documentCount:n.index.documents.length,externalSymbolCount:n.index.externalSymbols.length,inputCount:e.length,removedDefinitionOccurrences:n.removedDefinitionOccurrences,touchedDocuments:n.touchedDocuments}}function Mi(e,t,r){let n=e.metadata;if(!n)throw new Error("Cannot rebase a SCIP index without metadata");if(!K(n.projectRoot,t))throw new Error(`Cannot rebase SCIP project root: expected ${t}, got ${n.projectRoot}`);return X($r,{metadata:X(zr,{...n,projectRoot:r}),documents:e.documents,externalSymbols:e.externalSymbols})}function Vr(e,t,r){let n=yt(S(e,{inputKind:"SCIP normalization input",maxBytes:R})),i=Mi(n,t,r);mt(e,Buffer.from(ht(i)))}function _i(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&&!K(o,r))throw new Error(`Cannot merge SCIP indexes with different project roots: ${r} vs ${o}`)}let n=r&&Qt(r);return n===r?t:X(zr,{...t,projectRoot:n})}function ji(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,X(Li,{language:n.language||r.language,relativePath:n.relativePath||r.relativePath,occurrences:Fi([...n.occurrences,...r.occurrences]),symbols:Qr([...n.symbols,...r.symbols]),text:qi(n.text,r.text),positionEncoding:n.positionEncoding||r.positionEncoding}))}return[...t.values()]}function Fi(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 Qr(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,X(Oi,{symbol:n.symbol,documentation:Bi([...n.documentation,...r.documentation]),relationships:Ni([...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 Ni(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 qi(e,t){return e?t?e.length>=t.length?e:t:e:t}function Bi(e){return[...new Set(e)]}import{createHash as Rt}from"crypto";import{closeSync as $i,existsSync as g,mkdirSync as zi,openSync as Wi,readSync as Vi,readdirSync as vt,renameSync as xt,rmSync as Ie,statSync as Z}from"fs";import{basename as Yr,dirname as k,join as f,relative as Hr}from"path";var wt=Object.freeze({maxGenerations:2,maxLogicalBytes:2*1024*1024*1024});function Kr(e){let t=m(e.outputDb),r=Yi(e);e.onStage?.("after-recovery-retained");let n=e.preserveOutputScip?e.outputScip:e.tempOutputScip,i=Gt({generationRoot:t,databasePath:e.tempOutputDb,indexPath:g(n)?n:void 0,metadataPath:g(e.tempMetaPath)?e.tempMetaPath:void 0}),o=(e.now??(()=>new Date))().toISOString(),a={version:V,currentGeneration:i.identity,artifactSet:"immutable-v1",...r?{previousGeneration:r}:{},...e.publication?{publication:e.publication}:{},publishedAt:o},s=G(f(t,"state.json"),a,{spacing:2,trailingNewline:!0});e.onStage?.("after-pointer-handoff"),e.preserveOutputScip||It(e.tempOutputScip,e.outputScip),e.onStage?.("after-scip-handoff"),It(e.tempOutputDb,e.outputDb),e.onStage?.("after-database-handoff"),It(e.tempMetaPath,e.metaPath),e.onStage?.("after-metadata-handoff");let c=i.identity,d={...a,stableMirrors:Pt(e.outputDb,e.outputScip)};G(f(t,"state.json"),d,{spacing:2,trailingNewline:!0});let l=Xr(e.outputDb,{now:e.now}),p=ne(i.directorySync,s.directorySync);return{currentGeneration:c,...r?{previousGeneration:r}:{},retention:l,achievedDurability:p==="synced"?"directory-durable":"file-flushed",directorySync:p}}function Qi(e,t,r,n=()=>new Date){if(!g(e))return null;let i=C(e),o=f(m(e),"state.json");if(i?.artifactSet==="immutable-v1"&&le(e,i.currentGeneration))return i;let a=m(e),s=!i&&g(o)?Xi(r,e,t):void 0;if(s&&!ue(a,s))return null;let c=Gt({generationRoot:a,databasePath:e,indexPath:g(t)?t:void 0,metadataPath:g(r)?r:void 0,forcedIdentity:i?.currentGeneration??s}),d={version:V,currentGeneration:c.identity,artifactSet:"immutable-v1",stableMirrors:Pt(e,t),...i?.previousGeneration?{previousGeneration:i.previousGeneration}:{},...i?.publication?{publication:i.publication}:{},publishedAt:i?.publishedAt??n().toISOString()};return G(f(a,"state.json"),d,{spacing:2,trailingNewline:!0}),d}function rs(e,t,r=()=>new Date){if(!g(e)||!g(t))throw new Error("metadata-only generation refresh requires stable database and metadata files");let n=C(e),i=m(e),o=Gt({generationRoot:i,databasePath:e,indexPath:g(f(k(e),"index.scip"))?f(k(e),"index.scip"):void 0,metadataPath:t}),a=n&&n.currentGeneration!==o.identity?tn(e,n.currentGeneration):void 0,s={version:V,currentGeneration:o.identity,artifactSet:"immutable-v1",stableMirrors:Pt(e,f(k(e),"index.scip")),...a?{previousGeneration:a}:{},...n?.publication?{publication:n.publication}:{},publishedAt:r().toISOString()};return G(f(m(e),"state.json"),s,{spacing:2,trailingNewline:!0}),Xr(e,{now:r}),s}function Xr(e,t={}){let r=Hi(t.limits),i=(t.now??(()=>new Date))().toISOString(),o=T(de(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 a=C(e),s=Zr(e),c=et(e,s.map(w=>w.identity),{isProcessAlive:t.isProcessAlive??ie,readProcessIdentity:t.readProcessIdentity??te}),d=new Set(c.protectedGenerations);a?.currentGeneration&&d.add(a.currentGeneration),a?.previousGeneration?.generationIdentity&&d.add(a.previousGeneration.generationIdentity);let l=s.length,p=s.reduce((w,$e)=>w+$e.logicalBytes,0),h=0,D=0;for(let w of s){if(l<=r.maxGenerations&&p<=r.maxLogicalBytes)break;d.has(w.identity)||(t.onBeforeRemove?.(w.identity),Ie(w.path,{recursive:!0,force:!0}),l-=1,p-=w.logicalBytes,h+=1,D+=w.logicalBytes)}let y=l>r.maxGenerations||p>r.maxLogicalBytes,L={state:y?"protected":h>0?"collected":"within-bounds",generationCount:l,logicalBytes:p,protectedGenerations:d.size,activeReaderLeases:c.activeLeases,staleReaderLeasesRemoved:c.staleLeasesRemoved,malformedReaderLeases:c.malformedLeases,removedGenerations:h,removedLogicalBytes:D,limits:r,at:i,...y?{reason:c.malformedLeases>0?"malformed reader ownership evidence fails closed":"retention bounds cannot be met without deleting a protected generation"}:{}};return Ur(e,L),L}catch(a){let s={state:"error",generationCount:0,logicalBytes:0,protectedGenerations:0,activeReaderLeases:0,staleReaderLeasesRemoved:0,malformedReaderLeases:0,removedGenerations:0,removedLogicalBytes:0,limits:r,at:i,reason:a instanceof Error?a.message:String(a)};try{Ur(e,s)}catch{}return s}finally{o.release()}}function ns(e){let t=m(e);if(!g(t))return{state:"absent",generationCount:0,logicalBytes:0,protectedGenerations:0,activeReaderLeases:0,malformedReaderLeases:0,limits:{...wt},reason:"local immutable generation store does not exist"};let r=Ui(e),n=r?.limits??{...wt},i=T(de(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=Zr(e),a=C(e),s=et(e,o.map(d=>d.identity),{isProcessAlive:ie,readProcessIdentity:te},{removeStale:!1}),c=new Set(s.protectedGenerations);return a?.currentGeneration&&c.add(a.currentGeneration),a?.previousGeneration?.generationIdentity&&c.add(a.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:s.activeLeases,malformedReaderLeases:s.malformedLeases,limits:n,...r?{lastCollection:r}:{},...s.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 Hi(e={}){let t={...wt,...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 Zr(e){let t=m(e);return g(t)?vt(t,{withFileTypes:!0}).filter(r=>r.isDirectory()&&/^[a-f0-9]{64}$/.test(r.name)).map(r=>{let n=f(t,r.name),i=ue(t,r.name),o=i?i.database.size+(i.index?.size??0)+(i.metadata?.size??0):en(n);return{identity:r.name,path:n,logicalBytes:o,modifiedAtMs:Z(n).mtimeMs}}).sort((r,n)=>r.modifiedAtMs-n.modifiedAtMs||r.identity.localeCompare(n.identity)):[]}function en(e){let t=0;for(let r of vt(e,{withFileTypes:!0})){let n=f(e,r.name);r.isDirectory()?t+=en(n):r.isFile()&&(t+=Z(n).size)}return t}function Ur(e,t){F(f(m(e),"gc.json"),t,{spacing:2,trailingNewline:!0})}function Ui(e){try{let t=JSON.parse(b(f(m(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 Et(e,t=f(k(e),"meta.json")){let r=f(m(e),"state.json");if(!g(r))return{state:"legacy",statePath:r};let n=C(e);if(!n)return{state:"invalid",statePath:r,reason:"generation state is malformed"};try{let i=le(e,n.currentGeneration),o=i!==null,a=i?Ji(e,t,i,n):!1,s=n.previousGeneration?g(f(k(e),n.previousGeneration.databasePath)):!0;return!a||!o||!s?{state:"drifted",statePath:r,currentMatches:a,recoveryExists:s,generation:n,reason:o?a?"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:a,recoveryExists:s,generation:n}}catch(i){return{state:"drifted",statePath:r,currentMatches:!1,recoveryExists:!1,generation:n,reason:i instanceof Error?i.message:String(i)}}}function Ji(e,t,r,n){if(n.stableMirrors&&(n.stableMirrors.databaseFileIdentity!==O(e)||n.stableMirrors.indexFileIdentity!==void 0&&n.stableMirrors.indexFileIdentity!==O(f(k(e),"index.scip")))||!Jr(e,r.database))return!1;let i=f(k(e),"index.scip");if(r.index&&!Jr(i,r.index))return!1;if(!r.metadata)return!g(t);if(!g(t))return!1;let o=f(m(e),r.identity,r.metadata.file);return g(o)&&N(b(t,"reindex metadata"))===N(b(o,"immutable reindex metadata"))}function Jr(e,t){return g(e)&&Z(e).isFile()&&Z(e).size===t.size}function Yi(e){let t=Qi(e.outputDb,e.outputScip,e.metaPath);return t?tn(e.outputDb,t.currentGeneration):void 0}function Pt(e,t){return{databaseFileIdentity:O(e),...g(t)?{indexFileIdentity:O(t)}:{}}}function tn(e,t){let r=f(m(e),t),n=f(r,Yr(e)),i=f(r,"meta.json");return{generationIdentity:t,databasePath:Hr(k(e),n),...g(i)?{metadataPath:Hr(k(e),i)}:{}}}function Ki(e){if(g(e)){for(let t of vt(e,{withFileTypes:!0}))if(t.isDirectory()&&t.name.endsWith(".tmp"))try{Ie(f(e,t.name),{recursive:!0,force:!0})}catch{}}}function Xi(e,t,r=f(k(t),"index.scip")){let n=Rt("sha256").update("sqlite-generation-artifacts-v1\0");return n.update(Fe(t)),g(r)&&n.update(`\0${Fe(r)}`),g(e)&&n.update(`\0${N(b(e,"reindex metadata"))}`),n.digest("hex")}function Gt(e){let t=St(e.databasePath),r=e.indexPath?St(e.indexPath):void 0,n=e.metadataPath?St(e.metadataPath):void 0,i=e.forcedIdentity??Zi(t,r,e.metadataPath),o=f(e.generationRoot,i),a=f(o,De);if(g(a)){let d=ue(e.generationRoot,i);if(d&&rn(o,d.database,t)&&to(o,d.index,r)&&ro(o,d.metadata,e.metadataPath))return{identity:i,directorySync:j(e.generationRoot)};throw new Error(`SQLite generation ${i} already exists with different or corrupt artifacts.`)}let s=[Ee(e.generationRoot)];Ki(e.generationRoot);let c=`${o}.${process.pid}.${Date.now()}.tmp`;Ie(c,{recursive:!0,force:!0}),zi(c,{recursive:!0});try{s.push(bt(e.databasePath,f(c,t.file))),r&&e.indexPath&&s.push(bt(e.indexPath,f(c,r.file))),n&&e.metadataPath&&s.push(bt(e.metadataPath,f(c,n.file)));let d=G(f(c,De),{version:Ze,identity:i,database:t,...r?{index:r}:{},...n?{metadata:n}:{}},{spacing:2,trailingNewline:!0});d.directorySync!=="not-requested"&&s.push(d.directorySync),s.push(j(c)),I(()=>xt(c,o)),s.push(j(e.generationRoot))}finally{try{Ie(c,{recursive:!0,force:!0})}catch{}}return{identity:i,directorySync:ne(...s)}}function Zi(e,t,r){let n=Rt("sha256").update("sqlite-generation-artifacts-v1\0");return n.update(e.sha256),t&&n.update(`\0${t.sha256}`),r&&n.update(`\0${N(b(r,"reindex metadata"))}`),n.digest("hex")}function St(e){return{file:Yr(e),size:Z(e).size,sha256:Fe(e)}}function Fe(e){let t=Rt("sha256"),r=Wi(e,"r"),n=Buffer.allocUnsafe(1024*1024);try{for(;;){let i=eo(r,n);if(i===0)break;t.update(n.subarray(0,i))}}finally{$i(r)}return t.digest("hex")}function eo(e,t){let r=0;for(;r<t.length;){let n=Vi(e,t,r,t.length-r,null);if(r+=n,n===0)break}return r}function bt(e,t){return Ce(e,t,{mode:292})}function rn(e,t,r){let n=f(e,t.file);return t.file===r.file&&t.size===r.size&&t.sha256===r.sha256&&g(n)&&Z(n).size===t.size&&Fe(n)===t.sha256}function to(e,t,r){return!t||!r?t===r:rn(e,t,r)}function ro(e,t,r){if(!t||!r)return t===void 0&&r===void 0;let n=f(e,t.file);return g(n)&&N(b(n,"stored reindex metadata"))===N(b(r,"candidate reindex metadata"))}function It(e,t){I(()=>Ie(`${t}.tmp-replace`,{force:!0})),I(()=>xt(e,`${t}.tmp-replace`)),I(()=>xt(`${t}.tmp-replace`,t))}var Lt=1,on="CODEBASEIQ_SHARED_CACHE",ao=2,Ne=JSON.stringify({cliVersion:Ht,artifactCatalogVersion:be,postIndexAugmentationSchemaVersion:ao,sqliteGenerationStoreVersion:V,typescriptFragmentStoreVersion:Oe,typescriptOverlayStoreVersion:Me}),Ot="manifest.json",so="shared-cache.json",Mt=[ft,fe,he];function At(e,t){if(!e.clean||!e.treeOid)return;let r=Sn(JSON.stringify({version:Lt,repositoryId:e.repositoryId,treeOid:e.treeOid,fingerprint:t,producerIdentity:Ne}));return{repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:e.projectRoot,treeOid:e.treeOid,fingerprint:t,producerIdentity:Ne,generationId:r,repositoryCacheDir:Ge(e.repositoryId)}}function fn(e,t,r){if(process.env[on]==="0")return`${on}=0`;if(!We(r))return"explicit cache or database override";if(Ve(Ct(t))!==Ve(ze(e))||t!==u(Ct(t),"index.db"))return"index database is outside the managed worktree cache"}function ks(e,t,r){if(!We(t))return;let n=r??oe(e);return n?u(Ge(n.repositoryId),"evidence.db"):void 0}function $(e,t=!0){let r=Ft(e),n;try{n=mn(E(u(r,Ot),{inputKind:"shared-generation manifest",maxBytes:v}))}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=A(r,i.path),a=Be(o);if(!a.isFile()||a.size!==i.size||Y(o,{inputKind:"shared-generation artifact",maxBytes:R})!==i.sha256)return null}}catch{return null}return n}function Ds(e,t,r){if(!e.treeOid)return null;let n=He(t,r),i=u(Ut(),"repositories",e.repositoryId),o;try{let c=Tt(i);if(!c.isDirectory()||c.isSymbolicLink())return null;o=un(i)}catch{return null}let a=u(o,"generations"),s=[];try{for(let c of ln(a)){if(!/^[a-f0-9]{64}$/.test(c))continue;let d=u(a,c),l;try{l=Tt(d)}catch{continue}if(!(!l.isDirectory()||l.isSymbolicLink()))try{let p=mn(E(u(d,Ot),{inputKind:"shared-generation baseline manifest",maxBytes:v}));p.generationId===c&&p.repositoryId===e.repositoryId&&p.treeOid===e.treeOid&&p.producerIdentity===Ne&&po(p.fingerprint,n)&&s.push(p)}catch{continue}}}catch{return null}s.sort((c,d)=>Date.parse(d.createdAt)-Date.parse(c.createdAt)||c.generationId.localeCompare(d.generationId));for(let c of s){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=$(d);if(l)return{snapshot:d,manifest:l}}return null}function gn(e){let t=T(u(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 co(e)}finally{t.release()}}function co(e){let t=$(e.snapshot);if(t)return an(e.snapshot,t);if(!Re(e.sourceCacheDir,e.sourceProjectRoot,e.snapshot.fingerprint))throw new Error("source index is incomplete, incompatible, or corrupt");let r=sn(e.sourceCacheDir);if(!r)throw new Error("source index artifacts are incomplete");let n=_e(e.sourceCacheDir),i=u(e.snapshot.repositoryCacheDir,"generations"),o=[Ee(i)],a=dn(u(i,`.tmp-${process.pid}-`));try{let s=[];for(let y of n.files){let L=A(e.sourceCacheDir,y),w=A(a,y);o.push(ve(L,w,292)),e.onPublicationStage?.("after-artifact-flushed",y);let $e=Be(w).size;s.push({path:y,size:$e,sha256:Y(w,{inputKind:"staged shared-generation artifact",maxBytes:R})})}let c=pn(S(u(a,"index.scip"),{inputKind:"staged shared SCIP index",maxBytes:R})).metadata?.projectRoot;if(!c)throw new Error("shared SCIP generation has no project root metadata");let d=qt(e.sourceProjectRoot);if(!K(c,d))throw new Error("shared SCIP generation root does not match its source worktree");if(sn(e.sourceCacheDir)!==r||e.sourceStillValid&&!e.sourceStillValid())throw new Error("source index changed while staging a shared generation");let l={version:Lt,artifactCatalogVersion:be,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:s.sort((y,L)=>y.path.localeCompare(L.path))},p=G(u(a,Ot),l,{spacing:2,trailingNewline:!0});p.directorySync!=="not-requested"&&o.push(p.directorySync),e.onPublicationStage?.("after-manifest-flushed"),o.push(j(a)),e.onPublicationStage?.("after-staging-directory-synced");let h=Ft(e.snapshot);try{if(B(h)&&!$(e.snapshot)){let y=`${h}.corrupt-${process.pid}-${Date.now()}`;I(()=>U(h,y)),q(y,{recursive:!0,force:!0})}I(()=>U(a,h))}catch(y){let L=$(e.snapshot);if(L)return an(e.snapshot,L);throw y}e.onPublicationStage?.("after-generation-renamed"),o.push(j(i)),e.onPublicationStage?.("after-generations-directory-synced");let D=ne(...o);return{kind:"published",manifest:l,achievedDurability:D==="synced"?"directory-durable":"file-flushed",directorySync:D}}finally{q(a,{recursive:!0,force:!0})}}function an(e,t){let r=j(u(e.repositoryCacheDir,"generations"));return{kind:"existing",manifest:t,achievedDurability:r==="synced"?"directory-durable":"file-flushed",directorySync:r}}function kt(e){let t=Ft(e.snapshot);ee(e.targetCacheDir,{recursive:!0});let r=T(u(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=dn(u(e.targetCacheDir,".shared-hydrate-")),yo(e.manifest,e.snapshot);for(let c of e.manifest.artifacts){let d=A(t,c.path),l=A(n,c.path);if(ve(d,l),Be(l).size!==c.size||Y(l,{inputKind:"hydrated shared-generation artifact",maxBytes:R})!==c.sha256)throw new Error(`shared artifact is corrupt: ${c.path}`)}let a=qt(e.targetProjectRoot);if(a!==e.manifest.scipProjectRoot)for(let c of e.manifest.artifacts)c.path.endsWith(".scip")&&Vr(A(n,c.path),e.manifest.scipProjectRoot,a);if(!Re(n,e.targetProjectRoot,e.snapshot.fingerprint,!1))throw new Error("staged shared generation failed completeness or integrity validation");i=fo(e.targetCacheDir,n),o=!0,go(n,e.targetCacheDir,i),Kr({tempOutputScip:u(n,"index.scip"),tempOutputDb:u(n,"index.db"),tempMetaPath:u(n,"meta.json"),outputScip:u(e.targetCacheDir,"index.scip"),outputDb:u(e.targetCacheDir,"index.db"),metaPath:u(e.targetCacheDir,"meta.json"),now:e.now});let s=Et(u(e.targetCacheDir,"index.db"),u(e.targetCacheDir,"meta.json"));if(s.state==="invalid"||s.state==="drifted")throw new Error(`hydrated SQLite generation failed validation: ${s.reason}`);e.persistLease!==!1&&Dt(e.snapshot,e.targetCacheDir,e.action??"attached",e.now)}catch(a){throw o&&i&&mo(e.targetCacheDir,i),a}finally{n&&q(n,{recursive:!0,force:!0}),r.release()}}function Ls(e,t,r,n){let i=fn(e,r.dbPath,t);if(i)return{kind:"bypassed",reason:i};try{let o=n??oe(e);if(!o)return{kind:"missed",reason:"Git worktree identity is unavailable"};if(!o.clean)return qe(o,r.cacheDir,"missed",void 0,"worktree has uncommitted changes"),{kind:"missed",reason:"worktree has uncommitted changes"};let a=t.languages??nt(e),s=Qe(e,a,yn(t)),c=At(o,s);if(!c)return{kind:"missed",reason:"clean committed snapshot is unavailable"};let d=$(c);if(d)return kt({snapshot:c,manifest:d,targetCacheDir:r.cacheDir,targetProjectRoot:e}),{kind:"attached",generationId:c.generationId};let l=lo(c,e);return l?(d=l.manifest,kt({snapshot:c,manifest:d,targetCacheDir:r.cacheDir,targetProjectRoot:e,action:"peer-imported"}),{kind:"peer-imported",generationId:c.generationId,sourceProjectRoot:l.sourceProjectRoot}):(qe(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 Os(e,t,r,n){let i=fn(e,r.dbPath,t);if(i)return{kind:"bypassed",reason:i};try{let o=n??oe(e);if(!o)return{kind:"missed",reason:"Git worktree identity is unavailable"};if(!o.clean)return qe(o,r.cacheDir,"missed",void 0,"worktree is not a clean committed snapshot"),{kind:"missed",reason:"worktree is not a clean committed snapshot"};let a=t.languages??nt(e),s=Qe(e,a,yn(t)),c=At(o,s);if(!c)return qe(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=$(c);if(d)return Re(r.cacheDir,e,s)?(Dt(c,r.cacheDir,"local-fresh"),{kind:"local-fresh"}):(kt({snapshot:c,manifest:d,targetCacheDir:r.cacheDir,targetProjectRoot:e}),{kind:"attached",generationId:c.generationId});let l=jt(r.cacheDir);return!l||JSON.stringify(l.fingerprint)!==JSON.stringify(s)||JSON.stringify([...l.indexedLanguages??[]].sort())!==JSON.stringify([...a].sort())?{kind:"missed",reason:"local metadata does not match the clean worktree snapshot"}:Re(r.cacheDir,e,s)?(gn({snapshot:c,sourceCacheDir:r.cacheDir,sourceProjectRoot:e,sourceStillValid:()=>{let p=oe(e);return(p?At(p,s):void 0)?.generationId===c.generationId}}),Dt(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 Ms(e,t={}){let r=t.timeoutMs??3e4,n=t.pollMs??100,i=t.now??re,o=i()+r,a=u(e.repositoryCacheDir,"locks"),s=u(a,`${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($(e))return{kind:"generation-ready"};let d=Te(s,{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 io(Math.min(n,l))}return $(e)?{kind:"generation-ready"}:{kind:"timeout"}}function Dt(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:_t(i)};return Nt(e.repositoryCacheDir,o,!0),o}function _s(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:_t(n)};return Nt(e.repositoryCacheDir,i,!0),i}function qe(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()},a={...o,ownershipChecksum:_t(o)};return Nt(Ge(e.repositoryId),a,!1),a}function _t(e){return Sn(JSON.stringify({version:1,repositoryId:e.repositoryId,worktreeId:e.worktreeId,projectRoot:we(e.projectRoot),localCacheDir:we(e.localCacheDir)}))}function mn(e){let t=JSON.parse(e);if(t.version!==Lt||t.artifactCatalogVersion!==be||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!==Ne||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(je(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 ve(e,t,r=384){return Ce(e,t,{mode:r})}function lo(e,t){for(let r of Jt(t)){if(we(r.path)===we(t))continue;let n=ze(r.path),i=jt(n);if(!(!i||JSON.stringify(i.fingerprint)!==JSON.stringify(e.fingerprint)||JSON.stringify([...i.indexedLanguages??[]].sort())!==JSON.stringify([...e.fingerprint.languages].sort()))&&Re(n,r.path,e.fingerprint))try{return{manifest:gn({snapshot:e,sourceCacheDir:n,sourceProjectRoot:r.path}).manifest,sourceProjectRoot:r.path}}catch{continue}}return null}function uo(e,t,r){ee(e,{recursive:!0}),G(u(e,so),{version:1,repositoryId:t,worktreeId:r},{spacing:2,trailingNewline:!0})}function sn(e){try{let t=_e(e),r=cn("sha256");for(let n of t.files){let i=A(e,n),o=Be(i).size;r.update(n).update("\0").update(String(o)).update("\0"),Bt(i,{inputKind:"source-generation artifact",maxBytes:R},a=>r.update(a)),r.update("\0")}return r.digest("hex")}catch{return null}}function jt(e){try{let t=Ae(E(u(e,"meta.json"),{inputKind:"reindex metadata",maxBytes:v}));return(t.kind==="legacy"||t.kind==="supported")&&t.capabilities.publishableGeneration?t.metadata:void 0}catch{return}}function yn(e){return{pnpmWorkspaces:e.indexer?.typescript?.pnpmWorkspaces,typescriptProjectMode:e.indexer?.typescript?.projectMode,typescriptProjects:e.indexer?.typescript?.projects,clojureConfigPath:e.indexer?.clojure?.configPath}}function po(e,t){let r=He(e.languages,e);return JSON.stringify(r)===JSON.stringify(t)}function Ft(e){return u(e.repositoryCacheDir,"generations",e.generationId)}function Nt(e,t,r){let n=er(e,{waitMs:5e3});if(!n)throw new Error("repository cache cleanup is busy");try{if(r){let o=t.activeGenerationId??t.baseGenerationId;if(!o||!B(u(e,"generations",o)))throw new Error("shared generation disappeared before its lease was attached")}let i=u(e,"worktrees");ee(i,{recursive:!0}),G(u(i,`${t.worktreeId}.json`),t,{spacing:2,trailingNewline:!0}),uo(t.localCacheDir,t.repositoryId,t.worktreeId)}finally{n.release()}}function fo(e,t){let r=u(t,".rollback"),n=new Map,i=new Map;ee(r,{recursive:!0});for(let s of["index.scip","index.db","meta.json"]){let c=u(e,s),d=B(c);n.set(s,d),d&&ve(c,u(r,"stable",s))}for(let s of Mt){let c=u(e,s),d=B(c);if(d){let l=Tt(c);if(!l.isDirectory()||l.isSymbolicLink())throw new Error(`managed artifact path is not a directory: ${s}`)}i.set(s,d)}let o=u(e,ce),a=B(o);return a&&hn(o,u(r,"sqlite-generations")),{root:r,stableFiles:n,managedDirectories:i,generationStoreExisted:a}}function go(e,t,r){for(let n of Mt){let i=u(t,n);if(r.managedDirectories.get(n)){let a=u(r.root,"managed",n);ee(Ct(a),{recursive:!0}),I(()=>U(i,a))}let o=u(e,n);B(o)&&I(()=>U(o,i))}}function mo(e,t){for(let i of Mt){let o=u(e,i),a=u(t.root,"managed",i);t.managedDirectories.get(i)?B(a)&&(q(o,{recursive:!0,force:!0}),I(()=>U(a,o))):q(o,{recursive:!0,force:!0})}for(let[i,o]of t.stableFiles){let a=u(e,i);if(!o){q(a,{force:!0});continue}let s=`${a}.shared-restore-${no()}`;ve(u(t.root,"stable",i),s),I(()=>q(a,{force:!0})),I(()=>U(s,a))}let r=u(e,ce);q(r,{recursive:!0,force:!0});let n=u(t.root,"sqlite-generations");t.generationStoreExisted&&B(n)&&I(()=>U(n,r))}function hn(e,t){ee(t,{recursive:!0});for(let r of ln(e,{withFileTypes:!0})){let n=u(e,r.name),i=u(t,r.name);if(r.isSymbolicLink())throw new Error(`managed cache backup cannot contain a symlink: ${n}`);r.isDirectory()?hn(n,i):r.isFile()&&ve(n,i)}}function yo(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 Re(e,t,r,n=!0,i=!0){try{let o=jt(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 a=_e(e),s=Et(u(e,"index.db"),u(e,"meta.json"));if(n?s.state!=="current":s.state==="invalid"||s.state==="drifted")return xe(`source validation rejected SQLite generation state ${s.state}`),!1;let c=new oo(u(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=qt(t),p=(i?a.files.filter(h=>h.endsWith(".scip")):["index.scip"]).every(h=>{let D=pn(S(A(e,h),{inputKind:"shared SCIP validation artifact",maxBytes:R})).metadata?.projectRoot,y=D!==void 0&&K(D,d);return y||xe(`source validation rejected SCIP root for ${h}: ${String(D)}`),y});return p||xe("source validation rejected SCIP project roots"),p}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 qt(e){try{return nn(un(e)).href}catch{return nn(we(e)).href}}function Sn(e){return cn("sha256").update(e).digest("hex")}function Fs(e){return typeof e=="object"&&e!==null}function Ns(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")?e:null}export{Kt as a,ho as b,z as c,Ae as d,Ro as e,Xt as f,bn as g,vo as h,ke as i,Zt as j,er as k,T as l,ko as m,zo as n,pr as o,Fs as p,Ns as q,nt as r,Oa as s,$a as t,za as u,sa as v,ca as w,da as x,la as y,ua as z,ba as A,Ia as B,xa as C,wa as D,Kr as E,Qi as F,rs as G,ns as H,Et as I,At as J,fn as K,ks as L,$ as M,Ds as N,gn as O,kt as P,Ls as Q,Os as R,Ms as S,Dt as T,_s as U,_t as V};
|
|
21
|
-
//# sourceMappingURL=chunk-QW7EP6WI.js.map
|