@visulima/vis 1.0.0-alpha.26 → 1.0.0-alpha.28

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.
Files changed (116) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/LICENSE.md +3213 -95
  3. package/README.md +24 -22
  4. package/dist/bin.js +1 -1
  5. package/dist/binx.js +1 -1
  6. package/dist/config/index.d.ts +176 -16
  7. package/dist/packem_chunks/bin.js +468 -364
  8. package/dist/packem_chunks/bloom-status.js +1 -1
  9. package/dist/packem_chunks/bloom-sync.js +1 -1
  10. package/dist/packem_chunks/config.js +15 -15
  11. package/dist/packem_chunks/devtools.js +82 -0
  12. package/dist/packem_chunks/doctor-probe.js +1 -1
  13. package/dist/packem_chunks/fix.js +1 -1
  14. package/dist/packem_chunks/handler10.js +1 -1
  15. package/dist/packem_chunks/handler11.js +1 -1
  16. package/dist/packem_chunks/handler12.js +1 -1
  17. package/dist/packem_chunks/handler13.js +1 -1
  18. package/dist/packem_chunks/handler14.js +8 -9
  19. package/dist/packem_chunks/handler15.js +1 -1
  20. package/dist/packem_chunks/handler16.js +1 -1
  21. package/dist/packem_chunks/handler17.js +1 -1
  22. package/dist/packem_chunks/handler18.js +1 -1
  23. package/dist/packem_chunks/handler19.js +1 -1
  24. package/dist/packem_chunks/handler2.js +1 -1
  25. package/dist/packem_chunks/handler20.js +1 -1
  26. package/dist/packem_chunks/handler21.js +3 -3
  27. package/dist/packem_chunks/handler22.js +1 -1
  28. package/dist/packem_chunks/handler23.js +2 -2
  29. package/dist/packem_chunks/handler24.js +1 -1
  30. package/dist/packem_chunks/handler26.js +1 -1
  31. package/dist/packem_chunks/handler27.js +1 -1
  32. package/dist/packem_chunks/handler28.js +1 -1
  33. package/dist/packem_chunks/handler29.js +1 -1
  34. package/dist/packem_chunks/handler3.js +1 -1
  35. package/dist/packem_chunks/handler30.js +6 -6
  36. package/dist/packem_chunks/handler31.js +1 -1
  37. package/dist/packem_chunks/handler33.js +1 -1
  38. package/dist/packem_chunks/handler34.js +4 -4
  39. package/dist/packem_chunks/handler35.js +3 -22
  40. package/dist/packem_chunks/handler36.js +21 -60
  41. package/dist/packem_chunks/handler37.js +61 -6
  42. package/dist/packem_chunks/handler38.js +3 -24
  43. package/dist/packem_chunks/handler39.js +6 -153
  44. package/dist/packem_chunks/handler4.js +5 -5
  45. package/dist/packem_chunks/handler40.js +24 -10
  46. package/dist/packem_chunks/handler41.js +153 -25
  47. package/dist/packem_chunks/handler42.js +25 -708
  48. package/dist/packem_chunks/handler43.js +10 -24
  49. package/dist/packem_chunks/handler44.js +659 -273
  50. package/dist/packem_chunks/handler45.js +24 -46
  51. package/dist/packem_chunks/handler46.js +322 -3
  52. package/dist/packem_chunks/handler47.js +48 -27
  53. package/dist/packem_chunks/handler48.js +3 -187
  54. package/dist/packem_chunks/handler49.js +23 -30
  55. package/dist/packem_chunks/handler5.js +7 -7
  56. package/dist/packem_chunks/handler50.js +195 -0
  57. package/dist/packem_chunks/handler51.js +34 -0
  58. package/dist/packem_chunks/handler8.js +1 -1
  59. package/dist/packem_chunks/handler9.js +1 -1
  60. package/dist/packem_chunks/heal-accept.js +1 -1
  61. package/dist/packem_chunks/heal.js +1 -1
  62. package/dist/packem_chunks/help-command.js +7 -17
  63. package/dist/packem_chunks/index.js +3 -3
  64. package/dist/packem_chunks/keys-refresh.js +1 -1
  65. package/dist/packem_chunks/list.js +2 -2
  66. package/dist/packem_chunks/loader.js +1 -1
  67. package/dist/packem_chunks/prune.js +1 -1
  68. package/dist/packem_chunks/run.js +1 -1
  69. package/dist/packem_chunks/status.js +1 -1
  70. package/dist/packem_chunks/sync.js +1 -1
  71. package/dist/packem_chunks/sync2.js +1 -1
  72. package/dist/packem_chunks/tripwire.js +1 -1
  73. package/dist/packem_chunks/verify-lockfile.js +1 -1
  74. package/dist/packem_shared/Table-CwC2kW07-EjFLNV0q.js +12 -0
  75. package/dist/packem_shared/_commonjsHelpers-CLblCigl.js +1 -0
  76. package/dist/packem_shared/{advisories-DS8JEB_g.js → advisories-BxXiKFbL.js} +1 -1
  77. package/dist/packem_shared/{ai-analysis-Csn82p17.js → ai-analysis-BnmDFqc8.js} +5 -5
  78. package/dist/packem_shared/{ai-fix-BlYyz5bI.js → ai-fix-BGbnrWCz.js} +7 -7
  79. package/dist/packem_shared/{cyclonedx-ja1cbU69.js → cyclonedx-C2k2HmvI.js} +1 -1
  80. package/dist/packem_shared/{dependency-scan-s2MD0vi-.js → dependency-scan-Bki15Yi-.js} +1 -1
  81. package/dist/packem_shared/{docker-Bw9gKo69.js → docker-k-Sl8b-w.js} +1 -1
  82. package/dist/packem_shared/{failure-log-B0Uh-65U.js → failure-log-C3bG1bCA.js} +1 -1
  83. package/dist/packem_shared/index-2r730kXY.js +29 -0
  84. package/dist/packem_shared/{index-88UK-tt_.js → index-DBq4TVu5.js} +1 -1
  85. package/dist/packem_shared/{lifecycle-ChCFTm5Q.js → lifecycle-B91p_ra8.js} +2 -2
  86. package/dist/packem_shared/{lockfile-BG1HvBzH.js → lockfile-DmDfgKaT.js} +1 -1
  87. package/dist/packem_shared/{min-release-age-heJgeP7o.js → min-release-age-B1Jm1_JY.js} +1 -1
  88. package/dist/packem_shared/{native-config-sync-BOeuyrBj.js → native-config-sync-Cnpj2xcn.js} +6 -6
  89. package/dist/packem_shared/{osv-bloom-QSAn2Dcw.js → osv-bloom-ep8GlDGT.js} +2 -2
  90. package/dist/packem_shared/pm-runner-COoPLGKi.js +1 -0
  91. package/dist/packem_shared/{provenance-BsBn1f5S.js → provenance-DbkJRDqt.js} +1 -1
  92. package/dist/packem_shared/{registry-keys-pemEkRM9.js → registry-keys-SylX07bs.js} +1 -1
  93. package/dist/packem_shared/{resolve-explicit-CBPr617N.js → resolve-explicit-CJ_5wYSu.js} +1 -1
  94. package/dist/packem_shared/s1ngularity-DlS-4a6K.js +1 -0
  95. package/dist/packem_shared/scan-progress-CU4ttEHQ.js +2 -0
  96. package/dist/packem_shared/{signatures-CaXzNuEn.js → signatures-B-1u4t-c.js} +1 -1
  97. package/dist/packem_shared/spinner-B9ZPv1iT.js +1 -0
  98. package/dist/packem_shared/spinners-f91Rbo99-Bjf3NcO0.js +1 -0
  99. package/dist/packem_shared/tabs-C-qFIoUv.js +1 -0
  100. package/dist/packem_shared/typosquats-BxCOUvTJ.js +1 -0
  101. package/dist/packem_shared/use-measured-height-kIDCuc76.js +1 -0
  102. package/dist/packem_shared/vis-update-app-COYmjGKv.js +1 -0
  103. package/dist/packem_shared/watch-BSVsZ_1I.js +1 -0
  104. package/dist/packem_shared/watch-loop-CP318TfG.js +11 -0
  105. package/index.js +751 -567
  106. package/package.json +11 -11
  107. package/schemas/project.schema.json +86 -1
  108. package/schemas/vis-config.schema.json +255 -7
  109. package/dist/packem_shared/index-CS6a2wFB.js +0 -29
  110. package/dist/packem_shared/index.server-B7ETiT4C.js +0 -2
  111. package/dist/packem_shared/pm-runner-BzGZmzYs.js +0 -1
  112. package/dist/packem_shared/s1ngularity-j_ArCZAs.js +0 -1
  113. package/dist/packem_shared/scan-progress-EbvmIh4i.js +0 -2
  114. package/dist/packem_shared/typosquats-C1e6RNjF.js +0 -1
  115. package/dist/packem_shared/use-measured-height-DjYgUOKk.js +0 -1
  116. package/dist/packem_shared/vis-update-app-qhQPV97i.js +0 -1
@@ -1,5 +1,5 @@
1
- var H=Object.defineProperty;var k=(e,r)=>H(e,"name",{value:r,configurable:!0});import{createRequire as B}from"node:module";import{renderToString as z}from"@visulima/tui";import{Box as U}from"@visulima/tui/components/box";import{Table as W}from"@visulima/tui/components/table";import{Text as y}from"@visulima/tui/components/text";import v from"react";import{a8 as K,a9 as G,aa as Y,ab as X}from"../packem_chunks/bin.js";const F=B(import.meta.url),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=k(e=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[r,a]=w.versions.node.split(".").map(Number);if(r>22||r===22&&a>=3||r===20&&a>=16)return w.getBuiltinModule(e)}return F(e)},"__cjs_getBuiltinModule"),{spawn:D,execFileSync:O}=$("node:child_process"),{existsSync:C}=$("node:fs"),{platform:J,homedir:R}=$("node:os"),{join:g}=$("node:path"),Q=/v?(\d+\.\d+\.\d+(?:-[\w.]+)?)/,Z=5e3,ee=1e4,re=3e5,te=4096,E=J()==="win32",M=["amp","claude","codex","copilot","crush","cursor","droid","gemini","kimi","opencode","qwen"];var ae=Object.defineProperty,ne=k((e,r)=>ae(e,"name",{value:r,configurable:!0}),"A$1"),ie=Object.defineProperty,m=ne((e,r)=>ie(e,"name",{value:r,configurable:!0}),"o"),oe=Object.defineProperty,se=m((e,r)=>oe(e,"name",{value:r,configurable:!0}),"a$6");const ce={alternateCommands:[],buildArgs:se((e,r,a)=>["-x",e,"--dangerously-allow-all"],"buildArgs"),command:"amp",defaultModel:"",envVariable:"AMP_PATH"};var le=Object.defineProperty,ue=m((e,r)=>le(e,"name",{value:r,configurable:!0}),"t$8");const de={alternateCommands:[],buildArgs:ue((e,r,a)=>["--dangerously-skip-permissions","--model",r,"--output-format","text","-p",e],"buildArgs"),command:"claude",defaultModel:"claude-sonnet-4-20250514",envVariable:"CLAUDE_PATH"};var me=Object.defineProperty,pe=m((e,r)=>me(e,"name",{value:r,configurable:!0}),"a$4");const ge={alternateCommands:["openai-codex"],buildArgs:pe((e,r,a)=>[e,"--approval-mode","full-auto","--quiet","--model",r,"--max-tokens",String(a)],"buildArgs"),command:"codex",defaultModel:"o3",envVariable:"CODEX_PATH"};var fe=Object.defineProperty,he=m((e,r)=>fe(e,"name",{value:r,configurable:!0}),"l");const ve={alternateCommands:[],buildArgs:he((e,r,a)=>{const t=["-p",e,"--allow-all-tools"];return r&&t.push("--model",r),t},"buildArgs"),command:"copilot",defaultModel:"",envVariable:"COPILOT_PATH"};var ye=Object.defineProperty,be=m((e,r)=>ye(e,"name",{value:r,configurable:!0}),"n$2");const ke={alternateCommands:[],buildArgs:be((e,r,a)=>{const t=["run","--yolo"];return r&&t.push("-m",r),t.push(e),t},"buildArgs"),command:"crush",defaultModel:"",envVariable:"CRUSH_PATH"};var we=Object.defineProperty,Ae=m((e,r)=>we(e,"name",{value:r,configurable:!0}),"t$5");const $e={alternateCommands:["cursor"],buildArgs:Ae((e,r,a)=>{const t=["-p","--force","--output-format","text"];return r&&t.push("--model",r),t.push(e),t},"buildArgs"),command:"agent",defaultModel:"",envVariable:"CURSOR_PATH"};var Se=Object.defineProperty,Pe=m((e,r)=>Se(e,"name",{value:r,configurable:!0}),"i");const Ce={alternateCommands:[],buildArgs:Pe((e,r,a)=>{const t=[e,"--skip-permissions-unsafe","-o","text"];return r&&t.push("-m",r),t},"buildArgs"),command:"droid",defaultModel:"",envVariable:"DROID_PATH"};var Te=Object.defineProperty,je=m((e,r)=>Te(e,"name",{value:r,configurable:!0}),"o$1");const Oe={alternateCommands:["gemini-cli"],buildArgs:je((e,r,a)=>["--sandbox","--model",r,"--max-output-tokens",String(a),"-p",e],"buildArgs"),command:"gemini",defaultModel:"gemini-2.5-pro",envVariable:"GEMINI_PATH"};var Re=Object.defineProperty,Ee=m((e,r)=>Re(e,"name",{value:r,configurable:!0}),"o");const Me={alternateCommands:[],buildArgs:Ee((e,r,a)=>{const t=["--quiet","-p",e];return r&&t.push("-m",r),t},"buildArgs"),command:"kimi",defaultModel:"",envVariable:"KIMI_PATH"};var xe=Object.defineProperty,_e=m((e,r)=>xe(e,"name",{value:r,configurable:!0}),"r");const Ie={alternateCommands:[],buildArgs:_e((e,r,a)=>{const t=["run",e];return r&&t.push("-m",r),t},"buildArgs"),command:"opencode",defaultModel:"anthropic/claude-sonnet-4",envVariable:"OPENCODE_PATH"};var Ne=Object.defineProperty,Le=m((e,r)=>Ne(e,"name",{value:r,configurable:!0}),"n");const qe={alternateCommands:["qwen-code"],buildArgs:Le((e,r,a)=>["-p",e,"--yolo","-o","text"],"buildArgs"),command:"qwen",defaultModel:"",envVariable:"QWEN_PATH"};var Ve=Object.defineProperty,f=m((e,r)=>Ve(e,"name",{value:r,configurable:!0}),"s");const x={amp:ce,claude:de,codex:ge,copilot:ve,crush:ke,cursor:$e,droid:Ce,gemini:Oe,kimi:Me,opencode:Ie,qwen:qe},T=f(e=>e.startsWith("~")?g(R(),e.slice(1)):e,"resolveHome"),He=f(e=>{try{const r=O(E?"where":"which",[e],{encoding:"utf8",stdio:["pipe","pipe","pipe"],timeout:Z}).trim().split(`
2
- `)[0]?.trim();return r&&r.length>0?r:void 0}catch{return}},"whichCommand"),Be=f(e=>{const r=R();if(E){const a=process.env.APPDATA??"",t=process.env.LOCALAPPDATA??"",n=process.env.ProgramFiles??"";return[g(a,"npm",`${e}.cmd`),g(a,"npm",e),g(t,"Programs",e,`${e}.exe`),g(n,e,`${e}.exe`),g(r,".npm-global","bin",`${e}.cmd`)]}return[`/opt/homebrew/bin/${e}`,`/usr/local/bin/${e}`,g(r,".npm-global","bin",e),g(r,".local","bin",e),g(r,".cargo","bin",e)]},"getKnownPaths"),S=f(e=>{try{const r=O(e,["--version"],{encoding:"utf8",stdio:["pipe","pipe","pipe"],timeout:ee}),a=Q.exec(r);return a?a[1]:void 0}catch{return}},"detectVersion"),_=f(e=>{const r=x[e],a={available:!1,name:e},t=process.env[r.envVariable];if(t&&C(T(t))){const i=T(t);return{...a,available:!0,detectionMethod:"envvar",path:i,version:S(i)}}const n=[r.command,...r.alternateCommands];for(const i of n){const o=He(i);if(o)return{...a,available:!0,detectionMethod:"which",path:o,version:S(o)}}for(const i of n)for(const o of Be(i))if(C(o))return{...a,available:!0,detectionMethod:"known-path",path:o,version:S(o)};return a},"detectProvider"),Fe=f(()=>M.map(e=>_(e)),"detectAllProviders"),De=f(()=>Fe().filter(e=>e.available),"detectAvailableProviders"),Je=f((e,r,a={})=>{const t=x[e],n=a.model??t.defaultModel,i=a.maxTokens??te;return t.buildArgs(r,n,i)},"buildCliArgs"),ze=f(async(e,r,a={})=>{if(!e.available||!e.path)throw new Error(`AI provider "${e.name}" is not available.`);const t=Je(e.name,r,a),n=a.timeoutMs??re;return new Promise((i,o)=>{const p={env:{...process.env,FORCE_COLOR:"0",NO_COLOR:"1"},stdio:["pipe","pipe","pipe"]},s=D(e.path,t,p);s.stdin.end();let c="",d="",u=!1;const b=setTimeout(()=>{u=!0,s.kill("SIGTERM"),o(new Error(`${e.name} CLI timed out after ${String(n)}ms`))},n);s.stdout.on("data",h=>{c+=h.toString("utf8")}),s.stderr.on("data",h=>{d+=h.toString("utf8")}),s.on("close",h=>{clearTimeout(b),!u&&(h===0?i({provider:e.name,stderr:d,stdout:c}):o(new Error(`${e.name} CLI exited with code ${String(h)}: ${d||c}`)))}),s.on("error",h=>{clearTimeout(b),u||o(new Error(`Failed to spawn ${e.name} CLI: ${h.message}`))})})},"runProvider");var Ue=Object.defineProperty,I=k((e,r)=>Ue(e,"name",{value:r,configurable:!0}),"i");const We=12e4,Ke=2,Ge=1e3,Ye=I(e=>new Promise(r=>{setTimeout(r,e)}),"sleep"),N=I(async(e,r,a=Ke)=>{let t;for(let n=0;n<=a;n+=1)try{return(await ze(e,r,{timeoutMs:We})).stdout}catch(i){if(t=i instanceof Error?i:new Error(String(i)),t.message.includes("timed out"))throw t;if(n<a){const o=Ge*2**n;await Ye(o)}}throw t??new Error("AI request failed after retries")},"runWithRetry");var Xe=Object.defineProperty,l=k((e,r)=>Xe(e,"name",{value:r,configurable:!0}),"c");const Qe={amp:30,claude:80,codex:60,copilot:50,crush:35,cursor:40,droid:20,gemini:100,kimi:25,opencode:35,qwen:30},Ze=l(e=>{if(e?.provider){if(!M.includes(e.provider))return;const t=_(e.provider);return t.available?t:void 0}const r=De();if(r.length===0)return;const a={...Qe,...e?.priority};return r.toSorted((t,n)=>(a[n.name]??0)-(a[t.name]??0))[0]},"resolveProvider"),er=new Set(["defer","review","skip","update"]),rr=new Set(["critical","high","low","medium"]),tr=new Set(["high","low","medium"]),ar=50,P=30,nr=l(e=>e.map(r=>{const a=r.vulnerabilities&&r.vulnerabilities.length>0?` [VULNERABILITIES: ${r.vulnerabilities.map(n=>`${n.severity} ${n.id}`).join(", ")}]`:"";let t="";if(r.socketReport){const n=Math.round(r.socketReport.score.overall*100),i=[`score:${String(n)}%`];if(r.socketReport.alerts.length>0){const o={};for(const s of r.socketReport.alerts)o[s.severity]=(o[s.severity]??0)+1;const p=Object.entries(o).map(([s,c])=>`${String(c)} ${s}`).join(", ");i.push(`alerts: ${p}`)}i.push(`supply-chain:${String(Math.round(r.socketReport.score.supplyChain*100))}%`),i.push(`quality:${String(Math.round(r.socketReport.score.quality*100))}%`),t=` [SOCKET.DEV: ${i.join(", ")}]`}return`- ${r.packageName}: ${r.currentRange} → ${r.newRange} (${r.updateType})${a}${t}`}).join(`
1
+ var H=Object.defineProperty;var k=(e,r)=>H(e,"name",{value:r,configurable:!0});import{createRequire as F}from"node:module";import{c as z,d as v,a6 as U,n as y,y as W,aj as K,ak as G,al as Y,am as X}from"../packem_chunks/bin.js";const B=F(import.meta.url),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=k(e=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[r,a]=w.versions.node.split(".").map(Number);if(r>22||r===22&&a>=3||r===20&&a>=16)return w.getBuiltinModule(e)}return B(e)},"__cjs_getBuiltinModule"),{spawn:D,execFileSync:O}=$("node:child_process"),{existsSync:C}=$("node:fs"),{platform:J,homedir:R}=$("node:os"),{join:g}=$("node:path"),Q=/v?(\d+\.\d+\.\d+(?:-[\w.]+)?)/,Z=5e3,ee=1e4,re=3e5,te=4096,E=J()==="win32",M=["amp","claude","codex","copilot","crush","cursor","droid","gemini","kimi","opencode","qwen"];var ae=Object.defineProperty,ne=k((e,r)=>ae(e,"name",{value:r,configurable:!0}),"A$1"),ie=Object.defineProperty,m=ne((e,r)=>ie(e,"name",{value:r,configurable:!0}),"o"),oe=Object.defineProperty,se=m((e,r)=>oe(e,"name",{value:r,configurable:!0}),"a$6");const ce={alternateCommands:[],buildArgs:se((e,r,a)=>["-x",e,"--dangerously-allow-all"],"buildArgs"),command:"amp",defaultModel:"",envVariable:"AMP_PATH"};var le=Object.defineProperty,ue=m((e,r)=>le(e,"name",{value:r,configurable:!0}),"t$8");const de={alternateCommands:[],buildArgs:ue((e,r,a)=>["--dangerously-skip-permissions","--model",r,"--output-format","text","-p",e],"buildArgs"),command:"claude",defaultModel:"claude-sonnet-4-20250514",envVariable:"CLAUDE_PATH"};var me=Object.defineProperty,pe=m((e,r)=>me(e,"name",{value:r,configurable:!0}),"a$4");const ge={alternateCommands:["openai-codex"],buildArgs:pe((e,r,a)=>[e,"--approval-mode","full-auto","--quiet","--model",r,"--max-tokens",String(a)],"buildArgs"),command:"codex",defaultModel:"o3",envVariable:"CODEX_PATH"};var fe=Object.defineProperty,he=m((e,r)=>fe(e,"name",{value:r,configurable:!0}),"l");const ve={alternateCommands:[],buildArgs:he((e,r,a)=>{const t=["-p",e,"--allow-all-tools"];return r&&t.push("--model",r),t},"buildArgs"),command:"copilot",defaultModel:"",envVariable:"COPILOT_PATH"};var ye=Object.defineProperty,be=m((e,r)=>ye(e,"name",{value:r,configurable:!0}),"n$2");const ke={alternateCommands:[],buildArgs:be((e,r,a)=>{const t=["run","--yolo"];return r&&t.push("-m",r),t.push(e),t},"buildArgs"),command:"crush",defaultModel:"",envVariable:"CRUSH_PATH"};var we=Object.defineProperty,Ae=m((e,r)=>we(e,"name",{value:r,configurable:!0}),"t$5");const $e={alternateCommands:["cursor"],buildArgs:Ae((e,r,a)=>{const t=["-p","--force","--output-format","text"];return r&&t.push("--model",r),t.push(e),t},"buildArgs"),command:"agent",defaultModel:"",envVariable:"CURSOR_PATH"};var Se=Object.defineProperty,Pe=m((e,r)=>Se(e,"name",{value:r,configurable:!0}),"i");const Ce={alternateCommands:[],buildArgs:Pe((e,r,a)=>{const t=[e,"--skip-permissions-unsafe","-o","text"];return r&&t.push("-m",r),t},"buildArgs"),command:"droid",defaultModel:"",envVariable:"DROID_PATH"};var je=Object.defineProperty,Te=m((e,r)=>je(e,"name",{value:r,configurable:!0}),"o$1");const Oe={alternateCommands:["gemini-cli"],buildArgs:Te((e,r,a)=>["--sandbox","--model",r,"--max-output-tokens",String(a),"-p",e],"buildArgs"),command:"gemini",defaultModel:"gemini-2.5-pro",envVariable:"GEMINI_PATH"};var Re=Object.defineProperty,Ee=m((e,r)=>Re(e,"name",{value:r,configurable:!0}),"o");const Me={alternateCommands:[],buildArgs:Ee((e,r,a)=>{const t=["--quiet","-p",e];return r&&t.push("-m",r),t},"buildArgs"),command:"kimi",defaultModel:"",envVariable:"KIMI_PATH"};var _e=Object.defineProperty,xe=m((e,r)=>_e(e,"name",{value:r,configurable:!0}),"r");const Ie={alternateCommands:[],buildArgs:xe((e,r,a)=>{const t=["run",e];return r&&t.push("-m",r),t},"buildArgs"),command:"opencode",defaultModel:"anthropic/claude-sonnet-4",envVariable:"OPENCODE_PATH"};var Ne=Object.defineProperty,Le=m((e,r)=>Ne(e,"name",{value:r,configurable:!0}),"n");const qe={alternateCommands:["qwen-code"],buildArgs:Le((e,r,a)=>["-p",e,"--yolo","-o","text"],"buildArgs"),command:"qwen",defaultModel:"",envVariable:"QWEN_PATH"};var Ve=Object.defineProperty,f=m((e,r)=>Ve(e,"name",{value:r,configurable:!0}),"s");const _={amp:ce,claude:de,codex:ge,copilot:ve,crush:ke,cursor:$e,droid:Ce,gemini:Oe,kimi:Me,opencode:Ie,qwen:qe},j=f(e=>e.startsWith("~")?g(R(),e.slice(1)):e,"resolveHome"),He=f(e=>{try{const r=O(E?"where":"which",[e],{encoding:"utf8",stdio:["pipe","pipe","pipe"],timeout:Z}).trim().split(`
2
+ `)[0]?.trim();return r&&r.length>0?r:void 0}catch{return}},"whichCommand"),Fe=f(e=>{const r=R();if(E){const a=process.env.APPDATA??"",t=process.env.LOCALAPPDATA??"",n=process.env.ProgramFiles??"";return[g(a,"npm",`${e}.cmd`),g(a,"npm",e),g(t,"Programs",e,`${e}.exe`),g(n,e,`${e}.exe`),g(r,".npm-global","bin",`${e}.cmd`)]}return[`/opt/homebrew/bin/${e}`,`/usr/local/bin/${e}`,g(r,".npm-global","bin",e),g(r,".local","bin",e),g(r,".cargo","bin",e)]},"getKnownPaths"),S=f(e=>{try{const r=O(e,["--version"],{encoding:"utf8",stdio:["pipe","pipe","pipe"],timeout:ee}),a=Q.exec(r);return a?a[1]:void 0}catch{return}},"detectVersion"),x=f(e=>{const r=_[e],a={available:!1,name:e},t=process.env[r.envVariable];if(t&&C(j(t))){const i=j(t);return{...a,available:!0,detectionMethod:"envvar",path:i,version:S(i)}}const n=[r.command,...r.alternateCommands];for(const i of n){const o=He(i);if(o)return{...a,available:!0,detectionMethod:"which",path:o,version:S(o)}}for(const i of n)for(const o of Fe(i))if(C(o))return{...a,available:!0,detectionMethod:"known-path",path:o,version:S(o)};return a},"detectProvider"),Be=f(()=>M.map(e=>x(e)),"detectAllProviders"),De=f(()=>Be().filter(e=>e.available),"detectAvailableProviders"),Je=f((e,r,a={})=>{const t=_[e],n=a.model??t.defaultModel,i=a.maxTokens??te;return t.buildArgs(r,n,i)},"buildCliArgs"),ze=f(async(e,r,a={})=>{if(!e.available||!e.path)throw new Error(`AI provider "${e.name}" is not available.`);const t=Je(e.name,r,a),n=a.timeoutMs??re;return new Promise((i,o)=>{const p={env:{...process.env,FORCE_COLOR:"0",NO_COLOR:"1"},stdio:["pipe","pipe","pipe"]},s=D(e.path,t,p);s.stdin.end();let c="",d="",u=!1;const b=setTimeout(()=>{u=!0,s.kill("SIGTERM"),o(new Error(`${e.name} CLI timed out after ${String(n)}ms`))},n);s.stdout.on("data",h=>{c+=h.toString("utf8")}),s.stderr.on("data",h=>{d+=h.toString("utf8")}),s.on("close",h=>{clearTimeout(b),!u&&(h===0?i({provider:e.name,stderr:d,stdout:c}):o(new Error(`${e.name} CLI exited with code ${String(h)}: ${d||c}`)))}),s.on("error",h=>{clearTimeout(b),u||o(new Error(`Failed to spawn ${e.name} CLI: ${h.message}`))})})},"runProvider");var Ue=Object.defineProperty,I=k((e,r)=>Ue(e,"name",{value:r,configurable:!0}),"i");const We=12e4,Ke=2,Ge=1e3,Ye=I(e=>new Promise(r=>{setTimeout(r,e)}),"sleep"),N=I(async(e,r,a=Ke)=>{let t;for(let n=0;n<=a;n+=1)try{return(await ze(e,r,{timeoutMs:We})).stdout}catch(i){if(t=i instanceof Error?i:new Error(String(i)),t.message.includes("timed out"))throw t;if(n<a){const o=Ge*2**n;await Ye(o)}}throw t??new Error("AI request failed after retries")},"runWithRetry");var Xe=Object.defineProperty,l=k((e,r)=>Xe(e,"name",{value:r,configurable:!0}),"c");const Qe={amp:30,claude:80,codex:60,copilot:50,crush:35,cursor:40,droid:20,gemini:100,kimi:25,opencode:35,qwen:30},Ze=l(e=>{if(e?.provider){if(!M.includes(e.provider))return;const t=x(e.provider);return t.available?t:void 0}const r=De();if(r.length===0)return;const a={...Qe,...e?.priority};return r.toSorted((t,n)=>(a[n.name]??0)-(a[t.name]??0))[0]},"resolveProvider"),er=new Set(["defer","review","skip","update"]),rr=new Set(["critical","high","low","medium"]),tr=new Set(["high","low","medium"]),ar=50,P=30,nr=l(e=>e.map(r=>{const a=r.vulnerabilities&&r.vulnerabilities.length>0?` [VULNERABILITIES: ${r.vulnerabilities.map(n=>`${n.severity} ${n.id}`).join(", ")}]`:"";let t="";if(r.socketReport){const n=Math.round(r.socketReport.score.overall*100),i=[`score:${String(n)}%`];if(r.socketReport.alerts.length>0){const o={};for(const s of r.socketReport.alerts)o[s.severity]=(o[s.severity]??0)+1;const p=Object.entries(o).map(([s,c])=>`${String(c)} ${s}`).join(", ");i.push(`alerts: ${p}`)}i.push(`supply-chain:${String(Math.round(r.socketReport.score.supplyChain*100))}%`),i.push(`quality:${String(Math.round(r.socketReport.score.quality*100))}%`),t=` [SOCKET.DEV: ${i.join(", ")}]`}return`- ${r.packageName}: ${r.currentRange} → ${r.newRange} (${r.updateType})${a}${t}`}).join(`
3
3
  `),"buildPackageList"),A=`Respond ONLY with valid JSON in this exact structure:
4
4
  {
5
5
  "summary": "Brief overall summary",
@@ -60,9 +60,9 @@ For each package:
60
60
  5. Flag any packages where skipping the update poses security risk
61
61
  6. If Socket.dev scores are provided, factor in supply chain and quality scores — low scores indicate higher risk
62
62
 
63
- ${A}`,"security")},or=new Set(["compatibility","impact","recommend","security"]),$r=l(e=>or.has(e)?e:"impact","validateAnalysisType"),L=l((e,r="impact")=>{const a=nr(e);return ir[r](a)},"buildAnalysisPrompt"),sr=/```(?:json)?\s*([\s\S]*?)```/,cr=/\{[\s\S]*\}/,lr=l(e=>{try{return JSON.parse(e)}catch{}const r=sr.exec(e);if(r?.[1])try{return JSON.parse(r[1])}catch{}const a=cr.exec(e);if(a?.[0])try{return JSON.parse(a[0])}catch{}},"extractJson"),ur=l(e=>({action:er.has(e.action)?e.action:"review",breakingChanges:Array.isArray(e.breakingChanges)?e.breakingChanges:[],effort:tr.has(e.effort)?e.effort:"medium",package:typeof e.package=="string"?e.package:"",reason:typeof e.reason=="string"?e.reason:"",riskLevel:rr.has(e.riskLevel)?e.riskLevel:"medium"}),"normalizeRecommendation"),q=l((e,r,a)=>{const t=lr(e);if(!t||typeof t!="object")return{analysisType:a,provider:r,recommendations:[],summary:"Failed to parse AI response.",warnings:["AI response was not valid JSON."]};const n=t,i=Array.isArray(n.recommendations)?n.recommendations:[];return{analysisType:a,provider:r,recommendations:i.map(o=>ur(o)),summary:typeof n.summary=="string"?n.summary:"",warnings:Array.isArray(n.warnings)?n.warnings:[]}},"parseAiResponse"),dr={eslint:["ESLint 9.0: Flat config required","ESLint 8.0+: New rule formats"],next:["Next.js 13+: App router changes","Next.js 14+: Server components default"],react:["React 17 to 18: Concurrent features","React 18+: Strict mode changes"],typescript:["TypeScript 5.0: New decorators","TypeScript 4.7+: ESM changes"],vite:["Vite 5: Node.js 18+ required"],vue:["Vue 3: Composition API","Vue 3: Breaking template changes"],webpack:["Webpack 5: Node.js polyfills removed"]},mr=new Set(["bcrypt","cors","crypto-js","express-session","helmet","jose","jsonwebtoken","node-forge","oauth","passport"]),j=l((e,r)=>{const a=e.map(t=>{const n=t.vulnerabilities&&t.vulnerabilities.length>0,i=mr.has(t.packageName),o=dr[t.packageName]??[];let p="low",s="update",c="low",d="Patch/minor update, safe to apply.";return t.updateType==="major"?(p="high",s=o.length>0?"review":"update",c="medium",d=o.length>0?`Major update with known breaking changes: ${o[0]}`:"Major version update, review changelog before applying."):t.updateType==="minor"&&(p="medium",d="Minor update, generally safe."),n&&(p="high",s="update",d="Security update — current version has known vulnerabilities."),i&&t.updateType==="major"&&(s="review",d="Security-sensitive package with major update, careful review needed.",c="high"),{action:s,breakingChanges:o,effort:c,package:t.packageName,reason:d,riskLevel:p}});return{analysisType:r,provider:"rule-engine",recommendations:a,summary:`Rule-based ${r} analysis for ${String(e.length)} packages.`,warnings:["No AI provider available — using built-in rule engine."]}},"ruleBasedAnalysis"),pr=l(async(e,r,a)=>{const t=L(r,a),n=await N(e,t);return q(n,e.name,a)},"analyzeChunk"),gr=l((e,r,a)=>{const t=[],n=[],i=[];for(const o of e)t.push(...o.recommendations),n.push(...o.warnings),o.summary&&i.push(o.summary);return{analysisType:a,provider:r,recommendations:t,summary:i.length===1?i[0]??"":`Analyzed ${String(t.length)} packages in ${String(e.length)} batches.`,warnings:[...new Set(n)]}},"mergeResults"),V={compatibility:"Compatibility",impact:"Impact",recommend:"Recommendations",security:"Security"},Sr=l(e=>{const r=`${V[e.analysisType]??e.analysisType} Analysis (${e.provider})`,a=e.recommendations.flatMap(n=>{const i=[{action:n.action,effort:n.effort,package:n.package,reason:n.reason,risk:n.riskLevel}];return n.breakingChanges.length>0&&i.push({action:"",effort:"",package:"",reason:`Breaking: ${n.breakingChanges.join("; ")}`,risk:""}),i}),t=process.stdout.columns||80;return z(v.createElement(U,{borderStyle:"round",flexDirection:"column",paddingLeft:1,paddingRight:1},v.createElement(y,{bold:!0},r),v.createElement(y,null,""),v.createElement(y,null,e.summary),v.createElement(y,null,""),v.createElement(W,{borderStyle:"none",data:a}),...e.warnings.length>0?[v.createElement(y,null,""),...e.warnings.map((n,i)=>v.createElement(y,{dimColor:!0,key:String(i)},` ${n}`))]:[]),{columns:t})},"formatAiAnalysis");l(e=>JSON.stringify(e,void 0,2),"formatAiAnalysisJson");const Pr=l(async(e,r,a,t="impact")=>{const n=Ze(a);if(!n)return r.info(`No AI CLI tool found, using rule-based analysis.
64
- `),j(e,t);const i=K(n.name,t,e),o=G(i);if(o)return r.info(`Using cached ${t} analysis from ${o.provider}.
63
+ ${A}`,"security")},or=new Set(["compatibility","impact","recommend","security"]),yr=l(e=>or.has(e)?e:"impact","validateAnalysisType"),L=l((e,r="impact")=>{const a=nr(e);return ir[r](a)},"buildAnalysisPrompt"),sr=/```(?:json)?\s*([\s\S]*?)```/,cr=/\{[\s\S]*\}/,lr=l(e=>{try{return JSON.parse(e)}catch{}const r=sr.exec(e);if(r?.[1])try{return JSON.parse(r[1])}catch{}const a=cr.exec(e);if(a?.[0])try{return JSON.parse(a[0])}catch{}},"extractJson"),ur=l(e=>({action:er.has(e.action)?e.action:"review",breakingChanges:Array.isArray(e.breakingChanges)?e.breakingChanges:[],effort:tr.has(e.effort)?e.effort:"medium",package:typeof e.package=="string"?e.package:"",reason:typeof e.reason=="string"?e.reason:"",riskLevel:rr.has(e.riskLevel)?e.riskLevel:"medium"}),"normalizeRecommendation"),q=l((e,r,a)=>{const t=lr(e);if(!t||typeof t!="object")return{analysisType:a,provider:r,recommendations:[],summary:"Failed to parse AI response.",warnings:["AI response was not valid JSON."]};const n=t,i=Array.isArray(n.recommendations)?n.recommendations:[];return{analysisType:a,provider:r,recommendations:i.map(o=>ur(o)),summary:typeof n.summary=="string"?n.summary:"",warnings:Array.isArray(n.warnings)?n.warnings:[]}},"parseAiResponse"),dr={eslint:["ESLint 9.0: Flat config required","ESLint 8.0+: New rule formats"],next:["Next.js 13+: App router changes","Next.js 14+: Server components default"],react:["React 17 to 18: Concurrent features","React 18+: Strict mode changes"],typescript:["TypeScript 5.0: New decorators","TypeScript 4.7+: ESM changes"],vite:["Vite 5: Node.js 18+ required"],vue:["Vue 3: Composition API","Vue 3: Breaking template changes"],webpack:["Webpack 5: Node.js polyfills removed"]},mr=new Set(["bcrypt","cors","crypto-js","express-session","helmet","jose","jsonwebtoken","node-forge","oauth","passport"]),T=l((e,r)=>{const a=e.map(t=>{const n=t.vulnerabilities&&t.vulnerabilities.length>0,i=mr.has(t.packageName),o=dr[t.packageName]??[];let p="low",s="update",c="low",d="Patch/minor update, safe to apply.";return t.updateType==="major"?(p="high",s=o.length>0?"review":"update",c="medium",d=o.length>0?`Major update with known breaking changes: ${o[0]}`:"Major version update, review changelog before applying."):t.updateType==="minor"&&(p="medium",d="Minor update, generally safe."),n&&(p="high",s="update",d="Security update — current version has known vulnerabilities."),i&&t.updateType==="major"&&(s="review",d="Security-sensitive package with major update, careful review needed.",c="high"),{action:s,breakingChanges:o,effort:c,package:t.packageName,reason:d,riskLevel:p}});return{analysisType:r,provider:"rule-engine",recommendations:a,summary:`Rule-based ${r} analysis for ${String(e.length)} packages.`,warnings:["No AI provider available — using built-in rule engine."]}},"ruleBasedAnalysis"),pr=l(async(e,r,a)=>{const t=L(r,a),n=await N(e,t);return q(n,e.name,a)},"analyzeChunk"),gr=l((e,r,a)=>{const t=[],n=[],i=[];for(const o of e)t.push(...o.recommendations),n.push(...o.warnings),o.summary&&i.push(o.summary);return{analysisType:a,provider:r,recommendations:t,summary:i.length===1?i[0]??"":`Analyzed ${String(t.length)} packages in ${String(e.length)} batches.`,warnings:[...new Set(n)]}},"mergeResults"),V={compatibility:"Compatibility",impact:"Impact",recommend:"Recommendations",security:"Security"},br=l(e=>{const r=`${V[e.analysisType]??e.analysisType} Analysis (${e.provider})`,a=e.recommendations.flatMap(n=>{const i=[{action:n.action,effort:n.effort,package:n.package,reason:n.reason,risk:n.riskLevel}];return n.breakingChanges.length>0&&i.push({action:"",effort:"",package:"",reason:`Breaking: ${n.breakingChanges.join("; ")}`,risk:""}),i}),t=process.stdout.columns||80;return z(v.createElement(U,{borderStyle:"round",flexDirection:"column",paddingLeft:1,paddingRight:1},v.createElement(y,{bold:!0},r),v.createElement(y,null,""),v.createElement(y,null,e.summary),v.createElement(y,null,""),v.createElement(W,{borderStyle:"none",data:a}),...e.warnings.length>0?[v.createElement(y,null,""),...e.warnings.map((n,i)=>v.createElement(y,{dimColor:!0,key:String(i)},` ${n}`))]:[]),{columns:t})},"formatAiAnalysis");l(e=>JSON.stringify(e,void 0,2),"formatAiAnalysisJson");const kr=l(async(e,r,a,t="impact")=>{const n=Ze(a);if(!n)return r.info(`No AI CLI tool found, using rule-based analysis.
64
+ `),T(e,t);const i=K(n.name,t,e),o=G(i);if(o)return r.info(`Using cached ${t} analysis from ${o.provider}.
65
65
  `),o;const p=V[t]??t;r.info(`Running ${p.toLowerCase()} analysis with ${n.name}...
66
66
  `);try{let s;if(e.length>ar){r.info(`Splitting ${String(e.length)} packages into batches of ${String(P)}...
67
67
  `);const c=[];for(let u=0;u<e.length;u+=P)c.push(e.slice(u,u+P));const d=[];for(let u=0;u<c.length;u+=1){r.info(` Batch ${String(u+1)}/${String(c.length)}...`);const b=c[u];b&&d.push(await pr(n,b,t))}s=gr(d,n.name,t)}else{const c=await N(n,L(e,t));s=q(c,n.name,t)}return Y(i,s,X(t,a?.cacheTtl)),s}catch(s){const c=s instanceof Error?s.message:String(s);return r.warn(`AI analysis failed (${c}), falling back to rule engine.
68
- `),j(e,t)}},"runAiAnalysis");export{$r as H,ze as O,Qe as R,Sr as Z,Fe as _,Ze as b,Pr as e,N as r,lr as w};
68
+ `),T(e,t)}},"runAiAnalysis");export{yr as H,ze as O,Qe as R,br as Z,Be as _,Ze as b,kr as e,N as r,lr as w};
@@ -1,5 +1,5 @@
1
- var O=Object.defineProperty;var f=(e,t)=>O(e,"name",{value:t,configurable:!0});import{createRequire as F}from"node:module";import{readLastRunSummary as T}from"@visulima/task-runner";import{a as k}from"./failure-log-B0Uh-65U.js";import{q as j,r as D,$ as y,a0 as _,a1 as N,a2 as R,a3 as A,a4 as M}from"../packem_chunks/bin.js";import{a as $,C as b,M as H,z as q}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{w as W,b as L,r as Y}from"./ai-analysis-Csn82p17.js";const C=F(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=f(e=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[t,a]=d.versions.node.split(".").map(Number);if(t>22||t===22&&a>=3||t===20&&a>=16)return d.getBuiltinModule(e)}return C(e)},"__cjs_getBuiltinModule"),{readFile:E,writeFile:B}=I("node:fs/promises");var z=Object.defineProperty,m=f((e,t)=>z(e,"name",{value:t,configurable:!0}),"u");const J=32*1024,K=m((e,t)=>{if(e.length<=t)return e;const a=e.slice(-t),o=e.length-a.length;return`[…${String(o)} bytes truncated from head…]
2
- ${a}`},"truncateHead"),U=m(async(e,t)=>t===void 0?T(e,{dataDirectory:j(e)}):D(e,t),"loadSummary"),ge=m(async(e,t,a={})=>{const o=a.terminalOutputLimit??J,[r,n]=await Promise.all([k(e,t),U(e,a.runId)]),i=n?y(n,t):void 0;if(!r&&!i)return;let s,c;if(n&&i){const l=await _(e,n.id),g=l?y(l,t):void 0;s=N(i.hashDetails,g?.hashDetails),c=l?.id}const h=r?.terminalOutput??"";return{command:r?.command??void 0,cwd:r?.cwd??void 0,dependencies:i?.dependencies??[],duration:i?.duration,exitCode:r?.exitCode??i?.exitCode,hash:i?.hash??r?.hash,hashDetails:i?.hashDetails,hashDiff:s,previousRunId:c,project:i?.target.project,runId:n?.id??r?.runId,status:r?.status??(i?G(i):void 0),target:i?.target.target,taskId:t,terminalOutput:K(h,o),terminalOutputCaptured:!!r,timestamp:r?.timestamp??i?.endTime??i?.startTime}},"aggregateFailureContext"),G=m(e=>{if(e.exitCode!==void 0&&e.exitCode!==0)return"failure";switch(e.cacheStatus){case"HIT":return"local-cache";case"REMOTE_HIT":return"remote-cache";case"SKIPPED":return"skipped";default:return e.exitCode===0?"success":void 0}},"mapCacheStatusToTaskStatus");var V=Object.defineProperty,u=f((e,t)=>V(e,"name",{value:t,configurable:!0}),"a");const Q=3600*1e3,S=80,X=new Set(["high","low","medium"]),Z=u(()=>`You are an expert software engineer helping fix a failing build/test/lint task.
1
+ var O=Object.defineProperty;var f=(e,t)=>O(e,"name",{value:t,configurable:!0});import{createRequire as F}from"node:module";import{readLastRunSummary as T}from"@visulima/task-runner";import{a as k}from"./failure-log-C3bG1bCA.js";import{x as j,A as D,a9 as y,aa as _,ab as N,ac as A,ad as R,ae as M}from"../packem_chunks/bin.js";import{a as $,C as b,M as H,z as W}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{w as q,b as L,r as Y}from"./ai-analysis-BnmDFqc8.js";const C=F(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=f(e=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[t,a]=l.versions.node.split(".").map(Number);if(t>22||t===22&&a>=3||t===20&&a>=16)return l.getBuiltinModule(e)}return C(e)},"__cjs_getBuiltinModule"),{readFile:E,writeFile:B}=I("node:fs/promises");var z=Object.defineProperty,m=f((e,t)=>z(e,"name",{value:t,configurable:!0}),"u");const J=32*1024,K=m((e,t)=>{if(e.length<=t)return e;const a=e.slice(-t),o=e.length-a.length;return`[…${String(o)} bytes truncated from head…]
2
+ ${a}`},"truncateHead"),U=m(async(e,t)=>t===void 0?T(e,{dataDirectory:j(e)}):D(e,t),"loadSummary"),ge=m(async(e,t,a={})=>{const o=a.terminalOutputLimit??J,[r,n]=await Promise.all([k(e,t),U(e,a.runId)]),i=n?y(n,t):void 0;if(!r&&!i)return;let s,c;if(n&&i){const d=await _(e,n.id),g=d?y(d,t):void 0;s=N(i.hashDetails,g?.hashDetails),c=d?.id}const h=r?.terminalOutput??"";return{command:r?.command??void 0,cwd:r?.cwd??void 0,dependencies:i?.dependencies??[],duration:i?.duration,exitCode:r?.exitCode??i?.exitCode,hash:i?.hash??r?.hash,hashDetails:i?.hashDetails,hashDiff:s,previousRunId:c,project:i?.target.project,runId:n?.id??r?.runId,status:r?.status??(i?G(i):void 0),target:i?.target.target,taskId:t,terminalOutput:K(h,o),terminalOutputCaptured:!!r,timestamp:r?.timestamp??i?.endTime??i?.startTime}},"aggregateFailureContext"),G=m(e=>{if(e.exitCode!==void 0&&e.exitCode!==0)return"failure";switch(e.cacheStatus){case"HIT":return"local-cache";case"REMOTE_HIT":return"remote-cache";case"SKIPPED":return"skipped";default:return e.exitCode===0?"success":void 0}},"mapCacheStatusToTaskStatus");var V=Object.defineProperty,u=f((e,t)=>V(e,"name",{value:t,configurable:!0}),"a");const Q=3600*1e3,S=80,X=new Set(["high","low","medium"]),Z=u(()=>`You are an expert software engineer helping fix a failing build/test/lint task.
3
3
 
4
4
  You will be given:
5
5
  - The terminal output (stdout/stderr) from the failed task.
@@ -30,14 +30,14 @@ Respond ONLY with valid JSON in this exact structure:
30
30
  }
31
31
  ],
32
32
  "cannotFix": "optional — set when no safe patch can be proposed"
