@microsoft/managed-apps-cli 0.21.0 → 0.23.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/README.md +3 -1
- package/dist/AddConfig-GZO2UMFR.js +12 -0
- package/dist/AddConnector-HJCCENAM.js +23 -0
- package/dist/{AuthStatus-ZZIP3LBD.js → AuthStatus-WCICFN6O.js} +2 -2
- package/dist/{AuthSwitch-HK7JU2FR.js → AuthSwitch-5PKHCTM2.js} +2 -2
- package/dist/Bin.js +1 -1
- package/dist/BuildMaafApp-Q74EFM3Q.js +11 -0
- package/dist/Cli-7EVTIORX.js +54 -0
- package/dist/CloneMaafApp-EKHHLMWD.js +11 -0
- package/dist/CreateMaafApp-L3XX2UVT.js +20 -0
- package/dist/DeleteMaafApp-YCDKWFRG.js +11 -0
- package/dist/DeployMaafApp-HF67BQRZ.js +14 -0
- package/dist/{Dev-SHIA5S7X.js → Dev-BTJUJGP5.js} +2 -2
- package/dist/{EnvironmentVariableAuthenticationProvider-5YTMRAE4.js → EnvironmentVariableAuthenticationProvider-VNN4AG2E.js} +2 -2
- package/dist/GetMaafBuildStatus-7B6ZNSEA.js +11 -0
- package/dist/{GetSettings-NM6H2U5F.js → GetSettings-GJWIPK2T.js} +2 -2
- package/dist/InfoMaafApp-WGNDYYGN.js +13 -0
- package/dist/Init-TJOSV5DE.js +11 -0
- package/dist/ListConnectorActions-HTD6YSCY.js +11 -0
- package/dist/ListConnectors-OET7STMW.js +11 -0
- package/dist/{ListMaafApps-RT3PGZSJ.js → ListMaafApps-KRXJMAEU.js} +2 -2
- package/dist/{Login-HG5S7LBC.js → Login-5TFNB24B.js} +2 -2
- package/dist/{Logout-BUPHLOAH.js → Logout-35U4J627.js} +2 -2
- package/dist/{MockFetch-4CYTSNJ7.js → MockFetch-XSZECQYX.js} +2 -2
- package/dist/{NodeMsalAuthenticationProvider-HTH3V3G2.js → NodeMsalAuthenticationProvider-OUL57BVL.js} +2 -2
- package/dist/Pack-S7P4MIT6.js +8 -0
- package/dist/PlayMaafApp-D4KLJKLT.js +12 -0
- package/dist/RefreshDataSource-N5CEH23S.js +11 -0
- package/dist/{RefreshGitAuth-5A3SX2HC.js → RefreshGitAuth-2VL6VBLU.js} +2 -2
- package/dist/{RemoveDataSource-57JJLK5I.js → RemoveDataSource-XR5Q4O3F.js} +2 -2
- package/dist/{ServicePrincipalAuthenticationProvider-SVKDZG6X.js → ServicePrincipalAuthenticationProvider-H3PTPXYY.js} +2 -2
- package/dist/{SetSetting-RB3F7IXG.js → SetSetting-HXY4YSKC.js} +2 -2
- package/dist/{ShareLinkCreate-7BCDPWY6.js → ShareLinkCreate-YG3DACP2.js} +2 -2
- package/dist/{ShareLinkList-4BI3WMNN.js → ShareLinkList-XF6BIB3M.js} +2 -2
- package/dist/ShareLinkRevoke-4USAQKLB.js +11 -0
- package/dist/ShareList-6QI7ZAMZ.js +11 -0
- package/dist/{ShareMaafApp-QFRXLYUD.js → ShareMaafApp-PZI5MCBA.js} +2 -2
- package/dist/{TelemetrySettings-A474HALH.js → TelemetrySettings-WWVPRF7T.js} +2 -2
- package/dist/{UnshareMaafApp-423RNXCN.js → UnshareMaafApp-MHBIV5OR.js} +2 -2
- package/dist/chunk-2FNWZUPW.js +15 -0
- package/dist/chunk-2HSJ2XAQ.js +13 -0
- package/dist/{chunk-U36HMOQW.js → chunk-3FP37TPE.js} +10 -10
- package/dist/chunk-5XRK3F43.js +11 -0
- package/dist/{chunk-EV3TTTOT.js → chunk-7PH2NK5K.js} +2 -2
- package/dist/chunk-DAG6RPOF.js +11 -0
- package/dist/{chunk-5AUOEXAR.js → chunk-DD7E4ADI.js} +2 -2
- package/dist/chunk-F3HGM3IU.js +106 -0
- package/dist/chunk-FMJDKXNM.js +12 -0
- package/dist/chunk-HCPTQP7J.js +11 -0
- package/dist/chunk-I22E6YZT.js +11 -0
- package/dist/chunk-LDP2SHPJ.js +11 -0
- package/dist/{chunk-3BRAT6NP.js → chunk-PKDXP7CL.js} +2 -2
- package/dist/chunk-SBVJ4SMO.js +20 -0
- package/dist/chunk-SCJXITCN.js +12 -0
- package/dist/chunk-TZRZFNLH.js +38 -0
- package/dist/{chunk-G33Q5FWT.js → chunk-UIW77LMA.js} +234 -234
- package/dist/chunk-WQKDXHGX.js +11 -0
- package/dist/{chunk-MFPX2RFH.js → chunk-X5O77GZS.js} +2 -2
- package/dist/{chunk-7NXJAIJX.js → chunk-Y7TZZLPW.js} +2 -2
- package/dist/chunk-ZIONKKAV.js +44 -0
- package/package.json +4 -4
- package/dist/AddConnector-4AMM746J.js +0 -41
- package/dist/BuildMaafApp-MOTZOLJZ.js +0 -11
- package/dist/Cli-6CCXMCPX.js +0 -54
- package/dist/CreateMaafApp-TUO72CW7.js +0 -20
- package/dist/DeleteMaafApp-MZVGIAX3.js +0 -11
- package/dist/DeployMaafApp-KXATM3E3.js +0 -14
- package/dist/GetMaafApp-ELB5KMHW.js +0 -11
- package/dist/GetMaafBuildStatus-3W7LI5TJ.js +0 -11
- package/dist/Init-CH5DUQWA.js +0 -11
- package/dist/ListConnectorActions-7SIFGPYR.js +0 -11
- package/dist/ListConnectors-TRKIWRVQ.js +0 -11
- package/dist/Pack-AHKC2MYF.js +0 -8
- package/dist/PlayMaafApp-LWKJU2IN.js +0 -12
- package/dist/RefreshDataSource-ZFZJXJ5L.js +0 -11
- package/dist/ShareLinkRevoke-EEJVCRCY.js +0 -11
- package/dist/ShareList-LJDAEGI3.js +0 -11
- package/dist/ShowMaafApp-3KK6NUG2.js +0 -11
- package/dist/chunk-6FFQN2SO.js +0 -13
- package/dist/chunk-6MXOK2LG.js +0 -11
- package/dist/chunk-DREO7EYO.js +0 -20
- package/dist/chunk-NP2KJOYC.js +0 -12
- package/dist/chunk-QAFCXGBD.js +0 -11
- package/dist/chunk-QSB5P4RM.js +0 -38
- package/dist/chunk-S5HEU7XK.js +0 -11
- package/dist/chunk-UBTSW22U.js +0 -11
- package/dist/chunk-VFSTQAZ2.js +0 -12
- package/dist/chunk-VNEZZ3RI.js +0 -11
- package/dist/chunk-W7EWOZPO.js +0 -104
- package/dist/chunk-YIKNM523.js +0 -15
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __pathDirname(__filename);
|
|
7
|
+
import{a as E}from"./chunk-TYRVM4PP.js";import{c}from"./chunk-SBVJ4SMO.js";import{g as m}from"./chunk-UIW77LMA.js";import{b as g,c as y,d as p,e as h}from"./chunk-RBG2H562.js";import{a as i}from"./chunk-7PH2NK5K.js";import{i as d}from"./chunk-PVAIJSAI.js";import{j as C}from"./chunk-3FP37TPE.js";import{d as v}from"./chunk-UT667QSU.js";function T(e){if(e.body)try{let n=JSON.parse(e.body);if(typeof n?.error?.message=="string"&&n.error.message.trim())return n.error.message}catch{}}var w=new Set(["ENOTFOUND","EAI_AGAIN","ECONNREFUSED","ETIMEDOUT","ECONNRESET","ConnectionRefused","ConnectionClosed","FailedToOpenSocket"]);function b(e){if(!(e instanceof Error)||e instanceof m)return!1;let n=e.code;return typeof n=="string"&&w.has(n)||w.has(e.name)}function G(e,n){let{environmentId:t}=n;if(b(e))return new h(`Could not reach environment ${t}. Its endpoint did not resolve or did not respond, which usually means the environment id is wrong or the environment does not exist in this cloud \u2014 verify the id and the --cloud value. If the id is correct, check your network connection, VPN, or proxy.`,{underlyingError:e.message,environmentId:t});if(!(e instanceof m))return null;let r=T(e),o=n.repoType==="native",a="Ask an admin to grant you the required permission in this environment.";if(e.status===401)return new y(r??"Your sign-in session has expired or is invalid. Run `ms auth login` and try again.");if(e.status===403){let f=r??(o?`You do not have permission to create repositories in environment ${t}.`:`You do not have permission to create an app in environment ${t}.`);return new y(`${f} ${a}`)}return e.status===404?new g(r??`Environment ${t} was not found. Verify the environment id and that you have access to it.`):e.status===409?new g(r??`An app with the same name already exists in environment ${t}. Choose a different name.`):e.status===429||e.status===503?new h(r??"The service is temporarily unavailable or rate-limited. Wait a moment and try again."):null}var u=v(E(),1);function j(){let e=c(["--version"],{captureStdout:!0,allowFailure:!0,emitStderr:!1});if(!e.success)throw new p("'git' is required but was not found on PATH.");let n=e.stdout,t=i.engines.git;if(!u.default.validRange(t))return;let r=u.default.coerce(n);if(r&&!u.default.satisfies(r,t))throw new p(`Git ${t} is required (found ${r.version}). Please upgrade git.`)}function F(){let e=c(["credential-manager","--version"],{captureStdout:!0,allowFailure:!0,emitStderr:!1});if(!(e.success?e:c(["credential-manager-core","--version"],{captureStdout:!0,allowFailure:!0,emitStderr:!1})).success)throw new p("Git Credential Manager is required for the native app flow but was not found. Install Git Credential Manager, then run `git-credential-manager configure` and retry.");let t=c(["config","--get-all","credential.helper"],{captureStdout:!0,allowFailure:!0,emitStderr:!1});if(!(t.success?t.stdout.split(/\r?\n/).some(o=>/(?:^|[\\/])git-credential-manager(?:-core)?(?:\.exe)?(?:["']|\s|$)/i.test(o.trim())||/^(?:manager|manager-core)$/i.test(o.trim())):!1))throw new p("Git Credential Manager is installed but not configured as a Git credential helper. Run `git-credential-manager configure` and retry.")}function J(e){let n={version:C,appId:e.appId,appDisplayName:e.appDisplayName,environmentId:e.environmentId,description:e.description,repoType:e.repoType,cloud:e.cloud,buildPath:e.buildPath??"./dist",buildCommand:e.buildCommand??"npm run build",buildEntryPoint:e.buildEntryPoint??"index.html"};return e.repositoryId&&(n.repositoryId=e.repositoryId),e.externalRepoUrl&&(n.externalRepoUrl=e.externalRepoUrl),e.iconPath&&(n.iconPath=e.iconPath),e.localAppUrl&&(n.localAppUrl=e.localAppUrl),e.connectionReferences!==void 0&&(n.connectionReferences=e.connectionReferences),e.appSettings!==void 0&&(n.appSettings=e.appSettings),n}import*as s from"fs";import*as S from"path";var l=v(E(),1);var A="https://registry.npmjs.org",N=5e3;async function I(e,n=i.version){if(!l.default.valid(n))return;if(l.default.prerelease(n)===null)return n;let t=await $(e);return t?`^${t}`:void 0}async function $(e){try{let{data:n}=await e.get(`${A}/${i.name}/latest`,{headers:{"user-agent":`${i.name}/${i.version}`},signal:AbortSignal.timeout(N)});return typeof n?.version=="string"&&l.default.valid(n.version)?n.version:void 0}catch{return}}async function Q(e,n,t){let r=S.join(e,"package.json");if(!s.existsSync(r))return;let o=await I(t);if(!o){n||d(`Skipping the project-local CLI pin: '${i.version}' is not a published release and no published version could be resolved. Install '${i.name}' into the project manually if you want a project-local CLI.`);return}!n&&o!==i.version&&d(`'${i.version}' is a prerelease build; pinning the latest published CLI ('${o}') into the app instead.`);try{let a=JSON.parse(s.readFileSync(r,"utf8"));a.devDependencies=Object.fromEntries(Object.entries({...a.devDependencies,[i.name]:o}).sort(([f],[R])=>f.localeCompare(R,"en"))),s.writeFileSync(r,`${JSON.stringify(a,null,2)}
|
|
8
|
+
`)}catch(a){n||d(`Could not pin '${i.name}' into ${r} (${a instanceof Error?a.message:String(a)}). Add "${i.name}": "${o}" to devDependencies manually.`)}}var O="none",P="native",x=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Z(e){return x.test(e.trim())}function ee(e){if(e===void 0||e==="")return{repoType:"native",remoteUrl:void 0};let n=e.trim();return n.toLowerCase()===P?{repoType:"native",remoteUrl:void 0}:n.toLowerCase()===O?{repoType:"none",remoteUrl:void 0}:{repoType:"github",remoteUrl:n}}export{G as a,j as b,F as c,J as d,Q as e,Z as f,ee as g};
|
|
9
|
+
/*!
|
|
10
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
11
|
+
*/
|
|
12
|
+
//# sourceMappingURL=chunk-FMJDKXNM.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __pathDirname(__filename);
|
|
7
|
+
import{N as a,Q as i,g as o}from"./chunk-UIW77LMA.js";import{a as s,b as u,c,d as l,e as d}from"./chunk-RBG2H562.js";var g=["GitHubMappingMissing","GitHubMappingExpired","GitHubMappingStale"];function E(e){return typeof e=="string"&&g.includes(e)}function m(e){let n=e.code;if(!n)return null;let t=e.message;if(!t||!t.trim())return null;switch(n){case"GitHubMappingMissing":case"GitHubMappingExpired":case"GitHubMappingStale":case"GitHubUserLacksAccess":case"GitHubUserLacksRequiredLevel":case"GitHubAuthSessionExpired":case"GitHubAuthSessionNotFound":case"GitHubAuthDenied":case"GitHubAuthCancelled":return new c(t);case"GitHubAppNotInstalled":case"GitHubInstallationSuspended":return new l(t);case"GitHubRateLimited":case"GitHubEvaluationError":case"GitHubUpstreamError":return new d(t);case"GitHubRepoArchived":case"GitHubRepoNotEnterprise":case"GitHubRepoNotFound":return new u(t);case"OperationNotFound":return new s(t);default:return null}}function v(e){if(e instanceof s)return null;let n=f(e);return n?m(n):null}function S(e){let n=f(e);if(!n)return null;let t=n.code;return!E(t)||!(e instanceof i||e instanceof a)&&n.httpStatus!==401?null:{code:t,payload:n}}function f(e){if(e instanceof a)return{code:e.code,message:e.message,details:e.details};if(e instanceof i)return{code:e.code,message:e.message,httpStatus:e.status,details:e.details};if(e instanceof o){let n=p(e.body);return n?{code:n.code,message:n.message??"",httpStatus:e.status,details:n.details}:null}if(e instanceof Error){let n=e.message.match(/\{[\s\S]*\}/);if(!n)return null;let t=p(n[0]);if(!t?.code)return null;let r=e.message.match(/status:\s*(\d+)/i);return{code:t.code,message:t.message??"",httpStatus:r?Number(r[1]):void 0,details:t.details}}return null}function p(e){if(!e)return null;try{let t=JSON.parse(e)?.error;return!t||typeof t!="object"?null:{code:typeof t.code=="string"?t.code:void 0,message:typeof t.message=="string"?t.message:void 0,details:t.details}}catch{return null}}export{m as a,v as b,S as c};
|
|
8
|
+
/*!
|
|
9
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
10
|
+
*/
|
|
11
|
+
//# sourceMappingURL=chunk-HCPTQP7J.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __pathDirname(__filename);
|
|
7
|
+
import{a as f}from"./chunk-OL6CTXQR.js";import{Ga as p,ga as c}from"./chunk-UIW77LMA.js";import{a as l}from"./chunk-RBG2H562.js";import{h as m}from"./chunk-PVAIJSAI.js";var b=1e3;function w(t){if(typeof t=="string"){let r=t.trim();return r?{errorMessage:r}:{}}if(!t||typeof t!="object")return{};let e=t,a=typeof e.code=="string"&&e.code.trim()?e.code.trim():void 0;if(typeof e.error=="string"){let r=e.error.trim(),n=g(a,r||void 0);return n?{errorMessage:n}:{}}let d,i,o;if(e.error&&typeof e.error=="object"){let r=e.error.code,n=e.error.message,u=e.error.buildOutput;d=typeof r=="string"&&r.trim()?r.trim():void 0,i=typeof n=="string"&&n.trim()?n.trim():void 0,o=typeof u=="string"&&u.trim()?u.trim():void 0}!i&&typeof e.message=="string"&&e.message.trim()&&(i=e.message.trim()),!o&&typeof e.buildOutput=="string"&&e.buildOutput.trim()&&(o=e.buildOutput.trim());let s=g(d??a,i);return s||o?{errorMessage:s,buildOutput:o}:{}}async function L(t){let e=p(),a=b,d=t.maxIntervalMs??1/0,i=Math.min(d,Math.max(a,t.initialWaitMs)),o=t.deadlineMs!=null?Date.now()+t.deadlineMs:null,s=!t.isJsonMode&&process.stdout.isTTY?new f:null;s?.start(t.spinnerLabel??"Waiting for build status...");try{for(;;){if(o!==null&&Date.now()>=o)throw new l(`Build did not complete within ${Math.round(t.deadlineMs/6e4)} minutes. Commit SHA: ${t.commitSha}.`);await S(i);let r=await c({logger:e,actionsParams:{appName:t.appName,commitSha:t.commitSha}});switch(r.status){case"Succeeded":return r;case"Failed":case"Canceled":{s?.stop();let n=w(r.result);!t.isJsonMode&&n.buildOutput&&m(n.buildOutput);let u=n.errorMessage??"",M=u?`Build ${r.status.toLowerCase()}: ${u}.`:`Build ${r.status.toLowerCase()}.`;throw new l(M+(t.commitSha?` Commit SHA: ${t.commitSha}.`:""))}case"NotStarted":case"Running":{let n=r.retryAfterMs??i;i=Math.min(d,Math.max(a,n));break}default:return y(r.status)}}}finally{s?.stop()}}function y(t){throw new l(`Unexpected build status from server: ${String(t)}.`)}function g(t,e){return t&&e?`${t}: ${e}`:t??e}function S(t){return new Promise(e=>setTimeout(e,t))}export{w as a,L as b};
|
|
8
|
+
/*!
|
|
9
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
10
|
+
*/
|
|
11
|
+
//# sourceMappingURL=chunk-I22E6YZT.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __pathDirname(__filename);
|
|
7
|
+
import{a as e}from"./chunk-7PH2NK5K.js";import{b as t,c as s}from"./chunk-Y7TZZLPW.js";import*as r from"os";import*as o from"path";var n=t("WORKING_DIRECTORY")??process.cwd(),E=t("CONFIG_DIR")??o.join(r.homedir(),".ms-cli"),p=o.join(E,"cache","auth"),a=o.join(E,"telemetry"),I="microsoft-managed-apps-cli",C="msal-token-cache",R="x-ms-client-request-id",T="x-ms-client-session-id",i="x-ms-target-url",m="x-ms-auth-resource",x="x-ms-body-token-resource",N="userSettings.json",S=`managed-apps-cli/${e.version}`,O=s("USE_MMA_APP_ID")?"c4ee713f-aede-4371-91fc-921aa3a5ded9":"9cee029c-6210-4654-90bb-17e6e9d36617",A="managedappscli";export{n as a,E as b,p as c,a as d,I as e,C as f,R as g,T as h,i,m as j,x as k,N as l,S as m,O as n,A as o};
|
|
8
|
+
/*!
|
|
9
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
10
|
+
*/
|
|
11
|
+
//# sourceMappingURL=chunk-LDP2SHPJ.js.map
|
|
@@ -4,8 +4,8 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a as U,b as y,c as b}from"./chunk-
|
|
7
|
+
import{a as U,b as y,c as b}from"./chunk-HCPTQP7J.js";import{a as h,b as E}from"./chunk-X5O77GZS.js";import{Ca as H,Da as G,Ga as x,c as g}from"./chunk-UIW77LMA.js";import{c as D}from"./chunk-RBG2H562.js";import{h as d}from"./chunk-PVAIJSAI.js";async function T(r){let{remoteUrl:c,tenantId:l,jsonMode:p,openBrowser:s,verb:f}=r,{host:t,owner:i,repo:n}=g(c),o=i&&n?H(i,n):"",v=t&&i&&n?`https://${t}/${i}/${n}`:c,e=x(),a=M(f);e.trackActivityEvent(a,{repoHost:t,repoHash:o}),p||d("GitHub authentication is required for this action.");let u=I({isJson:p,openBrowser:s}),m=new AbortController,R=()=>{m.abort()};process.once("SIGINT",R);try{await G({remoteUrl:v,tenantId:l,logger:e,display:u,skipBrowser:!1,signal:m.signal})}catch(w){throw e.trackActivityEvent(`${a}.Failed`,{repoHost:t,repoHash:o}),y(w)??w}finally{process.removeListener("SIGINT",R)}e.trackActivityEvent(`${a}.Complete`,{repoHost:t,repoHash:o}),p||d(A(f))}function A(r){switch(r){case"app create":return"Resuming create...";case"app init":return"Resuming init...";case"app build":return"Resuming build...";case"app deploy":return"Resuming deploy..."}}function I(r){return r.isJson?new E:r.openBrowser?h:{...h,openVerificationUri:void 0}}function M(r){switch(r){case"app create":return"Maaf.Create.GitHubDcfRecovery";case"app init":return"Maaf.Init.GitHubDcfRecovery";case"app build":return"Maaf.Build.GitHubDcfRecovery";case"app deploy":return"Maaf.Deploy.GitHubDcfRecovery"}}async function F(r,c,l=T){let{repoType:p,externalRepoUrl:s,tenantId:f,jsonMode:t,openBrowser:i,verb:n}=c;try{return await r({isRetry:!1})}catch(o){if(p!=="github")throw o;if(!b(o)){let e=y(o);throw e||o}if(!s)throw new D(`GitHub authentication is required, but the app config does not record the external repository URL needed to recover the identity mapping. This app may have been created before the URL was persisted to \`ms.config.json\`. Either add \`externalRepoUrl: "<your repo url>"\` to \`ms.config.json\`, or recreate the app with \`ms app create --repo <your repo url>\`, then run \`ms ${n}\` again.`);await l({remoteUrl:s,tenantId:f,jsonMode:t,openBrowser:i,verb:n});try{return await r({isRetry:!0})}catch(e){let a=b(e);if(a)throw U(a.payload)??e;let u=y(e);throw u||e}}}export{F as a};
|
|
8
8
|
/*!
|
|
9
9
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
10
10
|
*/
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-PKDXP7CL.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __pathDirname(__filename);
|
|
7
|
+
import{c as S,d as x,e as v}from"./chunk-RBG2H562.js";import{n as O}from"./chunk-LDP2SHPJ.js";import{d as I,f as N}from"./chunk-Y7TZZLPW.js";import{h as C}from"./chunk-PVAIJSAI.js";function b(t){try{return new URL(t).host}catch{return t}}function q(t,e,i){e||C(`Authenticating to ${b(t)} for ${i}. A browser window may open. Sign in with the account associated with this tenant.`)}import{execFileSync as A}from"child_process";var D=[{patterns:[/403 forbidden/i,/returned error: 403/i,/access denied/i],bucket:"auth-403",build:t=>`Git reached the remote but access was denied while ${t} (HTTP 403). This usually means one of:
|
|
8
|
+
- the signed-in account is in the wrong tenant, or lacks permission to this app's repo; or
|
|
9
|
+
- Git Credential Manager returned a cached credential for a different account than your current 'ms auth' sign-in (a stale or mismatched credential).
|
|
10
|
+
Confirm 'ms auth status' shows the account and tenant for this environment. If it doesn't match, clear the cached git credential for the host ('git credential-manager erase', or remove it from your OS credential store) so Git re-prompts, then re-run.`},{patterns:[/terminal prompts disabled/i,/could not read username/i,/could not read password/i],bucket:"auth-prompt-unavailable",build:t=>`Git could not obtain a credential while ${t}: there is no cached credential and the session can't prompt for one. Make sure Git Credential Manager is installed, then re-run in an interactive terminal so the browser sign-in can complete.`},{patterns:[/authentication failed/i,/invalid username or password/i],bucket:"auth-invalid-credential",build:t=>`Git authentication failed while ${t}: the credential was missing, invalid, or expired. When the browser opens, sign in with the account for this environment's tenant; if a stale credential is cached, clear it in Git Credential Manager and re-run.`}],F=[/could not resolve host/i,/could not resolve proxy/i,/failed to connect/i,/connection timed out/i,/connection refused/i,/network is unreachable/i,/temporary failure in name resolution/i];function U(t){return t.replace(/(\b[a-z][a-z0-9+.-]*:\/\/)[^/\s@]+@/gi,"$1[REDACTED]@")}function $(t,e){let i=U(t.trimEnd());if(!i)return null;for(let r of D)if(r.patterns.some(n=>n.test(i)))return new S(`${r.build(e.action)}
|
|
11
|
+
|
|
12
|
+
Git output:
|
|
13
|
+
${i}`,{classifierBucket:r.bucket,action:e.action});return F.some(r=>r.test(i))?new v(`Git could not reach the remote while ${e.action}. Check your network connection (and proxy settings, if any) and try again.
|
|
14
|
+
|
|
15
|
+
Git output:
|
|
16
|
+
${i}`,{classifierBucket:"network",action:e.action}):null}function m(t){return t==null?"":Buffer.isBuffer(t)?t.toString():t}var B=64*1024*1024,y=[2,31,0];function z(){try{let e=A("git",["--version"],{stdio:["ignore","pipe","ignore"],encoding:"utf8"}).match(/git version (\d+)\.(\d+)(?:\.(\d+))?/);if(!e)return!0;let i=[Number(e[1]),Number(e[2]),Number(e[3]??0)];for(let r=0;r<y.length;r++)if(i[r]!==y[r])return i[r]>y[r];return!0}catch{return!0}}function M(t,e){let i=e?.filter(s=>s.length>0);if(!i?.length)return{args:[...t]};if(!z())return{args:[...i.flatMap(s=>["-c",`http.extraHeader=${s}`]),...t]};let r=Number(I("GIT_CONFIG_COUNT")??"0");if(!Number.isSafeInteger(r)||r<0)throw new Error("GIT_CONFIG_COUNT must be a non-negative integer.");let n=N();for(let[s,a]of i.entries()){let o=r+s;n[`GIT_CONFIG_KEY_${o}`]="http.extraHeader",n[`GIT_CONFIG_VALUE_${o}`]=a}return n.GIT_CONFIG_COUNT=String(r+i.length),{args:[...t],env:n}}function f(t,e={}){let{cwd:i,allowFailure:r=!1,captureStdout:n=!1,emitStderr:s=!0,classify:a,network:o=!1,httpExtraHeaders:c}=e,d=o&&!a&&!r,l=M(t,c);try{let u=A("git",l.args,{cwd:i,stdio:["ignore",n?"pipe":"ignore",d?"inherit":"pipe"],maxBuffer:B,env:l.env});return{success:!0,status:0,stdout:n?m(u):"",stderr:""}}catch(u){let g=u,h=m(g.stderr);if(a&&!r){let H=h||m(g.stdout)||(u instanceof Error?u.message:String(u)),R=$(H,a);if(R)throw R}if(s&&h&&process.stderr.write(h),!r)throw u;return{success:!1,status:typeof g.status=="number"?g.status:null,stdout:m(g.stdout),stderr:h,error:u instanceof Error?u:new Error(String(u))}}}import{execFileSync as p}from"child_process";import*as G from"fs";import*as k from"path";function T({gitUrl:t,loginAuthority:e,authResource:i,platform:r=process.platform}){let n;try{n=new URL(t)}catch(d){throw new Error(`Git credential helper setup requires a valid HTTPS remote URL: ${d instanceof Error?d.message:String(d)}`)}if(n.protocol!=="https:")throw new Error(`Git credential helper setup requires an HTTPS remote URL, got '${n.protocol}'.`);let s=n.host,a=`${e}/oauth2/v2.0`,o=`credential.https://${s}`,c=[[`${o}.oauthAuthorizeEndpoint`,`${a}/authorize?prompt=select_account`],[`${o}.oauthTokenEndpoint`,`${a}/token`],[`${o}.oauthDeviceEndpoint`,`${a}/devicecode`],[`${o}.oauthClientId`,O],[`${o}.oauthScopes`,`${i}/.default offline_access`],[`${o}.oauthRedirectUri`,"http://localhost"]];return r==="win32"&&c.push([`${o}.credentialStore`,"dpapi"]),c}function ut(){let t=f(["rev-parse","HEAD"],{captureStdout:!0,allowFailure:!0,emitStderr:!1});if(!t.success)return null;let e=f(["rev-parse","--abbrev-ref","HEAD"],{captureStdout:!0,allowFailure:!0,emitStderr:!1});if(!e.success)return null;let i=t.stdout.trim(),r=e.stdout.trim();return{branch:r,commitSha:i,detached:r==="HEAD"}}function lt(){let t=f(["config","--get","remote.origin.url"],{captureStdout:!0,allowFailure:!0,emitStderr:!1});if(t.success)return t.stdout.trim()||void 0}var P=["https://","ssh://","git@"];function V(t){return P.some(e=>t.startsWith(e))&&t.trim()===t&&!t.startsWith("-")&&!/[\r\n\0]/.test(t)}function E(t){return t.replace(/:\/\/[^\s/]+@/g,"://[REDACTED]@")}function ft(t,e=process.cwd()){try{return t!==void 0&&!V(t)?{success:!1,error:"Unsafe git remote URL."}:(w({remoteUrl:t,cwd:e}),{success:!0})}catch(i){return{success:!1,error:E(i instanceof Error?i.message:String(i))}}}function W({directory:t,gitUrl:e,loginAuthority:i,authResource:r}){let n=_({gitUrl:e,loginAuthority:i,authResource:r});w({remoteUrl:e,cwd:t,createDirectory:!0,initialBranch:"main",localConfig:n,updateExistingRemote:!0,emitRemoteError:!0,skipInitIfRepoExists:!0})}function dt({directory:t,gitUrl:e,loginAuthority:i,authResource:r,onProgress:n}){let s=_({gitUrl:e,loginAuthority:i,authResource:r}),a=s.flatMap(([o,c])=>["-c",`${o}=${c}`]);n?.("Cloning platform-managed repository..."),f([...a,"-c","http.sslVersion=tlsv1.3","clone",e,t],{network:!0,classify:{action:`cloning from ${b(e)}`}}),n?.("Saving Git Credential Manager configuration...");try{return w({cwd:t,localConfig:s,skipInitIfRepoExists:!0}),{configPersisted:!0}}catch(o){return{configPersisted:!1,configError:E(o instanceof Error?o.message:String(o))}}}function gt(t){try{return W(t),{success:!0}}catch(e){return{success:!1,error:E(e instanceof Error?e.message:String(e))}}}function _({gitUrl:t,loginAuthority:e,authResource:i}){try{return T({gitUrl:t,loginAuthority:e,authResource:i})}catch(r){throw new x(`Git credential helper setup failed: ${r instanceof Error?r.message:String(r)}`)}}function w({remoteUrl:t,cwd:e,createDirectory:i=!1,initialBranch:r,localConfig:n=[],updateExistingRemote:s=!1,emitRemoteError:a=!1,skipInitIfRepoExists:o=!1}){i&&G.mkdirSync(e,{recursive:!0});let c={stdio:"pipe",windowsHide:!0,cwd:e};o&&G.existsSync(k.join(e,".git"))||(p("git",["init"],c),r&&p("git",["symbolic-ref","HEAD",`refs/heads/${r}`],c));for(let[l,u]of n)p("git",["config","--local",l,u],c);if(t)try{p("git",["remote","add","origin",t],c)}catch(l){if(!s||!L(l).includes("already exists"))throw a&&process.stderr.write(E(L(l))),l;p("git",["remote","set-url","origin",t],c)}}function L(t){return typeof t=="object"&&t!==null&&"stderr"in t&&Buffer.isBuffer(t.stderr)?t.stderr.toString():""}function j(){let t=f(["status","--porcelain"],{captureStdout:!0,allowFailure:!0,emitStderr:!1}),e=f(["rev-list","--count","origin/main..main"],{captureStdout:!0,allowFailure:!0,emitStderr:!1}),i=e.stdout.trim();return{hasUncommittedChanges:t.success?t.stdout.trim().length>0:null,isMainAheadOfOrigin:e.success&&/^\d+$/.test(i)?Number(i)>0:null}}function pt(){let t=j(),e=[];return t.hasUncommittedChanges===!0&&e.push("There are uncommitted changes in the working tree. These will not be included in the remote build/deploy until they are committed and pushed. Run `git commit` and then `git push`."),t.isMainAheadOfOrigin===!0&&e.push("Local 'main' is ahead of 'origin/main'. These will not be included in the remote build/deploy until they are pushed. Run `git push`."),e.length>0?e.join(" "):null}export{b as a,q as b,f as c,ut as d,lt as e,ft as f,W as g,dt as h,gt as i,pt as j};
|
|
17
|
+
/*!
|
|
18
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
19
|
+
*/
|
|
20
|
+
//# sourceMappingURL=chunk-SBVJ4SMO.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __pathDirname(__filename);
|
|
7
|
+
import{a as $,b as D,d as W,e as _,g as F}from"./chunk-2HSJ2XAQ.js";import{a as K}from"./chunk-USRRI5H4.js";import{h as V,i as q,j as H}from"./chunk-DD7E4ADI.js";import{Ga as g,Ha as J,R as P,U as T,g as E,ma as x,pa as b,va as L,x as k,xa as O,y as I,ya as B,z as N}from"./chunk-UIW77LMA.js";import{b as y}from"./chunk-RBG2H562.js";import{u as U,v as j}from"./chunk-DAG6RPOF.js";import{c as C,d as S,h,i as A}from"./chunk-PVAIJSAI.js";import{a as w}from"./chunk-WQKDXHGX.js";import{a as G}from"./chunk-3FP37TPE.js";async function ke(e,n){fe(e,n),await e.runVerb();let s=J();if(!s.appConfig)throw new y(`No ${G} found in the current directory. Run "${"ms"} app init" first.`);let i=await q(e),c=await e.getTenantIdAsync();if(!c)throw new y("Unable to determine tenant ID. Ensure you are logged in.");let p=await V(e),l=W(await e.getOption("access")),m=l==="edit"?_(s.appConfig):s.appConfig.repoType??"none",u=se(e.getPositionalArgs(0));if(u.length===0)throw new y("Provide at least one principal (Entra object ID or user/group email address). Separate multiple entries with commas, spaces, or both.");let o=n==="share"&&(l!=="edit"||m!=="native"),a=g(),f=a.trackScenario("MaafApp.SharePermissions",{mode:n,access:l,repoType:m,inputCount:u.length});try{let t=[],r=await ie(u,t,o);if(a.trackActivityEvent("MaafApp.SharePermissions.PrincipalResolution",{mode:n,inputCount:u.length,resolvedCount:r.length,failedCount:t.length,emailPassthrough:o}),r.length===0)throw new y(Y(t));t.length>0&&A(Y(t));let d=await(n==="share"?ee:ne)({tenantId:c,environmentId:i,appName:p,access:l,refs:r,repoType:m,jsonMode:e.isJsonMode()});f.complete({resolvedCount:r.length,failedResolutionCount:t.length,scope:d.scope,role:d.role,appScopeContributorFallback:l==="edit"&&d.scope==="app",...n==="unshare"&&{revokedCount:d.revokedCount??0,revokedPrincipalCount:d.revokedPrincipalCount??0,notFoundCount:d.notFound?.length??0,skippedCount:d.skipped?.length??0}});let M=n==="share"&&l==="edit"?await te({appInfo:d.appInfo,tenantId:c,environmentId:i,appName:p,jsonMode:e.isJsonMode()}):void 0;e.isJsonMode()?S({access:l,partialFailure:t.length>0,...d.result,...n==="unshare"&&{revokedCount:d.revokedCount??0,revokedPrincipalCount:d.revokedPrincipalCount??0,notFound:(d.notFound??[]).map(X),skipped:(d.skipped??[]).map(X)},...M&&{repoType:M.repoType,cloneUrl:M.cloneUrl},warnings:t}):(de({appName:p,mode:n,access:l,inputCount:r.length,outcome:d}),oe(M))}catch(t){throw f.failure(t),t}}async function ee(e){let{tenantId:n,environmentId:s,appName:i,access:c,refs:p,repoType:l,jsonMode:m}=e;if(c==="play"||c==="test"){let f=c==="test"?N:k,t=p.map(R=>Q(R,f));return{result:await b({tenantId:n,environmentId:s,logger:g(),actionsParams:{appName:i,put:t,delete:[]}}),scope:"app",role:f}}if(l==="none")throw new y($);if(l!=="native"){m||A(D);let f=p.map(r=>Q(r,I));return{result:await b({tenantId:n,environmentId:s,logger:g(),actionsParams:{appName:i,put:f,delete:[]}}),scope:"app",role:I}}let u=await F({tenantId:n,environmentId:s,appName:i}),o=p.map(ue);return{result:await O({tenantId:n,environmentId:s,logger:g(),actionsParams:{repoId:u.repositoryId,put:o,delete:[]}}),scope:"repo",role:P,appInfo:u}}async function ne(e){let{tenantId:n,environmentId:s,appName:i,access:c,refs:p,repoType:l,jsonMode:m}=e,u=p.map(z),o=new Map(p.map(r=>[z(r),r]));if(c==="edit"&&l==="none")throw new y($);let a=c!=="edit"||l!=="native",f=a?c==="test"?N:c==="play"?k:I:P,t;if(a)c==="edit"&&l!=="native"&&(m||A(D)),t=await L({tenantId:n,environmentId:s,logger:g(),actionsParams:{appName:i,principalIds:u,roleDefinitionName:f}});else{let r=await F({tenantId:n,environmentId:s,appName:i});t=await B({tenantId:n,environmentId:s,logger:g(),actionsParams:{repoId:r.repositoryId,principalIds:u}})}return{result:t.result,scope:a?"app":"repo",role:f,revokedCount:t.revokedCount,revokedPrincipalCount:t.revokedPrincipalCount,notFound:t.notFoundPrincipalIds.map(r=>o.get(r)??{id:r,input:r}),skipped:t.skippedNullRoleAssignments.map(r=>o.get(r.principalObjectId)??{id:r.principalObjectId,input:r.principalObjectId})}}function z(e){if(!e.id)throw new y(`Could not resolve '${e.input}' to an AAD object ID. Unshare requires object IDs.`);return e.id}async function te(e){let n=e.appInfo;if(!n)try{n=await x({tenantId:e.tenantId,environmentId:e.environmentId,logger:g(),actionsParams:{appName:e.appName}})}catch{e.jsonMode||A(`Share succeeded, but repository details for '${e.appName}' could not be read.`);return}return K(n)}function oe(e){e&&(e.repoType&&h(`Repo type: ${e.repoType}`),e.cloneUrl&&h(`Clone URL: ${e.cloneUrl}`))}function se(e){let n=new Set;for(let s of e)for(let i of s.split(",")){let c=i.trim();c&&n.add(c)}return[...n]}async function ie(e,n,s){let i=new Map,c=new Map,l=(await Promise.all(e.map(async o=>{let a=o.toLowerCase(),f=i.get(a);if(f)return f;if(H(o)){let t={id:o,input:o};return i.set(a,t),t}if(!le(o))return n.push({input:o,reason:"not an AAD object ID (GUID) or a valid email address"}),null;if(s){let t={input:o,email:o};return i.set(a,t),t}try{let t=c.get(a);t||(t=T(o,g()),c.set(a,t));let r=await t;if(!r)return n.push({input:o,reason:"no user or group found in this tenant (invite as a guest in Entra ID first if external)"}),null;let R={id:r.id,input:o,type:r.type,email:o,displayName:r.displayName};return i.set(a,R),R}catch(t){return n.push({input:o,reason:ae(t)}),null}}))).filter(o=>o!==null),m=[],u=new Set;for(let o of l){let a=(o.id??o.email??o.input).toLowerCase();u.has(a)||(u.add(a),m.push(o))}return m}function Y(e){let n=e.length===1?"entry":"entries",s=e.map(i=>` - ${i.input}: ${i.reason}`);return[`Could not resolve ${e.length} ${n}:`,...s].join(`
|
|
8
|
+
`)}function ae(e){if(e instanceof E){if(e.status===403)return re(e.status);let n=pe(e.body);return n!==void 0?`Graph ${e.status}: ${n}`:e.message}return e instanceof Error?e.message:String(e)}function re(e){return`Graph ${e}: your sign-in lacks permission to look up accounts by email. Pass the AAD object ID (GUID) instead, or have an admin grant the User.ReadBasic.All and Group.Read.All Graph permissions.`}function pe(e){if(e)try{let s=JSON.parse(e)?.error?.message;return typeof s=="string"?s:void 0}catch{return}}function le(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}function Q(e,n){return{name:e.displayName??e.input,properties:{roleName:n,principal:ce(e)}}}function ce(e){return e.id?e.email?{id:e.id,email:e.email}:{id:e.id}:{email:e.email??e.input}}function ue(e){let n=e.id??e.input;return{name:e.displayName??e.input,properties:{roleName:P,principal:e.type?{id:n,type:e.type}:{id:n}}}}function X(e){return{id:e.id??e.input,label:e.displayName??e.input}}function de(e){let{appName:n,mode:s,access:i,inputCount:c,outcome:p}=e,l=i==="play"?"play":i==="test"?"test":"edit";if(s==="share"){let a=p.result.put?.length??0;if(a===0){h("No changes were applied.");return}C(`Shared app '${n}' with ${a} ${v("principal",a)}. They can now ${l} the app.`);return}let m=p.revokedCount??0,u=p.revokedPrincipalCount??m;if(u===0){h(`No ${l} assignments to revoke on '${n}' \u2014 none of the ${c} ${v("principal",c)} had existing access.`);return}if(C(`Revoked ${l} permissions for ${u} ${v("principal",u)} on '${n}'.`),p.notFound&&p.notFound.length>0){let o=p.notFound.map(a=>a.displayName??a.input).join(", ");h(`${p.notFound.length} ${v("principal",p.notFound.length)} had no existing ${l} access (no-op): ${o}`)}if(p.skipped&&p.skipped.length>0){let o=p.skipped.map(a=>a.displayName??a.input).join(", ");h(`${p.skipped.length} ${v("principal",p.skipped.length)} had a role assignment with an unknown role definition; ${l} access was not modified for: ${o}. Investigate via the role-assignments API.`)}}function v(e,n){return n===1?e:`${e}s`}function fe(e,n){let s=n==="share"?w.app.share:w.app.unshare,i=n==="share"?U:j;e.setDescription(s.description),e.addExamples(s.examples),e.consumePositionalArgs("principal"),e.addOptions([{flags:{key:i.AppName.name},env:i.AppName.envVar,description:s.options.app,optionalInNonInteractive:!0},{flags:{key:i.Access.name},env:i.Access.envVar,default:i.Access.defaultValue,description:s.options.access,optionalInNonInteractive:!0}])}export{ke as a};
|
|
9
|
+
/*!
|
|
10
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
11
|
+
*/
|
|
12
|
+
//# sourceMappingURL=chunk-SCJXITCN.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __pathDirname(__filename);
|
|
7
|
+
import{a as V}from"./chunk-7PH2NK5K.js";import{c as Q,e as X}from"./chunk-Y7TZZLPW.js";import{a as p}from"./chunk-WQKDXHGX.js";import{a as H,b as O,d as Ae}from"./chunk-UT667QSU.js";var E=O(P=>{var $=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},N=class extends ${constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};P.CommanderError=$;P.InvalidArgumentError=N});var D=O(M=>{var{InvalidArgumentError:Oe}=E(),L=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new Oe(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,n):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function xe(o){let e=o.name()+(o.variadic===!0?"...":"");return o.required?"<"+e+">":"["+e+"]"}M.Argument=L;M.humanReadableArgName=xe});var z=O(Z=>{var{humanReadableArgName:we}=D(),I=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(n=>!n._hidden);if(e._hasImplicitHelpCommand()){let[,n,i]=e._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),r=e.createCommand(n).helpOption(!1);r.description(e._helpCommandDescription),i&&r.arguments(i),t.push(r)}return this.sortSubcommands&&t.sort((n,i)=>n.name().localeCompare(i.name())),t}compareOptions(e,t){let n=i=>i.short?i.short.replace(/^-/,""):i.long.replace(/^--/,"");return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(r=>!r.hidden),n=e._hasHelpOption&&e._helpShortFlag&&!e._findOption(e._helpShortFlag),i=e._hasHelpOption&&!e._findOption(e._helpLongFlag);if(n||i){let r;n?i?r=e.createOption(e._helpFlags,e._helpDescription):r=e.createOption(e._helpShortFlag,e._helpDescription):r=e.createOption(e._helpLongFlag,e._helpDescription),t.push(r)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let i=n.options.filter(r=>!r.hidden);t.push(...i)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e._args.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e._args.find(t=>t.description)?e._args:[]}subcommandTerm(e){let t=e._args.map(n=>we(n)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((n,i)=>Math.max(n,t.subcommandTerm(i).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((n,i)=>Math.max(n,t.optionTerm(i).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((n,i)=>Math.max(n,t.optionTerm(i).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((n,i)=>Math.max(n,t.argumentTerm(i).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let n="";for(let i=e.parent;i;i=i.parent)n=i.name()+" "+n;return n+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(", ")})`;return e.description?`${e.description} ${n}`:n}return e.description}formatHelp(e,t){let n=t.padWidth(e,t),i=t.helpWidth||80,r=2,s=2;function l(m,b){if(b){let F=`${m.padEnd(n+s)}${b}`;return t.wrap(F,i-r,n+s)}return m}function a(m){return m.join(`
|
|
8
|
+
`).replace(/^/gm," ".repeat(r))}let h=[`Usage: ${t.commandUsage(e)}`,""],u=t.commandDescription(e);u.length>0&&(h=h.concat([t.wrap(u,i,0),""]));let c=t.visibleArguments(e).map(m=>l(t.argumentTerm(m),t.argumentDescription(m)));c.length>0&&(h=h.concat(["Arguments:",a(c),""]));let f=t.visibleOptions(e).map(m=>l(t.optionTerm(m),t.optionDescription(m)));if(f.length>0&&(h=h.concat(["Options:",a(f),""])),this.showGlobalOptions){let m=t.visibleGlobalOptions(e).map(b=>l(t.optionTerm(b),t.optionDescription(b)));m.length>0&&(h=h.concat(["Global Options:",a(m),""]))}let A=t.visibleCommands(e).map(m=>l(t.subcommandTerm(m),t.subcommandDescription(m)));return A.length>0&&(h=h.concat(["Commands:",a(A),""])),h.join(`
|
|
9
|
+
`)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,n,i=40){let r=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",s=new RegExp(`[\\n][${r}]+`);if(e.match(s))return e;let l=t-n;if(l<i)return e;let a=e.slice(0,n),h=e.slice(n).replace(`\r
|
|
10
|
+
`,`
|
|
11
|
+
`),u=" ".repeat(n),f="\\s\u200B",A=new RegExp(`
|
|
12
|
+
|.{1,${l-1}}([${f}]|$)|[^${f}]+?([${f}]|$)`,"g"),m=h.match(A)||[];return a+m.map((b,F)=>b===`
|
|
13
|
+
`?"":(F>0?u:"")+b.trimEnd()).join(`
|
|
14
|
+
`)}};Z.Help=I});var R=O(S=>{var{InvalidArgumentError:He}=E(),q=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=ee(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,n)=>{if(!this.argChoices.includes(t))throw new He(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,n):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return Ee(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},W=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let i=this.negativeOptions.get(n).presetArg,r=i!==void 0?i:!1;return t.negate===(r===e)}};function Ee(o){return o.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function ee(o){let e,t,n=o.split(/[ |,]+/);return n.length>1&&!/^[[<]/.test(n[1])&&(e=n.shift()),t=n.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}S.Option=q;S.splitOptionFlags=ee;S.DualOptions=W});var ne=O(te=>{function Te(o,e){if(Math.abs(o.length-e.length)>3)return Math.max(o.length,e.length);let t=[];for(let n=0;n<=o.length;n++)t[n]=[n];for(let n=0;n<=e.length;n++)t[0][n]=n;for(let n=1;n<=e.length;n++)for(let i=1;i<=o.length;i++){let r=1;o[i-1]===e[n-1]?r=0:r=1,t[i][n]=Math.min(t[i-1][n]+1,t[i][n-1]+1,t[i-1][n-1]+r),i>1&&n>1&&o[i-1]===e[n-2]&&o[i-2]===e[n-1]&&(t[i][n]=Math.min(t[i][n],t[i-2][n-2]+1))}return t[o.length][e.length]}function ve(o,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=o.startsWith("--");t&&(o=o.slice(2),e=e.map(s=>s.slice(2)));let n=[],i=3,r=.4;return e.forEach(s=>{if(s.length<=1)return;let l=Te(o,s),a=Math.max(o.length,s.length);(a-l)/a>r&&(l<i?(i=l,n=[s]):l===i&&n.push(s))}),n.sort((s,l)=>s.localeCompare(l)),t&&(n=n.map(s=>`--${s}`)),n.length>1?`
|
|
15
|
+
(Did you mean one of ${n.join(", ")}?)`:n.length===1?`
|
|
16
|
+
(Did you mean ${n[0]}?)`:""}te.suggestSimilar=ve});var le=O(ae=>{var Ve=H("events").EventEmitter,j=H("child_process"),y=H("path"),G=H("fs"),d=H("process"),{Argument:$e,humanReadableArgName:De}=D(),{CommanderError:U}=E(),{Help:Se}=z(),{Option:ie,splitOptionFlags:ke,DualOptions:Fe}=R(),{suggestSimilar:re}=ne(),B=class o extends Ve{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this._args=[],this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:t=>d.stdout.write(t),writeErr:t=>d.stderr.write(t),getOutHelpWidth:()=>d.stdout.isTTY?d.stdout.columns:void 0,getErrHelpWidth:()=>d.stderr.isTTY?d.stderr.columns:void 0,outputError:(t,n)=>n(t)},this._hidden=!1,this._hasHelpOption=!0,this._helpFlags="-h, --help",this._helpDescription="display help for command",this._helpShortFlag="-h",this._helpLongFlag="--help",this._addImplicitHelpCommand=void 0,this._helpCommandName="help",this._helpCommandnameAndArgs="help [command]",this._helpCommandDescription="display help for command",this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._hasHelpOption=e._hasHelpOption,this._helpFlags=e._helpFlags,this._helpDescription=e._helpDescription,this._helpShortFlag=e._helpShortFlag,this._helpLongFlag=e._helpLongFlag,this._helpCommandName=e._helpCommandName,this._helpCommandnameAndArgs=e._helpCommandnameAndArgs,this._helpCommandDescription=e._helpCommandDescription,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}command(e,t,n){let i=t,r=n;typeof i=="object"&&i!==null&&(r=i,i=null),r=r||{};let[,s,l]=e.match(/([^ ]+) *(.*)/),a=this.createCommand(s);return i&&(a.description(i),a._executableHandler=!0),r.isDefault&&(this._defaultCommandName=a._name),a._hidden=!!(r.noHelp||r.hidden),a._executableFile=r.executableFile||null,l&&a.arguments(l),this.commands.push(a),a.parent=this,a.copyInheritedSettings(this),i?this:a}createCommand(e){return new o(e)}createHelp(){return Object.assign(new Se,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
|
|
17
|
+
- specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this.commands.push(e),e.parent=this,this}createArgument(e,t){return new $e(e,t)}argument(e,t,n,i){let r=this.createArgument(e,t);return typeof n=="function"?r.default(i).argParser(n):r.default(n),this.addArgument(r),this}arguments(e){return e.split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this._args.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this._args.push(e),this}addHelpCommand(e,t){return e===!1?this._addImplicitHelpCommand=!1:(this._addImplicitHelpCommand=!0,typeof e=="string"&&(this._helpCommandName=e.split(" ")[0],this._helpCommandnameAndArgs=e),this._helpCommandDescription=t||this._helpCommandDescription),this}_hasImplicitHelpCommand(){return this._addImplicitHelpCommand===void 0?this.commands.length&&!this._actionHandler&&!this._findCommand("help"):this._addImplicitHelpCommand}hook(e,t){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
|
|
18
|
+
Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new U(e,t,n)),d.exit(e)}action(e){let t=n=>{let i=this._args.length,r=n.slice(0,i);return this._storeOptionsAsProperties?r[i]=this:r[i]=this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new ie(e,t)}addOption(e){let t=e.name(),n=e.attributeName();if(e.negate){let r=e.long.replace(/^--no-/,"--");this._findOption(r)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,"default");this.options.push(e);let i=(r,s,l)=>{r==null&&e.presetArg!==void 0&&(r=e.presetArg);let a=this.getOptionValue(n);if(r!==null&&e.parseArg)try{r=e.parseArg(r,a)}catch(h){if(h.code==="commander.invalidArgument"){let u=`${s} ${h.message}`;this.error(u,{exitCode:h.exitCode,code:h.code})}throw h}else r!==null&&e.variadic&&(r=e._concatValue(r,a));r==null&&(e.negate?r=!1:e.isBoolean()||e.optional?r=!0:r=""),this.setOptionValueWithSource(n,r,l)};return this.on("option:"+t,r=>{let s=`error: option '${e.flags}' argument '${r}' is invalid.`;i(r,s,"cli")}),e.envVar&&this.on("optionEnv:"+t,r=>{let s=`error: option '${e.flags}' value '${r}' from env '${e.envVar}' is invalid.`;i(r,s,"env")}),this}_optionEx(e,t,n,i,r){if(typeof t=="object"&&t instanceof ie)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(t,n);if(s.makeOptionMandatory(!!e.mandatory),typeof i=="function")s.default(r).argParser(i);else if(i instanceof RegExp){let l=i;i=(a,h)=>{let u=l.exec(a);return u?u[0]:h},s.default(r).argParser(i)}else s.default(i);return this.addOption(s)}option(e,t,n,i){return this._optionEx({},e,t,n,i)}requiredOption(e,t,n,i){return this._optionEx({mandatory:!0},e,t,n,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){if(this._passThroughOptions=!!e,this.parent&&e&&!this.parent._enablePositionalOptions)throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}storeOptionsAsProperties(e=!0){if(this._storeOptionsAsProperties=!!e,this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return T(this).forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");t=t||{},e===void 0&&(e=d.argv,d.versions&&d.versions.electron&&(t.from="electron")),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case"node":this._scriptPath=e[1],n=e.slice(2);break;case"electron":d.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case"user":n=e.slice(0);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(e,t){let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_executeSubCommand(e,t){t=t.slice();let n=!1,i=[".js",".ts",".tsx",".mjs",".cjs"];function r(u,c){let f=y.resolve(u,c);if(G.existsSync(f))return f;if(i.includes(y.extname(c)))return;let A=i.find(m=>G.existsSync(`${f}${m}`));if(A)return`${f}${A}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=e._executableFile||`${this._name}-${e._name}`,l=this._executableDir||"";if(this._scriptPath){let u;try{u=G.realpathSync(this._scriptPath)}catch{u=this._scriptPath}l=y.resolve(y.dirname(u),l)}if(l){let u=r(l,s);if(!u&&!e._executableFile&&this._scriptPath){let c=y.basename(this._scriptPath,y.extname(this._scriptPath));c!==this._name&&(u=r(l,`${c}-${e._name}`))}s=u||s}n=i.includes(y.extname(s));let a;d.platform!=="win32"?n?(t.unshift(s),t=oe(d.execArgv).concat(t),a=j.spawn(d.argv[0],t,{stdio:"inherit"})):a=j.spawn(s,t,{stdio:"inherit"}):(t.unshift(s),t=oe(d.execArgv).concat(t),a=j.spawn(d.execPath,t,{stdio:"inherit"})),a.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(c=>{d.on(c,()=>{a.killed===!1&&a.exitCode===null&&a.kill(c)})});let h=this._exitCallback;h?a.on("close",()=>{h(new U(d.exitCode||0,"commander.executeSubCommandAsync","(close)"))}):a.on("close",d.exit.bind(d)),a.on("error",u=>{if(u.code==="ENOENT"){let c=l?`searched for local subcommand relative to directory '${l}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",f=`'${s}' does not exist
|
|
19
|
+
- if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
20
|
+
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
21
|
+
- ${c}`;throw new Error(f)}else if(u.code==="EACCES")throw new Error(`'${s}' not executable`);if(!h)d.exit(1);else{let c=new U(1,"commander.executeSubCommandAsync","(error)");c.nestedError=u,h(c)}}),this.runningCommand=a}_dispatchSubcommand(e,t,n){let i=this._findCommand(e);i||this.help({error:!0});let r;return r=this._chainOrCallSubCommandHook(r,i,"preSubcommand"),r=this._chainOrCall(r,()=>{if(i._executableHandler)this._executeSubCommand(i,t.concat(n));else return i._parseCommand(t,n)}),r}_checkNumberOfArguments(){this._args.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this._args.length>0&&this._args[this._args.length-1].variadic)&&this.args.length>this._args.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,i,r)=>{let s=i;if(i!==null&&n.parseArg)try{s=n.parseArg(i,r)}catch(l){if(l.code==="commander.invalidArgument"){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'. ${l.message}`;this.error(a,{exitCode:l.exitCode,code:l.code})}throw l}return s};this._checkNumberOfArguments();let t=[];this._args.forEach((n,i)=>{let r=n.defaultValue;n.variadic?i<this.args.length?(r=this.args.slice(i),n.parseArg&&(r=r.reduce((s,l)=>e(n,l,s),n.defaultValue))):r===void 0&&(r=[]):i<this.args.length&&(r=this.args[i],n.parseArg&&(r=e(n,r,n.defaultValue))),t[i]=r}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,i=[];return T(this).reverse().filter(r=>r._lifeCycleHooks[t]!==void 0).forEach(r=>{r._lifeCycleHooks[t].forEach(s=>{i.push({hookedCommand:r,callback:s})})}),t==="postAction"&&i.reverse(),i.forEach(r=>{n=this._chainOrCall(n,()=>r.callback(r.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let i=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(r=>{i=this._chainOrCall(i,()=>r(this,t))}),i}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._hasImplicitHelpCommand()&&e[0]===this._helpCommandName)return e.length===1&&this.help(),this._dispatchSubcommand(e[1],[],[this._helpLongFlag]);if(this._defaultCommandName)return se(this,t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),se(this,n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},r=`command:${this.name()}`;if(this._actionHandler){i(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(r,e,t)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent&&this.parent.listenerCount(r))i(),this._processArguments(),this.parent.emit(r,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){for(let e=this;e;e=e.parent)e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let i=n.attributeName();return this.getOptionValue(i)===void 0?!1:this.getOptionValueSource(i)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let i=e.find(r=>n.conflictsWith.includes(r.attributeName()));i&&this._conflictingOption(n,i)})}_checkForConflictingOptions(){for(let e=this;e;e=e.parent)e._checkForConflictingLocalOptions()}parseOptions(e){let t=[],n=[],i=t,r=e.slice();function s(a){return a.length>1&&a[0]==="-"}let l=null;for(;r.length;){let a=r.shift();if(a==="--"){i===n&&i.push(a),i.push(...r);break}if(l&&!s(a)){this.emit(`option:${l.name()}`,a);continue}if(l=null,s(a)){let h=this._findOption(a);if(h){if(h.required){let u=r.shift();u===void 0&&this.optionMissingArgument(h),this.emit(`option:${h.name()}`,u)}else if(h.optional){let u=null;r.length>0&&!s(r[0])&&(u=r.shift()),this.emit(`option:${h.name()}`,u)}else this.emit(`option:${h.name()}`);l=h.variadic?h:null;continue}}if(a.length>2&&a[0]==="-"&&a[1]!=="-"){let h=this._findOption(`-${a[1]}`);if(h){h.required||h.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${h.name()}`,a.slice(2)):(this.emit(`option:${h.name()}`),r.unshift(`-${a.slice(2)}`));continue}}if(/^--[^=]+=/.test(a)){let h=a.indexOf("="),u=this._findOption(a.slice(0,h));if(u&&(u.required||u.optional)){this.emit(`option:${u.name()}`,a.slice(h+1));continue}}if(s(a)&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(a)){t.push(a),r.length>0&&n.push(...r);break}else if(a===this._helpCommandName&&this._hasImplicitHelpCommand()){t.push(a),r.length>0&&t.push(...r);break}else if(this._defaultCommandName){n.push(a),r.length>0&&n.push(...r);break}}if(this._passThroughOptions){i.push(a),r.length>0&&i.push(...r);break}i.push(a)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let i=this.options[n].attributeName();e[i]=i===this._versionOptionName?this._version:this[i]}return e}return this._optionValues}optsWithGlobals(){return T(this).reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
|
|
22
|
+
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
23
|
+
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
24
|
+
`),this.outputHelp({error:!0}));let n=t||{},i=n.exitCode||1,r=n.code||"commander.error";this._exit(i,r,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in d.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,d.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Fe(this.options),t=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(i=>!t(i)).forEach(i=>{this.setOptionValueWithSource(i,n.implied[i],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let n=s=>{let l=s.attributeName(),a=this.getOptionValue(l),h=this.options.find(c=>c.negate&&l===c.attributeName()),u=this.options.find(c=>!c.negate&&l===c.attributeName());return h&&(h.presetArg===void 0&&a===!1||h.presetArg!==void 0&&a===h.presetArg)?h:u||s},i=s=>{let l=n(s),a=l.attributeName();return this.getOptionValueSource(a)==="env"?`environment variable '${l.envVar}'`:`option '${l.flags}'`},r=`error: ${i(e)} cannot be used with ${i(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let i=[],r=this;do{let s=r.createHelp().visibleOptions(r).filter(l=>l.long).map(l=>l.long);i=i.concat(s),r=r.parent}while(r&&!r._enablePositionalOptions);t=re(e,i)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this._args.length,n=t===1?"":"s",r=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let i=[];this.createHelp().visibleCommands(this).forEach(r=>{i.push(r.name()),r.alias()&&i.push(r.alias())}),t=re(e,i)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:"commander.unknownCommand"})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",n=n||"output the version number";let i=this.createOption(t,n);return this._versionOptionName=i.attributeName(),this.options.push(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
25
|
+
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this._args.map(n=>De(n));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=y.basename(e,y.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},n;return t.error?n=i=>this._outputConfiguration.writeErr(i):n=i=>this._outputConfiguration.writeOut(i),t.write=e.write||n,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let n=this._getHelpContext(e);T(this).reverse().forEach(r=>r.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let i=this.helpInformation(n);if(t&&(i=t(i),typeof i!="string"&&!Buffer.isBuffer(i)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(i),this.emit(this._helpLongFlag),this.emit("afterHelp",n),T(this).forEach(r=>r.emit("afterAllHelp",n))}helpOption(e,t){if(typeof e=="boolean")return this._hasHelpOption=e,this;this._helpFlags=e||this._helpFlags,this._helpDescription=t||this._helpDescription;let n=ke(this._helpFlags);return this._helpShortFlag=n.shortFlag,this._helpLongFlag=n.longFlag,this}help(e){this.outputHelp(e);let t=d.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let n=["beforeAll","before","after","afterAll"];if(!n.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
26
|
+
Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,r=>{let s;typeof t=="function"?s=t({error:r.error,command:r.command}):s=t,s&&r.write(`${s}
|
|
27
|
+
`)}),this}};function se(o,e){o._hasHelpOption&&e.find(n=>n===o._helpLongFlag||n===o._helpShortFlag)&&(o.outputHelp(),o._exit(0,"commander.helpDisplayed","(outputHelp)"))}function oe(o){return o.map(e=>{if(!e.startsWith("--inspect"))return e;let t,n="127.0.0.1",i="9229",r;return(r=e.match(/^(--inspect(-brk)?)$/))!==null?t=r[1]:(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=r[1],/^\d+$/.test(r[3])?i=r[3]:n=r[3]):(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=r[1],n=r[3],i=r[4]),t&&i!=="0"?`${t}=${n}:${parseInt(i)+1}`:e})}function T(o){let e=[];for(let t=o;t;t=t.parent)e.push(t);return e}ae.Command=B});var ce=O((g,pe)=>{var{Argument:Ne}=D(),{Command:he}=le(),{CommanderError:Pe,InvalidArgumentError:ue}=E(),{Help:Le}=z(),{Option:Me}=R();g=pe.exports=new he;g.program=g;g.Argument=Ne;g.Command=he;g.CommanderError=Pe;g.Help=Le;g.InvalidArgumentError=ue;g.InvalidOptionArgumentError=ue;g.Option=Me});var de=Ae(ce(),1),{program:Be,createCommand:Ke,createArgument:Je,createOption:Ye,CommanderError:Qe,InvalidArgumentError:Xe,InvalidOptionArgumentError:Ze,Command:me,Argument:et,Option:tt,Help:fe}=de.default;var x={auth:{"@description":"Manage authentication state.",commands:{login:{"@helpText":p.auth.login.description,lazyHandler:async()=>(await import("./Login-5TFNB24B.js")).loginAsync},logout:{"@helpText":p.auth.logout.description,lazyHandler:async()=>(await import("./Logout-35U4J627.js")).logoutAsync},status:{"@helpText":p.auth.status.description,lazyHandler:async()=>(await import("./AuthStatus-WCICFN6O.js")).authStatusAsync},switch:{"@helpText":p.auth.switch.description,lazyHandler:async()=>(await import("./AuthSwitch-5PKHCTM2.js")).authSwitchAsync}}},app:{"@description":"Manage apps and their resources.",commands:{clone:{"@helpText":p.app.clone.description,lazyHandler:async()=>(await import("./CloneMaafApp-EKHHLMWD.js")).cloneMaafAppAsync},create:{"@helpText":p.app.create.description,lazyHandler:async()=>(await import("./CreateMaafApp-L3XX2UVT.js")).createMaafAppAsync},init:{"@helpText":p.app.init.description,lazyHandler:async()=>(await import("./Init-TJOSV5DE.js")).initAsync},list:{"@helpText":p.app.list.description,lazyHandler:async()=>(await import("./ListMaafApps-KRXJMAEU.js")).listMaafAppsAsync},show:{"@helpText":p.app.show.deprecation,lazyHandler:async()=>(await import("./InfoMaafApp-WGNDYYGN.js")).showMaafAppAsync},share:{typed:!0,"@helpText":p.app.share.description,lazyHandler:async()=>(await import("./ShareMaafApp-PZI5MCBA.js")).shareMaafAppAsync,commands:{link:{typed:!0,"@helpText":p.app.shareLink.description,commands:{create:{"@helpText":p.app.shareLink.create.description,lazyHandler:async()=>(await import("./ShareLinkCreate-YG3DACP2.js")).shareLinkCreateAsync},list:{"@helpText":p.app.shareLink.list.description,lazyHandler:async()=>(await import("./ShareLinkList-XF6BIB3M.js")).shareLinkListAsync},revoke:{"@helpText":p.app.shareLink.revoke.description,lazyHandler:async()=>(await import("./ShareLinkRevoke-4USAQKLB.js")).shareLinkRevokeAsync}}},list:{"@helpText":p.app.share.list.description,lazyHandler:async()=>(await import("./ShareList-6QI7ZAMZ.js")).shareListAsync}}},unshare:{"@helpText":p.app.unshare.description,lazyHandler:async()=>(await import("./UnshareMaafApp-MHBIV5OR.js")).unshareMaafAppAsync},info:{"@helpText":p.app.info.description,lazyHandler:async()=>(await import("./InfoMaafApp-WGNDYYGN.js")).infoMaafAppAsync},build:{"@helpText":p.app.build.description,lazyHandler:async()=>(await import("./BuildMaafApp-Q74EFM3Q.js")).buildMaafAppAsync},"build-status":{"@helpText":p.app.buildStatus.description,lazyHandler:async()=>(await import("./GetMaafBuildStatus-7B6ZNSEA.js")).getMaafBuildStatusAsync},deploy:{"@helpText":p.app.deploy.description,lazyHandler:async()=>(await import("./DeployMaafApp-HF67BQRZ.js")).deployMaafAppAsync},pack:{"@helpText":p.app.pack.description,lazyHandler:async()=>(await import("./Pack-S7P4MIT6.js")).packAsync},play:{"@helpText":p.app.play.description,lazyHandler:async()=>(await import("./PlayMaafApp-D4KLJKLT.js")).playMaafAppAsync},dev:{"@helpText":p.app.dev.description,lazyHandler:async()=>(await import("./Dev-BTJUJGP5.js")).devAsync},delete:{"@helpText":p.app.delete.description,lazyHandler:async()=>(await import("./DeleteMaafApp-YCDKWFRG.js")).deleteMaafAppAsync},refresh:{typed:!0,commands:{"data-source":{"@helpText":p.app.refresh.dataSource.description,lazyHandler:async()=>(await import("./RefreshDataSource-N5CEH23S.js")).refreshDataSourceAsync}}},add:{typed:!0,commands:{config:{"@helpText":p.app.add.config.description,requiresEnvVar:"ALM",lazyHandler:async()=>(await import("./AddConfig-GZO2UMFR.js")).addConfigAsync},"data-source":{"@helpText":p.app.add.connector.description,lazyHandler:async()=>(await import("./AddConnector-HJCCENAM.js")).addConnectorAsync},connector:{"@helpText":"(deprecated) Use 'data-source' instead.",lazyHandler:async()=>(await import("./AddConnector-HJCCENAM.js")).addConnectorAsync}}},remove:{typed:!0,commands:{"data-source":{"@helpText":p.app.remove.description,lazyHandler:async()=>(await import("./RemoveDataSource-XR5Q4O3F.js")).removeDataSourceAsync},connector:{"@helpText":"(deprecated) Use 'data-source' instead.",lazyHandler:async()=>(await import("./RemoveDataSource-XR5Q4O3F.js")).removeDataSourceAsync}}},"set-setting":{"@helpText":p.app["set-setting"].description,lazyHandler:async()=>(await import("./SetSetting-HXY4YSKC.js")).setSettingAsync},"get-settings":{"@helpText":p.app["get-settings"].description,lazyHandler:async()=>(await import("./GetSettings-GJWIPK2T.js")).getSettingsAsync}}},connector:{"@description":"Discover available connectors and their operations.",commands:{list:{"@helpText":p.connector.list.description,lazyHandler:async()=>(await import("./ListConnectors-OET7STMW.js")).listConnectorsCliAsync},"list-actions":{"@helpText":p.connector["list-actions"].description,lazyHandler:async()=>(await import("./ListConnectorActions-HTD6YSCY.js")).listConnectorActionsCliAsync}}},git:{"@description":"Manage GitHub integration for apps.",commands:{auth:{typed:!0,commands:{refresh:{"@helpText":p.git.auth.refresh.description,lazyHandler:async()=>(await import("./RefreshGitAuth-2VL6VBLU.js")).refreshGitAuthAsync}}}}},telemetry:{"@description":"Manage CLI telemetry settings.",commands:{enable:{"@helpText":p.telemetry.enable.description,lazyHandler:async()=>(await import("./TelemetrySettings-WWVPRF7T.js")).telemetryEnableAsync},disable:{"@helpText":p.telemetry.disable.description,lazyHandler:async()=>(await import("./TelemetrySettings-WWVPRF7T.js")).telemetryDisableAsync},status:{"@helpText":p.telemetry.status.description,lazyHandler:async()=>(await import("./TelemetrySettings-WWVPRF7T.js")).telemetryStatusAsync}}}};function ge(o){return o.requiresEnvVar===void 0||Q(o.requiresEnvVar)}function C(o){return o.typed===!0}function k(o){return typeof o.lazyHandler=="function"}function w(o,e){if(!Object.prototype.hasOwnProperty.call(o,e))return;let t=o[e];return ge(t)?t:void 0}function K(o){return Object.entries(o).filter(([,e])=>ge(e))}function lt(o,e){let t=o.slice(2);if(t.length===0||t[0].startsWith("-"))return null;let[n]=t;return v(n,e)?_e(e[n].commands,t,1,[n]):null}function _e(o,e,t,n){if(t>=e.length)return null;let i=e[t];if(i.startsWith("-"))return null;let r=w(o,i);if(!r)return null;let s=[...n,i];if(!C(r))return{path:s,lazyHandler:r.lazyHandler,tokensConsumed:t+1};let l=e[t+1];return l!==void 0&&!l.startsWith("-")&&w(r.commands,l)!==void 0?_e(r.commands,e,t+1,s):k(r)?{path:s,lazyHandler:r.lazyHandler,tokensConsumed:t+1}:null}function ht(o,e){let t=o.slice(2),n=t.findIndex(u=>u.startsWith("-")),i=n===-1?t:t.slice(0,n);if(i.length<2)return null;let[r,...s]=i;if(!v(r,e))return null;let l=e[r].commands,a=[r],h=!1;for(let u of s){let c=w(l,u);if(!c)return h?{pathTokens:a,unknownToken:u}:null;if(!C(c))return null;a.push(u),l=c.commands,h=!0}return h?{pathTokens:a,unknownToken:void 0}:null}function v(o,e){return o in e}function J(o,e,t){let n=new fe;n.helpWidth=process.stdout.columns??80;let i=Math.max(...t.map(([l])=>l.length),8),r=2,s=2;o.push(e);for(let[l,a]of t){let h=`${l.padEnd(i+s)}${a}`;o.push(n.wrap(h,n.helpWidth-r,i+s,1).replace(/^/gm," ".repeat(r)))}}function ye(){let o=[],e=Object.entries(x);if(e.length>0){let t=Math.max(...e.map(([i])=>i.length)),n=Math.max(t+2,10);o.push("Command Groups:"),o.push("");for(let[i,r]of e)o.push(` ${i.padEnd(n)} ${r["@description"]}`);o.push(""),o.push(`Run '${"ms"} <group> --help' for commands within a group.`)}return o.join(`
|
|
28
|
+
`)}function gt(o){if(!v(o,x))return"";let e=x[o],t=[];t.push(`Usage: ${"ms"} ${o} <command> [flags]`),t.push(""),t.push(e["@description"]),t.push("");let n=[],i=[];for(let[r,s]of K(e.commands))if(C(s)){let l=s["@helpText"];k(s)&&l!==void 0&&n.push([r,l]),i.push([r,s])}else n.push([r,s["@helpText"]]);if(n.length>0&&J(t,"Commands:",n),i.length>0){t.push("");for(let[r,s]of i)J(t,`${r} <type>:`,Y(s,r).map(([l,a])=>[l,a]))}return t.push(""),t.push(`Run '${"ms"} ${o} <command> --help' for command-specific flags.`),t.join(`
|
|
29
|
+
`)}function Y(o,e){let t=[];for(let[n,i]of K(o.commands)){let r=e?`${e} ${n}`:n;C(i)?t.push(...Y(i,r)):t.push([r,i["@helpText"]])}return t}function _t(o){if(o.length<2)return null;let[e,...t]=o;if(!v(e,x))return null;let n=x[e].commands,i;for(let l of t){let a=w(n,l);if(!a)return null;if(i=a,C(a))n=a.commands;else return null}if(!i||!C(i))return null;let r=o.join(" "),s=[];return s.push(`Usage: ${"ms"} ${r} <type> [flags]`),s.push(""),J(s,"Types:",Y(i,"")),s.push(""),s.push(`Run '${"ms"} ${r} <type> --help' for type-specific flags.`),s.join(`
|
|
30
|
+
`)}function be(){return`${"ms"} v${V.version} (preview)`}function Ce(o){let e=new me;return e.option("--non-interactive","Run in non-interactive mode (no prompts, all parameters must be provided via flags or environment variables)"),e.option("--json","Format output as JSON"),e.option("--no-color","Disable colored output"),o?e.name(`${"ms"} ${o.path.join(" ")}`):(e.name("ms"),e.usage("[option] [command] [<args>]")),e.version(V.version,"-v, --version","output the current version"),e.description(p.global.programDescription),e.addHelpText("beforeAll",()=>`${be()}
|
|
31
|
+
|
|
32
|
+
`),e.addHelpText("after",()=>o?"":`
|
|
33
|
+
`+ye()+`
|
|
34
|
+
`),e}var Ie=new Set(["--help","-h","--version","-v","--json","--no-color","--non-interactive"]);function ze(o){let e=o.slice(2);return e.some(n=>n==="--help"||n==="-h"||n==="--version"||n==="-v")&&e.every(n=>Ie.has(n))}function Dt(o){return ze(o)?(o.includes("--no-color")&&X("NO_COLOR","1"),Ce(null).parse([...o]),!0):!1}export{x as a,lt as b,ht as c,v as d,gt as e,_t as f,be as g,Ce as h,Dt as i};
|
|
35
|
+
/*!
|
|
36
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
37
|
+
*/
|
|
38
|
+
//# sourceMappingURL=chunk-TZRZFNLH.js.map
|