@earlyai/cli 2.13.1 → 2.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.cjs +2 -2
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -17,7 +17,7 @@ Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._life
17
17
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
18
18
  - ${t?`searched for local subcommand relative to directory '${t}'`:`no directory for search for local subcommand, use .executableDir() to supply a custom directory`}`;throw Error(r)}_executeSubCommand(e,t){t=t.slice();let o=!1,s=[`.js`,`.ts`,`.tsx`,`.mjs`,`.cjs`];function l(e,t){let n=r.resolve(e,t);if(i.existsSync(n))return n;if(s.includes(r.extname(t)))return;let a=s.find(e=>i.existsSync(`${n}${e}`));if(a)return`${n}${a}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||``;if(this._scriptPath){let e;try{e=i.realpathSync(this._scriptPath)}catch{e=this._scriptPath}d=r.resolve(r.dirname(e),d)}if(d){let t=l(d,u);if(!t&&!e._executableFile&&this._scriptPath){let n=r.basename(this._scriptPath,r.extname(this._scriptPath));n!==this._name&&(t=l(d,`${n}-${e._name}`))}u=t||u}o=s.includes(r.extname(u));let f;a.platform===`win32`?(this._checkForMissingExecutable(u,d,e._name),t.unshift(u),t=h(a.execArgv).concat(t),f=n.spawn(a.execPath,t,{stdio:`inherit`})):o?(t.unshift(u),t=h(a.execArgv).concat(t),f=n.spawn(a.argv[0],t,{stdio:`inherit`})):f=n.spawn(u,t,{stdio:`inherit`}),f.killed||[`SIGUSR1`,`SIGUSR2`,`SIGTERM`,`SIGINT`,`SIGHUP`].forEach(e=>{a.on(e,()=>{f.killed===!1&&f.exitCode===null&&f.kill(e)})});let p=this._exitCallback;f.on(`close`,e=>{e??=1,p?p(new c(e,`commander.executeSubCommandAsync`,`(close)`)):a.exit(e)}),f.on(`error`,t=>{if(t.code===`ENOENT`)this._checkForMissingExecutable(u,d,e._name);else if(t.code===`EACCES`)throw Error(`'${u}' not executable`);if(!p)a.exit(1);else{let e=new c(1,`commander.executeSubCommandAsync`,`(error)`);e.nestedError=t,p(e)}}),this.runningCommand=f}_dispatchSubcommand(e,t,n){let r=this._findCommand(e);r||this.help({error:!0}),r._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,r,`preSubcommand`),i=this._chainOrCall(i,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(n));else return r._parseCommand(t,n)}),i}_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=(e,t,n)=>{let r=t;if(t!==null&&e.parseArg){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,n,i)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,r)=>{let i=n.defaultValue;n.variadic?r<this.args.length?(i=this.args.slice(r),n.parseArg&&(i=i.reduce((t,r)=>e(n,r,t),n.defaultValue))):i===void 0&&(i=[]):r<this.args.length&&(i=this.args[r],n.parseArg&&(i=e(n,i,n.defaultValue))),t[r]=i}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then==`function`?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,r=[];return this._getCommandAndAncestors().reverse().filter(e=>e._lifeCycleHooks[t]!==void 0).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),t===`postAction`&&r.reverse(),r.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_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 r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let n;return n=this._chainOrCallHooks(n,`preAction`),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(i,e,t)})),n=this._chainOrCallHooks(n,`postAction`),n}if(this.parent?.listenerCount(i))r(),this._processArguments(),this.parent.emit(i,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():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),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(e=>{let t=e.attributeName();return this.getOptionValue(t)===void 0?!1:this.getOptionValueSource(t)!==`default`});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],r=t;function i(e){return e.length>1&&e[0]===`-`}let a=e=>/^-\d*\.?\d+(e[+-]?\d+)?$/.test(e)?!this._getCommandAndAncestors().some(e=>e.options.map(e=>e.short).some(e=>/^-\d$/.test(e))):!1,o=null,s=null,c=0;for(;c<e.length||s;){let l=s??e[c++];if(s=null,l===`--`){r===n&&r.push(l),r.push(...e.slice(c));break}if(o&&(!i(l)||a(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,i(l)){let t=this._findOption(l);if(t){if(t.required){let n=e[c++];n===void 0&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,n)}else if(t.optional){let n=null;c<e.length&&(!i(e[c])||a(e[c]))&&(n=e[c++]),this.emit(`option:${t.name()}`,n)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(l.length>2&&l[0]===`-`&&l[1]!==`-`){let e=this._findOption(`-${l[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,l.slice(2)):(this.emit(`option:${e.name()}`),s=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let e=l.indexOf(`=`),t=this._findOption(l.slice(0,e));if(t&&(t.required||t.optional)){this.emit(`option:${t.name()}`,l.slice(e+1));continue}}if(r===t&&i(l)&&!(this.commands.length===0&&a(l))&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(l)){t.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){r.push(l,...e.slice(c));break}r.push(l)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==`string`?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
19
19
  `),this.outputHelp({error:!0}));let n=t||{},r=n.exitCode||1,i=n.code||`commander.error`;this._exit(r,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in a.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()}`,a.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new f(this.options),t=e=>this.getOptionValue(e)!==void 0&&![`default`,`implied`].includes(this.getOptionValueSource(e));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],`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=e=>{let t=e.attributeName(),n=this.getOptionValue(t),r=this.options.find(e=>e.negate&&t===e.attributeName()),i=this.options.find(e=>!e.negate&&t===e.attributeName());return r&&(r.presetArg===void 0&&n===!1||r.presetArg!==void 0&&n===r.presetArg)?r:i||e},r=e=>{let t=n(e),r=t.attributeName();return this.getOptionValueSource(r)===`env`?`environment variable '${t.envVar}'`:`option '${t.flags}'`},i=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(i,{code:`commander.conflictingOption`})}unknownOption(e){if(this._allowUnknownOption)return;let t=``;if(e.startsWith(`--`)&&this._showSuggestionAfterError){let n=[],r=this;do{let e=r.createHelp().visibleOptions(r).filter(e=>e.long).map(e=>e.long);n=n.concat(e),r=r.parent}while(r&&!r._enablePositionalOptions);t=p(e,n)}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 n=[];this.createHelp().visibleCommands(this).forEach(e=>{n.push(e.name()),e.alias()&&n.push(e.alias())}),t=p(e,n)}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||=`-V, --version`,n||=`output the version number`;let r=this.createOption(t,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on(`option:`+r.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),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 Error(`Command alias can't be the same as its name`);let n=this.parent?._findCommand(e);if(n){let t=[n.name()].concat(n.aliases()).join(`|`);throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(e=>s(e));return[].concat(this.options.length||this._helpOption!==null?`[options]`:[],this.commands.length?`[command]`:[],this.registeredArguments.length?e:[]).join(` `)}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??``:(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??``:(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??``:(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=r.basename(e,r.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let r=t.formatHelp(this,t);return n.hasColors?r:this._outputConfiguration.stripColor(r)}_getOutputContext(e){e||={};let t=!!e.error,n,r,i;return t?(n=e=>this._outputConfiguration.writeErr(e),r=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=e=>this._outputConfiguration.writeOut(e),r=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:t,write:e=>(r||(e=this._outputConfiguration.stripColor(e)),n(e)),hasColors:r,helpWidth:i}}outputHelp(e){let t;typeof e==`function`&&(t=e,e=void 0);let n=this._getOutputContext(e),r={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(e=>e.emit(`beforeAllHelp`,r)),this.emit(`beforeHelp`,r);let i=this.helpInformation({error:n.error});if(t&&(i=t(i),typeof i!=`string`&&!Buffer.isBuffer(i)))throw Error(`outputHelp callback must return a string or a Buffer`);n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit(`afterHelp`,r),this._getCommandAndAncestors().forEach(e=>e.emit(`afterAllHelp`,r))}helpOption(e,t){return typeof e==`boolean`?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??`-h, --help`,t??`display help for command`),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(a.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 Error(`Unexpected value for position to addHelpText.
20
- Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function h(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function g(){if(a.env.NO_COLOR||a.env.FORCE_COLOR===`0`||a.env.FORCE_COLOR===`false`)return!1;if(a.env.FORCE_COLOR||a.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=m,e.useColor=g}));const{program:M,createCommand:ee,createArgument:N,createOption:te,CommanderError:P,InvalidArgumentError:F,InvalidOptionArgumentError:I,Command:L,Argument:ne,Option:R,Help:z}=u(s((e=>{let{Argument:t}=D(),{Command:n}=j(),{CommanderError:r,InvalidArgumentError:i}=E(),{Help:a}=O(),{Option:o}=k();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i}))(),1).default;var re=`2.13.1`,ie=s((e=>{let t=e=>e!=null,n=e=>typeof e==`object`&&!!e,r=e=>Array.isArray(e),i=e=>e instanceof Map,a=e=>e instanceof Set,o=e=>e instanceof Date,s=e=>typeof e==`number`,c=e=>typeof e==`string`,l=e=>typeof e==`boolean`,u=e=>e instanceof Error,d=e=>t(e)?c(e)||r(e)?e.length===0:i(e)||a(e)?e.size===0:o(e)?!1:n(e)?Object.keys(e).length===0:!1:!0,f=e=>u(e)?e.message:`error is not Instance of Error`,p=(e,t)=>{let n=new Set(e);for(let e of n)t.includes(e)||n.delete(e);return[...n]},m=async(e,t)=>{let n=await Promise.all(e.map(e=>t(e)));return e.filter((e,t)=>n[t])},h=(e,t)=>{let n=[];for(let r of e)n.some(e=>t(r,e))||n.push(r);return n},g=e=>[...new Set(e)],_=async e=>Promise.all(e.map(e=>new Promise((t,n)=>e().then(e=>e?t(e):n(e)).catch(e=>n(e))))).then(()=>!0).catch(e=>{if(!l(e))throw e;return e}),v=e=>e.trim().replaceAll(/([\da-z])([A-Z])/g,`$1-$2`).replaceAll(/([A-Z])([A-Z][\da-z])/g,`$1-$2`).replaceAll(/[\s_]+/g,`-`).toLowerCase(),y=e=>e.replaceAll(/[\s-]+/g,` `).split(` `).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(``),b=e=>{let t=0;for(let n=0;n<e.length;n++){let r=e.codePointAt(n)??0;t=Math.trunc(t*31+r)}return t>>>0},x=(...e)=>{let n={};for(let r of e)for(let e in r)t(r[e])&&(n[e]=r[e]);return n},S=(e,t)=>r(e)?e.map(e=>S(e,t)):n(e)?Object.fromEntries(Object.entries(e).filter(([e])=>!t.includes(e)).map(([e,n])=>[e,S(n,t)])):e,C=(e,t)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}},w=(e,t)=>{let n=!1;return(...r)=>{n||(e(...r),n=!0,setTimeout(()=>{n=!1},t))}};var T=class{listeners=[];addListener(e){this.listeners.push(e)}notifyAll(e){for(let t of this.listeners)t(e)}clear(){this.listeners.length=0}},E=class{set=new Set;constructor(e=[]){for(let t of e)this.safeAdd(t)}safeAdd(e){return t(e)?(this.set.add(e),!0):!1}has(e){return t(e)?this.set.has(e):!1}delete(e){return t(e)?this.set.delete(e):!1}clear(){this.set.clear()}get size(){return this.set.size}values(){return this.set.values()}toSet(){return structuredClone(this.set)}[Symbol.iterator](){return this.set[Symbol.iterator]()}concatSet(e){for(let t of e)this.safeAdd(t)}};e.Observer=T,e.SafeSet=E,e.arePromiseFnsTruthy=_,e.debounce=C,e.fastHash=b,e.filterAsync=m,e.getErrorMessage=f,e.intersection=p,e.isArray=r,e.isBoolean=l,e.isDate=o,e.isDefined=t,e.isEmpty=d,e.isError=u,e.isMap=i,e.isNumber=s,e.isObject=n,e.isSet=a,e.isString=c,e.merge=x,e.removeNestedField=S,e.throttle=w,e.toCamelCase=y,e.toKebabCase=v,e.uniq=g,e.uniqWith=h})),B=ie();function V(e,t,n,{key:r=``,prefix:i=`EARLY`,parser:a,def:o,isRequired:s=!1,envName:c}={}){let l=new R(t,n);a&&l.argParser(a),s&&l.makeOptionMandatory(!0);let u=c??(()=>{let n=[];for(let t=e;t&&(0,B.isDefined)(t.name());t=t.parent)t.parent&&n.unshift(t.name());return[i,...n,r||t.split(/[ ,|]/)[1].replace(/^--?/,``)].join(`_`).replaceAll(/[- ]/g,`_`).toUpperCase()})();return l.env(u),(0,B.isDefined)(o)&&l.default(o),e.addOption(l),l}function ae(e){return(typeof e==`object`&&!!e||typeof e==`function`)&&typeof e.then==`function`}function oe(e){switch(typeof e){case`string`:case`symbol`:return e.toString();case`function`:return e.name;default:throw Error(`Unexpected ${typeof e} service id type`)}}const se=Symbol.for(`@inversifyjs/common/islazyServiceIdentifier`);var ce=class{[se];#e;constructor(e){this.#e=e,this[se]=!0}static is(e){return typeof e==`object`&&!!e&&!0===e[se]}unwrap(){return this.#e()}};function le(e,t,n){return Reflect.getOwnMetadata(t,e,n)}function ue(e,t,n,r){Reflect.defineMetadata(t,n,e,r)}function de(e,t,n,r,i){let a=r(le(e,t,i)??n());Reflect.defineMetadata(t,a,e,i)}function fe(e){return Object.getPrototypeOf(e.prototype)?.constructor}const pe=`@inversifyjs/container/bindingId`;function me(){let e=le(Object,pe)??0;return e===2**53-1?ue(Object,pe,-(2**53-1)):de(Object,pe,()=>e,e=>e+1),e}const he={Request:`Request`,Singleton:`Singleton`,Transient:`Transient`},ge={ConstantValue:`ConstantValue`,DynamicValue:`DynamicValue`,Factory:`Factory`,Instance:`Instance`,Provider:`Provider`,ResolvedValue:`ResolvedValue`,ServiceRedirection:`ServiceRedirection`};function*_e(...e){for(let t of e)yield*t}var ve=class e{#e;#t;#n;constructor(e){this.#e=new Map,this.#t={};for(let t of Reflect.ownKeys(e))this.#t[t]=new Map;this.#n=e}add(e,t){this.#a(e).push(t);for(let n of Reflect.ownKeys(t))this.#o(n,t[n]).push(e)}clone(){let e=this.#r(),t=this.#i(),n=Reflect.ownKeys(this.#n),r=this._buildNewInstance(this.#n);this.#u(this.#e,r.#e,e,t);for(let t of n)this.#l(this.#t[t],r.#t[t],e);return r}get(e,t){return this.#t[e].get(t)}getAllKeys(e){return this.#t[e].keys()}removeByRelation(e,t){let n=this.get(e,t);if(n===void 0)return;let r=new Set(n);for(let n of r){let r=this.#e.get(n);if(r===void 0)throw Error(`Expecting model relation, none found`);for(let i of r)i[e]===t&&this.#d(n,i);this.#e.delete(n)}}_buildNewInstance(t){return new e(t)}_cloneModel(e){return e}_cloneRelation(e){return e}#r(){let e=new Map;for(let t of this.#e.keys()){let n=this._cloneModel(t);e.set(t,n)}return e}#i(){let e=new Map;for(let t of this.#e.values())for(let n of t){let t=this._cloneRelation(n);e.set(n,t)}return e}#a(e){let t=this.#e.get(e);return t===void 0&&(t=[],this.#e.set(e,t)),t}#o(e,t){let n=this.#t[e].get(t);return n===void 0&&(n=[],this.#t[e].set(t,n)),n}#s(e,t){let n=t.get(e);if(n===void 0)throw Error(`Expecting model to be cloned, none found`);return n}#c(e,t){let n=t.get(e);if(n===void 0)throw Error(`Expecting relation to be cloned, none found`);return n}#l(e,t,n){for(let[r,i]of e){let e=[];for(let t of i)e.push(this.#s(t,n));t.set(r,e)}}#u(e,t,n,r){for(let[i,a]of e){let e=[];for(let t of a)e.push(this.#c(t,r));t.set(this.#s(i,n),e)}}#d(e,t){for(let n of Reflect.ownKeys(t))this.#f(e,n,t[n])}#f(e,t,n){let r=this.#t[t].get(n);if(r!==void 0){let i=r.indexOf(e);i!==-1&&r.splice(i,1),r.length===0&&this.#t[t].delete(n)}}},ye;(function(e){e.moduleId=`moduleId`,e.serviceId=`serviceId`})(ye||={});var be=class e{#e;#t;constructor(e,t){this.#e=t??new ve({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#t=e}static build(t){return new e(t)}add(e,t){this.#e.add(e,t)}clone(){return new e(this.#t,this.#e.clone())}get(e){let t=[],n=this.#e.get(ye.serviceId,e);n!==void 0&&t.push(n);let r=this.#t()?.get(e);if(r!==void 0&&t.push(r),t.length!==0)return _e(...t)}removeAllByModuleId(e){this.#e.removeByRelation(ye.moduleId,e)}removeAllByServiceId(e){this.#e.removeByRelation(ye.serviceId,e)}};const xe=`@inversifyjs/core/classMetadataReflectKey`;function Se(){return{constructorArguments:[],lifecycle:{postConstructMethodNames:new Set,preDestroyMethodNames:new Set},properties:new Map,scope:void 0}}const Ce=`@inversifyjs/core/pendingClassMetadataCountReflectKey`,we=Symbol.for(`@inversifyjs/core/InversifyCoreError`);var Te=class e extends Error{[we];kind;constructor(e,t,n){super(t,n),this[we]=!0,this.kind=e}static is(e){return typeof e==`object`&&!!e&&!0===e[we]}static isErrorOfKind(t,n){return e.is(t)&&t.kind===n}},Ee,De,Oe,ke,Ae;function je(e){let t=le(e,xe)??Se();if(!function(e){let t=le(e,Ce);return t!==void 0&&t!==0}(e))return function(e,t){let n=[];if(t.length<e.length)throw new Te(Ee.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}". "${e.name}" constructor requires at least ${e.length.toString()} arguments, found ${t.length.toString()} instead.\nAre you using @inject, @multiInject or @unmanaged decorators in every non optional constructor argument?\n\nIf you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`);for(let e=0;e<t.length;++e)t[e]===void 0&&n.push(e);if(n.length>0)throw new Te(Ee.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}" at constructor indexes "${n.join(`", "`)}".\n\nAre you using @inject, @multiInject or @unmanaged decorators at those indexes?\n\nIf you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`)}(e,t.constructorArguments),t;(function(e,t){let n=[];for(let r=0;r<t.constructorArguments.length;++r){let i=t.constructorArguments[r];i!==void 0&&i.kind!==De.unknown||n.push(` - Missing or incomplete metadata for type "${e.name}" at constructor argument with index ${r.toString()}.\nEvery constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`)}for(let[r,i]of t.properties)i.kind===De.unknown&&n.push(` - Missing or incomplete metadata for type "${e.name}" at property "${r.toString()}".\nThis property must be decorated either with @inject or @multiInject decorator.`);throw n.length===0?new Te(Ee.unknown,`Unexpected class metadata for type "${e.name}" with uncompletion traces.\nThis might be caused by one of the following reasons:\n\n1. A third party library is targeting inversify reflection metadata.\n2. A bug is causing the issue. Consider submiting an issue to fix it.`):new Te(Ee.missingInjectionDecorator,`Invalid class metadata at type ${e.name}:\n\n${n.join(`
20
+ Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function h(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function g(){if(a.env.NO_COLOR||a.env.FORCE_COLOR===`0`||a.env.FORCE_COLOR===`false`)return!1;if(a.env.FORCE_COLOR||a.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=m,e.useColor=g}));const{program:M,createCommand:ee,createArgument:N,createOption:te,CommanderError:P,InvalidArgumentError:F,InvalidOptionArgumentError:I,Command:L,Argument:ne,Option:R,Help:z}=u(s((e=>{let{Argument:t}=D(),{Command:n}=j(),{CommanderError:r,InvalidArgumentError:i}=E(),{Help:a}=O(),{Option:o}=k();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i}))(),1).default;var re=`2.13.2`,ie=s((e=>{let t=e=>e!=null,n=e=>typeof e==`object`&&!!e,r=e=>Array.isArray(e),i=e=>e instanceof Map,a=e=>e instanceof Set,o=e=>e instanceof Date,s=e=>typeof e==`number`,c=e=>typeof e==`string`,l=e=>typeof e==`boolean`,u=e=>e instanceof Error,d=e=>t(e)?c(e)||r(e)?e.length===0:i(e)||a(e)?e.size===0:o(e)?!1:n(e)?Object.keys(e).length===0:!1:!0,f=e=>u(e)?e.message:`error is not Instance of Error`,p=(e,t)=>{let n=new Set(e);for(let e of n)t.includes(e)||n.delete(e);return[...n]},m=async(e,t)=>{let n=await Promise.all(e.map(e=>t(e)));return e.filter((e,t)=>n[t])},h=(e,t)=>{let n=[];for(let r of e)n.some(e=>t(r,e))||n.push(r);return n},g=e=>[...new Set(e)],_=async e=>Promise.all(e.map(e=>new Promise((t,n)=>e().then(e=>e?t(e):n(e)).catch(e=>n(e))))).then(()=>!0).catch(e=>{if(!l(e))throw e;return e}),v=e=>e.trim().replaceAll(/([\da-z])([A-Z])/g,`$1-$2`).replaceAll(/([A-Z])([A-Z][\da-z])/g,`$1-$2`).replaceAll(/[\s_]+/g,`-`).toLowerCase(),y=e=>e.replaceAll(/[\s-]+/g,` `).split(` `).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(``),b=e=>{let t=0;for(let n=0;n<e.length;n++){let r=e.codePointAt(n)??0;t=Math.trunc(t*31+r)}return t>>>0},x=(...e)=>{let n={};for(let r of e)for(let e in r)t(r[e])&&(n[e]=r[e]);return n},S=(e,t)=>r(e)?e.map(e=>S(e,t)):n(e)?Object.fromEntries(Object.entries(e).filter(([e])=>!t.includes(e)).map(([e,n])=>[e,S(n,t)])):e,C=(e,t)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}},w=(e,t)=>{let n=!1;return(...r)=>{n||(e(...r),n=!0,setTimeout(()=>{n=!1},t))}};var T=class{listeners=[];addListener(e){this.listeners.push(e)}notifyAll(e){for(let t of this.listeners)t(e)}clear(){this.listeners.length=0}},E=class{set=new Set;constructor(e=[]){for(let t of e)this.safeAdd(t)}safeAdd(e){return t(e)?(this.set.add(e),!0):!1}has(e){return t(e)?this.set.has(e):!1}delete(e){return t(e)?this.set.delete(e):!1}clear(){this.set.clear()}get size(){return this.set.size}values(){return this.set.values()}toSet(){return structuredClone(this.set)}[Symbol.iterator](){return this.set[Symbol.iterator]()}concatSet(e){for(let t of e)this.safeAdd(t)}};e.Observer=T,e.SafeSet=E,e.arePromiseFnsTruthy=_,e.debounce=C,e.fastHash=b,e.filterAsync=m,e.getErrorMessage=f,e.intersection=p,e.isArray=r,e.isBoolean=l,e.isDate=o,e.isDefined=t,e.isEmpty=d,e.isError=u,e.isMap=i,e.isNumber=s,e.isObject=n,e.isSet=a,e.isString=c,e.merge=x,e.removeNestedField=S,e.throttle=w,e.toCamelCase=y,e.toKebabCase=v,e.uniq=g,e.uniqWith=h})),B=ie();function V(e,t,n,{key:r=``,prefix:i=`EARLY`,parser:a,def:o,isRequired:s=!1,envName:c}={}){let l=new R(t,n);a&&l.argParser(a),s&&l.makeOptionMandatory(!0);let u=c??(()=>{let n=[];for(let t=e;t&&(0,B.isDefined)(t.name());t=t.parent)t.parent&&n.unshift(t.name());return[i,...n,r||t.split(/[ ,|]/)[1].replace(/^--?/,``)].join(`_`).replaceAll(/[- ]/g,`_`).toUpperCase()})();return l.env(u),(0,B.isDefined)(o)&&l.default(o),e.addOption(l),l}function ae(e){return(typeof e==`object`&&!!e||typeof e==`function`)&&typeof e.then==`function`}function oe(e){switch(typeof e){case`string`:case`symbol`:return e.toString();case`function`:return e.name;default:throw Error(`Unexpected ${typeof e} service id type`)}}const se=Symbol.for(`@inversifyjs/common/islazyServiceIdentifier`);var ce=class{[se];#e;constructor(e){this.#e=e,this[se]=!0}static is(e){return typeof e==`object`&&!!e&&!0===e[se]}unwrap(){return this.#e()}};function le(e,t,n){return Reflect.getOwnMetadata(t,e,n)}function ue(e,t,n,r){Reflect.defineMetadata(t,n,e,r)}function de(e,t,n,r,i){let a=r(le(e,t,i)??n());Reflect.defineMetadata(t,a,e,i)}function fe(e){return Object.getPrototypeOf(e.prototype)?.constructor}const pe=`@inversifyjs/container/bindingId`;function me(){let e=le(Object,pe)??0;return e===2**53-1?ue(Object,pe,-(2**53-1)):de(Object,pe,()=>e,e=>e+1),e}const he={Request:`Request`,Singleton:`Singleton`,Transient:`Transient`},ge={ConstantValue:`ConstantValue`,DynamicValue:`DynamicValue`,Factory:`Factory`,Instance:`Instance`,Provider:`Provider`,ResolvedValue:`ResolvedValue`,ServiceRedirection:`ServiceRedirection`};function*_e(...e){for(let t of e)yield*t}var ve=class e{#e;#t;#n;constructor(e){this.#e=new Map,this.#t={};for(let t of Reflect.ownKeys(e))this.#t[t]=new Map;this.#n=e}add(e,t){this.#a(e).push(t);for(let n of Reflect.ownKeys(t))this.#o(n,t[n]).push(e)}clone(){let e=this.#r(),t=this.#i(),n=Reflect.ownKeys(this.#n),r=this._buildNewInstance(this.#n);this.#u(this.#e,r.#e,e,t);for(let t of n)this.#l(this.#t[t],r.#t[t],e);return r}get(e,t){return this.#t[e].get(t)}getAllKeys(e){return this.#t[e].keys()}removeByRelation(e,t){let n=this.get(e,t);if(n===void 0)return;let r=new Set(n);for(let n of r){let r=this.#e.get(n);if(r===void 0)throw Error(`Expecting model relation, none found`);for(let i of r)i[e]===t&&this.#d(n,i);this.#e.delete(n)}}_buildNewInstance(t){return new e(t)}_cloneModel(e){return e}_cloneRelation(e){return e}#r(){let e=new Map;for(let t of this.#e.keys()){let n=this._cloneModel(t);e.set(t,n)}return e}#i(){let e=new Map;for(let t of this.#e.values())for(let n of t){let t=this._cloneRelation(n);e.set(n,t)}return e}#a(e){let t=this.#e.get(e);return t===void 0&&(t=[],this.#e.set(e,t)),t}#o(e,t){let n=this.#t[e].get(t);return n===void 0&&(n=[],this.#t[e].set(t,n)),n}#s(e,t){let n=t.get(e);if(n===void 0)throw Error(`Expecting model to be cloned, none found`);return n}#c(e,t){let n=t.get(e);if(n===void 0)throw Error(`Expecting relation to be cloned, none found`);return n}#l(e,t,n){for(let[r,i]of e){let e=[];for(let t of i)e.push(this.#s(t,n));t.set(r,e)}}#u(e,t,n,r){for(let[i,a]of e){let e=[];for(let t of a)e.push(this.#c(t,r));t.set(this.#s(i,n),e)}}#d(e,t){for(let n of Reflect.ownKeys(t))this.#f(e,n,t[n])}#f(e,t,n){let r=this.#t[t].get(n);if(r!==void 0){let i=r.indexOf(e);i!==-1&&r.splice(i,1),r.length===0&&this.#t[t].delete(n)}}},ye;(function(e){e.moduleId=`moduleId`,e.serviceId=`serviceId`})(ye||={});var be=class e{#e;#t;constructor(e,t){this.#e=t??new ve({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#t=e}static build(t){return new e(t)}add(e,t){this.#e.add(e,t)}clone(){return new e(this.#t,this.#e.clone())}get(e){let t=[],n=this.#e.get(ye.serviceId,e);n!==void 0&&t.push(n);let r=this.#t()?.get(e);if(r!==void 0&&t.push(r),t.length!==0)return _e(...t)}removeAllByModuleId(e){this.#e.removeByRelation(ye.moduleId,e)}removeAllByServiceId(e){this.#e.removeByRelation(ye.serviceId,e)}};const xe=`@inversifyjs/core/classMetadataReflectKey`;function Se(){return{constructorArguments:[],lifecycle:{postConstructMethodNames:new Set,preDestroyMethodNames:new Set},properties:new Map,scope:void 0}}const Ce=`@inversifyjs/core/pendingClassMetadataCountReflectKey`,we=Symbol.for(`@inversifyjs/core/InversifyCoreError`);var Te=class e extends Error{[we];kind;constructor(e,t,n){super(t,n),this[we]=!0,this.kind=e}static is(e){return typeof e==`object`&&!!e&&!0===e[we]}static isErrorOfKind(t,n){return e.is(t)&&t.kind===n}},Ee,De,Oe,ke,Ae;function je(e){let t=le(e,xe)??Se();if(!function(e){let t=le(e,Ce);return t!==void 0&&t!==0}(e))return function(e,t){let n=[];if(t.length<e.length)throw new Te(Ee.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}". "${e.name}" constructor requires at least ${e.length.toString()} arguments, found ${t.length.toString()} instead.\nAre you using @inject, @multiInject or @unmanaged decorators in every non optional constructor argument?\n\nIf you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`);for(let e=0;e<t.length;++e)t[e]===void 0&&n.push(e);if(n.length>0)throw new Te(Ee.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}" at constructor indexes "${n.join(`", "`)}".\n\nAre you using @inject, @multiInject or @unmanaged decorators at those indexes?\n\nIf you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`)}(e,t.constructorArguments),t;(function(e,t){let n=[];for(let r=0;r<t.constructorArguments.length;++r){let i=t.constructorArguments[r];i!==void 0&&i.kind!==De.unknown||n.push(` - Missing or incomplete metadata for type "${e.name}" at constructor argument with index ${r.toString()}.\nEvery constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`)}for(let[r,i]of t.properties)i.kind===De.unknown&&n.push(` - Missing or incomplete metadata for type "${e.name}" at property "${r.toString()}".\nThis property must be decorated either with @inject or @multiInject decorator.`);throw n.length===0?new Te(Ee.unknown,`Unexpected class metadata for type "${e.name}" with uncompletion traces.\nThis might be caused by one of the following reasons:\n\n1. A third party library is targeting inversify reflection metadata.\n2. A bug is causing the issue. Consider submiting an issue to fix it.`):new Te(Ee.missingInjectionDecorator,`Invalid class metadata at type ${e.name}:\n\n${n.join(`
21
21
 
22
22
  `)}`)})(e,t)}function Me(e,t){let n=je(t).scope??e.scope;return{cache:{isRight:!1,value:void 0},id:me(),implementationType:t,isSatisfiedBy:()=>!0,moduleId:void 0,onActivation:void 0,onDeactivation:void 0,scope:n,serviceIdentifier:t,type:ge.Instance}}function Ne(e){return e.isRight?{isRight:!0,value:e.value}:e}function Pe(e){switch(e.type){case ge.ConstantValue:case ge.DynamicValue:return function(e){return{cache:Ne(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type,value:e.value}}(e);case ge.Factory:return function(e){return{cache:Ne(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case ge.Instance:return function(e){return{cache:Ne(e.cache),id:e.id,implementationType:e.implementationType,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case ge.Provider:return function(e){return{cache:Ne(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,provider:e.provider,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case ge.ResolvedValue:return function(e){return{cache:Ne(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,metadata:e.metadata,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case ge.ServiceRedirection:return function(e){return{id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,serviceIdentifier:e.serviceIdentifier,targetServiceIdentifier:e.targetServiceIdentifier,type:e.type}}(e)}}(function(e){e[e.injectionDecoratorConflict=0]=`injectionDecoratorConflict`,e[e.missingInjectionDecorator=1]=`missingInjectionDecorator`,e[e.planning=2]=`planning`,e[e.resolution=3]=`resolution`,e[e.unknown=4]=`unknown`})(Ee||={}),function(e){e[e.unknown=32]=`unknown`}(De||={}),function(e){e.id=`id`,e.moduleId=`moduleId`,e.serviceId=`serviceId`}(Oe||={});var Fe=class e extends ve{_buildNewInstance(t){return new e(t)}_cloneModel(e){return Pe(e)}},Ie=class e{#e;#t;#n;constructor(e,t,n){this.#t=n??new Fe({id:{isOptional:!1},moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#n=e,this.#e=t}static build(t,n){return new e(t,n)}clone(){return new e(this.#n,this.#e,this.#t.clone())}get(e){let t=this.getNonParentBindings(e)??this.#n()?.get(e);if(t!==void 0)return t;let n=this.#r(e);return n===void 0?n:[n]}*getChained(e){let t=this.getNonParentBindings(e);t!==void 0&&(yield*t);let n=this.#n();if(n===void 0){if(t===void 0){let t=this.#r(e);t!==void 0&&(yield t)}}else yield*n.getChained(e)}getBoundServices(){let e=new Set(this.#t.getAllKeys(Oe.serviceId)),t=this.#n();if(t!==void 0)for(let n of t.getBoundServices())e.add(n);return e}getById(e){return this.#t.get(Oe.id,e)??this.#n()?.getById(e)}getByModuleId(e){return this.#t.get(Oe.moduleId,e)??this.#n()?.getByModuleId(e)}getNonParentBindings(e){return this.#t.get(Oe.serviceId,e)}getNonParentBoundServices(){return this.#t.getAllKeys(Oe.serviceId)}removeById(e){this.#t.removeByRelation(Oe.id,e)}removeAllByModuleId(e){this.#t.removeByRelation(Oe.moduleId,e)}removeAllByServiceId(e){this.#t.removeByRelation(Oe.serviceId,e)}set(e){let t={[Oe.id]:e.id,[Oe.serviceId]:e.serviceIdentifier};e.moduleId!==void 0&&(t[Oe.moduleId]=e.moduleId),this.#t.add(e,t)}#r(e){if(this.#e===void 0||typeof e!=`function`)return;let t=Me(this.#e,e);return this.set(t),t}};(function(e){e.moduleId=`moduleId`,e.serviceId=`serviceId`})(ke||={});var Le=class e{#e;#t;constructor(e,t){this.#e=t??new ve({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#t=e}static build(t){return new e(t)}add(e,t){this.#e.add(e,t)}clone(){return new e(this.#t,this.#e.clone())}get(e){let t=[],n=this.#e.get(ke.serviceId,e);n!==void 0&&t.push(n);let r=this.#t()?.get(e);if(r!==void 0&&t.push(r),t.length!==0)return _e(...t)}removeAllByModuleId(e){this.#e.removeByRelation(ke.moduleId,e)}removeAllByServiceId(e){this.#e.removeByRelation(ke.serviceId,e)}};function Re(){return 0}function ze(e){return t=>{t!==void 0&&t.kind===De.unknown&&de(e,Ce,Re,e=>e-1)}}function Be(e,t){return(...n)=>r=>{if(r===void 0)return e(...n);if(r.kind===Ae.unmanaged)throw new Te(Ee.injectionDecoratorConflict,`Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found`);return t(r,...n)}}function Ve(e){if(e.kind!==De.unknown&&!0!==e.isFromTypescriptParamType)throw new Te(Ee.injectionDecoratorConflict,`Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found`)}(function(e){e[e.multipleInjection=0]=`multipleInjection`,e[e.singleInjection=1]=`singleInjection`,e[e.unmanaged=2]=`unmanaged`})(Ae||={});const H=Be(function(e,t,n){return e===Ae.multipleInjection?{chained:n?.chained??!1,kind:e,name:void 0,optional:!1,tags:new Map,value:t}:{kind:e,name:void 0,optional:!1,tags:new Map,value:t}},function(e,t,n,r){return Ve(e),t===Ae.multipleInjection?{...e,chained:r?.chained??!1,kind:t,value:n}:{...e,kind:t,value:n}});function He(e,t){return n=>{let r=n.properties.get(t);return n.properties.set(t,e(r)),n}}var Ue;function We(e,t,n,r){if(Te.isErrorOfKind(r,Ee.injectionDecoratorConflict)){let i=function(e,t,n){if(n===void 0){if(t===void 0)throw new Te(Ee.unknown,`Unexpected undefined property and index values`);return{kind:Ue.property,property:t,targetClass:e.constructor}}return typeof n==`number`?{index:n,kind:Ue.parameter,targetClass:e}:{kind:Ue.method,method:t,targetClass:e}}(e,t,n);throw new Te(Ee.injectionDecoratorConflict,`Unexpected injection error.\n\nCause:\n\n${r.message}\n\nDetails\n\n${function(e){switch(e.kind){case Ue.method:return`[class: "${e.targetClass.name}", method: "${e.method.toString()}"]`;case Ue.parameter:return`[class: "${e.targetClass.name}", index: "${e.index.toString()}"]`;case Ue.property:return`[class: "${e.targetClass.name}", property: "${e.property.toString()}"]`}}(i)}`,{cause:r})}throw r}function Ge(e,t){return(n,r,i)=>{try{i===void 0?function(e,t){let n=Ke(e,t);return(e,t)=>{de(e.constructor,xe,Se,He(n(e),t))}}(e,t)(n,r):typeof i==`number`?function(e,t){let n=Ke(e,t);return(e,t,r)=>{if(!function(e,t){return typeof e==`function`&&t===void 0}(e,t))throw new Te(Ee.injectionDecoratorConflict,`Found an @inject decorator in a non constructor parameter.\nFound @inject decorator at method "${t?.toString()??``}" at class "${e.constructor.name}"`);de(e,xe,Se,function(e,t){return n=>{let r=n.constructorArguments[t];return n.constructorArguments[t]=e(r),n}}(n(e),r))}}(e,t)(n,r,i):function(e,t){let n=Ke(e,t);return(e,t,r)=>{if(!function(e){return e.set!==void 0}(r))throw new Te(Ee.injectionDecoratorConflict,`Found an @inject decorator in a non setter property method.\nFound @inject decorator at method "${t.toString()}" at class "${e.constructor.name}"`);de(e.constructor,xe,Se,He(n(e),t))}}(e,t)(n,r,i)}catch(e){We(n,r,i,e)}}}function Ke(e,t){return n=>{let r=t(n);return t=>(r(t),e(t))}}function qe(e){return Ge(H(Ae.singleInjection,e),ze)}(function(e){e[e.method=0]=`method`,e[e.parameter=1]=`parameter`,e[e.property=2]=`property`})(Ue||={});const Je=`@inversifyjs/core/classIsInjectableFlagReflectKey`,Ye=[Array,BigInt,Boolean,Function,Number,Object,String];function Xe(e){let t=le(e,`design:paramtypes`);t!==void 0&&de(e,xe,Se,function(e){return t=>(e.forEach((e,n)=>{var r;t.constructorArguments[n]!==void 0||(r=e,Ye.includes(r))||(t.constructorArguments[n]=function(e){return{isFromTypescriptParamType:!0,kind:Ae.singleInjection,name:void 0,optional:!1,tags:new Map,value:e}}(e))}),t)}(t))}function Ze(e){return t=>{(function(e){if(le(e,Je)!==void 0)throw new Te(Ee.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class "${e.name}"`);ue(e,Je,!0)})(t),Xe(t),e!==void 0&&de(t,xe,Se,t=>({...t,scope:e}))}}function Qe(e,t,n){let r;return e.extendConstructorArguments??!0?(r=[...t.constructorArguments],n.constructorArguments.map((e,t)=>{r[t]=e})):r=n.constructorArguments,r}function $e(e,t,n){return e?new Set([...t,...n]):n}function et(e,t,n){let r=e.lifecycle?.extendPostConstructMethods??!0,i=$e(e.lifecycle?.extendPreDestroyMethods??!0,t.lifecycle.preDestroyMethodNames,n.lifecycle.preDestroyMethodNames);return{postConstructMethodNames:$e(r,t.lifecycle.postConstructMethodNames,n.lifecycle.postConstructMethodNames),preDestroyMethodNames:i}}function tt(e,t,n){let r;return r=e.extendProperties??!0?new Map(_e(t.properties,n.properties)):n.properties,r}function nt(e){return t=>{de(t,xe,Se,function(e,t){return n=>({constructorArguments:Qe(e,t,n),lifecycle:et(e,t,n),properties:tt(e,t,n),scope:n.scope})}(e,je(e.type)))}}function rt(e){return t=>{let n=fe(t);if(n===void 0)throw new Te(Ee.injectionDecoratorConflict,`Expected base type for type "${t.name}", none found.`);nt({...e,type:n})(t)}}function it(e){return t=>{let n=[],r=fe(t);for(;r!==void 0&&r!==Object;){let e=r;n.push(e),r=fe(e)}n.reverse();for(let r of n)nt({...e,type:r})(t)}}function at(e){return t=>{t===void 0&&de(e,Ce,Re,e=>e+1)}}function ot(e){return t=>{let n=t??{kind:De.unknown,name:void 0,optional:!1,tags:new Map};if(n.kind===Ae.unmanaged)throw new Te(Ee.injectionDecoratorConflict,`Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections`);return e(n)}}function st(e){if(e.optional)throw new Te(Ee.injectionDecoratorConflict,`Unexpected duplicated optional decorator`);return e.optional=!0,e}function U(){return Ge(ot(st),at)}var ct;function lt(e){return e instanceof Error?e instanceof RangeError&&/stack space|call stack|too much recursion/i.test(e.message)||e.name===`InternalError`&&/too much recursion/.test(e.message):!1}function ut(e,t){if(lt(t)){let n=function(e){let t=[...e];return t.length===0?`(No dependency trace)`:t.map(oe).join(` -> `)}(function(e){let t=new Set;for(let n of e.servicesBranch){if(t.has(n))return[...t,n];t.add(n)}return[...t]}(e));throw new Te(Ee.planning,`Circular dependency found: ${n}`,{cause:t})}throw t}(function(e){e[e.multipleInjection=0]=`multipleInjection`,e[e.singleInjection=1]=`singleInjection`})(ct||={});const dt=Symbol.for(`@inversifyjs/core/LazyPlanServiceNode`);var ft=class{[dt];_serviceIdentifier;_serviceNode;constructor(e,t){this[dt]=!0,this._serviceNode=e,this._serviceIdentifier=t}get bindings(){return this._getNode().bindings}get isContextFree(){return this._getNode().isContextFree}get serviceIdentifier(){return this._serviceIdentifier}set bindings(e){this._getNode().bindings=e}set isContextFree(e){this._getNode().isContextFree=e}static is(e){return typeof e==`object`&&!!e&&!0===e[dt]}invalidate(){this._serviceNode=void 0}isExpanded(){return this._serviceNode!==void 0}_getNode(){return this._serviceNode===void 0&&(this._serviceNode=this._buildPlanServiceNode()),this._serviceNode}},pt=class e{#e;constructor(e){this.#e=e}get name(){return this.#e.elem.name}get serviceIdentifier(){return this.#e.elem.serviceIdentifier}get tags(){return this.#e.elem.tags}getAncestor(){if(this.#e.elem.getAncestorsCalled=!0,this.#e.previous!==void 0)return new e(this.#e.previous)}};function mt(e,t,n){let r=n?.customServiceIdentifier??t.serviceIdentifier,i=(!0===n?.chained?[...e.operations.getBindingsChained(r)]:[...e.operations.getBindings(r)??[]]).filter(e=>e.isSatisfiedBy(t));if(i.length===0&&e.autobindOptions!==void 0&&typeof r==`function`){let n=Me(e.autobindOptions,r);e.operations.setBinding(n),n.isSatisfiedBy(t)&&i.push(n)}return i}var ht=class e{last;constructor(e){this.last=e}concat(t){return new e({elem:t,previous:this.last})}[Symbol.iterator](){let e=this.last;return{next:()=>{if(e===void 0)return{done:!0,value:void 0};let t=e.elem;return e=e.previous,{done:!1,value:t}}}}};function gt(e){let t=new Map;return e.rootConstraints.tag!==void 0&&t.set(e.rootConstraints.tag.key,e.rootConstraints.tag.value),new ht({elem:{getAncestorsCalled:!1,name:e.rootConstraints.name,serviceIdentifier:e.rootConstraints.serviceIdentifier,tags:t},previous:void 0})}function _t(e){return e.redirections!==void 0}function vt(e,t,n,r){let i=n.elem.serviceIdentifier,a=n.previous?.elem.serviceIdentifier;Array.isArray(e)?function(e,t,n,r,i,a){if(e.length!==0){let t=`Ambiguous bindings found for service: "${oe(a[a.length-1]??n)}".${St(a)}\n\nRegistered bindings:\n\n${e.map(e=>function(e){switch(e.type){case ge.Instance:return`[ type: "${e.type}", serviceIdentifier: "${oe(e.serviceIdentifier)}", scope: "${e.scope}", implementationType: "${e.implementationType.name}" ]`;case ge.ServiceRedirection:return`[ type: "${e.type}", serviceIdentifier: "${oe(e.serviceIdentifier)}", redirection: "${oe(e.targetServiceIdentifier)}" ]`;default:return`[ type: "${e.type}", serviceIdentifier: "${oe(e.serviceIdentifier)}", scope: "${e.scope}" ]`}}(e.binding)).join(`
23
23
  `)}\n\nTrying to resolve bindings for "${bt(n,r)}".${xt(i)}`;throw new Te(Ee.planning,t)}t||yt(n,r,i,a)}(e,t,i,a,n.elem,r):function(e,t,n,r,i,a){e!==void 0||t||yt(n,r,i,a)}(e,t,i,a,n.elem,r)}function yt(e,t,n,r){let i=`No bindings found for service: "${oe(r[r.length-1]??e)}".\n\nTrying to resolve bindings for "${bt(e,t)}".${St(r)}${xt(n)}`;throw new Te(Ee.planning,i)}function bt(e,t){return t===void 0?`${oe(e)} (Root service)`:oe(t)}function xt(e){let t=e.tags.size===0?``:`\n- tags:\n - ${[...e.tags.keys()].map(e=>e.toString()).join(`
@@ -33013,7 +33013,7 @@ Notes:
33013
33013
  - * Required fields: --api-key, --token, --frequency, --start-time
33014
33014
  - Frequency can be weekly or monthly
33015
33015
  Need help? → https://docs.startearly.ai
33016
- `).action(async e=>{try{let t={...e,command:EU.COVERAGE};$1.bind(wU.CliOptions).toConstantValue(t),await(await $1.getAsync(g4)).runFlow(),$1.unbind(wU.CliOptions)}catch(e){$1.get(fZ).error(`Error:`,e instanceof Error?e.message:`Unknown error`),process.exit(1)}})}const v4=/\.early\.(test|spec)\.[tj]sx?$/,y4=/^test_early_.*\.py$/;function b4(e){let t=TU.basename(e);return v4.test(t)||y4.test(t)}let x4=class extends n4{async runFlow(){await this.login();let e=this.configService.getConfigValueOrThrow(`gitOrg`),t=this.configService.getConfigValueOrThrow(`gitRepo`);if(!(0,B.isDefined)(this.teamId))throw Error(`User is not associated with a team`);let n=await this.logStart();try{let r=this.configService.getConfigValue(`prNumber`);await((0,B.isDefined)(r)?this.runSinglePrMode(e,t,n,Number(r)):this.runBatchMode(e,t,n)),await this.logEndOperation()}catch(e){let t=e instanceof Error?e.message:`Unknown error`;throw await this.logEndOperation(t),e}}async runSinglePrMode(e,t,n,r){this.logger.info(`Single PR mode — processing PR #${r}`);let i=await this.scmHostService.getMergedPrByNumber(e,t,r);if(!(0,B.isDefined)(i)){this.logger.info(`PR #${r} not found or still open — skipping`);return}this.logger.info(`PR #${r} [${i.state}]: found`);let a=await this.processMergedPr(e,t,i);(0,B.isDefined)(a)?(this.logger.info(`Reporting 1 PR with Early activity`),await this.workflowService.reportAdoptions(n,this.applySummaryOnly([a]))):this.logger.info(`No PRs with Early activity found`)}async runBatchMode(e,t,n){let r=this.configService.getConfigValue(`backfill`),i=this.configService.getConfigValue(`maxPrs`)??5,a=this.configService.getConfigValue(`maxTags`)??10,o=r?null:await this.workflowService.getLastGatherStatsRun(this.teamId,e,t);r?this.logger.info(`Backfill mode — reprocessing up to ${i} recent PRs`):this.logger.info((0,B.isDefined)(o)?`Last gather-stats run: ${o.toISOString()}`:`First gather-stats run — processing up to ${i} recent PRs`);let{prs:s,tags:c}=await this.scmHostService.getMergedPrsWithDetails(e,t,o,(0,B.isDefined)(o)?2**53-1:i,a);this.logger.info(`Found ${s.length} PRs and ${c.length} tags to process`);let l=[];for(let n of s){let r=await this.processMergedPr(e,t,n);(0,B.isDefined)(r)&&l.push(r)}for(let n of c)l.push(this.mapTagToAdoptionEntry(e,t,n)),this.logger.info(`Tag ${n.name}: included — commit ${n.commitSha}`);l.length>0?(this.logger.info(`Reporting ${l.length} entries with Early activity`),await this.workflowService.reportAdoptions(n,this.applySummaryOnly(l))):this.logger.info(`No PRs with Early activity found`)}mapTagToAdoptionEntry(e,t,n){let r={tagName:n.name,commitDate:n.commitDate,taggerDate:n.taggerDate,taggerName:n.taggerName,taggerEmail:n.taggerEmail,message:n.message};return{owner:e,repo:t,prNumber:-1,prState:`MERGED`,mergedAt:n.taggerDate??n.commitDate,commitSha:n.commitSha,earlyFiles:[{path:n.name,changeType:`TAG`}],commits:[],prOutcomeSummary:r}}applySummaryOnly(e){return this.configService.getConfigValue(`summaryOnly`)??!0?e.map(e=>e.prNumber===-1?{...e,commits:[]}:{...e,earlyFiles:[],commits:[]}):e}async logEndOperation(e){if((0,B.isDefined)(this.workflowRunId))try{await this.workflowService.logEndOperation(this.workflowRunId,e),this.logger.info(`Successfully logged workflow end`)}catch(e){this.logger.warn(`Failed to log workflow end: `+(e instanceof Error?e.message:`Unknown error`))}}async computePrOutcomeSummary(e,t){let n=e.commits.at(-1)?.oid;if(!(!(0,B.isDefined)(n)||!(0,B.isDefined)(this.teamId)))try{this.logger.info(`PR #${e.number}: looking up run_output for commit ${n}`);let r=(await this.workflowService.getRunOutputByCommitSha(this.teamId,n)).runOutput;if(!(0,B.isDefined)(r)||!Array.isArray(r.publicMethods)||r.publicMethods.length===0)return this.logger.info(`PR #${e.number}: no publicMethods in run_output — using zero-count summary`),{methodsWithExistingTestsNotChanged:0,methodsWithNewTestsAdded:t.filter(e=>e.changeType===`ADDED`).length,methodsWithExistingTestsModified:t.filter(e=>e.changeType===`MODIFIED`).length,methodsWithExistingTestsDeleted:t.filter(e=>e.changeType===`DELETED`).length};let i=new Set(r.publicMethods.filter(e=>(0,B.isDefined)(e.testPath)).map(e=>e.testPath)),a=new Set(t.filter(e=>e.changeType===`ADDED`).map(e=>e.path)),o=new Set(t.filter(e=>e.changeType===`MODIFIED`).map(e=>e.path)),s=new Set(t.filter(e=>e.changeType===`DELETED`).map(e=>e.path)),c=new Set([...a,...o,...s]),l=[...i].filter(e=>!c.has(e)).length,u={methodsWithExistingTestsNotChanged:l,methodsWithNewTestsAdded:a.size,methodsWithExistingTestsModified:o.size,methodsWithExistingTestsDeleted:s.size};return this.logger.info(`PR #${e.number}: prOutcomeSummary — ${i.size} testPaths, ${l} existing, ${a.size} new, ${o.size} modified, ${s.size} deleted`),u}catch(t){this.logger.warn(`PR #${e.number}: failed to compute prOutcomeSummary for commit ${n}: ${t instanceof Error?t.message:`Unknown error`}`);return}}async processMergedPr(e,t,n){let r=n.files.filter(e=>b4(e.path)).map(e=>({path:e.path,changeType:e.changeType})),i=[];for(let r of n.commits){let n=(await this.scmHostService.getCommitFiles(e,t,r.oid)).filter(e=>b4(e.filename)).map(e=>({path:e.filename,changeType:e.status}));n.length>0&&i.push({sha:r.oid,date:r.date,files:n})}if(r.length>0||i.length>0){this.logger.info(`PR #${n.number} [${n.state}]: included — ${r.length} early files in diff, ${i.length} commits with early files`);let a=await this.computePrOutcomeSummary(n,r);return{owner:e,repo:t,prNumber:n.number,prState:n.state,mergedAt:n.mergedAt,commitSha:n.mergeCommitSha??void 0,earlyFiles:r,commits:i,prOutcomeSummary:a}}if(await this.checkForWorkflowRun(n)){this.logger.info(`PR #${n.number} [${n.state}]: included — no early files but has Early workflow run`);let a=await this.computePrOutcomeSummary(n,r);return{owner:e,repo:t,prNumber:n.number,prState:n.state,mergedAt:n.mergedAt,commitSha:n.mergeCommitSha??void 0,earlyFiles:r,commits:i,prOutcomeSummary:a}}this.logger.info(`PR #${n.number} [${n.state}]: skipped — no early files and no Early workflow run`)}async checkForWorkflowRun(e){let t=e.commits.at(-1)?.oid;if(!(0,B.isDefined)(t)||!(0,B.isDefined)(this.teamId))return!1;try{return(0,B.isDefined)((await this.workflowService.getRunOutputByCommitSha(this.teamId,t)).runOutput)}catch{return!1}}};x4=uZ([Ze(),it({extendConstructorArguments:!0,extendProperties:!0})],x4);function S4(e){let t=e.command(EU.GATHER_STATS).alias(`stats`).description(`Gather adoption stats for EarlyAI-generated test files in merged PRs`);return V(t,`--git-org <org>`,`Git organization name`,{envName:`GIT_ORG`}),V(t,`--git-repo <repo>`,`Git repository name`,{envName:`GIT_REPO`}),V(t,`--scm-provider <provider>`,`SCM provider (e.g., github, bitbucket)`,{envName:`SCM_PROVIDER`,def:`github`}),V(t,`--ref-name <ref>`,`Head branch name`,{envName:`REF_NAME`,isRequired:!0}),V(t,`--backfill [value]`,`Ignore last run timestamp and reprocess all recent PRs`,{envName:`BACKFILL`,def:`false`}),V(t,`--max-prs <number>`,`Maximum number of PRs to process on first run or backfill (default: 5)`,{envName:`MAX_PRS`}),V(t,`--max-tags <number>`,`Maximum number of release tags to fetch (default: 10)`,{envName:`MAX_TAGS`}),V(t,`--pr-number <number>`,`Process a single PR by number (ignores --backfill and --max-prs)`,{envName:`PR_NUMBER`}),V(t,`--summary-only [value]`,`Report only the adoption summary per PR (default: true). When false, also includes per-file details and per-commit breakdowns`,{envName:`SUMMARY_ONLY`,def:`true`}),t.addHelpText(`after`,`
33016
+ `).action(async e=>{try{let t={...e,command:EU.COVERAGE};$1.bind(wU.CliOptions).toConstantValue(t),await(await $1.getAsync(g4)).runFlow(),$1.unbind(wU.CliOptions)}catch(e){$1.get(fZ).error(`Error:`,e instanceof Error?e.message:`Unknown error`),process.exit(1)}})}const v4=/\.early\.(test|spec)\.[tj]sx?$/,y4=/^test_early_.*\.py$/;function b4(e){let t=TU.basename(e);return v4.test(t)||y4.test(t)}let x4=class extends n4{async runFlow(){await this.login();let e=this.configService.getConfigValueOrThrow(`gitOrg`),t=this.configService.getConfigValueOrThrow(`gitRepo`);if(!(0,B.isDefined)(this.teamId))throw Error(`User is not associated with a team`);let n=await this.logStart();try{let r=this.configService.getConfigValue(`prNumber`);await((0,B.isDefined)(r)?this.runSinglePrMode(e,t,n,Number(r)):this.runBatchMode(e,t,n)),await this.logEndOperation()}catch(e){let t=e instanceof Error?e.message:`Unknown error`;throw await this.logEndOperation(t),e}}async runSinglePrMode(e,t,n,r){this.logger.info(`Single PR mode — processing PR #${r}`);let i=await this.scmHostService.getMergedPrByNumber(e,t,r);if(!(0,B.isDefined)(i)){this.logger.info(`PR #${r} not found or still open — skipping`);return}this.logger.info(`PR #${r} [${i.state}]: found`);let a=await this.processMergedPr(e,t,i);this.logger.info(`Reporting 1 PR with Early activity`),await this.workflowService.reportAdoptions(n,this.applySummaryOnly([a]))}async runBatchMode(e,t,n){let r=this.configService.getConfigValue(`backfill`),i=this.configService.getConfigValue(`maxPrs`)??5,a=this.configService.getConfigValue(`maxTags`)??10,o=r?null:await this.workflowService.getLastGatherStatsRun(this.teamId,e,t);r?this.logger.info(`Backfill mode — reprocessing up to ${i} recent PRs`):this.logger.info((0,B.isDefined)(o)?`Last gather-stats run: ${o.toISOString()}`:`First gather-stats run — processing up to ${i} recent PRs`);let{prs:s,tags:c}=await this.scmHostService.getMergedPrsWithDetails(e,t,o,(0,B.isDefined)(o)?2**53-1:i,a);this.logger.info(`Found ${s.length} PRs and ${c.length} tags to process`);let l=[];for(let n of s)l.push(await this.processMergedPr(e,t,n));for(let n of c)l.push(this.mapTagToAdoptionEntry(e,t,n)),this.logger.info(`Tag ${n.name}: included — commit ${n.commitSha}`);l.length>0?(this.logger.info(`Reporting ${l.length} entries with Early activity`),await this.workflowService.reportAdoptions(n,this.applySummaryOnly(l))):this.logger.info(`No merged PRs or tags found in time window`)}mapTagToAdoptionEntry(e,t,n){let r={tagName:n.name,commitDate:n.commitDate,taggerDate:n.taggerDate,taggerName:n.taggerName,taggerEmail:n.taggerEmail,message:n.message};return{owner:e,repo:t,prNumber:-1,prState:`MERGED`,mergedAt:n.taggerDate??n.commitDate,commitSha:n.commitSha,earlyFiles:[{path:n.name,changeType:`TAG`}],commits:[],prOutcomeSummary:r}}applySummaryOnly(e){return this.configService.getConfigValue(`summaryOnly`)??!0?e.map(e=>e.prNumber===-1?{...e,commits:[]}:{...e,earlyFiles:[],commits:[]}):e}async logEndOperation(e){if((0,B.isDefined)(this.workflowRunId))try{await this.workflowService.logEndOperation(this.workflowRunId,e),this.logger.info(`Successfully logged workflow end`)}catch(e){this.logger.warn(`Failed to log workflow end: `+(e instanceof Error?e.message:`Unknown error`))}}async computePrOutcomeSummary(e,t){let n=e.commits.at(-1)?.oid;if(!(!(0,B.isDefined)(n)||!(0,B.isDefined)(this.teamId)))try{this.logger.info(`PR #${e.number}: looking up run_output for commit ${n}`);let r=(await this.workflowService.getRunOutputByCommitSha(this.teamId,n)).runOutput;if(!(0,B.isDefined)(r)||!Array.isArray(r.publicMethods)||r.publicMethods.length===0)return this.logger.info(`PR #${e.number}: no publicMethods in run_output — using zero-count summary`),{methodsWithExistingTestsNotChanged:0,methodsWithNewTestsAdded:t.filter(e=>e.changeType===`ADDED`).length,methodsWithExistingTestsModified:t.filter(e=>e.changeType===`MODIFIED`).length,methodsWithExistingTestsDeleted:t.filter(e=>e.changeType===`DELETED`).length};let i=new Set(r.publicMethods.filter(e=>(0,B.isDefined)(e.testPath)).map(e=>e.testPath)),a=new Set(t.filter(e=>e.changeType===`ADDED`).map(e=>e.path)),o=new Set(t.filter(e=>e.changeType===`MODIFIED`).map(e=>e.path)),s=new Set(t.filter(e=>e.changeType===`DELETED`).map(e=>e.path)),c=new Set([...a,...o,...s]),l=[...i].filter(e=>!c.has(e)).length,u={methodsWithExistingTestsNotChanged:l,methodsWithNewTestsAdded:a.size,methodsWithExistingTestsModified:o.size,methodsWithExistingTestsDeleted:s.size};return this.logger.info(`PR #${e.number}: prOutcomeSummary — ${i.size} testPaths, ${l} existing, ${a.size} new, ${o.size} modified, ${s.size} deleted`),u}catch(t){this.logger.warn(`PR #${e.number}: failed to compute prOutcomeSummary for commit ${n}: ${t instanceof Error?t.message:`Unknown error`}`);return}}async processMergedPr(e,t,n){let r=n.files.filter(e=>b4(e.path)).map(e=>({path:e.path,changeType:e.changeType})),i=[];for(let r of n.commits){let n=(await this.scmHostService.getCommitFiles(e,t,r.oid)).filter(e=>b4(e.filename)).map(e=>({path:e.filename,changeType:e.status}));n.length>0&&i.push({sha:r.oid,date:r.date,files:n})}this.logger.info(`PR #${n.number} [${n.state}]: included — ${r.length} early files in diff, ${i.length} commits with early files`);let a=await this.computePrOutcomeSummary(n,r);return{owner:e,repo:t,prNumber:n.number,prState:n.state,mergedAt:n.mergedAt,commitSha:n.mergeCommitSha??void 0,earlyFiles:r,commits:i,prOutcomeSummary:a}}};x4=uZ([Ze(),it({extendConstructorArguments:!0,extendProperties:!0})],x4);function S4(e){let t=e.command(EU.GATHER_STATS).alias(`stats`).description(`Gather adoption stats for EarlyAI-generated test files in merged PRs`);return V(t,`--git-org <org>`,`Git organization name`,{envName:`GIT_ORG`}),V(t,`--git-repo <repo>`,`Git repository name`,{envName:`GIT_REPO`}),V(t,`--scm-provider <provider>`,`SCM provider (e.g., github, bitbucket)`,{envName:`SCM_PROVIDER`,def:`github`}),V(t,`--ref-name <ref>`,`Head branch name`,{envName:`REF_NAME`,isRequired:!0}),V(t,`--backfill [value]`,`Ignore last run timestamp and reprocess all recent PRs`,{envName:`BACKFILL`,def:`false`}),V(t,`--max-prs <number>`,`Maximum number of PRs to process on first run or backfill (default: 5)`,{envName:`MAX_PRS`}),V(t,`--max-tags <number>`,`Maximum number of release tags to fetch (default: 10)`,{envName:`MAX_TAGS`}),V(t,`--pr-number <number>`,`Process a single PR by number (ignores --backfill and --max-prs)`,{envName:`PR_NUMBER`}),V(t,`--summary-only [value]`,`Report only the adoption summary per PR (default: true). When false, also includes per-file details and per-commit breakdowns`,{envName:`SUMMARY_ONLY`,def:`true`}),t.addHelpText(`after`,`
33017
33017
  Examples:
33018
33018
  $ early gather-stats --api-key your-api-key --token your-github-token
33019
33019
  $ early stats --api-key your-api-key --token your-github-token --git-org myorg --git-repo myrepo
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@earlyai/cli",
3
- "version": "2.13.1",
3
+ "version": "2.13.2",
4
4
  "description": "early cli",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {