Lines 57-97javascript
57Relationship controls:`);for(let n of yn()){let o=e.relations.find(r=>r.family===n.family)?.status??"unsupported";console.log(` ${o.toUpperCase().padEnd(11)} ${n.family} ${n.direction} \u2014 ${n.question}`)}if(console.log(`
58Strengths: ${Object.keys(jt).join(", ")}. Unavailable analyses: ${un.map(n=>n.id).join(", ")}.`),console.log(`
59The agent chooses a question, family, and direction; this command reports support and does not infer intent.`),!t.matrix){console.log("Run `scip-query capabilities --matrix` only when a named claim needs contract or provider details.");return}Xg(e),Zg(e)}function Xg(e){console.log(`
60Control contracts:`);for(let t of wn)console.log(` scip-query ${t.command}`),console.log(` Input: ${t.requiredInput}`),console.log(` Returns: ${t.returnedFact}`),console.log(` Ceiling: ${t.evidenceCeiling}`),console.log(` Does not establish: ${t.nonClaim}`),t.contrasts.length>0&&console.log(` Contrast: ${t.contrasts.join(" ")}`),t.gapClosingCommands.length>0&&console.log(`
61Relationship contracts:`);for(let t of yn()){let i=e.relations.find(o=>o.family===t.family)?.status??"unsupported";console.log(` ${i.toUpperCase().padEnd(11)} ${t.family} ${t.direction}`),console.log(` Establishes: ${t.establishes}`),console.log(` Strengths: ${t.evidenceStrengths.join(", ")||"none registered"}`),console.log(` Provider ceilings: ${t.supportCeilings.join(
62Evidence strength legend:`);for(let[t,n]of Object.entries(jt))console.log(` ${t.toUpperCase().padEnd(11)} ${n}`);console.log(`
63Explicitly unavailable relationship analyses:`);for(let t of un)console.log(` ${t.id} [${t.families.join(", ")}]`),console.log(` ${t.capability}`),console.log(` Consequence: ${t.consequence}`),console.log(` Recover selected paths with: ${t.recoverWith.join(", ")}`)}function Zg(e){console.log(`
64Project capability matrix:`);for(let t of e.capabilities)console.log(` ${t.status.toUpperCase().padEnd(11)} ${t.label} [${t.evidence}]`),console.log(` ${t.reason}`);console.log(`
65Relationship support:`);for(let t of e.relations){console.log(` ${t.status.toUpperCase().padEnd(11)} ${t.family}`),console.log(` ${t.establishes}`),console.log(` Does not establish: ${t.nonClaims.join(" ")}`);for(let n of t.providerCapabilities)console.log(` ${n.status.toUpperCase().padEnd(11)} ${n.id}: ${n.subtypes.join(", ")}`),console.log(` ${n.reason}`)}if(e.matrix.length!==0){console.log(`
66Language matrix:`);for(let t of e.matrix){console.log(` ${t.language}`);for(let n of[t.indexing,t.sourceFacts,t.semantic,t.detectors,t.cleanupVerification])console.log(` ${n.status.toUpperCase().padEnd(11)} ${n.label}`),console.log(` ${n.reason}`)}}}function xt(e){return{...e,options:x(e.options)}}function Je({query:e,format:t,emptyMessage:n,heuristicLabel:i,before:o,toJson:r,coverage:s,agentResult:a,after:c,...l}){let d=xt(l);return{...d,renderShape:"list",handler:ta({commandName:d.id,query:e,format:t,emptyMessage:n,heuristicLabel:i,before:o,toJson:r,coverage:s,agentResult:a ...
67 Deletion candidates -- confirm with cleanup-plan --verify before deleting.`,L,{count:h.length,loc:f}),!R&&h.length>N.length&&console.log(`
68 Showing top ${N.length} by LOC. Re-run with --full for the remaining ${h.length-N.length}.`)),p.length>0&&(h.length>0&&console.log(""),Pn(F,"FILE-INTERNAL ONLY",` Used only within the same file (no cross-file callers). Could be a
69 single-use helper, an abstraction-in-progress, or a callback registered
70 through a framework path that static analysis cannot trace (signal
71 handlers, event listeners, dependency injection). NOT necessarily dead \u2014
72 review case by case.`,q,{count:p.length,loc:y}),!R&&p.length>F.length&&console.log(`
73 Showing top ${F.length} by LOC. Re-run with --full for the remaining ${p.length-F.length}.`)),g.length>0&&((h.length>0||p.length>0)&&console.log(""),Pn(H,"IMPLICIT USAGE",` Traits, macros, attributes, ABI exports, or reflection provide a
74 consumer that the static reference graph cannot trace. Investigation
75 signals only \u2014 not deletion candidates and not counted as dead code.`,E,{count:g.length,loc:v}),!R&&g.length>H.length&&console.log(`
76 Showing top ${H.length} by LOC. Re-run with --full for the remaining ${g.length-H.length}.`));let V=[];l&&V.push(`${h.length} dead code (${f} LOC)`),d&&V.push(`${p.length} file-internal (${y} LOC)`),m&&V.push(`${g.length} implicit usage (${
77\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`),console.log(`Total: ${h.length+p.length+g.length} symbols \u2014 ${V.join(" + ")}`)}),td=Se("unused-imports",{query:({db:e,
78${e.length} unused import(s)`)}),nd=sa("isolated",{query:({db:e,opts:t,budget:n})=>fr(e,{scope:$(t,"scope"),minLoc:k(t,"minLoc",
79${e.length} isolated symbol(s)`)}),id=ee("extract-candidates",({db:e,args:t,opts:n,budget:i})=>{let o=Nr(e,{scope:$(n,
80${_(r.relativePath,r.startLine,r.endLine)} ${r.shortName} (${r.loc} LOC, ${r.totalCallees} callees)`),console.log(` Kind: ${r.extractionKind}; tier: ${
81${o.length} extraction candidate(s) found.`)}),od=ee("locality-candidates",({db:e,args:t,opts:n,budget:i})=>{let o=Or(e,{target:U(t,
82${s} ${r.sourceUnit.shortName}`),console.log(` Current directory: ${r.currentDirectory}; tier: ${r.recommendedTier}; action: ${r.actionTier}`),console.log(` Consumer coverage: ${r.consumerCoverage}; consumers: ${r.consumerFiles.length}`),r.nearestCommonOwner&&console.log(` Nearest common owner: ${r.nearestCommonOwner}`),r.suggestedHome&&console.log(` Suggested home: ${r.suggestedHome}`),r.whyNoSuggestedHome&&console.log(` Suggested home withheld: ${r.whyNoSuggestedHome}`),r.boundaryMarkers.length>0&&console.log(` Boundary
83${o.length} locality candidate(s) found.`)}),rd=Se("wrapper-candidates",{query:({db:e,opts:t,budget:n})=>as(e,{scope:$(t,"scope"),maxLoc:k(t,"maxLoc",15),limit:D(t,"limit",30),scanLimit:n.scanLimit,semantic:n.semantic}),format:e=>` ${_(e.file,e.startLine,e.endLine)} ${e.shortName} (${e.loc} LOC)
84 Only called by: ${e.singleCallerShort} (fan-in: ${e.callerFanIn}, tier: ${e.actionTier})`+(e.boundaryEvidence.length>0?`
85 Boundary evidence: ${e.boundaryEvidence.join("; ")}`:""),emptyMessage:()=>"No wrapper candidates found.",heuristicLabel:"wrapper candidates",after:e=>console.log(`
86${e.length} wrapper candidate(s).`)}),sd=Se("passthrough-candidates",{query:({db:e,opts:t,budget:n})=>Hr(e,{scope:$(t,"scope"),maxLoc:k(t,"maxLoc",15),limit:D(t,"limit",30),scanLimit:n.scanLimit,semantic:n.semantic}),format:e=>` ${_(e.file,e.startLine,e.endLine)} ${e.shortName} (${e.loc} LOC)
87 Forwards to: ${e.forwardsToShort} (${e.forwardsToFile}, tier: ${e.actionTier})
88 Recommendation: ${e.recommendation}`+(e.boundaryEvidence.length>0?`
89 Boundary evidence: ${e.boundaryEvidence.join("; ")}`:"")+(e.publicFacadeEvidence.length>0?`
90 Public facade evidence: ${e.publicFacadeEvidence.join("; ")}`:""),emptyMessage:()=>"No passthrough candidates found.",heuristicLabel:"passthrough candidates",after:e=>console.log(`
91${e.length} passthrough candidate(s).`)}),ad=Se("stale-abstractions",{query:({db:e,opts:t,budget:n})=>ss(e,{scope:$(t,"scope"),minLoc:k(t,"minLoc",3),limit:D(t,"limit",30),includeLowConfidence:b(t,"includeLowConfidence"),scanLimit:n.scanLimit,semantic:n.semantic}),format:e=>{let t=e.consumers===0?"unused":`${e.consumers} consumer`,n=e.barrelConsumers>0?`, +${e.barrelConsumers} barrel`:"";return` [${e.confidence}] ${_(e.file,e.startLine,e.endLine)} ${e.shortName} (${e.kind}, ${e.loc} LOC, ${t}${n})
93 Kind: ${e.stalenessKind}; tier: ${e.actionTier}
94 Recommendation: ${e.recommendation}`},emptyMessage:()=>"No stale abstractions found.",heuristicLabel:"stale abstraction candidates",after:e=>console.log(`
95${e.length} stale abstraction(s).`)}),cd=mn("complexity-hotspots",{headers:["score"," LOC","fan-in","fan-out","callees","symbol"],query:({db:e,opts:t,budget:n})=>us(e,{scope:$(t,"scope"),minLoc:k(t,"minLoc",10),limit:D(t,"limit",20),scanLimit:n.scanLimit,semantic:n.semantic}),format:e=>` ${e.score.toFixed(1).padStart(5)} ${String(e.loc).padStart(4)} ${String(e.fanIn).padStart(6)} ${String(e.fanOut).padStart(7
96${Math.round(t.similarity*100)}% ${n}
97`),console.log(` A: ${t.symbolA.shortName} (${t.symbolA.file}, ${t.symbolA.loc} LOC)`),console.log(` B: ${t.symbolB.shortName} (${t.symbolB
Long lines were clipped for display.