scip-query 0.6.9 → 0.7.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/README.md +3 -1
- package/dist/augment-vue-worker.js +1 -1
- package/dist/chunk-23YIGCYF.js +25 -0
- package/dist/{chunk-V4WRHJU3.js → chunk-2IYEIFPP.js} +6 -6
- package/dist/chunk-2JEFS2YJ.js +2 -0
- package/dist/chunk-33SSUPCB.js +7 -0
- package/dist/chunk-3GNFUVFA.js +2 -0
- package/dist/chunk-3OUC276S.js +2 -0
- package/dist/{chunk-JLFAQ2E2.js → chunk-4STLJYHI.js} +4 -4
- package/dist/chunk-563HLCDW.js +35 -0
- package/dist/chunk-5TT47UMX.js +44 -0
- package/dist/chunk-6H2XIIPY.js +71 -0
- package/dist/{chunk-I5BB33E6.js → chunk-72JOIFXL.js} +3 -3
- package/dist/chunk-7H4RJ4MC.js +2 -0
- package/dist/chunk-7O4MJYIW.js +63 -0
- package/dist/chunk-7OX2O53H.js +62 -0
- package/dist/chunk-A2AVLALL.js +2 -0
- package/dist/chunk-AQYBOORI.js +2 -0
- package/dist/chunk-ARBZM2NF.js +34 -0
- package/dist/{chunk-GRAEZYYU.js → chunk-BI4F6GXI.js} +2 -2
- package/dist/chunk-BOVNTAKQ.js +3 -0
- package/dist/chunk-CKIO6SVS.js +2 -0
- package/dist/chunk-D6Z67MZL.js +2 -0
- package/dist/chunk-DFK54IRN.js +2 -0
- package/dist/chunk-FD37DBTD.js +2 -0
- package/dist/chunk-FOQQDXE7.js +2 -0
- package/dist/chunk-GAQGJ52J.js +11 -0
- package/dist/chunk-IODTPF5H.js +20 -0
- package/dist/chunk-J6Z5YKGQ.js +4 -0
- package/dist/chunk-JB4PUN5S.js +40 -0
- package/dist/chunk-JTXKS5GK.js +3 -0
- package/dist/chunk-KJ3ZJIE5.js +2 -0
- package/dist/chunk-KJ6CW6EK.js +2 -0
- package/dist/{chunk-AXHDRSRI.js → chunk-KNA6Z7JB.js} +3 -3
- package/dist/{chunk-U3GYMGBX.js → chunk-LDV2B7ET.js} +8 -8
- package/dist/chunk-LWYIGRHR.js +5 -0
- package/dist/chunk-MDAYGS6T.js +2 -0
- package/dist/chunk-MX6F756F.js +2 -0
- package/dist/chunk-NHDPYW7O.js +2 -0
- package/dist/{chunk-IIKNAXAE.js → chunk-NKJKI6SE.js} +2 -2
- package/dist/chunk-NN3O7TPH.js +8 -0
- package/dist/chunk-NSTZMBAB.js +18 -0
- package/dist/chunk-NYEMZHUC.js +6 -0
- package/dist/chunk-OHEIZWIA.js +4 -0
- package/dist/chunk-PG3ZI5IH.js +2 -0
- package/dist/chunk-QAEDNTY7.js +2 -0
- package/dist/chunk-QE6MGGUY.js +2 -0
- package/dist/chunk-QPRIYXH4.js +2 -0
- package/dist/chunk-QWJBIBE6.js +3 -0
- package/dist/chunk-RCJEFQOK.js +4 -0
- package/dist/chunk-ROOHENEP.js +61 -0
- package/dist/{chunk-3JGBAAP7.js → chunk-ROZNBWIF.js} +2 -2
- package/dist/chunk-TGK5DFBJ.js +2 -0
- package/dist/chunk-TKDJQ2WD.js +59 -0
- package/dist/chunk-TRNAQABL.js +7 -0
- package/dist/chunk-U75WH4XG.js +2 -0
- package/dist/chunk-V53J46BX.js +2 -0
- package/dist/chunk-V76FCF5F.js +2 -0
- package/dist/chunk-VUBQBW7H.js +16 -0
- package/dist/chunk-WJQY2LGT.js +2 -0
- package/dist/{chunk-ZO5IFJRM.js → chunk-WODJHE6Z.js} +3 -3
- package/dist/{chunk-IX45SWX5.js → chunk-WPLKHAH7.js} +4 -4
- package/dist/chunk-XO6R3X5J.js +2 -0
- package/dist/chunk-YSZNAG4G.js +2 -0
- package/dist/chunk-ZNUPGRPR.js +3 -0
- package/dist/{chunk-UIM4WALN.js → chunk-ZXFTC5ET.js} +4 -4
- package/dist/cli.js +362 -527
- package/dist/config-types-CGIeLEpY.d.ts +108 -0
- package/dist/db-DdTPetj5.d.ts +69 -0
- package/dist/health-x7B4Xu_6.d.ts +119 -0
- package/dist/index.d.ts +100 -334
- package/dist/index.js +3 -131
- package/dist/postinstall.js +1 -1
- package/dist/queries/affected.d.ts +9 -2
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.d.ts +12 -2
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +12 -2
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +19 -2
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +16 -2
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/code.d.ts +12 -2
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +15 -2
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +19 -2
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.d.ts +22 -2
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +8 -2
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +16 -2
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +32 -2
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +34 -2
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deep-chains.d.ts +8 -2
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/deps.d.ts +6 -2
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.d.ts +22 -2
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/drift.d.ts +18 -2
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.d.ts +19 -2
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +7 -2
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +6 -2
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +4 -81
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +8 -2
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +10 -2
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +13 -2
- package/dist/queries/imports.js +1 -1
- package/dist/queries/index.d.ts +45 -44
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +11 -2
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/members.d.ts +10 -2
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +8 -2
- package/dist/queries/methods.js +1 -1
- package/dist/queries/outline.d.ts +10 -2
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +14 -2
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +13 -2
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +7 -2
- package/dist/queries/refs.js +1 -1
- package/dist/queries/similar-chains.d.ts +21 -2
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +12 -2
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +16 -2
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +21 -2
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +16 -2
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +36 -3
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +11 -2
- package/dist/queries/stats.js +1 -1
- package/dist/queries/surface.d.ts +8 -2
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +10 -2
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +10 -2
- package/dist/queries/system.js +1 -1
- package/dist/queries/trace.d.ts +18 -2
- package/dist/queries/trace.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +14 -2
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +10 -10
- package/dist/reindex.d.ts +153 -0
- package/dist/reindex.js +69 -0
- package/dist/runtime.d.ts +108 -0
- package/dist/runtime.js +3 -0
- package/dist/scip-cli-a-xOztiK.d.ts +20 -0
- package/package.json +184 -4
- package/dist/chunk-2OP63JQQ.js +0 -2
- package/dist/chunk-33Z6HQBX.js +0 -5
- package/dist/chunk-3F453KPT.js +0 -2
- package/dist/chunk-3PKPUCIJ.js +0 -11
- package/dist/chunk-42BWO2NN.js +0 -2
- package/dist/chunk-4MDCFY3E.js +0 -2
- package/dist/chunk-4QWTQ6YV.js +0 -2
- package/dist/chunk-5IRX5I64.js +0 -5
- package/dist/chunk-5MPZ2A7J.js +0 -2
- package/dist/chunk-67OMD56K.js +0 -90
- package/dist/chunk-6UVVA5I4.js +0 -7
- package/dist/chunk-BAA4EJRX.js +0 -2
- package/dist/chunk-BT36WY5B.js +0 -114
- package/dist/chunk-CLKFDBS6.js +0 -39
- package/dist/chunk-CWMWTHV3.js +0 -2
- package/dist/chunk-DXO2ECRF.js +0 -7
- package/dist/chunk-EHEZLULQ.js +0 -85
- package/dist/chunk-FVH3Y44U.js +0 -1
- package/dist/chunk-GWBRU65E.js +0 -2
- package/dist/chunk-H4DXD2FB.js +0 -5
- package/dist/chunk-I2KUHGMX.js +0 -16
- package/dist/chunk-JMASYYSW.js +0 -2
- package/dist/chunk-KAM4C6ZD.js +0 -4
- package/dist/chunk-LBWLO7NA.js +0 -70
- package/dist/chunk-LJ2YWNQF.js +0 -2
- package/dist/chunk-LLDPR3DG.js +0 -6
- package/dist/chunk-LNUZWWWL.js +0 -2
- package/dist/chunk-NLJCXHFU.js +0 -84
- package/dist/chunk-NRAJIFQA.js +0 -2
- package/dist/chunk-OYRGWW6Z.js +0 -2
- package/dist/chunk-PVMRIOM6.js +0 -33
- package/dist/chunk-QRYEOK3M.js +0 -2
- package/dist/chunk-SF2HYG53.js +0 -4
- package/dist/chunk-SHGPRVWH.js +0 -2
- package/dist/chunk-SMOUOKAO.js +0 -2
- package/dist/chunk-TBJDUS4E.js +0 -71
- package/dist/chunk-TPXWXKL6.js +0 -2
- package/dist/chunk-TTCUMJ43.js +0 -19
- package/dist/chunk-TYR7QY5G.js +0 -2
- package/dist/chunk-UZG3QXTG.js +0 -2
- package/dist/chunk-VDMRAGBK.js +0 -6
- package/dist/chunk-W6SRVK2Y.js +0 -5
- package/dist/chunk-WGYJDGBI.js +0 -25
- package/dist/chunk-WYX3RU2K.js +0 -2
- package/dist/chunk-WZYA234B.js +0 -2
- package/dist/chunk-Y6ZFXZ7B.js +0 -2
- package/dist/chunk-YCN5XEST.js +0 -7
- package/dist/db-Rx8Ho_JF.d.ts +0 -838
- package/dist/queries/drift-policy.d.ts +0 -6
- package/dist/queries/drift-policy.js +0 -2
- package/dist/queries/health-cache-control.d.ts +0 -15
- package/dist/queries/health-cache-control.js +0 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{a}from"./chunk-TKDJQ2WD.js";import{b as s}from"./chunk-QAEDNTY7.js";import"./chunk-NKJKI6SE.js";import"./chunk-IODTPF5H.js";import"./chunk-ARBZM2NF.js";import"./chunk-JB4PUN5S.js";import"./chunk-7O4MJYIW.js";import"./chunk-ZNUPGRPR.js";import"./chunk-RCJEFQOK.js";import"./chunk-BOVNTAKQ.js";import"./chunk-KJ6CW6EK.js";import{a as i,c as n,d as l}from"./chunk-7OX2O53H.js";import"./chunk-5TT47UMX.js";import"./chunk-NHDPYW7O.js";import"./chunk-NN3O7TPH.js";import c from"better-sqlite3";var d=["node_modules",".git","dist","build","out","coverage","target",".next",".nuxt",".cache",".turbo",".scipquery-cache","__pycache__",".venv","venv"],o=class{db;config;pathFilter;constructor(t,e){this.config=t,this.pathFilter=e??null,this.db=new c(t.dbPath,{readonly:!0}),this.db.pragma("busy_timeout = 5000")}isIgnored(t){return this.pathFilter?.isIgnored(t)??!1}get localSymbolPredicate(){return`(
|
|
2
2
|
EXISTS (
|
|
3
3
|
SELECT 1
|
|
4
4
|
FROM defn_enclosing_ranges local_der
|
|
@@ -15,134 +15,6 @@ import"./chunk-FVH3Y44U.js";import{a as Vi}from"./chunk-ZO5IFJRM.js";import{a as
|
|
|
15
15
|
AND local_m.role = 1
|
|
16
16
|
${this.pathExclusionsFor("local_d").trimStart()}
|
|
17
17
|
)
|
|
18
|
-
)`}get pathExclusions(){return this.pathExclusionsFor("d")}get symbolNoise(){return this.symbolNoiseFor("gs")}pathExclusionsFor(...t){return t.flatMap(
|
|
19
|
-
`)}symbolNoiseFor(t){return`AND ${t}.symbol NOT LIKE '%().(%' AND ${t}.symbol NOT LIKE '%typeLiteral%'`}all(t,...
|
|
20
|
-
# Dependencies
|
|
21
|
-
node_modules/
|
|
22
|
-
vendor/
|
|
23
|
-
.bundle/
|
|
24
|
-
|
|
25
|
-
# Build output
|
|
26
|
-
dist/
|
|
27
|
-
build/
|
|
28
|
-
out/
|
|
29
|
-
target/
|
|
30
|
-
bin/
|
|
31
|
-
obj/
|
|
32
|
-
|
|
33
|
-
# Python
|
|
34
|
-
__pycache__/
|
|
35
|
-
*.pyc
|
|
36
|
-
*.pyo
|
|
37
|
-
.venv/
|
|
38
|
-
venv/
|
|
39
|
-
.env/
|
|
40
|
-
env/
|
|
41
|
-
*.egg-info/
|
|
42
|
-
|
|
43
|
-
# Rust
|
|
44
|
-
target/
|
|
45
|
-
|
|
46
|
-
# Java / Kotlin / Scala
|
|
47
|
-
*.class
|
|
48
|
-
.gradle/
|
|
49
|
-
.mvn/
|
|
50
|
-
|
|
51
|
-
# C# / .NET
|
|
52
|
-
bin/
|
|
53
|
-
obj/
|
|
54
|
-
packages/
|
|
55
|
-
|
|
56
|
-
# Go
|
|
57
|
-
vendor/
|
|
58
|
-
|
|
59
|
-
# Dart
|
|
60
|
-
.dart_tool/
|
|
61
|
-
build/
|
|
62
|
-
|
|
63
|
-
# PHP
|
|
64
|
-
vendor/
|
|
65
|
-
|
|
66
|
-
# IDE / OS
|
|
67
|
-
.idea/
|
|
68
|
-
.vscode/
|
|
69
|
-
*.swp
|
|
70
|
-
*.swo
|
|
71
|
-
.DS_Store
|
|
72
|
-
Thumbs.db
|
|
73
|
-
|
|
74
|
-
# Type definitions (often noise in queries)
|
|
75
|
-
*.d.ts
|
|
76
|
-
`;function fe(e,t,n){let r=dt(t,n);if(!r)return!1;try{return e.ignores(r)}catch{return!1}}function dt(e,t){if(!t||t===".")return null;if(!pe(t)&&!t.startsWith(".."))return t.replaceAll("\\","/");let n=pe(t)?t:ct(e,t),r=ut(e,n).replaceAll("\\","/");return!r||r==="."||r.startsWith("..")?null:r}import{execFile as Pr,execFileSync as wr}from"child_process";import{closeSync as Cr,existsSync as y,mkdirSync as Ue,mkdtempSync as Er,openSync as Tr,readFileSync as Or,renameSync as v,rmSync as R,writeFileSync as He}from"fs";import{cpus as Dr}from"os";import{basename as W,dirname as b,extname as Lr,join as p}from"path";import{execFileSync as k}from"child_process";import{platform as T,arch as pt}from"os";var me=T()==="win32",he="v0.7.0";function E(e){let t=me?"where":"which";try{return k(t,[e],{stdio:"pipe"}),!0}catch{return!1}}function ft(){try{return k(me?"where":"which",["scip"],{stdio:"pipe"}),!0}catch{return!1}}function mt(){try{return k("scip",["--version"],{stdio:"pipe"}).toString().trim()}catch{return null}}function ht(){let e=T(),t=pt(),n,r,i;switch(e){case"darwin":n="darwin",i="tar.gz";break;case"linux":n="linux",i="tar.gz";break;case"win32":n="windows",i="zip";break;default:return null}switch(t){case"arm64":r="arm64";break;case"x64":r="amd64";break;default:return null}let s=`scip-${n}-${r}.${i}`;return{url:`https://github.com/sourcegraph/scip/releases/download/${he}/${s}`,filename:s}}function bt(){let e=ht();console.log("\nThe `scip` CLI is required but not found on PATH.\n"),T()==="darwin"?(console.log("Install via Homebrew:"),console.log(` brew install sourcegraph/scip/scip
|
|
77
|
-
`),console.log("Or download manually:")):console.log("Download from:"),console.log(e?` ${e.url}
|
|
78
|
-
`:` https://github.com/sourcegraph/scip/releases/tag/${he}
|
|
79
|
-
`),console.log("After installing, ensure `scip` is on your PATH and run `scip-query reindex`.")}function O(e){if(T()==="darwin"&&E("brew")){e("Installing scip CLI via Homebrew...");try{if(k("brew",["install","sourcegraph/scip/scip"],{stdio:"inherit",timeout:3e5,env:process.env}),E("scip"))return e("Successfully installed scip CLI via Homebrew"),!0}catch(t){let n=t instanceof Error?t.message:String(t);e(`Homebrew install failed: ${n}`)}}if(E("go")){e("Installing scip CLI via go install...");try{if(k("go",["install","github.com/sourcegraph/scip/cmd/scip@latest"],{stdio:"inherit",timeout:3e5,env:process.env}),E("scip"))return e("Successfully installed scip CLI via go install"),!0}catch(t){let n=t instanceof Error?t.message:String(t);e(`go install failed: ${n}`)}}return e("Could not auto-install scip CLI."),e("Install manually from: https://github.com/sourcegraph/scip/releases"),!1}import yt from"better-sqlite3";import{execFileSync as xt}from"child_process";import{existsSync as St,readdirSync as vt,readFileSync as Rt}from"fs";import{extname as D,join as be}from"path";function m(e){let t=new Set((e.extensions??ge).map(s=>s.toLowerCase()));if(t.size===0)return{scanned:0,inserted:0,existing:0};if(!St(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let n=I(e.projectRoot),r=It(e.projectRoot,t).filter(s=>!n.isIgnored(s)),i=new yt(e.dbPath);try{let s=Pt(i,r),o=i.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
|
|
80
|
-
VALUES (?, ?, NULL, ?)`),u=i.transaction(g=>{let l=0;for(let d of g){if(s.has(d))continue;let f=Rt(be(e.projectRoot,d),"utf-8"),Ze=o.run(wt(d),d,f);l+=Number(Ze.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 It(e,t){let n=kt(e,t);if(n)return n;let r=[],i=s=>{let o=s?be(e,s):e,a;try{a=vt(o,{withFileTypes:!0})}catch{return}for(let u of a){if(de.has(u.name))continue;let c=s?`${s}/${u.name}`:u.name;if(u.isDirectory()){i(c);continue}t.has(D(u.name).toLowerCase())&&r.push(c)}};return i(""),r.sort()}function kt(e,t){try{return xt("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"]}).split(`
|
|
81
|
-
`).filter(r=>r&&t.has(D(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 s=t.slice(i,i+r),o=e.prepare(`SELECT relative_path FROM documents WHERE relative_path IN (${s.map(()=>"?").join(",")})`).all(...s);for(let a of o)n.add(a.relative_path)}return n}function wt(e){return D(e).toLowerCase()===".vue"?"vue":D(e).replace(/^\./,"").toLowerCase()||"source"}import{execFileSync as Ct}from"child_process";import{existsSync as Et,readdirSync as xe}from"fs";import{extname as Se,join as ve}from"path";var Tt=new Set([".git",".hg",".svn",".idea",".vscode","node_modules","vendor","dist","build","target","bin","obj",".dart_tool",".gradle",".next",".venv","venv","__pycache__"]),Ot=[{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:"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 L(e){let t=[],n=Dt(e),r=jt(e);for(let i of Ot){if(Lt(e,i.files)){t.push(i.language);continue}if(Ft(n,i.globs)){t.push(i.language);continue}Mt(r,i.extensions)&&t.push(i.language)}return t.includes("typescript")&&ye(t,"javascript"),t.includes("cpp")&&!r.has(".c")&&ye(t,"c"),t}function Dt(e){try{return xe(e)}catch{return[]}}function Lt(e,t){return t?.length?t.some(n=>Et(ve(e,n))):!1}function Ft(e,t){return t?.length?e.some(n=>t.some(r=>Nt(n,r))):!1}function Nt(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 jt(e){let t=_t(e);if(t)return t;let n=new Set,r=[e];for(;r.length>0;){let i=r.pop();if(!i)continue;let s;try{s=xe(i,{withFileTypes:!0})}catch{continue}for(let o of s){if(o.name.startsWith(".")&&!o.name.endsWith("proj")&&!o.name.endsWith("sln")&&o.isDirectory())continue;let a=ve(i,o.name);if(o.isDirectory()){Tt.has(o.name)||r.push(a);continue}let u=Se(o.name).toLowerCase();u&&n.add(u)}}return n}function _t(e){try{let t=Ct("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(`
|
|
82
|
-
`)){if(!r)continue;let i=Se(r).toLowerCase();i&&n.add(i)}return n}catch{return null}}function Mt(e,t){return t?.length?t.some(n=>e.has(n)):!1}function ye(e,t){let n=e.indexOf(t);n!==-1&&e.splice(n,1)}import{existsSync as Re,readdirSync as At}from"fs";import{join as z}from"path";var X={typescript:{language:"typescript",indexerBinary:"scip-typescript",checkCommand:"npx scip-typescript --version",indexArgs:({outputPath:e,pnpmWorkspaces:t,indexerBinary:n})=>{let r=["index","--infer-tsconfig","--output",e,"--no-progress-bar"];return t&&r.splice(1,0,"--pnpm-workspaces"),{binary:n,args:r}},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"},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",Ie(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",Ie(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=z(e,"vendor","bin","scip-php"),r=z(e,"vendor","davidrjenni","scip-php","bin","scip-php");return{binary:"php",args:["-d","error_reporting=E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED",Re(r)?r:Re(n)?n:t]}},defaultOutputPath:"index.scip",markerFiles:["composer.json"],installMethods:[],installUrl:"https://github.com/davidrjenni/scip-php/releases"}};function F(e){return X[e]}function Ie(e,t){let n;try{n=At(e)}catch{return null}for(let r of n)if(t.some(i=>r.endsWith(i)))return z(e,r);return null}import{readFileSync as Vt,writeFileSync as $t}from"fs";import{create as K}from"@bufbuild/protobuf";import{deserializeSCIP as Bt,serializeSCIP as Wt,DocumentSchema as Ut,IndexSchema as Ht,SymbolInformationSchema as Gt}from"@c4312/scip";function Q(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=Jt(e.flatMap(i=>i.documents??[])),r=ke(e.flatMap(i=>i.externalSymbols??[]));return K(Ht,{metadata:t,documents:n,externalSymbols:r})}function N(e,t){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let n=e.map(i=>Bt(Vt(i))),r=Q(n);return $t(t,Buffer.from(Wt(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 Jt(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,K(Ut,{language:r.language||n.language,relativePath:r.relativePath||n.relativePath,occurrences:[...r.occurrences,...n.occurrences],symbols:ke([...r.symbols,...n.symbols]),text:Xt(r.text,n.text),positionEncoding:r.positionEncoding||n.positionEncoding}))}return[...t.values()]}function ke(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,K(Gt,{symbol:r.symbol,documentation:Kt([...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 Xt(e,t){return e?t?e.length>=t.length?e:t:e:t}function Kt(e){return[...new Set(e)]}import{execFileSync as Qt}from"child_process";import{createHash as Yt}from"crypto";import{readdirSync as Zt,readFileSync as en}from"fs";import{join as Pe}from"path";function tn(e){return(nn(e)??rn(e)).filter(t=>t&&!we(t)).sort()}function j(e){return tn(e).map(t=>{let n=Pe(e,t);try{let r=en(n);return{path:t,size:r.byteLength,hash:Yt("sha256").update(r).digest("hex")}}catch{return{path:t,size:-1,hash:"unreadable"}}})}function nn(e){try{return Qt("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:50*1024*1024,stdio:["ignore","pipe","ignore"]}).split(`
|
|
83
|
-
`).filter(Boolean)}catch{return null}}function rn(e){let t=[],n=[""];for(;n.length>0;){let r=n.pop(),i=r?Pe(e,r):e,s;try{s=Zt(i,{withFileTypes:!0})}catch{continue}for(let o of s){let a=r?`${r}/${o.name}`:o.name;if(o.isDirectory()){we(a)||n.push(a);continue}t.push(a)}}return t}function we(e){return e.split("/").some(n=>sn.has(n))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var sn=new Set([".git","node_modules",".scipquery-cache",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]);import{readFileSync as on,writeFileSync as an}from"fs";import{create as Ce}from"@bufbuild/protobuf";import{deserializeSCIP as un,DocumentSchema as cn,IndexSchema as ln,serializeSCIP as gn,SymbolRole as dn}from"@c4312/scip";function Ee(e){let t;try{t=un(on(e))}catch{return{removedDefinitionOccurrences:0,touchedDocuments:0}}let n=pn(t);return n.removedDefinitionOccurrences>0&&an(e,Buffer.from(gn(n.index))),{removedDefinitionOccurrences:n.removedDefinitionOccurrences,touchedDocuments:n.touchedDocuments}}function pn(e){let t=new Set;for(let s of e.documents)for(let o of s.symbols)o.symbol&&t.add(o.symbol);for(let s of e.externalSymbols)s.symbol&&t.add(s.symbol);let n=0,r=0,i=[];for(let s of e.documents){let o=s.occurrences.filter(a=>(a.symbolRoles&dn.Definition)===0||t.has(a.symbol)?!0:(n+=1,!1));if(o.length===s.occurrences.length){i.push(s);continue}r+=1,i.push(Ce(cn,{language:s.language,relativePath:s.relativePath,occurrences:o,symbols:s.symbols,text:s.text,positionEncoding:s.positionEncoding}))}return{index:n===0?e:Ce(ln,{metadata:e.metadata,documents:i,externalSymbols:e.externalSymbols}),removedDefinitionOccurrences:n,touchedDocuments:r}}import{execFileSync as M}from"child_process";import{existsSync as Y,readFileSync as fn}from"fs";import{createRequire as mn}from"module";import{platform as Oe}from"os";import{dirname as Te,join as _}from"path";var hn=mn(import.meta.url),bn=Oe()==="win32";function h(e){let t=bn?"where":"which";try{return M(t,[e],{stdio:"pipe"}),!0}catch{return!1}}function Z(e){return[e.indexerBinary,...e.binaryAliases??[]]}function A(e){let t=Z(e);return t.length===1?t[0]:t.join(" or ")}function P(e){for(let t of Z(e))if(h(t))return t;return xn(e)}function V(e){return P(e)!==null||yn(e)}function yn(e){return De(e)!==null}function xn(e){let t=De(e);if(!t)return null;let r=JSON.parse(fn(t,"utf8")).bin;if(!r)return null;if(typeof r=="string")return _(Te(t),r);for(let i of Z(e)){let s=r[i];if(s)return _(Te(t),s)}return null}function De(e){if(!e.bundledNpmPackage)return null;try{return hn.resolve(`${e.bundledNpmPackage}/package.json`)}catch{return null}}function ee(e,t){for(let n of e.projectLocalBinaries??[]){let r=_(t,n);if(Y(r))return r}return null}function te(e,t=process.env,n=e.indexerBinary){if(e.indexerBinary!=="scip-dotnet"||Le(n,t))return t;let r=Sn(n,t);return r?{...t,DOTNET_ROOT:r}:t}function $(e,t){let n=e.installMethods,r=A(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(h(i.prerequisite)){t(`Installing ${r} via ${i.label}...`);try{M(i.binary,i.args,{stdio:"inherit",timeout:3e5,env:process.env});let s=P(e);if(s){let o=s===e.indexerBinary?"":` (using ${s})`;return t(`Successfully installed ${r} via ${i.label}${o}`),!0}t(`${i.label} command completed but ${r} was not found on PATH`)}catch(s){let o=s instanceof Error?s.message:String(s);t(`${i.label} install failed: ${o}`)}}return t(`Could not auto-install ${r}.`),e.installUrl&&t(`Install manually from: ${e.installUrl}`),!1}function Sn(e,t){for(let n of vn(t))if(Le(e,{...t,DOTNET_ROOT:n}))return n;return null}function vn(e){let t=[],n=e.DOTNET_ROOT;if(n&&Y(n)&&t.push(n),Oe()==="darwin"&&h("brew"))try{let r=M("brew",["--prefix","dotnet@9"],{stdio:"pipe",env:e}).toString().trim(),i=_(r,"libexec");Y(i)&&!t.includes(i)&&t.push(i)}catch{}return t}function Le(e,t){try{return M(e,["--version"],{stdio:"pipe",env:t}),!0}catch{return!1}}import Rn from"better-sqlite3";import{createRequire as In}from"module";import{existsSync as Ne,mkdtempSync as kn,readFileSync as w,rmSync as Pn,statSync as wn,writeFileSync as Cn}from"fs";import{cpus as En,tmpdir as Tn}from"os";import{dirname as re,extname as On,join as S,relative as Dn,resolve as je}from"path";import{pathToFileURL as Ln}from"url";import{Worker as Fn}from"worker_threads";function _e(e){m({projectRoot:e.projectRoot,dbPath:e.dbPath});let t=je(e.projectRoot,e.tsconfig);if(!Ne(t))throw new Error(`Vue tsconfig not found at ${t}`);let n=new Rn(e.dbPath);try{let r=tr(n,e.projectRoot),i=S(re(e.dbPath),"augment-vue-meta.json"),s=Fe(n,e.projectRoot,e.tsconfig),o=Nn(i,s,e.onStatus);if(o)return o;let a=lr(n,e.projectRoot,r),u=jn(n,e,t,r,a),c=fr(u.occurrences),g=_n(n,e,r,a,c);e.onStatus?.(`Resolved ${c.length} Vue references with Volar; inserted ${g} mentions.`);let l=Mn(r,c,g,u,a);return Vn(i,Fe(n,e.projectRoot,e.tsconfig),l),l}finally{n.close()}}function Nn(e,t,n){let r=An(e,t);return r&&n?.(`Vue references unchanged; reused ${r.resolvedReferences} cached resolved references.`),r}function jn(e,t,n,r,i){if(Jn(r))return zn({projectRoot:t.projectRoot,dbPath:t.dbPath,tsconfig:t.tsconfig,vueFiles:r});let s=Sr(),o=nr(t.projectRoot,n);return $n({projectRoot:t.projectRoot,vueFiles:o.fileNames.filter(a=>a.endsWith(".vue")),context:o,symbolLookup:ar(e,t.projectRoot,s),vueSymbolLookup:i,sourceCache:s})}function _n(e,t,n,r,i){return gr(e,t.projectRoot,n,r,i)}function Mn(e,t,n,r,i){return{vueFiles:e.length,resolvedReferences:t.length,insertedMentions:n,skippedReferences:r.skippedReferences,syntheticSymbols:i.syntheticSymbols}}function An(e,t){try{let n=JSON.parse(w(e,"utf-8"));return JSON.stringify(n.fingerprint)===JSON.stringify(t)?n.result:null}catch{return null}}function Vn(e,t,n){Cn(e,JSON.stringify({updatedAt:new Date().toISOString(),fingerprint:t,result:n},null,2)+`
|
|
84
|
-
`)}function Fe(e,t,n){let r=e.prepare(`
|
|
85
|
-
SELECT
|
|
86
|
-
(SELECT COUNT(*) FROM documents) AS documents,
|
|
87
|
-
(SELECT COUNT(*) FROM global_symbols) AS symbols,
|
|
88
|
-
(SELECT COUNT(*) FROM chunks) AS chunks,
|
|
89
|
-
(SELECT COUNT(*) FROM mentions) AS mentions,
|
|
90
|
-
(SELECT COUNT(*) FROM defn_enclosing_ranges) AS ranges,
|
|
91
|
-
(SELECT MAX(id) FROM chunks) AS maxChunkId,
|
|
92
|
-
(SELECT MAX(id) FROM global_symbols) AS maxSymbolId
|
|
93
|
-
`).get();return{version:2,tsconfig:n,files:j(t),db:r}}function $n(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 s=Bn(e,i);t.push(...s.occurrences),n+=s.skippedReferences}return{occurrences:t,skippedReferences:n}}function Bn(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.sourceCache(t.fileName);if(!i)return{occurrences:[],skippedReferences:t.countFileSkip?1:0};let s=e.context.language.maps.get(r,n),o=C(e.projectRoot,t.fileName),a=[...hr(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:Hn(a),processedStarts:new Set};return Wn({...e,fileName:t.fileName,sourceInfo:i,sourceFile:o,map:s,tokenContext:u})}function Wn(e){let t=[],n=0;for(let r of e.tokenContext.tokens){if(e.tokenContext.processedStarts.has(r.start))continue;let i=br(e.map,r.start);if(i===null)continue;let o=(e.context.languageService.getDefinitionAtPosition(e.fileName,i+1)??[]).find(u=>!yr(e.projectRoot,u.fileName));if(!o){n++;continue}let a=pr(o,e.symbolLookup,e.vueSymbolLookup,e.context,e.projectRoot);if(a===null){n++;continue}Me(t,e.sourceInfo,e.sourceFile,r,a),e.tokenContext.processedStarts.add(r.start),Un(t,e,r,i,a)}return{occurrences:t,skippedReferences:n}}function Un(e,t,n,r,i){if(!((t.tokenContext.tokenTextCounts.get(n.text)??0)<=1))for(let s of Gn(t.context.languageService,t.fileName,r+1,t.map,n,t.tokenContext.tokenByStart)){if(t.tokenContext.processedStarts.has(s))continue;let o=t.tokenContext.tokenByStart.get(s);o&&(Me(e,t.sourceInfo,t.sourceFile,o,i),t.tokenContext.processedStarts.add(s))}}function Me(e,t,n,r,i){let s=We(t,r.start);e.push({sourceFile:n,sourceLine:s.line,sourceStartChar:s.character,sourceEndChar:s.character+r.text.length,symbolId:i})}function Hn(e){let t=new Map;for(let n of e)t.set(n.text,(t.get(n.text)??0)+1);return t}function Gn(e,t,n,r,i,s){let o=e.getDocumentHighlights?.(t,n,[t])??[],a=[];for(let u of o)if(u.fileName===t)for(let c of u.highlightSpans){let g=qn(r,c.textSpan.start,s,i.text);g!==null&&a.push(g)}return a}function qn(e,t,n,r){let i=n.get(t);if(i?.text===r)return i.start;let s=Be(e,t);if(s===null)return null;let o=n.get(s);return o?.text===r?o.start:null}function Jn(e){return e.length>=8&&Ae(e.length)>1}function zn(e){let t=Ae(e.vueFiles.length),n=Kn(e.vueFiles),r=Yn(n,t),i=new URL("./augment-vue-worker.js",import.meta.url),s=kn(S(Tn(),"scip-query-vue-workers-")),o=new SharedArrayBuffer(4),a=new Int32Array(o),u=Xn(),c=Date.now();try{for(let l=0;l<r.length;l++)new Fn(i,{workerData:{projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,tasks:r[l],resultPath:S(s,`${l}.json`),sharedBuffer:o}});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,d)=>{let f=JSON.parse(w(S(s,`${d}.json`),"utf-8"));if(!f.ok)throw new Error(`Vue reference worker failed: ${f.error}`);return f.result});return{occurrences:g.flatMap(l=>l.occurrences),skippedReferences:g.reduce((l,d)=>l+d.skippedReferences,0)}}finally{Pn(s,{recursive:!0,force:!0})}}function Ae(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,En().length-1));return Math.max(1,Math.min(e,n))}function Xn(){let e=Number(process.env.SCIP_QUERY_AUGMENT_VUE_WORKER_TIMEOUT_MS??0);return Number.isFinite(e)&&e>0?e:3e5}function Kn(e){let t=Qn(),n=[];for(let r of e){let i=Ve(r),s=Math.max(1,Math.ceil(i/t));for(let o=0;o<s;o++)n.push({fileName:r,startOffset:Math.floor(i*o/s),endOffset:o===s-1?Number.POSITIVE_INFINITY:Math.floor(i*(o+1)/s),countFileSkip:o===0})}return n}function Qn(){return Number.POSITIVE_INFINITY}function Yn(e,t){let n=Array.from({length:t},()=>({tasks:[],weight:0})),r=e.map(i=>({task:i,weight:Zn(i)})).sort((i,s)=>s.weight-i.weight);for(let i of r){let s=n.reduce((o,a)=>a.weight<o.weight?a:o);s.tasks.push(i.task),s.weight+=i.weight}return n.map(i=>i.tasks).filter(i=>i.length>0)}function Zn(e){return Number.isFinite(e.endOffset)?Math.max(1,e.endOffset-e.startOffset):Math.max(1,Ve(e.fileName)-e.startOffset)}function Ve(e){try{return wn(e).size}catch{return 1}}function er(e){e.transaction(()=>{e.prepare(`
|
|
94
|
-
DELETE FROM mentions
|
|
95
|
-
WHERE chunk_id IN (
|
|
96
|
-
SELECT c.id
|
|
97
|
-
FROM chunks c
|
|
98
|
-
JOIN documents d ON d.id = c.document_id
|
|
99
|
-
WHERE d.language = 'vue' OR d.relative_path LIKE '%.vue'
|
|
100
|
-
)
|
|
101
|
-
`).run(),e.prepare(`
|
|
102
|
-
DELETE FROM chunks
|
|
103
|
-
WHERE document_id IN (
|
|
104
|
-
SELECT id
|
|
105
|
-
FROM documents
|
|
106
|
-
WHERE language = 'vue' OR relative_path LIKE '%.vue'
|
|
107
|
-
)
|
|
108
|
-
`).run()})()}function tr(e,t){return e.prepare(`
|
|
109
|
-
SELECT relative_path AS relativePath
|
|
110
|
-
FROM documents
|
|
111
|
-
WHERE language = 'vue' OR relative_path LIKE '%.vue'
|
|
112
|
-
ORDER BY relative_path
|
|
113
|
-
`).all().map(r=>je(t,r.relativePath))}function nr(e,t){let{vueCore:n,ts:r,volarTs:i}=rr(e),{parsed:s,vueOptions:o}=ir(n,r,t),a=re(t),u=n.createVueLanguagePlugin(r,s.options,o,f=>f),c=sr(n,r,u),g=or(a,s),{languageServiceHost:l}=i.createLanguageServiceHost(r,r.sys,c,f=>f,g),d=r.createLanguageService(l);return{ts:r,language:c,languageService:d,fileNames:s.fileNames,configDir:a}}function rr(e){let t=In(Ln(S(e,"package.json")).href);return{vueCore:ne(t,"@vue/language-core",e),ts:ne(t,"typescript",e),volarTs:ne(t,"@volar/typescript",e)}}function ir(e,t,n){let r=t.readConfigFile(n,t.sys.readFile);if(r.error||!r.config)throw new Error(`Failed to read ${n}`);let s=e.createParsedCommandLine(t,t.sys,n).vueOptions;return typeof e.createGlobalTypesWriter=="function"&&(s.globalTypesPath=e.createGlobalTypesWriter(s,t.sys.writeFile)),{parsed:t.parseJsonConfigFileContent(r.config,t.sys,re(n),void 0,n,void 0,e.getAllExtensions(s).map(o=>({extension:o.slice(1),isMixedContent:!0,scriptKind:t.ScriptKind.Deferred}))),vueOptions:s}}function sr(e,t,n){let r={},i=e.createLanguage([n],new Map,s=>{if(!Ne(s))return;let o=w(s,"utf-8");r.current?.scripts.set(s,t.ScriptSnapshot.fromString(o),n.getLanguageId(s)??xr(s))});return r.current=i,i}function or(e,t){return{getCurrentDirectory:()=>e,getCompilationSettings:()=>t.options,getScriptFileNames:()=>t.fileNames,getProjectReferences:()=>t.projectReferences,getProjectVersion:()=>"0"}}function ne(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 ar(e,t,n){let r=ur(e);return i=>{let s=C(t,i.fileName),o=n(i.fileName);if(!o)return null;let a=We(o,i.textSpan.start),u=r.get(s);if(!u)return null;let c=u.containingByLine.get(a.line);return c!==void 0?c:cr(u.starts,a.line,2)}}function ur(e){let t=e.prepare(`
|
|
114
|
-
SELECT
|
|
115
|
-
d.relative_path AS relativePath,
|
|
116
|
-
der.start_line AS startLine,
|
|
117
|
-
der.end_line AS endLine,
|
|
118
|
-
der.symbol_id AS symbolId
|
|
119
|
-
FROM defn_enclosing_ranges der
|
|
120
|
-
JOIN documents d ON d.id = der.document_id
|
|
121
|
-
ORDER BY d.relative_path, (der.end_line - der.start_line) DESC
|
|
122
|
-
`).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 s=r.startLine;s<=r.endLine;s++)i.containingByLine.set(s,r.symbolId)}for(let r of n.values())r.starts.sort((i,s)=>i.line-s.line);return n}function cr(e,t,n){let r=0,i=e.length-1;for(;r<=i;){let o=Math.floor((r+i)/2);e[o].line<t?r=o+1:i=o-1}let s=null;for(let o of[i,r]){let a=e[o];if(!a)continue;let u=Math.abs(a.line-t);u>n||(!s||u<s.distance)&&(s={distance:u,symbolId:a.symbolId})}return s?.symbolId??null}function lr(e,t,n){let r=Ir(t),i=e.prepare("SELECT id FROM global_symbols WHERE symbol = ?"),s=e.prepare(`
|
|
123
|
-
INSERT OR IGNORE INTO global_symbols (symbol, display_name, kind, documentation)
|
|
124
|
-
VALUES (?, ?, ?, ?)
|
|
125
|
-
`),o=0,a=new Map;return e.transaction(()=>{for(let c of n){let g=C(t,c),l=kr(r.name,r.version,g);s.run(l,"default",7,`Vue component|${g}`);let d=i.get(l);d&&(o++,a.set(c,d.id))}})(),{get(c){return a.get(c)??null},syntheticSymbols:o}}function gr(e,t,n,r,i){return e.transaction(()=>(er(e),dr(e,t,n,r),mr(e,i)))()}function dr(e,t,n,r){let i=e.prepare("SELECT id FROM documents WHERE relative_path = ?"),s=e.prepare(`
|
|
126
|
-
INSERT INTO chunks (document_id, chunk_index, start_line, end_line, occurrences)
|
|
127
|
-
VALUES (?, ?, ?, ?, X'00')
|
|
128
|
-
`),o=e.prepare(`
|
|
129
|
-
INSERT OR IGNORE INTO mentions (chunk_id, symbol_id, role)
|
|
130
|
-
VALUES (?, ?, 1)
|
|
131
|
-
`);for(let a of n){let u=r.get(a);if(!u)continue;let c=C(t,a),g=i.get(c);if(!g)continue;let l=s.run(g.id,-1,0,0);o.run(Number(l.lastInsertRowid),u)}}function pr(e,t,n,r,i){if(e.fileName.endsWith(".vue")){let s=r.language.scripts.get(e.fileName),o=s?.generated?.languagePlugin.typescript?.getServiceScript(s.generated.root)?.code;if(s&&o){let a=r.language.maps.get(o,s);if(Be(a,e.textSpan.start)!==null)return n.get(e.fileName)}return e.fileName.startsWith(i)?n.get(e.fileName):null}return t(e)}function fr(e){let t=new Set,n=[];for(let r of e){let i=$e(r);t.has(i)||(t.add(i),n.push(r))}return n}function $e(e){return[e.sourceFile,e.sourceLine,e.sourceStartChar,e.sourceEndChar,e.symbolId].join(":")}function mr(e,t){let n=Rr(e,[...new Set(t.map(u=>u.sourceFile))]),r=e.prepare(`
|
|
132
|
-
INSERT INTO chunks (document_id, chunk_index, start_line, end_line, occurrences)
|
|
133
|
-
VALUES (?, ?, ?, ?, X'00')
|
|
134
|
-
`),i=e.prepare(`
|
|
135
|
-
INSERT OR IGNORE INTO mentions (chunk_id, symbol_id, role)
|
|
136
|
-
VALUES (?, ?, 0)
|
|
137
|
-
`),s=new Set,o=0,a=0;for(let u of t){let c=$e(u);if(s.has(c))continue;s.add(c);let g=n.get(u.sourceFile);if(!g)continue;let l=r.run(g,a++,u.sourceLine,u.sourceLine),d=i.run(Number(l.lastInsertRowid),u.symbolId);o+=Number(d.changes)}return o}function*hr(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 br(e,t){for(let[n]of e.toGeneratedLocation(t,r=>!!r.navigation))return n;return null}function Be(e,t){let n=e;for(let[r]of n.toSourceLocation(t,i=>!!i.navigation))return r;return null}function We(e,t){let n=0,r=e.lineStarts.length-1;for(;n<=r;){let s=Math.floor((n+r)/2);e.lineStarts[s]<=t?n=s+1:r=s-1}let i=Math.max(0,r);return{line:i,character:t-e.lineStarts[i]}}function yr(e,t){return C(e,t).startsWith("node_modules/")}function C(e,t){return Dn(e,t).replaceAll("\\","/")}function xr(e){switch(On(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 Sr(){let e=new Map;return t=>{if(e.has(t))return e.get(t)??null;try{let n=w(t,"utf-8"),r={text:n,lineStarts:vr(n)};return e.set(t,r),r}catch{return e.set(t,null),null}}}function vr(e){let t=[0];for(let n=0;n<e.length;n++)e.charCodeAt(n)===10&&t.push(n+1);return t}function Rr(e,t){let n=new Map,r=500;for(let i=0;i<t.length;i+=r){let s=t.slice(i,i+r),o=e.prepare(`SELECT id, relative_path AS relativePath FROM documents WHERE relative_path IN (${s.map(()=>"?").join(",")})`).all(...s);for(let a of o)n.set(a.relativePath,a.id)}return n}function Ir(e){try{let t=JSON.parse(w(S(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 kr(e,t,n){let r=n.split("/").map(i=>`\`${i.replaceAll("`","")}\``).join("/");return`scip-vue npm ${e} ${t} ${r}/default.`}async function Fr(e){let{projectRoot:t,maxHeapMb:n=8192,onStatus:r=console.log,skipAutoInstall:i=!1}=e,s=Nr(e),o=Date.now();Ue(b(s.outputScip),{recursive:!0}),Ue(b(s.outputDb),{recursive:!0});let a=e.languages??L(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=ri(t,a,{pnpmWorkspaces:e.pnpmWorkspaces}),c=Qr(p(b(s.outputDb),"index.lock")),g=null;try{let l=jr({opts:e,paths:s,languages:a,fingerprint:u,start:o,onStatus:r});if(l)return l;$r(i,r);let d=_r(s);return g=d.runDir,await Mr({opts:e,languages:a,projectRoot:t,paths:s,tempPaths:d,fingerprint:u,start:o,maxHeapMb:n,skipAutoInstall:i,onStatus:r})}finally{g&&R(g,{recursive:!0,force:!0}),c()}}function Nr(e){let t=e.outputScip??p(e.projectRoot,"index.scip"),n=e.outputDb??p(e.projectRoot,"index.db");return{outputScip:t,outputDb:n,metaPath:p(b(n),"meta.json")}}function jr(e){if(e.opts.skipIfUnchanged===!1||!y(e.paths.outputScip)||!y(e.paths.outputDb)||!ii(e.paths.metaPath,e.fingerprint))return null;m({projectRoot:e.opts.projectRoot,dbPath:e.paths.outputDb,onStatus:e.onStatus});let t=Date.now()-e.start;return 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:[]}}function _r(e){let t=Er(p(b(e.outputDb),"reindex-"));return{runDir:t,tempOutputScip:p(t,W(e.outputScip)),tempOutputDb:p(t,W(e.outputDb)),tempMetaPath:p(t,W(e.metaPath))}}async function Mr(e){let t={...process.env,NODE_OPTIONS:`--max-old-space-size=${e.maxHeapMb}`},{indexedOutputs:n,skippedLanguages:r}=await Ar(e,t);Vr(e,t,n,r);let i=Date.now()-e.start;return e.onStatus(`Done in ${(i/1e3).toFixed(1)}s`),{languages:n.map(s=>s.language),indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:i,reused:!1,skipped:r}}async function Ar(e,t){let{preparedRuns:n,skippedLanguages:r}=Br({languages:e.languages,tempOutputScip:e.tempPaths.tempOutputScip,projectRoot:e.projectRoot,env:t,skipAutoInstall:e.skipAutoInstall,pnpmWorkspaces:e.opts.pnpmWorkspaces,onStatus:e.onStatus}),i=await ei(n,e.projectRoot,e.onStatus,e.opts.indexerConcurrency),{indexedOutputs:s}=Ur(i,r);return Hr(s,r,e.languages,e.opts.allowPartial,e.onStatus),{indexedOutputs:s,skippedLanguages:r}}function Vr(e,t,n,r){Gr(n,e.tempPaths.tempOutputScip,e.onStatus),qr(e.tempPaths.tempOutputScip,e.tempPaths.tempOutputDb,t,e.onStatus),m({projectRoot:e.projectRoot,dbPath:e.tempPaths.tempOutputDb,onStatus:e.onStatus}),si(e.tempPaths.tempMetaPath,{version:2,status:r.length===0?"complete":"partial",updatedAt:new Date().toISOString(),fingerprint:e.fingerprint,requestedLanguages:e.languages,indexedLanguages:n.map(i=>i.language),skipped:[...r]}),Yr({tempOutputScip:e.tempPaths.tempOutputScip,tempOutputDb:e.tempPaths.tempOutputDb,tempMetaPath:e.tempPaths.tempMetaPath,outputScip:e.paths.outputScip,outputDb:e.paths.outputDb,metaPath:e.paths.metaPath})}function $r(e,t){if(!h("scip")){if(e)throw new Error(`The scip CLI is required but not found on PATH.
|
|
138
|
-
Install from: https://github.com/sourcegraph/scip/releases`);if(t("scip CLI not found on PATH. Attempting auto-install..."),!O(t))throw new Error(`The scip CLI is required but could not be installed.
|
|
139
|
-
Install manually from: https://github.com/sourcegraph/scip/releases`)}}function Br(e){let t=[],n=[],r=e.languages.map((i,s)=>({language:i,scipPath:e.languages.length>1?Kr(e.tempOutputScip,i,s):e.tempOutputScip}));for(let{language:i,scipPath:s}of r){let o=Wr({...e,language:i,scipPath:s});"skipped"in o?n.push(o.skipped):t.push(o.prepared)}return{preparedRuns:t,skippedLanguages:n}}function Wr(e){let t=F(e.language),n=A(t),r=ee(t,e.projectRoot);if(!r&&!V(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...`),!$(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??P(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:s,args:o}=t.indexArgs({projectRoot:e.projectRoot,outputPath:e.scipPath,pnpmWorkspaces:e.pnpmWorkspaces,indexerBinary:i});return{prepared:{language:e.language,scipPath:e.scipPath,config:t,resolvedBinary:i,binary:s,args:o,env:te(t,e.env,i)}}}function Ur(e,t){let n=[];for(let r of e)r.skipped?t.push(r.skipped):n.push({language:r.language,scipPath:r.scipPath});return{indexedOutputs:n}}function Hr(e,t,n,r,i){if(e.length===0){let s=t.map(o=>` - ${o.language}: ${o.reason}`).join(`
|
|
140
|
-
`);throw new Error(`No language indexers ran successfully. Install at least one indexer for the languages in this project.
|
|
141
|
-
`+s)}if(t.length!==0&&(i(`Indexed ${e.length} of ${n.length} languages; skipped ${t.map(s=>s.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.
|
|
142
|
-
`+t.map(s=>` - ${s.language}: ${s.reason}`).join(`
|
|
143
|
-
`))}function Gr(e,t,n){e.length>1?(n(`Merging ${e.length} language indexes...`),N(e.map(r=>r.scipPath),t)):e[0].scipPath!==t&&v(e[0].scipPath,t)}function qr(e,t,n,r){if(r("Converting to SQLite..."),!y(e))throw new Error(`SCIP index not found at ${e} after indexing`);try{let i=Ee(e);i.removedDefinitionOccurrences>0&&r(`Sanitized ${i.removedDefinitionOccurrences} invalid definition occurrences across ${i.touchedDocuments} documents before SQLite conversion.`),wr("scip",["expt-convert","--output",t,e],{env:n,stdio:"pipe",maxBuffer:50*1024*1024})}catch(i){let s=i instanceof Error?i.message:String(i);throw new Error(`Failed to convert SCIP index to SQLite: ${s}`,{cause:i})}}function Jr(e,t,n){if(!e.defaultOutputPath)return;let r=p(t,e.defaultOutputPath);n!==r&&y(r)&&v(r,n)}function zr(e,t,n){if(!e.defaultOutputPath)return null;let r=p(t,e.defaultOutputPath);if(r===n)return null;let i=`${n}.default-output-backup`;return R(i,{force:!0}),y(r)?(v(r,i),{defaultOutputPath:r,backupPath:i}):{defaultOutputPath:r,backupPath:null}}function Xr(e){e&&(R(e.defaultOutputPath,{force:!0}),e.backupPath&&y(e.backupPath)&&v(e.backupPath,e.defaultOutputPath))}function Kr(e,t,n){let r=Lr(e)||".scip",i=W(e,r);return p(b(e),`${i}.${n+1}.${t}${r}`)}function Qr(e){let t;try{t=Tr(e,"wx")}catch(n){throw(typeof n=="object"&&n&&"code"in n?n.code:void 0)==="EEXIST"?new Error(`Another scip-query reindex is already running for ${b(e)}.`,{cause:n}):n}return He(t,JSON.stringify({pid:process.pid,startedAt:new Date().toISOString()})+`
|
|
144
|
-
`),()=>{try{Cr(t)}finally{R(e,{force:!0})}}}function Yr(e){ie(e.tempOutputScip,e.outputScip),ie(e.tempOutputDb,e.outputDb),ie(e.tempMetaPath,e.metaPath)}function ie(e,t){R(`${t}.tmp-replace`,{force:!0}),v(e,`${t}.tmp-replace`),v(`${t}.tmp-replace`,t)}function Zr(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(2,Math.max(1,Dr().length-1));return Math.max(1,Math.min(e,Math.floor(r)))}async function ei(e,t,n,r){let i=e.filter(c=>c.config.defaultOutputPath),s=e.filter(c=>!c.config.defaultOutputPath),o=[],a=Zr(s.length,r),u=await ni(s,a,c=>se(c,t,n));if(a>1){let c=new Map;for(let g of u.filter(l=>l.skipped)){let l=s.find(d=>d.language===g.language);l&&(n(`Retrying ${l.language} indexer serially after parallel failure...`),c.set(l.language,await se(l,t,n)))}o.push(...u.map(g=>c.get(g.language)??g))}else o.push(...u);for(let c of i)o.push(await se(c,t,n));return o.sort((c,g)=>e.findIndex(l=>l.language===c.language)-e.findIndex(l=>l.language===g.language))}async function se(e,t,n){n(`Indexing ${e.language} with ${e.resolvedBinary}...`),R(e.scipPath,{force:!0});let r=zr(e.config,t,e.scipPath);try{await ti(e.binary,e.args,{cwd:t,env:e.env,maxBuffer:50*1024*1024}),Jr(e.config,t,e.scipPath)}catch(i){let s=i instanceof Error?i.message:String(i),o=`${e.resolvedBinary} indexer failed: ${s.split(`
|
|
145
|
-
`)[0]}`;return n(`Skipping ${e.language}: ${o}`),{language:e.language,scipPath:e.scipPath,skipped:{language:e.language,reason:o}}}finally{Xr(r)}if(!y(e.scipPath)){let i=`${e.resolvedBinary} indexer completed but did not produce ${e.scipPath}`;return n(`Skipping ${e.language}: ${i}`),{language:e.language,scipPath:e.scipPath,skipped:{language:e.language,reason:i}}}return{language:e.language,scipPath:e.scipPath}}function ti(e,t,n){return new Promise((r,i)=>{Pr(e,[...t],n,s=>{s?i(s):r()})})}async function ni(e,t,n){if(e.length===0)return[];let r=new Array(e.length),i=0,s=Math.max(1,Math.min(e.length,t)),o=Array.from({length:s},async()=>{for(;i<e.length;){let a=i++;r[a]=await n(e[a])}});return await Promise.all(o),r}function ri(e,t,n){return{version:1,languages:[...t].sort(),pnpmWorkspaces:n.pnpmWorkspaces===!0,files:j(e)}}function ii(e,t){try{let n=JSON.parse(Or(e,"utf-8"));return n.version===2&&n.status==="complete"&&B(n.fingerprint)===B(t)&&B([...n.indexedLanguages??[]].sort())===B(t.languages)}catch{return!1}}function si(e,t){He(e,`${JSON.stringify(t,null,2)}
|
|
146
|
-
`)}function B(e){return JSON.stringify(e)}import{readFileSync as oi,writeFileSync as ai,existsSync as qe,mkdirSync as ui}from"fs";import{join as x,resolve as Ge}from"path";import{createHash as ci}from"crypto";import{homedir as li}from"os";var Je=".scipquery.json",gi={enabled:!1,debounceMs:3e4,cooldownMs:6e4,ignore:[]};function di(e){let t=x(e,Je);if(!qe(t))return{};try{let n=oi(t,"utf-8");return JSON.parse(n)}catch{return{}}}function ze(e){return{...gi,...e.watch}}function pi(e,t){let n=process.env.SCIP_QUERY_CACHE_DIR;if(n)return oe(n);if(t?.dbPath)return oe(Ge(e,t.dbPath));let i=process.env.XDG_CACHE_HOME||x(li(),".cache"),s=ci("sha256").update(Ge(e)).digest("hex").slice(0,12),o=x(i,"scip-query","projects",s);return oe(o)}function ae(e,t){let n=pi(e,t);return{cacheDir:n,dbPath:x(n,"index.db"),indexPath:x(n,"index.scip"),metaPath:x(n,"meta.json")}}function fi(e,t){let n=x(e,Je);return qe(n)||ai(n,JSON.stringify({languages:t,watch:{enabled:!1,debounceMs:3e4,cooldownMs:6e4}},null,2)+`
|
|
147
|
-
`),n}function oe(e){return ui(e,{recursive:!0}),e}import{watch as mi}from"fs";import{existsSync as Xe,renameSync as Ke}from"fs";import{join as hi,relative as bi}from"path";import{fork as yi}from"child_process";import xi from"ignore";var ue=class{projectRoot;watchConfig;indexPaths;languages;pnpmWorkspaces;onStatus;onReindexComplete;onError;status={state:"idle"};debounceTimer=null;cooldownTimer=null;dirty=!1;changedFiles=0;reindexInFlight=!1;lastReindexEnd=0;fsWatchers=[];gitignoreFilter;extraIgnore;stopped=!1;constructor(t){this.projectRoot=t.projectRoot,this.watchConfig=ze(t.config),this.indexPaths=ae(t.projectRoot,t.config),this.languages=t.languages,this.pnpmWorkspaces=t.config.indexer?.typescript?.pnpmWorkspaces??!1,this.onStatus=t.onStatus??(()=>{}),this.onReindexComplete=t.onReindexComplete??(()=>{}),this.onError=t.onError??(n=>console.error(n.message)),this.gitignoreFilter=I(t.projectRoot),this.extraIgnore=xi(),this.watchConfig.ignore.length>0&&this.extraIgnore.add(this.watchConfig.ignore)}start(){this.stopped=!1,this.setStatus({state:"idle"});try{let t=mi(this.projectRoot,{recursive:!0},(n,r)=>{r&&!this.stopped&&this.handleFileChange(r)});this.fsWatchers.push(t)}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 t of this.fsWatchers)t.close();this.fsWatchers=[],this.clearDebounceTimer(),this.clearCooldownTimer(),this.setStatus({state:"idle"})}handleFileChange(t){let n=bi(this.projectRoot,hi(this.projectRoot,t));if(this.gitignoreFilter.isIgnored(n)||this.extraIgnore.ignores(n)||t.endsWith("index.db")||t.endsWith("index.scip")||t.endsWith("index.db.tmp")||t.endsWith(".scipquery.json"))return;if(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 r=Date.now()+this.watchConfig.debounceMs;this.setStatus({state:"waiting",changedFiles:this.changedFiles,reindexAt:r}),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.triggerReindex()},this.watchConfig.debounceMs)}triggerReindex(){if(this.reindexInFlight||this.stopped)return;let t=Date.now()-this.lastReindexEnd;if(this.lastReindexEnd>0&&t<this.watchConfig.cooldownMs){let r=this.watchConfig.cooldownMs-t;this.dirty=!0;let i=Date.now()+r;this.setStatus({state:"cooldown",until:i,dirty:!0}),this.cooldownTimer=setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped&&(this.dirty=!1,this.triggerReindex())},r);return}this.reindexInFlight=!0,this.dirty=!1,this.changedFiles=0;let n=Date.now();this.setStatus({state:"indexing",startedAt:n}),this.runReindex().then(r=>{if(this.reindexInFlight=!1,this.lastReindexEnd=Date.now(),this.onReindexComplete(r),this.dirty&&!this.stopped){let i=Date.now()+this.watchConfig.cooldownMs;this.setStatus({state:"cooldown",until:i,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(r=>{this.reindexInFlight=!1,this.lastReindexEnd=Date.now(),this.onError(r instanceof Error?r:new Error(String(r))),this.setStatus({state:"idle"})})}runReindex(){return new Promise((t,n)=>{let r=Date.now(),i=this.indexPaths.dbPath+".tmp",s=Si(this.indexPaths.indexPath),o=yi(new URL("./reindex-worker.js",import.meta.url).pathname,[],{env:{...process.env,SCIP_REINDEX_PROJECT_ROOT:this.projectRoot,SCIP_REINDEX_OUTPUT_SCIP:s,SCIP_REINDEX_OUTPUT_DB:i,SCIP_REINDEX_LANGUAGES:this.languages?.join(",")??"",SCIP_REINDEX_PNPM_WORKSPACES:this.pnpmWorkspaces?"1":""},stdio:"pipe"});o.on("exit",a=>{if(a===0)try{Xe(i)&&Ke(i,this.indexPaths.dbPath),Xe(s)&&Ke(s,this.indexPaths.indexPath),t(Date.now()-r)}catch(u){n(new Error(`Atomic swap failed: ${u}`))}else n(new Error(`Reindex worker exited with code ${a}`))}),o.on("error",n)})}setStatus(t){this.status=t,this.onStatus(t)}clearDebounceTimer(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null)}clearCooldownTimer(){this.cooldownTimer&&(clearTimeout(this.cooldownTimer),this.cooldownTimer=null)}};function Si(e){return e.endsWith(".scip")?e.slice(0,-5)+".tmp.scip":e+".tmp.scip"}import{existsSync as ce,mkdirSync as vi,symlinkSync as Ri,readlinkSync as Ii,unlinkSync as ki}from"fs";import{join as U,dirname as Qe,resolve as le}from"path";import{homedir as Ye,platform as Pi}from"os";import{fileURLToPath as wi}from"url";var Ci=Pi()==="win32",Ei=["concrete-plan","scip-explore","scip-debloat","scip-verify","scip-language-playbook"];function Ti(e={}){let t=e.quiet?()=>{}:console.log,n=wi(import.meta.url),r=le(Qe(n),"..","skills"),i=[U(Ye(),".claude","skills"),U(Ye(),".codex","skills")],s={installed:[],skipped:[],alreadyLinked:[]};for(let o of i){let a=Qe(o);if(!ce(a))continue;vi(o,{recursive:!0});let u=o.includes(".codex")?"Codex":"Claude";for(let c of Ei){let g=U(r,c),l=U(o,c);if(!ce(g)){s.skipped.push(`${u}/${c}`);continue}if(ce(l)){try{let d=Ii(l);if(le(d)===le(g)){s.alreadyLinked.push(`${u}/${c}`),t(` ok: ${c} \u2192 ${u} (already linked)`);continue}}catch{s.skipped.push(`${u}/${c}`),t(` skip: ${c} \u2192 ${u} (exists, not a symlink)`);continue}ki(l)}Ri(g,l,Ci?"junction":"dir"),s.installed.push(`${u}/${c}`),t(` done: ${c} \u2192 ${u}`)}}return s}export{Is as HEALTH_PHASES,X as INDEXER_CONFIGS,rt as ProjectIndex,H as ScipDatabase,ue as Watcher,ds as affected,m as augmentAuxiliaryDocuments,_e as augmentVueResolvedReferences,es as bottlenecks,ns as byKind,os as callGraph,ps as changeSurface,Es as code,Ts as complexity,Rs as complexityHotspots,Cs as convergence,Qi as coupling,I as createGitignoreFilter,Zi as cycles,Os as dataflow,$i as dead,is as deepChains,_i as deps,L as detectLanguages,fs as diffImpact,hs as diffImpactPartial,ms as diffImpactPlan,ys as drift,gs as extractCandidates,Ji as fanIn,zi as fanOut,Di as files,F as getIndexerConfig,mt as getScipVersion,ks as health,Ps as healthPhase,ws as healthReportFromPhases,ss as hierarchy,Bi as hotspots,Ui as importedBy,Wi as imports,fi as initProjectConfig,Ti as installSkills,h as isBinaryAvailable,V as isIndexerInstalled,ft as isScipInstalled,ts as isolated,rs as kindCounts,nt as leafName,di as loadProjectConfig,qi as members,bs as mergeDiffImpactPartials,N as mergeScipFiles,Q as mergeScipIndexes,Fi as methods,Gi as outline,et as parseSymbol,Ss as passthroughCandidates,bt as printScipInstallInstructions,Mi as rdeps,Ls as redundantReexports,Ni as refs,Fr as reindex,ae as resolveIndexPaths,tt as shortenSymbol,as as similar,us as similarAll,ls as similarChains,cs as similarFiles,Fs as similarSignatures,Ds as slice,vs as staleAbstractions,Oi as stats,Vi as surface,Li as symbols,Ai as system,Yi as topCoupling,Xi as topFanIn,Ki as topFanOut,ji as trace,$ as tryInstallIndexer,O as tryInstallScipCli,Hi as unusedImports,xs as wrapperCandidates};
|
|
18
|
+
)`}get pathExclusions(){return this.pathExclusionsFor("d")}get symbolNoise(){return this.symbolNoiseFor("gs")}pathExclusionsFor(...t){return t.flatMap(e=>d.flatMap(r=>[`AND ${e}.relative_path NOT LIKE '${r}/%'`,`AND ${e}.relative_path NOT LIKE '%/${r}/%'`])).join(`
|
|
19
|
+
`)}symbolNoiseFor(t){return`AND ${t}.symbol NOT LIKE '%().(%' AND ${t}.symbol NOT LIKE '%typeLiteral%'`}all(t,...e){return this.db.prepare(t).all(...e)}get(t,...e){return this.db.prepare(t).get(...e)}close(){this.db.close()}};export{s as ProjectIndex,o as ScipDatabase,a as createGitignoreFilter,l as leafName,i as parseSymbol,n as shortenSymbol};
|
|
148
20
|
//# sourceMappingURL=index.js.map
|
package/dist/postinstall.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
2
|
+
import{b as u,c as k,d as f,e as g}from"./chunk-LWYIGRHR.js";import{existsSync as p,mkdirSync as L,symlinkSync as v,readlinkSync as C,unlinkSync as b}from"fs";import{join as c,dirname as m,resolve as d}from"path";import{homedir as S,platform as q}from"os";import{fileURLToPath as R}from"url";var D=q()==="win32",N=["concrete-plan","scip-explore","scip-debloat","scip-verify","scip-language-playbook"];function T(t={}){let i=t.quiet?()=>{}:console.log,e=R(import.meta.url),I=d(m(e),"..","skills"),$=[c(S(),".claude","skills"),c(S(),".codex","skills")],s={installed:[],skipped:[],alreadyLinked:[]};for(let o of $){let h=m(o);if(!p(h))continue;L(o,{recursive:!0});let n=o.includes(".codex")?"Codex":"Claude";for(let l of N){let a=c(I,l),r=c(o,l);if(!p(a)){s.skipped.push(`${n}/${l}`);continue}if(p(r)){try{let x=C(r);if(d(x)===d(a)){s.alreadyLinked.push(`${n}/${l}`),i(` ok: ${l} \u2192 ${n} (already linked)`);continue}}catch{s.skipped.push(`${n}/${l}`),i(` skip: ${l} \u2192 ${n} (exists, not a symlink)`);continue}b(r)}v(a,r,D?"junction":"dir"),s.installed.push(`${n}/${l}`),i(` done: ${l} \u2192 ${n}`)}}return s}function y(){console.log("scip-query: installing skills...");let t=T({quiet:!1});if(t.installed.length+t.alreadyLinked.length>0&&console.log(`
|
|
3
3
|
${t.installed.length} skill(s) installed, ${t.alreadyLinked.length} already linked.`),!u())console.log(`
|
|
4
4
|
scip CLI not found on PATH. Attempting auto-install...`),g(console.log)||f();else{let e=k();console.log(`
|
|
5
5
|
scip CLI: ${e??"installed"}`)}console.log("")}y();
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import { S as ScipDatabase
|
|
1
|
+
import { S as ScipDatabase } from '../db-DdTPetj5.js';
|
|
2
2
|
import 'better-sqlite3';
|
|
3
|
+
import '../config-types-CGIeLEpY.js';
|
|
3
4
|
|
|
5
|
+
interface AffectedResult {
|
|
6
|
+
symbol: string;
|
|
7
|
+
shortName: string;
|
|
8
|
+
file: string;
|
|
9
|
+
depth: number;
|
|
10
|
+
}
|
|
4
11
|
/**
|
|
5
12
|
* Full transitive closure of symbols that could break if a given symbol changes.
|
|
6
13
|
* BFS from the target through the mention graph: depth 1 = direct consumers,
|
|
@@ -11,4 +18,4 @@ declare function affected(db: ScipDatabase, symbolPattern: string, opts?: {
|
|
|
11
18
|
scope?: string;
|
|
12
19
|
}): AffectedResult[];
|
|
13
20
|
|
|
14
|
-
export { affected };
|
|
21
|
+
export { type AffectedResult, affected };
|
package/dist/queries/affected.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-72JOIFXL.js";import"../chunk-ARBZM2NF.js";import"../chunk-JB4PUN5S.js";import"../chunk-7O4MJYIW.js";import"../chunk-ZNUPGRPR.js";import"../chunk-RCJEFQOK.js";import"../chunk-BOVNTAKQ.js";import"../chunk-KJ6CW6EK.js";import"../chunk-7OX2O53H.js";import"../chunk-5TT47UMX.js";import"../chunk-NHDPYW7O.js";import"../chunk-NN3O7TPH.js";export{a as affected};
|
|
2
2
|
//# sourceMappingURL=affected.js.map
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
import { S as ScipDatabase
|
|
1
|
+
import { S as ScipDatabase } from '../db-DdTPetj5.js';
|
|
2
2
|
import 'better-sqlite3';
|
|
3
|
+
import '../config-types-CGIeLEpY.js';
|
|
3
4
|
|
|
5
|
+
interface BottleneckResult {
|
|
6
|
+
symbol: string;
|
|
7
|
+
shortName: string;
|
|
8
|
+
fanIn: number;
|
|
9
|
+
fanOut: number;
|
|
10
|
+
/** fanIn * fanOut — higher = more central coupling hub */
|
|
11
|
+
score: number;
|
|
12
|
+
definedIn: string;
|
|
13
|
+
}
|
|
4
14
|
/**
|
|
5
15
|
* Find coupling hubs: symbols with both high fan-in (many consumers)
|
|
6
16
|
* AND high fan-out (references many other symbols).
|
|
@@ -17,4 +27,4 @@ declare function bottlenecks(db: ScipDatabase, opts?: {
|
|
|
17
27
|
semantic?: boolean;
|
|
18
28
|
}): BottleneckResult[];
|
|
19
29
|
|
|
20
|
-
export { bottlenecks };
|
|
30
|
+
export { type BottleneckResult, bottlenecks };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-YSZNAG4G.js";import"../chunk-MX6F756F.js";import"../chunk-QAEDNTY7.js";import"../chunk-NKJKI6SE.js";import"../chunk-IODTPF5H.js";import"../chunk-ARBZM2NF.js";import"../chunk-JB4PUN5S.js";import"../chunk-7O4MJYIW.js";import"../chunk-ZNUPGRPR.js";import"../chunk-RCJEFQOK.js";import"../chunk-BOVNTAKQ.js";import"../chunk-KJ6CW6EK.js";import"../chunk-7OX2O53H.js";import"../chunk-5TT47UMX.js";import"../chunk-NHDPYW7O.js";import"../chunk-NN3O7TPH.js";export{a as bottlenecks};
|
|
2
2
|
//# sourceMappingURL=bottlenecks.js.map
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
import { S as ScipDatabase
|
|
1
|
+
import { S as ScipDatabase } from '../db-DdTPetj5.js';
|
|
2
2
|
import 'better-sqlite3';
|
|
3
|
+
import '../config-types-CGIeLEpY.js';
|
|
3
4
|
|
|
5
|
+
interface ByKindResult {
|
|
6
|
+
symbol: string;
|
|
7
|
+
shortName: string;
|
|
8
|
+
kind: number;
|
|
9
|
+
kindName: string;
|
|
10
|
+
relativePath: string;
|
|
11
|
+
startLine: number;
|
|
12
|
+
endLine: number;
|
|
13
|
+
}
|
|
4
14
|
declare function byKind(db: ScipDatabase, kindQuery: string, opts?: {
|
|
5
15
|
scope?: string;
|
|
6
16
|
limit?: number;
|
|
@@ -14,4 +24,4 @@ declare function kindCounts(db: ScipDatabase, opts?: {
|
|
|
14
24
|
count: number;
|
|
15
25
|
}>;
|
|
16
26
|
|
|
17
|
-
export { byKind, kindCounts };
|
|
27
|
+
export { type ByKindResult, byKind, kindCounts };
|
package/dist/queries/by-kind.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b}from"../chunk-
|
|
1
|
+
import{a,b}from"../chunk-3OUC276S.js";import"../chunk-7OX2O53H.js";import"../chunk-5TT47UMX.js";import"../chunk-NHDPYW7O.js";import"../chunk-NN3O7TPH.js";export{a as byKind,b as kindCounts};
|
|
2
2
|
//# sourceMappingURL=by-kind.js.map
|
|
@@ -1,6 +1,23 @@
|
|
|
1
|
-
import { S as ScipDatabase
|
|
1
|
+
import { S as ScipDatabase } from '../db-DdTPetj5.js';
|
|
2
2
|
import 'better-sqlite3';
|
|
3
|
+
import '../config-types-CGIeLEpY.js';
|
|
3
4
|
|
|
5
|
+
interface CallGraphResult {
|
|
6
|
+
symbol: string;
|
|
7
|
+
shortName: string;
|
|
8
|
+
/** Symbols that call this one (incoming) */
|
|
9
|
+
callers: Array<{
|
|
10
|
+
symbol: string;
|
|
11
|
+
shortName: string;
|
|
12
|
+
file: string;
|
|
13
|
+
}>;
|
|
14
|
+
/** Symbols called by this one (outgoing) */
|
|
15
|
+
callees: Array<{
|
|
16
|
+
symbol: string;
|
|
17
|
+
shortName: string;
|
|
18
|
+
file: string;
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
4
21
|
/**
|
|
5
22
|
* Build a call graph for a symbol: who calls it (incoming) and
|
|
6
23
|
* what it calls (outgoing).
|
|
@@ -12,4 +29,4 @@ declare function callGraph(db: ScipDatabase, symbolPattern: string, opts?: {
|
|
|
12
29
|
semantic?: boolean;
|
|
13
30
|
}): CallGraphResult | null;
|
|
14
31
|
|
|
15
|
-
export { callGraph };
|
|
32
|
+
export { type CallGraphResult, callGraph };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-TGK5DFBJ.js";import"../chunk-MX6F756F.js";import"../chunk-ARBZM2NF.js";import"../chunk-JB4PUN5S.js";import"../chunk-7O4MJYIW.js";import"../chunk-ZNUPGRPR.js";import"../chunk-RCJEFQOK.js";import"../chunk-BOVNTAKQ.js";import"../chunk-KJ6CW6EK.js";import"../chunk-7OX2O53H.js";import"../chunk-5TT47UMX.js";import"../chunk-NHDPYW7O.js";import"../chunk-NN3O7TPH.js";export{a as callGraph};
|
|
2
2
|
//# sourceMappingURL=call-graph.js.map
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
import { S as ScipDatabase
|
|
1
|
+
import { S as ScipDatabase } from '../db-DdTPetj5.js';
|
|
2
2
|
import 'better-sqlite3';
|
|
3
|
+
import '../config-types-CGIeLEpY.js';
|
|
3
4
|
|
|
5
|
+
interface ChangeSurfaceEntry {
|
|
6
|
+
symbol: string;
|
|
7
|
+
shortName: string;
|
|
8
|
+
startLine: number;
|
|
9
|
+
endLine: number;
|
|
10
|
+
externalConsumers: number;
|
|
11
|
+
riskLevel: 'low' | 'medium' | 'high';
|
|
12
|
+
}
|
|
13
|
+
interface ChangeSurfaceResult {
|
|
14
|
+
file: string;
|
|
15
|
+
symbols: ChangeSurfaceEntry[];
|
|
16
|
+
totalExternalConsumers: number;
|
|
17
|
+
}
|
|
4
18
|
/**
|
|
5
19
|
* Pre-change briefing for a file. For each symbol defined in the file,
|
|
6
20
|
* reports external consumer count and blast-radius risk.
|
|
@@ -12,4 +26,4 @@ declare function changeSurface(db: ScipDatabase, filePattern: string, opts?: {
|
|
|
12
26
|
semantic?: boolean;
|
|
13
27
|
}): ChangeSurfaceResult | null;
|
|
14
28
|
|
|
15
|
-
export { changeSurface };
|
|
29
|
+
export { type ChangeSurfaceEntry, type ChangeSurfaceResult, changeSurface };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-GAQGJ52J.js";import"../chunk-DFK54IRN.js";import"../chunk-QAEDNTY7.js";import"../chunk-NKJKI6SE.js";import"../chunk-IODTPF5H.js";import"../chunk-ARBZM2NF.js";import"../chunk-JB4PUN5S.js";import"../chunk-7O4MJYIW.js";import"../chunk-ZNUPGRPR.js";import"../chunk-RCJEFQOK.js";import"../chunk-BOVNTAKQ.js";import"../chunk-KJ6CW6EK.js";import"../chunk-7OX2O53H.js";import"../chunk-5TT47UMX.js";import"../chunk-NHDPYW7O.js";import"../chunk-NN3O7TPH.js";export{a as changeSurface};
|
|
2
2
|
//# sourceMappingURL=change-surface.js.map
|
package/dist/queries/code.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
import { S as ScipDatabase
|
|
1
|
+
import { S as ScipDatabase } from '../db-DdTPetj5.js';
|
|
2
2
|
import 'better-sqlite3';
|
|
3
|
+
import '../config-types-CGIeLEpY.js';
|
|
3
4
|
|
|
5
|
+
interface CodeResult {
|
|
6
|
+
symbol: string;
|
|
7
|
+
shortName: string;
|
|
8
|
+
relativePath: string;
|
|
9
|
+
startLine: number;
|
|
10
|
+
endLine: number;
|
|
11
|
+
language: string | null;
|
|
12
|
+
source: string;
|
|
13
|
+
}
|
|
4
14
|
/**
|
|
5
15
|
* Read the source code for a symbol, bounded to its definition range.
|
|
6
16
|
* Language-agnostic: just reads the file and extracts the relevant lines.
|
|
@@ -14,4 +24,4 @@ declare function code(db: ScipDatabase, symbolPattern: string, opts?: {
|
|
|
14
24
|
context?: number;
|
|
15
25
|
}): CodeResult | null;
|
|
16
26
|
|
|
17
|
-
export { code };
|
|
27
|
+
export { type CodeResult, code };
|
package/dist/queries/code.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-2IYEIFPP.js";import"../chunk-DFK54IRN.js";import"../chunk-ZNUPGRPR.js";import"../chunk-7OX2O53H.js";import"../chunk-5TT47UMX.js";import"../chunk-NHDPYW7O.js";import"../chunk-NN3O7TPH.js";export{a as code};
|
|
2
2
|
//# sourceMappingURL=code.js.map
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
-
import { S as ScipDatabase
|
|
1
|
+
import { S as ScipDatabase } from '../db-DdTPetj5.js';
|
|
2
2
|
import 'better-sqlite3';
|
|
3
|
+
import '../config-types-CGIeLEpY.js';
|
|
3
4
|
|
|
5
|
+
interface ComplexityHotspot {
|
|
6
|
+
symbol: string;
|
|
7
|
+
shortName: string;
|
|
8
|
+
file: string;
|
|
9
|
+
startLine: number;
|
|
10
|
+
endLine: number;
|
|
11
|
+
loc: number;
|
|
12
|
+
fanIn: number;
|
|
13
|
+
fanOut: number;
|
|
14
|
+
calleeCount: number;
|
|
15
|
+
score: number;
|
|
16
|
+
}
|
|
4
17
|
/**
|
|
5
18
|
* Find complexity hotspots: symbols with a composite score based on
|
|
6
19
|
* LOC, fan-in, fan-out, and callee count.
|
|
@@ -20,4 +33,4 @@ declare function complexityHotspots(db: ScipDatabase, opts?: {
|
|
|
20
33
|
semantic?: boolean;
|
|
21
34
|
}): ComplexityHotspot[];
|
|
22
35
|
|
|
23
|
-
export { complexityHotspots };
|
|
36
|
+
export { type ComplexityHotspot, complexityHotspots };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-FD37DBTD.js";import"../chunk-V76FCF5F.js";import"../chunk-MX6F756F.js";import"../chunk-QAEDNTY7.js";import"../chunk-NKJKI6SE.js";import"../chunk-IODTPF5H.js";import"../chunk-ARBZM2NF.js";import"../chunk-JB4PUN5S.js";import"../chunk-7O4MJYIW.js";import"../chunk-ZNUPGRPR.js";import"../chunk-RCJEFQOK.js";import"../chunk-BOVNTAKQ.js";import"../chunk-KJ6CW6EK.js";import"../chunk-7OX2O53H.js";import"../chunk-5TT47UMX.js";import"../chunk-NHDPYW7O.js";import"../chunk-NN3O7TPH.js";export{a as complexityHotspots};
|
|
2
2
|
//# sourceMappingURL=complexity-hotspots.js.map
|
|
@@ -1,6 +1,23 @@
|
|
|
1
|
-
import { S as ScipDatabase
|
|
1
|
+
import { S as ScipDatabase } from '../db-DdTPetj5.js';
|
|
2
2
|
import 'better-sqlite3';
|
|
3
|
+
import '../config-types-CGIeLEpY.js';
|
|
3
4
|
|
|
5
|
+
interface ComplexityResult {
|
|
6
|
+
symbol: string;
|
|
7
|
+
shortName: string;
|
|
8
|
+
relativePath: string;
|
|
9
|
+
startLine: number;
|
|
10
|
+
endLine: number;
|
|
11
|
+
loc: number;
|
|
12
|
+
/** Branch count from source-level regex (if, else, for, while, switch, catch, ternary, &&, ||) */
|
|
13
|
+
branches: number;
|
|
14
|
+
/** Cyclomatic complexity estimate: branches + 1 */
|
|
15
|
+
cyclomaticEstimate: number;
|
|
16
|
+
/** Number of distinct callees within the definition */
|
|
17
|
+
calleeCount: number;
|
|
18
|
+
fanIn: number;
|
|
19
|
+
fanOut: number;
|
|
20
|
+
}
|
|
4
21
|
/**
|
|
5
22
|
* Per-symbol complexity analysis combining source-level branch counting
|
|
6
23
|
* with index-level metrics (fan-in, fan-out, callee count).
|
|
@@ -12,4 +29,4 @@ declare function complexity(db: ScipDatabase, symbolPattern: string, opts?: {
|
|
|
12
29
|
semantic?: boolean;
|
|
13
30
|
}): ComplexityResult | null;
|
|
14
31
|
|
|
15
|
-
export { complexity };
|
|
32
|
+
export { type ComplexityResult, complexity };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-33SSUPCB.js";import"../chunk-QAEDNTY7.js";import"../chunk-NKJKI6SE.js";import"../chunk-IODTPF5H.js";import"../chunk-ARBZM2NF.js";import"../chunk-JB4PUN5S.js";import"../chunk-7O4MJYIW.js";import"../chunk-ZNUPGRPR.js";import"../chunk-RCJEFQOK.js";import"../chunk-BOVNTAKQ.js";import"../chunk-KJ6CW6EK.js";import"../chunk-7OX2O53H.js";import"../chunk-5TT47UMX.js";import"../chunk-NHDPYW7O.js";import"../chunk-NN3O7TPH.js";export{a as complexity};
|
|
2
2
|
//# sourceMappingURL=complexity.js.map
|
|
@@ -1,6 +1,26 @@
|
|
|
1
|
-
import { S as ScipDatabase
|
|
1
|
+
import { S as ScipDatabase } from '../db-DdTPetj5.js';
|
|
2
2
|
import 'better-sqlite3';
|
|
3
|
+
import '../config-types-CGIeLEpY.js';
|
|
3
4
|
|
|
5
|
+
interface ConvergenceResult {
|
|
6
|
+
symbolA: {
|
|
7
|
+
symbol: string;
|
|
8
|
+
shortName: string;
|
|
9
|
+
file: string;
|
|
10
|
+
loc: number;
|
|
11
|
+
};
|
|
12
|
+
symbolB: {
|
|
13
|
+
symbol: string;
|
|
14
|
+
shortName: string;
|
|
15
|
+
file: string;
|
|
16
|
+
loc: number;
|
|
17
|
+
};
|
|
18
|
+
similarity: number;
|
|
19
|
+
sharedCallees: string[];
|
|
20
|
+
uniqueToA: string[];
|
|
21
|
+
uniqueToB: string[];
|
|
22
|
+
consolidationStrategy: string;
|
|
23
|
+
}
|
|
4
24
|
/**
|
|
5
25
|
* Given two similar symbols, show what a consolidated version would look like.
|
|
6
26
|
* The shared callee set becomes the common body. The unique callees become
|
|
@@ -10,4 +30,4 @@ declare function convergence(db: ScipDatabase, symbolPatternA: string, symbolPat
|
|
|
10
30
|
semantic?: boolean;
|
|
11
31
|
}): ConvergenceResult | null;
|
|
12
32
|
|
|
13
|
-
export { convergence };
|
|
33
|
+
export { type ConvergenceResult, convergence };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-KJ3ZJIE5.js";import"../chunk-ARBZM2NF.js";import"../chunk-JB4PUN5S.js";import"../chunk-7O4MJYIW.js";import"../chunk-ZNUPGRPR.js";import"../chunk-RCJEFQOK.js";import"../chunk-BOVNTAKQ.js";import"../chunk-KJ6CW6EK.js";import"../chunk-7OX2O53H.js";import"../chunk-5TT47UMX.js";import"../chunk-NHDPYW7O.js";import"../chunk-NN3O7TPH.js";export{a as convergence};
|
|
2
2
|
//# sourceMappingURL=convergence.js.map
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { S as ScipDatabase
|
|
1
|
+
import { S as ScipDatabase } from '../db-DdTPetj5.js';
|
|
2
2
|
import 'better-sqlite3';
|
|
3
|
+
import '../config-types-CGIeLEpY.js';
|
|
3
4
|
|
|
5
|
+
interface CouplingResult {
|
|
6
|
+
file1: string;
|
|
7
|
+
file2: string;
|
|
8
|
+
sharedSymbols: number;
|
|
9
|
+
}
|
|
4
10
|
/**
|
|
5
11
|
* Measure coupling between two files: how many symbols do they share
|
|
6
12
|
* (symbols defined in one and referenced in the other, or vice versa).
|
|
@@ -14,4 +20,4 @@ declare function topCoupling(db: ScipDatabase, opts?: {
|
|
|
14
20
|
scope?: string;
|
|
15
21
|
}): CouplingResult[];
|
|
16
22
|
|
|
17
|
-
export { coupling, topCoupling };
|
|
23
|
+
export { type CouplingResult, coupling, topCoupling };
|
package/dist/queries/coupling.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a,b}from"../chunk-
|
|
1
|
+
import{a,b}from"../chunk-ZXFTC5ET.js";import"../chunk-DFK54IRN.js";import"../chunk-ZNUPGRPR.js";import"../chunk-7OX2O53H.js";import"../chunk-5TT47UMX.js";import"../chunk-NHDPYW7O.js";import"../chunk-NN3O7TPH.js";export{a as coupling,b as topCoupling};
|
|
2
2
|
//# sourceMappingURL=coupling.js.map
|