@ooneex/cli 1.1.4 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,38 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var m=function(r,e,t,o){var s=arguments.length,i=s<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,a;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")i=Reflect.decorate(r,e,t,o);else for(var n=r.length-1;n>=0;n--)if(a=r[n])i=(s<3?a(i):s>3?a(e,t,i):a(e,t))||i;return s>3&&i&&Object.defineProperty(e,t,i),i};import{parseArgs as Ys}from"util";import{TerminalLogger as Vs}from"@ooneex/logger";import{container as oo}from"@ooneex/container";var H=[];var ve=(r)=>{let e=null;return H.find((t)=>{return e=oo.get(t),e.getName()===r}),e};import{join as O}from"path";import{TerminalLogger as uo}from"@ooneex/logger";import{toPascalCase as yo}from"@ooneex/utils";import{container as ro,EContainerScope as so}from"@ooneex/container";var u={command:(r=so.Singleton)=>{return(e)=>{ro.add(e,r),H.push(e)}}};import{prompt as po}from"enquirer";import{Assert as io,Validation as no}from"@ooneex/validation";var ao=1,co=/^[a-zA-Z0-9]+$/;class ye extends no{getConstraint(){return io(`string >= ${ao}`)}getErrorMessage(){return"Name must contain only letters, and numbers"}validate(r,e){let t=super.validate(r,e);if(!t.isValid)return t;let o=r;if(!co.test(o))return{isValid:!1,message:this.getErrorMessage()||"Invalid name format"};return{isValid:!0}}}var y=async(r)=>{return(await po({type:"input",name:"name",message:r.message,validate:(t)=>{let s=new ye().validate(t);if(!s.isValid)return s.message||"Controller name is invalid";return!0}})).name};var we=`import { describe, expect, test } from "bun:test";
3
+ var Ro=Object.create;var{getPrototypeOf:Bo,defineProperty:Bt,getOwnPropertyNames:Do}=Object;var Oo=Object.prototype.hasOwnProperty;function Po(e){return this[e]}var Io,Lo,Y=(e,t,s)=>{var r=e!=null&&typeof e==="object";if(r){var i=t?Io??=new WeakMap:Lo??=new WeakMap,o=i.get(e);if(o)return o}s=e!=null?Ro(Bo(e)):{};let n=t||!e||!e.__esModule?Bt(s,"default",{value:e,enumerable:!0}):s;for(let a of Do(e))if(!Oo.call(n,a))Bt(n,a,{get:Po.bind(e,a),enumerable:!0});if(r)i.set(e,n);return n};var g=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var A=function(e,t,s,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,s):r,n;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")o=Reflect.decorate(e,t,s,r);else for(var a=e.length-1;a>=0;a--)if(n=e[a])o=(i<3?n(o):i>3?n(t,s,o):n(t,s))||o;return i>3&&o&&Object.defineProperty(t,s,o),o};var he=import.meta.require;var Lt=g((Tu,fe)=>{var Go=typeof process<"u"&&process.env.TERM_PROGRAM==="Hyper",Ko=typeof process<"u"&&process.platform==="win32",Ot=typeof process<"u"&&process.platform==="linux",je={ballotDisabled:"\u2612",ballotOff:"\u2610",ballotOn:"\u2611",bullet:"\u2022",bulletWhite:"\u25E6",fullBlock:"\u2588",heart:"\u2764",identicalTo:"\u2261",line:"\u2500",mark:"\u203B",middot:"\xB7",minus:"\uFF0D",multiplication:"\xD7",obelus:"\xF7",pencilDownRight:"\u270E",pencilRight:"\u270F",pencilUpRight:"\u2710",percent:"%",pilcrow2:"\u2761",pilcrow:"\xB6",plusMinus:"\xB1",question:"?",section:"\xA7",starsOff:"\u2606",starsOn:"\u2605",upDownArrow:"\u2195"},Pt=Object.assign({},je,{check:"\u221A",cross:"\xD7",ellipsisLarge:"...",ellipsis:"...",info:"i",questionSmall:"?",pointer:">",pointerSmall:"\xBB",radioOff:"( )",radioOn:"(*)",warning:"\u203C"}),It=Object.assign({},je,{ballotCross:"\u2718",check:"\u2714",cross:"\u2716",ellipsisLarge:"\u22EF",ellipsis:"\u2026",info:"\u2139",questionFull:"\uFF1F",questionSmall:"\uFE56",pointer:Ot?"\u25B8":"\u276F",pointerSmall:Ot?"\u2023":"\u203A",radioOff:"\u25EF",radioOn:"\u25C9",warning:"\u26A0"});fe.exports=Ko&&!Go?Pt:It;Reflect.defineProperty(fe.exports,"common",{enumerable:!1,value:je});Reflect.defineProperty(fe.exports,"windows",{enumerable:!1,value:Pt});Reflect.defineProperty(fe.exports,"other",{enumerable:!1,value:It})});var we=g((_u,ke)=>{var Wo=(e)=>e!==null&&typeof e==="object"&&!Array.isArray(e),Ho=/[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g,Yo=()=>{if(typeof process<"u")return process.env.FORCE_COLOR!=="0";return!1},$t=()=>{let e={enabled:Yo(),visible:!0,styles:{},keys:{}},t=(o)=>{let n=o.open=`\x1B[${o.codes[0]}m`,a=o.close=`\x1B[${o.codes[1]}m`,p=o.regex=new RegExp(`\\u001b\\[${o.codes[1]}m`,"g");return o.wrap=(l,u)=>{if(l.includes(a))l=l.replace(p,a+n);let c=n+l+a;return u?c.replace(/\r*\n/g,`${a}$&${n}`):c},o},s=(o,n,a)=>{return typeof o==="function"?o(n):o.wrap(n,a)},r=(o,n)=>{if(o===""||o==null)return"";if(e.enabled===!1)return o;if(e.visible===!1)return"";let a=""+o,p=a.includes(`
4
+ `),l=n.length;if(l>0&&n.includes("unstyle"))n=[...new Set(["unstyle",...n])].reverse();while(l-- >0)a=s(e.styles[n[l]],a,p);return a},i=(o,n,a)=>{e.styles[o]=t({name:o,codes:n}),(e.keys[a]||(e.keys[a]=[])).push(o),Reflect.defineProperty(e,o,{configurable:!0,enumerable:!0,set(l){e.alias(o,l)},get(){let l=(u)=>r(u,l.stack);return Reflect.setPrototypeOf(l,e),l.stack=this.stack?this.stack.concat(o):[o],l}})};return i("reset",[0,0],"modifier"),i("bold",[1,22],"modifier"),i("dim",[2,22],"modifier"),i("italic",[3,23],"modifier"),i("underline",[4,24],"modifier"),i("inverse",[7,27],"modifier"),i("hidden",[8,28],"modifier"),i("strikethrough",[9,29],"modifier"),i("black",[30,39],"color"),i("red",[31,39],"color"),i("green",[32,39],"color"),i("yellow",[33,39],"color"),i("blue",[34,39],"color"),i("magenta",[35,39],"color"),i("cyan",[36,39],"color"),i("white",[37,39],"color"),i("gray",[90,39],"color"),i("grey",[90,39],"color"),i("bgBlack",[40,49],"bg"),i("bgRed",[41,49],"bg"),i("bgGreen",[42,49],"bg"),i("bgYellow",[43,49],"bg"),i("bgBlue",[44,49],"bg"),i("bgMagenta",[45,49],"bg"),i("bgCyan",[46,49],"bg"),i("bgWhite",[47,49],"bg"),i("blackBright",[90,39],"bright"),i("redBright",[91,39],"bright"),i("greenBright",[92,39],"bright"),i("yellowBright",[93,39],"bright"),i("blueBright",[94,39],"bright"),i("magentaBright",[95,39],"bright"),i("cyanBright",[96,39],"bright"),i("whiteBright",[97,39],"bright"),i("bgBlackBright",[100,49],"bgBright"),i("bgRedBright",[101,49],"bgBright"),i("bgGreenBright",[102,49],"bgBright"),i("bgYellowBright",[103,49],"bgBright"),i("bgBlueBright",[104,49],"bgBright"),i("bgMagentaBright",[105,49],"bgBright"),i("bgCyanBright",[106,49],"bgBright"),i("bgWhiteBright",[107,49],"bgBright"),e.ansiRegex=Ho,e.hasColor=e.hasAnsi=(o)=>{return e.ansiRegex.lastIndex=0,typeof o==="string"&&o!==""&&e.ansiRegex.test(o)},e.alias=(o,n)=>{let a=typeof n==="string"?e[n]:n;if(typeof a!=="function")throw TypeError("Expected alias to be the name of an existing color (string) or a function");if(!a.stack)Reflect.defineProperty(a,"name",{value:o}),e.styles[o]=a,a.stack=[o];Reflect.defineProperty(e,o,{configurable:!0,enumerable:!0,set(p){e.alias(o,p)},get(){let p=(l)=>r(l,p.stack);return Reflect.setPrototypeOf(p,e),p.stack=this.stack?this.stack.concat(a.stack):a.stack,p}})},e.theme=(o)=>{if(!Wo(o))throw TypeError("Expected theme to be an object");for(let n of Object.keys(o))e.alias(n,o[n]);return e},e.alias("unstyle",(o)=>{if(typeof o==="string"&&o!=="")return e.ansiRegex.lastIndex=0,o.replace(e.ansiRegex,"");return""}),e.alias("noop",(o)=>o),e.none=e.clear=e.noop,e.stripColor=e.unstyle,e.symbols=Lt(),e.define=i,e};ke.exports=$t();ke.exports.create=$t});var C=g((Fo)=>{var Vo=Object.prototype.toString,P=we(),Ut=!1,ye=new Set,qt={yellow:"blue",cyan:"red",green:"magenta",black:"white",blue:"yellow",red:"cyan",magenta:"green",white:"black"};Fo.longest=(e,t)=>{return e.reduce((s,r)=>Math.max(s,t?r[t].length:r.length),0)};Fo.hasColor=(e)=>!!e&&P.hasColor(e);var Se=Fo.isObject=(e)=>{return e!==null&&typeof e==="object"&&!Array.isArray(e)};Fo.nativeType=(e)=>{return Vo.call(e).slice(8,-1).toLowerCase().replace(/\s/g,"")};Fo.isAsyncFn=(e)=>{return Fo.nativeType(e)==="asyncfunction"};Fo.isPrimitive=(e)=>{return e!=null&&typeof e!=="object"&&typeof e!=="function"};Fo.resolve=(e,t,...s)=>{if(typeof t==="function")return t.call(e,...s);return t};Fo.scrollDown=(e=[])=>[...e.slice(1),e[0]];Fo.scrollUp=(e=[])=>[e.pop(),...e];Fo.reorder=(e=[])=>{let t=e.slice();return t.sort((s,r)=>{if(s.index>r.index)return 1;if(s.index<r.index)return-1;return 0}),t};Fo.swap=(e,t,s)=>{let r=e.length,i=s===r?0:s<0?r-1:s,o=e[t];e[t]=e[i],e[i]=o};Fo.width=(e,t=80)=>{let s=e&&e.columns?e.columns:t;if(e&&typeof e.getWindowSize==="function")s=e.getWindowSize()[0];if(process.platform==="win32")return s-1;return s};Fo.height=(e,t=20)=>{let s=e&&e.rows?e.rows:t;if(e&&typeof e.getWindowSize==="function")s=e.getWindowSize()[1];return s};Fo.wordWrap=(e,t={})=>{if(!e)return e;if(typeof t==="number")t={width:t};let{indent:s="",newline:r=`
5
+ `+s,width:i=80}=t,o=(r+s).match(/[^\S\n]/g)||[];i-=o.length;let n=`.{1,${i}}([\\s\\u200B]+|$)|[^\\s\\u200B]+?([\\s\\u200B]+|$)`,a=e.trim(),p=new RegExp(n,"g"),l=a.match(p)||[];if(l=l.map((u)=>u.replace(/\n$/,"")),t.padEnd)l=l.map((u)=>u.padEnd(i," "));if(t.padStart)l=l.map((u)=>u.padStart(i," "));return s+l.join(r)};Fo.unmute=(e)=>{let t=e.stack.find((r)=>P.keys.color.includes(r));if(t)return P[t];if(e.stack.find((r)=>r.slice(2)==="bg"))return P[t.slice(2)];return(r)=>r};Fo.pascal=(e)=>e?e[0].toUpperCase()+e.slice(1):"";Fo.inverse=(e)=>{if(!e||!e.stack)return e;let t=e.stack.find((r)=>P.keys.color.includes(r));if(t){let r=P["bg"+Fo.pascal(t)];return r?r.black:e}let s=e.stack.find((r)=>r.slice(0,2)==="bg");if(s)return P[s.slice(2).toLowerCase()]||e;return P.none};Fo.complement=(e)=>{if(!e||!e.stack)return e;let t=e.stack.find((r)=>P.keys.color.includes(r)),s=e.stack.find((r)=>r.slice(0,2)==="bg");if(t&&!s)return P[qt[t]||t];if(s){let r=s.slice(2).toLowerCase(),i=qt[r];if(!i)return e;return P["bg"+Fo.pascal(i)]||e}return P.none};Fo.meridiem=(e)=>{let t=e.getHours(),s=e.getMinutes(),r=t>=12?"pm":"am";t=t%12;let i=t===0?12:t,o=s<10?"0"+s:s;return i+":"+o+" "+r};Fo.set=(e={},t="",s)=>{return t.split(".").reduce((r,i,o,n)=>{let a=n.length-1>o?r[i]||{}:s;if(!Fo.isObject(a)&&o<n.length-1)a={};return r[i]=a},e)};Fo.get=(e={},t="",s)=>{let r=e[t]==null?t.split(".").reduce((i,o)=>i&&i[o],e):e[t];return r==null?s:r};Fo.mixin=(e,t)=>{if(!Se(e))return t;if(!Se(t))return e;for(let s of Object.keys(t)){let r=Object.getOwnPropertyDescriptor(t,s);if(hasOwnProperty.call(r,"value"))if(hasOwnProperty.call(e,s)&&Se(r.value)){let i=Object.getOwnPropertyDescriptor(e,s);if(Se(i.value)&&i.value!==r.value)e[s]=Fo.merge({},e[s],t[s]);else Reflect.defineProperty(e,s,r)}else Reflect.defineProperty(e,s,r);else Reflect.defineProperty(e,s,r)}return e};Fo.merge=(...e)=>{let t={};for(let s of e)Fo.mixin(t,s);return t};Fo.mixinEmitter=(e,t)=>{let s=t.constructor.prototype;for(let r of Object.keys(s)){let i=s[r];if(typeof i==="function")Fo.define(e,r,i.bind(t));else Fo.define(e,r,i)}};var Ne=(e,t)=>{if(Ut)return;if(Ut=!0,ye.forEach((s)=>s()),e===!0)process.exit(128+t)},Gt=Ne.bind(null,!0,15),Kt=Ne.bind(null,!0,2);Fo.onExit=(e)=>{if(ye.size===0)process.once("SIGTERM",Gt),process.once("SIGINT",Kt),process.once("exit",Ne);return ye.add(e),()=>{if(ye.delete(e),ye.size===0)process.off("SIGTERM",Gt),process.off("SIGINT",Kt),process.off("exit",Ne)}};Fo.define=(e,t,s)=>{Reflect.defineProperty(e,t,{value:s})};Fo.defineExport=(e,t,s)=>{let r;Reflect.defineProperty(e,t,{enumerable:!0,configurable:!0,set(i){r=i},get(){return r?r():s()}})}});var Ft=g((Cu,Vt)=>{Vt.exports=({onlyFirst:e=!1}={})=>{let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}});var V=g((Ru,Qt)=>{var gn=Ft();Qt.exports=(e)=>typeof e==="string"?e.replace(gn(),""):e});var Zt=g((En)=>{En.ctrl={a:"first",b:"backward",c:"cancel",d:"deleteForward",e:"last",f:"forward",g:"reset",i:"tab",k:"cutForward",l:"reset",n:"newItem",m:"cancel",j:"submit",p:"search",r:"remove",s:"save",u:"undo",w:"cutLeft",x:"toggleCursor",v:"paste"};En.shift={up:"shiftUp",down:"shiftDown",left:"shiftLeft",right:"shiftRight",tab:"prev"};En.fn={up:"pageUp",down:"pageDown",left:"pageLeft",right:"pageRight",delete:"deleteForward"};En.option={b:"backward",f:"forward",d:"cutRight",left:"cutLeft",up:"altUp",down:"altDown"};En.keys={pageup:"pageUp",pagedown:"pageDown",home:"home",end:"end",cancel:"cancel",delete:"deleteForward",backspace:"delete",down:"down",enter:"submit",escape:"cancel",left:"left",space:"space",number:"number",return:"submit",right:"right",tab:"next",up:"up"}});var Xt=g((Du,zt)=>{zt.exports=class{_queue=[];_executing=!1;_jobRunner=null;constructor(t){this._jobRunner=t}enqueue=(...t)=>{this._queue.push(t),this._dequeue()};destroy(){this._queue.length=0,this._jobRunner=null}_dequeue(){if(this._executing||!this._queue.length)return;this._executing=!0,this._jobRunner(...this._queue.shift()),setTimeout(()=>{this._executing=!1,this._dequeue()})}}});var tt=g((Ou,jt)=>{var Jt=he("readline"),Nn=Zt(),Mn=Xt(),Tn=/^(?:\x1b)([a-zA-Z0-9])$/,_n=/^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/,vn={OP:"f1",OQ:"f2",OR:"f3",OS:"f4","[11~":"f1","[12~":"f2","[13~":"f3","[14~":"f4","[[A":"f1","[[B":"f2","[[C":"f3","[[D":"f4","[[E":"f5","[15~":"f5","[17~":"f6","[18~":"f7","[19~":"f8","[20~":"f9","[21~":"f10","[23~":"f11","[24~":"f12","[A":"up","[B":"down","[C":"right","[D":"left","[E":"clear","[F":"end","[H":"home",OA:"up",OB:"down",OC:"right",OD:"left",OE:"clear",OF:"end",OH:"home","[1~":"home","[2~":"insert","[3~":"delete","[4~":"end","[5~":"pageup","[6~":"pagedown","[[5~":"pageup","[[6~":"pagedown","[7~":"home","[8~":"end","[a":"up","[b":"down","[c":"right","[d":"left","[e":"clear","[2$":"insert","[3$":"delete","[5$":"pageup","[6$":"pagedown","[7$":"home","[8$":"end",Oa:"up",Ob:"down",Oc:"right",Od:"left",Oe:"clear","[2^":"insert","[3^":"delete","[5^":"pageup","[6^":"pagedown","[7^":"home","[8^":"end","[Z":"tab"};function Cn(e){return["[a","[b","[c","[d","[e","[2$","[3$","[5$","[6$","[7$","[8$","[Z"].includes(e)}function Rn(e){return["Oa","Ob","Oc","Od","Oe","[2^","[3^","[5^","[6^","[7^","[8^"].includes(e)}var Me=(e="",t={})=>{let s,r={name:t.name,ctrl:!1,meta:!1,shift:!1,option:!1,sequence:e,raw:e,...t};if(Buffer.isBuffer(e))if(e[0]>127&&e[1]===void 0)e[0]-=128,e="\x1B"+String(e);else e=String(e);else if(e!==void 0&&typeof e!=="string")e=String(e);else if(!e)e=r.sequence||"";if(r.sequence=r.sequence||e||r.name,e==="\r")r.raw=void 0,r.name="return";else if(e===`
6
+ `)r.name="enter";else if(e==="\t")r.name="tab";else if(e==="\b"||e==="\x7F"||e==="\x1B\x7F"||e==="\x1B\b")r.name="backspace",r.meta=e.charAt(0)==="\x1B";else if(e==="\x1B"||e==="\x1B\x1B")r.name="escape",r.meta=e.length===2;else if(e===" "||e==="\x1B ")r.name="space",r.meta=e.length===2;else if(e<="\x1A")r.name=String.fromCharCode(e.charCodeAt(0)+97-1),r.ctrl=!0;else if(e.length===1&&e>="0"&&e<="9")r.name="number";else if(e.length===1&&e>="a"&&e<="z")r.name=e;else if(e.length===1&&e>="A"&&e<="Z")r.name=e.toLowerCase(),r.shift=!0;else if(s=Tn.exec(e))r.meta=!0,r.shift=/^[A-Z]$/.test(s[1]);else if(s=_n.exec(e)){let i=[...e];if(i[0]==="\x1B"&&i[1]==="\x1B")r.option=!0;let o=[s[1],s[2],s[4],s[6]].filter(Boolean).join(""),n=(s[3]||s[5]||1)-1;r.ctrl=!!(n&4),r.meta=!!(n&10),r.shift=!!(n&1),r.code=o,r.name=vn[o],r.shift=Cn(o)||r.shift,r.ctrl=Rn(o)||r.ctrl}return r};Me.listen=(e={},t)=>{let{stdin:s}=e;if(!s||s!==process.stdin&&!s.isTTY)throw Error("Invalid stream passed");let r=Jt.createInterface({terminal:!0,input:s});Jt.emitKeypressEvents(s,r);let i=new Mn((a,p)=>t(a,Me(a,p),r)),o=s.isRaw;if(s.isTTY)s.setRawMode(!0);return s.on("keypress",i.enqueue),r.resume(),()=>{if(s.isTTY)s.setRawMode(o);s.removeListener("keypress",i.enqueue),i.destroy(),r.pause(),r.close()}};Me.action=(e,t,s)=>{let r={...Nn,...s};if(t.ctrl)return t.action=r.ctrl[t.name],t;if(t.option&&r.option)return t.action=r.option[t.name],t;if(t.shift)return t.action=r.shift[t.name],t;return t.action=r.keys[t.name],t};jt.exports=Me});var es=g((Pu,kt)=>{kt.exports=(e)=>{e.timers=e.timers||{};let t=e.options.timers;if(!t)return;for(let s of Object.keys(t)){let r=t[s];if(typeof r==="number")r={interval:r};Bn(e,s,r)}};function Bn(e,t,s={}){let r=e.timers[t]={name:t,start:Date.now(),ms:0,tick:0},i=s.interval||120;r.frames=s.frames||[],r.loading=!0;let o=setInterval(()=>{r.ms=Date.now()-r.start,r.tick++,e.render()},i);return r.stop=()=>{r.loading=!1,clearInterval(o)},Reflect.defineProperty(r,"interval",{value:o}),e.once("close",()=>r.stop()),r.stop}});var rs=g((Iu,ss)=>{var{define:Dn,width:On}=C();class ts{constructor(e){let t=e.options;Dn(this,"_prompt",e),this.type=e.type,this.name=e.name,this.message="",this.header="",this.footer="",this.error="",this.hint="",this.input="",this.cursor=0,this.index=0,this.lines=0,this.tick=0,this.prompt="",this.buffer="",this.width=On(t.stdout||process.stdout),Object.assign(this,t),this.name=this.name||this.message,this.message=this.message||this.name,this.symbols=e.symbols,this.styles=e.styles,this.required=new Set,this.cancelled=!1,this.submitted=!1}clone(){let e={...this};return e.status=this.status,e.buffer=Buffer.from(e.buffer),delete e.clone,e}set color(e){this._color=e}get color(){let e=this.prompt.styles;if(this.cancelled)return e.cancelled;if(this.submitted)return e.submitted;let t=this._color||e[this.status];return typeof t==="function"?t:e.pending}set loading(e){this._loading=e}get loading(){if(typeof this._loading==="boolean")return this._loading;if(this.loadingChoices)return"choices";return!1}get status(){if(this.cancelled)return"cancelled";if(this.submitted)return"submitted";return"pending"}}ss.exports=ts});var os=g((Lu,is)=>{var st=C(),_=we(),rt={default:_.noop,noop:_.noop,set inverse(e){this._inverse=e},get inverse(){return this._inverse||st.inverse(this.primary)},set complement(e){this._complement=e},get complement(){return this._complement||st.complement(this.primary)},primary:_.cyan,success:_.green,danger:_.magenta,strong:_.bold,warning:_.yellow,muted:_.dim,disabled:_.gray,dark:_.dim.gray,underline:_.underline,set info(e){this._info=e},get info(){return this._info||this.primary},set em(e){this._em=e},get em(){return this._em||this.primary.underline},set heading(e){this._heading=e},get heading(){return this._heading||this.muted.underline},set pending(e){this._pending=e},get pending(){return this._pending||this.primary},set submitted(e){this._submitted=e},get submitted(){return this._submitted||this.success},set cancelled(e){this._cancelled=e},get cancelled(){return this._cancelled||this.danger},set typing(e){this._typing=e},get typing(){return this._typing||this.dim},set placeholder(e){this._placeholder=e},get placeholder(){return this._placeholder||this.primary.dim},set highlight(e){this._highlight=e},get highlight(){return this._highlight||this.inverse}};rt.merge=(e={})=>{if(e.styles&&typeof e.styles.enabled==="boolean")_.enabled=e.styles.enabled;if(e.styles&&typeof e.styles.visible==="boolean")_.visible=e.styles.visible;let t=st.merge({},rt,e.styles);delete t.merge;for(let s of Object.keys(_))if(!hasOwnProperty.call(t,s))Reflect.defineProperty(t,s,{get:()=>_[s]});for(let s of Object.keys(_.styles))if(!hasOwnProperty.call(t,s))Reflect.defineProperty(t,s,{get:()=>_[s]});return t};is.exports=rt});var as=g(($u,ns)=>{var it=process.platform==="win32",U=we(),Pn=C(),ot={...U.symbols,upDownDoubleArrow:"\u21D5",upDownDoubleArrow2:"\u2B0D",upDownArrow:"\u2195",asterisk:"*",asterism:"\u2042",bulletWhite:"\u25E6",electricArrow:"\u2301",ellipsisLarge:"\u22EF",ellipsisSmall:"\u2026",fullBlock:"\u2588",identicalTo:"\u2261",indicator:U.symbols.check,leftAngle:"\u2039",mark:"\u203B",minus:"\u2212",multiplication:"\xD7",obelus:"\xF7",percent:"%",pilcrow:"\xB6",pilcrow2:"\u2761",pencilUpRight:"\u2710",pencilDownRight:"\u270E",pencilRight:"\u270F",plus:"+",plusMinus:"\xB1",pointRight:"\u261E",rightAngle:"\u203A",section:"\xA7",hexagon:{off:"\u2B21",on:"\u2B22",disabled:"\u2B22"},ballot:{on:"\u2611",off:"\u2610",disabled:"\u2612"},stars:{on:"\u2605",off:"\u2606",disabled:"\u2606"},folder:{on:"\u25BC",off:"\u25B6",disabled:"\u25B6"},prefix:{pending:U.symbols.question,submitted:U.symbols.check,cancelled:U.symbols.cross},separator:{pending:U.symbols.pointerSmall,submitted:U.symbols.middot,cancelled:U.symbols.middot},radio:{off:it?"( )":"\u25EF",on:it?"(*)":"\u25C9",disabled:it?"(|)":"\u24BE"},numbers:["\u24EA","\u2460","\u2461","\u2462","\u2463","\u2464","\u2465","\u2466","\u2467","\u2468","\u2469","\u246A","\u246B","\u246C","\u246D","\u246E","\u246F","\u2470","\u2471","\u2472","\u2473","\u3251","\u3252","\u3253","\u3254","\u3255","\u3256","\u3257","\u3258","\u3259","\u325A","\u325B","\u325C","\u325D","\u325E","\u325F","\u32B1","\u32B2","\u32B3","\u32B4","\u32B5","\u32B6","\u32B7","\u32B8","\u32B9","\u32BA","\u32BB","\u32BC","\u32BD","\u32BE","\u32BF"]};ot.merge=(e)=>{let t=Pn.merge({},U.symbols,ot,e.symbols);return delete t.merge,t};ns.exports=ot});var ls=g((Uu,ps)=>{var In=os(),Ln=as(),$n=C();ps.exports=(e)=>{e.options=$n.merge({},e.options.theme,e.options),e.symbols=Ln.merge(e.options),e.styles=In.merge(e.options)}});var ms=g((ds,cs)=>{var us=process.env.TERM_PROGRAM==="Apple_Terminal",Un=V(),nt=C(),L=cs.exports=ds,at=!1,F=L.code={bell:"\x07",beep:"\x07",beginning:"\x1B[G",down:"\x1B[J",esc:"\x1B[",getPosition:"\x1B[6n",hide:"\x1B[?25l",line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",restorePosition:"\x1B["+(us?"8":"u"),savePosition:"\x1B["+(us?"7":"s"),screen:"\x1B[2J",show:"\x1B[?25h",up:"\x1B[1J"},ne=L.cursor={get hidden(){return at},hide(){return at=!0,F.hide},show(){return at=!1,F.show},forward:(e=1)=>`\x1B[${e}C`,backward:(e=1)=>`\x1B[${e}D`,nextLine:(e=1)=>"\x1B[E".repeat(e),prevLine:(e=1)=>"\x1B[F".repeat(e),up:(e=1)=>e?`\x1B[${e}A`:"",down:(e=1)=>e?`\x1B[${e}B`:"",right:(e=1)=>e?`\x1B[${e}C`:"",left:(e=1)=>e?`\x1B[${e}D`:"",to(e,t){return t?`\x1B[${t+1};${e+1}H`:`\x1B[${e+1}G`},move(e=0,t=0){let s="";return s+=e<0?ne.left(-e):e>0?ne.right(e):"",s+=t<0?ne.up(-t):t>0?ne.down(t):"",s},strLen(e){var t=0,s=e.length,r=-1;for(var i=0;i<s;i++)if(r=e.charCodeAt(i),r>=0&&r<=128)t+=1;else t+=2;return t},restore(e={}){let{after:t,cursor:s,initial:r,input:i,prompt:o,size:n,value:a}=e;if(r=nt.isPrimitive(r)?String(r):"",i=nt.isPrimitive(i)?String(i):"",a=nt.isPrimitive(a)?String(a):"",n){let p=L.cursor.up(n)+L.cursor.to(this.strLen(o)),l=i.length-s;if(l>0)p+=L.cursor.left(l);return p}if(a||t){let p=!i&&!!r?-this.strLen(r):-this.strLen(i)+s;if(t)p-=this.strLen(t);if(i===""&&r&&!o.includes(r))p+=this.strLen(r);return L.cursor.move(p)}}},pt=L.erase={screen:F.screen,up:F.up,down:F.down,line:F.line,lineEnd:F.lineEnd,lineStart:F.lineStart,lines(e){let t="";for(let s=0;s<e;s++)t+=L.erase.line+(s<e-1?L.cursor.up(1):"");if(e)t+=L.code.beginning;return t}};L.clear=(e="",t=process.stdout.columns)=>{if(!t)return pt.line+ne.to(0);let s=(o)=>[...Un(o)].length,r=e.split(/\r?\n/),i=0;for(let o of r)i+=1+Math.floor(Math.max(s(o)-1,0)/t);return(pt.line+ne.prevLine()).repeat(i-1)+pt.line+ne.to(0)}});var ue=g((qu,fs)=>{var qn=he("events"),hs=V(),lt=tt(),Gn=es(),Kn=rs(),Wn=ls(),R=C(),ae=ms();class ut extends qn{constructor(e={}){super();this.name=e.name,this.type=e.type,this.options=e,Wn(this),Gn(this),this.state=new Kn(this),this.initial=[e.initial,e.default].find((t)=>t!=null),this.stdout=e.stdout||process.stdout,this.stdin=e.stdin||process.stdin,this.scale=e.scale||1,this.term=this.options.term||process.env.TERM_PROGRAM,this.margin=Yn(this.options.margin),this.setMaxListeners(0),Hn(this)}async keypress(e,t={}){this.keypressed=!0;let s=lt.action(e,lt(e,t),this.options.actions);this.state.keypress=s,this.emit("keypress",e,s),this.emit("state",this.state.clone());let r=this.options[s.action]||this[s.action]||this.dispatch;if(typeof r==="function")return await r.call(this,e,s);this.alert()}alert(){if(delete this.state.alert,this.options.show===!1)this.emit("alert");else this.stdout.write(ae.code.beep)}cursorHide(){this.stdout.write(ae.cursor.hide());let e=R.onExit(()=>this.cursorShow());this.on("close",()=>{this.cursorShow(),e()})}cursorShow(){this.stdout.write(ae.cursor.show())}write(e){if(!e)return;if(this.stdout&&this.state.show!==!1)this.stdout.write(e);this.state.buffer+=e}clear(e=0){let t=this.state.buffer;if(this.state.buffer="",!t&&!e||this.options.show===!1)return;this.stdout.write(ae.cursor.down(e)+ae.clear(t,this.width))}restore(){if(this.state.closed||this.options.show===!1)return;let{prompt:e,after:t,rest:s}=this.sections(),{cursor:r,initial:i="",input:o="",value:n=""}=this,a=this.state.size=s.length,p={after:t,cursor:r,initial:i,input:o,prompt:e,size:a,value:n},l=ae.cursor.restore(p);if(l)this.stdout.write(l)}sections(){let{buffer:e,input:t,prompt:s}=this.state;s=hs(s);let r=hs(e),i=r.indexOf(s),o=r.slice(0,i),a=r.slice(i).split(`
7
+ `),p=a[0],l=a[a.length-1],c=(s+(t?" "+t:"")).length,h=c<p.length?p.slice(c+1):"";return{header:o,prompt:p,after:h,rest:a.slice(1),last:l}}async submit(){if(this.state.submitted=!0,this.state.validating=!0,this.options.onSubmit)await this.options.onSubmit.call(this,this.name,this.value,this);let e=this.state.error||await this.validate(this.value,this.state);if(e!==!0){let t=`
8
+ `+this.symbols.pointer+" ";if(typeof e==="string")t+=e.trim();else t+="Invalid input";this.state.error=`
9
+ `+this.styles.danger(t),this.state.submitted=!1,await this.render(),await this.alert(),this.state.validating=!1,this.state.error=void 0;return}this.state.validating=!1,await this.render(),await this.close(),this.value=await this.result(this.value),this.emit("submit",this.value)}async cancel(e){if(this.state.cancelled=this.state.submitted=!0,await this.render(),await this.close(),typeof this.options.onCancel==="function")await this.options.onCancel.call(this,this.name,this.value,this);this.emit("cancel",await this.error(e))}async close(){this.state.closed=!0;try{let e=this.sections(),t=Math.ceil(e.prompt.length/this.width);if(e.rest)this.write(ae.cursor.down(e.rest.length));this.write(`
10
+ `.repeat(t))}catch(e){}this.emit("close")}start(){if(!this.stop&&this.options.show!==!1)this.stop=lt.listen(this,this.keypress.bind(this)),this.once("close",this.stop),this.emit("start",this)}async skip(){if(this.skipped=this.options.skip===!0,typeof this.options.skip==="function")this.skipped=await this.options.skip.call(this,this.name,this.value);return this.skipped}async initialize(){let{format:e,options:t,result:s}=this;if(this.format=()=>e.call(this,this.value),this.result=()=>s.call(this,this.value),typeof t.initial==="function")this.initial=await t.initial.call(this,this);if(typeof t.onRun==="function")await t.onRun.call(this,this);if(typeof t.onSubmit==="function"){let r=t.onSubmit.bind(this),i=this.submit.bind(this);delete this.options.onSubmit,this.submit=async()=>{return await r(this.name,this.value,this),i()}}await this.start(),await this.render()}render(){throw Error("expected prompt to have a custom render method")}run(){return new Promise(async(e,t)=>{if(this.once("submit",e),this.once("cancel",t),await this.skip())return this.render=()=>{},this.submit();await this.initialize(),this.emit("run")})}async element(e,t,s){let{options:r,state:i,symbols:o,timers:n}=this,a=n&&n[e];i.timer=a;let p=r[e]||i[e]||o[e],l=t&&t[e]!=null?t[e]:await p;if(l==="")return l;let u=await this.resolve(l,i,t,s);if(!u&&t&&t[e])return this.resolve(p,i,t,s);return u}async prefix(){let e=await this.element("prefix")||this.symbols,t=this.timers&&this.timers.prefix,s=this.state;if(s.timer=t,R.isObject(e))e=e[s.status]||e.pending;if(!R.hasColor(e))return(this.styles[s.status]||this.styles.pending)(e);return e}async message(){let e=await this.element("message");if(!R.hasColor(e))return this.styles.strong(e);return e}async separator(){let e=await this.element("separator")||this.symbols,t=this.timers&&this.timers.separator,s=this.state;s.timer=t;let r=e[s.status]||e.pending||s.separator,i=await this.resolve(r,s);if(R.isObject(i))i=i[s.status]||i.pending;if(!R.hasColor(i))return this.styles.muted(i);return i}async pointer(e,t){let s=await this.element("pointer",e,t);if(typeof s==="string"&&R.hasColor(s))return s;if(s){let r=this.styles,i=this.index===t,o=i?r.primary:(p)=>p,n=await this.resolve(s[i?"on":"off"]||s,this.state),a=!R.hasColor(n)?o(n):n;return i?a:" ".repeat(n.length)}}async indicator(e,t){let s=await this.element("indicator",e,t);if(typeof s==="string"&&R.hasColor(s))return s;if(s){let r=this.styles,i=e.enabled===!0,o=i?r.success:r.dark,n=s[i?"on":"off"]||s;return!R.hasColor(n)?o(n):n}return""}body(){return null}footer(){if(this.state.status==="pending")return this.element("footer")}header(){if(this.state.status==="pending")return this.element("header")}async hint(){if(this.state.status==="pending"&&!this.isValue(this.state.input)){let e=await this.element("hint");if(!R.hasColor(e))return this.styles.muted(e);return e}}error(e){return!this.state.submitted?e||this.state.error:""}format(e){return e}result(e){return e}validate(e){if(this.options.required===!0)return this.isValue(e);return!0}isValue(e){return e!=null&&e!==""}resolve(e,...t){return R.resolve(this,e,...t)}get base(){return ut.prototype}get style(){return this.styles[this.state.status]}get height(){return this.options.rows||R.height(this.stdout,25)}get width(){return this.options.columns||R.width(this.stdout,80)}get size(){return{width:this.width,height:this.height}}set cursor(e){this.state.cursor=e}get cursor(){return this.state.cursor}set input(e){this.state.input=e}get input(){return this.state.input}set value(e){this.state.value=e}get value(){let{input:e,value:t}=this.state,s=[t,e].find(this.isValue.bind(this));return this.isValue(s)?s:this.initial}static get prompt(){return(e)=>new this(e).run()}}function Hn(e){let t=(i)=>{return e[i]===void 0||typeof e[i]==="function"},s=["actions","choices","initial","margin","roles","styles","symbols","theme","timers","value"],r=["body","footer","error","header","hint","indicator","message","prefix","separator","skip"];for(let i of Object.keys(e.options)){if(s.includes(i))continue;if(/^on[A-Z]/.test(i))continue;let o=e.options[i];if(typeof o==="function"&&t(i)){if(!r.includes(i))e[i]=o.bind(e)}else if(typeof e[i]!=="function")e[i]=o}}function Yn(e){if(typeof e==="number")e=[e,e,e,e];let t=[].concat(e||[]),s=(i)=>i%2===0?`
11
+ `:" ",r=[];for(let i=0;i<4;i++){let o=s(i);if(t[i])r.push(o.repeat(t[i]));else r.push("")}return r}fs.exports=ut});var Es=g((Gu,gs)=>{var Vn=C(),ys={default(e,t){return t},checkbox(e,t){throw Error("checkbox role is not implemented yet")},editable(e,t){throw Error("editable role is not implemented yet")},expandable(e,t){throw Error("expandable role is not implemented yet")},heading(e,t){return t.disabled="",t.indicator=[t.indicator," "].find((s)=>s!=null),t.message=t.message||"",t},input(e,t){throw Error("input role is not implemented yet")},option(e,t){return ys.default(e,t)},radio(e,t){throw Error("radio role is not implemented yet")},separator(e,t){return t.disabled="",t.indicator=[t.indicator," "].find((s)=>s!=null),t.message=t.message||e.symbols.line.repeat(5),t},spacer(e,t){return t}};gs.exports=(e,t={})=>{let s=Vn.merge({},ys,t.roles);return s[e]||s.default}});var ge=g((Ku,ws)=>{var Fn=V(),Qn=ue(),Zn=Es(),Te=C(),{reorder:dt,scrollUp:zn,scrollDown:Xn,isObject:As,swap:Jn}=Te;class xs extends Qn{constructor(e){super(e);this.cursorHide(),this.maxSelected=e.maxSelected||1/0,this.multiple=e.multiple||!1,this.initial=e.initial||0,this.delay=e.delay||0,this.longest=0,this.num=""}async initialize(){if(typeof this.options.initial==="function")this.initial=await this.options.initial.call(this);await this.reset(!0),await super.initialize()}async reset(){let{choices:e,initial:t,autofocus:s,suggest:r}=this.options;if(this.state._choices=[],this.state.choices=[],this.choices=await Promise.all(await this.toChoices(e)),this.choices.forEach((i)=>i.enabled=!1),typeof r!=="function"&&this.selectable.length===0)throw Error("At least one choice must be selectable");if(As(t))t=Object.keys(t);if(Array.isArray(t)){if(s!=null)this.index=this.findIndex(s);t.forEach((i)=>this.enable(this.find(i))),await this.render()}else{if(s!=null)t=s;if(typeof t==="string")t=this.findIndex(t);if(typeof t==="number"&&t>-1)this.index=Math.max(0,Math.min(t,this.choices.length)),this.enable(this.find(this.index))}if(this.isDisabled(this.focused))await this.down()}async toChoices(e,t){this.state.loadingChoices=!0;let s=[],r=0,i=async(o,n)=>{if(typeof o==="function")o=await o.call(this);if(o instanceof Promise)o=await o;for(let a=0;a<o.length;a++){let p=o[a]=await this.toChoice(o[a],r++,n);if(s.push(p),p.choices)await i(p.choices,p)}return s};return i(e,t).then((o)=>{return this.state.loadingChoices=!1,o})}async toChoice(e,t,s){if(typeof e==="function")e=await e.call(this,this);if(e instanceof Promise)e=await e;if(typeof e==="string")e={name:e};if(e.normalized)return e;e.normalized=!0;let r=e.value;if(e=Zn(e.role,this.options)(this,e),typeof e.disabled==="string"&&!e.hint)e.hint=e.disabled,e.disabled=!0;if(e.disabled===!0&&e.hint==null)e.hint="(disabled)";if(e.index!=null)return e;if(e.name=e.name||e.key||e.title||e.value||e.message,e.message=e.message||e.name||"",e.value=[e.value,e.name].find(this.isValue.bind(this)),e.input="",e.index=t,e.cursor=0,Te.define(e,"parent",s),e.level=s?s.level+1:1,e.indent==null)e.indent=s?s.indent+" ":e.indent||"";if(e.path=s?s.path+"."+e.name:e.name,e.enabled=!!(this.multiple&&!this.isDisabled(e)&&(e.enabled||this.isSelected(e))),!this.isDisabled(e))this.longest=Math.max(this.longest,Fn(e.message).length);let o={...e};if(e.reset=(n=o.input,a=o.value)=>{for(let p of Object.keys(o))e[p]=o[p];e.input=n,e.value=a},r==null&&typeof e.initial==="function")e.input=await e.initial.call(this,this.state,e,t);return e}async onChoice(e,t){if(this.emit("choice",e,t,this),typeof e.onChoice==="function")await e.onChoice.call(this,this.state,e,t)}async addChoice(e,t,s){let r=await this.toChoice(e,t,s);return this.choices.push(r),this.index=this.choices.length-1,this.limit=this.choices.length,r}async newItem(e,t,s){let r={name:"New choice name?",editable:!0,newChoice:!0,...e},i=await this.addChoice(r,t,s);return i.updateChoice=()=>{delete i.newChoice,i.name=i.message=i.input,i.input="",i.cursor=0},this.render()}indent(e){if(e.indent==null)return e.level>1?" ".repeat(e.level-1):"";return e.indent}dispatch(e,t){if(this.multiple&&this[t.name])return this[t.name]();this.alert()}focus(e,t){if(typeof t!=="boolean")t=e.enabled;if(t&&!e.enabled&&this.selected.length>=this.maxSelected)return this.alert();return this.index=e.index,e.enabled=t&&!this.isDisabled(e),e}space(){if(!this.multiple)return this.alert();if(!this.focused)return;return this.toggle(this.focused),this.render()}a(){if(this.maxSelected<this.choices.length)return this.alert();let e=this.selectable.every((t)=>t.enabled);return this.choices.forEach((t)=>t.enabled=!e),this.render()}i(){if(this.choices.length-this.selected.length>this.maxSelected)return this.alert();return this.choices.forEach((e)=>e.enabled=!e.enabled),this.render()}g(){if(!this.choices.some((t)=>!!t.parent))return this.a();let e=this.focused;return this.toggle(e.parent&&!e.choices?e.parent:e),this.render()}toggle(e,t){if(!e.enabled&&this.selected.length>=this.maxSelected)return this.alert();if(typeof t!=="boolean")t=!e.enabled;if(e.enabled=t,e.choices)e.choices.forEach((r)=>this.toggle(r,t));let s=e.parent;while(s){let r=s.choices.filter((i)=>this.isDisabled(i));s.enabled=r.every((i)=>i.enabled===!0),s=s.parent}return bs(this,this.choices),this.emit("toggle",e,this),e}enable(e){if(this.selected.length>=this.maxSelected)return this.alert();return e.enabled=!this.isDisabled(e),e.choices&&e.choices.forEach(this.enable.bind(this)),e}disable(e){return e.enabled=!1,e.choices&&e.choices.forEach(this.disable.bind(this)),e}number(e){this.num+=e;let t=(s)=>{let r=Number(s);if(r>this.choices.length-1)return this.alert();let i=this.focused,o=this.choices.find((n)=>r===n.index);if(!o.enabled&&this.selected.length>=this.maxSelected)return this.alert();if(this.visible.indexOf(o)===-1){let n=dt(this.choices),a=n.indexOf(o);if(i.index>a){let p=n.slice(a,a+this.limit),l=n.filter((u)=>!p.includes(u));this.choices=p.concat(l)}else{let p=a-this.limit+1;this.choices=n.slice(p).concat(n.slice(0,p))}}return this.index=this.choices.indexOf(o),this.toggle(this.focused),this.render()};return clearTimeout(this.numberTimeout),new Promise((s)=>{let r=this.choices.length,i=this.num,o=(n=!1,a)=>{if(clearTimeout(this.numberTimeout),n)a=t(i);this.num="",s(a)};if(i==="0"||i.length===1&&Number(i+"0")>r)return o(!0);if(Number(i)>r)return o(!1,this.alert());this.numberTimeout=setTimeout(()=>o(!0),this.delay)})}home(){return this.choices=dt(this.choices),this.index=0,this.render()}end(){let e=this.choices.length-this.limit,t=dt(this.choices);return this.choices=t.slice(e).concat(t.slice(0,e)),this.index=this.limit-1,this.render()}first(){return this.index=0,this.render()}last(){return this.index=this.visible.length-1,this.render()}prev(){if(this.visible.length<=1)return this.alert();return this.up()}next(){if(this.visible.length<=1)return this.alert();return this.down()}right(){if(this.cursor>=this.input.length)return this.alert();return this.cursor++,this.render()}left(){if(this.cursor<=0)return this.alert();return this.cursor--,this.render()}up(){let e=this.choices.length,t=this.visible.length,s=this.index;if(this.options.scroll===!1&&s===0)return this.alert();if(e>t&&s===0)return this.scrollUp();if(this.index=(s-1%e+e)%e,this.isDisabled()&&!this.allChoicesAreDisabled())return this.up();return this.render()}down(){let e=this.choices.length,t=this.visible.length,s=this.index;if(this.options.scroll===!1&&s===t-1)return this.alert();if(e>t&&s===t-1)return this.scrollDown();if(this.index=(s+1)%e,this.isDisabled()&&!this.allChoicesAreDisabled())return this.down();return this.render()}scrollUp(e=0){if(this.choices=zn(this.choices),this.index=e,this.isDisabled())return this.up();return this.render()}scrollDown(e=this.visible.length-1){if(this.choices=Xn(this.choices),this.index=e,this.isDisabled())return this.down();return this.render()}async shiftUp(){if(this.options.sort===!0){this.sorting=!0,this.swap(this.index-1),await this.up(),this.sorting=!1;return}return this.scrollUp(this.index)}async shiftDown(){if(this.options.sort===!0){this.sorting=!0,this.swap(this.index+1),await this.down(),this.sorting=!1;return}return this.scrollDown(this.index)}pageUp(){if(this.visible.length<=1)return this.alert();if(this.limit=Math.max(this.limit-1,0),this.index=Math.min(this.limit-1,this.index),this._limit=this.limit,this.isDisabled())return this.up();return this.render()}pageDown(){if(this.visible.length>=this.choices.length)return this.alert();if(this.index=Math.max(0,this.index),this.limit=Math.min(this.limit+1,this.choices.length),this._limit=this.limit,this.isDisabled())return this.down();return this.render()}swap(e){Jn(this.choices,this.index,e)}allChoicesAreDisabled(e=this.choices){return e.every((t)=>this.isDisabled(t))}isDisabled(e=this.focused){if(e&&["disabled","collapsed","hidden","completing","readonly"].some((s)=>e[s]===!0))return!0;return e&&e.role==="heading"}isEnabled(e=this.focused){if(Array.isArray(e))return e.every((t)=>this.isEnabled(t));if(e.choices){let t=e.choices.filter((s)=>!this.isDisabled(s));return e.enabled&&t.every((s)=>this.isEnabled(s))}return e.enabled&&!this.isDisabled(e)}isChoice(e,t){return e.name===t||e.index===Number(t)}isSelected(e){if(Array.isArray(this.initial))return this.initial.some((t)=>this.isChoice(e,t));return this.isChoice(e,this.initial)}map(e=[],t="value"){return[].concat(e||[]).reduce((s,r)=>{return s[r]=this.find(r,t),s},{})}filter(e,t){let r=typeof e==="function"?e:(n,a)=>[n.name,a].includes(e),o=(this.options.multiple?this.state._choices:this.choices).filter(r);if(t)return o.map((n)=>n[t]);return o}find(e,t){if(As(e))return t?e[t]:e;let r=typeof e==="function"?e:(o,n)=>[o.name,n].includes(e),i=this.choices.find(r);if(i)return t?i[t]:i}findIndex(e){return this.choices.indexOf(this.find(e))}async submit(){let e=this.focused;if(!e)return this.alert();if(e.newChoice){if(!e.input)return this.alert();return e.updateChoice(),this.render()}if(this.choices.some((o)=>o.newChoice))return this.alert();let{reorder:t,sort:s}=this.options,r=this.multiple===!0,i=this.selected;if(i===void 0)return this.alert();if(Array.isArray(i)&&t!==!1&&s!==!0)i=Te.reorder(i);return this.value=r?i.map((o)=>o.name):i.name,super.submit()}set choices(e=[]){this.state._choices=this.state._choices||[],this.state.choices=e;for(let t of e)if(!this.state._choices.some((s)=>s.name===t.name))this.state._choices.push(t);if(!this._initial&&this.options.initial){this._initial=!0;let t=this.initial;if(typeof t==="string"||typeof t==="number"){let s=this.find(t);if(s)this.initial=s.index,this.focus(s,!0)}}}get choices(){return bs(this,this.state.choices||[])}set visible(e){this.state.visible=e}get visible(){return(this.state.visible||this.choices).slice(0,this.limit)}set limit(e){this.state.limit=e}get limit(){let{state:e,options:t,choices:s}=this,r=e.limit||this._limit||t.limit||s.length;return Math.min(r,this.height)}set value(e){super.value=e}get value(){if(typeof super.value!=="string"&&super.value===this.initial)return this.input;return super.value}set index(e){this.state.index=e}get index(){return Math.max(0,this.state?this.state.index:0)}get enabled(){return this.filter(this.isEnabled.bind(this))}get focused(){let e=this.choices[this.index];if(e&&this.state.submitted&&this.multiple!==!0)e.enabled=!0;return e}get selectable(){return this.choices.filter((e)=>!this.isDisabled(e))}get selected(){return this.multiple?this.enabled:this.focused}}function bs(e,t){if(t instanceof Promise)return t;if(typeof t==="function"){if(Te.isAsyncFn(t))return t;t=t.call(e,e)}for(let s of t){if(Array.isArray(s.choices)){let r=s.choices.filter((i)=>!e.isDisabled(i));s.enabled=r.every((i)=>i.enabled===!0)}if(e.isDisabled(s)===!0)delete s.enabled}return t}ws.exports=xs});var Q=g((Wu,Ns)=>{var jn=ge(),ct=C();class Ss extends jn{constructor(e){super(e);this.emptyError=this.options.emptyError||"No items were selected"}async dispatch(e,t){if(this.multiple)return this[t.name]?await this[t.name](e,t):await super.dispatch(e,t);this.alert()}separator(){if(this.options.separator)return super.separator();let e=this.styles.muted(this.symbols.ellipsis);return this.state.submitted?super.separator():e}pointer(e,t){return!this.multiple||this.options.pointer?super.pointer(e,t):""}indicator(e,t){return this.multiple?super.indicator(e,t):""}choiceMessage(e,t){let s=this.resolve(e.message,this.state,e,t);if(e.role==="heading"&&!ct.hasColor(s))s=this.styles.strong(s);return this.resolve(s,this.state,e,t)}choiceSeparator(){return":"}async renderChoice(e,t){await this.onChoice(e,t);let s=this.index===t,r=await this.pointer(e,t),i=await this.indicator(e,t)+(e.pad||""),o=await this.resolve(e.hint,this.state,e,t);if(o&&!ct.hasColor(o))o=this.styles.muted(o);let n=this.indent(e),a=await this.choiceMessage(e,t),p=()=>[this.margin[3],n+r+i,a,this.margin[1],o].filter(Boolean).join(" ");if(e.role==="heading")return p();if(e.disabled){if(!ct.hasColor(a))a=this.styles.disabled(a);return p()}if(s)a=this.styles.em(a);return p()}async renderChoices(){if(this.state.loading==="choices")return this.styles.warning("Loading choices");if(this.state.submitted)return"";let e=this.visible.map(async(i,o)=>await this.renderChoice(i,o)),t=await Promise.all(e);if(!t.length)t.push(this.styles.danger("No matching choices"));let s=this.margin[0]+t.join(`
12
+ `),r;if(this.options.choicesHeader)r=await this.resolve(this.options.choicesHeader,this.state);return[r,s].filter(Boolean).join(`
13
+ `)}format(){if(!this.state.submitted||this.state.cancelled)return"";if(Array.isArray(this.selected))return this.selected.map((e)=>this.styles.primary(e.name)).join(", ");return this.styles.primary(this.selected.name)}async render(){let{submitted:e,size:t}=this.state,s="",r=await this.header(),i=await this.prefix(),o=await this.separator(),n=await this.message();if(this.options.promptLine!==!1)s=[i,n,o,""].join(" "),this.state.prompt=s;let a=await this.format(),p=await this.error()||await this.hint(),l=await this.renderChoices(),u=await this.footer();if(a)s+=a;if(p&&!s.includes(p))s+=" "+p;if(e&&!a&&!l.trim()&&this.multiple&&this.emptyError!=null)s+=this.styles.danger(this.emptyError);this.clear(t),this.write([r,s,l,u].filter(Boolean).join(`
14
+ `)),this.write(this.margin[2]),this.restore()}}Ns.exports=Ss});var _s=g((Hu,Ts)=>{var kn=Q(),ea=(e,t)=>{let s=e?new RegExp(e,"ig"):/$^/;return(r)=>{return e?r.replace(s,(i)=>t(i)):r}};class Ms extends kn{constructor(e){super(e);this.cursorShow()}moveCursor(e){this.state.cursor+=e}dispatch(e){return this.append(e)}space(e){return this.options.multiple?super.space(e):this.append(e)}append(e){let{cursor:t,input:s}=this.state;return this.input=s.slice(0,t)+e+s.slice(t),this.moveCursor(1),this.complete()}delete(){let{cursor:e,input:t}=this.state;if(!t)return this.alert();return this.input=t.slice(0,e-1)+t.slice(e),this.moveCursor(-1),this.complete()}deleteForward(){let{cursor:e,input:t}=this.state;if(t[e]===void 0)return this.alert();return this.input=`${t}`.slice(0,e)+`${t}`.slice(e+1),this.complete()}number(e){return this.append(e)}async complete(){this.completing=!0,this.choices=await this.suggest(this.input,this.state._choices),this.state.limit=void 0,this.index=Math.min(Math.max(this.visible.length-1,0),this.index),await this.render(),this.completing=!1}suggest(e=this.input,t=this.state._choices){if(typeof this.options.suggest==="function")return this.options.suggest.call(this,e,t);let s=e.toLowerCase();return t.filter((r)=>r.message.toLowerCase().includes(s))}pointer(){return""}format(){if(!this.focused)return this.input;if(this.options.multiple&&this.state.submitted)return this.selected.map((e)=>this.styles.primary(e.message)).join(", ");if(this.state.submitted){let e=this.value=this.input=this.focused.value;return this.styles.primary(e)}return this.input}async render(){if(this.state.status!=="pending")return super.render();let e=this.options.highlight||this.styles.complement,t=(i,o)=>{if(!i)return i;if(e.stack)return e(i);return e.call(this,i)},s=ea(this.input,t),r=this.choices;this.choices=r.map((i)=>({...i,message:s(i.message)})),await super.render(),this.choices=r}submit(){if(this.options.multiple)this.value=this.selected.map((e)=>e.name);return super.submit()}}Ts.exports=Ms});var ht=g((Yu,vs)=>{var mt=C();vs.exports=(e,t={})=>{e.cursorHide();let{input:s="",initial:r="",pos:i,showCursor:o=!0,color:n}=t,a=n||e.styles.placeholder,p=mt.inverse(e.styles.primary),l=(y)=>p(e.styles.black(y)),u=s,c=" ",h=l(c);if(e.blink&&e.blink.off===!0)l=(y)=>y,h="";if(o&&i===0&&r===""&&s==="")return l(c);if(o&&i===0&&(s===r||s===""))return l(r[0])+a(r.slice(1));r=mt.isPrimitive(r)?`${r}`:"",s=mt.isPrimitive(s)?`${s}`:"";let d=r&&r.startsWith(s)&&r!==s,m=d?l(r[s.length]):h;if(i!==s.length&&o===!0)u=s.slice(0,i)+l(s[i])+s.slice(i+1),m="";if(o===!1)m="";if(d){let y=e.styles.unstyle(u+m);return u+m+a(r.slice(y.length))}return u+m}});var _e=g((Vu,Rs)=>{var ta=V(),sa=Q(),ra=ht();class Cs extends sa{constructor(e){super({...e,multiple:!0});this.type="form",this.initial=this.options.initial,this.align=[this.options.align,"right"].find((t)=>t!=null),this.emptyError="",this.values={}}async reset(e){if(await super.reset(),e===!0)this._index=this.index;return this.index=this._index,this.values={},this.choices.forEach((t)=>t.reset&&t.reset()),this.render()}dispatch(e){return!!e&&this.append(e)}append(e){let t=this.focused;if(!t)return this.alert();let{cursor:s,input:r}=t;return t.value=t.input=r.slice(0,s)+e+r.slice(s),t.cursor++,this.render()}delete(){let e=this.focused;if(!e||e.cursor<=0)return this.alert();let{cursor:t,input:s}=e;return e.value=e.input=s.slice(0,t-1)+s.slice(t),e.cursor--,this.render()}deleteForward(){let e=this.focused;if(!e)return this.alert();let{cursor:t,input:s}=e;if(s[t]===void 0)return this.alert();let r=`${s}`.slice(0,t)+`${s}`.slice(t+1);return e.value=e.input=r,this.render()}right(){let e=this.focused;if(!e)return this.alert();if(e.cursor>=e.input.length)return this.alert();return e.cursor++,this.render()}left(){let e=this.focused;if(!e)return this.alert();if(e.cursor<=0)return this.alert();return e.cursor--,this.render()}space(e,t){return this.dispatch(e,t)}number(e,t){return this.dispatch(e,t)}next(){let e=this.focused;if(!e)return this.alert();let{initial:t,input:s}=e;if(t&&t.startsWith(s)&&s!==t)return e.value=e.input=t,e.cursor=e.value.length,this.render();return super.next()}prev(){let e=this.focused;if(!e)return this.alert();if(e.cursor===0)return super.prev();return e.value=e.input="",e.cursor=0,this.render()}separator(){return""}format(e){return!this.state.submitted?super.format(e):""}pointer(){return""}indicator(e){return e.input?"\u29BF":"\u2299"}async choiceSeparator(e,t){let s=await this.resolve(e.separator,this.state,e,t)||":";return s?" "+this.styles.disabled(s):""}async renderChoice(e,t){await this.onChoice(e,t);let{state:s,styles:r}=this,{cursor:i,initial:o="",name:n,input:a=""}=e,{muted:p,submitted:l,primary:u,danger:c}=r,h=this.index===t,d=e.validate||(()=>!0),m=await this.choiceSeparator(e,t),y=e.message;if(this.align==="right")y=y.padStart(this.longest+1," ");if(this.align==="left")y=y.padEnd(this.longest+1," ");let S=this.values[n]=a||o,f=a?"success":"dark";if(await d.call(e,S,this.state)!==!0)f="danger";let E=r[f],w=E(await this.indicator(e,t))+(e.pad||""),N=this.indent(e),T=()=>[N,w,y+m,a].filter(Boolean).join(" ");if(s.submitted)return y=ta(y),a=l(a),T();if(e.format)a=await e.format.call(this,a,e,t);else{let v=this.styles.muted;a=ra(this,{input:a,initial:o,pos:i,showCursor:h,color:v})}if(!this.isValue(a))a=this.styles.muted(this.symbols.ellipsis);if(e.result)this.values[n]=await e.result.call(this,S,e,t);if(h)y=u(y);if(e.error)a+=(a?" ":"")+c(e.error.trim());else if(e.hint)a+=(a?" ":"")+p(e.hint.trim());return T()}async submit(){return this.value=this.values,super.base.submit.call(this)}}Rs.exports=Cs});var ft=g((Fu,Ds)=>{var ia=_e(),oa=()=>{throw Error("expected prompt to have a custom authenticate method")},Bs=(e=oa)=>{class t extends ia{constructor(s){super(s)}async submit(){this.value=await e.call(this,this.values,this.state),super.base.submit.call(this)}static create(s){return Bs(s)}}return t};Ds.exports=Bs()});var Is=g((Qu,Ps)=>{var na=ft();function aa(e,t){if(e.username===this.options.username&&e.password===this.options.password)return!0;return!1}var Os=(e=aa)=>{let t=[{name:"username",message:"username"},{name:"password",message:"password",format(r){if(this.options.showPassword)return r;return(this.state.submitted?this.styles.primary:this.styles.muted)(this.symbols.asterisk.repeat(r.length))}}];class s extends na.create(e){constructor(r){super({...r,choices:t})}static create(r){return Os(r)}}return s};Ps.exports=Os()});var ve=g((Zu,$s)=>{var pa=ue(),{isPrimitive:la,hasColor:ua}=C();class Ls extends pa{constructor(e){super(e);this.cursorHide()}async initialize(){let e=await this.resolve(this.initial,this.state);this.input=await this.cast(e),await super.initialize()}dispatch(e){if(!this.isValue(e))return this.alert();return this.input=e,this.submit()}format(e){let{styles:t,state:s}=this;return!s.submitted?t.primary(e):t.success(e)}cast(e){return this.isTrue(e)}isTrue(e){return/^[ty1]/i.test(e)}isFalse(e){return/^[fn0]/i.test(e)}isValue(e){return la(e)&&(this.isTrue(e)||this.isFalse(e))}async hint(){if(this.state.status==="pending"){let e=await this.element("hint");if(!ua(e))return this.styles.muted(e);return e}}async render(){let{input:e,size:t}=this.state,s=await this.prefix(),r=await this.separator(),i=await this.message(),o=this.styles.muted(this.default),n=[s,i,o,r].filter(Boolean).join(" ");this.state.prompt=n;let a=await this.header(),p=this.value=this.cast(e),l=await this.format(p),u=await this.error()||await this.hint(),c=await this.footer();if(u&&!n.includes(u))l+=" "+u;n+=" "+l,this.clear(t),this.write([a,n,c].filter(Boolean).join(`
15
+ `)),this.restore()}set value(e){super.value=e}get value(){return this.cast(super.value)}}$s.exports=Ls});var Gs=g((zu,qs)=>{var da=ve();class Us extends da{constructor(e){super(e);this.default=this.options.default||(this.initial?"(Y/n)":"(y/N)")}}qs.exports=Us});var Hs=g((Xu,Ws)=>{var ca=Q(),ma=_e(),de=ma.prototype;class Ks extends ca{constructor(e){super({...e,multiple:!0});this.align=[this.options.align,"left"].find((t)=>t!=null),this.emptyError="",this.values={}}dispatch(e,t){let s=this.focused,r=s.parent||{};if(!s.editable&&!r.editable){if(e==="a"||e==="i")return super[e]()}return de.dispatch.call(this,e,t)}append(e,t){return de.append.call(this,e,t)}delete(e,t){return de.delete.call(this,e,t)}space(e){return this.focused.editable?this.append(e):super.space()}number(e){return this.focused.editable?this.append(e):super.number(e)}next(){return this.focused.editable?de.next.call(this):super.next()}prev(){return this.focused.editable?de.prev.call(this):super.prev()}async indicator(e,t){let s=e.indicator||"",r=e.editable?s:super.indicator(e,t);return await this.resolve(r,this.state,e,t)||""}indent(e){return e.role==="heading"?"":e.editable?" ":" "}async renderChoice(e,t){if(e.indent="",e.editable)return de.renderChoice.call(this,e,t);return super.renderChoice(e,t)}error(){return""}footer(){return this.state.error}async validate(){let e=!0;for(let t of this.choices){if(typeof t.validate!=="function")continue;if(t.role==="heading")continue;let s=t.parent?this.value[t.parent.name]:this.value;if(t.editable)s=t.value===t.name?t.initial||"":t.value;else if(!this.isDisabled(t))s=t.enabled===!0;if(e=await t.validate(s,this.state),e!==!0)break}if(e!==!0)this.state.error=typeof e==="string"?e:"Invalid Input";return e}submit(){if(this.focused.newChoice===!0)return super.submit();if(this.choices.some((e)=>e.newChoice))return this.alert();this.value={};for(let e of this.choices){let t=e.parent?this.value[e.parent.name]:this.value;if(e.role==="heading"){this.value[e.name]={};continue}if(e.editable)t[e.name]=e.value===e.name?e.initial||"":e.value;else if(!this.isDisabled(e))t[e.name]=e.enabled===!0}return this.base.submit.call(this)}}Ws.exports=Ks});var pe=g((Ju,Vs)=>{var ha=ue(),fa=tt(),ya=ht(),{isPrimitive:ga}=C();class Ys extends ha{constructor(e){super(e);if(this.initial=ga(this.initial)?String(this.initial):"",this.initial)this.cursorHide();this.state.prevCursor=0,this.state.clipboard=[],this.keypressTimeout=this.options.keypressTimeout!==void 0?this.options.keypressTimeout:null}async keypress(e,t=e?fa(e,{}):{}){let s=Date.now(),r=s-this.lastKeypress;this.lastKeypress=s;let i=t.name==="return"||t.name==="enter",o=this.state.prevKeypress,n;if(this.state.prevKeypress=t,this.keypressTimeout!=null&&i){if(r<this.keypressTimeout)return this.submit();this.state.multilineBuffer=this.state.multilineBuffer||"",this.state.multilineBuffer+=e,n=!0,o=null}if(n||this.options.multiline&&i){if(!o||o.name!=="return")return this.append(`
16
+ `,t)}return super.keypress(e,t)}moveCursor(e){this.cursor+=e}reset(){return this.input=this.value="",this.cursor=0,this.render()}dispatch(e,t){if(!e||t.ctrl||t.code)return this.alert();this.append(e)}append(e){let{cursor:t,input:s}=this.state;this.input=`${s}`.slice(0,t)+e+`${s}`.slice(t),this.moveCursor(String(e).length),this.render()}insert(e){this.append(e)}delete(){let{cursor:e,input:t}=this.state;if(e<=0)return this.alert();this.input=`${t}`.slice(0,e-1)+`${t}`.slice(e),this.moveCursor(-1),this.render()}deleteForward(){let{cursor:e,input:t}=this.state;if(t[e]===void 0)return this.alert();this.input=`${t}`.slice(0,e)+`${t}`.slice(e+1),this.render()}cutForward(){let e=this.cursor;if(this.input.length<=e)return this.alert();this.state.clipboard.push(this.input.slice(e)),this.input=this.input.slice(0,e),this.render()}cutLeft(){let e=this.cursor;if(e===0)return this.alert();let t=this.input.slice(0,e),s=this.input.slice(e),r=t.split(" ");this.state.clipboard.push(r.pop()),this.input=r.join(" "),this.cursor=this.input.length,this.input+=s,this.render()}paste(){if(!this.state.clipboard.length)return this.alert();this.insert(this.state.clipboard.pop()),this.render()}toggleCursor(){if(this.state.prevCursor)this.cursor=this.state.prevCursor,this.state.prevCursor=0;else this.state.prevCursor=this.cursor,this.cursor=0;this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.input.length-1,this.render()}next(){let e=this.initial!=null?String(this.initial):"";if(!e||!e.startsWith(this.input))return this.alert();this.input=this.initial,this.cursor=this.initial.length,this.render()}prev(){if(!this.input)return this.alert();this.reset()}backward(){return this.left()}forward(){return this.right()}right(){if(this.cursor>=this.input.length)return this.alert();return this.moveCursor(1),this.render()}left(){if(this.cursor<=0)return this.alert();return this.moveCursor(-1),this.render()}isValue(e){return!!e}async format(e=this.value){let t=await this.resolve(this.initial,this.state);if(!this.state.submitted)return ya(this,{input:e,initial:t,pos:this.cursor});return this.styles.submitted(e||t)}async render(){let e=this.state.size,t=await this.prefix(),s=await this.separator(),r=await this.message(),i=[t,r,s].filter(Boolean).join(" ");this.state.prompt=i;let o=await this.header(),n=await this.format(),a=await this.error()||await this.hint(),p=await this.footer();if(a&&!n.includes(a))n+=" "+a;i+=" "+n,this.clear(e),this.write([o,i,p].filter(Boolean).join(`
17
+ `)),this.restore()}}Vs.exports=Ys});var Qs=g((ju,Fs)=>{var Ea=(e)=>e.filter((t,s)=>e.lastIndexOf(t)===s),Ce=(e)=>Ea(e).filter(Boolean);Fs.exports=(e,t={},s="")=>{let{past:r=[],present:i=""}=t,o,n;switch(e){case"prev":case"undo":return o=r.slice(0,r.length-1),n=r[r.length-1]||"",{past:Ce([s,...o]),present:n};case"next":case"redo":return o=r.slice(1),n=r[0]||"",{past:Ce([...o,s]),present:n};case"save":return{past:Ce([...r,s]),present:""};case"remove":if(n=Ce(r.filter((a)=>a!==s)),i="",n.length)i=n.pop();return{past:n,present:i};default:throw Error(`Invalid action: "${e}"`)}}});var yt=g((ku,Xs)=>{var Aa=pe(),Zs=Qs();class zs extends Aa{constructor(e){super(e);let t=this.options.history;if(t&&t.store){let s=t.values||this.initial;this.autosave=!!t.autosave,this.store=t.store,this.data=this.store.get("values")||{past:[],present:s},this.initial=this.data.present||this.data.past[this.data.past.length-1]}}completion(e){if(!this.store)return this.alert();if(this.data=Zs(e,this.data,this.input),!this.data.present)return this.alert();return this.input=this.data.present,this.cursor=this.input.length,this.render()}altUp(){return this.completion("prev")}altDown(){return this.completion("next")}prev(){return this.save(),super.prev()}save(){if(!this.store)return;this.data=Zs("save",this.data,this.input),this.store.set("values",this.data)}submit(){if(this.store&&this.autosave===!0)this.save();return super.submit()}}Xs.exports=zs});var ks=g((ed,js)=>{var ba=pe();class Js extends ba{format(){return""}}js.exports=Js});var sr=g((td,tr)=>{var xa=pe();class er extends xa{constructor(e={}){super(e);this.sep=this.options.separator||/, */,this.initial=e.initial||""}split(e=this.value){return e?String(e).split(this.sep):[]}format(){let e=this.state.submitted?this.styles.primary:(t)=>t;return this.list.map(e).join(", ")}async submit(e){let t=this.state.error||await this.validate(this.list,this.state);if(t!==!0)return this.state.error=t,super.submit();return this.value=this.list,super.submit()}get list(){return this.split()}}tr.exports=er});var or=g((sd,ir)=>{var wa=Q();class rr extends wa{constructor(e){super({...e,multiple:!0})}}ir.exports=rr});var gt=g((rd,ar)=>{var Sa=pe();class nr extends Sa{constructor(e={}){super({style:"number",...e});this.min=this.isValue(e.min)?this.toNumber(e.min):-1/0,this.max=this.isValue(e.max)?this.toNumber(e.max):1/0,this.delay=e.delay!=null?e.delay:1000,this.float=e.float!==!1,this.round=e.round===!0||e.float===!1,this.major=e.major||10,this.minor=e.minor||1,this.initial=e.initial!=null?e.initial:"",this.input=String(this.initial),this.cursor=this.input.length,this.cursorShow()}append(e){if(!/[-+.]/.test(e)||e==="."&&this.input.includes("."))return this.alert("invalid number");return super.append(e)}number(e){return super.append(e)}next(){if(this.input&&this.input!==this.initial)return this.alert();if(!this.isValue(this.initial))return this.alert();return this.input=this.initial,this.cursor=String(this.initial).length,this.render()}up(e){let t=e||this.minor,s=this.toNumber(this.input);if(s>this.max+t)return this.alert();return this.input=`${s+t}`,this.render()}down(e){let t=e||this.minor,s=this.toNumber(this.input);if(s<this.min-t)return this.alert();return this.input=`${s-t}`,this.render()}shiftDown(){return this.down(this.major)}shiftUp(){return this.up(this.major)}format(e=this.input){if(typeof this.options.format==="function")return this.options.format.call(this,e);return this.styles.info(e)}toNumber(e=""){return this.float?+e:Math.round(+e)}isValue(e){return/^[-+]?[0-9]+((\.)|(\.[0-9]+))?$/.test(e)}submit(){let e=[this.input,this.initial].find((t)=>this.isValue(t));return this.value=this.toNumber(e||0),super.submit()}}ar.exports=nr});var ur=g((id,lr)=>{var Na=pe();class pr extends Na{constructor(e){super(e);this.cursorShow()}format(e=this.input){if(!this.keypressed)return"";return(this.state.submitted?this.styles.primary:this.styles.muted)(this.symbols.asterisk.repeat(e.length))}}lr.exports=pr});var hr=g((od,mr)=>{var Ma=V(),Ta=ge(),dr=C();class cr extends Ta{constructor(e={}){super(e);this.widths=[].concat(e.messageWidth||50),this.align=[].concat(e.align||"left"),this.linebreak=e.linebreak||!1,this.edgeLength=e.edgeLength||3,this.newline=e.newline||`
18
+ `;let t=e.startNumber||1;if(typeof this.scale==="number")this.scaleKey=!1,this.scale=Array(this.scale).fill(0).map((s,r)=>({name:r+t}))}async reset(){return this.tableized=!1,await super.reset(),this.render()}tableize(){if(this.tableized===!0)return;this.tableized=!0;let e=0;for(let t of this.choices){e=Math.max(e,t.message.length),t.scaleIndex=t.initial||2,t.scale=[];for(let s=0;s<this.scale.length;s++)t.scale.push({index:s})}this.widths[0]=Math.min(this.widths[0],e+3)}async dispatch(e,t){if(this.multiple)return this[t.name]?await this[t.name](e,t):await super.dispatch(e,t);this.alert()}heading(e,t,s){return this.styles.strong(e)}separator(){return this.styles.muted(this.symbols.ellipsis)}right(){let e=this.focused;if(e.scaleIndex>=this.scale.length-1)return this.alert();return e.scaleIndex++,this.render()}left(){let e=this.focused;if(e.scaleIndex<=0)return this.alert();return e.scaleIndex--,this.render()}indent(){return""}format(){if(this.state.submitted)return this.choices.map((t)=>this.styles.info(t.index)).join(", ");return""}pointer(){return""}renderScaleKey(){if(this.scaleKey===!1)return"";if(this.state.submitted)return"";return["",...this.scale.map((s)=>` ${s.name} - ${s.message}`)].map((s)=>this.styles.muted(s)).join(`
19
+ `)}renderScaleHeading(e){let t=this.scale.map((a)=>a.name);if(typeof this.options.renderScaleHeading==="function")t=this.options.renderScaleHeading.call(this,e);let s=this.scaleLength-t.join("").length,r=Math.round(s/(t.length-1)),o=t.map((a)=>this.styles.strong(a)).join(" ".repeat(r)),n=" ".repeat(this.widths[0]);return this.margin[3]+n+this.margin[1]+o}scaleIndicator(e,t,s){if(typeof this.options.scaleIndicator==="function")return this.options.scaleIndicator.call(this,e,t,s);let r=e.scaleIndex===t.index;if(t.disabled)return this.styles.hint(this.symbols.radio.disabled);if(r)return this.styles.success(this.symbols.radio.on);return this.symbols.radio.off}renderScale(e,t){let s=e.scale.map((i)=>this.scaleIndicator(e,i,t)),r=this.term==="Hyper"?"":" ";return s.join(r+this.symbols.line.repeat(this.edgeLength))}async renderChoice(e,t){await this.onChoice(e,t);let s=this.index===t,r=await this.pointer(e,t),i=await e.hint;if(i&&!dr.hasColor(i))i=this.styles.muted(i);let o=(d)=>this.margin[3]+d.replace(/\s+$/,"").padEnd(this.widths[0]," "),n=this.newline,a=this.indent(e),p=await this.resolve(e.message,this.state,e,t),l=await this.renderScale(e,t),u=this.margin[1]+this.margin[3];this.scaleLength=Ma(l).length,this.widths[0]=Math.min(this.widths[0],this.width-this.scaleLength-u.length);let h=dr.wordWrap(p,{width:this.widths[0],newline:n}).split(`
20
+ `).map((d)=>o(d)+this.margin[1]);if(s)l=this.styles.info(l),h=h.map((d)=>this.styles.info(d));if(h[0]+=l,this.linebreak)h.push("");return[a+r,h.join(`
21
+ `)].filter(Boolean)}async renderChoices(){if(this.state.submitted)return"";this.tableize();let e=this.visible.map(async(r,i)=>await this.renderChoice(r,i)),t=await Promise.all(e),s=await this.renderScaleHeading();return this.margin[0]+[s,...t.map((r)=>r.join(" "))].join(`
22
+ `)}async render(){let{submitted:e,size:t}=this.state,s=await this.prefix(),r=await this.separator(),i=await this.message(),o="";if(this.options.promptLine!==!1)o=[s,i,r,""].join(" "),this.state.prompt=o;let n=await this.header(),a=await this.format(),p=await this.renderScaleKey(),l=await this.error()||await this.hint(),u=await this.renderChoices(),c=await this.footer(),h=this.emptyError;if(a)o+=a;if(l&&!o.includes(l))o+=" "+l;if(e&&!a&&!u.trim()&&this.multiple&&h!=null)o+=this.styles.danger(h);if(this.clear(t),this.write([n,o,p,u,c].filter(Boolean).join(`
23
+ `)),!this.state.submitted)this.write(this.margin[2]);this.restore()}submit(){this.value={};for(let e of this.choices)this.value[e.name]=e.scaleIndex;return this.base.submit.call(this)}}mr.exports=cr});var Er=g((nd,gr)=>{var fr=V(),_a=(e="")=>{return typeof e==="string"?e.replace(/^['"]|['"]$/g,""):""};class yr{constructor(e){this.name=e.key,this.field=e.field||{},this.value=_a(e.initial||this.field.initial||""),this.message=e.message||this.name,this.cursor=0,this.input="",this.lines=[]}}var va=async(e={},t={},s=(r)=>r)=>{let r=new Set,i=e.fields||[],o=e.template,n=[],a=[],p=[],l=1;if(typeof o==="function")o=await o();let u=-1,c=()=>o[++u],h=()=>o[u+1],d=(m)=>{m.line=l,n.push(m)};d({type:"bos",value:""});while(u<o.length-1){let m=c();if(/^[^\S\n ]$/.test(m)){d({type:"text",value:m});continue}if(m===`
24
+ `){d({type:"newline",value:m}),l++;continue}if(m==="\\"){m+=c(),d({type:"text",value:m});continue}if((m==="$"||m==="#"||m==="{")&&h()==="{"){let S=c();m+=S;let f={type:"template",open:m,inner:"",close:"",value:m},E;while(E=c()){if(E==="}"){if(h()==="}")E+=c();f.value+=E,f.close=E;break}if(E===":")f.initial="",f.key=f.inner;else if(f.initial!==void 0)f.initial+=E;f.value+=E,f.inner+=E}if(f.template=f.open+(f.initial||f.inner)+f.close,f.key=f.key||f.inner,hasOwnProperty.call(t,f.key))f.initial=t[f.key];f=s(f),d(f),p.push(f.key),r.add(f.key);let w=a.find((N)=>N.name===f.key);if(f.field=i.find((N)=>N.name===f.key),!w)w=new yr(f),a.push(w);w.lines.push(f.line-1);continue}let y=n[n.length-1];if(y.type==="text"&&y.line===l)y.value+=m;else d({type:"text",value:m})}return d({type:"eos",value:""}),{input:o,tabstops:n,unique:r,keys:p,items:a}};gr.exports=async(e)=>{let t=e.options,s=new Set(t.required===!0?[]:t.required||[]),r={...t.values,...t.initial},{tabstops:i,items:o,keys:n}=await va(t,r),a=Et("result",e,t),p=Et("format",e,t),l=Et("validate",e,t,!0),u=e.isValue.bind(e);return async(c={},h=!1)=>{let d=0;c.required=s,c.items=o,c.keys=n,c.output="";let m=async(E,w,N,T)=>{let v=await l(E,w,N,T);if(v===!1)return"Invalid field "+N.name;return v};for(let E of i){let{value:w,key:N}=E;if(E.type!=="template"){if(w)c.output+=w;continue}if(E.type==="template"){let T=o.find((le)=>le.name===N);if(t.required===!0)c.required.add(T.name);let v=[T.input,c.values[T.value],T.value,w].find(u),be=(T.field||{}).message||E.inner;if(h){let le=await m(c.values[N],c,T,d);if(le&&typeof le==="string"||le===!1){c.invalid.set(N,le);continue}c.invalid.delete(N);let Co=await a(c.values[N],c,T,d);c.output+=fr(Co);continue}T.placeholder=!1;let vo=w;if(w=await p(w,c,T,d),v!==w)c.values[N]=v,w=e.styles.typing(v),c.missing.delete(be);else if(c.values[N]=void 0,v=`<${be}>`,w=e.styles.primary(v),T.placeholder=!0,c.required.has(N))c.missing.add(be);if(c.missing.has(be)&&c.validating)w=e.styles.warning(v);if(c.invalid.has(N)&&c.validating)w=e.styles.danger(v);if(d===c.index)if(vo!==w)w=e.styles.underline(w);else w=e.styles.heading(fr(w));d++}if(w)c.output+=w}let y=c.output.split(`
25
+ `).map((E)=>" "+E),S=o.length,f=0;for(let E of o){if(c.invalid.has(E.name))E.lines.forEach((w)=>{if(y[w][0]!==" ")return;y[w]=c.styles.danger(c.symbols.bullet)+y[w].slice(1)});if(e.isValue(c.values[E.name]))f++}return c.completed=(f/S*100).toFixed(0),c.output=y.join(`
26
+ `),c.output}};function Et(e,t,s,r){return(i,o,n,a)=>{if(typeof n.field[e]==="function")return n.field[e].call(t,i,o,n,a);return[r,i].find((p)=>t.isValue(p))}}});var xr=g((ad,br)=>{var Ca=V(),Ra=Er(),Ba=ue();class Ar extends Ba{constructor(e){super(e);this.cursorHide(),this.reset(!0)}async initialize(){this.interpolate=await Ra(this),await super.initialize()}async reset(e){if(this.state.keys=[],this.state.invalid=new Map,this.state.missing=new Set,this.state.completed=0,this.state.values={},e!==!0)await this.initialize(),await this.render()}moveCursor(e){let t=this.getItem();this.cursor+=e,t.cursor+=e}dispatch(e,t){if(!t.code&&!t.ctrl&&e!=null&&this.getItem()){this.append(e,t);return}this.alert()}append(e,t){let s=this.getItem(),r=s.input.slice(0,this.cursor),i=s.input.slice(this.cursor);this.input=s.input=`${r}${e}${i}`,this.moveCursor(1),this.render()}delete(){let e=this.getItem();if(this.cursor<=0||!e.input)return this.alert();let t=e.input.slice(this.cursor),s=e.input.slice(0,this.cursor-1);this.input=e.input=`${s}${t}`,this.moveCursor(-1),this.render()}increment(e){return e>=this.state.keys.length-1?0:e+1}decrement(e){return e<=0?this.state.keys.length-1:e-1}first(){this.state.index=0,this.render()}last(){this.state.index=this.state.keys.length-1,this.render()}right(){if(this.cursor>=this.input.length)return this.alert();this.moveCursor(1),this.render()}left(){if(this.cursor<=0)return this.alert();this.moveCursor(-1),this.render()}prev(){this.state.index=this.decrement(this.state.index),this.getItem(),this.render()}next(){this.state.index=this.increment(this.state.index),this.getItem(),this.render()}up(){this.prev()}down(){this.next()}format(e){let t=this.state.completed<100?this.styles.warning:this.styles.success;if(this.state.submitted===!0&&this.state.completed!==100)t=this.styles.danger;return t(`${this.state.completed}% completed`)}async render(){let{index:e,keys:t=[],submitted:s,size:r}=this.state,i=[this.options.newline,`
27
+ `].find((f)=>f!=null),o=await this.prefix(),n=await this.separator(),a=await this.message(),p=[o,a,n].filter(Boolean).join(" ");this.state.prompt=p;let l=await this.header(),u=await this.error()||"",c=await this.hint()||"",h=s?"":await this.interpolate(this.state),d=this.state.key=t[e]||"",m=await this.format(d),y=await this.footer();if(m)p+=" "+m;if(c&&!m&&this.state.completed===0)p+=" "+c;this.clear(r);let S=[l,p,h,y,u.trim()];this.write(S.filter(Boolean).join(i)),this.restore()}getItem(e){let{items:t,keys:s,index:r}=this.state,i=t.find((o)=>o.name===s[r]);if(i&&i.input!=null)this.input=i.input,this.cursor=i.cursor;return i}async submit(){if(typeof this.interpolate!=="function")await this.initialize();await this.interpolate(this.state,!0);let{invalid:e,missing:t,output:s,values:r}=this.state;if(e.size){let n="";for(let[a,p]of e)n+=`Invalid ${a}: ${p}
28
+ `;return this.state.error=n,super.submit()}if(t.size)return this.state.error="Required: "+[...t.keys()].join(", "),super.submit();let o=Ca(s).split(`
29
+ `).map((n)=>n.slice(1)).join(`
30
+ `);return this.value={values:r,result:o},super.submit()}}br.exports=Ar});var Nr=g((pd,Sr)=>{var Da=Q();class wr extends Da{constructor(e){super({...e,reorder:!1,sort:!0,multiple:!0});this.state.hint=[this.options.hint,"(Use <shift>+<up/down> to sort)"].find(this.isValue.bind(this))}indicator(){return""}async renderChoice(e,t){let s=await super.renderChoice(e,t),r=this.symbols.identicalTo+" ",i=this.index===t&&this.sorting?this.styles.muted(r):" ";if(this.options.drag===!1)i="";if(this.options.numbered===!0)return i+`${t+1} - `+s;return i+s}get selected(){return this.choices}submit(){return this.value=this.choices.map((e)=>e.value),super.submit()}}Sr.exports=wr});var _r=g((ld,Tr)=>{var Oa=ge();class Mr extends Oa{constructor(e={}){super(e);if(this.emptyError=e.emptyError||"No items were selected",this.term=process.env.TERM_PROGRAM,!this.options.header){let t=["","4 - Strongly Agree","3 - Agree","2 - Neutral","1 - Disagree","0 - Strongly Disagree",""];t=t.map((s)=>this.styles.muted(s)),this.state.header=t.join(`
31
+ `)}}async toChoices(...e){if(this.createdScales)return!1;this.createdScales=!0;let t=await super.toChoices(...e);for(let s of t)s.scale=Pa(5,this.options),s.scaleIdx=2;return t}dispatch(){this.alert()}space(){let e=this.focused,t=e.scale[e.scaleIdx],s=t.selected;return e.scale.forEach((r)=>r.selected=!1),t.selected=!s,this.render()}indicator(){return""}pointer(){return""}separator(){return this.styles.muted(this.symbols.ellipsis)}right(){let e=this.focused;if(e.scaleIdx>=e.scale.length-1)return this.alert();return e.scaleIdx++,this.render()}left(){let e=this.focused;if(e.scaleIdx<=0)return this.alert();return e.scaleIdx--,this.render()}indent(){return" "}async renderChoice(e,t){await this.onChoice(e,t);let s=this.index===t,r=this.term==="Hyper",i=!r?8:9,o=!r?" ":"",n=this.symbols.line.repeat(i),a=" ".repeat(i+(r?0:1)),p=(E)=>(E?this.styles.success("\u25C9"):"\u25EF")+o,l=t+1+".",u=s?this.styles.heading:this.styles.noop,c=await this.resolve(e.message,this.state,e,t),h=this.indent(e),d=h+e.scale.map((E,w)=>p(w===e.scaleIdx)).join(n),m=(E)=>E===e.scaleIdx?u(E):E,y=h+e.scale.map((E,w)=>m(w)).join(a),S=()=>[l,c].filter(Boolean).join(" "),f=()=>[S(),d,y," "].filter(Boolean).join(`
32
+ `);if(s)d=this.styles.cyan(d),y=this.styles.cyan(y);return f()}async renderChoices(){if(this.state.submitted)return"";let e=this.visible.map(async(s,r)=>await this.renderChoice(s,r)),t=await Promise.all(e);if(!t.length)t.push(this.styles.danger("No matching choices"));return t.join(`
33
+ `)}format(){if(this.state.submitted)return this.choices.map((t)=>this.styles.info(t.scaleIdx)).join(", ");return""}async render(){let{submitted:e,size:t}=this.state,s=await this.prefix(),r=await this.separator(),i=await this.message(),o=[s,i,r].filter(Boolean).join(" ");this.state.prompt=o;let n=await this.header(),a=await this.format(),p=await this.error()||await this.hint(),l=await this.renderChoices(),u=await this.footer();if(a||!p)o+=" "+a;if(p&&!o.includes(p))o+=" "+p;if(e&&!a&&!l&&this.multiple&&this.type!=="form")o+=this.styles.danger(this.emptyError);this.clear(t),this.write([o,n,l,u].filter(Boolean).join(`
34
+ `)),this.restore()}submit(){this.value={};for(let e of this.choices)this.value[e.name]=e.scaleIdx;return this.base.submit.call(this)}}function Pa(e,t={}){if(Array.isArray(t.scale))return t.scale.map((r)=>({...r}));let s=[];for(let r=1;r<e+1;r++)s.push({i:r,selected:!1});return s}Tr.exports=Mr});var Rr=g((ud,Cr)=>{var Ia=ve();class vr extends Ia{async initialize(){await super.initialize(),this.value=this.initial=this.resolve(this.options.initial),this.disabled=this.options.disabled||"no",this.enabled=this.options.enabled||"yes",await this.render()}reset(){this.value=this.initial,this.render()}delete(){this.alert()}toggle(){this.value=!this.value,this.render()}enable(){if(this.value===!0)return this.alert();this.value=!0,this.render()}disable(){if(this.value===!1)return this.alert();this.value=!1,this.render()}up(){this.toggle()}down(){this.toggle()}right(){this.toggle()}left(){this.toggle()}next(){this.toggle()}prev(){this.toggle()}dispatch(e="",t){switch(e.toLowerCase()){case" ":return this.toggle();case"1":case"y":case"t":return this.enable();case"0":case"n":case"f":return this.disable();default:return this.alert()}}format(){let e=(s)=>this.styles.primary.underline(s);return[this.value?this.disabled:e(this.disabled),this.value?e(this.enabled):this.enabled].join(this.styles.muted(" / "))}async render(){let{size:e}=this.state,t=await this.header(),s=await this.prefix(),r=await this.separator(),i=await this.message(),o=await this.format(),n=await this.error()||await this.hint(),a=await this.footer(),p=[s,i,r,o].join(" ");if(this.state.prompt=p,n&&!p.includes(n))p+=" "+n;this.clear(e),this.write([t,p,a].filter(Boolean).join(`
35
+ `)),this.write(this.margin[2]),this.restore()}}Cr.exports=vr});var Or=g((dd,Dr)=>{var La=Q();class Br extends La{constructor(e){super(e);if(typeof this.options.correctChoice!=="number"||this.options.correctChoice<0)throw Error("Please specify the index of the correct answer from the list of choices")}async toChoices(e,t){let s=await super.toChoices(e,t);if(s.length<2)throw Error("Please give at least two choices to the user");if(this.options.correctChoice>s.length)throw Error("Please specify the index of the correct answer from the list of choices");return s}check(e){return e.index===this.options.correctChoice}async result(e){return{selectedAnswer:e,correctAnswer:this.options.choices[this.options.correctChoice].value,correct:await this.check(this.state)}}}Dr.exports=Br});var Ir=g((At)=>{var Pr=C(),M=(e,t)=>{Pr.defineExport(At,e,t),Pr.defineExport(At,e.toLowerCase(),t)};M("AutoComplete",()=>_s());M("BasicAuth",()=>Is());M("Confirm",()=>Gs());M("Editable",()=>Hs());M("Form",()=>_e());M("Input",()=>yt());M("Invisible",()=>ks());M("List",()=>sr());M("MultiSelect",()=>or());M("Numeral",()=>gt());M("Password",()=>ur());M("Scale",()=>hr());M("Select",()=>Q());M("Snippet",()=>xr());M("Sort",()=>Nr());M("Survey",()=>_r());M("Text",()=>yt());M("Toggle",()=>Rr());M("Quiz",()=>Or())});var $r=g((md,Lr)=>{Lr.exports={ArrayPrompt:ge(),AuthPrompt:ft(),BooleanPrompt:ve(),NumberPrompt:gt(),StringPrompt:pe()}});var z=g((hd,qr)=>{var Ur=he("assert"),xt=he("events"),Z=C();class $ extends xt{constructor(e,t){super();this.options=Z.merge({},e),this.answers={...t}}register(e,t){if(Z.isObject(e)){for(let r of Object.keys(e))this.register(r,e[r]);return this}Ur.equal(typeof t,"function","expected a function");let s=e.toLowerCase();if(t.prototype instanceof this.Prompt)this.prompts[s]=t;else this.prompts[s]=t(this.Prompt,this);return this}async prompt(e=[]){for(let t of[].concat(e))try{if(typeof t==="function")t=await t.call(this);await this.ask(Z.merge({},this.options,t))}catch(s){return Promise.reject(s)}return this.answers}async ask(e){if(typeof e==="function")e=await e.call(this);let t=Z.merge({},this.options,e),{type:s,name:r}=e,{set:i,get:o}=Z;if(typeof s==="function")s=await s.call(this,e,this.answers);if(!s)return this.answers[r];if(s==="number")s="numeral";Ur(this.prompts[s],`Prompt "${s}" is not registered`);let n=new this.prompts[s](t),a=o(this.answers,r);if(n.state.answers=this.answers,n.enquirer=this,r)n.on("submit",(l)=>{this.emit("answer",r,l,n),i(this.answers,r,l)});let p=n.emit.bind(n);if(n.emit=(...l)=>{return this.emit.call(this,...l),p(...l)},this.emit("prompt",n,this),t.autofill&&a!=null){if(n.value=n.input=a,t.autofill==="show")await n.submit()}else a=n.value=await n.run();return a}use(e){return e.call(this,this),this}set Prompt(e){this._Prompt=e}get Prompt(){return this._Prompt||this.constructor.Prompt}get prompts(){return this.constructor.prompts}static set Prompt(e){this._Prompt=e}static get Prompt(){return this._Prompt||ue()}static get prompts(){return Ir()}static get types(){return $r()}static get prompt(){let e=(t,...s)=>{let r=new this(...s),i=r.emit.bind(r);return r.emit=(...o)=>{return e.emit(...o),i(...o)},r.prompt(t)};return Z.mixinEmitter(e,new xt),e}}Z.mixinEmitter($,new xt);var bt=$.prompts;for(let e of Object.keys(bt)){let t=e.toLowerCase(),s=(r)=>new bt[e](r).run();if($.prompt[t]=s,$[t]=s,!$[e])Reflect.defineProperty($,e,{get:()=>bt[e]})}var Ee=(e)=>{Z.defineExport($,e,()=>$.types[e])};Ee("ArrayPrompt");Ee("AuthPrompt");Ee("BooleanPrompt");Ee("NumberPrompt");Ee("StringPrompt");qr.exports=$});var zi=g((vt,Ct)=>{(function(e,t){if(typeof vt==="object"&&typeof Ct==="object")Ct.exports=t();else if(typeof define==="function"&&define.amd)define(function(){return t()});else e.pluralize=t()})(vt,function(){var e=[],t=[],s={},r={},i={};function o(d){if(typeof d==="string")return new RegExp("^"+d+"$","i");return d}function n(d,m){if(d===m)return m;if(d===d.toLowerCase())return m.toLowerCase();if(d===d.toUpperCase())return m.toUpperCase();if(d[0]===d[0].toUpperCase())return m.charAt(0).toUpperCase()+m.substr(1).toLowerCase();return m.toLowerCase()}function a(d,m){return d.replace(/\$(\d{1,2})/g,function(y,S){return m[S]||""})}function p(d,m){return d.replace(m[0],function(y,S){var f=a(m[1],arguments);if(y==="")return n(d[S-1],f);return n(y,f)})}function l(d,m,y){if(!d.length||s.hasOwnProperty(d))return m;var S=y.length;while(S--){var f=y[S];if(f[0].test(m))return p(m,f)}return m}function u(d,m,y){return function(S){var f=S.toLowerCase();if(m.hasOwnProperty(f))return n(S,f);if(d.hasOwnProperty(f))return n(S,d[f]);return l(f,S,y)}}function c(d,m,y,S){return function(f){var E=f.toLowerCase();if(m.hasOwnProperty(E))return!0;if(d.hasOwnProperty(E))return!1;return l(E,E,y)===E}}function h(d,m,y){var S=m===1?h.singular(d):h.plural(d);return(y?m+" ":"")+S}return h.plural=u(i,r,e),h.isPlural=c(i,r,e),h.singular=u(r,i,t),h.isSingular=c(r,i,t),h.addPluralRule=function(d,m){e.push([o(d),m])},h.addSingularRule=function(d,m){t.push([o(d),m])},h.addUncountableRule=function(d){if(typeof d==="string"){s[d.toLowerCase()]=!0;return}h.addPluralRule(d,"$0"),h.addSingularRule(d,"$0")},h.addIrregularRule=function(d,m){m=m.toLowerCase(),d=d.toLowerCase(),i[d]=m,r[m]=d},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"]].forEach(function(d){return h.addIrregularRule(d[0],d[1])}),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(d){return h.addPluralRule(d[0],d[1])}),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(d){return h.addSingularRule(d[0],d[1])}),["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","species","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[e\u00E9]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(h.addUncountableRule),h})});import{parseArgs as hu}from"util";import{TerminalLogger as fu}from"@ooneex/logger";import{container as $o}from"@ooneex/container";var xe=[];var Dt=(e)=>{let t=null;return xe.find((s)=>{return t=$o.get(s),t.getName()===e}),t};import{join as X}from"path";import{TerminalLogger as Ha}from"@ooneex/logger";import{toPascalCase as Ya}from"@ooneex/utils";import{container as Uo,EContainerScope as qo}from"@ooneex/container";var b={command:(e=qo.Singleton)=>{return(t)=>{Uo.add(t,e),xe.push(t)}}};var Gr=Y(z(),1);import{Assert as $a,Validation as Ua}from"@ooneex/validation";var qa=1,Ga=/^[a-zA-Z0-9]+$/;class wt extends Ua{getConstraint(){return $a(`string >= ${qa}`)}getErrorMessage(){return"Name must contain only letters, and numbers"}validate(e,t){let s=super.validate(e,t);if(!s.isValid)return s;let r=e;if(!Ga.test(r))return{isValid:!1,message:this.getErrorMessage()||"Invalid name format"};return{isValid:!0}}}var x=async(e)=>{return(await Gr.prompt({type:"input",name:"name",message:e.message,validate:(s)=>{let i=new wt().validate(s);if(!i.isValid)return i.message||"Controller name is invalid";return!0}})).name};var Kr=`import { describe, expect, test } from "bun:test";
4
36
  import { {{NAME}}Ai } from "@/ai/{{NAME}}Ai";
5
37
 
6
38
  describe("{{NAME}}Ai", () => {
@@ -18,7 +50,7 @@ describe("{{NAME}}Ai", () => {
18
50
  expect(typeof {{NAME}}Ai.prototype.runStream).toBe("function");
19
51
  });
20
52
  });
21
- `;var Me=`import { decorator, type IAiChat, OpenAi, type OpenAiConfigType } from "@ooneex/ai";
53
+ `;var Wr=`import { decorator, type IAiChat, OpenAi, type OpenAiConfigType } from "@ooneex/ai";
22
54
  import { inject } from "@ooneex/container";
23
55
 
24
56
  @decorator.ai()
@@ -36,7 +68,7 @@ export class {{NAME}}Ai implements IAiChat<OpenAiConfigType> {
36
68
  yield* this.ai.runStream(prompt || "My prompt", config);
37
69
  }
38
70
  }
39
- `;class Y{getName(){return"make:ai"}getDescription(){return"Generate a new AI class"}async run(r){let{name:e}=r;if(!e)e=await y({message:"Enter name"});e=yo(e).replace(/Ai$/,"");let t=Me.replace(/{{NAME}}/g,e),o=O("src","ai"),s=O(process.cwd(),o),i=O(s,`${e}Ai.ts`);await Bun.write(i,t);let a=we.replace(/{{NAME}}/g,e),n=O("tests","ai"),c=O(process.cwd(),n),p=O(c,`${e}Ai.spec.ts`);await Bun.write(p,a);let l=new uo;l.success(`${O(o,e)}Ai.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),l.success(`${O(n,e)}Ai.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Y=m([u.command()],Y);import{join as D}from"path";import{TerminalLogger as go}from"@ooneex/logger";import{toPascalCase as Eo}from"@ooneex/utils";var Ne=`import { describe, expect, test } from "bun:test";
71
+ `;class Re{getName(){return"make:ai"}getDescription(){return"Generate a new AI class"}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter name"});t=Ya(t).replace(/Ai$/,"");let s=Wr.replace(/{{NAME}}/g,t),r=X("src","ai"),i=X(process.cwd(),r),o=X(i,`${t}Ai.ts`);await Bun.write(o,s);let n=Kr.replace(/{{NAME}}/g,t),a=X("tests","ai"),p=X(process.cwd(),a),l=X(p,`${t}Ai.spec.ts`);await Bun.write(l,n);let u=new Ha;u.success(`${X(r,t)}Ai.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),u.success(`${X(a,t)}Ai.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Re=A([b.command()],Re);import{join as J}from"path";import{TerminalLogger as Qa}from"@ooneex/logger";import{toPascalCase as Za}from"@ooneex/utils";var Hr=`import { describe, expect, test } from "bun:test";
40
72
  import { {{NAME}}Analytics } from "@/analytics/{{NAME}}Analytics";
41
73
 
42
74
  describe("{{NAME}}Analytics", () => {
@@ -49,7 +81,7 @@ describe("{{NAME}}Analytics", () => {
49
81
  expect(typeof {{NAME}}Analytics.prototype.capture).toBe("function");
50
82
  });
51
83
  });
52
- `;var Se=`import { decorator } from "@ooneex/analytics";
84
+ `;var Yr=`import { decorator } from "@ooneex/analytics";
53
85
  import type { IAnalytics } from "@ooneex/analytics";
54
86
 
55
87
  type CaptureOptionsType = Record<string, unknown>;
@@ -60,7 +92,7 @@ export class {{NAME}}Analytics<T extends CaptureOptionsType = CaptureOptionsType
60
92
  // console.log("Analytics captured:", options);
61
93
  }
62
94
  }
63
- `;class V{getName(){return"make:analytics"}getDescription(){return"Generate a new analytics class"}async run(r){let{name:e}=r;if(!e)e=await y({message:"Enter analytics name"});e=Eo(e).replace(/Analytics$/,"");let t=Se.replace(/{{NAME}}/g,e),o=D("src","analytics"),s=D(process.cwd(),o),i=D(s,`${e}Analytics.ts`);await Bun.write(i,t);let a=Ne.replace(/{{NAME}}/g,e),n=D("tests","analytics"),c=D(process.cwd(),n),p=D(c,`${e}Analytics.spec.ts`);await Bun.write(p,a);let l=new go;l.success(`${D(o,e)}Analytics.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),l.success(`${D(n,e)}Analytics.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}V=m([u.command()],V);import{join as A}from"path";import{TerminalLogger as $o}from"@ooneex/logger";import{toKebabCase as Go}from"@ooneex/utils";import{prompt as Ao}from"enquirer";var Te=async(r)=>{return(await Ao({type:"input",name:"destination",message:r.message,initial:r.initial||".",validate:(t)=>{if(!t||t.trim()==="")return"Destination path is required";return!0}})).destination};var Re=`import { RuleConfigSeverity, type UserConfig } from "@commitlint/types";
95
+ `;class Be{getName(){return"make:analytics"}getDescription(){return"Generate a new analytics class"}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter analytics name"});t=Za(t).replace(/Analytics$/,"");let s=Yr.replace(/{{NAME}}/g,t),r=J("src","analytics"),i=J(process.cwd(),r),o=J(i,`${t}Analytics.ts`);await Bun.write(o,s);let n=Hr.replace(/{{NAME}}/g,t),a=J("tests","analytics"),p=J(process.cwd(),a),l=J(p,`${t}Analytics.spec.ts`);await Bun.write(l,n);let u=new Qa;u.success(`${J(r,t)}Analytics.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),u.success(`${J(a,t)}Analytics.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Be=A([b.command()],Be);import{join as D}from"path";import{TerminalLogger as mp}from"@ooneex/logger";import{toKebabCase as hp}from"@ooneex/utils";var Vr=Y(z(),1),Fr=async(e)=>{return(await Vr.prompt({type:"input",name:"destination",message:e.message,initial:e.initial||".",validate:(s)=>{if(!s||s.trim()==="")return"Destination path is required";return!0}})).destination};var Qr=`import { RuleConfigSeverity, type UserConfig } from "@commitlint/types";
64
96
 
65
97
  const Configuration: UserConfig = {
66
98
  extends: ["@commitlint/config-conventional"],
@@ -201,7 +233,7 @@ const Configuration: UserConfig = {
201
233
  };
202
234
 
203
235
  export default Configuration;
204
- `;var _e=`# Logs
236
+ `;var Zr=`# Logs
205
237
  logs
206
238
  *.log
207
239
  npm-debug.log*
@@ -351,7 +383,7 @@ vite.config.ts.timestamp-*
351
383
 
352
384
  # Application
353
385
  var/
354
- `;var Oe=`{
386
+ `;var zr=`{
355
387
  "$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
356
388
  "vcs": {
357
389
  "enabled": true,
@@ -430,7 +462,7 @@ var/
430
462
  }
431
463
  }
432
464
  }
433
- `;var De=`[test]
465
+ `;var Xr=`[test]
434
466
  coverage = true
435
467
 
436
468
  [workspace]
@@ -463,7 +495,7 @@ buildDependencies = [
463
495
  "@swc/core",
464
496
  "nx",
465
497
  ]
466
- `;var fe=`# =============================================================================
498
+ `;var St=`# =============================================================================
467
499
  # App
468
500
  # =============================================================================
469
501
 
@@ -619,7 +651,7 @@ POLAR_ENVIRONMENT=
619
651
 
620
652
  # Clerk authentication secret key
621
653
  CLERK_SECRET_KEY=
622
- `;var Be=`import { PostHogAnalytics } from "@ooneex/analytics";
654
+ `;var Jr=`import { PostHogAnalytics } from "@ooneex/analytics";
623
655
  import { App } from "@ooneex/app";
624
656
  import { AppEnv, type EnvType } from "@ooneex/app-env";
625
657
  import { RedisCache } from "@ooneex/cache";
@@ -651,7 +683,7 @@ const app = new App({
651
683
  });
652
684
 
653
685
  await app.run();
654
- `;var Ce=`{
686
+ `;var jr=`{
655
687
  "$schema": "./node_modules/nx/schemas/nx-schema.json",
656
688
  "targetDefaults": {
657
689
  "build": {
@@ -681,7 +713,7 @@ await app.run();
681
713
  ],
682
714
  "packageManager": "bun"
683
715
  }
684
- `;var Pe=`{
716
+ `;var kr=`{
685
717
  "name": "{{NAME}}",
686
718
  "module": "index.ts",
687
719
  "private": true,
@@ -756,7 +788,7 @@ await app.run();
756
788
  ]
757
789
  }
758
790
  }
759
- `;var Ie=`{
791
+ `;var ei=`{
760
792
  "compilerOptions": {
761
793
  "jsx": "react-jsx",
762
794
  "lib": ["ES2022", "DOM"],
@@ -784,7 +816,7 @@ await app.run();
784
816
  },
785
817
  "exclude": ["node_modules", ".github", ".husky", ".nx", ".zed", ".vscode"]
786
818
  }
787
- `;import{join as E}from"path";import{TerminalLogger as Io}from"@ooneex/logger";import{toKebabCase as Lo,toPascalCase as Uo}from"@ooneex/utils";var Le=`#!/usr/bin/env bun
819
+ `;import{join as B}from"path";import{TerminalLogger as up}from"@ooneex/logger";import{toKebabCase as dp,toPascalCase as cp}from"@ooneex/utils";var ti=`#!/usr/bin/env bun
788
820
 
789
821
  import { migrationUp } from "@ooneex/migrations";
790
822
  import "@/migrations/migrations";
@@ -793,7 +825,7 @@ await migrationUp({
793
825
  databaseUrl: Bun.env.DATABASE_URL || ":memory:",
794
826
  tableName: "migrations",
795
827
  });
796
- `;var Ue=`import type { ModuleType } from "@ooneex/module";
828
+ `;var si=`import type { ModuleType } from "@ooneex/module";
797
829
 
798
830
  export const {{NAME}}Module: ModuleType = {
799
831
  controllers: [],
@@ -803,7 +835,7 @@ export const {{NAME}}Module: ModuleType = {
803
835
  cronJobs: [],
804
836
  events: [],
805
837
  };
806
- `;var $e=`{
838
+ `;var ri=`{
807
839
  "name": "@module/{{NAME}}",
808
840
  "description": "",
809
841
  "version": "0.0.1",
@@ -814,13 +846,13 @@ export const {{NAME}}Module: ModuleType = {
814
846
  "seed:run": "bun run ./bin/bin/run.ts"
815
847
  }
816
848
  }
817
- `;var Ge=`#!/usr/bin/env bun
849
+ `;var ii=`#!/usr/bin/env bun
818
850
 
819
851
  import { seedRun } from "@ooneex/seeds";
820
852
  import "@/seeds/seeds";
821
853
 
822
854
  await seedRun();
823
- `;var We=`import { describe, expect, test } from "bun:test";
855
+ `;var oi=`import { describe, expect, test } from "bun:test";
824
856
  import { {{NAME}}Module } from "@/{{NAME}}Module";
825
857
 
826
858
  describe("{{NAME}}Module", () => {
@@ -844,7 +876,7 @@ describe("{{NAME}}Module", () => {
844
876
  expect(Array.isArray({{NAME}}Module.events)).toBe(true);
845
877
  });
846
878
  });
847
- `;var Ke=`{
879
+ `;var ni=`{
848
880
  "extends": "../../tsconfig.json",
849
881
  "compilerOptions": {
850
882
  "types": ["@types/bun"],
@@ -855,10 +887,10 @@ describe("{{NAME}}Module", () => {
855
887
  "include": ["src/**/*.ts", "src/**/*.tsx", "tests/**/*.ts", "tests/**/*.tsx"],
856
888
  "exclude": ["node_modules", "dist"]
857
889
  }
858
- `;class W{getName(){return"make:module"}getDescription(){return"Generate a new module"}async addToAppModule(r,e,t){let o=await Bun.file(r).text(),s=`${e}Module`,i=`@${t}/${s}`,a=`import { ${s} } from "${i}";
859
- `,n=o.lastIndexOf("import "),c=o.indexOf(`
860
- `,n);o=`${o.slice(0,c+1)}${a}${o.slice(c+1)}`;let p=["controllers","entities","permissions","middlewares","cronJobs","events"];for(let l of p){let f=new RegExp(`(${l}:\\s*\\[)([^\\]]*)`,"s"),d=o.match(f);if(d){let h=d[2]?.trim(),g=`...${s}.${l}`,x=h?`${h}, ${g}`:g;o=o.replace(f,`$1${x}`)}}await Bun.write(r,o)}async addPathAlias(r,e){let t=await Bun.file(r).text(),o=JSON.parse(t);o.compilerOptions??={},o.compilerOptions.paths??={},o.compilerOptions.paths[`@${e}/*`]=[`../${e}/src/*`],await Bun.write(r,`${JSON.stringify(o,null,2)}
861
- `)}async run(r){let{cwd:e=process.cwd(),silent:t=!1,skipBin:o=!1,skipMigrations:s=!1,skipSeeds:i=!1}=r,{name:a}=r;if(!a)a=await y({message:"Enter module name"});let n=Uo(a).replace(/Module$/,""),c=Lo(n),p=E(e,"modules",c),l=E(p,"bin"),f=E(p,"src"),d=E(p,"tests"),h=Ue.replace(/{{NAME}}/g,n),g=$e.replace(/{{NAME}}/g,c),x=We.replace(/{{NAME}}/g,n);if(!o)await Bun.write(E(l,"migration","up.ts"),Le),await Bun.write(E(l,"seed","run.ts"),Ge);if(await Bun.write(E(f,`${n}Module.ts`),h),!s)await Bun.write(E(f,"migrations","migrations.ts"),"");if(!i)await Bun.write(E(f,"seeds","seeds.ts"),"");await Bun.write(E(p,"package.json"),g),await Bun.write(E(p,"tsconfig.json"),Ke),await Bun.write(E(d,`${n}Module.spec.ts`),x);let R=E(e,"modules","app","src","AppModule.ts");if(await Bun.file(R).exists())await this.addToAppModule(R,n,c);let _=E(e,"modules","app","tsconfig.json");if(await Bun.file(_).exists())await this.addPathAlias(_,c);if(!t)new Io().success(`modules/${c} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}W=m([u.command()],W);class F{getName(){return"make:app"}getDescription(){return"Generate a new application"}async run(r){let{name:e,destination:t}=r;if(!e)e=await y({message:"Enter application name"});let o=Go(e);if(!t)t=await Te({message:"Enter destination path",initial:o});let s=Pe.replace(/{{NAME}}/g,o);await Bun.write(A(t,".commitlintrc.ts"),Re),await Bun.write(A(t,".env"),fe),await Bun.write(A(t,".env.example"),fe),await Bun.write(A(t,".gitignore"),_e),await Bun.write(A(t,"biome.jsonc"),Oe),await Bun.write(A(t,"bunfig.toml"),De),await Bun.write(A(t,"nx.json"),Ce),await Bun.write(A(t,"package.json"),s),await Bun.write(A(t,"tsconfig.json"),Ie),await new W().run({name:"app",cwd:t,silent:!0,skipBin:!0,skipMigrations:!0,skipSeeds:!0}),await Bun.write(A(t,".husky","commit-msg"),'bunx commitlint --edit "$1"'),await Bun.write(A(t,".husky","pre-commit"),"lint-staged"),await Bun.write(A(t,"modules","app","src","index.ts"),Be),await Bun.write(A(t,"modules","app","var",".gitkeep"),""),new $o().success(`${o} created successfully at ${t}`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}F=m([u.command()],F);import{join as B}from"path";import{TerminalLogger as ko}from"@ooneex/logger";import{toPascalCase as qo}from"@ooneex/utils";var ke=`import { describe, expect, test } from "bun:test";
890
+ `;class ce{getName(){return"make:module"}getDescription(){return"Generate a new module"}async addToAppModule(e,t,s){let r=await Bun.file(e).text(),i=`${t}Module`,o=`@${s}/${i}`,n=`import { ${i} } from "${o}";
891
+ `,a=r.lastIndexOf("import "),p=r.indexOf(`
892
+ `,a);r=`${r.slice(0,p+1)}${n}${r.slice(p+1)}`;let l=["controllers","entities","permissions","middlewares","cronJobs","events"];for(let u of l){let c=new RegExp(`(${u}:\\s*\\[)([^\\]]*)`,"s"),h=r.match(c);if(h){let d=h[2]?.trim(),m=`...${i}.${u}`,y=d?`${d}, ${m}`:m;r=r.replace(c,`$1${y}`)}}await Bun.write(e,r)}async addPathAlias(e,t){let s=await Bun.file(e).text(),r=JSON.parse(s);r.compilerOptions??={},r.compilerOptions.paths??={},r.compilerOptions.paths[`@${t}/*`]=[`../${t}/src/*`],await Bun.write(e,`${JSON.stringify(r,null,2)}
893
+ `)}async run(e){let{cwd:t=process.cwd(),silent:s=!1,skipBin:r=!1,skipMigrations:i=!1,skipSeeds:o=!1}=e,{name:n}=e;if(!n)n=await x({message:"Enter module name"});let a=cp(n).replace(/Module$/,""),p=dp(a),l=B(t,"modules",p),u=B(l,"bin"),c=B(l,"src"),h=B(l,"tests"),d=si.replace(/{{NAME}}/g,a),m=ri.replace(/{{NAME}}/g,p),y=oi.replace(/{{NAME}}/g,a);if(!r)await Bun.write(B(u,"migration","up.ts"),ti),await Bun.write(B(u,"seed","run.ts"),ii);if(await Bun.write(B(c,`${a}Module.ts`),d),!i)await Bun.write(B(c,"migrations","migrations.ts"),"");if(!o)await Bun.write(B(c,"seeds","seeds.ts"),"");await Bun.write(B(l,"package.json"),m),await Bun.write(B(l,"tsconfig.json"),ni),await Bun.write(B(h,`${a}Module.spec.ts`),y);let S=B(t,"modules","app","src","AppModule.ts");if(await Bun.file(S).exists())await this.addToAppModule(S,a,p);let f=B(t,"modules","app","tsconfig.json");if(await Bun.file(f).exists())await this.addPathAlias(f,p);if(!s)new up().success(`modules/${p} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}ce=A([b.command()],ce);class De{getName(){return"make:app"}getDescription(){return"Generate a new application"}async run(e){let{name:t,destination:s}=e;if(!t)t=await x({message:"Enter application name"});let r=hp(t);if(!s)s=await Fr({message:"Enter destination path",initial:r});let i=kr.replace(/{{NAME}}/g,r);await Bun.write(D(s,".commitlintrc.ts"),Qr),await Bun.write(D(s,".env"),St),await Bun.write(D(s,".env.example"),St),await Bun.write(D(s,".gitignore"),Zr),await Bun.write(D(s,"biome.jsonc"),zr),await Bun.write(D(s,"bunfig.toml"),Xr),await Bun.write(D(s,"nx.json"),jr),await Bun.write(D(s,"package.json"),i),await Bun.write(D(s,"tsconfig.json"),ei),await new ce().run({name:"app",cwd:s,silent:!0,skipBin:!0,skipMigrations:!0,skipSeeds:!0}),await Bun.write(D(s,".husky","commit-msg"),'bunx commitlint --edit "$1"'),await Bun.write(D(s,".husky","pre-commit"),"lint-staged"),await Bun.write(D(s,"modules","app","src","index.ts"),Jr),await Bun.write(D(s,"modules","app","var",".gitkeep"),""),new mp().success(`${r} created successfully at ${s}`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}De=A([b.command()],De);import{join as j}from"path";import{TerminalLogger as gp}from"@ooneex/logger";import{toPascalCase as Ep}from"@ooneex/utils";var ai=`import { describe, expect, test } from "bun:test";
862
894
  import { {{NAME}}Cache } from "@/cache/{{NAME}}Cache";
863
895
 
864
896
  describe("{{NAME}}Cache", () => {
@@ -886,7 +918,7 @@ describe("{{NAME}}Cache", () => {
886
918
  expect(typeof {{NAME}}Cache.prototype.has).toBe("function");
887
919
  });
888
920
  });
889
- `;var qe=`import { CacheException, decorator } from "@ooneex/cache";
921
+ `;var pi=`import { CacheException, decorator } from "@ooneex/cache";
890
922
  import type { ICache } from "@ooneex/cache";
891
923
 
892
924
  @decorator.cache()
@@ -907,7 +939,7 @@ export class {{NAME}}Cache implements ICache {
907
939
  throw new CacheException(\`Failed to check if key "\${key}" exists: Not implemented\`);
908
940
  }
909
941
  }
910
- `;class Q{getName(){return"make:cache"}getDescription(){return"Generate a new cache class"}async run(r){let{name:e}=r;if(!e)e=await y({message:"Enter cache name"});e=qo(e).replace(/Cache$/,"");let t=qe.replace(/{{NAME}}/g,e),o=B("src","cache"),s=B(process.cwd(),o),i=B(s,`${e}Cache.ts`);await Bun.write(i,t);let a=ke.replace(/{{NAME}}/g,e),n=B("tests","cache"),c=B(process.cwd(),n),p=B(c,`${e}Cache.spec.ts`);await Bun.write(p,a);let l=new ko;l.success(`${B(o,e)}Cache.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),l.success(`${B(n,e)}Cache.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Q=m([u.command()],Q);import{basename as Ho,join as K}from"path";import{TerminalLogger as Yo}from"@ooneex/logger";var{Glob:Vo}=globalThis.Bun;class z{getName(){return"make:claude:skill"}getDescription(){return"Generate Claude skills from templates"}async run(){let r=K(import.meta.dir,"..","templates","claude","skills"),e=K(".claude","skills"),t=K(process.cwd(),e),o=new Vo("*.md.txt"),s=new Yo;for await(let i of o.scan(r)){let a=await Bun.file(K(r,i)).text(),n=Ho(i,".md.txt"),c=K(t,`${n}.md`);await Bun.write(c,a),s.success(`${K(e,n)}.md created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}}z=m([u.command()],z);import{basename as ur,join as b}from"path";import{TerminalLogger as dr}from"@ooneex/logger";import{toKebabCase as yr,toPascalCase as Ae,trim as fr}from"@ooneex/utils";import{prompt as Fo}from"enquirer";var Z=async(r)=>{return(await Fo({type:"confirm",name:"confirm",message:r.message})).confirm};var k=["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD"];import{prompt as Zo}from"enquirer";import{Assert as Qo,Validation as zo}from"@ooneex/validation";class he extends zo{getConstraint(){return Qo("string >= 3")}getErrorMessage(){return`Route method must be one of: ${k.join(", ")}`}validate(r,e){let t=super.validate(r,e);if(!t.isValid)return t;let o=r;if(o.trim()!==o)return{isValid:!1,message:this.getErrorMessage()||"Invalid route method format"};let s=o.toUpperCase();if(!k.includes(s))return{isValid:!1,message:this.getErrorMessage()||"Invalid route method"};return{isValid:!0}}}var He=async(r)=>{return(await Zo({type:"select",name:"method",message:r.message,initial:r.initial??0,choices:k.map((t)=>t),validate:(t)=>{let s=new he().validate(t);if(!s.isValid)return s.message||"Route method is invalid";return!0}})).method};import{prompt as er}from"enquirer";import{Assert as Xo,Validation as Jo}from"@ooneex/validation";var jo=/^[a-zA-Z0-9]+\.[a-zA-Z0-9]+\.[a-zA-Z0-9]+$/;class ge extends Jo{getConstraint(){return Xo("string >= 7")}getErrorMessage(){return"Route name must follow format: namespace.resource.action (e.g., 'api.users.list')"}validate(r,e){let t=super.validate(r,e);if(!t.isValid)return t;let o=r;if(o.trim()!==o)return{isValid:!1,message:this.getErrorMessage()||"Invalid route name format"};if(!jo.test(o))return{isValid:!1,message:this.getErrorMessage()||"Invalid route name format"};let s=o.split(".");if(s.length!==3)return{isValid:!1,message:this.getErrorMessage()||"Invalid route name format"};let[i,a,n]=s;if(!i||!a||!n)return{isValid:!1,message:this.getErrorMessage()||"Invalid route name format"};return{isValid:!0}}}var Ye=async(r)=>{return(await er({type:"input",name:"routeName",message:r.message,validate:(t)=>{let s=new ge().validate(t);if(!s.isValid)return s.message||"Route name is invalid";return!0}})).routeName};import{prompt as ar}from"enquirer";import{Assert as tr,Validation as or}from"@ooneex/validation";var rr=1,sr=/^\/[\w\-/:]*$/,ir=/^[a-zA-Z0-9\-_]+$/,nr=/^:[a-zA-Z][a-zA-Z0-9]*$/;class Ee extends or{getConstraint(){return tr(`string >= ${rr}`)}getErrorMessage(){return"Route path must start with '/' and contain only valid segments (e.g., '/users', '/api/users/:id')"}validate(r,e){let t=super.validate(r,e);if(!t.isValid)return t;let o=r;if(o.trim()!==o)return{isValid:!1,message:this.getErrorMessage()||"Invalid route path format"};if(!o.startsWith("/"))return{isValid:!1,message:"Route path must start with '/'"};if(o.length>1&&o.endsWith("/"))return{isValid:!1,message:"Route path cannot end with '/' (except for root path)"};if(!sr.test(o))return{isValid:!1,message:this.getErrorMessage()||"Invalid route path format"};if(o==="/")return{isValid:!0};let s=o.slice(1).split("/");for(let i of s){if(!i)return{isValid:!1,message:"Route path cannot contain empty segments (double slashes)"};if(i.startsWith(":")){if(!nr.test(i))return{isValid:!1,message:`Invalid parameter segment '${i}'. Parameters must follow format ':paramName' with alphanumeric characters only`}}else if(!ir.test(i))return{isValid:!1,message:`Invalid path segment '${i}'. Segments must contain only letters, numbers, hyphens, and underscores`}}return{isValid:!0}}}var Ve=async(r)=>{return(await ar({type:"input",name:"path",message:r.message,initial:r.initial??"/",validate:(t)=>{let s=new Ee().validate(t);if(!s.isValid)return s.message||"Route path is invalid";return!0}})).path};var Fe=`import type { ContextType } from "@ooneex/socket";
942
+ `;class Oe{getName(){return"make:cache"}getDescription(){return"Generate a new cache class"}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter cache name"});t=Ep(t).replace(/Cache$/,"");let s=pi.replace(/{{NAME}}/g,t),r=j("src","cache"),i=j(process.cwd(),r),o=j(i,`${t}Cache.ts`);await Bun.write(o,s);let n=ai.replace(/{{NAME}}/g,t),a=j("tests","cache"),p=j(process.cwd(),a),l=j(p,`${t}Cache.spec.ts`);await Bun.write(l,n);let u=new gp;u.success(`${j(r,t)}Cache.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),u.success(`${j(a,t)}Cache.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Oe=A([b.command()],Oe);import{basename as Ap,join as me}from"path";import{TerminalLogger as bp}from"@ooneex/logger";var{Glob:xp}=globalThis.Bun;class Pe{getName(){return"make:claude:skill"}getDescription(){return"Generate Claude skills from templates"}async run(){let e=me(import.meta.dir,"..","templates","claude","skills"),t=me(".claude","skills"),s=me(process.cwd(),t),r=new xp("*.md.txt"),i=new bp;for await(let o of r.scan(e)){let n=await Bun.file(me(e,o)).text(),a=Ap(o,".md.txt"),p=me(s,`${a}.md`);await Bun.write(p,n),i.success(`${me(t,a)}.md created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}}Pe=A([b.command()],Pe);import{basename as $p,join as O}from"path";import{TerminalLogger as Up}from"@ooneex/logger";import{toKebabCase as qp,toPascalCase as _t,trim as Gp}from"@ooneex/utils";var li=Y(z(),1),Ie=async(e)=>{return(await li.prompt({type:"confirm",name:"confirm",message:e.message})).confirm};var Ae=["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD"];var ui=Y(z(),1);import{Assert as wp,Validation as Sp}from"@ooneex/validation";class Nt extends Sp{getConstraint(){return wp("string >= 3")}getErrorMessage(){return`Route method must be one of: ${Ae.join(", ")}`}validate(e,t){let s=super.validate(e,t);if(!s.isValid)return s;let r=e;if(r.trim()!==r)return{isValid:!1,message:this.getErrorMessage()||"Invalid route method format"};let i=r.toUpperCase();if(!Ae.includes(i))return{isValid:!1,message:this.getErrorMessage()||"Invalid route method"};return{isValid:!0}}}var di=async(e)=>{return(await ui.prompt({type:"select",name:"method",message:e.message,initial:e.initial??0,choices:Ae.map((s)=>s),validate:(s)=>{let i=new Nt().validate(s);if(!i.isValid)return i.message||"Route method is invalid";return!0}})).method};var ci=Y(z(),1);import{Assert as Np,Validation as Mp}from"@ooneex/validation";var Tp=/^[a-zA-Z0-9]+\.[a-zA-Z0-9]+\.[a-zA-Z0-9]+$/;class Mt extends Mp{getConstraint(){return Np("string >= 7")}getErrorMessage(){return"Route name must follow format: namespace.resource.action (e.g., 'api.users.list')"}validate(e,t){let s=super.validate(e,t);if(!s.isValid)return s;let r=e;if(r.trim()!==r)return{isValid:!1,message:this.getErrorMessage()||"Invalid route name format"};if(!Tp.test(r))return{isValid:!1,message:this.getErrorMessage()||"Invalid route name format"};let i=r.split(".");if(i.length!==3)return{isValid:!1,message:this.getErrorMessage()||"Invalid route name format"};let[o,n,a]=i;if(!o||!n||!a)return{isValid:!1,message:this.getErrorMessage()||"Invalid route name format"};return{isValid:!0}}}var mi=async(e)=>{return(await ci.prompt({type:"input",name:"routeName",message:e.message,validate:(s)=>{let i=new Mt().validate(s);if(!i.isValid)return i.message||"Route name is invalid";return!0}})).routeName};var hi=Y(z(),1);import{Assert as _p,Validation as vp}from"@ooneex/validation";var Cp=1,Rp=/^\/[\w\-/:]*$/,Bp=/^[a-zA-Z0-9\-_]+$/,Dp=/^:[a-zA-Z][a-zA-Z0-9]*$/;class Tt extends vp{getConstraint(){return _p(`string >= ${Cp}`)}getErrorMessage(){return"Route path must start with '/' and contain only valid segments (e.g., '/users', '/api/users/:id')"}validate(e,t){let s=super.validate(e,t);if(!s.isValid)return s;let r=e;if(r.trim()!==r)return{isValid:!1,message:this.getErrorMessage()||"Invalid route path format"};if(!r.startsWith("/"))return{isValid:!1,message:"Route path must start with '/'"};if(r.length>1&&r.endsWith("/"))return{isValid:!1,message:"Route path cannot end with '/' (except for root path)"};if(!Rp.test(r))return{isValid:!1,message:this.getErrorMessage()||"Invalid route path format"};if(r==="/")return{isValid:!0};let i=r.slice(1).split("/");for(let o of i){if(!o)return{isValid:!1,message:"Route path cannot contain empty segments (double slashes)"};if(o.startsWith(":")){if(!Dp.test(o))return{isValid:!1,message:`Invalid parameter segment '${o}'. Parameters must follow format ':paramName' with alphanumeric characters only`}}else if(!Bp.test(o))return{isValid:!1,message:`Invalid path segment '${o}'. Segments must contain only letters, numbers, hyphens, and underscores`}}return{isValid:!0}}}var fi=async(e)=>{return(await hi.prompt({type:"input",name:"path",message:e.message,initial:e.initial??"/",validate:(s)=>{let i=new Tt().validate(s);if(!i.isValid)return i.message||"Route path is invalid";return!0}})).path};var yi=`import type { ContextType } from "@ooneex/socket";
911
943
  import { ERole } from "@ooneex/role";
912
944
  import { Route } from "@ooneex/routing";
913
945
  import { Assert } from "@ooneex/validation";
@@ -940,7 +972,7 @@ export class {{NAME}}Controller {
940
972
  });
941
973
  }
942
974
  }
943
- `;var Qe=`import { describe, expect, test } from "bun:test";
975
+ `;var gi=`import { describe, expect, test } from "bun:test";
944
976
  import { {{NAME}}Controller } from "@/controllers/{{NAME}}Controller";
945
977
 
946
978
  describe("{{NAME}}Controller", () => {
@@ -953,7 +985,7 @@ describe("{{NAME}}Controller", () => {
953
985
  expect(typeof {{NAME}}Controller.prototype.index).toBe("function");
954
986
  });
955
987
  });
956
- `;var ze=`import type { ContextType } from "@ooneex/controller";
988
+ `;var Ei=`import type { ContextType } from "@ooneex/controller";
957
989
  import { ERole } from "@ooneex/role";
958
990
  import { Route } from "@ooneex/routing";
959
991
  import { Assert } from "@ooneex/validation";
@@ -986,7 +1018,7 @@ export class {{NAME}}Controller {
986
1018
  });
987
1019
  }
988
1020
  }
989
- `;var Ze=`export type {{TYPE_NAME}}RouteType = {
1021
+ `;var Ai=`export type {{TYPE_NAME}}RouteType = {
990
1022
  params: {
991
1023
 
992
1024
  },
@@ -1000,9 +1032,9 @@ export class {{NAME}}Controller {
1000
1032
 
1001
1033
  },
1002
1034
  };
1003
- `;class X{getName(){return"make:controller"}getDescription(){return"Generate a new controller class"}async addToModule(r,e){let t=await Bun.file(r).text(),o=`${e}Controller`,s=`import { ${o} } from "./controllers/${o}";
1004
- `,i=t.lastIndexOf("import "),a=t.indexOf(`
1005
- `,i);t=`${t.slice(0,a+1)}${s}${t.slice(a+1)}`;let n=/(controllers:\s*\[)([^\]]*)/s,c=t.match(n);if(c){let p=c[2]?.trim(),l=p?`${p}, ${o}`:o;t=t.replace(n,`$1${l}`)}await Bun.write(r,t)}async run(r){let{name:e,isSocket:t}=r;if(!e)e=await y({message:"Enter controller name"});if(t===void 0)t=await Z({message:"Is this a socket controller?"});e=Ae(e).replace(/Controller$/,"");let{route:o={}}=r,i=(t?Fe:ze).replaceAll("{{NAME}}",e),a="",n="";if(!o.name)o.name=await Ye({message:"Enter route name (e.g., api.user.create)"});if(a=Ae(o.name),n=o.name,i=i.replaceAll("{{ROUTE_NAME}}",o.name).replaceAll("{{TYPE_NAME}}",a).replaceAll("{{TYPE_NAME_FILE}}",n),!o.path)o.path=await Ve({message:"Enter route path",initial:"/"});let c=`/${yr(fr(o.path,"/"))}`;if(i=i.replaceAll("{{ROUTE_PATH}}",c),!t&&!o.method)o.method=await He({message:"Enter route method"});if(!t&&o.method)i=i.replaceAll("{{ROUTE_METHOD}}",o.method.toLowerCase());let p=b("src","controllers"),l=b(process.cwd(),p),f=b(l,`${e}Controller.ts`);await Bun.write(f,i);let d=b("src","types","routes"),h=b(process.cwd(),d),g=b(h,`${n}.ts`),x=Ze.replaceAll("{{TYPE_NAME}}",a);await Bun.write(g,x);let R=Qe.replace(/{{NAME}}/g,e),_=b("tests","controllers"),q=b(process.cwd(),_),eo=b(q,`${e}Controller.spec.ts`);await Bun.write(eo,R);let to=Ae(ur(process.cwd())),xe=b(process.cwd(),"src",`${to}Module.ts`);if(await Bun.file(xe).exists())await this.addToModule(xe,e);let de=new dr;de.success(`${b(p,e)}Controller.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),de.success(`${b(d,n)}.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),de.success(`${b(_,e)}Controller.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}X=m([u.command()],X);import{basename as Er,join as w}from"path";import{TerminalLogger as Ar}from"@ooneex/logger";import{toPascalCase as je}from"@ooneex/utils";var Xe=`import { describe, expect, test } from "bun:test";
1035
+ `;class Le{getName(){return"make:controller"}getDescription(){return"Generate a new controller class"}async addToModule(e,t){let s=await Bun.file(e).text(),r=`${t}Controller`,i=`import { ${r} } from "./controllers/${r}";
1036
+ `,o=s.lastIndexOf("import "),n=s.indexOf(`
1037
+ `,o);s=`${s.slice(0,n+1)}${i}${s.slice(n+1)}`;let a=/(controllers:\s*\[)([^\]]*)/s,p=s.match(a);if(p){let l=p[2]?.trim(),u=l?`${l}, ${r}`:r;s=s.replace(a,`$1${u}`)}await Bun.write(e,s)}async run(e){let{name:t,isSocket:s}=e;if(!t)t=await x({message:"Enter controller name"});if(s===void 0)s=await Ie({message:"Is this a socket controller?"});t=_t(t).replace(/Controller$/,"");let{route:r={}}=e,o=(s?yi:Ei).replaceAll("{{NAME}}",t),n="",a="";if(!r.name)r.name=await mi({message:"Enter route name (e.g., api.user.create)"});if(n=_t(r.name),a=r.name,o=o.replaceAll("{{ROUTE_NAME}}",r.name).replaceAll("{{TYPE_NAME}}",n).replaceAll("{{TYPE_NAME_FILE}}",a),!r.path)r.path=await fi({message:"Enter route path",initial:"/"});let p=`/${qp(Gp(r.path,"/"))}`;if(o=o.replaceAll("{{ROUTE_PATH}}",p),!s&&!r.method)r.method=await di({message:"Enter route method"});if(!s&&r.method)o=o.replaceAll("{{ROUTE_METHOD}}",r.method.toLowerCase());let l=O("src","controllers"),u=O(process.cwd(),l),c=O(u,`${t}Controller.ts`);await Bun.write(c,o);let h=O("src","types","routes"),d=O(process.cwd(),h),m=O(d,`${a}.ts`),y=Ai.replaceAll("{{TYPE_NAME}}",n);await Bun.write(m,y);let S=gi.replace(/{{NAME}}/g,t),f=O("tests","controllers"),E=O(process.cwd(),f),w=O(E,`${t}Controller.spec.ts`);await Bun.write(w,S);let N=_t($p(process.cwd())),T=O(process.cwd(),"src",`${N}Module.ts`);if(await Bun.file(T).exists())await this.addToModule(T,t);let v=new Up;v.success(`${O(l,t)}Controller.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),v.success(`${O(h,a)}.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),v.success(`${O(f,t)}Controller.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Le=A([b.command()],Le);import{basename as Hp,join as q}from"path";import{TerminalLogger as Yp}from"@ooneex/logger";import{toPascalCase as wi}from"@ooneex/utils";var bi=`import { describe, expect, test } from "bun:test";
1006
1038
  import { {{NAME}}Cron } from "@/cron/{{NAME}}Cron";
1007
1039
 
1008
1040
  describe("{{NAME}}Cron", () => {
@@ -1025,7 +1057,7 @@ describe("{{NAME}}Cron", () => {
1025
1057
  expect(typeof {{NAME}}Cron.prototype.handler).toBe("function");
1026
1058
  });
1027
1059
  });
1028
- `;var Je=`import type { TimeZoneType } from "@ooneex/country";
1060
+ `;var xi=`import type { TimeZoneType } from "@ooneex/country";
1029
1061
  import type { CronTimeType } from "@ooneex/cron";
1030
1062
  import { Cron, decorator } from "@ooneex/cron";
1031
1063
 
@@ -1046,9 +1078,9 @@ export class {{NAME}}Cron extends Cron {
1046
1078
  // console.log("{{NAME}}Cron handler executed");
1047
1079
  }
1048
1080
  }
1049
- `;class J{getName(){return"make:cron"}getDescription(){return"Generate a new cron class"}async addToModule(r,e){let t=await Bun.file(r).text(),o=`${e}Cron`,s=`import { ${o} } from "./cron/${o}";
1050
- `,i=t.lastIndexOf("import "),a=t.indexOf(`
1051
- `,i);t=`${t.slice(0,a+1)}${s}${t.slice(a+1)}`;let n=/(cronJobs:\s*\[)([^\]]*)/s,c=t.match(n);if(c){let p=c[2]?.trim(),l=p?`${p}, ${o}`:o;t=t.replace(n,`$1${l}`)}await Bun.write(r,t)}async run(r){let{name:e}=r;if(!e)e=await y({message:"Enter cron name"});e=je(e).replace(/Cron$/,"");let t=Je.replace(/{{NAME}}/g,e),o=w("src","cron"),s=w(process.cwd(),o),i=w(s,`${e}Cron.ts`);await Bun.write(i,t);let a=Xe.replace(/{{NAME}}/g,e),n=w("tests","cron"),c=w(process.cwd(),n),p=w(c,`${e}Cron.spec.ts`);await Bun.write(p,a);let l=je(Er(process.cwd())),f=w(process.cwd(),"src",`${l}Module.ts`);if(await Bun.file(f).exists())await this.addToModule(f,e);let d=new Ar;d.success(`${w(o,e)}Cron.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),d.success(`${w(n,e)}Cron.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}J=m([u.command()],J);import{join as C}from"path";import{TerminalLogger as vr}from"@ooneex/logger";import{toPascalCase as wr}from"@ooneex/utils";var et=`import { describe, expect, test } from "bun:test";
1081
+ `;class $e{getName(){return"make:cron"}getDescription(){return"Generate a new cron class"}async addToModule(e,t){let s=await Bun.file(e).text(),r=`${t}Cron`,i=`import { ${r} } from "./cron/${r}";
1082
+ `,o=s.lastIndexOf("import "),n=s.indexOf(`
1083
+ `,o);s=`${s.slice(0,n+1)}${i}${s.slice(n+1)}`;let a=/(cronJobs:\s*\[)([^\]]*)/s,p=s.match(a);if(p){let l=p[2]?.trim(),u=l?`${l}, ${r}`:r;s=s.replace(a,`$1${u}`)}await Bun.write(e,s)}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter cron name"});t=wi(t).replace(/Cron$/,"");let s=xi.replace(/{{NAME}}/g,t),r=q("src","cron"),i=q(process.cwd(),r),o=q(i,`${t}Cron.ts`);await Bun.write(o,s);let n=bi.replace(/{{NAME}}/g,t),a=q("tests","cron"),p=q(process.cwd(),a),l=q(p,`${t}Cron.spec.ts`);await Bun.write(l,n);let u=wi(Hp(process.cwd())),c=q(process.cwd(),"src",`${u}Module.ts`);if(await Bun.file(c).exists())await this.addToModule(c,t);let h=new Yp;h.success(`${q(r,t)}Cron.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),h.success(`${q(a,t)}Cron.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}$e=A([b.command()],$e);import{join as k}from"path";import{TerminalLogger as Qp}from"@ooneex/logger";import{toPascalCase as Zp}from"@ooneex/utils";var Si=`import { describe, expect, test } from "bun:test";
1052
1084
  import { {{NAME}}Database } from "@/databases/{{NAME}}Database";
1053
1085
 
1054
1086
  describe("{{NAME}}Database", () => {
@@ -1061,7 +1093,7 @@ describe("{{NAME}}Database", () => {
1061
1093
  expect(typeof {{NAME}}Database.prototype.getSource).toBe("function");
1062
1094
  });
1063
1095
  });
1064
- `;var tt=`import { DataSource } from "typeorm";
1096
+ `;var Ni=`import { DataSource } from "typeorm";
1065
1097
  import { TypeormDatabase, DatabaseException, decorator } from "@ooneex/database";
1066
1098
 
1067
1099
  @decorator.database()
@@ -1084,7 +1116,7 @@ export class {{NAME}}Database extends TypeormDatabase {
1084
1116
  return this.source;
1085
1117
  }
1086
1118
  }
1087
- `;class j{getName(){return"make:database"}getDescription(){return"Generate a new database class"}async run(r){let{name:e}=r;if(!e)e=await y({message:"Enter database name"});e=wr(e).replace(/DatabaseAdapter$/,"").replace(/Database$/,"");let t=tt.replace(/{{NAME}}/g,e),o=C("src","databases"),s=C(process.cwd(),o),i=C(s,`${e}Database.ts`);await Bun.write(i,t);let a=et.replace(/{{NAME}}/g,e),n=C("tests","databases"),c=C(process.cwd(),n),p=C(c,`${e}Database.spec.ts`);await Bun.write(p,a);let l=new vr;l.success(`${C(o,e)}Database.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),l.success(`${C(n,e)}Database.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}j=m([u.command()],j);import{join as wt}from"path";import{TerminalLogger as qr}from"@ooneex/logger";var{YAML:Mt}=globalThis.Bun;import{prompt as Mr}from"enquirer";var ot=["clickhouse","elasticsearch","grafana","jaeger","keycloak","libretranslate","maildev","memcached","minio","mongodb","mysql","nats","postgres","prometheus","rabbitmq","redis","temporal","vault"],rt=async(r)=>{return(await Mr({type:"autocomplete",name:"service",message:r.message,initial:r.initial,choices:ot.map((t)=>t),validate:(t)=>{if(!ot.includes(t))return"Docker service is invalid";return!0}})).service};var st=`services:
1119
+ `;class Ue{getName(){return"make:database"}getDescription(){return"Generate a new database class"}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter database name"});t=Zp(t).replace(/DatabaseAdapter$/,"").replace(/Database$/,"");let s=Ni.replace(/{{NAME}}/g,t),r=k("src","databases"),i=k(process.cwd(),r),o=k(i,`${t}Database.ts`);await Bun.write(o,s);let n=Si.replace(/{{NAME}}/g,t),a=k("tests","databases"),p=k(process.cwd(),a),l=k(p,`${t}Database.spec.ts`);await Bun.write(l,n);let u=new Qp;u.success(`${k(r,t)}Database.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),u.success(`${k(a,t)}Database.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ue=A([b.command()],Ue);import{join as Qi}from"path";import{TerminalLogger as ml}from"@ooneex/logger";var{YAML:Zi}=globalThis.Bun;var Ti=Y(z(),1),Mi=["clickhouse","elasticsearch","grafana","jaeger","keycloak","libretranslate","maildev","memcached","minio","mongodb","mysql","nats","postgres","prometheus","rabbitmq","redis","temporal","vault"],_i=async(e)=>{return(await Ti.prompt({type:"autocomplete",name:"service",message:e.message,initial:e.initial,choices:Mi.map((s)=>s),validate:(s)=>{if(!Mi.includes(s))return"Docker service is invalid";return!0}})).service};var vi=`services:
1088
1120
  # ClickHouse - Column-oriented OLAP database for analytics
1089
1121
  # Docs: https://clickhouse.com/docs
1090
1122
  # HTTP API: http://localhost:8123
@@ -1105,7 +1137,7 @@ export class {{NAME}}Database extends TypeormDatabase {
1105
1137
 
1106
1138
  volumes:
1107
1139
  clickhouse_data:
1108
- `;var it=`services:
1140
+ `;var Ci=`services:
1109
1141
  # Elasticsearch - Full-text search and analytics engine
1110
1142
  # Docs: https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
1111
1143
  # HTTP API: http://localhost:9200
@@ -1126,7 +1158,7 @@ volumes:
1126
1158
 
1127
1159
  volumes:
1128
1160
  elasticsearch_data:
1129
- `;var nt=`services:
1161
+ `;var Ri=`services:
1130
1162
  # Grafana - Metrics visualization and dashboards
1131
1163
  # Docs: https://grafana.com/docs/grafana/latest/
1132
1164
  # Web UI: http://localhost:3000 (ooneex/ooneex)
@@ -1144,7 +1176,7 @@ volumes:
1144
1176
 
1145
1177
  volumes:
1146
1178
  grafana_data:
1147
- `;var at=`services:
1179
+ `;var Bi=`services:
1148
1180
  # Jaeger - Distributed tracing system
1149
1181
  # Docs: https://www.jaegertracing.io/docs/
1150
1182
  # Web UI: http://localhost:16686
@@ -1158,7 +1190,7 @@ volumes:
1158
1190
  - "16686:16686"
1159
1191
  - "6831:6831/udp"
1160
1192
  - "14268:14268"
1161
- `;var ct=`services:
1193
+ `;var Di=`services:
1162
1194
  # Keycloak - Identity and access management
1163
1195
  # Docs: https://www.keycloak.org/documentation
1164
1196
  # Admin Console: http://localhost:8080 (ooneex/ooneex)
@@ -1172,7 +1204,7 @@ volumes:
1172
1204
  - KEYCLOAK_ADMIN=ooneex
1173
1205
  - KEYCLOAK_ADMIN_PASSWORD=ooneex
1174
1206
  command: start-dev
1175
- `;var pt=`services:
1207
+ `;var Oi=`services:
1176
1208
  # LibreTranslate - Self-hosted machine translation API
1177
1209
  # Docs: https://libretranslate.com/docs/
1178
1210
  # API: http://localhost:4000
@@ -1199,7 +1231,7 @@ volumes:
1199
1231
 
1200
1232
  volumes:
1201
1233
  libretranslate_models:
1202
- `;var lt=`services:
1234
+ `;var Pi=`services:
1203
1235
  # MailDev - Email testing tool with web UI
1204
1236
  # Docs: https://github.com/maildev/maildev
1205
1237
  # Web UI: http://localhost:1080
@@ -1210,7 +1242,7 @@ volumes:
1210
1242
  ports:
1211
1243
  - "1080:1080"
1212
1244
  - "1025:1025"
1213
- `;var mt=`services:
1245
+ `;var Ii=`services:
1214
1246
  # Memcached - Distributed memory caching system
1215
1247
  # Docs: https://memcached.org/
1216
1248
  # Connection: localhost:11211
@@ -1220,7 +1252,7 @@ volumes:
1220
1252
  restart: "on-failure"
1221
1253
  ports:
1222
1254
  - "11211:11211"
1223
- `;var ut=`services:
1255
+ `;var Li=`services:
1224
1256
  # MinIO - S3-compatible object storage
1225
1257
  # Docs: https://min.io/docs/minio/container/index.html
1226
1258
  # API: http://localhost:9000
@@ -1241,7 +1273,7 @@ volumes:
1241
1273
 
1242
1274
  volumes:
1243
1275
  minio_data:
1244
- `;var dt=`services:
1276
+ `;var $i=`services:
1245
1277
  # MongoDB - NoSQL document database
1246
1278
  # Docs: https://www.mongodb.com/docs/
1247
1279
  # Connection: mongodb://ooneex:ooneex@localhost:27017/ooneex
@@ -1260,7 +1292,7 @@ volumes:
1260
1292
 
1261
1293
  volumes:
1262
1294
  mongodb_data:
1263
- `;var yt=`services:
1295
+ `;var Ui=`services:
1264
1296
  # MySQL - Alternative relational database
1265
1297
  # Docs: https://dev.mysql.com/doc/
1266
1298
  # Connection: mysql://ooneex:ooneex@localhost:3306/ooneex
@@ -1280,7 +1312,7 @@ volumes:
1280
1312
 
1281
1313
  volumes:
1282
1314
  mysql_db:
1283
- `;var ft=`services:
1315
+ `;var qi=`services:
1284
1316
  # NATS - High-performance messaging system with JetStream
1285
1317
  # Docs: https://docs.nats.io/
1286
1318
  # Client: localhost:4222
@@ -1293,7 +1325,7 @@ volumes:
1293
1325
  - "4222:4222"
1294
1326
  - "8222:8222"
1295
1327
  command: "--jetstream --http_port 8222"
1296
- `;var ht=`services:
1328
+ `;var Gi=`services:
1297
1329
  # PostgreSQL - Primary relational database
1298
1330
  # Docs: https://www.postgresql.org/docs/
1299
1331
  # Connection: postgresql://ooneex:ooneex@localhost:5432/ooneex
@@ -1314,7 +1346,7 @@ volumes:
1314
1346
 
1315
1347
  volumes:
1316
1348
  postgres_db:
1317
- `;var gt=`services:
1349
+ `;var Ki=`services:
1318
1350
  # Prometheus - Metrics collection and monitoring
1319
1351
  # Docs: https://prometheus.io/docs/
1320
1352
  # Web UI: http://localhost:9090
@@ -1329,7 +1361,7 @@ volumes:
1329
1361
 
1330
1362
  volumes:
1331
1363
  prometheus_data:
1332
- `;var Et=`services:
1364
+ `;var Wi=`services:
1333
1365
  # RabbitMQ - Message broker for async processing
1334
1366
  # Docs: https://www.rabbitmq.com/docs
1335
1367
  # AMQP: amqp://ooneex:ooneex@localhost:5672/ooneex
@@ -1351,7 +1383,7 @@ volumes:
1351
1383
 
1352
1384
  volumes:
1353
1385
  rabbitmq_data:
1354
- `;var At=`services:
1386
+ `;var Hi=`services:
1355
1387
  # Redis - In-memory data store for caching and sessions
1356
1388
  # Docs: https://redis.io/docs/
1357
1389
  # Connection: redis://localhost:6379
@@ -1366,7 +1398,7 @@ volumes:
1366
1398
 
1367
1399
  volumes:
1368
1400
  redis_data:
1369
- `;var bt=`services:
1401
+ `;var Yi=`services:
1370
1402
  # Temporal - Workflow orchestration engine
1371
1403
  # Docs: https://docs.temporal.io/
1372
1404
  # gRPC: localhost:7233
@@ -1383,7 +1415,7 @@ volumes:
1383
1415
  - POSTGRES_USER=ooneex
1384
1416
  - POSTGRES_PWD=ooneex
1385
1417
  - POSTGRES_SEEDS=postgres
1386
- `;var xt=`services:
1418
+ `;var Vi=`services:
1387
1419
  # Vault - Secrets management and encryption
1388
1420
  # Docs: https://developer.hashicorp.com/vault/docs
1389
1421
  # Web UI: http://localhost:8200 (token: ooneex)
@@ -1398,20 +1430,20 @@ volumes:
1398
1430
  - VAULT_DEV_LISTEN_ADDRESS=0.0.0.0:8200
1399
1431
  cap_add:
1400
1432
  - IPC_LOCK
1401
- `;var vt={clickhouse:st,elasticsearch:it,grafana:nt,jaeger:at,keycloak:ct,libretranslate:pt,maildev:lt,memcached:mt,minio:ut,mongodb:dt,mysql:yt,nats:ft,postgres:ht,prometheus:gt,rabbitmq:Et,redis:At,temporal:bt,vault:xt};function Hr(r){let e=r.split(`
1402
- `),t=[],o=!1;for(let s of e){if(s.startsWith("services:")){o=!0;continue}if(o){if(s.startsWith("volumes:")||s.startsWith("networks:"))break;t.push(s)}}return t.join(`
1403
- `)}function Yr(r){let e=Mt.parse(r);return e.volumes?Object.keys(e.volumes):[]}class ee{getName(){return"make:docker"}getDescription(){return"Add a docker service to docker-compose.yml"}async run(r){let{name:e}=r;if(!e)e=await rt({message:"Select docker service"});let t=vt[e],o=wt(process.cwd(),"docker-compose.yml"),s=new qr,i=Bun.file(o);if(await i.exists()){let c=await i.text(),p=Mt.parse(c);if(p.services&&e in p.services){s.warn(`Service "${e}" already exists in docker-compose.yml`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0});return}let l=Hr(t),f=Yr(t),d=c,h=d.indexOf(`
1404
- volumes:`),g=d.indexOf(`
1405
- networks:`),x=-1;if(h!==-1&&g!==-1)x=Math.min(h,g);else if(h!==-1)x=h;else if(g!==-1)x=g;if(x!==-1)d=`${d.slice(0,x)}
1406
- ${l}${d.slice(x)}`;else d=`${d.trimEnd()}
1407
- ${l}`;for(let R of f)if(!d.includes(` ${R}:`))if(d.includes(`
1408
- volumes:`)){let _=d.indexOf(`
1409
- volumes:`),q=d.slice(_+9);d=`${d.slice(0,_+9)}
1410
- ${R}:${q}`}else d=`${d.trimEnd()}
1433
+ `;var Fi={clickhouse:vi,elasticsearch:Ci,grafana:Ri,jaeger:Bi,keycloak:Di,libretranslate:Oi,maildev:Pi,memcached:Ii,minio:Li,mongodb:$i,mysql:Ui,nats:qi,postgres:Gi,prometheus:Ki,rabbitmq:Wi,redis:Hi,temporal:Yi,vault:Vi};function hl(e){let t=e.split(`
1434
+ `),s=[],r=!1;for(let i of t){if(i.startsWith("services:")){r=!0;continue}if(r){if(i.startsWith("volumes:")||i.startsWith("networks:"))break;s.push(i)}}return s.join(`
1435
+ `)}function fl(e){let t=Zi.parse(e);return t.volumes?Object.keys(t.volumes):[]}class qe{getName(){return"make:docker"}getDescription(){return"Add a docker service to docker-compose.yml"}async run(e){let{name:t}=e;if(!t)t=await _i({message:"Select docker service"});let s=Fi[t],r=Qi(process.cwd(),"docker-compose.yml"),i=new ml,o=Bun.file(r);if(await o.exists()){let p=await o.text(),l=Zi.parse(p);if(l.services&&t in l.services){i.warn(`Service "${t}" already exists in docker-compose.yml`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0});return}let u=hl(s),c=fl(s),h=p,d=h.indexOf(`
1436
+ volumes:`),m=h.indexOf(`
1437
+ networks:`),y=-1;if(d!==-1&&m!==-1)y=Math.min(d,m);else if(d!==-1)y=d;else if(m!==-1)y=m;if(y!==-1)h=`${h.slice(0,y)}
1438
+ ${u}${h.slice(y)}`;else h=`${h.trimEnd()}
1439
+ ${u}`;for(let S of c)if(!h.includes(` ${S}:`))if(h.includes(`
1440
+ volumes:`)){let f=h.indexOf(`
1441
+ volumes:`),E=h.slice(f+9);h=`${h.slice(0,f+9)}
1442
+ ${S}:${E}`}else h=`${h.trimEnd()}
1411
1443
 
1412
1444
  volumes:
1413
- ${R}:
1414
- `;await Bun.write(o,d)}else await Bun.write(o,t);let a=wt(process.cwd(),"package.json"),n=Bun.file(a);if(await n.exists()){let c=await n.json();c.scripts=c.scripts||{},c.scripts.docker="docker compose up -d",await Bun.write(a,JSON.stringify(c,null,2))}s.success(`Service "${e}" added to docker-compose.yml`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),s.info("Run 'bun run docker' to start docker containers",void 0,{showTimestamp:!1,showArrow:!0,showLevel:!1})}}ee=m([u.command()],ee);import{basename as Qr,join as M}from"path";import{TerminalLogger as zr}from"@ooneex/logger";import{toPascalCase as Tt,toSnakeCase as Zr}from"@ooneex/utils";import Xr from"pluralize";var Nt=`import { describe, expect, test } from "bun:test";
1445
+ ${S}:
1446
+ `;await Bun.write(r,h)}else await Bun.write(r,s);let n=Qi(process.cwd(),"package.json"),a=Bun.file(n);if(await a.exists()){let p=await a.json();p.scripts=p.scripts||{},p.scripts.docker="docker compose up -d",await Bun.write(n,JSON.stringify(p,null,2))}i.success(`Service "${t}" added to docker-compose.yml`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),i.info("Run 'bun run docker' to start docker containers",void 0,{showTimestamp:!1,showArrow:!0,showLevel:!1})}}qe=A([b.command()],qe);var ki=Y(zi(),1);import{basename as El,join as G}from"path";import{TerminalLogger as Al}from"@ooneex/logger";import{toPascalCase as ji,toSnakeCase as bl}from"@ooneex/utils";var Xi=`import { describe, expect, test } from "bun:test";
1415
1447
  import { {{NAME}}Entity } from "@/entities/{{NAME}}Entity";
1416
1448
 
1417
1449
  describe("{{NAME}}Entity", () => {
@@ -1476,7 +1508,7 @@ describe("{{NAME}}Entity", () => {
1476
1508
  expect("deletedAt" in entity).toBe(true);
1477
1509
  });
1478
1510
  });
1479
- `;var St=`import type { LocaleType } from "@ooneex/translation";
1511
+ `;var Ji=`import type { LocaleType } from "@ooneex/translation";
1480
1512
  import { random } from "@ooneex/utils";
1481
1513
  import { Column, CreateDateColumn, DeleteDateColumn, PrimaryColumn, UpdateDateColumn } from "typeorm";
1482
1514
 
@@ -1527,9 +1559,9 @@ export class {{NAME}}Entity extends BaseEntity {
1527
1559
  @DeleteDateColumn({ name: "deleted_at" })
1528
1560
  deletedAt?: Date;
1529
1561
  }
1530
- `;class te{getName(){return"make:entity"}getDescription(){return"Generate a new entity class"}async addToModule(r,e){let t=await Bun.file(r).text(),o=`${e}Entity`,s=`import { ${o} } from "./entities/${o}";
1531
- `,i=t.lastIndexOf("import "),a=t.indexOf(`
1532
- `,i);t=`${t.slice(0,a+1)}${s}${t.slice(a+1)}`;let n=/(entities:\s*\[)([^\]]*)/s,c=t.match(n);if(c){let p=c[2]?.trim(),l=p?`${p}, ${o}`:o;t=t.replace(n,`$1${l}`)}await Bun.write(r,t)}async run(r){let{name:e,tableName:t}=r;if(!e)e=await y({message:"Enter entity name"});if(e=Tt(e).replace(/Entity$/,""),!t)t=Zr(Xr(e));let o=St.replace(/{{NAME}}/g,e).replace(/{{TABLE_NAME}}/g,t),s=M("src","entities"),i=M(process.cwd(),s),a=M(i,`${e}Entity.ts`);await Bun.write(a,o);let n=Nt.replace(/{{NAME}}/g,e),c=M("tests","entities"),p=M(process.cwd(),c),l=M(p,`${e}Entity.spec.ts`);await Bun.write(l,n);let f=Tt(Qr(process.cwd())),d=M(process.cwd(),"src",`${f}Module.ts`);if(await Bun.file(d).exists())await this.addToModule(d,e);let h=new zr;h.success(`${M(s,e)}Entity.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),h.success(`${M(c,e)}Entity.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}te=m([u.command()],te);import{join as P}from"path";import{TerminalLogger as es}from"@ooneex/logger";import{toPascalCase as ts}from"@ooneex/utils";var Rt=`import { describe, expect, test } from "bun:test";
1562
+ `;class Ge{getName(){return"make:entity"}getDescription(){return"Generate a new entity class"}async addToModule(e,t){let s=await Bun.file(e).text(),r=`${t}Entity`,i=`import { ${r} } from "./entities/${r}";
1563
+ `,o=s.lastIndexOf("import "),n=s.indexOf(`
1564
+ `,o);s=`${s.slice(0,n+1)}${i}${s.slice(n+1)}`;let a=/(entities:\s*\[)([^\]]*)/s,p=s.match(a);if(p){let l=p[2]?.trim(),u=l?`${l}, ${r}`:r;s=s.replace(a,`$1${u}`)}await Bun.write(e,s)}async run(e){let{name:t,tableName:s}=e;if(!t)t=await x({message:"Enter entity name"});if(t=ji(t).replace(/Entity$/,""),!s)s=bl(ki.default(t));let r=Ji.replace(/{{NAME}}/g,t).replace(/{{TABLE_NAME}}/g,s),i=G("src","entities"),o=G(process.cwd(),i),n=G(o,`${t}Entity.ts`);await Bun.write(n,r);let a=Xi.replace(/{{NAME}}/g,t),p=G("tests","entities"),l=G(process.cwd(),p),u=G(l,`${t}Entity.spec.ts`);await Bun.write(u,a);let c=ji(El(process.cwd())),h=G(process.cwd(),"src",`${c}Module.ts`);if(await Bun.file(h).exists())await this.addToModule(h,t);let d=new Al;d.success(`${G(i,t)}Entity.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),d.success(`${G(p,t)}Entity.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ge=A([b.command()],Ge);import{join as ee}from"path";import{TerminalLogger as Sl}from"@ooneex/logger";import{toPascalCase as Nl}from"@ooneex/utils";var eo=`import { describe, expect, test } from "bun:test";
1533
1565
  import { {{NAME}}Logger } from "@/loggers/{{NAME}}Logger";
1534
1566
 
1535
1567
  describe("{{NAME}}Logger", () => {
@@ -1572,7 +1604,7 @@ describe("{{NAME}}Logger", () => {
1572
1604
  expect(typeof {{NAME}}Logger.prototype.error).toBe("function");
1573
1605
  });
1574
1606
  });
1575
- `;var _t=`import type { IException } from "@ooneex/exception";
1607
+ `;var to=`import type { IException } from "@ooneex/exception";
1576
1608
  import type { ILogger } from "@ooneex/logger";
1577
1609
  import type { ScalarType } from "@ooneex/types";
1578
1610
  import { decorator } from "@ooneex/logger";
@@ -1607,7 +1639,7 @@ export class {{NAME}}Logger implements ILogger {
1607
1639
  // Handle error logging
1608
1640
  }
1609
1641
  }
1610
- `;class oe{getName(){return"make:logger"}getDescription(){return"Generate a new logger class"}async run(r){let{name:e}=r;if(!e)e=await y({message:"Enter logger name"});e=ts(e).replace(/Logger$/,"");let t=_t.replace(/{{NAME}}/g,e),o=P("src","loggers"),s=P(process.cwd(),o),i=P(s,`${e}Logger.ts`);await Bun.write(i,t);let a=Rt.replace(/{{NAME}}/g,e),n=P("tests","loggers"),c=P(process.cwd(),n),p=P(c,`${e}Logger.spec.ts`);await Bun.write(p,a);let l=new es;l.success(`${P(o,e)}Logger.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),l.success(`${P(n,e)}Logger.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}oe=m([u.command()],oe);import{join as v}from"path";import{TerminalLogger as ns}from"@ooneex/logger";import{toPascalCase as as}from"@ooneex/utils";var Ot=`import { describe, expect, test } from "bun:test";
1642
+ `;class Ke{getName(){return"make:logger"}getDescription(){return"Generate a new logger class"}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter logger name"});t=Nl(t).replace(/Logger$/,"");let s=to.replace(/{{NAME}}/g,t),r=ee("src","loggers"),i=ee(process.cwd(),r),o=ee(i,`${t}Logger.ts`);await Bun.write(o,s);let n=eo.replace(/{{NAME}}/g,t),a=ee("tests","loggers"),p=ee(process.cwd(),a),l=ee(p,`${t}Logger.spec.ts`);await Bun.write(l,n);let u=new Sl;u.success(`${ee(r,t)}Logger.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),u.success(`${ee(a,t)}Logger.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ke=A([b.command()],Ke);import{join as I}from"path";import{TerminalLogger as Cl}from"@ooneex/logger";import{toPascalCase as Rl}from"@ooneex/utils";var so=`import { describe, expect, test } from "bun:test";
1611
1643
  import { {{NAME}}Mailer } from "@/mailers/{{NAME}}Mailer";
1612
1644
 
1613
1645
  describe("{{NAME}}Mailer", () => {
@@ -1620,7 +1652,7 @@ describe("{{NAME}}Mailer", () => {
1620
1652
  expect(typeof {{NAME}}Mailer.prototype.send).toBe("function");
1621
1653
  });
1622
1654
  });
1623
- `;var Dt=`import { inject } from "@ooneex/container";
1655
+ `;var ro=`import { inject } from "@ooneex/container";
1624
1656
  import type { IMailer } from "@ooneex/mailer";
1625
1657
  import { type {{NAME}}MailerPropsType, {{NAME}}MailerTemplate } from "./{{NAME}}MailerTemplate";
1626
1658
 
@@ -1644,7 +1676,7 @@ export class {{NAME}}Mailer implements IMailer {
1644
1676
  });
1645
1677
  }
1646
1678
  }
1647
- `;var Bt=`import { describe, expect, test } from "bun:test";
1679
+ `;var io=`import { describe, expect, test } from "bun:test";
1648
1680
  import { {{NAME}}MailerTemplate } from "@/mailers/{{NAME}}MailerTemplate";
1649
1681
 
1650
1682
  describe("{{NAME}}MailerTemplate", () => {
@@ -1656,7 +1688,7 @@ describe("{{NAME}}MailerTemplate", () => {
1656
1688
  expect(typeof {{NAME}}MailerTemplate).toBe("function");
1657
1689
  });
1658
1690
  });
1659
- `;var Ct=`import { MailerLayout } from "@ooneex/mailer";
1691
+ `;var oo=`import { MailerLayout } from "@ooneex/mailer";
1660
1692
 
1661
1693
  export type {{NAME}}MailerPropsType = {
1662
1694
  link: string;
@@ -1671,7 +1703,7 @@ export const {{NAME}}MailerTemplate = (props?: {{NAME}}MailerPropsType) => (
1671
1703
  <MailerLayout.Footer />
1672
1704
  </MailerLayout>
1673
1705
  );
1674
- `;class re{getName(){return"make:mailer"}getDescription(){return"Generate a new mailer class"}async run(r){let{name:e}=r;if(!e)e=await y({message:"Enter mailer name"});e=as(e).replace(/Mailer$/,"");let t=Dt.replace(/{{NAME}}/g,e),o=Ct.replace(/{{NAME}}/g,e),s=v("src","mailers"),i=v(process.cwd(),s),a=v(i,`${e}Mailer.ts`),n=v(i,`${e}MailerTemplate.tsx`);await Bun.write(a,t),await Bun.write(n,o);let c=Ot.replace(/{{NAME}}/g,e),p=Bt.replace(/{{NAME}}/g,e),l=v("tests","mailers"),f=v(process.cwd(),l),d=v(f,`${e}Mailer.spec.ts`),h=v(f,`${e}MailerTemplate.spec.ts`);await Bun.write(d,c),await Bun.write(h,p);let g=new ns;g.success(`${v(s,e)}Mailer.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),g.success(`${v(s,e)}MailerTemplate.tsx created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),g.success(`${v(l,e)}Mailer.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),g.success(`${v(l,e)}MailerTemplate.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}re=m([u.command()],re);import{basename as ms,join as N}from"path";import{TerminalLogger as us}from"@ooneex/logger";import{toPascalCase as Ut}from"@ooneex/utils";var Pt=`import type { ContextType } from "@ooneex/socket";
1706
+ `;class We{getName(){return"make:mailer"}getDescription(){return"Generate a new mailer class"}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter mailer name"});t=Rl(t).replace(/Mailer$/,"");let s=ro.replace(/{{NAME}}/g,t),r=oo.replace(/{{NAME}}/g,t),i=I("src","mailers"),o=I(process.cwd(),i),n=I(o,`${t}Mailer.ts`),a=I(o,`${t}MailerTemplate.tsx`);await Bun.write(n,s),await Bun.write(a,r);let p=so.replace(/{{NAME}}/g,t),l=io.replace(/{{NAME}}/g,t),u=I("tests","mailers"),c=I(process.cwd(),u),h=I(c,`${t}Mailer.spec.ts`),d=I(c,`${t}MailerTemplate.spec.ts`);await Bun.write(h,p),await Bun.write(d,l);let m=new Cl;m.success(`${I(i,t)}Mailer.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),m.success(`${I(i,t)}MailerTemplate.tsx created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),m.success(`${I(u,t)}Mailer.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),m.success(`${I(u,t)}MailerTemplate.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}We=A([b.command()],We);import{basename as Pl,join as K}from"path";import{TerminalLogger as Il}from"@ooneex/logger";import{toPascalCase as lo}from"@ooneex/utils";var no=`import type { ContextType } from "@ooneex/socket";
1675
1707
  import { decorator, type IMiddleware } from "@ooneex/middleware";
1676
1708
 
1677
1709
  @decorator.middleware()
@@ -1683,7 +1715,7 @@ export class {{NAME}}Middleware implements IMiddleware {
1683
1715
  return context
1684
1716
  }
1685
1717
  }
1686
- `;var It=`import { describe, expect, test } from "bun:test";
1718
+ `;var ao=`import { describe, expect, test } from "bun:test";
1687
1719
  import { {{NAME}}Middleware } from "@/middlewares/{{NAME}}Middleware";
1688
1720
 
1689
1721
  describe("{{NAME}}Middleware", () => {
@@ -1696,7 +1728,7 @@ describe("{{NAME}}Middleware", () => {
1696
1728
  expect(typeof {{NAME}}Middleware.prototype.handler).toBe("function");
1697
1729
  });
1698
1730
  });
1699
- `;var Lt=`import type { ContextType } from "@ooneex/controller";
1731
+ `;var po=`import type { ContextType } from "@ooneex/controller";
1700
1732
  import { decorator, type IMiddleware } from "@ooneex/middleware";
1701
1733
 
1702
1734
  @decorator.middleware()
@@ -1708,9 +1740,9 @@ export class {{NAME}}Middleware implements IMiddleware {
1708
1740
  return context
1709
1741
  }
1710
1742
  }
1711
- `;class se{getName(){return"make:middleware"}getDescription(){return"Generate a new middleware class"}async addToModule(r,e){let t=await Bun.file(r).text(),o=`${e}Middleware`,s=`import { ${o} } from "./middlewares/${o}";
1712
- `,i=t.lastIndexOf("import "),a=t.indexOf(`
1713
- `,i);t=`${t.slice(0,a+1)}${s}${t.slice(a+1)}`;let n=/(middlewares:\s*\[)([^\]]*)/s,c=t.match(n);if(c){let p=c[2]?.trim(),l=p?`${p}, ${o}`:o;t=t.replace(n,`$1${l}`)}await Bun.write(r,t)}async run(r){let{name:e,isSocket:t}=r;if(!e)e=await y({message:"Enter middleware name"});if(t===void 0)t=await Z({message:"Is this a socket middleware?"});e=Ut(e).replace(/Middleware$/,"");let s=(t?Pt:Lt).replace(/{{NAME}}/g,e),i=N("src","middlewares"),a=N(process.cwd(),i),n=N(a,`${e}Middleware.ts`);await Bun.write(n,s);let c=It.replace(/{{NAME}}/g,e),p=N("tests","middlewares"),l=N(process.cwd(),p),f=N(l,`${e}Middleware.spec.ts`);await Bun.write(f,c);let d=Ut(ms(process.cwd())),h=N(process.cwd(),"src",`${d}Module.ts`);if(await Bun.file(h).exists())await this.addToModule(h,e);let g=new us;g.success(`${N(i,e)}Middleware.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),g.success(`${N(p,e)}Middleware.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}se=m([u.command()],se);import{join as ds}from"path";import{TerminalLogger as ys}from"@ooneex/logger";import{migrationCreate as fs}from"@ooneex/migrations";class ie{getName(){return"make:migration"}getDescription(){return"Generate a new migration file"}async run(){await fs({dir:"src/migrations"});let r=ds(process.cwd(),"package.json"),e=Bun.file(r);if(await e.exists()){let o=await e.json();o.scripts=o.scripts||{},o.scripts["migration:up"]="bun ./bin/migration/up.ts",await Bun.write(r,JSON.stringify(o,null,2))}let t=new ys;t.success("Migration file created successfully",void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),t.info("Run 'bun run migration:up' to execute migrations",void 0,{showTimestamp:!1,showArrow:!0,showLevel:!1})}}ie=m([u.command()],ie);import{basename as Es,join as S}from"path";import{TerminalLogger as As}from"@ooneex/logger";import{toPascalCase as Wt}from"@ooneex/utils";var $t=`import { describe, expect, test } from "bun:test";
1743
+ `;class He{getName(){return"make:middleware"}getDescription(){return"Generate a new middleware class"}async addToModule(e,t){let s=await Bun.file(e).text(),r=`${t}Middleware`,i=`import { ${r} } from "./middlewares/${r}";
1744
+ `,o=s.lastIndexOf("import "),n=s.indexOf(`
1745
+ `,o);s=`${s.slice(0,n+1)}${i}${s.slice(n+1)}`;let a=/(middlewares:\s*\[)([^\]]*)/s,p=s.match(a);if(p){let l=p[2]?.trim(),u=l?`${l}, ${r}`:r;s=s.replace(a,`$1${u}`)}await Bun.write(e,s)}async run(e){let{name:t,isSocket:s}=e;if(!t)t=await x({message:"Enter middleware name"});if(s===void 0)s=await Ie({message:"Is this a socket middleware?"});t=lo(t).replace(/Middleware$/,"");let i=(s?no:po).replace(/{{NAME}}/g,t),o=K("src","middlewares"),n=K(process.cwd(),o),a=K(n,`${t}Middleware.ts`);await Bun.write(a,i);let p=ao.replace(/{{NAME}}/g,t),l=K("tests","middlewares"),u=K(process.cwd(),l),c=K(u,`${t}Middleware.spec.ts`);await Bun.write(c,p);let h=lo(Pl(process.cwd())),d=K(process.cwd(),"src",`${h}Module.ts`);if(await Bun.file(d).exists())await this.addToModule(d,t);let m=new Il;m.success(`${K(o,t)}Middleware.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),m.success(`${K(l,t)}Middleware.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}He=A([b.command()],He);import{join as Ll}from"path";import{TerminalLogger as $l}from"@ooneex/logger";import{migrationCreate as Ul}from"@ooneex/migrations";class Ye{getName(){return"make:migration"}getDescription(){return"Generate a new migration file"}async run(){await Ul({dir:"src/migrations"});let e=Ll(process.cwd(),"package.json"),t=Bun.file(e);if(await t.exists()){let r=await t.json();r.scripts=r.scripts||{},r.scripts["migration:up"]="bun ./bin/migration/up.ts",await Bun.write(e,JSON.stringify(r,null,2))}let s=new $l;s.success("Migration file created successfully",void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),s.info("Run 'bun run migration:up' to execute migrations",void 0,{showTimestamp:!1,showArrow:!0,showLevel:!1})}}Ye=A([b.command()],Ye);import{basename as Kl,join as W}from"path";import{TerminalLogger as Wl}from"@ooneex/logger";import{toPascalCase as mo}from"@ooneex/utils";var uo=`import { describe, expect, test } from "bun:test";
1714
1746
  import { Permission } from "@ooneex/permission";
1715
1747
  import { {{NAME}}Permission } from "@/permissions/{{NAME}}Permission";
1716
1748
 
@@ -1735,7 +1767,7 @@ describe("{{NAME}}Permission", () => {
1735
1767
  });
1736
1768
 
1737
1769
  });
1738
- `;var Gt=`import { decorator, Permission } from "@ooneex/permission";
1770
+ `;var co=`import { decorator, Permission } from "@ooneex/permission";
1739
1771
  import type { IUser } from "@ooneex/user";
1740
1772
 
1741
1773
  @decorator.permission()
@@ -1774,9 +1806,9 @@ export class {{NAME}}Permission extends Permission {
1774
1806
  return this;
1775
1807
  }
1776
1808
  }
1777
- `;class ne{getName(){return"make:permission"}getDescription(){return"Generate a new permission class"}async addToModule(r,e){let t=await Bun.file(r).text(),o=`${e}Permission`,s=`import { ${o} } from "./permissions/${o}";
1778
- `,i=t.lastIndexOf("import "),a=t.indexOf(`
1779
- `,i);t=`${t.slice(0,a+1)}${s}${t.slice(a+1)}`;let n=/(permissions:\s*\[)([^\]]*)/s,c=t.match(n);if(c){let p=c[2]?.trim(),l=p?`${p}, ${o}`:o;t=t.replace(n,`$1${l}`)}await Bun.write(r,t)}async run(r){let{name:e}=r;if(!e)e=await y({message:"Enter permission name"});e=Wt(e).replace(/Permission$/,"");let t=Gt.replace(/{{NAME}}/g,e),o=S("src","permissions"),s=S(process.cwd(),o),i=S(s,`${e}Permission.ts`);await Bun.write(i,t);let a=$t.replace(/{{NAME}}/g,e),n=S("tests","permissions"),c=S(process.cwd(),n),p=S(c,`${e}Permission.spec.ts`);await Bun.write(p,a);let l=Wt(Es(process.cwd())),f=S(process.cwd(),"src",`${l}Module.ts`);if(await Bun.file(f).exists())await this.addToModule(f,e);let d=new As;d.success(`${S(o,e)}Permission.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),d.success(`${S(n,e)}Permission.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}ne=m([u.command()],ne);import{basename as vs,join as T}from"path";import{TerminalLogger as ws}from"@ooneex/logger";import{toKebabCase as Ms,toPascalCase as qt}from"@ooneex/utils";var Kt=`import { describe, expect, test } from "bun:test";
1809
+ `;class Ve{getName(){return"make:permission"}getDescription(){return"Generate a new permission class"}async addToModule(e,t){let s=await Bun.file(e).text(),r=`${t}Permission`,i=`import { ${r} } from "./permissions/${r}";
1810
+ `,o=s.lastIndexOf("import "),n=s.indexOf(`
1811
+ `,o);s=`${s.slice(0,n+1)}${i}${s.slice(n+1)}`;let a=/(permissions:\s*\[)([^\]]*)/s,p=s.match(a);if(p){let l=p[2]?.trim(),u=l?`${l}, ${r}`:r;s=s.replace(a,`$1${u}`)}await Bun.write(e,s)}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter permission name"});t=mo(t).replace(/Permission$/,"");let s=co.replace(/{{NAME}}/g,t),r=W("src","permissions"),i=W(process.cwd(),r),o=W(i,`${t}Permission.ts`);await Bun.write(o,s);let n=uo.replace(/{{NAME}}/g,t),a=W("tests","permissions"),p=W(process.cwd(),a),l=W(p,`${t}Permission.spec.ts`);await Bun.write(l,n);let u=mo(Kl(process.cwd())),c=W(process.cwd(),"src",`${u}Module.ts`);if(await Bun.file(c).exists())await this.addToModule(c,t);let h=new Wl;h.success(`${W(r,t)}Permission.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),h.success(`${W(a,t)}Permission.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ve=A([b.command()],Ve);import{basename as Vl,join as H}from"path";import{TerminalLogger as Fl}from"@ooneex/logger";import{toKebabCase as Ql,toPascalCase as yo}from"@ooneex/utils";var ho=`import { describe, expect, test } from "bun:test";
1780
1812
  import { {{NAME}}PubSub } from "@/pubsub/{{NAME}}PubSub";
1781
1813
 
1782
1814
  describe("{{NAME}}PubSub", () => {
@@ -1814,7 +1846,7 @@ describe("{{NAME}}PubSub", () => {
1814
1846
  expect(typeof {{NAME}}PubSub.prototype.unsubscribeAll).toBe("function");
1815
1847
  });
1816
1848
  });
1817
- `;var kt=`import { inject } from "@ooneex/container";
1849
+ `;var fo=`import { inject } from "@ooneex/container";
1818
1850
  import type { ScalarType } from "@ooneex/types";
1819
1851
  import { decorator, PubSub, RedisPubSub } from "@ooneex/pub-sub";
1820
1852
 
@@ -1836,9 +1868,9 @@ export class {{NAME}}Event<Data extends Record<string, ScalarType> = Record<stri
1836
1868
  // TODO: Implement handler logic here
1837
1869
  }
1838
1870
  }
1839
- `;class ae{getName(){return"make:pubsub"}getDescription(){return"Generate a new PubSub event class"}async addToModule(r,e){let t=await Bun.file(r).text(),o=`${e}Event`,s=`import { ${o} } from "./events/${o}";
1840
- `,i=t.lastIndexOf("import "),a=t.indexOf(`
1841
- `,i);t=`${t.slice(0,a+1)}${s}${t.slice(a+1)}`;let n=/(events:\s*\[)([^\]]*)/s,c=t.match(n);if(c){let p=c[2]?.trim(),l=p?`${p}, ${o}`:o;t=t.replace(n,`$1${l}`)}await Bun.write(r,t)}async run(r){let{name:e,channel:t}=r;if(!e)e=await y({message:"Enter name"});if(e=qt(e).replace(/PubSub$/,""),!t)t=Ms(e);let o=kt.replace(/{{NAME}}/g,e).replace(/{{CHANNEL}}/g,t),s=T("src","events"),i=T(process.cwd(),s),a=T(i,`${e}Event.ts`);await Bun.write(a,o);let n=Kt.replace(/{{NAME}}/g,e),c=T("tests","events"),p=T(process.cwd(),c),l=T(p,`${e}Event.spec.ts`);await Bun.write(l,n);let f=qt(vs(process.cwd())),d=T(process.cwd(),"src",`${f}Module.ts`);if(await Bun.file(d).exists())await this.addToModule(d,e);let h=new ws;h.success(`${T(s,e)}Event.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),h.success(`${T(c,e)}Event.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}ae=m([u.command()],ae);import{join as I}from"path";import{TerminalLogger as Ts}from"@ooneex/logger";import{toPascalCase as Rs}from"@ooneex/utils";var Ht=`import { describe, expect, test } from "bun:test";
1871
+ `;class Fe{getName(){return"make:pubsub"}getDescription(){return"Generate a new PubSub event class"}async addToModule(e,t){let s=await Bun.file(e).text(),r=`${t}Event`,i=`import { ${r} } from "./events/${r}";
1872
+ `,o=s.lastIndexOf("import "),n=s.indexOf(`
1873
+ `,o);s=`${s.slice(0,n+1)}${i}${s.slice(n+1)}`;let a=/(events:\s*\[)([^\]]*)/s,p=s.match(a);if(p){let l=p[2]?.trim(),u=l?`${l}, ${r}`:r;s=s.replace(a,`$1${u}`)}await Bun.write(e,s)}async run(e){let{name:t,channel:s}=e;if(!t)t=await x({message:"Enter name"});if(t=yo(t).replace(/PubSub$/,""),!s)s=Ql(t);let r=fo.replace(/{{NAME}}/g,t).replace(/{{CHANNEL}}/g,s),i=H("src","events"),o=H(process.cwd(),i),n=H(o,`${t}Event.ts`);await Bun.write(n,r);let a=ho.replace(/{{NAME}}/g,t),p=H("tests","events"),l=H(process.cwd(),p),u=H(l,`${t}Event.spec.ts`);await Bun.write(u,a);let c=yo(Vl(process.cwd())),h=H(process.cwd(),"src",`${c}Module.ts`);if(await Bun.file(h).exists())await this.addToModule(h,t);let d=new Fl;d.success(`${H(i,t)}Event.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),d.success(`${H(p,t)}Event.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Fe=A([b.command()],Fe);import{join as te}from"path";import{TerminalLogger as Xl}from"@ooneex/logger";import{toPascalCase as Jl}from"@ooneex/utils";var go=`import { describe, expect, test } from "bun:test";
1842
1874
  import { {{NAME}}Repository } from "@/repositories/{{NAME}}Repository";
1843
1875
 
1844
1876
  describe("{{NAME}}Repository", () => {
@@ -1901,7 +1933,7 @@ describe("{{NAME}}Repository", () => {
1901
1933
  expect(typeof {{NAME}}Repository.prototype.count).toBe("function");
1902
1934
  });
1903
1935
  });
1904
- `;var Yt=`import { inject } from "@ooneex/container";
1936
+ `;var Eo=`import { inject } from "@ooneex/container";
1905
1937
  import type { ITypeormDatabase } from "@ooneex/database";
1906
1938
  import { decorator } from "@ooneex/repository";
1907
1939
  import type { FilterResultType } from "@ooneex/types";
@@ -2023,7 +2055,7 @@ export class {{NAME}}Repository {
2023
2055
  return await repository.count(criteria ? { where: criteria } : {});
2024
2056
  }
2025
2057
  }
2026
- `;class ce{getName(){return"make:repository"}getDescription(){return"Generate a new repository class"}async run(r){let{name:e}=r;if(!e)e=await y({message:"Enter repository name"});e=Rs(e).replace(/Repository$/,"");let t=Yt.replace(/{{NAME}}/g,e),o=I("src","repositories"),s=I(process.cwd(),o),i=I(s,`${e}Repository.ts`);await Bun.write(i,t);let a=Ht.replace(/{{NAME}}/g,e),n=I("tests","repositories"),c=I(process.cwd(),n),p=I(c,`${e}Repository.spec.ts`);await Bun.write(p,a);let l=new Ts;l.success(`${I(o,e)}Repository.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),l.success(`${I(n,e)}Repository.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}ce=m([u.command()],ce);import{join as _s}from"path";import{TerminalLogger as Os}from"@ooneex/logger";import{seedCreate as Ds}from"@ooneex/seeds";class pe{getName(){return"make:seed"}getDescription(){return"Generate a new seed file"}async run(r){let{name:e}=r;if(!e)e=await y({message:"Enter seed name"});let t=await Ds({name:e,dir:"src/seeds"}),o=_s(process.cwd(),"package.json"),s=Bun.file(o);if(await s.exists()){let a=await s.json();a.scripts=a.scripts||{},a.scripts["seed:run"]="bun ./bin/seed/run.ts",await Bun.write(o,JSON.stringify(a,null,2))}let i=new Os;i.success(`${t} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),i.info("Run 'bun run seed:run' to execute seeds",void 0,{showTimestamp:!1,showArrow:!0,showLevel:!1})}}pe=m([u.command()],pe);import{join as L}from"path";import{TerminalLogger as Ps}from"@ooneex/logger";import{toPascalCase as Is}from"@ooneex/utils";var Vt=`import { describe, expect, test } from "bun:test";
2058
+ `;class Qe{getName(){return"make:repository"}getDescription(){return"Generate a new repository class"}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter repository name"});t=Jl(t).replace(/Repository$/,"");let s=Eo.replace(/{{NAME}}/g,t),r=te("src","repositories"),i=te(process.cwd(),r),o=te(i,`${t}Repository.ts`);await Bun.write(o,s);let n=go.replace(/{{NAME}}/g,t),a=te("tests","repositories"),p=te(process.cwd(),a),l=te(p,`${t}Repository.spec.ts`);await Bun.write(l,n);let u=new Xl;u.success(`${te(r,t)}Repository.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),u.success(`${te(a,t)}Repository.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Qe=A([b.command()],Qe);import{join as jl}from"path";import{TerminalLogger as kl}from"@ooneex/logger";import{seedCreate as eu}from"@ooneex/seeds";class Ze{getName(){return"make:seed"}getDescription(){return"Generate a new seed file"}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter seed name"});let s=await eu({name:t,dir:"src/seeds"}),r=jl(process.cwd(),"package.json"),i=Bun.file(r);if(await i.exists()){let n=await i.json();n.scripts=n.scripts||{},n.scripts["seed:run"]="bun ./bin/seed/run.ts",await Bun.write(r,JSON.stringify(n,null,2))}let o=new kl;o.success(`${s} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),o.info("Run 'bun run seed:run' to execute seeds",void 0,{showTimestamp:!1,showArrow:!0,showLevel:!1})}}Ze=A([b.command()],Ze);import{join as se}from"path";import{TerminalLogger as ru}from"@ooneex/logger";import{toPascalCase as iu}from"@ooneex/utils";var Ao=`import { describe, expect, test } from "bun:test";
2027
2059
  import { {{NAME}}Service } from "@/services/{{NAME}}Service";
2028
2060
 
2029
2061
  describe("{{NAME}}Service", () => {
@@ -2036,7 +2068,7 @@ describe("{{NAME}}Service", () => {
2036
2068
  expect(typeof {{NAME}}Service.prototype.execute).toBe("function");
2037
2069
  });
2038
2070
  });
2039
- `;var Ft=`import { decorator } from "@ooneex/service";
2071
+ `;var bo=`import { decorator } from "@ooneex/service";
2040
2072
  import type { IService } from "@ooneex/service";
2041
2073
 
2042
2074
  type ServiceDataType = Record<string, unknown>;
@@ -2047,7 +2079,7 @@ export class {{NAME}}Service<T extends ServiceDataType = ServiceDataType> implem
2047
2079
  // TODO: Implement service logic
2048
2080
  }
2049
2081
  }
2050
- `;class le{getName(){return"make:service"}getDescription(){return"Generate a new service class"}async run(r){let{name:e}=r;if(!e)e=await y({message:"Enter service name"});e=Is(e).replace(/Service$/,"");let t=Ft.replace(/{{NAME}}/g,e),o=L("src","services"),s=L(process.cwd(),o),i=L(s,`${e}Service.ts`);await Bun.write(i,t);let a=Vt.replace(/{{NAME}}/g,e),n=L("tests","services"),c=L(process.cwd(),n),p=L(c,`${e}Service.spec.ts`);await Bun.write(p,a);let l=new Ps;l.success(`${L(o,e)}Service.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),l.success(`${L(n,e)}Service.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}le=m([u.command()],le);import{join as U}from"path";import{TerminalLogger as $s}from"@ooneex/logger";import{toPascalCase as Gs,toSnakeCase as Ws}from"@ooneex/utils";var Qt=`import { describe, expect, test } from "bun:test";
2082
+ `;class ze{getName(){return"make:service"}getDescription(){return"Generate a new service class"}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter service name"});t=iu(t).replace(/Service$/,"");let s=bo.replace(/{{NAME}}/g,t),r=se("src","services"),i=se(process.cwd(),r),o=se(i,`${t}Service.ts`);await Bun.write(o,s);let n=Ao.replace(/{{NAME}}/g,t),a=se("tests","services"),p=se(process.cwd(),a),l=se(p,`${t}Service.spec.ts`);await Bun.write(l,n);let u=new ru;u.success(`${se(r,t)}Service.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),u.success(`${se(a,t)}Service.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}ze=A([b.command()],ze);import{join as re}from"path";import{TerminalLogger as au}from"@ooneex/logger";import{toPascalCase as pu,toSnakeCase as lu}from"@ooneex/utils";var xo=`import { describe, expect, test } from "bun:test";
2051
2083
  import { {{NAME}}StorageAdapter } from "@/storage/{{NAME}}StorageAdapter";
2052
2084
 
2053
2085
  describe("{{NAME}}StorageAdapter", () => {
@@ -2064,7 +2096,7 @@ describe("{{NAME}}StorageAdapter", () => {
2064
2096
  expect(typeof {{NAME}}StorageAdapter.prototype.getOptions).toBe("function");
2065
2097
  });
2066
2098
  });
2067
- `;var zt=`import { Storage, decorator, StorageException } from "@ooneex/storage";
2099
+ `;var wo=`import { Storage, decorator, StorageException } from "@ooneex/storage";
2068
2100
  import type { S3Options } from "bun";
2069
2101
 
2070
2102
  @decorator.storage()
@@ -2119,7 +2151,7 @@ export class {{NAME}}Storage extends Storage {
2119
2151
  };
2120
2152
  }
2121
2153
  }
2122
- `;class me{getName(){return"make:storage"}getDescription(){return"Generate a new storage class"}async run(r){let{name:e}=r;if(!e)e=await y({message:"Enter storage name"});e=Gs(e).replace(/Storage$/,"");let t=Ws(e).toUpperCase(),o=zt.replace(/{{NAME}}/g,e).replace(/{{NAME_UPPER}}/g,t),s=U("src","storage"),i=U(process.cwd(),s),a=U(i,`${e}Storage.ts`);await Bun.write(a,o);let n=Qt.replace(/{{NAME}}/g,e),c=U("tests","storage"),p=U(process.cwd(),c),l=U(p,`${e}Storage.spec.ts`);await Bun.write(l,n);let f=new $s;f.success(`${U(s,e)}Storage.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),f.success(`${U(c,e)}Storage.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}me=m([u.command()],me);import{join as $}from"path";import{TerminalLogger as qs}from"@ooneex/logger";import{toPascalCase as Hs}from"@ooneex/utils";var Zt=`import { describe, expect, test } from "bun:test";
2154
+ `;class Xe{getName(){return"make:storage"}getDescription(){return"Generate a new storage class"}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter storage name"});t=pu(t).replace(/Storage$/,"");let s=lu(t).toUpperCase(),r=wo.replace(/{{NAME}}/g,t).replace(/{{NAME_UPPER}}/g,s),i=re("src","storage"),o=re(process.cwd(),i),n=re(o,`${t}Storage.ts`);await Bun.write(n,r);let a=xo.replace(/{{NAME}}/g,t),p=re("tests","storage"),l=re(process.cwd(),p),u=re(l,`${t}Storage.spec.ts`);await Bun.write(u,a);let c=new au;c.success(`${re(i,t)}Storage.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),c.success(`${re(p,t)}Storage.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Xe=A([b.command()],Xe);import{join as ie}from"path";import{TerminalLogger as cu}from"@ooneex/logger";import{toPascalCase as mu}from"@ooneex/utils";var So=`import { describe, expect, test } from "bun:test";
2123
2155
  import { {{NAME}}VectorDatabase } from "@/databases/{{NAME}}VectorDatabase";
2124
2156
 
2125
2157
  describe("{{NAME}}VectorDatabase", () => {
@@ -2142,7 +2174,7 @@ describe("{{NAME}}VectorDatabase", () => {
2142
2174
  expect(typeof {{NAME}}VectorDatabase.prototype.getSchema).toBe("function");
2143
2175
  });
2144
2176
  });
2145
- `;var Xt=`import { VectorDatabase, decorator } from "@ooneex/rag";
2177
+ `;var No=`import { VectorDatabase, decorator } from "@ooneex/rag";
2146
2178
  import type { EmbeddingModelType, EmbeddingProviderType, FieldValueType } from "@ooneex/rag";
2147
2179
  import { Utf8 } from "apache-arrow";
2148
2180
 
@@ -2166,8 +2198,8 @@ export class {{NAME}}VectorDatabase extends VectorDatabase<DataType> {
2166
2198
  };
2167
2199
  }
2168
2200
  }
2169
- `;class ue{getName(){return"make:vector-database"}getDescription(){return"Generate a new vector database class"}async run(r){let{name:e}=r;if(!e)e=await y({message:"Enter vector database name"});e=Hs(e).replace(/VectorDatabase$/,"").replace(/Database$/,"");let t=Xt.replace(/{{NAME}}/g,e),o=$("src","databases"),s=$(process.cwd(),o),i=$(s,`${e}VectorDatabase.ts`);await Bun.write(i,t);let a=Zt.replace(/{{NAME}}/g,e),n=$("tests","databases"),c=$(process.cwd(),n),p=$(c,`${e}VectorDatabase.spec.ts`);await Bun.write(p,a);let l=new qs;l.success(`${$(o,e)}VectorDatabase.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),l.success(`${$(n,e)}VectorDatabase.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}ue=m([u.command()],ue);var{values:G,positionals:Fs}=Ys({args:Bun.argv,options:{name:{type:"string"},"route-name":{type:"string"},"route-path":{type:"string"},"route-method":{type:"string"},"is-socket":{type:"boolean"},dir:{type:"string"},channel:{type:"string"},"table-name":{type:"string"}},strict:!0,allowPositionals:!0}),be=new Vs,Jt=Fs[2];if(!Jt)be.error(`Command name is required
2170
- `),process.exit(1);var jt=ve(Jt);if(!jt)be.info(`No commands found
2171
- `),process.exit(1);var Qs={name:G.name,dir:G.dir,channel:G.channel,isSocket:G["is-socket"],tableName:G["table-name"],route:{name:G["route-name"],path:G["route-path"],method:G["route-method"]}};try{await jt.run(Qs)}catch(r){be.error(r,void 0,{showArrow:!1,showTimestamp:!1,showLevel:!1}),process.exit(1)}
2201
+ `;class Je{getName(){return"make:vector-database"}getDescription(){return"Generate a new vector database class"}async run(e){let{name:t}=e;if(!t)t=await x({message:"Enter vector database name"});t=mu(t).replace(/VectorDatabase$/,"").replace(/Database$/,"");let s=No.replace(/{{NAME}}/g,t),r=ie("src","databases"),i=ie(process.cwd(),r),o=ie(i,`${t}VectorDatabase.ts`);await Bun.write(o,s);let n=So.replace(/{{NAME}}/g,t),a=ie("tests","databases"),p=ie(process.cwd(),a),l=ie(p,`${t}VectorDatabase.spec.ts`);await Bun.write(l,n);let u=new cu;u.success(`${ie(r,t)}VectorDatabase.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),u.success(`${ie(a,t)}VectorDatabase.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Je=A([b.command()],Je);var{values:oe,positionals:yu}=hu({args:Bun.argv,options:{name:{type:"string"},"route-name":{type:"string"},"route-path":{type:"string"},"route-method":{type:"string"},"is-socket":{type:"boolean"},dir:{type:"string"},channel:{type:"string"},"table-name":{type:"string"}},strict:!0,allowPositionals:!0}),Rt=new fu,Mo=yu[2];if(!Mo)Rt.error(`Command name is required
2202
+ `),process.exit(1);var To=Dt(Mo);if(!To)Rt.info(`No commands found
2203
+ `),process.exit(1);var gu={name:oe.name,dir:oe.dir,channel:oe.channel,isSocket:oe["is-socket"],tableName:oe["table-name"],route:{name:oe["route-name"],path:oe["route-path"],method:oe["route-method"]}};try{await To.run(gu)}catch(e){Rt.error(e,void 0,{showArrow:!1,showTimestamp:!1,showLevel:!1}),process.exit(1)}
2172
2204
 
2173
- //# debugId=946366AAAB582CB064756E2164756E21
2205
+ //# debugId=01306FCBF967120264756E2164756E21