codebaseiq 0.3.0 → 0.3.1
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 +15 -0
- package/dist/{chunk-BFBIMTCJ.js → chunk-2XBJRZEM.js} +2 -2
- package/dist/{chunk-GDHWOA57.js → chunk-2Z7K66D7.js} +2 -2
- package/dist/{chunk-HVFB3PME.js → chunk-3H2H5ODK.js} +2 -2
- package/dist/{chunk-LZSQ6X7E.js → chunk-3LQJRS4I.js} +2 -2
- package/dist/{chunk-GIDCP7KV.js → chunk-3ON3A2QV.js} +2 -2
- package/dist/{chunk-TPO7XC5Z.js → chunk-4GWN76B2.js} +2 -2
- package/dist/{chunk-GL6UTNUB.js → chunk-53ELMZRF.js} +2 -2
- package/dist/{chunk-6VREELBC.js → chunk-57OPIQFM.js} +2 -2
- package/dist/{chunk-JSNTHRLQ.js → chunk-5CR4U5X2.js} +2 -2
- package/dist/{chunk-GUFPEFBG.js → chunk-5MPBSFZH.js} +2 -2
- package/dist/{chunk-K7JLSGCJ.js → chunk-5TZNHP4T.js} +3 -3
- package/dist/{chunk-DVWO7RBC.js → chunk-5YBDBY5L.js} +2 -2
- package/dist/{chunk-T5X7DK6C.js → chunk-6EYESTJM.js} +2 -2
- package/dist/{chunk-AQI4N64O.js → chunk-6FXXYYQM.js} +2 -2
- package/dist/{chunk-VWYGCMV5.js → chunk-AGGR2BKS.js} +2 -2
- package/dist/{chunk-FEIZXBLH.js → chunk-ALOEHWJS.js} +2 -2
- package/dist/{chunk-D53LWANR.js → chunk-AXQCHG77.js} +2 -2
- package/dist/{chunk-7JELP5YE.js → chunk-BFANZRQ5.js} +2 -2
- package/dist/{chunk-5IZRKWTZ.js → chunk-BGYRF5YX.js} +2 -2
- package/dist/{chunk-5IC2WZAL.js → chunk-BIADXGC3.js} +2 -2
- package/dist/{chunk-HENP2O4A.js → chunk-BPKNP3KZ.js} +2 -2
- package/dist/{chunk-GP7C5VAE.js → chunk-CB5AVJMM.js} +2 -2
- package/dist/{chunk-HQA7EBSK.js → chunk-CJTKGAGH.js} +2 -2
- package/dist/{chunk-JLZLLLW5.js → chunk-CLPCFGRT.js} +2 -2
- package/dist/{chunk-EXZ7VLRY.js → chunk-CSPDQLLU.js} +2 -2
- package/dist/{chunk-AEXQYQD7.js → chunk-CYJS33YX.js} +2 -2
- package/dist/{chunk-AURCQHSG.js → chunk-DDRA3QKN.js} +2 -2
- package/dist/{chunk-3RSBGWGL.js → chunk-DECN422G.js} +2 -2
- package/dist/{chunk-3RR2K7EZ.js → chunk-DJKOXMNG.js} +2 -2
- package/dist/{chunk-PFC44E6D.js → chunk-DWBAESVW.js} +2 -2
- package/dist/{chunk-FQTIFWLR.js → chunk-EHPOTEQX.js} +2 -2
- package/dist/{chunk-NBCQZSGR.js → chunk-ELYMY5S2.js} +2 -2
- package/dist/{chunk-FTTV7IRX.js → chunk-EOKVZXNF.js} +42 -42
- package/dist/{chunk-HINZQKSY.js → chunk-F5CJO5JN.js} +2 -2
- package/dist/{chunk-SMDIEDM4.js → chunk-G7GVV2TV.js} +2 -2
- package/dist/{chunk-67VJAYVR.js → chunk-HJTM3C4Y.js} +2 -2
- package/dist/{chunk-I22IZYDI.js → chunk-HNXRVGMY.js} +2 -2
- package/dist/{chunk-NCJILOAK.js → chunk-I3OK27P7.js} +2 -2
- package/dist/{chunk-FWQGH2N2.js → chunk-ILGTMRMZ.js} +2 -2
- package/dist/{chunk-DDN2F6GB.js → chunk-JAFDMV5I.js} +2 -2
- package/dist/{chunk-LONKINMJ.js → chunk-JNXI6NQ7.js} +2 -2
- package/dist/{chunk-6BF3VYEF.js → chunk-JSB43EX6.js} +2 -2
- package/dist/chunk-JYRJYXUV.js +2 -0
- package/dist/chunk-K4S2VH42.js +82 -0
- package/dist/{chunk-75KJGYX7.js → chunk-K6FNTQQW.js} +2 -2
- package/dist/{chunk-XQPPURLQ.js → chunk-KEJ2HLRW.js} +2 -2
- package/dist/{chunk-D7AZAOZX.js → chunk-KFTHI2R6.js} +2 -2
- package/dist/{chunk-J3GLP7Q5.js → chunk-KLX6NSWT.js} +2 -2
- package/dist/{chunk-TJBOJUVN.js → chunk-KUKKLWJD.js} +2 -2
- package/dist/{chunk-2EDX3JT5.js → chunk-KUKWHP4R.js} +2 -2
- package/dist/{chunk-JFIA2JI3.js → chunk-KWRQVLPX.js} +2 -2
- package/dist/{chunk-5DSL3NT2.js → chunk-L37EQYAX.js} +2 -2
- package/dist/{chunk-ITSJMNUD.js → chunk-LCW3PSGL.js} +2 -2
- package/dist/{chunk-2PRONPAS.js → chunk-LSZYMN2A.js} +2 -2
- package/dist/{chunk-Q23IMHXS.js → chunk-MC46AL7B.js} +2 -2
- package/dist/{chunk-JYI7CV25.js → chunk-MDFT325O.js} +2 -2
- package/dist/{chunk-CVHOQONG.js → chunk-N2XDMNVI.js} +2 -2
- package/dist/chunk-NNG6M6XD.js +3 -0
- package/dist/{chunk-MVRGB4KJ.js → chunk-O2KWU34K.js} +2 -2
- package/dist/{chunk-USOAJHY7.js → chunk-OBC7HSSO.js} +2 -2
- package/dist/{chunk-RIYJ4L33.js → chunk-OKAF4OQS.js} +2 -2
- package/dist/{chunk-GQXXOS55.js → chunk-OP6BUIV6.js} +2 -2
- package/dist/{chunk-23C5AD3B.js → chunk-OQ3DK7FW.js} +2 -2
- package/dist/chunk-OT5ISJSR.js +2 -0
- package/dist/{chunk-C7QWUBR2.js → chunk-OWJWOEDU.js} +2 -2
- package/dist/{chunk-RJVAPMHF.js → chunk-PIFYOWS4.js} +2 -2
- package/dist/{chunk-CR3OG6SQ.js → chunk-PTR3EOXC.js} +2 -2
- package/dist/{chunk-NBZKSTXP.js → chunk-QY7QB7I6.js} +2 -2
- package/dist/{chunk-Q3ZCQY2Y.js → chunk-R4OJGTMP.js} +2 -2
- package/dist/{chunk-UQE4XFSA.js → chunk-RIO3JXHM.js} +2 -2
- package/dist/{chunk-CW6AXOLR.js → chunk-SA7G6GJX.js} +2 -2
- package/dist/{chunk-Q4XEU3UH.js → chunk-SB53KPWA.js} +2 -2
- package/dist/{chunk-36JC5BG2.js → chunk-SUE7SHZL.js} +2 -2
- package/dist/{chunk-ZAFGY22Q.js → chunk-SZ4P7MF7.js} +2 -2
- package/dist/{chunk-BBP7HVBJ.js → chunk-T2M5HWBQ.js} +2 -2
- package/dist/{chunk-MHWMEZDA.js → chunk-TEMM2FEL.js} +2 -2
- package/dist/{chunk-JX6ZWDOS.js → chunk-TLTSESB4.js} +2 -2
- package/dist/{chunk-FOZ74V56.js → chunk-UIAUPFBJ.js} +2 -2
- package/dist/{chunk-PHNCEUXX.js → chunk-UJIXCI3L.js} +2 -2
- package/dist/{chunk-XMJ53WG4.js → chunk-UMEPSVKT.js} +2 -2
- package/dist/{chunk-GWYZVVKY.js → chunk-V4NGDIEA.js} +2 -2
- package/dist/{chunk-E52K4L2W.js → chunk-VSGOIZMQ.js} +2 -2
- package/dist/{chunk-Z6RL7XOE.js → chunk-W7QDASTN.js} +2 -2
- package/dist/{chunk-PTQPPPG2.js → chunk-WO6OFKUC.js} +2 -2
- package/dist/{chunk-C7OUW52M.js → chunk-XJBK3QDV.js} +2 -2
- package/dist/{chunk-FH5WG4LE.js → chunk-XUPFA6GH.js} +2 -2
- package/dist/{chunk-DAKIGMIK.js → chunk-YPBKBYPS.js} +2 -2
- package/dist/{chunk-ZQ62NNKN.js → chunk-Z66XYVLZ.js} +2 -2
- package/dist/{chunk-OFGOOL6U.js → chunk-ZMA5HWXY.js} +2 -2
- package/dist/{cli-program-UO7PZD6V.js → cli-program-SCHOHOQE.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/{code-viewer-VHLBLIUM.js → code-viewer-AMRXV444.js} +2 -2
- package/dist/{code-viewer-KIXEYQNJ.js → code-viewer-EXI5SFFR.js} +2 -2
- package/dist/{command-descriptors-F5P2V3NW.js → command-descriptors-H6A4UY72.js} +3 -3
- package/dist/{command-descriptors-YCLATF5I.js → command-descriptors-ROIOTCCW.js} +3 -3
- package/dist/direct-navigation-3JOYP2MO.js +3 -0
- package/dist/direct-navigation-SJMJLBY7.js +2 -0
- package/dist/index.js +1 -1
- package/dist/invocation-command-descriptors-GMZX3UAD.js +2 -0
- package/dist/invocation-command-descriptors-HNMKDEF6.js +3 -0
- package/dist/{output-continuation-command-BTETTXEC.js → output-continuation-command-5NWVDQT7.js} +2 -2
- package/dist/output-continuation-command-RNEHNYPU.js +3 -0
- package/dist/project-reindex-MIW5CYEG.js +3 -0
- package/dist/{project-reindex-CRJU3IFG.js → project-reindex-VQ23LWDA.js} +2 -2
- package/dist/queries/affected.js +1 -1
- package/dist/queries/anchors.js +1 -1
- package/dist/queries/bottlenecks.js +1 -1
- package/dist/queries/call-graph.js +1 -1
- package/dist/queries/change-surface.js +1 -1
- package/dist/queries/cleanup-plan.js +1 -1
- package/dist/queries/complexity-hotspots.js +1 -1
- package/dist/queries/complexity.js +1 -1
- package/dist/queries/context.js +1 -1
- package/dist/queries/convergence.js +1 -1
- package/dist/queries/dataflow.js +1 -1
- package/dist/queries/dead.js +1 -1
- package/dist/queries/decorative-checkers.js +1 -1
- package/dist/queries/dependence-slice.js +1 -1
- package/dist/queries/diff-impact.js +1 -1
- package/dist/queries/drift.js +1 -1
- package/dist/queries/entry-map.js +1 -1
- package/dist/queries/evidence.js +1 -1
- package/dist/queries/extract-candidates.js +1 -1
- package/dist/queries/health.js +1 -1
- package/dist/queries/hotspots.js +1 -1
- package/dist/queries/imports.js +1 -1
- package/dist/queries/incomplete-migration.js +1 -1
- package/dist/queries/index.js +1 -1
- package/dist/queries/isolated.js +1 -1
- package/dist/queries/locality-candidates.js +1 -1
- package/dist/queries/members.js +1 -1
- package/dist/queries/methods.js +1 -1
- package/dist/queries/not-implemented.js +1 -1
- package/dist/queries/passthrough-candidates.js +1 -1
- package/dist/queries/plan-context.js +1 -1
- package/dist/queries/recent-duplicates.js +1 -1
- package/dist/queries/redundant-reexports.js +1 -1
- package/dist/queries/reference-neighborhood.js +1 -1
- package/dist/queries/reference-reachability.js +1 -1
- package/dist/queries/refs.js +1 -1
- package/dist/queries/self-audit.js +1 -1
- package/dist/queries/similar-signatures.js +1 -1
- package/dist/queries/similar.js +1 -1
- package/dist/queries/slice.js +1 -1
- package/dist/queries/source-inspection.js +1 -1
- package/dist/queries/stale-abstractions.js +1 -1
- package/dist/queries/surface.js +1 -1
- package/dist/queries/system-map.js +1 -1
- package/dist/queries/trace.js +1 -1
- package/dist/queries/twin-ab.js +1 -1
- package/dist/queries/unused-imports.js +1 -1
- package/dist/queries/unused-params.js +1 -1
- package/dist/queries/value-flow.js +1 -1
- package/dist/queries/wrapper-candidates.js +1 -1
- package/dist/reindex-worker.js +1 -1
- package/dist/reindex.js +1 -1
- package/dist/runtime.js +1 -1
- package/dist/rust-semantic-session-server.js +1 -1
- package/dist/rust-semantic-session-worker.js +1 -1
- package/dist/rust-semantic-worker.js +1 -1
- package/dist/{sentinel-ensure-command-SPW7XQLB.js → sentinel-ensure-command-H66AZ3VE.js} +2 -2
- package/dist/sentinel-ensure-command-R4YAUCJB.js +3 -0
- package/dist/watch-server.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-6JMAVFL4.js +0 -3
- package/dist/chunk-6WAPPQ5F.js +0 -82
- package/dist/chunk-P4NVCOM7.js +0 -2
- package/dist/chunk-Z35GOVEH.js +0 -2
- package/dist/direct-navigation-4XJTXIDT.js +0 -2
- package/dist/direct-navigation-J5MVYYAD.js +0 -3
- package/dist/invocation-command-descriptors-RWV4VAI4.js +0 -2
- package/dist/invocation-command-descriptors-U76PN7IY.js +0 -3
- package/dist/output-continuation-command-BL25S26S.js +0 -3
- package/dist/project-reindex-TQFCOA2O.js +0 -3
- package/dist/sentinel-ensure-command-OSWGCFFL.js +0 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as de}from"./chunk-ZNH33XIB.js";import{a as me}from"./chunk-GDHWOA57.js";import{a as he}from"./chunk-BBP7HVBJ.js";import{a as ge}from"./chunk-6YTSKJJ3.js";import{a as fe}from"./chunk-2E6OUPCF.js";import{a as ce}from"./chunk-TNJGTQWO.js";import{a as le}from"./chunk-MZNMASFM.js";import{a as ue}from"./chunk-WWCV4E6J.js";import{a as ae}from"./chunk-KPZGTB2O.js";import{a as se}from"./chunk-WK2IQJPK.js";import{a as ne}from"./chunk-UQE4XFSA.js";import{a as pe}from"./chunk-3RSBGWGL.js";import{a as oe}from"./chunk-BFBIMTCJ.js";import{a as ie}from"./chunk-ZQ62NNKN.js";import{a as ee}from"./chunk-IZDPGOZR.js";import{b as re}from"./chunk-YRKP7PM7.js";import{a as te}from"./chunk-2OMXFE64.js";import{a as T,b as Y}from"./chunk-MHWMEZDA.js";import{b as Q}from"./chunk-OQUCBKOI.js";import{a as X}from"./chunk-CCIYWXX6.js";import{b as J}from"./chunk-JX6ZWDOS.js";import{f as Z}from"./chunk-36JC5BG2.js";import{b as K}from"./chunk-QDCCHMVZ.js";import{d as q,e as U}from"./chunk-J3GLP7Q5.js";import{f as M,h as A}from"./chunk-NDKOVQFG.js";import{a as j}from"./chunk-F74LZWCE.js";import{C as W,z as G}from"./chunk-ICUL7XRT.js";import{w as k}from"./chunk-7GAK2F3H.js";import{f as z,g as O}from"./chunk-SX72EVMY.js";import{readdirSync as Ye}from"fs";import{basename as Xe,join as Ce}from"path";function Qe(e,r,t={}){let i=new Set(e),o=new Set(r),n=[...o].filter(s=>!i.has(s)).sort(),a=t.allowExtra?[]:[...i].filter(s=>!o.has(s)).sort();return{missing:n,extra:a}}function Je(e,r){let t=Ze(e,r.file,r.keys);if(!t.ok)return{name:r.name,file:r.file,status:"unavailable",missing:[],extra:[],unavailableReason:t.reason};let i=nt(e.config.projectRoot,r.mustEqual),o=Qe(t.keys,i,{allowExtra:r.allowExtra??!1}),n=o.missing.length>0||o.extra.length>0?"violated":"ok";return{name:r.name,file:r.file,status:n,missing:o.missing,extra:o.extra}}function be(e,r){return r.map(t=>Je(e,t))}function Ze(e,r,t){return t.type==="markdown-list"?ot(e,r,t.marker):et(e,r,t)}function et(e,r,t){if(!k(e,r))return{ok:!1,reason:`file not found: ${r}`};let o=G(r);if(!o)return{ok:!1,reason:`unsupported file type for ${t.type} extraction: ${r}`};let n=W(e,r);if(!n)return{ok:!1,reason:`tree-sitter parser unavailable for ${o} (${r}) \u2014 contract skipped, not silently passed`,disclosedUnavailable:{language:o,reason:"parser-unavailable"}};let a=t.type==="object-literal-keys"?tt(n,t.identifier):it(n,t.identifier);return a===null?{ok:!1,reason:`no ${t.type==="object-literal-keys"?"object literal":"string array"} named "${t.identifier}" found in ${r}`}:{ok:!0,keys:a}}function Se(e){let r=e.childForFieldName("value");return r?r.type==="as_expression"||r.type==="satisfies_expression"?r.namedChild(0):r:null}function tt(e,r){for(let t of e.rootNode.descendantsOfType("variable_declarator")){if(t.childForFieldName("name")?.text!==r)continue;let o=Se(t);if(o?.type==="object")return rt(o)}return null}function rt(e){let r=new Set;for(let t of e.namedChildren)if(t.type==="pair"){let i=t.childForFieldName("key");i&&r.add(ye(i.text))}else t.type==="shorthand_property_identifier"&&r.add(t.text);return[...r].sort()}function it(e,r){for(let t of e.rootNode.descendantsOfType("variable_declarator")){if(t.childForFieldName("name")?.text!==r)continue;let o=Se(t);if(o?.type!=="array")continue;let n=new Set;for(let a of o.namedChildren)a.type==="string"&&n.add(ye(a.text));return[...n].sort()}return null}function ye(e){return e.length>=2&&(e[0]==="'"&&e.endsWith("'")||e[0]==='"'&&e.endsWith('"'))?e.slice(1,-1):e}function ot(e,r,t){let i=k(e,r);if(!i)return{ok:!1,reason:`file not found: ${r}`};let o=xe(i,t);return o===null?{ok:!1,reason:`no <!-- BEGIN GENERATED ${t} --> ... <!-- END GENERATED ${t} --> block in ${r}`}:{ok:!0,keys:we(o)}}function xe(e,r){let t=j(r),o=new RegExp(`<!--\\s*BEGIN GENERATED ${t}\\s*-->([\\s\\S]*?)<!--\\s*END GENERATED ${t}\\s*-->`).exec(e);return o?o[1]:null}function we(e){let r=new Set;for(let t of e.matchAll(/`([a-z][a-z0-9-]*)`/g))r.add(t[1]);for(let t of e.matchAll(/\[([a-z][a-z0-9-]*)\]\([^)]*\)/g))r.add(t[1]);return[...r].sort()}function nt(e,r){switch(r.type){case"top-level-dirs":return ve(Ce(e,r.path));case"file-glob":return[...new Set(K(e,r.pattern).map(t=>Xe(t)))].sort();case"registered-commands":return at(e);case"builtin-skills":return ve(Ce(e,"skills"))}}function ve(e){let r;try{r=Ye(e,{withFileTypes:!0})}catch{return[]}return r.filter(t=>t.isDirectory()&&!t.name.startsWith(".")).map(t=>t.name).sort()}function at(e){let r;try{r=z(e,"docs/COMMAND_REFERENCE.md",{maxBytes:8*1024*1024,inputKind:"generated command reference"})}catch(i){if(!O(i))throw i;return[]}let t=xe(r,"COMMAND REFERENCE");return t?we(t):[]}function g(e){return e.scoreCount??e.count}function B(e){let r=dt(e),{breakdown:t,pressure:i}=mt(e),o=Le(t,"risk"),n=Le(t,"hygiene"),a=st(e),s=[...e.warnings];e.complexity.coverage.semanticEvidence.excludedSymbolCount>0&&s.push(`Complexity scoring excluded ${e.complexity.coverage.semanticEvidence.excludedSymbolCount} symbol(s) with incomplete or unavailable compiler evidence.`);let l=e.evidenceCoverage.filter(d=>d.semanticEvidence.status!=="complete"&&d.semanticEvidence.status!=="disabled");return l.length>0&&s.push(`Compiler-resolved evidence was incomplete or unavailable in health phase(s): ${l.map(d=>d.phase).join(", ")}.`),{score:Math.min(o,n),riskScore:o,hygieneScore:n,scoreBreakdown:t,overview:{documents:e.statsResult.documents,symbols:e.statsResult.symbols,indexSizeBytes:e.statsResult.indexSizeBytes},findings:{deadSymbols:e.dead.count,deadLoc:e.dead.loc,isolatedSymbols:e.isolated.count,isolatedLoc:e.isolated.loc,cycles:e.realCycleCount,similarPairs:e.similarCount,duplicateBodyGroups:e.duplicateBodies.count,duplicateBodyLoc:e.duplicateBodies.loc,twinDriftGroups:e.twinDrift.count,twinDriftLoc:e.twinDrift.loc,reactComponentDuplicatePairs:e.reactComponentDuplicates.count,reactHookCandidatePairs:e.reactHookCandidates.count,reactHookCandidateScoreCount:g(e.reactHookCandidates),reactLargeComponentPressureFiles:e.reactLargeComponentPressure.count,vueComponentDuplicatePairs:e.vueComponentDuplicates.count,vueComposableCandidatePairs:e.vueComposableCandidates.count,vueComposableCandidateScoreCount:g(e.vueComposableCandidates),vueLargeViewPressureFiles:e.vueLargeViewPressure.count,extractionCandidates:e.extractCount,wrappers:e.wrappers.count,wrapperScoreCount:g(e.wrappers),passthroughs:e.passthroughs.count,staleTypes:e.stale.count,driftedFiles:e.drift.count,complexityHotspotCount:e.complexity.extremeCount,hiddenCouplingPairs:e.gitEvidence?.hiddenCoupling.pairCount??null,hiddenCouplingScoreCount:e.gitEvidence?.hiddenCoupling.scoreCount??null,coverageContractViolations:e.coverageContracts.count},axes:ct(e),validation:lt(e),suppressions:e.suppressions,actions:r,pressure:i,topComplexity:e.complexity.top,coverage:a,warnings:s.length>0?s:void 0}}function st(e){let r=e.complexity.coverage.semanticEvidence.status;return{status:e.evidenceCoverage.some(i=>i.semanticEvidence.status!=="complete"&&i.semanticEvidence.status!=="disabled")?"incomplete":r==="disabled"?"semantic-disabled":r==="complete"?"complete":"incomplete",complexity:e.complexity.coverage,phases:e.evidenceCoverage}}function ct(e){return{deletable:{loc:e.dead.loc+e.isolated.loc,symbols:e.dead.count+e.isolated.count},cycles:{count:e.realCycleCount},changeAmplification:e.gitEvidence?.amplification??null,hiddenCoupling:e.gitEvidence?.hiddenCoupling??null,churnWeightedComplexity:ut(e),evidenceQuality:{graphFindings:e.dead.count+e.isolated.count+e.realCycleCount,heuristicFindings:e.similarCount+e.duplicateBodies.count+e.twinDrift.count+e.reactComponentDuplicates.count+e.reactHookCandidates.count+e.reactLargeComponentPressure.count+e.vueComponentDuplicates.count+e.vueComposableCandidates.count+e.vueLargeViewPressure.count+e.extractCount+e.wrappers.count+e.passthroughs.count+e.stale.count+e.drift.count,userSuppressed:e.suppressions?.total??0}}}function ut(e){let r=e.gitEvidence?.fileStats;return r?e.complexity.top.map(t=>{let i=t.file?r[t.file]?.changes??0:0;return{...t,changes:i,weighted:h(t.score*Math.log2(1+i))}}).sort((t,i)=>i.weighted-t.weighted):null}function lt(e){let r=e.gitEvidence?.fileStats;if(!r)return null;let t={dead:e.dead.files??[],isolated:e.isolated.files??[],twinDrift:e.twinDrift.files??[],wrappers:e.wrappers.files??[],passthroughs:e.passthroughs.files??[],stale:e.stale.files??[],reactComponents:e.reactComponentDuplicates.files??[],reactHooks:e.reactHookCandidates.files??[],reactLargeComponents:e.reactLargeComponentPressure.files??[],vueComponents:e.vueComponentDuplicates.files??[],vueComposables:e.vueComposableCandidates.files??[],vueLargeViews:e.vueLargeViewPressure.files??[]},i=new Set(Object.values(t).flat()),o=0,n=0,a=0;for(let[b,f]of Object.entries(r))i.has(b)?o+=f.fixChanges:(n+=f.fixChanges,a+=1);let s=i.size>0?h(o/i.size):0,l=a>0?h(n/a):0,d={};for(let[b,f]of Object.entries(t)){let C=new Set(f);if(C.size===0)continue;let S=0;for(let D of C)S+=r[D]?.fixChanges??0;let x=h(S/C.size);d[b]={flaggedFiles:C.size,fixDensity:x,lift:l>0?h(x/l):null}}return{flaggedFiles:i.size,flaggedFixDensity:s,baselineFixDensity:l,ratio:i.size>0&&l>0?h(s/l):null,byCategory:d,validationBasis:{method:"subject-regex",commitsScanned:e.gitEvidence?.commitsScanned??0}}}function h(e){return Math.round(e*100)/100}function Ee(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/0+$/,"").replace(/\.$/,"")}function L(e,r="existing shared infrastructure discount"){let t=g(e);return Math.abs(t-e.count)<.01?"":` (${Ee(t)} score-weighted after ${r})`}function y(e,r){let t=g(e),i=`${e.count} ${r}`;return Math.abs(t-e.count)<.01?i:`${i} (${Ee(t)} score-weighted)`}function dt(e){let r=[];if(e.dead.count>0&&r.push({category:"Dead code",evidence:"graph-fact",description:`${e.dead.count} indexed symbols with no visible repository references \u2014 review runtime/framework roots and the capability disclosure, then verify any deletion with cleanup-plan --verify`,effort:"low",impact:"high",count:e.dead.count,locRecoverable:e.dead.loc}),e.isolated.count>0&&r.push({category:"Isolated symbols",evidence:"graph-fact",description:`${e.isolated.count} symbols completely disconnected from the codebase graph`,effort:"low",impact:"medium",count:e.isolated.count,locRecoverable:e.isolated.loc}),e.realCycleCount>0&&r.push({category:"Circular dependencies",evidence:"graph-fact",description:`${e.realCycleCount} indexed dependency cycle(s) \u2014 inspect ownership and runtime order before choosing whether or how to break them`,effort:"medium",impact:"high",count:e.realCycleCount,locRecoverable:0}),e.similarCount>0&&r.push({category:"Similar functions",evidence:"heuristic",description:`${e.similarCount} pairs share disclosed call or source-token evidence beyond imports \u2014 review domain identity before considering consolidation`,effort:"medium",impact:"medium",count:e.similarCount,locRecoverable:0}),e.duplicateBodies.count>0&&r.push({category:"Duplicate function bodies",evidence:"heuristic",description:`${e.duplicateBodies.count} exact small-body group(s) across files \u2014 consolidate only when the domain concept matches`,effort:"low",impact:"medium",count:e.duplicateBodies.count,locRecoverable:e.duplicateBodies.loc}),e.twinDrift.count>0&&r.push({category:"Drifted twin implementations",evidence:"heuristic",description:`${e.twinDrift.count} same-name (or near-name) function group(s) across files with diverged or identical bodies \u2014 determine whether they represent the same concept before acting`,effort:"medium",impact:"medium",count:e.twinDrift.count,locRecoverable:0}),e.reactComponentDuplicates.count>0&&r.push({category:"Duplicated React components",evidence:"heuristic",description:`${e.reactComponentDuplicates.count} React component pair(s) share JSX structure \u2014 review whether local product intent justifies reuse`,effort:"medium",impact:"medium",count:e.reactComponentDuplicates.count,locRecoverable:e.reactComponentDuplicates.loc}),e.reactHookCandidates.count>0&&r.push({category:"Duplicated React hook behavior",evidence:"heuristic",description:`${e.reactHookCandidates.count} React component pair(s) share state/effect/request behavior${L(e.reactHookCandidates)} \u2014 review whether a common hook would preserve ownership and lifecycle semantics`,effort:"medium",impact:"medium",count:e.reactHookCandidates.count,locRecoverable:e.reactHookCandidates.loc}),e.reactLargeComponentPressure.count>0&&r.push({category:"Large React components",evidence:"heuristic",description:`${e.reactLargeComponentPressure.count} React component(s) concentrate JSX/behavior pressure \u2014 split by reason to change`,effort:"medium",impact:"medium",count:e.reactLargeComponentPressure.count,locRecoverable:0}),e.vueComponentDuplicates.count>0&&r.push({category:"Duplicated Vue components",evidence:"heuristic",description:`${e.vueComponentDuplicates.count} Vue component pair(s) share template structure \u2014 review whether local product intent justifies reuse`,effort:"medium",impact:"medium",count:e.vueComponentDuplicates.count,locRecoverable:e.vueComponentDuplicates.loc}),e.vueComposableCandidates.count>0&&r.push({category:"Duplicated Vue behavior",evidence:"heuristic",description:`${e.vueComposableCandidates.count} Vue component pair(s) share state/effect/request behavior${L(e.vueComposableCandidates)} \u2014 review whether a common composable would preserve ownership and lifecycle semantics`,effort:"medium",impact:"medium",count:e.vueComposableCandidates.count,locRecoverable:e.vueComposableCandidates.loc}),e.vueLargeViewPressure.count>0&&r.push({category:"Large Vue views",evidence:"heuristic",description:`${e.vueLargeViewPressure.count} Vue file(s) concentrate template/script/style pressure \u2014 split by reason to change`,effort:"medium",impact:"medium",count:e.vueLargeViewPressure.count,locRecoverable:0}),e.extractCount>0&&r.push({category:"Extraction candidates",evidence:"heuristic",description:`${e.extractCount} large functions with isolated callee clusters \u2014 review same-file or feature-local extraction seams`,effort:"medium",impact:"medium",count:e.extractCount,locRecoverable:0}),e.wrappers.count>0&&r.push({category:"Wrapper functions",evidence:"heuristic",description:`${e.wrappers.count} single-consumer symbols${L(e.wrappers,"boundary-evidence discount")} \u2014 inspect whether each is indirection or an intentional API, framework, or ownership boundary`,effort:"low",impact:"low",count:e.wrappers.count,locRecoverable:e.wrappers.loc}),e.passthroughs.count>0&&r.push({category:"Passthrough functions",evidence:"heuristic",description:`${e.passthroughs.count} functions that literally forward to one callee \u2014 inspect whether each is unnecessary indirection or an intentional boundary`,effort:"low",impact:"low",count:e.passthroughs.count,locRecoverable:e.passthroughs.loc}),e.stale.count>0){let o=[];e.stale.unused>0&&o.push(`${e.stale.unused} unused`),e.stale.singleUse>0&&o.push(`${e.stale.singleUse} single-consumer (not in types file)`),r.push({category:"Stale abstractions",evidence:"heuristic",description:`${o.join(", ")} \u2014 review public, runtime-registration, and ownership evidence before removing, moving, or inlining`,effort:"low",impact:"medium",count:e.stale.count,locRecoverable:e.stale.loc})}if(e.drift.count>0){let o=[];e.drift.unusedImports>0&&o.push(`${e.drift.unusedImports} unused imports`),e.drift.architectureViolations>0&&o.push(`${e.drift.architectureViolations} declared architecture violations`),r.push({category:"Structural drift",evidence:"heuristic",description:`${o.join(", ")} \u2014 repair direct dependency-rule breaks; inspect boundary signals with \`drift --architecture\``,effort:e.drift.architectureViolations>0?"medium":"low",impact:e.drift.architectureViolations>0?"medium":"low",count:e.drift.count,locRecoverable:0})}if(e.coverageContracts.count>0&&r.push({category:"Coverage contract drift",evidence:"graph-fact",description:`${e.coverageContracts.count} configured coverage contract(s) drifted from their ground-truth source (enumeration rot) \u2014 run \`codebaseiq health --json\` for the missing/extra keys`,effort:"low",impact:"medium",count:e.coverageContracts.count,locRecoverable:0}),e.gitEvidence&&e.gitEvidence.hiddenCoupling.pairCount>0){let o=e.gitEvidence.hiddenCoupling.top[0];r.push({category:"Hidden coupling",evidence:"change-graph",description:`${e.gitEvidence.hiddenCoupling.pairCount} file pair(s) co-change without a structural link`+L({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:e.gitEvidence.hiddenCoupling.scoreCount},"broad/stale-history discount")+(o?` (e.g. ${o.fileA} \u2194 ${o.fileB})`:"")+" \u2014 inspect whether a shared concept, generated artifact, or coordinated contract explains the history",effort:"medium",impact:"high",count:e.gitEvidence.hiddenCoupling.pairCount,locRecoverable:0})}let t={high:3,medium:2,low:1},i={low:3,medium:2,high:1};return r.sort((o,n)=>{let a=t[o.impact]*i[o.effort];return t[n.impact]*i[n.effort]-a}),r}var He={"dead-code":"risk",isolated:"risk",cycles:"risk",complexity:"risk","hidden-coupling":"risk","cycles-pressure":"risk","complexity-pressure":"risk","hidden-coupling-pressure":"risk",similar:"hygiene","duplicate-bodies":"hygiene","twin-drift":"hygiene","react-component-duplicates":"hygiene","react-hook-candidates":"hygiene","react-large-component-pressure":"hygiene","vue-component-duplicates":"hygiene","vue-composable-candidates":"hygiene","vue-large-view-pressure":"hygiene",extract:"hygiene",wrappers:"hygiene",passthroughs:"hygiene","stale-abstractions":"hygiene",drift:"hygiene","similar-pressure":"hygiene","duplicate-bodies-pressure":"hygiene","twin-drift-pressure":"hygiene","react-component-duplicates-pressure":"hygiene","react-hook-candidates-pressure":"hygiene","react-large-component-pressure-pressure":"hygiene","vue-component-duplicates-pressure":"hygiene","vue-composable-candidates-pressure":"hygiene","vue-large-view-pressure-pressure":"hygiene","extract-pressure":"hygiene","wrappers-pressure":"hygiene","passthroughs-pressure":"hygiene","stale-abstractions-pressure":"hygiene","drift-pressure":"hygiene"};function Le(e,r){let t=e.filter(i=>i.kind===r).reduce((i,o)=>i+o.points,0);return Math.max(0,Math.min(100,100-t))}function mt(e){let r=Math.max(e.statsResult.documents,1),t=Math.max(e.statsResult.symbols,1),i=[],o=[],n=(m,w,v)=>{w>0&&i.push({axis:m,points:w,detail:v,kind:He[m]??"hygiene"})},a=(m,w,v,Ge,We,qe,Ue)=>{let H=Math.max(Ge,1);if(v<=H)return;let P=v/H,R=Math.min(We,Math.ceil(Math.log2(P)*qe));if(R<=0)return;let Ke=He[m]??"hygiene";o.push({axis:m,category:w,kind:Ke,count:v,threshold:h(H),ratio:h(P),extraPenalty:R}),n(m,R,`${v} ${Ue} exceed pressure threshold ${h(H)} (${h(P)}x)`)},s=e.dead.count/t;n("dead-code",Math.min(20,Math.round(s*200)),`${e.dead.count} dead symbols (${e.dead.loc} LOC deletable)`);let l=e.isolated.count/t;n("isolated",Math.min(10,Math.round(l*200)),`${e.isolated.count} isolated symbols (${e.isolated.loc} LOC deletable)`),n("cycles",Math.min(15,e.realCycleCount*5),`${e.realCycleCount} real dependency cycle(s)`);let d=e.similarCount/t*1e3;n("similar",Math.min(10,Math.round(d)),`${e.similarCount} similar function pair(s)`);let b=e.duplicateBodies.count/t*1e3;n("duplicate-bodies",Math.min(10,Math.round(b*2)),`${e.duplicateBodies.count} exact duplicate small-body group(s) (${e.duplicateBodies.loc} duplicate LOC)`);let f=e.twinDrift.count/t*1e3;n("twin-drift",Math.min(10,Math.round(f*2)),`${e.twinDrift.count} drifted twin implementation group(s) (same or near-same name, diverged or identical bodies)`);let C=e.reactComponentDuplicates.count/r*1e3;n("react-component-duplicates",Math.min(10,Math.round(C)),`${e.reactComponentDuplicates.count} duplicated React component pair(s)`);let S=g(e.reactHookCandidates),x=S/r*1e3;n("react-hook-candidates",Math.min(10,Math.round(x)),y(e.reactHookCandidates,"duplicated React behavior pair(s)"));let D=e.reactLargeComponentPressure.count/r*1e3;n("react-large-component-pressure",Math.min(5,Math.round(D/2)),`${e.reactLargeComponentPressure.count} large React component pressure file(s)`);let Ie=e.vueComponentDuplicates.count/r*1e3;n("vue-component-duplicates",Math.min(10,Math.round(Ie)),`${e.vueComponentDuplicates.count} duplicated Vue component pair(s)`);let _=g(e.vueComposableCandidates),ze=_/r*1e3;n("vue-composable-candidates",Math.min(10,Math.round(ze)),y(e.vueComposableCandidates,"duplicated Vue behavior pair(s)"));let Oe=e.vueLargeViewPressure.count/r*1e3;n("vue-large-view-pressure",Math.min(5,Math.round(Oe/2)),`${e.vueLargeViewPressure.count} large Vue view pressure file(s)`);let F=g(e.wrappers);n("wrappers",Math.min(3,F),y(e.wrappers,"wrapper candidate(s)"));let I=g(e.passthroughs);n("passthroughs",Math.min(3,I),y(e.passthroughs,"passthrough candidate(s)")),n("stale-abstractions",Math.min(8,e.stale.unused),`${e.stale.unused} unused stale abstraction(s); ${e.stale.singleUse} single-consumer signal(s)`);let je=e.drift.direct/r;if(n("drift",Math.min(5,Math.round(je*50)),`${e.drift.direct} direct drift finding(s); ${e.drift.signal} signal drift finding(s)`),n("complexity",Math.min(5,e.complexity.extremeCount*2),`${e.complexity.extremeCount} extreme complexity hotspot(s)`),e.gitEvidence){let m=e.gitEvidence.hiddenCoupling.scoreCount;n("hidden-coupling",Math.min(5,Math.ceil(m/10)),y({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:m},"co-changing pair(s) without a structural link"))}if(a("cycles-pressure","Circular dependencies",e.realCycleCount,3,10,3,"cycle(s)"),a("complexity-pressure","Extreme complexity",e.complexity.extremeCount,3,5,2,"extreme complexity hotspot(s)"),e.gitEvidence){let m=e.gitEvidence.hiddenCoupling.scoreCount;a("hidden-coupling-pressure","Hidden coupling",m,50,10,4,"score-weighted co-changing pair(s)")}return a("similar-pressure","Similar functions",e.similarCount,Math.max(50,t*.01),8,4,"similar function pair(s)"),a("duplicate-bodies-pressure","Duplicate function bodies",e.duplicateBodies.count,Math.max(20,t*.005),8,4,"exact duplicate small-body group(s)"),a("twin-drift-pressure","Drifted twin implementations",e.twinDrift.count,Math.max(20,t*.005),8,4,"drifted twin implementation group(s)"),a("react-component-duplicates-pressure","Duplicated React components",e.reactComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated React component pair(s)"),a("react-hook-candidates-pressure","Duplicated React hook behavior",S,Math.max(10,r*.01),8,4,"duplicated React behavior pair(s)"),a("react-large-component-pressure-pressure","Large React components",e.reactLargeComponentPressure.count,Math.max(10,r*.01),4,2,"large React component pressure file(s)"),a("vue-component-duplicates-pressure","Duplicated Vue components",e.vueComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated Vue component pair(s)"),a("vue-composable-candidates-pressure","Duplicated Vue behavior",_,Math.max(10,r*.01),8,4,"duplicated Vue behavior pair(s)"),a("vue-large-view-pressure-pressure","Large Vue views",e.vueLargeViewPressure.count,Math.max(10,r*.01),4,2,"large Vue view pressure file(s)"),a("extract-pressure","Extraction candidates",e.extractCount,Math.max(50,t*.01),4,2,"extraction candidate(s)"),a("wrappers-pressure","Wrapper functions",F,50,4,2,"wrapper candidate(s)"),a("passthroughs-pressure","Passthrough functions",I,50,4,2,"passthrough candidate(s)"),a("stale-abstractions-pressure","Single-consumer stale abstraction signals",e.stale.singleUse,Math.max(50,t*.02),4,2,"single-consumer stale abstraction signal(s)"),a("drift-pressure","Structural drift signals",e.drift.signal,Math.max(10,r*.1),4,2,"signal drift finding(s)"),{breakdown:i,pressure:o}}var p={dead:{minLoc:3,skipBarrels:!0,deadCodeOnly:!0},isolated:{minLoc:3},similar:{minSimilarity:.6,limit:50,minCallees:4},duplicateBodies:{maxLoc:15,limit:50},extract:{minLoc:15,minCallees:5,limit:50},wrappers:{maxLoc:15,limit:50},passthroughs:{maxLoc:15,limit:50},stale:{minLoc:3,limit:50},drift:{},twinDrift:{minSimilarity:.3}};import{getHeapStatistics as pt}from"v8";var ht=64*1024*1024;function $(){let e=globalThis.gc;if(!e)return;let r=pt();r.heap_size_limit-r.used_heap_size<ht||e()}var gt=50,ft=25e3,Ct=2500,De=2500,Pe=50,vt=10,bt=["overview","dead","isolated","cycles","similar","duplicate-bodies","twin-drift","react-component-duplicates","react-hook-candidates","react-large-component-pressure","vue-component-duplicates","vue-composable-candidates","vue-large-view-pressure","extract-candidates","wrapper-candidates","passthrough-candidates","stale-abstractions","drift","complexity-hotspots","git-evidence","suppressions","coverage-contracts"],St={overview:(e,r,t,i)=>({phase:"overview",statsResult:i,warnings:t.warnings}),dead:(e,r,t)=>({phase:"dead",dead:wt(e,r,t)}),isolated:(e,r,t)=>({phase:"isolated",isolated:Ht(e,r,t)}),cycles:(e,r,t)=>({phase:"cycles",realCycleCount:Lt(e,r,t)}),similar:(e,r,t)=>({phase:"similar",similarCount:Et(e,r,t)}),"duplicate-bodies":(e,r,t)=>({phase:"duplicate-bodies",duplicateBodies:Pt(e,r,t)}),"twin-drift":(e,r,t)=>({phase:"twin-drift",twinDrift:Rt(e,r,t)}),"react-component-duplicates":(e,r,t)=>({phase:"react-component-duplicates",reactComponentDuplicates:kt(e,r,t)}),"react-hook-candidates":(e,r,t)=>({phase:"react-hook-candidates",reactHookCandidates:Mt(e,r,t)}),"react-large-component-pressure":(e,r,t)=>({phase:"react-large-component-pressure",reactLargeComponentPressure:At(e,r,t)}),"vue-component-duplicates":(e,r,t)=>({phase:"vue-component-duplicates",vueComponentDuplicates:Tt(e,r,t)}),"vue-composable-candidates":(e,r,t)=>({phase:"vue-composable-candidates",vueComposableCandidates:Bt(e,r,t)}),"vue-large-view-pressure":(e,r,t)=>({phase:"vue-large-view-pressure",vueLargeViewPressure:$t(e,r,t)}),"extract-candidates":(e,r,t)=>({phase:"extract-candidates",extractCount:Dt(e,r,t)}),"wrapper-candidates":(e,r,t)=>({phase:"wrapper-candidates",wrappers:Vt(e,r,t)}),"passthrough-candidates":(e,r,t)=>({phase:"passthrough-candidates",passthroughs:Nt(e,r,t)}),"stale-abstractions":(e,r,t)=>({phase:"stale-abstractions",stale:_t(e,r,t)}),drift:(e,r,t)=>({phase:"drift",drift:Ot(e,r,t)}),"complexity-hotspots":(e,r,t)=>({phase:"complexity-hotspots",complexity:jt(e,r,t)}),"git-evidence":(e,r,t)=>({phase:"git-evidence",gitEvidence:Ft(e,t)}),suppressions:(e,r,t)=>({phase:"suppressions",suppressions:It(e,t)}),"coverage-contracts":(e,r,t)=>({phase:"coverage-contracts",coverageContracts:zt(e,t)})};function Or(e,r={}){return Me(e,r.full!==!1,(t,i)=>{let o=xt(e,r.scope,t,i);return B(o)})}function jr(e,r,t={}){return yt(e,[r],t)[0]}function yt(e,r,t={}){return Me(e,t.full!==!1,(i,o)=>{let n={...o,releaseCachesBetweenPhases:!1};return r.map(a=>Te(e,a,t.scope,n,i))})}function Me(e,r,t){let i=ge(e),o=Gt(i,r);try{return t(i,o)}finally{T(e,{semanticProvider:!0}),$()}}function Gr(e){return B(Ae(e))}function Ae(e){let r=u(e,"overview");return{statsResult:r.statsResult,warnings:r.warnings,evidenceCoverage:e.map(i=>({phase:i.phase,semanticEvidence:i.evidenceCoverage})),dead:u(e,"dead").dead,isolated:u(e,"isolated").isolated,realCycleCount:u(e,"cycles").realCycleCount,similarCount:u(e,"similar").similarCount,duplicateBodies:u(e,"duplicate-bodies").duplicateBodies,twinDrift:u(e,"twin-drift").twinDrift,reactComponentDuplicates:u(e,"react-component-duplicates").reactComponentDuplicates,reactHookCandidates:u(e,"react-hook-candidates").reactHookCandidates,reactLargeComponentPressure:u(e,"react-large-component-pressure").reactLargeComponentPressure,vueComponentDuplicates:u(e,"vue-component-duplicates").vueComponentDuplicates,vueComposableCandidates:u(e,"vue-composable-candidates").vueComposableCandidates,vueLargeViewPressure:u(e,"vue-large-view-pressure").vueLargeViewPressure,extractCount:u(e,"extract-candidates").extractCount,wrappers:u(e,"wrapper-candidates").wrappers,passthroughs:u(e,"passthrough-candidates").passthroughs,stale:u(e,"stale-abstractions").stale,drift:u(e,"drift").drift,complexity:u(e,"complexity-hotspots").complexity,gitEvidence:Re(e,"git-evidence")?.gitEvidence??null,suppressions:Re(e,"suppressions")?.suppressions??null,coverageContracts:u(e,"coverage-contracts").coverageContracts}}function Re(e,r){return e.find(t=>t.phase===r)}function u(e,r){let t=e.find(i=>i.phase===r);if(!t)throw new Error(`Missing health phase result: ${r}`);return t}function xt(e,r,t,i){return Ae(bt.map(o=>Te(e,o,r,i,t)))}function Te(e,r,t,i,o){q(e);let n=St[r](e,t,i,o),a=U(e),s=a.incompleteSymbolIds.size,l=a.unavailableSymbolIds.size,d=i.semantic?s>0&&l>0?"incomplete-and-unavailable":s>0?"incomplete":l>0?"unavailable":"complete":"disabled";return{...n,evidenceCoverage:{enabled:i.semantic,status:d,incompleteSymbolCount:s,unavailableSymbolCount:l}}}function wt(e,r,t){return c(e,t,"dead",()=>{let i=Y(e,{scope:r,...p.dead,scanLimit:t.candidateScanLimit,semantic:t.semantic});return E(Ut(e,i.symbols))})}function Ht(e,r,t){return c(e,t,"isolated",()=>{let i=ne(e,{scope:r,...p.isolated,scanLimit:t.candidateScanLimit,semantic:t.semantic});return E(Kt(e,i))})}function Lt(e,r,t){return c(e,t,"cycles",()=>ee(e,{scope:r}).filter(o=>o.kind==="real").length)}function Et(e,r,t){let i=c(e,t,"similar",()=>Z(e,{scope:r,...p.similar,scanLimit:t.candidateScanLimit,semantic:t.semantic}));return Math.min(i,t.candidateResultLimit)}function Dt(e,r,t){return c(e,t,"extract-candidates",()=>oe(e,{scope:r,...p.extract,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic}).length)}function Pt(e,r,t){return c(e,t,"duplicate-bodies",()=>{let i=te(e,{scope:r,...p.duplicateBodies,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}),o=new Set,n=0;for(let a of i)for(let s of a.functions.slice(1))o.add(s.file),n+=s.loc;return{count:i.length,loc:n,files:[...o]}})}function Rt(e,r,t){return c(e,t,"twin-drift",()=>{let i=re(e,{scope:r,...p.twinDrift,scanLimit:t.candidateScanLimit}).filter(a=>a.relationship==="divergent"||a.relationship==="identical"),o=new Set,n=0;for(let a of i)for(let s of a.members)o.add(s.file),n+=s.loc;return{count:i.length,loc:n,files:[...o].sort()}})}function kt(e,r,t){return c(e,t,"react-component-duplicates",()=>{let i=ae(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return V(i)})}function Mt(e,r,t){return c(e,t,"react-hook-candidates",()=>{let i=se(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return $e(i,Xt)})}function At(e,r,t){return c(e,t,"react-large-component-pressure",()=>{let i=ce(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return Yt(i)})}function Tt(e,r,t){return c(e,t,"vue-component-duplicates",()=>{let i=ue(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return V(i)})}function Bt(e,r,t){return c(e,t,"vue-composable-candidates",()=>{let i=le(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return $e(i,Qt)})}function $t(e,r,t){return c(e,t,"vue-large-view-pressure",()=>{let i=de(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return E(i)})}function Vt(e,r,t){return c(e,t,"wrapper-candidates",()=>{let i=me(e,{scope:r,...p.wrappers,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return Be(i,Jt)})}function Nt(e,r,t){return c(e,t,"passthrough-candidates",()=>{let i=pe(e,{scope:r,...p.passthroughs,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return Be(i,Zt)})}function _t(e,r,t){return c(e,t,"stale-abstractions",()=>{let i=he(e,{scope:r,...p.stale,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic}),o=i.filter(n=>n.consumers===0).length;return{count:i.length,loc:i.reduce((n,a)=>n+a.loc,0),files:[...new Set(i.map(n=>n.file))],unused:o,singleUse:i.length-o}})}function Ft(e,r){return c(e,r,"git-evidence",()=>{let t=X(e,{historyMode:r.gitHistoryMode}),i=t.fileChurn();if(!i)return null;let o=t.commitHistory(),n=Q(e,void 0,{limit:r.candidateResultLimit,historyMode:r.gitHistoryMode}),a={};for(let[s,l]of i)a[s]={changes:l.changes,fixChanges:l.fixChanges};return{amplification:t.changeAmplification(),hiddenCoupling:{pairCount:n.findings.length,scoreCount:N(n.findings.reduce((s,l)=>s+ke(l),0)),top:n.findings.slice(0,5).map(s=>({fileA:s.fileA,fileB:s.fileB,together:s.together,confidence:s.confidence,focusedTogether:s.focusedTogether,broadTogether:s.broadTogether,broadCommitRatio:s.broadCommitRatio,lastTogetherAt:s.lastTogetherAt,recentTogether:s.recentTogether,commitScope:s.commitScope,recency:s.recency,scoreWeight:ke(s),subjectContext:s.subjectContext}))},fileStats:a,commitsScanned:o?.commits.length??0}})}function It(e,r){return c(e,r,"suppressions",()=>{let t=fe(e);return{total:t.total,byCategory:{...t.byCategory}}})}function zt(e,r){return c(e,r,"coverage-contracts",()=>{let t=e.config.coverageContracts??[],o=be(e,t).filter(n=>n.status!=="ok");return{count:o.length,loc:0,files:[...new Set(o.map(n=>n.file))].sort()}})}function Ot(e,r,t){return c(e,t,"drift",()=>{let i=ie(e,{scope:r,...p.drift,includePatternDeviations:!1,limit:Number.POSITIVE_INFINITY,semantic:t.semantic}),o=i.results.filter(s=>s.kind!=="pattern-deviation"),n=o.filter(s=>s.actionTier==="direct").length,a=o.length-n;return{count:o.length,unusedImports:i.unusedImports,architectureViolations:i.architectureViolations,layerViolations:i.layerViolations,direct:n,signal:a}})}function jt(e,r,t){return c(e,t,"complexity-hotspots",()=>{let i=J(e,{scope:r,minLoc:10,limit:t.complexityResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return{top:i.rows.slice(0,5).map(o=>({symbol:o.shortName,score:o.score,file:o.file})),extremeCount:i.rows.filter(o=>o.score>gt).length,coverage:i.coverage}})}function Gt(e,r){let t=e.symbols>=ft||e.documents>=Ct,i=r?Number.POSITIVE_INFINITY:Pe,o=r?Number.POSITIVE_INFINITY:vt;return!t||r?{candidateScanLimit:void 0,candidateResultLimit:i,complexityResultLimit:o,semantic:!0,gitHistoryMode:r?"full":"bounded",releaseCachesBetweenPhases:!0,warnings:r&&t?["Large index detected; running health without candidate scan or result caps because full mode is enabled."]:[]}:{candidateScanLimit:De,candidateResultLimit:i,complexityResultLimit:o,semantic:!1,gitHistoryMode:"bounded",releaseCachesBetweenPhases:!0,warnings:[`Large index detected; candidate-style health checks scanned their highest-priority ${De} symbols and reported their top ${Pe} findings. Enable full mode for unbounded candidate counts.`]}}function Wt(e,r){r.releaseCachesBetweenPhases&&(T(e),$())}function c(e,r,t,i){qt(t);try{return i()}finally{Wt(e,r)}}function qt(e){process.env.CODEBASEIQ_HEALTH_TRACE==="1"&&console.error(`[health] ${e}`)}function Ut(e,r){return r.filter(t=>!M(e,t.relativePath)&&!A(e,t.symbol,t.relativePath)&&t.kind==="dead-code")}function Kt(e,r){return r.filter(t=>!M(e,t.relativePath)&&!A(e,t.symbol,t.relativePath))}function E(e){let r=new Set;for(let t of e){let i=t.relativePath??t.file;i&&r.add(i)}return{count:e.length,loc:e.reduce((t,i)=>t+i.loc,0),files:[...r]}}function Be(e,r){return{...E(e),scoreCount:N(e.reduce((i,o)=>i+r(o),0))}}function Yt(e){let r=new Map;for(let t of e)r.set(t.file,Math.max(r.get(t.file)??0,t.loc));return{count:r.size,loc:[...r.values()].reduce((t,i)=>t+i,0),files:[...r.keys()]}}function V(e){let r=new Map;for(let t of e)r.set(t.fileA,Math.max(r.get(t.fileA)??0,t.locA)),r.set(t.fileB,Math.max(r.get(t.fileB)??0,t.locB));return{count:e.length,loc:[...r.values()].reduce((t,i)=>t+i,0),files:[...r.keys()]}}function $e(e,r){return{...V(e),scoreCount:N(e.reduce((i,o)=>i+r(o),0))}}function Xt(e){let r=e.sharedHooks.length>0,t=Ve({namedState:e.sharedState,requests:e.sharedRequests,lifecycle:e.sharedEffects,functions:e.sharedHandlers});return r&&t<=2?0:r?.5:Ne(e.sharedState,e.sharedHandlers,e.sharedHandlerVerbs)?.25:t>=2?1:.5}function Qt(e){let r=e.sharedComposables.length+e.sharedStores.length>0,t=Ve({namedState:e.sharedBindings,requests:e.sharedRequests,lifecycle:e.sharedLifecycle,functions:e.sharedFunctions});return r&&t<=2?0:r?.5:Ne(e.sharedBindings,e.sharedFunctions,e.sharedFunctionVerbs)?.25:t>=2?1:.5}function Ve(e){return e.requests.length*2+e.lifecycle.length+e.namedState.filter(r=>!Fe.has(_e(r))).length+Math.min(e.functions.length,3)}function Ne(e,r,t){let i=[...e,...r,...t].map(_e);return i.length>0&&i.every(o=>Fe.has(o))}function _e(e){return e.replace(/^handle/,"").replace(/^is/,"").replace(/^has/,"").toLowerCase()}function Jt(e){return e.actionTier==="signal"?.25:1}function Zt(e){return e.actionTier==="signal"?.25:1}function ke(e){return e.commitScope==="broad-sweep"?e.recency==="recent"?.25:0:e.commitScope==="mixed"?e.recency==="recent"?.5:.25:e.recency==="recent"?1:.5}function N(e){return Math.round(e*100)/100}var Fe=new Set(["add","apply","cancel","change","clear","close","create","delete","draft","edit","error","filter","form","load","loading","name","open","refresh","remove","reset","save","saving","search","select","selected","submit","toggle","update","value"]);export{p as a,bt as b,Or as c,jr as d,yt as e,Gr as f};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as de}from"./chunk-ZNH33XIB.js";import{a as me}from"./chunk-2Z7K66D7.js";import{a as he}from"./chunk-T2M5HWBQ.js";import{a as ge}from"./chunk-6YTSKJJ3.js";import{a as fe}from"./chunk-2E6OUPCF.js";import{a as ce}from"./chunk-TNJGTQWO.js";import{a as le}from"./chunk-MZNMASFM.js";import{a as ue}from"./chunk-WWCV4E6J.js";import{a as ae}from"./chunk-KPZGTB2O.js";import{a as se}from"./chunk-WK2IQJPK.js";import{a as ne}from"./chunk-RIO3JXHM.js";import{a as pe}from"./chunk-DECN422G.js";import{a as oe}from"./chunk-2XBJRZEM.js";import{a as ie}from"./chunk-Z66XYVLZ.js";import{a as ee}from"./chunk-IZDPGOZR.js";import{b as re}from"./chunk-YRKP7PM7.js";import{a as te}from"./chunk-2OMXFE64.js";import{a as T,b as Y}from"./chunk-TEMM2FEL.js";import{b as Q}from"./chunk-OQUCBKOI.js";import{a as X}from"./chunk-CCIYWXX6.js";import{b as J}from"./chunk-TLTSESB4.js";import{f as Z}from"./chunk-SUE7SHZL.js";import{b as K}from"./chunk-QDCCHMVZ.js";import{d as q,e as U}from"./chunk-KLX6NSWT.js";import{f as M,h as A}from"./chunk-NDKOVQFG.js";import{a as j}from"./chunk-F74LZWCE.js";import{C as W,z as G}from"./chunk-ICUL7XRT.js";import{w as k}from"./chunk-7GAK2F3H.js";import{f as z,g as O}from"./chunk-SX72EVMY.js";import{readdirSync as Ye}from"fs";import{basename as Xe,join as Ce}from"path";function Qe(e,r,t={}){let i=new Set(e),o=new Set(r),n=[...o].filter(s=>!i.has(s)).sort(),a=t.allowExtra?[]:[...i].filter(s=>!o.has(s)).sort();return{missing:n,extra:a}}function Je(e,r){let t=Ze(e,r.file,r.keys);if(!t.ok)return{name:r.name,file:r.file,status:"unavailable",missing:[],extra:[],unavailableReason:t.reason};let i=nt(e.config.projectRoot,r.mustEqual),o=Qe(t.keys,i,{allowExtra:r.allowExtra??!1}),n=o.missing.length>0||o.extra.length>0?"violated":"ok";return{name:r.name,file:r.file,status:n,missing:o.missing,extra:o.extra}}function be(e,r){return r.map(t=>Je(e,t))}function Ze(e,r,t){return t.type==="markdown-list"?ot(e,r,t.marker):et(e,r,t)}function et(e,r,t){if(!k(e,r))return{ok:!1,reason:`file not found: ${r}`};let o=G(r);if(!o)return{ok:!1,reason:`unsupported file type for ${t.type} extraction: ${r}`};let n=W(e,r);if(!n)return{ok:!1,reason:`tree-sitter parser unavailable for ${o} (${r}) \u2014 contract skipped, not silently passed`,disclosedUnavailable:{language:o,reason:"parser-unavailable"}};let a=t.type==="object-literal-keys"?tt(n,t.identifier):it(n,t.identifier);return a===null?{ok:!1,reason:`no ${t.type==="object-literal-keys"?"object literal":"string array"} named "${t.identifier}" found in ${r}`}:{ok:!0,keys:a}}function Se(e){let r=e.childForFieldName("value");return r?r.type==="as_expression"||r.type==="satisfies_expression"?r.namedChild(0):r:null}function tt(e,r){for(let t of e.rootNode.descendantsOfType("variable_declarator")){if(t.childForFieldName("name")?.text!==r)continue;let o=Se(t);if(o?.type==="object")return rt(o)}return null}function rt(e){let r=new Set;for(let t of e.namedChildren)if(t.type==="pair"){let i=t.childForFieldName("key");i&&r.add(ye(i.text))}else t.type==="shorthand_property_identifier"&&r.add(t.text);return[...r].sort()}function it(e,r){for(let t of e.rootNode.descendantsOfType("variable_declarator")){if(t.childForFieldName("name")?.text!==r)continue;let o=Se(t);if(o?.type!=="array")continue;let n=new Set;for(let a of o.namedChildren)a.type==="string"&&n.add(ye(a.text));return[...n].sort()}return null}function ye(e){return e.length>=2&&(e[0]==="'"&&e.endsWith("'")||e[0]==='"'&&e.endsWith('"'))?e.slice(1,-1):e}function ot(e,r,t){let i=k(e,r);if(!i)return{ok:!1,reason:`file not found: ${r}`};let o=xe(i,t);return o===null?{ok:!1,reason:`no <!-- BEGIN GENERATED ${t} --> ... <!-- END GENERATED ${t} --> block in ${r}`}:{ok:!0,keys:we(o)}}function xe(e,r){let t=j(r),o=new RegExp(`<!--\\s*BEGIN GENERATED ${t}\\s*-->([\\s\\S]*?)<!--\\s*END GENERATED ${t}\\s*-->`).exec(e);return o?o[1]:null}function we(e){let r=new Set;for(let t of e.matchAll(/`([a-z][a-z0-9-]*)`/g))r.add(t[1]);for(let t of e.matchAll(/\[([a-z][a-z0-9-]*)\]\([^)]*\)/g))r.add(t[1]);return[...r].sort()}function nt(e,r){switch(r.type){case"top-level-dirs":return ve(Ce(e,r.path));case"file-glob":return[...new Set(K(e,r.pattern).map(t=>Xe(t)))].sort();case"registered-commands":return at(e);case"builtin-skills":return ve(Ce(e,"skills"))}}function ve(e){let r;try{r=Ye(e,{withFileTypes:!0})}catch{return[]}return r.filter(t=>t.isDirectory()&&!t.name.startsWith(".")).map(t=>t.name).sort()}function at(e){let r;try{r=z(e,"docs/COMMAND_REFERENCE.md",{maxBytes:8*1024*1024,inputKind:"generated command reference"})}catch(i){if(!O(i))throw i;return[]}let t=xe(r,"COMMAND REFERENCE");return t?we(t):[]}function g(e){return e.scoreCount??e.count}function B(e){let r=dt(e),{breakdown:t,pressure:i}=mt(e),o=Le(t,"risk"),n=Le(t,"hygiene"),a=st(e),s=[...e.warnings];e.complexity.coverage.semanticEvidence.excludedSymbolCount>0&&s.push(`Complexity scoring excluded ${e.complexity.coverage.semanticEvidence.excludedSymbolCount} symbol(s) with incomplete or unavailable compiler evidence.`);let l=e.evidenceCoverage.filter(d=>d.semanticEvidence.status!=="complete"&&d.semanticEvidence.status!=="disabled");return l.length>0&&s.push(`Compiler-resolved evidence was incomplete or unavailable in health phase(s): ${l.map(d=>d.phase).join(", ")}.`),{score:Math.min(o,n),riskScore:o,hygieneScore:n,scoreBreakdown:t,overview:{documents:e.statsResult.documents,symbols:e.statsResult.symbols,indexSizeBytes:e.statsResult.indexSizeBytes},findings:{deadSymbols:e.dead.count,deadLoc:e.dead.loc,isolatedSymbols:e.isolated.count,isolatedLoc:e.isolated.loc,cycles:e.realCycleCount,similarPairs:e.similarCount,duplicateBodyGroups:e.duplicateBodies.count,duplicateBodyLoc:e.duplicateBodies.loc,twinDriftGroups:e.twinDrift.count,twinDriftLoc:e.twinDrift.loc,reactComponentDuplicatePairs:e.reactComponentDuplicates.count,reactHookCandidatePairs:e.reactHookCandidates.count,reactHookCandidateScoreCount:g(e.reactHookCandidates),reactLargeComponentPressureFiles:e.reactLargeComponentPressure.count,vueComponentDuplicatePairs:e.vueComponentDuplicates.count,vueComposableCandidatePairs:e.vueComposableCandidates.count,vueComposableCandidateScoreCount:g(e.vueComposableCandidates),vueLargeViewPressureFiles:e.vueLargeViewPressure.count,extractionCandidates:e.extractCount,wrappers:e.wrappers.count,wrapperScoreCount:g(e.wrappers),passthroughs:e.passthroughs.count,staleTypes:e.stale.count,driftedFiles:e.drift.count,complexityHotspotCount:e.complexity.extremeCount,hiddenCouplingPairs:e.gitEvidence?.hiddenCoupling.pairCount??null,hiddenCouplingScoreCount:e.gitEvidence?.hiddenCoupling.scoreCount??null,coverageContractViolations:e.coverageContracts.count},axes:ct(e),validation:lt(e),suppressions:e.suppressions,actions:r,pressure:i,topComplexity:e.complexity.top,coverage:a,warnings:s.length>0?s:void 0}}function st(e){let r=e.complexity.coverage.semanticEvidence.status;return{status:e.evidenceCoverage.some(i=>i.semanticEvidence.status!=="complete"&&i.semanticEvidence.status!=="disabled")?"incomplete":r==="disabled"?"semantic-disabled":r==="complete"?"complete":"incomplete",complexity:e.complexity.coverage,phases:e.evidenceCoverage}}function ct(e){return{deletable:{loc:e.dead.loc+e.isolated.loc,symbols:e.dead.count+e.isolated.count},cycles:{count:e.realCycleCount},changeAmplification:e.gitEvidence?.amplification??null,hiddenCoupling:e.gitEvidence?.hiddenCoupling??null,churnWeightedComplexity:ut(e),evidenceQuality:{graphFindings:e.dead.count+e.isolated.count+e.realCycleCount,heuristicFindings:e.similarCount+e.duplicateBodies.count+e.twinDrift.count+e.reactComponentDuplicates.count+e.reactHookCandidates.count+e.reactLargeComponentPressure.count+e.vueComponentDuplicates.count+e.vueComposableCandidates.count+e.vueLargeViewPressure.count+e.extractCount+e.wrappers.count+e.passthroughs.count+e.stale.count+e.drift.count,userSuppressed:e.suppressions?.total??0}}}function ut(e){let r=e.gitEvidence?.fileStats;return r?e.complexity.top.map(t=>{let i=t.file?r[t.file]?.changes??0:0;return{...t,changes:i,weighted:h(t.score*Math.log2(1+i))}}).sort((t,i)=>i.weighted-t.weighted):null}function lt(e){let r=e.gitEvidence?.fileStats;if(!r)return null;let t={dead:e.dead.files??[],isolated:e.isolated.files??[],twinDrift:e.twinDrift.files??[],wrappers:e.wrappers.files??[],passthroughs:e.passthroughs.files??[],stale:e.stale.files??[],reactComponents:e.reactComponentDuplicates.files??[],reactHooks:e.reactHookCandidates.files??[],reactLargeComponents:e.reactLargeComponentPressure.files??[],vueComponents:e.vueComponentDuplicates.files??[],vueComposables:e.vueComposableCandidates.files??[],vueLargeViews:e.vueLargeViewPressure.files??[]},i=new Set(Object.values(t).flat()),o=0,n=0,a=0;for(let[b,f]of Object.entries(r))i.has(b)?o+=f.fixChanges:(n+=f.fixChanges,a+=1);let s=i.size>0?h(o/i.size):0,l=a>0?h(n/a):0,d={};for(let[b,f]of Object.entries(t)){let C=new Set(f);if(C.size===0)continue;let S=0;for(let D of C)S+=r[D]?.fixChanges??0;let x=h(S/C.size);d[b]={flaggedFiles:C.size,fixDensity:x,lift:l>0?h(x/l):null}}return{flaggedFiles:i.size,flaggedFixDensity:s,baselineFixDensity:l,ratio:i.size>0&&l>0?h(s/l):null,byCategory:d,validationBasis:{method:"subject-regex",commitsScanned:e.gitEvidence?.commitsScanned??0}}}function h(e){return Math.round(e*100)/100}function Ee(e){return Number.isInteger(e)?String(e):e.toFixed(2).replace(/0+$/,"").replace(/\.$/,"")}function L(e,r="existing shared infrastructure discount"){let t=g(e);return Math.abs(t-e.count)<.01?"":` (${Ee(t)} score-weighted after ${r})`}function y(e,r){let t=g(e),i=`${e.count} ${r}`;return Math.abs(t-e.count)<.01?i:`${i} (${Ee(t)} score-weighted)`}function dt(e){let r=[];if(e.dead.count>0&&r.push({category:"Dead code",evidence:"graph-fact",description:`${e.dead.count} indexed symbols with no visible repository references \u2014 review runtime/framework roots and the capability disclosure, then verify any deletion with cleanup-plan --verify`,effort:"low",impact:"high",count:e.dead.count,locRecoverable:e.dead.loc}),e.isolated.count>0&&r.push({category:"Isolated symbols",evidence:"graph-fact",description:`${e.isolated.count} symbols completely disconnected from the codebase graph`,effort:"low",impact:"medium",count:e.isolated.count,locRecoverable:e.isolated.loc}),e.realCycleCount>0&&r.push({category:"Circular dependencies",evidence:"graph-fact",description:`${e.realCycleCount} indexed dependency cycle(s) \u2014 inspect ownership and runtime order before choosing whether or how to break them`,effort:"medium",impact:"high",count:e.realCycleCount,locRecoverable:0}),e.similarCount>0&&r.push({category:"Similar functions",evidence:"heuristic",description:`${e.similarCount} pairs share disclosed call or source-token evidence beyond imports \u2014 review domain identity before considering consolidation`,effort:"medium",impact:"medium",count:e.similarCount,locRecoverable:0}),e.duplicateBodies.count>0&&r.push({category:"Duplicate function bodies",evidence:"heuristic",description:`${e.duplicateBodies.count} exact small-body group(s) across files \u2014 consolidate only when the domain concept matches`,effort:"low",impact:"medium",count:e.duplicateBodies.count,locRecoverable:e.duplicateBodies.loc}),e.twinDrift.count>0&&r.push({category:"Drifted twin implementations",evidence:"heuristic",description:`${e.twinDrift.count} same-name (or near-name) function group(s) across files with diverged or identical bodies \u2014 determine whether they represent the same concept before acting`,effort:"medium",impact:"medium",count:e.twinDrift.count,locRecoverable:0}),e.reactComponentDuplicates.count>0&&r.push({category:"Duplicated React components",evidence:"heuristic",description:`${e.reactComponentDuplicates.count} React component pair(s) share JSX structure \u2014 review whether local product intent justifies reuse`,effort:"medium",impact:"medium",count:e.reactComponentDuplicates.count,locRecoverable:e.reactComponentDuplicates.loc}),e.reactHookCandidates.count>0&&r.push({category:"Duplicated React hook behavior",evidence:"heuristic",description:`${e.reactHookCandidates.count} React component pair(s) share state/effect/request behavior${L(e.reactHookCandidates)} \u2014 review whether a common hook would preserve ownership and lifecycle semantics`,effort:"medium",impact:"medium",count:e.reactHookCandidates.count,locRecoverable:e.reactHookCandidates.loc}),e.reactLargeComponentPressure.count>0&&r.push({category:"Large React components",evidence:"heuristic",description:`${e.reactLargeComponentPressure.count} React component(s) concentrate JSX/behavior pressure \u2014 split by reason to change`,effort:"medium",impact:"medium",count:e.reactLargeComponentPressure.count,locRecoverable:0}),e.vueComponentDuplicates.count>0&&r.push({category:"Duplicated Vue components",evidence:"heuristic",description:`${e.vueComponentDuplicates.count} Vue component pair(s) share template structure \u2014 review whether local product intent justifies reuse`,effort:"medium",impact:"medium",count:e.vueComponentDuplicates.count,locRecoverable:e.vueComponentDuplicates.loc}),e.vueComposableCandidates.count>0&&r.push({category:"Duplicated Vue behavior",evidence:"heuristic",description:`${e.vueComposableCandidates.count} Vue component pair(s) share state/effect/request behavior${L(e.vueComposableCandidates)} \u2014 review whether a common composable would preserve ownership and lifecycle semantics`,effort:"medium",impact:"medium",count:e.vueComposableCandidates.count,locRecoverable:e.vueComposableCandidates.loc}),e.vueLargeViewPressure.count>0&&r.push({category:"Large Vue views",evidence:"heuristic",description:`${e.vueLargeViewPressure.count} Vue file(s) concentrate template/script/style pressure \u2014 split by reason to change`,effort:"medium",impact:"medium",count:e.vueLargeViewPressure.count,locRecoverable:0}),e.extractCount>0&&r.push({category:"Extraction candidates",evidence:"heuristic",description:`${e.extractCount} large functions with isolated callee clusters \u2014 review same-file or feature-local extraction seams`,effort:"medium",impact:"medium",count:e.extractCount,locRecoverable:0}),e.wrappers.count>0&&r.push({category:"Wrapper functions",evidence:"heuristic",description:`${e.wrappers.count} single-consumer symbols${L(e.wrappers,"boundary-evidence discount")} \u2014 inspect whether each is indirection or an intentional API, framework, or ownership boundary`,effort:"low",impact:"low",count:e.wrappers.count,locRecoverable:e.wrappers.loc}),e.passthroughs.count>0&&r.push({category:"Passthrough functions",evidence:"heuristic",description:`${e.passthroughs.count} functions that literally forward to one callee \u2014 inspect whether each is unnecessary indirection or an intentional boundary`,effort:"low",impact:"low",count:e.passthroughs.count,locRecoverable:e.passthroughs.loc}),e.stale.count>0){let o=[];e.stale.unused>0&&o.push(`${e.stale.unused} unused`),e.stale.singleUse>0&&o.push(`${e.stale.singleUse} single-consumer (not in types file)`),r.push({category:"Stale abstractions",evidence:"heuristic",description:`${o.join(", ")} \u2014 review public, runtime-registration, and ownership evidence before removing, moving, or inlining`,effort:"low",impact:"medium",count:e.stale.count,locRecoverable:e.stale.loc})}if(e.drift.count>0){let o=[];e.drift.unusedImports>0&&o.push(`${e.drift.unusedImports} unused imports`),e.drift.architectureViolations>0&&o.push(`${e.drift.architectureViolations} declared architecture violations`),r.push({category:"Structural drift",evidence:"heuristic",description:`${o.join(", ")} \u2014 repair direct dependency-rule breaks; inspect boundary signals with \`drift --architecture\``,effort:e.drift.architectureViolations>0?"medium":"low",impact:e.drift.architectureViolations>0?"medium":"low",count:e.drift.count,locRecoverable:0})}if(e.coverageContracts.count>0&&r.push({category:"Coverage contract drift",evidence:"graph-fact",description:`${e.coverageContracts.count} configured coverage contract(s) drifted from their ground-truth source (enumeration rot) \u2014 run \`codebaseiq health --json\` for the missing/extra keys`,effort:"low",impact:"medium",count:e.coverageContracts.count,locRecoverable:0}),e.gitEvidence&&e.gitEvidence.hiddenCoupling.pairCount>0){let o=e.gitEvidence.hiddenCoupling.top[0];r.push({category:"Hidden coupling",evidence:"change-graph",description:`${e.gitEvidence.hiddenCoupling.pairCount} file pair(s) co-change without a structural link`+L({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:e.gitEvidence.hiddenCoupling.scoreCount},"broad/stale-history discount")+(o?` (e.g. ${o.fileA} \u2194 ${o.fileB})`:"")+" \u2014 inspect whether a shared concept, generated artifact, or coordinated contract explains the history",effort:"medium",impact:"high",count:e.gitEvidence.hiddenCoupling.pairCount,locRecoverable:0})}let t={high:3,medium:2,low:1},i={low:3,medium:2,high:1};return r.sort((o,n)=>{let a=t[o.impact]*i[o.effort];return t[n.impact]*i[n.effort]-a}),r}var He={"dead-code":"risk",isolated:"risk",cycles:"risk",complexity:"risk","hidden-coupling":"risk","cycles-pressure":"risk","complexity-pressure":"risk","hidden-coupling-pressure":"risk",similar:"hygiene","duplicate-bodies":"hygiene","twin-drift":"hygiene","react-component-duplicates":"hygiene","react-hook-candidates":"hygiene","react-large-component-pressure":"hygiene","vue-component-duplicates":"hygiene","vue-composable-candidates":"hygiene","vue-large-view-pressure":"hygiene",extract:"hygiene",wrappers:"hygiene",passthroughs:"hygiene","stale-abstractions":"hygiene",drift:"hygiene","similar-pressure":"hygiene","duplicate-bodies-pressure":"hygiene","twin-drift-pressure":"hygiene","react-component-duplicates-pressure":"hygiene","react-hook-candidates-pressure":"hygiene","react-large-component-pressure-pressure":"hygiene","vue-component-duplicates-pressure":"hygiene","vue-composable-candidates-pressure":"hygiene","vue-large-view-pressure-pressure":"hygiene","extract-pressure":"hygiene","wrappers-pressure":"hygiene","passthroughs-pressure":"hygiene","stale-abstractions-pressure":"hygiene","drift-pressure":"hygiene"};function Le(e,r){let t=e.filter(i=>i.kind===r).reduce((i,o)=>i+o.points,0);return Math.max(0,Math.min(100,100-t))}function mt(e){let r=Math.max(e.statsResult.documents,1),t=Math.max(e.statsResult.symbols,1),i=[],o=[],n=(m,w,v)=>{w>0&&i.push({axis:m,points:w,detail:v,kind:He[m]??"hygiene"})},a=(m,w,v,Ge,We,qe,Ue)=>{let H=Math.max(Ge,1);if(v<=H)return;let P=v/H,R=Math.min(We,Math.ceil(Math.log2(P)*qe));if(R<=0)return;let Ke=He[m]??"hygiene";o.push({axis:m,category:w,kind:Ke,count:v,threshold:h(H),ratio:h(P),extraPenalty:R}),n(m,R,`${v} ${Ue} exceed pressure threshold ${h(H)} (${h(P)}x)`)},s=e.dead.count/t;n("dead-code",Math.min(20,Math.round(s*200)),`${e.dead.count} dead symbols (${e.dead.loc} LOC deletable)`);let l=e.isolated.count/t;n("isolated",Math.min(10,Math.round(l*200)),`${e.isolated.count} isolated symbols (${e.isolated.loc} LOC deletable)`),n("cycles",Math.min(15,e.realCycleCount*5),`${e.realCycleCount} real dependency cycle(s)`);let d=e.similarCount/t*1e3;n("similar",Math.min(10,Math.round(d)),`${e.similarCount} similar function pair(s)`);let b=e.duplicateBodies.count/t*1e3;n("duplicate-bodies",Math.min(10,Math.round(b*2)),`${e.duplicateBodies.count} exact duplicate small-body group(s) (${e.duplicateBodies.loc} duplicate LOC)`);let f=e.twinDrift.count/t*1e3;n("twin-drift",Math.min(10,Math.round(f*2)),`${e.twinDrift.count} drifted twin implementation group(s) (same or near-same name, diverged or identical bodies)`);let C=e.reactComponentDuplicates.count/r*1e3;n("react-component-duplicates",Math.min(10,Math.round(C)),`${e.reactComponentDuplicates.count} duplicated React component pair(s)`);let S=g(e.reactHookCandidates),x=S/r*1e3;n("react-hook-candidates",Math.min(10,Math.round(x)),y(e.reactHookCandidates,"duplicated React behavior pair(s)"));let D=e.reactLargeComponentPressure.count/r*1e3;n("react-large-component-pressure",Math.min(5,Math.round(D/2)),`${e.reactLargeComponentPressure.count} large React component pressure file(s)`);let Ie=e.vueComponentDuplicates.count/r*1e3;n("vue-component-duplicates",Math.min(10,Math.round(Ie)),`${e.vueComponentDuplicates.count} duplicated Vue component pair(s)`);let _=g(e.vueComposableCandidates),ze=_/r*1e3;n("vue-composable-candidates",Math.min(10,Math.round(ze)),y(e.vueComposableCandidates,"duplicated Vue behavior pair(s)"));let Oe=e.vueLargeViewPressure.count/r*1e3;n("vue-large-view-pressure",Math.min(5,Math.round(Oe/2)),`${e.vueLargeViewPressure.count} large Vue view pressure file(s)`);let F=g(e.wrappers);n("wrappers",Math.min(3,F),y(e.wrappers,"wrapper candidate(s)"));let I=g(e.passthroughs);n("passthroughs",Math.min(3,I),y(e.passthroughs,"passthrough candidate(s)")),n("stale-abstractions",Math.min(8,e.stale.unused),`${e.stale.unused} unused stale abstraction(s); ${e.stale.singleUse} single-consumer signal(s)`);let je=e.drift.direct/r;if(n("drift",Math.min(5,Math.round(je*50)),`${e.drift.direct} direct drift finding(s); ${e.drift.signal} signal drift finding(s)`),n("complexity",Math.min(5,e.complexity.extremeCount*2),`${e.complexity.extremeCount} extreme complexity hotspot(s)`),e.gitEvidence){let m=e.gitEvidence.hiddenCoupling.scoreCount;n("hidden-coupling",Math.min(5,Math.ceil(m/10)),y({count:e.gitEvidence.hiddenCoupling.pairCount,scoreCount:m},"co-changing pair(s) without a structural link"))}if(a("cycles-pressure","Circular dependencies",e.realCycleCount,3,10,3,"cycle(s)"),a("complexity-pressure","Extreme complexity",e.complexity.extremeCount,3,5,2,"extreme complexity hotspot(s)"),e.gitEvidence){let m=e.gitEvidence.hiddenCoupling.scoreCount;a("hidden-coupling-pressure","Hidden coupling",m,50,10,4,"score-weighted co-changing pair(s)")}return a("similar-pressure","Similar functions",e.similarCount,Math.max(50,t*.01),8,4,"similar function pair(s)"),a("duplicate-bodies-pressure","Duplicate function bodies",e.duplicateBodies.count,Math.max(20,t*.005),8,4,"exact duplicate small-body group(s)"),a("twin-drift-pressure","Drifted twin implementations",e.twinDrift.count,Math.max(20,t*.005),8,4,"drifted twin implementation group(s)"),a("react-component-duplicates-pressure","Duplicated React components",e.reactComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated React component pair(s)"),a("react-hook-candidates-pressure","Duplicated React hook behavior",S,Math.max(10,r*.01),8,4,"duplicated React behavior pair(s)"),a("react-large-component-pressure-pressure","Large React components",e.reactLargeComponentPressure.count,Math.max(10,r*.01),4,2,"large React component pressure file(s)"),a("vue-component-duplicates-pressure","Duplicated Vue components",e.vueComponentDuplicates.count,Math.max(10,r*.01),8,4,"duplicated Vue component pair(s)"),a("vue-composable-candidates-pressure","Duplicated Vue behavior",_,Math.max(10,r*.01),8,4,"duplicated Vue behavior pair(s)"),a("vue-large-view-pressure-pressure","Large Vue views",e.vueLargeViewPressure.count,Math.max(10,r*.01),4,2,"large Vue view pressure file(s)"),a("extract-pressure","Extraction candidates",e.extractCount,Math.max(50,t*.01),4,2,"extraction candidate(s)"),a("wrappers-pressure","Wrapper functions",F,50,4,2,"wrapper candidate(s)"),a("passthroughs-pressure","Passthrough functions",I,50,4,2,"passthrough candidate(s)"),a("stale-abstractions-pressure","Single-consumer stale abstraction signals",e.stale.singleUse,Math.max(50,t*.02),4,2,"single-consumer stale abstraction signal(s)"),a("drift-pressure","Structural drift signals",e.drift.signal,Math.max(10,r*.1),4,2,"signal drift finding(s)"),{breakdown:i,pressure:o}}var p={dead:{minLoc:3,skipBarrels:!0,deadCodeOnly:!0},isolated:{minLoc:3},similar:{minSimilarity:.6,limit:50,minCallees:4},duplicateBodies:{maxLoc:15,limit:50},extract:{minLoc:15,minCallees:5,limit:50},wrappers:{maxLoc:15,limit:50},passthroughs:{maxLoc:15,limit:50},stale:{minLoc:3,limit:50},drift:{},twinDrift:{minSimilarity:.3}};import{getHeapStatistics as pt}from"v8";var ht=64*1024*1024;function $(){let e=globalThis.gc;if(!e)return;let r=pt();r.heap_size_limit-r.used_heap_size<ht||e()}var gt=50,ft=25e3,Ct=2500,De=2500,Pe=50,vt=10,bt=["overview","dead","isolated","cycles","similar","duplicate-bodies","twin-drift","react-component-duplicates","react-hook-candidates","react-large-component-pressure","vue-component-duplicates","vue-composable-candidates","vue-large-view-pressure","extract-candidates","wrapper-candidates","passthrough-candidates","stale-abstractions","drift","complexity-hotspots","git-evidence","suppressions","coverage-contracts"],St={overview:(e,r,t,i)=>({phase:"overview",statsResult:i,warnings:t.warnings}),dead:(e,r,t)=>({phase:"dead",dead:wt(e,r,t)}),isolated:(e,r,t)=>({phase:"isolated",isolated:Ht(e,r,t)}),cycles:(e,r,t)=>({phase:"cycles",realCycleCount:Lt(e,r,t)}),similar:(e,r,t)=>({phase:"similar",similarCount:Et(e,r,t)}),"duplicate-bodies":(e,r,t)=>({phase:"duplicate-bodies",duplicateBodies:Pt(e,r,t)}),"twin-drift":(e,r,t)=>({phase:"twin-drift",twinDrift:Rt(e,r,t)}),"react-component-duplicates":(e,r,t)=>({phase:"react-component-duplicates",reactComponentDuplicates:kt(e,r,t)}),"react-hook-candidates":(e,r,t)=>({phase:"react-hook-candidates",reactHookCandidates:Mt(e,r,t)}),"react-large-component-pressure":(e,r,t)=>({phase:"react-large-component-pressure",reactLargeComponentPressure:At(e,r,t)}),"vue-component-duplicates":(e,r,t)=>({phase:"vue-component-duplicates",vueComponentDuplicates:Tt(e,r,t)}),"vue-composable-candidates":(e,r,t)=>({phase:"vue-composable-candidates",vueComposableCandidates:Bt(e,r,t)}),"vue-large-view-pressure":(e,r,t)=>({phase:"vue-large-view-pressure",vueLargeViewPressure:$t(e,r,t)}),"extract-candidates":(e,r,t)=>({phase:"extract-candidates",extractCount:Dt(e,r,t)}),"wrapper-candidates":(e,r,t)=>({phase:"wrapper-candidates",wrappers:Vt(e,r,t)}),"passthrough-candidates":(e,r,t)=>({phase:"passthrough-candidates",passthroughs:Nt(e,r,t)}),"stale-abstractions":(e,r,t)=>({phase:"stale-abstractions",stale:_t(e,r,t)}),drift:(e,r,t)=>({phase:"drift",drift:Ot(e,r,t)}),"complexity-hotspots":(e,r,t)=>({phase:"complexity-hotspots",complexity:jt(e,r,t)}),"git-evidence":(e,r,t)=>({phase:"git-evidence",gitEvidence:Ft(e,t)}),suppressions:(e,r,t)=>({phase:"suppressions",suppressions:It(e,t)}),"coverage-contracts":(e,r,t)=>({phase:"coverage-contracts",coverageContracts:zt(e,t)})};function Or(e,r={}){return Me(e,r.full!==!1,(t,i)=>{let o=xt(e,r.scope,t,i);return B(o)})}function jr(e,r,t={}){return yt(e,[r],t)[0]}function yt(e,r,t={}){return Me(e,t.full!==!1,(i,o)=>{let n={...o,releaseCachesBetweenPhases:!1};return r.map(a=>Te(e,a,t.scope,n,i))})}function Me(e,r,t){let i=ge(e),o=Gt(i,r);try{return t(i,o)}finally{T(e,{semanticProvider:!0}),$()}}function Gr(e){return B(Ae(e))}function Ae(e){let r=u(e,"overview");return{statsResult:r.statsResult,warnings:r.warnings,evidenceCoverage:e.map(i=>({phase:i.phase,semanticEvidence:i.evidenceCoverage})),dead:u(e,"dead").dead,isolated:u(e,"isolated").isolated,realCycleCount:u(e,"cycles").realCycleCount,similarCount:u(e,"similar").similarCount,duplicateBodies:u(e,"duplicate-bodies").duplicateBodies,twinDrift:u(e,"twin-drift").twinDrift,reactComponentDuplicates:u(e,"react-component-duplicates").reactComponentDuplicates,reactHookCandidates:u(e,"react-hook-candidates").reactHookCandidates,reactLargeComponentPressure:u(e,"react-large-component-pressure").reactLargeComponentPressure,vueComponentDuplicates:u(e,"vue-component-duplicates").vueComponentDuplicates,vueComposableCandidates:u(e,"vue-composable-candidates").vueComposableCandidates,vueLargeViewPressure:u(e,"vue-large-view-pressure").vueLargeViewPressure,extractCount:u(e,"extract-candidates").extractCount,wrappers:u(e,"wrapper-candidates").wrappers,passthroughs:u(e,"passthrough-candidates").passthroughs,stale:u(e,"stale-abstractions").stale,drift:u(e,"drift").drift,complexity:u(e,"complexity-hotspots").complexity,gitEvidence:Re(e,"git-evidence")?.gitEvidence??null,suppressions:Re(e,"suppressions")?.suppressions??null,coverageContracts:u(e,"coverage-contracts").coverageContracts}}function Re(e,r){return e.find(t=>t.phase===r)}function u(e,r){let t=e.find(i=>i.phase===r);if(!t)throw new Error(`Missing health phase result: ${r}`);return t}function xt(e,r,t,i){return Ae(bt.map(o=>Te(e,o,r,i,t)))}function Te(e,r,t,i,o){q(e);let n=St[r](e,t,i,o),a=U(e),s=a.incompleteSymbolIds.size,l=a.unavailableSymbolIds.size,d=i.semantic?s>0&&l>0?"incomplete-and-unavailable":s>0?"incomplete":l>0?"unavailable":"complete":"disabled";return{...n,evidenceCoverage:{enabled:i.semantic,status:d,incompleteSymbolCount:s,unavailableSymbolCount:l}}}function wt(e,r,t){return c(e,t,"dead",()=>{let i=Y(e,{scope:r,...p.dead,scanLimit:t.candidateScanLimit,semantic:t.semantic});return E(Ut(e,i.symbols))})}function Ht(e,r,t){return c(e,t,"isolated",()=>{let i=ne(e,{scope:r,...p.isolated,scanLimit:t.candidateScanLimit,semantic:t.semantic});return E(Kt(e,i))})}function Lt(e,r,t){return c(e,t,"cycles",()=>ee(e,{scope:r}).filter(o=>o.kind==="real").length)}function Et(e,r,t){let i=c(e,t,"similar",()=>Z(e,{scope:r,...p.similar,scanLimit:t.candidateScanLimit,semantic:t.semantic}));return Math.min(i,t.candidateResultLimit)}function Dt(e,r,t){return c(e,t,"extract-candidates",()=>oe(e,{scope:r,...p.extract,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic}).length)}function Pt(e,r,t){return c(e,t,"duplicate-bodies",()=>{let i=te(e,{scope:r,...p.duplicateBodies,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit}),o=new Set,n=0;for(let a of i)for(let s of a.functions.slice(1))o.add(s.file),n+=s.loc;return{count:i.length,loc:n,files:[...o]}})}function Rt(e,r,t){return c(e,t,"twin-drift",()=>{let i=re(e,{scope:r,...p.twinDrift,scanLimit:t.candidateScanLimit}).filter(a=>a.relationship==="divergent"||a.relationship==="identical"),o=new Set,n=0;for(let a of i)for(let s of a.members)o.add(s.file),n+=s.loc;return{count:i.length,loc:n,files:[...o].sort()}})}function kt(e,r,t){return c(e,t,"react-component-duplicates",()=>{let i=ae(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return V(i)})}function Mt(e,r,t){return c(e,t,"react-hook-candidates",()=>{let i=se(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return $e(i,Xt)})}function At(e,r,t){return c(e,t,"react-large-component-pressure",()=>{let i=ce(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return Yt(i)})}function Tt(e,r,t){return c(e,t,"vue-component-duplicates",()=>{let i=ue(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return V(i)})}function Bt(e,r,t){return c(e,t,"vue-composable-candidates",()=>{let i=le(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return $e(i,Qt)})}function $t(e,r,t){return c(e,t,"vue-large-view-pressure",()=>{let i=de(e,{scope:r,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit});return E(i)})}function Vt(e,r,t){return c(e,t,"wrapper-candidates",()=>{let i=me(e,{scope:r,...p.wrappers,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return Be(i,Jt)})}function Nt(e,r,t){return c(e,t,"passthrough-candidates",()=>{let i=pe(e,{scope:r,...p.passthroughs,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return Be(i,Zt)})}function _t(e,r,t){return c(e,t,"stale-abstractions",()=>{let i=he(e,{scope:r,...p.stale,limit:t.candidateResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic}),o=i.filter(n=>n.consumers===0).length;return{count:i.length,loc:i.reduce((n,a)=>n+a.loc,0),files:[...new Set(i.map(n=>n.file))],unused:o,singleUse:i.length-o}})}function Ft(e,r){return c(e,r,"git-evidence",()=>{let t=X(e,{historyMode:r.gitHistoryMode}),i=t.fileChurn();if(!i)return null;let o=t.commitHistory(),n=Q(e,void 0,{limit:r.candidateResultLimit,historyMode:r.gitHistoryMode}),a={};for(let[s,l]of i)a[s]={changes:l.changes,fixChanges:l.fixChanges};return{amplification:t.changeAmplification(),hiddenCoupling:{pairCount:n.findings.length,scoreCount:N(n.findings.reduce((s,l)=>s+ke(l),0)),top:n.findings.slice(0,5).map(s=>({fileA:s.fileA,fileB:s.fileB,together:s.together,confidence:s.confidence,focusedTogether:s.focusedTogether,broadTogether:s.broadTogether,broadCommitRatio:s.broadCommitRatio,lastTogetherAt:s.lastTogetherAt,recentTogether:s.recentTogether,commitScope:s.commitScope,recency:s.recency,scoreWeight:ke(s),subjectContext:s.subjectContext}))},fileStats:a,commitsScanned:o?.commits.length??0}})}function It(e,r){return c(e,r,"suppressions",()=>{let t=fe(e);return{total:t.total,byCategory:{...t.byCategory}}})}function zt(e,r){return c(e,r,"coverage-contracts",()=>{let t=e.config.coverageContracts??[],o=be(e,t).filter(n=>n.status!=="ok");return{count:o.length,loc:0,files:[...new Set(o.map(n=>n.file))].sort()}})}function Ot(e,r,t){return c(e,t,"drift",()=>{let i=ie(e,{scope:r,...p.drift,includePatternDeviations:!1,limit:Number.POSITIVE_INFINITY,semantic:t.semantic}),o=i.results.filter(s=>s.kind!=="pattern-deviation"),n=o.filter(s=>s.actionTier==="direct").length,a=o.length-n;return{count:o.length,unusedImports:i.unusedImports,architectureViolations:i.architectureViolations,layerViolations:i.layerViolations,direct:n,signal:a}})}function jt(e,r,t){return c(e,t,"complexity-hotspots",()=>{let i=J(e,{scope:r,minLoc:10,limit:t.complexityResultLimit,scanLimit:t.candidateScanLimit,semantic:t.semantic});return{top:i.rows.slice(0,5).map(o=>({symbol:o.shortName,score:o.score,file:o.file})),extremeCount:i.rows.filter(o=>o.score>gt).length,coverage:i.coverage}})}function Gt(e,r){let t=e.symbols>=ft||e.documents>=Ct,i=r?Number.POSITIVE_INFINITY:Pe,o=r?Number.POSITIVE_INFINITY:vt;return!t||r?{candidateScanLimit:void 0,candidateResultLimit:i,complexityResultLimit:o,semantic:!0,gitHistoryMode:r?"full":"bounded",releaseCachesBetweenPhases:!0,warnings:r&&t?["Large index detected; running health without candidate scan or result caps because full mode is enabled."]:[]}:{candidateScanLimit:De,candidateResultLimit:i,complexityResultLimit:o,semantic:!1,gitHistoryMode:"bounded",releaseCachesBetweenPhases:!0,warnings:[`Large index detected; candidate-style health checks scanned their highest-priority ${De} symbols and reported their top ${Pe} findings. Enable full mode for unbounded candidate counts.`]}}function Wt(e,r){r.releaseCachesBetweenPhases&&(T(e),$())}function c(e,r,t,i){qt(t);try{return i()}finally{Wt(e,r)}}function qt(e){process.env.CODEBASEIQ_HEALTH_TRACE==="1"&&console.error(`[health] ${e}`)}function Ut(e,r){return r.filter(t=>!M(e,t.relativePath)&&!A(e,t.symbol,t.relativePath)&&t.kind==="dead-code")}function Kt(e,r){return r.filter(t=>!M(e,t.relativePath)&&!A(e,t.symbol,t.relativePath))}function E(e){let r=new Set;for(let t of e){let i=t.relativePath??t.file;i&&r.add(i)}return{count:e.length,loc:e.reduce((t,i)=>t+i.loc,0),files:[...r]}}function Be(e,r){return{...E(e),scoreCount:N(e.reduce((i,o)=>i+r(o),0))}}function Yt(e){let r=new Map;for(let t of e)r.set(t.file,Math.max(r.get(t.file)??0,t.loc));return{count:r.size,loc:[...r.values()].reduce((t,i)=>t+i,0),files:[...r.keys()]}}function V(e){let r=new Map;for(let t of e)r.set(t.fileA,Math.max(r.get(t.fileA)??0,t.locA)),r.set(t.fileB,Math.max(r.get(t.fileB)??0,t.locB));return{count:e.length,loc:[...r.values()].reduce((t,i)=>t+i,0),files:[...r.keys()]}}function $e(e,r){return{...V(e),scoreCount:N(e.reduce((i,o)=>i+r(o),0))}}function Xt(e){let r=e.sharedHooks.length>0,t=Ve({namedState:e.sharedState,requests:e.sharedRequests,lifecycle:e.sharedEffects,functions:e.sharedHandlers});return r&&t<=2?0:r?.5:Ne(e.sharedState,e.sharedHandlers,e.sharedHandlerVerbs)?.25:t>=2?1:.5}function Qt(e){let r=e.sharedComposables.length+e.sharedStores.length>0,t=Ve({namedState:e.sharedBindings,requests:e.sharedRequests,lifecycle:e.sharedLifecycle,functions:e.sharedFunctions});return r&&t<=2?0:r?.5:Ne(e.sharedBindings,e.sharedFunctions,e.sharedFunctionVerbs)?.25:t>=2?1:.5}function Ve(e){return e.requests.length*2+e.lifecycle.length+e.namedState.filter(r=>!Fe.has(_e(r))).length+Math.min(e.functions.length,3)}function Ne(e,r,t){let i=[...e,...r,...t].map(_e);return i.length>0&&i.every(o=>Fe.has(o))}function _e(e){return e.replace(/^handle/,"").replace(/^is/,"").replace(/^has/,"").toLowerCase()}function Jt(e){return e.actionTier==="signal"?.25:1}function Zt(e){return e.actionTier==="signal"?.25:1}function ke(e){return e.commitScope==="broad-sweep"?e.recency==="recent"?.25:0:e.commitScope==="mixed"?e.recency==="recent"?.5:.25:e.recency==="recent"?1:.5}function N(e){return Math.round(e*100)/100}var Fe=new Set(["add","apply","cancel","change","clear","close","create","delete","draft","edit","error","filter","form","load","loading","name","open","refresh","remove","reset","save","saving","search","select","selected","submit","toggle","update","value"]);export{p as a,bt as b,Or as c,jr as d,yt as e,Gr as f};
|
|
2
|
+
//# sourceMappingURL=chunk-VSGOIZMQ.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{a as w}from"./chunk-ILMHV3KM.js";import{a as F,b as x,d as T,e as H,f as b,g as _,h as N}from"./chunk-
|
|
1
|
+
import{a as w}from"./chunk-ILMHV3KM.js";import{a as F,b as x,d as T,e as H,f as b,g as _,h as N}from"./chunk-LSZYMN2A.js";import{a as W,b as j}from"./chunk-JYRJYXUV.js";import{a as f}from"./chunk-6O3KXIDL.js";import{ca as B,da as q}from"./chunk-UQYQBLJX.js";import m from"process";import{existsSync as Se}from"fs";import{dirname as M,join as ve,resolve as E,sep as Le}from"path";import{fileURLToPath as ze}from"url";import{spawn as ae}from"child_process";import{platform as $}from"os";var c=class extends Error{},p=class extends Error{},v=class extends Error{constructor(r,n,i){super(`rust-analyzer LSP request ${n} failed: ${i}`);this.code=r}code},ue=3e4,le=16*1024,ce=64*1024*1024,U=64*1024,J=256*1024*1024,g=Buffer.from(`\r
|
|
2
2
|
\r
|
|
3
3
|
`,"ascii"),L=class{constructor(e,r={}){this.transport=e;this.requestTimeoutMs=r.requestTimeoutMs??ue,this.configuration=r.configuration??{};let n=de(r.maxHeaderBytes,r.maxMessageBytes);this.maxHeaderBytes=n.maxHeaderBytes,this.maxMessageBytes=n.maxMessageBytes,this.monotonicNow=r.monotonicNow??f,this.headerBuffer=Buffer.allocUnsafe(this.maxHeaderBytes+g.length),this.transport.onData(i=>this.handleData(i)),this.transport.onClose((i,s)=>this.failTransport(new Error(we(i,s)),!1)),this.transport.onError(i=>this.failTransport(i,!0))}transport;nextId=1;pending=new Map;diagnosedUris=new Set;diagnosticWaiters=new Map;readinessWaiters=new Set;requestTimeoutMs;configuration;maxHeaderBytes;maxMessageBytes;monotonicNow;headerBuffer;headerLength=0;bodyBuffer=null;bodyLength=0;transportFailure=null;transportKilled=!1;transportKillPromise=null;currentServerStatusGeneration=0;latestServerStatus=null;shutdownStarted=!1;async initialize(e,r={}){let n=e.capabilities??{},i=n.experimental&&typeof n.experimental=="object"&&!Array.isArray(n.experimental)?n.experimental:{},s=await this.request("initialize",{...e,capabilities:{...n,experimental:{...i,serverStatusNotification:!0}}},r);return this.notify("initialized",{}),s}async references(e,r={}){let n=await this.request("textDocument/references",e,r);return Array.isArray(n)?n:[]}async definition(e,r={}){let n=await this.request("textDocument/definition",e,r);return he(n)}async prepareCallHierarchy(e,r={}){let n=await this.request("textDocument/prepareCallHierarchy",e,r);return Array.isArray(n)?n:[]}async outgoingCalls(e,r={}){let n=await this.request("callHierarchy/outgoingCalls",{item:e},r);return Array.isArray(n)?n:[]}async hover(e,r={}){let n=await this.request("textDocument/hover",e,r);return n&&typeof n=="object"?n:null}async readinessBarrier(e={}){try{await this.request("codebaseiq/readinessBarrier",null,e)}catch(r){if(r instanceof v&&r.code===-32601)return;throw r}}serverStatusGeneration(){return this.currentServerStatusGeneration}serverStatusSnapshot(){let e=this.latestServerStatus;return e?{generation:e.generation,status:{...e.status}}:null}waitForQuiescence(e,r){if(this.transportFailure)return Promise.reject(this.transportFailure);let n=this.latestServerStatus;if(n&&n.generation>e){if(n.status.health==="error")return Promise.reject(G());if(n.status.quiescent)return Promise.resolve(n.status)}return new Promise((i,s)=>{let o={afterGeneration:e,resolve:i,reject:s,timeout:setTimeout(()=>{this.readinessWaiters.delete(o),s(new Error(`rust-analyzer readiness timed out after ${r}ms`))},r)};this.readinessWaiters.add(o)})}didOpenTextDocument(e){this.notify("textDocument/didOpen",{textDocument:e})}waitForDiagnostics(e,r){return this.transportFailure?Promise.resolve(!1):this.diagnosedUris.has(e)?Promise.resolve(!0):new Promise(n=>{let i=u=>{clearTimeout(s),n(u)},s=setTimeout(()=>{let u=this.diagnosticWaiters.get(e)?.filter(l=>l!==i);u&&u.length>0?this.diagnosticWaiters.set(e,u):this.diagnosticWaiters.delete(e),n(!1)},r),o=this.diagnosticWaiters.get(e)??[];o.push(i),this.diagnosticWaiters.set(e,o)})}async shutdown(e={}){if(!this.shutdownStarted){this.shutdownStarted=!0;try{await this.request("shutdown",null,e),this.notify("exit",null)}catch(r){throw this.notify("exit",null),this.killTransportOnce(),r}}}async shutdownAndReap(e={}){let r;try{await this.shutdown(e)}catch(n){r=n}try{await this.killTransportOnce()}catch(n){throw new Error(`rust-analyzer process-tree cleanup failed: ${n instanceof Error?n.message:String(n)}`,{cause:n})}if(r)throw r}request(e,r,n={}){if(this.transportFailure)return Promise.reject(this.transportFailure);let i=z(n.timeoutMs??this.requestTimeoutMs,n.deadlineMs,this.monotonicNow),s=this.nextId++,o={jsonrpc:"2.0",id:s,method:e,params:r};return new Promise((u,l)=>{let d=setTimeout(()=>{let y=i.deadlineLimited?new c(`rust-analyzer readiness deadline expired during LSP request ${e}`):new Error(`rust-analyzer LSP request ${e} timed out after ${i.timeoutMs}ms`);this.cancelAndFailTimedOutRequest(s,y)},i.timeoutMs);this.pending.set(s,{method:e,deadlineMs:n.deadlineMs,resolve:y=>u(y),reject:l,timeout:d}),this.transport.write(S(o))})}notify(e,r){this.transportFailure||this.transport.write(S({jsonrpc:"2.0",method:e,params:r}))}handleData(e){if(this.transportFailure||e.length===0)return;let r=0;for(;r<e.length&&!this.transportFailure;){if(this.bodyBuffer){let o=Math.min(e.length-r,this.bodyBuffer.length-this.bodyLength);if(e.copy(this.bodyBuffer,this.bodyLength,r,r+o),r+=o,this.bodyLength+=o,this.bodyLength===this.bodyBuffer.length){let u=this.bodyBuffer.toString("utf8");this.bodyBuffer=null,this.bodyLength=0;let l;try{l=Re(u)}catch{this.failProtocol("rust-analyzer LSP response body was not a valid JSON object");continue}try{this.dispatchMessage(l)}catch{this.failTransport(new Error("rust-analyzer LSP message handling failed"),!0)}}continue}if(this.headerLength===this.headerBuffer.length){this.failProtocol(`rust-analyzer LSP header exceeded ${this.maxHeaderBytes} byte limit`);return}if(this.headerBuffer[this.headerLength++]=e[r++],!this.headerDelimiterComplete())continue;let n=this.headerLength-g.length;if(n>this.maxHeaderBytes){this.failProtocol(`rust-analyzer LSP header exceeded ${this.maxHeaderBytes} byte limit`);return}let i=this.headerBuffer.subarray(0,n).toString("ascii");this.headerLength=0;let s;try{s=fe(i,this.maxMessageBytes)}catch(o){this.failProtocol(o instanceof Error?o.message:String(o));return}this.bodyBuffer=Buffer.allocUnsafe(s),this.bodyLength=0,s===0&&(this.bodyBuffer=null,this.failProtocol("rust-analyzer LSP response body was not a valid JSON object"))}}headerDelimiterComplete(){if(this.headerLength<g.length)return!1;let e=this.headerLength-g.length;return this.headerBuffer.subarray(e,this.headerLength).equals(g)}failProtocol(e){this.failTransport(new p(e),!0)}failTransport(e,r){this.transportFailure||(this.transportFailure=e,this.headerLength=0,this.bodyBuffer=null,this.bodyLength=0,r&&this.killTransportOnce().catch(()=>{}),this.rejectPending(e),this.resolveDiagnosticWaiters(!1))}killTransportOnce(){return this.transportKilled?this.transportKillPromise??Promise.resolve():(this.transportKilled=!0,this.transportKillPromise=Promise.resolve(this.transport.kill()),this.transportKillPromise)}async cancelAndFailTimedOutRequest(e,r){let n=this.pending.get(e);if(!n)return;this.pending.delete(e);try{this.transport.write(S({jsonrpc:"2.0",method:"$/cancelRequest",params:{id:e}}))}catch{}this.transportFailure||(this.transportFailure=r,this.headerLength=0,this.bodyBuffer=null,this.bodyLength=0);let i=r;try{await this.killTransportOnce()}catch(s){i=new Error(`${r.message}; rust-analyzer cleanup failed: ${s instanceof Error?s.message:String(s)}`,{cause:s})}n.reject(i),this.rejectPending(i),this.resolveDiagnosticWaiters(!1)}dispatchMessage(e){if(this.recordDiagnosticNotification(e),this.recordServerStatusNotification(e),e.id!==void 0&&e.id!==null&&e.method){this.respondToServerRequest(e);return}if(e.id===void 0||e.id===null)return;let r=this.pending.get(e.id);if(r){if(clearTimeout(r.timeout),this.pending.delete(e.id),e.error){r.reject(new v(e.error.code,r.method,e.error.message));return}if(r.deadlineMs!==void 0&&this.monotonicNow()>=r.deadlineMs){r.reject(new c(`rust-analyzer readiness deadline expired during LSP request ${r.method}`));return}r.resolve(e.result)}}recordDiagnosticNotification(e){if(e.method!=="textDocument/publishDiagnostics")return;let r=e.params,n=r&&typeof r=="object"&&typeof r.uri=="string"?r.uri:null;if(!n)return;this.diagnosedUris.add(n);let i=this.diagnosticWaiters.get(n)??[];this.diagnosticWaiters.delete(n),i.forEach(s=>s(!0))}recordServerStatusNotification(e){if(e.method!=="experimental/serverStatus"||e.id!==void 0||!me(e.params))return;let r=e.params,n={health:r.health,quiescent:r.quiescent,...typeof r.message=="string"?{message:r.message}:{}},i=++this.currentServerStatusGeneration;if(this.latestServerStatus={generation:i,status:n},n.health==="error"){this.rejectReadinessWaiters(G());return}if(n.quiescent)for(let s of this.readinessWaiters)i<=s.afterGeneration||(clearTimeout(s.timeout),this.readinessWaiters.delete(s),s.resolve(n))}respondToServerRequest(e){if(e.id===void 0||e.id===null||!e.method)return;let r=e.method==="workspace/configuration"?this.workspaceConfiguration(e.params):null;this.transport.write(S({jsonrpc:"2.0",id:e.id,result:r}))}workspaceConfiguration(e){return(e&&typeof e=="object"&&Array.isArray(e.items)?e.items:[]).map(n=>typeof n.section=="string"?pe(this.configuration,n.section):this.configuration)}rejectPending(e){for(let[r,n]of this.pending)clearTimeout(n.timeout),n.reject(e),this.pending.delete(r);this.rejectReadinessWaiters(e)}resolveDiagnosticWaiters(e){for(let r of this.diagnosticWaiters.values())r.forEach(n=>n(e));this.diagnosticWaiters.clear()}rejectReadinessWaiters(e){for(let r of this.readinessWaiters)clearTimeout(r.timeout),r.reject(e),this.readinessWaiters.delete(r)}};function de(t=le,e=ce){if(!Number.isSafeInteger(t)||t<=0)throw new TypeError("maxHeaderBytes must be a positive safe integer.");if(!Number.isSafeInteger(e)||e<=0)throw new TypeError("maxMessageBytes must be a positive safe integer.");if(t>U)throw new RangeError(`maxHeaderBytes cannot exceed ${U} bytes for rust-analyzer LSP.`);if(t+g.length+e>J)throw new RangeError(`Combined rust-analyzer LSP header and message limits cannot exceed ${J} bytes.`);return{maxHeaderBytes:t,maxMessageBytes:e}}function fe(t,e){let r=[];for(let s of t.split(`\r
|
|
4
4
|
`)){let o=s.indexOf(":");o<0||s.slice(0,o).trim().toLowerCase()!=="content-length"||r.push(s.slice(o+1).trim())}if(r.length===0)throw new p("rust-analyzer LSP response missing Content-Length header");if(r.length>1){let s=new Set(r).size>1?"rust-analyzer LSP response has conflicting Content-Length headers":"rust-analyzer LSP response has duplicate Content-Length headers";throw new p(s)}let n=r[0];if(!/^\d+$/.test(n))throw new p("rust-analyzer LSP Content-Length must be a non-negative safe integer");let i=Number(n);if(!Number.isSafeInteger(i))throw new p("rust-analyzer LSP Content-Length must be a non-negative safe integer");if(i>e)throw new p(`rust-analyzer LSP Content-Length exceeds ${e} byte message limit`);return i}function z(t,e,r=f){if(e===void 0)return{timeoutMs:t,deadlineLimited:!1};let n=e-r();if(n<=0)throw new c("rust-analyzer readiness deadline expired before LSP operation");return{timeoutMs:Math.min(t,n),deadlineLimited:n<=t}}function me(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;let e=t;return(e.health==="ok"||e.health==="warning"||e.health==="error")&&typeof e.quiescent=="boolean"&&(e.message===void 0||e.message===null||typeof e.message=="string")}function G(){return new c("rust-analyzer reported error health before reaching readiness")}function pe(t,e){let r=e.startsWith("rust-analyzer.")?e.slice(14):e;if(r===""||r==="rust-analyzer")return t;let n=t;for(let i of r.split(".")){if(!n||typeof n!="object")return null;n=n[i]}return n??null}function he(t){return t?(Array.isArray(t)?t:[t]).flatMap(r=>ye(r)?[r]:ge(r)?[{uri:r.targetUri,range:r.targetSelectionRange}]:[]):[]}function ye(t){return!!(t&&typeof t=="object"&&typeof t.uri=="string")}function ge(t){return!!(t&&typeof t=="object"&&typeof t.targetUri=="string")}function K(t,e,r=process.env,n){let i=ae(t,[],{cwd:e,env:r,detached:$()!=="win32",stdio:["pipe","pipe","pipe"],windowsHide:!0}),s=i.pid===void 0?null:W(i.pid,$()!=="win32"),o=s?F(n,s):null,u=null;return i.on("close",()=>x(o)),{write(l){i.stdin.write(l)},onData(l){i.stdout.on("data",l)},onClose(l){i.on("close",l)},onError(l){i.on("error",l)},kill(){if(!s){i.kill();return}return u??=j(s,{gracefulMs:1e3,forceMs:1e3}).then(l=>{if(!l.reaped)throw new Error(l.detail??`rust-analyzer process tree ${s.rootPid} was not reaped.`);x(o)}),u}}}function S(t){let e=JSON.stringify(t);return`Content-Length: ${Buffer.byteLength(e,"utf8")}\r
|
|
5
5
|
\r
|
|
6
6
|
${e}`}function Re(t){let e=JSON.parse(t);if(!e||typeof e!="object")throw new Error("rust-analyzer LSP response was not a JSON object");return e}function we(t,e){return`rust-analyzer LSP transport closed${e?` by ${e}`:t===null?"":` with code ${t}`}`}async function Q(t,e,r,n=f){let i=r-n();if(i<=0)throw new c("rust-analyzer readiness deadline expired before quiescence");try{let s=await t.waitForQuiescence(e,i);if(P(r,n,"during quiescence"),s.health==="error")throw new c("rust-analyzer reported error health before reaching readiness");if(!s.quiescent)throw new c("rust-analyzer did not report quiescence before reaching readiness");return s}catch(s){throw s instanceof c?s:new c(s instanceof Error?s.message:String(s))}}async function tt(t,e,r,n,i,s=f,o=D){let u=await Q(t,e,n,s);if(r===0)return u;let l=t.serverStatusSnapshot();if(!l)throw new c("rust-analyzer status is unavailable after initial document open");return await be(t,l,r,n,i,s,o)??u}async function be(t,e,r,n,i,s=f,o=D){if(r===0)return null;if(!e)throw new c("rust-analyzer status is unavailable before document open");Y(e.status,"before document open");try{await t.readinessBarrier({deadlineMs:n}),P(n,s,"during post-open synchronization")}catch(d){throw d instanceof c?d:new c(d instanceof Error?d.message:String(d))}let u=t.serverStatusSnapshot();if(!u||u.generation<e.generation)throw new c("rust-analyzer status is unavailable after document open");let l;return u.generation===e.generation?(Y(u.status,"after document open"),l=u.status):l=await Q(t,e.generation,n,s),await C(i,n,s,o),l}async function rt(t,e,r,n=f){let i=z(e,r,n);await t(i.timeoutMs),P(r,n,"during diagnostics")}async function C(t,e,r=f,n=D){if(t<=0)return;if(z(t,e,r).deadlineLimited)throw new c("rust-analyzer readiness deadline cannot accommodate delay");await n(t),P(e,r,"during delay")}async function nt(t,e){try{return await t()}catch(r){throw r instanceof c&&await e(),r}}function it(t){return t instanceof c?{ok:!1,error:t.message}:null}function P(t,e,r){if(t-e()<=0)throw new c(`rust-analyzer readiness deadline expired ${r}`)}function Y(t,e){if(t.health==="error")throw new c(`rust-analyzer reported error health ${e}`);if(!t.quiescent)throw new c(`rust-analyzer did not report quiescence ${e}`)}function D(t){return new Promise(e=>setTimeout(e,t))}async function Pe(t){let e=t.includeReferences!==!1,r=t.includeCallees===!0,n=t.includeSignatures===!0,i={timeoutMs:t.requestTimeoutMs},s=Ae(t),o=X(t),u=V(t),l=ee(t),d=Oe(t.projectRoot,s),y=Ie(t.projectRoot,d),k=ke(d),h=new L(K(t.rustAnalyzerBinary,y),{requestTimeoutMs:t.requestTimeoutMs,configuration:k});try{let A=await h.initialize({processId:m.pid,rootUri:T(y,"."),capabilities:{textDocument:{references:{dynamicRegistration:!1},callHierarchy:{dynamicRegistration:!1},hover:{dynamicRegistration:!1}}},initializationOptions:k});if(e&&!A.capabilities.referencesProvider)return{available:!1,reason:"rust-analyzer initialized without textDocument/references support.",references:o.map(a=>[a.symbolId,[]]),...r?{callees:u.map(a=>[a.symbolId,[]])}:{}};if(r&&!A.capabilities.callHierarchyProvider)return{available:!1,reason:"rust-analyzer initialized without call hierarchy support.",references:o.map(a=>[a.symbolId,[]]),callees:u.map(a=>[a.symbolId,[]]),...n?{signatures:l.map(a=>[a.symbolId,null])}:{}};if(n&&!A.capabilities.hoverProvider)return{available:!1,reason:"rust-analyzer initialized without hover support.",references:o.map(a=>[a.symbolId,[]]),...r?{callees:u.map(a=>[a.symbolId,[]])}:{},signatures:l.map(a=>[a.symbolId,null])};let ie=Be(h,t.projectRoot,s);await qe(h,ie,t.diagnosticsTimeoutMs??1e4),await ne(t.settleDelayMs??5e3);let I=e?await w(o,t.concurrency??8,async a=>{let O=await te(h,b(t.projectRoot,a,!1),{requestTimeoutMs:t.requestTimeoutMs,retryTimeoutMs:t.referenceRetryTimeoutMs});return{symbolId:a.symbolId,references:N(_(t.projectRoot,O.locations)),complete:O.complete}}):o.map(a=>({symbolId:a.symbolId,references:[],complete:!0})),se=r?await w(u,t.concurrency??8,async a=>({symbolId:a.symbolId,callees:await je(h,t.projectRoot,a,i)})):[],oe=n?await w(l,t.concurrency??8,async a=>({symbolId:a.symbolId,signature:await xe(h,t.projectRoot,a,i)})):[];return{available:!0,references:I.filter(a=>a.complete).map(a=>[a.symbolId,a.references]),incompleteReferenceSymbolIds:I.filter(a=>!a.complete).map(a=>a.symbolId),...r?{callees:se.map(a=>[a.symbolId,a.callees])}:{},...n?{signatures:oe.map(a=>[a.symbolId,a.signature])}:{}}}finally{await h.shutdown().catch(()=>{})}}function X(t){return t.referenceDefinitions??t.definitions}function V(t){return t.calleeDefinitions??t.definitions}function ee(t){return t.signatureDefinitions??t.definitions}function Ae(t){return[...t.includeReferences!==!1?X(t):[],...t.includeCallees===!0?V(t):[],...t.includeSignatures===!0?ee(t):[]]}async function xe(t,e,r,n={}){let i=b(e,r,!1),s=await Te(t,{textDocument:i.textDocument,position:i.position},n);return Ce(s)}async function Te(t,e,r={}){try{return await t.hover(e,r)}catch(n){if(R(n),!(n instanceof Error?n.message:String(n)).includes("content modified"))return null;await re(r.deadlineMs);try{return await t.hover(e,r)}catch(s){return R(s),null}}}function Ce(t){if(!t)return null;let e=De(t.contents),r=/```(?:rust)?\s*([\s\S]*?)```/i.exec(e),n=r?r[1]:e;for(let i of n.split(/\r?\n/)){let s=i.replace(/^`+|`+$/g,"").trim();if(s&&Ee(s))return s}return null}function De(t){return typeof t=="string"?t:Array.isArray(t)?t.map(Me).join(`
|
|
7
7
|
`):"value"in t?t.value:""}function Me(t){return typeof t=="string"?t:t.value}function Ee(t){return/^(?:pub(?:\([^)]*\))?\s+)?(?:async\s+)?(?:const\s+)?(?:unsafe\s+)?(?:extern\s+(?:"[^"]+"\s+)?)?(?:fn|struct|enum|trait|type|const|static|mod)\b/.test(t)}function ke(t){return{...t.length>0?{linkedProjects:t}:{},references:{excludeImports:!1,excludeTests:!1}}}function Ie(t,e){return e.length===1?M(e[0]):E(t)}function Oe(t,e){let r=E(t),n=[],i=new Set;for(let s of e){let o=M(E(r,s.relativePath));for(;$e(r,o);){let u=ve(o,"Cargo.toml");if(Se(u)){i.has(u)||(i.add(u),n.push(u));break}let l=M(o);if(l===o)break;o=l}}return n}function Be(t,e,r){let n=new Set,i=[];for(let s of r)if(!n.has(s.relativePath)){n.add(s.relativePath);try{let o=T(e,s.relativePath);t.didOpenTextDocument({uri:o,languageId:"rust",version:1,text:B(e,s.relativePath,{inputKind:"indexed Rust source file"})}),i.push(o)}catch(o){if(!q(o))throw o}}return i}async function qe(t,e,r){await Promise.all(e.map(n=>t.waitForDiagnostics(n,r).catch(()=>!1)))}async function ht(t,e){return(await te(t,e)).locations}async function te(t,e,r={}){try{return{locations:await t.references(e,{timeoutMs:r.requestTimeoutMs,deadlineMs:r.deadlineMs}),complete:!0}}catch(n){R(n);let i=n instanceof Error?n.message:String(n);if(Z(n))return{locations:[],complete:!1};if(!i.includes("content modified"))return{locations:[],complete:!0};await re(r.deadlineMs);try{return{locations:await t.references(e,We(r)),complete:!0}}catch(s){return R(s),{locations:[],complete:!Z(s)}}}}function We(t){return{...t.retryTimeoutMs&&t.retryTimeoutMs>0?{timeoutMs:t.retryTimeoutMs}:{},...t.deadlineMs!==void 0?{deadlineMs:t.deadlineMs}:{}}}function Z(t){let e=t instanceof Error?t.message:String(t);return e.includes("rust-analyzer LSP request")&&e.includes("timed out after")}async function je(t,e,r,n={}){let i=b(e,r,!1),s=await Fe(t,{textDocument:i.textDocument,position:i.position},n),o=(await Promise.all(s.map(u=>He(t,u,n)))).flat();return Ne(_e(e,o))}async function Fe(t,e,r={}){try{return await t.prepareCallHierarchy(e,r)}catch(n){return R(n),[]}}async function He(t,e,r={}){try{return await t.outgoingCalls(e,r)}catch(n){return R(n),[]}}async function re(t){if(t===void 0){await ne(1e3);return}await C(1e3,t)}function R(t){if(t instanceof c)throw t}function _e(t,e){return e.map(r=>({symbol:r.to.name,file:H(t,r.to.uri),line:r.to.selectionRange.start.line,...r.fromRanges[0]===void 0?{}:{callsiteLine:r.fromRanges[0].start.line}}))}function Ne(t){let e=new Set,r=[];for(let n of t){let i=`${n.symbol}\0${n.file}\0${n.line}\0${n.callsiteLine??""}`;e.has(i)||(e.add(i),r.push(n))}return r.sort((n,i)=>n.file.localeCompare(i.file)||n.line-i.line||n.symbol.localeCompare(i.symbol))}function ne(t){return t<=0?Promise.resolve():new Promise(e=>setTimeout(e,t))}function $e(t,e){return e===t||e.startsWith(`${t}${Le}`)}async function Ue(){return new Promise((t,e)=>{let r=[];m.stdin.on("data",n=>r.push(n)),m.stdin.on("error",e),m.stdin.on("end",()=>t(Buffer.concat(r).toString("utf8")))})}async function Je(){try{let t=JSON.parse(await Ue()),e=await Pe(t);m.stdout.write(JSON.stringify(e))}catch(t){let e={available:!1,reason:t instanceof Error?t.message:String(t),references:[]};m.stdout.write(JSON.stringify(e)),m.exitCode=1}}m.argv[1]&&ze(import.meta.url)===m.argv[1]&&Je();export{L as a,K as b,tt as c,be as d,rt as e,nt as f,it as g,Pe as h,X as i,V as j,ee as k,Ae as l,xe as m,Te as n,Ce as o,ke as p,Ie as q,Oe as r,Be as s,qe as t,ht as u,te as v,je as w,ne as x};
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
8
|
+
//# sourceMappingURL=chunk-W7QDASTN.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as G,D as P,a as y,b as ce,i as k,j as le,t as B,u as de,w as j,x as ue,y as b}from"./chunk-
|
|
1
|
+
import{A as G,D as P,a as y,b as ce,i as k,j as le,t as B,u as de,w as j,x as ue,y as b}from"./chunk-XUPFA6GH.js";import{c as oe,d as re,e as ie,g as se,i as ae,k as E}from"./chunk-YPBKBYPS.js";import{eb as g,fb as ne,gb as C,ib as x,n as ee,p as te,w as S}from"./chunk-JNXI6NQ7.js";import{A as H,C as Z,n as N,o as L,q as M,z as Y}from"./chunk-K4S2VH42.js";import{c as W}from"./chunk-XQAVQVIL.js";import{c as T,g as Q}from"./chunk-DRENNWRG.js";import{qa as X}from"./chunk-MEUHIDI3.js";function ge(e,n,t){if(!Number.isSafeInteger(t.limit)||t.limit<=0)throw new Error("Reference page limit must be a positive safe integer.");let o=N(e,n);if(!o)return{rows:[],hasMore:!1,producer:t.producer??"source-keyset",semanticEnrichment:!1};if(t.producer==="complete-only"||t.semantic===!0||o.relativePath.endsWith(".rb"))return F(e,n,t);let i=Y(e,o);if(!i)return F(e,n,t);let s=fe(e,o),c=Te(e,s),a=[],l=t.producer==="source-keyset";for(let u of c){if(t.after&&u<t.after.relativePath)continue;t.instrumentation?.fileScanned?.(u);let f=H(e,i,u);f.length>0&&(l=!0);let d=new Set(f);s?.relativePath===u&&d.add(s.line);for(let m of[...d].sort((p,Ae)=>p-Ae)){let p={relativePath:u,line:m};if(!(t.after&&R(p,t.after)<=0)&&(a.push(p),t.instrumentation?.rowAccepted?.(p),l&&a.length>t.limit))return me(a,t.limit)}}return l?me(a,t.limit):F(e,n,t,s)}function R(e,n){return(e.relativePath<n.relativePath?-1:e.relativePath>n.relativePath?1:0)||e.line-n.line}function me(e,n){return{rows:e.slice(0,n),hasMore:e.length>n,producer:"source-keyset",semanticEnrichment:!1}}function F(e,n,t,o){let r=N(e,n),i=t.semantic===!0||r?.relativePath.endsWith(".rb")?S(e,n,{semantic:t.semantic}):De(e,n,o),s=Me(i).filter(c=>!t.after||R(c,t.after)>0);for(let c of s.slice(0,t.limit+1))t.instrumentation?.rowAccepted?.(c);return{rows:s.slice(0,t.limit),hasMore:s.length>t.limit,producer:"complete-only",semanticEnrichment:t.semantic===!0}}function De(e,n,t){let o=N(e,n);if(!o)return[];let r=t===void 0?fe(e,o):t,i=Z(e,o).map(s=>({relativePath:s.file,line:s.line}));return r?[r,...i]:i}function fe(e,n){return!Q(n.symbol)&&!e.isIgnored(n.relativePath)?{relativePath:n.relativePath,line:n.startLine}:null}function Te(e,n){let t=W(e);return!n||t.includes(n.relativePath)?t:[...t,n.relativePath].sort((o,r)=>o<r?-1:o>r?1:0)}function Me(e){let n=new Map;for(let t of e)n.set(`${t.relativePath}\0${t.line}`,t);return[...n.values()].sort(R)}import{InvalidArgumentError as v}from"commander";var St=X,Be=/^[+-]?\d+$/u,je=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/u,xt=(e=>V(e,"an integer")),pe=(e=>{let n=V(e,"a non-negative integer");if(n<0)throw new v(`Expected a non-negative integer, got "${e}".`);return n}),he=(e=>{let n=V(e,"a positive integer");if(n<1)throw new v(`Expected a positive integer, got "${e}".`);return n}),Et=(e=>{if(!je.test(e))throw new v(`Expected a number, got "${e}".`);let n=Number(e);if(!Number.isFinite(n))throw new v(`Expected a finite number, got "${e}".`);return n});function V(e,n){if(!Be.test(e))throw new v(`Expected ${n}, got "${e}".`);let t=Number(e);if(!Number.isSafeInteger(t))throw new v(`Expected ${n}, got "${e}".`);return t}function h(e,n,t,...o){return o.length>0?{flags:e,description:n,parser:t,defaultValue:o[0]}:{flags:e,description:n,parser:t}}function Ge(){return h("--json","Output as JSON for programmatic consumption")}function Fe(){return h("--compact","Emit minified one-line JSON (use with --json)")}function Ve(){return h("--result-only","Emit only the command-owned result (use with --json)")}function Ce(e=[]){return I(e)}function I(e=[]){let n=[Ge(),Ve(),Fe()],t=new Set(n.map(o=>o.flags));return[...e.filter(o=>!t.has(o.flags)),...n]}function $(e,n=[]){return{category:e,examples:n}}function Pt(e,n){return{origin:"mixed",observedSources:e,producerValidation:{status:"not-evaluated"},families:n}}function $t(e,n){return{origin:e,observedSources:n,producerValidation:{status:"not-evaluated"}}}function wt(e,n,t){return{id:e,selector:n,origin:{kind:"fixed",origin:t}}}function Ot(e,n,t,o){return{id:e,selector:n,origin:{kind:"result-field",field:t,values:o}}}function w(e,n,t,o,r,i,s){return{answers:typeof e=="string"?[e]:e,returns:typeof n=="string"?[n]:n,inputs:t,coverage:o,operation:i,semantic:s,...r?{scope:r}:{}}}function Nt(e,n,t,o,r,i=y){let s=typeof e=="string"?[e]:e,c=typeof n=="string"?[n]:n;return w(s,c,t,o,r,i,K(s.join(" "),c.join("; "),["This command establishes only its declared result units and evidence contract."],void 0,{outputCost:o==="complete"?"bounded":"variable"}))}function ye(e,n,t,o,r,i=y){let s=typeof e=="string"?[e]:e,c=typeof n=="string"?[n]:n;return w(s,c,t,o,r,i,Ke(c.join("; "),["This command does not establish repository graph relationships unless its result says so explicitly."]))}function be(e,n,t={ranking:"identity-only"}){return{kind:"locator",locates:e,nonClaims:n,outputCost:"small",frontierClosure:["evidence","inspect","code"],...t}}function Lt(e){return{kind:"graph-projection",outputCost:"bounded",frontierClosure:["inspect","code"],...e}}function Re(e,n,t,o={}){return{kind:"source-read",reads:e,nonClaims:n,outputCost:"potentially-large",frontierClosure:[],...t?{compatibility:t}:{},...o}}function K(e,n,t,o,r={}){return{kind:"analysis",analysis:e,resultMeaning:n,nonClaims:t,outputCost:"bounded",frontierClosure:["inspect","code"],...o?{compatibility:o}:{},...r}}function Ke(e,n,t,o={}){return{kind:"maintenance",effect:e,nonClaims:n,outputCost:"variable",frontierClosure:[],...t?{compatibility:t}:{},...o}}function J(e){return Buffer.from(JSON.stringify(e),"utf8").toString("base64url")}function A(e){return e.generation.identity}function U(e){return"after"in e?J({version:2,...e}):J({version:1,...e})}function ve(e,n){let t=_e(e);if(!Je(t)&&!Ue(t))throw new Error("Invalid result cursor. Run the command again without --cursor.");return ze(t,n),t}function Je(e){if(!e||typeof e!="object")return!1;let n=e;return n.version===1&&typeof n.command=="string"&&typeof n.target=="string"&&Number.isSafeInteger(n.offset)&&(n.offset??-1)>=0&&typeof n.indexGeneration=="string"&&n.indexGeneration.length>0}function Ue(e){if(!e||typeof e!="object")return!1;let n=e,t=n.after;return n.version===2&&typeof n.command=="string"&&typeof n.target=="string"&&!!t&&typeof t.relativePath=="string"&&t.relativePath.length>0&&Number.isSafeInteger(t.line)&&(t.line??-1)>=0&&(n.producer==="source-keyset"||n.producer==="complete-only")&&typeof n.semanticEnrichment=="boolean"&&typeof n.indexGeneration=="string"&&n.indexGeneration.length>0}function _e(e){try{return JSON.parse(Buffer.from(e,"base64url").toString("utf8"))}catch{throw new Error("Invalid result cursor. Run the command again without --cursor.")}}function ze(e,n){if(e.command!==n.command||e.target!==n.target)throw new Error("This cursor belongs to a different command or target. Run again without --cursor.");if(e.indexGeneration!==n.indexGeneration)throw new Error("The index changed after this cursor was issued. Run again without --cursor.")}function Se(e,n){let t=L(e,n),o=qe(t);for(let r of o)console.log(r)}function xe(e,n,t="No results found for resolved symbol."){return L(e,n).match?t:z(n,M(e,n,5))}function _(e,n,t,o){return{...D(e,n),[o]:t}}function D(e,n){let t=L(e,n);return t.match?{matched:!0,resolved:{symbol:t.match.symbol,shortName:T(t.match.symbol),relativePath:t.match.relativePath},otherMatches:t.candidates.map(o=>({shortName:o.shortName,relativePath:o.relativePath,startLine:o.startLine})),totalMatches:t.total}:{matched:!1,suggestions:M(e,n,5)}}function z(e,n){let t=`No definition matched '${e}'.`;return n.length>0?`${t} Suggestions: ${n.join(", ")}`:t}function qe(e){if(!e.match||e.total<=1)return[];let n=e.match,t=Math.max(0,e.total-1),o=[`Resolved: ${T(n.symbol)} (${n.relativePath}) -- ${t} other definition(s) share this name; qualify as <dir/leaf> to target another.`],r=e.candidates.slice(0,3);return r.length>0&&o.push(`Alternates: ${r.map(i=>`${i.shortName} (${i.relativePath}:${g(i.startLine)})`).join("; ")}`),o.push(""),o}var We=k(({db:e,args:n,opts:t})=>{let o=B(n,0),r=b(t,"signatures"),i=ee(e,o);if(b(t,"json")){P("outline",n,t,i);return}if(console.log(`\u2550\u2550\u2550 REQUEST \u2550\u2550\u2550
|
|
2
2
|
file=${JSON.stringify(o)}; signatures=${r?"shown":"hidden"}`),i.length===0){console.log(`
|
|
3
3
|
\u2550\u2550\u2550 OBSERVED FACTS \u2550\u2550\u2550
|
|
4
4
|
No compiler-owned constructs were found for ${JSON.stringify(o)}.`),console.log(`
|
|
@@ -27,4 +27,4 @@ ${p}continue with --cursor ${d.cursor}`)}});function Ye(e,n,t){let o=S(e,n,{sema
|
|
|
27
27
|
`),o=0,r=0;for(let i=0;i<t.length;i++){let s=t[i].length+12;i>o&&r+s>Ee&&(n.push(`${e.relativePath}:${g(e.startLine+o)}-${g(e.startLine+i-1)}`),o=i,r=0),r+=s}return n.push(`${e.relativePath}:${g(e.startLine+o)}-${g(e.endLine)}`),n}function Pe(e,n){return{requested:n.length,matched:n.filter(t=>t.status==="matched").length,ambiguous:n.filter(t=>t.status==="ambiguous").length,missing:n.filter(t=>t.status==="missing").length,entries:[...n],bindingClosure:e.bindingClosure}}function $e(e,n){return["codebaseiq","code",...e.map(O),...n.members==="all"?["--members","all"]:[],...n.context>0?["--context",String(n.context)]:[]].join(" ")}function dt(e,n,t){if(!t)return D(e,n);let o={file:t.relativePath,symbol:t.shortName,language:t.language??"unknown",range:{startLine:g(t.startLine),endLine:g(t.endLine)},...t.freshness?{freshness:t.freshness}:{},lines:t.source.split(`
|
|
28
28
|
`).map((s,c)=>({line:g(t.startLine+c),text:s}))},r=D(e,n),i=r.totalMatches??0;return!r.matched||!r.resolved||i<=1?o:{...o,resolution:{selected:r.resolved,alternatives:r.otherMatches??[],totalMatches:i}}}function ut(e){return{requested:e.requested,matched:e.matched,ambiguous:e.ambiguous,missing:e.missing,entries:e.entries.map(n=>({selector:n.selector,status:n.status,kind:n.kind,totalCandidates:n.totalCandidates,sources:n.results.map(t=>({file:t.relativePath,symbol:t.shortName,language:t.language??"unknown",range:{startLine:g(t.startLine),endLine:g(t.endLine)},...t.freshness?{freshness:t.freshness}:{},lines:t.source.split(`
|
|
29
29
|
`).map((o,r)=>({line:g(t.startLine+r),text:o}))})),definitions:n.definitions,...n.fileCoverage?{fileCoverage:n.fileCoverage}:{},...n.rangeCoverage?{rangeCoverage:n.rangeCoverage}:{},candidates:n.candidates,omittedCandidates:n.omittedCandidates,suggestions:n.suggestions,...n.reason?{reason:n.reason}:{}})),literalValues:e.bindingClosure.inline}}function O(e){return`'${e.replaceAll("'","'\\''")}'`}var Zt=[{id:"session",command:"session",description:"Show evidence already delivered in this agent exploration session",options:[h("--reset","Clear this agent exploration-session ledger")],agent:ye("Which indexed source ranges and graph facts have already been delivered in this exploration session?","prior command ordinals, exact source ranges, and content-bound graph receipts",[],"complete","repository",ce("repository-observation",[{when:{kind:"option",name:"reset",equals:!0},role:"mutation"}])),renderShape:"custom",docs:$("Navigation"),handler:et},{id:"refs",command:"refs <symbol>",description:"Find all files referencing a symbol",options:Ce([h("--full","Run unbounded semantic analysis on large indexes"),h("-n, --limit <n>","Maximum reference sites to return",he),h("--cursor <cursor>","Continue a prior bounded result (implies --limit 50 when omitted)")]),budget:"semantic",agent:{operation:y,answers:["Which files reference this symbol?","Is this symbol used anywhere, or only defined?"],returns:["referencing file paths","reference line numbers grouped by file"],inputs:["symbol"],coverage:"bounded",semantic:K("Resolve the exact reference sites attributed to one compiler symbol identity.","Referencing file paths and reference line numbers grouped by file.",["Reference sites do not establish runtime execution, data flow, or task relevance."]),contrasts:[{command:"imported-by",distinction:"imported-by lists files importing the symbol; refs covers every reference site, imported or not."},{command:"affected",distinction:"refs is one hop out; affected is the transitive closure of what could break."}]},renderShape:"grouped-by-file",docs:$("Navigation",["codebaseiq refs login"]),handler:Qe},{id:"outline",command:"outline <file>",description:"Tree view of symbols in a file, with line ranges",agent:{...w("What symbols and nesting exist in this file?","symbol names, nesting, and line ranges",["file"],"complete",void 0,y,be(["file","symbol","construct"],["File ownership and nesting do not establish execution or task relevance."],{ranking:"identity-only",manualInput:"One exact current project file path.",evidenceCeiling:"Exact compiler-owned constructs and ranges when the file is indexed; no invented semantic overlay."})),contrasts:[{command:"search",distinction:"outline enumerates constructs in one known file; search locates exact text across current project text."},{command:"code",distinction:"outline returns identities and ranges; code materializes exact source for selected identities."}]},options:I([h("--signatures","Show trimmed symbol signatures")]),renderShape:"custom",docs:$("Navigation"),handler:We},{id:"code",command:"code <selectors...>",description:"Read exact definitions, ranges with local call closure, or file export surfaces",agent:{...w("What exact source defines these symbols, ranges, or file surfaces?","per-selector resolution, complete definition source, exact ranges with statically attributed same-file call closure, file export surfaces, omitted-local ledgers, and line ranges",[["symbol","file"]],"complete",void 0,y,Re(["construct","exact-source"],["Source materialization does not establish callers, runtime reachability, or task relevance by itself."],void 0,{manualInput:"One or more exact symbols, file:line ranges, or file paths.",evidenceCeiling:"Exact current source bytes for every resolved selector, with omitted file-local constructs disclosed."})),resultUnits:{kind:"field",field:"code"},contrasts:[{command:"inspect",distinction:"code materializes complete exact source; inspect batches bounded behavior or source gaps."},{command:"outline",distinction:"code reads selected implementations; outline enumerates file structure without reading every body."}]},options:I([h("-C, --context <n>","Extra lines of context above/below",pe,0),h("--members <exported|all>","For file selectors, return the exported surface or the complete file",void 0,"exported")]),renderShape:"custom",docs:$("Navigation",["codebaseiq code parseRequest handleRequest","codebaseiq code src/api.ts src/web.ts"]),handler:Xe}];export{St as a,xt as b,pe as c,he as d,Et as e,h as f,Fe as g,Ce as h,I as i,$ as j,Pt as k,$t as l,wt as m,Ot as n,w as o,Nt as p,ye as q,be as r,Lt as s,Re as t,K as u,Se as v,xe as w,_ as x,D as y,Zt as z};
|
|
30
|
-
//# sourceMappingURL=chunk-
|
|
30
|
+
//# sourceMappingURL=chunk-WO6OFKUC.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as D}from"./chunk-U7NUXDQO.js";import{c as C}from"./chunk-
|
|
1
|
+
import{a as D}from"./chunk-U7NUXDQO.js";import{c as C}from"./chunk-BPKNP3KZ.js";import{a as I}from"./chunk-57OPIQFM.js";import{e as P}from"./chunk-MSI3K7PJ.js";import{b as F}from"./chunk-SGMNWYTH.js";import{f as M,g as S}from"./chunk-NDKOVQFG.js";import{d as g}from"./chunk-GVAF222T.js";function oe(e,n={}){let t=new C(e).productionCallableDefinitions({scope:n.scope,requireCallableSymbol:!0,includeSuppressed:!0}),r=L(e,t),l=n.search?.trim().toLocaleLowerCase();return t.map(s=>j(e,s,r.get(s.symbolId)??[])).filter(s=>s!==null).map(s=>s.result).filter(s=>!l||$(s).includes(l)).sort(G)}function re(e,n,o={}){let t=F(e,n);if(!t.match)return{kind:"missing",query:n};if(t.total>1)return{kind:"ambiguous",query:n,total:t.total,candidates:[{symbol:t.match.symbol,shortName:g(t.match.symbol),relativePath:t.match.relativePath,startLine:t.match.startLine},...t.candidates]};let r=new C(e),l=r.definitionsForFile(t.match.relativePath).find(a=>a.symbol===t.match.symbol);if(!l?.isFunctionLike)return{kind:"not-entry",query:n,symbol:t.match.symbol,shortName:g(t.match.symbol),file:t.match.relativePath,reason:"The resolved symbol is not a callable definition."};let s=L(e,[l]),f=j(e,l,s.get(l.symbolId)??[]);if(!f)return{kind:"not-entry",query:n,symbol:l.symbol,shortName:g(l.symbol),file:l.relativePath,reason:"The callable is neither an external root nor an uncalled callable on a detected entry surface."};let m=K(e,r,l),i=new Set(o.expand??[]),c=z(m,i),d=new Set(c.regions.filter(a=>a.expanded).map(a=>a.id)),p=[...i].filter(a=>!d.has(a)).sort();return{kind:"matched",query:n,entry:f.result,regions:c.regions,regionEdges:c.regionEdges,unmatchedExpansions:p,coverage:{completeWithinIndexedStaticCallEdges:!0,completeWithinSelectedStaticEvidence:!0,candidateReachabilityIncluded:m.edges.some(a=>a.evidenceStrength==="candidate"),dynamicDispatchRepresented:!1,symbolCount:m.symbols.length,symbolEdgeCount:m.edges.length,exactSymbolEdgeCount:m.edges.filter(a=>a.evidenceStrength==="exact").length,candidateSymbolEdgeCount:m.edges.filter(a=>a.evidenceStrength==="candidate").length,regionCount:c.regions.length,regionEdgeCount:c.regionEdges.length,externalCallCount:m.externalCalls.length}}}function L(e,n){let o=n.filter(t=>B(e,t.relativePath)||S(e,t.symbol,t.relativePath).length>0);return P(e,o,{semantic:!1,semanticEvidence:I})}function j(e,n,o){let t=T(e,n),r=t.length>0,l=B(e,n.relativePath)&&o.length===0;if(!r&&!l)return null;let s=[...t];return l&&s.push("entry-surface-without-indexed-caller"),{definition:n,result:{symbol:n.symbol,shortName:g(n.symbol),file:n.relativePath,startLine:n.startLine,endLine:n.endLine,documentation:n.documentation,confidence:r?"root":"candidate",evidence:s,indexedCallerCount:o.length}}}function B(e,n){return M(e,n)||/(?:^|\/)entry\.(?:ts|tsx|js|jsx|mjs|cjs)$/.test(n)}function T(e,n){let o=S(e,n.symbol,n.relativePath),t=[];return w(o,["package-surface-file","transitive-package-surface"])&&D(e,n)&&t.push("package-public-export"),o.includes("rust-public-library")&&t.push("rust-public-library"),o.includes("framework-entrypoint")&&t.push("framework-dispatched-export"),w(o,["configured-file","configured-path-prefix","configured-qualified-var","configured-symbol-pattern"])&&t.push("configured-entry-root"),t}function w(e,n){return n.some(o=>e.includes(o))}function $(e){return[e.symbol,e.shortName,e.file,e.documentation??"",...e.evidence].join(`
|
|
2
2
|
`).toLocaleLowerCase()}function G(e,n){return N(e.confidence)-N(n.confidence)||e.file.localeCompare(n.file)||e.startLine-n.startLine||e.symbol.localeCompare(n.symbol)}function N(e){return e==="root"?0:1}function K(e,n,o){let t=new Map([[o.symbol,0]]),r=new Map,l=new Map([[o.symbol,o]]),s=new Map,f=new Map,m=[o];for(;m.length>0;){let i=n.calleeMap(m,{additive:!1,semantic:!1}),c=[];for(let d of m){let p=t.get(d.symbol)??0;r.set(d.symbol,k(d,p));for(let a of i.get(d.symbolId)??[]){let y=W(n,a,l);if(!y){let R=O(d,a);f.set(J(R),R);continue}let u=p+1,h=t.get(y.symbol);(h===void 0||u<h)&&t.set(y.symbol,u),r.set(y.symbol,k(y,Math.min(u,h??u)));let v=q(d,y,a);s.set(H(v),v),h===void 0&&c.push(y)}}m=c}return{symbols:[...r.values()].sort(Q),edges:[...s.values()].sort(U),externalCalls:[...f.values()].sort(V)}}function W(e,n,o){let t=o.get(n.symbol);if(t)return t;let r=e.definitionsForFile(n.file).find(l=>l.symbol===n.symbol)??null;return r&&o.set(r.symbol,r),r}function k(e,n){return{symbol:e.symbol,shortName:g(e.symbol),file:e.relativePath,depth:n}}function q(e,n,o){return{fromSymbol:e.symbol,fromShortName:g(e.symbol),fromFile:e.relativePath,toSymbol:n.symbol,toShortName:g(n.symbol),toFile:n.relativePath,source:o.source,evidenceStrength:o.source==="scip-chunk"?"candidate":"exact"}}function O(e,n){return{fromSymbol:e.symbol,fromShortName:g(e.symbol),fromFile:e.relativePath,toSymbol:n.symbol,toShortName:g(n.symbol),reportedFile:n.file,source:n.source,evidenceStrength:n.source==="scip-chunk"?"candidate":"exact"}}function z(e,n){let o=b(e.symbols,i=>i.file),t=b(e.edges.filter(i=>i.fromFile===i.toFile),i=>i.fromFile),r=b(e.externalCalls,i=>i.fromFile),l=A(e.edges.filter(i=>i.fromFile!==i.toFile)),s=b(l,i=>i.toRegionId),f=b(l,i=>i.fromRegionId);return{regions:[...o.entries()].map(([i,c])=>{let d=x(i),p=n.has(d),a=t.get(i)??[],y=r.get(i)??[];return{id:d,file:i,minDepth:Math.min(...c.map(u=>u.depth)),symbolCount:c.length,internalEdgeCount:a.length,externalCallCount:y.length,incomingRegionIds:E((s.get(d)??[]).map(u=>u.fromRegionId)),outgoingRegionIds:E((f.get(d)??[]).map(u=>u.toRegionId)),expanded:p,symbols:p?c:[],internalEdges:p?a:[],externalCalls:p?y:[]}}).sort((i,c)=>i.minDepth-c.minDepth||i.file.localeCompare(c.file)),regionEdges:l}}function A(e){let n=new Map;for(let o of e){let t=`${o.fromFile}\0${o.toFile}`,r=n.get(t)??[];r.push(o),n.set(t,r)}return[...n.values()].map(o=>{let t=o[0];return{fromRegionId:x(t.fromFile),fromFile:t.fromFile,toRegionId:x(t.toFile),toFile:t.toFile,callCount:o.length,exactCallCount:o.filter(r=>r.evidenceStrength==="exact").length,candidateCallCount:o.filter(r=>r.evidenceStrength==="candidate").length,fromSymbols:E(o.map(r=>r.fromShortName)),toSymbols:E(o.map(r=>r.toShortName)),evidence:E(o.map(r=>r.source))}}).sort((o,t)=>o.fromFile.localeCompare(t.fromFile)||o.toFile.localeCompare(t.toFile))}function b(e,n){let o=new Map;for(let t of e){let r=n(t),l=o.get(r)??[];l.push(t),o.set(r,l)}return o}function x(e){return`file:${e}`}function E(e){return[...new Set(e)].sort()}function H(e){return`${e.fromSymbol}\0${e.toSymbol}`}function J(e){return`${e.fromSymbol}\0${e.toSymbol}`}function Q(e,n){return e.depth-n.depth||e.file.localeCompare(n.file)||e.symbol.localeCompare(n.symbol)}function U(e,n){return e.fromFile.localeCompare(n.fromFile)||e.fromSymbol.localeCompare(n.fromSymbol)||e.toSymbol.localeCompare(n.toSymbol)}function V(e,n){return e.fromFile.localeCompare(n.fromFile)||e.fromSymbol.localeCompare(n.fromSymbol)||e.toSymbol.localeCompare(n.toSymbol)}export{oe as a,re as b};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-XJBK3QDV.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{b as I}from"./chunk-DAKIGMIK.js";import{bb as v,ib as s,lb as E,mb as V}from"./chunk-LONKINMJ.js";import{c as y}from"./chunk-ZZ3MWF33.js";import{fa as h,pa as S,w}from"./chunk-MEUHIDI3.js";import{G as x}from"./chunk-UQYQBLJX.js";var ce={defaultRole:"repository-observation"};function pe(e,n=[]){return{defaultRole:e,...n.length>0?{rules:n}:{}}}function k(e,n){for(let t of e.rules??[]){if(t.when.kind==="option-present"){let r=n.options[t.when.name];if(r!==void 0&&r!==!1)return t.role;continue}if((t.when.kind==="argument"?n.args[t.when.index]:n.options[t.when.name])===t.when.equals)return t.role}return e.defaultRole}function fe(e){return[...new Set([e.defaultRole,...(e.rules??[]).map(n=>n.role)])]}function A(e){return e==="repository-observation"||e==="repository-preview"||e==="composite"}import{AsyncLocalStorage as z}from"async_hooks";var U=1,j=1;var F={policyId:"codebaseiq:unresolved-repository-policy",policyVersion:j,permission:"not-established",reasons:["No repository action policy was supplied for this claim."]};function N(e){return{schemaVersion:U,origin:e.contract.origin,coverage:$(e.coverage),producerValidation:e.contract.producerValidation,stateAuthority:w(e.receipt,e.receipt),repositoryPolicy:e.repositoryPolicy??F,...e.contract.families?{families:e.contract.families}:{}}}function $(e){return e?e.complete===!0?{state:"complete",returned:e.returned,totalKnown:!0,total:e.total??e.returned,omitted:0}:e.totalKnown?{state:"partial",returned:e.returned,totalKnown:!0,...e.total===void 0?{}:{total:e.total},...e.omitted===void 0?{}:{omitted:e.omitted}}:{state:"unknown",returned:e.returned,totalKnown:!1}:{state:"unknown",returned:0,totalKnown:!1}}var W="codebaseiq-result";var G=1,Y=1,_=1,L=1;function M(e){let n=e.resultSchemaVersion??Y;if(!X(n))throw new Error("CLI result schema version must be a positive safe integer.");let{producerVersion:t,...o}=e;return{kind:W,schemaVersion:G,producer:{name:"codebaseiq",version:t},resultSchemaVersion:n,...o}}function J(e,n){return JSON.stringify(e,null,n?0:2)}function X(e){return Number.isSafeInteger(e)&&Number(e)>0}var P=Symbol("option-value-source"),T=new Map,D=new Map,B=new Map,H=new z;function Ie(e,n){return H.run(e,n)}function ke(e){T=new Map(e)}function Ae(e){D=new Map(e)}function Ne(e){B=new Map(e)}function m(e){return(...n)=>{let{args:t,opts:o}=le(n);S(r=>{I(r.generation.identity),e({db:r,args:t,opts:o})})}}function R(e,n){return m(t=>{let o=V(t.db,e,d(t.opts,"full"),{quiet:d(t.opts,"json")});n({...t,budget:o})})}function _e(e){return m(n=>c(n,e,{kind:"list"}))}function Le(e){return m(n=>c(n,e,{kind:"table",headers:e.headers,dashWidths:e.dashWidths}))}function Me(e){return m(n=>c(n,e,{kind:"grouped",key:e.key}))}function Z(e){return m(n=>b(n,e))}function Je(e){return Z({commandName:e.commandName,query:e.query,emptyMessage:e.emptyMessage,heuristicLabel:e.heuristicLabel,before:e.before,render:(n,t)=>s.sectionedReport(e.sections(n,t)),toJson:e.toJson,coverage:e.coverage,agentResult:e.agentResult,after:e.after})}function ee(e,n){return R(e,t=>b(t,{...n,commandName:n.commandName??e}))}function Pe(e,n){return ee(e,{commandName:n.commandName??e,query:n.query,emptyMessage:n.emptyMessage,heuristicLabel:n.heuristicLabel,before:n.before,render:(t,o)=>s.sectionedReport(n.sections(t,o)),toJson:n.toJson,coverage:n.coverage,agentResult:n.agentResult,after:n.after})}function Te(e,n){return R(e,t=>c(t,{...n,commandName:e},{kind:"list"}))}function De(e,n){return R(e,t=>c(t,{...n,commandName:e},{kind:"grouped",key:n.key}))}function Be(e,n){return String(e[n])}function He(e,n){let t=e[n];return typeof t=="string"?[t]:Array.isArray(t)&&t.every(o=>typeof o=="string")?t:[]}function Qe(e,n){let t=e[n];return typeof t=="string"?t:void 0}function qe(e,n){let t=e[n];return typeof t=="string"?t:void 0}function Q(e,n){let t=e[n];return typeof t=="number"?t:void 0}function d(e,n){return!!e[n]}function Ke(e,n){let t=e[n];return Array.isArray(t)&&t.every(o=>typeof o=="string")?t:[]}function Ue(e,n,t){return Q(e,n)??t}function je(e,n,t){let o=Q(e,n),r=o!==void 0&&ne(e,n)!=="default";if(d(e,"full")){if(r)throw new Error("--full cannot be combined with --limit. Use --full for all findings, or --limit N for a capped report.");return Number.MAX_SAFE_INTEGER}return o??t}function ne(e,n){return e[P]?.(n)}function c(e,n,t){b(e,{commandName:n.commandName,query:n.query,emptyMessage:(o,r)=>o.length===0&&n.emptyMessage?n.emptyMessage(r):void 0,heuristicLabel:n.heuristicLabel,render:(o,r)=>{t.kind==="list"?s.list(o,i=>n.format(i,r)):t.kind==="table"?s.table(t.headers,o.map(i=>n.format(i,r)),t.dashWidths):s.groupedByFile(o,i=>n.format(i,r),t.key?i=>t.key(i,r):void 0)},toJson:n.toJson,coverage:n.coverage,agentResult:n.agentResult,before:n.before,after:n.after})}function b(e,n){let t=n.query(e);if(d(e.opts,"json")){if(!n.commandName)throw new Error("JSON output requires a command name so its result contract can be identified.");oe(n.commandName,e.args,e.opts,n.toJson?n.toJson(t,e):t,{analysisBudget:te(e),coverage:n.coverage?.(t,e),agentResult:n.agentResult?.(t,e),resultSchemaVersion:n.resultSchemaVersion});return}let o=n.emptyMessage?.(t,e);if(o){s.empty(o);return}n.heuristicLabel&&E(n.heuristicLabel),n.before?.(t,e),n.render(t,e),n.after?.(t,e)}function te(e){return e.budget?.analysisBudget}function oe(e,n,t,o,r={}){let i=T.get(e),a=D.get(e),u=B.get(e),p=a?k(a.operation,{args:n,options:t}):void 0,f=H.getStore();if(f!==void 0&&p!==void 0&&f!==p)throw new Error(`Command ${e} changed operation role during execution: selected ${f}, rendered ${p}.`);let g=f??p,O=de(o),C=r.coverage??ae(a,o,r.analysisBudget),l=C&&O&&!C.resolution?{...C,resolution:O}:C;if(l&&ie(l),d(t,"resultOnly")){let K=Object.hasOwn(r,"resultOnly")?r.resultOnly:o;y(JSON.stringify(K,null,d(t,"compact")?0:2));return}let q=M({producerVersion:x,command:e,...g?{operationRole:g}:{},...i?{evidence:i}:{},...r.analysisBudget?{analysisBudget:r.analysisBudget}:{},args:ue(n),options:t,result:o,...l?{coverage:l}:{},...r.agentResult!==void 0?{agentResult:r.agentResult}:{},...re(g,i,r.analysisBudget,l,u,r.observationReceipt),...r.resultSchemaVersion===void 0?{}:{resultSchemaVersion:r.resultSchemaVersion}});y(J(q,d(t,"compact")))}function re(e,n,t,o,r,i){if(!e||!A(e))return{};let a=h(),u=i??(a?v({projectRoot:a.config.projectRoot,db:a,...r?{observedSourceKinds:r.observedSources}:{}}):void 0);return u?{evidenceContext:{schemaVersion:_,operationRole:e,receipt:u,analysisManifest:{schemaVersion:L,...n?{evidence:n}:{},...t?{analysisBudget:t}:{},...o?{coverage:o}:{},...r?{claimQualification:N({contract:r,receipt:u,...o?{coverage:o}:{}})}:{}}}}:{}}function ie(e){if(!Number.isSafeInteger(e.returned)||e.returned<0)throw new Error("Invocation coverage returned count must be a non-negative safe integer.");if(e.complete!==!0&&e.complete!==!1&&e.complete!==null)throw new Error("Invocation coverage complete must be true, false, or null.");if(e.complete===!0){if(!e.totalKnown)throw new Error("Complete invocation coverage must know its total.");if(!Number.isSafeInteger(e.total)||e.total!==e.returned)throw new Error("Complete invocation coverage total must equal returned.");if(e.omitted!==0)throw new Error("Complete invocation coverage cannot omit results.");if(e.omittedIdentities!==void 0)throw new Error("Complete invocation coverage cannot name omitted identities.");if(e.continuation!==void 0)throw new Error("Complete invocation coverage cannot provide a continuation.")}else if(e.totalKnown){if(e.complete!==!1)throw new Error("Known incomplete invocation coverage must set complete to false.");if(!Number.isSafeInteger(e.total)||e.total<e.returned)throw new Error("Known invocation coverage total must be a safe integer at least as large as returned.");let n=e.total-e.returned;if(e.omitted!==n)throw new Error("Known invocation coverage omitted count must equal total minus returned.");if(n===0)throw new Error("Known incomplete invocation coverage must omit at least one result.");if(e.omittedIdentities&&e.omittedIdentities.length!==n)throw new Error("Omitted identity count must equal the disclosed omitted count.")}else{if(e.total!==void 0||e.omitted!==void 0)throw new Error("Unknown invocation coverage cannot claim a total or omitted count.");if(e.omittedIdentities!==void 0)throw new Error("Unknown invocation coverage cannot claim omitted identities.")}if(e.continuation&&(e.continuation.cursor.length===0||e.continuation.indexGeneration.length===0))throw new Error("Invocation coverage continuation requires a cursor and index generation.");if(e.resolution){if(!Number.isSafeInteger(e.resolution.totalCandidates)||e.resolution.totalCandidates<0)throw new Error("Invocation resolution candidate count must be a non-negative safe integer.");if(e.resolution.state==="exact"&&e.resolution.totalCandidates!==1)throw new Error("Exact invocation resolution must name exactly one candidate.");if(e.resolution.state==="missing"&&e.resolution.totalCandidates!==0)throw new Error("Missing invocation resolution cannot name candidates.");if(e.resolution.state==="ambiguous"&&e.resolution.totalCandidates<2)throw new Error("Ambiguous invocation resolution must name at least two candidates.")}}function ae(e,n,t){if(!e)return;let o=se(e,n);return e.coverage==="complete"?{complete:!0,totalKnown:!0,returned:o,total:o,omitted:0}:e.coverage==="sampled"?{complete:!1,totalKnown:!1,returned:o}:e.coverage==="bounded"&&t?{complete:!1,totalKnown:!1,returned:o}:{complete:null,totalKnown:!1,returned:o}}function se(e,n){let t=e.resultUnits??{kind:"report"};if(t.kind==="rows")return Array.isArray(n)?n.length:0;if(t.kind==="field"){if(!n||typeof n!="object")return 0;let o=n[t.field];return Array.isArray(o)?o.length:o==null?0:1}return n==null?0:1}function de(e){if(!e||typeof e!="object"||Array.isArray(e))return;let n=e;if(n.matched===!1)return{state:"missing",totalCandidates:0};if(n.matched!==!0||!Number.isSafeInteger(n.totalMatches))return;let t=n.totalMatches;return t<=0?{state:"missing",totalCandidates:0}:t===1?{state:"exact",totalCandidates:t}:{state:"ambiguous",totalCandidates:t}}function ue(e){return e.filter(n=>typeof n=="string"||typeof n=="number"||typeof n=="boolean")}function le(e){if(e.length===0)return{args:[],opts:{}};let n=e[e.length-1];return{args:e.slice(0,-1),opts:me(n)}}function me(e){if(!e||typeof e!="object")return{};let n=e,t=typeof n.optsWithGlobals=="function"?n.optsWithGlobals.bind(n):typeof n.opts=="function"?n.opts.bind(n):null;if(t){let o=t();return!o||typeof o!="object"?{}:(typeof n.getOptionValueSource=="function"&&Object.defineProperty(o,P,{value:r=>n.getOptionValueSource(r),enumerable:!1}),o)}return e}export{ce as a,pe as b,k as c,fe as d,Ie as e,ke as f,Ae as g,Ne as h,m as i,R as j,_e as k,Le as l,Me as m,Z as n,Je as o,ee as p,Pe as q,Te as r,De as s,Be as t,He as u,Qe as v,qe as w,Q as x,d as y,Ke as z,Ue as A,je as B,ne as C,oe as D,le as E,me as F};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{b as I}from"./chunk-YPBKBYPS.js";import{bb as v,ib as s,lb as E,mb as V}from"./chunk-JNXI6NQ7.js";import{c as y}from"./chunk-ZZ3MWF33.js";import{fa as h,pa as S,w}from"./chunk-MEUHIDI3.js";import{G as x}from"./chunk-UQYQBLJX.js";var ce={defaultRole:"repository-observation"};function pe(e,n=[]){return{defaultRole:e,...n.length>0?{rules:n}:{}}}function k(e,n){for(let t of e.rules??[]){if(t.when.kind==="option-present"){let r=n.options[t.when.name];if(r!==void 0&&r!==!1)return t.role;continue}if((t.when.kind==="argument"?n.args[t.when.index]:n.options[t.when.name])===t.when.equals)return t.role}return e.defaultRole}function fe(e){return[...new Set([e.defaultRole,...(e.rules??[]).map(n=>n.role)])]}function A(e){return e==="repository-observation"||e==="repository-preview"||e==="composite"}import{AsyncLocalStorage as z}from"async_hooks";var U=1,j=1;var F={policyId:"codebaseiq:unresolved-repository-policy",policyVersion:j,permission:"not-established",reasons:["No repository action policy was supplied for this claim."]};function N(e){return{schemaVersion:U,origin:e.contract.origin,coverage:$(e.coverage),producerValidation:e.contract.producerValidation,stateAuthority:w(e.receipt,e.receipt),repositoryPolicy:e.repositoryPolicy??F,...e.contract.families?{families:e.contract.families}:{}}}function $(e){return e?e.complete===!0?{state:"complete",returned:e.returned,totalKnown:!0,total:e.total??e.returned,omitted:0}:e.totalKnown?{state:"partial",returned:e.returned,totalKnown:!0,...e.total===void 0?{}:{total:e.total},...e.omitted===void 0?{}:{omitted:e.omitted}}:{state:"unknown",returned:e.returned,totalKnown:!1}:{state:"unknown",returned:0,totalKnown:!1}}var W="codebaseiq-result";var G=1,Y=1,_=1,L=1;function M(e){let n=e.resultSchemaVersion??Y;if(!X(n))throw new Error("CLI result schema version must be a positive safe integer.");let{producerVersion:t,...o}=e;return{kind:W,schemaVersion:G,producer:{name:"codebaseiq",version:t},resultSchemaVersion:n,...o}}function J(e,n){return JSON.stringify(e,null,n?0:2)}function X(e){return Number.isSafeInteger(e)&&Number(e)>0}var P=Symbol("option-value-source"),T=new Map,D=new Map,B=new Map,H=new z;function Ie(e,n){return H.run(e,n)}function ke(e){T=new Map(e)}function Ae(e){D=new Map(e)}function Ne(e){B=new Map(e)}function m(e){return(...n)=>{let{args:t,opts:o}=le(n);S(r=>{I(r.generation.identity),e({db:r,args:t,opts:o})})}}function R(e,n){return m(t=>{let o=V(t.db,e,d(t.opts,"full"),{quiet:d(t.opts,"json")});n({...t,budget:o})})}function _e(e){return m(n=>c(n,e,{kind:"list"}))}function Le(e){return m(n=>c(n,e,{kind:"table",headers:e.headers,dashWidths:e.dashWidths}))}function Me(e){return m(n=>c(n,e,{kind:"grouped",key:e.key}))}function Z(e){return m(n=>b(n,e))}function Je(e){return Z({commandName:e.commandName,query:e.query,emptyMessage:e.emptyMessage,heuristicLabel:e.heuristicLabel,before:e.before,render:(n,t)=>s.sectionedReport(e.sections(n,t)),toJson:e.toJson,coverage:e.coverage,agentResult:e.agentResult,after:e.after})}function ee(e,n){return R(e,t=>b(t,{...n,commandName:n.commandName??e}))}function Pe(e,n){return ee(e,{commandName:n.commandName??e,query:n.query,emptyMessage:n.emptyMessage,heuristicLabel:n.heuristicLabel,before:n.before,render:(t,o)=>s.sectionedReport(n.sections(t,o)),toJson:n.toJson,coverage:n.coverage,agentResult:n.agentResult,after:n.after})}function Te(e,n){return R(e,t=>c(t,{...n,commandName:e},{kind:"list"}))}function De(e,n){return R(e,t=>c(t,{...n,commandName:e},{kind:"grouped",key:n.key}))}function Be(e,n){return String(e[n])}function He(e,n){let t=e[n];return typeof t=="string"?[t]:Array.isArray(t)&&t.every(o=>typeof o=="string")?t:[]}function Qe(e,n){let t=e[n];return typeof t=="string"?t:void 0}function qe(e,n){let t=e[n];return typeof t=="string"?t:void 0}function Q(e,n){let t=e[n];return typeof t=="number"?t:void 0}function d(e,n){return!!e[n]}function Ke(e,n){let t=e[n];return Array.isArray(t)&&t.every(o=>typeof o=="string")?t:[]}function Ue(e,n,t){return Q(e,n)??t}function je(e,n,t){let o=Q(e,n),r=o!==void 0&&ne(e,n)!=="default";if(d(e,"full")){if(r)throw new Error("--full cannot be combined with --limit. Use --full for all findings, or --limit N for a capped report.");return Number.MAX_SAFE_INTEGER}return o??t}function ne(e,n){return e[P]?.(n)}function c(e,n,t){b(e,{commandName:n.commandName,query:n.query,emptyMessage:(o,r)=>o.length===0&&n.emptyMessage?n.emptyMessage(r):void 0,heuristicLabel:n.heuristicLabel,render:(o,r)=>{t.kind==="list"?s.list(o,i=>n.format(i,r)):t.kind==="table"?s.table(t.headers,o.map(i=>n.format(i,r)),t.dashWidths):s.groupedByFile(o,i=>n.format(i,r),t.key?i=>t.key(i,r):void 0)},toJson:n.toJson,coverage:n.coverage,agentResult:n.agentResult,before:n.before,after:n.after})}function b(e,n){let t=n.query(e);if(d(e.opts,"json")){if(!n.commandName)throw new Error("JSON output requires a command name so its result contract can be identified.");oe(n.commandName,e.args,e.opts,n.toJson?n.toJson(t,e):t,{analysisBudget:te(e),coverage:n.coverage?.(t,e),agentResult:n.agentResult?.(t,e),resultSchemaVersion:n.resultSchemaVersion});return}let o=n.emptyMessage?.(t,e);if(o){s.empty(o);return}n.heuristicLabel&&E(n.heuristicLabel),n.before?.(t,e),n.render(t,e),n.after?.(t,e)}function te(e){return e.budget?.analysisBudget}function oe(e,n,t,o,r={}){let i=T.get(e),a=D.get(e),u=B.get(e),p=a?k(a.operation,{args:n,options:t}):void 0,f=H.getStore();if(f!==void 0&&p!==void 0&&f!==p)throw new Error(`Command ${e} changed operation role during execution: selected ${f}, rendered ${p}.`);let g=f??p,O=de(o),C=r.coverage??ae(a,o,r.analysisBudget),l=C&&O&&!C.resolution?{...C,resolution:O}:C;if(l&&ie(l),d(t,"resultOnly")){let K=Object.hasOwn(r,"resultOnly")?r.resultOnly:o;y(JSON.stringify(K,null,d(t,"compact")?0:2));return}let q=M({producerVersion:x,command:e,...g?{operationRole:g}:{},...i?{evidence:i}:{},...r.analysisBudget?{analysisBudget:r.analysisBudget}:{},args:ue(n),options:t,result:o,...l?{coverage:l}:{},...r.agentResult!==void 0?{agentResult:r.agentResult}:{},...re(g,i,r.analysisBudget,l,u,r.observationReceipt),...r.resultSchemaVersion===void 0?{}:{resultSchemaVersion:r.resultSchemaVersion}});y(J(q,d(t,"compact")))}function re(e,n,t,o,r,i){if(!e||!A(e))return{};let a=h(),u=i??(a?v({projectRoot:a.config.projectRoot,db:a,...r?{observedSourceKinds:r.observedSources}:{}}):void 0);return u?{evidenceContext:{schemaVersion:_,operationRole:e,receipt:u,analysisManifest:{schemaVersion:L,...n?{evidence:n}:{},...t?{analysisBudget:t}:{},...o?{coverage:o}:{},...r?{claimQualification:N({contract:r,receipt:u,...o?{coverage:o}:{}})}:{}}}}:{}}function ie(e){if(!Number.isSafeInteger(e.returned)||e.returned<0)throw new Error("Invocation coverage returned count must be a non-negative safe integer.");if(e.complete!==!0&&e.complete!==!1&&e.complete!==null)throw new Error("Invocation coverage complete must be true, false, or null.");if(e.complete===!0){if(!e.totalKnown)throw new Error("Complete invocation coverage must know its total.");if(!Number.isSafeInteger(e.total)||e.total!==e.returned)throw new Error("Complete invocation coverage total must equal returned.");if(e.omitted!==0)throw new Error("Complete invocation coverage cannot omit results.");if(e.omittedIdentities!==void 0)throw new Error("Complete invocation coverage cannot name omitted identities.");if(e.continuation!==void 0)throw new Error("Complete invocation coverage cannot provide a continuation.")}else if(e.totalKnown){if(e.complete!==!1)throw new Error("Known incomplete invocation coverage must set complete to false.");if(!Number.isSafeInteger(e.total)||e.total<e.returned)throw new Error("Known invocation coverage total must be a safe integer at least as large as returned.");let n=e.total-e.returned;if(e.omitted!==n)throw new Error("Known invocation coverage omitted count must equal total minus returned.");if(n===0)throw new Error("Known incomplete invocation coverage must omit at least one result.");if(e.omittedIdentities&&e.omittedIdentities.length!==n)throw new Error("Omitted identity count must equal the disclosed omitted count.")}else{if(e.total!==void 0||e.omitted!==void 0)throw new Error("Unknown invocation coverage cannot claim a total or omitted count.");if(e.omittedIdentities!==void 0)throw new Error("Unknown invocation coverage cannot claim omitted identities.")}if(e.continuation&&(e.continuation.cursor.length===0||e.continuation.indexGeneration.length===0))throw new Error("Invocation coverage continuation requires a cursor and index generation.");if(e.resolution){if(!Number.isSafeInteger(e.resolution.totalCandidates)||e.resolution.totalCandidates<0)throw new Error("Invocation resolution candidate count must be a non-negative safe integer.");if(e.resolution.state==="exact"&&e.resolution.totalCandidates!==1)throw new Error("Exact invocation resolution must name exactly one candidate.");if(e.resolution.state==="missing"&&e.resolution.totalCandidates!==0)throw new Error("Missing invocation resolution cannot name candidates.");if(e.resolution.state==="ambiguous"&&e.resolution.totalCandidates<2)throw new Error("Ambiguous invocation resolution must name at least two candidates.")}}function ae(e,n,t){if(!e)return;let o=se(e,n);return e.coverage==="complete"?{complete:!0,totalKnown:!0,returned:o,total:o,omitted:0}:e.coverage==="sampled"?{complete:!1,totalKnown:!1,returned:o}:e.coverage==="bounded"&&t?{complete:!1,totalKnown:!1,returned:o}:{complete:null,totalKnown:!1,returned:o}}function se(e,n){let t=e.resultUnits??{kind:"report"};if(t.kind==="rows")return Array.isArray(n)?n.length:0;if(t.kind==="field"){if(!n||typeof n!="object")return 0;let o=n[t.field];return Array.isArray(o)?o.length:o==null?0:1}return n==null?0:1}function de(e){if(!e||typeof e!="object"||Array.isArray(e))return;let n=e;if(n.matched===!1)return{state:"missing",totalCandidates:0};if(n.matched!==!0||!Number.isSafeInteger(n.totalMatches))return;let t=n.totalMatches;return t<=0?{state:"missing",totalCandidates:0}:t===1?{state:"exact",totalCandidates:t}:{state:"ambiguous",totalCandidates:t}}function ue(e){return e.filter(n=>typeof n=="string"||typeof n=="number"||typeof n=="boolean")}function le(e){if(e.length===0)return{args:[],opts:{}};let n=e[e.length-1];return{args:e.slice(0,-1),opts:me(n)}}function me(e){if(!e||typeof e!="object")return{};let n=e,t=typeof n.optsWithGlobals=="function"?n.optsWithGlobals.bind(n):typeof n.opts=="function"?n.opts.bind(n):null;if(t){let o=t();return!o||typeof o!="object"?{}:(typeof n.getOptionValueSource=="function"&&Object.defineProperty(o,P,{value:r=>n.getOptionValueSource(r),enumerable:!1}),o)}return e}export{ce as a,pe as b,k as c,fe as d,Ie as e,ke as f,Ae as g,Ne as h,m as i,R as j,_e as k,Le as l,Me as m,Z as n,Je as o,ee as p,Pe as q,Te as r,De as s,Be as t,He as u,Qe as v,qe as w,Q as x,d as y,Ke as z,Ue as A,je as B,ne as C,oe as D,le as E,me as F};
|
|
2
|
+
//# sourceMappingURL=chunk-XUPFA6GH.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{eb as he,gb as z}from"./chunk-
|
|
1
|
+
import{eb as he,gb as z}from"./chunk-JNXI6NQ7.js";import{b as le}from"./chunk-ZZ3MWF33.js";import{j as ge,l as P,r as v}from"./chunk-D7DOB27N.js";import{c as de,d as pe,e as D}from"./chunk-6O3KXIDL.js";import{h as b}from"./chunk-UQYQBLJX.js";import{AsyncLocalStorage as nt}from"async_hooks";import{createHash as V}from"crypto";import{existsSync as rt,mkdirSync as st}from"fs";import{tmpdir as it}from"os";import{isAbsolute as ot,join as ye,resolve as Se}from"path";var q=2,at="CODEBASEIQ_SESSION",me="CODEBASEIQ_SESSION_DIR",ut=128,I=new nt;function ve(e,t){let n=e.sessionEnabled===!1||e.json?void 0:It(),r={enabled:n!==void 0,reemit:e.reemit===!0,command:e.command,projectRoot:Se(e.cwd),sessionIdentity:n,staged:[],stagedEvidence:[],finalized:!1};return I.run(r,t)}function Dn(e){let t=I.getStore();!t||t.finalized||(t.generationIdentity=e)}function zn(){return I.getStore()?.staged.length??0}function qn(e){let t=I.getStore();!t||e<0||e>t.staged.length||(t.staged.length=e)}function W(e){let t=I.getStore();if(!t||t.finalized)return;t.finalized=!0;let n=t.state;if(!n){t.staged.length=0,t.stagedEvidence.length=0;return}try{if(e&&(t.staged.length>0||t.stagedEvidence.length>0)){let r=n.ledger.nextOrdinal,s=yt(t.staged).map(o=>({...o,ordinal:r,command:t.command})),i=vt(t.stagedEvidence).map(o=>({...o,ordinal:r,command:t.command}));n.ledger.ranges.push(...s),n.ledger.evidence.push(...i),n.ledger.nextOrdinal+=1,n.ledger.updatedAt=new Date().toISOString(),v(n.ledgerPath,n.ledger,{spacing:2,trailingNewline:!0})}}catch{}finally{n.lock.release(),t.state=null,t.staged.length=0,t.stagedEvidence.length=0}}function Vn(e){let t=e.source.split(`
|
|
2
2
|
`);if(t.length===0)return"";let n=ct(e.relativePath,e.startLine,t,e.ownerSymbol,e.sessionPolicy??"exact-unit"),r=e.indent??" ",s=e.sourceIndent??" ",i=e.focusLines??new Set;return n.map(o=>{let a=z(e.relativePath,o.startLine,o.endLine);if(o.kind==="covered"){let p=o.ordinal===null?"this command":`session #${o.ordinal} via ${o.command}`;return[`${r}${a} [source previously emitted: ${p}; not repeated]`,...e.afterHeader??[]].join(`
|
|
3
3
|
`)}let u=e.headerSuffix??"",d=o.lines.map((p,l)=>{let g=o.startLine+l,c=e.showFocusMarker===!1?"":i.has(g)?">":" ",m=e.lineNumberWidth??5;return`${s}${c}${String(he(g)).padStart(m)} ${p}`});return[`${r}${a}${u}`,...e.blankAfterHeader?[""]:[],...e.afterHeader??[],...d].join(`
|
|
4
4
|
`)}).join(`
|
|
@@ -18,4 +18,4 @@ ${t.command}]
|
|
|
18
18
|
`:`
|
|
19
19
|
[codebaseiq transport complete; evaluate command coverage separately]
|
|
20
20
|
`;return`${r}${e.content}${s}`}export{Ae as a,Dn as b,zn as c,qn as d,Vn as e,Wn as f,Gn as g,tr as h,nr as i,Ft as j,M as k,sn as l,Or as m,br as n};
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-YPBKBYPS.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as S}from"./chunk-LQHYYIOB.js";import{c as m}from"./chunk-
|
|
1
|
+
import{c as S}from"./chunk-LQHYYIOB.js";import{c as m}from"./chunk-BPKNP3KZ.js";import{h as y}from"./chunk-KLX6NSWT.js";import{a as h}from"./chunk-BRQL7AFJ.js";import{p}from"./chunk-F74LZWCE.js";import{a as g}from"./chunk-ICUL7XRT.js";import f from"path";function W(e,t){let{scope:i,minDeviation:r=5,limit:n=50}=t??{},a=t?.semantic!==!1,u=t?.includePatternDeviations===!0,o=new m(e).fileDependencyGraph(i),l=S(e,{scope:i}),c=x([...D(e,o,{scope:i,semantic:a}),...R(l.forbiddenEdges),...u?E(o,r):[]]);return t?.includeArchitecture===!0&&(c.architecture=l),n<=0||c.results.length<=n?c:{...c,results:c.results.slice(0,n),totalResults:c.results.length}}function D(e,t,i){let r=_(e,i.scope),n=[],a=new Set;for(let[s,o]of t){if(d(s))continue;let l=r.get(s)??new Set;for(let c of o)d(c)||l.has(c)||v(e,s,c,i)||(n.push({file:s,dep:c}),a.add(s))}a.size>0&&w(e,r,{paths:[...a]});let u=[];for(let{file:s,dep:o}of n)(r.get(s)??new Set).has(o)||u.push({file:s,kind:"unused-import",description:`Depends on ${o} but references none of its symbols`,dep:o,actionTier:"direct",evidenceReasons:[`dependency edge exists from ${s} to ${o}`,"no semantic, source, type-only, side-effect, or Vue-template usage survived the conservative skip gates"],recommendation:"Remove the unused import or dependency edge after running the project checks."});return u}function v(e,t,i,r){return C(e,t,i)||M(e,t,i)||O(i)||P(e,t,i)||N(i)?!0:r.semantic&&A(e,t,i)}function R(e){return e.flatMap(t=>{let i=t.examples[0];return i?[{file:i.fromFile,kind:"architecture-violation",description:`${t.from} depends on forbidden boundary ${t.to} through ${t.fileEdgeCount} file edge(s)`,dep:i.toFile,detail:`${t.from} may not depend on ${t.to}`,actionTier:"direct",policyBasis:"explicit",architecture:{fromBoundary:t.from,toBoundary:t.to,fileEdgeCount:t.fileEdgeCount,importerCount:t.importerCount,importedFileCount:t.importedFileCount,examples:t.examples},evidenceReasons:[`configured dependency row for ${t.from} does not allow ${t.to}`,`${t.fileEdgeCount} file edge(s) connect ${t.importerCount} importer(s) to ${t.importedFileCount} imported file(s)`,...t.examples.map(r=>`${r.fromFile} imports ${r.toFile}`)],recommendation:"Move the dependency behind an allowed boundary, reverse the dependency through an owned interface, or deliberately update the project architecture rule."}]:[]})}function E(e,t){let i=[];for(let[r,n]of k(e)){let a=n.filter(s=>!d(s));if(a.length<t)continue;let u=I(e,a);for(let s of a)for(let o of e.get(s)??[])d(o)||(u.get(o)??0)===1&&f.dirname(o)!==r&&f.dirname(o)!==f.dirname(r)&&i.push({file:s,kind:"pattern-deviation",description:`Only file in ${r}/ that depends on ${o}`,dep:o,actionTier:"signal",evidenceReasons:[`${a.length} sibling file(s) in ${r}/ were compared`,`${s} is the only non-skipped sibling depending on ${o}`],recommendation:"Review sibling ownership before changing this import; unique dependency shape can be intentional specialization."})}return i}function x(e){let t=e.filter(i=>i.kind==="architecture-violation").length;return{results:e,unusedImports:e.filter(i=>i.kind==="unused-import").length,architectureViolations:t,layerViolations:t,patternDeviations:e.filter(i=>i.kind==="pattern-deviation").length}}function k(e){let t=new Map;for(let i of e.keys()){let r=f.dirname(i),n=t.get(r);n||(n=[],t.set(r,n)),n.push(i)}return t}function I(e,t){let i=new Map;for(let r of t)for(let n of e.get(r)??[])d(n)||i.set(n,(i.get(n)??0)+1);return i}function _(e,t){let i=new Map;return $(e,i,t),i}function $(e,t,i){for(let r of F(e,i))b(e,t,r.from_file,r.to_file)}function F(e,t){let i=t?"AND d1.relative_path LIKE ?":"",r=t?[`%${t}%`]:[];return e.all(`SELECT DISTINCT d1.relative_path AS from_file, d2.relative_path AS to_file
|
|
2
2
|
FROM mentions m
|
|
3
3
|
JOIN chunks c ON m.chunk_id = c.id
|
|
4
4
|
JOIN documents d1 ON c.document_id = d1.id
|
|
@@ -15,4 +15,4 @@ import{c as S}from"./chunk-LQHYYIOB.js";import{c as m}from"./chunk-HENP2O4A.js";
|
|
|
15
15
|
AND m.role != 1
|
|
16
16
|
${e.pathExclusionsFor("d1","d2")}
|
|
17
17
|
${i}`,...r)}function w(e,t,i={}){new m(e).scanSourceReferences({paths:i.paths??g(e,{includeIgnored:!1}),includeRustAttributeNames:!0,identifierResolution:"permissive"},n=>{n.target.relativePath!==n.sourceFile&&(e.isIgnored(n.target.relativePath)||b(e,t,n.sourceFile,n.target.relativePath))})}function b(e,t,i,r){if(e.isIgnored(i)||e.isIgnored(r))return;let n=t.get(i);n||(n=new Set,t.set(i,n)),n.add(r)}function O(e){return e.includes("types")||e.endsWith(".d.ts")}function A(e,t,i){let r=y(e,t).filter(n=>n.sourcePath===i);return r.length>0&&r.some(n=>n.isUsed)}function C(e,t,i){let r=p(e,t).filter(n=>n.sourcePath===i);return r.length>0&&r.some(n=>n.used)}function M(e,t,i){let r=p(e,t).filter(n=>n.sourcePath===i);return r.length>0&&r.every(n=>n.isTypeOnly===!0)}function N(e){return e.endsWith(".vue")}function P(e,t,i){let r=p(e,t).filter(n=>n.sourcePath===i);return r.length===0?!1:r.every(n=>n.kind==="side-effect"||n.kind==="namespace"&&n.usedMembers.length===0&&!n.used)}function d(e){let t=h(e);return!!(t==="entry"||t==="barrel"||t==="test"||t==="worker"||T(f.basename(e)))}function T(e){return!!(e==="index.ts"||e==="index.js"||e==="cli.ts"||e==="main.ts"||e==="main.rs"||e.includes("worker.")||e.includes("postinstall.")||e==="health.ts"||e==="health.js")}export{W as a};
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
18
|
+
//# sourceMappingURL=chunk-Z66XYVLZ.js.map
|