scip-query 0.8.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -8
- package/dist/{chunk-GD7XRHSV.js → chunk-2BMFRBV6.js} +2 -2
- package/dist/{chunk-GMEBYEMU.js → chunk-2WEH5QHC.js} +2 -2
- package/dist/{chunk-PE4EJOLN.js → chunk-4DAPXOWD.js} +2 -2
- package/dist/{chunk-EKP7XJ6L.js → chunk-4HTJZC6G.js} +2 -2
- package/dist/{chunk-RCRK4E7E.js → chunk-4JQFTUKD.js} +2 -2
- package/dist/{chunk-7I6KNKE3.js → chunk-4MHT7LKP.js} +2 -2
- package/dist/chunk-5OHZEO3U.js +3 -0
- package/dist/chunk-5QJIEYFB.js +34 -0
- package/dist/{chunk-Z2AJQ7VA.js → chunk-6DEX3XP6.js} +2 -2
- package/dist/{chunk-SSINY7HL.js → chunk-6IGXZZQ4.js} +2 -2
- package/dist/{chunk-FIPE5AQT.js → chunk-6K2JQ2VI.js} +2 -2
- package/dist/{chunk-OIMM7KMI.js → chunk-6QVCPUK6.js} +2 -2
- package/dist/chunk-6VL4AIEO.js +8 -0
- package/dist/{chunk-K6YIGVL7.js → chunk-772YYL6I.js} +2 -2
- package/dist/{chunk-FTBT4RP2.js → chunk-A2VTV2QB.js} +2 -2
- package/dist/{chunk-EM2PPDN7.js → chunk-ADRYSISR.js} +2 -2
- package/dist/chunk-AI2ECT7L.js +2 -0
- package/dist/{chunk-TR5AU6A5.js → chunk-AP5GTKSG.js} +2 -2
- package/dist/chunk-B32FX5KB.js +2 -0
- package/dist/{chunk-UQE3DSXY.js → chunk-BGRPMGTD.js} +2 -2
- package/dist/{chunk-7TYJD45F.js → chunk-BNW3Q24R.js} +2 -2
- package/dist/{chunk-QYQXPPDI.js → chunk-BUAC4Q4G.js} +2 -2
- package/dist/{chunk-7UZWNW4E.js → chunk-BZ6LCGE6.js} +2 -2
- package/dist/{chunk-ZJ737ZMD.js → chunk-CMXFASVD.js} +2 -2
- package/dist/{chunk-XSZ5NC4O.js → chunk-CO3AL7NZ.js} +2 -2
- package/dist/{chunk-4B7YLRXX.js → chunk-FVIKFWUL.js} +2 -2
- package/dist/{chunk-APLCSDXL.js → chunk-FVVT7GV6.js} +2 -2
- package/dist/chunk-HXXRN77A.js +2 -0
- package/dist/{chunk-NK7TQQG4.js → chunk-IC3RC3KJ.js} +2 -2
- package/dist/chunk-ISCKLDSS.js +22 -0
- package/dist/chunk-ITHQJZTG.js +2 -0
- package/dist/{chunk-RIXOMSOR.js → chunk-IVAIPXNO.js} +2 -2
- package/dist/{chunk-NOVKLH2F.js → chunk-IW7ASGVF.js} +2 -2
- package/dist/{chunk-4A4JFNWG.js → chunk-JODYQDE4.js} +2 -2
- package/dist/{chunk-66ORT3LS.js → chunk-L2KFPRMA.js} +2 -2
- package/dist/{chunk-HVXIXDLV.js → chunk-MCW36F2D.js} +2 -2
- package/dist/{chunk-SDGCKEB7.js → chunk-MN75T4UB.js} +2 -2
- package/dist/{chunk-AGW2MVIO.js → chunk-NC4IUW25.js} +2 -2
- package/dist/{chunk-2EC4JTHC.js → chunk-NGI4V4AB.js} +2 -2
- package/dist/{chunk-SOGLYIJ4.js → chunk-O6KCZPJQ.js} +2 -2
- package/dist/chunk-OAI5GEIN.js +6 -0
- package/dist/chunk-OH5HIAID.js +4 -0
- package/dist/{chunk-NGLRXEWN.js → chunk-OLCKSG3Y.js} +2 -2
- package/dist/{chunk-JTCEWV7Q.js → chunk-OXKEUWMJ.js} +2 -2
- package/dist/{chunk-JAMU6FLN.js → chunk-PRVDXGSK.js} +2 -2
- package/dist/{chunk-46ILZVMX.js → chunk-QJWN6LA5.js} +2 -2
- package/dist/{chunk-BCFED24F.js → chunk-QKO474FG.js} +2 -2
- package/dist/{chunk-TQTVM27C.js → chunk-QYKKTYBN.js} +2 -2
- package/dist/chunk-R3G6ERW7.js +7 -0
- package/dist/{chunk-UUDYI3FF.js → chunk-R6XDPWJA.js} +2 -2
- package/dist/{chunk-D43L5PQF.js → chunk-SCEMECW7.js} +2 -2
- package/dist/{chunk-HVGNOUYP.js → chunk-SJR4SB7B.js} +2 -2
- package/dist/chunk-SYKCO25G.js +16 -0
- package/dist/{chunk-MKE7SEEX.js → chunk-T22X7WT6.js} +2 -2
- package/dist/chunk-UIWAZ2NT.js +2 -0
- package/dist/{chunk-SLOIQKY7.js → chunk-VDY4HYNK.js} +2 -2
- package/dist/{chunk-EAU4RDFG.js → chunk-VDZIEDJB.js} +2 -2
- package/dist/{chunk-6ZFKI5EP.js → chunk-VGBSY6N7.js} +2 -2
- package/dist/{chunk-VN6B6HFB.js → chunk-VZRILF2Z.js} +2 -2
- package/dist/{chunk-CVRXOP6M.js → chunk-WJIS6BNI.js} +2 -2
- package/dist/{chunk-DJTJ3DLZ.js → chunk-WN5Z3UVT.js} +2 -2
- package/dist/{chunk-6G76D2YM.js → chunk-XCW7DYHM.js} +2 -2
- package/dist/{chunk-ZIIQ55VK.js → chunk-Y5H7TBVE.js} +2 -2
- package/dist/{chunk-I7OTKWNY.js → chunk-YWZBKYLS.js} +2 -2
- package/dist/{chunk-64UY7VTR.js → chunk-ZF6P2NAT.js} +3 -3
- package/dist/{chunk-SB6I6O3P.js → chunk-ZGIK464P.js} +2 -2
- package/dist/{chunk-WC43FMAB.js → chunk-ZOT3WUZW.js} +2 -2
- package/dist/{chunk-TFO4OMJZ.js → chunk-ZZ2W5P3D.js} +2 -2
- package/dist/cli.js +187 -149
- package/dist/index.js +1 -1
- package/dist/postinstall.js +2 -2
- package/dist/queries/affected.js +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/by-kind.js +1 -1
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/co-change.js +1 -1
- package/dist/queries/code.js +1 -1
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/coupling.js +1 -1
- package/dist/queries/cycles.js +1 -1
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.js +1 -1
- package/dist/queries/deep-chains.js +1 -1
- package/dist/queries/deps.js +1 -1
- package/dist/queries/diff-gate.d.ts +9 -2
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.d.ts +3 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/fan.js +1 -1
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.js +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.d.ts +71 -0
- package/dist/queries/incomplete-migration.js +2 -0
- package/dist/queries/index.d.ts +2 -1
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/outline.js +1 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-chains.js +1 -1
- package/dist/queries/similar-files.js +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.d.ts +15 -1
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.js +1 -1
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/symbols.js +1 -1
- package/dist/queries/system.js +1 -1
- package/dist/queries/trace.js +1 -1
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/runtime.js +1 -1
- package/package.json +5 -1
- package/skills/scip-query/SKILL.md +79 -0
- package/dist/chunk-6P5W4U6G.js +0 -16
- package/dist/chunk-GTZAU7OL.js +0 -2
- package/dist/chunk-K4Z3FCUJ.js +0 -6
- package/dist/chunk-N5D5ZCBW.js +0 -7
- package/dist/chunk-OQSV6OS2.js +0 -2
- package/dist/chunk-PCMVXWDC.js +0 -34
- package/dist/chunk-PLFYFZX3.js +0 -2
- package/dist/chunk-RKTDEIHF.js +0 -2
- package/dist/chunk-WQFOZIID.js +0 -4
- package/dist/chunk-XBFLIGWU.js +0 -3
package/dist/queries/surface.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-BGRPMGTD.js";import"../chunk-ZOT3WUZW.js";import"../chunk-IW7ASGVF.js";import"../chunk-QYKKTYBN.js";import"../chunk-VDZIEDJB.js";import"../chunk-5QJIEYFB.js";import"../chunk-VGBSY6N7.js";import"../chunk-ZF6P2NAT.js";import"../chunk-4MHT7LKP.js";import"../chunk-IVAIPXNO.js";import"../chunk-FVVT7GV6.js";import"../chunk-WEJYUS5O.js";import"../chunk-PBGTMPJ7.js";import"../chunk-O6KCZPJQ.js";import"../chunk-OH5HIAID.js";import"../chunk-ISCKLDSS.js";import"../chunk-NN3O7TPH.js";import"../chunk-VDZL45XI.js";export{a as surface};
|
|
2
2
|
//# sourceMappingURL=surface.js.map
|
package/dist/queries/symbols.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-ITHQJZTG.js";import"../chunk-ZOT3WUZW.js";import"../chunk-4MHT7LKP.js";import"../chunk-O6KCZPJQ.js";import"../chunk-OH5HIAID.js";import"../chunk-ISCKLDSS.js";import"../chunk-NN3O7TPH.js";import"../chunk-VDZL45XI.js";export{a as symbols};
|
|
2
2
|
//# sourceMappingURL=symbols.js.map
|
package/dist/queries/system.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-2BMFRBV6.js";import"../chunk-ZOT3WUZW.js";import"../chunk-4MHT7LKP.js";import"../chunk-O6KCZPJQ.js";import"../chunk-OH5HIAID.js";import"../chunk-ISCKLDSS.js";import"../chunk-NN3O7TPH.js";import"../chunk-VDZL45XI.js";export{a as system};
|
|
2
2
|
//# sourceMappingURL=system.js.map
|
package/dist/queries/trace.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-IC3RC3KJ.js";import"../chunk-VGBSY6N7.js";import"../chunk-ZF6P2NAT.js";import"../chunk-4MHT7LKP.js";import"../chunk-FVVT7GV6.js";import"../chunk-WEJYUS5O.js";import"../chunk-PBGTMPJ7.js";import"../chunk-O6KCZPJQ.js";import"../chunk-OH5HIAID.js";import"../chunk-ISCKLDSS.js";import"../chunk-NN3O7TPH.js";import"../chunk-VDZL45XI.js";export{a as trace};
|
|
2
2
|
//# sourceMappingURL=trace.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-SJR4SB7B.js";import"../chunk-V76FCF5F.js";import"../chunk-MX6F756F.js";import"../chunk-IW7ASGVF.js";import"../chunk-QYKKTYBN.js";import"../chunk-VDZIEDJB.js";import"../chunk-5QJIEYFB.js";import"../chunk-VGBSY6N7.js";import"../chunk-ZF6P2NAT.js";import"../chunk-4MHT7LKP.js";import"../chunk-IVAIPXNO.js";import"../chunk-FVVT7GV6.js";import"../chunk-WEJYUS5O.js";import"../chunk-PBGTMPJ7.js";import"../chunk-O6KCZPJQ.js";import"../chunk-OH5HIAID.js";import"../chunk-ISCKLDSS.js";import"../chunk-NN3O7TPH.js";import"../chunk-VDZL45XI.js";export{a as unusedParams};
|
|
2
2
|
//# sourceMappingURL=unused-params.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-WN5Z3UVT.js";import"../chunk-WJIS6BNI.js";import"../chunk-V76FCF5F.js";import"../chunk-MX6F756F.js";import"../chunk-IW7ASGVF.js";import"../chunk-QYKKTYBN.js";import"../chunk-VDZIEDJB.js";import"../chunk-5QJIEYFB.js";import"../chunk-VGBSY6N7.js";import"../chunk-ZF6P2NAT.js";import"../chunk-4MHT7LKP.js";import"../chunk-IVAIPXNO.js";import"../chunk-FVVT7GV6.js";import"../chunk-WEJYUS5O.js";import"../chunk-PBGTMPJ7.js";import"../chunk-O6KCZPJQ.js";import"../chunk-OH5HIAID.js";import"../chunk-ISCKLDSS.js";import"../chunk-NN3O7TPH.js";import"../chunk-VDZL45XI.js";export{a as wrapperCandidates};
|
|
2
2
|
//# sourceMappingURL=wrapper-candidates.js.map
|
package/dist/runtime.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import{b,c as j,d as W}from"./chunk-LWYIGRHR.js";import{a as w}from"./chunk-TKDJQ2WD.js";import{readFileSync as _,writeFileSync as D,existsSync as v,mkdirSync as F}from"fs";import{join as l,resolve as C}from"path";import{createHash as L}from"crypto";import{homedir as $}from"os";var P=".scipquery.json",A={enabled:!1,debounceMs:3e4,cooldownMs:6e4,ignore:[]};function N(i){let t=l(i,P);if(!v(t))return{};try{let e=_(t,"utf-8");return JSON.parse(e)}catch{return{}}}function R(i){return{...A,...i.watch}}function O(i,t){let e=process.env.SCIP_QUERY_CACHE_DIR;if(e)return g(e);if(t?.dbPath)return g(C(i,t.dbPath));let n=process.env.XDG_CACHE_HOME||l($(),".cache"),o=L("sha256").update(C(i)).digest("hex").slice(0,12),r=l(n,"scip-query","projects",o);return g(r)}function f(i,t){let e=O(i,t);return{cacheDir:e,dbPath:l(e,"index.db"),indexPath:l(e,"index.scip"),metaPath:l(e,"meta.json")}}function M(i,t){let e=l(i,P);return v(e)||D(e,JSON.stringify({languages:t,watch:{enabled:!1,debounceMs:3e4,cooldownMs:6e4}},null,2)+`
|
|
2
|
-
`),e}function g(i){return F(i,{recursive:!0}),i}import{watch as q}from"fs";import{existsSync as I,renameSync as T}from"fs";import{join as U,relative as H}from"path";import{fork as G}from"child_process";import X from"ignore";var m=class{projectRoot;watchConfig;indexPaths;languages;pnpmWorkspaces;onStatus;onReindexComplete;onError;status={state:"idle"};debounceTimer=null;cooldownTimer=null;dirty=!1;changedFiles=0;reindexInFlight=!1;lastReindexEnd=0;fsWatchers=[];gitignoreFilter;extraIgnore;stopped=!1;constructor(t){this.projectRoot=t.projectRoot,this.watchConfig=R(t.config),this.indexPaths=f(t.projectRoot,t.config),this.languages=t.languages,this.pnpmWorkspaces=t.config.indexer?.typescript?.pnpmWorkspaces??!1,this.onStatus=t.onStatus??(()=>{}),this.onReindexComplete=t.onReindexComplete??(()=>{}),this.onError=t.onError??(e=>console.error(e.message)),this.gitignoreFilter=w(t.projectRoot),this.extraIgnore=X(),this.watchConfig.ignore.length>0&&this.extraIgnore.add(this.watchConfig.ignore)}start(){this.stopped=!1,this.setStatus({state:"idle"});try{let t=q(this.projectRoot,{recursive:!0},(e,s)=>{s&&!this.stopped&&this.handleFileChange(s)});this.fsWatchers.push(t)}catch{this.onError(new Error("Failed to start file watcher. On Linux, you may need to increase inotify limits: sysctl -w fs.inotify.max_user_watches=524288"))}}stop(){this.stopped=!0;for(let t of this.fsWatchers)t.close();this.fsWatchers=[],this.clearDebounceTimer(),this.clearCooldownTimer(),this.setStatus({state:"idle"})}handleFileChange(t){let e=H(this.projectRoot,U(this.projectRoot,t));if(this.gitignoreFilter.isIgnored(e)||this.extraIgnore.ignores(e)||t.endsWith("index.db")||t.endsWith("index.scip")||t.endsWith("index.db.tmp")||t.endsWith(".scipquery.json"))return;if(this.changedFiles++,this.reindexInFlight){this.dirty=!0,this.setStatus({state:"indexing",startedAt:this.status.startedAt});return}if(this.status.state==="cooldown"){this.dirty=!0,this.setStatus({state:"cooldown",until:this.status.until,dirty:!0});return}this.clearDebounceTimer();let 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 t=Date.now()-this.lastReindexEnd;if(this.lastReindexEnd>0&&t<this.watchConfig.cooldownMs){let s=this.watchConfig.cooldownMs-t;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 e=Date.now();this.setStatus({state:"indexing",startedAt:e}),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((t,e)=>{let s=Date.now(),n=this.indexPaths.dbPath+".tmp",o=B(this.indexPaths.indexPath),r=G(new URL("./reindex-worker.js",import.meta.url).pathname,[],{env:{...process.env,SCIP_REINDEX_PROJECT_ROOT:this.projectRoot,SCIP_REINDEX_OUTPUT_SCIP:o,SCIP_REINDEX_OUTPUT_DB:n,SCIP_REINDEX_LANGUAGES:this.languages?.join(",")??"",SCIP_REINDEX_PNPM_WORKSPACES:this.pnpmWorkspaces?"1":""},stdio:"pipe"});r.on("exit",h=>{if(h===0)try{I(n)&&T(n,this.indexPaths.dbPath),I(o)&&T(o,this.indexPaths.indexPath),t(Date.now()-s)}catch(a){e(new Error(`Atomic swap failed: ${a}`))}else e(new Error(`Reindex worker exited with code ${h}`))}),r.on("error",e)})}setStatus(t){this.status=t,this.onStatus(t)}clearDebounceTimer(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null)}clearCooldownTimer(){this.cooldownTimer&&(clearTimeout(this.cooldownTimer),this.cooldownTimer=null)}};function B(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 d,dirname as k,resolve as S}from"path";import{homedir as y,platform as Y}from"os";import{fileURLToPath as z}from"url";var Z=Y()==="win32",tt=["concrete-plan","scip-ai-cleanup","scip-explore","scip-debloat","scip-doc-reconcile","scip-maintainability","scip-verify","scip-language-playbook"];function et(i={}){let t=i.quiet?()=>{}:console.log,e=z(import.meta.url),s=S(k(e),"..","skills"),n=[d(y(),".claude","skills"),d(y(),".codex","skills"),d(y(),".agents","skills")],o={installed:[],skipped:[],alreadyLinked:[]};for(let r of n){let h=k(r);if(!x(h))continue;J(r,{recursive:!0});let a=it(r);for(let c of tt){let u=d(s,c),p=d(r,c);if(!x(u)){o.skipped.push(`${a}/${c}`);continue}if(x(p)){try{let E=K(p);if(S(E)===S(u)){o.alreadyLinked.push(`${a}/${c}`),t(` ok: ${c} \u2192 ${a} (already linked)`);continue}}catch{o.skipped.push(`${a}/${c}`),t(` skip: ${c} \u2192 ${a} (exists, not a symlink)`);continue}Q(p)}V(u,p,Z?"junction":"dir"),o.installed.push(`${a}/${c}`),t(` done: ${c} \u2192 ${a}`)}}return o}function it(i){return i.includes(".codex")?"Codex":i.includes(".agents")?"Agents":"Claude"}export{m as Watcher,j as getScipVersion,M as initProjectConfig,et as installSkills,b as isScipInstalled,N as loadProjectConfig,W as printScipInstallInstructions,f as resolveIndexPaths};
|
|
2
|
+
`),e}function g(i){return F(i,{recursive:!0}),i}import{watch as q}from"fs";import{existsSync as I,renameSync as T}from"fs";import{join as U,relative as H}from"path";import{fork as G}from"child_process";import X from"ignore";var m=class{projectRoot;watchConfig;indexPaths;languages;pnpmWorkspaces;onStatus;onReindexComplete;onError;status={state:"idle"};debounceTimer=null;cooldownTimer=null;dirty=!1;changedFiles=0;reindexInFlight=!1;lastReindexEnd=0;fsWatchers=[];gitignoreFilter;extraIgnore;stopped=!1;constructor(t){this.projectRoot=t.projectRoot,this.watchConfig=R(t.config),this.indexPaths=f(t.projectRoot,t.config),this.languages=t.languages,this.pnpmWorkspaces=t.config.indexer?.typescript?.pnpmWorkspaces??!1,this.onStatus=t.onStatus??(()=>{}),this.onReindexComplete=t.onReindexComplete??(()=>{}),this.onError=t.onError??(e=>console.error(e.message)),this.gitignoreFilter=w(t.projectRoot),this.extraIgnore=X(),this.watchConfig.ignore.length>0&&this.extraIgnore.add(this.watchConfig.ignore)}start(){this.stopped=!1,this.setStatus({state:"idle"});try{let t=q(this.projectRoot,{recursive:!0},(e,s)=>{s&&!this.stopped&&this.handleFileChange(s)});this.fsWatchers.push(t)}catch{this.onError(new Error("Failed to start file watcher. On Linux, you may need to increase inotify limits: sysctl -w fs.inotify.max_user_watches=524288"))}}stop(){this.stopped=!0;for(let t of this.fsWatchers)t.close();this.fsWatchers=[],this.clearDebounceTimer(),this.clearCooldownTimer(),this.setStatus({state:"idle"})}handleFileChange(t){let e=H(this.projectRoot,U(this.projectRoot,t));if(this.gitignoreFilter.isIgnored(e)||this.extraIgnore.ignores(e)||t.endsWith("index.db")||t.endsWith("index.scip")||t.endsWith("index.db.tmp")||t.endsWith(".scipquery.json"))return;if(this.changedFiles++,this.reindexInFlight){this.dirty=!0,this.setStatus({state:"indexing",startedAt:this.status.startedAt});return}if(this.status.state==="cooldown"){this.dirty=!0,this.setStatus({state:"cooldown",until:this.status.until,dirty:!0});return}this.clearDebounceTimer();let 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 t=Date.now()-this.lastReindexEnd;if(this.lastReindexEnd>0&&t<this.watchConfig.cooldownMs){let s=this.watchConfig.cooldownMs-t;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 e=Date.now();this.setStatus({state:"indexing",startedAt:e}),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((t,e)=>{let s=Date.now(),n=this.indexPaths.dbPath+".tmp",o=B(this.indexPaths.indexPath),r=G(new URL("./reindex-worker.js",import.meta.url).pathname,[],{env:{...process.env,SCIP_REINDEX_PROJECT_ROOT:this.projectRoot,SCIP_REINDEX_OUTPUT_SCIP:o,SCIP_REINDEX_OUTPUT_DB:n,SCIP_REINDEX_LANGUAGES:this.languages?.join(",")??"",SCIP_REINDEX_PNPM_WORKSPACES:this.pnpmWorkspaces?"1":""},stdio:"pipe"});r.on("exit",h=>{if(h===0)try{I(n)&&T(n,this.indexPaths.dbPath),I(o)&&T(o,this.indexPaths.indexPath),t(Date.now()-s)}catch(a){e(new Error(`Atomic swap failed: ${a}`))}else e(new Error(`Reindex worker exited with code ${h}`))}),r.on("error",e)})}setStatus(t){this.status=t,this.onStatus(t)}clearDebounceTimer(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null)}clearCooldownTimer(){this.cooldownTimer&&(clearTimeout(this.cooldownTimer),this.cooldownTimer=null)}};function B(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 d,dirname as k,resolve as S}from"path";import{homedir as y,platform as Y}from"os";import{fileURLToPath as z}from"url";var Z=Y()==="win32",tt=["scip-query","concrete-plan","scip-ai-cleanup","scip-explore","scip-debloat","scip-doc-reconcile","scip-maintainability","scip-verify","scip-language-playbook"];function et(i={}){let t=i.quiet?()=>{}:console.log,e=z(import.meta.url),s=S(k(e),"..","skills"),n=[d(y(),".claude","skills"),d(y(),".codex","skills"),d(y(),".agents","skills")],o={installed:[],skipped:[],alreadyLinked:[]};for(let r of n){let h=k(r);if(!x(h))continue;J(r,{recursive:!0});let a=it(r);for(let c of tt){let u=d(s,c),p=d(r,c);if(!x(u)){o.skipped.push(`${a}/${c}`);continue}if(x(p)){try{let E=K(p);if(S(E)===S(u)){o.alreadyLinked.push(`${a}/${c}`),t(` ok: ${c} \u2192 ${a} (already linked)`);continue}}catch{o.skipped.push(`${a}/${c}`),t(` skip: ${c} \u2192 ${a} (exists, not a symlink)`);continue}Q(p)}V(u,p,Z?"junction":"dir"),o.installed.push(`${a}/${c}`),t(` done: ${c} \u2192 ${a}`)}}return o}function it(i){return i.includes(".codex")?"Codex":i.includes(".agents")?"Agents":"Claude"}export{m as Watcher,j as getScipVersion,M as initProjectConfig,et as installSkills,b as isScipInstalled,N as loadProjectConfig,W as printScipInstallInstructions,f 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.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Language-agnostic code intelligence CLI powered by SCIP indexes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -135,6 +135,10 @@
|
|
|
135
135
|
"import": "./dist/queries/imports.js",
|
|
136
136
|
"types": "./dist/queries/imports.d.ts"
|
|
137
137
|
},
|
|
138
|
+
"./queries/incomplete-migration": {
|
|
139
|
+
"import": "./dist/queries/incomplete-migration.js",
|
|
140
|
+
"types": "./dist/queries/incomplete-migration.d.ts"
|
|
141
|
+
},
|
|
138
142
|
"./queries/index": {
|
|
139
143
|
"import": "./dist/queries/index.js",
|
|
140
144
|
"types": "./dist/queries/index.d.ts"
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scip-query
|
|
3
|
+
description: Router for codebase work in scip-query-indexed projects. Use whenever exploring, planning, implementing, refactoring, extracting helpers, verifying changes, hunting duplication or bloat, fixing stale docs, or cleaning up after an AI coding session — or when unsure which scip-* skill applies. Picks the right specialist skill and the commands that must run for each phase of work.
|
|
4
|
+
allowed-tools: [Bash, Skill]
|
|
5
|
+
keywords: [scip, codebase, explore, plan, implement, refactor, extract, verify, check-work, cleanup, duplication, bloat, drift, route, which-skill]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# scip-query Router
|
|
9
|
+
|
|
10
|
+
This project is indexed by `scip-query` — compiler-resolved code intelligence.
|
|
11
|
+
Your job here is only to route: identify the phase of work, invoke the right
|
|
12
|
+
specialist skill, and enforce the non-negotiable checks. Do not improvise a
|
|
13
|
+
workflow when a specialist skill exists for it.
|
|
14
|
+
|
|
15
|
+
If the index might be stale (code changed since the last reindex), run
|
|
16
|
+
`scip-query reindex` before anything else.
|
|
17
|
+
|
|
18
|
+
## The default loop for any implementation request
|
|
19
|
+
|
|
20
|
+
When the user asks you to build, change, or fix something non-trivial:
|
|
21
|
+
|
|
22
|
+
1. **Plan first** — invoke `concrete-plan` (every claim in the plan must come
|
|
23
|
+
from a scip-query command, anchored by `scip-query plan-context <target>`).
|
|
24
|
+
2. **Implement** the plan.
|
|
25
|
+
3. **Run the post-checks that match what you did** (table below) — don't wait
|
|
26
|
+
to be asked.
|
|
27
|
+
4. **Gate before done** — `scip-query reindex && scip-query diff-gate`; fix
|
|
28
|
+
findings or state explicitly why each is accepted.
|
|
29
|
+
|
|
30
|
+
## Route by phase of work
|
|
31
|
+
|
|
32
|
+
| You are about to... | Invoke | Anchor commands |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| Understand how something works, trace a system end-to-end | `scip-explore` | `scip-query system <module>`, `scip-query trace <symbol>` |
|
|
35
|
+
| Plan a feature, fix, or refactor | `concrete-plan` | `scip-query plan-context <target>` |
|
|
36
|
+
| Pick high-signal commands for an unfamiliar language | `scip-language-playbook` | — |
|
|
37
|
+
| Verify work you just finished (any implementation, refactor, or extraction) | `scip-verify` | `scip-query reindex && scip-query diff-gate` |
|
|
38
|
+
| Find dead code, duplication, or structural bloat | `scip-debloat` | `scip-query health` |
|
|
39
|
+
| Clean up after AI-assisted coding sessions | `scip-ai-cleanup` | `scip-query recent-duplicates`, `scip-query incomplete-migration` |
|
|
40
|
+
| Reconcile docs/standards that drifted from the code | `scip-doc-reconcile` | `scip-query doc-drift <doc>` |
|
|
41
|
+
| Review architecture, boundaries, hidden policies | `scip-maintainability` | `scip-query bottlenecks`, `scip-query coupling` |
|
|
42
|
+
|
|
43
|
+
Invoke skills by name (Skill tool or slash command). If skill invocation is
|
|
44
|
+
unavailable in this harness, read `~/.agents/skills/<name>/SKILL.md` and
|
|
45
|
+
follow it directly.
|
|
46
|
+
|
|
47
|
+
## Match the post-check to the change
|
|
48
|
+
|
|
49
|
+
After implementing, run the checks for what the change actually did — every
|
|
50
|
+
row, every time it applies:
|
|
51
|
+
|
|
52
|
+
| You just... | Run |
|
|
53
|
+
|---|---|
|
|
54
|
+
| Extracted a helper / created an abstraction | `scip-query incomplete-migration` — lists call sites that still hold the logic inline; migrate them or state why they differ |
|
|
55
|
+
| Wrote a brand-new helper or module | `scip-query similar <it>` and `scip-query recent-duplicates` — reuse beats re-implementation; delete the echo |
|
|
56
|
+
| Added parameters, options, or config flags | `scip-query unused-params` — speculative "for later" params must go |
|
|
57
|
+
| Added a forwarding or wrapper layer | `scip-query wrapper-candidates` and `scip-query passthrough-candidates` — indirection must earn its keep |
|
|
58
|
+
| Added an interface, base class, or type alias | `scip-query stale-abstractions` — one real consumer is not an abstraction |
|
|
59
|
+
| Changed a schema, contract, config, or generated file | `scip-query co-change <file>` — update the historical partners or confirm the coupling broke |
|
|
60
|
+
| Changed code that docs describe | `scip-query doc-drift` — update the docs that now lie |
|
|
61
|
+
| Deleted code | `scip-query cleanup-plan --verify` — take the whole cascade with compiler proof |
|
|
62
|
+
|
|
63
|
+
Confusable detectors (full guide: docs/DETECTOR_GUIDE.md): `unused-params` is
|
|
64
|
+
parameter-level; `passthrough-candidates` = one **callee** (only forwards);
|
|
65
|
+
`wrapper-candidates` = one **caller** (no reuse); `stale-abstractions` is
|
|
66
|
+
type-level. `recent-duplicates` = similarity + git age (which copy is the
|
|
67
|
+
echo); `incomplete-migration` = the inverse (the new helper is canonical, the
|
|
68
|
+
old inline copies must go).
|
|
69
|
+
|
|
70
|
+
**Before declaring any change done** — run `scip-query diff-gate`. Exit 1
|
|
71
|
+
means findings, each with a remediation. Fix them or knowingly accept them
|
|
72
|
+
with a stated reason; never ignore them silently.
|
|
73
|
+
|
|
74
|
+
## One-time project setup
|
|
75
|
+
|
|
76
|
+
If this project has no agent guidance yet, offer to run
|
|
77
|
+
`scip-query setup-agent` — it seeds the AGENTS.md block (every agent reads
|
|
78
|
+
it) and, with `--git-hook`, installs a pre-commit diff gate that fires no
|
|
79
|
+
matter which agent or human wrote the change.
|
package/dist/chunk-6P5W4U6G.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import{a as h}from"./chunk-NOVKLH2F.js";import{d as p}from"./chunk-64UY7VTR.js";import{c as u,f,h as g}from"./chunk-SOGLYIJ4.js";import{execFileSync as d}from"child_process";function A(e,n={}){let t=b(e,n);return t.note?C(t.note,t.changedFileLines):t.changedFiles.length===0?D(t.changedFileLines):I(t.changedFiles,[S(e,t.changedFiles,t.changedFiles)])}function b(e,n={}){let{base:t="HEAD"}=n;try{let s=F(e.config.projectRoot,t);return{changedFileLines:s,changedFiles:_(e,s),note:s.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],note:"Unable to compute git diff."}}}function S(e,n,t){let s=new h(e),r=new Set(t),a=[],l=new Map,o=n.flatMap(i=>s.definitionsForFile(i)).filter(E).sort((i,m)=>i.relativePath.localeCompare(m.relativePath)||i.startLine-m.startLine),c=p(e,o);for(let i of o)x(e,i,t,r,a,l,c.get(i.symbolId)??new Set);return{changedSymbols:a,consumerEntries:[...l.entries()].map(([i,m])=>({file:i,symbols:[...m].sort()}))}}function I(e,n){let t=new Map,s=n.flatMap(a=>a.changedSymbols);for(let a of n)for(let l of a.consumerEntries){let o=t.get(l.file);o||(o=new Set,t.set(l.file,o));for(let c of l.symbols)o.add(c)}let r=N(t);return{changedFiles:[...e],changedSymbols:s,affectedConsumers:r,summary:{totalChangedFiles:e.length,totalChangedSymbols:s.length,totalAffectedFiles:r.length}}}function C(e,n=[]){return{changedFiles:n,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:n.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function D(e){return{changedFiles:e,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:e.length,totalChangedSymbols:0,totalAffectedFiles:0,note:"Changed files are not present in the current SCIP index."}}}function F(e,n){let t=d("git",["diff","--name-only",n],{encoding:"utf-8",cwd:e,timeout:1e4}),s=d("git",["diff","--name-only","--cached",n],{encoding:"utf-8",cwd:e,timeout:1e4}),r=d("git",["ls-files","--others","--exclude-standard"],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([t,s,r].flatMap(a=>a.split(`
|
|
2
|
-
`)).map(a=>a.trim()).filter(a=>a.length>0))]}function _(e,n){let t=[];for(let s of n){let r=e.get(`SELECT relative_path FROM documents
|
|
3
|
-
WHERE relative_path LIKE ?
|
|
4
|
-
LIMIT 1`,`%${s}`);r&&!e.isIgnored(r.relative_path)&&t.push(r.relative_path)}return t}function x(e,n,t,s,r,a,l){let o=Math.max(R(e,n.symbolId),l.size);if(!v(n,o))return;let c=u(n.symbol);r.push({symbol:n.symbol,shortName:c,file:n.relativePath,fanIn:o});for(let i of M(e,n.symbolId,t))y(e,s,a,i,c);for(let i of l)y(e,s,a,i,c)}function R(e,n){return e.get(`SELECT COUNT(DISTINCT c.document_id) AS fan_in
|
|
5
|
-
FROM mentions m
|
|
6
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
7
|
-
WHERE m.symbol_id = ?
|
|
8
|
-
AND m.role != 1`,n)?.fan_in??0}function M(e,n,t){return t.length===0?[]:e.all(`SELECT DISTINCT ref_d.relative_path
|
|
9
|
-
FROM mentions m
|
|
10
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
11
|
-
JOIN documents ref_d ON c.document_id = ref_d.id
|
|
12
|
-
WHERE m.symbol_id = ?
|
|
13
|
-
AND m.role != 1
|
|
14
|
-
AND ref_d.relative_path NOT IN (${t.map(()=>"?").join(",")})
|
|
15
|
-
${e.pathExclusionsFor("ref_d")}`,n,...t).map(r=>r.relative_path)}function y(e,n,t,s,r){if(e.isIgnored(s)||n.has(s))return;let a=t.get(s);a||(a=new Set,t.set(s,a)),a.add(r)}function N(e){return[...e.entries()].map(([n,t])=>({file:n,consumedSymbols:t.size})).sort((n,t)=>t.consumedSymbols-n.consumedSymbols)}function E(e){return!(g(e.symbol)||e.parentTypeName!==null&&!f(e.symbol))}function v(e,n){return f(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&n>0}export{A as a,b,S as c,I as d};
|
|
16
|
-
//# sourceMappingURL=chunk-6P5W4U6G.js.map
|
package/dist/chunk-GTZAU7OL.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as F}from"./chunk-JTCEWV7Q.js";import{a as k}from"./chunk-AQYBOORI.js";import{a as z}from"./chunk-DJTJ3DLZ.js";import{a as $}from"./chunk-SSINY7HL.js";import{a as B}from"./chunk-QYQXPPDI.js";import{a as M}from"./chunk-SLOIQKY7.js";import{b as _}from"./chunk-K4Z3FCUJ.js";import{a as T}from"./chunk-HVXIXDLV.js";import{a as D}from"./chunk-2EC4JTHC.js";import{a as x,b as w}from"./chunk-OIMM7KMI.js";import{b as P}from"./chunk-4A4JFNWG.js";import{b as R,c as E}from"./chunk-N5D5ZCBW.js";import{a as L}from"./chunk-K6YIGVL7.js";import{a as A}from"./chunk-EKP7XJ6L.js";import{e as b,f as C}from"./chunk-TQTVM27C.js";function y(e){let i=X(e),{breakdown:t}=J(e),n=I(t,"risk"),r=I(t,"hygiene");return{score:Math.min(n,r),riskScore:n,hygieneScore:r,scoreBreakdown:t,overview:{documents:e.statsResult.documents,symbols:e.statsResult.symbols,indexSizeBytes:e.statsResult.indexSizeBytes},findings:{deadSymbols:e.dead.count,deadLoc:e.dead.loc,isolatedSymbols:e.isolated.count,isolatedLoc:e.isolated.loc,cycles:e.realCycleCount,similarPairs:e.similarCount,extractionCandidates:e.extractCount,wrappers:e.wrappers.count,passthroughs:e.passthroughs.count,staleTypes:e.stale.count,driftedFiles:e.drift.count,complexityHotspotCount:e.complexity.extremeCount,hiddenCouplingPairs:e.gitEvidence?.hiddenCoupling.pairCount??null},axes:q(e),validation:Y(e),suppressions:e.suppressions,actions:i,topComplexity:e.complexity.top,warnings:e.warnings.length>0?e.warnings:void 0}}function q(e){return{deletable:{loc:e.dead.loc+e.isolated.loc,symbols:e.dead.count+e.isolated.count},cycles:{count:e.realCycleCount},changeAmplification:e.gitEvidence?.amplification??null,hiddenCoupling:e.gitEvidence?.hiddenCoupling??null,churnWeightedComplexity:Q(e),evidenceQuality:{graphFindings:e.dead.count+e.isolated.count+e.realCycleCount,heuristicFindings:e.similarCount+e.extractCount+e.wrappers.count+e.passthroughs.count+e.stale.count+e.drift.count,userSuppressed:e.suppressions?.total??0}}}function Q(e){let i=e.gitEvidence?.fileStats;return i?e.complexity.top.map(t=>{let n=t.file?i[t.file]?.changes??0:0;return{...t,changes:n,weighted:h(t.score*Math.log2(1+n))}}).sort((t,n)=>n.weighted-t.weighted):null}function Y(e){let i=e.gitEvidence?.fileStats;if(!i)return null;let t={dead:e.dead.files??[],isolated:e.isolated.files??[],wrappers:e.wrappers.files??[],passthroughs:e.passthroughs.files??[],stale:e.stale.files??[]},n=new Set(Object.values(t).flat()),r=0,o=0,a=0;for(let[m,l]of Object.entries(i))n.has(m)?r+=l.fixChanges:(o+=l.fixChanges,a+=1);let p=n.size>0?h(r/n.size):0,u=a>0?h(o/a):0,f={};for(let[m,l]of Object.entries(t)){let d=new Set(l);if(d.size===0)continue;let g=0;for(let U of d)g+=i[U]?.fixChanges??0;let v=h(g/d.size);f[m]={flaggedFiles:d.size,fixDensity:v,lift:u>0?h(v/u):null}}return{flaggedFiles:n.size,flaggedFixDensity:p,baselineFixDensity:u,ratio:n.size>0&&u>0?h(p/u):null,byCategory:f}}function h(e){return Math.round(e*100)/100}function X(e){let i=[];if(e.dead.count>0&&i.push({category:"Dead code",evidence:"graph-fact",description:`${e.dead.count} symbols with zero references anywhere \u2014 safe to delete`,effort:"low",impact:"high",count:e.dead.count,locRecoverable:e.dead.loc}),e.isolated.count>0&&i.push({category:"Isolated symbols",evidence:"graph-fact",description:`${e.isolated.count} symbols completely disconnected from the codebase graph`,effort:"low",impact:"medium",count:e.isolated.count,locRecoverable:e.isolated.loc}),e.realCycleCount>0&&i.push({category:"Circular dependencies",evidence:"graph-fact",description:`${e.realCycleCount} cycle(s) \u2014 break with dependency inversion or module restructuring`,effort:"medium",impact:"high",count:e.realCycleCount,locRecoverable:0}),e.similarCount>0&&i.push({category:"Similar functions",evidence:"heuristic",description:`${e.similarCount} pairs with real logic overlap (beyond shared imports) \u2014 consolidation candidates`,effort:"medium",impact:"medium",count:e.similarCount,locRecoverable:0}),e.extractCount>0&&i.push({category:"Extraction candidates",evidence:"heuristic",description:`${e.extractCount} large functions with isolated callee clusters \u2014 extract method opportunities`,effort:"medium",impact:"medium",count:e.extractCount,locRecoverable:0}),e.wrappers.count>0&&i.push({category:"Wrapper functions",evidence:"heuristic",description:`${e.wrappers.count} single-consumer symbols that could be inlined`,effort:"low",impact:"low",count:e.wrappers.count,locRecoverable:e.wrappers.loc}),e.passthroughs.count>0&&i.push({category:"Passthrough functions",evidence:"heuristic",description:`${e.passthroughs.count} functions that just forward to one callee \u2014 unnecessary indirection`,effort:"low",impact:"low",count:e.passthroughs.count,locRecoverable:e.passthroughs.loc}),e.stale.count>0){let r=[];e.stale.unused>0&&r.push(`${e.stale.unused} unused`),e.stale.singleUse>0&&r.push(`${e.stale.singleUse} single-consumer (not in types file)`),i.push({category:"Stale abstractions",evidence:"heuristic",description:`${r.join(", ")} \u2014 premature abstraction`,effort:"low",impact:"medium",count:e.stale.count,locRecoverable:e.stale.loc})}if(e.drift.count>0){let r=[];e.drift.unusedImports>0&&r.push(`${e.drift.unusedImports} unused imports`),e.drift.layerViolations>0&&r.push(`${e.drift.layerViolations} layer violations`),i.push({category:"Structural drift",evidence:"heuristic",description:r.join(", "),effort:e.drift.layerViolations>0?"medium":"low",impact:e.drift.layerViolations>0?"medium":"low",count:e.drift.count,locRecoverable:0})}if(e.gitEvidence&&e.gitEvidence.hiddenCoupling.pairCount>0){let r=e.gitEvidence.hiddenCoupling.top[0];i.push({category:"Hidden coupling",evidence:"change-graph",description:`${e.gitEvidence.hiddenCoupling.pairCount} file pair(s) co-change without a dependency edge`+(r?` (e.g. ${r.fileA} \u2194 ${r.fileB})`:"")+" \u2014 name the shared concept or enforce the sync",effort:"medium",impact:"high",count:e.gitEvidence.hiddenCoupling.pairCount,locRecoverable:0})}let t={high:3,medium:2,low:1},n={low:3,medium:2,high:1};return i.sort((r,o)=>{let a=t[r.impact]*n[r.effort];return t[o.impact]*n[o.effort]-a}),i}var K={"dead-code":"risk",isolated:"risk",cycles:"risk",complexity:"risk","hidden-coupling":"risk",similar:"hygiene",extract:"hygiene",wrappers:"hygiene",passthroughs:"hygiene","stale-abstractions":"hygiene",drift:"hygiene"};function I(e,i){let t=e.filter(n=>n.kind===i).reduce((n,r)=>n+r.points,0);return Math.max(0,Math.min(100,100-t))}function J(e){let i=Math.max(e.statsResult.documents,1),t=Math.max(e.statsResult.symbols,1),n=[],r=(l,d,g)=>{d>0&&n.push({axis:l,points:d,detail:g,kind:K[l]??"hygiene"})},o=e.dead.count/t;r("dead-code",Math.min(20,Math.round(o*200)),`${e.dead.count} dead symbols (${e.dead.loc} LOC deletable)`);let a=e.isolated.count/t;r("isolated",Math.min(10,Math.round(a*200)),`${e.isolated.count} isolated symbols (${e.isolated.loc} LOC deletable)`),r("cycles",Math.min(15,e.realCycleCount*5),`${e.realCycleCount} real dependency cycle(s)`);let p=e.similarCount/t*1e3;r("similar",Math.min(10,Math.round(p)),`${e.similarCount} similar function pair(s)`);let u=e.extractCount/t*1e3;r("extract",Math.min(5,Math.round(u/2)),`${e.extractCount} extraction candidate(s)`),r("wrappers",Math.min(3,e.wrappers.count),`${e.wrappers.count} wrapper candidate(s)`),r("passthroughs",Math.min(3,e.passthroughs.count),`${e.passthroughs.count} passthrough candidate(s)`);let f=e.stale.count/Math.max(t*.1,1);r("stale-abstractions",Math.min(8,Math.round(f*10)),`${e.stale.count} stale abstraction(s)`);let m=e.drift.count/i;return r("drift",Math.min(5,Math.round(m*50)),`${e.drift.count} drift finding(s)`),r("complexity",Math.min(5,e.complexity.extremeCount*2),`${e.complexity.extremeCount} extreme complexity hotspot(s)`),e.gitEvidence&&r("hidden-coupling",Math.min(5,e.gitEvidence.hiddenCoupling.pairCount),`${e.gitEvidence.hiddenCoupling.pairCount} co-changing pair(s) without a dependency edge`),{breakdown:n}}import{getHeapStatistics as Z}from"v8";var ee=64*1024*1024;function H(){let e=globalThis.gc;if(!e)return;let i=Z();i.heap_size_limit-i.used_heap_size<ee||e()}var te=50,ie=75e3,ne=5e3,O=2500,re=["overview","dead","isolated","cycles","similar","extract-candidates","wrapper-candidates","passthrough-candidates","stale-abstractions","drift","complexity-hotspots","git-evidence","suppressions"],j={overview:(e,i,t,n)=>({phase:"overview",statsResult:n,warnings:t.warnings}),dead:(e,i,t)=>({phase:"dead",dead:ae(e,i,t)}),isolated:(e,i,t)=>({phase:"isolated",isolated:se(e,i,t)}),cycles:(e,i,t)=>({phase:"cycles",realCycleCount:ce(e,i,t)}),similar:(e,i,t)=>({phase:"similar",similarCount:ue(e,i,t)}),"extract-candidates":(e,i,t)=>({phase:"extract-candidates",extractCount:le(e,i,t)}),"wrapper-candidates":(e,i,t)=>({phase:"wrapper-candidates",wrappers:de(e,i,t)}),"passthrough-candidates":(e,i,t)=>({phase:"passthrough-candidates",passthroughs:he(e,i,t)}),"stale-abstractions":(e,i,t)=>({phase:"stale-abstractions",stale:pe(e,i,t)}),drift:(e,i,t)=>({phase:"drift",drift:ge(e,i,t)}),"complexity-hotspots":(e,i,t)=>({phase:"complexity-hotspots",complexity:be(e,i,t)}),"git-evidence":(e,i,t)=>({phase:"git-evidence",gitEvidence:me(e,t)}),suppressions:(e,i,t)=>({phase:"suppressions",suppressions:fe(e,t)})};function Ge(e,i={}){return N(e,i.full===!0,(t,n)=>{let r=oe(e,i.scope,t,n);return y(r)})}function We(e,i,t={}){return N(e,t.full===!0,(n,r)=>j[i](e,t.scope,r,n))}function N(e,i,t){let n=k(e),r=Ce(n,i);try{return t(n,r)}finally{x(e,{semanticProvider:!0}),H()}}function Ue(e){return y(G(e))}function G(e){let i=s(e,"overview");return{statsResult:i.statsResult,warnings:i.warnings,dead:s(e,"dead").dead,isolated:s(e,"isolated").isolated,realCycleCount:s(e,"cycles").realCycleCount,similarCount:s(e,"similar").similarCount,extractCount:s(e,"extract-candidates").extractCount,wrappers:s(e,"wrapper-candidates").wrappers,passthroughs:s(e,"passthrough-candidates").passthroughs,stale:s(e,"stale-abstractions").stale,drift:s(e,"drift").drift,complexity:s(e,"complexity-hotspots").complexity,gitEvidence:V(e,"git-evidence")?.gitEvidence??null,suppressions:V(e,"suppressions")?.suppressions??null}}function V(e,i){return e.find(t=>t.phase===i)}function s(e,i){let t=e.find(n=>n.phase===i);if(!t)throw new Error(`Missing health phase result: ${i}`);return t}function oe(e,i,t,n){return G(re.map(r=>j[r](e,i,n,t)))}function ae(e,i,t){return c(e,t,"dead",()=>{let n=w(e,{scope:i,minLoc:3,skipBarrels:!0,deadCodeOnly:!0,scanLimit:t.candidateScanLimit,semantic:!1});return S(He(e,n.symbols))})}function se(e,i,t){return c(e,t,"isolated",()=>{let n=B(e,{scope:i,minLoc:3,scanLimit:t.candidateScanLimit,semantic:!1});return S(Se(e,n))})}function ce(e,i,t){return c(e,t,"cycles",()=>A(e,{scope:i}).filter(r=>r.kind==="real").length)}function ue(e,i,t){return c(e,t,"similar",()=>_(e,{scope:i,minSimilarity:.6,limit:50,minCallees:4,scanLimit:t.candidateScanLimit,semantic:!1}).length)}function le(e,i,t){return c(e,t,"extract-candidates",()=>T(e,{scope:i,minLoc:15,minCallees:5,limit:50,scanLimit:t.candidateScanLimit,semantic:!1}).length)}function de(e,i,t){return W(e,t,"wrapper-candidates",()=>z(e,{scope:i,maxLoc:15,limit:50,scanLimit:t.candidateScanLimit,semantic:!1}))}function he(e,i,t){return W(e,t,"passthrough-candidates",()=>M(e,{scope:i,maxLoc:15,limit:50,scanLimit:t.candidateScanLimit,semantic:!1}))}function pe(e,i,t){return c(e,t,"stale-abstractions",()=>{let n=$(e,{scope:i,minLoc:3,limit:50,scanLimit:t.candidateScanLimit,semantic:!1}),r=n.filter(o=>o.consumers===0).length;return{count:n.length,loc:n.reduce((o,a)=>o+a.loc,0),files:[...new Set(n.map(o=>o.file))],unused:r,singleUse:n.length-r}})}function me(e,i){return c(e,i,"git-evidence",()=>{let t=R(e);if(!t)return null;let n=P(e,void 0,{limit:50}),r={};for(let[o,a]of t)r[o]={changes:a.changes,fixChanges:a.fixChanges};return{amplification:E(e),hiddenCoupling:{pairCount:n.findings.length,top:n.findings.slice(0,5).map(o=>({fileA:o.fileA,fileB:o.fileB,together:o.together,confidence:o.confidence}))},fileStats:r}})}function fe(e,i){return c(e,i,"suppressions",()=>{let t=F(e);return{total:t.total,byCategory:{...t.byCategory}}})}function ge(e,i,t){return c(e,t,"drift",()=>{let n=D(e,{scope:i,semantic:!1});return{count:n.unusedImports+n.layerViolations,unusedImports:n.unusedImports,layerViolations:n.layerViolations}})}function be(e,i,t){return c(e,t,"complexity-hotspots",()=>{let n=L(e,{scope:i,minLoc:10,limit:10,scanLimit:t.candidateScanLimit,semantic:!1});return{top:n.slice(0,5).map(r=>({symbol:r.shortName,score:r.score,file:r.file})),extremeCount:n.filter(r=>r.score>te).length}})}function Ce(e,i){return e.symbols>=ie||e.documents>=ne?i?{candidateScanLimit:void 0,releaseCachesBetweenPhases:!0,warnings:["Large index detected; running unbounded health analyses because --full was supplied."]}:{candidateScanLimit:O,releaseCachesBetweenPhases:!0,warnings:[`Large index detected; candidate-style health checks scanned their highest-priority ${O} symbols. Run "scip-query health --full" for unbounded candidate counts.`]}:{candidateScanLimit:void 0,releaseCachesBetweenPhases:!0,warnings:[]}}function xe(e,i){i.releaseCachesBetweenPhases&&(x(e),H())}function c(e,i,t,n){ye(t);try{return n()}finally{xe(e,i)}}function W(e,i,t,n){return c(e,i,t,()=>S(n()))}function ye(e){process.env.SCIP_QUERY_HEALTH_TRACE==="1"&&console.error(`[health] ${e}`)}function He(e,i){return i.filter(t=>!b(e,t.relativePath)&&!C(e,t.symbol,t.relativePath)&&t.kind==="dead-code")}function Se(e,i){return i.filter(t=>!b(e,t.relativePath)&&!C(e,t.symbol,t.relativePath))}function S(e){let i=new Set;for(let t of e){let n=t.relativePath??t.file;n&&i.add(n)}return{count:e.length,loc:e.reduce((t,n)=>t+n.loc,0),files:[...i]}}export{re as a,Ge as b,We as c,Ue as d};
|
|
2
|
-
//# sourceMappingURL=chunk-GTZAU7OL.js.map
|
package/dist/chunk-K4Z3FCUJ.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{a as x,b as y,d as R,e as N}from"./chunk-RKTDEIHF.js";import{c as M}from"./chunk-MX6F756F.js";import{a as k}from"./chunk-NOVKLH2F.js";import{a as P}from"./chunk-PCMVXWDC.js";import{a as A}from"./chunk-7I6KNKE3.js";import{c as p,d as q,g as w}from"./chunk-SOGLYIJ4.js";import{a as z}from"./chunk-WQFOZIID.js";function re(e,i,t={}){let{minSimilarity:s=.4,limit:r=20}=t,a=Z(e,i,{semantic:t.semantic!==!1});if(!a)return[];if(!w(a.symbol))return[];let n=O(e,a,s,{scanLimit:t.scanLimit,semantic:t.semantic!==!1});return n.length>0?n.slice(0,r):W(e,i,{minSimilarity:s,limit:r})}function O(e,i,t,s){let r=$(e,{minCallees:3,excludeSymbol:i.symbol,scanLimit:s.scanLimit,semantic:s.semantic}),a=R([i,...r].map(o=>o.callees)),n=[];for(let o of r){if(o.callees.size<3)continue;let l=T(i,o,a,{minSimilarity:t,requireSignificantShared:1,requireSharedCount:0});l&&n.push(l)}return n.sort((o,l)=>l.similarity-o.similarity),n}function T(e,i,t,s){let{similarity:r,significantShared:a}=N(e.callees,i.callees,t);if(r<s.minSimilarity)return null;let n=x(e.callees,i.callees).size;if(a.length<s.requireSignificantShared&&n<s.requireSharedCount)return null;let o=a.length>0?a:[...x(e.callees,i.callees)];return{symbolA:e.symbol,shortNameA:p(e.symbol),fileA:e.file,symbolB:i.symbol,shortNameB:p(i.symbol),fileB:i.file,similarity:r,similarityBasis:"callees",sharedCallees:o.map(p),uniqueToA:[...y(e.callees,i.callees)].map(p),uniqueToB:[...y(i.callees,e.callees)].map(p)}}function ae(e,i={}){let{minSimilarity:t=.5,limit:s=20,scope:r,minCallees:a=4,crossFileOnly:n=!1,scanLimit:o}=i,l=$(e,{minCallees:a,scope:r,scanLimit:o,semantic:i.semantic!==!1}),c=R(l.map(m=>m.callees)),u=new Map;for(let m of l)for(let b of m.callees)u.set(b,(u.get(b)??0)+1);let h=Math.max(8,Math.ceil(Math.sqrt(l.length))),F=new Map;for(let m=0;m<l.length;m+=1)for(let b of l[m].callees){if((u.get(b)??0)>h)continue;let g=F.get(b);g||(g=[],F.set(b,g)),g.push(m)}let C=[],B=new Set;e:for(let m=0;m<l.length;m+=1){let b=l[m],g=new Set;for(let D of b.callees){let S=F.get(D);if(S)for(let f of S)f>m&&g.add(f)}for(let D of g){let S=`${m}|${D}`;if(B.has(S))continue;B.add(S);let f=l[D];if(n&&b.file===f.file)continue;if(b.paramCount>=0&&f.paramCount>=0){let j=Math.abs(b.paramCount-f.paramCount),_=Math.max(2,Math.ceil(Math.max(b.paramCount,f.paramCount)*.5));if(j>_)continue}let L=T(b,f,c,{minSimilarity:t,requireSignificantShared:2,requireSharedCount:4});if(L&&(C.push(L),C.length>s*5))break e}}return C.sort((m,b)=>b.similarity-m.similarity),C.slice(0,s)}var V=["ScipDatabase#all","ScipDatabase#get","ScipDatabase#prepare","ScipDatabase#pathExclusionsFor","ScipDatabase#isIgnored","ScipDatabase#symbolNoiseFor","PerDbValue#get","PerDbValue#has",":storage:db:ScipDatabase:all",":storage:db:ScipDatabase:get",":storage:db:ScipDatabase:prepare",":storage:db:ScipDatabase:pathExclusionsFor",":storage:db:ScipDatabase:isIgnored",":storage:db:ScipDatabase:symbolNoiseFor",":storage:per-db-cache:PerDbValue:get",":storage:per-db-cache:PerDbValue:has"];function Z(e,i,t){let s=A(e,i),r=new k(e);if(!s)return null;let a=P(e,s,{semantic:t.semantic});return{symbol:s.symbol,file:s.relativePath,callees:E(a.map(n=>n.symbol)),paramCount:r.callableSignature(s)?.paramCount??-1}}function $(e,i){let{minCallees:t,scope:s,excludeSymbol:r,scanLimit:a}=i,n=new k(e),o=M(n.productionCallableDefinitions({scope:s,minLoc:5,excludeSymbol:r,sortByLocDesc:typeof a=="number"&&a>0}),a),l=n.calleeMap(o,{semantic:i.semantic!==!1});return o.map(c=>({symbol:c.symbol,file:c.relativePath,callees:E((l.get(c.symbolId)??[]).map(u=>u.symbol)),paramCount:n.callableSignature(c)?.paramCount??-1})).filter(c=>c.callees.size>=t)}function E(e){return new Set([...e].filter(i=>!U(i)))}function U(e){return V.some(i=>e.includes(i))}function W(e,i,t){let s=G(e,i);if(!s||s.tokens.size<3)return[];let r=t.minSimilarity>=.5?t.minSimilarity:.3,a=[];for(let n of H(e)){if(n.symbol===s.symbol||n.tokens.size<3)continue;let o=x(s.tokens,n.tokens);if(o.size<2)continue;let l=new Set([...s.tokens,...n.tokens]),c=l.size>0?o.size/l.size:0;c<r||a.push({symbolA:s.symbol,shortNameA:p(s.symbol),fileA:s.file,symbolB:n.symbol,shortNameB:p(n.symbol),fileB:n.file,similarity:c,similarityBasis:"source-tokens",sharedCallees:[...o].sort(),uniqueToA:[...y(s.tokens,n.tokens)].sort(),uniqueToB:[...y(n.tokens,s.tokens)].sort()})}return a.sort((n,o)=>o.similarity-n.similarity||n.shortNameB.localeCompare(o.shortNameB)),a.slice(0,t.limit)}function G(e,i){let t=A(e,i);if(!t||!w(t.symbol))return null;let s=K(e,t);return s?{symbol:t.symbol,file:t.relativePath,tokens:s}:null}function K(e,i){let t=q(i.symbol),s=v(e,i.relativePath,i.startLine,i.endLine,t),r=I(s,t);return r.size>0?r:null}function H(e){return new k(e).productionCallableDefinitions().map(t=>({symbol:t.symbol,file:t.relativePath,tokens:I(v(e,t.relativePath,t.startLine,t.endLine,t.leaf),t.leaf)})).filter(t=>t.tokens.size>0)}function v(e,i,t,s,r){let a=z(e,i);if(!a)return"";let n=a.split(`
|
|
2
|
-
`);if(s>=t&&s-t<=12)return n.slice(t,s+1).join(`
|
|
3
|
-
`);let o=[new RegExp(`\\bdef\\s+${d(r)}\\b`),new RegExp(`\\bfun\\s+${d(r)}\\b`),new RegExp(`\\bfn\\s+${d(r)}\\b`),new RegExp(`\\bfunction\\s+${d(r)}\\b`),new RegExp(`\\b${d(r)}\\s*\\(`)],l=n.findIndex(c=>o.some(u=>u.test(c)));if(l>=0){let c=l;for(let u=l+1;u<n.length&&u<=l+8;u++){let h=n[u]??"";if(u>l&&Q(h)||(c=u,h.trim()===""&&u>l+1))break}return n.slice(l,c+1).join(`
|
|
4
|
-
`)}return n.slice(t,Math.min(n.length,t+8)).join(`
|
|
5
|
-
`)}function I(e,i){if(!e)return new Set;let t=new Set(["public","private","protected","final","static","class","def","fun","fn","function","return","string","bool","boolean","void","unit","self","this","new","const","let","var","end","pub"]),s=J(i),a=e.replace(/["'`]/g," ").replace(/\b\d+\b/g," NUM ").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[^A-Za-z0-9_]+/g," ").replace(/_/g," ").toLowerCase().split(/\s+/).map(n=>n.trim()).filter(n=>n.length>1).filter(n=>!t.has(n)).filter(n=>!s.has(n));return new Set(a)}function J(e){return new Set(e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9_]+|_/).map(i=>i.toLowerCase()).filter(i=>i.length>1))}function Q(e){return/^\s*(?:def|fun|fn|function|class|trait|module|object|enum|interface|public|private|protected)\b/.test(e)}function d(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}export{re as a,ae as b};
|
|
6
|
-
//# sourceMappingURL=chunk-K4Z3FCUJ.js.map
|
package/dist/chunk-N5D5ZCBW.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{d as g}from"./chunk-VDZL45XI.js";import{execFileSync as j}from"child_process";var R=2e3,w=50,M=/\b(?:fix(?:es|ed)?|bug|regression|hotfix)\b/i,h=g("git-commit-history",{clearGroups:["whole-project"]});function x(e){let t=y(e.config.projectRoot);if(!t)return null;let n=h.has(e)?h.get(e,()=>({head:"",history:null})):null;return n&&n.head===t?n.history:(h.invalidate(e),h.get(e,()=>({head:t,history:S(e.config.projectRoot,t)})).history)}function y(e){try{return C(e,["rev-parse","HEAD"]).trim()||null}catch{return null}}function C(e,t){return j("git",["-C",e,...t],{encoding:"utf-8",maxBuffer:64*1024*1024,stdio:["ignore","pipe","ignore"]})}function S(e,t){let n;try{n=C(e,["log","--no-merges","--name-only","-n",String(R),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}let r=[],o=0;for(let s of n.split("")){if(s.trim()==="")continue;let c=s.indexOf(`
|
|
2
|
-
`),f=c>=0?s.slice(0,c):s,[a,i,l]=f.split("\0");if(!a||!i)continue;let m=c>=0?s.slice(c+1).split(`
|
|
3
|
-
`).map(u=>u.trim()).filter(u=>u!==""):[];if(m.length>w){o+=1;continue}r.push({hash:a,timestamp:Number(i)||0,subject:l??"",files:m})}return{head:t,commits:r,skippedBulkCommits:o}}function k(e){return M.test(e.subject)}function D(e){let t=x(e);if(!t)return null;let n=new Map;for(let r of t.commits){let o=k(r);for(let s of r.files){let c=n.get(s)??{changes:0,fixChanges:0,lastChangedAt:0};c.changes+=1,o&&(c.fixChanges+=1),r.timestamp>c.lastChangedAt&&(c.lastChangedAt=r.timestamp),n.set(s,c)}}return n}function T(e){let t=x(e);if(!t||t.commits.length===0)return null;let n=t.commits.map(r=>r.files.length).filter(r=>r>0).sort((r,o)=>r-o);return n.length===0?null:{medianFilesPerCommit:F(n,.5),p90FilesPerCommit:F(n,.9),commitsAnalyzed:n.length}}function F(e,t){let n=Math.min(e.length-1,Math.floor(e.length*t));return e[n]}var d=g("git-tracked-files",{clearGroups:["whole-project"]});function _(e){let t=y(e.config.projectRoot);if(!t)return null;let n=d.has(e)?d.get(e,()=>({head:"",files:null})):null;return n&&n.head===t?n.files:(d.invalidate(e),d.get(e,()=>{try{let r=C(e.config.projectRoot,["ls-files"]);return{head:t,files:new Set(r.split(`
|
|
4
|
-
`).map(o=>o.trim()).filter(o=>o!==""))}}catch{return{head:t,files:null}}}).files)}var p=g("git-file-adds",{clearGroups:["whole-project"]});function v(e){let t=y(e.config.projectRoot);if(!t)return null;let n=p.has(e)?p.get(e,()=>({head:"",adds:null})):null;return n&&n.head===t?n.adds:(p.invalidate(e),p.get(e,()=>({head:t,adds:P(e.config.projectRoot)})).adds)}function P(e){let t;try{t=C(e,["log","--no-merges","--diff-filter=A","--name-only","-n",String(R),"--pretty=format:%x01%H%x00%ct%x00%s"])}catch{return null}let n=new Map,r=-1;for(let o of t.split("")){if(o.trim()==="")continue;r+=1;let s=o.indexOf(`
|
|
5
|
-
`),c=s>=0?o.slice(0,s):o,[,f]=c.split("\0"),a=Number(f)||0;if(!(s<0))for(let i of o.slice(s+1).split(`
|
|
6
|
-
`)){let l=i.trim();l!==""&&n.set(l,{commitsAgo:r,addedAt:a})}}return n}function E(e,t={}){let{minTogether:n=4,minConfidence:r=.6}=t,o=x(e);if(!o)return null;let s=new Map,c=new Map;for(let a of o.commits){let i=[...new Set(a.files)].sort();for(let l of i)s.set(l,(s.get(l)??0)+1);for(let l=0;l<i.length;l++)for(let m=l+1;m<i.length;m++){let u=`${i[l]}\0${i[m]}`;c.set(u,(c.get(u)??0)+1)}}let f=[];for(let[a,i]of c){if(i<n)continue;let[l,m]=a.split("\0"),u=s.get(l)??i,A=s.get(m)??i,b=Math.max(i/u,i/A);b<r||f.push({fileA:l,fileB:m,together:i,confidence:b,changesA:u,changesB:A})}return f.sort((a,i)=>i.together-a.together||i.confidence-a.confidence||a.fileA.localeCompare(i.fileA)),f}export{x as a,D as b,T as c,_ as d,v as e,E as f};
|
|
7
|
-
//# sourceMappingURL=chunk-N5D5ZCBW.js.map
|
package/dist/chunk-OQSV6OS2.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as F,d as A}from"./chunk-N5D5ZCBW.js";import{existsSync as k,readFileSync as z}from"fs";import{join as v}from"path";var b=/\.(?:md|mdx|rst|txt)$/i;function C(n){return/(?:^|\/)(?:docs\/plans|plans|adrs?|rfcs?|decisions|changelogs?|archive|reports?)\//i.test(n)||/(?:^|\/)CHANGELOG\.(?:md|mdx|rst|txt)$/i.test(n)}var T=3,U=/[A-Za-z0-9_@-]+(?:\/[A-Za-z0-9_.@-]+)+\.[A-Za-z0-9]{1,6}\b/g;function L(n,d={}){let{doc:s,limit:u=20,minCoupling:g=T}=d,t=F(n);if(!t)return{available:!1,commitsAnalyzed:0,docsScanned:0,findings:[]};let c=A(n)??new Set,r=new Map,p=new Map,m=new Set;for(let o of t.commits){let l=[...new Set(o.files)],S=l.filter(i=>b.test(i)),y=l.filter(i=>!b.test(i));for(let i of l){m.add(i);let a=r.get(i)??[];a.push(o.timestamp),r.set(i,a)}for(let i of S){let a=p.get(i);a||(a=new Map,p.set(i,a));for(let e of y)a.set(e,(a.get(e)??0)+1)}}let h=[...c].filter(o=>b.test(o)),M=j(c),x=[];for(let o of h){if(s!==void 0&&!o.includes(s)||s===void 0&&C(o)||!k(v(n.config.projectRoot,o)))continue;let l=Math.max(0,...r.get(o)??[]),S=new Map,{resolved:y,broken:i}=w(n,o,c,M,m);for(let e of y){if(e===o||b.test(e))continue;let f=(r.get(e)??[]).filter(D=>D>l).length;f!==0&&S.set(e,{file:e,evidence:"reference",coChanges:0,changesSinceDocUpdate:f})}for(let[e,f]of p.get(o)??[]){if(f<g||!c.has(e))continue;let D=(r.get(e)??[]).filter(E=>E>l).length;if(D===0)continue;let R=S.get(e);R?(R.evidence="both",R.coChanges=f):S.set(e,{file:e,evidence:"co-change",coChanges:f,changesSinceDocUpdate:D})}if(S.size===0&&i.length===0)continue;let a=[...S.values()].sort((e,f)=>f.changesSinceDocUpdate-e.changesSinceDocUpdate);x.push({doc:o,docLastChangedAt:l,staleness:a.reduce((e,f)=>e+f.changesSinceDocUpdate,0)+i.length*10,subjects:a.slice(0,8),brokenReferences:i})}return x.sort((o,l)=>l.staleness-o.staleness),{available:!0,commitsAnalyzed:t.commits.length,docsScanned:h.length,findings:x.slice(0,u)}}function H(n,d){let s=A(n)??new Set,u=j(s),g=[];for(let t of s){if(!b.test(t)||C(t)||!k(v(n.config.projectRoot,t)))continue;let{resolved:c}=w(n,t,s,u,new Set),r=[...c].filter(p=>d.has(p));r.length>0&&g.push({doc:t,cited:r.sort()})}return g}function j(n){let d=new Map;for(let s of n){let u=s.split("/");for(let g of[2,3]){if(u.length<g)continue;let t=u.slice(-g).join("/"),c=d.get(t)??[];c.push(s),d.set(t,c)}}return d}function w(n,d,s,u,g){let t=new Set,c=new Set,r;try{r=z(v(n.config.projectRoot,d),"utf-8")}catch{return{resolved:t,broken:[]}}for(let p of r.matchAll(U)){let m=p[0].replace(/^\.?\//,"");if(s.has(m)){t.add(m);continue}let h=u.get(m);if(h&&h.length===1){t.add(h[0]);continue}h&&h.length>1||g.has(m)&&c.add(m)}return{resolved:t,broken:[...c]}}export{C as a,L as b,H as c};
|
|
2
|
-
//# sourceMappingURL=chunk-OQSV6OS2.js.map
|
package/dist/chunk-PCMVXWDC.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import{b as k,g as v,h as O,i as D,n as F}from"./chunk-6ZFKI5EP.js";import{c as N,e as T}from"./chunk-64UY7VTR.js";import{d as M,f as w,r as L,s as I,v as A}from"./chunk-SOGLYIJ4.js";import{c as E,i as C}from"./chunk-WQFOZIID.js";import{d as R}from"./chunk-VDZL45XI.js";function le(e,n,o={}){let l=x(e,[n],{additive:o.additive,semantic:o.semantic}),i=o.callableOnly?(l.get(n.symbolId)??[]).filter(a=>w(a.symbol)):l.get(n.symbolId)??[];return typeof o.limit=="number"?i.slice(0,o.limit):i}function ie(e,n,o={}){let l=G(e)?W(e,n,{semantic:o.semantic!==!1}):J(e).get(n.symbolId)??[];return typeof o.limit=="number"?l.slice(0,o.limit):l}var H=R("caller-rows",{clearGroups:["whole-project"]}),$=2e4;function G(e){return(e.get("SELECT COUNT(*) AS count FROM global_symbols")?.count??0)>$}function J(e){return H.get(e,()=>{let n=I(e),o=x(e,n),l=new Map;for(let c of n)l.set(c.symbol,c.symbolId);let i=new Map,a=new Map;for(let c of n){let s=o.get(c.symbolId);if(!(!s||s.length===0))for(let d of s){let t=l.get(d.symbol);if(t===void 0||t===c.symbolId)continue;let r=i.get(t);r||(r=[],i.set(t,r),a.set(t,new Set));let f=`${c.symbol}|${c.relativePath}`;a.get(t).has(f)||(a.get(t).add(f),r.push({symbol:c.symbol,file:c.relativePath,source:"caller-map-inversion"}))}}return i})}function W(e,n,o){let l=[],i=new Set,a=s=>{if(s.symbol===n.symbol)return;let d=`${s.symbol}|${s.file}`;i.has(d)||(i.add(d),l.push(s))};for(let s of F(e,n))s.file!==n.relativePath&&a({symbol:s.enclosingSymbol??s.file,file:s.file,source:"resolved-reference"});let c=o.semantic?B(e,n):null;if(c)for(let s of N(e,c)){if(s.file===n.relativePath||e.isIgnored(s.file))continue;let d=A(L(e,s.file),s.line);a({symbol:d?.symbol??s.file,file:s.file,source:"semantic-reference"})}return l}function B(e,n){return e.get(`SELECT
|
|
2
|
-
d.id AS documentId,
|
|
3
|
-
gs.id AS symbolId,
|
|
4
|
-
gs.symbol,
|
|
5
|
-
d.relative_path AS relativePath,
|
|
6
|
-
COALESCE(der.start_line, c.start_line) AS startLine,
|
|
7
|
-
COALESCE(der.end_line, c.end_line) AS endLine,
|
|
8
|
-
COALESCE(gs.display_name, '') AS leaf,
|
|
9
|
-
NULL AS parentTypeName,
|
|
10
|
-
CASE WHEN gs.kind IN (6, 12, 13) OR gs.symbol LIKE '%().' THEN 1 ELSE 0 END AS isFunctionLike,
|
|
11
|
-
CASE WHEN gs.kind IN (5, 8, 11) THEN 1 ELSE 0 END AS isTypeLike,
|
|
12
|
-
gs.kind AS kind,
|
|
13
|
-
gs.documentation AS documentation,
|
|
14
|
-
gs.enclosing_symbol AS enclosingSymbol
|
|
15
|
-
FROM global_symbols gs
|
|
16
|
-
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
17
|
-
LEFT JOIN chunks c ON c.document_id = der.document_id
|
|
18
|
-
JOIN documents d ON d.id = COALESCE(der.document_id, c.document_id)
|
|
19
|
-
WHERE gs.id = ?
|
|
20
|
-
LIMIT 1`,n.symbolId)??null}function x(e,n,o={}){if(n.length===0)return new Map;let l=o.additive??!1,i=[],a=[];for(let r of n)E(r.relativePath)&&C(e,r.relativePath)!==null?i.push(r):a.push(r);let c=new Map,s=new Map,d=r=>{for(let[f,p]of r){let b=c.get(f);b||(b=[],c.set(f,b));let y=s.get(f);y||(y=new Set,s.set(f,y));for(let m of p){let u=`${m.symbol}|${m.chunkId}`;y.has(u)||(y.add(u),b.push(m))}}};i.length>0&&d(j(e,i)),o.semantic!==!1&&d(q(T(e,n)));let t=l?n:a;return t.length>0&&d(Y(e,t)),c}function j(e,n){let o=new Map,l=U(n,o),i=D(e);for(let[a,c]of l){let s=C(e,a);if(s)for(let d of s){let t=K(c,d.line);if(!t)continue;let r=V(e,a,i,d.calleeLeaf,d.memberAccess);r&&r.symbol!==t.symbol&&o.get(t.symbolId).push({symbol:r.symbol,file:r.file,chunkId:d.line,source:"ast-callsite"})}}return o}function U(e,n){let o=new Map;for(let l of e){let i=o.get(l.relativePath);i?i.push(l):o.set(l.relativePath,[l]),n.set(l.symbolId,[])}for(let l of o.values())l.sort((i,a)=>i.endLine-i.startLine-(a.endLine-a.startLine));return o}function K(e,n){return e.find(o=>n>=o.startLine&&n<=o.endLine)??null}function V(e,n,o,l,i){let a=v(n,o.get(l)??[]);return a.length===0?null:O(e,n,a,i)}function Y(e,n){if(n.length===0)return new Map;let o=e.all(`SELECT c.document_id, c.id AS chunk_id, c.start_line, c.end_line, m.symbol_id
|
|
21
|
-
FROM mentions m
|
|
22
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
23
|
-
WHERE m.role != 1`),l=new Map;for(let t of o)l.has(t.document_id)||l.set(t.document_id,[]),l.get(t.document_id).push(t);let i=new Map(e.all("SELECT id, relative_path FROM documents").map(t=>[t.id,t.relative_path])),a=new Map,c=e.all(`SELECT gs.id AS symbol_id, gs.symbol,
|
|
24
|
-
COALESCE(der.document_id, def_chunk.document_id) AS document_id
|
|
25
|
-
FROM global_symbols gs
|
|
26
|
-
LEFT JOIN defn_enclosing_ranges der ON der.symbol_id = gs.id
|
|
27
|
-
LEFT JOIN (
|
|
28
|
-
SELECT m.symbol_id, MIN(c.document_id) AS document_id
|
|
29
|
-
FROM mentions m
|
|
30
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
31
|
-
WHERE m.role = 1
|
|
32
|
-
GROUP BY m.symbol_id
|
|
33
|
-
) def_chunk ON def_chunk.symbol_id = gs.id`);for(let t of c)a.has(t.symbol_id)||a.set(t.symbol_id,{symbol:t.symbol,file:t.document_id!==null?i.get(t.document_id)??"":""});let s=new Map,d=i;for(let t of n){let r=l.get(t.documentId)??[],f=new Set,p=[],b=null,y=()=>{if(b)return b;let m=d.get(t.documentId)??"",u=new Set;if(m){let h=k(e,m),S=Math.max(0,t.startLine),_=Math.min(h.length-1,t.endLine);for(let g=S;g<=_;g+=1)for(let P of h[g])u.add(P)}return b=u,u};for(let m of r){if(m.symbol_id===t.symbolId)continue;let u=a.get(m.symbol_id);if(!u)continue;if(!(m.start_line>=t.startLine&&m.end_line<=t.endLine)){if(!(m.start_line<=t.endLine&&m.end_line>=t.startLine))continue;let g=M(u.symbol);if(!g||!y().has(g))continue}let S=`${u.symbol}|${m.chunk_id}`;f.has(S)||(f.add(S),p.push({...u,chunkId:m.chunk_id,source:"scip-chunk"}))}s.set(t.symbolId,p)}return s}function q(e){let n=new Map;for(let[o,l]of e){let i=[];for(let a of l)i.push({symbol:a.symbol,file:a.file,chunkId:-1,source:"semantic-callee"});n.set(o,i)}return n}export{le as a,ie as b,x as c};
|
|
34
|
-
//# sourceMappingURL=chunk-PCMVXWDC.js.map
|
package/dist/chunk-PLFYFZX3.js
DELETED
package/dist/chunk-RKTDEIHF.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function m(n,e){let t=new Set;for(let r of n)e.has(r)&&t.add(r);return t}function M(n,e){let t=new Set;for(let r of n)e.has(r)||t.add(r);return t}function w(n,e){if(n.size===0&&e.size===0)return 0;let t=0;for(let o of n)e.has(o)&&(t+=1);let r=n.size+e.size-t;return r===0?0:t/r}function x(n){let e=n.length;if(e===0)return new Map;let t=new Map;for(let o of n)for(let s of o)t.set(s,(t.get(s)??0)+1);let r=new Map;for(let[o,s]of t)r.set(o,Math.log(e/s));return r}function p(n){let e=[...n.values()].sort((r,o)=>r-o);if(e.length===0)return 0;let t=Math.floor(e.length/2);return e.length%2===0?(e[t-1]+e[t])/2:e[t]}function v(n,e,t){let r=m(n,e);if(r.size===0)return{similarity:0,significantShared:[],trivialShared:[]};let o=0,s=0,T=0,l=new Set([...n,...e]);for(let i of l){let a=t.get(i)??0,f=n.has(i)?a:0,u=e.has(i)?a:0;o+=f*u,s+=f*f,T+=u*u}let h=Math.sqrt(s)*Math.sqrt(T),g=h>0?o/h:0,S=p(t),c=[],d=[];for(let i of r)(t.get(i)??0)>=S?c.push(i):d.push(i);return c.sort((i,a)=>(t.get(a)??0)-(t.get(i)??0)),{similarity:g,significantShared:c,trivialShared:d}}export{m as a,M as b,w as c,x as d,v as e};
|
|
2
|
-
//# sourceMappingURL=chunk-RKTDEIHF.js.map
|
package/dist/chunk-WQFOZIID.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{c as L,e as A}from"./chunk-VDZL45XI.js";import{existsSync as q,readFileSync as X}from"fs";import{join as $}from"path";var J=L("source-text",{clearGroups:["whole-project","source-file"]});function S(e,t){let r=t.replace(/\\/g,"/");return J.get(e,r,()=>{let n=$(e.config.projectRoot,r);return q(n)?X(n,"utf-8"):""})}var Z=/scip-query[\s:-]*ignore[\s:-]*(?:dead(?:-code)?|stale|wrapper|passthrough|drift|extract)?/i;function Pe(e,t,r){if(r<=0)return!1;let n=S(e,t);if(!n)return!1;let s=n.split(`
|
|
2
|
-
`);for(let a=r-1;a>=0&&a>=r-5;a-=1){let i=(s[a]??"").trim();if(i!==""){if(Z.test(i))return!0;if(!i.startsWith("//")&&!i.startsWith("*")&&!i.startsWith("/*")&&!i.startsWith("@")&&!i.startsWith("#"))return!1}}return!1}import{extname as w}from"path";var ee={".rs":"rust",".ts":"typescript",".mts":"typescript",".cts":"typescript",".tsx":"tsx",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".java":"java",".kt":"kotlin",".kts":"kotlin",".scala":"scala",".sc":"scala",".rb":"ruby",".c":"c",".h":"c",".cc":"cpp",".cpp":"cpp",".cxx":"cpp",".hpp":"cpp",".hh":"cpp",".hxx":"cpp",".cs":"csharp",".php":"php",".vb":"vb"};function y(e){return ee[w(e).toLowerCase()]??null}function x(e){return w(e).toLowerCase()===".vue"}import{createRequire as te}from"module";var f=te(import.meta.url),b=null,F=!1;function re(){if(F)return null;if(b)return b;try{return b=f("tree-sitter"),b}catch{return F=!0,null}}var k=new Map,_=new Set;function ne(e){if(_.has(e))return null;let t=k.get(e);if(t)return t;let r;try{switch(e){case"rust":r=f("tree-sitter-rust");break;case"typescript":r=f("tree-sitter-typescript").typescript;break;case"tsx":r=f("tree-sitter-typescript").tsx;break;case"javascript":r=f("tree-sitter-javascript");break;case"python":r=f("tree-sitter-python");break;case"java":r=f("tree-sitter-java");break;case"kotlin":r=f("tree-sitter-kotlin");break;case"scala":r=f("tree-sitter-scala");break;case"ruby":r=f("tree-sitter-ruby");break;case"c":r=f("tree-sitter-c");break;case"cpp":r=f("tree-sitter-cpp");break;case"csharp":r=f("tree-sitter-c-sharp");break;case"php":r=f("tree-sitter-php").php;break;case"vb":{let n=f("tree-sitter-vb-dotnet");r=n.language??n;break}}}catch{return _.add(e),null}return k.set(e,r),r}var R=new Map;function se(e){let t=R.get(e);if(t)return t;let r=ne(e);if(!r)return null;let n=re();if(!n)return null;let s=new n;try{s.setLanguage(r)}catch{return _.add(e),null}return R.set(e,s),s}function ae(e,t){return e.parse(n=>n>=t.length?null:t.slice(n,Math.min(t.length,n+16384)))}function C(e,t){let r=se(e);if(!r)return null;try{return ae(r,t)}catch{return null}}function T(e){let t=[],r=/<script\b([^>]*)>([\s\S]*?)<\/script>/g;for(let o of e.matchAll(r))typeof o.index=="number"&&t.push({tagOpen:o[1]??"",body:o[2]??"",openIdx:o.index+(o[0].length-(o[2]?.length??0)-9)});if(t.length===0)return null;let n=t.find(o=>/\bsetup\b/.test(o.tagOpen))??t[0],a=n.tagOpen.match(/\blang\s*=\s*["']?([\w-]+)/)?.[1]?.toLowerCase(),i=a==="ts"||a==="typescript"?"typescript":a==="tsx"?"tsx":"javascript";return{body:n.body,startLine:ie(e,n.openIdx),language:i}}function ie(e,t){let r=0;for(let n=0;n<t&&n<e.length;n++)e.charCodeAt(n)===10&&r++;return r}var j=A("ast-trees",{clearGroups:["whole-project","source-file"]});function N(e,t){if(x(t))return oe(e,t);let r=y(t);if(!r)return null;let n=S(e,t);return n?j.get(e,t,n,()=>C(r,n)):null}function oe(e,t){let r=S(e,t);return r?j.get(e,t,r,()=>{let n=T(r);if(!n)return null;let s=`
|
|
3
|
-
`.repeat(n.startLine)+n.body;return C(n.language,s)}):null}function h(e){return e.type==="comment"||e.type==="line_comment"||e.type==="block_comment"}var ce=new Set(["function_declaration","method_definition","method_signature","function_signature"]);function D(e,t){let r=le(e,t);if(r)return{name:r.name,startLine:r.definitionNode.startPosition.row,endLine:r.definitionNode.endPosition.row,paramCount:I(r.functionNode),params:E(r.functionNode),paramsEndLine:v(r.functionNode),isLiteralPassthrough:P(r.functionNode,t)};if(!ue(e.type,t))return null;let n=e.childForFieldName("name")??e.namedChildren.find(s=>s.type==="identifier"||s.type==="property_identifier");return n?{name:n.text,startLine:e.startPosition.row,endLine:e.endPosition.row,paramCount:I(e),params:E(e),paramsEndLine:v(e),isLiteralPassthrough:P(e,t)}:null}function M(e){return e.namedChildren.find(t=>t.type==="parameters"||t.type==="formal_parameters")}function E(e){let t=M(e);if(!t)return[];let r=[];for(let n of t.namedChildren){if(h(n))continue;if(n.type==="identifier"){r.push({name:n.text,simple:!0});continue}let s=n.namedChildren.some(o=>o.type.endsWith("_modifier"))||/^\s*(?:public|private|protected|readonly|override)\b/.test(n.text),a=n.childForFieldName("pattern");if(!s&&a&&a.type==="identifier"){r.push({name:a.text,simple:!0});continue}let i=n.namedChildren.find(o=>o.type==="identifier");r.push({name:a?.type==="identifier"?a.text:i?.text??"",simple:!1})}return r}function v(e){let t=M(e);return t?t.endPosition.row:e.startPosition.row}function ue(e,t){return t==="rust"?e==="function_item"||e==="function_signature_item":t==="python"?e==="function_definition":t==="typescript"||t==="tsx"||t==="javascript"?ce.has(e):!1}function le(e,t){if(t!=="typescript"&&t!=="tsx"&&t!=="javascript")return null;if(e.type==="variable_declarator"){let r=e.childForFieldName("name")??e.namedChild(0),n=e.childForFieldName("value")??e.namedChild(1);return!r||!n||n.type!=="arrow_function"&&n.type!=="function_expression"?null:{name:r.text,definitionNode:e,functionNode:n}}if(e.type==="public_field_definition"){let r=e.childForFieldName("name")??e.namedChild(0),n=e.childForFieldName("value")??e.namedChild(1);return!r||!n||n.type!=="arrow_function"&&n.type!=="function_expression"?null:{name:r.text,definitionNode:e,functionNode:n}}return null}function I(e){let t=e.namedChildren.find(n=>n.type==="parameters"||n.type==="formal_parameters");if(!t)return 0;let r=0;for(let n of t.namedChildren)h(n)||(r+=1);return r}function P(e,t){let r=e.namedChildren.find(l=>l.type==="block"||l.type==="statement_block");if(!r)return!1;let n=r.namedChildren.filter(l=>!h(l));if(n.length!==1)return!1;let s=n[0],a=null;if(s.type==="return_statement"||s.type==="expression_statement"?a=s.namedChild(0)??null:t==="rust"&&(s.type==="call_expression"||s.type==="macro_invocation")&&(a=s),!a)return!1;let i=t==="python"?"call":"call_expression";if(a.type!==i)return!1;let o=a.namedChildren.find(l=>l.type==="arguments"||l.type==="argument_list");if(!o)return!1;let u=o.namedChildren.filter(l=>!h(l)),c=e.namedChildren.find(l=>l.type==="parameters"||l.type==="formal_parameters");if(!c)return!1;let p=[];for(let l of c.namedChildren){if(l.type==="identifier"){p.push(l.text);continue}let d=l.namedChildren.find(K=>K.type==="identifier");d&&p.push(d.text)}if(u.length!==p.length)return!1;for(let l=0;l<p.length;l+=1){let d=u[l];if(d.type!=="identifier"||d.text!==p[l])return!1}return!0}function O(e,t){let r=pe(e,t);if(!r)return null;let n=g(r);return n?{calleeLeaf:n,memberAccess:fe(r),line:e.startPosition.row}:null}function pe(e,t){if(t==="rust")return e.type==="call_expression"?e.childForFieldName("function")??e.namedChild(0):e.type==="macro_invocation"?e.childForFieldName("macro")??e.namedChild(0):null;if(t==="python")return e.type!=="call"?null:e.childForFieldName("function")??e.namedChild(0);if(t==="typescript"||t==="tsx"||t==="javascript"){if(e.type==="call_expression")return e.childForFieldName("function")??e.namedChild(0);if(e.type==="new_expression")return e.childForFieldName("constructor")??e.namedChild(0)}return null}function fe(e){switch(e.type){case"field_expression":case"member_expression":case"attribute":return!0;default:return!1}}function g(e){switch(e.type){case"identifier":case"type_identifier":case"property_identifier":case"shorthand_property_identifier":return e.text;case"field_expression":case"member_expression":case"attribute":{let t=e.namedChild(e.namedChildCount-1);return t?g(t):null}case"scoped_identifier":{let t=e.childForFieldName("name")??e.namedChild(e.namedChildCount-1);return t?g(t):null}case"super":case"self":case"this":return null;default:return null}}var me=new Set(["identifier","type_identifier","field_identifier"]),de=new Set(["identifier"]),ge=new Set(["identifier","property_identifier","type_identifier","shorthand_property_identifier","shorthand_property_identifier_pattern"]),ye=new Set(["rust","python"]),he=/\{([^{}]*)\}/g,Se=/\b([A-Za-z_][\w]*)\b/g;function B(e,t){return be(t).has(e.type)}function Q(e,t){return ye.has(t)&&e.type==="string_content"}function H(e){let t=0;for(let n of e.values()){let s=n[n.length-1];s!==void 0&&s>t&&(t=s)}let r=new Array(t+1);for(let n=0;n<=t;n+=1)r[n]=new Set;for(let[n,s]of e)for(let a of s)r[a].add(n);return r}function be(e){return e==="rust"?me:e==="python"?de:ge}function V(e,t){let r=e.startPosition.row;for(let n of e.text.matchAll(he)){let s=n[1]??"";for(let a of s.matchAll(Se))a[1]&&t(a[1],r)}}var xe=[/\bdefault\s*=\s*"([^"]+)"/g,/\bwith\s*=\s*"([^"]+)"/g,/\bserialize_with\s*=\s*"([^"]+)"/g,/\bdeserialize_with\s*=\s*"([^"]+)"/g,/\bskip_serializing_if\s*=\s*"([^"]+)"/g,/\bgetter\s*=\s*"([^"]+)"/g,/\brename_all_with\s*=\s*"([^"]+)"/g,/\bschema_with\s*=\s*"([^"]+)"/g],_e=/^#!?\[\s*serde\s*\(/,Ce=/^#!?\[\s*schemars\s*\(/,Ne=/^#!?\[\s*validate\s*\(/,Le=new Set(["invoke","invokeTauriCommand","listen","once","emit","subscribe","dispatch","sendCommand","callRust"]);function G(e,t,r){if(t!=="typescript"&&t!=="tsx"&&t!=="javascript"||e.type!=="call_expression")return;let n=e.childForFieldName("function")??e.namedChild(0);if(!n)return;let s=g(n);if(!s||!Le.has(s))return;let a=e.namedChildren.find(u=>u.type==="arguments");if(!a)return;let i=a.namedChild(0);if(!i||i.type!=="string")return;let o=i.namedChildren.find(u=>u.type==="string_fragment");o&&r.add(o.text)}function U(e,t){let r=_e.test(e),n=Ce.test(e),s=Ne.test(e);if(!(!r&&!n&&!s))for(let a of xe){a.lastIndex=0;let i;for(;(i=a.exec(e))!==null;){let o=i[1],u=o.split("::").pop()??o;u==="is_none"&&/\bOption\b/.test(o)||u==="is_empty"&&/\b(String|Vec|HashMap|BTreeMap|HashSet|BTreeSet)\b/.test(o)||u&&t.add(u)}}}function z(e,t){let r=new Map,n=(i,o)=>{if(i===o)return;let u=r.get(i);u||(u=new Set,r.set(i,u)),u.add(o)},s=t==="python"?new Set(["identifier"]):new Set(["type_identifier"]),a=(i,o)=>{let u=c=>{s.has(c.type)&&c.text!==o&&n(c.text,o);for(let p of c.children)u(p)};for(let c of i.children)u(c)};if(t==="rust")for(let i of e.rootNode.descendantsOfType(["struct_item","enum_item","union_item","type_item"])){let o=i.namedChildren.find(c=>c.type==="type_identifier")?.text;if(!o)continue;let u=i.namedChildren.find(c=>c.type==="field_declaration_list"||c.type==="enum_variant_list"||c.type==="ordered_field_declaration_list");u&&a(u,o),i.type==="type_item"&&a(i,o)}else if(t==="python")for(let i of e.rootNode.descendantsOfType("class_definition")){let o=i.namedChildren.find(c=>c.type==="identifier")?.text;if(!o)continue;let u=i.namedChildren.find(c=>c.type==="block");if(u)for(let c of u.descendantsOfType("type"))for(let p of c.descendantsOfType("identifier"))p.text!==o&&n(p.text,o)}else for(let i of e.rootNode.descendantsOfType(["interface_declaration","type_alias_declaration","class_declaration"])){let o=i.namedChildren.find(u=>u.type==="type_identifier")?.text;o&&a(i,o)}return r}var W=new WeakMap;function m(e,t){let r=y(t);if(!r)return null;let n=N(e,t);if(!n)return null;let s=W.get(n);if(s)return s;let a=Fe(n,r);return W.set(n,a),a}function Ae(e,t,r,n){let s=m(e,t);return s?we(s,r,n)?.isLiteralPassthrough??!0:!0}function we(e,t,r){return e.callables.find(n=>n.startLine===t&&n.endLine===r)??null}function Fe(e,t){let r=[],n=[],s=new Set,a=new Set,i=new Map,o=(c,p)=>{let l=i.get(c);if(!l){i.set(c,[p]);return}l[l.length-1]!==p&&l.push(p)},u=c=>{let p=D(c,t);p&&r.push(p);let l=O(c,t);l&&n.push(l),G(c,t,a),t==="rust"&&(c.type==="attribute_item"||c.type==="inner_attribute_item")&&U(c.text,s),B(c,t)&&o(c.text,c.startPosition.row),Q(c,t)&&V(c,o);for(let d of c.children)u(d)};return u(e.rootNode),{language:t,callables:r,callSites:n,typeContainerMap:z(e,t),identifierLineMap:i,identifiersByLine:H(i),fileIdentifiers:new Set(i.keys()),rustAttrReferencedNames:s,crossLanguageDispatchNames:a}}var Y=new Set(["rust","typescript","tsx","javascript","python"]);function ke(e,t){let r=m(e,t);return!r||!Y.has(r.language)?null:r.callables.map(n=>({name:n.name,startLine:n.startLine,endLine:n.endLine}))}function Re(e,t){let r=m(e,t);return!r||!Y.has(r.language)?null:r.callSites}function Te(e,t){return m(e,t)?.typeContainerMap??new Map}function je(e,t,r={}){let n=m(e,t);if(!n)return[];let s=[];if(r.includeCrossLanguageDispatchNames)for(let a of n.crossLanguageDispatchNames)s.push({name:a,kind:"cross-language-dispatch",occurrences:1});if(r.includeRustAttributeNames&&n.language==="rust")for(let a of n.rustAttrReferencedNames)s.push({name:a,kind:"rust-attribute",occurrences:1});return s}export{S as a,Pe as b,y as c,x as d,N as e,m as f,Ae as g,ke as h,Re as i,Te as j,je as k};
|
|
4
|
-
//# sourceMappingURL=chunk-WQFOZIID.js.map
|
package/dist/chunk-XBFLIGWU.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as G}from"./chunk-HVGNOUYP.js";import{a as L}from"./chunk-AQYBOORI.js";import{a as F}from"./chunk-DJTJ3DLZ.js";import{a as E}from"./chunk-SSINY7HL.js";import{a as x}from"./chunk-QYQXPPDI.js";import{a as B}from"./chunk-SLOIQKY7.js";import{a as N,b as v}from"./chunk-K4Z3FCUJ.js";import{a as A}from"./chunk-HVXIXDLV.js";import{a as D}from"./chunk-6P5W4U6G.js";import{c as R}from"./chunk-OQSV6OS2.js";import{a as w}from"./chunk-2EC4JTHC.js";import{b as k}from"./chunk-OIMM7KMI.js";import{a as p}from"./chunk-4A4JFNWG.js";import{f as $}from"./chunk-N5D5ZCBW.js";import{a as C}from"./chunk-EKP7XJ6L.js";import{a as S}from"./chunk-NOVKLH2F.js";import{e as h,f as d}from"./chunk-TQTVM27C.js";import{existsSync as j}from"fs";import{existsSync as H,readFileSync as I,writeFileSync as T}from"fs";import{isAbsolute as O,join as M}from"path";var U=75e3,q=5e3,z=2500;function J(e){let i=L(e);return i.symbols>=U||i.documents>=q?z:void 0}var K=".scipquery-baseline.json";function u(e,i){return i&&O(i)?i:M(e.config.projectRoot,i??K)}function P(e,i={}){let{scope:t}=i,s=J(e),o=[],f=k(e,{scope:t,minLoc:3,skipBarrels:!0,deadCodeOnly:!0,scanLimit:s,semantic:!1});for(let n of f.symbols)h(e,n.relativePath)||d(e,n.symbol,n.relativePath)||n.kind==="dead-code"&&o.push(`dead:${n.relativePath}:${n.shortName}`);for(let n of x(e,{scope:t,minLoc:3,scanLimit:s,semantic:!1}))h(e,n.relativePath)||d(e,n.symbol,n.relativePath)||o.push(`isolated:${n.relativePath}:${n.shortName}`);for(let n of C(e,{scope:t}))n.kind==="real"&&o.push(`cycle:${W(n.path)}`);for(let n of v(e,{scope:t,minSimilarity:.6,limit:50,minCallees:4,scanLimit:s,semantic:!1}))o.push(`similar:${[n.symbolA,n.symbolB].sort().join("|")}`);for(let n of A(e,{scope:t,minLoc:15,minCallees:5,limit:50,scanLimit:s,semantic:!1}))o.push(`extract:${n.relativePath}:${n.shortName}`);for(let n of F(e,{scope:t,maxLoc:15,limit:50,scanLimit:s,semantic:!1}))o.push(`wrapper:${n.file}:${n.shortName}`);for(let n of B(e,{scope:t,maxLoc:15,limit:50,scanLimit:s,semantic:!1}))o.push(`passthrough:${n.file}:${n.shortName}`);for(let n of E(e,{scope:t,minLoc:3,limit:50,scanLimit:s,semantic:!1}))o.push(`stale:${n.file}:${n.shortName}`);for(let n of w(e,{scope:t,semantic:!1}).results)n.kind!=="pattern-deviation"&&o.push(`drift:${n.kind}:${n.file}:${n.dep}`);return[...new Set(o)].sort()}function W(e){if(e.length===0)return"";let i=0;for(let t=1;t<e.length;t++)e[t]<e[i]&&(i=t);return[...e.slice(i),...e.slice(0,i)].join(">")}function ue(e,i={}){let t=P(e,{scope:i.scope}),s=u(e,i.path);return T(s,JSON.stringify({version:1,findings:t},null,2)+`
|
|
2
|
-
`),{path:s,findingCount:t.length}}function _(e,i={}){let t=u(e,i.path);if(!H(t))throw new Error(`No baseline found at ${t}. Create one with: scip-query health --write-baseline`);let s=JSON.parse(I(t,"utf-8")),o=new Set(s.findings??[]),f=P(e,{scope:i.scope}),n=new Set(f);return{baselinePath:t,baselineCount:o.size,current:f,newFindings:f.filter(a=>!o.has(a)),fixedFindings:[...o].filter(a=>!n.has(a))}}function Ae(e,i={}){let t=i.base??"HEAD",{minTogether:s=6,minConfidence:o=.6,maxEchoChecks:f=10,minSimilarity:n=.8}=i,a=D(e,{base:t}),r=a.changedFiles,l=new Set(r),c={base:t,changedFiles:r,changedSymbols:a.changedSymbols.length,checksRun:[],skipped:[],findings:[],note:a.summary.note};return r.length===0||(Y(e,a.changedSymbols,l,f,n,c),Q(e,l,s,o,c),V(e,l,c),X(e,r,c),Z(e,a.changedSymbols,c),ee(e,c)),c}function Y(e,i,t,s,o,f){f.checksRun.push("echo");for(let n of i.slice(0,s)){let a=N(e,n.symbol,{minSimilarity:o,limit:3});for(let r of a){let l=r.fileA===n.file?r.fileB:r.fileA,c=r.fileA===n.file?r.shortNameB:r.shortNameA;t.has(l)||f.findings.push({check:"echo",message:`${n.shortName} (${n.file}) is ${Math.round(r.similarity*100)}% similar to established ${c} (${l})`,remediation:`Extend or reuse ${c} instead of keeping the re-implementation.`})}}i.length>s&&f.skipped.push({check:"echo",reason:`echo check capped at ${s} of ${i.length} changed symbols`})}function Q(e,i,t,s,o){let f=$(e,{minTogether:t,minConfidence:0});if(!f){o.skipped.push({check:"co-change-partner",reason:"no git history"});return}o.checksRun.push("co-change-partner");let n=new Set;for(let a of f){let r=i.has(a.fileA),l=i.has(a.fileB);if(r===l)continue;let c=r?a.fileA:a.fileB,m=r?a.fileB:a.fileA,g=r?a.changesA:a.changesB,y=g>0?a.together/g:0;if(y<s||p(m)||p(c)||!j(`${e.config.projectRoot}/${m}`))continue;let b=`${c}|${m}`;n.has(b)||(n.add(b),o.findings.push({check:"co-change-partner",message:`${c} changed, but ${m} did not \u2014 they change together ${a.together}x (${Math.round(y*100)}% of the time)`,remediation:`Update ${m} alongside this change, or confirm the coupling no longer holds.`}))}}function V(e,i,t){t.checksRun.push("doc-reference");for(let s of R(e,i))i.has(s.doc)||t.findings.push({check:"doc-reference",message:`${s.doc} cites ${s.cited.join(", ")} \u2014 changed in this diff, doc untouched`,remediation:`Re-read ${s.doc} and update its claims, or update its citations.`})}function X(e,i,t){t.checksRun.push("unused-params");for(let s of G(e,{files:i,limit:50}))t.findings.push({check:"unused-params",message:`${s.shortName} (${s.file}) has trailing unused parameter(s): ${s.unusedTrailing.join(", ")}`,remediation:"Drop the unused trailing parameters and their call-site arguments."})}function Z(e,i,t){t.checksRun.push("new-dead");let s=new S(e);for(let o of i)o.fanIn>0||s.fileKind(o.file)!=="test"&&(h(e,o.file)||d(e,o.symbol,o.file)||t.findings.push({check:"new-dead",message:`${o.shortName} (${o.file}) was changed but has zero indexed consumers`,remediation:"Wire it up, or remove it before it becomes permanent dead code."}))}function ee(e,i){if(!j(u(e))){i.skipped.push({check:"baseline",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}i.checksRun.push("baseline");let t=_(e);for(let s of t.newFindings)i.findings.push({check:"baseline",message:`new finding vs committed baseline: ${s}`,remediation:"Fix the finding, or knowingly accept it via health --write-baseline."})}export{P as a,ue as b,_ as c,Ae as d};
|
|
3
|
-
//# sourceMappingURL=chunk-XBFLIGWU.js.map
|