startx 0.1.0 → 0.1.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "startx",
3
- "version": "0.1.0",
3
+ "version": "0.1.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/avinashid/startx.git"
@@ -21,25 +21,7 @@
21
21
  "test": "turbo test",
22
22
  "format": "turbo format"
23
23
  },
24
- "devDependencies": {
25
- "@biomejs/biome": "catalog:",
26
- "prettier": "catalog:",
27
- "rimraf": "catalog:",
28
- "turbo": "catalog:",
29
- "typescript": "catalog:",
30
- "tsdown": "catalog:",
31
- "unrun": "catalog:",
32
- "vitest": "catalog:",
33
- "tsx": "catalog:",
34
- "@types/node": "catalog:"
35
- },
36
- "dependencies": {
37
- "zod": "catalog:",
38
- "@vinejs/vine": "catalog:",
39
- "axios": "catalog:",
40
- "date-fns": "catalog:",
41
- "nanoid": "catalog:"
42
- },
24
+
43
25
  "engines": {
44
26
  "node": ">=22"
45
27
  },
@@ -44,29 +44,36 @@ const customPrintFormat = format.printf((info: Logform.TransformableInfo) => {
44
44
 
45
45
  interface LoggerInput {
46
46
  logName: string;
47
+ enableFileLogging?: boolean;
47
48
  }
48
49
 
49
- const createWLogger = ({ logName }: LoggerInput) => {
50
+ const createWLogger = ({ logName, enableFileLogging = true }: LoggerInput) => {
51
+ const baseTransports = [
52
+ new transports.Console({
53
+ format: format.combine(upperCaseLevel(), format.colorize({ all: true }), customPrintFormat),
54
+ }),
55
+ ];
56
+ const fileTransports = enableFileLogging
57
+ ? [
58
+ new transports.File({
59
+ level: "error",
60
+ filename: path.join(LOG_DIR, logName, `${logName}-Error.log`),
61
+ format: customPrintFormat,
62
+ }),
63
+ new transports.File({
64
+ filename: path.join(LOG_DIR, logName, `${logName}-Combined.log`),
65
+ format: customPrintFormat,
66
+ }),
67
+ ]
68
+ : [];
50
69
  return createLogger({
51
70
  level: ENV.LOG_LEVEL,
52
71
  format: format.combine(format.timestamp(), format.errors({ stack: true })),
53
- transports: [
54
- new transports.Console({
55
- format: format.combine(upperCaseLevel(), format.colorize({ all: true }), customPrintFormat),
56
- }),
57
- new transports.File({
58
- level: "error",
59
- filename: path.join(LOG_DIR, logName, `${logName}-Error.log`),
60
- format: customPrintFormat,
61
- }),
62
- new transports.File({
63
- filename: path.join(LOG_DIR, logName, `${logName}-Combined.log`),
64
- format: customPrintFormat,
65
- }),
66
- ],
72
+ transports: [...baseTransports, ...fileTransports],
67
73
  });
68
74
  };
69
75
 
70
76
  export const logger = createWLogger({
71
77
  logName: "globalLog",
78
+ enableFileLogging: false,
72
79
  });
@@ -52,7 +52,7 @@ Found: ${t.toString().split(`
52
52
  `),stack:e&&e.stack,exception:!0,date:new Date().toString(),process:this.getProcessInfo(),os:this.getOsInfo(),trace:this.getTrace(e)}}getProcessInfo(){return{pid:process.pid,uid:process.getuid?process.getuid():null,gid:process.getgid?process.getgid():null,cwd:process.cwd(),execPath:process.execPath,version:process.version,argv:process.argv,memoryUsage:process.memoryUsage()}}getOsInfo(){return{loadavg:n.loadavg(),uptime:n.uptime()}}getTrace(e){return(e?o.parse(e):o.get()).map(e=>({column:e.getColumnNumber(),file:e.getFileName(),function:e.getFunctionName(),line:e.getLineNumber(),method:e.getMethodName(),native:e.isNative()}))}_addHandler(e){if(!this.handlers.has(e)){e.handleExceptions=!0;let t=new s(e);this.handlers.set(e,t),this.logger.pipe(t)}}_uncaughtException(e){let t=this.getAllInfo(e),n=this._getExceptionHandlers(),o=typeof this.logger.exitOnError==`function`?this.logger.exitOnError(e):this.logger.exitOnError,s;!n.length&&o&&(console.warn(`winston: exitOnError cannot be true with no exception handlers.`),console.warn(`winston: not exiting process.`),o=!1);function c(){i(`doExit`,o),i(`process._exiting`,process._exiting),o&&!process._exiting&&(s&&clearTimeout(s),process.exit(1))}if(!n||n.length===0)return process.nextTick(c);r(n,(e,t)=>{let n=a(t),r=e.transport||e;function o(e){return()=>{i(e),n()}}r._ending=!0,r.once(`finish`,o(`finished`)),r.once(`error`,o(`error`))},()=>o&&c()),this.logger.log(t),o&&(s=setTimeout(c,3e3))}_getExceptionHandlers(){return this.logger.transports.filter(e=>(e.transport||e).handleExceptions)}}})),Wh=_(((e,t)=>{let{Writable:n}=Th();t.exports=class extends n{constructor(e){if(super({objectMode:!0}),!e)throw Error(`RejectionStream requires a TransportStream instance.`);this.handleRejections=!0,this.transport=e}_write(e,t,n){return e.rejection?this.transport.log(e,n):(n(),!0)}}})),Gh=_(((e,t)=>{let n=x(`os`),r=Rh(),i=Oh()(`winston:rejection`),a=Bh(),o=Vh(),s=Wh();t.exports=class{constructor(e){if(!e)throw Error(`Logger is required to handle rejections`);this.logger=e,this.handlers=new Map}handle(...e){e.forEach(e=>{if(Array.isArray(e))return e.forEach(e=>this._addHandler(e));this._addHandler(e)}),this.catcher||(this.catcher=this._unhandledRejection.bind(this),process.on(`unhandledRejection`,this.catcher))}unhandle(){this.catcher&&(process.removeListener(`unhandledRejection`,this.catcher),this.catcher=!1,Array.from(this.handlers.values()).forEach(e=>this.logger.unpipe(e)))}getAllInfo(e){let t=null;return e&&(t=typeof e==`string`?e:e.message),{error:e,level:`error`,message:[`unhandledRejection: ${t||`(no error message)`}`,e&&e.stack||` No stack trace`].join(`
53
53
  `),stack:e&&e.stack,rejection:!0,date:new Date().toString(),process:this.getProcessInfo(),os:this.getOsInfo(),trace:this.getTrace(e)}}getProcessInfo(){return{pid:process.pid,uid:process.getuid?process.getuid():null,gid:process.getgid?process.getgid():null,cwd:process.cwd(),execPath:process.execPath,version:process.version,argv:process.argv,memoryUsage:process.memoryUsage()}}getOsInfo(){return{loadavg:n.loadavg(),uptime:n.uptime()}}getTrace(e){return(e?o.parse(e):o.get()).map(e=>({column:e.getColumnNumber(),file:e.getFileName(),function:e.getFunctionName(),line:e.getLineNumber(),method:e.getMethodName(),native:e.isNative()}))}_addHandler(e){if(!this.handlers.has(e)){e.handleRejections=!0;let t=new s(e);this.handlers.set(e,t),this.logger.pipe(t)}}_unhandledRejection(e){let t=this.getAllInfo(e),n=this._getRejectionHandlers(),o=typeof this.logger.exitOnError==`function`?this.logger.exitOnError(e):this.logger.exitOnError,s;!n.length&&o&&(console.warn(`winston: exitOnError cannot be true with no rejection handlers.`),console.warn(`winston: not exiting process.`),o=!1);function c(){i(`doExit`,o),i(`process._exiting`,process._exiting),o&&!process._exiting&&(s&&clearTimeout(s),process.exit(1))}if(!n||n.length===0)return process.nextTick(c);r(n,(e,t)=>{let n=a(t),r=e.transport||e;function o(e){return()=>{i(e),n()}}r._ending=!0,r.once(`finish`,o(`finished`)),r.once(`error`,o(`error`))},()=>o&&c()),this.logger.log(t),o&&(s=setTimeout(c,3e3))}_getRejectionHandlers(){return this.logger.transports.filter(e=>(e.transport||e).handleRejections)}}})),Kh=_(((e,t)=>{t.exports=class{constructor(e){let t=qh();if(typeof e!=`object`||Array.isArray(e)||!(e instanceof t))throw Error(`Logger is required for profiling`);this.logger=e,this.start=Date.now()}done(...e){typeof e[e.length-1]==`function`&&(console.warn(`Callback function no longer supported as of winston@3.0.0`),e.pop());let t=typeof e[e.length-1]==`object`?e.pop():{};return t.level=t.level||`info`,t.durationMs=Date.now()-this.start,this.logger.write(t)}}})),qh=_(((e,t)=>{let{Stream:n,Transform:r}=Th(),i=Rh(),{LEVEL:a,SPLAT:o}=Y(),s=Mh(),c=Uh(),l=Gh(),u=nh(),d=Kh(),{warn:f}=Lm(),p=Fh(),m=/%[scdjifoO%]/g;var h=class extends r{constructor(e){super({objectMode:!0}),this.configure(e)}child(e){let t=this;return Object.create(t,{write:{value:function(n){let r=Object.assign({},e,n);n instanceof Error&&(r.stack=n.stack,r.message=n.message,r.cause=n.cause),t.write(r)}}})}configure({silent:e,format:t,defaultMeta:n,levels:r,level:i=`info`,exitOnError:a=!0,transports:o,colors:s,emitErrs:u,formatters:d,padLevels:f,rewriters:m,stripColors:h,exceptionHandlers:g,rejectionHandlers:_}={}){if(this.transports.length&&this.clear(),this.silent=e,this.format=t||this.format||Cm()(),this.defaultMeta=n||null,this.levels=r||this.levels||p.npm.levels,this.level=i,this.exceptions&&this.exceptions.unhandle(),this.rejections&&this.rejections.unhandle(),this.exceptions=new c(this),this.rejections=new l(this),this.profilers={},this.exitOnError=a,o&&(o=Array.isArray(o)?o:[o],o.forEach(e=>this.add(e))),s||u||d||f||m||h)throw Error([`{ colors, emitErrs, formatters, padLevels, rewriters, stripColors } were removed in winston@3.0.0.`,`Use a custom winston.format(function) instead.`,`See: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md`].join(`
54
54
  `));g&&this.exceptions.handle(g),_&&this.rejections.handle(_)}getHighestLogLevel(){let e=g(this.levels,this.level);return!this.transports||this.transports.length===0?e:this.transports.reduce((e,t)=>{let n=g(this.levels,t.level);return n!==null&&n>e?n:e},e)}isLevelEnabled(e){let t=g(this.levels,e);if(t===null)return!1;let n=g(this.levels,this.level);return n===null?!1:!this.transports||this.transports.length===0?n>=t:this.transports.findIndex(e=>{let r=g(this.levels,e.level);return r===null&&(r=n),r>=t})!==-1}log(e,t,...n){if(arguments.length===1)return e[a]=e.level,this._addDefaultMeta(e),this.write(e),this;if(arguments.length===2)return t&&typeof t==`object`?(t[a]=t.level=e,this._addDefaultMeta(t),this.write(t),this):(t={[a]:e,level:e,message:t},this._addDefaultMeta(t),this.write(t),this);let[r]=n;if(typeof r==`object`&&r&&!(t&&t.match&&t.match(m))){let i=Object.assign({},this.defaultMeta,r,{[a]:e,[o]:n,level:e,message:t});return r.message&&(i.message=`${i.message} ${r.message}`),r.stack&&(i.stack=r.stack),r.cause&&(i.cause=r.cause),this.write(i),this}return this.write(Object.assign({},this.defaultMeta,{[a]:e,[o]:n,level:e,message:t})),this}_transform(e,t,n){if(this.silent)return n();e[a]||(e[a]=e.level),!this.levels[e[a]]&&this.levels[e[a]]!==0&&console.error(`[winston] Unknown logger level: %s`,e[a]),this._readableState.pipes||console.error(`[winston] Attempt to write logs with no transports, which can increase memory usage: %j`,e);try{this.push(this.format.transform(e,this.format.options))}finally{this._writableState.sync=!1,n()}}_final(e){i(this.transports.slice(),(e,t)=>{if(!e||e.finished)return setImmediate(t);e.once(`finish`,t),e.end()},e)}add(e){let t=!s(e)||e.log.length>2?new u({transport:e}):e;if(!t._writableState||!t._writableState.objectMode)throw Error(`Transports must WritableStreams in objectMode. Set { objectMode: true }.`);return this._onEvent(`error`,t),this._onEvent(`warn`,t),this.pipe(t),e.handleExceptions&&this.exceptions.handle(),e.handleRejections&&this.rejections.handle(),this}remove(e){if(!e)return this;let t=e;return(!s(e)||e.log.length>2)&&(t=this.transports.filter(t=>t.transport===e)[0]),t&&this.unpipe(t),this}clear(){return this.unpipe(),this}close(){return this.exceptions.unhandle(),this.rejections.unhandle(),this.clear(),this.emit(`close`),this}setLevels(){f.deprecated(`setLevels`)}query(e,t){typeof e==`function`&&(t=e,e={}),e||={};let n={},r=Object.assign({},e.query||{});function a(t,n){e.query&&typeof t.formatQuery==`function`&&(e.query=t.formatQuery(r)),t.query(e,(r,i)=>{if(r)return n(r);typeof t.formatResults==`function`&&(i=t.formatResults(i,e.format)),n(null,i)})}function o(e,t){a(e,(r,i)=>{t&&(i=r||i,i&&(n[e.name]=i),t()),t=null})}i(this.transports.filter(e=>!!e.query),o,()=>t(null,n))}stream(e={}){let t=new n,r=[];return t._streams=r,t.destroy=()=>{let e=r.length;for(;e--;)r[e].destroy()},this.transports.filter(e=>!!e.stream).forEach(n=>{let i=n.stream(e);i&&(r.push(i),i.on(`log`,e=>{e.transport=e.transport||[],e.transport.push(n.name),t.emit(`log`,e)}),i.on(`error`,e=>{e.transport=e.transport||[],e.transport.push(n.name),t.emit(`error`,e)}))}),t}startTimer(){return new d(this)}profile(e,...t){let n=Date.now();if(this.profilers[e]){let r=this.profilers[e];delete this.profilers[e],typeof t[t.length-2]==`function`&&(console.warn(`Callback function no longer supported as of winston@3.0.0`),t.pop());let i=typeof t[t.length-1]==`object`?t.pop():{};return i.level=i.level||`info`,i.durationMs=n-r,i.message=i.message||e,this.write(i)}return this.profilers[e]=n,this}handleExceptions(...e){console.warn(`Deprecated: .handleExceptions() will be removed in winston@4. Use .exceptions.handle()`),this.exceptions.handle(...e)}unhandleExceptions(...e){console.warn(`Deprecated: .unhandleExceptions() will be removed in winston@4. Use .exceptions.unhandle()`),this.exceptions.unhandle(...e)}cli(){throw Error([`Logger.cli() was removed in winston@3.0.0`,`Use a custom winston.formats.cli() instead.`,`See: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md`].join(`
55
- `))}_onEvent(e,t){function n(n){e===`error`&&!this.transports.includes(t)&&this.add(t),this.emit(e,n,t)}t[`__winston`+e]||(t[`__winston`+e]=n.bind(this),t.on(e,t[`__winston`+e]))}_addDefaultMeta(e){this.defaultMeta&&Object.assign(e,this.defaultMeta)}};function g(e,t){let n=e[t];return!n&&n!==0?null:n}Object.defineProperty(h.prototype,`transports`,{configurable:!1,enumerable:!0,get(){let{pipes:e}=this._readableState;return Array.isArray(e)?e:[e].filter(Boolean)}}),t.exports=h})),Jh=_(((e,t)=>{let{LEVEL:n}=Y(),r=Fh(),i=qh(),a=Oh()(`winston:create-logger`);function o(e){return`is`+e.charAt(0).toUpperCase()+e.slice(1)+`Enabled`}t.exports=function(e={}){e.levels=e.levels||r.npm.levels;class t extends i{constructor(e){super(e)}}let s=new t(e);return Object.keys(e.levels).forEach(function(e){if(a(`Define prototype method for "%s"`,e),e===`log`){console.warn(`Level "log" not defined: conflicts with the method "log". Use a different level name.`);return}t.prototype[e]=function(...t){let r=this||s;if(t.length===1){let[i]=t,a=i&&i.message&&i||{message:i};return a.level=a[n]=e,r._addDefaultMeta(a),r.write(a),this||s}return t.length===0?(r.log(e,``),r):r.log(e,...t)},t.prototype[o(e)]=function(){return(this||s).isLevelEnabled(e)}}),s}})),Yh=_(((e,t)=>{let n=Jh();t.exports=class{constructor(e={}){this.loggers=new Map,this.options=e}add(e,t){if(!this.loggers.has(e)){t=Object.assign({},t||this.options);let r=t.transports||this.options.transports;r?t.transports=Array.isArray(r)?r.slice():[r]:t.transports=[];let i=n(t);i.on(`close`,()=>this._delete(e)),this.loggers.set(e,i)}return this.loggers.get(e)}get(e,t){return this.add(e,t)}has(e){return!!this.loggers.has(e)}close(e){if(e)return this._removeLogger(e);this.loggers.forEach((e,t)=>this._removeLogger(t))}_removeLogger(e){this.loggers.has(e)&&(this.loggers.get(e).close(),this._delete(e))}_delete(e){this.loggers.delete(e)}}})),Xh=_((e=>{let t=Im(),{warn:n}=Lm();e.version=Rm().version,e.transports=Ph(),e.config=Fh(),e.addColors=t.levels,e.format=t.format,e.createLogger=Jh(),e.Logger=qh(),e.ExceptionHandler=Uh(),e.RejectionHandler=Gh(),e.Container=Yh(),e.Transport=rh(),e.loggers=new e.Container;let r=e.createLogger();Object.keys(e.config.npm.levels).concat([`log`,`query`,`stream`,`add`,`remove`,`clear`,`profile`,`startTimer`,`handleExceptions`,`unhandleExceptions`,`handleRejections`,`unhandleRejections`,`configure`,`child`]).forEach(t=>e[t]=(...e)=>r[t](...e)),Object.defineProperty(e,`level`,{get(){return r.level},set(e){r.level=e}}),Object.defineProperty(e,`exceptions`,{get(){return r.exceptions}}),Object.defineProperty(e,`rejections`,{get(){return r.rejections}}),[`exitOnError`].forEach(t=>{Object.defineProperty(e,t,{get(){return r[t]},set(e){r[t]=e}})}),Object.defineProperty(e,`default`,{get(){return{exceptionHandlers:r.exceptionHandlers,rejectionHandlers:r.rejectionHandlers,transports:r.transports}}}),n.deprecated(e,`setLevels`),n.forFunctions(e,`useFormat`,[`cli`]),n.forProperties(e,`useFormat`,[`padLevels`,`stripColors`]),n.forFunctions(e,`deprecated`,[`addRewriter`,`addFilter`,`clone`,`extend`]),n.forProperties(e,`deprecated`,[`emitErrs`,`levelLength`])}))();const Zh={error:`red`,warn:`yellow`,info:`green`,http:`magenta`,debug:`blue`},Qh=(0,Xh.format)(e=>(e.level=e.level.toUpperCase(),e));(0,Xh.addColors)(Zh);const $h=t.join(process.cwd(),`logs`),eg=Xh.format.printf(e=>{let{level:t,message:n,timestamp:i,stack:a,...o}=e,s=String(t),c=String(a||n);if(Object.keys(o).length>0){let e=r.inspect(o,{depth:null,colors:!1});c+=`\nExtra Details:\n${e}`}return`${i?new Date(String(i)).toLocaleString(`tr-TR`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`}):new Date().toISOString()} :${s}: ${c}`}),tg=(({logName:e})=>(0,Xh.createLogger)({level:$p.LOG_LEVEL,format:Xh.format.combine(Xh.format.timestamp(),Xh.format.errors({stack:!0})),transports:[new Xh.transports.Console({format:Xh.format.combine(Qh(),Xh.format.colorize({all:!0}),eg)}),new Xh.transports.File({level:`error`,filename:t.join($h,e,`${e}-Error.log`),format:eg}),new Xh.transports.File({filename:t.join($h,e,`${e}-Combined.log`),format:eg})]}))({logName:`globalLog`});var ng=_((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),rg=_((e=>{let{InvalidArgumentError:t}=ng();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}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,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),ig=_((e=>{let{humanReadableArgName:t}=rg();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
55
+ `))}_onEvent(e,t){function n(n){e===`error`&&!this.transports.includes(t)&&this.add(t),this.emit(e,n,t)}t[`__winston`+e]||(t[`__winston`+e]=n.bind(this),t.on(e,t[`__winston`+e]))}_addDefaultMeta(e){this.defaultMeta&&Object.assign(e,this.defaultMeta)}};function g(e,t){let n=e[t];return!n&&n!==0?null:n}Object.defineProperty(h.prototype,`transports`,{configurable:!1,enumerable:!0,get(){let{pipes:e}=this._readableState;return Array.isArray(e)?e:[e].filter(Boolean)}}),t.exports=h})),Jh=_(((e,t)=>{let{LEVEL:n}=Y(),r=Fh(),i=qh(),a=Oh()(`winston:create-logger`);function o(e){return`is`+e.charAt(0).toUpperCase()+e.slice(1)+`Enabled`}t.exports=function(e={}){e.levels=e.levels||r.npm.levels;class t extends i{constructor(e){super(e)}}let s=new t(e);return Object.keys(e.levels).forEach(function(e){if(a(`Define prototype method for "%s"`,e),e===`log`){console.warn(`Level "log" not defined: conflicts with the method "log". Use a different level name.`);return}t.prototype[e]=function(...t){let r=this||s;if(t.length===1){let[i]=t,a=i&&i.message&&i||{message:i};return a.level=a[n]=e,r._addDefaultMeta(a),r.write(a),this||s}return t.length===0?(r.log(e,``),r):r.log(e,...t)},t.prototype[o(e)]=function(){return(this||s).isLevelEnabled(e)}}),s}})),Yh=_(((e,t)=>{let n=Jh();t.exports=class{constructor(e={}){this.loggers=new Map,this.options=e}add(e,t){if(!this.loggers.has(e)){t=Object.assign({},t||this.options);let r=t.transports||this.options.transports;r?t.transports=Array.isArray(r)?r.slice():[r]:t.transports=[];let i=n(t);i.on(`close`,()=>this._delete(e)),this.loggers.set(e,i)}return this.loggers.get(e)}get(e,t){return this.add(e,t)}has(e){return!!this.loggers.has(e)}close(e){if(e)return this._removeLogger(e);this.loggers.forEach((e,t)=>this._removeLogger(t))}_removeLogger(e){this.loggers.has(e)&&(this.loggers.get(e).close(),this._delete(e))}_delete(e){this.loggers.delete(e)}}})),Xh=_((e=>{let t=Im(),{warn:n}=Lm();e.version=Rm().version,e.transports=Ph(),e.config=Fh(),e.addColors=t.levels,e.format=t.format,e.createLogger=Jh(),e.Logger=qh(),e.ExceptionHandler=Uh(),e.RejectionHandler=Gh(),e.Container=Yh(),e.Transport=rh(),e.loggers=new e.Container;let r=e.createLogger();Object.keys(e.config.npm.levels).concat([`log`,`query`,`stream`,`add`,`remove`,`clear`,`profile`,`startTimer`,`handleExceptions`,`unhandleExceptions`,`handleRejections`,`unhandleRejections`,`configure`,`child`]).forEach(t=>e[t]=(...e)=>r[t](...e)),Object.defineProperty(e,`level`,{get(){return r.level},set(e){r.level=e}}),Object.defineProperty(e,`exceptions`,{get(){return r.exceptions}}),Object.defineProperty(e,`rejections`,{get(){return r.rejections}}),[`exitOnError`].forEach(t=>{Object.defineProperty(e,t,{get(){return r[t]},set(e){r[t]=e}})}),Object.defineProperty(e,`default`,{get(){return{exceptionHandlers:r.exceptionHandlers,rejectionHandlers:r.rejectionHandlers,transports:r.transports}}}),n.deprecated(e,`setLevels`),n.forFunctions(e,`useFormat`,[`cli`]),n.forProperties(e,`useFormat`,[`padLevels`,`stripColors`]),n.forFunctions(e,`deprecated`,[`addRewriter`,`addFilter`,`clone`,`extend`]),n.forProperties(e,`deprecated`,[`emitErrs`,`levelLength`])}))();const Zh={error:`red`,warn:`yellow`,info:`green`,http:`magenta`,debug:`blue`},Qh=(0,Xh.format)(e=>(e.level=e.level.toUpperCase(),e));(0,Xh.addColors)(Zh);const $h=t.join(process.cwd(),`logs`),eg=Xh.format.printf(e=>{let{level:t,message:n,timestamp:i,stack:a,...o}=e,s=String(t),c=String(a||n);if(Object.keys(o).length>0){let e=r.inspect(o,{depth:null,colors:!1});c+=`\nExtra Details:\n${e}`}return`${i?new Date(String(i)).toLocaleString(`tr-TR`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`}):new Date().toISOString()} :${s}: ${c}`}),tg=(({logName:e,enableFileLogging:n=!0})=>{let r=[new Xh.transports.Console({format:Xh.format.combine(Qh(),Xh.format.colorize({all:!0}),eg)})],i=n?[new Xh.transports.File({level:`error`,filename:t.join($h,e,`${e}-Error.log`),format:eg}),new Xh.transports.File({filename:t.join($h,e,`${e}-Combined.log`),format:eg})]:[];return(0,Xh.createLogger)({level:$p.LOG_LEVEL,format:Xh.format.combine(Xh.format.timestamp(),Xh.format.errors({stack:!0})),transports:[...r,...i]})})({logName:`globalLog`,enableFileLogging:!1});var ng=_((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),rg=_((e=>{let{InvalidArgumentError:t}=ng();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}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,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),ig=_((e=>{let{humanReadableArgName:t}=rg();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
56
56
  `)}displayWidth(e){return r(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=` `.repeat(2);if(!n)return i+e;let a=e.padEnd(t+e.length-r.displayWidth(e)),o=(this.helpWidth??80)-t-2-2,s;return s=o<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,o).replace(/\n/g,`
57
57
  `+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
58
58
  `)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),ag=_((e=>{let{InvalidArgumentError:t}=ng();var n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=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 n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r===void 0?!1:r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
@@ -184,7 +184,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
184
184
  `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
185
185
  `,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,a=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(a=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(a.push(this.sourceToken),e.items.push({start:a}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(a.push(this.sourceToken),e.items.push({start:a,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey)if(!t.sep)if(i(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=c(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(i(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(o(t.key)&&!i(t.sep,`newline`)){let e=c(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else a.length>0?t.sep=t.sep.concat(a,this.sourceToken):t.sep.push(this.sourceToken);else t.sep?t.value||r?e.items.push({start:a,key:null,sep:[this.sourceToken]}):i(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:a,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!i(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:a});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||i(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=c(s(t));l(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(`
186
186
  `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
187
- `,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=c(s(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=c(s(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),N_=_((e=>{var t=T_(),n=c_(),r=l_(),i=Ng(),a=X(),o=j_(),s=M_();function c(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function l(e,n={}){let{lineCounter:i,prettyErrors:a}=c(n),o=new s.Parser(i?.addNewLine),l=new t.Composer(n),u=Array.from(l.compose(o.parse(e)));if(a&&i)for(let t of u)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return u.length>0?u:Object.assign([],{empty:!0},l.streamInfo())}function u(e,n={}){let{lineCounter:i,prettyErrors:a}=c(n),o=new s.Parser(i?.addNewLine),l=new t.Composer(n),u=null;for(let t of l.compose(o.parse(e),!0,e.length))if(!u)u=t;else if(u.options.logLevel!==`silent`){u.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(u.errors.forEach(r.prettifyError(e,i)),u.warnings.forEach(r.prettifyError(e,i))),u}function d(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=u(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function f(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=d,e.parseAllDocuments=l,e.parseDocument=u,e.stringify=f})),P_=b(_((e=>{var t=T_(),n=c_(),r=o_(),i=l_(),a=Tg(),o=X(),s=Ig(),c=Z(),l=Rg(),u=Bg();k_();var d=A_(),f=j_(),p=M_(),m=N_(),h=yg();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=m.parse,e.parseAllDocuments=m.parseAllDocuments,e.parseDocument=m.parseDocument,e.stringify=m.stringify,e.visit=h.visit,e.visitAsync=h.visitAsync}))(),1);function F_(){return $p.NODE_ENV===`development`?t.resolve(process.cwd(),`../../`):process.cwd()}const I_=new class{root=F_();async pathExists(e){try{return await a.access(e),!0}catch{return!1}}async writeFile({file:e,content:n}){await a.writeFile(t.resolve(this.root,e),n)}async writeJSONFile({file:e,content:n,dir:r}){e=`${e}.json`;let i=t.resolve(this.root,e);if(r){let n=t.resolve(this.root,r);await this.ensurePathExists({dir:r}),i=t.resolve(n,e)}await a.writeFile(i,JSON.stringify(n,null,2))}async readFile({file:e}){return await a.readFile(t.resolve(this.root,e),`utf-8`)}async readJSONFile({file:e,dir:n}){try{e=`${e}.json`;let r=t.resolve(this.root,n??``,e),i=await a.readFile(r,`utf-8`);return JSON.parse(i)}catch(t){return console.error(`Failed to read JSON file at ${e}:`,t),null}}async readYamlFile({file:e,dir:n}){try{e=`${e}.yaml`;let r=t.resolve(this.root,n??``,e),i=await a.readFile(r,`utf-8`);return P_.parseDocument(i)}catch(t){return console.error(`Failed to read Yaml file at ${e}:`,t),null}}async ensurePathExists({dir:e}){let n=t.resolve(this.root,e);await this.pathExists(n)||await a.mkdir(n,{recursive:!0})}async avoidOverriding({file:e}){let n=t.resolve(this.root,e);if(await this.pathExists(n))throw Error(`File ${n} already exists`)}async removeFile({file:e}){let n=t.resolve(this.root,e);await this.pathExists(n)&&await a.unlink(n)}async removeDirectory({dir:e,target:n}){let r=t.resolve(this.root,e,n);await this.pathExists(r)&&await a.rm(r,{recursive:!0,force:!0})}async copyFile({from:e,to:n}){await this.ensurePathExists({dir:t.dirname(n)}),await a.copyFile(t.resolve(this.root,e),t.resolve(this.root,n))}async copyDirectory({from:e,to:n,recursive:r=!0,include:i,exclude:o}){let s=t.resolve(this.root,e),c=t.resolve(this.root,n);if(!await this.pathExists(s))return;await this.ensurePathExists({dir:t.join(n)});let l=await a.readdir(s,{withFileTypes:!0});for(let u of l){let l=t.join(s,u.name),d=t.join(c,u.name),f=(!i||i.test(u.name))&&(!o||!o.test(u.name));u.isDirectory()?r&&await this.copyDirectory({from:t.join(e,u.name),to:t.join(n,u.name),recursive:r,include:i,exclude:o}):u.isFile()&&f&&await a.copyFile(l,d)}}async listDirectories({dir:e}){try{return(await a.readdir(t.resolve(this.root,e),{withFileTypes:!0})).filter(e=>e.isDirectory()).map(e=>e.name)}catch(t){return console.error(`Error listing directories in ${e}:`,t),[]}}async listFiles({dir:e}){try{return(await a.readdir(t.resolve(this.root,e),{withFileTypes:!0})).filter(e=>e.isFile()).map(e=>e.name)}catch(t){return console.error(`Error listing files in ${e}:`,t),[]}}},L_={".npmignore":{tags:[`never`]},".npmrc":{tags:[`never`]},".prettierignore":{tags:[`prettier`]},".prettier.js":{tags:[`prettier`]},"biome.json":{tags:[`biome`]},"package.json":{tags:[`never`]},"pnpm-lock.yaml":{tags:[`never`]},"pnpm-workspace.yaml":{tags:[`root`]},"turbo.json":{tags:[`root`]},LICENSE:{tags:[`never`]},".env":{tags:[`never`]},"eslint.config.ts":{tags:[`never`]},"vitest.config.ts":{tags:[`never`]},"tsdown.config.ts":{tags:[`tsdown`]}},R_=Qp({STARTX_ENV:Gp.enum([`development`,`production`,`test`,`staging`]).default(`production`)});var z_=class{static getDirectory(){let e=n(import.meta.url),r=t.dirname(e),i=process.cwd();return r=R_.STARTX_ENV===`development`?t.resolve(r,`../../../../`):t.resolve(r,`../../../`),{template:r,workspace:i}}static async getPackageList(){let e=[],n=this.getDirectory().template,r=async e=>{try{return await I_.listDirectories({dir:e})}catch(e){return console.error(`Error listing directory:`,e),[]}},[i,a,o,s]=await Promise.all([r(t.join(n,`apps`)),r(t.join(n,`configs`)),r(t.join(n,`packages`)),r(t.join(n,`packages`,`@repo`))]);return i.forEach(r=>{e.push({type:`apps`,path:t.join(n,`apps`,r),name:r})}),a.forEach(r=>{e.push({type:`configs`,path:t.join(n,`configs`,r),name:r})}),o.forEach(r=>{r!==`@repo`&&e.push({type:`packages`,path:t.join(n,`packages`,r),name:r})}),s.forEach(r=>{e.push({type:`packages`,path:t.join(n,`packages`,`@repo`,r),name:`@repo/${r}`})}),e}static async parsePackageJson({dir:e}){return await I_.readJSONFile({dir:e,file:`package`})}static async parsePnpmWorkspace({dir:e}){return(await I_.readYamlFile({file:`pnpm-workspace`,dir:e}))?.toJSON()}};const B_={"@biomejs/biome":{tags:[`common`,`biome`,`root`],version:`catalog:`},prettier:{tags:[`common`,`prettier`,`root`],version:`catalog:`},vitest:{tags:[`common`,`vitest`,`root`],version:`catalog:`},tsdown:{tags:[`common`,`tsdown`,`root`],version:`catalog:`},"@types/node":{tags:[`common`,`node`,`root`],version:`catalog:`,isDevDependency:!0},"typescript-config":{tags:[`common`],version:`workspace:^`,isDevDependency:!0},"eslint-config":{tags:[`common`,`eslint`],version:`workspace:^`,isDevDependency:!0},"vitest-config":{tags:[`common`,`vitest`],version:`workspace:^`,isDevDependency:!0}},V_={dev:[{script:`turbo run dev`,tags:[`app`,`root`]},{script:`tsx watch src/index.ts`,tags:[`app`]}],"dev:debug":[{script:`turbo run dev:debug`,tags:[`backend`,`node`,`root`]},{script:`tsx watch --inspect src/index.ts`,tags:[`backend`,`node`]}],"bun:dev":[{script:`turbo run bun:dev`,tags:[`backend`,`node`,`root`]},{script:`bun --watch src/index.ts`,tags:[`backend`,`node`]}],start:[{script:`turbo run start`,tags:[`backend`,`node`,`root`]},{script:`node dist/index.mjs`,tags:[`backend`,`node`]}],lint:[{script:`turbo run eslint`,tags:[`common`,`eslint`,`root`]},{script:`eslint .`,tags:[`common`,`eslint`]}],"lint:fix":[{script:`turbo run lint:fix`,tags:[`common`,`eslint`,`root`]},{script:`eslint . src/**/*.ts --fix`,tags:[`common`,`eslint`]}],clean:[{script:`turbo run clean`,tags:[`common`,`root`]},{script:`rimraf dist .turbo`,tags:[`common`]}],"deep:clean":[{script:`turbo run deep:clean`,tags:[`common`,`root`]},{script:`rimraf node_modules dist .turbo`,tags:[`common`]}],typecheck:[{script:`turbo run typecheck`,tags:[`common`,`root`]},{script:`tsc --noEmit`,tags:[`common`]}],format:[{script:`turbo run format`,tags:[`common`,`root`]},{script:`biome format --write .`,tags:[`common`,`biome`,`prettier`]},{script:`prettier --write .`,tags:[`common`,`prettier`]}],"format:check":[{script:`turbo run format:check`,tags:[`common`,`root`]},{script:`biome ci .`,tags:[`common`,`biome`,`prettier`]},{script:`prettier --check .`,tags:[`common`,`prettier`]}],test:[{script:`turbo run test`,tags:[`common`,`vitest`,`root`]},{script:`vitest run`,tags:[`common`,`vitest`]}]},H_={packageManager:`pnpm@10.28.2`,node:`>=22`};var U_=class{static objSorter(e,t=[]){let n=Object.fromEntries(Object.entries(e).filter(([,e])=>e!=null)),r=[];for(let e of t)e in n&&(r.push([e,n[e]]),delete n[e]);for(let e of Object.entries(n))r.push(e);return Object.fromEntries(r)}static handlePackageJson(e){let t=!!e.app.devDependencies?.turbo,n=t?[...e.tags,`root`]:[...e.tags],r=t?{version:`1.0.0`,packageManager:H_.packageManager,engines:{node:H_.node}}:{},i=Object.fromEntries(Object.entries(V_).map(([e,t])=>{let r=t.find(e=>e.tags.every(e=>n.includes(e)));return r?[e,r.script]:null}).filter(e=>e!==null)),a=e=>Object.fromEntries(Object.entries(e??{}).filter(([e])=>{let t=B_[e];return!t||t.tags.every(e=>n.includes(e))})),o=a(e.app.dependencies),s=a(e.app.devDependencies);for(let[e,t]of Object.entries(s))t.includes(`workspace:`)&&delete s[e];if(e.dependencies)for(let[t,n]of Object.entries(e.dependencies))o[t]||(o[t]=n);for(let[e,t]of Object.entries(B_))t.isDevDependency&&!s[e]?s[e]=t.version:o[e]||(o[e]=t.version);for(let t of e.app.startx?.ignore??[])delete o[t],delete s[t];let c={name:e.name||e.app.name,description:e.app.description,type:`module`,exports:e.app.exports,files:e.app.files,scripts:i,dependencies:o,devDependencies:s,...r};return{packageJson:this.objSorter(c,[`name`,`description`,`version`,`type`,`scripts`,`files`,`exports`,`dependencies`,`devDependencies`,`packageManager`,`engines`]),isWorkspace:t}}};const W_=(e,t=[])=>e.name===`up`||t.includes(`vim`)&&e.name===`k`||t.includes(`emacs`)&&e.ctrl&&e.name===`p`,G_=(e,t=[])=>e.name===`down`||t.includes(`vim`)&&e.name===`j`||t.includes(`emacs`)&&e.ctrl&&e.name===`n`,K_=e=>e.name===`space`,q_=e=>e.name===`backspace`,J_=e=>e.name===`tab`,Y_=e=>`1234567890`.includes(e.name),X_=e=>e.name===`enter`||e.name===`return`;var Z_=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},Q_=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},$_=class extends Error{name=`ExitPromptError`},ev=class extends Error{name=`HookError`},tv=class extends Error{name=`ValidationError`};const nv=new o;function rv(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function iv(e,t){let n=rv(e);return nv.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function av(){let e=nv.getStore();if(!e)throw new ev(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function ov(){return av().rl}function sv(e){return s.bind((...t)=>{let n=av(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function cv(e){let t=av(),{index:n}=t,r=e({get(){return t.hooks[n]},set(e){t.hooks[n]=e},initialized:n in t.hooks});return t.index++,r}function lv(){av().handleChange()}const uv={queue(e){let t=av(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(ov());if(r!=null&&typeof r!=`function`)throw new tv(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=av();sv(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=av();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function Q(e){return cv(t=>{let n=s.bind(function(e){t.get()!==e&&(t.set(e),lv())});if(t.initialized)return[t.get(),n];let r=typeof e==`function`?e():e;return t.set(r),[r,n]})}function dv(e,t){cv(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&uv.queue(e),n.set(t)})}function fv(){return i.platform===`win32`?!!i.env.WT_SESSION||!!i.env.TERMINUS_SUBLIME||i.env.ConEmuTask===`{cmd::Cmder}`||i.env.TERM_PROGRAM===`Terminus-Sublime`||i.env.TERM_PROGRAM===`vscode`||i.env.TERM===`xterm-256color`||i.env.TERM===`alacritty`||i.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:i.env.TERM!==`linux`}const pv={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},mv={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},hv={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},gv={...pv,...mv},_v={...pv,...hv};var vv=fv()?gv:_v;Object.entries(mv);const yv={prefix:{idle:l(`blue`,`?`),done:l(`green`,vv.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>l(`yellow`,e))},style:{answer:e=>l(`cyan`,e),message:e=>l(`bold`,e),error:e=>l(`red`,`> ${e}`),defaultAnswer:e=>l(`dim`,`(${e})`),help:e=>l(`dim`,e),highlight:e=>l(`cyan`,e),key:e=>l(`cyan`,l(`bold`,`<${e}>`))}};function bv(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function xv(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=bv(n)&&bv(r)?xv(n,r):r}return t}function Sv(...e){return xv(yv,...e.filter(e=>e!=null))}function Cv({status:e=`idle`,theme:t}){let[n,r]=Q(!1),[i,a]=Q(0),{prefix:o,spinner:s}=Sv(t);return dv(()=>{if(e===`loading`){let e,t=-1,n=setTimeout(()=>{r(!0),e=setInterval(()=>{t+=1,a(t%s.frames.length)},s.interval)},300);return()=>{clearTimeout(n),clearInterval(e)}}else r(!1)},[e]),n?s.frames[i]:typeof o==`string`?o:o[e===`loading`?`idle`:e]??o.idle}function wv(e,t){return cv(n=>{let r=n.get();if(!r||r.dependencies.length!==t.length||r.dependencies.some((e,n)=>e!==t[n])){let r=e();return n.set({value:r,dependencies:t}),r}return r.value})}function Tv(e){return Q({current:e})[0]}function Ev(e){let t=Tv(e);t.current=e,dv(e=>{let n=!1,r=sv((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var Dv=_(((e,t)=>{t.exports=r;function n(e){let t={defaultWidth:0,output:process.stdout,tty:x(`tty`)};return e?(Object.keys(t).forEach(function(n){e[n]||(e[n]=t[n])}),e):t}function r(e){let t=n(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}));const Ov=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),kv=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Av=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,jv=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Mv=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Nv=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Pv=/\t{1,1000}/y,Fv=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,Iv=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Lv=/\p{M}+/gu,Rv={limit:1/0,ellipsis:``},zv=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?zv(i,Rv,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Iv,l],[jv,0],[Mv,o],[Pv,s],[Fv,c],[Nv,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(Lv,``)){let t=e.codePointAt(0)||0;if(S=kv(t)?2:Av(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===Nv?Ov(e.slice(p,n.lastIndex)):n===Fv?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}};var Bv=zv;const Vv={limit:1/0,ellipsis:``,ellipsisWidth:0};var Hv=(e,t={})=>Bv(e,Vv,t).width;const Uv=`]8;;`,Wv=RegExp(`(?:\\[(?<code>\\d+)m|\\${Uv}(?<uri>.*))`,`y`),Gv=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Kv=e=>`[${e}m`,qv=e=>`${Uv}${e}`,Jv=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:Hv(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=Hv(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===`›`)&&(i=!0,a=t.startsWith(Uv,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Yv=e=>{let t=e.split(` `),n=t.length;for(;n&&!Hv(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Xv=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=Hv(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=Hv(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),Jv(s,r,t),c=Hv(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Jv(s,r,t),c=Hv(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){Jv(s,r,t),c=Hv(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Yv(e)));let l=s.join(`
187
+ `,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=c(s(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=c(s(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),N_=_((e=>{var t=T_(),n=c_(),r=l_(),i=Ng(),a=X(),o=j_(),s=M_();function c(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function l(e,n={}){let{lineCounter:i,prettyErrors:a}=c(n),o=new s.Parser(i?.addNewLine),l=new t.Composer(n),u=Array.from(l.compose(o.parse(e)));if(a&&i)for(let t of u)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return u.length>0?u:Object.assign([],{empty:!0},l.streamInfo())}function u(e,n={}){let{lineCounter:i,prettyErrors:a}=c(n),o=new s.Parser(i?.addNewLine),l=new t.Composer(n),u=null;for(let t of l.compose(o.parse(e),!0,e.length))if(!u)u=t;else if(u.options.logLevel!==`silent`){u.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(u.errors.forEach(r.prettifyError(e,i)),u.warnings.forEach(r.prettifyError(e,i))),u}function d(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=u(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function f(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=d,e.parseAllDocuments=l,e.parseDocument=u,e.stringify=f})),P_=b(_((e=>{var t=T_(),n=c_(),r=o_(),i=l_(),a=Tg(),o=X(),s=Ig(),c=Z(),l=Rg(),u=Bg();k_();var d=A_(),f=j_(),p=M_(),m=N_(),h=yg();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=m.parse,e.parseAllDocuments=m.parseAllDocuments,e.parseDocument=m.parseDocument,e.stringify=m.stringify,e.visit=h.visit,e.visitAsync=h.visitAsync}))(),1);function F_(){return $p.NODE_ENV===`development`?t.resolve(process.cwd(),`../../`):process.cwd()}const I_=new class{root=F_();async pathExists(e){try{return await a.access(e),!0}catch{return!1}}async writeFile({file:e,content:n}){await a.writeFile(t.resolve(this.root,e),n)}async writeJSONFile({file:e,content:n,dir:r}){e=`${e}.json`;let i=t.resolve(this.root,e);if(r){let n=t.resolve(this.root,r);await this.ensurePathExists({dir:r}),i=t.resolve(n,e)}await a.writeFile(i,JSON.stringify(n,null,2))}async readFile({file:e}){return await a.readFile(t.resolve(this.root,e),`utf-8`)}async readJSONFile({file:e,dir:n}){try{e=`${e}.json`;let r=t.resolve(this.root,n??``,e),i=await a.readFile(r,`utf-8`);return JSON.parse(i)}catch(t){return console.error(`Failed to read JSON file at ${e}:`,t),null}}async readYamlFile({file:e,dir:n}){try{e=`${e}.yaml`;let r=t.resolve(this.root,n??``,e),i=await a.readFile(r,`utf-8`);return P_.parseDocument(i)}catch(t){return console.error(`Failed to read Yaml file at ${e}:`,t),null}}async ensurePathExists({dir:e}){let n=t.resolve(this.root,e);await this.pathExists(n)||await a.mkdir(n,{recursive:!0})}async avoidOverriding({file:e}){let n=t.resolve(this.root,e);if(await this.pathExists(n))throw Error(`File ${n} already exists`)}async removeFile({file:e}){let n=t.resolve(this.root,e);await this.pathExists(n)&&await a.unlink(n)}async removeDirectory({dir:e,target:n}){let r=t.resolve(this.root,e,n);await this.pathExists(r)&&await a.rm(r,{recursive:!0,force:!0})}async copyFile({from:e,to:n}){await this.ensurePathExists({dir:t.dirname(n)}),await a.copyFile(t.resolve(this.root,e),t.resolve(this.root,n))}async copyDirectory({from:e,to:n,recursive:r=!0,include:i,exclude:o}){let s=t.resolve(this.root,e),c=t.resolve(this.root,n);if(!await this.pathExists(s))return;await this.ensurePathExists({dir:t.join(n)});let l=await a.readdir(s,{withFileTypes:!0});for(let u of l){let l=t.join(s,u.name),d=t.join(c,u.name),f=(!i||i.test(u.name))&&(!o||!o.test(u.name));u.isDirectory()?r&&await this.copyDirectory({from:t.join(e,u.name),to:t.join(n,u.name),recursive:r,include:i,exclude:o}):u.isFile()&&f&&await a.copyFile(l,d)}}async listDirectories({dir:e}){try{return(await a.readdir(t.resolve(this.root,e),{withFileTypes:!0})).filter(e=>e.isDirectory()).map(e=>e.name)}catch(t){return console.error(`Error listing directories in ${e}:`,t),[]}}async listFiles({dir:e}){try{return(await a.readdir(t.resolve(this.root,e),{withFileTypes:!0})).filter(e=>e.isFile()).map(e=>e.name)}catch(t){return console.error(`Error listing files in ${e}:`,t),[]}}},L_={"startx.json":{tags:[`never`]},".npmignore":{tags:[`never`]},".npmrc":{tags:[`never`]},".prettierignore":{tags:[`prettier`]},".prettier.js":{tags:[`prettier`]},"biome.json":{tags:[`biome`]},"package.json":{tags:[`never`]},"pnpm-lock.yaml":{tags:[`never`]},"pnpm-workspace.yaml":{tags:[`root`]},"turbo.json":{tags:[`root`]},LICENSE:{tags:[`never`]},".env":{tags:[`never`]},"eslint.config.ts":{tags:[`never`]},"vitest.config.ts":{tags:[`never`]},"tsdown.config.ts":{tags:[`tsdown`]}},R_=Qp({STARTX_ENV:Gp.enum([`development`,`production`,`test`,`staging`]).default(`production`)});var z_=class{static getDirectory(){let e=n(import.meta.url),r=t.dirname(e),i=process.cwd();return r=R_.STARTX_ENV===`development`?t.resolve(r,`../../../../`):t.resolve(r,`../../../`),{template:r,workspace:i}}static async getPackageList(){let e=[],n=this.getDirectory().template,r=async e=>{try{return await I_.listDirectories({dir:e})}catch(e){return console.error(`Error listing directory:`,e),[]}},[i,a,o,s]=await Promise.all([r(t.join(n,`apps`)),r(t.join(n,`configs`)),r(t.join(n,`packages`)),r(t.join(n,`packages`,`@repo`))]);return i.forEach(r=>{e.push({type:`apps`,path:t.join(n,`apps`,r),name:r})}),a.forEach(r=>{e.push({type:`configs`,path:t.join(n,`configs`,r),name:r})}),o.forEach(r=>{r!==`@repo`&&e.push({type:`packages`,path:t.join(n,`packages`,r),name:r})}),s.forEach(r=>{e.push({type:`packages`,path:t.join(n,`packages`,`@repo`,r),name:`@repo/${r}`})}),e}static async parsePackageJson({dir:e,file:t=`package`}){return await I_.readJSONFile({dir:e,file:t})}static async parsePnpmWorkspace({dir:e}){return(await I_.readYamlFile({file:`pnpm-workspace`,dir:e}))?.toJSON()}};const B_={"@biomejs/biome":{tags:[`common`,`biome`,`root`],version:`catalog:`},prettier:{tags:[`common`,`prettier`,`root`],version:`catalog:`},vitest:{tags:[`common`,`vitest`,`root`],version:`catalog:`},tsdown:{tags:[`common`,`tsdown`,`root`],version:`catalog:`},"@types/node":{tags:[`common`,`node`,`root`],version:`catalog:`,isDevDependency:!0},"typescript-config":{tags:[`common`],version:`workspace:^`,isDevDependency:!0},"eslint-config":{tags:[`common`,`eslint`],version:`workspace:^`,isDevDependency:!0},"vitest-config":{tags:[`common`,`vitest`],version:`workspace:^`,isDevDependency:!0}},V_={dev:[{script:`turbo run dev`,tags:[`app`,`root`]},{script:`tsx watch src/index.ts`,tags:[`app`]}],"dev:debug":[{script:`turbo run dev:debug`,tags:[`backend`,`node`,`root`]},{script:`tsx watch --inspect src/index.ts`,tags:[`backend`,`node`]}],"bun:dev":[{script:`turbo run bun:dev`,tags:[`backend`,`node`,`root`]},{script:`bun --watch src/index.ts`,tags:[`backend`,`node`]}],start:[{script:`turbo run start`,tags:[`backend`,`node`,`root`]},{script:`node dist/index.mjs`,tags:[`backend`,`node`]}],lint:[{script:`turbo run eslint`,tags:[`common`,`eslint`,`root`]},{script:`eslint .`,tags:[`common`,`eslint`]}],"lint:fix":[{script:`turbo run lint:fix`,tags:[`common`,`eslint`,`root`]},{script:`eslint . src/**/*.ts --fix`,tags:[`common`,`eslint`]}],clean:[{script:`turbo run clean`,tags:[`common`,`root`]},{script:`rimraf dist .turbo`,tags:[`common`]}],"deep:clean":[{script:`turbo run deep:clean`,tags:[`common`,`root`]},{script:`rimraf node_modules dist .turbo`,tags:[`common`]}],typecheck:[{script:`turbo run typecheck`,tags:[`common`,`root`]},{script:`tsc --noEmit`,tags:[`common`]}],format:[{script:`turbo run format`,tags:[`common`,`root`]},{script:`biome format --write .`,tags:[`common`,`biome`,`prettier`]},{script:`prettier --write .`,tags:[`common`,`prettier`]}],"format:check":[{script:`turbo run format:check`,tags:[`common`,`root`]},{script:`biome ci .`,tags:[`common`,`biome`,`prettier`]},{script:`prettier --check .`,tags:[`common`,`prettier`]}],test:[{script:`turbo run test`,tags:[`common`,`vitest`,`root`]},{script:`vitest run`,tags:[`common`,`vitest`]}]},H_={packageManager:`pnpm@10.28.2`,node:`>=22`};var U_=class{static objSorter(e,t=[]){let n=Object.fromEntries(Object.entries(e).filter(([,e])=>e!=null)),r=[];for(let e of t)e in n&&(r.push([e,n[e]]),delete n[e]);for(let e of Object.entries(n))r.push(e);return Object.fromEntries(r)}static handlePackageJson(e){let t=!!e.app.devDependencies?.turbo,n=t?[...e.tags,`root`]:[...e.tags],r=t?{version:`1.0.0`,packageManager:H_.packageManager,engines:{node:H_.node}}:{},i=Object.fromEntries(Object.entries(V_).map(([e,t])=>{let r=t.find(e=>e.tags.every(e=>n.includes(e)));return r?[e,r.script]:null}).filter(e=>e!==null)),a=e=>Object.fromEntries(Object.entries(e??{}).filter(([e])=>{let t=B_[e];return!t||t.tags.every(e=>n.includes(e))})),o=a(e.app.dependencies),s=a(e.app.devDependencies);for(let[e,t]of Object.entries(s))t.includes(`workspace:`)&&delete s[e];if(e.dependencies)for(let[t,n]of Object.entries(e.dependencies))o[t]||(o[t]=n);for(let[e,t]of Object.entries(B_))t.isDevDependency&&!s[e]?s[e]=t.version:o[e]||(o[e]=t.version);for(let t of e.app.startx?.ignore??[])delete o[t],delete s[t];let c={name:e.name||e.app.name,description:e.app.description,type:`module`,exports:e.app.exports,files:e.app.files,scripts:i,dependencies:o,devDependencies:s,...r};return{packageJson:this.objSorter(c,[`name`,`description`,`version`,`type`,`scripts`,`files`,`exports`,`dependencies`,`devDependencies`,`packageManager`,`engines`]),isWorkspace:t}}};const W_=(e,t=[])=>e.name===`up`||t.includes(`vim`)&&e.name===`k`||t.includes(`emacs`)&&e.ctrl&&e.name===`p`,G_=(e,t=[])=>e.name===`down`||t.includes(`vim`)&&e.name===`j`||t.includes(`emacs`)&&e.ctrl&&e.name===`n`,K_=e=>e.name===`space`,q_=e=>e.name===`backspace`,J_=e=>e.name===`tab`,Y_=e=>`1234567890`.includes(e.name),X_=e=>e.name===`enter`||e.name===`return`;var Z_=class extends Error{name=`AbortPromptError`;message=`Prompt was aborted`;constructor(e){super(),this.cause=e?.cause}},Q_=class extends Error{name=`CancelPromptError`;message=`Prompt was canceled`},$_=class extends Error{name=`ExitPromptError`},ev=class extends Error{name=`HookError`},tv=class extends Error{name=`ValidationError`};const nv=new o;function rv(e){return{rl:e,hooks:[],hooksCleanup:[],hooksEffect:[],index:0,handleChange(){}}}function iv(e,t){let n=rv(e);return nv.run(n,()=>{function e(e){n.handleChange=()=>{n.index=0,e()},n.handleChange()}return t(e)})}function av(){let e=nv.getStore();if(!e)throw new ev(`[Inquirer] Hook functions can only be called from within a prompt`);return e}function ov(){return av().rl}function sv(e){return s.bind((...t)=>{let n=av(),r=!1,i=n.handleChange;n.handleChange=()=>{r=!0};let a=e(...t);return r&&i(),n.handleChange=i,a})}function cv(e){let t=av(),{index:n}=t,r=e({get(){return t.hooks[n]},set(e){t.hooks[n]=e},initialized:n in t.hooks});return t.index++,r}function lv(){av().handleChange()}const uv={queue(e){let t=av(),{index:n}=t;t.hooksEffect.push(()=>{t.hooksCleanup[n]?.();let r=e(ov());if(r!=null&&typeof r!=`function`)throw new tv(`useEffect return value must be a cleanup function or nothing.`);t.hooksCleanup[n]=r})},run(){let e=av();sv(()=>{e.hooksEffect.forEach(e=>{e()}),e.hooksEffect.length=0})()},clearAll(){let e=av();e.hooksCleanup.forEach(e=>{e?.()}),e.hooksEffect.length=0,e.hooksCleanup.length=0}};function Q(e){return cv(t=>{let n=s.bind(function(e){t.get()!==e&&(t.set(e),lv())});if(t.initialized)return[t.get(),n];let r=typeof e==`function`?e():e;return t.set(r),[r,n]})}function dv(e,t){cv(n=>{let r=n.get();(!Array.isArray(r)||t.some((e,t)=>!Object.is(e,r[t])))&&uv.queue(e),n.set(t)})}function fv(){return i.platform===`win32`?!!i.env.WT_SESSION||!!i.env.TERMINUS_SUBLIME||i.env.ConEmuTask===`{cmd::Cmder}`||i.env.TERM_PROGRAM===`Terminus-Sublime`||i.env.TERM_PROGRAM===`vscode`||i.env.TERM===`xterm-256color`||i.env.TERM===`alacritty`||i.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:i.env.TERM!==`linux`}const pv={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},mv={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},hv={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},gv={...pv,...mv},_v={...pv,...hv};var vv=fv()?gv:_v;Object.entries(mv);const yv={prefix:{idle:l(`blue`,`?`),done:l(`green`,vv.tick)},spinner:{interval:80,frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`].map(e=>l(`yellow`,e))},style:{answer:e=>l(`cyan`,e),message:e=>l(`bold`,e),error:e=>l(`red`,`> ${e}`),defaultAnswer:e=>l(`dim`,`(${e})`),help:e=>l(`dim`,e),highlight:e=>l(`cyan`,e),key:e=>l(`cyan`,l(`bold`,`<${e}>`))}};function bv(e){if(typeof e!=`object`||!e)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function xv(...e){let t={};for(let n of e)for(let[e,r]of Object.entries(n)){let n=t[e];t[e]=bv(n)&&bv(r)?xv(n,r):r}return t}function Sv(...e){return xv(yv,...e.filter(e=>e!=null))}function Cv({status:e=`idle`,theme:t}){let[n,r]=Q(!1),[i,a]=Q(0),{prefix:o,spinner:s}=Sv(t);return dv(()=>{if(e===`loading`){let e,t=-1,n=setTimeout(()=>{r(!0),e=setInterval(()=>{t+=1,a(t%s.frames.length)},s.interval)},300);return()=>{clearTimeout(n),clearInterval(e)}}else r(!1)},[e]),n?s.frames[i]:typeof o==`string`?o:o[e===`loading`?`idle`:e]??o.idle}function wv(e,t){return cv(n=>{let r=n.get();if(!r||r.dependencies.length!==t.length||r.dependencies.some((e,n)=>e!==t[n])){let r=e();return n.set({value:r,dependencies:t}),r}return r.value})}function Tv(e){return Q({current:e})[0]}function Ev(e){let t=Tv(e);t.current=e,dv(e=>{let n=!1,r=sv((r,i)=>{n||t.current(i,e)});return e.input.on(`keypress`,r),()=>{n=!0,e.input.removeListener(`keypress`,r)}},[])}var Dv=_(((e,t)=>{t.exports=r;function n(e){let t={defaultWidth:0,output:process.stdout,tty:x(`tty`)};return e?(Object.keys(t).forEach(function(n){e[n]||(e[n]=t[n])}),e):t}function r(e){let t=n(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}));const Ov=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),kv=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Av=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,jv=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Mv=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Nv=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Pv=/\t{1,1000}/y,Fv=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,Iv=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Lv=/\p{M}+/gu,Rv={limit:1/0,ellipsis:``},zv=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?zv(i,Rv,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Iv,l],[jv,0],[Mv,o],[Pv,s],[Fv,c],[Nv,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(Lv,``)){let t=e.codePointAt(0)||0;if(S=kv(t)?2:Av(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===Nv?Ov(e.slice(p,n.lastIndex)):n===Fv?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}};var Bv=zv;const Vv={limit:1/0,ellipsis:``,ellipsisWidth:0};var Hv=(e,t={})=>Bv(e,Vv,t).width;const Uv=`]8;;`,Wv=RegExp(`(?:\\[(?<code>\\d+)m|\\${Uv}(?<uri>.*))`,`y`),Gv=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Kv=e=>`[${e}m`,qv=e=>`${Uv}${e}`,Jv=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:Hv(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=Hv(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===`›`)&&(i=!0,a=t.startsWith(Uv,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Yv=e=>{let t=e.split(` `),n=t.length;for(;n&&!Hv(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Xv=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=Hv(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=Hv(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),Jv(s,r,t),c=Hv(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Jv(s,r,t),c=Hv(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){Jv(s,r,t),c=Hv(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Yv(e)));let l=s.join(`
188
188
  `),u=!1;for(let e=0;e<l.length;e++){let t=l[e];if(r+=t,u)u=!1;else if(u=t>=`\ud800`&&t<=`\udbff`,u)continue;if(t===`\x1B`||t===`›`){Wv.lastIndex=e+1;let t=Wv.exec(l)?.groups;if(t?.code!==void 0){let e=Number.parseFloat(t.code);i=e===39?void 0:e}else t?.uri!==void 0&&(a=t.uri.length===0?void 0:t.uri)}if(l[e+1]===`
189
189
  `){a&&(r+=qv(``));let e=i?Gv(i):void 0;i&&e&&(r+=Kv(e))}else t===`
190
190
  `&&(i&&Gv(i)&&(r+=Kv(i)),a&&(r+=qv(a)))}return r},Zv=/\r?\n/;function Qv(e,t,n){return String(e).normalize().split(Zv).map(e=>Xv(e,t,n)).join(`
@@ -200,4 +200,4 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
200
200
  `+t:``),o=Math.floor(n.length/i)-this.cursorPos.rows+(t?Ty(t):0);o>0&&(a+=by(o)),a+=Sy(this.cursorPos.cols),this.write(xy(this.extraLinesUnderPrompt)+wy(this.height)+a),this.extraLinesUnderPrompt=o,this.height=Ty(a)}checkCursorPos(){let e=this.rl.getCursorPos();e.cols!==this.cursorPos.cols&&(this.write(Sy(e.cols)),this.cursorPos=e)}done({clearContent:e}){this.rl.setPrompt(``);let t=xy(this.extraLinesUnderPrompt);t+=e?wy(this.height):`
201
201
  `,t+=`\x1B[?25h`,this.write(t),this.rl.close()}},Oy=class extends Promise{static withResolver(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}},ky=b(iy(),1);const Ay=globalThis.setImmediate;function jy(){let e=Error.prepareStackTrace,t=[];try{Error.prepareStackTrace=(e,n)=>{let r=n.slice(1);return t=r,r},Error().stack}catch{return t}return Error.prepareStackTrace=e,t}function My(e){let t=jy();return(n,r={})=>{let{input:i=process.stdin,signal:a}=r,o=new Set,c=new ky.default;c.pipe(r.output??process.stdout),c.mute();let l=u.createInterface({terminal:!0,input:i,output:c}),d=new Dy(l),{promise:f,resolve:p,reject:m}=Oy.withResolver(),h=()=>m(new Q_);if(a){let e=()=>m(new Z_({cause:a.reason}));if(a.aborted)return e(),Object.assign(f,{cancel:h});a.addEventListener(`abort`,e),o.add(()=>a.removeEventListener(`abort`,e))}o.add(gy((e,t)=>{m(new $_(`User force closed the prompt with ${e} ${t}`))}));let g=()=>m(new $_(`User force closed the prompt with SIGINT`));return l.on(`SIGINT`,g),o.add(()=>l.removeListener(`SIGINT`,g)),iv(l,a=>{let u=s.bind(()=>uv.clearAll());l.on(`close`,u),o.add(()=>l.removeListener(`close`,u));let g=()=>{let r=()=>d.checkCursorPos();l.input.on(`keypress`,r),o.add(()=>l.input.removeListener(`keypress`,r)),a(()=>{try{let r=e(n,e=>{setImmediate(()=>p(e))});if(r===void 0){let e=t[1]?.getFileName();throw Error(`Prompt functions must return a string.\n at ${e}`)}let[i,a]=typeof r==`string`?[r]:r;d.render(i,a),uv.run()}catch(e){m(e)}})};return`readableFlowing`in i?Ay(g):g(),Object.assign(f.then(e=>(uv.clearAll(),e),e=>{throw uv.clearAll(),e}).finally(()=>{o.forEach(e=>e()),d.done({clearContent:!!r.clearPromptOnDone}),c.end()}).then(()=>f),{cancel:h})})}}var $=class{separator=l(`dim`,Array.from({length:15}).join(vv.line));type=`separator`;constructor(e){e&&(this.separator=e)}static isSeparator(e){return!!(e&&typeof e==`object`&&`type`in e&&e.type===`separator`)}};const Ny={icon:{checked:l(`green`,vv.circleFilled),unchecked:vv.circle,cursor:vv.pointer,disabledChecked:l(`green`,vv.circleDouble),disabledUnchecked:`-`},style:{disabled:e=>l(`dim`,e),renderSelectedChoices:e=>e.map(e=>e.short).join(`, `),description:e=>l(`cyan`,e),keysHelpTip:e=>e.map(([e,t])=>`${l(`bold`,e)} ${l(`dim`,t)}`).join(l(`dim`,` • `))},i18n:{disabledError:`This option is disabled and cannot be toggled.`},keybindings:[]};function Py(e){return!$.isSeparator(e)&&!e.disabled}function Fy(e){return!$.isSeparator(e)}function Iy(e){return!$.isSeparator(e)&&e.checked}function Ly(e){return Py(e)?{...e,checked:!e.checked}:e}function Ry(e){return function(t){return Py(t)?{...t,checked:e}:t}}function zy(e){return e.map(e=>{if($.isSeparator(e))return e;if(typeof e==`string`)return{value:e,name:e,short:e,checkedName:e,disabled:!1,checked:!1};let t=e.name??String(e.value),n={value:e.value,name:t,short:e.short??t,checkedName:e.checkedName??t,disabled:e.disabled??!1,checked:e.checked??!1};return e.description&&(n.description=e.description),n})}var By=My((e,t)=>{let{pageSize:n=7,loop:r=!0,required:i,validate:a=()=>!0}=e,o={all:`a`,invert:`i`,...e.shortcuts},s=Sv(Ny,e.theme),{keybindings:c}=s,[l,u]=Q(`idle`),d=Cv({status:l,theme:s}),[f,p]=Q(zy(e.choices)),m=wv(()=>{let e=f.findIndex(Fy),t=f.findLastIndex(Fy);if(e===-1)throw new tv(`[checkbox prompt] No selectable choices. All choices are disabled.`);return{first:e,last:t}},[f]),[h,g]=Q(m.first),[_,v]=Q();Ev(async e=>{if(X_(e)){let e=f.filter(Iy),n=await a([...e]);i&&!e.length?v(`At least one choice must be selected`):n===!0?(u(`done`),t(e.map(e=>e.value))):v(n||`You must select a valid value`)}else if(W_(e,c)||G_(e,c)){if(_&&v(void 0),r||W_(e,c)&&h!==m.first||G_(e,c)&&h!==m.last){let t=W_(e,c)?-1:1,n=h;do n=(n+t+f.length)%f.length;while(!Fy(f[n]));g(n)}}else if(K_(e)){let e=f[h];e&&!$.isSeparator(e)&&(e.disabled?v(s.i18n.disabledError):(v(void 0),p(f.map((e,t)=>t===h?Ly(e):e))))}else if(e.name===o.all){let e=f.some(e=>Py(e)&&!e.checked);p(f.map(Ry(e)))}else if(e.name===o.invert)p(f.map(Ly));else if(Y_(e)){let t=Number(e.name)-1,n=-1,r=f.findIndex(e=>$.isSeparator(e)?!1:(n++,n===t)),i=f[r];i&&Py(i)&&(g(r),p(f.map((e,t)=>t===r?Ly(e):e)))}});let y=s.style.message(e.message,l),b,x=ry({items:f,active:h,renderItem({item:e,isActive:t}){if($.isSeparator(e))return` ${e.separator}`;let n=t?s.icon.cursor:` `;if(e.disabled){let t=typeof e.disabled==`string`?e.disabled:`(disabled)`,r=e.checked?s.icon.disabledChecked:s.icon.disabledUnchecked;return s.style.disabled(`${n}${r} ${e.name} ${t}`)}t&&(b=e.description);let r=e.checked?s.icon.checked:s.icon.unchecked,i=e.checked?e.checkedName:e.name;return(t?s.style.highlight:e=>e)(`${n}${r} ${i}`)},pageSize:n,loop:r});if(l===`done`){let e=f.filter(Iy);return[d,y,s.style.answer(s.style.renderSelectedChoices(e,f))].filter(Boolean).join(` `)}let S=[[`↑↓`,`navigate`],[`space`,`select`]];o.all&&S.push([o.all,`all`]),o.invert&&S.push([o.invert,`invert`]),S.push([`⏎`,`submit`]);let C=s.style.keysHelpTip(S);return`${[[d,y].filter(Boolean).join(` `),x,` `,b?s.style.description(b):``,_?s.style.error(_):``,C].filter(Boolean).join(`
202
202
  `).trimEnd()}${yy}`});const Vy={validationFailureMode:`keep`};var Hy=My((e,t)=>{let{prefill:n=`tab`}=e,r=Sv(Vy,e.theme),[i,a]=Q(`idle`),[o,s]=Q(String(e.default??``)),[c,l]=Q(),[u,d]=Q(``),f=Cv({status:i,theme:r});async function p(t){let{required:n,pattern:r,patternError:i=`Invalid input`}=e;return n&&!t?`You must provide a value`:r&&!r.test(t)?i:typeof e.validate==`function`?await e.validate(t)||`You must provide a valid value`:!0}Ev(async(e,n)=>{if(i===`idle`)if(X_(e)){let e=u||o;a(`loading`);let i=await p(e);i===!0?(d(e),a(`done`),t(e)):(r.validationFailureMode===`clear`?d(``):n.write(u),l(i),a(`idle`))}else q_(e)&&!u?s(``):J_(e)&&!u?(s(``),n.clearLine(0),n.write(o),d(o)):(d(n.line),l(void 0))}),dv(e=>{n===`editable`&&o&&(e.write(o),d(o))},[]);let m=r.style.message(e.message,i),h=u;typeof e.transformer==`function`?h=e.transformer(u,{isFinal:i===`done`}):i===`done`&&(h=r.style.answer(u));let g;o&&i!==`done`&&!u&&(g=r.style.defaultAnswer(o));let _=``;return c&&(_=r.style.error(c)),[[f,m,g,h].filter(e=>e!==void 0).join(` `),_]});const Uy={icon:{cursor:vv.pointer},style:{disabled:e=>l(`dim`,e),description:e=>l(`cyan`,e),keysHelpTip:e=>e.map(([e,t])=>`${l(`bold`,e)} ${l(`dim`,t)}`).join(l(`dim`,` • `))},i18n:{disabledError:`This option is disabled and cannot be selected.`},indexMode:`hidden`,keybindings:[]};function Wy(e){return!$.isSeparator(e)&&!e.disabled}function Gy(e){return!$.isSeparator(e)}function Ky(e){return e.map(e=>{if($.isSeparator(e))return e;if(typeof e!=`object`||!e||!(`value`in e)){let t=String(e);return{value:e,name:t,short:t,disabled:!1}}let t=e.name??String(e.value),n={value:e.value,name:t,short:e.short??t,disabled:e.disabled??!1};return e.description&&(n.description=e.description),n})}var qy=My((e,t)=>{let{loop:n=!0,pageSize:r=7}=e,i=Sv(Uy,e.theme),{keybindings:a}=i,[o,s]=Q(`idle`),c=Cv({status:o,theme:i}),l=Tv(),u=!a.includes(`vim`),d=wv(()=>Ky(e.choices),[e.choices]),f=wv(()=>{let e=d.findIndex(Gy),t=d.findLastIndex(Gy);if(e===-1)throw new tv(`[select prompt] No selectable choices. All choices are disabled.`);return{first:e,last:t}},[d]),p=wv(()=>`default`in e?d.findIndex(t=>Wy(t)&&t.value===e.default):-1,[e.default,d]),[m,h]=Q(p===-1?f.first:p),g=d[m],[_,v]=Q();Ev((e,r)=>{if(clearTimeout(l.current),_&&v(void 0),X_(e))g.disabled?v(i.i18n.disabledError):(s(`done`),t(g.value));else if(W_(e,a)||G_(e,a)){if(r.clearLine(0),n||W_(e,a)&&m!==f.first||G_(e,a)&&m!==f.last){let t=W_(e,a)?-1:1,n=m;do n=(n+t+d.length)%d.length;while(!Gy(d[n]));h(n)}}else if(Y_(e)&&!Number.isNaN(Number(r.line))){let e=Number(r.line)-1,t=-1,n=d.findIndex(n=>$.isSeparator(n)?!1:(t++,t===e)),i=d[n];i!=null&&Wy(i)&&h(n),l.current=setTimeout(()=>{r.clearLine(0)},700)}else if(q_(e))r.clearLine(0);else if(u){let e=r.line.toLowerCase(),t=d.findIndex(t=>$.isSeparator(t)||!Wy(t)?!1:t.name.toLowerCase().startsWith(e));t!==-1&&h(t),l.current=setTimeout(()=>{r.clearLine(0)},700)}}),dv(()=>()=>{clearTimeout(l.current)},[]);let y=i.style.message(e.message,o),b=i.style.keysHelpTip([[`↑↓`,`navigate`],[`⏎`,`select`]]),x=0,S=ry({items:d,active:m,renderItem({item:e,isActive:t,index:n}){if($.isSeparator(e))return x++,` ${e.separator}`;let r=t?i.icon.cursor:` `,a=i.indexMode===`number`?`${n+1-x}. `:``;if(e.disabled){let n=typeof e.disabled==`string`?e.disabled:`(disabled)`,r=t?i.icon.cursor:`-`;return i.style.disabled(`${r} ${a}${e.name} ${n}`)}return(t?i.style.highlight:e=>e)(`${r} ${a}${e.name}`)},pageSize:r,loop:n});if(o===`done`)return[c,y,i.style.answer(g.short)].filter(Boolean).join(` `);let{description:C}=g;return`${[[c,y].filter(Boolean).join(` `),S,` `,C?i.style.description(C):``,_?i.style.error(_):``,b].filter(Boolean).join(`
203
- `).trimEnd()}${yy}`}),Jy=class{static async getText(e){let{message:t,schema:n,default:r}=e,i;if(n&&r!==void 0){let e=n.safeParse(r);e.success&&(i=e.data)}else !n&&r!==void 0&&(i=r);if(n&&n instanceof Af)return await qy({message:t,choices:n.options.map(e=>({value:e})),default:i});let a=await Hy({message:t,default:i,validate:e=>{if(!n)return!0;let t=e;if(n instanceof Dd){if(e.trim()===``)return`Input cannot be empty`;let n=Number(e);if(Number.isNaN(n))return`Please enter a valid number`;t=n}let r=n.safeParse(t);return r.success?!0:r.error.issues[0]?.message??`Invalid input`}});if(!n)return a;let o=n instanceof Dd?Number(a):a;return n.parse(o)}static async choose(e){let{message:t,options:n,mode:r=`single`,default:i,includeAllOption:a=!1,required:o=!1}=e,s=`__all__`,c=r===`single`?[i]:[...i||[]],l=[...r===`multiple`&&a?[{name:`All`,value:s,checked:c.includes(s)}]:[],...n.map(e=>({name:e,value:e,checked:c.includes(e)}))];if(r===`multiple`){let e=await By({message:t,choices:l,validate:e=>o&&e.length===0?`You must select at least one option.`:!0});return a&&e.includes(s)?n:e}return await qy({message:t,choices:n.map(e=>({name:e,value:e})),default:typeof i==`string`?i:void 0})}},Yy=class e{static command=new hg(`init`).argument(`[projectName]`).option(`-d, --dir <path>`,`workspace directory`).option(`--with-vitest <boolean>`,`include vitest`,!0).option(`--with-eslint <boolean>`,`include eslint`,!0).action(e.run.bind(e));static async run(t,n){let r=await z_.getPackageList(),i=await e.getPrefs({projectName:t,options:n,projects:r.filter(e=>e.type===`apps`)}),a=await Promise.all(i.selectedProjects.map(async e=>({...e,packageJson:await z_.parsePackageJson({dir:e.path})}))),o=await Promise.all(r.filter(e=>e.type!==`apps`).map(async e=>({...e,packageJson:await z_.parsePackageJson({dir:e.path})}))),s=await this.getPackagesPrefs({apps:a,packages:o,tags:i.tags});await this.installWorkspace({name:i.projectName,tags:s.tags,dir:{workspace:i.workspace,template:i.template}});for(let e of[...s.selectedPackages,...a]){let t={};if(e.type===`apps`){let n=s.selectedPackages.filter(t=>e.packageJson?.startx?.tags?.every(e=>t.packageJson?.startx?.tags?.includes(e)));t=Object.fromEntries(n.map(e=>e.packageJson?.name).filter(e=>!!e).map(e=>[e,`workspace:^`]))}await this.installPackage({packages:e,directory:{workspace:i.workspace,template:i.template},tags:s.tags,dependencies:t})}}static async getPrefs(e){let n=new Map;(e.options.withEslint===`true`||e.options.withEslint===!0)&&n.set(`eslint`,`eslint`),(e.options.withVitest===`true`||e.options.withVitest===!0)&&n.set(`vitest`,`vitest`),e.projectName||=await Jy.getText({message:`Project naming`,name:`projectName`,schema:Gp.string().min(2).trim()});let r=z_.getDirectory(),i;if(e.options.dir)try{i=t.resolve(r.workspace,e.options.dir)}catch{throw Error(`Invalid template directory`)}else i=t.join(r.workspace,e.projectName);if(e.projects.length===0)throw Error(`No apps found`);let a=await Jy.choose({message:`Select apps to install`,options:e.projects.map(e=>e.name),includeAllOption:!0,mode:`multiple`,required:!0}),o=e.projects.filter(e=>a.includes(e.name));return await Jy.choose({message:`Select formatter`,options:[`prettier + biome`,`prettier`],mode:`single`,default:`prettier`,required:!0})===`prettier`||n.set(`biome`,`biome`),n.set(`prettier`,`prettier`),{projectName:e.projectName,workspace:i,template:r.template,selectedProjects:o,tags:Array.from(n.values())}}static async getPackagesPrefs(e){let t=new Set([`common`,...e.tags]);for(let n of e.apps){let e=n.packageJson?.startx?.tags;if(e?.length)for(let n of e)t.add(n)}let n=e.packages.filter(e=>{if(e.type!==`packages`)return!1;let n=e.packageJson?.startx?.tags;return n?.length?n.every(e=>t.has(e)):!0}),r=[];n.length&&(r=await Jy.choose({message:`Select packages to install`,options:n.map(e=>e.name),includeAllOption:!0,mode:`multiple`,required:!1}));let i=e.packages.filter(e=>{if(e.type!==`configs`)return!1;let n=e.packageJson?.startx?.tags;return n?.length?n.every(e=>t.has(e)):!0}),a=n.filter(e=>r.includes(e.name)),o=new Set;for(let n of[...a,...e.apps]){let r=n.packageJson?.startx?.requiredDeps||[],i=n.packageJson?.startx?.requiredDevDeps||[];if(r?.length||i?.length)for(let n of[...r,...i]){o.add(n);let r=e.packages.find(e=>e.name===n);r&&r.packageJson?.startx?.tags?.forEach(e=>t.add(e))}}let s=Array.from(new Set([...r,...o,...i.map(e=>e.name)])).map(t=>e.packages.find(e=>t===e.name));return o.size&&tg.warn(`Auto-including required packages: ${Array.from(o).join(`, `)}`),{tags:Array.from(t),selectedPackages:s}}static async installPackage(e){let{packageJson:n,isWorkspace:r}=U_.handlePackageJson({app:e.packages.packageJson,tags:e.tags,name:e.packages.name});if(r)throw Error(`Can't install workspace as package.`);let i=t.join(e.directory.workspace,e.packages.type),a=t.join(e.directory.template,e.packages.type);if(e.packages.packageJson?.name?.startsWith(`@repo`)){let n=e.packages.packageJson.name.split(`/`)[1];i=t.join(i,`@repo`,n),a=t.join(a,`@repo`,n)}else i=t.join(i,e.packages.name),a=t.join(a,e.packages.name);await I_.writeJSONFile({dir:i,file:`package`,content:n});let o=await I_.listFiles({dir:a});for(let n of o){let r=L_[n];if(!(r&&!r.tags.every(t=>e.tags.includes(t))))try{await I_.copyFile({from:t.join(a,n),to:t.join(i,n)})}catch(e){tg.error(`Failed to copy file ${n}:`,e)}}await I_.copyDirectory({from:t.join(a,`src`),to:t.join(i,`src`),exclude:e.tags.includes(`vitest`)?void 0:/\.test\.tsx?$/}),tg.info(`Successfully installed ${e.packages.name}`)}static async installWorkspace(e){e.tags.push(`root`);let n=await z_.parsePackageJson({dir:e.dir.template});if(!n)throw Error(`Failed to parse package.json`);let{packageJson:r}=U_.handlePackageJson({app:n,tags:e.tags,name:e.name});await I_.writeJSONFile({dir:e.dir.workspace,file:`package`,content:r});let i=await I_.listFiles({dir:e.dir.template});for(let n of i){let r=L_[n];if(!(r&&!r.tags.every(t=>e.tags.includes(t))))try{await I_.copyFile({from:t.join(e.dir.template,n),to:t.join(e.dir.workspace,n)})}catch(e){tg.error(`Failed to copy file ${n}:`,e)}}}},Xy=`0.1.0`;const Zy=new hg;Zy.name(`startx`).description(`StartX CLI - Your all in one monorepo startup tool.`).version(Xy),Zy.command(`ping`).action(()=>{tg.info(`pong`)}),Zy.addCommand(Yy.command),Zy.parse(process.argv);export{};
203
+ `).trimEnd()}${yy}`}),Jy=class{static async getText(e){let{message:t,schema:n,default:r}=e,i;if(n&&r!==void 0){let e=n.safeParse(r);e.success&&(i=e.data)}else !n&&r!==void 0&&(i=r);if(n&&n instanceof Af)return await qy({message:t,choices:n.options.map(e=>({value:e})),default:i});let a=await Hy({message:t,default:i,validate:e=>{if(!n)return!0;let t=e;if(n instanceof Dd){if(e.trim()===``)return`Input cannot be empty`;let n=Number(e);if(Number.isNaN(n))return`Please enter a valid number`;t=n}let r=n.safeParse(t);return r.success?!0:r.error.issues[0]?.message??`Invalid input`}});if(!n)return a;let o=n instanceof Dd?Number(a):a;return n.parse(o)}static async choose(e){let{message:t,options:n,mode:r=`single`,default:i,includeAllOption:a=!1,required:o=!1}=e,s=`__all__`,c=r===`single`?[i]:[...i||[]],l=[...r===`multiple`&&a?[{name:`All`,value:s,checked:c.includes(s)}]:[],...n.map(e=>({name:e,value:e,checked:c.includes(e)}))];if(r===`multiple`){let e=await By({message:t,choices:l,validate:e=>o&&e.length===0?`You must select at least one option.`:!0});return a&&e.includes(s)?n:e}return await qy({message:t,choices:n.map(e=>({name:e,value:e})),default:typeof i==`string`?i:void 0})}},Yy=class e{static command=new hg(`init`).argument(`[projectName]`).option(`-d, --dir <path>`,`workspace directory`).option(`--with-vitest <boolean>`,`include vitest`,!0).option(`--with-eslint <boolean>`,`include eslint`,!0).action(e.run.bind(e));static async run(t,n){let r=await z_.getPackageList(),i=await e.getPrefs({projectName:t,options:n,projects:r.filter(e=>e.type===`apps`)}),a=await Promise.all(i.selectedProjects.map(async e=>({...e,packageJson:await z_.parsePackageJson({dir:e.path})}))),o=await Promise.all(r.filter(e=>e.type!==`apps`).map(async e=>({...e,packageJson:await z_.parsePackageJson({dir:e.path})}))),s=await this.getPackagesPrefs({apps:a,packages:o,tags:i.tags});await this.installWorkspace({name:i.projectName,tags:s.tags,dir:{workspace:i.workspace,template:i.template}});for(let e of[...s.selectedPackages,...a]){let t={};if(e.type===`apps`){let n=s.selectedPackages.filter(t=>e.packageJson?.startx?.tags?.every(e=>t.packageJson?.startx?.tags?.includes(e)));t=Object.fromEntries(n.map(e=>e.packageJson?.name).filter(e=>!!e).map(e=>[e,`workspace:^`]))}await this.installPackage({packages:e,directory:{workspace:i.workspace,template:i.template},tags:s.tags,dependencies:t})}}static async getPrefs(e){let n=new Map;(e.options.withEslint===`true`||e.options.withEslint===!0)&&n.set(`eslint`,`eslint`),(e.options.withVitest===`true`||e.options.withVitest===!0)&&n.set(`vitest`,`vitest`),e.projectName||=await Jy.getText({message:`Project naming`,name:`projectName`,schema:Gp.string().min(2).trim()});let r=z_.getDirectory(),i;if(e.options.dir)try{i=t.resolve(r.workspace,e.options.dir)}catch{throw Error(`Invalid template directory`)}else i=t.join(r.workspace,e.projectName);if(e.projects.length===0)throw Error(`No apps found`);let a=await Jy.choose({message:`Select apps to install`,options:e.projects.map(e=>e.name),includeAllOption:!0,mode:`multiple`,required:!0}),o=e.projects.filter(e=>a.includes(e.name));return await Jy.choose({message:`Select formatter`,options:[`prettier + biome`,`prettier`],mode:`single`,default:`prettier`,required:!0})===`prettier`||n.set(`biome`,`biome`),n.set(`prettier`,`prettier`),{projectName:e.projectName,workspace:i,template:r.template,selectedProjects:o,tags:Array.from(n.values())}}static async getPackagesPrefs(e){let t=new Set([`common`,...e.tags]);for(let n of e.apps){let e=n.packageJson?.startx?.tags;if(e?.length)for(let n of e)t.add(n)}let n=e.packages.filter(e=>{if(e.type!==`packages`)return!1;let n=e.packageJson?.startx?.tags;return n?.length?n.every(e=>t.has(e)):!0}),r=[];n.length&&(r=await Jy.choose({message:`Select packages to install`,options:n.map(e=>e.name),includeAllOption:!0,mode:`multiple`,required:!1}));let i=e.packages.filter(e=>{if(e.type!==`configs`)return!1;let n=e.packageJson?.startx?.tags;return n?.length?n.every(e=>t.has(e)):!0}),a=n.filter(e=>r.includes(e.name)),o=new Set;for(let n of[...a,...e.apps]){let r=n.packageJson?.startx?.requiredDeps||[],i=n.packageJson?.startx?.requiredDevDeps||[];if(r?.length||i?.length)for(let n of[...r,...i]){o.add(n);let r=e.packages.find(e=>e.name===n);r&&r.packageJson?.startx?.tags?.forEach(e=>t.add(e))}}let s=Array.from(new Set([...r,...o,...i.map(e=>e.name)])).map(t=>e.packages.find(e=>t===e.name));return o.size&&tg.warn(`Auto-including required packages: ${Array.from(o).join(`, `)}`),{tags:Array.from(t),selectedPackages:s}}static async installPackage(e){let{packageJson:n,isWorkspace:r}=U_.handlePackageJson({app:e.packages.packageJson,tags:e.tags,name:e.packages.name});if(r)throw Error(`Can't install workspace as package.`);let i=t.join(e.directory.workspace,e.packages.type),a=t.join(e.directory.template,e.packages.type);if(e.packages.packageJson?.name?.startsWith(`@repo`)){let n=e.packages.packageJson.name.split(`/`)[1];i=t.join(i,`@repo`,n),a=t.join(a,`@repo`,n)}else i=t.join(i,e.packages.name),a=t.join(a,e.packages.name);await I_.writeJSONFile({dir:i,file:`package`,content:n});let o=await I_.listFiles({dir:a});for(let n of o){let r=L_[n];if(!(r&&!r.tags.every(t=>e.tags.includes(t))))try{await I_.copyFile({from:t.join(a,n),to:t.join(i,n)})}catch(e){tg.error(`Failed to copy file ${n}:`,e)}}await I_.copyDirectory({from:t.join(a,`src`),to:t.join(i,`src`),exclude:e.tags.includes(`vitest`)?void 0:/\.test\.tsx?$/}),tg.info(`Successfully installed ${e.packages.name}`)}static async installWorkspace(e){e.tags.push(`root`);let n=await z_.parsePackageJson({dir:e.dir.template}),r=await z_.parsePackageJson({dir:e.dir.template,file:`startx`});if(!n)throw Error(`Failed to parse package.json`);n.dependencies=r?.dependencies||{},n.devDependencies=r?.devDependencies||{};let{packageJson:i}=U_.handlePackageJson({app:n,tags:e.tags,name:e.name});await I_.writeJSONFile({dir:e.dir.workspace,file:`package`,content:i});let a=await I_.listFiles({dir:e.dir.template});for(let n of a){let r=L_[n];if(!(r&&!r.tags.every(t=>e.tags.includes(t))))try{await I_.copyFile({from:t.join(e.dir.template,n),to:t.join(e.dir.workspace,n)})}catch(e){tg.error(`Failed to copy file ${n}:`,e)}}}},Xy=`0.1.3`;const Zy=new hg;Zy.name(`startx`).description(`StartX CLI - Your all in one monorepo startup tool.`).version(Xy),Zy.command(`ping`).action(()=>{tg.info(`pong`)}),Zy.addCommand(Yy.command),Zy.parse(process.argv);export{};
package/startx.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "startx",
3
+ "devDependencies": {
4
+ "@biomejs/biome": "catalog:",
5
+ "prettier": "catalog:",
6
+ "rimraf": "catalog:",
7
+ "turbo": "catalog:",
8
+ "typescript": "catalog:",
9
+ "tsdown": "catalog:",
10
+ "unrun": "catalog:",
11
+ "vitest": "catalog:",
12
+ "tsx": "catalog:",
13
+ "@types/node": "catalog:"
14
+ },
15
+ "dependencies": {
16
+ "zod": "catalog:",
17
+ "@vinejs/vine": "catalog:",
18
+ "axios": "catalog:",
19
+ "date-fns": "catalog:",
20
+ "nanoid": "catalog:"
21
+ }
22
+ }