33
- }`,"buildSystemPrompt"),v=u((e,t)=>{const a=[];if(t.added.length>0&&a.push(` added: ${t.added.join(", ")}`),t.changed.length>0&&a.push(` changed: ${t.changed.join(", ")}`),t.removed.length>0&&a.push(` removed: ${t.removed.join(", ")}`),a.length!==0)return`- ${e}:
33
+ }`,"buildSystemPrompt"),x=u((e,t)=>{const a=[];if(t.added.length>0&&a.push(` added: ${t.added.join(", ")}`),t.changed.length>0&&a.push(` changed: ${t.changed.join(", ")}`),t.removed.length>0&&a.push(` removed: ${t.removed.join(", ")}`),a.length!==0)return`- ${e}:
34
34
  ${a.join(`
35
- `)}`},"formatBucket"),ee=u(e=>{if(!e.hashDiff)return"No hash-diff available — there is no previous run to compare against.";const t=[];e.hashDiff.commandChanged&&t.push("- command line changed since previous run");const a=v("file inputs",e.hashDiff.nodes),o=v("implicit deps",e.hashDiff.implicitDeps),r=v("runtime/env",e.hashDiff.runtime);return a&&t.push(a),o&&t.push(o),r&&t.push(r),t.length===0?"No detectable changes between this run and the previous run.":t.join(`
35
+ `)}`},"formatBucket"),ee=u(e=>{if(!e.hashDiff)return"No hash-diff available — there is no previous run to compare against.";const t=[];e.hashDiff.commandChanged&&t.push("- command line changed since previous run");const a=x("file inputs",e.hashDiff.nodes),o=x("implicit deps",e.hashDiff.implicitDeps),r=x("runtime/env",e.hashDiff.runtime);return a&&t.push(a),o&&t.push(o),r&&t.push(r),t.length===0?"No detectable changes between this run and the previous run.":t.join(`
36
36
  `)},"buildHashDiffSummary"),te=u(e=>{const t=[`Task: ${e.taskId}`];return e.project&&t.push(`Project: ${e.project}`),e.target&&t.push(`Target: ${e.target}`),e.command&&t.push(`Command: ${e.command}`),e.cwd&&t.push(`CWD: ${e.cwd}`),e.exitCode!==void 0&&t.push(`Exit code: ${String(e.exitCode)}`),e.hash&&t.push(`Task hash: ${e.hash}`),t.push("","Hash-diff since previous run:",ee(e),""),e.terminalOutputCaptured?t.push("Terminal output:","```",e.terminalOutput,"```"):t.push("Terminal output: <no failure log was captured for this task>",'Set "cannotFix" and tell the user to re-run with `vis run` so logs can be captured.'),t.join(`
37
37
  `)},"buildUserPrompt"),ae=u(e=>`${Z()}
38
38
 
39
- ${te(e)}`,"buildFixPrompt"),ie=u((e,t)=>{const a=Array.isArray(e.patches)?e.patches:[],o=[];for(const n of a)typeof n.file!="string"||n.file.length===0||typeof n.oldString!="string"||n.oldString.length===0||typeof n.newString=="string"&&o.push({file:n.file,newString:n.newString,oldString:n.oldString,reason:typeof n.reason=="string"&&n.reason.length>0?n.reason:void 0});const r=typeof e.cannotFix=="string"&&e.cannotFix.length>0?e.cannotFix:void 0;return{cannotFix:r,confidence:X.has(e.confidence)?e.confidence:"low",explanation:typeof e.explanation=="string"?e.explanation:"",patches:r?[]:o,provider:t}},"normalizeFixProposal"),ne=u((e,t)=>{const a=W(e);return!a||typeof a!="object"?{cannotFix:"AI response was not valid JSON.",confidence:"low",explanation:"Failed to parse AI response.",patches:[],provider:t}:ie(a,t)},"parseFixResponse"),re=u((e,t)=>R({cwd:t.cwd??null,flow:"ai-fix",hash:t.hash??null,provider:e,taskId:t.taskId,terminalOutput:t.terminalOutput,terminalOutputCaptured:t.terminalOutputCaptured}),"buildFixCacheKey"),ve=u(async(e,t,a={})=>{const o=L(a.config);if(!o){t.warn(`No AI provider available — install one of: claude, gemini, copilot, codex.
40
- `);return}const r=a.cache!==!1,n=re(o.name,e);if(r){const i=A(n);if(i)return t.info(`Using cached fix proposal from ${i.provider}.
39
+ ${te(e)}`,"buildFixPrompt"),ie=u((e,t)=>{const a=Array.isArray(e.patches)?e.patches:[],o=[];for(const n of a)typeof n.file!="string"||n.file.length===0||typeof n.oldString!="string"||n.oldString.length===0||typeof n.newString=="string"&&o.push({file:n.file,newString:n.newString,oldString:n.oldString,reason:typeof n.reason=="string"&&n.reason.length>0?n.reason:void 0});const r=typeof e.cannotFix=="string"&&e.cannotFix.length>0?e.cannotFix:void 0;return{cannotFix:r,confidence:X.has(e.confidence)?e.confidence:"low",explanation:typeof e.explanation=="string"?e.explanation:"",patches:r?[]:o,provider:t}},"normalizeFixProposal"),ne=u((e,t)=>{const a=q(e);return!a||typeof a!="object"?{cannotFix:"AI response was not valid JSON.",confidence:"low",explanation:"Failed to parse AI response.",patches:[],provider:t}:ie(a,t)},"parseFixResponse"),re=u((e,t)=>A({cwd:t.cwd??null,flow:"ai-fix",hash:t.hash??null,provider:e,taskId:t.taskId,terminalOutput:t.terminalOutput,terminalOutputCaptured:t.terminalOutputCaptured}),"buildFixCacheKey"),xe=u(async(e,t,a={})=>{const o=L(a.config);if(!o){t.warn(`No AI provider available — install one of: claude, gemini, copilot, codex.
40
+ `);return}const r=a.cache!==!1,n=re(o.name,e);if(r){const i=R(n);if(i)return t.info(`Using cached fix proposal from ${i.provider}.
41
41
  `),i}t.info(`Generating fix proposal with ${o.name}...
42
42
  `);try{const i=await Y(o,ae(e)),s=ne(i,o.name);return r&&s.patches.length>0&&!s.cannotFix&&M(n,s,Q),s}catch(i){const s=i instanceof Error?i.message:String(i);t.warn(`AI fix proposal failed (${s}).
43
- `);return}},"runFixAnalysis"),se=u((e,t,a)=>$(a)?b(a):b(H(t??e,a)),"resolvePatchPath"),oe=u((e,t)=>{const a=q(e,t);return a===""?!0:!a.startsWith("..")&&!$(a)},"isInsideWorkspace"),ce=u((e,t,a)=>{const o=e.indexOf(t),r=Math.max(0,o-S),n=Math.min(e.length,o+t.length+S),i=e.slice(r,n);return{previewAfter:`${e.slice(r,o)}${a}${e.slice(o+t.length,n)}`,previewBefore:i}},"buildPreview"),xe=u(async(e,t,a,o={})=>{const r=o.dryRun===!0,n=new Map,i=[];for(const s of a.patches){const c=se(e,t,s.file);if(!oe(e,c)){i.push({absolutePath:c,patch:s,status:"outside-workspace"});continue}let h=n.get(c);if(h===void 0){try{h=await E(c,"utf8")}catch(p){const w=p.code;i.push({absolutePath:c,error:w==="ENOENT"?void 0:p.message,patch:s,status:w==="ENOENT"?"missing-file":"error"});continue}n.set(c,h)}const l=h.indexOf(s.oldString);if(l===-1){i.push({absolutePath:c,patch:s,status:"no-match"});continue}if(h.indexOf(s.oldString,l+s.oldString.length)!==-1){i.push({absolutePath:c,patch:s,status:"ambiguous-match"});continue}const{previewAfter:g,previewBefore:P}=ce(h,s.oldString,s.newString),x=`${h.slice(0,l)}${s.newString}${h.slice(l+s.oldString.length)}`;if(!r)try{await B(c,x,"utf8")}catch(p){n.delete(c),i.push({absolutePath:c,error:p.message,patch:s,status:"error"});continue}n.set(c,x),i.push({absolutePath:c,patch:s,previewAfter:g,previewBefore:P,status:"applied"})}return i},"applyFixProposal");export{ge as a,ve as b,xe as c,se as r};
43
+ `);return}},"runFixAnalysis"),se=u((e,t,a)=>$(a)?b(a):b(H(t??e,a)),"resolvePatchPath"),oe=u((e,t)=>{const a=W(e,t);return a===""?!0:!a.startsWith("..")&&!$(a)},"isInsideWorkspace"),ce=u((e,t,a)=>{const o=e.indexOf(t),r=Math.max(0,o-S),n=Math.min(e.length,o+t.length+S),i=e.slice(r,n);return{previewAfter:`${e.slice(r,o)}${a}${e.slice(o+t.length,n)}`,previewBefore:i}},"buildPreview"),ve=u(async(e,t,a,o={})=>{const r=o.dryRun===!0,n=new Map,i=[];for(const s of a.patches){const c=se(e,t,s.file);if(!oe(e,c)){i.push({absolutePath:c,patch:s,status:"outside-workspace"});continue}let h=n.get(c);if(h===void 0){try{h=await E(c,"utf8")}catch(p){const w=p.code;i.push({absolutePath:c,error:w==="ENOENT"?void 0:p.message,patch:s,status:w==="ENOENT"?"missing-file":"error"});continue}n.set(c,h)}const d=h.indexOf(s.oldString);if(d===-1){i.push({absolutePath:c,patch:s,status:"no-match"});continue}if(h.indexOf(s.oldString,d+s.oldString.length)!==-1){i.push({absolutePath:c,patch:s,status:"ambiguous-match"});continue}const{previewAfter:g,previewBefore:P}=ce(h,s.oldString,s.newString),v=`${h.slice(0,d)}${s.newString}${h.slice(d+s.oldString.length)}`;if(!r)try{await B(c,v,"utf8")}catch(p){n.delete(c),i.push({absolutePath:c,error:p.message,patch:s,status:"error"});continue}n.set(c,v),i.push({absolutePath:c,patch:s,previewAfter:g,previewBefore:P,status:"applied"})}return i},"applyFixProposal");export{ge as a,xe as b,ve as c,se as r};
@@ -1,4 +1,4 @@
1
- var de=Object.defineProperty;var w=(e,n)=>de(e,"name",{value:n,configurable:!0});import{createRequire as he}from"node:module";import{n as ie}from"../packem_chunks/config.js";import{M as B,$ as _e}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{r as be}from"./docker-Bw9gKo69.js";import{e as $e}from"./license-zZU7aavK.js";import{F as Oe}from"./lockfile-BG1HvBzH.js";import{x as ke}from"./pm-runner-BzGZmzYs.js";const ge=he(import.meta.url),W=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ae=w(e=>{if(typeof W<"u"&&W.versions&&W.versions.node){const[n,t]=W.versions.node.split(".").map(Number);if(n>22||n===22&&t>=3||n===20&&t>=16)return W.getBuiltinModule(e)}return ge(e)},"__cjs_getBuiltinModule"),{randomUUID:ye}=ae("node:crypto"),{readdirSync:ve}=ae("node:fs");var je=Object.defineProperty,pe=w((e,n)=>je(e,"name",{value:n,configurable:!0}),"r$1");const z=pe(e=>e.replaceAll(/[^\w.~-]/g,n=>`%${(n.codePointAt(0)??0).toString(16).toUpperCase().padStart(2,"0")}`),"encodeSegment"),M=pe((e,n)=>{const t=e.toLowerCase();if(t.startsWith("@")){const o=t.indexOf("/");if(o>0){const r=t.slice(0,o),p=t.slice(o+1);return`pkg:npm/${z(r)}/${z(p)}@${z(n)}`}}return`pkg:npm/${z(t)}@${z(n)}`},"toNpmPurl");var Se=Object.defineProperty,j=w((e,n)=>Se(e,"name",{value:n,configurable:!0}),"a");const m={ARRAY:"array",BOOLEAN:"boolean",DATE:"date",FUNCTION:"function",JSTOXML_OBJECT:"jstoxml-object",NULL:"null",NUMBER:"number",OBJECT:"object",STRING:"string"},Te=[m.STRING,m.NUMBER,m.BOOLEAN],Ae='<?xml version="1.0" encoding="UTF-8"?>',se=["_selfCloseTag","_attrs"],xe=j((e="",n=0)=>e.repeat(n),"getIndentStr"),Q=j(e=>Array.isArray(e)&&m.ARRAY||typeof e===m.OBJECT&&e!==null&&e._name&&m.JSTOXML_OBJECT||e instanceof Date&&m.DATE||e===null&&m.NULL||typeof e,"getType"),le=j(e=>e.startsWith("<![CDATA["),"isCDATA"),ue=j((e="",n={},t)=>{let o=e;if(typeof e===m.STRING){if(le(e))return e;const r=new RegExp(`(${Object.keys(n).join("|")})(?!(\\w|#)*;)`,"g");o=String(e).replace(r,(p,g)=>n[g]||"")}return typeof t=="function"?t(o):o},"mapStr"),Ce=j((e={},n,t,o)=>(Array.isArray(e)?e:Object.entries(e).map(([r,p])=>({[r]:p}))).reduce((r,p)=>{const g=Object.keys(p)[0],y=p[g];if(typeof t===m.FUNCTION&&t(g,y))return r;const b=n?ue(y,n):y,$=!o&&b===!0?"":`="${b}"`;return r.push(`${g}${$}`),r},[]),"getAttributeKeyVals"),Ne=j((e={},n,t,o)=>{const r=Ce(e,n,t,o);return r.length===0?"":` ${r.join(" ")}`},"formatAttributes"),Re=j((e={})=>Object.keys(e).map(n=>({_name:n,_content:e[n]})),"objToArray"),we=j(e=>Te.includes(Q(e)),"isPrimitive"),Pe=j(e=>!e.match("<"),"isSimpleXML"),De=j(({header:e,isOutputStart:n})=>e&&n?typeof e===m.BOOLEAN?Ae:e:"","getHeaderString"),re={"<":"&lt;",">":"&gt;","&":"&amp;",'"':"&quot;"},J=j((e={},n={})=>{const{depth:t=0,indent:o,_isFirstItem:r,_isOutputStart:p=!0,header:g,attributeReplacements:y={},attributeFilter:b,attributeExplicitTrue:$=!1,contentReplacements:q={},contentMap:L,selfCloseTags:I=!0}=n,H=typeof y=="boolean"&&!y?{}:{...re,...y},Y=typeof q=="boolean"&&!q?{}:{...re,...q},P=typeof o=="string",T=xe(o,t),G=Q(e),U=De({header:g,indent:o,depth:t,isOutputStart:p}),D=p&&!U&&r&&t===0,E=P&&!D?`
1
+ var de=Object.defineProperty;var w=(e,n)=>de(e,"name",{value:n,configurable:!0});import{createRequire as he}from"node:module";import{n as ie}from"../packem_chunks/config.js";import{M as B,$ as _e}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{r as be}from"./docker-k-Sl8b-w.js";import{e as $e}from"./license-zZU7aavK.js";import{F as Oe}from"./lockfile-DmDfgKaT.js";import{x as ke}from"./pm-runner-COoPLGKi.js";const ge=he(import.meta.url),W=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ae=w(e=>{if(typeof W<"u"&&W.versions&&W.versions.node){const[n,t]=W.versions.node.split(".").map(Number);if(n>22||n===22&&t>=3||n===20&&t>=16)return W.getBuiltinModule(e)}return ge(e)},"__cjs_getBuiltinModule"),{randomUUID:ye}=ae("node:crypto"),{readdirSync:ve}=ae("node:fs");var je=Object.defineProperty,pe=w((e,n)=>je(e,"name",{value:n,configurable:!0}),"r$1");const z=pe(e=>e.replaceAll(/[^\w.~-]/g,n=>`%${(n.codePointAt(0)??0).toString(16).toUpperCase().padStart(2,"0")}`),"encodeSegment"),M=pe((e,n)=>{const t=e.toLowerCase();if(t.startsWith("@")){const o=t.indexOf("/");if(o>0){const r=t.slice(0,o),p=t.slice(o+1);return`pkg:npm/${z(r)}/${z(p)}@${z(n)}`}}return`pkg:npm/${z(t)}@${z(n)}`},"toNpmPurl");var Se=Object.defineProperty,j=w((e,n)=>Se(e,"name",{value:n,configurable:!0}),"a");const m={ARRAY:"array",BOOLEAN:"boolean",DATE:"date",FUNCTION:"function",JSTOXML_OBJECT:"jstoxml-object",NULL:"null",NUMBER:"number",OBJECT:"object",STRING:"string"},Te=[m.STRING,m.NUMBER,m.BOOLEAN],Ae='<?xml version="1.0" encoding="UTF-8"?>',se=["_selfCloseTag","_attrs"],xe=j((e="",n=0)=>e.repeat(n),"getIndentStr"),Q=j(e=>Array.isArray(e)&&m.ARRAY||typeof e===m.OBJECT&&e!==null&&e._name&&m.JSTOXML_OBJECT||e instanceof Date&&m.DATE||e===null&&m.NULL||typeof e,"getType"),le=j(e=>e.startsWith("<![CDATA["),"isCDATA"),ue=j((e="",n={},t)=>{let o=e;if(typeof e===m.STRING){if(le(e))return e;const r=new RegExp(`(${Object.keys(n).join("|")})(?!(\\w|#)*;)`,"g");o=String(e).replace(r,(p,g)=>n[g]||"")}return typeof t=="function"?t(o):o},"mapStr"),Ce=j((e={},n,t,o)=>(Array.isArray(e)?e:Object.entries(e).map(([r,p])=>({[r]:p}))).reduce((r,p)=>{const g=Object.keys(p)[0],y=p[g];if(typeof t===m.FUNCTION&&t(g,y))return r;const b=n?ue(y,n):y,$=!o&&b===!0?"":`="${b}"`;return r.push(`${g}${$}`),r},[]),"getAttributeKeyVals"),Ne=j((e={},n,t,o)=>{const r=Ce(e,n,t,o);return r.length===0?"":` ${r.join(" ")}`},"formatAttributes"),Re=j((e={})=>Object.keys(e).map(n=>({_name:n,_content:e[n]})),"objToArray"),we=j(e=>Te.includes(Q(e)),"isPrimitive"),Pe=j(e=>!e.match("<"),"isSimpleXML"),De=j(({header:e,isOutputStart:n})=>e&&n?typeof e===m.BOOLEAN?Ae:e:"","getHeaderString"),re={"<":"&lt;",">":"&gt;","&":"&amp;",'"':"&quot;"},J=j((e={},n={})=>{const{depth:t=0,indent:o,_isFirstItem:r,_isOutputStart:p=!0,header:g,attributeReplacements:y={},attributeFilter:b,attributeExplicitTrue:$=!1,contentReplacements:q={},contentMap:L,selfCloseTags:I=!0}=n,H=typeof y=="boolean"&&!y?{}:{...re,...y},Y=typeof q=="boolean"&&!q?{}:{...re,...q},P=typeof o=="string",T=xe(o,t),G=Q(e),U=De({header:g,indent:o,depth:t,isOutputStart:p}),D=p&&!U&&r&&t===0,E=P&&!D?`
2
2
  `:"";let v="";switch(G){case m.JSTOXML_OBJECT:{const{_name:f,_content:l}=e;if(l===null&&typeof L!="function"){v=`${E}${T}${f}`;break}if(Array.isArray(l)&&l.every(we))return l.map(S=>J({_name:f,_content:S},{...n,depth:t,_isOutputStart:!1})).join("");if(se.includes(f))break;const _=J(l,{...n,depth:t+1,_isOutputStart:D}),N=Q(_),O=Pe(_),k=le(_),R=`${E}${T}`;if(f==="_comment"){v+=`${R}<!-- ${l} -->`;break}const K=N==="undefined"||_==="",c=I,s=e._selfCloseTag,i=typeof s===m.BOOLEAN?K&&s:K&&c,a=i?"/":"",u=Ne(e._attrs,H,b,$),d=`<${f}${u}${a}>`,A=P&&!O&&!k?`
3
3
  ${T}`:"",x=i?"":`${_}${A}</${f}>`;v+=`${R}${d}${x}`;break}case m.OBJECT:{const f=Object.keys(e);v=f.map((l,_)=>{const N={...n,_isFirstItem:_===0,_isLastItem:_+1===f.length,_isOutputStart:D},O={_name:l};if(Q(e[l])===m.OBJECT&&(se.forEach(k=>{const R=e[l][k];typeof R<"u"&&(O[k]=R,delete e[l][k])}),typeof e[l]._content<"u"&&Object.keys(e[l]).length>1)){const k=Object.assign({},e[l]);delete k._content,O._content=[...Re(k),e[l]._content]}return typeof O._content>"u"&&(O._content=e[l]),J(O,N)},n).join("");break}case m.FUNCTION:{const f=e(n);v=J(f,n);break}case m.ARRAY:{v=e.map((f,l)=>{const _={...n,_isFirstItem:l===0,_isLastItem:l+1===e.length,_isOutputStart:D};return J(f,_)}).join("");break}default:{v=ue(e,Y,L);break}}return`${U}${v}`},"toXML");var Ee=Object.defineProperty,X=w((e,n)=>Ee(e,"name",{value:n,configurable:!0}),"r");const te=X(e=>{try{return ie(e)}catch{return}},"readJsonSafe"),Me=X(e=>{if(e.length===0||e.includes("..")||e.startsWith(".")||e.includes("\0")||e.includes("\\"))return!1;if(e.startsWith("@")){const n=e.indexOf("/");return n>1&&!e.includes("/",n+1)}return!e.includes("/")},"isSafePackageName"),Be=X(e=>e.length>0&&!e.includes("/")&&!e.includes("\\")&&!e.includes("..")&&!e.includes("\0"),"isSafeVersion"),Le=X((e,n,t)=>{const o=`${n.replaceAll("/","+")}@${t}`,r=B(e,"node_modules",".pnpm"),p=te(B(r,o,"node_modules",n,"package.json"));if(p)return p;let g;try{g=ve(r)}catch{return}const y=`${o}_`;for(const b of g){if(!b.startsWith(y))continue;const $=te(B(r,b,"node_modules",n,"package.json"));if($)return $}},"readPnpmVirtualStore"),Ie=X((e,n,t)=>{const o=te(B(e,"node_modules",n,"package.json"));return o?.version===t?o:void 0},"readHoistedCopy"),Ue=X((e,n,t)=>{if(!(!Me(n)||!Be(t)))return Le(e,n,t)??Ie(e,n,t)},"readInstalledPackageMetadata");var Fe=Object.defineProperty,me=w((e,n)=>Fe(e,"name",{value:n,configurable:!0}),"t");const Je={sha256:"SHA-256",sha384:"SHA-384",sha512:"SHA-512"},Xe={sha256:64,sha384:96,sha512:128},qe=me(e=>{const n={name:e.name,version:e.version},{integrity:t}=e;return t&&t.hex.length===Xe[t.algorithm]&&(n.hash={alg:Je[t.algorithm],content:t.hex}),e.dependencies&&(n.dependencies=e.dependencies),e.peerDependencies&&(n.peerDependencies=e.peerDependencies),e.optionalDependencies&&(n.optionalDependencies=e.optionalDependencies),n},"toResolvedPackage"),He=[{file:"pnpm-lock.yaml",type:"pnpm"},{file:"npm-shrinkwrap.json",type:"npm"},{file:"package-lock.json",type:"npm"},{file:"yarn.lock",type:"yarn"},{file:"bun.lock",type:"bun"}],Ve=me(e=>{for(const{file:n,type:t}of He){let o;try{o=_e(B(e,n))}catch{continue}const r=new Map;for(const p of Oe(o,t))r.set(`${p.name}@${p.version}`,qe(p));return{packages:r,type:t}}},"readLockfilePackages");var We=Object.defineProperty,fe=w((e,n)=>We(e,"name",{value:n,configurable:!0}),"s");const ze=fe(e=>{const n=e.indexOf(":");return n<=0?e:e.slice(0,n)==="npm"?e.slice(n+1):e},"stripProtocolPrefix"),ee=fe((e,n,t)=>{const o=t.get(e);if(!o||o.size===0)return;if(o.has(n))return n;const r=ze(n);if(r!==n&&o.has(r))return r;const p=[...o];return ke.maxSatisfying(p,r,{includePrerelease:!0})||p[0]},"resolveSpecifier");var Ye=Object.defineProperty,h=w((e,n)=>Ye(e,"name",{value:n,configurable:!0}),"p");const Ge="1.7",Ke="CycloneDX",Qe="http://cyclonedx.org/schema/bom-1.7.schema.json",Ze="@visulima/vis",ce=h(e=>{try{return ie(e)}catch{return}},"readPackageJson"),en=h(e=>{if(e){if(typeof e=="string")return e;if(typeof e=="object"&&e.name)return e.email?`${e.name} <${e.email}>`:e.name}},"toAuthorString"),nn=h(e=>{if(e)return typeof e=="string"?e:e.url},"toRepositoryUrl"),tn=h(e=>{if(e)return typeof e=="string"?e:e.url},"toBugsUrl"),on=h(e=>{const n=[];e.homepage&&n.push({type:"website",url:e.homepage});const t=nn(e.repository);t&&n.push({type:"vcs",url:t});const o=tn(e.bugs);return o&&n.push({type:"issue-tracker",url:o}),n.length>0?n:void 0},"buildExternalReferences"),sn=h(e=>e==="application"||e==="service"||e==="tool"?"application":"library","toCycloneDxComponentType"),ne=h((e,n)=>{if(!n)return;n.description&&(e.description=n.description);const t=en(n.author);t&&(e.author=t);const o=$e(n);o&&(e.licenses=o);const r=on(n);r&&(e.externalReferences=r)},"decoratePackageComponent"),yn=h(e=>{const{focus:n,generatorVersion:t,includeDev:o=!1,now:r=new Date,projectGraph:p,serialNumber:g,workspace:y,workspaceRoot:b}=e,$=n&&n.length>0?[...be(n,p)].sort():Object.keys(y.projects).sort(),q=new Set($),L=new Map;for(const c of $){const s=y.projects[c];s&&L.set(c,ce(B(b,s.root,"package.json")))}const I=[],H=new Map;for(const c of $){const s=y.projects[c];if(!s)continue;const i=L.get(c),a=i?.version??"0.0.0",u=M(c,a);H.set(c,u);const d={"bom-ref":u,name:c,purl:u,type:sn(s.projectType),version:a};ne(d,i),I.push(d)}const Y=Ve(b),P=new Map,T=new Map;if(Y)for(const c of Y.packages.values()){P.set(`${c.name}@${c.version}`,c);let s=T.get(c.name);s||(s=new Set,T.set(c.name,s)),s.add(c.version)}const G=[],U=[],D=new Map;for(const c of $){const s=L.get(c);if(!s)continue;const i=[s.dependencies,s.peerDependencies];o&&i.push(s.devDependencies);const a=new Set,u=h((d,A)=>{if(A)for(const[x,S]of Object.entries(A)){if(q.has(x)){const F=H.get(x);F&&a.add(F);continue}const C=ee(x,S,T);C&&(a.add(M(x,C)),d.push(`${x}@${C}`))}},"seedRef");for(const d of i)u(G,d);u(U,s.optionalDependencies),D.set(c,a)}const E=new Map,v=new Map,f=h((c,s)=>{const i=[...c];for(;i.length>0;){const a=i.pop(),u=E.get(a);if(u==="required"||u==="optional"&&s==="optional")continue;E.set(a,s);const d=P.get(a);if(!d)continue;const A=v.get(a)??new Set,x=[d.dependencies,d.peerDependencies];for(const S of x)if(S)for(const[C,F]of Object.entries(S))for(const V of F){const Z=ee(C,V,T);Z&&(A.add(M(C,Z)),i.push(`${C}@${Z}`))}if(d.optionalDependencies)for(const[S,C]of Object.entries(d.optionalDependencies))for(const F of C){const V=ee(S,F,T);V&&(A.add(M(S,V)),U.push(`${S}@${V}`))}A.size>0&&v.set(a,A)}},"walk");f(G,"required"),f(U,"optional");const l=[],_=[...E.keys()].sort();for(const c of _){const s=P.get(c);if(!s)continue;const i=M(s.name,s.version),a={"bom-ref":i,name:s.name,purl:i,scope:E.get(c)??"required",type:"library",version:s.version};s.hash&&(a.hashes=[s.hash]),ne(a,Ue(b,s.name,s.version)),l.push(a)}const N=[];for(const[c,s]of D){const i=H.get(c);if(!i)continue;const a=[...s].sort();N.push(a.length>0?{dependsOn:a,ref:i}:{ref:i})}for(const c of _){const s=P.get(c);if(!s)continue;const i=M(s.name,s.version),a=v.get(c),u=a?[...a].sort():[];N.push(u.length>0?{dependsOn:u,ref:i}:{ref:i})}N.sort((c,s)=>c.ref.localeCompare(s.ref));const O=ce(B(b,"package.json")),k=(()=>{if(n?.length===1){const u=I.find(d=>d.name===n[0]);if(u)return{"bom-ref":u["bom-ref"],name:u.name,purl:u.purl,type:u.type,version:u.version}}const c=O?.name??"workspace",s=O?.version??"0.0.0",i=M(c,s),a={"bom-ref":i,name:c,purl:i,type:"application",version:s};return ne(a,O),a})(),R=k["bom-ref"],K=R?I.filter(c=>c["bom-ref"]!==R):I;return{$schema:Qe,bomFormat:Ke,components:[...K,...l],dependencies:N,metadata:{component:k,lifecycles:[{phase:"build"}],timestamp:r.toISOString(),tools:{components:[{name:Ze,type:"application",...t?{version:t}:{}}]}},serialNumber:g??`urn:uuid:${ye()}`,specVersion:Ge,version:1}},"buildCycloneDxBom"),_n=h(e=>{const n={version:e.version??1,xmlns:"http://cyclonedx.org/schema/bom/1.7"};e.serialNumber&&(n.serialNumber=e.serialNumber);const t=[];return e.metadata&&t.push(rn(e.metadata)),e.components&&e.components.length>0&&t.push({_content:e.components.map(o=>oe(o)),_name:"components"}),e.dependencies&&e.dependencies.length>0&&t.push({_content:e.dependencies.map(o=>an(o)),_name:"dependencies"}),`${J({_attrs:n,_content:t,_name:"bom"},{header:!0,indent:" ",selfCloseTags:!0})}
4
4
  `},"serializeBomToXml"),rn=h(e=>{const n=[];return e.timestamp&&n.push({timestamp:e.timestamp}),e.lifecycles&&e.lifecycles.length>0&&n.push({_content:e.lifecycles.map(t=>{const o=[];return t.phase&&o.push({phase:t.phase}),t.name&&o.push({name:t.name}),t.description&&o.push({description:t.description}),{_content:o,_name:"lifecycle"}}),_name:"lifecycles"}),e.tools?.components&&n.push({_content:[{_content:e.tools.components.map(t=>oe(t)),_name:"components"}],_name:"tools"}),e.component&&n.push(oe(e.component)),{_content:n,_name:"metadata"}},"metadataToXmlElement"),oe=h(e=>{const n={type:e.type};e["bom-ref"]&&(n["bom-ref"]=e["bom-ref"]);const t=[];e.group&&t.push({group:e.group}),t.push({name:e.name}),e.version&&t.push({version:e.version}),e.description&&t.push({description:e.description}),e.author&&t.push({author:e.author}),e.hashes&&e.hashes.length>0&&t.push({_content:e.hashes.map(r=>({_attrs:{alg:r.alg},_content:r.content,_name:"hash"})),_name:"hashes"});const o=cn(e.licenses);return o&&t.push(o),e.purl&&t.push({purl:e.purl}),e.scope&&t.push({scope:e.scope}),e.externalReferences&&e.externalReferences.length>0&&t.push({_content:e.externalReferences.map(r=>({_attrs:{type:r.type},_content:[{url:r.url}],_name:"reference"})),_name:"externalReferences"}),{_attrs:n,_content:t,_name:"component"}},"componentToXmlElement"),cn=h(e=>{if(!e||e.length===0)return;const n=[];for(const t of e){if("expression"in t){n.push({expression:t.expression});continue}const o=[];"id"in t.license&&t.license.id?o.push({id:t.license.id}):"name"in t.license&&t.license.name&&o.push({name:t.license.name}),n.push({_content:o,_name:"license"})}return{_content:n,_name:"licenses"}},"licensesToXmlElement"),an=h(e=>e.dependsOn&&e.dependsOn.length>0?{_attrs:{ref:e.ref},_content:e.dependsOn.map(n=>({_attrs:{ref:n},_name:"dependency"})),_name:"dependency"}:{_attrs:{ref:e.ref},_name:"dependency"},"dependencyToXmlElement");export{yn as b,_n as s,M as t};
@@ -1 +1 @@
1
- var D=Object.defineProperty;var y=(o,t)=>D(o,"name",{value:t,configurable:!0});import{i as w,M as u,$ as d}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{F as h}from"./lockfile-BG1HvBzH.js";import{h as b,J as j}from"../packem_chunks/bin.js";var L=Object.defineProperty,l=y((o,t)=>L(o,"name",{value:t,configurable:!0}),"f");const S={bun:{file:"bun.lock",type:"bun"},npm:{aliases:["npm-shrinkwrap.json"],file:"package-lock.json",type:"npm"},pnpm:{file:"pnpm-lock.yaml",type:"pnpm"},yarn:{file:"yarn.lock",type:"yarn"}},O=l(o=>{const t=S[o];return t?[...t.aliases??[],t.file].map(e=>({file:e,type:t.type})):[]},"lockfileCandidates"),m=l((o,t)=>{const e=O(t);if(e.length!==0)return e.find(r=>w(u(o,r.file)))??e[e.length-1]},"resolveLockfile"),g=l(o=>{try{return JSON.parse(d(o))}catch{return}},"readPackageJsonShape"),v=l(o=>{const t=[],e=g(u(o,"package.json"));e&&t.push(e);const r=b(o);let c;if(r?c=r:e?.workspaces&&(Array.isArray(e.workspaces)?c=e.workspaces:e.workspaces.packages&&(c=e.workspaces.packages)),!c)return t;const a=j(o,c);for(const s of a){const n=g(u(o,s,"package.json"));n&&t.push(n)}return t},"collectWorkspacePackageJsons"),P=l((o,t)=>{const e=new Set,r=[],c=new Map;for(const s of t){const n=c.get(s.name);n?n.push(s):c.set(s.name,[s])}const a=l(s=>{if(s)for(const n of Object.keys(s))e.has(n)||(e.add(n),r.push(n))},"enqueueRoots");for(const s of v(o))a(s.dependencies),a(s.peerDependencies),a(s.optionalDependencies);for(;r.length>0;){const s=r.shift(),n=c.get(s);if(n){for(const i of n)for(const p of[i.dependencies,i.peerDependencies,i.optionalDependencies])if(p)for(const f of Object.keys(p))e.has(f)||(e.add(f),r.push(f))}}return e},"computeProdReachable"),C=l((o,t,e={})=>{const r=m(o,t);if(!r)return[];let c;try{c=d(u(o,r.file))}catch{return[]}const a=h(c,r.type);if(a.length===0)return[];const s=e.includeDev??!0?void 0:P(o,a),n=new Set,i=[];for(const p of a){if(s&&!s.has(p.name))continue;const f=`${p.name}@${p.version}`;n.has(f)||(n.add(f),i.push({isDev:!1,name:p.name,version:p.version}))}return i},"lockedPackages"),E=l((o,t)=>{const e=m(o,t);if(!e)return[];let r;try{r=d(u(o,e.file))}catch{return[]}const c=h(r,e.type);if(c.length===0)return[];const a=new Map;for(const n of c)a.has(n.name)||a.set(n.name,new Set),a.get(n.name).add(n.version);const s=[];for(const[n,i]of a)i.size<=1||s.push({name:n,versions:[...i]});return s.sort((n,i)=>n.name.localeCompare(i.name))},"findDuplicateDependencies"),F=l((o,t)=>{const e=m(o,t);if(!e)return;let r;try{r=d(u(o,e.file))}catch{return}const c=h(r,e.type);if(c.length===0)return;const a=[],s=new Set;for(const n of v(o))for(const i of[n.dependencies,n.devDependencies,n.peerDependencies,n.optionalDependencies])if(i)for(const[p,f]of Object.entries(i)){const k=`${p}@${f}`;s.has(k)||(s.add(k),a.push({name:p,version:f}))}return{entries:c,roots:a}},"loadLockfileGraph");export{S as L,F as a,E as f,C as l,m as r};
1
+ var D=Object.defineProperty;var y=(o,t)=>D(o,"name",{value:t,configurable:!0});import{i as w,M as u,$ as d}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{F as h}from"./lockfile-DmDfgKaT.js";import{l as b,J as j}from"../packem_chunks/bin.js";var L=Object.defineProperty,l=y((o,t)=>L(o,"name",{value:t,configurable:!0}),"f");const S={bun:{file:"bun.lock",type:"bun"},npm:{aliases:["npm-shrinkwrap.json"],file:"package-lock.json",type:"npm"},pnpm:{file:"pnpm-lock.yaml",type:"pnpm"},yarn:{file:"yarn.lock",type:"yarn"}},O=l(o=>{const t=S[o];return t?[...t.aliases??[],t.file].map(e=>({file:e,type:t.type})):[]},"lockfileCandidates"),m=l((o,t)=>{const e=O(t);if(e.length!==0)return e.find(r=>w(u(o,r.file)))??e[e.length-1]},"resolveLockfile"),g=l(o=>{try{return JSON.parse(d(o))}catch{return}},"readPackageJsonShape"),v=l(o=>{const t=[],e=g(u(o,"package.json"));e&&t.push(e);const r=b(o);let c;if(r?c=r:e?.workspaces&&(Array.isArray(e.workspaces)?c=e.workspaces:e.workspaces.packages&&(c=e.workspaces.packages)),!c)return t;const a=j(o,c);for(const s of a){const n=g(u(o,s,"package.json"));n&&t.push(n)}return t},"collectWorkspacePackageJsons"),P=l((o,t)=>{const e=new Set,r=[],c=new Map;for(const s of t){const n=c.get(s.name);n?n.push(s):c.set(s.name,[s])}const a=l(s=>{if(s)for(const n of Object.keys(s))e.has(n)||(e.add(n),r.push(n))},"enqueueRoots");for(const s of v(o))a(s.dependencies),a(s.peerDependencies),a(s.optionalDependencies);for(;r.length>0;){const s=r.shift(),n=c.get(s);if(n){for(const i of n)for(const p of[i.dependencies,i.peerDependencies,i.optionalDependencies])if(p)for(const f of Object.keys(p))e.has(f)||(e.add(f),r.push(f))}}return e},"computeProdReachable"),C=l((o,t,e={})=>{const r=m(o,t);if(!r)return[];let c;try{c=d(u(o,r.file))}catch{return[]}const a=h(c,r.type);if(a.length===0)return[];const s=e.includeDev??!0?void 0:P(o,a),n=new Set,i=[];for(const p of a){if(s&&!s.has(p.name))continue;const f=`${p.name}@${p.version}`;n.has(f)||(n.add(f),i.push({isDev:!1,name:p.name,version:p.version}))}return i},"lockedPackages"),E=l((o,t)=>{const e=m(o,t);if(!e)return[];let r;try{r=d(u(o,e.file))}catch{return[]}const c=h(r,e.type);if(c.length===0)return[];const a=new Map;for(const n of c)a.has(n.name)||a.set(n.name,new Set),a.get(n.name).add(n.version);const s=[];for(const[n,i]of a)i.size<=1||s.push({name:n,versions:[...i]});return s.sort((n,i)=>n.name.localeCompare(i.name))},"findDuplicateDependencies"),F=l((o,t)=>{const e=m(o,t);if(!e)return;let r;try{r=d(u(o,e.file))}catch{return}const c=h(r,e.type);if(c.length===0)return;const a=[],s=new Set;for(const n of v(o))for(const i of[n.dependencies,n.devDependencies,n.peerDependencies,n.optionalDependencies])if(i)for(const[p,f]of Object.entries(i)){const k=`${p}@${f}`;s.has(k)||(s.add(k),a.push({name:p,version:f}))}return{entries:c,roots:a}},"loadLockfileGraph");export{S as L,F as a,E as f,C as l,m as r};
@@ -1,4 +1,4 @@
1
- var pa=Object.defineProperty;var c=(h,n)=>pa(h,"name",{value:n,configurable:!0});import{createRequire as da}from"node:module";import{b as va,n as Do,B as Ji}from"../packem_chunks/config.js";import{K as ci,M as Be,i as Aa,z as ba}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{bf as Ca,bg as $a}from"../packem_chunks/bin.js";import"./index-CS6a2wFB.js";const ha=da(import.meta.url),vr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ga=c(h=>{if(typeof vr<"u"&&vr.versions&&vr.versions.node){const[n,m]=vr.versions.node.split(".").map(Number);if(n>22||n===22&&m>=3||n===20&&m>=16)return vr.getBuiltinModule(h)}return ha(h)},"__cjs_getBuiltinModule"),{cpSync:No,lstatSync:ma,readdirSync:ya,existsSync:Mo,rmSync:si,readFileSync:Vi}=ga("node:fs");var Sa=Object.defineProperty,Ea=c((h,n)=>Sa(h,"name",{value:n,configurable:!0}),"t");class ft extends Error{static{c(this,"LockfilePruneError")}static{Ea(this,"LockfilePruneError")}constructor(n){super(n),this.name="LockfilePruneError"}}var wa=Object.defineProperty,Bt=c((h,n)=>wa(h,"name",{value:n,configurable:!0}),"p$2");const qo=Bt(h=>{let n=h.startsWith("/")?h.slice(1):h;const m=n.indexOf("(");return m!==-1&&(n=n.slice(0,m)),n},"canonicalKey"),ka=Bt((h,n)=>{if(!(n.startsWith("link:")||n.startsWith("file:")||n.startsWith("workspace:")))return`${h}@${n}`},"resolveDepKey"),xa=Bt(h=>{const n=[];for(const m of[h.dependencies,h.devDependencies,h.optionalDependencies])if(m)for(const[v,$]of Object.entries(m))$?.version&&n.push({name:v,version:$.version});return n},"collectImporterDeps"),Ki=Bt(h=>{const n=[];for(const m of[h.dependencies,h.optionalDependencies])if(m)for(const[v,$]of Object.entries(m))typeof $=="string"&&n.push({name:v,version:$});return n},"collectPackageDeps"),Gi=Bt(h=>{const n=new Map;if(!h)return n;for(const m of Object.keys(h)){const v=qo(m),$=n.get(v);$?$.push(m):n.set(v,[m])}return n},"buildKeyIndex"),Yo=Bt(h=>{const n=h.displayName??"pnpm-lock.yaml",m=typeof h.lockfileContent=="string"?h.lockfileContent:h.lockfileContent.toString("utf8");let v;try{v=Ca(m)}catch(oe){throw new ft(`${n}: parse failed — ${oe.message}`)}const $=Bt(oe=>oe.packages?Object.keys(oe.packages).length:0,"packageCount");let a;for(const oe of v){const[T]=oe.errors;if(T)throw new ft(`${n}: parse failed — ${T.message}`);const ne=oe.toJS();if(!ne||typeof ne!="object")continue;const me=ne;(a===void 0||$(me)>$(a))&&(a=me)}if(a===void 0)throw new ft(`${n}: top-level value is not an object`);const g=a.importers??{},e=Gi(a.packages),C=Gi(a.snapshots),k=new Set(["."]);for(const oe of h.closure)k.add(oe.relativeRoot===""?".":oe.relativeRoot);const b={};for(const[oe,T]of Object.entries(g))k.has(oe)&&(b[oe]=T);const S=new Set,O=new Set,H=[];for(const oe of Object.values(b))for(const T of xa(oe))H.push(T);for(;H.length>0;){const{name:oe,version:T}=H.shift(),ne=ka(oe,T);if(!ne)continue;const me=qo(ne),U=C.get(me)??C.get(ne)??[];for(const be of U){if(O.has(be))continue;O.add(be);const ye=a.snapshots?.[be];if(ye)for(const je of Ki(ye))H.push(je)}const ue=e.get(me)??e.get(ne)??[];for(const be of ue){if(S.has(be))continue;S.add(be);const ye=a.packages?.[be];if(ye&&!a.snapshots)for(const je of Ki(ye))H.push(je)}}const A={lockfileVersion:a.lockfileVersion};for(const oe of["settings","overrides","patchedDependencies","catalogs"])a[oe]!==void 0&&(A[oe]=a[oe]);if(A.importers=b,a.packages){const oe={};for(const T of Object.keys(a.packages))S.has(T)&&(oe[T]=a.packages[T]);A.packages=oe}if(a.snapshots){const oe={};for(const T of Object.keys(a.snapshots))O.has(T)&&(oe[T]=a.snapshots[T]);A.snapshots=oe}const y=Object.keys(a.packages??{}).length,E=Object.keys(A.packages??{}).length,X=y-E,fe=Object.keys(g).length-Object.keys(b).length;return{content:$a(A,{lineWidth:0}),message:`${n}: kept ${E}/${y} packages and ${Object.keys(b).length} importers (dropped ${X} packages, ${fe} importers)`,status:"pruned"}},"prunePnpmLockfile");var Oa=Object.defineProperty,ja=c((h,n)=>Oa(h,"name",{value:n,configurable:!0}),"p$1");const _a=ja(h=>Yo({...h,displayName:h.displayName??"aube-lock.yaml"}),"pruneAubeLockfile");var Ta=Object.defineProperty,Sr=c((h,n)=>Ta(h,"name",{value:n,configurable:!0}),"p");const Ra=Sr(h=>{let n="",m=!1,v=!1,$=!1;for(let a=0;a<h.length;a+=1){const g=h[a],e=h[a+1];if(v){g===`
1
+ var pa=Object.defineProperty;var c=(h,n)=>pa(h,"name",{value:n,configurable:!0});import{createRequire as da}from"node:module";import{d as va,n as Do,B as Ji}from"../packem_chunks/config.js";import{K as ci,M as Be,i as Aa,z as ba}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{c2 as Ca,c3 as $a}from"../packem_chunks/bin.js";import"./_commonjsHelpers-CLblCigl.js";const ha=da(import.meta.url),vr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ga=c(h=>{if(typeof vr<"u"&&vr.versions&&vr.versions.node){const[n,m]=vr.versions.node.split(".").map(Number);if(n>22||n===22&&m>=3||n===20&&m>=16)return vr.getBuiltinModule(h)}return ha(h)},"__cjs_getBuiltinModule"),{cpSync:No,lstatSync:ma,readdirSync:ya,existsSync:Mo,rmSync:si,readFileSync:Vi}=ga("node:fs");var Sa=Object.defineProperty,Ea=c((h,n)=>Sa(h,"name",{value:n,configurable:!0}),"t");class ft extends Error{static{c(this,"LockfilePruneError")}static{Ea(this,"LockfilePruneError")}constructor(n){super(n),this.name="LockfilePruneError"}}var wa=Object.defineProperty,Bt=c((h,n)=>wa(h,"name",{value:n,configurable:!0}),"p$2");const qo=Bt(h=>{let n=h.startsWith("/")?h.slice(1):h;const m=n.indexOf("(");return m!==-1&&(n=n.slice(0,m)),n},"canonicalKey"),ka=Bt((h,n)=>{if(!(n.startsWith("link:")||n.startsWith("file:")||n.startsWith("workspace:")))return`${h}@${n}`},"resolveDepKey"),xa=Bt(h=>{const n=[];for(const m of[h.dependencies,h.devDependencies,h.optionalDependencies])if(m)for(const[v,$]of Object.entries(m))$?.version&&n.push({name:v,version:$.version});return n},"collectImporterDeps"),Ki=Bt(h=>{const n=[];for(const m of[h.dependencies,h.optionalDependencies])if(m)for(const[v,$]of Object.entries(m))typeof $=="string"&&n.push({name:v,version:$});return n},"collectPackageDeps"),Gi=Bt(h=>{const n=new Map;if(!h)return n;for(const m of Object.keys(h)){const v=qo(m),$=n.get(v);$?$.push(m):n.set(v,[m])}return n},"buildKeyIndex"),Yo=Bt(h=>{const n=h.displayName??"pnpm-lock.yaml",m=typeof h.lockfileContent=="string"?h.lockfileContent:h.lockfileContent.toString("utf8");let v;try{v=Ca(m)}catch(oe){throw new ft(`${n}: parse failed — ${oe.message}`)}const $=Bt(oe=>oe.packages?Object.keys(oe.packages).length:0,"packageCount");let a;for(const oe of v){const[T]=oe.errors;if(T)throw new ft(`${n}: parse failed — ${T.message}`);const ne=oe.toJS();if(!ne||typeof ne!="object")continue;const me=ne;(a===void 0||$(me)>$(a))&&(a=me)}if(a===void 0)throw new ft(`${n}: top-level value is not an object`);const g=a.importers??{},e=Gi(a.packages),C=Gi(a.snapshots),k=new Set(["."]);for(const oe of h.closure)k.add(oe.relativeRoot===""?".":oe.relativeRoot);const b={};for(const[oe,T]of Object.entries(g))k.has(oe)&&(b[oe]=T);const S=new Set,O=new Set,H=[];for(const oe of Object.values(b))for(const T of xa(oe))H.push(T);for(;H.length>0;){const{name:oe,version:T}=H.shift(),ne=ka(oe,T);if(!ne)continue;const me=qo(ne),U=C.get(me)??C.get(ne)??[];for(const be of U){if(O.has(be))continue;O.add(be);const ye=a.snapshots?.[be];if(ye)for(const je of Ki(ye))H.push(je)}const ue=e.get(me)??e.get(ne)??[];for(const be of ue){if(S.has(be))continue;S.add(be);const ye=a.packages?.[be];if(ye&&!a.snapshots)for(const je of Ki(ye))H.push(je)}}const A={lockfileVersion:a.lockfileVersion};for(const oe of["settings","overrides","patchedDependencies","catalogs"])a[oe]!==void 0&&(A[oe]=a[oe]);if(A.importers=b,a.packages){const oe={};for(const T of Object.keys(a.packages))S.has(T)&&(oe[T]=a.packages[T]);A.packages=oe}if(a.snapshots){const oe={};for(const T of Object.keys(a.snapshots))O.has(T)&&(oe[T]=a.snapshots[T]);A.snapshots=oe}const y=Object.keys(a.packages??{}).length,E=Object.keys(A.packages??{}).length,X=y-E,fe=Object.keys(g).length-Object.keys(b).length;return{content:$a(A,{lineWidth:0}),message:`${n}: kept ${E}/${y} packages and ${Object.keys(b).length} importers (dropped ${X} packages, ${fe} importers)`,status:"pruned"}},"prunePnpmLockfile");var Oa=Object.defineProperty,ja=c((h,n)=>Oa(h,"name",{value:n,configurable:!0}),"p$1");const _a=ja(h=>Yo({...h,displayName:h.displayName??"aube-lock.yaml"}),"pruneAubeLockfile");var Ta=Object.defineProperty,Sr=c((h,n)=>Ta(h,"name",{value:n,configurable:!0}),"p");const Ra=Sr(h=>{let n="",m=!1,v=!1,$=!1;for(let a=0;a<h.length;a+=1){const g=h[a],e=h[a+1];if(v){g===`
2
2
  `&&(v=!1,n+=g);continue}if($){g==="*"&&e==="/"&&($=!1,a+=1);continue}if(m){if(g==="\\"){n+=g,e!==void 0&&(n+=e,a+=1);continue}g==='"'&&(m=!1),n+=g;continue}if(g==='"'){m=!0,n+=g;continue}if(g==="/"&&e==="/"){v=!0,a+=1;continue}if(g==="/"&&e==="*"){$=!0,a+=1;continue}n+=g}return n},"stripJsonComments"),La=Sr(h=>{const n=[];for(const m of[h.dependencies,h.devDependencies,h.optionalDependencies,h.peerDependencies])if(m)for(const[v,$]of Object.entries(m))typeof $=="string"&&n.push({name:v,spec:$});return n},"collectWorkspaceDeps"),Fa=Sr(h=>{for(const n of h)if(typeof n=="object"&&!Array.isArray(n))return n},"extractMetadata"),Pa=Sr(h=>{if(!h)return[];const n=[];for(const m of["dependencies","optionalDependencies","peerDependencies"]){const v=h[m];v!==null&&typeof v=="object"&&!Array.isArray(v)&&n.push(...Object.keys(v))}return n},"collectMetadataDeps"),Ia=Sr(h=>{if(Buffer.isBuffer(h.lockfileContent))return{message:"bun.lockb is binary; run `bun install --save-text-lockfile` to regenerate as bun.lock, then rerun `vis docker scaffold`.",status:"skipped"};const n=Ra(h.lockfileContent);let m;try{m=JSON.parse(n)}catch(y){throw new ft(`bun.lock: parse failed — ${y.message}`)}if(!m||typeof m!="object")throw new ft("bun.lock: top-level value is not an object");const v=m.workspaces??{},$=m.packages??{},a=new Set([""]);for(const y of h.closure)a.add(y.relativeRoot===""?"":y.relativeRoot);const g={},e=[];for(const[y,E]of Object.entries(v))a.has(y)&&(g[y]=E,e.push(...La(E)));const C=new Set;for(const{name:y}of e)C.add(y);const k=[...C];for(;k.length>0;){const y=k.shift();for(const E of Object.keys($)){if(E.split("/")[0]!==y&&E!==y)continue;const X=Fa($[E]);for(const fe of Pa(X))C.has(fe)||(C.add(fe),k.push(fe))}}const b={};for(const[y,E]of Object.entries($)){const X=y.split("/")[0];(C.has(X)||C.has(y))&&(b[y]=E)}const S={...m,packages:b,workspaces:g},O=Object.keys($).length,H=Object.keys(b).length,A=O-H;return{content:`${JSON.stringify(S,null,2)}
3
3
  `,message:`bun.lock: kept ${H}/${O} packages (dropped ${A})`,status:"pruned"}},"pruneBunLockfile");var Na=Object.defineProperty,li=c((h,n)=>Na(h,"name",{value:n,configurable:!0}),"k");const _n="node_modules/",Ma=li((h,n,m)=>{let v=n;for(;;){const $=v===""?`${_n}${m}`:`${v}/${_n}${m}`;if(h[$]!==void 0)return $;if(v==="")return;const a=v.lastIndexOf(`/${_n.slice(0,-1)}/`);v=a===-1?"":v.slice(0,a)}},"resolveDep"),Da=li(h=>{const n=[];for(const m of[h.dependencies,h.devDependencies,h.optionalDependencies,h.peerDependencies])if(m)for(const v of Object.keys(m))n.push(v);return n},"collectDepNames"),qa=li(h=>{const n=h.displayName??"package-lock.json",m=typeof h.lockfileContent=="string"?h.lockfileContent:h.lockfileContent.toString("utf8");let v;try{v=JSON.parse(m)}catch(A){throw new ft(`${n}: parse failed — ${A.message}`)}if(!v||typeof v!="object")throw new ft(`${n}: top-level value is not an object`);const $=v.packages??{},a=new Set([""]);for(const A of h.closure)A.relativeRoot!==""&&a.add(A.relativeRoot);const g=new Set,e=[];for(const A of Object.keys($))a.has(A)&&(g.add(A),e.push(A));for(const[A,y]of Object.entries($))y.link===!0&&typeof y.resolved=="string"&&a.has(y.resolved)&&g.add(A);for(;e.length>0;){const A=e.shift(),y=$[A];if(y)for(const E of Da(y)){const X=Ma($,A,E);if(!X||g.has(X))continue;g.add(X);const fe=$[X];fe.link===!0&&typeof fe.resolved=="string"&&$[fe.resolved]!==void 0&&!g.has(fe.resolved)?(g.add(fe.resolved),e.push(fe.resolved)):e.push(X)}}const C={};for(const A of Object.keys($))g.has(A)&&(C[A]=$[A]);const k=C[""];k&&Array.isArray(k.workspaces)&&(k.workspaces=k.workspaces.filter(A=>{if(typeof A!="string")return!1;const y=A.replace(/\/?\*+$/,"").replace(/\/$/,"");if(y===""||y==="*")return!0;for(const E of a)if(E===A||E===y||E.startsWith(`${y}/`))return!0;return!1}));const b={...v,packages:C};delete b.dependencies;const S=Object.keys($).length,O=Object.keys(C).length,H=S-O;return{content:`${JSON.stringify(b,null,2)}
4
4
  `,message:`${n}: kept ${O}/${S} entries (dropped ${H})`,status:"pruned"}},"pruneNpmLockfile");var Tn={},Fe={},Rn,Qi;function Ya(){if(Qi)return Rn;Qi=1;var h=Object.defineProperty,n=c((a,g)=>h(a,"name",{value:g,configurable:!0}),"a");function m(a,g){function e(){this.constructor=a}c(e,"s"),n(e,"ctor"),e.prototype=g.prototype,a.prototype=new e}c(m,"peg$subclass"),n(m,"peg$subclass");function v(a,g,e,C){this.message=a,this.expected=g,this.found=e,this.location=C,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,v)}c(v,"peg$SyntaxError"),n(v,"peg$SyntaxError"),m(v,Error),v.buildMessage=function(a,g){var e={literal:n(function(A){return'"'+k(A.text)+'"'},"literal"),class:n(function(A){var y="",E;for(E=0;E<A.parts.length;E++)y+=A.parts[E]instanceof Array?b(A.parts[E][0])+"-"+b(A.parts[E][1]):b(A.parts[E]);return"["+(A.inverted?"^":"")+y+"]"},"class"),any:n(function(A){return"any character"},"any"),end:n(function(A){return"end of input"},"end"),other:n(function(A){return A.description},"other")};function C(A){return A.charCodeAt(0).toString(16).toUpperCase()}c(C,"T"),n(C,"hex");function k(A){return A.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(y){return"\\x0"+C(y)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(y){return"\\x"+C(y)})}c(k,"q"),n(k,"literalEscape");function b(A){return A.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(y){return"\\x0"+C(y)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(y){return"\\x"+C(y)})}c(b,"_"),n(b,"classEscape");function S(A){return e[A.type](A)}c(S,"re"),n(S,"describeExpectation");function O(A){var y=new Array(A.length),E,X;for(E=0;E<A.length;E++)y[E]=S(A[E]);if(y.sort(),y.length>0){for(E=1,X=1;E<y.length;E++)y[E-1]!==y[E]&&(y[X]=y[E],X++);y.length=X}switch(y.length){case 1:return y[0];case 2:return y[0]+" or "+y[1];default:return y.slice(0,-1).join(", ")+", or "+y[y.length-1]}}c(O,"le"),n(O,"describeExpected");function H(A){return A?'"'+k(A)+'"':"end of input"}return c(H,"te"),n(H,"describeFound"),"Expected "+O(a)+" but "+H(g)+" found."};function $(a,g){g=g!==void 0?g:{};var e={},C={Start:pn},k=pn,b=n(function(t){return t||[]},"peg$c0"),S=n(function(t,o,u){return[{command:t,type:o}].concat(u||[])},"peg$c1"),O=n(function(t,o){return[{command:t,type:o||";"}]},"peg$c2"),H=n(function(t){return t},"peg$c3"),A=";",y=ce(";",!1),E="&",X=ce("&",!1),fe=n(function(t,o){return o?{chain:t,then:o}:{chain:t}},"peg$c8"),oe=n(function(t,o){return{type:t,line:o}},"peg$c9"),T="&&",ne=ce("&&",!1),me="||",U=ce("||",!1),ue=n(function(t,o){return o?{...t,then:o}:t},"peg$c14"),be=n(function(t,o){return{type:t,chain:o}},"peg$c15"),ye="|&",je=ce("|&",!1),Me="|",De=ce("|",!1),qe="=",rt=ce("=",!1),Ee=n(function(t,o){return{name:t,args:[o]}},"peg$c22"),He=n(function(t){return{name:t,args:[]}},"peg$c23"),Ge="(",Qe=ce("(",!1),re=")",Pe=ce(")",!1),We=n(function(t,o){return{type:"subshell",subshell:t,args:o}},"peg$c28"),ke="{",xe=ce("{",!1),$e="}",Le=ce("}",!1),Ae=n(function(t,o){return{type:"group",group:t,args:o}},"peg$c33"),Ye=n(function(t,o){return{type:"command",args:o,envs:t}},"peg$c34"),Ue=n(function(t){return{type:"envs",envs:t}},"peg$c35"),Ve=n(function(t){return t},"peg$c36"),Je=n(function(t){return t},"peg$c37"),q=/^[0-9]/,W=Ze([["0","9"]],!1,!1),se=n(function(t,o,u){return{type:"redirection",subtype:o,fd:t!==null?parseInt(t):null,args:[u]}},"peg$c40"),Ce=">>",nt=ce(">>",!1),at=">&",st=ce(">&",!1),At=">",Ke=ce(">",!1),pt="<<<",et=ce("<<<",!1),ze="<&",dt=ce("<&",!1),bt="<",ht=ce("<",!1),r=n(function(t){return{type:"argument",segments:[].concat(...t)}},"peg$c53"),_=n(function(t){return t},"peg$c54"),R="$'",z=ce("$'",!1),Y="'",l=ce("'",!1),w=n(function(t){return[{type:"text",text:t}]},"peg$c59"),L='""',F=ce('""',!1),D=n(function(){return{type:"text",text:""}},"peg$c62"),V='"',P=ce('"',!1),Z=n(function(t){return t},"peg$c65"),J=n(function(t){return{type:"arithmetic",arithmetic:t,quoted:!0}},"peg$c66"),ie=n(function(t){return{type:"shell",shell:t,quoted:!0}},"peg$c67"),ve=n(function(t){return{type:"variable",...t,quoted:!0}},"peg$c68"),pe=n(function(t){return{type:"text",text:t}},"peg$c69"),_e=n(function(t){return{type:"arithmetic",arithmetic:t,quoted:!1}},"peg$c70"),Qr=n(function(t){return{type:"shell",shell:t,quoted:!1}},"peg$c71"),zr=n(function(t){return{type:"variable",...t,quoted:!1}},"peg$c72"),wr=n(function(t){return{type:"glob",pattern:t}},"peg$c73"),Ut=/^[^']/,Wt=Ze(["'"],!0,!1),wt=n(function(t){return t.join("")},"peg$c76"),kr=/^[^$"]/,xr=Ze(["$",'"'],!0,!1),tr=`\\
@@ -1,2 +1,2 @@
1
- var m=Object.defineProperty;var a=(t,e)=>m(t,"name",{value:e,configurable:!0});import{createRequire as p}from"node:module";import{M as v}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{d as j}from"../packem_chunks/bin.js";const h=p(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=a(t=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[e,r]=s.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return s.getBuiltinModule(t)}return h(t)},"__cjs_getBuiltinModule"),{mkdirSync:y,writeFileSync:F,readdirSync:L}=u("node:fs"),{readFile:_}=u("node:fs/promises");var S=Object.defineProperty,i=a((t,e)=>S(t,"name",{value:e,configurable:!0}),"i");const c=i(t=>j(t),"getFailureLogDirectory"),l=i((t,e)=>v(c(t),`${encodeURIComponent(e)}.json`),"getFailureLogPath");class R{static{a(this,"FailureLogLifeCycle")}static{i(this,"FailureLogLifeCycle")}#e;#t;constructor(e,r){this.#e=e,this.#t=r}printTaskTerminalOutput(e,r,o){if(r!=="failure")return;const n=c(this.#e);try{y(n,{recursive:!0})}catch{return}const d=e.overrides.command,f=e.projectRoot,g={command:d,cwd:f,exitCode:void 0,hash:e.hash,runId:this.#t,status:r,taskId:e.id,terminalOutput:o,timestamp:new Date().toISOString()};try{F(l(this.#e,e.id),`${JSON.stringify(g,void 0,2)}
1
+ var m=Object.defineProperty;var a=(t,e)=>m(t,"name",{value:e,configurable:!0});import{createRequire as p}from"node:module";import{M as j}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{j as v}from"../packem_chunks/bin.js";const h=p(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=a(t=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[e,r]=s.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return s.getBuiltinModule(t)}return h(t)},"__cjs_getBuiltinModule"),{mkdirSync:y,writeFileSync:F,readdirSync:L}=u("node:fs"),{readFile:_}=u("node:fs/promises");var S=Object.defineProperty,i=a((t,e)=>S(t,"name",{value:e,configurable:!0}),"i");const c=i(t=>v(t),"getFailureLogDirectory"),l=i((t,e)=>j(c(t),`${encodeURIComponent(e)}.json`),"getFailureLogPath");class R{static{a(this,"FailureLogLifeCycle")}static{i(this,"FailureLogLifeCycle")}#e;#t;constructor(e,r){this.#e=e,this.#t=r}printTaskTerminalOutput(e,r,o){if(r!=="failure")return;const n=c(this.#e);try{y(n,{recursive:!0})}catch{return}const d=e.overrides.command,f=e.projectRoot,g={command:d,cwd:f,exitCode:void 0,hash:e.hash,runId:this.#t,status:r,taskId:e.id,terminalOutput:o,timestamp:new Date().toISOString()};try{F(l(this.#e,e.id),`${JSON.stringify(g,void 0,2)}
2
2
  `,"utf8")}catch{}}}const T=i(async(t,e)=>{const r=l(t,e);try{const o=await _(r,"utf8");return JSON.parse(o)}catch{return}},"loadFailureLog"),w=i(t=>{const e=c(t);let r;try{r=L(e)}catch{return[]}const o=[];for(const n of r)if(n.endsWith(".json"))try{o.push(decodeURIComponent(n.slice(0,-5)))}catch{}return o},"listFailureLogs");export{R as F,T as a,w as l};
@@ -0,0 +1,29 @@
1
+ var Rn=Object.defineProperty;var N=(t,e)=>Rn(t,"name",{value:e,configurable:!0});import{createRequire as zn}from"node:module";import"./_commonjsHelpers-CLblCigl.js";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
2
+ const require = __cjs_mod__.createRequire(import.meta.url);
3
+ const Fn=zn(import.meta.url),pe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Wn=N(t=>{if(typeof pe<"u"&&pe.versions&&pe.versions.node){const[e,n]=pe.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return pe.getBuiltinModule(t)}return Fn(t)},"__cjs_getBuiltinModule"),{createRequire:Ke}=Wn("node:module"),qn=16,et=32,Gn=64,re=128,Oe="positionals";var Hn=Object.defineProperty,_t=N((t,e)=>Hn(t,"name",{value:e,configurable:!0}),"i$6"),Kn=Object.defineProperty,Lt=_t((t,e)=>Kn(t,"name",{value:e,configurable:!0}),"s"),Jn=Object.defineProperty,St=Lt((t,e)=>Jn(t,"name",{value:e,configurable:!0}),"s"),Zn=Object.defineProperty,Tt=St((t,e)=>Zn(t,"name",{value:e,configurable:!0}),"i"),Yn=Object.defineProperty,It=Tt((t,e)=>Yn(t,"name",{value:e,configurable:!0}),"t");It(t=>t instanceof Error&&t.type==="VisulimaError","isVisulimaError");let Qn=class extends Error{static{N(this,"V")}static{_t(this,"g")}static{Lt(this,"p")}static{St(this,"V")}static{Tt(this,"VisulimaError")}static{It(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:e,hint:n,location:i,message:r,name:o,stack:l,title:s}){super(r,{cause:e}),this.title=s,this.name=o,this.stack=l??this.stack,this.loc=i,this.hint=n}setLocation(e){this.loc=e}setName(e){this.name=e}setMessage(e){this.message=e}setHint(e){this.hint=e}};var Xn=Object.defineProperty,Mt=N((t,e)=>Xn(t,"name",{value:e,configurable:!0}),"t$3"),ei=Object.defineProperty,Vt=Mt((t,e)=>ei(t,"name",{value:e,configurable:!0}),"t"),ti=Object.defineProperty,ni=Vt((t,e)=>ti(t,"name",{value:e,configurable:!0}),"e");let E=class extends Qn{static{N(this,"m")}static{Mt(this,"u")}static{Vt(this,"c")}static{ni(this,"CerebroError")}code;context;constructor(e,n,i){super({message:e,name:"CerebroError"}),this.code=n,this.context=i}};var ii=Object.defineProperty,oi=N((t,e)=>ii(t,"name",{value:e,configurable:!0}),"a$2"),ri=Object.defineProperty,ai=oi((t,e)=>ri(t,"name",{value:e,configurable:!0}),"l"),si=Object.defineProperty,T=ai((t,e)=>si(t,"name",{value:e,configurable:!0}),"r");const B=T(t=>"Deno"in t,"hasDeno"),D=T(t=>"Bun"in t,"hasBun"),xe=T(()=>{if(B(globalThis)){const t=globalThis.Deno,e=t.execPath();let n=e;try{const{importMeta:i}=globalThis;i?.url&&(n=i.url)}catch{}return[e,n,...t.args]}return D(globalThis)?globalThis.Bun.process.argv:process.argv},"getArgv"),li=T(()=>B(globalThis)?globalThis.Deno.cwd():D(globalThis)?globalThis.Bun.process.cwd():process.cwd(),"getCwd"),H=T(()=>{if(B(globalThis)){const t=globalThis.Deno;return new Proxy(t.env.toObject(),{get:T((e,n)=>typeof n=="string"?t.env.get(n):e[n],"get"),has:T((e,n)=>typeof n=="string"?t.env.has(n):n in e,"has"),set:T((e,n,i)=>typeof n=="string"?(i===void 0||t.env.set(n,i),!0):!1,"set")})}return D(globalThis)?globalThis.Bun.process.env:process.env},"getEnv"),Ut=T(()=>B(globalThis)?[]:D(globalThis)?globalThis.Bun.process.execArgv:process.execArgv,"getExecArgv"),Bt=T(()=>B(globalThis)?globalThis.Deno.execPath():D(globalThis)?globalThis.Bun.process.execPath:process.execPath,"getExecPath"),ci=T(()=>{if(B(globalThis)){const t=globalThis.Deno.build?.os??"unknown";return t==="windows"?"win32":t}return D(globalThis)?globalThis.Bun.platform??"unknown":process.platform},"getPlatform"),ui=T(()=>{if(B(globalThis)){const t=globalThis.Deno.build?.arch??"unknown";return t==="x86_64"?"x64":t==="aarch64"?"arm64":t}return D(globalThis)?globalThis.Bun.process.arch:process.arch},"getArch");T(()=>{if(B(globalThis)){const t=globalThis.Deno,e={};return t.version?.deno&&(e.deno=t.version.deno),t.version?.v8&&(e.v8=t.version.v8),t.version?.typescript&&(e.typescript=t.version.typescript),e}if(D(globalThis)){const t=globalThis.Bun,e={...t.process.versions};return t.version&&(e.bun=t.version),e}return process.versions},"getVersions");const W=T((t=0)=>{if(B(globalThis))throw globalThis.Deno.exit(t),new Error("Deno exit failed");if(D(globalThis))throw globalThis.Bun.process.exit(t),new Error("Bun exit failed");process.exit(t)},"exitProcess"),tt=T((t,e)=>{if(B(globalThis))return()=>{};if(D(globalThis)){try{const i=globalThis.Bun;if(i.process?.on)return i.process.on(t,e),()=>{i.process?.removeListener&&i.process.removeListener(t,e)}}catch{}return()=>{}}const n=process;return n.on(t,e),()=>{n.removeListener(t,e)}},"onProcessEvent");var pi=Object.defineProperty,Ee=N((t,e)=>pi(t,"name",{value:e,configurable:!0}),"k$2");const F=new Uint32Array(65536),fi=Ee((t,e)=>{const n=t.length,i=e.length,r=1<<n-1;let o=-1,l=0,s=n,p=n;for(;p--;)F[t.charCodeAt(p)]|=1<<p;for(p=0;p<i;p++){let a=F[e.charCodeAt(p)];const c=a|l;a|=(a&o)+o^o,l|=~(a|o),o&=a,l&r&&s++,o&r&&s--,l=l<<1|1,o=o<<1|~(c|l),l&=c}for(p=n;p--;)F[t.charCodeAt(p)]=0;return s},"myers_32"),di=Ee((t,e)=>{const n=e.length,i=t.length,r=[],o=[],l=Math.ceil(n/32),s=Math.ceil(i/32);for(let u=0;u<l;u++)o[u]=-1,r[u]=0;let p=0;for(;p<s-1;p++){let u=0,v=-1;const w=p*32,y=Math.min(32,i)+w;for(let O=w;O<y;O++)F[t.charCodeAt(O)]|=1<<O;for(let O=0;O<n;O++){const A=F[e.charCodeAt(O)],h=o[O/32|0]>>>O&1,m=r[O/32|0]>>>O&1,b=A|u,$=((A|m)&v)+v^v|A|m;let P=u|~($|v),j=v&$;P>>>31^h&&(o[O/32|0]^=1<<O),j>>>31^m&&(r[O/32|0]^=1<<O),P=P<<1|h,j=j<<1|m,v=j|~(b|P),u=P&b}for(let O=w;O<y;O++)F[t.charCodeAt(O)]=0}let a=0,c=-1;const d=p*32,f=Math.min(32,i-d)+d;for(let u=d;u<f;u++)F[t.charCodeAt(u)]|=1<<u;let g=i;for(let u=0;u<n;u++){const v=F[e.charCodeAt(u)],w=o[u/32|0]>>>u&1,y=r[u/32|0]>>>u&1,O=v|a,A=((v|y)&c)+c^c|v|y;let h=a|~(A|c),m=c&A;g+=h>>>i-1&1,g-=m>>>i-1&1,h>>>31^w&&(o[u/32|0]^=1<<u),m>>>31^y&&(r[u/32|0]^=1<<u),h=h<<1|w,m=m<<1|y,c=m|~(O|h),a=h&O}for(let u=d;u<f;u++)F[t.charCodeAt(u)]=0;return g},"myers_x"),Dt=Ee((t,e)=>{if(t.length<e.length){const n=e;e=t,t=n}return e.length===0?t.length:t.length<=32?fi(t,e):di(t,e)},"distance");Ee((t,e)=>{let n=1/0,i=0;for(let r=0;r<e.length;r++){const o=Dt(t,e[r]);o<n&&(n=o,i=r)}return e[i]},"closest");var hi=Object.defineProperty,mi=N((t,e)=>hi(t,"name",{value:e,configurable:!0}),"a$1"),gi=Object.defineProperty,vi=mi((t,e)=>gi(t,"name",{value:e,configurable:!0}),"a"),bi=Object.defineProperty,yi=vi((t,e)=>bi(t,"name",{value:e,configurable:!0}),"p"),wi=Object.defineProperty,Rt=yi((t,e)=>wi(t,"name",{value:e,configurable:!0}),"e"),$i=Object.defineProperty,Oi=Rt((t,e)=>$i(t,"name",{value:e,configurable:!0}),"E");const zt=String.raw,nt=zt`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,xi=Oi(()=>new RegExp(zt`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${nt}(?:\u200D${nt})*`,"gu"),"default");var Pi=Object.defineProperty,Ai=Rt((t,e)=>Pi(t,"name",{value:e,configurable:!0}),"p");Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]]));const Mc=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,Vc=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,se=xi(),Ei=/[-_./\s]+/g,ge=/(\u001B\[[0-9;]*[a-z])/i,it=new RegExp("\\p{Script=Arabic}","u"),Ci=new RegExp("\\p{Script=Bengali}","u"),ie=new RegExp("\\p{Script=Cyrillic}","u"),Ni=new RegExp("\\p{Script=Devanagari}","u"),ki=new RegExp("\\p{Script=Ethiopic}","u"),Ue=new RegExp("\\p{Script=Greek}","u"),ot=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),ji=new RegExp("\\p{Script=Gujarati}","u"),_i=new RegExp("\\p{Script=Gurmukhi}","u"),rt=new RegExp("\\p{Script=Hangul}","u"),at=new RegExp("\\p{Script=Hebrew}","u"),Li=new RegExp("\\p{Script=Hiragana}","u"),st=new RegExp("\\p{Script=Han}","u"),Si=new RegExp("\\p{Script=Kannada}","u"),Ti=new RegExp("\\p{Script=Katakana}","u"),Ii=new RegExp("\\p{Script=Khmer}","u"),Mi=new RegExp("\\p{Script=Lao}","u"),I=new RegExp("\\p{Script=Latin}","u"),Vi=new RegExp("\\p{Script=Malayalam}","u"),Ui=new RegExp("\\p{Script=Myanmar}","u"),Bi=new RegExp("\\p{Script=Oriya}","u"),Di=new RegExp("\\p{Script=Sinhala}","u"),Ri=new RegExp("\\p{Script=Tamil}","u"),zi=new RegExp("\\p{Script=Telugu}","u"),Fi=new RegExp("\\p{Script=Thai}","u"),Wi=new RegExp("\\p{Script=Tibetan}","u"),lt=/[\u02BB\u02BC\u0027]/u,qi=Ai(t=>t.replace(se,""),"stripEmoji");var Gi=Object.defineProperty,S=N((t,e)=>Gi(t,"name",{value:e,configurable:!0}),"x$2"),Hi=Object.defineProperty,x=S((t,e)=>Hi(t,"name",{value:e,configurable:!0}),"O");const Ki=Ke(import.meta.url),fe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ft=x(t=>{if(typeof fe<"u"&&fe.versions&&fe.versions.node){const[e,n]=fe.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return fe.getBuiltinModule(t)}return Ki(t)},"__cjs_getBuiltinModule"),{writeFile:Ji,stat:Zi,rm:Yi,readFile:ct,readdir:Qi,mkdir:Xi,access:eo}=Ft("node:fs/promises"),{createRequire:to}=Ft("node:module"),ye=[{description:"Turn on verbose output",group:"global",name:"verbose",type:Boolean},{description:"Turn on debugging output",group:"global",name:"debug",type:Boolean},{alias:"h",description:"Print out helpful usage information",group:"global",name:"help",type:Boolean},{alias:"q",description:"Silence output",group:"global",name:"quiet",type:Boolean},{alias:"V",description:"Print version info",group:"global",name:"version",type:Boolean},{description:"Turn off colored output",group:"global",name:"no-color",type:Boolean},{description:"Force colored output",group:"global",name:"color",type:Boolean}];var no=Object.defineProperty,io=x((t,e)=>no(t,"name",{value:e,configurable:!0}),"t$9");let K=class extends E{static{N(this,"D")}static{S(this,"S")}static{x(this,"a")}static{io(this,"CommandNotFoundError")}commandName;constructor(e,n=[]){const i=`Command "${e}" not found${n.length>0?`. Did you mean: ${n.join(", ")}?`:""}`;super(i,"COMMAND_NOT_FOUND",{commandName:e,suggestions:n}),this.name="CommandNotFoundError",this.commandName=e,n.length>0&&(this.hint=`Try one of these commands: ${n.join(", ")}`)}};var oo=Object.defineProperty,ro=x((t,e)=>oo(t,"name",{value:e,configurable:!0}),"e$7");let Wt=class extends E{static{N(this,"at")}static{S(this,"at")}static{x(this,"o")}static{ro(this,"ConflictingOptionsError")}option1;option2;constructor(t,e){super(`Options "${t}" and "${e}" cannot be used together`,"CONFLICTING_OPTIONS",{option1:t,option2:e}),this.name="ConflictingOptionsError",this.option1=t,this.option2=e,this.hint=`Remove either --${t} or --${e}`}};var ao=Object.defineProperty,so=x((t,e)=>ao(t,"name",{value:e,configurable:!0}),"e$6");let lo=class extends E{static{N(this,"jn")}static{S(this,"jn")}static{x(this,"o")}static{so(this,"PluginError")}pluginName;constructor(t,e,n){super(`Plugin "${t}" error: ${e}`,"PLUGIN_ERROR",{originalError:n,pluginName:t}),this.name="PluginError",this.pluginName=t,n&&(this.cause=n)}};var co=Object.defineProperty,ut=x((t,e)=>co(t,"name",{value:e,configurable:!0}),"d$7");let uo=class{static{N(this,"Mn")}static{S(this,"Un")}static{x(this,"p")}static{ut(this,"PluginManager")}logger;plugins=new Map;initialized=!1;cachedDependencyOrder=void 0;constructor(t){this.logger=t}hasPlugins(){return this.plugins.size>0}register(t){if(this.initialized)throw new Error(`Cannot register plugin "${t.name}" after initialization`);if(this.plugins.has(t.name))throw new Error(`Plugin "${t.name}" is already registered`);H().CEREBRO_OUTPUT_LEVEL===String(re)&&this.logger.debug(`registering plugin: ${t.name}`),this.plugins.set(t.name,t),this.cachedDependencyOrder=void 0}async init(t){if(this.initialized)throw new Error("PluginManager already initialized");if(this.plugins.size===0){this.logger.debug("no plugins registered, skipping initialization"),this.initialized=!0;return}this.validateDependencies();const e=this.getDependencyOrder();this.logger.debug(`initializing ${String(e.length)} plugin(s)...`);for(const n of e)if(typeof n.init=="function"){this.logger.debug(`initializing plugin: ${n.name}`);try{await n.init(t)}catch(i){const r=new lo(n.name,`Failed to initialize: ${i instanceof Error?i.message:String(i)}`,i instanceof Error?i:void 0);throw this.logger.error(r.message),r}}this.initialized=!0}async executeLifecycle(t,e,n){if(!this.initialized)throw new Error("PluginManager not initialized");if(this.plugins.size===0)return;const i=this.getDependencyOrder();for(const r of i){const o=r[t];if(typeof o=="function"){this.logger.debug(`executing ${t} hook for plugin: ${r.name}`);try{await(t==="afterCommand"?o(e,n):o(e))}catch(l){throw this.logger.error(`Error in ${t} hook for plugin "${r.name}":`,l),l}}}}async executeErrorHandlers(t,e){if(!this.initialized||this.plugins.size===0)return;const n=this.getDependencyOrder();for(const i of n)if(typeof i.onError=="function"){this.logger.debug(`executing error handler for plugin: ${i.name}`);try{await i.onError(t,e)}catch(r){this.logger.error(`Error in error handler for plugin "${i.name}":`,r)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const t=[],e=new Set,n=new Set,i=ut(r=>{if(e.has(r))return;if(n.has(r))throw new Error(`Circular dependency detected involving plugin "${r}"`);const o=this.plugins.get(r);if(!o)throw new Error(`Plugin "${r}" not found`);if(n.add(r),o.dependencies)for(const l of o.dependencies)i(l);n.delete(r),e.add(r),t.push(o)},"visit");for(const r of this.plugins.keys())i(r);return this.cachedDependencyOrder=t,t}validateDependencies(){for(const t of this.plugins.values())if(t.dependencies){for(const e of t.dependencies)if(!this.plugins.has(e))throw new Error(`Plugin "${t.name}" depends on "${e}" which is not registered`)}}};var po=Object.defineProperty,fo=x((t,e)=>po(t,"name",{value:e,configurable:!0}),"n$a");const ve=fo(t=>t.type?.name==="Boolean","optionIsBoolean");var ho=Object.defineProperty,qt=x((t,e)=>ho(t,"name",{value:e,configurable:!0}),"p$9");const mo=qt(t=>{let e=t.type?t.type.name.toLowerCase():"string";const n=t.multiple??t.lazyMultiple?"[]":"";return e&&(e=e==="boolean"?"":`{underline ${e}${n}}`),e},"getTypeLabel"),pt=qt(t=>(ve(t)||(t.typeLabel=t.typeLabel??mo(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),"mapOptionTypeLabel");var go=Object.defineProperty,Gt=x((t,e)=>go(t,"name",{value:e,configurable:!0}),"e$4");const vo=new RegExp(/^-([^\d-])$/),bo=new RegExp(/^--(\S+)/),yo=new RegExp(/^-([^\d-]{2,})$/),wo=Gt(t=>vo.test(t)||bo.test(t)||yo.test(t),"isOption"),$o=Gt((t,e)=>{const n=e[0]&&wo(e[0])||e.length===0?null:e.shift()??null;if(!t.includes(n)){const i=new Error(`Command not recognised: ${String(n)}`);throw i.command=n,i.name="INVALID_COMMAND",i}return{argv:e,command:n}},"commandLineCommands");var Oo=Object.defineProperty,Ht=x((t,e)=>Oo(t,"name",{value:e,configurable:!0}),"i$b"),xo=Object.defineProperty,Kt=Ht((t,e)=>xo(t,"name",{value:e,configurable:!0}),"i"),Po=Object.defineProperty,Jt=Kt((t,e)=>Po(t,"name",{value:e,configurable:!0}),"s"),Ao=Object.defineProperty,Zt=Jt((t,e)=>Ao(t,"name",{value:e,configurable:!0}),"i"),Eo=Object.defineProperty,Yt=Zt((t,e)=>Eo(t,"name",{value:e,configurable:!0}),"t");Yt(t=>t instanceof Error&&t.type==="VisulimaError","isVisulimaError");let Ce=class extends Error{static{N(this,"ue")}static{S(this,"ce")}static{x(this,"v")}static{Ht(this,"g")}static{Kt(this,"p")}static{Jt(this,"V")}static{Zt(this,"VisulimaError")}static{Yt(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:e,hint:n,location:i,message:r,name:o,stack:l,title:s}){super(r,{cause:e}),this.title=s,this.name=o,this.stack=l??this.stack,this.loc=i,this.hint=n}setLocation(e){this.loc=e}setName(e){this.name=e}setMessage(e){this.message=e}setHint(e){this.hint=e}};var Co=Object.defineProperty,Qt=x((t,e)=>Co(t,"name",{value:e,configurable:!0}),"o$b"),No=Object.defineProperty,Xt=Qt((t,e)=>No(t,"name",{value:e,configurable:!0}),"o"),ko=Object.defineProperty,jo=Xt((t,e)=>ko(t,"name",{value:e,configurable:!0}),"i");let _o=class en extends Ce{static{N(this,"mt")}static{S(this,"ht")}static{x(this,"a")}static{Qt(this,"a")}static{Xt(this,"t")}static{jo(this,"AlreadySetError")}optionName;constructor(e){super({cause:void 0,hint:`Remove the duplicate option '${e}' from your command line arguments.`,location:void 0,message:`Option '${e}' is already set`,name:"ALREADY_SET",stack:void 0,title:"Option Already Set"}),this.optionName=e,Object.setPrototypeOf(this,en.prototype)}};var Lo=Object.defineProperty,tn=x((t,e)=>Lo(t,"name",{value:e,configurable:!0}),"t$7"),So=Object.defineProperty,nn=tn((t,e)=>So(t,"name",{value:e,configurable:!0}),"e"),To=Object.defineProperty,Io=nn((t,e)=>To(t,"name",{value:e,configurable:!0}),"e");let ft=class on extends Ce{static{N(this,"yt")}static{S(this,"vt")}static{x(this,"n")}static{tn(this,"n")}static{nn(this,"o")}static{Io(this,"UnknownOptionError")}optionName;constructor(e){super({cause:void 0,hint:`Check your option definitions or remove the unknown option '${e}' from your command line arguments.`,location:void 0,message:`Unknown option: --${e}`,name:"UNKNOWN_OPTION",stack:void 0,title:"Unknown Option"}),this.optionName=`--${e}`,Object.setPrototypeOf(this,on.prototype)}};var Mo=Object.defineProperty,rn=x((t,e)=>Mo(t,"name",{value:e,configurable:!0}),"a$9"),Vo=Object.defineProperty,an=rn((t,e)=>Vo(t,"name",{value:e,configurable:!0}),"a"),Uo=Object.defineProperty,Bo=an((t,e)=>Uo(t,"name",{value:e,configurable:!0}),"o");let Do=class sn extends Ce{static{N(this,"Ot")}static{S(this,"bt")}static{x(this,"n")}static{rn(this,"o")}static{an(this,"e")}static{Bo(this,"UnknownValueError")}value;constructor(e){super({hint:"Use a defined option or add a defaultOption to capture this value.",message:`Unknown value: ${e}`,name:"UNKNOWN_VALUE",title:"Unknown Value"}),this.value=e,Object.setPrototypeOf(this,sn.prototype)}};var Ro=Object.defineProperty,ln=x((t,e)=>Ro(t,"name",{value:e,configurable:!0}),"i$8"),zo=Object.defineProperty,cn=ln((t,e)=>zo(t,"name",{value:e,configurable:!0}),"i"),Fo=Object.defineProperty,Wo=cn((t,e)=>Fo(t,"name",{value:e,configurable:!0}),"i");let M=class un extends Ce{static{N(this,"Nt")}static{S(this,"Pt")}static{x(this,"a")}static{ln(this,"o")}static{cn(this,"e")}static{Wo(this,"InvalidDefinitionsError")}constructor(e,n){super({cause:void 0,hint:n,location:void 0,message:e,name:"INVALID_DEFINITIONS",stack:void 0,title:"Invalid Option Definition"}),Object.setPrototypeOf(this,un.prototype)}};var qo=Object.defineProperty,Go=x((t,e)=>qo(t,"name",{value:e,configurable:!0}),"z"),Ho=Object.defineProperty,le=Go((t,e)=>Ho(t,"name",{value:e,configurable:!0}),"S"),Ko=Object.defineProperty,Ne=le((t,e)=>Ko(t,"name",{value:e,configurable:!0}),"o");const dt=Ne(t=>t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean"),"isBooleanType"),ht=Ne(t=>t===Number||typeof t=="function"&&t.name==="Number","isNumberType"),mt=Ne(t=>t===String||typeof t=="function"&&t.name==="String","isStringType"),Jo=Ne((t,e)=>Array.isArray(t)?dt(e)?t.map(Boolean):ht(e)?t.map(Number):mt(e)?t.map(String):t.map(n=>e(String(n))):t===null?null:dt(e)?!!t:ht(e)?Number(t):mt(e)?typeof t=="string"?t:String(t):e(typeof t=="string"?t:String(t)),"convertValue");var Zo=Object.defineProperty,Yo=le((t,e)=>Zo(t,"name",{value:e,configurable:!0}),"e");const L=Yo((t,e,n,...i)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...i)},"debug");var Qo=Object.defineProperty,te=le((t,e)=>Qo(t,"name",{value:e,configurable:!0}),"h$1");const Xo=/-([a-z])/g,er=/^\d+$/,Be=te(t=>t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean"),"isBooleanType"),tr=te(t=>t.codePointAt(0)===95,"isSpecialKey"),gt=te((t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],"appendToArrayMultiple"),vt=te(t=>t==="__proto__"||t==="constructor"||t==="prototype","isUnsafeKey"),bt=te((t,e,n,i=!1)=>{t[e]===void 0?t[e]=i?[n]:n:i&&Array.isArray(t[e])?t[e].push(n):t[e]=[t[e],n]},"createOrAppendArray"),nr=te((t,e,n,i,r)=>{let o=e.get(t)??n.get(t);if(!o&&i){const l=t.toLowerCase();o=i.get(l)??r?.get(l)}return o},"getDefinition"),ir=te((t,e,n,i)=>{const r=n.debug??!1;L(r,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),L(r,"Starting argument resolution","resolver"),L(r,"Tokens:","resolver",t),L(r,"Definitions:","resolver",e),L(r,"Processing tokens...","resolver");const o=new Map,l=new Map,s=n.caseInsensitive?new Map:void 0,p=n.caseInsensitive?new Map:void 0,a=n.camelCase?new Map:void 0,c=n.camelCase?new Map:void 0;for(const h of e)if(o.set(h.name,h),h.alias&&l.set(h.alias,h),n.caseInsensitive&&s&&(s.set(h.name.toLowerCase(),h),h.alias&&p&&p.set(h.alias.toLowerCase(),h)),n.camelCase&&a&&c){const m=h.name.replaceAll(Xo,(b,$)=>$.toUpperCase());a.set(h.name,m),c.set(m,h.name)}const d={},f={},g=[],u=new Set;let v=!1;const w=e.find(h=>h.defaultOption),y=e.some(h=>h.group),O=e.some(h=>h.type===Number);for(let h=0;h<t.length;h++){const m=t[h];if(m.kind==="option-terminator"){d._unknown=i.slice(m.index),v=!0;break}if(m.kind==="option"&&m.name){let b=nr(m.name,o,l,s,p);if(!b&&m.value===void 0&&O&&er.test(m.name)){const C=e.find(R=>R.type===Number);C&&(b=C,m.value=m.name,m.name=C.name)}const $=b?b.name:m.name,P=b?.multiple,j=b?.lazyMultiple;if(f[$]!==void 0&&!P&&!j&&!n.partial)throw new _o($);if(!b&&n.partial){const C=m.rawName??`--${m.name}${m.value!==void 0&&m.inlineValue?`=${m.value}`:""}`;g.push({index:m.index,value:C});continue}if(!b&&n.stopAtFirstUnknown){d._unknown=i.slice(m.index);break}if(!b&&!n.partial)throw new ft(m.name);if(m.value===void 0){const C=t[h+1],R=C?.kind==="option"&&!("name"in C)&&C.value!==void 0,V=C&&b&&!(b.type&&Be(b.type))&&(C.kind==="positional"||R),Dn=b&&b.defaultOption&&!b.multiple&&!b.lazyMultiple;if(V&&(!b?.defaultOption||Dn))if(P){let z=h+1;const Ve=[];for(;z<t.length&&(t[z].kind==="positional"||t[z].kind==="option"&&!("name"in t[z])&&t[z].value!==void 0);)Ve.push(t[z].value),u.add(t[z].index),z++;f[$]=f[$]===void 0?Ve:gt(f[$],Ve),h=z-1}else j?(bt(f,$,C.value,!0),u.add(C.index),h++):(f[$]=C.value,u.add(C.index),h++);else b?.type&&Be(b.type)?bt(f,$,!0,P):f[$]=P?[]:null}else{let{value:C}=m;if(b?.type&&Be(b.type))switch(C){case"":{if(n.partial)f._unknown??=[],f._unknown.push(`${m.rawName??`--${m.name}`}${m.value?`=${m.value}`:""}`),C=!0;else throw new ft(m.name);break}case"false":{C=!1;break}case"true":{C=!0;break}default:C=!0}const R=[C];if(P){let V=h+1;for(;V<t.length&&t[V].kind==="positional";)R.push(t[V].value),u.add(t[V].index),V++;h=V-1}f[$]===void 0?f[$]=P||j?R:C:P||j?f[$]=gt(f[$],R):f[$]=C}}else if(m.kind==="positional"&&n.stopAtFirstUnknown&&!u.has(m.index)&&!w){L(r,`Found unconsumed positional token at index ${String(m.index)}, stopping processing`,"resolver"),d._unknown=i.slice(m.index);break}}for(const[h,m]of Object.entries(f)){const b=o.get(h);b&&(b.multiple||b.lazyMultiple)&&!Array.isArray(m)&&(f[h]=[m])}let A=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!v){for(const h of t)if(h.kind==="option"&&!o.has(h.name??"")&&!l.has(h.name??"")&&(!n.caseInsensitive||!s?.has(h.name?.toLowerCase()??"")&&!p?.has(h.name?.toLowerCase()??""))){A=h.index;break}}if(w){const h=[],m=[];for(const b of t)b.kind==="positional"&&!u.has(b.index)&&b.index<A&&(h.push(b.value),m.push(b));if(h.length>0){const b=f[w.name],$=w.multiple??w.lazyMultiple;b===void 0?$?(m.forEach(P=>u.add(P.index)),f[w.name]=h):(u.add(m[0].index),f[w.name]=h[0]):$&&(m.forEach(P=>u.add(P.index)),f[w.name]=Array.isArray(b)?[...h,...b]:[...h,b])}}if(!n.partial){for(const h of t)if(h.kind==="positional"&&!u.has(h.index))throw new Do(i[h.index])}if(n.partial&&!n.stopAtFirstUnknown){const h=[...g];if(f._unknown){const m=new Map;for(const[b,$]of i.entries())m.set($,b);for(const b of f._unknown){const $=m.get(b);$!==void 0&&h.push({index:$,value:b})}}for(const m of t)m.kind==="positional"&&!u.has(m.index)&&h.push({index:m.index,value:i[m.index]});h.length>0&&(h.sort((m,b)=>m.index-b.index),d._unknown=h.map(m=>m.value))}if(n.stopAtFirstUnknown&&!v){const h=t.findIndex($=>$.kind==="option"&&!o.has($.name??"")&&!l.has($.name??"")&&(!n.caseInsensitive||!s?.has($.name?.toLowerCase()??"")&&!p?.has($.name?.toLowerCase()??""))),m=t.findIndex($=>$.kind==="positional"&&!u.has($.index));let b=-1;if(h!==-1&&m!==-1?b=Math.min(h,m):h!==-1?b=h:m!==-1&&(b=m),b>=0){const $=t[b].index;d._unknown=i.slice($)}}else g.length>0&&!n.partial&&(d._unknown=g.map(h=>h.value));for(const[h,m]of Object.entries(f)){const b=n.camelCase?a?.get(h)??h:h,$=o.get(h);d[b]=$?.type?Jo(m,$.type):m===void 0?null:m}for(const h of e){const m=n.camelCase?a?.get(h.name)??h.name:h.name;!(m in d)&&h.defaultValue!==void 0&&(h.multiple??h.lazyMultiple?d[m]=Array.isArray(h.defaultValue)?[...h.defaultValue]:[h.defaultValue]:d[m]=h.defaultValue)}if(y){const h={},m={},b={};for(const P of e)if(P.group){const j=Array.isArray(P.group)?P.group:[P.group];for(const C of j)vt(C)||(h[C]??={})}for(const P of Object.keys(d))if(!tr(P)){m[P]=d[P];let j=P;n.camelCase&&(j=c?.get(P)??P);const C=o.get(j);if(C?.group){const R=Array.isArray(C.group)?C.group:[C.group];for(const V of R)vt(V)||h[V]&&(h[V][P]=d[P])}else b[P]=d[P]}const $={_all:m};for(const[P,j]of Object.entries(h))$[P]=j;Object.keys(b).length>0&&($._none=b),d._unknown&&($._unknown=d._unknown),Object.keys(d).forEach(P=>delete d[P]),Object.assign(d,$)}return L(r,"Final parsed result:","resolver",d),d},"resolveArgs");var or=Object.defineProperty,ne=le((t,e)=>or(t,"name",{value:e,configurable:!0}),"l");const Q="-".codePointAt(0),Y="=",rr=Y.codePointAt(0),ar="--",sr="-",lr="--",pn=ne(t=>t.length>2&&t.startsWith(lr),"hasLongOptionPrefix"),cr=ne(t=>pn(t)&&!t.includes(Y,3),"isLongOption"),ur=ne(t=>pn(t)&&t.includes(Y,3),"isLongOptionAndValue"),pr=ne(t=>t!==void 0&&t.length>0&&t.codePointAt(0)!==Q,"hasOptionValue"),fr=ne(t=>{if(t.length!==2||t.codePointAt(0)!==Q||t.codePointAt(1)===Q)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},"isShortOption"),dr=ne(t=>!(t.length<=2||t.codePointAt(0)!==Q||t.codePointAt(1)===Q),"isShortOptionGroup"),hr=ne(t=>{const e=[],n=[...t];let i=-1,r=0;for(;n.length>0;){const o=n.shift();if(o===void 0)break;const l=n[0];if(r>0?r--:i++,o===ar){e.push({index:i,kind:"option-terminator"});const s=n.map((p,a)=>({index:i+a+1,kind:"positional",value:p}));e.push(...s),i+=n.length;break}if(fr(o)){const s=o.charAt(1);let p;r?(e.push({index:i,kind:"option",name:s,rawName:o,value:p}),r===1&&pr(l)&&(p=n.shift(),e.push({index:i,kind:"option",value:p}))):e.push({index:i,kind:"option",name:s,rawName:o,value:p}),p!==void 0&&++i;continue}if(dr(o)&&!o.includes(Y)){const s=[];let p="",a=!1;for(let c=1;c<o.length;c++){const d=o.charAt(c);a?p+=d:d.codePointAt(0)===rr?a=!0:s.push(`${sr}${d}`)}if(a)if(s.length>0){const c=s.pop();s.push(`${c}=${p}`)}else s.push(p);n.unshift(...s),r=s.length;continue}if(cr(o)){const s=o.slice(2);e.push({index:i,kind:"option",name:s,rawName:o});continue}if(ur(o)){const s=o.indexOf(Y),p=o.slice(2,s),a=o.slice(s+1);e.push({index:i,inlineValue:!0,kind:"option",name:p,rawName:o,value:a});continue}if(o.length>2&&o.codePointAt(0)===Q&&o.codePointAt(1)!==Q&&o.includes(Y)){const s=o.indexOf(Y),p=o.charAt(1),a=o.slice(s+1);e.push({index:i,inlineValue:!0,kind:"option",name:p,rawName:o,value:a});continue}e.push({index:i,kind:"positional",value:o})}return e},"parseArgsTokens");var mr=Object.defineProperty,Je=le((t,e)=>mr(t,"name",{value:e,configurable:!0}),"d");const gr=/\d/,vr=Je(t=>t!=null&&(t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean")),"isBooleanType"),br=Je(t=>typeof t=="function","isValidCustomTypeFunction"),yr=Je((t,e,n)=>{const i=n?.debug??!1;L(i,"Validating definitions:","validation",t,"caseInsensitive:",e);const r=new Set,o=new Set,l=new Set,s=new Set;let p=0;for(const a of t){if(L(i,"Checking definition:","validation",a),!a.name)throw L(i,"Validation failed: name is required","validation"),new M("Invalid option definition: name is required");if(typeof a.name!="string")throw new M("Invalid option definition: name must be a string");if(a.name.trim()==="")throw new M("Invalid option definition: name cannot be empty");const c=e?a.name.toLowerCase():"";if(r.has(a.name)||e&&l.has(c))throw new M(`Invalid option definition: duplicate name '${a.name}'`);if(o.has(a.name)||e&&s.has(c))throw new M(`Invalid option definition: name '${a.name}' conflicts with an existing alias`);if(r.add(a.name),e&&l.add(c),a.alias!==void 0){if(typeof a.alias!="string")throw new M("Invalid option definition: alias must be a string");if(a.alias.length!==1)throw new M("Invalid option definition: alias must be a single character");if(gr.test(a.alias))throw new M("Invalid option definition: alias cannot be numeric");if(a.alias==="-")throw new M('Invalid option definition: alias cannot be "-"');const d=e?a.alias.toLowerCase():"";if(o.has(a.alias)||e&&s.has(d))throw new M(`Invalid option definition: duplicate alias '${a.alias}'`);if(r.has(a.alias)||e&&l.has(d))throw new M(`Invalid option definition: alias '${a.alias}' conflicts with an existing option name`);o.add(a.alias),e&&s.add(d)}if(a.defaultOption&&(p++,a.type!==void 0&&vr(a.type)))throw new M("Invalid option definition: defaultOption cannot be Boolean type");if(a.type!==void 0&&!(a.type===Boolean||a.type===Number||a.type===String||typeof a.type=="function"&&br(a.type)))throw new M("Invalid option definition: invalid type")}if(p>1)throw L(i,"Validation failed: multiple defaultOptions not allowed","validation"),new M("Invalid option definition: multiple defaultOptions not allowed");L(i,"Validation completed successfully","validation")},"validateDefinitions");var wr=Object.defineProperty,$r=le((t,e)=>wr(t,"name",{value:e,configurable:!0}),"O");const Or=$r((t,e={})=>{const n=e.debug??!1;L(n,"Starting command-line-args parsing","index"),L(n,"Options:","index",e);const i={...e};i.stopAtFirstUnknown&&(i.partial=!0);const r=Array.isArray(t)?t:[t];L(n,"Normalized definitions:","index",r),yr(r,i.caseInsensitive,n?i:void 0);let{argv:o}=i;if(!o&&(o=process.argv.slice(2),process.execArgv.length>0)){const a=new Set(process.execArgv);o=o.filter(c=>!a.has(c))}L(n,"Using argv:","index",o);let l=o;i.caseInsensitive&&(l=o.map(a=>{if(a.startsWith("--")){const c=a.indexOf("="),d=(c===-1?a.slice(2):a.slice(2,c)).toLowerCase();return c===-1?`--${d}`:`--${d}${a.slice(c)}`}if(a.startsWith("-")&&!a.startsWith("--")&&a.length>1){const c=a.slice(1).split("=",2),d=c[0],f=c[1];if(!d)return a;const g=d.toLowerCase();return f===void 0?`-${g}`:`-${g}=${f}`}return a}));const s=hr(l.map(String));L(n,"Tokenized arguments:","index",s);const p=ir(s,r,i,o);return L(n,"Command-line-args parsing completed","index"),p},"commandLineArgs");var xr=Object.defineProperty,Pr=x((t,e)=>xr(t,"name",{value:e,configurable:!0}),"b$2");let Ar=class{static{N(this,"Yi")}static{S(this,"Ki")}static{x(this,"m")}static{Pr(this,"EmptyToolbox")}result;argv;options;argument;command;commandName;env;logger;console;fs;process;runtime;rawUnknown;constructor(t,e){this.commandName=t,this.command=e}};var Er=Object.defineProperty,Cr=x((t,e)=>Er(t,"name",{value:e,configurable:!0}),"n$6");let De=class extends E{static{N(this,"Oe")}static{S(this,"be")}static{x(this,"i")}static{Cr(this,"CommandLoaderError")}commandName;constructor(e,n,i){super(`Failed to load command "${e}": ${n}`,"COMMAND_LOADER_ERROR",{commandName:e,reason:n}),this.name="CommandLoaderError",this.commandName=e,this.hint="Ensure the loader resolves to a module with a default export that is the command handler function.",i!==void 0&&(this.cause=i)}};var Nr=Object.defineProperty,kr=x((t,e)=>Nr(t,"name",{value:e,configurable:!0}),"f$5");const jr=/^-{1,2}(\w+)(=(.+))?$/,fn=kr((t,e,n,i)=>{const r=jr.exec(t);if(r===null)return{};const o=r[1];if(!o)return{};const l=n&&i?n.get(o)??i.get(o):e.find(s=>s.name===o||s.alias===o);return l!==void 0?{argName:l.name,argValue:r[3],option:l}:{}},"getParameterOption");var _r=Object.defineProperty,He=x((t,e)=>_r(t,"name",{value:e,configurable:!0}),"e$3");const yt=He((t,e)=>{if(e.type===void 0)return t;if(e.type.name==="Boolean"){if(t==="true"||t==="1")return e.type(!0);if(t==="false"||t==="0")return e.type(!1)}return e.type(t)},"convertType"),Lr=new Set(["0","1","false","true"]),Sr=He((t,e,n,i)=>{if(e.length===0||t.length===0)return{};const r=He((o,l)=>{const{argName:s,argValue:p,option:a}=fn(l,e,n,i),{lastOption:c}=o;return a&&ve(a)&&p&&s?o.partial[s]=yt(p,a):o.lastName&&c&&ve(c)&&Lr.has(l)&&(o.partial[o.lastName]=yt(l,c)),{lastName:s,lastOption:a,partial:o.partial}},"getBooleanValue");return t.reduce(r,{partial:{}}).partial},"getBooleanValues");var Tr=Object.defineProperty,wt=x((t,e)=>Tr(t,"name",{value:e,configurable:!0}),"s$8");const Ir=new Set(["0","1","false","true"]),Mr=wt((t,e,n,i)=>{if(e.length===0||t.length===0)return t;const r=wt((o,l)=>{const{argValue:s,option:p}=fn(l,e,n,i),{lastOption:a}=o;if(a&&ve(a)&&Ir.has(l)){const{args:c}=o;return{args:c.slice(0,-1)}}return p&&ve(p)&&s?{args:o.args}:{args:[...o.args,l],lastOption:p}},"removeBooleanArguments");return t.reduce(r,{args:[]}).args},"removeBooleanValues");var Vr=Object.defineProperty,Ur=x((t,e)=>Vr(t,"name",{value:e,configurable:!0}),"o$8");const Br=Ur(t=>{const e=new Map;for(const n of t){const i=e.get(n.name);i?e.set(n.name,{...i,...n}):e.set(n.name,n)}return[...e.values()]},"mergeArguments");var Dr=Object.defineProperty,ke=x((t,e)=>Dr(t,"name",{value:e,configurable:!0}),"o$7");const Rr=ke(t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},"transformBooleanEnv"),zr=ke((t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return Rr(e);if(t.type===Number||typeof t.type=="function"&&t.type.name==="Number"){const n=Number.parseFloat(e);return Number.isNaN(n)?void 0:n}return t.type===String||typeof t.type=="function"&&t.type.name==="String"?e:t.type(e)}},"transformEnvValue"),Fr=/_./g,Wr=/^[A-Z]/,qr=ke(t=>t.toLowerCase().replaceAll(Fr,e=>e[1]?.toUpperCase()??e).replace(Wr,e=>e.toLowerCase()),"toCamelCase"),Gr=ke(t=>{if(!t||t.length===0)return{};const e={},n=H();for(const i of t){const r=n[i.name],o=zr(i,r),l=o===void 0?i.defaultValue:o,s=qr(i.name);e[s]=l}return e},"processEnvVariables");var Hr=Object.defineProperty,be=x((t,e)=>Hr(t,"name",{value:e,configurable:!0}),"a$5");const Kr=be(t=>{const e=new Map,n=new Map;for(const i of t)if(e.set(i.name,i),i.alias){const r=Array.isArray(i.alias)?i.alias:[i.alias];for(const o of r)n.set(o,i)}return{optionMapByAlias:n,optionMapByName:e}},"buildOptionMaps"),dn=be(async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new De(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(i){throw new De(t.name,i instanceof Error?i.message:String(i),i)}const n=e.default;if(typeof n!="function")throw new De(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},"loadLazyHandler"),Jr=be((t,e,n,i)=>{const r=new Ar(t.name,t),{_all:o,_unknown:l,positionals:s}=e,p=Object.keys(n).length>0?{...o,...n}:o;Oe in p&&delete p[Oe],r.argument=s?.[Oe]??[],r.rawUnknown=[...l??[]];const a=Object.keys(i).length>0;return r.options=a?{...p,...i}:p,r.env=Gr(t.env),r},"prepareToolbox"),Zr=be((t,e,n)=>{const i=t.options??[],r=i.length>0;let o=Br(r?[...i,...n]:n);if(o.length>0){for(const a of o)if(a.multiple&&a.lazyMultiple)throw new Error(`Argument "${a.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(o=[{defaultOption:!0,description:t.argument.description,group:"positionals",multiple:!0,name:Oe,type:t.argument.type,typeLabel:t.argument.typeLabel},...o]);let l,s;if(r){const{optionMapByAlias:a,optionMapByName:c}=Kr(i);l=Mr(e,i,c,a),s=Sr(e,i,c,a)}else l=e,s={};const p=Or(o,{argv:l,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:o,booleanValues:s,parsedArgs:p}},"processCommandArgs"),oe=be(async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await dn(t))(e),"executeCommand");var Yr=Object.defineProperty,Qr=x((t,e)=>Yr(t,"name",{value:e,configurable:!0}),"n$5");let Xr=class extends E{static{N(this,"No")}static{S(this,"$a")}static{x(this,"s")}static{Qr(this,"CommandValidationError")}commandName;missingOptions;constructor(t,e){super(`Command "${t}" is missing required options: ${e.join(", ")}`,"COMMAND_VALIDATION_ERROR",{commandName:t,missingOptions:e}),this.name="CommandValidationError",this.commandName=t,this.missingOptions=e,this.hint=`Provide the following required options: ${e.join(", ")}`}};var ea=Object.defineProperty,ta=x((t,e)=>ea(t,"name",{value:e,configurable:!0}),"t$5");const $t=ta((t,e,n=!1)=>{const i=[];for(const r of t)if(!(!n&&!r.required)&&e[r.name]===void 0){if(r.type?.name==="Boolean"){e[r.name]=!1;continue}i.push(r)}return i},"listMissingArguments");var na=Object.defineProperty,hn=x((t,e)=>na(t,"name",{value:e,configurable:!0}),"n$4");const ia=hn((t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:Dt(t,e)<=t.length/3,"isSimilar"),Z=hn((t,e)=>{const n=t.toLowerCase();return e.filter(i=>ia(i.toLowerCase(),n))},"findAlternatives");var oa=Object.defineProperty,je=x((t,e)=>oa(t,"name",{value:e,configurable:!0}),"a$4");const ra=je((t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(i=>{const r=i.startsWith("--");let o=`Found unknown ${r?"option":"argument"} "${i}"`;if(r){const l=Z(i.replace("--",""),(e.options??[]).map(s=>s.name));if(l.length>0){const[s,...p]=l.map(a=>`--${a}`);o+=p.length>0?`, did you mean ${s??""} or ${p.join(", ")}?`:`, did you mean ${s??""}?`}}n.push(o)}),n.length>0)throw new Error(n.join(`
4
+ `))},"validateUnknownOptions"),aa=je((t,e,n)=>{const i=n.__requiredOptions__,r=i?$t(i,e,!0):$t(t,e,!1);if(r.length>0)throw new Xr(n.name,r.map(o=>o.name));e._unknown&&e._unknown.length>0&&!n.argument&&ra(e,n)},"validateRequiredOptions"),sa=je((t,e,n)=>{const i=n.__conflictingOptions__??t.filter(r=>r.conflicts!==void 0);if(i.length>0){const r=i.find(o=>Array.isArray(o.conflicts)?o.conflicts.some(l=>e[l]!==void 0)&&e[o.name]!==void 0:e[o.conflicts]!==void 0&&e[o.name]!==void 0);if(r)throw new Wt(r.name,typeof r.conflicts=="string"?r.conflicts:r.conflicts?.[0]??"unknown")}},"validateConflictingOptions"),la=je(t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const r of t.options){if(r.name){const o=e.get(r.name)??[];o.push(r),e.set(r.name,o)}if(typeof r.alias=="string"&&r.alias.length>0){const o=n.get(r.alias)??[];o.push(r),n.set(r.alias,o)}else if(Array.isArray(r.alias)){for(const o of r.alias)if(o.length>0){const l=n.get(o)??[];l.push(r),n.set(o,l)}}}const i=[];for(const[r,o]of e)o.length>1&&i.push(`Duplicate option name "${r}" in command "${t.name}": ${JSON.stringify(o)}`);for(const[r,o]of n)o.length>1&&i.push(`Duplicate option alias "-${r}" used by options ${o.map(l=>`"${l.name}"`).join(", ")} in command "${t.name}"`);if(i.length>0)throw new Error(i.join(`
5
+ `))},"validateDuplicateOptions");var ca=Object.defineProperty,Ze=x((t,e)=>ca(t,"name",{value:e,configurable:!0}),"s$4");const ua=Ze((t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];let i;for(let r=1;r<=e.length;r+=1){const o=e[r-1];if(o===void 0||o.startsWith("-"))break;n.push(o);const l=n.join(" ");t.has(l)&&(i={commandPath:[...n],depth:r})}return i?{argv:e.slice(i.depth),commandPath:i.commandPath}:{argv:e,commandPath:void 0}},"parseNestedCommand"),J=Ze(t=>t.join(" "),"getCommandPathKey"),Ot=Ze((t,e)=>e&&e.length>0?[...e,t]:[t],"getFullCommandPath");var pa=Object.defineProperty,mn=x((t,e)=>pa(t,"name",{value:e,configurable:!0}),"i$5"),fa=Object.defineProperty,gn=mn((t,e)=>fa(t,"name",{value:e,configurable:!0}),"r"),da=Object.defineProperty,ha=gn((t,e)=>da(t,"name",{value:e,configurable:!0}),"c");let vn=class{static{N(this,"xt")}static{S(this,"xt")}static{x(this,"l")}static{mn(this,"y")}static{gn(this,"s")}static{ha(this,"LRUCache")}capacity;cache;keyOrder;constructor(t){this.capacity=t,this.cache=new Map,this.keyOrder=[]}get(t){if(this.cache.has(t))return this.keyOrder=this.keyOrder.filter(e=>e!==t),this.keyOrder.push(t),this.cache.get(t)}has(t){return this.cache.has(t)}set(t,e){if(this.cache.has(t))this.keyOrder=this.keyOrder.filter(n=>n!==t);else if(this.cache.size>=this.capacity){const n=this.keyOrder.shift();n!==void 0&&this.cache.delete(n)}this.cache.set(t,e),this.keyOrder.push(t)}delete(t){this.cache.delete(t),this.keyOrder=this.keyOrder.filter(e=>e!==t)}clear(){this.cache.clear(),this.keyOrder=[]}size(){return this.cache.size}};var ma=Object.defineProperty,ga=x((t,e)=>ma(t,"name",{value:e,configurable:!0}),"r$5"),va=Object.defineProperty,ba=ga((t,e)=>va(t,"name",{value:e,configurable:!0}),"a"),ya=Object.defineProperty,wa=ba((t,e)=>ya(t,"name",{value:e,configurable:!0}),"s");const $a=wa((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleLowerCase(e.locale):t[0].toLowerCase())+t.slice(1),"lowerFirst");var Oa=Object.defineProperty,xa=x((t,e)=>Oa(t,"name",{value:e,configurable:!0}),"I"),Pa=Object.defineProperty,_e=xa((t,e)=>Pa(t,"name",{value:e,configurable:!0}),"W");const Aa=to(import.meta.url),de=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ea=_e(t=>{if(typeof de<"u"&&de.versions&&de.versions.node){const[e,n]=de.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return de.getBuiltinModule(t)}return Aa(t)},"__cjs_getBuiltinModule"),{stripVTControlCharacters:Ca}=Ea("node:util");var Na=Object.defineProperty,ka=_e((t,e)=>Na(t,"name",{value:e,configurable:!0}),"g");const Re=new vn(1e3),ja=/[.*+?^${}()|[\]\\]/g,_a=ka(t=>{const e=t.join("");if(Re.has(e))return Re.get(e);const n=t.map(r=>r.replaceAll(ja,String.raw`\$&`)).join("|"),i=new RegExp(n,"g");return Re.set(e,i),i},"getSeparatorsRegex");var La=Object.defineProperty,Sa=_e((t,e)=>La(t,"name",{value:e,configurable:!0}),"t");const Ta=Sa(t=>{const e=[];let n=0,i;for(se.lastIndex=0;(i=se.exec(t))!==null;)i.index>n&&e.push(t.slice(n,i.index)),e.push(i[0]),n=se.lastIndex;return n<t.length&&e.push(t.slice(n)),e.filter(Boolean)},"splitByEmoji");var Ia=Object.defineProperty,k=_e((t,e)=>Ia(t,"name",{value:e,configurable:!0}),"u");const Ma=/[ČŠŽĐ]/i,bn=new Uint8Array(128),yn=new Uint8Array(128),wn=new Uint8Array(128);for(let t=0;t<128;t++)bn[t]=t>=65&&t<=90?1:0,yn[t]=t>=97&&t<=122?1:0,wn[t]=t>=48&&t<=57?1:0;const ze=k(t=>bn[t],"isUpper"),xt=k(t=>yn[t],"isLower"),Fe=k(t=>wn[t],"isDigit"),G=k((t,e,n,i,r)=>{if(t.length===0)return[];let o=!1;const l=Object.values(e);for(const g of l)if(g(t[0])){o=!0;break}if(!o&&!n)return[t];const s=[...t],p=[];let a=s[0],c="other";const d=Object.entries(e);for(const g of d){const[u,v]=g;if(v(s[0])){c=u;break}}let f=n&&i?s[0]===s[0].toLocaleUpperCase(i):!1;for(let g=1;g<s.length;g++){const u=s[g];let v="other";for(const O of d){const[A,h]=O;if(h(u)){v=A;break}}const w=n&&i?u===u.toLocaleUpperCase(i):!1;let y=!1;r?y=r(c,v,f,w,u,g,s):(c!==v&&c!=="other"&&v!=="other"&&(y=!0),n&&v!=="other"&&!f&&w&&(y=!0)),y?(p.push(a),a=u):a+=u,c=v,n&&(f=w)}return a&&a.length>0&&p.push(a),p.length>0?p:[t]},"handleScriptTransitions"),Va=k((t,e,n,i)=>{if(n.size===0)return e;for(const r of n)if(t.startsWith(r,e))return i.push(r),e+r.length;return e},"detectAndProcessAcronym"),$n=k((t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let n=0;const i=[],r=t.length;for(let o=1;o<r;o++){const l=Va(t,n,e,i);if(l!==n){n=l,o=n-1;continue}const s=t.codePointAt(o-1),p=t.codePointAt(o),a=s&&s<128&&ze(s),c=p&&p<128&&ze(p),d=s&&s<128&&xt(s),f=s&&s<128&&Fe(s),g=p&&p<128&&Fe(p);if(d&&c){i.push(t.slice(n,o)),n=o;continue}if(f&&!g||!f&&g){i.push(t.slice(n,o)),n=o;continue}if(g&&!f){let u=!1,v=!1;if(o+1<r){const w=t.codePointAt(o+1);u=w&&w<128&&ze(w),v=w&&w<128&&Fe(w)}if(!v&&u){i.push(t.slice(n,o),t.slice(o,o+1)),n=o+1;continue}}if(o+1<r){const u=t.codePointAt(o+1),v=u&&u<128&&xt(u);if(a&&c&&v){const w=t.slice(n,o+1);e.has(w)||(i.push(t.slice(n,o)),n=o)}}}return n<r&&i.push(t.slice(n)),i.filter(o=>o!=="")},"splitCamelCaseFast"),On=k((t,e,n)=>{if(t.length===0)return[];const i=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!i&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const a=[...t],c=a.length,d=[];let f=a[0],g=a[0]===a[0].toLocaleUpperCase(e),u=g,v=g?0:-1;for(let w=1;w<c;w++){const y=a[w],O=y===y.toLocaleUpperCase(e);if(O===g)f+=y;else if(O)f&&f.length>0&&(d.push(f),f=y),u=!0,v=w;else{if(u&&w-v>1){const A=a[w-1],h=f.slice(0,-1);h&&h.length>0&&d.push(h),f=A+y}else f+=y;u=!1,v=-1}g=O}return f&&f.length>0&&d.push(f),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!ie.test(t)&&!I.test(t))return[t];const a=[...t],c=a.length,d=[];let f=a[0];const g=a[0];let u;ie.test(g)?u=1:I.test(g)?u=2:u=0;let v=g===g.toLocaleUpperCase(e);for(let y=1;y<c;y++){const O=a[y];let A;ie.test(O)?A=1:I.test(O)?A=2:A=0;const h=O===O.toLocaleUpperCase(e);u!==A&&(u===1||u===2)&&(A===1||A===2)||A===u&&!v&&h?(d.push(f),f=O):f+=O,u=A,v=h}f&&f.length>0&&d.push(f);const w=[];for(let y=0;y<d.length;y++)y<d.length-1&&d[y].length===1&&I.test(d[y])&&ie.test(d[y+1][0])?(w.push(d[y]+d[y+1]),y+=1):w.push(d[y]);return w}if(e.startsWith("el")){if(!Ue.test(t)&&!I.test(t))return[t];const a=[];ot.lastIndex=0;let c;for(;(c=ot.exec(t))!==null;)a.push(c[0]);a.length===0&&a.push(t);const d=[];if(a.length===1){const f=a[0];if(!f||!Ue.test(f[0])||f.length===1)return[f??t]}for(const f of a){if(!f)continue;if(!Ue.test(f[0])||f.length===1){d.push(f);continue}const g=f.length;let u=f[0],v=f[0]===f[0].toLocaleUpperCase(e);for(let w=1;w<g;w++){const y=f[w],O=y===y.toLocaleUpperCase(e);!v&&O?(d.push(u),u=y):u+=y,v=O}u&&d.push(u)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const a=e.startsWith("ja"),c=a?{hiragana:k(f=>Li.test(f),"hiragana"),kanji:k(f=>st.test(f),"kanji"),katakana:k(f=>Ti.test(f),"katakana"),latin:k(f=>I.test(f),"latin")}:{hangul:k(f=>rt.test(f),"hangul"),latin:k(f=>I.test(f),"latin")},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(a){const f=G(t,c,!1,e,(u,v)=>u==="hiragana"&&v==="katakana"||u==="katakana"&&v==="hiragana"||u==="hiragana"&&v==="latin"||u==="katakana"&&v==="latin"||u==="kanji"&&v==="latin"||u==="latin"&&(v==="hiragana"||v==="katakana"||v==="kanji")),g=[];for(const u of f){const v=u;v.length===1&&d.has(v)&&g.length>0?g[g.length-1]=g.at(-1)+v:g.push(v)}return g.length>0?g:[t]}return G(t,c,!1,e,(f,g)=>f==="hangul"&&g==="latin"||f==="latin"&&g==="hangul")}if(e.startsWith("sl")){const a=[...t],c=a.length,d=[];let f=a[0],g=a[0]===a[0].toLocaleUpperCase(e);for(let u=1;u<c;u++){const v=a[u],w=v===v.toLocaleUpperCase(e),y=Ma.test(v),O=u<c-1&&a[u+1]===a[u+1].toLocaleUpperCase(e);!g&&w||y&&O?(d.push(f),f=v,y&&O&&(d.push(f),f="")):f+=v,g=w}return f&&f.length>0&&d.push(f),d}if(e.startsWith("zh"))return G(t,{han:k(a=>st.test(a),"han"),latin:k(a=>I.test(a),"latin")},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const a=k(c=>at.test(c)||it.test(c),"isRtlChar");return G(t,{latin:k(c=>I.test(c),"latin"),rtl:k(c=>a(c),"rtl")},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const a=k(c=>Ni.test(c)||Ci.test(c)||ji.test(c)||_i.test(c)||Si.test(c)||Ri.test(c)||zi.test(c)||Vi.test(c)||Di.test(c)||Fi.test(c)||Mi.test(c)||Wi.test(c)||Ui.test(c)||ki.test(c)||Ii.test(c)||Bi.test(c),"isIndicChar");return G(t,{indic:k(c=>a(c),"indic"),latin:k(c=>I.test(c),"latin")},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return G(t,{cyrillic:k(a=>ie.test(a),"cyrillic"),latin:k(a=>I.test(a),"latin")},!0,e);if(["ar","fa","he"].includes(e))return G(t,{latin:k(a=>I.test(a),"latin"),rtl:k(a=>at.test(a)||it.test(a),"rtl")},!1,e);if(e.startsWith("ko"))return G(t,{hangul:k(a=>rt.test(a),"hangul"),latin:k(a=>I.test(a),"latin")},!1,e);if(e.startsWith("uz")){if(!ie.test(t)&&!I.test(t))return[t];const a=[...t],c=a.length,d=[];let f=a[0],g=a[0]===a[0].toLocaleUpperCase(e);for(let u=1;u<c;u++){const v=a[u],w=v===v.toLocaleUpperCase(e);if(lt.test(v)||lt.test(a[u-1])){f+=v;continue}!g&&w?(d.push(f),f=v):f+=v,g=w}return f&&f.length>0&&d.push(f),d}const r=[...t],o=r.length,l=[];let s=r[0],p=r[0]===r[0].toLocaleUpperCase(e);for(const a of n)if(t.startsWith(a)){l.push(a),s=r[a.length],p=s===s.toLocaleUpperCase(e);break}for(let a=1;a<o;a++){const c=r[a],d=c===c.toLocaleUpperCase(e);let f=0;for(const g of n)if(t.startsWith(g,a)){l.push(s,g),f=g.length,s="";const u=g.at(-1);u&&(p=u===u.toLocaleUpperCase(e));break}if(f>0){a+=f-1;continue}!p&&d?(l.push(s),s=c):s+=c,p=d}return s&&l.push(s),l},"splitCamelCaseLocale"),Ua=k((t,e,n)=>{const i=[],r=ge.test(t)?t.split(ge).filter(Boolean):[t];for(const o of r){const l=o;if(ge.test(l))i.push(l);else{const s=se.test(l)?Ta(l).filter(Boolean):[l];for(const p of s)if(se.test(p))i.push(p);else if(e){const a=e.toLowerCase().split("-")[0];i.push(...On(p,a,n))}else i.push(...$n(p,n))}}return i},"processTextWithAnsiEmoji"),Ba=k((t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:n=!1,handleEmoji:i=!1,knownAcronyms:r=[],locale:o,normalize:l=!1,separators:s,stripAnsi:p=!1,stripEmoji:a=!1}=e,c=new Set([...r].toSorted((y,O)=>O.length-y.length));let d=t;p&&(d=Ca(d)),a&&(d=qi(d));let f;Array.isArray(s)?f=_a(s):s instanceof RegExp?f=s:f=Ei;const g=[];let u=d;const v=f.flags.includes("g")?f:new RegExp(f.source,`${f.flags}g`);for(;u.length>0;){const y=v.exec(u);if(!y){u===".."?g.push(".."):u==="."?g.push("."):u.length>0&&g.push(u);break}const O=y.index,A=y[0],h=A.length,m=u.slice(0,O),b=u.slice(O+h);if(A.startsWith("../"))g.push(".."),u=u.slice(O+3);else if(A.startsWith("./"))g.push("."),u=u.slice(O+2);else if(O===0&&A==="..")g.push(".."),u=u.slice(2);else if(O===0&&A===".")g.push("."),u=u.slice(1);else{m.length>0&&g.push(m);let $=0;for(;($=A.indexOf("../",$))!==-1;)g.push(".."),$+=3;for($=0;($=A.indexOf("./",$))!==-1;)($===0||A[$-1]!==".")&&g.push("."),$+=2;let P=b;for(;P.startsWith("../");)g.push(".."),P=P.slice(3);for(;P.startsWith("./");)g.push("."),P=P.slice(2);if(P===".."){g.push("..");break}else if(P==="."){g.push(".");break}else u=P}v.lastIndex=0}if(g.length===0){const y=d.split(f).filter(Boolean);g.push(...y)}let w=[];for(const y of g)n||i?w.push(...Ua(y,o,c)):o?w.push(...On(y,o,c)):w.push(...$n(y,c));return l&&(w=w.map(y=>c.has(y)?y:o&&y===y.toLocaleUpperCase(o)?y[0]+y.slice(1).toLocaleLowerCase(o):y.toUpperCase()===y&&!c.has(y)?y.slice(0,1)+y.slice(1).toLowerCase():y)),w},"splitByCase");var Da=Object.defineProperty,Ra=x((t,e)=>Da(t,"name",{value:e,configurable:!0}),"r$4"),za=Object.defineProperty,Fa=Ra((t,e)=>za(t,"name",{value:e,configurable:!0}),"o"),Wa=Object.defineProperty,qa=Fa((t,e)=>Wa(t,"name",{value:e,configurable:!0}),"s");const Ga=qa((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleUpperCase(e.locale):t[0].toUpperCase())+t.slice(1),"upperFirst");var Ha=Object.defineProperty,Ka=x((t,e)=>Ha(t,"name",{value:e,configurable:!0}),"r$3"),Ja=Object.defineProperty,Za=Ka((t,e)=>Ja(t,"name",{value:e,configurable:!0}),"r"),Ya=Object.defineProperty,Qa=Za((t,e)=>Ya(t,"name",{value:e,configurable:!0}),"n");const Xa=Qa((t,e)=>`${t}::${e?.joiner??""}::${e?.locale??""}::${e?.knownAcronyms?.join(",")??""}::${e?.normalize?"true":"false"}`,"generateCacheKey");var es=Object.defineProperty,ts=x((t,e)=>es(t,"name",{value:e,configurable:!0}),"i$3"),ns=Object.defineProperty,is=ts((t,e)=>ns(t,"name",{value:e,configurable:!0}),"f"),os=Object.defineProperty,rs=is((t,e)=>os(t,"name",{value:e,configurable:!0}),"l");const as=rs((t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const i=[];let r="",o="";for(let l=0;l<n;l++){const s=t[l];if(ge.test(s)){r?(i.push(r+o+s),r="",o=""):(i.length>0&&i.push(e),r=s);continue}r?(o&&(o+=e),o+=s):(i.length>0&&i.push(e),i.push(s))}return i.join("")},"joinSegments");var ss=Object.defineProperty,ls=x((t,e)=>ss(t,"name",{value:e,configurable:!0}),"r$2"),cs=Object.defineProperty,us=ls((t,e)=>cs(t,"name",{value:e,configurable:!0}),"a"),ps=Object.defineProperty,fs=us((t,e)=>ps(t,"name",{value:e,configurable:!0}),"e");const ds=/(?<![a-zß])SS(?![a-z])/g,hs=fs(t=>t.replaceAll(ds,"ß"),"normalizeGermanEszett");var ms=Object.defineProperty,gs=x((t,e)=>ms(t,"name",{value:e,configurable:!0}),"c$2"),vs=Object.defineProperty,bs=gs((t,e)=>vs(t,"name",{value:e,configurable:!0}),"c"),ys=Object.defineProperty,ws=bs((t,e)=>ys(t,"name",{value:e,configurable:!0}),"o");const $s=new vn(1e3),xn=ws((t,e)=>{if(typeof t!="string"||!t)return"";const n=e?.cache??!1,i=e?.cacheStore??$s;let r;if(n&&(r=Xa(t,e)),n&&r&&i.has(r))return i.get(r);let o=!0;const l=as(Ba(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(s=>{if(e?.handleAnsi&&ge.test(s))return s;const p=e?.locale?.startsWith("de")?hs(s):s,a=e?.locale?p.toLocaleLowerCase(e.locale):p.toLowerCase();return o?(o=!1,$a(a,e)):Ga(a,e)}),"");return n&&r&&i.set(r,l),l},"camelCase");var Os=Object.defineProperty,Le=x((t,e)=>Os(t,"name",{value:e,configurable:!0}),"a$2");const xs=Le(t=>{t.options?.forEach(e=>{e.__camelCaseName__=xn(e.name)})},"processOptionNames"),Ps=Le(t=>{if(!Array.isArray(t.options)||t.options.length===0)return;const e=new Set;for(const i of t.options)e.add(i.name);const n=[];for(const i of t.options)if(i.name.startsWith("no-")){const r=i.name.replace("no-","");if(!e.has(r)){if(i.type!==Boolean)throw new Error(`Cannot add negated option "${i.name}" to command "${t.name}" because it is not a boolean.`);const o={...i,defaultValue:i.defaultValue===void 0?!0:!i.defaultValue,name:r};n.push(o),e.add(r)}}n.length>0&&t.options.push(...n)},"addNegatableOptions"),As=Le((t,e)=>{if(!e.options||e.options.length===0)return;const{options:n}=t,i=new Map;for(const o of e.options)if(o.name.startsWith("no-")){const l=xn(o.name);i.set(l,o)}const r=Object.keys(n).filter(o=>i.has(o));if(r.length!==0)for(const o of r){const l=o.charAt(2);if(!l)continue;const s=l.toLowerCase()+o.slice(3),p=i.get(o);p&&(p.__negated__=!0),n[s]=!n[o],Reflect.deleteProperty(n,o)}},"mapNegatableOptions"),Es=Le((t,e)=>{if(!e.options||e.options.length===0)return;const n=new Map;for(const r of e.options)r.__camelCaseName__&&r.__negated__===void 0&&r.implies!==void 0&&n.set(r.__camelCaseName__,r);if(n.size===0)return;const{options:i}=t;for(const r of Object.keys(i)){const o=n.get(r);if(o?.implies){const{implies:l}=o;for(const[s,p]of Object.entries(l))i[s]===void 0&&(i[s]=p)}}},"mapImpliedOptions");var Cs=Object.defineProperty,Se=x((t,e)=>Cs(t,"name",{value:e,configurable:!0}),"e$2");const Ns=Se(()=>!!process.versions.electron,"isElectronApp"),ks=Se(()=>Ns()&&!process.defaultApp,"isBundledElectronApp"),js=Se(()=>ks()?0:1,"getProcessArgvBinIndex"),_s=Se(t=>t.slice(js()+1),"hideBin");var Ls=Object.defineProperty,Pn=x((t,e)=>Ls(t,"name",{value:e,configurable:!0}),"e$1");const Ss=" ",Ts=Pn((t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,i)=>n===e[i]),"equals"),Is=Pn(t=>{if(typeof t=="string")return t.split(Ss);const e=xe();return Ts(t,e)?_s(t):t},"parseRawCommand");var Ms=Object.defineProperty,We=x((t,e)=>Ms(t,"name",{value:e,configurable:!0}),"r");const Vs=We(t=>{const e=We(o=>{t.error(`Uncaught exception: ${o.message||o}`),o.stack&&t.error(o.stack),W(1)},"uncaughtExceptionHandler"),n=We((o,l)=>{if(o instanceof Error)t.error(`Promise rejection: ${o.message||o}`),o.stack&&t.error(o.stack);else{let s;if(typeof o=="string")s=o;else try{s=JSON.stringify(o)}catch{s=String(o)}t.error(`Promise rejection: ${s}`)}W(1)},"unhandledRejectionHandler"),i=tt("uncaughtException",e),r=tt("unhandledRejection",n);return()=>{i(),r()}},"registerExceptionHandler");var Us=Object.defineProperty,ce=x((t,e)=>Us(t,"name",{value:e,configurable:!0}),"e");const Pe=100,An=/^[a-z][\w-]*$/i,Ae=ce((t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new E(`${e} must be a non-empty string`,"INVALID_INPUT",{fieldName:e,value:t});return t.trim()},"validateNonEmptyString"),Pt=ce((t,e)=>{if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new E(`${e} must be an array of strings`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateStringArray");ce((t,e)=>{if(typeof t!="function")throw new E(`${e} must be a function`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateFunction");const qe=ce((t,e)=>{if(typeof t!="object"||t===null)throw new E(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateObject"),we=ce(t=>{const e=Ae(t,"Command name");if(e.length>Pe)throw new E(`Command name is too long (maximum ${String(Pe)} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new E(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!An.test(e))throw new E(`Command name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_COMMAND_NAME",{commandName:e});return e},"validateCommandName");ce(t=>{const e=Ae(t,"Plugin name");if(e.length>Pe)throw new E(`Plugin name is too long (maximum ${String(Pe)} characters)`,"INVALID_PLUGIN_NAME",{length:e.length,pluginName:e});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new E(`Plugin name "${e}" contains invalid characters`,"INVALID_PLUGIN_NAME",{pluginName:e});if(!An.test(e))throw new E(`Plugin name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_PLUGIN_NAME",{pluginName:e});return e},"validatePluginName");var Bs=Object.defineProperty,Te=x((t,e)=>Bs(t,"name",{value:e,configurable:!0}),"s");const Ds=new Set([`
6
+ `,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),Rs=/^[A-Z]:/i,zs=Te(t=>{if(typeof t!="string")throw new TypeError("Argument must be a string");if(t.length>1e4)throw new Error(`Argument is too long (maximum ${String(1e4)} characters)`);for(const e of t)if(Ds.has(e))throw new Error(`Argument contains dangerous character: ${e}`);return t.trim()},"sanitizeArgument"),At=Te(t=>{if(!Array.isArray(t))throw new TypeError("Arguments must be an array");if(t.length>100)throw new Error(`Too many arguments (maximum ${String(100)})`);return t.map(e=>zs(e))},"sanitizeArguments");Te(t=>{if(typeof t!="string")throw new TypeError("Path must be a string");const e=t.trim();if(e.includes("..")||e.includes("../")||e.includes("..\\"))throw new Error("Path contains directory traversal sequences");if(e.startsWith("/")||Rs.test(e))throw new Error("Absolute paths are not allowed");if(e.length>1e3)throw new Error("Path is too long");return e},"validateSafePath");class Rc{static{N(this,"$s")}static{S(this,"Ir")}static{x(this,"RateLimiter")}static{Te(this,"RateLimiter")}attempts=new Map;maxAttempts;windowMs;constructor(e=5,n=6e4){if(e<=0||n<=0)throw new Error("maxAttempts and windowMs must be positive numbers");this.maxAttempts=e,this.windowMs=n}checkLimit(e){const n=Date.now(),i=this.attempts.get(e);return!i||n>i.resetTime?(this.attempts.set(e,{count:1,resetTime:n+this.windowMs}),this.cleanup(n),!0):i.count>=this.maxAttempts?!1:(i.count+=1,!0)}reset(e){this.attempts.delete(e)}cleanup(e){for(const[n,i]of this.attempts.entries())e>i.resetTime&&this.attempts.delete(n)}}var Fs=Object.defineProperty,U=x((t,e)=>Fs(t,"name",{value:e,configurable:!0}),"b");const Ws=/^-([^\d-])$/,qs=/^--(\S+)/,Gs=/^-([^\d-]{2,})$/,Ge=U(t=>Ws.test(t)||qs.test(t)||Gs.test(t),"isOption"),Hs={access:U((t,e)=>eo(t,e),"access"),mkdir:U((t,e)=>Xi(t,e),"mkdir"),readdir:U(t=>Qi(t),"readdir"),readFile:U((async(t,e)=>e===void 0?ct(t):ct(t,e)),"readFile"),rm:U((t,e)=>Yi(t,e),"rm"),stat:U(t=>Zi(t),"stat"),writeFile:U((t,e,n)=>Ji(t,e,n),"writeFile")};let Ks=class En{static{N(this,"Ie")}static{S(this,"Dt")}static{x(this,"Cli")}static{U(this,"Cli")}#t;#e;#c;#u;#f;#d;#y;#w;#$;#O;#x;#p;#n;#i;#o;#r;#a;#h=!1;#P;#A=!1;#m;#g;#v;#l=[];#j(){return this.#m===void 0&&(this.#m=[...this.#i.keys()]),this.#m}#E(){return this.#g===void 0&&(this.#g=[...this.#n.keys()]),this.#g}#s(){return this.#v===void 0&&(this.#v=[...this.#j(),...this.#E()]),this.#v}#C(){return this.#l.length===0?ye:[...ye,...this.#l]}#N(){this.#m=void 0,this.#g=void 0,this.#v=void 0}#b(){if(this.#c===void 0){const e=Is(this.#e.argv);this.#c=At(e),this.#_()}return this.#c}#_(){if(!this.#c)return;const e=H();let n=!1;for(const i of this.#c){if(i==="--quiet"||i==="-q"){e.CEREBRO_OUTPUT_LEVEL=String(qn),n=!0;break}if(i==="--verbose"||i==="-v"){e.CEREBRO_OUTPUT_LEVEL=String(Gn),n=!0;break}if(i==="--debug"||i==="-vvv"){e.CEREBRO_OUTPUT_LEVEL=String(re),n=!0;break}}n||(e.CEREBRO_OUTPUT_LEVEL=Object.hasOwn(e,"DEBUG")?String(re):String(et))}#L(){this.#A||(this.#P=Vs(this.#t),this.#A=!0)}#S(){return{arch:ui(),argv:this.#b(),cwd:this.#u,env:this.#O??H(),exit:this.#$??(e=>W(e??0)),platform:ci(),stdin:this.#x}}#k(e,n,i,r){this.#t.debug(`command '${r}' found, parsing command args: ${n.join(", ")}`);const{arguments_:o,booleanValues:l,parsedArgs:s}=Zr(e,n,this.#C()),p=Object.keys(l).length>0;let a=s;p&&(a={...s,_all:{...s._all,...l}}),aa(o,a,e);const c=Jr(e,s,l,i);c.runtime=this,c.argv=this.#b(),c.fs=this.#w??Hs,c.process=this.#S(),c.console=this.#t;const d=e.options&&e.options.length>0;if(d&&e.options){const f=e.options.filter(g=>g.name.startsWith("no-"));for(const g of f){const u=g.name.replace("no-",""),v=`--${g.name}`,w=`--${u}`,y=n.includes(v),O=n.includes(w);if(y&&O)throw new Wt(u,g.name)}}return d&&(As(c,e),Es(c,e)),sa(o,c.options,e),H().CEREBRO_OUTPUT_LEVEL===String(re)&&(this.#t.debug("command options parsed from options:"),this.#t.debug(JSON.stringify(c.options,null,2)),this.#t.debug("command argument parsed from argument:"),this.#t.debug(JSON.stringify(c.argument,null,2))),{arguments_:o,booleanValues:l,commandArgs:a,parsedArgs:s,toolbox:c}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new E("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#f=e.trim();const i=n.argv??xe(),r=n.cwd??li();if(this.#e={...n,argv:i,cwd:r},this.#e.argv&&!Array.isArray(this.#e.argv))throw new E("CLI argv option must be an array of strings","INVALID_INPUT",{argv:this.#e.argv});if(this.#e.cwd&&typeof this.#e.cwd!="string")throw new E("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new E("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new E("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});const o=H();if(o.CEREBRO_OUTPUT_LEVEL=String(et),typeof this.#e.logger=="object"){const c=["debug","error","info","log","warn"],d=[],f=this.#e.logger;for(const g of c)typeof f[g]!="function"&&d.push(g);if(d.length>0)throw new E(`Logger object is missing required methods: ${d.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:d});this.#t=this.#e.logger}else this.#t={...console,debug:U((...c)=>{o.CEREBRO_OUTPUT_LEVEL===String(re)&&console.debug(...c)},"debug")};this.#d=this.#e.packageVersion,this.#y=this.#e.packageName,this.#u=this.#e.cwd,this.#r="help",this.#a={};const l=n.fs;if(l!==void 0&&(typeof l!="object"||l===null))throw new E("CLI fs option must be an object implementing the CerebroFs interface","INVALID_INPUT",{fs:n.fs});const s=n.exit;if(s!==void 0&&typeof s!="function")throw new E("CLI exit option must be a function","INVALID_INPUT",{exit:n.exit});const p=n.env;if(p!==void 0&&(typeof p!="object"||p===null))throw new E("CLI env option must be a record of string keys","INVALID_INPUT",{env:n.env});const a=n.stdin;if(a!==void 0&&typeof a!="string")throw new E("CLI stdin option must be a string","INVALID_INPUT",{stdin:n.stdin});this.#w=n.fs,this.#$=n.exit,this.#O=n.env,this.#x=n.stdin??"",this.#n=new Map,this.#i=new Map,this.#o=new Map}setCommandSection(e){return this.#a=e,this}getCommandSection(){return this.#a.header||(this.#a.header=`${this.#f}${this.#d?` v${this.#d}`:""}`),this.#a}setDefaultCommand(e){return this.#r=e,this}get defaultCommand(){return this.#r}addCommand(e){qe(e,"Command"),we(e.name);const n=typeof e.execute=="function",i=typeof e.loader=="function";if(n&&i)throw new E(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!i)throw new E(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?we(e.alias):Pt(e.alias,"Command alias").forEach(a=>we(a))),e.argument&&qe(e.argument,"Command argument"),e.options&&qe(e.options,"Command options"),e.commandPath&&(Pt(e.commandPath,"Command commandPath"),e.commandPath.forEach(a=>{we(a)}));const r=Ot(e.name,e.commandPath),o=J(r);if(this.#i.has(o))throw new E(`Command with path "${o}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});const l=Array.isArray(e.commandPath)&&e.commandPath.length>0,s=this.#n.get(e.name),p=s!==void 0&&(s.commandPath===void 0||s.commandPath.length===0);if(!l&&p)throw new E(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const a of e.options)pt(a);if(la(e),Ps(e),xs(e),e.options&&(e.__conflictingOptions__=e.options.filter(a=>a.conflicts!==void 0),e.__requiredOptions__=e.options.filter(a=>a.required===!0)),l&&s!==void 0)this.#n.set(o,e);else{if(!l&&s!==void 0&&!p){const a=Ot(s.name,s.commandPath);this.#n.set(J(a),s)}this.#n.set(e.name,e)}if(this.#i.set(o,r),this.#o.set(o,e),this.#N(),e.alias!==void 0){const a=typeof e.alias=="string"?[e.alias]:e.alias;for(const c of a){if(H().CEREBRO_OUTPUT_LEVEL===String(re)&&this.#t.debug("adding alias",c),this.#n.has(c))throw new E(`Command alias "${c}" conflicts with existing command`,"DUPLICATE_COMMAND",{alias:c,commandName:e.name});this.#n.set(c,e)}}return this}addGlobalOption(e){const n=e,i=new Set(ye.map(o=>o.name)),r=new Set(ye.map(o=>o.alias).filter(Boolean));if(i.has(n.name))throw new E(`Cannot add global option "--${n.name}": it conflicts with a built-in global option`,"DUPLICATE_OPTION",{optionName:n.name});if(n.alias&&r.has(n.alias))throw new E(`Cannot add global option with alias "-${n.alias}": it conflicts with a built-in global option alias`,"DUPLICATE_OPTION",{alias:n.alias,optionName:n.name});if(new Set(this.#l.map(o=>o.name)).has(n.name))throw new E(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",pt(n),this.#l.push(n),this}getGlobalOptions(){return this.#C()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#p?this.#p:(this.#p=new uo(this.#t),this.#p.register({description:"Attaches the logger to the toolbox",execute:U(e=>{e.logger=this.#t,e.console=e.logger},"execute"),name:"logger"}),this.#p)}getCliName(){return this.#f}getPackageVersion(){return this.#d}getPackageName(){return this.#y}getCommands(){return this.#n}getCwd(){return this.#u}dispose(){this.#P?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:i=!0,...r}=e;if(!this.#n.has("help")){const{default:m}=await import("../packem_chunks/help-command.js");this.addCommand(new m(this.#n))}const o=this.#E(),l=this.#i;this.#L();const s=this.#b();let p,a=[...s];const c=Bt(),d=Ut(),f=xe();this.#t.debug(`process.execPath: ${c}`),this.#t.debug(`process.execArgv: ${d.join(" ")}`),this.#t.debug(`process.argv: ${f.join(" ")}`);const g=ua(l,[...s]);if(g.commandPath)p=g.commandPath,a=g.argv;else{if(s.length>1&&s[0]&&s[1]&&!Ge(s[0])&&!Ge(s[1])){const b=[];let $=0;for(;$<s.length;){const j=s[$];if(!j||Ge(j))break;b.push(j),$+=1}const P=J(b);if(b[0]&&!o.includes(b[0])){const j=this.#s(),C=Z(P,j);throw new K(P,C)}}let m;try{m=$o([null,...o],[...s])}catch(b){if(b instanceof Error&&b.name==="INVALID_COMMAND"&&"command"in b){const $=b.command,P=this.#s(),j=Z($,P);throw new K($,j)}throw b}m.command&&(p=[m.command],a=m.argv)}if(!p)if(this.#r)p=[this.#r];else{const m=this.#s();throw new K("",m)}const u=J(p),v=this.#i.get(u);let w;if(v){if(w=this.#o.get(u),!w||J(v)!==u){const m=this.#s(),b=Z(u,m);throw new K(u,b)}}else{const m=p.at(-1);if(w=m?this.#n.get(m):void 0,!w){const b=this.#s(),$=Z(u,b);throw new K(u,$)}}if(typeof w.execute!="function"&&typeof w.loader!="function")return this.#t.error(`Command "${w.name}" has no function to execute.`),i?W(1):void 0;const y=a;let O,A;try{({commandArgs:O,toolbox:A}=this.#k(w,y,r,u))}catch(m){if(this.#t.error(m),i)return W(1);throw m}const h=this.getPluginManager();try{!this.#h&&h.hasPlugins()&&(await h.init({cli:this,cwd:this.#u,logger:this.#t}),this.#h=!0),await h.executeLifecycle("execute",A),await h.executeLifecycle("beforeCommand",A);let m;const b=O.global;if(b?.help){const $=this.#n.get("help");if(!$)throw new E("Help command not found","COMMAND_NOT_FOUND");m=await oe($,A,O)}else if(b?.version??b?.V){const $=this.#n.get("version");if(!$)throw new E("Version command not found","COMMAND_NOT_FOUND");m=await oe($,A,O)}else m=await oe(w,A,O);return await h.executeLifecycle("afterCommand",A,m),i?W(0):void 0}catch(m){throw await h.executeErrorHandlers(m,A),m}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:i=[],...r}=n;Ae(e,"Command name");const o=e.split(" ").filter(Boolean),l=J(o),s=this.#i.get(l)?this.#o.get(l):this.#n.get(e);if(!s){const f=this.#s(),g=Z(l||e,f);throw new K(e,g)}if(typeof s.execute!="function"&&typeof s.loader!="function")throw new E(`Command "${s.name}" has no function to execute`,"INVALID_COMMAND",{commandName:s.name});const p=[...At(i)];this.#t.debug(`running command '${e}' programmatically with args: ${p.join(", ")}`);const{commandArgs:a,toolbox:c}=this.#k(s,p,r,l||e),d=this.getPluginManager();try{!this.#h&&d.hasPlugins()&&(await d.init({cli:this,cwd:this.#u,logger:this.#t}),this.#h=!0),await d.executeLifecycle("execute",c),await d.executeLifecycle("beforeCommand",c);let f;const g=a.global;if(g?.help){const u=this.#n.get("help");if(!u)throw new E("Help command not found","COMMAND_NOT_FOUND");f=await oe(u,c,a)}else if(g?.version??g?.V){const u=this.#n.get("version");if(!u)throw new E("Version command not found","COMMAND_NOT_FOUND");f=await oe(u,c,a)}else f=await oe(s,c,a);return await d.executeLifecycle("afterCommand",c,f),f}catch(f){throw await d.executeErrorHandlers(f,c),f}}clone(e){const n={...this.#e,...e},i=new En(this.#f,n);for(const[r,o]of this.#n)i.#n.set(r,o);for(const[r,o]of this.#i)i.#i.set(r,[...o]);for(const[r,o]of this.#o)i.#o.set(r,o);for(const r of this.#l)i.#l.push(r);return i.#r=this.#r,i.#a={...this.#a},i.#N(),i}async getAction(e){Ae(e,"Command name");const n=e.split(" ").filter(Boolean),i=J(n),r=this.#i.get(i)?this.#o.get(i):this.#n.get(e);if(!r){const o=this.#s(),l=Z(i||e,o);throw new K(e,l)}if(typeof r.execute=="function")return r.execute;if(typeof r.loader=="function")return dn(r);throw new E(`Command "${r.name}" has no execute or loader defined`,"INVALID_COMMAND",{commandName:r.name})}};var Js=Object.defineProperty,Zs=N((t,e)=>Js(t,"name",{value:e,configurable:!0}),"e$1"),Ys=Object.defineProperty,Qs=Zs((t,e)=>Ys(t,"name",{value:e,configurable:!0}),"o"),Xs=Object.defineProperty,el=Qs((t,e)=>Xs(t,"name",{value:e,configurable:!0}),"t");const zc=el((t,e)=>new Ks(t,e),"createCerebro");var tl=Object.defineProperty,nl=N((t,e)=>tl(t,"name",{value:e,configurable:!0}),"r$1"),il=Object.defineProperty,ol=nl((t,e)=>il(t,"name",{value:e,configurable:!0}),"r"),rl=Object.defineProperty,al=ol((t,e)=>rl(t,"name",{value:e,configurable:!0}),"o");const Fc=al(()=>{try{const t=require("node:module");if(typeof t.enableCompileCache=="function"){t.enableCompileCache();return}}catch{}try{require("v8-compile-cache")}catch{}},"enableCompileCache");var sl=Object.defineProperty,ll=N((t,e)=>sl(t,"name",{value:e,configurable:!0}),"u$2"),cl=Object.defineProperty,Cn=ll((t,e)=>cl(t,"name",{value:e,configurable:!0}),"p");const ul=Ke(import.meta.url),he=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Nn=Cn(t=>{if(typeof he<"u"&&he.versions&&he.versions.node){const[e,n]=he.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return he.getBuiltinModule(t)}return ul(t)},"__cjs_getBuiltinModule"),{execFileSync:pl}=Nn("node:child_process"),{totalmem:fl}=Nn("node:os");var dl=Object.defineProperty,Ie=Cn((t,e)=>dl(t,"name",{value:e,configurable:!0}),"r");const hl=/--max-old-space-size=(\d+)/,ml=/--max-semi-space-size=(\d+)/,gl=Ie(t=>Math.floor(fl()/1024/1024*t),"getDefaultMaxOldSpaceSize"),vl=Ie(t=>t<=512?4:t<=1024?8:t<=2048?16:t<=4096?32:t<=8192?64:Math.floor(Math.log2(t))*8,"getSemiSpaceSize"),Et=Ie((t,e)=>{for(const n of e){const i=t.exec(n);if(i)return Number.parseInt(i[1],10)}},"extractFlag"),Wc=Ie(t=>{const e=t?.maxOldSpacePercent??.75,n=[...Ut()],i=[...xe()],r=Et(hl,n),o=Et(ml,n);if(r!==void 0&&o!==void 0)return;const l=r??gl(e),s=o??vl(l),p=[];if(r===void 0&&p.push(`--max-old-space-size=${String(l)}`),o===void 0&&p.push(`--max-semi-space-size=${String(s)}`),p.length!==0)try{pl(Bt(),[...p,...n,...i.slice(1)],{env:H(),stdio:"inherit"}),W(0)}catch(a){const c=a.status;W(typeof c=="number"?c:1)}},"applyHeapTuning");var bl=Object.defineProperty,yl=N((t,e)=>bl(t,"name",{value:e,configurable:!0}),"T"),wl=Object.defineProperty,Me=yl((t,e)=>wl(t,"name",{value:e,configurable:!0}),"N");const $l=Ke(import.meta.url),me=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ol=Me(t=>{if(typeof me<"u"&&me.versions&&me.versions.node){const[e,n]=me.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return me.getBuiltinModule(t)}return $l(t)},"__cjs_getBuiltinModule"),{createRequire:xl}=Ol("node:module");var Pl=Object.defineProperty,Al=Me((t,e)=>Pl(t,"name",{value:e,configurable:!0}),"A$2"),El=Object.defineProperty,Ye=Al((t,e)=>El(t,"name",{value:e,configurable:!0}),"$"),Cl=Object.defineProperty,Nl=Ye((t,e)=>Cl(t,"name",{value:e,configurable:!0}),"r$1");const kl=Nl(t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
7
+ `),"normalizeLF"),jl=globalThis.process??Object.create(null),Ct={versions:{}},Nt=new Proxy(jl,{get(t,e){if(e in t)return t[e];if(e in Ct)return Ct[e]}});var _l=Object.defineProperty,Ll=Ye((t,e)=>_l(t,"name",{value:e,configurable:!0}),"b");const Sl=Ll((t,e,n,i)=>{const r={column:0,line:-1,...t.start},o={...r,...t.end},l=r.line,s=r.column,p=o.line,a=o.column;let c=Math.max(l-(n+1),0),d=Math.min(e.length,p+i);l===-1&&(c=0),p===-1&&(d=e.length);const f=p-l,g={};if(f)for(let u=0;u<=f;u++){const v=u+l;if(!s)g[v]=!0;else if(u===0){const w=e[v-1]?.length;g[v]=[s,(w??0)-s+1]}else if(u===f)g[v]=[0,a];else{const w=e[v-u]?.length;g[v]=[0,w]}}else s===a?g[l]=s?[s,0]:!0:g[l]=[s,(a??0)-(s??0)];return{end:d,markerLines:g,start:c}},"getMarkerLines");var Tl=Object.defineProperty,$e=Ye((t,e)=>Tl(t,"name",{value:e,configurable:!0}),"t");const Il=Nt.platform==="win32"&&!Nt.env?.WT_SESSION?">":"❯",Ml=$e((t,e,n)=>{const i={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...n,color:{gutter:$e(u=>u,"gutter"),marker:$e(u=>u,"marker"),message:$e(u=>u,"message"),...n?.color}},r=typeof e.start.column=="number";let o=kl(t).split(`
8
+ `);typeof i.tabWidth=="number"&&(o=o.map(u=>u.replaceAll(" "," ".repeat(i.tabWidth))));const{end:l,markerLines:s,start:p}=Sl(e,o,i.linesAbove,i.linesBelow),a=String(l).length,{gutter:c,marker:d,message:f}=i.color;let g=o.slice(p,l).map((u,v)=>{const w=p+1+v,y=s[w],O=` ${String(w)}`.slice(-a),A=!s[w+1],h=` ${O}${i.showGutter?" |":""}`;if(y){let m="";if(Array.isArray(y)){const b=u.replaceAll(/[^\t]/g," ").slice(0,Math.max(y[0]-1,0)),$=y[1]||1;m=[`
9
+ `,i.prefix+c(h.replaceAll(/\d/g," "))," ",b,d("^").repeat($)].join(""),A&&i.message&&(m+=` ${f(i.message)}`)}return[i.prefix+d(Il),c(h),u.length>0?` ${u}`:"",m].join("")}return`${i.prefix} ${c(h)}${u.length>0?` ${u}`:""}`}).join(`
10
+ `);return i.message&&!r&&(g=`${i.prefix+" ".repeat(a+1)+i.message}
11
+ ${g}`),g},"codeFrame");var Vl=Object.defineProperty,Ul=Me((t,e)=>Vl(t,"name",{value:e,configurable:!0}),"x$1"),Bl=Object.defineProperty,Dl=Ul((t,e)=>Bl(t,"name",{value:e,configurable:!0}),"x"),Rl=Object.defineProperty,q=Dl((t,e)=>Rl(t,"name",{value:e,configurable:!0}),"u");const X=q((t,...e)=>{process.env.DEBUG&&process.env.DEBUG==="true"&&console.debug(`error:parse-stacktrace: ${t}`,...e)},"debugLog"),ee="<unknown>",zl=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Fl=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,Wl=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,ql=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,Gl=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,Hl=/in\s(.*)\s\(at\s(.+)\)\sat/,Kl=/^(?:.*@)?(.*):(\d+):(\d+)$/,Jl=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Zl=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Yl=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,kt=/\(error: (.*)\)/,Ql=/at\s/,Xl=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,ec=/\S*(?:Error: |AggregateError:)/,kn=/^Anonymous function$/,tc=/^\s*in\s.*/,nc=/^.*?\s*at\s.*/,ic=/^.*?\s*@.*|\[native code\]/,jn=q((t,e)=>{const n=t.includes("safari-extension"),i=t.includes("safari-web-extension");return n||i?[t.includes("@")?t.split("@")[0]:ee,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},"extractSafariExtensionDetails"),_n=q((t,e)=>{const n=Wl.exec(e);n&&(t.file=n[1],t.line=+n[2],t.column=+n[3])},"parseMapped"),oc=q(t=>{const e=Hl.exec(t);if(e){X(`parse nested node error stack line: "${t}"`,`found: ${JSON.stringify(e)}`);const i=e[2].split(":");return{column:i[2]?+i[2]:void 0,file:i[0],line:i[1]?+i[1]:void 0,methodName:e[1]??ee,raw:t,type:void 0}}const n=Gl.exec(t);if(n){X(`parse node error stack line: "${t}"`,`found: ${JSON.stringify(n)}`);const i={column:n[4]?+n[4]:void 0,file:n[2]?n[2].replace(Ql,""):void 0,line:n[3]?+n[3]:void 0,methodName:n[1]??ee,raw:t,type:t.startsWith("internal")?"internal":void 0};return _n(i,`${n[2]}:${n[3]}:${n[4]}`),i}},"parseNode"),rc=q(t=>{const e=zl.exec(t);if(e){X(`parse chrome error stack line: "${t}"`,`found: ${JSON.stringify(e)}`);const n=e[2]?.startsWith("native"),i=e[2]?.startsWith("eval")||e[1]?.startsWith("eval");let r,o;if(i){const a=Fl.exec(t);if(a){const c=Xl.exec(a[1]);c?(e[2]=c[4]??c[1],e[3]=c[5]??c[2],e[4]=c[3]):a[2]&&(e[2]=a[1]),a[2]&&(r={column:a[4]?+a[4]:void 0,file:a[2],line:a[3]?+a[3]:void 0,methodName:"eval",raw:t,type:"eval"})}else{const c=ql.exec(t);c&&(o={column:c[4]?+c[4]:void 0,file:c[2],line:c[3]?+c[3]:void 0},r={column:c[6]?+c[6]:void 0,file:c[1],line:c[5]?+c[5]:void 0,methodName:"eval",raw:c[0],type:"eval"})}}const[l,s]=jn(e[1]?e[1].replace(kn,"<anonymous>"):ee,e[2]),p={column:e[4]?+e[4]:void 0,evalOrigin:r,file:s,line:e[3]?+e[3]:void 0,methodName:l,raw:t,type:i?"eval":n?"native":void 0};return o?(p.column=o.column,p.file=o.file,p.line=o.line):_n(p,`${s}:${e[3]}:${e[4]}`),p}},"parseChromium"),ac=q((t,e)=>{const n=Jl.exec(t);if(n){X(`parse gecko error stack line: "${t}"`,`found: ${JSON.stringify(n)}`);const i=n[3]?.includes(" > eval"),r=i&&n[3]&&Zl.exec(n[3]);let o;i&&r&&(n[3]=r[1],o={column:n[5]?+n[5]:void 0,file:n[3],line:n[4]?+n[4]:void 0,methodName:"eval",raw:t,type:"eval"},n[4]=r[2]);const[l,s]=jn(n[1]?n[1].replace(kn,"<anonymous>"):ee,n[3]);let p;(e?.type==="safari"||!i&&e?.type==="firefox")&&e.column?p=e.column:!i&&n[5]&&(p=+n[5]);let a;return(e?.type==="safari"||!i&&e?.type==="firefox")&&e.line?a=e.line:n[4]&&(a=+n[4]),{column:p,evalOrigin:o,file:s,line:a,methodName:l,raw:t,type:i?"eval":s.includes("[native code]")?"native":void 0}}},"parseGecko"),sc=q((t,e)=>{const n=Yl.exec(t);if(!(n&&n[2].includes(" > eval"))&&n)return X(`parse firefox error stack line: "${t}"`,`found: ${JSON.stringify(n)}`),{column:n[4]?+n[4]:e?.column??void 0,file:n[2],line:n[3]?+n[3]:e?.line??void 0,methodName:n[1]||ee,raw:t,type:void 0}},"parseFirefox"),lc=q(t=>{const e=Kl.exec(t);if(e)return X(`parse react android native error stack line: "${t}"`,`found: ${JSON.stringify(e)}`),{column:e[3]?+e[3]:void 0,file:e[1],line:e[2]?+e[2]:void 0,methodName:ee,raw:t,type:void 0}},"parseReactAndroidNative"),Ln=q((t,{filter:e,frameLimit:n=50}={})=>{const i=t;let r=(typeof i.stacktrace=="string"?i.stacktrace:t.stack??"").split(`
12
+ `).map(o=>(kt.test(o)?o.replace(kt,"$1"):o).trim()).filter(o=>!ec.test(o)&&o!=="eval code");return e&&(r=r.filter(o=>e(o))),r=r.slice(0,n),r.reduce((o,l,s)=>{if(!l||l.length>1024)return o;let p;if(tc.test(l))p=oc(l);else if(nc.test(l))p=rc(l);else if(ic.test(l)){let a;if(s===0){const c=t,d=c.columnNumber,f=c.lineNumber,g=c.line,u=c.column;d||f?a={column:d,line:f,type:"firefox"}:(g||u)&&(a={column:u,line:g,type:"safari"})}p=sc(l,a)??ac(l,a)}else p=lc(l);return p?o.push(p):X(`parse error stack line: "${l}"`,"not parser found"),o},[])},"parseStacktrace");var cc=Object.defineProperty,uc=Me((t,e)=>cc(t,"name",{value:e,configurable:!0}),"p"),pc=Object.defineProperty,Sn=uc((t,e)=>pc(t,"name",{value:e,configurable:!0}),"m");const fc=xl(import.meta.url),ae=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Qe=Sn(t=>{if(typeof ae<"u"&&ae.versions&&ae.versions.node){const[e,n]=ae.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ae.getBuiltinModule(t)}return fc(t)},"__cjs_getBuiltinModule"),{existsSync:dc,readFileSync:hc}=Qe("node:fs"),{relative:mc}=Qe("node:path"),{cwd:gc}=ae,{fileURLToPath:vc}=Qe("node:url");var bc=Object.defineProperty,_=Sn((t,e)=>bc(t,"name",{value:e,configurable:!0}),"o");const ue=_((t,e,n)=>n===0?t:e===" "?t+" ".repeat(n):t+" ".repeat(e*n),"getPrefix"),yc=_((t,e)=>{const n=t.replace("async file:","file:");return mc(e,n.startsWith("file:")?vc(n):n)},"getRelativePath"),wc=_((t,e,n)=>{if(e)return n.title(t.message);const i=t.message?`: ${t.message}`:"";return n.title(t.name+i)},"getTitleText"),Tn=_((t,{color:e,hideErrorTitle:n,indentation:i,prefix:r},o)=>`${ue(r,i,o)}${wc(t,n,e)}
13
+ `,"getMessage"),In=_((t,{color:e,indentation:n,prefix:i},r)=>{if(t.hint===void 0)return;const o=ue(i,n,r);let l="";if(Array.isArray(t.hint))for(const s of t.hint)l+=`${o+s}
14
+ `;else l+=o+t.hint;return e.hint(l)},"getHint"),Xe=_((t,{color:e,cwd:n,displayShortPath:i,indentation:r,prefix:o},l=0)=>{const s=i?yc(t.file,n):t.file,{fileLine:p,method:a}=e;return`${ue(o,r,l)}at ${t.methodName?`${a(t.methodName)} `:""}${p(s)}:${p(t.line?.toString()??"")}`},"getMainFrame"),Mn=_((t,{color:e,indentation:n,linesAbove:i,linesBelow:r,prefix:o,showGutter:l,showLineNumbers:s,tabWidth:p},a)=>{if(t.file===void 0)return;const c=t.file.replace("file://","");if(!dc(c))return;const d=hc(c,"utf8");return Ml(d,{start:{column:t.column,line:t.line}},{color:e,linesAbove:i,linesBelow:r,prefix:ue(o,n,a),showGutter:l,showLineNumbers:s,tabWidth:p})},"getCode"),Vn=_((t,e,n)=>{if(t.errors.length===0)return;let i=`${ue(e.prefix,e.indentation,n)}Errors:
15
+
16
+ `,r=!0;for(const o of t.errors)r?r=!1:i+=`
17
+
18
+ `,i+=Bn(o,{...e,framesMaxLimit:1,hideErrorCodeView:e.hideErrorErrorsCodeView},n+1);return`
19
+ ${i}`},"getErrors"),Un=_((t,e,n)=>{let i=`${ue(e.prefix,e.indentation,n)}Caused by:
20
+
21
+ `;const r=t.cause;i+=Tn(r,e,n);const o=Ln(r).shift(),l=In(r,e,n);if(l&&(i+=`${l}
22
+ `),o&&(i+=Xe(o,e,n),!e.hideErrorCauseCodeView)){const s=Mn(o,e,n);s!==void 0&&(i+=`
23
+ ${s}`)}if(r.cause)i+=`
24
+ ${Un(r,e,n+1)}`;else if(r instanceof AggregateError){const s=Vn(r,e,n);s!==void 0&&(i+=`
25
+ ${s}`)}return`
26
+ ${i}`},"getCause"),$c=_((t,e)=>(t.length>0?`
27
+ `:"")+t.map(n=>Xe(n,e)).join(`
28
+ `),"getStacktrace"),Bn=_((t,e,n)=>{const i={cwd:gc(),displayShortPath:!1,filterStacktrace:void 0,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...e,color:{fileLine:_(l=>l,"fileLine"),gutter:_(l=>l,"gutter"),hint:_(l=>l,"hint"),marker:_(l=>l,"marker"),message:_(l=>l,"message"),method:_(l=>l,"method"),title:_(l=>l,"title"),...e.color}},r=Ln(t,{filter:e.filterStacktrace,frameLimit:i.framesMaxLimit}),o=r.shift();return[e.hideMessage?void 0:Tn(t,i,n),In(t,i,n),o?Xe(o,i,n):void 0,o&&!i.hideErrorCodeView?Mn(o,i,n):void 0,t instanceof AggregateError?Vn(t,i,n):void 0,t.cause===void 0?void 0:Un(t,i,n),r.length>0?$c(r,i):void 0].filter(Boolean).join(`
29
+ `).replaceAll("\\","/")},"internalRenderError"),Oc=_((t,e={})=>{if(e.framesMaxLimit!==void 0&&e.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return Bn(t,e,0)},"renderError");var xc=Object.defineProperty,Pc=N((t,e)=>xc(t,"name",{value:e,configurable:!0}),"i$1"),Ac=Object.defineProperty,Ec=Pc((t,e)=>Ac(t,"name",{value:e,configurable:!0}),"n"),Cc=Object.defineProperty,jt=Ec((t,e)=>Cc(t,"name",{value:e,configurable:!0}),"n");const qc=jt((t={})=>({description:"Enhanced error handling and reporting with beautiful code frames",name:"error-handler",onError:jt((e,n)=>{const{logger:i,runtime:r}=n,{detailed:o=!1,exitOnError:l=!0,formatter:s,logErrors:p=!0,renderOptions:a={}}=t;if(p)if(s)i.error(s(e));else if(o){const c=r.getCwd(),d=Oc(e,{cwd:c,hideErrorCodeView:!1,hideErrorTitle:!1,hideMessage:!1,linesAbove:2,linesBelow:3,...a});i.error(d)}else i.error(e);l&&W(1)},"handleError"),version:"1.0.0"}),"errorHandlerPlugin");var Nc="1.0.0-alpha.27";const Gc={version:Nc};var kc=Object.defineProperty,jc=N((t,e)=>kc(t,"name",{value:e,configurable:!0}),"e");const Hc={argument:{description:"Package to execute (optionally with @version)",name:"package",type:String},description:"Execute a remote package without permanent installation",examples:[["vis dlx create-vite my-app","Scaffold a new project"],["vis dlx typescript@5.5.4 tsc --version","Run specific version"],["vis dlx -p cowsay -p lolcatjs -c 'echo hi | cowsay | lolcatjs'","Multiple packages with shell"],["vis install && vis dlx --offline typescript tsc --version","Hardened: pre-install + offline (no registry fetch on dlx)"]],group:"Run & Execute",loader:jc(()=>import("../packem_chunks/handler9.js"),"loader"),name:"dlx",options:[{alias:"p",description:"Additional packages to install (repeatable)",multiple:!0,name:"package",type:String},{alias:"c",defaultValue:!1,description:"Execute within shell environment",name:"shell-mode",type:Boolean},{alias:"s",defaultValue:!1,description:"Suppress output except command results",name:"silent",type:Boolean},{defaultValue:!1,description:"Resolve from local store only — fail rather than fetch from the registry. Pair with `vis install` for hardened npx-style workflows.",name:"offline",type:Boolean}]};export{Wc as N,zc as T,Hc as a,H as b,Mc as c,E as d,Vc as f,Fc as i,Gc as m,se as n,qc as w};