codebaseiq 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -2
- package/README.md +1 -1
- package/dist/augment-vue-worker.js +1 -1
- package/dist/{chunk-2DMVFAY7.js → chunk-23C5AD3B.js} +2 -2
- package/dist/{chunk-WH5SYOMD.js → chunk-2E6OUPCF.js} +2 -2
- package/dist/{chunk-RWKEXCHU.js → chunk-2EDX3JT5.js} +2 -2
- package/dist/chunk-2I2UHZET.js +2 -0
- package/dist/{chunk-CSZOQ7YO.js → chunk-2OMXFE64.js} +2 -2
- package/dist/{chunk-EXMVF3JR.js → chunk-2PRONPAS.js} +3 -3
- package/dist/{chunk-5WXOEJ4G.js → chunk-356EZBIP.js} +2 -2
- package/dist/{chunk-A7XQT7MH.js → chunk-36JC5BG2.js} +2 -2
- package/dist/{chunk-RRPK327J.js → chunk-3RR2K7EZ.js} +2 -2
- package/dist/{chunk-3NUZVLR7.js → chunk-3RSBGWGL.js} +2 -2
- package/dist/{chunk-MTMF4N7F.js → chunk-3VJ3OCRE.js} +2 -2
- package/dist/{chunk-IBM3F2BJ.js → chunk-4LK5OIPW.js} +2 -2
- package/dist/{chunk-FQA3KIFX.js → chunk-5DSL3NT2.js} +2 -2
- package/dist/{chunk-IYBIBMPF.js → chunk-5FWR5HLG.js} +2 -2
- package/dist/{chunk-CIVYHK7U.js → chunk-5IC2WZAL.js} +2 -2
- package/dist/{chunk-PARCKE3Q.js → chunk-5IZRKWTZ.js} +2 -2
- package/dist/{chunk-HHBBGWES.js → chunk-5LL4KEHO.js} +2 -2
- package/dist/chunk-5T44HG5Y.js +88 -0
- package/dist/{chunk-YFQPWKHR.js → chunk-5ZI2PPI7.js} +2 -2
- package/dist/{chunk-T3YFIJ5P.js → chunk-67VJAYVR.js} +2 -2
- package/dist/{chunk-DKJXK3HA.js → chunk-6BF3VYEF.js} +2 -2
- package/dist/chunk-6JMAVFL4.js +3 -0
- package/dist/chunk-6O3KXIDL.js +2 -0
- package/dist/{chunk-OJFLPVBP.js → chunk-6VREELBC.js} +2 -2
- package/dist/chunk-6WAPPQ5F.js +82 -0
- package/dist/{chunk-QLTFXVUI.js → chunk-75KJGYX7.js} +2 -2
- package/dist/{chunk-PLZXWZHY.js → chunk-7GAK2F3H.js} +2 -2
- package/dist/{chunk-X5I2BQGX.js → chunk-7JELP5YE.js} +2 -2
- package/dist/{chunk-W3FK73MD.js → chunk-7UCDGXRW.js} +2 -2
- package/dist/{chunk-CMXW7MFV.js → chunk-AEXQYQD7.js} +2 -2
- package/dist/{chunk-PHPQ24UG.js → chunk-AQI4N64O.js} +2 -2
- package/dist/{chunk-XUJM6474.js → chunk-AURCQHSG.js} +2 -2
- package/dist/{chunk-EM5UHLAM.js → chunk-BBP7HVBJ.js} +2 -2
- package/dist/{chunk-57KFVPVZ.js → chunk-BFBIMTCJ.js} +2 -2
- package/dist/{chunk-VVCBMH5O.js → chunk-BGGB5N53.js} +2 -2
- package/dist/{chunk-ZOEDRCR4.js → chunk-BRQL7AFJ.js} +2 -2
- package/dist/{chunk-KDYQQJ6X.js → chunk-BWL3PMPT.js} +2 -2
- package/dist/{chunk-M7LAIM77.js → chunk-C6WKPKCF.js} +2 -2
- package/dist/{chunk-2F5ERMNI.js → chunk-C7OUW52M.js} +2 -2
- package/dist/{chunk-N3Q3AWGW.js → chunk-C7QWUBR2.js} +96 -96
- package/dist/{chunk-BX2U3QQV.js → chunk-CCIYWXX6.js} +2 -2
- package/dist/{chunk-3AC56WAR.js → chunk-CIYA2KZN.js} +2 -2
- package/dist/{chunk-35YYZD3D.js → chunk-CR3OG6SQ.js} +2 -2
- package/dist/{chunk-VYZQZ4ZN.js → chunk-CVHOQONG.js} +2 -2
- package/dist/{chunk-4IFISPQW.js → chunk-CW6AXOLR.js} +2 -2
- package/dist/{chunk-NDGTJHQN.js → chunk-D53LWANR.js} +2 -2
- package/dist/{chunk-VCWAJPXQ.js → chunk-D7AZAOZX.js} +2 -2
- package/dist/{chunk-ACZDU5GK.js → chunk-D7DOB27N.js} +7 -7
- package/dist/{chunk-CDWSLAPN.js → chunk-DAKIGMIK.js} +2 -2
- package/dist/chunk-DDN2F6GB.js +2 -0
- package/dist/{chunk-L3YSDLNB.js → chunk-DVWO7RBC.js} +2 -2
- package/dist/{chunk-KNV5VFDV.js → chunk-E52K4L2W.js} +2 -2
- package/dist/chunk-EIBGSU2R.js +2 -0
- package/dist/chunk-EQNMD62X.js +51 -0
- package/dist/{chunk-LY2NB5XR.js → chunk-EXZ7VLRY.js} +2 -2
- package/dist/{chunk-YIOQJ45A.js → chunk-F3QSL4W2.js} +2 -2
- package/dist/{chunk-JOALNFY3.js → chunk-F74LZWCE.js} +2 -2
- package/dist/{chunk-ZB3V5QM7.js → chunk-FEIZXBLH.js} +2 -2
- package/dist/{chunk-NJA4MMBD.js → chunk-FH5WG4LE.js} +2 -2
- package/dist/{chunk-MRGTCMDK.js → chunk-FOZ74V56.js} +2 -2
- package/dist/{chunk-S5SKXCND.js → chunk-FQTIFWLR.js} +2 -2
- package/dist/chunk-FTTV7IRX.js +355 -0
- package/dist/chunk-FWQGH2N2.js +2 -0
- package/dist/{chunk-PFPHS4NO.js → chunk-GDHWOA57.js} +2 -2
- package/dist/{chunk-H3CKAL6P.js → chunk-GIDCP7KV.js} +2 -2
- package/dist/{chunk-6SDEQTVY.js → chunk-GL6UTNUB.js} +2 -2
- package/dist/{chunk-37TKC6MB.js → chunk-GP7C5VAE.js} +2 -2
- package/dist/{chunk-U24M5RQM.js → chunk-GQLDYCWS.js} +2 -2
- package/dist/{chunk-I5FCDTK2.js → chunk-GQXXOS55.js} +2 -2
- package/dist/{chunk-NTRW52UR.js → chunk-GUFPEFBG.js} +2 -2
- package/dist/{chunk-B2E3HZ2A.js → chunk-GV2CEZCW.js} +2 -2
- package/dist/{chunk-AM5SUGHF.js → chunk-GVAF222T.js} +2 -2
- package/dist/{chunk-TAJ6UGCO.js → chunk-GWYZVVKY.js} +3 -3
- package/dist/{chunk-NK76RSB6.js → chunk-HENP2O4A.js} +2 -2
- package/dist/{chunk-VG55NFXF.js → chunk-HINZQKSY.js} +2 -2
- package/dist/{chunk-6OVNYYY4.js → chunk-HQA7EBSK.js} +2 -2
- package/dist/{chunk-DLC6JDN7.js → chunk-HVFB3PME.js} +2 -2
- package/dist/{chunk-FY5V4V4F.js → chunk-I22IZYDI.js} +2 -2
- package/dist/{chunk-RVYLJDXC.js → chunk-ICUL7XRT.js} +2 -2
- package/dist/{chunk-QVHZB75Z.js → chunk-IHSLIIL3.js} +2 -2
- package/dist/{chunk-PNVZIJ57.js → chunk-ITSJMNUD.js} +2 -2
- package/dist/{chunk-XNUWRTYM.js → chunk-IZDPGOZR.js} +2 -2
- package/dist/chunk-J3GLP7Q5.js +3 -0
- package/dist/{chunk-BH5CE4LN.js → chunk-J7AMBVWF.js} +2 -2
- package/dist/{chunk-YXJ4IAHH.js → chunk-JCMFBF4Z.js} +2 -2
- package/dist/{chunk-ZJZQ7Q2Q.js → chunk-JFIA2JI3.js} +2 -2
- package/dist/{chunk-FIXYHQ3W.js → chunk-JLZLLLW5.js} +2 -2
- package/dist/{chunk-2E6BTWER.js → chunk-JSNTHRLQ.js} +2 -2
- package/dist/{chunk-77GHPR2R.js → chunk-JX6ZWDOS.js} +2 -2
- package/dist/{chunk-SRY26ITJ.js → chunk-JYI7CV25.js} +2 -2
- package/dist/chunk-K7JLSGCJ.js +8 -0
- package/dist/{chunk-DFPAZXLU.js → chunk-KPZGTB2O.js} +2 -2
- package/dist/{chunk-7Z7HCZ7J.js → chunk-LKUTSP4G.js} +2 -2
- package/dist/{chunk-HIEXRDJF.js → chunk-LMTSB3TB.js} +2 -2
- package/dist/{chunk-BLKYYQ7C.js → chunk-LONKINMJ.js} +95 -95
- package/dist/{chunk-SF34QLK2.js → chunk-LQHYYIOB.js} +2 -2
- package/dist/{chunk-HBQGKMM3.js → chunk-LZSQ6X7E.js} +2 -2
- package/dist/{chunk-RCPZOPV6.js → chunk-M2Y6PCFE.js} +2 -2
- package/dist/{chunk-WJOQC4P7.js → chunk-MEUHIDI3.js} +2 -2
- package/dist/{chunk-MT5W4DUG.js → chunk-MHWMEZDA.js} +2 -2
- package/dist/{chunk-FLLXYUOL.js → chunk-MQW6SJ4P.js} +2 -2
- package/dist/{chunk-57KEZDPT.js → chunk-MSI3K7PJ.js} +2 -2
- package/dist/chunk-MVRGB4KJ.js +278 -0
- package/dist/{chunk-27PHVDKL.js → chunk-MZNMASFM.js} +2 -2
- package/dist/{chunk-DVYG3JTA.js → chunk-NBCQZSGR.js} +2 -2
- package/dist/{chunk-NIO346UL.js → chunk-NBZKSTXP.js} +2 -2
- package/dist/{chunk-UWB5WMC2.js → chunk-NCJILOAK.js} +2 -2
- package/dist/{chunk-JN5LIBT3.js → chunk-NDKOVQFG.js} +2 -2
- package/dist/{chunk-W6C6QTXJ.js → chunk-NEWHKGVD.js} +2 -2
- package/dist/{chunk-HBXZAGY6.js → chunk-O2M3VNDY.js} +2 -2
- package/dist/chunk-OFGOOL6U.js +3 -0
- package/dist/{chunk-FEBLLMTL.js → chunk-OQUCBKOI.js} +2 -2
- package/dist/{chunk-5IO2APSS.js → chunk-P4NVCOM7.js} +2 -2
- package/dist/{chunk-SJZQ2PTZ.js → chunk-PFC44E6D.js} +2 -2
- package/dist/{chunk-LAGDJXFY.js → chunk-PHNCEUXX.js} +2 -2
- package/dist/{chunk-HYKSLTAR.js → chunk-PTQPPPG2.js} +2 -2
- package/dist/{chunk-5XEVXVTK.js → chunk-PUVNH4PO.js} +2 -2
- package/dist/chunk-Q23IMHXS.js +343 -0
- package/dist/{chunk-YYFV32WR.js → chunk-Q3ZCQY2Y.js} +2 -2
- package/dist/{chunk-OMBRP7BB.js → chunk-Q4XEU3UH.js} +2 -2
- package/dist/{chunk-I645ZF75.js → chunk-QEOWONKY.js} +2 -2
- package/dist/{chunk-JXHLB7TP.js → chunk-QMOZZ2VX.js} +2 -2
- package/dist/{chunk-2VKB5CMA.js → chunk-RCIGX23V.js} +2 -2
- package/dist/{chunk-J24VICI5.js → chunk-RIYJ4L33.js} +2 -2
- package/dist/{chunk-M4EVGA5S.js → chunk-RJVAPMHF.js} +3 -3
- package/dist/chunk-SB7NASHU.js +2 -0
- package/dist/{chunk-3XFJUWJE.js → chunk-SGMNWYTH.js} +2 -2
- package/dist/chunk-SMDIEDM4.js +27 -0
- package/dist/{chunk-IOVPAZWP.js → chunk-SX72EVMY.js} +2 -2
- package/dist/{chunk-WO47BIPY.js → chunk-T5X7DK6C.js} +2 -2
- package/dist/{chunk-CZEIHYMP.js → chunk-T6MQNNAC.js} +2 -2
- package/dist/chunk-T75DS2E6.js +21 -0
- package/dist/{chunk-57GCCPLS.js → chunk-TEANKHUU.js} +2 -2
- package/dist/{chunk-T55YPJGB.js → chunk-TJBOJUVN.js} +2 -2
- package/dist/{chunk-I2KP4AGR.js → chunk-TJWVT4DO.js} +2 -2
- package/dist/{chunk-KM4QRWI5.js → chunk-TNJGTQWO.js} +2 -2
- package/dist/{chunk-EFFMFK7C.js → chunk-TOTWJZIX.js} +2 -2
- package/dist/{chunk-QMGWSEPL.js → chunk-TPO7XC5Z.js} +2 -2
- package/dist/{chunk-54K6556S.js → chunk-U33PMPNW.js} +2 -2
- package/dist/{chunk-GXVDTHFC.js → chunk-U7NUXDQO.js} +2 -2
- package/dist/chunk-UC2FD2PS.js +4 -0
- package/dist/{chunk-TUTSO7UZ.js → chunk-UQE4XFSA.js} +2 -2
- package/dist/{chunk-4O52YNKL.js → chunk-UQYQBLJX.js} +2 -2
- package/dist/{chunk-FPDL2TUB.js → chunk-USOAJHY7.js} +2 -2
- package/dist/{chunk-JUO3Z644.js → chunk-UW6KD57C.js} +2 -2
- package/dist/{chunk-VLTUX4IF.js → chunk-VGWZ4MOY.js} +2 -2
- package/dist/{chunk-U2XX3BT4.js → chunk-VWYGCMV5.js} +2 -2
- package/dist/{chunk-IWAMYGPN.js → chunk-W7YLRXZE.js} +2 -2
- package/dist/{chunk-QKVTWODE.js → chunk-WK2IQJPK.js} +2 -2
- package/dist/{chunk-S64NCE2Z.js → chunk-WWCV4E6J.js} +2 -2
- package/dist/{chunk-IVJJNVSX.js → chunk-XMJ53WG4.js} +2 -2
- package/dist/{chunk-IGYAZPRX.js → chunk-XN3EKMLI.js} +2 -2
- package/dist/{chunk-FWY2PRIF.js → chunk-XQAVQVIL.js} +2 -2
- package/dist/{chunk-JYX5UZSZ.js → chunk-XQPPURLQ.js} +2 -2
- package/dist/{chunk-4AOOSCZ7.js → chunk-YHPG3S2U.js} +2 -2
- package/dist/{chunk-5BDK6QC3.js → chunk-YRKP7PM7.js} +2 -2
- package/dist/{chunk-4NHWNAWQ.js → chunk-YT4DVWUV.js} +2 -2
- package/dist/{chunk-5NJPH3QZ.js → chunk-YTJHCGYB.js} +2 -2
- package/dist/chunk-Z35GOVEH.js +2 -0
- package/dist/{chunk-K5G7SPAG.js → chunk-Z6RL7XOE.js} +4 -4
- package/dist/{chunk-OVKZM2XI.js → chunk-ZAFGY22Q.js} +2 -2
- package/dist/{chunk-A67HT5FR.js → chunk-ZB4C5TTR.js} +2 -2
- package/dist/{chunk-CWMHWD56.js → chunk-ZNH33XIB.js} +2 -2
- package/dist/{chunk-ZNQCR656.js → chunk-ZQ62NNKN.js} +2 -2
- package/dist/{cli-context-XEPPF4RX.js → cli-context-FJL2JHOE.js} +2 -2
- package/dist/{cli-context-TSADTXLB.js → cli-context-PQNWHMCQ.js} +2 -2
- package/dist/{cli-program-KJGQEM72.js → cli-program-UO7PZD6V.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/{code-CDe-mIjx.d.ts → code-DfX3xeWy.d.ts} +1 -1
- package/dist/{code-viewer-YGDON6SY.js → code-viewer-KIXEYQNJ.js} +2 -2
- package/dist/{code-viewer-ZCTHXQ5C.js → code-viewer-VHLBLIUM.js} +2 -2
- package/dist/{command-descriptors-5VAB2MZX.js → command-descriptors-F5P2V3NW.js} +129 -129
- package/dist/{command-descriptors-EAHKIRAG.js → command-descriptors-YCLATF5I.js} +130 -130
- package/dist/{db-DmRNdCtm.d.ts → db-BoG_PWYH.d.ts} +1 -1
- package/dist/direct-navigation-4XJTXIDT.js +2 -0
- package/dist/direct-navigation-J5MVYYAD.js +3 -0
- package/dist/{graph-evidence-Bs54NWws.d.ts → graph-evidence-D1jx1Cql.d.ts} +1 -1
- package/dist/{health-BnzbSLCE.d.ts → health-DkYBS5BI.d.ts} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/invocation-command-descriptors-RWV4VAI4.js +2 -0
- package/dist/invocation-command-descriptors-U76PN7IY.js +3 -0
- package/dist/{scip-cli-BRFKkHQn.d.ts → maintenance-types-CdL5eQii.d.ts} +1 -20
- package/dist/output-continuation-command-BL25S26S.js +3 -0
- package/dist/output-continuation-command-BTETTXEC.js +2 -0
- package/dist/postinstall.js +1 -1
- package/dist/project-reindex-CRJU3IFG.js +2 -0
- package/dist/project-reindex-TQFCOA2O.js +3 -0
- package/dist/queries/affected.d.ts +1 -1
- package/dist/queries/affected.js +1 -1
- package/dist/queries/anchors.d.ts +1 -1
- package/dist/queries/anchors.js +1 -1
- package/dist/queries/architecture.d.ts +1 -1
- package/dist/queries/architecture.js +1 -1
- package/dist/queries/bottlenecks.d.ts +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +1 -1
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +1 -1
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +1 -1
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +1 -1
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.d.ts +2 -2
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +1 -1
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +1 -1
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/context.d.ts +1 -1
- package/dist/queries/context.js +1 -1
- package/dist/queries/convergence.d.ts +1 -1
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +1 -1
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +1 -1
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +1 -1
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +1 -1
- package/dist/queries/dead.js +1 -1
- package/dist/queries/decorative-checkers.d.ts +1 -1
- package/dist/queries/decorative-checkers.js +1 -1
- package/dist/queries/deep-chains.d.ts +1 -1
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/dependence-slice.d.ts +2 -2
- package/dist/queries/dependence-slice.js +1 -1
- package/dist/queries/dependency-depth.d.ts +1 -1
- package/dist/queries/dependency-depth.js +1 -1
- package/dist/queries/deps.d.ts +1 -1
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.d.ts +1 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +1 -1
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +1 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.d.ts +1 -1
- package/dist/queries/duplicate-bodies.js +1 -1
- package/dist/queries/entry-map.d.ts +1 -1
- package/dist/queries/entry-map.js +1 -1
- package/dist/queries/evidence.d.ts +2 -2
- package/dist/queries/evidence.js +1 -1
- package/dist/queries/extract-candidates.d.ts +1 -1
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +1 -1
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +1 -1
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +2 -2
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +1 -1
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +1 -1
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +1 -1
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +4 -4
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +1 -1
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.d.ts +1 -1
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.d.ts +1 -1
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/not-implemented.d.ts +1 -1
- package/dist/queries/not-implemented.js +1 -1
- package/dist/queries/outline.d.ts +1 -1
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +1 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +1 -1
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +1 -1
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +1 -1
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +1 -1
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.d.ts +1 -1
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +1 -1
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/reference-neighborhood.d.ts +1 -1
- package/dist/queries/reference-neighborhood.js +1 -1
- package/dist/queries/reference-reachability.d.ts +1 -1
- package/dist/queries/reference-reachability.js +1 -1
- package/dist/queries/refs.d.ts +1 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +1 -1
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.d.ts +1 -1
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +1 -1
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +1 -1
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +1 -1
- package/dist/queries/slice.js +1 -1
- package/dist/queries/source-inspection.d.ts +3 -3
- package/dist/queries/source-inspection.js +1 -1
- package/dist/queries/source-search.d.ts +1 -1
- package/dist/queries/source-search.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +1 -1
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +1 -1
- package/dist/queries/surface.d.ts +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +1 -1
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system-map.d.ts +1 -1
- package/dist/queries/system-map.js +1 -1
- package/dist/queries/system.d.ts +1 -1
- package/dist/queries/system.js +1 -1
- package/dist/queries/test-quality.d.ts +1 -1
- package/dist/queries/test-quality.js +1 -1
- package/dist/queries/trace.d.ts +1 -1
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.d.ts +1 -1
- package/dist/queries/twin-ab.js +1 -1
- package/dist/queries/twin-drift.d.ts +1 -1
- package/dist/queries/twin-drift.js +1 -1
- package/dist/queries/unused-imports.d.ts +1 -1
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.d.ts +1 -1
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/value-flow.d.ts +2 -2
- package/dist/queries/value-flow.js +1 -1
- package/dist/queries/vue-component-duplicates.d.ts +1 -1
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.d.ts +1 -1
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.d.ts +1 -1
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +1 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +2 -2
- package/dist/reindex.d.ts +2 -4
- package/dist/reindex.js +71 -32
- package/dist/runtime.d.ts +1 -2
- package/dist/runtime.js +3 -3
- package/dist/rust-semantic-session-server.js +1 -1
- package/dist/rust-semantic-session-worker.js +1 -1
- package/dist/rust-semantic-worker.js +1 -1
- package/dist/sentinel-ensure-command-OSWGCFFL.js +3 -0
- package/dist/sentinel-ensure-command-SPW7XQLB.js +2 -0
- package/dist/sentinel-worker.js +1 -1
- package/dist/typescript-mailbox-worker.js +1 -1
- package/dist/watch-server.js +2 -2
- package/docs/INDEX_GENERATIONS.md +2 -2
- package/docs/NPM_RELEASE.md +323 -0
- package/docs/schemas/npm-release-state.schema.json +4 -13
- package/package.json +3 -11
- package/dist/chunk-2Q2LW5JW.js +0 -14
- package/dist/chunk-327YK6TB.js +0 -4
- package/dist/chunk-347TXATM.js +0 -2
- package/dist/chunk-36WRYYTE.js +0 -3
- package/dist/chunk-6OAHRI2D.js +0 -6
- package/dist/chunk-6URCE5QY.js +0 -2
- package/dist/chunk-6ZV5EDUT.js +0 -5
- package/dist/chunk-7R64XY4Y.js +0 -12
- package/dist/chunk-CANBLFVQ.js +0 -15
- package/dist/chunk-CCRZLRWJ.js +0 -2
- package/dist/chunk-G2XUZCF2.js +0 -88
- package/dist/chunk-H5QXP63L.js +0 -2
- package/dist/chunk-HCMQZPEO.js +0 -2
- package/dist/chunk-IEL6Q5W3.js +0 -308
- package/dist/chunk-IGQQUENU.js +0 -109
- package/dist/chunk-K2O7SBAU.js +0 -2
- package/dist/chunk-QVWDQTMG.js +0 -2
- package/dist/chunk-RJWAB4VR.js +0 -345
- package/dist/chunk-VCL7FK3E.js +0 -3
- package/dist/chunk-WOOTEWQT.js +0 -239
- package/dist/chunk-XYLV727H.js +0 -21
- package/dist/chunk-YMGZZEW4.js +0 -2
- package/dist/direct-navigation-B3SGOOBW.js +0 -2
- package/dist/direct-navigation-ZL362KXF.js +0 -3
- package/dist/invocation-command-descriptors-CSUGUHTT.js +0 -2
- package/dist/invocation-command-descriptors-PPVZOIE5.js +0 -3
- package/dist/output-continuation-command-FTVVBVSN.js +0 -2
- package/dist/output-continuation-command-ITPRC3YV.js +0 -3
- package/dist/project-reindex-7HZSLLLY.js +0 -3
- package/dist/project-reindex-NGM3DYBN.js +0 -2
- package/dist/sentinel-ensure-command-KYYULCFU.js +0 -2
- package/dist/sentinel-ensure-command-RIZA3RY7.js +0 -3
- package/docs/WINDOWS_SIDECAR_RELEASE.md +0 -424
- package/docs/schemas/windows-sidecar-provenance.schema.json +0 -137
- package/scripts/build-codebaseiq-windows.mjs +0 -197
- package/scripts/codebaseiq-windows-provenance.mjs +0 -364
- package/scripts/verify-codebaseiq-windows.mjs +0 -29
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import{a as ne,c as re}from"./chunk-YTJHCGYB.js";import{a as jn}from"./chunk-ILMHV3KM.js";import{a as Qt,b as Kt,d as qe,e as nn}from"./chunk-O2M3VNDY.js";import{I as zt,J as Xt,K as Yt,M as Vt,Q as wn,R as Xe,T as Dn,U as Fn,V as kn,a as me,b as Ht,d as Jt}from"./chunk-6WAPPQ5F.js";import{b as Ot,c as Lt,e as X,f as ge,g as te,h as Ct,i as $t,j as Ut,k as Gt,l as Bt,r as he,s as rn}from"./chunk-EQNMD62X.js";import{a as ze,c as Se,d as _n,f as Tn}from"./chunk-4LK5OIPW.js";import{s as Be}from"./chunk-C6WKPKCF.js";import{A as ln,B as un,C as pn,D as gn,E as fn,F as mn,G as He,I as $,J as ye,K as hn,M as Je,N as yn,O as bn,P as be,S as Sn,T as Rn,U as xn,c as K,d as le,e as Ae,g as Me,h as Ce,i as Dt,j as D,l as jt,o as F,p as M,q as C,r as We,s as Zt,t as en,u as tn,v as an,w as on,x as sn,y as cn,z as dn}from"./chunk-T75DS2E6.js";import{e as fe}from"./chunk-YT4DVWUV.js";import{a as j,b as _t}from"./chunk-RCIGX23V.js";import{i as q,j as J,l as Ft,m as Ge,n as kt,r as Wt,s as qt,u as Pn,x as En,y as In,z as vn}from"./chunk-D7DOB27N.js";import{i as ue,j as Z}from"./chunk-R2NOK63J.js";import{a as S,c as Tt,d as ee,e as H}from"./chunk-6O3KXIDL.js";import{$ as Nt,E as $e,O as Ue,T as pe,Y as wt,Z as z,a as Pt,c as Q,f as A,g as se,ga as At,h as ce,ha as Mt,i as Et,n as It,o as vt,p as de,r as I}from"./chunk-UQYQBLJX.js";import{createHash as fo}from"crypto";import{existsSync as T,mkdirSync as je,readdirSync as Cr,renameSync as $r,rmSync as Y,statSync as mo}from"fs";import{basename as ke,dirname as h,extname as ho,join as v,resolve as Fr}from"path";import{execFileSync as Kr}from"child_process";import{constants as Zr,copyFileSync as On,statSync as ei}from"fs";import{platform as ti}from"os";var ni=Object.freeze({size:e=>ei(e).size,clone:ii,copy:(e,t)=>On(e,t)}),ri=new Set(["ENOSYS","ENOTSUP","EOPNOTSUPP","EINVAL","EXDEV","ENOTTY"]);function U(e,t,n=ni){let r=n.size(e);try{return n.clone(e,t),{method:"reflink",bytes:r}}catch(i){if(!oi(i))throw i}return n.copy(e,t),{method:"copy",bytes:r}}function ii(e,t){if(ti()!=="darwin"){On(e,t,Zr.COPYFILE_FICLONE_FORCE);return}try{Kr("/bin/cp",["-c",e,t],{timeout:6e4,maxBuffer:64*1024,stdio:["ignore","ignore","pipe"],windowsHide:!0})}catch(n){throw ai(n)}}function ai(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 oi(e){let t=e?.code;return t!==void 0&&ri.has(t)}function Ln(){return{reflinkedBytes:0,fallbackCopiedBytes:0}}function G(e,t){t.method==="reflink"?e.reflinkedBytes+=t.bytes:e.fallbackCopiedBytes+=t.bytes}import{dirname as si,join as ci}from"path";function Nn(e={}){return{id:"runtime-boundaries",facts:["runtime-boundary-observation","runtime-boundary-link"],run:({projectRoot:t,dbPath:n,onStatus:r})=>{let i=new F({projectRoot:t,dbPath:n,indexPath:e.indexPath??ci(si(n),"index.scip")}),a,o=!1,s=!1;try{let l=e.reuseExisting||e.affectedFiles?Vt(i):null;e.reuseExisting&&l?.extractorVersion===zt?(a=l,o=!0):(a=Xt(i,{...l?{previousGraph:l}:{},...e.affectedFiles?{affectedFiles:e.affectedFiles}:{}}),s=(a.coverage.filesReused??0)>0)}finally{i.close()}o||Yt(n,a);let c={reused:o,incrementallyUpdated:s,observations:a.observations.length,links:a.links.length,frontiers:a.frontiers.length,filesScanned:a.coverage.filesScanned,errors:a.coverage.extractionErrors.length,phases:a.coverage.phases};return r?.(c.reused?`Reused ${c.observations} cached runtime-boundary observation(s) and ${c.links} link(s).`:c.incrementallyUpdated?`Incrementally refreshed runtime-boundary observations (${c.filesScanned-(a.coverage.filesReused??0)} file(s) extracted, ${a.coverage.filesReused??0} reused) and rebuilt ${c.links} link(s).`:`Extracted ${c.observations} runtime-boundary observation(s), ${c.links} link(s), and ${c.frontiers} unresolved frontier(s).`),!o&&a.coverage.phases&&r?.(`Runtime-boundary phases: ${a.coverage.phases.map(l=>`${l.id} ${l.durationMs.toFixed(0)}ms`).join(", ")}.`),c}}}import{createHash as li}from"crypto";import{existsSync as ui}from"fs";import{dirname as pi,join as Mn}from"path";function Ye(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 Re(e,t,n){let r=e.changes.map(s=>s.path).sort();if(r.length===0&&!e.projectIdentityChanged&&e.uncertainty.length===0)return{mode:"none",changedFiles:r,affectedFiles:[],reasons:[]};let i=new Set(n),a=Ye(e),o=new Set(a.reasons);return r.some(s=>!i.has(s))&&o.add("changed-file-outside-project"),t===null?(o.add("dependency-graph-unavailable"),An(r,i,o)):o.size>0?An(r,i,o):{mode:"closure",changedFiles:r,affectedFiles:di(r,t,i),reasons:[]}}function An(e,t,n){return{mode:"full-project",changedFiles:e,affectedFiles:[...t].sort(),reasons:[...n].sort()}}function di(e,t,n){let r=new Map;for(let[o,s]of t)if(n.has(o))for(let c of s){if(!n.has(c))continue;let l=r.get(c)??new Set;l.add(o),r.set(c,l)}let i=new Set(e),a=[...e];for(let o=0;o<a.length;o+=1){let s=a[o];if(s!==void 0)for(let c of r.get(s)??[])i.has(c)||(i.add(c),a.push(c))}return[...i].sort()}var gi="<global-symbols>";function fi(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:Ve(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:Ve(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:gi,kind:"global-symbol",values:Ve(n)});return mi(t)}function mi(e){let t=new Map;for(let r of e){let i=JSON.stringify([r.kind,r.values]),a=t.get(r.relativePath)??[];a.push(i),t.set(r.relativePath,a)}let n=new Map;for(let[r,i]of[...t].sort(([a],[o])=>a.localeCompare(o))){let a=li("sha256");for(let o of i.sort())a.update(String(Buffer.byteLength(o))),a.update(":"),a.update(o),a.update(`
|
|
58
|
+
`);n.set(r,a.digest("hex"))}return n}function hi(e,t){let n=[],r=[],i=[],a=[],o=new Set([...e.keys(),...t.keys()]);for(let s of[...o].sort()){let c=e.get(s),l=t.get(s);c===void 0?n.push(s):l===void 0?i.push(s):c!==l?r.push(s):a.push(s)}return{addedFiles:n,modifiedFiles:r,deletedFiles:i,changedFiles:[...n,...r,...i].sort(),unchangedFiles:a}}function Qe(e,t,n){let r=new Set(e.affectedFiles),i=new Set(t.changedFiles),a=e.mode==="full-project"?[]:t.changedFiles.filter(c=>!r.has(c)),o=e.affectedFiles.filter(c=>!i.has(c)).sort(),s=t.changedFiles.length-a.length;return{passed:a.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:a,extraFiles:o}}function Ke(e,t=xi){let n=t.wallNow===void 0&&t.monotonicNow===void 0,r=t.monotonicNow??t.now,i=t.wallNow??t.now,a=r(),o=(l,d)=>{let p=r();return qn(e.refreshResult,l,n?p:i(),Math.max(0,p-a),d)};if(!t.databaseExists(e.previousDbPath))return o("prior-index-unavailable");if(!t.databaseExists(e.candidateDbPath))return o("candidate-index-unavailable");let s=null,c=null;try{s=t.openDatabase(e.projectRoot,e.previousDbPath,e.previousIndexPath),c=t.openDatabase(e.projectRoot,e.candidateDbPath,e.candidateIndexPath);let l=[...new Set([...t.indexedPaths(s),...t.indexedPaths(c)])].sort(),d=de(e.previousSnapshot,e.currentSnapshot),p=new Set(l),u=d.changes.length>0&&!Ye(d).fullProject&&d.changes.every(_=>p.has(_.path)),g=Re(d,u?t.dependencyGraph(s):new Map,l),m=hi(t.factDigests(s),t.factDigests(c)),x=r();return{version:1,status:"evaluated",refreshResult:e.refreshResult,recordedAt:new Date(n?x:i()).toISOString(),durationMs:Math.max(0,x-a),manifest:d,plan:g,comparison:m,evaluation:Qe(g,m,l.length)}}catch(l){return o("oracle-error",l instanceof Error?l.message:String(l))}finally{Cn(s),Cn(c)}}function Gn(e,t,n,r=Date.now()){return qn(e,t,r,0,n)}function Bn(e){let t=pi(e);return{latestPath:Mn(t,"affected-shadow-latest.json"),historyPath:Mn(t,"affected-shadow.jsonl")}}function xs(e,t=n=>Et(n,"affected-shadow source file")){let n=Bn(e),r;try{r=JSON.parse(t(n.latestPath))}catch(f){let y=_i(f),R=y?"telemetry-missing":vi(f);return O(n,R,y?void 0:f instanceof Error?f.message:String(f))}if(M(r)&&typeof r.version=="number"&&r.version!==1)return O(n,"unsupported-record-version",`Unsupported version ${r.version}.`);if(!Ei(r))return O(n,"telemetry-malformed");if(r.status==="unavailable")return Ii(r.reason)?{state:"unavailable",...n,reason:r.reason,recordedAt:r.recordedAt,refreshResult:r.refreshResult,durationMs:r.durationMs,...typeof r.error=="string"?{error:r.error}:{}}:O(n,"telemetry-malformed");if(r.status!=="evaluated")return O(n,"telemetry-malformed");let i=r.plan,a=r.comparison,o=r.evaluation;if(!M(r.manifest)||!M(i)||!M(a)||!M(o))return O(n,"telemetry-malformed");let s=i.mode,c=C(i.affectedFiles),l=C(i.reasons),d=C(a.changedFiles),p=C(o.predictedFiles),u=C(o.actualFiles),g=C(o.missingFiles),m=o.recall,x=o.affectedRatio;if(s!=="none"&&s!=="closure"&&s!=="full-project"||c===null||l===null||d===null||p===null||u===null||g===null||typeof o.passed!="boolean"||!$n(m)||!$n(x))return O(n,"telemetry-malformed");let _=u.length===0?1:(u.length-g.length)/u.length;return!Un(c,p)||!Un(d,u)||o.passed!==(g.length===0)||Math.abs(m-_)>Number.EPSILON||g.some(f=>!u.includes(f)||p.includes(f))?O(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 Ps(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 Wn(e,t,n=Pi){let r=Bn(e);return n.appendHistory(r.historyPath,t),n.writeLatest(r.latestPath,t),r}var yi=8*1024*1024,bi=Qt;function Si(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 Ri(e,t,n=yi){Kt(e,Si(t),{maxSegmentBytes:n,previousSuffix:bi})}function Ve(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 xi={now:()=>Date.now(),wallNow:()=>Date.now(),monotonicNow:S,databaseExists:e=>ui(e),openDatabase:(e,t,n)=>new F({projectRoot:e,dbPath:t,indexPath:n}),indexedPaths:e=>fe(e),dependencyGraph:e=>me(e),factDigests:e=>fi(e)},Pi={appendHistory:Ri,writeLatest:(e,t)=>Wt(e,t,{spacing:2,trailingNewline:!0})};function qn(e,t,n,r,i){return{version:1,status:"unavailable",refreshResult:e,recordedAt:new Date(n).toISOString(),durationMs:r,reason:t,...i?{error:i}:{}}}function Cn(e){try{e?.close()}catch{}}function Ei(e){return M(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 Ii(e){return e==="prior-index-unavailable"||e==="candidate-index-unavailable"||e==="oracle-error"}function $n(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1}function Un(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function O(e,t,n){return{state:"unavailable",...e,reason:t,...n?{error:n}:{}}}function vi(e){return e instanceof SyntaxError?"telemetry-malformed":"telemetry-unreadable"}function _i(e){return e instanceof Error&&e.code==="ENOENT"}import{readdirSync as Ti}from"fs";import{isAbsolute as Hn,join as wi,resolve as Di}from"path";var xe="@sourcegraph/scip-typescript@0.4.0",Jn="scip-python-plus@0.7.5",zn="github.com/sourcegraph/scip-go@v0.2.7",Xn="scip-dotnet@0.2.14",Fi="scip_dart@1.6.2",ki=3,ji=new Set(["bin","obj","node_modules"]),Oi={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:xe,destination:"npm global prefix",prerequisite:"npm",binary:"npm",args:["install","-g",xe]}],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:xe,destination:"npm global prefix",prerequisite:"npm",binary:"npm",args:["install","-g",xe]}],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:X.language,indexerBinary:X.indexerBinary,checkCommand:`${X.indexerBinary} --version`,indexArgs:({outputPath:e})=>({binary:X.indexerBinary,args:["scip",".","--output",e]}),markerFiles:[...I.rust],installMethods:[],installUrl:X.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:Jn,destination:"npm global prefix",prerequisite:"npm",binary:"npm",args:["install","-g",Jn]}],installUrl:"https://github.com/PlunderStruck/scip-python",bundledNpmPackage:"scip-python-plus"},clojure:{language:"clojure",indexerBinary:"scip-clojure",projectLocalBinaries:["node_modules/.bin/scip-clojure"],checkCommand:"scip-clojure -h",indexArgs:({projectRoot:e,outputPath:t,indexerBinary:n,configPath:r})=>{let i=["-root",e,"-output",t];return r&&i.push("-config",Hn(r)?r:Di(e,r)),{binary:n,args:i}},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:zn,destination:"Go bin directory (GOBIN or GOPATH/bin)",prerequisite:"go",binary:"go",args:["install",zn]}],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",Yn(e,[".sln",".slnx",".csproj"])??e,"--output",t,"--working-directory",e]}),markerFiles:[...I.csharp],installMethods:[{label:"dotnet",identity:Xn,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",Yn(e,[".sln",".slnx",".vbproj"])??e,"--output",t,"--working-directory",e]}),markerFiles:[...I.vb],installMethods:[{label:"dotnet",identity:Xn,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:Fi,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})=>Hn(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 Vn(e){if(!(e.projectPath||e.pnpmWorkspaces)){if(e.language==="typescript")return"{}";if(e.language==="javascript")return'{"compilerOptions":{"allowJs":true}}'}}function Ze(e){return Oi[e]}function Yn(e,t){let n=[e];for(let r=0;r<=ki&&n.length>0;r++){let i=[],a=[];for(let o of n){let s;try{s=Ti(o,{withFileTypes:!0})}catch{continue}for(let c of s){let l=wi(o,c.name);c.isDirectory()?!c.name.startsWith(".")&&!ji.has(c.name)&&a.push(l):i.push(l)}}for(let o of t){let s=i.filter(c=>c.endsWith(o)).sort()[0];if(s)return s}n=a.sort()}return null}import{createHash as Li}from"crypto";import{existsSync as Qn,rmSync as Kn}from"fs";import{resolve as Ni}from"path";import tr from"better-sqlite3";var Ai={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}]},Mi={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 nr(e){let t=S(),n=Ci(e.affectedFiles);if($i(e.previousDbPath,e.miniDbPath,e.candidateDbPath),Kn(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");Zn(e.previousDbPath,"previous SQLite generation",!1),Zn(e.miniDbPath,"incremental SQLite mini database");let r=U(e.previousDbPath,e.candidateDbPath);e.writeTelemetry&&G(e.writeTelemetry,r);let i=null;try{i=new tr(j(e.candidateDbPath),{fileMustExist:!0}),i.pragma("busy_timeout = 5000"),i.pragma("foreign_keys = ON"),i.prepare("ATTACH DATABASE ? AS incremental").run(j(e.miniDbPath)),et(i,"main","candidate SQLite generation"),et(i,"incremental","incremental SQLite mini database"),Ui(i,n),Gi(i,n.length);let a=tt(i,"main",!0),o=L(i,"SELECT COUNT(*) AS value FROM main.documents");i.transaction(()=>{Bi(i),Wi(i),qi(i),e.onStage?.("after-delete"),Hi(i),e.onStage?.("after-symbol-reconciliation"),Ji(i),e.onStage?.("after-insert"),zi(i),Xi(i,n.length,o),e.onStage?.("before-commit")}).immediate(),rr(i,"main","candidate SQLite generation");let l=[...Yi(i)].filter(([d,p])=>a.get(d)!==p).map(([d])=>d).sort();return i.exec("DETACH DATABASE incremental"),i.close(),i=null,{candidateDbPath:e.candidateDbPath,affectedDocumentCount:n.length,changedDocumentPaths:l,durationMs:S()-t}}catch(a){try{i?.close()}finally{Kn(e.candidateDbPath,{force:!0})}throw new Error(`Incremental SQLite publication rejected: ${a instanceof Error?a.message:String(a)}`,{cause:a})}}function Ci(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 $i(e,t,n){let r=[e,t,n].map(i=>Ni(i));if(new Set(r).size!==r.length)throw new Error("previous, mini, and candidate SQLite paths must be distinct")}function Zn(e,t,n=!0){let r=new tr(j(e),{readonly:!0,fileMustExist:!0});try{et(r,"main",t),n&&rr(r,"main",t)}finally{r.close()}}function et(e,t,n){for(let[r,i]of Object.entries(Ai)){let o=e.prepare(`PRAGMA ${t}.table_info('${r}')`).all().map(({name:s,type:c,notnull:l,pk:d})=>({name:s,type:c.toUpperCase(),notnull:l,pk:d}));if(JSON.stringify(o)!==JSON.stringify(i))throw new Error(`${n} schema changed for table ${r}`)}for(let[r,i]of Object.entries(Mi)){let a=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(a?.tbl_name!==i.table||JSON.stringify(o)!==JSON.stringify(i.columns))throw new Error(`${n} schema changed for index ${r}`)}er(e,t,"documents",["relative_path"],n),er(e,t,"global_symbols",["symbol"],n)}function er(e,t,n,r,i){if(!e.prepare(`PRAGMA ${t}.index_list('${n}')`).all().some(s=>{if(s.unique!==1)return!1;let c=e.prepare(`PRAGMA ${t}.index_info('${s.name}')`).all().map(l=>l.name);return JSON.stringify(c)===JSON.stringify(r)}))throw new Error(`${i} lost the unique ${n}(${r.join(", ")}) constraint`)}function rr(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 Ui(e,t){e.exec("CREATE TEMP TABLE incremental_affected_paths (relative_path TEXT PRIMARY KEY) WITHOUT ROWID");let n=e.prepare("INSERT INTO temp.incremental_affected_paths(relative_path) VALUES (?)");e.transaction(i=>{for(let a of i)n.run(a)})(t)}function Gi(e,t){let n=L(e,"SELECT COUNT(*) AS value FROM incremental.documents"),r=L(e,`SELECT COUNT(*) AS value
|
|
59
|
+
FROM main.documents d
|
|
60
|
+
JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path`),i=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(),a=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||i!==void 0||a!==void 0)throw new Error("incremental SQLite mini database does not exactly match the affected document set")}function Bi(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 Wi(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 qi(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 Hi(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 Ji(e){let t=L(e,"SELECT COALESCE(MAX(id), 0) AS value FROM main.documents"),n=L(e,"SELECT COALESCE(MAX(id), 0) AS value FROM main.chunks"),r=L(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 zi(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 Xi(e,t,n){let r=L(e,"SELECT COUNT(*) AS value FROM main.documents"),i=L(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||i!==t)throw new Error("candidate SQLite document counts changed unexpectedly");let a=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(a!==void 0||o!==void 0)throw new Error("candidate SQLite generation contains duplicate document paths or symbols")}function Yi(e){let t=tt(e,"main",!0),n=tt(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 tt(e,t,n){let r=n?"JOIN temp.incremental_affected_paths p ON p.relative_path = d.relative_path":"",i=e.prepare(`SELECT d.relative_path, d.language, d.position_encoding, d.text
|
|
206
|
+
FROM ${t}.documents d
|
|
207
|
+
${r}
|
|
208
|
+
ORDER BY d.relative_path`).all(),a=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(),c=new Map;for(let[d,p]of Object.entries({documents:i,chunks:a,definitions:o,mentions:s}))for(let u of p){let g=JSON.stringify([d,u]),m=c.get(u.relative_path)??[];m.push(g),c.set(u.relative_path,m)}let l=new Map;for(let[d,p]of[...c].sort(([u],[g])=>u.localeCompare(g))){let u=Li("sha256");for(let g of p.sort())u.update(g).update(`
|
|
228
|
+
`);l.set(d,u.digest("hex"))}return l}function L(e,t){return e.prepare(t).get().value}import Vi from"better-sqlite3";var Pe="idx_mentions_definitions",Qi=["symbol_id","chunk_id"];function nt(e){let t=new Vi(j(e)),n=[],r=[],i=[];try{return t.transaction(()=>{Ki(t,n),Ee(t,"idx_global_symbols_symbol")?.join("\0")==="symbol"&&ir(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")):Ee(t,"idx_global_symbols_symbol")&&i.push("idx_global_symbols_symbol");let a=Ee(t,"idx_chunks_doc_id"),o=ir(t,"chunks").some(s=>s.name!=="idx_chunks_doc_id"&&s.columns.length>1&&s.columns[0]==="document_id");a?.join("\0")==="document_id"&&o?(t.exec('DROP INDEX "idx_chunks_doc_id"'),r.push("idx_chunks_doc_id")):a&&i.push("idx_chunks_doc_id"),t.exec("ANALYZE")})(),{added:n,removed:r,retained:i,analyzed:!0}}catch(a){if(a.code==="SQLITE_NOTADB")return{added:[],removed:[],retained:[],analyzed:!1,skippedReason:"not-a-sqlite-database"};throw a}finally{t.close()}}function Ki(e,t){let n=ar(e,Pe);if(n){let r=n.columns.join("\0")===Qi.join("\0"),i=/\bWHERE\s+role\s*=\s*1\b/iu.test(n.sql??"");if(!r||!i||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 ir(e,t){return e.prepare(`PRAGMA index_list('${t.replaceAll("'","''")}')`).all().map(n=>({name:n.name,unique:n.unique===1,columns:Ee(e,n.name)??[]}))}function Ee(e,t){return ar(e,t)?.columns??null}function ar(e,t){let n=e.prepare("SELECT tbl_name, sql FROM sqlite_master WHERE type = 'index' AND name = ?").get(t);if(!n)return null;let r=e.prepare(`PRAGMA index_info('${t.replaceAll("'","''")}')`).all().map(i=>i.name);return{table:n.tbl_name,sql:n.sql,columns:r}}import{createHash as Zi}from"crypto";import{existsSync as rt,readdirSync as ea}from"fs";import{dirname as it,join as Ie,relative as ta,resolve as at,sep as or}from"path";function sr(e,t){let n=t.includes("."),r={};for(let a of t)r[a]=[];let i=[];for(let a of e){let o=ur(a.path,t);o?r[o].push(a):n?r["."].push(a):i.push(a)}return{files:r,shared:i}}function cr(e,t){let n=new Map;for(let i of e){let a=t[i]?.packageName;a&&n.set(a,i)}let r=new Map;for(let i of e)r.set(i,new Set);for(let i of e){let a=t[i],o=r.get(i);if(!a||a.parseFailed){for(let s of e)s!==i&&o.add(s);continue}for(let s of a.dependencyNames){let c=n.get(s);c&&c!==i&&o.add(c)}for(let s of[...a.pathsTargets,...a.referencesPaths]){let c=ur(s,e);c&&c!==i&&o.add(c)}}return na(e,r)}function dr(e,t,n){let r={};for(let i of e){let a=new Map;for(let o of t.files[i]??[])a.set(o.path,o);for(let o of n[i]??[])for(let s of t.files[o]??[])a.set(s.path,s);for(let o of t.shared)a.set(o.path,o);r[i]={files:[...a.values()].sort((o,s)=>o.path.localeCompare(s.path))}}return r}function ot(e){if(e===".")return"root";let t=Zi("sha256").update(e).digest("hex").slice(0,8);return`${e.split("/").join("__")}-${t}`}function lr(e,t){let n=at(e),r={};for(let i of t)r[i]=ra(n,i);return r}function ur(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 na(e,t){let n={};for(let r of e){let i=new Set,a=[...t.get(r)??[]];for(;a.length>0;){let o=a.pop();if(!(o===r||i.has(o))){i.add(o);for(let s of t.get(o)??[])s!==r&&!i.has(s)&&a.push(s)}}n[r]=[...i].sort((o,s)=>o.localeCompare(s))}return n}function ra(e,t){let n=t==="."?e:Ie(e,t),r=ia(n),i=aa(n),a=i?oa(i,e):{pathsTargets:[],referencesPaths:[],failed:!1};return{packageName:r.name,dependencyNames:r.dependencyNames,pathsTargets:a.pathsTargets,referencesPaths:a.referencesPaths,parseFailed:r.failed||a.failed}}function ia(e){let t=Ie(e,"package.json");if(!rt(t))return{name:void 0,dependencyNames:[],failed:!1};let n=st(t);if(!n.ok)return{name:void 0,dependencyNames:[],failed:!0};let r=typeof n.value.name=="string"?n.value.name:void 0,i=new Set;for(let a of["dependencies","devDependencies","peerDependencies"]){let o=n.value[a];if(o&&typeof o=="object"&&!Array.isArray(o))for(let s of Object.keys(o))i.add(s)}return{name:r,dependencyNames:[...i],failed:!1}}function aa(e){let t=Ie(e,"tsconfig.json");if(rt(t))return t;let n;try{n=ea(e).filter(r=>/^tsconfig.*\.json$/.test(r))}catch{return}return n.sort((r,i)=>r.localeCompare(i)),n.length>0?Ie(e,n[0]):void 0}function oa(e,t){let n=st(e);if(!n.ok)return{pathsTargets:[],referencesPaths:[],failed:!0};let r=sa(n.value,e,t),i=pr(e,n.value,t,0);return{pathsTargets:i.pathsTargets,referencesPaths:r,failed:i.failed}}function sa(e,t,n){let r=e.references;if(!Array.isArray(r))return[];let i=it(t),a=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 c=gr(s,i,n);c&&a.add(c)}return[...a]}function pr(e,t,n,r){let i=ca(t);if(i)return{pathsTargets:da(i,it(e),n),failed:!1};if(r>=5)return{pathsTargets:[],failed:!1};let a=la(t.extends,e,n);if(!a)return{pathsTargets:[],failed:!1};let o=st(a);return o.ok?pr(a,o.value,n,r+1):{pathsTargets:[],failed:!0}}function ca(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 da(e,t,n){let r=new Set;for(let i of Object.values(e))if(Array.isArray(i))for(let a of i){if(typeof a!="string")continue;let o=gr(a,t,n);o&&r.add(o)}return[...r]}function la(e,t,n){let r=Array.isArray(e)?e.at(-1):e;if(typeof r!="string"||r.trim()===""||!r.startsWith(".")&&!r.startsWith("/"))return;let i=at(it(t),r);if(i.endsWith(".json")||(i=`${i}.json`),!i.split(or).includes("node_modules")&&$e(n,i)&&rt(i))return i}function gr(e,t,n){let r=e.replace(/\/?\*+$/,""),i=at(t,r===""?".":r);if(!$e(n,i))return;let o=ta(n,i).split(or).join("/");return o===""?".":o}function ua(e){let t="",n=0,r=!1,i=e.length;for(;n<i;){let a=e[n];if(r){if(t+=a,a==="\\"&&n+1<i){t+=e[n+1],n+=2;continue}a==='"'&&(r=!1),n+=1;continue}if(a==='"'){r=!0,t+=a,n+=1;continue}if(a==="/"&&e[n+1]==="/"){for(n+=2;n<i&&e[n]!==`
|
|
229
|
+
`;)n+=1;continue}if(a==="/"&&e[n+1]==="*"){for(n+=2;n<i&&!(e[n]==="*"&&e[n+1]==="/");)n+=1;n+=2;continue}t+=a,n+=1}return t}function st(e){try{let t=se(e,{maxBytes:Pt,inputKind:"TypeScript project manifest"}),n=JSON.parse(ua(t));return n&&typeof n=="object"&&!Array.isArray(n)?{ok:!0,value:n}:{ok:!1}}catch{return{ok:!1}}}import{writeFileSync as Ta}from"fs";import{deserializeSCIP as wa,PositionEncoding as ve,serializeSCIP as Da}from"@c4312/scip";import{rmSync as ga}from"fs";import fa from"better-sqlite3";var ma=200,ha=[`CREATE TABLE documents (
|
|
230
|
+
id INTEGER PRIMARY KEY,
|
|
231
|
+
language TEXT,
|
|
232
|
+
relative_path TEXT NOT NULL UNIQUE,
|
|
233
|
+
position_encoding TEXT,
|
|
234
|
+
text TEXT
|
|
235
|
+
)`,`CREATE TABLE chunks (
|
|
236
|
+
id INTEGER PRIMARY KEY,
|
|
237
|
+
document_id INTEGER NOT NULL,
|
|
238
|
+
chunk_index INTEGER NOT NULL,
|
|
239
|
+
start_line INTEGER NOT NULL,
|
|
240
|
+
end_line INTEGER NOT NULL,
|
|
241
|
+
occurrences BLOB NOT NULL,
|
|
242
|
+
FOREIGN KEY (document_id) REFERENCES documents(id)
|
|
243
|
+
)`,`CREATE TABLE global_symbols (
|
|
244
|
+
id INTEGER PRIMARY KEY,
|
|
245
|
+
symbol TEXT NOT NULL UNIQUE,
|
|
246
|
+
display_name TEXT,
|
|
247
|
+
kind INTEGER,
|
|
248
|
+
documentation TEXT,
|
|
249
|
+
signature BLOB,
|
|
250
|
+
enclosing_symbol TEXT,
|
|
251
|
+
relationships BLOB
|
|
252
|
+
)`,`CREATE TABLE mentions (
|
|
253
|
+
chunk_id INTEGER NOT NULL,
|
|
254
|
+
symbol_id INTEGER NOT NULL,
|
|
255
|
+
role INTEGER NOT NULL,
|
|
256
|
+
PRIMARY KEY (chunk_id, symbol_id, role),
|
|
257
|
+
FOREIGN KEY (chunk_id) REFERENCES chunks(id),
|
|
258
|
+
FOREIGN KEY (symbol_id) REFERENCES global_symbols(id)
|
|
259
|
+
)`,`CREATE TABLE defn_enclosing_ranges (
|
|
260
|
+
id INTEGER PRIMARY KEY,
|
|
261
|
+
document_id INTEGER NOT NULL,
|
|
262
|
+
symbol_id INTEGER NOT NULL,
|
|
263
|
+
start_line INTEGER NOT NULL,
|
|
264
|
+
start_char INTEGER NOT NULL,
|
|
265
|
+
end_line INTEGER NOT NULL,
|
|
266
|
+
end_char INTEGER NOT NULL,
|
|
267
|
+
FOREIGN KEY (document_id) REFERENCES documents(id),
|
|
268
|
+
FOREIGN KEY (symbol_id) REFERENCES global_symbols(id)
|
|
269
|
+
)`],ya=["CREATE INDEX idx_chunks_line_range ON chunks(document_id, start_line, end_line)","CREATE INDEX idx_mentions_symbol_id_role ON mentions(symbol_id, role)","CREATE INDEX idx_defn_enclosing_ranges_symbol_id ON defn_enclosing_ranges(symbol_id)","CREATE INDEX idx_defn_enclosing_ranges_document ON defn_enclosing_ranges(document_id, start_line, end_line)","CREATE INDEX idx_chunks_doc_id ON chunks(document_id)","CREATE INDEX idx_global_symbols_symbol ON global_symbols(symbol)"];function mr(e,t){ga(e,{force:!0});let n=new fa(j(e));try{n.pragma("journal_mode = WAL"),n.pragma("synchronous = NORMAL"),n.pragma("temp_store = MEMORY"),n.pragma("foreign_keys = ON");for(let r of ha)n.exec(r);n.transaction(()=>ba(n,t)).immediate(),n.transaction(()=>{for(let r of ya)n.exec(r)}).immediate()}finally{n.close()}}function ba(e,t){let n=Sa(e);for(let r of Ra(e,n,t))xa(e,n,r),Pa(e,n,r)}function Sa(e){let t=e.prepare("INSERT INTO global_symbols (symbol, display_name, kind, documentation, enclosing_symbol) VALUES (?, ?, ?, ?, ?)"),n=new Map,r=i=>{let a=n.get(i.symbol);if(a!==void 0)return a;let o=Number(t.run(i.symbol,i.displayName||null,i.kind||null,i.documentation.join(`
|
|
270
|
+
`)||null,i.enclosingSymbol||null).lastInsertRowid);return n.set(i.symbol,o),o};return{declared:r,referenced:i=>r({symbol:i,displayName:null,kind:null,documentation:[],enclosingSymbol:null})}}function Ra(e,t,n){let r=e.prepare("INSERT INTO documents (language, relative_path, position_encoding, text) VALUES (?, ?, ?, ?)"),i=[],a=new Set;for(let o of n){if(!o.relativePath)throw new Error("document relative path must not be empty");if(a.has(o.relativePath))continue;a.add(o.relativePath);let s=Number(r.run(o.language||null,o.relativePath,o.positionEncoding,o.text||null).lastInsertRowid);for(let c of Ea(o.symbols)){if(!c.symbol)throw new Error(`empty symbol in symbol information for document ${o.relativePath}`);he(c.symbol)||t.declared(c)}i.push({id:s,relativePath:o.relativePath,occurrences:Ia(o.occurrences)})}return i}function xa(e,t,n){let r=e.prepare(`INSERT INTO defn_enclosing_ranges (document_id, symbol_id, start_line, start_char, end_line, end_char)
|
|
271
|
+
VALUES (?, ?, ?, ?, ?, ?)`);for(let i of n.occurrences){if((i.roles&1)===0||he(i.symbol)||!i.enclosingRange)continue;let[a,o,s,c]=_a(i,n.relativePath);r.run(n.id,t.referenced(i.symbol),a,o,s,c)}}function Pa(e,t,n){let r=e.prepare("INSERT INTO chunks (document_id, chunk_index, start_line, end_line, occurrences) VALUES (?, ?, ?, ?, ?)"),i=e.prepare("INSERT INTO mentions (chunk_id, symbol_id, role) VALUES (?, ?, ?)");va(n.occurrences).forEach((a,o)=>{let s=Number(r.run(n.id,o,a.startLine,a.endLine,rn(a.occurrences)).lastInsertRowid),c=new Map;for(let l of a.occurrences){if(he(l.symbol))continue;let d=c.get(l.symbol)??new Set;d.add(l.roles),c.set(l.symbol,d)}for(let[l,d]of c){let p=t.referenced(l);for(let u of d)i.run(s,p,u)}})}function Ea(e){let t=new Map;for(let n of e){let r=t.get(n.symbol);if(!r){t.set(n.symbol,n);continue}t.set(n.symbol,{...r,documentation:[...r.documentation,...n.documentation.filter(i=>!r.documentation.includes(i))]})}return[...t.values()].sort((n,r)=>hr(n.symbol,r.symbol))}function Ia(e){let t=[...e].sort((r,i)=>fr(r.range,i.range)||hr(r.symbol,i.symbol)),n=[];for(let r of t){let i=n.at(-1);i&&i.symbol===r.symbol&&fr(i.range,r.range)===0?n[n.length-1]={...i,roles:i.roles|r.roles}:n.push(r)}return n}function va(e){let t=[],n=0;for(;n<e.length;){let r=Math.min(e.length,n+ma);for(;r<e.length&&e[r-1].range[0]===e[r].range[0];)r+=1;t.push({startLine:e[n].range[0],endLine:e[r-1].range[0],occurrences:e.slice(n,r)}),n=r}return t}function _a(e,t){let n=e.enclosingRange,[r,i,a,o]=n;if(!(r>=0&&i>=0&&(a>r&&o>=0||a===r&&o>=i)))throw new Error(`bad enclosing range ${JSON.stringify(n)} for symbol ${e.symbol} in document ${t}`);return n}function fr(e,t){return e[0]-t[0]||e[1]-t[1]||e[2]-t[2]||e[3]-t[3]}function hr(e,t){return e<t?-1:e>t?1:0}var Fa={[ve.UnspecifiedPositionEncoding]:null,[ve.UTF8CodeUnitOffsetFromLineStart]:"UTF-8",[ve.UTF16CodeUnitOffsetFromLineStart]:"UTF-16",[ve.UTF32CodeUnitOffsetFromLineStart]:"UTF-32"};function br(e,t,n){let r=wa(A(e,{inputKind:"SCIP index store input",maxBytes:Q})),i={removedDefinitionOccurrences:0,touchedDocuments:0};if(n.sanitize){let a=Zt(r);a.touchedDocuments>0&&(Ta(e,Buffer.from(Da(a.index))),r=a.index),i={removedDefinitionOccurrences:a.removedDefinitionOccurrences,touchedDocuments:a.touchedDocuments}}return mr(t,r.documents.map(ka)),i}function ka(e){let t=Fa[e.positionEncoding];if(t===void 0)throw new Error(`unknown position encoding ${e.positionEncoding} in ${e.relativePath}`);return{relativePath:e.relativePath,language:e.language||null,positionEncoding:t,text:e.text||null,symbols:e.symbols.map(n=>({symbol:n.symbol,displayName:n.displayName||null,kind:n.kind||null,documentation:n.documentation,enclosingSymbol:n.enclosingSymbol||null})),occurrences:e.occurrences.flatMap(n=>{let r=yr(n.range);return r?[{symbol:n.symbol,roles:n.symbolRoles,range:r,enclosingRange:yr(n.enclosingRange)}]:[]})}}function yr(e){return e.length===3?[e[0],e[1],e[0],e[2]]:e.length===4?[e[0],e[1],e[2],e[3]]:null}import{createHash as Ba}from"crypto";import{existsSync as ct,statSync as Wa,writeFileSync as dt}from"fs";import{join as qa}from"path";import{randomUUID as ja}from"crypto";import{existsSync as Oa}from"fs";var La=12e4,Na=5,_e=class{projectRoot;cacheDir;baseGeneration;timeoutMs;runtime;mailboxLimits;constructor(t,n={}){this.projectRoot=wt(t.projectRoot),this.cacheDir=t.cacheDir,this.baseGeneration=t.baseGeneration,this.timeoutMs=n.timeoutMs??Ua(),this.runtime=n.runtime??Ga,this.mailboxLimits=n.mailboxLimits??{}}request(t){let n=wn(this.cacheDir),r=_n(this.cacheDir),i=Xe(n.statePath);if(!Sr(i,this.projectRoot,this.runtime))throw new Error("Compatible TypeScript index service is not running.");let a=this.runtime.now(),o=a+this.timeoutMs,s=(this.runtime.monotonicNow??S)()+this.timeoutMs,c=En("typescript-index-v4",{baseGeneration:this.baseGeneration,request:t}),l=In(c),d=vn(r,{mailboxVersion:Pn,operationKey:c,clientId:this.runtime.randomId(),enqueuedAtMs:a,deadlineAtMs:o,protocolVersion:Se,id:l,baseGeneration:this.baseGeneration,request:t},{nowMs:a,limits:this.mailboxLimits});for(;(this.runtime.monotonicNow??S)()<=s;){if(Oa(d.responsePath))return Aa(se(d.responsePath,{maxBytes:this.mailboxLimits.maxItemBytes??64*1024*1024,inputKind:"TypeScript index mailbox response"}),l,c,this.baseGeneration,t.producerIdentity,t.affectedFiles);let p=Xe(n.statePath);if(!Sr(p,this.projectRoot,this.runtime))throw new Error("TypeScript index service stopped while processing a request.");this.runtime.sleep(Na)}throw new Error(`TypeScript index service timed out after ${this.timeoutMs}ms.`)}};function Sr(e,t,n){let r=e?.processIdentity?n.readProcessIdentity?.(e.pid):null;return e!==null&&e.projectRoot===t&&e.typescriptIndex?.protocolVersion===Se&&n.isProcessAlive(e.pid)&&(!e.processIdentity||r!=null&&ee(e.processIdentity,r))}function Aa(e,t,n,r,i,a){let o=JSON.parse(e);if(o.protocolVersion!==Se||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=Ma(o.response,i),c=[...new Set(a)].sort(),l=s.fragments.map(d=>d.relativePath).sort();if(JSON.stringify(l)!==JSON.stringify(c))throw new Error("TypeScript index service omitted or added an affected document.");return s}function Ma(e,t){if(!e||typeof e!="object")throw new Error("TypeScript index service wrote an invalid response.");let n=e;if(n.producerIdentity!==t||typeof n.cold!="boolean"||typeof n.durationMs!="number"||!Number.isFinite(n.durationMs)||!Array.isArray(n.fragments))throw new Error("TypeScript index service wrote an invalid response.");let r=new Set,i=n.fragments.map(a=>{if(!a||typeof a.relativePath!="string"||a.bytesBase64!==null&&typeof a.bytesBase64!="string"||typeof a.occurrences!="number"||!Number.isInteger(a.occurrences)||a.occurrences<0||typeof a.symbols!="number"||!Number.isInteger(a.symbols)||a.symbols<0||!Array.isArray(a.referenceFragments)||!a.referenceFragments.every(Ca)||r.has(a.relativePath))throw new Error("TypeScript index service wrote an invalid fragment.");r.add(a.relativePath);let o=a.bytesBase64===null?null:$a(a.bytesBase64);return{relativePath:a.relativePath,bytes:o,occurrences:a.occurrences,symbols:a.symbols,referenceFragments:a.referenceFragments}});return{producerIdentity:n.producerIdentity,cold:n.cold,durationMs:n.durationMs,fragments:i}}function Ca(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 $a(e){let t=Buffer.from(e,"base64");if(t.toString("base64")!==e)throw new Error("TypeScript index service wrote invalid base64.");return t}function Ua(){let e=Number(process.env.SCIP_TYPESCRIPT_INDEX_TIMEOUT_MS);return Number.isInteger(e)&&e>0?e:La}var Ga={now:Date.now,monotonicNow:S,randomId:ja,sleep(e){let t=new Int32Array(new SharedArrayBuffer(4));Atomics.wait(t,0,0,e)},isProcessAlive:J,readProcessIdentity:H};function Ha(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=de(e.previousSnapshot,e.currentSnapshot);if(n.changes.length===0)return{eligible:!1,reason:"no changed project inputs"};if(n.changes.some(d=>d.kind!=="modified"||d.inputKind!=="source"||!Be(d.path)))return{eligible:!1,reason:"change is not a modified TypeScript source file"};let r=Re(n,e.graph,e.projectFiles);if(r.mode!=="closure"||r.affectedFiles.length===0)return{eligible:!1,reason:r.reasons.length>0?`affected set widened: ${r.reasons.join(", ")}`:"empty affected set"};let i=Ja(r,t,e.graph);if(!i)return{eligible:!1,reason:"affected files cross or ambiguously match TypeScript projects"};let a=Rr(e.currentSnapshot,e.projectFiles,e.producerIdentity),o=Rr(e.previousSnapshot,e.projectFiles,e.producerIdentity);if(a!==o)return{eligible:!1,reason:"TypeScript fragment project identity changed"};let s=Pr(e.previousSnapshot,e.projectFiles,e.graph,e.producerIdentity,e.projectFiles);if(!s)return{eligible:!1,reason:"prior document identity unavailable"};let c=Pr(e.currentSnapshot,e.projectFiles,e.graph,e.producerIdentity,r.affectedFiles);if(!c)return{eligible:!1,reason:"next document identity unavailable"};let l=i.length===1?i[0]:void 0;return{eligible:!0,manifest:n,plan:r,projectIdentity:a,previousFragmentGeneration:xr(e.previousSnapshot,e.producerIdentity),nextFragmentGeneration:xr(e.currentSnapshot,e.producerIdentity),previousDocumentIdentities:s,nextDocumentIdentities:c,projects:i,...l?{tsconfigPath:l.tsconfigPath,projectArgument:l.projectArgument}:{}}}function Ja(e,t,n){let r=new Map;for(let a of e.affectedFiles){let o=za(a,t);if(!o)return null;let s=r.get(o)??[];s.push(a),r.set(o,s)}let i=[];for(let[a,o]of[...r].sort(([s],[c])=>s.localeCompare(c))){let s=new Set(o),c=e.changedFiles.filter(l=>s.has(l)||o.some(d=>Xa(d,l,n)));if(c.length===0)return null;i.push({projectArgument:a,tsconfigPath:a==="."?"tsconfig.json":`${a}/tsconfig.json`,modifiedFiles:c,affectedFiles:[...o].sort()})}return i}function za(e,t){let n=t.filter(a=>a==="."||e===a||e.startsWith(`${a}/`));if(n.length===0)return null;let r=[...new Set(n)].sort((a,o)=>Te(o)-Te(a)||a.localeCompare(o)),i=r[0];return r[1]&&Te(r[1])===Te(i)?null:i}function Te(e){return e==="."?0:e.split("/").filter(Boolean).length}function Xa(e,t,n){let r=new Set,i=[e];for(let a=0;a<i.length;a+=1){let o=i[a];if(!(!o||r.has(o))){r.add(o);for(let s of n.get(o)??[]){if(s===t)return!0;r.has(s)||i.push(s)}}}return!1}function Er(e){let t=S();try{if(!ct(e.previousDbPath)||!ct(e.previousShardPath))throw new Error("prior TypeScript graph or language shard unavailable");let n=performance.now(),r=ze();if(!r.available)throw new Error(r.reason);let i=performance.now()-n;n=performance.now();let a=new F({projectRoot:e.projectRoot,dbPath:e.previousDbPath,indexPath:e.previousIndexPath}),o,s;try{o=fe(a,{includeIgnored:!1}).filter(Be).sort(),s=me(a)}finally{a.close()}let c=performance.now()-n,l=Ha({projectMode:e.projectMode,workspaceProjects:e.projectMode==="workspace"?z(e.projectRoot,e.currentSnapshot.typescriptProjects):void 0,previousSnapshot:e.previousSnapshot,currentSnapshot:e.currentSnapshot,projectFiles:o,graph:s,producerIdentity:r.producerIdentity,rootTsconfigExists:ct(qa(e.projectRoot,"tsconfig.json"))});if(!l.eligible)throw new Error(l.reason);let d=Tn(e.previousDbPath);if(!d)throw new Error("published TypeScript base generation unavailable");n=performance.now();let p=new _e({projectRoot:e.projectRoot,cacheDir:e.cacheDir,baseGeneration:d}),u=l.projects.map(b=>p.request({kind:"emit-documents",tsconfigPath:b.tsconfigPath,projectArgument:b.projectArgument,projectIdentity:l.projectIdentity,producerIdentity:r.producerIdentity,modifiedFiles:b.modifiedFiles,affectedFiles:b.affectedFiles})),g=u.flatMap(b=>b.fragments),m=performance.now()-n,x=Wa(e.previousShardPath).size>=ln;n=performance.now();let _=x?null:A(e.previousShardPath,{inputKind:"TypeScript base SCIP shard",maxBytes:Q}),f=x?{completeIndexBytes:null,affectedIndexBytes:an(g)}:cn({packageVersion:r.packageVersion,baseIndexBytes:_,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:_,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 R=performance.now()-n;n=performance.now(),f.completeIndexBytes&&dt(e.candidateShardPath,f.completeIndexBytes),dt(e.candidateAffectedScipPath,f.affectedIndexBytes);let E=performance.now()-n,P={scipPath:x?e.previousShardPath:e.candidateShardPath,candidateScipPath:e.candidateShardPath,affectedScipPath:e.candidateAffectedScipPath,completeScipUpdated:!x,durationMs:S()-t,cold:u.some(b=>b.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(b=>[b.relativePath,b.referenceFragments])),timings:{runtimeMs:i,graphMs:c,requestMs:m,serviceMs:u.reduce((b,B)=>b+B.durationMs,0),assemblyMs:y,fragmentStoreMs:R,writeMs:E}};return e.onStatus(`Incremental TypeScript index emitted ${P.affectedFiles.length} affected document(s) across ${l.projects.length} project(s) in ${(P.durationMs/1e3).toFixed(3)}s (${P.cold?"cold":"warm"} service; ${x?"whole SCIP deferred":"whole SCIP current"}; runtime ${i.toFixed(0)}ms, graph ${c.toFixed(0)}ms, request ${m.toFixed(0)}ms, assembly ${y.toFixed(0)}ms, fragments ${R.toFixed(0)}ms, write ${E.toFixed(0)}ms).`),P}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 Ir(e){let t=ze();if(!t.available)throw new Error(t.reason);let n=pn({cacheDir:e.cacheDir,generationIdentity:e.generationIdentity,baseIndexBytes:A(e.baseShardPath,{inputKind:"TypeScript base SCIP shard",maxBytes:Q}),packageVersion:t.packageVersion});dt(e.candidateShardPath,n)}function Rr(e,t,n){let r=e.files.filter(i=>It(i.path,e.languages)!=="source").map(i=>({path:i.path,size:i.size,hash:i.hash})).sort((i,a)=>i.path.localeCompare(a.path));return lt(JSON.stringify({version:1,producerIdentity:n,pnpmWorkspaces:e.pnpmWorkspaces,typescriptProjectMode:e.typescriptProjectMode,typescriptProjects:[...e.typescriptProjects].sort(),projectFiles:[...t].sort(),nonSourceInputs:r}))}function xr(e,t){return lt(JSON.stringify({version:1,producerIdentity:t,snapshot:e}))}function Pr(e,t,n,r,i){let a=new Set(e.files.map(c=>c.path)),o=Ht({projectFiles:t.filter(c=>a.has(c)),snapshot:e,graph:n,engineIdentity:r}),s=new Map;for(let c of i){let l=o.identityFor(c,"typescript-scip-document-v1");if(l.key){s.set(c,l.key);continue}if(a.has(c))return null;s.set(c,lt(JSON.stringify({version:1,producerIdentity:r,generatedDocument:c})))}return s}function lt(e){return Ba("sha256").update(e).digest("hex")}import{closeSync as Ya,existsSync as we,fstatSync as Va,lstatSync as Qa,openSync as Ka,renameSync as pt,rmSync as De,statSync as Za,writeSync as eo}from"fs";import{cpus as to}from"os";import{join as gt}from"path";function no(e,t){if(e.temporaryRootConfigContent===void 0)return null;let n=gt(t,"tsconfig.json"),r=Buffer.from(e.temporaryRootConfigContent,"utf8"),i;try{i=Ka(n,"wx",384)}catch(a){if(a.code==="EEXIST")return null;throw a}try{eo(i,r);let a=Va(i);return{path:n,content:r,device:a.dev,inode:a.ino}}finally{Ya(i)}}function ro(e){if(e)try{let t=Qa(e.path);if(!t.isFile()||t.dev!==e.device||t.ino!==e.inode||t.size!==e.content.byteLength)return;let n;try{n=A(e.path,{maxBytes:e.content.byteLength,inputKind:"temporary TypeScript index configuration"})}catch{return}if(!n.equals(e.content))return;De(e.path)}catch(t){if(t.code!=="ENOENT")throw t}}function io(e,t,n){if(!e.defaultOutputPath)return;let r=gt(t,e.defaultOutputPath);n!==r&&we(r)&&pt(r,n)}function ao(e,t,n){if(!e.defaultOutputPath)return null;let r=gt(t,e.defaultOutputPath);if(r===n)return null;let i=`${n}.default-output-backup`;return De(i,{force:!0}),we(r)?(pt(r,i),{defaultOutputPath:r,backupPath:i}):{defaultOutputPath:r,backupPath:null}}function oo(e){e&&(De(e.defaultOutputPath,{force:!0}),e.backupPath&&we(e.backupPath)&&pt(e.backupPath,e.defaultOutputPath))}function so(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,to().length));return Math.max(1,Math.min(e,Math.floor(r)))}async function _r(e,t,n,r,i){D(i,"Reindex cancelled by its owner.");let a=e.filter(d=>d.config.defaultOutputPath),o=e.filter(d=>!d.config.defaultOutputPath),s=[],c=so(o.length,r),l=await jn(o,c,d=>ut(d,t,n,i));if(c>1){let d=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...`),D(i,"Reindex cancelled by its owner."),d.set(u.id,(await ut(u,t,n,i)).result))}s.push(...l.map(({result:p})=>d.get(p.id)??p))}else s.push(...l.map(({result:d})=>d));for(let d of a)D(i,"Reindex cancelled by its owner."),s.push((await ut(d,t,n,i)).result);return s.sort((d,p)=>e.findIndex(u=>u.id===d.id)-e.findIndex(u=>u.id===p.id))}async function ut(e,t,n,r){D(r,"Reindex cancelled by its owner."),n(`Indexing ${e.label} with ${e.resolvedBinary}...`),De(e.scipPath,{force:!0});let i=ao(e.config,t,e.scipPath),a=no(e,t),o=[e.binary,...e.args].join(" "),s=S();try{e.trustedProjectTool&&Gt(t,e.trustedProjectTool);let l=Lt(e.binary,e.args),d=await kn({command:l.binary,args:l.args,label:`${e.label} indexer`,cwd:t,env:e.env,timeoutMs:co(),maxStdoutBytes:50*1024*1024,maxStderrBytes:50*1024*1024,signal:r});if(d.status!==0){let p=d.stderr.trim();throw new Error(`${e.resolvedBinary} exited with status ${d.status}${p?`:
|
|
272
|
+
${p}`:""}`)}io(e.config,t,e.scipPath)}catch(l){if(r?.aborted)throw Dt(r,"Reindex cancelled by its owner.");let d=l instanceof Error?l.message:String(l),p=`${e.resolvedBinary} indexer failed: ${d.split(`
|
|
273
|
+
`)[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:S()-s,command:o,skipped:{language:e.language,reason:u}},retryable:lo(l)}}finally{oo(i),ro(a)}if(!we(e.scipPath)){let l=`${e.resolvedBinary} indexer completed but did not produce ${e.scipPath}`,d=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:S()-s,command:o,skipped:{language:e.language,reason:d}},retryable:!1}}let c;try{c=Za(e.scipPath).size}catch{c=void 0}return{result:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,durationMs:S()-s,command:o,outputBytes:c},retryable:!1}}function co(){let e=Number(process.env.CODEBASEIQ_INDEXER_TIMEOUT_MS);return Number.isFinite(e)&&e>0?Math.floor(e):Dn.indexer}function lo(e){return e instanceof Fn?e.kind==="spawn"&&vr(e.cause):vr(e)}function vr(e){let t=e?.code;return t==="EAGAIN"||t==="ENOMEM"||t==="EMFILE"||t==="ENFILE"||t==="ETXTBSY"}import{execFileSync as wr}from"child_process";import{homedir as Tr,platform as uo}from"os";import{delimiter as po,join as Fe}from"path";function Dr(e,t){let n=e.installMethods,r=ge(e);if(!n?.length)return t(`No auto-install method available for ${r}.`),e.installUrl&&t(`Install manually from: ${e.installUrl}`),!1;for(let i of n){if(!i.identity||!i.destination){t(`Refusing ${i.label} installation for ${r}: the installer descriptor lacks an immutable identity or destination.`);continue}if(!Ot(i.prerequisite))continue;let a=go(i);t(`Installing immutable ${i.identity} via ${i.label} into ${a}; expected executable: ${r}.`);try{wr(i.binary,i.args,{stdio:"inherit",windowsHide:!0,timeout:3e5,env:process.env,shell:uo()==="win32"});let o=te(e);if(o){let s=o===e.indexerBinary?"":` (using ${o})`;return t(`Successfully installed ${i.identity} via ${i.label}${s}; resolved executable: ${o}.`),!0}t(`${i.label} command completed but ${r} was not found on PATH`)}catch(o){let s=o instanceof Error?o.message:String(o);t(`${i.label} install failed: ${s}`)}}return t(`Could not auto-install ${r}.`),e.installUrl&&t(`Install manually from: ${e.installUrl}`),!1}function go(e){if(e.binary==="npm")return ft("npm",["root","-g"])??e.destination;if(e.binary==="go"){let t=ft("go",["env","GOBIN"]);if(t)return t;let n=ft("go",["env","GOPATH"]);if(n)return Fe(n.split(po)[0],"bin")}return e.binary==="dotnet"?Fe(process.env.DOTNET_CLI_HOME??Tr(),".dotnet","tools"):e.binary==="dart"?Fe(process.env.PUB_CACHE??Fe(Tr(),".pub-cache"),"bin"):e.destination}function ft(e,t){try{return wr(e,t,{stdio:["ignore","pipe","ignore"],windowsHide:!0,encoding:"utf8",timeout:1e4,killSignal:"SIGKILL",env:process.env}).trim()||null}catch{return null}}async function zd(e){let{projectRoot:t,maxHeapMb:n=8192,onStatus:r=console.log}=e,i=e.skipAutoInstall===!0||e.installMissing!==!0,a=So(e),o=Date.now(),s=S();je(h(a.outputScip),{recursive:!0}),je(h(a.outputDb),{recursive:!0});let c=e.languages??We(t);if(c.length===0)throw new Error("No supported languages detected in this project. Looked for: tsconfig.json, Cargo.toml, go.mod, pyproject.toml, etc.");r(`Detected languages: ${c.join(", ")}`);let l=ue("reindex.fingerprint",()=>Mt(t,c,{pnpmWorkspaces:e.pnpmWorkspaces,typescriptProjectMode:e.typescriptProjectMode,typescriptProjects:e.typescriptProjects,clojureConfigPath:e.clojureConfigPath}),{languages:c.length}),d,p;if(e.skipIfUnchanged!==!1&&!hn(t,a.outputDb)&&Fr(a.outputScip)===Fr(v(h(a.outputDb),"index.scip"))){let f=pe(t);if(d=f?.clean?ye(f,l):void 0,f&&!f.clean&&!bo(a)){let y=yn(f,c,{pnpmWorkspaces:e.pnpmWorkspaces,typescriptProjectMode:e.typescriptProjectMode,typescriptProjects:e.typescriptProjects,clojureConfigPath:e.clojureConfigPath});if(y)try{be({snapshot:y.snapshot,manifest:y.manifest,targetCacheDir:h(a.outputDb),targetProjectRoot:t,persistLease:!1}),xn(y.snapshot,h(a.outputDb)),r(`Forked shared baseline ${y.snapshot.generationId.slice(0,12)} for dirty worktree reindex`)}catch(R){r(`Shared baseline fork failed; continuing locally: ${N(R)}`)}}else if(d){let y=Je(d);if(y){if(!yo(a,l))try{be({snapshot:d,manifest:y,targetCacheDir:h(a.outputDb),targetProjectRoot:t}),r(`Attached shared generation ${d.generationId.slice(0,12)}`)}catch(R){r(`Shared generation attach failed; continuing locally: ${N(R)}`)}}else{let R=await Sn(d);if(R.kind==="owner")p=R.release;else if(R.kind==="generation-ready"){let E=Je(d);if(E)try{be({snapshot:d,manifest:E,targetCacheDir:h(a.outputDb),targetProjectRoot:t,action:"waited"}),r(`Attached shared generation ${d.generationId.slice(0,12)} after waiting`)}catch(P){r(`Shared generation attach failed after waiting; continuing locally: ${N(P)}`)}}else r("Shared generation build lock timed out; continuing with an isolated local reindex")}}}let g=jt(v(h(a.outputDb),"cache-lifecycle.lock"),{waitMs:3e4});if(!g)throw p?.(),new Error(`Could not acquire codebaseiq cache lifecycle lock for ${h(a.outputDb)}.`);let m;try{m=await Z("reindex.lock",()=>Ho(v(h(a.outputDb),"index.lock"),{projectRoot:t,trigger:e.trigger,onStatus:r}),{languages:c.length})}catch(f){throw g.release(),p?.(),f}let x=null,_=Ln();try{mn(a.outputDb,a.outputScip,a.metaPath);let f=Eo(h(a.outputDb));f.removed>0&&r(`Removed ${f.removed} abandoned reindex workspace(s)`);for(let W of f.errors)r(`Could not remove abandoned reindex workspace: ${W}`);let y=null,R=ue("reindex.reuse-check",()=>(y=Ro({opts:e,paths:a,languages:c,fingerprint:l,start:o,monotonicStart:s,onStatus:r}),y),()=>({languages:c.length,reused:y!==null}));if(R){kr({snapshot:d,paths:a,projectRoot:t,fingerprint:l,onStatus:r});let W=qe(a.outputDb,R);return W.state==="failed"&&r(`Warning: reindex succeeded, but activity telemetry was not recorded: ${W.reason}`),Ue(t,h(a.outputDb)),R}let E=Po(a);x=E.runDir;let P,b=await Z("reindex.fresh",async()=>(P=await Io({opts:e,languages:c,projectRoot:t,paths:a,tempPaths:E,fingerprint:l,start:o,monotonicStart:s,maxHeapMb:n,skipAutoInstall:i,onStatus:r,writeTelemetry:_}),P),()=>({languages:c.length,reused:P?.reused,skipped:P?.skipped.length}));kr({snapshot:d,paths:a,projectRoot:t,fingerprint:l,onStatus:r});let B=qe(a.outputDb,b);return B.state==="failed"&&r(`Warning: reindex succeeded, but activity telemetry was not recorded: ${B.reason}`),Ue(t,h(a.outputDb)),b}catch(f){let y=Ne({trigger:e.trigger,result:"failed",start:o,monotonicStart:s,error:f instanceof Error?f.message:String(f)});Qr(a.metaPath,y);let R=nn(a.outputDb,y);throw R.state==="failed"&&r(`Warning: failed reindex activity telemetry was not recorded: ${R.reason}`),f}finally{if(x){let f=x;try{q(()=>Y(f,{recursive:!0,force:!0}))}catch(y){r(`Warning: temporary reindex workspace was left behind: ${N(y)}`)}}m(),g.release(),p?.()}}function kr(e){if(e.snapshot)try{let t=pe(e.projectRoot),n=t?ye(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=bn({snapshot:e.snapshot,sourceCacheDir:h(e.paths.outputDb),sourceProjectRoot:e.projectRoot,sourceStillValid:()=>{let i=pe(e.projectRoot);return(i?ye(i,e.fingerprint):void 0)?.generationId===e.snapshot?.generationId}});Rn(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: ${N(t)}`)}}function yo(e,t){if(!T(e.outputScip)||!T(e.outputDb)||!Vr(e.metaPath,t))return!1;let n=$(e.outputDb,e.metaPath);return n.state!=="invalid"&&n.state!=="drifted"}function bo(e){if(!T(e.outputScip)||!T(e.outputDb)||!V(e.metaPath))return!1;let t=$(e.outputDb,e.metaPath);return t.state!=="invalid"&&t.state!=="drifted"}function N(e){return e instanceof Error?e.message:String(e)}function yt(e,t,n,r,i,a){try{re(Nn({indexPath:n,reuseExisting:i,affectedFiles:a}),{projectRoot:e,dbPath:t,onStatus:r})}catch(o){r(`Runtime-boundary extraction unavailable: ${o instanceof Error?o.message:String(o)}.`)}}function So(e){let t=e.outputScip??v(e.projectRoot,"index.scip"),n=e.outputDb??v(e.projectRoot,"index.db");return{outputScip:t,outputDb:n,metaPath:v(h(n),"meta.json")}}function Ro(e){let t=$(e.paths.outputDb,e.paths.metaPath);if(e.opts.skipIfUnchanged===!1||!T(e.paths.outputScip)||!T(e.paths.outputDb)||!Vr(e.paths.metaPath,e.fingerprint)||t.state==="invalid"||t.state==="drifted")return null;re(ne(),{projectRoot:e.opts.projectRoot,dbPath:e.paths.outputDb,onStatus:e.onStatus}),yt(e.opts.projectRoot,e.paths.outputDb,e.paths.outputScip,e.onStatus,!0),$(e.paths.outputDb,e.paths.metaPath).state==="drifted"&&(He(e.paths.outputDb,e.paths.metaPath),e.onStatus("Published refreshed SQLite generation after post-index augmentation"));let n=S()-e.monotonicStart,r=Ne({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:xo(e.paths,e.opts.projectRoot,e.languages,e.opts)}}function xo(e,t,n,r){let i=Xr(t,n,r);return n.map(a=>({id:a,language:a,reused:!0,fingerprint:ie(i[a]),outputBytes:ae(St(e.outputDb,a)),durationMs:0}))}function Po(e){let t=_t(v(h(e.outputDb),"reindex-"));return{runDir:t,tempOutputScip:v(t,ke(e.outputScip)),tempOutputDb:v(t,ke(e.outputDb)),tempMetaPath:v(t,ke(e.metaPath))}}function Eo(e){let t=[],n;try{n=Cr(e,{withFileTypes:!0})}catch(i){return{removed:0,errors:[N(i)]}}let r=0;for(let i of n)if(!(!i.name.startsWith("reindex-")||!i.isDirectory()))try{Y(v(e,i.name),{recursive:!0,force:!0}),r+=1}catch(a){t.push(`${i.name}: ${N(a)}`)}return{removed:r,errors:t}}async function Io(e){let t={...process.env,NODE_OPTIONS:`--max-old-space-size=${e.maxHeapMb}`},n,r=await Z("reindex.language-indexers",async()=>(n=await _o(e,t),n),()=>({languages:e.languages.length,indexed:n?.indexedOutputs.length,reused:n?.reusedLanguages.length,skipped:n?.skippedLanguages.length})),{indexedOutputs:i,skippedLanguages:a,reusedLanguages:o,languageFingerprints:s,shards:c,typescriptProjectShardContext:l,incrementalTypeScript:d}=r;if(o.length>0&&e.onStatus(`Reused ${o.length} cached language shard(s): ${o.join(", ")}`),vo({run:e,indexedOutputs:i,skippedLanguages:a,reusedLanguages:o})){let g=ue("reindex.publish",()=>No(e,i,a,o,s,l),{mode:"metadata-only",languages:i.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:i.map(x=>x.language),indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:m,reused:!0,skipped:a,lastRefresh:g,shards:c,writeTelemetry:e.writeTelemetry}}let p=await Z("reindex.publish",()=>Lo(e,t,i,a,o,s,l,d),{mode:d?"incremental-or-fallback":"full",languages:i.length,reused:o.length,skipped:a.length}),u=p.durationMs;return e.onStatus(`Done in ${(u/1e3).toFixed(1)}s`),{languages:i.map(g=>g.language),indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:u,reused:!1,skipped:a,lastRefresh:p,shards:c,writeTelemetry:e.writeTelemetry}}function vo(e){if(e.run.opts.skipIfUnchanged===!1||e.skippedLanguages.length>0||!T(e.run.paths.outputScip)||!T(e.run.paths.outputDb))return!1;let t=$(e.run.paths.outputDb,e.run.paths.metaPath);if(t.state==="invalid"||t.state==="drifted")return!1;let n=new Set(e.reusedLanguages),r=new Set(e.indexedOutputs.map(i=>i.language));return e.run.languages.length>0&&r.size===e.run.languages.length&&e.indexedOutputs.length===e.run.languages.length&&e.run.languages.every(i=>n.has(i)&&r.has(i))}async function _o(e,t){let n=ko({paths:e.paths,projectRoot:e.projectRoot,languages:e.languages,pnpmWorkspaces:e.opts.pnpmWorkspaces,typescriptProjectMode:e.opts.typescriptProjectMode,typescriptProjects:e.opts.typescriptProjects,clojureConfigPath:e.opts.clojureConfigPath}),r=[],i=new Set;for(let[w,xt]of n)xt.reused&&(r.push({language:w,scipPath:xt.scipPath}),i.add(w));for(let w of i)e.onStatus(`Reusing cached ${w} SCIP shard (language inputs unchanged).`);let a=n.get("typescript"),o=$(e.paths.outputDb,e.paths.metaPath),s=V(e.paths.metaPath),c=(o.state==="legacy"||o.state==="current")&&s!==null&&Ce(s),l=s?.scipCompanion!=="deferred"&&(o.state!=="current"||o.generation.publication?.scipCompanion!=="deferred"),d=a&&!a.reused&&c?Er({projectRoot:e.projectRoot,cacheDir:h(e.paths.outputDb),previousDbPath:e.paths.outputDb,previousIndexPath:e.paths.outputScip,previousShardPath:a.scipPath,candidateShardPath:oe(e.tempPaths.tempOutputScip,"typescript-incremental",0),candidateAffectedScipPath:oe(e.tempPaths.tempOutputScip,"typescript-affected",0),baseShardCurrent:l,previousSnapshot:bt(e.paths.metaPath),currentSnapshot:e.fingerprint,projectMode:e.opts.typescriptProjectMode,onStatus:e.onStatus}):null,p=new Set(d?["typescript"]:[]),u=d?void 0:To(e,n),{preparedRuns:g,skippedLanguages:m,languageOutputScipPaths:x}=Co({languages:e.languages.filter(w=>!i.has(w)&&!p.has(w)),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}),_=u?g.filter(w=>w.language!=="typescript"||u.missedProjectIds.has(w.id)):g,f=await _r(_,e.projectRoot,e.onStatus,e.opts.indexerConcurrency,e.opts.signal),y=[];if(u){Do(e.paths.outputDb,f,e.writeTelemetry);let w=x.typescript??e.tempPaths.tempOutputScip;y=Fo({outputDb:e.paths.outputDb,tempOutputScip:e.tempPaths.tempOutputScip,outputScipPath:w,reusedProjects:u.reusedProjects,writeTelemetry:e.writeTelemetry})}let R=[...f,...y],{indexedOutputs:E}=Uo(R,m),P=d?[{language:"typescript",scipPath:d.scipPath}]:[],b=[...r,...P,...E];Go(b,m,e.languages,e.opts.allowPartial,e.onStatus);let B=d?[{id:"typescript",language:"typescript",label:"typescript (incremental documents)",scipPath:d.scipPath,outputScipPath:d.scipPath,durationMs:d.durationMs,command:"watch-service:typescript-index",outputBytes:ae(d.scipPath)??void 0}]:[],W=jo(n,[...f,...B],u?{outputDb:e.paths.outputDb,classification:u.classification}:void 0);return{indexedOutputs:b,skippedLanguages:m,reusedLanguages:[...i],languageFingerprints:Oo(n,e.languages),shards:W,typescriptProjectShardContext:u?{projects:u.allProjects,fingerprints:u.fingerprints}:void 0,incrementalTypeScript:d??void 0}}function To(e,t){let n=t.get("typescript");if(!n||n.reused||e.opts.typescriptProjectMode!=="workspace")return;let r=z(e.projectRoot,e.opts.typescriptProjects);if(r.length===0)return;let i=lr(e.projectRoot,r),a=sr(n.fingerprint.files,r),o=cr(r,i),s=dr(r,a,o),c=V(e.paths.metaPath),d=wo(c,s,m=>T(Le(e.paths.outputDb,m))),p=[...d.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:d,reusedProjects:p,missedProjectIds:g}}function wo(e,t,n){let r=new Map;for(let i of Object.keys(t)){let a=t[i];if(!e){r.set(i,{reused:!1,reason:"no reindex metadata found",fingerprint:a});continue}let o=e.version===K&&Me(e).typescriptProjectShardReuse?e.typescriptProjectShards?.[i]:void 0;if(!o){r.set(i,{reused:!1,reason:"no cached fingerprint for this project",fingerprint:a});continue}if(!n(i)){r.set(i,{reused:!1,reason:"cached shard file missing on disk",fingerprint:a});continue}if(k(o)!==k(a)){r.set(i,{reused:!1,reason:"project inputs changed since last index",fingerprint:a});continue}r.set(i,{reused:!0,fingerprint:a})}return r}function Do(e,t,n){for(let r of t){if(r.skipped||!r.id.startsWith("typescript:"))continue;let i=r.id.slice(11),a=Le(e,i);je(h(a),{recursive:!0}),G(n,U(r.scipPath,a))}}function Fo(e){return e.reusedProjects.map((t,n)=>{let r=Le(e.outputDb,t),i=oe(e.tempOutputScip,"typescript-project-cached",n);return G(e.writeTelemetry,U(r,i)),{id:`typescript:${t}`,language:"typescript",label:`typescript (${t})`,scipPath:i,outputScipPath:e.outputScipPath,durationMs:0,command:"cached",outputBytes:ae(i)??void 0}})}function ko(e){let t=V(e.paths.metaPath),n=Xr(e.projectRoot,e.languages,e),r=new Map;for(let i of e.languages){let a=St(e.paths.outputDb,i),o=n[i];if(!t){r.set(i,{reused:!1,reason:"no reindex metadata found",fingerprint:o,scipPath:a});continue}if(t.version!==K){r.set(i,{reused:!1,reason:`metadata version ${String(t.version??"unknown")} predates per-language shard caching`,fingerprint:o,scipPath:a});continue}if(i==="typescript"&&t.scipCompanion==="deferred"){r.set(i,{reused:!1,reason:"whole TypeScript SCIP companion is deferred behind changed-document overlays",fingerprint:o,scipPath:a});continue}if(!Me(t).languageShardReuse||!t.languageFingerprints){r.set(i,{reused:!1,reason:"no per-language fingerprints recorded in metadata",fingerprint:o,scipPath:a});continue}let s=t.languageFingerprints[i];if(!s){r.set(i,{reused:!1,reason:"no cached fingerprint for this language",fingerprint:o,scipPath:a});continue}if(!T(a)){r.set(i,{reused:!1,reason:"cached shard file missing on disk",fingerprint:o,scipPath:a});continue}if(k(s)!==k(o)){r.set(i,{reused:!1,reason:"language inputs changed since last index",fingerprint:o,scipPath:a});continue}r.set(i,{reused:!0,fingerprint:o,scipPath:a})}return r}function jo(e,t,n){let r=[];for(let[i,a]of e)a.reused&&r.push({id:i,language:i,reused:!0,fingerprint:ie(a.fingerprint),outputBytes:ae(a.scipPath),durationMs:0});for(let i of t){let a=e.get(i.language),o=n&&i.id.startsWith("typescript:")?i.id.slice(11):null,s=o?n.classification.get(o):void 0;r.push({id:i.id,language:i.language,reused:!1,missReason:s?.reason??a?.reason??i.skipped?.reason,fingerprint:s?ie(s.fingerprint):a?ie(a.fingerprint):"unknown",outputBytes:i.outputBytes??null,durationMs:i.durationMs,command:i.command})}if(n)for(let[i,a]of n.classification)a.reused&&r.push({id:`typescript:${i}`,language:"typescript",reused:!0,fingerprint:ie(a.fingerprint),outputBytes:ae(Le(n.outputDb,i)),durationMs:0});return r}function ie(e){return fo("sha256").update(k(e)).digest("hex").slice(0,16)}function ae(e){try{return mo(e).size}catch{return null}}function Oo(e,t){let n={};for(let r of t){let i=e.get(r);i&&(n[r]=i.fingerprint)}return n}async function Lo(e,t,n,r,i,a,o,s){D(e.opts.signal,"Reindex cancelled by its owner.");let c=!s||s.completeScipUpdated,l=!1;c&&(jr(e.paths.outputDb,n,e.writeTelemetry),l=Or(n,e.tempPaths.tempOutputScip,e.onStatus));let d=await Bo({run:e,indexedOutputs:n,skippedLanguages:r,reusedLanguages:i,incrementalTypeScript:s,completeScipAvailable:c,completeScipSanitized:l,materializeFullFallback:async()=>{if(D(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..."),Ir({cacheDir:h(e.paths.outputDb),generationIdentity:s.nextFragmentGeneration,baseShardPath:s.scipPath,candidateShardPath:s.candidateScipPath});let E=n.map(P=>P.language==="typescript"?{language:P.language,scipPath:s.candidateScipPath}:P);return jr(e.paths.outputDb,E,e.writeTelemetry),l=Or(E,e.tempPaths.tempOutputScip,e.onStatus),l}});D(e.opts.signal,"Reindex cancelled by its owner."),re(ne(),{projectRoot:e.projectRoot,dbPath:e.tempPaths.tempOutputDb,onStatus:e.onStatus}),yt(e.projectRoot,e.tempPaths.tempOutputDb,e.tempPaths.tempOutputScip,e.onStatus,!1,s?.affectedFiles);let p=nt(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(", ")}`),d.mode==="incremental"&&s){let E=null,P=null;try{E=new F({projectRoot:e.projectRoot,dbPath:e.tempPaths.tempOutputDb,indexPath:e.tempPaths.tempOutputScip}),P=new F({projectRoot:e.projectRoot,dbPath:e.paths.outputDb,indexPath:e.paths.outputScip});let b=Jt(E,e.fingerprint,s.referenceFragmentsByFile,P);e.onStatus(`Cached exact TypeScript reference fragments for ${b} affected document(s).`)}catch(b){e.onStatus(`Exact TypeScript reference fragment prefill unavailable: ${b instanceof Error?b.message:String(b)}.`)}finally{E?.close(),P?.close()}}let u=bt(e.paths.metaPath),g=d.mode==="incremental"&&s?qo(s,d.changedDocumentPaths):Ke({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=Ne({trigger:e.opts.trigger,result:"rebuilt",start:e.start,monotonicStart:e.monotonicStart,languages:n.map(E=>E.language),skipped:[...r]}),x=d.mode==="incremental"&&d.scipCompanion==="deferred",_={...a};x&&delete _.typescript;let{metadata:f,pruneProjects:y}=Gr({run:e,indexedOutputs:n,skippedLanguages:r,reusedLanguages:i,languageFingerprints:_,typescriptProjectShardContext:o,lastRefresh:m});f.scipCompanion=x?"deferred":"current",Br(e.paths.outputDb,y),Rt(e.tempPaths.tempMetaPath,f);let R=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:d.mode==="incremental"&&d.scipCompanion==="deferred",publication:d.mode==="incremental"?{mode:"incremental",validation:"passed",converterDurationMs:d.converterDurationMs,affectedDocumentCount:s?.affectedFiles.length,changedDocumentCount:d.changedDocumentPaths.length,producerDurationMs:s?.timings.serviceMs,materializationDurationMs:s?.durationMs,patchDurationMs:d.patchDurationMs,scipCompanion:d.scipCompanion,...d.scipCompanion==="deferred"&&s?{typescriptOverlayGeneration:s.nextFragmentGeneration}:{}}:{mode:"full",validation:"passed",converterDurationMs:d.converterDurationMs,scipCompanion:"current",...d.fallbackReason?{fallbackReason:d.fallbackReason}:{}}});return R.achievedDurability==="file-flushed"&&e.onStatus(`Published local generation ${R.currentGeneration.slice(0,12)} (file-flushed; directory sync unsupported)`),gn(h(e.paths.outputDb),d.mode==="incremental"&&d.scipCompanion==="deferred"?[s.nextFragmentGeneration]:[]),dn(h(e.paths.outputDb),s?.completeScipUpdated?[s.nextFragmentGeneration]:[]),Ur(e.paths.outputDb,g,e.onStatus),m}function No(e,t,n,r,i,a){let o=bt(e.paths.metaPath),s=null;try{G(e.writeTelemetry,U(e.paths.outputDb,e.tempPaths.tempOutputDb))}catch(u){s=Gn("reused","oracle-error",`Could not snapshot the prior database: ${u instanceof Error?u.message:String(u)}`)}re(ne(),{projectRoot:e.projectRoot,dbPath:e.paths.outputDb,onStatus:e.onStatus}),yt(e.projectRoot,e.paths.outputDb,e.paths.outputScip,e.onStatus,!0);let c=nt(e.paths.outputDb);c.added.length>0&&e.onStatus(`Added SQLite query indexes: ${c.added.join(", ")}`),c.removed.length>0&&e.onStatus(`Removed redundant SQLite indexes: ${c.removed.join(", ")}`),s??=Ke({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=Ne({trigger:e.opts.trigger,result:"reused",start:e.start,monotonicStart:e.monotonicStart,languages:t.map(u=>u.language),skipped:[...n]}),{metadata:d,pruneProjects:p}=Gr({run:e,indexedOutputs:t,skippedLanguages:n,reusedLanguages:r,languageFingerprints:i,typescriptProjectShardContext:a,lastRefresh:l});return Br(e.paths.outputDb,p),Rt(e.paths.metaPath,d),He(e.paths.outputDb,e.paths.metaPath),Ur(e.paths.outputDb,s,e.onStatus),l}function bt(e){return vt(V(e)?.fingerprint)}function Ur(e,t,n){try{Wn(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 Gr(e){let t=Ao({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:2,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 Ao(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 Br(e,t){let n=Yr(e);if(t===null){q(()=>Y(n,{recursive:!0,force:!0}));return}let r;try{r=Cr(n)}catch{return}for(let i of Mo(r,t))q(()=>Y(v(n,i),{force:!0}))}function Mo(e,t){let n=new Set(t.map(r=>`${ot(r)}.scip`));return e.filter(r=>!n.has(r))}function jr(e,t,n){for(let r of t){let i=St(e,r.language);je(h(i),{recursive:!0}),r.scipPath!==i&&G(n,U(r.scipPath,i))}}function Co(e){let t=[],n=[],r=e.languages.map((a,o)=>({language:a,scipPath:e.languages.length>1?oe(e.tempOutputScip,a,o):e.tempOutputScip})),i=Object.fromEntries(r.map(({language:a,scipPath:o})=>[a,o]));for(let{language:a,scipPath:o}of r){let s=$o({...e,language:a,scipPath:o});for(let c of s)"skipped"in c?Wr(n,c.skipped):t.push(c.prepared)}return{preparedRuns:t,skippedLanguages:n,languageOutputScipPaths:i}}function $o(e){if(e.language!=="typescript"||e.typescriptProjectMode!=="workspace")return[mt({...e,id:e.language,label:e.language,outputScipPath:e.scipPath})];let t=e.preDiscoveredTypeScriptProjects??z(e.projectRoot,e.typescriptProjects);return t.length===0?[mt({...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)=>mt({...e,id:`typescript:${n}`,label:`typescript (${n})`,scipPath:oe(e.tempOutputScip,"typescript-project",r),outputScipPath:e.scipPath,pnpmWorkspaces:!1,projectPath:n})))}function mt(e){let t=Ze(e.language),n=ge(t),r=$t(t,e.projectRoot),i=e.trustProjectTools&&r?Ut(t,e.projectRoot):null,a=te(t);if(!i&&!a&&r){let d=`${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}: ${d}`),{skipped:{language:e.language,reason:d}}}if(!i&&!a&&!Ct(t)){if(e.skipAutoInstall){let d=`${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}: ${d}`),{skipped:{language:e.language,reason:d}}}if(e.onStatus(`${n} not found. Attempting auto-install...`),!Dr(t,e.onStatus)){let d=`${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}: ${d}`),{skipped:{language:e.language,reason:d}}}}let o=i?.canonicalPath??te(t);if(!o){let d=`${n} was not found after installation checks.`;return e.onStatus(`Skipping ${e.language}: ${d}`),{skipped:{language:e.language,reason:d}}}let{binary:s,args:c}=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=Vn({language:e.language,projectPath:e.projectPath,pnpmWorkspaces:e.pnpmWorkspaces});if(i&&!i.executable){let d=`${i.relativePath} is not executable; refusing project-local indexer.`;return e.onStatus(`Skipping ${e.language}: ${d}`),{skipped:{language:e.language,reason:d}}}return i&&e.onStatus(`Trusted project-local ${e.language} indexer ${i.relativePath} (${i.sha256.slice(0,12)}\u2026, ${i.canonicalPath}).`),{prepared:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,config:t,resolvedBinary:o,binary:s,args:c,env:Bt(t,e.env,o),...l===void 0?{}:{temporaryRootConfigContent:l},...i?{trustedProjectTool:i}:{}}}}function Uo(e,t){let n=new Map;for(let i of e)if(i.skipped)Wr(t,i.skipped);else{let a=`${i.language}\0${i.outputScipPath}`,o=n.get(a)??{language:i.language,outputScipPath:i.outputScipPath,scipPaths:[]};o.scipPaths.push(i.scipPath),n.set(a,o)}let r=[];for(let i of n.values())if(i.scipPaths.length>1)en(i.scipPaths,i.outputScipPath),r.push({language:i.language,scipPath:i.outputScipPath});else{let a=i.scipPaths[0];a!==i.outputScipPath&&$r(a,i.outputScipPath),r.push({language:i.language,scipPath:i.outputScipPath})}return{indexedOutputs:r}}function Wr(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 Go(e,t,n,r,i){if(e.length===0){let a=t.map(o=>` - ${o.language}: ${o.reason}`).join(`
|
|
274
|
+
`);throw new Error(`No language indexers ran successfully. Install at least one indexer for the languages in this project.
|
|
275
|
+
`+a)}if(t.length!==0&&(i(`Indexed ${e.length} language output(s); skipped or incomplete: ${t.map(a=>a.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.
|
|
276
|
+
`+t.map(a=>` - ${a.language}: ${a.reason}`).join(`
|
|
277
|
+
`))}function Or(e,t,n){if(e.length>1){n(`Merging ${e.length} language indexes...`);let r=performance.now(),i=tn(e.map(a=>a.scipPath),t);return qr(i,n),n(`Merged and sanitized SCIP indexes in ${(performance.now()-r).toFixed(0)}ms.`),!0}else e[0].scipPath!==t&&$r(e[0].scipPath,t);return!1}async function Bo(e){let t;if(Wo(e)){let i=v(e.run.tempPaths.runDir,"typescript-affected.db");try{e.run.onStatus(`Converting ${e.incrementalTypeScript.affectedFiles.length} affected TypeScript document(s) to SQLite...`);let a=performance.now();Lr(e.incrementalTypeScript.affectedScipPath,i,e.run.onStatus,!1,e.run.opts.signal),e.run.onStatus(`Converted affected SCIP documents in ${(performance.now()-a).toFixed(0)}ms.`);let o=nr({previousDbPath:e.run.paths.outputDb,miniDbPath:i,candidateDbPath:e.run.tempPaths.tempOutputDb,affectedFiles:e.incrementalTypeScript.affectedFiles,writeTelemetry:e.run.writeTelemetry});return e.run.onStatus(`Patched ${o.affectedDocumentCount} SQLite document(s) in ${(o.durationMs/1e3).toFixed(3)}s.`),{mode:"incremental",changedDocumentPaths:o.changedDocumentPaths,patchDurationMs:o.durationMs,converterDurationMs:performance.now()-a,scipCompanion:e.incrementalTypeScript.completeScipUpdated?"current":"deferred"}}catch(a){D(e.run.opts.signal,"Reindex cancelled by its owner."),t=a instanceof Error?a.message:String(a),q(()=>Y(i,{force:!0})),q(()=>Y(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 Lr(e.run.tempPaths.tempOutputScip,e.run.tempPaths.tempOutputDb,e.run.onStatus,n,e.run.opts.signal),{mode:"full",converterDurationMs:performance.now()-r,...t?{fallbackReason:t}:{}}}function Wo(e){if(!e.incrementalTypeScript||e.skippedLanguages.length>0||!T(e.run.paths.outputDb)||!T(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 qo(e,t){let n=S(),r=[...t].sort(),i=new Set(r),a={addedFiles:[],modifiedFiles:r,deletedFiles:[],changedFiles:r,unchangedFiles:e.affectedFiles.filter(o=>!i.has(o)).sort()};return{version:1,status:"evaluated",refreshResult:"rebuilt",recordedAt:new Date().toISOString(),durationMs:S()-n,manifest:e.manifest,plan:e.plan,comparison:a,evaluation:Qe(e.plan,a,e.projectFileCount)}}function Lr(e,t,n,r,i){if(D(i,"Reindex cancelled by its owner."),n("Writing the SQLite index..."),!T(e))throw new Error(`SCIP index not found at ${e} after indexing`);try{qr(br(e,t,{sanitize:!r}),n)}catch(a){let o=a instanceof Error?a.message:String(a);throw new Error(`Failed to write the SQLite index: ${o}`,{cause:a})}}function qr(e,t){e.removedDefinitionOccurrences!==0&&t(`Sanitized ${e.removedDefinitionOccurrences} invalid definition occurrences across ${e.touchedDocuments} documents before SQLite conversion.`)}function oe(e,t,n){let r=ho(e)||".scip",i=ke(e,r);return v(h(e),`${i}.${n+1}.${t}${r}`)}async function Ho(e,t){for(let n=0;n<2;n++){let r=Jo(e,t);if(r)return r;let i=zo(e);if(i&&zr(t.trigger,i)){t.onStatus(`Manual reindex preempting watcher refresh started at ${i.startedAt}.`);let a;try{a=await Yo(i)}catch(s){throw new Error(`Could not verify the watcher's in-progress reindex owner (pid ${i.pid}); refusing to steal an active lock: ${N(s)}`,{cause:s})}if(!a)throw new Error(`Could not confirm the watcher's in-progress reindex (pid ${i.pid}) terminated for ${h(e)}; refusing to steal an active lock.`);let o=Ge(e,{parseLegacy:Oe});if(!kt(e,o,{parseLegacy:Oe}))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 Jo(e,t){let n=H(process.pid),r=Ft(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:Oe});if(r.kind==="acquired"&&r.reclaimed){let i=Hr(r.reclaimed,e);i&&zr(t.trigger,i)?t.onStatus(`Manual reindex preempting watcher refresh started at ${i.startedAt}; its prior owner was already stale.`):t.onStatus(`Recovered an abandoned or incomplete reindex lock for ${h(e)}.`)}return r.kind==="acquired"?()=>{r.lock.release()}:null}function zo(e){return Hr(Ge(e,{parseLegacy:Oe}),e)}var Oe=e=>{let t=Jr(e,"");return t?{pid:t.pid,...t.processIdentity?{processIdentity:t.processIdentity}:{}}:null};function Hr(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 Jr(e.parsed,t)}function Jr(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=Tt(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 zr(e,t){return e?.kind==="manual-cli"&&Xo(t?.trigger)}function Xo(e){return e?.kind==="watch-source"||e?.kind==="watch-git-head"||e?.kind==="watch-git-index"||e?.kind==="watch-git-state"}async function Yo(e){return!J(e.pid)||(ht(e),Nr(e,"SIGTERM"),await Ar(e,2e3))?!0:(ht(e),Nr(e,"SIGKILL"),Ar(e,1e3))}function Nr(e,t){if(e.processGroupLeader)try{process.kill(-e.pid,t);return}catch{if(!J(e.pid))return;ht(e)}try{process.kill(e.pid,t)}catch{}}async function Ar(e,t){let n=S()+t;for(;S()<n;){if(Mr(e))return!0;await Vo(50)}return Mr(e)}function ht(e){if(!e.processIdentity)throw new Error(`Refusing to signal reindex pid ${e.pid}: its ownership record has no process identity.`);let t=H(e.pid);if(!t)throw new Error(`Refusing to signal reindex pid ${e.pid}: its process identity is unavailable.`);if(!ee(e.processIdentity,t))throw new Error(`Refusing to signal reindex pid ${e.pid}: its process identity does not match the ownership record.`)}function Mr(e){if(!J(e.pid))return!0;if(!e.processIdentity)return!1;let t=H(e.pid);return t!==null&&!ee(e.processIdentity,t)}function Vo(e){return new Promise(t=>setTimeout(t,e))}function Xr(e,t,n){return Object.fromEntries(t.map(r=>{let i=r==="typescript"?Nt(n.typescriptProjects):[],a=r==="clojure"?Qo(n.clojureConfigPath):void 0,o=[...Ze(r).markerFiles,...i,...a?[a]:[]],s=r==="typescript"?{typescriptProjectMode:n.typescriptProjectMode??"single",typescriptProjects:i}:{typescriptProjectMode:"single",typescriptProjects:[]};return[r,{version:2,languages:[r],pnpmWorkspaces:r==="typescript"&&Ko(n),...s,clojureConfigPath:a,files:At(e,{language:r,markerFiles:o})}]}))}function Qo(e){return e?.trim()||void 0}function Ko(e){return e.typescriptProjectMode!=="workspace"&&e.pnpmWorkspaces===!0}function St(e,t){return v(h(e),"language-indexes",`${t}.scip`)}function Yr(e){return v(h(e),"language-indexes","typescript-projects")}function Le(e,t){return v(Yr(e),`${ot(t)}.scip`)}function V(e){try{return Ae(le(ce(e,"reindex metadata")))}catch{return null}}function Vr(e,t){try{let n=le(ce(e,"reindex metadata"));if(n.kind!=="legacy"&&n.kind!=="supported")return!1;let r=n.metadata;return n.capabilities.publishableGeneration&&Ce(r)&&k(r.fingerprint)===k(t)&&k([...r.indexedLanguages??[]].sort())===k(t.languages)}catch{return!1}}function Rt(e,t){qt(e,t,{spacing:2,trailingNewline:!0})}function Qr(e,t){try{let n=Ae(le(ce(e,"reindex metadata")));if(!n)return;Rt(e,{...n,lastRefresh:t})}catch{}}function Ne(e){return{trigger:e.trigger??{kind:"unknown"},result:e.result,startedAt:new Date(e.start).toISOString(),completedAt:new Date().toISOString(),durationMs:S()-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{xs as a,Ps as b,Ze as c,Dr as d,zd as e};
|
|
278
|
+
//# sourceMappingURL=chunk-MVRGB4KJ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as R,b as F}from"./chunk-IRQOAM5G.js";import{a as k,b as C,c as V,e as o,f as v}from"./chunk-OTOKVOJ3.js";import{a as B,b as g}from"./chunk-NMTSZXCL.js";import{M as y}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as R,b as F}from"./chunk-IRQOAM5G.js";import{a as k,b as C,c as V,e as o,f as v}from"./chunk-OTOKVOJ3.js";import{a as B,b as g}from"./chunk-NMTSZXCL.js";import{M as y}from"./chunk-ICUL7XRT.js";function j(e,s={}){let{minSimilarity:m=.45,minSharedBehaviors:t=6,limit:i=20,scope:l,scanLimit:c,filePattern:d,focusFiles:h}=s,u=y(e).vueProfiles({scope:l,minBehaviorTokens:Math.max(3,t),scanLimit:c}).map(r=>({file:r.file,tokens:r.behaviorTokens,profile:r})),n=R(u,r=>r.tokens);return F({profiles:u,limit:i,filePattern:d,focusFiles:h,candidateIndex:n,profile:{name:"vue-composable-candidates"},compare:(r,a)=>T(r,a,m,t),sort:(r,a)=>a.similarity-r.similarity||r.fileA.localeCompare(a.fileA)||r.fileB.localeCompare(a.fileB)})}function T(e,s,m,t){let i=B(e.tokens,s.tokens);if(i.size<t||!P(i))return null;let l=C(e.tokens,s.tokens);if(l<m)return null;let c=o(i,"composable:"),d=o(i,"store:"),h=o(i,"reactivity:"),u=o(i,"lifecycle:"),n=o(i,"request:"),r=o(i,"function:"),a=o(i,"function-verb:"),b=o(i,"template-binding:"),p=o(i,"template-event:"),f=q({sharedComposables:c,sharedStores:d,sharedReactivity:h,sharedLifecycle:u,sharedRequests:n,sharedFunctions:r,sharedFunctionVerbs:a,sharedBindings:b,sharedTemplateEvents:p});return{fileA:e.file,fileB:s.file,similarity:l,tokenCountA:e.tokens.size,tokenCountB:s.tokens.size,sharedTokens:v(i),sharedComposables:c,sharedStores:d,sharedReactivity:h,sharedLifecycle:u,sharedRequests:n,sharedFunctions:r,sharedFunctionVerbs:a,sharedBindings:b,sharedTemplateEvents:p,evidenceClass:f.evidenceClass,actionTier:f.actionTier,evidenceClassReasons:f.reasons,recommendation:f.recommendation,uniqueToA:v(g(e.tokens,s.tokens)).slice(0,25),uniqueToB:v(g(s.tokens,e.tokens)).slice(0,25),reason:S({sharedComposables:c,sharedStores:d,sharedRequests:n,sharedLifecycle:u,sharedFunctions:r,sharedFunctionVerbs:a,sharedBindings:b}),locA:e.profile.totalLines,locB:s.profile.totalLines}}function q(e){return k({genericWords:A,primitiveGroups:[{values:e.sharedReactivity,reasonPrefix:"shared reactivity primitive",bucket:"generic"},{values:e.sharedLifecycle,reasonPrefix:"shared lifecycle primitive",bucket:"generic"}],nameGroups:[{names:e.sharedComposables,label:"shared composable",fallbackBucket:"shared-abstraction"},{names:e.sharedStores,label:"shared store",fallbackBucket:"shared-abstraction"},{names:e.sharedRequests,label:"shared request",fallbackBucket:"generic"},{names:e.sharedFunctions,label:"shared function",fallbackBucket:"generic"},{names:e.sharedFunctionVerbs,label:"shared action verb",fallbackBucket:"generic"},{names:e.sharedBindings,label:"shared binding",fallbackBucket:"generic"},{names:e.sharedTemplateEvents,label:"shared template event",fallbackBucket:"generic"}],recommendation:w})}function w(e){switch(e){case"domain-behavior":return"Review for a shared composable, store, or feature module around the named domain behavior.";case"mixed":return"Separate generic Vue mechanics from domain-specific behavior before extracting a composable.";case"shared-abstraction":return"Review the existing composable/store usage first; extract only if duplicated behavior remains outside it.";case"generic-workflow-scaffolding":return"Treat as support evidence for a repeated workflow shape, not direct composable-extraction evidence."}}function P(e){let s=0,m=0,t=0,i=0,l=0,c=0,d=0;for(let n of e)n.startsWith("composable:")?s+=1:n.startsWith("store:")?m+=1:n.startsWith("request:")?t+=1:n.startsWith("lifecycle:")?i+=1:n.startsWith("function:")?l+=1:n.startsWith("reactivity:")?c+=1:(n.startsWith("function-verb:")||n.startsWith("template-binding:")||n.startsWith("template-event:"))&&(d+=1);let h=s+m,u=h+t+i+l+d;return V([{name:"requests",count:t},{name:"lifecycle",count:i},{name:"functions",count:l},{name:"reusableHooks",count:h},{name:"reactivity",count:c},{name:"namedBehavior",count:u}],[{min:{requests:1,namedBehavior:4},reason:"shared request workflow"},{min:{lifecycle:1,functions:2,namedBehavior:4},reason:"shared lifecycle workflow"},{min:{reusableHooks:2,requests:1,namedBehavior:5},reason:"shared reusable Vue hooks and requests"},{min:{reusableHooks:2,functions:2,namedBehavior:5},reason:"shared reusable Vue hooks and functions"},{min:{functions:2,reactivity:1,namedBehavior:4},reason:"shared reactive functions"}]).pass}function S(e){let s=[];return e.sharedComposables.length&&s.push(`shared composables: ${e.sharedComposables.join(", ")}`),e.sharedStores.length&&s.push(`shared stores: ${e.sharedStores.join(", ")}`),e.sharedRequests.length&&s.push(`shared request helpers: ${e.sharedRequests.join(", ")}`),e.sharedLifecycle.length&&s.push(`shared lifecycle: ${e.sharedLifecycle.join(", ")}`),e.sharedFunctions.length&&s.push(`shared functions: ${e.sharedFunctions.slice(0,6).join(", ")}`),e.sharedFunctionVerbs.length&&s.push(`shared action verbs: ${e.sharedFunctionVerbs.slice(0,6).join(", ")}`),e.sharedBindings.length&&s.push(`shared template bindings: ${e.sharedBindings.slice(0,6).join(", ")}`),s.join("; ")||"shared Vue behavior profile"}var A=new Set(["add","apply","cancel","change","clear","close","composable","create","data","delete","draft","edit","error","fetch","filter","form","item","items","load","loading","name","open","reactive","ref","refresh","remove","request","reset","resource","row","rows","save","saving","search","select","selected","store","submit","toggle","update","use","value","watch"]);export{j as a};
|
|
2
|
+
//# sourceMappingURL=chunk-MZNMASFM.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as y}from"./chunk-
|
|
1
|
+
import{b as y}from"./chunk-VGWZ4MOY.js";import{a as v}from"./chunk-6VREELBC.js";import{p as S}from"./chunk-J7AMBVWF.js";import{a as b}from"./chunk-SGMNWYTH.js";import{d as u,e as f,h as m,p,q as g}from"./chunk-GVAF222T.js";import{w as d}from"./chunk-7GAK2F3H.js";function q(e,t,i={}){let n=T(e,t,i);return{definitions:n.definitions,referencedBy:n.referencedBy.map(r=>({relativePath:r.relativePath,line:r.line,enclosingSymbol:r.enclosingSymbol,enclosingShort:r.enclosingShort}))}}function T(e,t,i={}){let n=R(e,t,i);return{definitions:n.definitions,referencedBy:n.referencedBy}}function R(e,t,i={}){let n=b(e,t);if(!n)return{definitions:[],referencedBy:[],referenceEvidence:[],claimSupport:null};let r=e.get("SELECT display_name, documentation FROM global_symbols WHERE id = ?",n.symbolId),c=g(r?.documentation??null),o=e.isIgnored(n.relativePath)?[]:[{relativePath:n.relativePath,startLine:n.startLine,endLine:n.endLine,signature:K(c,r?.display_name??null,n.symbol),source:B(e,n.relativePath,n.startLine,n.endLine)}],h=i.referenceContext??2,s=S(e,n,{semantic:i.semantic,semanticEvidence:v}).map(l=>{let a=y(e,l.file,l.line,h,f(n.symbol));return{relativePath:l.file,line:l.line,enclosingSymbol:l.enclosingSymbol,enclosingShort:l.enclosingSymbol?u(l.enclosingSymbol):"(top-level)",provenance:l.provenance,sourceStartLine:a?.startLine??null,sourceEndLine:a?.endLine??null,source:a?.source??null,sourceKind:a?.kind??"unavailable"}}),E=s.map(x);return{definitions:o,referencedBy:E,referenceEvidence:s.map(l=>({relativePath:l.relativePath,line:l.line,provenance:l.provenance,sourceKind:l.sourceKind})),claimSupport:P(s)}}function x(e){return{relativePath:e.relativePath,line:e.line,enclosingSymbol:e.enclosingSymbol,enclosingShort:e.enclosingShort,sourceStartLine:e.sourceStartLine,sourceEndLine:e.sourceEndLine,source:e.source}}function P(e){let t="resolved source-attributed or SCIP-indexed references to this exact symbol",i=["Dynamic dispatch, reflection, generated calls, and unindexed source are outside this scope."],n=e.filter(c=>c.sourceKind!=="complete-call-expression"&&c.sourceKind!=="non-call-reference"),r="direct, statically visible call expressions among the resolved reference sites";return{referenceAbsence:{status:"eligible",scope:t,limitations:i},callsitePredicates:n.length===0?{status:"eligible",scope:r,limitations:i}:{status:"ineligible",scope:r,reason:`${n.length} reference site(s) lack one unambiguous complete call expression.`,followup:L(n)}}}function L(e){let t=[...new Set(e.map(i=>`${i.relativePath}:${i.line+1}`))];return t.length===0||t.length>24?null:`codebaseiq inspect ${t.map(i=>`--at ${C(i)}`).join(" ")} --view behavior`}function C(e){return`'${e.replaceAll("'","'\\''")}'`}function B(e,t,i,n){let r=d(e,t);if(!r)return null;let o=r.split(`
|
|
2
2
|
`).slice(i,n+1).join(`
|
|
3
3
|
`).trimEnd();return o.length>0?o:null}function K(e,t,i){let n=p(e);if(n&&!A(n))return n;let r=(t??"").trim();return r?m(i)&&!r.endsWith("()")?`${r}()`:r:u(i)}function A(e){return e.startsWith("undefined")||e.includes("|")||e.includes("```")}export{q as a,T as b,R as c};
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
4
|
+
//# sourceMappingURL=chunk-NBCQZSGR.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{k as x}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{k as x}from"./chunk-J3GLP7Q5.js";import{a as y,e as b}from"./chunk-GVAF222T.js";import{z as v}from"./chunk-ICUL7XRT.js";import{g,l as D,m as F,t as E,v as I}from"./chunk-7GAK2F3H.js";import{a as _,d as p}from"./chunk-3LCDIREB.js";import{spawnSync as P}from"child_process";import{createHash as U}from"crypto";import{existsSync as k}from"fs";import{dirname as L,join as T}from"path";import{fileURLToPath as j}from"url";var R=g("definition-consumer-file-usage",{clearGroups:["whole-project","source-file"]}),M=E({kind:"consumer-file-usage",invalidation:I("consumer-file-usage"),serialize:Q,deserialize:W});function Le(e,n){return{forDefinitions(r,i){return B(e,n,r,i)}}}function Me(e){let n=new Map;for(let[r,i]of e)n.set(r,new Set(i.files.map(t=>t.file)));return n}function Ne(e,n,r){return w(e,n,r).partition}function B(e,n,r,i){let t=h(r.length),s=_()?F(e):null,a=s?V(r,i,s):void 0,o=a?{workIdentity:a,workOutcome:"computed"}:{};return p("consumer-evidence.product",()=>{let l=p("consumer-evidence.provenance",()=>z(e,n,r,i),()=>({...o,definitions:r.length,semantic:i.semantic,sourceFallback:i.sourceFallback!==!1})),u=new Map;t={...t,...l.counters};let c=q(r,l.sources);return p("consumer-evidence.classify",()=>{let f=Y(e,r,l.sources,c);for(let d of r){let m=f.get(d.symbolId)??$();t.realFiles+=m.partition.realConsumers.length,t.reexportOnlyFiles+=m.partition.barrelConsumers,t.importOnlyFiles+=m.partition.importOnlyConsumers,u.set(d.symbolId,{definition:d,files:m.files,semanticIncomplete:l.incompleteSymbolIds.has(d.symbolId),semanticUnavailable:l.unavailableSymbolIds.has(d.symbolId),...m.partition})}},()=>({...o,...c,realFiles:t.realFiles,reexportOnlyFiles:t.reexportOnlyFiles,importOnlyFiles:t.importOnlyFiles})),u},()=>({...o,...t}))}function V(e,n,r){let i=U("sha256").update("consumer-evidence-v3-calibrated-semantic\0").update(r).update("\0").update(n.semantic?"semantic\0":"indexed\0").update(n.sourceFallback===!1?"no-source-fallback":"source-fallback");for(let t of e.map(s=>s.symbol).sort())i.update("\0").update(t);return i.digest("hex").slice(0,24)}function h(e){return{definitions:e,indexedFiles:0,semanticFiles:0,fallbackFiles:0,totalFiles:0,realFiles:0,reexportOnlyFiles:0,importOnlyFiles:0}}function z(e,n,r,i){let t=h(r.length),s=new Map,a=new Set,o=new Set;if(S(s,t,"indexed",n.crossFileCallerMap(r,{semantic:!1})),i.semantic){let l=x(e,r);S(s,t,"semantic",l.callers);for(let u of l.incompleteSymbolIds)a.add(u);for(let u of l.unavailableSymbolIds)o.add(u)}return i.sourceFallback!==!1&&S(s,t,"source-fallback",n.sourceFallbackCallerFiles(r)),t.totalFiles=[...s.values()].reduce((l,u)=>l+u.size,0),{sources:s,counters:t,incompleteSymbolIds:a,unavailableSymbolIds:o}}function q(e,n){return{definitions:e.length,consumerFiles:[...n.values()].reduce((r,i)=>r+i.size,0),nativeAttempted:!1,nativeUsed:!1,nativeReason:"not-attempted"}}function S(e,n,r,i){let t=0;for(let[s,a]of i){let o=e.get(s);o||(o=new Map,e.set(s,o));for(let l of a){t++;let u=o.get(l)??new Set;u.add(r),o.set(l,u)}}r==="indexed"?n.indexedFiles+=t:r==="semantic"?n.semanticFiles+=t:n.fallbackFiles+=t}function Y(e,n,r,i){let t=re(e,n,r,i);return t||H(e,n,r)}function H(e,n,r){let i=new Map;for(let t of n){let s=r.get(t.symbolId)??new Map;i.set(t.symbolId,w(e,t,[...s.keys()],s))}return i}function w(e,n,r,i=new Map){let t=[],s=0,a=0,o=b(n.symbol),l=[];for(let u of r){let c;X(e,u,n.relativePath,o)?(s++,c="reexport-only"):J(e,u,o)?(a++,c="import-only"):(t.push(u),c="real"),l.push({file:u,sources:[...i.get(u)??[]],classification:c})}return{partition:{realConsumers:t,barrelConsumers:s,importOnlyConsumers:a},files:l}}function $(){return{partition:{realConsumers:[],barrelConsumers:0,importOnlyConsumers:0},files:[]}}function J(e,n,r){if(!r)return!1;let i=v(n);if(!i)return!1;let t=R.get(e,n,()=>A(e,n,i));return t.importedLeaves.has(r)&&!t.usedLeaves.has(r)}function A(e,n,r){let i=y(e).forFile(n,{text:!0,ast:!0}),t=i.text;if(!t)return G();let s=D(e,n,t),a=M.read(e,n,s);if(a)return a;let o=K(i.ast,r);return M.write(e,n,s,o),o}function K(e,n){let r=new Set,i=new Set;if(!e)return{importedLeaves:r,usedLeaves:i};let t=n==="rust"?new Set(["use_declaration"]):n==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),s=(a,o)=>{let l=o||t.has(a.type);(a.type==="identifier"||a.type==="type_identifier"||a.type==="property_identifier"||a.type==="field_identifier")&&(l?r.add(a.text):i.add(a.text));for(let u of a.children)s(u,l)};return s(e.rootNode,!1),{importedLeaves:r,usedLeaves:i}}function G(){return{importedLeaves:new Set,usedLeaves:new Set}}function Q(e){return JSON.stringify({importedLeaves:[...e.importedLeaves],usedLeaves:[...e.usedLeaves]})}function W(e){try{let n=JSON.parse(e);return!Array.isArray(n.importedLeaves)||!Array.isArray(n.usedLeaves)?null:{importedLeaves:new Set(n.importedLeaves.filter(r=>typeof r=="string")),usedLeaves:new Set(n.usedLeaves.filter(r=>typeof r=="string"))}}catch{return null}}function X(e,n,r,i){if(!i)return!1;let t=y(e).forFile(n,{lines:!0,reexports:!0}),s=t.lines??[];if(s.length===0)return!1;let a=t.reexports??[];return O(s,a,i)}function O(e,n,r){if(e.length===0||n.length===0)return!1;let i=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),t=new RegExp(`\\b${i}\\b`),s=0;for(let a=0;a<e.length;a++){if(!t.test(e[a]??""))continue;if(s++,!n.find(l=>l.startLine<=a&&a<=l.endLine))return!1}return s>0}var Z="CODEBASEIQ_NATIVE_CONSUMER_CLASSIFY",ee="CODEBASEIQ_NATIVE_KERNELS_BIN",ne="CODEBASEIQ_NATIVE_CONSUMER_CLASSIFY_MIN_FILES",N=1e3,ie=5e3,te=64*1024*1024,C;function re(e,n,r,i){let t=process.env[Z]?.toLowerCase();if(t!=="1"&&t!=="true")return i.nativeReason=t==="0"||t==="false"?"disabled":"opt-in-required",null;if(i.consumerFiles<fe())return i.nativeReason="below-threshold",null;let s=me();if(!s)return i.nativeReason="binary-missing",null;i.nativeAttempted=!0;let a=se(e,n,r),o=P(s,["consumer-classify"],{input:JSON.stringify(a),encoding:"utf8",timeout:ie,maxBuffer:te,windowsHide:!0});if(o.status!==0||o.error)return i.nativeReason=o.error?`spawn-error:${o.error.message}`:`exit-${o.status??"null"}`,null;try{let l=JSON.parse(o.stdout),u=ae(l,n);return u?(i.nativeUsed=!0,i.nativeReason="used",u):(i.nativeReason="invalid-response",null)}catch{return i.nativeReason="invalid-json",null}}function se(e,n,r){let i=new Map,t=[];for(let o of n){let l=b(o.symbol),c=[...(r.get(o.symbolId)??new Map).entries()].map(([f,d])=>{let m=i.get(f)??new Set;return l&&m.add(l),i.set(f,m),{file:f,sources:[...d]}});t.push({symbol_id:o.symbolId,leaf:l,consumer_files:c})}let s={},a={};for(let[o,l]of i){let u=v(o);if(u){let f=R.get(e,o,()=>A(e,o,u));s[o]={imported_leaves:[...f.importedLeaves],used_leaves:[...f.usedLeaves]}}let c=oe(e,o,l);c.length>0&&(a[o]=c)}return{definitions:t,file_usages:s,reexport_only_leaves:a}}function oe(e,n,r){if(r.size===0)return[];let i=y(e).forFile(n,{lines:!0,reexports:!0}),t=i.lines??[],s=i.reexports??[];return t.length===0||s.length===0?[]:[...r].filter(a=>O(t,s,a))}function ae(e,n){if(!Array.isArray(e.entries)||e.entries.length!==n.length)return null;let r=new Set(n.map(t=>t.symbolId)),i=new Map;for(let t of e.entries){let s=le(t);if(!s||!r.has(s.symbol_id))return null;i.set(s.symbol_id,{partition:{realConsumers:s.real_consumers,barrelConsumers:s.barrel_consumers,importOnlyConsumers:s.import_only_consumers},files:s.files})}for(let t of r)if(!i.has(t))return null;return i}function le(e){if(!e||typeof e!="object")return null;let n=e;if(typeof n.symbol_id!="number"||!Array.isArray(n.real_consumers)||typeof n.barrel_consumers!="number"||typeof n.import_only_consumers!="number"||!Array.isArray(n.files)||!n.real_consumers.every(i=>typeof i=="string"))return null;let r=[];for(let i of n.files){if(!i||typeof i!="object")return null;let t=i;if(typeof t.file!="string"||!Array.isArray(t.sources)||!t.sources.every(ue)||!ce(t.classification))return null;r.push({file:t.file,sources:t.sources,classification:t.classification})}return{symbol_id:n.symbol_id,real_consumers:n.real_consumers,barrel_consumers:n.barrel_consumers,import_only_consumers:n.import_only_consumers,files:r}}function ue(e){return e==="indexed"||e==="semantic"||e==="source-fallback"}function ce(e){return e==="real"||e==="reexport-only"||e==="import-only"}function fe(){let e=process.env[ne];if(!e)return N;let n=Number(e);return Number.isFinite(n)&&n>=0?n:N}function me(){if(C!==void 0)return C;let e=process.env[ee],n=process.platform==="win32"?"codebaseiq-kernels.exe":"codebaseiq-kernels";return C=[...e?[e]:[],...de().map(i=>T(i,"target","release",n))].find(i=>k(i))??null,C}function de(){let e=new Set,n=L(j(import.meta.url));for(let r=0;r<5;r++)e.add(n),n=L(n);return[...e]}export{Le as a,Me as b,Ne as c,J as d};
|
|
2
|
+
//# sourceMappingURL=chunk-NBZKSTXP.js.map
|