@visulima/vis 1.0.0-alpha.28 → 1.0.0-alpha.29
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 +35 -0
- package/LICENSE.md +24 -24
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/packem_chunks/bin.js +297 -297
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/config.js +12 -12
- package/dist/packem_chunks/doctor-probe.js +1 -1
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -2
- package/dist/packem_chunks/handler11.js +5 -1
- package/dist/packem_chunks/handler12.js +1 -5
- package/dist/packem_chunks/handler13.js +27 -1
- package/dist/packem_chunks/handler14.js +5 -27
- package/dist/packem_chunks/handler15.js +1 -5
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +5 -1
- package/dist/packem_chunks/handler21.js +2 -5
- package/dist/packem_chunks/handler22.js +2 -2
- package/dist/packem_chunks/handler23.js +1 -2
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +5 -1
- package/dist/packem_chunks/handler26.js +1 -5
- package/dist/packem_chunks/handler27.js +3 -1
- package/dist/packem_chunks/handler28.js +1 -3
- package/dist/packem_chunks/handler29.js +7 -1
- package/dist/packem_chunks/handler3.js +4 -4
- package/dist/packem_chunks/handler30.js +32 -6
- package/dist/packem_chunks/handler31.js +3 -33
- package/dist/packem_chunks/handler32.js +8 -3
- package/dist/packem_chunks/handler33.js +1 -1
- package/dist/packem_chunks/handler34.js +2 -2
- package/dist/packem_chunks/handler35.js +11 -3
- package/dist/packem_chunks/handler36.js +3 -22
- package/dist/packem_chunks/handler37.js +21 -60
- package/dist/packem_chunks/handler38.js +61 -3
- package/dist/packem_chunks/handler39.js +3 -6
- package/dist/packem_chunks/handler4.js +1 -1
- package/dist/packem_chunks/handler40.js +6 -24
- package/dist/packem_chunks/handler41.js +24 -153
- package/dist/packem_chunks/handler42.js +153 -25
- package/dist/packem_chunks/handler43.js +25 -10
- package/dist/packem_chunks/handler44.js +10 -708
- package/dist/packem_chunks/handler45.js +708 -24
- package/dist/packem_chunks/handler46.js +24 -322
- package/dist/packem_chunks/handler47.js +322 -48
- package/dist/packem_chunks/handler48.js +48 -3
- package/dist/packem_chunks/handler49.js +3 -27
- package/dist/packem_chunks/handler5.js +7 -7
- package/dist/packem_chunks/handler50.js +21 -189
- package/dist/packem_chunks/handler51.js +194 -33
- package/dist/packem_chunks/handler52.js +34 -0
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +1 -1
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +4 -4
- package/dist/packem_chunks/index.js +2 -2
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/loader2.js +1 -1
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/run.js +1 -1
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tripwire.js +2 -2
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_shared/Table-3pFgIUZ2-DABgc6rj.js +12 -0
- package/dist/packem_shared/{advisories-BxXiKFbL.js → advisories-DpgSuWDH.js} +1 -1
- package/dist/packem_shared/{affected-shas-Dm7eqcI8.js → affected-shas-BkXXecyi.js} +1 -1
- package/dist/packem_shared/ai-analysis-KP8b5lc0.js +68 -0
- package/dist/packem_shared/{ai-fix-BGbnrWCz.js → ai-fix-CfFWatGY.js} +7 -7
- package/dist/packem_shared/{applyDefaults-KxZkvlp3.js → applyDefaults-DLvOqXGX.js} +1 -1
- package/dist/packem_shared/{build-scripts-3E2pmscY.js → build-scripts-D-ysm_bS.js} +1 -1
- package/dist/packem_shared/{cyclonedx-C2k2HmvI.js → cyclonedx-B04lIvwu.js} +3 -3
- package/dist/packem_shared/{dependency-scan-Bki15Yi-.js → dependency-scan-B9wTcLxf.js} +1 -1
- package/dist/packem_shared/{docker-k-Sl8b-w.js → docker-DxA80dRx.js} +1 -1
- package/dist/packem_shared/{failure-log-C3bG1bCA.js → failure-log-n3j_-w8s.js} +1 -1
- package/dist/packem_shared/index-BDF8gawl.js +29 -0
- package/dist/packem_shared/{index-DBq4TVu5.js → index-BfG9_znI.js} +1 -1
- package/dist/packem_shared/{lifecycle-B91p_ra8.js → lifecycle-NHIKDiCh.js} +1 -1
- package/dist/packem_shared/lockfile-CoeFxWAv.js +1 -0
- package/dist/packem_shared/lockfile-DAuTDwow.js +1 -0
- package/dist/packem_shared/{manifests-Z3spBpxv.js → manifests-B7wUR3Rk.js} +1 -1
- package/dist/packem_shared/{min-release-age-B1Jm1_JY.js → min-release-age-YyNI7gqV.js} +1 -1
- package/dist/packem_shared/{native-config-sync-Cnpj2xcn.js → native-config-sync-CgRIIRZV.js} +7 -7
- package/dist/packem_shared/{osv-bloom-ep8GlDGT.js → osv-bloom-BQSIHt5h.js} +2 -2
- package/dist/packem_shared/{pm-runner-COoPLGKi.js → pm-runner-Ta_yz2uP.js} +1 -1
- package/dist/packem_shared/{provenance-DbkJRDqt.js → provenance-DoEp2uOo.js} +1 -1
- package/dist/packem_shared/{readFileSync-CGmzMUF2-D6rUjGDn.js → readFileSync-4c_c6Qey-6SWMDNdw.js} +1 -1
- package/dist/packem_shared/{registry-keys-SylX07bs.js → registry-keys-CD1xHavV.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-CJ_5wYSu.js → resolve-explicit-DpSc7RN2.js} +1 -1
- package/dist/packem_shared/{runtime-check-DgXsKCsv.js → runtime-check-Cbtb_Utb.js} +1 -1
- package/dist/packem_shared/{s1ngularity-DlS-4a6K.js → s1ngularity-CIX7UcT5.js} +1 -1
- package/dist/packem_shared/scan-progress-CTVVf9WW.js +2 -0
- package/dist/packem_shared/{selectors-BE2BCnTR.js → selectors-BU8aTRQm.js} +1 -1
- package/dist/packem_shared/{signatures-B-1u4t-c.js → signatures-BHM7cnqB.js} +1 -1
- package/dist/packem_shared/{spinner-B9ZPv1iT.js → spinner-C8xs6QZv.js} +1 -1
- package/dist/packem_shared/{tabs-C-qFIoUv.js → tabs-xZkm6Y_J.js} +1 -1
- package/dist/packem_shared/{toolchain-Jx2lkAYy.js → toolchain-juKl-WgV.js} +1 -1
- package/dist/packem_shared/typosquats-DRKU6d2S.js +1 -0
- package/dist/packem_shared/{use-measured-height-kIDCuc76.js → use-measured-height-Lea6TCVD.js} +1 -1
- package/dist/packem_shared/{verify-C8EAHql6.js → verify-DA80ja1b.js} +1 -1
- package/dist/packem_shared/{vis-update-app-COYmjGKv.js → vis-update-app-BCKzlqj8.js} +1 -1
- package/dist/packem_shared/{watch-BSVsZ_1I.js → watch-DdR-pFzX.js} +1 -1
- package/dist/packem_shared/{watch-loop-CP318TfG.js → watch-loop-C8csFvRU.js} +1 -1
- package/index.d.ts +201 -201
- package/index.js +567 -751
- package/package.json +13 -13
- package/dist/packem_shared/Table-CwC2kW07-EjFLNV0q.js +0 -12
- package/dist/packem_shared/ai-analysis-BnmDFqc8.js +0 -68
- package/dist/packem_shared/index-2r730kXY.js +0 -29
- package/dist/packem_shared/lockfile-DmDfgKaT.js +0 -1
- package/dist/packem_shared/scan-progress-CU4ttEHQ.js +0 -2
- package/dist/packem_shared/typosquats-BxCOUvTJ.js +0 -1
|
@@ -1,10 +1,25 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)){if(o.length===0)continue;const n=/^\s*(\d+)\s+(.+)$/.exec(o);if(!n)continue;const l=Number.parseInt(n[1]??"",10),c=(n[2]??"").toLowerCase();!Number.isFinite(l)||l===e||(/(?:^|[ /])vis-native(?:\s|$|[-.])/.test(c)||/(?:^|[ /])vis\s+run\b/.test(c)||/(?:^|[ /])task-runner(?:\s|$|[-.])/.test(c))&&i.push(l)}return i},"listOrphansUnix"),yt=M(e=>{const t=mt("tasklist",["/FO","CSV","/NH"]),i=[];for(const o of t.split(/\r?\n/)){if(o.length===0)continue;const n=o.split(/","/).map(h=>h.replaceAll(/^"|"$/g,"")),l=(n[0]??"").toLowerCase(),c=Number.parseInt(n[1]??"",10);!Number.isFinite(c)||c===e||(l==="vis.exe"||l.startsWith("vis-native")||l.includes("task-runner"))&&i.push(c)}return i},"listOrphansWindows"),Fi=M(()=>{let e;try{const t=Ee("watchman",["--version"],{encoding:"utf8",timeout:2e3});if(t.error||typeof t.status=="number"&&t.status!==0)throw t.error??new Error("watchman exited non-zero");e=typeof t.stdout=="string"?t.stdout.trim():void 0}catch{return{id:"watchman",message:"Watchman not found — `vis` uses native fs.watch (fine for small repos). Install Watchman + `fb-watchman` to scale watch mode on large monorepos.",status:"skip"}}return{detail:e?{version:e}:void 0,id:"watchman",message:e?`Watchman available (${e}) — scalable watch backend in use.`:"Watchman available — scalable watch backend in use.",status:"ok"}},"checkWatchmanAvailability"),Mi=M((e=process.cwd())=>{let t="";try{t=ut(J(e,".gitattributes"),"utf8")}catch(i){if(i.code!=="ENOENT")return{id:"git-lfs",message:"Could not read .gitattributes.",status:"warn"}}if(!t.includes("filter=lfs"))return{id:"git-lfs",message:"No Git LFS tracking declared in .gitattributes.",status:"skip"};try{const i=Ee("git",["lfs","version"],{encoding:"utf8",timeout:2e3});if(i.error||typeof i.status=="number"&&i.status!==0)throw i.error??new Error("git-lfs not available")}catch{return{id:"git-lfs",message:"Repo tracks files via Git LFS but `git-lfs` is not installed — checked-out LFS files are pointer stubs, not real content. Install git-lfs and run `git lfs pull`.",status:"warn"}}return{id:"git-lfs",message:"Git LFS tracking declared and `git-lfs` is installed.",status:"ok"}},"checkGitLfsTracking"),Ei=M(e=>[Si(),Ci(),Fi(),Mi(e),Ti()],"runRuntimeDiagnostics");var zi=Object.defineProperty,ke=T((e,t)=>zi(e,"name",{value:t,configurable:!0}),"s$2");const ye=[{id:"dependencies",label:"Deps"},{id:"security",label:"Security"},{id:"optimization",label:"Optimize"},{id:"runtime",label:"Runtime"}],Fe=["dependencies","security","optimization","runtime"],me=ke(e=>{const t=new Map;for(const i of Fe)t.set(i,[]);for(const i of e)t.get(i.section).push(i);for(const[i,o]of t)o.length===0&&t.delete(i);return t},"groupBySection"),xe=ke((e,t,i,o)=>{let n=e.filter(l=>l.section===t);if(o&&(n=n.filter(l=>l.severity===o)),i){const l=i.toLowerCase();n=n.filter(c=>c.title.toLowerCase().includes(l))}return[...n]},"filterFindings"),Bi=ke(e=>{const t={dependencies:"idle",optimization:"idle",runtime:"idle",security:"idle"};for(const i of Fe)e.has(i)&&(t[i]="idle");return t},"initialStatus");class Ze{static{T(this,"DoctorStore")}static{ke(this,"DoctorStore")}#e;#i=new Set;constructor(t=[]){const i=Array.isArray(t)?{findings:t}:t,o=i.findings??[],n=i.activeSections??new Set(Fe),l=Fe.find(a=>n.has(a))??"dependencies",c=xe(o,l,"",void 0),h=Bi(n);if(o.length>0)for(const a of o)h[a.section]="done";this.#e={all:o,entries:c,filterActive:!1,filterText:"",filterType:l,focusedPanel:"list",grouped:me(c),pendingAction:void 0,sectionError:{},sectionMessage:{},sectionStatus:h,selectedIndex:0,severityFilter:void 0}}getSnapshot=ke(()=>this.#e,"getSnapshot");subscribe=ke(t=>(this.#i.add(t),()=>{this.#i.delete(t)}),"subscribe");setSelectedIndex(t){const i=Math.max(0,Math.min(t,this.#e.entries.length-1));i!==this.#e.selectedIndex&&this.#t({...this.#e,selectedIndex:i})}setFocusedPanel(t){t!==this.#e.focusedPanel&&this.#t({...this.#e,focusedPanel:t})}setFilterType(t){if(t===this.#e.filterType)return;const i=xe(this.#e.all,t,this.#e.filterText,this.#e.severityFilter);this.#t({...this.#e,entries:i,filterType:t,grouped:me(i),selectedIndex:0})}setFilter(t){const i=xe(this.#e.all,this.#e.filterType,t,this.#e.severityFilter);this.#t({...this.#e,entries:i,filterText:t,grouped:me(i),selectedIndex:0})}setFilterActive(t){if(t===this.#e.filterActive)return;if(t){this.#t({...this.#e,filterActive:!0});return}const i=xe(this.#e.all,this.#e.filterType,"",this.#e.severityFilter);this.#t({...this.#e,entries:i,filterActive:!1,filterText:"",grouped:me(i),selectedIndex:0})}setPendingAction(t){this.#t({...this.#e,pendingAction:t})}setSeverityFilter(t){if(t===this.#e.severityFilter)return;const i=xe(this.#e.all,this.#e.filterType,this.#e.filterText,t);this.#t({...this.#e,entries:i,grouped:me(i),selectedIndex:0,severityFilter:t})}startSection(t,i){this.#t({...this.#e,sectionMessage:{...this.#e.sectionMessage,[t]:i},sectionStatus:{...this.#e.sectionStatus,[t]:"running"}})}completeSection(t,i){const o=[...this.#e.all,...i],n=xe(o,this.#e.filterType,this.#e.filterText,this.#e.severityFilter),l={...this.#e.sectionMessage};delete l[t],this.#t({...this.#e,all:o,entries:n,grouped:me(n),sectionMessage:l,sectionStatus:{...this.#e.sectionStatus,[t]:"done"}})}failSection(t,i){this.#t({...this.#e,sectionError:{...this.#e.sectionError,[t]:i},sectionStatus:{...this.#e.sectionStatus,[t]:"error"}})}#t(t){this.#e=t;for(const i of this.#i)try{i()}catch{}}}var Li=Object.defineProperty,kt=T((e,t)=>Li(e,"name",{value:t,configurable:!0}),"r$1");const et={error:0,warn:1},Vi=kt(e=>!!e.acceptedRisk,"isAcknowledged"),wt=kt(e=>{const t=[];if(e.sections.has("dependencies")){for(const i of e.outdated)t.push({entry:i,id:`outdated:${i.packageName}`,kind:"outdated",section:"dependencies",severity:"warn",subtitle:`${i.currentRange} → ${i.newRange} (${i.updateType})`,title:i.packageName});for(const i of e.duplicates)t.push({id:`duplicate:${i.name}`,kind:"duplicate",pkg:i,section:"dependencies",severity:"warn",subtitle:`${String(i.versions.length)} versions installed`,title:i.name})}if(e.sections.has("security"))for(const i of e.outdated){if(i.vulnerabilities&&i.vulnerabilities.length>0){const o=i.vulnerabilities[0],n=Vi(i)?"warn":"error",l=i.vulnerabilities.length;t.push({entry:i,id:`vuln:${i.packageName}`,kind:"vulnerability",packageName:i.packageName,section:"security",severity:n,subtitle:l===1?`${o.severity} · ${o.id}`:`${String(l)} advisories · top: ${o.severity} ${o.id}`,title:i.packageName})}if(i.socketReport&&i.socketReport.alerts.length>0){const o=Math.round(i.socketReport.score.overall*100);t.push({entry:i,id:`socket:${i.packageName}`,kind:"socket",packageName:i.packageName,section:"security",severity:"warn",subtitle:`${String(i.socketReport.alerts.length)} alert${i.socketReport.alerts.length===1?"":"s"} · score ${String(o)}%`,title:i.packageName})}}if(e.sections.has("optimization"))for(const i of e.optimizations)t.push({entry:i,id:`opt:${i.packageName}`,kind:"optimization",section:"optimization",severity:"warn",subtitle:`${i.category} → ${i.replacement}`,title:i.packageName});if(e.sections.has("runtime"))for(const i of e.runtime)i.status==="warn"&&t.push({diagnostic:i,id:`runtime:${i.id}`,kind:"runtime",section:"runtime",severity:"warn",title:i.message});return t.sort((i,o)=>{if(i.section!==o.section){const n=["dependencies","security","optimization","runtime"];return n.indexOf(i.section)-n.indexOf(o.section)}return et[i.severity]-et[o.severity]}),t},"flattenFindings"),vt={dependencies:"Dependencies",optimization:"Optimization",runtime:"Runtime",security:"Security"};var Ui=Object.defineProperty,Gi=T((e,t)=>Ui(e,"name",{value:t,configurable:!0}),"a$2");const _i={error:"red",warn:"yellow"},Hi={error:"✖",warn:"⚠"},Ki={error:" ERROR ",warn:" WARN "},Yi=Gi(({children:e,hint:t,message:i,severity:o,title:n})=>{const l=_i[o];return s.jsxs(u,{borderColor:l,borderStyle:"single",flexDirection:"column",flexShrink:0,paddingX:1,children:[s.jsxs(u,{gap:1,children:[s.jsx(r,{backgroundColor:l,bold:!0,color:"black",children:Ki[o]}),s.jsx(r,{bold:!0,color:l,children:Hi[o]}),s.jsx(r,{bold:!0,wrap:"truncate-end",children:n})]}),s.jsx(r,{wrap:"truncate-end",children:i}),t?s.jsx(r,{dimColor:!0,wrap:"truncate-end",children:t}):null,e]})},"ConfigBanner");var Wi=Object.defineProperty,te=T((e,t)=>Wi(e,"name",{value:t,configurable:!0}),"d$2");const Ji={CRITICAL:"red",HIGH:"red",LOW:"gray",MODERATE:"yellow",UNKNOWN:"gray"},qi={critical:"red",high:"red",low:"gray",medium:"yellow"},Xi={major:"red",minor:"yellow",patch:"green"},R=te(({children:e,label:t,width:i=14})=>s.jsxs(u,{children:[s.jsx(u,{width:i,children:s.jsxs(r,{dimColor:!0,children:[t,":"]})}),typeof e=="string"?s.jsx(r,{children:e}):e]}),"FieldRow"),ne=te(({children:e})=>s.jsx(u,{marginTop:1,children:s.jsx(r,{bold:!0,color:"white",children:e})}),"SectionTitle"),Qi=te(({finding:e})=>{const{entry:t}=e,i=Xi[t.updateType]??"white";return s.jsxs(u,{flexDirection:"column",children:[s.jsx(R,{label:"Current",children:t.currentRange}),s.jsxs(R,{label:"Target",children:[s.jsx(r,{children:t.newRange}),s.jsxs(r,{bold:!0,color:i,children:[" (",t.updateType,")"]})]}),s.jsx(R,{label:"Catalog",children:t.catalogName}),t.acceptedRisk?s.jsx(R,{label:"Risk ack",children:s.jsx(r,{dimColor:!0,children:t.acceptedRisk.reason??"(no reason recorded)"})}):null,s.jsx(ne,{children:"Action"}),s.jsxs(r,{dimColor:!0,children:["Run"," ",s.jsx(r,{bold:!0,color:"white",children:"vis update"})," ","to apply this change."]})]})},"OutdatedDetail"),Zi=te(({finding:e})=>s.jsxs(u,{flexDirection:"column",children:[s.jsx(R,{label:"Versions",children:s.jsx(r,{children:String(e.pkg.versions.length)})}),s.jsx(ne,{children:"Installed versions"}),e.pkg.versions.map(t=>s.jsxs(r,{children:[" · ",t]},t)),s.jsx(ne,{children:"Action"}),s.jsxs(r,{dimColor:!0,children:["Run"," ",s.jsx(r,{bold:!0,color:"white",children:"vis dedupe"})," ","to consolidate to a single resolution."]})]}),"DuplicateDetail"),es=te(({finding:e})=>{const t=e.entry.vulnerabilities??[];return s.jsxs(u,{flexDirection:"column",children:[s.jsx(R,{label:"Package",children:e.packageName}),s.jsx(R,{label:"Current",children:e.entry.currentRange}),s.jsx(R,{label:"Advisories",children:String(t.length)}),e.entry.acceptedRisk?s.jsx(R,{label:"Risk ack",children:s.jsx(r,{dimColor:!0,children:e.entry.acceptedRisk.reason??"(no reason recorded)"})}):null,t.map(i=>{const o=Ji[i.severity]??"gray";return s.jsxs(u,{flexDirection:"column",marginTop:1,children:[s.jsxs(u,{children:[s.jsx(r,{bold:!0,color:o,children:i.severity}),s.jsx(r,{children:" "}),s.jsx(r,{children:i.id}),typeof i.cvssScore=="number"?s.jsxs(r,{dimColor:!0,children:[" · CVSS ",i.cvssScore.toFixed(1)]}):null]}),s.jsx(r,{wrap:"wrap",children:i.summary}),i.fixedVersions.length>0?s.jsxs(r,{dimColor:!0,children:["Fixed in: ",i.fixedVersions.join(", ")]}):null,i.aliases&&i.aliases.length>0?s.jsxs(r,{dimColor:!0,children:["Aliases: ",i.aliases.join(", ")]}):null]},i.id)})]})},"VulnerabilityDetail"),ts=te(({finding:e})=>{const t=e.entry.socketReport;if(!t)return s.jsx(r,{dimColor:!0,children:"No Socket report attached."});const i=Math.round(t.score.overall*100),o=We(t.score.overall);return s.jsxs(u,{flexDirection:"column",children:[s.jsx(R,{label:"Package",children:e.packageName}),s.jsx(R,{label:"Overall",children:s.jsxs(r,{color:o,children:[String(i),"%"]})}),s.jsx(R,{label:"Alerts",children:String(t.alerts.length)}),e.entry.acceptedRisk?s.jsx(R,{label:"Risk ack",children:s.jsx(r,{dimColor:!0,children:e.entry.acceptedRisk.reason??"(no reason recorded)"})}):null,s.jsx(ne,{children:"Score breakdown"}),Object.entries(t.score).map(([n,l])=>{if(n==="overall")return null;const c=typeof l=="number"?l:0,h=Math.round(c*100),a=We(c);return s.jsxs(u,{children:[s.jsx(u,{width:14,children:s.jsxs(r,{dimColor:!0,children:[n,":"]})}),s.jsxs(r,{color:a,children:[String(h),"%"]})]},n)}),s.jsx(ne,{children:"Alerts"}),t.alerts.map((n,l)=>{const c=qi[n.severity]??"gray";return s.jsxs(u,{flexDirection:"column",marginBottom:1,children:[s.jsxs(u,{children:[s.jsx(r,{bold:!0,color:c,children:n.severity}),s.jsx(r,{children:" "}),s.jsx(r,{children:n.type})]}),n.props?s.jsx(r,{dimColor:!0,wrap:"wrap",children:JSON.stringify(n.props)}):null]},`${n.type}-${String(l)}`)})]})},"SocketDetail"),is=te(({finding:e})=>{const{entry:t}=e;return s.jsxs(u,{flexDirection:"column",children:[s.jsx(R,{label:"Package",children:t.packageName}),s.jsx(R,{label:"Category",children:t.category}),s.jsx(R,{label:"Replacement",children:t.replacement}),t.overrideSpec?s.jsx(R,{label:"Override",children:t.overrideSpec}):null,s.jsx(R,{label:"Codemod",children:s.jsx(r,{color:t.hasCodemod?"green":"gray",children:t.hasCodemod?"available":"not available"})}),t.docUrl?s.jsx(R,{label:"Guide",children:s.jsx(r,{color:"cyan",underline:!0,children:t.docUrl})}):null,s.jsx(ne,{children:"Action"}),t.hasCodemod?s.jsxs(r,{dimColor:!0,children:["Run"," ",s.jsx(r,{bold:!0,color:"white",children:"vis optimize"})," ","to apply the codemod interactively."]}):t.overrideSpec?s.jsxs(r,{dimColor:!0,children:["Run"," ",s.jsx(r,{bold:!0,color:"white",children:"vis optimize"})," ","to install the package override."]}):t.docUrl?s.jsx(r,{dimColor:!0,children:"No automated codemod. Open the migration guide above for the recommended alternative and steps."}):s.jsx(r,{dimColor:!0,children:"No automated codemod. Consult the package's docs or the e18e module-replacements guide for an alternative."})]})},"OptimizationDetail"),ss=te(({finding:e})=>{const{diagnostic:t}=e,i=t.status==="warn"?"yellow":t.status==="ok"?"green":"gray";return s.jsxs(u,{flexDirection:"column",children:[s.jsx(R,{label:"Check",children:t.id}),s.jsx(R,{label:"Status",children:s.jsx(r,{color:i,children:t.status})}),s.jsx(ne,{children:"Message"}),s.jsx(r,{wrap:"wrap",children:t.message}),t.detail&&Object.keys(t.detail).length>0?s.jsxs(s.Fragment,{children:[s.jsx(ne,{children:"Details"}),Object.entries(t.detail).map(([o,n])=>s.jsxs(u,{children:[s.jsx(u,{width:20,children:s.jsxs(r,{dimColor:!0,children:[o,":"]})}),s.jsx(r,{children:String(n)})]},o))]}):null]})},"RuntimeDetail"),rs=te(({finding:e,focused:t,scrollRef:i})=>{const o=t?"white":"gray";if(!e)return s.jsx(u,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:s.jsx(r,{dimColor:!0,children:"No finding selected"})});let n;switch(e.kind){case"duplicate":{n=s.jsx(Zi,{finding:e});break}case"optimization":{n=s.jsx(is,{finding:e});break}case"outdated":{n=s.jsx(Qi,{finding:e});break}case"runtime":{n=s.jsx(ss,{finding:e});break}case"socket":{n=s.jsx(ts,{finding:e});break}case"vulnerability":{n=s.jsx(es,{finding:e});break}default:{n=s.jsx(r,{dimColor:!0,children:"Unknown finding kind."});break}}return s.jsxs(u,{borderColor:o,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[s.jsxs(u,{flexShrink:0,paddingTop:1,paddingX:2,children:[s.jsx(r,{bold:!0,color:"white",children:e.title}),s.jsxs(r,{dimColor:!0,children:[" ",vt[e.section]]})]}),s.jsxs(Ft,{flexGrow:1,flexShrink:1,paddingX:2,ref:i,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:[s.jsx(r,{}),n]})]})},"DoctorDetailPanel");var ns=Object.defineProperty,Ie=T((e,t)=>ns(e,"name",{value:t,configurable:!0}),"c$2");const bt={error:"red",warn:"yellow"},os={error:"✖",warn:"⚠"},ls=Ie(e=>e.kind==="outdated"||e.kind==="vulnerability"||e.kind==="socket"?!!e.entry.acceptedRisk:!1,"hasAcceptedRisk"),as=Ie(({finding:e,isSelected:t})=>{const i=bt[e.severity],o=ls(e);return s.jsxs(u,{flexShrink:0,height:1,children:[s.jsx(r,{children:t?">":" "}),s.jsxs(r,{color:i,children:[" ",os[e.severity]," "]}),s.jsx(u,{flexGrow:1,children:s.jsx(r,{bold:t,inverse:t,wrap:"truncate",children:e.title})}),o?s.jsx(r,{color:"cyan",children:" ack"}):null,e.subtitle?s.jsxs(r,{dimColor:!0,wrap:"truncate",children:[" ",e.subtitle]}):null]})},"FindingRow"),cs=Ie(({count:e,section:t})=>s.jsxs(u,{flexShrink:0,height:1,marginTop:1,children:[s.jsx(r,{dimColor:!0,children:"▼ "}),s.jsx(r,{bold:!0,color:"white",children:vt[t].toUpperCase()}),s.jsxs(r,{dimColor:!0,children:[" (",e,")"]})]}),"SectionHeader"),ds=Ie(({count:e,label:t,status:i})=>s.jsxs(r,{children:[t,i==="running"?s.jsxs(r,{children:[" ",s.jsx(ft,{type:"dots"})]}):null,i==="error"?s.jsx(r,{bold:!0,color:"red",children:" ✖"}):s.jsxs(r,{dimColor:!0,children:[" (",String(e),")"]})]}),"TabLabel"),us=Ie(({elapsedMs:e,entries:t,filterActive:i,filterText:o,filterType:n,focused:l,fromCache:c=!1,grouped:h,onViewportHeightChange:a,scrollOffset:g,sectionCounts:y,sectionMessage:w,sectionStatus:A,selectedIndex:E,severityFilter:p,totalAll:P,viewportHeight:z})=>{const q=l?"white":"gray",{measuredHeight:V,ref:B}=mi(z,a);let S=0,G=0;for(const b of t)b.severity==="error"?S+=1:b.severity==="warn"&&(G+=1);const _=[];S>0&&_.push(`${String(S)} error${S===1?"":"s"}`),G>0&&_.push(`${String(G)} warn${G===1?"":"s"}`);const oe=_.length>0?` (${_.join(", ")})`:"",ie=(e/1e3).toFixed(1),U=[];for(const[b,j]of h){U.push(s.jsx(cs,{count:j.length,section:b},`hdr-${b}`));for(const X of j){const C=t.indexOf(X);U.push(s.jsx(as,{finding:X,isSelected:C===E},X.id))}}let F=0;for(const[,b]of h)F+=2+b.length;const K=F>V&&V>0;return s.jsxs(u,{borderColor:q,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[s.jsxs(u,{flexShrink:0,gap:1,paddingX:1,children:[s.jsx(r,{bold:!0,inverse:!0,children:" DOCTOR "}),s.jsxs(r,{wrap:"truncate",children:[t.length,t.length===P?"":`/${String(P)}`," finding",t.length===1?"":"s",oe]}),p?s.jsx(r,{bold:!0,color:bt[p],inverse:!0,children:` ${p.toUpperCase()} ONLY `}):null,c?s.jsx(r,{bold:!0,color:"cyan",inverse:!0,children:" CACHED "}):null,s.jsxs(r,{dimColor:!0,children:[" · ",ie,"s"]})]}),s.jsx(u,{flexShrink:0,paddingX:1,paddingY:1,children:s.jsx(gi,{isFocused:l,keyMap:{next:[],previous:[],useNumbers:!1,useTab:!1},onChange:T(()=>{},"onChange"),showIndex:!1,value:n,children:ye.map(({id:b,label:j})=>s.jsx(fi,{name:b,children:s.jsx(ds,{count:y[b],label:j,status:A[b]})},b))})}),(()=>{const b=Object.keys(A).filter(j=>A[j]==="running"&&w[j]).map(j=>w[j]);return b.length===0?null:s.jsx(u,{flexShrink:0,paddingX:1,children:s.jsxs(r,{dimColor:!0,wrap:"truncate",children:[s.jsx(ft,{type:"dots"})," ",b.join(" · ")]})})})(),i&&s.jsxs(u,{flexShrink:0,paddingX:1,children:[s.jsx(r,{bold:!0,color:"white",children:"/ "}),s.jsx(r,{children:o}),s.jsx(r,{inverse:!0,children:" "})]}),s.jsxs(u,{flexDirection:"row",flexGrow:1,overflow:"hidden",ref:B,children:[s.jsx(u,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:s.jsx(u,{flexDirection:"column",marginTop:-g,children:U.length>0?U:s.jsx(u,{marginTop:1,children:s.jsx(r,{dimColor:!0,children:"No findings match the current filter."})})})}),K&&s.jsx(u,{flexShrink:0,marginLeft:1,marginRight:1,children:s.jsx(Mt,{contentHeight:F,placement:"inset",scrollOffset:g,style:"block",viewportHeight:V})})]},`list-${n}-${o}`)]})},"DoctorListPanel");var hs=Object.defineProperty,ze=T((e,t)=>hs(e,"name",{value:t,configurable:!0}),"g$1");const ps=ze(e=>{if(e.kind==="outdated")return{command:`vis update ${e.entry.packageName}`,description:`Update ${e.entry.packageName} to ${e.entry.newRange}`};if(e.kind==="duplicate")return{command:`vis dedupe ${e.pkg.name}`,description:`Dedupe ${e.pkg.name} (${String(e.pkg.versions.length)} versions)`}},"buildUpdateAction"),gs=ze(e=>{if(e.kind==="optimization")return{command:`vis optimize ${e.entry.packageName}`,description:`Replace ${e.entry.packageName} with ${e.entry.replacement}`}},"buildOptimizeAction"),fs=ze(e=>{if(e.kind!=="outdated"&&e.kind!=="vulnerability"&&e.kind!=="socket")return;const t=e.kind==="outdated"?e.entry.packageName:e.packageName,i=["// Add to vis.config.ts:","security: {"," acceptedRisks: {",` "${t}": {`,' reason: "explain why this risk is acceptable",',' expiresAt: "YYYY-MM-DD",'," },"," },","},"].join(`
|
|
3
|
-
`);return{command:i,configSnippet:i,description:`Acknowledge risk for ${t}`}},"buildAckAction"),ms=100,xs=40,ys=10,ks=ze(({autoExitSeconds:e=0,banner:t,fromCache:i=!1,startedAt:o,store:n})=>{const{exit:l}=Et(),{columns:c,rows:h}=zt(),a=L.useSyncExternalStore(n.subscribe,n.getSnapshot),[g,y]=L.useState(!1),[w,A]=L.useState(!1),[E,p]=L.useState(0),[P,z]=L.useState(()=>Date.now());L.useEffect(()=>{const x=setInterval(()=>{z(Date.now())},1e3);return()=>{clearInterval(x)}},[]);const q=P-o,V=L.useRef(null),B=L.useRef(null),S=a.entries[a.selectedIndex]??null,G=L.useMemo(()=>{const x={dependencies:0,optimization:0,runtime:0,security:0};for(const m of a.all)x[m.section]+=1;return x},[a.all]),_=t?t.hint?5:4:0,oe=L.useMemo(()=>{for(const x of Object.keys(a.sectionStatus))if(a.sectionStatus[x]==="running"&&a.sectionMessage[x])return 1;return 0},[a.sectionStatus,a.sectionMessage]),ie=c>=ms,U=ie?Math.max(1,h-_-2):Math.floor(h*.55),F=Math.max(1,U-6-oe-(a.filterActive?1:0)),[K,b]=L.useState(F),j=K>0?K:F,X=L.useMemo(()=>{let x=0;for(const[,m]of a.grouped)x+=2+m.length;return x},[a.grouped]),C=Math.max(0,X-j),le=Math.min(E,C),ue=L.useCallback(x=>{let m=0,k=0;for(const[,$e]of a.grouped){m+=2;for(let ae=0;ae<$e.length;ae++){if(k===x)return m;m+=1,k+=1}}return m},[a.grouped]),I=L.useCallback(x=>{const m=ue(x);p(k=>m>k+j-2?Math.min(C,Math.max(0,m-j+2)):m<k+1?Math.max(0,m-1):k)},[ue,j,C]);if(L.useEffect(()=>{B.current?.scrollToTop()},[S?.id]),Bt((x,m)=>{if(x==="c"&&m.ctrl){l();return}if(!w){if(g){m.escape||x==="?"?y(!1):x==="q"?(y(!1),A(!0)):m.downArrow||x==="j"?V.current?.scrollBy(1):(m.upArrow||x==="k")&&V.current?.scrollBy(-1);return}if(x==="?"){y(!0);return}if(x==="q"){A(!0);return}if(m.tab){n.setFocusedPanel(a.focusedPanel==="list"?"detail":"list");return}if(a.filterActive){if(m.escape||m.return){n.setFilterActive(!1);return}if(m.backspace){p(0),n.setFilter(a.filterText.slice(0,-1));return}x&&!m.ctrl&&!m.meta&&(p(0),n.setFilter(a.filterText+x));return}if(a.focusedPanel==="list"&&(m.leftArrow||m.rightArrow)){const k=ye.findIndex(ae=>ae.id===a.filterType),$e=m.rightArrow?(k+1)%ye.length:(k-1+ye.length)%ye.length;p(0),B.current?.scrollToTop(),n.setFilterType(ye[$e].id);return}if(a.focusedPanel==="list"){if(m.downArrow||x==="j"){const k=Math.min(a.selectedIndex+1,a.entries.length-1);n.setSelectedIndex(k),I(k);return}if(m.upArrow||x==="k"){const k=Math.max(a.selectedIndex-1,0);n.setSelectedIndex(k),I(k);return}if(m.pageDown){const k=Math.min(a.selectedIndex+10,a.entries.length-1);n.setSelectedIndex(k),I(k);return}if(m.pageUp){const k=Math.max(a.selectedIndex-10,0);n.setSelectedIndex(k),I(k);return}if(m.home){n.setSelectedIndex(0),p(0);return}if(m.end){const k=a.entries.length-1;n.setSelectedIndex(k),I(k);return}if(x==="/"){n.setFilterActive(!0);return}if(x==="e"){n.setSeverityFilter(a.severityFilter==="error"?void 0:"error"),p(0);return}if(x==="w"){n.setSeverityFilter(a.severityFilter==="warn"?void 0:"warn"),p(0);return}if(x==="u"&&S){const k=ps(S);k&&(n.setPendingAction(k),l());return}if(x==="o"&&S){const k=gs(S);k&&(n.setPendingAction(k),l());return}if(x==="a"&&S){const k=fs(S);k&&(n.setPendingAction(k),l());return}if(x==="d"){n.setFocusedPanel("detail");return}return}if(m.escape||m.leftArrow){n.setFocusedPanel("list");return}if(m.downArrow||x==="j"){B.current?.scrollBy(1);return}if(m.upArrow||x==="k"){B.current?.scrollBy(-1);return}if(m.pageDown){B.current?.scrollBy(10);return}if(m.pageUp){B.current?.scrollBy(-10);return}if(m.home){B.current?.scrollToTop();return}m.end&&B.current?.scrollToBottom()}},{isActive:!0}),c<xs||h<ys)return s.jsx(u,{alignItems:"center",height:h,justifyContent:"center",width:c,children:s.jsxs(r,{color:"yellow",children:["Terminal too small (",c,"x",h,")"]})});const Q=a.focusedPanel==="detail",ee=[s.jsxs(u,{gap:1,children:[s.jsx(r,{bold:!0,color:"white",children:"q"}),s.jsx(r,{dimColor:!0,children:"QUIT"})]},"q"),s.jsxs(u,{gap:1,children:[s.jsx(r,{bold:!0,color:"white",children:"?"}),s.jsx(r,{dimColor:!0,children:"HELP"})]},"?"),s.jsxs(u,{gap:1,children:[s.jsx(r,{bold:!0,color:"white",children:"↑↓"}),s.jsx(r,{dimColor:!0,children:Q?"SCROLL":"NAV"})]},"nav"),Q?s.jsxs(u,{gap:1,children:[s.jsx(r,{bold:!0,color:"white",children:"←/Esc"}),s.jsx(r,{dimColor:!0,children:"LIST"})]},"lr"):s.jsxs(u,{gap:1,children:[s.jsx(r,{bold:!0,color:"white",children:"←→"}),s.jsx(r,{dimColor:!0,children:"SECTION"})]},"lr"),s.jsxs(u,{gap:1,children:[s.jsx(r,{bold:!0,color:"white",children:"/"}),s.jsx(r,{dimColor:!0,children:"SEARCH"})]},"search"),s.jsxs(u,{gap:1,children:[s.jsx(r,{bold:!0,color:"white",children:"e/w"}),s.jsx(r,{dimColor:!0,children:"SEVERITY"})]},"sev"),s.jsxs(u,{gap:1,children:[s.jsx(r,{bold:!0,color:"white",children:"u/o/a"}),s.jsx(r,{dimColor:!0,children:"ACTION"})]},"actions"),s.jsxs(u,{gap:1,children:[s.jsx(r,{bold:!0,color:"white",children:"Tab"}),s.jsx(r,{dimColor:!0,children:"PANEL"})]},"tab")],he=s.jsx(u,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:s.jsx(u,{gap:2,overflow:"hidden",paddingX:1,children:ee})}),pe=s.jsxs(Lt,{footer:s.jsxs(r,{dimColor:!0,children:[s.jsx(r,{bold:!0,color:"white",children:"↑↓"})," scroll ",s.jsx(r,{bold:!0,color:"white",children:"?"}),"/",s.jsx(r,{bold:!0,color:"white",children:"Esc"})," close"]}),scrollRef:V,title:"DOCTOR — KEYBOARD SHORTCUTS",visible:g,width:56,children:[s.jsxs(u,{flexDirection:"column",marginBottom:1,children:[s.jsxs(u,{marginBottom:1,children:[s.jsx(r,{dimColor:!0,children:"── "}),s.jsx(r,{bold:!0,color:"white",children:"NAVIGATION"})]}),s.jsxs(u,{children:[s.jsx(u,{width:26,children:s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" ↑/k "}),s.jsx(r,{dimColor:!0,children:"Move up"})]})}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" ↓/j "}),s.jsx(r,{dimColor:!0,children:"Move down"})]})]}),s.jsxs(u,{children:[s.jsx(u,{width:26,children:s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" PgUp"}),s.jsx(r,{dimColor:!0,children:" Jump up 10"})]})}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" PgDn"}),s.jsx(r,{dimColor:!0,children:" Jump down 10"})]})]}),s.jsxs(u,{children:[s.jsx(u,{width:26,children:s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" Home"}),s.jsx(r,{dimColor:!0,children:" Jump to top"})]})}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" End"}),s.jsx(r,{dimColor:!0,children:" Jump to bottom"})]})]}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" Tab"}),s.jsx(r,{dimColor:!0,children:" Switch panel"})]}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" →/←"}),s.jsx(r,{dimColor:!0,children:" Section tabs (list) / Focus list (detail)"})]})]}),s.jsxs(u,{flexDirection:"column",marginBottom:1,children:[s.jsxs(u,{marginBottom:1,children:[s.jsx(r,{dimColor:!0,children:"── "}),s.jsx(r,{bold:!0,color:"white",children:"FILTER"})]}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" /"}),s.jsx(r,{dimColor:!0,children:" Open text filter (Esc/Enter to close)"})]}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" e"}),s.jsx(r,{dimColor:!0,children:" Toggle errors-only filter"})]}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" w"}),s.jsx(r,{dimColor:!0,children:" Toggle warns-only filter"})]})]}),s.jsxs(u,{flexDirection:"column",marginBottom:1,children:[s.jsxs(u,{marginBottom:1,children:[s.jsx(r,{dimColor:!0,children:"── "}),s.jsx(r,{bold:!0,color:"white",children:"ACTIONS"})]}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" u"}),s.jsx(r,{dimColor:!0,children:" Exit + suggest update / dedupe command"})]}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" o"}),s.jsx(r,{dimColor:!0,children:" Exit + suggest optimize command"})]}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" a"}),s.jsx(r,{dimColor:!0,children:" Exit + print risk-ack snippet"})]}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" d"}),s.jsx(r,{dimColor:!0,children:" Focus detail panel"})]})]}),s.jsxs(u,{flexDirection:"column",children:[s.jsxs(u,{marginBottom:1,children:[s.jsx(r,{dimColor:!0,children:"── "}),s.jsx(r,{bold:!0,color:"white",children:"EXIT"})]}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" q"}),s.jsx(r,{dimColor:!0,children:" Quit (with countdown)"})]}),s.jsxs(r,{children:[s.jsx(r,{bold:!0,color:"white",children:" Ctrl+C"}),s.jsx(r,{dimColor:!0,children:" Quit immediately"})]})]})]}),ge=s.jsx(us,{elapsedMs:q,entries:a.entries,filterActive:a.filterActive,filterText:a.filterText,filterType:a.filterType,focused:a.focusedPanel==="list",fromCache:i,grouped:a.grouped,onViewportHeightChange:b,scrollOffset:le,sectionCounts:G,sectionMessage:a.sectionMessage,sectionStatus:a.sectionStatus,selectedIndex:a.selectedIndex,severityFilter:a.severityFilter,totalAll:a.all.length,viewportHeight:j}),fe=t?s.jsx(Yi,{hint:t.hint,message:t.message,severity:t.severity,title:t.title}):null,je=s.jsx(rs,{finding:S,focused:a.focusedPanel==="detail",scrollRef:B});if(ie){const x=Math.floor(c*.4);return s.jsxs(u,{flexDirection:"column",height:h,width:c,children:[fe,s.jsxs(u,{flexDirection:"row",flexGrow:1,children:[s.jsx(u,{flexGrow:1,children:ge}),s.jsx(u,{width:x,children:je})]}),he,s.jsx(Je,{autoExitSeconds:e||3,onCancel:T(()=>{A(!1)},"onCancel"),visible:w}),pe]})}return s.jsxs(u,{flexDirection:"column",height:h,width:c,children:[fe,s.jsx(u,{height:U,children:ge}),s.jsx(u,{flexGrow:1,children:je}),he,s.jsx(Je,{autoExitSeconds:e||3,onCancel:T(()=>{A(!1)},"onCancel"),visible:w}),pe]})},"VisDoctorApp");var ws=Object.defineProperty,ve=T((e,t)=>ws(e,"name",{value:t,configurable:!0}),"n");const vs=ve(e=>e.replaceAll(/[$()+.?[\\\]^{|}]/g,String.raw`\$&`),"escapeRegex"),bs=ve(e=>{const t=e.split("*").map(i=>vs(i));return new RegExp(`^${t.join(".*")}$`,"i")},"compilePattern"),js=ve(e=>e?e.split(",").map(t=>t.trim()).filter(t=>t.length>0).map(t=>bs(t)):[],"parseFilterPatterns"),Ne=ve((e,t)=>{for(const i of t)if(i.test(e))return!0;return!1},"matchesAny"),$s=ve((e,t,i)=>{if(t.length===0)return e;const o=e.outdated.filter(g=>Ne(g.packageName,t)),n=e.duplicates.filter(g=>Ne(g.name,t)),l=e.optimizations.filter(g=>Ne(g.packageName,t));let c=0,h=0,a=0;for(const g of o)g.vulnerabilities&&(c+=g.vulnerabilities.length),g.socketReport&&(h+=g.socketReport.alerts.length,g.socketReport.score.overall<i&&(a+=1));return{...e,duplicates:n,optimizations:l,outdated:o,socketIssues:{alerts:h,lowScore:a},vulnCount:c}},"applyFilter"),jt=ve((e,t)=>t.length===0?[...e]:e.filter(i=>{if(i.kind==="runtime")return!0;const o=i.kind==="duplicate"?i.pkg.name:i.kind==="outdated"||i.kind==="optimization"?i.entry.packageName:i.packageName;return Ne(o,t)}),"filterFindingsByPattern");var Ss=Object.defineProperty,be=T((e,t)=>Ss(e,"name",{value:t,configurable:!0}),"r");const $t=["dependencies","security","optimization","runtime"],tt=be(e=>{const t=new Set;if(!e)return t;for(const i of e.split(",")){const o=i.trim().toLowerCase();$t.includes(o)&&t.add(o)}return t},"parseSectionList"),Cs=be((e,t)=>{if(e!==void 0&&e!=="")return tt(e);const i=tt(t);return new Set($t.filter(o=>!i.has(o)))},"resolveSections"),St=be(e=>{const t={micro:0,native:0,preferred:0,socket:0,total:e.length};for(const i of e)switch(i.category){case"micro-utility":{t.micro+=1;break}case"native":{t.native+=1;break}case"preferred":{t.preferred+=1;break}case"socket":{t.socket+=1;break}}return t},"summarizeOptimizations"),re=be((e,t)=>{if(!e.sections.has(t))return"skip";switch(t){case"dependencies":return e.outdated.length>0||e.duplicates.length>0?"warn":"ok";case"optimization":return e.optimizations.length>0?"warn":"ok";case"runtime":return e.runtime.some(i=>i.status==="warn")?"warn":"ok";case"security":return e.vulnCount>0||e.socketIssues.alerts>0?"error":e.socketIssues.lowScore>0?"warn":"ok";default:return"ok"}},"sectionStatus"),Rs=be((e,t)=>{const i=St(e.optimizations),o={dependencies:re(e,"dependencies"),optimization:re(e,"optimization"),runtime:re(e,"runtime"),security:re(e,"security")},n=new Set([...Object.values(o),e.supplyChain.status]),l=n.has("error")?"error":n.has("warn")?"warn":"ok";return{dependencies:{duplicates:e.duplicates.length,installed:e.installedCount,outdated:e.outdated.length,status:o.dependencies},elapsedMs:e.elapsedMs,optimizations:{microUtilities:i.micro,native:i.native,preferred:i.preferred,socket:i.socket,status:o.optimization,total:i.total},packageManager:t,runtime:e.runtime.map(c=>({detail:c.detail,id:c.id,message:c.message,status:c.status})),runtimeStatus:o.runtime,security:{alerts:e.socketIssues.alerts,lowScorePackages:e.socketIssues.lowScore,status:o.security,vulnerabilities:e.vulnCount},status:l,supplyChain:{findings:e.supplyChain.findings.map(c=>({detail:c.detail,label:c.label,severity:c.severity})),status:e.supplyChain.status},workspaces:e.workspaceCount}},"buildJsonPayload"),it=be((e,t)=>{const i=e.runtime.some(n=>n.status==="warn"),o=e.vulnCount>0||e.socketIssues.alerts>0;return t?o||e.outdated.length>0||e.duplicates.length>0||i:o},"shouldFail");var Ts=Object.defineProperty,Be=T((e,t)=>Ts(e,"name",{value:t,configurable:!0}),"u$1");const As=["aube-workspace.yaml","pnpm-workspace.yaml"],Ce=Be(e=>typeof e=="boolean"?e:void 0,"asBool"),Ps=Be(e=>{if(e==="no-downgrade"||e==="off")return e},"asTrustPolicy"),Is=Be(e=>{const t={allowBuildsCount:0,blockExoticSubdeps:void 0,jailBuilds:void 0,minimumReleaseAge:void 0,minimumReleaseAgeStrict:void 0,paranoid:void 0,source:void 0,strictDepBuilds:void 0,trustPolicy:void 0};for(const i of As){const o=J(e,i);if(!Ae(o))continue;let n;try{n=Vt(qt(o))}catch{continue}if(typeof n!="object"||n===null)continue;const l=n;return t.source=i,t.paranoid=Ce(l.paranoid),t.trustPolicy=Ps(l.trustPolicy),t.blockExoticSubdeps=Ce(l.blockExoticSubdeps),t.jailBuilds=Ce(l.jailBuilds),t.strictDepBuilds=Ce(l.strictDepBuilds),t.minimumReleaseAgeStrict=Ce(l.minimumReleaseAgeStrict),typeof l.minimumReleaseAge=="number"&&Number.isFinite(l.minimumReleaseAge)&&(t.minimumReleaseAge=l.minimumReleaseAge),l.allowBuilds&&typeof l.allowBuilds=="object"&&!Array.isArray(l.allowBuilds)&&(t.allowBuildsCount=Object.keys(l.allowBuilds).length),t}return t},"readAubeSecurityPosture"),Ds=Be(e=>e.paranoid?{...e,jailBuilds:!0,minimumReleaseAgeStrict:!0,strictDepBuilds:!0,trustPolicy:"no-downgrade"}:e,"applyAubeParanoidOverrides");var Os=Object.defineProperty,Ue=T((e,t)=>Os(e,"name",{value:t,configurable:!0}),"i");const Ns=/^(@[\w./-]+\/[\w./-]+|[\w.-]+)@(.+)$/,Fs=Ue(e=>{const t=Ns.exec(e);if(t)return{name:t[1],version:t[2]}},"parsePatchKey"),Ms=Ue((e,t)=>{let i;try{if(t==="pnpm"){const n=J(e,"pnpm-workspace.yaml");Ae(n)&&(i=Ut(n)?.patchedDependencies)}else if(t==="bun"){const n=J(e,"package.json");Ae(n)&&(i=ht(n)?.patchedDependencies)}}catch{return[]}if(!i||typeof i!="object")return[];const o=[];for(const[n,l]of Object.entries(i)){if(typeof l!="string"||l.length===0)continue;const c=Fs(n);c&&o.push({name:c.name,patchFile:l,resolvedPatchFile:Xt(l)?l:dt(e,l),version:c.version})}return o},"readPatchedDependencies"),Es=Ue(e=>{const t=[];for(const i of e)Ae(i.resolvedPatchFile)||t.push({entry:i,kind:"missing-file"});return t},"findPatchIssues");var zs=Object.defineProperty,Ct=T((e,t)=>zs(e,"name",{value:t,configurable:!0}),"c");const st=Ct(e=>e.some(t=>t.severity==="error")?"error":e.some(t=>t.severity==="warn")?"warn":"ok","rollUpStatus"),Bs=Ct((e,t={})=>{const i=[],o=e?.security;if(!o)return i.push({detail:"Use defineConfig() from '@visulima/vis/config' to apply secure defaults.",label:"No security config — running with the PM's native defaults",severity:"warn"}),{findings:i,status:st(i)};const n=o.policies?.firstSeen?.minutes,l=o.policies?.publisherChange,c=o.policies?.installScripts;n===void 0?i.push({detail:"Set security.policies.firstSeen.minutes to block packages published in the last N minutes (mitigates supply-chain attacks).",label:"policies.firstSeen.minutes is not set",severity:"warn"}):n===0?i.push({detail:"New packages can be installed immediately after publishing. Consider setting a non-zero cooldown.",label:"policies.firstSeen.minutes is explicitly 0",severity:"warn"}):i.push({label:`policies.firstSeen.minutes: ${String(n)} minutes`,severity:"ok"}),l?.mode===void 0||l.mode==="off"?i.push({detail:"Packages whose trust level has decreased will not be blocked. Consider 'no-downgrade'.",label:`policies.publisherChange.mode: ${l?.mode??"not set"}`,severity:"warn"}):i.push({label:`policies.publisherChange.mode: ${l.mode}`,severity:"ok"}),o.blockExoticSubdeps===void 0||!o.blockExoticSubdeps?i.push({detail:"Transitive dependencies can pull code from git repos or tarball URLs. Set to true to block.",label:`blockExoticSubdeps: ${String(o.blockExoticSubdeps??!1)}`,severity:"warn"}):i.push({label:"blockExoticSubdeps: true",severity:"ok"});const h=c?.allow?Object.keys(c.allow).length:0;if(h===0?i.push({detail:"Lifecycle scripts are blocked by default. List trusted packages here to opt them back in (e.g. esbuild, @prisma/client).",label:"policies.installScripts.allow: not configured",severity:"warn"}):i.push({label:`policies.installScripts.allow: ${String(h)} ${h===1?"entry":"entries"}`,severity:"ok"}),c?.strict&&h===0&&i.push({detail:"All dependencies with build scripts will be blocked. Run 'vis approve-builds' to populate the allow list.",label:"policies.installScripts.strict is on but allow is empty",severity:"error"}),t.workspaceRoot){const a=xi(t.workspaceRoot);if(a.length>0){const g=[...new Set(a.map(y=>y.tool))].sort((y,w)=>y.localeCompare(w)).join(", ");i.push({detail:"Run `vis migrate verify` for the full list, then re-run `vis migrate <tool>` to clean up.",label:`${String(a.length)} leftover ${a.length===1?"reference":"references"} to ${g}`,severity:"warn"})}}if(t.workspaceRoot&&t.packageManager==="aube"){const a=Is(t.workspaceRoot),g=Ds(a),y=g.source?` (from ${g.source})`:"";g.paranoid===!0&&i.push({detail:"Forces jailBuilds, trustPolicy=no-downgrade, minimumReleaseAgeStrict, strictStoreIntegrity, and strictDepBuilds on.",label:`aube paranoid: true${y}`,severity:"ok"}),g.trustPolicy==="off"&&i.push({detail:"Trust downgrades between releases will not be blocked. Set trustPolicy: no-downgrade in aube-workspace.yaml.",label:`aube trustPolicy: off${y}`,severity:"warn"}),g.blockExoticSubdeps===!1&&i.push({detail:"Transitive deps from git+, file:, and tarball URLs will not be blocked. Re-enable with blockExoticSubdeps: true.",label:`aube blockExoticSubdeps: false${y}`,severity:"warn"}),g.minimumReleaseAge===0&&i.push({detail:"Newly published versions are not held in a cooling window. Restore with minimumReleaseAge: 1440 (24h) or higher.",label:`aube minimumReleaseAge: 0${y}`,severity:"warn"}),g.jailBuilds===!0&&i.push({label:`aube jailBuilds: true${y}`,severity:"ok"}),g.strictDepBuilds===!0&&i.push({label:`aube strictDepBuilds: true${y}`,severity:"ok"}),g.allowBuildsCount>0&&i.push({label:`aube allowBuilds: ${String(g.allowBuildsCount)} ${g.allowBuildsCount===1?"entry":"entries"}${y}`,severity:"ok"})}if(t.workspaceRoot&&t.packageManager){const a=Ms(t.workspaceRoot,t.packageManager);if(a.length>0){const g=Es(a);if(g.length===0)i.push({label:`patchedDependencies: ${String(a.length)} ${a.length===1?"entry":"entries"} resolved`,severity:"ok"});else for(const y of g)i.push({detail:`Referenced from ${t.packageManager==="pnpm"?"pnpm-workspace.yaml":"package.json"} but the file is not present at ${y.entry.patchFile}.`,label:`patchedDependencies: missing patch file for ${y.entry.name}@${y.entry.version}`,severity:"error"})}}return{findings:i,status:st(i)}},"buildSupplyChainPosture");var Ls=Object.defineProperty,$=T((e,t)=>Ls(e,"name",{value:t,configurable:!0}),"u");const H=$(e=>e>=1e3?`${(e/1e3).toFixed(1)}s`:`${String(Math.round(e))}ms`,"fmtDuration"),De=$(async(e,t,i,o)=>{if(!e)return i();e.start(t);const n=Date.now();try{const l=await i(),c=Date.now()-n,{status:h,summary:a}=o(l,c);return e.finish(t,h,a),l}catch(l){const c=Date.now()-n,h=l instanceof Error?l.message:String(l);throw e.finish(t,"error",`${h} (${H(c)})`),l}},"tracked"),Vs=$((e,t)=>{const i={duplicates:t.duplicates,elapsedMs:0,installedCount:0,optimizations:t.optimizations,outdated:t.outdated,runtime:t.runtime,sections:new Set([e]),socketIssues:{alerts:0,lowScore:0},supplyChain:{findings:[],status:"ok"},vulnCount:0,workspaceCount:0};return wt(i)},"buildSectionFindings"),rt=$(async e=>{const{filterPatterns:t,installed:i,progress:o,resolveCodemods:n,sections:l,store:c,visConfig:h,workspaceRoot:a}=e,g=l.has("dependencies"),y=l.has("security"),w=l.has("optimization"),A=l.has("runtime"),E=$((f,D)=>jt(Vs(f,D),t),"sectionFindings"),p=gt(a),{packageManager:P}=ot(a),z=Xe(J(a,"package.json"),!1),q=pt(a),V=new Set(z);for(const f of q){const D=Xe(J(dt(a,f),"package.json"),!1);for(const O of D)V.add(O)}const B=Gt(a),S=lt(a,P),G=at(h?.security,{minimumScore:h?.security?.policies?.score?.minimum}),_=h?.security?.policies?.score?.minimum??ct,oe=h?.security?.acceptedRisks,ie=ii(a,p.name),U={exclude:[],ignore:[],include:[],includeLocked:!1,includePrerelease:!1,security:!0,target:"latest"},F=g?ui(a,p.name):[],K=w?si(V):[],b=w?ri(V,ie,p,!1):[],j=new Set(K.map(f=>f.packageName)),X=b.filter(f=>!j.has(f.packageName)),C=[...K,...X],le=A?Ei(a):[];c&&(g&&c.startSection("dependencies",S.size>0?"checking outdated catalog dependencies":"scanning duplicates"),y&&c.startSection("security",i.length>0?`scanning ${String(i.length)} packages for advisories`:"no installed packages to scan"),w&&c.startSection("optimization","matching e18e + socket overrides"),A&&c.startSection("runtime","running runtime diagnostics")),c&&A&&c.completeSection("runtime",E("runtime",{duplicates:[],optimizations:[],outdated:[],runtime:le}));const ue=(g||y)&&S.size>0?De(o,"outdated",()=>_t(S,U,B,void 0,a,G,oe),(f,D)=>{const O=f.outdated.length;return{status:O>0?"warn":"ok",summary:O>0?`${String(O)} outdated · ${H(D)}`:`up to date · ${H(D)}`}}):Promise.resolve({failed:[],ignored:[],outdated:[]}),I=y&&i.length>0?De(o,"vulnerabilities",()=>Ht(i.map(f=>({name:f.name,version:f.version}))),(f,D)=>{let O=0;for(const se of f.values())O+=se.length;return{status:O>0?"error":"ok",summary:O>0?`${String(O)} found · ${H(D)}`:`none found · ${H(D)}`}}):Promise.resolve(new Map),Q=y&&G.length>0&&i.length>0?De(o,"socket",()=>Kt(G,i.map(f=>({name:f.name,version:f.version}))),(f,D)=>{let O=0,se=0;for(const Ye of f.values())O+=Ye.alerts.length,Ye.score.overall<_&&(se+=1);const Ke=O+se;return{status:Ke>0?"warn":"ok",summary:Ke>0?`${String(O)} alert${O===1?"":"s"}, ${String(se)} low-score · ${H(D)}`:`clean · ${H(D)}`}}):Promise.resolve(new Map);let ee,he,pe,ge;const fe=ue.catch(f=>(ee=f instanceof Error?f.message:String(f),c||d.warn(`Outdated scan failed: ${ee}`),{failed:[],ignored:[],outdated:[]})),je=I.catch(f=>(he=f instanceof Error?f.message:String(f),c||d.warn(`Vulnerability scan failed: ${he}`),new Map)),x=Q.catch(f=>(pe=f instanceof Error?f.message:String(f),c||d.warn(`Socket scan failed: ${pe}`),new Map)),m=c&&g?fe.then(f=>{if(ee){c.failSection("dependencies",ee);return}c.completeSection("dependencies",E("dependencies",{duplicates:F,optimizations:[],outdated:f.outdated,runtime:[]}))}):void 0,k=c&&y?Promise.all([fe,je,x]).then(([f])=>{const D=ee??he??pe;if(D){c.failSection("security",D);return}c.completeSection("security",E("security",{duplicates:[],optimizations:[],outdated:f.outdated,runtime:[]}))}):void 0,$e=(async()=>{if(n&&w&&C.length>0&&await De(o,"codemods",async()=>(await ni(C),C),(f,D)=>{const O=f.filter(se=>se.hasCodemod||se.category==="socket").length;return{status:"ok",summary:`${String(O)} auto-fixable · ${H(D)}`}}).catch(f=>{ge=f instanceof Error?f.message:String(f)}),c&&w){if(ge){c.failSection("optimization",ge);return}c.completeSection("optimization",E("optimization",{duplicates:[],optimizations:C,outdated:[],runtime:[]}))}})(),[ae,Tt,At]=await Promise.all([fe,je,x]);await Promise.all([m,k,$e]);let _e=0,He=0;if(y&&G.length>0)for(const f of At.values())_e+=f.alerts.length,f.score.overall<_&&(He+=1);let Le=0;if(y){for(const f of ae.outdated)f.vulnerabilities&&f.vulnerabilities.length>0&&(Le+=f.vulnerabilities.length);for(const f of Tt.values())Le+=f.length}return{duplicates:F,installedCount:i.length,optimizations:w?C:[],outdated:g?ae.outdated:[],runtime:le,sections:l,socketIssues:{alerts:_e,lowScore:He},supplyChain:Bs(h,{packageManager:P,workspaceRoot:a}),vulnCount:Le,workspaceCount:q.length}},"streamScans"),Us=$(e=>{switch(e){case"error":return Re(N.failure);case"skip":return v(N.dash);case"warn":return Me(N.warning);default:return we(N.success)}},"sectionIcon"),de=$((e,t)=>{const i=process.stderr.columns??80,o=Math.max(20,Math.min(i-2,60)),n=N.dash.repeat(2),l=`${Us(t)} ${ce(e)}`,c=l.replaceAll(/\[[0-9;]*m/g,"").length,h=Math.max(0,o-c-n.length-2);return`${n} ${l} ${v(N.dash.repeat(h))}`},"heading"),W=$(e=>` ${we(N.success)} ${e}`,"itemOk"),Z=$(e=>` ${Me(N.warning)} ${e}`,"itemWarn"),Ge=$(e=>` ${Re(N.failure)} ${e}`,"itemError"),Rt=$(e=>` ${v(N.dash)} ${v(e)}`,"itemSkip"),Y=$((e,t,i)=>{const o=`${ce(String(e))} ${v(t)}`;return i?`${o} ${v(`(${i})`)}`:o},"countLine"),Gs=$(e=>{if(e.sections.has("dependencies")){if(d.log(""),d.log(de("Dependencies",re(e,"dependencies"))),d.log(W(Y(e.installedCount,"packages installed"))),e.outdated.length>0){const t=e.outdated.filter(l=>l.updateType==="major").length,i=e.outdated.filter(l=>l.updateType==="minor").length,o=e.outdated.filter(l=>l.updateType==="patch").length,n=[];t>0&&n.push(`${String(t)} major`),i>0&&n.push(`${String(i)} minor`),o>0&&n.push(`${String(o)} patch`),d.log(Z(Y(e.outdated.length,"outdated",n.join(", "))))}else d.log(W("All dependencies up to date"));e.duplicates.length>0?d.log(Z(Y(e.duplicates.length,"packages with duplicate versions"))):d.log(W("No duplicate dependencies"))}},"displayDependencies"),_s=$(e=>{e.sections.has("security")&&(d.log(""),d.log(de("Security",re(e,"security"))),e.vulnCount>0?d.log(Ge(Y(e.vulnCount,`vulnerabilit${e.vulnCount===1?"y":"ies"} found`))):d.log(W("No known vulnerabilities")),e.socketIssues.alerts>0&&d.log(Z(Y(e.socketIssues.alerts,`Socket.dev security alert${e.socketIssues.alerts===1?"":"s"}`))),e.socketIssues.lowScore>0&&d.log(Z(Y(e.socketIssues.lowScore,`package${e.socketIssues.lowScore===1?"":"s"} with low security score`))),e.socketIssues.alerts===0&&e.socketIssues.lowScore===0&&e.vulnCount===0&&d.log(W("No security issues detected")))},"displaySecurity"),Hs=$(e=>{if(!e.sections.has("optimization"))return;d.log(""),d.log(de("Optimization",re(e,"optimization")));const t=St(e.optimizations);if(t.total===0){d.log(W("No optimizations available"));return}t.native>0&&d.log(Z(Y(t.native,"replaceable with native APIs"))),t.preferred>0&&d.log(Z(Y(t.preferred,"with lighter alternatives"))),t.micro>0&&d.log(Z(Y(t.micro,"trivial micro-utilities"))),t.socket>0&&d.log(Z(Y(t.socket,"@socketregistry overrides available")))},"displayOptimization"),Ks=$(e=>{d.log(""),d.log(de("Supply Chain",e.supplyChain.status));for(const t of e.supplyChain.findings){const i=t.severity==="ok"?W(t.label):t.severity==="error"?Ge(t.label):Z(t.label);d.log(i),t.detail&&d.log(` ${v(N.arrow)} ${v(t.detail)}`)}e.supplyChain.status!=="ok"&&d.log(` ${v(N.arrow)} ${v("Configure with security.* in vis.config.ts. See `vis check --security-config` for details.")}`)},"displaySupplyChain"),Ys=$(e=>{if(e.sections.has("runtime")){d.log(""),d.log(de("Runtime",re(e,"runtime")));for(const t of e.runtime)t.status==="ok"?d.log(W(t.message)):t.status==="skip"?d.log(Rt(t.message)):d.log(Z(t.message))}},"displayRuntime"),Ws=$((e,t)=>{const i=e.vulnCount,o=e.runtime.filter(l=>l.status==="warn").length,n=e.outdated.length+e.duplicates.length+e.optimizations.length+o;if(t){if(i===0&&n===0)d.success(`Everything looks good! ${v(`(${H(e.elapsedMs)})`)}`);else{const l=[];i>0&&l.push(Re(`${String(i)} security`)),n>0&&l.push(Me(`${String(n)} improvement${n===1?"":"s"}`)),d.log(`${Re(N.failure)} ${l.join(", ")} ${v(`(${H(e.elapsedMs)})`)}`)}return}d.log(""),d.log(de("Summary","ok")),i===0&&n===0?d.success(`Everything looks good! ${v(`(${H(e.elapsedMs)})`)}`):(i>0&&d.error(`${String(i)} security issue${i===1?"":"s"}`),n>0&&d.log(` ${Te(N.arrow)} ${ce(String(n))} ${v(`improvement${n===1?"":"s"} available`)} ${v(`(${H(e.elapsedMs)})`)}`))},"displaySummary"),Js=$(e=>{const t=[];if(e.outdated.length>0&&t.push("vis update — update outdated dependencies"),(e.vulnCount>0||e.socketIssues.alerts>0)&&t.push("vis audit — detailed security analysis"),e.optimizations.length>0&&t.push("vis optimize — apply optimizations interactively"),e.duplicates.length>0&&t.push("vis dedupe — reduce duplicate versions"),t.length>0){d.log(""),d.log(ce("Next steps:"));for(const i of t)d.log(` ${v(N.arrow)} ${i}`)}d.log("")},"displayActions"),qs=$((e,t)=>{t||(Gs(e),_s(e),Hs(e),Ys(e),Ks(e)),Ws(e,t)},"displayResults"),Xs=$((e,t,i,o,n)=>{const l=[],c=e.has("dependencies"),h=e.has("security"),a=e.has("optimization");return(c||h)&&t>0&&l.push({id:"outdated",label:"Outdated catalog dependencies"}),h&&o>0&&l.push({id:"vulnerabilities",label:"Known vulnerabilities (OSV)"}),h&&i&&o>0&&l.push({id:"socket",label:"Socket.dev supply-chain reports"}),a&&n&&l.push({id:"codemods",label:"Codemod availability"}),l},"planScanTasks"),Qs=$(e=>{if(d.log(""),d.log(`${ce(Te("vis doctor"))} ${v("— project health check")}`),d.log(W(`Detected ${e.packageManagerName} v${e.packageManagerVersion}`)),e.workspaceCount!==void 0&&e.workspaceCount>0&&d.log(W(Y(e.workspaceCount,`workspace package${e.workspaceCount===1?"":"s"}`))),e.runtimeFindings.length===0)d.log(W(`Node.js ${e.nodeVersion}`));else{for(const t of e.runtimeFindings){const i=t.severity==="error"?Re:Me;d.log(Ge(`Runtime: ${i(t.message)}`))}d.log(` ${v(N.arrow)} Run ${we("vis toolchain install")} to install pinned versions, or ${we("vis toolchain status")} for the per-tool breakdown.`)}d.log("")},"printBanner"),fr=$(async({logger:e,options:t,visConfig:i,visConfigError:o,workspaceRoot:n})=>{if(!n)throw new Error("Could not determine workspace root.");const l=t.format==="json"||t.json===!0,c=Cs(t.only,t.skip),h=!!t.quiet,a=t.progress===!1,g=js(t.filter);if(c.size===0){d.error("No sections selected. Check your --only / --skip values."),process.exitCode=2;return}const y=Date.now(),w=gt(n),A=ci(n),E=!!process.stdout.isTTY,p=!l&&E&&!Jt&&!h&&!a;!l&&!p&&Qs({nodeVersion:process.versions.node,packageManagerName:w.name,packageManagerVersion:w.version,runtimeFindings:A,workspaceCount:void 0});const P=lt(n,ot(n).packageManager),z=hi(n,w.name),q=z.length,V=at(i?.security).length>0,B=i?.security?.policies?.score?.minimum??ct,S=pt(n);if(!l&&!h&&!p){const I=S.length>0?v(` · ${String(S.length)} workspace package${S.length===1?"":"s"}`):"";d.log(`${v("·")} ${v("Found")} ${ce(String(q))} ${v(`installed package${q===1?"":"s"}`)}${I}`)}const G=o?{hint:o.file?`Continuing with default settings — fix or regenerate ${o.file} (vis init --force).`:"Continuing with default settings.",message:o.message,severity:"error",title:o.file?`Failed to load ${o.file}`:"Failed to load vis.config"}:void 0,_=pi(n,w.name)?.file,oe=_?J(n,_):void 0,ie=ti(n),U=t.cache!==!1&&!t.fix?vi({configPath:ie,lockfilePath:oe,sections:c,socketEnabled:V,workspaceRoot:n}):void 0,F=U?bi(U):void 0,K=F!==void 0;let b,j;if(p){const I=F?new Ze({activeSections:c,findings:jt(wt(F),g)}):new Ze({activeSections:c}),Q=Yt(Wt.createElement(ks,{banner:G,fromCache:K,startedAt:y,store:I}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0});try{b=F??await rt({filterPatterns:g,installed:z,resolveCodemods:!!t.fix,sections:c,store:I,visConfig:i,workspaceRoot:n})}catch(ee){throw Q.unmount(),ee}await Q.waitUntilExit(),j=I.getSnapshot().pendingAction}else if(F)b=F;else{const I=Xs(c,P.size,V,q,!!t.fix),Q=di(I,{live:!l&&!h&&!a});try{b=await rt({filterPatterns:g,installed:z,progress:Q,resolveCodemods:!!t.fix,sections:c,visConfig:i,workspaceRoot:n})}finally{Q.stop()}}const X={...b,elapsedMs:Date.now()-y};if(U&&!K)try{ji(U,X)}catch{}const C=$s(X,g,B);if(l){process.stdout.write(`${JSON.stringify(Rs(C,w.name),void 0,2)}
|
|
4
|
-
|
|
5
|
-
`)
|
|
6
|
-
|
|
7
|
-
`),
|
|
8
|
-
`))
|
|
9
|
-
`),process.stdout.write(`
|
|
10
|
-
`))
|
|
1
|
+
var he=Object.defineProperty;var D=(e,s)=>he(e,"name",{value:s,configurable:!0});import{createRequire as ke}from"node:module";import{I as w,j as v,E as u,q as R,e as x,T as b}from"../packem_shared/Table-3pFgIUZ2-DABgc6rj.js";import{M as W,i as I,$ as Pe,C as G,z as P}from"../packem_shared/readFileSync-4c_c6Qey-6SWMDNdw.js";import{n as j,q as ve,w as E}from"./config.js";import{o as re}from"../packem_shared/index-DH-5hsrC.js";import{V as pe,t as te,a3 as C,aO as we,aN as L,an as K,aP as De,b as oe,aW as se,ag as be,a as xe,aX as Ne,aY as Je,aZ as Te,a_ as Se}from"./bin.js";const ye=ke(import.meta.url),z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$e=D(e=>{if(typeof z<"u"&&z.versions&&z.versions.node){const[s,o]=z.versions.node.split(".").map(Number);if(s>22||s===22&&o>=3||s===20&&o>=16)return z.getBuiltinModule(e)}return ye(e)},"__cjs_getBuiltinModule"),{readFileSync:ie,writeFileSync:ee}=$e("node:fs");var Re=Object.defineProperty,O=D((e,s)=>Re(e,"name",{value:s,configurable:!0}),"r$3");const We=O(e=>/[*?[\]{}!]/.test(e),"isGlob"),je=O(e=>typeof e=="string"?e:e.reason,"ruleReason"),Me=O(e=>typeof e=="string"?void 0:e.replacement,"ruleReplacement"),ae=O((e,s)=>e.some(o=>re(o,s)),"matchesAnyGlob"),ne=O((e,s)=>{if(typeof e=="string")return!0;const o=Array.isArray(e.packages)&&e.packages.length>0,t=Array.isArray(e.paths)&&e.paths.length>0;return!!(!o&&!t||o&&s.packageName!==void 0&&ae(e.packages,s.packageName)||t&&ae(e.paths,s.packageDir))},"ruleAppliesToInstance"),Fe=O((e,s)=>{const o=s[e.depName];if(o!==void 0&&ne(o,e))return{pattern:e.depName,rule:o};for(const[t,r]of Object.entries(s))if(We(t)&&re(t,e.depName)&&ne(r,e))return{pattern:t,rule:r}},"findMatchingRule"),Ie=O((e,s)=>{if(Object.keys(s).length===0)return[];const o=[];for(const t of e){if(t.isInternal)continue;const r=Fe(t,s);r&&o.push({depName:t.depName,depType:t.depType,matchedPattern:r.pattern,packageDir:t.packageDir,packageJsonPath:t.packageJsonPath,packageName:t.packageName,reason:je(r.rule),replacement:Me(r.rule),specifier:t.specifier})}return o},"lintBannedDeps");var Ee=Object.defineProperty,_=D((e,s)=>Ee(e,"name",{value:s,configurable:!0}),"m");const Ce=new Set(["dependencies","devDependencies","peerDependencies"]),Ve=_(e=>e.startsWith("catalog:"),"isCatalogReference"),Ae=_(e=>e.startsWith("workspace:"),"isWorkspaceReference"),Oe=_((e,s)=>{if(!e)return!1;for(const o of e.values())if(o.has(s))return!0;return!1},"isPinnedInAnyCatalog"),He=_((e,s={})=>{const o=s.min??3,t=new Set(s.ignoreDeps),r=e.filter(i=>i.isInternal||!Ce.has(i.depType)||Ae(i.specifier)||s.dep!==void 0&&i.depName!==s.dep?!1:!t.has(i.depName)),n=new Map;for(const i of r){const p=n.get(i.depName);p?p.push(i):n.set(i.depName,[i])}const a=[];for(const[i,p]of n){if(Oe(s.catalogs,i)||p.some(m=>Ve(m.specifier)))continue;const c=new Map;for(const m of p){let d=c.get(m.specifier);d||(d=new Set,c.set(m.specifier,d)),d.add(m.packageJsonPath)}const f=[...c.entries()].sort((m,d)=>m[1].size!==d[1].size?d[1].size-m[1].size:m[0].localeCompare(d[0]))[0];!f||f[1].size<o||a.push({catalogName:"default",depName:i,instanceCount:f[1].size,specifier:f[0]})}return a.sort((i,p)=>i.depName.localeCompare(p.depName))},"proposeCatalogAdditions"),_e=_((e,s)=>{if(s.length===0)return;const o=W(e,"pnpm-workspace.yaml"),t=I(o)?ie(o,"utf8"):"",r=t.includes(`\r
|
|
2
|
+
`)?`\r
|
|
3
|
+
`:`
|
|
4
|
+
`,n=s.filter(d=>d.catalogName==="default").sort((d,g)=>d.depName.localeCompare(g.depName));if(n.length===0)return;const a=t.length>0?t.split(r):[],i=a.findIndex(d=>/^catalog\s*:\s*$/.test(d));if(i===-1){const d=["catalog:"];for(const $ of n)d.push(` ${$.depName}: "${$.specifier}"`);let g=0;for(;g<a.length&&(a[g]??"").trim().length===0;)g+=1;const h=[...a.slice(0,g),...d,"",...a.slice(g)].join(r);return ee(o,h.endsWith(r)?h:`${h}${r}`),o}let p=a.length;const c=new Set;for(let d=i+1;d<a.length;d+=1){const g=a[d]??"",h=g.trimStart();if(g.length===0)continue;if(g.length-h.length===0&&h.length>0&&!h.startsWith("#")){p=d;break}const $=/^([\w./@-]+)\s*:/.exec(h);$?.[1]&&c.add($[1])}const f=[];for(const d of n)c.has(d.depName)||f.push(` ${d.depName}: "${d.specifier}"`);if(f.length===0)return;const m=[...a.slice(0,p),...f,...a.slice(p)].join(r);return ee(o,m.endsWith(r)?m:`${m}${r}`),o},"applyCatalogProposals"),ze=_((e,s)=>{if(s.length===0)return"";const o=W(e,"pnpm-workspace.yaml"),t=I(o)?ie(o,"utf8"):"",r=[...s].sort((i,p)=>i.depName.localeCompare(p.depName)),n=["--- pnpm-workspace.yaml","+++ pnpm-workspace.yaml"],a=t.includes(`\r
|
|
5
|
+
`)?`\r
|
|
6
|
+
`:`
|
|
7
|
+
`;if((t.length>0?t.split(a):[]).findIndex(i=>/^catalog\s*:\s*$/.test(i))===-1){n.push("@@ +1 @@","+catalog:");for(const i of r)n.push(`+ ${i.depName}: "${i.specifier}"`)}else{n.push("@@ catalog: @@");for(const i of r)n.push(`+ ${i.depName}: "${i.specifier}"`)}return n.join(a)},"renderCatalogProposalsDiff");var Be=Object.defineProperty,ce=D((e,s)=>Be(e,"name",{value:s,configurable:!0}),"l");const Le=ce(e=>{const s=[],o=pe(e);if(o){const r=W(e,"pnpm-workspace.yaml");for(const n of o)n.startsWith("!")||te(e,[n]).length===0&&s.push({pattern:n,source:"pnpm-workspace.yaml",sourcePath:r})}const t=W(e,"package.json");if(I(t)){const r=j(t).workspaces,n=Array.isArray(r)?r:r?.packages;if(n)for(const a of n)typeof a!="string"||a.startsWith("!")||te(e,[a]).length===0&&s.push({pattern:a,source:"package.json",sourcePath:t})}return s},"lintDeadWorkspacePatterns"),qe=ce((e,s={})=>{const{useEditorconfig:o}=s,t=new Map;for(const n of e){const a=t.get(n.sourcePath);a?a.push(n):t.set(n.sourcePath,[n])}const r=[];for(const[n,a]of t){const i=new Set(a.map(f=>f.pattern));if(n.endsWith(".yaml")||n.endsWith(".yml")){const f=Pe(n).split(`
|
|
8
|
+
`).filter(m=>{const d=m.trim();if(!d.startsWith("- "))return!0;const g=d.slice(2).replaceAll(/^['"]|['"]$/g,"");return!i.has(g)}).join(`
|
|
9
|
+
`);ve(n,f,{overwrite:!0}),r.push(n);continue}const p=j(n),c=p.workspaces;Array.isArray(c)?p.workspaces=c.filter(f=>typeof f!="string"||!i.has(f)):c&&Array.isArray(c.packages)&&(c.packages=c.packages.filter(f=>typeof f!="string"||!i.has(f))),E(n,p,{indent:C(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},"applyDeadWorkspacePatternFixes");var Ue=Object.defineProperty,fe=D((e,s)=>Ue(e,"name",{value:s,configurable:!0}),"f$2");const Ge=["dependencies","devDependencies","peerDependencies","optionalDependencies"],Ke=fe((e,s={})=>{const o=new Set(s.ignoreBlocks),t=we(e),r=[];for(const n of t){const a=W(e,n,"package.json"),i=L(a);if(!i)continue;const p=typeof i.name=="string"?i.name:void 0;for(const c of Ge){if(o.has(c))continue;const f=i[c];typeof f=="object"&&f!==null&&!Array.isArray(f)&&Object.keys(f).length===0&&r.push({depType:c,packageDir:n,packageJsonPath:a,packageName:p})}}return r},"lintEmptyDeps"),Xe=fe((e,s={})=>{const{useEditorconfig:o}=s,t=new Map;for(const n of e){const a=t.get(n.packageJsonPath);a?a.push(n):t.set(n.packageJsonPath,[n])}const r=[];for(const[n,a]of t){const i=j(n);for(const p of a){const c=i[p.depType];typeof c=="object"&&c!==null&&!Array.isArray(c)&&Object.keys(c).length===0&&Reflect.deleteProperty(i,p.depType)}E(n,i,{indent:C(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},"applyEmptyDepsFixes");var Ye=Object.defineProperty,le=D((e,s)=>Ye(e,"name",{value:s,configurable:!0}),"o");const Ze=/\/+$/,X=/node_modules/,Y=/\.git/,Qe=/[$()+.?[\\\]^{|}]/g,et=/\/\*\*$|\/\*\/\*$/,tt=le((e,s)=>{const o=s.replace(Ze,"");if(o.startsWith("!"))return[];const t=[];if(o.endsWith("/*")){const n=o.slice(0,-2),a=G(e,n);if(!I(a))return[];for(const i of K(a,{includeFiles:!1,includeSymlinks:!1,maxDepth:1,skip:[X,Y]}))i.path===a||i.name.startsWith(".")||t.push(W(n,i.name));return t}if(o.endsWith("/**")||o.endsWith("/*/*")){const n=o.replace(et,""),a=G(e,n);if(!I(a))return[];for(const i of K(a,{includeFiles:!1,includeSymlinks:!1,skip:[X,Y]})){if(i.path===a)continue;const p=i.path.slice(a.length+1);t.push(`${n}/${p}`)}return t}if(!o.includes("/")&&o.includes("*")){const n=o.replaceAll(Qe,String.raw`\$&`).replaceAll("*",".*"),a=new RegExp(`^${n}$`);for(const i of K(e,{includeFiles:!1,includeSymlinks:!1,maxDepth:1,skip:[X,Y]}))i.path!==e&&a.test(i.name)&&t.push(i.name);return t}const r=G(e,o);return I(r)&&t.push(o),t},"collectPatternMatches"),ot=le(e=>{const s=pe(e)??De(e)??[],o=new Set,t=[];for(const r of s)for(const n of tt(e,r))n==="."||o.has(n)||(o.add(n),I(W(e,n,"package.json"))||t.push({packageDir:n}));return t},"lintMissingPackageJson");var st=Object.defineProperty,at=D((e,s)=>st(e,"name",{value:s,configurable:!0}),"r$2");const nt=["dependencies","devDependencies","optionalDependencies","peerDependencies"],rt=at((e,s={})=>{const o=new Set(s.depTypes??nt),t=new Set(s.ignoreDeps),r=new Map;for(const a of e)a.packageDir!=="."||!o.has(a.depType)||r.set(a.depName,{depType:a.depType,specifier:a.specifier});if(r.size===0)return[];const n=[];for(const a of e){if(a.packageDir==="."||!o.has(a.depType)||t.has(a.depName))continue;const i=r.get(a.depName);i&&n.push({childSpecifier:a.specifier,depName:a.depName,depType:a.depType,packageDir:a.packageDir,packageJsonPath:a.packageJsonPath,packageName:a.packageName,rootDepType:i.depType,rootSpecifier:i.specifier})}return n},"lintRedefineRoot");var it=Object.defineProperty,ge=D((e,s)=>it(e,"name",{value:s,configurable:!0}),"a$1");const pt=ge((e,s)=>{if(!s)return[];const o=W(e,"package.json"),t=L(o);if(!t)return[];if(t.private!==!0)return[];const r=t.dependencies;if(typeof r!="object"||r===null||Array.isArray(r))return[];const n=Object.keys(r);return n.length===0?[]:[{depNames:n,packageJsonPath:o}]},"lintRootDeps"),ct=ge((e,s={})=>{const{useEditorconfig:o}=s,t=[];for(const r of e){const n=j(r.packageJsonPath),a=n.dependencies;if(typeof a!="object"||a===null)continue;const i=a;n.devDependencies??={};const p=n.devDependencies;for(const c of r.depNames){const f=i[c];typeof f=="string"&&(c in p||(p[c]=f),Reflect.deleteProperty(i,c))}Object.keys(i).length===0&&Reflect.deleteProperty(n,"dependencies"),E(r.packageJsonPath,n,{indent:C(r.packageJsonPath,{useEditorconfig:o}),overwrite:!0}),t.push(r.packageJsonPath)}return t},"applyRootDepsFixes");var ft=Object.defineProperty,de=D((e,s)=>ft(e,"name",{value:s,configurable:!0}),"r$1");const lt=/^[a-z][\w-]*@\S+$/i,gt=de((e,s,o={})=>{if(!s)return[];const t=W(e,"package.json"),r=L(t);if(!r)return[];const n=r.packageManager;return typeof n=="string"&<.test(n)?[]:[{packageJsonPath:t,suggested:o.suggested}]},"lintRootPackageManager"),dt=de((e,s={})=>{const{useEditorconfig:o}=s,t=[];for(const r of e){if(!r.suggested)continue;const n=j(r.packageJsonPath);n.packageManager=r.suggested,E(r.packageJsonPath,n,{indent:C(r.packageJsonPath,{useEditorconfig:o}),overwrite:!0}),t.push(r.packageJsonPath)}return t},"applyRootPackageManagerFixes");var ut=Object.defineProperty,ue=D((e,s)=>ut(e,"name",{value:s,configurable:!0}),"a");const mt=ue((e,s)=>{if(!s)return[];const o=W(e,"package.json"),t=L(o);return t?t.private===!0?[]:[{packageJsonPath:o,rawValue:t.private}]:[]},"lintRootPrivate"),ht=ue((e,s={})=>{const{useEditorconfig:o}=s,t=[];for(const r of e){const n=j(r.packageJsonPath);let a=n;if("private"in n)n.private=!0;else{const{name:i,version:p,...c}=n,f={};i!==void 0&&(f.name=i),p!==void 0&&(f.version=p),f.private=!0;for(const[m,d]of Object.entries(c))f[m]=d;a=f}E(r.packageJsonPath,a,{indent:C(r.packageJsonPath,{useEditorconfig:o}),overwrite:!0}),t.push(r.packageJsonPath)}return t},"applyRootPrivateFixes");var kt=Object.defineProperty,Q=D((e,s)=>kt(e,"name",{value:s,configurable:!0}),"p$1");const yt=[{id:"react",label:"React",members:["react","react-dom","react-test-renderer"]},{id:"next",label:"Next.js",members:["next","@next/font","@next/bundle-analyzer","@next/mdx","@next/third-parties","@next/eslint-plugin-next","eslint-config-next"]},{id:"babel",label:"Babel",prefixes:["@babel/"]},{id:"storybook",label:"Storybook",members:["storybook","sb"],prefixes:["@storybook/"]},{id:"vitest",label:"Vitest",members:["vitest"],prefixes:["@vitest/"]},{id:"playwright",label:"Playwright",members:["playwright","@playwright/test"]},{id:"trpc",label:"tRPC",prefixes:["@trpc/"]},{id:"prisma",label:"Prisma",members:["prisma"],prefixes:["@prisma/"]},{id:"turborepo",label:"Turborepo",members:["turbo","turbo-ignore","@turbo/gen","eslint-config-turbo","eslint-plugin-turbo"]},{id:"typescript-eslint",label:"typescript-eslint",members:["typescript-eslint"],prefixes:["@typescript-eslint/"]},{id:"eslint-stylistic",label:"ESLint Stylistic",prefixes:["@stylistic/"]},{id:"lexical",label:"Lexical",members:["lexical"],prefixes:["@lexical/"]},{id:"nx",label:"Nx",prefixes:["@nx/","@nrwl/"]}],$t=new Set(["dependencies","devDependencies","peerDependencies"]),Pt=Q((e,s)=>{for(const o of e)if(o.members?.includes(s)||o.prefixes?.some(t=>s.startsWith(t)))return o},"familyForDep"),vt=Q(e=>e.startsWith("workspace:")||e.startsWith("catalog:"),"isWorkspaceOrCatalogReference"),wt=Q((e,s={})=>{const o=new Set(s.ignoreFamilies),t=new Map;for(const i of yt)t.set(i.id,i);for(const i of s.extraFamilies??[])t.set(i.id,i);const r=[...t.values()],n=new Map;for(const i of e){if(i.isInternal||!$t.has(i.depType)||vt(i.specifier))continue;const p=Pt(r,i.depName);if(!p||o.has(p.id))continue;const c=n.get(p.id),f={depName:i.depName,depType:i.depType,packageDir:i.packageDir,packageJsonPath:i.packageJsonPath,packageName:i.packageName,specifier:i.specifier};c?c.push(f):n.set(p.id,[f])}const a=[];for(const[i,p]of n){const c=[...new Set(p.map(m=>m.specifier))];if(c.length<2)continue;const f=t.get(i);f&&a.push({family:i,familyLabel:f.label??i,members:p,specifiers:c})}return a},"lintSimilarDeps");var Dt=Object.defineProperty,B=D((e,s)=>Dt(e,"name",{value:s,configurable:!0}),"r");const bt=B(e=>e.startsWith("@types/"),"isTypesPackage"),xt=B((e,s={})=>{const o=new Set(s.ignoreDeps),t=new Map,r=B(a=>{const i=t.get(a);if(i!==void 0)return i;try{const p=j(a).private===!0;return t.set(a,p),p}catch{return t.set(a,!1),!1}},"isPrivate"),n=[];for(const a of e)a.depType==="dependencies"&&bt(a.depName)&&(o.has(a.depName)||r(a.packageJsonPath)&&n.push({childSpecifier:a.specifier,depName:a.depName,packageDir:a.packageDir,packageJsonPath:a.packageJsonPath,packageName:a.packageName}));return n},"lintTypesInDeps"),Nt=B((e,s={})=>{const{useEditorconfig:o}=s,t=new Map;for(const n of e){const a=t.get(n.packageJsonPath);a?a.push(n):t.set(n.packageJsonPath,[n])}const r=[];for(const[n,a]of t){const i=j(n),p=i.dependencies;if(typeof p!="object"||p===null)continue;const c=p;i.devDependencies??={};const f=i.devDependencies;for(const m of a){const d=c[m.depName];typeof d=="string"&&(m.depName in f||(f[m.depName]=d),Reflect.deleteProperty(c,m.depName))}Object.keys(c).length===0&&Reflect.deleteProperty(i,"dependencies"),E(n,i,{indent:C(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},"applyTypesInDepsFixes");var Jt=Object.defineProperty,q=D((e,s)=>Jt(e,"name",{value:s,configurable:!0}),"f");const Tt=q(e=>e.startsWith("workspace:"),"isWorkspaceSpecifier"),St=q((e,s={})=>{const o=s.fixSpecifier??"workspace:*",t=[];for(const r of e)r.isInternal&&(Tt(r.specifier)||t.push({depName:r.depName,depType:r.depType,fix:o,packageDir:r.packageDir,packageJsonPath:r.packageJsonPath,packageName:r.packageName,specifier:r.specifier}));return t},"lintWorkspaceProtocol"),Rt=q((e,s,o,t)=>{const r=s.split(".");let n=e;for(let p=0;p<r.length-1;p+=1){const c=r[p],f=n[c];(typeof f!="object"||f===null)&&(n[c]={}),n=n[c]}const a=r.at(-1);let i=n[a];(typeof i!="object"||i===null)&&(i={},n[a]=i),i[o]=t},"setNestedField"),Wt=q((e,s={})=>{const{useEditorconfig:o}=s,t=new Map;for(const n of e){const a=t.get(n.packageJsonPath);a?a.push(n):t.set(n.packageJsonPath,[n])}const r=[];for(const[n,a]of t){const i=j(n);for(const p of a)if(p.depType.includes("."))Rt(i,p.depType,p.depName,p.fix);else{const c=i[p.depType];typeof c=="object"&&c!==null&&(c[p.depName]=p.fix)}E(n,i,{indent:C(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},"applyWorkspaceProtocolFixes");var jt=Object.defineProperty,V=D((e,s)=>jt(e,"name",{value:s,configurable:!0}),"p");const Mt=new Set(["dependencies","devDependencies","peerDependencies"]),Ft=V(e=>e.startsWith("catalog:"),"isCatalogReference"),It=V(e=>e.startsWith("workspace:"),"isWorkspaceReference"),Et=V(e=>{if(!e.startsWith("catalog:"))return;const s=e.slice(8);return s===""?"default":s},"catalogNameOf"),Ct=V((e,s)=>{if(e.get("default")?.has(s))return"default";const o=[...e.keys()].filter(t=>t!=="default").sort();for(const t of o)if(e.get(t)?.has(s))return t},"findCatalogPinning"),Vt=V(e=>e==="default"?"catalog:":`catalog:${e}`,"buildCatalogSpecifier"),At=V((e,s)=>{const o=[...e].sort((r,n)=>(r.packageName??r.packageDir).localeCompare(n.packageName??n.packageDir));let t;for(const r of o){const n=oe(r.specifier);if(!n)continue;if(!t){t=r;continue}const a=oe(t.specifier);if(!a){t=r;continue}const i=se(a,n),p=se(n,a);(s==="highest"&&i||s==="lowest"&&p)&&(t=r)}if(t)return{canonical:t,canonicalSource:t.packageName??t.packageDir}},"pickCanonicalBySemver"),Ot=V((e,s={})=>{const o=s.resolve??"highest",t=new Set(s.ignoreDeps),r=[],n=e.filter(i=>i.isInternal||!Mt.has(i.depType)||It(i.specifier)||s.dep!==void 0&&i.depName!==s.dep?!1:!t.has(i.depName)),a=new Map;for(const i of n){const p=a.get(i.depName);p?p.push(i):a.set(i.depName,[i])}for(const[i,p]of a){const c=s.pinned?.get(i);if(c!==void 0){for(const g of p)g.specifier!==c&&r.push({canonicalSource:"cli:--pin",depName:i,depType:g.depType,fix:c,packageDir:g.packageDir,packageJsonPath:g.packageJsonPath,packageName:g.packageName,specifier:g.specifier});continue}if(o==="catalog"){const{catalogs:g}=s;if(!g)continue;const h=Ct(g,i);if(!h)continue;const $=Vt(h);for(const T of p)Et(T.specifier)!==h&&r.push({canonicalSource:`catalog:${h}`,depName:i,depType:T.depType,fix:$,packageDir:T.packageDir,packageJsonPath:T.packageJsonPath,packageName:T.packageName,specifier:T.specifier});continue}const f=p.filter(g=>!Ft(g.specifier));if(f.length<2||new Set(f.map(g=>g.specifier)).size<=1)continue;const m=At(f,o);if(!m)continue;const d=m.canonical.specifier;for(const g of f)g.specifier!==d&&r.push({canonicalSource:m.canonicalSource,depName:i,depType:g.depType,fix:d,packageDir:g.packageDir,packageJsonPath:g.packageJsonPath,packageName:g.packageName,specifier:g.specifier})}return r},"lintWorkspaceVersions"),Ht=V((e,s={})=>{const{useEditorconfig:o}=s,t=new Map;for(const n of e){const a=t.get(n.packageJsonPath);a?a.push(n):t.set(n.packageJsonPath,[n])}const r=[];for(const[n,a]of t){const i=j(n);for(const p of a){const c=i[p.depType];typeof c=="object"&&c!==null&&(c[p.depName]=p.fix)}E(n,i,{indent:C(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},"applyWorkspaceVersionsFixes");var _t=Object.defineProperty,y=D((e,s)=>_t(e,"name",{value:s,configurable:!0}),"d");const zt=y(e=>{if(I(W(e,"pnpm-workspace.yaml")))return!0;const s=W(e,"package.json");if(!I(s))return!1;try{return j(s).workspaces!==void 0}catch{return!1}},"detectWorkspaceConfig"),A=y((e,s)=>{const o=new Map;for(const t of e){const r=s(t),n=o.get(r);n?n.push(t):o.set(r,[t])}return o},"groupBy"),Bt=y((e,s,o,t)=>{if(e.length===0){t.info(w("✓ workspace-protocol: no violations"));return}const r=o?"Fixed":"Found",n=o?R:x;t.info(n(v(`${r} ${String(e.length)} workspace-protocol violation${e.length===1?"":"s"}`)));for(const[a,i]of A(e,p=>p.packageName??p.packageJsonPath)){const p=P(s,i[0].packageJsonPath);t.info(` ${v(a)} ${u(`(${p})`)}`);for(const c of i){const f=o?R("→"):x("→");t.info(` ${u(c.depType)} ${c.depName}: ${b(c.specifier)} ${f} ${w(c.fix)}`)}}o||t.info(u(" Run with --fix to rewrite specifiers in place."))},"printWorkspaceProtocolHuman"),Lt=y((e,s,o)=>{if(e.length===0){o.info(w("✓ redefine-root: no violations"));return}o.info(x(v(`Found ${String(e.length)} dep${e.length===1?"":"s"} re-declared from root`)));for(const[t,r]of A(e,n=>n.packageName??n.packageJsonPath)){const n=P(s,r[0].packageJsonPath);o.info(` ${v(t)} ${u(`(${n})`)}`);for(const a of r)o.info(` ${u(a.depType)} ${a.depName}: ${b(a.childSpecifier)} ${u(`(root ${a.rootDepType}: ${a.rootSpecifier})`)}`)}o.info(u(" Remove these from child package.json files — root pin will resolve."))},"printRedefineRootHuman"),qt=y((e,s,o,t)=>{if(e.length===0){t.info(w("✓ workspace-versions: no drift"));return}const r=o?"Fixed":"Found",n=o?R:x;t.info(n(v(`${r} ${String(e.length)} workspace-version drift${e.length===1?"":"s"}`)));for(const[a,i]of A(e,p=>p.depName)){const p=i[0].fix,c=i[0].canonicalSource;t.info(` ${v(a)} ${u(`canonical: ${p} (from ${c})`)}`);for(const f of i){const m=P(s,f.packageJsonPath),d=f.packageName??m,g=o?R("→"):x("→");t.info(` ${d} ${u(`(${m})`)} ${u(f.depType)}: ${b(f.specifier)} ${g} ${w(f.fix)}`)}}o||t.info(u(" Run with --fix to align drifting specifiers."))},"printWorkspaceVersionsHuman"),Ut=y((e,s,o)=>{if(e.length===0){o.info(w("✓ banned-deps: no violations"));return}o.info(b(v(`Found ${String(e.length)} banned dep${e.length===1?"":"s"}`)));for(const[t,r]of A(e,n=>n.packageName??n.packageJsonPath)){const n=P(s,r[0].packageJsonPath);o.info(` ${v(t)} ${u(`(${n})`)}`);for(const a of r){const i=a.replacement?` ${u("→")} ${w(a.replacement)}`:"";o.info(` ${u(a.depType)} ${b(a.depName)}${i}`),o.info(` ${u(a.reason)}`)}}},"printBannedDepsHuman"),Gt=y((e,s,o,t)=>{if(e.length===0){t.info(w("✓ catalog-proposals: nothing worth promoting"));return}const r=o?"Added":"Would add",n=o?R:x;t.info(n(v(`${r} ${String(e.length)} catalog entr${e.length===1?"y":"ies"}`)));for(const a of e)t.info(` ${v(a.depName)}: ${w(a.specifier)} ${u(`(${String(a.instanceCount)} packages agree)`)}`);if(!o){const a=ze(s,e);if(a){t.info(""),t.info(u("Proposed pnpm-workspace.yaml changes:"));for(const i of a.split(`
|
|
10
|
+
`))i.startsWith("+")?t.info(w(i)):i.startsWith("-")?t.info(b(i)):t.info(u(i))}t.info(u(" Run with --fix to write these entries to pnpm-workspace.yaml."))}},"printCatalogProposalsHuman"),Kt=y((e,s,o,t)=>{if(e.length===0){t.info(w("✓ custom-types: no engines / packageManager / volta drift"));return}const r=o?"Fixed":"Found",n=o?R:x;t.info(n(v(`${r} ${String(e.length)} custom-type drift${e.length===1?"":"s"}`)));for(const[a,i]of A(e,p=>`${p.customType} ${p.depName}`)){const p=i[0].fix,c=i[0].canonicalSource;t.info(` ${v(a)} ${u(`canonical: ${p} (from ${c})`)}`);for(const f of i){const m=P(s,f.packageJsonPath),d=f.packageName??m,g=o?R("→"):x("→");t.info(` ${d} ${u(`(${m})`)}: ${b(f.specifier)} ${g} ${w(f.fix)}`)}}o||t.info(u(" Run with --fix to align engines/packageManager/volta versions."))},"printCustomTypesHuman"),Xt=y((e,s,o,t)=>{if(e.length===0){t.info(w("✓ empty-deps: no empty dependency blocks"));return}const r=o?"Removed":"Found",n=o?R:x;t.info(n(v(`${r} ${String(e.length)} empty dependency block${e.length===1?"":"s"}`)));for(const[a,i]of A(e,p=>p.packageName??p.packageJsonPath)){const p=P(s,i[0].packageJsonPath);t.info(` ${v(a)} ${u(`(${p})`)}`);for(const c of i)t.info(` ${u(c.depType)}: ${b("{}")}`)}o||t.info(u(" Run with --fix to drop empty blocks."))},"printEmptyDepsHuman"),Yt=y((e,s,o,t)=>{if(e.length===0){t.info(w('✓ root-private: root package.json is "private": true'));return}const r=o?"Set":"Missing",n=o?R:b;for(const a of e){const i=P(s,a.packageJsonPath);if(t.info(n(v(`${r} "private": true on root ${u(`(${i})`)}`))),!o){const p=a.rawValue===void 0?"absent":JSON.stringify(a.rawValue);t.info(` ${u("current:")} ${b(p)}`)}}o||t.info(u(' Run with --fix to set "private": true.'))},"printRootPrivateHuman"),Zt=y((e,s,o,t)=>{if(e.length===0){t.info(w("✓ root-package-manager: packageManager field present"));return}const r=o?"Set":"Missing",n=o?R:b;for(const a of e){const i=P(s,a.packageJsonPath);t.info(n(v(`${r} packageManager on root ${u(`(${i})`)}`))),!o&&!a.suggested&&t.info(u(" no canonical specifier configured (set policy.rootPackageManager.suggested to enable --fix)"))}o||t.info(u(' e.g. "packageManager": "pnpm@10.32.1"'))},"printRootPackageManagerHuman"),Qt=y((e,s,o,t)=>{if(e.length===0){t.info(w("✓ root-deps: no runtime dependencies on private root"));return}const r=o?"Moved":"Found",n=o?R:x;for(const a of e){const i=P(s,a.packageJsonPath);t.info(n(v(`${r} ${String(a.depNames.length)} runtime dep${a.depNames.length===1?"":"s"} on private root ${u(`(${i})`)}`)));for(const p of a.depNames)t.info(` ${b(p)}`)}o||t.info(u(" Run with --fix to move them to devDependencies."))},"printRootDepsHuman"),eo=y((e,s)=>{if(e.length===0){s.info(w("✓ missing-package-json: every workspace dir has a package.json"));return}s.info(x(v(`Found ${String(e.length)} workspace dir${e.length===1?"":"s"} without a package.json`)));for(const o of e)s.info(` ${b(o.packageDir)}`);s.info(u(" Either delete the directory or scaffold a package.json (vis create)."))},"printMissingPackageJsonHuman"),to=y((e,s,o)=>{if(e.length===0){o.info(w("✓ dead-workspace-pattern: every workspace pattern matches at least one package"));return}const t=s?"Removed":"Found",r=s?R:x;o.info(r(v(`${t} ${String(e.length)} unmatched workspace pattern${e.length===1?"":"s"}`)));for(const[n,a]of A(e,i=>i.source)){o.info(` ${v(n)}`);for(const i of a)o.info(` ${b(i.pattern)}`)}s||o.info(u(" Run with --fix to drop dead patterns."))},"printDeadWorkspacePatternsHuman"),oo=y((e,s,o,t)=>{if(e.length===0){t.info(w("✓ types-in-deps: no @types/* in dependencies of private packages"));return}const r=o?"Moved":"Found",n=o?R:x;t.info(n(v(`${r} ${String(e.length)} @types/* dep${e.length===1?"":"s"} in dependencies`)));for(const[a,i]of A(e,p=>p.packageName??p.packageJsonPath)){const p=P(s,i[0].packageJsonPath);t.info(` ${v(a)} ${u(`(${p})`)}`);for(const c of i)t.info(` ${b(c.depName)} ${u(c.childSpecifier)}`)}o||t.info(u(" Run with --fix to move them to devDependencies."))},"printTypesInDepsHuman"),so=y((e,s,o)=>{if(e.length===0){o.info(w("✓ similar-deps: every related dep family is in sync"));return}o.info(x(v(`Found ${String(e.length)} family${e.length===1?"":" families"} with version drift`)));for(const t of e){o.info(` ${v(t.familyLabel)} ${u(`(${t.specifiers.join(", ")})`)}`);for(const r of t.members){const n=P(s,r.packageJsonPath),a=r.packageName??n;o.info(` ${a} ${u(`(${n})`)} ${u(r.depType)}: ${b(r.depName)}@${x(r.specifier)}`)}}o.info(u(" Pick a single specifier per family and align by hand — auto-fix is unsafe across name boundaries."))},"printSimilarDepsHuman"),ao=y((e,s,o,t,r)=>{let n=!0;const a=y(i=>{n||r.info(""),n=!1,i()},"section");t.workspaceProtocol&&a(()=>{Bt(e.workspaceProtocol??[],s,o.workspaceProtocol,r)}),t.redefineRoot&&a(()=>{Lt(e.redefineRoot??[],s,r)}),t.workspaceVersions&&a(()=>{qt(e.workspaceVersions??[],s,o.workspaceVersions,r)}),t.customTypes&&a(()=>{Kt(e.customTypes??[],s,o.customTypes,r)}),e.catalogProposals!==void 0&&a(()=>{Gt(e.catalogProposals??[],s,o.catalogProposals,r)}),t.bannedDeps&&a(()=>{Ut(e.bannedDeps??[],s,r)}),t.emptyDeps&&a(()=>{Xt(e.emptyDeps??[],s,o.emptyDeps,r)}),t.rootPrivate&&a(()=>{Yt(e.rootPrivate??[],s,o.rootPrivate,r)}),t.rootPackageManager&&a(()=>{Zt(e.rootPackageManager??[],s,o.rootPackageManager,r)}),t.rootDeps&&a(()=>{Qt(e.rootDeps??[],s,o.rootDeps,r)}),t.missingPackageJson&&a(()=>{eo(e.missingPackageJson??[],r)}),t.deadWorkspacePatterns&&a(()=>{to(e.deadWorkspacePatterns??[],o.deadWorkspacePatterns,r)}),t.typesInDeps&&a(()=>{oo(e.typesInDeps??[],s,o.typesInDeps,r)}),t.similarDeps&&a(()=>{so(e.similarDeps??[],s,r)})},"printHuman"),no=y((e,s)=>{for(const o of e.workspaceProtocol??[]){const t=P(s,o.packageJsonPath);process.stdout.write(`workspace-protocol ${t} ${o.depType} ${o.depName} ${o.specifier} → ${o.fix}
|
|
11
|
+
`)}for(const o of e.redefineRoot??[]){const t=P(s,o.packageJsonPath);process.stdout.write(`redefine-root ${t} ${o.depType} ${o.depName} ${o.childSpecifier}
|
|
12
|
+
`)}for(const o of e.workspaceVersions??[]){const t=P(s,o.packageJsonPath);process.stdout.write(`workspace-versions ${t} ${o.depType} ${o.depName} ${o.specifier} → ${o.fix}
|
|
13
|
+
`)}for(const o of e.customTypes??[]){const t=P(s,o.packageJsonPath);process.stdout.write(`custom-types ${t} ${o.customType} ${o.depName} ${o.specifier} → ${o.fix}
|
|
14
|
+
`)}for(const o of e.bannedDeps??[]){const t=P(s,o.packageJsonPath);process.stdout.write(`banned-deps ${t} ${o.depType} ${o.depName} ${o.reason}
|
|
15
|
+
`)}for(const o of e.catalogProposals??[])process.stdout.write(`catalog-proposal ${o.catalogName} ${o.depName} ${o.specifier} ${String(o.instanceCount)}
|
|
16
|
+
`);for(const o of e.emptyDeps??[]){const t=P(s,o.packageJsonPath);process.stdout.write(`empty-deps ${t} ${o.depType}
|
|
17
|
+
`)}for(const o of e.rootPrivate??[]){const t=P(s,o.packageJsonPath);process.stdout.write(`root-private ${t}
|
|
18
|
+
`)}for(const o of e.rootPackageManager??[]){const t=P(s,o.packageJsonPath);process.stdout.write(`root-package-manager ${t} ${o.suggested??""}
|
|
19
|
+
`)}for(const o of e.rootDeps??[]){const t=P(s,o.packageJsonPath);for(const r of o.depNames)process.stdout.write(`root-deps ${t} ${r}
|
|
20
|
+
`)}for(const o of e.missingPackageJson??[])process.stdout.write(`missing-package-json ${o.packageDir}
|
|
21
|
+
`);for(const o of e.deadWorkspacePatterns??[])process.stdout.write(`dead-workspace-pattern ${o.source} ${o.pattern}
|
|
22
|
+
`);for(const o of e.typesInDeps??[]){const t=P(s,o.packageJsonPath);process.stdout.write(`types-in-deps ${t} ${o.depName} ${o.childSpecifier}
|
|
23
|
+
`)}for(const o of e.similarDeps??[])for(const t of o.members){const r=P(s,t.packageJsonPath);process.stdout.write(`similar-deps ${o.family} ${r} ${t.depType} ${t.depName} ${t.specifier}
|
|
24
|
+
`)}},"printMinimal"),ro=y((e,s,o,t)=>{const r=y(a=>({...a,packageJsonPath:P(s,a.packageJsonPath)}),"relativize"),n={fixed:o};if(t.workspaceProtocol){const a=(e.workspaceProtocol??[]).map(i=>r(i));n.workspaceProtocol={issues:a,total:a.length}}if(t.redefineRoot){const a=(e.redefineRoot??[]).map(i=>r(i));n.redefineRoot={issues:a,total:a.length}}if(t.workspaceVersions){const a=(e.workspaceVersions??[]).map(i=>r(i));n.workspaceVersions={issues:a,total:a.length}}if(t.customTypes){const a=(e.customTypes??[]).map(i=>r(i));n.customTypes={issues:a,total:a.length}}if(t.bannedDeps){const a=(e.bannedDeps??[]).map(i=>r(i));n.bannedDeps={issues:a,total:a.length}}if(e.catalogProposals!==void 0){const a=e.catalogProposals;n.catalogProposals={proposals:a,total:a.length}}if(t.emptyDeps){const a=(e.emptyDeps??[]).map(i=>r(i));n.emptyDeps={issues:a,total:a.length}}if(t.rootPrivate){const a=(e.rootPrivate??[]).map(i=>r(i));n.rootPrivate={issues:a,total:a.length}}if(t.rootPackageManager){const a=(e.rootPackageManager??[]).map(i=>r(i));n.rootPackageManager={issues:a,total:a.length}}if(t.rootDeps){const a=(e.rootDeps??[]).map(i=>r(i));n.rootDeps={issues:a,total:a.length}}if(t.missingPackageJson){const a=e.missingPackageJson??[];n.missingPackageJson={issues:a,total:a.length}}if(t.deadWorkspacePatterns){const a=e.deadWorkspacePatterns??[];n.deadWorkspacePatterns={issues:a,total:a.length}}if(t.typesInDeps){const a=(e.typesInDeps??[]).map(i=>r(i));n.typesInDeps={issues:a,total:a.length}}if(t.similarDeps){const a=(e.similarDeps??[]).map(i=>({...i,members:i.members.map(p=>({...p,packageJsonPath:P(s,p.packageJsonPath)}))}));n.similarDeps={issues:a,total:a.length}}process.stdout.write(`${JSON.stringify(n,void 0,2)}
|
|
25
|
+
`)},"printJson"),S=y((e,s,o)=>{const t=e[s];return typeof t=="boolean"?t:e[o]===!0},"flag"),io=y(e=>{const s=e,o=(e.ban?.length??0)>0,t=(e.pin?.length??0)>0,r=S(s,"workspaceProtocol","workspace-protocol"),n=S(s,"redefineRoot","redefine-root"),a=S(s,"bannedDeps","banned-deps"),i=S(s,"workspaceVersions","workspace-versions"),p=S(s,"customTypes","custom-types"),c=S(s,"emptyDeps","empty-deps"),f=S(s,"rootPrivate","root-private"),m=S(s,"rootPackageManager","root-package-manager"),d=S(s,"rootDeps","root-deps"),g=S(s,"missingPackageJson","missing-package-json"),h=S(s,"deadWorkspacePatterns","dead-workspace-patterns"),$=S(s,"typesInDeps","types-in-deps"),T=S(s,"similarDeps","similar-deps");return r||n||a||i||p||c||f||m||d||g||h||$||T||o||t?{bannedDeps:a||o,customTypes:p,deadWorkspacePatterns:h,emptyDeps:c,missingPackageJson:g,redefineRoot:n,rootDeps:d,rootPackageManager:m,rootPrivate:f,similarDeps:T,typesInDeps:$,workspaceProtocol:r,workspaceVersions:i||t}:{bannedDeps:!0,customTypes:!0,deadWorkspacePatterns:!0,emptyDeps:!0,missingPackageJson:!0,redefineRoot:!0,rootDeps:!0,rootPackageManager:!0,rootPrivate:!0,similarDeps:!0,typesInDeps:!0,workspaceProtocol:!0,workspaceVersions:!0}},"resolveSelection"),po=y(e=>{const s=new Map;for(const o of e??[]){const t=o.lastIndexOf("@");if(t<=0||t===o.length-1)throw new Error(`Invalid --pin "${o}". Use: name@<specifier> (e.g. react@^18.2.0).`);const r=o.slice(0,t),n=o.slice(t+1);s.set(r,n)}return s},"parsePinFlags"),co=new Set(["catalog","highest","lowest"]),fo=y(e=>{if(e===void 0)return"highest";if(!co.has(e))throw new Error(`Invalid --resolve "${e}". Use: highest, lowest, or catalog.`);return e},"parseResolveStrategy"),F=y((e,s)=>e?s===void 0||s===!0:!1,"isAutofixAllowed"),lo={"custom-types":"policy.customTypes.autofix","workspace-protocol":"policy.workspaceProtocol.autofix","workspace-versions":"policy.workspaceVersions.autofix"},Z=y((e,s,o,t)=>{const r=lo[s],n=o==="prompt"?`${r} = "prompt" (interactive mode not yet implemented; report-only)`:`${r} = false`,a=`Set "${r}": true (or remove it) to enable rewrites.`;e.warn(`${s}: ${String(t)} issue${t===1?"":"s"} not rewritten — ${n}. ${a}`)},"warnAutofixDenied"),Po=y(async({logger:e,options:s,visConfig:o,workspaceRoot:t})=>{if(!t)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const r=t,n=s.fix??!1,a=s.format??"human",i=s.quiet??!1;if(!["human","json","minimal"].includes(a))throw new Error(`Invalid --format "${a}". Use: human, json, or minimal.`);const p=io(s),c=o?.policy??{},f=o?.editorconfig??!0,m=po(s.pin),d=s.ban??[];(s.dep!==void 0||s.resolve!==void 0)&&!p.workspaceVersions&&!i&&e.warn("--dep / --resolve only apply to --workspace-versions; ignored.");const g=be(r),h={},$={catalogProposals:!1,customTypes:!1,deadWorkspacePatterns:!1,emptyDeps:!1,rootDeps:!1,rootPackageManager:!1,rootPrivate:!1,typesInDeps:!1,workspaceProtocol:!1,workspaceVersions:!1},T=zt(r);let N=0;if(p.workspaceProtocol){const l=St(g,{fixSpecifier:s.fixSpecifier}),k=F(n,c.workspaceProtocol?.autofix);k&&l.length>0&&(Wt(l,{useEditorconfig:f}),$.workspaceProtocol=!0),h.workspaceProtocol=l,k||(N+=l.length),n&&!k&&l.length>0&&!i&&Z(e,"workspace-protocol",c.workspaceProtocol?.autofix,l.length)}if(p.redefineRoot){const l=rt(g,{ignoreDeps:c.redefineRoot?.ignore});h.redefineRoot=l,N+=l.length}if(p.workspaceVersions){const l=fo(s.resolve??c.workspaceVersions?.resolve),k=l==="catalog"?xe(r):void 0;l==="catalog"&&(!k||k.size===0)&&!i&&e.warn("--resolve catalog: no catalog found in pnpm-workspace.yaml or root package.json — nothing to align.");const J=Ot(g,{catalogs:k,dep:s.dep,ignoreDeps:c.workspaceVersions?.ignore,pinned:m.size>0?m:void 0,resolve:l}),H=F(n,c.workspaceVersions?.autofix);if(H&&J.length>0&&(Ht(J,{useEditorconfig:f}),$.workspaceVersions=!0),h.workspaceVersions=J,H||(N+=J.length),n&&!H&&J.length>0&&!i&&Z(e,"workspace-versions",c.workspaceVersions?.autofix,J.length),s.proposeMin!==void 0){if(l!=="catalog"&&!i)e.warn("--propose-min only runs under --resolve catalog; ignored.");else if(l==="catalog"){const M=He(g,{catalogs:k,ignoreDeps:c.workspaceVersions?.ignore,min:s.proposeMin});H&&M.length>0&&(_e(r,M),$.catalogProposals=!0),h.catalogProposals=M}}}if(p.customTypes){const l=c.customTypes?.extraTypes,k=Ne(l);if(k.length>0){for(const me of k)e.error(`policy.customTypes.${me}`);process.exitCode=1;return}const J=Je(r,l),H=(s.resolve??c.customTypes?.resolve)==="lowest"?"lowest":"highest",M=Te(J,{dep:s.dep,ignoreDeps:c.customTypes?.ignore,resolve:H}),U=F(n,c.customTypes?.autofix);U&&M.length>0&&(Se(M,{useEditorconfig:f}),$.customTypes=!0),h.customTypes=M,U||(N+=M.length),n&&!U&&M.length>0&&!i&&Z(e,"custom-types",c.customTypes?.autofix,M.length)}if(p.bannedDeps){const l={...c.bannedDeps};for(const J of d)l[J]={reason:"banned via --ban CLI flag"};Object.keys(l).length===0&&s.bannedDeps&&!i&&e.warn("--banned-deps: no policy.bannedDeps in vis config, nothing to check.");const k=Ie(g,l);h.bannedDeps=k,N+=k.length}if(p.emptyDeps){const l=Ke(r,{ignoreBlocks:c.emptyDeps?.ignoreBlocks}),k=F(n,c.emptyDeps?.autofix);k&&l.length>0&&(Xe(l,{useEditorconfig:f}),$.emptyDeps=!0),h.emptyDeps=l,k||(N+=l.length)}if(p.rootPrivate){const l=mt(r,T),k=F(n,c.rootPrivate?.autofix);k&&l.length>0&&(ht(l,{useEditorconfig:f}),$.rootPrivate=!0),h.rootPrivate=l,k||(N+=l.length)}if(p.rootPackageManager){const l=gt(r,T,{suggested:c.rootPackageManager?.suggested}),k=F(n,c.rootPackageManager?.autofix);k&&l.some(J=>J.suggested!==void 0)&&(dt(l,{useEditorconfig:f}),$.rootPackageManager=!0),h.rootPackageManager=l,(!k||!$.rootPackageManager)&&(N+=l.filter(J=>J.suggested===void 0||!$.rootPackageManager).length)}if(p.rootDeps){const l=pt(r,T),k=F(n,c.rootDeps?.autofix);k&&l.length>0&&(ct(l,{useEditorconfig:f}),$.rootDeps=!0),h.rootDeps=l,k||(N+=l.length)}if(p.missingPackageJson){const l=ot(r);h.missingPackageJson=l,N+=l.length}if(p.deadWorkspacePatterns){const l=Le(r),k=F(n,c.deadWorkspacePatterns?.autofix);k&&l.length>0&&(qe(l,{useEditorconfig:f}),$.deadWorkspacePatterns=!0),h.deadWorkspacePatterns=l,k||(N+=l.length)}if(p.typesInDeps){const l=xt(g,{ignoreDeps:c.typesInDeps?.ignore}),k=F(n,c.typesInDeps?.autofix);k&&l.length>0&&(Nt(l,{useEditorconfig:f}),$.typesInDeps=!0),h.typesInDeps=l,k||(N+=l.length)}if(p.similarDeps){const l=wt(g,{extraFamilies:c.similarDeps?.extraFamilies,ignoreFamilies:c.similarDeps?.ignoreFamilies});h.similarDeps=l,N+=l.length}i||(a==="json"?ro(h,r,$,p):a==="minimal"?no(h,r):ao(h,r,$,p,e)),N>0&&(process.exitCode=1)},"execute");export{Po as default};
|