codebaseiq 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/dist/augment-vue-worker.js +1 -1
- package/dist/{chunk-DQMDCD24.js → chunk-27PHVDKL.js} +2 -2
- package/dist/{chunk-ZMI2JSX2.js → chunk-2DMVFAY7.js} +2 -2
- package/dist/{chunk-5PUWMSDU.js → chunk-2E6BTWER.js} +2 -2
- package/dist/{chunk-YESXMKX3.js → chunk-2F5ERMNI.js} +2 -2
- package/dist/chunk-2VKB5CMA.js +60 -0
- package/dist/{chunk-NNJ2KZZG.js → chunk-327YK6TB.js} +4 -4
- package/dist/chunk-347TXATM.js +2 -0
- package/dist/{chunk-VEXUL62T.js → chunk-35YYZD3D.js} +2 -2
- package/dist/chunk-36WRYYTE.js +3 -0
- package/dist/chunk-37TKC6MB.js +2 -0
- package/dist/{chunk-FAJQ7LWY.js → chunk-3AC56WAR.js} +2 -2
- package/dist/{chunk-JE3WZ6II.js → chunk-3NUZVLR7.js} +2 -2
- package/dist/{chunk-UZGZB3VB.js → chunk-3XFJUWJE.js} +2 -2
- package/dist/{chunk-OVTS4DKB.js → chunk-4AOOSCZ7.js} +2 -2
- package/dist/{chunk-LU3BMVH2.js → chunk-4IFISPQW.js} +2 -2
- package/dist/chunk-4NHWNAWQ.js +11 -0
- package/dist/chunk-4O52YNKL.js +5 -0
- package/dist/{chunk-HPJRBHVT.js → chunk-54K6556S.js} +2 -2
- package/dist/{chunk-HRWGYWRJ.js → chunk-57GCCPLS.js} +2 -2
- package/dist/{chunk-J77SU6VA.js → chunk-57KEZDPT.js} +2 -2
- package/dist/{chunk-OFBE4NGP.js → chunk-57KFVPVZ.js} +2 -2
- package/dist/{chunk-WOQBZPIF.js → chunk-5BDK6QC3.js} +2 -2
- package/dist/{chunk-7MGU3HPH.js → chunk-5IO2APSS.js} +2 -2
- package/dist/chunk-5NJPH3QZ.js +61 -0
- package/dist/{chunk-GW6Z3WGY.js → chunk-5WXOEJ4G.js} +2 -2
- package/dist/chunk-5XEVXVTK.js +3 -0
- package/dist/{chunk-RR7SX44N.js → chunk-6OVNYYY4.js} +2 -2
- package/dist/{chunk-ZV3JV5G5.js → chunk-6SDEQTVY.js} +2 -2
- package/dist/{chunk-EF2R3WNQ.js → chunk-6URCE5QY.js} +2 -2
- package/dist/{chunk-UCD3H3UZ.js → chunk-6ZV5EDUT.js} +2 -2
- package/dist/{chunk-C6SBF2WH.js → chunk-77GHPR2R.js} +2 -2
- package/dist/{chunk-YVCIMIOC.js → chunk-7R64XY4Y.js} +2 -2
- package/dist/{chunk-VXYS3FZD.js → chunk-7Z7HCZ7J.js} +2 -2
- package/dist/{chunk-CO5R3UNA.js → chunk-A67HT5FR.js} +2 -2
- package/dist/{chunk-UDS562V4.js → chunk-A7XQT7MH.js} +2 -2
- package/dist/{chunk-RDBI2RXU.js → chunk-ACZDU5GK.js} +2 -2
- package/dist/{chunk-FETNQCFO.js → chunk-AM5SUGHF.js} +2 -2
- package/dist/{chunk-NNOKTMZT.js → chunk-B2E3HZ2A.js} +2 -2
- package/dist/{chunk-CVYSU6BX.js → chunk-BH5CE4LN.js} +2 -2
- package/dist/chunk-BLKYYQ7C.js +543 -0
- package/dist/{chunk-4WKDMDEW.js → chunk-BX2U3QQV.js} +2 -2
- package/dist/{chunk-ZKX2FRS6.js → chunk-CANBLFVQ.js} +2 -2
- package/dist/{chunk-SMRBZ6EC.js → chunk-CCRZLRWJ.js} +2 -2
- package/dist/chunk-CDWSLAPN.js +21 -0
- package/dist/chunk-CIVYHK7U.js +22 -0
- package/dist/{chunk-L57ZKWVG.js → chunk-CMXW7MFV.js} +2 -2
- package/dist/{chunk-T3DGWPXM.js → chunk-CSZOQ7YO.js} +2 -2
- package/dist/{chunk-ZZXSWSN6.js → chunk-CWMHWD56.js} +2 -2
- package/dist/{chunk-6NW7MU72.js → chunk-CZEIHYMP.js} +2 -2
- package/dist/{chunk-DO6WQD2T.js → chunk-D62CTZX6.js} +2 -2
- package/dist/{chunk-XWUOUWYI.js → chunk-DFPAZXLU.js} +2 -2
- package/dist/{chunk-MOVBWNIP.js → chunk-DKJXK3HA.js} +2 -2
- package/dist/{chunk-XMQ23E27.js → chunk-DLC6JDN7.js} +2 -2
- package/dist/chunk-DUKHVPU5.js +4 -0
- package/dist/{chunk-ID63777H.js → chunk-DVYG3JTA.js} +2 -2
- package/dist/{chunk-NE6IU5ZD.js → chunk-EFFMFK7C.js} +2 -2
- package/dist/{chunk-I2T2LLK2.js → chunk-EM5UHLAM.js} +2 -2
- package/dist/chunk-EN4AHLL3.js +3 -0
- package/dist/chunk-EXMVF3JR.js +3 -0
- package/dist/{chunk-SWHMHUKF.js → chunk-FEBLLMTL.js} +2 -2
- package/dist/chunk-FIXYHQ3W.js +3 -0
- package/dist/{chunk-RKEJ6VTF.js → chunk-FLLXYUOL.js} +2 -2
- package/dist/{chunk-KWVHSKHK.js → chunk-FPDL2TUB.js} +2 -2
- package/dist/chunk-FQA3KIFX.js +17 -0
- package/dist/chunk-FWY2PRIF.js +3 -0
- package/dist/chunk-FY5V4V4F.js +2 -0
- package/dist/chunk-G2XUZCF2.js +88 -0
- package/dist/{chunk-QHRNXP3C.js → chunk-GXVDTHFC.js} +2 -2
- package/dist/{chunk-6MUIJMVL.js → chunk-H3CKAL6P.js} +2 -2
- package/dist/chunk-H5QXP63L.js +2 -0
- package/dist/{chunk-VUIYB2V3.js → chunk-HBQGKMM3.js} +2 -2
- package/dist/{chunk-PYAB5SM6.js → chunk-HBXZAGY6.js} +2 -2
- package/dist/{chunk-NNO6A2PO.js → chunk-HCMQZPEO.js} +2 -2
- package/dist/{chunk-Q65CQ4XL.js → chunk-HHBBGWES.js} +2 -2
- package/dist/{chunk-GTXSJDCO.js → chunk-HIEXRDJF.js} +2 -2
- package/dist/{chunk-4FC325IF.js → chunk-HYKSLTAR.js} +2 -2
- package/dist/{chunk-XLQ3GLWZ.js → chunk-I2KP4AGR.js} +2 -2
- package/dist/chunk-I5FCDTK2.js +2 -0
- package/dist/{chunk-QKPLA6IC.js → chunk-I645ZF75.js} +2 -2
- package/dist/{chunk-FDGD5AB5.js → chunk-IBM3F2BJ.js} +2 -2
- package/dist/{chunk-Q72QSKXC.js → chunk-IEL6Q5W3.js} +38 -38
- package/dist/{chunk-NCZUNH3E.js → chunk-IGQQUENU.js} +12 -12
- package/dist/chunk-IGYAZPRX.js +4 -0
- package/dist/chunk-IOVPAZWP.js +3 -0
- package/dist/{chunk-OL6KJP3N.js → chunk-IVJJNVSX.js} +2 -2
- package/dist/{chunk-AKB7V7TV.js → chunk-IWAMYGPN.js} +2 -2
- package/dist/chunk-IYBIBMPF.js +90 -0
- package/dist/{chunk-IOP6FWIM.js → chunk-J24VICI5.js} +2 -2
- package/dist/{chunk-C7QOQX32.js → chunk-JN5LIBT3.js} +2 -2
- package/dist/{chunk-O6QTXQPJ.js → chunk-JOALNFY3.js} +2 -2
- package/dist/{chunk-GCHRX4YW.js → chunk-JUO3Z644.js} +2 -2
- package/dist/{chunk-BJ6SQAEN.js → chunk-JXHLB7TP.js} +2 -2
- package/dist/{chunk-IJ4HMYBE.js → chunk-JYX5UZSZ.js} +2 -2
- package/dist/chunk-K2O7SBAU.js +2 -0
- package/dist/{chunk-OLF4MA5W.js → chunk-K5G7SPAG.js} +2 -2
- package/dist/{chunk-YSNONTJ2.js → chunk-KDYQQJ6X.js} +2 -2
- package/dist/{chunk-7NVGT435.js → chunk-KM4QRWI5.js} +2 -2
- package/dist/{chunk-HKQUXIFO.js → chunk-KNV5VFDV.js} +2 -2
- package/dist/chunk-L3YSDLNB.js +2 -0
- package/dist/{chunk-EZNMUY67.js → chunk-LAGDJXFY.js} +2 -2
- package/dist/{chunk-ENCCHKM6.js → chunk-LY2NB5XR.js} +4 -4
- package/dist/chunk-M4EVGA5S.js +14 -0
- package/dist/chunk-M7LAIM77.js +127 -0
- package/dist/{chunk-BVAJLC5A.js → chunk-MRGTCMDK.js} +2 -2
- package/dist/{chunk-OZYRSMSH.js → chunk-MT5W4DUG.js} +2 -2
- package/dist/{chunk-VE5AVNMP.js → chunk-MTMF4N7F.js} +2 -2
- package/dist/chunk-N3Q3AWGW.js +545 -0
- package/dist/{chunk-TXXOEMZJ.js → chunk-NDGTJHQN.js} +2 -2
- package/dist/chunk-NIO346UL.js +2 -0
- package/dist/chunk-NJA4MMBD.js +2 -0
- package/dist/{chunk-7FND7D7N.js → chunk-NK76RSB6.js} +2 -2
- package/dist/{chunk-H3LGFZVK.js → chunk-NTRW52UR.js} +2 -2
- package/dist/{chunk-JOIRNPPY.js → chunk-OJFLPVBP.js} +2 -2
- package/dist/{chunk-KMITESMT.js → chunk-OMBRP7BB.js} +2 -2
- package/dist/{chunk-UP3BUZR5.js → chunk-OVKZM2XI.js} +2 -2
- package/dist/{chunk-MVB3DAEY.js → chunk-PARCKE3Q.js} +2 -2
- package/dist/{chunk-CAUCPUOF.js → chunk-PFPHS4NO.js} +2 -2
- package/dist/chunk-PHPQ24UG.js +22 -0
- package/dist/chunk-PLZXWZHY.js +77 -0
- package/dist/{chunk-34WBMAYK.js → chunk-PNVZIJ57.js} +2 -2
- package/dist/{chunk-SYDJMPES.js → chunk-QKVTWODE.js} +2 -2
- package/dist/{chunk-FW53T7EB.js → chunk-QLTFXVUI.js} +2 -2
- package/dist/{chunk-PBI2LFKH.js → chunk-QMGWSEPL.js} +2 -2
- package/dist/{chunk-CQP3THUZ.js → chunk-QVHZB75Z.js} +2 -2
- package/dist/{chunk-6BQ3DSPK.js → chunk-QVWDQTMG.js} +2 -2
- package/dist/{chunk-ST7V3SKN.js → chunk-RCPZOPV6.js} +2 -2
- package/dist/chunk-RJWAB4VR.js +345 -0
- package/dist/chunk-RRPK327J.js +20 -0
- package/dist/chunk-RVYLJDXC.js +21 -0
- package/dist/chunk-RWKEXCHU.js +3 -0
- package/dist/{chunk-L4NRUAGJ.js → chunk-S5SKXCND.js} +2 -2
- package/dist/{chunk-RBAS5ZHI.js → chunk-S64NCE2Z.js} +2 -2
- package/dist/{chunk-WMPRTGH2.js → chunk-SF34QLK2.js} +2 -2
- package/dist/{chunk-ANFVSJWQ.js → chunk-SJZQ2PTZ.js} +2 -2
- package/dist/{chunk-4XTAUQFD.js → chunk-SRY26ITJ.js} +2 -2
- package/dist/chunk-SV2LEFVM.js +2 -0
- package/dist/{chunk-7XAN6GKB.js → chunk-T3YFIJ5P.js} +2 -2
- package/dist/chunk-T55YPJGB.js +3 -0
- package/dist/chunk-TAJ6UGCO.js +21 -0
- package/dist/{chunk-PIOMTC27.js → chunk-TUTSO7UZ.js} +2 -2
- package/dist/{chunk-FQKZWM4L.js → chunk-U24M5RQM.js} +5 -5
- package/dist/{chunk-XME3HPXZ.js → chunk-U2XX3BT4.js} +2 -2
- package/dist/{chunk-SZD2KF7Q.js → chunk-UWB5WMC2.js} +2 -2
- package/dist/{chunk-6CS3UQTN.js → chunk-VCL7FK3E.js} +2 -2
- package/dist/{chunk-N3IQCBCF.js → chunk-VCWAJPXQ.js} +2 -2
- package/dist/{chunk-LZYFLFEH.js → chunk-VG55NFXF.js} +2 -2
- package/dist/{chunk-PTAWHLVJ.js → chunk-VLTUX4IF.js} +2 -2
- package/dist/{chunk-JEJLSICM.js → chunk-VVCBMH5O.js} +2 -2
- package/dist/{chunk-JSOYNVWH.js → chunk-VYZQZ4ZN.js} +2 -2
- package/dist/chunk-W3FK73MD.js +8 -0
- package/dist/{chunk-UNBY47BC.js → chunk-W6C6QTXJ.js} +2 -2
- package/dist/chunk-WH5SYOMD.js +2 -0
- package/dist/chunk-WJOQC4P7.js +7 -0
- package/dist/chunk-WO47BIPY.js +3 -0
- package/dist/chunk-WOOTEWQT.js +239 -0
- package/dist/{chunk-UBGWN7I4.js → chunk-X5I2BQGX.js} +2 -2
- package/dist/{chunk-PX4RYAAK.js → chunk-XNUWRTYM.js} +2 -2
- package/dist/{chunk-ICFDQHAM.js → chunk-XUJM6474.js} +2 -2
- package/dist/chunk-XYLV727H.js +21 -0
- package/dist/{chunk-TRRC4ZJ7.js → chunk-YFQPWKHR.js} +2 -2
- package/dist/{chunk-NEDP5RFQ.js → chunk-YIOQJ45A.js} +2 -2
- package/dist/{chunk-Y6KHROC3.js → chunk-YXJ4IAHH.js} +2 -2
- package/dist/chunk-YYFV32WR.js +3 -0
- package/dist/{chunk-BH5F2Q4O.js → chunk-ZB3V5QM7.js} +2 -2
- package/dist/chunk-ZJZQ7Q2Q.js +3 -0
- package/dist/{chunk-EMNIHCRB.js → chunk-ZNQCR656.js} +2 -2
- package/dist/{chunk-TIIC3ZE7.js → chunk-ZOEDRCR4.js} +2 -2
- package/dist/cli-context-TSADTXLB.js +2 -0
- package/dist/cli-context-XEPPF4RX.js +3 -0
- package/dist/cli-program-KJGQEM72.js +7 -0
- package/dist/cli.js +1 -1
- package/dist/{code-DlqpBDd0.d.ts → code-CDe-mIjx.d.ts} +1 -1
- package/dist/code-viewer-YGDON6SY.js +12 -0
- package/dist/code-viewer-ZCTHXQ5C.js +11 -0
- package/dist/command-descriptors-5VAB2MZX.js +335 -0
- package/dist/command-descriptors-EAHKIRAG.js +337 -0
- package/dist/{config-types-BNoC96J3.d.ts → config-types-D6X5S68_.d.ts} +50 -0
- package/dist/{db-D7sauVFH.d.ts → db-DmRNdCtm.d.ts} +1 -1
- package/dist/direct-navigation-B3SGOOBW.js +2 -0
- package/dist/direct-navigation-ZL362KXF.js +3 -0
- package/dist/{graph-evidence-BIFqyisO.d.ts → graph-evidence-Bs54NWws.d.ts} +1 -1
- package/dist/{health-DJaZXg8I.d.ts → health-BnzbSLCE.d.ts} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/invocation-command-descriptors-CSUGUHTT.js +2 -0
- package/dist/invocation-command-descriptors-PPVZOIE5.js +3 -0
- package/dist/output-continuation-command-FTVVBVSN.js +2 -0
- package/dist/output-continuation-command-ITPRC3YV.js +3 -0
- package/dist/project-reindex-7HZSLLLY.js +3 -0
- package/dist/project-reindex-NGM3DYBN.js +2 -0
- package/dist/queries/affected.d.ts +2 -2
- package/dist/queries/affected.js +1 -1
- package/dist/queries/anchors.d.ts +2 -2
- package/dist/queries/anchors.js +1 -1
- package/dist/queries/architecture.d.ts +2 -2
- package/dist/queries/architecture.js +1 -1
- package/dist/queries/bottlenecks.d.ts +2 -2
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +2 -2
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +2 -2
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +2 -2
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +2 -2
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +2 -2
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.d.ts +3 -3
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +2 -2
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +2 -2
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/context.d.ts +2 -2
- package/dist/queries/context.js +1 -1
- package/dist/queries/convergence.d.ts +2 -2
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +2 -2
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +2 -2
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +2 -2
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +2 -2
- package/dist/queries/dead.js +1 -1
- package/dist/queries/decorative-checkers.d.ts +2 -2
- package/dist/queries/decorative-checkers.js +1 -1
- package/dist/queries/deep-chains.d.ts +2 -2
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/dependence-slice.d.ts +3 -3
- package/dist/queries/dependence-slice.js +1 -1
- package/dist/queries/dependency-depth.d.ts +2 -2
- package/dist/queries/dependency-depth.js +1 -1
- package/dist/queries/deps.d.ts +2 -2
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.d.ts +2 -2
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +2 -2
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +2 -2
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.d.ts +2 -2
- package/dist/queries/duplicate-bodies.js +1 -1
- package/dist/queries/entry-map.d.ts +2 -2
- package/dist/queries/entry-map.js +1 -1
- package/dist/queries/evidence.d.ts +3 -3
- package/dist/queries/evidence.js +1 -1
- package/dist/queries/extract-candidates.d.ts +2 -2
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +2 -2
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +2 -2
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +3 -3
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +2 -2
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +2 -2
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +2 -2
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +2 -2
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +5 -5
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +2 -2
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.d.ts +2 -2
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.d.ts +2 -2
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +2 -2
- package/dist/queries/methods.js +1 -1
- package/dist/queries/not-implemented.d.ts +2 -2
- package/dist/queries/not-implemented.js +1 -1
- package/dist/queries/outline.d.ts +2 -2
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +2 -2
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +2 -2
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +2 -2
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +2 -2
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +2 -2
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.d.ts +2 -2
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +2 -2
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/reference-neighborhood.d.ts +2 -2
- package/dist/queries/reference-neighborhood.js +1 -1
- package/dist/queries/reference-reachability.d.ts +2 -2
- package/dist/queries/reference-reachability.js +1 -1
- package/dist/queries/refs.d.ts +2 -2
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +2 -2
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.d.ts +2 -2
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +2 -2
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +2 -2
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +2 -2
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +2 -2
- package/dist/queries/slice.js +1 -1
- package/dist/queries/source-inspection.d.ts +4 -4
- package/dist/queries/source-inspection.js +1 -1
- package/dist/queries/source-search.d.ts +2 -2
- package/dist/queries/source-search.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +2 -2
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +2 -2
- package/dist/queries/surface.d.ts +2 -2
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +2 -2
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system-map.d.ts +2 -2
- package/dist/queries/system-map.js +1 -1
- package/dist/queries/system.d.ts +2 -2
- package/dist/queries/system.js +1 -1
- package/dist/queries/test-quality.d.ts +2 -2
- package/dist/queries/test-quality.js +1 -1
- package/dist/queries/trace.d.ts +2 -2
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.d.ts +2 -2
- package/dist/queries/twin-ab.js +1 -1
- package/dist/queries/twin-drift.d.ts +2 -2
- package/dist/queries/twin-drift.js +1 -1
- package/dist/queries/unused-imports.d.ts +2 -2
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.d.ts +2 -2
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/value-flow.d.ts +3 -3
- package/dist/queries/value-flow.js +1 -1
- package/dist/queries/vue-component-duplicates.d.ts +2 -2
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.d.ts +2 -2
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.d.ts +2 -2
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +2 -2
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +1 -1
- package/dist/reindex.d.ts +3 -3
- package/dist/reindex.js +31 -31
- package/dist/runtime.d.ts +24 -4
- package/dist/runtime.js +3 -3
- package/dist/rust-semantic-session-server.js +1 -1
- package/dist/rust-semantic-session-worker.js +1 -1
- package/dist/rust-semantic-worker.js +1 -1
- package/dist/{scip-cli-B7N3haxa.d.ts → scip-cli-BRFKkHQn.d.ts} +1 -1
- package/dist/sentinel-ensure-command-KYYULCFU.js +2 -0
- package/dist/sentinel-ensure-command-RIZA3RY7.js +3 -0
- package/dist/sentinel-hook.js +39 -0
- package/dist/sentinel-worker.js +16 -0
- package/dist/typescript-mailbox-worker.js +1 -1
- package/dist/watch-server.js +6 -6
- package/docs/COMMAND_REFERENCE.md +5 -3
- package/docs/schemas/project-config.schema.json +159 -0
- package/package.json +9 -5
- package/skills/codebaseiq/SKILL.md +1 -1
- package/skills/concrete-plan/SKILL.md +1 -1
- package/ui/view/api.js +450 -0
- package/ui/view/app.js +394 -0
- package/ui/view/builder.js +323 -0
- package/ui/view/file-panel.js +170 -0
- package/ui/view/focus.js +379 -0
- package/ui/view/index.html +54 -0
- package/ui/view/map.js +424 -0
- package/ui/view/styles.css +1125 -0
- package/dist/chunk-2X7V4HS4.js +0 -88
- package/dist/chunk-3IER7Q6H.js +0 -12
- package/dist/chunk-3JSXXYTZ.js +0 -345
- package/dist/chunk-476NR5B7.js +0 -2
- package/dist/chunk-5VKBFZZU.js +0 -3
- package/dist/chunk-ADTBPVUZ.js +0 -21
- package/dist/chunk-BFFZDZQV.js +0 -2
- package/dist/chunk-BMYOV5GP.js +0 -77
- package/dist/chunk-C74PPYLA.js +0 -3
- package/dist/chunk-CWONGW6P.js +0 -3
- package/dist/chunk-DDZ7VHWV.js +0 -20
- package/dist/chunk-DR2LURYU.js +0 -3
- package/dist/chunk-ECQBG7PW.js +0 -564
- package/dist/chunk-FM5BPL4V.js +0 -60
- package/dist/chunk-G6XFR4ZL.js +0 -4
- package/dist/chunk-GTIYTDRE.js +0 -562
- package/dist/chunk-HOA5YGOH.js +0 -3
- package/dist/chunk-KUW32IRO.js +0 -2
- package/dist/chunk-LTA3BRZX.js +0 -2
- package/dist/chunk-NAUD7LCA.js +0 -2
- package/dist/chunk-OGTFJ3XD.js +0 -2
- package/dist/chunk-Q5ELPRKQ.js +0 -2
- package/dist/chunk-QCN62RTF.js +0 -3
- package/dist/chunk-QW7EP6WI.js +0 -21
- package/dist/chunk-RU65DDUP.js +0 -215
- package/dist/chunk-SELM5MER.js +0 -2
- package/dist/chunk-SNNWPCN7.js +0 -4
- package/dist/chunk-TFZB6XTM.js +0 -239
- package/dist/chunk-UXM43C7T.js +0 -3
- package/dist/chunk-VFY6Y2H6.js +0 -61
- package/dist/chunk-WE5RZHZ7.js +0 -5
- package/dist/chunk-Z54RD7VL.js +0 -3
- package/dist/cli-context-3SNLDYBM.js +0 -3
- package/dist/cli-context-T3B7W6GG.js +0 -2
- package/dist/cli-program-YNOXO72B.js +0 -7
- package/dist/command-descriptors-6AOUKWW7.js +0 -346
- package/dist/command-descriptors-ZFKJSRUP.js +0 -344
- package/dist/direct-navigation-DP4LVMRX.js +0 -3
- package/dist/direct-navigation-FLUS3BT6.js +0 -2
- package/dist/invocation-command-descriptors-QT2JMY5J.js +0 -3
- package/dist/invocation-command-descriptors-YN4QJEAX.js +0 -2
- package/dist/output-continuation-command-2V2SL4TD.js +0 -2
- package/dist/output-continuation-command-65J5IP3O.js +0 -3
- package/dist/project-reindex-5JOKXAXT.js +0 -2
- package/dist/project-reindex-UQBIKO4M.js +0 -3
package/dist/chunk-TFZB6XTM.js
DELETED
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import{a as ee,c as te}from"./chunk-VFY6Y2H6.js";import{a as Tn}from"./chunk-ILMHV3KM.js";import{a as Kt,b as Zt,d as Ue,e as rn}from"./chunk-PYAB5SM6.js";import{P as Qt,Q as Vt,R as Xt,T as Yt,X as jn,Y as Je,a as vt,b as It,c as se,d as fe,e as Jt,g as zt}from"./chunk-NCZUNH3E.js";import{a as z,b as pe,c as Z,d as $t,e as Bt,f as Gt,g as Ut,h as Wt}from"./chunk-KUW32IRO.js";import{a as He,c as ye,d as wn,f as _n}from"./chunk-FDGD5AB5.js";import{T as Be}from"./chunk-RU65DDUP.js";import{A as ln,B as un,C as pn,D as gn,E as fn,F as mn,G as We,I as N,J as me,K as hn,M as qe,N as yn,O as Sn,P as he,S as bn,T as Pn,U as xn,c as K,d as de,e as Ae,g as Le,h as _t,i as Dt,j as T,l as Lt,o as F,p as L,q as M,r as Ge,s as en,t as tn,u as nn,v as an,w as on,x as sn,y as cn,z as dn}from"./chunk-QW7EP6WI.js";import{e as ge}from"./chunk-3IER7Q6H.js";import{i as W,j as H,l as Ot,m as $e,n as At,r as qt,s as Ht,u as Rn,x as vn,y as In,z as En}from"./chunk-RDBI2RXU.js";import{i as le,j as q}from"./chunk-R2NOK63J.js";import{a as Rt,b as Y,c as U,d as b}from"./chunk-EF2R3WNQ.js";import{E as Me,O as Ne,S as ue,X as kt,Y as J,_ as Mt,a as Pt,c as Oe,f as X,fa as Nt,g as ie,ga as Ct,h as oe,i as xt,n as Et,o as wt,p as ce,r as I}from"./chunk-WE5RZHZ7.js";import{a as Ce,d as Ft}from"./chunk-6OAHRI2D.js";import{b as jt,c as Tt}from"./chunk-2Q2LW5JW.js";import{createHash as Ci}from"crypto";import{existsSync as _,mkdirSync as Te,mkdtempSync as $i,readdirSync as Fr,renameSync as kr,rmSync as Q,statSync as Bi}from"fs";import{basename as je,dirname as h,extname as Gi,join as E,resolve as Rr}from"path";import{platform as Ui}from"os";import{execFileSync as Hr}from"child_process";import{constants as Jr,copyFileSync as Fn,statSync as zr}from"fs";import{platform as Qr}from"os";var Vr=Object.freeze({size:e=>zr(e).size,clone:Yr,copy:(e,t)=>Fn(e,t)}),Xr=new Set(["ENOSYS","ENOTSUP","EOPNOTSUPP","EINVAL","EXDEV","ENOTTY"]);function C(e,t,n=Vr){let r=n.size(e);try{return n.clone(e,t),{method:"reflink",bytes:r}}catch(a){if(!Zr(a))throw a}return n.copy(e,t),{method:"copy",bytes:r}}function Yr(e,t){if(Qr()!=="darwin"){Fn(e,t,Jr.COPYFILE_FICLONE_FORCE);return}try{Hr("/bin/cp",["-c",e,t],{timeout:6e4,maxBuffer:64*1024,stdio:["ignore","ignore","pipe"],windowsHide:!0})}catch(n){throw Kr(n)}}function Kr(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 Zr(e){let t=e?.code;return t!==void 0&&Xr.has(t)}function kn(){return{reflinkedBytes:0,fallbackCopiedBytes:0}}function $(e,t){t.method==="reflink"?e.reflinkedBytes+=t.bytes:e.fallbackCopiedBytes+=t.bytes}import{dirname as ea,join as ta}from"path";function Dn(e={}){return{id:"runtime-boundaries",facts:["runtime-boundary-observation","runtime-boundary-link"],run:({projectRoot:t,dbPath:n,onStatus:r})=>{let a=new F({projectRoot:t,dbPath:n,indexPath:e.indexPath??ta(ea(n),"index.scip")}),i,o=!1,s=!1;try{let l=e.reuseExisting||e.affectedFiles?Yt(a):null;e.reuseExisting&&l?.extractorVersion===Qt?(i=l,o=!0):(i=Vt(a,{...l?{previousGraph:l}:{},...e.affectedFiles?{affectedFiles:e.affectedFiles}:{}}),s=(i.coverage.filesReused??0)>0)}finally{a.close()}o||Xt(n,i);let d={reused:o,incrementallyUpdated:s,observations:i.observations.length,links:i.links.length,frontiers:i.frontiers.length,filesScanned:i.coverage.filesScanned,errors:i.coverage.extractionErrors.length,phases:i.coverage.phases};return r?.(d.reused?`Reused ${d.observations} cached runtime-boundary observation(s) and ${d.links} link(s).`:d.incrementallyUpdated?`Incrementally refreshed runtime-boundary observations (${d.filesScanned-(i.coverage.filesReused??0)} file(s) extracted, ${i.coverage.filesReused??0} reused) and rebuilt ${d.links} link(s).`:`Extracted ${d.observations} runtime-boundary observation(s), ${d.links} link(s), and ${d.frontiers} unresolved frontier(s).`),!o&&i.coverage.phases&&r?.(`Runtime-boundary phases: ${i.coverage.phases.map(l=>`${l.id} ${l.durationMs.toFixed(0)}ms`).join(", ")}.`),d}}}import{createHash as ra}from"crypto";import{existsSync as aa}from"fs";import{dirname as ia,join as An}from"path";function ze(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 Se(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 a=new Set(n),i=ze(e),o=new Set(i.reasons);return r.some(s=>!a.has(s))&&o.add("changed-file-outside-project"),t===null?(o.add("dependency-graph-unavailable"),On(r,a,o)):o.size>0?On(r,a,o):{mode:"closure",changedFiles:r,affectedFiles:na(r,t,a),reasons:[]}}function On(e,t,n){return{mode:"full-project",changedFiles:e,affectedFiles:[...t].sort(),reasons:[...n].sort()}}function na(e,t,n){let r=new Map;for(let[o,s]of t)if(n.has(o))for(let d of s){if(!n.has(d))continue;let l=r.get(d)??new Set;l.add(o),r.set(d,l)}let a=new Set(e),i=[...e];for(let o=0;o<i.length;o+=1){let s=i[o];if(s!==void 0)for(let d of r.get(s)??[])a.has(d)||(a.add(d),i.push(d))}return[...a].sort()}var oa="<global-symbols>";function sa(e){let t=[];for(let n of e.all(`
|
|
2
|
-
SELECT relative_path, language, position_encoding, text
|
|
3
|
-
FROM documents
|
|
4
|
-
`))t.push({relativePath:n.relative_path,kind:"document",values:[n.language,n.position_encoding,n.text]});for(let n of e.all(`
|
|
5
|
-
SELECT d.relative_path,
|
|
6
|
-
c.chunk_index,
|
|
7
|
-
c.start_line,
|
|
8
|
-
c.end_line,
|
|
9
|
-
hex(c.occurrences) AS occurrences_hex
|
|
10
|
-
FROM chunks c
|
|
11
|
-
JOIN documents d ON d.id = c.document_id
|
|
12
|
-
`))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(`
|
|
13
|
-
SELECT d.relative_path,
|
|
14
|
-
r.start_line,
|
|
15
|
-
r.start_char,
|
|
16
|
-
r.end_line,
|
|
17
|
-
r.end_char,
|
|
18
|
-
g.symbol,
|
|
19
|
-
g.display_name,
|
|
20
|
-
g.kind,
|
|
21
|
-
g.documentation,
|
|
22
|
-
CASE WHEN g.signature IS NULL THEN NULL ELSE hex(g.signature) END AS signature_hex,
|
|
23
|
-
g.enclosing_symbol,
|
|
24
|
-
CASE WHEN g.relationships IS NULL THEN NULL ELSE hex(g.relationships) END AS relationships_hex
|
|
25
|
-
FROM defn_enclosing_ranges r
|
|
26
|
-
JOIN documents d ON d.id = r.document_id
|
|
27
|
-
JOIN global_symbols g ON g.id = r.symbol_id
|
|
28
|
-
`))t.push({relativePath:n.relative_path,kind:"definition",values:Qe(n,[n.start_line,n.start_char,n.end_line,n.end_char])});for(let n of e.all(`
|
|
29
|
-
SELECT d.relative_path,
|
|
30
|
-
c.chunk_index,
|
|
31
|
-
m.role,
|
|
32
|
-
g.symbol,
|
|
33
|
-
g.display_name,
|
|
34
|
-
g.kind,
|
|
35
|
-
g.documentation,
|
|
36
|
-
CASE WHEN g.signature IS NULL THEN NULL ELSE hex(g.signature) END AS signature_hex,
|
|
37
|
-
g.enclosing_symbol,
|
|
38
|
-
CASE WHEN g.relationships IS NULL THEN NULL ELSE hex(g.relationships) END AS relationships_hex
|
|
39
|
-
FROM mentions m
|
|
40
|
-
JOIN chunks c ON c.id = m.chunk_id
|
|
41
|
-
JOIN documents d ON d.id = c.document_id
|
|
42
|
-
JOIN global_symbols g ON g.id = m.symbol_id
|
|
43
|
-
`))t.push({relativePath:n.relative_path,kind:"mention",values:Qe(n,[n.chunk_index,n.role])});for(let n of e.all(`
|
|
44
|
-
SELECT g.symbol,
|
|
45
|
-
g.display_name,
|
|
46
|
-
g.kind,
|
|
47
|
-
g.documentation,
|
|
48
|
-
CASE WHEN g.signature IS NULL THEN NULL ELSE hex(g.signature) END AS signature_hex,
|
|
49
|
-
g.enclosing_symbol,
|
|
50
|
-
CASE WHEN g.relationships IS NULL THEN NULL ELSE hex(g.relationships) END AS relationships_hex
|
|
51
|
-
FROM global_symbols g
|
|
52
|
-
WHERE NOT EXISTS (
|
|
53
|
-
SELECT 1 FROM defn_enclosing_ranges r WHERE r.symbol_id = g.id
|
|
54
|
-
) AND NOT EXISTS (
|
|
55
|
-
SELECT 1 FROM mentions m WHERE m.symbol_id = g.id
|
|
56
|
-
)
|
|
57
|
-
`))t.push({relativePath:oa,kind:"global-symbol",values:Qe(n)});return ca(t)}function ca(e){let t=new Map;for(let r of e){let a=JSON.stringify([r.kind,r.values]),i=t.get(r.relativePath)??[];i.push(a),t.set(r.relativePath,i)}let n=new Map;for(let[r,a]of[...t].sort(([i],[o])=>i.localeCompare(o))){let i=ra("sha256");for(let o of a.sort())i.update(String(Buffer.byteLength(o))),i.update(":"),i.update(o),i.update(`
|
|
58
|
-
`);n.set(r,i.digest("hex"))}return n}function da(e,t){let n=[],r=[],a=[],i=[],o=new Set([...e.keys(),...t.keys()]);for(let s of[...o].sort()){let d=e.get(s),l=t.get(s);d===void 0?n.push(s):l===void 0?a.push(s):d!==l?r.push(s):i.push(s)}return{addedFiles:n,modifiedFiles:r,deletedFiles:a,changedFiles:[...n,...r,...a].sort(),unchangedFiles:i}}function Ve(e,t,n){let r=new Set(e.affectedFiles),a=new Set(t.changedFiles),i=e.mode==="full-project"?[]:t.changedFiles.filter(d=>!r.has(d)),o=e.affectedFiles.filter(d=>!a.has(d)).sort(),s=t.changedFiles.length-i.length;return{passed:i.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:i,extraFiles:o}}function Xe(e,t=fa){let n=t.wallNow===void 0&&t.monotonicNow===void 0,r=t.monotonicNow??t.now,a=t.wallNow??t.now,i=r(),o=(l,c)=>{let p=r();return Gn(e.refreshResult,l,n?p:a(),Math.max(0,p-i),c)};if(!t.databaseExists(e.previousDbPath))return o("prior-index-unavailable");if(!t.databaseExists(e.candidateDbPath))return o("candidate-index-unavailable");let s=null,d=null;try{s=t.openDatabase(e.projectRoot,e.previousDbPath,e.previousIndexPath),d=t.openDatabase(e.projectRoot,e.candidateDbPath,e.candidateIndexPath);let l=[...new Set([...t.indexedPaths(s),...t.indexedPaths(d)])].sort(),c=ce(e.previousSnapshot,e.currentSnapshot),p=new Set(l),u=c.changes.length>0&&!ze(c).fullProject&&c.changes.every(w=>p.has(w.path)),g=Se(c,u?t.dependencyGraph(s):new Map,l),m=da(t.factDigests(s),t.factDigests(d)),x=r();return{version:1,status:"evaluated",refreshResult:e.refreshResult,recordedAt:new Date(n?x:a()).toISOString(),durationMs:Math.max(0,x-i),manifest:c,plan:g,comparison:m,evaluation:Ve(g,m,l.length)}}catch(l){return o("oracle-error",l instanceof Error?l.message:String(l))}finally{Ln(s),Ln(d)}}function Cn(e,t,n,r=Date.now()){return Gn(e,t,r,0,n)}function $n(e){let t=ia(e);return{latestPath:An(t,"affected-shadow-latest.json"),historyPath:An(t,"affected-shadow.jsonl")}}function Vo(e,t=n=>xt(n,"affected-shadow source file")){let n=$n(e),r;try{r=JSON.parse(t(n.latestPath))}catch(f){let y=ba(f),P=y?"telemetry-missing":Sa(f);return D(n,P,y?void 0:f instanceof Error?f.message:String(f))}if(L(r)&&typeof r.version=="number"&&r.version!==1)return D(n,"unsupported-record-version",`Unsupported version ${r.version}.`);if(!ha(r))return D(n,"telemetry-malformed");if(r.status==="unavailable")return ya(r.reason)?{state:"unavailable",...n,reason:r.reason,recordedAt:r.recordedAt,refreshResult:r.refreshResult,durationMs:r.durationMs,...typeof r.error=="string"?{error:r.error}:{}}:D(n,"telemetry-malformed");if(r.status!=="evaluated")return D(n,"telemetry-malformed");let a=r.plan,i=r.comparison,o=r.evaluation;if(!L(r.manifest)||!L(a)||!L(i)||!L(o))return D(n,"telemetry-malformed");let s=a.mode,d=M(a.affectedFiles),l=M(a.reasons),c=M(i.changedFiles),p=M(o.predictedFiles),u=M(o.actualFiles),g=M(o.missingFiles),m=o.recall,x=o.affectedRatio;if(s!=="none"&&s!=="closure"&&s!=="full-project"||d===null||l===null||c===null||p===null||u===null||g===null||typeof o.passed!="boolean"||!Mn(m)||!Mn(x))return D(n,"telemetry-malformed");let w=u.length===0?1:(u.length-g.length)/u.length;return!Nn(d,p)||!Nn(c,u)||o.passed!==(g.length===0)||Math.abs(m-w)>Number.EPSILON||g.some(f=>!u.includes(f)||p.includes(f))?D(n,"telemetry-malformed"):{state:o.passed?"passing":"failing",...n,recordedAt:r.recordedAt,refreshResult:r.refreshResult,durationMs:r.durationMs,mode:s,recall:m,affectedRatio:x,predictedFiles:p,actualFiles:u,missingFiles:g,fallbackReasons:l}}function Xo(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 Bn(e,t,n=ma){let r=$n(e);return n.appendHistory(r.historyPath,t),n.writeLatest(r.latestPath,t),r}var la=8*1024*1024,ua=Kt;function pa(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 ga(e,t,n=la){Zt(e,pa(t),{maxSegmentBytes:n,previousSuffix:ua})}function Qe(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 fa={now:()=>Date.now(),wallNow:()=>Date.now(),monotonicNow:b,databaseExists:e=>aa(e),openDatabase:(e,t,n)=>new F({projectRoot:e,dbPath:t,indexPath:n}),indexedPaths:e=>ge(e),dependencyGraph:e=>fe(e),factDigests:e=>sa(e)},ma={appendHistory:ga,writeLatest:(e,t)=>qt(e,t,{spacing:2,trailingNewline:!0})};function Gn(e,t,n,r,a){return{version:1,status:"unavailable",refreshResult:e,recordedAt:new Date(n).toISOString(),durationMs:r,reason:t,...a?{error:a}:{}}}function Ln(e){try{e?.close()}catch{}}function ha(e){return L(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 ya(e){return e==="prior-index-unavailable"||e==="candidate-index-unavailable"||e==="oracle-error"}function Mn(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1}function Nn(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function D(e,t,n){return{state:"unavailable",...e,reason:t,...n?{error:n}:{}}}function Sa(e){return e instanceof SyntaxError?"telemetry-malformed":"telemetry-unreadable"}function ba(e){return e instanceof Error&&e.code==="ENOENT"}import{readdirSync as Pa}from"fs";import{isAbsolute as Un,join as xa,resolve as Ra}from"path";var be="@sourcegraph/scip-typescript@0.4.0",Wn="scip-python-plus@0.7.5",qn="github.com/sourcegraph/scip-go@v0.2.7",Hn="scip-dotnet@0.2.14",va="scip_dart@1.6.2",Ia={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:[...I.typescript],installMethods:[{label:"npm",identity:be,destination:"npm global prefix",prerequisite:"npm",binary:"npm",args:["install","-g",be]}],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:[...I.javascript],installMethods:[{label:"npm",identity:be,destination:"npm global prefix",prerequisite:"npm",binary:"npm",args:["install","-g",be]}],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:[...I.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:[...I.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:[...I.kotlin],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},rust:{language:z.language,indexerBinary:z.indexerBinary,checkCommand:`${z.indexerBinary} --version`,indexArgs:({outputPath:e})=>({binary:z.indexerBinary,args:["scip",".","--output",e]}),markerFiles:[...I.rust],installMethods:[],installUrl:z.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:[...I.python],installMethods:[{label:"npm",identity:Wn,destination:"npm global prefix",prerequisite:"npm",binary:"npm",args:["install","-g",Wn]}],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 a=["-root",e,"-output",t];return r&&a.push("-config",Un(r)?r:Ra(e,r)),{binary:n,args:a}},markerFiles:[...I.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:[...I.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:[...I.go],installMethods:[{label:"go install",identity:qn,destination:"Go bin directory (GOBIN or GOPATH/bin)",prerequisite:"go",binary:"go",args:["install",qn]}],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:[...I.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:[...I.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",Jn(e,[".sln",".csproj"])??e,"--output",t,"--working-directory",e]}),markerFiles:[...I.csharp],installMethods:[{label:"dotnet",identity:Hn,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",Jn(e,[".sln",".vbproj"])??e,"--output",t,"--working-directory",e]}),markerFiles:[...I.vb],installMethods:[{label:"dotnet",identity:Hn,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:[...I.dart],installMethods:[{label:"dart pub",identity:va,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})=>Un(e)?{binary:"php",args:["-d","error_reporting=E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED",e]}:{binary:e,args:[]},defaultOutputPath:"index.scip",markerFiles:[...I.php],installMethods:[],installUrl:"https://github.com/davidrjenni/scip-php/releases"}};function zn(e){if(!(e.projectPath||e.pnpmWorkspaces)){if(e.language==="typescript")return"{}";if(e.language==="javascript")return'{"compilerOptions":{"allowJs":true}}'}}function Ye(e){return Ia[e]}function Jn(e,t){let n;try{n=Pa(e)}catch{return null}for(let r of t)for(let a of n)if(a.endsWith(r))return xa(e,a);return null}import{createHash as Ea}from"crypto";import{existsSync as Qn,rmSync as Vn}from"fs";import{resolve as wa}from"path";import Kn from"better-sqlite3";var _a={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}]},ja={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 Zn(e){let t=b(),n=Ta(e.affectedFiles);if(Fa(e.previousDbPath,e.miniDbPath,e.candidateDbPath),Vn(e.candidateDbPath,{force:!0}),!Qn(e.previousDbPath))throw new Error("previous SQLite generation is unavailable");if(!Qn(e.miniDbPath))throw new Error("incremental SQLite mini database is unavailable");Xn(e.previousDbPath,"previous SQLite generation",!1),Xn(e.miniDbPath,"incremental SQLite mini database");let r=C(e.previousDbPath,e.candidateDbPath);e.writeTelemetry&&$(e.writeTelemetry,r);let a=null;try{a=new Kn(e.candidateDbPath,{fileMustExist:!0}),a.pragma("busy_timeout = 5000"),a.pragma("foreign_keys = ON"),a.prepare("ATTACH DATABASE ? AS incremental").run(e.miniDbPath),Ke(a,"main","candidate SQLite generation"),Ke(a,"incremental","incremental SQLite mini database"),ka(a,n),Da(a,n.length);let i=Ze(a,"main",!0),o=O(a,"SELECT COUNT(*) AS value FROM main.documents");a.transaction(()=>{Oa(a),Aa(a),La(a),e.onStage?.("after-delete"),Ma(a),e.onStage?.("after-symbol-reconciliation"),Na(a),e.onStage?.("after-insert"),Ca(a),$a(a,n.length,o),e.onStage?.("before-commit")}).immediate(),er(a,"main","candidate SQLite generation");let l=[...Ba(a)].filter(([c,p])=>i.get(c)!==p).map(([c])=>c).sort();return a.exec("DETACH DATABASE incremental"),a.close(),a=null,{candidateDbPath:e.candidateDbPath,affectedDocumentCount:n.length,changedDocumentPaths:l,durationMs:b()-t}}catch(i){try{a?.close()}finally{Vn(e.candidateDbPath,{force:!0})}throw new Error(`Incremental SQLite publication rejected: ${i instanceof Error?i.message:String(i)}`,{cause:i})}}function Ta(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 Fa(e,t,n){let r=[e,t,n].map(a=>wa(a));if(new Set(r).size!==r.length)throw new Error("previous, mini, and candidate SQLite paths must be distinct")}function Xn(e,t,n=!0){let r=new Kn(e,{readonly:!0,fileMustExist:!0});try{Ke(r,"main",t),n&&er(r,"main",t)}finally{r.close()}}function Ke(e,t,n){for(let[r,a]of Object.entries(_a)){let o=e.prepare(`PRAGMA ${t}.table_info('${r}')`).all().map(({name:s,type:d,notnull:l,pk:c})=>({name:s,type:d.toUpperCase(),notnull:l,pk:c}));if(JSON.stringify(o)!==JSON.stringify(a))throw new Error(`${n} schema changed for table ${r}`)}for(let[r,a]of Object.entries(ja)){let i=e.prepare(`SELECT tbl_name FROM ${t}.sqlite_master WHERE type = 'index' AND name = ?`).get(r),o=e.prepare(`PRAGMA ${t}.index_info('${r}')`).all().map(s=>s.name);if(i?.tbl_name!==a.table||JSON.stringify(o)!==JSON.stringify(a.columns))throw new Error(`${n} schema changed for index ${r}`)}Yn(e,t,"documents",["relative_path"],n),Yn(e,t,"global_symbols",["symbol"],n)}function Yn(e,t,n,r,a){if(!e.prepare(`PRAGMA ${t}.index_list('${n}')`).all().some(s=>{if(s.unique!==1)return!1;let d=e.prepare(`PRAGMA ${t}.index_info('${s.name}')`).all().map(l=>l.name);return JSON.stringify(d)===JSON.stringify(r)}))throw new Error(`${a} lost the unique ${n}(${r.join(", ")}) constraint`)}function er(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 ka(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(a=>{for(let i of a)n.run(i)})(t)}function Da(e,t){let n=O(e,"SELECT COUNT(*) AS value FROM incremental.documents"),r=O(e,`SELECT COUNT(*) AS value
|
|
59
|
-
FROM main.documents d
|
|
60
|
-
JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path`),a=e.prepare(`SELECT p.relative_path
|
|
61
|
-
FROM temp.incremental_affected_paths p
|
|
62
|
-
LEFT JOIN incremental.documents d ON d.relative_path = p.relative_path
|
|
63
|
-
WHERE d.id IS NULL
|
|
64
|
-
LIMIT 1`).pluck().get(),i=e.prepare(`SELECT d.relative_path
|
|
65
|
-
FROM incremental.documents d
|
|
66
|
-
LEFT JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
|
|
67
|
-
WHERE p.relative_path IS NULL
|
|
68
|
-
LIMIT 1`).pluck().get();if(n!==t||r!==t||a!==void 0||i!==void 0)throw new Error("incremental SQLite mini database does not exactly match the affected document set")}function Oa(e){e.exec(`
|
|
69
|
-
CREATE TEMP TABLE incremental_old_defined_symbols (symbol TEXT PRIMARY KEY) WITHOUT ROWID;
|
|
70
|
-
INSERT OR IGNORE INTO temp.incremental_old_defined_symbols(symbol)
|
|
71
|
-
SELECT g.symbol
|
|
72
|
-
FROM main.defn_enclosing_ranges r
|
|
73
|
-
JOIN main.documents d ON d.id = r.document_id
|
|
74
|
-
JOIN main.global_symbols g ON g.id = r.symbol_id
|
|
75
|
-
JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path;
|
|
76
|
-
INSERT OR IGNORE INTO temp.incremental_old_defined_symbols(symbol)
|
|
77
|
-
SELECT g.symbol
|
|
78
|
-
FROM main.mentions m
|
|
79
|
-
JOIN main.chunks c ON c.id = m.chunk_id
|
|
80
|
-
JOIN main.documents d ON d.id = c.document_id
|
|
81
|
-
JOIN main.global_symbols g ON g.id = m.symbol_id
|
|
82
|
-
JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
|
|
83
|
-
WHERE m.role = 1;
|
|
84
|
-
|
|
85
|
-
CREATE TEMP TABLE incremental_new_defined_symbols (symbol TEXT PRIMARY KEY) WITHOUT ROWID;
|
|
86
|
-
INSERT OR IGNORE INTO temp.incremental_new_defined_symbols(symbol)
|
|
87
|
-
SELECT g.symbol
|
|
88
|
-
FROM incremental.defn_enclosing_ranges r
|
|
89
|
-
JOIN incremental.global_symbols g ON g.id = r.symbol_id;
|
|
90
|
-
INSERT OR IGNORE INTO temp.incremental_new_defined_symbols(symbol)
|
|
91
|
-
SELECT g.symbol
|
|
92
|
-
FROM incremental.mentions m
|
|
93
|
-
JOIN incremental.global_symbols g ON g.id = m.symbol_id
|
|
94
|
-
WHERE m.role = 1;
|
|
95
|
-
`)}function Aa(e){let t=e.prepare(`WITH changed_symbols AS (
|
|
96
|
-
SELECT symbol FROM temp.incremental_old_defined_symbols
|
|
97
|
-
UNION
|
|
98
|
-
SELECT symbol FROM temp.incremental_new_defined_symbols
|
|
99
|
-
), unaffected_definitions AS (
|
|
100
|
-
SELECT g.symbol
|
|
101
|
-
FROM main.defn_enclosing_ranges r
|
|
102
|
-
JOIN main.documents d ON d.id = r.document_id
|
|
103
|
-
JOIN main.global_symbols g ON g.id = r.symbol_id
|
|
104
|
-
LEFT JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
|
|
105
|
-
WHERE p.relative_path IS NULL
|
|
106
|
-
UNION
|
|
107
|
-
SELECT g.symbol
|
|
108
|
-
FROM main.mentions m
|
|
109
|
-
JOIN main.chunks c ON c.id = m.chunk_id
|
|
110
|
-
JOIN main.documents d ON d.id = c.document_id
|
|
111
|
-
JOIN main.global_symbols g ON g.id = m.symbol_id
|
|
112
|
-
LEFT JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
|
|
113
|
-
WHERE m.role = 1 AND p.relative_path IS NULL
|
|
114
|
-
)
|
|
115
|
-
SELECT u.symbol
|
|
116
|
-
FROM unaffected_definitions u
|
|
117
|
-
JOIN changed_symbols c ON c.symbol = u.symbol
|
|
118
|
-
LIMIT 1`).pluck().get();if(typeof t=="string")throw new Error(`symbol definition is shared by affected and unaffected documents: ${t}`)}function La(e){e.exec(`
|
|
119
|
-
DELETE FROM main.mentions
|
|
120
|
-
WHERE chunk_id IN (
|
|
121
|
-
SELECT c.id
|
|
122
|
-
FROM main.chunks c
|
|
123
|
-
JOIN main.documents d ON d.id = c.document_id
|
|
124
|
-
JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
|
|
125
|
-
);
|
|
126
|
-
DELETE FROM main.chunks
|
|
127
|
-
WHERE document_id IN (
|
|
128
|
-
SELECT d.id
|
|
129
|
-
FROM main.documents d
|
|
130
|
-
JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
|
|
131
|
-
);
|
|
132
|
-
DELETE FROM main.defn_enclosing_ranges
|
|
133
|
-
WHERE document_id IN (
|
|
134
|
-
SELECT d.id
|
|
135
|
-
FROM main.documents d
|
|
136
|
-
JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path
|
|
137
|
-
);
|
|
138
|
-
DELETE FROM main.documents
|
|
139
|
-
WHERE relative_path IN (SELECT relative_path FROM temp.incremental_affected_paths);
|
|
140
|
-
`)}function Ma(e){e.exec(`
|
|
141
|
-
UPDATE main.global_symbols
|
|
142
|
-
SET display_name = NULL,
|
|
143
|
-
kind = NULL,
|
|
144
|
-
documentation = NULL,
|
|
145
|
-
signature = NULL,
|
|
146
|
-
enclosing_symbol = NULL,
|
|
147
|
-
relationships = NULL
|
|
148
|
-
WHERE symbol IN (SELECT symbol FROM temp.incremental_old_defined_symbols);
|
|
149
|
-
|
|
150
|
-
INSERT OR IGNORE INTO main.global_symbols(
|
|
151
|
-
symbol, display_name, kind, documentation, signature, enclosing_symbol, relationships
|
|
152
|
-
)
|
|
153
|
-
SELECT symbol, display_name, kind, documentation, signature, enclosing_symbol, relationships
|
|
154
|
-
FROM incremental.global_symbols;
|
|
155
|
-
|
|
156
|
-
UPDATE main.global_symbols
|
|
157
|
-
SET display_name = (
|
|
158
|
-
SELECT source.display_name FROM incremental.global_symbols source
|
|
159
|
-
WHERE source.symbol = main.global_symbols.symbol
|
|
160
|
-
),
|
|
161
|
-
kind = (
|
|
162
|
-
SELECT source.kind FROM incremental.global_symbols source
|
|
163
|
-
WHERE source.symbol = main.global_symbols.symbol
|
|
164
|
-
),
|
|
165
|
-
documentation = (
|
|
166
|
-
SELECT source.documentation FROM incremental.global_symbols source
|
|
167
|
-
WHERE source.symbol = main.global_symbols.symbol
|
|
168
|
-
),
|
|
169
|
-
signature = (
|
|
170
|
-
SELECT source.signature FROM incremental.global_symbols source
|
|
171
|
-
WHERE source.symbol = main.global_symbols.symbol
|
|
172
|
-
),
|
|
173
|
-
enclosing_symbol = (
|
|
174
|
-
SELECT source.enclosing_symbol FROM incremental.global_symbols source
|
|
175
|
-
WHERE source.symbol = main.global_symbols.symbol
|
|
176
|
-
),
|
|
177
|
-
relationships = (
|
|
178
|
-
SELECT source.relationships FROM incremental.global_symbols source
|
|
179
|
-
WHERE source.symbol = main.global_symbols.symbol
|
|
180
|
-
)
|
|
181
|
-
WHERE symbol IN (SELECT symbol FROM temp.incremental_new_defined_symbols);
|
|
182
|
-
`)}function Na(e){let t=O(e,"SELECT COALESCE(MAX(id), 0) AS value FROM main.documents"),n=O(e,"SELECT COALESCE(MAX(id), 0) AS value FROM main.chunks"),r=O(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)
|
|
183
|
-
SELECT id + ?, language, relative_path, position_encoding, text
|
|
184
|
-
FROM incremental.documents`).run(t),e.prepare(`INSERT INTO main.chunks(id, document_id, chunk_index, start_line, end_line, occurrences)
|
|
185
|
-
SELECT id + ?, document_id + ?, chunk_index, start_line, end_line, occurrences
|
|
186
|
-
FROM incremental.chunks`).run(n,t),e.prepare(`INSERT INTO main.mentions(chunk_id, symbol_id, role)
|
|
187
|
-
SELECT m.chunk_id + ?, target.id, m.role
|
|
188
|
-
FROM incremental.mentions m
|
|
189
|
-
JOIN incremental.global_symbols source ON source.id = m.symbol_id
|
|
190
|
-
JOIN main.global_symbols target ON target.symbol = source.symbol`).run(n),e.prepare(`INSERT INTO main.defn_enclosing_ranges(
|
|
191
|
-
id, document_id, symbol_id, start_line, start_char, end_line, end_char
|
|
192
|
-
)
|
|
193
|
-
SELECT r.id + ?, r.document_id + ?, target.id,
|
|
194
|
-
r.start_line, r.start_char, r.end_line, r.end_char
|
|
195
|
-
FROM incremental.defn_enclosing_ranges r
|
|
196
|
-
JOIN incremental.global_symbols source ON source.id = r.symbol_id
|
|
197
|
-
JOIN main.global_symbols target ON target.symbol = source.symbol`).run(r,t)}function Ca(e){e.exec(`
|
|
198
|
-
DELETE FROM main.global_symbols
|
|
199
|
-
WHERE NOT EXISTS (SELECT 1 FROM main.mentions m WHERE m.symbol_id = main.global_symbols.id)
|
|
200
|
-
AND NOT EXISTS (
|
|
201
|
-
SELECT 1 FROM main.defn_enclosing_ranges r WHERE r.symbol_id = main.global_symbols.id
|
|
202
|
-
);
|
|
203
|
-
`)}function $a(e,t,n){let r=O(e,"SELECT COUNT(*) AS value FROM main.documents"),a=O(e,`SELECT COUNT(*) AS value
|
|
204
|
-
FROM main.documents d
|
|
205
|
-
JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path`);if(r!==n||a!==t)throw new Error("candidate SQLite document counts changed unexpectedly");let i=e.prepare("SELECT relative_path FROM main.documents GROUP BY relative_path HAVING COUNT(*) > 1 LIMIT 1").pluck().get(),o=e.prepare("SELECT symbol FROM main.global_symbols GROUP BY symbol HAVING COUNT(*) > 1 LIMIT 1").pluck().get();if(i!==void 0||o!==void 0)throw new Error("candidate SQLite generation contains duplicate document paths or symbols")}function Ba(e){let t=Ze(e,"main",!0),n=Ze(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 Ze(e,t,n){let r=n?"JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path":"",a=e.prepare(`SELECT d.relative_path, d.language, d.position_encoding, d.text
|
|
206
|
-
FROM ${t}.documents d
|
|
207
|
-
${r}
|
|
208
|
-
ORDER BY d.relative_path`).all(),i=e.prepare(`SELECT d.relative_path, c.chunk_index, c.start_line, c.end_line, hex(c.occurrences) AS occurrences
|
|
209
|
-
FROM ${t}.chunks c
|
|
210
|
-
JOIN ${t}.documents d ON d.id = c.document_id
|
|
211
|
-
${r}
|
|
212
|
-
ORDER BY d.relative_path, c.chunk_index, c.start_line, c.end_line, c.id`).all(),o=e.prepare(`SELECT d.relative_path, r.start_line, r.start_char, r.end_line, r.end_char,
|
|
213
|
-
g.symbol, g.display_name, g.kind, g.documentation,
|
|
214
|
-
CASE WHEN g.signature IS NULL THEN NULL ELSE hex(g.signature) END AS signature,
|
|
215
|
-
g.enclosing_symbol,
|
|
216
|
-
CASE WHEN g.relationships IS NULL THEN NULL ELSE hex(g.relationships) END AS relationships
|
|
217
|
-
FROM ${t}.defn_enclosing_ranges r
|
|
218
|
-
JOIN ${t}.documents d ON d.id = r.document_id
|
|
219
|
-
JOIN ${t}.global_symbols g ON g.id = r.symbol_id
|
|
220
|
-
${r}
|
|
221
|
-
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
|
|
222
|
-
FROM ${t}.mentions m
|
|
223
|
-
JOIN ${t}.chunks c ON c.id = m.chunk_id
|
|
224
|
-
JOIN ${t}.documents d ON d.id = c.document_id
|
|
225
|
-
JOIN ${t}.global_symbols g ON g.id = m.symbol_id
|
|
226
|
-
${r}
|
|
227
|
-
ORDER BY d.relative_path, c.chunk_index, m.role, g.symbol`).all(),d=new Map;for(let[c,p]of Object.entries({documents:a,chunks:i,definitions:o,mentions:s}))for(let u of p){let g=JSON.stringify([c,u]),m=d.get(u.relative_path)??[];m.push(g),d.set(u.relative_path,m)}let l=new Map;for(let[c,p]of[...d].sort(([u],[g])=>u.localeCompare(g))){let u=Ea("sha256");for(let g of p.sort())u.update(g).update(`
|
|
228
|
-
`);l.set(c,u.digest("hex"))}return l}function O(e,t){return e.prepare(t).get().value}import Ga from"better-sqlite3";var Pe="idx_mentions_definitions",Ua=["symbol_id","chunk_id"];function et(e){let t=new Ga(e),n=[],r=[],a=[];try{return t.transaction(()=>{Wa(t,n),xe(t,"idx_global_symbols_symbol")?.join("\0")==="symbol"&&tr(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")):xe(t,"idx_global_symbols_symbol")&&a.push("idx_global_symbols_symbol");let i=xe(t,"idx_chunks_doc_id"),o=tr(t,"chunks").some(s=>s.name!=="idx_chunks_doc_id"&&s.columns.length>1&&s.columns[0]==="document_id");i?.join("\0")==="document_id"&&o?(t.exec('DROP INDEX "idx_chunks_doc_id"'),r.push("idx_chunks_doc_id")):i&&a.push("idx_chunks_doc_id"),t.exec("ANALYZE")})(),{added:n,removed:r,retained:a,analyzed:!0}}catch(i){if(i.code==="SQLITE_NOTADB")return{added:[],removed:[],retained:[],analyzed:!1,skippedReason:"not-a-sqlite-database"};throw i}finally{t.close()}}function Wa(e,t){let n=nr(e,Pe);if(n){let r=n.columns.join("\0")===Ua.join("\0"),a=/\bWHERE\s+role\s*=\s*1\b/iu.test(n.sql??"");if(!r||!a||n.table!=="mentions")throw new Error(`${Pe} exists with an incompatible definition`);return}e.exec(`CREATE INDEX "${Pe}" ON mentions(symbol_id, chunk_id) WHERE role = 1`),t.push(Pe)}function tr(e,t){return e.prepare(`PRAGMA index_list('${t.replaceAll("'","''")}')`).all().map(n=>({name:n.name,unique:n.unique===1,columns:xe(e,n.name)??[]}))}function xe(e,t){return nr(e,t)?.columns??null}function nr(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(a=>a.name);return{table:n.tbl_name,sql:n.sql,columns:r}}import{createHash as qa}from"crypto";import{existsSync as tt,readdirSync as Ha}from"fs";import{dirname as nt,join as Re,relative as Ja,resolve as rt,sep as rr}from"path";function ar(e,t){let n=t.includes("."),r={};for(let i of t)r[i]=[];let a=[];for(let i of e){let o=cr(i.path,t);o?r[o].push(i):n?r["."].push(i):a.push(i)}return{files:r,shared:a}}function ir(e,t){let n=new Map;for(let a of e){let i=t[a]?.packageName;i&&n.set(i,a)}let r=new Map;for(let a of e)r.set(a,new Set);for(let a of e){let i=t[a],o=r.get(a);if(!i||i.parseFailed){for(let s of e)s!==a&&o.add(s);continue}for(let s of i.dependencyNames){let d=n.get(s);d&&d!==a&&o.add(d)}for(let s of[...i.pathsTargets,...i.referencesPaths]){let d=cr(s,e);d&&d!==a&&o.add(d)}}return za(e,r)}function or(e,t,n){let r={};for(let a of e){let i=new Map;for(let o of t.files[a]??[])i.set(o.path,o);for(let o of n[a]??[])for(let s of t.files[o]??[])i.set(s.path,s);for(let o of t.shared)i.set(o.path,o);r[a]={files:[...i.values()].sort((o,s)=>o.path.localeCompare(s.path))}}return r}function at(e){if(e===".")return"root";let t=qa("sha256").update(e).digest("hex").slice(0,8);return`${e.split("/").join("__")}-${t}`}function sr(e,t){let n=rt(e),r={};for(let a of t)r[a]=Qa(n,a);return r}function cr(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 za(e,t){let n={};for(let r of e){let a=new Set,i=[...t.get(r)??[]];for(;i.length>0;){let o=i.pop();if(!(o===r||a.has(o))){a.add(o);for(let s of t.get(o)??[])s!==r&&!a.has(s)&&i.push(s)}}n[r]=[...a].sort((o,s)=>o.localeCompare(s))}return n}function Qa(e,t){let n=t==="."?e:Re(e,t),r=Va(n),a=Xa(n),i=a?Ya(a,e):{pathsTargets:[],referencesPaths:[],failed:!1};return{packageName:r.name,dependencyNames:r.dependencyNames,pathsTargets:i.pathsTargets,referencesPaths:i.referencesPaths,parseFailed:r.failed||i.failed}}function Va(e){let t=Re(e,"package.json");if(!tt(t))return{name:void 0,dependencyNames:[],failed:!1};let n=it(t);if(!n.ok)return{name:void 0,dependencyNames:[],failed:!0};let r=typeof n.value.name=="string"?n.value.name:void 0,a=new Set;for(let i of["dependencies","devDependencies","peerDependencies"]){let o=n.value[i];if(o&&typeof o=="object"&&!Array.isArray(o))for(let s of Object.keys(o))a.add(s)}return{name:r,dependencyNames:[...a],failed:!1}}function Xa(e){let t=Re(e,"tsconfig.json");if(tt(t))return t;let n;try{n=Ha(e).filter(r=>/^tsconfig.*\.json$/.test(r))}catch{return}return n.sort((r,a)=>r.localeCompare(a)),n.length>0?Re(e,n[0]):void 0}function Ya(e,t){let n=it(e);if(!n.ok)return{pathsTargets:[],referencesPaths:[],failed:!0};let r=Ka(n.value,e,t),a=dr(e,n.value,t,0);return{pathsTargets:a.pathsTargets,referencesPaths:r,failed:a.failed}}function Ka(e,t,n){let r=e.references;if(!Array.isArray(r))return[];let a=nt(t),i=new Set;for(let o of r){if(!o||typeof o!="object")continue;let s=o.path;if(typeof s!="string"||s.trim()==="")continue;let d=lr(s,a,n);d&&i.add(d)}return[...i]}function dr(e,t,n,r){let a=Za(t);if(a)return{pathsTargets:ei(a,nt(e),n),failed:!1};if(r>=5)return{pathsTargets:[],failed:!1};let i=ti(t.extends,e,n);if(!i)return{pathsTargets:[],failed:!1};let o=it(i);return o.ok?dr(i,o.value,n,r+1):{pathsTargets:[],failed:!0}}function Za(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 ei(e,t,n){let r=new Set;for(let a of Object.values(e))if(Array.isArray(a))for(let i of a){if(typeof i!="string")continue;let o=lr(i,t,n);o&&r.add(o)}return[...r]}function ti(e,t,n){let r=Array.isArray(e)?e.at(-1):e;if(typeof r!="string"||r.trim()===""||!r.startsWith(".")&&!r.startsWith("/"))return;let a=rt(nt(t),r);if(a.endsWith(".json")||(a=`${a}.json`),!a.split(rr).includes("node_modules")&&Me(n,a)&&tt(a))return a}function lr(e,t,n){let r=e.replace(/\/?\*+$/,""),a=rt(t,r===""?".":r);if(!Me(n,a))return;let o=Ja(n,a).split(rr).join("/");return o===""?".":o}function ni(e){let t="",n=0,r=!1,a=e.length;for(;n<a;){let i=e[n];if(r){if(t+=i,i==="\\"&&n+1<a){t+=e[n+1],n+=2;continue}i==='"'&&(r=!1),n+=1;continue}if(i==='"'){r=!0,t+=i,n+=1;continue}if(i==="/"&&e[n+1]==="/"){for(n+=2;n<a&&e[n]!==`
|
|
229
|
-
`;)n+=1;continue}if(i==="/"&&e[n+1]==="*"){for(n+=2;n<a&&!(e[n]==="*"&&e[n+1]==="/");)n+=1;n+=2;continue}t+=i,n+=1}return t}function it(e){try{let t=ie(e,{maxBytes:Pt,inputKind:"TypeScript project manifest"}),n=JSON.parse(ni(t));return n&&typeof n=="object"&&!Array.isArray(n)?{ok:!0,value:n}:{ok:!1}}catch{return{ok:!1}}}import{createHash as gi}from"crypto";import{existsSync as ot,statSync as fi,writeFileSync as st}from"fs";import{join as mi}from"path";import{randomUUID as ri}from"crypto";import{existsSync as ai}from"fs";var ii=12e4,oi=5,ve=class{projectRoot;cacheDir;baseGeneration;timeoutMs;runtime;mailboxLimits;constructor(t,n={}){this.projectRoot=kt(t.projectRoot),this.cacheDir=t.cacheDir,this.baseGeneration=t.baseGeneration,this.timeoutMs=n.timeoutMs??ui(),this.runtime=n.runtime??pi,this.mailboxLimits=n.mailboxLimits??{}}request(t){let n=jn(this.cacheDir),r=wn(this.cacheDir),a=Je(n.statePath);if(!ur(a,this.projectRoot,this.runtime))throw new Error("Compatible TypeScript index service is not running.");let i=this.runtime.now(),o=i+this.timeoutMs,s=(this.runtime.monotonicNow??b)()+this.timeoutMs,d=vn("typescript-index-v4",{baseGeneration:this.baseGeneration,request:t}),l=In(d),c=En(r,{mailboxVersion:Rn,operationKey:d,clientId:this.runtime.randomId(),enqueuedAtMs:i,deadlineAtMs:o,protocolVersion:ye,id:l,baseGeneration:this.baseGeneration,request:t},{nowMs:i,limits:this.mailboxLimits});for(;(this.runtime.monotonicNow??b)()<=s;){if(ai(c.responsePath))return si(ie(c.responsePath,{maxBytes:this.mailboxLimits.maxItemBytes??64*1024*1024,inputKind:"TypeScript index mailbox response"}),l,d,this.baseGeneration,t.producerIdentity,t.affectedFiles);let p=Je(n.statePath);if(!ur(p,this.projectRoot,this.runtime))throw new Error("TypeScript index service stopped while processing a request.");this.runtime.sleep(oi)}throw new Error(`TypeScript index service timed out after ${this.timeoutMs}ms.`)}};function ur(e,t,n){let r=e?.processIdentity?n.readProcessIdentity?.(e.pid):null;return e!==null&&e.projectRoot===t&&e.typescriptIndex?.protocolVersion===ye&&n.isProcessAlive(e.pid)&&(!e.processIdentity||r!=null&&Y(e.processIdentity,r))}function si(e,t,n,r,a,i){let o=JSON.parse(e);if(o.protocolVersion!==ye||o.id!==t||o.operationKey!==n||o.ok===!0&&o.baseGeneration!==r)throw new Error("TypeScript index service wrote an incompatible response.");if(o.ok!==!0)throw new Error(typeof o.error=="string"?o.error:"TypeScript index service request failed.");let s=ci(o.response,a),d=[...new Set(i)].sort(),l=s.fragments.map(c=>c.relativePath).sort();if(JSON.stringify(l)!==JSON.stringify(d))throw new Error("TypeScript index service omitted or added an affected document.");return s}function ci(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,a=n.fragments.map(i=>{if(!i||typeof i.relativePath!="string"||i.bytesBase64!==null&&typeof i.bytesBase64!="string"||typeof i.occurrences!="number"||!Number.isInteger(i.occurrences)||i.occurrences<0||typeof i.symbols!="number"||!Number.isInteger(i.symbols)||i.symbols<0||!Array.isArray(i.referenceFragments)||!i.referenceFragments.every(di)||r.has(i.relativePath))throw new Error("TypeScript index service wrote an invalid fragment.");r.add(i.relativePath);let o=i.bytesBase64===null?null:li(i.bytesBase64);return{relativePath:i.relativePath,bytes:o,occurrences:i.occurrences,symbols:i.symbols,referenceFragments:i.referenceFragments}});return{producerIdentity:n.producerIdentity,cold:n.cold,durationMs:n.durationMs,fragments:a}}function di(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 li(e){let t=Buffer.from(e,"base64");if(t.toString("base64")!==e)throw new Error("TypeScript index service wrote invalid base64.");return t}function ui(){let e=Number(process.env.SCIP_TYPESCRIPT_INDEX_TIMEOUT_MS);return Number.isInteger(e)&&e>0?e:ii}var pi={now:Date.now,monotonicNow:b,randomId:ri,sleep(e){let t=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(t,0,0,e)},isProcessAlive:H,readProcessIdentity:U};function hi(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=ce(e.previousSnapshot,e.currentSnapshot);if(n.changes.length===0)return{eligible:!1,reason:"no changed project inputs"};if(n.changes.some(c=>c.kind!=="modified"||c.inputKind!=="source"||!Be(c.path)))return{eligible:!1,reason:"change is not a modified TypeScript source file"};let r=Se(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 a=yi(r,t,e.graph);if(!a)return{eligible:!1,reason:"affected files cross or ambiguously match TypeScript projects"};let i=pr(e.currentSnapshot,e.projectFiles,e.producerIdentity),o=pr(e.previousSnapshot,e.projectFiles,e.producerIdentity);if(i!==o)return{eligible:!1,reason:"TypeScript fragment project identity changed"};let s=fr(e.previousSnapshot,e.projectFiles,e.graph,e.producerIdentity,e.projectFiles);if(!s)return{eligible:!1,reason:"prior document identity unavailable"};let d=fr(e.currentSnapshot,e.projectFiles,e.graph,e.producerIdentity,r.affectedFiles);if(!d)return{eligible:!1,reason:"next document identity unavailable"};let l=a.length===1?a[0]:void 0;return{eligible:!0,manifest:n,plan:r,projectIdentity:i,previousFragmentGeneration:gr(e.previousSnapshot,e.producerIdentity),nextFragmentGeneration:gr(e.currentSnapshot,e.producerIdentity),previousDocumentIdentities:s,nextDocumentIdentities:d,projects:a,...l?{tsconfigPath:l.tsconfigPath,projectArgument:l.projectArgument}:{}}}function yi(e,t,n){let r=new Map;for(let i of e.affectedFiles){let o=Si(i,t);if(!o)return null;let s=r.get(o)??[];s.push(i),r.set(o,s)}let a=[];for(let[i,o]of[...r].sort(([s],[d])=>s.localeCompare(d))){let s=new Set(o),d=e.changedFiles.filter(l=>s.has(l)||o.some(c=>bi(c,l,n)));if(d.length===0)return null;a.push({projectArgument:i,tsconfigPath:i==="."?"tsconfig.json":`${i}/tsconfig.json`,modifiedFiles:d,affectedFiles:[...o].sort()})}return a}function Si(e,t){let n=t.filter(i=>i==="."||e===i||e.startsWith(`${i}/`));if(n.length===0)return null;let r=[...new Set(n)].sort((i,o)=>Ie(o)-Ie(i)||i.localeCompare(o)),a=r[0];return r[1]&&Ie(r[1])===Ie(a)?null:a}function Ie(e){return e==="."?0:e.split("/").filter(Boolean).length}function bi(e,t,n){let r=new Set,a=[e];for(let i=0;i<a.length;i+=1){let o=a[i];if(!(!o||r.has(o))){r.add(o);for(let s of n.get(o)??[]){if(s===t)return!0;r.has(s)||a.push(s)}}}return!1}function mr(e){let t=b();try{if(!ot(e.previousDbPath)||!ot(e.previousShardPath))throw new Error("prior TypeScript graph or language shard unavailable");let n=performance.now(),r=He();if(!r.available)throw new Error(r.reason);let a=performance.now()-n;n=performance.now();let i=new F({projectRoot:e.projectRoot,dbPath:e.previousDbPath,indexPath:e.previousIndexPath}),o,s;try{o=ge(i,{includeIgnored:!1}).filter(Be).sort(),s=fe(i)}finally{i.close()}let d=performance.now()-n,l=hi({projectMode:e.projectMode,workspaceProjects:e.projectMode==="workspace"?J(e.projectRoot,e.currentSnapshot.typescriptProjects):void 0,previousSnapshot:e.previousSnapshot,currentSnapshot:e.currentSnapshot,projectFiles:o,graph:s,producerIdentity:r.producerIdentity,rootTsconfigExists:ot(mi(e.projectRoot,"tsconfig.json"))});if(!l.eligible)throw new Error(l.reason);let c=_n(e.previousDbPath);if(!c)throw new Error("published TypeScript base generation unavailable");n=performance.now();let p=new ve({projectRoot:e.projectRoot,cacheDir:e.cacheDir,baseGeneration:c}),u=l.projects.map(S=>p.request({kind:"emit-documents",tsconfigPath:S.tsconfigPath,projectArgument:S.projectArgument,projectIdentity:l.projectIdentity,producerIdentity:r.producerIdentity,modifiedFiles:S.modifiedFiles,affectedFiles:S.affectedFiles})),g=u.flatMap(S=>S.fragments),m=performance.now()-n,x=fi(e.previousShardPath).size>=ln;n=performance.now();let w=x?null:X(e.previousShardPath,{inputKind:"TypeScript base SCIP shard",maxBytes:Oe}),f=x?{completeIndexBytes:null,affectedIndexBytes:an(g)}:cn({packageVersion:r.packageVersion,baseIndexBytes:w,fragments:g}),y=performance.now()-n;n=performance.now(),x?un({cacheDir:e.cacheDir,previousGenerationIdentity:l.previousFragmentGeneration,nextGenerationIdentity:l.nextFragmentGeneration,producerIdentity:r.producerIdentity,projectIdentity:l.projectIdentity,baseShardCurrent:e.baseShardCurrent,fragments:g}):(on({cacheDir:e.cacheDir,packageVersion:r.packageVersion,indexBytes:w,producerIdentity:r.producerIdentity,projectIdentity:l.projectIdentity,generationIdentity:l.previousFragmentGeneration,documentIdentities:l.previousDocumentIdentities,allowUntrackedDocuments:!0}),sn({cacheDir:e.cacheDir,previousGenerationIdentity:l.previousFragmentGeneration,producerIdentity:r.producerIdentity,projectIdentity:l.projectIdentity,generationIdentity:l.nextFragmentGeneration,fragments:g,documentIdentities:l.nextDocumentIdentities}));let P=performance.now()-n;n=performance.now(),f.completeIndexBytes&&st(e.candidateShardPath,f.completeIndexBytes),st(e.candidateAffectedScipPath,f.affectedIndexBytes);let v=performance.now()-n,R={scipPath:x?e.previousShardPath:e.candidateShardPath,candidateScipPath:e.candidateShardPath,affectedScipPath:e.candidateAffectedScipPath,completeScipUpdated:!x,durationMs:b()-t,cold:u.some(S=>S.cold),changedFiles:l.plan.changedFiles,affectedFiles:l.plan.affectedFiles,producerIdentity:r.producerIdentity,previousFragmentGeneration:l.previousFragmentGeneration,nextFragmentGeneration:l.nextFragmentGeneration,manifest:l.manifest,plan:l.plan,projectFileCount:o.length,referenceFragmentsByFile:new Map(g.map(S=>[S.relativePath,S.referenceFragments])),timings:{runtimeMs:a,graphMs:d,requestMs:m,serviceMs:u.reduce((S,B)=>S+B.durationMs,0),assemblyMs:y,fragmentStoreMs:P,writeMs:v}};return e.onStatus(`Incremental TypeScript index emitted ${R.affectedFiles.length} affected document(s) across ${l.projects.length} project(s) in ${(R.durationMs/1e3).toFixed(3)}s (${R.cold?"cold":"warm"} service; ${x?"whole SCIP deferred":"whole SCIP current"}; runtime ${a.toFixed(0)}ms, graph ${d.toFixed(0)}ms, request ${m.toFixed(0)}ms, assembly ${y.toFixed(0)}ms, fragments ${P.toFixed(0)}ms, write ${v.toFixed(0)}ms).`),R}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 hr(e){let t=He();if(!t.available)throw new Error(t.reason);let n=pn({cacheDir:e.cacheDir,generationIdentity:e.generationIdentity,baseIndexBytes:X(e.baseShardPath,{inputKind:"TypeScript base SCIP shard",maxBytes:Oe}),packageVersion:t.packageVersion});st(e.candidateShardPath,n)}function pr(e,t,n){let r=e.files.filter(a=>Et(a.path,e.languages)!=="source").map(a=>({path:a.path,size:a.size,hash:a.hash})).sort((a,i)=>a.path.localeCompare(i.path));return ct(JSON.stringify({version:1,producerIdentity:n,pnpmWorkspaces:e.pnpmWorkspaces,typescriptProjectMode:e.typescriptProjectMode,typescriptProjects:[...e.typescriptProjects].sort(),projectFiles:[...t].sort(),nonSourceInputs:r}))}function gr(e,t){return ct(JSON.stringify({version:1,producerIdentity:t,snapshot:e}))}function fr(e,t,n,r,a){let i=new Set(e.files.map(d=>d.path)),o=Jt({projectFiles:t.filter(d=>i.has(d)),snapshot:e,graph:n,engineIdentity:r}),s=new Map;for(let d of a){let l=o.identityFor(d,"typescript-scip-document-v1");if(l.key){s.set(d,l.key);continue}if(i.has(d))return null;s.set(d,ct(JSON.stringify({version:1,producerIdentity:r,generatedDocument:d})))}return s}function ct(e){return gi("sha256").update(e).digest("hex")}import{closeSync as Pi,existsSync as Ee,fstatSync as xi,lstatSync as Ri,openSync as vi,renameSync as lt,rmSync as we,statSync as Ii,writeSync as Ei}from"fs";import{cpus as wi}from"os";import{join as ut}from"path";function _i(e,t){if(e.temporaryRootConfigContent===void 0)return null;let n=ut(t,"tsconfig.json"),r=Buffer.from(e.temporaryRootConfigContent,"utf8"),a;try{a=vi(n,"wx",384)}catch(i){if(i.code==="EEXIST")return null;throw i}try{Ei(a,r);let i=xi(a);return{path:n,content:r,device:i.dev,inode:i.ino}}finally{Pi(a)}}function ji(e){if(e)try{let t=Ri(e.path);if(!t.isFile()||t.dev!==e.device||t.ino!==e.inode||t.size!==e.content.byteLength)return;let n;try{n=X(e.path,{maxBytes:e.content.byteLength,inputKind:"temporary TypeScript index configuration"})}catch{return}if(!n.equals(e.content))return;we(e.path)}catch(t){if(t.code!=="ENOENT")throw t}}function Ti(e,t,n){if(!e.defaultOutputPath)return;let r=ut(t,e.defaultOutputPath);n!==r&&Ee(r)&<(r,n)}function Fi(e,t,n){if(!e.defaultOutputPath)return null;let r=ut(t,e.defaultOutputPath);if(r===n)return null;let a=`${n}.default-output-backup`;return we(a,{force:!0}),Ee(r)?(lt(r,a),{defaultOutputPath:r,backupPath:a}):{defaultOutputPath:r,backupPath:null}}function ki(e){e&&(we(e.defaultOutputPath,{force:!0}),e.backupPath&&Ee(e.backupPath)&<(e.backupPath,e.defaultOutputPath))}function Di(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,wi().length));return Math.max(1,Math.min(e,Math.floor(r)))}async function Sr(e,t,n,r,a){T(a,"Reindex cancelled by its owner.");let i=e.filter(c=>c.config.defaultOutputPath),o=e.filter(c=>!c.config.defaultOutputPath),s=[],d=Di(o.length,r),l=await Tn(o,d,c=>dt(c,t,n,a));if(d>1){let c=new Map;for(let p of l.filter(u=>u.result.skipped&&u.retryable)){let u=o.find(g=>g.id===p.result.id);u&&(n(`Retrying ${u.label} indexer serially after parallel failure...`),T(a,"Reindex cancelled by its owner."),c.set(u.id,(await dt(u,t,n,a)).result))}s.push(...l.map(({result:p})=>c.get(p.id)??p))}else s.push(...l.map(({result:c})=>c));for(let c of i)T(a,"Reindex cancelled by its owner."),s.push((await dt(c,t,n,a)).result);return s.sort((c,p)=>e.findIndex(u=>u.id===c.id)-e.findIndex(u=>u.id===p.id))}async function dt(e,t,n,r){T(r,"Reindex cancelled by its owner."),n(`Indexing ${e.label} with ${e.resolvedBinary}...`),we(e.scipPath,{force:!0});let a=Fi(e.config,t,e.scipPath),i=_i(e,t),o=[e.binary,...e.args].join(" "),s=b();try{e.trustedProjectTool&&Ut(t,e.trustedProjectTool);let l=Tt(e.binary,e.args),c=await se({command:l.binary,args:l.args,label:`${e.label} indexer`,cwd:t,env:e.env,timeoutMs:Oi(),maxStdoutBytes:50*1024*1024,maxStderrBytes:50*1024*1024,signal:r});if(c.status!==0){let p=c.stderr.trim();throw new Error(`${e.resolvedBinary} exited with status ${c.status}${p?`:
|
|
230
|
-
${p}`:""}`)}Ti(e.config,t,e.scipPath)}catch(l){if(r?.aborted)throw Dt(r,"Reindex cancelled by its owner.");let c=l instanceof Error?l.message:String(l),p=`${e.resolvedBinary} indexer failed: ${c.split(`
|
|
231
|
-
`)[0]}`,u=e.label===e.language?p:`${e.label}: ${p}`;return n(`Skipping ${e.label}: ${p}`),{result:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,durationMs:b()-s,command:o,skipped:{language:e.language,reason:u}},retryable:Ai(l)}}finally{ki(a),ji(i)}if(!Ee(e.scipPath)){let l=`${e.resolvedBinary} indexer completed but did not produce ${e.scipPath}`,c=e.label===e.language?l:`${e.label}: ${l}`;return n(`Skipping ${e.label}: ${l}`),{result:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,durationMs:b()-s,command:o,skipped:{language:e.language,reason:c}},retryable:!1}}let d;try{d=Ii(e.scipPath).size}catch{d=void 0}return{result:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,durationMs:b()-s,command:o,outputBytes:d},retryable:!1}}function Oi(){let e=Number(process.env.CODEBASEIQ_INDEXER_TIMEOUT_MS);return Number.isFinite(e)&&e>0?Math.floor(e):vt.indexer}function Ai(e){return e instanceof It?e.kind==="spawn"&&yr(e.cause):yr(e)}function yr(e){let t=e?.code;return t==="EAGAIN"||t==="ENOMEM"||t==="EMFILE"||t==="ENFILE"||t==="ETXTBSY"}import{execFileSync as Pr}from"child_process";import{homedir as br,platform as Li}from"os";import{delimiter as Mi,join as _e}from"path";function xr(e,t){let n=e.installMethods,r=pe(e);if(!n?.length)return t(`No auto-install method available for ${r}.`),e.installUrl&&t(`Install manually from: ${e.installUrl}`),!1;for(let a of n){if(!a.identity||!a.destination){t(`Refusing ${a.label} installation for ${r}: the installer descriptor lacks an immutable identity or destination.`);continue}if(!jt(a.prerequisite))continue;let i=Ni(a);t(`Installing immutable ${a.identity} via ${a.label} into ${i}; expected executable: ${r}.`);try{Pr(a.binary,a.args,{stdio:"inherit",windowsHide:!0,timeout:3e5,env:process.env,shell:Li()==="win32"});let o=Z(e);if(o){let s=o===e.indexerBinary?"":` (using ${o})`;return t(`Successfully installed ${a.identity} via ${a.label}${s}; resolved executable: ${o}.`),!0}t(`${a.label} command completed but ${r} was not found on PATH`)}catch(o){let s=o instanceof Error?o.message:String(o);t(`${a.label} install failed: ${s}`)}}return t(`Could not auto-install ${r}.`),e.installUrl&&t(`Install manually from: ${e.installUrl}`),!1}function Ni(e){if(e.binary==="npm")return pt("npm",["root","-g"])??e.destination;if(e.binary==="go"){let t=pt("go",["env","GOBIN"]);if(t)return t;let n=pt("go",["env","GOPATH"]);if(n)return _e(n.split(Mi)[0],"bin")}return e.binary==="dotnet"?_e(process.env.DOTNET_CLI_HOME??br(),".dotnet","tools"):e.binary==="dart"?_e(process.env.PUB_CACHE??_e(br(),".pub-cache"),"bin"):e.destination}function pt(e,t){try{return Pr(e,t,{stdio:["ignore","pipe","ignore"],windowsHide:!0,encoding:"utf8",timeout:1e4,killSignal:"SIGKILL",env:process.env}).trim()||null}catch{return null}}async function dd(e){let{projectRoot:t,maxHeapMb:n=8192,onStatus:r=console.log}=e,a=e.skipAutoInstall===!0||e.installMissing!==!0,i=Hi(e),o=Date.now(),s=b();Te(h(i.outputScip),{recursive:!0}),Te(h(i.outputDb),{recursive:!0});let d=e.languages??Ge(t);if(d.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: ${d.join(", ")}`);let l=le("reindex.fingerprint",()=>Ct(t,d,{pnpmWorkspaces:e.pnpmWorkspaces,typescriptProjectMode:e.typescriptProjectMode,typescriptProjects:e.typescriptProjects,clojureConfigPath:e.clojureConfigPath}),{languages:d.length}),c,p;if(e.skipIfUnchanged!==!1&&!hn(t,i.outputDb)&&Rr(i.outputScip)===Rr(E(h(i.outputDb),"index.scip"))){let f=ue(t);if(c=f?.clean?me(f,l):void 0,f&&!f.clean&&!qi(i)){let y=yn(f,d,{pnpmWorkspaces:e.pnpmWorkspaces,typescriptProjectMode:e.typescriptProjectMode,typescriptProjects:e.typescriptProjects,clojureConfigPath:e.clojureConfigPath});if(y)try{he({snapshot:y.snapshot,manifest:y.manifest,targetCacheDir:h(i.outputDb),targetProjectRoot:t,persistLease:!1}),xn(y.snapshot,h(i.outputDb)),r(`Forked shared baseline ${y.snapshot.generationId.slice(0,12)} for dirty worktree reindex`)}catch(P){r(`Shared baseline fork failed; continuing locally: ${A(P)}`)}}else if(c){let y=qe(c);if(y){if(!Wi(i,l))try{he({snapshot:c,manifest:y,targetCacheDir:h(i.outputDb),targetProjectRoot:t}),r(`Attached shared generation ${c.generationId.slice(0,12)}`)}catch(P){r(`Shared generation attach failed; continuing locally: ${A(P)}`)}}else{let P=await bn(c);if(P.kind==="owner")p=P.release;else if(P.kind==="generation-ready"){let v=qe(c);if(v)try{he({snapshot:c,manifest:v,targetCacheDir:h(i.outputDb),targetProjectRoot:t,action:"waited"}),r(`Attached shared generation ${c.generationId.slice(0,12)} after waiting`)}catch(R){r(`Shared generation attach failed after waiting; continuing locally: ${A(R)}`)}}else r("Shared generation build lock timed out; continuing with an isolated local reindex")}}}let g=Lt(E(h(i.outputDb),"cache-lifecycle.lock"),{waitMs:3e4});if(!g)throw p?.(),new Error(`Could not acquire codebaseiq cache lifecycle lock for ${h(i.outputDb)}.`);let m;try{m=await q("reindex.lock",()=>bo(E(h(i.outputDb),"index.lock"),{projectRoot:t,trigger:e.trigger,onStatus:r}),{languages:d.length})}catch(f){throw g.release(),p?.(),f}let x=null,w=kn();try{mn(i.outputDb,i.outputScip,i.metaPath);let f=Vi(h(i.outputDb));f.removed>0&&r(`Removed ${f.removed} abandoned reindex workspace(s)`);for(let G of f.errors)r(`Could not remove abandoned reindex workspace: ${G}`);let y=null,P=le("reindex.reuse-check",()=>(y=Ji({opts:e,paths:i,languages:d,fingerprint:l,start:o,monotonicStart:s,onStatus:r}),y),()=>({languages:d.length,reused:y!==null}));if(P){vr({snapshot:c,paths:i,projectRoot:t,fingerprint:l,onStatus:r});let G=Ue(i.outputDb,P);return G.state==="failed"&&r(`Warning: reindex succeeded, but activity telemetry was not recorded: ${G.reason}`),Ne(t,h(i.outputDb)),P}await q("reindex.scip-cli-ready",()=>uo(a,r));let v=Qi(i);x=v.runDir;let R,S=await q("reindex.fresh",async()=>(R=await Xi({opts:e,languages:d,projectRoot:t,paths:i,tempPaths:v,fingerprint:l,start:o,monotonicStart:s,maxHeapMb:n,skipAutoInstall:a,onStatus:r,writeTelemetry:w}),R),()=>({languages:d.length,reused:R?.reused,skipped:R?.skipped.length}));vr({snapshot:c,paths:i,projectRoot:t,fingerprint:l,onStatus:r});let B=Ue(i.outputDb,S);return B.state==="failed"&&r(`Warning: reindex succeeded, but activity telemetry was not recorded: ${B.reason}`),Ne(t,h(i.outputDb)),S}catch(f){let y=De({trigger:e.trigger,result:"failed",start:o,monotonicStart:s,error:f instanceof Error?f.message:String(f)});qr(i.metaPath,y);let P=rn(i.outputDb,y);throw P.state==="failed"&&r(`Warning: failed reindex activity telemetry was not recorded: ${P.reason}`),f}finally{if(x){let f=x;try{W(()=>Q(f,{recursive:!0,force:!0}))}catch(y){r(`Warning: temporary reindex workspace was left behind: ${A(y)}`)}}m(),g.release(),p?.()}}function vr(e){if(e.snapshot)try{let t=ue(e.projectRoot),n=t?me(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=Sn({snapshot:e.snapshot,sourceCacheDir:h(e.paths.outputDb),sourceProjectRoot:e.projectRoot,sourceStillValid:()=>{let a=ue(e.projectRoot);return(a?me(a,e.fingerprint):void 0)?.generationId===e.snapshot?.generationId}});Pn(e.snapshot,h(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: ${A(t)}`)}}function Wi(e,t){if(!_(e.outputScip)||!_(e.outputDb)||!Wr(e.metaPath,t))return!1;let n=N(e.outputDb,e.metaPath);return n.state!=="invalid"&&n.state!=="drifted"}function qi(e){if(!_(e.outputScip)||!_(e.outputDb)||!V(e.metaPath))return!1;let t=N(e.outputDb,e.metaPath);return t.state!=="invalid"&&t.state!=="drifted"}function A(e){return e instanceof Error?e.message:String(e)}function mt(e,t,n,r,a,i){try{te(Dn({indexPath:n,reuseExisting:a,affectedFiles:i}),{projectRoot:e,dbPath:t,onStatus:r})}catch(o){r(`Runtime-boundary extraction unavailable: ${o instanceof Error?o.message:String(o)}.`)}}function Hi(e){let t=e.outputScip??E(e.projectRoot,"index.scip"),n=e.outputDb??E(e.projectRoot,"index.db");return{outputScip:t,outputDb:n,metaPath:E(h(n),"meta.json")}}function Ji(e){let t=N(e.paths.outputDb,e.paths.metaPath);if(e.opts.skipIfUnchanged===!1||!_(e.paths.outputScip)||!_(e.paths.outputDb)||!Wr(e.paths.metaPath,e.fingerprint)||t.state==="invalid"||t.state==="drifted")return null;te(ee(),{projectRoot:e.opts.projectRoot,dbPath:e.paths.outputDb,onStatus:e.onStatus}),mt(e.opts.projectRoot,e.paths.outputDb,e.paths.outputScip,e.onStatus,!0),N(e.paths.outputDb,e.paths.metaPath).state==="drifted"&&(We(e.paths.outputDb,e.paths.metaPath),e.onStatus("Published refreshed SQLite generation after post-index augmentation"));let n=b()-e.monotonicStart,r=De({trigger:e.opts.trigger,result:"reused",start:e.start,monotonicStart:e.monotonicStart,languages:e.languages,skipped:[]});return qr(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:zi(e.paths,e.opts.projectRoot,e.languages,e.opts)}}function zi(e,t,n,r){let a=Gr(t,n,r);return n.map(i=>({id:i,language:i,reused:!0,fingerprint:ne(a[i]),outputBytes:re(yt(e.outputDb,i)),durationMs:0}))}function Qi(e){let t=$i(E(h(e.outputDb),"reindex-"));return{runDir:t,tempOutputScip:E(t,je(e.outputScip)),tempOutputDb:E(t,je(e.outputDb)),tempMetaPath:E(t,je(e.metaPath))}}function Vi(e){let t=[],n;try{n=Fr(e,{withFileTypes:!0})}catch(a){return{removed:0,errors:[A(a)]}}let r=0;for(let a of n)if(!(!a.name.startsWith("reindex-")||!a.isDirectory()))try{Q(E(e,a.name),{recursive:!0,force:!0}),r+=1}catch(i){t.push(`${a.name}: ${A(i)}`)}return{removed:r,errors:t}}async function Xi(e){let t={...process.env,NODE_OPTIONS:`--max-old-space-size=${e.maxHeapMb}`},n,r=await q("reindex.language-indexers",async()=>(n=await Ki(e,t),n),()=>({languages:e.languages.length,indexed:n?.indexedOutputs.length,reused:n?.reusedLanguages.length,skipped:n?.skippedLanguages.length})),{indexedOutputs:a,skippedLanguages:i,reusedLanguages:o,languageFingerprints:s,shards:d,typescriptProjectShardContext:l,incrementalTypeScript:c}=r;if(o.length>0&&e.onStatus(`Reused ${o.length} cached language shard(s): ${o.join(", ")}`),Yi({run:e,indexedOutputs:a,skippedLanguages:i,reusedLanguages:o})){let g=le("reindex.publish",()=>so(e,a,i,o,s,l),{mode:"metadata-only",languages:a.length,reused:o.length}),m=g.durationMs;return e.onStatus(`All language shards unchanged; reused existing SQLite index in ${(m/1e3).toFixed(1)}s`),{languages:a.map(x=>x.language),indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:m,reused:!0,skipped:i,lastRefresh:g,shards:d,writeTelemetry:e.writeTelemetry}}let p=await q("reindex.publish",()=>oo(e,t,a,i,o,s,l,c),{mode:c?"incremental-or-fallback":"full",languages:a.length,reused:o.length,skipped:i.length}),u=p.durationMs;return e.onStatus(`Done in ${(u/1e3).toFixed(1)}s`),{languages:a.map(g=>g.language),indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:u,reused:!1,skipped:i,lastRefresh:p,shards:d,writeTelemetry:e.writeTelemetry}}function Yi(e){if(e.run.opts.skipIfUnchanged===!1||e.skippedLanguages.length>0||!_(e.run.paths.outputScip)||!_(e.run.paths.outputDb))return!1;let t=N(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(a=>a.language));return e.run.languages.length>0&&r.size===e.run.languages.length&&e.indexedOutputs.length===e.run.languages.length&&e.run.languages.every(a=>n.has(a)&&r.has(a))}async function Ki(e,t){let n=ro({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=[],a=new Set;for(let[j,bt]of n)bt.reused&&(r.push({language:j,scipPath:bt.scipPath}),a.add(j));for(let j of a)e.onStatus(`Reusing cached ${j} SCIP shard (language inputs unchanged).`);let i=n.get("typescript"),o=N(e.paths.outputDb,e.paths.metaPath),s=V(e.paths.metaPath),d=o.state==="legacy"||o.state==="current",l=s?.scipCompanion!=="deferred"&&(o.state!=="current"||o.generation.publication?.scipCompanion!=="deferred"),c=i&&!i.reused&&d?mr({projectRoot:e.projectRoot,cacheDir:h(e.paths.outputDb),previousDbPath:e.paths.outputDb,previousIndexPath:e.paths.outputScip,previousShardPath:i.scipPath,candidateShardPath:ae(e.tempPaths.tempOutputScip,"typescript-incremental",0),candidateAffectedScipPath:ae(e.tempPaths.tempOutputScip,"typescript-affected",0),baseShardCurrent:l,previousSnapshot:ht(e.paths.metaPath),currentSnapshot:e.fingerprint,projectMode:e.opts.typescriptProjectMode,onStatus:e.onStatus}):null,p=new Set(c?["typescript"]:[]),u=c?void 0:Zi(e,n),{preparedRuns:g,skippedLanguages:m,languageOutputScipPaths:x}=po({languages:e.languages.filter(j=>!a.has(j)&&!p.has(j)),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:u?.allProjects,clojureConfigPath:e.opts.clojureConfigPath,onStatus:e.onStatus}),w=u?g.filter(j=>j.language!=="typescript"||u.missedProjectIds.has(j.id)):g,f=await Sr(w,e.projectRoot,e.onStatus,e.opts.indexerConcurrency,e.opts.signal),y=[];if(u){to(e.paths.outputDb,f,e.writeTelemetry);let j=x.typescript??e.tempPaths.tempOutputScip;y=no({outputDb:e.paths.outputDb,tempOutputScip:e.tempPaths.tempOutputScip,outputScipPath:j,reusedProjects:u.reusedProjects,writeTelemetry:e.writeTelemetry})}let P=[...f,...y],{indexedOutputs:v}=fo(P,m),R=c?[{language:"typescript",scipPath:c.scipPath}]:[],S=[...r,...R,...v];mo(S,m,e.languages,e.opts.allowPartial,e.onStatus);let B=c?[{id:"typescript",language:"typescript",label:"typescript (incremental documents)",scipPath:c.scipPath,outputScipPath:c.scipPath,durationMs:c.durationMs,command:"watch-service:typescript-index",outputBytes:re(c.scipPath)??void 0}]:[],G=ao(n,[...f,...B],u?{outputDb:e.paths.outputDb,classification:u.classification}:void 0);return{indexedOutputs:S,skippedLanguages:m,reusedLanguages:[...a],languageFingerprints:io(n,e.languages),shards:G,typescriptProjectShardContext:u?{projects:u.allProjects,fingerprints:u.fingerprints}:void 0,incrementalTypeScript:c??void 0}}function Zi(e,t){let n=t.get("typescript");if(!n||n.reused||e.opts.typescriptProjectMode!=="workspace")return;let r=J(e.projectRoot,e.opts.typescriptProjects);if(r.length===0)return;let a=sr(e.projectRoot,r),i=ar(n.fingerprint.files,r),o=ir(r,a),s=or(r,i,o),d=V(e.paths.metaPath),c=eo(d,s,m=>_(ke(e.paths.outputDb,m))),p=[...c.entries()].filter(([,m])=>m.reused).map(([m])=>m),u=new Set(p),g=new Set(r.filter(m=>!u.has(m)).map(m=>`typescript:${m}`));return{allProjects:r,fingerprints:s,classification:c,reusedProjects:p,missedProjectIds:g}}function eo(e,t,n){let r=new Map;for(let a of Object.keys(t)){let i=t[a];if(!e){r.set(a,{reused:!1,reason:"no reindex metadata found",fingerprint:i});continue}let o=e.version===K&&Le(e).typescriptProjectShardReuse?e.typescriptProjectShards?.[a]:void 0;if(!o){r.set(a,{reused:!1,reason:"no cached fingerprint for this project",fingerprint:i});continue}if(!n(a)){r.set(a,{reused:!1,reason:"cached shard file missing on disk",fingerprint:i});continue}if(k(o)!==k(i)){r.set(a,{reused:!1,reason:"project inputs changed since last index",fingerprint:i});continue}r.set(a,{reused:!0,fingerprint:i})}return r}function to(e,t,n){for(let r of t){if(r.skipped||!r.id.startsWith("typescript:"))continue;let a=r.id.slice(11),i=ke(e,a);Te(h(i),{recursive:!0}),$(n,C(r.scipPath,i))}}function no(e){return e.reusedProjects.map((t,n)=>{let r=ke(e.outputDb,t),a=ae(e.tempOutputScip,"typescript-project-cached",n);return $(e.writeTelemetry,C(r,a)),{id:`typescript:${t}`,language:"typescript",label:`typescript (${t})`,scipPath:a,outputScipPath:e.outputScipPath,durationMs:0,command:"cached",outputBytes:re(a)??void 0}})}function ro(e){let t=V(e.paths.metaPath),n=Gr(e.projectRoot,e.languages,e),r=new Map;for(let a of e.languages){let i=yt(e.paths.outputDb,a),o=n[a];if(!t){r.set(a,{reused:!1,reason:"no reindex metadata found",fingerprint:o,scipPath:i});continue}if(t.version!==K){r.set(a,{reused:!1,reason:`metadata version ${String(t.version??"unknown")} predates per-language shard caching`,fingerprint:o,scipPath:i});continue}if(a==="typescript"&&t.scipCompanion==="deferred"){r.set(a,{reused:!1,reason:"whole TypeScript SCIP companion is deferred behind changed-document overlays",fingerprint:o,scipPath:i});continue}if(!Le(t).languageShardReuse||!t.languageFingerprints){r.set(a,{reused:!1,reason:"no per-language fingerprints recorded in metadata",fingerprint:o,scipPath:i});continue}let s=t.languageFingerprints[a];if(!s){r.set(a,{reused:!1,reason:"no cached fingerprint for this language",fingerprint:o,scipPath:i});continue}if(!_(i)){r.set(a,{reused:!1,reason:"cached shard file missing on disk",fingerprint:o,scipPath:i});continue}if(k(s)!==k(o)){r.set(a,{reused:!1,reason:"language inputs changed since last index",fingerprint:o,scipPath:i});continue}r.set(a,{reused:!0,fingerprint:o,scipPath:i})}return r}function ao(e,t,n){let r=[];for(let[a,i]of e)i.reused&&r.push({id:a,language:a,reused:!0,fingerprint:ne(i.fingerprint),outputBytes:re(i.scipPath),durationMs:0});for(let a of t){let i=e.get(a.language),o=n&&a.id.startsWith("typescript:")?a.id.slice(11):null,s=o?n.classification.get(o):void 0;r.push({id:a.id,language:a.language,reused:!1,missReason:s?.reason??i?.reason??a.skipped?.reason,fingerprint:s?ne(s.fingerprint):i?ne(i.fingerprint):"unknown",outputBytes:a.outputBytes??null,durationMs:a.durationMs,command:a.command})}if(n)for(let[a,i]of n.classification)i.reused&&r.push({id:`typescript:${a}`,language:"typescript",reused:!0,fingerprint:ne(i.fingerprint),outputBytes:re(ke(n.outputDb,a)),durationMs:0});return r}function ne(e){return Ci("sha256").update(k(e)).digest("hex").slice(0,16)}function re(e){try{return Bi(e).size}catch{return null}}function io(e,t){let n={};for(let r of t){let a=e.get(r);a&&(n[r]=a.fingerprint)}return n}async function oo(e,t,n,r,a,i,o,s){T(e.opts.signal,"Reindex cancelled by its owner.");let d=!s||s.completeScipUpdated,l=!1;d&&(Ir(e.paths.outputDb,n,e.writeTelemetry),l=Er(n,e.tempPaths.tempOutputScip,e.onStatus));let c=await ho({run:e,env:t,indexedOutputs:n,skippedLanguages:r,reusedLanguages:a,incrementalTypeScript:s,completeScipAvailable:d,completeScipSanitized:l,materializeFullFallback:async()=>{if(T(e.opts.signal,"Reindex cancelled by its owner."),!s||s.completeScipUpdated)return l;e.onStatus("Materializing the deferred whole TypeScript SCIP companion for full conversion..."),hr({cacheDir:h(e.paths.outputDb),generationIdentity:s.nextFragmentGeneration,baseShardPath:s.scipPath,candidateShardPath:s.candidateScipPath});let v=n.map(R=>R.language==="typescript"?{language:R.language,scipPath:s.candidateScipPath}:R);return Ir(e.paths.outputDb,v,e.writeTelemetry),l=Er(v,e.tempPaths.tempOutputScip,e.onStatus),l}});T(e.opts.signal,"Reindex cancelled by its owner."),te(ee(),{projectRoot:e.projectRoot,dbPath:e.tempPaths.tempOutputDb,onStatus:e.onStatus}),mt(e.projectRoot,e.tempPaths.tempOutputDb,e.tempPaths.tempOutputScip,e.onStatus,!1,s?.affectedFiles);let p=et(e.tempPaths.tempOutputDb);if(p.added.length>0&&e.onStatus(`Added SQLite query indexes: ${p.added.join(", ")}`),p.removed.length>0&&e.onStatus(`Removed redundant SQLite indexes: ${p.removed.join(", ")}`),c.mode==="incremental"&&s){let v=null,R=null;try{v=new F({projectRoot:e.projectRoot,dbPath:e.tempPaths.tempOutputDb,indexPath:e.tempPaths.tempOutputScip}),R=new F({projectRoot:e.projectRoot,dbPath:e.paths.outputDb,indexPath:e.paths.outputScip});let S=zt(v,e.fingerprint,s.referenceFragmentsByFile,R);e.onStatus(`Cached exact TypeScript reference fragments for ${S} affected document(s).`)}catch(S){e.onStatus(`Exact TypeScript reference fragment prefill unavailable: ${S instanceof Error?S.message:String(S)}.`)}finally{v?.close(),R?.close()}}let u=ht(e.paths.metaPath),g=c.mode==="incremental"&&s?So(s,c.changedDocumentPaths):Xe({projectRoot:e.projectRoot,previousDbPath:e.paths.outputDb,previousIndexPath:e.paths.outputScip,candidateDbPath:e.tempPaths.tempOutputDb,candidateIndexPath:e.tempPaths.tempOutputScip,previousSnapshot:u,currentSnapshot:e.fingerprint,refreshResult:"rebuilt"}),m=De({trigger:e.opts.trigger,result:"rebuilt",start:e.start,monotonicStart:e.monotonicStart,languages:n.map(v=>v.language),skipped:[...r]}),x=c.mode==="incremental"&&c.scipCompanion==="deferred",w={...i};x&&delete w.typescript;let{metadata:f,pruneProjects:y}=Or({run:e,indexedOutputs:n,skippedLanguages:r,reusedLanguages:a,languageFingerprints:w,typescriptProjectShardContext:o,lastRefresh:m});f.scipCompanion=x?"deferred":"current",Ar(e.paths.outputDb,y),St(e.tempPaths.tempMetaPath,f);let P=fn({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:c.mode==="incremental"&&c.scipCompanion==="deferred",publication:c.mode==="incremental"?{mode:"incremental",validation:"passed",converterDurationMs:c.converterDurationMs,affectedDocumentCount:s?.affectedFiles.length,changedDocumentCount:c.changedDocumentPaths.length,producerDurationMs:s?.timings.serviceMs,materializationDurationMs:s?.durationMs,patchDurationMs:c.patchDurationMs,scipCompanion:c.scipCompanion,...c.scipCompanion==="deferred"&&s?{typescriptOverlayGeneration:s.nextFragmentGeneration}:{}}:{mode:"full",validation:"passed",converterDurationMs:c.converterDurationMs,scipCompanion:"current",...c.fallbackReason?{fallbackReason:c.fallbackReason}:{}}});return P.achievedDurability==="file-flushed"&&e.onStatus(`Published local generation ${P.currentGeneration.slice(0,12)} (file-flushed; directory sync unsupported)`),gn(h(e.paths.outputDb),c.mode==="incremental"&&c.scipCompanion==="deferred"?[s.nextFragmentGeneration]:[]),dn(h(e.paths.outputDb),s?.completeScipUpdated?[s.nextFragmentGeneration]:[]),Dr(e.paths.outputDb,g,e.onStatus),m}function so(e,t,n,r,a,i){let o=ht(e.paths.metaPath),s=null;try{$(e.writeTelemetry,C(e.paths.outputDb,e.tempPaths.tempOutputDb))}catch(u){s=Cn("reused","oracle-error",`Could not snapshot the prior database: ${u instanceof Error?u.message:String(u)}`)}te(ee(),{projectRoot:e.projectRoot,dbPath:e.paths.outputDb,onStatus:e.onStatus}),mt(e.projectRoot,e.paths.outputDb,e.paths.outputScip,e.onStatus,!0);let d=et(e.paths.outputDb);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(", ")}`),s??=Xe({projectRoot:e.projectRoot,previousDbPath:e.tempPaths.tempOutputDb,previousIndexPath:e.paths.outputScip,candidateDbPath:e.paths.outputDb,candidateIndexPath:e.paths.outputScip,previousSnapshot:o,currentSnapshot:e.fingerprint,refreshResult:"reused"});let l=De({trigger:e.opts.trigger,result:"reused",start:e.start,monotonicStart:e.monotonicStart,languages:t.map(u=>u.language),skipped:[...n]}),{metadata:c,pruneProjects:p}=Or({run:e,indexedOutputs:t,skippedLanguages:n,reusedLanguages:r,languageFingerprints:a,typescriptProjectShardContext:i,lastRefresh:l});return Ar(e.paths.outputDb,p),St(e.paths.metaPath,c),We(e.paths.outputDb,e.paths.metaPath),Dr(e.paths.outputDb,s,e.onStatus),l}function ht(e){return wt(V(e)?.fingerprint)}function Dr(e,t,n){try{Bn(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 Or(e){let t=co({mode:e.run.opts.typescriptProjectMode,skippedLanguages:e.skippedLanguages,reusedLanguages:e.reusedLanguages,context:e.typescriptProjectShardContext,metaPath:e.run.paths.metaPath});return{metadata:{version:K,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 co(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=V(e.metaPath),n=t?.version===K?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 Ar(e,t){let n=Ur(e);if(t===null){W(()=>Q(n,{recursive:!0,force:!0}));return}let r;try{r=Fr(n)}catch{return}for(let a of lo(r,t))W(()=>Q(E(n,a),{force:!0}))}function lo(e,t){let n=new Set(t.map(r=>`${at(r)}.scip`));return e.filter(r=>!n.has(r))}function Ir(e,t,n){for(let r of t){let a=yt(e,r.language);Te(h(a),{recursive:!0}),r.scipPath!==a&&$(n,C(r.scipPath,a))}}async function uo(e,t){if(!Ce()){if(Ui()==="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.
|
|
232
|
-
To install the reviewed version, run: codebaseiq reindex --install-missing
|
|
233
|
-
Or install manually from: https://github.com/sourcegraph/scip/releases`);if(t("scip CLI not found on PATH. Attempting auto-install..."),!Ft(t))throw new Error(`The scip CLI is required but could not be installed.
|
|
234
|
-
Install manually from: https://github.com/sourcegraph/scip/releases`)}}function po(e){let t=[],n=[],r=e.languages.map((i,o)=>({language:i,scipPath:e.languages.length>1?ae(e.tempOutputScip,i,o):e.tempOutputScip})),a=Object.fromEntries(r.map(({language:i,scipPath:o})=>[i,o]));for(let{language:i,scipPath:o}of r){let s=go({...e,language:i,scipPath:o});for(let d of s)"skipped"in d?Lr(n,d.skipped):t.push(d.prepared)}return{preparedRuns:t,skippedLanguages:n,languageOutputScipPaths:a}}function go(e){if(e.language!=="typescript"||e.typescriptProjectMode!=="workspace")return[gt({...e,id:e.language,label:e.language,outputScipPath:e.scipPath})];let t=e.preDiscoveredTypeScriptProjects??J(e.projectRoot,e.typescriptProjects);return t.length===0?[gt({...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)=>gt({...e,id:`typescript:${n}`,label:`typescript (${n})`,scipPath:ae(e.tempOutputScip,"typescript-project",r),outputScipPath:e.scipPath,pnpmWorkspaces:!1,projectPath:n})))}function gt(e){let t=Ye(e.language),n=pe(t),r=Bt(t,e.projectRoot),a=e.trustProjectTools&&r?Gt(t,e.projectRoot):null,i=Z(t);if(!a&&!i&&r){let c=`${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}: ${c}`),{skipped:{language:e.language,reason:c}}}if(!a&&!i&&!$t(t)){if(e.skipAutoInstall){let c=`${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}: ${c}`),{skipped:{language:e.language,reason:c}}}if(e.onStatus(`${n} not found. Attempting auto-install...`),!xr(t,e.onStatus)){let c=`${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}: ${c}`),{skipped:{language:e.language,reason:c}}}}let o=a?.canonicalPath??Z(t);if(!o){let c=`${n} was not found after installation checks.`;return e.onStatus(`Skipping ${e.language}: ${c}`),{skipped:{language:e.language,reason:c}}}let{binary:s,args:d}=t.indexArgs({projectRoot:e.projectRoot,outputPath:e.scipPath,pnpmWorkspaces:e.pnpmWorkspaces,indexerBinary:o,projectPath:e.projectPath,configPath:e.language==="clojure"?e.clojureConfigPath:void 0}),l=zn({language:e.language,projectPath:e.projectPath,pnpmWorkspaces:e.pnpmWorkspaces});if(a&&!a.executable){let c=`${a.relativePath} is not executable; refusing project-local indexer.`;return e.onStatus(`Skipping ${e.language}: ${c}`),{skipped:{language:e.language,reason:c}}}return a&&e.onStatus(`Trusted project-local ${e.language} indexer ${a.relativePath} (${a.sha256.slice(0,12)}\u2026, ${a.canonicalPath}).`),{prepared:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,config:t,resolvedBinary:o,binary:s,args:d,env:Wt(t,e.env,o),...l===void 0?{}:{temporaryRootConfigContent:l},...a?{trustedProjectTool:a}:{}}}}function fo(e,t){let n=new Map;for(let a of e)if(a.skipped)Lr(t,a.skipped);else{let i=`${a.language}\0${a.outputScipPath}`,o=n.get(i)??{language:a.language,outputScipPath:a.outputScipPath,scipPaths:[]};o.scipPaths.push(a.scipPath),n.set(i,o)}let r=[];for(let a of n.values())if(a.scipPaths.length>1)tn(a.scipPaths,a.outputScipPath),r.push({language:a.language,scipPath:a.outputScipPath});else{let i=a.scipPaths[0];i!==a.outputScipPath&&kr(i,a.outputScipPath),r.push({language:a.language,scipPath:a.outputScipPath})}return{indexedOutputs:r}}function Lr(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 mo(e,t,n,r,a){if(e.length===0){let i=t.map(o=>` - ${o.language}: ${o.reason}`).join(`
|
|
235
|
-
`);throw new Error(`No language indexers ran successfully. Install at least one indexer for the languages in this project.
|
|
236
|
-
`+i)}if(t.length!==0&&(a(`Indexed ${e.length} language output(s); skipped or incomplete: ${t.map(i=>i.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.
|
|
237
|
-
`+t.map(i=>` - ${i.language}: ${i.reason}`).join(`
|
|
238
|
-
`))}function Er(e,t,n){if(e.length>1){n(`Merging ${e.length} language indexes...`);let r=performance.now(),a=nn(e.map(i=>i.scipPath),t);return Nr(a,n),n(`Merged and sanitized SCIP indexes in ${(performance.now()-r).toFixed(0)}ms.`),!0}else e[0].scipPath!==t&&kr(e[0].scipPath,t);return!1}async function ho(e){let t;if(yo(e)){let a=E(e.run.tempPaths.runDir,"typescript-affected.db");try{Mr(e.incrementalTypeScript.affectedScipPath,e.run.onStatus),e.run.onStatus(`Converting ${e.incrementalTypeScript.affectedFiles.length} affected TypeScript document(s) to SQLite...`);let i=performance.now();await wr(e.incrementalTypeScript.affectedScipPath,a,e.env,e.run.onStatus,!1,e.run.opts.signal),e.run.onStatus(`Converted affected SCIP documents in ${(performance.now()-i).toFixed(0)}ms.`);let o=Zn({previousDbPath:e.run.paths.outputDb,miniDbPath:a,candidateDbPath:e.run.tempPaths.tempOutputDb,affectedFiles:e.incrementalTypeScript.affectedFiles,writeTelemetry:e.run.writeTelemetry});return e.run.onStatus(`Patched ${o.affectedDocumentCount} SQLite document(s) in ${(o.durationMs/1e3).toFixed(3)}s.`),{mode:"incremental",changedDocumentPaths:o.changedDocumentPaths,patchDurationMs:o.durationMs,converterDurationMs:performance.now()-i,scipCompanion:e.incrementalTypeScript.completeScipUpdated?"current":"deferred"}}catch(i){T(e.run.opts.signal,"Reindex cancelled by its owner."),t=i instanceof Error?i.message:String(i),W(()=>Q(a,{force:!0})),W(()=>Q(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 wr(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 yo(e){if(!e.incrementalTypeScript||e.skippedLanguages.length>0||!_(e.run.paths.outputDb)||!_(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 So(e,t){let n=b(),r=[...t].sort(),a=new Set(r),i={addedFiles:[],modifiedFiles:r,deletedFiles:[],changedFiles:r,unchangedFiles:e.affectedFiles.filter(o=>!a.has(o)).sort()};return{version:1,status:"evaluated",refreshResult:"rebuilt",recordedAt:new Date().toISOString(),durationMs:b()-n,manifest:e.manifest,plan:e.plan,comparison:i,evaluation:Ve(e.plan,i,e.projectFileCount)}}async function wr(e,t,n,r,a=!1,i){if(T(i,"Reindex cancelled by its owner."),r("Converting to SQLite..."),!_(e))throw new Error(`SCIP index not found at ${e} after indexing`);try{a||Mr(e,r);let o=Ce();if(!o)throw new Error("scip CLI is not available");let s=await se({command:o,args:["expt-convert","--output",t,e],label:"SCIP SQLite conversion",env:n,maxStdoutBytes:50*1024*1024,maxStderrBytes:50*1024*1024,timeoutMs:3e5,signal:i});if(s.status!==0)throw new Error(`scip expt-convert exited with ${s.status}${s.stderr.trim()?`: ${s.stderr.trim()}`:""}`)}catch(o){T(i,"Reindex cancelled by its owner.");let s=o instanceof Error?o.message:String(o);throw new Error(`Failed to convert SCIP index to SQLite: ${s}`,{cause:o})}}function Mr(e,t){let n=en(e);Nr(n,t)}function Nr(e,t){e.removedDefinitionOccurrences!==0&&t(`Sanitized ${e.removedDefinitionOccurrences} invalid definition occurrences across ${e.touchedDocuments} documents before SQLite conversion.`)}function ae(e,t,n){let r=Gi(e)||".scip",a=je(e,r);return E(h(e),`${a}.${n+1}.${t}${r}`)}async function bo(e,t){for(let n=0;n<2;n++){let r=Po(e,t);if(r)return r;let a=xo(e);if(a&&Br(t.trigger,a)){t.onStatus(`Manual reindex preempting watcher refresh started at ${a.startedAt}.`);let i;try{i=await vo(a)}catch(s){throw new Error(`Could not verify the watcher's in-progress reindex owner (pid ${a.pid}); refusing to steal an active lock: ${A(s)}`,{cause:s})}if(!i)throw new Error(`Could not confirm the watcher's in-progress reindex (pid ${a.pid}) terminated for ${h(e)}; refusing to steal an active lock.`);let o=$e(e,{parseLegacy:Fe});if(!At(e,o,{parseLegacy:Fe}))throw new Error(`Reindex lock ownership changed before preemption completed for ${h(e)}.`);continue}throw new Error(`Another codebaseiq reindex is already running for ${h(e)}.`)}throw new Error(`Could not acquire codebaseiq reindex lock for ${h(e)}.`)}function Po(e,t){let n=U(process.pid),r=Ot(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:Fe});if(r.kind==="acquired"&&r.reclaimed){let a=Cr(r.reclaimed,e);a&&Br(t.trigger,a)?t.onStatus(`Manual reindex preempting watcher refresh started at ${a.startedAt}; its prior owner was already stale.`):t.onStatus(`Recovered an abandoned or incomplete reindex lock for ${h(e)}.`)}return r.kind==="acquired"?()=>{r.lock.release()}:null}function xo(e){return Cr($e(e,{parseLegacy:Fe}),e)}var Fe=e=>{let t=$r(e,"");return t?{pid:t.pid,...t.processIdentity?{processIdentity:t.processIdentity}:{}}:null};function Cr(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:h(t),startedAt:e.record.startedAt,trigger:n.trigger}}return $r(e.parsed,t)}function $r(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=Rt(n.processIdentity);return r?.pid===n.pid?{processIdentity:r}:{}})(),...n.processGroupLeader===!0?{processGroupLeader:!0}:{},projectRoot:typeof n.projectRoot=="string"?n.projectRoot:h(t),startedAt:typeof n.startedAt=="string"?n.startedAt:"unknown",trigger:n.trigger}}catch{return null}}function Br(e,t){return e?.kind==="manual-cli"&&Ro(t?.trigger)}function Ro(e){return e?.kind==="watch-source"||e?.kind==="watch-git-head"||e?.kind==="watch-git-index"||e?.kind==="watch-git-state"}async function vo(e){return!H(e.pid)||(ft(e),_r(e,"SIGTERM"),await jr(e,2e3))?!0:(ft(e),_r(e,"SIGKILL"),jr(e,1e3))}function _r(e,t){if(e.processGroupLeader)try{process.kill(-e.pid,t);return}catch{if(!H(e.pid))return;ft(e)}try{process.kill(e.pid,t)}catch{}}async function jr(e,t){let n=b()+t;for(;b()<n;){if(Tr(e))return!0;await Io(50)}return Tr(e)}function ft(e){if(!e.processIdentity)throw new Error(`Refusing to signal reindex pid ${e.pid}: its ownership record has no process identity.`);let t=U(e.pid);if(!t)throw new Error(`Refusing to signal reindex pid ${e.pid}: its process identity is unavailable.`);if(!Y(e.processIdentity,t))throw new Error(`Refusing to signal reindex pid ${e.pid}: its process identity does not match the ownership record.`)}function Tr(e){if(!H(e.pid))return!0;if(!e.processIdentity)return!1;let t=U(e.pid);return t!==null&&!Y(e.processIdentity,t)}function Io(e){return new Promise(t=>setTimeout(t,e))}function Gr(e,t,n){return Object.fromEntries(t.map(r=>{let a=r==="typescript"?Mt(n.typescriptProjects):[],i=r==="clojure"?Eo(n.clojureConfigPath):void 0,o=[...Ye(r).markerFiles,...a,...i?[i]:[]],s=r==="typescript"?{typescriptProjectMode:n.typescriptProjectMode??"single",typescriptProjects:a}:{typescriptProjectMode:"single",typescriptProjects:[]};return[r,{version:2,languages:[r],pnpmWorkspaces:r==="typescript"&&wo(n),...s,clojureConfigPath:i,files:Nt(e,{language:r,markerFiles:o})}]}))}function Eo(e){return e?.trim()||void 0}function wo(e){return e.typescriptProjectMode!=="workspace"&&e.pnpmWorkspaces===!0}function yt(e,t){return E(h(e),"language-indexes",`${t}.scip`)}function Ur(e){return E(h(e),"language-indexes","typescript-projects")}function ke(e,t){return E(Ur(e),`${at(t)}.scip`)}function V(e){try{return Ae(de(oe(e,"reindex metadata")))}catch{return null}}function Wr(e,t){try{let n=de(oe(e,"reindex metadata"));if(n.kind!=="legacy"&&n.kind!=="supported")return!1;let r=n.metadata;return n.capabilities.publishableGeneration&&_t(r)&&k(r.fingerprint)===k(t)&&k([...r.indexedLanguages??[]].sort())===k(t.languages)}catch{return!1}}function St(e,t){Ht(e,t,{spacing:2,trailingNewline:!0})}function qr(e,t){try{let n=Ae(de(oe(e,"reindex metadata")));if(!n)return;St(e,{...n,lastRefresh:t})}catch{}}function De(e){return{trigger:e.trigger??{kind:"unknown"},result:e.result,startedAt:new Date(e.start).toISOString(),completedAt:new Date().toISOString(),durationMs:b()-e.monotonicStart,indexedLanguages:e.languages?[...e.languages]:void 0,skipped:e.skipped?[...e.skipped]:void 0,error:e.error}}function k(e){return JSON.stringify(e)}export{Vo as a,Xo as b,Ye as c,xr as d,dd as e};
|
|
239
|
-
//# sourceMappingURL=chunk-TFZB6XTM.js.map
|
package/dist/chunk-UXM43C7T.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{e as s,f as v,lb as E,qb as V,rb as I}from"./chunk-ECQBG7PW.js";import{c as y}from"./chunk-XZEE23VG.js";import{E as h,N as S,d as w}from"./chunk-G6XFR4ZL.js";import{l as x}from"./chunk-2X7V4HS4.js";var ce={defaultRole:"repository-observation"};function pe(e,n=[]){return{defaultRole:e,...n.length>0?{rules:n}:{}}}function k(e,n){for(let t of e.rules??[]){if(t.when.kind==="option-present"){let r=n.options[t.when.name];if(r!==void 0&&r!==!1)return t.role;continue}if((t.when.kind==="argument"?n.args[t.when.index]:n.options[t.when.name])===t.when.equals)return t.role}return e.defaultRole}function fe(e){return[...new Set([e.defaultRole,...(e.rules??[]).map(n=>n.role)])]}function A(e){return e==="repository-observation"||e==="repository-preview"||e==="composite"}import{AsyncLocalStorage as z}from"async_hooks";var U=1,j=1;var F={policyId:"codebaseiq:unresolved-repository-policy",policyVersion:j,permission:"not-established",reasons:["No repository action policy was supplied for this claim."]};function N(e){return{schemaVersion:U,origin:e.contract.origin,coverage:$(e.coverage),producerValidation:e.contract.producerValidation,stateAuthority:w(e.receipt,e.receipt),repositoryPolicy:e.repositoryPolicy??F,...e.contract.families?{families:e.contract.families}:{}}}function $(e){return e?e.complete===!0?{state:"complete",returned:e.returned,totalKnown:!0,total:e.total??e.returned,omitted:0}:e.totalKnown?{state:"partial",returned:e.returned,totalKnown:!0,...e.total===void 0?{}:{total:e.total},...e.omitted===void 0?{}:{omitted:e.omitted}}:{state:"unknown",returned:e.returned,totalKnown:!1}:{state:"unknown",returned:0,totalKnown:!1}}var W="codebaseiq-result";var G=1,Y=1,_=1,L=1;function M(e){let n=e.resultSchemaVersion??Y;if(!X(n))throw new Error("CLI result schema version must be a positive safe integer.");let{producerVersion:t,...o}=e;return{kind:W,schemaVersion:G,producer:{name:"codebaseiq",version:t},resultSchemaVersion:n,...o}}function J(e,n){return JSON.stringify(e,null,n?0:2)}function X(e){return Number.isSafeInteger(e)&&Number(e)>0}var P=Symbol("option-value-source"),T=new Map,D=new Map,B=new Map,H=new z;function Ie(e,n){return H.run(e,n)}function ke(e){T=new Map(e)}function Ae(e){D=new Map(e)}function Ne(e){B=new Map(e)}function m(e){return(...n)=>{let{args:t,opts:o}=le(n);S(r=>{v(r.generation.identity),e({db:r,args:t,opts:o})})}}function R(e,n){return m(t=>{let o=I(t.db,e,d(t.opts,"full"),{quiet:d(t.opts,"json")});n({...t,budget:o})})}function _e(e){return m(n=>c(n,e,{kind:"list"}))}function Le(e){return m(n=>c(n,e,{kind:"table",headers:e.headers,dashWidths:e.dashWidths}))}function Me(e){return m(n=>c(n,e,{kind:"grouped",key:e.key}))}function Z(e){return m(n=>b(n,e))}function Je(e){return Z({commandName:e.commandName,query:e.query,emptyMessage:e.emptyMessage,heuristicLabel:e.heuristicLabel,before:e.before,render:(n,t)=>s.sectionedReport(e.sections(n,t)),toJson:e.toJson,coverage:e.coverage,agentResult:e.agentResult,after:e.after})}function ee(e,n){return R(e,t=>b(t,{...n,commandName:n.commandName??e}))}function Pe(e,n){return ee(e,{commandName:n.commandName??e,query:n.query,emptyMessage:n.emptyMessage,heuristicLabel:n.heuristicLabel,before:n.before,render:(t,o)=>s.sectionedReport(n.sections(t,o)),toJson:n.toJson,coverage:n.coverage,agentResult:n.agentResult,after:n.after})}function Te(e,n){return R(e,t=>c(t,{...n,commandName:e},{kind:"list"}))}function De(e,n){return R(e,t=>c(t,{...n,commandName:e},{kind:"grouped",key:n.key}))}function Be(e,n){return String(e[n])}function He(e,n){let t=e[n];return typeof t=="string"?[t]:Array.isArray(t)&&t.every(o=>typeof o=="string")?t:[]}function Qe(e,n){let t=e[n];return typeof t=="string"?t:void 0}function qe(e,n){let t=e[n];return typeof t=="string"?t:void 0}function Q(e,n){let t=e[n];return typeof t=="number"?t:void 0}function d(e,n){return!!e[n]}function Ke(e,n){let t=e[n];return Array.isArray(t)&&t.every(o=>typeof o=="string")?t:[]}function Ue(e,n,t){return Q(e,n)??t}function je(e,n,t){let o=Q(e,n),r=o!==void 0&&ne(e,n)!=="default";if(d(e,"full")){if(r)throw new Error("--full cannot be combined with --limit. Use --full for all findings, or --limit N for a capped report.");return Number.MAX_SAFE_INTEGER}return o??t}function ne(e,n){return e[P]?.(n)}function c(e,n,t){b(e,{commandName:n.commandName,query:n.query,emptyMessage:(o,r)=>o.length===0&&n.emptyMessage?n.emptyMessage(r):void 0,heuristicLabel:n.heuristicLabel,render:(o,r)=>{t.kind==="list"?s.list(o,i=>n.format(i,r)):t.kind==="table"?s.table(t.headers,o.map(i=>n.format(i,r)),t.dashWidths):s.groupedByFile(o,i=>n.format(i,r),t.key?i=>t.key(i,r):void 0)},toJson:n.toJson,coverage:n.coverage,agentResult:n.agentResult,before:n.before,after:n.after})}function b(e,n){let t=n.query(e);if(d(e.opts,"json")){if(!n.commandName)throw new Error("JSON output requires a command name so its result contract can be identified.");oe(n.commandName,e.args,e.opts,n.toJson?n.toJson(t,e):t,{analysisBudget:te(e),coverage:n.coverage?.(t,e),agentResult:n.agentResult?.(t,e),resultSchemaVersion:n.resultSchemaVersion});return}let o=n.emptyMessage?.(t,e);if(o){s.empty(o);return}n.heuristicLabel&&V(n.heuristicLabel),n.before?.(t,e),n.render(t,e),n.after?.(t,e)}function te(e){return e.budget?.analysisBudget}function oe(e,n,t,o,r={}){let i=T.get(e),a=D.get(e),u=B.get(e),p=a?k(a.operation,{args:n,options:t}):void 0,f=H.getStore();if(f!==void 0&&p!==void 0&&f!==p)throw new Error(`Command ${e} changed operation role during execution: selected ${f}, rendered ${p}.`);let g=f??p,O=de(o),C=r.coverage??ae(a,o,r.analysisBudget),l=C&&O&&!C.resolution?{...C,resolution:O}:C;if(l&&ie(l),d(t,"resultOnly")){let K=Object.hasOwn(r,"resultOnly")?r.resultOnly:o;y(JSON.stringify(K,null,d(t,"compact")?0:2));return}let q=M({producerVersion:x,command:e,...g?{operationRole:g}:{},...i?{evidence:i}:{},...r.analysisBudget?{analysisBudget:r.analysisBudget}:{},args:ue(n),options:t,result:o,...l?{coverage:l}:{},...r.agentResult!==void 0?{agentResult:r.agentResult}:{},...re(g,i,r.analysisBudget,l,u,r.observationReceipt),...r.resultSchemaVersion===void 0?{}:{resultSchemaVersion:r.resultSchemaVersion}});y(J(q,d(t,"compact")))}function re(e,n,t,o,r,i){if(!e||!A(e))return{};let a=h(),u=i??(a?E({projectRoot:a.config.projectRoot,db:a,...r?{observedSourceKinds:r.observedSources}:{}}):void 0);return u?{evidenceContext:{schemaVersion:_,operationRole:e,receipt:u,analysisManifest:{schemaVersion:L,...n?{evidence:n}:{},...t?{analysisBudget:t}:{},...o?{coverage:o}:{},...r?{claimQualification:N({contract:r,receipt:u,...o?{coverage:o}:{}})}:{}}}}:{}}function ie(e){if(!Number.isSafeInteger(e.returned)||e.returned<0)throw new Error("Invocation coverage returned count must be a non-negative safe integer.");if(e.complete!==!0&&e.complete!==!1&&e.complete!==null)throw new Error("Invocation coverage complete must be true, false, or null.");if(e.complete===!0){if(!e.totalKnown)throw new Error("Complete invocation coverage must know its total.");if(!Number.isSafeInteger(e.total)||e.total!==e.returned)throw new Error("Complete invocation coverage total must equal returned.");if(e.omitted!==0)throw new Error("Complete invocation coverage cannot omit results.");if(e.omittedIdentities!==void 0)throw new Error("Complete invocation coverage cannot name omitted identities.");if(e.continuation!==void 0)throw new Error("Complete invocation coverage cannot provide a continuation.")}else if(e.totalKnown){if(e.complete!==!1)throw new Error("Known incomplete invocation coverage must set complete to false.");if(!Number.isSafeInteger(e.total)||e.total<e.returned)throw new Error("Known invocation coverage total must be a safe integer at least as large as returned.");let n=e.total-e.returned;if(e.omitted!==n)throw new Error("Known invocation coverage omitted count must equal total minus returned.");if(n===0)throw new Error("Known incomplete invocation coverage must omit at least one result.");if(e.omittedIdentities&&e.omittedIdentities.length!==n)throw new Error("Omitted identity count must equal the disclosed omitted count.")}else{if(e.total!==void 0||e.omitted!==void 0)throw new Error("Unknown invocation coverage cannot claim a total or omitted count.");if(e.omittedIdentities!==void 0)throw new Error("Unknown invocation coverage cannot claim omitted identities.")}if(e.continuation&&(e.continuation.cursor.length===0||e.continuation.indexGeneration.length===0))throw new Error("Invocation coverage continuation requires a cursor and index generation.");if(e.resolution){if(!Number.isSafeInteger(e.resolution.totalCandidates)||e.resolution.totalCandidates<0)throw new Error("Invocation resolution candidate count must be a non-negative safe integer.");if(e.resolution.state==="exact"&&e.resolution.totalCandidates!==1)throw new Error("Exact invocation resolution must name exactly one candidate.");if(e.resolution.state==="missing"&&e.resolution.totalCandidates!==0)throw new Error("Missing invocation resolution cannot name candidates.");if(e.resolution.state==="ambiguous"&&e.resolution.totalCandidates<2)throw new Error("Ambiguous invocation resolution must name at least two candidates.")}}function ae(e,n,t){if(!e)return;let o=se(e,n);return e.coverage==="complete"?{complete:!0,totalKnown:!0,returned:o,total:o,omitted:0}:e.coverage==="sampled"?{complete:!1,totalKnown:!1,returned:o}:e.coverage==="bounded"&&t?{complete:!1,totalKnown:!1,returned:o}:{complete:null,totalKnown:!1,returned:o}}function se(e,n){let t=e.resultUnits??{kind:"report"};if(t.kind==="rows")return Array.isArray(n)?n.length:0;if(t.kind==="field"){if(!n||typeof n!="object")return 0;let o=n[t.field];return Array.isArray(o)?o.length:o==null?0:1}return n==null?0:1}function de(e){if(!e||typeof e!="object"||Array.isArray(e))return;let n=e;if(n.matched===!1)return{state:"missing",totalCandidates:0};if(n.matched!==!0||!Number.isSafeInteger(n.totalMatches))return;let t=n.totalMatches;return t<=0?{state:"missing",totalCandidates:0}:t===1?{state:"exact",totalCandidates:t}:{state:"ambiguous",totalCandidates:t}}function ue(e){return e.filter(n=>typeof n=="string"||typeof n=="number"||typeof n=="boolean")}function le(e){if(e.length===0)return{args:[],opts:{}};let n=e[e.length-1];return{args:e.slice(0,-1),opts:me(n)}}function me(e){if(!e||typeof e!="object")return{};let n=e,t=typeof n.optsWithGlobals=="function"?n.optsWithGlobals.bind(n):typeof n.opts=="function"?n.opts.bind(n):null;if(t){let o=t();return!o||typeof o!="object"?{}:(typeof n.getOptionValueSource=="function"&&Object.defineProperty(o,P,{value:r=>n.getOptionValueSource(r),enumerable:!1}),o)}return e}export{ce as a,pe as b,k as c,fe as d,Ie as e,ke as f,Ae as g,Ne as h,m as i,R as j,_e as k,Le as l,Me as m,Z as n,Je as o,ee as p,Pe as q,Te as r,De as s,Be as t,He as u,Qe as v,qe as w,Q as x,d as y,Ke as z,Ue as A,je as B,ne as C,oe as D,le as E,me as F};
|
|
3
|
-
//# sourceMappingURL=chunk-UXM43C7T.js.map
|
package/dist/chunk-VFY6Y2H6.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import{g as D,h as M}from"./chunk-3IER7Q6H.js";import{e as _}from"./chunk-FM5BPL4V.js";import{a as V,b as I,ba as A,fa as N,g as S}from"./chunk-WE5RZHZ7.js";import Re from"better-sqlite3";import{existsSync as wn}from"fs";import{dirname as En,join as Tn,resolve as he}from"path";import Ve from"better-sqlite3";import{execFileSync as xe}from"child_process";import{existsSync as ve,readdirSync as Ie}from"fs";import{extname as x,join as we}from"path";function j(e={}){return{id:"auxiliary-documents",facts:["auxiliary-document"],run:n=>Ee({projectRoot:n.projectRoot,dbPath:n.dbPath,extensions:e.extensions,onStatus:n.onStatus})}}function Ee(e){let n=new Set((e.extensions??D).map(i=>i.toLowerCase()));if(n.size===0)return{scanned:0,inserted:0,existing:0};if(!ve(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let t=_(e.projectRoot),r=Te(e.projectRoot,n).filter(i=>!t.isIgnored(i)),o=new Ve(e.dbPath);try{let i=Fe(o,r),s=o.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
|
|
2
|
-
VALUES (?, ?, NULL, ?)`),a=o.transaction(l=>{let f=0;for(let g of l){if(i.has(g))continue;let p=A(e.projectRoot,g,{inputKind:"auxiliary source file"}),m=s.run(Le(g),g,p);f+=Number(m.changes)}return f})(r),c={scanned:r.length,inserted:a,existing:r.length-a};return e.onStatus?.(`Augmented SQLite documents with ${a} auxiliary source file${a===1?"":"s"} (${c.existing} already present).`),c}finally{o.close()}}function Te(e,n){let t=Ce(e,n);if(t)return t;let r=[],o=i=>{let s=i?we(e,i):e,u;try{u=Ie(s,{withFileTypes:!0})}catch{return}for(let a of u){if(M.has(a.name))continue;let c=i?`${i}/${a.name}`:a.name;if(a.isDirectory()){o(c);continue}n.has(x(a.name).toLowerCase())&&r.push(c)}};return o(""),r.sort()}function Ce(e,n){try{return xe("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:3e4,killSignal:"SIGKILL"}).split(`
|
|
3
|
-
`).filter(r=>r&&n.has(x(r).toLowerCase())).sort()}catch{return null}}function Fe(e,n){let t=new Set,r=500;for(let o=0;o<n.length;o+=r){let i=n.slice(o,o+r),s=e.prepare(`SELECT relative_path FROM documents WHERE relative_path IN (${i.map(()=>"?").join(",")})`).all(...i);for(let u of s)t.add(u.relative_path)}return t}function Le(e){return x(e).toLowerCase()===".vue"?"vue":x(e).replace(/^\./,"").toLowerCase()||"source"}import{writeFileSync as Pe}from"fs";function W(e,n){let t=performance.now(),r=e.run(n);return{stageId:e.id,facts:e.facts,durationMs:performance.now()-t,result:r}}async function U(e){let n=e.readFingerprint(),t=Oe(e.cachePath,n);if(t)return e.onCacheHit?.(t.result),t.result;let r=await e.compute();return Ae(e.cachePath,e.readFingerprint(),r),r}function Oe(e,n){try{let t=JSON.parse(S(e,{maxBytes:V,inputKind:"post-index augmentation cache"}));return $(t.fingerprint)===$(n)?{result:t.result}:null}catch{return null}}function Ae(e,n,t){Pe(e,`${JSON.stringify({updatedAt:new Date().toISOString(),fingerprint:n,result:t},null,2)}
|
|
4
|
-
`)}function $(e){return JSON.stringify(e)}import{randomUUID as De}from"crypto";import{mkdtempSync as Me,rmSync as _e,statSync as H}from"fs";import{tmpdir as je}from"os";import{join as K}from"path";import{Worker as $e}from"worker_threads";function Ne(){return{"missing-source-file":0,"missing-service-script":0,"no-definition":0,"same-file-definition":0,"unindexed-definition":0}}function y(){return{skippedReferences:0,skippedReferenceReasons:Ne(),skippedReferenceSamples:[]}}function v(e,n){e.skippedReferences+=n.skippedReferences;for(let t of Object.keys(e.skippedReferenceReasons)){e.skippedReferenceReasons[t]+=n.skippedReferenceReasons[t];for(let r of n.skippedReferenceSamples.filter(o=>o.reason===t))e.skippedReferenceSamples.filter(i=>i.reason===t&&i.sourceFile===r.sourceFile).length<2&&e.skippedReferenceSamples.push(r)}}var We=3e5,G=64*1024*1024,Ue={createResultDirectory:()=>Me(K(je(),"codebaseiq-vue-workers-")),spawn:(e,n)=>new $e(e,{workerData:n}),resultSize:e=>H(e).size,readResult:e=>S(e,{maxBytes:G,inputKind:"Vue worker result"}),removeResultDirectory:e=>_e(e,{recursive:!0,force:!0})};function J(e){return e.length>=8&&X(e.length)>1}async function z(e,n=Ue){let t=X(e.vueFiles.length),r=nn(e.vueFiles),o=rn(r,t),i=new URL("./augment-vue-worker.js",import.meta.url),s=e.timeoutMs??Ze(),u=e.maxResultBytes??en();B("timeoutMs",s),B("maxResultBytes",u);let a=De(),c=n.createResultDirectory(),l=[],f,g,p;try{for(let d=0;d<o.length;d++){let b=d,F=o[d]??[],L=F.map(ke=>ke.taskId),P=K(c,`${b}.json`),O=n.spawn(i,{projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,tasks:F,resultPath:P,runId:a,workerId:b,taskIds:L});l.push({workerId:b,taskIds:L,resultPath:P,handle:O,completion:Be(O,b)})}await He(l,s);let m=l.sort((d,b)=>d.workerId-b.workerId).map(d=>Ge(d,a,u,n));p={occurrences:m.flatMap(d=>d.occurrences),...y()};for(let d of m)v(p,d)}catch(m){f=m}finally{let m=await Ke(l);if(m.length===0)try{n.removeResultDirectory(c)}catch(d){m.push(d)}if(m.length>0){let d=f===void 0?m:[f,...m];g=new AggregateError(d,`Vue worker cleanup failed: ${Qe(d[0])}`)}}if(g)throw g;if(f!==void 0)throw f;if(!p)throw new Error("Vue workers completed without producing a merged result.");return p}function Be(e,n){return new Promise((t,r)=>{let o=!1,i=a=>{o||(o=!0,e.off("error",s),e.off("exit",u),a?r(a):t())},s=a=>{i(new Error(`Vue reference worker ${n} failed: ${a.message}`,{cause:a}))},u=a=>{i(a===0?void 0:new Error(`Vue reference worker ${n} exited with code ${a}`))};e.once("error",s),e.once("exit",u)})}async function He(e,n){let t;try{await Promise.race([Promise.all(e.map(r=>r.completion)),new Promise((r,o)=>{t=setTimeout(()=>o(new Error(`Vue reference workers timed out after ${(n/1e3).toFixed(3)}s`)),n),t.unref()})])}finally{t&&clearTimeout(t)}}async function Ke(e){return(await Promise.allSettled(e.map(async t=>t.handle.terminate()))).flatMap(t=>t.status==="rejected"?[t.reason]:[])}function Ge(e,n,t,r){let o=r.resultSize(e.resultPath);if(!Number.isSafeInteger(o)||o<0||o>t)throw new Error(`Vue reference worker ${e.workerId} result is ${o} bytes; limit is ${t} bytes`);let i;try{i=JSON.parse(r.readResult(e.resultPath))}catch(s){throw new Error(`Vue reference worker ${e.workerId} produced invalid JSON`,{cause:s})}if(!k(i)||i.version!==1||i.runId!==n||i.workerId!==e.workerId)throw new Error(`Vue reference worker ${e.workerId} result identity does not match its assignment`);if(!qe(i.taskIds,e.taskIds))throw new Error(`Vue reference worker ${e.workerId} result task identities do not match its assignment`);if(i.ok===!1)throw typeof i.error!="string"?new Error(`Vue reference worker ${e.workerId} failure payload is malformed`):new Error(`Vue reference worker ${e.workerId} failed: ${i.error}`);if(i.ok!==!0||!Je(i.result))throw new Error(`Vue reference worker ${e.workerId} success payload is malformed`);return i.result}function Je(e){if(!k(e)||!Array.isArray(e.occurrences)||!e.occurrences.every(ze)||!R(e.skippedReferences)||!k(e.skippedReferenceReasons))return!1;for(let n of["missing-source-file","missing-service-script","no-definition","same-file-definition","unindexed-definition"])if(!R(e.skippedReferenceReasons[n]))return!1;return Array.isArray(e.skippedReferenceSamples)&&e.skippedReferenceSamples.every(Xe)}function ze(e){return k(e)&&typeof e.sourceFile=="string"&&R(e.sourceLine)&&R(e.sourceStartChar)&&R(e.sourceEndChar)&&typeof e.sourceToken=="string"&&typeof e.definitionFile=="string"&&R(e.symbolId)}function Xe(e){return k(e)&&typeof e.sourceFile=="string"&&R(e.sourceLine)&&R(e.sourceStartChar)&&R(e.sourceEndChar)&&typeof e.token=="string"&&Ye(e.reason)}function Ye(e){return e==="missing-source-file"||e==="missing-service-script"||e==="no-definition"||e==="same-file-definition"||e==="unindexed-definition"}function R(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function k(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qe(e,n){return Array.isArray(e)&&e.length===n.length&&e.every((t,r)=>typeof t=="string"&&t===n[r])}function B(e,n){if(!Number.isSafeInteger(n)||n<=0)throw new TypeError(`${e} must be a positive safe integer.`)}function Qe(e){return e instanceof Error?e.message:String(e)}function X(e){let n=Number(process.env.CODEBASEIQ_AUGMENT_VUE_WORKERS??0),t=Number.isFinite(n)&&n>0?n:1;return Math.max(1,Math.min(e,t))}function Ze(){let e=Number(process.env.CODEBASEIQ_AUGMENT_VUE_WORKER_TIMEOUT_MS??0);return Number.isFinite(e)&&e>0?e:We}function en(){let e=Number(process.env.CODEBASEIQ_AUGMENT_VUE_WORKER_RESULT_MAX_BYTES??0);return Number.isSafeInteger(e)&&e>0?e:G}function nn(e){let n=tn(),t=[];for(let r of e){let o=Y(r),i=Math.max(1,Math.ceil(o/n));for(let s=0;s<i;s++)t.push({taskId:`${t.length}:${r}:${s}`,fileName:r,startOffset:Math.floor(o*s/i),endOffset:s===i-1?Number.POSITIVE_INFINITY:Math.floor(o*(s+1)/i),countFileSkip:s===0})}return t}function tn(){return Number.POSITIVE_INFINITY}function rn(e,n){let t=Array.from({length:n},()=>({tasks:[],weight:0})),r=e.map(o=>({task:o,weight:on(o)})).sort((o,i)=>i.weight-o.weight);for(let o of r){let i=t.reduce((s,u)=>u.weight<s.weight?u:s);i.tasks.push(o.task),i.weight+=o.weight}return t.map(o=>o.tasks).filter(o=>o.length>0)}function on(e){return Number.isFinite(e.endOffset)?Math.max(1,e.endOffset-e.startOffset):Math.max(1,Y(e.fileName)-e.startOffset)}function Y(e){try{return H(e).size}catch{return 1}}import{createRequire as sn}from"module";import{existsSync as un}from"fs";import{dirname as q,extname as an,join as Q,relative as cn,resolve as ln}from"path";import{pathToFileURL as fn}from"url";function dn(e){e.transaction(()=>{e.prepare(`
|
|
5
|
-
DELETE FROM mentions
|
|
6
|
-
WHERE chunk_id IN (
|
|
7
|
-
SELECT c.id
|
|
8
|
-
FROM chunks c
|
|
9
|
-
JOIN documents d ON d.id = c.document_id
|
|
10
|
-
WHERE d.language = 'vue' OR d.relative_path LIKE '%.vue'
|
|
11
|
-
)
|
|
12
|
-
`).run(),e.prepare(`
|
|
13
|
-
DELETE FROM chunks
|
|
14
|
-
WHERE document_id IN (
|
|
15
|
-
SELECT id
|
|
16
|
-
FROM documents
|
|
17
|
-
WHERE language = 'vue' OR relative_path LIKE '%.vue'
|
|
18
|
-
)
|
|
19
|
-
`).run()})()}function Z(e,n){return e.prepare(`
|
|
20
|
-
SELECT relative_path AS relativePath
|
|
21
|
-
FROM documents
|
|
22
|
-
WHERE language = 'vue' OR relative_path LIKE '%.vue'
|
|
23
|
-
ORDER BY relative_path
|
|
24
|
-
`).all().map(r=>ln(n,r.relativePath))}function ee(e,n){let{vueCore:t,ts:r,volarTs:o}=gn(e),{parsed:i,vueOptions:s}=mn(t,r,n),u=q(n),a=t.createVueLanguagePlugin(r,i.options,s,p=>p),c=pn(t,r,a),l=Rn(u,i),{languageServiceHost:f}=o.createLanguageServiceHost(r,r.sys,c,p=>p,l),g=r.createLanguageService(f);return{ts:r,language:c,languageService:g,fileNames:i.fileNames,configDir:u}}function gn(e){let n=sn(fn(Q(e,"package.json")).href);return{vueCore:w(n,"@vue/language-core",e),ts:w(n,"typescript",e),volarTs:w(n,"@volar/typescript",e)}}function mn(e,n,t){let r=n.readConfigFile(t,n.sys.readFile);if(r.error||!r.config)throw new Error(`Failed to read ${t}`);let i=e.createParsedCommandLine(n,n.sys,t).vueOptions;return typeof e.createGlobalTypesWriter=="function"&&(i.globalTypesPath=e.createGlobalTypesWriter(i,n.sys.writeFile)),{parsed:n.parseJsonConfigFileContent(r.config,n.sys,q(t),void 0,t,void 0,e.getAllExtensions(i).map(s=>({extension:s.slice(1),isMixedContent:!0,scriptKind:n.ScriptKind.Deferred}))),vueOptions:i}}function pn(e,n,t){let r={},o=e.createLanguage([t],new Map,i=>{if(!un(i))return;let s=S(i,{maxBytes:I,inputKind:"Vue language-service source file"});r.current?.scripts.set(i,n.ScriptSnapshot.fromString(s),t.getLanguageId(i)??Vn(i))});return r.current=o,o}function Rn(e,n){return{getCurrentDirectory:()=>e,getCompilationSettings:()=>n.options,getScriptFileNames:()=>n.fileNames,getProjectReferences:()=>n.projectReferences,getProjectVersion:()=>"0"}}function w(e,n,t){try{return e(n)}catch(r){throw(typeof r=="object"&&r!==null&&"code"in r?r.code:null)==="MODULE_NOT_FOUND"?new Error(`Vue augmentation requires ${n} to be installed in ${t}. Install Vue/Volar dependencies for that project, then rerun augment-vue.`,{cause:r}):r}}function ne(e,n,t){let r=hn(e);return o=>{if(!o.name)return null;let i=h(n,o.fileName),s=t.get(o.fileName);if(!s)return null;let u=t.positionAt(s,o.textSpan.start),a=r.get(i);if(!a)return null;let c=a.starts.find(f=>f.line===u.line&&f.displayName===o.name);if(c)return c.symbolId;let l=a.containingByLine.get(u.line);return l&&l.displayName===o.name?l.symbolId:Sn(a.starts,u.line,2,o.name)}}function hn(e){let n=e.prepare(`
|
|
25
|
-
SELECT
|
|
26
|
-
d.relative_path AS relativePath,
|
|
27
|
-
der.start_line AS startLine,
|
|
28
|
-
der.end_line AS endLine,
|
|
29
|
-
der.symbol_id AS symbolId,
|
|
30
|
-
gs.display_name AS displayName
|
|
31
|
-
FROM defn_enclosing_ranges der
|
|
32
|
-
JOIN documents d ON d.id = der.document_id
|
|
33
|
-
JOIN global_symbols gs ON gs.id = der.symbol_id
|
|
34
|
-
ORDER BY d.relative_path, (der.end_line - der.start_line) DESC
|
|
35
|
-
`).all(),t=new Map;for(let r of n){let o=t.get(r.relativePath);o||(o={containingByLine:new Map,starts:[]},t.set(r.relativePath,o)),o.starts.push({line:r.startLine,symbolId:r.symbolId,displayName:r.displayName});for(let i=r.startLine;i<=r.endLine;i++)o.containingByLine.set(i,{symbolId:r.symbolId,displayName:r.displayName})}for(let r of t.values())r.starts.sort((o,i)=>o.line-i.line);return t}function Sn(e,n,t,r){let o=0,i=e.length-1;for(;o<=i;){let u=Math.floor((o+i)/2);e[u].line<n?o=u+1:i=u-1}let s=null;for(let u of[i,o]){let a=e[u];if(!a||a.displayName!==r)continue;let c=Math.abs(a.line-n);c>t||(!s||c<s.distance)&&(s={distance:c,symbolId:a.symbolId})}return s?.symbolId??null}function te(e,n,t){let r=de(n),o=e.prepare("SELECT id FROM global_symbols WHERE symbol = ?"),i=e.prepare(`
|
|
36
|
-
INSERT OR IGNORE INTO global_symbols (symbol, display_name, kind, documentation)
|
|
37
|
-
VALUES (?, ?, ?, ?)
|
|
38
|
-
`),s=0,u=new Map;return e.transaction(()=>{for(let c of t){let l=h(n,c),f=me(r.name,r.version,l);i.run(f,"default",7,`Vue component|${l}`);let g=ge(o,r,n,c);g&&(s++,u.set(c,g))}})(),{get(c){return u.get(c)??null},syntheticSymbols:s}}function re(e,n,t,r,o){return e.transaction(()=>(dn(e),bn(e,n,t,r),yn(e,o)))()}function bn(e,n,t,r){let o=e.prepare("SELECT id FROM documents WHERE relative_path = ?"),i=e.prepare(`
|
|
39
|
-
INSERT INTO chunks (document_id, chunk_index, start_line, end_line, occurrences)
|
|
40
|
-
VALUES (?, ?, ?, ?, X'00')
|
|
41
|
-
`),s=e.prepare(`
|
|
42
|
-
INSERT OR IGNORE INTO mentions (chunk_id, symbol_id, role)
|
|
43
|
-
VALUES (?, ?, 1)
|
|
44
|
-
`);for(let u of t){let a=r.get(u);if(!a)continue;let c=h(n,u),l=o.get(c);if(!l)continue;let f=i.run(l.id,-1,0,0);s.run(Number(f.lastInsertRowid),a)}}function oe(e,n){let t=de(n),r=e.prepare("SELECT id FROM global_symbols WHERE symbol = ?"),o=new Map;return{get(i){if(o.has(i))return o.get(i)??null;let s=ge(r,t,n,i);return o.set(i,s),s}}}function ie(e,n,t,r,o){if(e.fileName.endsWith(".vue")){let i=r.language.scripts.get(e.fileName),s=i?.generated?.languagePlugin.typescript?.getServiceScript(i.generated.root)?.code;if(i&&s){let u=r.language.maps.get(s,i);if(E(u,e.textSpan.start)!==null)return t.get(e.fileName)}return e.fileName.startsWith(o)?t.get(e.fileName):null}return n(e)}function se(e){let n=new Set,t=[];for(let r of e){let o=ue(r);n.has(o)||(n.add(o),t.push(r))}return t}function ue(e){return[e.sourceFile,e.sourceLine,e.sourceStartChar,e.sourceEndChar,e.symbolId].join(":")}function yn(e,n){let t=vn(e,[...new Set(n.map(a=>a.sourceFile))]),r=e.prepare(`
|
|
45
|
-
INSERT INTO chunks (document_id, chunk_index, start_line, end_line, occurrences)
|
|
46
|
-
VALUES (?, ?, ?, ?, X'00')
|
|
47
|
-
`),o=e.prepare(`
|
|
48
|
-
INSERT OR IGNORE INTO mentions (chunk_id, symbol_id, role)
|
|
49
|
-
VALUES (?, ?, 0)
|
|
50
|
-
`),i=new Set,s=0,u=0;for(let a of n){let c=ue(a);if(i.has(c))continue;i.add(c);let l=t.get(a.sourceFile);if(!l)continue;let f=r.run(l,u++,a.sourceLine,a.sourceLine),g=o.run(Number(f.lastInsertRowid),a.symbolId);s+=Number(g.changes)}return s}function*ae(e){let n=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,t=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=n.exec(e);){let o=r[0];t.has(o)||(yield{text:o,start:r.index,end:r.index+o.length})}}function ce(e,n){for(let[t]of e.toGeneratedLocation(n,r=>!!r.navigation))return t;return null}function E(e,n){let t=e;for(let[r]of t.toSourceLocation(n,o=>!!o.navigation))return r;return null}function kn(e,n){let t=0,r=e.lineStarts.length-1;for(;t<=r;){let i=Math.floor((t+r)/2);e.lineStarts[i]<=n?t=i+1:r=i-1}let o=Math.max(0,r);return{line:o,character:n-e.lineStarts[o]}}function le(e,n){return h(e,n).startsWith("node_modules/")}function h(e,n){return cn(e,n).replaceAll("\\","/")}function Vn(e){switch(an(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 fe(){let e=new Map;return{get(n){if(e.has(n))return e.get(n)??null;try{let t=S(n,{maxBytes:I,inputKind:"Vue source file"}),r={text:t,lineStarts:xn(t)};return e.set(n,r),r}catch{return e.set(n,null),null}},positionAt:kn}}function xn(e){let n=[0];for(let t=0;t<e.length;t++)e.charCodeAt(t)===10&&n.push(t+1);return n}function vn(e,n){let t=new Map,r=500;for(let o=0;o<n.length;o+=r){let i=n.slice(o,o+r),s=e.prepare(`SELECT id, relative_path AS relativePath FROM documents WHERE relative_path IN (${i.map(()=>"?").join(",")})`).all(...i);for(let u of s)t.set(u.relativePath,u.id)}return t}function de(e){try{let n=JSON.parse(S(Q(e,"package.json"),{maxBytes:V,inputKind:"project package manifest"}));return{name:n.name??"workspace",version:n.version??"0.0.0"}}catch{return{name:"workspace",version:"0.0.0"}}}function ge(e,n,t,r){let o=h(t,r),i=me(n.name,n.version,o);return e.get(i)?.id??null}function me(e,n,t){let r=t.split("/").map(o=>`\`${o.replaceAll("`","")}\``).join("/");return`scip-vue npm ${e} ${n} ${r}/default.`}async function Et(e){return W(j(),{projectRoot:e.projectRoot,dbPath:e.dbPath}),Cn(e)}async function Cn(e){let n=he(e.projectRoot,e.tsconfig);if(!wn(n))throw new Error(`Vue tsconfig not found at ${n}`);let t=new Re(e.dbPath);try{let r=Z(t,e.projectRoot),o=Tn(En(e.dbPath),"augment-vue-meta.json");return await U({cachePath:o,readFingerprint:()=>On(t,e.projectRoot,e.tsconfig),compute:()=>Fn({db:t,projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,configPath:n,vueFiles:r,onStatus:e.onStatus}),onCacheHit:i=>e.onStatus?.(`Vue references unchanged; reused ${i.resolvedReferences} cached resolved references.`)})}finally{t.close()}}async function Fn(e){let n=te(e.db,e.projectRoot,e.vueFiles),t=J(e.vueFiles)?await z({projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,vueFiles:e.vueFiles}):Pn(e,n);return Ln(e,n,t)}function Ln(e,n,t){let r=se(t.occurrences),o=re(e.db,e.projectRoot,e.vueFiles,n,r),i={vueFiles:e.vueFiles.length,resolvedReferences:r.length,resolvedReferenceSamples:$n(e.db,r,20),insertedMentions:o,skippedReferences:t.skippedReferences,skippedReferenceReasons:t.skippedReferenceReasons,skippedReferenceSamples:jn(t.skippedReferenceSamples,20),syntheticSymbols:n.syntheticSymbols};return e.onStatus?.(`Resolved ${i.resolvedReferences} Vue references with Volar; inserted ${i.insertedMentions} mentions.`),i}function Pn(e,n){let t=Se({db:e.db,projectRoot:e.projectRoot,configPath:e.configPath,vueSymbolLookup:n});return be({...t,vueFiles:t.context.fileNames.filter(r=>r.endsWith(".vue"))})}function On(e,n,t){let r=e.prepare(`
|
|
51
|
-
SELECT
|
|
52
|
-
(SELECT COUNT(*) FROM documents) AS documents,
|
|
53
|
-
(SELECT COUNT(*) FROM global_symbols) AS symbols,
|
|
54
|
-
(SELECT COUNT(*) FROM chunks) AS chunks,
|
|
55
|
-
(SELECT COUNT(*) FROM mentions) AS mentions,
|
|
56
|
-
(SELECT COUNT(*) FROM defn_enclosing_ranges) AS ranges,
|
|
57
|
-
(SELECT MAX(id) FROM chunks) AS maxChunkId,
|
|
58
|
-
(SELECT MAX(id) FROM global_symbols) AS maxSymbolId
|
|
59
|
-
`).get();return{version:3,tsconfig:t,files:N(n),db:r}}function Tt(e){let n=he(e.projectRoot,e.tsconfig),t=new Re(e.dbPath,{readonly:!0});try{let r=Se({db:t,projectRoot:e.projectRoot,configPath:n,vueSymbolLookup:oe(t,e.projectRoot)});return be({vueFiles:e.vueFiles??[],tasks:e.tasks,...r})}finally{t.close()}}function Se(e){let n=fe();return{projectRoot:e.projectRoot,context:ee(e.projectRoot,e.configPath),symbolLookup:ne(e.db,e.projectRoot,n),vueSymbolLookup:e.vueSymbolLookup,sourceReader:n}}function be(e){let n=[],t=y(),r=e.tasks??e.vueFiles.map(o=>({fileName:o,startOffset:0,endOffset:Number.POSITIVE_INFINITY,countFileSkip:!0}));for(let o of r){let i=An(e,o);n.push(...i.occurrences),v(t,i)}return{occurrences:n,...t}}function An(e,n){let t=e.sourceReader.get(n.fileName);if(!t)return pe(e.projectRoot,n,"missing-source-file");let r=e.context.language.scripts.get(n.fileName),o=r?.generated?.languagePlugin.typescript?.getServiceScript(r.generated.root)?.code;if(!r||!o)return pe(e.projectRoot,n,"missing-service-script");let i=e.context.language.maps.get(o,r),s=h(e.projectRoot,n.fileName),u=[...ae(t.text)],a={tokens:u.filter(c=>c.start>=n.startOffset&&c.start<n.endOffset),tokenByStart:new Map(u.map(c=>[c.start,c])),tokenTextCounts:Un(u),processedStarts:new Set};return Nn({...e,fileName:n.fileName,sourceInfo:t,sourceFile:s,map:i,tokenContext:a})}function Nn(e){let n=[],t=y();for(let r of e.tokenContext.tokens){if(e.tokenContext.processedStarts.has(r.start)||Dn(e.sourceInfo.text,r.start))continue;let o=ce(e.map,r.start);if(o===null)continue;let s=(e.context.languageService.getDefinitionAtPosition(e.fileName,o+1)??[]).find(l=>!le(e.projectRoot,l.fileName));if(!s){T(t,e.sourceReader,e.sourceInfo,e.sourceFile,r,"no-definition");continue}let u=h(e.projectRoot,s.fileName),a=Mn(e.sourceFile,r.text,u);if(a){T(t,e.sourceReader,e.sourceInfo,e.sourceFile,r,a);continue}let c=ie(s,e.symbolLookup,e.vueSymbolLookup,e.context,e.projectRoot);if(c===null){T(t,e.sourceReader,e.sourceInfo,e.sourceFile,r,"unindexed-definition");continue}ye(n,e.sourceReader,e.sourceInfo,e.sourceFile,r,u,c),e.tokenContext.processedStarts.add(r.start),Wn(n,e,r,o,u,c)}return{occurrences:n,...t}}function Dn(e,n){let t=e.lastIndexOf(`
|
|
60
|
-
`,n-1)+1,r=e.slice(t,n);return/\bfrom\s+['"][^'"]*$/.test(r)||/\bimport\s*\(\s*['"][^'"]*$/.test(r)}function Mn(e,n,t){return t===e?"same-file-definition":t.endsWith(".vue")&&n!==t.split("/").at(-1)?.replace(/\.vue$/,"")?"unindexed-definition":null}function pe(e,n,t){let r=y();return n.countFileSkip&&(r.skippedReferences=1,r.skippedReferenceReasons[t]=1,r.skippedReferenceSamples.push({sourceFile:h(e,n.fileName),sourceLine:0,sourceStartChar:0,sourceEndChar:0,token:"",reason:t})),{occurrences:[],...r}}function T(e,n,t,r,o,i){if(e.skippedReferences++,e.skippedReferenceReasons[i]++,e.skippedReferenceSamples.filter(u=>u.reason===i&&u.sourceFile===r).length>=2)return;let s=n.positionAt(t,o.start);e.skippedReferenceSamples.push({sourceFile:r,sourceLine:s.line,sourceStartChar:s.character,sourceEndChar:s.character+o.text.length,token:o.text,reason:i})}function C(e,n){let t=new Map;for(let i of e){let s=t.get(i.sourceFile)??[];s.push(i),t.set(i.sourceFile,s)}let r=[...t.keys()].sort(),o=[];for(let i=0;o.length<n;i++){let s=!1;for(let u of r){let a=t.get(u)?.[i];if(a&&(o.push(a),s=!0,o.length===n))break}if(!s)break}return o}function _n(e,n){let t=C(e.filter(i=>i.sourceFile!==i.definitionFile),Math.ceil(n/2)),r=new Set(t.map(i=>`${i.sourceFile}:${i.sourceLine}:${i.sourceStartChar}:${i.sourceEndChar}:${i.symbolId}`)),o=C(e.filter(i=>!r.has(`${i.sourceFile}:${i.sourceLine}:${i.sourceStartChar}:${i.sourceEndChar}:${i.symbolId}`)),n-t.length);return[...t,...o]}function jn(e,n){let t=[...new Set(e.map(o=>o.reason))].sort(),r=[];for(let[o,i]of t.entries()){let s=t.length-o,u=Math.ceil((n-r.length)/s);r.push(...C(e.filter(a=>a.reason===i),u))}return r.slice(0,n)}function $n(e,n,t){let r=e.prepare("SELECT symbol FROM global_symbols WHERE id = ?");return _n(n,t).map(({symbolId:o,...i})=>({...i,definitionSymbol:r.get(o)?.symbol??`symbol-id:${o}`}))}function Wn(e,n,t,r,o,i){if(!((n.tokenContext.tokenTextCounts.get(t.text)??0)<=1))for(let s of Bn(n.context.languageService,n.fileName,r+1,n.map,t,n.tokenContext.tokenByStart)){if(n.tokenContext.processedStarts.has(s))continue;let u=n.tokenContext.tokenByStart.get(s);u&&(ye(e,n.sourceReader,n.sourceInfo,n.sourceFile,u,o,i),n.tokenContext.processedStarts.add(s))}}function ye(e,n,t,r,o,i,s){let u=n.positionAt(t,o.start);e.push({sourceFile:r,sourceLine:u.line,sourceStartChar:u.character,sourceEndChar:u.character+o.text.length,sourceToken:o.text,definitionFile:i,symbolId:s})}function Un(e){let n=new Map;for(let t of e)n.set(t.text,(n.get(t.text)??0)+1);return n}function Bn(e,n,t,r,o,i){let s=e.getDocumentHighlights?.(n,t,[n])??[],u=[];for(let a of s)if(a.fileName===n)for(let c of a.highlightSpans){let l=Hn(r,c.textSpan.start,i,o.text);l!==null&&u.push(l)}return u}function Hn(e,n,t,r){let o=t.get(n);if(o?.text===r)return o.start;let i=E(e,n);if(i===null)return null;let s=t.get(i);return s?.text===r?s.start:null}export{j as a,Ee as b,W as c,Et as d,Tt as e};
|
|
61
|
-
//# sourceMappingURL=chunk-VFY6Y2H6.js.map
|