scip-query 0.10.4 → 0.10.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/dist/chunk-ONPCQ2PM.js +6 -0
- package/dist/cli.js +181 -180
- package/dist/postinstall.js +1 -1
- package/dist/reindex-worker.js +8 -8
- package/dist/reindex.d.ts +1 -1
- package/dist/reindex.js +19 -19
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +1 -1
- package/dist/{scip-cli-a-xOztiK.d.ts → scip-cli-Bh1M_JPu.d.ts} +1 -1
- package/package.json +6 -3
- package/scripts/build-scip-windows.mjs +75 -0
- package/vendor/scip/LICENSE.scip +201 -0
- package/vendor/scip/README.md +6 -0
- package/vendor/scip/win32-arm64/scip.exe +0 -0
- package/vendor/scip/win32-x64/scip.exe +0 -0
- package/dist/chunk-NXIAHE7F.js +0 -5
package/dist/postinstall.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{
|
|
2
|
+
import{c as g,d as k,e as m,f}from"./chunk-ONPCQ2PM.js";import{existsSync as p,mkdirSync as L,symlinkSync as v,readlinkSync as b,unlinkSync as q}from"fs";import{join as e,dirname as y,resolve as d}from"path";import{homedir as u,platform as A}from"os";import{fileURLToPath as C}from"url";var H=A()==="win32",U=["scip-query","scip-query-setup","scip-adoption","scip-health-audit","scip-health-improve","scip-api-impact","concrete-plan","scip-ai-cleanup","scip-debug","scip-explore","scip-triage-issue","scip-diagram","scip-debloat","scip-doc-reconcile","scip-directory-architecture","scip-maintainability","scip-react-maintainability","scip-vue-maintainability","scip-verify","scip-language-playbook"];function N(i={}){let l=i.quiet?()=>{}:console.log,o=C(import.meta.url),h=d(y(o),"..","skills"),I=[e(u(),".claude","skills"),e(u(),".codex","skills"),e(u(),".agents","skills")],n={installed:[],skipped:[],alreadyLinked:[]};for(let r of I){let $=y(r);if(!p($))continue;L(r,{recursive:!0});let t=R(r);for(let s of U){let a=e(h,s),c=e(r,s);if(!p(a)){n.skipped.push(`${t}/${s}`);continue}if(p(c)){try{let x=b(c);if(d(x)===d(a)){n.alreadyLinked.push(`${t}/${s}`),l(` ok: ${s} \u2192 ${t} (already linked)`);continue}}catch{n.skipped.push(`${t}/${s}`),l(` skip: ${s} \u2192 ${t} (exists, not a symlink)`);continue}q(c)}v(a,c,H?"junction":"dir"),n.installed.push(`${t}/${s}`),l(` done: ${s} \u2192 ${t}`)}}return n}function R(i){return i.includes(".codex")?"Codex":i.includes(".agents")?"Agents":"Claude"}function S(){console.log("scip-query: installing skills...");let i=N({quiet:!1});if(i.installed.length+i.alreadyLinked.length>0&&console.log(`
|
|
3
3
|
${i.installed.length} skill(s) installed, ${i.alreadyLinked.length} already linked.`),!g())console.log(`
|
|
4
4
|
scip CLI not found on PATH. Attempting auto-install...`),f(console.log)||m();else{let o=k();console.log(`
|
|
5
5
|
scip CLI: ${o??"installed"}`)}console.log("")}S();
|
package/dist/reindex-worker.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
`)){if(!r)continue;let a=U(r).toLowerCase();a&&t.add(a)}return t}catch{return null}}function ke(e,n){return n?.length?n.some(t=>e.has(t)):!1}function _(e,n){let t=e.indexOf(n);t!==-1&&e.splice(t,1)}import{existsSync as z,readdirSync as De}from"fs";import{join as R}from"path";var Oe={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",J(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",J(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",z(r)?r:z(t)?t:n]}},defaultOutputPath:"index.scip",markerFiles:["composer.json"],installMethods:[],installUrl:"https://github.com/davidrjenni/scip-php/releases"}};function k(e){return Oe[e]}function J(e,n){let t;try{t=De(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 Le,writeFileSync as je}from"fs";import{create as D}from"@bufbuild/protobuf";import{deserializeSCIP as Ce,serializeSCIP as we,DocumentSchema as Ee,IndexSchema as $e,SymbolInformationSchema as Fe}from"@c4312/scip";function Be(e){if(e.length===0)throw new Error("Cannot merge zero SCIP indexes");if(e.length===1)return e[0];let n=Me(e),t=Ne(e.flatMap(a=>a.documents??[])),r=H(e.flatMap(a=>a.externalSymbols??[]));return D($e,{metadata:n,documents:t,externalSymbols:r})}function G(e,n){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let t=e.map(a=>Ce(Le(a))),r=Be(t);return je(n,Buffer.from(we(r))),{documentCount:r.documents.length,externalSymbolCount:r.externalSymbols.length,inputCount:e.length}}function Me(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 Ne(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(Ee,{language:r.language||t.language,relativePath:r.relativePath||t.relativePath,occurrences:[...r.occurrences,...t.occurrences],symbols:H([...r.symbols,...t.symbols]),text:_e(r.text,t.text),positionEncoding:r.positionEncoding||t.positionEncoding}))}return[...n.values()]}function H(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(Fe,{symbol:r.symbol,documentation:Te([...r.documentation,...t.documentation]),relationships:Ae([...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 Ae(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 _e(e,n){return e?n?e.length>=n.length?e:n:e:n}function Te(e){return[...new Set(e)]}import{readFileSync as Ue,writeFileSync as We}from"fs";import{create as X}from"@bufbuild/protobuf";import{deserializeSCIP as qe,DocumentSchema as ze,IndexSchema as Je,serializeSCIP as Ge,SymbolRole as He}from"@c4312/scip";function Q(e){let n;try{n=qe(Ue(e))}catch{return{removedDefinitionOccurrences:0,touchedDocuments:0}}let t=Xe(n);return t.removedDefinitionOccurrences>0&&We(e,Buffer.from(Ge(t.index))),{removedDefinitionOccurrences:t.removedDefinitionOccurrences,touchedDocuments:t.touchedDocuments}}function Xe(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&He.Definition)===0||n.has(o.symbol)?!0:(t+=1,!1));if(s.length===i.occurrences.length){a.push(i);continue}r+=1,a.push(X(ze,{language:i.language,relativePath:i.relativePath,occurrences:s,symbols:i.symbols,text:i.text,positionEncoding:i.positionEncoding}))}return{index:t===0?e:X(Je,{metadata:e.metadata,documents:a,externalSymbols:e.externalSymbols}),removedDefinitionOccurrences:t,touchedDocuments:r}}import{execFile as Qe}from"child_process";import{existsSync as x,renameSync as L,rmSync as j}from"fs";import{cpus as Ke}from"os";import{join as K}from"path";function Ve(e,n,t){if(!e.defaultOutputPath)return;let r=K(n,e.defaultOutputPath);t!==r&&x(r)&&L(r,t)}function Ye(e,n,t){if(!e.defaultOutputPath)return null;let r=K(n,e.defaultOutputPath);if(r===t)return null;let a=`${t}.default-output-backup`;return j(a,{force:!0}),x(r)?(L(r,a),{defaultOutputPath:r,backupPath:a}):{defaultOutputPath:r,backupPath:null}}function Ze(e){e&&(j(e.defaultOutputPath,{force:!0}),e.backupPath&&x(e.backupPath)&&L(e.backupPath,e.defaultOutputPath))}function en(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,Ke().length-1));return Math.max(1,Math.min(e,Math.floor(r)))}async function V(e,n,t,r){let a=e.filter(u=>u.config.defaultOutputPath),i=e.filter(u=>!u.config.defaultOutputPath),s=[],o=en(i.length,r),p=await tn(i,o,u=>O(u,n,t));if(o>1){let u=new Map;for(let c of p.filter(l=>l.skipped)){let l=i.find(h=>h.language===c.language);l&&(t(`Retrying ${l.language} indexer serially after parallel failure...`),u.set(l.language,await O(l,n,t)))}s.push(...p.map(c=>u.get(c.language)??c))}else s.push(...p);for(let u of a)s.push(await O(u,n,t));return s.sort((u,c)=>e.findIndex(l=>l.language===u.language)-e.findIndex(l=>l.language===c.language))}async function O(e,n,t){t(`Indexing ${e.language} with ${e.resolvedBinary}...`),j(e.scipPath,{force:!0});let r=Ye(e.config,n,e.scipPath);try{await nn(e.binary,e.args,{cwd:n,env:e.env,maxBuffer:50*1024*1024}),Ve(e.config,n,e.scipPath)}catch(a){let i=a instanceof Error?a.message:String(a),s=`${e.resolvedBinary} indexer failed: ${i.split(`
|
|
3
|
-
`)[0]}`;return t(`Skipping ${e.language}: ${s}`),{language:e.language,scipPath:e.scipPath,skipped:{language:e.language,reason:s}}}finally{
|
|
4
|
-
Install from: https://github.com/sourcegraph/scip/releases`);if(n("scip CLI not found on PATH. Attempting auto-install..."),!
|
|
5
|
-
Install manually from: https://github.com/sourcegraph/scip/releases`)}}function
|
|
1
|
+
import{a as I,b as R}from"./chunk-KPHKX4LP.js";import{a as h,b as v,f as _}from"./chunk-ONPCQ2PM.js";import{execFileSync as dn}from"child_process";import{closeSync as mn,copyFileSync as fn,existsSync as P,mkdirSync as M,mkdtempSync as hn,openSync as xn,readFileSync as se,renameSync as N,rmSync as A,writeFileSync as oe}from"fs";import{basename as S,dirname as d,extname as yn,join as g}from"path";import{execFileSync as he}from"child_process";import{existsSync as xe,readdirSync as U}from"fs";import{extname as W,join as q}from"path";var ye=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=[],t=Se(e),r=Re(e);for(let a of be){if(Pe(e,a.files)){n.push(a.language);continue}if(ve(t,a.globs)){n.push(a.language);continue}De(r,a.extensions)&&n.push(a.language)}return n.includes("typescript")&&T(n,"javascript"),n.includes("cpp")&&!r.has(".c")&&T(n,"c"),n}function Se(e){try{return U(e)}catch{return[]}}function Pe(e,n){return n?.length?n.some(t=>xe(q(e,t))):!1}function ve(e,n){return n?.length?e.some(t=>n.some(r=>Ie(t,r))):!1}function Ie(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 Re(e){let n=ke(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=U(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=q(a,s.name);if(s.isDirectory()){ye.has(s.name)||r.push(o);continue}let p=W(s.name).toLowerCase();p&&t.add(p)}}return t}function ke(e){try{let n=he("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=W(r).toLowerCase();a&&t.add(a)}return t}catch{return null}}function De(e,n){return n?.length?n.some(t=>e.has(t)):!1}function T(e,n){let t=e.indexOf(n);t!==-1&&e.splice(t,1)}import{existsSync as J,readdirSync as Oe}from"fs";import{join as k}from"path";var Le={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",G(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",G(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=k(e,"vendor","bin","scip-php"),r=k(e,"vendor","davidrjenni","scip-php","bin","scip-php");return{binary:"php",args:["-d","error_reporting=E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED",J(r)?r:J(t)?t:n]}},defaultOutputPath:"index.scip",markerFiles:["composer.json"],installMethods:[],installUrl:"https://github.com/davidrjenni/scip-php/releases"}};function D(e){return Le[e]}function G(e,n){let t;try{t=Oe(e)}catch{return null}for(let r of t)if(n.some(a=>r.endsWith(a)))return k(e,r);return null}import{readFileSync as Ce,writeFileSync as je}from"fs";import{create as O}from"@bufbuild/protobuf";import{deserializeSCIP as we,serializeSCIP as Ee,DocumentSchema as $e,IndexSchema as Be,SymbolInformationSchema as Fe}from"@c4312/scip";function Me(e){if(e.length===0)throw new Error("Cannot merge zero SCIP indexes");if(e.length===1)return e[0];let n=Ne(e),t=Ae(e.flatMap(a=>a.documents??[])),r=X(e.flatMap(a=>a.externalSymbols??[]));return O(Be,{metadata:n,documents:t,externalSymbols:r})}function H(e,n){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let t=e.map(a=>we(Ce(a))),r=Me(t);return je(n,Buffer.from(Ee(r))),{documentCount:r.documents.length,externalSymbolCount:r.externalSymbols.length,inputCount:e.length}}function Ne(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 Ae(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,O($e,{language:r.language||t.language,relativePath:r.relativePath||t.relativePath,occurrences:[...r.occurrences,...t.occurrences],symbols:X([...r.symbols,...t.symbols]),text:Te(r.text,t.text),positionEncoding:r.positionEncoding||t.positionEncoding}))}return[...n.values()]}function X(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,O(Fe,{symbol:r.symbol,documentation:Ue([...r.documentation,...t.documentation]),relationships:_e([...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 _e(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 Te(e,n){return e?n?e.length>=n.length?e:n:e:n}function Ue(e){return[...new Set(e)]}import{readFileSync as We,writeFileSync as qe}from"fs";import{create as Q}from"@bufbuild/protobuf";import{deserializeSCIP as ze,DocumentSchema as Je,IndexSchema as Ge,serializeSCIP as He,SymbolRole as Xe}from"@c4312/scip";function K(e){let n;try{n=ze(We(e))}catch{return{removedDefinitionOccurrences:0,touchedDocuments:0}}let t=Qe(n);return t.removedDefinitionOccurrences>0&&qe(e,Buffer.from(He(t.index))),{removedDefinitionOccurrences:t.removedDefinitionOccurrences,touchedDocuments:t.touchedDocuments}}function Qe(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&Xe.Definition)===0||n.has(o.symbol)?!0:(t+=1,!1));if(s.length===i.occurrences.length){a.push(i);continue}r+=1,a.push(Q(Je,{language:i.language,relativePath:i.relativePath,occurrences:s,symbols:i.symbols,text:i.text,positionEncoding:i.positionEncoding}))}return{index:t===0?e:Q(Ge,{metadata:e.metadata,documents:a,externalSymbols:e.externalSymbols}),removedDefinitionOccurrences:t,touchedDocuments:r}}import{execFile as Ke}from"child_process";import{existsSync as x,renameSync as C,rmSync as j}from"fs";import{cpus as Ve}from"os";import{join as V}from"path";function Ye(e,n,t){if(!e.defaultOutputPath)return;let r=V(n,e.defaultOutputPath);t!==r&&x(r)&&C(r,t)}function Ze(e,n,t){if(!e.defaultOutputPath)return null;let r=V(n,e.defaultOutputPath);if(r===t)return null;let a=`${t}.default-output-backup`;return j(a,{force:!0}),x(r)?(C(r,a),{defaultOutputPath:r,backupPath:a}):{defaultOutputPath:r,backupPath:null}}function en(e){e&&(j(e.defaultOutputPath,{force:!0}),e.backupPath&&x(e.backupPath)&&C(e.backupPath,e.defaultOutputPath))}function nn(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,Ve().length-1));return Math.max(1,Math.min(e,Math.floor(r)))}async function Y(e,n,t,r){let a=e.filter(u=>u.config.defaultOutputPath),i=e.filter(u=>!u.config.defaultOutputPath),s=[],o=nn(i.length,r),p=await rn(i,o,u=>L(u,n,t));if(o>1){let u=new Map;for(let c of p.filter(l=>l.skipped)){let l=i.find(f=>f.language===c.language);l&&(t(`Retrying ${l.language} indexer serially after parallel failure...`),u.set(l.language,await L(l,n,t)))}s.push(...p.map(c=>u.get(c.language)??c))}else s.push(...p);for(let u of a)s.push(await L(u,n,t));return s.sort((u,c)=>e.findIndex(l=>l.language===u.language)-e.findIndex(l=>l.language===c.language))}async function L(e,n,t){t(`Indexing ${e.language} with ${e.resolvedBinary}...`),j(e.scipPath,{force:!0});let r=Ze(e.config,n,e.scipPath);try{await tn(e.binary,e.args,{cwd:n,env:e.env,maxBuffer:50*1024*1024}),Ye(e.config,n,e.scipPath)}catch(a){let i=a instanceof Error?a.message:String(a),s=`${e.resolvedBinary} indexer failed: ${i.split(`
|
|
3
|
+
`)[0]}`;return t(`Skipping ${e.language}: ${s}`),{language:e.language,scipPath:e.scipPath,skipped:{language:e.language,reason:s}}}finally{en(r)}if(!x(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 tn(e,n,t){return new Promise((r,a)=>{Ke(e,[...n],t,i=>{i?a(i):r()})})}async function rn(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}import{execFileSync as E}from"child_process";import{existsSync as w,readFileSync as an}from"fs";import{createRequire as sn}from"module";import{platform as on}from"os";import{dirname as Z,join as y}from"path";var un=sn(import.meta.url);function $(e){return[e.indexerBinary,...e.binaryAliases??[]]}function B(e){let n=$(e);return n.length===1?n[0]:n.join(" or ")}function b(e){for(let n of $(e))if(h(n))return n;return pn(e)}function ee(e){return b(e)!==null||ln(e)}function ln(e){return ne(e)!==null}function pn(e){let n=ne(e);if(!n)return null;let r=JSON.parse(an(n,"utf8")).bin;if(!r)return null;if(typeof r=="string")return y(Z(n),r);for(let a of $(e)){let i=r[a];if(i)return y(Z(n),i)}return null}function ne(e){if(!e.bundledNpmPackage)return null;try{return un.resolve(`${e.bundledNpmPackage}/package.json`)}catch{return null}}function te(e,n){for(let t of e.projectLocalBinaries??[]){let r=y(n,t);if(w(r))return r}return null}function re(e,n=process.env,t=e.indexerBinary){if(e.indexerBinary!=="scip-dotnet"||ie(t,n))return n;let r=cn(t,n);return r?{...n,DOTNET_ROOT:r}:n}function ae(e,n){let t=e.installMethods,r=B(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(h(a.prerequisite)){n(`Installing ${r} via ${a.label}...`);try{E(a.binary,a.args,{stdio:"inherit",timeout:3e5,env:process.env});let i=b(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 cn(e,n){for(let t of gn(n))if(ie(e,{...n,DOTNET_ROOT:t}))return t;return null}function gn(e){let n=[],t=e.DOTNET_ROOT;if(t&&w(t)&&n.push(t),on()==="darwin"&&h("brew"))try{let r=E("brew",["--prefix","dotnet@9"],{stdio:"pipe",env:e}).toString().trim(),a=y(r,"libexec");w(a)&&!n.includes(a)&&n.push(a)}catch{}return n}function ie(e,n){try{return E(e,["--version"],{stdio:"pipe",env:n}),!0}catch{return!1}}async function ue(e){let{projectRoot:n,maxHeapMb:t=8192,onStatus:r=console.log,skipAutoInstall:a=!1}=e,i=bn(e),s=Date.now();M(d(i.outputScip),{recursive:!0}),M(d(i.outputDb),{recursive:!0});let o=e.languages??z(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 p=Nn(n,o,{pnpmWorkspaces:e.pnpmWorkspaces}),u=Fn(g(d(i.outputDb),"index.lock")),c=null;try{let l=Sn({opts:e,paths:i,languages:o,fingerprint:p,start:s,onStatus:r});if(l)return l;On(a,r);let f=Pn(i);return c=f.runDir,await vn({opts:e,languages:o,projectRoot:n,paths:i,tempPaths:f,fingerprint:p,start:s,maxHeapMb:t,skipAutoInstall:a,onStatus:r})}finally{c&&A(c,{recursive:!0,force:!0}),u()}}function bn(e){let n=e.outputScip??g(e.projectRoot,"index.scip"),t=e.outputDb??g(e.projectRoot,"index.db");return{outputScip:n,outputDb:t,metaPath:g(d(t),"meta.json")}}function Sn(e){if(e.opts.skipIfUnchanged===!1||!P(e.paths.outputScip)||!P(e.paths.outputDb)||!An(e.paths.metaPath,e.fingerprint))return null;I({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 Pn(e){let n=hn(g(d(e.outputDb),"reindex-"));return{runDir:n,tempOutputScip:g(n,S(e.outputScip)),tempOutputDb:g(n,S(e.outputDb)),tempMetaPath:g(n,S(e.metaPath))}}async function vn(e){let n={...process.env,NODE_OPTIONS:`--max-old-space-size=${e.maxHeapMb}`},{indexedOutputs:t,skippedLanguages:r,reusedLanguages:a}=await In(e,n);a.length>0&&e.onStatus(`Reused ${a.length} cached language shard(s): ${a.join(", ")}`),Rn(e,n,t,r);let i=Date.now()-e.start;return e.onStatus(`Done in ${(i/1e3).toFixed(1)}s`),{languages:t.map(s=>s.language),indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:i,reused:!1,skipped:r}}async function In(e,n){let t=kn(e),r=new Set(t.map(u=>u.language));for(let u of r)e.onStatus(`Reusing cached ${u} SCIP shard (language inputs unchanged).`);let{preparedRuns:a,skippedLanguages:i}=Ln({languages:e.languages.filter(u=>!r.has(u)),tempOutputScip:e.tempPaths.tempOutputScip,projectRoot:e.projectRoot,env:n,skipAutoInstall:e.skipAutoInstall,pnpmWorkspaces:e.opts.pnpmWorkspaces,onStatus:e.onStatus}),s=await Y(a,e.projectRoot,e.onStatus,e.opts.indexerConcurrency),{indexedOutputs:o}=jn(s,i),p=[...t,...o];return wn(p,i,e.languages,e.opts.allowPartial,e.onStatus),{indexedOutputs:p,skippedLanguages:i,reusedLanguages:[...r]}}function Rn(e,n,t,r){Dn(e.paths.outputDb,t),En(t,e.tempPaths.tempOutputScip,e.onStatus),$n(e.tempPaths.tempOutputScip,e.tempPaths.tempOutputDb,n,e.onStatus),I({projectRoot:e.projectRoot,dbPath:e.tempPaths.tempOutputDb,onStatus:e.onStatus}),_n(e.tempPaths.tempMetaPath,{version:3,status:r.length===0?"complete":"partial",updatedAt:new Date().toISOString(),fingerprint:e.fingerprint,languageFingerprints:le(e.projectRoot,e.languages,{pnpmWorkspaces:e.opts.pnpmWorkspaces}),requestedLanguages:e.languages,indexedLanguages:t.map(a=>a.language),skipped:[...r]}),Mn({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 kn(e){let n;try{n=JSON.parse(se(e.paths.metaPath,"utf-8"))}catch{return[]}if(n.version!==3||!n.languageFingerprints)return[];let t=[],r=le(e.projectRoot,e.languages,{pnpmWorkspaces:e.opts.pnpmWorkspaces});for(let a of e.languages){let i=pe(e.paths.outputDb,a);P(i)&&m(n.languageFingerprints[a])===m(r[a])&&t.push({language:a,scipPath:i})}return t}function Dn(e,n){for(let t of n){let r=pe(e,t.language);M(d(r),{recursive:!0}),t.scipPath!==r&&fn(t.scipPath,r)}}function On(e,n){if(!v()){if(e)throw new Error(`The scip CLI is required but not found on PATH.
|
|
4
|
+
Install from: https://github.com/sourcegraph/scip/releases`);if(n("scip CLI not found on PATH. Attempting auto-install..."),!_(n))throw new Error(`The scip CLI is required but could not be installed.
|
|
5
|
+
Install manually from: https://github.com/sourcegraph/scip/releases`)}}function Ln(e){let n=[],t=[],r=e.languages.map((a,i)=>({language:a,scipPath:e.languages.length>1?Bn(e.tempOutputScip,a,i):e.tempOutputScip}));for(let{language:a,scipPath:i}of r){let s=Cn({...e,language:a,scipPath:i});"skipped"in s?t.push(s.skipped):n.push(s.prepared)}return{preparedRuns:n,skippedLanguages:t}}function Cn(e){let n=D(e.language),t=B(n),r=te(n,e.projectRoot);if(!r&&!ee(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...`),!ae(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??b(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:re(n,e.env,a)}}}function jn(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 wn(e,n,t,r,a){if(e.length===0){let i=n.map(s=>` - ${s.language}: ${s.reason}`).join(`
|
|
6
6
|
`);throw new Error(`No language indexers ran successfully. Install at least one indexer for the languages in this project.
|
|
7
7
|
`+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.
|
|
8
8
|
`+n.map(i=>` - ${i.language}: ${i.reason}`).join(`
|
|
9
|
-
`))}function
|
|
10
|
-
`),()=>{try{
|
|
11
|
-
`)}function
|
|
9
|
+
`))}function En(e,n,t){e.length>1?(t(`Merging ${e.length} language indexes...`),H(e.map(r=>r.scipPath),n)):e[0].scipPath!==n&&N(e[0].scipPath,n)}function $n(e,n,t,r){if(r("Converting to SQLite..."),!P(e))throw new Error(`SCIP index not found at ${e} after indexing`);try{let a=K(e);a.removedDefinitionOccurrences>0&&r(`Sanitized ${a.removedDefinitionOccurrences} invalid definition occurrences across ${a.touchedDocuments} documents before SQLite conversion.`);let i=v();if(!i)throw new Error("scip CLI is not available");dn(i,["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 Bn(e,n,t){let r=yn(e)||".scip",a=S(e,r);return g(d(e),`${a}.${t+1}.${n}${r}`)}function Fn(e){let n;try{n=xn(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 oe(n,JSON.stringify({pid:process.pid,startedAt:new Date().toISOString()})+`
|
|
10
|
+
`),()=>{try{mn(n)}finally{A(e,{force:!0})}}}function Mn(e){F(e.tempOutputScip,e.outputScip),F(e.tempOutputDb,e.outputDb),F(e.tempMetaPath,e.metaPath)}function F(e,n){A(`${n}.tmp-replace`,{force:!0}),N(e,`${n}.tmp-replace`),N(`${n}.tmp-replace`,n)}function Nn(e,n,t){return{version:1,languages:[...n].sort(),pnpmWorkspaces:t.pnpmWorkspaces===!0,files:R(e)}}function le(e,n,t){return Object.fromEntries(n.map(r=>{let a=D(r).markerFiles;return[r,{version:1,languages:[r],pnpmWorkspaces:r==="typescript"&&t.pnpmWorkspaces===!0,files:R(e,{language:r,markerFiles:a})}]}))}function pe(e,n){return g(d(e),"language-indexes",`${n}.scip`)}function An(e,n){try{let t=JSON.parse(se(e,"utf-8"));return(t.version===2||t.version===3)&&t.status==="complete"&&m(t.fingerprint)===m(n)&&m([...t.indexedLanguages??[]].sort())===m(n.languages)}catch{return!1}}function _n(e,n){oe(e,`${JSON.stringify(n,null,2)}
|
|
11
|
+
`)}function m(e){return JSON.stringify(e)}var de=process.env.SCIP_REINDEX_PROJECT_ROOT,me=process.env.SCIP_REINDEX_OUTPUT_SCIP,fe=process.env.SCIP_REINDEX_OUTPUT_DB,ce=process.env.SCIP_REINDEX_LANGUAGES,Tn=process.env.SCIP_REINDEX_PNPM_WORKSPACES==="1";(!de||!me||!fe)&&(console.error("reindex-worker: missing required env vars"),process.exit(1));var ge=ce?ce.split(",").filter(Boolean):void 0;ue({projectRoot:de,outputScip:me,outputDb:fe,languages:ge?.length?ge:void 0,pnpmWorkspaces:Tn,onStatus:e=>process.stderr.write(`[reindex] ${e}
|
|
12
12
|
`)}).then(()=>{process.exit(0)}).catch(e=>{console.error(`reindex-worker error: ${e}`),process.exit(1)});
|
|
13
13
|
//# sourceMappingURL=reindex-worker.js.map
|
package/dist/reindex.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as SupportedLanguage, I as IndexerConfig } from './config-types-Bj4sh28g.js';
|
|
2
2
|
import { Index } from '@c4312/scip';
|
|
3
|
-
export { t as tryInstallScipCli } from './scip-cli-
|
|
3
|
+
export { t as tryInstallScipCli } from './scip-cli-Bh1M_JPu.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Detect which languages are present in a project directory by checking for
|
package/dist/reindex.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
VALUES (?, ?, NULL, ?)`),u=o.transaction(g=>{let l=0;for(let p of g){if(i.has(p))continue;let m=
|
|
3
|
-
`).filter(r=>r&&n.has(v(r).toLowerCase())).sort()}catch{return null}}function
|
|
4
|
-
`)){if(!r)continue;let o=
|
|
5
|
-
`).filter(Boolean)}catch{return null}}function
|
|
6
|
-
`)[0]}`;return t(`Skipping ${e.language}: ${s}`),{language:e.language,scipPath:e.scipPath,skipped:{language:e.language,reason:s}}}finally{
|
|
1
|
+
import{a as x,b as O,f as F}from"./chunk-ONPCQ2PM.js";import{a as ne}from"./chunk-UUBMFL3F.js";import{a as Z,b as ee}from"./chunk-OBBDKQAG.js";import"./chunk-64MNV6AB.js";import"./chunk-7S5E7KWT.js";import{execFileSync as ur}from"child_process";import{closeSync as cr,copyFileSync as lr,existsSync as w,mkdirSync as K,mkdtempSync as gr,openSync as pr,readFileSync as We,renameSync as Y,rmSync as Q,writeFileSync as Ge}from"fs";import{basename as C,dirname as f,extname as dr,join as d}from"path";import qe from"better-sqlite3";import{execFileSync as Xe}from"child_process";import{existsSync as Ke,readdirSync as Ye,readFileSync as Qe}from"fs";import{extname as v,join as te}from"path";function b(e){let n=new Set((e.extensions??Z).map(i=>i.toLowerCase()));if(n.size===0)return{scanned:0,inserted:0,existing:0};if(!Ke(e.dbPath))throw new Error(`SCIP SQLite database not found at ${e.dbPath}`);let t=ne(e.projectRoot),r=Ze(e.projectRoot,n).filter(i=>!t.isIgnored(i)),o=new qe(e.dbPath);try{let i=nn(o,r),s=o.prepare(`INSERT OR IGNORE INTO documents (language, relative_path, position_encoding, text)
|
|
2
|
+
VALUES (?, ?, NULL, ?)`),u=o.transaction(g=>{let l=0;for(let p of g){if(i.has(p))continue;let m=Qe(te(e.projectRoot,p),"utf-8"),ze=s.run(tn(p),p,m);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{o.close()}}function Ze(e,n){let t=en(e,n);if(t)return t;let r=[],o=i=>{let s=i?te(e,i):e,a;try{a=Ye(s,{withFileTypes:!0})}catch{return}for(let u of a){if(ee.has(u.name))continue;let c=i?`${i}/${u.name}`:u.name;if(u.isDirectory()){o(c);continue}n.has(v(u.name).toLowerCase())&&r.push(c)}};return o(""),r.sort()}function en(e,n){try{return Xe("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:26214400,stdio:["ignore","pipe","ignore"]}).split(`
|
|
3
|
+
`).filter(r=>r&&n.has(v(r).toLowerCase())).sort()}catch{return null}}function nn(e,n){let t=new Set,r=500;for(let o=0;o<n.length;o+=r){let i=n.slice(o,o+r),s=e.prepare(`SELECT relative_path FROM documents WHERE relative_path IN (${i.map(()=>"?").join(",")})`).all(...i);for(let a of s)t.add(a.relative_path)}return t}function tn(e){return v(e).toLowerCase()===".vue"?"vue":v(e).replace(/^\./,"").toLowerCase()||"source"}import{execFileSync as rn}from"child_process";import{existsSync as on,readdirSync as oe}from"fs";import{extname as ie,join as se}from"path";var sn=new Set([".git",".hg",".svn",".idea",".vscode","node_modules","vendor","dist","build","target","bin","obj",".dart_tool",".gradle",".next",".venv","venv","__pycache__"]),an=[{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 D(e){let n=[],t=un(e),r=pn(e);for(let o of an){if(cn(e,o.files)){n.push(o.language);continue}if(ln(t,o.globs)){n.push(o.language);continue}mn(r,o.extensions)&&n.push(o.language)}return n.includes("typescript")&&re(n,"javascript"),n.includes("cpp")&&!r.has(".c")&&re(n,"c"),n}function un(e){try{return oe(e)}catch{return[]}}function cn(e,n){return n?.length?n.some(t=>on(se(e,t))):!1}function ln(e,n){return n?.length?e.some(t=>n.some(r=>gn(t,r))):!1}function gn(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 pn(e){let n=dn(e);if(n)return n;let t=new Set,r=[e];for(;r.length>0;){let o=r.pop();if(!o)continue;let i;try{i=oe(o,{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=se(o,s.name);if(s.isDirectory()){sn.has(s.name)||r.push(a);continue}let u=ie(s.name).toLowerCase();u&&t.add(u)}}return t}function dn(e){try{let n=rn("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(`
|
|
4
|
+
`)){if(!r)continue;let o=ie(r).toLowerCase();o&&t.add(o)}return t}catch{return null}}function mn(e,n){return n?.length?n.some(t=>e.has(t)):!1}function re(e,n){let t=e.indexOf(n);t!==-1&&e.splice(t,1)}import{existsSync as ae,readdirSync as fn}from"fs";import{join as E}from"path";var ce={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",ue(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",ue(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=E(e,"vendor","bin","scip-php"),r=E(e,"vendor","davidrjenni","scip-php","bin","scip-php");return{binary:"php",args:["-d","error_reporting=E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED",ae(r)?r:ae(t)?t:n]}},defaultOutputPath:"index.scip",markerFiles:["composer.json"],installMethods:[],installUrl:"https://github.com/davidrjenni/scip-php/releases"}};function k(e){return ce[e]}function ue(e,n){let t;try{t=fn(e)}catch{return null}for(let r of t)if(n.some(o=>r.endsWith(o)))return E(e,r);return null}import{readFileSync as hn,writeFileSync as bn}from"fs";import{create as V}from"@bufbuild/protobuf";import{deserializeSCIP as yn,serializeSCIP as xn,DocumentSchema as Sn,IndexSchema as Rn,SymbolInformationSchema as vn}from"@c4312/scip";function le(e){if(e.length===0)throw new Error("Cannot merge zero SCIP indexes");if(e.length===1)return e[0];let n=kn(e),t=In(e.flatMap(o=>o.documents??[])),r=ge(e.flatMap(o=>o.externalSymbols??[]));return V(Rn,{metadata:n,documents:t,externalSymbols:r})}function T(e,n){if(e.length===0)throw new Error("Cannot merge zero SCIP files");let t=e.map(o=>yn(hn(o))),r=le(t);return bn(n,Buffer.from(xn(r))),{documentCount:r.documents.length,externalSymbolCount:r.externalSymbols.length,inputCount:e.length}}function kn(e){let n=e[0]?.metadata;if(!n)return;let t=n.projectRoot;for(let r of e.slice(1)){let o=r.metadata?.projectRoot;if(t&&o&&o!==t)throw new Error(`Cannot merge SCIP indexes with different project roots: ${t} vs ${o}`)}return n}function In(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,V(Sn,{language:r.language||t.language,relativePath:r.relativePath||t.relativePath,occurrences:[...r.occurrences,...t.occurrences],symbols:ge([...r.symbols,...t.symbols]),text:Ln(r.text,t.text),positionEncoding:r.positionEncoding||t.positionEncoding}))}return[...n.values()]}function ge(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,V(vn,{symbol:r.symbol,documentation:Cn([...r.documentation,...t.documentation]),relationships:Pn([...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 Pn(e){let n=new Set,t=[];for(let r of e){let o=[r.symbol,r.isReference?"1":"0",r.isImplementation?"1":"0",r.isTypeDefinition?"1":"0",r.isDefinition?"1":"0"].join("|");n.has(o)||(n.add(o),t.push(r))}return t}function Ln(e,n){return e?n?e.length>=n.length?e:n:e:n}function Cn(e){return[...new Set(e)]}import{execFileSync as wn}from"child_process";import{createHash as On}from"crypto";import{readdirSync as Fn,readFileSync as Dn}from"fs";import{join as de}from"path";function pe(e){return(Vn(e)??Tn(e)).filter(n=>n&&!me(n)).sort()}function S(e,n={}){return(n.language?pe(e).filter(r=>En(r,n.language,n.markerFiles)):pe(e)).map(r=>{let o=de(e,r);try{let i=Dn(o);return{path:r,size:i.byteLength,hash:On("sha256").update(i).digest("hex")}}catch{return{path:r,size:-1,hash:"unreadable"}}})}function En(e,n,t){let r=e.split("/").at(-1)??e;if(t?.includes(e)||t?.includes(r)||Mn.has(r))return!0;let o=e.includes(".")?`.${e.split(".").at(-1).toLowerCase()}`:"";return(Nn[n]??[]).includes(o)}function Vn(e){try{return wn("git",["-C",e,"ls-files","-co","--exclude-standard","--","."],{encoding:"utf-8",maxBuffer:50*1024*1024,stdio:["ignore","pipe","ignore"]}).split(`
|
|
5
|
+
`).filter(Boolean)}catch{return null}}function Tn(e){let n=[],t=[""];for(;t.length>0;){let r=t.pop(),o=r?de(e,r):e,i;try{i=Fn(o,{withFileTypes:!0})}catch{continue}for(let s of i){let a=r?`${r}/${s.name}`:s.name;if(s.isDirectory()){me(a)||t.push(a);continue}n.push(a)}}return n}function me(e){return e.split("/").some(t=>jn.has(t))||e.endsWith(".db")||e.endsWith(".db-wal")||e.endsWith(".db-shm")||e.endsWith(".scip")}var jn=new Set([".git","node_modules",".scipquery-cache",".stryker-tmp","dist","build","coverage",".next",".nuxt","target"]),Mn=new Set(["package.json","package-lock.json","pnpm-lock.yaml","yarn.lock","bun.lockb","tsconfig.json","tsconfig.base.json","pyproject.toml","setup.py","setup.cfg","Cargo.toml","Cargo.lock","go.mod","go.sum","pom.xml","build.gradle","build.gradle.kts","build.sbt","compile_commands.json","CMakeLists.txt","Makefile","Gemfile","Gemfile.lock","composer.json","composer.lock","pubspec.yaml","pubspec.lock"]),Nn={typescript:[".ts",".tsx",".mts",".cts"],javascript:[".js",".jsx",".mjs",".cjs"],java:[".java"],scala:[".scala"],kotlin:[".kt",".kts"],rust:[".rs"],python:[".py",".pyi"],ruby:[".rb"],go:[".go"],cpp:[".cc",".cpp",".cxx",".hpp",".hh",".hxx"],c:[".c",".h"],csharp:[".cs"],vb:[".vb"],dart:[".dart"],php:[".php"]};import{readFileSync as An,writeFileSync as _n}from"fs";import{create as fe}from"@bufbuild/protobuf";import{deserializeSCIP as $n,DocumentSchema as Bn,IndexSchema as Un,serializeSCIP as Wn,SymbolRole as Gn}from"@c4312/scip";function he(e){let n;try{n=$n(An(e))}catch{return{removedDefinitionOccurrences:0,touchedDocuments:0}}let t=Jn(n);return t.removedDefinitionOccurrences>0&&_n(e,Buffer.from(Wn(t.index))),{removedDefinitionOccurrences:t.removedDefinitionOccurrences,touchedDocuments:t.touchedDocuments}}function Jn(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,o=[];for(let i of e.documents){let s=i.occurrences.filter(a=>(a.symbolRoles&Gn.Definition)===0||n.has(a.symbol)?!0:(t+=1,!1));if(s.length===i.occurrences.length){o.push(i);continue}r+=1,o.push(fe(Bn,{language:i.language,relativePath:i.relativePath,occurrences:s,symbols:i.symbols,text:i.text,positionEncoding:i.positionEncoding}))}return{index:t===0?e:fe(Un,{metadata:e.metadata,documents:o,externalSymbols:e.externalSymbols}),removedDefinitionOccurrences:t,touchedDocuments:r}}import{execFile as Hn}from"child_process";import{existsSync as I,renameSync as M,rmSync as N}from"fs";import{cpus as zn}from"os";import{join as be}from"path";function qn(e,n,t){if(!e.defaultOutputPath)return;let r=be(n,e.defaultOutputPath);t!==r&&I(r)&&M(r,t)}function Xn(e,n,t){if(!e.defaultOutputPath)return null;let r=be(n,e.defaultOutputPath);if(r===t)return null;let o=`${t}.default-output-backup`;return N(o,{force:!0}),I(r)?(M(r,o),{defaultOutputPath:r,backupPath:o}):{defaultOutputPath:r,backupPath:null}}function Kn(e){e&&(N(e.defaultOutputPath,{force:!0}),e.backupPath&&I(e.backupPath)&&M(e.backupPath,e.defaultOutputPath))}function Yn(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,zn().length-1));return Math.max(1,Math.min(e,Math.floor(r)))}async function ye(e,n,t,r){let o=e.filter(c=>c.config.defaultOutputPath),i=e.filter(c=>!c.config.defaultOutputPath),s=[],a=Yn(i.length,r),u=await Zn(i,a,c=>j(c,n,t));if(a>1){let c=new Map;for(let g of u.filter(l=>l.skipped)){let l=i.find(p=>p.language===g.language);l&&(t(`Retrying ${l.language} indexer serially after parallel failure...`),c.set(l.language,await j(l,n,t)))}s.push(...u.map(g=>c.get(g.language)??g))}else s.push(...u);for(let c of o)s.push(await j(c,n,t));return s.sort((c,g)=>e.findIndex(l=>l.language===c.language)-e.findIndex(l=>l.language===g.language))}async function j(e,n,t){t(`Indexing ${e.language} with ${e.resolvedBinary}...`),N(e.scipPath,{force:!0});let r=Xn(e.config,n,e.scipPath);try{await Qn(e.binary,e.args,{cwd:n,env:e.env,maxBuffer:50*1024*1024}),qn(e.config,n,e.scipPath)}catch(o){let i=o instanceof Error?o.message:String(o),s=`${e.resolvedBinary} indexer failed: ${i.split(`
|
|
6
|
+
`)[0]}`;return t(`Skipping ${e.language}: ${s}`),{language:e.language,scipPath:e.scipPath,skipped:{language:e.language,reason:s}}}finally{Kn(r)}if(!I(e.scipPath)){let o=`${e.resolvedBinary} indexer completed but did not produce ${e.scipPath}`;return t(`Skipping ${e.language}: ${o}`),{language:e.language,scipPath:e.scipPath,skipped:{language:e.language,reason:o}}}return{language:e.language,scipPath:e.scipPath}}function Qn(e,n,t){return new Promise((r,o)=>{Hn(e,[...n],t,i=>{i?o(i):r()})})}async function Zn(e,n,t){if(e.length===0)return[];let r=new Array(e.length),o=0,i=Math.max(1,Math.min(e.length,n)),s=Array.from({length:i},async()=>{for(;o<e.length;){let a=o++;r[a]=await t(e[a])}});return await Promise.all(s),r}import{execFileSync as _}from"child_process";import{existsSync as A,readFileSync as et}from"fs";import{createRequire as nt}from"module";import{platform as tt}from"os";import{dirname as xe,join as P}from"path";var rt=nt(import.meta.url);function $(e){return[e.indexerBinary,...e.binaryAliases??[]]}function L(e){let n=$(e);return n.length===1?n[0]:n.join(" or ")}function R(e){for(let n of $(e))if(x(n))return n;return it(e)}function B(e){return R(e)!==null||ot(e)}function ot(e){return Se(e)!==null}function it(e){let n=Se(e);if(!n)return null;let r=JSON.parse(et(n,"utf8")).bin;if(!r)return null;if(typeof r=="string")return P(xe(n),r);for(let o of $(e)){let i=r[o];if(i)return P(xe(n),i)}return null}function Se(e){if(!e.bundledNpmPackage)return null;try{return rt.resolve(`${e.bundledNpmPackage}/package.json`)}catch{return null}}function U(e,n){for(let t of e.projectLocalBinaries??[]){let r=P(n,t);if(A(r))return r}return null}function W(e,n=process.env,t=e.indexerBinary){if(e.indexerBinary!=="scip-dotnet"||Re(t,n))return n;let r=st(t,n);return r?{...n,DOTNET_ROOT:r}:n}function G(e,n){let t=e.installMethods,r=L(e);if(!t?.length)return n(`No auto-install method available for ${r}.`),e.installUrl&&n(`Install manually from: ${e.installUrl}`),!1;for(let o of t)if(x(o.prerequisite)){n(`Installing ${r} via ${o.label}...`);try{_(o.binary,o.args,{stdio:"inherit",timeout:3e5,env:process.env});let i=R(e);if(i){let s=i===e.indexerBinary?"":` (using ${i})`;return n(`Successfully installed ${r} via ${o.label}${s}`),!0}n(`${o.label} command completed but ${r} was not found on PATH`)}catch(i){let s=i instanceof Error?i.message:String(i);n(`${o.label} install failed: ${s}`)}}return n(`Could not auto-install ${r}.`),e.installUrl&&n(`Install manually from: ${e.installUrl}`),!1}function st(e,n){for(let t of at(n))if(Re(e,{...n,DOTNET_ROOT:t}))return t;return null}function at(e){let n=[],t=e.DOTNET_ROOT;if(t&&A(t)&&n.push(t),tt()==="darwin"&&x("brew"))try{let r=_("brew",["--prefix","dotnet@9"],{stdio:"pipe",env:e}).toString().trim(),o=P(r,"libexec");A(o)&&!n.includes(o)&&n.push(o)}catch{}return n}function Re(e,n){try{return _(e,["--version"],{stdio:"pipe",env:n}),!0}catch{return!1}}import Bt from"better-sqlite3";import{existsSync as Ut,readFileSync as Wt,writeFileSync as Gt}from"fs";import{dirname as Jt,join as Ht,resolve as zt}from"path";import{readFileSync as ut,rmSync as ct,statSync as lt,mkdtempSync as gt}from"fs";import{cpus as pt,tmpdir as dt}from"os";import{join as J}from"path";import{Worker as mt}from"worker_threads";function ve(e){return e.length>=8&&Ie(e.length)>1}function ke(e){let n=Ie(e.vueFiles.length),t=ht(e.vueFiles),r=yt(t,n),o=new URL("./augment-vue-worker.js",import.meta.url),i=gt(J(dt(),"scip-query-vue-workers-")),s=new SharedArrayBuffer(4),a=new Int32Array(s),u=ft(),c=Date.now();try{for(let l=0;l<r.length;l++)new mt(o,{workerData:{projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,tasks:r[l],resultPath:J(i,`${l}.json`),sharedBuffer:s}});for(;Atomics.load(a,0)<r.length;){if(Date.now()-c>u)throw new Error(`Vue reference workers timed out after ${(u/1e3).toFixed(0)}s`);Atomics.wait(a,0,Atomics.load(a,0),100)}let g=r.map((l,p)=>{let m=JSON.parse(ut(J(i,`${p}.json`),"utf-8"));if(!m.ok)throw new Error(`Vue reference worker failed: ${m.error}`);return m.result});return{occurrences:g.flatMap(l=>l.occurrences),skippedReferences:g.reduce((l,p)=>l+p.skippedReferences,0)}}finally{ct(i,{recursive:!0,force:!0})}}function Ie(e){let n=Number(process.env.SCIP_QUERY_AUGMENT_VUE_WORKERS??0),t=Number.isFinite(n)&&n>0?n:Math.min(8,Math.max(1,pt().length-1));return Math.max(1,Math.min(e,t))}function ft(){let e=Number(process.env.SCIP_QUERY_AUGMENT_VUE_WORKER_TIMEOUT_MS??0);return Number.isFinite(e)&&e>0?e:3e5}function ht(e){let n=bt(),t=[];for(let r of e){let o=Pe(r),i=Math.max(1,Math.ceil(o/n));for(let s=0;s<i;s++)t.push({fileName:r,startOffset:Math.floor(o*s/i),endOffset:s===i-1?Number.POSITIVE_INFINITY:Math.floor(o*(s+1)/i),countFileSkip:s===0})}return t}function bt(){return Number.POSITIVE_INFINITY}function yt(e,n){let t=Array.from({length:n},()=>({tasks:[],weight:0})),r=e.map(o=>({task:o,weight:xt(o)})).sort((o,i)=>i.weight-o.weight);for(let o of r){let i=t.reduce((s,a)=>a.weight<s.weight?a:s);i.tasks.push(o.task),i.weight+=o.weight}return t.map(o=>o.tasks).filter(o=>o.length>0)}function xt(e){return Number.isFinite(e.endOffset)?Math.max(1,e.endOffset-e.startOffset):Math.max(1,Pe(e.fileName)-e.startOffset)}function Pe(e){try{return lt(e).size}catch{return 1}}import{createRequire as St}from"module";import{existsSync as Rt,readFileSync as z}from"fs";import{dirname as Le,extname as vt,join as Ce,relative as kt,resolve as It}from"path";import{pathToFileURL as Pt}from"url";function Lt(e){e.transaction(()=>{e.prepare(`
|
|
7
7
|
DELETE FROM mentions
|
|
8
8
|
WHERE chunk_id IN (
|
|
9
9
|
SELECT c.id
|
|
@@ -18,12 +18,12 @@ import{a as h,e as O}from"./chunk-NXIAHE7F.js";import{a as ee}from"./chunk-UUBMF
|
|
|
18
18
|
FROM documents
|
|
19
19
|
WHERE language = 'vue' OR relative_path LIKE '%.vue'
|
|
20
20
|
)
|
|
21
|
-
`).run()})()}function
|
|
21
|
+
`).run()})()}function we(e,n){return e.prepare(`
|
|
22
22
|
SELECT relative_path AS relativePath
|
|
23
23
|
FROM documents
|
|
24
24
|
WHERE language = 'vue' OR relative_path LIKE '%.vue'
|
|
25
25
|
ORDER BY relative_path
|
|
26
|
-
`).all().map(r=>
|
|
26
|
+
`).all().map(r=>It(n,r.relativePath))}function Oe(e,n){let{vueCore:t,ts:r,volarTs:o}=Ct(e),{parsed:i,vueOptions:s}=wt(t,r,n),a=Le(n),u=t.createVueLanguagePlugin(r,i.options,s,m=>m),c=Ot(t,r,u),g=Ft(a,i),{languageServiceHost:l}=o.createLanguageServiceHost(r,r.sys,c,m=>m,g),p=r.createLanguageService(l);return{ts:r,language:c,languageService:p,fileNames:i.fileNames,configDir:a}}function Ct(e){let n=St(Pt(Ce(e,"package.json")).href);return{vueCore:H(n,"@vue/language-core",e),ts:H(n,"typescript",e),volarTs:H(n,"@volar/typescript",e)}}function wt(e,n,t){let r=n.readConfigFile(t,n.sys.readFile);if(r.error||!r.config)throw new Error(`Failed to read ${t}`);let i=e.createParsedCommandLine(n,n.sys,t).vueOptions;return typeof e.createGlobalTypesWriter=="function"&&(i.globalTypesPath=e.createGlobalTypesWriter(i,n.sys.writeFile)),{parsed:n.parseJsonConfigFileContent(r.config,n.sys,Le(t),void 0,t,void 0,e.getAllExtensions(i).map(s=>({extension:s.slice(1),isMixedContent:!0,scriptKind:n.ScriptKind.Deferred}))),vueOptions:i}}function Ot(e,n,t){let r={},o=e.createLanguage([t],new Map,i=>{if(!Rt(i))return;let s=z(i,"utf-8");r.current?.scripts.set(i,n.ScriptSnapshot.fromString(s),t.getLanguageId(i)??Mt(i))});return r.current=o,o}function Ft(e,n){return{getCurrentDirectory:()=>e,getCompilationSettings:()=>n.options,getScriptFileNames:()=>n.fileNames,getProjectReferences:()=>n.projectReferences,getProjectVersion:()=>"0"}}function H(e,n,t){try{return e(n)}catch(r){throw(typeof r=="object"&&r!==null&&"code"in r?r.code:null)==="MODULE_NOT_FOUND"?new Error(`Vue augmentation requires ${n} to be installed in ${t}. Install Vue/Volar dependencies for that project, then rerun augment-vue.`,{cause:r}):r}}function Fe(e,n,t){let r=Dt(e);return o=>{let i=h(n,o.fileName),s=t.get(o.fileName);if(!s)return null;let a=t.positionAt(s,o.textSpan.start),u=r.get(i);if(!u)return null;let c=u.containingByLine.get(a.line);return c!==void 0?c:Et(u.starts,a.line,2)}}function Dt(e){let n=e.prepare(`
|
|
27
27
|
SELECT
|
|
28
28
|
d.relative_path AS relativePath,
|
|
29
29
|
der.start_line AS startLine,
|
|
@@ -32,23 +32,23 @@ import{a as h,e as O}from"./chunk-NXIAHE7F.js";import{a as ee}from"./chunk-UUBMF
|
|
|
32
32
|
FROM defn_enclosing_ranges der
|
|
33
33
|
JOIN documents d ON d.id = der.document_id
|
|
34
34
|
ORDER BY d.relative_path, (der.end_line - der.start_line) DESC
|
|
35
|
-
`).all(),t=new Map;for(let r of n){let o=t.get(r.relativePath);o||(o={containingByLine:new Map,starts:[]},t.set(r.relativePath,o)),o.starts.push({line:r.startLine,symbolId:r.symbolId});for(let i=r.startLine;i<=r.endLine;i++)o.containingByLine.set(i,r.symbolId)}for(let r of t.values())r.starts.sort((o,i)=>o.line-i.line);return t}function
|
|
35
|
+
`).all(),t=new Map;for(let r of n){let o=t.get(r.relativePath);o||(o={containingByLine:new Map,starts:[]},t.set(r.relativePath,o)),o.starts.push({line:r.startLine,symbolId:r.symbolId});for(let i=r.startLine;i<=r.endLine;i++)o.containingByLine.set(i,r.symbolId)}for(let r of t.values())r.starts.sort((o,i)=>o.line-i.line);return t}function Et(e,n,t){let r=0,o=e.length-1;for(;r<=o;){let s=Math.floor((r+o)/2);e[s].line<n?r=s+1:o=s-1}let i=null;for(let s of[o,r]){let a=e[s];if(!a)continue;let u=Math.abs(a.line-n);u>t||(!i||u<i.distance)&&(i={distance:u,symbolId:a.symbolId})}return i?.symbolId??null}function De(e,n,t){let r=_t(n),o=e.prepare("SELECT id FROM global_symbols WHERE symbol = ?"),i=e.prepare(`
|
|
36
36
|
INSERT OR IGNORE INTO global_symbols (symbol, display_name, kind, documentation)
|
|
37
37
|
VALUES (?, ?, ?, ?)
|
|
38
|
-
`),s=0,a=new Map;return e.transaction(()=>{for(let c of t){let g=
|
|
38
|
+
`),s=0,a=new Map;return e.transaction(()=>{for(let c of t){let g=h(n,c),l=$e(r.name,r.version,g);i.run(l,"default",7,`Vue component|${g}`);let p=$t(o,r,n,c);p&&(s++,a.set(c,p))}})(),{get(c){return a.get(c)??null},syntheticSymbols:s}}function Ee(e,n,t,r,o){return e.transaction(()=>(Lt(e),Vt(e,n,t,r),Tt(e,o)))()}function Vt(e,n,t,r){let o=e.prepare("SELECT id FROM documents WHERE relative_path = ?"),i=e.prepare(`
|
|
39
39
|
INSERT INTO chunks (document_id, chunk_index, start_line, end_line, occurrences)
|
|
40
40
|
VALUES (?, ?, ?, ?, X'00')
|
|
41
41
|
`),s=e.prepare(`
|
|
42
42
|
INSERT OR IGNORE INTO mentions (chunk_id, symbol_id, role)
|
|
43
43
|
VALUES (?, ?, 1)
|
|
44
|
-
`);for(let a of t){let u=r.get(a);if(!u)continue;let c=
|
|
44
|
+
`);for(let a of t){let u=r.get(a);if(!u)continue;let c=h(n,a),g=o.get(c);if(!g)continue;let l=i.run(g.id,-1,0,0);s.run(Number(l.lastInsertRowid),u)}}function Ve(e,n,t,r,o){if(e.fileName.endsWith(".vue")){let i=r.language.scripts.get(e.fileName),s=i?.generated?.languagePlugin.typescript?.getServiceScript(i.generated.root)?.code;if(i&&s){let a=r.language.maps.get(s,i);if(q(a,e.textSpan.start)!==null)return t.get(e.fileName)}return e.fileName.startsWith(o)?t.get(e.fileName):null}return n(e)}function Te(e){let n=new Set,t=[];for(let r of e){let o=je(r);n.has(o)||(n.add(o),t.push(r))}return t}function je(e){return[e.sourceFile,e.sourceLine,e.sourceStartChar,e.sourceEndChar,e.symbolId].join(":")}function Tt(e,n){let t=At(e,[...new Set(n.map(u=>u.sourceFile))]),r=e.prepare(`
|
|
45
45
|
INSERT INTO chunks (document_id, chunk_index, start_line, end_line, occurrences)
|
|
46
46
|
VALUES (?, ?, ?, ?, X'00')
|
|
47
47
|
`),o=e.prepare(`
|
|
48
48
|
INSERT OR IGNORE INTO mentions (chunk_id, symbol_id, role)
|
|
49
49
|
VALUES (?, ?, 0)
|
|
50
|
-
`),i=new Set,s=0,a=0;for(let u of n){let c=
|
|
51
|
-
`)}function
|
|
50
|
+
`),i=new Set,s=0,a=0;for(let u of n){let c=je(u);if(i.has(c))continue;i.add(c);let g=t.get(u.sourceFile);if(!g)continue;let l=r.run(g,a++,u.sourceLine,u.sourceLine),p=o.run(Number(l.lastInsertRowid),u.symbolId);s+=Number(p.changes)}return s}function*Me(e){let n=/\b[A-Za-z_$][A-Za-z0-9_$]*\b/g,t=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=n.exec(e);){let o=r[0];t.has(o)||(yield{text:o,start:r.index,end:r.index+o.length})}}function Ne(e,n){for(let[t]of e.toGeneratedLocation(n,r=>!!r.navigation))return t;return null}function q(e,n){let t=e;for(let[r]of t.toSourceLocation(n,o=>!!o.navigation))return r;return null}function jt(e,n){let t=0,r=e.lineStarts.length-1;for(;t<=r;){let i=Math.floor((t+r)/2);e.lineStarts[i]<=n?t=i+1:r=i-1}let o=Math.max(0,r);return{line:o,character:n-e.lineStarts[o]}}function Ae(e,n){return h(e,n).startsWith("node_modules/")}function h(e,n){return kt(e,n).replaceAll("\\","/")}function Mt(e){switch(vt(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 _e(){let e=new Map;return{get(n){if(e.has(n))return e.get(n)??null;try{let t=z(n,"utf-8"),r={text:t,lineStarts:Nt(t)};return e.set(n,r),r}catch{return e.set(n,null),null}},positionAt:jt}}function Nt(e){let n=[0];for(let t=0;t<e.length;t++)e.charCodeAt(t)===10&&n.push(t+1);return n}function At(e,n){let t=new Map,r=500;for(let o=0;o<n.length;o+=r){let i=n.slice(o,o+r),s=e.prepare(`SELECT id, relative_path AS relativePath FROM documents WHERE relative_path IN (${i.map(()=>"?").join(",")})`).all(...i);for(let a of s)t.set(a.relativePath,a.id)}return t}function _t(e){try{let n=JSON.parse(z(Ce(e,"package.json"),"utf-8"));return{name:n.name??"workspace",version:n.version??"0.0.0"}}catch{return{name:"workspace",version:"0.0.0"}}}function $t(e,n,t,r){let o=h(t,r),i=$e(n.name,n.version,o);return e.get(i)?.id??null}function $e(e,n,t){let r=t.split("/").map(o=>`\`${o.replaceAll("`","")}\``).join("/");return`scip-vue npm ${e} ${n} ${r}/default.`}function qt(e){b({projectRoot:e.projectRoot,dbPath:e.dbPath});let n=zt(e.projectRoot,e.tsconfig);if(!Ut(n))throw new Error(`Vue tsconfig not found at ${n}`);let t=new Bt(e.dbPath);try{let r=we(t,e.projectRoot),o=Ht(Jt(e.dbPath),"augment-vue-meta.json"),i=Be(t,e.projectRoot,e.tsconfig),s=Xt(o,i,e.onStatus);if(s)return s;let a=Kt({db:t,projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,configPath:n,vueFiles:r,onStatus:e.onStatus});return Zt(o,Be(t,e.projectRoot,e.tsconfig),a),a}finally{t.close()}}function Xt(e,n,t){let r=Qt(e,n);return r&&t?.(`Vue references unchanged; reused ${r.resolvedReferences} cached resolved references.`),r}function Kt(e){let n=De(e.db,e.projectRoot,e.vueFiles),t=Yt(e,n),r=Te(t.occurrences),o=Ee(e.db,e.projectRoot,e.vueFiles,n,r),i={vueFiles:e.vueFiles.length,resolvedReferences:r.length,insertedMentions:o,skippedReferences:t.skippedReferences,syntheticSymbols:n.syntheticSymbols};return e.onStatus?.(`Resolved ${i.resolvedReferences} Vue references with Volar; inserted ${i.insertedMentions} mentions.`),i}function Yt(e,n){if(ve(e.vueFiles))return ke({projectRoot:e.projectRoot,dbPath:e.dbPath,tsconfig:e.tsconfig,vueFiles:e.vueFiles});let t=er({db:e.db,projectRoot:e.projectRoot,configPath:e.configPath,vueSymbolLookup:n});return nr({...t,vueFiles:t.context.fileNames.filter(r=>r.endsWith(".vue"))})}function Qt(e,n){try{let t=JSON.parse(Wt(e,"utf-8"));return JSON.stringify(t.fingerprint)===JSON.stringify(n)?t.result:null}catch{return null}}function Zt(e,n,t){Gt(e,JSON.stringify({updatedAt:new Date().toISOString(),fingerprint:n,result:t},null,2)+`
|
|
51
|
+
`)}function Be(e,n,t){let r=e.prepare(`
|
|
52
52
|
SELECT
|
|
53
53
|
(SELECT COUNT(*) FROM documents) AS documents,
|
|
54
54
|
(SELECT COUNT(*) FROM global_symbols) AS symbols,
|
|
@@ -57,13 +57,13 @@ import{a as h,e as O}from"./chunk-NXIAHE7F.js";import{a as ee}from"./chunk-UUBMF
|
|
|
57
57
|
(SELECT COUNT(*) FROM defn_enclosing_ranges) AS ranges,
|
|
58
58
|
(SELECT MAX(id) FROM chunks) AS maxChunkId,
|
|
59
59
|
(SELECT MAX(id) FROM global_symbols) AS maxSymbolId
|
|
60
|
-
`).get();return{version:2,tsconfig:t,files:S(n),db:r}}function
|
|
61
|
-
Install from: https://github.com/sourcegraph/scip/releases`);if(n("scip CLI not found on PATH. Attempting auto-install..."),!
|
|
62
|
-
Install manually from: https://github.com/sourcegraph/scip/releases`)}}function
|
|
60
|
+
`).get();return{version:2,tsconfig:t,files:S(n),db:r}}function er(e){let n=_e();return{projectRoot:e.projectRoot,context:Oe(e.projectRoot,e.configPath),symbolLookup:Fe(e.db,e.projectRoot,n),vueSymbolLookup:e.vueSymbolLookup,sourceReader:n}}function nr(e){let n=[],t=0,r=e.tasks??e.vueFiles.map(o=>({fileName:o,startOffset:0,endOffset:Number.POSITIVE_INFINITY,countFileSkip:!0}));for(let o of r){let i=tr(e,o);n.push(...i.occurrences),t+=i.skippedReferences}return{occurrences:n,skippedReferences:t}}function tr(e,n){let t=e.context.language.scripts.get(n.fileName),r=t?.generated?.languagePlugin.typescript?.getServiceScript(t.generated.root)?.code;if(!t||!r)return{occurrences:[],skippedReferences:n.countFileSkip?1:0};let o=e.sourceReader.get(n.fileName);if(!o)return{occurrences:[],skippedReferences:n.countFileSkip?1:0};let i=e.context.language.maps.get(r,t),s=h(e.projectRoot,n.fileName),a=[...Me(o.text)],u={tokens:a.filter(c=>c.start>=n.startOffset&&c.start<n.endOffset),tokenByStart:new Map(a.map(c=>[c.start,c])),tokenTextCounts:ir(a),processedStarts:new Set};return rr({...e,fileName:n.fileName,sourceInfo:o,sourceFile:s,map:i,tokenContext:u})}function rr(e){let n=[],t=0;for(let r of e.tokenContext.tokens){if(e.tokenContext.processedStarts.has(r.start))continue;let o=Ne(e.map,r.start);if(o===null)continue;let s=(e.context.languageService.getDefinitionAtPosition(e.fileName,o+1)??[]).find(u=>!Ae(e.projectRoot,u.fileName));if(!s){t++;continue}let a=Ve(s,e.symbolLookup,e.vueSymbolLookup,e.context,e.projectRoot);if(a===null){t++;continue}Ue(n,e.sourceReader,e.sourceInfo,e.sourceFile,r,a),e.tokenContext.processedStarts.add(r.start),or(n,e,r,o,a)}return{occurrences:n,skippedReferences:t}}function or(e,n,t,r,o){if(!((n.tokenContext.tokenTextCounts.get(t.text)??0)<=1))for(let i of sr(n.context.languageService,n.fileName,r+1,n.map,t,n.tokenContext.tokenByStart)){if(n.tokenContext.processedStarts.has(i))continue;let s=n.tokenContext.tokenByStart.get(i);s&&(Ue(e,n.sourceReader,n.sourceInfo,n.sourceFile,s,o),n.tokenContext.processedStarts.add(i))}}function Ue(e,n,t,r,o,i){let s=n.positionAt(t,o.start);e.push({sourceFile:r,sourceLine:s.line,sourceStartChar:s.character,sourceEndChar:s.character+o.text.length,symbolId:i})}function ir(e){let n=new Map;for(let t of e)n.set(t.text,(n.get(t.text)??0)+1);return n}function sr(e,n,t,r,o,i){let s=e.getDocumentHighlights?.(n,t,[n])??[],a=[];for(let u of s)if(u.fileName===n)for(let c of u.highlightSpans){let g=ar(r,c.textSpan.start,i,o.text);g!==null&&a.push(g)}return a}function ar(e,n,t,r){let o=t.get(n);if(o?.text===r)return o.start;let i=q(e,n);if(i===null)return null;let s=t.get(i);return s?.text===r?s.start:null}async function Zo(e){let{projectRoot:n,maxHeapMb:t=8192,onStatus:r=console.log,skipAutoInstall:o=!1}=e,i=mr(e),s=Date.now();K(f(i.outputScip),{recursive:!0}),K(f(i.outputDb),{recursive:!0});let a=e.languages??D(n);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=Er(n,a,{pnpmWorkspaces:e.pnpmWorkspaces}),c=Fr(d(f(i.outputDb),"index.lock")),g=null;try{let l=fr({opts:e,paths:i,languages:a,fingerprint:u,start:s,onStatus:r});if(l)return l;vr(o,r);let p=hr(i);return g=p.runDir,await br({opts:e,languages:a,projectRoot:n,paths:i,tempPaths:p,fingerprint:u,start:s,maxHeapMb:t,skipAutoInstall:o,onStatus:r})}finally{g&&Q(g,{recursive:!0,force:!0}),c()}}function mr(e){let n=e.outputScip??d(e.projectRoot,"index.scip"),t=e.outputDb??d(e.projectRoot,"index.db");return{outputScip:n,outputDb:t,metaPath:d(f(t),"meta.json")}}function fr(e){if(e.opts.skipIfUnchanged===!1||!w(e.paths.outputScip)||!w(e.paths.outputDb)||!Vr(e.paths.metaPath,e.fingerprint))return null;b({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 hr(e){let n=gr(d(f(e.outputDb),"reindex-"));return{runDir:n,tempOutputScip:d(n,C(e.outputScip)),tempOutputDb:d(n,C(e.outputDb)),tempMetaPath:d(n,C(e.metaPath))}}async function br(e){let n={...process.env,NODE_OPTIONS:`--max-old-space-size=${e.maxHeapMb}`},{indexedOutputs:t,skippedLanguages:r,reusedLanguages:o}=await yr(e,n);o.length>0&&e.onStatus(`Reused ${o.length} cached language shard(s): ${o.join(", ")}`),xr(e,n,t,r);let i=Date.now()-e.start;return e.onStatus(`Done in ${(i/1e3).toFixed(1)}s`),{languages:t.map(s=>s.language),indexPath:e.paths.outputScip,dbPath:e.paths.outputDb,durationMs:i,reused:!1,skipped:r}}async function yr(e,n){let t=Sr(e),r=new Set(t.map(c=>c.language));for(let c of r)e.onStatus(`Reusing cached ${c} SCIP shard (language inputs unchanged).`);let{preparedRuns:o,skippedLanguages:i}=kr({languages:e.languages.filter(c=>!r.has(c)),tempOutputScip:e.tempPaths.tempOutputScip,projectRoot:e.projectRoot,env:n,skipAutoInstall:e.skipAutoInstall,pnpmWorkspaces:e.opts.pnpmWorkspaces,onStatus:e.onStatus}),s=await ye(o,e.projectRoot,e.onStatus,e.opts.indexerConcurrency),{indexedOutputs:a}=Pr(s,i),u=[...t,...a];return Lr(u,i,e.languages,e.opts.allowPartial,e.onStatus),{indexedOutputs:u,skippedLanguages:i,reusedLanguages:[...r]}}function xr(e,n,t,r){Rr(e.paths.outputDb,t),Cr(t,e.tempPaths.tempOutputScip,e.onStatus),wr(e.tempPaths.tempOutputScip,e.tempPaths.tempOutputDb,n,e.onStatus),b({projectRoot:e.projectRoot,dbPath:e.tempPaths.tempOutputDb,onStatus:e.onStatus}),Tr(e.tempPaths.tempMetaPath,{version:3,status:r.length===0?"complete":"partial",updatedAt:new Date().toISOString(),fingerprint:e.fingerprint,languageFingerprints:Je(e.projectRoot,e.languages,{pnpmWorkspaces:e.opts.pnpmWorkspaces}),requestedLanguages:e.languages,indexedLanguages:t.map(o=>o.language),skipped:[...r]}),Dr({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 Sr(e){let n;try{n=JSON.parse(We(e.paths.metaPath,"utf-8"))}catch{return[]}if(n.version!==3||!n.languageFingerprints)return[];let t=[],r=Je(e.projectRoot,e.languages,{pnpmWorkspaces:e.opts.pnpmWorkspaces});for(let o of e.languages){let i=He(e.paths.outputDb,o);w(i)&&y(n.languageFingerprints[o])===y(r[o])&&t.push({language:o,scipPath:i})}return t}function Rr(e,n){for(let t of n){let r=He(e,t.language);K(f(r),{recursive:!0}),t.scipPath!==r&&lr(t.scipPath,r)}}function vr(e,n){if(!O()){if(e)throw new Error(`The scip CLI is required but not found on PATH.
|
|
61
|
+
Install from: https://github.com/sourcegraph/scip/releases`);if(n("scip CLI not found on PATH. Attempting auto-install..."),!F(n))throw new Error(`The scip CLI is required but could not be installed.
|
|
62
|
+
Install manually from: https://github.com/sourcegraph/scip/releases`)}}function kr(e){let n=[],t=[],r=e.languages.map((o,i)=>({language:o,scipPath:e.languages.length>1?Or(e.tempOutputScip,o,i):e.tempOutputScip}));for(let{language:o,scipPath:i}of r){let s=Ir({...e,language:o,scipPath:i});"skipped"in s?t.push(s.skipped):n.push(s.prepared)}return{preparedRuns:n,skippedLanguages:t}}function Ir(e){let n=k(e.language),t=L(n),r=U(n,e.projectRoot);if(!r&&!B(n)){if(e.skipAutoInstall){let a=`${t} not found on PATH (auto-install disabled). ${n.installUrl??""}`.trim();return e.onStatus(`Skipping ${e.language}: ${a}`),{skipped:{language:e.language,reason:a}}}if(e.onStatus(`${t} not found. Attempting auto-install...`),!G(n,e.onStatus)){let a=`${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}: ${a}`),{skipped:{language:e.language,reason:a}}}}let o=r??R(n);if(!o){let a=`${t} was not found after installation checks.`;return e.onStatus(`Skipping ${e.language}: ${a}`),{skipped:{language:e.language,reason:a}}}let{binary:i,args:s}=n.indexArgs({projectRoot:e.projectRoot,outputPath:e.scipPath,pnpmWorkspaces:e.pnpmWorkspaces,indexerBinary:o});return{prepared:{language:e.language,scipPath:e.scipPath,config:n,resolvedBinary:o,binary:i,args:s,env:W(n,e.env,o)}}}function Pr(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 Lr(e,n,t,r,o){if(e.length===0){let i=n.map(s=>` - ${s.language}: ${s.reason}`).join(`
|
|
63
63
|
`);throw new Error(`No language indexers ran successfully. Install at least one indexer for the languages in this project.
|
|
64
64
|
`+i)}if(n.length!==0&&(o(`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.
|
|
65
65
|
`+n.map(i=>` - ${i.language}: ${i.reason}`).join(`
|
|
66
|
-
`))}function
|
|
67
|
-
`),()=>{try{
|
|
68
|
-
`)}function
|
|
66
|
+
`))}function Cr(e,n,t){e.length>1?(t(`Merging ${e.length} language indexes...`),T(e.map(r=>r.scipPath),n)):e[0].scipPath!==n&&Y(e[0].scipPath,n)}function wr(e,n,t,r){if(r("Converting to SQLite..."),!w(e))throw new Error(`SCIP index not found at ${e} after indexing`);try{let o=he(e);o.removedDefinitionOccurrences>0&&r(`Sanitized ${o.removedDefinitionOccurrences} invalid definition occurrences across ${o.touchedDocuments} documents before SQLite conversion.`);let i=O();if(!i)throw new Error("scip CLI is not available");ur(i,["expt-convert","--output",n,e],{env:t,stdio:"pipe",maxBuffer:50*1024*1024})}catch(o){let i=o instanceof Error?o.message:String(o);throw new Error(`Failed to convert SCIP index to SQLite: ${i}`,{cause:o})}}function Or(e,n,t){let r=dr(e)||".scip",o=C(e,r);return d(f(e),`${o}.${t+1}.${n}${r}`)}function Fr(e){let n;try{n=pr(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 ${f(e)}.`,{cause:t}):t}return Ge(n,JSON.stringify({pid:process.pid,startedAt:new Date().toISOString()})+`
|
|
67
|
+
`),()=>{try{cr(n)}finally{Q(e,{force:!0})}}}function Dr(e){X(e.tempOutputScip,e.outputScip),X(e.tempOutputDb,e.outputDb),X(e.tempMetaPath,e.metaPath)}function X(e,n){Q(`${n}.tmp-replace`,{force:!0}),Y(e,`${n}.tmp-replace`),Y(`${n}.tmp-replace`,n)}function Er(e,n,t){return{version:1,languages:[...n].sort(),pnpmWorkspaces:t.pnpmWorkspaces===!0,files:S(e)}}function Je(e,n,t){return Object.fromEntries(n.map(r=>{let o=k(r).markerFiles;return[r,{version:1,languages:[r],pnpmWorkspaces:r==="typescript"&&t.pnpmWorkspaces===!0,files:S(e,{language:r,markerFiles:o})}]}))}function He(e,n){return d(f(e),"language-indexes",`${n}.scip`)}function Vr(e,n){try{let t=JSON.parse(We(e,"utf-8"));return(t.version===2||t.version===3)&&t.status==="complete"&&y(t.fingerprint)===y(n)&&y([...t.indexedLanguages??[]].sort())===y(n.languages)}catch{return!1}}function Tr(e,n){Ge(e,`${JSON.stringify(n,null,2)}
|
|
68
|
+
`)}function y(e){return JSON.stringify(e)}export{ce as INDEXER_CONFIGS,b as augmentAuxiliaryDocuments,qt as augmentVueResolvedReferences,L as describeIndexerBinary,D as detectLanguages,k as getIndexerConfig,W as getIndexerExecutionEnv,x as isBinaryAvailable,B as isIndexerInstalled,T as mergeScipFiles,le as mergeScipIndexes,Zo as reindex,R as resolveIndexerBinary,U as resolveProjectLocalIndexerBinary,G as tryInstallIndexer,F as tryInstallScipCli};
|
|
69
69
|
//# sourceMappingURL=reindex.js.map
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { P as ProjectConfig, a as SupportedLanguage } from './config-types-Bj4sh28g.js';
|
|
2
|
-
export { g as getScipVersion, i as isScipInstalled, p as printScipInstallInstructions } from './scip-cli-
|
|
2
|
+
export { g as getScipVersion, i as isScipInstalled, p as printScipInstallInstructions } from './scip-cli-Bh1M_JPu.js';
|
|
3
3
|
|
|
4
4
|
type WatcherStatus = {
|
|
5
5
|
state: 'idle';
|
package/dist/runtime.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{c as $,d as T,e as E}from"./chunk-ONPCQ2PM.js";import{a as v}from"./chunk-UUBMFL3F.js";import{readFileSync as D,writeFileSync as A,existsSync as b,mkdirSync as _}from"fs";import{join as c,resolve as C}from"path";import{createHash as W}from"crypto";import{homedir as F}from"os";var h=".scipquery.json",M={enabled:!1,debounceMs:3e4,cooldownMs:6e4,ignore:[]};function L(i){let e=c(i,h);if(!b(e))return{};try{let t=D(e,"utf-8");return JSON.parse(t)}catch(t){let s=t instanceof Error?t.message:String(t);throw t instanceof SyntaxError?new Error(`invalid ${h} at ${e}: ${s}`,{cause:t}):new Error(`unable to read ${h} at ${e}: ${s}`,{cause:t})}}function P(i){return{...M,...i.watch}}function N(i,e){let t=process.env.SCIP_QUERY_CACHE_DIR;if(t)return f(t);if(e?.dbPath)return f(C(i,e.dbPath));let n=process.env.XDG_CACHE_HOME||c(F(),".cache"),r=W("sha256").update(C(i)).digest("hex").slice(0,12),o=c(n,"scip-query","projects",r);return f(o)}function m(i,e){let t=N(i,e);return{cacheDir:t,dbPath:c(t,"index.db"),indexPath:c(t,"index.scip"),metaPath:c(t,"meta.json")}}function O(i,e){let t=c(i,h);return b(t)||A(t,JSON.stringify({languages:e,watch:{enabled:!1,debounceMs:3e4,cooldownMs:6e4}},null,2)+`
|
|
2
2
|
`),t}function f(i){return _(i,{recursive:!0}),i}import{watch as U}from"fs";import{existsSync as R,renameSync as k}from"fs";import{join as q,relative as H}from"path";import{fork as B}from"child_process";import G from"ignore";var y=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(e){this.projectRoot=e.projectRoot,this.watchConfig=P(e.config),this.indexPaths=m(e.projectRoot,e.config),this.languages=e.languages,this.pnpmWorkspaces=e.config.indexer?.typescript?.pnpmWorkspaces??!1,this.onStatus=e.onStatus??(()=>{}),this.onReindexComplete=e.onReindexComplete??(()=>{}),this.onError=e.onError??(t=>console.error(t.message)),this.gitignoreFilter=v(e.projectRoot),this.extraIgnore=G(),this.watchConfig.ignore.length>0&&this.extraIgnore.add(this.watchConfig.ignore)}start(){this.stopped=!1,this.setStatus({state:"idle"});try{let e=U(this.projectRoot,{recursive:!0},(t,s)=>{s&&!this.stopped&&this.handleFileChange(s)});this.fsWatchers.push(e)}catch{this.onError(new Error("Failed to start file watcher. On Linux, you may need to increase inotify limits: sysctl -w fs.inotify.max_user_watches=524288"))}}stop(){this.stopped=!0;for(let e of this.fsWatchers)e.close();this.fsWatchers=[],this.clearDebounceTimer(),this.clearCooldownTimer(),this.setStatus({state:"idle"})}handleFileChange(e){let t=H(this.projectRoot,q(this.projectRoot,e));if(this.gitignoreFilter.isIgnored(t)||this.extraIgnore.ignores(t)||e.endsWith("index.db")||e.endsWith("index.scip")||e.endsWith("index.db.tmp")||e.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 s=Date.now()+this.watchConfig.debounceMs;this.setStatus({state:"waiting",changedFiles:this.changedFiles,reindexAt:s}),this.debounceTimer=setTimeout(()=>{this.debounceTimer=null,this.triggerReindex()},this.watchConfig.debounceMs)}triggerReindex(){if(this.reindexInFlight||this.stopped)return;let e=Date.now()-this.lastReindexEnd;if(this.lastReindexEnd>0&&e<this.watchConfig.cooldownMs){let s=this.watchConfig.cooldownMs-e;this.dirty=!0;let n=Date.now()+s;this.setStatus({state:"cooldown",until:n,dirty:!0}),this.cooldownTimer=setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped&&(this.dirty=!1,this.triggerReindex())},s);return}this.reindexInFlight=!0,this.dirty=!1,this.changedFiles=0;let t=Date.now();this.setStatus({state:"indexing",startedAt:t}),this.runReindex().then(s=>{if(this.reindexInFlight=!1,this.lastReindexEnd=Date.now(),this.onReindexComplete(s),this.dirty&&!this.stopped){let n=Date.now()+this.watchConfig.cooldownMs;this.setStatus({state:"cooldown",until:n,dirty:!0}),this.cooldownTimer=setTimeout(()=>{this.cooldownTimer=null,this.dirty&&!this.stopped?(this.dirty=!1,this.triggerReindex()):this.setStatus({state:"idle"})},this.watchConfig.cooldownMs)}else this.setStatus({state:"idle"})}).catch(s=>{this.reindexInFlight=!1,this.lastReindexEnd=Date.now(),this.onError(s instanceof Error?s:new Error(String(s))),this.setStatus({state:"idle"})})}runReindex(){return new Promise((e,t)=>{let s=Date.now(),n=this.indexPaths.dbPath+".tmp",r=X(this.indexPaths.indexPath),o=B(new URL("./reindex-worker.js",import.meta.url).pathname,[],{env:{...process.env,SCIP_REINDEX_PROJECT_ROOT:this.projectRoot,SCIP_REINDEX_OUTPUT_SCIP:r,SCIP_REINDEX_OUTPUT_DB:n,SCIP_REINDEX_LANGUAGES:this.languages?.join(",")??"",SCIP_REINDEX_PNPM_WORKSPACES:this.pnpmWorkspaces?"1":""},stdio:"pipe"});o.on("exit",d=>{if(d===0)try{R(n)&&k(n,this.indexPaths.dbPath),R(r)&&k(r,this.indexPaths.indexPath),e(Date.now()-s)}catch(a){t(new Error(`Atomic swap failed: ${a}`))}else t(new Error(`Reindex worker exited with code ${d}`))}),o.on("error",t)})}setStatus(e){this.status=e,this.onStatus(e)}clearDebounceTimer(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null)}clearCooldownTimer(){this.cooldownTimer&&(clearTimeout(this.cooldownTimer),this.cooldownTimer=null)}};function X(i){return i.endsWith(".scip")?i.slice(0,-5)+".tmp.scip":i+".tmp.scip"}import{existsSync as x,mkdirSync as J,symlinkSync as V,readlinkSync as K,unlinkSync as Q}from"fs";import{join as p,dirname as I,resolve as S}from"path";import{homedir as w,platform as Y}from"os";import{fileURLToPath as z}from"url";var Z=Y()==="win32",ee=["scip-query","scip-query-setup","scip-adoption","scip-health-audit","scip-health-improve","scip-api-impact","concrete-plan","scip-ai-cleanup","scip-debug","scip-explore","scip-triage-issue","scip-diagram","scip-debloat","scip-doc-reconcile","scip-directory-architecture","scip-maintainability","scip-react-maintainability","scip-vue-maintainability","scip-verify","scip-language-playbook"];function te(i={}){let e=i.quiet?()=>{}:console.log,t=z(import.meta.url),s=S(I(t),"..","skills"),n=[p(w(),".claude","skills"),p(w(),".codex","skills"),p(w(),".agents","skills")],r={installed:[],skipped:[],alreadyLinked:[]};for(let o of n){let d=I(o);if(!x(d))continue;J(o,{recursive:!0});let a=ie(o);for(let l of ee){let g=p(s,l),u=p(o,l);if(!x(g)){r.skipped.push(`${a}/${l}`);continue}if(x(u)){try{let j=K(u);if(S(j)===S(g)){r.alreadyLinked.push(`${a}/${l}`),e(` ok: ${l} \u2192 ${a} (already linked)`);continue}}catch{r.skipped.push(`${a}/${l}`),e(` skip: ${l} \u2192 ${a} (exists, not a symlink)`);continue}Q(u)}V(g,u,Z?"junction":"dir"),r.installed.push(`${a}/${l}`),e(` done: ${l} \u2192 ${a}`)}}return r}function ie(i){return i.includes(".codex")?"Codex":i.includes(".agents")?"Agents":"Claude"}export{y as Watcher,T as getScipVersion,O as initProjectConfig,te as installSkills,$ as isScipInstalled,L as loadProjectConfig,E as printScipInstallInstructions,m as resolveIndexPaths};
|
|
3
3
|
//# sourceMappingURL=runtime.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scip-query",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.5",
|
|
4
4
|
"description": "Evidence and verification for AI coding agents: map code, reuse concepts, finish migrations, and gate diffs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,8 +13,10 @@
|
|
|
13
13
|
"dist/**/*.d.ts",
|
|
14
14
|
"docs/assets/**/*",
|
|
15
15
|
"docs/*.md",
|
|
16
|
+
"scripts/build-scip-windows.mjs",
|
|
16
17
|
"skills/**/SKILL.md",
|
|
17
|
-
"skills/**/agents/*.yaml"
|
|
18
|
+
"skills/**/agents/*.yaml",
|
|
19
|
+
"vendor/scip/**/*"
|
|
18
20
|
],
|
|
19
21
|
"sideEffects": false,
|
|
20
22
|
"exports": {
|
|
@@ -288,9 +290,10 @@
|
|
|
288
290
|
"test:watch": "vitest",
|
|
289
291
|
"typecheck": "tsc --noEmit",
|
|
290
292
|
"lint": "npm run format:check && eslint src tests tsup.config.ts",
|
|
293
|
+
"build:scip-windows": "node scripts/build-scip-windows.mjs",
|
|
291
294
|
"calibrate": "node scripts/accuracy-calibration.mjs",
|
|
292
295
|
"docs:commands": "vite-node scripts/render-command-reference.ts --write",
|
|
293
|
-
"prepublishOnly": "npm run build",
|
|
296
|
+
"prepublishOnly": "npm run build && npm run build:scip-windows",
|
|
294
297
|
"postinstall": "node dist/postinstall.js || true"
|
|
295
298
|
},
|
|
296
299
|
"keywords": [
|