agentica 0.12.10 → 0.12.14
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/bin/index.js +13 -122
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_modules__={"../../node_modules/.pnpm/typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.8.2/node_modules/typia/lib/internal/_assertGuard.js":function(e,t,r){"use strict";t._assertGuard=void 0;let i=r("../../node_modules/.pnpm/typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.8.2/node_modules/typia/lib/TypeGuardError.mjs");t._assertGuard=(e,t,r)=>{if(!0===e){if(r)throw r(t);throw new i.TypeGuardError(t)}return!1}},"../../node_modules/.pnpm/typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.8.2/node_modules/typia/lib/internal/_isFormatDateTime.js":function(e,t){"use strict";t._isFormatDateTime=void 0,t._isFormatDateTime=e=>r.test(e);let r=/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(T|\s)([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](?:\.[0-9]{1,9})?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$/i},child_process:function(e){"use strict";e.exports=require("child_process")},events:function(e){"use strict";e.exports=require("events")},fs:function(e){"use strict";e.exports=require("fs")},path:function(e){"use strict";e.exports=require("path")},process:function(e){"use strict";e.exports=require("process")},prettier:function(e){"use strict";e.exports=import("prettier")},"../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/index.js":function(e,t,r){let{Argument:i}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/argument.js"),{Command:
|
|
3
|
-
- specify the name in Command constructor or using .name()`);return(t=t||{}).isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this.commands.push(e),e.parent=this,this}createArgument(e,t){return new l(e,t)}argument(e,t,r,i){let
|
|
4
|
-
Expecting one of '${r.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=e=>{if("commander.executeSubCommandAsync"!==e.code)throw e},this}_exit(e,t,r){this._exitCallback&&this._exitCallback(new c(e,t,r)),a.exit(e)}action(e){return this._actionHandler=t=>{let r=this._args.length,i=t.slice(0,r);return this._storeOptionsAsProperties?i[r]=this:i[r]=this.opts(),i.push(this),e.apply(this,i)},this}createOption(e,t){return new u(e,t)}addOption(e){let t=e.name(),r=e.attributeName();if(e.negate){let t=e.long.replace(/^--no-/,"--");this._findOption(t)||this.setOptionValueWithSource(r,void 0===e.defaultValue||e.defaultValue,"default")}else void 0!==e.defaultValue&&this.setOptionValueWithSource(r,e.defaultValue,"default");this.options.push(e);let i=(t,i,
|
|
2
|
+
let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_modules__={"../../node_modules/.pnpm/typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.8.2/node_modules/typia/lib/internal/_assertGuard.js":function(e,t,r){"use strict";t._assertGuard=void 0;let i=r("../../node_modules/.pnpm/typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.8.2/node_modules/typia/lib/TypeGuardError.mjs");t._assertGuard=(e,t,r)=>{if(!0===e){if(r)throw r(t);throw new i.TypeGuardError(t)}return!1}},"../../node_modules/.pnpm/typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.8.2/node_modules/typia/lib/internal/_isFormatDateTime.js":function(e,t){"use strict";t._isFormatDateTime=void 0,t._isFormatDateTime=e=>r.test(e);let r=/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(T|\s)([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](?:\.[0-9]{1,9})?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$/i},child_process:function(e){"use strict";e.exports=require("child_process")},events:function(e){"use strict";e.exports=require("events")},fs:function(e){"use strict";e.exports=require("fs")},path:function(e){"use strict";e.exports=require("path")},process:function(e){"use strict";e.exports=require("process")},prettier:function(e){"use strict";e.exports=import("prettier")},"../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/index.js":function(e,t,r){let{Argument:i}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/argument.js"),{Command:s}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/command.js"),{CommanderError:n,InvalidArgumentError:o}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/error.js"),{Help:a}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/help.js"),{Option:l}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/option.js");(t=e.exports=new s).program=t,t.Argument=i,t.Command=s,t.CommanderError=n,t.Help=a,t.InvalidArgumentError=o,t.InvalidOptionArgumentError=o,t.Option=l},"../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/argument.js":function(e,t,r){let{InvalidArgumentError:i}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/error.js");t.Argument=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}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)?t.concat(e):[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=(e,t)=>{if(!this.argChoices.includes(e))throw new i(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,t):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}},t.humanReadableArgName=function(e){let t=e.name()+(!0===e.variadic?"...":"");return e.required?"<"+t+">":"["+t+"]"}},"../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/command.js":function(e,t,r){let i=r("events").EventEmitter,s=r("child_process"),n=r("path"),o=r("fs"),a=r("process"),{Argument:l,humanReadableArgName:p}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/argument.js"),{CommanderError:c}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/error.js"),{Help:h}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/help.js"),{Option:u,splitOptionFlags:m,DualOptions:d}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/option.js"),{suggestSimilar:_}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/suggestSimilar.js");class g extends i{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this._args=[],this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:e=>a.stdout.write(e),writeErr:e=>a.stderr.write(e),getOutHelpWidth:()=>a.stdout.isTTY?a.stdout.columns:void 0,getErrHelpWidth:()=>a.stderr.isTTY?a.stderr.columns:void 0,outputError:(e,t)=>t(e)},this._hidden=!1,this._hasHelpOption=!0,this._helpFlags="-h, --help",this._helpDescription="display help for command",this._helpShortFlag="-h",this._helpLongFlag="--help",this._addImplicitHelpCommand=void 0,this._helpCommandName="help",this._helpCommandnameAndArgs="help [command]",this._helpCommandDescription="display help for command",this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._hasHelpOption=e._hasHelpOption,this._helpFlags=e._helpFlags,this._helpDescription=e._helpDescription,this._helpShortFlag=e._helpShortFlag,this._helpLongFlag=e._helpLongFlag,this._helpCommandName=e._helpCommandName,this._helpCommandnameAndArgs=e._helpCommandnameAndArgs,this._helpCommandDescription=e._helpCommandDescription,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}command(e,t,r){let i=t,s=r;"object"==typeof i&&null!==i&&(s=i,i=null),s=s||{};let[,n,o]=e.match(/([^ ]+) *(.*)/),a=this.createCommand(n);return(i&&(a.description(i),a._executableHandler=!0),s.isDefault&&(this._defaultCommandName=a._name),a._hidden=!!(s.noHelp||s.hidden),a._executableFile=s.executableFile||null,o&&a.arguments(o),this.commands.push(a),a.parent=this,a.copyInheritedSettings(this),i)?this:a}createCommand(e){return new g(e)}createHelp(){return Object.assign(new h,this.configureHelp())}configureHelp(e){return void 0===e?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return void 0===e?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return"string"!=typeof e&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
|
|
3
|
+
- specify the name in Command constructor or using .name()`);return(t=t||{}).isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this.commands.push(e),e.parent=this,this}createArgument(e,t){return new l(e,t)}argument(e,t,r,i){let s=this.createArgument(e,t);return"function"==typeof r?s.default(i).argParser(r):s.default(r),this.addArgument(s),this}arguments(e){return e.split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(e){let t=this._args.slice(-1)[0];if(t&&t.variadic)throw Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&void 0!==e.defaultValue&&void 0===e.parseArg)throw Error(`a default value for a required argument is never used: '${e.name()}'`);return this._args.push(e),this}addHelpCommand(e,t){return!1===e?this._addImplicitHelpCommand=!1:(this._addImplicitHelpCommand=!0,"string"==typeof e&&(this._helpCommandName=e.split(" ")[0],this._helpCommandnameAndArgs=e),this._helpCommandDescription=t||this._helpCommandDescription),this}_hasImplicitHelpCommand(){return void 0===this._addImplicitHelpCommand?this.commands.length&&!this._actionHandler&&!this._findCommand("help"):this._addImplicitHelpCommand}hook(e,t){let r=["preSubcommand","preAction","postAction"];if(!r.includes(e))throw Error(`Unexpected value for event passed to hook : '${e}'.
|
|
4
|
+
Expecting one of '${r.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=e=>{if("commander.executeSubCommandAsync"!==e.code)throw e},this}_exit(e,t,r){this._exitCallback&&this._exitCallback(new c(e,t,r)),a.exit(e)}action(e){return this._actionHandler=t=>{let r=this._args.length,i=t.slice(0,r);return this._storeOptionsAsProperties?i[r]=this:i[r]=this.opts(),i.push(this),e.apply(this,i)},this}createOption(e,t){return new u(e,t)}addOption(e){let t=e.name(),r=e.attributeName();if(e.negate){let t=e.long.replace(/^--no-/,"--");this._findOption(t)||this.setOptionValueWithSource(r,void 0===e.defaultValue||e.defaultValue,"default")}else void 0!==e.defaultValue&&this.setOptionValueWithSource(r,e.defaultValue,"default");this.options.push(e);let i=(t,i,s)=>{null==t&&void 0!==e.presetArg&&(t=e.presetArg);let n=this.getOptionValue(r);if(null!==t&&e.parseArg)try{t=e.parseArg(t,n)}catch(e){if("commander.invalidArgument"===e.code){let t=`${i} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}else null!==t&&e.variadic&&(t=e._concatValue(t,n));null==t&&(t=!e.negate&&(!!e.isBoolean()||!!e.optional||"")),this.setOptionValueWithSource(r,t,s)};return this.on("option:"+t,t=>{let r=`error: option '${e.flags}' argument '${t}' is invalid.`;i(t,r,"cli")}),e.envVar&&this.on("optionEnv:"+t,t=>{let r=`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`;i(t,r,"env")}),this}_optionEx(e,t,r,i,s){if("object"==typeof t&&t instanceof u)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let n=this.createOption(t,r);if(n.makeOptionMandatory(!!e.mandatory),"function"==typeof i)n.default(s).argParser(i);else if(i instanceof RegExp){let e=i;i=(t,r)=>{let i=e.exec(t);return i?i[0]:r},n.default(s).argParser(i)}else n.default(i);return this.addOption(n)}option(e,t,r,i){return this._optionEx({},e,t,r,i)}requiredOption(e,t,r,i){return this._optionEx({mandatory:!0},e,t,r,i)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){if(this._passThroughOptions=!!e,this.parent&&e&&!this.parent._enablePositionalOptions)throw Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}storeOptionsAsProperties(e=!0){if(this._storeOptionsAsProperties=!!e,this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");return this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,r){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=r,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return v(this).forEach(r=>{void 0!==r.getOptionValueSource(e)&&(t=r.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){let r;if(void 0!==e&&!Array.isArray(e))throw Error("first parameter to parse must be array or undefined");switch(t=t||{},void 0===e&&(e=a.argv,a.versions&&a.versions.electron&&(t.from="electron")),this.rawArgs=e.slice(),t.from){case void 0:case"node":this._scriptPath=e[1],r=e.slice(2);break;case"electron":a.defaultApp?(this._scriptPath=e[1],r=e.slice(2)):r=e.slice(1);break;case"user":r=e.slice(0);break;default:throw Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",r}parse(e,t){let r=this._prepareUserArgs(e,t);return this._parseCommand([],r),this}async parseAsync(e,t){let r=this._prepareUserArgs(e,t);return await this._parseCommand([],r),this}_executeSubCommand(e,t){let r;t=t.slice();let i=!1,l=[".js",".ts",".tsx",".mjs",".cjs"];function p(e,t){let r=n.resolve(e,t);if(o.existsSync(r))return r;if(l.includes(n.extname(t)))return;let i=l.find(e=>o.existsSync(`${r}${e}`));if(i)return`${r}${i}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let h=e._executableFile||`${this._name}-${e._name}`,u=this._executableDir||"";if(this._scriptPath){let e;try{e=o.realpathSync(this._scriptPath)}catch(t){e=this._scriptPath}u=n.resolve(n.dirname(e),u)}if(u){let t=p(u,h);if(!t&&!e._executableFile&&this._scriptPath){let r=n.basename(this._scriptPath,n.extname(this._scriptPath));r!==this._name&&(t=p(u,`${r}-${e._name}`))}h=t||h}i=l.includes(n.extname(h)),"win32"!==a.platform?i?(t.unshift(h),t=b(a.execArgv).concat(t),r=s.spawn(a.argv[0],t,{stdio:"inherit"})):r=s.spawn(h,t,{stdio:"inherit"}):(t.unshift(h),t=b(a.execArgv).concat(t),r=s.spawn(a.execPath,t,{stdio:"inherit"})),r.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(e=>{a.on(e,()=>{!1===r.killed&&null===r.exitCode&&r.kill(e)})});let m=this._exitCallback;m?r.on("close",()=>{m(new c(a.exitCode||0,"commander.executeSubCommandAsync","(close)"))}):r.on("close",a.exit.bind(a)),r.on("error",t=>{if("ENOENT"===t.code){let t=u?`searched for local subcommand relative to directory '${u}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory";throw Error(`'${h}' does not exist
|
|
5
5
|
- if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
6
6
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
7
|
-
- ${t}`)}if("EACCES"===t.code)throw Error(`'${h}' not executable`);if(
|
|
7
|
+
- ${t}`)}if("EACCES"===t.code)throw Error(`'${h}' not executable`);if(m){let e=new c(1,"commander.executeSubCommandAsync","(error)");e.nestedError=t,m(e)}else a.exit(1)}),this.runningCommand=r}_dispatchSubcommand(e,t,r){let i;let s=this._findCommand(e);return s||this.help({error:!0}),i=this._chainOrCallSubCommandHook(i,s,"preSubcommand"),i=this._chainOrCall(i,()=>{if(!s._executableHandler)return s._parseCommand(t,r);this._executeSubCommand(s,t.concat(r))})}_checkNumberOfArguments(){this._args.forEach((e,t)=>{e.required&&null==this.args[t]&&this.missingArgument(e.name())}),(!(this._args.length>0)||!this._args[this._args.length-1].variadic)&&this.args.length>this._args.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,r)=>{let i=t;if(null!==t&&e.parseArg)try{i=e.parseArg(t,r)}catch(r){if("commander.invalidArgument"===r.code){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'. ${r.message}`;this.error(i,{exitCode:r.exitCode,code:r.code})}throw r}return i};this._checkNumberOfArguments();let t=[];this._args.forEach((r,i)=>{let s=r.defaultValue;r.variadic?i<this.args.length?(s=this.args.slice(i),r.parseArg&&(s=s.reduce((t,i)=>e(r,i,t),r.defaultValue))):void 0===s&&(s=[]):i<this.args.length&&(s=this.args[i],r.parseArg&&(s=e(r,s,r.defaultValue))),t[i]=s}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&"function"==typeof e.then?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let r=e,i=[];return v(this).reverse().filter(e=>void 0!==e._lifeCycleHooks[t]).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{i.push({hookedCommand:e,callback:t})})}),"postAction"===t&&i.reverse(),i.forEach(e=>{r=this._chainOrCall(r,()=>e.callback(e.hookedCommand,this))}),r}_chainOrCallSubCommandHook(e,t,r){let i=e;return void 0!==this._lifeCycleHooks[r]&&this._lifeCycleHooks[r].forEach(e=>{i=this._chainOrCall(i,()=>e(this,t))}),i}_parseCommand(e,t){let r=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(r.operands),t=r.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._hasImplicitHelpCommand()&&e[0]===this._helpCommandName)return 1===e.length&&this.help(),this._dispatchSubcommand(e[1],[],[this._helpLongFlag]);if(this._defaultCommandName)return f(this,t),this._dispatchSubcommand(this._defaultCommandName,e,t);!this.commands.length||0!==this.args.length||this._actionHandler||this._defaultCommandName||this.help({error:!0}),f(this,r.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let i=()=>{r.unknown.length>0&&this.unknownOption(r.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){let r;return i(),this._processArguments(),r=this._chainOrCallHooks(r,"preAction"),r=this._chainOrCall(r,()=>this._actionHandler(this.processedArgs)),this.parent&&(r=this._chainOrCall(r,()=>{this.parent.emit(s,e,t)})),r=this._chainOrCallHooks(r,"postAction")}if(this.parent&&this.parent.listenerCount(s))i(),this._processArguments(),this.parent.emit(s,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(i(),this._processArguments())}else this.commands.length?(i(),this.help({error:!0})):(i(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){for(let e=this;e;e=e.parent)e.options.forEach(t=>{t.mandatory&&void 0===e.getOptionValue(t.attributeName())&&e.missingMandatoryOptionValue(t)})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return void 0!==this.getOptionValue(t)&&"default"!==this.getOptionValueSource(t)});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let r=e.find(e=>t.conflictsWith.includes(e.attributeName()));r&&this._conflictingOption(t,r)})}_checkForConflictingOptions(){for(let e=this;e;e=e.parent)e._checkForConflictingLocalOptions()}parseOptions(e){let t=[],r=[],i=t,s=e.slice();function n(e){return e.length>1&&"-"===e[0]}let o=null;for(;s.length;){let e=s.shift();if("--"===e){i===r&&i.push(e),i.push(...s);break}if(o&&!n(e)){this.emit(`option:${o.name()}`,e);continue}if(o=null,n(e)){let t=this._findOption(e);if(t){if(t.required){let e=s.shift();void 0===e&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,e)}else if(t.optional){let e=null;s.length>0&&!n(s[0])&&(e=s.shift()),this.emit(`option:${t.name()}`,e)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(e.length>2&&"-"===e[0]&&"-"!==e[1]){let t=this._findOption(`-${e[1]}`);if(t){t.required||t.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${t.name()}`,e.slice(2)):(this.emit(`option:${t.name()}`),s.unshift(`-${e.slice(2)}`));continue}}if(/^--[^=]+=/.test(e)){let t=e.indexOf("="),r=this._findOption(e.slice(0,t));if(r&&(r.required||r.optional)){this.emit(`option:${r.name()}`,e.slice(t+1));continue}}if(n(e)&&(i=r),(this._enablePositionalOptions||this._passThroughOptions)&&0===t.length&&0===r.length){if(this._findCommand(e)){t.push(e),s.length>0&&r.push(...s);break}if(e===this._helpCommandName&&this._hasImplicitHelpCommand()){t.push(e),s.length>0&&t.push(...s);break}if(this._defaultCommandName){r.push(e),s.length>0&&r.push(...s);break}}if(this._passThroughOptions){i.push(e),s.length>0&&i.push(...s);break}i.push(e)}return{operands:t,unknown:r}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let r=0;r<t;r++){let t=this.options[r].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return v(this).reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
|
|
8
8
|
`,this._outputConfiguration.writeErr),"string"==typeof this._showHelpAfterError?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
9
|
-
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr("\n"),this.outputHelp({error:!0}));let r=t||{},i=r.exitCode||1,
|
|
10
|
-
`),this._exit(0,"commander.version",e)}),this}description(e,t){return void 0===e&&void 0===t?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return void 0===e?this._summary:(this._summary=e,this)}alias(e){if(void 0===e)return this._aliases[0];let t=this;if(0!==this.commands.length&&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");return t._aliases.push(e),this}aliases(e){return void 0===e?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(void 0===e){if(this._usage)return this._usage;let e=this._args.map(e=>p(e));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?e:[]).join(" ")}return this._usage=e,this}name(e){return void 0===e?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=
|
|
9
|
+
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr("\n"),this.outputHelp({error:!0}));let r=t||{},i=r.exitCode||1,s=r.code||"commander.error";this._exit(i,s,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in a.env){let t=e.attributeName();(void 0===this.getOptionValue(t)||["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 d(this.options),t=e=>void 0!==this.getOptionValue(e)&&!["default","implied"].includes(this.getOptionValueSource(e));this.options.filter(r=>void 0!==r.implied&&t(r.attributeName())&&e.valueFromOption(this.getOptionValue(r.attributeName()),r)).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 r=e=>{let t=e.attributeName(),r=this.getOptionValue(t),i=this.options.find(e=>e.negate&&t===e.attributeName()),s=this.options.find(e=>!e.negate&&t===e.attributeName());return i&&(void 0===i.presetArg&&!1===r||void 0!==i.presetArg&&r===i.presetArg)?i:s||e},i=e=>{let t=r(e),i=t.attributeName();return"env"===this.getOptionValueSource(i)?`environment variable '${t.envVar}'`:`option '${t.flags}'`},s=`error: ${i(e)} cannot be used with ${i(t)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let r=[],i=this;do{let e=i.createHelp().visibleOptions(i).filter(e=>e.long).map(e=>e.long);r=r.concat(e),i=i.parent}while(i&&!i._enablePositionalOptions);t=_(e,r)}let r=`error: unknown option '${e}'${t}`;this.error(r,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this._args.length,r=this.parent?` for '${this.name()}'`:"",i=`error: too many arguments${r}. Expected ${t} argument${1===t?"":"s"} but got ${e.length}.`;this.error(i,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let r=[];this.createHelp().visibleCommands(this).forEach(e=>{r.push(e.name()),e.alias()&&r.push(e.alias())}),t=_(e,r)}let r=`error: unknown command '${e}'${t}`;this.error(r,{code:"commander.unknownCommand"})}version(e,t,r){if(void 0===e)return this._version;this._version=e,t=t||"-V, --version",r=r||"output the version number";let i=this.createOption(t,r);return this._versionOptionName=i.attributeName(),this.options.push(i),this.on("option:"+i.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
10
|
+
`),this._exit(0,"commander.version",e)}),this}description(e,t){return void 0===e&&void 0===t?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return void 0===e?this._summary:(this._summary=e,this)}alias(e){if(void 0===e)return this._aliases[0];let t=this;if(0!==this.commands.length&&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");return t._aliases.push(e),this}aliases(e){return void 0===e?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(void 0===e){if(this._usage)return this._usage;let e=this._args.map(e=>p(e));return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this._args.length?e:[]).join(" ")}return this._usage=e,this}name(e){return void 0===e?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=n.basename(e,n.extname(e)),this}executableDir(e){return void 0===e?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return void 0===t.helpWidth&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){let t;let r={error:!!(e=e||{}).error};return t=r.error?e=>this._outputConfiguration.writeErr(e):e=>this._outputConfiguration.writeOut(e),r.write=e.write||t,r.command=this,r}outputHelp(e){let t;"function"==typeof e&&(t=e,e=void 0);let r=this._getHelpContext(e);v(this).reverse().forEach(e=>e.emit("beforeAllHelp",r)),this.emit("beforeHelp",r);let i=this.helpInformation(r);if(t&&"string"!=typeof(i=t(i))&&!Buffer.isBuffer(i))throw Error("outputHelp callback must return a string or a Buffer");r.write(i),this.emit(this._helpLongFlag),this.emit("afterHelp",r),v(this).forEach(e=>e.emit("afterAllHelp",r))}helpOption(e,t){if("boolean"==typeof e)return this._hasHelpOption=e,this;this._helpFlags=e||this._helpFlags,this._helpDescription=t||this._helpDescription;let r=m(this._helpFlags);return this._helpShortFlag=r.shortFlag,this._helpLongFlag=r.longFlag,this}help(e){this.outputHelp(e);let t=a.exitCode||0;0===t&&e&&"function"!=typeof e&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let r=["beforeAll","before","after","afterAll"];if(!r.includes(e))throw Error(`Unexpected value for position to addHelpText.
|
|
11
11
|
Expecting one of '${r.join("', '")}'`);let i=`${e}Help`;return this.on(i,e=>{let r;(r="function"==typeof t?t({error:e.error,command:e.command}):t)&&e.write(`${r}
|
|
12
|
-
`)}),this}}function f(e,t){e._hasHelpOption&&t.find(t=>t===e._helpLongFlag||t===e._helpShortFlag)&&(e.outputHelp(),e._exit(0,"commander.helpDisplayed","(outputHelp)"))}function b(e){return e.map(e=>{let t,r;if(!e.startsWith("--inspect"))return e;let i="127.0.0.1",
|
|
13
|
-
|.{1,${
|
|
12
|
+
`)}),this}}function f(e,t){e._hasHelpOption&&t.find(t=>t===e._helpLongFlag||t===e._helpShortFlag)&&(e.outputHelp(),e._exit(0,"commander.helpDisplayed","(outputHelp)"))}function b(e){return e.map(e=>{let t,r;if(!e.startsWith("--inspect"))return e;let i="127.0.0.1",s="9229";return(null!==(r=e.match(/^(--inspect(-brk)?)$/))?t=r[1]:null!==(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))?(t=r[1],/^\d+$/.test(r[3])?s=r[3]:i=r[3]):null!==(r=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))&&(t=r[1],i=r[3],s=r[4]),t&&"0"!==s)?`${t}=${i}:${parseInt(s)+1}`:e})}function v(e){let t=[];for(let r=e;r;r=r.parent)t.push(r);return t}t.Command=g},"../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/error.js":function(e,t){class r extends Error{constructor(e,t,r){super(r),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}}t.CommanderError=r,t.InvalidArgumentError=class extends r{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}},"../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/help.js":function(e,t,r){let{humanReadableArgName:i}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/argument.js");t.Help=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden);if(e._hasImplicitHelpCommand()){let[,r,i]=e._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),s=e.createCommand(r).helpOption(!1);s.description(e._helpCommandDescription),i&&s.arguments(i),t.push(s)}return this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let r=e=>e.short?e.short.replace(/^-/,""):e.long.replace(/^--/,"");return r(e).localeCompare(r(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),r=e._hasHelpOption&&e._helpShortFlag&&!e._findOption(e._helpShortFlag),i=e._hasHelpOption&&!e._findOption(e._helpLongFlag);if(r||i){let s;s=r?i?e.createOption(e._helpFlags,e._helpDescription):e.createOption(e._helpShortFlag,e._helpDescription):e.createOption(e._helpLongFlag,e._helpDescription),t.push(s)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let r=e.parent;r;r=r.parent){let e=r.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return(e._argsDescription&&e._args.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e._args.find(e=>e.description))?e._args:[]}subcommandTerm(e){let t=e._args.map(e=>i(e)).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((e,r)=>Math.max(e,t.subcommandTerm(r).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,r)=>Math.max(e,t.optionTerm(r).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,r)=>Math.max(e,t.optionTerm(r).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,r)=>Math.max(e,t.argumentTerm(r).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let r="";for(let t=e.parent;t;t=t.parent)r=t.name()+" "+r;return r+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(e=>JSON.stringify(e)).join(", ")}`),void 0!==e.defaultValue&&(e.required||e.optional||e.isBoolean()&&"boolean"==typeof e.defaultValue)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),void 0!==e.presetArg&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),void 0!==e.envVar&&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(e=>JSON.stringify(e)).join(", ")}`),void 0!==e.defaultValue&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let r=`(${t.join(", ")})`;return e.description?`${e.description} ${r}`:r}return e.description}formatHelp(e,t){let r=t.padWidth(e,t),i=t.helpWidth||80;function s(e,s){if(s){let n=`${e.padEnd(r+2)}${s}`;return t.wrap(n,i-2,r+2)}return e}function n(e){return e.join("\n").replace(/^/gm," ".repeat(2))}let o=[`Usage: ${t.commandUsage(e)}`,""],a=t.commandDescription(e);a.length>0&&(o=o.concat([t.wrap(a,i,0),""]));let l=t.visibleArguments(e).map(e=>s(t.argumentTerm(e),t.argumentDescription(e)));l.length>0&&(o=o.concat(["Arguments:",n(l),""]));let p=t.visibleOptions(e).map(e=>s(t.optionTerm(e),t.optionDescription(e)));if(p.length>0&&(o=o.concat(["Options:",n(p),""])),this.showGlobalOptions){let r=t.visibleGlobalOptions(e).map(e=>s(t.optionTerm(e),t.optionDescription(e)));r.length>0&&(o=o.concat(["Global Options:",n(r),""]))}let c=t.visibleCommands(e).map(e=>s(t.subcommandTerm(e),t.subcommandDescription(e)));return c.length>0&&(o=o.concat(["Commands:",n(c),""])),o.join("\n")}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,r,i=40){let s=RegExp(`[\\n][ \\f\\t\\v\u00a0\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]+`);if(e.match(s))return e;let n=t-r;if(n<i)return e;let o=e.slice(0,r),a=e.slice(r).replace("\r\n","\n"),l=" ".repeat(r),p=`\\s\u200B`,c=RegExp(`
|
|
13
|
+
|.{1,${n-1}}([${p}]|$)|[^${p}]+?([${p}]|$)`,"g");return o+(a.match(c)||[]).map((e,t)=>"\n"===e?"":(t>0?l:"")+e.trimEnd()).join("\n")}}},"../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/option.js":function(e,t,r){let{InvalidArgumentError:i}=r("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/error.js");function s(e){let t,r;let i=e.split(/[ |,]+/);return i.length>1&&!/^[[<]/.test(i[1])&&(t=i.shift()),r=i.shift(),!t&&/^-[^-]$/.test(r)&&(t=r,r=void 0),{shortFlag:t,longFlag:r}}t.Option=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 r=s(e);this.short=r.shortFlag,this.long=r.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"string"==typeof e&&(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)?t.concat(e):[e]}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,t)=>{if(!this.argChoices.includes(e))throw new i(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(e,t):e},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.name().replace(/^no-/,"").split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},t.splitOptionFlags=s,t.DualOptions=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let r=t.attributeName();if(!this.dualOptions.has(r))return!0;let i=this.negativeOptions.get(r).presetArg;return t.negate===((void 0!==i&&i)===e)}}},"../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/lib/suggestSimilar.js":function(e,t){t.suggestSimilar=function(e,t){if(!t||0===t.length)return"";t=Array.from(new Set(t));let r=e.startsWith("--");r&&(e=e.slice(2),t=t.map(e=>e.slice(2)));let i=[],s=3;return(t.forEach(t=>{if(t.length<=1)return;let r=function(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let r=[];for(let t=0;t<=e.length;t++)r[t]=[t];for(let e=0;e<=t.length;e++)r[0][e]=e;for(let i=1;i<=t.length;i++)for(let s=1;s<=e.length;s++){let n=1;n=+(e[s-1]!==t[i-1]),r[s][i]=Math.min(r[s-1][i]+1,r[s][i-1]+1,r[s-1][i-1]+n),s>1&&i>1&&e[s-1]===t[i-2]&&e[s-2]===t[i-1]&&(r[s][i]=Math.min(r[s][i],r[s-2][i-2]+1))}return r[e.length][t.length]}(e,t),n=Math.max(e.length,t.length);(n-r)/n>.4&&(r<s?(s=r,i=[t]):r===s&&i.push(t))}),i.sort((e,t)=>e.localeCompare(t)),r&&(i=i.map(e=>`--${e}`)),i.length>1)?`
|
|
14
14
|
(Did you mean one of ${i.join(", ")}?)`:1===i.length?`
|
|
15
|
-
(Did you mean ${i[0]}?)`:""}},"../../node_modules/.pnpm/typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.8.2/node_modules/typia/lib/TypeGuardError.mjs":function(e,t,r){"use strict";r.r(t),r.d(t,{TypeGuardError:()=>i});class i extends Error{method;path;expected;value;fake_expected_typed_value_;constructor(e){super(e.message||`Error on ${e.method}(): invalid type${e.path?` on ${e.path}`:""}, expect to be ${e.expected}`);let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.method=e.method,this.path=e.path,this.expected=e.expected,this.value=e.value}}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](r,r.exports,__webpack_require__),r.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};(()=>{"use strict";let{program:e,createCommand:t,createArgument:r,createOption:i,CommanderError:
|
|
15
|
+
(Did you mean ${i[0]}?)`:""}},"../../node_modules/.pnpm/typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.8.2/node_modules/typia/lib/TypeGuardError.mjs":function(e,t,r){"use strict";r.r(t),r.d(t,{TypeGuardError:()=>i});class i extends Error{method;path;expected;value;fake_expected_typed_value_;constructor(e){super(e.message||`Error on ${e.method}(): invalid type${e.path?` on ${e.path}`:""}, expect to be ${e.expected}`);let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.method=e.method,this.path=e.path,this.expected=e.expected,this.value=e.value}}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](r,r.exports,__webpack_require__),r.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};(()=>{"use strict";let{program:e,createCommand:t,createArgument:r,createOption:i,CommanderError:s,InvalidArgumentError:n,InvalidOptionArgumentError:o,Command:a,Argument:l,Option:p,Help:c}=__webpack_require__("../../node_modules/.pnpm/commander@10.0.1/node_modules/commander/index.js");var h,u,m,d,_=__webpack_require__("../../node_modules/.pnpm/typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.8.2/node_modules/typia/lib/internal/_assertGuard.js");let g=require("fs/promises");var f=__webpack_require__.n(g);let b=require("inquirer");var v=__webpack_require__.n(b),y=__webpack_require__("path"),O=__webpack_require__.n(y),w=__webpack_require__("child_process");!function(e){e.create=async e=>{let t={name:e.projectName,version:"0.0.1",description:"",scripts:{prepare:"ts-patch install",build:"tsc",dev:"ts-node src/index.ts",start:"node dist/index.js"}};await f().writeFile(O().join(e.projectPath,"package.json"),JSON.stringify(t,null,2)),console.log("✅ package.json created")},e.installPackage=e=>t=>{let r=t=>{switch(e){case"npm":return`npm install ${t}`;case"yarn":return`yarn add ${t}`;case"pnpm":return`pnpm add ${t}`;case"bun":return`bun add ${t}`;default:throw Error(`Unsupported package manager: ${e}`)}},i=t.services.map(e=>`@wrtnlabs/connector-${e}`);console.log("\uD83D\uDE80 Installing existing dependencies..."),(0,w.execSync)(`${e} install`,{cwd:t.projectPath,stdio:"inherit"}),i.forEach(e=>{console.log(`🚀 Installing ${e}...`),(0,w.execSync)(r(e),{cwd:t.projectPath,stdio:"inherit"})})}}(h||(h={}));let A=require("giget"),C=require("node:path");var x=__webpack_require__.n(C);let j=e=>e.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join("");!function(e){e.createAll=t=>{let r=e.create("import")({services:t.services}),i=e.create("connector")({services:t.services});return`
|
|
16
16
|
import { Agentica } from "@agentica/core";
|
|
17
17
|
import typia from "typia";
|
|
18
18
|
import dotenv from "dotenv";
|
|
@@ -38,117 +38,8 @@ export const agent = new Agentica({
|
|
|
38
38
|
protocol: "class",
|
|
39
39
|
application: typia.llm.application<${t}Service, "chatgpt">(),
|
|
40
40
|
execute: new ${t}Service(),
|
|
41
|
-
}`}).join(",\n"),r=e=>e.services.map(e=>`import { ${j(e)}Service } from "@wrtnlabs/connector-${e}";`).join("\n")}(u||(u={})),function(e){e.
|
|
42
|
-
|
|
43
|
-
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
44
|
-
/* Projects */
|
|
45
|
-
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
46
|
-
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
47
|
-
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
48
|
-
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
49
|
-
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
50
|
-
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
51
|
-
/* Language and Environment */
|
|
52
|
-
"target": "es2015" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
53
|
-
"lib": [
|
|
54
|
-
"ES2021"
|
|
55
|
-
] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
|
|
56
|
-
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
57
|
-
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
|
58
|
-
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
59
|
-
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
60
|
-
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
61
|
-
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
62
|
-
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
63
|
-
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
64
|
-
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
65
|
-
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
66
|
-
/* Modules */
|
|
67
|
-
"module": "commonjs" /* Specify what module code is generated. */,
|
|
68
|
-
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
69
|
-
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
70
|
-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
71
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
72
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
73
|
-
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
74
|
-
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
75
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
76
|
-
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
77
|
-
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
78
|
-
// "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */
|
|
79
|
-
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
80
|
-
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
81
|
-
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
82
|
-
// "noUncheckedSideEffectImports": true, /* Check side effect imports. */
|
|
83
|
-
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
84
|
-
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
85
|
-
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
86
|
-
/* JavaScript Support */
|
|
87
|
-
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
88
|
-
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
89
|
-
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
90
|
-
/* Emit */
|
|
91
|
-
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
92
|
-
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
93
|
-
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
94
|
-
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
95
|
-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
96
|
-
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
97
|
-
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
98
|
-
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
|
|
99
|
-
// "removeComments": true, /* Disable emitting comments. */
|
|
100
|
-
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
101
|
-
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
102
|
-
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
103
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
104
|
-
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
105
|
-
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
106
|
-
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
107
|
-
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
108
|
-
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
109
|
-
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
110
|
-
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
111
|
-
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
112
|
-
/* Interop Constraints */
|
|
113
|
-
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
114
|
-
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
115
|
-
// "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
|
|
116
|
-
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
117
|
-
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
118
|
-
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
119
|
-
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
120
|
-
/* Type Checking */
|
|
121
|
-
"strict": true /* Enable all strict type-checking options. */,
|
|
122
|
-
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
123
|
-
"strictNullChecks": true /* When type checking, take into account 'null' and 'undefined'. */,
|
|
124
|
-
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
125
|
-
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
126
|
-
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
127
|
-
// "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */
|
|
128
|
-
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
129
|
-
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
130
|
-
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
131
|
-
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
132
|
-
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
133
|
-
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
134
|
-
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
135
|
-
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
136
|
-
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
137
|
-
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
138
|
-
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
139
|
-
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
140
|
-
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
141
|
-
/* Completeness */
|
|
142
|
-
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
143
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
|
|
144
|
-
"plugins": [
|
|
145
|
-
{
|
|
146
|
-
"transform": "typia/lib/transform"
|
|
147
|
-
}
|
|
148
|
-
]
|
|
149
|
-
}
|
|
150
|
-
}`}(d||(d={}));var S=__webpack_require__("fs"),E=__webpack_require__.n(S);let $=e=>{if(E().existsSync(e.projectPath))throw Error(`${O().basename(e.projectPath)} directory already exists.`);E().mkdirSync(e.projectPath)},P=require("node:util");function T(e){return(0,P.styleText)("blueBright",e)}function H(e){return(0,P.styleText)("redBright",e)}!function(e){e.execute=t=>{let r=e.PROJECT[t].runner;if(!r)throw Error(`Not supported project type: ${t}`);return r},e.PROJECT={standalone:{title:`Standalone ${T("Application")}`,key:"standalone",runner:async e=>{$({projectPath:e.projectPath}),await Promise.all([h.create({projectName:e.projectName,projectPath:e.projectPath}),d.create({projectPath:e.projectPath})]),await b().mkdir(A().join(e.projectPath,"src"),{recursive:!1});let t=u.createAll({services:e.services});await r({filePath:A().join(e.projectPath,"src/index.ts"),taskName:"Agentica code",content:t}),await i(e)}},nodejs:{title:`NodeJS ${T("Agent Server")}`,key:"nodejs",runner:async e=>t("nodejs")(e)(async()=>{let t=A().join(e.projectPath,"src/index.ts"),r=await b().readFile(t,"utf-8").then(t=>0!==e.services.length?t.replace(/import { BbsArticleService }.*;\n/g,"").replace(/controllers:\s*\[[\s\S]*?\],\n/,"controllers: [/// INSERT CONTROLLER HERE],\n"):t);return{indexFilePath:t,indexFileContent:r}})},nestjs:{title:`NestJS ${T("Agent Server")}`,key:"nestjs",runner:async e=>t("nestjs")(e)(async()=>{let t=A().join(e.projectPath,"src/controllers/chat/ChatController.ts"),r=await b().readFile(t,"utf-8");return{indexFilePath:t,indexFileContent:r}})},react:{title:`React ${T("Client Application")} (Currently not supported)`,key:"react",runner:void 0}};let t=t=>n=>async o=>{await e.writeTemplate(t,n.projectName);let s=u.create("import")({services:n.services}),a=u.create("connector")({services:n.services}),{indexFilePath:l,indexFileContent:p}=await o(),c=p.replace("/// INSERT IMPORT HERE",s).replace("/// INSERT CONTROLLER HERE",a);await r({filePath:l,taskName:"Agentica code",content:c}),await i(n)},r=async e=>{let t=await Promise.resolve().then(__webpack_require__.bind(__webpack_require__,"prettier")).then(t=>t.format(e.content,{parser:"typescript"})).catch(()=>e.content);await b().writeFile(e.filePath,t),console.log(`✅ ${e.taskName} created`)},i=async e=>{let t=`OPENAI_API_KEY=${e.openAIKey}
|
|
151
|
-
`;await b().writeFile(A().join(e.projectPath,".env"),t),console.log("✅ .env created")};e.writeTemplate=async(e,t)=>{await (0,k.downloadTemplate)(`github:wrtnlabs/agentica.template.${e}`,{dir:t}),console.log("✅ Template downloaded");let r=A().join(t,".github/dependabot.yml");await b().access(r).then(()=>!0).catch(()=>!1)&&await b().rm(r)}}(m||(m={}));var F=__webpack_require__("../../node_modules/.pnpm/typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.8.2/node_modules/typia/lib/internal/_isFormatDateTime.js");let D=async()=>{try{let e=await fetch("https://registry.npmjs.org/-/v1/search?text=scope:@wrtnlabs&size=10000"),t=await e.json();return(()=>{let e;let t=e=>Array.isArray(e.objects)&&e.objects.every(e=>"object"==typeof e&&null!==e&&r(e))&&"number"==typeof e.total&&"string"==typeof e.time&&F._isFormatDateTime(e.time),r=e=>"object"==typeof e.package&&null!==e.package&&i(e.package),i=e=>"string"==typeof e.name,n=(t,r,i=!0)=>((Array.isArray(t.objects)||_._assertGuard(i,{method:"typia.assert",path:r+".objects",expected:"Array<__type>",value:t.objects},e))&&t.objects.every((t,n)=>("object"==typeof t&&null!==t||_._assertGuard(i,{method:"typia.assert",path:r+".objects["+n+"]",expected:"__type",value:t},e))&&o(t,r+".objects["+n+"]",i)||_._assertGuard(i,{method:"typia.assert",path:r+".objects["+n+"]",expected:"__type",value:t},e))||_._assertGuard(i,{method:"typia.assert",path:r+".objects",expected:"Array<__type>",value:t.objects},e))&&("number"==typeof t.total||_._assertGuard(i,{method:"typia.assert",path:r+".total",expected:"number",value:t.total},e))&&("string"==typeof t.time&&(F._isFormatDateTime(t.time)||_._assertGuard(i,{method:"typia.assert",path:r+".time",expected:'string & Format<"date-time">',value:t.time},e))||_._assertGuard(i,{method:"typia.assert",path:r+".time",expected:'(string & Format<"date-time">)',value:t.time},e)),o=(t,r,i=!0)=>("object"==typeof t.package&&null!==t.package||_._assertGuard(i,{method:"typia.assert",path:r+'["package"]',expected:"__type.o1",value:t.package},e))&&s(t.package,r+'["package"]',i)||_._assertGuard(i,{method:"typia.assert",path:r+'["package"]',expected:"__type.o1",value:t.package},e),s=(t,r,i=!0)=>"string"==typeof t.name||_._assertGuard(i,{method:"typia.assert",path:r+".name",expected:"string",value:t.name},e),a=e=>"object"==typeof e&&null!==e&&t(e);return(t,r)=>(!1===a(t)&&(e=r,((t,r,i=!0)=>("object"==typeof t&&null!==t||_._assertGuard(!0,{method:"typia.assert",path:r+"",expected:"INpmPackages",value:t},e))&&n(t,r+"",!0)||_._assertGuard(!0,{method:"typia.assert",path:r+"",expected:"INpmPackages",value:t},e))(t,"$input",!0)),t)})()(t).objects.map(e=>e.package.name).filter(e=>"@wrtnlabs/connector-shared"!==e&&/^@wrtnlabs\/connector-(?:[a-z0-9-]+)+$/.test(e)).map(e=>{let t=e.replace("@wrtnlabs/connector-","");return{name:t.replace("-"," ").toUpperCase(),value:t}})}catch(e){return console.error("Error occurred while fetching package list:",e),[]}},V=e=>[{type:"list",name:"packageManager",message:"Package Manager",choices:["npm","pnpm",{name:`yarn (berry ${T("is not supported")})`,value:"yarn"},"bun"]},e.options.project?null:{type:"list",name:"projectType",message:"Project Type",choices:Object.values(m.PROJECT).map(e=>({name:e.title,value:e.key}))},{type:"checkbox",name:"services",message:"Embedded Controllers",choices:e.services},{type:"input",name:"openAIKey",message:"Please enter your OPENAI_API_KEY:"}].filter(e=>null!==e);!function(e){async function t({projectName:e,options:t}){var r;let i=O().join(process.cwd(),e);if(await b().access(O().join(process.cwd(),e)).then(()=>!0).catch(()=>!1)){console.error(`❌ Project ${H(e)} already exists`);return}let n=V({services:(await D()).sort((e,t)=>e.name.localeCompare(t.name)),options:t}),o={...await v().prompt(n),...t.project?{projectType:t.project}:{}},{packageManager:s,openAIKey:a,projectType:l,services:p}=(()=>{let e;let t=e=>("nodejs"===e.projectType||"nestjs"===e.projectType||"react"===e.projectType||"standalone"===e.projectType)&&Array.isArray(e.services)&&e.services.every(e=>"string"==typeof e)&&("npm"===e.packageManager||"yarn"===e.packageManager||"pnpm"===e.packageManager||"bun"===e.packageManager)&&"string"==typeof e.openAIKey,r=(t,r,i=!0)=>("nodejs"===t.projectType||"nestjs"===t.projectType||"react"===t.projectType||"standalone"===t.projectType||_._assertGuard(i,{method:"typia.assert",path:r+".projectType",expected:'("nestjs" | "nodejs" | "react" | "standalone")',value:t.projectType},e))&&((Array.isArray(t.services)||_._assertGuard(i,{method:"typia.assert",path:r+".services",expected:"Array<string>",value:t.services},e))&&t.services.every((t,n)=>"string"==typeof t||_._assertGuard(i,{method:"typia.assert",path:r+".services["+n+"]",expected:"string",value:t},e))||_._assertGuard(i,{method:"typia.assert",path:r+".services",expected:"Array<string>",value:t.services},e))&&("npm"===t.packageManager||"yarn"===t.packageManager||"pnpm"===t.packageManager||"bun"===t.packageManager||_._assertGuard(i,{method:"typia.assert",path:r+".packageManager",expected:'("bun" | "npm" | "pnpm" | "yarn")',value:t.packageManager},e))&&("string"==typeof t.openAIKey||_._assertGuard(i,{method:"typia.assert",path:r+".openAIKey",expected:"string",value:t.openAIKey},e)),i=e=>"object"==typeof e&&null!==e&&t(e);return(t,n)=>(!1===i(t)&&(e=n,((t,i,n=!0)=>("object"==typeof t&&null!==t||_._assertGuard(!0,{method:"typia.assert",path:i+"",expected:"__object",value:t},e))&&r(t,i+"",!0)||_._assertGuard(!0,{method:"typia.assert",path:i+"",expected:"__object",value:t},e))(t,"$input",!0)),t)})()(o);await m.execute(l)({projectName:e,projectPath:i,openAIKey:a,services:p}),console.log("\uD83D\uDCE6 Package installation in progress..."),h.installPackage(s)({projectPath:i,services:p}),console.log(`
|
|
41
|
+
}`}).join(",\n"),r=e=>e.services.map(e=>`import { ${j(e)}Service } from "@wrtnlabs/connector-${e}";`).join("\n")}(u||(u={}));let k=require("node:util");function $(e){return(0,k.styleText)("blueBright",e)}function E(e){return(0,k.styleText)("redBright",e)}!function(e){e.execute=t=>{let r=e.PROJECT[t].runner;if(!r)throw Error(`Not supported project type: ${t}`);return r},e.PROJECT={standalone:{title:`Standalone ${$("Application")}`,key:"standalone",runner:async e=>t("standalone")(e)(async()=>{let t=x().join(e.projectPath,"src/index.ts"),r=await f().readFile(t,"utf-8");return{indexFilePath:t,indexFileContent:r}})},nodejs:{title:`NodeJS ${$("Agent Server")}`,key:"nodejs",runner:async e=>t("nodejs")(e)(async()=>{let t=x().join(e.projectPath,"src/index.ts"),r=await f().readFile(t,"utf-8").then(t=>0!==e.services.length?t.replace(/import { BbsArticleService }.*;\n/g,"").replace(/controllers:\s*\[[\s\S]*?\],\n/,"controllers: [/// INSERT CONTROLLER HERE],\n"):t);return{indexFilePath:t,indexFileContent:r}})},nestjs:{title:`NestJS ${$("Agent Server")}`,key:"nestjs",runner:async e=>t("nestjs")(e)(async()=>{let t=x().join(e.projectPath,"src/controllers/chat/ChatController.ts"),r=await f().readFile(t,"utf-8");return{indexFilePath:t,indexFileContent:r}})},react:{title:`React ${$("Client Application")}`,key:"react",runner:async t=>{await e.writeTemplate("react",t.projectName)}}};let t=t=>s=>async n=>{await e.writeTemplate(t,s.projectName);let o=u.create("import")({services:s.services}),a=u.create("connector")({services:s.services}),{indexFilePath:l,indexFileContent:p}=await n(),c=p.replace("/// INSERT IMPORT HERE",o).replace("/// INSERT CONTROLLER HERE",a);await r({filePath:l,taskName:"Agentica code",content:c}),await i(s)},r=async e=>{let t=await Promise.resolve().then(__webpack_require__.bind(__webpack_require__,"prettier")).then(t=>t.format(e.content,{parser:"typescript"})).catch(()=>e.content);await f().writeFile(e.filePath,t),console.log(`✅ ${e.taskName} created`)},i=async e=>{let t=`OPENAI_API_KEY=${e.openAIKey}
|
|
42
|
+
`;await f().writeFile(x().join(e.projectPath,".env"),t),console.log("✅ .env created")};e.writeTemplate=async(e,t)=>{await (0,A.downloadTemplate)(`github:wrtnlabs/agentica.template.${e}`,{dir:t}),console.log("✅ Template downloaded");let r=x().join(t,".github/dependabot.yml");await f().access(r).then(()=>!0).catch(()=>!1)&&await f().rm(r)}}(m||(m={}));var S=__webpack_require__("../../node_modules/.pnpm/typia@8.0.3_@samchon+openapi@3.1.0_typescript@5.8.2/node_modules/typia/lib/internal/_isFormatDateTime.js");let H=async()=>{try{let e=await fetch("https://registry.npmjs.org/-/v1/search?text=scope:@wrtnlabs&size=10000"),t=await e.json();return(()=>{let e;let t=e=>Array.isArray(e.objects)&&e.objects.every(e=>"object"==typeof e&&null!==e&&r(e))&&"number"==typeof e.total&&"string"==typeof e.time&&S._isFormatDateTime(e.time),r=e=>"object"==typeof e.package&&null!==e.package&&i(e.package),i=e=>"string"==typeof e.name,s=(t,r,i=!0)=>((Array.isArray(t.objects)||_._assertGuard(i,{method:"typia.assert",path:r+".objects",expected:"Array<__type>",value:t.objects},e))&&t.objects.every((t,s)=>("object"==typeof t&&null!==t||_._assertGuard(i,{method:"typia.assert",path:r+".objects["+s+"]",expected:"__type",value:t},e))&&n(t,r+".objects["+s+"]",i)||_._assertGuard(i,{method:"typia.assert",path:r+".objects["+s+"]",expected:"__type",value:t},e))||_._assertGuard(i,{method:"typia.assert",path:r+".objects",expected:"Array<__type>",value:t.objects},e))&&("number"==typeof t.total||_._assertGuard(i,{method:"typia.assert",path:r+".total",expected:"number",value:t.total},e))&&("string"==typeof t.time&&(S._isFormatDateTime(t.time)||_._assertGuard(i,{method:"typia.assert",path:r+".time",expected:'string & Format<"date-time">',value:t.time},e))||_._assertGuard(i,{method:"typia.assert",path:r+".time",expected:'(string & Format<"date-time">)',value:t.time},e)),n=(t,r,i=!0)=>("object"==typeof t.package&&null!==t.package||_._assertGuard(i,{method:"typia.assert",path:r+'["package"]',expected:"__type.o1",value:t.package},e))&&o(t.package,r+'["package"]',i)||_._assertGuard(i,{method:"typia.assert",path:r+'["package"]',expected:"__type.o1",value:t.package},e),o=(t,r,i=!0)=>"string"==typeof t.name||_._assertGuard(i,{method:"typia.assert",path:r+".name",expected:"string",value:t.name},e),a=e=>"object"==typeof e&&null!==e&&t(e);return(t,r)=>(!1===a(t)&&(e=r,((t,r,i=!0)=>("object"==typeof t&&null!==t||_._assertGuard(!0,{method:"typia.assert",path:r+"",expected:"INpmPackages",value:t},e))&&s(t,r+"",!0)||_._assertGuard(!0,{method:"typia.assert",path:r+"",expected:"INpmPackages",value:t},e))(t,"$input",!0)),t)})()(t).objects.map(e=>e.package.name).filter(e=>"@wrtnlabs/connector-shared"!==e&&/^@wrtnlabs\/connector-(?:[a-z0-9-]+)+$/.test(e)).map(e=>{let t=e.replace("@wrtnlabs/connector-","");return{name:t.replace("-"," ").toUpperCase(),value:t}})}catch(e){return console.error("Error occurred while fetching package list:",e),[]}},T=e=>[{type:"list",name:"packageManager",message:"Package Manager",choices:["npm","pnpm",{name:`yarn (berry ${$("is not supported")})`,value:"yarn"},"bun"]},e.options.project?null:{type:"list",name:"projectType",message:"Project Type",choices:Object.values(m.PROJECT).map(e=>({name:e.title,value:e.key}))},0===e.services.length?null:{type:"checkbox",name:"services",message:"Embedded Controllers",choices:e.services,when:e=>"react"!==e.projectType},{type:"input",name:"openAIKey",message:"Please enter your OPENAI_API_KEY:"}].filter(e=>null!==e);!function(e){async function t({projectName:e,options:t}){var r;let i=O().join(process.cwd(),e);if(await f().access(O().join(process.cwd(),e)).then(()=>!0).catch(()=>!1)){console.error(`❌ Project ${E(e)} already exists`);return}let s=T({services:"react"===t.project?[]:(await H()).sort((e,t)=>e.name.localeCompare(t.name)),options:t}),n=await v().prompt(s),o={...n,...t.project?{projectType:t.project}:{},...n.services?{services:n.services}:{services:[]}},{packageManager:a,openAIKey:l,projectType:p,services:c}=(()=>{let e;let t=e=>Array.isArray(e.services)&&e.services.every(e=>"string"==typeof e)&&("nodejs"===e.projectType||"nestjs"===e.projectType||"react"===e.projectType||"standalone"===e.projectType)&&("npm"===e.packageManager||"yarn"===e.packageManager||"pnpm"===e.packageManager||"bun"===e.packageManager)&&"string"==typeof e.openAIKey,r=(t,r,i=!0)=>((Array.isArray(t.services)||_._assertGuard(i,{method:"typia.assert",path:r+".services",expected:"Array<string>",value:t.services},e))&&t.services.every((t,s)=>"string"==typeof t||_._assertGuard(i,{method:"typia.assert",path:r+".services["+s+"]",expected:"string",value:t},e))||_._assertGuard(i,{method:"typia.assert",path:r+".services",expected:"Array<string>",value:t.services},e))&&("nodejs"===t.projectType||"nestjs"===t.projectType||"react"===t.projectType||"standalone"===t.projectType||_._assertGuard(i,{method:"typia.assert",path:r+".projectType",expected:'("nestjs" | "nodejs" | "react" | "standalone")',value:t.projectType},e))&&("npm"===t.packageManager||"yarn"===t.packageManager||"pnpm"===t.packageManager||"bun"===t.packageManager||_._assertGuard(i,{method:"typia.assert",path:r+".packageManager",expected:'("bun" | "npm" | "pnpm" | "yarn")',value:t.packageManager},e))&&("string"==typeof t.openAIKey||_._assertGuard(i,{method:"typia.assert",path:r+".openAIKey",expected:"string",value:t.openAIKey},e)),i=e=>"object"==typeof e&&null!==e&&t(e);return(t,s)=>(!1===i(t)&&(e=s,((t,i,s=!0)=>("object"==typeof t&&null!==t||_._assertGuard(!0,{method:"typia.assert",path:i+"",expected:"__object",value:t},e))&&r(t,i+"",!0)||_._assertGuard(!0,{method:"typia.assert",path:i+"",expected:"__object",value:t},e))(t,"$input",!0)),t)})()(o);await m.execute(p)({projectName:e,projectPath:i,openAIKey:l,services:c}),process.chdir(i),console.log("\uD83D\uDCE6 Package installation in progress..."),h.installPackage(a)({projectPath:i,services:c}),console.log(`
|
|
152
43
|
🎉 Project ${e} created`),console.log(`
|
|
153
|
-
⚠️ ${(r="Note:",(0,
|
|
154
|
-
❌ The value of ${
|
|
44
|
+
⚠️ ${(r="Note:",(0,k.styleText)("yellow",r))} Please implement constructor values for each controller generated in agent.ts or index.ts`)}e.execute=t}(d||(d={})),(async function(){let e=new a;e.command("start <directory>").description("Start a new project").option("-p, --project [nodejs|nestjs|react|standalone]","The project type").action(async(e,t)=>{if(!0===t.project){console.error(`
|
|
45
|
+
❌ The value of ${E("--project")} is required`);return}d.execute({projectName:e,options:t})}),console.log("--------------------------------"),console.log(` 🚀 Agentica ${$("Setup Wizard")}`),console.log("--------------------------------"),e.parse(process.argv)})().catch(e=>{console.error(e.message),process.exit(-1)})})();var __webpack_export_target__=exports;for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__]=__webpack_exports__[__webpack_i__];__webpack_exports__.__esModule&&Object.defineProperty(__webpack_export_target__,"__esModule",{value:!0});
|