@visulima/vis 1.0.0-alpha.23 → 1.0.0-alpha.25

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 (94) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/LICENSE.md +1262 -151
  3. package/README.md +5 -3
  4. package/dashboard/dist/index.html +29 -29
  5. package/dist/bin.js +1 -1
  6. package/dist/binx.js +1 -1
  7. package/dist/config/index.d.ts +27 -8
  8. package/dist/packem_chunks/bin.js +299 -290
  9. package/dist/packem_chunks/fix.js +1 -1
  10. package/dist/packem_chunks/handler.js +1 -1
  11. package/dist/packem_chunks/handler10.js +2 -2
  12. package/dist/packem_chunks/handler11.js +1 -1
  13. package/dist/packem_chunks/handler12.js +1 -1
  14. package/dist/packem_chunks/handler13.js +1 -1
  15. package/dist/packem_chunks/handler14.js +10 -10
  16. package/dist/packem_chunks/handler15.js +1 -1
  17. package/dist/packem_chunks/handler16.js +1 -1
  18. package/dist/packem_chunks/handler17.js +1 -1
  19. package/dist/packem_chunks/handler18.js +1 -1
  20. package/dist/packem_chunks/handler19.js +1 -1
  21. package/dist/packem_chunks/handler2.js +2 -2
  22. package/dist/packem_chunks/handler20.js +1 -1
  23. package/dist/packem_chunks/handler21.js +5 -5
  24. package/dist/packem_chunks/handler22.js +2 -2
  25. package/dist/packem_chunks/handler23.js +2 -2
  26. package/dist/packem_chunks/handler24.js +1 -1
  27. package/dist/packem_chunks/handler25.js +1 -1
  28. package/dist/packem_chunks/handler27.js +1 -1
  29. package/dist/packem_chunks/handler28.js +1 -1
  30. package/dist/packem_chunks/handler29.js +1 -1
  31. package/dist/packem_chunks/handler3.js +1 -1
  32. package/dist/packem_chunks/handler30.js +1 -1
  33. package/dist/packem_chunks/handler31.js +1 -1
  34. package/dist/packem_chunks/handler32.js +3 -3
  35. package/dist/packem_chunks/handler34.js +5 -26
  36. package/dist/packem_chunks/handler35.js +22 -5
  37. package/dist/packem_chunks/handler36.js +60 -21
  38. package/dist/packem_chunks/handler37.js +6 -61
  39. package/dist/packem_chunks/handler38.js +24 -6
  40. package/dist/packem_chunks/handler39.js +152 -707
  41. package/dist/packem_chunks/handler4.js +1 -1
  42. package/dist/packem_chunks/handler40.js +10 -24
  43. package/dist/packem_chunks/handler41.js +25 -286
  44. package/dist/packem_chunks/handler42.js +707 -152
  45. package/dist/packem_chunks/handler43.js +24 -10
  46. package/dist/packem_chunks/handler44.js +322 -25
  47. package/dist/packem_chunks/handler45.js +46 -24
  48. package/dist/packem_chunks/handler46.js +1 -1
  49. package/dist/packem_chunks/handler47.js +7 -7
  50. package/dist/packem_chunks/handler48.js +65 -53
  51. package/dist/packem_chunks/handler5.js +3 -3
  52. package/dist/packem_chunks/handler6.js +1 -1
  53. package/dist/packem_chunks/handler8.js +1 -1
  54. package/dist/packem_chunks/handler9.js +1 -1
  55. package/dist/packem_chunks/heal-accept.js +1 -1
  56. package/dist/packem_chunks/heal.js +1 -1
  57. package/dist/packem_chunks/help-command.js +16 -16
  58. package/dist/packem_chunks/index.js +6 -6
  59. package/dist/packem_chunks/list.js +1 -1
  60. package/dist/packem_chunks/loader.js +2 -2
  61. package/dist/packem_chunks/prune.js +3 -3
  62. package/dist/packem_chunks/run.js +1 -1
  63. package/dist/packem_chunks/sync2.js +1 -1
  64. package/dist/packem_chunks/tripwire.js +1 -1
  65. package/dist/packem_chunks/verify-lockfile.js +1 -1
  66. package/dist/packem_shared/affected-shas-Dm7eqcI8.js +1 -0
  67. package/dist/packem_shared/{ai-analysis-B8pDCOuT.js → ai-analysis-Csn82p17.js} +1 -1
  68. package/dist/packem_shared/{ai-fix-DiGSrGKv.js → ai-fix-BlYyz5bI.js} +3 -3
  69. package/dist/packem_shared/{cyclonedx-B293T7R0.js → cyclonedx-D6F9rAay.js} +1 -1
  70. package/dist/packem_shared/dependency-scan-s2MD0vi-.js +1 -0
  71. package/dist/packem_shared/{docker-BhBBfWfc.js → docker-BU-7veP5.js} +1 -1
  72. package/dist/packem_shared/index-D9ZIw4ra.js +29 -0
  73. package/dist/packem_shared/index-PexbdLyT.js +1 -0
  74. package/dist/packem_shared/lifecycle-ChCFTm5Q.js +2 -0
  75. package/dist/packem_shared/{lockfile-CQLFNyVa.js → lockfile-BG1HvBzH.js} +1 -1
  76. package/dist/packem_shared/{min-release-age-Cz6HbF-I.js → min-release-age-heJgeP7o.js} +1 -1
  77. package/dist/packem_shared/peer-warnings-EvSJ18gE.js +1 -0
  78. package/dist/packem_shared/pm-runner-Cj76BV8q.js +1 -0
  79. package/dist/packem_shared/{provenance-BcldGs02.js → provenance-CdvMwB2R.js} +1 -1
  80. package/dist/packem_shared/{resolve-explicit-2G-2HWtR.js → resolve-explicit-CRFybyxv.js} +1 -1
  81. package/dist/packem_shared/{s1ngularity-Boxkax0D.js → s1ngularity-CiZla5EP.js} +1 -1
  82. package/dist/packem_shared/{signatures-SO-fyExV.js → signatures-BsEDWhME.js} +1 -1
  83. package/dist/packem_shared/{typosquats-CioMnpnb.js → typosquats-_7T7U2q2.js} +1 -1
  84. package/dist/packem_shared/vis-update-app-qhQPV97i.js +1 -0
  85. package/index.js +52 -52
  86. package/package.json +14 -25
  87. package/schemas/project.schema.json +4 -0
  88. package/schemas/vis-config.schema.json +18 -13
  89. package/dist/packem_shared/dependency-scan-BbtivycX.js +0 -1
  90. package/dist/packem_shared/index-C1w1GXdS.js +0 -1
  91. package/dist/packem_shared/index-CZX_II5N.js +0 -29
  92. package/dist/packem_shared/lifecycle-wRE7ymVc.js +0 -2
  93. package/dist/packem_shared/pm-runner-CVliR6Ie.js +0 -1
  94. package/dist/packem_shared/vis-update-app-BWA1kA1q.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/vis",
3
- "version": "1.0.0-alpha.23",
3
+ "version": "1.0.0-alpha.25",
4
4
  "description": "A monorepo dev toolkit — task runner, remote caching, security scanning, git hooks, and AI agent integrations — powered by @visulima/task-runner",
5
5
  "keywords": [
6
6
  "build",
@@ -13,9 +13,7 @@
13
13
  "workspace"
14
14
  ],
15
15
  "homepage": "https://visulima.com/packages/vis",
16
- "bugs": {
17
- "url": "https://github.com/visulima/visulima/issues"
18
- },
16
+ "bugs": "https://github.com/visulima/visulima/issues",
19
17
  "repository": {
20
18
  "type": "git",
21
19
  "url": "git+https://github.com/visulima/visulima.git",
@@ -80,24 +78,15 @@
80
78
  "LICENSE.md"
81
79
  ],
82
80
  "dependencies": {
83
- "@floating-ui/core": "1.7.5",
84
- "@floating-ui/dom": "1.7.6",
85
- "@hono/node-server": "^2.0.2",
86
- "@visulima/error": "6.0.0-alpha.27",
87
- "@visulima/secret-scanner": "1.0.0-alpha.3",
88
- "@visulima/source-map": "3.0.0-alpha.9",
89
- "@visulima/task-runner": "1.0.0-alpha.15",
90
- "@visulima/tui": "1.0.0-alpha.18",
91
- "graphology": "0.26.0",
92
- "graphology-layout-forceatlas2": "0.10.1",
93
- "graphology-types": "0.24.8",
94
- "hono": "4.12.19",
81
+ "@visulima/secret-scanner": "1.0.0-alpha.4",
82
+ "@visulima/tabular": "4.0.0-alpha.12",
83
+ "@visulima/task-runner": "1.0.0-alpha.16",
84
+ "@visulima/tui": "1.0.0-alpha.20",
95
85
  "jiti": "^2.7.0",
96
86
  "module-replacements": "^2.11.0",
97
87
  "module-replacements-codemods": "^1.2.1",
98
88
  "react": "19.2.6",
99
89
  "react-reconciler": ">=0.33.0",
100
- "sigma": "3.0.3",
101
90
  "tinyexec": "^1.1.2"
102
91
  },
103
92
  "peerDependencies": {
@@ -121,14 +110,14 @@
121
110
  }
122
111
  },
123
112
  "optionalDependencies": {
124
- "@visulima/vis-binding-linux-arm64-gnu": "1.0.0-alpha.23",
125
- "@visulima/vis-binding-darwin-x64": "1.0.0-alpha.23",
126
- "@visulima/vis-binding-darwin-arm64": "1.0.0-alpha.23",
127
- "@visulima/vis-binding-linux-arm64-musl": "1.0.0-alpha.23",
128
- "@visulima/vis-binding-linux-x64-gnu": "1.0.0-alpha.23",
129
- "@visulima/vis-binding-linux-x64-musl": "1.0.0-alpha.23",
130
- "@visulima/vis-binding-win32-x64-msvc": "1.0.0-alpha.23",
131
- "@visulima/vis-binding-win32-arm64-msvc": "1.0.0-alpha.23"
113
+ "@visulima/vis-binding-darwin-arm64": "1.0.0-alpha.25",
114
+ "@visulima/vis-binding-darwin-x64": "1.0.0-alpha.25",
115
+ "@visulima/vis-binding-linux-arm64-musl": "1.0.0-alpha.25",
116
+ "@visulima/vis-binding-linux-arm64-gnu": "1.0.0-alpha.25",
117
+ "@visulima/vis-binding-linux-x64-gnu": "1.0.0-alpha.25",
118
+ "@visulima/vis-binding-linux-x64-musl": "1.0.0-alpha.25",
119
+ "@visulima/vis-binding-win32-arm64-msvc": "1.0.0-alpha.25",
120
+ "@visulima/vis-binding-win32-x64-msvc": "1.0.0-alpha.25"
132
121
  },
133
122
  "engines": {
134
123
  "node": "^22.14.0 || >=24.10.0"
@@ -28,6 +28,10 @@
28
28
  ],
29
29
  "description": "Project layer, used for constraint inheritance and query filtering."
30
30
  },
