scip-query 0.10.3 → 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/README.md +9 -8
- package/dist/{chunk-YVLHL6KQ.js → chunk-237YUOPK.js} +2 -2
- package/dist/chunk-56UN3DMK.js +2 -0
- package/dist/chunk-5UDFZC4D.js +2 -0
- package/dist/{chunk-X474LKJX.js → chunk-6UFMPECA.js} +2 -2
- package/dist/chunk-7JOTOWZO.js +4 -0
- package/dist/chunk-A7RNHUJH.js +20 -0
- package/dist/chunk-AYYIZ4BA.js +4 -0
- package/dist/chunk-BNKE4TT5.js +2 -0
- package/dist/chunk-MA7OVFHI.js +2 -0
- package/dist/chunk-ONPCQ2PM.js +6 -0
- package/dist/chunk-QUJBXLBY.js +2 -0
- package/dist/chunk-WBJZNPUT.js +2 -0
- package/dist/{chunk-4HOMAEDD.js → chunk-YUTRW57I.js} +2 -2
- package/dist/cli.js +211 -198
- package/dist/frontend-behavior-evidence-BxKpKWUu.d.ts +4 -0
- package/dist/postinstall.js +3 -3
- package/dist/queries/diff-gate.d.ts +4 -2
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/doc-drift.js +1 -1
- package/dist/queries/health.js +1 -1
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.d.ts +1 -0
- package/dist/queries/index.js +1 -1
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/react-component-duplicates.js +1 -1
- package/dist/queries/react-hook-candidates.d.ts +3 -2
- package/dist/queries/react-hook-candidates.js +1 -1
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/vue-component-duplicates.js +1 -1
- package/dist/queries/vue-composable-candidates.d.ts +3 -2
- package/dist/queries/vue-composable-candidates.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 +2 -2
- package/dist/{scip-cli-a-xOztiK.d.ts → scip-cli-Bh1M_JPu.d.ts} +1 -1
- package/docs/AGENT_GUIDE.md +42 -5
- package/docs/AI_FAILURE_MODES.md +28 -21
- package/docs/COMMAND_REFERENCE.md +4 -2
- package/docs/analyzer-inventory.md +5 -1
- package/docs/analyzer-validation-ledger.md +8 -0
- package/package.json +7 -3
- package/scripts/build-scip-windows.mjs +75 -0
- package/skills/concrete-plan/SKILL.md +3 -5
- package/skills/concrete-plan/agents/openai.yaml +4 -0
- package/skills/scip-adoption/SKILL.md +120 -0
- package/skills/scip-adoption/agents/openai.yaml +4 -0
- package/skills/scip-ai-cleanup/SKILL.md +12 -4
- package/skills/scip-ai-cleanup/agents/openai.yaml +4 -0
- package/skills/scip-api-impact/SKILL.md +147 -0
- package/skills/scip-api-impact/agents/openai.yaml +4 -0
- package/skills/scip-debloat/SKILL.md +15 -13
- package/skills/scip-debloat/agents/openai.yaml +4 -0
- package/skills/scip-debug/SKILL.md +119 -0
- package/skills/scip-debug/agents/openai.yaml +4 -0
- package/skills/scip-diagram/SKILL.md +138 -0
- package/skills/scip-diagram/agents/openai.yaml +4 -0
- package/skills/scip-directory-architecture/SKILL.md +2 -2
- package/skills/scip-directory-architecture/agents/openai.yaml +4 -0
- package/skills/scip-doc-reconcile/SKILL.md +1 -3
- package/skills/scip-doc-reconcile/agents/openai.yaml +4 -0
- package/skills/scip-explore/SKILL.md +8 -2
- package/skills/scip-explore/agents/openai.yaml +4 -0
- package/skills/scip-health-audit/SKILL.md +158 -0
- package/skills/scip-health-audit/agents/openai.yaml +4 -0
- package/skills/scip-health-improve/SKILL.md +151 -0
- package/skills/scip-health-improve/agents/openai.yaml +4 -0
- package/skills/scip-language-playbook/SKILL.md +7 -4
- package/skills/scip-language-playbook/agents/openai.yaml +4 -0
- package/skills/scip-maintainability/SKILL.md +7 -3
- package/skills/scip-maintainability/agents/openai.yaml +4 -0
- package/skills/scip-query/SKILL.md +74 -33
- package/skills/scip-query/agents/openai.yaml +4 -0
- package/skills/scip-query-setup/SKILL.md +65 -18
- package/skills/scip-query-setup/agents/openai.yaml +3 -0
- package/skills/scip-react-maintainability/SKILL.md +2 -2
- package/skills/scip-react-maintainability/agents/openai.yaml +4 -0
- package/skills/scip-triage-issue/SKILL.md +112 -0
- package/skills/scip-triage-issue/agents/openai.yaml +4 -0
- package/skills/scip-verify/SKILL.md +83 -232
- package/skills/scip-verify/agents/openai.yaml +4 -0
- package/skills/scip-vue-maintainability/SKILL.md +2 -3
- package/skills/scip-vue-maintainability/agents/openai.yaml +4 -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-7ADUXFRZ.js +0 -2
- package/dist/chunk-GLJAAKDW.js +0 -4
- package/dist/chunk-GS33KGAY.js +0 -2
- package/dist/chunk-I7TSQZ3J.js +0 -4
- package/dist/chunk-NP5HYVLX.js +0 -20
- package/dist/chunk-NXIAHE7F.js +0 -5
- package/dist/chunk-O4L4AB3T.js +0 -2
- package/dist/chunk-TO54DY4O.js +0 -2
- package/dist/chunk-UMNENNTX.js +0 -2
package/dist/chunk-7ADUXFRZ.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as S}from"./chunk-O4L4AB3T.js";import{a as g}from"./chunk-GS33KGAY.js";import{a as f}from"./chunk-UMNENNTX.js";import{a as p}from"./chunk-TO54DY4O.js";import{b as y}from"./chunk-UQJGTVHV.js";import{e as h}from"./chunk-KRGBLZT2.js";var v=.7,C=.62,R=.45;function H(i,t={}){let{windowCommits:e=100,limit:n=30,scope:a,scanLimit:l}=t,s=h(i);if(!s)return{available:!1,windowCommits:e,findings:[]};if(n<=0)return{available:!0,windowCommits:e,findings:[]};let d=A(i,{limit:n,minSimilarity:t.minSimilarity,scanLimit:l,scope:a,semantic:t.semantic}).map(o=>I(o,s,e)).filter(o=>o!==null);d.sort((o,r)=>(o.kind===r.kind?0:o.kind==="echo"?-1:1)||r.similarity-o.similarity||o.echoFile.localeCompare(r.echoFile)||o.echoSymbol.localeCompare(r.echoSymbol)||o.domain.localeCompare(r.domain));let b=d.slice(0,n).map(x);return{available:!0,windowCommits:e,findings:b,rootCauseGroups:w(b)}}function A(i,t){let e=K(t.limit);return[...F(i,{scope:t.scope,minSimilarity:t.minSimilarity??v,limit:e,scanLimit:t.scanLimit,semantic:t.semantic}),...B(i,{scope:t.scope,minSimilarity:t.minSimilarity??C,limit:e,scanLimit:t.scanLimit}),...L(i,{scope:t.scope,minSimilarity:t.minSimilarity??R,limit:e,scanLimit:t.scanLimit}),...E(i,{scope:t.scope,minSimilarity:t.minSimilarity??C,limit:e,scanLimit:t.scanLimit}),...k(i,{scope:t.scope,minSimilarity:t.minSimilarity??R,limit:e,scanLimit:t.scanLimit})]}function F(i,t){return y(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,crossFileOnly:!0,scanLimit:t.scanLimit,semantic:t.semantic}).map(e=>({domain:"callable",basis:e.similarityBasis??"callees",symbolA:e.shortNameA,fileA:e.fileA,symbolB:e.shortNameB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:e.sharedCallees,sharedCallees:e.sharedCallees}))}function B(i,t){return f(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,scanLimit:t.scanLimit}).filter(e=>e.fileA!==e.fileB).map(e=>({domain:"react-component",basis:"jsx-structure",symbolA:e.componentA,fileA:e.fileA,symbolB:e.componentB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:u(["component",e.sharedComponents],["tag",e.sharedNativeTags],["prop",e.sharedProps],["event",e.sharedEvents],["binding",e.sharedBindings]),sharedCallees:[]}))}function L(i,t){return p(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,scanLimit:t.scanLimit}).filter(e=>e.fileA!==e.fileB).map(e=>({domain:"react-hook",basis:"react-behavior",symbolA:e.componentA,fileA:e.fileA,symbolB:e.componentB,fileB:e.fileB,similarity:e.similarity,sharedEvidence:u(["hook",e.sharedHooks],["react-hook",e.sharedReactHooks],["effect",e.sharedEffects],["state",e.sharedState],["request",e.sharedRequests],["handler",e.sharedHandlers],["action",e.sharedHandlerVerbs]),sharedCallees:[]}))}function E(i,t){return g(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,scanLimit:t.scanLimit}).filter(e=>e.fileA!==e.fileB).map(e=>({domain:"vue-component",basis:"vue-template",symbolA:c(e.fileA),fileA:e.fileA,symbolB:c(e.fileB),fileB:e.fileB,similarity:e.similarity,sharedEvidence:u(["component",e.sharedComponents],["prop",e.sharedProps],["event",e.sharedEvents],["directive",e.sharedDirectives],["slot",e.sharedSlots],["identifier",e.sharedIdentifiers]),sharedCallees:[]}))}function k(i,t){return S(i,{scope:t.scope,minSimilarity:t.minSimilarity,limit:t.limit,scanLimit:t.scanLimit}).filter(e=>e.fileA!==e.fileB).map(e=>({domain:"vue-composable",basis:"vue-behavior",symbolA:c(e.fileA),fileA:e.fileA,symbolB:c(e.fileB),fileB:e.fileB,similarity:e.similarity,sharedEvidence:u(["composable",e.sharedComposables],["store",e.sharedStores],["reactivity",e.sharedReactivity],["lifecycle",e.sharedLifecycle],["request",e.sharedRequests],["function",e.sharedFunctions],["action",e.sharedFunctionVerbs],["binding",e.sharedBindings],["template-event",e.sharedTemplateEvents]),sharedCallees:[]}))}function I(i,t,e){let n=t.get(i.fileA)?.commitsAgo??null,a=t.get(i.fileB)?.commitsAgo??null,l=n!==null&&n<=e,s=a!==null&&a<=e;if(!l&&!s)return null;if(l&&s){let m=(n??0)<=(a??0);return{kind:"twin",domain:i.domain,basis:i.basis,echoSymbol:m?i.symbolA:i.symbolB,echoFile:m?i.fileA:i.fileB,echoAgeCommits:(m?n:a)??0,establishedSymbol:m?i.symbolB:i.symbolA,establishedFile:m?i.fileB:i.fileA,establishedAgeCommits:m?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}return{kind:"echo",domain:i.domain,basis:i.basis,echoSymbol:l?i.symbolA:i.symbolB,echoFile:l?i.fileA:i.fileB,echoAgeCommits:(l?n:a)??0,establishedSymbol:l?i.symbolB:i.symbolA,establishedFile:l?i.fileB:i.fileA,establishedAgeCommits:l?a:n,similarity:i.similarity,sharedEvidence:i.sharedEvidence,sharedCallees:i.sharedCallees}}function x(i){let t=D(i);return{...i,rootCauseKey:t,groupKey:`recent-duplicate:${t}`}}function D(i){if(i.kind==="echo")return["echo",i.domain,i.basis,i.establishedSymbol].join(":");let t=i.sharedEvidence.slice().sort().join("|"),e=[i.echoSymbol,i.establishedSymbol].sort().join("|");return["twin",i.domain,i.basis,t||e].join(":")}function w(i){let t=new Map;for(let[e,n]of i.entries()){let a=n.rootCauseKey??D(n),l=n.groupKey??`recent-duplicate:${a}`,s=t.get(l);s||(s={groupKey:l,rootCauseKey:a,kind:n.kind,domain:n.domain,basis:n.basis,count:0,maxSimilarity:n.similarity,findingIndexes:[],echoFiles:new Set,establishedFile:n.kind==="echo"?n.establishedFile:void 0,establishedSymbol:n.kind==="echo"?n.establishedSymbol:void 0,relatedFiles:new Set,sharedEvidence:new Set,recommendation:N(n)},t.set(l,s)),s.count+=1,s.maxSimilarity=Math.max(s.maxSimilarity,n.similarity),s.findingIndexes.push(e),s.echoFiles.add(n.echoFile),s.relatedFiles.add(n.echoFile),s.relatedFiles.add(n.establishedFile);for(let m of n.sharedEvidence)s.sharedEvidence.add(m)}return[...t.values()].map(e=>({...e,echoFiles:[...e.echoFiles].sort(),relatedFiles:[...e.relatedFiles].sort(),sharedEvidence:[...e.sharedEvidence].sort().slice(0,16)})).sort((e,n)=>n.count-e.count||n.maxSimilarity-e.maxSimilarity||e.groupKey.localeCompare(n.groupKey))}function N(i){return i.kind==="echo"?"Review the established side once, then migrate or delete every echo in this group.":"Pick one owner for the new twins and consolidate the group before the copies diverge."}function K(i){return Number.isFinite(i)?i*5:Number.POSITIVE_INFINITY}function u(...i){let t=[],e=new Set;for(let[n,a]of i)for(let l of a){let s=`${n}:${l}`;e.has(s)||(e.add(s),t.push(s))}return t}function c(i){return(i.split("/").pop()??i).replace(/\.[^.]+$/,"")}export{H as a};
|
|
2
|
-
//# sourceMappingURL=chunk-7ADUXFRZ.js.map
|
package/dist/chunk-GLJAAKDW.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as E,d as I}from"./chunk-KRGBLZT2.js";import{b as _,c as v,d as N}from"./chunk-A4L36SZS.js";import{existsSync as X,readFileSync as A}from"fs";import{join as D}from"path";function j(t,n){let e=$(t,n)??W(t,n)??G(t,n)??Z(t,n);return J(t,e,n)}function $(t,n){let e=-1,i=null;for(let o=0;o<=n;o+=1){let r=x(t[o]??"");r&&(i===null?(i=r,e=o):r===i&&(i=null,e=-1))}if(i===null||e<0)return null;for(let o=n+1;o<t.length;o+=1)if(x(t[o]??"")===i)return{start:e,end:o+1};return{start:e,end:t.length}}function x(t){let n=t.match(/^\s*(```+|~~~+)/);return n?n[1].startsWith("`")?"`":"~":null}function W(t,n){if(!y(t[n]??""))return null;let e=n;for(;e>0&&y(t[e-1]??"");)e-=1;let i=n+1;for(;i<t.length&&y(t[i]??"");)i+=1;return{start:e,end:i}}function y(t){let n=t.trim();return n.startsWith("|")&&n.endsWith("|")&&n.includes("|")}function G(t,n){let e=n;for(;e>=0;){let r=t[e]??"";if(T(r)!==null)break;if(k(r)!==null)return null;e-=1}if(e<0)return null;let i=T(t[e]??"");if(i===null)return null;let o=e+1;for(;o<t.length;){let r=t[o]??"",s=T(r);if(s!==null){if(s<=i)break;o+=1;continue}if(k(r)!==null)break;o+=1}return{start:e,end:o}}function T(t){let n=t.match(/^(\s*)(?:[-*+]\s+|\d+[.)]\s+)/);return n?n[1].length:null}function Z(t,n){let e=t[n]??"";if(L(e)||e.trim().length===0)return{start:n,end:n+1};let i=n;for(;i>0&&O(t[i-1]??"");)i-=1;let o=n+1;for(;o<t.length&&O(t[o]??"");)o+=1;return{start:i,end:o}}function O(t){return k(t)===null}function k(t){return t.trim().length===0?"blank":L(t)?"heading":x(t)?"fence":y(t)?"table":T(t)!==null?"list":null}function L(t){return/^#{1,6}\s+/.test(t.trim())}function J(t,n,e){let{start:i,end:o}=n;if(o-i>40){let s=Math.floor(20);i=Math.max(i,e-s),o=Math.min(o,i+40),i=Math.max(n.start,o-40)}let r=t.slice(i,o).join(`
|
|
2
|
-
`).trim();return r.length<=2e3?r:`${r.slice(0,2e3).trimEnd()}...`}var p=/\.(?:md|mdx|rst|txt)$/i;function q(t){return/(?:^|\/)(?:docs\/plans|plans|adrs?|rfcs?|decisions|changelogs?|archive|reports?)\//i.test(t)||/(?:^|\/)CHANGELOG\.(?:md|mdx|rst|txt)$/i.test(t)}var K=3,H=/[A-Za-z0-9_@-]+(?:\/[A-Za-z0-9_.@-]+)+\.[A-Za-z0-9]{1,6}\b/g;function lt(t,n={}){let{doc:e,limit:i=20,minCoupling:o=K}=n,r=Y(t);if(!r)return{available:!1,commitsAnalyzed:0,docsScanned:0,findings:[]};let s=[];for(let c of r.docFiles){if(e!==void 0&&!c.includes(e)||e===void 0&&!z(t,c)||e!==void 0&&!X(D(t.config.projectRoot,c)))continue;let d=Math.max(0,...r.changeTimes.get(c)??[]),g=Q(t,c),l=new Map,{resolved:a,broken:u,citations:m}=P(t,c,r.tracked,r.trackedBySuffix,r.everSeenInHistory),S=new Map(m.map(f=>[f.file,f.contexts]));for(let f of a){if(f===c||p.test(f))continue;let h=(r.changeTimes.get(f)??[]).filter(b=>b>d).length;h!==0&&l.set(f,{file:f,evidence:"reference",coChanges:0,changesSinceDocUpdate:h,...w("reference",g),citationContexts:S.get(f)})}for(let[f,h]of r.coupling.get(c)??[]){if(h<o||!r.tracked.has(f))continue;let b=(r.changeTimes.get(f)??[]).filter(U=>U>d).length;if(b===0)continue;let C=l.get(f);C?(C.evidence="both",C.coChanges=h,Object.assign(C,w("both",g))):l.set(f,{file:f,evidence:"co-change",coChanges:h,changesSinceDocUpdate:b,...w("co-change",g)})}if(l.size===0&&u.length===0)continue;let R=[...l.values()].sort((f,h)=>h.changesSinceDocUpdate-f.changesSinceDocUpdate);s.push({doc:c,docLastChangedAt:d,staleness:R.reduce((f,h)=>f+h.changesSinceDocUpdate,0)+u.length*10,subjects:R.slice(0,8),brokenReferences:u})}return s.sort((c,d)=>d.staleness-c.staleness),{available:!0,commitsAnalyzed:r.historyCommitCount,docsScanned:r.docFiles.length,findings:s.slice(0,i)}}function Q(t,n){let e;try{e=A(D(t.config.projectRoot,n),"utf8").slice(0,6e3)}catch{return{docIntent:"unknown",reasons:["doc text unavailable"]}}let i=`${n}
|
|
3
|
-
${e}`.toLowerCase(),o=F(i,["historical note","historical record","history note","retrospective","postmortem","post-mortem","archived","archive","previously","legacy","recorded","record of","snapshot","as of","migration note","decision record"]);if(o.length>0)return{docIntent:"historical-note",reasons:[`historical-note terms: ${o.join(", ")}`]};let r=F(i,["current","standard","standards","must","should","policy","guide","guidance","workflow","contract","invariant","source of truth"]);return r.length>0?{docIntent:"current-guidance",reasons:[`current-guidance terms: ${r.join(", ")}`]}:{docIntent:"unknown",reasons:["no current-guidance or historical-note markers found"]}}function F(t,n){return n.filter(e=>t.includes(e))}function w(t,n){return{actionTier:V(t,n.docIntent),docIntent:n.docIntent,docIntentReasons:n.reasons}}function V(t,n){return n==="historical-note"?"support":t==="co-change"?"signal":"direct"}function Y(t){let n=E(t);if(!n)return null;let e=I(t)??new Set,i=new Map,o=new Map,r=new Set;for(let s of n.commits){let c=[...new Set(s.files)],d=c.filter(l=>p.test(l)),g=c.filter(l=>!p.test(l));for(let l of c){r.add(l);let a=i.get(l)??[];a.push(s.timestamp),i.set(l,a)}for(let l of d){let a=o.get(l);a||(a=new Map,o.set(l,a));for(let u of g)a.set(u,(a.get(u)??0)+1)}}return{changeTimes:i,coupling:o,docFiles:[...e].filter(s=>p.test(s)),everSeenInHistory:r,historyCommitCount:n.commits.length,tracked:e,trackedBySuffix:B(e)}}function ut(t,n){let e=I(t)??new Set,i=B(e),o=[];for(let r of e){if(!z(t,r))continue;let{resolved:s,citations:c}=P(t,r,e,i,new Set),d=[...s].filter(g=>n.has(g));if(d.length>0){let g=d.sort(),l=new Set(g),a=c.filter(u=>l.has(u.file));o.push({doc:r,cited:g,citations:a,citedClaims:M(a.flatMap(u=>u.contexts)).slice(0,3)})}}return o}function z(t,n){return p.test(n)&&!q(n)&&X(D(t.config.projectRoot,n))}function B(t){let n=new Map;for(let e of t){let i=e.split("/");for(let o of[2,3]){if(i.length<o)continue;let r=i.slice(-o).join("/"),s=n.get(r)??[];s.push(e),n.set(r,s)}}return n}function P(t,n,e,i,o){let r=new Set,s=new Set,c=et(t,n);if(!c)return{resolved:r,broken:[],citations:[]};let d=tt(t,n,c),g=new Map,l=(a,u)=>{let m=d.get(u);if(!m||m.length===0)return;let S=g.get(a)??[];S.push(...m),g.set(a,M(S).slice(0,3))};for(let a of c){if(e.has(a)){r.add(a),l(a,a);continue}let u=i.get(a);if(u&&u.length===1){r.add(u[0]),l(u[0],a);continue}u&&u.length>1||o.has(a)&&s.add(a)}return{resolved:r,broken:[...s],citations:[...g].map(([a,u])=>({file:a,contexts:u}))}}function tt(t,n,e){let i;try{i=A(D(t.config.projectRoot,n),"utf-8").split(/\r?\n/)}catch{return new Map}let o=new Set(e),r=new Map;for(let s=0;s<i.length;s+=1){let c=i[s]??"";for(let d of c.matchAll(H)){let g=d[0].replace(/^\.?\//,"");if(!o.has(g))continue;let l=j(i,s);if(l.length===0)continue;let a=r.get(g)??[];a.push(l),r.set(g,M(a).slice(0,3))}}return r}function M(t){let n=[];for(let e of new Set(t))n.some(i=>nt(i,e))||n.push(e);return n}function nt(t,n){if(t===n)return!0;let e=t.split(/\r?\n/).map(c=>c.trim()).filter(c=>c.length>0),i=n.split(/\r?\n/).map(c=>c.trim()).filter(c=>c.length>0),o=Math.min(e.length,i.length);if(o===0)return!1;if(o<3)return t.includes(n)||n.includes(t);let r=new Set(i),s=e.filter(c=>r.has(c)).length;return s>=3&&s/o>=.6}function et(t,n){let e;try{e=A(D(t.config.projectRoot,n),"utf-8")}catch{return null}let i=_(t,n,e),o=v(t,"doc-path-tokens",n,i);if(o!==null)try{return JSON.parse(o)}catch{}let r=[...new Set([...e.matchAll(H)].map(s=>s[0].replace(/^\.?\//,"")))];return N(t,"doc-path-tokens",n,i,JSON.stringify(r)),r}export{j as a,q as b,lt as c,ut as d};
|
|
4
|
-
//# sourceMappingURL=chunk-GLJAAKDW.js.map
|
package/dist/chunk-GS33KGAY.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as p}from"./chunk-PVZMPG5I.js";import{a as c,b as a,c as f}from"./chunk-3UVJJ6Z7.js";import{c as m}from"./chunk-ERHOS6AW.js";function B(e,t={}){let{minSimilarity:n=.62,minTokens:i=8,limit:l=20,scope:d,scanLimit:h,filePattern:g}=t,k=P(e,{scope:d,minTokens:i,scanLimit:h});return p({profiles:k,limit:l,filePattern:g,compare:(o,s)=>v(o,s,n),sort:(o,s)=>s.similarity-o.similarity||o.fileA.localeCompare(s.fileA)||o.fileB.localeCompare(s.fileB)})}function P(e,t){return m(e,{scope:t.scope,minTemplateTokens:t.minTokens,scanLimit:t.scanLimit}).map(n=>({file:n.file,tokens:n.templateTokens,loc:C(n)}))}function C(e){return e.totalLines}function v(e,t,n){let i=c(e.tokens,t.tokens);if(i.size<6||!T(i))return null;let l=f(e.tokens,t.tokens);return l<n?null:{fileA:e.file,fileB:t.file,similarity:l,sharedTokens:u(i),sharedComponents:r(i,"component:"),sharedProps:r(i,"prop:"),sharedEvents:r(i,"event:"),sharedDirectives:r(i,"directive:"),sharedSlots:r(i,"slot:"),sharedIdentifiers:r(i,"id:"),uniqueToA:u(a(e.tokens,t.tokens)).slice(0,25),uniqueToB:u(a(t.tokens,e.tokens)).slice(0,25),locA:e.loc,locB:t.loc}}function T(e){let t=0,n=0;for(let i of e)i.startsWith("component:")&&(t+=1),(i.startsWith("prop:")||i.startsWith("event:")||i.startsWith("directive:")||i.startsWith("slot:"))&&(n+=1);return t>=1||n>=3}function r(e,t){return[...e].filter(n=>n.startsWith(t)).map(n=>n.slice(t.length)).sort()}function u(e){return[...e].sort()}export{B as a};
|
|
2
|
-
//# sourceMappingURL=chunk-GS33KGAY.js.map
|
package/dist/chunk-I7TSQZ3J.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as ee}from"./chunk-NNDYO2DX.js";import{a as X}from"./chunk-YVLHL6KQ.js";import{a as y}from"./chunk-B32FX5KB.js";import{a as Q}from"./chunk-SPE4YCOT.js";import{a as J}from"./chunk-ZFMPHDAT.js";import{a as Z}from"./chunk-C2QSK7E7.js";import{a as W,b as Y}from"./chunk-UQJGTVHV.js";import{a as U}from"./chunk-G3WGZU5Q.js";import{a as V}from"./chunk-DE7MA6OD.js";import{a as q}from"./chunk-7KCSELEV.js";import{b as I,c as P,f as H}from"./chunk-NP5HYVLX.js";import{a as _,d as z}from"./chunk-GLJAAKDW.js";import{a as O}from"./chunk-AW4N6MGC.js";import{b as E}from"./chunk-C3MZZ2ZN.js";import{a as F,c as N,d as K,e as B}from"./chunk-EYLXU575.js";import{g as L}from"./chunk-KRGBLZT2.js";import{a as M}from"./chunk-CJJP64OC.js";import{a as j}from"./chunk-3ZYF3ELZ.js";import{f as w,g as D}from"./chunk-ZQLO2SCU.js";import{d as $,e as G}from"./chunk-JM72FNGA.js";import{createHash as ye}from"crypto";import{existsSync as x,readFileSync as oe}from"fs";import{existsSync as se,readFileSync as ae,writeFileSync as ce}from"fs";import{isAbsolute as le,join as fe}from"path";var de=75e3,ue=5e3,he=2500;function ge(e){let i=Z(e);return i.symbols>=de||i.documents>=ue?he:void 0}var pe=".scipquery-baseline.json";function k(e,i){return i&&le(i)?i:fe(e.config.projectRoot,i??pe)}function ne(e,i={}){let{scope:n}=i,r=ge(e),o=[],s=E(e,{scope:n,...y.dead,scanLimit:r});for(let t of s.symbols)w(e,t.relativePath)||D(e,t.symbol,t.relativePath)||t.kind==="dead-code"&&o.push(`dead:${t.relativePath}:${t.shortName}`);for(let t of U(e,{scope:n,...y.isolated,scanLimit:r}))w(e,t.relativePath)||D(e,t.symbol,t.relativePath)||o.push(`isolated:${t.relativePath}:${t.shortName}`);for(let t of M(e,{scope:n}))t.kind==="real"&&o.push(`cycle:${me(t.path)}`);for(let t of Y(e,{scope:n,...y.similar,scanLimit:r}))o.push(`similar:${[t.symbolA,t.symbolB].sort().join("|")}`);for(let t of q(e,{scope:n,...y.extract,scanLimit:r}))o.push(`extract:${t.relativePath}:${t.shortName}`);for(let t of Q(e,{scope:n,...y.wrappers,scanLimit:r}))o.push(`wrapper:${t.file}:${t.shortName}`);for(let t of V(e,{scope:n,...y.passthroughs,scanLimit:r}))o.push(`passthrough:${t.file}:${t.shortName}`);for(let t of J(e,{scope:n,...y.stale,scanLimit:r}))o.push(`stale:${t.file}:${t.shortName}`);for(let t of O(e,{scope:n,...y.drift}).results)t.kind!=="pattern-deviation"&&o.push(`drift:${t.kind}:${t.file}:${t.dep}`);return[...new Set(o)].sort()}function me(e){if(e.length===0)return"";let i=0;for(let n=1;n<e.length;n++)e[n]<e[i]&&(i=n);return[...e.slice(i),...e.slice(0,i)].join(">")}function $n(e,i={}){let n=ne(e,{scope:i.scope}),r=k(e,i.path);return ce(r,JSON.stringify({version:1,findings:n},null,2)+`
|
|
2
|
-
`),{path:r,findingCount:n.length}}function ie(e,i={}){let n=k(e,i.path);if(!se(n))throw new Error(`No baseline found at ${n}. Create one with: scip-query health --write-baseline`);let r=JSON.parse(ae(n,"utf-8")),o=new Set(r.findings??[]),s=ne(e,{scope:i.scope}),t=new Set(s);return{baselinePath:n,baselineCount:o.size,current:s,newFindings:s.filter(c=>!o.has(c)),fixedFindings:[...o].filter(c=>!t.has(c))}}var Bn=["echo","incomplete-migration","co-change-partner","doc-reference","unused-params","new-dead","baseline"];function Mn(e,i={}){let n=i.base??"HEAD",{minTogether:r=6,minConfidence:o=.6,maxEchoChecks:s=Number.POSITIVE_INFINITY,maxHelpers:t=Number.POSITIVE_INFINITY,minSimilarity:c=.8}=i,a=new Set(i.skip??[]),f=P(e,{base:n}),g=I(e,{base:n,plan:f}),u=g.changedFiles,d=new Set(u),l=new Set(f.changedFileLines),m=Xe(e.config.projectRoot,n,f),h={base:n,changedFiles:u,changedSymbols:g.changedSymbols.length,checksRun:[],skipped:[],suppressed:[],findings:[],rootCauseGroups:[],note:g.summary.note};if(u.length===0)return h;let p=(b,S)=>{if(a.has(b)){h.skipped.push({check:b,reason:"skipped via --skip"});return}S()};return p("echo",()=>De(e,g.changedSymbols,d,m,s,c,h)),p("incomplete-migration",()=>je(e,n,f,t,h)),p("co-change-partner",()=>Ee(e,d,r,o,h)),p("doc-reference",()=>Me(e,d,l,f.changedRanges,h)),p("unused-params",()=>Je(e,u,h)),p("new-dead",()=>Ze(e,g.changedSymbols,m,h)),p("baseline",()=>tn(e,h)),$e(h,e.config.suppressions??[]),h.rootCauseGroups=be(h.findings),h}function be(e){let i=new Map;for(let n of e){let r=n.groupKey??`${n.check}:${n.id}`,o=i.get(r);o||(o={groupKey:r,check:n.check,severity:n.severity,actionTier:n.actionTier,sourceAnalyzer:n.sourceAnalyzer,rootCauseKey:n.rootCauseKey,count:0,findingIds:[],files:new Set,relatedFiles:new Set,message:n.message,remediation:n.remediation},i.set(r,o)),o.count+=1,o.findingIds.push(n.id),o.severity=Ce(o.severity,n.severity),o.actionTier=Se(o.actionTier,n.actionTier),n.file&&o.files.add(n.file);for(let s of n.relatedFiles??[])o.relatedFiles.add(s)}return[...i.values()].map(n=>({...n,files:[...n.files].sort(),relatedFiles:[...n.relatedFiles].sort()})).sort((n,r)=>r.count-n.count||T(r.severity)-T(n.severity)||n.groupKey.localeCompare(r.groupKey))}function Ce(e,i){return T(i)>T(e)?i:e}function T(e){return e==="error"?2:e==="warning"?1:0}function Se(e,i){return e?i&&te(i)>te(e)?i:e:i}function te(e){return e==="direct"?2:e==="signal"?1:0}function $e(e,i){if(i.length===0||e.findings.length===0)return;let n=[];for(let r of e.findings){let o=i.find(s=>we(s,r));o?e.suppressed.push({finding:r,suppression:o}):n.push(r)}e.findings=n}function we(e,i){return!e.reason||e.reason.trim()===""||e.expiresAt&&Date.parse(e.expiresAt)<=Date.now()||e.id&&e.id!==i.id||e.check&&e.check!==i.check||e.file&&e.file!==i.file?!1:!!(e.id||e.check)}function De(e,i,n,r,o,s,t){t.checksRun.push("echo");for(let c of i.slice(0,o)){if(r(c))continue;let a=W(e,c.symbol,{minSimilarity:s,limit:5}),f=[];for(let l of a){let m=l.fileA===c.file?l.fileB:l.fileA,h=l.fileA===c.file?l.shortNameB:l.shortNameA,p=l.fileA===c.file?l.symbolB:l.symbolA;n.has(m)||f.push({otherFile:m,otherShort:h,otherSymbol:p,similarity:l.similarity,similarityBasis:l.similarityBasis??"callees",sharedEvidence:l.sharedCallees})}if(f.length===0)continue;let g=f[0],u=C("echo",c.symbol,c.file,...f.map(l=>`${l.otherSymbol}|${l.otherFile}`).sort()),d=ke(c,f);t.findings.push({id:u,groupKey:u,actionTier:d,check:"echo",severity:"warning",evidence:"heuristic",confidence:g.similarity,file:c.file,symbol:c.symbol,relatedFiles:[...new Set(f.map(l=>l.otherFile))].sort(),message:xe(c,f),why:Ae(c,f),remediation:Ge(d,c.shortName,g.otherShort),suppressionHint:`scip-query: ignore echo ${u} -- <reason>`})}i.length>o&&t.skipped.push({check:"echo",reason:`echo check capped at ${o} of ${i.length} changed symbols`})}function ke(e,i){return i.some(r=>Re(e.symbol,r))?"direct":"signal"}function Re(e,i){if(i.similarityBasis!=="source-tokens"||i.similarity<.98||i.sharedEvidence.length>8)return!1;let n=$(e),r=$(i.otherSymbol);return!n||!r?!1:n===r?!0:ve(i.sharedEvidence)?!1:Te(n,r)}function Te(e,i){let n=re(e),r=re(i);if(n.length===0||r.length===0)return!1;let o=new Set(r),s=n.filter(t=>o.has(t)).length;return s>=2&&s/Math.min(n.length,r.length)>=.5}function re(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(i=>i.toLowerCase()).filter(i=>i.length>=2)}var Fe=new Set(["bytes","crypto","hex","num","random","secret","to","token"]);function ve(e){return e.length>=3&&e.every(i=>Fe.has(i.toLowerCase()))}function xe(e,i){let n=i[0],r=Math.round(n.similarity*100);return i.length===1?`${e.shortName} (${e.file}) is ${r}% similar to established ${n.otherShort} (${n.otherFile})`:`${e.shortName} (${e.file}) resembles ${i.length} established symbol(s); strongest is ${r}% similar to ${n.otherShort} (${n.otherFile})`}function Ae(e,i){let n=[`${e.shortName} was changed in this diff.`];for(let r of i.slice(0,3))n.push(`${r.otherShort} is outside this diff and scored ${Math.round(r.similarity*100)}% similar by ${r.similarityBasis} evidence.`),n.push(`Shared evidence: ${r.sharedEvidence.slice(0,5).join(", ")||"(none listed)"}.`);return i.length>3&&n.push(`${i.length-3} additional similar match(es) grouped into this finding.`),n}function Ge(e,i,n){return e==="direct"?`Extract or reuse the shared behavior with ${n}, or keep the duplicate with a suppression reason.`:`Review whether ${i} is intentionally parallel to the established implementation(s); extract shared behavior only if the product semantics match.`}function je(e,i,n,r,o){let s=X(e,{base:i,maxHelpers:r,diffPlan:n});if(!s.available){o.skipped.push({check:"incomplete-migration",reason:"no git history"});return}o.checksRun.push("incomplete-migration"),s.note&&o.skipped.push({check:"incomplete-migration",reason:s.note});for(let t of s.findings){let c=t.leftovers.map(l=>`${l.shortName} (${l.file}, ${Math.round(l.containment*100)}% helper / ${Math.round(l.siteCoverage*100)}% site, ${l.migrationScope})`).join(", "),a=t.leftovers.map(l=>`${l.shortName}: ${l.migrationScope} (${l.migrationScopeReasons[0]})`).join("; "),f=[...t.migratedFiles,...t.leftovers.map(l=>l.file)],g=t.leftovers.length===0?void 0:Math.max(...t.leftovers.map(l=>Math.min(l.containment,l.siteCoverage))),u=t.leftovers.some(l=>l.migrationScope==="possible-subtype"),d=C("incomplete-migration",t.helperSymbol,t.helperFile,f.join("|"));o.findings.push({id:d,check:"incomplete-migration",severity:"warning",evidence:"heuristic",confidence:g,file:t.helperFile,symbol:t.helperSymbol,relatedFiles:f,message:`new helper ${t.helperShortName} (${t.helperFile}) is wired into ${t.migratedFiles.length} file(s), but ${t.leftovers.length} similar un-migrated site(s) remain: ${c}`,why:[`${t.helperShortName} is new in this diff and already referenced by ${t.migratedFiles.join(", ")}.`,`Helper shape: ${t.helperShape}; ${t.specificHelperCalleeCount}/${t.helperCalleeCount} helper callees are specific enough to score.`,`Unchanged site(s) still contain the helper's callee pattern: ${c}.`,`Migration scope hints: ${a}.`],remediation:u?`Migrate same-scope sites to ${t.helperShortName}; review possible subtype/variant sites before applying the helper.`:`Migrate the remaining sites to ${t.helperShortName}, or confirm they are intentionally different.`,suppressionHint:`scip-query: ignore incomplete-migration ${d} -- <reason>`})}}function Ee(e,i,n,r,o){let s=L(e,i,{minTogether:n,minConfidence:0,maxFilesPerCommit:20});if(!s){o.skipped.push({check:"co-change-partner",reason:"no git history"});return}o.checksRun.push("co-change-partner");let t=new Set,c;for(let a of s){let f=i.has(a.fileA),g=i.has(a.fileB);if(f===g)continue;let u=f?a.fileA:a.fileB,d=f?a.fileB:a.fileA,l=f?a.changesA:a.changesB,m=l>0?a.together/l:0;if(m<r||F(d)||F(u)||!x(`${e.config.projectRoot}/${d}`))continue;let h=`${u}|${d}`;if(t.has(h))continue;t.add(h);let p=C("co-change-partner",u,d,String(a.together)),b=N(u,d),S=K({fileA:u,fileB:d,together:a.together,confidence:m,commitScope:a.commitScope,recency:a.recency,subjectContext:a.subjectContext},b,(c??=B(e))(u,d)),A=[u,d].sort().join("|");o.findings.push({id:p,check:"co-change-partner",severity:"warning",evidence:"change-graph",actionTier:"signal",groupKey:`co-change-partner:${A}`,confidence:m,file:u,relatedFiles:[d],sourceAnalyzer:"co-change",rootCauseKey:A,partnerClass:b.partnerClass,partnerClassReasons:b.reasons,commitScope:a.commitScope,recency:a.recency,focusedTogether:a.focusedTogether,broadTogether:a.broadTogether,broadCommitRatio:a.broadCommitRatio,lastTogetherAt:a.lastTogetherAt,recentTogether:a.recentTogether,subjectContext:a.subjectContext,...S?{declaredCouplingSuggestion:S}:{},message:`${u} changed, but ${d} did not \u2014 they change together ${a.together}x (${Math.round(m*100)}% of the time)`,why:[`${u} is in this diff and ${d} is not.`,`Git history shows ${a.together} co-change(s), which is ${Math.round(m*100)}% of changes to the edited side.`,`History context: ${Le(a)}.`,`Subject context: ${Ne(a.subjectContext)}.`,...Ke(a),`Partner class: ${b.partnerClass} (${b.reasons.join("; ")}).`],remediation:S?`Update ${d} alongside this change, declare the coupling "${S.name}", or confirm the coupling no longer holds.`:`Update ${d} alongside this change, or confirm the coupling no longer holds.`,suppressionHint:`scip-query: ignore co-change-partner ${p} -- <reason>`})}}function Le(e){return`${e.commitScope}/${e.recency}; ${e.focusedTogether} focused, ${e.broadTogether} broad-sweep (${Math.round(e.broadCommitRatio*100)}% broad), ${e.recentTogether} recent, last ${Be(e.lastTogetherAt)}`}function Ne(e){let i=e.subjectLabels.length>0?e.subjectLabels.slice(0,5).join(", "):"none inferred",n=e.issueRefs.length>0?e.issueRefs.slice(0,5).join(", "):"none",r=e.sampleSubjects.length>0?e.sampleSubjects.slice(0,3).map(o=>`"${o}"`).join("; "):"none";return`labels ${i}; refs ${n}; samples ${r}; external issue/PR labels ${e.externalIssueLabelStatus}`}function Ke(e){let i=[];return e.commitScope==="broad-sweep"&&i.push("Broad-sweep history is weaker than focused co-edits; confirm this is a real coordination contract."),e.recency==="stale"&&i.push("The pair has no co-change in the recent history window; confirm the coupling still holds."),i}function Be(e){return e<=0?"unknown":new Date(e*1e3).toISOString().slice(0,10)}function Me(e,i,n,r,o){o.checksRun.push("doc-reference");let s=Oe(e,i,r);if(s.size!==0)for(let t of z(e,s)){if(n.has(t.doc))continue;let c=t.citedClaims.length>0?t.citedClaims:Pe(e,t.doc,t.cited),a=Ie(c),f=C("doc-reference",t.doc,t.cited.join("|"));o.findings.push({id:f,check:"doc-reference",severity:"warning",evidence:"change-graph",actionTier:a.actionTier,confidence:1,file:t.doc,relatedFiles:t.cited,citationKind:a.citationKind,citationKindReasons:a.reasons,citedClaims:c,message:`${t.doc} cites ${t.cited.join(", ")} as ${_e(a.citationKind)} \u2014 changed in this diff, doc untouched`,why:[`${t.cited.join(", ")} changed in this diff.`,`${t.doc} cites the changed file(s) but was not updated in the same diff.`,...a.reasons.map(g=>`Citation kind evidence: ${g}`)],remediation:ze(a.citationKind,t.doc),suppressionHint:`scip-query: ignore doc-reference ${f} -- <reason>`})}}function Ie(e){let i=e.join(`
|
|
3
|
-
`).toLowerCase(),n=[],r=v(i,[".scipquery","declaredcouplings","suppression","suppressions","config","configuration","json"]);if(r.length>0)return n.push(`configuration/example terms near citation: ${r.join(", ")}`),{citationKind:"configuration-example",actionTier:"support",reasons:n};let o=v(i,["accepted","intentional","intentionally","retained","historical"]);if(o.length>0)return n.push(`intentional-record terms near citation: ${o.join(", ")}`),{citationKind:"intentional-record",actionTier:"support",reasons:n};let s=v(i,["command","cli","usage","example","run","workflow"]);return s.length>0?(n.push(`guide/reference terms near citation: ${s.join(", ")}`),{citationKind:"guide-reference",actionTier:"signal",reasons:n}):(n.push(e.length>0?"citation appears in prose without config or guide markers":"citation context unavailable"),{citationKind:"behavioral-claim",actionTier:"direct",reasons:n})}function Pe(e,i,n){let r;try{r=oe(`${e.config.projectRoot}/${i}`,"utf-8").split(/\r?\n/)}catch{return[]}let o=n.flatMap(He),s=[];for(let t=0;t<r.length;t+=1){let c=r[t]??"";o.some(a=>c.includes(a))&&s.push(_(r,t))}return s}function He(e){let i=e.split("/");return[e,`./${e}`,i.slice(-3).join("/"),i.slice(-2).join("/")].filter((n,r,o)=>n.length>0&&o.indexOf(n)===r)}function v(e,i){return i.filter(n=>e.includes(n))}function _e(e){switch(e){case"behavioral-claim":return"a behavioral doc claim";case"configuration-example":return"a configuration example";case"guide-reference":return"a guide reference";case"intentional-record":return"an intentional record"}}function ze(e,i){switch(e){case"behavioral-claim":return`Re-read ${i} and update the behavioral claim or citation.`;case"configuration-example":return`Verify the configuration example in ${i} still points at the intended file; update only if the example target changed.`;case"guide-reference":return`Verify the guide reference in ${i} still sends readers to the right implementation or command surface.`;case"intentional-record":return`Verify the intentional citation in ${i} is still meant to name this file.`}}function Oe(e,i,n){let r=qe(n),o=new Set;for(let s of i)Ue(e,s,r.get(s)??[])&&o.add(s);return o}function qe(e){let i=new Map;for(let n of e){let r=i.get(n.file)??[];r.push(n),i.set(n.file,r)}return i}function Ue(e,i,n){if(n.length===0)return!1;if(!Ve.test(i))return!0;let r=`${e.config.projectRoot}/${i}`;if(!x(r))return!0;let o=oe(r,"utf-8").split(/\r?\n/),s=We(o);for(let t of n)for(let c=t.startLine;c<=t.endLine;c+=1)if((o[c]??"").trim()!==""&&!s.has(c))return!0;return!1}var Ve=/\.(?:[cm]?[jt]sx?)$/i;function We(e){let i=new Set,n=!1;for(let r=0;r<e.length;r+=1){let o=e[r].trim();!n&&Ye(o)&&(n=!0),n&&(i.add(r),o.endsWith(";")&&(n=!1))}return i}function Ye(e){return/^import(?:\s|$)/.test(e)||/^export(?:\s+type)?\s+(?:\*|\{)/.test(e)}function Je(e,i,n){n.checksRun.push("unused-params");for(let r of ee(e,{files:i,limit:50})){let o=C("unused-params",r.symbol,r.file,r.unusedTrailing.join("|"));n.findings.push({id:o,check:"unused-params",severity:"warning",evidence:"heuristic",confidence:.85,file:r.file,startLine:r.startLine,endLine:r.endLine,symbol:r.symbol,message:`${r.shortName} (${r.file}) has trailing unused parameter(s): ${r.unusedTrailing.join(", ")}`,why:[`${r.shortName} is in a changed file.`,`The trailing parameter(s) ${r.unusedTrailing.join(", ")} are not referenced in the function body.`],remediation:"Drop the unused trailing parameters and their call-site arguments.",suppressionHint:`scip-query: ignore unused-params ${o} -- <reason>`})}}function Ze(e,i,n,r){r.checksRun.push("new-dead");let o=new j(e);for(let s of i){if(n(s)||s.fanIn>0||o.fileKind(s.file)==="test"||w(e,s.file)||D(e,s.symbol,s.file)||Qe(s.symbol))continue;let t=C("new-dead",s.symbol,s.file);r.findings.push({id:t,check:"new-dead",severity:"warning",evidence:"graph-fact",confidence:.9,file:s.file,symbol:s.symbol,message:`${s.shortName} (${s.file}) was changed but has zero indexed consumers`,why:[`${s.shortName} is a changed production symbol.`,"The index reports zero consumers for this symbol.","The symbol is not in a detected entry surface or configured live root."],remediation:"Wire it up, or remove it before it becomes permanent dead code.",suppressionHint:`scip-query: ignore new-dead ${t} -- <reason>`})}}function Qe(e){if(G(e)!=="type")return!1;let i=$(e);return i.startsWith("_Assert")||i.startsWith("Assert")}function Xe(e,i,n){let r=new Map(n.renamedFiles.map(s=>[s.to,s.from])),o=new Map;return s=>{let t=r.get(s.file)??s.file,c=$(s.symbol);if(!c)return!1;let a=o.get(t);return a===void 0&&(a=H(e,i,t),o.set(t,a)),a!==null&&en(a,c)}}function en(e,i){return new RegExp(`\\b${nn(i)}\\b`).test(e)}function nn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function tn(e,i){if(!x(k(e))){i.skipped.push({check:"baseline",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}i.checksRun.push("baseline");let n=ie(e);for(let r of n.newFindings){let o=rn(r),s=C("baseline",r);i.findings.push({id:s,groupKey:`baseline:${o.sourceAnalyzer}:${o.rootCauseKey}`,check:"baseline",severity:"error",evidence:"baseline",actionTier:o.actionTier,confidence:1,file:o.file,relatedFiles:o.relatedFiles.length>0?o.relatedFiles:void 0,sourceAnalyzer:o.sourceAnalyzer,rootCauseKey:o.rootCauseKey,message:`new ${o.label} vs committed baseline: ${r}`,why:["A committed health baseline exists.","The current health result contains a finding not present in that baseline.",`Underlying analyzer: ${o.sourceAnalyzer}.`,`Inherited action tier: ${o.actionTier}.`,`Root cause key: ${o.rootCauseKey}.`,...o.why],remediation:o.remediation,suppressionHint:`scip-query: ignore baseline ${s} -- <reason>`})}}function rn(e){let[i,n]=R(e,":"),r=i||"unknown",o=(s={})=>{let t=s.actionTier??on(r);return{sourceAnalyzer:r,actionTier:t,rootCauseKey:s.rootCauseKey??(n||e),label:s.label??`${r} finding`,relatedFiles:s.relatedFiles??[],why:s.why??[],remediation:s.remediation??sn(t,r),file:s.file}};if(!n)return o({rootCauseKey:e,why:["Baseline identity did not include analyzer payload."]});if(["dead","isolated","extract","wrapper","passthrough","stale"].includes(r)){let[s,t]=R(n,":");return o({file:s,relatedFiles:s?[s]:[],rootCauseKey:t?`${s}:${t}`:n,label:`${r} finding`,why:t?[`Baseline subject: ${t}.`]:[]})}if(r==="cycle"){let s=n.split(">").filter(Boolean);return o({relatedFiles:s,rootCauseKey:n,label:"cycle finding",why:s.length>0?[`Cycle path: ${s.join(" > ")}.`]:[]})}if(r==="similar"){let s=n.split("|").filter(Boolean);return o({relatedFiles:[],rootCauseKey:n,label:"similarity finding",why:s.length>0?[`Similar symbols: ${s.join(" | ")}.`]:[]})}if(r==="drift"){let[s,t]=R(n,":"),[c,a]=R(t,":");return o({actionTier:s==="unused-import"?"direct":"signal",file:c,relatedFiles:[...new Set([c,a].filter(Boolean))],rootCauseKey:n,label:`${s||"drift"} finding`,why:[...s?[`Drift kind: ${s}.`]:[],...a?[`Related dependency: ${a}.`]:[]]})}return o({why:["Baseline analyzer prefix is not recognized by this diff-gate version."]})}function on(e){switch(e){case"dead":case"isolated":case"cycle":case"passthrough":return"direct";case"similar":case"extract":case"wrapper":case"stale":return"signal";default:return"signal"}}function sn(e,i){return e==="direct"?`Fix the new ${i} baseline finding, or knowingly accept it via health --write-baseline.`:`Review the new ${i} baseline signal; fix it if it reflects real debt, or knowingly accept it via health --write-baseline.`}function R(e,i){let n=e.indexOf(i);return n<0?[e,""]:[e.slice(0,n),e.slice(n+i.length)]}function C(e,...i){return`SQ${ye("sha256").update([e,...i].join("\0")).digest("hex").slice(0,12).toUpperCase()}`}export{ne as a,$n as b,ie as c,Bn as d,Mn as e,Xe as f};
|
|
4
|
-
//# sourceMappingURL=chunk-I7TSQZ3J.js.map
|
package/dist/chunk-NP5HYVLX.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import{a as S}from"./chunk-3ZYF3ELZ.js";import{e as b}from"./chunk-FUPDW5AC.js";import{c as p,f as h,h as y}from"./chunk-JM72FNGA.js";import{execFileSync as d}from"child_process";import{existsSync as x,readFileSync as N}from"fs";import{basename as C}from"path";var v="Unable to compute git diff.";function le(e,n={}){let t=n.plan??P(e,n);return t.note?A(t.note,t.changedFileLines):t.changedFiles.length===0?O(t.changedFileLines):T(t.changedFiles,[E(e,t.changedFiles,t.changedFiles,t.changedRanges)])}function P(e,n={}){let{base:t="HEAD"}=n;try{let i=$(e.config.projectRoot,t),r=J(e,i),s=G(e,k(e.config.projectRoot,t));return{changedFileLines:i,changedFiles:r,changedRanges:s,renamedFiles:B(e.config.projectRoot,t,r),note:i.length===0?"No changed files found.":void 0}}catch{return{changedFileLines:[],changedFiles:[],changedRanges:[],renamedFiles:[],note:v}}}function E(e,n,t,i=[]){let r=new S(e),s=new Set(t),a=q(i),l=[],m=new Map,f=n.flatMap(o=>r.definitionsForFile(o)).filter(ee).filter(o=>V(o,a)).sort((o,u)=>o.relativePath.localeCompare(u.relativePath)||o.startLine-u.startLine),c=f.map(o=>o.symbolId),g=K(e,c),w=Q(e,c,t),M=b(e,f.filter(o=>g.get(o.symbolId)===0));for(let o of f)j(e,o,s,l,m,M.get(o.symbolId)??new Set,g.get(o.symbolId)??0,w.get(o.symbolId)??new Set);return{changedSymbols:l,consumerEntries:[...m.entries()].map(([o,u])=>({file:o,symbols:[...u].sort()}))}}function T(e,n){let t=new Map,i=n.flatMap(s=>s.changedSymbols);for(let s of n)for(let a of s.consumerEntries){let l=t.get(a.file);l||(l=new Set,t.set(a.file,l));for(let m of a.symbols)l.add(m)}let r=X(t);return{changedFiles:[...e],changedSymbols:i,affectedConsumers:r,summary:{totalChangedFiles:e.length,totalChangedSymbols:i.length,totalAffectedFiles:r.length}}}function A(e,n=[]){return{changedFiles:n,changedSymbols:[],affectedConsumers:[],summary:{totalChangedFiles:n.length,totalChangedSymbols:0,totalAffectedFiles:0,note:e}}}function O(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 $(e,n){let t=d("git",["diff","--name-only",n],{encoding:"utf-8",cwd:e,timeout:1e4}),i=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,i,r].flatMap(s=>s.split(`
|
|
2
|
-
`)).map(s=>s.trim()).filter(s=>s.length>0))]}function k(e,n){let t=d("git",["diff","--unified=0",n],{encoding:"utf-8",cwd:e,timeout:1e4}),i=d("git",["diff","--unified=0","--cached",n],{encoding:"utf-8",cwd:e,timeout:1e4});return _([...L(t),...L(i)])}function z(e,n,t){try{return d("git",["show",`${n}:./${t}`],{encoding:"utf-8",cwd:e,timeout:1e4,stdio:["ignore","pipe","ignore"]})}catch{return null}}function B(e,n,t){if(t.length===0)return[];let i=new Map,r=new Set;for(let a of U(e,n))t.includes(a.to)&&(i.set(a.to,a),r.add(a.from));let s=W(e,n);if(s.length===0)return[...i.values()].sort((a,l)=>a.to.localeCompare(l.to));for(let a of t){if(i.has(a)||!x(`${e}/${a}`))continue;let l=s.filter(c=>!r.has(c)).filter(c=>C(c)===C(a));if(l.length===0)continue;let m=N(`${e}/${a}`,"utf-8"),f=l.map(c=>({from:c,to:a,similarity:H(z(e,n,c)??"",m)})).sort((c,g)=>g.similarity-c.similarity)[0];f&&f.similarity>=.45&&(i.set(a,f),r.add(f.from))}return[...i.values()].sort((a,l)=>a.to.localeCompare(l.to))}function W(e,n){let t=d("git",["diff","--name-only","--diff-filter=D",n],{encoding:"utf-8",cwd:e,timeout:1e4}),i=d("git",["diff","--name-only","--diff-filter=D","--cached",n],{encoding:"utf-8",cwd:e,timeout:1e4});return[...new Set([...R(t),...R(i)])]}function U(e,n){let t=d("git",["diff","--name-status","--find-renames",n],{encoding:"utf-8",cwd:e,timeout:1e4}),i=d("git",["diff","--name-status","--find-renames","--cached",n],{encoding:"utf-8",cwd:e,timeout:1e4});return[...t.split(`
|
|
3
|
-
`),...i.split(`
|
|
4
|
-
`)].map(r=>r.trim()).filter(r=>r.startsWith("R")).map(r=>r.split(" ")).filter(r=>r.length>=3).map(([r,s,a])=>({from:s,to:a,similarity:Number(r.slice(1))/100}))}function H(e,n){let t=new Set(I(e)),i=new Set(I(n));if(t.size===0&&i.size===0)return 1;if(t.size===0||i.size===0)return 0;let r=0;for(let s of t)i.has(s)&&(r+=1);return 2*r/(t.size+i.size)}function I(e){return e.match(/[A-Za-z_$][\w$]*|[{}()[\].,]/g)??[]}function R(e){return e.split(`
|
|
5
|
-
`).map(n=>n.trim()).filter(n=>n.length>0)}function J(e,n){let t=F(e),i=[];for(let r of n){let s=t(r);s&&!e.isIgnored(s)&&i.push(s)}return i}function G(e,n){let t=F(e),i=[];for(let r of n){let s=t(r.file);s&&!e.isIgnored(s)&&i.push({...r,file:s})}return _(i)}function F(e){let n=e.all(`SELECT relative_path FROM documents
|
|
6
|
-
ORDER BY id`).map(i=>i.relative_path),t=new Map(n.map(i=>[i,i]));return i=>{let r=i.replace(/\\/g,"/"),s=t.get(r);return s||(n.find(a=>a.endsWith(r))??null)}}function L(e){let n=[],t=null;for(let i of e.split(`
|
|
7
|
-
`)){if(i.startsWith("+++ ")){t=Y(i.slice(4).trim());continue}if(!t||!i.startsWith("@@ "))continue;let r=/@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/.exec(i);if(!r)continue;let s=Math.max(0,Number(r[1])-1),a=r[2]===void 0?1:Number(r[2]);n.push({file:t,startLine:s,endLine:Math.max(s,s+Math.max(a,1)-1)})}return n}function Y(e){return e==="/dev/null"?null:e.startsWith("a/")||e.startsWith("b/")?e.slice(2):e}function _(e){let n=new Set,t=[];for(let i of e){let r=`${i.file}:${i.startLine}:${i.endLine}`;n.has(r)||(n.add(r),t.push(i))}return t}function q(e){let n=new Map;for(let t of e){let i=n.get(t.file);i||(i=[],n.set(t.file,i)),i.push(t)}return n}function V(e,n){let t=n.get(e.relativePath);return!t||t.length===0?!0:t.some(i=>Z(e.startLine,e.endLine,i.startLine,i.endLine))}function Z(e,n,t,i){return e<=i&&t<=n}function j(e,n,t,i,r,s,a,l){let m=Math.max(a,s.size);if(!ne(n,m))return;let f=p(n.symbol);i.push({symbol:n.symbol,shortName:f,file:n.relativePath,startLine:n.startLine,endLine:n.endLine,fanIn:m});for(let c of l)D(e,t,r,c,f);for(let c of s)D(e,t,r,c,f)}function K(e,n){if(n.length===0)return new Map;let t=e.all(`SELECT m.symbol_id, COUNT(DISTINCT c.document_id) AS fan_in
|
|
8
|
-
FROM mentions m
|
|
9
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
10
|
-
WHERE m.symbol_id IN (${n.map(()=>"?").join(",")})
|
|
11
|
-
AND m.role != 1
|
|
12
|
-
GROUP BY m.symbol_id`,...n);return new Map(t.map(i=>[i.symbol_id,i.fan_in]))}function Q(e,n,t){if(n.length===0||t.length===0)return new Map;let i=e.all(`SELECT DISTINCT m.symbol_id, ref_d.relative_path
|
|
13
|
-
FROM mentions m
|
|
14
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
15
|
-
JOIN documents ref_d ON c.document_id = ref_d.id
|
|
16
|
-
WHERE m.symbol_id IN (${n.map(()=>"?").join(",")})
|
|
17
|
-
AND m.role != 1
|
|
18
|
-
AND ref_d.relative_path NOT IN (${t.map(()=>"?").join(",")})
|
|
19
|
-
${e.pathExclusionsFor("ref_d")}`,...n,...t),r=new Map;for(let s of i){let a=r.get(s.symbol_id);a||(a=new Set,r.set(s.symbol_id,a)),a.add(s.relative_path)}return r}function D(e,n,t,i,r){if(e.isIgnored(i)||n.has(i))return;let s=t.get(i);s||(s=new Set,t.set(i,s)),s.add(r)}function X(e){return[...e.entries()].map(([n,t])=>({file:n,consumedSymbols:t.size})).sort((n,t)=>t.consumedSymbols-n.consumedSymbols)}function ee(e){return!(y(e.symbol)||e.parentTypeName!==null&&!h(e.symbol))}function ne(e,n){return h(e.symbol)||e.isTypeLike?!0:e.parentTypeName===null&&n>0}export{v as a,le as b,P as c,E as d,T as e,z as f};
|
|
20
|
-
//# sourceMappingURL=chunk-NP5HYVLX.js.map
|
package/dist/chunk-NXIAHE7F.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{execFileSync as p}from"child_process";import{platform as u}from"os";var g=u()==="win32";function n(e){let r=g?"where":"which";try{return p(r,[e],{stdio:"pipe"}),!0}catch{return!1}}import{execFileSync as t}from"child_process";import{platform as l,arch as m}from"os";var a="v0.7.0";function x(){return n("scip")}function C(){try{return t("scip",["--version"],{stdio:"pipe"}).toString().trim()}catch{return null}}function f(){let e=l(),r=m(),i,o,s;switch(e){case"darwin":i="darwin",s="tar.gz";break;case"linux":i="linux",s="tar.gz";break;case"win32":i="windows",s="zip";break;default:return null}switch(r){case"arm64":o="arm64";break;case"x64":o="amd64";break;default:return null}let c=`scip-${i}-${o}.${s}`;return{url:`https://github.com/sourcegraph/scip/releases/download/${a}/${c}`,filename:c}}function S(){let e=f();console.log("\nThe `scip` CLI is required but not found on PATH.\n"),l()==="darwin"?(console.log("Install via Homebrew:"),console.log(` brew install sourcegraph/scip/scip
|
|
2
|
-
`),console.log("Or download manually:")):console.log("Download from:"),console.log(e?` ${e.url}
|
|
3
|
-
`:` https://github.com/sourcegraph/scip/releases/tag/${a}
|
|
4
|
-
`),console.log("After installing, ensure `scip` is on your PATH and run `scip-query reindex`.")}function $(e){if(l()==="darwin"&&n("brew")){e("Installing scip CLI via Homebrew...");try{if(t("brew",["install","sourcegraph/scip/scip"],{stdio:"inherit",timeout:3e5,env:process.env}),n("scip"))return e("Successfully installed scip CLI via Homebrew"),!0}catch(r){let i=r instanceof Error?r.message:String(r);e(`Homebrew install failed: ${i}`)}}if(n("go")){e("Installing scip CLI via go install...");try{if(t("go",["install","github.com/sourcegraph/scip/cmd/scip@latest"],{stdio:"inherit",timeout:3e5,env:process.env}),n("scip"))return e("Successfully installed scip CLI via go install"),!0}catch(r){let i=r instanceof Error?r.message:String(r);e(`go install failed: ${i}`)}}return e("Could not auto-install scip CLI."),e("Install manually from: https://github.com/sourcegraph/scip/releases"),!1}export{n as a,x as b,C as c,S as d,$ as e};
|
|
5
|
-
//# sourceMappingURL=chunk-NXIAHE7F.js.map
|
package/dist/chunk-O4L4AB3T.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as V}from"./chunk-PVZMPG5I.js";import{a as v,b,c as R}from"./chunk-3UVJJ6Z7.js";import{c as B}from"./chunk-ERHOS6AW.js";function L(e,s={}){let{minSimilarity:i=.45,minSharedBehaviors:t=6,limit:n=20,scope:a,scanLimit:l,filePattern:c}=s,h=B(e,{scope:a,minBehaviorTokens:Math.max(3,t),scanLimit:l}).map(o=>({file:o.file,tokens:o.behaviorTokens,profile:o}));return V({profiles:h,limit:n,filePattern:c,compare:(o,r)=>w(o,r,i,t),sort:(o,r)=>r.similarity-o.similarity||o.fileA.localeCompare(r.fileA)||o.fileB.localeCompare(r.fileB)})}function w(e,s,i,t){let n=v(e.tokens,s.tokens);if(n.size<t||!q(n))return null;let a=P(e.tokens,s.tokens);if(a<i)return null;let l=d(n,"composable:"),c=d(n,"store:"),h=d(n,"reactivity:"),o=d(n,"lifecycle:"),r=d(n,"request:"),f=d(n,"function:"),g=d(n,"function-verb:"),p=d(n,"template-binding:"),C=d(n,"template-event:"),m=k({sharedComposables:l,sharedStores:c,sharedReactivity:h,sharedLifecycle:o,sharedRequests:r,sharedFunctions:f,sharedFunctionVerbs:g,sharedBindings:p,sharedTemplateEvents:C});return{fileA:e.file,fileB:s.file,similarity:a,sharedTokens:y(n),sharedComposables:l,sharedStores:c,sharedReactivity:h,sharedLifecycle:o,sharedRequests:r,sharedFunctions:f,sharedFunctionVerbs:g,sharedBindings:p,sharedTemplateEvents:C,evidenceClass:m.evidenceClass,actionTier:m.actionTier,evidenceClassReasons:m.reasons,recommendation:m.recommendation,uniqueToA:y(b(e.tokens,s.tokens)).slice(0,25),uniqueToB:y(b(s.tokens,e.tokens)).slice(0,25),reason:$({sharedComposables:l,sharedStores:c,sharedRequests:r,sharedLifecycle:o,sharedFunctions:f,sharedFunctionVerbs:g,sharedBindings:p}),locA:e.profile.totalLines,locB:s.profile.totalLines}}function k(e){let s=[],i=[],t=[];e.sharedReactivity.length&&i.push(`shared reactivity primitive: ${e.sharedReactivity.join(", ")}`),e.sharedLifecycle.length&&i.push(`shared lifecycle primitive: ${e.sharedLifecycle.join(", ")}`),u(e.sharedComposables,"shared composable",s,t),u(e.sharedStores,"shared store",s,t),u(e.sharedRequests,"shared request",s,i),u(e.sharedFunctions,"shared function",s,i),u(e.sharedFunctionVerbs,"shared action verb",s,i),u(e.sharedBindings,"shared binding",s,i),u(e.sharedTemplateEvents,"shared template event",s,i);let n=s.length>0,a=i.length>0,l=t.length>0,c=n?a||l?"mixed":"domain-behavior":l?"shared-abstraction":"generic-workflow-scaffolding";return{actionTier:c==="domain-behavior"||c==="mixed"?"signal":"support",evidenceClass:c,reasons:[...s,...t,...i].slice(0,6),recommendation:A(c)}}function u(e,s,i,t){let n=[],a=[];for(let l of e)S(l)?n.push(l):a.push(l);n.length&&i.push(`${s} has domain term(s): ${n.slice(0,6).join(", ")}`),a.length&&t.push(`${s} is generic workflow: ${a.slice(0,6).join(", ")}`)}function S(e){return T(e).filter(i=>!F.has(i)).length>0}function T(e){return e.replace(/([A-Z])([A-Z][a-z])/g,"$1 $2").replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)}function A(e){switch(e){case"domain-behavior":return"Review for a shared composable, store, or feature module around the named domain behavior.";case"mixed":return"Separate generic Vue mechanics from domain-specific behavior before extracting a composable.";case"shared-abstraction":return"Review the existing composable/store usage first; extract only if duplicated behavior remains outside it.";case"generic-workflow-scaffolding":return"Treat as support evidence for a repeated workflow shape, not direct composable-extraction evidence."}}function P(e,s){if(e.size===0||s.size===0)return 0;let t=v(e,s).size/Math.min(e.size,s.size);return Math.max(R(e,s),t)}function q(e){let s=0,i=0,t=0,n=0,a=0,l=0,c=0;for(let r of e)r.startsWith("composable:")?s+=1:r.startsWith("store:")?i+=1:r.startsWith("request:")?t+=1:r.startsWith("lifecycle:")?n+=1:r.startsWith("function:")?a+=1:r.startsWith("reactivity:")?l+=1:(r.startsWith("function-verb:")||r.startsWith("template-binding:")||r.startsWith("template-event:"))&&(c+=1);let h=s+i,o=h+t+n+a+c;return t>=1&&o>=4||n>=1&&a>=2&&o>=4||h>=2&&(t>=1||a>=2)&&o>=5||a>=2&&l>=1&&o>=4}function $(e){let s=[];return e.sharedComposables.length&&s.push(`shared composables: ${e.sharedComposables.join(", ")}`),e.sharedStores.length&&s.push(`shared stores: ${e.sharedStores.join(", ")}`),e.sharedRequests.length&&s.push(`shared request helpers: ${e.sharedRequests.join(", ")}`),e.sharedLifecycle.length&&s.push(`shared lifecycle: ${e.sharedLifecycle.join(", ")}`),e.sharedFunctions.length&&s.push(`shared functions: ${e.sharedFunctions.slice(0,6).join(", ")}`),e.sharedFunctionVerbs.length&&s.push(`shared action verbs: ${e.sharedFunctionVerbs.slice(0,6).join(", ")}`),e.sharedBindings.length&&s.push(`shared template bindings: ${e.sharedBindings.slice(0,6).join(", ")}`),s.join("; ")||"shared Vue behavior profile"}function d(e,s){return[...e].filter(i=>i.startsWith(s)).map(i=>i.slice(s.length)).sort()}function y(e){return[...e].sort()}var F=new Set(["add","apply","cancel","change","clear","close","composable","create","data","delete","draft","edit","error","fetch","filter","form","item","items","load","loading","name","open","reactive","ref","refresh","remove","request","reset","resource","row","rows","save","saving","search","select","selected","store","submit","toggle","update","use","value","watch"]);export{L as a};
|
|
2
|
-
//# sourceMappingURL=chunk-O4L4AB3T.js.map
|
package/dist/chunk-TO54DY4O.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as y}from"./chunk-PVZMPG5I.js";import{a as k,b as p,c as H}from"./chunk-3UVJJ6Z7.js";import{e as v}from"./chunk-EWC3UK4V.js";function x(e,s={}){let{minSimilarity:r=.45,minSharedBehaviors:a=6,limit:t=20,scope:c,scanLimit:i,filePattern:l}=s,d=v(e,{scope:c,minBehaviorTokens:Math.max(3,a),scanLimit:i}).map(o=>({file:o.file,component:o.name,tokens:o.behaviorTokens,profile:o}));return y({profiles:d,limit:t,filePattern:l,compare:(o,n)=>b(o,n,r,a),sort:(o,n)=>n.similarity-o.similarity||o.fileA.localeCompare(n.fileA)||o.componentA.localeCompare(n.componentA)||o.fileB.localeCompare(n.fileB)||o.componentB.localeCompare(n.componentB)})}function b(e,s,r,a){let t=k(e.tokens,s.tokens);if(t.size<a||!T(t))return null;let c=S(e.tokens,s.tokens);if(c<r)return null;let i=h(t,"hook:"),l=h(t,"react-hook:"),d=h(t,"effect:"),o=h(t,"state:"),n=h(t,"request:"),u=h(t,"handler:"),g=h(t,"handler-verb:"),m=A({sharedHooks:i,sharedReactHooks:l,sharedEffects:d,sharedState:o,sharedRequests:n,sharedHandlers:u,sharedHandlerVerbs:g});return{fileA:e.file,componentA:e.component,fileB:s.file,componentB:s.component,similarity:c,sharedTokens:R(t),sharedHooks:i,sharedReactHooks:l,sharedEffects:d,sharedState:o,sharedRequests:n,sharedHandlers:u,sharedHandlerVerbs:g,evidenceClass:m.evidenceClass,actionTier:m.actionTier,evidenceClassReasons:m.reasons,recommendation:m.recommendation,uniqueToA:R(p(e.tokens,s.tokens)).slice(0,25),uniqueToB:R(p(s.tokens,e.tokens)).slice(0,25),reason:E({sharedHooks:i,sharedReactHooks:l,sharedEffects:d,sharedState:o,sharedRequests:n,sharedHandlers:u,sharedHandlerVerbs:g}),locA:e.profile.loc,locB:s.profile.loc}}function A(e){let s=[],r=[],a=[];e.sharedReactHooks.length&&r.push(`shared React primitives: ${e.sharedReactHooks.join(", ")}`),e.sharedEffects.length&&r.push(`shared lifecycle primitive: ${e.sharedEffects.join(", ")}`),f(e.sharedHooks,"shared hook",s,a),f(e.sharedRequests,"shared request",s,r),f(e.sharedState,"shared state",s,r),f(e.sharedHandlers,"shared handler",s,r),f(e.sharedHandlerVerbs,"shared action verb",s,r);let t=s.length>0,c=r.length>0,i=a.length>0,l=t?c||i?"mixed":"domain-behavior":i?"shared-abstraction":"generic-workflow-scaffolding",d=l==="domain-behavior"||l==="mixed"?"signal":"support",o=[...s,...a,...r].slice(0,6);return{actionTier:d,evidenceClass:l,reasons:o,recommendation:w(l)}}function f(e,s,r,a){let t=[],c=[];for(let i of e)B(i)?t.push(i):c.push(i);t.length&&r.push(`${s} has domain term(s): ${t.slice(0,6).join(", ")}`),c.length&&a.push(`${s} is generic workflow: ${c.slice(0,6).join(", ")}`)}function B(e){return C(e).filter(r=>!P.has(r)).length>0}function C(e){return e.replace(/([A-Z])([A-Z][a-z])/g,"$1 $2").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/^use(?=[A-Z])/,"").replace(/^handle(?=[A-Z])/,"").replace(/^is(?=[A-Z])/,"").replace(/^has(?=[A-Z])/,"").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)}function w(e){switch(e){case"domain-behavior":return"Review for a shared hook, controller, or feature module around the named domain behavior.";case"mixed":return"Separate generic React mechanics from domain-specific behavior before extracting a shared hook.";case"shared-abstraction":return"Review the existing shared hook usage first; extract only if duplicated behavior remains outside it.";case"generic-workflow-scaffolding":return"Treat as support evidence for a repeated workflow shape, not direct hook-extraction evidence."}}function S(e,s){if(e.size===0||s.size===0)return 0;let a=k(e,s).size/Math.min(e.size,s.size);return Math.max(H(e,s),a)}function T(e){let s=0,r=0,a=0,t=0,c=0,i=0,l=0;for(let n of e)n.startsWith("hook:")?s+=1:n.startsWith("react-hook:")?r+=1:n.startsWith("effect:")?a+=1:n.startsWith("request:")?t+=1:n.startsWith("handler:")||n.startsWith("handler-verb:")?c+=1:n.startsWith("state:")?i+=1:n.startsWith("state-hook:")&&(l+=1);let d=i+l,o=s+r+a+t+c+d;return t>=1&&o>=4||s>=1&&(t>=1||i>=1||c>=2)&&o>=5||i>=1&&c>=2&&(a>=1||r>=2)&&o>=5}function E(e){let s=[];return e.sharedHooks.length&&s.push(`shared hooks: ${e.sharedHooks.join(", ")}`),e.sharedReactHooks.length&&s.push(`shared React hooks: ${e.sharedReactHooks.join(", ")}`),e.sharedEffects.length&&s.push(`shared effects: ${e.sharedEffects.join(", ")}`),e.sharedState.length&&s.push(`shared state: ${e.sharedState.join(", ")}`),e.sharedRequests.length&&s.push(`shared requests: ${e.sharedRequests.join(", ")}`),e.sharedHandlers.length&&s.push(`shared handlers: ${e.sharedHandlers.slice(0,6).join(", ")}`),e.sharedHandlerVerbs.length&&s.push(`shared action verbs: ${e.sharedHandlerVerbs.slice(0,6).join(", ")}`),s.join("; ")||"shared React behavior profile"}function h(e,s){return[...e].filter(r=>r.startsWith(s)).map(r=>r.slice(s.length)).sort()}function R(e){return[...e].sort()}var P=new Set(["add","apply","async","callback","cancel","change","clear","close","create","data","delete","draft","edit","effect","error","fetch","filter","form","handle","has","is","item","items","load","loader","loading","memo","name","open","reducer","refresh","ref","remove","request","reset","resource","row","rows","save","saving","search","select","selected","state","store","submit","toggle","update","use","value"]);export{x as a};
|
|
2
|
-
//# sourceMappingURL=chunk-TO54DY4O.js.map
|
package/dist/chunk-UMNENNTX.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as u}from"./chunk-PVZMPG5I.js";import{a as p,b as l,c as f}from"./chunk-3UVJJ6Z7.js";import{e as m}from"./chunk-EWC3UK4V.js";function v(n,t={}){let{minSimilarity:o=.62,minTokens:e=8,limit:a=20,scope:g,scanLimit:d,filePattern:h}=t,k=m(n,{scope:g,minJsxTokens:e,scanLimit:d}).filter(i=>i.kind==="component").map(i=>({file:i.file,component:i.name,tokens:i.jsxTokens,profile:i}));return u({profiles:k,limit:a,filePattern:h,compare:(i,r)=>P(i,r,o),sort:(i,r)=>r.similarity-i.similarity||i.fileA.localeCompare(r.fileA)||i.componentA.localeCompare(r.componentA)||i.fileB.localeCompare(r.fileB)||i.componentB.localeCompare(r.componentB)})}function P(n,t,o){let e=p(n.tokens,t.tokens);if(e.size<6||!B(e))return null;let a=f(n.tokens,t.tokens);return a<o?null:{fileA:n.file,componentA:n.component,fileB:t.file,componentB:t.component,similarity:a,sharedTokens:c(e),sharedComponents:s(e,"component:"),sharedNativeTags:s(e,"native:"),sharedProps:s(e,"prop:"),sharedEvents:s(e,"event:"),sharedBindings:s(e,"binding:"),uniqueToA:c(l(n.tokens,t.tokens)).slice(0,25),uniqueToB:c(l(t.tokens,n.tokens)).slice(0,25),locA:n.profile.loc,locB:t.profile.loc}}function B(n){let t=0,o=0;for(let e of n)e.startsWith("component:")&&(t+=1),(e.startsWith("prop:")||e.startsWith("event:")||e.startsWith("native:")||e.startsWith("jsx:"))&&(o+=1);return t>=1||o>=4}function s(n,t){return[...n].filter(o=>o.startsWith(t)).map(o=>o.slice(t.length)).sort()}function c(n){return[...n].sort()}export{v as a};
|
|
2
|
-
//# sourceMappingURL=chunk-UMNENNTX.js.map
|