@redocly/cli 2.47.0 → 2.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chunks/{TEQA5OM7.js → 2GJPOM5H.js} +1 -1
- package/lib/chunks/{W2NJCZOS.js → 3CR6IHZV.js} +1 -1
- package/lib/chunks/3JJEI7CJ.js +456 -0
- package/lib/chunks/{QRD3XQNU.js → 3M6ARSHY.js} +1 -1
- package/lib/chunks/3X52NOC5.js +7 -0
- package/lib/chunks/46OWEERC.js +19 -0
- package/lib/chunks/4IA3ZTGK.js +20 -0
- package/lib/chunks/{TO2KJ36N.js → 5E3L4HJN.js} +1 -1
- package/lib/chunks/5EG7SNNU.js +177 -0
- package/lib/chunks/5L3FH5WQ.js +16 -0
- package/lib/chunks/5L5WOOWA.js +7 -0
- package/lib/chunks/5ZEWVWOC.js +14 -0
- package/lib/chunks/6O3ZHZZ2.js +7 -0
- package/lib/chunks/{KEUH3PST.js → AJZAID3R.js} +1 -1
- package/lib/chunks/BD5JG7YZ.js +7 -0
- package/lib/chunks/{B6HS7CVY.js → BEOYUN4L.js} +48 -48
- package/lib/chunks/CF5YCHNA.js +7 -0
- package/lib/chunks/D27SC2KR.js +90 -0
- package/lib/chunks/{SN2EC2ZR.js → DYAVWTVD.js} +1 -1
- package/lib/chunks/E35Q6YJN.js +7 -0
- package/lib/chunks/EB2V4VMP.js +7 -0
- package/lib/chunks/{QVV2EKMT.js → FL3CA53Z.js} +1 -1
- package/lib/chunks/FVBSRIWC.js +18 -0
- package/lib/chunks/G2XR6TRU.js +67 -0
- package/lib/chunks/G3YJARF7.js +57 -0
- package/lib/chunks/GA6WYGKY.js +7 -0
- package/lib/chunks/GBRES7WG.js +5400 -0
- package/lib/chunks/GHPAE4DZ.js +20 -0
- package/lib/chunks/{SL6AH3N2.js → GJRJZYC4.js} +1 -1
- package/lib/chunks/{REBHK2JR.js → GOJNDGZT.js} +1 -1
- package/lib/chunks/HJYFWIVE.js +9 -0
- package/lib/chunks/HLZCPNF7.js +16 -0
- package/lib/chunks/KIQI3UBS.js +177 -0
- package/lib/chunks/KNPQJVYA.js +14 -0
- package/lib/chunks/L3TZNNJJ.js +13 -0
- package/lib/chunks/{34J2ZJDK.js → LUC2DWUK.js} +1 -1
- package/lib/chunks/MBHFDTYI.js +78 -0
- package/lib/chunks/NB54XRRU.js +10 -0
- package/lib/chunks/NSIQWNYL.js +7 -0
- package/lib/chunks/NWMTC4AN.js +7 -0
- package/lib/chunks/PFYPTG4G.js +7 -0
- package/lib/chunks/{5NR4DJW4.js → PVM7EVWV.js} +1 -1
- package/lib/chunks/Q5FNL2RM.js +22 -0
- package/lib/chunks/QW5MTOU2.js +22 -0
- package/lib/chunks/REFX2EKS.js +13 -0
- package/lib/chunks/S4GQKQ5G.js +7 -0
- package/lib/chunks/SGBB4RNM.js +11 -0
- package/lib/chunks/{YQW463Z7.js → SPPRUUK3.js} +1 -1
- package/lib/chunks/SQVG3CEM.js +8 -0
- package/lib/chunks/TSB6PODJ.js +13 -0
- package/lib/chunks/U2A6GEAN.js +42 -0
- package/lib/chunks/UDBINQ2S.js +42 -0
- package/lib/chunks/UKSQ7B5H.js +2268 -0
- package/lib/chunks/{QL4V2A4A.js → V3JMSQFP.js} +1 -1
- package/lib/chunks/VWSPU27A.js +30 -0
- package/lib/chunks/W62VKXGM.js +26 -0
- package/lib/chunks/WIZYCYZG.js +7 -0
- package/lib/chunks/XDK4JK3V.js +9 -0
- package/lib/chunks/{5PXRDPHV.js → YJGI7CZ2.js} +1 -1
- package/lib/chunks/YQS3OX36.js +11 -0
- package/lib/chunks/{S4MX7JPH.js → Z2AXUXMK.js} +1 -1
- package/lib/chunks/ZBL4IVEW.js +11 -0
- package/lib/chunks/ZGMTMVBB.js +19 -0
- package/lib/chunks/{RIFZSMUA.js → ZVUMPMHU.js} +1 -1
- package/lib/eject-assets/AGENTS.md +137 -0
- package/lib/eject-assets/generators/cli/docs.ts +224 -0
- package/lib/eject-assets/generators/cli/engine-source.ts +21 -0
- package/lib/eject-assets/generators/cli/index.ts +90 -0
- package/lib/eject-assets/generators/cli/render.ts +348 -0
- package/lib/eject-assets/generators/go/client.ts +57 -0
- package/lib/eject-assets/generators/go/descriptor.ts +41 -0
- package/lib/eject-assets/generators/go/index.ts +336 -0
- package/lib/eject-assets/generators/go/models.ts +179 -0
- package/lib/eject-assets/generators/go/naming.ts +49 -0
- package/lib/eject-assets/generators/go/operations.ts +296 -0
- package/lib/eject-assets/generators/go/pagination.ts +194 -0
- package/lib/eject-assets/generators/go/types.ts +60 -0
- package/lib/eject-assets/generators/mock/faker.ts +214 -0
- package/lib/eject-assets/generators/mock/index.ts +35 -0
- package/lib/eject-assets/generators/mock/render.ts +282 -0
- package/lib/eject-assets/generators/mock/sample.ts +316 -0
- package/lib/eject-assets/generators/mock/values.ts +63 -0
- package/lib/eject-assets/generators/php/client.ts +63 -0
- package/lib/eject-assets/generators/php/descriptor.ts +58 -0
- package/lib/eject-assets/generators/php/index.ts +237 -0
- package/lib/eject-assets/generators/php/models.ts +275 -0
- package/lib/eject-assets/generators/php/naming.ts +51 -0
- package/lib/eject-assets/generators/php/operations.ts +232 -0
- package/lib/eject-assets/generators/php/pagination.ts +133 -0
- package/lib/eject-assets/generators/php/types.ts +148 -0
- package/lib/eject-assets/generators/python/client.ts +123 -0
- package/lib/eject-assets/generators/python/descriptor.ts +52 -0
- package/lib/eject-assets/generators/python/index.ts +251 -0
- package/lib/eject-assets/generators/python/models.ts +242 -0
- package/lib/eject-assets/generators/python/naming.ts +46 -0
- package/lib/eject-assets/generators/python/operations.ts +147 -0
- package/lib/eject-assets/generators/python/pagination.ts +128 -0
- package/lib/eject-assets/generators/python/types.ts +54 -0
- package/lib/eject-assets/generators/swr/index.ts +37 -0
- package/lib/eject-assets/generators/swr/render.ts +78 -0
- package/lib/eject-assets/generators/tanstack-query/index.ts +48 -0
- package/lib/eject-assets/generators/tanstack-query/render.ts +346 -0
- package/lib/eject-assets/generators/transformers/index.ts +46 -0
- package/lib/eject-assets/generators/transformers/render.ts +506 -0
- package/lib/eject-assets/generators/typescript/banner.ts +35 -0
- package/lib/eject-assets/generators/typescript/client.ts +254 -0
- package/lib/eject-assets/generators/typescript/descriptor.ts +137 -0
- package/lib/eject-assets/generators/typescript/index.ts +101 -0
- package/lib/eject-assets/generators/typescript/inline-runtime.ts +135 -0
- package/lib/eject-assets/generators/typescript/operation-signature.ts +62 -0
- package/lib/eject-assets/generators/typescript/operation-types.ts +17 -0
- package/lib/eject-assets/generators/typescript/operations.ts +524 -0
- package/lib/eject-assets/generators/typescript/response-headers.ts +74 -0
- package/lib/eject-assets/generators/typescript/type-guards.ts +159 -0
- package/lib/eject-assets/generators/typescript/types.ts +172 -0
- package/lib/eject-assets/generators/zod/index.ts +32 -0
- package/lib/eject-assets/generators/zod/schemas.ts +456 -0
- package/lib/eject-assets/skills/cli-generator/SKILL.md +121 -0
- package/lib/eject-assets/skills/client-generators/SKILL.md +142 -0
- package/lib/eject-assets/skills/go-generator/SKILL.md +96 -0
- package/lib/eject-assets/skills/mock-generator/SKILL.md +50 -0
- package/lib/eject-assets/skills/php-generator/SKILL.md +112 -0
- package/lib/eject-assets/skills/python-generator/SKILL.md +110 -0
- package/lib/eject-assets/skills/swr-generator/SKILL.md +50 -0
- package/lib/eject-assets/skills/tanstack-query-generator/SKILL.md +55 -0
- package/lib/eject-assets/skills/transformers-generator/SKILL.md +47 -0
- package/lib/eject-assets/skills/typescript-generator/SKILL.md +95 -0
- package/lib/eject-assets/skills/zod-generator/SKILL.md +54 -0
- package/lib/index.js +272 -193
- package/package.json +1 -1
- package/lib/chunks/PIJLRHNN.js +0 -8
- package/lib/chunks/Y5HLCNL5.js +0 -2542
package/lib/index.js
CHANGED
|
@@ -5,21 +5,21 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
5
5
|
const require = __createRequire(import.meta.url);
|
|
6
6
|
var __filename = __fileURLToPath(import.meta.url);
|
|
7
7
|
var __dirname = __pathDirname(__filename);
|
|
8
|
-
import{a as xi,c as vi}from"./chunks/OFAMJNQ6.js";import{a as ui,b as fi,c as rt,d as mi,e as gn,f as He,g as Wt,h as di,i as hi,j as yo,k as gi,l as fr,m as Pe,n as yn,o as yi,p as bi,q as Si,r as wi,s as kr,t as bo,u as mt,v as Ur}from"./chunks/W2NJCZOS.js";import{a as Sn,b as Ci,c as Ai}from"./chunks/RIFZSMUA.js";import{a as qt,b as W}from"./chunks/QRD3XQNU.js";import{a as fn,b as ur,c as go,d as li,e as dn,f as pi,g as hn,h as Fr}from"./chunks/QVV2EKMT.js";import{a as ai,c as mn,d as ho}from"./chunks/P26PQ2RU.js";import"./chunks/RS5PUOTT.js";import{a as tt,b as si,c as ii}from"./chunks/5NR4DJW4.js";import{a as ci}from"./chunks/BXI4SF2U.js";import{c as bn,d as Ei,f as Oi}from"./chunks/34J2ZJDK.js";import"./chunks/O6PRCLSV.js";import"./chunks/32XCOMOR.js";import{$ as ri,A as Zs,C as Qs,D as ye,F as Ne,G as pe,H as ee,I as Q,J as et,K as de,L as Fe,M as ue,N as Nr,O as y,Q as lr,R as ut,T as ei,U as ti,W as ft,X as ln,Y as Lr,_ as Mr,a as Ws,aa as pr,b as Rt,c as re,ca as ni,d as yt,da as Ot,ea as pn,f as zs,fa as un,g as Vs,ga as ze,h as an,i as mo,j as Bs,ja as oi,l as _e,la as Ve,n as Me,o as Gs,p as cn,q as Ie,r as Hs,s as Ys,t as Ks,u as cr,y as Js,z as Xs}from"./chunks/B6HS7CVY.js";import"./chunks/NEWT5A6S.js";import{a as We,c as B,e as Pt}from"./chunks/RFWIIJFG.js";var mr=B((xb,Pi)=>{"use strict";var af="2.0.0",cf=Number.MAX_SAFE_INTEGER||9007199254740991,lf=16,pf=250,uf=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Pi.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:lf,MAX_SAFE_BUILD_LENGTH:pf,MAX_SAFE_INTEGER:cf,RELEASE_TYPES:uf,SEMVER_SPEC_VERSION:af,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var qr=B((vb,Ri)=>{"use strict";var ff=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};Ri.exports=ff});var dr=B((bt,$i)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:So,MAX_SAFE_BUILD_LENGTH:mf,MAX_LENGTH:df}=mr(),hf=qr();bt=$i.exports={};var gf=bt.re=[],yf=bt.safeRe=[],T=bt.src=[],bf=bt.safeSrc=[],j=bt.t={},Sf=0,wo="[a-zA-Z0-9-]",wf=[["\\s",1],["\\d",df],[wo,mf]],Ef=t=>{for(let[e,r]of wf)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},Z=(t,e,r)=>{let n=Ef(e),o=Sf++;hf(t,o,e),j[t]=o,T[o]=e,bf[o]=n,gf[o]=new RegExp(e,r?"g":void 0),yf[o]=new RegExp(n,r?"g":void 0)};Z("NUMERICIDENTIFIER","0|[1-9]\\d*");Z("NUMERICIDENTIFIERLOOSE","\\d+");Z("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${wo}*`);Z("MAINVERSION",`(${T[j.NUMERICIDENTIFIER]})\\.(${T[j.NUMERICIDENTIFIER]})\\.(${T[j.NUMERICIDENTIFIER]})`);Z("MAINVERSIONLOOSE",`(${T[j.NUMERICIDENTIFIERLOOSE]})\\.(${T[j.NUMERICIDENTIFIERLOOSE]})\\.(${T[j.NUMERICIDENTIFIERLOOSE]})`);Z("PRERELEASEIDENTIFIER",`(?:${T[j.NONNUMERICIDENTIFIER]}|${T[j.NUMERICIDENTIFIER]})`);Z("PRERELEASEIDENTIFIERLOOSE",`(?:${T[j.NONNUMERICIDENTIFIER]}|${T[j.NUMERICIDENTIFIERLOOSE]})`);Z("PRERELEASE",`(?:-(${T[j.PRERELEASEIDENTIFIER]}(?:\\.${T[j.PRERELEASEIDENTIFIER]})*))`);Z("PRERELEASELOOSE",`(?:-?(${T[j.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${T[j.PRERELEASEIDENTIFIERLOOSE]})*))`);Z("BUILDIDENTIFIER",`${wo}+`);Z("BUILD",`(?:\\+(${T[j.BUILDIDENTIFIER]}(?:\\.${T[j.BUILDIDENTIFIER]})*))`);Z("FULLPLAIN",`v?${T[j.MAINVERSION]}${T[j.PRERELEASE]}?${T[j.BUILD]}?`);Z("FULL",`^${T[j.FULLPLAIN]}$`);Z("LOOSEPLAIN",`[v=\\s]*${T[j.MAINVERSIONLOOSE]}${T[j.PRERELEASELOOSE]}?${T[j.BUILD]}?`);Z("LOOSE",`^${T[j.LOOSEPLAIN]}$`);Z("GTLT","((?:<|>)?=?)");Z("XRANGEIDENTIFIERLOOSE",`${T[j.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Z("XRANGEIDENTIFIER",`${T[j.NUMERICIDENTIFIER]}|x|X|\\*`);Z("XRANGEPLAIN",`[v=\\s]*(${T[j.XRANGEIDENTIFIER]})(?:\\.(${T[j.XRANGEIDENTIFIER]})(?:\\.(${T[j.XRANGEIDENTIFIER]})(?:${T[j.PRERELEASE]})?${T[j.BUILD]}?)?)?`);Z("XRANGEPLAINLOOSE",`[v=\\s]*(${T[j.XRANGEIDENTIFIERLOOSE]})(?:\\.(${T[j.XRANGEIDENTIFIERLOOSE]})(?:\\.(${T[j.XRANGEIDENTIFIERLOOSE]})(?:${T[j.PRERELEASELOOSE]})?${T[j.BUILD]}?)?)?`);Z("XRANGE",`^${T[j.GTLT]}\\s*${T[j.XRANGEPLAIN]}$`);Z("XRANGELOOSE",`^${T[j.GTLT]}\\s*${T[j.XRANGEPLAINLOOSE]}$`);Z("COERCEPLAIN",`(^|[^\\d])(\\d{1,${So}})(?:\\.(\\d{1,${So}}))?(?:\\.(\\d{1,${So}}))?`);Z("COERCE",`${T[j.COERCEPLAIN]}(?:$|[^\\d])`);Z("COERCEFULL",T[j.COERCEPLAIN]+`(?:${T[j.PRERELEASE]})?(?:${T[j.BUILD]})?(?:$|[^\\d])`);Z("COERCERTL",T[j.COERCE],!0);Z("COERCERTLFULL",T[j.COERCEFULL],!0);Z("LONETILDE","(?:~>?)");Z("TILDETRIM",`(\\s*)${T[j.LONETILDE]}\\s+`,!0);bt.tildeTrimReplace="$1~";Z("TILDE",`^${T[j.LONETILDE]}${T[j.XRANGEPLAIN]}$`);Z("TILDELOOSE",`^${T[j.LONETILDE]}${T[j.XRANGEPLAINLOOSE]}$`);Z("LONECARET","(?:\\^)");Z("CARETTRIM",`(\\s*)${T[j.LONECARET]}\\s+`,!0);bt.caretTrimReplace="$1^";Z("CARET",`^${T[j.LONECARET]}${T[j.XRANGEPLAIN]}$`);Z("CARETLOOSE",`^${T[j.LONECARET]}${T[j.XRANGEPLAINLOOSE]}$`);Z("COMPARATORLOOSE",`^${T[j.GTLT]}\\s*(${T[j.LOOSEPLAIN]})$|^$`);Z("COMPARATOR",`^${T[j.GTLT]}\\s*(${T[j.FULLPLAIN]})$|^$`);Z("COMPARATORTRIM",`(\\s*)${T[j.GTLT]}\\s*(${T[j.LOOSEPLAIN]}|${T[j.XRANGEPLAIN]})`,!0);bt.comparatorTrimReplace="$1$2$3";Z("HYPHENRANGE",`^\\s*(${T[j.XRANGEPLAIN]})\\s+-\\s+(${T[j.XRANGEPLAIN]})\\s*$`);Z("HYPHENRANGELOOSE",`^\\s*(${T[j.XRANGEPLAINLOOSE]})\\s+-\\s+(${T[j.XRANGEPLAINLOOSE]})\\s*$`);Z("STAR","(<|>)?=?\\s*\\*");Z("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Z("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var wn=B((Pb,_i)=>{"use strict";var Of=Object.freeze({loose:!0}),Cf=Object.freeze({}),Af=t=>t?typeof t!="object"?Of:t:Cf;_i.exports=Af});var Eo=B((Rb,ji)=>{"use strict";var Ii=/^[0-9]+$/,Ti=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=Ii.test(t),n=Ii.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},xf=(t,e)=>Ti(e,t);ji.exports={compareIdentifiers:Ti,rcompareIdentifiers:xf}});var Te=B(($b,Ni)=>{"use strict";var En=qr(),{MAX_LENGTH:Di,MAX_SAFE_INTEGER:On}=mr(),{safeRe:Cn,t:An}=dr(),vf=wn(),{compareIdentifiers:Oo}=Eo(),Pf=(t,e)=>{let r=e.split(".");if(r.length>t.length)return!1;for(let n=0;n<r.length;n++)if(Oo(t[n],r[n])!==0)return!1;return!0},Co=class t{constructor(e,r){if(r=vf(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>Di)throw new TypeError(`version is longer than ${Di} characters`);En("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?Cn[An.LOOSE]:Cn[An.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>On||this.major<0)throw new TypeError("Invalid major version");if(this.minor>On||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>On||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let s=+o;if(s>=0&&s<On)return s}return o}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(En("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],o=e.prerelease[r];if(En("prerelease compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return Oo(n,o)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],o=e.build[r];if(En("build compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return Oo(n,o)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let o=`-${r}`.match(this.options.loose?Cn[An.PRERELEASELOOSE]:Cn[An.PRERELEASE]);if(!o||o[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[o];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(r){let s=[r,o];if(n===!1&&(s=[r]),Pf(this.prerelease,r)){let i=this.prerelease[r.split(".").length];isNaN(i)&&(this.prerelease=s)}else this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};Ni.exports=Co});var $t=B((_b,Mi)=>{"use strict";var Li=Te(),Rf=(t,e,r=!1)=>{if(t instanceof Li)return t;try{return new Li(t,e)}catch(n){if(!r)return null;throw n}};Mi.exports=Rf});var ki=B((Ib,Fi)=>{"use strict";var $f=$t(),_f=(t,e)=>{let r=$f(t,e);return r?r.version:null};Fi.exports=_f});var qi=B((Tb,Ui)=>{"use strict";var If=$t(),Tf=(t,e)=>{let r=If(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};Ui.exports=Tf});var Vi=B((jb,zi)=>{"use strict";var Wi=Te(),jf=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new Wi(t instanceof Wi?t.version:t,r).inc(e,n,o).version}catch{return null}};zi.exports=jf});var Hi=B((Db,Gi)=>{"use strict";var Bi=$t(),Df=(t,e)=>{let r=Bi(t,null,!0),n=Bi(e,null,!0),o=r.compare(n);if(o===0)return null;let s=o>0,i=s?r:n,a=s?n:r,c=!!i.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(i)===0)return a.minor&&!a.patch?"minor":"patch"}let u=c?"pre":"";return r.major!==n.major?u+"major":r.minor!==n.minor?u+"minor":r.patch!==n.patch?u+"patch":"prerelease"};Gi.exports=Df});var Ki=B((Nb,Yi)=>{"use strict";var Nf=Te(),Lf=(t,e)=>new Nf(t,e).major;Yi.exports=Lf});var Xi=B((Lb,Ji)=>{"use strict";var Mf=Te(),Ff=(t,e)=>new Mf(t,e).minor;Ji.exports=Ff});var Qi=B((Mb,Zi)=>{"use strict";var kf=Te(),Uf=(t,e)=>new kf(t,e).patch;Zi.exports=Uf});var ta=B((Fb,ea)=>{"use strict";var qf=$t(),Wf=(t,e)=>{let r=qf(t,e);return r&&r.prerelease.length?r.prerelease:null};ea.exports=Wf});var nt=B((kb,na)=>{"use strict";var ra=Te(),zf=(t,e,r)=>new ra(t,r).compare(new ra(e,r));na.exports=zf});var sa=B((Ub,oa)=>{"use strict";var Vf=nt(),Bf=(t,e,r)=>Vf(e,t,r);oa.exports=Bf});var aa=B((qb,ia)=>{"use strict";var Gf=nt(),Hf=(t,e)=>Gf(t,e,!0);ia.exports=Hf});var xn=B((Wb,la)=>{"use strict";var ca=Te(),Yf=(t,e,r)=>{let n=new ca(t,r),o=new ca(e,r);return n.compare(o)||n.compareBuild(o)};la.exports=Yf});var ua=B((zb,pa)=>{"use strict";var Kf=xn(),Jf=(t,e)=>t.sort((r,n)=>Kf(r,n,e));pa.exports=Jf});var ma=B((Vb,fa)=>{"use strict";var Xf=xn(),Zf=(t,e)=>t.sort((r,n)=>Xf(n,r,e));fa.exports=Zf});var Wr=B((Bb,da)=>{"use strict";var Qf=nt(),em=(t,e,r)=>Qf(t,e,r)>0;da.exports=em});var vn=B((Gb,ha)=>{"use strict";var tm=nt(),rm=(t,e,r)=>tm(t,e,r)<0;ha.exports=rm});var Ao=B((Hb,ga)=>{"use strict";var nm=nt(),om=(t,e,r)=>nm(t,e,r)===0;ga.exports=om});var xo=B((Yb,ya)=>{"use strict";var sm=nt(),im=(t,e,r)=>sm(t,e,r)!==0;ya.exports=im});var Pn=B((Kb,ba)=>{"use strict";var am=nt(),cm=(t,e,r)=>am(t,e,r)>=0;ba.exports=cm});var Rn=B((Jb,Sa)=>{"use strict";var lm=nt(),pm=(t,e,r)=>lm(t,e,r)<=0;Sa.exports=pm});var vo=B((Xb,wa)=>{"use strict";var um=Ao(),fm=xo(),mm=Wr(),dm=Pn(),hm=vn(),gm=Rn(),ym=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return um(t,r,n);case"!=":return fm(t,r,n);case">":return mm(t,r,n);case">=":return dm(t,r,n);case"<":return hm(t,r,n);case"<=":return gm(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};wa.exports=ym});var Oa=B((Zb,Ea)=>{"use strict";var bm=Te(),Sm=$t(),{safeRe:$n,t:_n}=dr(),wm=(t,e)=>{if(t instanceof bm)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?$n[_n.COERCEFULL]:$n[_n.COERCE]);else{let c=e.includePrerelease?$n[_n.COERCERTLFULL]:$n[_n.COERCERTL],p;for(;(p=c.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||p.index+p[0].length!==r.index+r[0].length)&&(r=p),c.lastIndex=p.index+p[1].length+p[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],o=r[3]||"0",s=r[4]||"0",i=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return Sm(`${n}.${o}.${s}${i}${a}`,e)};Ea.exports=wm});var Aa=B((Qb,Ca)=>{"use strict";var Em=$t(),Om=mr(),Cm=Te(),Am=(t,e,r)=>{if(!Om.RELEASE_TYPES.includes(e))return null;let n=xm(t,r);return n&&vm(n,e)},xm=(t,e)=>{let r=t instanceof Cm?t.version:t;return Em(r,e)},vm=(t,e)=>{if(Pm(e))return t.version;switch(t.prerelease=[],e){case"major":t.minor=0,t.patch=0;break;case"minor":t.patch=0;break}return t.format()},Pm=t=>t.startsWith("pre");Ca.exports=Am});var va=B((eS,xa)=>{"use strict";var Po=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let o=this.map.keys().next().value;this.delete(o)}this.map.set(e,r)}return this}};xa.exports=Po});var ot=B((tS,_a)=>{"use strict";var Rm=/\s+/g,Ro=class t{constructor(e,r){if(r=_m(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof $o)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(Rm," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(o=>!Ra(o[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&km(o[0])){this.set=[o];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(Fm,"");let n=((this.options.includePrerelease&&Lm)|(this.options.loose&&Mm))+":"+e,o=Pa.get(n);if(o)return o;let s=this.options.loose,i=s?ke[je.HYPHENRANGELOOSE]:ke[je.HYPHENRANGE];e=e.replace(i,Jm(this.options.includePrerelease)),fe("hyphen replace",e),e=e.replace(ke[je.COMPARATORTRIM],jm),fe("comparator trim",e),e=e.replace(ke[je.TILDETRIM],Dm),fe("tilde trim",e),e=e.replace(ke[je.CARETTRIM],Nm),fe("caret trim",e);let a=e.split(" ").map(l=>Um(l,this.options)).join(" ").split(/\s+/).map(l=>Km(l,this.options));s&&(a=a.filter(l=>(fe("loose invalid filter",l,this.options),!!l.match(ke[je.COMPARATORLOOSE])))),fe("range list",a);let c=new Map,p=a.map(l=>new $o(l,this.options));for(let l of p){if(Ra(l))return[l];c.set(l.value,l)}c.size>1&&c.has("")&&c.delete("");let u=[...c.values()];return Pa.set(n,u),u}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>$a(n,r)&&e.set.some(o=>$a(o,r)&&n.every(s=>o.every(i=>s.intersects(i,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new Im(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Xm(this.set[r],e,this.options))return!0;return!1}};_a.exports=Ro;var $m=va(),Pa=new $m,_m=wn(),$o=zr(),fe=qr(),Im=Te(),{safeRe:ke,src:Tm,t:je,comparatorTrimReplace:jm,tildeTrimReplace:Dm,caretTrimReplace:Nm}=dr(),{FLAG_INCLUDE_PRERELEASE:Lm,FLAG_LOOSE:Mm}=mr(),Fm=new RegExp(Tm[je.BUILD],"g"),Ra=t=>t.value==="<0.0.0-0",km=t=>t.value==="",$a=(t,e)=>{let r=!0,n=t.slice(),o=n.pop();for(;r&&n.length;)r=n.every(s=>o.intersects(s,e)),o=n.pop();return r},Um=(t,e)=>(t=t.replace(ke[je.BUILD],""),fe("comp",t,e),t=Vm(t,e),fe("caret",t),t=Wm(t,e),fe("tildes",t),t=Gm(t,e),fe("xrange",t),t=Ym(t,e),fe("stars",t),t),Ce=t=>!t||t.toLowerCase()==="x"||t==="*",qm=(t,e,r)=>Ce(t)&&!Ce(e)||Ce(e)&&r&&!Ce(r),Wm=(t,e)=>t.trim().split(/\s+/).map(r=>zm(r,e)).join(" "),zm=(t,e)=>{let r=e.loose?ke[je.TILDELOOSE]:ke[je.TILDE],n=e.includePrerelease?"-0":"";return t.replace(r,(o,s,i,a,c)=>{fe("tilde",t,o,s,i,a,c);let p;return Ce(s)?p="":Ce(i)?p=`>=${s}.0.0${n} <${+s+1}.0.0-0`:Ce(a)?p=`>=${s}.${i}.0${n} <${s}.${+i+1}.0-0`:c?(fe("replaceTilde pr",c),p=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`):p=`>=${s}.${i}.${a} <${s}.${+i+1}.0-0`,fe("tilde return",p),p})},Vm=(t,e)=>t.trim().split(/\s+/).map(r=>Bm(r,e)).join(" "),Bm=(t,e)=>{fe("caret",t,e);let r=e.loose?ke[je.CARETLOOSE]:ke[je.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,s,i,a,c)=>{fe("caret",t,o,s,i,a,c);let p;return Ce(s)?p="":Ce(i)?p=`>=${s}.0.0${n} <${+s+1}.0.0-0`:Ce(a)?s==="0"?p=`>=${s}.${i}.0${n} <${s}.${+i+1}.0-0`:p=`>=${s}.${i}.0${n} <${+s+1}.0.0-0`:c?(fe("replaceCaret pr",c),s==="0"?i==="0"?p=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:p=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:p=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`):(fe("no pr"),s==="0"?i==="0"?p=`>=${s}.${i}.${a} <${s}.${i}.${+a+1}-0`:p=`>=${s}.${i}.${a} <${s}.${+i+1}.0-0`:p=`>=${s}.${i}.${a} <${+s+1}.0.0-0`),fe("caret return",p),p})},Gm=(t,e)=>(fe("replaceXRanges",t,e),t.split(/\s+/).map(r=>Hm(r,e)).join(" ")),Hm=(t,e)=>{t=t.trim();let r=e.loose?ke[je.XRANGELOOSE]:ke[je.XRANGE];return t.replace(r,(n,o,s,i,a,c)=>{if(fe("xRange",t,n,o,s,i,a,c),qm(s,i,a))return t;let p=Ce(s),u=p||Ce(i),l=u||Ce(a),m=l;return o==="="&&m&&(o=""),c=e.includePrerelease?"-0":"",p?o===">"||o==="<"?n="<0.0.0-0":n="*":o&&m?(u&&(i=0),a=0,o===">"?(o=">=",u?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",u?s=+s+1:i=+i+1),o==="<"&&(c="-0"),n=`${o+s}.${i}.${a}${c}`):u?n=`>=${s}.0.0${c} <${+s+1}.0.0-0`:l&&(n=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),fe("xRange return",n),n})},Ym=(t,e)=>(fe("replaceStars",t,e),t.trim().replace(ke[je.STAR],"")),Km=(t,e)=>(fe("replaceGTE0",t,e),t.trim().replace(ke[e.includePrerelease?je.GTE0PRE:je.GTE0],"")),Jm=t=>(e,r,n,o,s,i,a,c,p,u,l,m)=>(Ce(n)?r="":Ce(o)?r=`>=${n}.0.0${t?"-0":""}`:Ce(s)?r=`>=${n}.${o}.0${t?"-0":""}`:i?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,Ce(p)?c="":Ce(u)?c=`<${+p+1}.0.0-0`:Ce(l)?c=`<${p}.${+u+1}.0-0`:m?c=`<=${p}.${u}.${l}-${m}`:t?c=`<${p}.${u}.${+l+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),Xm=(t,e,r)=>{for(let n=0;n<t.length;n++)if(!t[n].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let n=0;n<t.length;n++)if(fe(t[n].semver),t[n].semver!==$o.ANY&&t[n].semver.prerelease.length>0){let o=t[n].semver;if(o.major===e.major&&o.minor===e.minor&&o.patch===e.patch)return!0}return!1}return!0}});var zr=B((rS,La)=>{"use strict";var Vr=Symbol("SemVer ANY"),To=class t{static get ANY(){return Vr}constructor(e,r){if(r=Ia(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),Io("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===Vr?this.value="":this.value=this.operator+this.semver.version,Io("comp",this)}parse(e){let r=this.options.loose?Ta[ja.COMPARATORLOOSE]:Ta[ja.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new Da(n[2],this.options.loose):this.semver=Vr}toString(){return this.value}test(e){if(Io("Comparator.test",e,this.options.loose),this.semver===Vr||e===Vr)return!0;if(typeof e=="string")try{e=new Da(e,this.options)}catch{return!1}return _o(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new Na(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new Na(this.value,r).test(e.semver):(r=Ia(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||_o(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||_o(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};La.exports=To;var Ia=wn(),{safeRe:Ta,t:ja}=dr(),_o=vo(),Io=qr(),Da=Te(),Na=ot()});var Br=B((nS,Ma)=>{"use strict";var Zm=ot(),Qm=(t,e,r)=>{try{e=new Zm(e,r)}catch{return!1}return e.test(t)};Ma.exports=Qm});var ka=B((oS,Fa)=>{"use strict";var ed=ot(),td=(t,e)=>new ed(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));Fa.exports=td});var qa=B((sS,Ua)=>{"use strict";var rd=Te(),nd=ot(),od=(t,e,r)=>{let n=null,o=null,s=null;try{s=new nd(e,r)}catch{return null}return t.forEach(i=>{s.test(i)&&(!n||o.compare(i)===-1)&&(n=i,o=new rd(n,r))}),n};Ua.exports=od});var za=B((iS,Wa)=>{"use strict";var sd=Te(),id=ot(),ad=(t,e,r)=>{let n=null,o=null,s=null;try{s=new id(e,r)}catch{return null}return t.forEach(i=>{s.test(i)&&(!n||o.compare(i)===1)&&(n=i,o=new sd(n,r))}),n};Wa.exports=ad});var Ga=B((aS,Ba)=>{"use strict";var jo=Te(),cd=ot(),Va=Wr(),ld=(t,e)=>{t=new cd(t,e);let r=new jo("0.0.0");if(t.test(r)||(r=new jo("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){let o=t.set[n],s=null;o.forEach(i=>{let a=new jo(i.semver.version);switch(i.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||Va(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${i.operator}`)}}),s&&(!r||Va(r,s))&&(r=s)}return r&&t.test(r)?r:null};Ba.exports=ld});var Ya=B((cS,Ha)=>{"use strict";var pd=ot(),ud=(t,e)=>{try{return new pd(t,e).range||"*"}catch{return null}};Ha.exports=ud});var In=B((lS,Za)=>{"use strict";var fd=Te(),Xa=zr(),{ANY:md}=Xa,dd=ot(),hd=Br(),Ka=Wr(),Ja=vn(),gd=Rn(),yd=Pn(),bd=(t,e,r,n)=>{t=new fd(t,n),e=new dd(e,n);let o,s,i,a,c;switch(r){case">":o=Ka,s=gd,i=Ja,a=">",c=">=";break;case"<":o=Ja,s=yd,i=Ka,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(hd(t,e,n))return!1;for(let p=0;p<e.set.length;++p){let u=e.set[p],l=null,m=null;if(u.forEach(d=>{d.semver===md&&(d=new Xa(">=0.0.0")),l=l||d,m=m||d,o(d.semver,l.semver,n)?l=d:i(d.semver,m.semver,n)&&(m=d)}),l.operator===a||l.operator===c||(!m.operator||m.operator===a)&&s(t,m.semver))return!1;if(m.operator===c&&i(t,m.semver))return!1}return!0};Za.exports=bd});var ec=B((pS,Qa)=>{"use strict";var Sd=In(),wd=(t,e,r)=>Sd(t,e,">",r);Qa.exports=wd});var rc=B((uS,tc)=>{"use strict";var Ed=In(),Od=(t,e,r)=>Ed(t,e,"<",r);tc.exports=Od});var sc=B((fS,oc)=>{"use strict";var nc=ot(),Cd=(t,e,r)=>(t=new nc(t,r),e=new nc(e,r),t.intersects(e,r));oc.exports=Cd});var ac=B((mS,ic)=>{"use strict";var Ad=Br(),xd=nt();ic.exports=(t,e,r)=>{let n=[],o=null,s=null,i=t.sort((u,l)=>xd(u,l,r));for(let u of i)Ad(u,e,r)?(s=u,o||(o=u)):(s&&n.push([o,s]),s=null,o=null);o&&n.push([o,null]);let a=[];for(let[u,l]of n)u===l?a.push(u):!l&&u===i[0]?a.push("*"):l?u===i[0]?a.push(`<=${l}`):a.push(`${u} - ${l}`):a.push(`>=${u}`);let c=a.join(" || "),p=typeof e.raw=="string"?e.raw:String(e);return c.length<p.length?c:e}});var mc=B((dS,fc)=>{"use strict";var cc=ot(),Lo=zr(),{ANY:Do}=Lo,No=Br(),Mo=nt(),vd=(t,e,r={})=>{if(t===e)return!0;t=new cc(t,r),e=new cc(e,r);let n=!1;e:for(let o of t.set){for(let s of e.set){let i=Rd(o,s,r);if(n=n||i!==null,i)continue e}if(n)return!1}return!0},Pd=[new Lo(">=0.0.0-0")],lc=[new Lo(">=0.0.0")],Rd=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Do){if(e.length===1&&e[0].semver===Do)return!0;r.includePrerelease?t=Pd:t=lc}if(e.length===1&&e[0].semver===Do){if(r.includePrerelease)return!0;e=lc}let n=new Set,o,s;for(let d of t)d.operator===">"||d.operator===">="?o=pc(o,d,r):d.operator==="<"||d.operator==="<="?s=uc(s,d,r):n.add(d.semver);if(n.size>1)return null;let i;if(o&&s){if(i=Mo(o.semver,s.semver,r),i>0)return null;if(i===0&&(o.operator!==">="||s.operator!=="<="))return null}for(let d of n){if(o&&!No(d,String(o),r)||s&&!No(d,String(s),r))return null;for(let w of e)if(!No(d,String(w),r))return!1;return!0}let a,c,p,u,l=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,m=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;l&&l.prerelease.length===1&&s.operator==="<"&&l.prerelease[0]===0&&(l=!1);for(let d of e){if(u=u||d.operator===">"||d.operator===">=",p=p||d.operator==="<"||d.operator==="<=",o){if(m&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===m.major&&d.semver.minor===m.minor&&d.semver.patch===m.patch&&(m=!1),d.operator===">"||d.operator===">="){if(a=pc(o,d,r),a===d&&a!==o)return!1}else if(o.operator===">="&&!d.test(o.semver))return!1}if(s){if(l&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===l.major&&d.semver.minor===l.minor&&d.semver.patch===l.patch&&(l=!1),d.operator==="<"||d.operator==="<="){if(c=uc(s,d,r),c===d&&c!==s)return!1}else if(s.operator==="<="&&!d.test(s.semver))return!1}if(!d.operator&&(s||o)&&i!==0)return!1}return!(o&&p&&!s&&i!==0||s&&u&&!o&&i!==0||m||l)},pc=(t,e,r)=>{if(!t)return e;let n=Mo(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},uc=(t,e,r)=>{if(!t)return e;let n=Mo(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};fc.exports=vd});var ko=B((hS,gc)=>{"use strict";var Fo=dr(),dc=mr(),$d=Te(),hc=Eo(),_d=$t(),Id=ki(),Td=qi(),jd=Vi(),Dd=Hi(),Nd=Ki(),Ld=Xi(),Md=Qi(),Fd=ta(),kd=nt(),Ud=sa(),qd=aa(),Wd=xn(),zd=ua(),Vd=ma(),Bd=Wr(),Gd=vn(),Hd=Ao(),Yd=xo(),Kd=Pn(),Jd=Rn(),Xd=vo(),Zd=Oa(),Qd=Aa(),eh=zr(),th=ot(),rh=Br(),nh=ka(),oh=qa(),sh=za(),ih=Ga(),ah=Ya(),ch=In(),lh=ec(),ph=rc(),uh=sc(),fh=ac(),mh=mc();gc.exports={parse:_d,valid:Id,clean:Td,inc:jd,diff:Dd,major:Nd,minor:Ld,patch:Md,prerelease:Fd,compare:kd,rcompare:Ud,compareLoose:qd,compareBuild:Wd,sort:zd,rsort:Vd,gt:Bd,lt:Gd,eq:Hd,neq:Yd,gte:Kd,lte:Jd,cmp:Xd,coerce:Zd,truncate:Qd,Comparator:eh,Range:th,satisfies:rh,toComparators:nh,maxSatisfying:oh,minSatisfying:sh,minVersion:ih,validRange:ah,outside:ch,gtr:lh,ltr:ph,intersects:uh,simplifyRange:fh,subset:mh,SemVer:$d,re:Fo.re,src:Fo.src,tokens:Fo.t,SEMVER_SPEC_VERSION:dc.SEMVER_SPEC_VERSION,RELEASE_TYPES:dc.RELEASE_TYPES,compareIdentifiers:hc.compareIdentifiers,rcompareIdentifiers:hc.rcompareIdentifiers}});var bc=B((bS,dh)=>{dh.exports={name:"dotenv",version:"16.4.7",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var Vo=B((SS,Ct)=>{var qo=We("fs"),Wo=We("path"),hh=We("os"),gh=We("crypto"),yh=bc(),zo=yh.version,bh=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function Sh(t){let e={},r=t.toString();r=r.replace(/\r\n?/mg,`
|
|
9
|
-
`);let n;for(;(n=
|
|
10
|
-
`),s=s.replace(/\\r/g,"\r")),e[o]=s}return e}function
|
|
11
|
-
\u26A0\uFE0F Warning: failed to satisfy expected node version. Expected: "${t}", Current "${
|
|
8
|
+
import{a as Ki,c as Ji}from"./chunks/OFAMJNQ6.js";import{a as Li,b as Di,c as lt,d as Mi,e as Rn,f as Qe,g as Jt,h as ki,i as Fi,j as Io,k as Ui,l as Cr,m as Ie,n as _n,o as qi,p as Wi,q as zi,r as Vi,s as Xr,t as To,u as Et,v as Zr}from"./chunks/3CR6IHZV.js";import{a as In,b as Hi,c as Yi}from"./chunks/ZVUMPMHU.js";import{a as Kt,b as z}from"./chunks/3M6ARSHY.js";import{c as jn,d as Gi,f as Bi}from"./chunks/LUC2DWUK.js";import"./chunks/O6PRCLSV.js";import{a as An,b as Er,c as jo,d as Ti,e as Pn,f as Ni,g as $n,h as Jr}from"./chunks/FL3CA53Z.js";import{a as ji,c as vn,d as _o}from"./chunks/P26PQ2RU.js";import"./chunks/RS5PUOTT.js";import{a as ct,b as Ri,c as _i}from"./chunks/PVM7EVWV.js";import{a as Ii}from"./chunks/BXI4SF2U.js";import"./chunks/32XCOMOR.js";import{$ as vi,A as Ei,B as Ci,C as Oi,D as Ee,F as qe,G as fe,H as ee,I as Z,J as at,K as be,L as Ve,M as me,N as Hr,O as g,Q as wr,R as wt,T as xi,U as Ai,W as St,X as Cn,Y as Yr,_ as Kr,a as ui,aa as Sr,b as Dt,c as te,ca as Pi,d as At,da as jt,ea as On,f as fi,fa as xn,g as mi,ga as Ke,h as Sn,i as Ro,j as di,ja as $i,l as Le,la as de,n as ze,o as hi,p as En,q as De,r as gi,s as yi,t as bi,u as br,y as wi,z as Si}from"./chunks/BEOYUN4L.js";import"./chunks/NEWT5A6S.js";import{a as Ye,c as G,e as _t}from"./chunks/RFWIIJFG.js";var Or=G((Tw,Xi)=>{"use strict";var Qf="2.0.0",em=Number.MAX_SAFE_INTEGER||9007199254740991,tm=16,rm=250,nm=["major","premajor","minor","preminor","patch","prepatch","prerelease"];Xi.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:tm,MAX_SAFE_BUILD_LENGTH:rm,MAX_SAFE_INTEGER:em,RELEASE_TYPES:nm,SEMVER_SPEC_VERSION:Qf,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Qr=G((Nw,Zi)=>{"use strict";var om=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};Zi.exports=om});var xr=G((vt,Qi)=>{"use strict";var{MAX_SAFE_COMPONENT_LENGTH:No,MAX_SAFE_BUILD_LENGTH:sm,MAX_LENGTH:im}=Or(),am=Qr();vt=Qi.exports={};var cm=vt.re=[],lm=vt.safeRe=[],j=vt.src=[],pm=vt.safeSrc=[],I=vt.t={},um=0,Lo="[a-zA-Z0-9-]",fm=[["\\s",1],["\\d",im],[Lo,sm]],mm=t=>{for(let[e,r]of fm)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},Q=(t,e,r)=>{let n=mm(e),o=um++;am(t,o,e),I[t]=o,j[o]=e,pm[o]=n,cm[o]=new RegExp(e,r?"g":void 0),lm[o]=new RegExp(n,r?"g":void 0)};Q("NUMERICIDENTIFIER","0|[1-9]\\d*");Q("NUMERICIDENTIFIERLOOSE","\\d+");Q("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Lo}*`);Q("MAINVERSION",`(${j[I.NUMERICIDENTIFIER]})\\.(${j[I.NUMERICIDENTIFIER]})\\.(${j[I.NUMERICIDENTIFIER]})`);Q("MAINVERSIONLOOSE",`(${j[I.NUMERICIDENTIFIERLOOSE]})\\.(${j[I.NUMERICIDENTIFIERLOOSE]})\\.(${j[I.NUMERICIDENTIFIERLOOSE]})`);Q("PRERELEASEIDENTIFIER",`(?:${j[I.NONNUMERICIDENTIFIER]}|${j[I.NUMERICIDENTIFIER]})`);Q("PRERELEASEIDENTIFIERLOOSE",`(?:${j[I.NONNUMERICIDENTIFIER]}|${j[I.NUMERICIDENTIFIERLOOSE]})`);Q("PRERELEASE",`(?:-(${j[I.PRERELEASEIDENTIFIER]}(?:\\.${j[I.PRERELEASEIDENTIFIER]})*))`);Q("PRERELEASELOOSE",`(?:-?(${j[I.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${j[I.PRERELEASEIDENTIFIERLOOSE]})*))`);Q("BUILDIDENTIFIER",`${Lo}+`);Q("BUILD",`(?:\\+(${j[I.BUILDIDENTIFIER]}(?:\\.${j[I.BUILDIDENTIFIER]})*))`);Q("FULLPLAIN",`v?${j[I.MAINVERSION]}${j[I.PRERELEASE]}?${j[I.BUILD]}?`);Q("FULL",`^${j[I.FULLPLAIN]}$`);Q("LOOSEPLAIN",`[v=\\s]*${j[I.MAINVERSIONLOOSE]}${j[I.PRERELEASELOOSE]}?${j[I.BUILD]}?`);Q("LOOSE",`^${j[I.LOOSEPLAIN]}$`);Q("GTLT","((?:<|>)?=?)");Q("XRANGEIDENTIFIERLOOSE",`${j[I.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Q("XRANGEIDENTIFIER",`${j[I.NUMERICIDENTIFIER]}|x|X|\\*`);Q("XRANGEPLAIN",`[v=\\s]*(${j[I.XRANGEIDENTIFIER]})(?:\\.(${j[I.XRANGEIDENTIFIER]})(?:\\.(${j[I.XRANGEIDENTIFIER]})(?:${j[I.PRERELEASE]})?${j[I.BUILD]}?)?)?`);Q("XRANGEPLAINLOOSE",`[v=\\s]*(${j[I.XRANGEIDENTIFIERLOOSE]})(?:\\.(${j[I.XRANGEIDENTIFIERLOOSE]})(?:\\.(${j[I.XRANGEIDENTIFIERLOOSE]})(?:${j[I.PRERELEASELOOSE]})?${j[I.BUILD]}?)?)?`);Q("XRANGE",`^${j[I.GTLT]}\\s*${j[I.XRANGEPLAIN]}$`);Q("XRANGELOOSE",`^${j[I.GTLT]}\\s*${j[I.XRANGEPLAINLOOSE]}$`);Q("COERCEPLAIN",`(^|[^\\d])(\\d{1,${No}})(?:\\.(\\d{1,${No}}))?(?:\\.(\\d{1,${No}}))?`);Q("COERCE",`${j[I.COERCEPLAIN]}(?:$|[^\\d])`);Q("COERCEFULL",j[I.COERCEPLAIN]+`(?:${j[I.PRERELEASE]})?(?:${j[I.BUILD]})?(?:$|[^\\d])`);Q("COERCERTL",j[I.COERCE],!0);Q("COERCERTLFULL",j[I.COERCEFULL],!0);Q("LONETILDE","(?:~>?)");Q("TILDETRIM",`(\\s*)${j[I.LONETILDE]}\\s+`,!0);vt.tildeTrimReplace="$1~";Q("TILDE",`^${j[I.LONETILDE]}${j[I.XRANGEPLAIN]}$`);Q("TILDELOOSE",`^${j[I.LONETILDE]}${j[I.XRANGEPLAINLOOSE]}$`);Q("LONECARET","(?:\\^)");Q("CARETTRIM",`(\\s*)${j[I.LONECARET]}\\s+`,!0);vt.caretTrimReplace="$1^";Q("CARET",`^${j[I.LONECARET]}${j[I.XRANGEPLAIN]}$`);Q("CARETLOOSE",`^${j[I.LONECARET]}${j[I.XRANGEPLAINLOOSE]}$`);Q("COMPARATORLOOSE",`^${j[I.GTLT]}\\s*(${j[I.LOOSEPLAIN]})$|^$`);Q("COMPARATOR",`^${j[I.GTLT]}\\s*(${j[I.FULLPLAIN]})$|^$`);Q("COMPARATORTRIM",`(\\s*)${j[I.GTLT]}\\s*(${j[I.LOOSEPLAIN]}|${j[I.XRANGEPLAIN]})`,!0);vt.comparatorTrimReplace="$1$2$3";Q("HYPHENRANGE",`^\\s*(${j[I.XRANGEPLAIN]})\\s+-\\s+(${j[I.XRANGEPLAIN]})\\s*$`);Q("HYPHENRANGELOOSE",`^\\s*(${j[I.XRANGEPLAINLOOSE]})\\s+-\\s+(${j[I.XRANGEPLAINLOOSE]})\\s*$`);Q("STAR","(<|>)?=?\\s*\\*");Q("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Q("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Tn=G((Lw,ea)=>{"use strict";var dm=Object.freeze({loose:!0}),hm=Object.freeze({}),gm=t=>t?typeof t!="object"?dm:t:hm;ea.exports=gm});var Do=G((Dw,na)=>{"use strict";var ta=/^[0-9]+$/,ra=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t===e?0:t<e?-1:1;let r=ta.test(t),n=ta.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},ym=(t,e)=>ra(e,t);na.exports={compareIdentifiers:ra,rcompareIdentifiers:ym}});var Me=G((Mw,sa)=>{"use strict";var Nn=Qr(),{MAX_LENGTH:oa,MAX_SAFE_INTEGER:Ln}=Or(),{safeRe:Dn,t:Mn}=xr(),bm=Tn(),{compareIdentifiers:Mo}=Do(),wm=(t,e)=>{let r=e.split(".");if(r.length>t.length)return!1;for(let n=0;n<r.length;n++)if(Mo(t[n],r[n])!==0)return!1;return!0},ko=class t{constructor(e,r){if(r=bm(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>oa)throw new TypeError(`version is longer than ${oa} characters`);Nn("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?Dn[Mn.LOOSE]:Dn[Mn.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Ln||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Ln||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Ln||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(o=>{if(/^[0-9]+$/.test(o)){let s=+o;if(s>=0&&s<Ln)return s}return o}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(Nn("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],o=e.prerelease[r];if(Nn("prerelease compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return Mo(n,o)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],o=e.build[r];if(Nn("build compare",r,n,o),n===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(n===void 0)return-1;if(n===o)continue;return Mo(n,o)}while(++r)}inc(e,r,n){if(e.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){let o=`-${r}`.match(this.options.loose?Dn[Mn.PRERELEASELOOSE]:Dn[Mn.PRERELEASE]);if(!o||o[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let o=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[o];else{let s=this.prerelease.length;for(;--s>=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(o)}}if(r){let s=[r,o];if(n===!1&&(s=[r]),wm(this.prerelease,r)){let i=this.prerelease[r.split(".").length];isNaN(i)&&(this.prerelease=s)}else this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};sa.exports=ko});var Mt=G((kw,aa)=>{"use strict";var ia=Me(),Sm=(t,e,r=!1)=>{if(t instanceof ia)return t;try{return new ia(t,e)}catch(n){if(!r)return null;throw n}};aa.exports=Sm});var la=G((Fw,ca)=>{"use strict";var Em=Mt(),Cm=(t,e)=>{let r=Em(t,e);return r?r.version:null};ca.exports=Cm});var ua=G((Uw,pa)=>{"use strict";var Om=Mt(),xm=(t,e)=>{let r=Om(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};pa.exports=xm});var da=G((qw,ma)=>{"use strict";var fa=Me(),Am=(t,e,r,n,o)=>{typeof r=="string"&&(o=n,n=r,r=void 0);try{return new fa(t instanceof fa?t.version:t,r).inc(e,n,o).version}catch{return null}};ma.exports=Am});var ya=G((Ww,ga)=>{"use strict";var ha=Mt(),vm=(t,e)=>{let r=ha(t,null,!0),n=ha(e,null,!0),o=r.compare(n);if(o===0)return null;let s=o>0,i=s?r:n,a=s?n:r,c=!!i.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(i)===0)return a.minor&&!a.patch?"minor":"patch"}let u=c?"pre":"";return r.major!==n.major?u+"major":r.minor!==n.minor?u+"minor":r.patch!==n.patch?u+"patch":"prerelease"};ga.exports=vm});var wa=G((zw,ba)=>{"use strict";var Pm=Me(),$m=(t,e)=>new Pm(t,e).major;ba.exports=$m});var Ea=G((Vw,Sa)=>{"use strict";var Rm=Me(),_m=(t,e)=>new Rm(t,e).minor;Sa.exports=_m});var Oa=G((Gw,Ca)=>{"use strict";var jm=Me(),Im=(t,e)=>new jm(t,e).patch;Ca.exports=Im});var Aa=G((Bw,xa)=>{"use strict";var Tm=Mt(),Nm=(t,e)=>{let r=Tm(t,e);return r&&r.prerelease.length?r.prerelease:null};xa.exports=Nm});var pt=G((Hw,Pa)=>{"use strict";var va=Me(),Lm=(t,e,r)=>new va(t,r).compare(new va(e,r));Pa.exports=Lm});var Ra=G((Yw,$a)=>{"use strict";var Dm=pt(),Mm=(t,e,r)=>Dm(e,t,r);$a.exports=Mm});var ja=G((Kw,_a)=>{"use strict";var km=pt(),Fm=(t,e)=>km(t,e,!0);_a.exports=Fm});var kn=G((Jw,Ta)=>{"use strict";var Ia=Me(),Um=(t,e,r)=>{let n=new Ia(t,r),o=new Ia(e,r);return n.compare(o)||n.compareBuild(o)};Ta.exports=Um});var La=G((Xw,Na)=>{"use strict";var qm=kn(),Wm=(t,e)=>t.sort((r,n)=>qm(r,n,e));Na.exports=Wm});var Ma=G((Zw,Da)=>{"use strict";var zm=kn(),Vm=(t,e)=>t.sort((r,n)=>zm(n,r,e));Da.exports=Vm});var en=G((Qw,ka)=>{"use strict";var Gm=pt(),Bm=(t,e,r)=>Gm(t,e,r)>0;ka.exports=Bm});var Fn=G((eS,Fa)=>{"use strict";var Hm=pt(),Ym=(t,e,r)=>Hm(t,e,r)<0;Fa.exports=Ym});var Fo=G((tS,Ua)=>{"use strict";var Km=pt(),Jm=(t,e,r)=>Km(t,e,r)===0;Ua.exports=Jm});var Uo=G((rS,qa)=>{"use strict";var Xm=pt(),Zm=(t,e,r)=>Xm(t,e,r)!==0;qa.exports=Zm});var Un=G((nS,Wa)=>{"use strict";var Qm=pt(),ed=(t,e,r)=>Qm(t,e,r)>=0;Wa.exports=ed});var qn=G((oS,za)=>{"use strict";var td=pt(),rd=(t,e,r)=>td(t,e,r)<=0;za.exports=rd});var qo=G((sS,Va)=>{"use strict";var nd=Fo(),od=Uo(),sd=en(),id=Un(),ad=Fn(),cd=qn(),ld=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return nd(t,r,n);case"!=":return od(t,r,n);case">":return sd(t,r,n);case">=":return id(t,r,n);case"<":return ad(t,r,n);case"<=":return cd(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};Va.exports=ld});var Ba=G((iS,Ga)=>{"use strict";var pd=Me(),ud=Mt(),{safeRe:Wn,t:zn}=xr(),fd=(t,e)=>{if(t instanceof pd)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?Wn[zn.COERCEFULL]:Wn[zn.COERCE]);else{let c=e.includePrerelease?Wn[zn.COERCERTLFULL]:Wn[zn.COERCERTL],l;for(;(l=c.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||l.index+l[0].length!==r.index+r[0].length)&&(r=l),c.lastIndex=l.index+l[1].length+l[2].length;c.lastIndex=-1}if(r===null)return null;let n=r[2],o=r[3]||"0",s=r[4]||"0",i=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return ud(`${n}.${o}.${s}${i}${a}`,e)};Ga.exports=fd});var Ya=G((aS,Ha)=>{"use strict";var md=Mt(),dd=Or(),hd=Me(),gd=(t,e,r)=>{if(!dd.RELEASE_TYPES.includes(e))return null;let n=yd(t,r);return n&&bd(n,e)},yd=(t,e)=>{let r=t instanceof hd?t.version:t;return md(r,e)},bd=(t,e)=>{if(wd(e))return t.version;switch(t.prerelease=[],e){case"major":t.minor=0,t.patch=0;break;case"minor":t.patch=0;break}return t.format()},wd=t=>t.startsWith("pre");Ha.exports=gd});var Ja=G((cS,Ka)=>{"use strict";var Wo=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let o=this.map.keys().next().value;this.delete(o)}this.map.set(e,r)}return this}};Ka.exports=Wo});var ut=G((lS,ec)=>{"use strict";var Sd=/\s+/g,zo=class t{constructor(e,r){if(r=Cd(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof Vo)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(Sd," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(o=>!Za(o[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let o of this.set)if(o.length===1&&jd(o[0])){this.set=[o];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(_d,"");let n=((this.options.includePrerelease&&$d)|(this.options.loose&&Rd))+":"+e,o=Xa.get(n);if(o)return o;let s=this.options.loose,i=s?Ge[ke.HYPHENRANGELOOSE]:Ge[ke.HYPHENRANGE];e=e.replace(i,Wd(this.options.includePrerelease)),he("hyphen replace",e),e=e.replace(Ge[ke.COMPARATORTRIM],Ad),he("comparator trim",e),e=e.replace(Ge[ke.TILDETRIM],vd),he("tilde trim",e),e=e.replace(Ge[ke.CARETTRIM],Pd),he("caret trim",e);let a=e.split(" ").map(p=>Id(p,this.options)).join(" ").split(/\s+/).map(p=>qd(p,this.options));s&&(a=a.filter(p=>(he("loose invalid filter",p,this.options),!!p.match(Ge[ke.COMPARATORLOOSE])))),he("range list",a);let c=new Map,l=a.map(p=>new Vo(p,this.options));for(let p of l){if(Za(p))return[p];c.set(p.value,p)}c.size>1&&c.has("")&&c.delete("");let u=[...c.values()];return Xa.set(n,u),u}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>Qa(n,r)&&e.set.some(o=>Qa(o,r)&&n.every(s=>o.every(i=>s.intersects(i,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new Od(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(zd(this.set[r],e,this.options))return!0;return!1}};ec.exports=zo;var Ed=Ja(),Xa=new Ed,Cd=Tn(),Vo=tn(),he=Qr(),Od=Me(),{safeRe:Ge,src:xd,t:ke,comparatorTrimReplace:Ad,tildeTrimReplace:vd,caretTrimReplace:Pd}=xr(),{FLAG_INCLUDE_PRERELEASE:$d,FLAG_LOOSE:Rd}=Or(),_d=new RegExp(xd[ke.BUILD],"g"),Za=t=>t.value==="<0.0.0-0",jd=t=>t.value==="",Qa=(t,e)=>{let r=!0,n=t.slice(),o=n.pop();for(;r&&n.length;)r=n.every(s=>o.intersects(s,e)),o=n.pop();return r},Id=(t,e)=>(t=t.replace(Ge[ke.BUILD],""),he("comp",t,e),t=Dd(t,e),he("caret",t),t=Nd(t,e),he("tildes",t),t=kd(t,e),he("xrange",t),t=Ud(t,e),he("stars",t),t),$e=t=>!t||t.toLowerCase()==="x"||t==="*",Td=(t,e,r)=>$e(t)&&!$e(e)||$e(e)&&r&&!$e(r),Nd=(t,e)=>t.trim().split(/\s+/).map(r=>Ld(r,e)).join(" "),Ld=(t,e)=>{let r=e.loose?Ge[ke.TILDELOOSE]:Ge[ke.TILDE],n=e.includePrerelease?"-0":"";return t.replace(r,(o,s,i,a,c)=>{he("tilde",t,o,s,i,a,c);let l;return $e(s)?l="":$e(i)?l=`>=${s}.0.0${n} <${+s+1}.0.0-0`:$e(a)?l=`>=${s}.${i}.0${n} <${s}.${+i+1}.0-0`:c?(he("replaceTilde pr",c),l=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`):l=`>=${s}.${i}.${a} <${s}.${+i+1}.0-0`,he("tilde return",l),l})},Dd=(t,e)=>t.trim().split(/\s+/).map(r=>Md(r,e)).join(" "),Md=(t,e)=>{he("caret",t,e);let r=e.loose?Ge[ke.CARETLOOSE]:Ge[ke.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(o,s,i,a,c)=>{he("caret",t,o,s,i,a,c);let l;return $e(s)?l="":$e(i)?l=`>=${s}.0.0${n} <${+s+1}.0.0-0`:$e(a)?s==="0"?l=`>=${s}.${i}.0${n} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.0${n} <${+s+1}.0.0-0`:c?(he("replaceCaret pr",c),s==="0"?i==="0"?l=`>=${s}.${i}.${a}-${c} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a}-${c} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a}-${c} <${+s+1}.0.0-0`):(he("no pr"),s==="0"?i==="0"?l=`>=${s}.${i}.${a} <${s}.${i}.${+a+1}-0`:l=`>=${s}.${i}.${a} <${s}.${+i+1}.0-0`:l=`>=${s}.${i}.${a} <${+s+1}.0.0-0`),he("caret return",l),l})},kd=(t,e)=>(he("replaceXRanges",t,e),t.split(/\s+/).map(r=>Fd(r,e)).join(" ")),Fd=(t,e)=>{t=t.trim();let r=e.loose?Ge[ke.XRANGELOOSE]:Ge[ke.XRANGE];return t.replace(r,(n,o,s,i,a,c)=>{if(he("xRange",t,n,o,s,i,a,c),Td(s,i,a))return t;let l=$e(s),u=l||$e(i),p=u||$e(a),m=p;return o==="="&&m&&(o=""),c=e.includePrerelease?"-0":"",l?o===">"||o==="<"?n="<0.0.0-0":n="*":o&&m?(u&&(i=0),a=0,o===">"?(o=">=",u?(s=+s+1,i=0,a=0):(i=+i+1,a=0)):o==="<="&&(o="<",u?s=+s+1:i=+i+1),o==="<"&&(c="-0"),n=`${o+s}.${i}.${a}${c}`):u?n=`>=${s}.0.0${c} <${+s+1}.0.0-0`:p&&(n=`>=${s}.${i}.0${c} <${s}.${+i+1}.0-0`),he("xRange return",n),n})},Ud=(t,e)=>(he("replaceStars",t,e),t.trim().replace(Ge[ke.STAR],"")),qd=(t,e)=>(he("replaceGTE0",t,e),t.trim().replace(Ge[e.includePrerelease?ke.GTE0PRE:ke.GTE0],"")),Wd=t=>(e,r,n,o,s,i,a,c,l,u,p,m)=>($e(n)?r="":$e(o)?r=`>=${n}.0.0${t?"-0":""}`:$e(s)?r=`>=${n}.${o}.0${t?"-0":""}`:i?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,$e(l)?c="":$e(u)?c=`<${+l+1}.0.0-0`:$e(p)?c=`<${l}.${+u+1}.0-0`:m?c=`<=${l}.${u}.${p}-${m}`:t?c=`<${l}.${u}.${+p+1}-0`:c=`<=${c}`,`${r} ${c}`.trim()),zd=(t,e,r)=>{for(let n=0;n<t.length;n++)if(!t[n].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let n=0;n<t.length;n++)if(he(t[n].semver),t[n].semver!==Vo.ANY&&t[n].semver.prerelease.length>0){let o=t[n].semver;if(o.major===e.major&&o.minor===e.minor&&o.patch===e.patch)return!0}return!1}return!0}});var tn=G((pS,ic)=>{"use strict";var rn=Symbol("SemVer ANY"),Ho=class t{static get ANY(){return rn}constructor(e,r){if(r=tc(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),Bo("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===rn?this.value="":this.value=this.operator+this.semver.version,Bo("comp",this)}parse(e){let r=this.options.loose?rc[nc.COMPARATORLOOSE]:rc[nc.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new oc(n[2],this.options.loose):this.semver=rn}toString(){return this.value}test(e){if(Bo("Comparator.test",e,this.options.loose),this.semver===rn||e===rn)return!0;if(typeof e=="string")try{e=new oc(e,this.options)}catch{return!1}return Go(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new sc(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new sc(this.value,r).test(e.semver):(r=tc(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||Go(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||Go(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};ic.exports=Ho;var tc=Tn(),{safeRe:rc,t:nc}=xr(),Go=qo(),Bo=Qr(),oc=Me(),sc=ut()});var nn=G((uS,ac)=>{"use strict";var Vd=ut(),Gd=(t,e,r)=>{try{e=new Vd(e,r)}catch{return!1}return e.test(t)};ac.exports=Gd});var lc=G((fS,cc)=>{"use strict";var Bd=ut(),Hd=(t,e)=>new Bd(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));cc.exports=Hd});var uc=G((mS,pc)=>{"use strict";var Yd=Me(),Kd=ut(),Jd=(t,e,r)=>{let n=null,o=null,s=null;try{s=new Kd(e,r)}catch{return null}return t.forEach(i=>{s.test(i)&&(!n||o.compare(i)===-1)&&(n=i,o=new Yd(n,r))}),n};pc.exports=Jd});var mc=G((dS,fc)=>{"use strict";var Xd=Me(),Zd=ut(),Qd=(t,e,r)=>{let n=null,o=null,s=null;try{s=new Zd(e,r)}catch{return null}return t.forEach(i=>{s.test(i)&&(!n||o.compare(i)===1)&&(n=i,o=new Xd(n,r))}),n};fc.exports=Qd});var gc=G((hS,hc)=>{"use strict";var Yo=Me(),eh=ut(),dc=en(),th=(t,e)=>{t=new eh(t,e);let r=new Yo("0.0.0");if(t.test(r)||(r=new Yo("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){let o=t.set[n],s=null;o.forEach(i=>{let a=new Yo(i.semver.version);switch(i.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||dc(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${i.operator}`)}}),s&&(!r||dc(r,s))&&(r=s)}return r&&t.test(r)?r:null};hc.exports=th});var bc=G((gS,yc)=>{"use strict";var rh=ut(),nh=(t,e)=>{try{return new rh(t,e).range||"*"}catch{return null}};yc.exports=nh});var Vn=G((yS,Cc)=>{"use strict";var oh=Me(),Ec=tn(),{ANY:sh}=Ec,ih=ut(),ah=nn(),wc=en(),Sc=Fn(),ch=qn(),lh=Un(),ph=(t,e,r,n)=>{t=new oh(t,n),e=new ih(e,n);let o,s,i,a,c;switch(r){case">":o=wc,s=ch,i=Sc,a=">",c=">=";break;case"<":o=Sc,s=lh,i=wc,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(ah(t,e,n))return!1;for(let l=0;l<e.set.length;++l){let u=e.set[l],p=null,m=null;if(u.forEach(d=>{d.semver===sh&&(d=new Ec(">=0.0.0")),p=p||d,m=m||d,o(d.semver,p.semver,n)?p=d:i(d.semver,m.semver,n)&&(m=d)}),p.operator===a||p.operator===c||(!m.operator||m.operator===a)&&s(t,m.semver))return!1;if(m.operator===c&&i(t,m.semver))return!1}return!0};Cc.exports=ph});var xc=G((bS,Oc)=>{"use strict";var uh=Vn(),fh=(t,e,r)=>uh(t,e,">",r);Oc.exports=fh});var vc=G((wS,Ac)=>{"use strict";var mh=Vn(),dh=(t,e,r)=>mh(t,e,"<",r);Ac.exports=dh});var Rc=G((SS,$c)=>{"use strict";var Pc=ut(),hh=(t,e,r)=>(t=new Pc(t,r),e=new Pc(e,r),t.intersects(e,r));$c.exports=hh});var jc=G((ES,_c)=>{"use strict";var gh=nn(),yh=pt();_c.exports=(t,e,r)=>{let n=[],o=null,s=null,i=t.sort((u,p)=>yh(u,p,r));for(let u of i)gh(u,e,r)?(s=u,o||(o=u)):(s&&n.push([o,s]),s=null,o=null);o&&n.push([o,null]);let a=[];for(let[u,p]of n)u===p?a.push(u):!p&&u===i[0]?a.push("*"):p?u===i[0]?a.push(`<=${p}`):a.push(`${u} - ${p}`):a.push(`>=${u}`);let c=a.join(" || "),l=typeof e.raw=="string"?e.raw:String(e);return c.length<l.length?c:e}});var Mc=G((CS,Dc)=>{"use strict";var Ic=ut(),Xo=tn(),{ANY:Ko}=Xo,Jo=nn(),Zo=pt(),bh=(t,e,r={})=>{if(t===e)return!0;t=new Ic(t,r),e=new Ic(e,r);let n=!1;e:for(let o of t.set){for(let s of e.set){let i=Sh(o,s,r);if(n=n||i!==null,i)continue e}if(n)return!1}return!0},wh=[new Xo(">=0.0.0-0")],Tc=[new Xo(">=0.0.0")],Sh=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Ko){if(e.length===1&&e[0].semver===Ko)return!0;r.includePrerelease?t=wh:t=Tc}if(e.length===1&&e[0].semver===Ko){if(r.includePrerelease)return!0;e=Tc}let n=new Set,o,s;for(let d of t)d.operator===">"||d.operator===">="?o=Nc(o,d,r):d.operator==="<"||d.operator==="<="?s=Lc(s,d,r):n.add(d.semver);if(n.size>1)return null;let i;if(o&&s){if(i=Zo(o.semver,s.semver,r),i>0)return null;if(i===0&&(o.operator!==">="||s.operator!=="<="))return null}for(let d of n){if(o&&!Jo(d,String(o),r)||s&&!Jo(d,String(s),r))return null;for(let b of e)if(!Jo(d,String(b),r))return!1;return!0}let a,c,l,u,p=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,m=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1;p&&p.prerelease.length===1&&s.operator==="<"&&p.prerelease[0]===0&&(p=!1);for(let d of e){if(u=u||d.operator===">"||d.operator===">=",l=l||d.operator==="<"||d.operator==="<=",o){if(m&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===m.major&&d.semver.minor===m.minor&&d.semver.patch===m.patch&&(m=!1),d.operator===">"||d.operator===">="){if(a=Nc(o,d,r),a===d&&a!==o)return!1}else if(o.operator===">="&&!d.test(o.semver))return!1}if(s){if(p&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===p.major&&d.semver.minor===p.minor&&d.semver.patch===p.patch&&(p=!1),d.operator==="<"||d.operator==="<="){if(c=Lc(s,d,r),c===d&&c!==s)return!1}else if(s.operator==="<="&&!d.test(s.semver))return!1}if(!d.operator&&(s||o)&&i!==0)return!1}return!(o&&l&&!s&&i!==0||s&&u&&!o&&i!==0||m||p)},Nc=(t,e,r)=>{if(!t)return e;let n=Zo(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},Lc=(t,e,r)=>{if(!t)return e;let n=Zo(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};Dc.exports=bh});var Gn=G((OS,Uc)=>{"use strict";var Qo=xr(),kc=Or(),Eh=Me(),Fc=Do(),Ch=Mt(),Oh=la(),xh=ua(),Ah=da(),vh=ya(),Ph=wa(),$h=Ea(),Rh=Oa(),_h=Aa(),jh=pt(),Ih=Ra(),Th=ja(),Nh=kn(),Lh=La(),Dh=Ma(),Mh=en(),kh=Fn(),Fh=Fo(),Uh=Uo(),qh=Un(),Wh=qn(),zh=qo(),Vh=Ba(),Gh=Ya(),Bh=tn(),Hh=ut(),Yh=nn(),Kh=lc(),Jh=uc(),Xh=mc(),Zh=gc(),Qh=bc(),eg=Vn(),tg=xc(),rg=vc(),ng=Rc(),og=jc(),sg=Mc();Uc.exports={parse:Ch,valid:Oh,clean:xh,inc:Ah,diff:vh,major:Ph,minor:$h,patch:Rh,prerelease:_h,compare:jh,rcompare:Ih,compareLoose:Th,compareBuild:Nh,sort:Lh,rsort:Dh,gt:Mh,lt:kh,eq:Fh,neq:Uh,gte:qh,lte:Wh,cmp:zh,coerce:Vh,truncate:Gh,Comparator:Bh,Range:Hh,satisfies:Yh,toComparators:Kh,maxSatisfying:Jh,minSatisfying:Xh,minVersion:Zh,validRange:Qh,outside:eg,gtr:tg,ltr:rg,intersects:ng,simplifyRange:og,subset:sg,SemVer:Eh,re:Qo.re,src:Qo.src,tokens:Qo.t,SEMVER_SPEC_VERSION:kc.SEMVER_SPEC_VERSION,RELEASE_TYPES:kc.RELEASE_TYPES,compareIdentifiers:Fc.compareIdentifiers,rcompareIdentifiers:Fc.rcompareIdentifiers}});var Wc=G((vS,ig)=>{ig.exports={name:"dotenv",version:"16.4.7",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var os=G((PS,It)=>{var ts=Ye("fs"),rs=Ye("path"),ag=Ye("os"),cg=Ye("crypto"),lg=Wc(),ns=lg.version,pg=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function ug(t){let e={},r=t.toString();r=r.replace(/\r\n?/mg,`
|
|
9
|
+
`);let n;for(;(n=pg.exec(r))!=null;){let o=n[1],s=n[2]||"";s=s.trim();let i=s[0];s=s.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),i==='"'&&(s=s.replace(/\\n/g,`
|
|
10
|
+
`),s=s.replace(/\\r/g,"\r")),e[o]=s}return e}function fg(t){let e=Gc(t),r=Re.configDotenv({path:e});if(!r.parsed){let i=new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);throw i.code="MISSING_DATA",i}let n=Vc(t).split(","),o=n.length,s;for(let i=0;i<o;i++)try{let a=n[i].trim(),c=hg(r,a);s=Re.decrypt(c.ciphertext,c.key);break}catch(a){if(i+1>=o)throw a}return Re.parse(s)}function mg(t){console.log(`[dotenv@${ns}][INFO] ${t}`)}function dg(t){console.log(`[dotenv@${ns}][WARN] ${t}`)}function Bn(t){console.log(`[dotenv@${ns}][DEBUG] ${t}`)}function Vc(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function hg(t,e){let r;try{r=new URL(e)}catch(a){if(a.code==="ERR_INVALID_URL"){let c=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw c.code="INVALID_DOTENV_KEY",c}throw a}let n=r.password;if(!n){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let o=r.searchParams.get("environment");if(!o){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let s=`DOTENV_VAULT_${o.toUpperCase()}`,i=t.parsed[s];if(!i){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${s} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:i,key:n}}function Gc(t){let e=null;if(t&&t.path&&t.path.length>0)if(Array.isArray(t.path))for(let r of t.path)ts.existsSync(r)&&(e=r.endsWith(".vault")?r:`${r}.vault`);else e=t.path.endsWith(".vault")?t.path:`${t.path}.vault`;else e=rs.resolve(process.cwd(),".env.vault");return ts.existsSync(e)?e:null}function zc(t){return t[0]==="~"?rs.join(ag.homedir(),t.slice(1)):t}function gg(t){mg("Loading env from encrypted .env.vault");let e=Re._parseVault(t),r=process.env;return t&&t.processEnv!=null&&(r=t.processEnv),Re.populate(r,e,t),{parsed:e}}function yg(t){let e=rs.resolve(process.cwd(),".env"),r="utf8",n=!!(t&&t.debug);t&&t.encoding?r=t.encoding:n&&Bn("No encoding is specified. UTF-8 is used by default");let o=[e];if(t&&t.path)if(!Array.isArray(t.path))o=[zc(t.path)];else{o=[];for(let c of t.path)o.push(zc(c))}let s,i={};for(let c of o)try{let l=Re.parse(ts.readFileSync(c,{encoding:r}));Re.populate(i,l,t)}catch(l){n&&Bn(`Failed to load ${c} ${l.message}`),s=l}let a=process.env;return t&&t.processEnv!=null&&(a=t.processEnv),Re.populate(a,i,t),s?{parsed:i,error:s}:{parsed:i}}function bg(t){if(Vc(t).length===0)return Re.configDotenv(t);let e=Gc(t);return e?Re._configVault(t):(dg(`You set DOTENV_KEY but you are missing a .env.vault file at ${e}. Did you forget to build it?`),Re.configDotenv(t))}function wg(t,e){let r=Buffer.from(e.slice(-64),"hex"),n=Buffer.from(t,"base64"),o=n.subarray(0,12),s=n.subarray(-16);n=n.subarray(12,-16);try{let i=cg.createDecipheriv("aes-256-gcm",r,o);return i.setAuthTag(s),`${i.update(n)}${i.final()}`}catch(i){let a=i instanceof RangeError,c=i.message==="Invalid key length",l=i.message==="Unsupported state or unable to authenticate data";if(a||c){let u=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw u.code="INVALID_DOTENV_KEY",u}else if(l){let u=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw u.code="DECRYPTION_FAILED",u}else throw i}}function Sg(t,e,r={}){let n=!!(r&&r.debug),o=!!(r&&r.override);if(typeof e!="object"){let s=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw s.code="OBJECT_REQUIRED",s}for(let s of Object.keys(e))Object.prototype.hasOwnProperty.call(t,s)?(o===!0&&(t[s]=e[s]),n&&Bn(o===!0?`"${s}" is already defined and WAS overwritten`:`"${s}" is already defined and was NOT overwritten`)):t[s]=e[s]}var Re={configDotenv:yg,_configVault:gg,_parseVault:fg,config:bg,decrypt:wg,parse:ug,populate:Sg};It.exports.configDotenv=Re.configDotenv;It.exports._configVault=Re._configVault;It.exports._parseVault=Re._parseVault;It.exports.config=Re.config;It.exports.decrypt=Re.decrypt;It.exports.parse=Re.parse;It.exports.populate=Re.populate;It.exports=Re});var Xp=G(Hs=>{"use strict";Hs.parse=ab;Hs.serialize=cb;var tb=Object.prototype.toString,rb=Object.prototype.hasOwnProperty,nb=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,ob=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,sb=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,ib=/^[\u0020-\u003A\u003D-\u007E]*$/;function ab(t,e){if(typeof t!="string")throw new TypeError("argument str must be a string");var r={},n=t.length;if(n<2)return r;var o=e&&e.decode||lb,s=0,i=0,a=0;do{if(i=t.indexOf("=",s),i===-1)break;if(a=t.indexOf(";",s),a===-1)a=n;else if(i>a){s=t.lastIndexOf(";",i-1)+1;continue}var c=Kp(t,s,i),l=Jp(t,i,c),u=t.slice(c,l);if(!rb.call(r,u)){var p=Kp(t,i+1,a),m=Jp(t,a,p);t.charCodeAt(p)===34&&t.charCodeAt(m-1)===34&&(p++,m--);var d=t.slice(p,m);r[u]=ub(d,o)}s=a+1}while(s<n);return r}function Kp(t,e,r){do{var n=t.charCodeAt(e);if(n!==32&&n!==9)return e}while(++e<r);return r}function Jp(t,e,r){for(;e>r;){var n=t.charCodeAt(--e);if(n!==32&&n!==9)return e+1}return r}function cb(t,e,r){var n=r&&r.encode||encodeURIComponent;if(typeof n!="function")throw new TypeError("option encode is invalid");if(!nb.test(t))throw new TypeError("argument name is invalid");var o=n(e);if(!ob.test(o))throw new TypeError("argument val is invalid");var s=t+"="+o;if(!r)return s;if(r.maxAge!=null){var i=Math.floor(r.maxAge);if(!isFinite(i))throw new TypeError("option maxAge is invalid");s+="; Max-Age="+i}if(r.domain){if(!sb.test(r.domain))throw new TypeError("option domain is invalid");s+="; Domain="+r.domain}if(r.path){if(!ib.test(r.path))throw new TypeError("option path is invalid");s+="; Path="+r.path}if(r.expires){var a=r.expires;if(!pb(a)||isNaN(a.valueOf()))throw new TypeError("option expires is invalid");s+="; Expires="+a.toUTCString()}if(r.httpOnly&&(s+="; HttpOnly"),r.secure&&(s+="; Secure"),r.partitioned&&(s+="; Partitioned"),r.priority){var c=typeof r.priority=="string"?r.priority.toLowerCase():r.priority;switch(c){case"low":s+="; Priority=Low";break;case"medium":s+="; Priority=Medium";break;case"high":s+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(r.sameSite){var l=typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite;switch(l){case!0:s+="; SameSite=Strict";break;case"lax":s+="; SameSite=Lax";break;case"strict":s+="; SameSite=Strict";break;case"none":s+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return s}function lb(t){return t.indexOf("%")!==-1?decodeURIComponent(t):t}function pb(t){return tb.call(t)==="[object Date]"}function ub(t,e){try{return e(t)}catch{return t}}});var tu=G((xA,hn)=>{"use strict";var uo={decodeValues:!0,map:!1,silent:!1};function Ys(t){return typeof t=="string"&&!!t.trim()}function Ks(t,e){var r=t.split(";").filter(Ys),n=r.shift(),o=fb(n),s=o.name,i=o.value;e=e?Object.assign({},uo,e):uo;try{i=e.decodeValues?decodeURIComponent(i):i}catch(c){console.error("set-cookie-parser encountered an error while decoding a cookie with value '"+i+"'. Set options.decodeValues to false to disable this feature.",c)}var a={name:s,value:i};return r.forEach(function(c){var l=c.split("="),u=l.shift().trimLeft().toLowerCase(),p=l.join("=");u==="expires"?a.expires=new Date(p):u==="max-age"?a.maxAge=parseInt(p,10):u==="secure"?a.secure=!0:u==="httponly"?a.httpOnly=!0:u==="samesite"?a.sameSite=p:u==="partitioned"?a.partitioned=!0:a[u]=p}),a}function fb(t){var e="",r="",n=t.split("=");return n.length>1?(e=n.shift(),r=n.join("=")):r=t,{name:e,value:r}}function eu(t,e){if(e=e?Object.assign({},uo,e):uo,!t)return e.map?{}:[];if(t.headers)if(typeof t.headers.getSetCookie=="function")t=t.headers.getSetCookie();else if(t.headers["set-cookie"])t=t.headers["set-cookie"];else{var r=t.headers[Object.keys(t.headers).find(function(o){return o.toLowerCase()==="set-cookie"})];!r&&t.headers.cookie&&!e.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),t=r}if(Array.isArray(t)||(t=[t]),e.map){var n={};return t.filter(Ys).reduce(function(o,s){var i=Ks(s,e);return o[i.name]=i,o},n)}else return t.filter(Ys).map(function(o){return Ks(o,e)})}function mb(t){if(Array.isArray(t))return t;if(typeof t!="string")return[];var e=[],r=0,n,o,s,i,a;function c(){for(;r<t.length&&/\s/.test(t.charAt(r));)r+=1;return r<t.length}function l(){return o=t.charAt(r),o!=="="&&o!==";"&&o!==","}for(;r<t.length;){for(n=r,a=!1;c();)if(o=t.charAt(r),o===","){for(s=r,r+=1,c(),i=r;r<t.length&&l();)r+=1;r<t.length&&t.charAt(r)==="="?(a=!0,r=i,e.push(t.substring(n,s)),n=r):r=s+1}else r+=1;(!a||r>=t.length)&&e.push(t.substring(n,t.length))}return e}hn.exports=eu;hn.exports.parse=eu;hn.exports.parseString=Ks;hn.exports.splitCookiesString=mb});var qc=_t(Gn(),1);import*as es from"node:process";try{let t=_i?.node;typeof t=="string"&&!qc.satisfies(es.version,t)&&g.warn(`
|
|
11
|
+
\u26A0\uFE0F Warning: failed to satisfy expected node version. Expected: "${t}", Current "${es.version}"
|
|
12
12
|
|
|
13
|
-
`)}catch{}var
|
|
14
|
-
`).map(o=>o.split(" ")),n=0;return r.forEach(o=>{o.length>1&&
|
|
15
|
-
`)}rowToString(e,r){return this.rasterize(e).forEach((n,o)=>{let s="";n.forEach((i,a)=>{let{width:c}=e[a],
|
|
13
|
+
`)}catch{}var Xf=_t(os(),1);import*as Zf from"node:path";import{notStrictEqual as Vg,strictEqual as Gg}from"assert";var Eg={right:vg,center:Pg},Cg=0,Hn=1,Og=2,Yn=3,ss=class{constructor(e){var r;this.width=e.width,this.wrap=(r=e.wrap)!==null&&r!==void 0?r:!0,this.rows=[]}span(...e){let r=this.div(...e);r.span=!0}resetOutput(){this.rows=[]}div(...e){if(e.length===0&&this.div(""),this.wrap&&this.shouldApplyLayoutDSL(...e)&&typeof e[0]=="string")return this.applyLayoutDSL(e[0]);let r=e.map(n=>typeof n=="string"?this.colFromString(n):n);return this.rows.push(r),r}shouldApplyLayoutDSL(...e){return e.length===1&&typeof e[0]=="string"&&/[\t\n]/.test(e[0])}applyLayoutDSL(e){let r=e.split(`
|
|
14
|
+
`).map(o=>o.split(" ")),n=0;return r.forEach(o=>{o.length>1&&et.stringWidth(o[0])>n&&(n=Math.min(Math.floor(this.width*.5),et.stringWidth(o[0])))}),r.forEach(o=>{this.div(...o.map((s,i)=>({text:s.trim(),padding:this.measurePadding(s),width:i===0&&o.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(e){return{text:e,padding:this.measurePadding(e)}}measurePadding(e){let r=et.stripAnsi(e);return[0,r.match(/\s*$/)[0].length,0,r.match(/^\s*/)[0].length]}toString(){let e=[];return this.rows.forEach(r=>{this.rowToString(r,e)}),e.filter(r=>!r.hidden).map(r=>r.text).join(`
|
|
15
|
+
`)}rowToString(e,r){return this.rasterize(e).forEach((n,o)=>{let s="";n.forEach((i,a)=>{let{width:c}=e[a],l=this.negatePadding(e[a]),u=i;if(l>et.stringWidth(i)&&(u+=" ".repeat(l-et.stringWidth(i))),e[a].align&&e[a].align!=="left"&&this.wrap){let m=Eg[e[a].align];u=m(u,l),et.stringWidth(u)<l&&(u+=" ".repeat((c||0)-et.stringWidth(u)-1))}let p=e[a].padding||[0,0,0,0];p[Yn]&&(s+=" ".repeat(p[Yn])),s+=Bc(e[a],u,"| "),s+=u,s+=Bc(e[a],u," |"),p[Hn]&&(s+=" ".repeat(p[Hn])),o===0&&r.length>0&&(s=this.renderInline(s,r[r.length-1]))}),r.push({text:s.replace(/ +$/,""),span:e.span})}),r}renderInline(e,r){let n=e.match(/^ */),o=n?n[0].length:0,s=r.text,i=et.stringWidth(s.trimRight());return r.span?this.wrap?o<i?e:(r.hidden=!0,s.trimRight()+" ".repeat(o-i)+e.trimLeft()):(r.hidden=!0,s+e):e}rasterize(e){let r=[],n=this.columnWidths(e),o;return e.forEach((s,i)=>{s.width=n[i],this.wrap?o=et.wrap(s.text,this.negatePadding(s),{hard:!0}).split(`
|
|
16
16
|
`):o=s.text.split(`
|
|
17
|
-
`),s.border&&(o.unshift("."+"-".repeat(this.negatePadding(s)+2)+"."),o.push("'"+"-".repeat(this.negatePadding(s)+2)+"'")),s.padding&&(o.unshift(...new Array(s.padding[
|
|
18
|
-
`),o+=t.charAt(s);return r&&n&&(o=`${r}${o}${n}`),o}function Ho(t){return Cc(t,{stringWidth:e=>[...e].length,stripAnsi:Go,wrap:xc})}import{dirname as vc,resolve as Pc}from"path";import{readdirSync as Lh,statSync as Mh}from"fs";function Rc(t,e){let r=Pc(".",t),n;for(Mh(r).isDirectory()||(r=vc(r));;){if(n=e(r,Lh(r)),n)return Pc(r,n);if(r=vc(n=r),n===r)break}}import{inspect as eg}from"util";import{readFileSync as tg}from"fs";import{fileURLToPath as Uc}from"url";import{format as kh}from"util";import{readFileSync as Uh}from"fs";import{normalize as qh,resolve as Wh}from"path";function zt(t){if(t!==t.toLowerCase()&&t!==t.toUpperCase()||(t=t.toLowerCase()),t.indexOf("-")===-1&&t.indexOf("_")===-1)return t;{let r="",n=!1,o=t.match(/^-+/);for(let s=o?o[0].length:0;s<t.length;s++){let i=t.charAt(s);n&&(n=!1,i=i.toUpperCase()),s!==0&&(i==="-"||i==="_")?n=!0:i!=="-"&&i!=="_"&&(r+=i)}return r}}function Nn(t,e){let r=t.toLowerCase();e=e||"-";let n="";for(let o=0;o<t.length;o++){let s=r.charAt(o),i=t.charAt(o);s!==i&&o>0?n+=`${e}${r.charAt(o)}`:n+=i}return n}function Ln(t){return t==null?!1:typeof t=="number"||/^0x[0-9a-f]+$/i.test(t)?!0:/^0[^.]/.test(t)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(t)}function $c(t){if(Array.isArray(t))return t.map(i=>typeof i!="string"?i+"":i);t=t.trim();let e=0,r=null,n=null,o=null,s=[];for(let i=0;i<t.length;i++){if(r=n,n=t.charAt(i),n===" "&&!o){r!==" "&&e++;continue}n===o?o=null:(n==="'"||n==='"')&&!o&&(o=n),s[e]||(s[e]=""),s[e]+=n}return s}var st;(function(t){t.BOOLEAN="boolean",t.STRING="string",t.NUMBER="number",t.ARRAY="array"})(st||(st={}));var At,Mn=class{constructor(e){At=e}parse(e,r){let n=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},r),o=$c(e),s=Fh(Object.assign(Object.create(null),n.alias)),i=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},n.configuration),a=Object.assign(Object.create(null),n.default),c=n.configObjects||[],p=n.envPrefix,u=i["populate--"],l=u?"--":"_",m=Object.create(null),d=Object.create(null),w=n.__||At.format,h={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},x=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,C=new RegExp("^--"+i["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(g){let b=typeof g=="object"?g.key:g,$=Object.keys(g).map(function(A){return{boolean:"bools",string:"strings",number:"numbers"}[A]}).filter(Boolean).pop();$&&(h[$][b]=!0),h.arrays[b]=!0,h.keys.push(b)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(g){h.bools[g]=!0,h.keys.push(g)}),[].concat(n.string||[]).filter(Boolean).forEach(function(g){h.strings[g]=!0,h.keys.push(g)}),[].concat(n.number||[]).filter(Boolean).forEach(function(g){h.numbers[g]=!0,h.keys.push(g)}),[].concat(n.count||[]).filter(Boolean).forEach(function(g){h.counts[g]=!0,h.keys.push(g)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(g){h.normalize[g]=!0,h.keys.push(g)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([g,b])=>{typeof b=="number"&&(h.nargs[g]=b,h.keys.push(g))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([g,b])=>{typeof b=="function"&&(h.coercions[g]=b,h.keys.push(g))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(g){h.configs[g]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([g,b])=>{(typeof b=="boolean"||typeof b=="function")&&(h.configs[g]=b)})),Ze(n.key,s,n.default,h.arrays),Object.keys(a).forEach(function(g){(h.aliases[g]||[]).forEach(function(b){a[b]=a[g]})});let O=null;fo();let v=[],E=Object.assign(Object.create(null),{_:[]}),R={};for(let g=0;g<o.length;g++){let b=o[g],$=b.replace(/^-{3,}/,"---"),A,S,D,N,G,ve;if(b!=="--"&&ae(b))I(b);else if($.match(/---+(=|$)/)){I(b);continue}else if(b.match(/^--.+=/)||!i["short-option-groups"]&&b.match(/^-.+=/))N=b.match(/^--?([^=]+)=([\s\S]*)$/),N!==null&&Array.isArray(N)&&N.length>=3&&(V(N[1],h.arrays)?g=ne(g,N[1],o,N[2]):V(N[1],h.nargs)!==!1?g=Y(g,N[1],o,N[2]):z(N[1],N[2]));else if(b.match(C)&&i["boolean-negation"])N=b.match(C),N!==null&&Array.isArray(N)&&N.length>=2&&(S=N[1],z(S,V(S,h.arrays)?[!1]:!1));else if(b.match(/^--.+/)||!i["short-option-groups"]&&b.match(/^-[^-]+/))N=b.match(/^--?(.+)/),N!==null&&Array.isArray(N)&&N.length>=2&&(S=N[1],V(S,h.arrays)?g=ne(g,S,o):V(S,h.nargs)!==!1?g=Y(g,S,o):(G=o[g+1],G!==void 0&&(!G.match(/^-/)||G.match(x))&&!V(S,h.bools)&&!V(S,h.counts)||/^(true|false)$/.test(G)?(z(S,G),g++):z(S,ie(S))));else if(b.match(/^-.\..+=/))N=b.match(/^-([^=]+)=([\s\S]*)$/),N!==null&&Array.isArray(N)&&N.length>=3&&z(N[1],N[2]);else if(b.match(/^-.\..+/)&&!b.match(x))G=o[g+1],N=b.match(/^-(.\..+)/),N!==null&&Array.isArray(N)&&N.length>=2&&(S=N[1],G!==void 0&&!G.match(/^-/)&&!V(S,h.bools)&&!V(S,h.counts)?(z(S,G),g++):z(S,ie(S)));else if(b.match(/^-[^-]+/)&&!b.match(x)){D=b.slice(1,-1).split(""),A=!1;for(let Le=0;Le<D.length;Le++){if(G=b.slice(Le+2),D[Le+1]&&D[Le+1]==="="){ve=b.slice(Le+3),S=D[Le],V(S,h.arrays)?g=ne(g,S,o,ve):V(S,h.nargs)!==!1?g=Y(g,S,o,ve):z(S,ve),A=!0;break}if(G==="-"){z(D[Le],G);continue}if(/[A-Za-z]/.test(D[Le])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(G)&&V(G,h.bools)===!1){z(D[Le],G),A=!0;break}if(D[Le+1]&&D[Le+1].match(/\W/)){z(D[Le],G),A=!0;break}else z(D[Le],ie(D[Le]))}S=b.slice(-1)[0],!A&&S!=="-"&&(V(S,h.arrays)?g=ne(g,S,o):V(S,h.nargs)!==!1?g=Y(g,S,o):(G=o[g+1],G!==void 0&&(!/^(-|--)[^-]/.test(G)||G.match(x))&&!V(S,h.bools)&&!V(S,h.counts)||/^(true|false)$/.test(G)?(z(S,G),g++):z(S,ie(S))))}else if(b.match(/^-[0-9]$/)&&b.match(x)&&V(b.slice(1),h.bools))S=b.slice(1),z(S,ie(S));else if(b==="--"){v=o.slice(g+1);break}else if(i["halt-at-non-option"]){v=o.slice(g);break}else I(b)}te(E,!0),te(E,!1),M(E),oe(),$e(E,h.aliases,a,!0),K(E),i["set-placeholder-key"]&&ce(E),Object.keys(h.counts).forEach(function(g){le(E,g.split("."))||z(g,0)}),u&&v.length&&(E[l]=[]),v.forEach(function(g){E[l].push(g)}),i["camel-case-expansion"]&&i["strip-dashed"]&&Object.keys(E).filter(g=>g!=="--"&&g.includes("-")).forEach(g=>{delete E[g]}),i["strip-aliased"]&&[].concat(...Object.keys(s).map(g=>s[g])).forEach(g=>{i["camel-case-expansion"]&&g.includes("-")&&delete E[g.split(".").map(b=>zt(b)).join(".")],delete E[g]});function I(g){let b=P("_",g);(typeof b=="string"||typeof b=="number")&&E._.push(b)}function Y(g,b,$,A){let S,D=V(b,h.nargs);if(D=typeof D!="number"||isNaN(D)?1:D,D===0)return Oe(A)||(O=Error(w("Argument unexpected for: %s",b))),z(b,ie(b)),g;let N=Oe(A)?0:1;if(i["nargs-eats-options"])$.length-(g+1)+N<D&&(O=Error(w("Not enough arguments following: %s",b))),N=D;else{for(S=g+1;S<$.length&&(!$[S].match(/^-[^0-9]/)||$[S].match(x)||ae($[S]));S++)N++;N<D&&(O=Error(w("Not enough arguments following: %s",b)))}let G=Math.min(N,D);for(!Oe(A)&&G>0&&(z(b,A),G--),S=g+1;S<G+g+1;S++)z(b,$[S]);return g+G}function ne(g,b,$,A){let S=[],D=A||$[g+1],N=V(b,h.nargs);if(V(b,h.bools)&&!/^(true|false)$/.test(D))S.push(!0);else if(Oe(D)||Oe(A)&&/^-/.test(D)&&!x.test(D)&&!ae(D)){if(a[b]!==void 0){let G=a[b];S=Array.isArray(G)?G:[G]}}else{Oe(A)||S.push(_(b,A));for(let G=g+1;G<$.length&&!(!i["greedy-arrays"]&&S.length>0||N&&typeof N=="number"&&S.length>=N||(D=$[G],/^-/.test(D)&&!x.test(D)&&!ae(D)));G++)g=G,S.push(_(b,D))}return typeof N=="number"&&(N&&S.length<N||isNaN(N)&&S.length===0)&&(O=Error(w("Not enough arguments following: %s",b))),z(b,S),g}function z(g,b){if(/-/.test(g)&&i["camel-case-expansion"]){let S=g.split(".").map(function(D){return zt(D)}).join(".");De(g,S)}let $=_(g,b),A=g.split(".");Ge(E,A,$),h.aliases[g]&&h.aliases[g].forEach(function(S){let D=S.split(".");Ge(E,D,$)}),A.length>1&&i["dot-notation"]&&(h.aliases[A[0]]||[]).forEach(function(S){let D=S.split("."),N=[].concat(A);N.shift(),D=D.concat(N),(h.aliases[g]||[]).includes(D.join("."))||Ge(E,D,$)}),V(g,h.normalize)&&!V(g,h.arrays)&&[g].concat(h.aliases[g]||[]).forEach(function(D){Object.defineProperty(R,D,{enumerable:!0,get(){return b},set(N){b=typeof N=="string"?At.normalize(N):N}})})}function De(g,b){h.aliases[g]&&h.aliases[g].length||(h.aliases[g]=[b],m[b]=!0),h.aliases[b]&&h.aliases[b].length||De(b,g)}function _(g,b){typeof b=="string"&&(b[0]==="'"||b[0]==='"')&&b[b.length-1]===b[0]&&(b=b.substring(1,b.length-1)),(V(g,h.bools)||V(g,h.counts))&&typeof b=="string"&&(b=b==="true");let $=Array.isArray(b)?b.map(function(A){return P(g,A)}):P(g,b);return V(g,h.counts)&&(Oe($)||typeof $=="boolean")&&($=Yo()),V(g,h.normalize)&&V(g,h.arrays)&&(Array.isArray(b)?$=b.map(A=>At.normalize(A)):$=At.normalize(b)),$}function P(g,b){return!i["parse-positional-numbers"]&&g==="_"||!V(g,h.strings)&&!V(g,h.bools)&&!Array.isArray(b)&&(Ln(b)&&i["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${b}`)))||!Oe(b)&&V(g,h.numbers))&&(b=Number(b)),b}function M(g){let b=Object.create(null);$e(b,h.aliases,a),Object.keys(h.configs).forEach(function($){let A=g[$]||b[$];if(A)try{let S=null,D=At.resolve(At.cwd(),A),N=h.configs[$];if(typeof N=="function"){try{S=N(D)}catch(G){S=G}if(S instanceof Error){O=S;return}}else S=At.require(D);U(S)}catch(S){S.name==="PermissionDenied"?O=S:g[$]&&(O=Error(w("Invalid JSON config file: %s",A)))}})}function U(g,b){Object.keys(g).forEach(function($){let A=g[$],S=b?b+"."+$:$;typeof A=="object"&&A!==null&&!Array.isArray(A)&&i["dot-notation"]?U(A,S):(!le(E,S.split("."))||V(S,h.arrays)&&i["combine-arrays"])&&z(S,A)})}function oe(){typeof c<"u"&&c.forEach(function(g){U(g)})}function te(g,b){if(typeof p>"u")return;let $=typeof p=="string"?p:"",A=At.env();Object.keys(A).forEach(function(S){if($===""||S.lastIndexOf($,0)===0){let D=S.split("__").map(function(N,G){return G===0&&(N=N.substring($.length)),zt(N)});(b&&h.configs[D.join(".")]||!b)&&!le(g,D)&&z(D.join("."),A[S])}})}function K(g){let b,$=new Set;Object.keys(g).forEach(function(A){if(!$.has(A)&&(b=V(A,h.coercions),typeof b=="function"))try{let S=P(A,b(g[A]));[].concat(h.aliases[A]||[],A).forEach(D=>{$.add(D),g[D]=S})}catch(S){O=S}})}function ce(g){return h.keys.forEach(b=>{~b.indexOf(".")||typeof g[b]>"u"&&(g[b]=void 0)}),g}function $e(g,b,$,A=!1){Object.keys($).forEach(function(S){le(g,S.split("."))||(Ge(g,S.split("."),$[S]),A&&(d[S]=!0),(b[S]||[]).forEach(function(D){le(g,D.split("."))||Ge(g,D.split("."),$[S])}))})}function le(g,b){let $=g;i["dot-notation"]||(b=[b.join(".")]),b.slice(0,-1).forEach(function(S){$=$[S]||{}});let A=b[b.length-1];return typeof $!="object"?!1:A in $}function Ge(g,b,$){let A=g;i["dot-notation"]||(b=[b.join(".")]),b.slice(0,-1).forEach(function(ve){ve=_c(ve),typeof A=="object"&&A[ve]===void 0&&(A[ve]={}),typeof A[ve]!="object"||Array.isArray(A[ve])?(Array.isArray(A[ve])?A[ve].push({}):A[ve]=[A[ve],{}],A=A[ve][A[ve].length-1]):A=A[ve]});let S=_c(b[b.length-1]),D=V(b.join("."),h.arrays),N=Array.isArray($),G=i["duplicate-arguments-array"];!G&&V(S,h.nargs)&&(G=!0,(!Oe(A[S])&&h.nargs[S]===1||Array.isArray(A[S])&&A[S].length===h.nargs[S])&&(A[S]=void 0)),$===Yo()?A[S]=Yo(A[S]):Array.isArray(A[S])?G&&D&&N?A[S]=i["flatten-duplicate-arrays"]?A[S].concat($):(Array.isArray(A[S][0])?A[S]:[A[S]]).concat([$]):!G&&!!D==!!N?A[S]=$:A[S]=A[S].concat([$]):A[S]===void 0&&D?A[S]=N?$:[$]:G&&!(A[S]===void 0||V(S,h.counts)||V(S,h.bools))?A[S]=[A[S],$]:A[S]=$}function Ze(...g){g.forEach(function(b){Object.keys(b||{}).forEach(function($){h.aliases[$]||(h.aliases[$]=[].concat(s[$]||[]),h.aliases[$].concat($).forEach(function(A){if(/-/.test(A)&&i["camel-case-expansion"]){let S=zt(A);S!==$&&h.aliases[$].indexOf(S)===-1&&(h.aliases[$].push(S),m[S]=!0)}}),h.aliases[$].concat($).forEach(function(A){if(A.length>1&&/[A-Z]/.test(A)&&i["camel-case-expansion"]){let S=Nn(A,"-");S!==$&&h.aliases[$].indexOf(S)===-1&&(h.aliases[$].push(S),m[S]=!0)}}),h.aliases[$].forEach(function(A){h.aliases[A]=[$].concat(h.aliases[$].filter(function(S){return A!==S}))}))})})}function V(g,b){let $=[].concat(h.aliases[g]||[],g),A=Object.keys(b),S=$.find(D=>A.includes(D));return S?b[S]:!1}function xe(g){let b=Object.keys(h);return[].concat(b.map(A=>h[A])).some(function(A){return Array.isArray(A)?A.includes(g):A[g]})}function Qe(g,...b){return[].concat(...b).some(function(A){let S=g.match(A);return S&&xe(S[1])})}function k(g){if(g.match(x)||!g.match(/^-[^-]+/))return!1;let b=!0,$,A=g.slice(1).split("");for(let S=0;S<A.length;S++){if($=g.slice(S+2),!xe(A[S])){b=!1;break}if(A[S+1]&&A[S+1]==="="||$==="-"||/[A-Za-z]/.test(A[S])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test($)||A[S+1]&&A[S+1].match(/\W/))break}return b}function ae(g){return i["unknown-options-as-args"]&&se(g)}function se(g){return g=g.replace(/^-{3,}/,"--"),g.match(x)||k(g)?!1:!Qe(g,/^-+([^=]+?)=[\s\S]*$/,C,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function ie(g){return!V(g,h.bools)&&!V(g,h.counts)&&`${g}`in a?a[g]:Ee(qe(g))}function Ee(g){return{[st.BOOLEAN]:!0,[st.STRING]:"",[st.NUMBER]:void 0,[st.ARRAY]:[]}[g]}function qe(g){let b=st.BOOLEAN;return V(g,h.strings)?b=st.STRING:V(g,h.numbers)?b=st.NUMBER:V(g,h.bools)?b=st.BOOLEAN:V(g,h.arrays)&&(b=st.ARRAY),b}function Oe(g){return g===void 0}function fo(){Object.keys(h.counts).find(g=>V(g,h.arrays)?(O=Error(w("Invalid configuration: %s, opts.count excludes opts.array.",g)),!0):V(g,h.nargs)?(O=Error(w("Invalid configuration: %s, opts.count excludes opts.narg.",g)),!0):!1)}return{aliases:Object.assign({},h.aliases),argv:Object.assign(R,E),configuration:i,defaulted:Object.assign({},d),error:O,newAliases:Object.assign({},m)}}};function Fh(t){let e=[],r=Object.create(null),n=!0;for(Object.keys(t).forEach(function(o){e.push([].concat(t[o],o))});n;){n=!1;for(let o=0;o<e.length;o++)for(let s=o+1;s<e.length;s++)if(e[o].filter(function(a){return e[s].indexOf(a)!==-1}).length){e[o]=e[o].concat(e[s]),e.splice(s,1),n=!0;break}}return e.forEach(function(o){o=o.filter(function(i,a,c){return c.indexOf(i)===a});let s=o.pop();s!==void 0&&typeof s=="string"&&(r[s]=o)}),r}function Yo(t){return t!==void 0?t+1:1}function _c(t){return t==="__proto__"?"___proto___":t}var Ic=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):10;if(process&&process.version&&Number(process.version.match(/v([^.]+)/)[1])<Ic)throw Error(`yargs parser supports a minimum Node.js version of ${Ic}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var zh=process?process.env:{},Tc=new Mn({cwd:process.cwd,env:()=>zh,format:kh,normalize:qh,resolve:Wh,require:t=>{if(typeof We<"u")return We(t);if(t.match(/\.json$/))return Uh(t,"utf8");throw Error("only .json config files are supported in ESM")}}),Gr=function(e,r){return Tc.parse(e.slice(),r).argv};Gr.detailed=function(t,e){return Tc.parse(t.slice(),e)};Gr.camelCase=zt;Gr.decamelize=Nn;Gr.looksLikeNumber=Ln;var Ko=Gr;import{basename as rg,dirname as ng,extname as og,relative as sg,resolve as Fc}from"path";function jc(){return Vh()?0:1}function Vh(){return Bh()&&!process.defaultApp}function Bh(){return!!process.versions.electron}function Jo(t){return t.slice(jc()+1)}function Dc(){return process.argv[jc()]}var me=class t extends Error{constructor(e){super(e||"yargs error"),this.name="YError",Error.captureStackTrace(this,t)}};import{readFileSync as Gh,statSync as Hh,writeFile as Yh}from"fs";import{format as Kh}from"util";import{resolve as Jh}from"path";var Nc={fs:{readFileSync:Gh,writeFile:Yh},format:Kh,resolve:Jh,exists:t=>{try{return Hh(t).isFile()}catch{return!1}}};var dt,Xo=class{constructor(e){e=e||{},this.directory=e.directory||"./locales",this.updateFiles=typeof e.updateFiles=="boolean"?e.updateFiles:!0,this.locale=e.locale||"en",this.fallbackToLanguage=typeof e.fallbackToLanguage=="boolean"?e.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...e){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);let r=e.shift(),n=function(){};return typeof e[e.length-1]=="function"&&(n=e.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][r]&&this.updateFiles?(this.cache[this.locale][r]=r,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),dt.format.apply(dt.format,[this.cache[this.locale][r]||r].concat(e))}__n(){let e=Array.prototype.slice.call(arguments),r=e.shift(),n=e.shift(),o=e.shift(),s=function(){};typeof e[e.length-1]=="function"&&(s=e.pop()),this.cache[this.locale]||this._readLocaleFile();let i=o===1?r:n;this.cache[this.locale][r]&&(i=this.cache[this.locale][r][o===1?"one":"other"]),!this.cache[this.locale][r]&&this.updateFiles?(this.cache[this.locale][r]={one:r,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:s})):s();let a=[i];return~i.indexOf("%d")&&a.push(o),dt.format.apply(dt.format,a.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){this.cache[this.locale]||this._readLocaleFile();for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this.cache[this.locale][r]=e[r])}_taggedLiteral(e,...r){let n="";return e.forEach(function(o,s){let i=r[s+1];n+=o,typeof i<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(r,1)))}_enqueueWrite(e){this.writeQueue.push(e),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let e=this,r=this.writeQueue[0],n=r.directory,o=r.locale,s=r.cb,i=this._resolveLocaleFile(n,o),a=JSON.stringify(this.cache[o],null,2);dt.fs.writeFile(i,a,"utf-8",function(c){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),s(c)})}_readLocaleFile(){let e={},r=this._resolveLocaleFile(this.directory,this.locale);try{dt.fs.readFileSync&&(e=JSON.parse(dt.fs.readFileSync(r,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+r),n.code==="ENOENT")e={};else throw n}this.cache[this.locale]=e}_resolveLocaleFile(e,r){let n=dt.resolve(e,"./",r+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~r.lastIndexOf("_")){let o=dt.resolve(e,"./",r.split("_")[0]+".json");this._fileExistsSync(o)&&(n=o)}return n}_fileExistsSync(e){return dt.exists(e)}};function Lc(t,e){dt=e;let r=new Xo(t);return{__:r.__.bind(r),__n:r.__n.bind(r),setLocale:r.setLocale.bind(r),getLocale:r.getLocale.bind(r),updateLocale:r.updateLocale.bind(r),locale:r.locale}}var Xh=t=>Lc(t,Nc),Mc=Xh;var ig="require is not supported by ESM",kc="loading a directory of commands is not supported yet for ESM",ag=Uc(import.meta.url).split("node_modules")[0],cg=Uc(import.meta.url),Zo={assert:{notStrictEqual:Zh,strictEqual:Qh},cliui:Ho,findUp:Rc,getEnv:t=>process.env[t],inspect:eg,getCallerFile:()=>{throw new me(kc)},getProcessArgvBin:Dc,mainFilename:ag||process.cwd(),Parser:Ko,path:{basename:rg,dirname:ng,extname:og,relative:sg,resolve:Fc},process:{argv:()=>process.argv,cwd:process.cwd,execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:tg,require:()=>{throw new me(ig)},requireDirectory:()=>{throw new me(kc)},stringWidth:t=>[...t].length,y18n:Mc({directory:Fc(cg,"../../../locales"),updateFiles:!1})};function Ue(t,e,r,n){r.assert.notStrictEqual(t,e,n)}function Qo(t,e){e.assert.strictEqual(typeof t,"string")}function hr(t){return Object.keys(t)}function he(t){return!!t&&!!t.then&&typeof t.then=="function"}function _t(t){let r=t.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,o=r.shift();if(!o)throw new Error(`No command found in: ${t}`);let s={cmd:o.replace(n,""),demanded:[],optional:[]};return r.forEach((i,a)=>{let c=!1;i=i.replace(/\s/g,""),/\.+[\]>]/.test(i)&&a===r.length-1&&(c=!0),/^\[/.test(i)?s.optional.push({cmd:i.replace(n,"").split("|"),variadic:c}):s.demanded.push({cmd:i.replace(n,"").split("|"),variadic:c})}),s}var lg=["first","second","third","fourth","fifth","sixth"];function L(t,e,r){function n(){return typeof t=="object"?[{demanded:[],optional:[]},t,e]:[_t(`cmd ${t}`),e,r]}try{let o=0,[s,i,a]=n(),c=[].slice.call(i);for(;c.length&&c[c.length-1]===void 0;)c.pop();let p=a||c.length;if(p<s.demanded.length)throw new me(`Not enough arguments provided. Expected ${s.demanded.length} but received ${c.length}.`);let u=s.demanded.length+s.optional.length;if(p>u)throw new me(`Too many arguments provided. Expected max ${u} but received ${p}.`);s.demanded.forEach(l=>{let m=c.shift(),d=qc(m);l.cmd.filter(h=>h===d||h==="*").length===0&&Wc(d,l.cmd,o),o+=1}),s.optional.forEach(l=>{if(c.length===0)return;let m=c.shift(),d=qc(m);l.cmd.filter(h=>h===d||h==="*").length===0&&Wc(d,l.cmd,o),o+=1})}catch(o){console.warn(o.stack)}}function qc(t){return Array.isArray(t)?"array":t===null?"null":typeof t}function Wc(t,e,r){throw new me(`Invalid ${lg[r]||"manyith"} argument. Expected ${e.join(" or ")} but received ${t}.`)}var Fn=class{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,r,n=!0){if(L("<array|function> [boolean] [boolean]",[e,r,n],arguments.length),Array.isArray(e)){for(let o=0;o<e.length;o++){if(typeof e[o]!="function")throw Error("middleware must be a function");let s=e[o];s.applyBeforeValidation=r,s.global=n}Array.prototype.push.apply(this.globalMiddleware,e)}else if(typeof e=="function"){let o=e;o.applyBeforeValidation=r,o.global=n,this.globalMiddleware.push(e)}return this.yargs}addCoerceMiddleware(e,r){let n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(o=>{let s=[...n[r]||[],r];return o.option?!s.includes(o.option):!0}),e.option=r,this.addMiddleware(e,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let e=this.frozens.pop();e!==void 0&&(this.globalMiddleware=e)}reset(){this.globalMiddleware=this.globalMiddleware.filter(e=>e.global)}};function zc(t){return t?t.map(e=>(e.applyBeforeValidation=!1,e)):[]}function Vt(t,e,r,n){return r.reduce((o,s)=>{if(s.applyBeforeValidation!==n)return o;if(he(o))return o.then(i=>Promise.all([i,s(i,e)])).then(([i,a])=>Object.assign(i,a));{let i=s(o,e);return he(i)?i.then(a=>Object.assign(o,a)):Object.assign(o,i)}},t)}function Bt(t,e,r=n=>{throw n}){try{let n=pg(t)?t():t;return he(n)?n.then(o=>e(o)):e(n)}catch(n){return r(n)}}function pg(t){return typeof t=="function"}function es(t){if(typeof We>"u")return null;for(let e=0,r=Object.keys(We.cache),n;e<r.length;e++)if(n=We.cache[r[e]],n.exports===t)return n;return null}var gr=/(^\*)|(^\$0)/,ts=class{constructor(e,r,n,o){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=o,this.usage=e,this.globalMiddleware=n,this.validation=r}addDirectory(e,r,n,o){o=o||{},typeof o.recurse!="boolean"&&(o.recurse=!1),Array.isArray(o.extensions)||(o.extensions=["js"]);let s=typeof o.visit=="function"?o.visit:i=>i;o.visit=(i,a,c)=>{let p=s(i,a,c);if(p){if(this.requireCache.has(a))return p;this.requireCache.add(a),this.addHandler(p)}return p},this.shim.requireDirectory({require:r,filename:n},e,o)}addHandler(e,r,n,o,s,i){let a=[],c=zc(s);if(o=o||(()=>{}),Array.isArray(e))if(ug(e))[e,...a]=e;else for(let p of e)this.addHandler(p);else if(mg(e)){let p=Array.isArray(e.command)||typeof e.command=="string"?e.command:this.moduleName(e);e.aliases&&(p=[].concat(p).concat(e.aliases)),this.addHandler(p,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(Vc(n)){this.addHandler([e].concat(a),r,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof e=="string"){let p=_t(e);a=a.map(m=>_t(m).cmd);let u=!1,l=[p.cmd].concat(a).filter(m=>gr.test(m)?(u=!0,!1):!0);l.length===0&&u&&l.push("$0"),u&&(p.cmd=l[0],a=l.slice(1),e=e.replace(gr,p.cmd)),a.forEach(m=>{this.aliasMap[m]=p.cmd}),r!==!1&&this.usage.command(e,r,u,a,i),this.handlers[p.cmd]={original:e,description:r,handler:o,builder:n||{},middlewares:c,deprecated:i,demanded:p.demanded,optional:p.optional},u&&(this.defaultCommand=this.handlers[p.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,r,n,o,s,i){let a=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,c=r.getInternalMethods().getContext(),p=c.commands.slice(),u=!e;e&&(c.commands.push(e),c.fullCommands.push(a.original));let l=this.applyBuilderUpdateUsageAndParse(u,a,r,n.aliases,p,o,s,i);return he(l)?l.then(m=>this.applyMiddlewareAndGetResult(u,a,m.innerArgv,c,s,m.aliases,r)):this.applyMiddlewareAndGetResult(u,a,l.innerArgv,c,s,l.aliases,r)}applyBuilderUpdateUsageAndParse(e,r,n,o,s,i,a,c){let p=r.builder,u=n;if(kn(p)){let l=p(n.getInternalMethods().reset(o),c);if(he(l))return l.then(m=>(u=Gc(m)?m:n,this.parseAndUpdateUsage(e,r,u,s,i,a)))}else fg(p)&&(u=n.getInternalMethods().reset(o),Object.keys(r.builder).forEach(l=>{u.option(l,p[l])}));return this.parseAndUpdateUsage(e,r,u,s,i,a)}parseAndUpdateUsage(e,r,n,o,s,i){e&&n.getInternalMethods().getUsageInstance().unfreeze(),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(o,r),r.description);let a=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,s,i);return he(a)?a.then(c=>({aliases:n.parsed.aliases,innerArgv:c})):{aliases:n.parsed.aliases,innerArgv:a}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,r){let n=gr.test(r.original)?r.original.replace(gr,"").trim():r.original,o=e.filter(s=>!gr.test(s));return o.push(n),`$0 ${o.join(" ")}`}applyMiddlewareAndGetResult(e,r,n,o,s,i,a){let c={};if(s)return n;a.getInternalMethods().getHasOutput()||(c=this.populatePositionals(r,n,o,a));let p=this.globalMiddleware.getMiddleware().slice(0).concat(r.middlewares);if(n=Vt(n,a,p,!0),!a.getInternalMethods().getHasOutput()){let u=a.getInternalMethods().runValidation(i,c,a.parsed.error,e);n=Bt(n,l=>(u(l),l))}if(r.handler&&!a.getInternalMethods().getHasOutput()){a.getInternalMethods().setHasOutput();let u=!!a.getOptions().configuration["populate--"];a.getInternalMethods().postProcess(n,u,!1,!1),n=Vt(n,a,p,!1),n=Bt(n,l=>{let m=r.handler(l);return he(m)?m.then(()=>l):l}),e||a.getInternalMethods().getUsageInstance().cacheHelpMessage(),he(n)&&!a.getInternalMethods().hasParseCallback()&&n.catch(l=>{try{a.getInternalMethods().getUsageInstance().fail(null,l)}catch{}})}return e||(o.commands.pop(),o.fullCommands.pop()),n}populatePositionals(e,r,n,o){r._=r._.slice(n.commands.length);let s=e.demanded.slice(0),i=e.optional.slice(0),a={};for(this.validation.positionalCount(s.length,r._.length);s.length;){let c=s.shift();this.populatePositional(c,r,a)}for(;i.length;){let c=i.shift();this.populatePositional(c,r,a)}return r._=n.commands.concat(r._.map(c=>""+c)),this.postProcessPositionals(r,a,this.cmdToParseOptions(e.original),o),a}populatePositional(e,r,n){let o=e.cmd[0];e.variadic?n[o]=r._.splice(0).map(String):r._.length&&(n[o]=[String(r._.shift())])}cmdToParseOptions(e){let r={array:[],default:{},alias:{},demand:{}},n=_t(e);return n.demanded.forEach(o=>{let[s,...i]=o.cmd;o.variadic&&(r.array.push(s),r.default[s]=[]),r.alias[s]=i,r.demand[s]=!0}),n.optional.forEach(o=>{let[s,...i]=o.cmd;o.variadic&&(r.array.push(s),r.default[s]=[]),r.alias[s]=i}),r}postProcessPositionals(e,r,n,o){let s=Object.assign({},o.getOptions());s.default=Object.assign(n.default,s.default);for(let p of Object.keys(n.alias))s.alias[p]=(s.alias[p]||[]).concat(n.alias[p]);s.array=s.array.concat(n.array),s.config={};let i=[];if(Object.keys(r).forEach(p=>{r[p].map(u=>{s.configuration["unknown-options-as-args"]&&(s.key[p]=!0),i.push(`--${p}`),i.push(u)})}),!i.length)return;let a=Object.assign({},s.configuration,{"populate--":!1}),c=this.shim.Parser.detailed(i,Object.assign({},s,{configuration:a}));if(c.error)o.getInternalMethods().getUsageInstance().fail(c.error.message,c.error);else{let p=Object.keys(r);Object.keys(r).forEach(u=>{p.push(...c.aliases[u])}),Object.keys(c.argv).forEach(u=>{p.indexOf(u)!==-1&&(r[u]||(r[u]=c.argv[u]),e[u]=c.argv[u])})}}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){let n=gr.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");e.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}let r=this.defaultCommand.builder;if(kn(r))return r(e,!0);Vc(r)||Object.keys(r).forEach(n=>{e.option(n,r[n])})}moduleName(e){let r=es(e);if(!r)throw new Error(`No command name given for module: ${this.shim.inspect(e)}`);return this.commandFromFilename(r.filename)}commandFromFilename(e){return this.shim.path.basename(e,this.shim.path.extname(e))}extractDesc({describe:e,description:r,desc:n}){for(let o of[e,r,n]){if(typeof o=="string"||o===!1)return o;Ue(o,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let e=this.frozens.pop();Ue(e,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=e}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}};function Bc(t,e,r,n){return new ts(t,e,r,n)}function Vc(t){return typeof t=="object"&&!!t.builder&&typeof t.handler=="function"}function ug(t){return t.every(e=>typeof e=="string")}function kn(t){return typeof t=="function"}function fg(t){return typeof t=="object"}function mg(t){return typeof t=="object"&&!Array.isArray(t)}function It(t={},e=()=>!0){let r={};return hr(t).forEach(n=>{e(n,t[n])&&(r[n]=t[n])}),r}function Tt(t){typeof process>"u"||[process.stdout,process.stderr].forEach(e=>{let r=e;r._handle&&r.isTTY&&typeof r._handle.setBlocking=="function"&&r._handle.setBlocking(t)})}function dg(t){return typeof t=="boolean"}function Yc(t,e){let r=e.y18n.__,n={},o=[];n.failFn=function(P){o.push(P)};let s=null,i=!0;n.showHelpOnFail=function(P=!0,M){function U(){return typeof P=="string"?[!0,P]:[P,M]}let[oe,te]=U();return s=te,i=oe,n};let a=!1;n.fail=function(P,M){let U=t.getInternalMethods().getLoggerInstance();if(o.length)for(let oe=o.length-1;oe>=0;--oe){let te=o[oe];if(dg(te)){if(M)throw M;if(P)throw Error(P)}else te(P,M,n)}else{if(t.getExitProcess()&&Tt(!0),a||(a=!0,i&&(t.showHelp("error"),U.error()),(P||M)&&U.error(P||M),s&&((P||M)&&U.error(""),U.error(s))),M=M||new me(P),t.getExitProcess())return t.exit(1);if(t.getInternalMethods().hasParseCallback())return t.exit(1,M);throw M}};let c=[],p=!1;n.usage=(_,P)=>_===null?(p=!0,c=[],n):(p=!1,c.push([_,P||""]),n),n.getUsage=()=>c,n.getUsageDisabled=()=>p,n.getPositionalGroupName=()=>r("Positionals:");let u=[];n.example=(_,P)=>{u.push([_,P||""])};let l=[];n.command=function(P,M,U,oe,te=!1){U&&(l=l.map(K=>(K[2]=!1,K))),l.push([P,M||"",U,oe,te])},n.getCommands=()=>l;let m={};n.describe=function(P,M){Array.isArray(P)?P.forEach(U=>{n.describe(U,M)}):typeof P=="object"?Object.keys(P).forEach(U=>{n.describe(U,P[U])}):m[P]=M},n.getDescriptions=()=>m;let d=[];n.epilog=_=>{d.push(_)};let w=!1,h;n.wrap=_=>{w=!0,h=_};function x(){return w||(h=ne(),w=!0),h}let C="__yargsString__:";n.deferY18nLookup=_=>C+_,n.help=function(){if(E)return E;v();let P=t.customScriptName?t.$0:e.path.basename(t.$0),M=t.getDemandedOptions(),U=t.getDemandedCommands(),oe=t.getDeprecatedOptions(),te=t.getGroups(),K=t.getOptions(),ce=[];ce=ce.concat(Object.keys(m)),ce=ce.concat(Object.keys(M)),ce=ce.concat(Object.keys(U)),ce=ce.concat(Object.keys(K.default)),ce=ce.filter(I),ce=Object.keys(ce.reduce((k,ae)=>(ae!=="_"&&(k[ae]=!0),k),{}));let $e=x(),le=e.cliui({width:$e,wrap:!!$e});if(!p){if(c.length)c.forEach(k=>{le.div(`${k[0].replace(/\$0/g,P)}`),k[1]&&le.div({text:`${k[1]}`,padding:[1,0,0,0]})}),le.div();else if(l.length){let k=null;U._?k=`${P} <${r("command")}>
|
|
19
|
-
`:
|
|
20
|
-
`,
|
|
21
|
-
`);
|
|
22
|
-
`)}return
|
|
17
|
+
`),s.border&&(o.unshift("."+"-".repeat(this.negatePadding(s)+2)+"."),o.push("'"+"-".repeat(this.negatePadding(s)+2)+"'")),s.padding&&(o.unshift(...new Array(s.padding[Cg]||0).fill("")),o.push(...new Array(s.padding[Og]||0).fill(""))),o.forEach((a,c)=>{r[c]||r.push([]);let l=r[c];for(let u=0;u<i;u++)l[u]===void 0&&l.push("");l.push(a)})}),r}negatePadding(e){let r=e.width||0;return e.padding&&(r-=(e.padding[Yn]||0)+(e.padding[Hn]||0)),e.border&&(r-=4),r}columnWidths(e){if(!this.wrap)return e.map(i=>i.width||et.stringWidth(i.text));let r=e.length,n=this.width,o=e.map(i=>{if(i.width)return r--,n-=i.width,i.width}),s=r?Math.floor(n/r):0;return o.map((i,a)=>i===void 0?Math.max(s,xg(e[a])):i)}};function Bc(t,e,r){return t.border?/[.']-+[.']/.test(e)?"":e.trim().length!==0?r:" ":""}function xg(t){let e=t.padding||[],r=1+(e[Yn]||0)+(e[Hn]||0);return t.border?r+4:r}function Ag(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function vg(t,e){t=t.trim();let r=et.stringWidth(t);return r<e?" ".repeat(e-r)+t:t}function Pg(t,e){t=t.trim();let r=et.stringWidth(t);return r>=e?t:" ".repeat(e-r>>1)+t}var et;function Hc(t,e){return et=e,new ss({width:t?.width||Ag(),wrap:t?.wrap})}var Yc=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function is(t){return t.replace(Yc,"")}function Kc(t,e){let[r,n]=t.match(Yc)||["",""];t=is(t);let o="";for(let s=0;s<t.length;s++)s!==0&&s%e===0&&(o+=`
|
|
18
|
+
`),o+=t.charAt(s);return r&&n&&(o=`${r}${o}${n}`),o}function as(t){return Hc(t,{stringWidth:e=>[...e].length,stripAnsi:is,wrap:Kc})}import{dirname as Jc,resolve as Xc}from"path";import{readdirSync as $g,statSync as Rg}from"fs";function Zc(t,e){let r=Xc(".",t),n;for(Rg(r).isDirectory()||(r=Jc(r));;){if(n=e(r,$g(r)),n)return Xc(r,n);if(r=Jc(n=r),n===r)break}}import{inspect as Bg}from"util";import{readFileSync as Hg}from"fs";import{fileURLToPath as pl}from"url";import{format as jg}from"util";import{readFileSync as Ig}from"fs";import{normalize as Tg,resolve as Ng}from"path";function Xt(t){if(t!==t.toLowerCase()&&t!==t.toUpperCase()||(t=t.toLowerCase()),t.indexOf("-")===-1&&t.indexOf("_")===-1)return t;{let r="",n=!1,o=t.match(/^-+/);for(let s=o?o[0].length:0;s<t.length;s++){let i=t.charAt(s);n&&(n=!1,i=i.toUpperCase()),s!==0&&(i==="-"||i==="_")?n=!0:i!=="-"&&i!=="_"&&(r+=i)}return r}}function Kn(t,e){let r=t.toLowerCase();e=e||"-";let n="";for(let o=0;o<t.length;o++){let s=r.charAt(o),i=t.charAt(o);s!==i&&o>0?n+=`${e}${r.charAt(o)}`:n+=i}return n}function Jn(t){return t==null?!1:typeof t=="number"||/^0x[0-9a-f]+$/i.test(t)?!0:/^0[^.]/.test(t)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(t)}function Qc(t){if(Array.isArray(t))return t.map(i=>typeof i!="string"?i+"":i);t=t.trim();let e=0,r=null,n=null,o=null,s=[];for(let i=0;i<t.length;i++){if(r=n,n=t.charAt(i),n===" "&&!o){r!==" "&&e++;continue}n===o?o=null:(n==="'"||n==='"')&&!o&&(o=n),s[e]||(s[e]=""),s[e]+=n}return s}var ft;(function(t){t.BOOLEAN="boolean",t.STRING="string",t.NUMBER="number",t.ARRAY="array"})(ft||(ft={}));var Tt,Xn=class{constructor(e){Tt=e}parse(e,r){let n=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},r),o=Qc(e),s=_g(Object.assign(Object.create(null),n.alias)),i=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},n.configuration),a=Object.assign(Object.create(null),n.default),c=n.configObjects||[],l=n.envPrefix,u=i["populate--"],p=u?"--":"_",m=Object.create(null),d=Object.create(null),b=n.__||Tt.format,h={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},C=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,x=new RegExp("^--"+i["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(y){let w=typeof y=="object"?y.key:y,_=Object.keys(y).map(function(A){return{boolean:"bools",string:"strings",number:"numbers"}[A]}).filter(Boolean).pop();_&&(h[_][w]=!0),h.arrays[w]=!0,h.keys.push(w)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(y){h.bools[y]=!0,h.keys.push(y)}),[].concat(n.string||[]).filter(Boolean).forEach(function(y){h.strings[y]=!0,h.keys.push(y)}),[].concat(n.number||[]).filter(Boolean).forEach(function(y){h.numbers[y]=!0,h.keys.push(y)}),[].concat(n.count||[]).filter(Boolean).forEach(function(y){h.counts[y]=!0,h.keys.push(y)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(y){h.normalize[y]=!0,h.keys.push(y)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([y,w])=>{typeof w=="number"&&(h.nargs[y]=w,h.keys.push(y))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([y,w])=>{typeof w=="function"&&(h.coercions[y]=w,h.keys.push(y))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(y){h.configs[y]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([y,w])=>{(typeof w=="boolean"||typeof w=="function")&&(h.configs[y]=w)})),st(n.key,s,n.default,h.arrays),Object.keys(a).forEach(function(y){(h.aliases[y]||[]).forEach(function(w){a[w]=a[y]})});let E=null;$o();let v=[],O=Object.assign(Object.create(null),{_:[]}),$={};for(let y=0;y<o.length;y++){let w=o[y],_=w.replace(/^-{3,}/,"---"),A,S,T,N,B,je;if(w!=="--"&&ce(w))F(w);else if(_.match(/---+(=|$)/)){F(w);continue}else if(w.match(/^--.+=/)||!i["short-option-groups"]&&w.match(/^-.+=/))N=w.match(/^--?([^=]+)=([\s\S]*)$/),N!==null&&Array.isArray(N)&&N.length>=3&&(V(N[1],h.arrays)?y=ne(y,N[1],o,N[2]):V(N[1],h.nargs)!==!1?y=D(y,N[1],o,N[2]):X(N[1],N[2]));else if(w.match(x)&&i["boolean-negation"])N=w.match(x),N!==null&&Array.isArray(N)&&N.length>=2&&(S=N[1],X(S,V(S,h.arrays)?[!1]:!1));else if(w.match(/^--.+/)||!i["short-option-groups"]&&w.match(/^-[^-]+/))N=w.match(/^--?(.+)/),N!==null&&Array.isArray(N)&&N.length>=2&&(S=N[1],V(S,h.arrays)?y=ne(y,S,o):V(S,h.nargs)!==!1?y=D(y,S,o):(B=o[y+1],B!==void 0&&(!B.match(/^-/)||B.match(C))&&!V(S,h.bools)&&!V(S,h.counts)||/^(true|false)$/.test(B)?(X(S,B),y++):X(S,ae(S))));else if(w.match(/^-.\..+=/))N=w.match(/^-([^=]+)=([\s\S]*)$/),N!==null&&Array.isArray(N)&&N.length>=3&&X(N[1],N[2]);else if(w.match(/^-.\..+/)&&!w.match(C))B=o[y+1],N=w.match(/^-(.\..+)/),N!==null&&Array.isArray(N)&&N.length>=2&&(S=N[1],B!==void 0&&!B.match(/^-/)&&!V(S,h.bools)&&!V(S,h.counts)?(X(S,B),y++):X(S,ae(S)));else if(w.match(/^-[^-]+/)&&!w.match(C)){T=w.slice(1,-1).split(""),A=!1;for(let We=0;We<T.length;We++){if(B=w.slice(We+2),T[We+1]&&T[We+1]==="="){je=w.slice(We+3),S=T[We],V(S,h.arrays)?y=ne(y,S,o,je):V(S,h.nargs)!==!1?y=D(y,S,o,je):X(S,je),A=!0;break}if(B==="-"){X(T[We],B);continue}if(/[A-Za-z]/.test(T[We])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(B)&&V(B,h.bools)===!1){X(T[We],B),A=!0;break}if(T[We+1]&&T[We+1].match(/\W/)){X(T[We],B),A=!0;break}else X(T[We],ae(T[We]))}S=w.slice(-1)[0],!A&&S!=="-"&&(V(S,h.arrays)?y=ne(y,S,o):V(S,h.nargs)!==!1?y=D(y,S,o):(B=o[y+1],B!==void 0&&(!/^(-|--)[^-]/.test(B)||B.match(C))&&!V(S,h.bools)&&!V(S,h.counts)||/^(true|false)$/.test(B)?(X(S,B),y++):X(S,ae(S))))}else if(w.match(/^-[0-9]$/)&&w.match(C)&&V(w.slice(1),h.bools))S=w.slice(1),X(S,ae(S));else if(w==="--"){v=o.slice(y+1);break}else if(i["halt-at-non-option"]){v=o.slice(y);break}else F(w)}re(O,!0),re(O,!1),M(O),se(),Ne(O,h.aliases,a,!0),Y(O),i["set-placeholder-key"]&&le(O),Object.keys(h.counts).forEach(function(y){pe(O,y.split("."))||X(y,0)}),u&&v.length&&(O[p]=[]),v.forEach(function(y){O[p].push(y)}),i["camel-case-expansion"]&&i["strip-dashed"]&&Object.keys(O).filter(y=>y!=="--"&&y.includes("-")).forEach(y=>{delete O[y]}),i["strip-aliased"]&&[].concat(...Object.keys(s).map(y=>s[y])).forEach(y=>{i["camel-case-expansion"]&&y.includes("-")&&delete O[y.split(".").map(w=>Xt(w)).join(".")],delete O[y]});function F(y){let w=P("_",y);(typeof w=="string"||typeof w=="number")&&O._.push(w)}function D(y,w,_,A){let S,T=V(w,h.nargs);if(T=typeof T!="number"||isNaN(T)?1:T,T===0)return Pe(A)||(E=Error(b("Argument unexpected for: %s",w))),X(w,ae(w)),y;let N=Pe(A)?0:1;if(i["nargs-eats-options"])_.length-(y+1)+N<T&&(E=Error(b("Not enough arguments following: %s",w))),N=T;else{for(S=y+1;S<_.length&&(!_[S].match(/^-[^0-9]/)||_[S].match(C)||ce(_[S]));S++)N++;N<T&&(E=Error(b("Not enough arguments following: %s",w)))}let B=Math.min(N,T);for(!Pe(A)&&B>0&&(X(w,A),B--),S=y+1;S<B+y+1;S++)X(w,_[S]);return y+B}function ne(y,w,_,A){let S=[],T=A||_[y+1],N=V(w,h.nargs);if(V(w,h.bools)&&!/^(true|false)$/.test(T))S.push(!0);else if(Pe(T)||Pe(A)&&/^-/.test(T)&&!C.test(T)&&!ce(T)){if(a[w]!==void 0){let B=a[w];S=Array.isArray(B)?B:[B]}}else{Pe(A)||S.push(R(w,A));for(let B=y+1;B<_.length&&!(!i["greedy-arrays"]&&S.length>0||N&&typeof N=="number"&&S.length>=N||(T=_[B],/^-/.test(T)&&!C.test(T)&&!ce(T)));B++)y=B,S.push(R(w,T))}return typeof N=="number"&&(N&&S.length<N||isNaN(N)&&S.length===0)&&(E=Error(b("Not enough arguments following: %s",w))),X(w,S),y}function X(y,w){if(/-/.test(y)&&i["camel-case-expansion"]){let S=y.split(".").map(function(T){return Xt(T)}).join(".");ue(y,S)}let _=R(y,w),A=y.split(".");Ze(O,A,_),h.aliases[y]&&h.aliases[y].forEach(function(S){let T=S.split(".");Ze(O,T,_)}),A.length>1&&i["dot-notation"]&&(h.aliases[A[0]]||[]).forEach(function(S){let T=S.split("."),N=[].concat(A);N.shift(),T=T.concat(N),(h.aliases[y]||[]).includes(T.join("."))||Ze(O,T,_)}),V(y,h.normalize)&&!V(y,h.arrays)&&[y].concat(h.aliases[y]||[]).forEach(function(T){Object.defineProperty($,T,{enumerable:!0,get(){return w},set(N){w=typeof N=="string"?Tt.normalize(N):N}})})}function ue(y,w){h.aliases[y]&&h.aliases[y].length||(h.aliases[y]=[w],m[w]=!0),h.aliases[w]&&h.aliases[w].length||ue(w,y)}function R(y,w){typeof w=="string"&&(w[0]==="'"||w[0]==='"')&&w[w.length-1]===w[0]&&(w=w.substring(1,w.length-1)),(V(y,h.bools)||V(y,h.counts))&&typeof w=="string"&&(w=w==="true");let _=Array.isArray(w)?w.map(function(A){return P(y,A)}):P(y,w);return V(y,h.counts)&&(Pe(_)||typeof _=="boolean")&&(_=cs()),V(y,h.normalize)&&V(y,h.arrays)&&(Array.isArray(w)?_=w.map(A=>Tt.normalize(A)):_=Tt.normalize(w)),_}function P(y,w){return!i["parse-positional-numbers"]&&y==="_"||!V(y,h.strings)&&!V(y,h.bools)&&!Array.isArray(w)&&(Jn(w)&&i["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${w}`)))||!Pe(w)&&V(y,h.numbers))&&(w=Number(w)),w}function M(y){let w=Object.create(null);Ne(w,h.aliases,a),Object.keys(h.configs).forEach(function(_){let A=y[_]||w[_];if(A)try{let S=null,T=Tt.resolve(Tt.cwd(),A),N=h.configs[_];if(typeof N=="function"){try{S=N(T)}catch(B){S=B}if(S instanceof Error){E=S;return}}else S=Tt.require(T);q(S)}catch(S){S.name==="PermissionDenied"?E=S:y[_]&&(E=Error(b("Invalid JSON config file: %s",A)))}})}function q(y,w){Object.keys(y).forEach(function(_){let A=y[_],S=w?w+"."+_:_;typeof A=="object"&&A!==null&&!Array.isArray(A)&&i["dot-notation"]?q(A,S):(!pe(O,S.split("."))||V(S,h.arrays)&&i["combine-arrays"])&&X(S,A)})}function se(){typeof c<"u"&&c.forEach(function(y){q(y)})}function re(y,w){if(typeof l>"u")return;let _=typeof l=="string"?l:"",A=Tt.env();Object.keys(A).forEach(function(S){if(_===""||S.lastIndexOf(_,0)===0){let T=S.split("__").map(function(N,B){return B===0&&(N=N.substring(_.length)),Xt(N)});(w&&h.configs[T.join(".")]||!w)&&!pe(y,T)&&X(T.join("."),A[S])}})}function Y(y){let w,_=new Set;Object.keys(y).forEach(function(A){if(!_.has(A)&&(w=V(A,h.coercions),typeof w=="function"))try{let S=P(A,w(y[A]));[].concat(h.aliases[A]||[],A).forEach(T=>{_.add(T),y[T]=S})}catch(S){E=S}})}function le(y){return h.keys.forEach(w=>{~w.indexOf(".")||typeof y[w]>"u"&&(y[w]=void 0)}),y}function Ne(y,w,_,A=!1){Object.keys(_).forEach(function(S){pe(y,S.split("."))||(Ze(y,S.split("."),_[S]),A&&(d[S]=!0),(w[S]||[]).forEach(function(T){pe(y,T.split("."))||Ze(y,T.split("."),_[S])}))})}function pe(y,w){let _=y;i["dot-notation"]||(w=[w.join(".")]),w.slice(0,-1).forEach(function(S){_=_[S]||{}});let A=w[w.length-1];return typeof _!="object"?!1:A in _}function Ze(y,w,_){let A=y;i["dot-notation"]||(w=[w.join(".")]),w.slice(0,-1).forEach(function(je){je=el(je),typeof A=="object"&&A[je]===void 0&&(A[je]={}),typeof A[je]!="object"||Array.isArray(A[je])?(Array.isArray(A[je])?A[je].push({}):A[je]=[A[je],{}],A=A[je][A[je].length-1]):A=A[je]});let S=el(w[w.length-1]),T=V(w.join("."),h.arrays),N=Array.isArray(_),B=i["duplicate-arguments-array"];!B&&V(S,h.nargs)&&(B=!0,(!Pe(A[S])&&h.nargs[S]===1||Array.isArray(A[S])&&A[S].length===h.nargs[S])&&(A[S]=void 0)),_===cs()?A[S]=cs(A[S]):Array.isArray(A[S])?B&&T&&N?A[S]=i["flatten-duplicate-arrays"]?A[S].concat(_):(Array.isArray(A[S][0])?A[S]:[A[S]]).concat([_]):!B&&!!T==!!N?A[S]=_:A[S]=A[S].concat([_]):A[S]===void 0&&T?A[S]=N?_:[_]:B&&!(A[S]===void 0||V(S,h.counts)||V(S,h.bools))?A[S]=[A[S],_]:A[S]=_}function st(...y){y.forEach(function(w){Object.keys(w||{}).forEach(function(_){h.aliases[_]||(h.aliases[_]=[].concat(s[_]||[]),h.aliases[_].concat(_).forEach(function(A){if(/-/.test(A)&&i["camel-case-expansion"]){let S=Xt(A);S!==_&&h.aliases[_].indexOf(S)===-1&&(h.aliases[_].push(S),m[S]=!0)}}),h.aliases[_].concat(_).forEach(function(A){if(A.length>1&&/[A-Z]/.test(A)&&i["camel-case-expansion"]){let S=Kn(A,"-");S!==_&&h.aliases[_].indexOf(S)===-1&&(h.aliases[_].push(S),m[S]=!0)}}),h.aliases[_].forEach(function(A){h.aliases[A]=[_].concat(h.aliases[_].filter(function(S){return A!==S}))}))})})}function V(y,w){let _=[].concat(h.aliases[y]||[],y),A=Object.keys(w),S=_.find(T=>A.includes(T));return S?w[S]:!1}function _e(y){let w=Object.keys(h);return[].concat(w.map(A=>h[A])).some(function(A){return Array.isArray(A)?A.includes(y):A[y]})}function it(y,...w){return[].concat(...w).some(function(A){let S=y.match(A);return S&&_e(S[1])})}function U(y){if(y.match(C)||!y.match(/^-[^-]+/))return!1;let w=!0,_,A=y.slice(1).split("");for(let S=0;S<A.length;S++){if(_=y.slice(S+2),!_e(A[S])){w=!1;break}if(A[S+1]&&A[S+1]==="="||_==="-"||/[A-Za-z]/.test(A[S])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(_)||A[S+1]&&A[S+1].match(/\W/))break}return w}function ce(y){return i["unknown-options-as-args"]&&ie(y)}function ie(y){return y=y.replace(/^-{3,}/,"--"),y.match(C)||U(y)?!1:!it(y,/^-+([^=]+?)=[\s\S]*$/,x,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function ae(y){return!V(y,h.bools)&&!V(y,h.counts)&&`${y}`in a?a[y]:ve(He(y))}function ve(y){return{[ft.BOOLEAN]:!0,[ft.STRING]:"",[ft.NUMBER]:void 0,[ft.ARRAY]:[]}[y]}function He(y){let w=ft.BOOLEAN;return V(y,h.strings)?w=ft.STRING:V(y,h.numbers)?w=ft.NUMBER:V(y,h.bools)?w=ft.BOOLEAN:V(y,h.arrays)&&(w=ft.ARRAY),w}function Pe(y){return y===void 0}function $o(){Object.keys(h.counts).find(y=>V(y,h.arrays)?(E=Error(b("Invalid configuration: %s, opts.count excludes opts.array.",y)),!0):V(y,h.nargs)?(E=Error(b("Invalid configuration: %s, opts.count excludes opts.narg.",y)),!0):!1)}return{aliases:Object.assign({},h.aliases),argv:Object.assign($,O),configuration:i,defaulted:Object.assign({},d),error:E,newAliases:Object.assign({},m)}}};function _g(t){let e=[],r=Object.create(null),n=!0;for(Object.keys(t).forEach(function(o){e.push([].concat(t[o],o))});n;){n=!1;for(let o=0;o<e.length;o++)for(let s=o+1;s<e.length;s++)if(e[o].filter(function(a){return e[s].indexOf(a)!==-1}).length){e[o]=e[o].concat(e[s]),e.splice(s,1),n=!0;break}}return e.forEach(function(o){o=o.filter(function(i,a,c){return c.indexOf(i)===a});let s=o.pop();s!==void 0&&typeof s=="string"&&(r[s]=o)}),r}function cs(t){return t!==void 0?t+1:1}function el(t){return t==="__proto__"?"___proto___":t}var tl=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):10;if(process&&process.version&&Number(process.version.match(/v([^.]+)/)[1])<tl)throw Error(`yargs parser supports a minimum Node.js version of ${tl}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);var Lg=process?process.env:{},rl=new Xn({cwd:process.cwd,env:()=>Lg,format:jg,normalize:Tg,resolve:Ng,require:t=>{if(typeof Ye<"u")return Ye(t);if(t.match(/\.json$/))return Ig(t,"utf8");throw Error("only .json config files are supported in ESM")}}),on=function(e,r){return rl.parse(e.slice(),r).argv};on.detailed=function(t,e){return rl.parse(t.slice(),e)};on.camelCase=Xt;on.decamelize=Kn;on.looksLikeNumber=Jn;var ls=on;import{basename as Yg,dirname as Kg,extname as Jg,relative as Xg,resolve as cl}from"path";function nl(){return Dg()?0:1}function Dg(){return Mg()&&!process.defaultApp}function Mg(){return!!process.versions.electron}function ps(t){return t.slice(nl()+1)}function ol(){return process.argv[nl()]}var ge=class t extends Error{constructor(e){super(e||"yargs error"),this.name="YError",Error.captureStackTrace(this,t)}};import{readFileSync as kg,statSync as Fg,writeFile as Ug}from"fs";import{format as qg}from"util";import{resolve as Wg}from"path";var sl={fs:{readFileSync:kg,writeFile:Ug},format:qg,resolve:Wg,exists:t=>{try{return Fg(t).isFile()}catch{return!1}}};var Ct,us=class{constructor(e){e=e||{},this.directory=e.directory||"./locales",this.updateFiles=typeof e.updateFiles=="boolean"?e.updateFiles:!0,this.locale=e.locale||"en",this.fallbackToLanguage=typeof e.fallbackToLanguage=="boolean"?e.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...e){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);let r=e.shift(),n=function(){};return typeof e[e.length-1]=="function"&&(n=e.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][r]&&this.updateFiles?(this.cache[this.locale][r]=r,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),Ct.format.apply(Ct.format,[this.cache[this.locale][r]||r].concat(e))}__n(){let e=Array.prototype.slice.call(arguments),r=e.shift(),n=e.shift(),o=e.shift(),s=function(){};typeof e[e.length-1]=="function"&&(s=e.pop()),this.cache[this.locale]||this._readLocaleFile();let i=o===1?r:n;this.cache[this.locale][r]&&(i=this.cache[this.locale][r][o===1?"one":"other"]),!this.cache[this.locale][r]&&this.updateFiles?(this.cache[this.locale][r]={one:r,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:s})):s();let a=[i];return~i.indexOf("%d")&&a.push(o),Ct.format.apply(Ct.format,a.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){this.cache[this.locale]||this._readLocaleFile();for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this.cache[this.locale][r]=e[r])}_taggedLiteral(e,...r){let n="";return e.forEach(function(o,s){let i=r[s+1];n+=o,typeof i<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(r,1)))}_enqueueWrite(e){this.writeQueue.push(e),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){let e=this,r=this.writeQueue[0],n=r.directory,o=r.locale,s=r.cb,i=this._resolveLocaleFile(n,o),a=JSON.stringify(this.cache[o],null,2);Ct.fs.writeFile(i,a,"utf-8",function(c){e.writeQueue.shift(),e.writeQueue.length>0&&e._processWriteQueue(),s(c)})}_readLocaleFile(){let e={},r=this._resolveLocaleFile(this.directory,this.locale);try{Ct.fs.readFileSync&&(e=JSON.parse(Ct.fs.readFileSync(r,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+r),n.code==="ENOENT")e={};else throw n}this.cache[this.locale]=e}_resolveLocaleFile(e,r){let n=Ct.resolve(e,"./",r+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~r.lastIndexOf("_")){let o=Ct.resolve(e,"./",r.split("_")[0]+".json");this._fileExistsSync(o)&&(n=o)}return n}_fileExistsSync(e){return Ct.exists(e)}};function il(t,e){Ct=e;let r=new us(t);return{__:r.__.bind(r),__n:r.__n.bind(r),setLocale:r.setLocale.bind(r),getLocale:r.getLocale.bind(r),updateLocale:r.updateLocale.bind(r),locale:r.locale}}var zg=t=>il(t,sl),al=zg;var Zg="require is not supported by ESM",ll="loading a directory of commands is not supported yet for ESM",Qg=pl(import.meta.url).split("node_modules")[0],ey=pl(import.meta.url),fs={assert:{notStrictEqual:Vg,strictEqual:Gg},cliui:as,findUp:Zc,getEnv:t=>process.env[t],inspect:Bg,getCallerFile:()=>{throw new ge(ll)},getProcessArgvBin:ol,mainFilename:Qg||process.cwd(),Parser:ls,path:{basename:Yg,dirname:Kg,extname:Jg,relative:Xg,resolve:cl},process:{argv:()=>process.argv,cwd:process.cwd,execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:Hg,require:()=>{throw new ge(Zg)},requireDirectory:()=>{throw new ge(ll)},stringWidth:t=>[...t].length,y18n:al({directory:cl(ey,"../../../locales"),updateFiles:!1})};function Be(t,e,r,n){r.assert.notStrictEqual(t,e,n)}function ms(t,e){e.assert.strictEqual(typeof t,"string")}function Ar(t){return Object.keys(t)}function we(t){return!!t&&!!t.then&&typeof t.then=="function"}function kt(t){let r=t.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,o=r.shift();if(!o)throw new Error(`No command found in: ${t}`);let s={cmd:o.replace(n,""),demanded:[],optional:[]};return r.forEach((i,a)=>{let c=!1;i=i.replace(/\s/g,""),/\.+[\]>]/.test(i)&&a===r.length-1&&(c=!0),/^\[/.test(i)?s.optional.push({cmd:i.replace(n,"").split("|"),variadic:c}):s.demanded.push({cmd:i.replace(n,"").split("|"),variadic:c})}),s}var ty=["first","second","third","fourth","fifth","sixth"];function L(t,e,r){function n(){return typeof t=="object"?[{demanded:[],optional:[]},t,e]:[kt(`cmd ${t}`),e,r]}try{let o=0,[s,i,a]=n(),c=[].slice.call(i);for(;c.length&&c[c.length-1]===void 0;)c.pop();let l=a||c.length;if(l<s.demanded.length)throw new ge(`Not enough arguments provided. Expected ${s.demanded.length} but received ${c.length}.`);let u=s.demanded.length+s.optional.length;if(l>u)throw new ge(`Too many arguments provided. Expected max ${u} but received ${l}.`);s.demanded.forEach(p=>{let m=c.shift(),d=ul(m);p.cmd.filter(h=>h===d||h==="*").length===0&&fl(d,p.cmd,o),o+=1}),s.optional.forEach(p=>{if(c.length===0)return;let m=c.shift(),d=ul(m);p.cmd.filter(h=>h===d||h==="*").length===0&&fl(d,p.cmd,o),o+=1})}catch(o){console.warn(o.stack)}}function ul(t){return Array.isArray(t)?"array":t===null?"null":typeof t}function fl(t,e,r){throw new ge(`Invalid ${ty[r]||"manyith"} argument. Expected ${e.join(" or ")} but received ${t}.`)}var Zn=class{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,r,n=!0){if(L("<array|function> [boolean] [boolean]",[e,r,n],arguments.length),Array.isArray(e)){for(let o=0;o<e.length;o++){if(typeof e[o]!="function")throw Error("middleware must be a function");let s=e[o];s.applyBeforeValidation=r,s.global=n}Array.prototype.push.apply(this.globalMiddleware,e)}else if(typeof e=="function"){let o=e;o.applyBeforeValidation=r,o.global=n,this.globalMiddleware.push(e)}return this.yargs}addCoerceMiddleware(e,r){let n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(o=>{let s=[...n[r]||[],r];return o.option?!s.includes(o.option):!0}),e.option=r,this.addMiddleware(e,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let e=this.frozens.pop();e!==void 0&&(this.globalMiddleware=e)}reset(){this.globalMiddleware=this.globalMiddleware.filter(e=>e.global)}};function ml(t){return t?t.map(e=>(e.applyBeforeValidation=!1,e)):[]}function Zt(t,e,r,n){return r.reduce((o,s)=>{if(s.applyBeforeValidation!==n)return o;if(we(o))return o.then(i=>Promise.all([i,s(i,e)])).then(([i,a])=>Object.assign(i,a));{let i=s(o,e);return we(i)?i.then(a=>Object.assign(o,a)):Object.assign(o,i)}},t)}function Qt(t,e,r=n=>{throw n}){try{let n=ry(t)?t():t;return we(n)?n.then(o=>e(o)):e(n)}catch(n){return r(n)}}function ry(t){return typeof t=="function"}function ds(t){if(typeof Ye>"u")return null;for(let e=0,r=Object.keys(Ye.cache),n;e<r.length;e++)if(n=Ye.cache[r[e]],n.exports===t)return n;return null}var vr=/(^\*)|(^\$0)/,hs=class{constructor(e,r,n,o){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=o,this.usage=e,this.globalMiddleware=n,this.validation=r}addDirectory(e,r,n,o){o=o||{},typeof o.recurse!="boolean"&&(o.recurse=!1),Array.isArray(o.extensions)||(o.extensions=["js"]);let s=typeof o.visit=="function"?o.visit:i=>i;o.visit=(i,a,c)=>{let l=s(i,a,c);if(l){if(this.requireCache.has(a))return l;this.requireCache.add(a),this.addHandler(l)}return l},this.shim.requireDirectory({require:r,filename:n},e,o)}addHandler(e,r,n,o,s,i){let a=[],c=ml(s);if(o=o||(()=>{}),Array.isArray(e))if(ny(e))[e,...a]=e;else for(let l of e)this.addHandler(l);else if(sy(e)){let l=Array.isArray(e.command)||typeof e.command=="string"?e.command:this.moduleName(e);e.aliases&&(l=[].concat(l).concat(e.aliases)),this.addHandler(l,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(dl(n)){this.addHandler([e].concat(a),r,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof e=="string"){let l=kt(e);a=a.map(m=>kt(m).cmd);let u=!1,p=[l.cmd].concat(a).filter(m=>vr.test(m)?(u=!0,!1):!0);p.length===0&&u&&p.push("$0"),u&&(l.cmd=p[0],a=p.slice(1),e=e.replace(vr,l.cmd)),a.forEach(m=>{this.aliasMap[m]=l.cmd}),r!==!1&&this.usage.command(e,r,u,a,i),this.handlers[l.cmd]={original:e,description:r,handler:o,builder:n||{},middlewares:c,deprecated:i,demanded:l.demanded,optional:l.optional},u&&(this.defaultCommand=this.handlers[l.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,r,n,o,s,i){let a=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,c=r.getInternalMethods().getContext(),l=c.commands.slice(),u=!e;e&&(c.commands.push(e),c.fullCommands.push(a.original));let p=this.applyBuilderUpdateUsageAndParse(u,a,r,n.aliases,l,o,s,i);return we(p)?p.then(m=>this.applyMiddlewareAndGetResult(u,a,m.innerArgv,c,s,m.aliases,r)):this.applyMiddlewareAndGetResult(u,a,p.innerArgv,c,s,p.aliases,r)}applyBuilderUpdateUsageAndParse(e,r,n,o,s,i,a,c){let l=r.builder,u=n;if(Qn(l)){let p=l(n.getInternalMethods().reset(o),c);if(we(p))return p.then(m=>(u=gl(m)?m:n,this.parseAndUpdateUsage(e,r,u,s,i,a)))}else oy(l)&&(u=n.getInternalMethods().reset(o),Object.keys(r.builder).forEach(p=>{u.option(p,l[p])}));return this.parseAndUpdateUsage(e,r,u,s,i,a)}parseAndUpdateUsage(e,r,n,o,s,i){e&&n.getInternalMethods().getUsageInstance().unfreeze(),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(o,r),r.description);let a=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,s,i);return we(a)?a.then(c=>({aliases:n.parsed.aliases,innerArgv:c})):{aliases:n.parsed.aliases,innerArgv:a}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,r){let n=vr.test(r.original)?r.original.replace(vr,"").trim():r.original,o=e.filter(s=>!vr.test(s));return o.push(n),`$0 ${o.join(" ")}`}applyMiddlewareAndGetResult(e,r,n,o,s,i,a){let c={};if(s)return n;a.getInternalMethods().getHasOutput()||(c=this.populatePositionals(r,n,o,a));let l=this.globalMiddleware.getMiddleware().slice(0).concat(r.middlewares);if(n=Zt(n,a,l,!0),!a.getInternalMethods().getHasOutput()){let u=a.getInternalMethods().runValidation(i,c,a.parsed.error,e);n=Qt(n,p=>(u(p),p))}if(r.handler&&!a.getInternalMethods().getHasOutput()){a.getInternalMethods().setHasOutput();let u=!!a.getOptions().configuration["populate--"];a.getInternalMethods().postProcess(n,u,!1,!1),n=Zt(n,a,l,!1),n=Qt(n,p=>{let m=r.handler(p);return we(m)?m.then(()=>p):p}),e||a.getInternalMethods().getUsageInstance().cacheHelpMessage(),we(n)&&!a.getInternalMethods().hasParseCallback()&&n.catch(p=>{try{a.getInternalMethods().getUsageInstance().fail(null,p)}catch{}})}return e||(o.commands.pop(),o.fullCommands.pop()),n}populatePositionals(e,r,n,o){r._=r._.slice(n.commands.length);let s=e.demanded.slice(0),i=e.optional.slice(0),a={};for(this.validation.positionalCount(s.length,r._.length);s.length;){let c=s.shift();this.populatePositional(c,r,a)}for(;i.length;){let c=i.shift();this.populatePositional(c,r,a)}return r._=n.commands.concat(r._.map(c=>""+c)),this.postProcessPositionals(r,a,this.cmdToParseOptions(e.original),o),a}populatePositional(e,r,n){let o=e.cmd[0];e.variadic?n[o]=r._.splice(0).map(String):r._.length&&(n[o]=[String(r._.shift())])}cmdToParseOptions(e){let r={array:[],default:{},alias:{},demand:{}},n=kt(e);return n.demanded.forEach(o=>{let[s,...i]=o.cmd;o.variadic&&(r.array.push(s),r.default[s]=[]),r.alias[s]=i,r.demand[s]=!0}),n.optional.forEach(o=>{let[s,...i]=o.cmd;o.variadic&&(r.array.push(s),r.default[s]=[]),r.alias[s]=i}),r}postProcessPositionals(e,r,n,o){let s=Object.assign({},o.getOptions());s.default=Object.assign(n.default,s.default);for(let l of Object.keys(n.alias))s.alias[l]=(s.alias[l]||[]).concat(n.alias[l]);s.array=s.array.concat(n.array),s.config={};let i=[];if(Object.keys(r).forEach(l=>{r[l].map(u=>{s.configuration["unknown-options-as-args"]&&(s.key[l]=!0),i.push(`--${l}`),i.push(u)})}),!i.length)return;let a=Object.assign({},s.configuration,{"populate--":!1}),c=this.shim.Parser.detailed(i,Object.assign({},s,{configuration:a}));if(c.error)o.getInternalMethods().getUsageInstance().fail(c.error.message,c.error);else{let l=Object.keys(r);Object.keys(r).forEach(u=>{l.push(...c.aliases[u])}),Object.keys(c.argv).forEach(u=>{l.indexOf(u)!==-1&&(r[u]||(r[u]=c.argv[u]),e[u]=c.argv[u])})}}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){let n=vr.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");e.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}let r=this.defaultCommand.builder;if(Qn(r))return r(e,!0);dl(r)||Object.keys(r).forEach(n=>{e.option(n,r[n])})}moduleName(e){let r=ds(e);if(!r)throw new Error(`No command name given for module: ${this.shim.inspect(e)}`);return this.commandFromFilename(r.filename)}commandFromFilename(e){return this.shim.path.basename(e,this.shim.path.extname(e))}extractDesc({describe:e,description:r,desc:n}){for(let o of[e,r,n]){if(typeof o=="string"||o===!1)return o;Be(o,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let e=this.frozens.pop();Be(e,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=e}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}};function hl(t,e,r,n){return new hs(t,e,r,n)}function dl(t){return typeof t=="object"&&!!t.builder&&typeof t.handler=="function"}function ny(t){return t.every(e=>typeof e=="string")}function Qn(t){return typeof t=="function"}function oy(t){return typeof t=="object"}function sy(t){return typeof t=="object"&&!Array.isArray(t)}function Ft(t={},e=()=>!0){let r={};return Ar(t).forEach(n=>{e(n,t[n])&&(r[n]=t[n])}),r}function Ut(t){typeof process>"u"||[process.stdout,process.stderr].forEach(e=>{let r=e;r._handle&&r.isTTY&&typeof r._handle.setBlocking=="function"&&r._handle.setBlocking(t)})}function iy(t){return typeof t=="boolean"}function bl(t,e){let r=e.y18n.__,n={},o=[];n.failFn=function(P){o.push(P)};let s=null,i=!0;n.showHelpOnFail=function(P=!0,M){function q(){return typeof P=="string"?[!0,P]:[P,M]}let[se,re]=q();return s=re,i=se,n};let a=!1;n.fail=function(P,M){let q=t.getInternalMethods().getLoggerInstance();if(o.length)for(let se=o.length-1;se>=0;--se){let re=o[se];if(iy(re)){if(M)throw M;if(P)throw Error(P)}else re(P,M,n)}else{if(t.getExitProcess()&&Ut(!0),a||(a=!0,i&&(t.showHelp("error"),q.error()),(P||M)&&q.error(P||M),s&&((P||M)&&q.error(""),q.error(s))),M=M||new ge(P),t.getExitProcess())return t.exit(1);if(t.getInternalMethods().hasParseCallback())return t.exit(1,M);throw M}};let c=[],l=!1;n.usage=(R,P)=>R===null?(l=!0,c=[],n):(l=!1,c.push([R,P||""]),n),n.getUsage=()=>c,n.getUsageDisabled=()=>l,n.getPositionalGroupName=()=>r("Positionals:");let u=[];n.example=(R,P)=>{u.push([R,P||""])};let p=[];n.command=function(P,M,q,se,re=!1){q&&(p=p.map(Y=>(Y[2]=!1,Y))),p.push([P,M||"",q,se,re])},n.getCommands=()=>p;let m={};n.describe=function(P,M){Array.isArray(P)?P.forEach(q=>{n.describe(q,M)}):typeof P=="object"?Object.keys(P).forEach(q=>{n.describe(q,P[q])}):m[P]=M},n.getDescriptions=()=>m;let d=[];n.epilog=R=>{d.push(R)};let b=!1,h;n.wrap=R=>{b=!0,h=R};function C(){return b||(h=ne(),b=!0),h}let x="__yargsString__:";n.deferY18nLookup=R=>x+R,n.help=function(){if(O)return O;v();let P=t.customScriptName?t.$0:e.path.basename(t.$0),M=t.getDemandedOptions(),q=t.getDemandedCommands(),se=t.getDeprecatedOptions(),re=t.getGroups(),Y=t.getOptions(),le=[];le=le.concat(Object.keys(m)),le=le.concat(Object.keys(M)),le=le.concat(Object.keys(q)),le=le.concat(Object.keys(Y.default)),le=le.filter(F),le=Object.keys(le.reduce((U,ce)=>(ce!=="_"&&(U[ce]=!0),U),{}));let Ne=C(),pe=e.cliui({width:Ne,wrap:!!Ne});if(!l){if(c.length)c.forEach(U=>{pe.div(`${U[0].replace(/\$0/g,P)}`),U[1]&&pe.div({text:`${U[1]}`,padding:[1,0,0,0]})}),pe.div();else if(p.length){let U=null;q._?U=`${P} <${r("command")}>
|
|
19
|
+
`:U=`${P} [${r("command")}]
|
|
20
|
+
`,pe.div(`${U}`)}}if(p.length>1||p.length===1&&!p[0][2]){pe.div(r("Commands:"));let U=t.getInternalMethods().getContext(),ce=U.commands.length?`${U.commands.join(" ")} `:"";t.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(p=p.sort((ie,ae)=>ie[0].localeCompare(ae[0]))),p.forEach(ie=>{let ae=`${P} ${ce}${ie[0].replace(/^\$0 ?/,"")}`;pe.span({text:ae,padding:[0,2,0,2],width:E(p,Ne,`${P}${ce}`)+4},{text:ie[1]});let ve=[];ie[2]&&ve.push(`[${r("default")}]`),ie[3]&&ie[3].length&&ve.push(`[${r("aliases:")} ${ie[3].join(", ")}]`),ie[4]&&(typeof ie[4]=="string"?ve.push(`[${r("deprecated: %s",ie[4])}]`):ve.push(`[${r("deprecated")}]`)),ve.length?pe.div({text:ve.join(" "),padding:[0,0,0,2],align:"right"}):pe.div()}),pe.div()}let Ze=(Object.keys(Y.alias)||[]).concat(Object.keys(t.parsed.newAliases)||[]);le=le.filter(U=>!t.parsed.newAliases[U]&&Ze.every(ce=>(Y.alias[ce]||[]).indexOf(U)===-1));let st=r("Options:");re[st]||(re[st]=[]),$(le,Y.alias,re,st);let V=U=>/^--/.test(eo(U)),_e=Object.keys(re).filter(U=>re[U].length>0).map(U=>{let ce=re[U].filter(F).map(ie=>{if(~Ze.indexOf(ie))return ie;for(let ae=0,ve;(ve=Ze[ae])!==void 0;ae++)if(~(Y.alias[ve]||[]).indexOf(ie))return ve;return ie});return{groupName:U,normalizedKeys:ce}}).filter(({normalizedKeys:U})=>U.length>0).map(({groupName:U,normalizedKeys:ce})=>{let ie=ce.reduce((ae,ve)=>(ae[ve]=[ve].concat(Y.alias[ve]||[]).map(He=>U===n.getPositionalGroupName()?He:(/^[0-9]$/.test(He)?~Y.boolean.indexOf(ve)?"-":"--":He.length>1?"--":"-")+He).sort((He,Pe)=>V(He)===V(Pe)?0:V(He)?1:-1).join(", "),ae),{});return{groupName:U,normalizedKeys:ce,switches:ie}});if(_e.filter(({groupName:U})=>U!==n.getPositionalGroupName()).some(({normalizedKeys:U,switches:ce})=>!U.every(ie=>V(ce[ie])))&&_e.filter(({groupName:U})=>U!==n.getPositionalGroupName()).forEach(({normalizedKeys:U,switches:ce})=>{U.forEach(ie=>{V(ce[ie])&&(ce[ie]=ay(ce[ie],4))})}),_e.forEach(({groupName:U,normalizedKeys:ce,switches:ie})=>{pe.div(U),ce.forEach(ae=>{let ve=ie[ae],He=m[ae]||"",Pe=null;~He.lastIndexOf(x)&&(He=r(He.substring(x.length))),~Y.boolean.indexOf(ae)&&(Pe=`[${r("boolean")}]`),~Y.count.indexOf(ae)&&(Pe=`[${r("count")}]`),~Y.string.indexOf(ae)&&(Pe=`[${r("string")}]`),~Y.normalize.indexOf(ae)&&(Pe=`[${r("string")}]`),~Y.array.indexOf(ae)&&(Pe=`[${r("array")}]`),~Y.number.indexOf(ae)&&(Pe=`[${r("number")}]`);let $o=w=>typeof w=="string"?`[${r("deprecated: %s",w)}]`:`[${r("deprecated")}]`,y=[ae in se?$o(se[ae]):null,Pe,ae in M?`[${r("required")}]`:null,Y.choices&&Y.choices[ae]?`[${r("choices:")} ${n.stringifiedValues(Y.choices[ae])}]`:null,D(Y.default[ae],Y.defaultDescription[ae])].filter(Boolean).join(" ");pe.span({text:eo(ve),padding:[0,2,0,2+yl(ve)],width:E(ie,Ne)+4},He),y?pe.div({text:y,padding:[0,0,0,2],align:"right"}):pe.div()}),pe.div()}),u.length&&(pe.div(r("Examples:")),u.forEach(U=>{U[0]=U[0].replace(/\$0/g,P)}),u.forEach(U=>{U[1]===""?pe.div({text:U[0],padding:[0,2,0,2]}):pe.div({text:U[0],padding:[0,2,0,2],width:E(u,Ne)+4},{text:U[1]})}),pe.div()),d.length>0){let U=d.map(ce=>ce.replace(/\$0/g,P)).join(`
|
|
21
|
+
`);pe.div(`${U}
|
|
22
|
+
`)}return pe.toString().replace(/\s*$/,"")};function E(R,P,M){let q=0;return Array.isArray(R)||(R=Object.values(R).map(se=>[se])),R.forEach(se=>{q=Math.max(e.stringWidth(M?`${M} ${eo(se[0])}`:eo(se[0]))+yl(se[0]),q)}),P&&(q=Math.min(q,parseInt((P*.5).toString(),10))),q}function v(){let R=t.getDemandedOptions(),P=t.getOptions();(Object.keys(P.alias)||[]).forEach(M=>{P.alias[M].forEach(q=>{m[q]&&n.describe(M,m[q]),q in R&&t.demandOption(M,R[q]),~P.boolean.indexOf(q)&&t.boolean(M),~P.count.indexOf(q)&&t.count(M),~P.string.indexOf(q)&&t.string(M),~P.normalize.indexOf(q)&&t.normalize(M),~P.array.indexOf(q)&&t.array(M),~P.number.indexOf(q)&&t.number(M)})})}let O;n.cacheHelpMessage=function(){O=this.help()},n.clearCachedHelpMessage=function(){O=void 0},n.hasCachedHelpMessage=function(){return!!O};function $(R,P,M,q){let se=[],re=null;return Object.keys(M).forEach(Y=>{se=se.concat(M[Y])}),R.forEach(Y=>{re=[Y].concat(P[Y]),re.some(le=>se.indexOf(le)!==-1)||M[q].push(Y)}),se}function F(R){return t.getOptions().hiddenOptions.indexOf(R)<0||t.parsed.argv[t.getOptions().showHiddenOpt]}n.showHelp=R=>{let P=t.getInternalMethods().getLoggerInstance();R||(R="error"),(typeof R=="function"?R:P[R])(n.help())},n.functionDescription=R=>["(",R.name?e.Parser.decamelize(R.name,"-"):r("generated-value"),")"].join(""),n.stringifiedValues=function(P,M){let q="",se=M||", ",re=[].concat(P);return!P||!re.length||re.forEach(Y=>{q.length&&(q+=se),q+=JSON.stringify(Y)}),q};function D(R,P){let M=`[${r("default:")} `;if(R===void 0&&!P)return null;if(P)M+=P;else switch(typeof R){case"string":M+=`"${R}"`;break;case"object":M+=JSON.stringify(R);break;default:M+=R}return`${M}]`}function ne(){return e.process.stdColumns?Math.min(80,e.process.stdColumns):80}let X=null;n.version=R=>{X=R},n.showVersion=R=>{let P=t.getInternalMethods().getLoggerInstance();R||(R="error"),(typeof R=="function"?R:P[R])(X)},n.reset=function(P){return s=null,a=!1,c=[],l=!1,d=[],u=[],p=[],m=Ft(m,M=>!P[M]),n};let ue=[];return n.freeze=function(){ue.push({failMessage:s,failureOutput:a,usages:c,usageDisabled:l,epilogs:d,examples:u,commands:p,descriptions:m})},n.unfreeze=function(){let P=ue.pop();P&&({failMessage:s,failureOutput:a,usages:c,usageDisabled:l,epilogs:d,examples:u,commands:p,descriptions:m}=P)},n}function gs(t){return typeof t=="object"}function ay(t,e){return gs(t)?{text:t.text,indentation:t.indentation+e}:{text:t,indentation:e}}function yl(t){return gs(t)?t.indentation:0}function eo(t){return gs(t)?t.text:t}var wl=`###-begin-{{app_name}}-completions-###
|
|
23
23
|
#
|
|
24
24
|
# yargs command completion script
|
|
25
25
|
#
|
|
@@ -47,7 +47,7 @@ _{{app_name}}_yargs_completions()
|
|
|
47
47
|
}
|
|
48
48
|
complete -o default -F _{{app_name}}_yargs_completions {{app_name}}
|
|
49
49
|
###-end-{{app_name}}-completions-###
|
|
50
|
-
`,
|
|
50
|
+
`,Sl=`#compdef {{app_name}}
|
|
51
51
|
###-begin-{{app_name}}-completions-###
|
|
52
52
|
#
|
|
53
53
|
# yargs command completion script
|
|
@@ -66,174 +66,253 @@ _{{app_name}}_yargs_completions()
|
|
|
66
66
|
}
|
|
67
67
|
compdef _{{app_name}}_yargs_completions {{app_name}}
|
|
68
68
|
###-end-{{app_name}}-completions-###
|
|
69
|
-
`;var
|
|
70
|
-
${
|
|
71
|
-
`)}`:"";e.fail(o("Missing required argument: %s","Missing required arguments: %s",Object.keys(d).length,Object.keys(d).join(", ")+h))}},s.unknownArguments=function(
|
|
72
|
-
${n("Argument: %s, Given: %s, Choices: %s",
|
|
73
|
-
`;m.forEach(w=>{d+=w}),e.fail(d)}};let c={};s.conflicts=function(l,m){L("<string|object> [array|string]",[l,m],arguments.length),typeof l=="object"?Object.keys(l).forEach(d=>{s.conflicts(d,l[d])}):(t.global(l),c[l]||(c[l]=[]),Array.isArray(m)?m.forEach(d=>s.conflicts(l,d)):c[l].push(m))},s.getConflicting=()=>c,s.conflicting=function(l){Object.keys(l).forEach(m=>{c[m]&&c[m].forEach(d=>{d&&l[m]!==void 0&&l[d]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",m,d))})})},s.recommendCommands=function(l,m){m=m.sort((x,C)=>C.length-x.length);let w=null,h=1/0;for(let x=0,C;(C=m[x])!==void 0;x++){let O=Zc(l,C);O<=3&&O<h&&(h=O,w=C)}w&&e.fail(n("Did you mean %s?",w))},s.reset=function(l){return i=It(i,m=>!l[m]),c=It(c,m=>!l[m]),s};let p=[];return s.freeze=function(){p.push({implied:i,conflicting:c})},s.unfreeze=function(){let l=p.pop();Ue(l,void 0,r),{implied:i,conflicting:c}=l},s}var os=[],Hr;function Yr(t,e,r,n){Hr=n;let o={};if(Object.prototype.hasOwnProperty.call(t,"extends")){if(typeof t.extends!="string")return o;let s=/\.json|\..*rc$/.test(t.extends),i=null;if(s)i=wg(e,t.extends);else try{i=We.resolve(t.extends)}catch{return t}Sg(i),os.push(i),o=s?JSON.parse(Hr.readFileSync(i,"utf8")):We(t.extends),delete t.extends,o=Yr(o,Hr.path.dirname(i),r,Hr)}return os=[],r?tl(o,t):Object.assign({},o,t)}function Sg(t){if(os.indexOf(t)>-1)throw new me(`Circular extended configurations: '${t}'.`)}function wg(t,e){return Hr.path.resolve(t,e)}function tl(t,e){let r={};function n(o){return o&&typeof o=="object"&&!Array.isArray(o)}Object.assign(r,t);for(let o of Object.keys(e))n(e[o])&&n(r[o])?r[o]=tl(t[o],e[o]):r[o]=e[o];return r}var F=function(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r},f=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)},we,Gt,Kr,it,Ke,qn,jt,Ht,at,Wn,ct,St,Je,lt,yr,Re,q,zn,Vn,Xe,Yt,br,Kt,Dt,Bn,J,Jt,Xt,Zt,X,xt,be;function bl(t){return(e=[],r=t.process.cwd(),n)=>{let o=new hs(e,r,n,t);return Object.defineProperty(o,"argv",{get:()=>o.parse(),enumerable:!0}),o.help(),o.version(),o}}var rl=Symbol("copyDoubleDash"),nl=Symbol("copyDoubleDash"),ss=Symbol("deleteFromParserHintObject"),ol=Symbol("freeze"),sl=Symbol("getDollarZero"),Qt=Symbol("getParserConfiguration"),is=Symbol("guessLocale"),il=Symbol("guessVersion"),al=Symbol("parsePositionalNumbers"),as=Symbol("pkgUp"),Nt=Symbol("populateParserHintArray"),Sr=Symbol("populateParserHintSingleValueDictionary"),cs=Symbol("populateParserHintArrayDictionary"),ls=Symbol("populateParserHintDictionary"),ps=Symbol("sanitizeKey"),us=Symbol("setKey"),fs=Symbol("unfreeze"),cl=Symbol("validateAsync"),ll=Symbol("getCommandInstance"),pl=Symbol("getContext"),ul=Symbol("getHasOutput"),fl=Symbol("getLoggerInstance"),ml=Symbol("getParseContext"),dl=Symbol("getUsageInstance"),hl=Symbol("getValidationInstance"),Gn=Symbol("hasParseCallback"),er=Symbol("postProcess"),gl=Symbol("rebase"),ms=Symbol("reset"),Jr=Symbol("runYargsParserAndExecuteCommands"),ds=Symbol("runValidation"),yl=Symbol("setHasOutput"),hs=class{constructor(e=[],r,n,o){this.customScriptName=!1,this.parsed=!1,we.set(this,void 0),Gt.set(this,void 0),Kr.set(this,{commands:[],fullCommands:[]}),it.set(this,null),Ke.set(this,null),qn.set(this,"show-hidden"),jt.set(this,null),Ht.set(this,!0),at.set(this,!0),Wn.set(this,[]),ct.set(this,void 0),St.set(this,{}),Je.set(this,!1),lt.set(this,null),yr.set(this,void 0),Re.set(this,""),q.set(this,void 0),zn.set(this,void 0),Vn.set(this,{}),Xe.set(this,null),Yt.set(this,null),br.set(this,{}),Kt.set(this,{}),Dt.set(this,void 0),Bn.set(this,!1),J.set(this,void 0),Jt.set(this,!1),Xt.set(this,!1),Zt.set(this,!1),X.set(this,void 0),xt.set(this,null),be.set(this,void 0),F(this,J,o),F(this,Dt,e),F(this,Gt,r),F(this,zn,n),F(this,ct,new Fn(this)),this.$0=this[sl](),this[ms](),F(this,we,f(this,we)),F(this,X,f(this,X)),F(this,be,f(this,be)),F(this,q,f(this,q)),f(this,q).showHiddenOpt=f(this,qn),F(this,yr,this[nl]())}addHelpOpt(e,r){let n="help";return L("[string|boolean] [string]",[e,r],arguments.length),f(this,lt)&&(this[ss](f(this,lt)),F(this,lt,null)),e===!1&&r===void 0?this:(F(this,lt,typeof e=="string"?e:n),this.boolean(f(this,lt)),this.describe(f(this,lt),r||f(this,X).deferY18nLookup("Show help")),this)}help(e,r){return this.addHelpOpt(e,r)}addShowHiddenOpt(e,r){if(L("[string|boolean] [string]",[e,r],arguments.length),e===!1&&r===void 0)return this;let n=typeof e=="string"?e:f(this,qn);return this.boolean(n),this.describe(n,r||f(this,X).deferY18nLookup("Show hidden options")),f(this,q).showHiddenOpt=n,this}showHidden(e,r){return this.addShowHiddenOpt(e,r)}alias(e,r){return L("<object|string|array> [string|array]",[e,r],arguments.length),this[cs](this.alias.bind(this),"alias",e,r),this}array(e){return L("<array|string>",[e],arguments.length),this[Nt]("array",e),this}boolean(e){return L("<array|string>",[e],arguments.length),this[Nt]("boolean",e),this}check(e,r){return L("<function> [boolean]",[e,r],arguments.length),this.middleware((n,o)=>Bt(()=>e(n),s=>(s?(typeof s=="string"||s instanceof Error)&&f(this,X).fail(s.toString(),s):f(this,X).fail(f(this,J).y18n.__("Argument check failed: %s",e.toString())),n),s=>(f(this,X).fail(s.message?s.message:s.toString(),s),n)),!1,r),this}choices(e,r){return L("<object|string|array> [string|array]",[e,r],arguments.length),this[cs](this.choices.bind(this),"choices",e,r),this}coerce(e,r){if(L("<object|string|array> [function]",[e,r],arguments.length),Array.isArray(e)){if(!r)throw new me("coerce callback must be provided");for(let n of e)this.coerce(n,r);return this}else if(typeof e=="object"){for(let n of Object.keys(e))this.coerce(n,e[n]);return this}if(!r)throw new me("coerce callback must be provided");return f(this,q).key[e]=!0,f(this,ct).addCoerceMiddleware((n,o)=>{let s;return Bt(()=>(s=o.getAliases(),r(n[e])),i=>{if(n[e]=i,s[e])for(let a of s[e])n[a]=i;return n},i=>{throw new me(i.message)})},e),this}conflicts(e,r){return L("<string|object> [string|array]",[e,r],arguments.length),f(this,be).conflicts(e,r),this}config(e="config",r,n){return L("[object|string] [string|function] [function]",[e,r,n],arguments.length),typeof e=="object"&&!Array.isArray(e)?(e=Yr(e,f(this,Gt),this[Qt]()["deep-merge-config"]||!1,f(this,J)),f(this,q).configObjects=(f(this,q).configObjects||[]).concat(e),this):(typeof r=="function"&&(n=r,r=void 0),this.describe(e,r||f(this,X).deferY18nLookup("Path to JSON config file")),(Array.isArray(e)?e:[e]).forEach(o=>{f(this,q).config[o]=n||!0}),this)}completion(e,r,n){return L("[string] [string|boolean|function] [function]",[e,r,n],arguments.length),typeof r=="function"&&(n=r,r=void 0),F(this,Ke,e||f(this,Ke)||"completion"),!r&&r!==!1&&(r="generate completion script"),this.command(f(this,Ke),r),n&&f(this,it).registerFunction(n),this}command(e,r,n,o,s,i){return L("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[e,r,n,o,s,i],arguments.length),f(this,we).addHandler(e,r,n,o,s,i),this}commands(e,r,n,o,s,i){return this.command(e,r,n,o,s,i)}commandDir(e,r){L("<string> [object]",[e,r],arguments.length);let n=f(this,zn)||f(this,J).require;return f(this,we).addDirectory(e,n,f(this,J).getCallerFile(),r),this}count(e){return L("<array|string>",[e],arguments.length),this[Nt]("count",e),this}default(e,r,n){return L("<object|string|array> [*] [string]",[e,r,n],arguments.length),n&&(Qo(e,f(this,J)),f(this,q).defaultDescription[e]=n),typeof r=="function"&&(Qo(e,f(this,J)),f(this,q).defaultDescription[e]||(f(this,q).defaultDescription[e]=f(this,X).functionDescription(r)),r=r.call()),this[Sr](this.default.bind(this),"default",e,r),this}defaults(e,r,n){return this.default(e,r,n)}demandCommand(e=1,r,n,o){return L("[number] [number|string] [string|null|undefined] [string|null|undefined]",[e,r,n,o],arguments.length),typeof r!="number"&&(n=r,r=1/0),this.global("_",!1),f(this,q).demandedCommands._={min:e,max:r,minMsg:n,maxMsg:o},this}demand(e,r,n){return Array.isArray(r)?(r.forEach(o=>{Ue(n,!0,f(this,J)),this.demandOption(o,n)}),r=1/0):typeof r!="number"&&(n=r,r=1/0),typeof e=="number"?(Ue(n,!0,f(this,J)),this.demandCommand(e,r,n,n)):Array.isArray(e)?e.forEach(o=>{Ue(n,!0,f(this,J)),this.demandOption(o,n)}):typeof n=="string"?this.demandOption(e,n):(n===!0||typeof n>"u")&&this.demandOption(e),this}demandOption(e,r){return L("<object|string|array> [string]",[e,r],arguments.length),this[Sr](this.demandOption.bind(this),"demandedOptions",e,r),this}deprecateOption(e,r){return L("<string> [string|boolean]",[e,r],arguments.length),f(this,q).deprecatedOptions[e]=r,this}describe(e,r){return L("<object|string|array> [string]",[e,r],arguments.length),this[us](e,!0),f(this,X).describe(e,r),this}detectLocale(e){return L("<boolean>",[e],arguments.length),F(this,Ht,e),this}env(e){return L("[string|boolean]",[e],arguments.length),e===!1?delete f(this,q).envPrefix:f(this,q).envPrefix=e||"",this}epilogue(e){return L("<string>",[e],arguments.length),f(this,X).epilog(e),this}epilog(e){return this.epilogue(e)}example(e,r){return L("<string|array> [string]",[e,r],arguments.length),Array.isArray(e)?e.forEach(n=>this.example(...n)):f(this,X).example(e,r),this}exit(e,r){F(this,Je,!0),F(this,jt,r),f(this,at)&&f(this,J).process.exit(e)}exitProcess(e=!0){return L("[boolean]",[e],arguments.length),F(this,at,e),this}fail(e){if(L("<function|boolean>",[e],arguments.length),typeof e=="boolean"&&e!==!1)throw new me("Invalid first argument. Expected function or boolean 'false'");return f(this,X).failFn(e),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(e,r){return L("<array> [function]",[e,r],arguments.length),r?f(this,it).getCompletion(e,r):new Promise((n,o)=>{f(this,it).getCompletion(e,(s,i)=>{s?o(s):n(i)})})}getDemandedOptions(){return L([],0),f(this,q).demandedOptions}getDemandedCommands(){return L([],0),f(this,q).demandedCommands}getDeprecatedOptions(){return L([],0),f(this,q).deprecatedOptions}getDetectLocale(){return f(this,Ht)}getExitProcess(){return f(this,at)}getGroups(){return Object.assign({},f(this,St),f(this,Kt))}getHelp(){if(F(this,Je,!0),!f(this,X).hasCachedHelpMessage()){if(!this.parsed){let r=this[Jr](f(this,Dt),void 0,void 0,0,!0);if(he(r))return r.then(()=>f(this,X).help())}let e=f(this,we).runDefaultBuilderOn(this);if(he(e))return e.then(()=>f(this,X).help())}return Promise.resolve(f(this,X).help())}getOptions(){return f(this,q)}getStrict(){return f(this,Jt)}getStrictCommands(){return f(this,Xt)}getStrictOptions(){return f(this,Zt)}global(e,r){return L("<string|array> [boolean]",[e,r],arguments.length),e=[].concat(e),r!==!1?f(this,q).local=f(this,q).local.filter(n=>e.indexOf(n)===-1):e.forEach(n=>{f(this,q).local.indexOf(n)===-1&&f(this,q).local.push(n)}),this}group(e,r){L("<string|array> <string>",[e,r],arguments.length);let n=f(this,Kt)[r]||f(this,St)[r];f(this,Kt)[r]&&delete f(this,Kt)[r];let o={};return f(this,St)[r]=(n||[]).concat(e).filter(s=>o[s]?!1:o[s]=!0),this}hide(e){return L("<string>",[e],arguments.length),f(this,q).hiddenOptions.push(e),this}implies(e,r){return L("<string|object> [number|string|array]",[e,r],arguments.length),f(this,be).implies(e,r),this}locale(e){return L("[string]",[e],arguments.length),e?(F(this,Ht,!1),f(this,J).y18n.setLocale(e),this):(this[is](),f(this,J).y18n.getLocale())}middleware(e,r,n){return f(this,ct).addMiddleware(e,!!r,n)}nargs(e,r){return L("<string|object|array> [number]",[e,r],arguments.length),this[Sr](this.nargs.bind(this),"narg",e,r),this}normalize(e){return L("<array|string>",[e],arguments.length),this[Nt]("normalize",e),this}number(e){return L("<array|string>",[e],arguments.length),this[Nt]("number",e),this}option(e,r){if(L("<string|object> [object]",[e,r],arguments.length),typeof e=="object")Object.keys(e).forEach(n=>{this.options(n,e[n])});else{typeof r!="object"&&(r={}),f(this,q).key[e]=!0,r.alias&&this.alias(e,r.alias);let n=r.deprecate||r.deprecated;n&&this.deprecateOption(e,n);let o=r.demand||r.required||r.require;o&&this.demand(e,o),r.demandOption&&this.demandOption(e,typeof r.demandOption=="string"?r.demandOption:void 0),r.conflicts&&this.conflicts(e,r.conflicts),"default"in r&&this.default(e,r.default),r.implies!==void 0&&this.implies(e,r.implies),r.nargs!==void 0&&this.nargs(e,r.nargs),r.config&&this.config(e,r.configParser),r.normalize&&this.normalize(e),r.choices&&this.choices(e,r.choices),r.coerce&&this.coerce(e,r.coerce),r.group&&this.group(e,r.group),(r.boolean||r.type==="boolean")&&(this.boolean(e),r.alias&&this.boolean(r.alias)),(r.array||r.type==="array")&&(this.array(e),r.alias&&this.array(r.alias)),(r.number||r.type==="number")&&(this.number(e),r.alias&&this.number(r.alias)),(r.string||r.type==="string")&&(this.string(e),r.alias&&this.string(r.alias)),(r.count||r.type==="count")&&this.count(e),typeof r.global=="boolean"&&this.global(e,r.global),r.defaultDescription&&(f(this,q).defaultDescription[e]=r.defaultDescription),r.skipValidation&&this.skipValidation(e);let s=r.describe||r.description||r.desc;this.describe(e,s),r.hidden&&this.hide(e),r.requiresArg&&this.requiresArg(e)}return this}options(e,r){return this.option(e,r)}parse(e,r,n){L("[string|array] [function|boolean|object] [function]",[e,r,n],arguments.length),this[ol](),typeof e>"u"&&(e=f(this,Dt)),typeof r=="object"&&(F(this,Yt,r),r=n),typeof r=="function"&&(F(this,Xe,r),r=!1),r||F(this,Dt,e),f(this,Xe)&&F(this,at,!1);let o=this[Jr](e,!!r),s=this.parsed;return f(this,it).setParsed(this.parsed),he(o)?o.then(i=>(f(this,Xe)&&f(this,Xe).call(this,f(this,jt),i,f(this,Re)),i)).catch(i=>{throw f(this,Xe)&&f(this,Xe)(i,this.parsed.argv,f(this,Re)),i}).finally(()=>{this[fs](),this.parsed=s}):(f(this,Xe)&&f(this,Xe).call(this,f(this,jt),o,f(this,Re)),this[fs](),this.parsed=s,o)}parseAsync(e,r,n){let o=this.parse(e,r,n);return he(o)?o:Promise.resolve(o)}parseSync(e,r,n){let o=this.parse(e,r,n);if(he(o))throw new me(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return o}parserConfiguration(e){return L("<object>",[e],arguments.length),F(this,Vn,e),this}pkgConf(e,r){L("<string> [string]",[e,r],arguments.length);let n=null,o=this[as](r||f(this,Gt));return o[e]&&typeof o[e]=="object"&&(n=Yr(o[e],r||f(this,Gt),this[Qt]()["deep-merge-config"]||!1,f(this,J)),f(this,q).configObjects=(f(this,q).configObjects||[]).concat(n)),this}positional(e,r){L("<string> <object>",[e,r],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];r=It(r,(i,a)=>{let c=n.indexOf(i)!==-1;return i==="type"&&["string","number","boolean"].indexOf(a)===-1&&(c=!1),c});let o=f(this,Kr).fullCommands[f(this,Kr).fullCommands.length-1],s=o?f(this,we).cmdToParseOptions(o):{array:[],alias:{},default:{},demand:{}};return hr(s).forEach(i=>{let a=s[i];Array.isArray(a)?a.indexOf(e)!==-1&&(r[i]=!0):a[e]&&!(i in r)&&(r[i]=a[e])}),this.group(e,f(this,X).getPositionalGroupName()),this.option(e,r)}recommendCommands(e=!0){return L("[boolean]",[e],arguments.length),F(this,Bn,e),this}required(e,r,n){return this.demand(e,r,n)}require(e,r,n){return this.demand(e,r,n)}requiresArg(e){return L("<array|string|object> [number]",[e],arguments.length),typeof e=="string"&&f(this,q).narg[e]?this:(this[Sr](this.requiresArg.bind(this),"narg",e,NaN),this)}showCompletionScript(e,r){return L("[string] [string]",[e,r],arguments.length),e=e||this.$0,f(this,yr).log(f(this,it).generateCompletionScript(e,r||f(this,Ke)||"completion")),this}showHelp(e){if(L("[string|function]",[e],arguments.length),F(this,Je,!0),!f(this,X).hasCachedHelpMessage()){if(!this.parsed){let n=this[Jr](f(this,Dt),void 0,void 0,0,!0);if(he(n))return n.then(()=>{f(this,X).showHelp(e)}),this}let r=f(this,we).runDefaultBuilderOn(this);if(he(r))return r.then(()=>{f(this,X).showHelp(e)}),this}return f(this,X).showHelp(e),this}scriptName(e){return this.customScriptName=!0,this.$0=e,this}showHelpOnFail(e,r){return L("[boolean|string] [string]",[e,r],arguments.length),f(this,X).showHelpOnFail(e,r),this}showVersion(e){return L("[string|function]",[e],arguments.length),f(this,X).showVersion(e),this}skipValidation(e){return L("<array|string>",[e],arguments.length),this[Nt]("skipValidation",e),this}strict(e){return L("[boolean]",[e],arguments.length),F(this,Jt,e!==!1),this}strictCommands(e){return L("[boolean]",[e],arguments.length),F(this,Xt,e!==!1),this}strictOptions(e){return L("[boolean]",[e],arguments.length),F(this,Zt,e!==!1),this}string(e){return L("<array|string>",[e],arguments.length),this[Nt]("string",e),this}terminalWidth(){return L([],0),f(this,J).process.stdColumns}updateLocale(e){return this.updateStrings(e)}updateStrings(e){return L("<object>",[e],arguments.length),F(this,Ht,!1),f(this,J).y18n.updateLocale(e),this}usage(e,r,n,o){if(L("<string|null|undefined> [string|boolean] [function|object] [function]",[e,r,n,o],arguments.length),r!==void 0){if(Ue(e,null,f(this,J)),(e||"").match(/^\$0( |$)/))return this.command(e,r,n,o);throw new me(".usage() description must start with $0 if being used as alias for .command()")}else return f(this,X).usage(e),this}version(e,r,n){let o="version";if(L("[boolean|string] [string] [string]",[e,r,n],arguments.length),f(this,xt)&&(this[ss](f(this,xt)),f(this,X).version(void 0),F(this,xt,null)),arguments.length===0)n=this[il](),e=o;else if(arguments.length===1){if(e===!1)return this;n=e,e=o}else arguments.length===2&&(n=r,r=void 0);return F(this,xt,typeof e=="string"?e:o),r=r||f(this,X).deferY18nLookup("Show version number"),f(this,X).version(n||void 0),this.boolean(f(this,xt)),this.describe(f(this,xt),r),this}wrap(e){return L("<number|null|undefined>",[e],arguments.length),f(this,X).wrap(e),this}[(we=new WeakMap,Gt=new WeakMap,Kr=new WeakMap,it=new WeakMap,Ke=new WeakMap,qn=new WeakMap,jt=new WeakMap,Ht=new WeakMap,at=new WeakMap,Wn=new WeakMap,ct=new WeakMap,St=new WeakMap,Je=new WeakMap,lt=new WeakMap,yr=new WeakMap,Re=new WeakMap,q=new WeakMap,zn=new WeakMap,Vn=new WeakMap,Xe=new WeakMap,Yt=new WeakMap,br=new WeakMap,Kt=new WeakMap,Dt=new WeakMap,Bn=new WeakMap,J=new WeakMap,Jt=new WeakMap,Xt=new WeakMap,Zt=new WeakMap,X=new WeakMap,xt=new WeakMap,be=new WeakMap,rl)](e){if(!e._||!e["--"])return e;e._.push.apply(e._,e["--"]);try{delete e["--"]}catch{}return e}[nl](){return{log:(...e)=>{this[Gn]()||console.log(...e),F(this,Je,!0),f(this,Re).length&&F(this,Re,f(this,Re)+`
|
|
74
|
-
`),
|
|
75
|
-
`),
|
|
76
|
-
`),
|
|
77
|
-
`)),await n.login(r)}catch(n){t.verbose&&(
|
|
78
|
-
`),
|
|
79
|
-
`),
|
|
80
|
-
`)}import{writeFileSync as
|
|
81
|
-
`)):
|
|
82
|
-
`));let{bundle:
|
|
69
|
+
`;var ys=class{constructor(e,r,n,o){var s,i,a;this.yargs=e,this.usage=r,this.command=n,this.shim=o,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.zshShell=(a=((s=this.shim.getEnv("SHELL"))===null||s===void 0?void 0:s.includes("zsh"))||((i=this.shim.getEnv("ZSH_NAME"))===null||i===void 0?void 0:i.includes("zsh")))!==null&&a!==void 0?a:!1}defaultCompletion(e,r,n,o){let s=this.command.getCommandHandlers();for(let a=0,c=e.length;a<c;++a)if(s[e[a]]&&s[e[a]].builder){let l=s[e[a]].builder;if(Qn(l)){let u=this.yargs.getInternalMethods().reset();return l(u,!0),u.argv}}let i=[];this.commandCompletions(i,e,n),this.optionCompletions(i,e,r,n),o(null,i)}commandCompletions(e,r,n){let o=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&o[o.length-1]!==n&&this.usage.getCommands().forEach(s=>{let i=kt(s[0]).cmd;if(r.indexOf(i)===-1)if(!this.zshShell)e.push(i);else{let a=s[1]||"";e.push(i.replace(/:/g,"\\:")+":"+a)}})}optionCompletions(e,r,n,o){if(o.match(/^-/)||o===""&&e.length===0){let s=this.yargs.getOptions(),i=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(s.key).forEach(a=>{let c=!!s.configuration["boolean-negation"]&&s.boolean.includes(a);!i.includes(a)&&!this.argsContainKey(r,n,a,c)&&(this.completeOptionKey(a,e,o),c&&s.default[a]&&this.completeOptionKey(`no-${a}`,e,o))})}}argsContainKey(e,r,n,o){if(e.indexOf(`--${n}`)!==-1||o&&e.indexOf(`--no-${n}`)!==-1)return!0;if(this.aliases){for(let s of this.aliases[n])if(r[s]!==void 0)return!0}return!1}completeOptionKey(e,r,n){let o=this.usage.getDescriptions(),s=c=>/^--/.test(c),i=c=>/^[^0-9]$/.test(c),a=!s(n)&&i(e)?"-":"--";if(!this.zshShell)r.push(a+e);else{let c=o[e]||"";r.push(a+`${e.replace(/:/g,"\\:")}:${c.replace("__yargsString__:","")}`)}}customCompletion(e,r,n,o){if(Be(this.customCompletionFunction,null,this.shim),ly(this.customCompletionFunction)){let s=this.customCompletionFunction(n,r);return we(s)?s.then(i=>{this.shim.process.nextTick(()=>{o(null,i)})}).catch(i=>{this.shim.process.nextTick(()=>{o(i,void 0)})}):o(null,s)}else return py(this.customCompletionFunction)?this.customCompletionFunction(n,r,(s=o)=>this.defaultCompletion(e,r,n,s),s=>{o(null,s)}):this.customCompletionFunction(n,r,s=>{o(null,s)})}getCompletion(e,r){let n=e.length?e[e.length-1]:"",o=this.yargs.parse(e,!0),s=this.customCompletionFunction?i=>this.customCompletion(e,i,n,r):i=>this.defaultCompletion(e,i,n,r);return we(o)?o.then(s):s(o)}generateCompletionScript(e,r){let n=this.zshShell?Sl:wl,o=this.shim.path.basename(e);return e.match(/\.js$/)&&(e=`./${e}`),n=n.replace(/{{app_name}}/g,o),n=n.replace(/{{completion_command}}/g,r),n.replace(/{{app_path}}/g,e)}registerFunction(e){this.customCompletionFunction=e}setParsed(e){this.aliases=e.aliases}};function El(t,e,r,n){return new ys(t,e,r,n)}function ly(t){return t.length<3}function py(t){return t.length>3}function Cl(t,e){if(t.length===0)return e.length;if(e.length===0)return t.length;let r=[],n;for(n=0;n<=e.length;n++)r[n]=[n];let o;for(o=0;o<=t.length;o++)r[0][o]=o;for(n=1;n<=e.length;n++)for(o=1;o<=t.length;o++)e.charAt(n-1)===t.charAt(o-1)?r[n][o]=r[n-1][o-1]:r[n][o]=Math.min(r[n-1][o-1]+1,Math.min(r[n][o-1]+1,r[n-1][o]+1));return r[e.length][t.length]}var Ol=["$0","--","_"];function xl(t,e,r){let n=r.y18n.__,o=r.y18n.__n,s={};s.nonOptionCount=function(p){let m=t.getDemandedCommands(),b=p._.length+(p["--"]?p["--"].length:0)-t.getInternalMethods().getContext().commands.length;m._&&(b<m._.min||b>m._.max)&&(b<m._.min?m._.minMsg!==void 0?e.fail(m._.minMsg?m._.minMsg.replace(/\$0/g,b.toString()).replace(/\$1/,m._.min.toString()):null):e.fail(o("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",b,b.toString(),m._.min.toString())):b>m._.max&&(m._.maxMsg!==void 0?e.fail(m._.maxMsg?m._.maxMsg.replace(/\$0/g,b.toString()).replace(/\$1/,m._.max.toString()):null):e.fail(o("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",b,b.toString(),m._.max.toString()))))},s.positionalCount=function(p,m){m<p&&e.fail(o("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",m,m+"",p+""))},s.requiredArguments=function(p,m){let d=null;for(let b of Object.keys(m))(!Object.prototype.hasOwnProperty.call(p,b)||typeof p[b]>"u")&&(d=d||{},d[b]=m[b]);if(d){let b=[];for(let C of Object.keys(d)){let x=d[C];x&&b.indexOf(x)<0&&b.push(x)}let h=b.length?`
|
|
70
|
+
${b.join(`
|
|
71
|
+
`)}`:"";e.fail(o("Missing required argument: %s","Missing required arguments: %s",Object.keys(d).length,Object.keys(d).join(", ")+h))}},s.unknownArguments=function(p,m,d,b,h=!0){let C=t.getInternalMethods().getCommandInstance().getCommands(),x=[],E=t.getInternalMethods().getContext();Object.keys(p).forEach(v=>{Ol.indexOf(v)===-1&&!Object.prototype.hasOwnProperty.call(d,v)&&!Object.prototype.hasOwnProperty.call(t.getInternalMethods().getParseContext(),v)&&!s.isValidAndSomeAliasIsNotNew(v,m)&&x.push(v)}),h&&(E.commands.length>0||C.length>0||b)&&p._.slice(E.commands.length).forEach(v=>{C.indexOf(""+v)===-1&&x.push(""+v)}),x.length>0&&e.fail(o("Unknown argument: %s","Unknown arguments: %s",x.length,x.join(", ")))},s.unknownCommands=function(p){let m=t.getInternalMethods().getCommandInstance().getCommands(),d=[],b=t.getInternalMethods().getContext();return(b.commands.length>0||m.length>0)&&p._.slice(b.commands.length).forEach(h=>{m.indexOf(""+h)===-1&&d.push(""+h)}),d.length>0?(e.fail(o("Unknown command: %s","Unknown commands: %s",d.length,d.join(", "))),!0):!1},s.isValidAndSomeAliasIsNotNew=function(p,m){if(!Object.prototype.hasOwnProperty.call(m,p))return!1;let d=t.parsed.newAliases;return[p,...m[p]].some(b=>!Object.prototype.hasOwnProperty.call(d,b)||!d[p])},s.limitedChoices=function(p){let m=t.getOptions(),d={};if(!Object.keys(m.choices).length)return;Object.keys(p).forEach(C=>{Ol.indexOf(C)===-1&&Object.prototype.hasOwnProperty.call(m.choices,C)&&[].concat(p[C]).forEach(x=>{m.choices[C].indexOf(x)===-1&&x!==void 0&&(d[C]=(d[C]||[]).concat(x))})});let b=Object.keys(d);if(!b.length)return;let h=n("Invalid values:");b.forEach(C=>{h+=`
|
|
72
|
+
${n("Argument: %s, Given: %s, Choices: %s",C,e.stringifiedValues(d[C]),e.stringifiedValues(m.choices[C]))}`}),e.fail(h)};let i={};s.implies=function(p,m){L("<string|object> [array|number|string]",[p,m],arguments.length),typeof p=="object"?Object.keys(p).forEach(d=>{s.implies(d,p[d])}):(t.global(p),i[p]||(i[p]=[]),Array.isArray(m)?m.forEach(d=>s.implies(p,d)):(Be(m,void 0,r),i[p].push(m)))},s.getImplied=function(){return i};function a(u,p){let m=Number(p);return p=isNaN(m)?p:m,typeof p=="number"?p=u._.length>=p:p.match(/^--no-.+/)?(p=p.match(/^--no-(.+)/)[1],p=!u[p]):p=u[p],p}s.implications=function(p){let m=[];if(Object.keys(i).forEach(d=>{let b=d;(i[d]||[]).forEach(h=>{let C=b,x=h;C=a(p,C),h=a(p,h),C&&!h&&m.push(` ${b} -> ${x}`)})}),m.length){let d=`${n("Implications failed:")}
|
|
73
|
+
`;m.forEach(b=>{d+=b}),e.fail(d)}};let c={};s.conflicts=function(p,m){L("<string|object> [array|string]",[p,m],arguments.length),typeof p=="object"?Object.keys(p).forEach(d=>{s.conflicts(d,p[d])}):(t.global(p),c[p]||(c[p]=[]),Array.isArray(m)?m.forEach(d=>s.conflicts(p,d)):c[p].push(m))},s.getConflicting=()=>c,s.conflicting=function(p){Object.keys(p).forEach(m=>{c[m]&&c[m].forEach(d=>{d&&p[m]!==void 0&&p[d]!==void 0&&e.fail(n("Arguments %s and %s are mutually exclusive",m,d))})})},s.recommendCommands=function(p,m){m=m.sort((C,x)=>x.length-C.length);let b=null,h=1/0;for(let C=0,x;(x=m[C])!==void 0;C++){let E=Cl(p,x);E<=3&&E<h&&(h=E,b=x)}b&&e.fail(n("Did you mean %s?",b))},s.reset=function(p){return i=Ft(i,m=>!p[m]),c=Ft(c,m=>!p[m]),s};let l=[];return s.freeze=function(){l.push({implied:i,conflicting:c})},s.unfreeze=function(){let p=l.pop();Be(p,void 0,r),{implied:i,conflicting:c}=p},s}var bs=[],sn;function an(t,e,r,n){sn=n;let o={};if(Object.prototype.hasOwnProperty.call(t,"extends")){if(typeof t.extends!="string")return o;let s=/\.json|\..*rc$/.test(t.extends),i=null;if(s)i=fy(e,t.extends);else try{i=Ye.resolve(t.extends)}catch{return t}uy(i),bs.push(i),o=s?JSON.parse(sn.readFileSync(i,"utf8")):Ye(t.extends),delete t.extends,o=an(o,sn.path.dirname(i),r,sn)}return bs=[],r?Al(o,t):Object.assign({},o,t)}function uy(t){if(bs.indexOf(t)>-1)throw new ge(`Circular extended configurations: '${t}'.`)}function fy(t,e){return sn.path.resolve(t,e)}function Al(t,e){let r={};function n(o){return o&&typeof o=="object"&&!Array.isArray(o)}Object.assign(r,t);for(let o of Object.keys(e))n(e[o])&&n(r[o])?r[o]=Al(t[o],e[o]):r[o]=e[o];return r}var k=function(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r},f=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)},Ae,er,cn,mt,tt,to,qt,tr,dt,ro,ht,Pt,rt,gt,Pr,Te,W,no,oo,nt,rr,$r,nr,Wt,so,K,or,sr,ir,J,Nt,Ce;function Wl(t){return(e=[],r=t.process.cwd(),n)=>{let o=new Rs(e,r,n,t);return Object.defineProperty(o,"argv",{get:()=>o.parse(),enumerable:!0}),o.help(),o.version(),o}}var vl=Symbol("copyDoubleDash"),Pl=Symbol("copyDoubleDash"),ws=Symbol("deleteFromParserHintObject"),$l=Symbol("freeze"),Rl=Symbol("getDollarZero"),ar=Symbol("getParserConfiguration"),Ss=Symbol("guessLocale"),_l=Symbol("guessVersion"),jl=Symbol("parsePositionalNumbers"),Es=Symbol("pkgUp"),zt=Symbol("populateParserHintArray"),Rr=Symbol("populateParserHintSingleValueDictionary"),Cs=Symbol("populateParserHintArrayDictionary"),Os=Symbol("populateParserHintDictionary"),xs=Symbol("sanitizeKey"),As=Symbol("setKey"),vs=Symbol("unfreeze"),Il=Symbol("validateAsync"),Tl=Symbol("getCommandInstance"),Nl=Symbol("getContext"),Ll=Symbol("getHasOutput"),Dl=Symbol("getLoggerInstance"),Ml=Symbol("getParseContext"),kl=Symbol("getUsageInstance"),Fl=Symbol("getValidationInstance"),io=Symbol("hasParseCallback"),cr=Symbol("postProcess"),Ul=Symbol("rebase"),Ps=Symbol("reset"),ln=Symbol("runYargsParserAndExecuteCommands"),$s=Symbol("runValidation"),ql=Symbol("setHasOutput"),Rs=class{constructor(e=[],r,n,o){this.customScriptName=!1,this.parsed=!1,Ae.set(this,void 0),er.set(this,void 0),cn.set(this,{commands:[],fullCommands:[]}),mt.set(this,null),tt.set(this,null),to.set(this,"show-hidden"),qt.set(this,null),tr.set(this,!0),dt.set(this,!0),ro.set(this,[]),ht.set(this,void 0),Pt.set(this,{}),rt.set(this,!1),gt.set(this,null),Pr.set(this,void 0),Te.set(this,""),W.set(this,void 0),no.set(this,void 0),oo.set(this,{}),nt.set(this,null),rr.set(this,null),$r.set(this,{}),nr.set(this,{}),Wt.set(this,void 0),so.set(this,!1),K.set(this,void 0),or.set(this,!1),sr.set(this,!1),ir.set(this,!1),J.set(this,void 0),Nt.set(this,null),Ce.set(this,void 0),k(this,K,o),k(this,Wt,e),k(this,er,r),k(this,no,n),k(this,ht,new Zn(this)),this.$0=this[Rl](),this[Ps](),k(this,Ae,f(this,Ae)),k(this,J,f(this,J)),k(this,Ce,f(this,Ce)),k(this,W,f(this,W)),f(this,W).showHiddenOpt=f(this,to),k(this,Pr,this[Pl]())}addHelpOpt(e,r){let n="help";return L("[string|boolean] [string]",[e,r],arguments.length),f(this,gt)&&(this[ws](f(this,gt)),k(this,gt,null)),e===!1&&r===void 0?this:(k(this,gt,typeof e=="string"?e:n),this.boolean(f(this,gt)),this.describe(f(this,gt),r||f(this,J).deferY18nLookup("Show help")),this)}help(e,r){return this.addHelpOpt(e,r)}addShowHiddenOpt(e,r){if(L("[string|boolean] [string]",[e,r],arguments.length),e===!1&&r===void 0)return this;let n=typeof e=="string"?e:f(this,to);return this.boolean(n),this.describe(n,r||f(this,J).deferY18nLookup("Show hidden options")),f(this,W).showHiddenOpt=n,this}showHidden(e,r){return this.addShowHiddenOpt(e,r)}alias(e,r){return L("<object|string|array> [string|array]",[e,r],arguments.length),this[Cs](this.alias.bind(this),"alias",e,r),this}array(e){return L("<array|string>",[e],arguments.length),this[zt]("array",e),this}boolean(e){return L("<array|string>",[e],arguments.length),this[zt]("boolean",e),this}check(e,r){return L("<function> [boolean]",[e,r],arguments.length),this.middleware((n,o)=>Qt(()=>e(n),s=>(s?(typeof s=="string"||s instanceof Error)&&f(this,J).fail(s.toString(),s):f(this,J).fail(f(this,K).y18n.__("Argument check failed: %s",e.toString())),n),s=>(f(this,J).fail(s.message?s.message:s.toString(),s),n)),!1,r),this}choices(e,r){return L("<object|string|array> [string|array]",[e,r],arguments.length),this[Cs](this.choices.bind(this),"choices",e,r),this}coerce(e,r){if(L("<object|string|array> [function]",[e,r],arguments.length),Array.isArray(e)){if(!r)throw new ge("coerce callback must be provided");for(let n of e)this.coerce(n,r);return this}else if(typeof e=="object"){for(let n of Object.keys(e))this.coerce(n,e[n]);return this}if(!r)throw new ge("coerce callback must be provided");return f(this,W).key[e]=!0,f(this,ht).addCoerceMiddleware((n,o)=>{let s;return Qt(()=>(s=o.getAliases(),r(n[e])),i=>{if(n[e]=i,s[e])for(let a of s[e])n[a]=i;return n},i=>{throw new ge(i.message)})},e),this}conflicts(e,r){return L("<string|object> [string|array]",[e,r],arguments.length),f(this,Ce).conflicts(e,r),this}config(e="config",r,n){return L("[object|string] [string|function] [function]",[e,r,n],arguments.length),typeof e=="object"&&!Array.isArray(e)?(e=an(e,f(this,er),this[ar]()["deep-merge-config"]||!1,f(this,K)),f(this,W).configObjects=(f(this,W).configObjects||[]).concat(e),this):(typeof r=="function"&&(n=r,r=void 0),this.describe(e,r||f(this,J).deferY18nLookup("Path to JSON config file")),(Array.isArray(e)?e:[e]).forEach(o=>{f(this,W).config[o]=n||!0}),this)}completion(e,r,n){return L("[string] [string|boolean|function] [function]",[e,r,n],arguments.length),typeof r=="function"&&(n=r,r=void 0),k(this,tt,e||f(this,tt)||"completion"),!r&&r!==!1&&(r="generate completion script"),this.command(f(this,tt),r),n&&f(this,mt).registerFunction(n),this}command(e,r,n,o,s,i){return L("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[e,r,n,o,s,i],arguments.length),f(this,Ae).addHandler(e,r,n,o,s,i),this}commands(e,r,n,o,s,i){return this.command(e,r,n,o,s,i)}commandDir(e,r){L("<string> [object]",[e,r],arguments.length);let n=f(this,no)||f(this,K).require;return f(this,Ae).addDirectory(e,n,f(this,K).getCallerFile(),r),this}count(e){return L("<array|string>",[e],arguments.length),this[zt]("count",e),this}default(e,r,n){return L("<object|string|array> [*] [string]",[e,r,n],arguments.length),n&&(ms(e,f(this,K)),f(this,W).defaultDescription[e]=n),typeof r=="function"&&(ms(e,f(this,K)),f(this,W).defaultDescription[e]||(f(this,W).defaultDescription[e]=f(this,J).functionDescription(r)),r=r.call()),this[Rr](this.default.bind(this),"default",e,r),this}defaults(e,r,n){return this.default(e,r,n)}demandCommand(e=1,r,n,o){return L("[number] [number|string] [string|null|undefined] [string|null|undefined]",[e,r,n,o],arguments.length),typeof r!="number"&&(n=r,r=1/0),this.global("_",!1),f(this,W).demandedCommands._={min:e,max:r,minMsg:n,maxMsg:o},this}demand(e,r,n){return Array.isArray(r)?(r.forEach(o=>{Be(n,!0,f(this,K)),this.demandOption(o,n)}),r=1/0):typeof r!="number"&&(n=r,r=1/0),typeof e=="number"?(Be(n,!0,f(this,K)),this.demandCommand(e,r,n,n)):Array.isArray(e)?e.forEach(o=>{Be(n,!0,f(this,K)),this.demandOption(o,n)}):typeof n=="string"?this.demandOption(e,n):(n===!0||typeof n>"u")&&this.demandOption(e),this}demandOption(e,r){return L("<object|string|array> [string]",[e,r],arguments.length),this[Rr](this.demandOption.bind(this),"demandedOptions",e,r),this}deprecateOption(e,r){return L("<string> [string|boolean]",[e,r],arguments.length),f(this,W).deprecatedOptions[e]=r,this}describe(e,r){return L("<object|string|array> [string]",[e,r],arguments.length),this[As](e,!0),f(this,J).describe(e,r),this}detectLocale(e){return L("<boolean>",[e],arguments.length),k(this,tr,e),this}env(e){return L("[string|boolean]",[e],arguments.length),e===!1?delete f(this,W).envPrefix:f(this,W).envPrefix=e||"",this}epilogue(e){return L("<string>",[e],arguments.length),f(this,J).epilog(e),this}epilog(e){return this.epilogue(e)}example(e,r){return L("<string|array> [string]",[e,r],arguments.length),Array.isArray(e)?e.forEach(n=>this.example(...n)):f(this,J).example(e,r),this}exit(e,r){k(this,rt,!0),k(this,qt,r),f(this,dt)&&f(this,K).process.exit(e)}exitProcess(e=!0){return L("[boolean]",[e],arguments.length),k(this,dt,e),this}fail(e){if(L("<function|boolean>",[e],arguments.length),typeof e=="boolean"&&e!==!1)throw new ge("Invalid first argument. Expected function or boolean 'false'");return f(this,J).failFn(e),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(e,r){return L("<array> [function]",[e,r],arguments.length),r?f(this,mt).getCompletion(e,r):new Promise((n,o)=>{f(this,mt).getCompletion(e,(s,i)=>{s?o(s):n(i)})})}getDemandedOptions(){return L([],0),f(this,W).demandedOptions}getDemandedCommands(){return L([],0),f(this,W).demandedCommands}getDeprecatedOptions(){return L([],0),f(this,W).deprecatedOptions}getDetectLocale(){return f(this,tr)}getExitProcess(){return f(this,dt)}getGroups(){return Object.assign({},f(this,Pt),f(this,nr))}getHelp(){if(k(this,rt,!0),!f(this,J).hasCachedHelpMessage()){if(!this.parsed){let r=this[ln](f(this,Wt),void 0,void 0,0,!0);if(we(r))return r.then(()=>f(this,J).help())}let e=f(this,Ae).runDefaultBuilderOn(this);if(we(e))return e.then(()=>f(this,J).help())}return Promise.resolve(f(this,J).help())}getOptions(){return f(this,W)}getStrict(){return f(this,or)}getStrictCommands(){return f(this,sr)}getStrictOptions(){return f(this,ir)}global(e,r){return L("<string|array> [boolean]",[e,r],arguments.length),e=[].concat(e),r!==!1?f(this,W).local=f(this,W).local.filter(n=>e.indexOf(n)===-1):e.forEach(n=>{f(this,W).local.indexOf(n)===-1&&f(this,W).local.push(n)}),this}group(e,r){L("<string|array> <string>",[e,r],arguments.length);let n=f(this,nr)[r]||f(this,Pt)[r];f(this,nr)[r]&&delete f(this,nr)[r];let o={};return f(this,Pt)[r]=(n||[]).concat(e).filter(s=>o[s]?!1:o[s]=!0),this}hide(e){return L("<string>",[e],arguments.length),f(this,W).hiddenOptions.push(e),this}implies(e,r){return L("<string|object> [number|string|array]",[e,r],arguments.length),f(this,Ce).implies(e,r),this}locale(e){return L("[string]",[e],arguments.length),e?(k(this,tr,!1),f(this,K).y18n.setLocale(e),this):(this[Ss](),f(this,K).y18n.getLocale())}middleware(e,r,n){return f(this,ht).addMiddleware(e,!!r,n)}nargs(e,r){return L("<string|object|array> [number]",[e,r],arguments.length),this[Rr](this.nargs.bind(this),"narg",e,r),this}normalize(e){return L("<array|string>",[e],arguments.length),this[zt]("normalize",e),this}number(e){return L("<array|string>",[e],arguments.length),this[zt]("number",e),this}option(e,r){if(L("<string|object> [object]",[e,r],arguments.length),typeof e=="object")Object.keys(e).forEach(n=>{this.options(n,e[n])});else{typeof r!="object"&&(r={}),f(this,W).key[e]=!0,r.alias&&this.alias(e,r.alias);let n=r.deprecate||r.deprecated;n&&this.deprecateOption(e,n);let o=r.demand||r.required||r.require;o&&this.demand(e,o),r.demandOption&&this.demandOption(e,typeof r.demandOption=="string"?r.demandOption:void 0),r.conflicts&&this.conflicts(e,r.conflicts),"default"in r&&this.default(e,r.default),r.implies!==void 0&&this.implies(e,r.implies),r.nargs!==void 0&&this.nargs(e,r.nargs),r.config&&this.config(e,r.configParser),r.normalize&&this.normalize(e),r.choices&&this.choices(e,r.choices),r.coerce&&this.coerce(e,r.coerce),r.group&&this.group(e,r.group),(r.boolean||r.type==="boolean")&&(this.boolean(e),r.alias&&this.boolean(r.alias)),(r.array||r.type==="array")&&(this.array(e),r.alias&&this.array(r.alias)),(r.number||r.type==="number")&&(this.number(e),r.alias&&this.number(r.alias)),(r.string||r.type==="string")&&(this.string(e),r.alias&&this.string(r.alias)),(r.count||r.type==="count")&&this.count(e),typeof r.global=="boolean"&&this.global(e,r.global),r.defaultDescription&&(f(this,W).defaultDescription[e]=r.defaultDescription),r.skipValidation&&this.skipValidation(e);let s=r.describe||r.description||r.desc;this.describe(e,s),r.hidden&&this.hide(e),r.requiresArg&&this.requiresArg(e)}return this}options(e,r){return this.option(e,r)}parse(e,r,n){L("[string|array] [function|boolean|object] [function]",[e,r,n],arguments.length),this[$l](),typeof e>"u"&&(e=f(this,Wt)),typeof r=="object"&&(k(this,rr,r),r=n),typeof r=="function"&&(k(this,nt,r),r=!1),r||k(this,Wt,e),f(this,nt)&&k(this,dt,!1);let o=this[ln](e,!!r),s=this.parsed;return f(this,mt).setParsed(this.parsed),we(o)?o.then(i=>(f(this,nt)&&f(this,nt).call(this,f(this,qt),i,f(this,Te)),i)).catch(i=>{throw f(this,nt)&&f(this,nt)(i,this.parsed.argv,f(this,Te)),i}).finally(()=>{this[vs](),this.parsed=s}):(f(this,nt)&&f(this,nt).call(this,f(this,qt),o,f(this,Te)),this[vs](),this.parsed=s,o)}parseAsync(e,r,n){let o=this.parse(e,r,n);return we(o)?o:Promise.resolve(o)}parseSync(e,r,n){let o=this.parse(e,r,n);if(we(o))throw new ge(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return o}parserConfiguration(e){return L("<object>",[e],arguments.length),k(this,oo,e),this}pkgConf(e,r){L("<string> [string]",[e,r],arguments.length);let n=null,o=this[Es](r||f(this,er));return o[e]&&typeof o[e]=="object"&&(n=an(o[e],r||f(this,er),this[ar]()["deep-merge-config"]||!1,f(this,K)),f(this,W).configObjects=(f(this,W).configObjects||[]).concat(n)),this}positional(e,r){L("<string> <object>",[e,r],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];r=Ft(r,(i,a)=>{let c=n.indexOf(i)!==-1;return i==="type"&&["string","number","boolean"].indexOf(a)===-1&&(c=!1),c});let o=f(this,cn).fullCommands[f(this,cn).fullCommands.length-1],s=o?f(this,Ae).cmdToParseOptions(o):{array:[],alias:{},default:{},demand:{}};return Ar(s).forEach(i=>{let a=s[i];Array.isArray(a)?a.indexOf(e)!==-1&&(r[i]=!0):a[e]&&!(i in r)&&(r[i]=a[e])}),this.group(e,f(this,J).getPositionalGroupName()),this.option(e,r)}recommendCommands(e=!0){return L("[boolean]",[e],arguments.length),k(this,so,e),this}required(e,r,n){return this.demand(e,r,n)}require(e,r,n){return this.demand(e,r,n)}requiresArg(e){return L("<array|string|object> [number]",[e],arguments.length),typeof e=="string"&&f(this,W).narg[e]?this:(this[Rr](this.requiresArg.bind(this),"narg",e,NaN),this)}showCompletionScript(e,r){return L("[string] [string]",[e,r],arguments.length),e=e||this.$0,f(this,Pr).log(f(this,mt).generateCompletionScript(e,r||f(this,tt)||"completion")),this}showHelp(e){if(L("[string|function]",[e],arguments.length),k(this,rt,!0),!f(this,J).hasCachedHelpMessage()){if(!this.parsed){let n=this[ln](f(this,Wt),void 0,void 0,0,!0);if(we(n))return n.then(()=>{f(this,J).showHelp(e)}),this}let r=f(this,Ae).runDefaultBuilderOn(this);if(we(r))return r.then(()=>{f(this,J).showHelp(e)}),this}return f(this,J).showHelp(e),this}scriptName(e){return this.customScriptName=!0,this.$0=e,this}showHelpOnFail(e,r){return L("[boolean|string] [string]",[e,r],arguments.length),f(this,J).showHelpOnFail(e,r),this}showVersion(e){return L("[string|function]",[e],arguments.length),f(this,J).showVersion(e),this}skipValidation(e){return L("<array|string>",[e],arguments.length),this[zt]("skipValidation",e),this}strict(e){return L("[boolean]",[e],arguments.length),k(this,or,e!==!1),this}strictCommands(e){return L("[boolean]",[e],arguments.length),k(this,sr,e!==!1),this}strictOptions(e){return L("[boolean]",[e],arguments.length),k(this,ir,e!==!1),this}string(e){return L("<array|string>",[e],arguments.length),this[zt]("string",e),this}terminalWidth(){return L([],0),f(this,K).process.stdColumns}updateLocale(e){return this.updateStrings(e)}updateStrings(e){return L("<object>",[e],arguments.length),k(this,tr,!1),f(this,K).y18n.updateLocale(e),this}usage(e,r,n,o){if(L("<string|null|undefined> [string|boolean] [function|object] [function]",[e,r,n,o],arguments.length),r!==void 0){if(Be(e,null,f(this,K)),(e||"").match(/^\$0( |$)/))return this.command(e,r,n,o);throw new ge(".usage() description must start with $0 if being used as alias for .command()")}else return f(this,J).usage(e),this}version(e,r,n){let o="version";if(L("[boolean|string] [string] [string]",[e,r,n],arguments.length),f(this,Nt)&&(this[ws](f(this,Nt)),f(this,J).version(void 0),k(this,Nt,null)),arguments.length===0)n=this[_l](),e=o;else if(arguments.length===1){if(e===!1)return this;n=e,e=o}else arguments.length===2&&(n=r,r=void 0);return k(this,Nt,typeof e=="string"?e:o),r=r||f(this,J).deferY18nLookup("Show version number"),f(this,J).version(n||void 0),this.boolean(f(this,Nt)),this.describe(f(this,Nt),r),this}wrap(e){return L("<number|null|undefined>",[e],arguments.length),f(this,J).wrap(e),this}[(Ae=new WeakMap,er=new WeakMap,cn=new WeakMap,mt=new WeakMap,tt=new WeakMap,to=new WeakMap,qt=new WeakMap,tr=new WeakMap,dt=new WeakMap,ro=new WeakMap,ht=new WeakMap,Pt=new WeakMap,rt=new WeakMap,gt=new WeakMap,Pr=new WeakMap,Te=new WeakMap,W=new WeakMap,no=new WeakMap,oo=new WeakMap,nt=new WeakMap,rr=new WeakMap,$r=new WeakMap,nr=new WeakMap,Wt=new WeakMap,so=new WeakMap,K=new WeakMap,or=new WeakMap,sr=new WeakMap,ir=new WeakMap,J=new WeakMap,Nt=new WeakMap,Ce=new WeakMap,vl)](e){if(!e._||!e["--"])return e;e._.push.apply(e._,e["--"]);try{delete e["--"]}catch{}return e}[Pl](){return{log:(...e)=>{this[io]()||console.log(...e),k(this,rt,!0),f(this,Te).length&&k(this,Te,f(this,Te)+`
|
|
74
|
+
`),k(this,Te,f(this,Te)+e.join(" "))},error:(...e)=>{this[io]()||console.error(...e),k(this,rt,!0),f(this,Te).length&&k(this,Te,f(this,Te)+`
|
|
75
|
+
`),k(this,Te,f(this,Te)+e.join(" "))}}}[ws](e){Ar(f(this,W)).forEach(r=>{if((o=>o==="configObjects")(r))return;let n=f(this,W)[r];Array.isArray(n)?~n.indexOf(e)&&n.splice(n.indexOf(e),1):typeof n=="object"&&delete n[e]}),delete f(this,J).getDescriptions()[e]}[$l](){f(this,ro).push({options:f(this,W),configObjects:f(this,W).configObjects.slice(0),exitProcess:f(this,dt),groups:f(this,Pt),strict:f(this,or),strictCommands:f(this,sr),strictOptions:f(this,ir),completionCommand:f(this,tt),output:f(this,Te),exitError:f(this,qt),hasOutput:f(this,rt),parsed:this.parsed,parseFn:f(this,nt),parseContext:f(this,rr)}),f(this,J).freeze(),f(this,Ce).freeze(),f(this,Ae).freeze(),f(this,ht).freeze()}[Rl](){let e="",r;return/\b(node|iojs|electron)(\.exe)?$/.test(f(this,K).process.argv()[0])?r=f(this,K).process.argv().slice(1,2):r=f(this,K).process.argv().slice(0,1),e=r.map(n=>{let o=this[Ul](f(this,er),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&o.length<n.length?o:n}).join(" ").trim(),f(this,K).getEnv("_")&&f(this,K).getProcessArgvBin()===f(this,K).getEnv("_")&&(e=f(this,K).getEnv("_").replace(`${f(this,K).path.dirname(f(this,K).process.execPath())}/`,"")),e}[ar](){return f(this,oo)}[Ss](){if(!f(this,tr))return;let e=f(this,K).getEnv("LC_ALL")||f(this,K).getEnv("LC_MESSAGES")||f(this,K).getEnv("LANG")||f(this,K).getEnv("LANGUAGE")||"en_US";this.locale(e.replace(/[.:].*/,""))}[_l](){return this[Es]().version||"unknown"}[jl](e){let r=e["--"]?e["--"]:e._;for(let n=0,o;(o=r[n])!==void 0;n++)f(this,K).Parser.looksLikeNumber(o)&&Number.isSafeInteger(Math.floor(parseFloat(`${o}`)))&&(r[n]=Number(o));return e}[Es](e){let r=e||"*";if(f(this,$r)[r])return f(this,$r)[r];let n={};try{let o=e||f(this,K).mainFilename;!e&&f(this,K).path.extname(o)&&(o=f(this,K).path.dirname(o));let s=f(this,K).findUp(o,(i,a)=>{if(a.includes("package.json"))return"package.json"});Be(s,void 0,f(this,K)),n=JSON.parse(f(this,K).readFileSync(s,"utf8"))}catch{}return f(this,$r)[r]=n||{},f(this,$r)[r]}[zt](e,r){r=[].concat(r),r.forEach(n=>{n=this[xs](n),f(this,W)[e].push(n)})}[Rr](e,r,n,o){this[Os](e,r,n,o,(s,i,a)=>{f(this,W)[s][i]=a})}[Cs](e,r,n,o){this[Os](e,r,n,o,(s,i,a)=>{f(this,W)[s][i]=(f(this,W)[s][i]||[]).concat(a)})}[Os](e,r,n,o,s){if(Array.isArray(n))n.forEach(i=>{e(i,o)});else if((i=>typeof i=="object")(n))for(let i of Ar(n))e(i,n[i]);else s(r,this[xs](n),o)}[xs](e){return e==="__proto__"?"___proto___":e}[As](e,r){return this[Rr](this[As].bind(this),"key",e,r),this}[vs](){var e,r,n,o,s,i,a,c,l,u,p,m;let d=f(this,ro).pop();Be(d,void 0,f(this,K));let b;e=this,r=this,n=this,o=this,s=this,i=this,a=this,c=this,l=this,u=this,p=this,m=this,{options:{set value(h){k(e,W,h)}}.value,configObjects:b,exitProcess:{set value(h){k(r,dt,h)}}.value,groups:{set value(h){k(n,Pt,h)}}.value,output:{set value(h){k(o,Te,h)}}.value,exitError:{set value(h){k(s,qt,h)}}.value,hasOutput:{set value(h){k(i,rt,h)}}.value,parsed:this.parsed,strict:{set value(h){k(a,or,h)}}.value,strictCommands:{set value(h){k(c,sr,h)}}.value,strictOptions:{set value(h){k(l,ir,h)}}.value,completionCommand:{set value(h){k(u,tt,h)}}.value,parseFn:{set value(h){k(p,nt,h)}}.value,parseContext:{set value(h){k(m,rr,h)}}.value}=d,f(this,W).configObjects=b,f(this,J).unfreeze(),f(this,Ce).unfreeze(),f(this,Ae).unfreeze(),f(this,ht).unfreeze()}[Il](e,r){return Qt(r,n=>(e(n),n))}getInternalMethods(){return{getCommandInstance:this[Tl].bind(this),getContext:this[Nl].bind(this),getHasOutput:this[Ll].bind(this),getLoggerInstance:this[Dl].bind(this),getParseContext:this[Ml].bind(this),getParserConfiguration:this[ar].bind(this),getUsageInstance:this[kl].bind(this),getValidationInstance:this[Fl].bind(this),hasParseCallback:this[io].bind(this),postProcess:this[cr].bind(this),reset:this[Ps].bind(this),runValidation:this[$s].bind(this),runYargsParserAndExecuteCommands:this[ln].bind(this),setHasOutput:this[ql].bind(this)}}[Tl](){return f(this,Ae)}[Nl](){return f(this,cn)}[Ll](){return f(this,rt)}[Dl](){return f(this,Pr)}[Ml](){return f(this,rr)||{}}[kl](){return f(this,J)}[Fl](){return f(this,Ce)}[io](){return!!f(this,nt)}[cr](e,r,n,o){return n||we(e)||(r||(e=this[vl](e)),(this[ar]()["parse-positional-numbers"]||this[ar]()["parse-positional-numbers"]===void 0)&&(e=this[jl](e)),o&&(e=Zt(e,this,f(this,ht).getMiddleware(),!1))),e}[Ps](e={}){k(this,W,f(this,W)||{});let r={};r.local=f(this,W).local?f(this,W).local:[],r.configObjects=f(this,W).configObjects?f(this,W).configObjects:[];let n={};r.local.forEach(i=>{n[i]=!0,(e[i]||[]).forEach(a=>{n[a]=!0})}),Object.assign(f(this,nr),Object.keys(f(this,Pt)).reduce((i,a)=>{let c=f(this,Pt)[a].filter(l=>!(l in n));return c.length>0&&(i[a]=c),i},{})),k(this,Pt,{});let o=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],s=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return o.forEach(i=>{r[i]=(f(this,W)[i]||[]).filter(a=>!n[a])}),s.forEach(i=>{r[i]=Ft(f(this,W)[i],a=>!n[a])}),r.envPrefix=f(this,W).envPrefix,k(this,W,r),k(this,J,f(this,J)?f(this,J).reset(n):bl(this,f(this,K))),k(this,Ce,f(this,Ce)?f(this,Ce).reset(n):xl(this,f(this,J),f(this,K))),k(this,Ae,f(this,Ae)?f(this,Ae).reset():hl(f(this,J),f(this,Ce),f(this,ht),f(this,K))),f(this,mt)||k(this,mt,El(this,f(this,J),f(this,Ae),f(this,K))),f(this,ht).reset(),k(this,tt,null),k(this,Te,""),k(this,qt,null),k(this,rt,!1),this.parsed=!1,this}[Ul](e,r){return f(this,K).path.relative(e,r)}[ln](e,r,n,o=0,s=!1){let i=!!n||s;e=e||f(this,Wt),f(this,W).__=f(this,K).y18n.__,f(this,W).configuration=this[ar]();let a=!!f(this,W).configuration["populate--"],c=Object.assign({},f(this,W).configuration,{"populate--":!0}),l=f(this,K).Parser.detailed(e,Object.assign({},f(this,W),{configuration:{"parse-positional-numbers":!1,...c}})),u=Object.assign(l.argv,f(this,rr)),p,m=l.aliases,d=!1,b=!1;Object.keys(u).forEach(h=>{h===f(this,gt)&&u[h]?d=!0:h===f(this,Nt)&&u[h]&&(b=!0)}),u.$0=this.$0,this.parsed=l,o===0&&f(this,J).clearCachedHelpMessage();try{if(this[Ss](),r)return this[cr](u,a,!!n,!1);f(this,gt)&&~[f(this,gt)].concat(m[f(this,gt)]||[]).filter(v=>v.length>1).indexOf(""+u._[u._.length-1])&&(u._.pop(),d=!0);let h=f(this,Ae).getCommands(),C=f(this,mt).completionKey in u,x=d||C||s;if(u._.length){if(h.length){let E;for(let v=o||0,O;u._[v]!==void 0;v++)if(O=String(u._[v]),~h.indexOf(O)&&O!==f(this,tt)){let $=f(this,Ae).runCommand(O,this,l,v+1,s,d||b||s);return this[cr]($,a,!!n,!1)}else if(!E&&O!==f(this,tt)){E=O;break}!f(this,Ae).hasDefaultCommand()&&f(this,so)&&E&&!x&&f(this,Ce).recommendCommands(E,h)}f(this,tt)&&~u._.indexOf(f(this,tt))&&!C&&(f(this,dt)&&Ut(!0),this.showCompletionScript(),this.exit(0))}if(f(this,Ae).hasDefaultCommand()&&!x){let E=f(this,Ae).runCommand(null,this,l,0,s,d||b||s);return this[cr](E,a,!!n,!1)}if(C){f(this,dt)&&Ut(!0),e=[].concat(e);let E=e.slice(e.indexOf(`--${f(this,mt).completionKey}`)+1);return f(this,mt).getCompletion(E,(v,O)=>{if(v)throw new ge(v.message);(O||[]).forEach($=>{f(this,Pr).log($)}),this.exit(0)}),this[cr](u,!a,!!n,!1)}if(f(this,rt)||(d?(f(this,dt)&&Ut(!0),i=!0,this.showHelp("log"),this.exit(0)):b&&(f(this,dt)&&Ut(!0),i=!0,f(this,J).showVersion("log"),this.exit(0))),!i&&f(this,W).skipValidation.length>0&&(i=Object.keys(u).some(E=>f(this,W).skipValidation.indexOf(E)>=0&&u[E]===!0)),!i){if(l.error)throw new ge(l.error.message);if(!C){let E=this[$s](m,{},l.error);n||(p=Zt(u,this,f(this,ht).getMiddleware(),!0)),p=this[Il](E,p??u),we(p)&&!n&&(p=p.then(()=>Zt(u,this,f(this,ht).getMiddleware(),!1)))}}}catch(h){if(h instanceof ge)f(this,J).fail(h.message,h);else throw h}return this[cr](p??u,a,!!n,!0)}[$s](e,r,n,o){e={...e},r={...r};let s={...this.getDemandedOptions()};return i=>{if(n)throw new ge(n.message);f(this,Ce).nonOptionCount(i),f(this,Ce).requiredArguments(i,s);let a=!1;f(this,sr)&&(a=f(this,Ce).unknownCommands(i)),f(this,or)&&!a?f(this,Ce).unknownArguments(i,e,r,!!o):f(this,ir)&&f(this,Ce).unknownArguments(i,e,{},!1,!1),f(this,Ce).limitedChoices(i),f(this,Ce).implications(i),f(this,Ce).conflicting(i)}}[ql](){k(this,rt,!0)}};function gl(t){return!!t&&typeof t.getInternalMethods=="function"}var my=Wl(fs),zl=my;function ao(){if(process.env.REDOCLY_AUTHORIZATION)return process.env.REDOCLY_AUTHORIZATION;throw new Error("No api key provided, please use environment variable REDOCLY_AUTHORIZATION.")}async function Vl({argv:t,config:e}){let r=Er(e,t.residency);try{let n=new Jr;t.verbose&&(g.info(`OAuth client initialized.
|
|
76
|
+
`),g.info(`Local credentials file path: ${n.credentialsFilePath}
|
|
77
|
+
`)),await n.login(r)}catch(n){t.verbose&&(g.error(`Residency: ${t.residency}.
|
|
78
|
+
`),g.error(`Login URL: ${r}.
|
|
79
|
+
`),g.error(n.stack||n.message)),t.residency?z(`\u274C Connection to ${r} failed.`):z("\u274C Login failed. Please check your credentials and try again.")}}async function Gl(){new Jr().logout(),g.output(`Logged out from the Redocly account. \u270B
|
|
80
|
+
`)}import{writeFileSync as dy}from"fs";import{performance as hy}from"perf_hooks";async function Bl({argv:t,config:e,version:r,collectSpecData:n}){let o=await lt(t.apis,e),s={errors:0,warnings:0,ignored:0};for(let{path:i,alias:a,output:c}of o)try{let l=hy.now(),u=e.forAlias(a);u.skipPreprocessors(t["skip-preprocessor"]),u.skipDecorators(t["skip-decorator"]),a===void 0?g.info(me(`bundling ${Et(i)}...
|
|
81
|
+
`)):g.info(me(`bundling ${Et(i)} using configuration for api '${a}'...
|
|
82
|
+
`));let{bundle:p,problems:m,...d}=await Sr({ref:i,config:u,dereference:t.dereferenced,removeUnusedComponents:t["remove-unused-components"],keepUrlRefs:t["keep-url-references"],componentRenamingConflicts:t["component-renaming-conflicts-severity"],componentNamesStrategy:t["component-names-strategy"],collectSpecData:n}),b=On(m),{outputFile:h,ext:C}=Wi({entrypoint:i,output:c,argvOutput:t.output,ext:t.ext,entries:t?.apis?.length||0});if(b.errors===0||t.force)if(h){let v=Io(Xr(p.parsed),C,t.dereferenced);Ui(h,v)}else{let v=Io(Xr(p.parsed),t.ext||"yaml",t.dereferenced);g.output(v)}s.errors+=b.errors,s.warnings+=b.warnings,s.ignored+=b.ignored,xn(m,{format:"codeframe",totals:b,version:r,command:"bundle"}),t.metafile&&(o.length>1&&g.warn('[WARNING] "--metafile" cannot be used with multiple apis. Skipping...'),dy(t.metafile,JSON.stringify(d),"utf-8"));let x=Rn(l);b.errors>0?t.force?g.info(`\u2753 Created a bundle for ${Z(Et(i))} at ${Z(h||"stdout")} with errors ${fe(x)}.
|
|
83
83
|
${ee("Errors ignored because of --force")}.
|
|
84
|
-
`):
|
|
85
|
-
`):
|
|
86
|
-
`);let
|
|
87
|
-
`))}catch(
|
|
84
|
+
`):g.error(`\u274C Errors encountered while bundling ${Z(Et(i))}: bundle not created (use --force to ignore errors).
|
|
85
|
+
`):g.info(`\u{1F4E6} Created a bundle for ${Z(Et(i))} at ${Z(h||"stdout")} ${fe(x)}.
|
|
86
|
+
`);let E=d.visitorsData?.["remove-unused-components"]?.removedCount;E&&g.info(me(`\u{1F9F9} Removed ${E} unused components.
|
|
87
|
+
`))}catch(l){qi(l,i)}if(zi(e),!(s.errors===0||t.force))throw new Kt("Bundle failed.")}var lr=_t(Gn(),1);import{spawnSync as Ts}from"node:child_process";import{existsSync as Fe,mkdirSync as Ns,mkdtempSync as rp,readdirSync as np,readFileSync as Ue,realpathSync as Jl,rmSync as op,statSync as by,writeFileSync as Oe}from"node:fs";import{createRequire as wy}from"node:module";import{tmpdir as sp}from"node:os";import{dirname as pn,join as oe,relative as yt,resolve as Sy}from"node:path";import{fileURLToPath as Ey}from"node:url";var ot={},_s=new Set(["typescript","zod","tanstack-query","tanstack-query-vue","tanstack-query-svelte","tanstack-query-solid","swr","transformers","mock","cli","python","go","php"]),gy=/import\s*(?:type\s*)?\{([^}]*)\}\s*from\s*['"]@redocly\/client-generator(?:\/generate)?['"]/g;function Hl(t,e){let r=new Set(e),n=new Set;for(let o of t.matchAll(gy))for(let s of o[1].split(",")){let i=s.trim().replace(/^type\s+/,"").split(/\s+as\s+/)[0].trim();r.has(i)&&n.add(i)}return[...n]}var yy=/^\/\/ Ejected from @redocly\/client-generator@([\w.-]+) — the built-in "([a-z-]+)" generator\./;function Yl(t){let e=t.match(yy);if(!(!e||!_s.has(e[2])))return{name:e[2],version:e[1]}}function Kl(t){return t.includes("Invalid pagination configuration")?"pagination":t.includes("Could not load generator")?"generator-load":/^Generator "[^"]+" failed:/.test(t)?"generator-run":t.includes("Unknown generator")||t.includes("does not support")?"not-supported":"other"}var ye={};var _r=new Set(["python","go","php","typescript","zod","mock","swr","tanstack-query","transformers","cli"]),Xl=new Map([["tanstack-query-vue","vue"],["tanstack-query-svelte","svelte"],["tanstack-query-solid","solid"]]),Je="@redocly/client-generator",Cy="https://redocly.com/docs/cli/commands/eject-generator",js="@redocly/openapi-core",Zl="<!-- redocly-generators:begin \u2014 managed by `redocly eject-generator`; content between markers is refreshed on eject -->",Is="<!-- redocly-generators:end -->";function Oy(){let t=Ey(new URL("./eject-assets/",import.meta.url));if(Fe(oe(t,"generators")))return t;let e=wy(import.meta.url).resolve(Je),r=oe(pn(e),"..","eject-assets");if(Fe(oe(r,"generators")))return r;throw new de(`
|
|
88
|
+
\u274C The ejectable generator sources are missing from ${Je}.
|
|
89
|
+
In a checkout of the CLI, build them first: npm run prepare -w ${Je}
|
|
90
|
+
`)}function Ql(t,e){let r=oe(process.cwd(),".claude","skills",t,"SKILL.md");return Ns(pn(r),{recursive:!0}),Oe(r,Ue(oe(e,"skills",t,"SKILL.md"),"utf-8"),"utf-8"),yt(process.cwd(),r)}function Ls(t,e){let r=["# Ejected client generators","","These files are Redocly client generators you own; `redocly generate-client` runs them.","Their design and the authoring toolkit are agent skills \u2014 edit the skill first, then make","the code match, and never hand-edit generated client output:","","- `.claude/skills/client-generators/SKILL.md` \u2014 the API model, the helpers, the loop.",...e.map(c=>`- \`.claude/skills/${c}-generator/SKILL.md\` \u2014 the \`${c}\` generator's design.`)],n=`${Zl}
|
|
91
|
+
|
|
92
|
+
${r.join(`
|
|
93
|
+
`)}
|
|
94
|
+
|
|
95
|
+
${Is}
|
|
96
|
+
`,o=oe(t,"AGENTS.md");if(!Fe(o)){Oe(o,n,"utf-8");return}let s=Ue(o,"utf-8"),i=s.indexOf(Zl),a=s.indexOf(Is);if(i===-1||a===-1){g.warn(`eject-generator: ${o} exists without the managed markers \u2014 leaving it untouched.
|
|
97
|
+
`);return}Oe(o,s.slice(0,i)+n.trimEnd()+s.slice(a+Is.length),"utf-8")}function Ds(t,e,r){let n=rp(oe(sp(),"redocly-eject-merge-")),o={ours:oe(n,".merge-ours"),base:oe(n,".merge-base"),theirs:oe(n,".merge-theirs")};Oe(o.ours,t,"utf-8"),Oe(o.base,e,"utf-8"),Oe(o.theirs,r,"utf-8");let s=Ts("git",["merge-file","-p","-L","yours","-L","ejected-from","-L","update",o.ours,o.base,o.theirs],{encoding:"utf-8"});if(op(n,{recursive:!0,force:!0}),s.error||s.status===null)throw ye.eject_generator_outcome="merge-tool-missing",new de("\n\u274C `--update` needs `git` on PATH for the three-way merge. Alternative: eject to a temporary directory and diff by hand.\n");if(s.status>127)throw ye.eject_generator_outcome="merge-failed",new de(`
|
|
98
|
+
\u274C \`git merge-file\` could not merge the update (your copy is untouched): ${s.stderr.trim()}
|
|
99
|
+
`);return{merged:s.stdout,conflicts:s.status}}function ip(t){return/Ejected from @redocly\/client-generator@(\S+)/.exec(t)?.[1]}function ap(t,e){let r=rp(oe(sp(),"redocly-eject-base-")),n=new Map;try{if(Ts("npm",["pack",t,"--pack-destination",r],{encoding:"utf-8"}).status!==0)return n;let s=np(r).find(i=>i.endsWith(".tgz"));if(s===void 0)return n;for(let i of e)Ts("tar",["-xzf",oe(r,s),"-C",r,i],{encoding:"utf-8"}).status===0&&n.set(i,Ue(oe(r,i),"utf-8"));return n}finally{op(r,{recursive:!0,force:!0})}}var ep=t=>`package/eject-assets/generators/${t}.mjs`,tp=(t,e)=>`package/eject-assets/generators/${t}/${e}`,jr=t=>`package/eject-assets/skills/${t}/SKILL.md`;function xy(t,e){let r=oe(t,"generators",e);if(!(!Fe(r)||!by(r).isDirectory()))return np(r).filter(n=>n.endsWith(".ts")).sort()}function co(t,e,r){let n=oe(process.cwd(),".claude","skills",t,"SKILL.md"),o=Ue(oe(e,"skills",t,"SKILL.md"),"utf-8");if(!Fe(n))return Ns(pn(n),{recursive:!0}),Oe(n,o,"utf-8"),0;let s=Ue(n,"utf-8");if(s===o)return 0;if(r===void 0)return Oe(`${n}.new`,o,"utf-8"),g.warn(`${yt(process.cwd(),n)} was edited and has no merge base \u2014 the new skill is beside it as SKILL.md.new.
|
|
100
|
+
`),0;let{merged:i,conflicts:a}=Ds(s,r,o);return Oe(n,i,"utf-8"),a}function Ms(t){return[..._r].filter(e=>Fe(oe(t,`${e}.mjs`))||Fe(oe(t,e,"index.ts")))}function ks(t,e=!1){let r=oe(process.cwd(),"package.json");if(!Fe(r))return"no-package-json";let n=Ue(r,"utf-8"),o=JSON.parse(n),s="present",i={};for(let[c,l]of Object.entries(t)){let u=o.devDependencies?.[c]!==void 0?o.devDependencies:o.dependencies?.[c]!==void 0?o.dependencies:void 0;u===void 0?(i[c]=`^${l}`,s="added"):e&&!(lr.validRange(u[c])!==null&&lr.satisfies(l,u[c]))&&(u[c]=`^${l}`,s==="present"&&(s="updated"))}if(s==="present")return"present";if(Object.keys(i).length>0){let c={...o.devDependencies,...i};o.devDependencies=Object.fromEntries(Object.entries(c).sort(([l],[u])=>l.localeCompare(u)))}let a=/^([ \t]+)"/m.exec(n)?.[1]??" ";return Oe(r,`${JSON.stringify(o,null,a)}
|
|
101
|
+
`,"utf-8"),s}function Ay(t,e,r,n,o){let s=Ci(e),i=te(s)&&te(s.apis)?s.apis:{};if(Object.values(i).some(a=>te(a)&&te(a.client)))return!1;if(n===-1){if(/^client:/m.test(e))return!1;let a=e===""||e.endsWith(`
|
|
102
|
+
`)?"":`
|
|
103
|
+
`;return Oe(t,`${e}${a}client:
|
|
104
|
+
generators:
|
|
105
|
+
- ${o}
|
|
106
|
+
`,"utf-8"),!0}return r.splice(n+1,0," generators:",` - ${o}`),Oe(t,r.join(`
|
|
107
|
+
`),"utf-8"),!0}function vy(t,e,r){if(t===void 0||!Fe(t))return!1;let n=Ue(t,"utf-8"),o=d=>b=>b===d||b===`'${d}'`||b===`"${d}"`,s=o(e),i=o(r),a=n.split(`
|
|
108
|
+
`),c=a.findIndex(d=>/^client:\s*$/.test(d)),l=c===-1?-1:a.findIndex((d,b)=>b>c&&/^\s+generators:/.test(d));if(l!==-1&&a.slice(c+1,l).some(d=>/^\S/.test(d))&&(l=-1),l===-1)return Ay(t,n,a,c,r);let u=a[l].match(/^(\s+generators:\s*\[)(.*)\]\s*$/);if(u!==null){let d=u[2].split(",").map(h=>h.trim()).filter(h=>h!=="");if(d.some(i))return!0;let b=d.findIndex(s);return b===-1?d.push(r):d[b]=r,a[l]=`${u[1]}${d.join(", ")}]`,Oe(t,a.join(`
|
|
109
|
+
`),"utf-8"),!0}if(!/^\s+generators:\s*$/.test(a[l]))return!1;let p=l,m=`${a[l].match(/^\s+/)[0]} `;for(let d=l+1;d<a.length;d++){if(/^\s*(#|$)/.test(a[d]))continue;let b=a[d].match(/^(\s+)- (.*?)\s*$/);if(b===null)break;let h=b[2].match(/\s+#.*$/)?.[0]??"",C=h===""?b[2]:b[2].slice(0,-h.length);if(i(C))return!0;if(s(C))return a[d]=`${b[1]}- ${r}${h}`,Oe(t,a.join(`
|
|
110
|
+
`),"utf-8"),!0;p=d,m=b[1]}return a.splice(p+1,0,`${m}- ${r}`),Oe(t,a.join(`
|
|
111
|
+
`),"utf-8"),!0}function Py({name:t,files:e,toolkitVersion:r,assetsDir:n,dir:o,targetDir:s}){let i=oe(s,"index.ts"),a=yt(process.cwd(),i)||i;if(!Fe(i)){ye.eject_generator_outcome="missing-target";let C=oe(o,`${t}.mjs`);throw new de(Fe(C)?`
|
|
112
|
+
\u274C ${yt(process.cwd(),C)} is a single-file eject from an older version; this version ejects a folder. Eject fresh: redocly eject-generator ${t} --force
|
|
113
|
+
`:`
|
|
114
|
+
\u274C Nothing to update: ${a} does not exist. Eject first.
|
|
115
|
+
`)}let c=ip(Ue(i,"utf-8"));c!==void 0&&lr.valid(c)!==null&&(ye.eject_generator_from_version=c),ye.eject_generator_to_version=r;let l=c===r||c===void 0?new Map:ap(`${Je}@${c}`,[...e.map(C=>tp(t,C)),jr("client-generators"),jr(`${t}-generator`)]);if(c===void 0)throw ye.eject_generator_outcome="missing-base",new de(`
|
|
116
|
+
\u274C Could not read the version ${a} was ejected from (not recorded in its header), so there is no merge base.
|
|
117
|
+
Eject to a temporary directory and diff by hand, or re-eject with --force.
|
|
118
|
+
`);let u=0;for(let C of e){let x=Ue(oe(n,"generators",t,C),"utf-8"),E=oe(s,C);if(!Fe(E)){Oe(E,x,"utf-8");continue}let v=Ue(E,"utf-8");if(v===x)continue;let O=c===r?x:l.get(tp(t,C));if(O===void 0){Oe(`${E}.new`,x,"utf-8"),g.warn(`${yt(process.cwd(),E)} has no merge base in ${Je}@${c} \u2014 the new file is beside it as ${C}.new.
|
|
119
|
+
`);continue}let $=Ds(v,O,x);Oe(E,$.merged,"utf-8"),u+=$.conflicts}let p=C=>c===r?Ue(oe(n,"skills",C,"SKILL.md"),"utf-8"):l.get(jr(C)),m=co("client-generators",n,p("client-generators"))+co(`${t}-generator`,n,p(`${t}-generator`));Ls(o,Ms(o));let d=ks({[Je]:r},!0);(d==="updated"||d==="added")&&g.info(`Set ${Je} to ^${r} in package.json \u2014 run your installer.
|
|
120
|
+
`);let b=u+m;ye.eject_generator_outcome=b>0?"conflicts":"success";let h=yt(process.cwd(),s)||s;b>0?(ye.eject_generator_conflicts=b,g.warn(`Updated ${h} with ${b} conflict(s)${m>0?" (some in .claude/skills)":""} \u2014 resolve the <<<<<<< markers, then regenerate.
|
|
121
|
+
`)):g.info(`Updated ${h} cleanly.
|
|
122
|
+
`)}function $y({name:t,asset:e,toolkitVersion:r,assetsDir:n,dir:o,target:s,printedTarget:i}){if(!Fe(s))throw ye.eject_generator_outcome="missing-target",new de(`
|
|
123
|
+
\u274C Nothing to update: ${i} does not exist. Eject first.
|
|
124
|
+
`);let a=oe(o,".pristine",`${t}.mjs`),c=Ue(s,"utf-8"),l=ip(c);l!==void 0&&lr.valid(l)!==null&&(ye.eject_generator_from_version=l),ye.eject_generator_to_version=r;let u=Fe(a)||l===r||l===void 0?new Map:ap(`${Je}@${l}`,[ep(t),jr("client-generators"),jr(`${t}-generator`)]),p=Fe(a)?Ue(a,"utf-8"):l===r?e:u.get(ep(t));if(p===void 0){ye.eject_generator_outcome="missing-base";let E=`${s}.new`;throw Oe(E,e,"utf-8"),new de(`
|
|
125
|
+
\u274C Could not read the version this file was ejected from (${l??"not recorded in its header"}), so there is no merge base.
|
|
126
|
+
The current generator is written to ${yt(process.cwd(),E)} \u2014 diff it against your copy and merge by hand.
|
|
127
|
+
`)}let{merged:m,conflicts:d}=Ds(c,p,e);Oe(s,m,"utf-8"),Fe(a)&&g.info(`Used ${yt(process.cwd(),a)} as the merge base. Later updates read the version from the file's header, so you can delete that .pristine directory.
|
|
128
|
+
`);let b=E=>l===r?Ue(oe(n,"skills",E,"SKILL.md"),"utf-8"):u.get(jr(E)),h=co("client-generators",n,b("client-generators"))+co(`${t}-generator`,n,b(`${t}-generator`));Ls(o,Ms(o));let C=ks({[Je]:r},!0);(C==="updated"||C==="added")&&g.info(`Set ${Je} to ^${r} in package.json \u2014 run your installer.
|
|
129
|
+
`);let x=d+h;ye.eject_generator_outcome=x>0?"conflicts":"success",x>0?(ye.eject_generator_conflicts=x,g.warn(`Updated ${i} with ${x} conflict(s)${h>0?" (some in .claude/skills)":""} \u2014 resolve the <<<<<<< markers, then regenerate.
|
|
130
|
+
`)):g.info(`Updated ${i} cleanly.
|
|
131
|
+
`)}var cp=async({argv:t,config:e})=>{let r=t.generator??"";ye.eject_generator_action=t.update?"update":"eject",(_r.has(r)||Xl.has(r))&&(ye.eject_generator_name=r),ye.eject_generator_outcome="unexpected-error";let n=Xl.get(r);if(n!==void 0){ye.eject_generator_action="guidance",ye.eject_generator_outcome="success",g.info(`
|
|
132
|
+
The "${r}" generator is the "tanstack-query" generator with one argument changed.
|
|
133
|
+
Eject that one and set the framework in your copy's default export:
|
|
134
|
+
|
|
135
|
+
redocly eject-generator tanstack-query
|
|
136
|
+
# then in generators/tanstack-query/index.ts: run: tanstackQueryGenerator('${n}')
|
|
137
|
+
`);return}if(!_r.has(r))throw ye.eject_generator_outcome="unknown-generator",new de(`
|
|
138
|
+
\u274C Unknown generator "${r}". Ejectable generators: ${[..._r].join(", ")}.
|
|
139
|
+
`);let o=Oy(),s=xy(o,r),{GENERATOR_VERSION:i}=await import("./chunks/S4GQKQ5G.js"),a=Sy(t.dir??"./generators"),c=s===void 0?oe(a,`${r}.mjs`):oe(a,r,"index.ts"),l=yt(process.cwd(),c)||c;if(t.update){if(s===void 0){let E=Ue(oe(o,"generators",`${r}.mjs`),"utf-8");$y({name:r,asset:E,toolkitVersion:i,assetsDir:o,dir:a,target:c,printedTarget:l})}else Py({name:r,files:s,toolkitVersion:i,assetsDir:o,dir:a,targetDir:oe(a,r)});return}if(Fe(c)&&!t.force)throw ye.eject_generator_outcome="already-exists",new de(`
|
|
140
|
+
\u274C ${l} already exists. Use --update to merge the newer version in, or --force to overwrite.
|
|
141
|
+
`);Ns(pn(c),{recursive:!0});let u=s===void 0?[Ue(oe(o,"generators",`${r}.mjs`),"utf-8")]:s.map(E=>Ue(oe(o,"generators",r,E),"utf-8"));s===void 0?Oe(c,u[0],"utf-8"):s.forEach((E,v)=>{Oe(oe(a,r,E),u[v],"utf-8")});let p=Ql("client-generators",o),m=Ql(`${r}-generator`,o);Ls(a,Ms(a));let d=`./${yt(e.configPath===void 0?process.cwd():Jl(pn(e.configPath)),Jl(c)).split("\\").join("/")}`,b=ks({[Je]:i}),h=u.some(E=>E.includes(`from "${js}"`)||E.includes(`from '${js}'`)),C=vy(e.configPath,r,d),x=s===void 0?l:yt(process.cwd(),oe(a,r))+"/";g.info(`Ejected the "${r}" generator to ${x}.
|
|
142
|
+
`+(b==="added"?`Added ${Je} to devDependencies (the ejected file imports its toolkit) \u2014 run your installer.
|
|
143
|
+
`:b==="no-package-json"?`The ejected file imports its toolkit from ${Je} \u2014 install it: npm install --save-dev ${Je}
|
|
144
|
+
`:"")+(h?`It also imports ${js} (a dependency of the toolkit) \u2014 add it explicitly if your package manager does not hoist.
|
|
145
|
+
`:"")+(C?`Added it to client.generators in ${yt(process.cwd(),e.configPath)} \u2014 the path to your copy replaces the built-in name.
|
|
146
|
+
`:`Point your config at the ${s===void 0?"file":"entry file"} \u2014 the path to your copy replaces the built-in name:
|
|
147
|
+
|
|
148
|
+
client:
|
|
149
|
+
generators:
|
|
150
|
+
- ${d}
|
|
151
|
+
|
|
152
|
+
`)+(s===void 0?"":`Running TypeScript generators uses Node's type stripping \u2014 Node 22.18 or 23.6 and newer.
|
|
153
|
+
`)+`Your agent's skills: ${m} (this generator's design) and ${p} (the toolkit).
|
|
154
|
+
|
|
155
|
+
Run it: redocly generate-client <api> --output <path>${C?"":` --generator ${d}`}
|
|
156
|
+
Edit ${x} and run that again to see your change.
|
|
157
|
+
Reference: ${Cy}
|
|
158
|
+
`),ye.eject_generator_outcome="success"};import{spawn as Ry}from"node:child_process";import*as lp from"node:process";var un=t=>t.replace(/[^a-zA-Z0-9 ._\-:\\/@]/g,""),pp=t=>t.replace(/[^a-zA-Z0-9@._-]/g,"");function Ir(){let t=lp.platform==="win32";return{npxExecutableName:t?"npx.cmd":"npx",sanitize:(n,o)=>t&&n?o(n):n||"",shell:t}}var up=async({argv:t})=>{g.info(`
|
|
88
159
|
Launching eject using NPX.
|
|
89
160
|
|
|
90
|
-
`);let{npxExecutableName:e,sanitize:r,shell:n}=
|
|
161
|
+
`);let{npxExecutableName:e,sanitize:r,shell:n}=Ir(),o=r(t.path,un),s=r(t["project-dir"],un);Ry(e,["-y","@redocly/realm","eject",`${t.type}`,o,`-d=${s}`,t.force?`--force=${t.force}`:""],{stdio:"inherit",shell:n}).on("error",a=>{throw g.info(`Eject launch failed: ${a.message}`),new Error("Eject launch failed.")})};import{writeFileSync as _y}from"node:fs";async function fp({argv:t,config:e,version:r,collectSpecData:n}){let o=t["output-file"]||"auto-generated.arazzo.yaml",s={outputFile:o,descriptionPath:t.descriptionPath,collectSpecData:n,version:r,config:e};try{let{generate:i}=await import("./chunks/GOJNDGZT.js");g.info(me(`
|
|
91
162
|
Generating Arazzo description...
|
|
92
|
-
`));let a=await i(s);
|
|
93
|
-
`+
|
|
94
|
-
`)}catch{throw new
|
|
95
|
-
\u274C Failed to generate Arazzo description. Check the output file path you provided, or the OpenAPI file content.`)}}import{basename as
|
|
163
|
+
`));let a=await i(s);_y(o,Oi(a)),g.info(`
|
|
164
|
+
`+Z(`Arazzo description ${ee(o)} successfully generated.`)+`
|
|
165
|
+
`)}catch{throw new de(`
|
|
166
|
+
\u274C Failed to generate Arazzo description. Check the output file path you provided, or the OpenAPI file content.`)}}import{readFileSync as jy}from"node:fs";import{mkdir as Iy,writeFile as Ty}from"node:fs/promises";import{basename as hp,dirname as Fs,extname as gp,isAbsolute as yp,relative as mp,resolve as pr}from"node:path";var Ny=/^[a-z][a-z0-9+.-]+:/i;function bp(t,e){let{setup:r}=t;if(typeof r!="string")return t;if(Ny.test(r))throw new de(`
|
|
96
167
|
\u274C \`client.setup\` must be a local file path \u2014 remote setup modules are not supported.
|
|
97
168
|
Got: ${r}
|
|
98
|
-
`);return
|
|
169
|
+
`);return yp(r)?t:{...t,setup:pr(e,r)}}function Ly(t){return`${t.replace(/[\\/]/g,"_")}.client.ts`}function Dy(t){if(t.startsWith("//"))return!1;if(t.startsWith("/"))return!0;try{let e=new URL(t);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}async function wp({argv:t,config:e}){let{AUTHORING_HELPER_NAMES:r,generateClient:n,mergeConfig:o}=await import("./chunks/S4GQKQ5G.js"),s=e.configPath?Fs(e.configPath):process.cwd(),i={serverUrl:t["server-url"],outputMode:t["output-mode"],runtime:t.runtime,importExt:t["import-ext"],goPackage:t["go-package"],argsStyle:t["args-style"],errorMode:t["error-mode"],dateType:t["date-type"],mockData:t["mock-data"],mockSeed:t["mock-seed"],docs:t.docs,generators:t.generator?.map(m=>m.startsWith(".")?pr(m):m),setup:t.setup===void 0?void 0:bp({setup:t.setup},process.cwd()).setup},a=e.resolvedConfig.apis??{},c=Object.keys(a).filter(m=>te(a[m].client)||a[m].clientOutput!==void 0);if(t.api===void 0){if(t.output)throw new de("\n\u274C --output can't target multiple APIs. Set `clientOutput` under each api in redocly.yaml, or pass a single <api>.\n");if(c.length===0)throw new de("\n\u274C No API to generate. Add a `client` block or `clientOutput` under an `apis:` entry, or pass <api> (a file/URL or an `apis:` alias).\n")}let l=await lt(t.api===void 0?c:[t.api],e),u={config:e,configDir:s,cliFlags:i,outputFlag:t.output,toolkit:{generateClient:n,mergeConfig:o,helperNames:r},seenOutputs:new Set,composable:[]};for(let m of l)await My(m,u);let p=te(e.resolvedConfig.client)?e.resolvedConfig.client:{};p.cliOutput!==void 0&&t.api===void 0&&u.composable.length>0&&await ky(p.cliOutput,u)}async function My(t,{config:e,configDir:r,cliFlags:n,outputFlag:o,toolkit:s,seenOutputs:i,composable:a}){let{path:c,alias:l}=t,u=l??hp(c,gp(c)),p=e.forAlias(l),{client:m,clientOutput:d}=p.resolvedConfig,b=bp(te(m)?m:{},r),h=s.mergeConfig(b,n);Fy(h.generators??[],s.helperNames,r);let C=o!==void 0?pr(o):d!==void 0?pr(r,d):pr(r,Ly(u));if(!C.endsWith(".ts"))throw new de(`
|
|
99
170
|
\u274C output must point at a TypeScript file (ending in .ts).
|
|
100
|
-
Got: ${
|
|
101
|
-
`);if(
|
|
102
|
-
\u274C Two APIs
|
|
171
|
+
Got: ${C}
|
|
172
|
+
`);if(i.has(C))throw new de(`
|
|
173
|
+
\u274C Two APIs write to the same path: ${C}.
|
|
103
174
|
Give each api a distinct \`clientOutput\`.
|
|
104
|
-
`);if(
|
|
175
|
+
`);if(i.add(C),h.serverUrl!==void 0&&!Dy(h.serverUrl))throw new de(`
|
|
105
176
|
\u274C serverUrl must be an absolute URL (https://api.example.com) or a root-relative path (/v1) \u2014 set via --server-url or the \`client\` block in redocly.yaml.
|
|
106
|
-
Got: ${
|
|
107
|
-
`);try{
|
|
108
|
-
Generating
|
|
109
|
-
`));let
|
|
110
|
-
`+
|
|
111
|
-
`)}catch(
|
|
112
|
-
\u274C Failed to generate
|
|
177
|
+
Got: ${h.serverUrl}
|
|
178
|
+
`);try{g.info(me(`
|
|
179
|
+
Generating client for ${u}...
|
|
180
|
+
`));let x=await s.generateClient({...h,api:c,output:C,config:p,configDir:r}),E=x.files.find($=>$.path.endsWith(".cli.ts"));if(E!==void 0){let $=h.importExt??"js";a.push({alias:u,cliPath:E.path.replace(/\.ts$/,$==="ts"?".ts":".js")})}for(let $ of x.files)i.add($.path);let O=`Client successfully generated: ${`${x.files.length} ${Le("file",x.files.length)}`} (${x.bytes} bytes) at ${ee(x.outputPath)}.`;g.info(`
|
|
181
|
+
`+Z(O)+`
|
|
182
|
+
`)}catch(x){let E=x instanceof Error?x.message:String(x);throw ot.generate_client_error_category=Kl(E),new de(`
|
|
183
|
+
\u274C Failed to generate client for ${u}.
|
|
113
184
|
${E}
|
|
114
|
-
`)}}
|
|
115
|
-
|
|
185
|
+
`)}}async function ky(t,{configDir:e,seenOutputs:r,composable:n}){let{renderComposedCliEntry:o}=await import("./chunks/W62VKXGM.js"),s=pr(e,t);if(!s.endsWith(".ts"))throw new de(`
|
|
186
|
+
\u274C client.cliOutput must point at a TypeScript file (ending in .ts).
|
|
187
|
+
Got: ${s}
|
|
188
|
+
`);if(r.has(s))throw new de(`
|
|
189
|
+
\u274C client.cliOutput resolves to a file this run generated: ${s}.
|
|
190
|
+
Give the composed entry its own path.
|
|
191
|
+
`);let i=hp(s,gp(s)),a=o(n.map(({alias:c,cliPath:l})=>({alias:c,modulePath:`./${mp(Fs(s),l).split("\\").join("/")}`})),i);await Iy(Fs(s),{recursive:!0}),await Ty(s,a,"utf-8"),ot.generate_client_composed_apis_count=n.length,g.info(`
|
|
192
|
+
`+Z(`Composed CLI written to ${ee(mp(process.cwd(),s))} \u2014 ${n.map(({alias:c})=>c).join(", ")} behind one \`${i}\` binary.`)+`
|
|
193
|
+
`)}var dp=new Set;function Fy(t,e,r){let n=new Set(ot.generate_client_builtin_generators??[]),o=new Set(ot.generate_client_toolkit_imports??[]),s=new Set(ot.generate_client_ejected_generators??[]),i=ot.generate_client_custom_generators_count??0;for(let a of t){if(_s.has(a)){n.add(a);continue}if(!dp.has(a)&&(dp.add(a),i++,a.startsWith(".")||yp(a)))try{let c=jy(pr(r,a),"utf-8");for(let u of Hl(c,e))o.add(u);let l=Yl(c);l&&s.add(`${l.name}@${l.version}`)}catch{}}ot.generate_client_builtin_generators=[...n],ot.generate_client_custom_generators_count=i,ot.generate_client_toolkit_imports=[...o],ot.generate_client_ejected_generators=[...s]}import*as Mp from"node:path";import{performance as Gy}from"node:perf_hooks";var xe="components";var Sp="channels",Ep="operations";import*as Cp from"node:path";function Tr(t,e){if(te(t)){e(t);for(let r of Object.keys(t))Tr(t[r],e)}else if(Array.isArray(t))for(let r of t)Tr(r,e)}function Nr(t){return t.startsWith(`#/${xe}/`)}function Op(t,e){Tr(t,r=>{if(De(r)&&Nr(r.$ref)){let n=Cp.basename(r.$ref);r.$ref=r.$ref.replace(n,e+"_"+n)}else if(te(r.discriminator)&&te(r.discriminator.mapping)){let{mapping:n}=r.discriminator;for(let o of Object.keys(n)){let s=n[o];typeof s=="string"&&Nr(s)&&(n[o]=s.split("/").map((i,a,c)=>c.length-1===a&&!i.startsWith(e+"_")?e+"_"+i:i).join("/"))}}})}function fn(t,e,r){return e?(t||z("Info section is not found in specification."),t[e]||z(`${ee(`prefix-${r}-with-info-prop`)} argument value is not found in info section.`),mi(t[e])||z(`${ee(`prefix-${r}-with-info-prop`)} argument value should be string.`),t[e].length>50&&z(`${ee(`prefix-${r}-with-info-prop`)} argument value length should not exceed 50 characters.`),t[e].replaceAll(/\s/g,"_")):""}function Us(t,e){return e?t?.map(r=>{let n={};for(let[o,s]of Object.entries(r))Object.assign(n,{[e+"_"+o]:s});return n}):t}function Ot(t,e){return e?e+"_"+t:t}import*as xp from"node:path";function lo(t,e){return t.replace(/"(#\/components\/.*?)"/g,r=>{let n=xp.basename(r);return r.replace(n,Ot(n,e))})}function mn(t){return t.map(e=>({name:e}))}import*as po from"node:path";function Ap(t){return po.basename(t,po.extname(t))}function vp(t){return Object.entries(t).filter(([e,r])=>r.length>1)}function qs(t,e){for(let[r,n]of e)g.warn(`Conflict on ${t} : ${qe(r)} in files: ${Z(n)}
|
|
194
|
+
`)}function Pp(t){g.info(fe(`
|
|
116
195
|
${t} conflict(s) on tags.
|
|
117
|
-
Suggestion: please use ${
|
|
196
|
+
Suggestion: please use ${Z("prefix-tags-with-filename")}, ${Z("prefix-tags-with-info-prop")} or ${Z("without-x-tag-groups")} to prevent naming conflicts.
|
|
118
197
|
|
|
119
|
-
`))}function
|
|
120
|
-
warning: ${e.length} conflict(s) on the ${
|
|
121
|
-
`)}function
|
|
122
|
-
`);return}t.externalDocs=o}}function
|
|
123
|
-
`);return}t.paths[
|
|
124
|
-
Please choose only one!`);let
|
|
125
|
-
`);let
|
|
198
|
+
`))}function $p(t){let e=t.map(([n])=>`\`${n}\``),r=ee(", ");g.warn(`
|
|
199
|
+
warning: ${e.length} conflict(s) on the ${qe(e.join(r))} tags description.
|
|
200
|
+
`)}function Uy(t,e){return!Dt(Object.values(t)[0],Object.values(e)[0])}function qy(t){let e=!1;for(let r=0,n=t.length;r<n;r++){let o=t[r+1];o&&Uy(t[r],o)&&(e=!0)}return e}var Ws=0;function Rp({potentialConflicts:t,withoutXTagGroups:e}){for(let r of Object.keys(t))for(let[n,o]of Object.entries(t[r])){let s=vp(o);if(s.length){if(r===xe)for(let[i,a]of Object.entries(s))qy(a[1])&&(a[1]=a[1].map(c=>Object.keys(c)[0]),qs(fe(r)+" => "+n,[a]),Ws+=1);else e&&r==="tags"?$p(s):(Ws+=s.length,qs(fe(r)+" => "+n,s));r==="tags"&&!e&&Pp(s.length)}}return Ws}var Lr="tags",Lt="x-tagGroups";function ur({joinedDef:t,withoutXTagGroups:e,context:r}){let{api:n,apiFilename:o,apiTitle:s,tags:i,potentialConflicts:a,tagsPrefix:c,componentsPrefix:l,oasVersion:u}=r;t.hasOwnProperty(Lr)||(t[Lr]=[]),a.tags.hasOwnProperty("all")||(a.tags.all={}),e&&!a.tags.hasOwnProperty("description")&&(a.tags.description={});for(let p of i||[]){let m=Ot(p.name,c);p.description&&(p.description=lo(p.description,l));let d=t.tags.find(h=>h.name===m);if(d&&e){let h=p.hasOwnProperty("description")&&d.description!==p.description;a.tags.description[m].push(...h?[n]:[])}else d||(u==="oas3_0"||u==="oas3_1"?p["x-displayName"]=p["x-displayName"]||p.name:u==="oas3_2"&&(p.summary=p.summary||p.name),p.name=m,t.tags.push(p),e&&(a.tags.description[m]=[n]));if(!e&&u!=="oas3_2"){let h=s||o;Wy(t,h),d||zy(t,m,_p(t,h))}let b=!a.tags.all[m]||a.tags.all[m]&&!a.tags.all[m].includes(n);a.tags.all[m]=[...a.tags.all[m]||[],...!e&&b?[n]:[]]}}function _p(t,e){return t[Lt].findIndex(r=>r.name===e)}function Wy(t,e){t.hasOwnProperty(Lt)||(t[Lt]=[]),t[Lt].some(n=>n.name===e)||t[Lt].push({name:e,tags:[]});let r=_p(t,e);t[Lt][r].hasOwnProperty(Lr)||(t[Lt][r][Lr]=[])}function zy(t,e,r){t[Lt][r][Lr].find(n=>n.name===e)||t[Lt][r][Lr].push(e)}import*as jp from"node:path";function Ip({joinedDef:t,openapi:e,context:r}){let{api:n}=r,{externalDocs:o}=e;if(o){if(t.hasOwnProperty("externalDocs")){g.warn(`warning: skip externalDocs from ${Z(jp.basename(n))}
|
|
201
|
+
`);return}t.externalDocs=o}}function Tp({joinedDef:t,withoutXTagGroups:e,openapi:r,context:n,serversAreTheSame:o}){let{apiFilename:s,apiTitle:i,api:a,potentialConflicts:c,tagsPrefix:l,componentsPrefix:u,oasVersion:p}=n,{paths:m,servers:d}=r,b=new Set(In);if(m){t.hasOwnProperty("paths")||(t.paths={});for(let v of Ro(m)){t.paths.hasOwnProperty(v)||(t.paths[v]={}),c.paths.hasOwnProperty(v)||(c.paths[v]={});let O=m[v],$=o?O.servers:O.servers||d||[];$&&C($,v);for(let F of Ro(O))b.has(F)&&E(O,v,F),F==="parameters"&&x(O,v),(typeof O[F]=="string"||F.startsWith("x-"))&&h(O,v,F)}}function h(v,O,$){let F=v[$];if(t.paths[O].hasOwnProperty($)&&!Dt(t.paths[O][$],F)){g.warn(`warning: different ${$} values in ${O}
|
|
202
|
+
`);return}t.paths[O][$]=F}function C(v,O){if(v){t.paths[O].hasOwnProperty("servers")||(t.paths[O].servers=[]);for(let $ of v){let F=!1;for(let D of t.paths[O].servers)D.url===$.url&&(Vy(D,$)||z(`Different server values for (${$.url}) in ${O}.`),F=!0);F||t.paths[O].servers.push($)}}}function x(v,O){if(v.parameters){t.paths[O].hasOwnProperty("parameters")||(t.paths[O].parameters=[]);for(let $ of v.parameters){let F=!1;for(let D of t.paths[O].parameters)De(D)&&De($)&&D.$ref===$.$ref&&(F=!0),!De(D)&&!De($)&&D.name===$.name&&D.in===$.in&&(Dt(D.schema,$.schema)||z(`Different parameter schemas for (${$.name}) in ${O}.`),F=!0);F||t.paths[O].parameters.push($)}}}function E(v,O,$){let F=v[$];if(!F)return;t.paths[O][$]=F,c.paths[O][$]=[...c.paths[O][$]||[],a];let{operationId:D}=F;D&&(c.paths.hasOwnProperty("operationIds")||(c.paths.operationIds={}),c.paths.operationIds[D]=[...c.paths.operationIds[D]||[],a]);let{tags:ne,security:X}=t.paths[O][$];ne?(t.paths[O][$].tags=ne.map(ue=>Ot(ue,l)),ur({joinedDef:t,withoutXTagGroups:e,context:{api:a,apiFilename:s,apiTitle:i,tags:mn(ne),potentialConflicts:c,tagsPrefix:l,componentsPrefix:u,oasVersion:p}})):(t.paths[O][$].tags=[Ot("other",l||s)],ur({joinedDef:t,withoutXTagGroups:e,context:{api:a,apiFilename:s,apiTitle:i,tags:mn(["other"]),potentialConflicts:c,tagsPrefix:l||s,componentsPrefix:u,oasVersion:p}})),!X&&r.hasOwnProperty("security")?t.paths[O][$].security=Us(r.security,u):F.security&&(t.paths[O][$].security=Us(F.security,u))}}function Vy(t,e){return t.description===e.description?Dt(t.variables,e.variables):!1}function Np({joinedDef:t,openapi:e,context:r}){let{api:n,potentialConflicts:o,componentsPrefix:s}=r,{components:i}=e;if(i){t.hasOwnProperty(xe)||(t[xe]={});for(let[a,c]of Object.entries(i)){o[xe].hasOwnProperty(a)||(o[xe][a]={},t[xe][a]={});for(let l of Object.keys(c)){let u=Ot(l,s);o.components[a][u]=[...o.components[a][l]||[],{[n]:c[l]}],t.components[a][u]=c[l]}}}}function Lp({joinedDef:t,withoutXTagGroups:e,openapi:r,context:n}){let{apiFilename:o,apiTitle:s,api:i,potentialConflicts:a,tagsPrefix:c,componentsPrefix:l,oasVersion:u}=n,p=u==="oas3_0"?"x-webhooks":"webhooks",m=r[p];if(m){t.hasOwnProperty(p)||(t[p]={});for(let d of Object.keys(m)){t[p][d]=m[d],a.webhooks.hasOwnProperty(d)||(a.webhooks[d]={});for(let b of Object.keys(m[d]))a.webhooks[d][b]=[...a.webhooks[d][b]||[],i];for(let b of Object.keys(t[p][d])){let{tags:h}=t[p][d][b];h&&(t[p][d][b].tags=h.map(C=>Ot(C,c)),ur({joinedDef:t,withoutXTagGroups:e,context:{api:i,apiFilename:o,apiTitle:s,tags:mn(h),potentialConflicts:a,tagsPrefix:c,componentsPrefix:l,oasVersion:u}}))}}}}function Dp(t,e,r){let o=e[0].parsed,s=fn(o.info,r,xe);o.openapi||z("Version of specification is not found."),o.info||z("Info section is not found in specification."),o.info?.description&&(o.info.description=lo(o.info.description,s)),t.openapi=o.openapi,t.info=o.info}async function kp({argv:t,config:e,version:r,collectSpecData:n}){let o=Gy.now(),{"prefix-components-with-info-prop":s,"prefix-tags-with-filename":i,"prefix-tags-with-info-prop":a,"without-x-tag-groups":c,output:l}=t,u=[i&&"prefix-tags-with-filename",a&&"prefix-tags-with-info-prop",c&&"without-x-tag-groups"].filter(Boolean);if(u.length>1)return z(`You use ${ee(u.join(", "))} together.
|
|
203
|
+
Please choose only one!`);let p=await lt(t.apis,e);if(p.length<2)return z("At least 2 APIs should be provided.");let m=_n(l||p[0].path),d=l||`openapi.${m}`,b=new St(e.resolve),h=await Promise.all(p.map(({path:R})=>b.resolveDocument(null,R,!0))),C=new Set([...Object.keys(e.decorators.oas3_0),...Object.keys(e.decorators.oas3_1),...Object.keys(e.decorators.oas2)]);e.skipDecorators(Array.from(C));let x=new Set([...Object.keys(e.preprocessors.oas3_0),...Object.keys(e.preprocessors.oas3_1),...Object.keys(e.preprocessors.oas2)]);e.skipPreprocessors(Array.from(x));let E=await Promise.all(h.map(R=>vi({document:R,config:e,externalRefResolver:new St(e.resolve),types:br(wt(R.parsed))}).catch(P=>{z(`${P.message}: ${Z(R.source.absoluteRef)}`)})));for(let{problems:R,bundle:P}of E){let M=On(R);M.errors&&(xn(R,{totals:M,version:r,command:"join"}),z(`\u274C Errors encountered while bundling ${Z(P.source.absoluteRef)}: join will not proceed.`))}let v=null;for(let R of h)try{let P=wt(R.parsed);if(n?.(R),P!=="oas3_0"&&P!=="oas3_1"&&P!=="oas3_2")return z(`Only OpenAPI 3.0, 3.1, and 3.2 are supported: ${Z(R.source.absoluteRef)}.`);if(v=v??P,v!==P)return z(`All APIs must use the same OpenAPI version: ${Z(R.source.absoluteRef)}.`)}catch(P){return z(`${P.message}: ${Z(R.source.absoluteRef)}.`)}let[O,...$]=h??[],F=$.every(({parsed:{paths:R,servers:P}})=>!R||At(R||{})?!0:P?.every(M=>O.parsed.servers?.find(({url:q})=>q===M.url))),D={},ne={tags:{},paths:{},components:{},webhooks:{}};Dp(D,h,s),F&&O.parsed.servers&&(D.servers=O.parsed.servers);for(let R of h){let P=te(R.parsed)?R.parsed:{},{tags:M,info:q}=P,se=Mp.relative(process.cwd(),R.source.absoluteRef),re=Ap(se),Y=i?re:fn(q,a,"tags"),le=fn(q,s,xe);P.hasOwnProperty("x-tagGroups")&&g.warn(`warning: x-tagGroups at ${Z(se)} will be skipped
|
|
204
|
+
`);let Ne={api:se,apiFilename:re,apiTitle:q?.title,tags:M,potentialConflicts:ne,tagsPrefix:Y,componentsPrefix:le,oasVersion:v};M&&ur({joinedDef:D,withoutXTagGroups:c,context:Ne}),Ip({joinedDef:D,openapi:P,context:Ne}),Tp({joinedDef:D,withoutXTagGroups:c,openapi:P,context:Ne,serversAreTheSame:F}),Np({joinedDef:D,openapi:P,context:Ne}),Lp({joinedDef:D,withoutXTagGroups:c,openapi:P,context:Ne}),le&&Op(P,le)}let X=Rp({potentialConflicts:ne,withoutXTagGroups:c}),ue=!0;if(X)return z(`Please fix conflicts before running ${ee("join")}.`);Ie(Xr(D),d,ue),Qe("join",o,d)}var zs={realm:"@redocly/realm","redoc-revel":"@redocly/redoc-revel","revel-reef":"@redocly/revel-reef","redoc-reef":"@redocly/redoc-reef",redoc:"@redocly/redoc",revel:"@redocly/revel",reef:"@redocly/reef"},Vs={redoc:"Redoc",revel:"Revel",reef:"Reef",realm:"Realm","redoc-revel":"Redoc + Revel","redoc-reef":"Redoc + Reef","revel-reef":"Revel + Reef"},Fp=["pro","enterprise"];import{spawn as By}from"node:child_process";import{existsSync as Hy,readFileSync as Yy}from"node:fs";import Ky from"node:path";var Up=async({argv:t})=>{let{plan:e,port:r}=t,n=t["project-dir"],o=t.product||Xy(n);if(!Jy(o))throw g.info(`Invalid product ${o}.`),new Error("Project preview launch failed.");let s=Vs[o],i=zs[o];g.info(`
|
|
126
205
|
Launching preview of ${s} ${e} using NPX.
|
|
127
206
|
|
|
128
|
-
`);let{npxExecutableName:a,shell:c}=
|
|
129
|
-
${s} detected in project's 'package.json'`),o}catch{
|
|
130
|
-
`,s+=`${
|
|
131
|
-
`,s+=`${
|
|
132
|
-
`,t.forEach(({file:i,executedWorkflows:a,argv:c})=>{let
|
|
133
|
-
`}),s+=`${
|
|
134
|
-
`,e.output(s)}function
|
|
135
|
-
`+
|
|
207
|
+
`);let{npxExecutableName:a,shell:c}=Ir();By(a,["-y",i,"preview",`--plan=${e}`,`--port=${r||4e3}`],{stdio:"inherit",cwd:n,shell:c}).on("error",u=>{throw g.info(`Project preview launch failed: ${u.message}`),new Error("Project preview launch failed.")})},Jy=t=>t?!!Vs[t]:!1,Xy=t=>{let e=Ky.join(process.cwd(),t,"package.json");if(Hy(e))try{let n=JSON.parse(Yy(e,"utf-8")).dependencies||{};for(let[o,s]of Object.entries(zs))if(n[s])return g.info(`
|
|
208
|
+
${s} detected in project's 'package.json'`),o}catch{g.info(`Invalid 'package.json': ${e}. Using Realm.`)}return"realm"};import{existsSync as Sb,readFileSync as Eb,writeFileSync as lu}from"node:fs";import{dirname as Cb,basename as Ob}from"node:path";function Gs(t,e){return JSON.stringify(t,(n,o)=>{if(o instanceof ArrayBuffer){if(o.byteLength>1048576)return{__type:"ArrayBuffer",data:`File too large to serialize (${o.byteLength} bytes). Maximum allowed size is 1048576 bytes.`,byteLength:o.byteLength};let s=new Uint8Array(o);return{__type:"ArrayBuffer",data:Buffer.from(s).toString("base64"),byteLength:o.byteLength}}return o instanceof File?{__type:"File",name:o.name||"[File Object]",size:o.size||0,type:o.type||"",lastModified:o.lastModified||0}:o},e)}var qp=_t(os(),1);import*as Wp from"node:fs";import*as fr from"node:path";function zp(t){if(t){let e=fr.dirname(t);for(;e!==fr.resolve(e,"..");){let r=fr.join(e,".env");if(Wp.existsSync(r)){qp.config({path:r});break}e=fr.resolve(e,"..")}}return process.env}var Vt=_t(Ii(),1);function Zy(t,e={}){let{clientCert:r,clientKey:n,caCert:o}=e,s=new URL(t).origin,i=jo(),a=i&&!Ti(t);if(r&&n&&a)return new Vt.ProxyAgent({uri:i,connect:{key:Buffer.from(n),cert:Buffer.from(r),...o&&{ca:Buffer.from(o)},rejectUnauthorized:!0}});if(r&&n)return new Vt.Client(s,{connect:{key:Buffer.from(n),cert:Buffer.from(r),...o&&{ca:Buffer.from(o)},rejectUnauthorized:!0}});if(a)return new Vt.ProxyAgent({uri:i})}function Vp(t){if(!jo()&&(!t||Object.keys(t).length===0))return Vt.fetch;let r=new Map;return(n,o)=>{let s=typeof n=="string"?n:n instanceof URL?n.toString():"url"in n?n.url:void 0;if(!s)throw new Error("Invalid input URL");let i=t?Qy(s,t):void 0,a=new URL(s).origin,c=r.get(a);return c||(c=Zy(s,i)||o?.dispatcher,c&&r.set(a,c)),(0,Vt.fetch)(n,{...o,dispatcher:c})}}function Qy(t,e){let r=new URL(t);return e[r.origin]||e[r.hostname]}import*as Bs from"node:path";function Gp(t,e){let n=Math.max(...t.map(({file:i})=>Bs.basename(i).length+40)),o=[{name:"Filename",width:n},{name:"Workflows",width:10},{name:"Passed",width:7},{name:"Failed",width:7},{name:"Warnings",width:8}],s="";s+=`${me(`\u250C${o.map(i=>"\u2500".repeat(i.width+2)).join("\u252C")}\u2510`)}
|
|
209
|
+
`,s+=`${me(`\u2502${o.map(i=>` ${i.name.padEnd(i.width)} `).join("\u2502")}\u2502`)}
|
|
210
|
+
`,s+=`${me(`\u251C${o.map(i=>"\u2500".repeat(i.width+2)).join("\u253C")}\u2524`)}
|
|
211
|
+
`,t.forEach(({file:i,executedWorkflows:a,argv:c})=>{let l=Bs.basename(i),u=c?.workflow||[],p=c?.skip||[],m=u&&u.length?a.filter(({workflowId:$})=>u.includes($)):a;m=p&&p.length?m.filter(({workflowId:$})=>!p.includes($)):m;let{workflows:d}=jn(m),b=me(d.total.toString().padEnd(11)),h=fe(d.passed.toString().padEnd(8)),C=d.failed>0?qe(d.failed.toString().padEnd(8)):me("-".padEnd(8)),x=d.warnings>0?ee(d.warnings.toString().padEnd(9)):me("-".padEnd(9)),v=`${d.failed>0?"x":"\u2713"} ${l}`.padEnd(n+1),O=d.failed>0?qe(v):fe(v);s+=me("\u2502")+` ${O}`+me("\u2502")+` ${b}`+me("\u2502")+` ${h}`+me("\u2502")+` ${C}`+me("\u2502")+` ${x}`+me("\u2502")+`
|
|
212
|
+
`}),s+=`${me(`\u2514${o.map(i=>"\u2500".repeat(i.width+2)).join("\u2534")}\u2518`)}${Gi}
|
|
213
|
+
`,e.output(s)}function Bp({entries:t=[],pageInfo:e={},version:r}={entries:[],pageInfo:{},version:void 0}){return{log:{version:"1.2",creator:{name:"@redocly/respect-core",version:r},pages:[Object.assign({startedDateTime:new Date().toISOString(),id:"page_1",title:"Page",pageTimings:{onContentLoad:-1,onLoad:-1}},e)],entries:t}}}var ou=_t(Ii(),1);import{URL as db}from"url";function Hp(t,e){if(t)if(typeof t.set=="function"&&typeof t.constructor=="function"){let r=t.constructor,n=new r(t);for(let o in e)n.set(o,e[o]);return n}else return Object.assign({},t,e);else return e}function dn(t){let e=[];if(Array.isArray(t))for(let r=0;r<t.length;r+=2)e.push({name:t[r],value:t[r+1]});else if(t instanceof Map||t.entries)for(let[r,n]of t.entries())e.push({name:r,value:n});else if(te(t))for(let[r,n]of Object.entries(t))e.push({name:r,value:n});return e}function Yp(t,e={}){let r=eb(t);if(r===void 0||r==="")return{};let n=dn(e).find(({name:i})=>String(i).toLowerCase()==="content-type")?.value,o=Array.isArray(n)?n.join(","):n,s=t instanceof URLSearchParams?"application/x-www-form-urlencoded;charset=UTF-8":"application/octet-stream";return{mimeType:typeof o=="string"?o:s,text:r}}function eb(t){if(typeof t=="string")return t;if(t instanceof URLSearchParams)return t.toString()}var Zp=_t(Xp(),1);function Qp(t){let e=[];for(let[r,n]of Object.entries(t))if(r.toLowerCase()==="cookie"){let o=Array.isArray(n)?n:[n];for(let s of o){let i=Zp.parse(s);for(let[a,c]of Object.entries(i))e.push({name:a,value:c})}}return e}var ru=_t(tu(),1);function nu(t){let e=[],r=t instanceof Headers?t.getSetCookie():t["set-cookie"];if(r)for(let n of r){let o;try{o=ru.parse(n)}catch{continue}for(let s of o){let{name:i,value:a,path:c,domain:l,expires:u,httpOnly:p,secure:m}=s,d={name:i,value:a,httpOnly:p||!1,secure:m||!1};c&&(d.path=c),l&&(d.domain=l),u&&(d.expires=u.toISOString()),e.push(d)}}return e}function Gt(t,e){let r=e[0]-t[0],n=e[1]-t[1];return r*1e3+n/1e6}var hb="x-har-request-id",fo=new Map,Js=function(t,e={}){return Js.harEntryMap=fo,async function(n,o={}){let{har:s=e.har,harPageRef:i=e.harPageRef,onHarEntry:a=e.onHarEntry}=o;if(s===!1)return t(n,o);let c=crypto.randomUUID(),l=process.hrtime(),u=new db(typeof n=="string"?n:n.url),p=Yp(o.body,o.headers||{}),m={_compressed:!1,_resourceType:"fetch",_timestamps:{start:l,socket:l,lookup:l,connect:l,secureConnect:l,sent:l,firstByte:l,received:l},timings:{blocked:-1,dns:-1,connect:-1,send:0,wait:0,receive:0,ssl:-1},time:0,startedDateTime:new Date().toISOString(),cache:{beforeRequest:null,afterRequest:null},request:{method:o.method||"GET",url:u.href,cookies:Qp(o.headers||{}),headers:dn(o.headers||{}),queryString:[...u.searchParams].map(([ue,R])=>({name:ue,value:R})),headersSize:-1,bodySize:p.text!==void 0?Buffer.byteLength(p.text):o.body?-1:0,...p.text!==void 0&&{postData:p},httpVersion:"HTTP/1.1"},response:{},pageref:""},d=o.dispatcher||new ou.Client(u.origin);d.on("connect",()=>m._timestamps.connect=process.hrtime()),o=Object.assign({},o,{headers:Hp(o.headers,{[hb]:c}),dispatcher:d}),fo.set(c,m),m._timestamps.sent=process.hrtime();let b=await t(n,o),h=b.clone(),C=b.clone();m._timestamps.firstByte=process.hrtime();let x=b.body===null?"":await h.text();m._timestamps.received=process.hrtime();let E=fo.get(c);if(fo.delete(c),!E)return b;E.response||(E.response={});let v=[...b.headers.entries()].map(([ue,R])=>`${ue}: ${R}`),O=`HTTP/1.1 ${b.status} ${b.statusText}`,$=Buffer.byteLength(O+`\r
|
|
214
|
+
`+v.join(`\r
|
|
136
215
|
`)+`\r
|
|
137
216
|
\r
|
|
138
|
-
`);if(
|
|
217
|
+
`);if(E._compressed=/^(gzip|compress|deflate|br)$/.test(b.headers.get("content-encoding")||""),E.response.content||(E.response.content={size:-1}),E._compressed){let ue=await C.arrayBuffer();E.response.content.size=ue.byteLength}else E.response.content.size=x?Buffer.byteLength(x):-1;let F=x?Buffer.byteLength(x):-1;E.response={headers:dn(b.headers),cookies:nu(b.headers),status:b.status,statusText:b.statusText||"",httpVersion:b.httpVersion?`HTTP/${b.httpVersion}`:"HTTP/1.1",redirectURL:b.headers.location||"",content:{size:E._compressed&&E.response.content.size!==-1?E.response.content.size:Buffer.byteLength(x),mimeType:b.headers.get("content-type")||"",text:x,compression:E._compressed&&E.response.content.size!==-1?E.response.content.size-F:0},bodySize:F,headersSize:$};let{_timestamps:D}=E;E.timings={blocked:Math.max(Gt(D.start,D.socket),.01),dns:-1,connect:Math.max(Gt(D.lookup,D.connect),-1),ssl:D.secureConnect?Math.max(Gt(D.connect,D.secureConnect),-1):-1,send:Gt(D.secureConnect||D.connect,D.sent),wait:Math.max(Gt(D.sent,D.firstByte),0),receive:Gt(D.firstByte,D.received)},E.time=Gt(D.start,D.received);let ne=[],X=E;do{let ue=X._parent;delete X._parent,ue&&ne.unshift(ue),X=ue}while(X);return m.pageref=i||"page_1",ne.forEach(ue=>{ue.pageref=m.pageref}),b.harEntry=m,Array.isArray(s?.log?.entries)&&s.log.entries.push(...ne,m),a&&(ne.forEach(ue=>{a(ue)}),a(m)),b}};function su(t){let e={};for(let r of t){let{executedWorkflows:n,globalTimeoutError:o,ctx:s,secretValues:i}=r;e[r.file]=Bi({value:{totalRequests:r.totalRequests,executedWorkflows:n.map(a=>iu(a)),totalTimeMs:r.totalTimeMs,globalTimeoutError:o,secretValues:i},noSecretsMasking:s.noSecretsMasking,secretsSet:s.secretsSet||new Set})}return e}function iu(t){let{ctx:e,...r}=t,n=t.executedSteps.map(i=>gb(i,t.workflowId,e)),o=jn([t]);return{...r,executedSteps:n,status:o.steps.failed>0?"error":o.steps.warnings>0?"warn":"success",totalRequests:o.totalRequests,totalTimeMs:t.totalTimeMs}}function gb(t,e,r){if("executedSteps"in t)return iu(t);let n=r.$workflows[e].steps[t.stepId];return{type:"step",stepId:t.stepId,workflowId:e,request:{method:n?.request?.method||"",url:t.response?.requestUrl||"",headers:n?.request?.header||{},body:n?.request?.body},response:{statusCode:t.response?.statusCode||0,body:n?.response?.body,headers:t.response?.header||{},time:t.response?.time||0,size:t.response?.responseSize},checks:t.checks.map(o=>({...o,status:yb(o)})),totalTimeMs:n?.response?.time||0,retriesLeft:t.retriesLeft,status:bb(t.checks)}}function yb(t){return t.passed?"success":t.severity==="error"?"error":"warn"}function bb(t){let e=!1;for(let r of t){if(!r.passed&&r.severity==="error")return"error";!r.passed&&r.severity==="warn"&&(e=!0)}return e?"warn":"success"}import*as Dr from"node:fs";import*as au from"node:path";function cu(t={},e){let r={};for(let[n,o]of Object.entries(t))r[n]={clientCert:Xs(o.clientCert,e),clientKey:Xs(o.clientKey,e),caCert:Xs(o.caCert,e)};return r}function Xs(t,e){if(t)try{if(!(t.includes("-----BEGIN")&&t.includes("-----END"))){let n=au.resolve(e,t);return Dr.accessSync(n,Dr.constants.R_OK),Dr.readFileSync(n,"utf-8")}return wb(t)}catch(r){throw new Error(`Failed to read certificate: ${r.message}`)}}function wb(t){let e=t.match(/^(-----BEGIN[^-]+-----)\r?\n([A-Za-z0-9+/=\r\n\t ]+)\r?\n(-----END[^-]+-----)/);if(!e)throw new Error("Invalid certificate format");let[,r,n,o]=e,s=n.replace(/\s+/g,"").match(/.{1,64}/g)?.join(`
|
|
139
218
|
`)||"";return`${r}
|
|
140
219
|
${s}
|
|
141
|
-
${o}`}async function bp({argv:t,config:e,version:r,collectSpecData:n}){let o,s;try{let{run:i,conditionallyMaskSecrets:a}=await import("./chunks/REBHK2JR.js"),c=e.configPath?dy(e.configPath):process.cwd();t.mtls&&(o=gp(t.mtls,c));let p=Ql(o);t["har-output"]&&(s=tp({version:r}),p=Ps(p,{har:s}));let u=new ft({http:{headers:e.resolve?.http?.headers??[],customFetch:p}}),l={files:t.files,input:t.input,server:t.server,workflow:t.workflow,skip:t.skip,verbose:t.verbose,config:e,version:r,collectSpecData:n,severity:t.severity,maxSteps:t["max-steps"],maxFetchTimeout:t["max-fetch-timeout"],executionTimeout:t["execution-timeout"],requestFileLoader:{getFileBody:async x=>{if(!fy(x))throw new Error(`File ${x} doesn't exist or isn't readable.`);let C=my(x);return new File([C],hy(x))}},envVariables:Zl(c)||{},logger:y,fetch:p,externalRefResolver:u,noSecretsMasking:t["no-secrets-masking"]};if(l.skip&&l.workflow)throw new Error("Cannot use both --skip and --workflow flags at the same time.");if(t["har-output"]&&!t["har-output"].endsWith(".har"))throw new Error("File for HAR logs should be in .har format");if(t["json-output"]&&!t["json-output"].endsWith(".json"))throw new Error("File for JSON logs should be in .json format");if(l.files.length>1&&t["har-output"])throw new Error("Currently only a single file can be run with --har-output. Please run a single file at a time.");let m=performance.now(),d=await i(l);y.printNewLine(),ep(d,y),y.printNewLine();let w=d.some(x=>x.hasProblems),h=d.some(x=>x.hasWarnings);if(t["json-output"]){let x={files:mp(d),status:w?"error":h?"warn":"success",totalTime:performance.now()-m};yp(t["json-output"],Es(x,2),"utf-8"),y.output(Q(y.indent(`JSON logs saved in ${pe(t["json-output"])}`,2))),y.printNewLine(),y.printNewLine()}if(t["har-output"])for(let x of d){let C=a({value:s,noSecretsMasking:x.ctx.noSecretsMasking,secretsSet:x.ctx.secretsSet||new Set});yp(t["har-output"],Es(C,2),"utf-8"),y.output(Q(`Har logs saved in ${pe(t["har-output"])}`)),y.printNewLine(),y.printNewLine()}if(w)throw new Error(" Tests exited with error ")}catch(i){throw new Ve(i?.message??i)}}function wp(t){if(Array.isArray(t)){let e={};for(let r of t)if(r&&typeof r=="string"){let n=Sp(r);Object.assign(e,n)}return Object.keys(e).length>0?e:void 0}if(!(!t||typeof t!="string"))return Sp(t)}function Sp(t){try{let e=JSON.parse(t);if(!re(e))throw new Error("mTLS config must be an object mapping domains to certificate configurations");for(let[r,n]of Object.entries(e)){if(!re(n))throw new Error(`mTLS config for domain "${r}" must be an object`);$s(n,"clientCert",r,!0),$s(n,"clientKey",r,!0),$s(n,"caCert",r,!1)}return e}catch(e){throw e instanceof SyntaxError?new Error(`Invalid JSON for --mtls option: ${e.message}`):e}}function $s(t,e,r,n){let o=t[e];if(!o){if(n)throw new Error(`${e} is required for domain "${r}"`);return}if(typeof o!="string")throw new Error(`${e} for domain "${r}" must be a string`)}import{performance as Dy}from"perf_hooks";var wt={thresholds:{maxParamsGood:5,maxDepthGood:4,maxPolymorphismGood:2,maxDependencyDepthGood:3,maxAmbiguousGood:0,maxOperationsForDiscoverability:1e3},weights:{parameterSimplicity:.1,schemaSimplicity:.1,documentationQuality:.18,constraintClarity:.12,exampleCoverage:.18,errorClarity:.12,dependencyClarity:.1,identifierClarity:.05,polymorphismClarity:.05,anyOfPenaltyMultiplier:2,discoverabilityWeight:.1},hotspotLimit:10},Ep=new Set(["id","name","type","value","data","key","status","state","code","result","item","object","resource","entity","input","output","payload","body","content","info"]);function Zn(t){if(t.length===0)return 0;let e=[...t].sort((n,o)=>n-o),r=Math.floor(e.length/2);return e.length%2!==0?e[r]:(e[r-1]+e[r])/2}function gy(t,e,r=wt){let{thresholds:n,weights:o}=r,s=pt(1-t.parameterCount/(n.maxParamsGood*2)),a=Math.max(t.maxRequestSchemaDepth,t.maxResponseSchemaDepth)/(n.maxDepthGood*2),c=Op(t,o.anyOfPenaltyMultiplier)/(n.maxPolymorphismGood*3),p=pt(1-a-c),u=(t.operationDescriptionPresent?1:0)+t.paramsWithDescription+t.schemaPropertiesWithDescription,l=1+t.parameterCount+t.totalSchemaProperties,m=l>0?pt(u/l):1,d=t.totalSchemaProperties>0?pt(t.constraintCount/t.totalSchemaProperties):1,w=(t.requestExamplePresent?1:0)+(t.responseExamplePresent?1:0),h=(t.requestBodyPresent?1:0)+1,x=pt(w/h),C=t.totalErrorResponses>0?pt(t.structuredErrorResponseCount/t.totalErrorResponses):1,O=pt(1-e/(n.maxDependencyDepthGood*2)),v=pt(1-t.ambiguousIdentifierCount/Math.max(n.maxAmbiguousGood+3,1)),E=Op(t,o.anyOfPenaltyMultiplier),R=E===0?1:t.hasDiscriminator?pt(1-E/(n.maxPolymorphismGood*4)):pt(1-E/(n.maxPolymorphismGood*2));return{parameterSimplicity:s,schemaSimplicity:p,documentationQuality:m,constraintClarity:d,exampleCoverage:x,errorClarity:C,dependencyClarity:O,identifierClarity:v,polymorphismClarity:R}}function yy(t,e=wt){let r=e.weights,n=t.parameterSimplicity*r.parameterSimplicity+t.schemaSimplicity*r.schemaSimplicity+t.documentationQuality*r.documentationQuality+t.constraintClarity*r.constraintClarity+t.exampleCoverage*r.exampleCoverage+t.errorClarity*r.errorClarity+t.dependencyClarity*r.dependencyClarity+t.identifierClarity*r.identifierClarity+t.polymorphismClarity*r.polymorphismClarity;return Pp(pt(n)*100)}function Cp(t,e,r=wt){let n=new Map;for(let[o,s]of t.operations){let i=e.get(o)??0,a=gy(s,i,r);n.set(o,{agentReadiness:yy(a,r),subscores:a})}return n}function Ap(t,e=wt){return pt(1-t/e.thresholds.maxOperationsForDiscoverability)}function xp(t,e,r=wt){if(t.size===0)return{agentReadiness:100};let n=[];for(let i of t.values())n.push(i.agentReadiness);let o=r.weights.discoverabilityWeight,s=e*100;return{agentReadiness:Pp(Zn(n)*(1-o)+s*o)}}function _s(t,e,r){return t-e+e*r}function Op(t,e){return _s(t.polymorphismCount,t.anyOfCount,e)}function pt(t){return Math.max(0,Math.min(1,t))}function vp(t){let e=t.size||1,r={parameterSimplicity:0,schemaSimplicity:0,documentationQuality:0,constraintClarity:0,exampleCoverage:0,errorClarity:0,dependencyClarity:0,identifierClarity:0,polymorphismClarity:0};for(let n of t.values())r.parameterSimplicity+=n.subscores.parameterSimplicity,r.schemaSimplicity+=n.subscores.schemaSimplicity,r.documentationQuality+=n.subscores.documentationQuality,r.constraintClarity+=n.subscores.constraintClarity,r.exampleCoverage+=n.subscores.exampleCoverage,r.errorClarity+=n.subscores.errorClarity,r.dependencyClarity+=n.subscores.dependencyClarity,r.identifierClarity+=n.subscores.identifierClarity,r.polymorphismClarity+=n.subscores.polymorphismClarity;return r.parameterSimplicity/=e,r.schemaSimplicity/=e,r.documentationQuality/=e,r.constraintClarity/=e,r.exampleCoverage/=e,r.errorClarity/=e,r.dependencyClarity/=e,r.identifierClarity/=e,r.polymorphismClarity/=e,r}function Pp(t){return Math.round(t*10)/10}function Rp(t,e,r){let n=Math.max(1,t);return e/n+r/n}function by(t,e){return e.totalSchemaProperties>t.totalSchemaProperties?!0:e.totalSchemaProperties<t.totalSchemaProperties?!1:Rp(e.totalSchemaProperties,e.schemaPropertiesWithDescription,e.constraintCount)>Rp(t.totalSchemaProperties,t.schemaPropertiesWithDescription,t.constraintCount)}var Sy=["enum","const","format","pattern","minimum","maximum","minLength","maxLength","minItems","maxItems","minProperties","maxProperties","multipleOf","exclusiveMinimum","exclusiveMaximum","uniqueItems"];function Is(){return{depth:-1,maxDepth:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,hasPropertyExamples:!1,writableTopLevelFields:0,refsUsed:[],debugEntries:null,pendingRef:null}}function Ip(t){Object.assign(t,Is())}function Tp(t){return{ref:{enter(e){typeof e?.$ref=="string"&&(t.refsUsed.push(e.$ref),t.pendingRef=e.$ref)}},Schema:{enter(e,r){t.depth++,t.maxDepth=Math.max(t.maxDepth,t.depth);let n=0;for(let i of Sy)e[i]!==void 0&&(t.constraintCount++,n++);e.discriminator?.propertyName&&(t.hasDiscriminator=!0);let o={};for(let i of["oneOf","anyOf","allOf"]){let a=e[i];Array.isArray(a)&&(t.polymorphismCount+=a.length,i==="anyOf"&&(t.anyOfCount+=a.length),o[i]=a.length)}let s=[];if(re(e.properties)){let i=Object.entries(e.properties);t.totalSchemaProperties+=i.length;for(let[a,c]of i){s.push(a);let p=c&&"$ref"in c&&c.$ref?r.resolve(c)?.node??c:c;p?.description&&t.schemaPropertiesWithDescription++,(p?.example!==void 0||p?.examples)&&(t.hasPropertyExamples=!0),p?.readOnly||t.writableTopLevelFields++}}t.debugEntries!==null&&t.debugEntries.push({ref:t.pendingRef,depth:t.depth,propertyNames:s,polymorphism:Object.keys(o).length>0?o:{},constraintCount:n}),t.pendingRef=null},leave(){t.depth--}}}}function jp(t,e,r){return{operations:new Map,currentPath:"",pathLevelParams:[],current:null,walkSchema:t,anyOfPenaltyMultiplier:e,debugOperationId:r,debugLogs:[]}}function wy(t,e,r){return{path:t,method:e,operationId:r.operationId,operationDescriptionPresent:!!r.description,parameterCount:0,requiredParameterCount:0,paramsWithDescription:0,ambiguousIdentifierCount:0,maxRequestSchemaDepth:0,maxResponseSchemaDepth:0,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,topLevelWritableFieldCount:0,requestBodyPresent:!1,requestExamplePresent:!1,responseExamplePresent:!1,structuredErrorResponseCount:0,totalErrorResponses:0,inRequestBody:!1,inResponse:!1,currentResponseCode:"",errorStructuredCounted:!1,maxEffectivePolymorphism:-1,refsUsed:new Set}}function Ey(t){let{inRequestBody:e,inResponse:r,currentResponseCode:n,errorStructuredCounted:o,maxEffectivePolymorphism:s,...i}=t;return i}function Dp(t){return{RequestBody:{enter(){t.current&&(t.current.requestBodyPresent=!0,t.current.inRequestBody=!0)},leave(){t.current&&(t.current.inRequestBody=!1)}},Response:{enter(e,r){let n=t.current;if(!n)return;let o=String(r.key);n.inResponse=!0,n.currentResponseCode=o,n.errorStructuredCounted=!1,_p(o)&&(n.totalErrorResponses++,!e.content&&e.description&&(n.structuredErrorResponseCount++,n.errorStructuredCounted=!0))},leave(){t.current&&(t.current.inResponse=!1)}},MediaType:{enter(e){let r=t.current;if(r&&(Cy(e)&&(r.inRequestBody&&(r.requestExamplePresent=!0),r.inResponse&&(r.responseExamplePresent=!0)),r.inResponse&&_p(r.currentResponseCode)&&!r.errorStructuredCounted&&(r.structuredErrorResponseCount++,r.errorStructuredCounted=!0),e.schema)){let n=!!t.debugOperationId&&(r.operationId===t.debugOperationId||`${r.method.toUpperCase()} ${r.path}`===t.debugOperationId),o=t.walkSchema(e.schema,n);by(r,o)&&(r.totalSchemaProperties=o.totalSchemaProperties,r.schemaPropertiesWithDescription=o.schemaPropertiesWithDescription,r.constraintCount=o.constraintCount);let s=_s(o.polymorphismCount,o.anyOfCount,t.anyOfPenaltyMultiplier);s>r.maxEffectivePolymorphism&&(r.maxEffectivePolymorphism=s,r.polymorphismCount=o.polymorphismCount,r.anyOfCount=o.anyOfCount),o.hasDiscriminator&&(r.hasDiscriminator=!0);for(let i of o.refsUsed)r.refsUsed.add(i);if(o.hasPropertyExamples&&(r.inRequestBody&&(r.requestExamplePresent=!0),r.inResponse&&(r.responseExamplePresent=!0)),r.inRequestBody&&(r.maxRequestSchemaDepth=Math.max(r.maxRequestSchemaDepth,o.maxDepth),r.topLevelWritableFieldCount=Math.max(r.topLevelWritableFieldCount,o.writableTopLevelFields)),r.inResponse&&(r.maxResponseSchemaDepth=Math.max(r.maxResponseSchemaDepth,o.maxDepth)),n&&o.debugEntries){let i=r.inRequestBody?"REQUEST BODY":`RESPONSE ${r.currentResponseCode}`;t.debugLogs.push({context:i,entries:o.debugEntries,totalProperties:o.totalSchemaProperties,totalPolymorphism:o.polymorphismCount,totalConstraints:o.constraintCount,maxDepth:o.maxDepth})}}}},Paths:{PathItem:{enter(e,r){t.currentPath=String(r.key),t.pathLevelParams=e.parameters??[]},Operation:{enter(e,r){let n=String(r.key),o=wy(t.currentPath,n,e);t.current=o;let s=Oy(t.pathLevelParams,e.parameters??[],r.resolve);for(let i of s.values())o.parameterCount++,i.required&&o.requiredParameterCount++,i.description&&o.paramsWithDescription++,Ay(i)&&o.ambiguousIdentifierCount++},leave(e){let r=t.current;if(!r)return;let n=e.operationId??`${r.method.toUpperCase()} ${r.path}`;t.operations.set(n,Ey(r)),t.current=null}}}}}}function Np(t){return{operationCount:t.operations.size,operations:t.operations}}function $p(t,e){return e(t).node}function Oy(t,e,r){let n=new Map;for(let o of t){let s=$p(o,r);s?.name&&s.in&&n.set(`${s.in}:${s.name}`,s)}for(let o of e){let s=$p(o,r);s?.name&&s.in&&n.set(`${s.in}:${s.name}`,s)}return n}function Cy(t){return t.example!==void 0||zs(t.examples)}function Ay(t){if(t.description)return!1;let e=(t.name??"").toLowerCase();return Ep.has(e)}function _p(t){if(t==="default"||/^4xx$/i.test(t)||/^5xx$/i.test(t))return!0;let e=parseInt(t,10);return e>=400&&e<600}function xy(t,e){if(!e.startsWith("#/"))return;let r=t;for(let n of e.slice(2).split("/"))r=r?.[Hs(n)];return r}function Lp({document:t,types:e,resolvedRefMap:r,ctx:n,debugOperationId:o,scoringConstants:s}){let i=s?.weights.anyOfPenaltyMultiplier??wt.weights.anyOfPenaltyMultiplier,a=Is(),c=Tp(a),p=Lr([{severity:"warn",ruleId:"score-schema",visitor:c}],e),u=(v,E)=>{Ip(a),E&&(a.debugEntries=[]),Mr({document:{...t,parsed:v},rootType:e.Schema,normalizedVisitors:p,resolvedRefMap:r,ctx:n});let{depth:R,pendingRef:I,debugEntries:Y,...ne}=a;return{...ne,refsUsed:[...a.refsUsed],debugEntries:E?a.debugEntries??void 0:void 0}},l=new Map,m=new WeakSet,d={maxDepth:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,hasPropertyExamples:!1,writableTopLevelFields:0,refsUsed:[]};function w(v,E){return{maxDepth:Math.max(v.maxDepth,E.maxDepth),polymorphismCount:v.polymorphismCount+E.polymorphismCount,anyOfCount:v.anyOfCount+E.anyOfCount,hasDiscriminator:v.hasDiscriminator||E.hasDiscriminator,totalSchemaProperties:v.totalSchemaProperties+E.totalSchemaProperties,schemaPropertiesWithDescription:v.schemaPropertiesWithDescription+E.schemaPropertiesWithDescription,constraintCount:v.constraintCount+E.constraintCount,hasPropertyExamples:v.hasPropertyExamples||E.hasPropertyExamples,writableTopLevelFields:v.writableTopLevelFields+E.writableTopLevelFields,refsUsed:[...v.refsUsed,...E.refsUsed],debugEntries:v.debugEntries||E.debugEntries?[...v.debugEntries??[],...E.debugEntries??[]]:void 0}}let h=(v,E=!1)=>{let R=v,I=Ie(v)?v.$ref:void 0;if(I){if(!E){let K=l.get(I);if(K)return K}R=xy(t.parsed,I)??v}if(re(R)&&m.has(R))return{...d};re(R)&&m.add(R);let Y=R?.oneOf,ne=R?.anyOf,z=Array.isArray(Y)&&Y.length>1,De=Array.isArray(ne)&&ne.length>1,_=z||De,P=Array.isArray(R?.allOf)&&R.allOf.length>0,M=R?.discriminator,U=!_&&re(M?.mapping)?Object.values(M.mapping).filter(K=>typeof K=="string"&&Ks(K)).map(K=>({$ref:K})):null,oe=Array.isArray(U)&&U.length>0,te;if(_||P||oe){let K={...R},ce=null,$e=xe=>{ce=ce?w(ce,xe):xe},le=(xe,Qe)=>{let k=h(Qe[0],E);for(let ae=1;ae<Qe.length;ae++){let se=h(Qe[ae],E);se.totalSchemaProperties>k.totalSchemaProperties&&(k=se)}return{...k,polymorphismCount:k.polymorphismCount+Qe.length,anyOfCount:k.anyOfCount+(xe==="anyOf"?Qe.length:0),hasDiscriminator:k.hasDiscriminator||!!M}};_&&delete K.discriminator,z&&(delete K.oneOf,$e(le("oneOf",Y))),De&&(delete K.anyOf,$e(le("anyOf",ne)));let Ge=null;if(oe){delete K.discriminator;let xe=h(U[0],E);for(let Qe=1;Qe<U.length;Qe++){let k=h(U[Qe],E);k.totalSchemaProperties>xe.totalSchemaProperties&&(xe=k)}Ge={...xe,polymorphismCount:xe.polymorphismCount+U.length,hasDiscriminator:!0}}let Ze=null;if(P){delete K.allOf,Ze={...d};for(let xe of R.allOf)Ze=w(Ze,h(xe,E));Ze.polymorphismCount+=R.allOf.length}te=u(K,E),Ze&&(te=w(te,Ze)),ce&&(te=w(te,ce)),Ge&&(te=w(te,Ge)),I&&(te={...te,refsUsed:[I,...te.refsUsed]})}else te=u(v,E);return re(R)&&m.delete(R),I&&!E&&l.set(I,te),te},x=jp(h,i,o),C=Dp(x),O=Lr([{severity:"warn",ruleId:"score",visitor:C}],e);return Mr({document:t,rootType:e.Root,normalizedVisitors:O,resolvedRefMap:r,ctx:n}),{metrics:Np(x),debugLogs:x.debugLogs}}function Mp(t){let e=new Map;for(let[o,s]of t)for(let i of s.refsUsed){let a=e.get(i);a||(a=new Set,e.set(i,a)),a.add(o)}let r=new Map;for(let o of t.keys())r.set(o,new Set);for(let o of e.values()){if(o.size<2)continue;let s=Array.from(o);for(let i=0;i<s.length;i++)for(let a=i+1;a<s.length;a++)r.get(s[i]).add(s[a]),r.get(s[a]).add(s[i])}let n=new Map;for(let o of t.keys()){let s=vy(o,r);n.set(o,s)}return n}function vy(t,e){let r=new Set([t]),n=[t],o=0;for(;n.length>0;){let s=[];for(let i of n)for(let a of e.get(i)??[])r.has(a)||(r.add(a),s.push(a));s.length>0&&o++,n=s}return o}function Fp(t){let e={agentReadiness:t.agentReadiness,discoverability:Math.round(t.discoverability*100),subscores:t.subscores,rawMetrics:{operationCount:t.rawMetrics.operationCount,operations:Object.fromEntries(Array.from(t.rawMetrics.operations.entries()).map(([r,n])=>{let{refsUsed:o,...s}=n;return[r,s]}))},operationScores:Object.fromEntries(t.operationScores),dependencyDepths:Object.fromEntries(t.dependencyDepths),hotspots:t.hotspots};y.output(JSON.stringify(e,null,2))}function kp(t,e=!1){Py(t),Ry(t),_y(t),e&&Iy(t),Ty(t)}function Up(t){return t>=80?pe:t>=50?ee:Ne}function qp(t){return Up(t)(ye(t.toFixed(1)))}function H(t){y.output(t+`
|
|
142
|
-
`)}function
|
|
143
|
-
`),n==="json"?
|
|
144
|
-
`),o;e&&
|
|
145
|
-
`);try{await n.login(r),o=await n.getAccessToken(r)}catch(s){e&&(
|
|
146
|
-
`),
|
|
147
|
-
`)),
|
|
148
|
-
\u2611\uFE0F Achieved Level: ${
|
|
220
|
+
${o}`}async function pu({argv:t,config:e,version:r,collectSpecData:n}){let o,s;try{let{run:i,conditionallyMaskSecrets:a}=await import("./chunks/GOJNDGZT.js"),c=e.configPath?Cb(e.configPath):process.cwd();t.mtls&&(o=cu(t.mtls,c));let l=Vp(o);t["har-output"]&&(s=Bp({version:r}),l=Js(l,{har:s}));let u=new St({http:{headers:e.resolve?.http?.headers??[],customFetch:l}}),p={files:t.files,input:t.input,server:t.server,workflow:t.workflow,skip:t.skip,verbose:t.verbose,config:e,version:r,collectSpecData:n,severity:t.severity,maxSteps:t["max-steps"],maxFetchTimeout:t["max-fetch-timeout"],executionTimeout:t["execution-timeout"],requestFileLoader:{getFileBody:async C=>{if(!Sb(C))throw new Error(`File ${C} doesn't exist or isn't readable.`);let x=Eb(C);return new File([x],Ob(C))}},envVariables:zp(c)||{},logger:g,fetch:l,externalRefResolver:u,noSecretsMasking:t["no-secrets-masking"]};if(p.skip&&p.workflow)throw new Error("Cannot use both --skip and --workflow flags at the same time.");if(t["har-output"]&&!t["har-output"].endsWith(".har"))throw new Error("File for HAR logs should be in .har format");if(t["json-output"]&&!t["json-output"].endsWith(".json"))throw new Error("File for JSON logs should be in .json format");if(p.files.length>1&&t["har-output"])throw new Error("Currently only a single file can be run with --har-output. Please run a single file at a time.");let m=performance.now(),d=await i(p);g.printNewLine(),Gp(d,g),g.printNewLine();let b=d.some(C=>C.hasProblems),h=d.some(C=>C.hasWarnings);if(t["json-output"]){let C={files:su(d),status:b?"error":h?"warn":"success",totalTime:performance.now()-m};lu(t["json-output"],Gs(C,2),"utf-8"),g.output(Z(g.indent(`JSON logs saved in ${fe(t["json-output"])}`,2))),g.printNewLine(),g.printNewLine()}if(t["har-output"])for(let C of d){let x=a({value:s,noSecretsMasking:C.ctx.noSecretsMasking,secretsSet:C.ctx.secretsSet||new Set});lu(t["har-output"],Gs(x,2),"utf-8"),g.output(Z(`Har logs saved in ${fe(t["har-output"])}`)),g.printNewLine(),g.printNewLine()}if(b)throw new Error(" Tests exited with error ")}catch(i){throw new de(i?.message??i)}}function fu(t){if(Array.isArray(t)){let e={};for(let r of t)if(r&&typeof r=="string"){let n=uu(r);Object.assign(e,n)}return Object.keys(e).length>0?e:void 0}if(!(!t||typeof t!="string"))return uu(t)}function uu(t){try{let e=JSON.parse(t);if(!te(e))throw new Error("mTLS config must be an object mapping domains to certificate configurations");for(let[r,n]of Object.entries(e)){if(!te(n))throw new Error(`mTLS config for domain "${r}" must be an object`);Zs(n,"clientCert",r,!0),Zs(n,"clientKey",r,!0),Zs(n,"caCert",r,!1)}return e}catch(e){throw e instanceof SyntaxError?new Error(`Invalid JSON for --mtls option: ${e.message}`):e}}function Zs(t,e,r,n){let o=t[e];if(!o){if(n)throw new Error(`${e} is required for domain "${r}"`);return}if(typeof o!="string")throw new Error(`${e} for domain "${r}" must be a string`)}import{performance as Wb}from"perf_hooks";var $t={thresholds:{maxParamsGood:5,maxDepthGood:4,maxPolymorphismGood:2,maxDependencyDepthGood:3,maxAmbiguousGood:0,maxOperationsForDiscoverability:1e3},weights:{parameterSimplicity:.1,schemaSimplicity:.1,documentationQuality:.18,constraintClarity:.12,exampleCoverage:.18,errorClarity:.12,dependencyClarity:.1,identifierClarity:.05,polymorphismClarity:.05,anyOfPenaltyMultiplier:2,discoverabilityWeight:.1},hotspotLimit:10},mu=new Set(["id","name","type","value","data","key","status","state","code","result","item","object","resource","entity","input","output","payload","body","content","info"]);function mo(t){if(t.length===0)return 0;let e=[...t].sort((n,o)=>n-o),r=Math.floor(e.length/2);return e.length%2!==0?e[r]:(e[r-1]+e[r])/2}function xb(t,e,r=$t){let{thresholds:n,weights:o}=r,s=bt(1-t.parameterCount/(n.maxParamsGood*2)),a=Math.max(t.maxRequestSchemaDepth,t.maxResponseSchemaDepth)/(n.maxDepthGood*2),c=du(t,o.anyOfPenaltyMultiplier)/(n.maxPolymorphismGood*3),l=bt(1-a-c),u=(t.operationDescriptionPresent?1:0)+t.paramsWithDescription+t.schemaPropertiesWithDescription,p=1+t.parameterCount+t.totalSchemaProperties,m=p>0?bt(u/p):1,d=t.totalSchemaProperties>0?bt(t.constraintCount/t.totalSchemaProperties):1,b=(t.requestExamplePresent?1:0)+(t.responseExamplePresent?1:0),h=(t.requestBodyPresent?1:0)+1,C=bt(b/h),x=t.totalErrorResponses>0?bt(t.structuredErrorResponseCount/t.totalErrorResponses):1,E=bt(1-e/(n.maxDependencyDepthGood*2)),v=bt(1-t.ambiguousIdentifierCount/Math.max(n.maxAmbiguousGood+3,1)),O=du(t,o.anyOfPenaltyMultiplier),$=O===0?1:t.hasDiscriminator?bt(1-O/(n.maxPolymorphismGood*4)):bt(1-O/(n.maxPolymorphismGood*2));return{parameterSimplicity:s,schemaSimplicity:l,documentationQuality:m,constraintClarity:d,exampleCoverage:C,errorClarity:x,dependencyClarity:E,identifierClarity:v,polymorphismClarity:$}}function Ab(t,e=$t){let r=e.weights,n=t.parameterSimplicity*r.parameterSimplicity+t.schemaSimplicity*r.schemaSimplicity+t.documentationQuality*r.documentationQuality+t.constraintClarity*r.constraintClarity+t.exampleCoverage*r.exampleCoverage+t.errorClarity*r.errorClarity+t.dependencyClarity*r.dependencyClarity+t.identifierClarity*r.identifierClarity+t.polymorphismClarity*r.polymorphismClarity;return wu(bt(n)*100)}function hu(t,e,r=$t){let n=new Map;for(let[o,s]of t.operations){let i=e.get(o)??0,a=xb(s,i,r);n.set(o,{agentReadiness:Ab(a,r),subscores:a})}return n}function gu(t,e=$t){return bt(1-t/e.thresholds.maxOperationsForDiscoverability)}function yu(t,e,r=$t){if(t.size===0)return{agentReadiness:100};let n=[];for(let i of t.values())n.push(i.agentReadiness);let o=r.weights.discoverabilityWeight,s=e*100;return{agentReadiness:wu(mo(n)*(1-o)+s*o)}}function Qs(t,e,r){return t-e+e*r}function du(t,e){return Qs(t.polymorphismCount,t.anyOfCount,e)}function bt(t){return Math.max(0,Math.min(1,t))}function bu(t){let e=t.size||1,r={parameterSimplicity:0,schemaSimplicity:0,documentationQuality:0,constraintClarity:0,exampleCoverage:0,errorClarity:0,dependencyClarity:0,identifierClarity:0,polymorphismClarity:0};for(let n of t.values())r.parameterSimplicity+=n.subscores.parameterSimplicity,r.schemaSimplicity+=n.subscores.schemaSimplicity,r.documentationQuality+=n.subscores.documentationQuality,r.constraintClarity+=n.subscores.constraintClarity,r.exampleCoverage+=n.subscores.exampleCoverage,r.errorClarity+=n.subscores.errorClarity,r.dependencyClarity+=n.subscores.dependencyClarity,r.identifierClarity+=n.subscores.identifierClarity,r.polymorphismClarity+=n.subscores.polymorphismClarity;return r.parameterSimplicity/=e,r.schemaSimplicity/=e,r.documentationQuality/=e,r.constraintClarity/=e,r.exampleCoverage/=e,r.errorClarity/=e,r.dependencyClarity/=e,r.identifierClarity/=e,r.polymorphismClarity/=e,r}function wu(t){return Math.round(t*10)/10}function Su(t,e,r){let n=Math.max(1,t);return e/n+r/n}function vb(t,e){return e.totalSchemaProperties>t.totalSchemaProperties?!0:e.totalSchemaProperties<t.totalSchemaProperties?!1:Su(e.totalSchemaProperties,e.schemaPropertiesWithDescription,e.constraintCount)>Su(t.totalSchemaProperties,t.schemaPropertiesWithDescription,t.constraintCount)}var Pb=["enum","const","format","pattern","minimum","maximum","minLength","maxLength","minItems","maxItems","minProperties","maxProperties","multipleOf","exclusiveMinimum","exclusiveMaximum","uniqueItems"];function ei(){return{depth:-1,maxDepth:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,hasPropertyExamples:!1,writableTopLevelFields:0,refsUsed:[],debugEntries:null,pendingRef:null}}function Ou(t){Object.assign(t,ei())}function xu(t){return{ref:{enter(e){typeof e?.$ref=="string"&&(t.refsUsed.push(e.$ref),t.pendingRef=e.$ref)}},Schema:{enter(e,r){t.depth++,t.maxDepth=Math.max(t.maxDepth,t.depth);let n=0;for(let i of Pb)e[i]!==void 0&&(t.constraintCount++,n++);e.discriminator?.propertyName&&(t.hasDiscriminator=!0);let o={};for(let i of["oneOf","anyOf","allOf"]){let a=e[i];Array.isArray(a)&&(t.polymorphismCount+=a.length,i==="anyOf"&&(t.anyOfCount+=a.length),o[i]=a.length)}let s=[];if(te(e.properties)){let i=Object.entries(e.properties);t.totalSchemaProperties+=i.length;for(let[a,c]of i){s.push(a);let l=c&&"$ref"in c&&c.$ref?r.resolve(c)?.node??c:c;l?.description&&t.schemaPropertiesWithDescription++,(l?.example!==void 0||l?.examples)&&(t.hasPropertyExamples=!0),l?.readOnly||t.writableTopLevelFields++}}t.debugEntries!==null&&t.debugEntries.push({ref:t.pendingRef,depth:t.depth,propertyNames:s,polymorphism:Object.keys(o).length>0?o:{},constraintCount:n}),t.pendingRef=null},leave(){t.depth--}}}}function Au(t,e,r){return{operations:new Map,currentPath:"",pathLevelParams:[],current:null,walkSchema:t,anyOfPenaltyMultiplier:e,debugOperationId:r,debugLogs:[]}}function $b(t,e,r){return{path:t,method:e,operationId:r.operationId,operationDescriptionPresent:!!r.description,parameterCount:0,requiredParameterCount:0,paramsWithDescription:0,ambiguousIdentifierCount:0,maxRequestSchemaDepth:0,maxResponseSchemaDepth:0,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,topLevelWritableFieldCount:0,requestBodyPresent:!1,requestExamplePresent:!1,responseExamplePresent:!1,structuredErrorResponseCount:0,totalErrorResponses:0,inRequestBody:!1,inResponse:!1,currentResponseCode:"",errorStructuredCounted:!1,maxEffectivePolymorphism:-1,refsUsed:new Set}}function Rb(t){let{inRequestBody:e,inResponse:r,currentResponseCode:n,errorStructuredCounted:o,maxEffectivePolymorphism:s,...i}=t;return i}function vu(t){return{RequestBody:{enter(){t.current&&(t.current.requestBodyPresent=!0,t.current.inRequestBody=!0)},leave(){t.current&&(t.current.inRequestBody=!1)}},Response:{enter(e,r){let n=t.current;if(!n)return;let o=String(r.key);n.inResponse=!0,n.currentResponseCode=o,n.errorStructuredCounted=!1,Cu(o)&&(n.totalErrorResponses++,!e.content&&e.description&&(n.structuredErrorResponseCount++,n.errorStructuredCounted=!0))},leave(){t.current&&(t.current.inResponse=!1)}},MediaType:{enter(e){let r=t.current;if(r&&(jb(e)&&(r.inRequestBody&&(r.requestExamplePresent=!0),r.inResponse&&(r.responseExamplePresent=!0)),r.inResponse&&Cu(r.currentResponseCode)&&!r.errorStructuredCounted&&(r.structuredErrorResponseCount++,r.errorStructuredCounted=!0),e.schema)){let n=!!t.debugOperationId&&(r.operationId===t.debugOperationId||`${r.method.toUpperCase()} ${r.path}`===t.debugOperationId),o=t.walkSchema(e.schema,n);vb(r,o)&&(r.totalSchemaProperties=o.totalSchemaProperties,r.schemaPropertiesWithDescription=o.schemaPropertiesWithDescription,r.constraintCount=o.constraintCount);let s=Qs(o.polymorphismCount,o.anyOfCount,t.anyOfPenaltyMultiplier);s>r.maxEffectivePolymorphism&&(r.maxEffectivePolymorphism=s,r.polymorphismCount=o.polymorphismCount,r.anyOfCount=o.anyOfCount),o.hasDiscriminator&&(r.hasDiscriminator=!0);for(let i of o.refsUsed)r.refsUsed.add(i);if(o.hasPropertyExamples&&(r.inRequestBody&&(r.requestExamplePresent=!0),r.inResponse&&(r.responseExamplePresent=!0)),r.inRequestBody&&(r.maxRequestSchemaDepth=Math.max(r.maxRequestSchemaDepth,o.maxDepth),r.topLevelWritableFieldCount=Math.max(r.topLevelWritableFieldCount,o.writableTopLevelFields)),r.inResponse&&(r.maxResponseSchemaDepth=Math.max(r.maxResponseSchemaDepth,o.maxDepth)),n&&o.debugEntries){let i=r.inRequestBody?"REQUEST BODY":`RESPONSE ${r.currentResponseCode}`;t.debugLogs.push({context:i,entries:o.debugEntries,totalProperties:o.totalSchemaProperties,totalPolymorphism:o.polymorphismCount,totalConstraints:o.constraintCount,maxDepth:o.maxDepth})}}}},Paths:{PathItem:{enter(e,r){t.currentPath=String(r.key),t.pathLevelParams=e.parameters??[]},Operation:{enter(e,r){let n=String(r.key),o=$b(t.currentPath,n,e);t.current=o;let s=_b(t.pathLevelParams,e.parameters??[],r.resolve);for(let i of s.values())o.parameterCount++,i.required&&o.requiredParameterCount++,i.description&&o.paramsWithDescription++,Ib(i)&&o.ambiguousIdentifierCount++},leave(e){let r=t.current;if(!r)return;let n=e.operationId??`${r.method.toUpperCase()} ${r.path}`;t.operations.set(n,Rb(r)),t.current=null}}}}}}function Pu(t){return{operationCount:t.operations.size,operations:t.operations}}function Eu(t,e){return e(t).node}function _b(t,e,r){let n=new Map;for(let o of t){let s=Eu(o,r);s?.name&&s.in&&n.set(`${s.in}:${s.name}`,s)}for(let o of e){let s=Eu(o,r);s?.name&&s.in&&n.set(`${s.in}:${s.name}`,s)}return n}function jb(t){return t.example!==void 0||fi(t.examples)}function Ib(t){if(t.description)return!1;let e=(t.name??"").toLowerCase();return mu.has(e)}function Cu(t){if(t==="default"||/^4xx$/i.test(t)||/^5xx$/i.test(t))return!0;let e=parseInt(t,10);return e>=400&&e<600}function Tb(t,e){if(!e.startsWith("#/"))return;let r=t;for(let n of e.slice(2).split("/"))r=r?.[gi(n)];return r}function $u({document:t,types:e,resolvedRefMap:r,ctx:n,debugOperationId:o,scoringConstants:s}){let i=s?.weights.anyOfPenaltyMultiplier??$t.weights.anyOfPenaltyMultiplier,a=ei(),c=xu(a),l=Yr([{severity:"warn",ruleId:"score-schema",visitor:c}],e),u=(v,O)=>{Ou(a),O&&(a.debugEntries=[]),Kr({document:{...t,parsed:v},rootType:e.Schema,normalizedVisitors:l,resolvedRefMap:r,ctx:n});let{depth:$,pendingRef:F,debugEntries:D,...ne}=a;return{...ne,refsUsed:[...a.refsUsed],debugEntries:O?a.debugEntries??void 0:void 0}},p=new Map,m=new WeakSet,d={maxDepth:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,hasPropertyExamples:!1,writableTopLevelFields:0,refsUsed:[]};function b(v,O){return{maxDepth:Math.max(v.maxDepth,O.maxDepth),polymorphismCount:v.polymorphismCount+O.polymorphismCount,anyOfCount:v.anyOfCount+O.anyOfCount,hasDiscriminator:v.hasDiscriminator||O.hasDiscriminator,totalSchemaProperties:v.totalSchemaProperties+O.totalSchemaProperties,schemaPropertiesWithDescription:v.schemaPropertiesWithDescription+O.schemaPropertiesWithDescription,constraintCount:v.constraintCount+O.constraintCount,hasPropertyExamples:v.hasPropertyExamples||O.hasPropertyExamples,writableTopLevelFields:v.writableTopLevelFields+O.writableTopLevelFields,refsUsed:[...v.refsUsed,...O.refsUsed],debugEntries:v.debugEntries||O.debugEntries?[...v.debugEntries??[],...O.debugEntries??[]]:void 0}}let h=(v,O=!1)=>{let $=v,F=De(v)?v.$ref:void 0;if(F){if(!O){let Y=p.get(F);if(Y)return Y}$=Tb(t.parsed,F)??v}if(te($)&&m.has($))return{...d};te($)&&m.add($);let D=$?.oneOf,ne=$?.anyOf,X=Array.isArray(D)&&D.length>1,ue=Array.isArray(ne)&&ne.length>1,R=X||ue,P=Array.isArray($?.allOf)&&$.allOf.length>0,M=$?.discriminator,q=!R&&te(M?.mapping)?Object.values(M.mapping).filter(Y=>typeof Y=="string"&&bi(Y)).map(Y=>({$ref:Y})):null,se=Array.isArray(q)&&q.length>0,re;if(R||P||se){let Y={...$},le=null,Ne=_e=>{le=le?b(le,_e):_e},pe=(_e,it)=>{let U=h(it[0],O);for(let ce=1;ce<it.length;ce++){let ie=h(it[ce],O);ie.totalSchemaProperties>U.totalSchemaProperties&&(U=ie)}return{...U,polymorphismCount:U.polymorphismCount+it.length,anyOfCount:U.anyOfCount+(_e==="anyOf"?it.length:0),hasDiscriminator:U.hasDiscriminator||!!M}};R&&delete Y.discriminator,X&&(delete Y.oneOf,Ne(pe("oneOf",D))),ue&&(delete Y.anyOf,Ne(pe("anyOf",ne)));let Ze=null;if(se){delete Y.discriminator;let _e=h(q[0],O);for(let it=1;it<q.length;it++){let U=h(q[it],O);U.totalSchemaProperties>_e.totalSchemaProperties&&(_e=U)}Ze={..._e,polymorphismCount:_e.polymorphismCount+q.length,hasDiscriminator:!0}}let st=null;if(P){delete Y.allOf,st={...d};for(let _e of $.allOf)st=b(st,h(_e,O));st.polymorphismCount+=$.allOf.length}re=u(Y,O),st&&(re=b(re,st)),le&&(re=b(re,le)),Ze&&(re=b(re,Ze)),F&&(re={...re,refsUsed:[F,...re.refsUsed]})}else re=u(v,O);return te($)&&m.delete($),F&&!O&&p.set(F,re),re},C=Au(h,i,o),x=vu(C),E=Yr([{severity:"warn",ruleId:"score",visitor:x}],e);return Kr({document:t,rootType:e.Root,normalizedVisitors:E,resolvedRefMap:r,ctx:n}),{metrics:Pu(C),debugLogs:C.debugLogs}}function Ru(t){let e=new Map;for(let[o,s]of t)for(let i of s.refsUsed){let a=e.get(i);a||(a=new Set,e.set(i,a)),a.add(o)}let r=new Map;for(let o of t.keys())r.set(o,new Set);for(let o of e.values()){if(o.size<2)continue;let s=Array.from(o);for(let i=0;i<s.length;i++)for(let a=i+1;a<s.length;a++)r.get(s[i]).add(s[a]),r.get(s[a]).add(s[i])}let n=new Map;for(let o of t.keys()){let s=Nb(o,r);n.set(o,s)}return n}function Nb(t,e){let r=new Set([t]),n=[t],o=0;for(;n.length>0;){let s=[];for(let i of n)for(let a of e.get(i)??[])r.has(a)||(r.add(a),s.push(a));s.length>0&&o++,n=s}return o}function _u(t){let e={agentReadiness:t.agentReadiness,discoverability:Math.round(t.discoverability*100),subscores:t.subscores,rawMetrics:{operationCount:t.rawMetrics.operationCount,operations:Object.fromEntries(Array.from(t.rawMetrics.operations.entries()).map(([r,n])=>{let{refsUsed:o,...s}=n;return[r,s]}))},operationScores:Object.fromEntries(t.operationScores),dependencyDepths:Object.fromEntries(t.dependencyDepths),hotspots:t.hotspots};g.output(JSON.stringify(e,null,2))}function ju(t,e=!1){Lb(t),Db(t),kb(t),e&&Fb(t),Ub(t)}function Iu(t){return t>=80?fe:t>=50?ee:qe}function Tu(t){return Iu(t)(Ee(t.toFixed(1)))}function H(t){g.output(t+`
|
|
221
|
+
`)}function Lb(t){H(""),H(Ee(Ve(" Scores"))),H(""),H(` Agent Readiness: ${Tu(t.agentReadiness)}/100`),H("")}function Db(t){H(Ee(Ve(" Subscores"))),H("");let e=t.subscores;Rt("Parameter Simplicity",e.parameterSimplicity),Rt("Schema Simplicity",e.schemaSimplicity),Rt("Documentation Quality",e.documentationQuality),Rt("Constraint Clarity",e.constraintClarity),Rt("Example Coverage",e.exampleCoverage),Rt("Error Clarity",e.errorClarity),Rt("Dependency Clarity",e.dependencyClarity),Rt("Identifier Clarity",e.identifierClarity),Rt("Polymorphism Clarity",e.polymorphismClarity),Rt("Discoverability",t.discoverability),H("")}function Rt(t,e){let r=Math.round(e*100),n=Mb(e);H(` ${t.padEnd(24)} ${n} ${Iu(r)(r+"%")}`)}function Mb(t){let r=Math.round(t*20);return be("["+"\u2588".repeat(r)+"\u2591".repeat(20-r)+"]")}function kb(t){if(H(Ee(Ve(" Raw Metrics Summary"))),H(""),H(` Total operations: ${t.rawMetrics.operationCount}`),t.rawMetrics.operationCount===0){H("");return}let e=[],r=[],n=[],o=[],s=0,i=0,a=0;for(let u of t.rawMetrics.operations.values())e.push(u.parameterCount),r.push(Math.max(u.maxRequestSchemaDepth,u.maxResponseSchemaDepth)),n.push(u.polymorphismCount),o.push(u.totalSchemaProperties),u.requestExamplePresent&&s++,u.responseExamplePresent&&i++,u.operationDescriptionPresent&&a++;let c=t.rawMetrics.operationCount;function l(u,p){let d=(p.reduce((x,E)=>x+E,0)/c).toFixed(1),b=mo(p).toFixed(1),h=Math.min(...p),C=Math.max(...p);H(` ${u.padEnd(26)} avg ${d.padStart(6)} median ${b.padStart(6)} min ${String(h).padStart(5)} max ${String(C).padStart(5)}`)}l("Parameters/operation:",e),l("Schema depth:",r),l("Polymorphism/operation:",n),l("Properties/operation:",o),H(` Operations with request examples: ${s}/${c} (${ti(s,c)})`),H(` Operations with response examples: ${i}/${c} (${ti(i,c)})`),H(` Operations with description: ${a}/${c} (${ti(a,c)})`),H("")}function ti(t,e){return e>0?`${Math.round(t/e*100)}%`:"N/A"}function Fb(t){H(Ee(Ve(" Per-Operation Metrics"))),H("");let e=" "+"Operation".padEnd(50)+"Props".padStart(7)+"Poly".padStart(7)+"Depth".padStart(7)+"Params".padStart(8)+"Constr".padStart(8);H(be(e)),H(be(" "+"\u2500".repeat(e.length-2)));let r=[...t.rawMetrics.operations.entries()].sort(([,n],[,o])=>o.totalSchemaProperties-n.totalSchemaProperties);for(let[,n]of r){let o=(n.operationId??`${n.method.toUpperCase()} ${n.path}`).slice(0,48),s=Math.max(n.maxRequestSchemaDepth,n.maxResponseSchemaDepth),i=" "+o.padEnd(50)+String(n.totalSchemaProperties).padStart(7)+String(n.polymorphismCount).padStart(7)+String(s).padStart(7)+String(n.parameterCount).padStart(8)+String(n.constraintCount).padStart(8);H(i)}H("")}function Nu(t,e){if(H(""),H(Ee(Ve(` Debug: ${t} schema breakdown`))),H(""),e.length===0){H(ee(` No schemas found for operation "${t}".`)),H(ee(' Make sure the value matches an operationId or "METHOD /path" exactly.')),H("");return}for(let r of e){H(Ee(be(` ${r.context}`))),H(be(" "+"\u2500".repeat(70)));let n=new Map;for(let s of r.entries){let i=s.ref??`(inline depth ${s.depth})`,a=n.get(i);if(a){a.count++,a.totalProps+=s.propertyNames.length;for(let c of s.propertyNames)a.propNames.includes(c)||a.propNames.push(c)}else n.set(i,{count:1,totalProps:s.propertyNames.length,propNames:[...s.propertyNames]})}for(let s of r.entries){let i=s.ref??"(inline)",a=" ".repeat(Math.min(s.depth,6)),c=s.propertyNames.length,l=` ${a}${i}`;c>0&&(l+=` (${c} properties)`);let u=[];if(s.polymorphism.oneOf&&u.push(`oneOf:${s.polymorphism.oneOf}`),s.polymorphism.anyOf&&u.push(`anyOf:${s.polymorphism.anyOf}`),s.polymorphism.allOf&&u.push(`allOf:${s.polymorphism.allOf}`),u.length>0&&(l+=` [${u.join(", ")}]`),s.constraintCount>0&&(l+=` {${s.constraintCount} constraints}`),H(l),c>0&&c<=20)H(` ${a} properties: ${s.propertyNames.join(", ")}`);else if(c>20){let p=s.propertyNames.slice(0,15).join(", ");H(` ${a} properties: ${p}, ... +${c-15} more`)}}H(""),H(` Totals: ${r.totalProperties} properties, ${r.totalPolymorphism} polymorphism items, ${r.totalConstraints} constraints, max depth ${r.maxDepth}`);let o=[...n.entries()].filter(([,s])=>s.totalProps>0).sort(([,s],[,i])=>i.totalProps-s.totalProps).slice(0,10);if(o.length>0){H(""),H(Ee(" Top schemas by property count:"));for(let[s,i]of o)H(` ${s}: ${i.totalProps} properties`)}H("")}}function Ub(t){if(t.hotspots.length===0){H(Ee(Ve(" No hotspot operations found."))),H("");return}H(Ee(Ve(` Top ${t.hotspots.length} Hotspot Operations`))),H("");for(let e of t.hotspots){let r=e.operationId?`${e.method.toUpperCase()} ${e.path} (${e.operationId})`:`${e.method.toUpperCase()} ${e.path}`;H(Ee(` ${r}`)),H(` Agent Readiness: ${Tu(e.agentReadinessScore)}`);for(let n of e.reasons)H(ee(` - ${n}`));H("")}}function Lu(t,e,r,n=$t){let o=[];for(let[s,i]of e){let a=t.operations.get(s);if(!a)continue;let c=qb(a,r.get(s)??0,n);c.length!==0&&o.push({path:a.path,method:a.method,operationId:a.operationId,agentReadinessScore:i.agentReadiness,reasons:c})}return o.sort((s,i)=>s.reasons.length!==i.reasons.length?i.reasons.length-s.reasons.length:s.agentReadinessScore-i.agentReadinessScore),o.slice(0,n.hotspotLimit)}function qb(t,e,r){let{thresholds:n}=r,o=[];t.parameterCount>n.maxParamsGood&&o.push(`High parameter count (${t.parameterCount})`);let s=Math.max(t.maxRequestSchemaDepth,t.maxResponseSchemaDepth);s>n.maxDepthGood&&o.push(`Deep schema nesting (depth ${s})`),t.anyOfCount>0&&!t.hasDiscriminator?o.push(`Polymorphism (anyOf) without discriminator (${t.anyOfCount} anyOf)`):t.polymorphismCount>n.maxPolymorphismGood&&o.push(`High polymorphism count (${t.polymorphismCount})`);let i=t.requestBodyPresent&&!t.requestExamplePresent,a=!t.responseExamplePresent;return i&&a?o.push("Missing request and response examples"):i?o.push("Missing request body examples"):a&&o.push("Missing response examples"),t.totalErrorResponses>0&&t.structuredErrorResponseCount===0&&o.push("No structured error responses (4xx/5xx)"),t.operationDescriptionPresent||o.push("Missing operation description"),t.parameterCount>0&&t.paramsWithDescription===0&&o.push("No parameter descriptions"),e>n.maxDependencyDepthGood&&o.push(`High dependency depth (${e})`),t.ambiguousIdentifierCount>n.maxAmbiguousGood&&o.push(`Ambiguous identifiers (${t.ambiguousIdentifierCount})`),o}async function Du({argv:t,config:e,collectSpecData:r}){let[{path:n}]=await lt(t.api?[t.api]:[],e),o=new St(e.resolve),{bundle:s}=await Sr({config:e,ref:n});r?.(s);let i=wt(s.parsed);if(wr(i)!=="oas3")return z(`The score command currently supports only OpenAPI 3.x. Detected: ${i}`);let a=Wb.now(),c=En(e.extendTypes(br(i),i),e),l=await Cn({rootDocument:s,rootType:c.Root,externalRefResolver:o}),u=t["debug-operation-id"],{metrics:p,debugLogs:m}=$u({document:s,types:c,resolvedRefMap:l,ctx:{problems:[],specVersion:i,config:e,visitorsData:{}},debugOperationId:u}),d=Ru(p.operations),b=hu(p,d),h=gu(p.operationCount),{agentReadiness:C}=yu(b,h),x=Lu(p,b,d),E={agentReadiness:C,discoverability:h,subscores:bu(b),rawMetrics:p,hotspots:x,operationScores:b,dependencyDepths:d};zb(E,n,a,t.format,!!t["operation-details"],u?{operationId:u,logs:m}:void 0)}function zb(t,e,r,n,o,s){g.info(`Document: ${at(e)} score:
|
|
222
|
+
`),n==="json"?_u(t):ju(t,o),s&&Nu(s.operationId,s.logs),Qe("score",r,e)}async function Mu(t,e=!1){let r=Er(t,t.resolvedConfig?.residency),n=new Jr,o=await n.getAccessToken(r);if(o)return e&&g.info(`Using existing access token.
|
|
223
|
+
`),o;e&&g.warn(`No valid access token found or refresh token expired. Attempting login...
|
|
224
|
+
`);try{await n.login(r),o=await n.getAccessToken(r)}catch(s){e&&(g.error(`\u274C Login failed.
|
|
225
|
+
`),g.error(`Error details: ${s.message}
|
|
226
|
+
`)),z(`Login failed. Please try again or check your connection to ${r}.`)}return o}function ku(t,e,r,n){n&&g.info(Ve(Ee(`
|
|
227
|
+
\u2611\uFE0F Achieved Level: ${be(r)}
|
|
149
228
|
|
|
150
|
-
`))),
|
|
151
|
-
`),
|
|
152
|
-
`),
|
|
153
|
-
`);for(let o of e){let s=o.location[0],i=0,a=0;if(s){let m=
|
|
154
|
-
`)}
|
|
155
|
-
`),
|
|
229
|
+
`))),g.output(`<?xml version="1.0" encoding="UTF-8"?>
|
|
230
|
+
`),g.output(`<checkstyle version="4.3">
|
|
231
|
+
`),g.output(`<file name="${Ke(t)}">
|
|
232
|
+
`);for(let o of e){let s=o.location[0],i=0,a=0;if(s){let m=jt(s);i=m.start.line,a=m.start.col}let c=o.scorecardLevel||"Unknown",l=o.severity==="warn"?"warning":"error",u=Ke(o.message),p=Ke(`${c}:${o.ruleId}`);g.output(`<error line="${i}" column="${a}" severity="${l}" message="${u}" source="${p}" />
|
|
233
|
+
`)}g.output(`</file>
|
|
234
|
+
`),g.output(`</checkstyle>
|
|
156
235
|
|
|
157
|
-
`)}function
|
|
158
|
-
`)}function
|
|
159
|
-
`)}function
|
|
160
|
-
`),
|
|
161
|
-
`),
|
|
162
|
-
`),
|
|
163
|
-
`),
|
|
164
|
-
`),n&&
|
|
165
|
-
`),
|
|
166
|
-
`);for(let i of e){let a=
|
|
167
|
-
`),i.severity==="warn"?
|
|
168
|
-
`):
|
|
169
|
-
`),
|
|
170
|
-
`)}
|
|
171
|
-
`),
|
|
236
|
+
`)}function gn(t){return t.replace(/\u001b\[[0-9;]*m/g,"")}function Vb(t,e){let r=`Line ${t.line}, Col ${t.col}`;if(!e)return r;let n=`Line ${e.line}, Col ${e.col}`;return`${r} \u2192 ${n}`}function Gb(t){if(!t.includes("/"))return`https://redocly.com/docs/cli/rules/oas/${t}`}function Fu(t,e,r,n="1.0"){let o={};for(let a of t){let c=a.scorecardLevel||"Unknown";o[c]||(o[c]=[]),o[c].push(a)}let s=[];for(let[a,c]of Object.entries(o)){let l=0,u=0,p=c.map(m=>(m.severity==="error"&&l++,m.severity==="warn"&&u++,{ruleId:m.ruleId,ruleUrl:Gb(m.ruleId),severity:m.severity,message:gn(m.message),location:m.location.map(d=>{let b=jt(d);return{file:d.source.absoluteRef,range:Vb(b.start,b.end),pointer:d.pointer}})}));s.push({name:a,total:{errors:l,warnings:u},problems:p})}let i={version:n,...r?{level:e}:{},levels:s};g.output(JSON.stringify(i,null,2)),g.info(`
|
|
237
|
+
`)}function Bt(t,e){return`${t}: ${Ke(String(e))}`}function Bb(t,e){let r=t.location[0];if(!r)return{file:e,line:0,column:0};let n=jt(r);return{file:r.source.absoluteRef,line:n.start.line,column:n.start.col,pointer:r.pointer}}function Hb(t,e){let r=[Bt("Level",t.scorecardLevel||"Unknown"),Bt("Rule",t.ruleId),Bt("Severity",t.severity),Bt("File",e.file),Bt("Line",e.line),Bt("Column",e.column)];return e.pointer&&r.push(Bt("Pointer",e.pointer)),r.push(Bt("Message",gn(t.message))),r.join(`
|
|
238
|
+
`)}function Uu(t,e,r,n){let o=e.filter(i=>i.severity==="error").length,s=e.filter(i=>i.severity==="warn").length;g.output(`<?xml version="1.0" encoding="UTF-8"?>
|
|
239
|
+
`),g.output(`<testsuites name="redocly scorecard-classic" tests="${e.length}" failures="${o}" errors="0" skipped="${s}">
|
|
240
|
+
`),g.output(`<testsuite name="scorecard-classic" tests="${e.length}" failures="${o}" errors="0" skipped="${s}">
|
|
241
|
+
`),g.output(`<properties>
|
|
242
|
+
`),g.output(`<property name="api" value="${Ke(t)}" />
|
|
243
|
+
`),n&&g.output(`<property name="achievedLevel" value="${Ke(r)}" />
|
|
244
|
+
`),g.output(`</properties>
|
|
245
|
+
`);for(let i of e){let a=Bb(i,t),c=i.scorecardLevel||"Unknown",l=gn(i.message),u=Hb(i,a);g.output(`<testcase classname="${Ke(c)}" name="${Ke(i.ruleId)}" file="${Ke(a.file)}" line="${a.line}">
|
|
246
|
+
`),i.severity==="warn"?g.output(`<skipped message="${Ke(l)}">${u}</skipped>
|
|
247
|
+
`):g.output(`<failure message="${Ke(l)}" type="${Ke(i.ruleId)}">${u}</failure>
|
|
248
|
+
`),g.output(`</testcase>
|
|
249
|
+
`)}g.output(`</testsuite>
|
|
250
|
+
`),g.output(`</testsuites>
|
|
172
251
|
|
|
173
|
-
`)}function
|
|
174
|
-
`)),r&&
|
|
175
|
-
\u2611\uFE0F Achieved Level: ${
|
|
176
|
-
`)));for(let[a,c]of Object.entries(n)){let
|
|
177
|
-
\u{1F4CB} ${a}`))+
|
|
178
|
-
`));let u=Math.max(...c.map(m=>{let d=m.location?.[0];if(d){let
|
|
179
|
-
`);
|
|
180
|
-
`);let o=
|
|
181
|
-
`),
|
|
182
|
-
`));let u=c.config.pluginsUrl?await
|
|
183
|
-
`):c.config.pluginsUrl?
|
|
184
|
-
`):
|
|
185
|
-
`)),{scorecard:
|
|
186
|
-
`),
|
|
187
|
-
`),c instanceof Error&&c.stack&&
|
|
252
|
+
`)}function Yb(t,e,r){let n=t.severity==="error"?qe:t.severity==="warn"?ee:me,o=t.location?.[0],s=0,i=0;if(o){let p=jt(o);s=p.start.line,i=p.start.col}let a=`${s}:${i}`.padEnd(e),c=n(t.severity.padEnd(7)),l=t.ruleId.padEnd(r),u=be(`[${t.scorecardLevel||"Unknown"}]`);return` ${a} ${c} ${u} ${l} ${t.message}`}function qu(t,e,r){let n=t.reduce((a,c)=>{let l=c.scorecardLevel||"Unknown";return a[l]||(a[l]=[]),a[l].push(c),a},{}),o=t.filter(a=>a.severity==="error").length,s=t.filter(a=>a.severity==="warn").length,i=Object.keys(n).length;g.info(Ve(`Found ${Ee(qe(o.toString()))} ${Le("error",o)} and ${Ee(ee(s.toString()))} ${Le("warning",s)} across ${Ee(be(i.toString()))} ${Le("level",i)}
|
|
253
|
+
`)),r&&g.output(Ve(Ee(`
|
|
254
|
+
\u2611\uFE0F Achieved Level: ${be(e)}
|
|
255
|
+
`)));for(let[a,c]of Object.entries(n)){let l=c.reduce((m,d)=>(m[d.severity]=(m[d.severity]||0)+1,m),{});g.output(Ee(be(`
|
|
256
|
+
\u{1F4CB} ${a}`))+me(` (${l.error||0} ${Le("error",l.error||0)}, ${l.warn||0} ${Le("warning",l.warn||0)})
|
|
257
|
+
`));let u=Math.max(...c.map(m=>{let d=m.location?.[0];if(d){let b=jt(d);return`${b.start.line}:${b.start.col}`.length}return 3}),8),p=Math.max(...c.map(m=>m.ruleId.length));for(let m of c)g.output(`${Yb(m,u,p)}
|
|
258
|
+
`);g.info("")}}async function Wu({projectUrl:t,auth:e,isApiKey:r=!1,verbose:n=!1}){n&&g.info(`Starting fetch for remote scorecard configuration...
|
|
259
|
+
`);let o=Kb(t);o||z(`Invalid project URL format: ${t}`);let{residency:s,orgSlug:i,projectSlug:a}=o;try{let c=await Jb({residency:s,orgSlug:i,projectSlug:a,auth:e,isApiKey:r,verbose:n}),l=c?.config.scorecardClassic||c?.config.scorecard;if(!l)throw new Error("No scorecard configuration found.");n&&(g.info(`Successfully fetched scorecard configuration.
|
|
260
|
+
`),g.info(`Scorecard levels found: ${l.levels?.length||0}
|
|
261
|
+
`));let u=c.config.pluginsUrl?await Xb(c.config.pluginsUrl,n):void 0;return n&&(u?g.info(`Successfully fetched plugins from ${c.config.pluginsUrl}
|
|
262
|
+
`):c.config.pluginsUrl?g.info(`No plugins were loaded from ${c.config.pluginsUrl}
|
|
263
|
+
`):g.info(`No custom plugins configured for this scorecard.
|
|
264
|
+
`)),{scorecard:l,plugins:u}}catch(c){let l=c instanceof Error?c.message:String(c);n&&(g.error(`\u274C Failed to fetch remote scorecard configuration.
|
|
265
|
+
`),g.error(`Error details: ${l}
|
|
266
|
+
`),c instanceof Error&&c.stack&&g.error(`Stack trace:
|
|
188
267
|
${c.stack}
|
|
189
|
-
`)),
|
|
190
|
-
`),c.status===401||c.status===403)throw s&&(
|
|
191
|
-
`),
|
|
192
|
-
`)),new Error(`Unauthorized access to project: ${r}. Please check your credentials.`);if(c.status!==200)throw new Error(`Failed to fetch project: ${r}. Status: ${c.status}`);return s&&
|
|
193
|
-
`),c.json()}async function
|
|
194
|
-
`);try{let r=await fetch(t);if(e&&
|
|
195
|
-
`),r.status!==200){e&&
|
|
196
|
-
`);return}return r.text()}catch(r){if(e){let n=r instanceof Error?r.message:String(r);
|
|
197
|
-
`)}return}}function
|
|
198
|
-
`),[];e&&
|
|
199
|
-
`);try{let n=
|
|
200
|
-
`);let i=`data:text/javascript;base64,${btoa(o)}`;e&&
|
|
201
|
-
`);let c=(await import(i)).default.map(
|
|
202
|
-
`),c.forEach((
|
|
203
|
-
`)})),c}catch(n){return e&&(
|
|
204
|
-
`),
|
|
205
|
-
`),n.stack&&
|
|
268
|
+
`)),z(l)}}function Kb(t){let e=new URL(t),r=e.pathname.match(/\/org\/(?<orgSlug>[^/]+)\/project\/(?<projectSlug>[^/]+)/);if(!r?.groups)return;let{orgSlug:n,projectSlug:o}=r.groups;return{residency:e.origin,orgSlug:n,projectSlug:o}}async function Jb({residency:t,orgSlug:e,projectSlug:r,auth:n,isApiKey:o,verbose:s=!1}){let i=Zb(n,o),a=new URL(`${t}/api/orgs/${e}/projects/${r}`),c=await fetch(a,{headers:i});if(s&&g.info(`Project fetch response status: ${c.status}
|
|
269
|
+
`),c.status===401||c.status===403)throw s&&(g.error(`Authentication failed with status ${c.status}.
|
|
270
|
+
`),g.error(`Check that your credentials are valid and have the necessary permissions.
|
|
271
|
+
`)),new Error(`Unauthorized access to project: ${r}. Please check your credentials.`);if(c.status!==200)throw new Error(`Failed to fetch project: ${r}. Status: ${c.status}`);return s&&g.info(`Successfully received project configuration.
|
|
272
|
+
`),c.json()}async function Xb(t,e=!1){e&&g.info(`Fetching plugins from: ${t}
|
|
273
|
+
`);try{let r=await fetch(t);if(e&&g.info(`Plugins fetch response status: ${r.status}
|
|
274
|
+
`),r.status!==200){e&&g.error(`Failed to fetch plugins
|
|
275
|
+
`);return}return r.text()}catch(r){if(e){let n=r instanceof Error?r.message:String(r);g.error(`Error fetching plugins: ${n}
|
|
276
|
+
`)}return}}function Zb(t,e){return e?{Authorization:`Bearer ${t}`}:{Cookie:`accessToken=${t}`}}async function zu(t,e,r=[],n=[],o){let s={};for(let i of r){let a={[i.name]:{root:t,rules:e}},c=await Pi({apis:a,...i,plugins:n},{configPath:o});s[i.name]=c.forAlias(i.name)}return s}function ho(t,e){if(t){for(let r of t)if(Object.entries(r.where?.metadata||{}).every(([o,s])=>Qb(o,s,e)))return r}}function Qb(t,e,r){if(e.match(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}Z)?\/(\d{4}-\d{2}-\d{2})?$/)){if(!r[t])return!1;let[n,o]=e.split("/"),s=new Date(r[t]);return!(s<new Date(n)||o&&s>new Date(o))}else if(e.match(/^\/.*\//)){if(!r[t])return!1;try{return hi(e).test(r[t])}catch{return g.error(`Invalid regex in scorecard target "${t}": ${e}`),!1}}return r[t]===e}var ew=".redocly.com";function Vu(t){try{return new URL(t).hostname.toLowerCase().endsWith(ew)}catch{return!1}}import*as Bu from"node:path";import{pathToFileURL as tw}from"node:url";async function Gu(t,e=!1,r){if(!t)return e&&g.info(`No plugins code provided to evaluate.
|
|
277
|
+
`),[];e&&g.info(`Starting plugin evaluation...
|
|
278
|
+
`);try{let n=tw(r??process.cwd()).href+"/",o=t.replaceAll("__redocly_dirname",`"${n}"`);e&&g.info(`Encoding plugins code to base64 data URI...
|
|
279
|
+
`);let i=`data:text/javascript;base64,${btoa(o)}`;e&&g.info(`Importing plugins module dynamically...
|
|
280
|
+
`);let c=(await import(i)).default.map(l=>l());return e&&(g.info(`Successfully evaluated ${c.length} ${Le("plugin",c.length)}.
|
|
281
|
+
`),c.forEach((l,u)=>{g.info(` Plugin ${u+1}: ${l.id||"unnamed"}
|
|
282
|
+
`)})),c}catch(n){return e&&(g.error(`\u274C Failed to evaluate plugins.
|
|
283
|
+
`),g.error(`Error details: ${n.message}
|
|
284
|
+
`),n.stack&&g.error(`Stack trace:
|
|
206
285
|
${n.stack}
|
|
207
|
-
`)),
|
|
208
|
-
`);let m=typeof s=="string"?await
|
|
209
|
-
`);let
|
|
210
|
-
`),h=
|
|
211
|
-
`)}
|
|
212
|
-
Validating level: "${
|
|
213
|
-
`),c&&m&&m.length>0&&
|
|
214
|
-
`);let v=
|
|
215
|
-
`);let
|
|
216
|
-
`),
|
|
217
|
-
`);let c=a||await
|
|
218
|
-
\u2713 Matched API "${
|
|
219
|
-
`),t.verbose&&(
|
|
220
|
-
`),
|
|
221
|
-
`),h&&
|
|
222
|
-
`),
|
|
223
|
-
`));let
|
|
224
|
-
`);let
|
|
225
|
-
Running scorecard for ${
|
|
226
|
-
`));let{problems:
|
|
227
|
-
\u2611\uFE0F Achieved Level: ${
|
|
228
|
-
`))),
|
|
229
|
-
`));return}
|
|
230
|
-
\u274C Your API specification does not satisfy the target scorecard level "${
|
|
231
|
-
`),t.format==="json"?
|
|
232
|
-
`)
|
|
233
|
-
`):
|
|
234
|
-
`):
|
|
235
|
-
and all related files are saved to the directory: ${
|
|
236
|
-
`),
|
|
286
|
+
`)),g.warn("Something went wrong during plugins evaluation."),[]}}async function Hu({apiPath:t,document:e,externalRefResolver:r,scorecardConfig:n,configPath:o,pluginsCodeOrPlugins:s,targetLevel:i,metadata:a={},verbose:c=!1}){let l=[],u=new Map,p=n.targets||[];i&&!n.levels?.some(E=>E.name===i)&&z(`Target level "${i}" not found in the scorecard configuration levels.
|
|
287
|
+
`);let m=typeof s=="string"?await Gu(s,c,o?Bu.dirname(o):void 0):s,d=Array.isArray(m)?m:[],b={},h;if(p.length>0){c&&g.info(`Scorecard has ${p.length} ${Le("target",p.length)} defined. Resolving target configurations...
|
|
288
|
+
`);let E=ho(p,a);E?(c&&g.info(`Found matching target for metadata. Resolving configurations for target "${JSON.stringify(E.where)}"...
|
|
289
|
+
`),h=E.rules):c&&g.info(`No matching target found for metadata. Proceeding with level configurations only.
|
|
290
|
+
`)}b=await zu(t,h,n.levels||[],d,o||"");for(let E of n.levels||[]){c&&g.info(`
|
|
291
|
+
Validating level: "${E.name}"
|
|
292
|
+
`),c&&m&&m.length>0&&g.info(`Using ${m.length} ${Le("plugin",m.length)} for this level.
|
|
293
|
+
`);let v=b[E.name];c&&g.info(`Linting document against level rules...
|
|
294
|
+
`);let $=(await $i({document:e,externalRefResolver:r,config:v})).filter(({ignored:F})=>!F).map(F=>({...F,scorecardLevel:E.name}));u.set(E.name,$),c&&g.info(`Found ${$.length} ${Le("problem",$.length)} for level "${E.name}".
|
|
295
|
+
`),l.push(...$)}let C=rw(u,n.levels||[],i);return{problems:l,achievedLevel:C,targetLevelAchieved:i?C===i:!0}}function rw(t,e,r){let n=null;for(let o of e){if((t.get(o.name)||[]).some(a=>a.severity==="error"))return n||"Non Conformant";if(n=o.name,r&&o.name===r)return o.name}return n||"Non Conformant"}async function Yu({argv:t,config:e,version:r,collectSpecData:n}){let o=performance.now(),s=await lt(t.api?[t.api]:[],e),i=t["project-url"]||e.resolvedConfig.scorecardClassic?.fromProjectUrl||e.resolvedConfig.scorecard?.fromProjectUrl;i||z("Scorecard is not configured. Please provide it via --project-url flag or configure it in redocly.yaml. Learn more: https://redocly.com/docs/realm/config/scorecard#fromprojecturl-example"),Vu(i)||z(`Project URL must be from the .redocly.com domain. Received: ${i}`);let a=process.env.REDOCLY_AUTHORIZATION;nw()&&!a&&z(`Please provide an API key using the REDOCLY_AUTHORIZATION environment variable.
|
|
296
|
+
`);let c=a||await Mu(e,t.verbose);c||z("Failed to obtain access token or API key.");let{scorecard:l,plugins:u}=await Wu({projectUrl:i,auth:c,isApiKey:!!a,verbose:t.verbose}),{path:p,alias:m}=s[0],b=Mi(e,p).alias||m,h=b?e.resolvedConfig.apis?.[b]?.metadata:void 0;t.verbose&&b&&h&&g.info(`
|
|
297
|
+
\u2713 Matched API "${be(b)}" from config
|
|
298
|
+
`),t.verbose&&(g.info(`Processing API: ${be(b||"default")}
|
|
299
|
+
`),g.info(`Path: ${Et(p)}
|
|
300
|
+
`),h&&g.info(`Config Metadata: ${JSON.stringify(h,null,2)}
|
|
301
|
+
`),g.info(`Project URL: ${i}
|
|
302
|
+
`));let C=new St(e.resolve),x=await C.resolveDocument(null,p,!0);n?.(x);let E=x.parsed?.info,v=E?.["x-metadata"]||{},O={title:E?.title,version:E?.version,...v,...h};t.verbose&&g.info(`Combined Metadata for target matching: ${JSON.stringify(O,null,2)}
|
|
303
|
+
`);let $=t["target-level"]||ho(l?.targets,O)?.minimumLevel;g.info(me(`
|
|
304
|
+
Running scorecard for ${Et(p)}...
|
|
305
|
+
`));let{problems:F,achievedLevel:D,targetLevelAchieved:ne}=await Hu({apiPath:p,document:x,externalRefResolver:C,scorecardConfig:l,configPath:e.configPath,pluginsCodeOrPlugins:u,targetLevel:$,metadata:O,verbose:t.verbose});if(F.length===0){g.output(Ve(Ee(`
|
|
306
|
+
\u2611\uFE0F Achieved Level: ${be(D)}
|
|
307
|
+
`))),g.output(fe(`\u2705 No issues found for ${Z(Et(p))}. Your API meets all scorecard requirements.
|
|
308
|
+
`));return}$&&!ne&&g.error(`
|
|
309
|
+
\u274C Your API specification does not satisfy the target scorecard level "${$}".
|
|
310
|
+
`),t.format==="json"?Fu(F,D,ne,r):t.format==="checkstyle"?ku(p,F,D,ne):t.format==="junit"?Uu(p,F,D,ne):qu(F,D,ne);let X=Rn(o);if(g.info(`\u{1F4CA} Scorecard results for ${Z(Et(p))} at ${Z(p||"stdout")} ${fe(X)}.
|
|
311
|
+
`),$&&!ne)throw new Kt("Target scorecard level not achieved.");if(D!=="Non Conformant")return;throw new Kt("Scorecard validation failed.")}function nw(){return!!(process.env.CI||!process.stdin.isTTY)}import*as Of from"node:fs";import{performance as ow}from"perf_hooks";import*as ff from"node:fs";import*as wo from"node:path";import*as Ku from"node:path";function Xe(t,e,r={}){Tr(t,o=>{if(De(o)&&Nr(o.$ref))n(o,"$ref");else if(te(o.discriminator)&&te(o.discriminator.mapping)){let{mapping:s}=o.discriminator;for(let i of Object.keys(s)){let a=s[i];typeof a=="string"&&Nr(a)&&n(o.discriminator.mapping,i)}}});function n(o,s){let i=o[s].split("/"),a=i.pop(),c=i[2],l=r[c];if(!l||!l[a])return;let u=ze(Ku.relative(e,l[a].filename));u.startsWith(".")||(u="./"+u),o[s]=u}}import*as ri from"node:path";import*as Ju from"node:path";function mr(t,e,r){return Ju.join(t,e)+`.${r}`}var Xu=["schemas","messages","securitySchemes","parameters","correlationIds","messageTraits","operationTraits","serverBindings","channelBindings","operationBindings","messageBindings"];var Zu=["schemas","messages","securitySchemes","servers","serverVariables","parameters","replies","replyAddresses","correlationIds","messageTraits","operationTraits","tags","externalDocs","serverBindings","channelBindings","operationBindings","messageBindings"];function go(t,e){return(e==="async2"?Xu:Zu).filter(n=>n in t)}function Qu({asyncapi:t,asyncapiDir:e,componentsFiles:r,ext:n,specVersion:o}){let s=t.components;if(!s)return;let i=ri.join(e,xe),a=go(s,o);for(let c of a){let l=ri.join(i,c);for(let u of Object.keys(s[c]||{})){let p=mr(l,u,n),m=[];c==="schemas"&&(m=(s[c]?.[u]?.allOf||[]).map(({$ref:d})=>d).filter(Sn)),r[c]=r[c]||{},r[c][u]={inherits:m,filename:p}}}}import*as tf from"node:fs";import*as kr from"node:path";import*as yn from"node:path";function xt(t,e,r){let n=yn.resolve(t),o=yn.resolve(e);o!==n&&!o.startsWith(n+yn.sep)&&z(`Refusing to write "${r}" outside the output directory.`)}import*as dr from"node:fs";import*as ef from"node:path";function hr(t,e,r){if(!dr.existsSync(t)||!dr.statSync(t).isDirectory())return;let n=dr.readdirSync(t);for(let o of n){let s=ef.join(t,o);dr.statSync(s).isDirectory()?hr(s,e,r):e(s,t,r)}}function Mr(t,e,r){if(!xi(t))return;let n=Cr(t);Xe(n,e,r),Ie(n,t)}function rf({channels:t,asyncapiDir:e,outDir:r,componentsFiles:n,pathSeparator:o,ext:s}){let i={};if(!t)return i;tf.mkdirSync(r,{recursive:!0});for(let a of Object.keys(t)){let c=`${kr.join(r,Jt(a,o))}.${s}`,l=t[a];De(l)||(xt(e,c,a),i[a]=c,Xe(l,kr.dirname(c),n),Ie(l,c),t[a]={$ref:ze(kr.relative(e,c))},hr(r,Mr,n))}return i}import*as cf from"node:fs";import*as qr from"node:path";import*as nf from"node:fs";function Fr(t){return t!=="securitySchemes"}function yo(t,e){Fr(e)&&nf.mkdirSync(t,{recursive:!0})}import*as of from"node:fs";function bo(t,e){return of.existsSync(t)&&!Dt(Cr(t),e)}import*as sf from"node:path";function Ur(t,e,r){if(!(!te(t)&&!Array.isArray(t))){if(Array.isArray(t)){for(let n of t)Ur(n,e,r);return}for(let n of Object.keys(t)){let o=t[n];if(n==="$ref"&&typeof o=="string"&&o.startsWith("#/channels/")){let s=o.slice(11),i=s.indexOf("/"),a=i===-1?s:s.slice(0,i),c=i===-1?"":s.slice(i),l=r[a];if(l){let u=ze(sf.relative(e,l));t[n]=c?`${u}#${c}`:u}}else Ur(o,e,r)}}}function af(t,e){let r=t.components;r&&(At(r[e])&&delete r[e],At(r)&&delete t.components)}function lf({asyncapi:t,asyncapiDir:e,componentsFiles:r,channelsFiles:n,ext:o,specVersion:s}){let i=t.components;if(i){let l=function(u){let p=qr.join(a,u);yo(p,u);for(let m of Object.keys(i?.[u]||{})){let d=mr(p,m,o);xt(e,d,m);let b=i?.[u]?.[m];Xe(b,qr.dirname(d),r),Ur(b,qr.dirname(d),n),bo(d,b)?g.warn(`warning: conflict for ${m} - file already exists with different content: ${Z(d)} ... Skip.
|
|
312
|
+
`):Ie(b,d),delete i?.[u]?.[m]}af(t,u)},a=qr.join(e,xe);cf.mkdirSync(a,{recursive:!0}),go(i,s).forEach(l)}}import*as pf from"node:fs";import*as gr from"node:path";function uf({operations:t,asyncapiDir:e,outDir:r,componentsFiles:n,channelsFiles:o,pathSeparator:s,ext:i}){if(t){pf.mkdirSync(r,{recursive:!0});for(let a of Object.keys(t)){let c=`${gr.join(r,Jt(a,s))}.${i}`,l=t[a];De(l)||(xt(e,c,a),Xe(l,gr.dirname(c),n),Ur(l,gr.dirname(c),o),Ie(l,c),t[a]={$ref:ze(gr.relative(e,c))},hr(r,Mr,n))}}}function mf({asyncapi:t,asyncapiDir:e,pathSeparator:r,ext:n,specVersion:o}){ff.mkdirSync(e,{recursive:!0});let s={};Qu({asyncapi:t,asyncapiDir:e,componentsFiles:s,ext:n,specVersion:o});let i=t.channels,a=i?rf({channels:i,asyncapiDir:e,outDir:wo.join(e,Sp),componentsFiles:s,pathSeparator:r,ext:n}):{};lf({asyncapi:t,asyncapiDir:e,componentsFiles:s,channelsFiles:a,ext:n,specVersion:o}),o==="async3"&&t.operations&&uf({operations:t.operations,asyncapiDir:e,outDir:wo.join(e,Ep),componentsFiles:s,channelsFiles:a,pathSeparator:r,ext:n}),Xe(t,e,s),Ie(t,wo.join(e,`asyncapi.${n}`))}import*as Ef from"node:fs";import*as Oo from"node:path";import*as wf from"node:fs";import*as Wr from"node:path";import*as So from"node:path";function df(t){return So.basename(t,So.extname(t))}function hf(t){return t?Hi.filter(e=>Fr(e)&&Object.keys(t).includes(e)):[]}function gf(t,e,r,n,o){let s=[];r==="schemas"&&(s=(t?.[r]?.[n]?.allOf||[]).map(({$ref:i})=>i).filter(Sn)),e[r]=e[r]||{},e[r][n]={inherits:s,filename:o}}import*as Eo from"node:path";function yf(t,e,r,n){if(!t.discriminator)return;let o=`#/${xe}/schemas/${e}`,s={};for(let[l,{inherits:u,filename:p}]of Object.entries(n))if(u.indexOf(o)>-1){let m=ze(Eo.relative(Eo.dirname(r),p));s[l]=m.startsWith(".")?m:"./"+m}if(At(s))return;let i=t.properties[t.discriminator.propertyName],a=i&&i.enum,c=t.discriminator.mapping=t.discriminator.mapping||{};for(let l of Object.keys(s))a&&!a.includes(l)||(c[l]&&c[l]!==s[l]&&g.warn(`warning: explicit mapping overlaps with local mapping entry ${qe(l)} at ${Z(r)}. Please check it.`),c[l]=s[l])}function bf(t,e){t.components&&At(t.components[e])&&delete t.components[e],At(t.components)&&delete t.components}function Sf(t,e,r,n){let{components:o}=t;if(o){let a=function(l){let u=Wr.join(s,l);for(let p of Object.keys(o?.[l]||{})){let m=mr(u,p,n);xt(e,m,p),gf(o,r,l,p,m)}},c=function(l){let u=Wr.join(s,l);yo(u,l);for(let p of Object.keys(o?.[l]||{})){let m=mr(u,p,n),d=o?.[l]?.[p];Xe(d,Wr.dirname(m),r),yf(d,df(m),m,r.schemas||{}),bo(m,d)?g.warn(`warning: conflict for ${p} - file already exists with different content: ${Z(m)} ... Skip.
|
|
313
|
+
`):Ie(d,m),Fr(l)&&delete t.components?.[l]?.[p]}bf(t,l)},s=Wr.join(e,xe);wf.mkdirSync(s,{recursive:!0});let i=hf(o);i.forEach(a),i.forEach(c)}}import*as bn from"node:fs";import*as Ht from"node:path";function Co(t,e,r,n,o,s="",i){if(t){bn.mkdirSync(r,{recursive:!0});for(let a of Object.keys(t)){let c=`${Ht.join(r,Jt(a,o))}.${i}`,l=t[a];if(!De(l)){xt(e,c,a);for(let u of In){let p=l[u],m=p?.["x-code-samples"]||p?.["x-codeSamples"];if(!(!m||!Array.isArray(m)))for(let d of m){if(d.source&&d.source.$ref)continue;let b=Ht.join(e,"code_samples",ki(d.lang),s+Jt(a,o),u+Fi(d.lang));xt(e,b,d.lang),bn.mkdirSync(Ht.dirname(b),{recursive:!0}),bn.writeFileSync(b,d.source),d.source={$ref:ze(Ht.relative(r,b))}}}Ie(l,c),t[a]={$ref:ze(Ht.relative(e,c))},hr(r,Mr,n)}}}}function Cf(t,e,r,n){Ef.mkdirSync(e,{recursive:!0});let o={};Sf(t,e,o,n),Co(t.paths,e,Oo.join(e,"paths"),o,r,void 0,n);let s=t.webhooks||t["x-webhooks"];Co(s,e,Oo.join(e,"webhooks"),o,r,"webhook_",n),Xe(t,e,o),Ie(t,Oo.join(e,`openapi.${n}`))}async function xf({argv:t,collectSpecData:e}){let r=ow.now(),{api:n,outDir:o,separator:s}=t,i=_n(n);Of.existsSync(n)||z(`File ${Z(n)} does not exist.`);let a=Cr(n);e?.({parsed:a});let c=wt(a);switch(c){case"async2":case"async3":mf({asyncapi:a,asyncapiDir:o,pathSeparator:s,ext:i,specVersion:c});break;case"oas3_0":case"oas3_1":case"oas3_2":Cf(a,o,s,i);break;case"oas2":z("OpenAPI 2 is not supported by this command.");break;default:z("File does not conform to the OpenAPI or AsyncAPI Specification. Version is not specified.")}g.info(`\u{1FA93} Document: ${Z(n)} ${fe("is successfully split")}
|
|
314
|
+
and all related files are saved to the directory: ${Z(o)}
|
|
315
|
+
`),Qe("split",r,n)}import{performance as sw}from"perf_hooks";function Af(t){let e=Object.fromEntries(Object.entries(t).map(([r,{metric:n,total:o,counts:s}])=>[r,{metric:n,total:o,counts:s}]));g.output(JSON.stringify(e,null,2))}function vf(t){let e=`| Feature | Count |
|
|
237
316
|
| --- | --- |
|
|
238
317
|
`,r=[];for(let{metric:n,total:o,counts:s}of Object.values(t)){e+=`| ${n} | ${o} |
|
|
239
318
|
`;let i=Object.entries(s??{});i.length&&r.push(`
|
|
@@ -242,47 +321,47 @@ Running scorecard for ${mt(l)}...
|
|
|
242
321
|
| --- | --- |
|
|
243
322
|
`+i.map(([a,c])=>`| ${a} | ${c} |`).join(`
|
|
244
323
|
`)+`
|
|
245
|
-
`)}
|
|
246
|
-
`));for(let[i,a]of Object.entries(o??{}))
|
|
247
|
-
`))}}function
|
|
324
|
+
`)}g.output(e+r.join(""))}function Pf(t){for(let{metric:e,total:r,color:n,counts:o}of Object.values(t)){let s=Hr[n];g.output(s(`${e}: ${r}
|
|
325
|
+
`));for(let[i,a]of Object.entries(o??{}))g.output(s(` - ${i}: ${a}
|
|
326
|
+
`))}}function $f(t,e,r,n){switch(g.info(`Document: ${at(e)} stats:
|
|
248
327
|
|
|
249
|
-
`),n){case"stylish":
|
|
328
|
+
`),n){case"stylish":Pf(t);break;case"json":Af(t);break;case"markdown":vf(t);break}Qe("stats",r,e)}function Rf(t){let e={refs:{metric:"\u{1F697} References",total:0,color:"red",items:new Set},externalDocs:{metric:"\u{1F4E6} External Documents",total:0,color:"magenta"},schemas:{metric:"\u{1F4C8} Schemas",total:0,color:"white"},parameters:{metric:"\u{1F449} Parameters",total:0,color:"yellow",items:new Set},links:{metric:"\u{1F517} Links",total:0,color:"cyan",items:new Set},pathItems:{metric:"\u{1F500} Path Items",total:0,color:"green"},webhooks:{metric:"\u{1F3A3} Webhooks",total:0,color:"green"},operations:{metric:"\u{1F477} Operations",total:0,color:"yellow"},tags:{metric:"\u{1F516} Tags",total:0,color:"white",items:new Set},xExtensions:{metric:"\u{1F9E9} Vendor Extensions",total:0,color:"cyan",counts:{}}},r={refs:{metric:"\u{1F697} References",total:0,color:"red",items:new Set},externalDocs:{metric:"\u{1F4E6} External Documents",total:0,color:"magenta"},schemas:{metric:"\u{1F4C8} Schemas",total:0,color:"white"},parameters:{metric:"\u{1F449} Parameters",total:0,color:"yellow",items:new Set},channels:{metric:"\u{1F4E1} Channels",total:0,color:"green"},operations:{metric:"\u{1F477} Operations",total:0,color:"yellow"},tags:{metric:"\u{1F516} Tags",total:0,color:"white",items:new Set},xExtensions:{metric:"\u{1F9E9} Vendor Extensions",total:0,color:"cyan",counts:{}}},n,o;switch(t){case"async2":o=r,n=Si(o);break;case"async3":o=r,n=Ei(o);break;case"oas2":case"oas3_0":case"oas3_1":case"oas3_2":o=e,n=wi(o);break;default:return z(`Unsupported spec version: ${t}.`)}return{statsVisitor:n,statsAccumulator:o}}async function _f({argv:t,config:e,collectSpecData:r}){let[{path:n}]=await lt(t.api?[t.api]:[],e),o=new St(e.resolve),{bundle:s}=await Sr({config:e,ref:n});r?.(s);let i=wt(s.parsed),a=En(e.extendTypes(br(i),i),e),{statsVisitor:c,statsAccumulator:l}=Rf(i),u=sw.now(),p={problems:[],specVersion:i,config:e,visitorsData:{}},m=await Cn({rootDocument:s,rootType:a.Root,externalRefResolver:o}),d=Yr([{severity:"warn",ruleId:"stats",visitor:c}],a);Kr({document:s,rootType:a.Root,normalizedVisitors:d,resolvedRefMap:m,ctx:p}),$f(l,n,u,t.format)}import{spawn as iw}from"node:child_process";var jf=async({argv:t})=>{g.info(`
|
|
250
329
|
Launching translate using NPX.
|
|
251
330
|
|
|
252
|
-
`);let{npxExecutableName:e,sanitize:r,shell:n}=
|
|
253
|
-
`):
|
|
254
|
-
`)}var
|
|
331
|
+
`);let{npxExecutableName:e,sanitize:r,shell:n}=Ir(),o=r(t["project-dir"],un),s=r(t.locale,pp);iw(e,["-y","@redocly/realm","translate",s,`-d=${o}`],{stdio:"inherit",shell:n}).on("error",a=>{throw g.info(`Translate launch failed: ${a.message}`),new Error("Translate launch failed.")})};var zr=class extends Error{};async function ni({operation:t,condition:e,onConditionNotMet:r,onRetry:n,startTime:o=Date.now(),retryTimeoutMs:s=6e5,retryIntervalMs:i=5e3}){async function a(){let c=await t();if(!e||e(c))return c;if(Date.now()-o>s)throw new Error("Timeout exceeded.");return r?.(c),await di(i),await n?.(c),a()}return a()}function xo(t,e){return e instanceof zr?z(e.message):e instanceof Ni?z(`${t} Reason: ${e.message} (status: ${e.status})
|
|
332
|
+
`):z(`${t} Reason: ${e.message}
|
|
333
|
+
`)}var aw=5e3;async function Ao({argv:t}){let e=performance.now(),r=new Yi,{organization:n,project:o,pushId:s,wait:i}=t,a=t.domain||An(),c=t["max-execution-time"]||1200,l=t["retry-interval"]?t["retry-interval"]*1e3:aw,u=t["start-time"]||Date.now(),p=c*1e3,m=t["continue-on-deploy-failures"]||!1;try{let d=ao(),b=new $n({domain:a,apiKey:d,command:"push-status"}),h;return h=await ni({operation:()=>b.remotes.getPush({organizationId:n,projectId:o,pushId:s}),condition:i?E=>!["pending","running"].includes(E.status.preview.deploy.status):null,onConditionNotMet:E=>{oi({status:E.status.preview.deploy.status,url:E.status.preview.deploy.url,spinner:r,buildType:"preview",continueOnDeployFailures:m,wait:i})},onRetry:E=>{t.onRetry&&t.onRetry({preview:E.status.preview,production:E.isMainBranch?E.status.production:null,commit:E.commit})},startTime:u,retryTimeoutMs:p,retryIntervalMs:l}),If({buildType:"preview",spinner:r,wait:i,push:h,continueOnDeployFailures:m}),Tf(h.status.preview.scorecard),h.isMainBranch&&(!i||h.status.preview.deploy.status==="success")&&(h=await ni({operation:()=>b.remotes.getPush({organizationId:n,projectId:o,pushId:s}),condition:i?E=>!["pending","running"].includes(E.status.production.deploy.status):null,onConditionNotMet:E=>{oi({status:E.status.production.deploy.status,url:E.status.production.deploy.url,spinner:r,buildType:"production",continueOnDeployFailures:m,wait:i})},onRetry:E=>{t.onRetry&&t.onRetry({preview:E.status.preview,production:E.isMainBranch?E.status.production:null,commit:E.commit})},startTime:u,retryTimeoutMs:p,retryIntervalMs:l})),h.isMainBranch&&(If({buildType:"production",spinner:r,wait:i,push:h,continueOnDeployFailures:m}),Tf(h.status.production.scorecard)),cw({organization:n,projectId:o,pushId:s,startedAt:e}),b.reportSunsetWarnings(),{preview:h.status.preview,production:h.isMainBranch?h.status.production:null,commit:h.commit}}catch(d){r.stop(),xo("\u2717 Failed to get push status.",d)}finally{r.stop()}}function cw({organization:t,projectId:e,pushId:r,startedAt:n}){g.info(`
|
|
255
334
|
Processed push-status for ${ee(t)}, ${ee(e)} and pushID ${ee(r)}.
|
|
256
|
-
`),
|
|
257
|
-
`):
|
|
258
|
-
${
|
|
259
|
-
${
|
|
260
|
-
${
|
|
261
|
-
${
|
|
262
|
-
${
|
|
263
|
-
`);
|
|
264
|
-
`)}}function
|
|
335
|
+
`),Qe("push-status",n,"Finished")}function If({buildType:t,spinner:e,push:r,continueOnDeployFailures:n}){r&&(r.isOutdated||!r.hasChanges?g.warn(`Files not added to your project. Reason: ${r.isOutdated?"outdated":"no changes"}.
|
|
336
|
+
`):oi({status:r.status[t].deploy.status,url:r.status[t].deploy.url,buildType:t,spinner:e,continueOnDeployFailures:n}))}function Tf(t){if(!(!t||t.length===0)){g.output(`
|
|
337
|
+
${at("Scorecard")}:`);for(let e of t)g.output(`
|
|
338
|
+
${at("Name")}: ${e.name}
|
|
339
|
+
${at("Status")}: ${e.status}
|
|
340
|
+
${at("URL")}: ${be(e.url)}
|
|
341
|
+
${at("Description")}: ${e.description}
|
|
342
|
+
`);g.output(`
|
|
343
|
+
`)}}function oi({status:t,url:e,spinner:r,buildType:n,continueOnDeployFailures:o,wait:s}){let i=lw({status:t,url:e,buildType:n,wait:s});if(t==="failed"&&!o)throw r.stop(),new zr(i);return s&&(t==="pending"||t==="running")?r.start(i):(r.stop(),g.output(i))}function lw({status:t,url:e,buildType:r,wait:n}){switch(t){case"skipped":return`${ee(`Skipped ${r}`)}
|
|
265
344
|
`;case"pending":{let o=`${ee(`Pending ${r}`)}`;return n?o:`Status: ${o}
|
|
266
345
|
`}case"running":{let o=`${ee(`Running ${r}`)}`;return n?o:`Status: ${o}
|
|
267
|
-
`}case"success":return`${
|
|
268
|
-
${
|
|
269
|
-
`;case"failed":return`${
|
|
270
|
-
${
|
|
271
|
-
`}}}import*as
|
|
272
|
-
`);let{id
|
|
273
|
-
`))}),
|
|
274
|
-
`),
|
|
275
|
-
`),m&&(
|
|
276
|
-
`),await
|
|
277
|
-
`),e[s]=n}return Object.entries(e).map(([n,o])=>
|
|
278
|
-
`),s+ee("\u2551"+" ".repeat(n+
|
|
279
|
-
`);
|
|
280
|
-
`,""),version:
|
|
346
|
+
`}case"success":return`${fe(`\u{1F680} ${Zr(r)} deploy success.`)}
|
|
347
|
+
${at(`${Zr(r)} URL`)}: ${be(e||"No URL yet.")}
|
|
348
|
+
`;case"failed":return`${qe(`\u274C ${Zr(r)} deploy fail.`)}
|
|
349
|
+
${at(`${Zr(r)} URL`)}: ${be(e||"No URL yet.")}`;default:{let o=`${ee(`No status yet for ${r} deploy`)}`;return n?o:`Status: ${o}
|
|
350
|
+
`}}}import*as yr from"node:fs";import*as Yt from"node:path";async function Nf({argv:t,config:e}){let r=performance.now(),n=Date.now(),{organization:o,project:s,"mount-path":i,verbose:a}=t,c=t.domain||An();if(!c)return z("No domain provided, please use --domain option or environment variable REDOCLY_AUTHORIZATION.");try{let{"commit-sha":l,"commit-url":u,"default-branch":p,"wait-for-deployment":m,"max-execution-time":d}=t,b=pw(t.author),h=ao(),C=uw(t.files),x="push";if(!C.length)return Qe(x,r,"No files to upload");let E=new $n({domain:c,apiKey:h,command:x}),v=await E.remotes.getDefaultBranch(o,s),O=await E.remotes.upsert(o,s,{mountBranchName:v,mountPath:i});g.info(`Uploading to ${O.mountPath} ${C.length} ${Le("file",C.length)}:
|
|
351
|
+
`);let{id:$}=await E.remotes.push(o,s,{remoteId:O.id,commit:{message:t.message,branchName:t.branch,sha:l,url:u,createdAt:t["created-at"],namespace:t.namespace,repository:t.repository,author:b},isMainBranch:p===t.branch},C.map(F=>({path:ze(F.name),stream:yr.createReadStream(F.path)})));return C.forEach(F=>{g.info(fe(`\u2713 ${F.name}
|
|
352
|
+
`))}),g.info(`
|
|
353
|
+
`),g.info(`Push ID: ${$}
|
|
354
|
+
`),m&&(g.info(`
|
|
355
|
+
`),await Ao({argv:{organization:o,project:s,pushId:$,wait:!0,domain:c,"max-execution-time":d,"start-time":n,"continue-on-deploy-failures":t["continue-on-deploy-failures"]},config:e,version:ct})),a&&Qe(x,r,`${Le("file",C.length)} uploaded to organization ${o}, project ${s}. Push ID: ${$}.`),E.reportSunsetWarnings(),{pushId:$}}catch(l){xo("\u2717 File upload failed.",l)}}function pw(t){if(!/^.+\s<[^<>]+>$/.test(t))throw new Error('Invalid author format. Use "Author Name <author@email.com>"');let[r,n]=t.split("<");return{name:r.trim(),email:n.replace(">","").trim()}}function uw(t){let e={};for(let n of t)if(yr.statSync(n).isDirectory()){let o=n;Lf(o,[]).forEach(i=>r(i,o))}else r(n,Yt.dirname(n));function r(n,o){let s=Yt.relative(o,n);e[s]&&g.warn(`File ${e[s]} is overwritten by ${n}
|
|
356
|
+
`),e[s]=n}return Object.entries(e).map(([n,o])=>fw(n,o))}function fw(t,e){return{name:t,path:Yt.resolve(e)}}function Lf(t,e){let r=yr.readdirSync(t);for(let n of r){let o=Yt.join(t,n);yr.statSync(o).isDirectory()?e=Lf(o,e):e.push(o)}return e}var Df=_t(Gn(),1);import{existsSync as mw,writeFileSync as dw,readFileSync as hw,statSync as gw}from"node:fs";import{tmpdir as si}from"node:os";import{join as ii}from"node:path";import*as wn from"node:process";var ai="redocly-cli-version",vo=4,yw=1e3*60*60*12,Mf=wn.env.NODE_ENV==="test"||wn.env.CI||!!wn.env.LAMBDA_TASK_ROOT||wn.env.REDOCLY_SUPPRESS_UPDATE_NOTICE==="true",kf=()=>{if(!Mf)try{let t=hw(ii(si(),ai)).toString();bw(ct,t)&&Sw(ct,t)}catch{return}},bw=(t,e)=>(0,Df.compare)(t,e)<0,ww=async t=>{let e=`http://registry.npmjs.org/${t}/latest`;try{return(await(await Pn(e,{timeout:vn})).json()).version}catch{return}},Ff=()=>{!Cw()||Mf||ww(Ri).then(t=>{if(t){let e=ii(si(),ai);dw(e,t)}}).catch(()=>{})},Sw=(t,e)=>{let r=[`A new version of ${be("Redocly CLI")} (${fe(e)}) is available.`,`Update now: \`${be("npm i -g @redocly/cli@latest")}\`.`,"Changelog: https://redocly.com/docs/cli/changelog/"],n=Math.max(...r.map(a=>To(a).length)),o=ee("\u2550".repeat(n+vo)),s=" ".repeat(vo),i=["",s+ee("\u2554"+o+"\u2557"),s+ee("\u2551"+" ".repeat(n+vo)+"\u2551"),r.map(Ew(n,s)).join(`
|
|
357
|
+
`),s+ee("\u2551"+" ".repeat(n+vo)+"\u2551"),s+ee("\u255A"+o+"\u255D"),"",""].join(`
|
|
358
|
+
`);g.info(i)},Ew=(t,e)=>r=>{let n=" ".repeat(t-To(r).length);return`${e}${ee("\u2551")} ${r}${n} ${ee("\u2551")}`},Cw=()=>{try{let t=ii(si(),ai);if(!mw(t))return!0;let e=new Date().getTime(),n=gw(t).mtime.getTime();return e-n>=yw}catch{return!1}};function Uf(t){if(!t||t==="/")throw new Error("Mount path cannot be empty or root path. Please use --mount-path option with a valid path.");return t}function Vr(t,e=!1){return r=>{let n=Number(r);if(isNaN(n)||n<=0)throw new Error(`${t} must be a positive number`);if(e&&!Number.isInteger(n))throw new Error(`${t} must be a positive integer`);return n}}import{execSync as Ow}from"node:child_process";import*as Br from"node:fs";import{existsSync as xw,writeFileSync as Aw,readFileSync as vw}from"node:fs";import*as Wf from"node:os";import{tmpdir as zf}from"node:os";import{join as Vf}from"node:path";async function qf(t=vn){try{return await Pn(ji,{timeout:t}),!0}catch{return!1}}var Po="***";async function Gf({config:t,argv:e,exit_code:r,execution_time:n,spec_version:o,spec_keyword:s,spec_full_version:i,respect_x_security_auth_types:a,respect_source_description_types:c,respect_criterion_object_types:l,lint_rules_with_errors:u,lint_rules_with_warnings:p,lint_rules_with_ignored_problems:m,generate_client:d,eject_generator:b}){try{if(!e||!await qf(1e3))return;let{_:[C],$0:x,...E}=e,{RedoclyOAuthClient:v}=await import("./chunks/DYAVWTVD.js"),O=new v,$=Er(t,E.residency),F=await O.isAuthorized($),D=Iw();D||(D=`ann_${Ji()}`,jw(D));let ne=wr(o),X=[{id:C,object:"command",uri:`urn:redocly:cli:command:${C}`,logged_in:F?"yes":"no",command:C,..._w(E,process.argv.slice(2)),node_version:process.version,npm_version:Ow("npm -v").toString().replace(`
|
|
359
|
+
`,""),version:ct,exit_code:r,execution_time:n,metadata:process.env.REDOCLY_CLI_TELEMETRY_METADATA,environment_ci:process.env.CI,environment:process.env.REDOCLY_ENVIRONMENT,has_config:typeof t?.document?.parsed>"u"?"no":"yes",spec_version:o,spec_keyword:s,spec_full_version:i,respect_x_security_auth_types:ne==="arazzo1"&&a?.length?JSON.stringify(a):void 0,respect_source_description_types:ne==="arazzo1"&&c?.length?JSON.stringify(c):void 0,respect_criterion_object_types:ne==="arazzo1"&&l?.length?JSON.stringify(l):void 0,lint_rules_with_errors:u?.length?JSON.stringify(u):void 0,lint_rules_with_warnings:p?.length?JSON.stringify(p):void 0,lint_rules_with_ignored_problems:m?.length?JSON.stringify(m):void 0,generate_client_builtin_generators:d?.generate_client_builtin_generators?.length?JSON.stringify(d.generate_client_builtin_generators):void 0,generate_client_custom_generators_count:d?.generate_client_custom_generators_count,generate_client_toolkit_imports:d?.generate_client_toolkit_imports?.length?JSON.stringify(d.generate_client_toolkit_imports):void 0,generate_client_error_category:d?.generate_client_error_category,generate_client_ejected_generators:d?.generate_client_ejected_generators?.length?JSON.stringify(d.generate_client_ejected_generators):void 0,generate_client_composed_apis_count:d?.generate_client_composed_apis_count,eject_generator_action:b?.eject_generator_action,eject_generator_name:b?.eject_generator_name,eject_generator_outcome:b?.eject_generator_outcome,eject_generator_conflicts:b?.eject_generator_conflicts,eject_generator_from_version:b?.eject_generator_from_version,eject_generator_to_version:b?.eject_generator_to_version}],ue=Ki.mapToCloudEvent({type:"com.redocly.command.ran",source:"urn:redocly:cli",origin:"redocly-cli",env:"production",osPlatform:Wf.platform(),actor:{id:D,object:"user",uri:""},category:"product",data:X}),{otelTelemetry:R}=await import("./chunks/V3JMSQFP.js");R.send(ue)}catch{}}function Bf(t,e){for(let r of t.sourceDescriptions??[])r.type&&e.add(r.type)}function Hf(t,e){for(let r of t.workflows??[]){Gr(r.successActions,e),Gr(r.failureActions,e);for(let n of r.steps??[])Yf(n.successCriteria,e),Gr(n.onSuccess,e),Gr(n.onFailure,e)}Gr(Object.values(t.components?.successActions??{}),e),Gr(Object.values(t.components?.failureActions??{}),e)}function Gr(t,e){for(let r of t??[])Yf(r.criteria,e)}function Yf(t,e){for(let r of t??[]){let n=Pw(r);n&&e.add(n)}}function Pw(t){let e=t.type;return typeof e=="string"?e:e?.type||(t.condition?"simple":void 0)}function Kf(t,e){for(let r of t.workflows??[]){for(let n of r["x-security"]??[]){let o=n.scheme;if(o?.type){let s=o.type==="http"?o.scheme:o.type;s&&e.add(s)}}for(let n of r.steps??[])for(let o of n["x-security"]??[]){let s=o.scheme;if(s?.type){let a=s.type==="http"?s.scheme:s.type;a&&e.add(a)}let i=o.schemeName;i&&e.add(i)}}}function $w(t){return Br.existsSync(t)&&Br.statSync(t).isFile()}function Rw(t){return Br.existsSync(t)&&Br.statSync(t).isDirectory()}function ci(t){return t&&(yi(t)?t.split("://")[0]+"://url":$w(t)?t.replace(/.+\.([^.]+)$/,(e,r)=>"file-"+r):Rw(t)?"folder":t)}function li(t,e,r){let n=Array.isArray(e)?e:[e];for(let o of n)t=t.replaceAll(o,r);return t}function Jf(t,e){let r={};for(let[n,o]of Object.entries(t))e.includes(n)?r[n]=Po:te(o)?r[n]=Jf(o,e):r[n]=o;return r}function pi(t,e,r=[]){if(Array.isArray(t))return t.forEach(n=>pi(n,e,r)),r;if(te(t))for(let[n,o]of Object.entries(t))e.includes(n)&&typeof o=="string"?r.push(o):(te(o)||Array.isArray(o))&&pi(o,e,r);return r}function _w(t,e){let r=["organization","o","input","i","clientCert","clientKey","caCert","server","S"],n=e.join(" "),o={};for(let[s,i]of Object.entries(t))if(r.includes(s))o[s]=Po,n=li(n,i,Po);else if(typeof i=="string"){let a=ci(i);o[s]=a,n=li(n,i,a)}else if(Array.isArray(i)){o[s]=i.map(ci);for(let a of i){let c=ci(a);n.includes(a)&&(n=n.replaceAll(a,c))}}else if(te(i)){let a=pi(i,r);for(let c of a)n=li(n,c,Po);o[s]=Jf(i,r)}else o[s]=i;return{arguments:JSON.stringify(o),raw_input:n}}var jw=t=>{if(!(process.env.CI||!t))try{let r=Vf(zf(),_o);Aw(r,t)}catch{}},Iw=()=>{if(!process.env.CI)try{let e=Vf(zf(),_o);return xw(e)?vw(e).toString().trim():void 0}catch{return}};function Se(t){return async e=>{let r=performance.now(),n=2,o,s="unknown",i,a,c,l=new Set,u=new Set,p=new Set,m=({parsed:x,source:E})=>{if(s="unknown",i=void 0,a=void 0,E?.absoluteRef&&Ai(E.absoluteRef)){s="graphql";return}try{s=wt(x)}catch{s="unsupported"}te(x)&&(i=x?.openapi?"openapi":x?.swagger?"swagger":x?.asyncapi?"asyncapi":x?.arazzo?"arazzo":x?.overlay?"overlay":void 0,i&&(a=x[i]),wr(s)==="arazzo1"&&(Kf(x,l),Bf(x,u),Hf(x,p)))},d=new Set,b=new Set,h=new Set,C=x=>{for(let E of x)E.ignored?h.add(E.ruleId):E.severity==="error"?d.add(E.ruleId):E.severity==="warn"&&b.add(E.ruleId)};try{e.config&&!ui(e.config)&&z("Please provide a valid path to the configuration file."),c=await Vi(e,ct),o=c.resolvedConfig.telemetry,n=1,typeof t=="function"&&await t({argv:e,config:c,version:ct,collectSpecData:m,collectResults:C}),n=0}catch(x){x instanceof Kt||(x instanceof de?g.error(x.message+`
|
|
281
360
|
|
|
282
|
-
`):(
|
|
283
|
-
`),
|
|
284
|
-
`)))}finally{if(process.env.REDOCLY_TELEMETRY!=="off"&&o!=="off"){let C=Math.round(performance.now()-r);await Zu({config:c,argv:e,exit_code:n,execution_time:C,spec_version:s,spec_keyword:i,spec_full_version:a,respect_x_security_auth_types:[...p],respect_source_description_types:[...u],respect_criterion_object_types:[...l],lint_rules_with_errors:[...d],lint_rules_with_warnings:[...w],lint_rules_with_ignored_problems:[...h]})}process.once("beforeExit",()=>{process.exit(n)})}}}of.config({path:sf.resolve(process.cwd(),"./.env")});Gu();Sl(Jo(process.argv)).version("version","Show version number.",tt).help("help","Show help.").parserConfiguration({"greedy-arrays":!1,"boolean-negation":!1}).command("stats [api]","Show statistics for an API description.",t=>t.env("REDOCLY_CLI_STATS").positional("api",{type:"string"}).option({config:{description:"Path to the config file.",type:"string"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"},format:{description:"Use a specific output format.",choices:["stylish","json","markdown"],default:"stylish"}}),t=>{ge(Mu)(t)}).command("score [api]","Score an API description for integration simplicity and agent readiness.",t=>t.env("REDOCLY_CLI_SCORE").positional("api",{type:"string"}).option({config:{description:"Path to the config file.",type:"string"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"},format:{description:"Use a specific output format.",choices:["stylish","json"],default:"stylish"},"operation-details":{description:"Print per-operation metric details.",type:"boolean",default:!1},"debug-operation-id":{description:"Print detailed schema breakdown for a specific operation.",type:"string"}}),t=>{ge(Vp)(t)}).command("split [api]","Split an API description into a multi-file structure.",t=>t.env("REDOCLY_CLI_SPLIT").positional("api",{description:"API description file that you want to split",type:"string"}).option({outDir:{description:"Output directory where files will be saved.",required:!0,type:"string"},separator:{description:"File path separator used while splitting.",required:!1,type:"string",default:"_"},config:{description:"Path to the config file.",requiresArg:!0,type:"string"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}).demandOption("api"),t=>{ge(Iu)(t)}).command("join [apis...]","Join multiple API descriptions into one [experimental].",t=>t.env("REDOCLY_CLI_JOIN").positional("apis",{array:!0,type:"string",demandOption:!0}).option({"prefix-tags-with-info-prop":{description:"Prefix tags with property value from info object.",requiresArg:!0,type:"string"},"prefix-tags-with-filename":{description:"Prefix tags with property value from file name.",type:"boolean",default:!1},"prefix-components-with-info-prop":{description:"Prefix components with property value from info object.",requiresArg:!0,type:"string"},"without-x-tag-groups":{description:"Skip automated x-tagGroups creation",type:"boolean"},output:{description:"Output file.",alias:"o",type:"string"},config:{description:"Path to the config file.",requiresArg:!0,type:"string"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),t=>{ge(Hl)(t)}).command("push-status [pushId]",!1,t=>t.env("REDOCLY_CLI_PUSH_STATUS").positional("pushId",{description:"Push id.",type:"string",demandOption:!0}).implies("max-execution-time","wait").option({organization:{description:"Name of the organization to push to.",type:"string",alias:"o",required:!0},project:{description:"Name of the project to push to.",type:"string",required:!0,alias:"p"},domain:{description:"Specify a domain.",alias:"d",type:"string",required:!1},wait:{description:"Wait for build to finish.",type:"boolean",default:!1},"max-execution-time":{description:"Maximum execution time in seconds.",type:"number"},"continue-on-deploy-failures":{description:"Command does not fail even if the deployment fails.",type:"boolean",default:!1},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),t=>{ge(lo)(t)}).command("push [files...]","Push documents to Reunite.",t=>t.env("REDOCLY_CLI_PUSH").positional("files",{type:"string",array:!0,demandOption:!0}).option({branch:{description:"Branch name to push to.",type:"string",alias:"b",required:!0},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"},organization:{description:"Name of the organization to push to.",type:"string",alias:"o",required:!0},project:{description:"Name of the project to push to.",type:"string",alias:"p",required:!0},"mount-path":{description:"The path files should be pushed to.",type:"string",alias:"mp",required:!0,coerce:Hu},author:{description:"Author of the commit.",type:"string",alias:"a",required:!0},message:{description:"Commit message.",type:"string",alias:"m",required:!0},"commit-sha":{description:"Commit SHA.",type:"string",alias:"sha"},"commit-url":{description:"Commit URL.",type:"string",alias:"url"},namespace:{description:"Repository namespace.",type:"string"},repository:{description:"Repository name.",type:"string"},"created-at":{description:"Commit creation date.",type:"string"},domain:{description:"Specify a domain.",alias:"d",type:"string"},config:{description:"Path to the config file.",requiresArg:!0,type:"string"},"default-branch":{type:"string",default:"main"},"max-execution-time":{description:"Maximum execution time in seconds.",type:"number"},"wait-for-deployment":{description:"Wait for build to finish.",type:"boolean",default:!1},verbose:{type:"boolean",default:!1},"continue-on-deploy-failures":{description:"Command does not fail even if the deployment fails.",type:"boolean",default:!1}}),t=>{ge(qu)(t)}).command("lint [apis...]","Lint an API or Arazzo description.",t=>t.env("REDOCLY_CLI_LINT").positional("apis",{array:!0,type:"string",demandOption:!0}).option({format:{description:"Use a specific output format.",choices:["stylish","codeframe","json","checkstyle","codeclimate","summary","markdown","github-actions","junit"],default:"codeframe"},"max-problems":{requiresArg:!0,description:"Reduce output to a maximum of N problems.",type:"number",default:100},"generate-ignore-file":{description:"Generate an ignore file.",type:"boolean"},"skip-rule":{description:"Ignore certain rules.",array:!0,type:"string"},"skip-preprocessor":{description:"Ignore certain preprocessors.",array:!0,type:"string"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"},config:{description:"Path to the config file.",requiresArg:!0,type:"string"},extends:{description:"Override extends configurations (defaults or config file settings).",requiresArg:!0,array:!0,type:"string"}}),t=>{ge(ui)(t)}).command("bundle [apis...]","Bundle a multi-file API description to a single file.",t=>t.env("REDOCLY_CLI_BUNDLE").positional("apis",{array:!0,type:"string",demandOption:!0}).options({output:{type:"string",description:"Output file or folder for inline APIs.",alias:"o"},ext:{description:"Bundle file extension.",requiresArg:!0,choices:fi},"skip-preprocessor":{description:"Ignore certain preprocessors.",array:!0,type:"string"},"skip-decorator":{description:"Ignore certain decorators.",array:!0,type:"string"},dereferenced:{alias:"d",type:"boolean",description:"Produce a fully dereferenced bundle."},force:{alias:"f",type:"boolean",description:"Produce bundle output even when errors occur."},config:{description:"Path to the config file.",type:"string"},metafile:{description:"Produce metadata about the bundle",type:"string"},extends:{description:"Override extends configurations (defaults or config file settings).",requiresArg:!0,array:!0,type:"string",hidden:!0},"remove-unused-components":{description:"Remove unused components.",type:"boolean",default:!1},"keep-url-references":{description:"Keep absolute url references.",type:"boolean",alias:"k"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"},"component-renaming-conflicts-severity":{description:"Whether to show warnings or fail on renaming conflicts (defaults to warn).",choices:["warn","error","off"]},"component-names-strategy":{description:"How to name inlined Schema components: 'basename' (default) or 'title' (from each schema's `title`).",choices:["basename","title"],default:"basename"}}).check(e=>{if(e.output&&(!e.apis||e.apis.length===0))throw new Error("At least one inline API must be specified when using --output.");return!0}),t=>{ge(Ol)(t)}).command("check-config","Lint the Redocly configuration file.",async t=>t.env("REDOCLY_CLI_CHECK_CONFIG").option({config:{description:"Path to the config file.",type:"string"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error"],default:"error"}}),t=>{ge()(t)}).command("login","Log in to Redocly.",async t=>t.env("REDOCLY_CLI_LOGIN").options({residency:{description:"Residency of the application. Defaults to `us`.",alias:["r"],type:"string"},config:{description:"Path to the config file.",requiresArg:!0,type:"string"},verbose:{alias:"v",describe:"Apply verbose mode.",type:"boolean"}}),t=>{ge(wl)(t)}).command("logout","Clear your stored credentials.",t=>t,t=>{ge(El)(t)}).command("preview","Preview Redocly project using one of the product NPM packages.",t=>t.env("REDOCLY_CLI_PREVIEW").options({product:{type:"string",choices:["redoc","revel","reef","realm","redoc-revel","redoc-reef","revel-reef"],description:"Product used to launch preview. Default is inferred from project's package.json or 'realm' is used."},plan:{type:"string",choices:Yl,default:"enterprise"},port:{alias:"p",type:"number",description:"Preview port.",default:4e3,coerce:Tr("port",!0)},"project-dir":{alias:["d","source-dir"],type:"string",description:"Specifies the project content directory. The default value is the directory where the command is executed.",default:"."},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),t=>{process.argv.some(e=>e.startsWith("--source-dir"))&&y.error(`Option --source-dir is deprecated and will be removed soon. Use --project-dir instead.
|
|
285
|
-
`),ge(Kl)(t)}).command("build-docs [api]","Produce API documentation as an HTML file",t=>t.positional("api",{type:"string"}).options({o:{describe:"Output destination file.",alias:"output",type:"string",default:"redoc-static.html"},title:{describe:"Page title.",type:"string"},disableGoogleFont:{describe:"Disable Google fonts.",type:"boolean",default:!1},t:{alias:"template",describe:"Path to handlebars page template, see https://github.com/Redocly/redocly-cli/blob/main/packages/cli/src/commands/build-docs/template.hbs for the example.",type:"string"},templateOptions:{describe:"Additional options to pass to the template. Use dot notation, e.g. templateOptions.metaDescription"},theme:{describe:"Redoc theme.openapi configuration. Use dot notation, e.g. theme.openapi.nativeScrollbars"},config:{describe:"Path to the config file.",type:"string"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}).check(e=>{if(e.theme&&!e.theme?.openapi)throw new Error("Invalid option: theme.openapi not set.");return!0}),async t=>{let{handlerBuildCommand:e}=await import("./chunks/S4MX7JPH.js");ge(e)(t)}).command("translate <locale>","Creates or updates translations.yaml files and fills them with missing built-in translations and translations from the redocly.yaml and sidebars.yaml files.",t=>t.env("REDOCLY_CLI_TRANSLATE").positional("locale",{description:"Locale code to generate translations for, or `all` for all current project locales.",type:"string",demandOption:!0}).options({"project-dir":{alias:"d",type:"string",description:"Specifies the project content directory. The default value is the directory where the command is executed.",default:"."},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),t=>{ge(Fu)(t)}).command("eject <type> [path]","Helper function to eject project elements for customization.",t=>t.env("REDOCLY_CLI_EJECT").positional("type",{description:"Specifies what type of project element to eject. Currently this value must be `component`.",demandOption:!0,choices:["component"]}).positional("path",{description:"Filepath to a component or filepath with glob pattern.",type:"string"}).options({"project-dir":{alias:"d",type:"string",description:"Specifies the project content directory. The default value is the directory where the command is executed.",default:"."},force:{alias:"f",type:"boolean",description:'Skips the "overwrite existing" confirmation when ejecting a component that is already ejected in the destination.'},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),t=>{ge(xl)(t)}).command("respect [files...]","Run Arazzo tests.",t=>t.env("REDOCLY_CLI_RESPECT").positional("files",{describe:"Test files or glob pattern.",type:"string",array:!0,default:[]}).options({input:{alias:"i",describe:"Input parameters.",type:"string"},server:{alias:"S",describe:"Server parameters.",type:"string"},workflow:{alias:"w",describe:"Workflow name.",type:"string",array:!0},skip:{alias:"s",describe:"Workflow to skip.",type:"string",array:!0},verbose:{alias:"v",describe:"Apply verbose mode.",type:"boolean"},"har-output":{describe:"Har file output name.",type:"string",alias:"H"},"json-output":{describe:"JSON file output name.",type:"string",alias:"J"},mtls:{describe:'Per-domain mutual TLS certificates configuration as JSON. Format: {"<domain>": {"clientCert": "<path>", "clientKey": "<path>", "caCert": "<path>"}}',type:"string",array:!0,coerce:wp},severity:{describe:"Severity of the check.",type:"string"},"max-steps":{describe:"Maximum number of steps to run (default: 2000).",type:"number",default:2e3,coerce:Tr("max-steps",!0)},"max-fetch-timeout":{describe:"Maximum time to wait for API response per request in milliseconds (default: 40 seconds).",type:"number",default:4e4,coerce:Tr("max-fetch-timeout",!1)},"execution-timeout":{describe:"Maximum time to wait for the Respect execution in milliseconds (default: 1 hour).",type:"number",default:36e5,coerce:Tr("execution-timeout",!1)},"no-secrets-masking":{describe:"Do not mask secrets in the output.",type:"boolean",default:!1}}),async t=>{ge(bp)(t)}).command("generate-arazzo <descriptionPath>","Auto-generate arazzo description file from an API description.",t=>t.env("REDOCLY_CLI_GENERATE_ARAZZO").positional("descriptionPath",{describe:"Description file path.",type:"string"}).options({"output-file":{alias:"o",describe:"Output File name.",type:"string",requiresArg:!0}}),async t=>{ge(vl)(t)}).command("generate-client [api]","Generate a TypeScript client from an OpenAPI description [experimental].",t=>t.env("REDOCLY_CLI_GENERATE_CLIENT").positional("api",{describe:"OpenAPI description file path (or alias from redocly.yaml `apis:`).",type:"string"}).options({output:{alias:"o",describe:"Output file path for the generated client (must end in .ts).",type:"string",requiresArg:!0},"server-url":{describe:"Override the server URL inlined into the generated runtime. Defaults to `servers[0].url`.",type:"string",requiresArg:!0},"output-mode":{describe:"How the client is split across files: `single` (default, one file) or `split` (schema types and guards in a sibling `<name>.schemas.ts` the entry re-exports).",choices:["single","split"],requiresArg:!0},runtime:{describe:"Runtime distribution: 'inline' (default) embeds the runtime in the generated file; 'package' imports it from @redocly/client-generator.",choices:["inline","package"],requiresArg:!0},"import-ext":{describe:"Extension in generated relative imports: 'js' (default) suits tsc and bundlers; 'ts' suits runtimes that resolve specifiers literally, like Node's built-in type stripping (node client.ts).",choices:["js","ts"],requiresArg:!0},setup:{describe:"Path to a publisher setup module (a file default-exporting { config, middleware }) that gets included into the generated client \u2014 pre-configure defaults such as the server URL, retries, headers, and middleware, so a published SDK ships with them built in. Works across all output modes.",type:"string",requiresArg:!0},"args-style":{describe:"How operation inputs are passed: `flat` (default) spreads path params as positional arguments followed by `params`/`body`/`headers`; `grouped` bundles every input into a single `args` object (the per-call request `init` stays a separate trailing argument).",choices:["flat","grouped"],requiresArg:!0},"error-mode":{describe:"Error handling: 'throw' (default) throws ApiError on non-2xx; 'result' returns { data, error, response }.",choices:["throw","result"],requiresArg:!0},"date-type":{describe:"How `date-time`/`date` string fields are typed: 'string' (default) keeps the ISO wire shape; 'Date' emits a `Date` (pair with --generator transformers so the runtime value matches).",choices:["string","Date"],requiresArg:!0},"mock-data":{describe:"How the `mock` generator produces data: 'static' (default) inlines deterministic literals (zero-dep); 'faker' emits @faker-js/faker calls for realistic data (install @faker-js/faker as a dev dependency).",choices:["static","faker"],requiresArg:!0},"mock-seed":{describe:"Seed for faker-mode mocks: emits a top-level `faker.seed(<n>)` so generated data is reproducible across runs. Ignored in static mode.",type:"number",requiresArg:!0},generator:{describe:"Generator to run; repeat the flag to run several (default: sdk). A built-in name (sdk, zod, tanstack-query, swr, transformers, mock) or a custom-generator path/package specifier. Example: --generator sdk --generator zod",type:"string",array:!0,requiresArg:!0},config:{describe:"Path to the config file.",type:"string",requiresArg:!0}}),async t=>{ge(Rl)(t)}).command("generate-spec <traffic>","Infer an OpenAPI description from recorded HTTP traffic, optionally refined with AI [experimental].",t=>t.env("REDOCLY_CLI_GENERATE_SPEC").positional("traffic",{describe:"Path to a traffic log file or folder (HAR, Kong, Nginx/Apache JSON, NDJSON).",type:"string"}).option({type:{describe:"Target API description type.",choices:["openapi"],default:"openapi"},"traffic-format":{describe:"Traffic input format.",choices:["auto","har","kong","nginx-json","apache-json","ndjson"],default:"auto"},server:{describe:"Server URL the traffic was captured against: only requests under it are considered, the rest of their URL becomes the API path, and it becomes the servers URL of the generated description.",type:"string"},title:{describe:"Title for the generated API description.",type:"string"},"with-ai":{describe:"Refine the inferred description with an AI provider to narrow the hypothesis.",type:"boolean",default:!1},"ai-provider":{describe:'AI provider used with --with-ai; runs the "claude", "codex", or "cursor" CLI in non-interactive mode.',choices:["claude","codex","cursor"],default:"claude"},"ai-model":{describe:"Model passed to the selected AI provider (provider-specific default applies).",type:"string"},"ai-concurrency":{describe:"Number of operations refined in parallel with --with-ai.",type:"number",default:4,coerce:Tr("ai-concurrency",!0)},output:{alias:"o",describe:"Write the generated description to this file instead of stdout.",type:"string"},config:{describe:"Path to the config file.",type:"string"}}),async t=>{let{handleGenerateSpec:e}=await import("./chunks/KEUH3PST.js");ge(e)(t)}).command("scorecard-classic [api]","Run quality scorecards with multiple rule levels to validate and maintain API description standards.",t=>t.positional("api",{type:"string"}).option({config:{describe:"Path to the config file.",type:"string"},"project-url":{describe:"URL to the project scorecard configuration.",type:"string"},format:{description:"Use a specific output format.",choices:["stylish","json","checkstyle","junit"],default:"stylish"},"target-level":{describe:"Target level for the scorecard.",type:"string"},verbose:{alias:"v",describe:"Apply verbose mode.",type:"boolean"}}),async t=>{ge(ru)(t)}).command("drift <traffic>","Detect drift between recorded HTTP traffic and an OpenAPI description [experimental].",t=>t.env("REDOCLY_CLI_DRIFT").positional("traffic",{describe:"Path to a traffic log file or folder (HAR, Kong, Nginx/Apache JSON, NDJSON).",type:"string"}).option({api:{describe:"OpenAPI description file or folder to validate against.",type:"string",demandOption:!0},"traffic-format":{describe:"Traffic input format.",choices:["auto","har","kong","nginx-json","apache-json","ndjson"],default:"auto"},"report-format":{describe:"Output format.",alias:"format",choices:["pretty","json","csv","sarif"],default:"pretty"},"match-mode":{describe:"Endpoint matching mode (how requests are located via the description servers). Mutually exclusive with --server.",choices:["strict-host","basepath"],defaultDescription:"strict-host"},"ignore-cookies":{describe:"Ignore cookie-based checks (useful for logs exported without cookies).",type:"boolean",default:!1},"ignore-headers":{describe:'Comma-separated header names to skip in undocumented-header checks. A trailing "*" matches by prefix, e.g. "x-consumer-*".',type:"string"},"max-findings":{describe:"Maximum findings shown in pretty output.",type:"number",default:10},"min-severity":{describe:"Discard findings below this severity from the report.",choices:["info","warning","error"],default:"info"},rules:{describe:"Comma-separated builtin rules to run.",type:"string"},output:{alias:"o",describe:"Write the drift report (in the format selected with --format) to this file instead of stdout.",type:"string"},server:{describe:"Server URL the traffic was captured against: only requests under it are considered, and the rest of their URL is treated as the API path. It replaces the description servers and the remaining path is matched against the description paths directly. Mutually exclusive with --match-mode.",type:"string"},config:{describe:"Path to the config file.",type:"string"},"lint-config":{describe:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),async t=>{let{handleDrift:e}=await import("./chunks/SL6AH3N2.js");ge(e)(t)}).command("proxy","Capture live HTTP traffic through a reverse proxy into a HAR file, optionally validating it against an OpenAPI description [experimental].",t=>t.env("REDOCLY_CLI_PROXY").option({target:{describe:"Upstream base URL to forward captured requests to.",type:"string",demandOption:!0},port:{describe:"Port the proxy listens on.",type:"number",default:4040},host:{describe:"Host the proxy binds to.",type:"string",default:"127.0.0.1"},har:{describe:"Path to the HAR file where captured traffic is written.",type:"string",demandOption:!0},api:{describe:"OpenAPI description file or folder to validate captured traffic against (live).",type:"string"},"report-format":{describe:"Output format for the validation report printed on shutdown.",alias:"format",choices:["pretty","json","csv","sarif"],default:"pretty"},"match-mode":{describe:"Endpoint matching mode.",choices:["strict-host","basepath"],default:"strict-host"},"ignore-cookies":{describe:"Ignore cookie-based checks.",type:"boolean",default:!1},"ignore-headers":{describe:'Comma-separated header names to skip in undocumented-header checks. A trailing "*" matches by prefix, e.g. "x-consumer-*".',type:"string"},"max-findings":{describe:"Maximum findings shown in pretty output.",type:"number",default:10},rules:{describe:"Comma-separated builtin rules to run.",type:"string"},config:{describe:"Path to the config file.",type:"string"},"lint-config":{describe:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),async t=>{let{handleProxy:e}=await import("./chunks/TEQA5OM7.js");ge(e)(t)}).completion("completion","Generate autocomplete script for `redocly` command.").demandCommand(1).middleware([Bu]).strict().argv;
|
|
361
|
+
`):(g.error(`An unexpected error occurred. This is likely a bug that should be reported.
|
|
362
|
+
`),g.error(x instanceof Error?x.stack||x.message:String(x)),g.error(`
|
|
363
|
+
`)))}finally{if(process.env.REDOCLY_TELEMETRY!=="off"&&o!=="off"){let x=Math.round(performance.now()-r);await Gf({config:c,argv:e,exit_code:n,execution_time:x,spec_version:s,spec_keyword:i,spec_full_version:a,respect_x_security_auth_types:[...l],respect_source_description_types:[...u],respect_criterion_object_types:[...p],lint_rules_with_errors:[...d],lint_rules_with_warnings:[...b],lint_rules_with_ignored_problems:[...h],generate_client:ot,eject_generator:ye})}process.once("beforeExit",()=>{process.exit(n)})}}}Xf.config({path:Zf.resolve(process.cwd(),"./.env")});Ff();zl(ps(process.argv)).version("version","Show version number.",ct).help("help","Show help.").parserConfiguration({"greedy-arrays":!1,"boolean-negation":!1}).command("stats [api]","Show statistics for an API description.",t=>t.env("REDOCLY_CLI_STATS").positional("api",{type:"string"}).option({config:{description:"Path to the config file.",type:"string"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"},format:{description:"Use a specific output format.",choices:["stylish","json","markdown"],default:"stylish"}}),t=>{Se(_f)(t)}).command("score [api]","Score an API description for integration simplicity and agent readiness.",t=>t.env("REDOCLY_CLI_SCORE").positional("api",{type:"string"}).option({config:{description:"Path to the config file.",type:"string"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"},format:{description:"Use a specific output format.",choices:["stylish","json"],default:"stylish"},"operation-details":{description:"Print per-operation metric details.",type:"boolean",default:!1},"debug-operation-id":{description:"Print detailed schema breakdown for a specific operation.",type:"string"}}),t=>{Se(Du)(t)}).command("split [api]","Split an API description into a multi-file structure.",t=>t.env("REDOCLY_CLI_SPLIT").positional("api",{description:"API description file that you want to split",type:"string"}).option({outDir:{description:"Output directory where files will be saved.",required:!0,type:"string"},separator:{description:"File path separator used while splitting.",required:!1,type:"string",default:"_"},config:{description:"Path to the config file.",requiresArg:!0,type:"string"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}).demandOption("api"),t=>{Se(xf)(t)}).command("join [apis...]","Join multiple API descriptions into one [experimental].",t=>t.env("REDOCLY_CLI_JOIN").positional("apis",{array:!0,type:"string",demandOption:!0}).option({"prefix-tags-with-info-prop":{description:"Prefix tags with property value from info object.",requiresArg:!0,type:"string"},"prefix-tags-with-filename":{description:"Prefix tags with property value from file name.",type:"boolean",default:!1},"prefix-components-with-info-prop":{description:"Prefix components with property value from info object.",requiresArg:!0,type:"string"},"without-x-tag-groups":{description:"Skip automated x-tagGroups creation",type:"boolean"},output:{description:"Output file.",alias:"o",type:"string"},config:{description:"Path to the config file.",requiresArg:!0,type:"string"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),t=>{Se(kp)(t)}).command("push-status [pushId]",!1,t=>t.env("REDOCLY_CLI_PUSH_STATUS").positional("pushId",{description:"Push id.",type:"string",demandOption:!0}).implies("max-execution-time","wait").option({organization:{description:"Name of the organization to push to.",type:"string",alias:"o",required:!0},project:{description:"Name of the project to push to.",type:"string",required:!0,alias:"p"},domain:{description:"Specify a domain.",alias:"d",type:"string",required:!1},wait:{description:"Wait for build to finish.",type:"boolean",default:!1},"max-execution-time":{description:"Maximum execution time in seconds.",type:"number"},"continue-on-deploy-failures":{description:"Command does not fail even if the deployment fails.",type:"boolean",default:!1},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),t=>{Se(Ao)(t)}).command("push [files...]","Push documents to Reunite.",t=>t.env("REDOCLY_CLI_PUSH").positional("files",{type:"string",array:!0,demandOption:!0}).option({branch:{description:"Branch name to push to.",type:"string",alias:"b",required:!0},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"},organization:{description:"Name of the organization to push to.",type:"string",alias:"o",required:!0},project:{description:"Name of the project to push to.",type:"string",alias:"p",required:!0},"mount-path":{description:"The path files should be pushed to.",type:"string",alias:"mp",required:!0,coerce:Uf},author:{description:"Author of the commit.",type:"string",alias:"a",required:!0},message:{description:"Commit message.",type:"string",alias:"m",required:!0},"commit-sha":{description:"Commit SHA.",type:"string",alias:"sha"},"commit-url":{description:"Commit URL.",type:"string",alias:"url"},namespace:{description:"Repository namespace.",type:"string"},repository:{description:"Repository name.",type:"string"},"created-at":{description:"Commit creation date.",type:"string"},domain:{description:"Specify a domain.",alias:"d",type:"string"},config:{description:"Path to the config file.",requiresArg:!0,type:"string"},"default-branch":{type:"string",default:"main"},"max-execution-time":{description:"Maximum execution time in seconds.",type:"number"},"wait-for-deployment":{description:"Wait for build to finish.",type:"boolean",default:!1},verbose:{type:"boolean",default:!1},"continue-on-deploy-failures":{description:"Command does not fail even if the deployment fails.",type:"boolean",default:!1}}),t=>{Se(Nf)(t)}).command("lint [apis...]","Lint an API or Arazzo description.",t=>t.env("REDOCLY_CLI_LINT").positional("apis",{array:!0,type:"string",demandOption:!0}).option({format:{description:"Use a specific output format.",choices:["stylish","codeframe","json","checkstyle","codeclimate","summary","markdown","github-actions","junit"],default:"codeframe"},"max-problems":{requiresArg:!0,description:"Reduce output to a maximum of N problems.",type:"number",default:100},"generate-ignore-file":{description:"Generate an ignore file.",type:"boolean"},"skip-rule":{description:"Ignore certain rules.",array:!0,type:"string"},"skip-preprocessor":{description:"Ignore certain preprocessors.",array:!0,type:"string"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"},config:{description:"Path to the config file.",requiresArg:!0,type:"string"},extends:{description:"Override extends configurations (defaults or config file settings).",requiresArg:!0,array:!0,type:"string"}}),t=>{Se(Li)(t)}).command("bundle [apis...]","Bundle a multi-file API description to a single file.",t=>t.env("REDOCLY_CLI_BUNDLE").positional("apis",{array:!0,type:"string",demandOption:!0}).options({output:{type:"string",description:"Output file or folder for inline APIs.",alias:"o"},ext:{description:"Bundle file extension.",requiresArg:!0,choices:Di},"skip-preprocessor":{description:"Ignore certain preprocessors.",array:!0,type:"string"},"skip-decorator":{description:"Ignore certain decorators.",array:!0,type:"string"},dereferenced:{alias:"d",type:"boolean",description:"Produce a fully dereferenced bundle."},force:{alias:"f",type:"boolean",description:"Produce bundle output even when errors occur."},config:{description:"Path to the config file.",type:"string"},metafile:{description:"Produce metadata about the bundle",type:"string"},extends:{description:"Override extends configurations (defaults or config file settings).",requiresArg:!0,array:!0,type:"string",hidden:!0},"remove-unused-components":{description:"Remove unused components.",type:"boolean",default:!1},"keep-url-references":{description:"Keep absolute url references.",type:"boolean",alias:"k"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"},"component-renaming-conflicts-severity":{description:"Whether to show warnings or fail on renaming conflicts (defaults to warn).",choices:["warn","error","off"]},"component-names-strategy":{description:"How to name inlined Schema components: 'basename' (default) or 'title' (from each schema's `title`).",choices:["basename","title"],default:"basename"}}).check(e=>{if(e.output&&(!e.apis||e.apis.length===0))throw new Error("At least one inline API must be specified when using --output.");return!0}),t=>{Se(Bl)(t)}).command("check-config","Lint the Redocly configuration file.",async t=>t.env("REDOCLY_CLI_CHECK_CONFIG").option({config:{description:"Path to the config file.",type:"string"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error"],default:"error"}}),t=>{Se()(t)}).command("login","Log in to Redocly.",async t=>t.env("REDOCLY_CLI_LOGIN").options({residency:{description:"Residency of the application. Defaults to `us`.",alias:["r"],type:"string"},config:{description:"Path to the config file.",requiresArg:!0,type:"string"},verbose:{alias:"v",describe:"Apply verbose mode.",type:"boolean"}}),t=>{Se(Vl)(t)}).command("logout","Clear your stored credentials.",t=>t,t=>{Se(Gl)(t)}).command("preview","Preview Redocly project using one of the product NPM packages.",t=>t.env("REDOCLY_CLI_PREVIEW").options({product:{type:"string",choices:["redoc","revel","reef","realm","redoc-revel","redoc-reef","revel-reef"],description:"Product used to launch preview. Default is inferred from project's package.json or 'realm' is used."},plan:{type:"string",choices:Fp,default:"enterprise"},port:{alias:"p",type:"number",description:"Preview port.",default:4e3,coerce:Vr("port",!0)},"project-dir":{alias:["d","source-dir"],type:"string",description:"Specifies the project content directory. The default value is the directory where the command is executed.",default:"."},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),t=>{process.argv.some(e=>e.startsWith("--source-dir"))&&g.error(`Option --source-dir is deprecated and will be removed soon. Use --project-dir instead.
|
|
364
|
+
`),Se(Up)(t)}).command("build-docs [api]","Produce API documentation as an HTML file",t=>t.positional("api",{type:"string"}).options({o:{describe:"Output destination file.",alias:"output",type:"string",default:"redoc-static.html"},title:{describe:"Page title.",type:"string"},disableGoogleFont:{describe:"Disable Google fonts.",type:"boolean",default:!1},t:{alias:"template",describe:"Path to handlebars page template, see https://github.com/Redocly/redocly-cli/blob/main/packages/cli/src/commands/build-docs/template.hbs for the example.",type:"string"},templateOptions:{describe:"Additional options to pass to the template. Use dot notation, e.g. templateOptions.metaDescription"},theme:{describe:"Redoc theme.openapi configuration. Use dot notation, e.g. theme.openapi.nativeScrollbars"},config:{describe:"Path to the config file.",type:"string"},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}).check(e=>{if(e.theme&&!e.theme?.openapi)throw new Error("Invalid option: theme.openapi not set.");return!0}),async t=>{let{handlerBuildCommand:e}=await import("./chunks/Z2AXUXMK.js");Se(e)(t)}).command("translate <locale>","Creates or updates translations.yaml files and fills them with missing built-in translations and translations from the redocly.yaml and sidebars.yaml files.",t=>t.env("REDOCLY_CLI_TRANSLATE").positional("locale",{description:"Locale code to generate translations for, or `all` for all current project locales.",type:"string",demandOption:!0}).options({"project-dir":{alias:"d",type:"string",description:"Specifies the project content directory. The default value is the directory where the command is executed.",default:"."},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),t=>{Se(jf)(t)}).command("eject <type> [path]","Helper function to eject project elements for customization.",t=>t.env("REDOCLY_CLI_EJECT").positional("type",{description:"Specifies what type of project element to eject. Currently this value must be `component`.",demandOption:!0,choices:["component"]}).positional("path",{description:"Filepath to a component or filepath with glob pattern.",type:"string"}).options({"project-dir":{alias:"d",type:"string",description:"Specifies the project content directory. The default value is the directory where the command is executed.",default:"."},force:{alias:"f",type:"boolean",description:'Skips the "overwrite existing" confirmation when ejecting a component that is already ejected in the destination.'},"lint-config":{description:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),t=>{Se(up)(t)}).command("respect [files...]","Run Arazzo tests.",t=>t.env("REDOCLY_CLI_RESPECT").positional("files",{describe:"Test files or glob pattern.",type:"string",array:!0,default:[]}).options({input:{alias:"i",describe:"Input parameters.",type:"string"},server:{alias:"S",describe:"Server parameters.",type:"string"},workflow:{alias:"w",describe:"Workflow name.",type:"string",array:!0},skip:{alias:"s",describe:"Workflow to skip.",type:"string",array:!0},verbose:{alias:"v",describe:"Apply verbose mode.",type:"boolean"},"har-output":{describe:"Har file output name.",type:"string",alias:"H"},"json-output":{describe:"JSON file output name.",type:"string",alias:"J"},mtls:{describe:'Per-domain mutual TLS certificates configuration as JSON. Format: {"<domain>": {"clientCert": "<path>", "clientKey": "<path>", "caCert": "<path>"}}',type:"string",array:!0,coerce:fu},severity:{describe:"Severity of the check.",type:"string"},"max-steps":{describe:"Maximum number of steps to run (default: 2000).",type:"number",default:2e3,coerce:Vr("max-steps",!0)},"max-fetch-timeout":{describe:"Maximum time to wait for API response per request in milliseconds (default: 40 seconds).",type:"number",default:4e4,coerce:Vr("max-fetch-timeout",!1)},"execution-timeout":{describe:"Maximum time to wait for the Respect execution in milliseconds (default: 1 hour).",type:"number",default:36e5,coerce:Vr("execution-timeout",!1)},"no-secrets-masking":{describe:"Do not mask secrets in the output.",type:"boolean",default:!1}}),async t=>{Se(pu)(t)}).command("generate-arazzo <descriptionPath>","Auto-generate arazzo description file from an API description.",t=>t.env("REDOCLY_CLI_GENERATE_ARAZZO").positional("descriptionPath",{describe:"Description file path.",type:"string"}).options({"output-file":{alias:"o",describe:"Output File name.",type:"string",requiresArg:!0}}),async t=>{Se(fp)(t)}).command("generate-client [api]","Generate a TypeScript client from an OpenAPI description [experimental].",t=>t.env("REDOCLY_CLI_GENERATE_CLIENT").positional("api",{describe:"OpenAPI description file path (or alias from redocly.yaml `apis:`).",type:"string"}).options({output:{alias:"o",describe:"Output file path for the generated client (must end in .ts).",type:"string",requiresArg:!0},"server-url":{describe:"Override the server URL inlined into the generated runtime. Defaults to `servers[0].url`.",type:"string",requiresArg:!0},"output-mode":{describe:"How the client is split across files: `single` (default, one file) or `split` (schema types and guards in a sibling `<name>.schemas.ts` the entry re-exports).",choices:["single","split"],requiresArg:!0},runtime:{describe:"Runtime distribution: 'inline' (default) embeds the runtime in the generated file; 'module' writes it as real files in a runtime/ folder beside the client.",choices:["inline","module"],requiresArg:!0},docs:{description:"Also write reference documentation for what this run generates: one Markdown page per selected generator that documents itself (the CLI, and each SDK).",type:"boolean"},"go-package":{description:"Package clause of the `go` generator's output (a valid Go package name). Defaults to `client`.",type:"string",requiresArg:!0},"import-ext":{describe:"Extension in generated relative imports: 'js' (default) suits tsc and bundlers; 'ts' suits runtimes that resolve specifiers literally, like Node's built-in type stripping (node client.ts).",choices:["js","ts"],requiresArg:!0},setup:{describe:"Path to a publisher setup module (a file default-exporting { config, middleware }) that gets included into the generated client \u2014 pre-configure defaults such as the server URL, retries, headers, and middleware, so a published SDK ships with them built in. Works across all output modes.",type:"string",requiresArg:!0},"args-style":{describe:"How operation inputs are passed: `flat` (default) spreads path params as positional arguments followed by `params`/`body`/`headers`; `grouped` bundles every input into a single `args` object (the per-call request `init` stays a separate trailing argument).",choices:["flat","grouped"],requiresArg:!0},"error-mode":{describe:"Error handling: 'throw' (default) throws ApiError on non-2xx; 'result' returns { data, error, response }.",choices:["throw","result"],requiresArg:!0},"date-type":{describe:"How `date-time`/`date` string fields are typed: 'string' (default) keeps the ISO wire shape; 'Date' emits a `Date` (pair with --generator transformers so the runtime value matches).",choices:["string","Date"],requiresArg:!0},"mock-data":{describe:"How the `mock` generator produces data: 'static' (default) inlines deterministic literals (zero-dep); 'faker' emits @faker-js/faker calls for realistic data (install @faker-js/faker as a dev dependency).",choices:["static","faker"],requiresArg:!0},"mock-seed":{describe:"Seed for faker-mode mocks: emits a top-level `faker.seed(<n>)` so generated data is reproducible across runs. Ignored in static mode.",type:"number",requiresArg:!0},generator:{describe:'Generator to run; repeat the flag to run several (default: typescript). Built-in: typescript, zod, tanstack-query, tanstack-query-vue, tanstack-query-svelte, tanstack-query-solid, swr, mock, transformers, cli, python, go, php \u2014 or a path/package specifier for a custom generator. What each one emits is in the "Use the generated client" guide. Example: --generator typescript --generator zod',type:"string",array:!0,requiresArg:!0},config:{describe:"Path to the config file.",type:"string",requiresArg:!0}}),async t=>{Se(wp)(t)}).command("eject-generator [generator]","Vendor a built-in client generator into your repo as an editable file [experimental].",t=>t.positional("generator",{describe:`Built-in generator to eject (${[..._r].join(", ")}).`,type:"string"}).options({config:{description:"Path to the config file.",type:"string"},dir:{describe:"Directory to eject into (default: ./generators).",type:"string",requiresArg:!0},force:{describe:"Overwrite an existing ejected file (discards local edits).",type:"boolean",default:!1},update:{describe:"Three-way merge a newer generator version into your customized copy (pristine \xD7 new \xD7 yours).",type:"boolean",default:!1}}),async t=>{Se(cp)(t)}).command("generate-spec <traffic>","Infer an OpenAPI description from recorded HTTP traffic, optionally refined with AI [experimental].",t=>t.env("REDOCLY_CLI_GENERATE_SPEC").positional("traffic",{describe:"Path to a traffic log file or folder (HAR, Kong, Nginx/Apache JSON, NDJSON).",type:"string"}).option({type:{describe:"Target API description type.",choices:["openapi"],default:"openapi"},"traffic-format":{describe:"Traffic input format.",choices:["auto","har","kong","nginx-json","apache-json","ndjson"],default:"auto"},server:{describe:"Server URL the traffic was captured against: only requests under it are considered, the rest of their URL becomes the API path, and it becomes the servers URL of the generated description.",type:"string"},title:{describe:"Title for the generated API description.",type:"string"},"with-ai":{describe:"Refine the inferred description with an AI provider to narrow the hypothesis.",type:"boolean",default:!1},"ai-provider":{describe:'AI provider used with --with-ai; runs the "claude", "codex", or "cursor" CLI in non-interactive mode.',choices:["claude","codex","cursor"],default:"claude"},"ai-model":{describe:"Model passed to the selected AI provider (provider-specific default applies).",type:"string"},"ai-concurrency":{describe:"Number of operations refined in parallel with --with-ai.",type:"number",default:4,coerce:Vr("ai-concurrency",!0)},output:{alias:"o",describe:"Write the generated description to this file instead of stdout.",type:"string"},config:{describe:"Path to the config file.",type:"string"}}),async t=>{let{handleGenerateSpec:e}=await import("./chunks/AJZAID3R.js");Se(e)(t)}).command("scorecard-classic [api]","Run quality scorecards with multiple rule levels to validate and maintain API description standards.",t=>t.positional("api",{type:"string"}).option({config:{describe:"Path to the config file.",type:"string"},"project-url":{describe:"URL to the project scorecard configuration.",type:"string"},format:{description:"Use a specific output format.",choices:["stylish","json","checkstyle","junit"],default:"stylish"},"target-level":{describe:"Target level for the scorecard.",type:"string"},verbose:{alias:"v",describe:"Apply verbose mode.",type:"boolean"}}),async t=>{Se(Yu)(t)}).command("drift <traffic>","Detect drift between recorded HTTP traffic and an OpenAPI description [experimental].",t=>t.env("REDOCLY_CLI_DRIFT").positional("traffic",{describe:"Path to a traffic log file or folder (HAR, Kong, Nginx/Apache JSON, NDJSON).",type:"string"}).option({api:{describe:"OpenAPI description file or folder to validate against.",type:"string",demandOption:!0},"traffic-format":{describe:"Traffic input format.",choices:["auto","har","kong","nginx-json","apache-json","ndjson"],default:"auto"},"report-format":{describe:"Output format.",alias:"format",choices:["pretty","json","csv","sarif"],default:"pretty"},"match-mode":{describe:"Endpoint matching mode (how requests are located via the description servers). Mutually exclusive with --server.",choices:["strict-host","basepath"],defaultDescription:"strict-host"},"ignore-cookies":{describe:"Ignore cookie-based checks (useful for logs exported without cookies).",type:"boolean",default:!1},"ignore-headers":{describe:'Comma-separated header names to skip in undocumented-header checks. A trailing "*" matches by prefix, e.g. "x-consumer-*".',type:"string"},"max-findings":{describe:"Maximum findings shown in pretty output.",type:"number",default:10},"min-severity":{describe:"Discard findings below this severity from the report.",choices:["info","warning","error"],default:"info"},rules:{describe:"Comma-separated builtin rules to run.",type:"string"},output:{alias:"o",describe:"Write the drift report (in the format selected with --format) to this file instead of stdout.",type:"string"},server:{describe:"Server URL the traffic was captured against: only requests under it are considered, and the rest of their URL is treated as the API path. It replaces the description servers and the remaining path is matched against the description paths directly. Mutually exclusive with --match-mode.",type:"string"},config:{describe:"Path to the config file.",type:"string"},"lint-config":{describe:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),async t=>{let{handleDrift:e}=await import("./chunks/GJRJZYC4.js");Se(e)(t)}).command("proxy","Capture live HTTP traffic through a reverse proxy into a HAR file, optionally validating it against an OpenAPI description [experimental].",t=>t.env("REDOCLY_CLI_PROXY").option({target:{describe:"Upstream base URL to forward captured requests to.",type:"string",demandOption:!0},port:{describe:"Port the proxy listens on.",type:"number",default:4040},host:{describe:"Host the proxy binds to.",type:"string",default:"127.0.0.1"},har:{describe:"Path to the HAR file where captured traffic is written.",type:"string",demandOption:!0},api:{describe:"OpenAPI description file or folder to validate captured traffic against (live).",type:"string"},"report-format":{describe:"Output format for the validation report printed on shutdown.",alias:"format",choices:["pretty","json","csv","sarif"],default:"pretty"},"match-mode":{describe:"Endpoint matching mode.",choices:["strict-host","basepath"],default:"strict-host"},"ignore-cookies":{describe:"Ignore cookie-based checks.",type:"boolean",default:!1},"ignore-headers":{describe:'Comma-separated header names to skip in undocumented-header checks. A trailing "*" matches by prefix, e.g. "x-consumer-*".',type:"string"},"max-findings":{describe:"Maximum findings shown in pretty output.",type:"number",default:10},rules:{describe:"Comma-separated builtin rules to run.",type:"string"},config:{describe:"Path to the config file.",type:"string"},"lint-config":{describe:"Severity level for config file linting.",choices:["warn","error","off"],default:"warn"}}),async t=>{let{handleProxy:e}=await import("./chunks/2GJPOM5H.js");Se(e)(t)}).completion("completion","Generate autocomplete script for `redocly` command.").demandCommand(1).middleware([kf]).strict().argv;
|
|
286
365
|
/*! Bundled license information:
|
|
287
366
|
|
|
288
367
|
cookie/index.js:
|