scip-query 0.6.7 → 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-KQWFRAQI.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-ZNNCDAYX.js → chunk-3OUC276S.js} +2 -2
- package/dist/{chunk-PQTGBYXV.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-HTJ5BOYP.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-2CC7RA6B.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-2R7OKZE5.js → chunk-KNA6Z7JB.js} +3 -3
- package/dist/{chunk-FYO3FPFH.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-TYRPQE6R.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-2YA36CXK.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-ILQSK2KJ.js → chunk-WODJHE6Z.js} +3 -3
- package/dist/{chunk-RRWPHKZA.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-OCQN6WF4.js → chunk-ZXFTC5ET.js} +4 -4
- package/dist/cli.js +361 -505
- 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 +109 -336
- 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 +14 -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 +22 -3
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +19 -3
- 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 +16 -2
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +22 -3
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.d.ts +25 -3
- 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 +35 -3
- 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 +19 -2
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.d.ts +20 -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 +19 -4
- 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 +13 -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 +15 -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 +10 -3
- 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 +18 -2
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +24 -2
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +17 -2
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +37 -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 +21 -3
- package/dist/queries/trace.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +15 -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-2AUZ3PLO.js +0 -2
- package/dist/chunk-3A2M7AF3.js +0 -4
- package/dist/chunk-3EJRPTTB.js +0 -2
- package/dist/chunk-3SWWYJPB.js +0 -6
- package/dist/chunk-4M4FEWBL.js +0 -7
- package/dist/chunk-4Y6KUJDO.js +0 -39
- package/dist/chunk-55ZJ2FCW.js +0 -6
- package/dist/chunk-6FLGPRBR.js +0 -5
- package/dist/chunk-6XRB6ATD.js +0 -16
- package/dist/chunk-7EQ4J66C.js +0 -2
- package/dist/chunk-7TGEXAN5.js +0 -25
- package/dist/chunk-ABLXPGAZ.js +0 -2
- package/dist/chunk-BG7YU4DJ.js +0 -2
- package/dist/chunk-D2R6IIEO.js +0 -2
- package/dist/chunk-E47WMJ5F.js +0 -2
- package/dist/chunk-EEA3R37V.js +0 -11
- package/dist/chunk-FAN2CVZT.js +0 -2
- package/dist/chunk-FVH3Y44U.js +0 -1
- package/dist/chunk-G47V5V3U.js +0 -90
- package/dist/chunk-GS55K4WJ.js +0 -85
- package/dist/chunk-H4DXD2FB.js +0 -5
- package/dist/chunk-HADDFTMU.js +0 -2
- package/dist/chunk-IARIBTCL.js +0 -2
- package/dist/chunk-IBWYWAWE.js +0 -70
- package/dist/chunk-JVMXNDRU.js +0 -2
- package/dist/chunk-K345WFTU.js +0 -2
- package/dist/chunk-K6ULLR7M.js +0 -19
- package/dist/chunk-KAM4C6ZD.js +0 -4
- package/dist/chunk-KCC3GMCX.js +0 -2
- package/dist/chunk-KRVRD6KZ.js +0 -5
- package/dist/chunk-KYGNCIJ6.js +0 -84
- package/dist/chunk-LHLXHH43.js +0 -2
- package/dist/chunk-LJ2YWNQF.js +0 -2
- package/dist/chunk-M7GBLQG4.js +0 -7
- package/dist/chunk-MEVK6R7N.js +0 -2
- package/dist/chunk-QRYEOK3M.js +0 -2
- package/dist/chunk-QYWGC7JV.js +0 -114
- package/dist/chunk-R373SHXM.js +0 -2
- package/dist/chunk-RUAJV3TN.js +0 -2
- package/dist/chunk-S57GUI2T.js +0 -7
- package/dist/chunk-SVUVC5VS.js +0 -2
- package/dist/chunk-T426XELO.js +0 -12
- package/dist/chunk-TBJDUS4E.js +0 -71
- package/dist/chunk-TX7BHRMT.js +0 -2
- package/dist/chunk-WPY46NIL.js +0 -5
- package/dist/chunk-X3Z4KZNX.js +0 -2
- package/dist/db-DdlToIC-.d.ts +0 -835
- 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 Ai}from"./chunk-ILQSK2KJ.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=gt(t,n);if(!r)return!1;try{return e.ignores(r)}catch{return!1}}function gt(e,t){if(!t||t===".")return null;if(!pe(t)&&!t.startsWith(".."))return t.replaceAll("\\","/");let n=pe(t)?t:ut(e,t),r=at(e,n).replaceAll("\\","/");return!r||r==="."||r.startsWith("..")?null:r}import{execFile as kr,execFileSync as Pr}from"child_process";import{closeSync as wr,existsSync as y,mkdirSync as Ue,mkdtempSync as Cr,openSync as Er,readFileSync as Or,renameSync as v,rmSync as R,writeFileSync as He}from"fs";import{cpus as Tr}from"os";import{basename as W,dirname as b,extname as Dr,join as p}from"path";import{execFileSync as k}from"child_process";import{platform as O,arch as dt}from"os";var me=O()==="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 pt(){try{return k(me?"where":"which",["scip"],{stdio:"pipe"}),!0}catch{return!1}}function ft(){try{return k("scip",["--version"],{stdio:"pipe"}).toString().trim()}catch{return null}}function mt(){let e=O(),t=dt(),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 ht(){let e=mt();console.log("\nThe `scip` CLI is required but not found on PATH.\n"),O()==="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 T(e){if(O()==="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 bt from"better-sqlite3";import{execFileSync as yt}from"child_process";import{existsSync as xt,readdirSync as St,readFileSync as vt}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(!xt(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let n=I(e.projectRoot),r=Rt(e.projectRoot,t).filter(s=>!n.isIgnored(s)),i=new bt(e.dbPath);try{let s=kt(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=vt(be(e.projectRoot,d),"utf-8"),Ze=o.run(Pt(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 Rt(e,t){let n=It(e,t);if(n)return n;let r=[],i=s=>{let o=s?be(e,s):e,a;try{a=St(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 It(e,t){try{return yt("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 kt(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 Pt(e){return D(e).toLowerCase()===".vue"?"vue":D(e).replace(/^\./,"").toLowerCase()||"source"}import{execFileSync as wt}from"child_process";import{existsSync as Ct,readdirSync as xe}from"fs";import{extname as Se,join as ve}from"path";var Et=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=Tt(e),r=Nt(e);for(let i of Ot){if(Dt(e,i.files)){t.push(i.language);continue}if(Lt(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 Tt(e){try{return xe(e)}catch{return[]}}function Dt(e,t){return t?.length?t.some(n=>Ct(ve(e,n))):!1}function Lt(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 Nt(e){let t=jt(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()){Et.has(o.name)||r.push(a);continue}let u=Se(o.name).toLowerCase();u&&n.add(u)}}return n}function jt(e){try{let t=wt("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 _t}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=_t(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 At,writeFileSync as Vt}from"fs";import{create as K}from"@bufbuild/protobuf";import{deserializeSCIP as $t,serializeSCIP as Bt,DocumentSchema as Wt,IndexSchema as Ut,SymbolInformationSchema as Ht}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=Gt(e),n=qt(e.flatMap(i=>i.documents??[])),r=ke(e.flatMap(i=>i.externalSymbols??[]));return K(Ut,{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=>$t(At(i))),r=Q(n);return Vt(t,Buffer.from(Bt(r))),{documentCount:r.documents.length,externalSymbolCount:r.externalSymbols.length,inputCount:e.length}}function Gt(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 qt(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(Wt,{language:r.language||n.language,relativePath:r.relativePath||n.relativePath,occurrences:[...r.occurrences,...n.occurrences],symbols:ke([...r.symbols,...n.symbols]),text:zt(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(Ht,{symbol:r.symbol,documentation:Xt([...r.documentation,...n.documentation]),relationships:Jt([...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 Jt(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 zt(e,t){return e?t?e.length>=t.length?e:t:e:t}function Xt(e){return[...new Set(e)]}import{execFileSync as Kt}from"child_process";import{createHash as Qt}from"crypto";import{readdirSync as Yt,readFileSync as Zt}from"fs";import{join as Pe}from"path";function en(e){return(tn(e)??nn(e)).filter(t=>t&&!we(t)).sort()}function j(e){return en(e).map(t=>{let n=Pe(e,t);try{let r=Zt(n);return{path:t,size:r.byteLength,hash:Qt("sha256").update(r).digest("hex")}}catch{return{path:t,size:-1,hash:"unreadable"}}})}function tn(e){try{return Kt("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 nn(e){let t=[],n=[""];for(;n.length>0;){let r=n.pop(),i=r?Pe(e,r):e,s;try{s=Yt(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=>rn.has(n))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var rn=new Set([".git","node_modules",".scipquery-cache",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]);import{readFileSync as sn,writeFileSync as on}from"fs";import{create as Ce}from"@bufbuild/protobuf";import{deserializeSCIP as an,DocumentSchema as un,IndexSchema as cn,serializeSCIP as ln,SymbolRole as gn}from"@c4312/scip";function Ee(e){let t;try{t=an(sn(e))}catch{return{removedDefinitionOccurrences:0,touchedDocuments:0}}let n=dn(t);return n.removedDefinitionOccurrences>0&&on(e,Buffer.from(ln(n.index))),{removedDefinitionOccurrences:n.removedDefinitionOccurrences,touchedDocuments:n.touchedDocuments}}function dn(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&gn.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(un,{language:s.language,relativePath:s.relativePath,occurrences:o,symbols:s.symbols,text:s.text,positionEncoding:s.positionEncoding}))}return{index:n===0?e:Ce(cn,{metadata:e.metadata,documents:i,externalSymbols:e.externalSymbols}),removedDefinitionOccurrences:n,touchedDocuments:r}}import{execFileSync as _}from"child_process";import{existsSync as Y,readFileSync as pn}from"fs";import{createRequire as fn}from"module";import{platform as Te}from"os";import{dirname as Oe,join as M}from"path";var mn=fn(import.meta.url),hn=Te()==="win32";function h(e){let t=hn?"where":"which";try{return _(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 yn(e)}function V(e){return P(e)!==null||bn(e)}function bn(e){return De(e)!==null}function yn(e){let t=De(e);if(!t)return null;let r=JSON.parse(pn(t,"utf8")).bin;if(!r)return null;if(typeof r=="string")return M(Oe(t),r);for(let i of Z(e)){let s=r[i];if(s)return M(Oe(t),s)}return null}function De(e){if(!e.bundledNpmPackage)return null;try{return mn.resolve(`${e.bundledNpmPackage}/package.json`)}catch{return null}}function ee(e,t){for(let n of e.projectLocalBinaries??[]){let r=M(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=xn(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{_(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 xn(e,t){for(let n of Sn(t))if(Le(e,{...t,DOTNET_ROOT:n}))return n;return null}function Sn(e){let t=[],n=e.DOTNET_ROOT;if(n&&Y(n)&&t.push(n),Te()==="darwin"&&h("brew"))try{let r=_("brew",["--prefix","dotnet@9"],{stdio:"pipe",env:e}).toString().trim(),i=M(r,"libexec");Y(i)&&!t.includes(i)&&t.push(i)}catch{}return t}function Le(e,t){try{return _(e,["--version"],{stdio:"pipe",env:t}),!0}catch{return!1}}import vn from"better-sqlite3";import{createRequire as Rn}from"module";import{existsSync as Ne,mkdtempSync as In,readFileSync as w,rmSync as kn,statSync as Pn,writeFileSync as wn}from"fs";import{cpus as Cn,tmpdir as En}from"os";import{dirname as re,extname as On,join as S,relative as Tn,resolve as je}from"path";import{pathToFileURL as Dn}from"url";import{Worker as Ln}from"worker_threads";function Me(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 vn(e.dbPath);try{let r=er(n,e.projectRoot),i=S(re(e.dbPath),"augment-vue-meta.json"),s=Fe(n,e.projectRoot,e.tsconfig),o=Fn(i,s,e.onStatus);if(o)return o;let a=cr(n,e.projectRoot,r),u=Nn(n,e,t,r,a),c=pr(u.occurrences),g=jn(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 An(i,Fe(n,e.projectRoot,e.tsconfig),l),l}finally{n.close()}}function Fn(e,t,n){let r=_n(e,t);return r&&n?.(`Vue references unchanged; reused ${r.resolvedReferences} cached resolved references.`),r}function Nn(e,t,n,r,i){if(qn(r))return Jn({projectRoot:t.projectRoot,dbPath:t.dbPath,tsconfig:t.tsconfig,vueFiles:r});let s=xr(),o=tr(t.projectRoot,n);return Vn({projectRoot:t.projectRoot,vueFiles:o.fileNames.filter(a=>a.endsWith(".vue")),context:o,symbolLookup:or(e,t.projectRoot,s),vueSymbolLookup:i,sourceCache:s})}function jn(e,t,n,r,i){return lr(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 _n(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 An(e,t,n){wn(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 Vn(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=$n(e,i);t.push(...s.occurrences),n+=s.skippedReferences}return{occurrences:t,skippedReferences:n}}function $n(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=[...mr(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:Un(a),processedStarts:new Set};return Bn({...e,fileName:t.fileName,sourceInfo:i,sourceFile:o,map:s,tokenContext:u})}function Bn(e){let t=[],n=0;for(let r of e.tokenContext.tokens){if(e.tokenContext.processedStarts.has(r.start))continue;let i=hr(e.map,r.start);if(i===null)continue;let o=(e.context.languageService.getDefinitionAtPosition(e.fileName,i+1)??[]).find(u=>!br(e.projectRoot,u.fileName));if(!o){n++;continue}let a=dr(o,e.symbolLookup,e.vueSymbolLookup,e.context,e.projectRoot);if(a===null){n++;continue}_e(t,e.sourceInfo,e.sourceFile,r,a),e.tokenContext.processedStarts.add(r.start),Wn(t,e,r,i,a)}return{occurrences:t,skippedReferences:n}}function Wn(e,t,n,r,i){if(!((t.tokenContext.tokenTextCounts.get(n.text)??0)<=1))for(let s of Hn(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&&(_e(e,t.sourceInfo,t.sourceFile,o,i),t.tokenContext.processedStarts.add(s))}}function _e(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 Un(e){let t=new Map;for(let n of e)t.set(n.text,(t.get(n.text)??0)+1);return t}function Hn(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=Gn(r,c.textSpan.start,s,i.text);g!==null&&a.push(g)}return a}function Gn(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 qn(e){return e.length>=8&&Ae(e.length)>1}function Jn(e){let t=Ae(e.vueFiles.length),n=Xn(e.vueFiles),r=Qn(n,t),i=new URL("./augment-vue-worker.js",import.meta.url),s=In(S(En(),"scip-query-vue-workers-")),o=new SharedArrayBuffer(4),a=new Int32Array(o),u=zn(),c=Date.now();try{for(let l=0;l<r.length;l++)new Ln(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{kn(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,Cn().length-1));return Math.max(1,Math.min(e,n))}function zn(){let e=Number(process.env.SCIP_QUERY_AUGMENT_VUE_WORKER_TIMEOUT_MS??0);return Number.isFinite(e)&&e>0?e:3e5}function Xn(e){let t=Kn(),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 Kn(){return Number.POSITIVE_INFINITY}function Qn(e,t){let n=Array.from({length:t},()=>({tasks:[],weight:0})),r=e.map(i=>({task:i,weight:Yn(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 Yn(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 Pn(e).size}catch{return 1}}function Zn(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 er(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 tr(e,t){let{vueCore:n,ts:r,volarTs:i}=nr(e),{parsed:s,vueOptions:o}=rr(n,r,t),a=re(t),u=n.createVueLanguagePlugin(r,s.options,o,f=>f),c=ir(n,r,u),g=sr(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 nr(e){let t=Rn(Dn(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 rr(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 ir(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)??yr(s))});return r.current=i,i}function sr(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 or(e,t,n){let r=ar(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:ur(u.starts,a.line,2)}}function ar(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 ur(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 cr(e,t,n){let r=Rr(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=Ir(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 lr(e,t,n,r,i){return e.transaction(()=>(Zn(e),gr(e,t,n,r),fr(e,i)))()}function gr(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 dr(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 pr(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 fr(e,t){let n=vr(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*mr(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 hr(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 br(e,t){return C(e,t).startsWith("node_modules/")}function C(e,t){return Tn(e,t).replaceAll("\\","/")}function yr(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 xr(){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:Sr(n)};return e.set(t,r),r}catch{return e.set(t,null),null}}}function Sr(e){let t=[0];for(let n=0;n<e.length;n++)e.charCodeAt(n)===10&&t.push(n+1);return t}function vr(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 Rr(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 Ir(e,t,n){let r=n.split("/").map(i=>`\`${i.replaceAll("`","")}\``).join("/");return`scip-vue npm ${e} ${t} ${r}/default.`}async function Lr(e){let{projectRoot:t,maxHeapMb:n=8192,onStatus:r=console.log,skipAutoInstall:i=!1}=e,s=Fr(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=ni(t,a,{pnpmWorkspaces:e.pnpmWorkspaces}),c=Kr(p(b(s.outputDb),"index.lock")),g=null;try{let l=Nr({opts:e,paths:s,languages:a,fingerprint:u,start:o,onStatus:r});if(l)return l;Vr(i,r);let d=jr(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 Fr(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 Nr(e){if(e.opts.skipIfUnchanged===!1||!y(e.paths.outputScip)||!y(e.paths.outputDb)||!ri(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 jr(e){let t=Cr(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 _r(e,t);Ar(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 _r(e,t){let{preparedRuns:n,skippedLanguages:r}=$r({languages:e.languages,tempOutputScip:e.tempPaths.tempOutputScip,projectRoot:e.projectRoot,env:t,skipAutoInstall:e.skipAutoInstall,pnpmWorkspaces:e.opts.pnpmWorkspaces,onStatus:e.onStatus}),i=await Zr(n,e.projectRoot,e.onStatus,e.opts.indexerConcurrency),{indexedOutputs:s}=Wr(i,r);return Ur(s,r,e.languages,e.opts.allowPartial,e.onStatus),{indexedOutputs:s,skippedLanguages:r}}function Ar(e,t,n,r){Hr(n,e.tempPaths.tempOutputScip,e.onStatus),Gr(e.tempPaths.tempOutputScip,e.tempPaths.tempOutputDb,t,e.onStatus),m({projectRoot:e.projectRoot,dbPath:e.tempPaths.tempOutputDb,onStatus:e.onStatus}),ii(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]}),Qr({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 Vr(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..."),!T(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 $r(e){let t=[],n=[],r=e.languages.map((i,s)=>({language:i,scipPath:e.languages.length>1?Xr(e.tempOutputScip,i,s):e.tempOutputScip}));for(let{language:i,scipPath:s}of r){let o=Br({...e,language:i,scipPath:s});"skipped"in o?n.push(o.skipped):t.push(o.prepared)}return{preparedRuns:t,skippedLanguages:n}}function Br(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 Wr(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 Ur(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 Hr(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 Gr(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.`),Pr("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 qr(e,t,n){if(!e.defaultOutputPath)return;let r=p(t,e.defaultOutputPath);n!==r&&y(r)&&v(r,n)}function Jr(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 zr(e){e&&(R(e.defaultOutputPath,{force:!0}),e.backupPath&&y(e.backupPath)&&v(e.backupPath,e.defaultOutputPath))}function Xr(e,t,n){let r=Dr(e)||".scip",i=W(e,r);return p(b(e),`${i}.${n+1}.${t}${r}`)}function Kr(e){let t;try{t=Er(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{wr(t)}finally{R(e,{force:!0})}}}function Qr(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 Yr(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,Tr().length-1));return Math.max(1,Math.min(e,Math.floor(r)))}async function Zr(e,t,n,r){let i=e.filter(c=>c.config.defaultOutputPath),s=e.filter(c=>!c.config.defaultOutputPath),o=[],a=Yr(s.length,r),u=await ti(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=Jr(e.config,t,e.scipPath);try{await ei(e.binary,e.args,{cwd:t,env:e.env,maxBuffer:50*1024*1024}),qr(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{zr(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 ei(e,t,n){return new Promise((r,i)=>{kr(e,[...t],n,s=>{s?i(s):r()})})}async function ti(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 ni(e,t,n){return{version:1,languages:[...t].sort(),pnpmWorkspaces:n.pnpmWorkspaces===!0,files:j(e)}}function ri(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 ii(e,t){He(e,`${JSON.stringify(t,null,2)}
|
|
146
|
-
`)}function B(e){return JSON.stringify(e)}import{readFileSync as si,writeFileSync as oi,existsSync as qe,mkdirSync as ai}from"fs";import{join as x,resolve as Ge}from"path";import{createHash as ui}from"crypto";import{homedir as ci}from"os";var Je=".scipquery.json",li={enabled:!1,debounceMs:3e4,cooldownMs:6e4,ignore:[]};function gi(e){let t=x(e,Je);if(!qe(t))return{};try{let n=si(t,"utf-8");return JSON.parse(n)}catch{return{}}}function ze(e){return{...li,...e.watch}}function di(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(ci(),".cache"),s=ui("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=di(e,t);return{cacheDir:n,dbPath:x(n,"index.db"),indexPath:x(n,"index.scip"),metaPath:x(n,"meta.json")}}function pi(e,t){let n=x(e,Je);return qe(n)||oi(n,JSON.stringify({languages:t,watch:{enabled:!1,debounceMs:3e4,cooldownMs:6e4}},null,2)+`
|
|
147
|
-
`),n}function oe(e){return ai(e,{recursive:!0}),e}import{watch as fi}from"fs";import{existsSync as Xe,renameSync as Ke}from"fs";import{join as mi,relative as hi}from"path";import{fork as bi}from"child_process";import yi 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=yi(),this.watchConfig.ignore.length>0&&this.extraIgnore.add(this.watchConfig.ignore)}start(){this.stopped=!1,this.setStatus({state:"idle"});try{let t=fi(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=hi(this.projectRoot,mi(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=xi(this.indexPaths.indexPath),o=bi(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 xi(e){return e.endsWith(".scip")?e.slice(0,-5)+".tmp.scip":e+".tmp.scip"}import{existsSync as ce,mkdirSync as Si,symlinkSync as vi,readlinkSync as Ri,unlinkSync as Ii}from"fs";import{join as U,dirname as Qe,resolve as le}from"path";import{homedir as Ye,platform as ki}from"os";import{fileURLToPath as Pi}from"url";var wi=ki()==="win32",Ci=["concrete-plan","scip-explore","scip-debloat","scip-verify","scip-language-playbook"];function Ei(e={}){let t=e.quiet?()=>{}:console.log,n=Pi(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;Si(o,{recursive:!0});let u=o.includes(".codex")?"Codex":"Claude";for(let c of Ci){let g=U(r,c),l=U(o,c);if(!ce(g)){s.skipped.push(`${u}/${c}`);continue}if(ce(l)){try{let d=Ri(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}Ii(l)}vi(g,l,wi?"junction":"dir"),s.installed.push(`${u}/${c}`),t(` done: ${c} \u2192 ${u}`)}}return s}export{Rs as HEALTH_PHASES,X as INDEXER_CONFIGS,rt as ProjectIndex,H as ScipDatabase,ue as Watcher,gs as affected,m as augmentAuxiliaryDocuments,Me as augmentVueResolvedReferences,Zi as bottlenecks,ts as byKind,ss as callGraph,ds as changeSurface,Cs as code,Es as complexity,vs as complexityHotspots,ws as convergence,Ki as coupling,I as createGitignoreFilter,Yi as cycles,Os as dataflow,Vi as dead,rs as deepChains,ji as deps,L as detectLanguages,ps as diffImpact,ms as diffImpactPartial,fs as diffImpactPlan,bs as drift,ls as extractCandidates,qi as fanIn,Ji as fanOut,Ti as files,F as getIndexerConfig,ft as getScipVersion,Is as health,ks as healthPhase,Ps as healthReportFromPhases,is as hierarchy,$i as hotspots,Wi as importedBy,Bi as imports,pi as initProjectConfig,Ei as installSkills,h as isBinaryAvailable,V as isIndexerInstalled,pt as isScipInstalled,es as isolated,ns as kindCounts,nt as leafName,gi as loadProjectConfig,Gi as members,hs as mergeDiffImpactPartials,N as mergeScipFiles,Q as mergeScipIndexes,Li as methods,Hi as outline,et as parseSymbol,xs as passthroughCandidates,ht as printScipInstallInstructions,Mi as rdeps,Ds as redundantReexports,Fi as refs,Lr as reindex,ae as resolveIndexPaths,tt as shortenSymbol,os as similar,as as similarAll,cs as similarChains,us as similarFiles,Ls as similarSignatures,Ts as slice,Ss as staleAbstractions,Oi as stats,Ai as surface,Di as symbols,_i as system,Qi as topCoupling,zi as topFanIn,Xi as topFanOut,Ni as trace,$ as tryInstallIndexer,T as tryInstallScipCli,Ui as unusedImports,ys 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).
|
|
@@ -13,6 +23,8 @@ declare function bottlenecks(db: ScipDatabase, opts?: {
|
|
|
13
23
|
scope?: string;
|
|
14
24
|
minFanIn?: number;
|
|
15
25
|
minFanOut?: number;
|
|
26
|
+
scanLimit?: number;
|
|
27
|
+
semantic?: boolean;
|
|
16
28
|
}): BottleneckResult[];
|
|
17
29
|
|
|
18
|
-
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).
|
|
@@ -8,6 +25,8 @@ import 'better-sqlite3';
|
|
|
8
25
|
* Incoming: other symbols whose definition ranges contain a reference to this symbol.
|
|
9
26
|
* Outgoing: symbols referenced within this symbol's definition range.
|
|
10
27
|
*/
|
|
11
|
-
declare function callGraph(db: ScipDatabase, symbolPattern: string
|
|
28
|
+
declare function callGraph(db: ScipDatabase, symbolPattern: string, opts?: {
|
|
29
|
+
semantic?: boolean;
|
|
30
|
+
}): CallGraphResult | null;
|
|
12
31
|
|
|
13
|
-
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.
|
|
@@ -8,6 +22,8 @@ import 'better-sqlite3';
|
|
|
8
22
|
* Symbol ranges come from getDefinitionsForFile so they are source-corrected
|
|
9
23
|
* and match `scip symbols` output.
|
|
10
24
|
*/
|
|
11
|
-
declare function changeSurface(db: ScipDatabase, filePattern: string
|
|
25
|
+
declare function changeSurface(db: ScipDatabase, filePattern: string, opts?: {
|
|
26
|
+
semantic?: boolean;
|
|
27
|
+
}): ChangeSurfaceResult | null;
|
|
12
28
|
|
|
13
|
-
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.
|
|
@@ -17,6 +30,7 @@ declare function complexityHotspots(db: ScipDatabase, opts?: {
|
|
|
17
30
|
minLoc?: number;
|
|
18
31
|
limit?: number;
|
|
19
32
|
scanLimit?: number;
|
|
33
|
+
semantic?: boolean;
|
|
20
34
|
}): ComplexityHotspot[];
|
|
21
35
|
|
|
22
|
-
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).
|
|
@@ -8,6 +25,8 @@ import 'better-sqlite3';
|
|
|
8
25
|
* Branch counting uses language-aware regex. The language is read from
|
|
9
26
|
* the SCIP documents table, so it works for any indexed language.
|
|
10
27
|
*/
|
|
11
|
-
declare function complexity(db: ScipDatabase, symbolPattern: string
|
|
28
|
+
declare function complexity(db: ScipDatabase, symbolPattern: string, opts?: {
|
|
29
|
+
semantic?: boolean;
|
|
30
|
+
}): ComplexityResult | null;
|
|
12
31
|
|
|
13
|
-
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,11 +1,33 @@
|
|
|
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
|
|
7
27
|
* the parameterization points.
|
|
8
28
|
*/
|
|
9
|
-
declare function convergence(db: ScipDatabase, symbolPatternA: string, symbolPatternB: string
|
|
29
|
+
declare function convergence(db: ScipDatabase, symbolPatternA: string, symbolPatternB: string, opts?: {
|
|
30
|
+
semantic?: boolean;
|
|
31
|
+
}): ConvergenceResult | null;
|
|
10
32
|
|
|
11
|
-
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
|