@seeka-labs/cli-apps 1.0.3 → 1.1.1

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/dist/index.js CHANGED
@@ -1,26 +1,26 @@
1
1
  #! /usr/bin/env node
2
- "use strict";var Ot=Object.create;var oe=Object.defineProperty;var bt=Object.getOwnPropertyDescriptor;var yt=Object.getOwnPropertyNames;var wt=Object.getPrototypeOf,Ct=Object.prototype.hasOwnProperty;var _=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var At=(s,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of yt(e))!Ct.call(s,i)&&i!==t&&oe(s,i,{get:()=>e[i],enumerable:!(n=bt(e,i))||n.enumerable});return s};var A=(s,e,t)=>(t=s!=null?Ot(wt(s)):{},At(e||!s||!s.__esModule?oe(t,"default",{value:s,enumerable:!0}):t,s));var k=_(q=>{var V=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}},T=class extends V{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};q.CommanderError=V;q.InvalidArgumentError=T});var H=_(I=>{var{InvalidArgumentError:Et}=k(),D=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 Et(`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 vt(s){let e=s.name()+(s.variadic===!0?"...":"");return s.required?"<"+e+">":"["+e+"]"}I.Argument=D;I.humanReadableArgName=vt});var M=_(ae=>{var{humanReadableArgName:xt}=H(),F=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(i=>!i._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((i,r)=>i.name().localeCompare(r.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(i=>!i.hidden),n=e._getHelpOption();if(n&&!n.hidden){let i=n.short&&e._findOption(n.short),r=n.long&&e._findOption(n.long);!i&&!r?t.push(n):n.long&&!r?t.push(e.createOption(n.long,n.description)):n.short&&!i&&t.push(e.createOption(n.short,n.description))}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.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(n=>xt(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,m=2;function a(p,b){if(b){let S=`${p.padEnd(n+m)}${b}`;return t.wrap(S,i-r,n+m)}return p}function o(p){return p.join(`
3
- `).replace(/^/gm," ".repeat(r))}let l=[`Usage: ${t.commandUsage(e)}`,""],c=t.commandDescription(e);c.length>0&&(l=l.concat([t.wrap(c,i,0),""]));let u=t.visibleArguments(e).map(p=>a(t.argumentTerm(p),t.argumentDescription(p)));u.length>0&&(l=l.concat(["Arguments:",o(u),""]));let h=t.visibleOptions(e).map(p=>a(t.optionTerm(p),t.optionDescription(p)));if(h.length>0&&(l=l.concat(["Options:",o(h),""])),this.showGlobalOptions){let p=t.visibleGlobalOptions(e).map(b=>a(t.optionTerm(b),t.optionDescription(b)));p.length>0&&(l=l.concat(["Global Options:",o(p),""]))}let O=t.visibleCommands(e).map(p=>a(t.subcommandTerm(p),t.subcommandDescription(p)));return O.length>0&&(l=l.concat(["Commands:",o(O),""])),l.join(`
4
- `)}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",m=new RegExp(`[\\n][${r}]+`);if(e.match(m))return e;let a=t-n;if(a<i)return e;let o=e.slice(0,n),l=e.slice(n).replace(`\r
2
+ "use strict";var xt=Object.create;var ce=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var $t=Object.getPrototypeOf,Vt=Object.prototype.hasOwnProperty;var _=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var Nt=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of kt(e))!Vt.call(i,s)&&s!==t&&ce(i,s,{get:()=>e[s],enumerable:!(n=St(e,s))||n.enumerable});return i};var v=(i,e,t)=>(t=i!=null?xt($t(i)):{},Nt(e||!i||!i.__esModule?ce(t,"default",{value:i,enumerable:!0}):t,i));var V=_(q=>{var H=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}},I=class extends H{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};q.CommanderError=H;q.InvalidArgumentError=I});var P=_(D=>{var{InvalidArgumentError:Ht}=V(),F=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 Ht(`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 Pt(i){let e=i.name()+(i.variadic===!0?"...":"");return i.required?"<"+e+">":"["+e+"]"}D.Argument=F;D.humanReadableArgName=Pt});var L=_(ue=>{var{humanReadableArgName:jt}=P(),M=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(s=>!s._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((s,r)=>s.name().localeCompare(r.name())),t}compareOptions(e,t){let n=s=>s.short?s.short.replace(/^-/,""):s.long.replace(/^--/,"");return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(s=>!s.hidden),n=e._getHelpOption();if(n&&!n.hidden){let s=n.short&&e._findOption(n.short),r=n.long&&e._findOption(n.long);!s&&!r?t.push(n):n.long&&!r?t.push(e.createOption(n.long,n.description)):n.short&&!s&&t.push(e.createOption(n.short,n.description))}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 s=n.options.filter(r=>!r.hidden);t.push(...s)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(n=>jt(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,s)=>Math.max(n,t.subcommandTerm(s).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((n,s)=>Math.max(n,t.optionTerm(s).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((n,s)=>Math.max(n,t.optionTerm(s).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((n,s)=>Math.max(n,t.argumentTerm(s).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let n="";for(let s=e.parent;s;s=s.parent)n=s.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),s=t.helpWidth||80,r=2,m=2;function l(d,w){if(w){let $=`${d.padEnd(n+m)}${w}`;return t.wrap($,s-r,n+m)}return d}function o(d){return d.join(`
3
+ `).replace(/^/gm," ".repeat(r))}let a=[`Usage: ${t.commandUsage(e)}`,""],c=t.commandDescription(e);c.length>0&&(a=a.concat([t.wrap(c,s,0),""]));let h=t.visibleArguments(e).map(d=>l(t.argumentTerm(d),t.argumentDescription(d)));h.length>0&&(a=a.concat(["Arguments:",o(h),""]));let f=t.visibleOptions(e).map(d=>l(t.optionTerm(d),t.optionDescription(d)));if(f.length>0&&(a=a.concat(["Options:",o(f),""])),this.showGlobalOptions){let d=t.visibleGlobalOptions(e).map(w=>l(t.optionTerm(w),t.optionDescription(w)));d.length>0&&(a=a.concat(["Global Options:",o(d),""]))}let b=t.visibleCommands(e).map(d=>l(t.subcommandTerm(d),t.subcommandDescription(d)));return b.length>0&&(a=a.concat(["Commands:",o(b),""])),a.join(`
4
+ `)}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,s=40){let r=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",m=new RegExp(`[\\n][${r}]+`);if(e.match(m))return e;let l=t-n;if(l<s)return e;let o=e.slice(0,n),a=e.slice(n).replace(`\r
5
5
  `,`
6
- `),c=" ".repeat(n),h="\\s\u200B",O=new RegExp(`
7
- |.{1,${a-1}}([${h}]|$)|[^${h}]+?([${h}]|$)`,"g"),p=l.match(O)||[];return o+p.map((b,S)=>b===`
8
- `?"":(S>0?c:"")+b.trimEnd()).join(`
9
- `)}};ae.Help=F});var U=_(R=>{var{InvalidArgumentError:St}=k(),W=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=$t(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 St(`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 kt(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},L=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 kt(s){return s.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function $t(s){let e,t,n=s.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}}R.Option=W;R.DualOptions=L});var ce=_(le=>{function Vt(s,e){if(Math.abs(s.length-e.length)>3)return Math.max(s.length,e.length);let t=[];for(let n=0;n<=s.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<=s.length;i++){let r=1;s[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&&s[i-1]===e[n-2]&&s[i-2]===e[n-1]&&(t[i][n]=Math.min(t[i][n],t[i-2][n-2]+1))}return t[s.length][e.length]}function Ht(s,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=s.startsWith("--");t&&(s=s.slice(2),e=e.map(m=>m.slice(2)));let n=[],i=3,r=.4;return e.forEach(m=>{if(m.length<=1)return;let a=Vt(s,m),o=Math.max(s.length,m.length);(o-a)/o>r&&(a<i?(i=a,n=[m]):a===i&&n.push(m))}),n.sort((m,a)=>m.localeCompare(a)),t&&(n=n.map(m=>`--${m}`)),n.length>1?`
6
+ `),c=" ".repeat(n),f="\\s\u200B",b=new RegExp(`
7
+ |.{1,${l-1}}([${f}]|$)|[^${f}]+?([${f}]|$)`,"g"),d=a.match(b)||[];return o+d.map((w,$)=>w===`
8
+ `?"":($>0?c:"")+w.trimEnd()).join(`
9
+ `)}};ue.Help=M});var B=_(U=>{var{InvalidArgumentError:Tt}=V(),R=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=qt(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 Tt(`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 It(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 s=this.negativeOptions.get(n).presetArg,r=s!==void 0?s:!1;return t.negate===(r===e)}};function It(i){return i.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function qt(i){let e,t,n=i.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}}U.Option=R;U.DualOptions=W});var pe=_(he=>{function Ft(i,e){if(Math.abs(i.length-e.length)>3)return Math.max(i.length,e.length);let t=[];for(let n=0;n<=i.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 s=1;s<=i.length;s++){let r=1;i[s-1]===e[n-1]?r=0:r=1,t[s][n]=Math.min(t[s-1][n]+1,t[s][n-1]+1,t[s-1][n-1]+r),s>1&&n>1&&i[s-1]===e[n-2]&&i[s-2]===e[n-1]&&(t[s][n]=Math.min(t[s][n],t[s-2][n-2]+1))}return t[i.length][e.length]}function Dt(i,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=i.startsWith("--");t&&(i=i.slice(2),e=e.map(m=>m.slice(2)));let n=[],s=3,r=.4;return e.forEach(m=>{if(m.length<=1)return;let l=Ft(i,m),o=Math.max(i.length,m.length);(o-l)/o>r&&(l<s?(s=l,n=[m]):l===s&&n.push(m))}),n.sort((m,l)=>m.localeCompare(l)),t&&(n=n.map(m=>`--${m}`)),n.length>1?`
10
10
  (Did you mean one of ${n.join(", ")}?)`:n.length===1?`
11
- (Did you mean ${n[0]}?)`:""}le.suggestSimilar=Ht});var fe=_(de=>{var Nt=require("events").EventEmitter,G=require("child_process"),w=require("path"),B=require("fs"),g=require("process"),{Argument:Pt,humanReadableArgName:jt}=H(),{CommanderError:z}=k(),{Help:Tt}=M(),{Option:ue,DualOptions:qt}=U(),{suggestSimilar:he}=ce(),J=class s extends Nt{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,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=>g.stdout.write(t),writeErr:t=>g.stderr.write(t),getOutHelpWidth:()=>g.stdout.isTTY?g.stdout.columns:void 0,getErrHelpWidth:()=>g.stderr.isTTY?g.stderr.columns:void 0,outputError:(t,n)=>n(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,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}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let i=t,r=n;typeof i=="object"&&i!==null&&(r=i,i=null),r=r||{};let[,m,a]=e.match(/([^ ]+) *(.*)/),o=this.createCommand(m);return i&&(o.description(i),o._executableHandler=!0),r.isDefault&&(this._defaultCommandName=o._name),o._hidden=!!(r.noHelp||r.hidden),o._executableFile=r.executableFile||null,a&&o.arguments(a),this._registerCommand(o),o.parent=this,o.copyInheritedSettings(this),i?this:o}createCommand(e){return new s(e)}createHelp(){return Object.assign(new Tt,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
12
- - 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._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new Pt(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.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.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.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,n,i]=e.match(/([^ ]+) *(.*)/),r=t??"display help for command",m=this.createCommand(n);return m.helpOption(!1),i&&m.arguments(i),r&&m.description(r),this._addImplicitHelpCommand=!0,this._helpCommand=m,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
13
- 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 z(e,t,n)),g.exit(e)}action(e){let t=n=>{let i=this.registeredArguments.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 ue(e,t)}_callParseArg(e,t,n,i){try{return e.parseArg(t,n)}catch(r){if(r.code==="commander.invalidArgument"){let m=`${i} ${r.message}`;this.error(m,{exitCode:r.exitCode,code:r.code})}throw r}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
14
- - already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=i=>[i.name()].concat(i.aliases()),n=t(e).find(i=>this._findCommand(i));if(n){let i=t(this._findCommand(n)).join("|"),r=t(e).join("|");throw new Error(`cannot add command '${r}' as already have command '${i}'`)}this.commands.push(e)}addOption(e){this._registerOption(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");let i=(r,m,a)=>{r==null&&e.presetArg!==void 0&&(r=e.presetArg);let o=this.getOptionValue(n);r!==null&&e.parseArg?r=this._callParseArg(e,r,o,m):r!==null&&e.variadic&&(r=e._concatValue(r,o)),r==null&&(e.negate?r=!1:e.isBoolean()||e.optional?r=!0:r=""),this.setOptionValueWithSource(n,r,a)};return this.on("option:"+t,r=>{let m=`error: option '${e.flags}' argument '${r}' is invalid.`;i(r,m,"cli")}),e.envVar&&this.on("optionEnv:"+t,r=>{let m=`error: option '${e.flags}' value '${r}' from env '${e.envVar}' is invalid.`;i(r,m,"env")}),this}_optionEx(e,t,n,i,r){if(typeof t=="object"&&t instanceof ue)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let m=this.createOption(t,n);if(m.makeOptionMandatory(!!e.mandatory),typeof i=="function")m.default(r).argParser(i);else if(i instanceof RegExp){let a=i;i=(o,l)=>{let c=a.exec(o);return c?c[0]:l},m.default(r).argParser(i)}else m.default(i);return this.addOption(m)}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){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,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 this._getCommandAndAncestors().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=g.argv,g.versions&&g.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":g.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(c,u){let h=w.resolve(c,u);if(B.existsSync(h))return h;if(i.includes(w.extname(u)))return;let O=i.find(p=>B.existsSync(`${h}${p}`));if(O)return`${h}${O}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let m=e._executableFile||`${this._name}-${e._name}`,a=this._executableDir||"";if(this._scriptPath){let c;try{c=B.realpathSync(this._scriptPath)}catch{c=this._scriptPath}a=w.resolve(w.dirname(c),a)}if(a){let c=r(a,m);if(!c&&!e._executableFile&&this._scriptPath){let u=w.basename(this._scriptPath,w.extname(this._scriptPath));u!==this._name&&(c=r(a,`${u}-${e._name}`))}m=c||m}n=i.includes(w.extname(m));let o;g.platform!=="win32"?n?(t.unshift(m),t=pe(g.execArgv).concat(t),o=G.spawn(g.argv[0],t,{stdio:"inherit"})):o=G.spawn(m,t,{stdio:"inherit"}):(t.unshift(m),t=pe(g.execArgv).concat(t),o=G.spawn(g.execPath,t,{stdio:"inherit"})),o.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(u=>{g.on(u,()=>{o.killed===!1&&o.exitCode===null&&o.kill(u)})});let l=this._exitCallback;o.on("close",(c,u)=>{c=c??1,l?l(new z(c,"commander.executeSubCommandAsync","(close)")):g.exit(c)}),o.on("error",c=>{if(c.code==="ENOENT"){let u=a?`searched for local subcommand relative to directory '${a}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",h=`'${m}' does not exist
11
+ (Did you mean ${n[0]}?)`:""}he.suggestSimilar=Dt});var be=_(_e=>{var Mt=require("events").EventEmitter,G=require("child_process"),O=require("path"),z=require("fs"),g=require("process"),{Argument:Lt,humanReadableArgName:Rt}=P(),{CommanderError:J}=V(),{Help:Wt}=L(),{Option:de,DualOptions:Ut}=B(),{suggestSimilar:fe}=pe(),K=class i extends Mt{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,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=>g.stdout.write(t),writeErr:t=>g.stderr.write(t),getOutHelpWidth:()=>g.stdout.isTTY?g.stdout.columns:void 0,getErrHelpWidth:()=>g.stderr.isTTY?g.stderr.columns:void 0,outputError:(t,n)=>n(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,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}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let s=t,r=n;typeof s=="object"&&s!==null&&(r=s,s=null),r=r||{};let[,m,l]=e.match(/([^ ]+) *(.*)/),o=this.createCommand(m);return s&&(o.description(s),o._executableHandler=!0),r.isDefault&&(this._defaultCommandName=o._name),o._hidden=!!(r.noHelp||r.hidden),o._executableFile=r.executableFile||null,l&&o.arguments(l),this._registerCommand(o),o.parent=this,o.copyInheritedSettings(this),s?this:o}createCommand(e){return new i(e)}createHelp(){return Object.assign(new Wt,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
12
+ - 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._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new Lt(e,t)}argument(e,t,n,s){let r=this.createArgument(e,t);return typeof n=="function"?r.default(s).argParser(n):r.default(n),this.addArgument(r),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.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.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,n,s]=e.match(/([^ ]+) *(.*)/),r=t??"display help for command",m=this.createCommand(n);return m.helpOption(!1),s&&m.arguments(s),r&&m.description(r),this._addImplicitHelpCommand=!0,this._helpCommand=m,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let n=["preSubcommand","preAction","postAction"];if(!n.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
13
+ 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 J(e,t,n)),g.exit(e)}action(e){let t=n=>{let s=this.registeredArguments.length,r=n.slice(0,s);return this._storeOptionsAsProperties?r[s]=this:r[s]=this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new de(e,t)}_callParseArg(e,t,n,s){try{return e.parseArg(t,n)}catch(r){if(r.code==="commander.invalidArgument"){let m=`${s} ${r.message}`;this.error(m,{exitCode:r.exitCode,code:r.code})}throw r}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
14
+ - already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=s=>[s.name()].concat(s.aliases()),n=t(e).find(s=>this._findCommand(s));if(n){let s=t(this._findCommand(n)).join("|"),r=t(e).join("|");throw new Error(`cannot add command '${r}' as already have command '${s}'`)}this.commands.push(e)}addOption(e){this._registerOption(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");let s=(r,m,l)=>{r==null&&e.presetArg!==void 0&&(r=e.presetArg);let o=this.getOptionValue(n);r!==null&&e.parseArg?r=this._callParseArg(e,r,o,m):r!==null&&e.variadic&&(r=e._concatValue(r,o)),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 m=`error: option '${e.flags}' argument '${r}' is invalid.`;s(r,m,"cli")}),e.envVar&&this.on("optionEnv:"+t,r=>{let m=`error: option '${e.flags}' value '${r}' from env '${e.envVar}' is invalid.`;s(r,m,"env")}),this}_optionEx(e,t,n,s,r){if(typeof t=="object"&&t instanceof de)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let m=this.createOption(t,n);if(m.makeOptionMandatory(!!e.mandatory),typeof s=="function")m.default(r).argParser(s);else if(s instanceof RegExp){let l=s;s=(o,a)=>{let c=l.exec(o);return c?c[0]:a},m.default(r).argParser(s)}else m.default(s);return this.addOption(m)}option(e,t,n,s){return this._optionEx({},e,t,n,s)}requiredOption(e,t,n,s){return this._optionEx({mandatory:!0},e,t,n,s)}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){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,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 this._getCommandAndAncestors().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=g.argv,g.versions&&g.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":g.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,s=[".js",".ts",".tsx",".mjs",".cjs"];function r(c,h){let f=O.resolve(c,h);if(z.existsSync(f))return f;if(s.includes(O.extname(h)))return;let b=s.find(d=>z.existsSync(`${f}${d}`));if(b)return`${f}${b}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let m=e._executableFile||`${this._name}-${e._name}`,l=this._executableDir||"";if(this._scriptPath){let c;try{c=z.realpathSync(this._scriptPath)}catch{c=this._scriptPath}l=O.resolve(O.dirname(c),l)}if(l){let c=r(l,m);if(!c&&!e._executableFile&&this._scriptPath){let h=O.basename(this._scriptPath,O.extname(this._scriptPath));h!==this._name&&(c=r(l,`${h}-${e._name}`))}m=c||m}n=s.includes(O.extname(m));let o;g.platform!=="win32"?n?(t.unshift(m),t=ge(g.execArgv).concat(t),o=G.spawn(g.argv[0],t,{stdio:"inherit"})):o=G.spawn(m,t,{stdio:"inherit"}):(t.unshift(m),t=ge(g.execArgv).concat(t),o=G.spawn(g.execPath,t,{stdio:"inherit"})),o.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(h=>{g.on(h,()=>{o.killed===!1&&o.exitCode===null&&o.kill(h)})});let a=this._exitCallback;o.on("close",(c,h)=>{c=c??1,a?a(new J(c,"commander.executeSubCommandAsync","(close)")):g.exit(c)}),o.on("error",c=>{if(c.code==="ENOENT"){let h=l?`searched for local subcommand relative to directory '${l}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",f=`'${m}' does not exist
15
15
  - if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
16
16
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
17
- - ${u}`;throw new Error(h)}else if(c.code==="EACCES")throw new Error(`'${m}' not executable`);if(!l)g.exit(1);else{let u=new z(1,"commander.executeSubCommandAsync","(error)");u.nestedError=c,l(u)}}),this.runningCommand=o}_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}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,i,r)=>{let m=i;if(i!==null&&n.parseArg){let a=`error: command-argument value '${i}' is invalid for argument '${n.name()}'.`;m=this._callParseArg(n,i,r,a)}return m};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,i)=>{let r=n.defaultValue;n.variadic?i<this.args.length?(r=this.args.slice(i),n.parseArg&&(r=r.reduce((m,a)=>e(n,a,m),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 this._getCommandAndAncestors().reverse().filter(r=>r._lifeCycleHooks[t]!==void 0).forEach(r=>{r._lifeCycleHooks[t].forEach(m=>{i.push({hookedCommand:r,callback:m})})}),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._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(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 m;return m=this._chainOrCallHooks(m,"preAction"),m=this._chainOrCall(m,()=>this._actionHandler(this.processedArgs)),this.parent&&(m=this._chainOrCall(m,()=>{this.parent.emit(r,e,t)})),m=this._chainOrCallHooks(m,"postAction"),m}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(){this._getCommandAndAncestors().forEach(e=>{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(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],i=t,r=e.slice();function m(o){return o.length>1&&o[0]==="-"}let a=null;for(;r.length;){let o=r.shift();if(o==="--"){i===n&&i.push(o),i.push(...r);break}if(a&&!m(o)){this.emit(`option:${a.name()}`,o);continue}if(a=null,m(o)){let l=this._findOption(o);if(l){if(l.required){let c=r.shift();c===void 0&&this.optionMissingArgument(l),this.emit(`option:${l.name()}`,c)}else if(l.optional){let c=null;r.length>0&&!m(r[0])&&(c=r.shift()),this.emit(`option:${l.name()}`,c)}else this.emit(`option:${l.name()}`);a=l.variadic?l:null;continue}}if(o.length>2&&o[0]==="-"&&o[1]!=="-"){let l=this._findOption(`-${o[1]}`);if(l){l.required||l.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${l.name()}`,o.slice(2)):(this.emit(`option:${l.name()}`),r.unshift(`-${o.slice(2)}`));continue}}if(/^--[^=]+=/.test(o)){let l=o.indexOf("="),c=this._findOption(o.slice(0,l));if(c&&(c.required||c.optional)){this.emit(`option:${c.name()}`,o.slice(l+1));continue}}if(m(o)&&(i=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(o)){t.push(o),r.length>0&&n.push(...r);break}else if(this._getHelpCommand()&&o===this._getHelpCommand().name()){t.push(o),r.length>0&&t.push(...r);break}else if(this._defaultCommandName){n.push(o),r.length>0&&n.push(...r);break}}if(this._passThroughOptions){i.push(o),r.length>0&&i.push(...r);break}i.push(o)}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 this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
17
+ - ${h}`;throw new Error(f)}else if(c.code==="EACCES")throw new Error(`'${m}' not executable`);if(!a)g.exit(1);else{let h=new J(1,"commander.executeSubCommandAsync","(error)");h.nestedError=c,a(h)}}),this.runningCommand=o}_dispatchSubcommand(e,t,n){let s=this._findCommand(e);s||this.help({error:!0});let r;return r=this._chainOrCallSubCommandHook(r,s,"preSubcommand"),r=this._chainOrCall(r,()=>{if(s._executableHandler)this._executeSubCommand(s,t.concat(n));else return s._parseCommand(t,n)}),r}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(n,s,r)=>{let m=s;if(s!==null&&n.parseArg){let l=`error: command-argument value '${s}' is invalid for argument '${n.name()}'.`;m=this._callParseArg(n,s,r,l)}return m};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,s)=>{let r=n.defaultValue;n.variadic?s<this.args.length?(r=this.args.slice(s),n.parseArg&&(r=r.reduce((m,l)=>e(n,l,m),n.defaultValue))):r===void 0&&(r=[]):s<this.args.length&&(r=this.args[s],n.parseArg&&(r=e(n,r,n.defaultValue))),t[s]=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,s=[];return this._getCommandAndAncestors().reverse().filter(r=>r._lifeCycleHooks[t]!==void 0).forEach(r=>{r._lifeCycleHooks[t].forEach(m=>{s.push({hookedCommand:r,callback:m})})}),t==="postAction"&&s.reverse(),s.forEach(r=>{n=this._chainOrCall(n,()=>r.callback(r.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let s=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(r=>{s=this._chainOrCall(s,()=>r(this,t))}),s}_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._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},r=`command:${this.name()}`;if(this._actionHandler){s(),this._processArguments();let m;return m=this._chainOrCallHooks(m,"preAction"),m=this._chainOrCall(m,()=>this._actionHandler(this.processedArgs)),this.parent&&(m=this._chainOrCall(m,()=>{this.parent.emit(r,e,t)})),m=this._chainOrCallHooks(m,"postAction"),m}if(this.parent&&this.parent.listenerCount(r))s(),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():(s(),this._processArguments())}else this.commands.length?(s(),this.help({error:!0})):(s(),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(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(n=>{let s=n.attributeName();return this.getOptionValue(s)===void 0?!1:this.getOptionValueSource(s)!=="default"});e.filter(n=>n.conflictsWith.length>0).forEach(n=>{let s=e.find(r=>n.conflictsWith.includes(r.attributeName()));s&&this._conflictingOption(n,s)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],s=t,r=e.slice();function m(o){return o.length>1&&o[0]==="-"}let l=null;for(;r.length;){let o=r.shift();if(o==="--"){s===n&&s.push(o),s.push(...r);break}if(l&&!m(o)){this.emit(`option:${l.name()}`,o);continue}if(l=null,m(o)){let a=this._findOption(o);if(a){if(a.required){let c=r.shift();c===void 0&&this.optionMissingArgument(a),this.emit(`option:${a.name()}`,c)}else if(a.optional){let c=null;r.length>0&&!m(r[0])&&(c=r.shift()),this.emit(`option:${a.name()}`,c)}else this.emit(`option:${a.name()}`);l=a.variadic?a:null;continue}}if(o.length>2&&o[0]==="-"&&o[1]!=="-"){let a=this._findOption(`-${o[1]}`);if(a){a.required||a.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${a.name()}`,o.slice(2)):(this.emit(`option:${a.name()}`),r.unshift(`-${o.slice(2)}`));continue}}if(/^--[^=]+=/.test(o)){let a=o.indexOf("="),c=this._findOption(o.slice(0,a));if(c&&(c.required||c.optional)){this.emit(`option:${c.name()}`,o.slice(a+1));continue}}if(m(o)&&(s=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(o)){t.push(o),r.length>0&&n.push(...r);break}else if(this._getHelpCommand()&&o===this._getHelpCommand().name()){t.push(o),r.length>0&&t.push(...r);break}else if(this._defaultCommandName){n.push(o),r.length>0&&n.push(...r);break}}if(this._passThroughOptions){s.push(o),r.length>0&&s.push(...r);break}s.push(o)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let s=this.options[n].attributeName();e[s]=s===this._versionOptionName?this._version:this[s]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
18
18
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
19
19
  `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
20
- `),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 g.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()}`,g.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new qt(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=m=>{let a=m.attributeName(),o=this.getOptionValue(a),l=this.options.find(u=>u.negate&&a===u.attributeName()),c=this.options.find(u=>!u.negate&&a===u.attributeName());return l&&(l.presetArg===void 0&&o===!1||l.presetArg!==void 0&&o===l.presetArg)?l:c||m},i=m=>{let a=n(m),o=a.attributeName();return this.getOptionValueSource(o)==="env"?`environment variable '${a.envVar}'`:`option '${a.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 m=r.createHelp().visibleOptions(r).filter(a=>a.long).map(a=>a.long);i=i.concat(m),r=r.parent}while(r&&!r._enablePositionalOptions);t=he(e,i)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.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=he(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._registerOption(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e}
21
- `),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");let n=this.parent?._findCommand(e);if(n){let i=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${i}'`)}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.registeredArguments.map(n=>jt(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.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=w.basename(e,w.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);this._getCommandAndAncestors().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._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach(r=>r.emit("afterAllHelp",n))}helpOption(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=g.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.
22
- Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,r=>{let m;typeof t=="function"?m=t({error:r.error,command:r.command}):m=t,m&&r.write(`${m}
23
- `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(i=>t.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function pe(s){return s.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})}de.Command=J});var be=_(y=>{var{Argument:ge}=H(),{Command:K}=fe(),{CommanderError:Dt,InvalidArgumentError:_e}=k(),{Help:It}=M(),{Option:Oe}=U();y.program=new K;y.createCommand=s=>new K(s);y.createOption=(s,e)=>new Oe(s,e);y.createArgument=(s,e)=>new ge(s,e);y.Command=K;y.Option=Oe;y.Argument=ge;y.Help=It;y.CommanderError=Dt;y.InvalidArgumentError=_e;y.InvalidOptionArgumentError=_e});var xe=_((Dn,ve)=>{ve.exports=Ee;Ee.sync=Mt;var Ce=require("fs");function Ft(s,e){var t=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!t||(t=t.split(";"),t.indexOf("")!==-1))return!0;for(var n=0;n<t.length;n++){var i=t[n].toLowerCase();if(i&&s.substr(-i.length).toLowerCase()===i)return!0}return!1}function Ae(s,e,t){return!s.isSymbolicLink()&&!s.isFile()?!1:Ft(e,t)}function Ee(s,e,t){Ce.stat(s,function(n,i){t(n,n?!1:Ae(i,s,e))})}function Mt(s,e){return Ae(Ce.statSync(s),s,e)}});var He=_((In,Ve)=>{Ve.exports=ke;ke.sync=Wt;var Se=require("fs");function ke(s,e,t){Se.stat(s,function(n,i){t(n,n?!1:$e(i,e))})}function Wt(s,e){return $e(Se.statSync(s),e)}function $e(s,e){return s.isFile()&&Lt(s,e)}function Lt(s,e){var t=s.mode,n=s.uid,i=s.gid,r=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),m=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),o=parseInt("010",8),l=parseInt("001",8),c=a|o,u=t&l||t&o&&i===m||t&a&&n===r||t&c&&r===0;return u}});var Pe=_((Mn,Ne)=>{var Fn=require("fs"),N;process.platform==="win32"||global.TESTING_WINDOWS?N=xe():N=He();Ne.exports=Y;Y.sync=Rt;function Y(s,e,t){if(typeof e=="function"&&(t=e,e={}),!t){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,i){Y(s,e||{},function(r,m){r?i(r):n(m)})})}N(s,e||{},function(n,i){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,i=!1),t(n,i)})}function Rt(s,e){try{return N.sync(s,e||{})}catch(t){if(e&&e.ignoreErrors||t.code==="EACCES")return!1;throw t}}});var Me=_((Wn,Fe)=>{var E=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",je=require("path"),Ut=E?";":":",Te=Pe(),qe=s=>Object.assign(new Error(`not found: ${s}`),{code:"ENOENT"}),De=(s,e)=>{let t=e.colon||Ut,n=s.match(/\//)||E&&s.match(/\\/)?[""]:[...E?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(t)],i=E?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",r=E?i.split(t):[""];return E&&s.indexOf(".")!==-1&&r[0]!==""&&r.unshift(""),{pathEnv:n,pathExt:r,pathExtExe:i}},Ie=(s,e,t)=>{typeof e=="function"&&(t=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:r}=De(s,e),m=[],a=l=>new Promise((c,u)=>{if(l===n.length)return e.all&&m.length?c(m):u(qe(s));let h=n[l],O=/^".*"$/.test(h)?h.slice(1,-1):h,p=je.join(O,s),b=!O&&/^\.[\\\/]/.test(s)?s.slice(0,2)+p:p;c(o(b,l,0))}),o=(l,c,u)=>new Promise((h,O)=>{if(u===i.length)return h(a(c+1));let p=i[u];Te(l+p,{pathExt:r},(b,S)=>{if(!b&&S)if(e.all)m.push(l+p);else return h(l+p);return h(o(l,c,u+1))})});return t?a(0).then(l=>t(null,l),t):a(0)},Gt=(s,e)=>{e=e||{};let{pathEnv:t,pathExt:n,pathExtExe:i}=De(s,e),r=[];for(let m=0;m<t.length;m++){let a=t[m],o=/^".*"$/.test(a)?a.slice(1,-1):a,l=je.join(o,s),c=!o&&/^\.[\\\/]/.test(s)?s.slice(0,2)+l:l;for(let u=0;u<n.length;u++){let h=c+n[u];try{if(Te.sync(h,{pathExt:i}))if(e.all)r.push(h);else return h}catch{}}}if(e.all&&r.length)return r;if(e.nothrow)return null;throw qe(s)};Fe.exports=Ie;Ie.sync=Gt});var Le=_((Ln,X)=>{"use strict";var We=(s={})=>{let e=s.env||process.env;return(s.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};X.exports=We;X.exports.default=We});var Be=_((Rn,Ge)=>{"use strict";var Re=require("path"),Bt=Me(),zt=Le();function Ue(s,e){let t=s.options.env||process.env,n=process.cwd(),i=s.options.cwd!=null,r=i&&process.chdir!==void 0&&!process.chdir.disabled;if(r)try{process.chdir(s.options.cwd)}catch{}let m;try{m=Bt.sync(s.command,{path:t[zt({env:t})],pathExt:e?Re.delimiter:void 0})}catch{}finally{r&&process.chdir(n)}return m&&(m=Re.resolve(i?s.options.cwd:"",m)),m}function Jt(s){return Ue(s)||Ue(s,!0)}Ge.exports=Jt});var ze=_((Un,Q)=>{"use strict";var Z=/([()\][%!^"`<>&|;, *?])/g;function Kt(s){return s=s.replace(Z,"^$1"),s}function Yt(s,e){return s=`${s}`,s=s.replace(/(\\*)"/g,'$1$1\\"'),s=s.replace(/(\\*)$/,"$1$1"),s=`"${s}"`,s=s.replace(Z,"^$1"),e&&(s=s.replace(Z,"^$1")),s}Q.exports.command=Kt;Q.exports.argument=Yt});var Ke=_((Gn,Je)=>{"use strict";Je.exports=/^#!(.*)/});var Xe=_((Bn,Ye)=>{"use strict";var Xt=Ke();Ye.exports=(s="")=>{let e=s.match(Xt);if(!e)return null;let[t,n]=e[0].replace(/#! ?/,"").split(" "),i=t.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var Qe=_((zn,Ze)=>{"use strict";var ee=require("fs"),Zt=Xe();function Qt(s){let t=Buffer.alloc(150),n;try{n=ee.openSync(s,"r"),ee.readSync(n,t,0,150,0),ee.closeSync(n)}catch{}return Zt(t.toString())}Ze.exports=Qt});var it=_((Jn,nt)=>{"use strict";var en=require("path"),et=Be(),tt=ze(),tn=Qe(),nn=process.platform==="win32",sn=/\.(?:com|exe)$/i,rn=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function mn(s){s.file=et(s);let e=s.file&&tn(s.file);return e?(s.args.unshift(s.file),s.command=e,et(s)):s.file}function on(s){if(!nn)return s;let e=mn(s),t=!sn.test(e);if(s.options.forceShell||t){let n=rn.test(e);s.command=en.normalize(s.command),s.command=tt.command(s.command),s.args=s.args.map(r=>tt.argument(r,n));let i=[s.command].concat(s.args).join(" ");s.args=["/d","/s","/c",`"${i}"`],s.command=process.env.comspec||"cmd.exe",s.options.windowsVerbatimArguments=!0}return s}function an(s,e,t){e&&!Array.isArray(e)&&(t=e,e=null),e=e?e.slice(0):[],t=Object.assign({},t);let n={command:s,args:e,options:t,file:void 0,original:{command:s,args:e}};return t.shell?n:on(n)}nt.exports=an});var mt=_((Kn,rt)=>{"use strict";var te=process.platform==="win32";function ne(s,e){return Object.assign(new Error(`${e} ${s.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${s.command}`,path:s.command,spawnargs:s.args})}function ln(s,e){if(!te)return;let t=s.emit;s.emit=function(n,i){if(n==="exit"){let r=st(i,e,"spawn");if(r)return t.call(s,"error",r)}return t.apply(s,arguments)}}function st(s,e){return te&&s===1&&!e.file?ne(e.original,"spawn"):null}function cn(s,e){return te&&s===1&&!e.file?ne(e.original,"spawnSync"):null}rt.exports={hookChildProcess:ln,verifyENOENT:st,verifyENOENTSync:cn,notFoundError:ne}});var lt=_((Yn,v)=>{"use strict";var ot=require("child_process"),ie=it(),se=mt();function at(s,e,t){let n=ie(s,e,t),i=ot.spawn(n.command,n.args,n.options);return se.hookChildProcess(i,n),i}function un(s,e,t){let n=ie(s,e,t),i=ot.spawnSync(n.command,n.args,n.options);return i.error=i.error||se.verifyENOENTSync(i.status,n),i}v.exports=at;v.exports.spawn=at;v.exports.sync=un;v.exports._parse=ie;v.exports._enoent=se});var ye=A(be(),1),{program:Sn,createCommand:kn,createArgument:$n,createOption:Vn,CommanderError:Hn,InvalidArgumentError:Nn,InvalidOptionArgumentError:Pn,Command:we,Argument:jn,Option:C,Help:Tn}=ye.default;var j=A(lt()),d=A(require("fs")),gt=A(require("os")),f=A(require("path"));var P="1.0.3";var ut=()=>{$(),console.log(`
20
+ `),this.outputHelp({error:!0}));let n=t||{},s=n.exitCode||1,r=n.code||"commander.error";this._exit(s,r,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in g.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()}`,g.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Ut(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(s=>!t(s)).forEach(s=>{this.setOptionValueWithSource(s,n.implied[s],"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=m=>{let l=m.attributeName(),o=this.getOptionValue(l),a=this.options.find(h=>h.negate&&l===h.attributeName()),c=this.options.find(h=>!h.negate&&l===h.attributeName());return a&&(a.presetArg===void 0&&o===!1||a.presetArg!==void 0&&o===a.presetArg)?a:c||m},s=m=>{let l=n(m),o=l.attributeName();return this.getOptionValueSource(o)==="env"?`environment variable '${l.envVar}'`:`option '${l.flags}'`},r=`error: ${s(e)} cannot be used with ${s(t)}`;this.error(r,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let s=[],r=this;do{let m=r.createHelp().visibleOptions(r).filter(l=>l.long).map(l=>l.long);s=s.concat(m),r=r.parent}while(r&&!r._enablePositionalOptions);t=fe(e,s)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.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 s=[];this.createHelp().visibleCommands(this).forEach(r=>{s.push(r.name()),r.alias()&&s.push(r.alias())}),t=fe(e,s)}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 s=this.createOption(t,n);return this._versionOptionName=s.attributeName(),this._registerOption(s),this.on("option:"+s.name(),()=>{this._outputConfiguration.writeOut(`${e}
21
+ `),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");let n=this.parent?._findCommand(e);if(n){let s=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${s}'`)}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.registeredArguments.map(n=>Rt(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.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=O.basename(e,O.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=s=>this._outputConfiguration.writeErr(s):n=s=>this._outputConfiguration.writeOut(s),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);this._getCommandAndAncestors().reverse().forEach(r=>r.emit("beforeAllHelp",n)),this.emit("beforeHelp",n);let s=this.helpInformation(n);if(t&&(s=t(s),typeof s!="string"&&!Buffer.isBuffer(s)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(s),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",n),this._getCommandAndAncestors().forEach(r=>r.emit("afterAllHelp",n))}helpOption(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=g.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.
22
+ Expecting one of '${n.join("', '")}'`);let s=`${e}Help`;return this.on(s,r=>{let m;typeof t=="function"?m=t({error:r.error,command:r.command}):m=t,m&&r.write(`${m}
23
+ `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(s=>t.is(s))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function ge(i){return i.map(e=>{if(!e.startsWith("--inspect"))return e;let t,n="127.0.0.1",s="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])?s=r[3]:n=r[3]):(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=r[1],n=r[3],s=r[4]),t&&s!=="0"?`${t}=${n}:${parseInt(s)+1}`:e})}_e.Command=K});var Ae=_(y=>{var{Argument:we}=P(),{Command:Y}=be(),{CommanderError:Bt,InvalidArgumentError:ye}=V(),{Help:Gt}=L(),{Option:Oe}=B();y.program=new Y;y.createCommand=i=>new Y(i);y.createOption=(i,e)=>new Oe(i,e);y.createArgument=(i,e)=>new we(i,e);y.Command=Y;y.Option=Oe;y.Argument=we;y.Help=Gt;y.CommanderError=Bt;y.InvalidArgumentError=ye;y.InvalidOptionArgumentError=ye});var $e=_((Zn,ke)=>{ke.exports=Se;Se.sync=Jt;var ve=require("fs");function zt(i,e){var t=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!t||(t=t.split(";"),t.indexOf("")!==-1))return!0;for(var n=0;n<t.length;n++){var s=t[n].toLowerCase();if(s&&i.substr(-s.length).toLowerCase()===s)return!0}return!1}function xe(i,e,t){return!i.isSymbolicLink()&&!i.isFile()?!1:zt(e,t)}function Se(i,e,t){ve.stat(i,function(n,s){t(n,n?!1:xe(s,i,e))})}function Jt(i,e){return xe(ve.statSync(i),i,e)}});var je=_((Qn,Pe)=>{Pe.exports=Ne;Ne.sync=Kt;var Ve=require("fs");function Ne(i,e,t){Ve.stat(i,function(n,s){t(n,n?!1:He(s,e))})}function Kt(i,e){return He(Ve.statSync(i),e)}function He(i,e){return i.isFile()&&Yt(i,e)}function Yt(i,e){var t=i.mode,n=i.uid,s=i.gid,r=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),m=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),l=parseInt("100",8),o=parseInt("010",8),a=parseInt("001",8),c=l|o,h=t&a||t&o&&s===m||t&l&&n===r||t&c&&r===0;return h}});var Ie=_((ti,Te)=>{var ei=require("fs"),j;process.platform==="win32"||global.TESTING_WINDOWS?j=$e():j=je();Te.exports=X;X.sync=Xt;function X(i,e,t){if(typeof e=="function"&&(t=e,e={}),!t){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,s){X(i,e||{},function(r,m){r?s(r):n(m)})})}j(i,e||{},function(n,s){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,s=!1),t(n,s)})}function Xt(i,e){try{return j.sync(i,e||{})}catch(t){if(e&&e.ignoreErrors||t.code==="EACCES")return!1;throw t}}});var We=_((ni,Re)=>{var x=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",qe=require("path"),Zt=x?";":":",Fe=Ie(),De=i=>Object.assign(new Error(`not found: ${i}`),{code:"ENOENT"}),Me=(i,e)=>{let t=e.colon||Zt,n=i.match(/\//)||x&&i.match(/\\/)?[""]:[...x?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(t)],s=x?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",r=x?s.split(t):[""];return x&&i.indexOf(".")!==-1&&r[0]!==""&&r.unshift(""),{pathEnv:n,pathExt:r,pathExtExe:s}},Le=(i,e,t)=>{typeof e=="function"&&(t=e,e={}),e||(e={});let{pathEnv:n,pathExt:s,pathExtExe:r}=Me(i,e),m=[],l=a=>new Promise((c,h)=>{if(a===n.length)return e.all&&m.length?c(m):h(De(i));let f=n[a],b=/^".*"$/.test(f)?f.slice(1,-1):f,d=qe.join(b,i),w=!b&&/^\.[\\\/]/.test(i)?i.slice(0,2)+d:d;c(o(w,a,0))}),o=(a,c,h)=>new Promise((f,b)=>{if(h===s.length)return f(l(c+1));let d=s[h];Fe(a+d,{pathExt:r},(w,$)=>{if(!w&&$)if(e.all)m.push(a+d);else return f(a+d);return f(o(a,c,h+1))})});return t?l(0).then(a=>t(null,a),t):l(0)},Qt=(i,e)=>{e=e||{};let{pathEnv:t,pathExt:n,pathExtExe:s}=Me(i,e),r=[];for(let m=0;m<t.length;m++){let l=t[m],o=/^".*"$/.test(l)?l.slice(1,-1):l,a=qe.join(o,i),c=!o&&/^\.[\\\/]/.test(i)?i.slice(0,2)+a:a;for(let h=0;h<n.length;h++){let f=c+n[h];try{if(Fe.sync(f,{pathExt:s}))if(e.all)r.push(f);else return f}catch{}}}if(e.all&&r.length)return r;if(e.nothrow)return null;throw De(i)};Re.exports=Le;Le.sync=Qt});var Be=_((ii,Z)=>{"use strict";var Ue=(i={})=>{let e=i.env||process.env;return(i.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};Z.exports=Ue;Z.exports.default=Ue});var Ke=_((si,Je)=>{"use strict";var Ge=require("path"),en=We(),tn=Be();function ze(i,e){let t=i.options.env||process.env,n=process.cwd(),s=i.options.cwd!=null,r=s&&process.chdir!==void 0&&!process.chdir.disabled;if(r)try{process.chdir(i.options.cwd)}catch{}let m;try{m=en.sync(i.command,{path:t[tn({env:t})],pathExt:e?Ge.delimiter:void 0})}catch{}finally{r&&process.chdir(n)}return m&&(m=Ge.resolve(s?i.options.cwd:"",m)),m}function nn(i){return ze(i)||ze(i,!0)}Je.exports=nn});var Ye=_((ri,ee)=>{"use strict";var Q=/([()\][%!^"`<>&|;, *?])/g;function sn(i){return i=i.replace(Q,"^$1"),i}function rn(i,e){return i=`${i}`,i=i.replace(/(\\*)"/g,'$1$1\\"'),i=i.replace(/(\\*)$/,"$1$1"),i=`"${i}"`,i=i.replace(Q,"^$1"),e&&(i=i.replace(Q,"^$1")),i}ee.exports.command=sn;ee.exports.argument=rn});var Ze=_((mi,Xe)=>{"use strict";Xe.exports=/^#!(.*)/});var et=_((oi,Qe)=>{"use strict";var mn=Ze();Qe.exports=(i="")=>{let e=i.match(mn);if(!e)return null;let[t,n]=e[0].replace(/#! ?/,"").split(" "),s=t.split("/").pop();return s==="env"?n:n?`${s} ${n}`:s}});var nt=_((ai,tt)=>{"use strict";var te=require("fs"),on=et();function an(i){let t=Buffer.alloc(150),n;try{n=te.openSync(i,"r"),te.readSync(n,t,0,150,0),te.closeSync(n)}catch{}return on(t.toString())}tt.exports=an});var mt=_((li,rt)=>{"use strict";var ln=require("path"),it=Ke(),st=Ye(),cn=nt(),un=process.platform==="win32",hn=/\.(?:com|exe)$/i,pn=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function dn(i){i.file=it(i);let e=i.file&&cn(i.file);return e?(i.args.unshift(i.file),i.command=e,it(i)):i.file}function fn(i){if(!un)return i;let e=dn(i),t=!hn.test(e);if(i.options.forceShell||t){let n=pn.test(e);i.command=ln.normalize(i.command),i.command=st.command(i.command),i.args=i.args.map(r=>st.argument(r,n));let s=[i.command].concat(i.args).join(" ");i.args=["/d","/s","/c",`"${s}"`],i.command=process.env.comspec||"cmd.exe",i.options.windowsVerbatimArguments=!0}return i}function gn(i,e,t){e&&!Array.isArray(e)&&(t=e,e=null),e=e?e.slice(0):[],t=Object.assign({},t);let n={command:i,args:e,options:t,file:void 0,original:{command:i,args:e}};return t.shell?n:fn(n)}rt.exports=gn});var lt=_((ci,at)=>{"use strict";var ne=process.platform==="win32";function ie(i,e){return Object.assign(new Error(`${e} ${i.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${i.command}`,path:i.command,spawnargs:i.args})}function _n(i,e){if(!ne)return;let t=i.emit;i.emit=function(n,s){if(n==="exit"){let r=ot(s,e,"spawn");if(r)return t.call(i,"error",r)}return t.apply(i,arguments)}}function ot(i,e){return ne&&i===1&&!e.file?ie(e.original,"spawn"):null}function bn(i,e){return ne&&i===1&&!e.file?ie(e.original,"spawnSync"):null}at.exports={hookChildProcess:_n,verifyENOENT:ot,verifyENOENTSync:bn,notFoundError:ie}});var ht=_((ui,S)=>{"use strict";var ct=require("child_process"),se=mt(),re=lt();function ut(i,e,t){let n=se(i,e,t),s=ct.spawn(n.command,n.args,n.options);return re.hookChildProcess(s,n),s}function wn(i,e,t){let n=se(i,e,t),s=ct.spawnSync(n.command,n.args,n.options);return s.error=s.error||re.verifyENOENTSync(s.status,n),s}S.exports=ut;S.exports.spawn=ut;S.exports.sync=wn;S.exports._parse=se;S.exports._enoent=re});var Ce=v(Ae(),1),{program:Rn,createCommand:Wn,createArgument:Un,createOption:Bn,CommanderError:Gn,InvalidArgumentError:zn,InvalidOptionArgumentError:Jn,Command:Ee,Argument:Kn,Option:C,Help:Yn}=Ce.default;var E=v(ht()),p=v(require("fs")),Et=v(require("os")),u=v(require("path"));var yn=/[\p{Lu}]/u,On=/[\p{Ll}]/u,pt=/^[\p{Lu}](?![\p{Lu}])/gu,gt=/([\p{Alpha}\p{N}_]|$)/u,me=/[_.\- ]+/,An=new RegExp("^"+me.source),dt=new RegExp(me.source+gt.source,"gu"),ft=new RegExp("\\d+"+gt.source,"gu"),Cn=(i,e,t,n)=>{let s=!1,r=!1,m=!1,l=!1;for(let o=0;o<i.length;o++){let a=i[o];l=o>2?i[o-3]==="-":!0,s&&yn.test(a)?(i=i.slice(0,o)+"-"+i.slice(o),s=!1,m=r,r=!0,o++):r&&m&&On.test(a)&&(!l||n)?(i=i.slice(0,o-1)+"-"+i.slice(o-1),m=r,r=!1,s=!0):(s=e(a)===a&&t(a)!==a,m=r,r=t(a)===a&&e(a)!==a)}return i},En=(i,e)=>(pt.lastIndex=0,i.replaceAll(pt,t=>e(t))),vn=(i,e)=>(dt.lastIndex=0,ft.lastIndex=0,i.replaceAll(ft,(t,n,s)=>["_","-"].includes(i.charAt(s+t.length))?t:e(t)).replaceAll(dt,(t,n)=>e(n)));function oe(i,e){if(!(typeof i=="string"||Array.isArray(i)))throw new TypeError("Expected the input to be `string | string[]`");if(e={pascalCase:!1,preserveConsecutiveUppercase:!1,...e},Array.isArray(i)?i=i.map(r=>r.trim()).filter(r=>r.length).join("-"):i=i.trim(),i.length===0)return"";let t=e.locale===!1?r=>r.toLowerCase():r=>r.toLocaleLowerCase(e.locale),n=e.locale===!1?r=>r.toUpperCase():r=>r.toLocaleUpperCase(e.locale);return i.length===1?me.test(i)?"":e.pascalCase?n(i):t(i):(i!==t(i)&&(i=Cn(i,t,n,e.preserveConsecutiveUppercase)),i=i.replace(An,""),i=e.preserveConsecutiveUppercase?En(i,t):t(i),e.pascalCase&&(i=n(i.charAt(0))+i.slice(1)),vn(i,n))}var T="1.1.1";var bt=()=>{N(),console.log(`
24
24
  \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
25
25
  \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
26
26
  \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
@@ -44,4 +44,4 @@ Expecting one of '${n.join("', '")}'`);let i=`${e}Help`;return this.on(i,r=>{let
44
44
  \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
45
45
  \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m/\x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;016m \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
46
46
  \x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@\x1B[38;5;m@
47
- \x1B[0m`),console.log(""),console.log("---------------------- Seeka Apps CLI ----------------------"),console.log(`-------------------------- v${P} -------------------------`),console.log(""),console.log("https://developers.seeka.co"),console.log("for help: npx @seeka-labs/cli-apps@latest --help"),console.log("for scaffolding help: npx @seeka-labs/cli-apps@latest init --help"),$()},$=()=>{console.log(""),console.log("------------------------------------------------------------"),console.log("")};var x=A(require("fs")),ht=require("os"),pt=s=>/^[a-zA-Z0-9-]+$/.test(s);function dt(s){try{let e=x.opendirSync(s),t=e.readSync();return e.closeSync(),t===null}catch{return!1}}function ft(s){let e={};return!s||s.length===0||s.forEach(t=>{let n=t.indexOf("=");if(n===-1){e[t]="";return}let i=t.substring(0,n),r=t.substring(n+1);e[i]=r}),e}var pn=s=>x.readFileSync(s,"utf-8").split(ht.EOL);var dn=(s,e,t)=>{let n=pn(s),i=n.find(r=>r.split("=")[0]===e);if(i!==void 0){let r=n.indexOf(i);n.splice(r,1,`${e}="${t}"`)}else n.push(`${e}="${t}"`);x.writeFileSync(s,n.join(ht.EOL))},re=(s,e)=>{e&&Object.keys(e).forEach(t=>{dn(s,t,e[t])})};var _t=s=>{if(!pt(s.appName)){console.error("App name must be alphanumeric and hyphens only");return}if(!s.appName.startsWith("seeka-app-")){console.error("App name must start with seeka-app-");return}let e=s.appName,t=f.resolve(s.outputDirectory,s.directoryName||e);console.log(`Creating new ${s.template.replace(/-/g," ")} Seeka app in ${t}`),console.log("");let n=f.resolve(t,".git"),i=d.existsSync(n),r=f.resolve(gt.default.tmpdir(),".seeka-app-init-git-"+new Date().getTime());if(d.existsSync(t)&&dt(t)===!1)if(s.force)console.log("--force was used and destination directory is not empty. Clearing out the directory"),i&&(console.info(".git directory found in directory, I will preserve it and remove all other files and directories to prepare for the app creation"),d.cpSync(n,r,{recursive:!0})),d.rmSync(t,{recursive:!0,force:!0});else{console.error("Directory is not empty. Use --force to create app in non-empty directory");return}d.mkdirSync(t,{recursive:!0}),i&&(d.cpSync(r,n,{recursive:!0}),d.rmSync(r,{recursive:!0}),console.info("Restored .git directory"));let m=f.resolve(__dirname,"init-templates",s.template);d.cpSync(m,t,{recursive:!0}),d.renameSync(f.join(t,".example.gitignore"),f.join(t,".gitignore"));let a=require(f.join(t,"package.json"));a.name=s.appName,a.version=P,a.description=`Seeka app ${s.appName}`,a.author=`${s.developerName} <${s.developerEmail}>`,a.scripts.deploy=a.scripts.deploy.replace(/seeka-app-example-name/i,s.appName),a.scripts.tunnel=a.scripts.tunnel.replace(/seeka-app-example-name/i,s.appName);let o=f.join(t,"README.md"),l=d.readFileSync(o,"utf8");l=l.replace(/seeka-app-example-name/g,s.appName),d.writeFileSync(o,l);let c=f.join(t,".gitlab-ci.yml"),u=d.readFileSync(c,"utf8");switch(u=u.replace(/seeka-app-example-name/g,s.appName),d.writeFileSync(c,u),s.template){case"aws-lambda":On(s,t,a);break;case"azure-function":gn(s,t,a);break;case"netlify-function":_n(s,t,a);break}if(fn(s,a),d.writeFileSync(f.join(t,"package.json"),JSON.stringify(a,null,2)),console.info("Scaffolded package.json"),console.log(""),s.installDependencies)switch(console.info("Installing dependencies with "+s.packageManager),s.packageManager){case"npm":j.sync("npm",["install"],{stdio:"inherit",cwd:t});break;case"pnpm":j.sync("pnpm",["install"],{stdio:"inherit",cwd:t});break;case"yarn":j.sync("yarn",["install"],{stdio:"inherit",cwd:t});break;default:console.error("Invalid package manager");return}$(),console.log(`Created ${e} in ${t}`),console.log("Boom! Your new Seeka app is ready!"),$();let h=f.relative(process.cwd(),t);console.log(`Run "cd ${h}" to change to your apps directory and start creating some magic!`),console.log(""),console.log("")},fn=(s,e)=>{let t;switch(s.packageManager){case"npm":t="npm run";break;case"pnpm":t="pnpm run";break;case"yarn":t="yarn";break;default:console.error("Invalid package manager");return}for(let n in e.scripts)e.scripts[n]=e.scripts[n].replace(/<packageManagerRunPrefix>/g,t);e.dependencies&&e.dependencies["@seeka-labs/sdk-apps-server"]&&(e.dependencies["@seeka-labs/sdk-apps-server"]="^"+e.version)},gn=(s,e,t)=>{if(d.renameSync(f.join(e,"local.settings.example.json"),f.join(e,"local.settings.json")),s.environmentVariables&&Object.keys(s.environmentVariables).length>0){let n=require(f.join(e,"local.settings.json"));n.Values={...n.Values,...s.environmentVariables},d.writeFileSync(f.join(e,"local.settings.json"),JSON.stringify(n,null,2))}console.info("Scaffolded Azure function")},_n=(s,e,t)=>{d.renameSync(f.join(e,".env.example"),f.join(e,".env")),s.environmentVariables&&Object.keys(s.environmentVariables).length>0&&re(f.join(e,".env"),s.environmentVariables),console.info("Scaffolded Netlify function")},On=(s,e,t)=>{d.renameSync(f.join(e,".env.example"),f.join(e,".env")),s.environmentVariables&&Object.keys(s.environmentVariables).length>0&&re(f.join(e,".env"),s.environmentVariables),console.info("Scaffolded AWS lambda function")};var me=new we;ut();me.command("init").description("initialises a new Seeka app").argument("<name>",'name of your app. alphanumeric and hyphens only and must start with "seeka-app-"').addOption(new C("--template <template>","app template").choices(["azure-function","aws-lambda","netlify-function"]).makeOptionMandatory()).addOption(new C("--developer <developer>","app developer name or company").makeOptionMandatory()).addOption(new C("--email <email>","app developer email").makeOptionMandatory()).addOption(new C("--outName [outName]","directory name of the app. a new directory will be created with this name to contain the app.")).addOption(new C("--outDir [outDir]","output directory to create the app in. a new directory will be created here that contains the app.").default("","current working dir")).addOption(new C("--packageManager [packageManager]","package manager").choices(["yarn","npm","pnpm"]).default("yarn")).option("--noDependencies","skip installing dependencies").option("--force","force creation of app in non-empty directory").option("--env [env...]","sets environment variables for the app. Use format of --env KEY1=VALUE1 KEY2=VALUE2").action((s,e)=>{let t={appName:s,template:e.template,outputDirectory:e.outDir||process.cwd(),directoryName:e.outName||void 0,packageManager:e.packageManager,developerEmail:e.email,developerName:e.developer,installDependencies:!e.noDependencies,force:e.force,environmentVariables:ft(e.env)};_t(t)}).showHelpAfterError(!0);me.showHelpAfterError(!0);me.parse();
47
+ \x1B[0m`),console.log(""),console.log("---------------------- Seeka Apps CLI ----------------------"),console.log(`-------------------------- v${T} -------------------------`),console.log(""),console.log("https://developers.seeka.co"),console.log("for help: npx @seeka-labs/cli-apps@latest --help"),console.log("for scaffolding help: npx @seeka-labs/cli-apps@latest init --help"),N()},N=()=>{console.log(""),console.log("------------------------------------------------------------"),console.log("")};var k=v(require("fs")),wt=require("os"),yt=i=>/^[a-zA-Z0-9-]+$/.test(i);function Ot(i){try{let e=k.opendirSync(i),t=e.readSync();return e.closeSync(),t===null}catch{return!1}}function At(i){let e={};return!i||i.length===0||i.forEach(t=>{let n=t.indexOf("=");if(n===-1){e[t]="";return}let s=t.substring(0,n),r=t.substring(n+1);e[s]=r}),e}var Sn=i=>k.readFileSync(i,"utf-8").split(wt.EOL);var kn=(i,e,t)=>{let n=Sn(i),s=n.find(r=>r.split("=")[0]===e);if(s!==void 0){let r=n.indexOf(s);n.splice(r,1,`${e}="${t}"`)}else n.push(`${e}="${t}"`);k.writeFileSync(i,n.join(wt.EOL))},ae=(i,e)=>{e&&Object.keys(e).forEach(t=>{kn(i,t,e[t])})};var vt=i=>{if(!yt(i.appName)){console.error("App name must be alphanumeric and hyphens only");return}if(!i.appName.startsWith("seeka-app-")){console.error("App name must start with seeka-app-");return}let e=i.appName,t=oe(i.appName.replace("seeka-app-",""),{pascalCase:!0}),n=u.resolve(i.outputDirectory,i.directoryName||e);console.log(`Creating new ${i.template.replace(/-/g," ")} Seeka app in ${n}`),console.log("");let s=u.resolve(n,".git"),r=p.existsSync(s),m=u.resolve(Et.default.tmpdir(),".seeka-app-init-git-"+new Date().getTime());if(p.existsSync(n)&&Ot(n)===!1)if(i.force)console.log("--force was used and destination directory is not empty. Clearing out the directory"),r&&(console.info(".git directory found in directory, I will preserve it and remove all other files and directories to prepare for the app creation"),p.cpSync(s,m,{recursive:!0})),p.rmSync(n,{recursive:!0,force:!0});else{console.error("Directory is not empty. Use --force to create app in non-empty directory");return}p.mkdirSync(n,{recursive:!0}),r&&(p.cpSync(m,s,{recursive:!0}),p.rmSync(m,{recursive:!0}),console.info("Restored .git directory"));let l=u.resolve(__dirname,"init-templates"),o=u.resolve(l,i.template);p.cpSync(o,n,{recursive:!0}),p.renameSync(u.join(n,".example.gitignore"),u.join(n,".gitignore"));let a=require(u.join(n,"package.json"));a.name=i.appName,a.version=T,a.description=`Seeka app ${i.appName}`,a.author=`${i.developerName} <${i.developerEmail}>`,a.scripts.deploy=a.scripts.deploy.replace(/seeka-app-example-name/i,i.appName),a.scripts.tunnel=a.scripts.tunnel.replace(/seeka-app-example-name/i,i.appName);let c=u.join(n,"README.md"),h=p.readFileSync(c,"utf8");h=h.replace(/seeka-app-example-name/g,i.appName),p.writeFileSync(c,h);let f=u.join(n,".gitlab-ci.yml"),b=p.readFileSync(f,"utf8");switch(b=b.replace(/seeka-app-example-name/g,i.appName),p.writeFileSync(f,b),i.template){case"aws-lambda":Pn(i,n,a,t);break;case"azure-function":Nn(i,n,a,t);break;case"netlify-function":Hn(i,n,a,t);break}if(A(u.join(n,"src","lib","state","seeka","installations.ts"),{SampleApp:t+"App"}),Vn(i,n,l,t),$n(i,a),p.writeFileSync(u.join(n,"package.json"),JSON.stringify(a,null,2)),console.info("Scaffolded package.json"),console.log(""),i.installDependencies)switch(console.info("Installing dependencies with "+i.packageManager),i.packageManager){case"npm":E.sync("npm",["install"],{stdio:"inherit",cwd:n}),i.browser&&E.sync("npm",["install"],{stdio:"inherit",cwd:u.join(n,"src","browser")});break;case"pnpm":E.sync("pnpm",["install"],{stdio:"inherit",cwd:n}),i.browser&&E.sync("pnpm",["install"],{stdio:"inherit",cwd:u.join(n,"src","browser")});break;case"yarn":E.sync("yarn",["install"],{stdio:"inherit",cwd:n}),i.browser&&E.sync("yarn",["install"],{stdio:"inherit",cwd:u.join(n,"src","browser")});break;default:console.error("Invalid package manager");return}N(),console.log(`Created ${e} in ${n}`),console.log("Boom! Your new Seeka app is ready!"),N();let d=u.relative(process.cwd(),n);console.log(`Run "cd ${d}" to change to your apps directory and start creating some magic!`),console.log(""),console.log("")},$n=(i,e)=>{let t;switch(i.packageManager){case"npm":t="npm run";break;case"pnpm":t="pnpm run";break;case"yarn":t="yarn";break;default:console.error("Invalid package manager");return}for(let n in e.scripts)e.scripts[n]=e.scripts[n].replace(/<packageManagerRunPrefix>/g,t);e.dependencies&&e.dependencies["@seeka-labs/sdk-apps-server"]&&(e.dependencies["@seeka-labs/sdk-apps-server"]="^"+e.version)},Vn=(i,e,t,n)=>{if(!i.browser){Ct(e);return}if(i.template!=="azure-function"){console.warn("Browser plugin is only supported for Azure function template, skipping browser plugin creation"),Ct(e);return}p.mkdirSync(u.join(e,"src","browser"),{recursive:!0}),p.cpSync(u.join(t,"browser"),u.join(e,"src","browser"),{recursive:!0});let s=u.join(e,"src","browser"),r=require(u.join(s,"package.json"));r.name=r.name.replace(/seeka-app-example-name/i,i.appName),r.description=r.description.replace(/seeka-app-example-name/i,i.appName),r.scripts.build=r.scripts.build.replace(/seeka-app-example-name/i,i.appName),r.scripts["build:dev"]=r.scripts["build:dev"].replace(/seeka-app-example-name/i,i.appName),r.scripts.watch=r.scripts.watch.replace(/seeka-app-example-name/i,i.appName),p.writeFileSync(u.join(s,"package.json"),JSON.stringify(r,null,2)),A(u.join(e,"src","lib","browser","index.ts"),{"seeka-app-example-name":i.appName}),A(u.join(s,"README.md"),{"seeka-app-example-name":i.appName}),A(u.join(s,"src","plugin","index.ts"),{"seeka-app-example-name":i.appName,SampleApp:n+"App"}),A(u.join(s,"src","browser.ts"),{SampleApp:n+"App"}),A(u.join(s,"package.json"),{SampleApp:n+"App"}),console.info("Scaffolded browser plugin"),console.log("")},A=(i,e)=>{let t=p.readFileSync(i,"utf8");for(let n in e)t=t.replace(new RegExp(n,"g"),e[n]);p.writeFileSync(i,t)},Ct=i=>{p.rmSync(u.join(i,"src","lib","browser"),{recursive:!0})},Nn=(i,e,t,n)=>{if(p.renameSync(u.join(e,"local.settings.example.json"),u.join(e,"local.settings.json")),i.environmentVariables&&Object.keys(i.environmentVariables).length>0){let s=require(u.join(e,"local.settings.json"));s.Values={...s.Values,...i.environmentVariables},p.writeFileSync(u.join(e,"local.settings.json"),JSON.stringify(s,null,2))}i.browser&&(t.scripts.build="tsc && cd src/browser && yarn && yarn build && cd ../",t.scripts.watch="cd src/browser && yarn && yarn build && cd ../ && tsc -w"),A(u.join(e,"src","lib","browser","models","index.ts"),{SampleApp:n+"App"}),A(u.join(e,"src","lib","browser","index.ts"),{SampleApp:n+"App"}),console.info("Scaffolded Azure function")},Hn=(i,e,t,n)=>{p.renameSync(u.join(e,".env.example"),u.join(e,".env")),i.environmentVariables&&Object.keys(i.environmentVariables).length>0&&ae(u.join(e,".env"),i.environmentVariables),console.info("Scaffolded Netlify function")},Pn=(i,e,t,n)=>{p.renameSync(u.join(e,".env.example"),u.join(e,".env")),i.environmentVariables&&Object.keys(i.environmentVariables).length>0&&ae(u.join(e,".env"),i.environmentVariables),console.info("Scaffolded AWS lambda function")};var le=new Ee;bt();le.command("init").description("initialises a new Seeka app").argument("<name>",'name of your app. alphanumeric and hyphens only and must start with "seeka-app-"').addOption(new C("--template <template>","app template").choices(["azure-function","aws-lambda","netlify-function"]).makeOptionMandatory()).addOption(new C("--developer <developer>","app developer name or company").makeOptionMandatory()).addOption(new C("--email <email>","app developer email").makeOptionMandatory()).addOption(new C("--outName [outName]","directory name of the app. a new directory will be created with this name to contain the app.")).addOption(new C("--outDir [outDir]","output directory to create the app in. a new directory will be created here that contains the app.").default("","current working dir")).addOption(new C("--packageManager [packageManager]","package manager").choices(["yarn","npm","pnpm"]).default("yarn")).option("--noDependencies","skip installing dependencies").option("--force","force creation of app in non-empty directory").option("--browser","adds support for browser plugin served from the app").option("--env [env...]","sets environment variables for the app. Use format of --env KEY1=VALUE1 KEY2=VALUE2").action((i,e)=>{let t={appName:i,template:e.template,browser:e.browser,outputDirectory:e.outDir||process.cwd(),directoryName:e.outName||void 0,packageManager:e.packageManager,developerEmail:e.email,developerName:e.developer,installDependencies:!e.noDependencies,force:e.force,environmentVariables:At(e.env)};vt(t)}).showHelpAfterError(!0);le.showHelpAfterError(!0);le.parse();
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@datalust/winston-seq": "^2.0.0",
26
- "@seeka-labs/sdk-apps-server": "^1.0.1",
26
+ "@seeka-labs/sdk-apps-server": "^1.0.4",
27
27
  "axios": "^1.6.7",
28
28
  "express": "^4.18.2",
29
29
  "lodash-es": "^4.17.21",
@@ -94,6 +94,7 @@ This project comes ready to deploy for free to Azure functions with database bac
94
94
  - Hosting: Consumption
95
95
  - Enable public access: On
96
96
  2. Set environment variables of the Azure web app - reference local.settings.json "Values"
97
+ 3. If your app receives calls directly from the browser (eg. your browser app plugin) then CORS needs to be enabled for all origins from within the settings of the Function app in Azure portal.
97
98
  3. `yarn deploy`
98
99
 
99
100
  ### Continuous delivery
@@ -1,5 +1,8 @@
1
1
  {
2
2
  "IsEncrypted": false,
3
+ "Host": {
4
+ "CORS": "*"
5
+ },
3
6
  "Values": {
4
7
  "FUNCTIONS_WORKER_RUNTIME": "node",
5
8
  "FUNCTIONS_EXTENSION_VERSION": "~4",
@@ -23,7 +23,7 @@
23
23
  "@azure/functions": "^4.1.0",
24
24
  "@azure/storage-queue": "^12.16.0",
25
25
  "@datalust/winston-seq": "^2.0.0",
26
- "@seeka-labs/sdk-apps-server": "^1.0.1",
26
+ "@seeka-labs/sdk-apps-server": "^1.0.4",
27
27
  "axios": "^1.6.7",
28
28
  "lodash-es": "^4.17.21",
29
29
  "openid-client": "^5.6.4",
@@ -0,0 +1,14 @@
1
+ import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions';
2
+
3
+ app.http('healthCheck', {
4
+ methods: ['GET', 'HEAD'],
5
+ authLevel: 'anonymous',
6
+ route: 'health',
7
+ handler: healthCheck
8
+ });
9
+
10
+ export async function healthCheck(req: HttpRequest, context: InvocationContext): Promise<HttpResponseInit> {
11
+ return {
12
+ status: 200
13
+ }
14
+ }
@@ -9,6 +9,7 @@ import {
9
9
  } from '@seeka-labs/sdk-apps-server';
10
10
 
11
11
  import { queueNames, triggerBackgroundJob } from '../lib/jobs';
12
+ import { getSeekaBrowserPlugin } from '../lib/browser'
12
13
  import { webhookLogger } from '../lib/logging';
13
14
  import { startServices } from '../lib/services';
14
15
  import {
@@ -25,6 +26,12 @@ app.http('seekaAppWebhook', {
25
26
 
26
27
  export async function seekaAppWebhook(req: HttpRequest, context: InvocationContext): Promise<HttpResponseInit> {
27
28
  const bodyStr = (await req.text()) as string;
29
+ if (!bodyStr) {
30
+ return {
31
+ status: 400,
32
+ jsonBody: { error: "Body missing. Ensure body is present and either specify the Content-Length request header OR set Transfer-Encoding request header to 'chunked'" }
33
+ }
34
+ }
28
35
  const body = JSON.parse(bodyStr) as SeekaWebhookPayload;
29
36
 
30
37
  const logger = webhookLogger(body, context);
@@ -108,6 +115,18 @@ export async function seekaAppWebhook(req: HttpRequest, context: InvocationConte
108
115
 
109
116
  break;
110
117
  }
118
+ case SeekaWebhookCallType.BrowserSdkPlugin: {
119
+ const plugin = await getSeekaBrowserPlugin(installation as SeekaAppInstallState, logger);
120
+
121
+ logger.profile('http.seeka.webhook.app')
122
+ return {
123
+ status: 200,
124
+ body: JSON.stringify(plugin),
125
+ headers: {
126
+ 'Content-Type': 'application/json'
127
+ }
128
+ }
129
+ }
111
130
  }
112
131
  }
113
132
  catch (err) {
@@ -0,0 +1,55 @@
1
+ import winston, { Logger } from 'winston';
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+ import util from 'util';
5
+ import { SeekaBrowserSdkPluginWebhookResponse } from '@seeka-labs/sdk-apps-server'
6
+ import {
7
+ SeekaAppInstallState
8
+ } from '../state/seeka/installations';
9
+ import type { ISampleAppBrowserSdkPluginConfig } from './models';
10
+
11
+ const fileExistsAsync = util.promisify(fs.exists);
12
+ const readFileAsync = util.promisify(fs.readFile);
13
+
14
+ export async function getSeekaBrowserPlugin(installation: SeekaAppInstallState, logger: Logger): Promise<SeekaBrowserSdkPluginWebhookResponse> {
15
+ logger.profile('http.seeka.browser.plugin')
16
+
17
+ let content: string | undefined;
18
+ let init: string | undefined;
19
+
20
+ try {
21
+ logger.verbose('Handling request for browser plugin content');
22
+ const browserPluginPath = path.resolve('./dist/src/browser/seeka-app-example-name.min.js');
23
+ if (await fileExistsAsync(browserPluginPath)) {
24
+ // Content of the script. This should not change per installation it should be the same for all installations
25
+ content = await readFileAsync(browserPluginPath, 'utf8');
26
+
27
+ // Configuration for the plugin. This can be different per installation.
28
+ // Configuration is sent to the browser so no sensitive config settings should be specified here.
29
+ const pluginConfig = {
30
+ myAppInstallSetting1: installation.installationSettings.myAppInstallSetting1,
31
+ myAppInstallSetting2: installation.installationSettings.myAppInstallSetting2,
32
+ appId: process.env.SEEKA_APP_ID,
33
+ appInstallId: installation.applicationInstallId,
34
+ appUrl: process.env.SELF_HOST_BASEURL
35
+ } as ISampleAppBrowserSdkPluginConfig;
36
+ init = `SampleAppConvergeSdkPlugin(${JSON.stringify(pluginConfig)})`;
37
+ }
38
+ else {
39
+ logger.error('Browser plugin content not found', { path: browserPluginPath });
40
+ }
41
+ }
42
+ catch (err) {
43
+ logger.error('Failed to handle request for browser plugin content', { ex: winston.exceptions.getAllInfo(err) });
44
+ }
45
+ finally {
46
+ logger.profile('http.seeka.browser.plugin')
47
+ logger.verbose('Request for browser plugin content handled');
48
+ }
49
+
50
+ if (!content || !init) {
51
+ throw new Error('Failed to handle request for browser plugin content')
52
+ }
53
+
54
+ return { content, init: init }
55
+ }
@@ -0,0 +1,7 @@
1
+ export interface ISampleAppBrowserSdkPluginConfig {
2
+ myAppInstallSetting1: string | number | undefined;
3
+ myAppInstallSetting2: string | number | undefined;
4
+ appId: string
5
+ appInstallId: string
6
+ appUrl: string
7
+ }
@@ -13,10 +13,6 @@
13
13
  "isolatedModules": false,
14
14
  },
15
15
  "include": [
16
- "src/**/*.ts"
17
- ],
18
- "exclude": [
19
- "node_modules",
20
- "dist"
16
+ "src/functions/*.ts"
21
17
  ]
22
18
  }
@@ -0,0 +1 @@
1
+ module.exports = require('../../scripts/eslint/shared.eslint.cjs');
@@ -0,0 +1 @@
1
+ "@seeka-labs:registry" "https://npm.packages.seeka.services/"
@@ -0,0 +1 @@
1
+ # `@seeka-labs/seeka-app-example-name-browser`
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "seeka-app-example-name-browser",
3
+ "version": "1.0.2",
4
+ "description": "Seeka browser app seeka-app-example-name-browser",
5
+ "author": "Seeka company <support@seeka.co>",
6
+ "license": "MIT",
7
+ "files": [
8
+ "dist/"
9
+ ],
10
+ "scripts": {
11
+ "lint": "eslint --fix src/ --ext .ts",
12
+ "test:ci": "jest --collectCoverage --coverageDirectory=\"./coverage\" --ci --reporters=default --reporters=jest-junit --watchAll=false",
13
+ "test": "jest --watch",
14
+ "clean": "rimraf dist build package",
15
+ "build": "yarn clean && node ./scripts/esbuild/build-browser-plugin.mjs seeka-app-example-name SampleAppConvergeSdkPlugin",
16
+ "build:dev": "yarn clean && node ./scripts/esbuild/build-browser-plugin.mjs seeka-app-example-name SampleAppConvergeSdkPlugin dev",
17
+ "watch": "yarn clean && node ./scripts/esbuild/build-browser-plugin.mjs seeka-app-example-name SampleAppConvergeSdkPlugin dev watch"
18
+ },
19
+ "dependencies": {
20
+ "@seeka-labs/converge": "^1.7.2"
21
+ },
22
+ "devDependencies": {
23
+ "@types/jest": "^29.5.4",
24
+ "@typescript-eslint/eslint-plugin": "^6.6.0",
25
+ "@typescript-eslint/parser": "^6.6.0",
26
+ "esbuild": "^0.20.1",
27
+ "eslint": "^8.48.0",
28
+ "eslint-plugin-unused-imports": "^3.0.0",
29
+ "jest": "^29.6.4",
30
+ "jest-junit": "^16.0.0",
31
+ "ts-jest": "^29.1.1",
32
+ "typedoc": "^0.25.1",
33
+ "typescript": "^5.1.6",
34
+ "@jgoz/esbuild-plugin-typecheck": "^3.1.1",
35
+ "watch": "^1.0.2"
36
+ }
37
+ }
@@ -0,0 +1,111 @@
1
+ import { importAsGlobals } from './plugins/importAsGlobals.mjs'
2
+ import { build, version, context } from 'esbuild'
3
+ import { typecheckPlugin } from '@jgoz/esbuild-plugin-typecheck';
4
+ import { copyFileSync, mkdirSync, existsSync } from 'fs'
5
+ import { resolve } from 'path'
6
+ import * as watch from 'watch'
7
+
8
+ console.log('esbuild version:', version);
9
+
10
+ if (process.argv.length < 3) {
11
+ throw new Error('Missing arg');
12
+ }
13
+
14
+ const pluginName = process.argv[2];
15
+
16
+ const mode = process.argv.length > 4 ? process.argv[4] : 'prod';
17
+ const watchBuild = process.argv.length > 5 ? process.argv[5] == 'watch' : false;
18
+
19
+ console.log('mode:', mode);
20
+ console.log('watchBuild:', process.argv[4]);
21
+
22
+ const opts = {
23
+ entryPoints: ['src/browser.ts'],
24
+ bundle: true,
25
+ metafile: true,
26
+ minify: mode === 'dev' ? false : true,
27
+ format: 'iife',
28
+ platform: 'browser',
29
+ //sourcemap: 'external',
30
+ sourcemap: mode === 'dev' ? true : false,
31
+ external: ['@seeka-labs/converge'],
32
+ outfile: `dist/${pluginName}.min.js`,
33
+ plugins: [
34
+ importAsGlobals({
35
+ "@seeka-labs/converge": "SeekaConvergeCore"
36
+ }),
37
+ typecheckPlugin()
38
+ ]
39
+ }
40
+
41
+ const postBuild = () => {
42
+ // Copy outfile to ../dist/src/browser
43
+ if (!existsSync(resolve('../../dist/src/browser'))) {
44
+ mkdirSync(resolve('../../dist/src/browser'), {
45
+ recursive: true,
46
+ });
47
+ }
48
+ copyFileSync(resolve(opts.outfile), resolve('../../dist/src/browser', `${pluginName}.min.js`))
49
+ }
50
+
51
+ if (watchBuild) {
52
+ const ctx = await context(opts);
53
+
54
+ async function buildWatch() {
55
+ await ctx.rebuild();
56
+ postBuild();
57
+ console.log('build succeeded');
58
+ }
59
+
60
+ await buildWatch();
61
+
62
+ // Start watch
63
+ let monitorInstance;
64
+ watch.createMonitor(resolve('./src'), function (monitor) {
65
+ console.log('watching ./src, press any key to exit');
66
+ monitorInstance = monitor;
67
+
68
+ monitor.on("created", async function (f, stat) {
69
+ console.log('rebuilding due to file created', f)
70
+ try {
71
+ await buildWatch();
72
+ }
73
+ catch (e) {
74
+ console.error(e);
75
+ }
76
+ })
77
+ monitor.on("changed", async function (f, curr, prev) {
78
+ console.log('rebuilding due to file changed', f)
79
+ try {
80
+ await buildWatch();
81
+ }
82
+ catch (e) {
83
+ console.error(e);
84
+ }
85
+ })
86
+ monitor.on("removed", async function (f, stat) {
87
+ console.log('rebuilding due to file deleted', f)
88
+ try {
89
+ await buildWatch();
90
+ }
91
+ catch (e) {
92
+ console.error(e);
93
+ }
94
+ })
95
+ })
96
+
97
+ // Support stopping
98
+ var stdin = process.stdin;
99
+ stdin.setRawMode(true);
100
+ stdin.resume();
101
+ stdin.setEncoding('utf8');
102
+ stdin.on('data', function (key) {
103
+ console.log('Stopping watch...');
104
+ monitorInstance.stop();
105
+ process.exit();
106
+ });
107
+ }
108
+ else {
109
+ await build(opts);
110
+ postBuild();
111
+ }
@@ -0,0 +1,39 @@
1
+ export function importAsGlobals(mapping) {
2
+ // https://github.com/evanw/esbuild/issues/337
3
+ // https://stackoverflow.com/a/3561711/153718
4
+ const escRe = (s) => s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
5
+ const filter = new RegExp(
6
+ Object.keys(mapping)
7
+ .map((mod) => `^${escRe(mod)}$`)
8
+ .join("|"),
9
+ );
10
+
11
+ return {
12
+ name: "global-imports",
13
+ setup(build) {
14
+ build.onResolve({ filter }, (args) => {
15
+ if (!mapping[args.path]) {
16
+ throw new Error("Unknown global: " + args.path);
17
+ }
18
+ return {
19
+ path: args.path,
20
+ namespace: "external-global",
21
+ };
22
+ });
23
+
24
+ build.onLoad(
25
+ {
26
+ filter,
27
+ namespace: "external-global",
28
+ },
29
+ async (args) => {
30
+ const global = mapping[args.path];
31
+ return {
32
+ contents: `module.exports = ${global};`,
33
+ loader: "js",
34
+ };
35
+ },
36
+ );
37
+ },
38
+ };
39
+ }
@@ -19,7 +19,7 @@
19
19
  "dependencies": {
20
20
  "@datalust/winston-seq": "^2.0.0",
21
21
  "@netlify/functions": "^2.5.1",
22
- "@seeka-labs/sdk-apps-server": "^1.0.1",
22
+ "@seeka-labs/sdk-apps-server": "^1.0.4",
23
23
  "axios": "^1.6.7",
24
24
  "lodash-es": "^4.17.21",
25
25
  "openid-client": "^5.6.4",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seeka-labs/cli-apps",
3
- "version": "1.0.3",
3
+ "version": "1.1.1",
4
4
  "description": "Seeka - Apps CLI",
5
5
  "author": "SEEKA <platform@seeka.co>",
6
6
  "license": "MIT",
@@ -26,7 +26,7 @@
26
26
  "build:templates": "node ./scripts/build-templates.js",
27
27
  "watch": "tsc -w",
28
28
  "clean": "yarn rimraf dist",
29
- "dev": "yarn run clean && yarn build && node dist/index.js init seeka-app-test1 --template azure-function --email 'dev@seeka.co' --developer Seeka --noDependencies --force --env 'SEEKA_APP_ID=123' 'SEEKA_APP_SECRET=345' --packageManager pnpm"
29
+ "dev": "yarn run clean && yarn build && rimraf seeka-app-test1 && node dist/index.js init seeka-app-test1 --template azure-function --email 'dev@seeka.co' --developer Seeka --noDependencies --browser --env 'SEEKA_APP_ID=123' 'SEEKA_APP_SECRET=345' --packageManager yarn"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@jest/globals": "^29.7.0",
@@ -34,6 +34,7 @@
34
34
  "@types/jest": "^29.5.12",
35
35
  "@types/memory-cache": "^0.2.5",
36
36
  "@types/node": "^18.14.0",
37
+ "camelcase": "^8.0.0",
37
38
  "commander": "^12.0.0",
38
39
  "cross-env": "^7.0.3",
39
40
  "cross-spawn": "^7.0.3",