31
+ "name": {
32
+ "type": "string",
33
+ "description": "Project name. When set, takes precedence over `package.json#name` as the project's identity in the workspace graph and CLI filters. Falls back to `package.json#name` when omitted."
34
+ },
31
35
  "owners": {
32
36
  "type": "array",
33
37
  "items": {
@@ -36,6 +36,11 @@
36
36
  "$ref": "#/$defs/CodeownersConfig",
37
37
  "description": "Code ownership configuration. Controls how `vis sync codeowners` renders the generated CODEOWNERS file."
38
38
  },
39
+ "defaultBase": {
40
+ "type": "string",
41
+ "description": "Default base branch used by `vis affected`, `vis ci`, and `vis run --affected` when no explicit `--base` is passed and no CI smart-resolver fires.\n\nResolved as `origin/<defaultBase>` against the local clone; should be a branch name (not a fully-qualified ref) such as `main`, `master`, or `trunk`. Falls back to `main` when omitted.\n\nMigrated automatically from `nx.json#affected.defaultBase` / `nx.json#defaultBase` by `vis migrate nx`.",
42
+ "default": "main"
43
+ },
39
44
  "constraints": {
40
45
  "type": "object",
41
46
  "properties": {
@@ -1057,19 +1062,6 @@
1057
1062
  "description": "When true, prevents transitive dependencies from using exotic sources (git repositories, direct tarball URLs). Only direct dependencies may use such sources. Equivalent to pnpm's `blockExoticSubdeps`.",
1058
1063
  "default": false
1059
1064
  },
1060
- "exoticSubdepsAllow": {
1061
- "type": "array",
1062
- "items": {
1063
- "type": "string"
1064
- },
1065
- "description": "Package names exempted from the `blockExoticSubdeps` check. Bare names and a trailing `*` glob (`@scope/*`) are supported. Use for an internal package legitimately published as a git or tarball dependency.",
1066
- "examples": [
1067
- [
1068
- "@myorg/legacy",
1069
- "internal-*"
1070
- ]
1071
- ]
1072
- },
1073
1065
  "depsDev": {
1074
1066
  "type": "object",
1075
1067
  "properties": {
@@ -1102,6 +1094,19 @@
1102
1094
  "additionalProperties": false,
1103
1095
  "description": "deps.dev (Google Open Source Insights) data-source configuration. Public, unauthenticated; pulls Scorecard data + advisories from `api.deps.dev`. Complements or replaces Socket.dev. Heavily cached."
1104
1096
  },
1097
+ "exoticSubdepsAllow": {
1098
+ "type": "array",
1099
+ "items": {
1100
+ "type": "string"
1101
+ },
1102
+ "description": "Package names exempted from the `blockExoticSubdeps` check. Bare names and a trailing `*` glob (`@scope/*`) are supported. Use for an internal package legitimately published as a git or tarball dependency.",
1103
+ "examples": [
1104
+ [
1105
+ "@myorg/legacy",
1106
+ "internal-*"
1107
+ ]
1108
+ ]
1109
+ },
1105
1110
  "marshalls": {
1106
1111
  "type": "object",
1107
1112
  "properties": {
@@ -1 +0,0 @@
1
- var g=Object.defineProperty;var m=(o,s)=>g(o,"name",{value:s,configurable:!0});import{i as v,M as u,$ as d}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{F as h}from"./lockfile-CQLFNyVa.js";import{E as w,A as D}from"../packem_chunks/bin.js";var b=Object.defineProperty,f=m((o,s)=>b(o,"name",{value:s,configurable:!0}),"l");const j={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"}},S=f(o=>{const s=j[o];return s?[...s.aliases??[],s.file].map(e=>({file:e,type:s.type})):[]},"lockfileCandidates"),y=f((o,s)=>{const e=S(s);if(e.length!==0)return e.find(r=>v(u(o,r.file)))??e[e.length-1]},"resolveLockfile"),k=f(o=>{try{return JSON.parse(d(o))}catch{return}},"readPackageJsonShape"),L=f(o=>{const s=[],e=k(u(o,"package.json"));e&&s.push(e);const r=w(o);let a;if(r?a=r:e?.workspaces&&(Array.isArray(e.workspaces)?a=e.workspaces:e.workspaces.packages&&(a=e.workspaces.packages)),!a)return s;const c=D(o,a);for(const t of c){const n=k(u(o,t,"package.json"));n&&s.push(n)}return s},"collectWorkspacePackageJsons"),P=f((o,s)=>{const e=new Set,r=[],a=new Map;for(const t of s){const n=a.get(t.name);n?n.push(t):a.set(t.name,[t])}const c=f(t=>{if(t)for(const n of Object.keys(t))e.has(n)||(e.add(n),r.push(n))},"enqueueRoots");for(const t of L(o))c(t.dependencies),c(t.peerDependencies),c(t.optionalDependencies);for(;r.length>0;){const t=r.shift(),n=a.get(t);if(n){for(const p of n)for(const i of[p.dependencies,p.peerDependencies,p.optionalDependencies])if(i)for(const l of Object.keys(i))e.has(l)||(e.add(l),r.push(l))}}return e},"computeProdReachable"),E=f((o,s,e={})=>{const r=y(o,s);if(!r)return[];let a;try{a=d(u(o,r.file))}catch{return[]}const c=h(a,r.type);if(c.length===0)return[];const t=e.includeDev??!0?void 0:P(o,c),n=new Set,p=[];for(const i of c){if(t&&!t.has(i.name))continue;const l=`${i.name}@${i.version}`;n.has(l)||(n.add(l),p.push({isDev:!1,name:i.name,version:i.version}))}return p},"lockedPackages"),J=f((o,s)=>{const e=y(o,s);if(!e)return[];let r;try{r=d(u(o,e.file))}catch{return[]}const a=h(r,e.type);if(a.length===0)return[];const c=new Map;for(const n of a)c.has(n.name)||c.set(n.name,new Set),c.get(n.name).add(n.version);const t=[];for(const[n,p]of c)p.size<=1||t.push({name:n,versions:[...p]});return t.sort((n,p)=>n.name.localeCompare(p.name))},"findDuplicateDependencies");export{j as L,J as f,E as l,y as r};
@@ -1 +0,0 @@
1
- var D=Object.defineProperty;var v=(t,e)=>D(t,"name",{value:e,configurable:!0});import{m as w,D as C,g as S,f as A}from"./provenance-BcldGs02.js";import{L as m}from"../packem_chunks/bin.js";import{x as W}from"./build-scripts-3E2pmscY.js";import{n as b}from"./license-zZU7aavK.js";import{a as j,C as F,$ as U}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{F as E}from"./lockfile-CQLFNyVa.js";import{L as N}from"./dependency-scan-BbtivycX.js";var I=Object.defineProperty,L=v((t,e)=>I(t,"name",{value:e,configurable:!0}),"i");const g={CRITICAL:0,HIGH:1,LOW:3,MODERATE:2,UNKNOWN:4},we=L((t,e)=>{const i=g[(t.vulnerability.severity??"UNKNOWN").toUpperCase()]??4,n=g[(e.vulnerability.severity??"UNKNOWN").toUpperCase()]??4;return i-n||t.packageName.localeCompare(e.packageName)||t.packageVersion.localeCompare(e.packageVersion)},"compareFindingsForDisplay"),M=L((t,e)=>{const i=g[e.toUpperCase()]??2;return(g[t.toUpperCase()]??4)<=i},"severityPassesFilter"),P=["firstSeen","installScripts","license","malware","publisherChange","score","unexpectedDeps","vulnerability"];var V=Object.defineProperty,R=v((t,e)=>V(t,"name",{value:e,configurable:!0}),"r");const $=6e4,_=R((t,e,i)=>{for(const n of i)if(n===t||n===`${t}@${e}`||n.endsWith("*")&&t.startsWith(n.slice(0,-1)))return!0;return!1},"isExcluded"),T=R(async(t,e)=>{const i=e.security?.policies?.firstSeen;if(i?.minutes===void 0||i.minutes<=0)return[];const n=i.minutes,a=i.exclude??[],o=e.security?.acceptedRisks,c=n*$,s=Date.now();return(await w(t.packages,C,async r=>{if(_(r.name,r.version,a))return;const l=await S(r.name,{workspaceRoot:t.workspaceRoot});if(l===void 0)return;const p=l.time?.[r.version];if(p===void 0)return;const u=Date.parse(p);if(Number.isNaN(u))return;const f=s-u;if(f>=c)return;const k=Math.max(0,Math.floor(f/$));return{acceptedRisk:m(r.name,r.version,o,"firstSeen"),data:{ageMinutes:k,minimumMinutes:n,publishedAt:p},packageName:r.name,policy:"firstSeen",reason:`${r.name}@${r.version} was published ${String(k)} min ago — below the ${String(n)} min firstSeen cooldown.`,severity:"block",version:r.version}})).filter(r=>r!==void 0)},"evaluateFirstSeenPolicy");var K=Object.defineProperty,H=v((t,e)=>K(t,"name",{value:e,configurable:!0}),"n");const q=H((t,e)=>{const i=e.security?.policies?.installScripts;if(!i)return[];const n=i.allow??{},a=i.strict===!0;if(!a&&Object.keys(n).length===0)return[];const o=W(t.workspaceRoot,n,{pinVersions:e.security?.pinVersions===!0});if(o.unapproved.length===0)return[];const c=e.security?.acceptedRisks,s=a?"block":"warn";return o.unapproved.map(r=>({acceptedRisk:m(r.name,r.version??"*",c,"installScripts"),data:{hooks:r.hooks},packageName:r.name,policy:"installScripts",reason:`${r.name}${r.version?`@${r.version}`:""} declares unapproved build script(s): ${r.hooks.join(", ")}`,severity:s,version:r.version??"*"}))},"evaluateInstallScriptsPolicy");var z=Object.defineProperty,y=v((t,e)=>z(t,"name",{value:e,configurable:!0}),"a");const Y=new Set(["AND","OR"]),B=y(t=>{const e=t.replaceAll("("," ").replaceAll(")"," ").split(/\s+/).map(a=>a.trim()).filter(a=>a.length>0),i=[];let n=!1;for(const a of e){const o=a.toUpperCase();if(n){n=!1;continue}if(o==="WITH"){n=!0;continue}if(Y.has(o))continue;const c=a.endsWith("+"),s=c?a.slice(0,-1):a,r=b(s)??s;i.push(r),c&&i.push(`${r}-or-later`)}return i},"extractSpdxLeaves"),G=y(t=>{if(typeof t.license=="string"){const e=t.license.trim();return e.length>0?e:void 0}if(t.license&&typeof t.license=="object"&&typeof t.license.type=="string"){const e=t.license.type.trim();if(e.length>0)return e}if(Array.isArray(t.licenses)&&t.licenses.length>0){const e=t.licenses.map(i=>i&&typeof i.type=="string"?i.type.trim():"").filter(i=>i.length>0);if(e.length>0)return e.length===1?e[0]:`(${e.join(" OR ")})`}},"declaredLicense"),J=y((t,e)=>{if(e.length===0)return;const i=new Set(e.map(n=>b(n)??n).map(n=>n.toLowerCase()));for(const n of t)if(i.has(n.toLowerCase()))return n},"findDeniedLeaf"),Q=y((t,e)=>{if(e.length===0)return;const i=new Set(e.map(n=>b(n)??n).map(n=>n.toLowerCase()));for(const n of t)if(!i.has(n.toLowerCase()))return n},"findUnallowedLeaf"),X=y((t,e)=>{const i=e.security?.policies?.license;if(!i)return[];const n=i.allow??[],a=i.deny??[];if(n.length===0&&a.length===0)return[];const o=e.security?.acceptedRisks,c=[];for(const s of t.packages){const r=t.manifestData?.get(`${s.name}@${s.version}`),l=r?G(r):void 0;if(!l){n.length>0&&c.push({acceptedRisk:m(s.name,s.version,o,"license"),data:{declaredLicense:null},packageName:s.name,policy:"license",reason:`${s.name}@${s.version} declares no license; allow-list mode requires one of: ${n.join(", ")}`,severity:"block",version:s.version});continue}const p=B(l),u=J(p,a);if(u){c.push({acceptedRisk:m(s.name,s.version,o,"license"),data:{declaredLicense:l,deniedLicense:u},packageName:s.name,policy:"license",reason:`${s.name}@${s.version} uses denied license '${u}' (declared: ${l})`,severity:"block",version:s.version});continue}const f=Q(p,n);f&&c.push({acceptedRisk:m(s.name,s.version,o,"license"),data:{allowList:n,declaredLicense:l,unallowedLicense:f},packageName:s.name,policy:"license",reason:`${s.name}@${s.version} uses license '${f}' which is not on the allow-list (declared: ${l})`,severity:"block",version:s.version})}return c},"evaluateLicensePolicy");var Z=Object.defineProperty,O=v((t,e)=>Z(t,"name",{value:e,configurable:!0}),"c$1");const ee=6e4,te=O((t,e,i)=>{for(const n of i)if(n===t||n===`${t}@${e}`||n.endsWith("*")&&t.startsWith(n.slice(0,-1)))return!0;return!1},"isExcluded"),ie=O(async(t,e)=>{const i=e.security?.policies?.publisherChange;if(i?.mode!=="no-downgrade")return[];const n=i.exclude??[],a=typeof i.ignoreAfter=="number"?i.ignoreAfter*ee:void 0,o=e.security?.acceptedRisks,c=Date.now();return(await w(t.packages,C,async s=>{if(te(s.name,s.version,n))return;const r=await S(s.name,{workspaceRoot:t.workspaceRoot});if(r===void 0)return;if(a!==void 0){const p=r.time?.[s.version],u=p===void 0?Number.NaN:Date.parse(p);if(!Number.isNaN(u)&&c-u>a)return}if(r.versions[s.version]?.dist?.attestations?.provenance!==void 0)return;const l=A(r,s.version);if(l!==void 0)return{acceptedRisk:m(s.name,s.version,o,"publisherChange"),data:{priorVersionWithProvenance:l},packageName:s.name,policy:"publisherChange",reason:`${s.name}@${s.version} dropped the provenance attestation that ${s.name}@${l} carried — publisher trust downgrade.`,severity:"block",version:s.version}})).filter(s=>s!==void 0)},"evaluatePublisherChangePolicy");var ne=Object.defineProperty,h=v((t,e)=>ne(t,"name",{value:e,configurable:!0}),"l$1");const se=h(t=>{for(const e of Object.values(N))for(const i of[e.file,...e.aliases??[]])if(t===i||t.endsWith(`/${i}`)||t.endsWith(`.${i}`))return e.type},"detectLockfileType"),re=h((t,e,i)=>{const n=j(e)?e:F(t,e);let a;try{a=U(n)}catch{return}const o=se(n)??N[i]?.type;if(!o)return;const c=E(a,o);if(c.length===0)return;const s=new Set;for(const r of c)s.add(`${r.name}@${r.version}`);return s},"loadBaselineKeys"),oe=h((t,e)=>{for(const i of e)if(i===t||i.endsWith("*")&&t.startsWith(i.slice(0,-1)))return!0;return!1},"matchesAllowList"),ae=h((t,e)=>{const i=e.security?.policies?.unexpectedDeps;if(!i)return[];const n=i.allow??[],a=i.baselineLockfile;if(n.length===0&&!a)return[];const o=a?re(t.workspaceRoot,a,t.packageManager):void 0,c=e.security?.acceptedRisks,s=[];for(const r of t.packages){const l=n.length===0||oe(r.name,n),p=o?o.has(`${r.name}@${r.version}`):!0;if(l&&p)continue;const u=[],f={};l||(u.push(`not on allow-list (${n.length} entr${n.length===1?"y":"ies"})`),f.allowList=n),!p&&o&&(u.push(`not present in baseline lockfile (${a})`),f.baselineLockfile=a),s.push({acceptedRisk:m(r.name,r.version,c,"unexpectedDeps"),data:f,packageName:r.name,policy:"unexpectedDeps",reason:`${r.name}@${r.version} is unexpected: ${u.join("; ")}`,severity:"block",version:r.version})}return s},"evaluateUnexpectedDepsPolicy");var ce=Object.defineProperty,le=v((t,e)=>ce(t,"name",{value:e,configurable:!0}),"c");const ue=le((t,e)=>{if(!t.osvFindings||t.osvFindings.size===0)return[];const i=e.security?.policies?.vulnerability?.failOn,n=e.security?.acceptedRisks,a=[];for(const o of t.packages){const c=t.osvFindings.get(o.name);if(!(!c||c.length===0))for(const s of c){const r=i?M(s.severity,i)?"block":"warn":"info";a.push({acceptedRisk:m(o.name,o.version,n,"vulnerability"),data:{advisoryId:s.id,aliases:s.aliases??[],cvssScore:s.cvssScore,fixedVersions:s.fixedVersions,severity:s.severity,summary:s.summary},packageName:o.name,policy:"vulnerability",reason:`${s.severity} ${s.id} affects ${o.name}@${o.version}: ${s.summary}`,severity:r,version:o.version})}}return a},"evaluateVulnerabilityPolicy");var pe=Object.defineProperty,d=v((t,e)=>pe(t,"name",{value:e,configurable:!0}),"t");const x=[{evaluate:ue,isConfigured:d(t=>t.security?.policies?.vulnerability!==void 0,"isConfigured"),name:"vulnerability",offlineSupported:!0,surfaces:["audit","doctor"]},{evaluate:X,isConfigured:d(t=>{const e=t.security?.policies?.license;return!!(e&&(e.allow&&e.allow.length>0||e.deny&&e.deny.length>0))},"isConfigured"),name:"license",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:q,isConfigured:d(t=>{const e=t.security?.policies?.installScripts;return!!(e&&(e.allow&&Object.keys(e.allow).length>0||e.strict===!0))},"isConfigured"),name:"installScripts",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:ae,isConfigured:d(t=>{const e=t.security?.policies?.unexpectedDeps;return!!(e&&(e.allow&&e.allow.length>0||typeof e.baselineLockfile=="string"))},"isConfigured"),name:"unexpectedDeps",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:T,isConfigured:d(t=>{const e=t.security?.policies?.firstSeen?.minutes;return typeof e=="number"&&e>0},"isConfigured"),name:"firstSeen",offlineSupported:!1,surfaces:["audit","doctor","install"]},{evaluate:ie,isConfigured:d(t=>t.security?.policies?.publisherChange?.mode==="no-downgrade","isConfigured"),name:"publisherChange",offlineSupported:!1,surfaces:["audit","doctor","install"]}],fe=d((t,e,i)=>x.filter(n=>n.surfaces.includes(t)?i!==void 0?i.has(n.name):n.isConfigured(e):!1),"selectModules"),Ce=d(async(t,e,i)=>{const n=fe(e,i.visConfig,i.enabledPolicies),a=[];for(const o of n){if(t.offline&&!o.offlineSupported){a.push({packageName:"*",policy:o.name,reason:`policy.${o.name} skipped: requires network (--offline)`,severity:"info",version:"*"});continue}try{const c=await o.evaluate(t,i.visConfig);a.push(...c)}catch(c){const s=c instanceof Error?c.message:String(c);a.push({packageName:"*",policy:o.name,reason:`policy.${o.name} failed: ${s}`,severity:"info",version:"*"})}}return a},"evaluatePolicies"),de=(()=>{const t=new Map;for(const e of P)t.set(e.toLowerCase(),e);return t})(),Se=d(()=>x.map(t=>t.name),"getRegisteredPolicyNames"),Ne=d((t,e)=>{if(t===void 0)return;const i=t.trim().toLowerCase();if(i===""||i==="none")return new Set;if(i==="all")return new Set(P);const n=new Set;for(const a of t.split(",").map(o=>o.trim()).filter(o=>o.length>0)){const o=a.replace(/^_+/,"").replaceAll(/_+([a-z])/g,(s,r)=>r.toUpperCase()),c=de.get(o.toLowerCase());c===void 0?e?.(a):n.add(c)}return n},"parsePoliciesFlag");export{we as c,Ce as e,Se as g,Ne as p,M as s};
@@ -1,29 +0,0 @@
1
- var Vn=Object.defineProperty;var E=(t,e)=>Vn(t,"name",{value:e,configurable:!0});import{createRequire as Un}from"node:module";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
2
- const require = __cjs_mod__.createRequire(import.meta.url);
3
- const Dn=Un(import.meta.url),pe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Bn=E(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 Dn(t)},"__cjs_getBuiltinModule"),{createRequire:He}=Bn("node:module"),Rn=16,et=32,zn=64,ie=128,$e="positionals";var Wn=Object.defineProperty,kt=E((t,e)=>Wn(t,"name",{value:e,configurable:!0}),"i$9"),Fn=Object.defineProperty,_t=kt((t,e)=>Fn(t,"name",{value:e,configurable:!0}),"s"),qn=Object.defineProperty,Lt=_t((t,e)=>qn(t,"name",{value:e,configurable:!0}),"s"),Gn=Object.defineProperty,St=Lt((t,e)=>Gn(t,"name",{value:e,configurable:!0}),"i"),Hn=Object.defineProperty,Tt=St((t,e)=>Hn(t,"name",{value:e,configurable:!0}),"t");Tt(t=>t instanceof Error&&t.type==="VisulimaError","isVisulimaError");let Jn=class extends Error{static{E(this,"V")}static{kt(this,"g")}static{_t(this,"p")}static{Lt(this,"V")}static{St(this,"VisulimaError")}static{Tt(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:e,hint:n,location:i,message:o,name:r,stack:l,title:s}){super(o,{cause:e}),this.title=s,this.name=r,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 Kn=Object.defineProperty,It=E((t,e)=>Kn(t,"name",{value:e,configurable:!0}),"t$7"),Yn=Object.defineProperty,Mt=It((t,e)=>Yn(t,"name",{value:e,configurable:!0}),"t"),Zn=Object.defineProperty,Xn=Mt((t,e)=>Zn(t,"name",{value:e,configurable:!0}),"e");let j=class extends Jn{static{E(this,"m")}static{It(this,"u")}static{Mt(this,"c")}static{Xn(this,"CerebroError")}code;context;constructor(e,n,i){super({message:e,name:"CerebroError"}),this.code=n,this.context=i}};var Qn=Object.defineProperty,ei=E((t,e)=>Qn(t,"name",{value:e,configurable:!0}),"a$2"),ti=Object.defineProperty,ni=ei((t,e)=>ti(t,"name",{value:e,configurable:!0}),"l"),ii=Object.defineProperty,S=ni((t,e)=>ii(t,"name",{value:e,configurable:!0}),"r");const U=S(t=>"Deno"in t,"hasDeno"),D=S(t=>"Bun"in t,"hasBun"),Pe=S(()=>{if(U(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"),ri=S(()=>U(globalThis)?globalThis.Deno.cwd():D(globalThis)?globalThis.Bun.process.cwd():process.cwd(),"getCwd"),G=S(()=>{if(U(globalThis)){const t=globalThis.Deno;return new Proxy(t.env.toObject(),{get:S((e,n)=>typeof n=="string"?t.env.get(n):e[n],"get"),has:S((e,n)=>typeof n=="string"?t.env.has(n):n in e,"has"),set:S((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"),Vt=S(()=>U(globalThis)?[]:D(globalThis)?globalThis.Bun.process.execArgv:process.execArgv,"getExecArgv"),Ut=S(()=>U(globalThis)?globalThis.Deno.execPath():D(globalThis)?globalThis.Bun.process.execPath:process.execPath,"getExecPath");S(()=>{if(U(globalThis)){const t=globalThis.Deno.build?.os??"unknown";return t==="windows"?"win32":t}return D(globalThis)?globalThis.Bun.platform??"unknown":process.platform},"getPlatform");S(()=>{if(U(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");S(()=>{if(U(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 q=S((t=0)=>{if(U(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=S((t,e)=>{if(U(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 oi=Object.defineProperty,Ee=E((t,e)=>oi(t,"name",{value:e,configurable:!0}),"k$1");const z=new Uint32Array(65536),ai=Ee((t,e)=>{const n=t.length,i=e.length,o=1<<n-1;let r=-1,l=0,s=n,p=n;for(;p--;)z[t.charCodeAt(p)]|=1<<p;for(p=0;p<i;p++){let a=z[e.charCodeAt(p)];const c=a|l;a|=(a&r)+r^r,l|=~(a|r),r&=a,l&o&&s++,r&o&&s--,l=l<<1|1,r=r<<1|~(c|l),l&=c}for(p=n;p--;)z[t.charCodeAt(p)]=0;return s},"myers_32"),si=Ee((t,e)=>{const n=e.length,i=t.length,o=[],r=[],l=Math.ceil(n/32),s=Math.ceil(i/32);for(let u=0;u<l;u++)r[u]=-1,o[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++)z[t.charCodeAt(O)]|=1<<O;for(let O=0;O<n;O++){const A=z[e.charCodeAt(O)],d=r[O/32|0]>>>O&1,m=o[O/32|0]>>>O&1,b=A|u,$=((A|m)&v)+v^v|A|m;let P=u|~($|v),k=v&$;P>>>31^d&&(r[O/32|0]^=1<<O),k>>>31^m&&(o[O/32|0]^=1<<O),P=P<<1|d,k=k<<1|m,v=k|~(b|P),u=P&b}for(let O=w;O<y;O++)z[t.charCodeAt(O)]=0}let a=0,c=-1;const h=p*32,f=Math.min(32,i-h)+h;for(let u=h;u<f;u++)z[t.charCodeAt(u)]|=1<<u;let g=i;for(let u=0;u<n;u++){const v=z[e.charCodeAt(u)],w=r[u/32|0]>>>u&1,y=o[u/32|0]>>>u&1,O=v|a,A=((v|y)&c)+c^c|v|y;let d=a|~(A|c),m=c&A;g+=d>>>i-1&1,g-=m>>>i-1&1,d>>>31^w&&(r[u/32|0]^=1<<u),m>>>31^y&&(o[u/32|0]^=1<<u),d=d<<1|w,m=m<<1|y,c=m|~(O|d),a=d&O}for(let u=h;u<f;u++)z[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?ai(t,e):si(t,e)},"distance");Ee((t,e)=>{let n=1/0,i=0;for(let o=0;o<e.length;o++){const r=Dt(t,e[o]);r<n&&(n=r,i=o)}return e[i]},"closest");var li=Object.defineProperty,ci=E((t,e)=>li(t,"name",{value:e,configurable:!0}),"p$4"),ui=Object.defineProperty,Bt=ci((t,e)=>ui(t,"name",{value:e,configurable:!0}),"e"),pi=Object.defineProperty,fi=Bt((t,e)=>pi(t,"name",{value:e,configurable:!0}),"E");const Rt=String.raw,nt=Rt`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,di=fi(()=>new RegExp(Rt`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${nt}(?:\u200D${nt})*`,"gu"),"default");var hi=Object.defineProperty,mi=Bt((t,e)=>hi(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 Pc=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,xc=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,ae=di(),gi=/[-_./\s]+/g,me=/(\u001B\[[0-9;]*[a-z])/i,it=new RegExp("\\p{Script=Arabic}","u"),vi=new RegExp("\\p{Script=Bengali}","u"),Q=new RegExp("\\p{Script=Cyrillic}","u"),bi=new RegExp("\\p{Script=Devanagari}","u"),yi=new RegExp("\\p{Script=Ethiopic}","u"),Ve=new RegExp("\\p{Script=Greek}","u"),rt=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),wi=new RegExp("\\p{Script=Gujarati}","u"),$i=new RegExp("\\p{Script=Gurmukhi}","u"),ot=new RegExp("\\p{Script=Hangul}","u"),at=new RegExp("\\p{Script=Hebrew}","u"),Oi=new RegExp("\\p{Script=Hiragana}","u"),st=new RegExp("\\p{Script=Han}","u"),Pi=new RegExp("\\p{Script=Kannada}","u"),xi=new RegExp("\\p{Script=Katakana}","u"),Ei=new RegExp("\\p{Script=Khmer}","u"),Ai=new RegExp("\\p{Script=Lao}","u"),I=new RegExp("\\p{Script=Latin}","u"),Ni=new RegExp("\\p{Script=Malayalam}","u"),ji=new RegExp("\\p{Script=Myanmar}","u"),Ci=new RegExp("\\p{Script=Oriya}","u"),ki=new RegExp("\\p{Script=Sinhala}","u"),_i=new RegExp("\\p{Script=Tamil}","u"),Li=new RegExp("\\p{Script=Telugu}","u"),Si=new RegExp("\\p{Script=Thai}","u"),Ti=new RegExp("\\p{Script=Tibetan}","u"),lt=/[\u02BB\u02BC\u0027]/u,Ii=mi(t=>t.replace(ae,""),"stripEmoji");var Mi=Object.defineProperty,zt=E((t,e)=>Mi(t,"name",{value:e,configurable:!0}),"i$6"),Vi=Object.defineProperty,Wt=zt((t,e)=>Vi(t,"name",{value:e,configurable:!0}),"r"),Ui=Object.defineProperty,Di=Wt((t,e)=>Ui(t,"name",{value:e,configurable:!0}),"c");let Ft=class{static{E(this,"l")}static{zt(this,"y")}static{Wt(this,"s")}static{Di(this,"LRUCache")}capacity;cache;keyOrder;constructor(e){this.capacity=e,this.cache=new Map,this.keyOrder=[]}get(e){if(this.cache.has(e))return this.keyOrder=this.keyOrder.filter(n=>n!==e),this.keyOrder.push(e),this.cache.get(e)}has(e){return this.cache.has(e)}set(e,n){if(this.cache.has(e))this.keyOrder=this.keyOrder.filter(i=>i!==e);else if(this.cache.size>=this.capacity){const i=this.keyOrder.shift();i!==void 0&&this.cache.delete(i)}this.cache.set(e,n),this.keyOrder.push(e)}delete(e){this.cache.delete(e),this.keyOrder=this.keyOrder.filter(n=>n!==e)}clear(){this.cache.clear(),this.keyOrder=[]}size(){return this.cache.size}};var Bi=Object.defineProperty,Ri=E((t,e)=>Bi(t,"name",{value:e,configurable:!0}),"r$5"),zi=Object.defineProperty,Wi=Ri((t,e)=>zi(t,"name",{value:e,configurable:!0}),"a"),Fi=Object.defineProperty,qi=Wi((t,e)=>Fi(t,"name",{value:e,configurable:!0}),"s");const Gi=qi((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleLowerCase(e.locale):t[0].toLowerCase())+t.slice(1),"lowerFirst");var Hi=Object.defineProperty,Ji=E((t,e)=>Hi(t,"name",{value:e,configurable:!0}),"I$2"),Ki=Object.defineProperty,Ae=Ji((t,e)=>Ki(t,"name",{value:e,configurable:!0}),"W");const Yi=He(import.meta.url),fe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Zi=Ae(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 Yi(t)},"__cjs_getBuiltinModule"),{stripVTControlCharacters:Xi}=Zi("node:util");var Qi=Object.defineProperty,er=Ae((t,e)=>Qi(t,"name",{value:e,configurable:!0}),"g");const Ue=new Ft(1e3),tr=/[.*+?^${}()|[\]\\]/g,nr=er(t=>{const e=t.join("");if(Ue.has(e))return Ue.get(e);const n=t.map(o=>o.replaceAll(tr,String.raw`\$&`)).join("|"),i=new RegExp(n,"g");return Ue.set(e,i),i},"getSeparatorsRegex");var ir=Object.defineProperty,rr=Ae((t,e)=>ir(t,"name",{value:e,configurable:!0}),"t");const or=rr(t=>{const e=[];let n=0,i;for(ae.lastIndex=0;(i=ae.exec(t))!==null;)i.index>n&&e.push(t.slice(n,i.index)),e.push(i[0]),n=ae.lastIndex;return n<t.length&&e.push(t.slice(n)),e.filter(Boolean)},"splitByEmoji");var ar=Object.defineProperty,C=Ae((t,e)=>ar(t,"name",{value:e,configurable:!0}),"u");const sr=/[ČŠŽĐ]/i,qt=new Uint8Array(128),Gt=new Uint8Array(128),Ht=new Uint8Array(128);for(let t=0;t<128;t++)qt[t]=t>=65&&t<=90?1:0,Gt[t]=t>=97&&t<=122?1:0,Ht[t]=t>=48&&t<=57?1:0;const De=C(t=>qt[t],"isUpper"),ct=C(t=>Gt[t],"isLower"),Be=C(t=>Ht[t],"isDigit"),F=C((t,e,n,i,o)=>{if(t.length===0)return[];let r=!1;const l=Object.values(e);for(const g of l)if(g(t[0])){r=!0;break}if(!r&&!n)return[t];const s=[...t],p=[];let a=s[0],c="other";const h=Object.entries(e);for(const g of h){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 h){const[A,d]=O;if(d(u)){v=A;break}}const w=n&&i?u===u.toLocaleUpperCase(i):!1;let y=!1;o?y=o(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"),lr=C((t,e,n,i)=>{if(n.size===0)return e;for(const o of n)if(t.startsWith(o,e))return i.push(o),e+o.length;return e},"detectAndProcessAcronym"),Jt=C((t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let n=0;const i=[],o=t.length;for(let r=1;r<o;r++){const l=lr(t,n,e,i);if(l!==n){n=l,r=n-1;continue}const s=t.codePointAt(r-1),p=t.codePointAt(r),a=s&&s<128&&De(s),c=p&&p<128&&De(p),h=s&&s<128&&ct(s),f=s&&s<128&&Be(s),g=p&&p<128&&Be(p);if(h&&c){i.push(t.slice(n,r)),n=r;continue}if(f&&!g||!f&&g){i.push(t.slice(n,r)),n=r;continue}if(g&&!f){let u=!1,v=!1;if(r+1<o){const w=t.codePointAt(r+1);u=w&&w<128&&De(w),v=w&&w<128&&Be(w)}if(!v&&u){i.push(t.slice(n,r),t.slice(r,r+1)),n=r+1;continue}}if(r+1<o){const u=t.codePointAt(r+1),v=u&&u<128&&ct(u);if(a&&c&&v){const w=t.slice(n,r+1);e.has(w)||(i.push(t.slice(n,r)),n=r)}}}return n<o&&i.push(t.slice(n)),i.filter(r=>r!=="")},"splitCamelCaseFast"),Kt=C((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,h=[];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&&(h.push(f),f=y),u=!0,v=w;else{if(u&&w-v>1){const A=a[w-1],d=f.slice(0,-1);d&&d.length>0&&h.push(d),f=A+y}else f+=y;u=!1,v=-1}g=O}return f&&f.length>0&&h.push(f),h}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!Q.test(t)&&!I.test(t))return[t];const a=[...t],c=a.length,h=[];let f=a[0];const g=a[0];let u;Q.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;Q.test(O)?A=1:I.test(O)?A=2:A=0;const d=O===O.toLocaleUpperCase(e);u!==A&&(u===1||u===2)&&(A===1||A===2)||A===u&&!v&&d?(h.push(f),f=O):f+=O,u=A,v=d}f&&f.length>0&&h.push(f);const w=[];for(let y=0;y<h.length;y++)y<h.length-1&&h[y].length===1&&I.test(h[y])&&Q.test(h[y+1][0])?(w.push(h[y]+h[y+1]),y+=1):w.push(h[y]);return w}if(e.startsWith("el")){if(!Ve.test(t)&&!I.test(t))return[t];const a=[];rt.lastIndex=0;let c;for(;(c=rt.exec(t))!==null;)a.push(c[0]);a.length===0&&a.push(t);const h=[];if(a.length===1){const f=a[0];if(!f||!Ve.test(f[0])||f.length===1)return[f??t]}for(const f of a){if(!f)continue;if(!Ve.test(f[0])||f.length===1){h.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?(h.push(u),u=y):u+=y,v=O}u&&h.push(u)}return h}if(e.startsWith("ja")||e.startsWith("ko")){const a=e.startsWith("ja"),c=a?{hiragana:C(f=>Oi.test(f),"hiragana"),kanji:C(f=>st.test(f),"kanji"),katakana:C(f=>xi.test(f),"katakana"),latin:C(f=>I.test(f),"latin")}:{hangul:C(f=>ot.test(f),"hangul"),latin:C(f=>I.test(f),"latin")},h=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(a){const f=F(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&&h.has(v)&&g.length>0?g[g.length-1]=g.at(-1)+v:g.push(v)}return g.length>0?g:[t]}return F(t,c,!1,e,(f,g)=>f==="hangul"&&g==="latin"||f==="latin"&&g==="hangul")}if(e.startsWith("sl")){const a=[...t],c=a.length,h=[];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=sr.test(v),O=u<c-1&&a[u+1]===a[u+1].toLocaleUpperCase(e);!g&&w||y&&O?(h.push(f),f=v,y&&O&&(h.push(f),f="")):f+=v,g=w}return f&&f.length>0&&h.push(f),h}if(e.startsWith("zh"))return F(t,{han:C(a=>st.test(a),"han"),latin:C(a=>I.test(a),"latin")},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const a=C(c=>at.test(c)||it.test(c),"isRtlChar");return F(t,{latin:C(c=>I.test(c),"latin"),rtl:C(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=C(c=>bi.test(c)||vi.test(c)||wi.test(c)||$i.test(c)||Pi.test(c)||_i.test(c)||Li.test(c)||Ni.test(c)||ki.test(c)||Si.test(c)||Ai.test(c)||Ti.test(c)||ji.test(c)||yi.test(c)||Ei.test(c)||Ci.test(c),"isIndicChar");return F(t,{indic:C(c=>a(c),"indic"),latin:C(c=>I.test(c),"latin")},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return F(t,{cyrillic:C(a=>Q.test(a),"cyrillic"),latin:C(a=>I.test(a),"latin")},!0,e);if(["ar","fa","he"].includes(e))return F(t,{latin:C(a=>I.test(a),"latin"),rtl:C(a=>at.test(a)||it.test(a),"rtl")},!1,e);if(e.startsWith("ko"))return F(t,{hangul:C(a=>ot.test(a),"hangul"),latin:C(a=>I.test(a),"latin")},!1,e);if(e.startsWith("uz")){if(!Q.test(t)&&!I.test(t))return[t];const a=[...t],c=a.length,h=[];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?(h.push(f),f=v):f+=v,g=w}return f&&f.length>0&&h.push(f),h}const o=[...t],r=o.length,l=[];let s=o[0],p=o[0]===o[0].toLocaleUpperCase(e);for(const a of n)if(t.startsWith(a)){l.push(a),s=o[a.length],p=s===s.toLocaleUpperCase(e);break}for(let a=1;a<r;a++){const c=o[a],h=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&&h?(l.push(s),s=c):s+=c,p=h}return s&&l.push(s),l},"splitCamelCaseLocale"),cr=C((t,e,n)=>{const i=[],o=me.test(t)?t.split(me).filter(Boolean):[t];for(const r of o){const l=r;if(me.test(l))i.push(l);else{const s=ae.test(l)?or(l).filter(Boolean):[l];for(const p of s)if(ae.test(p))i.push(p);else if(e){const a=e.toLowerCase().split("-")[0];i.push(...Kt(p,a,n))}else i.push(...Jt(p,n))}}return i},"processTextWithAnsiEmoji"),ur=C((t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:n=!1,handleEmoji:i=!1,knownAcronyms:o=[],locale:r,normalize:l=!1,separators:s,stripAnsi:p=!1,stripEmoji:a=!1}=e,c=new Set([...o].toSorted((y,O)=>O.length-y.length));let h=t;p&&(h=Xi(h)),a&&(h=Ii(h));let f;Array.isArray(s)?f=nr(s):s instanceof RegExp?f=s:f=gi;const g=[];let u=h;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],d=A.length,m=u.slice(0,O),b=u.slice(O+d);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=h.split(f).filter(Boolean);g.push(...y)}let w=[];for(const y of g)n||i?w.push(...cr(y,r,c)):r?w.push(...Kt(y,r,c)):w.push(...Jt(y,c));return l&&(w=w.map(y=>c.has(y)?y:r&&y===y.toLocaleUpperCase(r)?y[0]+y.slice(1).toLocaleLowerCase(r):y.toUpperCase()===y&&!c.has(y)?y.slice(0,1)+y.slice(1).toLowerCase():y)),w},"splitByCase");var pr=Object.defineProperty,fr=E((t,e)=>pr(t,"name",{value:e,configurable:!0}),"r$4"),dr=Object.defineProperty,hr=fr((t,e)=>dr(t,"name",{value:e,configurable:!0}),"o"),mr=Object.defineProperty,gr=hr((t,e)=>mr(t,"name",{value:e,configurable:!0}),"s");const vr=gr((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleUpperCase(e.locale):t[0].toUpperCase())+t.slice(1),"upperFirst");var br=Object.defineProperty,yr=E((t,e)=>br(t,"name",{value:e,configurable:!0}),"r$3"),wr=Object.defineProperty,$r=yr((t,e)=>wr(t,"name",{value:e,configurable:!0}),"r"),Or=Object.defineProperty,Pr=$r((t,e)=>Or(t,"name",{value:e,configurable:!0}),"n");const xr=Pr((t,e)=>`${t}::${e?.joiner??""}::${e?.locale??""}::${e?.knownAcronyms?.join(",")??""}::${e?.normalize?"true":"false"}`,"generateCacheKey");var Er=Object.defineProperty,Ar=E((t,e)=>Er(t,"name",{value:e,configurable:!0}),"i$4"),Nr=Object.defineProperty,jr=Ar((t,e)=>Nr(t,"name",{value:e,configurable:!0}),"f"),Cr=Object.defineProperty,kr=jr((t,e)=>Cr(t,"name",{value:e,configurable:!0}),"l");const _r=kr((t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const i=[];let o="",r="";for(let l=0;l<n;l++){const s=t[l];if(me.test(s)){o?(i.push(o+r+s),o="",r=""):(i.length>0&&i.push(e),o=s);continue}o?(r&&(r+=e),r+=s):(i.length>0&&i.push(e),i.push(s))}return i.join("")},"joinSegments");var Lr=Object.defineProperty,Sr=E((t,e)=>Lr(t,"name",{value:e,configurable:!0}),"r$2"),Tr=Object.defineProperty,Ir=Sr((t,e)=>Tr(t,"name",{value:e,configurable:!0}),"a"),Mr=Object.defineProperty,Vr=Ir((t,e)=>Mr(t,"name",{value:e,configurable:!0}),"e");const Ur=/(?<![a-zß])SS(?![a-z])/g,Dr=Vr(t=>t.replaceAll(Ur,"ß"),"normalizeGermanEszett");var Br=Object.defineProperty,Rr=E((t,e)=>Br(t,"name",{value:e,configurable:!0}),"c$1"),zr=Object.defineProperty,Wr=Rr((t,e)=>zr(t,"name",{value:e,configurable:!0}),"c"),Fr=Object.defineProperty,qr=Wr((t,e)=>Fr(t,"name",{value:e,configurable:!0}),"o");const Gr=new Ft(1e3),Yt=qr((t,e)=>{if(typeof t!="string"||!t)return"";const n=e?.cache??!1,i=e?.cacheStore??Gr;let o;if(n&&(o=xr(t,e)),n&&o&&i.has(o))return i.get(o);let r=!0;const l=_r(ur(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&&me.test(s))return s;const p=e?.locale?.startsWith("de")?Dr(s):s,a=e?.locale?p.toLocaleLowerCase(e.locale):p.toLowerCase();return r?(r=!1,Gi(a,e)):vr(a,e)}),"");return n&&o&&i.set(o,l),l},"camelCase");var Hr=Object.defineProperty,T=E((t,e)=>Hr(t,"name",{value:e,configurable:!0}),"_$2"),Jr=Object.defineProperty,x=T((t,e)=>Jr(t,"name",{value:e,configurable:!0}),"h");const be=[{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 Kr=Object.defineProperty,Yr=x((t,e)=>Kr(t,"name",{value:e,configurable:!0}),"t$5");let ee=class extends j{static{E(this,"S")}static{T(this,"T")}static{x(this,"a")}static{Yr(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 Zr=Object.defineProperty,Xr=x((t,e)=>Zr(t,"name",{value:e,configurable:!0}),"e$7");let Zt=class extends j{static{E(this,"De")}static{T(this,"Te")}static{x(this,"o")}static{Xr(this,"ConflictingOptionsError")}option1;option2;constructor(e,n){super(`Options "${e}" and "${n}" cannot be used together`,"CONFLICTING_OPTIONS",{option1:e,option2:n}),this.name="ConflictingOptionsError",this.option1=e,this.option2=n,this.hint=`Remove either --${e} or --${n}`}};var Qr=Object.defineProperty,eo=x((t,e)=>Qr(t,"name",{value:e,configurable:!0}),"e$6");let to=class extends j{static{E(this,"At")}static{T(this,"Ot")}static{x(this,"o")}static{eo(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 no=Object.defineProperty,ut=x((t,e)=>no(t,"name",{value:e,configurable:!0}),"d$4");let io=class{static{E(this,"$t")}static{T(this,"At")}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`);G().CEREBRO_OUTPUT_LEVEL===String(ie)&&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 o=new to(n.name,`Failed to initialize: ${i instanceof Error?i.message:String(i)}`,i instanceof Error?i:void 0);throw this.logger.error(o.message),o}}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 o of i){const r=o[t];if(typeof r=="function"){this.logger.debug(`executing ${t} hook for plugin: ${o.name}`);try{await(t==="afterCommand"?r(e,n):r(e))}catch(l){throw this.logger.error(`Error in ${t} hook for plugin "${o.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(o){this.logger.error(`Error in error handler for plugin "${i.name}":`,o)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const t=[],e=new Set,n=new Set,i=ut(o=>{if(e.has(o))return;if(n.has(o))throw new Error(`Circular dependency detected involving plugin "${o}"`);const r=this.plugins.get(o);if(!r)throw new Error(`Plugin "${o}" not found`);if(n.add(o),r.dependencies)for(const l of r.dependencies)i(l);n.delete(o),e.add(o),t.push(r)},"visit");for(const o of this.plugins.keys())i(o);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 ro=Object.defineProperty,oo=x((t,e)=>ro(t,"name",{value:e,configurable:!0}),"n$8");const ge=oo(t=>t.type?.name==="Boolean","optionIsBoolean");var ao=Object.defineProperty,Xt=x((t,e)=>ao(t,"name",{value:e,configurable:!0}),"p$6");const so=Xt(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=Xt(t=>(ge(t)||(t.typeLabel=t.typeLabel??so(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),"mapOptionTypeLabel");var lo=Object.defineProperty,Qt=x((t,e)=>lo(t,"name",{value:e,configurable:!0}),"e$4");const co=new RegExp(/^-([^\d-])$/),uo=new RegExp(/^--(\S+)/),po=new RegExp(/^-([^\d-]{2,})$/),fo=Qt(t=>co.test(t)||uo.test(t)||po.test(t),"isOption"),ho=Qt((t,e)=>{const n=e[0]&&fo(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 mo=Object.defineProperty,en=x((t,e)=>mo(t,"name",{value:e,configurable:!0}),"i$7"),go=Object.defineProperty,tn=en((t,e)=>go(t,"name",{value:e,configurable:!0}),"i"),vo=Object.defineProperty,nn=tn((t,e)=>vo(t,"name",{value:e,configurable:!0}),"s"),bo=Object.defineProperty,rn=nn((t,e)=>bo(t,"name",{value:e,configurable:!0}),"i"),yo=Object.defineProperty,on=rn((t,e)=>yo(t,"name",{value:e,configurable:!0}),"t");on(t=>t instanceof Error&&t.type==="VisulimaError","isVisulimaError");class Ne extends Error{static{E(this,"te")}static{T(this,"ee")}static{x(this,"v")}static{en(this,"g")}static{tn(this,"p")}static{nn(this,"V")}static{rn(this,"VisulimaError")}static{on(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:e,hint:n,location:i,message:o,name:r,stack:l,title:s}){super(o,{cause:e}),this.title=s,this.name=r,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 wo=Object.defineProperty,an=x((t,e)=>wo(t,"name",{value:e,configurable:!0}),"o$7"),$o=Object.defineProperty,sn=an((t,e)=>$o(t,"name",{value:e,configurable:!0}),"o"),Oo=Object.defineProperty,Po=sn((t,e)=>Oo(t,"name",{value:e,configurable:!0}),"i");let xo=class ln extends Ne{static{E(this,"He")}static{T(this,"He")}static{x(this,"a")}static{an(this,"a")}static{sn(this,"t")}static{Po(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,ln.prototype)}};var Eo=Object.defineProperty,cn=x((t,e)=>Eo(t,"name",{value:e,configurable:!0}),"t$3"),Ao=Object.defineProperty,un=cn((t,e)=>Ao(t,"name",{value:e,configurable:!0}),"e"),No=Object.defineProperty,jo=un((t,e)=>No(t,"name",{value:e,configurable:!0}),"e");let ft=class pn extends Ne{static{E(this,"Je")}static{T(this,"Je")}static{x(this,"n")}static{cn(this,"n")}static{un(this,"o")}static{jo(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,pn.prototype)}};var Co=Object.defineProperty,fn=x((t,e)=>Co(t,"name",{value:e,configurable:!0}),"a$9"),ko=Object.defineProperty,dn=fn((t,e)=>ko(t,"name",{value:e,configurable:!0}),"a"),_o=Object.defineProperty,Lo=dn((t,e)=>_o(t,"name",{value:e,configurable:!0}),"o");let So=class hn extends Ne{static{E(this,"Xe")}static{T(this,"Xe")}static{x(this,"n")}static{fn(this,"o")}static{dn(this,"e")}static{Lo(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,hn.prototype)}};var To=Object.defineProperty,mn=x((t,e)=>To(t,"name",{value:e,configurable:!0}),"i$4"),Io=Object.defineProperty,gn=mn((t,e)=>Io(t,"name",{value:e,configurable:!0}),"i"),Mo=Object.defineProperty,Vo=gn((t,e)=>Mo(t,"name",{value:e,configurable:!0}),"i");let M=class vn extends Ne{static{E(this,"nt")}static{T(this,"nt")}static{x(this,"a")}static{mn(this,"o")}static{gn(this,"e")}static{Vo(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,vn.prototype)}};var Uo=Object.defineProperty,Do=x((t,e)=>Uo(t,"name",{value:e,configurable:!0}),"z"),Bo=Object.defineProperty,le=Do((t,e)=>Bo(t,"name",{value:e,configurable:!0}),"S"),Ro=Object.defineProperty,je=le((t,e)=>Ro(t,"name",{value:e,configurable:!0}),"o");const dt=je(t=>t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean"),"isBooleanType"),ht=je(t=>t===Number||typeof t=="function"&&t.name==="Number","isNumberType"),mt=je(t=>t===String||typeof t=="function"&&t.name==="String","isStringType"),zo=je((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 Wo=Object.defineProperty,Fo=le((t,e)=>Wo(t,"name",{value:e,configurable:!0}),"e");const L=Fo((t,e,n,...i)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...i)},"debug");var qo=Object.defineProperty,Z=le((t,e)=>qo(t,"name",{value:e,configurable:!0}),"h$1");const Go=/-([a-z])/g,Ho=/^\d+$/,Re=Z(t=>t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean"),"isBooleanType"),Jo=Z(t=>t.codePointAt(0)===95,"isSpecialKey"),gt=Z((t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],"appendToArrayMultiple"),vt=Z(t=>t==="__proto__"||t==="constructor"||t==="prototype","isUnsafeKey"),bt=Z((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"),Ko=Z((t,e,n,i,o)=>{let r=e.get(t)??n.get(t);if(!r&&i){const l=t.toLowerCase();r=i.get(l)??o?.get(l)}return r},"getDefinition"),Yo=Z((t,e,n,i)=>{const o=n.debug??!1;L(o,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),L(o,"Starting argument resolution","resolver"),L(o,"Tokens:","resolver",t),L(o,"Definitions:","resolver",e),L(o,"Processing tokens...","resolver");const r=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 d of e)if(r.set(d.name,d),d.alias&&l.set(d.alias,d),n.caseInsensitive&&s&&(s.set(d.name.toLowerCase(),d),d.alias&&p&&p.set(d.alias.toLowerCase(),d)),n.camelCase&&a&&c){const m=d.name.replaceAll(Go,(b,$)=>$.toUpperCase());a.set(d.name,m),c.set(m,d.name)}const h={},f={},g=[],u=new Set;let v=!1;const w=e.find(d=>d.defaultOption),y=e.some(d=>d.group),O=e.some(d=>d.type===Number);for(let d=0;d<t.length;d++){const m=t[d];if(m.kind==="option-terminator"){h._unknown=i.slice(m.index),v=!0;break}if(m.kind==="option"&&m.name){let b=Ko(m.name,r,l,s,p);if(!b&&m.value===void 0&&O&&Ho.test(m.name)){const N=e.find(B=>B.type===Number);N&&(b=N,m.value=m.name,m.name=N.name)}const $=b?b.name:m.name,P=b?.multiple,k=b?.lazyMultiple;if(f[$]!==void 0&&!P&&!k&&!n.partial)throw new xo($);if(!b&&n.partial){const N=m.rawName??`--${m.name}${m.value!==void 0&&m.inlineValue?`=${m.value}`:""}`;g.push({index:m.index,value:N});continue}if(!b&&n.stopAtFirstUnknown){h._unknown=i.slice(m.index);break}if(!b&&!n.partial)throw new ft(m.name);if(m.value===void 0){const N=t[d+1],B=N?.kind==="option"&&!("name"in N)&&N.value!==void 0,V=N&&b&&!(b.type&&Re(b.type))&&(N.kind==="positional"||B),Mn=b&&b.defaultOption&&!b.multiple&&!b.lazyMultiple;if(V&&(!b?.defaultOption||Mn))if(P){let R=d+1;const Me=[];for(;R<t.length&&(t[R].kind==="positional"||t[R].kind==="option"&&!("name"in t[R])&&t[R].value!==void 0);)Me.push(t[R].value),u.add(t[R].index),R++;f[$]=f[$]===void 0?Me:gt(f[$],Me),d=R-1}else k?(bt(f,$,N.value,!0),u.add(N.index),d++):(f[$]=N.value,u.add(N.index),d++);else b?.type&&Re(b.type)?bt(f,$,!0,P):f[$]=P?[]:null}else{let{value:N}=m;if(b?.type&&Re(b.type))switch(N){case"":{if(n.partial)f._unknown??=[],f._unknown.push(`${m.rawName??`--${m.name}`}${m.value?`=${m.value}`:""}`),N=!0;else throw new ft(m.name);break}case"false":{N=!1;break}case"true":{N=!0;break}default:N=!0}const B=[N];if(P){let V=d+1;for(;V<t.length&&t[V].kind==="positional";)B.push(t[V].value),u.add(t[V].index),V++;d=V-1}f[$]===void 0?f[$]=P||k?B:N:P||k?f[$]=gt(f[$],B):f[$]=N}}else if(m.kind==="positional"&&n.stopAtFirstUnknown&&!u.has(m.index)&&!w){L(o,`Found unconsumed positional token at index ${String(m.index)}, stopping processing`,"resolver"),h._unknown=i.slice(m.index);break}}for(const[d,m]of Object.entries(f)){const b=r.get(d);b&&(b.multiple||b.lazyMultiple)&&!Array.isArray(m)&&(f[d]=[m])}let A=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!v){for(const d of t)if(d.kind==="option"&&!r.has(d.name??"")&&!l.has(d.name??"")&&(!n.caseInsensitive||!s?.has(d.name?.toLowerCase()??"")&&!p?.has(d.name?.toLowerCase()??""))){A=d.index;break}}if(w){const d=[],m=[];for(const b of t)b.kind==="positional"&&!u.has(b.index)&&b.index<A&&(d.push(b.value),m.push(b));if(d.length>0){const b=f[w.name],$=w.multiple??w.lazyMultiple;b===void 0?$?(m.forEach(P=>u.add(P.index)),f[w.name]=d):(u.add(m[0].index),f[w.name]=d[0]):$&&(m.forEach(P=>u.add(P.index)),f[w.name]=Array.isArray(b)?[...d,...b]:[...d,b])}}if(!n.partial){for(const d of t)if(d.kind==="positional"&&!u.has(d.index))throw new So(i[d.index])}if(n.partial&&!n.stopAtFirstUnknown){const d=[...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&&d.push({index:$,value:b})}}for(const m of t)m.kind==="positional"&&!u.has(m.index)&&d.push({index:m.index,value:i[m.index]});d.length>0&&(d.sort((m,b)=>m.index-b.index),h._unknown=d.map(m=>m.value))}if(n.stopAtFirstUnknown&&!v){const d=t.findIndex($=>$.kind==="option"&&!r.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(d!==-1&&m!==-1?b=Math.min(d,m):d!==-1?b=d:m!==-1&&(b=m),b>=0){const $=t[b].index;h._unknown=i.slice($)}}else g.length>0&&!n.partial&&(h._unknown=g.map(d=>d.value));for(const[d,m]of Object.entries(f)){const b=n.camelCase?a?.get(d)??d:d,$=r.get(d);h[b]=$?.type?zo(m,$.type):m===void 0?null:m}for(const d of e){const m=n.camelCase?a?.get(d.name)??d.name:d.name;!(m in h)&&d.defaultValue!==void 0&&(d.multiple??d.lazyMultiple?h[m]=Array.isArray(d.defaultValue)?[...d.defaultValue]:[d.defaultValue]:h[m]=d.defaultValue)}if(y){const d={},m={},b={};for(const P of e)if(P.group){const k=Array.isArray(P.group)?P.group:[P.group];for(const N of k)vt(N)||(d[N]??={})}for(const P of Object.keys(h))if(!Jo(P)){m[P]=h[P];let k=P;n.camelCase&&(k=c?.get(P)??P);const N=r.get(k);if(N?.group){const B=Array.isArray(N.group)?N.group:[N.group];for(const V of B)vt(V)||d[V]&&(d[V][P]=h[P])}else b[P]=h[P]}const $={_all:m};for(const[P,k]of Object.entries(d))$[P]=k;Object.keys(b).length>0&&($._none=b),h._unknown&&($._unknown=h._unknown),Object.keys(h).forEach(P=>delete h[P]),Object.assign(h,$)}return L(o,"Final parsed result:","resolver",h),h},"resolveArgs");var Zo=Object.defineProperty,X=le((t,e)=>Zo(t,"name",{value:e,configurable:!0}),"l");const J="-".codePointAt(0),H="=",Xo=H.codePointAt(0),Qo="--",ea="-",ta="--",bn=X(t=>t.length>2&&t.startsWith(ta),"hasLongOptionPrefix"),na=X(t=>bn(t)&&!t.includes(H,3),"isLongOption"),ia=X(t=>bn(t)&&t.includes(H,3),"isLongOptionAndValue"),ra=X(t=>t!==void 0&&t.length>0&&t.codePointAt(0)!==J,"hasOptionValue"),oa=X(t=>{if(t.length!==2||t.codePointAt(0)!==J||t.codePointAt(1)===J)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},"isShortOption"),aa=X(t=>!(t.length<=2||t.codePointAt(0)!==J||t.codePointAt(1)===J),"isShortOptionGroup"),sa=X(t=>{const e=[],n=[...t];let i=-1,o=0;for(;n.length>0;){const r=n.shift();if(r===void 0)break;const l=n[0];if(o>0?o--:i++,r===Qo){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(oa(r)){const s=r.charAt(1);let p;o?(e.push({index:i,kind:"option",name:s,rawName:r,value:p}),o===1&&ra(l)&&(p=n.shift(),e.push({index:i,kind:"option",value:p}))):e.push({index:i,kind:"option",name:s,rawName:r,value:p}),p!==void 0&&++i;continue}if(aa(r)&&!r.includes(H)){const s=[];let p="",a=!1;for(let c=1;c<r.length;c++){const h=r.charAt(c);a?p+=h:h.codePointAt(0)===Xo?a=!0:s.push(`${ea}${h}`)}if(a)if(s.length>0){const c=s.pop();s.push(`${c}=${p}`)}else s.push(p);n.unshift(...s),o=s.length;continue}if(na(r)){const s=r.slice(2);e.push({index:i,kind:"option",name:s,rawName:r});continue}if(ia(r)){const s=r.indexOf(H),p=r.slice(2,s),a=r.slice(s+1);e.push({index:i,inlineValue:!0,kind:"option",name:p,rawName:r,value:a});continue}if(r.length>2&&r.codePointAt(0)===J&&r.codePointAt(1)!==J&&r.includes(H)){const s=r.indexOf(H),p=r.charAt(1),a=r.slice(s+1);e.push({index:i,inlineValue:!0,kind:"option",name:p,rawName:r,value:a});continue}e.push({index:i,kind:"positional",value:r})}return e},"parseArgsTokens");var la=Object.defineProperty,Je=le((t,e)=>la(t,"name",{value:e,configurable:!0}),"d");const ca=/\d/,ua=Je(t=>t!=null&&(t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean")),"isBooleanType"),pa=Je(t=>typeof t=="function","isValidCustomTypeFunction"),fa=Je((t,e,n)=>{const i=n?.debug??!1;L(i,"Validating definitions:","validation",t,"caseInsensitive:",e);const o=new Set,r=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(o.has(a.name)||e&&l.has(c))throw new M(`Invalid option definition: duplicate name '${a.name}'`);if(r.has(a.name)||e&&s.has(c))throw new M(`Invalid option definition: name '${a.name}' conflicts with an existing alias`);if(o.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(ca.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 h=e?a.alias.toLowerCase():"";if(r.has(a.alias)||e&&s.has(h))throw new M(`Invalid option definition: duplicate alias '${a.alias}'`);if(o.has(a.alias)||e&&l.has(h))throw new M(`Invalid option definition: alias '${a.alias}' conflicts with an existing option name`);r.add(a.alias),e&&s.add(h)}if(a.defaultOption&&(p++,a.type!==void 0&&ua(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"&&pa(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 da=Object.defineProperty,ha=le((t,e)=>da(t,"name",{value:e,configurable:!0}),"O");const ma=ha((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 o=Array.isArray(t)?t:[t];L(n,"Normalized definitions:","index",o),fa(o,i.caseInsensitive,n?i:void 0);let{argv:r}=i;if(!r&&(r=process.argv.slice(2),process.execArgv.length>0)){const a=new Set(process.execArgv);r=r.filter(c=>!a.has(c))}L(n,"Using argv:","index",r);let l=r;i.caseInsensitive&&(l=r.map(a=>{if(a.startsWith("--")){const c=a.indexOf("="),h=(c===-1?a.slice(2):a.slice(2,c)).toLowerCase();return c===-1?`--${h}`:`--${h}${a.slice(c)}`}if(a.startsWith("-")&&!a.startsWith("--")&&a.length>1){const c=a.slice(1).split("=",2),h=c[0],f=c[1];if(!h)return a;const g=h.toLowerCase();return f===void 0?`-${g}`:`-${g}=${f}`}return a}));const s=sa(l.map(String));L(n,"Tokenized arguments:","index",s);const p=Yo(s,o,i,r);return L(n,"Command-line-args parsing completed","index"),p},"commandLineArgs");var ga=Object.defineProperty,va=x((t,e)=>ga(t,"name",{value:e,configurable:!0}),"n$4");let ba=class{static{E(this,"Bn")}static{T(this,"Un")}static{x(this,"a")}static{va(this,"EmptyToolbox")}result;argv;options;argument;command;commandName;env;logger;runtime;rawUnknown;constructor(t,e){this.commandName=t,this.command=e}};var ya=Object.defineProperty,wa=x((t,e)=>ya(t,"name",{value:e,configurable:!0}),"n$3");let ze=class extends j{static{E(this,"ue")}static{T(this,"ce")}static{x(this,"i")}static{wa(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 $a=Object.defineProperty,Oa=x((t,e)=>$a(t,"name",{value:e,configurable:!0}),"f$3");const Pa=/^-{1,2}(\w+)(=(.+))?$/,yn=Oa((t,e,n,i)=>{const o=Pa.exec(t);if(o===null)return{};const r=o[1];if(!r)return{};const l=n&&i?n.get(r)??i.get(r):e.find(s=>s.name===r||s.alias===r);return l!==void 0?{argName:l.name,argValue:o[3],option:l}:{}},"getParameterOption");var xa=Object.defineProperty,Ge=x((t,e)=>xa(t,"name",{value:e,configurable:!0}),"e$3");const yt=Ge((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"),Ea=new Set(["0","1","false","true"]),Aa=Ge((t,e,n,i)=>{if(e.length===0||t.length===0)return{};const o=Ge((r,l)=>{const{argName:s,argValue:p,option:a}=yn(l,e,n,i),{lastOption:c}=r;return a&&ge(a)&&p&&s?r.partial[s]=yt(p,a):r.lastName&&c&&ge(c)&&Ea.has(l)&&(r.partial[r.lastName]=yt(l,c)),{lastName:s,lastOption:a,partial:r.partial}},"getBooleanValue");return t.reduce(o,{partial:{}}).partial},"getBooleanValues");var Na=Object.defineProperty,wt=x((t,e)=>Na(t,"name",{value:e,configurable:!0}),"s$6");const ja=new Set(["0","1","false","true"]),Ca=wt((t,e,n,i)=>{if(e.length===0||t.length===0)return t;const o=wt((r,l)=>{const{argValue:s,option:p}=yn(l,e,n,i),{lastOption:a}=r;if(a&&ge(a)&&ja.has(l)){const{args:c}=r;return{args:c.slice(0,-1)}}return p&&ge(p)&&s?{args:r.args}:{args:[...r.args,l],lastOption:p}},"removeBooleanArguments");return t.reduce(o,{args:[]}).args},"removeBooleanValues");var ka=Object.defineProperty,_a=x((t,e)=>ka(t,"name",{value:e,configurable:!0}),"o$4");const La=_a(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 Sa=Object.defineProperty,Ce=x((t,e)=>Sa(t,"name",{value:e,configurable:!0}),"o$3");const Ta=Ce(t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},"transformBooleanEnv"),Ia=Ce((t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return Ta(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"),Ma=/_./g,Va=/^[A-Z]/,Ua=Ce(t=>t.toLowerCase().replaceAll(Ma,e=>e[1]?.toUpperCase()??e).replace(Va,e=>e.toLowerCase()),"toCamelCase"),Da=Ce(t=>{if(!t||t.length===0)return{};const e={},n=G();for(const i of t){const o=n[i.name],r=Ia(i,o),l=r===void 0?i.defaultValue:r,s=Ua(i.name);e[s]=l}return e},"processEnvVariables");var Ba=Object.defineProperty,ve=x((t,e)=>Ba(t,"name",{value:e,configurable:!0}),"a$4");const Ra=ve(t=>{const e=new Map,n=new Map;for(const i of t)if(e.set(i.name,i),i.alias){const o=Array.isArray(i.alias)?i.alias:[i.alias];for(const r of o)n.set(r,i)}return{optionMapByAlias:n,optionMapByName:e}},"buildOptionMaps"),za=ve(async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new ze(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(i){throw new ze(t.name,i instanceof Error?i.message:String(i),i)}const n=e.default;if(typeof n!="function")throw new ze(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},"loadLazyHandler"),Wa=ve((t,e,n,i)=>{const o=new ba(t.name,t),{_all:r,_unknown:l,positionals:s}=e,p=Object.keys(n).length>0?{...r,...n}:r;$e in p&&delete p[$e],o.argument=s?.[$e]??[],o.rawUnknown=[...l??[]];const a=Object.keys(i).length>0;return o.options=a?{...p,...i}:p,o.env=Da(t.env),o},"prepareToolbox"),Fa=ve((t,e,n)=>{const i=t.options??[],o=i.length>0;let r=La(o?[...i,...n]:n);if(r.length>0){for(const a of r)if(a.multiple&&a.lazyMultiple)throw new Error(`Argument "${a.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(r=[{defaultOption:!0,description:t.argument.description,group:"positionals",multiple:!0,name:$e,type:t.argument.type,typeLabel:t.argument.typeLabel},...r]);let l,s;if(o){const{optionMapByAlias:a,optionMapByName:c}=Ra(i);l=Ca(e,i,c,a),s=Aa(e,i,c,a)}else l=e,s={};const p=ma(r,{argv:l,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:r,booleanValues:s,parsedArgs:p}},"processCommandArgs"),te=ve(async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await za(t))(e),"executeCommand");var qa=Object.defineProperty,Ga=x((t,e)=>qa(t,"name",{value:e,configurable:!0}),"n$2");let Ha=class extends j{static{E(this,"fi")}static{T(this,"pi")}static{x(this,"s")}static{Ga(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 Ja=Object.defineProperty,Ka=x((t,e)=>Ja(t,"name",{value:e,configurable:!0}),"t$1");const $t=Ka((t,e,n=!1)=>{const i=[];for(const o of t)if(!(!n&&!o.required)&&e[o.name]===void 0){if(o.type?.name==="Boolean"){e[o.name]=!1;continue}i.push(o)}return i},"listMissingArguments");var Ya=Object.defineProperty,wn=x((t,e)=>Ya(t,"name",{value:e,configurable:!0}),"n$1");const Za=wn((t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:Dt(t,e)<=t.length/3,"isSimilar"),re=wn((t,e)=>{const n=t.toLowerCase();return e.filter(i=>Za(i.toLowerCase(),n))},"findAlternatives");var Xa=Object.defineProperty,ke=x((t,e)=>Xa(t,"name",{value:e,configurable:!0}),"a$3");const Qa=ke((t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(i=>{const o=i.startsWith("--");let r=`Found unknown ${o?"option":"argument"} "${i}"`;if(o){const l=re(i.replace("--",""),(e.options??[]).map(s=>s.name));if(l.length>0){const[s,...p]=l.map(a=>`--${a}`);r+=p.length>0?`, did you mean ${s??""} or ${p.join(", ")}?`:`, did you mean ${s??""}?`}}n.push(r)}),n.length>0)throw new Error(n.join(`
4
- `))},"validateUnknownOptions"),es=ke((t,e,n)=>{const i=n.__requiredOptions__,o=i?$t(i,e,!0):$t(t,e,!1);if(o.length>0)throw new Ha(n.name,o.map(r=>r.name));e._unknown&&e._unknown.length>0&&!n.argument&&Qa(e,n)},"validateRequiredOptions"),ts=ke((t,e,n)=>{const i=n.__conflictingOptions__??t.filter(o=>o.conflicts!==void 0);if(i.length>0){const o=i.find(r=>Array.isArray(r.conflicts)?r.conflicts.some(l=>e[l]!==void 0)&&e[r.name]!==void 0:e[r.conflicts]!==void 0&&e[r.name]!==void 0);if(o)throw new Zt(o.name,typeof o.conflicts=="string"?o.conflicts:o.conflicts?.[0]??"unknown")}},"validateConflictingOptions"),ns=ke(t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const o of t.options){if(o.name){const r=e.get(o.name)??[];r.push(o),e.set(o.name,r)}if(typeof o.alias=="string"&&o.alias.length>0){const r=n.get(o.alias)??[];r.push(o),n.set(o.alias,r)}else if(Array.isArray(o.alias)){for(const r of o.alias)if(r.length>0){const l=n.get(r)??[];l.push(o),n.set(r,l)}}}const i=[];for(const[o,r]of e)r.length>1&&i.push(`Duplicate option name "${o}" in command "${t.name}": ${JSON.stringify(r)}`);for(const[o,r]of n)r.length>1&&i.push(`Duplicate option alias "-${o}" used by options ${r.map(l=>`"${l.name}"`).join(", ")} in command "${t.name}"`);if(i.length>0)throw new Error(i.join(`
5
- `))},"validateDuplicateOptions");var is=Object.defineProperty,Ke=x((t,e)=>is(t,"name",{value:e,configurable:!0}),"s$2");const rs=Ke((t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];let i;for(let o=1;o<=e.length;o+=1){const r=e[o-1];if(r===void 0||r.startsWith("-"))break;n.push(r);const l=n.join(" ");t.has(l)&&(i={commandPath:[...n],depth:o})}return i?{argv:e.slice(i.depth),commandPath:i.commandPath}:{argv:e,commandPath:void 0}},"parseNestedCommand"),ne=Ke(t=>t.join(" "),"getCommandPathKey"),Ot=Ke((t,e)=>e&&e.length>0?[...e,t]:[t],"getFullCommandPath");var os=Object.defineProperty,_e=x((t,e)=>os(t,"name",{value:e,configurable:!0}),"a$2");const as=_e(t=>{t.options?.forEach(e=>{e.__camelCaseName__=Yt(e.name)})},"processOptionNames"),ss=_e(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 o=i.name.replace("no-","");if(!e.has(o)){if(i.type!==Boolean)throw new Error(`Cannot add negated option "${i.name}" to command "${t.name}" because it is not a boolean.`);const r={...i,defaultValue:i.defaultValue===void 0?!0:!i.defaultValue,name:o};n.push(r),e.add(o)}}n.length>0&&t.options.push(...n)},"addNegatableOptions"),ls=_e((t,e)=>{if(!e.options||e.options.length===0)return;const{options:n}=t,i=new Map;for(const r of e.options)if(r.name.startsWith("no-")){const l=Yt(r.name);i.set(l,r)}const o=Object.keys(n).filter(r=>i.has(r));if(o.length!==0)for(const r of o){const l=r.charAt(2);if(!l)continue;const s=l.toLowerCase()+r.slice(3),p=i.get(r);p&&(p.__negated__=!0),n[s]=!n[r],Reflect.deleteProperty(n,r)}},"mapNegatableOptions"),cs=_e((t,e)=>{if(!e.options||e.options.length===0)return;const n=new Map;for(const o of e.options)o.__camelCaseName__&&o.__negated__===void 0&&o.implies!==void 0&&n.set(o.__camelCaseName__,o);if(n.size===0)return;const{options:i}=t;for(const o of Object.keys(i)){const r=n.get(o);if(r?.implies){const{implies:l}=r;for(const[s,p]of Object.entries(l))i[s]===void 0&&(i[s]=p)}}},"mapImpliedOptions");var us=Object.defineProperty,Le=x((t,e)=>us(t,"name",{value:e,configurable:!0}),"e$2");const ps=Le(()=>!!process.versions.electron,"isElectronApp"),fs=Le(()=>ps()&&!process.defaultApp,"isBundledElectronApp"),ds=Le(()=>fs()?0:1,"getProcessArgvBinIndex"),hs=Le(t=>t.slice(ds()+1),"hideBin");var ms=Object.defineProperty,$n=x((t,e)=>ms(t,"name",{value:e,configurable:!0}),"e$1");const gs=" ",vs=$n((t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,i)=>n===e[i]),"equals"),bs=$n(t=>{if(typeof t=="string")return t.split(gs);const e=Pe();return vs(t,e)?hs(t):t},"parseRawCommand");var ys=Object.defineProperty,We=x((t,e)=>ys(t,"name",{value:e,configurable:!0}),"r");const ws=We(t=>{const e=We(r=>{t.error(`Uncaught exception: ${r.message||r}`),r.stack&&t.error(r.stack),q(1)},"uncaughtExceptionHandler"),n=We((r,l)=>{if(r instanceof Error)t.error(`Promise rejection: ${r.message||r}`),r.stack&&t.error(r.stack);else{let s;if(typeof r=="string")s=r;else try{s=JSON.stringify(r)}catch{s=String(r)}t.error(`Promise rejection: ${s}`)}q(1)},"unhandledRejectionHandler"),i=tt("uncaughtException",e),o=tt("unhandledRejection",n);return()=>{i(),o()}},"registerExceptionHandler");var $s=Object.defineProperty,ce=x((t,e)=>$s(t,"name",{value:e,configurable:!0}),"e");const xe=100,On=/^[a-z][\w-]*$/i,Ye=ce((t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new j(`${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 j(`${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 j(`${e} must be a function`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateFunction");const Fe=ce((t,e)=>{if(typeof t!="object"||t===null)throw new j(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateObject"),ye=ce(t=>{const e=Ye(t,"Command name");if(e.length>xe)throw new j(`Command name is too long (maximum ${String(xe)} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new j(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!On.test(e))throw new j(`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=Ye(t,"Plugin name");if(e.length>xe)throw new j(`Plugin name is too long (maximum ${String(xe)} characters)`,"INVALID_PLUGIN_NAME",{length:e.length,pluginName:e});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new j(`Plugin name "${e}" contains invalid characters`,"INVALID_PLUGIN_NAME",{pluginName:e});if(!On.test(e))throw new j(`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 Os=Object.defineProperty,Se=x((t,e)=>Os(t,"name",{value:e,configurable:!0}),"s");const Ps=new Set([`
6
- `,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),xs=/^[A-Z]:/i,Es=Se(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(Ps.has(e))throw new Error(`Argument contains dangerous character: ${e}`);return t.trim()},"sanitizeArgument"),xt=Se(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=>Es(e))},"sanitizeArguments");Se(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("/")||xs.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 Cc{static{E(this,"ao")}static{T(this,"co")}static{x(this,"RateLimiter")}static{Se(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 As=Object.defineProperty,Oe=x((t,e)=>As(t,"name",{value:e,configurable:!0}),"A");const Ns=/^-([^\d-])$/,js=/^--(\S+)/,Cs=/^-([^\d-]{2,})$/,qe=Oe(t=>Ns.test(t)||js.test(t)||Cs.test(t),"isOption");class ks{static{E(this,"Qi")}static{T(this,"uo")}static{x(this,"Cli")}static{Oe(this,"Cli")}#t;#e;#o;#c;#v;#u;#b;#a;#n;#i;#p;#s;#l;#f=!1;#y;#w=!1;#d;#h;#m;#g=[];#E(){return this.#d===void 0&&(this.#d=[...this.#i.keys()]),this.#d}#$(){return this.#h===void 0&&(this.#h=[...this.#n.keys()]),this.#h}#r(){return this.#m===void 0&&(this.#m=[...this.#E(),...this.#$()]),this.#m}#O(){return this.#g.length===0?be:[...be,...this.#g]}#A(){this.#d=void 0,this.#h=void 0,this.#m=void 0}#P(){if(this.#o===void 0){const e=bs(this.#e.argv);this.#o=xt(e),this.#N()}return this.#o}#N(){if(!this.#o)return;const e=G();let n=!1;for(const i of this.#o){if(i==="--quiet"||i==="-q"){e.CEREBRO_OUTPUT_LEVEL=String(Rn),n=!0;break}if(i==="--verbose"||i==="-v"){e.CEREBRO_OUTPUT_LEVEL=String(zn),n=!0;break}if(i==="--debug"||i==="-vvv"){e.CEREBRO_OUTPUT_LEVEL=String(ie),n=!0;break}}n||(e.CEREBRO_OUTPUT_LEVEL=Object.hasOwn(e,"DEBUG")?String(ie):String(et))}#j(){this.#w||(this.#y=ws(this.#t),this.#w=!0)}#x(e,n,i,o){this.#t.debug(`command '${o}' found, parsing command args: ${n.join(", ")}`);const{arguments_:r,booleanValues:l,parsedArgs:s}=Fa(e,n,this.#O()),p=Object.keys(l).length>0;let a=s;p&&(a={...s,_all:{...s._all,...l}}),es(r,a,e);const c=Wa(e,s,l,i);c.runtime=this,c.argv=this.#P();const h=e.options&&e.options.length>0;if(h&&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 Zt(u,g.name)}}return h&&(ls(c,e),cs(c,e)),ts(r,c.options,e),G().CEREBRO_OUTPUT_LEVEL===String(ie)&&(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_:r,booleanValues:l,commandArgs:a,parsedArgs:s,toolbox:c}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new j("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#v=e.trim();const i=n.argv??Pe(),o=n.cwd??ri();if(this.#e={...n,argv:i,cwd:o},this.#e.argv&&!Array.isArray(this.#e.argv))throw new j("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 j("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new j("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new j("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});const r=G();if(r.CEREBRO_OUTPUT_LEVEL=String(et),typeof this.#e.logger=="object"){const l=["debug","error","info","log","warn"],s=[],p=this.#e.logger;for(const a of l)typeof p[a]!="function"&&s.push(a);if(s.length>0)throw new j(`Logger object is missing required methods: ${s.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:s});this.#t=this.#e.logger}else this.#t={...console,debug:Oe((...l)=>{r.CEREBRO_OUTPUT_LEVEL===String(ie)&&console.debug(...l)},"debug")};this.#u=this.#e.packageVersion,this.#b=this.#e.packageName,this.#c=this.#e.cwd,this.#s="help",this.#l={},this.#n=new Map,this.#i=new Map,this.#p=new Map}setCommandSection(e){return this.#l=e,this}getCommandSection(){return this.#l.header||(this.#l.header=`${this.#v}${this.#u?` v${this.#u}`:""}`),this.#l}setDefaultCommand(e){return this.#s=e,this}get defaultCommand(){return this.#s}addCommand(e){Fe(e,"Command"),ye(e.name);const n=typeof e.execute=="function",i=typeof e.loader=="function";if(n&&i)throw new j(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!i)throw new j(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?ye(e.alias):Pt(e.alias,"Command alias").forEach(a=>ye(a))),e.argument&&Fe(e.argument,"Command argument"),e.options&&Fe(e.options,"Command options"),e.commandPath&&(Pt(e.commandPath,"Command commandPath"),e.commandPath.forEach(a=>{ye(a)}));const o=Ot(e.name,e.commandPath),r=ne(o);if(this.#i.has(r))throw new j(`Command with path "${r}" 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 j(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const a of e.options)pt(a);if(ns(e),ss(e),as(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(r,e);else{if(!l&&s!==void 0&&!p){const a=Ot(s.name,s.commandPath);this.#n.set(ne(a),s)}this.#n.set(e.name,e)}if(this.#i.set(r,o),this.#p.set(r,e),this.#A(),e.alias!==void 0){const a=typeof e.alias=="string"?[e.alias]:e.alias;for(const c of a){if(G().CEREBRO_OUTPUT_LEVEL===String(ie)&&this.#t.debug("adding alias",c),this.#n.has(c))throw new j(`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(be.map(r=>r.name)),o=new Set(be.map(r=>r.alias).filter(Boolean));if(i.has(n.name))throw new j(`Cannot add global option "--${n.name}": it conflicts with a built-in global option`,"DUPLICATE_OPTION",{optionName:n.name});if(n.alias&&o.has(n.alias))throw new j(`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.#g.map(r=>r.name)).has(n.name))throw new j(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",pt(n),this.#g.push(n),this}getGlobalOptions(){return this.#O()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#a?this.#a:(this.#a=new io(this.#t),this.#a.register({description:"Attaches the logger to the toolbox",execute:Oe(e=>{e.logger=this.#t},"execute"),name:"logger"}),this.#a)}getCliName(){return this.#v}getPackageVersion(){return this.#u}getPackageName(){return this.#b}getCommands(){return this.#n}getCwd(){return this.#c}dispose(){this.#y?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:i=!0,...o}=e;if(!this.#n.has("help")){const{default:m}=await import("../packem_chunks/help-command.js");this.addCommand(new m(this.#n))}const r=this.#$(),l=this.#i;this.#j();const s=this.#P();let p,a=[...s];const c=Ut(),h=Vt(),f=Pe();this.#t.debug(`process.execPath: ${c}`),this.#t.debug(`process.execArgv: ${h.join(" ")}`),this.#t.debug(`process.argv: ${f.join(" ")}`);const g=rs(l,[...s]);if(g.commandPath)p=g.commandPath,a=g.argv;else{if(s.length>1&&s[0]&&s[1]&&!qe(s[0])&&!qe(s[1])){const b=[];let $=0;for(;$<s.length;){const k=s[$];if(!k||qe(k))break;b.push(k),$+=1}const P=ne(b);if(b[0]&&!r.includes(b[0])){const k=this.#r(),N=re(P,k);throw new ee(P,N)}}let m;try{m=ho([null,...r],[...s])}catch(b){if(b instanceof Error&&b.name==="INVALID_COMMAND"&&"command"in b){const $=b.command,P=this.#r(),k=re($,P);throw new ee($,k)}throw b}m.command&&(p=[m.command],a=m.argv)}if(!p)if(this.#s)p=[this.#s];else{const m=this.#r();throw new ee("",m)}const u=ne(p),v=this.#i.get(u);let w;if(v){if(w=this.#p.get(u),!w||ne(v)!==u){const m=this.#r(),b=re(u,m);throw new ee(u,b)}}else{const m=p.at(-1);if(w=m?this.#n.get(m):void 0,!w){const b=this.#r(),$=re(u,b);throw new ee(u,$)}}if(typeof w.execute!="function"&&typeof w.loader!="function")return this.#t.error(`Command "${w.name}" has no function to execute.`),i?q(1):void 0;const y=a;let O,A;try{({commandArgs:O,toolbox:A}=this.#x(w,y,o,u))}catch(m){if(this.#t.error(m),i)return q(1);throw m}const d=this.getPluginManager();try{!this.#f&&d.hasPlugins()&&(await d.init({cli:this,cwd:this.#c,logger:this.#t}),this.#f=!0),await d.executeLifecycle("execute",A),await d.executeLifecycle("beforeCommand",A);let m;const b=O.global;if(b?.help){const $=this.#n.get("help");if(!$)throw new j("Help command not found","COMMAND_NOT_FOUND");m=await te($,A,O)}else if(b?.version??b?.V){const $=this.#n.get("version");if(!$)throw new j("Version command not found","COMMAND_NOT_FOUND");m=await te($,A,O)}else m=await te(w,A,O);return await d.executeLifecycle("afterCommand",A,m),i?q(0):void 0}catch(m){throw await d.executeErrorHandlers(m,A),m}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:i=[],...o}=n;Ye(e,"Command name");const r=e.split(" ").filter(Boolean),l=ne(r),s=this.#i.get(l)?this.#p.get(l):this.#n.get(e);if(!s){const f=this.#r(),g=re(l||e,f);throw new ee(e,g)}if(typeof s.execute!="function"&&typeof s.loader!="function")throw new j(`Command "${s.name}" has no function to execute`,"INVALID_COMMAND",{commandName:s.name});const p=[...xt(i)];this.#t.debug(`running command '${e}' programmatically with args: ${p.join(", ")}`);const{commandArgs:a,toolbox:c}=this.#x(s,p,o,l||e),h=this.getPluginManager();try{!this.#f&&h.hasPlugins()&&(await h.init({cli:this,cwd:this.#c,logger:this.#t}),this.#f=!0),await h.executeLifecycle("execute",c),await h.executeLifecycle("beforeCommand",c);let f;const g=a.global;if(g?.help){const u=this.#n.get("help");if(!u)throw new j("Help command not found","COMMAND_NOT_FOUND");f=await te(u,c,a)}else if(g?.version??g?.V){const u=this.#n.get("version");if(!u)throw new j("Version command not found","COMMAND_NOT_FOUND");f=await te(u,c,a)}else f=await te(s,c,a);return await h.executeLifecycle("afterCommand",c,f),f}catch(f){throw await h.executeErrorHandlers(f,c),f}}}var _s=Object.defineProperty,Ls=E((t,e)=>_s(t,"name",{value:e,configurable:!0}),"e$1"),Ss=Object.defineProperty,Ts=Ls((t,e)=>Ss(t,"name",{value:e,configurable:!0}),"o"),Is=Object.defineProperty,Ms=Ts((t,e)=>Is(t,"name",{value:e,configurable:!0}),"t");const kc=Ms((t,e)=>new ks(t,e),"createCerebro");var Vs=Object.defineProperty,se=E((t,e)=>Vs(t,"name",{value:e,configurable:!0}),"t$1");function Us(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}E(Us,"getDefaultExportFromCjs");se(Us,"getDefaultExportFromCjs");function Ds(t){return t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}E(Ds,"getDefaultExportFromNamespaceIfPresent");se(Ds,"getDefaultExportFromNamespaceIfPresent");function Bs(t){return t&&Object.prototype.hasOwnProperty.call(t,"default")&&Object.keys(t).length===1?t.default:t}E(Bs,"getDefaultExportFromNamespaceIfNotNamed");se(Bs,"getDefaultExportFromNamespaceIfNotNamed");function Rs(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var n=se(E(function i(){var o=!1;try{o=this instanceof i}catch{}return o?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)},"a"),"a");n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var o=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,o.get?o:{enumerable:!0,get:se(function(){return t[i]},"get")})}),n}E(Rs,"getAugmentedNamespace");se(Rs,"getAugmentedNamespace");var zs=Object.defineProperty,Ws=E((t,e)=>zs(t,"name",{value:e,configurable:!0}),"r$1"),Fs=Object.defineProperty,qs=Ws((t,e)=>Fs(t,"name",{value:e,configurable:!0}),"r"),Gs=Object.defineProperty,Hs=qs((t,e)=>Gs(t,"name",{value:e,configurable:!0}),"o");const _c=Hs(()=>{try{const t=require("node:module");if(typeof t.enableCompileCache=="function"){t.enableCompileCache();return}}catch{}try{require("v8-compile-cache")}catch{}},"enableCompileCache");var Js=Object.defineProperty,Ks=E((t,e)=>Js(t,"name",{value:e,configurable:!0}),"u$2"),Ys=Object.defineProperty,Pn=Ks((t,e)=>Ys(t,"name",{value:e,configurable:!0}),"p");const Zs=He(import.meta.url),de=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,xn=Pn(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 Zs(t)},"__cjs_getBuiltinModule"),{execFileSync:Xs}=xn("node:child_process"),{totalmem:Qs}=xn("node:os");var el=Object.defineProperty,Te=Pn((t,e)=>el(t,"name",{value:e,configurable:!0}),"r");const tl=/--max-old-space-size=(\d+)/,nl=/--max-semi-space-size=(\d+)/,il=Te(t=>Math.floor(Qs()/1024/1024*t),"getDefaultMaxOldSpaceSize"),rl=Te(t=>t<=512?4:t<=1024?8:t<=2048?16:t<=4096?32:t<=8192?64:Math.floor(Math.log2(t))*8,"getSemiSpaceSize"),Et=Te((t,e)=>{for(const n of e){const i=t.exec(n);if(i)return Number.parseInt(i[1],10)}},"extractFlag"),Lc=Te(t=>{const e=t?.maxOldSpacePercent??.75,n=[...Vt()],i=[...Pe()],o=Et(tl,n),r=Et(nl,n);if(o!==void 0&&r!==void 0)return;const l=o??il(e),s=r??rl(l),p=[];if(o===void 0&&p.push(`--max-old-space-size=${String(l)}`),r===void 0&&p.push(`--max-semi-space-size=${String(s)}`),p.length!==0)try{Xs(Ut(),[...p,...n,...i.slice(1)],{env:G(),stdio:"inherit"}),q(0)}catch(a){const c=a.status;q(typeof c=="number"?c:1)}},"applyHeapTuning");var ol=Object.defineProperty,al=E((t,e)=>ol(t,"name",{value:e,configurable:!0}),"T"),sl=Object.defineProperty,Ie=al((t,e)=>sl(t,"name",{value:e,configurable:!0}),"N");const ll=He(import.meta.url),he=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,cl=Ie(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 ll(t)},"__cjs_getBuiltinModule"),{createRequire:ul}=cl("node:module");var pl=Object.defineProperty,fl=Ie((t,e)=>pl(t,"name",{value:e,configurable:!0}),"A$2"),dl=Object.defineProperty,Ze=fl((t,e)=>dl(t,"name",{value:e,configurable:!0}),"$"),hl=Object.defineProperty,ml=Ze((t,e)=>hl(t,"name",{value:e,configurable:!0}),"r$1");const gl=ml(t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
7
- `),"normalizeLF"),vl=globalThis.process??Object.create(null),At={versions:{}},Nt=new Proxy(vl,{get(t,e){if(e in t)return t[e];if(e in At)return At[e]}});var bl=Object.defineProperty,yl=Ze((t,e)=>bl(t,"name",{value:e,configurable:!0}),"b");const wl=yl((t,e,n,i)=>{const o={column:0,line:-1,...t.start},r={...o,...t.end},l=o.line,s=o.column,p=r.line,a=r.column;let c=Math.max(l-(n+1),0),h=Math.min(e.length,p+i);l===-1&&(c=0),p===-1&&(h=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:h,markerLines:g,start:c}},"getMarkerLines");var $l=Object.defineProperty,we=Ze((t,e)=>$l(t,"name",{value:e,configurable:!0}),"t");const Ol=Nt.platform==="win32"&&!Nt.env?.WT_SESSION?">":"❯",Pl=we((t,e,n)=>{const i={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...n,color:{gutter:we(u=>u,"gutter"),marker:we(u=>u,"marker"),message:we(u=>u,"message"),...n?.color}},o=typeof e.start.column=="number";let r=gl(t).split(`
8
- `);typeof i.tabWidth=="number"&&(r=r.map(u=>u.replaceAll(" "," ".repeat(i.tabWidth))));const{end:l,markerLines:s,start:p}=wl(e,r,i.linesAbove,i.linesBelow),a=String(l).length,{gutter:c,marker:h,message:f}=i.color;let g=r.slice(p,l).map((u,v)=>{const w=p+1+v,y=s[w],O=` ${String(w)}`.slice(-a),A=!s[w+1],d=` ${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(d.replaceAll(/\d/g," "))," ",b,h("^").repeat($)].join(""),A&&i.message&&(m+=` ${f(i.message)}`)}return[i.prefix+h(Ol),c(d),u.length>0?` ${u}`:"",m].join("")}return`${i.prefix} ${c(d)}${u.length>0?` ${u}`:""}`}).join(`
10
- `);return i.message&&!o&&(g=`${i.prefix+" ".repeat(a+1)+i.message}
11
- ${g}`),g},"codeFrame");var xl=Object.defineProperty,El=Ie((t,e)=>xl(t,"name",{value:e,configurable:!0}),"x$1"),Al=Object.defineProperty,Nl=El((t,e)=>Al(t,"name",{value:e,configurable:!0}),"x"),jl=Object.defineProperty,W=Nl((t,e)=>jl(t,"name",{value:e,configurable:!0}),"u");const K=W((t,...e)=>{process.env.DEBUG&&process.env.DEBUG==="true"&&console.debug(`error:parse-stacktrace: ${t}`,...e)},"debugLog"),Y="<unknown>",Cl=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,kl=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,_l=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,Ll=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,Sl=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,Tl=/in\s(.*)\s\(at\s(.+)\)\sat/,Il=/^(?:.*@)?(.*):(\d+):(\d+)$/,Ml=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Vl=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ul=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,jt=/\(error: (.*)\)/,Dl=/at\s/,Bl=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,Rl=/^\s+|\s+$/g,zl=/\S*(?:Error: |AggregateError:)/,En=/^Anonymous function$/,Wl=/^\s*in\s.*/,Fl=/^.*?\s*at\s.*/,ql=/^.*?\s*@.*|\[native code\]/,An=W((t,e)=>{const n=t.includes("safari-extension"),i=t.includes("safari-web-extension");return n||i?[t.includes("@")?t.split("@")[0]:Y,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},"extractSafariExtensionDetails"),Nn=W((t,e)=>{const n=_l.exec(e);n&&(t.file=n[1],t.line=+n[2],t.column=+n[3])},"parseMapped"),Gl=W(t=>{const e=Tl.exec(t);if(e){K(`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]??Y,raw:t,type:void 0}}const n=Sl.exec(t);if(n){K(`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(Dl,""):void 0,line:n[3]?+n[3]:void 0,methodName:n[1]??Y,raw:t,type:t.startsWith("internal")?"internal":void 0};return Nn(i,`${n[2]}:${n[3]}:${n[4]}`),i}},"parseNode"),Hl=W(t=>{const e=Cl.exec(t);if(e){K(`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 o,r;if(i){const a=kl.exec(t);if(a){const c=Bl.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]&&(o={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=Ll.exec(t);c&&(r={column:c[4]?+c[4]:void 0,file:c[2],line:c[3]?+c[3]:void 0},o={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]=An(e[1]?e[1].replace(En,"<anonymous>"):Y,e[2]),p={column:e[4]?+e[4]:void 0,evalOrigin:o,file:s,line:e[3]?+e[3]:void 0,methodName:l,raw:t,type:i?"eval":n?"native":void 0};return r?(p.column=r.column,p.file=r.file,p.line=r.line):Nn(p,`${s}:${e[3]}:${e[4]}`),p}},"parseChromium"),Jl=W((t,e)=>{const n=Ml.exec(t);if(n){K(`parse gecko error stack line: "${t}"`,`found: ${JSON.stringify(n)}`);const i=n[3]?.includes(" > eval"),o=i&&n[3]&&Vl.exec(n[3]);let r;i&&o&&(n[3]=o[1],r={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]=o[2]);const[l,s]=An(n[1]?n[1].replace(En,"<anonymous>"):Y,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:r,file:s,line:a,methodName:l,raw:t,type:i?"eval":s.includes("[native code]")?"native":void 0}}},"parseGecko"),Kl=W((t,e)=>{const n=Ul.exec(t);if(!(n&&n[2].includes(" > eval"))&&n)return K(`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]||Y,raw:t,type:void 0}},"parseFirefox"),Yl=W(t=>{const e=Il.exec(t);if(e)return K(`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:Y,raw:t,type:void 0}},"parseReactAndroidNative"),jn=W((t,{filter:e,frameLimit:n=50}={})=>{const i=t;let o=(typeof i.stacktrace=="string"?i.stacktrace:t.stack??"").split(`
12
- `).map(r=>(jt.test(r)?r.replace(jt,"$1"):r).replaceAll(Rl,"")).filter(r=>!zl.test(r)&&r!=="eval code");return e&&(o=o.filter(r=>e(r))),o=o.slice(0,n),o.reduce((r,l,s)=>{if(!l||l.length>1024)return r;let p;if(Wl.test(l))p=Gl(l);else if(Fl.test(l))p=Hl(l);else if(ql.test(l)){let a;if(s===0){const c=t,h=c.columnNumber,f=c.lineNumber,g=c.line,u=c.column;h||f?a={column:h,line:f,type:"firefox"}:(g||u)&&(a={column:u,line:g,type:"safari"})}p=Kl(l,a)??Jl(l,a)}else p=Yl(l);return p?r.push(p):K(`parse error stack line: "${l}"`,"not parser found"),r},[])},"parseStacktrace");var Zl=Object.defineProperty,Xl=Ie((t,e)=>Zl(t,"name",{value:e,configurable:!0}),"p"),Ql=Object.defineProperty,Cn=Xl((t,e)=>Ql(t,"name",{value:e,configurable:!0}),"m");const ec=ul(import.meta.url),oe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Xe=Cn(t=>{if(typeof oe<"u"&&oe.versions&&oe.versions.node){const[e,n]=oe.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return oe.getBuiltinModule(t)}return ec(t)},"__cjs_getBuiltinModule"),{existsSync:tc,readFileSync:nc}=Xe("node:fs"),{relative:ic}=Xe("node:path"),{cwd:rc}=oe,{fileURLToPath:oc}=Xe("node:url");var ac=Object.defineProperty,_=Cn((t,e)=>ac(t,"name",{value:e,configurable:!0}),"o");const ue=_((t,e,n)=>n===0?t:e===" "?t+" ".repeat(n):t+" ".repeat(e*n),"getPrefix"),sc=_((t,e)=>{const n=t.replace("async file:","file:");return ic(e,n.startsWith("file:")?oc(n):n)},"getRelativePath"),lc=_((t,e,n)=>{if(e)return n.title(t.message);const i=t.message?`: ${t.message}`:"";return n.title(t.name+i)},"getTitleText"),kn=_((t,{color:e,hideErrorTitle:n,indentation:i,prefix:o},r)=>`${ue(o,i,r)}${lc(t,n,e)}
13
- `,"getMessage"),_n=_((t,{color:e,indentation:n,prefix:i},o)=>{if(t.hint===void 0)return;const r=ue(i,n,o);let l="";if(Array.isArray(t.hint))for(const s of t.hint)l+=`${r+s}
14
- `;else l+=r+t.hint;return e.hint(l)},"getHint"),Qe=_((t,{color:e,cwd:n,displayShortPath:i,indentation:o,prefix:r},l=0)=>{const s=i?sc(t.file,n):t.file,{fileLine:p,method:a}=e;return`${ue(r,o,l)}at ${t.methodName?`${a(t.methodName)} `:""}${p(s)}:${p(t.line?.toString()??"")}`},"getMainFrame"),Ln=_((t,{color:e,indentation:n,linesAbove:i,linesBelow:o,prefix:r,showGutter:l,showLineNumbers:s,tabWidth:p},a)=>{if(t.file===void 0)return;const c=t.file.replace("file://","");if(!tc(c))return;const h=nc(c,"utf8");return Pl(h,{start:{column:t.column,line:t.line}},{color:e,linesAbove:i,linesBelow:o,prefix:ue(r,n,a),showGutter:l,showLineNumbers:s,tabWidth:p})},"getCode"),Sn=_((t,e,n)=>{if(t.errors.length===0)return;let i=`${ue(e.prefix,e.indentation,n)}Errors:
15
-
16
- `,o=!0;for(const r of t.errors)o?o=!1:i+=`
17
-
18
- `,i+=In(r,{...e,framesMaxLimit:1,hideErrorCodeView:e.hideErrorErrorsCodeView},n+1);return`
19
- ${i}`},"getErrors"),Tn=_((t,e,n)=>{let i=`${ue(e.prefix,e.indentation,n)}Caused by:
20
-
21
- `;const o=t.cause;i+=kn(o,e,n);const r=jn(o).shift(),l=_n(o,e,n);if(l&&(i+=`${l}
22
- `),r&&(i+=Qe(r,e,n),!e.hideErrorCauseCodeView)){const s=Ln(r,e,n);s!==void 0&&(i+=`
23
- ${s}`)}if(o.cause)i+=`
24
- ${Tn(o,e,n+1)}`;else if(o instanceof AggregateError){const s=Sn(o,e,n);s!==void 0&&(i+=`
25
- ${s}`)}return`
26
- ${i}`},"getCause"),cc=_((t,e)=>(t.length>0?`
27
- `:"")+t.map(n=>Qe(n,e)).join(`
28
- `),"getStacktrace"),In=_((t,e,n)=>{const i={cwd:rc(),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}},o=jn(t,{filter:e.filterStacktrace,frameLimit:i.framesMaxLimit}),r=o.shift();return[e.hideMessage?void 0:kn(t,i,n),_n(t,i,n),r?Qe(r,i,n):void 0,r&&!i.hideErrorCodeView?Ln(r,i,n):void 0,t instanceof AggregateError?Sn(t,i,n):void 0,t.cause===void 0?void 0:Tn(t,i,n),o.length>0?cc(o,i):void 0].filter(Boolean).join(`
29
- `).replaceAll("\\","/")},"internalRenderError"),uc=_((t,e={})=>{if(e.framesMaxLimit!==void 0&&e.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return In(t,e,0)},"renderError");var pc=Object.defineProperty,fc=E((t,e)=>pc(t,"name",{value:e,configurable:!0}),"i$1"),dc=Object.defineProperty,hc=fc((t,e)=>dc(t,"name",{value:e,configurable:!0}),"n"),mc=Object.defineProperty,Ct=hc((t,e)=>mc(t,"name",{value:e,configurable:!0}),"n");const Sc=Ct((t={})=>({description:"Enhanced error handling and reporting with beautiful code frames",name:"error-handler",onError:Ct((e,n)=>{const{logger:i,runtime:o}=n,{detailed:r=!1,exitOnError:l=!0,formatter:s,logErrors:p=!0,renderOptions:a={}}=t;if(p)if(s)i.error(s(e));else if(r){const c=o.getCwd(),h=uc(e,{cwd:c,hideErrorCodeView:!1,hideErrorTitle:!1,hideMessage:!1,linesAbove:2,linesBelow:3,...a});i.error(h)}else i.error(e);l&&q(1)},"handleError"),version:"1.0.0"}),"errorHandlerPlugin");var gc="1.0.0-alpha.22";const Tc={version:gc};var vc=Object.defineProperty,bc=E((t,e)=>vc(t,"name",{value:e,configurable:!0}),"e");const Ic={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:bc(()=>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{ae as E,xc as H,Yt as L,me as M,Lc as N,ur as O,kc as T,Ic as a,xr as b,_r as c,G as d,j as e,Rs as f,Us as g,Pc as h,_c as i,Ft as l,Tc as m,vr as s,Dr as v,Sc as w};
@@ -1,2 +0,0 @@
1
- var Q=Object.defineProperty;var a=(t,e)=>Q(t,"name",{value:e,configurable:!0});import{createRequire as U}from"node:module";import{f as tt,M as p}from"./readFileSync-CGmzMUF2-D6rUjGDn.js";import{d as j}from"../packem_chunks/config.js";import{aL as lt,B as dt,aM as W}from"../packem_chunks/bin.js";const Z=U(import.meta.url),k=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=a(t=>{if(typeof k<"u"&&k.versions&&k.versions.node){const[e,o]=k.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return k.getBuiltinModule(t)}return Z(t)},"__cjs_getBuiltinModule"),{Socket:et}=y("node:net"),{randomBytes:ot}=y("node:crypto"),{readdir:st,writeFile:rt,rename:it,rm:T,open:A,readFile:at,stat:nt,unlink:O}=y("node:fs/promises"),{createRequire:ct}=y("node:module"),{spawn:ht}=y("node:child_process");var ut=Object.defineProperty,ft=a((t,e)=>ut(t,"name",{value:e,configurable:!0}),"i$1"),pt=Object.defineProperty,N=ft((t,e)=>pt(t,"name",{value:e,configurable:!0}),"s");const wt=ct(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,kt=N(t=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[e,o]=m.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return m.getBuiltinModule(t)}return wt(t)},"__cjs_getBuiltinModule"),{lstat:x,mkdir:mt}=kt("node:fs/promises");var gt=Object.defineProperty,vt=N((t,e)=>gt(t,"name",{value:e,configurable:!0}),"o");const yt=vt(async t=>{tt(t);try{const e=await x(t);if(!e.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(j(e))}'`);return}catch(e){if(e.code!=="ENOENT")throw e}try{await mt(t,{recursive:!0})}catch(e){if(e.code!=="EEXIST")throw e;const o=await x(t);if(!o.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(j(o))}'`,{cause:e})}},"ensureDir");var _t=Object.defineProperty,u=a((t,e)=>_t(t,"name",{value:e,configurable:!0}),"s");const bt=3e4,B=100;class $t extends Error{static{a(this,"ServiceReadinessError")}constructor(e,o){super(e),this.elapsedMs=o,this.name="ServiceReadinessError"}elapsedMs;static{u(this,"ServiceReadinessError")}}const Ht=u(async t=>{const e=t.host??"127.0.0.1",{port:o}=t,s=t.timeoutMs??bt,r=Date.now();for(;Date.now()-r<s;){if(await Et(e,o))return;await St(B)}throw new $t(`Timed out waiting for ${e}:${String(o)} to accept TCP connections (${String(s)}ms)`,Date.now()-r)},"waitForTcp"),Et=u((t,e)=>new Promise(o=>{const s=new et,r=u(i=>{s.removeAllListeners(),s.destroy(),o(i)},"onDone");s.once("connect",()=>{r(!0)}),s.once("error",()=>{r(!1)}),s.setTimeout(B,()=>{r(!1)});try{s.connect(e,t)}catch{r(!1)}}),"tryConnect"),St=u(t=>new Promise(e=>{setTimeout(e,t)}),"delay"),Pt=u(async(t,e)=>{const o=t.readiness??(t.port===void 0?void 0:{tcp:{port:t.port}});o&&await Ht({host:o.tcp.host,port:o.tcp.port,timeoutMs:e?.timeoutMs??o.tcp.timeoutMs})},"runReadiness");var Tt=Object.defineProperty,d=a((t,e)=>Tt(t,"name",{value:e,configurable:!0}),"o");const M=384,C=5e3,Mt=50,Rt=3e4,w=d(async t=>{const e=p(lt(t),"services");try{await yt(e)}catch(o){throw o.code==="ENOTDIR"?new Error(`Service registry path ${e} exists but is not a directory. Remove it or move the conflicting file before running \`vis service\`.`,{cause:o}):o}return e},"getRegistryDir"),R=d(t=>t.replaceAll("/","_").replaceAll(":","__"),"slugify"),D=d((t,e)=>p(t,`${R(e)}.json`),"entryPath"),Dt=d((t,e)=>p(t,`${R(e)}.lock`),"lockPath"),b=d(async(t,e)=>{const o=await w(t),s=D(o,e);if(await dt(s))try{return await W(s)}catch{return}},"readEntry"),Ot=d(async t=>{const e=await w(t);let o;try{o=await st(e)}catch{return[]}const s=[];for(const r of o)if(r.endsWith(".json"))try{const i=await W(p(e,r));s.push(i)}catch{}return s},"readAllEntries"),jt=d(async(t,e)=>{const o=await w(t),s=D(o,e.id),r=p(o,`.${ot(8).toString("hex")}.tmp`);await rt(r,`${JSON.stringify(e,void 0,2)}
2
- `,{mode:M});try{await it(r,s)}catch(i){throw await T(r,{force:!0}).catch(()=>{}),i}},"writeEntry"),g=d(async(t,e,o)=>{const s=await w(t),r=o??await b(t,e);await T(D(s,e),{force:!0}),r&&await T(r.logFile,{force:!0}).catch(()=>{})},"deleteEntry"),f=d(t=>{try{return process.kill(t,0),!0}catch{return!1}},"isAlive"),te=d(async t=>{const e=await Ot(t),o=[],s=[];for(const r of e){if(f(r.pid)){s.push(r);continue}const i=await b(t,r.id);if(i&&i.pid!==r.pid){s.push(i);continue}await g(t,r.id,r).catch(()=>{}),o.push(r.id)}return{pruned:o,surviving:s}},"pruneDead"),xt=d(t=>new Promise(e=>{setTimeout(e,t)}),"sleep"),Ct=d(async t=>{try{const e=await A(t,"wx",M);try{await e.writeFile(String(process.pid))}finally{await e.close().catch(()=>{})}return!0}catch(e){if(e.code==="EEXIST")return!1;throw e}},"tryClaimLock"),Lt=d(async t=>{let e;try{const o=await at(t,"utf8"),s=Number.parseInt(o.trim(),10);e=Number.isFinite(s)?s:void 0}catch{return!0}if(e!==void 0&&!f(e))return!0;try{const o=await nt(t);return Date.now()-o.mtimeMs>Rt}catch{return!0}},"isLockStale"),G=d(async(t,e,o)=>{const s=await w(t),r=Dt(s,e),i=Date.now();for(;!await Ct(r);){if(await Lt(r)){await O(r).catch(()=>{});continue}if(Date.now()-i>=C)throw new Error(`Could not acquire service lock for ${e} within ${String(C)}ms — another \`vis service\` invocation appears to be holding it.`);await xt(Mt)}try{return await o()}finally{await O(r).catch(()=>{})}},"withServiceLock");var Ft=Object.defineProperty,n=a((t,e)=>Ft(t,"name",{value:e,configurable:!0}),"r");function v(t,e={},o){for(const s in t){const r=t[s],i=o?`${o}:${s}`:s;typeof r=="object"&&r!==null?v(r,e,i):typeof r=="function"&&(e[i]=r)}return e}a(v,"c");n(v,"flatHooks");function It(...t){const e={};for(const o of t){const s=v(o);for(const r in s)e[r]?e[r].push(s[r]):e[r]=[s[r]]}for(const o in e)if(e[o].length>1){const s=e[o];e[o]=(...r)=>V(s,i=>i(...r))}else e[o]=e[o][0];return e}a(It,"v");n(It,"mergeHooks");function V(t,e){return t.reduce((o,s)=>o.then(()=>e(s)),Promise.resolve())}a(V,"d$2");n(V,"serial");const q=(()=>{if(console.createTask)return console.createTask;const t={run:n(e=>e(),"run")};return()=>t})();function $(t,e,o,s){for(let r=o;r<t.length;r+=1)try{const i=s?s.run(()=>t[r](...e)):t[r](...e);if(i&&typeof i.then=="function")return Promise.resolve(i).then(()=>$(t,e,r+1,s))}catch(i){return Promise.reject(i)}}a($,"k");n($,"callHooks");function X(t,e,o){if(t.length>0)return $(t,e,0,q(o))}a(X,"y");n(X,"serialTaskCaller");function J(t,e,o){if(t.length>0){const s=q(o);return Promise.all(t.map(r=>s.run(()=>r(...e))))}}a(J,"m");n(J,"parallelTaskCaller");function At(t,e){return t.reduce((o,s)=>o.then(()=>s(...e||[])),Promise.resolve())}a(At,"x");n(At,"serialCaller");function Wt(t,e){return Promise.all(t.map(o=>o(...e||[])))}a(Wt,"P");n(Wt,"parallelCaller");function _(t,e){for(const o of[...t])o(e)}a(_,"a");n(_,"callEachWith");var Nt=class{static{a(this,"p")}static{n(this,"Hookable")}_hooks;_before;_after;_deprecatedHooks;_deprecatedMessages;constructor(){this._hooks={},this._before=void 0,this._after=void 0,this._deprecatedMessages=void 0,this._deprecatedHooks={},this.hook=this.hook.bind(this),this.callHook=this.callHook.bind(this),this.callHookWith=this.callHookWith.bind(this)}hook(t,e,o={}){if(!t||typeof e!="function")return()=>{};const s=t;let r;for(;this._deprecatedHooks[t];)r=this._deprecatedHooks[t],t=r.to;if(r&&!o.allowDeprecated){let i=r.message;i||(i=`${s} hook has been deprecated`+(r.to?`, please use ${r.to}`:"")),this._deprecatedMessages||(this._deprecatedMessages=new Set),this._deprecatedMessages.has(i)||(console.warn(i),this._deprecatedMessages.add(i))}if(!e.name)try{Object.defineProperty(e,"name",{get:n(()=>"_"+t.replace(/\W+/g,"_")+"_hook_cb","get"),configurable:!0})}catch{}return this._hooks[t]=this._hooks[t]||[],this._hooks[t].push(e),()=>{e&&(this.removeHook(t,e),e=void 0)}}hookOnce(t,e){let o,s=n((...r)=>(typeof o=="function"&&o(),o=void 0,s=void 0,e(...r)),"_function");return o=this.hook(t,s),o}removeHook(t,e){const o=this._hooks[t];if(o){const s=o.indexOf(e);s!==-1&&o.splice(s,1),o.length===0&&(this._hooks[t]=void 0)}}clearHook(t){this._hooks[t]=void 0}deprecateHook(t,e){this._deprecatedHooks[t]=typeof e=="string"?{to:e}:e;const o=this._hooks[t]||[];this._hooks[t]=void 0;for(const s of o)this.hook(t,s)}deprecateHooks(t){for(const e in t)this.deprecateHook(e,t[e])}addHooks(t){const e=v(t),o=Object.keys(e).map(s=>this.hook(s,e[s]));return()=>{for(const s of o)s();o.length=0}}removeHooks(t){const e=v(t);for(const o in e)this.removeHook(o,e[o])}removeAllHooks(){this._hooks={}}callHook(t,...e){return this.callHookWith(X,t,e)}callHookParallel(t,...e){return this.callHookWith(J,t,e)}callHookWith(t,e,o){const s=this._before||this._after?{name:e,args:o,context:{}}:void 0;this._before&&_(this._before,s);const r=t(this._hooks[e]?[...this._hooks[e]]:[],o,e);return r instanceof Promise?r.finally(()=>{this._after&&s&&_(this._after,s)}):(this._after&&s&&_(this._after,s),r)}beforeEach(t){return this._before=this._before||[],this._before.push(t),()=>{if(this._before!==void 0){const e=this._before.indexOf(t);e!==-1&&this._before.splice(e,1)}}}afterEach(t){return this._after=this._after||[],this._after.push(t),()=>{if(this._after!==void 0){const e=this._after.indexOf(t);e!==-1&&this._after.splice(e,1)}}}};function K(){return new Nt}a(K,"w$2");n(K,"createHooks");(class{static{n(this,"HookableCore")}_hooks;constructor(){this._hooks={}}hook(t,e){return!t||typeof e!="function"?()=>{}:(this._hooks[t]=this._hooks[t]||[],this._hooks[t].push(e),()=>{e&&(this.removeHook(t,e),e=void 0)})}removeHook(t,e){const o=this._hooks[t];if(o){const s=o.indexOf(e);s!==-1&&o.splice(s,1),o.length===0&&(this._hooks[t]=void 0)}}callHook(t,...e){const o=this._hooks[t];if(!(!o||o.length===0))return $(o,e,0)}});const L=typeof window<"u";function Bt(t,e={}){const o={inspect:L,group:L,filter:n(()=>!0,"filter"),...e},s=o.filter,r=typeof s=="string"?c=>c.startsWith(s):s,i=o.tag?`[${o.tag}] `:"",l=n(c=>i+c.name+"".padEnd(c._id,"\0"),"logPrefix"),h={},S=t.beforeEach(c=>{r!==void 0&&!r(c.name)||(h[c.name]=h[c.name]||0,c._id=h[c.name]++,console.time(l(c)))}),P=t.afterEach(c=>{r!==void 0&&!r(c.name)||(o.group&&console.groupCollapsed(c.name),o.inspect?console.timeLog(l(c),c.args):console.timeEnd(l(c)),o.group&&console.groupEnd(),h[c.name]--)});return{close:n(()=>{S(),P()},"close")}}a(Bt,"W");n(Bt,"createDebugger");var Gt=Object.defineProperty,H=a((t,e)=>Gt(t,"name",{value:e,configurable:!0}),"t$1");const ee=H(()=>K(),"createVisHooks"),oe=H(async(t,e)=>{if(!(!e||e.length===0))for(const o of e){if(o.hooks)for(const[s,r]of Object.entries(o.hooks)){const i=Array.isArray(r)?r:[r];for(const l of i)t.hook(s,l)}o.setup&&await o.setup(t)}},"registerPlugins");class se{static{a(this,"HookableLifeCycle")}static{H(this,"HookableLifeCycle")}#o;#e;#s=new Map;constructor(e,o){this.#o=e,this.#e=o}startTasks(e){for(const o of e)this.#s.set(o.id,o),this.#t("task:before",o)}endTasks(e){for(const o of e)this.#s.delete(o.task.id),this.#t("task:after",o.task,o),o.status==="failure"?this.#t("task:failure",o.task,o):Vt(o.status)&&this.#t("task:cacheHit",o.task,o)}printCacheMiss(e,o){this.#t("task:cacheMiss",e,o)}onTaskStdout(e,o){this.#t("task:stdout",e,o)}onTaskStderr(e,o){this.#t("task:stderr",e,o)}#t(e,...o){Promise.resolve(this.#o.callHook(e,...o)).catch(s=>{if(this.#e)try{this.#e(e,s)}catch{}})}}const Vt=H(t=>t==="local-cache"||t==="local-cache-kept-existing"||t==="remote-cache","isCacheStatus");var qt=Object.defineProperty,Xt=a((t,e)=>qt(t,"name",{value:e,configurable:!0}),"i");const F=process.platform==="win32",Jt=Xt(async t=>{const{command:e,cwd:o,env:s,logFile:r}=t,i=await A(r,"a",M);let l;try{l=ht(F?"cmd":"/bin/sh",F?["/d","/s","/c",e]:["-c",e],{cwd:o,detached:!0,env:{...process.env,...s},stdio:["ignore",i.fd,i.fd],windowsHide:!0})}finally{await i.close().catch(()=>{})}if(l.pid===void 0&&await new Promise((h,S)=>{l.once("spawn",()=>{h()}),l.once("error",P=>{S(P)})}),l.pid===void 0)throw new Error(`Failed to spawn detached process for command: ${e}`);return l.unref(),{pid:l.pid}},"spawnDetached");var Kt=Object.defineProperty,E=a((t,e)=>Kt(t,"name",{value:e,configurable:!0}),"t");const Y=5e3,re=E(async t=>G(t.workspaceRoot,t.id,async()=>{const e=await b(t.workspaceRoot,t.id);if(e&&f(e.pid))throw new Error(`Service ${t.id} is already running (pid ${String(e.pid)})`);e&&await g(t.workspaceRoot,t.id,e);const o=await w(t.workspaceRoot),s=R(t.id),r=p(o,`${s}.log`),{pid:i}=await Jt({command:t.command,cwd:t.cwd,env:t.env,logFile:r}),l={command:t.command,config:t.config,cwd:t.cwd,env:t.config.env??{},id:t.id,logFile:r,pid:i,slug:s,startedAt:new Date().toISOString(),visVersion:process.env.VIS_VERSION??"0.0.0"};if(await jt(t.workspaceRoot,l),t.skipReadiness!==!0)try{await Pt(t.config,{timeoutMs:t.readinessTimeoutMs})}catch(h){throw await z(i,t.config.killGracePeriodMs??Y).catch(()=>{}),await g(t.workspaceRoot,t.id,l).catch(()=>{}),h}return{entry:l}}),"startService"),ie=E(async t=>G(t.workspaceRoot,t.id,async()=>{const e=await b(t.workspaceRoot,t.id);if(!e)return{stopped:!1};if(!f(e.pid))return await g(t.workspaceRoot,t.id,e),{stopped:!1};const o=t.graceMs??e.config.killGracePeriodMs??Y;return await z(e.pid,o),await g(t.workspaceRoot,t.id,e),{stopped:!0}}),"stopService"),z=E(async(t,e)=>{I(t,"SIGTERM");const o=Date.now();for(;Date.now()-o<e;){if(!f(t))return;await new Promise(s=>{setTimeout(s,100)})}f(t)&&I(t,"SIGKILL")},"stopServiceByPid"),I=E((t,e)=>{try{process.platform==="win32"?process.kill(t,e):process.kill(-t,e)}catch(o){if(o.code==="ESRCH")return;throw o}},"sendSignalToServiceGroup");export{se as H,$t as S,b as a,ie as b,ee as c,Ot as d,Pt as e,g as f,f as i,te as p,oe as r,re as s};