scip-query 0.10.11 → 0.11.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 +45 -0
- package/{vendor/scip/LICENSE.scip → LICENSE} +1 -0
- package/README.md +168 -55
- package/dist/augment-vue-worker.js +1 -1
- package/dist/chunk-2VSDXOG5.js +2 -0
- package/dist/chunk-343O6EVV.js +2 -0
- package/dist/chunk-3KDUITBE.js +7 -0
- package/dist/chunk-3T2FNHIU.js +2 -0
- package/dist/chunk-3V6JQQM5.js +2 -0
- package/dist/chunk-5AAAEZ2Z.js +2 -0
- package/dist/chunk-6Q6OFLFQ.js +8 -0
- package/dist/chunk-6XA4LDHY.js +2 -0
- package/dist/chunk-75X52JTA.js +2 -0
- package/dist/{chunk-54KGX7EX.js → chunk-7HB3CZFD.js} +2 -2
- package/dist/chunk-7JZRFDCU.js +2 -0
- package/dist/chunk-7XL7J7PT.js +3 -0
- package/dist/chunk-ALHNAPS2.js +2 -0
- package/dist/{chunk-JATUZIEH.js → chunk-BDRBPG7Y.js} +2 -2
- package/dist/chunk-BN5SXXQS.js +40 -0
- package/dist/chunk-C4ICAIJ4.js +3 -0
- package/dist/{chunk-LSET2TXH.js → chunk-CMHYBXJB.js} +2 -2
- package/dist/{chunk-YWYFU2V3.js → chunk-DRPAQAFM.js} +6 -6
- package/dist/chunk-FERAXG6Y.js +72 -0
- package/dist/chunk-FLJJLSGB.js +2 -0
- package/dist/chunk-FXG3PHVW.js +9 -0
- package/dist/chunk-GCN2P4EJ.js +2 -0
- package/dist/chunk-GHXRVCIY.js +21 -0
- package/dist/chunk-GNG622H3.js +3 -0
- package/dist/chunk-H4LUPLEJ.js +2 -0
- package/dist/{chunk-BASVXNY3.js → chunk-H56MGERE.js} +4 -4
- package/dist/chunk-H7NSJ7L2.js +5 -0
- package/dist/chunk-HINMXZ6J.js +2 -0
- package/dist/chunk-HXXMPYEF.js +2 -0
- package/dist/{chunk-Z3YYR4OS.js → chunk-HZKMEXA3.js} +2 -2
- package/dist/chunk-IFSX6YVU.js +4 -0
- package/dist/chunk-ISLWJ4PY.js +10 -0
- package/dist/chunk-J5WVNZ6O.js +2 -0
- package/dist/chunk-K2HYR5A7.js +3 -0
- package/dist/chunk-K6UI6EBZ.js +2 -0
- package/dist/chunk-KJCDEDQW.js +2 -0
- package/dist/{chunk-Z4HICZGY.js → chunk-KKMOB3OJ.js} +2 -2
- package/dist/{chunk-YWOOQ4FF.js → chunk-KMVGRIO2.js} +2 -2
- package/dist/chunk-LWOOTRHC.js +2 -0
- package/dist/{chunk-EY43NV4M.js → chunk-LZNLRE4X.js} +17 -8
- package/dist/chunk-M2YXL62V.js +23 -0
- package/dist/chunk-MNEJYEHW.js +3 -0
- package/dist/chunk-MTDBHTSF.js +2 -0
- package/dist/{chunk-ZQDIXAF5.js → chunk-N2Z3CU7X.js} +2 -2
- package/dist/chunk-N7PNFLGY.js +2 -0
- package/dist/chunk-NAH5EAZS.js +6 -0
- package/dist/chunk-NBXK32I6.js +2 -0
- package/dist/chunk-NJJ7AS4F.js +2 -0
- package/dist/{chunk-FDEQIPPK.js → chunk-NLMRJ7SI.js} +2 -2
- package/dist/chunk-ODVITBYU.js +26 -0
- package/dist/chunk-ORBRX2QJ.js +2 -0
- package/dist/chunk-P36UR5II.js +2 -0
- package/dist/chunk-PYZZBIEU.js +3 -0
- package/dist/chunk-PZS6J5YG.js +16 -0
- package/dist/{chunk-LM5SHAN4.js → chunk-QARYU7R3.js} +2 -2
- package/dist/chunk-QJ3FK4TB.js +38 -0
- package/dist/chunk-QXGTGE2C.js +35 -0
- package/dist/chunk-QZ4JVECJ.js +2 -0
- package/dist/chunk-R3JY4EZ4.js +102 -0
- package/dist/{chunk-VOYOYC5T.js → chunk-R5336VHZ.js} +2 -2
- package/dist/chunk-RJMXSHKM.js +2 -0
- package/dist/chunk-STBXCPKY.js +5 -0
- package/dist/chunk-T2FQ4GHD.js +9 -0
- package/dist/chunk-TFWDJDGO.js +2 -0
- package/dist/chunk-TG7QSYCJ.js +2 -0
- package/dist/{chunk-FKCGBZAC.js → chunk-TTS75UF2.js} +5 -5
- package/dist/{chunk-BVRS7RKQ.js → chunk-U7I373V4.js} +2 -2
- package/dist/chunk-UIKLA3F5.js +2 -0
- package/dist/{chunk-P753MDDE.js → chunk-UMPNL7T6.js} +2 -2
- package/dist/chunk-URSSPS5H.js +2 -0
- package/dist/chunk-VGMUFW3J.js +2 -0
- package/dist/chunk-VXTNADIW.js +18 -0
- package/dist/chunk-VYF5HA76.js +2 -0
- package/dist/chunk-WFGOH2UI.js +43 -0
- package/dist/chunk-WGA5BBTA.js +4 -0
- package/dist/chunk-WIBFXSYB.js +6 -0
- package/dist/chunk-WPSS37EW.js +2 -0
- package/dist/chunk-WQHWIVA7.js +3 -0
- package/dist/chunk-WS3Z6W3M.js +65 -0
- package/dist/chunk-WXVGNFAO.js +2 -0
- package/dist/{chunk-6LJHXREW.js → chunk-WZLPXFZU.js} +2 -2
- package/dist/chunk-X4O6K47U.js +2 -0
- package/dist/chunk-X6OGDTQH.js +2 -0
- package/dist/chunk-XEMQUN3Z.js +20 -0
- package/dist/{chunk-7B6LP46R.js → chunk-XHWLNQVZ.js} +2 -2
- package/dist/chunk-XMR747CP.js +2 -0
- package/dist/chunk-Y6L4LXPG.js +2 -0
- package/dist/chunk-YCPASUCX.js +2 -0
- package/dist/chunk-YZXV3CU3.js +60 -0
- package/dist/chunk-ZEKBR4OK.js +10 -0
- package/dist/chunk-ZMGBWSFZ.js +2 -0
- package/dist/cli.js +462 -274
- package/dist/{config-types-BDIWAYzr.d.ts → config-types-BrHl3Bge.d.ts} +61 -1
- package/dist/{db-Djj3Nqrb.d.ts → db-_Bdx0E1W.d.ts} +1 -1
- package/dist/diff-gate-types-CG2YQ_ei.d.ts +4 -0
- package/dist/{frontend-behavior-evidence-BxKpKWUu.d.ts → frontend-behavior-evidence-EfM4_9bc.d.ts} +1 -1
- package/dist/{health-D5J42g4D.d.ts → health-BEZ1Rt0S.d.ts} +54 -2
- package/dist/index.d.ts +10 -70
- package/dist/index.js +2 -2
- package/dist/postinstall.js +1 -4
- package/dist/queries/affected.d.ts +2 -2
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.d.ts +2 -2
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +2 -2
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +2 -2
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +2 -2
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.d.ts +2 -2
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.d.ts +12 -2
- 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 +7 -3
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +42 -4
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.d.ts +2 -2
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +2 -2
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +12 -3
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +2 -2
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +3 -3
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deep-chains.d.ts +2 -2
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/deps.d.ts +2 -2
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-gate.d.ts +65 -8
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.d.ts +21 -3
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.d.ts +29 -2
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.d.ts +15 -3
- package/dist/queries/drift.js +1 -1
- package/dist/queries/duplicate-bodies.d.ts +55 -0
- package/dist/queries/duplicate-bodies.js +2 -0
- package/dist/queries/extract-candidates.d.ts +2 -2
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +2 -2
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +4 -3
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +3 -3
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +2 -2
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +2 -2
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +2 -2
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +3 -2
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +12 -7
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +2 -2
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.d.ts +2 -2
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.d.ts +2 -2
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +2 -2
- package/dist/queries/methods.js +1 -1
- package/dist/queries/outline.d.ts +2 -2
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +11 -3
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.d.ts +3 -2
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.d.ts +7 -2
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +3 -3
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/react-large-component-pressure.d.ts +2 -2
- package/dist/queries/react-large-component-pressure.js +1 -1
- package/dist/queries/recent-duplicates.d.ts +2 -2
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +2 -2
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +2 -2
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.d.ts +9 -4
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.d.ts +2 -2
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +2 -2
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +17 -10
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +85 -17
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +2 -2
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +2 -2
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +2 -2
- package/dist/queries/surface.d.ts +2 -2
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +2 -2
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +2 -2
- package/dist/queries/system.js +1 -1
- package/dist/queries/trace.d.ts +2 -2
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.d.ts +55 -0
- package/dist/queries/twin-ab.js +2 -0
- package/dist/queries/twin-drift.d.ts +97 -0
- package/dist/queries/twin-drift.js +2 -0
- package/dist/queries/unused-imports.d.ts +2 -2
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.d.ts +2 -2
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/vue-component-duplicates.d.ts +7 -2
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.d.ts +3 -3
- package/dist/queries/vue-composable-candidates.js +1 -1
- package/dist/queries/vue-large-view-pressure.d.ts +6 -2
- package/dist/queries/vue-large-view-pressure.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +2 -2
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +9 -9
- package/dist/reindex.d.ts +30 -4
- package/dist/reindex.js +19 -19
- package/dist/runtime.d.ts +12 -6
- package/dist/runtime.js +2 -2
- package/dist/{scip-cli-CnK9Va4O.d.ts → scip-cli-C7cg4ZHR.d.ts} +1 -1
- package/dist/symbol-types-DaoeXKUt.d.ts +66 -0
- package/docs/AGENT_GUIDE.md +20 -18
- package/docs/AI_FAILURE_MODES.md +36 -13
- package/docs/API.md +1 -1
- package/docs/COMMAND_REFERENCE.md +57 -14
- package/docs/DETECTOR_GUIDE.md +20 -3
- package/docs/REGEX_POLICY.md +34 -0
- package/docs/analyzer-inventory.md +48 -3
- package/docs/analyzer-validation-ledger.md +41 -6
- package/package.json +23 -7
- package/scripts/build-scip-windows.mjs +10 -7
- package/scripts/evidence-product-contract.mjs +197 -0
- package/skills/_shared/SKILL.md +243 -0
- package/skills/_shared/agents/openai.yaml +4 -0
- package/skills/scip-api-impact/SKILL.md +55 -71
- package/skills/scip-claim-audit/SKILL.md +105 -0
- package/skills/scip-claim-audit/agents/openai.yaml +4 -0
- package/skills/scip-cleanup-audit/SKILL.md +122 -0
- package/skills/scip-cleanup-audit/agents/openai.yaml +4 -0
- package/skills/scip-cleanup-improve/SKILL.md +84 -0
- package/skills/scip-cleanup-improve/agents/openai.yaml +4 -0
- package/skills/scip-concrete-plan/SKILL.md +181 -0
- package/skills/scip-concrete-plan/agents/openai.yaml +4 -0
- package/skills/scip-conductor/SKILL.md +133 -0
- package/skills/scip-conductor/agents/openai.yaml +4 -0
- package/skills/scip-debug/SKILL.md +60 -58
- package/skills/scip-diagram/SKILL.md +64 -94
- package/skills/scip-directory-architecture/SKILL.md +65 -107
- package/skills/scip-doc-reconcile/SKILL.md +56 -67
- package/skills/scip-explore/SKILL.md +78 -210
- package/skills/scip-hyper-optimization/SKILL.md +124 -198
- package/skills/scip-integrity-audit/SKILL.md +103 -0
- package/skills/scip-integrity-audit/agents/openai.yaml +4 -0
- package/skills/scip-language-playbook/SKILL.md +56 -326
- package/skills/scip-maintainability/SKILL.md +80 -219
- package/skills/scip-probe-reachability/SKILL.md +92 -0
- package/skills/scip-probe-reachability/agents/openai.yaml +4 -0
- package/skills/scip-query/SKILL.md +108 -124
- package/skills/scip-react-maintainability/SKILL.md +64 -82
- package/skills/scip-setup/SKILL.md +121 -0
- package/skills/scip-setup/agents/openai.yaml +4 -0
- package/skills/scip-tla-model-system/SKILL.md +138 -0
- package/skills/scip-tla-model-system/agents/openai.yaml +4 -0
- package/skills/scip-triage-issue/SKILL.md +53 -41
- package/skills/scip-twin-drift/SKILL.md +107 -0
- package/skills/scip-twin-drift/agents/openai.yaml +4 -0
- package/skills/scip-verify/SKILL.md +70 -88
- package/skills/scip-vue-maintainability/SKILL.md +67 -94
- package/dist/chunk-2KHTSEIL.js +0 -102
- package/dist/chunk-3VD3JMK2.js +0 -2
- package/dist/chunk-4UZO3XCV.js +0 -35
- package/dist/chunk-5GOLFJEO.js +0 -8
- package/dist/chunk-5OST6GYB.js +0 -2
- package/dist/chunk-65AU3HFZ.js +0 -2
- package/dist/chunk-6GN7FXCH.js +0 -2
- package/dist/chunk-6IR2AOBM.js +0 -7
- package/dist/chunk-6JRV4MY2.js +0 -23
- package/dist/chunk-6QSOCTZT.js +0 -18
- package/dist/chunk-72KY2ZFO.js +0 -2
- package/dist/chunk-7GO4EQF5.js +0 -2
- package/dist/chunk-7IVSJJZU.js +0 -7
- package/dist/chunk-7TWLSZK5.js +0 -2
- package/dist/chunk-A536TEU4.js +0 -3
- package/dist/chunk-AVWPHM2Q.js +0 -4
- package/dist/chunk-B32FX5KB.js +0 -2
- package/dist/chunk-B6MJ5VQV.js +0 -2
- package/dist/chunk-BFXPG2VN.js +0 -2
- package/dist/chunk-BSN22NRK.js +0 -9
- package/dist/chunk-BZ53S4ZN.js +0 -2
- package/dist/chunk-C5CTSJ6X.js +0 -6
- package/dist/chunk-CO5GJRP7.js +0 -2
- package/dist/chunk-CW5YFOCP.js +0 -5
- package/dist/chunk-DS6QEB3G.js +0 -5
- package/dist/chunk-E35O7UCB.js +0 -2
- package/dist/chunk-EXDQ35NN.js +0 -2
- package/dist/chunk-FAYI6KZ5.js +0 -2
- package/dist/chunk-FFVIFETB.js +0 -2
- package/dist/chunk-FG4NT6VY.js +0 -2
- package/dist/chunk-FXNWFMKW.js +0 -25
- package/dist/chunk-G5UPYQGL.js +0 -4
- package/dist/chunk-GQBMH2TQ.js +0 -2
- package/dist/chunk-GRJY65YT.js +0 -2
- package/dist/chunk-HF25DFSC.js +0 -3
- package/dist/chunk-HHN2B5KA.js +0 -2
- package/dist/chunk-IHUETYFW.js +0 -2
- package/dist/chunk-JCLDUKT6.js +0 -38
- package/dist/chunk-JGN2ZFJR.js +0 -2
- package/dist/chunk-JM72FNGA.js +0 -2
- package/dist/chunk-JME7OWD3.js +0 -2
- package/dist/chunk-KDFONWTW.js +0 -40
- package/dist/chunk-LPL4MA6R.js +0 -2
- package/dist/chunk-LZHUWKGD.js +0 -2
- package/dist/chunk-M4COR2H6.js +0 -2
- package/dist/chunk-NOJAM5ZV.js +0 -21
- package/dist/chunk-O6ZH6C6Y.js +0 -2
- package/dist/chunk-OBGRLXWF.js +0 -3
- package/dist/chunk-OLTESY4K.js +0 -3
- package/dist/chunk-ONPCQ2PM.js +0 -6
- package/dist/chunk-P4KYUPBD.js +0 -4
- package/dist/chunk-P5RYBRIO.js +0 -4
- package/dist/chunk-P7AL7Y37.js +0 -2
- package/dist/chunk-PFOCOG57.js +0 -2
- package/dist/chunk-QLAUCRDJ.js +0 -2
- package/dist/chunk-QPU7EXAW.js +0 -2
- package/dist/chunk-QYB5P7GL.js +0 -2
- package/dist/chunk-RNM6LMCF.js +0 -2
- package/dist/chunk-RVWSAMTT.js +0 -2
- package/dist/chunk-TK7O5ER5.js +0 -3
- package/dist/chunk-TQ5W2H3S.js +0 -4
- package/dist/chunk-USPV3T5K.js +0 -2
- package/dist/chunk-UUBMFL3F.js +0 -59
- package/dist/chunk-VCQYSG2M.js +0 -10
- package/dist/chunk-VUKC6F77.js +0 -20
- package/dist/chunk-W2CBNBEL.js +0 -71
- package/dist/chunk-W6BVEKYC.js +0 -3
- package/dist/chunk-WUCEKFQC.js +0 -3
- package/dist/chunk-XUGQU7PM.js +0 -41
- package/dist/chunk-Y5NBHMQX.js +0 -2
- package/dist/chunk-YCOFCT4B.js +0 -2
- package/dist/chunk-YZA6PPZL.js +0 -3
- package/skills/concrete-plan/SKILL.md +0 -372
- package/skills/concrete-plan/agents/openai.yaml +0 -4
- package/skills/scip-adoption/SKILL.md +0 -122
- package/skills/scip-adoption/agents/openai.yaml +0 -4
- package/skills/scip-ai-cleanup/SKILL.md +0 -153
- package/skills/scip-ai-cleanup/agents/openai.yaml +0 -4
- package/skills/scip-debloat/SKILL.md +0 -439
- package/skills/scip-debloat/agents/openai.yaml +0 -4
- package/skills/scip-health-audit/SKILL.md +0 -162
- package/skills/scip-health-audit/agents/openai.yaml +0 -4
- package/skills/scip-health-improve/SKILL.md +0 -155
- package/skills/scip-health-improve/agents/openai.yaml +0 -4
- package/skills/scip-query-setup/SKILL.md +0 -170
- package/skills/scip-query-setup/agents/openai.yaml +0 -3
- package/vendor/scip/README.md +0 -6
- package/vendor/scip/win32-arm64/scip.exe +0 -0
- package/vendor/scip/win32-x64/scip.exe +0 -0
package/dist/reindex.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
VALUES (?, ?, NULL, ?)`),u=i.transaction(g=>{let l=0;for(let p of g){if(o.has(p))continue;let h=
|
|
3
|
-
`).filter(r=>r&&t.has(
|
|
4
|
-
`)){if(!r)continue;let i=
|
|
5
|
-
`)
|
|
6
|
-
`)
|
|
1
|
+
import{a as R,b as E,f as V}from"./chunk-WIBFXSYB.js";import{a as ce}from"./chunk-YZXV3CU3.js";import{d as se,e as ae,f as ue}from"./chunk-GNG622H3.js";import"./chunk-64MNV6AB.js";import"./chunk-7S5E7KWT.js";import{execFileSync as Gr}from"child_process";import{closeSync as Hr,copyFileSync as zr,existsSync as M,mkdirSync as re,mkdtempSync as Kr,openSync as Xr,readFileSync as D,renameSync as k,rmSync as I,writeFileSync as ot}from"fs";import{basename as T,dirname as f,extname as Yr,join as m}from"path";import{platform as Qr}from"os";import mt from"better-sqlite3";import{execFileSync as ht}from"child_process";import{existsSync as yt,readdirSync as bt,readFileSync as xt}from"fs";import{extname as j,join as le}from"path";function x(e={}){return{id:"auxiliary-documents",facts:["auxiliary-document"],run:t=>ge({projectRoot:t.projectRoot,dbPath:t.dbPath,extensions:e.extensions,onStatus:t.onStatus})}}function ge(e){let t=new Set((e.extensions??ae).map(o=>o.toLowerCase()));if(t.size===0)return{scanned:0,inserted:0,existing:0};if(!yt(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let n=ce(e.projectRoot),r=St(e.projectRoot,t).filter(o=>!n.isIgnored(o)),i=new mt(e.dbPath);try{let o=Pt(i,r),s=i.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
|
|
2
|
+
VALUES (?, ?, NULL, ?)`),u=i.transaction(g=>{let l=0;for(let p of g){if(o.has(p))continue;let h=xt(le(e.projectRoot,p),"utf-8"),ft=s.run(vt(p),p,h);l+=Number(ft.changes)}return l})(r),c={scanned:r.length,inserted:u,existing:r.length-u};return e.onStatus?.(`Augmented SQLite documents with ${u} auxiliary source file${u===1?"":"s"} (${c.existing} already present).`),c}finally{i.close()}}function St(e,t){let n=Rt(e,t);if(n)return n;let r=[],i=o=>{let s=o?le(e,o):e,a;try{a=bt(s,{withFileTypes:!0})}catch{return}for(let u of a){if(ue.has(u.name))continue;let c=o?`${o}/${u.name}`:u.name;if(u.isDirectory()){i(c);continue}t.has(j(u.name).toLowerCase())&&r.push(c)}};return i(""),r.sort()}function Rt(e,t){try{return ht("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"]}).split(`
|
|
3
|
+
`).filter(r=>r&&t.has(j(r).toLowerCase())).sort()}catch{return null}}function Pt(e,t){let n=new Set,r=500;for(let i=0;i<t.length;i+=r){let o=t.slice(i,i+r),s=e.prepare(`SELECT relative_path FROM documents WHERE relative_path IN (${o.map(()=>"?").join(",")})`).all(...o);for(let a of s)n.add(a.relative_path)}return n}function vt(e){return j(e).toLowerCase()===".vue"?"vue":j(e).replace(/^\./,"").toLowerCase()||"source"}import{execFileSync as kt}from"child_process";import{existsSync as It,readdirSync as de}from"fs";import{extname as fe,join as me}from"path";var jt=new Set([".git",".hg",".svn",".idea",".vscode","node_modules","vendor","dist","build","target","bin","obj",".dart_tool",".gradle",".next",".venv","venv","__pycache__"]),wt=[{language:"typescript",files:["tsconfig.json","tsconfig.base.json"],extensions:[".ts",".tsx",".mts",".cts"]},{language:"rust",files:["Cargo.toml"],extensions:[".rs"]},{language:"go",files:["go.mod"],extensions:[".go"]},{language:"java",files:["pom.xml","build.gradle","build.gradle.kts"],extensions:[".java"]},{language:"kotlin",files:["build.gradle.kts"],extensions:[".kt",".kts"]},{language:"scala",files:["build.sbt"],extensions:[".scala"]},{language:"clojure",files:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"],extensions:[".clj",".cljs",".cljc"]},{language:"python",files:["pyproject.toml","setup.py","setup.cfg","Pipfile"],extensions:[".py",".pyi"]},{language:"ruby",files:["Gemfile"],extensions:[".rb"]},{language:"cpp",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"]},{language:"c",files:["compile_commands.json","CMakeLists.txt","Makefile"],extensions:[".c",".h"]},{language:"csharp",globs:["*.csproj","*.sln"],extensions:[".cs"]},{language:"vb",globs:["*.vbproj"],extensions:[".vb"]},{language:"dart",files:["pubspec.yaml"],extensions:[".dart"]},{language:"php",files:["composer.json"],extensions:[".php"]},{language:"javascript",files:["package.json"],extensions:[".js",".jsx",".mjs",".cjs"]}];function A(e){let t=[],n=Ct(e),r=Tt(e);for(let i of wt){if(Lt(e,i.files)){t.push(i.language);continue}if(Ot(n,i.globs)){t.push(i.language);continue}Dt(r,i.extensions)&&t.push(i.language)}return t.includes("typescript")&&pe(t,"javascript"),t.includes("cpp")&&!r.has(".c")&&pe(t,"c"),t}function Ct(e){try{return de(e)}catch{return[]}}function Lt(e,t){return t?.length?t.some(n=>It(me(e,n))):!1}function Ot(e,t){return t?.length?e.some(n=>t.some(r=>Ft(n,r))):!1}function Ft(e,t){if(t==="*")return!0;if(!t.includes("*"))return e===t;let[n,r]=t.split("*");return e.startsWith(n??"")&&e.endsWith(r??"")}function Tt(e){let t=Mt(e);if(t)return t;let n=new Set,r=[e];for(;r.length>0;){let i=r.pop();if(!i)continue;let o;try{o=de(i,{withFileTypes:!0})}catch{continue}for(let s of o){if(s.name.startsWith(".")&&!s.name.endsWith("proj")&&!s.name.endsWith("sln")&&s.isDirectory())continue;let a=me(i,s.name);if(s.isDirectory()){jt.has(s.name)||r.push(a);continue}let u=fe(s.name).toLowerCase();u&&n.add(u)}}return n}function Mt(e){try{let t=kt("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"]}),n=new Set;for(let r of t.split(`
|
|
4
|
+
`)){if(!r)continue;let i=fe(r).toLowerCase();i&&n.add(i)}return n}catch{return null}}function Dt(e,t){return t?.length?t.some(n=>e.has(n)):!1}function pe(e,t){let n=e.indexOf(t);n!==-1&&e.splice(n,1)}import{existsSync as he,readdirSync as Et}from"fs";import{isAbsolute as Vt,join as N,resolve as At}from"path";var be={typescript:{language:"typescript",indexerBinary:"scip-typescript",checkCommand:"npx scip-typescript --version",indexArgs:({outputPath:e,pnpmWorkspaces:t,indexerBinary:n,projectPath:r})=>{let i=r?["index","--output",e,"--no-progress-bar",r]:["index","--infer-tsconfig","--output",e,"--no-progress-bar"];return t&&!r&&i.splice(1,0,"--pnpm-workspaces"),{binary:n,args:i}},markerFiles:["tsconfig.json"],installMethods:[{label:"npm",prerequisite:"npm",binary:"npm",args:["install","-g","@sourcegraph/scip-typescript"]}],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","--infer-tsconfig","--output",e,"--no-progress-bar"]}),markerFiles:["package.json"],installMethods:[{label:"npm",prerequisite:"npm",binary:"npm",args:["install","-g","@sourcegraph/scip-typescript"]}],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:["pom.xml","build.gradle"],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:["build.sbt"],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:["build.gradle.kts"],installMethods:[],installUrl:"https://github.com/sourcegraph/scip-java/releases"},rust:{language:"rust",indexerBinary:"rust-analyzer",checkCommand:"rust-analyzer --version",indexArgs:({outputPath:e})=>({binary:"rust-analyzer",args:["scip",".","--output",e]}),markerFiles:["Cargo.toml"],installMethods:[{label:"rustup",prerequisite:"rustup",binary:"rustup",args:["component","add","rust-analyzer"]}],installUrl:"https://github.com/rust-lang/rust-analyzer"},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:["pyproject.toml","setup.py"],installMethods:[{label:"npm",prerequisite:"npm",binary:"npm",args:["install","-g","scip-python-plus"]}],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",Vt(r)?r:At(e,r)),{binary:n,args:i}},markerFiles:["deps.edn","project.clj","bb.edn","shadow-cljs.edn"],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:["Gemfile"],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:["go.mod"],installMethods:[{label:"go install",prerequisite:"go",binary:"go",args:["install","github.com/sourcegraph/scip-go@latest"]}],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:["CMakeLists.txt","Makefile"],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:["CMakeLists.txt","Makefile"],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",ye(e,[".sln",".csproj"])??e,"--output",t,"--working-directory",e]}),markerFiles:["*.csproj","*.sln"],installMethods:[{label:"dotnet",prerequisite:"dotnet",binary:"dotnet",args:["tool","install","--global","scip-dotnet"]}],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",ye(e,[".sln",".vbproj"])??e,"--output",t,"--working-directory",e]}),markerFiles:["*.vbproj","*.sln"],installMethods:[{label:"dotnet",prerequisite:"dotnet",binary:"dotnet",args:["tool","install","--global","scip-dotnet"]}],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:["pubspec.yaml"],installMethods:[{label:"dart pub",prerequisite:"dart",binary:"dart",args:["pub","global","activate","scip_dart"]}],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:({projectRoot:e,indexerBinary:t})=>{let n=N(e,"vendor","bin","scip-php"),r=N(e,"vendor","davidrjenni","scip-php","bin","scip-php");return{binary:"php",args:["-d","error_reporting=E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED",he(r)?r:he(n)?n:t]}},defaultOutputPath:"index.scip",markerFiles:["composer.json"],installMethods:[],installUrl:"https://github.com/davidrjenni/scip-php/releases"}};function w(e){return be[e]}function ye(e,t){let n;try{n=Et(e)}catch{return null}for(let r of t)for(let i of n)if(i.endsWith(r))return N(e,i);return null}import{readFileSync as Nt,writeFileSync as $t}from"fs";import{create as $}from"@bufbuild/protobuf";import{deserializeSCIP as _t,serializeSCIP as Bt,DocumentSchema as Wt,IndexSchema as Ut,SymbolInformationSchema as Jt}from"@c4312/scip";function xe(e){if(e.length===0)throw new Error("Cannot merge zero SCIP indexes");if(e.length===1)return e[0];let t=qt(e),n=Gt(e.flatMap(i=>i.documents??[])),r=Se(e.flatMap(i=>i.externalSymbols??[]));return $(Ut,{metadata:t,documents:n,externalSymbols:r})}function C(e,t){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let n=e.map(i=>_t(Nt(i))),r=xe(n);return $t(t,Buffer.from(Bt(r))),{documentCount:r.documents.length,externalSymbolCount:r.externalSymbols.length,inputCount:e.length}}function qt(e){let t=e[0]?.metadata;if(!t)return;let n=t.projectRoot;for(let r of e.slice(1)){let i=r.metadata?.projectRoot;if(n&&i&&i!==n)throw new Error(`Cannot merge SCIP indexes with different project roots: ${n} vs ${i}`)}return t}function Gt(e){let t=new Map;for(let n of e){let r=t.get(n.relativePath);if(!r){t.set(n.relativePath,n);continue}t.set(n.relativePath,$(Wt,{language:r.language||n.language,relativePath:r.relativePath||n.relativePath,occurrences:Ht([...r.occurrences,...n.occurrences]),symbols:Se([...r.symbols,...n.symbols]),text:Kt(r.text,n.text),positionEncoding:r.positionEncoding||n.positionEncoding}))}return[...t.values()]}function Ht(e){let t=new Set,n=[];for(let r of e){let i=JSON.stringify(r);t.has(i)||(t.add(i),n.push(r))}return n}function Se(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,$(Jt,{symbol:r.symbol,documentation:Xt([...r.documentation,...n.documentation]),relationships:zt([...r.relationships,...n.relationships]),kind:r.kind||n.kind,displayName:r.displayName||n.displayName,enclosingSymbol:r.enclosingSymbol||n.enclosingSymbol,signatureDocumentation:r.signatureDocumentation??n.signatureDocumentation}))}return[...t.values()]}function zt(e){let t=new Set,n=[];for(let r of e){let i=[r.symbol,r.isReference?"1":"0",r.isImplementation?"1":"0",r.isTypeDefinition?"1":"0",r.isDefinition?"1":"0"].join("|");t.has(i)||(t.add(i),n.push(r))}return n}function Kt(e,t){return e?t?e.length>=t.length?e:t:e:t}function Xt(e){return[...new Set(e)]}import{readFileSync as Yt,writeFileSync as Qt}from"fs";function y(e,t){let n=Date.now(),r=e.run(t);return{stageId:e.id,facts:e.facts,durationMs:Date.now()-n,result:r}}function Pe(e){let t=e.readFingerprint(),n=Zt(e.cachePath,t);if(n)return e.onCacheHit?.(n.result),n.result;let r=e.compute();return en(e.cachePath,e.readFingerprint(),r),r}function Zt(e,t){try{let n=JSON.parse(Yt(e,"utf-8"));return Re(n.fingerprint)===Re(t)?{result:n.result}:null}catch{return null}}function en(e,t,n){Qt(e,`${JSON.stringify({updatedAt:new Date().toISOString(),fingerprint:t,result:n},null,2)}
|
|
5
|
+
`)}function Re(e){return JSON.stringify(e)}import{execFileSync as tn}from"child_process";import{createHash as nn}from"crypto";import{readdirSync as rn,readFileSync as on}from"fs";import{join as ke}from"path";function _(e){return[...new Set((e??[]).map(t=>t.trim()).filter(Boolean))].sort((t,n)=>t.localeCompare(n))}function ve(e){return(an(e)??un(e)).filter(t=>t&&!Ie(t)).sort()}function P(e,t={}){return(t.language?ve(e).filter(r=>sn(r,t.language,t.markerFiles)):ve(e)).map(r=>{let i=ke(e,r);try{let o=on(i);return{path:r,size:o.byteLength,hash:nn("sha256").update(o).digest("hex")}}catch{return{path:r,size:-1,hash:"unreadable"}}})}function sn(e,t,n){let r=e.split("/").at(-1)??e;if(n?.includes(e)||n?.includes(r)||ln.has(r))return!0;let i=e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:"";return(gn[t]??[]).includes(i)}function an(e){try{return tn("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:50*1024*1024,stdio:["ignore","pipe","ignore"]}).split(`
|
|
6
|
+
`).filter(Boolean)}catch{return null}}function un(e){let t=[],n=[""];for(;n.length>0;){let r=n.pop(),i=r?ke(e,r):e,o;try{o=rn(i,{withFileTypes:!0})}catch{continue}for(let s of o){let a=r?`${r}/${s.name}`:s.name;if(s.isDirectory()){Ie(a)||n.push(a);continue}t.push(a)}}return t}function Ie(e){let t=e.split("/");return e==="meta.json"||t.some(n=>cn.has(n))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var cn=new Set([".git","node_modules",".scipquery-cache",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]),ln=new Set(["package.json","package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lockb","tsconfig.json","tsconfig.base.json","pyproject.toml","setup.py","setup.cfg","Cargo.toml","Cargo.lock","go.mod","go.sum","pom.xml","build.gradle","build.gradle.kts","build.sbt","compile_commands.json","CMakeLists.txt","Makefile","Gemfile","Gemfile.lock","composer.json","composer.lock","pubspec.yaml","pubspec.lock","deps.edn","project.clj","bb.edn","shadow-cljs.edn"]),gn={typescript:[".ts",".tsx",".mts",".cts"],javascript:[".js",".jsx",".mjs",".cjs"],java:[".java"],scala:[".scala"],kotlin:[".kt",".kts"],rust:[".rs"],python:[".py",".pyi"],ruby:[".rb"],go:[".go"],cpp:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"],c:[".c",".h"],csharp:[".cs"],vb:[".vb"],dart:[".dart"],php:[".php"],clojure:[".clj",".cljs",".cljc"]};import{readFileSync as pn,writeFileSync as dn}from"fs";import{create as je}from"@bufbuild/protobuf";import{deserializeSCIP as fn,DocumentSchema as mn,IndexSchema as hn,serializeSCIP as yn,SymbolRole as bn}from"@c4312/scip";function we(e){let t;try{t=fn(pn(e))}catch{return{removedDefinitionOccurrences:0,touchedDocuments:0}}let n=xn(t);return n.removedDefinitionOccurrences>0&&dn(e,Buffer.from(yn(n.index))),{removedDefinitionOccurrences:n.removedDefinitionOccurrences,touchedDocuments:n.touchedDocuments}}function xn(e){let t=new Set;for(let o of e.documents)for(let s of o.symbols)s.symbol&&t.add(s.symbol);for(let o of e.externalSymbols)o.symbol&&t.add(o.symbol);let n=0,r=0,i=[];for(let o of e.documents){let s=o.occurrences.filter(a=>(a.symbolRoles&bn.Definition)===0||t.has(a.symbol)?!0:(n+=1,!1));if(s.length===o.occurrences.length){i.push(o);continue}r+=1,i.push(je(mn,{language:o.language,relativePath:o.relativePath,occurrences:s,symbols:o.symbols,text:o.text,positionEncoding:o.positionEncoding}))}return{index:n===0?e:je(hn,{metadata:e.metadata,documents:i,externalSymbols:e.externalSymbols}),removedDefinitionOccurrences:n,touchedDocuments:r}}import{existsSync as Sn,readFileSync as Rn,readdirSync as Pn,statSync as vn}from"fs";import d from"path";var kn=new Set([".cache",".git",".next",".nuxt",".turbo",".nx","build","coverage","dist","node_modules","tmp","vendor"]);function Ce(e,t=[]){let n=d.resolve(e),r=In(n),i=t.flatMap(u=>jn(n,u)),o=Cn([...r,...i]),s=Ln(n,o)?[n,...o]:o,a=s.length>0?s:[n];return[...new Set(a.map(u=>Fn(n,u)))].sort((u,c)=>u.localeCompare(c))}function In(e){let t=[],n=[e];for(;n.length>0;){let r=n.pop(),i;try{i=Pn(r,{withFileTypes:!0})}catch{continue}for(let o of i){let s=d.join(r,o.name);if(o.isDirectory()){!kn.has(o.name)&&!o.name.startsWith(".")&&n.push(s);continue}o.isFile()&&wn(s)&&t.push(d.dirname(s))}}return t}function jn(e,t){let n=t.trim();if(!n)return[];let r=d.resolve(e,n);if(!se(e,r))return[];try{let i=vn(r);if(i.isDirectory())return[r];if(i.isFile()&&Le(d.basename(r)))return[d.dirname(r)]}catch{return[]}return[]}function wn(e){if(!Le(d.basename(e)))return!1;let t=Oe(e);return t?d.basename(e)==="tsconfig.json"||"include"in t||"files"in t||"references"in t:!1}function Le(e){return e.startsWith("tsconfig")&&e.endsWith(".json")}function Cn(e){let t=[...new Set(e.map(n=>d.resolve(n)))].sort((n,r)=>n.localeCompare(r));return t.length<=1?t:t.filter(n=>!t.some(r=>r!==n&&Tn(n,r)))}function Ln(e,t){if(t.length===0||t.some(r=>d.resolve(r)===e))return!1;let n=d.join(e,"tsconfig.json");return Sn(n)&&On(n)}function On(e){let n=Oe(e)?.include;return Array.isArray(n)?n.some(r=>typeof r=="string"&&r.trim()!==""&&!r.startsWith("!")&&(r.includes("/")||r.includes("**")||!d.extname(r))):!1}function Oe(e){try{let t=JSON.parse(Rn(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}}function Fn(e,t){let n=d.relative(e,t);return n?n.split(d.sep).join("/"):"."}function Tn(e,t){let n=d.relative(e,t);return!!n&&!n.startsWith("..")&&!d.isAbsolute(n)}import{execFile as Mn}from"child_process";import{existsSync as L,renameSync as W,rmSync as U}from"fs";import{cpus as Dn}from"os";import{join as Fe}from"path";function En(e,t,n){if(!e.defaultOutputPath)return;let r=Fe(t,e.defaultOutputPath);n!==r&&L(r)&&W(r,n)}function Vn(e,t,n){if(!e.defaultOutputPath)return null;let r=Fe(t,e.defaultOutputPath);if(r===n)return null;let i=`${n}.default-output-backup`;return U(i,{force:!0}),L(r)?(W(r,i),{defaultOutputPath:r,backupPath:i}):{defaultOutputPath:r,backupPath:null}}function An(e){e&&(U(e.defaultOutputPath,{force:!0}),e.backupPath&&L(e.backupPath)&&W(e.backupPath,e.defaultOutputPath))}function Nn(e,t){if(e<=1)return 1;let n=Number(process.env.SCIP_QUERY_INDEXER_CONCURRENCY??0),r=Number.isFinite(t)&&t&&t>0?t:Number.isFinite(n)&&n>0?n:Math.min(8,Math.max(1,Dn().length));return Math.max(1,Math.min(e,Math.floor(r)))}async function Te(e,t,n,r){let i=e.filter(c=>c.config.defaultOutputPath),o=e.filter(c=>!c.config.defaultOutputPath),s=[],a=Nn(o.length,r),u=await _n(o,a,c=>B(c,t,n));if(a>1){let c=new Map;for(let g of u.filter(l=>l.skipped)){let l=o.find(p=>p.id===g.id);l&&(n(`Retrying ${l.label} indexer serially after parallel failure...`),c.set(l.id,await B(l,t,n)))}s.push(...u.map(g=>c.get(g.id)??g))}else s.push(...u);for(let c of i)s.push(await B(c,t,n));return s.sort((c,g)=>e.findIndex(l=>l.id===c.id)-e.findIndex(l=>l.id===g.id))}async function B(e,t,n){n(`Indexing ${e.label} with ${e.resolvedBinary}...`),U(e.scipPath,{force:!0});let r=Vn(e.config,t,e.scipPath);try{await $n(e.binary,e.args,{cwd:t,env:e.env,maxBuffer:50*1024*1024}),En(e.config,t,e.scipPath)}catch(i){let o=i instanceof Error?i.message:String(i),s=`${e.resolvedBinary} indexer failed: ${o.split(`
|
|
7
|
+
`)[0]}`,a=e.label===e.language?s:`${e.label}: ${s}`;return n(`Skipping ${e.label}: ${s}`),{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,skipped:{language:e.language,reason:a}}}finally{An(r)}if(!L(e.scipPath)){let i=`${e.resolvedBinary} indexer completed but did not produce ${e.scipPath}`,o=e.label===e.language?i:`${e.label}: ${i}`;return n(`Skipping ${e.label}: ${i}`),{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,skipped:{language:e.language,reason:o}}}return{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath}}function $n(e,t,n){return new Promise((r,i)=>{Mn(e,[...t],n,o=>{o?i(o):r()})})}async function _n(e,t,n){if(e.length===0)return[];let r=new Array(e.length),i=0,o=Math.max(1,Math.min(e.length,t)),s=Array.from({length:o},async()=>{for(;i<e.length;){let a=i++;r[a]=await n(e[a])}});return await Promise.all(s),r}import{execFileSync as q}from"child_process";import{existsSync as J,readFileSync as Bn}from"fs";import{createRequire as Wn}from"module";import{platform as Un}from"os";import{dirname as Me,join as O}from"path";var Jn=Wn(import.meta.url);function G(e){return[e.indexerBinary,...e.binaryAliases??[]]}function F(e){let t=G(e);return t.length===1?t[0]:t.join(" or ")}function v(e){for(let t of G(e))if(R(t))return t;return Gn(e)}function H(e){return v(e)!==null||qn(e)}function qn(e){return De(e)!==null}function Gn(e){let t=De(e);if(!t)return null;let r=JSON.parse(Bn(t,"utf8")).bin;if(!r)return null;if(typeof r=="string")return O(Me(t),r);for(let i of G(e)){let o=r[i];if(o)return O(Me(t),o)}return null}function De(e){if(!e.bundledNpmPackage)return null;try{return Jn.resolve(`${e.bundledNpmPackage}/package.json`)}catch{return null}}function z(e,t){for(let n of e.projectLocalBinaries??[]){let r=O(t,n);if(J(r))return r}return null}function K(e,t=process.env,n=e.indexerBinary){if(e.indexerBinary!=="scip-dotnet"||Ee(n,t))return t;let r=Hn(n,t);return r?{...t,DOTNET_ROOT:r}:t}function X(e,t){let n=e.installMethods,r=F(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(R(i.prerequisite)){t(`Installing ${r} via ${i.label}...`);try{q(i.binary,i.args,{stdio:"inherit",timeout:3e5,env:process.env});let o=v(e);if(o){let s=o===e.indexerBinary?"":` (using ${o})`;return t(`Successfully installed ${r} via ${i.label}${s}`),!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 Hn(e,t){for(let n of zn(t))if(Ee(e,{...t,DOTNET_ROOT:n}))return n;return null}function zn(e){let t=[],n=e.DOTNET_ROOT;if(n&&J(n)&&t.push(n),Un()==="darwin"&&R("brew"))try{let r=q("brew",["--prefix","dotnet@9"],{stdio:"pipe",env:e}).toString().trim(),i=O(r,"libexec");J(i)&&!t.includes(i)&&t.push(i)}catch{}return t}function Ee(e,t){try{return q(e,["--version"],{stdio:"pipe",env:t}),!0}catch{return!1}}import Cr from"better-sqlite3";import{existsSync as Lr}from"fs";import{dirname as Or,join as Fr,resolve as Tr}from"path";import{readFileSync as Kn,rmSync as Xn,statSync as Yn,mkdtempSync as Qn}from"fs";import{cpus as Zn,tmpdir as er}from"os";import{join as Y}from"path";import{Worker as tr}from"worker_threads";function Ve(e){return e.length>=8&&Ne(e.length)>1}function Ae(e){let t=Ne(e.vueFiles.length),n=rr(e.vueFiles),r=or(n,t),i=new URL("./augment-vue-worker.js",import.meta.url),o=Qn(Y(er(),"scip-query-vue-workers-")),s=new SharedArrayBuffer(4),a=new Int32Array(s),u=nr(),c=Date.now();try{for(let l=0;l<r.length;l++)new tr(i,{workerData:{projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,tasks:r[l],resultPath:Y(o,`${l}.json`),sharedBuffer:s}});for(;Atomics.load(a,0)<r.length;){if(Date.now()-c>u)throw new Error(`Vue reference workers timed out after ${(u/1e3).toFixed(0)}s`);Atomics.wait(a,0,Atomics.load(a,0),100)}let g=r.map((l,p)=>{let h=JSON.parse(Kn(Y(o,`${p}.json`),"utf-8"));if(!h.ok)throw new Error(`Vue reference worker failed: ${h.error}`);return h.result});return{occurrences:g.flatMap(l=>l.occurrences),skippedReferences:g.reduce((l,p)=>l+p.skippedReferences,0)}}finally{Xn(o,{recursive:!0,force:!0})}}function Ne(e){let t=Number(process.env.SCIP_QUERY_AUGMENT_VUE_WORKERS??0),n=Number.isFinite(t)&&t>0?t:Math.min(8,Math.max(1,Zn().length-1));return Math.max(1,Math.min(e,n))}function nr(){let e=Number(process.env.SCIP_QUERY_AUGMENT_VUE_WORKER_TIMEOUT_MS??0);return Number.isFinite(e)&&e>0?e:3e5}function rr(e){let t=ir(),n=[];for(let r of e){let i=$e(r),o=Math.max(1,Math.ceil(i/t));for(let s=0;s<o;s++)n.push({fileName:r,startOffset:Math.floor(i*s/o),endOffset:s===o-1?Number.POSITIVE_INFINITY:Math.floor(i*(s+1)/o),countFileSkip:s===0})}return n}function ir(){return Number.POSITIVE_INFINITY}function or(e,t){let n=Array.from({length:t},()=>({tasks:[],weight:0})),r=e.map(i=>({task:i,weight:sr(i)})).sort((i,o)=>o.weight-i.weight);for(let i of r){let o=n.reduce((s,a)=>a.weight<s.weight?a:s);o.tasks.push(i.task),o.weight+=i.weight}return n.map(i=>i.tasks).filter(i=>i.length>0)}function sr(e){return Number.isFinite(e.endOffset)?Math.max(1,e.endOffset-e.startOffset):Math.max(1,$e(e.fileName)-e.startOffset)}function $e(e){try{return Yn(e).size}catch{return 1}}import{createRequire as ar}from"module";import{existsSync as ur,readFileSync as Z}from"fs";import{dirname as _e,extname as cr,join as Be,relative as lr,resolve as gr}from"path";import{pathToFileURL as pr}from"url";function dr(e){e.transaction(()=>{e.prepare(`
|
|
7
8
|
DELETE FROM mentions
|
|
8
9
|
WHERE chunk_id IN (
|
|
9
10
|
SELECT c.id
|
|
@@ -18,12 +19,12 @@ import{a as x,b as F,f as E}from"./chunk-ONPCQ2PM.js";import{a as se}from"./chun
|
|
|
18
19
|
FROM documents
|
|
19
20
|
WHERE language = 'vue' OR relative_path LIKE '%.vue'
|
|
20
21
|
)
|
|
21
|
-
`).run()})()}function
|
|
22
|
+
`).run()})()}function We(e,t){return e.prepare(`
|
|
22
23
|
SELECT relative_path AS relativePath
|
|
23
24
|
FROM documents
|
|
24
25
|
WHERE language = 'vue' OR relative_path LIKE '%.vue'
|
|
25
26
|
ORDER BY relative_path
|
|
26
|
-
`).all().map(r=>
|
|
27
|
+
`).all().map(r=>gr(t,r.relativePath))}function Ue(e,t){let{vueCore:n,ts:r,volarTs:i}=fr(e),{parsed:o,vueOptions:s}=mr(n,r,t),a=_e(t),u=n.createVueLanguagePlugin(r,o.options,s,h=>h),c=hr(n,r,u),g=yr(a,o),{languageServiceHost:l}=i.createLanguageServiceHost(r,r.sys,c,h=>h,g),p=r.createLanguageService(l);return{ts:r,language:c,languageService:p,fileNames:o.fileNames,configDir:a}}function fr(e){let t=ar(pr(Be(e,"package.json")).href);return{vueCore:Q(t,"@vue/language-core",e),ts:Q(t,"typescript",e),volarTs:Q(t,"@volar/typescript",e)}}function mr(e,t,n){let r=t.readConfigFile(n,t.sys.readFile);if(r.error||!r.config)throw new Error(`Failed to read ${n}`);let o=e.createParsedCommandLine(t,t.sys,n).vueOptions;return typeof e.createGlobalTypesWriter=="function"&&(o.globalTypesPath=e.createGlobalTypesWriter(o,t.sys.writeFile)),{parsed:t.parseJsonConfigFileContent(r.config,t.sys,_e(n),void 0,n,void 0,e.getAllExtensions(o).map(s=>({extension:s.slice(1),isMixedContent:!0,scriptKind:t.ScriptKind.Deferred}))),vueOptions:o}}function hr(e,t,n){let r={},i=e.createLanguage([n],new Map,o=>{if(!ur(o))return;let s=Z(o,"utf-8");r.current?.scripts.set(o,t.ScriptSnapshot.fromString(s),n.getLanguageId(o)??vr(o))});return r.current=i,i}function yr(e,t){return{getCurrentDirectory:()=>e,getCompilationSettings:()=>t.options,getScriptFileNames:()=>t.fileNames,getProjectReferences:()=>t.projectReferences,getProjectVersion:()=>"0"}}function Q(e,t,n){try{return e(t)}catch(r){throw(typeof r=="object"&&r!==null&&"code"in r?r.code:null)==="MODULE_NOT_FOUND"?new Error(`Vue augmentation requires ${t} to be installed in ${n}. Install Vue/Volar dependencies for that project, then rerun augment-vue.`,{cause:r}):r}}function Je(e,t,n){let r=br(e);return i=>{let o=b(t,i.fileName),s=n.get(i.fileName);if(!s)return null;let a=n.positionAt(s,i.textSpan.start),u=r.get(o);if(!u)return null;let c=u.containingByLine.get(a.line);return c!==void 0?c:xr(u.starts,a.line,2)}}function br(e){let t=e.prepare(`
|
|
27
28
|
SELECT
|
|
28
29
|
d.relative_path AS relativePath,
|
|
29
30
|
der.start_line AS startLine,
|
|
@@ -32,23 +33,22 @@ import{a as x,b as F,f as E}from"./chunk-ONPCQ2PM.js";import{a as se}from"./chun
|
|
|
32
33
|
FROM defn_enclosing_ranges der
|
|
33
34
|
JOIN documents d ON d.id = der.document_id
|
|
34
35
|
ORDER BY d.relative_path, (der.end_line - der.start_line) DESC
|
|
35
|
-
`).all(),n=new Map;for(let r of t){let i=n.get(r.relativePath);i||(i={containingByLine:new Map,starts:[]},n.set(r.relativePath,i)),i.starts.push({line:r.startLine,symbolId:r.symbolId});for(let o=r.startLine;o<=r.endLine;o++)i.containingByLine.set(o,r.symbolId)}for(let r of n.values())r.starts.sort((i,o)=>i.line-o.line);return n}function
|
|
36
|
+
`).all(),n=new Map;for(let r of t){let i=n.get(r.relativePath);i||(i={containingByLine:new Map,starts:[]},n.set(r.relativePath,i)),i.starts.push({line:r.startLine,symbolId:r.symbolId});for(let o=r.startLine;o<=r.endLine;o++)i.containingByLine.set(o,r.symbolId)}for(let r of n.values())r.starts.sort((i,o)=>i.line-o.line);return n}function xr(e,t,n){let r=0,i=e.length-1;for(;r<=i;){let s=Math.floor((r+i)/2);e[s].line<t?r=s+1:i=s-1}let o=null;for(let s of[i,r]){let a=e[s];if(!a)continue;let u=Math.abs(a.line-t);u>n||(!o||u<o.distance)&&(o={distance:u,symbolId:a.symbolId})}return o?.symbolId??null}function qe(e,t,n){let r=jr(t),i=e.prepare("SELECT id FROM global_symbols WHERE symbol = ?"),o=e.prepare(`
|
|
36
37
|
INSERT OR IGNORE INTO global_symbols (symbol, display_name, kind, documentation)
|
|
37
38
|
VALUES (?, ?, ?, ?)
|
|
38
|
-
`),s=0,a=new Map;return e.transaction(()=>{for(let c of n){let g=
|
|
39
|
+
`),s=0,a=new Map;return e.transaction(()=>{for(let c of n){let g=b(t,c),l=et(r.name,r.version,g);o.run(l,"default",7,`Vue component|${g}`);let p=wr(i,r,t,c);p&&(s++,a.set(c,p))}})(),{get(c){return a.get(c)??null},syntheticSymbols:s}}function Ge(e,t,n,r,i){return e.transaction(()=>(dr(e),Sr(e,t,n,r),Rr(e,i)))()}function Sr(e,t,n,r){let i=e.prepare("SELECT id FROM documents WHERE relative_path = ?"),o=e.prepare(`
|
|
39
40
|
INSERT INTO chunks (document_id, chunk_index, start_line, end_line, occurrences)
|
|
40
41
|
VALUES (?, ?, ?, ?, X'00')
|
|
41
42
|
`),s=e.prepare(`
|
|
42
43
|
INSERT OR IGNORE INTO mentions (chunk_id, symbol_id, role)
|
|
43
44
|
VALUES (?, ?, 1)
|
|
44
|
-
`);for(let a of n){let u=r.get(a);if(!u)continue;let c=
|
|
45
|
+
`);for(let a of n){let u=r.get(a);if(!u)continue;let c=b(t,a),g=i.get(c);if(!g)continue;let l=o.run(g.id,-1,0,0);s.run(Number(l.lastInsertRowid),u)}}function He(e,t,n,r,i){if(e.fileName.endsWith(".vue")){let o=r.language.scripts.get(e.fileName),s=o?.generated?.languagePlugin.typescript?.getServiceScript(o.generated.root)?.code;if(o&&s){let a=r.language.maps.get(s,o);if(ee(a,e.textSpan.start)!==null)return n.get(e.fileName)}return e.fileName.startsWith(i)?n.get(e.fileName):null}return t(e)}function ze(e){let t=new Set,n=[];for(let r of e){let i=Ke(r);t.has(i)||(t.add(i),n.push(r))}return n}function Ke(e){return[e.sourceFile,e.sourceLine,e.sourceStartChar,e.sourceEndChar,e.symbolId].join(":")}function Rr(e,t){let n=Ir(e,[...new Set(t.map(u=>u.sourceFile))]),r=e.prepare(`
|
|
45
46
|
INSERT INTO chunks (document_id, chunk_index, start_line, end_line, occurrences)
|
|
46
47
|
VALUES (?, ?, ?, ?, X'00')
|
|
47
48
|
`),i=e.prepare(`
|
|
48
49
|
INSERT OR IGNORE INTO mentions (chunk_id, symbol_id, role)
|
|
49
50
|
VALUES (?, ?, 0)
|
|
50
|
-
`),o=new Set,s=0,a=0;for(let u of t){let c=
|
|
51
|
-
`)}function Ke(e,t,n){let r=e.prepare(`
|
|
51
|
+
`),o=new Set,s=0,a=0;for(let u of t){let c=Ke(u);if(o.has(c))continue;o.add(c);let g=n.get(u.sourceFile);if(!g)continue;let l=r.run(g,a++,u.sourceLine,u.sourceLine),p=i.run(Number(l.lastInsertRowid),u.symbolId);s+=Number(p.changes)}return s}function*Xe(e){let t=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,n=new Set(["script","setup","template","style","lang","scoped","true","false","null","undefined","const","let","var","import","from","export","return","if","else","for","while","function","class","type","interface","as","await","async"]),r;for(;r=t.exec(e);){let i=r[0];n.has(i)||(yield{text:i,start:r.index,end:r.index+i.length})}}function Ye(e,t){for(let[n]of e.toGeneratedLocation(t,r=>!!r.navigation))return n;return null}function ee(e,t){let n=e;for(let[r]of n.toSourceLocation(t,i=>!!i.navigation))return r;return null}function Pr(e,t){let n=0,r=e.lineStarts.length-1;for(;n<=r;){let o=Math.floor((n+r)/2);e.lineStarts[o]<=t?n=o+1:r=o-1}let i=Math.max(0,r);return{line:i,character:t-e.lineStarts[i]}}function Qe(e,t){return b(e,t).startsWith("node_modules/")}function b(e,t){return lr(e,t).replaceAll("\\","/")}function vr(e){switch(cr(e)){case".vue":return"vue";case".tsx":return"typescriptreact";case".ts":case".mts":case".cts":return"typescript";case".jsx":return"javascriptreact";case".js":case".mjs":case".cjs":return"javascript";case".json":return"json";default:return"typescript"}}function Ze(){let e=new Map;return{get(t){if(e.has(t))return e.get(t)??null;try{let n=Z(t,"utf-8"),r={text:n,lineStarts:kr(n)};return e.set(t,r),r}catch{return e.set(t,null),null}},positionAt:Pr}}function kr(e){let t=[0];for(let n=0;n<e.length;n++)e.charCodeAt(n)===10&&t.push(n+1);return t}function Ir(e,t){let n=new Map,r=500;for(let i=0;i<t.length;i+=r){let o=t.slice(i,i+r),s=e.prepare(`SELECT id, relative_path AS relativePath FROM documents WHERE relative_path IN (${o.map(()=>"?").join(",")})`).all(...o);for(let a of s)n.set(a.relativePath,a.id)}return n}function jr(e){try{let t=JSON.parse(Z(Be(e,"package.json"),"utf-8"));return{name:t.name??"workspace",version:t.version??"0.0.0"}}catch{return{name:"workspace",version:"0.0.0"}}}function wr(e,t,n,r){let i=b(n,r),o=et(t.name,t.version,i);return e.get(o)?.id??null}function et(e,t,n){let r=n.split("/").map(i=>`\`${i.replaceAll("`","")}\``).join("/");return`scip-vue npm ${e} ${t} ${r}/default.`}function tt(e){return{id:"vue-resolved-references",facts:["synthetic-symbol","source-mapped-occurrence","definition-mention","replacement-chunk","fingerprint-cache"],run:t=>Dr({projectRoot:t.projectRoot,dbPath:t.dbPath,tsconfig:e.tsconfig,onStatus:t.onStatus})}}function Mr(e){return y(x(),{projectRoot:e.projectRoot,dbPath:e.dbPath}),y(tt({tsconfig:e.tsconfig}),{projectRoot:e.projectRoot,dbPath:e.dbPath,onStatus:e.onStatus}).result}function Dr(e){let t=Tr(e.projectRoot,e.tsconfig);if(!Lr(t))throw new Error(`Vue tsconfig not found at ${t}`);let n=new Cr(e.dbPath);try{let r=We(n,e.projectRoot),i=Fr(Or(e.dbPath),"augment-vue-meta.json");return Pe({cachePath:i,readFingerprint:()=>Ar(n,e.projectRoot,e.tsconfig),compute:()=>Er({db:n,projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,configPath:t,vueFiles:r,onStatus:e.onStatus}),onCacheHit:o=>e.onStatus?.(`Vue references unchanged; reused ${o.resolvedReferences} cached resolved references.`)})}finally{n.close()}}function Er(e){let t=qe(e.db,e.projectRoot,e.vueFiles),n=Vr(e,t),r=ze(n.occurrences),i=Ge(e.db,e.projectRoot,e.vueFiles,t,r),o={vueFiles:e.vueFiles.length,resolvedReferences:r.length,insertedMentions:i,skippedReferences:n.skippedReferences,syntheticSymbols:t.syntheticSymbols};return e.onStatus?.(`Resolved ${o.resolvedReferences} Vue references with Volar; inserted ${o.insertedMentions} mentions.`),o}function Vr(e,t){if(Ve(e.vueFiles))return Ae({projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,vueFiles:e.vueFiles});let n=Nr({db:e.db,projectRoot:e.projectRoot,configPath:e.configPath,vueSymbolLookup:t});return $r({...n,vueFiles:n.context.fileNames.filter(r=>r.endsWith(".vue"))})}function Ar(e,t,n){let r=e.prepare(`
|
|
52
52
|
SELECT
|
|
53
53
|
(SELECT COUNT(*) FROM documents) AS documents,
|
|
54
54
|
(SELECT COUNT(*) FROM global_symbols) AS symbols,
|
|
@@ -57,13 +57,13 @@ import{a as x,b as F,f as E}from"./chunk-ONPCQ2PM.js";import{a as se}from"./chun
|
|
|
57
57
|
(SELECT COUNT(*) FROM defn_enclosing_ranges) AS ranges,
|
|
58
58
|
(SELECT MAX(id) FROM chunks) AS maxChunkId,
|
|
59
59
|
(SELECT MAX(id) FROM global_symbols) AS maxSymbolId
|
|
60
|
-
`).get();return{version:2,tsconfig:n,files:
|
|
61
|
-
Install from: https://github.com/sourcegraph/scip/releases`);if(t("scip CLI not found on PATH. Attempting auto-install..."),!
|
|
62
|
-
Install manually from: https://github.com/sourcegraph/scip/releases`)}}function
|
|
60
|
+
`).get();return{version:2,tsconfig:n,files:P(t),db:r}}function Nr(e){let t=Ze();return{projectRoot:e.projectRoot,context:Ue(e.projectRoot,e.configPath),symbolLookup:Je(e.db,e.projectRoot,t),vueSymbolLookup:e.vueSymbolLookup,sourceReader:t}}function $r(e){let t=[],n=0,r=e.tasks??e.vueFiles.map(i=>({fileName:i,startOffset:0,endOffset:Number.POSITIVE_INFINITY,countFileSkip:!0}));for(let i of r){let o=_r(e,i);t.push(...o.occurrences),n+=o.skippedReferences}return{occurrences:t,skippedReferences:n}}function _r(e,t){let n=e.context.language.scripts.get(t.fileName),r=n?.generated?.languagePlugin.typescript?.getServiceScript(n.generated.root)?.code;if(!n||!r)return{occurrences:[],skippedReferences:t.countFileSkip?1:0};let i=e.sourceReader.get(t.fileName);if(!i)return{occurrences:[],skippedReferences:t.countFileSkip?1:0};let o=e.context.language.maps.get(r,n),s=b(e.projectRoot,t.fileName),a=[...Xe(i.text)],u={tokens:a.filter(c=>c.start>=t.startOffset&&c.start<t.endOffset),tokenByStart:new Map(a.map(c=>[c.start,c])),tokenTextCounts:Ur(a),processedStarts:new Set};return Br({...e,fileName:t.fileName,sourceInfo:i,sourceFile:s,map:o,tokenContext:u})}function Br(e){let t=[],n=0;for(let r of e.tokenContext.tokens){if(e.tokenContext.processedStarts.has(r.start))continue;let i=Ye(e.map,r.start);if(i===null)continue;let s=(e.context.languageService.getDefinitionAtPosition(e.fileName,i+1)??[]).find(u=>!Qe(e.projectRoot,u.fileName));if(!s){n++;continue}let a=He(s,e.symbolLookup,e.vueSymbolLookup,e.context,e.projectRoot);if(a===null){n++;continue}nt(t,e.sourceReader,e.sourceInfo,e.sourceFile,r,a),e.tokenContext.processedStarts.add(r.start),Wr(t,e,r,i,a)}return{occurrences:t,skippedReferences:n}}function Wr(e,t,n,r,i){if(!((t.tokenContext.tokenTextCounts.get(n.text)??0)<=1))for(let o of Jr(t.context.languageService,t.fileName,r+1,t.map,n,t.tokenContext.tokenByStart)){if(t.tokenContext.processedStarts.has(o))continue;let s=t.tokenContext.tokenByStart.get(o);s&&(nt(e,t.sourceReader,t.sourceInfo,t.sourceFile,s,i),t.tokenContext.processedStarts.add(o))}}function nt(e,t,n,r,i,o){let s=t.positionAt(n,i.start);e.push({sourceFile:r,sourceLine:s.line,sourceStartChar:s.character,sourceEndChar:s.character+i.text.length,symbolId:o})}function Ur(e){let t=new Map;for(let n of e)t.set(n.text,(t.get(n.text)??0)+1);return t}function Jr(e,t,n,r,i,o){let s=e.getDocumentHighlights?.(t,n,[t])??[],a=[];for(let u of s)if(u.fileName===t)for(let c of u.highlightSpans){let g=qr(r,c.textSpan.start,o,i.text);g!==null&&a.push(g)}return a}function qr(e,t,n,r){let i=n.get(t);if(i?.text===r)return i.start;let o=ee(e,t);if(o===null)return null;let s=n.get(o);return s?.text===r?s.start:null}async function Yo(e){let{projectRoot:t,maxHeapMb:n=8192,onStatus:r=console.log,skipAutoInstall:i=!1}=e,o=Zr(e),s=Date.now();re(f(o.outputScip),{recursive:!0}),re(f(o.outputDb),{recursive:!0});let a=e.languages??A(t);if(a.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: ${a.join(", ")}`);let u=Pi(t,a,{pnpmWorkspaces:e.pnpmWorkspaces,typescriptProjectMode:e.typescriptProjectMode,typescriptProjects:e.typescriptProjects,clojureConfigPath:e.clojureConfigPath}),c=await fi(m(f(o.outputDb),"index.lock"),{projectRoot:t,trigger:e.trigger,onStatus:r}),g=null;try{let l=ei({opts:e,paths:o,languages:a,fingerprint:u,start:s,onStatus:r});if(l)return l;await ai(i,r);let p=ti(o);return g=p.runDir,await ni({opts:e,languages:a,projectRoot:t,paths:o,tempPaths:p,fingerprint:u,start:s,maxHeapMb:n,skipAutoInstall:i,onStatus:r})}catch(l){throw dt(o.metaPath,oe({trigger:e.trigger,result:"failed",start:s,error:l instanceof Error?l.message:String(l)})),l}finally{g&&I(g,{recursive:!0,force:!0}),c()}}function Zr(e){let t=e.outputScip??m(e.projectRoot,"index.scip"),n=e.outputDb??m(e.projectRoot,"index.db");return{outputScip:t,outputDb:n,metaPath:m(f(n),"meta.json")}}function ei(e){if(e.opts.skipIfUnchanged===!1||!M(e.paths.outputScip)||!M(e.paths.outputDb)||!vi(e.paths.metaPath,e.fingerprint))return null;y(x(),{projectRoot:e.opts.projectRoot,dbPath:e.paths.outputDb,onStatus:e.onStatus});let t=Date.now()-e.start,n=oe({trigger:e.opts.trigger,result:"reused",start:e.start,languages:e.languages,skipped:[]});return dt(e.paths.metaPath,n),e.onStatus(`Index unchanged; reused existing SQLite index in ${(t/1e3).toFixed(1)}s`),{languages:e.languages,indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:t,reused:!0,skipped:[],lastRefresh:n}}function ti(e){let t=Kr(m(f(e.outputDb),"reindex-"));return{runDir:t,tempOutputScip:m(t,T(e.outputScip)),tempOutputDb:m(t,T(e.outputDb)),tempMetaPath:m(t,T(e.metaPath))}}async function ni(e){let t={...process.env,NODE_OPTIONS:`--max-old-space-size=${e.maxHeapMb}`},{indexedOutputs:n,skippedLanguages:r,reusedLanguages:i}=await ri(e,t);i.length>0&&e.onStatus(`Reused ${i.length} cached language shard(s): ${i.join(", ")}`);let o=ii(e,t,n,r),s=o.durationMs;return e.onStatus(`Done in ${(s/1e3).toFixed(1)}s`),{languages:n.map(a=>a.language),indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:s,reused:!1,skipped:r,lastRefresh:o}}async function ri(e,t){let n=oi(e),r=new Set(n.map(c=>c.language));for(let c of r)e.onStatus(`Reusing cached ${c} SCIP shard (language inputs unchanged).`);let{preparedRuns:i,skippedLanguages:o}=ui({languages:e.languages.filter(c=>!r.has(c)),tempOutputScip:e.tempPaths.tempOutputScip,projectRoot:e.projectRoot,env:t,skipAutoInstall:e.skipAutoInstall,pnpmWorkspaces:e.opts.pnpmWorkspaces,typescriptProjectMode:e.opts.typescriptProjectMode,typescriptProjects:e.opts.typescriptProjects,clojureConfigPath:e.opts.clojureConfigPath,onStatus:e.onStatus}),s=await Te(i,e.projectRoot,e.onStatus,e.opts.indexerConcurrency),{indexedOutputs:a}=li(s,o),u=[...n,...a];return gi(u,o,e.languages,e.opts.allowPartial,e.onStatus),{indexedOutputs:u,skippedLanguages:o,reusedLanguages:[...r]}}function ii(e,t,n,r){si(e.paths.outputDb,n),pi(n,e.tempPaths.tempOutputScip,e.onStatus),di(e.tempPaths.tempOutputScip,e.tempPaths.tempOutputDb,t,e.onStatus),y(x(),{projectRoot:e.projectRoot,dbPath:e.tempPaths.tempOutputDb,onStatus:e.onStatus});let i=oe({trigger:e.opts.trigger,result:"rebuilt",start:e.start,languages:n.map(o=>o.language),skipped:[...r]});return pt(e.tempPaths.tempMetaPath,{version:3,status:r.length===0?"complete":"partial",updatedAt:new Date().toISOString(),fingerprint:e.fingerprint,languageFingerprints:ut(e.projectRoot,e.languages,{pnpmWorkspaces:e.opts.pnpmWorkspaces,typescriptProjectMode:e.opts.typescriptProjectMode,typescriptProjects:e.opts.typescriptProjects,clojureConfigPath:e.opts.clojureConfigPath}),requestedLanguages:e.languages,indexedLanguages:n.map(o=>o.language),skipped:[...r],lastRefresh:i}),Ri({tempOutputScip:e.tempPaths.tempOutputScip,tempOutputDb:e.tempPaths.tempOutputDb,tempMetaPath:e.tempPaths.tempMetaPath,outputScip:e.paths.outputScip,outputDb:e.paths.outputDb,metaPath:e.paths.metaPath}),i}function oi(e){let t;try{t=JSON.parse(D(e.paths.metaPath,"utf-8"))}catch{return[]}if(t.version!==3||!t.languageFingerprints)return[];let n=[],r=ut(e.projectRoot,e.languages,{pnpmWorkspaces:e.opts.pnpmWorkspaces,typescriptProjectMode:e.opts.typescriptProjectMode,typescriptProjects:e.opts.typescriptProjects,clojureConfigPath:e.opts.clojureConfigPath});for(let i of e.languages){let o=gt(e.paths.outputDb,i);M(o)&&S(t.languageFingerprints[i])===S(r[i])&&n.push({language:i,scipPath:o})}return n}function si(e,t){for(let n of t){let r=gt(e,n.language);re(f(r),{recursive:!0}),n.scipPath!==r&&zr(n.scipPath,r)}}async function ai(e,t){if(!E()){if(e)throw new Error(`The scip CLI is required but not found on PATH.
|
|
61
|
+
Install from: https://github.com/sourcegraph/scip/releases`);if(Qr()==="win32")throw new Error("The scip CLI was not found. On Windows it ships via the npm sidecar package scip-query-scip-windows (installed automatically with scip-query). Reinstall with optional dependencies enabled, run 'npm install -g scip-query-scip-windows', or set SCIP_QUERY_SCIP_BIN to a local scip.exe path.");if(t("scip CLI not found on PATH. Attempting auto-install..."),!V(t))throw new Error(`The scip CLI is required but could not be installed.
|
|
62
|
+
Install manually from: https://github.com/sourcegraph/scip/releases`)}}function ui(e){let t=[],n=[],r=e.languages.map((i,o)=>({language:i,scipPath:e.languages.length>1?at(e.tempOutputScip,i,o):e.tempOutputScip}));for(let{language:i,scipPath:o}of r){let s=ci({...e,language:i,scipPath:o});for(let a of s)"skipped"in a?st(n,a.skipped):t.push(a.prepared)}return{preparedRuns:t,skippedLanguages:n}}function ci(e){if(e.language!=="typescript"||e.typescriptProjectMode!=="workspace")return[te({...e,id:e.language,label:e.language,outputScipPath:e.scipPath})];let t=Ce(e.projectRoot,e.typescriptProjects);return t.length===0?[te({...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)=>te({...e,id:`typescript:${n}`,label:`typescript (${n})`,scipPath:at(e.tempOutputScip,"typescript-project",r),outputScipPath:e.scipPath,pnpmWorkspaces:!1,projectPath:n})))}function te(e){let t=w(e.language),n=F(t),r=z(t,e.projectRoot);if(!r&&!H(t)){if(e.skipAutoInstall){let a=`${n} not found on PATH (auto-install disabled). ${t.installUrl??""}`.trim();return e.onStatus(`Skipping ${e.language}: ${a}`),{skipped:{language:e.language,reason:a}}}if(e.onStatus(`${n} not found. Attempting auto-install...`),!X(t,e.onStatus)){let a=`${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}: ${a}`),{skipped:{language:e.language,reason:a}}}}let i=r??v(t);if(!i){let a=`${n} was not found after installation checks.`;return e.onStatus(`Skipping ${e.language}: ${a}`),{skipped:{language:e.language,reason:a}}}let{binary:o,args:s}=t.indexArgs({projectRoot:e.projectRoot,outputPath:e.scipPath,pnpmWorkspaces:e.pnpmWorkspaces,indexerBinary:i,projectPath:e.projectPath,configPath:e.language==="clojure"?e.clojureConfigPath:void 0});return{prepared:{id:e.id,language:e.language,label:e.label,scipPath:e.scipPath,outputScipPath:e.outputScipPath,config:t,resolvedBinary:i,binary:o,args:s,env:K(t,e.env,i)}}}function li(e,t){let n=new Map;for(let i of e)if(i.skipped)st(t,i.skipped);else{let o=`${i.language}\0${i.outputScipPath}`,s=n.get(o)??{language:i.language,outputScipPath:i.outputScipPath,scipPaths:[]};s.scipPaths.push(i.scipPath),n.set(o,s)}let r=[];for(let i of n.values())if(i.scipPaths.length>1)C(i.scipPaths,i.outputScipPath),r.push({language:i.language,scipPath:i.outputScipPath});else{let o=i.scipPaths[0];o!==i.outputScipPath&&k(o,i.outputScipPath),r.push({language:i.language,scipPath:i.outputScipPath})}return{indexedOutputs:r}}function st(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 gi(e,t,n,r,i){if(e.length===0){let o=t.map(s=>` - ${s.language}: ${s.reason}`).join(`
|
|
63
63
|
`);throw new Error(`No language indexers ran successfully. Install at least one indexer for the languages in this project.
|
|
64
64
|
`+o)}if(t.length!==0&&(i(`Indexed ${e.length} language output(s); skipped or incomplete: ${t.map(o=>o.language).join(", ")}.`),!r))throw new Error(`Failed to index all required languages; preserving the previous index. Pass --allow-partial to intentionally write an incomplete index.
|
|
65
65
|
`+t.map(o=>` - ${o.language}: ${o.reason}`).join(`
|
|
66
|
-
`))}function
|
|
67
|
-
`),()=>{try{
|
|
68
|
-
`),k(n,e)}function
|
|
66
|
+
`))}function pi(e,t,n){e.length>1?(n(`Merging ${e.length} language indexes...`),C(e.map(r=>r.scipPath),t)):e[0].scipPath!==t&&k(e[0].scipPath,t)}function di(e,t,n,r){if(r("Converting to SQLite..."),!M(e))throw new Error(`SCIP index not found at ${e} after indexing`);try{let i=we(e);i.removedDefinitionOccurrences>0&&r(`Sanitized ${i.removedDefinitionOccurrences} invalid definition occurrences across ${i.touchedDocuments} documents before SQLite conversion.`);let o=E();if(!o)throw new Error("scip CLI is not available");Gr(o,["expt-convert","--output",t,e],{env:n,stdio:"pipe",maxBuffer:50*1024*1024})}catch(i){let o=i instanceof Error?i.message:String(i);throw new Error(`Failed to convert SCIP index to SQLite: ${o}`,{cause:i})}}function at(e,t,n){let r=Yr(e)||".scip",i=T(e,r);return m(f(e),`${i}.${n+1}.${t}${r}`)}async function fi(e,t){for(let n=0;n<2;n++){let r=mi(e,t);if(r)return r;let i=hi(e);if(i&&yi(t.trigger,i)){if(t.onStatus(`Manual reindex preempting watcher refresh started at ${i.startedAt}.`),!await xi(i.pid))throw new Error(`Could not confirm the watcher's in-progress reindex (pid ${i.pid}) terminated for ${f(e)}; refusing to steal an active lock.`);I(e,{force:!0});continue}if(i&&!ie(i.pid)){I(e,{force:!0});continue}throw new Error(`Another scip-query reindex is already running for ${f(e)}.`)}throw new Error(`Could not acquire scip-query reindex lock for ${f(e)}.`)}function mi(e,t){let n;try{n=Xr(e,"wx")}catch(i){if((typeof i=="object"&&i&&"code"in i?i.code:void 0)==="EEXIST")return null;throw i}let r={version:1,pid:process.pid,projectRoot:t.projectRoot,startedAt:new Date().toISOString(),trigger:t.trigger};return ot(n,JSON.stringify(r)+`
|
|
67
|
+
`),()=>{try{Hr(n)}finally{I(e,{force:!0})}}}function hi(e){try{let t=JSON.parse(D(e,"utf-8"));return typeof t.pid!="number"||!Number.isInteger(t.pid)||t.pid<=0?null:{version:1,pid:t.pid,projectRoot:typeof t.projectRoot=="string"?t.projectRoot:f(e),startedAt:typeof t.startedAt=="string"?t.startedAt:"unknown",trigger:t.trigger}}catch{return null}}function yi(e,t){return e?.kind==="manual-cli"&&bi(t?.trigger)}function bi(e){return e?.kind==="watch-source"||e?.kind==="watch-git-head"||e?.kind==="watch-git-index"||e?.kind==="watch-git-state"}async function xi(e){return rt(e,"SIGTERM"),await it(e,2e3)?!0:(rt(e,"SIGKILL"),it(e,1e3))}function rt(e,t){try{process.kill(-e,t)}catch{try{process.kill(e,t)}catch{}}}async function it(e,t){let n=Date.now()+t;for(;Date.now()<n;){if(!ie(e))return!0;await Si(50)}return!ie(e)}function ie(e){try{return process.kill(e,0),!0}catch{return!1}}function Si(e){return new Promise(t=>setTimeout(t,e))}function Ri(e){ne(e.tempOutputScip,e.outputScip),ne(e.tempOutputDb,e.outputDb),ne(e.tempMetaPath,e.metaPath)}function ne(e,t){I(`${t}.tmp-replace`,{force:!0}),k(e,`${t}.tmp-replace`),k(`${t}.tmp-replace`,t)}function Pi(e,t,n){return{version:2,languages:[...t].sort(),pnpmWorkspaces:lt(n),typescriptProjectMode:n.typescriptProjectMode??"single",typescriptProjects:_(n.typescriptProjects),clojureConfigPath:ct(n.clojureConfigPath),files:P(e)}}function ut(e,t,n){return Object.fromEntries(t.map(r=>{let i=w(r).markerFiles,o=r==="typescript"?{typescriptProjectMode:n.typescriptProjectMode??"single",typescriptProjects:_(n.typescriptProjects)}:{typescriptProjectMode:"single",typescriptProjects:[]},s=r==="clojure"?ct(n.clojureConfigPath):void 0;return[r,{version:2,languages:[r],pnpmWorkspaces:r==="typescript"&<(n),...o,clojureConfigPath:s,files:P(e,{language:r,markerFiles:i})}]}))}function ct(e){return e?.trim()||void 0}function lt(e){return e.typescriptProjectMode!=="workspace"&&e.pnpmWorkspaces===!0}function gt(e,t){return m(f(e),"language-indexes",`${t}.scip`)}function vi(e,t){try{let n=JSON.parse(D(e,"utf-8"));return(n.version===2||n.version===3)&&n.status==="complete"&&S(n.fingerprint)===S(t)&&S([...n.indexedLanguages??[]].sort())===S(t.languages)}catch{return!1}}function pt(e,t){let n=`${e}.tmp-${process.pid}-${Date.now()}`;ot(n,`${JSON.stringify(t,null,2)}
|
|
68
|
+
`),k(n,e)}function dt(e,t){try{let n=JSON.parse(D(e,"utf-8"));if(n.version!==2&&n.version!==3)return;pt(e,{...n,lastRefresh:t})}catch{}}function oe(e){return{trigger:e.trigger??{kind:"unknown"},result:e.result,startedAt:new Date(e.start).toISOString(),completedAt:new Date().toISOString(),durationMs:Date.now()-e.start,indexedLanguages:e.languages?[...e.languages]:void 0,skipped:e.skipped?[...e.skipped]:void 0,error:e.error}}function S(e){return JSON.stringify(e)}export{be as INDEXER_CONFIGS,ge as augmentAuxiliaryDocuments,Mr as augmentVueResolvedReferences,x as auxiliaryDocumentsAugmentationStage,F as describeIndexerBinary,A as detectLanguages,w as getIndexerConfig,K as getIndexerExecutionEnv,R as isBinaryAvailable,H as isIndexerInstalled,C as mergeScipFiles,xe as mergeScipIndexes,Yo as reindex,v as resolveIndexerBinary,z as resolveProjectLocalIndexerBinary,y as runPostIndexAugmentation,X as tryInstallIndexer,V as tryInstallScipCli,tt as vueResolvedReferencesAugmentationStage};
|
|
69
69
|
//# sourceMappingURL=reindex.js.map
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as ProjectConfig, a as SupportedLanguage } from './config-types-
|
|
2
|
-
import { W as WatcherStatus } from './scip-cli-
|
|
3
|
-
export { g as getScipVersion, i as isScipInstalled, p as printScipInstallInstructions } from './scip-cli-
|
|
1
|
+
import { P as ProjectConfig, a as SupportedLanguage } from './config-types-BrHl3Bge.js';
|
|
2
|
+
import { W as WatcherStatus } from './scip-cli-C7cg4ZHR.js';
|
|
3
|
+
export { g as getScipVersion, i as isScipInstalled, p as printScipInstallInstructions } from './scip-cli-C7cg4ZHR.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Load project config from .scipquery.json in the project root.
|
|
@@ -8,9 +8,13 @@ export { g as getScipVersion, i as isScipInstalled, p as printScipInstallInstruc
|
|
|
8
8
|
*/
|
|
9
9
|
declare function loadProjectConfig(projectRoot: string): ProjectConfig;
|
|
10
10
|
/**
|
|
11
|
-
* Resolve all paths for a project's index files
|
|
11
|
+
* Resolve all storage paths for a project's index files (cache dir, SQLite
|
|
12
|
+
* db, .scip index, meta.json). Distinct from resolution/path-resolver.ts's
|
|
13
|
+
* resolveIndexedPaths, which resolves a file-pattern query against the
|
|
14
|
+
* already-indexed documents table -- a different job that happens to share
|
|
15
|
+
* "resolve" + "index" + "paths" vocabulary.
|
|
12
16
|
*/
|
|
13
|
-
declare function
|
|
17
|
+
declare function resolveIndexStoragePaths(projectRoot: string, config?: ProjectConfig): {
|
|
14
18
|
cacheDir: string;
|
|
15
19
|
dbPath: string;
|
|
16
20
|
indexPath: string;
|
|
@@ -48,6 +52,7 @@ declare class Watcher {
|
|
|
48
52
|
private pnpmWorkspaces;
|
|
49
53
|
private typescriptProjectMode?;
|
|
50
54
|
private typescriptProjects?;
|
|
55
|
+
private clojureConfigPath?;
|
|
51
56
|
private indexerConcurrency?;
|
|
52
57
|
private onStatus;
|
|
53
58
|
private onReindexComplete;
|
|
@@ -92,6 +97,7 @@ interface InstallSkillsResult {
|
|
|
92
97
|
installed: string[];
|
|
93
98
|
skipped: string[];
|
|
94
99
|
alreadyLinked: string[];
|
|
100
|
+
pruned: string[];
|
|
95
101
|
}
|
|
96
102
|
/**
|
|
97
103
|
* Install scip-query skills into Claude Code (~/.claude/skills/),
|
|
@@ -103,4 +109,4 @@ declare function installSkills(opts?: {
|
|
|
103
109
|
quiet?: boolean;
|
|
104
110
|
}): InstallSkillsResult;
|
|
105
111
|
|
|
106
|
-
export { Watcher, type WatcherOptions, initProjectConfig, installSkills, loadProjectConfig,
|
|
112
|
+
export { Watcher, type WatcherOptions, initProjectConfig, installSkills, loadProjectConfig, resolveIndexStoragePaths };
|
package/dist/runtime.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{c as
|
|
2
|
-
`),t}function
|
|
1
|
+
import{c as $,d as M,e as A}from"./chunk-WIBFXSYB.js";import{a as k}from"./chunk-YZXV3CU3.js";import{readFileSync as O,writeFileSync as D,existsSync as P,mkdirSync as N}from"fs";import{isAbsolute as de,join as u,relative as he,resolve as R}from"path";import{createHash as G}from"crypto";import{homedir as F}from"os";var f=".scipquery.json",W={enabled:!1,debounceMs:3e4,cooldownMs:6e4,gitPollMs:2e3,autoRefresh:!0,ignore:[]},U=["typescript","javascript","java","scala","kotlin","rust","python","ruby","go","cpp","c","csharp","vb","dart","php","clojure"];var me=new Set(U);function y(r){let e=u(r,f);if(!P(e))return{};try{let t=O(e,"utf-8");return JSON.parse(t)}catch(t){let i=t instanceof Error?t.message:String(t);throw t instanceof SyntaxError?new Error(`invalid ${f} at ${e}: ${i}`,{cause:t}):new Error(`unable to read ${f} at ${e}: ${i}`,{cause:t})}}function E(r){return{...W,...r.watch}}function L(r,e){let t=process.env.SCIP_QUERY_CACHE_DIR;if(t)return m(t);if(e?.dbPath)return m(R(r,e.dbPath));let s=process.env.XDG_CACHE_HOME||u(F(),".cache"),o=G("sha256").update(R(r)).digest("hex").slice(0,12),n=u(s,"scip-query","projects",o);return m(n)}function S(r,e){let t=L(r,e);return{cacheDir:t,dbPath:u(t,"index.db"),indexPath:u(t,"index.scip"),metaPath:u(t,"meta.json")}}function q(r,e){let t=u(r,f);return P(t)||D(t,JSON.stringify({languages:e,watch:{enabled:!1,debounceMs:3e4,cooldownMs:6e4,gitPollMs:2e3,autoRefresh:!0}},null,2)+`
|
|
2
|
+
`),t}function m(r){return N(r,{recursive:!0}),r}import{execFileSync as Y,fork as K}from"child_process";import{statSync as H,watch as X}from"fs";import{join as B,relative as V}from"path";import z from"ignore";var C=class{projectRoot;config;watchConfig;languages;pnpmWorkspaces;typescriptProjectMode;typescriptProjects;clojureConfigPath;indexerConcurrency;onStatus;onReindexComplete;onError;status={state:"idle"};debounceTimer=null;cooldownTimer=null;dirty=!1;changedFiles=0;pendingTrigger=null;reindexInFlight=!1;lastReindexEnd=0;fsWatchers=[];gitPollTimer=null;lastGitState=null;gitignoreFilter;extraIgnore;stopped=!1;constructor(e){this.projectRoot=e.projectRoot,this.config=e.config,this.watchConfig=E(e.config),this.languages=e.languages,this.pnpmWorkspaces=e.config.indexer?.typescript?.pnpmWorkspaces??!1,this.typescriptProjectMode=e.config.indexer?.typescript?.projectMode,this.typescriptProjects=e.config.indexer?.typescript?.projects,this.clojureConfigPath=e.config.indexer?.clojure?.configPath,this.indexerConcurrency=e.config.indexerConcurrency,this.onStatus=e.onStatus??(()=>{}),this.onReindexComplete=e.onReindexComplete??(()=>{}),this.onError=e.onError??(t=>console.error(t.message)),this.gitignoreFilter=k(e.projectRoot),this.extraIgnore=z(),this.watchConfig.ignore.length>0&&this.extraIgnore.add(this.watchConfig.ignore)}start(){this.stopped=!1,this.setStatus({state:"idle"}),this.startGitStatePolling();try{let e=X(this.projectRoot,{recursive:!0},(t,i)=>{i&&!this.stopped&&this.handleFileChange(i)});this.fsWatchers.push(e)}catch{this.onError(new Error("Failed to start file watcher. On Linux, you may need to increase inotify limits: sysctl -w fs.inotify.max_user_watches=524288"))}}stop(){this.stopped=!0;for(let e of this.fsWatchers)e.close();this.fsWatchers=[],this.clearDebounceTimer(),this.clearCooldownTimer(),this.clearGitPollTimer(),this.setStatus({state:"idle"})}handleFileChange(e){let t=V(this.projectRoot,B(this.projectRoot,e));t===".git"||t.startsWith(".git/")||this.gitignoreFilter.isIgnored(t)||this.extraIgnore.ignores(t)||e.endsWith("index.db")||e.endsWith("index.scip")||e.endsWith("index.db.tmp")||this.scheduleReindex({kind:"watch-source",detail:t})}scheduleReindex(e){if(this.pendingTrigger=J(this.pendingTrigger,e),this.changedFiles++,this.reindexInFlight){this.dirty=!0,this.setStatus({state:"indexing",startedAt:this.status.startedAt});return}if(this.status.state==="cooldown"){this.dirty=!0,this.setStatus({state:"cooldown",until:this.status.until,dirty:!0});return}this.clearDebounceTimer();let t=Date.now()+this.watchConfig.debounceMs;this.setStatus({state:"waiting",changedFiles:this.changedFiles,reindexAt:t}),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.triggerReindex()},this.watchConfig.debounceMs)}triggerReindex(){if(this.reindexInFlight||this.stopped)return;let e=Date.now()-this.lastReindexEnd;if(this.lastReindexEnd>0&&e<this.watchConfig.cooldownMs){let s=this.watchConfig.cooldownMs-e;this.dirty=!0;let o=Date.now()+s;this.setStatus({state:"cooldown",until:o,dirty:!0}),this.cooldownTimer=setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped&&(this.dirty=!1,this.triggerReindex())},s);return}this.reindexInFlight=!0,this.dirty=!1,this.changedFiles=0;let t=this.pendingTrigger??{kind:"watch-source"};this.pendingTrigger=null;let i=Date.now();this.setStatus({state:"indexing",startedAt:i}),this.runReindex(t).then(s=>{if(this.reindexInFlight=!1,this.lastReindexEnd=Date.now(),this.onReindexComplete(s),this.dirty&&!this.stopped){let o=Date.now()+this.watchConfig.cooldownMs;this.setStatus({state:"cooldown",until:o,dirty:!0}),this.cooldownTimer=setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped?(this.dirty=!1,this.triggerReindex()):this.setStatus({state:"idle"})},this.watchConfig.cooldownMs)}else this.setStatus({state:"idle"})}).catch(s=>{this.reindexInFlight=!1,this.lastReindexEnd=Date.now(),this.onError(s instanceof Error?s:new Error(String(s))),this.setStatus({state:"idle"})})}runReindex(e){return new Promise((t,i)=>{let s=Date.now(),o=y(this.projectRoot),n=Object.keys(o).length>0?o:this.config,c=S(this.projectRoot,n),a=n.indexer?.typescript,l=n.indexer?.clojure,d=K(new URL("./reindex-worker.js",import.meta.url).pathname,[],{detached:!0,env:{...process.env,SCIP_REINDEX_PROJECT_ROOT:this.projectRoot,SCIP_REINDEX_OUTPUT_SCIP:c.indexPath,SCIP_REINDEX_OUTPUT_DB:c.dbPath,SCIP_REINDEX_LANGUAGES:(n.languages??this.languages)?.join(",")??"",SCIP_REINDEX_INDEXER_CONCURRENCY:String(n.indexerConcurrency??this.indexerConcurrency??""),SCIP_REINDEX_PNPM_WORKSPACES:a?.pnpmWorkspaces??this.pnpmWorkspaces?"1":"",SCIP_REINDEX_TYPESCRIPT_CONFIG:JSON.stringify({projectMode:a?.projectMode??this.typescriptProjectMode,projects:a?.projects??this.typescriptProjects??[]}),SCIP_REINDEX_CLOJURE_CONFIG_PATH:l?.configPath??this.clojureConfigPath??"",SCIP_REINDEX_TRIGGER_KIND:e.kind,SCIP_REINDEX_TRIGGER_DETAIL:e.detail??""},stdio:"pipe"});d.on("exit",p=>{p===0?t(Date.now()-s):i(new Error(`Reindex worker exited with code ${p}`))}),d.on("error",i)})}setStatus(e){this.status=e,this.onStatus(e)}clearDebounceTimer(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null)}clearCooldownTimer(){this.cooldownTimer&&(clearTimeout(this.cooldownTimer),this.cooldownTimer=null)}startGitStatePolling(){this.lastGitState=this.readGitState(),this.lastGitState&&(this.gitPollTimer=setInterval(()=>this.pollGitState(),this.watchConfig.gitPollMs),this.gitPollTimer.unref?.())}pollGitState(){let e=this.lastGitState,t=this.readGitState();if(!e||!t||this.stopped){this.lastGitState=t;return}this.lastGitState=t;let i=e.head!==t.head,s=e.indexPath!==t.indexPath||e.indexMtimeMs!==t.indexMtimeMs||e.indexSize!==t.indexSize;i&&s?this.scheduleReindex({kind:"watch-git-state",detail:"HEAD and index changed"}):i?this.scheduleReindex({kind:"watch-git-head",detail:"HEAD changed"}):s&&this.scheduleReindex({kind:"watch-git-index",detail:t.indexPath??"index changed"})}readGitState(){let e=j(this.projectRoot,["rev-parse","--git-path","index"]);if(!e)return null;let t={head:j(this.projectRoot,["rev-parse","--verify","HEAD"]),indexPath:e};try{let i=H(e);t.indexMtimeMs=i.mtimeMs,t.indexSize=i.size}catch{t.indexMtimeMs=void 0,t.indexSize=void 0}return t}clearGitPollTimer(){this.gitPollTimer&&(clearInterval(this.gitPollTimer),this.gitPollTimer=null)}};function j(r,e){try{return Y("git",["-C",r,...e],{encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function J(r,e){return r?r.kind===e.kind?r.detail===e.detail?r:{kind:r.kind,detail:"multiple changes"}:{kind:"watch-git-state",detail:`${r.kind}, ${e.kind}`}:e}import{existsSync as v,mkdirSync as Q,symlinkSync as Z,readlinkSync as b,unlinkSync as T,readdirSync as ee}from"fs";import{join as h,dirname as w,resolve as g,relative as te,isAbsolute as re}from"path";import{homedir as x,platform as ie}from"os";import{fileURLToPath as se}from"url";var ne=ie()==="win32",_=["_shared","scip-query","scip-setup","scip-cleanup-audit","scip-cleanup-improve","scip-integrity-audit","scip-twin-drift","scip-claim-audit","scip-probe-reachability","scip-hyper-optimization","scip-api-impact","scip-concrete-plan","scip-conductor","scip-debug","scip-explore","scip-triage-issue","scip-diagram","scip-doc-reconcile","scip-directory-architecture","scip-maintainability","scip-react-maintainability","scip-vue-maintainability","scip-verify","scip-language-playbook","scip-tla-model-system"];function oe(r={}){let e=r.quiet?()=>{}:console.log,t=se(import.meta.url),i=g(w(t),"..","skills"),s=[h(x(),".claude","skills"),h(x(),".codex","skills"),h(x(),".agents","skills")],o={installed:[],skipped:[],alreadyLinked:[],pruned:[]};for(let n of s){let c=w(n);if(!v(c))continue;Q(n,{recursive:!0});let a=ce(n);ae(n,i,a,o,e);for(let l of _){let d=h(i,l),p=h(n,l);if(!v(d)){o.skipped.push(`${a}/${l}`);continue}if(v(p)){try{let I=b(p);if(g(I)===g(d)){o.alreadyLinked.push(`${a}/${l}`),e(` ok: ${l} \u2192 ${a} (already linked)`);continue}}catch{o.skipped.push(`${a}/${l}`),e(` skip: ${l} \u2192 ${a} (exists, not a symlink)`);continue}T(p)}Z(d,p,ne?"junction":"dir"),o.installed.push(`${a}/${l}`),e(` done: ${l} \u2192 ${a}`)}}return o}function ae(r,e,t,i,s){let o=new Set(_);for(let n of ee(r)){if(o.has(n))continue;let c=h(r,n),a;try{a=g(w(c),b(c))}catch{continue}le(a,e)&&(T(c),i.pruned.push(`${t}/${n}`),s(` prune: ${n} \u2192 ${t} (removed stale scip-query skill link)`))}}function le(r,e){let t=te(g(e),g(r));return t===""||!t.startsWith("..")&&!re(t)}function ce(r){return r.includes(".codex")?"Codex":r.includes(".agents")?"Agents":"Claude"}export{C as Watcher,M as getScipVersion,q as initProjectConfig,oe as installSkills,$ as isScipInstalled,y as loadProjectConfig,A as printScipInstallInstructions,S as resolveIndexStoragePaths};
|
|
3
3
|
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A symbol's location in the SCIP index. The minimum data needed to
|
|
3
|
+
* identify a definition: which document it lives in, which lines it
|
|
4
|
+
* spans, and the global symbol id. Used as a lightweight handle when
|
|
5
|
+
* the caller doesn't need the symbol's textual name or path.
|
|
6
|
+
*/
|
|
7
|
+
interface SymbolLocation {
|
|
8
|
+
documentId: number;
|
|
9
|
+
startLine: number;
|
|
10
|
+
endLine: number;
|
|
11
|
+
symbolId: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A SymbolLocation plus the human-readable bits: the SCIP symbol string
|
|
15
|
+
* and the document's relative path. Returned by lookup helpers like
|
|
16
|
+
* `findFirstSymbolMatch` so callers don't have to round-trip through the
|
|
17
|
+
* documents table to get a path or symbol name.
|
|
18
|
+
*/
|
|
19
|
+
interface SymbolMatch extends SymbolLocation {
|
|
20
|
+
symbol: string;
|
|
21
|
+
relativePath: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A full definition record: SymbolMatch plus per-symbol metadata
|
|
25
|
+
* (leaf name, parent type, kind, documentation, enclosing symbol).
|
|
26
|
+
* Used by the catalog APIs (`getDefinitionsForFile`, `getAllDefinitions`,
|
|
27
|
+
* `getScopedDefinitions`) so consumers don't have to re-derive any of
|
|
28
|
+
* these per-record.
|
|
29
|
+
*/
|
|
30
|
+
interface IndexedDefinition extends SymbolMatch {
|
|
31
|
+
leaf: string;
|
|
32
|
+
parentTypeName: string | null;
|
|
33
|
+
isFunctionLike: boolean;
|
|
34
|
+
isTypeLike: boolean;
|
|
35
|
+
kind: number | null;
|
|
36
|
+
documentation: string | null;
|
|
37
|
+
enclosingSymbol: string | null;
|
|
38
|
+
}
|
|
39
|
+
/** Parsed components of a SCIP symbol string */
|
|
40
|
+
interface ScipSymbol {
|
|
41
|
+
/** The indexer scheme (e.g. "scip-typescript", "scip-java", "rust-analyzer") */
|
|
42
|
+
scheme: string;
|
|
43
|
+
/** Package manager (e.g. "npm", "maven", "cargo") */
|
|
44
|
+
manager: string;
|
|
45
|
+
/** Package name (e.g. "@vega/api", "com.example/mylib") */
|
|
46
|
+
packageName: string;
|
|
47
|
+
/** Package version */
|
|
48
|
+
version: string;
|
|
49
|
+
/** Descriptor chain — the path to the symbol within the file */
|
|
50
|
+
descriptors: ScipDescriptor[];
|
|
51
|
+
/** The raw, unparsed symbol string */
|
|
52
|
+
raw: string;
|
|
53
|
+
}
|
|
54
|
+
interface ScipDescriptor {
|
|
55
|
+
name: string;
|
|
56
|
+
suffix: DescriptorSuffix;
|
|
57
|
+
}
|
|
58
|
+
type DescriptorSuffix = 'namespace' | 'type' | 'term' | 'method' | 'type-param' | 'parameter' | 'meta' | 'macro';
|
|
59
|
+
/** A local symbol (file-scoped, no cross-file identity) */
|
|
60
|
+
interface ScipLocalSymbol {
|
|
61
|
+
kind: 'local';
|
|
62
|
+
id: string;
|
|
63
|
+
raw: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export type { IndexedDefinition as I, SymbolMatch as S, ScipSymbol as a, ScipLocalSymbol as b };
|