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-Q72QSKXC.js
DELETED
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{$a as Jn,Ab as er,Bb as tr,Cb as nr,Eb as rr,Fb as ir,Gb as or,Hb as Ae,O as Wn,P as Gn,Z as Te,Za as re,_a as qn,ab as ie,bb as Fe,cb as pe,db as Hn,eb as zn,fb as Xn,gb as Kn,hb as Yn,k as Ee,lb as ht,qb as Qn,sb as Zn}from"./chunk-3JSXXYTZ.js";import{d as sn,e as it}from"./chunk-DO6WQD2T.js";import{$a as Bn,A as k,B as de,Ba as pt,C as Z,Ca as Pn,D as st,Da as gt,E as ln,Ea as ft,F as ct,Fa as In,G as dn,Ga as kn,H as R,Ha as wn,I as pn,Ia as En,J as A,Ja as Tn,Ka as Fn,L as ve,La as An,M as ut,Ma as _n,N as gn,Na as Ln,Oa as Dn,P as fn,Pa as On,Qa as jn,R as ee,Ra as Cn,Sa as ke,Ta as Mn,U as mn,V as hn,Va as mt,Wa as Nn,X as L,Xa as $n,Y as yn,Ya as we,ab as Vn,bb as Un,ea as Pe,fa as te,ha as ne,j as ot,ja as Sn,ma as bn,qa as Ie,ra as Rn,s as at,sa as lt,ta as xn,ua as vn,va as dt,x as cn,xa as V,y as un,ya as U,z as xe,za as W}from"./chunk-2X7V4HS4.js";import{B as an,C as rt,E as B,c as be,h as nn,i as K,j as Y,k as Ze,l as et,m as Re,n as tt,o as $,p as F,q as _,r as rn,v as on,w as le,x as Q,y as nt}from"./chunk-SNNWPCN7.js";import{createHash as Lu}from"crypto";import{existsSync as E,mkdirSync as Xe,mkdtempSync as Du,readdirSync as to,renameSync as no,rmSync as ce,statSync as Ou}from"fs";import{basename as ze,dirname as y,extname as ju,join as w,resolve as Hi}from"path";import{platform as Cu}from"os";import{execFileSync as ar}from"child_process";import{createRequire as So}from"module";import{existsSync as bo}from"fs";import{platform as ge,arch as sr}from"os";var fe="v0.8.1",yt="https://github.com/sourcegraph/scip",_e=`github.com/sourcegraph/scip/cmd/scip@${fe}`,cr=So(import.meta.url),ur="CODEBASEIQ_SCIP_BIN";function Ro(e){if(e.isOnPath("scip"))return{source:"path",path:"scip"};let t=e.env[ur];if(t&&e.fileExists(t))return{source:"env",path:t};if(e.platform==="win32"){let n=e.resolveSidecar(e.arch);if(n&&e.fileExists(n))return{source:"sidecar",path:n}}return null}function xo(e){for(let t of e==="arm64"?["arm64","x64"]:[e])try{return cr.resolve(`codebaseiq-windows/scip-win32-${t}.exe`)}catch{}return null}function oe(e=process.env){let t=Ro({platform:ge(),arch:sr(),env:e,isOnPath:re,fileExists:bo,resolveSidecar:xo});return t?.source==="path"?Jn("scip")??t.path:t?.path??null}function kl(){return oe()!==null}function vo(){let e=oe();if(!e)return null;try{return ar(e,["--version"],{stdio:"pipe",windowsHide:!0,timeout:1e4,killSignal:"SIGKILL"}).toString().trim()}catch{return null}}function Po(){let e=ge(),t=sr(),n,r,i;switch(e){case"darwin":n="darwin",i="tar.gz";break;case"linux":n="linux",i="tar.gz";break;default:return null}switch(t){case"arm64":r="arm64";break;case"x64":r="amd64";break;default:return null}let o=`scip-${n}-${r}.${i}`;return{url:`${yt}/releases/download/${fe}/${o}`,filename:o}}function wl(){let e=Po();if(console.log("\nThe `scip` CLI is required but not found on PATH.\n"),ge()==="darwin"||ge()==="linux")console.log("Install the reviewed version with Go:"),console.log(` go install ${_e}
|
|
3
|
-
`),console.log("Or download that exact release manually:");else if(ge()==="win32"){let t=Io();console.log("On Windows the scip binary ships via the npm sidecar package codebaseiq-windows,"),console.log("installed automatically with codebaseiq. If it is missing:"),console.log(` npm install -g ${t}`),console.log(`Or set ${ur} to a local scip.exe path.
|
|
4
|
-
`),console.log("Upstream release page:")}else console.log("Download from:");console.log(e?` ${e.url}
|
|
5
|
-
`:` ${yt}/releases/tag/${fe}
|
|
6
|
-
`),console.log("After installing, ensure `scip` is on your PATH and run `codebaseiq reindex`.")}function Io(){let t=cr("../../package.json").optionalDependencies?.["codebaseiq-windows"];if(!t||!/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(t))throw new Error("codebaseiq package metadata does not declare an exact Windows sidecar version.");return`codebaseiq-windows@${t}`}function lr(e){if(re("go")){e(`Installing immutable ${_e} via go install into the Go bin directory (GOBIN or GOPATH/bin); expected executable: scip.`);try{if(ar("go",["install",_e],{stdio:"inherit",windowsHide:!0,timeout:3e5,env:process.env}),re("scip")){let t=oe(),n=vo();if(t&&n&&n.includes(fe))return e(`Successfully installed ${_e}; resolved executable: ${t}; reported version: ${n}.`),!0;e(`go install completed, but the resolved scip executable did not report ${fe} (executable: ${t??"unresolved"}; version: ${n??"unavailable"}).`)}}catch(t){let n=t instanceof Error?t.message:String(t);e(`go install failed: ${n}`)}}return e("Could not auto-install scip CLI."),e(`Install manually from: ${yt}/releases`),!1}import{execFileSync as ko}from"child_process";import{constants as wo,copyFileSync as dr,statSync as Eo}from"fs";import{platform as To}from"os";var Fo=Object.freeze({size:e=>Eo(e).size,clone:_o,copy:(e,t)=>dr(e,t)}),Ao=new Set(["ENOSYS","ENOTSUP","EOPNOTSUPP","EINVAL","EXDEV","ENOTTY"]);function G(e,t,n=Fo){let r=n.size(e);try{return n.clone(e,t),{method:"reflink",bytes:r}}catch(i){if(!Do(i))throw i}return n.copy(e,t),{method:"copy",bytes:r}}function _o(e,t){if(To()!=="darwin"){dr(e,t,wo.COPYFILE_FICLONE_FORCE);return}try{ko("/bin/cp",["-c",e,t],{timeout:6e4,maxBuffer:64*1024,stdio:["ignore","ignore","pipe"],windowsHide:!0})}catch(n){throw Lo(n)}}function Lo(e){let t=e?.stderr,n=Buffer.isBuffer(t)?t.toString("utf8"):t??"";return/operation not supported|not supported/i.test(n)?Object.assign(e instanceof Error?e:new Error(String(e)),{code:"ENOTSUP"}):/cross-device link/i.test(n)?Object.assign(e instanceof Error?e:new Error(String(e)),{code:"EXDEV"}):e}function Do(e){let t=e?.code;return t!==void 0&&Ao.has(t)}function pr(){return{reflinkedBytes:0,fallbackCopiedBytes:0}}function q(e,t){t.method==="reflink"?e.reflinkedBytes+=t.bytes:e.fallbackCopiedBytes+=t.bytes}import Oo from"better-sqlite3";import{execFileSync as jo}from"child_process";import{existsSync as Co,readdirSync as Mo}from"fs";import{extname as Le,join as No}from"path";function J(e={}){return{id:"auxiliary-documents",facts:["auxiliary-document"],run:t=>gr({projectRoot:t.projectRoot,dbPath:t.dbPath,extensions:e.extensions,onStatus:t.onStatus})}}function gr(e){let t=new Set((e.extensions??Wn).map(o=>o.toLowerCase()));if(t.size===0)return{scanned:0,inserted:0,existing:0};if(!Co(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let n=yn(e.projectRoot),r=$o(e.projectRoot,t).filter(o=>!n.isIgnored(o)),i=new Oo(e.dbPath);try{let o=Vo(i,r),a=i.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
|
|
7
|
-
VALUES (?, ?, NULL, ?)`),c=i.transaction(l=>{let d=0;for(let p of l){if(o.has(p))continue;let g=bn(e.projectRoot,p,{inputKind:"auxiliary source file"}),f=a.run(Uo(p),p,g);d+=Number(f.changes)}return d})(r),u={scanned:r.length,inserted:c,existing:r.length-c};return e.onStatus?.(`Augmented SQLite documents with ${c} auxiliary source file${c===1?"":"s"} (${u.existing} already present).`),u}finally{i.close()}}function $o(e,t){let n=Bo(e,t);if(n)return n;let r=[],i=o=>{let a=o?No(e,o):e,s;try{s=Mo(a,{withFileTypes:!0})}catch{return}for(let c of s){if(Gn.has(c.name))continue;let u=o?`${o}/${c.name}`:c.name;if(c.isDirectory()){i(u);continue}t.has(Le(c.name).toLowerCase())&&r.push(u)}};return i(""),r.sort()}function Bo(e,t){try{return jo("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL"}).split(`
|
|
8
|
-
`).filter(r=>r&&t.has(Le(r).toLowerCase())).sort()}catch{return null}}function Vo(e,t){let n=new Set,r=500;for(let i=0;i<t.length;i+=r){let o=t.slice(i,i+r),a=e.prepare(`SELECT relative_path FROM documents WHERE relative_path IN (${o.map(()=>"?").join(",")})`).all(...o);for(let s of a)n.add(s.relative_path)}return n}function Uo(e){return Le(e).toLowerCase()===".vue"?"vue":Le(e).replace(/^\./,"").toLowerCase()||"source"}import{dirname as Wo,join as Go}from"path";function fr(e={}){return{id:"runtime-boundaries",facts:["runtime-boundary-observation","runtime-boundary-link"],run:({projectRoot:t,dbPath:n,onStatus:r})=>{let i=new L({projectRoot:t,dbPath:n,indexPath:e.indexPath??Go(Wo(n),"index.scip")}),o,a=!1,s=!1;try{let u=e.reuseExisting||e.affectedFiles?rr(i):null;e.reuseExisting&&u?.extractorVersion===er?(o=u,a=!0):(o=tr(i,{...u?{previousGraph:u}:{},...e.affectedFiles?{affectedFiles:e.affectedFiles}:{}}),s=(o.coverage.filesReused??0)>0)}finally{i.close()}a||nr(n,o);let c={reused:a,incrementallyUpdated:s,observations:o.observations.length,links:o.links.length,frontiers:o.frontiers.length,filesScanned:o.coverage.filesScanned,errors:o.coverage.extractionErrors.length,phases:o.coverage.phases};return r?.(c.reused?`Reused ${c.observations} cached runtime-boundary observation(s) and ${c.links} link(s).`:c.incrementallyUpdated?`Incrementally refreshed runtime-boundary observations (${c.filesScanned-(o.coverage.filesReused??0)} file(s) extracted, ${o.coverage.filesReused??0} reused) and rebuilt ${c.links} link(s).`:`Extracted ${c.observations} runtime-boundary observation(s), ${c.links} link(s), and ${c.frontiers} unresolved frontier(s).`),!a&&o.coverage.phases&&r?.(`Runtime-boundary phases: ${o.coverage.phases.map(u=>`${u.id} ${u.durationMs.toFixed(0)}ms`).join(", ")}.`),c}}}import{createHash as aa}from"crypto";import{existsSync as sa}from"fs";import{dirname as ca,join as Rr}from"path";function St(e){let t=new Set;for(let n of e.uncertainty)t.add(n);e.projectIdentityChanged&&t.add("project-identity-changed");for(let n of e.changes)n.kind==="added"&&t.add("file-added"),n.kind==="deleted"&&t.add("file-deleted"),n.inputKind==="config"&&t.add("configuration-changed"),n.inputKind==="ambient"&&t.add("ambient-declaration-changed"),n.inputKind==="other"&&t.add("unclassified-input");return{fullProject:t.size>0,reasons:[...t].sort()}}function De(e,t,n){let r=e.changes.map(s=>s.path).sort();if(r.length===0&&!e.projectIdentityChanged&&e.uncertainty.length===0)return{mode:"none",changedFiles:r,affectedFiles:[],reasons:[]};let i=new Set(n),o=St(e),a=new Set(o.reasons);return r.some(s=>!i.has(s))&&a.add("changed-file-outside-project"),t===null?(a.add("dependency-graph-unavailable"),mr(r,i,a)):a.size>0?mr(r,i,a):{mode:"closure",changedFiles:r,affectedFiles:qo(r,t,i),reasons:[]}}function mr(e,t,n){return{mode:"full-project",changedFiles:e,affectedFiles:[...t].sort(),reasons:[...n].sort()}}function qo(e,t,n){let r=new Map;for(let[a,s]of t)if(n.has(a))for(let c of s){if(!n.has(c))continue;let u=r.get(c)??new Set;u.add(a),r.set(c,u)}let i=new Set(e),o=[...e];for(let a=0;a<o.length;a+=1){let s=o[a];if(s!==void 0)for(let c of r.get(s)??[])i.has(c)||(i.add(c),o.push(c))}return[...i].sort()}import{appendFileSync as Jo,existsSync as Ho,mkdirSync as zo,renameSync as Xo,rmSync as Ko,statSync as Yo,truncateSync as Qo}from"fs";import{basename as Zo,dirname as ea}from"path";var ae=".previous",ta=".rotation.lock",na=2e3,bt=class extends Error{constructor(n,r){super(`Timed out after ${r}ms waiting for rotating JSONL lock: ${n}`);this.lockPath=n;this.timeoutMs=r;this.name="RotatingJsonlLockTimeoutError"}lockPath;timeoutMs;code="ROTATING_JSONL_LOCK_TIMEOUT"},Rt=class extends Error{constructor(n){super(`Rotating JSONL lock ownership changed before release: ${n}`);this.lockPath=n;this.name="RotatingJsonlLockReleaseError"}lockPath;code="ROTATING_JSONL_LOCK_RELEASE_FAILED"},hr=Object.freeze({monotonicNow:R,wait(e){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)},tryAcquireLock(e,t){let n=ve(e,{kind:"rotating-jsonl",detail:{target:Zo(t)}});return n.kind==="acquired"?{kind:"acquired",lock:n.lock}:{kind:"contended"}},makeDirectory(e){zo(e,{recursive:!0})},exists:Ho,readBytes(e){return $(e,{maxBytes:Re,inputKind:"rotating JSONL segment"})},size(e){return Yo(e).size},truncate:Qo,remove(e){Ko(e,{force:!0})},rename:Xo,append:Jo});function Oe(e,t,n){let r=n.runtime??hr,i=JSON.stringify(t);if(i===void 0)throw new TypeError("Rotating JSONL records must be JSON-serializable values.");let o=Buffer.from(`${i}
|
|
9
|
-
`),a=Math.max(1,Math.floor(n.maxSegmentBytes),o.length);return Sr(e,n.lockTimeoutMs,r,()=>{r.makeDirectory(ea(e));let s=ra(e,Re,r);n.onPhase?.("tail-repaired");let c=`${e}${n.previousSuffix??ae}`,u=!1,l=!1;return r.exists(e)&&r.size(e)+o.length>a&&(r.exists(c)&&(r.remove(c),l=!0),n.onPhase?.("previous-pruned"),r.rename(e,c),u=!0,n.onPhase?.("current-rotated")),r.append(e,o),n.onPhase?.("record-appended"),{lineBytes:o.length,segmentLimitBytes:a,repairedTailBytes:s,rotated:u,prunedPrevious:l}})}function yr(e,t={}){let n=t.runtime??hr,r=ia(t.maxSegmentBytes);return Sr(e,t.lockTimeoutMs,n,()=>{let i=[],o=0,a=`${e}${t.previousSuffix??ae}`;for(let s of[a,e]){if(!n.exists(s))continue;let c=oa(br(s,r,n));i.push(...c.lines),o+=c.partialTailBytes}return{lines:i,ignoredPartialTailBytes:o}})}function Sr(e,t,n,r){let i=`${e}${ta}`,o=Math.max(0,t??na),a=n.monotonicNow()+o,s;for(;;){let p=n.tryAcquireLock(i,e);if(p.kind==="acquired"){s=p.lock;break}let g=a-n.monotonicNow();if(g<=0)throw new bt(i,o);n.wait(Math.min(5,g))}let c=!1,u,l;try{l=r()}catch(p){c=!0,u=p}let d=!1;try{d=s.release()}catch(p){if(!c)throw p}if(c)throw u;if(!d)throw new Rt(i);return l}function ra(e,t,n){if(!n.exists(e))return 0;let r=br(e,t,n);if(r.length===0||r[r.length-1]===10)return 0;let i=r.lastIndexOf(10),o=i<0?0:i+1;return n.truncate(e,o),r.length-o}function ia(e){let t=e??Re;if(!Number.isSafeInteger(t)||t<=0)throw new RangeError(`maxSegmentBytes must be a positive safe integer; received ${t}`);return t}function br(e,t,n){let r=n.size(e);if(r>t)throw new tt("rotating JSONL segment",e,"too-large",r,t);let i=n.readBytes(e),o=n.size(e);if(o!==r||i.byteLength!==r)throw new tt("rotating JSONL segment",e,"changed-during-read",o,t);return i}function oa(e){let t=e.lastIndexOf(10),n=t<0?0:t+1;return{lines:e.subarray(0,n).toString("utf8").split(`
|
|
10
|
-
`).filter(i=>i.length>0),partialTailBytes:e.length-n}}var ua="<global-symbols>";function la(e){let t=[];for(let n of e.all(`
|
|
11
|
-
SELECT relative_path, language, position_encoding, text
|
|
12
|
-
FROM documents
|
|
13
|
-
`))t.push({relativePath:n.relative_path,kind:"document",values:[n.language,n.position_encoding,n.text]});for(let n of e.all(`
|
|
14
|
-
SELECT d.relative_path,
|
|
15
|
-
c.chunk_index,
|
|
16
|
-
c.start_line,
|
|
17
|
-
c.end_line,
|
|
18
|
-
hex(c.occurrences) AS occurrences_hex
|
|
19
|
-
FROM chunks c
|
|
20
|
-
JOIN documents d ON d.id = c.document_id
|
|
21
|
-
`))t.push({relativePath:n.relative_path,kind:"chunk",values:[n.chunk_index,n.start_line,n.end_line,n.occurrences_hex]});for(let n of e.all(`
|
|
22
|
-
SELECT d.relative_path,
|
|
23
|
-
r.start_line,
|
|
24
|
-
r.start_char,
|
|
25
|
-
r.end_line,
|
|
26
|
-
r.end_char,
|
|
27
|
-
g.symbol,
|
|
28
|
-
g.display_name,
|
|
29
|
-
g.kind,
|
|
30
|
-
g.documentation,
|
|
31
|
-
CASE WHEN g.signature IS NULL THEN NULL ELSE hex(g.signature) END AS signature_hex,
|
|
32
|
-
g.enclosing_symbol,
|
|
33
|
-
CASE WHEN g.relationships IS NULL THEN NULL ELSE hex(g.relationships) END AS relationships_hex
|
|
34
|
-
FROM defn_enclosing_ranges r
|
|
35
|
-
JOIN documents d ON d.id = r.document_id
|
|
36
|
-
JOIN global_symbols g ON g.id = r.symbol_id
|
|
37
|
-
`))t.push({relativePath:n.relative_path,kind:"definition",values:xt(n,[n.start_line,n.start_char,n.end_line,n.end_char])});for(let n of e.all(`
|
|
38
|
-
SELECT d.relative_path,
|
|
39
|
-
c.chunk_index,
|
|
40
|
-
m.role,
|
|
41
|
-
g.symbol,
|
|
42
|
-
g.display_name,
|
|
43
|
-
g.kind,
|
|
44
|
-
g.documentation,
|
|
45
|
-
CASE WHEN g.signature IS NULL THEN NULL ELSE hex(g.signature) END AS signature_hex,
|
|
46
|
-
g.enclosing_symbol,
|
|
47
|
-
CASE WHEN g.relationships IS NULL THEN NULL ELSE hex(g.relationships) END AS relationships_hex
|
|
48
|
-
FROM mentions m
|
|
49
|
-
JOIN chunks c ON c.id = m.chunk_id
|
|
50
|
-
JOIN documents d ON d.id = c.document_id
|
|
51
|
-
JOIN global_symbols g ON g.id = m.symbol_id
|
|
52
|
-
`))t.push({relativePath:n.relative_path,kind:"mention",values:xt(n,[n.chunk_index,n.role])});for(let n of e.all(`
|
|
53
|
-
SELECT g.symbol,
|
|
54
|
-
g.display_name,
|
|
55
|
-
g.kind,
|
|
56
|
-
g.documentation,
|
|
57
|
-
CASE WHEN g.signature IS NULL THEN NULL ELSE hex(g.signature) END AS signature_hex,
|
|
58
|
-
g.enclosing_symbol,
|
|
59
|
-
CASE WHEN g.relationships IS NULL THEN NULL ELSE hex(g.relationships) END AS relationships_hex
|
|
60
|
-
FROM global_symbols g
|
|
61
|
-
WHERE NOT EXISTS (
|
|
62
|
-
SELECT 1 FROM defn_enclosing_ranges r WHERE r.symbol_id = g.id
|
|
63
|
-
) AND NOT EXISTS (
|
|
64
|
-
SELECT 1 FROM mentions m WHERE m.symbol_id = g.id
|
|
65
|
-
)
|
|
66
|
-
`))t.push({relativePath:ua,kind:"global-symbol",values:xt(n)});return da(t)}function da(e){let t=new Map;for(let r of e){let i=JSON.stringify([r.kind,r.values]),o=t.get(r.relativePath)??[];o.push(i),t.set(r.relativePath,o)}let n=new Map;for(let[r,i]of[...t].sort(([o],[a])=>o.localeCompare(a))){let o=aa("sha256");for(let a of i.sort())o.update(String(Buffer.byteLength(a))),o.update(":"),o.update(a),o.update(`
|
|
67
|
-
`);n.set(r,o.digest("hex"))}return n}function pa(e,t){let n=[],r=[],i=[],o=[],a=new Set([...e.keys(),...t.keys()]);for(let s of[...a].sort()){let c=e.get(s),u=t.get(s);c===void 0?n.push(s):u===void 0?i.push(s):c!==u?r.push(s):o.push(s)}return{addedFiles:n,modifiedFiles:r,deletedFiles:i,changedFiles:[...n,...r,...i].sort(),unchangedFiles:o}}function vt(e,t,n){let r=new Set(e.affectedFiles),i=new Set(t.changedFiles),o=e.mode==="full-project"?[]:t.changedFiles.filter(c=>!r.has(c)),a=e.affectedFiles.filter(c=>!i.has(c)).sort(),s=t.changedFiles.length-o.length;return{passed:o.length===0,recall:t.changedFiles.length===0?1:s/t.changedFiles.length,affectedRatio:n===0?0:e.affectedFiles.length/n,predictedFiles:[...e.affectedFiles].sort(),actualFiles:[...t.changedFiles],missingFiles:o,extraFiles:a}}function Pt(e,t=ya){let n=t.wallNow===void 0&&t.monotonicNow===void 0,r=t.monotonicNow??t.now,i=t.wallNow??t.now,o=r(),a=(u,l)=>{let d=r();return Er(e.refreshResult,u,n?d:i(),Math.max(0,d-o),l)};if(!t.databaseExists(e.previousDbPath))return a("prior-index-unavailable");if(!t.databaseExists(e.candidateDbPath))return a("candidate-index-unavailable");let s=null,c=null;try{s=t.openDatabase(e.projectRoot,e.previousDbPath,e.previousIndexPath),c=t.openDatabase(e.projectRoot,e.candidateDbPath,e.candidateIndexPath);let u=[...new Set([...t.indexedPaths(s),...t.indexedPaths(c)])].sort(),l=xe(e.previousSnapshot,e.currentSnapshot),d=new Set(u),p=l.changes.length>0&&!St(l).fullProject&&l.changes.every(I=>d.has(I.path)),g=De(l,p?t.dependencyGraph(s):new Map,u),f=pa(t.factDigests(s),t.factDigests(c)),m=r();return{version:1,status:"evaluated",refreshResult:e.refreshResult,recordedAt:new Date(n?m:i()).toISOString(),durationMs:Math.max(0,m-o),manifest:l,plan:g,comparison:f,evaluation:vt(g,f,u.length)}}catch(u){return a("oracle-error",u instanceof Error?u.message:String(u))}finally{xr(s),xr(c)}}function Ir(e,t,n,r=Date.now()){return Er(e,t,r,0,n)}function kr(e){let t=ca(e);return{latestPath:Rr(t,"affected-shadow-latest.json"),historyPath:Rr(t,"affected-shadow.jsonl")}}function ld(e,t=n=>rn(n,"affected-shadow source file")){let n=kr(e),r;try{r=JSON.parse(t(n.latestPath))}catch(h){let S=va(h),b=S?"telemetry-missing":xa(h);return C(n,b,S?void 0:h instanceof Error?h.message:String(h))}if(U(r)&&typeof r.version=="number"&&r.version!==1)return C(n,"unsupported-record-version",`Unsupported version ${r.version}.`);if(!ba(r))return C(n,"telemetry-malformed");if(r.status==="unavailable")return Ra(r.reason)?{state:"unavailable",...n,reason:r.reason,recordedAt:r.recordedAt,refreshResult:r.refreshResult,durationMs:r.durationMs,...typeof r.error=="string"?{error:r.error}:{}}:C(n,"telemetry-malformed");if(r.status!=="evaluated")return C(n,"telemetry-malformed");let i=r.plan,o=r.comparison,a=r.evaluation;if(!U(r.manifest)||!U(i)||!U(o)||!U(a))return C(n,"telemetry-malformed");let s=i.mode,c=W(i.affectedFiles),u=W(i.reasons),l=W(o.changedFiles),d=W(a.predictedFiles),p=W(a.actualFiles),g=W(a.missingFiles),f=a.recall,m=a.affectedRatio;if(s!=="none"&&s!=="closure"&&s!=="full-project"||c===null||u===null||l===null||d===null||p===null||g===null||typeof a.passed!="boolean"||!vr(f)||!vr(m))return C(n,"telemetry-malformed");let I=p.length===0?1:(p.length-g.length)/p.length;return!Pr(c,d)||!Pr(l,p)||a.passed!==(g.length===0)||Math.abs(f-I)>Number.EPSILON||g.some(h=>!p.includes(h)||d.includes(h))?C(n,"telemetry-malformed"):{state:a.passed?"passing":"failing",...n,recordedAt:r.recordedAt,refreshResult:r.refreshResult,durationMs:r.durationMs,mode:s,recall:f,affectedRatio:m,predictedFiles:d,actualFiles:p,missingFiles:g,fallbackReasons:u}}function dd(e){if(e.state==="unavailable")return`unavailable (${e.reason})`;let t=e.missingFiles.length>0?`, ${e.missingFiles.length} missed`:"",n=e.fallbackReasons.length>0?`; fallback: ${e.fallbackReasons.join(", ")}`:"";return`${e.state}, ${(e.recall*100).toFixed(1)}% recall, ${e.predictedFiles.length} predicted / ${e.actualFiles.length} changed, ${(e.affectedRatio*100).toFixed(1)}% of project${t}${n}`}function wr(e,t,n=Sa){let r=kr(e);return n.appendHistory(r.historyPath,t),n.writeLatest(r.latestPath,t),r}var ga=8*1024*1024,fa=ae;function ma(e){let t={historyVersion:1,sourceVersion:e.version,refreshResult:e.refreshResult,recordedAt:e.recordedAt,durationMs:e.durationMs};return e.status==="unavailable"?{...t,status:"unavailable",reason:e.reason,...e.error?{error:e.error}:{}}:{...t,status:"evaluated",mode:e.plan.mode,passed:e.evaluation.passed,recall:e.evaluation.recall,affectedRatio:e.evaluation.affectedRatio,predictedFileCount:e.evaluation.predictedFiles.length,actualFileCount:e.evaluation.actualFiles.length,missingFileCount:e.evaluation.missingFiles.length,fallbackReasons:[...e.plan.reasons]}}function ha(e,t,n=ga){Oe(e,ma(t),{maxSegmentBytes:n,previousSuffix:fa})}function xt(e,t=[]){let n=[];for(let r of t)n.push(r);return n.push(e.symbol,e.display_name,e.kind,e.documentation,e.signature_hex,e.enclosing_symbol,e.relationships_hex),n}var ya={now:()=>Date.now(),wallNow:()=>Date.now(),monotonicNow:R,databaseExists:e=>sa(e),openDatabase:(e,t,n)=>new L({projectRoot:e,dbPath:t,indexPath:n}),indexedPaths:e=>Ee(e),dependencyGraph:e=>Te(e),factDigests:e=>la(e)},Sa={appendHistory:ha,writeLatest:(e,t)=>mn(e,t,{spacing:2,trailingNewline:!0})};function Er(e,t,n,r,i){return{version:1,status:"unavailable",refreshResult:e,recordedAt:new Date(n).toISOString(),durationMs:r,reason:t,...i?{error:i}:{}}}function xr(e){try{e?.close()}catch{}}function ba(e){return U(e)&&e.version===1&&typeof e.recordedAt=="string"&&(e.refreshResult==="rebuilt"||e.refreshResult==="reused")&&typeof e.durationMs=="number"&&Number.isFinite(e.durationMs)&&e.durationMs>=0}function Ra(e){return e==="prior-index-unavailable"||e==="candidate-index-unavailable"||e==="oracle-error"}function vr(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1}function Pr(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function C(e,t,n){return{state:"unavailable",...e,reason:t,...n?{error:n}:{}}}function xa(e){return e instanceof SyntaxError?"telemetry-malformed":"telemetry-unreadable"}function va(e){return e instanceof Error&&e.code==="ENOENT"}import{readdirSync as Pa}from"fs";import{isAbsolute as Tr,join as Ia,resolve as ka}from"path";var je="@sourcegraph/scip-typescript@0.4.0",Fr="scip-python-plus@0.7.5",Ar="github.com/sourcegraph/scip-go@v0.2.7",_r="scip-dotnet@0.2.14",wa="scip_dart@1.6.2",Ea={typescript:{language:"typescript",indexerBinary:"scip-typescript",checkCommand:"npx scip-typescript --version",indexArgs:({outputPath:e,pnpmWorkspaces:t,indexerBinary:n,projectPath:r})=>r?{binary:n,args:["index","--output",e,"--no-progress-bar",r]}:t?{binary:n,args:["index","--pnpm-workspaces","--output",e,"--no-progress-bar"]}:{binary:n,args:["index","--output",e,"--no-progress-bar"]},markerFiles:[...k.typescript],installMethods:[{label:"npm",identity:je,destination:"npm global prefix",prerequisite:"npm",binary:"npm",args:["install","-g",je]}],installUrl:"https://github.com/sourcegraph/scip-typescript",bundledNpmPackage:"@sourcegraph/scip-typescript"},javascript:{language:"javascript",indexerBinary:"scip-typescript",checkCommand:"npx scip-typescript --version",indexArgs:({outputPath:e,indexerBinary:t})=>({binary:t,args:["index","--output",e,"--no-progress-bar"]}),markerFiles:[...k.javascript],installMethods:[{label:"npm",identity:je,destination:"npm global prefix",prerequisite:"npm",binary:"npm",args:["install","-g",je]}],installUrl:"https://github.com/sourcegraph/scip-typescript",bundledNpmPackage:"@sourcegraph/scip-typescript"},java:{language:"java",indexerBinary:"scip-java",checkCommand:"scip-java --version",indexArgs:({outputPath:e})=>({binary:"scip-java",args:["index","--output",e]}),markerFiles:[...k.java],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},scala:{language:"scala",indexerBinary:"scip-java",checkCommand:"scip-java --version",indexArgs:({outputPath:e})=>({binary:"scip-java",args:["index","--output",e]}),markerFiles:[...k.scala],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},kotlin:{language:"kotlin",indexerBinary:"scip-java",checkCommand:"scip-java --version",indexArgs:({outputPath:e})=>({binary:"scip-java",args:["index","--output",e]}),markerFiles:[...k.kotlin],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},rust:{language:ie.language,indexerBinary:ie.indexerBinary,checkCommand:`${ie.indexerBinary} --version`,indexArgs:({outputPath:e})=>({binary:ie.indexerBinary,args:["scip",".","--output",e]}),markerFiles:[...k.rust],installMethods:[],installUrl:ie.installUrl},python:{language:"python",indexerBinary:"scip-python-plus",binaryAliases:["scip-python"],checkCommand:"scip-python-plus --version",indexArgs:({outputPath:e,indexerBinary:t})=>({binary:t,args:["index","--output",e,"--project-name","project"]}),markerFiles:[...k.python],installMethods:[{label:"npm",identity:Fr,destination:"npm global prefix",prerequisite:"npm",binary:"npm",args:["install","-g",Fr]}],installUrl:"https://github.com/PlunderStruck/scip-python",bundledNpmPackage:"scip-python-plus"},clojure:{language:"clojure",indexerBinary:"scip-clojure",projectLocalBinaries:["node_modules/.bin/scip-clojure"],checkCommand:"scip-clojure -h",indexArgs:({projectRoot:e,outputPath:t,indexerBinary:n,configPath:r})=>{let i=["-root",e,"-output",t];return r&&i.push("-config",Tr(r)?r:ka(e,r)),{binary:n,args:i}},markerFiles:[...k.clojure],installMethods:[],installUrl:"https://github.com/PlunderStruck/scip-clojure"},ruby:{language:"ruby",indexerBinary:"scip-ruby",checkCommand:"scip-ruby --version",indexArgs:({indexerBinary:e})=>({binary:e,args:["--dir","."]}),defaultOutputPath:"index.scip",markerFiles:[...k.ruby],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-ruby/releases"},go:{language:"go",indexerBinary:"scip-go",checkCommand:"scip-go --version",indexArgs:({outputPath:e})=>({binary:"scip-go",args:["--output",e]}),markerFiles:[...k.go],installMethods:[{label:"go install",identity:Ar,destination:"Go bin directory (GOBIN or GOPATH/bin)",prerequisite:"go",binary:"go",args:["install",Ar]}],installUrl:"https://github.com/sourcegraph/scip-go"},cpp:{language:"cpp",indexerBinary:"scip-clang",checkCommand:"scip-clang --version",indexArgs:({outputPath:e})=>({binary:"scip-clang",args:["--compdb-path","compile_commands.json","--index-output-path",e]}),markerFiles:[...k.cpp],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-clang/releases"},c:{language:"c",indexerBinary:"scip-clang",checkCommand:"scip-clang --version",indexArgs:({outputPath:e})=>({binary:"scip-clang",args:["--compdb-path","compile_commands.json","--index-output-path",e]}),markerFiles:[...k.c],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-clang/releases"},csharp:{language:"csharp",indexerBinary:"scip-dotnet",checkCommand:"scip-dotnet --version",indexArgs:({projectRoot:e,outputPath:t})=>({binary:"scip-dotnet",args:["index",Lr(e,[".sln",".csproj"])??e,"--output",t,"--working-directory",e]}),markerFiles:[...k.csharp],installMethods:[{label:"dotnet",identity:_r,destination:"dotnet global tool directory",prerequisite:"dotnet",binary:"dotnet",args:["tool","install","--global","scip-dotnet","--version","0.2.14"]}],installUrl:"https://github.com/sourcegraph/scip-dotnet/releases"},vb:{language:"vb",indexerBinary:"scip-dotnet",checkCommand:"scip-dotnet --version",indexArgs:({projectRoot:e,outputPath:t})=>({binary:"scip-dotnet",args:["index",Lr(e,[".sln",".vbproj"])??e,"--output",t,"--working-directory",e]}),markerFiles:[...k.vb],installMethods:[{label:"dotnet",identity:_r,destination:"dotnet global tool directory",prerequisite:"dotnet",binary:"dotnet",args:["tool","install","--global","scip-dotnet","--version","0.2.14"]}],installUrl:"https://github.com/sourcegraph/scip-dotnet/releases"},dart:{language:"dart",indexerBinary:"scip-dart",checkCommand:"scip-dart --version",indexArgs:({indexerBinary:e,outputPath:t})=>({binary:e,args:["--output",t]}),markerFiles:[...k.dart],installMethods:[{label:"dart pub",identity:wa,destination:"Dart pub global cache",prerequisite:"dart",binary:"dart",args:["pub","global","activate","scip_dart","1.6.2"]}],installUrl:"https://github.com/Workiva/scip-dart/releases"},php:{language:"php",indexerBinary:"scip-php",projectLocalBinaries:["vendor/davidrjenni/scip-php/bin/scip-php","vendor/bin/scip-php"],checkCommand:"scip-php --version",indexArgs:({indexerBinary:e})=>Tr(e)?{binary:"php",args:["-d","error_reporting=E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED",e]}:{binary:e,args:[]},defaultOutputPath:"index.scip",markerFiles:[...k.php],installMethods:[],installUrl:"https://github.com/davidrjenni/scip-php/releases"}};function Dr(e){if(!(e.projectPath||e.pnpmWorkspaces)){if(e.language==="typescript")return"{}";if(e.language==="javascript")return'{"compilerOptions":{"allowJs":true}}'}}function It(e){return Ea[e]}function Lr(e,t){let n;try{n=Pa(e)}catch{return null}for(let r of t)for(let i of n)if(i.endsWith(r))return Ia(e,i);return null}import{createHash as Ta}from"crypto";import{existsSync as Or,rmSync as jr}from"fs";import{resolve as Fa}from"path";import Nr from"better-sqlite3";var Aa={documents:[{name:"id",type:"INTEGER",notnull:0,pk:1},{name:"language",type:"TEXT",notnull:0,pk:0},{name:"relative_path",type:"TEXT",notnull:1,pk:0},{name:"position_encoding",type:"TEXT",notnull:0,pk:0},{name:"text",type:"TEXT",notnull:0,pk:0}],chunks:[{name:"id",type:"INTEGER",notnull:0,pk:1},{name:"document_id",type:"INTEGER",notnull:1,pk:0},{name:"chunk_index",type:"INTEGER",notnull:1,pk:0},{name:"start_line",type:"INTEGER",notnull:1,pk:0},{name:"end_line",type:"INTEGER",notnull:1,pk:0},{name:"occurrences",type:"BLOB",notnull:1,pk:0}],global_symbols:[{name:"id",type:"INTEGER",notnull:0,pk:1},{name:"symbol",type:"TEXT",notnull:1,pk:0},{name:"display_name",type:"TEXT",notnull:0,pk:0},{name:"kind",type:"INTEGER",notnull:0,pk:0},{name:"documentation",type:"TEXT",notnull:0,pk:0},{name:"signature",type:"BLOB",notnull:0,pk:0},{name:"enclosing_symbol",type:"TEXT",notnull:0,pk:0},{name:"relationships",type:"BLOB",notnull:0,pk:0}],mentions:[{name:"chunk_id",type:"INTEGER",notnull:1,pk:1},{name:"symbol_id",type:"INTEGER",notnull:1,pk:2},{name:"role",type:"INTEGER",notnull:1,pk:3}],defn_enclosing_ranges:[{name:"id",type:"INTEGER",notnull:0,pk:1},{name:"document_id",type:"INTEGER",notnull:1,pk:0},{name:"symbol_id",type:"INTEGER",notnull:1,pk:0},{name:"start_line",type:"INTEGER",notnull:1,pk:0},{name:"start_char",type:"INTEGER",notnull:1,pk:0},{name:"end_line",type:"INTEGER",notnull:1,pk:0},{name:"end_char",type:"INTEGER",notnull:1,pk:0}]},_a={idx_chunks_line_range:{table:"chunks",columns:["document_id","start_line","end_line"]},idx_defn_enclosing_ranges_document:{table:"defn_enclosing_ranges",columns:["document_id","start_line","end_line"]},idx_defn_enclosing_ranges_symbol_id:{table:"defn_enclosing_ranges",columns:["symbol_id"]},idx_mentions_symbol_id_role:{table:"mentions",columns:["symbol_id","role"]}};function $r(e){let t=R(),n=La(e.affectedFiles);if(Da(e.previousDbPath,e.miniDbPath,e.candidateDbPath),jr(e.candidateDbPath,{force:!0}),!Or(e.previousDbPath))throw new Error("previous SQLite generation is unavailable");if(!Or(e.miniDbPath))throw new Error("incremental SQLite mini database is unavailable");Cr(e.previousDbPath,"previous SQLite generation",!1),Cr(e.miniDbPath,"incremental SQLite mini database");let r=G(e.previousDbPath,e.candidateDbPath);e.writeTelemetry&&q(e.writeTelemetry,r);let i=null;try{i=new Nr(e.candidateDbPath,{fileMustExist:!0}),i.pragma("busy_timeout = 5000"),i.pragma("foreign_keys = ON"),i.prepare("ATTACH DATABASE ? AS incremental").run(e.miniDbPath),kt(i,"main","candidate SQLite generation"),kt(i,"incremental","incremental SQLite mini database"),Oa(i,n),ja(i,n.length);let o=wt(i,"main",!0),a=M(i,"SELECT COUNT(*) AS value FROM main.documents");i.transaction(()=>{Ca(i),Ma(i),Na(i),e.onStage?.("after-delete"),$a(i),e.onStage?.("after-symbol-reconciliation"),Ba(i),e.onStage?.("after-insert"),Va(i),Ua(i,n.length,a),e.onStage?.("before-commit")}).immediate(),Br(i,"main","candidate SQLite generation");let u=[...Wa(i)].filter(([l,d])=>o.get(l)!==d).map(([l])=>l).sort();return i.exec("DETACH DATABASE incremental"),i.close(),i=null,{candidateDbPath:e.candidateDbPath,affectedDocumentCount:n.length,changedDocumentPaths:u,durationMs:R()-t}}catch(o){try{i?.close()}finally{jr(e.candidateDbPath,{force:!0})}throw new Error(`Incremental SQLite publication rejected: ${o instanceof Error?o.message:String(o)}`,{cause:o})}}function La(e){if(e.length===0)throw new Error("incremental SQLite publication requires affected documents");let t=[...e].sort();for(let n of t)if(!n||n.startsWith("/")||n.includes("\\")||n.split("/").includes(".."))throw new Error(`invalid affected document path: ${n}`);if(new Set(t).size!==t.length)throw new Error("incremental SQLite publication contains duplicate affected documents");return t}function Da(e,t,n){let r=[e,t,n].map(i=>Fa(i));if(new Set(r).size!==r.length)throw new Error("previous, mini, and candidate SQLite paths must be distinct")}function Cr(e,t,n=!0){let r=new Nr(e,{readonly:!0,fileMustExist:!0});try{kt(r,"main",t),n&&Br(r,"main",t)}finally{r.close()}}function kt(e,t,n){for(let[r,i]of Object.entries(Aa)){let a=e.prepare(`PRAGMA ${t}.table_info('${r}')`).all().map(({name:s,type:c,notnull:u,pk:l})=>({name:s,type:c.toUpperCase(),notnull:u,pk:l}));if(JSON.stringify(a)!==JSON.stringify(i))throw new Error(`${n} schema changed for table ${r}`)}for(let[r,i]of Object.entries(_a)){let o=e.prepare(`SELECT tbl_name FROM ${t}.sqlite_master WHERE type = 'index' AND name = ?`).get(r),a=e.prepare(`PRAGMA ${t}.index_info('${r}')`).all().map(s=>s.name);if(o?.tbl_name!==i.table||JSON.stringify(a)!==JSON.stringify(i.columns))throw new Error(`${n} schema changed for index ${r}`)}Mr(e,t,"documents",["relative_path"],n),Mr(e,t,"global_symbols",["symbol"],n)}function Mr(e,t,n,r,i){if(!e.prepare(`PRAGMA ${t}.index_list('${n}')`).all().some(s=>{if(s.unique!==1)return!1;let c=e.prepare(`PRAGMA ${t}.index_info('${s.name}')`).all().map(u=>u.name);return JSON.stringify(c)===JSON.stringify(r)}))throw new Error(`${i} lost the unique ${n}(${r.join(", ")}) constraint`)}function Br(e,t,n){let r=e.prepare(`PRAGMA ${t}.integrity_check`).pluck().get();if(r!=="ok")throw new Error(`${n} failed integrity_check: ${String(r)}`);if(e.prepare(`PRAGMA ${t}.foreign_key_check`).all().length>0)throw new Error(`${n} failed foreign_key_check`)}function Oa(e,t){e.exec("CREATE TEMP TABLE incremental_affected_paths (relative_path TEXT PRIMARY KEY) WITHOUT ROWID");let n=e.prepare("INSERT INTO temp.incremental_affected_paths(relative_path) VALUES (?)");e.transaction(i=>{for(let o of i)n.run(o)})(t)}function ja(e,t){let n=M(e,"SELECT COUNT(*) AS value FROM incremental.documents"),r=M(e,`SELECT COUNT(*) AS value
|
|
68
|
-
FROM main.documents d
|
|
69
|
-
JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path`),i=e.prepare(`SELECT p.relative_path
|
|
70
|
-
FROM temp.incremental_affected_paths p
|
|
71
|
-
LEFT JOIN incremental.documents d ON d.relative_path = p.relative_path
|
|
72
|
-
WHERE d.id IS NULL
|
|
73
|
-
LIMIT 1`).pluck().get(),o=e.prepare(`SELECT d.relative_path
|
|
74
|
-
FROM incremental.documents d
|
|
75
|
-
LEFT JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
|
|
76
|
-
WHERE p.relative_path IS NULL
|
|
77
|
-
LIMIT 1`).pluck().get();if(n!==t||r!==t||i!==void 0||o!==void 0)throw new Error("incremental SQLite mini database does not exactly match the affected document set")}function Ca(e){e.exec(`
|
|
78
|
-
CREATE TEMP TABLE incremental_old_defined_symbols (symbol TEXT PRIMARY KEY) WITHOUT ROWID;
|
|
79
|
-
INSERT OR IGNORE INTO temp.incremental_old_defined_symbols(symbol)
|
|
80
|
-
SELECT g.symbol
|
|
81
|
-
FROM main.defn_enclosing_ranges r
|
|
82
|
-
JOIN main.documents d ON d.id = r.document_id
|
|
83
|
-
JOIN main.global_symbols g ON g.id = r.symbol_id
|
|
84
|
-
JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path;
|
|
85
|
-
INSERT OR IGNORE INTO temp.incremental_old_defined_symbols(symbol)
|
|
86
|
-
SELECT g.symbol
|
|
87
|
-
FROM main.mentions m
|
|
88
|
-
JOIN main.chunks c ON c.id = m.chunk_id
|
|
89
|
-
JOIN main.documents d ON d.id = c.document_id
|
|
90
|
-
JOIN main.global_symbols g ON g.id = m.symbol_id
|
|
91
|
-
JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
|
|
92
|
-
WHERE m.role = 1;
|
|
93
|
-
|
|
94
|
-
CREATE TEMP TABLE incremental_new_defined_symbols (symbol TEXT PRIMARY KEY) WITHOUT ROWID;
|
|
95
|
-
INSERT OR IGNORE INTO temp.incremental_new_defined_symbols(symbol)
|
|
96
|
-
SELECT g.symbol
|
|
97
|
-
FROM incremental.defn_enclosing_ranges r
|
|
98
|
-
JOIN incremental.global_symbols g ON g.id = r.symbol_id;
|
|
99
|
-
INSERT OR IGNORE INTO temp.incremental_new_defined_symbols(symbol)
|
|
100
|
-
SELECT g.symbol
|
|
101
|
-
FROM incremental.mentions m
|
|
102
|
-
JOIN incremental.global_symbols g ON g.id = m.symbol_id
|
|
103
|
-
WHERE m.role = 1;
|
|
104
|
-
`)}function Ma(e){let t=e.prepare(`WITH changed_symbols AS (
|
|
105
|
-
SELECT symbol FROM temp.incremental_old_defined_symbols
|
|
106
|
-
UNION
|
|
107
|
-
SELECT symbol FROM temp.incremental_new_defined_symbols
|
|
108
|
-
), unaffected_definitions AS (
|
|
109
|
-
SELECT g.symbol
|
|
110
|
-
FROM main.defn_enclosing_ranges r
|
|
111
|
-
JOIN main.documents d ON d.id = r.document_id
|
|
112
|
-
JOIN main.global_symbols g ON g.id = r.symbol_id
|
|
113
|
-
LEFT JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
|
|
114
|
-
WHERE p.relative_path IS NULL
|
|
115
|
-
UNION
|
|
116
|
-
SELECT g.symbol
|
|
117
|
-
FROM main.mentions m
|
|
118
|
-
JOIN main.chunks c ON c.id = m.chunk_id
|
|
119
|
-
JOIN main.documents d ON d.id = c.document_id
|
|
120
|
-
JOIN main.global_symbols g ON g.id = m.symbol_id
|
|
121
|
-
LEFT JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
|
|
122
|
-
WHERE m.role = 1 AND p.relative_path IS NULL
|
|
123
|
-
)
|
|
124
|
-
SELECT u.symbol
|
|
125
|
-
FROM unaffected_definitions u
|
|
126
|
-
JOIN changed_symbols c ON c.symbol = u.symbol
|
|
127
|
-
LIMIT 1`).pluck().get();if(typeof t=="string")throw new Error(`symbol definition is shared by affected and unaffected documents: ${t}`)}function Na(e){e.exec(`
|
|
128
|
-
DELETE FROM main.mentions
|
|
129
|
-
WHERE chunk_id IN (
|
|
130
|
-
SELECT c.id
|
|
131
|
-
FROM main.chunks c
|
|
132
|
-
JOIN main.documents d ON d.id = c.document_id
|
|
133
|
-
JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
|
|
134
|
-
);
|
|
135
|
-
DELETE FROM main.chunks
|
|
136
|
-
WHERE document_id IN (
|
|
137
|
-
SELECT d.id
|
|
138
|
-
FROM main.documents d
|
|
139
|
-
JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
|
|
140
|
-
);
|
|
141
|
-
DELETE FROM main.defn_enclosing_ranges
|
|
142
|
-
WHERE document_id IN (
|
|
143
|
-
SELECT d.id
|
|
144
|
-
FROM main.documents d
|
|
145
|
-
JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
|
|
146
|
-
);
|
|
147
|
-
DELETE FROM main.documents
|
|
148
|
-
WHERE relative_path IN (SELECT relative_path FROM temp.incremental_affected_paths);
|
|
149
|
-
`)}function $a(e){e.exec(`
|
|
150
|
-
UPDATE main.global_symbols
|
|
151
|
-
SET display_name = NULL,
|
|
152
|
-
kind = NULL,
|
|
153
|
-
documentation = NULL,
|
|
154
|
-
signature = NULL,
|
|
155
|
-
enclosing_symbol = NULL,
|
|
156
|
-
relationships = NULL
|
|
157
|
-
WHERE symbol IN (SELECT symbol FROM temp.incremental_old_defined_symbols);
|
|
158
|
-
|
|
159
|
-
INSERT OR IGNORE INTO main.global_symbols(
|
|
160
|
-
symbol, display_name, kind, documentation, signature, enclosing_symbol, relationships
|
|
161
|
-
)
|
|
162
|
-
SELECT symbol, display_name, kind, documentation, signature, enclosing_symbol, relationships
|
|
163
|
-
FROM incremental.global_symbols;
|
|
164
|
-
|
|
165
|
-
UPDATE main.global_symbols
|
|
166
|
-
SET display_name = (
|
|
167
|
-
SELECT source.display_name FROM incremental.global_symbols source
|
|
168
|
-
WHERE source.symbol = main.global_symbols.symbol
|
|
169
|
-
),
|
|
170
|
-
kind = (
|
|
171
|
-
SELECT source.kind FROM incremental.global_symbols source
|
|
172
|
-
WHERE source.symbol = main.global_symbols.symbol
|
|
173
|
-
),
|
|
174
|
-
documentation = (
|
|
175
|
-
SELECT source.documentation FROM incremental.global_symbols source
|
|
176
|
-
WHERE source.symbol = main.global_symbols.symbol
|
|
177
|
-
),
|
|
178
|
-
signature = (
|
|
179
|
-
SELECT source.signature FROM incremental.global_symbols source
|
|
180
|
-
WHERE source.symbol = main.global_symbols.symbol
|
|
181
|
-
),
|
|
182
|
-
enclosing_symbol = (
|
|
183
|
-
SELECT source.enclosing_symbol FROM incremental.global_symbols source
|
|
184
|
-
WHERE source.symbol = main.global_symbols.symbol
|
|
185
|
-
),
|
|
186
|
-
relationships = (
|
|
187
|
-
SELECT source.relationships FROM incremental.global_symbols source
|
|
188
|
-
WHERE source.symbol = main.global_symbols.symbol
|
|
189
|
-
)
|
|
190
|
-
WHERE symbol IN (SELECT symbol FROM temp.incremental_new_defined_symbols);
|
|
191
|
-
`)}function Ba(e){let t=M(e,"SELECT COALESCE(MAX(id), 0) AS value FROM main.documents"),n=M(e,"SELECT COALESCE(MAX(id), 0) AS value FROM main.chunks"),r=M(e,"SELECT COALESCE(MAX(id), 0) AS value FROM main.defn_enclosing_ranges");e.prepare(`INSERT INTO main.documents(id, language, relative_path, position_encoding, text)
|
|
192
|
-
SELECT id + ?, language, relative_path, position_encoding, text
|
|
193
|
-
FROM incremental.documents`).run(t),e.prepare(`INSERT INTO main.chunks(id, document_id, chunk_index, start_line, end_line, occurrences)
|
|
194
|
-
SELECT id + ?, document_id + ?, chunk_index, start_line, end_line, occurrences
|
|
195
|
-
FROM incremental.chunks`).run(n,t),e.prepare(`INSERT INTO main.mentions(chunk_id, symbol_id, role)
|
|
196
|
-
SELECT m.chunk_id + ?, target.id, m.role
|
|
197
|
-
FROM incremental.mentions m
|
|
198
|
-
JOIN incremental.global_symbols source ON source.id = m.symbol_id
|
|
199
|
-
JOIN main.global_symbols target ON target.symbol = source.symbol`).run(n),e.prepare(`INSERT INTO main.defn_enclosing_ranges(
|
|
200
|
-
id, document_id, symbol_id, start_line, start_char, end_line, end_char
|
|
201
|
-
)
|
|
202
|
-
SELECT r.id + ?, r.document_id + ?, target.id,
|
|
203
|
-
r.start_line, r.start_char, r.end_line, r.end_char
|
|
204
|
-
FROM incremental.defn_enclosing_ranges r
|
|
205
|
-
JOIN incremental.global_symbols source ON source.id = r.symbol_id
|
|
206
|
-
JOIN main.global_symbols target ON target.symbol = source.symbol`).run(r,t)}function Va(e){e.exec(`
|
|
207
|
-
DELETE FROM main.global_symbols
|
|
208
|
-
WHERE NOT EXISTS (SELECT 1 FROM main.mentions m WHERE m.symbol_id = main.global_symbols.id)
|
|
209
|
-
AND NOT EXISTS (
|
|
210
|
-
SELECT 1 FROM main.defn_enclosing_ranges r WHERE r.symbol_id = main.global_symbols.id
|
|
211
|
-
);
|
|
212
|
-
`)}function Ua(e,t,n){let r=M(e,"SELECT COUNT(*) AS value FROM main.documents"),i=M(e,`SELECT COUNT(*) AS value
|
|
213
|
-
FROM main.documents d
|
|
214
|
-
JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path`);if(r!==n||i!==t)throw new Error("candidate SQLite document counts changed unexpectedly");let o=e.prepare("SELECT relative_path FROM main.documents GROUP BY relative_path HAVING COUNT(*) > 1 LIMIT 1").pluck().get(),a=e.prepare("SELECT symbol FROM main.global_symbols GROUP BY symbol HAVING COUNT(*) > 1 LIMIT 1").pluck().get();if(o!==void 0||a!==void 0)throw new Error("candidate SQLite generation contains duplicate document paths or symbols")}function Wa(e){let t=wt(e,"main",!0),n=wt(e,"incremental",!1);if(JSON.stringify([...t])!==JSON.stringify([...n]))throw new Error("candidate SQLite affected document facts differ from the mini database");return t}function wt(e,t,n){let r=n?"JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path":"",i=e.prepare(`SELECT d.relative_path, d.language, d.position_encoding, d.text
|
|
215
|
-
FROM ${t}.documents d
|
|
216
|
-
${r}
|
|
217
|
-
ORDER BY d.relative_path`).all(),o=e.prepare(`SELECT d.relative_path, c.chunk_index, c.start_line, c.end_line, hex(c.occurrences) AS occurrences
|
|
218
|
-
FROM ${t}.chunks c
|
|
219
|
-
JOIN ${t}.documents d ON d.id = c.document_id
|
|
220
|
-
${r}
|
|
221
|
-
ORDER BY d.relative_path, c.chunk_index, c.start_line, c.end_line, c.id`).all(),a=e.prepare(`SELECT d.relative_path, r.start_line, r.start_char, r.end_line, r.end_char,
|
|
222
|
-
g.symbol, g.display_name, g.kind, g.documentation,
|
|
223
|
-
CASE WHEN g.signature IS NULL THEN NULL ELSE hex(g.signature) END AS signature,
|
|
224
|
-
g.enclosing_symbol,
|
|
225
|
-
CASE WHEN g.relationships IS NULL THEN NULL ELSE hex(g.relationships) END AS relationships
|
|
226
|
-
FROM ${t}.defn_enclosing_ranges r
|
|
227
|
-
JOIN ${t}.documents d ON d.id = r.document_id
|
|
228
|
-
JOIN ${t}.global_symbols g ON g.id = r.symbol_id
|
|
229
|
-
${r}
|
|
230
|
-
ORDER BY d.relative_path, r.start_line, r.start_char, r.end_line, r.end_char, g.symbol`).all(),s=e.prepare(`SELECT d.relative_path, c.chunk_index, m.role, g.symbol
|
|
231
|
-
FROM ${t}.mentions m
|
|
232
|
-
JOIN ${t}.chunks c ON c.id = m.chunk_id
|
|
233
|
-
JOIN ${t}.documents d ON d.id = c.document_id
|
|
234
|
-
JOIN ${t}.global_symbols g ON g.id = m.symbol_id
|
|
235
|
-
${r}
|
|
236
|
-
ORDER BY d.relative_path, c.chunk_index, m.role, g.symbol`).all(),c=new Map;for(let[l,d]of Object.entries({documents:i,chunks:o,definitions:a,mentions:s}))for(let p of d){let g=JSON.stringify([l,p]),f=c.get(p.relative_path)??[];f.push(g),c.set(p.relative_path,f)}let u=new Map;for(let[l,d]of[...c].sort(([p],[g])=>p.localeCompare(g))){let p=Ta("sha256");for(let g of d.sort())p.update(g).update(`
|
|
237
|
-
`);u.set(l,p.digest("hex"))}return u}function M(e,t){return e.prepare(t).get().value}import Ga from"better-sqlite3";var Ce="idx_mentions_definitions",qa=["symbol_id","chunk_id"];function Et(e){let t=new Ga(e),n=[],r=[],i=[];try{return t.transaction(()=>{Ja(t,n),Me(t,"idx_global_symbols_symbol")?.join("\0")==="symbol"&&Vr(t,"global_symbols").some(s=>s.name!=="idx_global_symbols_symbol"&&s.unique&&s.columns.join("\0")==="symbol")?(t.exec('DROP INDEX "idx_global_symbols_symbol"'),r.push("idx_global_symbols_symbol")):Me(t,"idx_global_symbols_symbol")&&i.push("idx_global_symbols_symbol");let o=Me(t,"idx_chunks_doc_id"),a=Vr(t,"chunks").some(s=>s.name!=="idx_chunks_doc_id"&&s.columns.length>1&&s.columns[0]==="document_id");o?.join("\0")==="document_id"&&a?(t.exec('DROP INDEX "idx_chunks_doc_id"'),r.push("idx_chunks_doc_id")):o&&i.push("idx_chunks_doc_id"),t.exec("ANALYZE")})(),{added:n,removed:r,retained:i,analyzed:!0}}catch(o){if(o.code==="SQLITE_NOTADB")return{added:[],removed:[],retained:[],analyzed:!1,skippedReason:"not-a-sqlite-database"};throw o}finally{t.close()}}function Ja(e,t){let n=Ur(e,Ce);if(n){let r=n.columns.join("\0")===qa.join("\0"),i=/\bWHERE\s+role\s*=\s*1\b/iu.test(n.sql??"");if(!r||!i||n.table!=="mentions")throw new Error(`${Ce} exists with an incompatible definition`);return}e.exec(`CREATE INDEX "${Ce}" ON mentions(symbol_id, chunk_id) WHERE role = 1`),t.push(Ce)}function Vr(e,t){return e.prepare(`PRAGMA index_list('${t.replaceAll("'","''")}')`).all().map(n=>({name:n.name,unique:n.unique===1,columns:Me(e,n.name)??[]}))}function Me(e,t){return Ur(e,t)?.columns??null}function Ur(e,t){let n=e.prepare("SELECT tbl_name, sql FROM sqlite_master WHERE type = 'index' AND name = ?").get(t);if(!n)return null;let r=e.prepare(`PRAGMA index_info('${t.replaceAll("'","''")}')`).all().map(i=>i.name);return{table:n.tbl_name,sql:n.sql,columns:r}}import{writeFileSync as Ha}from"fs";function H(e,t){let n=performance.now(),r=e.run(t);return{stageId:e.id,facts:e.facts,durationMs:performance.now()-n,result:r}}async function Gr(e){let t=e.readFingerprint(),n=za(e.cachePath,t);if(n)return e.onCacheHit?.(n.result),n.result;let r=await e.compute();return Xa(e.cachePath,e.readFingerprint(),r),r}function za(e,t){try{let n=JSON.parse(F(e,{maxBytes:Y,inputKind:"post-index augmentation cache"}));return Wr(n.fingerprint)===Wr(t)?{result:n.result}:null}catch{return null}}function Xa(e,t,n){Ha(e,`${JSON.stringify({updatedAt:new Date().toISOString(),fingerprint:t,result:n},null,2)}
|
|
238
|
-
`)}function Wr(e){return JSON.stringify(e)}import{existsSync as qr,statSync as Ka}from"fs";import{dirname as zr,join as Xr}from"path";var Ya="reindex-activity.jsonl",Ne=ae,Qa=1024*1024,Za=1440*60*1e3,Jr=e=>_(e,"reindex activity segment");function $e(e){return Xr(zr(e),Ya)}function es(e){if(e.reused)return 0;let t=Tt(e.indexPath)+Tt(e.dbPath);for(let n of e.shards??[])!n.reused&&n.outputBytes!==null&&(t+=n.outputBytes);return t}function Ft(e,t){let n=t.lastRefresh;if(!n)return{state:"failed",reason:"reindex result has no refresh metadata"};let r=es(t);return At($e(e),{version:1,event:"run",recordedAt:n.completedAt,trigger:n.trigger,result:n.result,durationMs:n.durationMs,estimatedLogicalOutputBytes:r,estimatedWriteBytes:r+(t.writeTelemetry?.fallbackCopiedBytes??0),reflinkedBytes:t.writeTelemetry?.reflinkedBytes??0,fallbackCopiedBytes:t.writeTelemetry?.fallbackCopiedBytes??0,byLanguage:as(t)})}function Kr(e,t){return At($e(e),{version:1,event:"run",recordedAt:t.completedAt,trigger:t.trigger,result:"failed",durationMs:t.durationMs,estimatedLogicalOutputBytes:0})}function Cd(e,t,n=new Date){return At($e(e),{version:1,event:"suppressed",recordedAt:n.toISOString(),trigger:t,reason:"completed-index-is-fresh"})}function ts(e,t,n=Qa,r){Oe(e,t,{maxSegmentBytes:n,previousSuffix:Ne,...r?{runtime:r}:{}})}function ns(e,t=new Date,n=Za,r=Jr){let i=t.getTime(),o=i-n,a={confidence:"complete",recordsRead:0,invalidRecords:0,skippedRecords:0,readErrors:0,ignoredPartialTailBytes:0,windowStartedAt:new Date(o).toISOString(),windowEndedAt:t.toISOString(),runs:0,rebuilt:0,reused:0,failed:0,suppressed:0,estimatedLogicalOutputBytes:0,estimatedWriteBytes:0,reflinkedBytes:0,fallbackCopiedBytes:0,languageAttribution:"complete",attributedRuns:0,unattributedRuns:0,invalidLanguageDetails:0,byLanguage:{},byTrigger:{}},s=$e(e),c=[];if(r===Jr){if(!qr(s)&&!qr(`${s}${Ne}`))return a;try{let u=yr(s,{previousSuffix:Ne});c=u.lines,a.ignoredPartialTailBytes=u.ignoredPartialTailBytes}catch{a.readErrors+=1,a.confidence="unavailable"}}else{let u=0;for(let l of[`${s}${Ne}`,s])try{c.push(...gs(r(l))),u+=1}catch{a.readErrors+=1}u===0?a.confidence="unavailable":a.readErrors>0&&(a.confidence="partial")}for(let u of c){a.recordsRead+=1;let l=rs(u);if(!l){a.invalidRecords+=1,a.confidence!=="unavailable"&&(a.confidence="partial");continue}let{record:d}=l,p=Date.parse(d.recordedAt);if(p<o||p>i){a.skippedRecords+=1;continue}if(a.invalidLanguageDetails=(a.invalidLanguageDetails??0)+l.invalidLanguageDetails,a.byTrigger[d.trigger.kind]=(a.byTrigger[d.trigger.kind]??0)+1,d.event==="suppressed"){a.suppressed+=1;continue}a.runs+=1,a[d.result]+=1,a.estimatedLogicalOutputBytes+=d.estimatedLogicalOutputBytes,a.estimatedWriteBytes=(a.estimatedWriteBytes??0)+(d.estimatedWriteBytes??d.estimatedLogicalOutputBytes),a.reflinkedBytes=(a.reflinkedBytes??0)+(d.reflinkedBytes??0),a.fallbackCopiedBytes=(a.fallbackCopiedBytes??0)+(d.fallbackCopiedBytes??0),d.result!=="failed"&&(l.hasLanguageDetails?a.attributedRuns=(a.attributedRuns??0)+1:a.unattributedRuns=(a.unattributedRuns??0)+1);for(let[g,f]of ls(d.byLanguage)){let m=(a.byLanguage??={})[g]??=ds();m.runs+=1,m[f.result]+=1,m.producedOutputBytes+=f.producedOutputBytes,m.durationMs+=f.durationMs}d.result==="rebuilt"&&a.oldestRebuildAt===void 0&&(a.oldestRebuildAt=d.recordedAt),(d.estimatedWriteBytes??d.estimatedLogicalOutputBytes)>0&&a.oldestWriteAt===void 0&&(a.oldestWriteAt=d.recordedAt)}return a.ignoredPartialTailBytes>0&&a.confidence!=="unavailable"&&(a.confidence="partial"),a.languageAttribution=ps(a),a}function At(e,t){try{return ts(e,t),{state:"recorded"}}catch(n){return{state:"failed",reason:n instanceof Error?n.message:String(n)}}}function rs(e){try{let t=JSON.parse(e);if(!t||typeof t!="object")return null;let n=t;if(n.version!==1||!an(n.recordedAt)||!n.trigger||!os(n.trigger.kind))return null;if(n.event==="suppressed")return n.reason==="completed-index-is-fresh"?{record:n,hasLanguageDetails:!1,invalidLanguageDetails:0}:null;if(n.event!=="run"||n.result!=="rebuilt"&&n.result!=="reused"&&n.result!=="failed"||!B(n.durationMs)||!B(n.estimatedLogicalOutputBytes)||n.estimatedWriteBytes!==void 0&&!B(n.estimatedWriteBytes)||n.reflinkedBytes!==void 0&&!B(n.reflinkedBytes)||n.fallbackCopiedBytes!==void 0&&!B(n.fallbackCopiedBytes))return null;let r=n,{byLanguage:i,...o}=r,a=ss(i);return{record:{...o,...a.byLanguage?{byLanguage:a.byLanguage}:{}},hasLanguageDetails:a.hasLanguageDetails,invalidLanguageDetails:a.invalidLanguageDetails}}catch{return null}}function Md(e,t,n=new Date){return t.enabled?is(ns(e,n,t.windowMs),t,n.getTime()):{state:"allowed",rebuilt:0,estimatedWriteBytes:0}}function is(e,t,n){let r=e.estimatedWriteBytes??e.estimatedLogicalOutputBytes,i={rebuilt:e.rebuilt,estimatedWriteBytes:r};return t.enabled?e.confidence!==void 0&&e.confidence!=="complete"?{state:"paused",reason:"activity-evidence",until:n+t.windowMs,...i,detail:`reindex activity evidence is ${e.confidence}`}:e.rebuilt>=t.maxRebuilds?{state:"paused",reason:"rebuild-count",until:Hr(e.oldestRebuildAt,t.windowMs,n),...i,detail:`${e.rebuilt}/${t.maxRebuilds} automatic rebuild slots consumed`}:r>=t.maxEstimatedWriteBytes?{state:"paused",reason:"estimated-write-bytes",until:Hr(e.oldestWriteAt,t.windowMs,n),...i,detail:`${r}/${t.maxEstimatedWriteBytes} estimated write bytes consumed`}:{state:"allowed",...i}:{state:"allowed",...i}}function Hr(e,t,n){let r=e?Date.parse(e):Number.NaN;return Number.isFinite(r)&&r+t>n?r+t:n+t}function os(e){return e==="manual-cli"||e==="setup"||e==="watch-source"||e==="watch-startup"||e==="watch-demand"||e==="watch-git-head"||e==="watch-git-index"||e==="watch-git-state"||e==="unknown"}function Tt(e){try{return Ka(e).size}catch{return 0}}function as(e){let t={};for(let n of e.languages){let r=(e.shards??[]).filter(u=>u.language===n),i=r.find(u=>u.id===n),o=e.reused||(i?i.reused:r.length>0&&r.every(u=>u.reused)),a=Tt(Xr(zr(e.dbPath),"language-indexes",`${n}.scip`)),s=a>0?a:i?.outputBytes??a,c=o?0:i?.durationMs??r.filter(u=>!u.reused).reduce((u,l)=>u+l.durationMs,0);t[n]={result:o?"reused":"rebuilt",outputBytes:s,producedOutputBytes:o?0:s,durationMs:c}}return t}function ss(e){if(e===void 0)return{hasLanguageDetails:!1,invalidLanguageDetails:0};if(!e||typeof e!="object"||Array.isArray(e))return{hasLanguageDetails:!1,invalidLanguageDetails:1};let t={},n=0;for(let[i,o]of Object.entries(e)){if(!us(i)||!cs(o)){n+=1;continue}t[i]=o}let r=Object.keys(t).length>0;return{...r?{byLanguage:t}:{},hasLanguageDetails:r,invalidLanguageDetails:n}}function cs(e){if(!e||typeof e!="object")return!1;let t=e;return(t.result==="rebuilt"||t.result==="reused")&&rt(t.outputBytes)&&rt(t.producedOutputBytes)&&B(t.durationMs)&&(t.result!=="reused"||t.producedOutputBytes===0&&t.durationMs===0)&&t.producedOutputBytes<=t.outputBytes}function us(e){return nt.includes(e)}function ls(e){return e?nt.flatMap(t=>{let n=e[t];return n?[[t,n]]:[]}):[]}function ds(){return{runs:0,rebuilt:0,reused:0,producedOutputBytes:0,durationMs:0}}function ps(e){let t=e.invalidLanguageDetails??0,n=e.attributedRuns??0;return(e.unattributedRuns??0)===0&&t===0?"complete":n===0?"unavailable":"partial"}function gs(e){return e.endsWith(`
|
|
239
|
-
`)||(e=e.slice(0,Math.max(0,e.lastIndexOf(`
|
|
240
|
-
`)+1))),e.split(`
|
|
241
|
-
`).filter(t=>t.length>0)}import{createHash as fs}from"crypto";import{existsSync as _t,readdirSync as ms}from"fs";import{dirname as Lt,join as Be,relative as hs,resolve as Dt,sep as Yr}from"path";function Qr(e,t){let n=t.includes("."),r={};for(let o of t)r[o]=[];let i=[];for(let o of e){let a=ni(o.path,t);a?r[a].push(o):n?r["."].push(o):i.push(o)}return{files:r,shared:i}}function Zr(e,t){let n=new Map;for(let i of e){let o=t[i]?.packageName;o&&n.set(o,i)}let r=new Map;for(let i of e)r.set(i,new Set);for(let i of e){let o=t[i],a=r.get(i);if(!o||o.parseFailed){for(let s of e)s!==i&&a.add(s);continue}for(let s of o.dependencyNames){let c=n.get(s);c&&c!==i&&a.add(c)}for(let s of[...o.pathsTargets,...o.referencesPaths]){let c=ni(s,e);c&&c!==i&&a.add(c)}}return ys(e,r)}function ei(e,t,n){let r={};for(let i of e){let o=new Map;for(let a of t.files[i]??[])o.set(a.path,a);for(let a of n[i]??[])for(let s of t.files[a]??[])o.set(s.path,s);for(let a of t.shared)o.set(a.path,a);r[i]={files:[...o.values()].sort((a,s)=>a.path.localeCompare(s.path))}}return r}function Ot(e){if(e===".")return"root";let t=fs("sha256").update(e).digest("hex").slice(0,8);return`${e.split("/").join("__")}-${t}`}function ti(e,t){let n=Dt(e),r={};for(let i of t)r[i]=Ss(n,i);return r}function ni(e,t){let n;for(let r of t)r!=="."&&(e===r||e.startsWith(`${r}/`))&&(!n||r.length>n.length)&&(n=r);return n}function ys(e,t){let n={};for(let r of e){let i=new Set,o=[...t.get(r)??[]];for(;o.length>0;){let a=o.pop();if(!(a===r||i.has(a))){i.add(a);for(let s of t.get(a)??[])s!==r&&!i.has(s)&&o.push(s)}}n[r]=[...i].sort((a,s)=>a.localeCompare(s))}return n}function Ss(e,t){let n=t==="."?e:Be(e,t),r=bs(n),i=Rs(n),o=i?xs(i,e):{pathsTargets:[],referencesPaths:[],failed:!1};return{packageName:r.name,dependencyNames:r.dependencyNames,pathsTargets:o.pathsTargets,referencesPaths:o.referencesPaths,parseFailed:r.failed||o.failed}}function bs(e){let t=Be(e,"package.json");if(!_t(t))return{name:void 0,dependencyNames:[],failed:!1};let n=jt(t);if(!n.ok)return{name:void 0,dependencyNames:[],failed:!0};let r=typeof n.value.name=="string"?n.value.name:void 0,i=new Set;for(let o of["dependencies","devDependencies","peerDependencies"]){let a=n.value[o];if(a&&typeof a=="object"&&!Array.isArray(a))for(let s of Object.keys(a))i.add(s)}return{name:r,dependencyNames:[...i],failed:!1}}function Rs(e){let t=Be(e,"tsconfig.json");if(_t(t))return t;let n;try{n=ms(e).filter(r=>/^tsconfig.*\.json$/.test(r))}catch{return}return n.sort((r,i)=>r.localeCompare(i)),n.length>0?Be(e,n[0]):void 0}function xs(e,t){let n=jt(e);if(!n.ok)return{pathsTargets:[],referencesPaths:[],failed:!0};let r=vs(n.value,e,t),i=ri(e,n.value,t,0);return{pathsTargets:i.pathsTargets,referencesPaths:r,failed:i.failed}}function vs(e,t,n){let r=e.references;if(!Array.isArray(r))return[];let i=Lt(t),o=new Set;for(let a of r){if(!a||typeof a!="object")continue;let s=a.path;if(typeof s!="string"||s.trim()==="")continue;let c=ii(s,i,n);c&&o.add(c)}return[...o]}function ri(e,t,n,r){let i=Ps(t);if(i)return{pathsTargets:Is(i,Lt(e),n),failed:!1};if(r>=5)return{pathsTargets:[],failed:!1};let o=ks(t.extends,e,n);if(!o)return{pathsTargets:[],failed:!1};let a=jt(o);return a.ok?ri(o,a.value,n,r+1):{pathsTargets:[],failed:!0}}function Ps(e){let t=e.compilerOptions;if(!t||typeof t!="object"||Array.isArray(t))return;let n=t.paths;return n&&typeof n=="object"&&!Array.isArray(n)?n:void 0}function Is(e,t,n){let r=new Set;for(let i of Object.values(e))if(Array.isArray(i))for(let o of i){if(typeof o!="string")continue;let a=ii(o,t,n);a&&r.add(a)}return[...r]}function ks(e,t,n){let r=Array.isArray(e)?e.at(-1):e;if(typeof r!="string"||r.trim()===""||!r.startsWith(".")&&!r.startsWith("/"))return;let i=Dt(Lt(t),r);if(i.endsWith(".json")||(i=`${i}.json`),!i.split(Yr).includes("node_modules")&&ot(n,i)&&_t(i))return i}function ii(e,t,n){let r=e.replace(/\/?\*+$/,""),i=Dt(t,r===""?".":r);if(!ot(n,i))return;let a=hs(n,i).split(Yr).join("/");return a===""?".":a}function ws(e){let t="",n=0,r=!1,i=e.length;for(;n<i;){let o=e[n];if(r){if(t+=o,o==="\\"&&n+1<i){t+=e[n+1],n+=2;continue}o==='"'&&(r=!1),n+=1;continue}if(o==='"'){r=!0,t+=o,n+=1;continue}if(o==="/"&&e[n+1]==="/"){for(n+=2;n<i&&e[n]!==`
|
|
242
|
-
`;)n+=1;continue}if(o==="/"&&e[n+1]==="*"){for(n+=2;n<i&&!(e[n]==="*"&&e[n+1]==="/");)n+=1;n+=2;continue}t+=o,n+=1}return t}function jt(e){try{let t=F(e,{maxBytes:Y,inputKind:"TypeScript project manifest"}),n=JSON.parse(ws(t));return n&&typeof n=="object"&&!Array.isArray(n)?{ok:!0,value:n}:{ok:!1}}catch{return{ok:!1}}}import{createHash as qs}from"crypto";import{existsSync as Mt,statSync as Js,writeFileSync as Nt}from"fs";import{join as Hs}from"path";import{createRequire as Es}from"module";import{dirname as Ts,isAbsolute as Xd,relative as Kd,resolve as Yd,sep as Qd}from"path";var oi=Es(import.meta.url),Fs=1,ai="0.4.0";function Ct(){let e=As();return e.available?{available:!0,packageVersion:e.packageVersion,typescriptVersion:e.typescriptVersion,producerIdentity:e.producerIdentity}:e}function As(){try{let e=oi.resolve("@sourcegraph/scip-typescript/package.json"),t=JSON.parse(_(e,"scip-typescript package manifest"));if(t.version!==ai)return{available:!1,reason:`unsupported scip-typescript version ${String(t.version??"unknown")}; expected ${ai}`};let n=Ts(e),r=oi.resolve("typescript/package.json",{paths:[n]}),i=JSON.parse(_(r,"TypeScript package manifest"));return typeof i.version!="string"||!i.version?{available:!1,reason:"scip-typescript TypeScript compiler version is unavailable"}:{available:!0,packageRoot:n,packageVersion:t.version,typescriptVersion:i.version,producerIdentity:_s(t.version,i.version)}}catch(e){return{available:!1,reason:`scip-typescript document producer unavailable: ${e instanceof Error?e.message:String(e)}`}}}function _s(e,t){return`scip-typescript:${e}:typescript:${t}:document-adapter:${Fs}`}import{createHash as Ls}from"crypto";import{dirname as Ds,join as si}from"path";var Ve=4;var Os="typescript-index";function ci(e){let t=si(e,Os),n=Pn(t);return{...n,requestDir:n.legacyRequestDir}}function ui(e){try{let t=ln(Z(_(si(Ds(e),"meta.json"),"reindex metadata")));return t?Ls("sha256").update(t).digest("hex"):null}catch{return null}}import{randomUUID as js}from"crypto";import{existsSync as Cs}from"fs";var Ms=12e4,Ns=5,Ue=class{projectRoot;cacheDir;baseGeneration;timeoutMs;runtime;mailboxLimits;constructor(t,n={}){this.projectRoot=nn(t.projectRoot),this.cacheDir=t.cacheDir,this.baseGeneration=t.baseGeneration,this.timeoutMs=n.timeoutMs??Ws(),this.runtime=n.runtime??Gs,this.mailboxLimits=n.mailboxLimits??{}}request(t){let n=sn(this.cacheDir),r=ci(this.cacheDir),i=it(n.statePath);if(!li(i,this.projectRoot,this.runtime))throw new Error("Compatible TypeScript index service is not running.");let o=this.runtime.now(),a=o+this.timeoutMs,s=(this.runtime.monotonicNow??R)()+this.timeoutMs,c=gt("typescript-index-v4",{baseGeneration:this.baseGeneration,request:t}),u=ft(c),l=In(r,{mailboxVersion:pt,operationKey:c,clientId:this.runtime.randomId(),enqueuedAtMs:o,deadlineAtMs:a,protocolVersion:Ve,id:u,baseGeneration:this.baseGeneration,request:t},{nowMs:o,limits:this.mailboxLimits});for(;(this.runtime.monotonicNow??R)()<=s;){if(Cs(l.responsePath))return $s(F(l.responsePath,{maxBytes:this.mailboxLimits.maxItemBytes??64*1024*1024,inputKind:"TypeScript index mailbox response"}),u,c,this.baseGeneration,t.producerIdentity,t.affectedFiles);let d=it(n.statePath);if(!li(d,this.projectRoot,this.runtime))throw new Error("TypeScript index service stopped while processing a request.");this.runtime.sleep(Ns)}throw new Error(`TypeScript index service timed out after ${this.timeoutMs}ms.`)}};function li(e,t,n){let r=e?.processIdentity?n.readProcessIdentity?.(e.pid):null;return e!==null&&e.projectRoot===t&&e.typescriptIndex?.protocolVersion===Ve&&n.isProcessAlive(e.pid)&&(!e.processIdentity||r!=null&&le(e.processIdentity,r))}function $s(e,t,n,r,i,o){let a=JSON.parse(e);if(a.protocolVersion!==Ve||a.id!==t||a.operationKey!==n||a.ok===!0&&a.baseGeneration!==r)throw new Error("TypeScript index service wrote an incompatible response.");if(a.ok!==!0)throw new Error(typeof a.error=="string"?a.error:"TypeScript index service request failed.");let s=Bs(a.response,i),c=[...new Set(o)].sort(),u=s.fragments.map(l=>l.relativePath).sort();if(JSON.stringify(u)!==JSON.stringify(c))throw new Error("TypeScript index service omitted or added an affected document.");return s}function Bs(e,t){if(!e||typeof e!="object")throw new Error("TypeScript index service wrote an invalid response.");let n=e;if(n.producerIdentity!==t||typeof n.cold!="boolean"||typeof n.durationMs!="number"||!Number.isFinite(n.durationMs)||!Array.isArray(n.fragments))throw new Error("TypeScript index service wrote an invalid response.");let r=new Set,i=n.fragments.map(o=>{if(!o||typeof o.relativePath!="string"||o.bytesBase64!==null&&typeof o.bytesBase64!="string"||typeof o.occurrences!="number"||!Number.isInteger(o.occurrences)||o.occurrences<0||typeof o.symbols!="number"||!Number.isInteger(o.symbols)||o.symbols<0||!Array.isArray(o.referenceFragments)||!o.referenceFragments.every(Vs)||r.has(o.relativePath))throw new Error("TypeScript index service wrote an invalid fragment.");r.add(o.relativePath);let a=o.bytesBase64===null?null:Us(o.bytesBase64);return{relativePath:o.relativePath,bytes:a,occurrences:o.occurrences,symbols:o.symbols,referenceFragments:o.referenceFragments}});return{producerIdentity:n.producerIdentity,cold:n.cold,durationMs:n.durationMs,fragments:i}}function Vs(e){if(!e||typeof e!="object")return!1;let t=e;return typeof t.targetSymbol=="string"&&!!t.location&&typeof t.location.file=="string"&&Number.isInteger(t.location.line)&&Number.isInteger(t.location.column)}function Us(e){let t=Buffer.from(e,"base64");if(t.toString("base64")!==e)throw new Error("TypeScript index service wrote invalid base64.");return t}function Ws(){let e=Number(process.env.SCIP_TYPESCRIPT_INDEX_TIMEOUT_MS);return Number.isInteger(e)&&e>0?e:Ms}var Gs={now:Date.now,monotonicNow:R,randomId:js,sleep(e){let t=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(t,0,0,e)},isProcessAlive:K,readProcessIdentity:Q};function zs(e){let t=e.projectMode==="workspace"?e.workspaceProjects??[]:["."];if(t.length===0)return{eligible:!1,reason:"workspace project roots unavailable"};if(t.length===1&&t[0]==="."&&!e.rootTsconfigExists)return{eligible:!1,reason:"root tsconfig unavailable"};if(!e.previousSnapshot)return{eligible:!1,reason:"prior project snapshot unavailable"};if(e.graph===null)return{eligible:!1,reason:"dependency graph unavailable"};if(e.projectFiles.length===0)return{eligible:!1,reason:"prior TypeScript documents unavailable"};let n=xe(e.previousSnapshot,e.currentSnapshot);if(n.changes.length===0)return{eligible:!1,reason:"no changed project inputs"};if(n.changes.some(l=>l.kind!=="modified"||l.inputKind!=="source"||!ht(l.path)))return{eligible:!1,reason:"change is not a modified TypeScript source file"};let r=De(n,e.graph,e.projectFiles);if(r.mode!=="closure"||r.affectedFiles.length===0)return{eligible:!1,reason:r.reasons.length>0?`affected set widened: ${r.reasons.join(", ")}`:"empty affected set"};let i=Xs(r,t,e.graph);if(!i)return{eligible:!1,reason:"affected files cross or ambiguously match TypeScript projects"};let o=di(e.currentSnapshot,e.projectFiles,e.producerIdentity),a=di(e.previousSnapshot,e.projectFiles,e.producerIdentity);if(o!==a)return{eligible:!1,reason:"TypeScript fragment project identity changed"};let s=gi(e.previousSnapshot,e.projectFiles,e.graph,e.producerIdentity,e.projectFiles);if(!s)return{eligible:!1,reason:"prior document identity unavailable"};let c=gi(e.currentSnapshot,e.projectFiles,e.graph,e.producerIdentity,r.affectedFiles);if(!c)return{eligible:!1,reason:"next document identity unavailable"};let u=i.length===1?i[0]:void 0;return{eligible:!0,manifest:n,plan:r,projectIdentity:o,previousFragmentGeneration:pi(e.previousSnapshot,e.producerIdentity),nextFragmentGeneration:pi(e.currentSnapshot,e.producerIdentity),previousDocumentIdentities:s,nextDocumentIdentities:c,projects:i,...u?{tsconfigPath:u.tsconfigPath,projectArgument:u.projectArgument}:{}}}function Xs(e,t,n){let r=new Map;for(let o of e.affectedFiles){let a=Ks(o,t);if(!a)return null;let s=r.get(a)??[];s.push(o),r.set(a,s)}let i=[];for(let[o,a]of[...r].sort(([s],[c])=>s.localeCompare(c))){let s=new Set(a),c=e.changedFiles.filter(u=>s.has(u)||a.some(l=>Ys(l,u,n)));if(c.length===0)return null;i.push({projectArgument:o,tsconfigPath:o==="."?"tsconfig.json":`${o}/tsconfig.json`,modifiedFiles:c,affectedFiles:[...a].sort()})}return i}function Ks(e,t){let n=t.filter(o=>o==="."||e===o||e.startsWith(`${o}/`));if(n.length===0)return null;let r=[...new Set(n)].sort((o,a)=>We(a)-We(o)||o.localeCompare(a)),i=r[0];return r[1]&&We(r[1])===We(i)?null:i}function We(e){return e==="."?0:e.split("/").filter(Boolean).length}function Ys(e,t,n){let r=new Set,i=[e];for(let o=0;o<i.length;o+=1){let a=i[o];if(!(!a||r.has(a))){r.add(a);for(let s of n.get(a)??[]){if(s===t)return!0;r.has(s)||i.push(s)}}}return!1}function fi(e){let t=R();try{if(!Mt(e.previousDbPath)||!Mt(e.previousShardPath))throw new Error("prior TypeScript graph or language shard unavailable");let n=performance.now(),r=Ct();if(!r.available)throw new Error(r.reason);let i=performance.now()-n;n=performance.now();let o=new L({projectRoot:e.projectRoot,dbPath:e.previousDbPath,indexPath:e.previousIndexPath}),a,s;try{a=Ee(o,{includeIgnored:!1}).filter(ht).sort(),s=Te(o)}finally{o.close()}let c=performance.now()-n,u=zs({projectMode:e.projectMode,workspaceProjects:e.projectMode==="workspace"?ne(e.projectRoot,e.currentSnapshot.typescriptProjects):void 0,previousSnapshot:e.previousSnapshot,currentSnapshot:e.currentSnapshot,projectFiles:a,graph:s,producerIdentity:r.producerIdentity,rootTsconfigExists:Mt(Hs(e.projectRoot,"tsconfig.json"))});if(!u.eligible)throw new Error(u.reason);let l=ui(e.previousDbPath);if(!l)throw new Error("published TypeScript base generation unavailable");n=performance.now();let d=new Ue({projectRoot:e.projectRoot,cacheDir:e.cacheDir,baseGeneration:l}),p=u.projects.map(x=>d.request({kind:"emit-documents",tsconfigPath:x.tsconfigPath,projectArgument:x.projectArgument,projectIdentity:u.projectIdentity,producerIdentity:r.producerIdentity,modifiedFiles:x.modifiedFiles,affectedFiles:x.affectedFiles})),g=p.flatMap(x=>x.fragments),f=performance.now()-n,m=Js(e.previousShardPath).size>=An;n=performance.now();let I=m?null:$(e.previousShardPath,{inputKind:"TypeScript base SCIP shard",maxBytes:et}),h=m?{completeIndexBytes:null,affectedIndexBytes:kn(g)}:Tn({packageVersion:r.packageVersion,baseIndexBytes:I,fragments:g}),S=performance.now()-n;n=performance.now(),m?_n({cacheDir:e.cacheDir,previousGenerationIdentity:u.previousFragmentGeneration,nextGenerationIdentity:u.nextFragmentGeneration,producerIdentity:r.producerIdentity,projectIdentity:u.projectIdentity,baseShardCurrent:e.baseShardCurrent,fragments:g}):(wn({cacheDir:e.cacheDir,packageVersion:r.packageVersion,indexBytes:I,producerIdentity:r.producerIdentity,projectIdentity:u.projectIdentity,generationIdentity:u.previousFragmentGeneration,documentIdentities:u.previousDocumentIdentities,allowUntrackedDocuments:!0}),En({cacheDir:e.cacheDir,previousGenerationIdentity:u.previousFragmentGeneration,producerIdentity:r.producerIdentity,projectIdentity:u.projectIdentity,generationIdentity:u.nextFragmentGeneration,fragments:g,documentIdentities:u.nextDocumentIdentities}));let b=performance.now()-n;n=performance.now(),h.completeIndexBytes&&Nt(e.candidateShardPath,h.completeIndexBytes),Nt(e.candidateAffectedScipPath,h.affectedIndexBytes);let P=performance.now()-n,v={scipPath:m?e.previousShardPath:e.candidateShardPath,candidateScipPath:e.candidateShardPath,affectedScipPath:e.candidateAffectedScipPath,completeScipUpdated:!m,durationMs:R()-t,cold:p.some(x=>x.cold),changedFiles:u.plan.changedFiles,affectedFiles:u.plan.affectedFiles,producerIdentity:r.producerIdentity,previousFragmentGeneration:u.previousFragmentGeneration,nextFragmentGeneration:u.nextFragmentGeneration,manifest:u.manifest,plan:u.plan,projectFileCount:a.length,referenceFragmentsByFile:new Map(g.map(x=>[x.relativePath,x.referenceFragments])),timings:{runtimeMs:i,graphMs:c,requestMs:f,serviceMs:p.reduce((x,z)=>x+z.durationMs,0),assemblyMs:S,fragmentStoreMs:b,writeMs:P}};return e.onStatus(`Incremental TypeScript index emitted ${v.affectedFiles.length} affected document(s) across ${u.projects.length} project(s) in ${(v.durationMs/1e3).toFixed(3)}s (${v.cold?"cold":"warm"} service; ${m?"whole SCIP deferred":"whole SCIP current"}; runtime ${i.toFixed(0)}ms, graph ${c.toFixed(0)}ms, request ${f.toFixed(0)}ms, assembly ${S.toFixed(0)}ms, fragments ${b.toFixed(0)}ms, write ${P.toFixed(0)}ms).`),v}catch(n){return e.onStatus(`Incremental TypeScript index unavailable: ${n instanceof Error?n.message:String(n)}. Falling back to the whole-project indexer.`),null}}function mi(e){let t=Ct();if(!t.available)throw new Error(t.reason);let n=Ln({cacheDir:e.cacheDir,generationIdentity:e.generationIdentity,baseIndexBytes:$(e.baseShardPath,{inputKind:"TypeScript base SCIP shard",maxBytes:et}),packageVersion:t.packageVersion});Nt(e.candidateShardPath,n)}function di(e,t,n){let r=e.files.filter(i=>cn(i.path,e.languages)!=="source").map(i=>({path:i.path,size:i.size,hash:i.hash})).sort((i,o)=>i.path.localeCompare(o.path));return $t(JSON.stringify({version:1,producerIdentity:n,pnpmWorkspaces:e.pnpmWorkspaces,typescriptProjectMode:e.typescriptProjectMode,typescriptProjects:[...e.typescriptProjects].sort(),projectFiles:[...t].sort(),nonSourceInputs:r}))}function pi(e,t){return $t(JSON.stringify({version:1,producerIdentity:t,snapshot:e}))}function gi(e,t,n,r,i){let o=new Set(e.files.map(c=>c.path)),a=Qn({projectFiles:t.filter(c=>o.has(c)),snapshot:e,graph:n,engineIdentity:r}),s=new Map;for(let c of i){let u=a.identityFor(c,"typescript-scip-document-v1");if(u.key){s.set(c,u.key);continue}if(o.has(c))return null;s.set(c,$t(JSON.stringify({version:1,producerIdentity:r,generatedDocument:c})))}return s}function $t(e){return qs("sha256").update(e).digest("hex")}import{closeSync as Qs,existsSync as Ge,fstatSync as Zs,lstatSync as ec,openSync as tc,renameSync as Ut,rmSync as qe,statSync as nc,writeSync as rc}from"fs";import{cpus as ic}from"os";import{join as Wt}from"path";var Bt=Symbol("no-error");async function hi(e,t,n){if(e.length===0)return[];let r=new Array(e.length),i=Number.isFinite(t)?Math.max(1,Math.floor(t)):1,o=Math.min(e.length,i),a=0,s=Bt,c=!0,u=Array.from({length:o},async()=>{for(;c&&a<e.length;){let l=a++;try{r[l]=await n(e[l])}catch(d){s===Bt&&(s=d),c=!1}}});if(await Promise.all(u),s!==Bt)throw s;return r}function oc(e,t){if(e.temporaryRootConfigContent===void 0)return null;let n=Wt(t,"tsconfig.json"),r=Buffer.from(e.temporaryRootConfigContent,"utf8"),i;try{i=tc(n,"wx",384)}catch(o){if(o.code==="EEXIST")return null;throw o}try{rc(i,r);let o=Zs(i);return{path:n,content:r,device:o.dev,inode:o.ino}}finally{Qs(i)}}function ac(e){if(e)try{let t=ec(e.path);if(!t.isFile()||t.dev!==e.device||t.ino!==e.inode||t.size!==e.content.byteLength)return;let n;try{n=$(e.path,{maxBytes:e.content.byteLength,inputKind:"temporary TypeScript index configuration"})}catch{return}if(!n.equals(e.content))return;qe(e.path)}catch(t){if(t.code!=="ENOENT")throw t}}function sc(e,t,n){if(!e.defaultOutputPath)return;let r=Wt(t,e.defaultOutputPath);n!==r&&Ge(r)&&Ut(r,n)}function cc(e,t,n){if(!e.defaultOutputPath)return null;let r=Wt(t,e.defaultOutputPath);if(r===n)return null;let i=`${n}.default-output-backup`;return qe(i,{force:!0}),Ge(r)?(Ut(r,i),{defaultOutputPath:r,backupPath:i}):{defaultOutputPath:r,backupPath:null}}function uc(e){e&&(qe(e.defaultOutputPath,{force:!0}),e.backupPath&&Ge(e.backupPath)&&Ut(e.backupPath,e.defaultOutputPath))}function lc(e,t){if(e<=1)return 1;let n=Number(process.env.CODEBASEIQ_INDEXER_CONCURRENCY??0),r=Number.isFinite(t)&&t&&t>0?t:Number.isFinite(n)&&n>0?n:Math.min(8,Math.max(1,ic().length));return Math.max(1,Math.min(e,Math.floor(r)))}async function Si(e,t,n,r,i){A(i,"Reindex cancelled by its owner.");let o=e.filter(l=>l.config.defaultOutputPath),a=e.filter(l=>!l.config.defaultOutputPath),s=[],c=lc(a.length,r),u=await hi(a,c,l=>Vt(l,t,n,i));if(c>1){let l=new Map;for(let d of u.filter(p=>p.result.skipped&&p.retryable)){let p=a.find(g=>g.id===d.result.id);p&&(n(`Retrying ${p.label} indexer serially after parallel failure...`),A(i,"Reindex cancelled by its owner."),l.set(p.id,(await Vt(p,t,n,i)).result))}s.push(...u.map(({result:d})=>l.get(d.id)??d))}else s.push(...u.map(({result:l})=>l));for(let l of o)A(i,"Reindex cancelled by its owner."),s.push((await Vt(l,t,n,i)).result);return s.sort((l,d)=>e.findIndex(p=>p.id===l.id)-e.findIndex(p=>p.id===d.id))}async function Vt(e,t,n,r){A(r,"Reindex cancelled by its owner."),n(`Indexing ${e.label} with ${e.resolvedBinary}...`),qe(e.scipPath,{force:!0});let i=cc(e.config,t,e.scipPath),o=oc(e,t),a=[e.binary,...e.args].join(" "),s=R();try{e.trustedProjectTool&&Kn(t,e.trustedProjectTool);let u=qn(e.binary,e.args),l=await Ae({command:u.binary,args:u.args,label:`${e.label} indexer`,cwd:t,env:e.env,timeoutMs:dc(),maxStdoutBytes:50*1024*1024,maxStderrBytes:50*1024*1024,signal:r});if(l.status!==0){let d=l.stderr.trim();throw new Error(`${e.resolvedBinary} exited with status ${l.status}${d?`:
|
|
243
|
-
${d}`:""}`)}sc(e.config,t,e.scipPath)}catch(u){if(r?.aborted)throw pn(r,"Reindex cancelled by its owner.");let l=u instanceof Error?u.message:String(u),d=`${e.resolvedBinary} indexer failed: ${l.split(`
|
|
244
|
-
`)[0]}`,p=e.label===e.language?d:`${e.label}: ${d}`;return n(`Skipping ${e.label}: ${d}`),{result:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,durationMs:R()-s,command:a,skipped:{language:e.language,reason:p}},retryable:pc(u)}}finally{uc(i),ac(o)}if(!Ge(e.scipPath)){let u=`${e.resolvedBinary} indexer completed but did not produce ${e.scipPath}`,l=e.label===e.language?u:`${e.label}: ${u}`;return n(`Skipping ${e.label}: ${u}`),{result:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,durationMs:R()-s,command:a,skipped:{language:e.language,reason:l}},retryable:!1}}let c;try{c=nc(e.scipPath).size}catch{c=void 0}return{result:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,durationMs:R()-s,command:a,outputBytes:c},retryable:!1}}function dc(){let e=Number(process.env.CODEBASEIQ_INDEXER_TIMEOUT_MS);return Number.isFinite(e)&&e>0?Math.floor(e):ir.indexer}function pc(e){return e instanceof or?e.kind==="spawn"&&yi(e.cause):yi(e)}function yi(e){let t=e?.code;return t==="EAGAIN"||t==="ENOMEM"||t==="EMFILE"||t==="ENFILE"||t==="ETXTBSY"}import{execFileSync as Ri}from"child_process";import{homedir as bi,platform as gc}from"os";import{delimiter as fc,join as Je}from"path";function xi(e,t){let n=e.installMethods,r=Fe(e);if(!n?.length)return t(`No auto-install method available for ${r}.`),e.installUrl&&t(`Install manually from: ${e.installUrl}`),!1;for(let i of n){if(!i.identity||!i.destination){t(`Refusing ${i.label} installation for ${r}: the installer descriptor lacks an immutable identity or destination.`);continue}if(!re(i.prerequisite))continue;let o=mc(i);t(`Installing immutable ${i.identity} via ${i.label} into ${o}; expected executable: ${r}.`);try{Ri(i.binary,i.args,{stdio:"inherit",windowsHide:!0,timeout:3e5,env:process.env,shell:gc()==="win32"});let a=pe(e);if(a){let s=a===e.indexerBinary?"":` (using ${a})`;return t(`Successfully installed ${i.identity} via ${i.label}${s}; resolved executable: ${a}.`),!0}t(`${i.label} command completed but ${r} was not found on PATH`)}catch(a){let s=a instanceof Error?a.message:String(a);t(`${i.label} install failed: ${s}`)}}return t(`Could not auto-install ${r}.`),e.installUrl&&t(`Install manually from: ${e.installUrl}`),!1}function mc(e){if(e.binary==="npm")return Gt("npm",["root","-g"])??e.destination;if(e.binary==="go"){let t=Gt("go",["env","GOBIN"]);if(t)return t;let n=Gt("go",["env","GOPATH"]);if(n)return Je(n.split(fc)[0],"bin")}return e.binary==="dotnet"?Je(process.env.DOTNET_CLI_HOME??bi(),".dotnet","tools"):e.binary==="dart"?Je(process.env.PUB_CACHE??Je(bi(),".pub-cache"),"bin"):e.destination}function Gt(e,t){try{return Ri(e,t,{stdio:["ignore","pipe","ignore"],windowsHide:!0,encoding:"utf8",timeout:1e4,killSignal:"SIGKILL",env:process.env}).trim()||null}catch{return null}}import cu from"better-sqlite3";import{existsSync as uu}from"fs";import{dirname as lu,join as du,resolve as pu}from"path";import{randomUUID as yc}from"crypto";import{mkdtempSync as Sc,rmSync as bc,statSync as Pi}from"fs";import{tmpdir as Rc}from"os";import{join as Ii}from"path";import{Worker as xc}from"worker_threads";function hc(){return{"missing-source-file":0,"missing-service-script":0,"no-definition":0,"same-file-definition":0,"unindexed-definition":0}}function se(){return{skippedReferences:0,skippedReferenceReasons:hc(),skippedReferenceSamples:[]}}function He(e,t){e.skippedReferences+=t.skippedReferences;for(let n of Object.keys(e.skippedReferenceReasons)){e.skippedReferenceReasons[n]+=t.skippedReferenceReasons[n];for(let r of t.skippedReferenceSamples.filter(i=>i.reason===n))e.skippedReferenceSamples.filter(o=>o.reason===n&&o.sourceFile===r.sourceFile).length<2&&e.skippedReferenceSamples.push(r)}}var vc=3e5,ki=64*1024*1024,Pc={createResultDirectory:()=>Sc(Ii(Rc(),"codebaseiq-vue-workers-")),spawn:(e,t)=>new xc(e,{workerData:t}),resultSize:e=>Pi(e).size,readResult:e=>F(e,{maxBytes:ki,inputKind:"Vue worker result"}),removeResultDirectory:e=>bc(e,{recursive:!0,force:!0})};function wi(e){return e.length>=8&&Ti(e.length)>1}async function Ei(e,t=Pc){let n=Ti(e.vueFiles.length),r=Cc(e.vueFiles),i=Nc(r,n),o=new URL("./augment-vue-worker.js",import.meta.url),a=e.timeoutMs??Oc(),s=e.maxResultBytes??jc();vi("timeoutMs",a),vi("maxResultBytes",s);let c=yc(),u=t.createResultDirectory(),l=[],d,p,g;try{for(let m=0;m<i.length;m++){let I=m,h=i[m]??[],S=h.map(v=>v.taskId),b=Ii(u,`${I}.json`),P=t.spawn(o,{projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,tasks:h,resultPath:b,runId:c,workerId:I,taskIds:S});l.push({workerId:I,taskIds:S,resultPath:b,handle:P,completion:Ic(P,I)})}await kc(l,a);let f=l.sort((m,I)=>m.workerId-I.workerId).map(m=>Ec(m,c,s,t));g={occurrences:f.flatMap(m=>m.occurrences),...se()};for(let m of f)He(g,m)}catch(f){d=f}finally{let f=await wc(l);if(f.length===0)try{t.removeResultDirectory(u)}catch(m){f.push(m)}if(f.length>0){let m=d===void 0?f:[d,...f];p=new AggregateError(m,`Vue worker cleanup failed: ${Dc(m[0])}`)}}if(p)throw p;if(d!==void 0)throw d;if(!g)throw new Error("Vue workers completed without producing a merged result.");return g}function Ic(e,t){return new Promise((n,r)=>{let i=!1,o=c=>{i||(i=!0,e.off("error",a),e.off("exit",s),c?r(c):n())},a=c=>{o(new Error(`Vue reference worker ${t} failed: ${c.message}`,{cause:c}))},s=c=>{o(c===0?void 0:new Error(`Vue reference worker ${t} exited with code ${c}`))};e.once("error",a),e.once("exit",s)})}async function kc(e,t){let n;try{await Promise.race([Promise.all(e.map(r=>r.completion)),new Promise((r,i)=>{n=setTimeout(()=>i(new Error(`Vue reference workers timed out after ${(t/1e3).toFixed(3)}s`)),t),n.unref()})])}finally{n&&clearTimeout(n)}}async function wc(e){return(await Promise.allSettled(e.map(async n=>n.handle.terminate()))).flatMap(n=>n.status==="rejected"?[n.reason]:[])}function Ec(e,t,n,r){let i=r.resultSize(e.resultPath);if(!Number.isSafeInteger(i)||i<0||i>n)throw new Error(`Vue reference worker ${e.workerId} result is ${i} bytes; limit is ${n} bytes`);let o;try{o=JSON.parse(r.readResult(e.resultPath))}catch(a){throw new Error(`Vue reference worker ${e.workerId} produced invalid JSON`,{cause:a})}if(!me(o)||o.version!==1||o.runId!==t||o.workerId!==e.workerId)throw new Error(`Vue reference worker ${e.workerId} result identity does not match its assignment`);if(!Lc(o.taskIds,e.taskIds))throw new Error(`Vue reference worker ${e.workerId} result task identities do not match its assignment`);if(o.ok===!1)throw typeof o.error!="string"?new Error(`Vue reference worker ${e.workerId} failure payload is malformed`):new Error(`Vue reference worker ${e.workerId} failed: ${o.error}`);if(o.ok!==!0||!Tc(o.result))throw new Error(`Vue reference worker ${e.workerId} success payload is malformed`);return o.result}function Tc(e){if(!me(e)||!Array.isArray(e.occurrences)||!e.occurrences.every(Fc)||!D(e.skippedReferences)||!me(e.skippedReferenceReasons))return!1;for(let t of["missing-source-file","missing-service-script","no-definition","same-file-definition","unindexed-definition"])if(!D(e.skippedReferenceReasons[t]))return!1;return Array.isArray(e.skippedReferenceSamples)&&e.skippedReferenceSamples.every(Ac)}function Fc(e){return me(e)&&typeof e.sourceFile=="string"&&D(e.sourceLine)&&D(e.sourceStartChar)&&D(e.sourceEndChar)&&typeof e.sourceToken=="string"&&typeof e.definitionFile=="string"&&D(e.symbolId)}function Ac(e){return me(e)&&typeof e.sourceFile=="string"&&D(e.sourceLine)&&D(e.sourceStartChar)&&D(e.sourceEndChar)&&typeof e.token=="string"&&_c(e.reason)}function _c(e){return e==="missing-source-file"||e==="missing-service-script"||e==="no-definition"||e==="same-file-definition"||e==="unindexed-definition"}function D(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function me(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Lc(e,t){return Array.isArray(e)&&e.length===t.length&&e.every((n,r)=>typeof n=="string"&&n===t[r])}function vi(e,t){if(!Number.isSafeInteger(t)||t<=0)throw new TypeError(`${e} must be a positive safe integer.`)}function Dc(e){return e instanceof Error?e.message:String(e)}function Ti(e){let t=Number(process.env.CODEBASEIQ_AUGMENT_VUE_WORKERS??0),n=Number.isFinite(t)&&t>0?t:1;return Math.max(1,Math.min(e,n))}function Oc(){let e=Number(process.env.CODEBASEIQ_AUGMENT_VUE_WORKER_TIMEOUT_MS??0);return Number.isFinite(e)&&e>0?e:vc}function jc(){let e=Number(process.env.CODEBASEIQ_AUGMENT_VUE_WORKER_RESULT_MAX_BYTES??0);return Number.isSafeInteger(e)&&e>0?e:ki}function Cc(e){let t=Mc(),n=[];for(let r of e){let i=Fi(r),o=Math.max(1,Math.ceil(i/t));for(let a=0;a<o;a++)n.push({taskId:`${n.length}:${r}:${a}`,fileName:r,startOffset:Math.floor(i*a/o),endOffset:a===o-1?Number.POSITIVE_INFINITY:Math.floor(i*(a+1)/o),countFileSkip:a===0})}return n}function Mc(){return Number.POSITIVE_INFINITY}function Nc(e,t){let n=Array.from({length:t},()=>({tasks:[],weight:0})),r=e.map(i=>({task:i,weight:$c(i)})).sort((i,o)=>o.weight-i.weight);for(let i of r){let o=n.reduce((a,s)=>s.weight<a.weight?s:a);o.tasks.push(i.task),o.weight+=i.weight}return n.map(i=>i.tasks).filter(i=>i.length>0)}function $c(e){return Number.isFinite(e.endOffset)?Math.max(1,e.endOffset-e.startOffset):Math.max(1,Fi(e.fileName)-e.startOffset)}function Fi(e){try{return Pi(e).size}catch{return 1}}import{createRequire as Bc}from"module";import{existsSync as Vc}from"fs";import{dirname as Ai,extname as Uc,join as _i,relative as Wc,resolve as Gc}from"path";import{pathToFileURL as qc}from"url";function Jc(e){e.transaction(()=>{e.prepare(`
|
|
245
|
-
DELETE FROM mentions
|
|
246
|
-
WHERE chunk_id IN (
|
|
247
|
-
SELECT c.id
|
|
248
|
-
FROM chunks c
|
|
249
|
-
JOIN documents d ON d.id = c.document_id
|
|
250
|
-
WHERE d.language = 'vue' OR d.relative_path LIKE '%.vue'
|
|
251
|
-
)
|
|
252
|
-
`).run(),e.prepare(`
|
|
253
|
-
DELETE FROM chunks
|
|
254
|
-
WHERE document_id IN (
|
|
255
|
-
SELECT id
|
|
256
|
-
FROM documents
|
|
257
|
-
WHERE language = 'vue' OR relative_path LIKE '%.vue'
|
|
258
|
-
)
|
|
259
|
-
`).run()})()}function Li(e,t){return e.prepare(`
|
|
260
|
-
SELECT relative_path AS relativePath
|
|
261
|
-
FROM documents
|
|
262
|
-
WHERE language = 'vue' OR relative_path LIKE '%.vue'
|
|
263
|
-
ORDER BY relative_path
|
|
264
|
-
`).all().map(r=>Gc(t,r.relativePath))}function Di(e,t){let{vueCore:n,ts:r,volarTs:i}=Hc(e),{parsed:o,vueOptions:a}=zc(n,r,t),s=Ai(t),c=n.createVueLanguagePlugin(r,o.options,a,g=>g),u=Xc(n,r,c),l=Kc(s,o),{languageServiceHost:d}=i.createLanguageServiceHost(r,r.sys,u,g=>g,l),p=r.createLanguageService(d);return{ts:r,language:u,languageService:p,fileNames:o.fileNames,configDir:s}}function Hc(e){let t=Bc(qc(_i(e,"package.json")).href);return{vueCore:qt(t,"@vue/language-core",e),ts:qt(t,"typescript",e),volarTs:qt(t,"@volar/typescript",e)}}function zc(e,t,n){let r=t.readConfigFile(n,t.sys.readFile);if(r.error||!r.config)throw new Error(`Failed to read ${n}`);let o=e.createParsedCommandLine(t,t.sys,n).vueOptions;return typeof e.createGlobalTypesWriter=="function"&&(o.globalTypesPath=e.createGlobalTypesWriter(o,t.sys.writeFile)),{parsed:t.parseJsonConfigFileContent(r.config,t.sys,Ai(n),void 0,n,void 0,e.getAllExtensions(o).map(a=>({extension:a.slice(1),isMixedContent:!0,scriptKind:t.ScriptKind.Deferred}))),vueOptions:o}}function Xc(e,t,n){let r={},i=e.createLanguage([n],new Map,o=>{if(!Vc(o))return;let a=F(o,{maxBytes:Ze,inputKind:"Vue language-service source file"});r.current?.scripts.set(o,t.ScriptSnapshot.fromString(a),n.getLanguageId(o)??nu(o))});return r.current=i,i}function Kc(e,t){return{getCurrentDirectory:()=>e,getCompilationSettings:()=>t.options,getScriptFileNames:()=>t.fileNames,getProjectReferences:()=>t.projectReferences,getProjectVersion:()=>"0"}}function qt(e,t,n){try{return e(t)}catch(r){throw(typeof r=="object"&&r!==null&&"code"in r?r.code:null)==="MODULE_NOT_FOUND"?new Error(`Vue augmentation requires ${t} to be installed in ${n}. Install Vue/Volar dependencies for that project, then rerun augment-vue.`,{cause:r}):r}}function Oi(e,t,n){let r=Yc(e);return i=>{if(!i.name)return null;let o=O(t,i.fileName),a=n.get(i.fileName);if(!a)return null;let s=n.positionAt(a,i.textSpan.start),c=r.get(o);if(!c)return null;let u=c.starts.find(d=>d.line===s.line&&d.displayName===i.name);if(u)return u.symbolId;let l=c.containingByLine.get(s.line);return l&&l.displayName===i.name?l.symbolId:Qc(c.starts,s.line,2,i.name)}}function Yc(e){let t=e.prepare(`
|
|
265
|
-
SELECT
|
|
266
|
-
d.relative_path AS relativePath,
|
|
267
|
-
der.start_line AS startLine,
|
|
268
|
-
der.end_line AS endLine,
|
|
269
|
-
der.symbol_id AS symbolId,
|
|
270
|
-
gs.display_name AS displayName
|
|
271
|
-
FROM defn_enclosing_ranges der
|
|
272
|
-
JOIN documents d ON d.id = der.document_id
|
|
273
|
-
JOIN global_symbols gs ON gs.id = der.symbol_id
|
|
274
|
-
ORDER BY d.relative_path, (der.end_line - der.start_line) DESC
|
|
275
|
-
`).all(),n=new Map;for(let r of t){let i=n.get(r.relativePath);i||(i={containingByLine:new Map,starts:[]},n.set(r.relativePath,i)),i.starts.push({line:r.startLine,symbolId:r.symbolId,displayName:r.displayName});for(let o=r.startLine;o<=r.endLine;o++)i.containingByLine.set(o,{symbolId:r.symbolId,displayName:r.displayName})}for(let r of n.values())r.starts.sort((i,o)=>i.line-o.line);return n}function Qc(e,t,n,r){let i=0,o=e.length-1;for(;i<=o;){let s=Math.floor((i+o)/2);e[s].line<t?i=s+1:o=s-1}let a=null;for(let s of[o,i]){let c=e[s];if(!c||c.displayName!==r)continue;let u=Math.abs(c.line-t);u>n||(!a||u<a.distance)&&(a={distance:u,symbolId:c.symbolId})}return a?.symbolId??null}function ji(e,t,n){let r=ou(t),i=e.prepare("SELECT id FROM global_symbols WHERE symbol = ?"),o=e.prepare(`
|
|
276
|
-
INSERT OR IGNORE INTO global_symbols (symbol, display_name, kind, documentation)
|
|
277
|
-
VALUES (?, ?, ?, ?)
|
|
278
|
-
`),a=0,s=new Map;return e.transaction(()=>{for(let u of n){let l=O(t,u),d=Gi(r.name,r.version,l);o.run(d,"default",7,`Vue component|${l}`);let p=au(i,r,t,u);p&&(a++,s.set(u,p))}})(),{get(u){return s.get(u)??null},syntheticSymbols:a}}function Ci(e,t,n,r,i){return e.transaction(()=>(Jc(e),Zc(e,t,n,r),eu(e,i)))()}function Zc(e,t,n,r){let i=e.prepare("SELECT id FROM documents WHERE relative_path = ?"),o=e.prepare(`
|
|
279
|
-
INSERT INTO chunks (document_id, chunk_index, start_line, end_line, occurrences)
|
|
280
|
-
VALUES (?, ?, ?, ?, X'00')
|
|
281
|
-
`),a=e.prepare(`
|
|
282
|
-
INSERT OR IGNORE INTO mentions (chunk_id, symbol_id, role)
|
|
283
|
-
VALUES (?, ?, 1)
|
|
284
|
-
`);for(let s of n){let c=r.get(s);if(!c)continue;let u=O(t,s),l=i.get(u);if(!l)continue;let d=o.run(l.id,-1,0,0);a.run(Number(d.lastInsertRowid),c)}}function Mi(e,t,n,r,i){if(e.fileName.endsWith(".vue")){let o=r.language.scripts.get(e.fileName),a=o?.generated?.languagePlugin.typescript?.getServiceScript(o.generated.root)?.code;if(o&&a){let s=r.language.maps.get(a,o);if(Jt(s,e.textSpan.start)!==null)return n.get(e.fileName)}return e.fileName.startsWith(i)?n.get(e.fileName):null}return t(e)}function Ni(e){let t=new Set,n=[];for(let r of e){let i=$i(r);t.has(i)||(t.add(i),n.push(r))}return n}function $i(e){return[e.sourceFile,e.sourceLine,e.sourceStartChar,e.sourceEndChar,e.symbolId].join(":")}function eu(e,t){let n=iu(e,[...new Set(t.map(c=>c.sourceFile))]),r=e.prepare(`
|
|
285
|
-
INSERT INTO chunks (document_id, chunk_index, start_line, end_line, occurrences)
|
|
286
|
-
VALUES (?, ?, ?, ?, X'00')
|
|
287
|
-
`),i=e.prepare(`
|
|
288
|
-
INSERT OR IGNORE INTO mentions (chunk_id, symbol_id, role)
|
|
289
|
-
VALUES (?, ?, 0)
|
|
290
|
-
`),o=new Set,a=0,s=0;for(let c of t){let u=$i(c);if(o.has(u))continue;o.add(u);let l=n.get(c.sourceFile);if(!l)continue;let d=r.run(l,s++,c.sourceLine,c.sourceLine),p=i.run(Number(d.lastInsertRowid),c.symbolId);a+=Number(p.changes)}return a}function*Bi(e){let t=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,n=new Set(["script","setup","template","style","lang","scoped","true","false","null","undefined","const","let","var","import","from","export","return","if","else","for","while","function","class","type","interface","as","await","async"]),r;for(;r=t.exec(e);){let i=r[0];n.has(i)||(yield{text:i,start:r.index,end:r.index+i.length})}}function Vi(e,t){for(let[n]of e.toGeneratedLocation(t,r=>!!r.navigation))return n;return null}function Jt(e,t){let n=e;for(let[r]of n.toSourceLocation(t,i=>!!i.navigation))return r;return null}function tu(e,t){let n=0,r=e.lineStarts.length-1;for(;n<=r;){let o=Math.floor((n+r)/2);e.lineStarts[o]<=t?n=o+1:r=o-1}let i=Math.max(0,r);return{line:i,character:t-e.lineStarts[i]}}function Ui(e,t){return O(e,t).startsWith("node_modules/")}function O(e,t){return Wc(e,t).replaceAll("\\","/")}function nu(e){switch(Uc(e)){case".vue":return"vue";case".tsx":return"typescriptreact";case".ts":case".mts":case".cts":return"typescript";case".jsx":return"javascriptreact";case".js":case".mjs":case".cjs":return"javascript";case".json":return"json";default:return"typescript"}}function Wi(){let e=new Map;return{get(t){if(e.has(t))return e.get(t)??null;try{let n=F(t,{maxBytes:Ze,inputKind:"Vue source file"}),r={text:n,lineStarts:ru(n)};return e.set(t,r),r}catch{return e.set(t,null),null}},positionAt:tu}}function ru(e){let t=[0];for(let n=0;n<e.length;n++)e.charCodeAt(n)===10&&t.push(n+1);return t}function iu(e,t){let n=new Map,r=500;for(let i=0;i<t.length;i+=r){let o=t.slice(i,i+r),a=e.prepare(`SELECT id, relative_path AS relativePath FROM documents WHERE relative_path IN (${o.map(()=>"?").join(",")})`).all(...o);for(let s of a)n.set(s.relativePath,s.id)}return n}function ou(e){try{let t=JSON.parse(F(_i(e,"package.json"),{maxBytes:Y,inputKind:"project package manifest"}));return{name:t.name??"workspace",version:t.version??"0.0.0"}}catch{return{name:"workspace",version:"0.0.0"}}}function au(e,t,n,r){let i=O(n,r),o=Gi(t.name,t.version,i);return e.get(o)?.id??null}function Gi(e,t,n){let r=n.split("/").map(i=>`\`${i.replaceAll("`","")}\``).join("/");return`scip-vue npm ${e} ${t} ${r}/default.`}async function gu(e){return H(J(),{projectRoot:e.projectRoot,dbPath:e.dbPath}),fu(e)}async function fu(e){let t=pu(e.projectRoot,e.tsconfig);if(!uu(t))throw new Error(`Vue tsconfig not found at ${t}`);let n=new cu(e.dbPath);try{let r=Li(n,e.projectRoot),i=du(lu(e.dbPath),"augment-vue-meta.json");return await Gr({cachePath:i,readFingerprint:()=>Su(n,e.projectRoot,e.tsconfig),compute:()=>mu({db:n,projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,configPath:t,vueFiles:r,onStatus:e.onStatus}),onCacheHit:o=>e.onStatus?.(`Vue references unchanged; reused ${o.resolvedReferences} cached resolved references.`)})}finally{n.close()}}async function mu(e){let t=ji(e.db,e.projectRoot,e.vueFiles),n=wi(e.vueFiles)?await Ei({projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,vueFiles:e.vueFiles}):yu(e,t);return hu(e,t,n)}function hu(e,t,n){let r=Ni(n.occurrences),i=Ci(e.db,e.projectRoot,e.vueFiles,t,r),o={vueFiles:e.vueFiles.length,resolvedReferences:r.length,resolvedReferenceSamples:Eu(e.db,r,20),insertedMentions:i,skippedReferences:n.skippedReferences,skippedReferenceReasons:n.skippedReferenceReasons,skippedReferenceSamples:wu(n.skippedReferenceSamples,20),syntheticSymbols:t.syntheticSymbols};return e.onStatus?.(`Resolved ${o.resolvedReferences} Vue references with Volar; inserted ${o.insertedMentions} mentions.`),o}function yu(e,t){let n=bu({db:e.db,projectRoot:e.projectRoot,configPath:e.configPath,vueSymbolLookup:t});return Ru({...n,vueFiles:n.context.fileNames.filter(r=>r.endsWith(".vue"))})}function Su(e,t,n){let r=e.prepare(`
|
|
291
|
-
SELECT
|
|
292
|
-
(SELECT COUNT(*) FROM documents) AS documents,
|
|
293
|
-
(SELECT COUNT(*) FROM global_symbols) AS symbols,
|
|
294
|
-
(SELECT COUNT(*) FROM chunks) AS chunks,
|
|
295
|
-
(SELECT COUNT(*) FROM mentions) AS mentions,
|
|
296
|
-
(SELECT COUNT(*) FROM defn_enclosing_ranges) AS ranges,
|
|
297
|
-
(SELECT MAX(id) FROM chunks) AS maxChunkId,
|
|
298
|
-
(SELECT MAX(id) FROM global_symbols) AS maxSymbolId
|
|
299
|
-
`).get();return{version:3,tsconfig:n,files:Ie(t),db:r}}function bu(e){let t=Wi();return{projectRoot:e.projectRoot,context:Di(e.projectRoot,e.configPath),symbolLookup:Oi(e.db,e.projectRoot,t),vueSymbolLookup:e.vueSymbolLookup,sourceReader:t}}function Ru(e){let t=[],n=se(),r=e.tasks??e.vueFiles.map(i=>({fileName:i,startOffset:0,endOffset:Number.POSITIVE_INFINITY,countFileSkip:!0}));for(let i of r){let o=xu(e,i);t.push(...o.occurrences),He(n,o)}return{occurrences:t,...n}}function xu(e,t){let n=e.sourceReader.get(t.fileName);if(!n)return qi(e.projectRoot,t,"missing-source-file");let r=e.context.language.scripts.get(t.fileName),i=r?.generated?.languagePlugin.typescript?.getServiceScript(r.generated.root)?.code;if(!r||!i)return qi(e.projectRoot,t,"missing-service-script");let o=e.context.language.maps.get(i,r),a=O(e.projectRoot,t.fileName),s=[...Bi(n.text)],c={tokens:s.filter(u=>u.start>=t.startOffset&&u.start<t.endOffset),tokenByStart:new Map(s.map(u=>[u.start,u])),tokenTextCounts:Fu(s),processedStarts:new Set};return vu({...e,fileName:t.fileName,sourceInfo:n,sourceFile:a,map:o,tokenContext:c})}function vu(e){let t=[],n=se();for(let r of e.tokenContext.tokens){if(e.tokenContext.processedStarts.has(r.start)||Pu(e.sourceInfo.text,r.start))continue;let i=Vi(e.map,r.start);if(i===null)continue;let a=(e.context.languageService.getDefinitionAtPosition(e.fileName,i+1)??[]).find(l=>!Ui(e.projectRoot,l.fileName));if(!a){Ht(n,e.sourceReader,e.sourceInfo,e.sourceFile,r,"no-definition");continue}let s=O(e.projectRoot,a.fileName),c=Iu(e.sourceFile,r.text,s);if(c){Ht(n,e.sourceReader,e.sourceInfo,e.sourceFile,r,c);continue}let u=Mi(a,e.symbolLookup,e.vueSymbolLookup,e.context,e.projectRoot);if(u===null){Ht(n,e.sourceReader,e.sourceInfo,e.sourceFile,r,"unindexed-definition");continue}Ji(t,e.sourceReader,e.sourceInfo,e.sourceFile,r,s,u),e.tokenContext.processedStarts.add(r.start),Tu(t,e,r,i,s,u)}return{occurrences:t,...n}}function Pu(e,t){let n=e.lastIndexOf(`
|
|
300
|
-
`,t-1)+1,r=e.slice(n,t);return/\bfrom\s+['"][^'"]*$/.test(r)||/\bimport\s*\(\s*['"][^'"]*$/.test(r)}function Iu(e,t,n){return n===e?"same-file-definition":n.endsWith(".vue")&&t!==n.split("/").at(-1)?.replace(/\.vue$/,"")?"unindexed-definition":null}function qi(e,t,n){let r=se();return t.countFileSkip&&(r.skippedReferences=1,r.skippedReferenceReasons[n]=1,r.skippedReferenceSamples.push({sourceFile:O(e,t.fileName),sourceLine:0,sourceStartChar:0,sourceEndChar:0,token:"",reason:n})),{occurrences:[],...r}}function Ht(e,t,n,r,i,o){if(e.skippedReferences++,e.skippedReferenceReasons[o]++,e.skippedReferenceSamples.filter(s=>s.reason===o&&s.sourceFile===r).length>=2)return;let a=t.positionAt(n,i.start);e.skippedReferenceSamples.push({sourceFile:r,sourceLine:a.line,sourceStartChar:a.character,sourceEndChar:a.character+i.text.length,token:i.text,reason:o})}function zt(e,t){let n=new Map;for(let o of e){let a=n.get(o.sourceFile)??[];a.push(o),n.set(o.sourceFile,a)}let r=[...n.keys()].sort(),i=[];for(let o=0;i.length<t;o++){let a=!1;for(let s of r){let c=n.get(s)?.[o];if(c&&(i.push(c),a=!0,i.length===t))break}if(!a)break}return i}function ku(e,t){let n=zt(e.filter(o=>o.sourceFile!==o.definitionFile),Math.ceil(t/2)),r=new Set(n.map(o=>`${o.sourceFile}:${o.sourceLine}:${o.sourceStartChar}:${o.sourceEndChar}:${o.symbolId}`)),i=zt(e.filter(o=>!r.has(`${o.sourceFile}:${o.sourceLine}:${o.sourceStartChar}:${o.sourceEndChar}:${o.symbolId}`)),t-n.length);return[...n,...i]}function wu(e,t){let n=[...new Set(e.map(i=>i.reason))].sort(),r=[];for(let[i,o]of n.entries()){let a=n.length-i,s=Math.ceil((t-r.length)/a);r.push(...zt(e.filter(c=>c.reason===o),s))}return r.slice(0,t)}function Eu(e,t,n){let r=e.prepare("SELECT symbol FROM global_symbols WHERE id = ?");return ku(t,n).map(({symbolId:i,...o})=>({...o,definitionSymbol:r.get(i)?.symbol??`symbol-id:${i}`}))}function Tu(e,t,n,r,i,o){if(!((t.tokenContext.tokenTextCounts.get(n.text)??0)<=1))for(let a of Au(t.context.languageService,t.fileName,r+1,t.map,n,t.tokenContext.tokenByStart)){if(t.tokenContext.processedStarts.has(a))continue;let s=t.tokenContext.tokenByStart.get(a);s&&(Ji(e,t.sourceReader,t.sourceInfo,t.sourceFile,s,i,o),t.tokenContext.processedStarts.add(a))}}function Ji(e,t,n,r,i,o,a){let s=t.positionAt(n,i.start);e.push({sourceFile:r,sourceLine:s.line,sourceStartChar:s.character,sourceEndChar:s.character+i.text.length,sourceToken:i.text,definitionFile:o,symbolId:a})}function Fu(e){let t=new Map;for(let n of e)t.set(n.text,(t.get(n.text)??0)+1);return t}function Au(e,t,n,r,i,o){let a=e.getDocumentHighlights?.(t,n,[t])??[],s=[];for(let c of a)if(c.fileName===t)for(let u of c.highlightSpans){let l=_u(r,u.textSpan.start,o,i.text);l!==null&&s.push(l)}return s}function _u(e,t,n,r){let i=n.get(t);if(i?.text===r)return i.start;let o=Jt(e,t);if(o===null)return null;let a=n.get(o);return a?.text===r?a.start:null}async function ro(e){let{projectRoot:t,maxHeapMb:n=8192,onStatus:r=console.log}=e,i=e.skipAutoInstall===!0||e.installMissing!==!0,o=$u(e),a=Date.now(),s=R();Xe(y(o.outputScip),{recursive:!0}),Xe(y(o.outputDb),{recursive:!0});let c=e.languages??lt(t);if(c.length===0)throw new Error("No supported languages detected in this project. Looked for: tsconfig.json, Cargo.toml, go.mod, pyproject.toml, etc.");r(`Detected languages: ${c.join(", ")}`);let u=Pe("reindex.fingerprint",()=>Rn(t,c,{pnpmWorkspaces:e.pnpmWorkspaces,typescriptProjectMode:e.typescriptProjectMode,typescriptProjects:e.typescriptProjects,clojureConfigPath:e.clojureConfigPath}),{languages:c.length}),l,d;if(e.skipIfUnchanged!==!1&&!Mn(t,o.outputDb)&&Hi(o.outputScip)===Hi(w(y(o.outputDb),"index.scip"))){let h=be(t);if(l=h?.clean?ke(h,u):void 0,h&&!h.clean&&!Nu(o)){let S=Nn(h,c,{pnpmWorkspaces:e.pnpmWorkspaces,typescriptProjectMode:e.typescriptProjectMode,typescriptProjects:e.typescriptProjects,clojureConfigPath:e.clojureConfigPath});if(S)try{we({snapshot:S.snapshot,manifest:S.manifest,targetCacheDir:y(o.outputDb),targetProjectRoot:t,persistLease:!1}),Un(S.snapshot,y(o.outputDb)),r(`Forked shared baseline ${S.snapshot.generationId.slice(0,12)} for dirty worktree reindex`)}catch(b){r(`Shared baseline fork failed; continuing locally: ${N(b)}`)}}else if(l){let S=mt(l);if(S){if(!Mu(o,u))try{we({snapshot:l,manifest:S,targetCacheDir:y(o.outputDb),targetProjectRoot:t}),r(`Attached shared generation ${l.generationId.slice(0,12)}`)}catch(b){r(`Shared generation attach failed; continuing locally: ${N(b)}`)}}else{let b=await Bn(l);if(b.kind==="owner")d=b.release;else if(b.kind==="generation-ready"){let P=mt(l);if(P)try{we({snapshot:l,manifest:P,targetCacheDir:y(o.outputDb),targetProjectRoot:t,action:"waited"}),r(`Attached shared generation ${l.generationId.slice(0,12)} after waiting`)}catch(v){r(`Shared generation attach failed after waiting; continuing locally: ${N(v)}`)}}else r("Shared generation build lock timed out; continuing with an isolated local reindex")}}}let g=fn(w(y(o.outputDb),"cache-lifecycle.lock"),{waitMs:3e4});if(!g)throw d?.(),new Error(`Could not acquire codebaseiq cache lifecycle lock for ${y(o.outputDb)}.`);let f;try{f=await te("reindex.lock",()=>pl(w(y(o.outputDb),"index.lock"),{projectRoot:t,trigger:e.trigger,onStatus:r}),{languages:c.length})}catch(h){throw g.release(),d?.(),h}let m=null,I=pr();try{vn(o.outputDb,o.outputScip,o.metaPath);let h=Wu(y(o.outputDb));h.removed>0&&r(`Removed ${h.removed} abandoned reindex workspace(s)`);for(let X of h.errors)r(`Could not remove abandoned reindex workspace: ${X}`);let S=null,b=Pe("reindex.reuse-check",()=>(S=Bu({opts:e,paths:o,languages:c,fingerprint:u,start:a,monotonicStart:s,onStatus:r}),S),()=>({languages:c.length,reused:S!==null}));if(b){zi({snapshot:l,paths:o,projectRoot:t,fingerprint:u,onStatus:r});let X=Ft(o.outputDb,b);return X.state==="failed"&&r(`Warning: reindex succeeded, but activity telemetry was not recorded: ${X.reason}`),at(t,y(o.outputDb)),b}await te("reindex.scip-cli-ready",()=>il(i,r));let P=Uu(o);m=P.runDir;let v,x=await te("reindex.fresh",async()=>(v=await Gu({opts:e,languages:c,projectRoot:t,paths:o,tempPaths:P,fingerprint:u,start:a,monotonicStart:s,maxHeapMb:n,skipAutoInstall:i,onStatus:r,writeTelemetry:I}),v),()=>({languages:c.length,reused:v?.reused,skipped:v?.skipped.length}));zi({snapshot:l,paths:o,projectRoot:t,fingerprint:u,onStatus:r});let z=Ft(o.outputDb,x);return z.state==="failed"&&r(`Warning: reindex succeeded, but activity telemetry was not recorded: ${z.reason}`),at(t,y(o.outputDb)),x}catch(h){let S=Qe({trigger:e.trigger,result:"failed",start:a,monotonicStart:s,error:h instanceof Error?h.message:String(h)});yo(o.metaPath,S);let b=Kr(o.outputDb,S);throw b.state==="failed"&&r(`Warning: failed reindex activity telemetry was not recorded: ${b.reason}`),h}finally{if(m){let h=m;try{ee(()=>ce(h,{recursive:!0,force:!0}))}catch(S){r(`Warning: temporary reindex workspace was left behind: ${N(S)}`)}}f(),g.release(),d?.()}}function zi(e){if(e.snapshot)try{let t=be(e.projectRoot),n=t?ke(t,e.fingerprint):void 0;if(!n||n.generationId!==e.snapshot.generationId){e.onStatus("Skipped shared generation publication because the worktree changed during indexing");return}let r=$n({snapshot:e.snapshot,sourceCacheDir:y(e.paths.outputDb),sourceProjectRoot:e.projectRoot,sourceStillValid:()=>{let i=be(e.projectRoot);return(i?ke(i,e.fingerprint):void 0)?.generationId===e.snapshot?.generationId}});Vn(e.snapshot,y(e.paths.outputDb),"built"),e.onStatus(r.kind==="published"?`Published shared generation ${e.snapshot.generationId.slice(0,12)} (${r.achievedDurability})`:`Shared generation ${e.snapshot.generationId.slice(0,12)} was already available (${r.achievedDurability})`)}catch(t){e.onStatus(`Shared generation publication failed; local index remains valid: ${N(t)}`)}}function Mu(e,t){if(!E(e.outputScip)||!E(e.outputDb)||!ho(e.metaPath,t))return!1;let n=V(e.outputDb,e.metaPath);return n.state!=="invalid"&&n.state!=="drifted"}function Nu(e){if(!E(e.outputScip)||!E(e.outputDb)||!ue(e.metaPath))return!1;let t=V(e.outputDb,e.metaPath);return t.state!=="invalid"&&t.state!=="drifted"}function N(e){return e instanceof Error?e.message:String(e)}function Yt(e,t,n,r,i,o){try{H(fr({indexPath:n,reuseExisting:i,affectedFiles:o}),{projectRoot:e,dbPath:t,onStatus:r})}catch(a){r(`Runtime-boundary extraction unavailable: ${a instanceof Error?a.message:String(a)}.`)}}function $u(e){let t=e.outputScip??w(e.projectRoot,"index.scip"),n=e.outputDb??w(e.projectRoot,"index.db");return{outputScip:t,outputDb:n,metaPath:w(y(n),"meta.json")}}function Bu(e){let t=V(e.paths.outputDb,e.paths.metaPath);if(e.opts.skipIfUnchanged===!1||!E(e.paths.outputScip)||!E(e.paths.outputDb)||!ho(e.paths.metaPath,e.fingerprint)||t.state==="invalid"||t.state==="drifted")return null;H(J(),{projectRoot:e.opts.projectRoot,dbPath:e.paths.outputDb,onStatus:e.onStatus}),Yt(e.opts.projectRoot,e.paths.outputDb,e.paths.outputScip,e.onStatus,!0),V(e.paths.outputDb,e.paths.metaPath).state==="drifted"&&(dt(e.paths.outputDb,e.paths.metaPath),e.onStatus("Published refreshed SQLite generation after post-index augmentation"));let n=R()-e.monotonicStart,r=Qe({trigger:e.opts.trigger,result:"reused",start:e.start,monotonicStart:e.monotonicStart,languages:e.languages,skipped:[]});return yo(e.paths.metaPath,r),e.onStatus(`Index unchanged; reused existing SQLite index in ${(n/1e3).toFixed(1)}s`),{languages:e.languages,indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:n,reused:!0,skipped:[],lastRefresh:r,shards:Vu(e.paths,e.opts.projectRoot,e.languages,e.opts)}}function Vu(e,t,n,r){let i=fo(t,n,r);return n.map(o=>({id:o,language:o,reused:!0,fingerprint:he(i[o]),outputBytes:ye(Zt(e.outputDb,o)),durationMs:0}))}function Uu(e){let t=Du(w(y(e.outputDb),"reindex-"));return{runDir:t,tempOutputScip:w(t,ze(e.outputScip)),tempOutputDb:w(t,ze(e.outputDb)),tempMetaPath:w(t,ze(e.metaPath))}}function Wu(e){let t=[],n;try{n=to(e,{withFileTypes:!0})}catch(i){return{removed:0,errors:[N(i)]}}let r=0;for(let i of n)if(!(!i.name.startsWith("reindex-")||!i.isDirectory()))try{ce(w(e,i.name),{recursive:!0,force:!0}),r+=1}catch(o){t.push(`${i.name}: ${N(o)}`)}return{removed:r,errors:t}}async function Gu(e){let t={...process.env,NODE_OPTIONS:`--max-old-space-size=${e.maxHeapMb}`},n,r=await te("reindex.language-indexers",async()=>(n=await Ju(e,t),n),()=>({languages:e.languages.length,indexed:n?.indexedOutputs.length,reused:n?.reusedLanguages.length,skipped:n?.skippedLanguages.length})),{indexedOutputs:i,skippedLanguages:o,reusedLanguages:a,languageFingerprints:s,shards:c,typescriptProjectShardContext:u,incrementalTypeScript:l}=r;if(a.length>0&&e.onStatus(`Reused ${a.length} cached language shard(s): ${a.join(", ")}`),qu({run:e,indexedOutputs:i,skippedLanguages:o,reusedLanguages:a})){let g=Pe("reindex.publish",()=>tl(e,i,o,a,s,u),{mode:"metadata-only",languages:i.length,reused:a.length}),f=g.durationMs;return e.onStatus(`All language shards unchanged; reused existing SQLite index in ${(f/1e3).toFixed(1)}s`),{languages:i.map(m=>m.language),indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:f,reused:!0,skipped:o,lastRefresh:g,shards:c,writeTelemetry:e.writeTelemetry}}let d=await te("reindex.publish",()=>el(e,t,i,o,a,s,u,l),{mode:l?"incremental-or-fallback":"full",languages:i.length,reused:a.length,skipped:o.length}),p=d.durationMs;return e.onStatus(`Done in ${(p/1e3).toFixed(1)}s`),{languages:i.map(g=>g.language),indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:p,reused:!1,skipped:o,lastRefresh:d,shards:c,writeTelemetry:e.writeTelemetry}}function qu(e){if(e.run.opts.skipIfUnchanged===!1||e.skippedLanguages.length>0||!E(e.run.paths.outputScip)||!E(e.run.paths.outputDb))return!1;let t=V(e.run.paths.outputDb,e.run.paths.metaPath);if(t.state==="invalid"||t.state==="drifted")return!1;let n=new Set(e.reusedLanguages),r=new Set(e.indexedOutputs.map(i=>i.language));return e.run.languages.length>0&&r.size===e.run.languages.length&&e.indexedOutputs.length===e.run.languages.length&&e.run.languages.every(i=>n.has(i)&&r.has(i))}async function Ju(e,t){let n=Yu({paths:e.paths,projectRoot:e.projectRoot,languages:e.languages,pnpmWorkspaces:e.opts.pnpmWorkspaces,typescriptProjectMode:e.opts.typescriptProjectMode,typescriptProjects:e.opts.typescriptProjects,clojureConfigPath:e.opts.clojureConfigPath}),r=[],i=new Set;for(let[T,tn]of n)tn.reused&&(r.push({language:T,scipPath:tn.scipPath}),i.add(T));for(let T of i)e.onStatus(`Reusing cached ${T} SCIP shard (language inputs unchanged).`);let o=n.get("typescript"),a=V(e.paths.outputDb,e.paths.metaPath),s=ue(e.paths.metaPath),c=a.state==="legacy"||a.state==="current",u=s?.scipCompanion!=="deferred"&&(a.state!=="current"||a.generation.publication?.scipCompanion!=="deferred"),l=o&&!o.reused&&c?fi({projectRoot:e.projectRoot,cacheDir:y(e.paths.outputDb),previousDbPath:e.paths.outputDb,previousIndexPath:e.paths.outputScip,previousShardPath:o.scipPath,candidateShardPath:Se(e.tempPaths.tempOutputScip,"typescript-incremental",0),candidateAffectedScipPath:Se(e.tempPaths.tempOutputScip,"typescript-affected",0),baseShardCurrent:u,previousSnapshot:Qt(e.paths.metaPath),currentSnapshot:e.fingerprint,projectMode:e.opts.typescriptProjectMode,onStatus:e.onStatus}):null,d=new Set(l?["typescript"]:[]),p=l?void 0:Hu(e,n),{preparedRuns:g,skippedLanguages:f,languageOutputScipPaths:m}=ol({languages:e.languages.filter(T=>!i.has(T)&&!d.has(T)),tempOutputScip:e.tempPaths.tempOutputScip,projectRoot:e.projectRoot,env:t,skipAutoInstall:e.skipAutoInstall,trustProjectTools:e.opts.trustProjectTools===!0,pnpmWorkspaces:e.opts.pnpmWorkspaces,typescriptProjectMode:e.opts.typescriptProjectMode,typescriptProjects:e.opts.typescriptProjects,preDiscoveredTypeScriptProjects:p?.allProjects,clojureConfigPath:e.opts.clojureConfigPath,onStatus:e.onStatus}),I=p?g.filter(T=>T.language!=="typescript"||p.missedProjectIds.has(T.id)):g,h=await Si(I,e.projectRoot,e.onStatus,e.opts.indexerConcurrency,e.opts.signal),S=[];if(p){Xu(e.paths.outputDb,h,e.writeTelemetry);let T=m.typescript??e.tempPaths.tempOutputScip;S=Ku({outputDb:e.paths.outputDb,tempOutputScip:e.tempPaths.tempOutputScip,outputScipPath:T,reusedProjects:p.reusedProjects,writeTelemetry:e.writeTelemetry})}let b=[...h,...S],{indexedOutputs:P}=sl(b,f),v=l?[{language:"typescript",scipPath:l.scipPath}]:[],x=[...r,...v,...P];cl(x,f,e.languages,e.opts.allowPartial,e.onStatus);let z=l?[{id:"typescript",language:"typescript",label:"typescript (incremental documents)",scipPath:l.scipPath,outputScipPath:l.scipPath,durationMs:l.durationMs,command:"watch-service:typescript-index",outputBytes:ye(l.scipPath)??void 0}]:[],X=Qu(n,[...h,...z],p?{outputDb:e.paths.outputDb,classification:p.classification}:void 0);return{indexedOutputs:x,skippedLanguages:f,reusedLanguages:[...i],languageFingerprints:Zu(n,e.languages),shards:X,typescriptProjectShardContext:p?{projects:p.allProjects,fingerprints:p.fingerprints}:void 0,incrementalTypeScript:l??void 0}}function Hu(e,t){let n=t.get("typescript");if(!n||n.reused||e.opts.typescriptProjectMode!=="workspace")return;let r=ne(e.projectRoot,e.opts.typescriptProjects);if(r.length===0)return;let i=ti(e.projectRoot,r),o=Qr(n.fingerprint.files,r),a=Zr(r,i),s=ei(r,o,a),c=ue(e.paths.metaPath),l=zu(c,s,f=>E(Ye(e.paths.outputDb,f))),d=[...l.entries()].filter(([,f])=>f.reused).map(([f])=>f),p=new Set(d),g=new Set(r.filter(f=>!p.has(f)).map(f=>`typescript:${f}`));return{allProjects:r,fingerprints:s,classification:l,reusedProjects:d,missedProjectIds:g}}function zu(e,t,n){let r=new Map;for(let i of Object.keys(t)){let o=t[i];if(!e){r.set(i,{reused:!1,reason:"no reindex metadata found",fingerprint:o});continue}let a=e.version===de&&ct(e).typescriptProjectShardReuse?e.typescriptProjectShards?.[i]:void 0;if(!a){r.set(i,{reused:!1,reason:"no cached fingerprint for this project",fingerprint:o});continue}if(!n(i)){r.set(i,{reused:!1,reason:"cached shard file missing on disk",fingerprint:o});continue}if(j(a)!==j(o)){r.set(i,{reused:!1,reason:"project inputs changed since last index",fingerprint:o});continue}r.set(i,{reused:!0,fingerprint:o})}return r}function Xu(e,t,n){for(let r of t){if(r.skipped||!r.id.startsWith("typescript:"))continue;let i=r.id.slice(11),o=Ye(e,i);Xe(y(o),{recursive:!0}),q(n,G(r.scipPath,o))}}function Ku(e){return e.reusedProjects.map((t,n)=>{let r=Ye(e.outputDb,t),i=Se(e.tempOutputScip,"typescript-project-cached",n);return q(e.writeTelemetry,G(r,i)),{id:`typescript:${t}`,language:"typescript",label:`typescript (${t})`,scipPath:i,outputScipPath:e.outputScipPath,durationMs:0,command:"cached",outputBytes:ye(i)??void 0}})}function Yu(e){let t=ue(e.paths.metaPath),n=fo(e.projectRoot,e.languages,e),r=new Map;for(let i of e.languages){let o=Zt(e.paths.outputDb,i),a=n[i];if(!t){r.set(i,{reused:!1,reason:"no reindex metadata found",fingerprint:a,scipPath:o});continue}if(t.version!==de){r.set(i,{reused:!1,reason:`metadata version ${String(t.version??"unknown")} predates per-language shard caching`,fingerprint:a,scipPath:o});continue}if(i==="typescript"&&t.scipCompanion==="deferred"){r.set(i,{reused:!1,reason:"whole TypeScript SCIP companion is deferred behind changed-document overlays",fingerprint:a,scipPath:o});continue}if(!ct(t).languageShardReuse||!t.languageFingerprints){r.set(i,{reused:!1,reason:"no per-language fingerprints recorded in metadata",fingerprint:a,scipPath:o});continue}let s=t.languageFingerprints[i];if(!s){r.set(i,{reused:!1,reason:"no cached fingerprint for this language",fingerprint:a,scipPath:o});continue}if(!E(o)){r.set(i,{reused:!1,reason:"cached shard file missing on disk",fingerprint:a,scipPath:o});continue}if(j(s)!==j(a)){r.set(i,{reused:!1,reason:"language inputs changed since last index",fingerprint:a,scipPath:o});continue}r.set(i,{reused:!0,fingerprint:a,scipPath:o})}return r}function Qu(e,t,n){let r=[];for(let[i,o]of e)o.reused&&r.push({id:i,language:i,reused:!0,fingerprint:he(o.fingerprint),outputBytes:ye(o.scipPath),durationMs:0});for(let i of t){let o=e.get(i.language),a=n&&i.id.startsWith("typescript:")?i.id.slice(11):null,s=a?n.classification.get(a):void 0;r.push({id:i.id,language:i.language,reused:!1,missReason:s?.reason??o?.reason??i.skipped?.reason,fingerprint:s?he(s.fingerprint):o?he(o.fingerprint):"unknown",outputBytes:i.outputBytes??null,durationMs:i.durationMs,command:i.command})}if(n)for(let[i,o]of n.classification)o.reused&&r.push({id:`typescript:${i}`,language:"typescript",reused:!0,fingerprint:he(o.fingerprint),outputBytes:ye(Ye(n.outputDb,i)),durationMs:0});return r}function he(e){return Lu("sha256").update(j(e)).digest("hex").slice(0,16)}function ye(e){try{return Ou(e).size}catch{return null}}function Zu(e,t){let n={};for(let r of t){let i=e.get(r);i&&(n[r]=i.fingerprint)}return n}async function el(e,t,n,r,i,o,a,s){A(e.opts.signal,"Reindex cancelled by its owner.");let c=!s||s.completeScipUpdated,u=!1;c&&(Xi(e.paths.outputDb,n,e.writeTelemetry),u=Ki(n,e.tempPaths.tempOutputScip,e.onStatus));let l=await ul({run:e,env:t,indexedOutputs:n,skippedLanguages:r,reusedLanguages:i,incrementalTypeScript:s,completeScipAvailable:c,completeScipSanitized:u,materializeFullFallback:async()=>{if(A(e.opts.signal,"Reindex cancelled by its owner."),!s||s.completeScipUpdated)return u;e.onStatus("Materializing the deferred whole TypeScript SCIP companion for full conversion..."),mi({cacheDir:y(e.paths.outputDb),generationIdentity:s.nextFragmentGeneration,baseShardPath:s.scipPath,candidateShardPath:s.candidateScipPath});let P=n.map(v=>v.language==="typescript"?{language:v.language,scipPath:s.candidateScipPath}:v);return Xi(e.paths.outputDb,P,e.writeTelemetry),u=Ki(P,e.tempPaths.tempOutputScip,e.onStatus),u}});A(e.opts.signal,"Reindex cancelled by its owner."),H(J(),{projectRoot:e.projectRoot,dbPath:e.tempPaths.tempOutputDb,onStatus:e.onStatus}),Yt(e.projectRoot,e.tempPaths.tempOutputDb,e.tempPaths.tempOutputScip,e.onStatus,!1,s?.affectedFiles);let d=Et(e.tempPaths.tempOutputDb);if(d.added.length>0&&e.onStatus(`Added SQLite query indexes: ${d.added.join(", ")}`),d.removed.length>0&&e.onStatus(`Removed redundant SQLite indexes: ${d.removed.join(", ")}`),l.mode==="incremental"&&s){let P=null,v=null;try{P=new L({projectRoot:e.projectRoot,dbPath:e.tempPaths.tempOutputDb,indexPath:e.tempPaths.tempOutputScip}),v=new L({projectRoot:e.projectRoot,dbPath:e.paths.outputDb,indexPath:e.paths.outputScip});let x=Zn(P,e.fingerprint,s.referenceFragmentsByFile,v);e.onStatus(`Cached exact TypeScript reference fragments for ${x} affected document(s).`)}catch(x){e.onStatus(`Exact TypeScript reference fragment prefill unavailable: ${x instanceof Error?x.message:String(x)}.`)}finally{P?.close(),v?.close()}}let p=Qt(e.paths.metaPath),g=l.mode==="incremental"&&s?dl(s,l.changedDocumentPaths):Pt({projectRoot:e.projectRoot,previousDbPath:e.paths.outputDb,previousIndexPath:e.paths.outputScip,candidateDbPath:e.tempPaths.tempOutputDb,candidateIndexPath:e.tempPaths.tempOutputScip,previousSnapshot:p,currentSnapshot:e.fingerprint,refreshResult:"rebuilt"}),f=Qe({trigger:e.opts.trigger,result:"rebuilt",start:e.start,monotonicStart:e.monotonicStart,languages:n.map(P=>P.language),skipped:[...r]}),m=l.mode==="incremental"&&l.scipCompanion==="deferred",I={...o};m&&delete I.typescript;let{metadata:h,pruneProjects:S}=oo({run:e,indexedOutputs:n,skippedLanguages:r,reusedLanguages:i,languageFingerprints:I,typescriptProjectShardContext:a,lastRefresh:f});h.scipCompanion=m?"deferred":"current",ao(e.paths.outputDb,S),en(e.tempPaths.tempMetaPath,h);let b=xn({tempOutputScip:e.tempPaths.tempOutputScip,tempOutputDb:e.tempPaths.tempOutputDb,tempMetaPath:e.tempPaths.tempMetaPath,outputScip:e.paths.outputScip,outputDb:e.paths.outputDb,metaPath:e.paths.metaPath,preserveOutputScip:l.mode==="incremental"&&l.scipCompanion==="deferred",publication:l.mode==="incremental"?{mode:"incremental",validation:"passed",converterDurationMs:l.converterDurationMs,affectedDocumentCount:s?.affectedFiles.length,changedDocumentCount:l.changedDocumentPaths.length,producerDurationMs:s?.timings.serviceMs,materializationDurationMs:s?.durationMs,patchDurationMs:l.patchDurationMs,scipCompanion:l.scipCompanion,...l.scipCompanion==="deferred"&&s?{typescriptOverlayGeneration:s.nextFragmentGeneration}:{}}:{mode:"full",validation:"passed",converterDurationMs:l.converterDurationMs,scipCompanion:"current",...l.fallbackReason?{fallbackReason:l.fallbackReason}:{}}});return b.achievedDurability==="file-flushed"&&e.onStatus(`Published local generation ${b.currentGeneration.slice(0,12)} (file-flushed; directory sync unsupported)`),Dn(y(e.paths.outputDb),l.mode==="incremental"&&l.scipCompanion==="deferred"?[s.nextFragmentGeneration]:[]),Fn(y(e.paths.outputDb),s?.completeScipUpdated?[s.nextFragmentGeneration]:[]),io(e.paths.outputDb,g,e.onStatus),f}function tl(e,t,n,r,i,o){let a=Qt(e.paths.metaPath),s=null;try{q(e.writeTelemetry,G(e.paths.outputDb,e.tempPaths.tempOutputDb))}catch(p){s=Ir("reused","oracle-error",`Could not snapshot the prior database: ${p instanceof Error?p.message:String(p)}`)}H(J(),{projectRoot:e.projectRoot,dbPath:e.paths.outputDb,onStatus:e.onStatus}),Yt(e.projectRoot,e.paths.outputDb,e.paths.outputScip,e.onStatus,!0);let c=Et(e.paths.outputDb);c.added.length>0&&e.onStatus(`Added SQLite query indexes: ${c.added.join(", ")}`),c.removed.length>0&&e.onStatus(`Removed redundant SQLite indexes: ${c.removed.join(", ")}`),s??=Pt({projectRoot:e.projectRoot,previousDbPath:e.tempPaths.tempOutputDb,previousIndexPath:e.paths.outputScip,candidateDbPath:e.paths.outputDb,candidateIndexPath:e.paths.outputScip,previousSnapshot:a,currentSnapshot:e.fingerprint,refreshResult:"reused"});let u=Qe({trigger:e.opts.trigger,result:"reused",start:e.start,monotonicStart:e.monotonicStart,languages:t.map(p=>p.language),skipped:[...n]}),{metadata:l,pruneProjects:d}=oo({run:e,indexedOutputs:t,skippedLanguages:n,reusedLanguages:r,languageFingerprints:i,typescriptProjectShardContext:o,lastRefresh:u});return ao(e.paths.outputDb,d),en(e.paths.metaPath,l),dt(e.paths.outputDb,e.paths.metaPath),io(e.paths.outputDb,s,e.onStatus),u}function Qt(e){return un(ue(e)?.fingerprint)}function io(e,t,n){try{wr(e,t),t.status==="evaluated"?n(`Affected-set shadow: ${(t.evaluation.recall*100).toFixed(1)}% recall; ${t.plan.affectedFiles.length} predicted, ${t.comparison.changedFiles.length} changed.`):n(`Affected-set shadow unavailable: ${t.reason}.`)}catch(r){n(`Affected-set shadow telemetry unavailable: ${r instanceof Error?r.message:String(r)}`)}}function oo(e){let t=nl({mode:e.run.opts.typescriptProjectMode,skippedLanguages:e.skippedLanguages,reusedLanguages:e.reusedLanguages,context:e.typescriptProjectShardContext,metaPath:e.run.paths.metaPath});return{metadata:{version:de,status:e.skippedLanguages.length===0?"complete":"partial",updatedAt:new Date().toISOString(),fingerprint:e.run.fingerprint,sqliteLayoutVersion:1,languageFingerprints:e.languageFingerprints,typescriptProjectShards:t.field,requestedLanguages:e.run.languages,indexedLanguages:e.indexedOutputs.map(n=>n.language),skipped:[...e.skippedLanguages],lastRefresh:e.lastRefresh},pruneProjects:t.pruneProjects}}function nl(e){if(e.mode!=="workspace")return{field:void 0,pruneProjects:null};if(e.skippedLanguages.some(t=>t.language==="typescript"))return{field:void 0,pruneProjects:null};if(e.reusedLanguages.includes("typescript")){let t=ue(e.metaPath),n=t?.version===de?t.typescriptProjectShards:void 0;return{field:n,pruneProjects:n?Object.keys(n):[]}}return e.context?{field:e.context.fingerprints,pruneProjects:e.context.projects}:{field:void 0,pruneProjects:[]}}function ao(e,t){let n=mo(e);if(t===null){ee(()=>ce(n,{recursive:!0,force:!0}));return}let r;try{r=to(n)}catch{return}for(let i of rl(r,t))ee(()=>ce(w(n,i),{force:!0}))}function rl(e,t){let n=new Set(t.map(r=>`${Ot(r)}.scip`));return e.filter(r=>!n.has(r))}function Xi(e,t,n){for(let r of t){let i=Zt(e,r.language);Xe(y(i),{recursive:!0}),r.scipPath!==i&&q(n,G(r.scipPath,i))}}async function il(e,t){if(!oe()){if(Cu()==="win32")throw new Error("The scip CLI was not found. On Windows it ships via the npm sidecar package codebaseiq-windows (installed automatically with codebaseiq). Reinstall codebaseiq with optional dependencies enabled, or follow 'codebaseiq setup' guidance for the exact sidecar package version, or set CODEBASEIQ_SCIP_BIN to a local scip.exe path.");if(e)throw new Error(`The scip CLI is required but not found on PATH.
|
|
301
|
-
To install the reviewed version, run: codebaseiq reindex --install-missing
|
|
302
|
-
Or install manually from: https://github.com/sourcegraph/scip/releases`);if(t("scip CLI not found on PATH. Attempting auto-install..."),!lr(t))throw new Error(`The scip CLI is required but could not be installed.
|
|
303
|
-
Install manually from: https://github.com/sourcegraph/scip/releases`)}}function ol(e){let t=[],n=[],r=e.languages.map((o,a)=>({language:o,scipPath:e.languages.length>1?Se(e.tempOutputScip,o,a):e.tempOutputScip})),i=Object.fromEntries(r.map(({language:o,scipPath:a})=>[o,a]));for(let{language:o,scipPath:a}of r){let s=al({...e,language:o,scipPath:a});for(let c of s)"skipped"in c?so(n,c.skipped):t.push(c.prepared)}return{preparedRuns:t,skippedLanguages:n,languageOutputScipPaths:i}}function al(e){if(e.language!=="typescript"||e.typescriptProjectMode!=="workspace")return[Xt({...e,id:e.language,label:e.language,outputScipPath:e.scipPath})];let t=e.preDiscoveredTypeScriptProjects??ne(e.projectRoot,e.typescriptProjects);return t.length===0?[Xt({...e,id:e.language,label:e.language,outputScipPath:e.scipPath})]:(e.onStatus(`Indexing TypeScript workspace as ${t.length} project shard(s).`),t.map((n,r)=>Xt({...e,id:`typescript:${n}`,label:`typescript (${n})`,scipPath:Se(e.tempOutputScip,"typescript-project",r),outputScipPath:e.scipPath,pnpmWorkspaces:!1,projectPath:n})))}function Xt(e){let t=It(e.language),n=Fe(t),r=zn(t,e.projectRoot),i=e.trustProjectTools&&r?Xn(t,e.projectRoot):null,o=pe(t);if(!i&&!o&&r){let l=`${n} is available only as repository-local code at ${r}. Review that exact tool and rerun with --trust-project-tools.`;return e.onStatus(`Skipping ${e.language}: ${l}`),{skipped:{language:e.language,reason:l}}}if(!i&&!o&&!Hn(t)){if(e.skipAutoInstall){let l=`${n} not found on PATH. To install the reviewed version, run: codebaseiq reindex --install-missing${t.installUrl?` (manual source: ${t.installUrl})`:""}`;return e.onStatus(`Skipping ${e.language}: ${l}`),{skipped:{language:e.language,reason:l}}}if(e.onStatus(`${n} not found. Attempting auto-install...`),!xi(t,e.onStatus)){let l=`${n} could not be auto-installed. ${t.installUrl?`Install manually from ${t.installUrl}`:`Install ${n} and put it on PATH.`}`;return e.onStatus(`Skipping ${e.language}: ${l}`),{skipped:{language:e.language,reason:l}}}}let a=i?.canonicalPath??pe(t);if(!a){let l=`${n} was not found after installation checks.`;return e.onStatus(`Skipping ${e.language}: ${l}`),{skipped:{language:e.language,reason:l}}}let{binary:s,args:c}=t.indexArgs({projectRoot:e.projectRoot,outputPath:e.scipPath,pnpmWorkspaces:e.pnpmWorkspaces,indexerBinary:a,projectPath:e.projectPath,configPath:e.language==="clojure"?e.clojureConfigPath:void 0}),u=Dr({language:e.language,projectPath:e.projectPath,pnpmWorkspaces:e.pnpmWorkspaces});if(i&&!i.executable){let l=`${i.relativePath} is not executable; refusing project-local indexer.`;return e.onStatus(`Skipping ${e.language}: ${l}`),{skipped:{language:e.language,reason:l}}}return i&&e.onStatus(`Trusted project-local ${e.language} indexer ${i.relativePath} (${i.sha256.slice(0,12)}\u2026, ${i.canonicalPath}).`),{prepared:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,config:t,resolvedBinary:a,binary:s,args:c,env:Yn(t,e.env,a),...u===void 0?{}:{temporaryRootConfigContent:u},...i?{trustedProjectTool:i}:{}}}}function sl(e,t){let n=new Map;for(let i of e)if(i.skipped)so(t,i.skipped);else{let o=`${i.language}\0${i.outputScipPath}`,a=n.get(o)??{language:i.language,outputScipPath:i.outputScipPath,scipPaths:[]};a.scipPaths.push(i.scipPath),n.set(o,a)}let r=[];for(let i of n.values())if(i.scipPaths.length>1)jn(i.scipPaths,i.outputScipPath),r.push({language:i.language,scipPath:i.outputScipPath});else{let o=i.scipPaths[0];o!==i.outputScipPath&&no(o,i.outputScipPath),r.push({language:i.language,scipPath:i.outputScipPath})}return{indexedOutputs:r}}function so(e,t){let n=e.find(r=>r.language===t.language);if(!n){e.push(t);return}n.reason.includes(t.reason)||(n.reason=`${n.reason}; ${t.reason}`)}function cl(e,t,n,r,i){if(e.length===0){let o=t.map(a=>` - ${a.language}: ${a.reason}`).join(`
|
|
304
|
-
`);throw new Error(`No language indexers ran successfully. Install at least one indexer for the languages in this project.
|
|
305
|
-
`+o)}if(t.length!==0&&(i(`Indexed ${e.length} language output(s); skipped or incomplete: ${t.map(o=>o.language).join(", ")}.`),!r))throw new Error(`Failed to index all required languages; preserving the previous index. Pass --allow-partial to intentionally write an incomplete index.
|
|
306
|
-
`+t.map(o=>` - ${o.language}: ${o.reason}`).join(`
|
|
307
|
-
`))}function Ki(e,t,n){if(e.length>1){n(`Merging ${e.length} language indexes...`);let r=performance.now(),i=Cn(e.map(o=>o.scipPath),t);return uo(i,n),n(`Merged and sanitized SCIP indexes in ${(performance.now()-r).toFixed(0)}ms.`),!0}else e[0].scipPath!==t&&no(e[0].scipPath,t);return!1}async function ul(e){let t;if(ll(e)){let i=w(e.run.tempPaths.runDir,"typescript-affected.db");try{co(e.incrementalTypeScript.affectedScipPath,e.run.onStatus),e.run.onStatus(`Converting ${e.incrementalTypeScript.affectedFiles.length} affected TypeScript document(s) to SQLite...`);let o=performance.now();await Yi(e.incrementalTypeScript.affectedScipPath,i,e.env,e.run.onStatus,!1,e.run.opts.signal),e.run.onStatus(`Converted affected SCIP documents in ${(performance.now()-o).toFixed(0)}ms.`);let a=$r({previousDbPath:e.run.paths.outputDb,miniDbPath:i,candidateDbPath:e.run.tempPaths.tempOutputDb,affectedFiles:e.incrementalTypeScript.affectedFiles,writeTelemetry:e.run.writeTelemetry});return e.run.onStatus(`Patched ${a.affectedDocumentCount} SQLite document(s) in ${(a.durationMs/1e3).toFixed(3)}s.`),{mode:"incremental",changedDocumentPaths:a.changedDocumentPaths,patchDurationMs:a.durationMs,converterDurationMs:performance.now()-o,scipCompanion:e.incrementalTypeScript.completeScipUpdated?"current":"deferred"}}catch(o){A(e.run.opts.signal,"Reindex cancelled by its owner."),t=o instanceof Error?o.message:String(o),ee(()=>ce(i,{force:!0})),ee(()=>ce(e.run.tempPaths.tempOutputDb,{force:!0})),e.run.onStatus(`Incremental SQLite publication unavailable: ${t}. Falling back to complete conversion.`)}}let n=e.completeScipSanitized;e.completeScipAvailable||(n=await e.materializeFullFallback());let r=performance.now();return await Yi(e.run.tempPaths.tempOutputScip,e.run.tempPaths.tempOutputDb,e.env,e.run.onStatus,n,e.run.opts.signal),{mode:"full",converterDurationMs:performance.now()-r,...t?{fallbackReason:t}:{}}}function ll(e){if(!e.incrementalTypeScript||e.skippedLanguages.length>0||!E(e.run.paths.outputDb)||!E(e.run.paths.outputScip))return!1;let t=new Set(e.reusedLanguages);return e.indexedOutputs.length===e.run.languages.length&&e.run.languages.every(n=>n==="typescript"||t.has(n))}function dl(e,t){let n=R(),r=[...t].sort(),i=new Set(r),o={addedFiles:[],modifiedFiles:r,deletedFiles:[],changedFiles:r,unchangedFiles:e.affectedFiles.filter(a=>!i.has(a)).sort()};return{version:1,status:"evaluated",refreshResult:"rebuilt",recordedAt:new Date().toISOString(),durationMs:R()-n,manifest:e.manifest,plan:e.plan,comparison:o,evaluation:vt(e.plan,o,e.projectFileCount)}}async function Yi(e,t,n,r,i=!1,o){if(A(o,"Reindex cancelled by its owner."),r("Converting to SQLite..."),!E(e))throw new Error(`SCIP index not found at ${e} after indexing`);try{i||co(e,r);let a=oe();if(!a)throw new Error("scip CLI is not available");let s=await Ae({command:a,args:["expt-convert","--output",t,e],label:"SCIP SQLite conversion",env:n,maxStdoutBytes:50*1024*1024,maxStderrBytes:50*1024*1024,timeoutMs:3e5,signal:o});if(s.status!==0)throw new Error(`scip expt-convert exited with ${s.status}${s.stderr.trim()?`: ${s.stderr.trim()}`:""}`)}catch(a){A(o,"Reindex cancelled by its owner.");let s=a instanceof Error?a.message:String(a);throw new Error(`Failed to convert SCIP index to SQLite: ${s}`,{cause:a})}}function co(e,t){let n=On(e);uo(n,t)}function uo(e,t){e.removedDefinitionOccurrences!==0&&t(`Sanitized ${e.removedDefinitionOccurrences} invalid definition occurrences across ${e.touchedDocuments} documents before SQLite conversion.`)}function Se(e,t,n){let r=ju(e)||".scip",i=ze(e,r);return w(y(e),`${i}.${n+1}.${t}${r}`)}async function pl(e,t){for(let n=0;n<2;n++){let r=gl(e,t);if(r)return r;let i=fl(e);if(i&&go(t.trigger,i)){t.onStatus(`Manual reindex preempting watcher refresh started at ${i.startedAt}.`);let o;try{o=await hl(i)}catch(s){throw new Error(`Could not verify the watcher's in-progress reindex owner (pid ${i.pid}); refusing to steal an active lock: ${N(s)}`,{cause:s})}if(!o)throw new Error(`Could not confirm the watcher's in-progress reindex (pid ${i.pid}) terminated for ${y(e)}; refusing to steal an active lock.`);let a=ut(e,{parseLegacy:Ke});if(!gn(e,a,{parseLegacy:Ke}))throw new Error(`Reindex lock ownership changed before preemption completed for ${y(e)}.`);continue}throw new Error(`Another codebaseiq reindex is already running for ${y(e)}.`)}throw new Error(`Could not acquire codebaseiq reindex lock for ${y(e)}.`)}function gl(e,t){let n=Q(process.pid),r=ve(e,{kind:"reindex",processIdentity:n,detail:{projectRoot:t.projectRoot,...process.env.SCIP_REINDEX_PROCESS_GROUP_LEADER==="1"?{processGroupLeader:!0}:{},...t.trigger?{trigger:t.trigger}:{}},parseLegacy:Ke});if(r.kind==="acquired"&&r.reclaimed){let i=lo(r.reclaimed,e);i&&go(t.trigger,i)?t.onStatus(`Manual reindex preempting watcher refresh started at ${i.startedAt}; its prior owner was already stale.`):t.onStatus(`Recovered an abandoned or incomplete reindex lock for ${y(e)}.`)}return r.kind==="acquired"?()=>{r.lock.release()}:null}function fl(e){return lo(ut(e,{parseLegacy:Ke}),e)}var Ke=e=>{let t=po(e,"");return t?{pid:t.pid,...t.processIdentity?{processIdentity:t.processIdentity}:{}}:null};function lo(e,t){if(e.state==="valid"&&e.record?.kind==="reindex"){let n=e.record.detail??{};return{version:2,pid:e.record.pid,...e.record.processIdentity?{processIdentity:e.record.processIdentity}:{},...n.processGroupLeader===!0?{processGroupLeader:!0}:{},projectRoot:typeof n.projectRoot=="string"?n.projectRoot:y(t),startedAt:e.record.startedAt,trigger:n.trigger}}return po(e.parsed,t)}function po(e,t){try{let n=e;return typeof n.pid!="number"||!Number.isInteger(n.pid)||n.pid<=0?null:{version:n.version===2?2:1,pid:n.pid,...n.processIdentity===void 0?{}:(()=>{let r=on(n.processIdentity);return r?.pid===n.pid?{processIdentity:r}:{}})(),...n.processGroupLeader===!0?{processGroupLeader:!0}:{},projectRoot:typeof n.projectRoot=="string"?n.projectRoot:y(t),startedAt:typeof n.startedAt=="string"?n.startedAt:"unknown",trigger:n.trigger}}catch{return null}}function go(e,t){return e?.kind==="manual-cli"&&ml(t?.trigger)}function ml(e){return e?.kind==="watch-source"||e?.kind==="watch-git-head"||e?.kind==="watch-git-index"||e?.kind==="watch-git-state"}async function hl(e){return!K(e.pid)||(Kt(e),Qi(e,"SIGTERM"),await Zi(e,2e3))?!0:(Kt(e),Qi(e,"SIGKILL"),Zi(e,1e3))}function Qi(e,t){if(e.processGroupLeader)try{process.kill(-e.pid,t);return}catch{if(!K(e.pid))return;Kt(e)}try{process.kill(e.pid,t)}catch{}}async function Zi(e,t){let n=R()+t;for(;R()<n;){if(eo(e))return!0;await yl(50)}return eo(e)}function Kt(e){if(!e.processIdentity)throw new Error(`Refusing to signal reindex pid ${e.pid}: its ownership record has no process identity.`);let t=Q(e.pid);if(!t)throw new Error(`Refusing to signal reindex pid ${e.pid}: its process identity is unavailable.`);if(!le(e.processIdentity,t))throw new Error(`Refusing to signal reindex pid ${e.pid}: its process identity does not match the ownership record.`)}function eo(e){if(!K(e.pid))return!0;if(!e.processIdentity)return!1;let t=Q(e.pid);return t!==null&&!le(e.processIdentity,t)}function yl(e){return new Promise(t=>setTimeout(t,e))}function fo(e,t,n){return Object.fromEntries(t.map(r=>{let i=r==="typescript"?Sn(n.typescriptProjects):[],o=r==="clojure"?Sl(n.clojureConfigPath):void 0,a=[...It(r).markerFiles,...i,...o?[o]:[]],s=r==="typescript"?{typescriptProjectMode:n.typescriptProjectMode??"single",typescriptProjects:i}:{typescriptProjectMode:"single",typescriptProjects:[]};return[r,{version:2,languages:[r],pnpmWorkspaces:r==="typescript"&&bl(n),...s,clojureConfigPath:o,files:Ie(e,{language:r,markerFiles:a})}]}))}function Sl(e){return e?.trim()||void 0}function bl(e){return e.typescriptProjectMode!=="workspace"&&e.pnpmWorkspaces===!0}function Zt(e,t){return w(y(e),"language-indexes",`${t}.scip`)}function mo(e){return w(y(e),"language-indexes","typescript-projects")}function Ye(e,t){return w(mo(e),`${Ot(t)}.scip`)}function ue(e){try{return st(Z(_(e,"reindex metadata")))}catch{return null}}function ho(e,t){try{let n=Z(_(e,"reindex metadata"));if(n.kind!=="legacy"&&n.kind!=="supported")return!1;let r=n.metadata;return n.capabilities.publishableGeneration&&dn(r)&&j(r.fingerprint)===j(t)&&j([...r.indexedLanguages??[]].sort())===j(t.languages)}catch{return!1}}function en(e,t){hn(e,t,{spacing:2,trailingNewline:!0})}function yo(e,t){try{let n=st(Z(_(e,"reindex metadata")));if(!n)return;en(e,{...n,lastRefresh:t})}catch{}}function Qe(e){return{trigger:e.trigger??{kind:"unknown"},result:e.result,startedAt:new Date(e.start).toISOString(),completedAt:new Date().toISOString(),durationMs:R()-e.monotonicStart,indexedLanguages:e.languages?[...e.languages]:void 0,skipped:e.skipped?[...e.skipped]:void 0,error:e.error}}function j(e){return JSON.stringify(e)}function Tf(e,t,n,r){return ro({projectRoot:e,languages:r.languages?.length?r.languages:t.languages,outputScip:n.indexPath,outputDb:n.dbPath,pnpmWorkspaces:t.indexer?.typescript?.pnpmWorkspaces,typescriptProjectMode:t.indexer?.typescript?.projectMode,typescriptProjects:t.indexer?.typescript?.projects,clojureConfigPath:t.indexer?.clojure?.configPath,skipIfUnchanged:r.force!==!0,allowPartial:r.allowPartial===!0,skipAutoInstall:r.skipAutoInstall===!0,installMissing:r.installMissing===!0,trustProjectTools:r.trustProjectTools===!0,indexerConcurrency:r.indexerConcurrency??t.indexerConcurrency,trigger:r.trigger,...r.onStatus?{onStatus:r.onStatus}:{}})}export{kl as a,wl as b,gr as c,ld as d,dd as e,It as f,Ya as g,Cd as h,Md as i,xi as j,gu as k,ro as l,Tf as m};
|
|
308
|
-
//# sourceMappingURL=chunk-Q72QSKXC.js.map
|