scip-query 0.13.0 → 0.15.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/CHANGELOG.md +19 -0
- package/README.md +16 -2
- package/dist/augment-vue-worker.js +1 -1
- package/dist/{chunk-U3VMUDXJ.js → chunk-4SCMYKD6.js} +1 -1
- package/dist/{chunk-FERAXG6Y.js → chunk-X7CHWTZ2.js} +1 -1
- package/dist/chunk-YBGC7HTY.js +3 -0
- package/dist/cli.js +259 -251
- package/dist/{config-types-BrHl3Bge.d.ts → config-types-aCgyLrvE.d.ts} +2 -0
- package/dist/{db-_Bdx0E1W.d.ts → db-DwCdT3rv.d.ts} +1 -1
- package/dist/{health-BEZ1Rt0S.d.ts → health-nJUidasZ.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/queries/affected.d.ts +2 -2
- package/dist/queries/bottlenecks.d.ts +2 -2
- package/dist/queries/by-kind.d.ts +2 -2
- package/dist/queries/call-graph.d.ts +2 -2
- package/dist/queries/change-surface.d.ts +2 -2
- package/dist/queries/cleanup-plan.d.ts +2 -2
- package/dist/queries/co-change.d.ts +2 -2
- package/dist/queries/code.d.ts +2 -2
- package/dist/queries/complexity-hotspots.d.ts +2 -2
- package/dist/queries/complexity.d.ts +2 -2
- package/dist/queries/convergence.d.ts +2 -2
- package/dist/queries/coupling.d.ts +2 -2
- package/dist/queries/cycles.d.ts +2 -2
- package/dist/queries/dataflow.d.ts +2 -2
- package/dist/queries/dead.d.ts +2 -2
- package/dist/queries/decorative-checkers.d.ts +2 -2
- package/dist/queries/deep-chains.d.ts +2 -2
- package/dist/queries/deps.d.ts +2 -2
- package/dist/queries/diff-gate.d.ts +2 -2
- package/dist/queries/diff-gate.js +1 -1
- package/dist/queries/diff-impact.d.ts +2 -2
- package/dist/queries/doc-drift.d.ts +2 -2
- package/dist/queries/drift.d.ts +2 -2
- package/dist/queries/duplicate-bodies.d.ts +2 -2
- package/dist/queries/extract-candidates.d.ts +2 -2
- package/dist/queries/fan.d.ts +2 -2
- package/dist/queries/files.d.ts +2 -2
- package/dist/queries/health.d.ts +3 -3
- package/dist/queries/health.js +1 -1
- package/dist/queries/hierarchy.d.ts +2 -2
- package/dist/queries/hotspots.d.ts +2 -2
- package/dist/queries/imports.d.ts +2 -2
- package/dist/queries/incomplete-migration.d.ts +2 -2
- package/dist/queries/index.d.ts +3 -3
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.d.ts +2 -2
- package/dist/queries/locality-candidates.d.ts +2 -2
- package/dist/queries/members.d.ts +2 -2
- package/dist/queries/methods.d.ts +2 -2
- package/dist/queries/not-implemented.d.ts +2 -2
- package/dist/queries/outline.d.ts +2 -2
- package/dist/queries/passthrough-candidates.d.ts +2 -2
- package/dist/queries/plan-context.d.ts +2 -2
- package/dist/queries/react-component-duplicates.d.ts +2 -2
- package/dist/queries/react-hook-candidates.d.ts +2 -2
- package/dist/queries/react-large-component-pressure.d.ts +2 -2
- package/dist/queries/recent-duplicates.d.ts +2 -2
- package/dist/queries/redundant-reexports.d.ts +2 -2
- package/dist/queries/refs.d.ts +2 -2
- package/dist/queries/self-audit.d.ts +2 -2
- package/dist/queries/similar-chains.d.ts +2 -2
- package/dist/queries/similar-files.d.ts +2 -2
- package/dist/queries/similar-signatures.d.ts +2 -2
- package/dist/queries/similar.d.ts +2 -2
- package/dist/queries/slice.d.ts +2 -2
- package/dist/queries/stale-abstractions.d.ts +2 -2
- package/dist/queries/stats.d.ts +2 -2
- package/dist/queries/surface.d.ts +2 -2
- package/dist/queries/symbols.d.ts +2 -2
- package/dist/queries/system.d.ts +2 -2
- package/dist/queries/test-quality.d.ts +2 -2
- package/dist/queries/trace.d.ts +2 -2
- package/dist/queries/twin-ab.d.ts +2 -2
- package/dist/queries/twin-drift.d.ts +2 -2
- package/dist/queries/unused-imports.d.ts +2 -2
- package/dist/queries/unused-params.d.ts +2 -2
- package/dist/queries/vue-component-duplicates.d.ts +2 -2
- package/dist/queries/vue-composable-candidates.d.ts +2 -2
- package/dist/queries/vue-large-view-pressure.d.ts +2 -2
- package/dist/queries/wrapper-candidates.d.ts +2 -2
- package/dist/reindex-worker.js +12 -11
- package/dist/reindex.d.ts +3 -3
- package/dist/reindex.js +20 -19
- package/dist/runtime.d.ts +3 -3
- package/dist/runtime.js +2 -2
- package/dist/{scip-cli-C7cg4ZHR.d.ts → scip-cli-DeAbuJ2b.d.ts} +1 -1
- package/docs/COMMAND_REFERENCE.md +2 -1
- package/package.json +1 -1
- package/skills/_shared/SKILL.md +3 -1
- package/skills/scip-calibrate/SKILL.md +7 -3
- package/skills/scip-verify/SKILL.md +6 -1
- package/dist/chunk-XC2PJOVM.js +0 -3
|
@@ -82,9 +82,14 @@ If it reports findings, fix them or record the acceptance reason. If a suppressi
|
|
|
82
82
|
|
|
83
83
|
```bash
|
|
84
84
|
scip-query suppress <id> --reason "<specific reason>"
|
|
85
|
-
scip-query config-validate
|
|
86
85
|
```
|
|
87
86
|
|
|
87
|
+
`suppress` writes one file per suppression under `.scipquery/suppressions/` —
|
|
88
|
+
commit that file with your change. Suppressing is a real decision, not a
|
|
89
|
+
bypass: every suppression counts against that detector's precision in
|
|
90
|
+
`scip-query effectiveness`, while fixing the finding counts for it. Prefer the
|
|
91
|
+
fix whenever the finding is real.
|
|
92
|
+
|
|
88
93
|
This step is complete only when `diff-gate` passes or every finding has a durable explanation.
|
|
89
94
|
|
|
90
95
|
### 5. Check health, docs, and config when relevant
|
package/dist/chunk-XC2PJOVM.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as be}from"./chunk-M7EEHYSU.js";import{a as ye}from"./chunk-N2OTJWC2.js";import{a as ne,c as oe,d as re,e as w}from"./chunk-ZEO4CXQR.js";import{a as pe}from"./chunk-27XEGMCT.js";import{a as ge}from"./chunk-6JUAGXR4.js";import{a as me}from"./chunk-C2QSK7E7.js";import{a as de}from"./chunk-6KMTPNZL.js";import{a as fe}from"./chunk-JJUX2OAP.js";import{a as ce}from"./chunk-X3DTIEMU.js";import{a as le}from"./chunk-2XRXEIRK.js";import{b as ie}from"./chunk-HZZQKNVE.js";import{a as ee,b as te}from"./chunk-3AMWF6V5.js";import{a as Y,b as J,c as Z,g as j,h as B}from"./chunk-KYB7FPXT.js";import{a as Q,b as D,e as X}from"./chunk-Q7PWDXL5.js";import{b as ae}from"./chunk-QVGFVRKD.js";import{a as N,c as W,d as q,e as V}from"./chunk-IUSSGHJO.js";import{a as U}from"./chunk-7COVQPQQ.js";import{a as he,e as ue}from"./chunk-KSJ544IV.js";import{a as se}from"./chunk-LY7NMOBW.js";import{a as O}from"./chunk-IMQFJ53K.js";import{f as R,g as T}from"./chunk-BZXE3HO4.js";import{i as H}from"./chunk-GULVO6NF.js";import{e as F,f as z,g as I}from"./chunk-X5C43YVI.js";import{a as _}from"./chunk-JZBGTSAB.js";import{a as L}from"./chunk-ISLWJ4PY.js";import{l as P}from"./chunk-WS3Z6W3M.js";import{createHash as We}from"crypto";import{existsSync as K}from"fs";function Ce(e){let[t,i]=G(e,":"),o=t||"unknown",n=(a={})=>{let s=a.actionTier??Ie(o);return{sourceAnalyzer:o,actionTier:s,rootCauseKey:a.rootCauseKey??(i||e),label:a.label??`${o} finding`,relatedFiles:a.relatedFiles??[],why:a.why??[],remediation:a.remediation??Ne(s,o),file:a.file}};if(!i)return n({rootCauseKey:e,why:["Baseline identity did not include analyzer payload."]});if(["dead","isolated","extract","wrapper","passthrough","stale"].includes(o)){let[a,s]=G(i,":");return n({file:a,relatedFiles:a?[a]:[],rootCauseKey:s?`${a}:${s}`:i,label:`${o} finding`,why:s?[`Baseline subject: ${s}.`]:[]})}if(o==="cycle"){let a=i.split(">").filter(Boolean);return n({relatedFiles:a,rootCauseKey:i,label:"cycle finding",why:a.length>0?[`Cycle path: ${a.join(" > ")}.`]:[]})}if(o==="similar"){let a=i.split("|").filter(Boolean);return n({relatedFiles:[],rootCauseKey:i,label:"similarity finding",why:a.length>0?[`Similar symbols: ${a.join(" | ")}.`]:[]})}if(o==="drift"){let[a,s]=G(i,":"),[l,c]=G(s,":");return n({actionTier:a==="unused-import"?"direct":"signal",file:l,relatedFiles:[...new Set([l,c].filter(Boolean))],rootCauseKey:i,label:`${a||"drift"} finding`,why:[...a?[`Drift kind: ${a}.`]:[],...c?[`Related dependency: ${c}.`]:[]]})}return n({why:["Baseline analyzer prefix is not recognized by this diff-gate version."]})}function Ie(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 Ne(e,t){return e==="direct"?`Fix the new ${t} baseline finding, or knowingly accept it via health --write-baseline.`:`Review the new ${t} baseline signal; fix it if it reflects real debt, or knowingly accept it via health --write-baseline.`}function G(e,t){let i=e.indexOf(t);return i<0?[e,""]:[e.slice(0,i),e.slice(i+t.length)]}import{existsSync as je,readFileSync as Be,writeFileSync as Me}from"fs";import{isAbsolute as Ke,join as Le}from"path";var Pe=25e3,_e=2500,ze=2500;function He(e){let t=me(e);return t.symbols>=Pe||t.documents>=_e?ze:void 0}var Oe=".scipquery-baseline.json";function x(e,t){return t&&Ke(t)?t:Le(e.config.projectRoot,t??Oe)}function $e(e,t={}){let{scope:i}=t,o=He(e),n=[],a=ae(e,{scope:i,...w.dead,scanLimit:o});for(let s of a.symbols)R(e,s.relativePath)||T(e,s.symbol,s.relativePath)||s.kind==="dead-code"&&n.push(`dead:${s.relativePath}:${s.shortName}`);for(let s of fe(e,{scope:i,...w.isolated,scanLimit:o}))R(e,s.relativePath)||T(e,s.symbol,s.relativePath)||n.push(`isolated:${s.relativePath}:${s.shortName}`);for(let s of se(e,{scope:i}))s.kind==="real"&&n.push(`cycle:${Ue(s.path)}`);for(let s of ue(e,{scope:i,...w.similar,scanLimit:o}))n.push(`similar:${[s.symbolA,s.symbolB].sort().join("|")}`);for(let s of ee(e,{scope:i,...w.duplicateBodies,scanLimit:o}))n.push(`duplicate-bodies:${s.hash}:${s.functions.map(l=>l.symbol).sort().join("|")}`);for(let s of le(e,{scope:i,...w.extract,scanLimit:o}))n.push(`extract:${s.relativePath}:${s.shortName}`);for(let s of pe(e,{scope:i,...w.wrappers,scanLimit:o}))n.push(`wrapper:${s.file}:${s.shortName}`);for(let s of de(e,{scope:i,...w.passthroughs,scanLimit:o}))n.push(`passthrough:${s.file}:${s.shortName}`);for(let s of ge(e,{scope:i,...w.stale,scanLimit:o}))n.push(`stale:${s.file}:${s.shortName}`);for(let s of ce(e,{scope:i,...w.drift,includePatternDeviations:!1,limit:Number.POSITIVE_INFINITY}).results)n.push(`drift:${s.kind}:${s.file}:${s.dep}`);return[...new Set(n)].sort()}function Ue(e){if(e.length===0)return"";let t=0;for(let i=1;i<e.length;i++)e[i]<e[t]&&(t=i);return[...e.slice(t),...e.slice(0,t)].join(">")}function Kt(e,t={}){let i=$e(e,{scope:t.scope}),o=x(e,t.path);return Me(o,JSON.stringify({version:1,findings:i},null,2)+`
|
|
2
|
-
`),{path:o,findingCount:i.length}}function Se(e,t={}){let i=x(e,t.path);if(!je(i))throw new Error(`No baseline found at ${i}. Create one with: scip-query health --write-baseline`);let o=JSON.parse(Be(i,"utf-8")),n=new Set(o.findings??[]),a=$e(e,{scope:t.scope}),s=new Set(a);return{baselinePath:i,baselineCount:n.size,current:a,newFindings:a.filter(l=>!n.has(l)),fixedFindings:[...n].filter(l=>!s.has(l))}}var ci=["echo","incomplete-migration","co-change-partner","twin-partner","coverage-contract","doc-reference","unused-params","new-dead","baseline"];function li(e,t={}){let i=t.base??"HEAD",{minTogether:o=6,minConfidence:n=.6,maxEchoChecks:a=Number.POSITIVE_INFINITY,maxHelpers:s=Number.POSITIVE_INFINITY,minSimilarity:l=.8,includeBaseline:c=!1,scanLimit:r}=t,d=t.semantic!==!1,u=new Set(t.skip??[]),h=Z(e,{base:i}),p=J(e,{base:i,plan:h}),m=p.changedFiles,b=new Set(m),S=new Set(h.changedFileLines),f=new Set([...b,...S]),C=j(e.config.projectRoot,i,B(h,m)),$=Ct(e.config.projectRoot,i,h,C),g={base:i,changedFiles:m,changedSymbols:p.changedSymbols.length,checksRun:[],skipped:[],suppressed:[],findings:[],attributionNotes:p.attributionNotes,rootCauseGroups:[],note:p.summary.note};if(m.length===0)return g;let v=(A,Ae)=>{if(u.has(A)){g.skipped.push({check:A,reason:"skipped via --skip"});return}let Ge=g.findings.length,xe=g.skipped.length,Ee=g.checksRun.length;P(`diff-gate.check.${A}`,Ae,()=>({check:A,changedFiles:m.length,changedSymbols:p.changedSymbols.length,findingsAdded:g.findings.length-Ge,skippedAdded:g.skipped.length-xe,checksRunAdded:g.checksRun.length-Ee}))};return v("echo",()=>Je(e,p.changedSymbols,b,$,a,l,r,d,g)),v("incomplete-migration",()=>it(e,i,h,s,r,d,C,g)),v("co-change-partner",()=>nt(e,f,o,n,g)),v("twin-partner",()=>ot(e,p.changedSymbols,b,r,g)),v("coverage-contract",()=>rt(e,f,g)),v("doc-reference",()=>ft(e,b,S,h.changedRanges,h.renamedFiles,g)),v("unused-params",()=>gt(e,m,g)),v("new-dead",()=>mt(e,p.changedSymbols,$,g)),c&&v("baseline",()=>St(e,g)),Ve(g,e.config.suppressions??[]),g.rootCauseGroups=qe(g.findings),g}function fi(e){return e.checksRun.length===0&&e.note===Y}function di(e){return e.filter(t=>!t.advisory)}function qe(e){let t=new Map;for(let i of e){let o=i.groupKey??`${i.check}:${i.id}`,n=t.get(o);n||(n={groupKey:o,check:i.check,severity:i.severity,actionTier:i.actionTier,sourceAnalyzer:i.sourceAnalyzer,rootCauseKey:i.rootCauseKey,count:0,findingIds:[],files:new Set,relatedFiles:new Set,message:i.message,remediation:i.remediation},t.set(o,n)),n.count+=1,n.findingIds.push(i.id),n.severity=Re(n.severity,i.severity),n.actionTier=Te(n.actionTier,i.actionTier),i.file&&n.files.add(i.file);for(let a of i.relatedFiles??[])n.relatedFiles.add(a)}return[...t.values()].map(i=>({...i,files:[...i.files].sort(),relatedFiles:[...i.relatedFiles].sort()})).sort((i,o)=>o.count-i.count||E(o.severity)-E(i.severity)||i.groupKey.localeCompare(o.groupKey))}function Re(e,t){return E(t)>E(e)?t:e}function E(e){return e==="error"?2:e==="warning"?1:0}function Te(e,t){return e?t&&we(t)>we(e)?t:e:t}function we(e){return e==="direct"?2:e==="signal"?1:0}function Ve(e,t){if(t.length===0||e.findings.length===0)return;let i=[];for(let o of e.findings){let n=t.find(a=>Ye(a,o));n?e.suppressed.push({finding:o,suppression:n}):i.push(o)}e.findings=i}function Ye(e,t){return!e.reason||e.reason.trim()===""||e.expiresAt&&Date.parse(e.expiresAt)<=Date.now()||e.id&&e.id!==t.id&&!t.legacySuppressionIds?.includes(e.id)||e.check&&e.check!==t.check||e.file&&e.file!==t.file?!1:!!(e.id||e.check)}function k(e,t){e.findings.push({...t,suppressionHint:`scip-query: ignore ${t.check} ${t.id} -- <reason>`})}function Je(e,t,i,o,n,a,s,l,c){c.checksRun.push("echo");for(let r of t.slice(0,n)){if(!I(r.symbol)||o(r))continue;let d=te(e,r.symbol,{maxLoc:15,scanLimit:s}).filter(f=>!i.has(f.file)).slice(0,5).map(f=>({otherFile:f.file,otherShort:f.shortName,otherSymbol:f.symbol,similarity:1,similarityBasis:"exact-body",sharedEvidence:[`exact normalized body (${f.loc} LOC)`]}));if(d.length>0){let f=y("echo",r.symbol,r.file),C=y("echo",r.symbol,r.file,...d.map(g=>`${g.otherSymbol}|${g.otherFile}`).sort()),$=d[0];k(c,{id:f,legacySuppressionIds:C===f?void 0:[C],groupKey:f,actionTier:"direct",check:"echo",severity:"warning",evidence:"heuristic",confidence:1,file:r.file,symbol:r.symbol,relatedFiles:[...new Set(d.map(g=>g.otherFile))].sort(),sourceAnalyzer:"duplicate-bodies",rootCauseKey:`${r.symbol}:${$.otherSymbol}`,message:ke(r,d),why:De(r,d),remediation:Fe("direct",r.shortName,$.otherShort)});continue}let u=he(e,r.symbol,{minSimilarity:a,limit:5,scanLimit:s,semantic:l,sourceCandidateMode:"target-pruned"}),h=[];for(let f of u){let C=f.fileA===r.file?f.fileB:f.fileA,$=f.fileA===r.file?f.shortNameB:f.shortNameA,g=f.fileA===r.file?f.symbolB:f.symbolA;i.has(C)||h.push({otherFile:C,otherShort:$,otherSymbol:g,similarity:f.similarity,similarityBasis:f.similarityBasis??"callees",sharedEvidence:f.sharedCallees})}if(h.length===0)continue;let p=h[0],m=y("echo",r.symbol,r.file,...h.map(f=>`${f.otherSymbol}|${f.otherFile}`).sort()),b=y("echo",r.symbol,r.file),S=Ze(r,h);k(c,{id:b,legacySuppressionIds:m===b?void 0:[m],groupKey:b,actionTier:S,check:"echo",severity:"warning",evidence:"heuristic",confidence:p.similarity,file:r.file,symbol:r.symbol,relatedFiles:[...new Set(h.map(f=>f.otherFile))].sort(),message:ke(r,h),why:De(r,h),remediation:Fe(S,r.shortName,p.otherShort)})}t.length>n&&c.skipped.push({check:"echo",reason:`echo check capped at ${n} of ${t.length} changed symbols`})}function Ze(e,t){return t.some(o=>Qe(e.symbol,o))?"direct":"signal"}function Qe(e,t){if(t.similarityBasis==="exact-body")return!0;if(t.similarityBasis!=="source-tokens"||t.similarity<.98||t.sharedEvidence.length>8)return!1;let i=F(e),o=F(t.otherSymbol);return!i||!o?!1:i===o?!0:tt(t.sharedEvidence)?!1:Xe(i,o)}function Xe(e,t){let i=ve(e),o=ve(t);if(i.length===0||o.length===0)return!1;let n=new Set(o),a=i.filter(s=>n.has(s)).length;return a>=2&&a/Math.min(i.length,o.length)>=.5}function ve(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).map(t=>t.toLowerCase()).filter(t=>t.length>=2)}var et=new Set(["bytes","crypto","hex","num","random","secret","to","token"]);function tt(e){return e.length>=3&&e.every(t=>et.has(t.toLowerCase()))}function ke(e,t){let i=t[0],o=Math.round(i.similarity*100);return t.length===1?`${e.shortName} (${e.file}) is ${o}% similar to established ${i.otherShort} (${i.otherFile})`:`${e.shortName} (${e.file}) resembles ${t.length} established symbol(s); strongest is ${o}% similar to ${i.otherShort} (${i.otherFile})`}function De(e,t){let i=[`${e.shortName} was changed in this diff.`];for(let o of t.slice(0,3))i.push(`${o.otherShort} is outside this diff and scored ${Math.round(o.similarity*100)}% similar by ${o.similarityBasis} evidence.`),i.push(`Shared evidence: ${o.sharedEvidence.slice(0,5).join(", ")||"(none listed)"}.`);return t.length>3&&i.push(`${t.length-3} additional similar match(es) grouped into this finding.`),i}function Fe(e,t,i){return e==="direct"?`Extract or reuse the shared behavior with ${i}, or keep the duplicate with a suppression reason.`:`Review whether ${t} is intentionally parallel to the established implementation(s); extract shared behavior only if the product semantics match.`}function it(e,t,i,o,n,a,s,l){let c=ye(e,{base:t,maxHelpers:o,diffPlan:i,scanLimit:n,semantic:a,baseContentAt:s});if(!c.available){l.skipped.push({check:"incomplete-migration",reason:"no git history"});return}l.checksRun.push("incomplete-migration"),c.note&&l.skipped.push({check:"incomplete-migration",reason:c.note});for(let r of c.findings){let d=r.leftovers.map(f=>`${f.shortName} (${f.file}, ${Math.round(f.containment*100)}% helper / ${Math.round(f.siteCoverage*100)}% site, ${f.migrationScope})`).join(", "),u=r.leftovers.map(f=>`${f.shortName}: ${f.migrationScope} (${f.migrationScopeReasons[0]})`).join("; "),h=[...r.migratedFiles,...r.leftovers.map(f=>f.file)],p=r.leftovers.length===0?void 0:Math.max(...r.leftovers.map(f=>Math.min(f.containment,f.siteCoverage))),m=r.leftovers.some(f=>f.migrationScope==="possible-subtype"),b=y("incomplete-migration",r.helperSymbol,r.helperFile,h.join("|")),S=y("incomplete-migration",r.helperSymbol,r.helperFile);k(l,{id:S,legacySuppressionIds:b===S?void 0:[b],check:"incomplete-migration",severity:"warning",evidence:"heuristic",confidence:p,file:r.helperFile,symbol:r.helperSymbol,relatedFiles:h,message:`new helper ${r.helperShortName} (${r.helperFile}) is wired into ${r.migratedFiles.length} file(s), but ${r.leftovers.length} similar un-migrated site(s) remain: ${d}`,why:[`${r.helperShortName} is new in this diff and already referenced by ${r.migratedFiles.join(", ")}.`,`Helper shape: ${r.helperShape}; ${r.specificHelperCalleeCount}/${r.helperCalleeCount} helper callees are specific enough to score.`,`Unchanged site(s) still contain the helper's callee pattern: ${d}.`,`Migration scope hints: ${u}.`],remediation:m?`Migrate same-scope sites to ${r.helperShortName}; review possible subtype/variant sites before applying the helper.`:`Migrate the remaining sites to ${r.helperShortName}, or confirm they are intentionally different.`})}}function nt(e,t,i,o,n){let a=U(e).directionalCoChangePairsForFiles(t,{minTogether:i,minConfidence:0,maxFilesPerCommit:20});if(!a){n.skipped.push({check:"co-change-partner",reason:"no git history"});return}n.checksRun.push("co-change-partner");let s=new Set,l;for(let c of a){let r=t.has(c.fileA),d=t.has(c.fileB);if(r===d)continue;let u=r?c.fileA:c.fileB,h=r?c.fileB:c.fileA,p=r?c.changesA:c.changesB,m=p>0?c.together/p:0;if(m<o||N(h)||N(u)||!K(`${e.config.projectRoot}/${h}`))continue;let b=`${u}|${h}`;if(s.has(b))continue;s.add(b);let S=y("co-change-partner",u,h,String(c.together)),f=y("co-change-partner",u,h),C=W(u,h),$=q({fileA:u,fileB:h,together:c.together,confidence:m,commitScope:c.commitScope,recency:c.recency,subjectContext:c.subjectContext},C,(l??=V(e))(u,h)),g=[u,h].sort().join("|");n.findings.push({id:f,legacySuppressionIds:S===f?void 0:[S],check:"co-change-partner",severity:"warning",evidence:"change-graph",actionTier:"signal",groupKey:`co-change-partner:${g}`,confidence:m,file:u,relatedFiles:[h],sourceAnalyzer:"co-change",rootCauseKey:g,partnerClass:C.partnerClass,partnerClassReasons:C.reasons,commitScope:c.commitScope,recency:c.recency,focusedTogether:c.focusedTogether,broadTogether:c.broadTogether,broadCommitRatio:c.broadCommitRatio,lastTogetherAt:c.lastTogetherAt,recentTogether:c.recentTogether,subjectContext:c.subjectContext,...$?{declaredCouplingSuggestion:$}:{},message:`${u} changed, but ${h} did not \u2014 they change together ${c.together}x (${Math.round(m*100)}% of the time)`,why:[`${u} is in this diff and ${h} is not.`,`Git history shows ${c.together} co-change(s), which is ${Math.round(m*100)}% of changes to the edited side.`,`History context: ${st(c)}.`,`Subject context: ${at(c.subjectContext)}.`,...ct(c),`Partner class: ${C.partnerClass} (${C.reasons.join("; ")}).`],remediation:$?`Update ${h} alongside this change, declare the coupling "${$.name}", or confirm the coupling no longer holds.`:`Update ${h} alongside this change, or confirm the coupling no longer holds.`})}}function ot(e,t,i,o,n){n.checksRun.push("twin-partner");let a=ie(e,{scanLimit:o}).filter(c=>c.relationship==="divergent"||c.relationship==="identical");if(a.length===0)return;let s=new Map;for(let c of a)for(let r of c.members)s.set(r.symbol,c);let l=new Set;for(let c of t){if(!I(c.symbol))continue;let r=s.get(c.symbol);if(!r)continue;let d=r.members.filter(m=>m.symbol!==c.symbol&&!i.has(m.file));if(d.length===0)continue;let u=[c.symbol,...d.map(m=>m.symbol)].sort().join("|");if(l.has(u))continue;l.add(u);let h=d[0],p=y("twin-partner",c.symbol,c.file,h.symbol);k(n,{id:p,groupKey:`twin-partner:${u}`,check:"twin-partner",severity:"warning",evidence:"heuristic",actionTier:"signal",advisory:!0,confidence:r.relationship==="identical"?1:Math.max(0,1-r.maxDivergence),file:c.file,symbol:c.symbol,relatedFiles:d.map(m=>m.file).sort(),sourceAnalyzer:"twin-drift",rootCauseKey:u,message:`${c.shortName} (${c.file}) changed but its same-name twin ${h.shortName} (${h.file}) did not \u2014 verify the change shouldn't apply to both, or consolidate them.`,why:[`${c.symbol} is in this diff.`,`${h.symbol} shares its (near-)name and is classified '${r.relationship}' with it, but ${h.file} is not in this diff.`,r.relationship==="divergent"?`The two bodies already diverge (~${Math.round(r.maxDivergence*100)}% token difference) \u2014 this diff may widen or narrow that drift.`:"The two bodies were byte-identical before this diff.","Advisory: twin-partner never fails the gate by itself \u2014 see the twin-partner entry in the diff-gate checks table."],remediation:`Update ${h.file} alongside this change, consolidate ${c.shortName}/${h.shortName} into one helper, or confirm the twin should diverge on purpose.`})}}function rt(e,t,i){i.checksRun.push("coverage-contract");let o=e.config.coverageContracts??[];for(let n of o){if(!oe(n,t))continue;let a=ne(e,n);if(a.status==="ok")continue;let s=y("coverage-contract",n.name,n.file);k(i,{id:s,groupKey:`coverage-contract:${n.name}`,check:"coverage-contract",severity:a.status==="unavailable"?"warning":"error",evidence:"graph-fact",actionTier:"direct",file:n.file,sourceAnalyzer:"coverage-contracts",rootCauseKey:n.name,message:re(a),why:[`Contract "${n.name}" declares that ${n.file} (${n.keys.type}) must track ${n.mustEqual.type}.`,a.status==="unavailable"?`The declared side could not be evaluated: ${a.unavailableReason}.`:`Missing: ${a.missing.join(", ")||"none"}. Extra: ${a.extra.join(", ")||"none"}.`,"Either side of this contract changed in this diff."],remediation:a.status==="unavailable"?"Investigate why the declared key set could not be parsed (see the reason above) \u2014 do not treat this as a pass.":`Update ${n.file} so its ${n.keys.type==="object-literal-keys"||n.keys.type==="string-array"?n.keys.identifier:n.keys.marker} matches ${n.mustEqual.type}, or fix the ground-truth source if the declared set is right.`})}}function st(e){return`${e.commitScope}/${e.recency}; ${e.focusedTogether} focused, ${e.broadTogether} broad-sweep (${Math.round(e.broadCommitRatio*100)}% broad), ${e.recentTogether} recent, last ${lt(e.lastTogetherAt)}`}function at(e){let t=e.subjectLabels.length>0?e.subjectLabels.slice(0,5).join(", "):"none inferred",i=e.issueRefs.length>0?e.issueRefs.slice(0,5).join(", "):"none",o=e.sampleSubjects.length>0?e.sampleSubjects.slice(0,3).map(n=>`"${n}"`).join("; "):"none";return`labels ${t}; refs ${i}; samples ${o}; external issue/PR labels ${e.externalIssueLabelStatus}`}function ct(e){let t=[];return e.commitScope==="broad-sweep"&&t.push("Broad-sweep history is weaker than focused co-edits; confirm this is a real coordination contract."),e.recency==="stale"&&t.push("The pair has no co-change in the recent history window; confirm the coupling still holds."),t}function lt(e){return e<=0?"unknown":new Date(e*1e3).toISOString().slice(0,10)}var M=3;function ft(e,t,i,o,n,a){a.checksRun.push("doc-reference");let s=D.referenceTargets(e,t,o);if(s.size===0)return;let l=new Set(n.map(r=>r.from)),c=[];for(let r of X(e,s))i.has(r.doc)||Q(e,r.doc)||c.push(dt(e,r,l));for(let r of ht(c))k(a,r)}function dt(e,t,i){let o=t.citedClaims.length>0?t.citedClaims:D.citationContexts(e,t.doc,t.cited),n=D.classifyCitation(o),a=D.hasLineAnchoredCitation(t.citations),s=t.cited.some(u=>i.has(u)||!K(`${e.config.projectRoot}/${u}`)),l=!(a||s),c=t.cited[0]??"",r=y("doc-reference",t.doc,t.cited.join("|")),d=y("doc-reference",t.doc,c);return{id:d,legacySuppressionIds:r===d?void 0:[r],check:"doc-reference",severity:"warning",evidence:"change-graph",actionTier:n.actionTier,groupKey:`doc-reference:${c}`,rootCauseKey:c,confidence:1,file:t.doc,relatedFiles:t.cited,citationKind:n.citationKind,citationKindReasons:n.reasons,citedClaims:o,...l?{advisory:!0}:{},message:`${t.doc} cites ${t.cited.join(", ")} as ${D.citationKindLabel(n.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.`,...n.reasons.map(u=>`Citation kind evidence: ${u}`),l?"Advisory: bare file-mention citation (no line anchor, cited file still present under the same path) \u2014 21.2 calibration found this citation shape low-precision; verify at your leisure.":a?"Blocking: citation includes a line anchor that may now point at the wrong lines.":"Blocking: the cited file was deleted or renamed in this diff \u2014 the citation almost certainly needs an update."],remediation:D.citationRemediation(n.citationKind,t.doc)}}function ht(e){let t=new Map;for(let o of e){let n=o.rootCauseKey??"",a=t.get(n);a?a.push(o):t.set(n,[o])}let i=[];for(let[o,n]of t)n.length<=M?i.push(...n):i.push(ut(o,n));return i}function ut(e,t){let i=[...t].sort((d,u)=>(d.file??"").localeCompare(u.file??"")),o=i.slice(0,M).map(d=>({doc:d.file??"",citedClaims:d.citedClaims??[]})),n=i.length-o.length,a=i.every(d=>d.advisory===!0),s=i.reduce((d,u)=>Re(d,u.severity),"info"),l=i.reduce((d,u)=>Te(d,u.actionTier),void 0),c=i.map(d=>d.file??"").filter(d=>d.length>0),r=[...new Set(i.flatMap(d=>[d.id,...d.legacySuppressionIds??[]]))];return{id:y("doc-reference","hub-cluster",e),memberFindingIds:r,check:"doc-reference",severity:s,evidence:"change-graph",actionTier:l,groupKey:`doc-reference:${e}`,rootCauseKey:e,confidence:1,file:o[0]?.doc,relatedFiles:[e],citationCount:i.length,citationExemplars:o,suppressedCount:n,...a?{advisory:!0}:{},message:`${e} is cited by ${i.length} doc(s) changed in this diff, doc(s) untouched \u2014 showing ${o.length} example(s), ${n} more damped`,why:[`${e} changed in this diff.`,`${i.length} doc(s) cite it but were not updated in the same diff: ${c.join(", ")}.`,...o.map(d=>`Example \u2014 ${d.doc}: ${d.citedClaims[0]??"(no captured citation text)"}`),`${n} additional doc(s) also cite this file, past the per-hub-file cascade cap (${M}) \u2014 not silently dropped: counted in citationCount/suppressedCount and individually addressable via memberFindingIds.`,a?"Advisory: every citation in this cluster is a bare file-mention (no line anchor, cited file still present).":"Blocking: at least one citation in this cluster is line-anchored or cites a deleted/renamed file."],remediation:`Review the ${o.length} example doc(s) above; ${i.length} total doc(s) cite ${e} the same way \u2014 see citationExemplars and memberFindingIds in --json for the complete list.`}}function gt(e,t,i){i.checksRun.push("unused-params");for(let o of be(e,{files:t,limit:50})){let n=y("unused-params",o.symbol,o.file,o.unusedTrailing.join("|")),a=y("unused-params",o.symbol,o.file);k(i,{id:a,legacySuppressionIds:n===a?void 0:[n],check:"unused-params",severity:"warning",evidence:"heuristic",confidence:.85,file:o.file,startLine:o.startLine,endLine:o.endLine,symbol:o.symbol,message:`${o.shortName} (${o.file}) has trailing unused parameter(s): ${o.unusedTrailing.join(", ")}`,why:[`${o.shortName} is in a changed file.`,`The trailing parameter(s) ${o.unusedTrailing.join(", ")} are not referenced in the function body.`],remediation:"Drop the unused trailing parameters and their call-site arguments."})}}function mt(e,t,i,o){o.checksRun.push("new-dead");let n=new O(e),a=L(e.config.projectRoot),s=a.length>1;for(let l of t){if(i(l)||l.fanIn>0||n.fileKind(l.file)==="test"||R(e,l.file)||T(e,l.symbol,l.file)||bt(l.symbol))continue;let c=y("new-dead",l.symbol,l.file),r=s&&pt(a,l.file)&&yt(e,l.symbol);k(o,{id:c,check:"new-dead",severity:"warning",evidence:r?"heuristic":"graph-fact",confidence:r?.4:.9,file:l.file,symbol:l.symbol,message:r?`${l.shortName} (${l.file}) unconfirmed (cross-package ambiguous-name resolution gap): zero indexed consumers found, but this name is ambiguous project-wide and lives in a workspace package \u2014 verify manually before treating as dead`:`${l.shortName} (${l.file}) was changed but has zero indexed consumers`,why:r?[`${l.shortName} is a changed production symbol in a workspace package.`,"The index, semantic, and source-fallback layers all report zero consumers for this symbol.","Its leaf name is ambiguous project-wide (a same-named definition exists elsewhere), and cross-package consumers reached only through a re-exporting barrel are a known unresolvable shape for this tool \u2014 see docs/plans/2026-07-02-followups.md item 2."]:[`${l.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:r?"Verify with a direct code search before deleting; this tool cannot confidently resolve this symbol.":"Wire it up, or remove it before it becomes permanent dead code."})}}function pt(e,t){return e.some(i=>t===i.relativeDir||t.startsWith(`${i.relativeDir}/`))}function yt(e,t){let i=F(t);return i?(H(e).get(i)?.length??0)>1:!1}function bt(e){if(z(e)!=="type")return!1;let t=F(e);return t.startsWith("_Assert")||t.startsWith("Assert")}function Ct(e,t,i,o){let n=new Map(i.renamedFiles.map(s=>[s.to,s.from])),a=o??j(e,t,B(i));return s=>{let l=n.get(s.file)??s.file,c=F(s.symbol);if(!c)return!1;let r=a(l);return r!==null&&$t(r,c)}}function $t(e,t){return new RegExp(`\\b${_(t)}\\b`).test(e)}function St(e,t){if(!K(x(e))){t.skipped.push({check:"baseline",reason:"no .scipquery-baseline.json \u2014 run health --write-baseline to enable"});return}t.checksRun.push("baseline");let i=Se(e);for(let o of i.newFindings){let n=Ce(o),a=y("baseline",o);k(t,{id:a,groupKey:`baseline:${n.sourceAnalyzer}:${n.rootCauseKey}`,check:"baseline",severity:"error",evidence:"baseline",actionTier:n.actionTier,confidence:1,file:n.file,relatedFiles:n.relatedFiles.length>0?n.relatedFiles:void 0,sourceAnalyzer:n.sourceAnalyzer,rootCauseKey:n.rootCauseKey,message:`new ${n.label} vs committed baseline: ${o}`,why:["A committed health baseline exists.","The current health result contains a finding not present in that baseline.",`Underlying analyzer: ${n.sourceAnalyzer}.`,`Inherited action tier: ${n.actionTier}.`,`Root cause key: ${n.rootCauseKey}.`,...n.why],remediation:n.remediation})}}function y(e,...t){return`SQ${We("sha256").update([e,...t].join("\0")).digest("hex").slice(0,12).toUpperCase()}`}export{$e as a,Kt as b,Se as c,ci as d,li as e,fi as f,di as g,Ct as h};
|
|
3
|
-
//# sourceMappingURL=chunk-XC2PJOVM.js.map
|