scip-query 0.6.3 → 0.6.5
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 +31 -29
- package/dist/augment-vue-worker.js +2 -0
- package/dist/chunk-2ZGHRI2A.js +5 -0
- package/dist/chunk-32R4VYYA.js +2 -0
- package/dist/chunk-3UB2DPLP.js +2 -0
- package/dist/chunk-4X7C236P.js +84 -0
- package/dist/chunk-5LQ6CVX3.js +2 -0
- package/dist/chunk-5YYMKE3G.js +70 -0
- package/dist/chunk-7LSCW7NF.js +6 -0
- package/dist/chunk-7X7FLQC5.js +2 -0
- package/dist/chunk-A5UNS4DR.js +4 -0
- package/dist/chunk-BNCTPTVX.js +2 -0
- package/dist/{chunk-TRBNQ273.js → chunk-C5BFS23M.js} +2 -2
- package/dist/{chunk-DM56ECPZ.js → chunk-DRLWW74T.js} +2 -2
- package/dist/chunk-EB5IVUNU.js +2 -0
- package/dist/{chunk-TPOYTT6O.js → chunk-ERRUE5G4.js} +4 -4
- package/dist/chunk-F4KR22Z2.js +2 -0
- package/dist/chunk-FG6A6ZUP.js +2 -0
- package/dist/chunk-FHSD5RKF.js +19 -0
- package/dist/chunk-FVVEIGP3.js +5 -0
- package/dist/chunk-GBDZY73J.js +2 -0
- package/dist/{chunk-4TYGGOLO.js → chunk-H4DXD2FB.js} +1 -1
- package/dist/chunk-HUASU3AD.js +71 -0
- package/dist/chunk-IJWIYZO5.js +2 -0
- package/dist/chunk-K6H3XJQW.js +7 -0
- package/dist/{chunk-KYT47WU2.js → chunk-KAM4C6ZD.js} +1 -1
- package/dist/{chunk-56LPZC3S.js → chunk-KTCODJNQ.js} +3 -3
- package/dist/chunk-LJ2YWNQF.js +2 -0
- package/dist/chunk-LT2CPEQ4.js +2 -0
- package/dist/chunk-M5QTG55L.js +2 -0
- package/dist/chunk-MKFH7QJG.js +7 -0
- package/dist/chunk-MO32JMOD.js +12 -0
- package/dist/chunk-MO65UK5V.js +6 -0
- package/dist/chunk-MTK3JAJT.js +2 -0
- package/dist/{chunk-6TRXTRCW.js → chunk-MXWC53GJ.js} +4 -4
- package/dist/{chunk-HLILTI7S.js → chunk-OQZF2DQJ.js} +3 -3
- package/dist/chunk-PBFMZKXE.js +6 -0
- package/dist/{chunk-MMKNCPHB.js → chunk-PFMGJ4BR.js} +4 -4
- package/dist/{chunk-5KWWENJZ.js → chunk-PK4U6NWP.js} +2 -2
- package/dist/{chunk-CH47OLNL.js → chunk-Q2ALKKSE.js} +4 -4
- package/dist/chunk-QFCK6WV2.js +39 -0
- package/dist/chunk-QFZE73XF.js +84 -0
- package/dist/chunk-QRYEOK3M.js +2 -0
- package/dist/{chunk-LORWXBOO.js → chunk-RKTDEIHF.js} +1 -1
- package/dist/chunk-ROWAEEOD.js +2 -0
- package/dist/chunk-RT5PV5JQ.js +7 -0
- package/dist/chunk-TLRA5TR6.js +2 -0
- package/dist/chunk-U5MVUPOO.js +2 -0
- package/dist/chunk-URUVLDM7.js +29 -0
- package/dist/chunk-WHGCGENP.js +16 -0
- package/dist/chunk-WIIZF5FP.js +2 -0
- package/dist/chunk-WNMAH3P7.js +2 -0
- package/dist/chunk-XV3XUZ3X.js +11 -0
- package/dist/chunk-YDKWDTAW.js +2 -0
- package/dist/{chunk-IUNRL2AQ.js → chunk-YDNCX5PF.js} +2 -2
- package/dist/chunk-YU25IHJX.js +90 -0
- package/dist/{chunk-VZE4SOJG.js → chunk-Z5CTXSWT.js} +3 -3
- package/dist/chunk-ZFCQQ4B5.js +2 -0
- package/dist/chunk-ZHHMG4UC.js +114 -0
- package/dist/cli.js +487 -388
- package/dist/{db-DKhNQ75l.d.ts → db-BZPa7dzJ.d.ts} +19 -9
- package/dist/index.d.ts +221 -13
- package/dist/index.js +45 -31
- package/dist/postinstall.js +1 -1
- package/dist/queries/affected.d.ts +1 -1
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.d.ts +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.d.ts +1 -1
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.d.ts +1 -1
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.d.ts +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/code.d.ts +1 -1
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.d.ts +1 -1
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.d.ts +1 -1
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.d.ts +1 -1
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.d.ts +1 -1
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.d.ts +1 -1
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.d.ts +1 -1
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.d.ts +1 -1
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deep-chains.d.ts +1 -1
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/deps.d.ts +1 -1
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-impact.d.ts +1 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/drift-policy.d.ts +6 -0
- package/dist/queries/drift-policy.js +2 -0
- package/dist/queries/drift.d.ts +1 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.d.ts +1 -1
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.d.ts +1 -1
- package/dist/queries/fan.js +1 -1
- package/dist/queries/files.d.ts +1 -1
- package/dist/queries/files.js +1 -1
- package/dist/queries/health.d.ts +1 -1
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +1 -1
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.d.ts +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.d.ts +1 -1
- package/dist/queries/imports.js +1 -1
- package/dist/queries/index.d.ts +1 -1
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +1 -1
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/members.d.ts +1 -1
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.d.ts +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/outline.d.ts +1 -1
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.d.ts +1 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/redundant-reexports.d.ts +1 -1
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.d.ts +1 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/similar-chains.d.ts +1 -1
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.d.ts +1 -1
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.d.ts +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +1 -1
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.d.ts +1 -1
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.d.ts +1 -1
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/stats.d.ts +1 -1
- package/dist/queries/stats.js +1 -1
- package/dist/queries/surface.d.ts +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.d.ts +1 -1
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.d.ts +1 -1
- package/dist/queries/system.js +1 -1
- package/dist/queries/trace.d.ts +1 -1
- package/dist/queries/trace.js +1 -1
- package/dist/queries/wrapper-candidates.d.ts +1 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +10 -63
- package/package.json +4 -2
- package/dist/chunk-2OXZVIED.js +0 -41
- package/dist/chunk-5IM4IQ6N.js +0 -2
- package/dist/chunk-5OV6CUTY.js +0 -2
- package/dist/chunk-6QXYWGE5.js +0 -10
- package/dist/chunk-C6PQLWHR.js +0 -7
- package/dist/chunk-DX5YEUX4.js +0 -6
- package/dist/chunk-DXXROCSQ.js +0 -19
- package/dist/chunk-EARGTC7U.js +0 -12
- package/dist/chunk-EJXPKSWV.js +0 -29
- package/dist/chunk-EUHHVFTI.js +0 -2
- package/dist/chunk-F2TGKDMW.js +0 -2
- package/dist/chunk-GSVIC6KN.js +0 -2
- package/dist/chunk-H4IWC7KJ.js +0 -89
- package/dist/chunk-H7BWAMFI.js +0 -4
- package/dist/chunk-HUEIPY4M.js +0 -5
- package/dist/chunk-ID7TO4P6.js +0 -65
- package/dist/chunk-J22I2FWD.js +0 -6
- package/dist/chunk-KOGVTPGE.js +0 -7
- package/dist/chunk-LUYN4IWJ.js +0 -2
- package/dist/chunk-MDUIJELV.js +0 -39
- package/dist/chunk-MSNW2AR2.js +0 -2
- package/dist/chunk-N3Z2SJCR.js +0 -2
- package/dist/chunk-NB3GIT4Z.js +0 -7
- package/dist/chunk-OBPP5RRE.js +0 -2
- package/dist/chunk-ORBQ3HJD.js +0 -2
- package/dist/chunk-P6IUCZA3.js +0 -24
- package/dist/chunk-Q2MCCKWZ.js +0 -2
- package/dist/chunk-QRULHDMO.js +0 -84
- package/dist/chunk-RAJHIEBM.js +0 -70
- package/dist/chunk-RKZBRDFK.js +0 -2
- package/dist/chunk-RPRIZ43D.js +0 -2
- package/dist/chunk-RXGCTLHY.js +0 -2
- package/dist/chunk-S6IGA6KK.js +0 -2
- package/dist/chunk-TVJMEDHH.js +0 -2
- package/dist/chunk-UDKLKBPQ.js +0 -2
- package/dist/chunk-UGUBEKK5.js +0 -2
- package/dist/chunk-VKYLXCV6.js +0 -2
- package/dist/chunk-VQXXSUQF.js +0 -8
- package/dist/chunk-VZHI3TUX.js +0 -6
- package/dist/chunk-YSEQFGGH.js +0 -2
package/dist/reindex-worker.js
CHANGED
|
@@ -1,66 +1,13 @@
|
|
|
1
|
-
import{d as
|
|
2
|
-
# Dependencies
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
.bundle/
|
|
6
|
-
|
|
7
|
-
# Build output
|
|
8
|
-
dist/
|
|
9
|
-
build/
|
|
10
|
-
out/
|
|
11
|
-
target/
|
|
12
|
-
bin/
|
|
13
|
-
obj/
|
|
14
|
-
|
|
15
|
-
# Python
|
|
16
|
-
__pycache__/
|
|
17
|
-
*.pyc
|
|
18
|
-
*.pyo
|
|
19
|
-
.venv/
|
|
20
|
-
venv/
|
|
21
|
-
.env/
|
|
22
|
-
env/
|
|
23
|
-
*.egg-info/
|
|
24
|
-
|
|
25
|
-
# Rust
|
|
26
|
-
target/
|
|
27
|
-
|
|
28
|
-
# Java / Kotlin / Scala
|
|
29
|
-
*.class
|
|
30
|
-
.gradle/
|
|
31
|
-
.mvn/
|
|
32
|
-
|
|
33
|
-
# C# / .NET
|
|
34
|
-
bin/
|
|
35
|
-
obj/
|
|
36
|
-
packages/
|
|
37
|
-
|
|
38
|
-
# Go
|
|
39
|
-
vendor/
|
|
40
|
-
|
|
41
|
-
# Dart
|
|
42
|
-
.dart_tool/
|
|
43
|
-
build/
|
|
44
|
-
|
|
45
|
-
# PHP
|
|
46
|
-
vendor/
|
|
47
|
-
|
|
48
|
-
# IDE / OS
|
|
49
|
-
.idea/
|
|
50
|
-
.vscode/
|
|
51
|
-
*.swp
|
|
52
|
-
*.swo
|
|
53
|
-
.DS_Store
|
|
54
|
-
Thumbs.db
|
|
55
|
-
|
|
56
|
-
# Type definitions (often noise in queries)
|
|
57
|
-
*.d.ts
|
|
58
|
-
`;function B(e,n,r){let t=je(n,r);if(!t)return!1;try{return e.ignores(t)}catch{return!1}}function je(e,n){if(!n||n===".")return null;if(!N(n)&&!n.startsWith(".."))return n.replaceAll("\\","/");let r=N(n)?n:Ce(e,n),t=Ie(e,r).replaceAll("\\","/");return!t||t==="."||t.startsWith("..")?null:t}import{readdirSync as Cn}from"fs";import{extname as kn,join as jn}from"path";function F(e){let n=new WeakMap,r=t=>{let i=n.get(t);return i||(i=new Map,n.set(t,i)),i};return{get(t,i,s){let a=r(t);if(a.has(i))return a.get(i);let l=s();return a.set(i,l),l},invalidate(t,i){n.get(t)?.delete(i)},invalidateAll(t){n.delete(t)},size(t){return n.get(t)?.size??0}}}var O=[".vue"],T=new Set(["node_modules",".git","target","dist","build",".next",".nuxt",".cache",".turbo","out","coverage",".scipquery-cache","__pycache__",".venv","venv",".idea",".vscode"]);var En=F("source-files");function V(e){let n=new Set((e.extensions??O).map(s=>s.toLowerCase()));if(n.size===0)return{scanned:0,inserted:0,existing:0};if(!Ee(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let r=M(e.projectRoot),t=Le(e.projectRoot,n).filter(s=>!r.isIgnored(s)),i=new De(e.dbPath);try{let s=t.length===0?new Set:new Set(i.prepare(`SELECT relative_path FROM documents WHERE relative_path IN (${t.map(()=>"?").join(",")})`).all(...t).map(f=>f.relative_path)),a=i.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
|
|
59
|
-
VALUES (?, ?, NULL, ?)`),c=i.transaction(f=>{let p=0;for(let u of f){if(s.has(u))continue;let v=_e(U(e.projectRoot,u),"utf-8"),o=a.run($e(u),u,v);p+=Number(o.changes)}return p})(t),h={scanned:t.length,inserted:c,existing:t.length-c};return e.onStatus?.(`Augmented SQLite documents with ${c} auxiliary source file${c===1?"":"s"} (${h.existing} already present).`),h}finally{i.close()}}function Le(e,n){let r=[],t=i=>{let s=i?U(e,i):e,a=[];try{a=we(s,{withFileTypes:!0})}catch{return}for(let l of a){if(T.has(l.name))continue;let c=i?`${i}/${l.name}`:l.name;if(l.isDirectory()){t(c);continue}n.has(D(l.name).toLowerCase())&&r.push(c)}};return t(""),r.sort()}function $e(e){return D(e).toLowerCase()===".vue"?"vue":D(e).replace(/^\./,"").toLowerCase()||"source"}import{existsSync as Ae,readdirSync as G}from"fs";import{extname as Re,join as q}from"path";var Ne=new Set([".git",".hg",".svn",".idea",".vscode","node_modules","vendor","dist","build","target","bin","obj",".dart_tool",".gradle",".next",".venv","venv","__pycache__"]),Be=[{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 z(e){let n=[],r=Me(e),t=Ue(e);for(let i of Be){if(Fe(e,i.files)){n.push(i.language);continue}if(Oe(r,i.globs)){n.push(i.language);continue}Ve(t,i.extensions)&&n.push(i.language)}return n.includes("typescript")&&W(n,"javascript"),n.includes("cpp")&&!t.has(".c")&&W(n,"c"),n}function Me(e){try{return G(e)}catch{return[]}}function Fe(e,n){return n?.length?n.some(r=>Ae(q(e,r))):!1}function Oe(e,n){return n?.length?e.some(r=>n.some(t=>Te(r,t))):!1}function Te(e,n){if(n==="*")return!0;if(!n.includes("*"))return e===n;let[r,t]=n.split("*");return e.startsWith(r??"")&&e.endsWith(t??"")}function Ue(e){let n=new Set,r=[e];for(;r.length>0;){let t=r.pop();if(!t)continue;let i;try{i=G(t,{withFileTypes:!0})}catch{continue}for(let s of i){if(s.name.startsWith(".")&&!s.name.endsWith("proj")&&!s.name.endsWith("sln")&&s.isDirectory())continue;let a=q(t,s.name);if(s.isDirectory()){Ne.has(s.name)||r.push(a);continue}let l=Re(s.name).toLowerCase();l&&n.add(l)}}return n}function Ve(e,n){return n?.length?n.some(r=>e.has(r)):!1}function W(e,n){let r=e.indexOf(n);r!==-1&&e.splice(r,1)}import{existsSync as K,readdirSync as We}from"fs";import{join as E}from"path";var Ge={typescript:{language:"typescript",indexerBinary:"scip-typescript",checkCommand:"npx scip-typescript --version",indexArgs:({outputPath:e,pnpmWorkspaces:n})=>{let r=["scip-typescript","index","--infer-tsconfig","--output",e,"--no-progress-bar"];return n&&r.splice(2,0,"--pnpm-workspaces"),{binary:"npx",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})=>({binary:"npx",args:["scip-typescript","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",binaryAliases:["scip-python-plus"],checkCommand:"npx scip-python --version",indexArgs:({outputPath:e})=>({binary:"npx",args:["scip-python","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:n})=>({binary:"scip-dotnet",args:["index",H(e,[".sln",".csproj"])??e,"--output",n,"--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:n})=>({binary:"scip-dotnet",args:["index",H(e,[".sln",".vbproj"])??e,"--output",n,"--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:n})=>({binary:e,args:["--output",n]}),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:n})=>{let r=E(e,"vendor","bin","scip-php"),t=E(e,"vendor","davidrjenni","scip-php","bin","scip-php");return{binary:"php",args:["-d","error_reporting=E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED",K(t)?t:K(r)?r:n]}},defaultOutputPath:"index.scip",markerFiles:["composer.json"],installMethods:[],installUrl:"https://github.com/davidrjenni/scip-php/releases"}};function X(e){return Ge[e]}function H(e,n){let r;try{r=We(e)}catch{return null}for(let t of r)if(n.some(i=>t.endsWith(i)))return E(e,t);return null}import{readFileSync as qe,writeFileSync as ze}from"fs";import{create as w}from"@bufbuild/protobuf";import{deserializeSCIP as Ke,serializeSCIP as He,DocumentSchema as Xe,IndexSchema as Je,SymbolInformationSchema as Qe}from"@c4312/scip";function Ye(e){if(e.length===0)throw new Error("Cannot merge zero SCIP indexes");if(e.length===1)return e[0];let n=Ze(e),r=en(e.flatMap(i=>i.documents??[])),t=Q(e.flatMap(i=>i.externalSymbols??[]));return w(Je,{metadata:n,documents:r,externalSymbols:t})}function J(e,n){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let r=e.map(i=>Ke(qe(i))),t=Ye(r);return ze(n,Buffer.from(He(t))),{documentCount:t.documents.length,externalSymbolCount:t.externalSymbols.length,inputCount:e.length}}function Ze(e){let n=e[0]?.metadata;if(!n)return;let r=n.projectRoot;for(let t of e.slice(1)){let i=t.metadata?.projectRoot;if(r&&i&&i!==r)throw new Error(`Cannot merge SCIP indexes with different project roots: ${r} vs ${i}`)}return n}function en(e){let n=new Map;for(let r of e){let t=n.get(r.relativePath);if(!t){n.set(r.relativePath,r);continue}n.set(r.relativePath,w(Xe,{language:t.language||r.language,relativePath:t.relativePath||r.relativePath,occurrences:[...t.occurrences,...r.occurrences],symbols:Q([...t.symbols,...r.symbols]),text:tn(t.text,r.text),positionEncoding:t.positionEncoding||r.positionEncoding}))}return[...n.values()]}function Q(e){let n=new Map;for(let r of e){let t=n.get(r.symbol);if(!t){n.set(r.symbol,r);continue}n.set(r.symbol,w(Qe,{symbol:t.symbol,documentation:rn([...t.documentation,...r.documentation]),relationships:nn([...t.relationships,...r.relationships]),kind:t.kind||r.kind,displayName:t.displayName||r.displayName,enclosingSymbol:t.enclosingSymbol||r.enclosingSymbol,signatureDocumentation:t.signatureDocumentation??r.signatureDocumentation}))}return[...n.values()]}function nn(e){let n=new Set,r=[];for(let t of e){let i=[t.symbol,t.isReference?"1":"0",t.isImplementation?"1":"0",t.isTypeDefinition?"1":"0",t.isDefinition?"1":"0"].join("|");n.has(i)||(n.add(i),r.push(t))}return r}function tn(e,n){return e?n?e.length>=n.length?e:n:e:n}function rn(e){return[...new Set(e)]}import{execFileSync as S}from"child_process";import{existsSync as _}from"fs";import{createRequire as sn}from"module";import{platform as Y}from"os";import{join as Z}from"path";var on=sn(import.meta.url),an=Y()==="win32";function b(e){let n=an?"where":"which";try{return S(n,[e],{stdio:"pipe"}),!0}catch{return!1}}function ee(e){return[e.indexerBinary,...e.binaryAliases??[]]}function L(e){let n=ee(e);return n.length===1?n[0]:n.join(" or ")}function I(e){for(let n of ee(e))if(b(n))return n;return te(e)?e.indexerBinary:null}function ne(e){return I(e)!==null||te(e)}function te(e){if(!e.bundledNpmPackage)return!1;try{return on.resolve(`${e.bundledNpmPackage}/package.json`),!0}catch{return!1}}function re(e,n){for(let r of e.projectLocalBinaries??[]){let t=Z(n,r);if(_(t))return t}return null}function ie(e,n=process.env,r=e.indexerBinary){if(e.indexerBinary!=="scip-dotnet"||oe(r,n))return n;let t=ln(r,n);return t?{...n,DOTNET_ROOT:t}:n}function se(e,n){let r=e.installMethods,t=L(e);if(!r?.length)return n(`No auto-install method available for ${t}.`),e.installUrl&&n(`Install manually from: ${e.installUrl}`),!1;for(let i of r)if(b(i.prerequisite)){n(`Installing ${t} via ${i.label}...`);try{S(i.binary,i.args,{stdio:"inherit",timeout:3e5,env:process.env});let s=I(e);if(s){let a=s===e.indexerBinary?"":` (using ${s})`;return n(`Successfully installed ${t} via ${i.label}${a}`),!0}n(`${i.label} command completed but ${t} was not found on PATH`)}catch(s){let a=s instanceof Error?s.message:String(s);n(`${i.label} install failed: ${a}`)}}return n(`Could not auto-install ${t}.`),e.installUrl&&n(`Install manually from: ${e.installUrl}`),!1}function ln(e,n){for(let r of cn(n))if(oe(e,{...n,DOTNET_ROOT:r}))return r;return null}function cn(e){let n=[],r=e.DOTNET_ROOT;if(r&&_(r)&&n.push(r),Y()==="darwin"&&b("brew"))try{let t=S("brew",["--prefix","dotnet@9"],{stdio:"pipe",env:e}).toString().trim(),i=Z(t,"libexec");_(i)&&!n.includes(i)&&n.push(i)}catch{}return n}function oe(e,n){try{return S(e,["--version"],{stdio:"pipe",env:n}),!0}catch{return!1}}async function ue(e){let{projectRoot:n,maxHeapMb:r=8192,onStatus:t=console.log,skipAutoInstall:i=!1}=e,s=e.outputScip??C(n,"index.scip"),a=e.outputDb??C(n,"index.db"),l=Date.now(),c=e.languages??z(n);if(c.length===0)throw new Error("No supported languages detected in this project. Looked for: tsconfig.json, Cargo.toml, go.mod, pyproject.toml, etc.");if(t(`Detected languages: ${c.join(", ")}`),!b("scip")){if(i)throw new Error(`The scip CLI is required but not found on PATH.
|
|
60
|
-
Install from: https://github.com/sourcegraph/scip/releases`);if(t("scip CLI not found on PATH. Attempting auto-install..."),!R(t))throw new Error(`The scip CLI is required but could not be installed.
|
|
61
|
-
Install manually from: https://github.com/sourcegraph/scip/releases`)}let h={...process.env,NODE_OPTIONS:`--max-old-space-size=${r}`},f=c.map((o,m)=>({language:o,scipPath:c.length>1?fn(s,o,m):s})),p=[],u=[];for(let{language:o,scipPath:m}of f){let d=X(o),x=L(d),$=re(d,n);if(!$&&!ne(d)){if(i){let g=`${x} not found on PATH (auto-install disabled). ${d.installUrl??""}`.trim();t(`Skipping ${o}: ${g}`),u.push({language:o,reason:g});continue}if(t(`${x} not found. Attempting auto-install...`),!se(d,t)){let g=`${x} could not be auto-installed. ${d.installUrl?`Install manually from ${d.installUrl}`:`Install ${x} and put it on PATH.`}`;t(`Skipping ${o}: ${g}`),u.push({language:o,reason:g});continue}}let y=$??I(d);if(!y){let g=`${x} was not found after installation checks.`;t(`Skipping ${o}: ${g}`),u.push({language:o,reason:g});continue}t(`Indexing ${o} with ${y}...`);let he=ie(d,h,y),{binary:xe,args:ye}=d.indexArgs({projectRoot:n,outputPath:m,pnpmWorkspaces:e.pnpmWorkspaces,indexerBinary:y});try{ae(xe,ye,{cwd:n,env:he,stdio:"pipe",maxBuffer:50*1024*1024})}catch(g){let be=g instanceof Error?g.message:String(g),A=`${y} indexer failed: ${be.split(`
|
|
62
|
-
`)[0]}`;t(`Skipping ${o}: ${A}`),u.push({language:o,reason:A});continue}mn(d,n,m),p.push({language:o,scipPath:m})}if(p.length===0){let o=u.map(m=>` - ${m.language}: ${m.reason}`).join(`
|
|
1
|
+
import{a as k,b as $}from"./chunk-HUASU3AD.js";import{d as E}from"./chunk-H4DXD2FB.js";import{execFile as Ke,execFileSync as Ve}from"child_process";import{closeSync as Ye,existsSync as m,mkdirSync as ee,mkdtempSync as Ze,openSync as en,readFileSync as nn,renameSync as f,rmSync as h,writeFileSync as ne}from"fs";import{cpus as tn}from"os";import{basename as I,dirname as d,extname as rn,join as c}from"path";import{execFileSync as ue}from"child_process";import{existsSync as le,readdirSync as M}from"fs";import{extname as N,join as F}from"path";var ce=new Set([".git",".hg",".svn",".idea",".vscode","node_modules","vendor","dist","build","target","bin","obj",".dart_tool",".gradle",".next",".venv","venv","__pycache__"]),pe=[{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 A(e){let n=[],t=ge(e),r=he(e);for(let a of pe){if(de(e,a.files)){n.push(a.language);continue}if(me(t,a.globs)){n.push(a.language);continue}ye(r,a.extensions)&&n.push(a.language)}return n.includes("typescript")&&B(n,"javascript"),n.includes("cpp")&&!r.has(".c")&&B(n,"c"),n}function ge(e){try{return M(e)}catch{return[]}}function de(e,n){return n?.length?n.some(t=>le(F(e,t))):!1}function me(e,n){return n?.length?e.some(t=>n.some(r=>fe(t,r))):!1}function fe(e,n){if(n==="*")return!0;if(!n.includes("*"))return e===n;let[t,r]=n.split("*");return e.startsWith(t??"")&&e.endsWith(r??"")}function he(e){let n=xe(e);if(n)return n;let t=new Set,r=[e];for(;r.length>0;){let a=r.pop();if(!a)continue;let i;try{i=M(a,{withFileTypes:!0})}catch{continue}for(let s of i){if(s.name.startsWith(".")&&!s.name.endsWith("proj")&&!s.name.endsWith("sln")&&s.isDirectory())continue;let o=F(a,s.name);if(s.isDirectory()){ce.has(s.name)||r.push(o);continue}let g=N(s.name).toLowerCase();g&&t.add(g)}}return t}function xe(e){try{let n=ue("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"]}),t=new Set;for(let r of n.split(`
|
|
2
|
+
`)){if(!r)continue;let a=N(r).toLowerCase();a&&t.add(a)}return t}catch{return null}}function ye(e,n){return n?.length?n.some(t=>e.has(t)):!1}function B(e,n){let t=e.indexOf(n);t!==-1&&e.splice(t,1)}import{existsSync as _,readdirSync as be}from"fs";import{join as R}from"path";var Se={typescript:{language:"typescript",indexerBinary:"scip-typescript",checkCommand:"npx scip-typescript --version",indexArgs:({outputPath:e,pnpmWorkspaces:n,indexerBinary:t})=>{let r=["index","--infer-tsconfig","--output",e,"--no-progress-bar"];return n&&r.splice(1,0,"--pnpm-workspaces"),{binary:t,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:n})=>({binary:n,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:n})=>({binary:n,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:n})=>({binary:"scip-dotnet",args:["index",T(e,[".sln",".csproj"])??e,"--output",n,"--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:n})=>({binary:"scip-dotnet",args:["index",T(e,[".sln",".vbproj"])??e,"--output",n,"--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:n})=>({binary:e,args:["--output",n]}),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:n})=>{let t=R(e,"vendor","bin","scip-php"),r=R(e,"vendor","davidrjenni","scip-php","bin","scip-php");return{binary:"php",args:["-d","error_reporting=E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED",_(r)?r:_(t)?t:n]}},defaultOutputPath:"index.scip",markerFiles:["composer.json"],installMethods:[],installUrl:"https://github.com/davidrjenni/scip-php/releases"}};function U(e){return Se[e]}function T(e,n){let t;try{t=be(e)}catch{return null}for(let r of t)if(n.some(a=>r.endsWith(a)))return R(e,r);return null}import{readFileSync as Pe,writeFileSync as ve}from"fs";import{create as D}from"@bufbuild/protobuf";import{deserializeSCIP as Ie,serializeSCIP as ke,DocumentSchema as Re,IndexSchema as De,SymbolInformationSchema as Ce}from"@c4312/scip";function Oe(e){if(e.length===0)throw new Error("Cannot merge zero SCIP indexes");if(e.length===1)return e[0];let n=je(e),t=Le(e.flatMap(a=>a.documents??[])),r=q(e.flatMap(a=>a.externalSymbols??[]));return D(De,{metadata:n,documents:t,externalSymbols:r})}function W(e,n){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let t=e.map(a=>Ie(Pe(a))),r=Oe(t);return ve(n,Buffer.from(ke(r))),{documentCount:r.documents.length,externalSymbolCount:r.externalSymbols.length,inputCount:e.length}}function je(e){let n=e[0]?.metadata;if(!n)return;let t=n.projectRoot;for(let r of e.slice(1)){let a=r.metadata?.projectRoot;if(t&&a&&a!==t)throw new Error(`Cannot merge SCIP indexes with different project roots: ${t} vs ${a}`)}return n}function Le(e){let n=new Map;for(let t of e){let r=n.get(t.relativePath);if(!r){n.set(t.relativePath,t);continue}n.set(t.relativePath,D(Re,{language:r.language||t.language,relativePath:r.relativePath||t.relativePath,occurrences:[...r.occurrences,...t.occurrences],symbols:q([...r.symbols,...t.symbols]),text:Ee(r.text,t.text),positionEncoding:r.positionEncoding||t.positionEncoding}))}return[...n.values()]}function q(e){let n=new Map;for(let t of e){let r=n.get(t.symbol);if(!r){n.set(t.symbol,t);continue}n.set(t.symbol,D(Ce,{symbol:r.symbol,documentation:$e([...r.documentation,...t.documentation]),relationships:we([...r.relationships,...t.relationships]),kind:r.kind||t.kind,displayName:r.displayName||t.displayName,enclosingSymbol:r.enclosingSymbol||t.enclosingSymbol,signatureDocumentation:r.signatureDocumentation??t.signatureDocumentation}))}return[...n.values()]}function we(e){let n=new Set,t=[];for(let r of e){let a=[r.symbol,r.isReference?"1":"0",r.isImplementation?"1":"0",r.isTypeDefinition?"1":"0",r.isDefinition?"1":"0"].join("|");n.has(a)||(n.add(a),t.push(r))}return t}function Ee(e,n){return e?n?e.length>=n.length?e:n:e:n}function $e(e){return[...new Set(e)]}import{readFileSync as Be,writeFileSync as Me}from"fs";import{create as z}from"@bufbuild/protobuf";import{deserializeSCIP as Ne,DocumentSchema as Fe,IndexSchema as Ae,serializeSCIP as _e,SymbolRole as Te}from"@c4312/scip";function J(e){let n;try{n=Ne(Be(e))}catch{return{removedDefinitionOccurrences:0,touchedDocuments:0}}let t=Ue(n);return t.removedDefinitionOccurrences>0&&Me(e,Buffer.from(_e(t.index))),{removedDefinitionOccurrences:t.removedDefinitionOccurrences,touchedDocuments:t.touchedDocuments}}function Ue(e){let n=new Set;for(let i of e.documents)for(let s of i.symbols)s.symbol&&n.add(s.symbol);for(let i of e.externalSymbols)i.symbol&&n.add(i.symbol);let t=0,r=0,a=[];for(let i of e.documents){let s=i.occurrences.filter(o=>(o.symbolRoles&Te.Definition)===0||n.has(o.symbol)?!0:(t+=1,!1));if(s.length===i.occurrences.length){a.push(i);continue}r+=1,a.push(z(Fe,{language:i.language,relativePath:i.relativePath,occurrences:s,symbols:i.symbols,text:i.text,positionEncoding:i.positionEncoding}))}return{index:t===0?e:z(Ae,{metadata:e.metadata,documents:a,externalSymbols:e.externalSymbols}),removedDefinitionOccurrences:t,touchedDocuments:r}}import{execFileSync as S}from"child_process";import{existsSync as C,readFileSync as We}from"fs";import{createRequire as qe}from"module";import{platform as H}from"os";import{dirname as G,join as b}from"path";var ze=qe(import.meta.url),Je=H()==="win32";function x(e){let n=Je?"where":"which";try{return S(n,[e],{stdio:"pipe"}),!0}catch{return!1}}function O(e){return[e.indexerBinary,...e.binaryAliases??[]]}function j(e){let n=O(e);return n.length===1?n[0]:n.join(" or ")}function P(e){for(let n of O(e))if(x(n))return n;return He(e)}function X(e){return P(e)!==null||Ge(e)}function Ge(e){return Q(e)!==null}function He(e){let n=Q(e);if(!n)return null;let r=JSON.parse(We(n,"utf8")).bin;if(!r)return null;if(typeof r=="string")return b(G(n),r);for(let a of O(e)){let i=r[a];if(i)return b(G(n),i)}return null}function Q(e){if(!e.bundledNpmPackage)return null;try{return ze.resolve(`${e.bundledNpmPackage}/package.json`)}catch{return null}}function K(e,n){for(let t of e.projectLocalBinaries??[]){let r=b(n,t);if(C(r))return r}return null}function V(e,n=process.env,t=e.indexerBinary){if(e.indexerBinary!=="scip-dotnet"||Z(t,n))return n;let r=Xe(t,n);return r?{...n,DOTNET_ROOT:r}:n}function Y(e,n){let t=e.installMethods,r=j(e);if(!t?.length)return n(`No auto-install method available for ${r}.`),e.installUrl&&n(`Install manually from: ${e.installUrl}`),!1;for(let a of t)if(x(a.prerequisite)){n(`Installing ${r} via ${a.label}...`);try{S(a.binary,a.args,{stdio:"inherit",timeout:3e5,env:process.env});let i=P(e);if(i){let s=i===e.indexerBinary?"":` (using ${i})`;return n(`Successfully installed ${r} via ${a.label}${s}`),!0}n(`${a.label} command completed but ${r} was not found on PATH`)}catch(i){let s=i instanceof Error?i.message:String(i);n(`${a.label} install failed: ${s}`)}}return n(`Could not auto-install ${r}.`),e.installUrl&&n(`Install manually from: ${e.installUrl}`),!1}function Xe(e,n){for(let t of Qe(n))if(Z(e,{...n,DOTNET_ROOT:t}))return t;return null}function Qe(e){let n=[],t=e.DOTNET_ROOT;if(t&&C(t)&&n.push(t),H()==="darwin"&&x("brew"))try{let r=S("brew",["--prefix","dotnet@9"],{stdio:"pipe",env:e}).toString().trim(),a=b(r,"libexec");C(a)&&!n.includes(a)&&n.push(a)}catch{}return n}function Z(e,n){try{return S(e,["--version"],{stdio:"pipe",env:n}),!0}catch{return!1}}async function te(e){let{projectRoot:n,maxHeapMb:t=8192,onStatus:r=console.log,skipAutoInstall:a=!1}=e,i=an(e),s=Date.now();ee(d(i.outputScip),{recursive:!0}),ee(d(i.outputDb),{recursive:!0});let o=e.languages??A(n);if(o.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: ${o.join(", ")}`);let g=On(n,o,{pnpmWorkspaces:e.pnpmWorkspaces}),u=vn(c(d(i.outputDb),"index.lock")),p=null;try{let l=sn({opts:e,paths:i,languages:o,fingerprint:g,start:s,onStatus:r});if(l)return l;pn(a,r);let y=on(i);return p=y.runDir,await un({opts:e,languages:o,projectRoot:n,paths:i,tempPaths:y,fingerprint:g,start:s,maxHeapMb:t,skipAutoInstall:a,onStatus:r})}finally{p&&h(p,{recursive:!0,force:!0}),u()}}function an(e){let n=e.outputScip??c(e.projectRoot,"index.scip"),t=e.outputDb??c(e.projectRoot,"index.db");return{outputScip:n,outputDb:t,metaPath:c(d(t),"meta.json")}}function sn(e){if(e.opts.skipIfUnchanged===!1||!m(e.paths.outputScip)||!m(e.paths.outputDb)||!jn(e.paths.metaPath,e.fingerprint))return null;k({projectRoot:e.opts.projectRoot,dbPath:e.paths.outputDb,onStatus:e.onStatus});let n=Date.now()-e.start;return e.onStatus(`Index unchanged; reused existing SQLite index in ${(n/1e3).toFixed(1)}s`),{languages:e.languages,indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:n,reused:!0,skipped:[]}}function on(e){let n=Ze(c(d(e.outputDb),"reindex-"));return{runDir:n,tempOutputScip:c(n,I(e.outputScip)),tempOutputDb:c(n,I(e.outputDb)),tempMetaPath:c(n,I(e.metaPath))}}async function un(e){let n={...process.env,NODE_OPTIONS:`--max-old-space-size=${e.maxHeapMb}`},{indexedOutputs:t,skippedLanguages:r}=await ln(e,n);cn(e,n,t,r);let a=Date.now()-e.start;return e.onStatus(`Done in ${(a/1e3).toFixed(1)}s`),{languages:t.map(i=>i.language),indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:a,reused:!1,skipped:r}}async function ln(e,n){let{preparedRuns:t,skippedLanguages:r}=gn({languages:e.languages,tempOutputScip:e.tempPaths.tempOutputScip,projectRoot:e.projectRoot,env:n,skipAutoInstall:e.skipAutoInstall,pnpmWorkspaces:e.opts.pnpmWorkspaces,onStatus:e.onStatus}),a=await Rn(t,e.projectRoot,e.onStatus,e.opts.indexerConcurrency),{indexedOutputs:i}=mn(a,r);return fn(i,r,e.languages,e.opts.allowPartial,e.onStatus),{indexedOutputs:i,skippedLanguages:r}}function cn(e,n,t,r){hn(t,e.tempPaths.tempOutputScip,e.onStatus),xn(e.tempPaths.tempOutputScip,e.tempPaths.tempOutputDb,n,e.onStatus),k({projectRoot:e.projectRoot,dbPath:e.tempPaths.tempOutputDb,onStatus:e.onStatus}),Ln(e.tempPaths.tempMetaPath,{version:2,status:r.length===0?"complete":"partial",updatedAt:new Date().toISOString(),fingerprint:e.fingerprint,requestedLanguages:e.languages,indexedLanguages:t.map(a=>a.language),skipped:[...r]}),In({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 pn(e,n){if(!x("scip")){if(e)throw new Error(`The scip CLI is required but not found on PATH.
|
|
3
|
+
Install from: https://github.com/sourcegraph/scip/releases`);if(n("scip CLI not found on PATH. Attempting auto-install..."),!E(n))throw new Error(`The scip CLI is required but could not be installed.
|
|
4
|
+
Install manually from: https://github.com/sourcegraph/scip/releases`)}}function gn(e){let n=[],t=[],r=e.languages.map((a,i)=>({language:a,scipPath:e.languages.length>1?Pn(e.tempOutputScip,a,i):e.tempOutputScip}));for(let{language:a,scipPath:i}of r){let s=dn({...e,language:a,scipPath:i});"skipped"in s?t.push(s.skipped):n.push(s.prepared)}return{preparedRuns:n,skippedLanguages:t}}function dn(e){let n=U(e.language),t=j(n),r=K(n,e.projectRoot);if(!r&&!X(n)){if(e.skipAutoInstall){let o=`${t} not found on PATH (auto-install disabled). ${n.installUrl??""}`.trim();return e.onStatus(`Skipping ${e.language}: ${o}`),{skipped:{language:e.language,reason:o}}}if(e.onStatus(`${t} not found. Attempting auto-install...`),!Y(n,e.onStatus)){let o=`${t} could not be auto-installed. ${n.installUrl?`Install manually from ${n.installUrl}`:`Install ${t} and put it on PATH.`}`;return e.onStatus(`Skipping ${e.language}: ${o}`),{skipped:{language:e.language,reason:o}}}}let a=r??P(n);if(!a){let o=`${t} was not found after installation checks.`;return e.onStatus(`Skipping ${e.language}: ${o}`),{skipped:{language:e.language,reason:o}}}let{binary:i,args:s}=n.indexArgs({projectRoot:e.projectRoot,outputPath:e.scipPath,pnpmWorkspaces:e.pnpmWorkspaces,indexerBinary:a});return{prepared:{language:e.language,scipPath:e.scipPath,config:n,resolvedBinary:a,binary:i,args:s,env:V(n,e.env,a)}}}function mn(e,n){let t=[];for(let r of e)r.skipped?n.push(r.skipped):t.push({language:r.language,scipPath:r.scipPath});return{indexedOutputs:t}}function fn(e,n,t,r,a){if(e.length===0){let i=n.map(s=>` - ${s.language}: ${s.reason}`).join(`
|
|
63
5
|
`);throw new Error(`No language indexers ran successfully. Install at least one indexer for the languages in this project.
|
|
64
|
-
`+
|
|
6
|
+
`+i)}if(n.length!==0&&(a(`Indexed ${e.length} of ${t.length} languages; skipped ${n.map(i=>i.language).join(", ")}.`),!r))throw new Error(`Failed to index all required languages; preserving the previous index. Pass --allow-partial to intentionally write an incomplete index.
|
|
7
|
+
`+n.map(i=>` - ${i.language}: ${i.reason}`).join(`
|
|
8
|
+
`))}function hn(e,n,t){e.length>1?(t(`Merging ${e.length} language indexes...`),W(e.map(r=>r.scipPath),n)):e[0].scipPath!==n&&f(e[0].scipPath,n)}function xn(e,n,t,r){if(r("Converting to SQLite..."),!m(e))throw new Error(`SCIP index not found at ${e} after indexing`);try{let a=J(e);a.removedDefinitionOccurrences>0&&r(`Sanitized ${a.removedDefinitionOccurrences} invalid definition occurrences across ${a.touchedDocuments} documents before SQLite conversion.`),Ve("scip",["expt-convert","--output",n,e],{env:t,stdio:"pipe",maxBuffer:50*1024*1024})}catch(a){let i=a instanceof Error?a.message:String(a);throw new Error(`Failed to convert SCIP index to SQLite: ${i}`,{cause:a})}}function yn(e,n,t){if(!e.defaultOutputPath)return;let r=c(n,e.defaultOutputPath);t!==r&&m(r)&&f(r,t)}function bn(e,n,t){if(!e.defaultOutputPath)return null;let r=c(n,e.defaultOutputPath);if(r===t)return null;let a=`${t}.default-output-backup`;return h(a,{force:!0}),m(r)?(f(r,a),{defaultOutputPath:r,backupPath:a}):{defaultOutputPath:r,backupPath:null}}function Sn(e){e&&(h(e.defaultOutputPath,{force:!0}),e.backupPath&&m(e.backupPath)&&f(e.backupPath,e.defaultOutputPath))}function Pn(e,n,t){let r=rn(e)||".scip",a=I(e,r);return c(d(e),`${a}.${t+1}.${n}${r}`)}function vn(e){let n;try{n=en(e,"wx")}catch(t){throw(typeof t=="object"&&t&&"code"in t?t.code:void 0)==="EEXIST"?new Error(`Another scip-query reindex is already running for ${d(e)}.`,{cause:t}):t}return ne(n,JSON.stringify({pid:process.pid,startedAt:new Date().toISOString()})+`
|
|
9
|
+
`),()=>{try{Ye(n)}finally{h(e,{force:!0})}}}function In(e){L(e.tempOutputScip,e.outputScip),L(e.tempOutputDb,e.outputDb),L(e.tempMetaPath,e.metaPath)}function L(e,n){h(`${n}.tmp-replace`,{force:!0}),f(e,`${n}.tmp-replace`),f(`${n}.tmp-replace`,n)}function kn(e,n){if(e<=1)return 1;let t=Number(process.env.SCIP_QUERY_INDEXER_CONCURRENCY??0),r=Number.isFinite(n)&&n&&n>0?n:Number.isFinite(t)&&t>0?t:Math.min(2,Math.max(1,tn().length-1));return Math.max(1,Math.min(e,Math.floor(r)))}async function Rn(e,n,t,r){let a=e.filter(u=>u.config.defaultOutputPath),i=e.filter(u=>!u.config.defaultOutputPath),s=[],o=kn(i.length,r),g=await Cn(i,o,u=>w(u,n,t));if(o>1){let u=new Map;for(let p of g.filter(l=>l.skipped)){let l=i.find(y=>y.language===p.language);l&&(t(`Retrying ${l.language} indexer serially after parallel failure...`),u.set(l.language,await w(l,n,t)))}s.push(...g.map(p=>u.get(p.language)??p))}else s.push(...g);for(let u of a)s.push(await w(u,n,t));return s.sort((u,p)=>e.findIndex(l=>l.language===u.language)-e.findIndex(l=>l.language===p.language))}async function w(e,n,t){t(`Indexing ${e.language} with ${e.resolvedBinary}...`),h(e.scipPath,{force:!0});let r=bn(e.config,n,e.scipPath);try{await Dn(e.binary,e.args,{cwd:n,env:e.env,maxBuffer:50*1024*1024}),yn(e.config,n,e.scipPath)}catch(a){let i=a instanceof Error?a.message:String(a),s=`${e.resolvedBinary} indexer failed: ${i.split(`
|
|
10
|
+
`)[0]}`;return t(`Skipping ${e.language}: ${s}`),{language:e.language,scipPath:e.scipPath,skipped:{language:e.language,reason:s}}}finally{Sn(r)}if(!m(e.scipPath)){let a=`${e.resolvedBinary} indexer completed but did not produce ${e.scipPath}`;return t(`Skipping ${e.language}: ${a}`),{language:e.language,scipPath:e.scipPath,skipped:{language:e.language,reason:a}}}return{language:e.language,scipPath:e.scipPath}}function Dn(e,n,t){return new Promise((r,a)=>{Ke(e,[...n],t,i=>{i?a(i):r()})})}async function Cn(e,n,t){if(e.length===0)return[];let r=new Array(e.length),a=0,i=Math.max(1,Math.min(e.length,n)),s=Array.from({length:i},async()=>{for(;a<e.length;){let o=a++;r[o]=await t(e[o])}});return await Promise.all(s),r}function On(e,n,t){return{version:1,languages:[...n].sort(),pnpmWorkspaces:t.pnpmWorkspaces===!0,files:$(e)}}function jn(e,n){try{let t=JSON.parse(nn(e,"utf-8"));return t.version===2&&t.status==="complete"&&v(t.fingerprint)===v(n)&&v([...t.indexedLanguages??[]].sort())===v(n.languages)}catch{return!1}}function Ln(e,n){ne(e,`${JSON.stringify(n,null,2)}
|
|
11
|
+
`)}function v(e){return JSON.stringify(e)}var ie=process.env.SCIP_REINDEX_PROJECT_ROOT,se=process.env.SCIP_REINDEX_OUTPUT_SCIP,oe=process.env.SCIP_REINDEX_OUTPUT_DB,re=process.env.SCIP_REINDEX_LANGUAGES,wn=process.env.SCIP_REINDEX_PNPM_WORKSPACES==="1";(!ie||!se||!oe)&&(console.error("reindex-worker: missing required env vars"),process.exit(1));var ae=re?re.split(",").filter(Boolean):void 0;te({projectRoot:ie,outputScip:se,outputDb:oe,languages:ae?.length?ae:void 0,pnpmWorkspaces:wn,onStatus:e=>process.stderr.write(`[reindex] ${e}
|
|
65
12
|
`)}).then(()=>{process.exit(0)}).catch(e=>{console.error(`reindex-worker error: ${e}`),process.exit(1)});
|
|
66
13
|
//# sourceMappingURL=reindex-worker.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scip-query",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"description": "Language-agnostic code intelligence CLI powered by SCIP indexes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"test:watch": "vitest",
|
|
36
36
|
"typecheck": "tsc --noEmit",
|
|
37
37
|
"lint": "eslint src/",
|
|
38
|
+
"calibrate": "node scripts/accuracy-calibration.mjs",
|
|
38
39
|
"prepublishOnly": "npm run build",
|
|
39
40
|
"postinstall": "node dist/postinstall.js || true"
|
|
40
41
|
},
|
|
@@ -64,7 +65,8 @@
|
|
|
64
65
|
"@c4312/scip": "^0.1.0",
|
|
65
66
|
"better-sqlite3": "^12.9.0",
|
|
66
67
|
"commander": "^13.1.0",
|
|
67
|
-
"ignore": "^7.0.3"
|
|
68
|
+
"ignore": "^7.0.3",
|
|
69
|
+
"ts-morph": "^28.0.0"
|
|
68
70
|
},
|
|
69
71
|
"//optionalDependencies": "Native parsers and bundled SCIP indexers go in optionalDependencies so a failed install (missing build tools, restricted registry, incompatible platform) downgrades scip-query gracefully — the affected language falls back to regex parsing or asks the user to install its indexer manually — instead of blocking npm install.",
|
|
70
72
|
"optionalDependencies": {
|
package/dist/chunk-2OXZVIED.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import{h as a,i as c}from"./chunk-ID7TO4P6.js";import{q as d}from"./chunk-QRULHDMO.js";import{b as l}from"./chunk-5IM4IQ6N.js";function E(e,t={}){let{limit:m=20,scope:s,minFanIn:n=2,minFanOut:f=2}=t,_=s?`AND def_d.relative_path LIKE '%${s}%'`:"",r=e.all(`SELECT * FROM (
|
|
2
|
-
SELECT
|
|
3
|
-
gs.symbol,
|
|
4
|
-
def_d.relative_path AS defined_in,
|
|
5
|
-
(SELECT COUNT(DISTINCT ref_c.document_id)
|
|
6
|
-
FROM mentions ref_m
|
|
7
|
-
JOIN chunks ref_c ON ref_m.chunk_id = ref_c.id
|
|
8
|
-
WHERE ref_m.symbol_id = gs.id AND ref_m.role != 1
|
|
9
|
-
) AS fan_in,
|
|
10
|
-
(SELECT COUNT(DISTINCT ref_gs.id)
|
|
11
|
-
FROM mentions ref_m
|
|
12
|
-
JOIN chunks ref_c ON ref_m.chunk_id = ref_c.id
|
|
13
|
-
JOIN global_symbols ref_gs ON ref_m.symbol_id = ref_gs.id
|
|
14
|
-
JOIN (
|
|
15
|
-
SELECT m3.symbol_id, c3.document_id
|
|
16
|
-
FROM mentions m3
|
|
17
|
-
JOIN chunks c3 ON m3.chunk_id = c3.id
|
|
18
|
-
WHERE m3.role = 1
|
|
19
|
-
GROUP BY m3.symbol_id
|
|
20
|
-
) ref_sym_def ON ref_sym_def.symbol_id = ref_gs.id
|
|
21
|
-
WHERE ref_c.document_id = def_d.id
|
|
22
|
-
AND ref_m.role != 1
|
|
23
|
-
AND ref_sym_def.document_id != def_d.id
|
|
24
|
-
) AS fan_out
|
|
25
|
-
FROM global_symbols gs
|
|
26
|
-
JOIN (
|
|
27
|
-
SELECT m2.symbol_id, c2.document_id
|
|
28
|
-
FROM mentions m2
|
|
29
|
-
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
30
|
-
WHERE m2.role = 1
|
|
31
|
-
GROUP BY m2.symbol_id
|
|
32
|
-
) sym_def ON sym_def.symbol_id = gs.id
|
|
33
|
-
JOIN documents def_d ON sym_def.document_id = def_d.id
|
|
34
|
-
WHERE 1 = 1
|
|
35
|
-
${e.pathExclusionsFor("def_d")}
|
|
36
|
-
${e.symbolNoiseFor("gs")}
|
|
37
|
-
${_}
|
|
38
|
-
) WHERE fan_in >= ? AND fan_out >= ?
|
|
39
|
-
ORDER BY (fan_in * fan_out) DESC
|
|
40
|
-
LIMIT ?`,n,f,m).filter(o=>!e.isIgnored(o.defined_in)).map(o=>({symbol:o.symbol,shortName:l(o.symbol),fanIn:o.fan_in,fanOut:o.fan_out,score:o.fan_in*o.fan_out,definedIn:o.defined_in}));return r.length>0?r:u(e,s,{minFanIn:n,minFanOut:f,limit:m})}function u(e,t,m){let{minFanIn:s,minFanOut:n,limit:f}=m;return d(e,{scope:t}).filter(i=>!e.isIgnored(i.relativePath)).map(i=>b(e,i)).filter(i=>i.fanIn>=s&&i.fanOut>=n).sort((i,r)=>r.score-i.score||r.fanIn-i.fanIn).slice(0,f)}function b(e,t){let m=new Set(c(e,t,{limit:500}).map(n=>n.file)).size,s=new Set(a(e,t,{limit:500}).filter(n=>n.file!==t.relativePath).map(n=>`${n.symbol}|${n.file}`)).size;return{symbol:t.symbol,shortName:l(t.symbol),fanIn:m,fanOut:s,score:m*s,definedIn:t.relativePath}}export{E as a};
|
|
41
|
-
//# sourceMappingURL=chunk-2OXZVIED.js.map
|
package/dist/chunk-5IM4IQ6N.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var d={"/":"namespace","#":"type",".":"term","[":"type-param",":":"meta","!":"macro"};function l(e){if(e.startsWith("local "))return{kind:"local",id:e.slice(6),raw:e};let t=e.split(" ");if(t.length<4)return{scheme:t[0]??"",manager:t[1]??"",packageName:t[2]??"",version:"",descriptors:[],raw:e};let s=t[0],i=t[1],r=e.slice(s.length+1+i.length+1),n;if(r.startsWith("`")){let f=r.indexOf("`",1);f===-1?(n=r.slice(1),r=""):(n=r.slice(1,f),r=r.slice(f+2))}else{let f=r.indexOf(" ");f===-1?(n=r,r=""):(n=r.slice(0,f),r=r.slice(f+1))}let c,o=r.indexOf(" ");o===-1?(c=r,r=""):(c=r.slice(0,o),r=r.slice(o+1));let a=m(r);return{scheme:s,manager:i,packageName:n,version:c,descriptors:a,raw:e}}function m(e){let t=[],s=0;for(;s<e.length;){if(e[s]==="["){let n=e.indexOf("]",s+1);if(n===-1){t.push({name:e.slice(s+1),suffix:"type-param"});break}t.push({name:e.slice(s+1,n),suffix:"type-param"}),s=n+1;continue}if(e[s]==="("&&(t.length===0||s===0||u(e[s-1]))){let n=e.indexOf(")",s+1);if(n!==-1&&e[n+1]!=="."){t.push({name:e.slice(s+1,n),suffix:"parameter"}),s=n+1;continue}}let i;if(e[s]==="`"){let n=e.indexOf("`",s+1);if(n===-1){i=e.slice(s+1),t.push({name:i,suffix:"term"});break}i=e.slice(s+1,n),s=n+1}else{let n=s;for(;s<e.length&&!u(e[s]);)s++;i=e.slice(n,s)}if(s>=e.length){i&&t.push({name:i,suffix:"term"});break}let r=e[s];if(r==="("){let n=e.indexOf(")",s+1);n!==-1&&e[n+1]==="."?(t.push({name:i,suffix:"method"}),s=n+2):n!==-1?(t.push({name:i,suffix:"method"}),s=n+1):(t.push({name:i,suffix:"term"}),s++)}else{let n=d[r];n&&t.push({name:i,suffix:n}),s+=1}}return t}function u(e){return e==="/"||e==="#"||e==="."||e==="("||e==="["||e===":"||e==="!"}function x(e){let t=l(e);if("kind"in t&&t.kind==="local")return`local:${t.id}`;let s=t;if(s.descriptors.length===0)return s.raw;let i=[];for(let r of s.descriptors){let n=r.name;r.suffix==="namespace"&&(n=n.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/,"").replace(/\.(py|pyi)$/,"").replace(/\.(rs)$/,"").replace(/\.(java|scala|kt|kts)$/,"").replace(/\.(rb)$/,"").replace(/\.(go)$/,"").replace(/\.(cs|vb)$/,"").replace(/\.(dart)$/,"").replace(/\.(php)$/,"").replace(/\.(c|cc|cpp|cxx|h|hpp)$/,"")),n&&(r.suffix==="method"?i.push(`${n}()`):i.push(n))}return i.join(":")}function S(e){let t=l(e);if("kind"in t&&t.kind==="local")return t.id;let s=t;return s.descriptors.length===0?"":s.descriptors[s.descriptors.length-1].name}function p(e){let t=l(e);if("kind"in t&&t.kind==="local")return null;let s=t;return s.descriptors[s.descriptors.length-1]?.suffix??null}function b(e){return e.endsWith("().")||p(e)==="method"}function y(e){let t=p(e);return t==="method"||t==="term"}function k(e){return p(e)==="namespace"}var h=/^rust-analyzer\b.*[\s/]impl#\[[^\]]+\]\[[^\]]+\]/;function D(e){return h.test(e)}var g=new Set(["test","tests","_tests"]);function $(e){let t=l(e);if("kind"in t)return!1;for(let s=0;s<t.descriptors.length-1;s+=1){let i=t.descriptors[s];if(i?.suffix==="namespace"&&i.name&&g.has(i.name))return!0}return!1}function T(e,t){let s=l(e),i=l(t);if("kind"in s||"kind"in i)return!1;let r=s.descriptors,n=i.descriptors;if(n.length!==r.length+1)return!1;for(let c=0;c<r.length;c++){let o=r[c],a=n[c];if(o.name!==a.name||o.suffix!==a.suffix)return!1}return!0}function M(e,t){let s=l(e),i=l(t);if("kind"in s||"kind"in i)return!1;let r=s.descriptors,n=i.descriptors;if(n.length<=r.length)return!1;for(let c=0;c<r.length;c++){let o=r[c],a=n[c];if(o.name!==a.name||o.suffix!==a.suffix)return!1}return!0}export{l as a,x as b,S as c,p as d,b as e,y as f,k as g,D as h,$ as i,T as j,M as k};
|
|
2
|
-
//# sourceMappingURL=chunk-5IM4IQ6N.js.map
|
package/dist/chunk-5OV6CUTY.js
DELETED
package/dist/chunk-6QXYWGE5.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{a as u}from"./chunk-DX5YEUX4.js";import{p as c}from"./chunk-QRULHDMO.js";import{b as a}from"./chunk-5IM4IQ6N.js";function _(t,d){let s=u(t,d);if(!s)return null;let n=t.get(`SELECT id, relative_path FROM documents
|
|
2
|
-
WHERE relative_path = ?
|
|
3
|
-
${t.pathExclusionsFor("documents")}
|
|
4
|
-
LIMIT 1`,s);if(!n||t.isIgnored(n.relative_path))return null;let f=c(t,n.relative_path).sort((e,i)=>e.startLine-i.startLine||e.endLine-i.endLine),m=[],l=0;for(let e of f){let o=t.get(`SELECT COUNT(DISTINCT c.document_id) AS consumer_count
|
|
5
|
-
FROM mentions m
|
|
6
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
7
|
-
WHERE m.symbol_id = ?
|
|
8
|
-
AND m.role != 1
|
|
9
|
-
AND c.document_id != ?`,e.symbolId,n.id)?.consumer_count??0,r;o>10?r="high":o>0?r="medium":r="low",l+=o,m.push({symbol:e.symbol,shortName:a(e.symbol),startLine:e.startLine,endLine:e.endLine,externalConsumers:o,riskLevel:r})}return{file:n.relative_path,symbols:m,totalExternalConsumers:l}}export{_ as a};
|
|
10
|
-
//# sourceMappingURL=chunk-6QXYWGE5.js.map
|
package/dist/chunk-C6PQLWHR.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{k as g}from"./chunk-ID7TO4P6.js";import{a as b}from"./chunk-H4IWC7KJ.js";import{b as m}from"./chunk-5IM4IQ6N.js";import{readFileSync as y}from"fs";import{join as d}from"path";function I(o,i){let t=b(o,i);if(!t)return null;let l=o.get("SELECT language FROM documents WHERE relative_path = ?",t.relativePath)?.language??"unknown",s=d(o.config.projectRoot,t.relativePath),n="";try{n=y(s,"utf-8").split(`
|
|
2
|
-
`).slice(t.startLine,t.endLine+1).join(`
|
|
3
|
-
`)}catch{}let e=S(n,l),f=t.endLine-t.startLine+1,a=g(o,[t],{additive:!0}).get(t.symbolId)??[],p=new Set(a.map(r=>r.symbol)),u=o.get(`SELECT COUNT(DISTINCT c.document_id) AS c
|
|
4
|
-
FROM mentions m
|
|
5
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
6
|
-
WHERE m.symbol_id = ? AND m.role != 1`,t.symbolId),h=new Set(a.filter(r=>r.file!==t.relativePath).map(r=>r.symbol)).size;return{symbol:t.symbol,shortName:m(t.symbol),relativePath:t.relativePath,startLine:t.startLine,endLine:t.endLine,loc:f,branches:e,cyclomaticEstimate:e+1,calleeCount:p.size,fanIn:u?.c??0,fanOut:h}}function S(o,i){let t=P(o),c=0,l=[/\bif\b/g,/\belse\s+if\b/g,/\belse\b/g,/\bfor\b/g,/\bwhile\b/g,/\bswitch\b/g,/\bcase\b/g,/\bcatch\b/g,/\?\s*[^?]/g,/&&/g,/\|\|/g];for(let s of l){let n=t.match(s);n&&(c+=n.length)}if(i==="python"){let s=[/\belif\b/g,/\bexcept\b/g,/\bfinally\b/g];for(let n of s){let e=t.match(n);e&&(c+=e.length)}}else if(i==="rust"){let s=[/\bmatch\b/g,/=>/g,/\bloop\b/g];for(let n of s){let e=t.match(n);e&&(c+=e.length)}}else if(i==="ruby"){let s=[/\belsif\b/g,/\bunless\b/g,/\brescue\b/g,/\bwhen\b/g];for(let n of s){let e=t.match(n);e&&(c+=e.length)}}else if(i==="go"){let s=[/\bselect\b/g,/\bdefer\b/g];for(let n of s){let e=t.match(n);e&&(c+=e.length)}}return c}function P(o){return o.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*/g,"").replace(/#.*/g,"").replace(/"(?:[^"\\]|\\.)*"/g,'""').replace(/'(?:[^'\\]|\\.)*'/g,"''").replace(/`(?:[^`\\]|\\.)*`/g,"``")}export{I as a};
|
|
7
|
-
//# sourceMappingURL=chunk-C6PQLWHR.js.map
|
package/dist/chunk-DX5YEUX4.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{a as c}from"./chunk-H4IWC7KJ.js";import{existsSync as m}from"fs";import{basename as p,isAbsolute as f,join as g}from"path";function S(e,r){let t=u(e,r,{allowMultiple:!1})[0]?.relativePath;return t||v(e,r)}function M(e,r){return u(e,r,{allowMultiple:!0}).map(t=>t.relativePath)}function v(e,r){if(!r)return null;let t=r.replace(/\\/g,"/").replace(/^\.\//,""),a=f(t)&&t.startsWith(e.config.projectRoot)?t.slice(e.config.projectRoot.length).replace(/^\/+/,""):t,n=g(e.config.projectRoot,a);return m(n)?a:null}function u(e,r,t){let a=h(r);if(!a)return[];let i=e.all(`SELECT relative_path
|
|
2
|
-
FROM documents
|
|
3
|
-
WHERE 1 = 1
|
|
4
|
-
${e.pathExclusionsFor("documents")}
|
|
5
|
-
ORDER BY relative_path`).filter(o=>!e.isIgnored(o.relative_path)).map(o=>({relativePath:o.relative_path,score:d(o.relative_path,a)})).filter(o=>o.score>0).sort((o,l)=>l.score-o.score||o.relativePath.localeCompare(l.relativePath));if(i.length===0){let o=c(e,r);return!o||e.isIgnored(o.relativePath)?[]:[{relativePath:o.relativePath,score:700}]}let s=i.filter(o=>o.score>=800);return s.length>0?t.allowMultiple?s:[s[0]]:t.allowMultiple?i:[i[0]]}function d(e,r){let t=h(e),a=p(t),n=p(r),i=0;return t===r&&(i+=1200),t.endsWith(`/${r}`)&&(i+=1100),a===n&&(i+=900),t.startsWith(`${r}/`)&&(i+=850),t.includes(r)&&(i+=250),i}function h(e){return e.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"")}export{S as a,M as b};
|
|
6
|
-
//# sourceMappingURL=chunk-DX5YEUX4.js.map
|
package/dist/chunk-DXXROCSQ.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import{b as v}from"./chunk-F2TGKDMW.js";import{a as $}from"./chunk-5KWWENJZ.js";import{b as y,f as S,g as I}from"./chunk-ID7TO4P6.js";import{e as k}from"./chunk-VQXXSUQF.js";import{f as _}from"./chunk-QRULHDMO.js";import g from"path";function J(t,r){let{scope:s}=r??{},l=I(t,s),n=O(t,s),c=[];for(let[e,a]of l){if(m(e))continue;let u=n.get(e)??new Set;for(let o of a)if(!m(o)&&!u.has(o)){if(E(o)||R(t,e,o))continue;c.push({file:e,kind:"unused-import",description:`Depends on ${o} but references none of its symbols`,dep:o})}}let i=D(l);for(let[e,a]of l){if(m(e))continue;let u=h(e);for(let o of a){if(m(o))continue;let f=h(o);if(u===f)continue;i.get(`${u}->${f}`)==="violation"&&c.push({file:e,kind:"layer-violation",description:`Imports from ${f}/ (${o}) \u2014 may cross architectural boundary`,dep:o,detail:`${u}/ should not depend on ${f}/`})}}let p=new Map;for(let e of l.keys()){let a=g.dirname(e);p.has(a)||p.set(a,[]),p.get(a).push(e)}for(let[e,a]of p){let u=a.filter(f=>!m(f));if(u.length<5)continue;let o=new Map;for(let f of u)for(let d of l.get(f)??[])m(d)||o.set(d,(o.get(d)??0)+1);for(let f of u)for(let d of l.get(f)??[])m(d)||(o.get(d)??0)===1&&g.dirname(d)!==e&&g.dirname(d)!==g.dirname(e)&&c.push({file:f,kind:"pattern-deviation",description:`Only file in ${e}/ that depends on ${d}`,dep:d})}return{results:c,unusedImports:c.filter(e=>e.kind==="unused-import").length,layerViolations:c.filter(e=>e.kind==="layer-violation").length,patternDeviations:c.filter(e=>e.kind==="pattern-deviation").length}}function O(t,r){let s=r?`AND d1.relative_path LIKE '%${r}%'`:"",l=t.all(`SELECT DISTINCT d1.relative_path AS from_file, d2.relative_path AS to_file
|
|
2
|
-
FROM mentions m
|
|
3
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
4
|
-
JOIN documents d1 ON c.document_id = d1.id
|
|
5
|
-
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
6
|
-
JOIN (
|
|
7
|
-
SELECT m2.symbol_id, c2.document_id
|
|
8
|
-
FROM mentions m2
|
|
9
|
-
JOIN chunks c2 ON m2.chunk_id = c2.id
|
|
10
|
-
WHERE m2.role = 1
|
|
11
|
-
GROUP BY m2.symbol_id
|
|
12
|
-
) sym_def ON sym_def.symbol_id = gs.id
|
|
13
|
-
JOIN documents d2 ON sym_def.document_id = d2.id
|
|
14
|
-
WHERE d1.id != d2.id
|
|
15
|
-
AND m.role != 1
|
|
16
|
-
${t.pathExclusionsFor("d1","d2")}
|
|
17
|
-
${s}`),n=new Map;for(let i of l)t.isIgnored(i.from_file)||t.isIgnored(i.to_file)||(n.has(i.from_file)||n.set(i.from_file,new Set),n.get(i.from_file).add(i.to_file));let c=t.all(`SELECT relative_path FROM documents
|
|
18
|
-
WHERE 1 = 1 ${t.pathExclusionsFor("documents")}`);for(let i of c){if(t.isIgnored(i.relative_path)||!_(i.relative_path))continue;let p=S(t,i.relative_path),e=n.get(i.relative_path);for(let a of p.keys()){let u=v(t,i.relative_path,a);for(let o of u)o.relativePath!==i.relative_path&&(t.isIgnored(o.relativePath)||(e||(e=new Set,n.set(i.relative_path,e)),e.add(o.relativePath)))}if(_(i.relative_path)==="rust"){let a=y(t,i.relative_path);for(let u of a){let o=v(t,i.relative_path,u);for(let f of o)f.relativePath!==i.relative_path&&(t.isIgnored(f.relativePath)||(e||(e=new Set,n.set(i.relative_path,e)),e.add(f.relativePath)))}}}return n}function D(t){let r=new Map,s=new Set;for(let[n,c]of t){if(m(n))continue;let i=h(n);s.add(i);for(let p of c){if(m(p))continue;let e=h(p);if(i===e)continue;s.add(e);let a=`${i}->${e}`;r.set(a,(r.get(a)??0)+1)}}let l=new Map;for(let[n,c]of r)l.set(n,c<=2?"violation":"ok");return l}function h(t){let s=t.replace(/\\/g,"/").split("/").filter(Boolean);return s.length<=1?"(root)":s.length>=3&&["src","lib","app","server","client"].includes(s[0])?`${s[0]}/${s[1]}`:s[0]}function E(t){return t.includes("types")||t.endsWith(".d.ts")}function R(t,r,s){let l=k(t,r).filter(n=>n.sourcePath===s);return l.length===0?!1:l.every(n=>n.kind==="side-effect"||n.kind==="namespace"&&n.usedMembers.length===0&&!n.used)}function m(t){let r=$(t);return!!(r==="entry"||r==="barrel"||r==="test"||r==="worker"||N(g.basename(t)))}function N(t){return!!(t==="index.ts"||t==="index.js"||t==="cli.ts"||t==="main.ts"||t==="main.rs"||t.includes("worker.")||t.includes("postinstall.")||t==="health.ts"||t==="health.js")}export{J as a};
|
|
19
|
-
//# sourceMappingURL=chunk-DXXROCSQ.js.map
|
package/dist/chunk-EARGTC7U.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{a as y,b as A}from"./chunk-F2TGKDMW.js";import{d as C,e as B,f as $,g as W,h as H}from"./chunk-5KWWENJZ.js";import{c as M}from"./chunk-56LPZC3S.js";import{a as w,b as D,c as O,f as k}from"./chunk-ID7TO4P6.js";import{f as T,g as I,q as x,v as N}from"./chunk-QRULHDMO.js";import{b as L,f as R,g as E,h as P,i as F}from"./chunk-5IM4IQ6N.js";function se(t,a={}){let{scope:p,minLoc:c=1,includeTests:o=!1,skipBarrels:m=!1,includeMembers:s=!1}=a,n=m?new Set(C(t)):new Set,i=t.all(`SELECT
|
|
2
|
-
m.symbol_id,
|
|
3
|
-
d.relative_path,
|
|
4
|
-
COUNT(*) AS ref_count
|
|
5
|
-
FROM mentions m
|
|
6
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
7
|
-
JOIN documents d ON c.document_id = d.id
|
|
8
|
-
WHERE m.role != 1
|
|
9
|
-
${t.pathExclusionsFor("d")}
|
|
10
|
-
GROUP BY m.symbol_id, d.relative_path`),f=new Map;for(let e of i){if(t.isIgnored(e.relative_path)||n.has(e.relative_path))continue;let r=f.get(e.symbol_id);r||(r=new Map,f.set(e.symbol_id,r)),r.set(e.relative_path,e.ref_count)}V(t,f,n);let u=G(t),g=x(t,{scope:p}).filter(e=>!t.isIgnored(e.relativePath)).filter(e=>!E(e.symbol)).filter(e=>b(e.symbol)).filter(e=>e.isFunctionLike||!e.enclosingSymbol||!b(e.enclosingSymbol)).filter(e=>o||Y(e.relativePath)).filter(e=>o||!u(e.relativePath,e.startLine,e.symbol,e.parentTypeName)).filter(e=>!P(e.symbol)).filter(e=>!F(e.symbol)).filter(e=>s||b(e.symbol)).filter(e=>e.endLine-e.startLine+1>=c).map(e=>{let r=f.get(e.symbolId)??new Map,U=r.get(e.relativePath)??0,v=0;for(let[j,J]of r)j!==e.relativePath&&(v+=J);return{relative_path:e.relativePath,start_line:e.startLine,end_line:e.endLine,loc:e.endLine-e.startLine+1,symbol:e.symbol,same_file_refs:U,cross_file_refs:v}}).filter(e=>e.cross_file_refs===0).sort((e,r)=>r.loc-e.loc||e.relative_path.localeCompare(r.relative_path)||e.start_line-r.start_line),l=0,d=0,_=0,S=g.filter(e=>!t.isIgnored(e.relative_path)).filter(e=>!B(t,e.relative_path)).filter(e=>!$(t,e.symbol,e.relative_path)).map(e=>{let r=e.same_file_refs===0?"dead-code":"file-internal";return r==="dead-code"?l++:d++,_+=e.loc,{relativePath:e.relative_path,startLine:e.start_line,endLine:e.end_line,loc:e.loc,symbol:e.symbol,shortName:L(e.symbol),sameFileRefs:e.same_file_refs,kind:r}});return{symbols:S,totalCount:S.length,deadCodeCount:l,fileInternalCount:d,totalLoc:_}}function V(t,a,p){let c=t.all(`SELECT relative_path FROM documents
|
|
11
|
-
WHERE 1 = 1 ${t.pathExclusionsFor("documents")}`),o=new Set(c.map(n=>n.relative_path)),m=new Set(M(t));for(let n of o)m.add(n);let s=(n,i,f)=>{if(f<=0)return;let u=a.get(n);u||(u=new Map,a.set(n,u)),u.set(i,(u.get(i)??0)+f)};for(let n of m){if(!T(n)&&!I(n)||t.isIgnored(n)||p.has(n))continue;let i=k(t,n);for(let[h,g]of i){let l=A(t,n,h);if(l.length!==0)for(let d of l){let _=d.relativePath===n?Math.max(0,g.length-1):g.length;s(d.symbolId,n,_)}}let f=O(t,n);for(let h of f){let g=y(t,n,h);for(let l of g)l.relativePath!==n&&s(l.symbolId,n,1)}let u=D(t,n);for(let h of u){let g=y(t,n,h);for(let l of g)s(l.symbolId,n,1)}}}function G(t){let a=new Map,p=c=>{let o=a.get(c);if(o)return o;let m=w(t,c);return o={ranges:m.map(s=>({startLine:s.startLine,endLine:s.endLine})),containers:new Set(m.map(s=>s.containerName).filter(s=>!!s))},a.set(c,o),o};return(c,o,m,s)=>{let n=p(c);for(let i of n.ranges)if(o>=i.startLine&&o<=i.endLine)return!0;if(s&&n.containers.has(s))return!0;for(let i of N(m))if(n.containers.has(i))return!0;return!1}}function Y(t){return[...new Set([...W,...H])].every(p=>!q(t,p))}function q(t,a){return new RegExp(`^${a.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/%/g,".*").replace(/_/g,".")}$`).test(t)}function b(t){return R(t)||t.endsWith("().")||t.endsWith(".")}export{se as a};
|
|
12
|
-
//# sourceMappingURL=chunk-EARGTC7U.js.map
|
package/dist/chunk-EJXPKSWV.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import{b as m}from"./chunk-DX5YEUX4.js";import{p as a}from"./chunk-QRULHDMO.js";import{b as d,e as l}from"./chunk-5IM4IQ6N.js";function u(t,n){let s=m(t,n);if(s.length===0)return[];let i=s.map(()=>"?").join(", "),c=t.all(`SELECT DISTINCT d1.relative_path, gs.symbol
|
|
2
|
-
FROM mentions m
|
|
3
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
4
|
-
JOIN documents d1 ON c.document_id = d1.id
|
|
5
|
-
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
6
|
-
WHERE d1.relative_path NOT IN (${i})
|
|
7
|
-
AND (
|
|
8
|
-
EXISTS (
|
|
9
|
-
SELECT 1
|
|
10
|
-
FROM defn_enclosing_ranges der
|
|
11
|
-
JOIN documents d2 ON der.document_id = d2.id
|
|
12
|
-
WHERE der.symbol_id = gs.id
|
|
13
|
-
AND d2.relative_path IN (${i})
|
|
14
|
-
)
|
|
15
|
-
OR EXISTS (
|
|
16
|
-
SELECT 1
|
|
17
|
-
FROM mentions def_m
|
|
18
|
-
JOIN chunks def_c ON def_m.chunk_id = def_c.id
|
|
19
|
-
JOIN documents d2 ON def_c.document_id = d2.id
|
|
20
|
-
WHERE def_m.symbol_id = gs.id
|
|
21
|
-
AND def_m.role = 1
|
|
22
|
-
AND d2.relative_path IN (${i})
|
|
23
|
-
)
|
|
24
|
-
)
|
|
25
|
-
AND m.role != 1
|
|
26
|
-
AND ${t.localSymbolPredicate}
|
|
27
|
-
${t.pathExclusionsFor("d1")}
|
|
28
|
-
ORDER BY d1.relative_path`,...s,...s,...s),p=s.flatMap(e=>a(t,e).filter(o=>l(o.symbol)).map(o=>({relative_path:e,symbol:o.symbol}))),r=new Set;return[...c,...p].filter(e=>!t.isIgnored(e.relative_path)).filter(e=>{let o=`${e.relative_path}|${e.symbol}`;return r.has(o)?!1:(r.add(o),!0)}).map(e=>({consumer:e.relative_path,symbol:e.symbol,shortName:d(e.symbol)}))}export{u as a};
|
|
29
|
-
//# sourceMappingURL=chunk-EJXPKSWV.js.map
|
package/dist/chunk-EUHHVFTI.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as n}from"./chunk-H4IWC7KJ.js";import{p as l}from"./chunk-QRULHDMO.js";import{b as m,d as o,j as i}from"./chunk-5IM4IQ6N.js";function f(r,a){let t=n(r,a);return t?l(r,t.relativePath).filter(e=>e.symbol!==t.symbol).filter(e=>i(t.symbol,e.symbol)).sort((e,s)=>e.startLine-s.startLine||e.endLine-s.endLine).map(e=>({symbol:e.symbol,shortName:m(e.symbol),startLine:e.startLine,endLine:e.endLine,kind:o(e.symbol)??"unknown"})):[]}export{f as a};
|
|
2
|
-
//# sourceMappingURL=chunk-EUHHVFTI.js.map
|
package/dist/chunk-F2TGKDMW.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as u}from"./chunk-56LPZC3S.js";import{d as I,e as x,l as p}from"./chunk-ID7TO4P6.js";import{e as R}from"./chunk-VQXXSUQF.js";import{c as h}from"./chunk-H4IWC7KJ.js";import{d as b,p as S,t as y}from"./chunk-QRULHDMO.js";import{c as d}from"./chunk-5IM4IQ6N.js";function g(o,c,n){let e=p(o).get(n);if(!e||e.length===0)return[];if(e.length===1)return[l(e[0])];let i=e.filter(f=>f.file===c);if(i.length>0)return i.map(l);let t=P(o,c),r=t.get(n);if(r)for(let f of r){let s=e.filter(m=>D(f,m.file));if(s.length>0)return s.map(l)}let a=new Set;for(let f of t.values())for(let s of f)a.add(s);for(let f of a){let s=e.filter(m=>D(f,m.file));if(s.length>0&&s.length===e.length)return s.map(l)}return[]}function j(o,c,n){let e=g(o,c,n);if(e.length>0)return e;let i=p(o).get(n);return!i||i.length===0?[]:i.map(l)}function C(o,c){let n=h(o,c);if(!n)return[];let e=d(n.symbol);if(!e)return[];let i=new Map;for(let t of u(o)){let r=b(o,t);if(!r||r.indexOf(e)===-1||t!==n.relativePath&&!g(o,t,e).some(s=>s.symbolId===n.symbolId))continue;let a=I(o,t,e,t===n.relativePath?{excludeStartLine:n.startLine,excludeEndLine:n.endLine}:{});a.length>0&&i.set(t,a)}return w(o,i)}function E(o,c){let n=new Map;for(let t of c){if(!t.leaf)continue;let r=n.get(t.leaf)??[];r.push(t),n.set(t.leaf,r)}if(n.size===0)return new Map;let e=new Set(c.map(t=>t.symbolId)),i=new Map;for(let t of u(o)){let r=x(o,t);if(r.size!==0){for(let a of r)if(n.has(a))for(let f of g(o,t,a)){if(!e.has(f.symbolId)||t===f.relativePath)continue;let s=i.get(f.symbolId);s||(s=new Set,i.set(f.symbolId,s)),s.add(t)}}}return i}function P(o,c){let n=new Map;for(let e of R(o,c)){if(!e.sourcePath)continue;let i=e.localName??e.importedName;if(i){let t=n.get(i);t||(t=new Set,n.set(i,t)),t.add(e.sourcePath)}if(e.kind==="namespace")for(let t of e.usedMembers){let r=n.get(t);r||(r=new Set,n.set(t,r)),r.add(e.sourcePath)}}return n}function D(o,c){let n=e=>e.replace(/\\/g,"/").replace(/^\.\//,"");return n(o)===n(c)}function l(o){return{symbolId:o.symbolId,symbol:o.symbol,relativePath:o.file}}function w(o,c){let n=[],e=new Set;for(let[i,t]of c){let r=S(o,i);for(let a of t){let f=y(r,a),s=`${i}|${a}|${f?.symbol??""}`;e.has(s)||(e.add(s),n.push({file:i,line:a,enclosingSymbol:f?.symbol??null}))}}return n}export{g as a,j as b,C as c,E as d};
|
|
2
|
-
//# sourceMappingURL=chunk-F2TGKDMW.js.map
|
package/dist/chunk-GSVIC6KN.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as m}from"./chunk-H4IWC7KJ.js";import{p as l}from"./chunk-QRULHDMO.js";import{c as r,e as a}from"./chunk-5IM4IQ6N.js";import{basename as p}from"path";function M(t,c){let o=m(t,c);if(!o)return[];let s=r(o.symbol),i=l(t,o.relativePath).filter(e=>a(e.symbol)),n=i.filter(e=>e.parentTypeName===s||e.symbol.includes(s));return(n.length>0?n:f(p(o.relativePath))===s?i.filter(e=>e.symbol.includes("<invalid-global-code>")):[]).map(e=>({startLine:e.startLine,endLine:e.endLine,name:r(e.symbol)}))}function f(t){return t.replace(/\.[^.]+$/,"")}export{M as a};
|
|
2
|
-
//# sourceMappingURL=chunk-GSVIC6KN.js.map
|
package/dist/chunk-H4IWC7KJ.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import{u as p}from"./chunk-QRULHDMO.js";import{b as N,c as E,f as R,g as I}from"./chunk-5IM4IQ6N.js";function T(e,t){let n=v(e,t.trim());if(n)return n;let i=t.match(/^(.+):(\d+)-(\d+)$/);if(i){let[,c,_,h]=i,u=Math.max(0,parseInt(_,10)-1),f=Math.max(u,parseInt(h,10)-1),m=e.get(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.end_line, d.relative_path
|
|
2
|
-
FROM global_symbols gs
|
|
3
|
-
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
4
|
-
JOIN documents d ON der.document_id = d.id
|
|
5
|
-
WHERE d.relative_path LIKE ?
|
|
6
|
-
AND der.start_line <= ? AND der.end_line >= ?
|
|
7
|
-
${e.pathExclusionsFor("d")}
|
|
8
|
-
ORDER BY (der.end_line - der.start_line) ASC
|
|
9
|
-
LIMIT 1`,`%${c}%`,u,f);if(m||(m=e.get(`SELECT gs.id, gs.symbol, c.document_id, MIN(c.start_line) AS start_line, MAX(c.end_line) AS end_line, d.relative_path
|
|
10
|
-
FROM global_symbols gs
|
|
11
|
-
JOIN mentions m ON m.symbol_id = gs.id
|
|
12
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
13
|
-
JOIN documents d ON c.document_id = d.id
|
|
14
|
-
WHERE m.role = 1
|
|
15
|
-
AND d.relative_path LIKE ?
|
|
16
|
-
AND c.start_line <= ? AND c.end_line >= ?
|
|
17
|
-
${e.pathExclusionsFor("d")}
|
|
18
|
-
GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
|
|
19
|
-
ORDER BY (MAX(c.end_line) - MIN(c.start_line)) ASC
|
|
20
|
-
LIMIT 1`,`%${c}%`,u,f)),m&&!e.isIgnored(m.relative_path))return p(e,m)}let d=M(t),o=w(t),l=$(e,o),a=x(l,t,d);if(a&&!e.isIgnored(a.relative_path))return p(e,a);let r=null;for(let c of l){if(e.isIgnored(c.relative_path))continue;let _=D(c,t,d,o);_<=0||(!r||_>r.score)&&(r={row:c,score:_})}return r?p(e,r.row):null}function v(e,t){let i=e.get(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.end_line, d.relative_path
|
|
21
|
-
FROM global_symbols gs
|
|
22
|
-
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
23
|
-
JOIN documents d ON der.document_id = d.id
|
|
24
|
-
WHERE gs.symbol = ?
|
|
25
|
-
${e.pathExclusionsFor("d")}
|
|
26
|
-
ORDER BY d.relative_path, der.start_line
|
|
27
|
-
LIMIT 1`,t)??e.get(`SELECT
|
|
28
|
-
gs.id,
|
|
29
|
-
gs.symbol,
|
|
30
|
-
c.document_id,
|
|
31
|
-
MIN(c.start_line) AS start_line,
|
|
32
|
-
MAX(c.end_line) AS end_line,
|
|
33
|
-
d.relative_path
|
|
34
|
-
FROM global_symbols gs
|
|
35
|
-
JOIN mentions m ON m.symbol_id = gs.id
|
|
36
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
37
|
-
JOIN documents d ON c.document_id = d.id
|
|
38
|
-
WHERE gs.symbol = ?
|
|
39
|
-
AND m.role = 1
|
|
40
|
-
${e.pathExclusionsFor("d")}
|
|
41
|
-
GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path
|
|
42
|
-
ORDER BY d.relative_path, start_line
|
|
43
|
-
LIMIT 1`,t);return!i||e.isIgnored(i.relative_path)?null:p(e,i)}function W(e,t){if("symbol"in t&&"relativePath"in t)return t;let n=A(e,t.symbolId)[0];return n?p(e,n):null}function A(e,t){let n=e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.end_line, d.relative_path, gs.display_name
|
|
44
|
-
FROM global_symbols gs
|
|
45
|
-
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
46
|
-
JOIN documents d ON der.document_id = d.id
|
|
47
|
-
WHERE gs.id = ?
|
|
48
|
-
ORDER BY der.start_line, der.end_line`,t);return n.length>0?n:e.all(`SELECT
|
|
49
|
-
gs.id,
|
|
50
|
-
gs.symbol,
|
|
51
|
-
c.document_id,
|
|
52
|
-
MIN(c.start_line) AS start_line,
|
|
53
|
-
MAX(c.end_line) AS end_line,
|
|
54
|
-
d.relative_path,
|
|
55
|
-
gs.display_name
|
|
56
|
-
FROM global_symbols gs
|
|
57
|
-
JOIN mentions m ON m.symbol_id = gs.id
|
|
58
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
59
|
-
JOIN documents d ON c.document_id = d.id
|
|
60
|
-
WHERE gs.id = ?
|
|
61
|
-
AND m.role = 1
|
|
62
|
-
${e.pathExclusionsFor("d")}
|
|
63
|
-
GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path, gs.display_name
|
|
64
|
-
ORDER BY start_line, end_line`,t)}function $(e,t){let n=t.map(()=>"(gs.symbol LIKE ? OR d.relative_path LIKE ? OR COALESCE(gs.display_name, '') LIKE ?)"),i=t.flatMap(o=>{let l=`%${o}%`;return[l,l,l]}),d=e.all(`SELECT gs.id, gs.symbol, der.document_id, der.start_line, der.end_line, d.relative_path, gs.display_name
|
|
65
|
-
FROM global_symbols gs
|
|
66
|
-
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
67
|
-
JOIN documents d ON der.document_id = d.id
|
|
68
|
-
WHERE ${n.join(`
|
|
69
|
-
AND `)}
|
|
70
|
-
${e.pathExclusionsFor("d")}
|
|
71
|
-
LIMIT 200`,...i);return d.length>0?d:e.all(`SELECT
|
|
72
|
-
gs.id,
|
|
73
|
-
gs.symbol,
|
|
74
|
-
c.document_id,
|
|
75
|
-
MIN(c.start_line) AS start_line,
|
|
76
|
-
MAX(c.end_line) AS end_line,
|
|
77
|
-
d.relative_path,
|
|
78
|
-
gs.display_name
|
|
79
|
-
FROM global_symbols gs
|
|
80
|
-
JOIN mentions m ON m.symbol_id = gs.id
|
|
81
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
82
|
-
JOIN documents d ON c.document_id = d.id
|
|
83
|
-
WHERE m.role = 1
|
|
84
|
-
AND ${n.join(`
|
|
85
|
-
AND `)}
|
|
86
|
-
${e.pathExclusionsFor("d")}
|
|
87
|
-
GROUP BY gs.id, gs.symbol, c.document_id, d.relative_path, gs.display_name
|
|
88
|
-
LIMIT 200`,...i)}function D(e,t,n,i){let d=t.trim(),o=n,l=o.replace(/\(\)$/,""),a=t.toLowerCase(),r=n.toLowerCase(),c=r.replace(/\(\)$/,""),_=e.symbol,h=N(e.symbol),u=E(e.symbol),f=e.display_name??"",m=e.symbol.toLowerCase(),y=h.toLowerCase(),S=u.toLowerCase(),O=f.toLowerCase(),g=e.relative_path.toLowerCase(),L=/[/:.]/.test(n),s=0;return(_===d||_===o)&&(s+=1150),(h===d||h===o)&&(s+=1100),f===l&&(s+=980),u===l&&(s+=960),(`${u}()`===d||`${u}()`===o)&&(s+=955),(m===a||m===r)&&(s+=1e3),(y===a||y===r)&&(s+=950),(g===a||g===r)&&(s+=925),(g.endsWith(`/${r}`)||g.endsWith(`/${a}`))&&(s+=875),O===c&&(s+=850),S===c&&(s+=825),(`${S}()`===a||`${S}()`===r)&&(s+=820),(y.endsWith(`:${r}`)||y.endsWith(`:${c}`)||y.endsWith(`:${c}()`))&&(s+=800),m.includes(r)&&(s+=120),y.includes(r)&&(s+=140),g.includes(r)&&(s+=140),O.includes(r)&&(s+=110),i.every(C=>{let b=C.toLowerCase();return m.includes(b)||y.includes(b)||g.includes(b)||O.includes(b)})&&(s+=100+i.length*15),R(e.symbol)&&S===c&&(s+=60),!L&&I(e.symbol)&&(s-=160),s-=Math.min(50,Math.max(0,e.end_line-e.start_line)),s}function M(e){return e.trim().replace(/\(\)$/,"").replace(/\(.*$/,"")}function w(e){let t=M(e),n=t.split(/[^A-Za-z0-9_]+/).map(i=>i.trim()).filter(i=>i.length>0);return n.length>0?[...new Set(n)]:[t]}function x(e,t,n){let i=t.trim(),d=e.filter(o=>{let l=N(o.symbol),a=(o.display_name??"").trim();return o.symbol===i||l===i||l===n||a===i||a===n||`${a}()`===i||o.relative_path===i});return d.length===0?null:(d.sort((o,l)=>o.end_line-o.start_line-(l.end_line-l.start_line)||o.relative_path.localeCompare(l.relative_path)||o.symbol.localeCompare(l.symbol)),d[0]??null)}export{T as a,v as b,W as c};
|
|
89
|
-
//# sourceMappingURL=chunk-H4IWC7KJ.js.map
|
package/dist/chunk-H7BWAMFI.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{c as S}from"./chunk-F2TGKDMW.js";import{j as d}from"./chunk-ID7TO4P6.js";import{a as g}from"./chunk-H4IWC7KJ.js";import{d as u,n as m,o as f}from"./chunk-QRULHDMO.js";import{b as s,f as a}from"./chunk-5IM4IQ6N.js";function _(n,o){let e=g(n,o);if(!e)return{definitions:[],referencedBy:[]};let i=n.get("SELECT display_name, documentation FROM global_symbols WHERE id = ?",e.symbolId),t=f(i?.documentation??null),c=n.isIgnored(e.relativePath)?[]:[{relativePath:e.relativePath,startLine:e.startLine,endLine:e.endLine,signature:b(t,i?.display_name??null,e.symbol),source:y(n,e.relativePath,e.startLine,e.endLine)}],l=S(n,e),p=(l.length>0?l:d(n,e)).filter(r=>!n.isIgnored(r.file)).map(r=>({relativePath:r.file,line:r.line,enclosingSymbol:r.enclosingSymbol,enclosingShort:r.enclosingSymbol?s(r.enclosingSymbol):"(top-level)"}));return{definitions:c,referencedBy:p}}function y(n,o,e,i){let t=u(n,o);if(!t)return null;let l=t.split(`
|
|
2
|
-
`).slice(e,i+1).join(`
|
|
3
|
-
`).trimEnd();return l.length>0?l:null}function b(n,o,e){let i=m(n);if(i&&!h(i))return i;let t=(o??"").trim();return t?a(e)&&!t.endsWith("()")?`${t}()`:t:s(e)}function h(n){return n.startsWith("undefined")||n.includes("|")||n.includes("```")}export{_ as a};
|
|
4
|
-
//# sourceMappingURL=chunk-H7BWAMFI.js.map
|
package/dist/chunk-HUEIPY4M.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{d as T}from"./chunk-F2TGKDMW.js";import{m as I}from"./chunk-ID7TO4P6.js";import{d as k}from"./chunk-VQXXSUQF.js";import{a as M,d as y,e as D,f as P,h as w,j as A,r as C}from"./chunk-QRULHDMO.js";import{a as x,b as F,c as b}from"./chunk-5IM4IQ6N.js";function ie(t,s){let{scope:n,minLoc:r=3,maxLoc:i=80,limit:o=30,includeLowConfidence:c=!1}=s??{},a=E(t,n),l=C(t,n).filter(e=>e.isTypeLike&&L(e)>=r).filter(e=>L(e)<=i).filter(e=>!t.isIgnored(e.relativePath)).filter(e=>!$(e.symbol)).filter(e=>!D(t,e.relativePath,e.startLine)),f=I(t,l),u=T(t,l),g=q(f,u),d=new Map;for(let e of l){let m=d.get(e.relativePath);m||(m=new Map,d.set(e.relativePath,m));let p=b(e.symbol);p&&m.set(p,e)}return l.map(e=>{let p=[...g.get(e.symbolId)??new Set].filter(v=>v!==e.relativePath&&!t.isIgnored(v)),{realConsumers:h,barrelConsumers:S}=O(t,e.relativePath,e.symbol,p),R=U(t,e,g,d);return{definition:e,realConsumers:h,barrelConsumers:S,transitivelyReachable:R}}).filter(e=>!e.transitivelyReachable).filter(e=>e.realConsumers.length<=1).filter(e=>!(e.realConsumers.length===0&&e.barrelConsumers>0)).filter(e=>N(e.definition,e.realConsumers.length,a)).map(e=>{let m=G(t,e.definition.relativePath,e.definition.startLine),p=_(e.definition.relativePath)?!0:H(t,e.definition),{confidence:h,reason:S}=K(e.realConsumers.length,m,p);return{symbol:e.definition.symbol,shortName:F(e.definition.symbol),file:e.definition.relativePath,startLine:e.definition.startLine,endLine:e.definition.endLine,loc:L(e.definition),consumers:e.realConsumers.length,barrelConsumers:e.barrelConsumers,kind:m,definerUsesType:p,confidence:h,reason:S}}).filter(e=>c||e.confidence!=="low").sort((e,m)=>{let p={high:0,medium:1,low:2};return p[e.confidence]-p[m.confidence]||m.loc-e.loc||e.file.localeCompare(m.file)||e.startLine-m.startLine}).slice(0,o)}function E(t,s){return new Set(C(t,s).filter(n=>n.isFunctionLike).map(n=>n.relativePath))}function $(t){let s=x(t);if("kind"in s)return!1;let n=s.descriptors;if(n.length<2)return!1;let r=n[n.length-1],i=n[n.length-2];return r?.suffix==="type"&&i?.suffix==="type"}function _(t){let n=(t.split("/").pop()??"").replace(/\.[^.]+$/,"");return!!(n==="types"||n==="models"||n==="schema"||n==="common"||n==="protocol"||n==="proto"||n==="dto"||n==="mod"||/(^|\/)types(\/|\.)/.test(t)||/(^|\/)models?(\/|\.)/.test(t)||/(^|\/)proto(?:col)?(\/|\.)/.test(t)||/(^|\/)schema(\/|\.)/.test(t))}function N(t,s,n){return!(_(t.relativePath)&&s>0||s===0&&n.has(t.relativePath))}function O(t,s,n,r){let i=[],o=0,c=b(n);for(let a of r)z(t,a,s,c)||B(t,a,c)?o++:i.push(a);return{realConsumers:i,barrelConsumers:o}}function U(t,s,n,r){let i=A(t,s.relativePath),o=b(s.symbol);if(!o)return!1;let c=i.get(o);if(!c||c.size===0)return!1;let a=r.get(s.relativePath);if(!a)return!1;for(let l of c){let f=a.get(l);if(!f)continue;let u=n.get(f.symbolId);if(u){for(let g of u)if(g!==s.relativePath&&!t.isIgnored(g))return!0}}return!1}var j=M("stale-abs-file-usage");function B(t,s,n){if(!n)return!1;let r=P(s);if(!r)return!1;let i=j.get(t,s,()=>W(t,s,r));return i.importedLeaves.has(n)&&!i.usedLeaves.has(n)}function W(t,s,n){let r=new Set,i=new Set,o=w(t,s);if(!o)return{importedLeaves:r,usedLeaves:i};let c=n==="rust"?new Set(["use_declaration"]):n==="python"?new Set(["import_statement","import_from_statement"]):new Set(["import_statement"]),a=(l,f)=>{let u=f||c.has(l.type);(l.type==="identifier"||l.type==="type_identifier"||l.type==="property_identifier"||l.type==="field_identifier")&&(u?r.add(l.text):i.add(l.text));for(let g of l.children)a(g,u)};return a(o.rootNode,!1),{importedLeaves:r,usedLeaves:i}}function z(t,s,n,r){if(!r)return!1;let i=y(t,s);if(!i)return!1;let o=k(t,s);if(o.length===0)return!1;let c=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`\\b${c}\\b`),l=i.split(`
|
|
2
|
-
`),f=0;for(let u=0;u<l.length;u++){if(!a.test(l[u]??""))continue;if(f++,!o.find(d=>d.startLine<=u&&u<=d.endLine))return!1}return f>0}function G(t,s,n){let r=y(t,s);if(!r)return"other";let i=r.split(`
|
|
3
|
-
`),o=Math.max(0,n-2),c=Math.min(i.length-1,n+2);for(let a=o;a<=c;a++){let f=(i[a]??"").replace(/^\s*\/\/.*$/g,"");if(/\b(?:export\s+)?(?:abstract\s+)?class\s+\w/.test(f))return"class";if(/\b(?:export\s+)?interface\s+\w/.test(f))return"interface";if(/\b(?:export\s+)?type\s+\w/.test(f))return"type";if(/\b(?:export\s+)?(?:const\s+)?enum\s+\w/.test(f))return"enum"}return"other"}function H(t,s){let n=y(t,s.relativePath);if(!n)return!1;let r=b(s.symbol);if(!r)return!1;let i=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(`\\b${i}\\b`),c=n.split(`
|
|
4
|
-
`);for(let a=0;a<c.length;a++)if(!(a>=s.startLine&&a<=s.endLine)&&o.test(c[a]??""))return!0;return!1}function K(t,s,n){return t===0?{confidence:"high",reason:"unused \u2014 no consumers and defining file has no real usage"}:t===1&&s==="class"?{confidence:"low",reason:"1 consumer + class kind \u2014 likely 1:1 encapsulation, not over-abstraction"}:t===1&&!n?{confidence:"high",reason:"1 consumer + defining file never uses it \u2014 type belongs with its consumer"}:{confidence:"medium",reason:"1 consumer \u2014 single-use abstraction"}}function L(t){return t.endLine-t.startLine+1}function q(...t){let s=new Map;for(let n of t)for(let[r,i]of n){let o=s.get(r);o||(o=new Set,s.set(r,o));for(let c of i)o.add(c)}return s}export{ie as a};
|
|
5
|
-
//# sourceMappingURL=chunk-HUEIPY4M.js.map
|