@visulima/vis 1.0.0-alpha.2 → 1.0.0-alpha.20
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 +830 -14
- package/LICENSE.md +7667 -0
- package/README.md +322 -19
- package/dist/bin.js +1 -146
- package/dist/config/index.d.ts +2795 -0
- package/dist/config/index.js +1 -0
- package/dist/generate/index.d.ts +157 -0
- package/dist/generate/index.js +1 -0
- package/dist/packem_chunks/bin.js +1295 -0
- package/dist/packem_chunks/config.js +19 -0
- package/dist/packem_chunks/doctor-probe.js +2 -0
- package/dist/packem_chunks/fix.js +11 -0
- package/dist/packem_chunks/handler.js +1 -0
- package/dist/packem_chunks/handler10.js +1 -0
- package/dist/packem_chunks/handler11.js +5 -0
- package/dist/packem_chunks/handler12.js +1 -0
- package/dist/packem_chunks/handler13.js +27 -0
- package/dist/packem_chunks/handler14.js +5 -0
- package/dist/packem_chunks/handler15.js +1 -0
- package/dist/packem_chunks/handler16.js +1 -0
- package/dist/packem_chunks/handler17.js +1 -0
- package/dist/packem_chunks/handler18.js +1 -0
- package/dist/packem_chunks/handler19.js +1 -0
- package/dist/packem_chunks/handler2.js +2 -0
- package/dist/packem_chunks/handler20.js +5 -0
- package/dist/packem_chunks/handler21.js +2 -0
- package/dist/packem_chunks/handler22.js +2 -0
- package/dist/packem_chunks/handler23.js +18 -0
- package/dist/packem_chunks/handler24.js +1 -0
- package/dist/packem_chunks/handler25.js +1 -0
- package/dist/packem_chunks/handler26.js +5 -0
- package/dist/packem_chunks/handler27.js +1 -0
- package/dist/packem_chunks/handler28.js +3 -0
- package/dist/packem_chunks/handler29.js +1 -0
- package/dist/packem_chunks/handler3.js +4 -0
- package/dist/packem_chunks/handler30.js +7 -0
- package/dist/packem_chunks/handler31.js +33 -0
- package/dist/packem_chunks/handler32.js +3 -0
- package/dist/packem_chunks/handler33.js +1 -0
- package/dist/packem_chunks/handler34.js +26 -0
- package/dist/packem_chunks/handler35.js +3 -0
- package/dist/packem_chunks/handler36.js +7 -0
- package/dist/packem_chunks/handler37.js +22 -0
- package/dist/packem_chunks/handler38.js +428 -0
- package/dist/packem_chunks/handler39.js +6 -0
- package/dist/packem_chunks/handler4.js +8 -0
- package/dist/packem_chunks/handler40.js +24 -0
- package/dist/packem_chunks/handler41.js +10 -0
- package/dist/packem_chunks/handler42.js +153 -0
- package/dist/packem_chunks/handler43.js +25 -0
- package/dist/packem_chunks/handler44.js +24 -0
- package/dist/packem_chunks/handler45.js +213 -0
- package/dist/packem_chunks/handler46.js +3 -0
- package/dist/packem_chunks/handler47.js +27 -0
- package/dist/packem_chunks/handler48.js +167 -0
- package/dist/packem_chunks/handler49.js +34 -0
- package/dist/packem_chunks/handler5.js +1 -0
- package/dist/packem_chunks/handler6.js +1 -0
- package/dist/packem_chunks/handler7.js +1 -0
- package/dist/packem_chunks/handler8.js +1 -0
- package/dist/packem_chunks/handler9.js +2 -0
- package/dist/packem_chunks/heal-accept.js +10 -0
- package/dist/packem_chunks/heal.js +14 -0
- package/dist/packem_chunks/help-command.js +18 -0
- package/dist/packem_chunks/index.js +7 -0
- package/dist/packem_chunks/keys-refresh.js +4 -0
- package/dist/packem_chunks/list.js +3 -0
- package/dist/packem_chunks/loader.js +1 -0
- package/dist/packem_chunks/prune.js +3 -0
- package/dist/packem_chunks/run.js +1 -0
- package/dist/packem_chunks/status.js +2 -0
- package/dist/packem_chunks/sync.js +2 -0
- package/dist/packem_chunks/sync2.js +2 -0
- package/dist/packem_chunks/tar.js +3 -0
- package/dist/packem_chunks/tripwire.js +2 -0
- package/dist/packem_shared/advisories-DsynpacV.js +1 -0
- package/dist/packem_shared/ai-analysis-uYuTIIXi.js +68 -0
- package/dist/packem_shared/ai-cache-DuwHYx2O.js +1 -0
- package/dist/packem_shared/ai-fix-DzrA-dVz.js +43 -0
- package/dist/packem_shared/applyDefaults-BOVDw1jD.js +1 -0
- package/dist/packem_shared/build-scripts-DsWMSWDs.js +1 -0
- package/dist/packem_shared/cache-directory-DQak1Vjc.js +1 -0
- package/dist/packem_shared/cyclonedx-CiHXuG8M.js +4 -0
- package/dist/packem_shared/definePlugin-CWm4Dv_t.js +1 -0
- package/dist/packem_shared/dependency-scan-DC3nAFHS.js +1 -0
- package/dist/packem_shared/docker-B-CIN_nj.js +60 -0
- package/dist/packem_shared/failure-log-C3LEMmkq.js +2 -0
- package/dist/packem_shared/flakiness-Dq6K4ymq.js +1 -0
- package/dist/packem_shared/giget-CcEy_Elm.js +2 -0
- package/dist/packem_shared/glob-MHJQjR39-CQ2GC0b_.js +1 -0
- package/dist/packem_shared/index-DH-5hsrC.js +1 -0
- package/dist/packem_shared/lifecycle-Dv3nAtoD.js +2 -0
- package/dist/packem_shared/lockfile-C5DYMHVq.js +1 -0
- package/dist/packem_shared/manifests-B0fMp872.js +1 -0
- package/dist/packem_shared/min-release-age-BFozFonQ.js +34 -0
- package/dist/packem_shared/native-config-sync-Dvi1g2nQ.js +21 -0
- package/dist/packem_shared/otelPlugin-CJR2T_lk.js +1 -0
- package/dist/packem_shared/registry-keys-CewRFW0e.js +1 -0
- package/dist/packem_shared/resolve-explicit-CC4Kifk5.js +5 -0
- package/dist/packem_shared/run-summary-utils-BaBGP3bo.js +1 -0
- package/dist/packem_shared/runtime-check-BusAwPb2.js +1 -0
- package/dist/packem_shared/scan-progress-CMynp3eA.js +2 -0
- package/dist/packem_shared/selectors-B2ISH581.js +3 -0
- package/dist/packem_shared/signatures-5ZdjJ2Pu.js +2 -0
- package/dist/packem_shared/symbols-CQmER5MT.js +1 -0
- package/dist/packem_shared/toolchain-Cc3cwyLP.js +5 -0
- package/dist/packem_shared/typosquats-BCeR-sLf.js +1 -0
- package/dist/packem_shared/use-measured-height-DjYgUOKk.js +1 -0
- package/dist/packem_shared/utils-DrNg0XTR.js +1 -0
- package/dist/packem_shared/verify-07kUNTuP.js +1 -0
- package/dist/packem_shared/vis-update-app-CFrlJ3mW.js +1 -0
- package/dist/packem_shared/xxh3-DrAUNq4n.js +1 -0
- package/index.d.ts +358 -0
- package/index.js +609 -0
- package/package.json +57 -22
- package/schemas/project.schema.json +872 -0
- package/schemas/vis-config.schema.json +4306 -0
- package/skills/vis/SKILL.md +96 -0
- package/templates/buildkite-ci/.buildkite/pipeline.yml.tera +85 -0
- package/templates/buildkite-ci/template.yml +20 -0
- package/dist/ai-analysis.d.ts +0 -40
- package/dist/ai-cache.d.ts +0 -21
- package/dist/bin.d.ts +0 -1
- package/dist/catalog.d.ts +0 -110
- package/dist/commands/affected.d.ts +0 -3
- package/dist/commands/ai.d.ts +0 -3
- package/dist/commands/analyze.d.ts +0 -3
- package/dist/commands/check.d.ts +0 -3
- package/dist/commands/graph.d.ts +0 -3
- package/dist/commands/hook/constants.d.ts +0 -8
- package/dist/commands/hook/index.d.ts +0 -3
- package/dist/commands/hook/install.d.ts +0 -7
- package/dist/commands/hook/migrate.d.ts +0 -27
- package/dist/commands/hook/uninstall.d.ts +0 -3
- package/dist/commands/migrate/constants.d.ts +0 -12
- package/dist/commands/migrate/deps.d.ts +0 -32
- package/dist/commands/migrate/index.d.ts +0 -3
- package/dist/commands/migrate/json.d.ts +0 -20
- package/dist/commands/migrate/lint-staged.d.ts +0 -62
- package/dist/commands/migrate/types.d.ts +0 -20
- package/dist/commands/run.d.ts +0 -3
- package/dist/commands/staged.d.ts +0 -3
- package/dist/commands/update.d.ts +0 -3
- package/dist/config.d.ts +0 -40
- package/dist/config.js +0 -1
- package/dist/package-manager.d.ts +0 -23
- package/dist/workspace.d.ts +0 -58
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var Pt=Object.defineProperty;var O=(e,t)=>Pt(e,"name",{value:t,configurable:!0});import{createRequire as Nt}from"node:module";import{n as Ft,W as Ke,aT as qe,u as zt,A as at,U as ct,O as jt,R as dt,J as ut,V as Et,T as Lt,N as Bt,p as u,I as ve,ag as F,e as ze,E as $,a as Re,j as ce,q as Ie,ae as pt,s as Vt,M as Ut}from"./bin.js";import{M as ee,i as Me,n as ht,b as _t,O as Ht,C as gt,j as Gt}from"./config.js";import{render as Yt}from"@visulima/tui";import Kt,{useSyncExternalStore as qt,useState as Te,useEffect as Je,useRef as We,useMemo as Le,useCallback as Xe}from"react";import{X as Qt}from"../packem_shared/xxh3-DrAUNq4n.js";import{x as Ze,A as ft,L as Zt,F as ei,T as ti,U as ii,a as ri,I as ni}from"./handler40.js";import{c as oi}from"../packem_shared/runtime-check-BusAwPb2.js";import{s as si}from"../packem_shared/scan-progress-CMynp3eA.js";import{f as li,l as ai}from"../packem_shared/dependency-scan-DC3nAFHS.js";import{jsxs as a,jsx as r,Fragment as ci}from"react/jsx-runtime";import{Box as p}from"@visulima/tui/components/box";import{Dialog as di}from"@visulima/tui/components/dialog";import{Text as n}from"@visulima/tui/components/text";import{useApp as ui}from"@visulima/tui/hooks/use-app";import{useInput as pi}from"@visulima/tui/hooks/use-input";import{useWindowSize as hi}from"@visulima/tui/hooks/use-window-size";import{ScrollView as gi}from"@visulima/tui/components/scroll-view";import{ScrollBar as fi}from"@visulima/tui/components/scroll-bar";import{Spinner as yt}from"@visulima/tui/components/spinner";import{Tab as mi}from"@visulima/tui/components/tab";import{Tabs as yi}from"@visulima/tui/components/tabs";import{u as ki}from"../packem_shared/use-measured-height-DjYgUOKk.js";import{s as wi}from"../packem_shared/verify-07kUNTuP.js";const Mt=Nt(import.meta.url),xe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,lt=O(e=>{if(typeof xe<"u"&&xe.versions&&xe.versions.node){const[t,i]=xe.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return xe.getBuiltinModule(e)}return Mt(e)},"__cjs_getBuiltinModule"),{statSync:Jt,rmSync:Qe,writeFileSync:Wt,readFileSync:Xt}=lt("node:fs"),{spawnSync:mt}=lt("node:child_process");var vi=Object.defineProperty,De=O((e,t)=>vi(e,"name",{value:t,configurable:!0}),"r$2");const Be=De(()=>ee(Ft(),"doctor"),"getCacheDirectory"),bi=1800*1e3,et=De(e=>{if(!e)return"";try{return String(Jt(e).mtimeMs)}catch{return""}},"safeMtime"),$i=2,Si=De(e=>{const t=JSON.stringify({configMtime:et(e.configPath),lockfileMtime:et(e.lockfilePath),schema:$i,sections:[...e.sections].toSorted(),socketEnabled:e.socketEnabled,workspaceRoot:e.workspaceRoot});return Qt(Buffer.from(t))},"buildDoctorCacheKey"),Ci=De(e=>{const t=ee(Be(),`${e}.json`);if(Me(t))try{const i=ht(t);if(Date.now()-i.createdAt>i.ttlMs){Qe(t,{force:!0});return}return{...i.results,sections:new Set(i.results.sections)}}catch{Qe(t,{force:!0});return}},"readDoctorCache"),xi=De((e,t,i=bi)=>{_t(Be());const s={createdAt:Date.now(),results:{...t,sections:[...t.sections]},ttlMs:i};Wt(ee(Be(),`${e}.json`),JSON.stringify(s,void 0,2),"utf8")},"writeDoctorCache");var Ti=Object.defineProperty,_=O((e,t)=>Ti(e,"name",{value:t,configurable:!0}),"i$1");const Pe="orphans",Ri=_(()=>{if(process.platform!=="linux")return{id:"inotify",message:"inotify capacity check skipped (not Linux).",status:"skip"};let e;try{const t=Xt("/proc/sys/fs/inotify/max_user_watches","utf8").trim(),i=Number.parseInt(t,10);Number.isFinite(i)&&i>0&&(e=i)}catch{return{id:"inotify",message:"Could not read /proc/sys/fs/inotify/max_user_watches.",status:"warn"}}return e===void 0?{id:"inotify",message:"inotify max_user_watches reported a non-numeric value.",status:"warn"}:e<65536?{detail:{maxWatches:e},id:"inotify",message:`inotify watcher limit is ${String(e)} — large monorepos can exhaust this. Bump now with \`sudo sysctl fs.inotify.max_user_watches=524288\` and persist via \`/etc/sysctl.d/99-vis.conf\` so it survives reboot.`,status:"warn"}:{detail:{maxWatches:e},id:"inotify",message:`inotify capacity OK (${String(e)} watches).`,status:"ok"}},"checkInotifyCapacity"),Ii=_(()=>{const e=!!process.stdin.isTTY,t=!!process.stdout.isTTY;return e&&t?{id:"tty",message:"Interactive TTY available — watch keybinds enabled.",status:"ok"}:!e&&!t?{id:"tty",message:"No TTY on stdin/stdout — running in CI / piped mode (keybinds disabled).",status:"skip"}:{detail:{stdin:String(e),stdout:String(t)},id:"tty",message:e?"stdin is a TTY but stdout is not — output is being captured; keybinds still work.":"stdout is a TTY but stdin is not — keybinds disabled (input is piped).",status:"skip"}},"checkTtyAvailability"),Di=_(()=>{const e=process.pid;try{return process.platform==="win32"?vt(e):wt(e)}catch{return[]}},"listOrphanPids"),Ai=_(()=>{const e=process.pid;let t;try{t=process.platform==="win32"?vt(e):wt(e)}catch{return{id:Pe,message:"Could not enumerate processes (ps/tasklist failed).",status:"warn"}}if(t.length===0)return{id:Pe,message:"No orphaned vis/task-runner processes detected.",status:"ok"};if(t.length<=2)return{detail:{count:t.length,pids:t.join(",")},id:Pe,message:`${String(t.length)} possibly orphaned process(es) detected (PIDs: ${t.join(", ")}). Likely benign.`,status:"skip"};const i=process.platform==="win32"?t.map(s=>`taskkill /F /PID ${String(s)}`).join(" & "):`kill ${t.join(" ")}`;return{detail:{count:t.length,pids:t.join(",")},id:"orphans",message:`${String(t.length)} possibly orphaned vis/task-runner processes — run \`vis doctor --fix\` to clean them up, or kill them manually: ${i}`,status:"warn"}},"checkOrphanedRunners"),Oi=_((e={})=>{const t=e.enumerate??Di,i=e.force===!0?"SIGKILL":"SIGTERM",s=e.kill??zi,o=t(),l=[],c=[];for(const h of o)try{s(h,i),l.push(h)}catch(d){const k=d.code??d.message;if(k==="ESRCH"){l.push(h);continue}c.push({pid:h,reason:k})}return{failed:c,killed:l}},"killOrphanedRunners"),Pi=_(e=>mt("taskkill",e,{encoding:"utf8"}),"defaultTaskkillRunner"),Ni=_((e,t)=>{process.kill(e,t)},"defaultProcessKill"),Mi=_((e,t,i=Pi)=>{const s=t==="SIGKILL"?["/F","/PID",String(e)]:["/PID",String(e)],o=i(s);if(o.error)throw o.error;if(typeof o.status=="number"&&o.status!==0){const l=o.status===128?"ESRCH":`taskkill exited with code ${String(o.status)}`,c=new Error(l);throw c.code=l,c}},"killViaTaskkill"),Fi=_((e,t,i=Ni)=>{i(e,t)},"killViaSignal"),zi=_((e,t)=>{if(process.platform==="win32"){Mi(e,t);return}Fi(e,t)},"defaultKill"),kt=_((e,t)=>{const i=mt(e,t,{encoding:"utf8"});if(i.error)throw i.error;if(typeof i.status=="number"&&i.status!==0)throw new Error(`${e} exited with code ${String(i.status)}`);return typeof i.stdout=="string"?i.stdout:""},"runProcessListing"),wt=_(e=>{const t=kt("ps",["-Ao","pid=,command="]),i=[];for(const s of t.split(`
|
|
2
|
+
`)){if(s.length===0)continue;const o=/^\s*(\d+)\s+(.+)$/.exec(s);if(!o)continue;const l=Number.parseInt(o[1]??"",10),c=(o[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"),vt=_(e=>{const t=kt("tasklist",["/FO","CSV","/NH"]),i=[];for(const s of t.split(/\r?\n/)){if(s.length===0)continue;const o=s.split(/","/).map(h=>h.replaceAll(/^"|"$/g,"")),l=(o[0]??"").toLowerCase(),c=Number.parseInt(o[1]??"",10);!Number.isFinite(c)||c===e||(l==="vis.exe"||l.startsWith("vis-native")||l.includes("task-runner"))&&i.push(c)}return i},"listOrphansWindows"),ji=_(()=>[Ri(),Ii(),Ai()],"runRuntimeDiagnostics");var Ei=Object.defineProperty,we=O((e,t)=>Ei(e,"name",{value:t,configurable:!0}),"s$2");const ke=[{id:"dependencies",label:"Deps"},{id:"security",label:"Security"},{id:"optimization",label:"Optimize"},{id:"runtime",label:"Runtime"}],Fe=["dependencies","security","optimization","runtime"],me=we(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,s]of t)s.length===0&&t.delete(i);return t},"groupBySection"),ye=we((e,t,i,s)=>{let o=e.filter(l=>l.section===t);if(s&&(o=o.filter(l=>l.severity===s)),i){const l=i.toLowerCase();o=o.filter(c=>c.title.toLowerCase().includes(l))}return[...o]},"filterFindings"),Li=we(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 tt{static{O(this,"DoctorStore")}static{we(this,"DoctorStore")}#e;#i=new Set;constructor(t=[]){const i=Array.isArray(t)?{findings:t}:t,s=i.findings??[],o=i.activeSections??new Set(Fe),l=Fe.find(d=>o.has(d))??"dependencies",c=ye(s,l,"",void 0),h=Li(o);if(s.length>0)for(const d of s)h[d.section]="done";this.#e={all:s,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=we(()=>this.#e,"getSnapshot");subscribe=we(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=ye(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=ye(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=ye(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=ye(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 s=[...this.#e.all,...i],o=ye(s,this.#e.filterType,this.#e.filterText,this.#e.severityFilter),l={...this.#e.sectionMessage};delete l[t],this.#t({...this.#e,all:s,entries:o,grouped:me(o),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 Bi=Object.defineProperty,bt=O((e,t)=>Bi(e,"name",{value:t,configurable:!0}),"r$1");const it={error:0,warn:1},Vi=bt(e=>!!e.acceptedRisk,"isAcknowledged"),$t=bt(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 s=i.vulnerabilities[0],o=Vi(i)?"warn":"error",l=i.vulnerabilities.length;t.push({entry:i,id:`vuln:${i.packageName}`,kind:"vulnerability",packageName:i.packageName,section:"security",severity:o,subtitle:l===1?`${s.severity} · ${s.id}`:`${String(l)} advisories · top: ${s.severity} ${s.id}`,title:i.packageName})}if(i.socketReport&&i.socketReport.alerts.length>0){const s=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(s)}%`,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,s)=>{if(i.section!==s.section){const o=["dependencies","security","optimization","runtime"];return o.indexOf(i.section)-o.indexOf(s.section)}return it[i.severity]-it[s.severity]}),t},"flattenFindings"),St={dependencies:"Dependencies",optimization:"Optimization",runtime:"Runtime",security:"Security"};var Ui=Object.defineProperty,_i=O((e,t)=>Ui(e,"name",{value:t,configurable:!0}),"a$2");const Hi={error:"red",warn:"yellow"},Gi={error:"✖",warn:"⚠"},Yi={error:" ERROR ",warn:" WARN "},Ki=_i(({children:e,hint:t,message:i,severity:s,title:o})=>{const l=Hi[s];return a(p,{borderColor:l,borderStyle:"single",flexDirection:"column",flexShrink:0,paddingX:1,children:[a(p,{gap:1,children:[r(n,{backgroundColor:l,bold:!0,color:"black",children:Yi[s]}),r(n,{bold:!0,color:l,children:Gi[s]}),r(n,{bold:!0,wrap:"truncate-end",children:o})]}),r(n,{wrap:"truncate-end",children:i}),t?r(n,{dimColor:!0,wrap:"truncate-end",children:t}):null,e]})},"ConfigBanner");var qi=Object.defineProperty,te=O((e,t)=>qi(e,"name",{value:t,configurable:!0}),"d$2");const Ji={CRITICAL:"red",HIGH:"red",LOW:"gray",MODERATE:"yellow",UNKNOWN:"gray"},Wi={critical:"red",high:"red",low:"gray",medium:"yellow"},Xi={major:"red",minor:"yellow",patch:"green"},I=te(({children:e,label:t,width:i=14})=>a(p,{children:[r(p,{width:i,children:a(n,{dimColor:!0,children:[t,":"]})}),typeof e=="string"?r(n,{children:e}):e]}),"FieldRow"),oe=te(({children:e})=>r(p,{marginTop:1,children:r(n,{bold:!0,color:"white",children:e})}),"SectionTitle"),Qi=te(({finding:e})=>{const{entry:t}=e,i=Xi[t.updateType]??"white";return a(p,{flexDirection:"column",children:[r(I,{label:"Current",children:t.currentRange}),a(I,{label:"Target",children:[r(n,{children:t.newRange}),a(n,{bold:!0,color:i,children:[" (",t.updateType,")"]})]}),r(I,{label:"Catalog",children:t.catalogName}),t.acceptedRisk?r(I,{label:"Risk ack",children:r(n,{dimColor:!0,children:t.acceptedRisk.reason??"(no reason recorded)"})}):null,r(oe,{children:"Action"}),a(n,{dimColor:!0,children:["Run"," ",r(n,{bold:!0,color:"white",children:"vis update"})," ","to apply this change."]})]})},"OutdatedDetail"),Zi=te(({finding:e})=>a(p,{flexDirection:"column",children:[r(I,{label:"Versions",children:r(n,{children:String(e.pkg.versions.length)})}),r(oe,{children:"Installed versions"}),e.pkg.versions.map(t=>a(n,{children:[" · ",t]},t)),r(oe,{children:"Action"}),a(n,{dimColor:!0,children:["Run"," ",r(n,{bold:!0,color:"white",children:"vis dedupe"})," ","to consolidate to a single resolution."]})]}),"DuplicateDetail"),er=te(({finding:e})=>{const t=e.entry.vulnerabilities??[];return a(p,{flexDirection:"column",children:[r(I,{label:"Package",children:e.packageName}),r(I,{label:"Current",children:e.entry.currentRange}),r(I,{label:"Advisories",children:String(t.length)}),e.entry.acceptedRisk?r(I,{label:"Risk ack",children:r(n,{dimColor:!0,children:e.entry.acceptedRisk.reason??"(no reason recorded)"})}):null,t.map(i=>{const s=Ji[i.severity]??"gray";return a(p,{flexDirection:"column",marginTop:1,children:[a(p,{children:[r(n,{bold:!0,color:s,children:i.severity}),r(n,{children:" "}),r(n,{children:i.id}),typeof i.cvssScore=="number"?a(n,{dimColor:!0,children:[" · CVSS ",i.cvssScore.toFixed(1)]}):null]}),r(n,{wrap:"wrap",children:i.summary}),i.fixedVersions.length>0?a(n,{dimColor:!0,children:["Fixed in: ",i.fixedVersions.join(", ")]}):null,i.aliases&&i.aliases.length>0?a(n,{dimColor:!0,children:["Aliases: ",i.aliases.join(", ")]}):null]},i.id)})]})},"VulnerabilityDetail"),tr=te(({finding:e})=>{const t=e.entry.socketReport;if(!t)return r(n,{dimColor:!0,children:"No Socket report attached."});const i=Math.round(t.score.overall*100),s=Ke(t.score.overall);return a(p,{flexDirection:"column",children:[r(I,{label:"Package",children:e.packageName}),r(I,{label:"Overall",children:a(n,{color:s,children:[String(i),"%"]})}),r(I,{label:"Alerts",children:String(t.alerts.length)}),e.entry.acceptedRisk?r(I,{label:"Risk ack",children:r(n,{dimColor:!0,children:e.entry.acceptedRisk.reason??"(no reason recorded)"})}):null,r(oe,{children:"Score breakdown"}),Object.entries(t.score).map(([o,l])=>{if(o==="overall")return null;const c=typeof l=="number"?l:0,h=Math.round(c*100),d=Ke(c);return a(p,{children:[r(p,{width:14,children:a(n,{dimColor:!0,children:[o,":"]})}),a(n,{color:d,children:[String(h),"%"]})]},o)}),r(oe,{children:"Alerts"}),t.alerts.map((o,l)=>{const c=Wi[o.severity]??"gray";return a(p,{flexDirection:"column",marginBottom:1,children:[a(p,{children:[r(n,{bold:!0,color:c,children:o.severity}),r(n,{children:" "}),r(n,{children:o.type})]}),o.props?r(n,{dimColor:!0,wrap:"wrap",children:JSON.stringify(o.props)}):null]},`${o.type}-${String(l)}`)})]})},"SocketDetail"),ir=te(({finding:e})=>{const{entry:t}=e;return a(p,{flexDirection:"column",children:[r(I,{label:"Package",children:t.packageName}),r(I,{label:"Category",children:t.category}),r(I,{label:"Replacement",children:t.replacement}),t.overrideSpec?r(I,{label:"Override",children:t.overrideSpec}):null,r(I,{label:"Codemod",children:r(n,{color:t.hasCodemod?"green":"gray",children:t.hasCodemod?"available":"not available"})}),t.docUrl?r(I,{label:"Guide",children:r(n,{color:"cyan",underline:!0,children:t.docUrl})}):null,r(oe,{children:"Action"}),t.hasCodemod?a(n,{dimColor:!0,children:["Run"," ",r(n,{bold:!0,color:"white",children:"vis optimize"})," ","to apply the codemod interactively."]}):t.overrideSpec?a(n,{dimColor:!0,children:["Run"," ",r(n,{bold:!0,color:"white",children:"vis optimize"})," ","to install the package override."]}):t.docUrl?r(n,{dimColor:!0,children:"No automated codemod. Open the migration guide above for the recommended alternative and steps."}):r(n,{dimColor:!0,children:"No automated codemod. Consult the package's docs or the e18e module-replacements guide for an alternative."})]})},"OptimizationDetail"),rr=te(({finding:e})=>{const{diagnostic:t}=e,i=t.status==="warn"?"yellow":t.status==="ok"?"green":"gray";return a(p,{flexDirection:"column",children:[r(I,{label:"Check",children:t.id}),r(I,{label:"Status",children:r(n,{color:i,children:t.status})}),r(oe,{children:"Message"}),r(n,{wrap:"wrap",children:t.message}),t.detail&&Object.keys(t.detail).length>0?a(ci,{children:[r(oe,{children:"Details"}),Object.entries(t.detail).map(([s,o])=>a(p,{children:[r(p,{width:20,children:a(n,{dimColor:!0,children:[s,":"]})}),r(n,{children:String(o)})]},s))]}):null]})},"RuntimeDetail"),nr=te(({finding:e,focused:t,scrollRef:i})=>{const s=t?"white":"gray";if(!e)return r(p,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:r(n,{dimColor:!0,children:"No finding selected"})});let o;switch(e.kind){case"duplicate":{o=r(Zi,{finding:e});break}case"optimization":{o=r(ir,{finding:e});break}case"outdated":{o=r(Qi,{finding:e});break}case"runtime":{o=r(rr,{finding:e});break}case"socket":{o=r(tr,{finding:e});break}case"vulnerability":{o=r(er,{finding:e});break}default:{o=r(n,{dimColor:!0,children:"Unknown finding kind."});break}}return a(p,{borderColor:s,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[a(p,{flexShrink:0,paddingTop:1,paddingX:2,children:[r(n,{bold:!0,color:"white",children:e.title}),a(n,{dimColor:!0,children:[" ",St[e.section]]})]}),a(gi,{flexGrow:1,flexShrink:1,paddingX:2,ref:i,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:[r(n,{}),o]})]})},"DoctorDetailPanel");var or=Object.defineProperty,Ae=O((e,t)=>or(e,"name",{value:t,configurable:!0}),"c$1");const Ct={error:"red",warn:"yellow"},sr={error:"✖",warn:"⚠"},lr=Ae(e=>e.kind==="outdated"||e.kind==="vulnerability"||e.kind==="socket"?!!e.entry.acceptedRisk:!1,"hasAcceptedRisk"),ar=Ae(({finding:e,isSelected:t})=>{const i=Ct[e.severity],s=lr(e);return a(p,{flexShrink:0,height:1,children:[r(n,{children:t?">":" "}),a(n,{color:i,children:[" ",sr[e.severity]," "]}),r(p,{flexGrow:1,children:r(n,{bold:t,inverse:t,wrap:"truncate",children:e.title})}),s?r(n,{color:"cyan",children:" ack"}):null,e.subtitle?a(n,{dimColor:!0,wrap:"truncate",children:[" ",e.subtitle]}):null]})},"FindingRow"),cr=Ae(({count:e,section:t})=>a(p,{flexShrink:0,height:1,marginTop:1,children:[r(n,{dimColor:!0,children:"▼ "}),r(n,{bold:!0,color:"white",children:St[t].toUpperCase()}),a(n,{dimColor:!0,children:[" (",e,")"]})]}),"SectionHeader"),dr=Ae(({count:e,label:t,status:i})=>a(n,{children:[t,i==="running"?a(n,{children:[" ",r(yt,{type:"dots"})]}):null,i==="error"?r(n,{bold:!0,color:"red",children:" ✖"}):a(n,{dimColor:!0,children:[" (",String(e),")"]})]}),"TabLabel"),ur=Ae(({elapsedMs:e,entries:t,filterActive:i,filterText:s,filterType:o,focused:l,fromCache:c=!1,grouped:h,onViewportHeightChange:d,scrollOffset:k,sectionCounts:b,sectionMessage:v,sectionStatus:D,selectedIndex:j,severityFilter:g,totalAll:A,viewportHeight:E})=>{const J=l?"white":"gray",{measuredHeight:B,ref:L}=ki(E,d);let T=0,V=0;for(const S of t)S.severity==="error"?T+=1:S.severity==="warn"&&(V+=1);const H=[];T>0&&H.push(`${String(T)} error${T===1?"":"s"}`),V>0&&H.push(`${String(V)} warn${V===1?"":"s"}`);const se=H.length>0?` (${H.join(", ")})`:"",ie=(e/1e3).toFixed(1),U=[];for(const[S,C]of h){U.push(r(cr,{count:C.length,section:S},`hdr-${S}`));for(const W of C){const R=t.indexOf(W);U.push(r(ar,{finding:W,isSelected:R===j},W.id))}}let z=0;for(const[,S]of h)z+=2+S.length;const Y=z>B&&B>0;return a(p,{borderColor:J,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[a(p,{flexShrink:0,gap:1,paddingX:1,children:[r(n,{bold:!0,inverse:!0,children:" DOCTOR "}),a(n,{wrap:"truncate",children:[t.length,t.length===A?"":`/${String(A)}`," finding",t.length===1?"":"s",se]}),g?r(n,{bold:!0,color:Ct[g],inverse:!0,children:` ${g.toUpperCase()} ONLY `}):null,c?r(n,{bold:!0,color:"cyan",inverse:!0,children:" CACHED "}):null,a(n,{dimColor:!0,children:[" · ",ie,"s"]})]}),r(p,{flexShrink:0,paddingX:1,paddingY:1,children:r(yi,{isFocused:l,keyMap:{next:[],previous:[],useNumbers:!1,useTab:!1},onChange:O(()=>{},"onChange"),showIndex:!1,value:o,children:ke.map(({id:S,label:C})=>r(mi,{name:S,children:r(dr,{count:b[S],label:C,status:D[S]})},S))})}),(()=>{const S=Object.keys(D).filter(C=>D[C]==="running"&&v[C]).map(C=>v[C]);return S.length===0?null:r(p,{flexShrink:0,paddingX:1,children:a(n,{dimColor:!0,wrap:"truncate",children:[r(yt,{type:"dots"})," ",S.join(" · ")]})})})(),i&&a(p,{flexShrink:0,paddingX:1,children:[r(n,{bold:!0,color:"white",children:"/ "}),r(n,{children:s}),r(n,{inverse:!0,children:" "})]}),a(p,{flexDirection:"row",flexGrow:1,overflow:"hidden",ref:L,children:[r(p,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:r(p,{flexDirection:"column",marginTop:-k,children:U.length>0?U:r(p,{marginTop:1,children:r(n,{dimColor:!0,children:"No findings match the current filter."})})})}),Y&&r(p,{flexShrink:0,marginLeft:1,marginRight:1,children:r(fi,{contentHeight:z,placement:"inset",scrollOffset:k,style:"block",viewportHeight:B})})]},`list-${o}-${s}`)]})},"DoctorListPanel");var pr=Object.defineProperty,je=O((e,t)=>pr(e,"name",{value:t,configurable:!0}),"g$1");const hr=je(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"),gr=je(e=>{if(e.kind==="optimization")return{command:`vis optimize ${e.entry.packageName}`,description:`Replace ${e.entry.packageName} with ${e.entry.replacement}`}},"buildOptimizeAction"),fr=je(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"),mr=100,yr=40,kr=10,wr=je(({autoExitSeconds:e=0,banner:t,fromCache:i=!1,startedAt:s,store:o})=>{const{exit:l}=ui(),{columns:c,rows:h}=hi(),d=qt(o.subscribe,o.getSnapshot),[k,b]=Te(!1),[v,D]=Te(!1),[j,g]=Te(0),[A,E]=Te(()=>Date.now());Je(()=>{const y=setInterval(()=>{E(Date.now())},1e3);return()=>{clearInterval(y)}},[]);const J=A-s,B=We(null),L=We(null),T=d.entries[d.selectedIndex]??null,V=Le(()=>{const y={dependencies:0,optimization:0,runtime:0,security:0};for(const m of d.all)y[m.section]+=1;return y},[d.all]),H=t?t.hint?5:4:0,se=Le(()=>{for(const y of Object.keys(d.sectionStatus))if(d.sectionStatus[y]==="running"&&d.sectionMessage[y])return 1;return 0},[d.sectionStatus,d.sectionMessage]),ie=c>=mr,U=ie?Math.max(1,h-H-2):Math.floor(h*.55),z=Math.max(1,U-6-se-(d.filterActive?1:0)),[Y,S]=Te(z),C=Y>0?Y:z,W=Le(()=>{let y=0;for(const[,m]of d.grouped)y+=2+m.length;return y},[d.grouped]),R=Math.max(0,W-C),le=Math.min(j,R),ue=Xe(y=>{let m=0,w=0;for(const[,Ce]of d.grouped){m+=2;for(let ae=0;ae<Ce.length;ae++){if(w===y)return m;m+=1,w+=1}}return m},[d.grouped]),P=Xe(y=>{const m=ue(y);g(w=>m>w+C-2?Math.min(R,Math.max(0,m-C+2)):m<w+1?Math.max(0,m-1):w)},[ue,C,R]);if(Je(()=>{L.current?.scrollToTop()},[T?.id]),pi((y,m)=>{if(y==="c"&&m.ctrl){l();return}if(!v){if(k){m.escape||y==="?"?b(!1):y==="q"?(b(!1),D(!0)):m.downArrow||y==="j"?B.current?.scrollBy(1):(m.upArrow||y==="k")&&B.current?.scrollBy(-1);return}if(y==="?"){b(!0);return}if(y==="q"){D(!0);return}if(m.tab){o.setFocusedPanel(d.focusedPanel==="list"?"detail":"list");return}if(d.filterActive){if(m.escape||m.return){o.setFilterActive(!1);return}if(m.backspace){g(0),o.setFilter(d.filterText.slice(0,-1));return}y&&!m.ctrl&&!m.meta&&(g(0),o.setFilter(d.filterText+y));return}if(d.focusedPanel==="list"&&(m.leftArrow||m.rightArrow)){const w=ke.findIndex(ae=>ae.id===d.filterType),Ce=m.rightArrow?(w+1)%ke.length:(w-1+ke.length)%ke.length;g(0),L.current?.scrollToTop(),o.setFilterType(ke[Ce].id);return}if(d.focusedPanel==="list"){if(m.downArrow||y==="j"){const w=Math.min(d.selectedIndex+1,d.entries.length-1);o.setSelectedIndex(w),P(w);return}if(m.upArrow||y==="k"){const w=Math.max(d.selectedIndex-1,0);o.setSelectedIndex(w),P(w);return}if(m.pageDown){const w=Math.min(d.selectedIndex+10,d.entries.length-1);o.setSelectedIndex(w),P(w);return}if(m.pageUp){const w=Math.max(d.selectedIndex-10,0);o.setSelectedIndex(w),P(w);return}if(m.home){o.setSelectedIndex(0),g(0);return}if(m.end){const w=d.entries.length-1;o.setSelectedIndex(w),P(w);return}if(y==="/"){o.setFilterActive(!0);return}if(y==="e"){o.setSeverityFilter(d.severityFilter==="error"?void 0:"error"),g(0);return}if(y==="w"){o.setSeverityFilter(d.severityFilter==="warn"?void 0:"warn"),g(0);return}if(y==="u"&&T){const w=hr(T);w&&(o.setPendingAction(w),l());return}if(y==="o"&&T){const w=gr(T);w&&(o.setPendingAction(w),l());return}if(y==="a"&&T){const w=fr(T);w&&(o.setPendingAction(w),l());return}if(y==="d"){o.setFocusedPanel("detail");return}return}if(m.escape||m.leftArrow){o.setFocusedPanel("list");return}if(m.downArrow||y==="j"){L.current?.scrollBy(1);return}if(m.upArrow||y==="k"){L.current?.scrollBy(-1);return}if(m.pageDown){L.current?.scrollBy(10);return}if(m.pageUp){L.current?.scrollBy(-10);return}if(m.home){L.current?.scrollToTop();return}m.end&&L.current?.scrollToBottom()}},{isActive:!0}),c<yr||h<kr)return r(p,{alignItems:"center",height:h,justifyContent:"center",width:c,children:a(n,{color:"yellow",children:["Terminal too small (",c,"x",h,")"]})});const X=d.focusedPanel==="detail",Z=[a(p,{gap:1,children:[r(n,{bold:!0,color:"white",children:"q"}),r(n,{dimColor:!0,children:"QUIT"})]},"q"),a(p,{gap:1,children:[r(n,{bold:!0,color:"white",children:"?"}),r(n,{dimColor:!0,children:"HELP"})]},"?"),a(p,{gap:1,children:[r(n,{bold:!0,color:"white",children:"↑↓"}),r(n,{dimColor:!0,children:X?"SCROLL":"NAV"})]},"nav"),X?a(p,{gap:1,children:[r(n,{bold:!0,color:"white",children:"←/Esc"}),r(n,{dimColor:!0,children:"LIST"})]},"lr"):a(p,{gap:1,children:[r(n,{bold:!0,color:"white",children:"←→"}),r(n,{dimColor:!0,children:"SECTION"})]},"lr"),a(p,{gap:1,children:[r(n,{bold:!0,color:"white",children:"/"}),r(n,{dimColor:!0,children:"SEARCH"})]},"search"),a(p,{gap:1,children:[r(n,{bold:!0,color:"white",children:"e/w"}),r(n,{dimColor:!0,children:"SEVERITY"})]},"sev"),a(p,{gap:1,children:[r(n,{bold:!0,color:"white",children:"u/o/a"}),r(n,{dimColor:!0,children:"ACTION"})]},"actions"),a(p,{gap:1,children:[r(n,{bold:!0,color:"white",children:"Tab"}),r(n,{dimColor:!0,children:"PANEL"})]},"tab")],pe=r(p,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:r(p,{gap:2,overflow:"hidden",paddingX:1,children:Z})}),he=a(di,{footer:a(n,{dimColor:!0,children:[r(n,{bold:!0,color:"white",children:"↑↓"})," scroll ",r(n,{bold:!0,color:"white",children:"?"}),"/",r(n,{bold:!0,color:"white",children:"Esc"})," close"]}),scrollRef:B,title:"DOCTOR — KEYBOARD SHORTCUTS",visible:k,width:56,children:[a(p,{flexDirection:"column",marginBottom:1,children:[a(p,{marginBottom:1,children:[r(n,{dimColor:!0,children:"── "}),r(n,{bold:!0,color:"white",children:"NAVIGATION"})]}),a(p,{children:[r(p,{width:26,children:a(n,{children:[r(n,{bold:!0,color:"white",children:" ↑/k "}),r(n,{dimColor:!0,children:"Move up"})]})}),a(n,{children:[r(n,{bold:!0,color:"white",children:" ↓/j "}),r(n,{dimColor:!0,children:"Move down"})]})]}),a(p,{children:[r(p,{width:26,children:a(n,{children:[r(n,{bold:!0,color:"white",children:" PgUp"}),r(n,{dimColor:!0,children:" Jump up 10"})]})}),a(n,{children:[r(n,{bold:!0,color:"white",children:" PgDn"}),r(n,{dimColor:!0,children:" Jump down 10"})]})]}),a(p,{children:[r(p,{width:26,children:a(n,{children:[r(n,{bold:!0,color:"white",children:" Home"}),r(n,{dimColor:!0,children:" Jump to top"})]})}),a(n,{children:[r(n,{bold:!0,color:"white",children:" End"}),r(n,{dimColor:!0,children:" Jump to bottom"})]})]}),a(n,{children:[r(n,{bold:!0,color:"white",children:" Tab"}),r(n,{dimColor:!0,children:" Switch panel"})]}),a(n,{children:[r(n,{bold:!0,color:"white",children:" →/←"}),r(n,{dimColor:!0,children:" Section tabs (list) / Focus list (detail)"})]})]}),a(p,{flexDirection:"column",marginBottom:1,children:[a(p,{marginBottom:1,children:[r(n,{dimColor:!0,children:"── "}),r(n,{bold:!0,color:"white",children:"FILTER"})]}),a(n,{children:[r(n,{bold:!0,color:"white",children:" /"}),r(n,{dimColor:!0,children:" Open text filter (Esc/Enter to close)"})]}),a(n,{children:[r(n,{bold:!0,color:"white",children:" e"}),r(n,{dimColor:!0,children:" Toggle errors-only filter"})]}),a(n,{children:[r(n,{bold:!0,color:"white",children:" w"}),r(n,{dimColor:!0,children:" Toggle warns-only filter"})]})]}),a(p,{flexDirection:"column",marginBottom:1,children:[a(p,{marginBottom:1,children:[r(n,{dimColor:!0,children:"── "}),r(n,{bold:!0,color:"white",children:"ACTIONS"})]}),a(n,{children:[r(n,{bold:!0,color:"white",children:" u"}),r(n,{dimColor:!0,children:" Exit + suggest update / dedupe command"})]}),a(n,{children:[r(n,{bold:!0,color:"white",children:" o"}),r(n,{dimColor:!0,children:" Exit + suggest optimize command"})]}),a(n,{children:[r(n,{bold:!0,color:"white",children:" a"}),r(n,{dimColor:!0,children:" Exit + print risk-ack snippet"})]}),a(n,{children:[r(n,{bold:!0,color:"white",children:" d"}),r(n,{dimColor:!0,children:" Focus detail panel"})]})]}),a(p,{flexDirection:"column",children:[a(p,{marginBottom:1,children:[r(n,{dimColor:!0,children:"── "}),r(n,{bold:!0,color:"white",children:"EXIT"})]}),a(n,{children:[r(n,{bold:!0,color:"white",children:" q"}),r(n,{dimColor:!0,children:" Quit (with countdown)"})]}),a(n,{children:[r(n,{bold:!0,color:"white",children:" Ctrl+C"}),r(n,{dimColor:!0,children:" Quit immediately"})]})]})]}),ge=r(ur,{elapsedMs:J,entries:d.entries,filterActive:d.filterActive,filterText:d.filterText,filterType:d.filterType,focused:d.focusedPanel==="list",fromCache:i,grouped:d.grouped,onViewportHeightChange:S,scrollOffset:le,sectionCounts:V,sectionMessage:d.sectionMessage,sectionStatus:d.sectionStatus,selectedIndex:d.selectedIndex,severityFilter:d.severityFilter,totalAll:d.all.length,viewportHeight:C}),fe=t?r(Ki,{hint:t.hint,message:t.message,severity:t.severity,title:t.title}):null,Se=r(nr,{finding:T,focused:d.focusedPanel==="detail",scrollRef:L});if(ie){const y=Math.floor(c*.4);return a(p,{flexDirection:"column",height:h,width:c,children:[fe,a(p,{flexDirection:"row",flexGrow:1,children:[r(p,{flexGrow:1,children:ge}),r(p,{width:y,children:Se})]}),pe,r(qe,{autoExitSeconds:e||3,onCancel:O(()=>{D(!1)},"onCancel"),visible:v}),he]})}return a(p,{flexDirection:"column",height:h,width:c,children:[fe,r(p,{height:U,children:ge}),r(p,{flexGrow:1,children:Se}),pe,r(qe,{autoExitSeconds:e||3,onCancel:O(()=>{D(!1)},"onCancel"),visible:v}),he]})},"VisDoctorApp");var vr=Object.defineProperty,be=O((e,t)=>vr(e,"name",{value:t,configurable:!0}),"n");const br=be(e=>e.replaceAll(/[$()+.?[\\\]^{|}]/g,String.raw`\$&`),"escapeRegex"),$r=be(e=>{const t=e.split("*").map(i=>br(i));return new RegExp(`^${t.join(".*")}$`,"i")},"compilePattern"),Sr=be(e=>e?e.split(",").map(t=>t.trim()).filter(t=>t.length>0).map(t=>$r(t)):[],"parseFilterPatterns"),Ne=be((e,t)=>{for(const i of t)if(i.test(e))return!0;return!1},"matchesAny"),Cr=be((e,t,i)=>{if(t.length===0)return e;const s=e.outdated.filter(k=>Ne(k.packageName,t)),o=e.duplicates.filter(k=>Ne(k.name,t)),l=e.optimizations.filter(k=>Ne(k.packageName,t));let c=0,h=0,d=0;for(const k of s)k.vulnerabilities&&(c+=k.vulnerabilities.length),k.socketReport&&(h+=k.socketReport.alerts.length,k.socketReport.score.overall<i&&(d+=1));return{...e,duplicates:o,optimizations:l,outdated:s,socketIssues:{alerts:h,lowScore:d},vulnCount:c}},"applyFilter"),xt=be((e,t)=>t.length===0?[...e]:e.filter(i=>{if(i.kind==="runtime")return!0;const s=i.kind==="duplicate"?i.pkg.name:i.kind==="outdated"||i.kind==="optimization"?i.entry.packageName:i.packageName;return Ne(s,t)}),"filterFindingsByPattern");var xr=Object.defineProperty,$e=O((e,t)=>xr(e,"name",{value:t,configurable:!0}),"r");const Tt=["dependencies","security","optimization","runtime"],rt=$e(e=>{const t=new Set;if(!e)return t;for(const i of e.split(",")){const s=i.trim().toLowerCase();Tt.includes(s)&&t.add(s)}return t},"parseSectionList"),Tr=$e((e,t)=>{if(e!==void 0&&e!=="")return rt(e);const i=rt(t);return new Set(Tt.filter(s=>!i.has(s)))},"resolveSections"),Rt=$e(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"),ne=$e((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"),Rr=$e((e,t)=>{const i=Rt(e.optimizations),s={dependencies:ne(e,"dependencies"),optimization:ne(e,"optimization"),runtime:ne(e,"runtime"),security:ne(e,"security")},o=new Set([...Object.values(s),e.supplyChain.status]),l=o.has("error")?"error":o.has("warn")?"warn":"ok";return{dependencies:{duplicates:e.duplicates.length,installed:e.installedCount,outdated:e.outdated.length,status:s.dependencies},elapsedMs:e.elapsedMs,optimizations:{microUtilities:i.micro,native:i.native,preferred:i.preferred,socket:i.socket,status:s.optimization,total:i.total},packageManager:t,runtime:e.runtime.map(c=>({detail:c.detail,id:c.id,message:c.message,status:c.status})),runtimeStatus:s.runtime,security:{alerts:e.socketIssues.alerts,lowScorePackages:e.socketIssues.lowScore,status:s.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"),nt=$e((e,t)=>{const i=e.runtime.some(o=>o.status==="warn"),s=e.vulnCount>0||e.socketIssues.alerts>0;return t?s||e.outdated.length>0||e.duplicates.length>0||i:s},"shouldFail");var Ir=Object.defineProperty,Ve=O((e,t)=>Ir(e,"name",{value:t,configurable:!0}),"i");const Dr=/^(@[\w./-]+\/[\w./-]+|[\w.-]+)@(.+)$/,Ar=Ve(e=>{const t=Dr.exec(e);if(t)return{name:t[1],version:t[2]}},"parsePatchKey"),Or=Ve((e,t)=>{let i;try{if(t==="pnpm"){const o=ee(e,"pnpm-workspace.yaml");Me(o)&&(i=zt(o)?.patchedDependencies)}else if(t==="bun"){const o=ee(e,"package.json");Me(o)&&(i=ht(o)?.patchedDependencies)}}catch{return[]}if(!i||typeof i!="object")return[];const s=[];for(const[o,l]of Object.entries(i)){if(typeof l!="string"||l.length===0)continue;const c=Ar(o);c&&s.push({name:c.name,patchFile:l,resolvedPatchFile:Ht(l)?l:gt(e,l),version:c.version})}return s},"readPatchedDependencies"),Pr=Ve(e=>{const t=[];for(const i of e)Me(i.resolvedPatchFile)||t.push({entry:i,kind:"missing-file"});return t},"findPatchIssues");var Nr=Object.defineProperty,It=O((e,t)=>Nr(e,"name",{value:t,configurable:!0}),"u$1");const ot=It(e=>e.some(t=>t.severity==="error")?"error":e.some(t=>t.severity==="warn")?"warn":"ok","rollUpStatus"),Mr=It((e,t={})=>{const i=[],s=e?.security;if(!s)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:ot(i)};const o=s.policies?.firstSeen?.minutes,l=s.policies?.publisherChange,c=s.policies?.installScripts;o===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"}):o===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(o)} 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"}),s.blockExoticSubdeps===void 0||!s.blockExoticSubdeps?i.push({detail:"Transitive dependencies can pull code from git repos or tarball URLs. Set to true to block.",label:`blockExoticSubdeps: ${String(s.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 d=wi(t.workspaceRoot);if(d.length>0){const k=[...new Set(d.map(b=>b.tool))].sort((b,v)=>b.localeCompare(v)).join(", ");i.push({detail:"Run `vis migrate verify` for the full list, then re-run `vis migrate <tool>` to clean up.",label:`${String(d.length)} leftover ${d.length===1?"reference":"references"} to ${k}`,severity:"warn"})}}if(t.workspaceRoot&&t.packageManager){const d=Or(t.workspaceRoot,t.packageManager);if(d.length>0){const k=Pr(d);if(k.length===0)i.push({label:`patchedDependencies: ${String(d.length)} ${d.length===1?"entry":"entries"} resolved`,severity:"ok"});else for(const b of k)i.push({detail:`Referenced from ${t.packageManager==="pnpm"?"pnpm-workspace.yaml":"package.json"} but the file is not present at ${b.entry.patchFile}.`,label:`patchedDependencies: missing patch file for ${b.entry.name}@${b.entry.version}`,severity:"error"})}}return{findings:i,status:ot(i)}},"buildSupplyChainPosture");var Fr=Object.defineProperty,x=O((e,t)=>Fr(e,"name",{value:t,configurable:!0}),"u");const G=x(e=>e>=1e3?`${(e/1e3).toFixed(1)}s`:`${String(Math.round(e))}ms`,"fmtDuration"),Oe=x(async(e,t,i,s)=>{if(!e)return i();e.start(t);const o=Date.now();try{const l=await i(),c=Date.now()-o,{status:h,summary:d}=s(l,c);return e.finish(t,h,d),l}catch(l){const c=Date.now()-o,h=l instanceof Error?l.message:String(l);throw e.finish(t,"error",`${h} (${G(c)})`),l}},"tracked"),zr=x((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 $t(i)},"buildSectionFindings"),st=x(async e=>{const{filterPatterns:t,installed:i,progress:s,resolveCodemods:o,sections:l,store:c,visConfig:h,workspaceRoot:d}=e,k=l.has("dependencies"),b=l.has("security"),v=l.has("optimization"),D=l.has("runtime"),j=x((f,N)=>xt(zr(f,N),t),"sectionFindings"),g=at(d),{packageManager:A}=ct(d),E=Ze(ee(d,"package.json"),!1),J=ft(d),B=new Set(E);for(const f of J){const N=Ze(ee(gt(d,f),"package.json"),!1);for(const M of N)B.add(M)}const L=jt(d),T=dt(d,A),V=ut(h?.security?.socket,h?.security?.policies?.score?.minimum),H=V?.minimumScore??h?.security?.policies?.score?.minimum??pt,se=h?.security?.acceptedRisks,ie=Zt(d,g.name),U={exclude:[],ignore:[],include:[],includeLocked:!1,includePrerelease:!1,security:!0,target:"latest"},z=k?li(d,g.name):[],Y=v?ei(B):[],S=v?ti(B,ie,g,!1):[],C=new Set(Y.map(f=>f.packageName)),W=S.filter(f=>!C.has(f.packageName)),R=[...Y,...W],le=D?ji():[];c&&(k&&c.startSection("dependencies",T.size>0?"checking outdated catalog dependencies":"scanning duplicates"),b&&c.startSection("security",i.length>0?`scanning ${String(i.length)} packages for advisories`:"no installed packages to scan"),v&&c.startSection("optimization","matching e18e + socket overrides"),D&&c.startSection("runtime","running runtime diagnostics")),c&&D&&c.completeSection("runtime",j("runtime",{duplicates:[],optimizations:[],outdated:[],runtime:le}));const ue=(k||b)&&T.size>0?Oe(s,"outdated",()=>Et(T,U,L,void 0,d,V,se),(f,N)=>{const M=f.outdated.length;return{status:M>0?"warn":"ok",summary:M>0?`${String(M)} outdated · ${G(N)}`:`up to date · ${G(N)}`}}):Promise.resolve({failed:[],ignored:[],outdated:[]}),P=b&&i.length>0?Oe(s,"vulnerabilities",()=>Lt(i.map(f=>({name:f.name,version:f.version}))),(f,N)=>{let M=0;for(const re of f.values())M+=re.length;return{status:M>0?"error":"ok",summary:M>0?`${String(M)} found · ${G(N)}`:`none found · ${G(N)}`}}):Promise.resolve(new Map),X=b&&V&&i.length>0?Oe(s,"socket",()=>Bt(i.map(f=>({name:f.name,version:f.version})),V),(f,N)=>{let M=0,re=0;for(const Ye of f.values())M+=Ye.alerts.length,Ye.score.overall<H&&(re+=1);const Ge=M+re;return{status:Ge>0?"warn":"ok",summary:Ge>0?`${String(M)} alert${M===1?"":"s"}, ${String(re)} low-score · ${G(N)}`:`clean · ${G(N)}`}}):Promise.resolve(new Map);let Z,pe,he,ge;const fe=ue.catch(f=>(Z=f instanceof Error?f.message:String(f),c||u.warn(`Outdated scan failed: ${Z}`),{failed:[],ignored:[],outdated:[]})),Se=P.catch(f=>(pe=f instanceof Error?f.message:String(f),c||u.warn(`Vulnerability scan failed: ${pe}`),new Map)),y=X.catch(f=>(he=f instanceof Error?f.message:String(f),c||u.warn(`Socket scan failed: ${he}`),new Map)),m=c&&k?fe.then(f=>{if(Z){c.failSection("dependencies",Z);return}c.completeSection("dependencies",j("dependencies",{duplicates:z,optimizations:[],outdated:f.outdated,runtime:[]}))}):void 0,w=c&&b?Promise.all([fe,Se,y]).then(([f])=>{const N=Z??pe??he;if(N){c.failSection("security",N);return}c.completeSection("security",j("security",{duplicates:[],optimizations:[],outdated:f.outdated,runtime:[]}))}):void 0,Ce=(async()=>{if(o&&v&&R.length>0&&await Oe(s,"codemods",async()=>(await ii(R),R),(f,N)=>{const M=f.filter(re=>re.hasCodemod||re.category==="socket").length;return{status:"ok",summary:`${String(M)} auto-fixable · ${G(N)}`}}).catch(f=>{ge=f instanceof Error?f.message:String(f)}),c&&v){if(ge){c.failSection("optimization",ge);return}c.completeSection("optimization",j("optimization",{duplicates:[],optimizations:R,outdated:[],runtime:[]}))}})(),[ae,At,Ot]=await Promise.all([fe,Se,y]);await Promise.all([m,w,Ce]);let _e=0,He=0;if(b&&V)for(const f of Ot.values())_e+=f.alerts.length,f.score.overall<H&&(He+=1);let Ee=0;if(b){for(const f of ae.outdated)f.vulnerabilities&&f.vulnerabilities.length>0&&(Ee+=f.vulnerabilities.length);for(const f of At.values())Ee+=f.length}return{duplicates:z,installedCount:i.length,optimizations:v?R:[],outdated:k?ae.outdated:[],runtime:le,sections:l,socketIssues:{alerts:_e,lowScore:He},supplyChain:Mr(h,{packageManager:A,workspaceRoot:d}),vulnCount:Ee,workspaceCount:J.length}},"streamScans"),jr=x(e=>{switch(e){case"error":return Re(F.failure);case"skip":return $(F.dash);case"warn":return ze(F.warning);default:return ve(F.success)}},"sectionIcon"),de=x((e,t)=>{const i=process.stderr.columns??80,s=Math.max(20,Math.min(i-2,60)),o=F.dash.repeat(2),l=`${jr(t)} ${ce(e)}`,c=l.replaceAll(/\[[0-9;]*m/g,"").length,h=Math.max(0,s-c-o.length-2);return`${o} ${l} ${$(F.dash.repeat(h))}`},"heading"),q=x(e=>` ${ve(F.success)} ${e}`,"itemOk"),Q=x(e=>` ${ze(F.warning)} ${e}`,"itemWarn"),Ue=x(e=>` ${Re(F.failure)} ${e}`,"itemError"),Dt=x(e=>` ${$(F.dash)} ${$(e)}`,"itemSkip"),K=x((e,t,i)=>{const s=`${ce(String(e))} ${$(t)}`;return i?`${s} ${$(`(${i})`)}`:s},"countLine"),Er=x(e=>{if(e.sections.has("dependencies")){if(u.log(""),u.log(de("Dependencies",ne(e,"dependencies"))),u.log(q(K(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,s=e.outdated.filter(l=>l.updateType==="patch").length,o=[];t>0&&o.push(`${String(t)} major`),i>0&&o.push(`${String(i)} minor`),s>0&&o.push(`${String(s)} patch`),u.log(Q(K(e.outdated.length,"outdated",o.join(", "))))}else u.log(q("All dependencies up to date"));e.duplicates.length>0?u.log(Q(K(e.duplicates.length,"packages with duplicate versions"))):u.log(q("No duplicate dependencies"))}},"displayDependencies"),Lr=x(e=>{e.sections.has("security")&&(u.log(""),u.log(de("Security",ne(e,"security"))),e.vulnCount>0?u.log(Ue(K(e.vulnCount,`vulnerabilit${e.vulnCount===1?"y":"ies"} found`))):u.log(q("No known vulnerabilities")),e.socketIssues.alerts>0&&u.log(Q(K(e.socketIssues.alerts,`Socket.dev security alert${e.socketIssues.alerts===1?"":"s"}`))),e.socketIssues.lowScore>0&&u.log(Q(K(e.socketIssues.lowScore,`package${e.socketIssues.lowScore===1?"":"s"} with low security score`))),e.socketIssues.alerts===0&&e.socketIssues.lowScore===0&&e.vulnCount===0&&u.log(q("No security issues detected")))},"displaySecurity"),Br=x(e=>{if(!e.sections.has("optimization"))return;u.log(""),u.log(de("Optimization",ne(e,"optimization")));const t=Rt(e.optimizations);if(t.total===0){u.log(q("No optimizations available"));return}t.native>0&&u.log(Q(K(t.native,"replaceable with native APIs"))),t.preferred>0&&u.log(Q(K(t.preferred,"with lighter alternatives"))),t.micro>0&&u.log(Q(K(t.micro,"trivial micro-utilities"))),t.socket>0&&u.log(Q(K(t.socket,"@socketregistry overrides available")))},"displayOptimization"),Vr=x(e=>{u.log(""),u.log(de("Supply Chain",e.supplyChain.status));for(const t of e.supplyChain.findings){const i=t.severity==="ok"?q(t.label):t.severity==="error"?Ue(t.label):Q(t.label);u.log(i),t.detail&&u.log(` ${$(F.arrow)} ${$(t.detail)}`)}e.supplyChain.status!=="ok"&&u.log(` ${$(F.arrow)} ${$("Configure with security.* in vis.config.ts. See `vis check --security-config` for details.")}`)},"displaySupplyChain"),Ur=x(e=>{if(e.sections.has("runtime")){u.log(""),u.log(de("Runtime",ne(e,"runtime")));for(const t of e.runtime)t.status==="ok"?u.log(q(t.message)):t.status==="skip"?u.log(Dt(t.message)):u.log(Q(t.message))}},"displayRuntime"),_r=x((e,t)=>{const i=e.vulnCount,s=e.runtime.filter(l=>l.status==="warn").length,o=e.outdated.length+e.duplicates.length+e.optimizations.length+s;if(t){if(i===0&&o===0)u.success(`Everything looks good! ${$(`(${G(e.elapsedMs)})`)}`);else{const l=[];i>0&&l.push(Re(`${String(i)} security`)),o>0&&l.push(ze(`${String(o)} improvement${o===1?"":"s"}`)),u.log(`${Re(F.failure)} ${l.join(", ")} ${$(`(${G(e.elapsedMs)})`)}`)}return}u.log(""),u.log(de("Summary","ok")),i===0&&o===0?u.success(`Everything looks good! ${$(`(${G(e.elapsedMs)})`)}`):(i>0&&u.error(`${String(i)} security issue${i===1?"":"s"}`),o>0&&u.log(` ${Ie(F.arrow)} ${ce(String(o))} ${$(`improvement${o===1?"":"s"} available`)} ${$(`(${G(e.elapsedMs)})`)}`))},"displaySummary"),Hr=x(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){u.log(""),u.log(ce("Next steps:"));for(const i of t)u.log(` ${$(F.arrow)} ${i}`)}u.log("")},"displayActions"),Gr=x((e,t)=>{t||(Er(e),Lr(e),Br(e),Ur(e),Vr(e)),_r(e,t)},"displayResults"),Yr=x((e,t,i,s,o)=>{const l=[],c=e.has("dependencies"),h=e.has("security"),d=e.has("optimization");return(c||h)&&t>0&&l.push({id:"outdated",label:"Outdated catalog dependencies"}),h&&s>0&&l.push({id:"vulnerabilities",label:"Known vulnerabilities (OSV)"}),h&&i&&s>0&&l.push({id:"socket",label:"Socket.dev supply-chain reports"}),d&&o&&l.push({id:"codemods",label:"Codemod availability"}),l},"planScanTasks"),Kr=x(e=>{if(u.log(""),u.log(`${ce(Ie("vis doctor"))} ${$("— project health check")}`),u.log(q(`Detected ${e.packageManagerName} v${e.packageManagerVersion}`)),e.workspaceCount!==void 0&&e.workspaceCount>0&&u.log(q(K(e.workspaceCount,`workspace package${e.workspaceCount===1?"":"s"}`))),e.runtimeFindings.length===0)u.log(q(`Node.js ${e.nodeVersion}`));else{for(const t of e.runtimeFindings){const i=t.severity==="error"?Re:ze;u.log(Ue(`Runtime: ${i(t.message)}`))}u.log(` ${$(F.arrow)} Run ${ve("vis toolchain install")} to install pinned versions, or ${ve("vis toolchain status")} for the per-tool breakdown.`)}u.log("")},"printBanner"),bn=x(async({logger:e,options:t,visConfig:i,visConfigError:s,workspaceRoot:o})=>{if(!o)throw new Error("Could not determine workspace root.");const l=t.format==="json"||t.json===!0,c=Tr(t.only,t.skip),h=!!t.quiet,d=t.progress===!1,k=Sr(t.filter);if(c.size===0){u.error("No sections selected. Check your --only / --skip values."),process.exitCode=2;return}const b=Date.now(),v=at(o),D=oi(o),j=!!process.stdout.isTTY,g=!l&&j&&!Vt&&!h&&!d;!l&&!g&&Kr({nodeVersion:process.versions.node,packageManagerName:v.name,packageManagerVersion:v.version,runtimeFindings:D,workspaceCount:void 0});const A=dt(o,ct(o).packageManager),E=ai(o,v.name),J=E.length,B=!!ut(i?.security?.socket),L=i?.security?.policies?.score?.minimum??pt,T=ft(o);if(!l&&!h&&!g){const P=T.length>0?$(` · ${String(T.length)} workspace package${T.length===1?"":"s"}`):"";u.log(`${$("·")} ${$("Found")} ${ce(String(J))} ${$(`installed package${J===1?"":"s"}`)}${P}`)}const V=s?{hint:s.file?`Continuing with default settings — fix or regenerate ${s.file} (vis init --force).`:"Continuing with default settings.",message:s.message,severity:"error",title:s.file?`Failed to load ${s.file}`:"Failed to load vis.config"}:void 0,H={bun:"bun.lock",npm:"package-lock.json",pnpm:"pnpm-lock.yaml",yarn:"yarn.lock"}[v.name],se=H?ee(o,H):void 0,ie=Gt(o),U=t.cache!==!1&&!t.fix?Si({configPath:ie,lockfilePath:se,sections:c,socketEnabled:B,workspaceRoot:o}):void 0,z=U?Ci(U):void 0,Y=z!==void 0;let S,C;if(g){const P=z?new tt({activeSections:c,findings:xt($t(z),k)}):new tt({activeSections:c}),X=Yt(Kt.createElement(wr,{banner:V,fromCache:Y,startedAt:b,store:P}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0});try{S=z??await st({filterPatterns:k,installed:E,resolveCodemods:!!t.fix,sections:c,store:P,visConfig:i,workspaceRoot:o})}catch(Z){throw X.unmount(),Z}await X.waitUntilExit(),C=P.getSnapshot().pendingAction}else if(z)S=z;else{const P=Yr(c,A.size,B,J,!!t.fix),X=si(P,{live:!l&&!h&&!d});try{S=await st({filterPatterns:k,installed:E,progress:X,resolveCodemods:!!t.fix,sections:c,visConfig:i,workspaceRoot:o})}finally{X.stop()}}const W={...S,elapsedMs:Date.now()-b};if(U&&!Y)try{xi(U,W)}catch{}const R=Cr(W,k,L);if(l){process.stdout.write(`${JSON.stringify(Rr(R,v.name),void 0,2)}
|
|
4
|
+
`),t.exitCode&&nt(R,!!t.strict)&&(process.exitCode=1);return}Y&&!h&&u.log(`${$("·")} Cached results (use --no-cache to refresh)`),k.length>0&&!h&&u.log(`${$("·")} Filter active: ${Ie(t.filter??"")}`),Gr(R,h);const le=R.runtime.some(P=>P.id===Pe&&P.status==="warn"),ue=R.sections.has("optimization")&&R.optimizations.length>0;t.fix&&(ue||le)?await qr({force:!!t.fixForce,logger:e,pm:v,recoverOrphans:le,results:R,useEditorconfig:i?.editorconfig??!0,workspaceRoot:o}):h||Hr(R),C&&(process.stdout.write(`
|
|
5
|
+
`),process.stdout.write(`${ce("→ ")}${C.description}
|
|
6
|
+
`),C.configSnippet?(process.stdout.write(`
|
|
7
|
+
`),process.stdout.write(`${$(C.configSnippet)}
|
|
8
|
+
`)):process.stdout.write(` ${Ie(C.command)}
|
|
9
|
+
`),process.stdout.write(`
|
|
10
|
+
`)),t.exitCode&&nt(R,!!t.strict)&&(process.exitCode=1)},"execute"),qr=x(async e=>{const{force:t,logger:i,pm:s,recoverOrphans:o,results:l,useEditorconfig:c,workspaceRoot:h}=e;u.log(""),u.log(de("Applying fixes","ok"));const d=l.optimizations.filter(g=>g.category==="socket"&&g.overrideSpec).map(g=>({original:g.packageName,spec:g.overrideSpec})),k=l.optimizations.filter(g=>g.category!=="socket"&&g.hasCodemod),b=l.optimizations.filter(g=>g.category!=="socket"&&!g.hasCodemod);let v=!1,D=0;const j=[];if(o){const g=Oi({force:t});if(g.killed.length>0&&(u.success(`Cleaned up ${String(g.killed.length)} orphaned process${g.killed.length===1?"":"es"} (PIDs: ${g.killed.join(", ")}).`),v=!0),g.failed.length>0){const A=t?"":" Re-run with `--fix --fix-force` to escalate to SIGKILL.";u.warn(`Could not signal ${String(g.failed.length)} orphan${g.failed.length===1?"":"s"}: ${g.failed.map(E=>`${String(E.pid)} (${E.reason})`).join(", ")}.${A}`)}}if(d.length>0){const g=ri(h,ee(h,"package.json"),d,s,c);g.added.length>0&&(u.success(`Added ${String(g.added.length)} security override${g.added.length===1?"":"s"}.`),v=!0),g.updated.length>0&&(u.success(`Updated ${String(g.updated.length)} override${g.updated.length===1?"":"s"}.`),v=!0)}for(const g of k)try{const A=await ni(h,g.packageName);A.filesChanged>0&&(u.success(`${g.packageName}: ${String(A.filesChanged)} file${A.filesChanged===1?"":"s"} updated`),D+=1,v=!0)}catch(A){const E=A instanceof Error?A.message:String(A);j.push({error:E,package:g.packageName}),u.warn(`${g.packageName}: codemod failed — ${E}`)}d.length>0&&(u.log(`${Ie(F.arrow)} Running ${s.name} install to update lockfile…`),Ut(s,{dev:!1,filter:[],force:!1,frozenLockfile:!1,ignoreScripts:!1,lockfileOnly:!1,noOptional:!1,offline:!1,prod:!1,recursive:!1,silent:!1,workspaceRoot:!1},h,i),v=!0),u.log(""),v?u.success(`Fixes applied. ${D>0?`${String(D)} codemod${D===1?"":"s"} applied.`:""}`.trim()):u.log(Dt("No auto-fixable items in the current run.")),j.length>0&&u.warn(`${String(j.length)} codemod${j.length===1?"":"s"} failed (run ${ve("vis optimize")} for the interactive picker).`),b.length>0&&u.notice(`${String(b.length)} optimization${b.length===1?"":"s"} need manual review (no codemod). Run ${ve("vis optimize")} to inspect them.`)},"runFixes");export{bn as default};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
var ge=Object.defineProperty;var g=(e,t)=>ge(e,"name",{value:t,configurable:!0});import{createRequire as he}from"node:module";import{aQ as ve,E as d,j as k,q as x,p as a,g as ce,M as be,A as we}from"./bin.js";import{i as O,C as _,Q as ke,z as W,b,M as c,B as m,n as ie,f as xe,O as $e}from"./config.js";import{f as Se}from"../packem_shared/giget-CcEy_Elm.js";const fe=he(import.meta.url),D=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,J=g(e=>{if(typeof D<"u"&&D.versions&&D.versions.node){const[t,r]=D.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return D.getBuiltinModule(e)}return fe(e)},"__cjs_getBuiltinModule"),{spawnSync:ye}=J("node:child_process"),{createInterface:_e}=J("node:readline"),{readdirSync:je,chmodSync:Ce}=J("node:fs");var Oe=Object.defineProperty,L=g((e,t)=>Oe(e,"name",{value:t,configurable:!0}),"e");const Pe={"vis:app":"builtin:app","vis:application":"builtin:app","vis:generator":"builtin:generator","vis:lib":"builtin:library","vis:library":"builtin:library","vis:monorepo":"builtin:monorepo"},Ne=["https://github.com/","https://gitlab.com/","https://bitbucket.org/","https://raw.githubusercontent.com/","https://git.sr.ht/","git@github.com:","git@gitlab.com:","git@bitbucket.org:","git@git.sr.ht:","github:","gh:","gitlab:","bitbucket:","sourcehut:","git:","http://","https://"],qe=L(e=>{for(const t of Ne)if(e.startsWith(t))return!0;return!e.startsWith("@")&&/^[^/#@][^/#]*\/[^/#]+/.test(e)},"isGitUrl"),De=new Set(["sv"]),Ee=L(e=>{if(De.has(e)||e.startsWith("create-")||e.startsWith("@")&&e.includes("/create-"))return e;if(e.startsWith("@")){const t=e.indexOf("/");if(t!==-1){const r=e.slice(0,t),i=e.slice(t+1);return`${r}/create-${i}`}return e}return`create-${e}`},"expandCreateShorthand"),Te=L((e,t=[])=>{if(!e)throw new Error("No template specified.");const r=e.toLowerCase(),i=Pe[r];return i?{args:t,source:r,type:i}:qe(e)?{args:t,source:e,type:"remote:git"}:{args:t,source:Ee(e),type:"remote:npm"}},"discoverTemplate"),Ie=L(e=>{switch(e){case"builtin:app":return"apps";case"builtin:generator":case"builtin:library":return"packages";default:return"."}},"inferParentDir");var Re=Object.defineProperty,le=g((e,t)=>Re(e,"name",{value:t,configurable:!0}),"i$1");const ae=["ability","able","about","above","abroad","absence","absolute","absolutely","absorb","academic","accept","access","accompany","accomplish","according","account","accurate","achieve","achievement","acid","acknowledge","acquire","across","act","action","active","activist","activity","actor","actress","actual","actually","adapt","add","addition","additional","address","adequate","adjust","adjustment","administration","administrator","admire","admission","admit","adolescent","adopt","adult","advance","advanced","advantage","adventure","advertising","advice","advise","adviser","advocate","affair","affect","afford","after","afternoon","again","against","age","agency","agenda","agent","ago","agree","agreement","agricultural","ahead","aid","aide","aim","air","aircraft","airline","airport","album","alive","all","alliance","allow","ally","almost","alone","along","already","also","alter","alternative","although","always","amazing","among","amount","analysis","analyst","analyze","ancient","and","angle","animal","anniversary","announce","annual","another","answer","anticipate","any","anybody","anymore","anyone","anything","anyway","anywhere","apart","apartment","apparent","apparently","appeal","appear","appearance","apple","application","apply","appoint","appointment","appreciate","approach","appropriate","approval","approve","approximately","architect","area","argue","argument","arise","arm","armed","around","arrange","arrangement","arrival","arrive","art","article","artist","artistic","aside","ask","asleep","aspect","assert","assess","assessment","asset","assign","assignment","assist","assistance","assistant","associate","association","assume","assumption","assure","athlete","athletic","atmosphere","attach","attempt","attend","attention","attitude","attorney","attract","attractive","attribute","audience","author","authority","auto","available","average","avoid","award","aware","awareness","away","awesome","baby","back","background","bag","bake","balance","ball","ban","band","bank","bar","barely","barrel","base","baseball","basic","basically","basis","basket","basketball","bathroom","battery","beach","bean","bear","beat","beautiful","beauty","because","become","bed","bedroom","beer","before","begin","beginning","behavior","behind","being","belief","believe","bell","belong","below","belt","bench","bend","beneath","benefit","beside","besides","best","bet","better","between","beyond","big","bike","bill","billion","bind","biological","bird","birth","birthday","bit","bite","black","blade","blanket","blind","block","blow","blue","board","boat","body","bond","bone","book","boom","boot","border","born","borrow","boss","both","bother","bottle","bottom","boundary","bowl","box","boy","boyfriend","brain","branch","brand","bread","break","breakfast","breast","breath","breathe","brick","bridge","brief","briefly","bright","brilliant","bring","broad","brother","brown","brush","buck","budget","build","building","bullet","bunch","bury","bus","business","busy","but","butter","button","buy","buyer","cabin","cabinet","cable","cake","calculate","call","camera","camp","campaign","campus","can","candidate","cap","capability","capable","capacity","capital","captain","capture","car","carbon","card","care","career","careful","carefully","carrier","carry","case","cash","cast","cat","catch","category","cause","ceiling","celebrate","celebration","celebrity","cell","center","central","century","ceremony","certain","certainly","chain","chair","chairman","challenge","chamber","champion","championship","chance","change","changing","channel","chapter","character","characteristic","characterize","charge","charity","chart","chase","cheap","check","cheek","cheese","chef","chemical","chest","chicken","chief","child","childhood","chip","chocolate","choice","cholesterol","choose","church","cigarette","circle","circumstance","cite","citizen","city","civil","civilian","claim","class","classic","classroom","clean","clear","clearly","client","climate","climb","clinic","clinical","clock","close","closely","closer","clothes","clothing","cloud","club","clue","cluster","coach","coal","coalition","coast","coat","code","coffee","cognitive","cold","colleague","collect","collection","collective","college","colonial","color","column","combination","combine","come","comedy","comfort","comfortable","command","commander","comment","commercial","commission","commit","commitment","committee","common","communicate","communication","community","company","compare","comparison","compete","competition","competitive","competitor","complete","completely","complex","complicated","component","compose","composition","comprehensive","computer","concentrate","concentration","concept","concern","concerned","concert","conclude","conclusion","concrete","condition","conduct","conference","confidence","confident","confirm","confront","confusion","congressional","connect","connection","consciousness","consensus","consequence","conservative","consider","considerable","consideration","consist","consistent","constant","constantly","constitute","constitutional","construct","construction","consultant","consume","consumer","consumption","contact","contain","container","contemporary","content","contest","context","continue","continued","contract","contrast","contribute","contribution","control","convention","conventional","conversation","convert","conviction","convince","cook","cookie","cooking","cool","cooperation","cop","cope","copy","core","corn","corner","corporate","corporation","correct","correspondent","cost","cotton","couch","could","council","counselor","count","counter","country","county","couple","courage","course","court","cousin","cover","coverage","cow","crack","craft","cream","create","creation","creative","creature","credit","crew","criteria","crop","cross","crowd","crucial","cultural","culture","cup","curious","current","currently","curriculum","custom","customer","cut","cycle","dad","daily","dance","dare","dark","darkness","data","date","daughter","day","deal","dealer","dear","debate","decade","decide","decision","deck","declare","decrease","deep","deeply","deer","defend","defendant","defense","defensive","define","definitely","definition","degree","delay","deliver","delivery","demand","democracy","democratic","demonstrate","demonstration","deny","department","depend","dependent","depending","depict","depth","deputy","derive","describe","description","desert","deserve","design","designer","desire","desk","desperate","despite","detail","detailed","detect","determine","develop","developing","development","device","devote","dialogue","diet","differ","difference","different","differently","difficult","difficulty","dig","digital","dimension","dining","dinner","direct","direction","directly","director","disability","disagree","disappear","discipline","discourse","discover","discovery","discuss","discussion","dish","dismiss","display","distance","distant","distinct","distinction","distinguish","distribute","distribution","district","diverse","diversity","divide","division","doctor","document","dog","domestic","dominant","dominate","door","double","down","downtown","dozen","draft","drag","drama","dramatic","dramatically","draw","drawing","dream","dress","drink","drive","driver","drop","dry","due","during","dust","duty","each","eager","ear","early","earn","earnings","earth","ease","easily","east","eastern","easy","eat","economic","economics","economist","economy","edge","edition","editor","educate","education","educational","educator","effect","effective","effectively","efficiency","efficient","effort","egg","eight","either","elderly","elect","election","electric","electricity","electronic","element","elementary","eliminate","elite","else","elsewhere","embrace","emerge","emission","emotion","emotional","emphasis","emphasize","employ","employee","employer","employment","empty","enable","encounter","encourage","end","energy","enforcement","engage","engine","engineer","engineering","enhance","enjoy","enormous","enough","ensure","enter","enterprise","entertainment","entire","entirely","entrance","entry","environment","environmental","episode","equal","equally","equipment","era","escape","especially","essay","essential","essentially","establish","establishment","estate","estimate","etc","ethics","ethnic","evaluate","evaluation","even","evening","event","eventually","ever","every","everybody","everyday","everyone","everything","everywhere","evidence","evolution","evolve","exact","exactly","examination","examine","example","exceed","excellent","except","exception","exchange","exciting","executive","exercise","exhibit","exhibition","exist","existence","existing","expand","expansion","expect","expectation","expense","expensive","experience","experiment","expert","explain","explanation","explore","expose","express","expression","extend","extension","extensive","extent","external","extra","extraordinary","extreme","extremely","eye","fabric","face","facility","fact","factor","factory","faculty","fade","fair","fairly","faith","fall","false","familiar","family","famous","fan","fantasy","far","farm","farmer","fashion","fast","fate","father","favor","favorite","feature","federal","fee","feed","feel","feeling","fellow","female","fence","few","fewer","fiber","fiction","field","fifteen","fifth","fifty","figure","file","fill","film","final","finally","finance","financial","find","finding","fine","finger","finish","firm","first","fish","fishing","fit","fitness","five","fix","flag","flame","flat","flavor","flesh","flight","float","floor","flow","flower","fly","focus","folk","follow","following","food","foot","football","for","force","foreign","forest","forever","forget","form","formal","formation","former","formula","forth","fortune","forward","found","foundation","founder","four","fourth","frame","framework","free","freedom","freeze","frequency","frequent","frequently","fresh","friend","friendly","friendship","from","front","fruit","fuel","full","fully","fun","function","fund","fundamental","funding","funeral","funny","furniture","furthermore","future","gain","galaxy","gallery","game","gap","garage","garden","garlic","gas","gate","gather","gaze","gear","gender","gene","general","generally","generate","generation","genetic","gentleman","gently","gesture","get","ghost","giant","gift","gifted","girl","girlfriend","give","given","glad","glance","glass","global","glove","goal","gold","golden","golf","good","government","governor","grab","grade","gradually","graduate","grain","grand","grandfather","grandmother","grant","grass","grave","gray","great","greatest","green","grocery","ground","group","grow","growing","growth","guarantee","guard","guess","guest","guide","guideline","guy","habit","habitat","hair","half","hall","hand","handful","handle","hang","happen","happy","hard","hardly","hat","have","head","headline","headquarters","health","healthy","hear","hearing","heart","heat","heaven","heavily","heavy","heel","height","helicopter","hello","help","helpful","here","heritage","hero","herself","hey","hide","high","highlight","highly","highway","hill","himself","hip","hire","historian","historic","historical","history","hit","hold","hole","holiday","holy","home","honest","honey","honor","hope","horizon","horse","hospital","host","hot","hotel","hour","house","household","housing","how","however","huge","human","humor","hundred","hungry","hunter","hunting","husband","hypothesis","ice","idea","ideal","identification","identify","identity","ignore","illustrate","image","imagination","imagine","immediate","immediately","immigrant","immigration","impact","implement","implication","imply","importance","important","impose","impossible","impress","impression","impressive","improve","improvement","incentive","incident","include","including","income","incorporate","increase","increased","increasing","increasingly","incredible","indeed","independence","independent","index","indicate","indication","individual","industrial","industry","infant","inflation","influence","inform","information","ingredient","initial","initially","initiative","inner","innocent","inquiry","inside","insight","insist","inspire","install","instance","instead","institution","institutional","instruction","instructor","instrument","insurance","intellectual","intelligence","intend","intense","intensity","intention","interaction","interest","interested","interesting","internal","international","interpret","interpretation","intervention","interview","into","introduce","introduction","invest","investigate","investigation","investigator","investment","investor","invite","involve","involved","involvement","iron","island","issue","item","its","itself","jacket","jet","job","join","joint","joke","journal","journalist","journey","joy","judge","judgment","juice","jump","junior","jury","just","justice","justify","keep","key","kick","kid","kind","king","kiss","kitchen","knee","knife","knock","know","knowledge","lab","label","labor","laboratory","lady","lake","land","landscape","language","lap","large","largely","last","late","later","latter","laugh","launch","law","lawn","lawsuit","lawyer","lay","layer","lead","leader","leadership","leading","leaf","league","lean","learn","learning","least","leather","leave","left","leg","legacy","legal","legend","legislation","legitimate","lemon","length","less","lesson","let","letter","level","liberal","library","license","lie","life","lifestyle","lifetime","lift","light","like","likely","limit","limitation","limited","line","link","lip","list","listen","literally","literary","literature","little","live","living","load","loan","local","locate","location","lock","long","look","loose","lose","lost","lot","lots","loud","love","lovely","lover","low","lower","luck","lucky","lunch","lung","machine","magazine","mail","main","mainly","maintain","maintenance","major","majority","make","maker","makeup","male","mall","man","manage","management","manager","manner","manufacturer","manufacturing","many","map","margin","mark","market","marketing","marriage","married","marry","mask","mass","massive","master","match","material","math","matter","may","maybe","mayor","meal","mean","meaning","meanwhile","measure","measurement","meat","mechanism","media","medical","medication","medicine","medium","meet","meeting","member","membership","memory","mental","mention","menu","mere","merely","message","metal","meter","method","middle","might","military","milk","million","mind","mine","minister","minor","minority","minute","miracle","mirror","miss","missile","mission","mix","mixture","mode","model","moderate","modern","modest","mom","moment","money","monitor","month","mood","moon","moral","more","moreover","morning","mortgage","most","mostly","mother","motion","motivation","motor","mount","mountain","mouse","mouth","move","movement","movie","much","multiple","muscle","museum","music","musical","musician","must","mutual","myself","mystery","myth","naked","name","narrative","narrow","nation","national","native","natural","naturally","nature","near","nearby","nearly","necessarily","necessary","neck","need","negative","negotiate","negotiation","neighbor","neighborhood","neither","nerve","net","network","never","nevertheless","new","newly","news","newspaper","next","nice","night","nine","nobody","nod","nomination","none","nonetheless","nor","normal","normally","north","northern","nose","not","note","nothing","notice","notion","novel","now","nowhere","nuclear","number","numerous","nurse","nut","object","objective","obligation","observation","observe","observer","obtain","obvious","obviously","occasion","occasionally","occupation","occupy","occur","ocean","odd","odds","off","offer","office","officer","official","often","oil","okay","old","once","one","ongoing","onion","online","only","onto","open","opening","operate","operating","operation","operator","opinion","opponent","opportunity","oppose","opposite","opposition","option","orange","order","ordinary","organic","organization","organize","orientation","origin","original","originally","other","others","otherwise","ought","our","ourselves","out","outcome","outside","oven","over","overall","overcome","overlook","owe","own","owner","pace","pack","package","page","paint","painter","painting","pair","pale","palm","pan","panel","pant","paper","parent","park","parking","part","participant","participate","participation","particular","particularly","partly","partner","partnership","party","pass","passage","passenger","passion","past","patch","path","patient","pattern","pause","pay","payment","peace","peak","peer","people","pepper","per","perceive","percentage","perception","perfect","perfectly","perform","performance","perhaps","period","permanent","permission","permit","person","personal","personality","personally","personnel","perspective","persuade","pet","phase","phenomenon","philosophy","phone","photo","photograph","photographer","phrase","physical","physically","physician","piano","pick","picture","pie","piece","pile","pilot","pine","pink","pipe","pitch","place","plan","plane","planet","planning","plant","plastic","plate","platform","play","player","please","pleasure","plenty","plot","plus","pocket","poem","poet","poetry","point","pole","police","policy","political","politically","politician","politics","poll","pool","pop","popular","population","porch","port","portion","portrait","portray","pose","position","positive","possess","possibility","possible","possibly","post","pot","potato","potential","potentially","pound","pour","powder","power","powerful","practical","practice","pray","prayer","precisely","predict","prefer","preference","pregnancy","pregnant","preparation","prepare","prescription","presence","present","presentation","preserve","president","presidential","press","pretend","pretty","prevent","previous","previously","price","pride","priest","primarily","primary","prime","principal","principle","print","prior","priority","privacy","private","probably","procedure","proceed","process","produce","producer","product","production","profession","professional","professor","profile","profit","program","progress","project","prominent","promise","promote","prompt","proof","proper","properly","property","proportion","proposal","propose","proposed","prosecutor","prospect","protect","protection","protein","protest","proud","prove","provide","provider","province","provision","psychological","psychologist","psychology","public","publication","publicly","publish","publisher","pull","purchase","pure","purpose","pursue","push","put","qualify","quality","quarter","quarterback","question","quick","quickly","quiet","quietly","quit","quite","quote","race","racial","radical","radio","rail","rain","raise","range","rank","rapid","rapidly","rare","rarely","rate","rather","rating","ratio","raw","reach","react","reaction","read","reader","reading","ready","real","reality","realize","really","reason","reasonable","recall","receive","recent","recently","recipe","recognition","recognize","recommend","recommendation","record","recording","recover","recovery","recruit","red","reduce","reduction","refer","reference","reflect","reflection","reform","refugee","refuse","regard","regarding","regardless","regime","region","regional","register","regular","regularly","regulate","regulation","reinforce","relate","relation","relationship","relative","relatively","relax","release","relevant","relief","religion","religious","rely","remain","remaining","remarkable","remember","remind","remote","remove","repeat","repeatedly","replace","reply","report","reporter","represent","representation","representative","reputation","request","require","requirement","research","researcher","resemble","reservation","resident","resist","resolution","resolve","resort","resource","respect","respond","respondent","response","responsibility","responsible","rest","restaurant","restore","restriction","result","retain","retire","retirement","return","reveal","revenue","review","revolution","rhythm","rice","rich","rid","ride","rifle","right","ring","rise","river","road","rock","role","roll","romantic","roof","room","root","rope","rose","roughly","round","route","routine","row","rub","rule","run","running","rural","rush","sacred","safe","safety","sake","salad","salary","sale","sales","salt","same","sample","sanction","sand","satellite","satisfaction","satisfy","sauce","save","saving","say","scale","scenario","scene","schedule","scheme","scholar","scholarship","school","science","scientific","scientist","scope","score","screen","script","sea","search","season","seat","second","secret","secretary","section","sector","secure","security","see","seed","seek","seem","segment","seize","select","selection","self","sell","senator","send","senior","sense","sensitive","sentence","separate","sequence","series","serious","seriously","serve","service","session","set","setting","settle","settlement","seven","several","shade","shadow","shake","shall","shape","share","sharp","sheet","shelf","shell","shelter","shift","shine","ship","shirt","shoe","shop","shopping","shore","short","shortly","shot","should","shoulder","shout","show","shower","shrug","shut","side","sigh","sight","sign","signal","significance","significant","significantly","silence","silent","silver","similar","similarly","simple","simply","since","sing","singer","single","sink","sir","sister","sit","site","situation","six","size","ski","skill","skin","sky","sleep","slice","slide","slight","slightly","slip","slow","slowly","small","smart","smell","smile","smooth","snap","snow","soccer","social","society","soft","software","soil","solar","solid","solution","solve","some","somebody","somehow","someone","something","sometimes","somewhat","somewhere","son","song","soon","sophisticated","sorry","sort","soul","sound","soup","source","south","southern","space","speak","speaker","special","specialist","species","specific","specifically","speech","speed","spend","spending","spin","spirit","spiritual","split","spokesman","sport","spot","spread","spring","square","squeeze","stability","stable","staff","stage","stair","stake","stand","standard","standing","star","stare","start","state","statement","station","statistics","status","stay","steady","steal","steel","step","stick","still","stir","stock","stomach","stone","stop","storage","store","storm","story","straight","strange","stranger","strategic","strategy","stream","street","strength","strengthen","stretch","string","strip","strong","strongly","structure","student","studio","study","stuff","style","subject","submit","subsequent","substance","substantial","succeed","success","successful","successfully","such","sudden","suddenly","sue","sufficient","sugar","suggest","suggestion","suit","summer","summit","sun","super","supply","support","supporter","suppose","supposed","sure","surely","surface","surgery","surprise","surprised","surprising","surprisingly","surround","survey","survival","survive","survivor","sustain","swear","sweep","sweet","swim","swing","switch","symbol","system","table","tablespoon","tactic","tail","take","tale","talent","talk","tall","tank","tap","tape","target","task","taste","tax","taxpayer","tea","teach","teacher","teaching","team","tear","teaspoon","technical","technique","technology","teen","teenager","telephone","telescope","television","tell","temperature","temporary","ten","tend","tendency","tennis","tent","term","terms","territory","test","testify","testimony","testing","text","than","thank","thanks","that","the","theater","their","them","theme","themselves","then","theory","therapy","there","therefore","thick","thin","thing","think","thinking","third","thirty","though","thought","thousand","three","throat","through","throughout","throw","ticket","tie","tight","time","tiny","tip","tire","tired","tissue","title","today","toe","together","tomato","tomorrow","tone","tongue","tonight","too","tool","tooth","top","topic","toss","total","totally","touch","tough","tour","tourist","tournament","tower","town","toy","trace","track","trade","tradition","traditional","traffic","trail","train","training","transfer","transform","transformation","transition","translate","transportation","travel","treat","treatment","treaty","tree","tremendous","trend","trial","tribe","trip","troop","truck","true","truly","trust","truth","try","tube","tunnel","turn","twelve","twenty","twice","twin","two","type","typical","typically","ultimate","ultimately","unable","uncle","under","undergo","understand","understanding","unfortunately","uniform","union","unique","unit","universal","universe","university","unknown","unless","unlike","unlikely","until","unusual","upon","upper","urban","urge","use","used","useful","user","usual","usually","utility","vacation","valley","valuable","value","variable","variation","variety","various","vary","vast","vegetable","vehicle","venture","version","versus","very","vessel","veteran","via","victory","video","view","viewer","village","virtually","virtue","visible","vision","visit","visitor","visual","vital","voice","volume","volunteer","vote","voter","wage","wait","wake","walk","wall","wander","want","warm","warn","warning","wash","watch","water","wave","way","wealth","wealthy","wear","weather","wedding","week","weekend","weekly","weigh","weight","welcome","welfare","well","west","western","wet","what","whatever","wheel","when","whenever","where","whereas","whether","which","while","whisper","white","who","whole","whom","whose","why","wide","widely","widespread","wife","wild","will","willing","win","wind","window","wine","wing","winner","winter","wipe","wire","wisdom","wise","wish","with","withdraw","within","without","witness","woman","wonder","wonderful","wood","wooden","word","work","worker","working","works","workshop","world","worried","worth","would","wrap","write","writer","writing","yard","yeah","year","yell","yellow","yes","yesterday","yield","young","your","yours","yourself","youth","zone"],Me=le((e,t)=>Math.floor(e+Math.random()*(t-e+1)),"random");function F(){return ae[Me(0,ae.length-1)]}g(F,"getRandomWord");le(F,"getRandomWord");var ze=Object.defineProperty,Le=g((e,t)=>ze(e,"name",{value:t,configurable:!0}),"o$1");const Ae=Le(()=>`${F()}-${F()}`,"randomName");var U,ne;function Ge(){return ne||(ne=1,U=["_http_agent","_http_client","_http_common","_http_incoming","_http_outgoing","_http_server","_stream_duplex","_stream_passthrough","_stream_readable","_stream_transform","_stream_wrap","_stream_writable","_tls_common","_tls_wrap","assert","assert/strict","async_hooks","buffer","child_process","cluster","console","constants","crypto","dgram","diagnostics_channel","dns","dns/promises","domain","events","fs","fs/promises","http","http2","https","inspector","inspector/promises","module","net","os","path","path/posix","path/win32","perf_hooks","process","punycode","querystring","readline","readline/promises","repl","stream","stream/consumers","stream/promises","stream/web","string_decoder","sys","timers","timers/promises","tls","trace_events","tty","url","util","util/types","v8","vm","wasi","worker_threads","zlib","node:sea","node:sqlite","node:test","node:test/reporters"]),U}g(Ge,"requireBuiltinModules");var B,oe;function Ue(){if(oe)return B;oe=1;var e=Object.defineProperty,t=g((o,l)=>e(o,"name",{value:l,configurable:!0}),"i");const r=Ge();var i=new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$"),n=["node_modules","favicon.ico"];function u(o){var l=[],s=[];if(o===null)return s.push("name cannot be null"),p(l,s);if(o===void 0)return s.push("name cannot be undefined"),p(l,s);if(typeof o!="string")return s.push("name must be a string"),p(l,s);if(o.length||s.push("name length must be greater than zero"),o.startsWith(".")&&s.push("name cannot start with a period"),o.startsWith("-")&&s.push("name cannot start with a hyphen"),o.match(/^_/)&&s.push("name cannot start with an underscore"),o.trim()!==o&&s.push("name cannot contain leading or trailing spaces"),n.forEach(function(h){o.toLowerCase()===h&&s.push(h+" is not a valid package name")}),r.includes(o.toLowerCase())&&l.push(o+" is a core module name"),o.length>214&&l.push("name can no longer contain more than 214 characters"),o.toLowerCase()!==o&&l.push("name can no longer contain capital letters"),/[~'!()*]/.test(o.split("/").slice(-1)[0])&&l.push(`name can no longer contain special characters ("~'!()*")`),encodeURIComponent(o)!==o){var w=o.match(i);if(w){var $=w[1],y=w[2];if(y.startsWith(".")&&s.push("name cannot start with a period"),encodeURIComponent($)===$&&encodeURIComponent(y)===y)return p(l,s)}s.push("name can only contain URL-friendly characters")}return p(l,s)}g(u,"validate"),t(u,"validate");var p=t(function(o,l){var s={validForNewPackages:l.length===0&&o.length===0,validForOldPackages:l.length===0,warnings:o,errors:l};return s.warnings.length||delete s.warnings,s.errors.length||delete s.errors,s},"done");return B=u,B}g(Ue,"requireLib");var Be=Ue();const Ve=ve(Be);var Fe=Object.defineProperty,I=g((e,t)=>Fe(e,"name",{value:t,configurable:!0}),"r$2");const pe=I(e=>e?Ve(e).validForNewPackages:!1,"isValidPackageName"),T=I(e=>e.toLowerCase().trim().replaceAll(/\s+/g,"-").replaceAll(/[^a-z\d\-~]/g,"-").replace(/^[._-]+/,"").replaceAll(/-{2,}/g,"-").replace(/-$/,""),"toValidPackageName"),Je=new Set([".DS_Store",".git",".gitkeep","Thumbs.db"]),ue=I(e=>O(e)?je(e).every(t=>Je.has(t)):!0,"isEmptyDir"),We=I((e,t)=>{const r=_(t,e);return{packageName:T(ke(r)),targetDir:r}},"resolveTargetDir"),He=I(e=>ue(e),"canSafelyOverwrite");var Ye=Object.defineProperty,A=g((e,t)=>Ye(e,"name",{value:t,configurable:!0}),"l$4");const E=A((e,t)=>new Promise(r=>{e.question(t,i=>{r(i.trim())})}),"ask"),V=A(async(e,t,r=!0)=>{const i=await E(e,` ${t} ${d(r?"[Y/n]":"[y/N]")} `);return i===""?r:i.toLowerCase()==="y"||i.toLowerCase()==="yes"},"confirm"),se=A(async(e,t,r)=>{process.stderr.write(` ${t}
|
|
2
|
+
`);for(const[i,n]of r.entries()){const u=k(x(` ${String(i+1)}.`)),p=n.hint?d(` — ${n.hint}`):"";process.stderr.write(`${u} ${n.label}${p}
|
|
3
|
+
`)}for(;;){const i=await E(e,`
|
|
4
|
+
${d(`Enter choice (1-${String(r.length)}):`)} `),n=Number.parseInt(i,10);if(n>=1&&n<=r.length)return r[n-1].value;const u=r.find(p=>p.value===i||p.label.toLowerCase()===i.toLowerCase());if(u)return u.value;process.stderr.write(` ${d("Invalid choice. Try again.")}
|
|
5
|
+
`)}},"select"),Ke=A(async e=>{const t=_e({input:process.stdin,output:process.stdout});try{process.stderr.write(`
|
|
6
|
+
${k(x("vis create"))} ${d("— project scaffolding")}
|
|
7
|
+
|
|
8
|
+
`);const r=e.inMonorepo?[{hint:"Scaffold via create-vite",label:"Vis Application",value:"vis:app"},{hint:"Reusable package scaffold",label:"Vis Library",value:"vis:library"},{hint:"Code generator scaffold",label:"Vis Generator",value:"vis:generator"},{hint:"Enter an npm create-* package or GitHub URL",label:"Custom template",value:"__custom__"}]:[{hint:"Full workspace setup",label:"Vis Monorepo",value:"vis:monorepo"},{hint:"Scaffold via create-vite",label:"Vis Application",value:"vis:app"},{hint:"Reusable package scaffold",label:"Vis Library",value:"vis:library"},{hint:"Code generator scaffold",label:"Vis Generator",value:"vis:generator"},{hint:"Enter an npm create-* package or GitHub URL",label:"Custom template",value:"__custom__"}];let i=await se(t,"Select a template:",r);if(i==="__custom__"&&(i=await E(t,`
|
|
9
|
+
${d("Template (npm package or GitHub URL):")} `),!i))throw new Error("No template specified.");const n=Ae(),u=await E(t,`
|
|
10
|
+
${d(`Project name (${n}):`)} `)||n;if(!pe(T(u)))throw new Error(`Invalid project name: "${u}". Must be a valid npm package name.`);const p=T(u),o=await E(t,` ${d(`Target directory (${p}):`)} `)||p;let l=!1;const s=_(e.cwd,o);if(!ue(s)&&(l=await V(t,`Directory "${o}" is not empty. Overwrite?`,!1),!l))throw new Error("Aborted — directory not empty.");let w;e.inMonorepo||(e.defaultPm?(w=e.defaultPm,process.stderr.write(` ${d(`Package manager: ${w} (from config)`)}
|
|
11
|
+
`)):w=await se(t,"Package manager:",[{label:"pnpm",value:"pnpm"},{label:"npm",value:"npm"},{label:"yarn",value:"yarn"},{label:"bun",value:"bun"}]));let $=!1;e.inMonorepo||($=await V(t,"Initialize a git repository?",e.defaultGitInit??!1));const y=e.defaultEditor==="vscode",h=await V(t,"Generate VS Code configuration?",y)?"vscode":void 0;return process.stderr.write(`
|
|
12
|
+
`),{editor:h,gitInit:$,overwrite:l,pm:w,projectName:u,targetDir:o,template:i}}finally{t.close()}},"runInteractivePrompts");var Qe=Object.defineProperty,S=g((e,t)=>Qe(e,"name",{value:t,configurable:!0}),"i");const Xe=S((e,t)=>{a.info("Scaffolding application via create-vite...");const r=[W(t.cwd,t.targetDir)||".",...e.args];return r.includes("--no-immediate")||r.push("--no-immediate"),ce(t.pm,{additionalPackages:[],args:r,package:"create-vite",shellMode:!1,silent:!1},t.cwd,t.logger)},"executeApp"),Ze=S(e=>`${JSON.stringify({devDependencies:{typescript:"^5.0.0",vitest:"^3.0.0"},exports:{".":{default:"./dist/index.js",types:"./dist/index.d.ts"}},files:["dist"],main:"./dist/index.js",name:e,scripts:{build:"tsc",dev:"tsc --watch",test:"vitest run","test:watch":"vitest"},type:"module",types:"./dist/index.d.ts",version:"0.0.1"},null,4)}
|
|
13
|
+
`,"libraryPackageJson"),et=S(()=>`${JSON.stringify({compilerOptions:{declaration:!0,declarationMap:!0,esModuleInterop:!0,module:"Node16",moduleResolution:"Node16",outDir:"./dist",rootDir:"./src",skipLibCheck:!0,sourceMap:!0,strict:!0,target:"ES2022"},include:["src/**/*"]},null,4)}
|
|
14
|
+
`,"libraryTsconfig"),tt=S(e=>`/**
|
|
15
|
+
* ${e} — library entry point.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export const greet = (name: string): string => \`Hello from ${e}, \${name}!\`;
|
|
19
|
+
`,"librarySrcIndex"),rt=S(e=>`import { describe, expect, it } from "vitest";
|
|
20
|
+
|
|
21
|
+
import { greet } from "../src/index";
|
|
22
|
+
|
|
23
|
+
describe("${e}", () => {
|
|
24
|
+
it("should greet", () => {
|
|
25
|
+
expect(greet("world")).toBe("Hello from ${e}, world!");
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
`,"libraryTestIndex"),it=S((e,t)=>{const{projectName:r,targetDir:i}=t;return a.info("Scaffolding library package..."),b(i),b(c(i,"src")),b(c(i,"__tests__")),m(c(i,"package.json"),Ze(r)),a.success("Created package.json"),m(c(i,"tsconfig.json"),et()),a.success("Created tsconfig.json"),m(c(i,"src","index.ts"),tt(r)),a.success("Created src/index.ts"),m(c(i,"__tests__","index.test.ts"),rt(r)),a.success("Created __tests__/index.test.ts"),m(c(i,".gitignore"),`node_modules/
|
|
29
|
+
dist/
|
|
30
|
+
.env
|
|
31
|
+
.DS_Store
|
|
32
|
+
`),a.success("Created .gitignore"),0},"executeLibrary"),at=S((e,t)=>{switch(e.type){case"builtin:app":return Xe(e,t);case"builtin:library":return it(e,t);default:throw new Error(`Unknown built-in template type: ${e.type}`)}},"executeBuiltin");var nt=Object.defineProperty,R=g((e,t)=>nt(e,"name",{value:t,configurable:!0}),"n$1");const ot=R((e,t)=>`${JSON.stringify({bin:{[e]:"./bin/index.js"},description:t,devDependencies:{typescript:"^5.0.0"},name:e,private:!0,scripts:{build:"tsc",dev:"tsc --watch"},type:"module",version:"0.0.1"},null,4)}
|
|
33
|
+
`,"packageJson"),st=R(e=>`#!/usr/bin/env node
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* ${e} — code generator
|
|
37
|
+
*
|
|
38
|
+
* Usage: npx ${e} [options]
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
console.log("Hello from ${e}!");
|
|
42
|
+
`,"binIndex"),ct=R(()=>`${JSON.stringify({compilerOptions:{declaration:!0,esModuleInterop:!0,module:"Node16",moduleResolution:"Node16",outDir:"./dist",rootDir:"./src",skipLibCheck:!0,strict:!0,target:"ES2022"},include:["src/**/*","bin/**/*"]},null,4)}
|
|
43
|
+
`,"tsconfigJson"),lt=R(()=>`/**
|
|
44
|
+
* Generator core logic — export functions used by the CLI entry point.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
export const generate = (): void => {
|
|
48
|
+
// TODO: Implement your generator logic here
|
|
49
|
+
};
|
|
50
|
+
`,"srcIndex"),pt=R((e,t="")=>{const{projectName:r,targetDir:i}=e;a.info("Scaffolding code generator..."),b(i),b(c(i,"bin")),b(c(i,"src")),m(c(i,"package.json"),ot(r,t||`Code generator: ${r}`)),a.success("Created package.json");const n=c(i,"bin","index.js");return m(n,st(r)),Ce(n,493),a.success("Created bin/index.js (executable)"),m(c(i,"tsconfig.json"),ct()),a.success("Created tsconfig.json"),m(c(i,"src","index.ts"),lt()),a.success("Created src/index.ts"),0},"executeGeneratorTemplate");var ut=Object.defineProperty,P=g((e,t)=>ut(e,"name",{value:t,configurable:!0}),"n");const dt=P(e=>`${JSON.stringify({devDependencies:{"@visulima/vis":"latest"},name:e,packageManager:"pnpm@latest",private:!0,scripts:{build:"vis run build",dev:"vis run dev",lint:"vis run lint",test:"vis run test"},type:"module",version:"0.0.0"},null,4)}
|
|
51
|
+
`,"rootPackageJson"),mt=P(()=>`packages:
|
|
52
|
+
- "apps/*"
|
|
53
|
+
- "packages/*"
|
|
54
|
+
`,"pnpmWorkspaceYaml"),gt=P(()=>`# Dependencies
|
|
55
|
+
node_modules/
|
|
56
|
+
|
|
57
|
+
# Build output
|
|
58
|
+
dist/
|
|
59
|
+
.output/
|
|
60
|
+
|
|
61
|
+
# Environment
|
|
62
|
+
.env
|
|
63
|
+
.env.local
|
|
64
|
+
.env.*.local
|
|
65
|
+
|
|
66
|
+
# IDE
|
|
67
|
+
.vscode/*
|
|
68
|
+
!.vscode/settings.json
|
|
69
|
+
!.vscode/extensions.json
|
|
70
|
+
.idea/
|
|
71
|
+
|
|
72
|
+
# OS
|
|
73
|
+
.DS_Store
|
|
74
|
+
Thumbs.db
|
|
75
|
+
|
|
76
|
+
# Logs
|
|
77
|
+
*.log
|
|
78
|
+
npm-debug.log*
|
|
79
|
+
pnpm-debug.log*
|
|
80
|
+
|
|
81
|
+
# Cache
|
|
82
|
+
.turbo/
|
|
83
|
+
.cache/
|
|
84
|
+
`,"gitignore"),ht=P(()=>`root = true
|
|
85
|
+
|
|
86
|
+
[*]
|
|
87
|
+
indent_style = space
|
|
88
|
+
indent_size = 4
|
|
89
|
+
end_of_line = lf
|
|
90
|
+
charset = utf-8
|
|
91
|
+
trim_trailing_whitespace = true
|
|
92
|
+
insert_final_newline = true
|
|
93
|
+
|
|
94
|
+
[*.{yml,yaml}]
|
|
95
|
+
indent_size = 2
|
|
96
|
+
|
|
97
|
+
[*.md]
|
|
98
|
+
trim_trailing_whitespace = false
|
|
99
|
+
`,"editorconfig"),ft=P(e=>`# ${e}
|
|
100
|
+
|
|
101
|
+
A monorepo powered by [vis](https://visulima.com/packages/vis).
|
|
102
|
+
|
|
103
|
+
## Getting Started
|
|
104
|
+
|
|
105
|
+
\`\`\`bash
|
|
106
|
+
# Install dependencies
|
|
107
|
+
pnpm install
|
|
108
|
+
|
|
109
|
+
# Run all apps in development mode
|
|
110
|
+
pnpm dev
|
|
111
|
+
|
|
112
|
+
# Build all packages
|
|
113
|
+
pnpm build
|
|
114
|
+
|
|
115
|
+
# Run tests
|
|
116
|
+
pnpm test
|
|
117
|
+
\`\`\`
|
|
118
|
+
|
|
119
|
+
## Structure
|
|
120
|
+
|
|
121
|
+
\`\`\`
|
|
122
|
+
├── apps/ # Applications
|
|
123
|
+
├── packages/ # Shared packages & libraries
|
|
124
|
+
├── pnpm-workspace.yaml
|
|
125
|
+
└── package.json
|
|
126
|
+
\`\`\`
|
|
127
|
+
`,"readmeMd"),yt=P(e=>{const{projectName:t,targetDir:r}=e;return a.info("Scaffolding monorepo workspace..."),b(r),b(c(r,"apps")),b(c(r,"packages")),m(c(r,"package.json"),dt(t)),a.success("Created package.json"),m(c(r,"pnpm-workspace.yaml"),mt()),a.success("Created pnpm-workspace.yaml"),m(c(r,".gitignore"),gt()),a.success("Created .gitignore"),m(c(r,".editorconfig"),ht()),a.success("Created .editorconfig"),m(c(r,"README.md"),ft(t)),a.success("Created README.md"),m(c(r,"apps",".gitkeep"),""),m(c(r,"packages",".gitkeep"),""),0},"executeMonorepoTemplate");var vt=Object.defineProperty,H=g((e,t)=>vt(e,"name",{value:t,configurable:!0}),"s");const bt={"create-nuxt":{monoArgs:["--no-gitInit"]},"create-vite":{args:["--no-immediate"]},sv:{args:["--no-install"],prependCommand:"create"}},wt=H((e,t,r)=>{const i=bt[e];if(!i)return t;const n=[...t];if(i.prependCommand&&!n.includes(i.prependCommand)&&n.unshift(i.prependCommand),i.args)for(const u of i.args)n.includes(u)||n.push(u);if(r&&i.monoArgs)for(const u of i.monoArgs)n.includes(u)||n.push(u);return n},"applyAutoFixes"),kt=H((e,t)=>{const r=W(t.cwd,t.targetDir)||".",i=[...e.args];i.includes(r)||i.unshift(r);const n=wt(e.source,i,t.inMonorepo);return a.info(`Running ${e.source} via ${t.pm.name} dlx...`),ce(t.pm,{additionalPackages:[],args:n,package:e.source,shellMode:!1,silent:!1},t.cwd,t.logger)},"executeRemoteNpm"),xt=H(async(e,t)=>{const{createConfig:r}=t;a.info(`Downloading template from ${e.source}...`);try{const i=await Se(e.source,{auth:r?.auth||process.env.GIGET_AUTH||process.env.GITHUB_TOKEN||process.env.GH_TOKEN||void 0,dir:t.targetDir,force:!0,preferOffline:r?.preferOffline,provider:r?.defaultProvider,registry:r?.registry});return a.info(`Downloaded to ${i.dir}`),0}catch(i){const n=i instanceof Error?i.message:String(i);return a.warn(`Failed to download template: ${n}`),1}},"executeRemoteGit");var $t=Object.defineProperty,_t=g((e,t)=>$t(e,"name",{value:t,configurable:!0}),"r");const jt=_t(async(e,t)=>{switch(e.type){case"builtin:app":case"builtin:library":return at(e,t);case"builtin:generator":return pt(t);case"builtin:monorepo":return yt(t);case"remote:git":return xt(e,t);case"remote:npm":return kt(e,t);default:throw new Error(`Unknown template type: ${e.type}`)}},"executeTemplate");var Ct=Object.defineProperty,j=g((e,t)=>Ct(e,"name",{value:t,configurable:!0}),"g");const St=j(e=>{const t=c(e,".vscode");b(t);const r=c(t,"settings.json"),i={"editor.defaultFormatter":"oxc.oxc-vscode","editor.formatOnSave":!0};if(O(r))try{const p=ie(r);m(r,`${JSON.stringify({...i,...p},null,4)}
|
|
128
|
+
`),a.success("Merged .vscode/settings.json")}catch{a.warn("Could not merge .vscode/settings.json, skipping")}else m(r,`${JSON.stringify(i,null,4)}
|
|
129
|
+
`),a.success("Created .vscode/settings.json");const n=c(t,"extensions.json"),u={recommendations:["oxc.oxc-vscode"]};if(O(n))try{const p=ie(n);m(n,`${JSON.stringify({...p,recommendations:[...new Set([...p.recommendations||[],...u.recommendations])]},null,4)}
|
|
130
|
+
`),a.success("Merged .vscode/extensions.json")}catch{a.warn("Could not merge .vscode/extensions.json, skipping")}else m(n,`${JSON.stringify(u,null,4)}
|
|
131
|
+
`),a.success("Created .vscode/extensions.json")},"generateVscodeConfig"),Ot=j((e,t)=>{const r=c(e,".ai");b(r);const i=c(r,"instructions");if(O(i))return;const n=`# Project Instructions
|
|
132
|
+
|
|
133
|
+
This project was scaffolded with vis create.
|
|
134
|
+
|
|
135
|
+
## Development
|
|
136
|
+
|
|
137
|
+
- Package manager: ${t}
|
|
138
|
+
- Build: \`${t} run build\`
|
|
139
|
+
- Test: \`${t} run test\`
|
|
140
|
+
- Lint: \`${t} run lint\`
|
|
141
|
+
|
|
142
|
+
## Conventions
|
|
143
|
+
|
|
144
|
+
- Use TypeScript strict mode
|
|
145
|
+
- ESM modules (\`"type": "module"\`)
|
|
146
|
+
- Follow Angular-style conventional commits
|
|
147
|
+
`;m(i,n),a.success("Created .ai/instructions")},"generateAiInstructions"),Pt=j(e=>{ye("git",["init"],{cwd:e,stdio:"pipe"}).status===0?a.success("Initialized git repository"):a.warn("Failed to initialize git repository")},"initGitRepo"),Nt=j((e,t,r,i=!1)=>(a.info("Installing dependencies..."),be(t,{dev:!1,filter:[],force:!1,frozenLockfile:!1,ignoreScripts:!1,lockfileOnly:!1,noOptional:!1,offline:i,prod:!1,recursive:!1,silent:!1,workspaceRoot:!1},e,r)===0?(a.success("Dependencies installed"),!0):(a.warn("Dependency installation failed (you can run install manually)"),!1)),"installDependencies"),qt=j(e=>{const t=e.split("#")[0].split("?")[0].replace(/\/+$/,"").replace(/\.git$/,"").split("/").filter(Boolean).at(-1)??"",r=t.includes(":")?t.split(":").pop()??t:t;return T(r)||"my-project"},"extractRepoName"),Dt=j(e=>{if(a.info(""),a.info(" Built-in templates:"),a.info(` ${k(x("vis:monorepo"))} ${d("Full pnpm workspace setup")}`),a.info(` ${k(x("vis:app"))} ${d("Application scaffold via create-vite")}`),a.info(` ${k(x("vis:library"))} ${d("Reusable TypeScript library package")}`),a.info(` ${k(x("vis:generator"))} ${d("Code generator scaffold with bin entry")}`),e&&Object.keys(e).length>0){a.info(""),a.info(" Config aliases (vis.config.ts → create.templates):");for(const[t,r]of Object.entries(e))a.info(` ${k(x(t))}${" ".repeat(Math.max(1,16-t.length))}${d(r)}`)}a.info(""),a.info(" Remote templates:"),a.info(` ${d("Any npm create-* package:")} vis create vite`),a.info(` ${d("GitHub repository:")} vis create user/repo`),a.info(` ${d("GitLab / Bitbucket:")} vis create gitlab:user/repo`),a.info(` ${d("Full URL:")} vis create https://github.com/user/repo`),a.info(""),a.info(` ${d("Template args after --:")} vis create vite -- --template react-ts`),a.info("")},"listTemplates"),Et=j((e,t,r,i)=>{const n=_(t)===_(e)?"":e;process.stderr.write(`
|
|
148
|
+
`),a.success("Project created successfully!"),process.stderr.write(`
|
|
149
|
+
`),a.notice("Next steps:"),n&&a.info(` cd ${n}`),i||a.info(` ${r} install`),a.info(` ${r} run dev`),process.stderr.write(`
|
|
150
|
+
`)},"printNextSteps"),Lt=j(async({argument:e,logger:t,options:r,rawUnknown:i,visConfig:n,workspaceRoot:u})=>{const p=Array.isArray(e)?e:e?[e]:[],o=n?.create;if(r.list){Dt(o?.templates);return}const l=r.cwd||u||process.cwd(),s=!!u,w=!!process.stdin.isTTY,$=we(l);let y,h,f,N=o?.defaultEditor,M=o?.gitInit??!1,Y=[],q=$,K=!1;if(p.length===0&&w&&r.interactive!==!1){const v=await Ke({cwd:l,defaultEditor:o?.defaultEditor,defaultGitInit:o?.gitInit,defaultPm:o?.defaultPm,inMonorepo:s});y=v.template,h=v.projectName,f=_(l,v.targetDir),N=v.editor??N,M=v.gitInit,K=v.overwrite,v.pm&&(q={name:v.pm,version:$.version})}else{if(p.length===0)throw new Error(`No template specified. Usage: vis create <template> [name] [-- args...]
|
|
151
|
+
Use --list to see available templates, or run interactively in a terminal.`);{let v=[...i??[]];if(v.length===0){const te=process.argv.slice(2),re=te.indexOf("--");re!==-1&&(v=te.slice(re+1))}const C=p.indexOf("--"),me=C===-1?p:p.slice(0,C);Y=[...C===-1?[]:p.slice(C+1),...v],[y,h]=me,!h&&y&&(h=qt(y)),N=r.editor==="vscode"?"vscode":N,M=!!r.gitInit||M}}if(!y)throw new Error("No template specified.");const z=o?.templates?.[y]??y,Q=Te(z,Y);if(!f){const v=s?Ie(Q.type):".",C=We(h??"",_(l,v));f=C.targetDir,h=C.packageName}const X=T(h??"");if(!pe(X))throw new Error(`Invalid project name: "${h}". Use lowercase alphanumeric characters and hyphens.`);h=X;const de=_(f),G=W(_(l),de);if(G===".."||G.startsWith(`..${xe}`)||$e(G))throw new Error(`Target directory "${f}" is outside the working directory. Use a name without "../" path segments.`);if(!K&&!He(f))throw new Error(`Target directory "${f}" is not empty.
|
|
152
|
+
Use a different name or clear the directory first.`);z!==y&&a.info(`Alias: ${k(x(y))} → ${d(z)}`),a.info(`Template: ${k(x(z))}`),a.info(`Project: ${k(h)}`),a.info(`Target: ${d(f)}`),process.stderr.write(`
|
|
153
|
+
`);const Z=await jt(Q,{createConfig:o,cwd:l,inMonorepo:s,logger:t,pm:q,projectName:h,targetDir:f});if(Z!==0){process.exitCode=Z;return}N==="vscode"&&St(f),O(f)&&Ot(f,q.name),M&&!s&&Pt(f);let ee=!1;o?.install!==!1&&O(c(f,"package.json"))&&(ee=Nt(f,q,t,o?.preferOffline)),Et(f,l,q.name,ee)},"execute");export{Lt as default};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var he=Object.defineProperty;var D=(e,s)=>he(e,"name",{value:s,configurable:!0});import{createRequire as ke}from"node:module";import{h as re,k as ee,ad as E,aS as Pe,aR as L,ay as G,aU as ve,S as te,b9 as oe,I as w,j as v,E as u,q as R,e as x,a as b,aj as we,R as De,ba as be,bb as xe,bc as Ne,bd as Je}from"./bin.js";import{M as j,i as I,n as W,$ as Te,B as Se,w as C,C as K,z as P}from"./config.js";import{o as ie}from"../packem_shared/index-DH-5hsrC.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:pe,writeFileSync:se}=$e("node:fs");var Re=Object.defineProperty,O=D((e,s)=>Re(e,"name",{value:s,configurable:!0}),"r$3");const je=O(e=>/[*?[\]{}!]/.test(e),"isGlob"),We=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=>ie(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(je(t)&&ie(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:We(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=j(e,"pnpm-workspace.yaml"),t=I(o)?pe(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 se(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 se(o,m.endsWith(r)?m:`${m}${r}`),o},"applyCatalogProposals"),ze=_((e,s)=>{if(s.length===0)return"";const o=j(e,"pnpm-workspace.yaml"),t=I(o)?pe(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=re(e);if(o){const r=j(e,"pnpm-workspace.yaml");for(const n of o)n.startsWith("!")||ee(e,[n]).length===0&&s.push({pattern:n,source:"pnpm-workspace.yaml",sourcePath:r})}const t=j(e,"package.json");if(I(t)){const r=W(t).workspaces,n=Array.isArray(r)?r:r?.packages;if(n)for(const a of n)typeof a!="string"||a.startsWith("!")||ee(e,[a]).length===0&&s.push({pattern:a,source:"package.json",sourcePath:t})}return s},"lintDeadWorkspacePatterns"),Ue=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=Te(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
|
+
`);Se(n,f,{overwrite:!0}),r.push(n);continue}const p=W(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))),C(n,p,{indent:E(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},"applyDeadWorkspacePatternFixes");var qe=Object.defineProperty,fe=D((e,s)=>qe(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=Pe(e),r=[];for(const n of t){const a=j(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"),Qe=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=W(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)}C(n,i,{indent:E(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},"applyEmptyDepsFixes");var Xe=Object.defineProperty,le=D((e,s)=>Xe(e,"name",{value:s,configurable:!0}),"o");const Ye=/\/+$/,Q=/node_modules/,X=/\.git/,Ze=/[$()+.?[\\\]^{|}]/g,et=/\/\*\*$|\/\*\/\*$/,tt=le((e,s)=>{const o=s.replace(Ye,"");if(o.startsWith("!"))return[];const t=[];if(o.endsWith("/*")){const n=o.slice(0,-2),a=K(e,n);if(!I(a))return[];for(const i of G(a,{includeFiles:!1,includeSymlinks:!1,maxDepth:1,skip:[Q,X]}))i.path===a||i.name.startsWith(".")||t.push(j(n,i.name));return t}if(o.endsWith("/**")||o.endsWith("/*/*")){const n=o.replace(et,""),a=K(e,n);if(!I(a))return[];for(const i of G(a,{includeFiles:!1,includeSymlinks:!1,skip:[Q,X]})){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(Ze,String.raw`\$&`).replaceAll("*",".*"),a=new RegExp(`^${n}$`);for(const i of G(e,{includeFiles:!1,includeSymlinks:!1,maxDepth:1,skip:[Q,X]}))i.path!==e&&a.test(i.name)&&t.push(i.name);return t}const r=K(e,o);return I(r)&&t.push(o),t},"collectPatternMatches"),ot=le(e=>{const s=re(e)??ve(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(j(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=j(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=W(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"),C(r.packageJsonPath,n,{indent:E(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=j(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=W(r.packageJsonPath);n.packageManager=r.suggested,C(r.packageJsonPath,n,{indent:E(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=j(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=W(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}C(r.packageJsonPath,a,{indent:E(r.packageJsonPath,{useEditorconfig:o}),overwrite:!0}),t.push(r.packageJsonPath)}return t},"applyRootPrivateFixes");var kt=Object.defineProperty,Z=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=Z((e,s)=>{for(const o of e)if(o.members?.includes(s)||o.prefixes?.some(t=>s.startsWith(t)))return o},"familyForDep"),vt=Z(e=>e.startsWith("workspace:")||e.startsWith("catalog:"),"isWorkspaceOrCatalogReference"),wt=Z((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=W(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=W(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"),C(n,i,{indent:E(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},"applyTypesInDepsFixes");var Jt=Object.defineProperty,U=D((e,s)=>Jt(e,"name",{value:s,configurable:!0}),"f");const Tt=U(e=>e.startsWith("workspace:"),"isWorkspaceSpecifier"),St=U((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=U((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"),jt=U((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=W(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)}C(n,i,{indent:E(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},"applyWorkspaceProtocolFixes");var Wt=Object.defineProperty,V=D((e,s)=>Wt(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=te(r.specifier);if(!n)continue;if(!t){t=r;continue}const a=te(t.specifier);if(!a){t=r;continue}const i=oe(a,n),p=oe(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=W(n);for(const p of a){const c=i[p.depType];typeof c=="object"&&c!==null&&(c[p.depName]=p.fix)}C(n,i,{indent:E(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}),"u");const zt=y(e=>{if(I(j(e,"pnpm-workspace.yaml")))return!0;const s=j(e,"package.json");if(!I(s))return!1;try{return W(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"),Ut=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"),qt=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"),Qt=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"),Xt=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"),Yt=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"),Zt=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(()=>{Ut(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(()=>{qt(e.bannedDeps??[],s,r)}),t.emptyDeps&&a(()=>{Qt(e.emptyDeps??[],s,o.emptyDeps,r)}),t.rootPrivate&&a(()=>{Xt(e.rootPrivate??[],s,o.rootPrivate,r)}),t.rootPackageManager&&a(()=>{Yt(e.rootPackageManager??[],s,o.rootPackageManager,r)}),t.rootDeps&&a(()=>{Zt(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"},Y=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"),yo=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=we(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&&(jt(l,{useEditorconfig:f}),$.workspaceProtocol=!0),h.workspaceProtocol=l,k||(N+=l.length),n&&!k&&l.length>0&&!i&&Y(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"?De(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&&Y(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=be(l);if(k.length>0){for(const me of k)e.error(`policy.customTypes.${me}`);process.exitCode=1;return}const J=xe(r,l),H=(s.resolve??c.customTypes?.resolve)==="lowest"?"lowest":"highest",M=Ne(J,{dep:s.dep,ignoreDeps:c.customTypes?.ignore,resolve:H}),q=F(n,c.customTypes?.autofix);q&&M.length>0&&(Je(M,{useEditorconfig:f}),$.customTypes=!0),h.customTypes=M,q||(N+=M.length),n&&!q&&M.length>0&&!i&&Y(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&&(Qe(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&&(Ue(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{yo as default};
|