@ooneex/cli 1.1.11 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,38 +1,46 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var Io=Object.create;var{getPrototypeOf:Lo,defineProperty:Ot,getOwnPropertyNames:$o}=Object;var Go=Object.prototype.hasOwnProperty;function Uo(e){return this[e]}var qo,Ko,Y=(e,t,s)=>{var r=e!=null&&typeof e==="object";if(r){var i=t?qo??=new WeakMap:Ko??=new WeakMap,o=i.get(e);if(o)return o}s=e!=null?Io(Lo(e)):{};let n=t||!e||!e.__esModule?Ot(s,"default",{value:e,enumerable:!0}):s;for(let a of $o(e))if(!Go.call(n,a))Ot(n,a,{get:Uo.bind(e,a),enumerable:!0});if(r)i.set(e,n);return n};var A=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var g=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 qt=A((Fc,fe)=>{var Zo=typeof process<"u"&&process.env.TERM_PROGRAM==="Hyper",Xo=typeof process<"u"&&process.platform==="win32",$t=typeof process<"u"&&process.platform==="linux",tt={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"},Gt=Object.assign({},tt,{check:"\u221A",cross:"\xD7",ellipsisLarge:"...",ellipsis:"...",info:"i",questionSmall:"?",pointer:">",pointerSmall:"\xBB",radioOff:"( )",radioOn:"(*)",warning:"\u203C"}),Ut=Object.assign({},tt,{ballotCross:"\u2718",check:"\u2714",cross:"\u2716",ellipsisLarge:"\u22EF",ellipsis:"\u2026",info:"\u2139",questionFull:"\uFF1F",questionSmall:"\uFE56",pointer:$t?"\u25B8":"\u276F",pointerSmall:$t?"\u2023":"\u203A",radioOff:"\u25EF",radioOn:"\u25C9",warning:"\u26A0"});fe.exports=Xo&&!Zo?Gt:Ut;Reflect.defineProperty(fe.exports,"common",{enumerable:!1,value:tt});Reflect.defineProperty(fe.exports,"windows",{enumerable:!1,value:Gt});Reflect.defineProperty(fe.exports,"other",{enumerable:!1,value:Ut})});var Ne=A((Qc,st)=>{var Jo=(e)=>e!==null&&typeof e==="object"&&!Array.isArray(e),jo=/[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g,ko=()=>{if(typeof process<"u")return process.env.FORCE_COLOR!=="0";return!1},Kt=()=>{let e={enabled:ko(),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,c)=>{if(l.includes(a))l=l.replace(p,a+n);let d=n+l+a;return c?d.replace(/\r*\n/g,`${a}$&${n}`):d},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=(c)=>r(c,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=jo,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(!Jo(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=qt(),e.define=i,e};st.exports=Kt();st.exports.create=Kt});var R=A((tn)=>{var en=Object.prototype.toString,P=Ne(),Ht=!1,ye=new Set,Wt={yellow:"blue",cyan:"red",green:"magenta",black:"white",blue:"yellow",red:"cyan",magenta:"green",white:"black"};tn.longest=(e,t)=>{return e.reduce((s,r)=>Math.max(s,t?r[t].length:r.length),0)};tn.hasColor=(e)=>!!e&&P.hasColor(e);var Me=tn.isObject=(e)=>{return e!==null&&typeof e==="object"&&!Array.isArray(e)};tn.nativeType=(e)=>{return en.call(e).slice(8,-1).toLowerCase().replace(/\s/g,"")};tn.isAsyncFn=(e)=>{return tn.nativeType(e)==="asyncfunction"};tn.isPrimitive=(e)=>{return e!=null&&typeof e!=="object"&&typeof e!=="function"};tn.resolve=(e,t,...s)=>{if(typeof t==="function")return t.call(e,...s);return t};tn.scrollDown=(e=[])=>[...e.slice(1),e[0]];tn.scrollUp=(e=[])=>[e.pop(),...e];tn.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};tn.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};tn.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};tn.height=(e,t=20)=>{let s=e&&e.rows?e.rows:t;if(e&&typeof e.getWindowSize==="function")s=e.getWindowSize()[1];return s};tn.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((c)=>c.replace(/\n$/,"")),t.padEnd)l=l.map((c)=>c.padEnd(i," "));if(t.padStart)l=l.map((c)=>c.padStart(i," "));return s+l.join(r)};tn.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};tn.pascal=(e)=>e?e[0].toUpperCase()+e.slice(1):"";tn.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"+tn.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};tn.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[Wt[t]||t];if(s){let r=s.slice(2).toLowerCase(),i=Wt[r];if(!i)return e;return P["bg"+tn.pascal(i)]||e}return P.none};tn.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};tn.set=(e={},t="",s)=>{return t.split(".").reduce((r,i,o,n)=>{let a=n.length-1>o?r[i]||{}:s;if(!tn.isObject(a)&&o<n.length-1)a={};return r[i]=a},e)};tn.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};tn.mixin=(e,t)=>{if(!Me(e))return t;if(!Me(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)&&Me(r.value)){let i=Object.getOwnPropertyDescriptor(e,s);if(Me(i.value)&&i.value!==r.value)e[s]=tn.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};tn.merge=(...e)=>{let t={};for(let s of e)tn.mixin(t,s);return t};tn.mixinEmitter=(e,t)=>{let s=t.constructor.prototype;for(let r of Object.keys(s)){let i=s[r];if(typeof i==="function")tn.define(e,r,i.bind(t));else tn.define(e,r,i)}};var Te=(e,t)=>{if(Ht)return;if(Ht=!0,ye.forEach((s)=>s()),e===!0)process.exit(128+t)},Yt=Te.bind(null,!0,15),Vt=Te.bind(null,!0,2);tn.onExit=(e)=>{if(ye.size===0)process.once("SIGTERM",Yt),process.once("SIGINT",Vt),process.once("exit",Te);return ye.add(e),()=>{if(ye.delete(e),ye.size===0)process.off("SIGTERM",Yt),process.off("SIGINT",Vt),process.off("exit",Te)}};tn.define=(e,t,s)=>{Reflect.defineProperty(e,t,{value:s})};tn.defineExport=(e,t,s)=>{let r;Reflect.defineProperty(e,t,{enumerable:!0,configurable:!0,set(i){r=i},get(){return r?r():s()}})}});var Xt=A((Zc,Zt)=>{Zt.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=A((Xc,Jt)=>{var Tn=Xt();Jt.exports=(e)=>typeof e==="string"?e.replace(Tn(),""):e});var jt=A((_n)=>{_n.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"};_n.shift={up:"shiftUp",down:"shiftDown",left:"shiftLeft",right:"shiftRight",tab:"prev"};_n.fn={up:"pageUp",down:"pageDown",left:"pageLeft",right:"pageRight",delete:"deleteForward"};_n.option={b:"backward",f:"forward",d:"cutRight",left:"cutLeft",up:"altUp",down:"altDown"};_n.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 es=A((jc,kt)=>{kt.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 it=A((kc,ss)=>{var ts=he("readline"),On=jt(),Pn=es(),In=/^(?:\x1b)([a-zA-Z0-9])$/,Ln=/^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/,$n={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 Gn(e){return["[a","[b","[c","[d","[e","[2$","[3$","[5$","[6$","[7$","[8$","[Z"].includes(e)}function Un(e){return["Oa","Ob","Oc","Od","Oe","[2^","[3^","[5^","[6^","[7^","[8^"].includes(e)}var _e=(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=In.exec(e))r.meta=!0,r.shift=/^[A-Z]$/.test(s[1]);else if(s=Ln.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=$n[o],r.shift=Gn(o)||r.shift,r.ctrl=Un(o)||r.ctrl}return r};_e.listen=(e={},t)=>{let{stdin:s}=e;if(!s||s!==process.stdin&&!s.isTTY)throw Error("Invalid stream passed");let r=ts.createInterface({terminal:!0,input:s});ts.emitKeypressEvents(s,r);let i=new Pn((a,p)=>t(a,_e(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()}};_e.action=(e,t,s)=>{let r={...On,...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};ss.exports=_e});var is=A((em,rs)=>{rs.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};qn(e,s,r)}};function qn(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 as=A((tm,ns)=>{var{define:Kn,width:Hn}=R();class os{constructor(e){let t=e.options;Kn(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=Hn(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"}}ns.exports=os});var ls=A((sm,ps)=>{var ot=R(),_=Ne(),nt={default:_.noop,noop:_.noop,set inverse(e){this._inverse=e},get inverse(){return this._inverse||ot.inverse(this.primary)},set complement(e){this._complement=e},get complement(){return this._complement||ot.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}};nt.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=ot.merge({},nt,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};ps.exports=nt});var ms=A((rm,cs)=>{var at=process.platform==="win32",G=Ne(),Wn=R(),pt={...G.symbols,upDownDoubleArrow:"\u21D5",upDownDoubleArrow2:"\u2B0D",upDownArrow:"\u2195",asterisk:"*",asterism:"\u2042",bulletWhite:"\u25E6",electricArrow:"\u2301",ellipsisLarge:"\u22EF",ellipsisSmall:"\u2026",fullBlock:"\u2588",identicalTo:"\u2261",indicator:G.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:G.symbols.question,submitted:G.symbols.check,cancelled:G.symbols.cross},separator:{pending:G.symbols.pointerSmall,submitted:G.symbols.middot,cancelled:G.symbols.middot},radio:{off:at?"( )":"\u25EF",on:at?"(*)":"\u25C9",disabled:at?"(|)":"\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"]};pt.merge=(e)=>{let t=Wn.merge({},G.symbols,pt,e.symbols);return delete t.merge,t};cs.exports=pt});var us=A((im,ds)=>{var Yn=ls(),Vn=ms(),Fn=R();ds.exports=(e)=>{e.options=Fn.merge({},e.options.theme,e.options),e.symbols=Vn.merge(e.options),e.styles=Yn.merge(e.options)}});var gs=A((fs,ys)=>{var hs=process.env.TERM_PROGRAM==="Apple_Terminal",Qn=V(),lt=R(),L=ys.exports=fs,ct=!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["+(hs?"8":"u"),savePosition:"\x1B["+(hs?"7":"s"),screen:"\x1B[2J",show:"\x1B[?25h",up:"\x1B[1J"},ne=L.cursor={get hidden(){return ct},hide(){return ct=!0,F.hide},show(){return ct=!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=lt.isPrimitive(r)?String(r):"",i=lt.isPrimitive(i)?String(i):"",a=lt.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)}}},mt=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 mt.line+ne.to(0);let s=(o)=>[...Qn(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(mt.line+ne.prevLine()).repeat(i-1)+mt.line+ne.to(0)}});var ce=A((om,As)=>{var zn=he("events"),Es=V(),dt=it(),Zn=is(),Xn=as(),Jn=us(),C=R(),ae=gs();class ut extends zn{constructor(e={}){super();this.name=e.name,this.type=e.type,this.options=e,Jn(this),Zn(this),this.state=new Xn(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=kn(this.options.margin),this.setMaxListeners(0),jn(this)}async keypress(e,t={}){this.keypressed=!0;let s=dt.action(e,dt(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=C.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=Es(s);let r=Es(e),i=r.indexOf(s),o=r.slice(0,i),a=r.slice(i).split(`
7
- `),p=a[0],l=a[a.length-1],d=(s+(t?" "+t:"")).length,h=d<p.length?p.slice(d+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=`
3
+ var ai=Object.create;var{getPrototypeOf:ii,defineProperty:Lt,getOwnPropertyNames:ni}=Object;var li=Object.prototype.hasOwnProperty;function di(e){return this[e]}var mi,ci,te=(e,t,s)=>{var r=e!=null&&typeof e==="object";if(r){var o=t?mi??=new WeakMap:ci??=new WeakMap,a=o.get(e);if(a)return a}s=e!=null?ai(ii(e)):{};let i=t||!e||!e.__esModule?Lt(s,"default",{value:e,enumerable:!0}):s;for(let n of ni(e))if(!li.call(i,n))Lt(i,n,{get:di.bind(e,n),enumerable:!0});if(r)o.set(e,i);return i};var x=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var y=function(e,t,s,r){var o=arguments.length,a=o<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,s):r,i;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")a=Reflect.decorate(e,t,s,r);else for(var n=e.length-1;n>=0;n--)if(i=e[n])a=(o<3?i(a):o>3?i(t,s,a):i(t,s))||a;return o>3&&a&&Object.defineProperty(t,s,a),a};var he=import.meta.require;var Kt=x((Ic,fe)=>{var xi=typeof process<"u"&&process.env.TERM_PROGRAM==="Hyper",wi=typeof process<"u"&&process.platform==="win32",Wt=typeof process<"u"&&process.platform==="linux",st={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"},qt=Object.assign({},st,{check:"\u221A",cross:"\xD7",ellipsisLarge:"...",ellipsis:"...",info:"i",questionSmall:"?",pointer:">",pointerSmall:"\xBB",radioOff:"( )",radioOn:"(*)",warning:"\u203C"}),kt=Object.assign({},st,{ballotCross:"\u2718",check:"\u2714",cross:"\u2716",ellipsisLarge:"\u22EF",ellipsis:"\u2026",info:"\u2139",questionFull:"\uFF1F",questionSmall:"\uFE56",pointer:Wt?"\u25B8":"\u276F",pointerSmall:Wt?"\u2023":"\u203A",radioOff:"\u25EF",radioOn:"\u25C9",warning:"\u26A0"});fe.exports=wi&&!xi?qt:kt;Reflect.defineProperty(fe.exports,"common",{enumerable:!1,value:st});Reflect.defineProperty(fe.exports,"windows",{enumerable:!1,value:qt});Reflect.defineProperty(fe.exports,"other",{enumerable:!1,value:kt})});var ve=x((Lc,rt)=>{var Ei=(e)=>e!==null&&typeof e==="object"&&!Array.isArray(e),Ai=/[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g,Ni=()=>{if(typeof process<"u")return process.env.FORCE_COLOR!=="0";return!1},Ht=()=>{let e={enabled:Ni(),visible:!0,styles:{},keys:{}},t=(a)=>{let i=a.open=`\x1B[${a.codes[0]}m`,n=a.close=`\x1B[${a.codes[1]}m`,l=a.regex=new RegExp(`\\u001b\\[${a.codes[1]}m`,"g");return a.wrap=(d,u)=>{if(d.includes(n))d=d.replace(l,n+i);let c=i+d+n;return u?c.replace(/\r*\n/g,`${n}$&${i}`):c},a},s=(a,i,n)=>{return typeof a==="function"?a(i):a.wrap(i,n)},r=(a,i)=>{if(a===""||a==null)return"";if(e.enabled===!1)return a;if(e.visible===!1)return"";let n=""+a,l=n.includes(`
4
+ `),d=i.length;if(d>0&&i.includes("unstyle"))i=[...new Set(["unstyle",...i])].reverse();while(d-- >0)n=s(e.styles[i[d]],n,l);return n},o=(a,i,n)=>{e.styles[a]=t({name:a,codes:i}),(e.keys[n]||(e.keys[n]=[])).push(a),Reflect.defineProperty(e,a,{configurable:!0,enumerable:!0,set(d){e.alias(a,d)},get(){let d=(u)=>r(u,d.stack);return Reflect.setPrototypeOf(d,e),d.stack=this.stack?this.stack.concat(a):[a],d}})};return o("reset",[0,0],"modifier"),o("bold",[1,22],"modifier"),o("dim",[2,22],"modifier"),o("italic",[3,23],"modifier"),o("underline",[4,24],"modifier"),o("inverse",[7,27],"modifier"),o("hidden",[8,28],"modifier"),o("strikethrough",[9,29],"modifier"),o("black",[30,39],"color"),o("red",[31,39],"color"),o("green",[32,39],"color"),o("yellow",[33,39],"color"),o("blue",[34,39],"color"),o("magenta",[35,39],"color"),o("cyan",[36,39],"color"),o("white",[37,39],"color"),o("gray",[90,39],"color"),o("grey",[90,39],"color"),o("bgBlack",[40,49],"bg"),o("bgRed",[41,49],"bg"),o("bgGreen",[42,49],"bg"),o("bgYellow",[43,49],"bg"),o("bgBlue",[44,49],"bg"),o("bgMagenta",[45,49],"bg"),o("bgCyan",[46,49],"bg"),o("bgWhite",[47,49],"bg"),o("blackBright",[90,39],"bright"),o("redBright",[91,39],"bright"),o("greenBright",[92,39],"bright"),o("yellowBright",[93,39],"bright"),o("blueBright",[94,39],"bright"),o("magentaBright",[95,39],"bright"),o("cyanBright",[96,39],"bright"),o("whiteBright",[97,39],"bright"),o("bgBlackBright",[100,49],"bgBright"),o("bgRedBright",[101,49],"bgBright"),o("bgGreenBright",[102,49],"bgBright"),o("bgYellowBright",[103,49],"bgBright"),o("bgBlueBright",[104,49],"bgBright"),o("bgMagentaBright",[105,49],"bgBright"),o("bgCyanBright",[106,49],"bgBright"),o("bgWhiteBright",[107,49],"bgBright"),e.ansiRegex=Ai,e.hasColor=e.hasAnsi=(a)=>{return e.ansiRegex.lastIndex=0,typeof a==="string"&&a!==""&&e.ansiRegex.test(a)},e.alias=(a,i)=>{let n=typeof i==="string"?e[i]:i;if(typeof n!=="function")throw TypeError("Expected alias to be the name of an existing color (string) or a function");if(!n.stack)Reflect.defineProperty(n,"name",{value:a}),e.styles[a]=n,n.stack=[a];Reflect.defineProperty(e,a,{configurable:!0,enumerable:!0,set(l){e.alias(a,l)},get(){let l=(d)=>r(d,l.stack);return Reflect.setPrototypeOf(l,e),l.stack=this.stack?this.stack.concat(n.stack):n.stack,l}})},e.theme=(a)=>{if(!Ei(a))throw TypeError("Expected theme to be an object");for(let i of Object.keys(a))e.alias(i,a[i]);return e},e.alias("unstyle",(a)=>{if(typeof a==="string"&&a!=="")return e.ansiRegex.lastIndex=0,a.replace(e.ansiRegex,"");return""}),e.alias("noop",(a)=>a),e.none=e.clear=e.noop,e.stripColor=e.unstyle,e.symbols=Kt(),e.define=o,e};rt.exports=Ht();rt.exports.create=Ht});var C=x((Ti)=>{var vi=Object.prototype.toString,I=ve(),Vt=!1,ge=new Set,Yt={yellow:"blue",cyan:"red",green:"magenta",black:"white",blue:"yellow",red:"cyan",magenta:"green",white:"black"};Ti.longest=(e,t)=>{return e.reduce((s,r)=>Math.max(s,t?r[t].length:r.length),0)};Ti.hasColor=(e)=>!!e&&I.hasColor(e);var Te=Ti.isObject=(e)=>{return e!==null&&typeof e==="object"&&!Array.isArray(e)};Ti.nativeType=(e)=>{return vi.call(e).slice(8,-1).toLowerCase().replace(/\s/g,"")};Ti.isAsyncFn=(e)=>{return Ti.nativeType(e)==="asyncfunction"};Ti.isPrimitive=(e)=>{return e!=null&&typeof e!=="object"&&typeof e!=="function"};Ti.resolve=(e,t,...s)=>{if(typeof t==="function")return t.call(e,...s);return t};Ti.scrollDown=(e=[])=>[...e.slice(1),e[0]];Ti.scrollUp=(e=[])=>[e.pop(),...e];Ti.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};Ti.swap=(e,t,s)=>{let r=e.length,o=s===r?0:s<0?r-1:s,a=e[t];e[t]=e[o],e[o]=a};Ti.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};Ti.height=(e,t=20)=>{let s=e&&e.rows?e.rows:t;if(e&&typeof e.getWindowSize==="function")s=e.getWindowSize()[1];return s};Ti.wordWrap=(e,t={})=>{if(!e)return e;if(typeof t==="number")t={width:t};let{indent:s="",newline:r=`
5
+ `+s,width:o=80}=t,a=(r+s).match(/[^\S\n]/g)||[];o-=a.length;let i=`.{1,${o}}([\\s\\u200B]+|$)|[^\\s\\u200B]+?([\\s\\u200B]+|$)`,n=e.trim(),l=new RegExp(i,"g"),d=n.match(l)||[];if(d=d.map((u)=>u.replace(/\n$/,"")),t.padEnd)d=d.map((u)=>u.padEnd(o," "));if(t.padStart)d=d.map((u)=>u.padStart(o," "));return s+d.join(r)};Ti.unmute=(e)=>{let t=e.stack.find((r)=>I.keys.color.includes(r));if(t)return I[t];if(e.stack.find((r)=>r.slice(2)==="bg"))return I[t.slice(2)];return(r)=>r};Ti.pascal=(e)=>e?e[0].toUpperCase()+e.slice(1):"";Ti.inverse=(e)=>{if(!e||!e.stack)return e;let t=e.stack.find((r)=>I.keys.color.includes(r));if(t){let r=I["bg"+Ti.pascal(t)];return r?r.black:e}let s=e.stack.find((r)=>r.slice(0,2)==="bg");if(s)return I[s.slice(2).toLowerCase()]||e;return I.none};Ti.complement=(e)=>{if(!e||!e.stack)return e;let t=e.stack.find((r)=>I.keys.color.includes(r)),s=e.stack.find((r)=>r.slice(0,2)==="bg");if(t&&!s)return I[Yt[t]||t];if(s){let r=s.slice(2).toLowerCase(),o=Yt[r];if(!o)return e;return I["bg"+Ti.pascal(o)]||e}return I.none};Ti.meridiem=(e)=>{let t=e.getHours(),s=e.getMinutes(),r=t>=12?"pm":"am";t=t%12;let o=t===0?12:t,a=s<10?"0"+s:s;return o+":"+a+" "+r};Ti.set=(e={},t="",s)=>{return t.split(".").reduce((r,o,a,i)=>{let n=i.length-1>a?r[o]||{}:s;if(!Ti.isObject(n)&&a<i.length-1)n={};return r[o]=n},e)};Ti.get=(e={},t="",s)=>{let r=e[t]==null?t.split(".").reduce((o,a)=>o&&o[a],e):e[t];return r==null?s:r};Ti.mixin=(e,t)=>{if(!Te(e))return t;if(!Te(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)&&Te(r.value)){let o=Object.getOwnPropertyDescriptor(e,s);if(Te(o.value)&&o.value!==r.value)e[s]=Ti.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};Ti.merge=(...e)=>{let t={};for(let s of e)Ti.mixin(t,s);return t};Ti.mixinEmitter=(e,t)=>{let s=t.constructor.prototype;for(let r of Object.keys(s)){let o=s[r];if(typeof o==="function")Ti.define(e,r,o.bind(t));else Ti.define(e,r,o)}};var Se=(e,t)=>{if(Vt)return;if(Vt=!0,ge.forEach((s)=>s()),e===!0)process.exit(128+t)},Ft=Se.bind(null,!0,15),jt=Se.bind(null,!0,2);Ti.onExit=(e)=>{if(ge.size===0)process.once("SIGTERM",Ft),process.once("SIGINT",jt),process.once("exit",Se);return ge.add(e),()=>{if(ge.delete(e),ge.size===0)process.off("SIGTERM",Ft),process.off("SIGINT",jt),process.off("exit",Se)}};Ti.define=(e,t,s)=>{Reflect.defineProperty(e,t,{value:s})};Ti.defineExport=(e,t,s)=>{let r;Reflect.defineProperty(e,t,{enumerable:!0,configurable:!0,set(o){r=o},get(){return r?r():s()}})}});var Jt=x((Gc,Xt)=>{Xt.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 se=x(($c,es)=>{var zi=Jt();es.exports=(e)=>typeof e==="string"?e.replace(zi(),""):e});var ts=x((Zi)=>{Zi.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"};Zi.shift={up:"shiftUp",down:"shiftDown",left:"shiftLeft",right:"shiftRight",tab:"prev"};Zi.fn={up:"pageUp",down:"pageDown",left:"pageLeft",right:"pageRight",delete:"deleteForward"};Zi.option={b:"backward",f:"forward",d:"cutRight",left:"cutLeft",up:"altUp",down:"altDown"};Zi.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 rs=x((qc,ss)=>{ss.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 at=x((kc,as)=>{var os=he("readline"),sn=ts(),rn=rs(),on=/^(?:\x1b)([a-zA-Z0-9])$/,an=/^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/,nn={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 ln(e){return["[a","[b","[c","[d","[e","[2$","[3$","[5$","[6$","[7$","[8$","[Z"].includes(e)}function dn(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=on.exec(e))r.meta=!0,r.shift=/^[A-Z]$/.test(s[1]);else if(s=an.exec(e)){let o=[...e];if(o[0]==="\x1B"&&o[1]==="\x1B")r.option=!0;let a=[s[1],s[2],s[4],s[6]].filter(Boolean).join(""),i=(s[3]||s[5]||1)-1;r.ctrl=!!(i&4),r.meta=!!(i&10),r.shift=!!(i&1),r.code=a,r.name=nn[a],r.shift=ln(a)||r.shift,r.ctrl=dn(a)||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=os.createInterface({terminal:!0,input:s});os.emitKeypressEvents(s,r);let o=new rn((n,l)=>t(n,Me(n,l),r)),a=s.isRaw;if(s.isTTY)s.setRawMode(!0);return s.on("keypress",o.enqueue),r.resume(),()=>{if(s.isTTY)s.setRawMode(a);s.removeListener("keypress",o.enqueue),o.destroy(),r.pause(),r.close()}};Me.action=(e,t,s)=>{let r={...sn,...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};as.exports=Me});var ns=x((Kc,is)=>{is.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};mn(e,s,r)}};function mn(e,t,s={}){let r=e.timers[t]={name:t,start:Date.now(),ms:0,tick:0},o=s.interval||120;r.frames=s.frames||[],r.loading=!0;let a=setInterval(()=>{r.ms=Date.now()-r.start,r.tick++,e.render()},o);return r.stop=()=>{r.loading=!1,clearInterval(a)},Reflect.defineProperty(r,"interval",{value:a}),e.once("close",()=>r.stop()),r.stop}});var ms=x((Hc,ds)=>{var{define:cn,width:pn}=C();class ls{constructor(e){let t=e.options;cn(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=pn(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"}}ds.exports=ls});var ps=x((Vc,cs)=>{var it=C(),M=ve(),nt={default:M.noop,noop:M.noop,set inverse(e){this._inverse=e},get inverse(){return this._inverse||it.inverse(this.primary)},set complement(e){this._complement=e},get complement(){return this._complement||it.complement(this.primary)},primary:M.cyan,success:M.green,danger:M.magenta,strong:M.bold,warning:M.yellow,muted:M.dim,disabled:M.gray,dark:M.dim.gray,underline:M.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}};nt.merge=(e={})=>{if(e.styles&&typeof e.styles.enabled==="boolean")M.enabled=e.styles.enabled;if(e.styles&&typeof e.styles.visible==="boolean")M.visible=e.styles.visible;let t=it.merge({},nt,e.styles);delete t.merge;for(let s of Object.keys(M))if(!hasOwnProperty.call(t,s))Reflect.defineProperty(t,s,{get:()=>M[s]});for(let s of Object.keys(M.styles))if(!hasOwnProperty.call(t,s))Reflect.defineProperty(t,s,{get:()=>M[s]});return t};cs.exports=nt});var hs=x((Yc,us)=>{var lt=process.platform==="win32",K=ve(),un=C(),dt={...K.symbols,upDownDoubleArrow:"\u21D5",upDownDoubleArrow2:"\u2B0D",upDownArrow:"\u2195",asterisk:"*",asterism:"\u2042",bulletWhite:"\u25E6",electricArrow:"\u2301",ellipsisLarge:"\u22EF",ellipsisSmall:"\u2026",fullBlock:"\u2588",identicalTo:"\u2261",indicator:K.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:K.symbols.question,submitted:K.symbols.check,cancelled:K.symbols.cross},separator:{pending:K.symbols.pointerSmall,submitted:K.symbols.middot,cancelled:K.symbols.middot},radio:{off:lt?"( )":"\u25EF",on:lt?"(*)":"\u25C9",disabled:lt?"(|)":"\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"]};dt.merge=(e)=>{let t=un.merge({},K.symbols,dt,e.symbols);return delete t.merge,t};us.exports=dt});var gs=x((Fc,fs)=>{var hn=ps(),fn=hs(),gn=C();fs.exports=(e)=>{e.options=gn.merge({},e.options.theme,e.options),e.symbols=fn.merge(e.options),e.styles=hn.merge(e.options)}});var ws=x((bs,xs)=>{var ys=process.env.TERM_PROGRAM==="Apple_Terminal",yn=se(),mt=C(),L=xs.exports=bs,ct=!1,re=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["+(ys?"8":"u"),savePosition:"\x1B["+(ys?"7":"s"),screen:"\x1B[2J",show:"\x1B[?25h",up:"\x1B[1J"},ne=L.cursor={get hidden(){return ct},hide(){return ct=!0,re.hide},show(){return ct=!1,re.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 o=0;o<s;o++)if(r=e.charCodeAt(o),r>=0&&r<=128)t+=1;else t+=2;return t},restore(e={}){let{after:t,cursor:s,initial:r,input:o,prompt:a,size:i,value:n}=e;if(r=mt.isPrimitive(r)?String(r):"",o=mt.isPrimitive(o)?String(o):"",n=mt.isPrimitive(n)?String(n):"",i){let l=L.cursor.up(i)+L.cursor.to(this.strLen(a)),d=o.length-s;if(d>0)l+=L.cursor.left(d);return l}if(n||t){let l=!o&&!!r?-this.strLen(r):-this.strLen(o)+s;if(t)l-=this.strLen(t);if(o===""&&r&&!a.includes(r))l+=this.strLen(r);return L.cursor.move(l)}}},pt=L.erase={screen:re.screen,up:re.up,down:re.down,line:re.line,lineEnd:re.lineEnd,lineStart:re.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=(a)=>[...yn(a)].length,r=e.split(/\r?\n/),o=0;for(let a of r)o+=1+Math.floor(Math.max(s(a)-1,0)/t);return(pt.line+ne.prevLine()).repeat(o-1)+pt.line+ne.to(0)}});var ce=x((jc,As)=>{var bn=he("events"),Es=se(),ut=at(),xn=ns(),wn=ms(),En=gs(),D=C(),le=ws();class ht extends bn{constructor(e={}){super();this.name=e.name,this.type=e.type,this.options=e,En(this),xn(this),this.state=new wn(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=Nn(this.options.margin),this.setMaxListeners(0),An(this)}async keypress(e,t={}){this.keypressed=!0;let s=ut.action(e,ut(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(le.code.beep)}cursorHide(){this.stdout.write(le.cursor.hide());let e=D.onExit(()=>this.cursorShow());this.on("close",()=>{this.cursorShow(),e()})}cursorShow(){this.stdout.write(le.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(le.cursor.down(e)+le.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:o="",input:a="",value:i=""}=this,n=this.state.size=s.length,l={after:t,cursor:r,initial:o,input:a,prompt:e,size:n,value:i},d=le.cursor.restore(l);if(d)this.stdout.write(d)}sections(){let{buffer:e,input:t,prompt:s}=this.state;s=Es(s);let r=Es(e),o=r.indexOf(s),a=r.slice(0,o),n=r.slice(o).split(`
7
+ `),l=n[0],d=n[n.length-1],c=(s+(t?" "+t:"")).length,p=c<l.length?l.slice(c+1):"";return{header:a,prompt:l,after:p,rest:n.slice(1),last:d}}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
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=dt.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 c=await this.resolve(l,i,t,s);if(!c&&t&&t[e])return this.resolve(p,i,t,s);return c}async prefix(){let e=await this.element("prefix")||this.symbols,t=this.timers&&this.timers.prefix,s=this.state;if(s.timer=t,C.isObject(e))e=e[s.status]||e.pending;if(!C.hasColor(e))return(this.styles[s.status]||this.styles.pending)(e);return e}async message(){let e=await this.element("message");if(!C.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(C.isObject(i))i=i[s.status]||i.pending;if(!C.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"&&C.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=!C.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"&&C.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!C.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(!C.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 C.resolve(this,e,...t)}get base(){return ut.prototype}get style(){return this.styles[this.state.status]}get height(){return this.options.rows||C.height(this.stdout,25)}get width(){return this.options.columns||C.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 jn(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 kn(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}As.exports=ut});var xs=A((nm,ws)=>{var ea=R(),bs={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 bs.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}};ws.exports=(e,t={})=>{let s=ea.merge({},bs,t.roles);return s[e]||s.default}});var ge=A((am,Ts)=>{var ta=V(),sa=ce(),ra=xs(),ve=R(),{reorder:ht,scrollUp:ia,scrollDown:oa,isObject:Ss,swap:na}=ve;class Ms extends sa{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(Ss(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=ra(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,ve.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,ta(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 Ns(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=ht(this.choices),a=n.indexOf(o);if(i.index>a){let p=n.slice(a,a+this.limit),l=n.filter((c)=>!p.includes(c));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=ht(this.choices),this.index=0,this.render()}end(){let e=this.choices.length-this.limit,t=ht(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=ia(this.choices),this.index=e,this.isDisabled())return this.up();return this.render()}scrollDown(e=this.visible.length-1){if(this.choices=oa(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){na(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(Ss(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=ve.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 Ns(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 Ns(e,t){if(t instanceof Promise)return t;if(typeof t==="function"){if(ve.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}Ts.exports=Ms});var Q=A((pm,vs)=>{var aa=ge(),ft=R();class _s extends aa{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"&&!ft.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&&!ft.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(!ft.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(`
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(le.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=ut.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),o=this.submit.bind(this);delete this.options.onSubmit,this.submit=async()=>{return await r(this.name,this.value,this),o()}}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:o,symbols:a,timers:i}=this,n=i&&i[e];o.timer=n;let l=r[e]||o[e]||a[e],d=t&&t[e]!=null?t[e]:await l;if(d==="")return d;let u=await this.resolve(d,o,t,s);if(!u&&t&&t[e])return this.resolve(l,o,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,D.isObject(e))e=e[s.status]||e.pending;if(!D.hasColor(e))return(this.styles[s.status]||this.styles.pending)(e);return e}async message(){let e=await this.element("message");if(!D.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,o=await this.resolve(r,s);if(D.isObject(o))o=o[s.status]||o.pending;if(!D.hasColor(o))return this.styles.muted(o);return o}async pointer(e,t){let s=await this.element("pointer",e,t);if(typeof s==="string"&&D.hasColor(s))return s;if(s){let r=this.styles,o=this.index===t,a=o?r.primary:(l)=>l,i=await this.resolve(s[o?"on":"off"]||s,this.state),n=!D.hasColor(i)?a(i):i;return o?n:" ".repeat(i.length)}}async indicator(e,t){let s=await this.element("indicator",e,t);if(typeof s==="string"&&D.hasColor(s))return s;if(s){let r=this.styles,o=e.enabled===!0,a=o?r.success:r.dark,i=s[o?"on":"off"]||s;return!D.hasColor(i)?a(i):i}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(!D.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 D.resolve(this,e,...t)}get base(){return ht.prototype}get style(){return this.styles[this.state.status]}get height(){return this.options.rows||D.height(this.stdout,25)}get width(){return this.options.columns||D.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 An(e){let t=(o)=>{return e[o]===void 0||typeof e[o]==="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 o of Object.keys(e.options)){if(s.includes(o))continue;if(/^on[A-Z]/.test(o))continue;let a=e.options[o];if(typeof a==="function"&&t(o)){if(!r.includes(o))e[o]=a.bind(e)}else if(typeof e[o]!=="function")e[o]=a}}function Nn(e){if(typeof e==="number")e=[e,e,e,e];let t=[].concat(e||[]),s=(o)=>o%2===0?`
11
+ `:" ",r=[];for(let o=0;o<4;o++){let a=s(o);if(t[o])r.push(a.repeat(t[o]));else r.push("")}return r}As.exports=ht});var Ts=x((zc,vs)=>{var vn=C(),Ns={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 Ns.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}};vs.exports=(e,t={})=>{let s=vn.merge({},Ns,t.roles);return s[e]||s.default}});var ye=x((Zc,Cs)=>{var Tn=se(),Sn=ce(),Mn=Ts(),Re=C(),{reorder:ft,scrollUp:Rn,scrollDown:Cn,isObject:Ss,swap:_n}=Re;class Rs extends Sn{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((o)=>o.enabled=!1),typeof r!=="function"&&this.selectable.length===0)throw Error("At least one choice must be selectable");if(Ss(t))t=Object.keys(t);if(Array.isArray(t)){if(s!=null)this.index=this.findIndex(s);t.forEach((o)=>this.enable(this.find(o))),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,o=async(a,i)=>{if(typeof a==="function")a=await a.call(this);if(a instanceof Promise)a=await a;for(let n=0;n<a.length;n++){let l=a[n]=await this.toChoice(a[n],r++,i);if(s.push(l),l.choices)await o(l.choices,l)}return s};return o(e,t).then((a)=>{return this.state.loadingChoices=!1,a})}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=Mn(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,Re.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,Tn(e.message).length);let a={...e};if(e.reset=(i=a.input,n=a.value)=>{for(let l of Object.keys(a))e[l]=a[l];e.input=i,e.value=n},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},o=await this.addChoice(r,t,s);return o.updateChoice=()=>{delete o.newChoice,o.name=o.message=o.input,o.input="",o.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((o)=>this.isDisabled(o));s.enabled=r.every((o)=>o.enabled===!0),s=s.parent}return Ms(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 o=this.focused,a=this.choices.find((i)=>r===i.index);if(!a.enabled&&this.selected.length>=this.maxSelected)return this.alert();if(this.visible.indexOf(a)===-1){let i=ft(this.choices),n=i.indexOf(a);if(o.index>n){let l=i.slice(n,n+this.limit),d=i.filter((u)=>!l.includes(u));this.choices=l.concat(d)}else{let l=n-this.limit+1;this.choices=i.slice(l).concat(i.slice(0,l))}}return this.index=this.choices.indexOf(a),this.toggle(this.focused),this.render()};return clearTimeout(this.numberTimeout),new Promise((s)=>{let r=this.choices.length,o=this.num,a=(i=!1,n)=>{if(clearTimeout(this.numberTimeout),i)n=t(o);this.num="",s(n)};if(o==="0"||o.length===1&&Number(o+"0")>r)return a(!0);if(Number(o)>r)return a(!1,this.alert());this.numberTimeout=setTimeout(()=>a(!0),this.delay)})}home(){return this.choices=ft(this.choices),this.index=0,this.render()}end(){let e=this.choices.length-this.limit,t=ft(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=Rn(this.choices),this.index=e,this.isDisabled())return this.up();return this.render()}scrollDown(e=this.visible.length-1){if(this.choices=Cn(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){_n(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:(i,n)=>[i.name,n].includes(e),a=(this.options.multiple?this.state._choices:this.choices).filter(r);if(t)return a.map((i)=>i[t]);return a}find(e,t){if(Ss(e))return t?e[t]:e;let r=typeof e==="function"?e:(a,i)=>[a.name,i].includes(e),o=this.choices.find(r);if(o)return t?o[t]:o}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((a)=>a.newChoice))return this.alert();let{reorder:t,sort:s}=this.options,r=this.multiple===!0,o=this.selected;if(o===void 0)return this.alert();if(Array.isArray(o)&&t!==!1&&s!==!0)o=Re.reorder(o);return this.value=r?o.map((a)=>a.name):o.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 Ms(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 Ms(e,t){if(t instanceof Promise)return t;if(typeof t==="function"){if(Re.isAsyncFn(t))return t;t=t.call(e,e)}for(let s of t){if(Array.isArray(s.choices)){let r=s.choices.filter((o)=>!e.isDisabled(o));s.enabled=r.every((o)=>o.enabled===!0)}if(e.isDisabled(s)===!0)delete s.enabled}return t}Cs.exports=Rs});var oe=x((Qc,Ds)=>{var Dn=ye(),gt=C();class _s extends Dn{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"&&!gt.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),o=await this.indicator(e,t)+(e.pad||""),a=await this.resolve(e.hint,this.state,e,t);if(a&&!gt.hasColor(a))a=this.styles.muted(a);let i=this.indent(e),n=await this.choiceMessage(e,t),l=()=>[this.margin[3],i+r+o,n,this.margin[1],a].filter(Boolean).join(" ");if(e.role==="heading")return l();if(e.disabled){if(!gt.hasColor(n))n=this.styles.disabled(n);return l()}if(s)n=this.styles.em(n);return l()}async renderChoices(){if(this.state.loading==="choices")return this.styles.warning("Loading choices");if(this.state.submitted)return"";let e=this.visible.map(async(o,a)=>await this.renderChoice(o,a)),t=await Promise.all(e);if(!t.length)t.push(this.styles.danger("No matching choices"));let s=this.margin[0]+t.join(`
12
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(),c=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,c].filter(Boolean).join(`
14
- `)),this.write(this.margin[2]),this.restore()}}vs.exports=_s});var Ds=A((lm,Cs)=>{var pa=Q(),la=(e,t)=>{let s=e?new RegExp(e,"ig"):/$^/;return(r)=>{return e?r.replace(s,(i)=>t(i)):r}};class Rs extends pa{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=la(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()}}Cs.exports=Rs});var gt=A((cm,Bs)=>{var yt=R();Bs.exports=(e,t={})=>{e.cursorHide();let{input:s="",initial:r="",pos:i,showCursor:o=!0,color:n}=t,a=n||e.styles.placeholder,p=yt.inverse(e.styles.primary),l=(y)=>p(e.styles.black(y)),c=s,d=" ",h=l(d);if(e.blink&&e.blink.off===!0)l=(y)=>y,h="";if(o&&i===0&&r===""&&s==="")return l(d);if(o&&i===0&&(s===r||s===""))return l(r[0])+a(r.slice(1));r=yt.isPrimitive(r)?`${r}`:"",s=yt.isPrimitive(s)?`${s}`:"";let m=r&&r.startsWith(s)&&r!==s,u=m?l(r[s.length]):h;if(i!==s.length&&o===!0)c=s.slice(0,i)+l(s[i])+s.slice(i+1),u="";if(o===!1)u="";if(m){let y=e.styles.unstyle(c+u);return c+u+a(r.slice(y.length))}return c+u}});var Re=A((mm,Ps)=>{var ca=V(),ma=Q(),da=gt();class Os extends ma{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:c,danger:d}=r,h=this.index===t,m=e.validate||(()=>!0),u=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 m.call(e,S,this.state)!==!0)f="danger";let b=r[f],x=b(await this.indicator(e,t))+(e.pad||""),N=this.indent(e),T=()=>[N,x,y+u,a].filter(Boolean).join(" ");if(s.submitted)return y=ca(y),a=l(a),T();if(e.format)a=await e.format.call(this,a,e,t);else{let v=this.styles.muted;a=da(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=c(y);if(e.error)a+=(a?" ":"")+d(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)}}Ps.exports=Os});var Et=A((dm,Ls)=>{var ua=Re(),ha=()=>{throw Error("expected prompt to have a custom authenticate method")},Is=(e=ha)=>{class t extends ua{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 Is(s)}}return t};Ls.exports=Is()});var Us=A((um,Gs)=>{var fa=Et();function ya(e,t){if(e.username===this.options.username&&e.password===this.options.password)return!0;return!1}var $s=(e=ya)=>{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 fa.create(e){constructor(r){super({...r,choices:t})}static create(r){return $s(r)}}return s};Gs.exports=$s()});var Ce=A((hm,Ks)=>{var ga=ce(),{isPrimitive:Ea,hasColor:Aa}=R();class qs extends ga{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 Ea(e)&&(this.isTrue(e)||this.isFalse(e))}async hint(){if(this.state.status==="pending"){let e=await this.element("hint");if(!Aa(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),c=await this.error()||await this.hint(),d=await this.footer();if(c&&!n.includes(c))l+=" "+c;n+=" "+l,this.clear(t),this.write([a,n,d].filter(Boolean).join(`
15
- `)),this.restore()}set value(e){super.value=e}get value(){return this.cast(super.value)}}Ks.exports=qs});var Ys=A((fm,Ws)=>{var ba=Ce();class Hs extends ba{constructor(e){super(e);this.default=this.options.default||(this.initial?"(Y/n)":"(y/N)")}}Ws.exports=Hs});var Qs=A((ym,Fs)=>{var wa=Q(),xa=Re(),me=xa.prototype;class Vs extends wa{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 me.dispatch.call(this,e,t)}append(e,t){return me.append.call(this,e,t)}delete(e,t){return me.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?me.next.call(this):super.next()}prev(){return this.focused.editable?me.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 me.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)}}Fs.exports=Vs});var pe=A((gm,Zs)=>{var Sa=ce(),Na=it(),Ma=gt(),{isPrimitive:Ta}=R();class zs extends Sa{constructor(e){super(e);if(this.initial=Ta(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?Na(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 Ma(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()}}Zs.exports=zs});var Js=A((Em,Xs)=>{var _a=(e)=>e.filter((t,s)=>e.lastIndexOf(t)===s),De=(e)=>_a(e).filter(Boolean);Xs.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:De([s,...o]),present:n};case"next":case"redo":return o=r.slice(1),n=r[0]||"",{past:De([...o,s]),present:n};case"save":return{past:De([...r,s]),present:""};case"remove":if(n=De(r.filter((a)=>a!==s)),i="",n.length)i=n.pop();return{past:n,present:i};default:throw Error(`Invalid action: "${e}"`)}}});var At=A((Am,er)=>{var va=pe(),js=Js();class ks extends va{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=js(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=js("save",this.data,this.input),this.store.set("values",this.data)}submit(){if(this.store&&this.autosave===!0)this.save();return super.submit()}}er.exports=ks});var rr=A((bm,sr)=>{var Ra=pe();class tr extends Ra{format(){return""}}sr.exports=tr});var nr=A((wm,or)=>{var Ca=pe();class ir extends Ca{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()}}or.exports=ir});var lr=A((xm,pr)=>{var Da=Q();class ar extends Da{constructor(e){super({...e,multiple:!0})}}pr.exports=ar});var bt=A((Sm,mr)=>{var Ba=pe();class cr extends Ba{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()}}mr.exports=cr});var hr=A((Nm,ur)=>{var Oa=pe();class dr extends Oa{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))}}ur.exports=dr});var Er=A((Mm,gr)=>{var Pa=V(),Ia=ge(),fr=R();class yr extends Ia{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||`
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(),o=await this.prefix(),a=await this.separator(),i=await this.message();if(this.options.promptLine!==!1)s=[o,i,a,""].join(" "),this.state.prompt=s;let n=await this.format(),l=await this.error()||await this.hint(),d=await this.renderChoices(),u=await this.footer();if(n)s+=n;if(l&&!s.includes(l))s+=" "+l;if(e&&!n&&!d.trim()&&this.multiple&&this.emptyError!=null)s+=this.styles.danger(this.emptyError);this.clear(t),this.write([r,s,d,u].filter(Boolean).join(`
14
+ `)),this.write(this.margin[2]),this.restore()}}Ds.exports=_s});var Bs=x((Xc,Os)=>{var Pn=oe(),On=(e,t)=>{let s=e?new RegExp(e,"ig"):/$^/;return(r)=>{return e?r.replace(s,(o)=>t(o)):r}};class Ps extends Pn{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=(o,a)=>{if(!o)return o;if(e.stack)return e(o);return e.call(this,o)},s=On(this.input,t),r=this.choices;this.choices=r.map((o)=>({...o,message:s(o.message)})),await super.render(),this.choices=r}submit(){if(this.options.multiple)this.value=this.selected.map((e)=>e.name);return super.submit()}}Os.exports=Ps});var bt=x((Jc,Is)=>{var yt=C();Is.exports=(e,t={})=>{e.cursorHide();let{input:s="",initial:r="",pos:o,showCursor:a=!0,color:i}=t,n=i||e.styles.placeholder,l=yt.inverse(e.styles.primary),d=(f)=>l(e.styles.black(f)),u=s,c=" ",p=d(c);if(e.blink&&e.blink.off===!0)d=(f)=>f,p="";if(a&&o===0&&r===""&&s==="")return d(c);if(a&&o===0&&(s===r||s===""))return d(r[0])+n(r.slice(1));r=yt.isPrimitive(r)?`${r}`:"",s=yt.isPrimitive(s)?`${s}`:"";let m=r&&r.startsWith(s)&&r!==s,h=m?d(r[s.length]):p;if(o!==s.length&&a===!0)u=s.slice(0,o)+d(s[o])+s.slice(o+1),h="";if(a===!1)h="";if(m){let f=e.styles.unstyle(u+h);return u+h+n(r.slice(f.length))}return u+h}});var Ce=x((ep,Us)=>{var Bn=se(),In=oe(),Ln=bt();class Ls extends In{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:o,initial:a="",name:i,input:n=""}=e,{muted:l,submitted:d,primary:u,danger:c}=r,p=this.index===t,m=e.validate||(()=>!0),h=await this.choiceSeparator(e,t),f=e.message;if(this.align==="right")f=f.padStart(this.longest+1," ");if(this.align==="left")f=f.padEnd(this.longest+1," ");let w=this.values[i]=n||a,g=n?"success":"dark";if(await m.call(e,w,this.state)!==!0)g="danger";let E=r[g],A=E(await this.indicator(e,t))+(e.pad||""),v=this.indent(e),S=()=>[v,A,f+h,n].filter(Boolean).join(" ");if(s.submitted)return f=Bn(f),n=d(n),S();if(e.format)n=await e.format.call(this,n,e,t);else{let _=this.styles.muted;n=Ln(this,{input:n,initial:a,pos:o,showCursor:p,color:_})}if(!this.isValue(n))n=this.styles.muted(this.symbols.ellipsis);if(e.result)this.values[i]=await e.result.call(this,w,e,t);if(p)f=u(f);if(e.error)n+=(n?" ":"")+c(e.error.trim());else if(e.hint)n+=(n?" ":"")+l(e.hint.trim());return S()}async submit(){return this.value=this.values,super.base.submit.call(this)}}Us.exports=Ls});var xt=x((tp,$s)=>{var Un=Ce(),Gn=()=>{throw Error("expected prompt to have a custom authenticate method")},Gs=(e=Gn)=>{class t extends Un{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 Gs(s)}}return t};$s.exports=Gs()});var ks=x((sp,qs)=>{var $n=xt();function Wn(e,t){if(e.username===this.options.username&&e.password===this.options.password)return!0;return!1}var Ws=(e=Wn)=>{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 $n.create(e){constructor(r){super({...r,choices:t})}static create(r){return Ws(r)}}return s};qs.exports=Ws()});var _e=x((rp,Hs)=>{var qn=ce(),{isPrimitive:kn,hasColor:Kn}=C();class Ks extends qn{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 kn(e)&&(this.isTrue(e)||this.isFalse(e))}async hint(){if(this.state.status==="pending"){let e=await this.element("hint");if(!Kn(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(),o=await this.message(),a=this.styles.muted(this.default),i=[s,o,a,r].filter(Boolean).join(" ");this.state.prompt=i;let n=await this.header(),l=this.value=this.cast(e),d=await this.format(l),u=await this.error()||await this.hint(),c=await this.footer();if(u&&!i.includes(u))d+=" "+u;i+=" "+d,this.clear(t),this.write([n,i,c].filter(Boolean).join(`
15
+ `)),this.restore()}set value(e){super.value=e}get value(){return this.cast(super.value)}}Hs.exports=Ks});var Fs=x((op,Ys)=>{var Hn=_e();class Vs extends Hn{constructor(e){super(e);this.default=this.options.default||(this.initial?"(Y/n)":"(y/N)")}}Ys.exports=Vs});var Zs=x((ap,zs)=>{var Vn=oe(),Yn=Ce(),pe=Yn.prototype;class js extends Vn{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 pe.dispatch.call(this,e,t)}append(e,t){return pe.append.call(this,e,t)}delete(e,t){return pe.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?pe.next.call(this):super.next()}prev(){return this.focused.editable?pe.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 pe.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)}}zs.exports=js});var de=x((ip,Xs)=>{var Fn=ce(),jn=at(),zn=bt(),{isPrimitive:Zn}=C();class Qs extends Fn{constructor(e){super(e);if(this.initial=Zn(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?jn(e,{}):{}){let s=Date.now(),r=s-this.lastKeypress;this.lastKeypress=s;let o=t.name==="return"||t.name==="enter",a=this.state.prevKeypress,i;if(this.state.prevKeypress=t,this.keypressTimeout!=null&&o){if(r<this.keypressTimeout)return this.submit();this.state.multilineBuffer=this.state.multilineBuffer||"",this.state.multilineBuffer+=e,i=!0,a=null}if(i||this.options.multiline&&o){if(!a||a.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 zn(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(),o=[t,r,s].filter(Boolean).join(" ");this.state.prompt=o;let a=await this.header(),i=await this.format(),n=await this.error()||await this.hint(),l=await this.footer();if(n&&!i.includes(n))i+=" "+n;o+=" "+i,this.clear(e),this.write([a,o,l].filter(Boolean).join(`
17
+ `)),this.restore()}}Xs.exports=Qs});var er=x((np,Js)=>{var Qn=(e)=>e.filter((t,s)=>e.lastIndexOf(t)===s),De=(e)=>Qn(e).filter(Boolean);Js.exports=(e,t={},s="")=>{let{past:r=[],present:o=""}=t,a,i;switch(e){case"prev":case"undo":return a=r.slice(0,r.length-1),i=r[r.length-1]||"",{past:De([s,...a]),present:i};case"next":case"redo":return a=r.slice(1),i=r[0]||"",{past:De([...a,s]),present:i};case"save":return{past:De([...r,s]),present:""};case"remove":if(i=De(r.filter((n)=>n!==s)),o="",i.length)o=i.pop();return{past:i,present:o};default:throw Error(`Invalid action: "${e}"`)}}});var wt=x((lp,rr)=>{var Xn=de(),tr=er();class sr extends Xn{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=tr(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=tr("save",this.data,this.input),this.store.set("values",this.data)}submit(){if(this.store&&this.autosave===!0)this.save();return super.submit()}}rr.exports=sr});var ir=x((dp,ar)=>{var Jn=de();class or extends Jn{format(){return""}}ar.exports=or});var dr=x((mp,lr)=>{var el=de();class nr extends el{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()}}lr.exports=nr});var pr=x((cp,cr)=>{var tl=oe();class mr extends tl{constructor(e){super({...e,multiple:!0})}}cr.exports=mr});var Et=x((pp,hr)=>{var sl=de();class ur extends sl{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()}}hr.exports=ur});var yr=x((up,gr)=>{var rl=de();class fr extends rl{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))}}gr.exports=fr});var Er=x((hp,wr)=>{var ol=se(),al=ye(),br=C();class xr extends al{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
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&&!fr.hasColor(i))i=this.styles.muted(i);let o=(m)=>this.margin[3]+m.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),c=this.margin[1]+this.margin[3];this.scaleLength=Pa(l).length,this.widths[0]=Math.min(this.widths[0],this.width-this.scaleLength-c.length);let h=fr.wordWrap(p,{width:this.widths[0],newline:n}).split(`
20
- `).map((m)=>o(m)+this.margin[1]);if(s)l=this.styles.info(l),h=h.map((m)=>this.styles.info(m));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(),c=await this.renderChoices(),d=await this.footer(),h=this.emptyError;if(a)o+=a;if(l&&!o.includes(l))o+=" "+l;if(e&&!a&&!c.trim()&&this.multiple&&h!=null)o+=this.styles.danger(h);if(this.clear(t),this.write([n,o,p,c,d].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)}}gr.exports=yr});var xr=A((Tm,wr)=>{var Ar=V(),La=(e="")=>{return typeof e==="string"?e.replace(/^['"]|['"]$/g,""):""};class br{constructor(e){this.name=e.key,this.field=e.field||{},this.value=La(e.initial||this.field.initial||""),this.message=e.message||this.name,this.cursor=0,this.input="",this.lines=[]}}var $a=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 c=-1,d=()=>o[++c],h=()=>o[c+1],m=(u)=>{u.line=l,n.push(u)};m({type:"bos",value:""});while(c<o.length-1){let u=d();if(/^[^\S\n ]$/.test(u)){m({type:"text",value:u});continue}if(u===`
24
- `){m({type:"newline",value:u}),l++;continue}if(u==="\\"){u+=d(),m({type:"text",value:u});continue}if((u==="$"||u==="#"||u==="{")&&h()==="{"){let S=d();u+=S;let f={type:"template",open:u,inner:"",close:"",value:u},b;while(b=d()){if(b==="}"){if(h()==="}")b+=d();f.value+=b,f.close=b;break}if(b===":")f.initial="",f.key=f.inner;else if(f.initial!==void 0)f.initial+=b;f.value+=b,f.inner+=b}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),m(f),p.push(f.key),r.add(f.key);let x=a.find((N)=>N.name===f.key);if(f.field=i.find((N)=>N.name===f.key),!x)x=new br(f),a.push(x);x.lines.push(f.line-1);continue}let y=n[n.length-1];if(y.type==="text"&&y.line===l)y.value+=u;else m({type:"text",value:u})}return m({type:"eos",value:""}),{input:o,tabstops:n,unique:r,keys:p,items:a}};wr.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 $a(t,r),a=wt("result",e,t),p=wt("format",e,t),l=wt("validate",e,t,!0),c=e.isValue.bind(e);return async(d={},h=!1)=>{let m=0;d.required=s,d.items=o,d.keys=n,d.output="";let u=async(b,x,N,T)=>{let v=await l(b,x,N,T);if(v===!1)return"Invalid field "+N.name;return v};for(let b of i){let{value:x,key:N}=b;if(b.type!=="template"){if(x)d.output+=x;continue}if(b.type==="template"){let T=o.find((le)=>le.name===N);if(t.required===!0)d.required.add(T.name);let v=[T.input,d.values[T.value],T.value,x].find(c),we=(T.field||{}).message||b.inner;if(h){let le=await u(d.values[N],d,T,m);if(le&&typeof le==="string"||le===!1){d.invalid.set(N,le);continue}d.invalid.delete(N);let Po=await a(d.values[N],d,T,m);d.output+=Ar(Po);continue}T.placeholder=!1;let Oo=x;if(x=await p(x,d,T,m),v!==x)d.values[N]=v,x=e.styles.typing(v),d.missing.delete(we);else if(d.values[N]=void 0,v=`<${we}>`,x=e.styles.primary(v),T.placeholder=!0,d.required.has(N))d.missing.add(we);if(d.missing.has(we)&&d.validating)x=e.styles.warning(v);if(d.invalid.has(N)&&d.validating)x=e.styles.danger(v);if(m===d.index)if(Oo!==x)x=e.styles.underline(x);else x=e.styles.heading(Ar(x));m++}if(x)d.output+=x}let y=d.output.split(`
25
- `).map((b)=>" "+b),S=o.length,f=0;for(let b of o){if(d.invalid.has(b.name))b.lines.forEach((x)=>{if(y[x][0]!==" ")return;y[x]=d.styles.danger(d.symbols.bullet)+y[x].slice(1)});if(e.isValue(d.values[b.name]))f++}return d.completed=(f/S*100).toFixed(0),d.output=y.join(`
26
- `),d.output}};function wt(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 Mr=A((_m,Nr)=>{var Ga=V(),Ua=xr(),qa=ce();class Sr extends qa{constructor(e){super(e);this.cursorHide(),this.reset(!0)}async initialize(){this.interpolate=await Ua(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(),c=await this.error()||"",d=await this.hint()||"",h=s?"":await this.interpolate(this.state),m=this.state.key=t[e]||"",u=await this.format(m),y=await this.footer();if(u)p+=" "+u;if(d&&!u&&this.state.completed===0)p+=" "+d;this.clear(r);let S=[l,p,h,y,c.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=Ga(s).split(`
29
- `).map((n)=>n.slice(1)).join(`
30
- `);return this.value={values:r,result:o},super.submit()}}Nr.exports=Sr});var vr=A((vm,_r)=>{var Ka=Q();class Tr extends Ka{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()}}_r.exports=Tr});var Dr=A((Rm,Cr)=>{var Ha=ge();class Rr extends Ha{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=Wa(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=(b)=>(b?this.styles.success("\u25C9"):"\u25EF")+o,l=t+1+".",c=s?this.styles.heading:this.styles.noop,d=await this.resolve(e.message,this.state,e,t),h=this.indent(e),m=h+e.scale.map((b,x)=>p(x===e.scaleIdx)).join(n),u=(b)=>b===e.scaleIdx?c(b):b,y=h+e.scale.map((b,x)=>u(x)).join(a),S=()=>[l,d].filter(Boolean).join(" "),f=()=>[S(),m,y," "].filter(Boolean).join(`
32
- `);if(s)m=this.styles.cyan(m),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(),c=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,c].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 Wa(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}Cr.exports=Rr});var Pr=A((Cm,Or)=>{var Ya=Ce();class Br extends Ya{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()}}Or.exports=Br});var $r=A((Dm,Lr)=>{var Va=Q();class Ir extends Va{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)}}}Lr.exports=Ir});var Ur=A((xt)=>{var Gr=R(),M=(e,t)=>{Gr.defineExport(xt,e,t),Gr.defineExport(xt,e.toLowerCase(),t)};M("AutoComplete",()=>Ds());M("BasicAuth",()=>Us());M("Confirm",()=>Ys());M("Editable",()=>Qs());M("Form",()=>Re());M("Input",()=>At());M("Invisible",()=>rr());M("List",()=>nr());M("MultiSelect",()=>lr());M("Numeral",()=>bt());M("Password",()=>hr());M("Scale",()=>Er());M("Select",()=>Q());M("Snippet",()=>Mr());M("Sort",()=>vr());M("Survey",()=>Dr());M("Text",()=>At());M("Toggle",()=>Pr());M("Quiz",()=>$r())});var Kr=A((Om,qr)=>{qr.exports={ArrayPrompt:ge(),AuthPrompt:Et(),BooleanPrompt:Ce(),NumberPrompt:bt(),StringPrompt:pe()}});var Z=A((Pm,Wr)=>{var Hr=he("assert"),Nt=he("events"),z=R();class $ extends Nt{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}Hr.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";Hr(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||ce()}static get prompts(){return Ur()}static get types(){return Kr()}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 Nt),e}}z.mixinEmitter($,new Nt);var St=$.prompts;for(let e of Object.keys(St)){let t=e.toLowerCase(),s=(r)=>new St[e](r).run();if($.prompt[t]=s,$[t]=s,!$[e])Reflect.defineProperty($,e,{get:()=>St[e]})}var Ee=(e)=>{z.defineExport($,e,()=>$.types[e])};Ee("ArrayPrompt");Ee("AuthPrompt");Ee("BooleanPrompt");Ee("NumberPrompt");Ee("StringPrompt");Wr.exports=$});var eo=A((Ct,Dt)=>{(function(e,t){if(typeof Ct==="object"&&typeof Dt==="object")Dt.exports=t();else if(typeof define==="function"&&define.amd)define(function(){return t()});else e.pluralize=t()})(Ct,function(){var e=[],t=[],s={},r={},i={};function o(m){if(typeof m==="string")return new RegExp("^"+m+"$","i");return m}function n(m,u){if(m===u)return u;if(m===m.toLowerCase())return u.toLowerCase();if(m===m.toUpperCase())return u.toUpperCase();if(m[0]===m[0].toUpperCase())return u.charAt(0).toUpperCase()+u.substr(1).toLowerCase();return u.toLowerCase()}function a(m,u){return m.replace(/\$(\d{1,2})/g,function(y,S){return u[S]||""})}function p(m,u){return m.replace(u[0],function(y,S){var f=a(u[1],arguments);if(y==="")return n(m[S-1],f);return n(y,f)})}function l(m,u,y){if(!m.length||s.hasOwnProperty(m))return u;var S=y.length;while(S--){var f=y[S];if(f[0].test(u))return p(u,f)}return u}function c(m,u,y){return function(S){var f=S.toLowerCase();if(u.hasOwnProperty(f))return n(S,f);if(m.hasOwnProperty(f))return n(S,m[f]);return l(f,S,y)}}function d(m,u,y,S){return function(f){var b=f.toLowerCase();if(u.hasOwnProperty(b))return!0;if(m.hasOwnProperty(b))return!1;return l(b,b,y)===b}}function h(m,u,y){var S=u===1?h.singular(m):h.plural(m);return(y?u+" ":"")+S}return h.plural=c(i,r,e),h.isPlural=d(i,r,e),h.singular=c(r,i,t),h.isSingular=d(r,i,t),h.addPluralRule=function(m,u){e.push([o(m),u])},h.addSingularRule=function(m,u){t.push([o(m),u])},h.addUncountableRule=function(m){if(typeof m==="string"){s[m.toLowerCase()]=!0;return}h.addPluralRule(m,"$0"),h.addSingularRule(m,"$0")},h.addIrregularRule=function(m,u){u=u.toLowerCase(),m=m.toLowerCase(),i[m]=u,r[u]=m},[["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(m){return h.addIrregularRule(m[0],m[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(m){return h.addPluralRule(m[0],m[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(m){return h.addSingularRule(m[0],m[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 Nc}from"util";import{TerminalLogger as Mc}from"@ooneex/logger";import{container as Ho}from"@ooneex/container";var xe=[];var Pt=(e)=>{let t=null;return xe.find((s)=>{return t=Ho.get(s),t.getName()===e}),t};import{homedir as Qo}from"os";import{join as et}from"path";import{TerminalLogger as zo}from"@ooneex/logger";import{container as Wo,EContainerScope as Yo}from"@ooneex/container";var E={command:(e=Yo.Singleton)=>{return(t)=>{Wo.add(t,e),xe.push(t)}}};var It=`#compdef oo ooneex
19
+ `)}renderScaleHeading(e){let t=this.scale.map((n)=>n.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)),a=t.map((n)=>this.styles.strong(n)).join(" ".repeat(r)),i=" ".repeat(this.widths[0]);return this.margin[3]+i+this.margin[1]+a}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((o)=>this.scaleIndicator(e,o,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),o=await e.hint;if(o&&!br.hasColor(o))o=this.styles.muted(o);let a=(m)=>this.margin[3]+m.replace(/\s+$/,"").padEnd(this.widths[0]," "),i=this.newline,n=this.indent(e),l=await this.resolve(e.message,this.state,e,t),d=await this.renderScale(e,t),u=this.margin[1]+this.margin[3];this.scaleLength=ol(d).length,this.widths[0]=Math.min(this.widths[0],this.width-this.scaleLength-u.length);let p=br.wordWrap(l,{width:this.widths[0],newline:i}).split(`
20
+ `).map((m)=>a(m)+this.margin[1]);if(s)d=this.styles.info(d),p=p.map((m)=>this.styles.info(m));if(p[0]+=d,this.linebreak)p.push("");return[n+r,p.join(`
21
+ `)].filter(Boolean)}async renderChoices(){if(this.state.submitted)return"";this.tableize();let e=this.visible.map(async(r,o)=>await this.renderChoice(r,o)),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(),o=await this.message(),a="";if(this.options.promptLine!==!1)a=[s,o,r,""].join(" "),this.state.prompt=a;let i=await this.header(),n=await this.format(),l=await this.renderScaleKey(),d=await this.error()||await this.hint(),u=await this.renderChoices(),c=await this.footer(),p=this.emptyError;if(n)a+=n;if(d&&!a.includes(d))a+=" "+d;if(e&&!n&&!u.trim()&&this.multiple&&p!=null)a+=this.styles.danger(p);if(this.clear(t),this.write([i,a,l,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)}}wr.exports=xr});var Tr=x((fp,vr)=>{var Ar=se(),il=(e="")=>{return typeof e==="string"?e.replace(/^['"]|['"]$/g,""):""};class Nr{constructor(e){this.name=e.key,this.field=e.field||{},this.value=il(e.initial||this.field.initial||""),this.message=e.message||this.name,this.cursor=0,this.input="",this.lines=[]}}var nl=async(e={},t={},s=(r)=>r)=>{let r=new Set,o=e.fields||[],a=e.template,i=[],n=[],l=[],d=1;if(typeof a==="function")a=await a();let u=-1,c=()=>a[++u],p=()=>a[u+1],m=(h)=>{h.line=d,i.push(h)};m({type:"bos",value:""});while(u<a.length-1){let h=c();if(/^[^\S\n ]$/.test(h)){m({type:"text",value:h});continue}if(h===`
24
+ `){m({type:"newline",value:h}),d++;continue}if(h==="\\"){h+=c(),m({type:"text",value:h});continue}if((h==="$"||h==="#"||h==="{")&&p()==="{"){let w=c();h+=w;let g={type:"template",open:h,inner:"",close:"",value:h},E;while(E=c()){if(E==="}"){if(p()==="}")E+=c();g.value+=E,g.close=E;break}if(E===":")g.initial="",g.key=g.inner;else if(g.initial!==void 0)g.initial+=E;g.value+=E,g.inner+=E}if(g.template=g.open+(g.initial||g.inner)+g.close,g.key=g.key||g.inner,hasOwnProperty.call(t,g.key))g.initial=t[g.key];g=s(g),m(g),l.push(g.key),r.add(g.key);let A=n.find((v)=>v.name===g.key);if(g.field=o.find((v)=>v.name===g.key),!A)A=new Nr(g),n.push(A);A.lines.push(g.line-1);continue}let f=i[i.length-1];if(f.type==="text"&&f.line===d)f.value+=h;else m({type:"text",value:h})}return m({type:"eos",value:""}),{input:a,tabstops:i,unique:r,keys:l,items:n}};vr.exports=async(e)=>{let t=e.options,s=new Set(t.required===!0?[]:t.required||[]),r={...t.values,...t.initial},{tabstops:o,items:a,keys:i}=await nl(t,r),n=At("result",e,t),l=At("format",e,t),d=At("validate",e,t,!0),u=e.isValue.bind(e);return async(c={},p=!1)=>{let m=0;c.required=s,c.items=a,c.keys=i,c.output="";let h=async(E,A,v,S)=>{let _=await d(E,A,v,S);if(_===!1)return"Invalid field "+v.name;return _};for(let E of o){let{value:A,key:v}=E;if(E.type!=="template"){if(A)c.output+=A;continue}if(E.type==="template"){let S=a.find((me)=>me.name===v);if(t.required===!0)c.required.add(S.name);let _=[S.input,c.values[S.value],S.value,A].find(u),ee=(S.field||{}).message||E.inner;if(p){let me=await h(c.values[v],c,S,m);if(me&&typeof me==="string"||me===!1){c.invalid.set(v,me);continue}c.invalid.delete(v);let oi=await n(c.values[v],c,S,m);c.output+=Ar(oi);continue}S.placeholder=!1;let ri=A;if(A=await l(A,c,S,m),_!==A)c.values[v]=_,A=e.styles.typing(_),c.missing.delete(ee);else if(c.values[v]=void 0,_=`<${ee}>`,A=e.styles.primary(_),S.placeholder=!0,c.required.has(v))c.missing.add(ee);if(c.missing.has(ee)&&c.validating)A=e.styles.warning(_);if(c.invalid.has(v)&&c.validating)A=e.styles.danger(_);if(m===c.index)if(ri!==A)A=e.styles.underline(A);else A=e.styles.heading(Ar(A));m++}if(A)c.output+=A}let f=c.output.split(`
25
+ `).map((E)=>" "+E),w=a.length,g=0;for(let E of a){if(c.invalid.has(E.name))E.lines.forEach((A)=>{if(f[A][0]!==" ")return;f[A]=c.styles.danger(c.symbols.bullet)+f[A].slice(1)});if(e.isValue(c.values[E.name]))g++}return c.completed=(g/w*100).toFixed(0),c.output=f.join(`
26
+ `),c.output}};function At(e,t,s,r){return(o,a,i,n)=>{if(typeof i.field[e]==="function")return i.field[e].call(t,o,a,i,n);return[r,o].find((l)=>t.isValue(l))}}});var Rr=x((gp,Mr)=>{var ll=se(),dl=Tr(),ml=ce();class Sr extends ml{constructor(e){super(e);this.cursorHide(),this.reset(!0)}async initialize(){this.interpolate=await dl(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),o=s.input.slice(this.cursor);this.input=s.input=`${r}${e}${o}`,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,o=[this.options.newline,`
27
+ `].find((g)=>g!=null),a=await this.prefix(),i=await this.separator(),n=await this.message(),l=[a,n,i].filter(Boolean).join(" ");this.state.prompt=l;let d=await this.header(),u=await this.error()||"",c=await this.hint()||"",p=s?"":await this.interpolate(this.state),m=this.state.key=t[e]||"",h=await this.format(m),f=await this.footer();if(h)l+=" "+h;if(c&&!h&&this.state.completed===0)l+=" "+c;this.clear(r);let w=[d,l,p,f,u.trim()];this.write(w.filter(Boolean).join(o)),this.restore()}getItem(e){let{items:t,keys:s,index:r}=this.state,o=t.find((a)=>a.name===s[r]);if(o&&o.input!=null)this.input=o.input,this.cursor=o.cursor;return o}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 i="";for(let[n,l]of e)i+=`Invalid ${n}: ${l}
28
+ `;return this.state.error=i,super.submit()}if(t.size)return this.state.error="Required: "+[...t.keys()].join(", "),super.submit();let a=ll(s).split(`
29
+ `).map((i)=>i.slice(1)).join(`
30
+ `);return this.value={values:r,result:a},super.submit()}}Mr.exports=Sr});var Dr=x((yp,_r)=>{var cl=oe();class Cr extends cl{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+" ",o=this.index===t&&this.sorting?this.styles.muted(r):" ";if(this.options.drag===!1)o="";if(this.options.numbered===!0)return o+`${t+1} - `+s;return o+s}get selected(){return this.choices}submit(){return this.value=this.choices.map((e)=>e.value),super.submit()}}_r.exports=Cr});var Br=x((bp,Or)=>{var pl=ye();class Pr extends pl{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=ul(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",o=!r?8:9,a=!r?" ":"",i=this.symbols.line.repeat(o),n=" ".repeat(o+(r?0:1)),l=(E)=>(E?this.styles.success("\u25C9"):"\u25EF")+a,d=t+1+".",u=s?this.styles.heading:this.styles.noop,c=await this.resolve(e.message,this.state,e,t),p=this.indent(e),m=p+e.scale.map((E,A)=>l(A===e.scaleIdx)).join(i),h=(E)=>E===e.scaleIdx?u(E):E,f=p+e.scale.map((E,A)=>h(A)).join(n),w=()=>[d,c].filter(Boolean).join(" "),g=()=>[w(),m,f," "].filter(Boolean).join(`
32
+ `);if(s)m=this.styles.cyan(m),f=this.styles.cyan(f);return g()}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(),o=await this.message(),a=[s,o,r].filter(Boolean).join(" ");this.state.prompt=a;let i=await this.header(),n=await this.format(),l=await this.error()||await this.hint(),d=await this.renderChoices(),u=await this.footer();if(n||!l)a+=" "+n;if(l&&!a.includes(l))a+=" "+l;if(e&&!n&&!d&&this.multiple&&this.type!=="form")a+=this.styles.danger(this.emptyError);this.clear(t),this.write([a,i,d,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 ul(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}Or.exports=Pr});var Ur=x((xp,Lr)=>{var hl=_e();class Ir extends hl{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(),o=await this.message(),a=await this.format(),i=await this.error()||await this.hint(),n=await this.footer(),l=[s,o,r,a].join(" ");if(this.state.prompt=l,i&&!l.includes(i))l+=" "+i;this.clear(e),this.write([t,l,n].filter(Boolean).join(`
35
+ `)),this.write(this.margin[2]),this.restore()}}Lr.exports=Ir});var Wr=x((wp,$r)=>{var fl=oe();class Gr extends fl{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)}}}$r.exports=Gr});var kr=x((Nt)=>{var qr=C(),T=(e,t)=>{qr.defineExport(Nt,e,t),qr.defineExport(Nt,e.toLowerCase(),t)};T("AutoComplete",()=>Bs());T("BasicAuth",()=>ks());T("Confirm",()=>Fs());T("Editable",()=>Zs());T("Form",()=>Ce());T("Input",()=>wt());T("Invisible",()=>ir());T("List",()=>dr());T("MultiSelect",()=>pr());T("Numeral",()=>Et());T("Password",()=>yr());T("Scale",()=>Er());T("Select",()=>oe());T("Snippet",()=>Rr());T("Sort",()=>Dr());T("Survey",()=>Br());T("Text",()=>wt());T("Toggle",()=>Ur());T("Quiz",()=>Wr())});var Hr=x((Ap,Kr)=>{Kr.exports={ArrayPrompt:ye(),AuthPrompt:xt(),BooleanPrompt:_e(),NumberPrompt:Et(),StringPrompt:de()}});var ie=x((Np,Yr)=>{var Vr=he("assert"),Tt=he("events"),ae=C();class U extends Tt{constructor(e,t){super();this.options=ae.merge({},e),this.answers={...t}}register(e,t){if(ae.isObject(e)){for(let r of Object.keys(e))this.register(r,e[r]);return this}Vr.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(ae.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=ae.merge({},this.options,e),{type:s,name:r}=e,{set:o,get:a}=ae;if(typeof s==="function")s=await s.call(this,e,this.answers);if(!s)return this.answers[r];if(s==="number")s="numeral";Vr(this.prompts[s],`Prompt "${s}" is not registered`);let i=new this.prompts[s](t),n=a(this.answers,r);if(i.state.answers=this.answers,i.enquirer=this,r)i.on("submit",(d)=>{this.emit("answer",r,d,i),o(this.answers,r,d)});let l=i.emit.bind(i);if(i.emit=(...d)=>{return this.emit.call(this,...d),l(...d)},this.emit("prompt",i,this),t.autofill&&n!=null){if(i.value=i.input=n,t.autofill==="show")await i.submit()}else n=i.value=await i.run();return n}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||ce()}static get prompts(){return kr()}static get types(){return Hr()}static get prompt(){let e=(t,...s)=>{let r=new this(...s),o=r.emit.bind(r);return r.emit=(...a)=>{return e.emit(...a),o(...a)},r.prompt(t)};return ae.mixinEmitter(e,new Tt),e}}ae.mixinEmitter(U,new Tt);var vt=U.prompts;for(let e of Object.keys(vt)){let t=e.toLowerCase(),s=(r)=>new vt[e](r).run();if(U.prompt[t]=s,U[t]=s,!U[e])Reflect.defineProperty(U,e,{get:()=>vt[e]})}var be=(e)=>{ae.defineExport(U,e,()=>U.types[e])};be("ArrayPrompt");be("AuthPrompt");be("BooleanPrompt");be("NumberPrompt");be("StringPrompt");Yr.exports=U});var Ta=x((Dt,Pt)=>{(function(e,t){if(typeof Dt==="object"&&typeof Pt==="object")Pt.exports=t();else if(typeof define==="function"&&define.amd)define(function(){return t()});else e.pluralize=t()})(Dt,function(){var e=[],t=[],s={},r={},o={};function a(m){if(typeof m==="string")return new RegExp("^"+m+"$","i");return m}function i(m,h){if(m===h)return h;if(m===m.toLowerCase())return h.toLowerCase();if(m===m.toUpperCase())return h.toUpperCase();if(m[0]===m[0].toUpperCase())return h.charAt(0).toUpperCase()+h.substr(1).toLowerCase();return h.toLowerCase()}function n(m,h){return m.replace(/\$(\d{1,2})/g,function(f,w){return h[w]||""})}function l(m,h){return m.replace(h[0],function(f,w){var g=n(h[1],arguments);if(f==="")return i(m[w-1],g);return i(f,g)})}function d(m,h,f){if(!m.length||s.hasOwnProperty(m))return h;var w=f.length;while(w--){var g=f[w];if(g[0].test(h))return l(h,g)}return h}function u(m,h,f){return function(w){var g=w.toLowerCase();if(h.hasOwnProperty(g))return i(w,g);if(m.hasOwnProperty(g))return i(w,m[g]);return d(g,w,f)}}function c(m,h,f,w){return function(g){var E=g.toLowerCase();if(h.hasOwnProperty(E))return!0;if(m.hasOwnProperty(E))return!1;return d(E,E,f)===E}}function p(m,h,f){var w=h===1?p.singular(m):p.plural(m);return(f?h+" ":"")+w}return p.plural=u(o,r,e),p.isPlural=c(o,r,e),p.singular=u(r,o,t),p.isSingular=c(r,o,t),p.addPluralRule=function(m,h){e.push([a(m),h])},p.addSingularRule=function(m,h){t.push([a(m),h])},p.addUncountableRule=function(m){if(typeof m==="string"){s[m.toLowerCase()]=!0;return}p.addPluralRule(m,"$0"),p.addSingularRule(m,"$0")},p.addIrregularRule=function(m,h){h=h.toLowerCase(),m=m.toLowerCase(),o[m]=h,r[h]=m},[["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(m){return p.addIrregularRule(m[0],m[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(m){return p.addPluralRule(m[0],m[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(m){return p.addSingularRule(m[0],m[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(p.addUncountableRule),p})});import{parseArgs as uc}from"util";import{Exception as ei}from"@ooneex/exception";import{TerminalLogger as hc}from"@ooneex/logger";import{container as pi}from"@ooneex/container";var Ae=[];var Ut=(e)=>{let t=null;return Ae.find((s)=>{return t=pi.get(s),t.getName()===e}),t};import{homedir as yi}from"os";import{join as tt}from"path";import{TerminalLogger as bi}from"@ooneex/logger";import{container as ui,EContainerScope as hi}from"@ooneex/container";var b={command:(e=hi.Singleton)=>{return(t)=>{ui.add(t,e),Ae.push(t)}}};var Gt=`#compdef oo ooneex
36
+
37
+ _oo_modules() {
38
+ local -a modules
39
+ if [[ -d modules ]]; then
40
+ modules=(\${(@f)"$(command ls -1 modules 2>/dev/null)"})
41
+ compadd -a modules
42
+ fi
43
+ }
36
44
 
37
45
  _oo() {
38
46
  local -a commands
@@ -76,6 +84,7 @@ _oo() {
76
84
  make:controller)
77
85
  _arguments -s \\
78
86
  '--name=[Name of the resource]:name' \\
87
+ '--module=[Module name]:module:_oo_modules' \\
79
88
  '--route-name=[Route name]:route_name' \\
80
89
  '--route-path=[Route path]:route_path' \\
81
90
  '--route-method=[Route HTTP method]:method:(GET POST PUT PATCH DELETE HEAD OPTIONS)' \\
@@ -84,25 +93,30 @@ _oo() {
84
93
  make:middleware)
85
94
  _arguments -s \\
86
95
  '--name=[Name of the resource]:name' \\
96
+ '--module=[Module name]:module:_oo_modules' \\
87
97
  '--is-socket[Socket mode]'
88
98
  ;;
89
99
  make:entity)
90
100
  _arguments -s \\
91
101
  '--name=[Name of the resource]:name' \\
102
+ '--module=[Module name]:module:_oo_modules' \\
92
103
  '--table-name=[Database table name]:table_name'
93
104
  ;;
94
105
  make:pubsub)
95
106
  _arguments -s \\
96
107
  '--name=[Name of the resource]:name' \\
108
+ '--module=[Module name]:module:_oo_modules' \\
97
109
  '--channel=[Channel name]:channel'
98
110
  ;;
99
111
  make:migration)
100
112
  _arguments -s \\
113
+ '--module=[Module name]:module:_oo_modules' \\
101
114
  '--dir=[Directory]:dir:_files -/'
102
115
  ;;
103
116
  make:seed)
104
117
  _arguments -s \\
105
118
  '--name=[Name of the resource]:name' \\
119
+ '--module=[Module name]:module:_oo_modules' \\
106
120
  '--dir=[Directory]:dir:_files -/'
107
121
  ;;
108
122
  make:module)
@@ -111,11 +125,18 @@ _oo() {
111
125
  ;;
112
126
  make:docker)
113
127
  _arguments -s \\
114
- '--name=[Docker service name]:name:(clickhouse elasticsearch grafana jaeger keycloak libretranslate maildev memcached minio mongodb mysql nats ooneex-jade postgres prometheus rabbitmq redis temporal vault)'
128
+ '--name=[Docker service name]:name:(clickhouse elasticsearch grafana jaeger keycloak libretranslate maildev memcached minio mongodb mysql nats ooneex-jade postgres prometheus rabbitmq redis temporal vault)' \\
129
+ '--module=[Module name]:module:_oo_modules'
115
130
  ;;
116
- make:ai|make:analytics|make:app|make:cache|make:cron|make:database|make:logger|make:mailer|make:permission|make:repository|make:service|make:storage|make:vector-database)
131
+ make:app)
117
132
  _arguments -s \\
118
- '--name=[Name of the resource]:name'
133
+ '--name=[Name of the resource]:name' \\
134
+ '--destination=[Destination path]:destination:_files -/'
135
+ ;;
136
+ make:ai|make:analytics|make:cache|make:cron|make:database|make:logger|make:mailer|make:permission|make:repository|make:service|make:storage|make:vector-database)
137
+ _arguments -s \\
138
+ '--name=[Name of the resource]:name' \\
139
+ '--module=[Module name]:module:_oo_modules'
119
140
  ;;
120
141
  make:claude:skill|completion:zsh)
121
142
  ;;
@@ -125,7 +146,15 @@ _oo() {
125
146
  }
126
147
 
127
148
  _oo "$@"
128
- `;var Lt=`#compdef oo ooneex
149
+ `;var $t=`#compdef oo ooneex
150
+
151
+ _ooneex_modules() {
152
+ local -a modules
153
+ if [[ -d modules ]]; then
154
+ modules=(\${(@f)"$(command ls -1 modules 2>/dev/null)"})
155
+ compadd -a modules
156
+ fi
157
+ }
129
158
 
130
159
  _ooneex() {
131
160
  local -a commands
@@ -169,6 +198,7 @@ _ooneex() {
169
198
  make:controller)
170
199
  _arguments -s \\
171
200
  '--name=[Name of the resource]:name' \\
201
+ '--module=[Module name]:module:_ooneex_modules' \\
172
202
  '--route-name=[Route name]:route_name' \\
173
203
  '--route-path=[Route path]:route_path' \\
174
204
  '--route-method=[Route HTTP method]:method:(GET POST PUT PATCH DELETE HEAD OPTIONS)' \\
@@ -177,25 +207,30 @@ _ooneex() {
177
207
  make:middleware)
178
208
  _arguments -s \\
179
209
  '--name=[Name of the resource]:name' \\
210
+ '--module=[Module name]:module:_ooneex_modules' \\
180
211
  '--is-socket[Socket mode]'
181
212
  ;;
182
213
  make:entity)
183
214
  _arguments -s \\
184
215
  '--name=[Name of the resource]:name' \\
216
+ '--module=[Module name]:module:_ooneex_modules' \\
185
217
  '--table-name=[Database table name]:table_name'
186
218
  ;;
187
219
  make:pubsub)
188
220
  _arguments -s \\
189
221
  '--name=[Name of the resource]:name' \\
222
+ '--module=[Module name]:module:_ooneex_modules' \\
190
223
  '--channel=[Channel name]:channel'
191
224
  ;;
192
225
  make:migration)
193
226
  _arguments -s \\
227
+ '--module=[Module name]:module:_ooneex_modules' \\
194
228
  '--dir=[Directory]:dir:_files -/'
195
229
  ;;
196
230
  make:seed)
197
231
  _arguments -s \\
198
232
  '--name=[Name of the resource]:name' \\
233
+ '--module=[Module name]:module:_ooneex_modules' \\
199
234
  '--dir=[Directory]:dir:_files -/'
200
235
  ;;
201
236
  make:module)
@@ -204,11 +239,18 @@ _ooneex() {
204
239
  ;;
205
240
  make:docker)
206
241
  _arguments -s \\
207
- '--name=[Docker service name]:name:(clickhouse elasticsearch grafana jaeger keycloak libretranslate maildev memcached minio mongodb mysql nats ooneex-jade postgres prometheus rabbitmq redis temporal vault)'
242
+ '--name=[Docker service name]:name:(clickhouse elasticsearch grafana jaeger keycloak libretranslate maildev memcached minio mongodb mysql nats ooneex-jade postgres prometheus rabbitmq redis temporal vault)' \\
243
+ '--module=[Module name]:module:_ooneex_modules'
208
244
  ;;
209
- make:ai|make:analytics|make:app|make:cache|make:cron|make:database|make:logger|make:mailer|make:permission|make:repository|make:service|make:storage|make:vector-database)
245
+ make:app)
210
246
  _arguments -s \\
211
- '--name=[Name of the resource]:name'
247
+ '--name=[Name of the resource]:name' \\
248
+ '--destination=[Destination path]:destination:_files -/'
249
+ ;;
250
+ make:ai|make:analytics|make:cache|make:cron|make:database|make:logger|make:mailer|make:permission|make:repository|make:service|make:storage|make:vector-database)
251
+ _arguments -s \\
252
+ '--name=[Name of the resource]:name' \\
253
+ '--module=[Module name]:module:_ooneex_modules'
212
254
  ;;
213
255
  make:claude:skill|completion:zsh)
214
256
  ;;
@@ -218,9 +260,9 @@ _ooneex() {
218
260
  }
219
261
 
220
262
  _ooneex "$@"
221
- `;class Se{getName(){return"completion:zsh"}getDescription(){return"Install Zsh completion for oo command"}async run(){let e=et(Qo(),".zsh"),t=et(e,"_oo");await Bun.write(t,It);let s=et(e,"_ooneex");await Bun.write(s,Lt);let r=new zo;r.success(`${t} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),r.success(`${s} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),r.info(`Add the following to your .zshrc if not already present:
263
+ `;class Ne{getName(){return"completion:zsh"}getDescription(){return"Install Zsh completion for oo command"}async run(){let e=tt(yi(),".zsh"),t=tt(e,"_oo");await Bun.write(t,Gt);let s=tt(e,"_ooneex");await Bun.write(s,$t);let r=new bi;r.success(`${t} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),r.success(`${s} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),r.info(`Add the following to your .zshrc if not already present:
222
264
  fpath=(~/.zsh $fpath)
223
- autoload -Uz compinit && compinit`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Se=g([E.command()],Se);import{join as X}from"path";import{TerminalLogger as ja}from"@ooneex/logger";import{toPascalCase as ka}from"@ooneex/utils";var Yr=Y(Z(),1);import{Assert as Fa,Validation as Qa}from"@ooneex/validation";var za=1,Za=/^[a-zA-Z][a-zA-Z0-9-]*$/;class Ae extends Qa{getConstraint(){return Fa(`string >= ${za}`)}getErrorMessage(){return"Name must start with a letter and contain only letters, numbers, and hyphens"}validate(e,t){let s=super.validate(e,t);if(!s.isValid)return s;let r=e;if(!Za.test(r))return{isValid:!1,message:this.getErrorMessage()||"Invalid name format"};return{isValid:!0}}}var w=async(e)=>{return(await Yr.prompt({type:"input",name:"name",message:e.message,validate:(s)=>{let i=new Ae().validate(s);if(!i.isValid)return i.message||"Controller name is invalid";return!0}})).name};var Vr=`import { describe, expect, test } from "bun:test";
265
+ autoload -Uz compinit && compinit`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ne=y([b.command()],Ne);import{join as H}from"path";import{TerminalLogger as Al}from"@ooneex/logger";import{toPascalCase as Nl}from"@ooneex/utils";var Fr=te(ie(),1);import{Assert as gl,Validation as yl}from"@ooneex/validation";var bl=1,xl=/^[a-zA-Z][a-zA-Z0-9-]*$/;class xe extends yl{getConstraint(){return gl(`string >= ${bl}`)}getErrorMessage(){return"Name must start with a letter and contain only letters, numbers, and hyphens"}validate(e,t){let s=super.validate(e,t);if(!s.isValid)return s;let r=e;if(!xl.test(r))return{isValid:!1,message:this.getErrorMessage()||"Invalid name format"};return{isValid:!0}}}var N=async(e)=>{return(await Fr.prompt({type:"input",name:"name",message:e.message,validate:(s)=>{let o=new xe().validate(s);if(!o.isValid)return o.message||"Controller name is invalid";return!0}})).name};var jr=`import { describe, expect, test } from "bun:test";
224
266
  import { {{NAME}}Ai } from "@/ai/{{NAME}}Ai";
225
267
 
226
268
  describe("{{NAME}}Ai", () => {
@@ -238,7 +280,7 @@ describe("{{NAME}}Ai", () => {
238
280
  expect(typeof {{NAME}}Ai.prototype.runStream).toBe("function");
239
281
  });
240
282
  });
241
- `;var Fr=`import { decorator, type IAiChat, OpenAi, type OpenAiConfigType } from "@ooneex/ai";
283
+ `;var zr=`import { decorator, type IAiChat, OpenAi, type OpenAiConfigType } from "@ooneex/ai";
242
284
  import { inject } from "@ooneex/container";
243
285
 
244
286
  @decorator.ai()
@@ -256,7 +298,7 @@ export class {{NAME}}Ai implements IAiChat<OpenAiConfigType> {
256
298
  yield* this.ai.runStream(prompt || "My prompt", config);
257
299
  }
258
300
  }
259
- `;class Be{getName(){return"make:ai"}getDescription(){return"Generate a new AI class"}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter name"});t=ka(t).replace(/Ai$/,"");let s=Fr.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=Vr.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 c=new ja;c.success(`${X(r,t)}Ai.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),c.success(`${X(a,t)}Ai.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Be=g([E.command()],Be);import{join as J}from"path";import{TerminalLogger as sp}from"@ooneex/logger";import{toPascalCase as rp}from"@ooneex/utils";var Qr=`import { describe, expect, test } from "bun:test";
301
+ `;class Pe{getName(){return"make:ai"}getDescription(){return"Generate a new AI class"}async run(e){let{name:t,module:s}=e;if(!t)t=await N({message:"Enter name"});t=Nl(t).replace(/Ai$/,"");let r=zr.replace(/{{NAME}}/g,t),o=s?H("modules",s):".",a=H(o,"src","ai"),i=H(process.cwd(),a),n=H(i,`${t}Ai.ts`);await Bun.write(n,r);let l=jr.replace(/{{NAME}}/g,t),d=H(o,"tests","ai"),u=H(process.cwd(),d),c=H(u,`${t}Ai.spec.ts`);await Bun.write(c,l);let p=new Al;p.success(`${H(a,t)}Ai.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${H(d,t)}Ai.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Pe=y([b.command()],Pe);import{join as V}from"path";import{TerminalLogger as Sl}from"@ooneex/logger";import{toPascalCase as Ml}from"@ooneex/utils";var Zr=`import { describe, expect, test } from "bun:test";
260
302
  import { {{NAME}}Analytics } from "@/analytics/{{NAME}}Analytics";
261
303
 
262
304
  describe("{{NAME}}Analytics", () => {
@@ -269,7 +311,7 @@ describe("{{NAME}}Analytics", () => {
269
311
  expect(typeof {{NAME}}Analytics.prototype.capture).toBe("function");
270
312
  });
271
313
  });
272
- `;var zr=`import { decorator } from "@ooneex/analytics";
314
+ `;var Qr=`import { decorator } from "@ooneex/analytics";
273
315
  import type { IAnalytics } from "@ooneex/analytics";
274
316
 
275
317
  type CaptureOptionsType = Record<string, unknown>;
@@ -280,7 +322,7 @@ export class {{NAME}}Analytics<T extends CaptureOptionsType = CaptureOptionsType
280
322
  // console.log("Analytics captured:", options);
281
323
  }
282
324
  }
283
- `;class Oe{getName(){return"make:analytics"}getDescription(){return"Generate a new analytics class"}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter analytics name"});t=rp(t).replace(/Analytics$/,"");let s=zr.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=Qr.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 c=new sp;c.success(`${J(r,t)}Analytics.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),c.success(`${J(a,t)}Analytics.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Oe=g([E.command()],Oe);import{join as B}from"path";import{TerminalLogger as xp}from"@ooneex/logger";import{toKebabCase as Sp}from"@ooneex/utils";var Zr=Y(Z(),1);var Xr=async(e)=>{let t=new Ae;return(await Zr.prompt({type:"input",name:"destination",message:e.message,initial:e.initial||".",validate:(r)=>{let i=t.validate(r);if(!i.isValid)return i.message||"Invalid destination";return!0}})).destination};var Jr=`import { RuleConfigSeverity, type UserConfig } from "@commitlint/types";
325
+ `;class Oe{getName(){return"make:analytics"}getDescription(){return"Generate a new analytics class"}async run(e){let{name:t,module:s}=e;if(!t)t=await N({message:"Enter analytics name"});t=Ml(t).replace(/Analytics$/,"");let r=Qr.replace(/{{NAME}}/g,t),o=s?V("modules",s):".",a=V(o,"src","analytics"),i=V(process.cwd(),a),n=V(i,`${t}Analytics.ts`);await Bun.write(n,r);let l=Zr.replace(/{{NAME}}/g,t),d=V(o,"tests","analytics"),u=V(process.cwd(),d),c=V(u,`${t}Analytics.spec.ts`);await Bun.write(c,l);let p=new Sl;p.success(`${V(a,t)}Analytics.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${V(d,t)}Analytics.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Oe=y([b.command()],Oe);import{join as R}from"path";import{TerminalLogger as zl}from"@ooneex/logger";import{toKebabCase as Zl,toSnakeCase as Ql}from"@ooneex/utils";var Xr=te(ie(),1);var Jr=async(e)=>{let t=new xe;return(await Xr.prompt({type:"input",name:"destination",message:e.message,initial:e.initial||".",validate:(r)=>{let o=t.validate(r);if(!o.isValid)return o.message||"Invalid destination";return!0}})).destination};var eo=`import { RuleConfigSeverity, type UserConfig } from "@commitlint/types";
284
326
 
285
327
  const Configuration: UserConfig = {
286
328
  extends: ["@commitlint/config-conventional"],
@@ -421,7 +463,7 @@ const Configuration: UserConfig = {
421
463
  };
422
464
 
423
465
  export default Configuration;
424
- `;var jr=`# Logs
466
+ `;var to=`# Logs
425
467
  logs
426
468
  *.log
427
469
  npm-debug.log*
@@ -571,7 +613,41 @@ vite.config.ts.timestamp-*
571
613
 
572
614
  # Application
573
615
  var/
574
- `;var kr=`{
616
+ `;var so=`import { inject } from "@ooneex/container";
617
+ import { AppEnv } from "@ooneex/app-env";
618
+ import { DataSource } from "typeorm";
619
+ import { TypeormDatabase, DatabaseException, decorator } from "@ooneex/database";
620
+ import { AppModule } from "@/AppModule";
621
+
622
+ @decorator.database()
623
+ export class AppDatabase extends TypeormDatabase {
624
+ constructor(@inject(AppEnv) private readonly env: AppEnv) {
625
+ super();
626
+ }
627
+
628
+ public getSource(): DataSource {
629
+ const url = this.env.DATABASE_URL;
630
+
631
+ if (!url) {
632
+ throw new DatabaseException(
633
+ "Database URL is required. Please set the DATABASE_URL environment variable.",
634
+ );
635
+ }
636
+
637
+ this.source = new DataSource({
638
+ synchronize: false,
639
+ entities: AppModule.entities,
640
+ extra: {
641
+ max: 10,
642
+ },
643
+ url,
644
+ type: "postgres",
645
+ });
646
+
647
+ return this.source;
648
+ }
649
+ }
650
+ `;var ro=`{
575
651
  "$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
576
652
  "vcs": {
577
653
  "enabled": true,
@@ -650,7 +726,7 @@ var/
650
726
  }
651
727
  }
652
728
  }
653
- `;var ei=`[test]
729
+ `;var oo=`[test]
654
730
  coverage = true
655
731
 
656
732
  [workspace]
@@ -670,11 +746,9 @@ hoistPattern = [
670
746
  "@typescript/native-preview",
671
747
  "undici-types",
672
748
  "react",
673
- "react-error-boundary",
674
- "react-*",
675
- "react-*/*",
676
749
  "@types/*",
677
750
  "pg",
751
+ "typeorm",
678
752
  "apache-arrow",
679
753
  "reflect-metadata",
680
754
  ]
@@ -683,16 +757,93 @@ buildDependencies = [
683
757
  "@swc/core",
684
758
  "nx",
685
759
  ]
686
- `;var Mt=`# =============================================================================
760
+ `;var ao=`# use the official Bun image
761
+ # see all versions at https://hub.docker.com/r/oven/bun/tags
762
+ FROM oven/bun:1 AS base
763
+ WORKDIR /{{NAME}}
764
+
765
+ # Declare the build-time argument with an optional default
766
+ ARG DATABASE_URL
767
+
768
+ # Promote build arg to runtime environment variable
769
+ ENV DATABASE_URL=\${DATABASE_URL}
770
+
771
+ # install dependencies into temp directory
772
+ # this will cache them and speed up future builds
773
+ FROM base AS install
774
+ RUN mkdir -p /temp/dev
775
+ COPY package.json bun.lock /temp/dev/
776
+ RUN cd /temp/dev && bun install --frozen-lockfile
777
+
778
+ # install with --production (exclude devDependencies)
779
+ RUN mkdir -p /temp/prod
780
+ COPY package.json bun.lock /temp/prod/
781
+ RUN cd /temp/prod && bun install --frozen-lockfile --production
782
+
783
+ # copy node_modules from temp directory
784
+ # then copy all (non-ignored) project files into the image
785
+ FROM base AS prerelease
786
+ COPY --from=install /temp/dev/node_modules node_modules
787
+ COPY . .
788
+
789
+ # build
790
+ ENV NODE_ENV=production
791
+ RUN bun run build
792
+
793
+ # copy production dependencies and source code into final image
794
+ FROM base AS release
795
+ COPY --from=install /temp/prod/node_modules node_modules
796
+ COPY --from=prerelease /ooneex/dist .
797
+ COPY --from=prerelease /ooneex/package.json .
798
+
799
+ # run the app
800
+ USER bun
801
+ EXPOSE 3000/tcp
802
+ ENTRYPOINT [ "bun", "run", "index.js" ]
803
+ `;var io=`services:
804
+ # PostgreSQL - Primary relational database
805
+ # Docs: https://www.postgresql.org/docs/
806
+ # Connection: postgresql://ooneex:ooneex@localhost:5432/ooneex
807
+ postgres:
808
+ image: postgres:17-alpine
809
+ container_name: {{NAME}}_db
810
+ restart: "on-failure"
811
+ ports:
812
+ - "5432:5432"
813
+ volumes:
814
+ - {{NAME}}_db_data:/var/lib/postgresql/data:rw
815
+ environment:
816
+ - POSTGRES_ROOT_PASSWORD=ooneex
817
+ - POSTGRES_DATABASE=ooneex
818
+ - POSTGRES_USER=ooneex
819
+ - POSTGRES_PASSWORD=ooneex
820
+ - PGDATA=/var/lib/postgresql/data/pgdata
821
+
822
+ # Redis - In-memory data store for caching and sessions
823
+ # Docs: https://redis.io/docs/
824
+ # Connection: redis://localhost:6379
825
+ redis:
826
+ image: redis:8.4-alpine
827
+ container_name: {{NAME}}_redis
828
+ restart: "on-failure"
829
+ ports:
830
+ - "6379:6379"
831
+ volumes:
832
+ - {{NAME}}_redis_data:/data:rw
833
+
834
+ volumes:
835
+ {{NAME}}_db_data:
836
+ {{NAME}}_redis_data:
837
+ `;var St=`# =============================================================================
687
838
  # App
688
839
  # =============================================================================
689
840
 
690
- # Application environment (local, development, staging, production)
841
+ # Application environment (local, development, staging, testing, test, qa, uat, integration, preview, demo, sandbox, beta, canary, hotfix, production)
691
842
  APP_ENV="local"
692
843
  # Server port number (default: 3000)
693
844
  PORT=3000
694
845
  # Server hostname (default: 0.0.0.0)
695
- HOST_NAME=""
846
+ HOST_NAME=
696
847
 
697
848
  # =============================================================================
698
849
  # Logs
@@ -723,21 +874,21 @@ ANALYTICS_POSTHOG_HOST="https://eu.i.posthog.com"
723
874
  # =============================================================================
724
875
 
725
876
  # Redis connection URL for caching
726
- CACHE_REDIS_URL="redis://localhost:6379"
877
+ CACHE_REDIS_URL=
727
878
 
728
879
  # =============================================================================
729
880
  # Pub/Sub
730
881
  # =============================================================================
731
882
 
732
883
  # Redis connection URL for pub/sub messaging
733
- PUBSUB_REDIS_URL="redis://localhost:6379"
884
+ PUBSUB_REDIS_URL=
734
885
 
735
886
  # =============================================================================
736
887
  # Rate limit
737
888
  # =============================================================================
738
889
 
739
890
  # Redis connection URL for rate limiting
740
- RATE_LIMIT_REDIS_URL="redis://localhost:6379"
891
+ RATE_LIMIT_REDIS_URL=
741
892
 
742
893
  # =============================================================================
743
894
  # CORS
@@ -784,7 +935,6 @@ FILESYSTEM_STORAGE_PATH=
784
935
  # =============================================================================
785
936
 
786
937
  # PostgreSQL connection URL
787
- # DATABASE_URL="postgres://username:password@localhost:5432/database_name"
788
938
  DATABASE_URL=
789
939
  # Redis connection URL for Redis-based database operations
790
940
  DATABASE_REDIS_URL=
@@ -839,9 +989,45 @@ POLAR_ENVIRONMENT=
839
989
 
840
990
  # Clerk authentication secret key
841
991
  CLERK_SECRET_KEY=
842
- `;var ti=`import { PostHogAnalytics } from "@ooneex/analytics";
992
+
993
+ # =============================================================================
994
+ # Allowed Users
995
+ # =============================================================================
996
+
997
+ # Comma-separated allowed user emails for development environment
998
+ DEVELOPMENT_ALLOWED_USERS=
999
+ # Comma-separated allowed user emails for staging environment
1000
+ STAGING_ALLOWED_USERS=
1001
+ # Comma-separated allowed user emails for testing environment
1002
+ TESTING_ALLOWED_USERS=
1003
+ # Comma-separated allowed user emails for test environment
1004
+ TEST_ALLOWED_USERS=
1005
+ # Comma-separated allowed user emails for QA environment
1006
+ QA_ALLOWED_USERS=
1007
+ # Comma-separated allowed user emails for UAT environment
1008
+ UAT_ALLOWED_USERS=
1009
+ # Comma-separated allowed user emails for integration environment
1010
+ INTEGRATION_ALLOWED_USERS=
1011
+ # Comma-separated allowed user emails for preview environment
1012
+ PREVIEW_ALLOWED_USERS=
1013
+ # Comma-separated allowed user emails for demo environment
1014
+ DEMO_ALLOWED_USERS=
1015
+ # Comma-separated allowed user emails for sandbox environment
1016
+ SANDBOX_ALLOWED_USERS=
1017
+ # Comma-separated allowed user emails for beta environment
1018
+ BETA_ALLOWED_USERS=
1019
+ # Comma-separated allowed user emails for canary environment
1020
+ CANARY_ALLOWED_USERS=
1021
+ # Comma-separated allowed user emails for hotfix environment
1022
+ HOTFIX_ALLOWED_USERS=
1023
+ # Comma-separated system user emails (have access across all environments)
1024
+ SYSTEM_USERS=
1025
+ # Comma-separated super admin user emails
1026
+ SUPER_ADMIN_USERS=
1027
+ # Comma-separated admin user emails
1028
+ ADMIN_USERS=
1029
+ `;var no=`import { PostHogAnalytics } from "@ooneex/analytics";
843
1030
  import { App } from "@ooneex/app";
844
- import { AppEnv, type EnvType } from "@ooneex/app-env";
845
1031
  import { RedisCache } from "@ooneex/cache";
846
1032
  import { LogtailLogger, ExceptionLogger, TerminalLogger } from "@ooneex/logger";
847
1033
  import { ResendMailer } from "@ooneex/mailer";
@@ -849,8 +1035,7 @@ import { CorsMiddleware } from "@ooneex/middleware";
849
1035
  import { RedisRateLimiter } from "@ooneex/rate-limit";
850
1036
  import { BunnyStorage } from "@ooneex/storage";
851
1037
  import { AppModule } from "./AppModule";
852
-
853
- const appEnv = new AppEnv((Bun.env.NODE_ENV || Bun.env.APP_ENV || "production") as EnvType);
1038
+ import { AppDatabase } from "./databases/AppDatabase";
854
1039
 
855
1040
  const app = new App({
856
1041
  prefix: "api",
@@ -866,12 +1051,12 @@ const app = new App({
866
1051
  cors: CorsMiddleware,
867
1052
  cronJobs: AppModule.cronJobs,
868
1053
  events: AppModule.events,
869
- env: appEnv,
1054
+ database: AppDatabase,
870
1055
  generateRouteDoc: true,
871
1056
  });
872
1057
 
873
1058
  await app.run();
874
- `;var si=`{
1059
+ `;var lo=`{
875
1060
  "$schema": "./node_modules/nx/schemas/nx-schema.json",
876
1061
  "targetDefaults": {
877
1062
  "build": {
@@ -901,7 +1086,7 @@ await app.run();
901
1086
  ],
902
1087
  "packageManager": "bun"
903
1088
  }
904
- `;var ri=`{
1089
+ `;var mo=`{
905
1090
  "name": "{{NAME}}",
906
1091
  "module": "index.ts",
907
1092
  "private": true,
@@ -923,28 +1108,29 @@ await app.run();
923
1108
  "modules/*"
924
1109
  ],
925
1110
  "dependencies": {
926
- "@ooneex/analytics": "^0.0.20",
927
- "@ooneex/app": "^0.17.2",
928
- "@ooneex/app-env": "^0.0.19",
929
- "@ooneex/auth": "^0.1.2",
930
- "@ooneex/cache": "^0.0.20",
931
- "@ooneex/container": "^0.0.19",
932
- "@ooneex/database": "^0.0.19",
933
- "@ooneex/logger": "^0.17.2",
934
- "@ooneex/mailer": "^0.0.19",
935
- "@ooneex/middleware": "^0.17.1",
936
- "@ooneex/module": "^0.17.1",
937
- "@ooneex/rate-limit": "^0.0.19",
938
- "@ooneex/role": "^0.0.18",
939
- "@ooneex/routing": "^0.17.1",
940
- "@ooneex/storage": "^0.0.20",
941
- "@ooneex/translation": "^0.0.18",
942
- "@ooneex/types": "^0.0.19",
943
- "@ooneex/utils": "^0.1.1",
944
- "@ooneex/validation": "^0.0.19",
1111
+ "@ooneex/analytics": "^1.0.2",
1112
+ "@ooneex/app": "^1.1.1",
1113
+ "@ooneex/app-env": "^1.0.2",
1114
+ "@ooneex/auth": "^1.1.1",
1115
+ "@ooneex/cache": "^1.0.2",
1116
+ "@ooneex/container": "^1.0.1",
1117
+ "@ooneex/database": "^1.0.2",
1118
+ "@ooneex/logger": "^1.1.1",
1119
+ "@ooneex/mailer": "^1.0.2",
1120
+ "@ooneex/middleware": "^1.1.1",
1121
+ "@ooneex/module": "^1.1.1",
1122
+ "@ooneex/rate-limit": "^1.0.2",
1123
+ "@ooneex/role": "^1.0.1",
1124
+ "@ooneex/routing": "^1.1.1",
1125
+ "@ooneex/storage": "^1.0.2",
1126
+ "@ooneex/translation": "^1.0.1",
1127
+ "@ooneex/types": "^1.0.1",
1128
+ "@ooneex/utils": "^0.1.0",
1129
+ "@ooneex/validation": "^1.0.2",
945
1130
  "pg": "^8.16.3",
946
1131
  "apache-arrow": "^21.1.0",
947
- "reflect-metadata": "^0.2.2"
1132
+ "reflect-metadata": "^0.2.2",
1133
+ "typeorm": "^0.3.28"
948
1134
  },
949
1135
  "devDependencies": {
950
1136
  "@biomejs/biome": "2.3.7",
@@ -954,9 +1140,8 @@ await app.run();
954
1140
  "@commitlint/types": "^20.3.1",
955
1141
  "@nx/js": "^22.3.3",
956
1142
  "@nx/workspace": "^22.3.3",
957
- "@ooneex/cli": "^0.17.1",
958
- "@ooneex/migrations": "^0.17.0",
959
- "@ooneex/seeds": "^0.17.0",
1143
+ "@ooneex/migrations": "^1.1.1",
1144
+ "@ooneex/seeds": "^1.1.1",
960
1145
  "@swc-node/register": "^1.11.1",
961
1146
  "@swc/core": "^1.15.8",
962
1147
  "@swc/helpers": "~0.5.18",
@@ -976,7 +1161,7 @@ await app.run();
976
1161
  ]
977
1162
  }
978
1163
  }
979
- `;var ii=`{
1164
+ `;var co=`{
980
1165
  "compilerOptions": {
981
1166
  "jsx": "react-jsx",
982
1167
  "lib": ["ES2022", "DOM"],
@@ -999,12 +1184,13 @@ await app.run();
999
1184
  "noPropertyAccessFromIndexSignature": false,
1000
1185
  "strictPropertyInitialization": false,
1001
1186
  "emitDecoratorMetadata": true,
1187
+ "experimentalDecorators": true,
1002
1188
  "strictNullChecks": true,
1003
1189
  "exactOptionalPropertyTypes": true
1004
1190
  },
1005
1191
  "exclude": ["node_modules", ".github", ".husky", ".nx", ".zed", ".vscode"]
1006
1192
  }
1007
- `;import{join as D}from"path";import{TerminalLogger as Ap}from"@ooneex/logger";import{toKebabCase as bp,toPascalCase as wp}from"@ooneex/utils";var oi=`#!/usr/bin/env bun
1193
+ `;import{join as P}from"path";import{TerminalLogger as Yl}from"@ooneex/logger";import{toKebabCase as Fl,toPascalCase as jl}from"@ooneex/utils";var po=`#!/usr/bin/env bun
1008
1194
 
1009
1195
  import { migrationUp } from "@ooneex/migrations";
1010
1196
  import "@/migrations/migrations";
@@ -1013,7 +1199,7 @@ await migrationUp({
1013
1199
  databaseUrl: Bun.env.DATABASE_URL || ":memory:",
1014
1200
  tableName: "migrations",
1015
1201
  });
1016
- `;var ni=`import type { ModuleType } from "@ooneex/module";
1202
+ `;var uo=`import type { ModuleType } from "@ooneex/module";
1017
1203
 
1018
1204
  export const {{NAME}}Module: ModuleType = {
1019
1205
  controllers: [],
@@ -1023,7 +1209,7 @@ export const {{NAME}}Module: ModuleType = {
1023
1209
  cronJobs: [],
1024
1210
  events: [],
1025
1211
  };
1026
- `;var ai=`{
1212
+ `;var ho=`{
1027
1213
  "name": "@module/{{NAME}}",
1028
1214
  "description": "",
1029
1215
  "version": "0.0.1",
@@ -1034,13 +1220,13 @@ export const {{NAME}}Module: ModuleType = {
1034
1220
  "seed:run": "bun run ./bin/bin/run.ts"
1035
1221
  }
1036
1222
  }
1037
- `;var pi=`#!/usr/bin/env bun
1223
+ `;var fo=`#!/usr/bin/env bun
1038
1224
 
1039
1225
  import { seedRun } from "@ooneex/seeds";
1040
1226
  import "@/seeds/seeds";
1041
1227
 
1042
1228
  await seedRun();
1043
- `;var li=`import { describe, expect, test } from "bun:test";
1229
+ `;var go=`import { describe, expect, test } from "bun:test";
1044
1230
  import { {{NAME}}Module } from "@/{{NAME}}Module";
1045
1231
 
1046
1232
  describe("{{NAME}}Module", () => {
@@ -1064,7 +1250,7 @@ describe("{{NAME}}Module", () => {
1064
1250
  expect(Array.isArray({{NAME}}Module.events)).toBe(true);
1065
1251
  });
1066
1252
  });
1067
- `;var ci=`{
1253
+ `;var yo=`{
1068
1254
  "extends": "../../tsconfig.json",
1069
1255
  "compilerOptions": {
1070
1256
  "types": ["@types/bun"],
@@ -1075,10 +1261,10 @@ describe("{{NAME}}Module", () => {
1075
1261
  "include": ["src/**/*.ts", "src/**/*.tsx", "tests/**/*.ts", "tests/**/*.tsx"],
1076
1262
  "exclude": ["node_modules", "dist"]
1077
1263
  }
1078
- `;class de{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}";
1079
- `,a=r.lastIndexOf("import "),p=r.indexOf(`
1080
- `,a);r=`${r.slice(0,p+1)}${n}${r.slice(p+1)}`;let l=["controllers","entities","permissions","middlewares","cronJobs","events"];for(let c of l){let d=new RegExp(`(${c}:\\s*\\[)([^\\]]*)`,"s"),h=r.match(d);if(h){let m=h[2]?.trim(),u=`...${i}.${c}`,y=m?`${m}, ${u}`:u;r=r.replace(d,`$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)}
1081
- `)}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 w({message:"Enter module name"});let a=wp(n).replace(/Module$/,""),p=bp(a),l=D(t,"modules",p),c=D(l,"bin"),d=D(l,"src"),h=D(l,"tests"),m=ni.replace(/{{NAME}}/g,a),u=ai.replace(/{{NAME}}/g,p),y=li.replace(/{{NAME}}/g,a);if(!r)await Bun.write(D(c,"migration","up.ts"),oi),await Bun.write(D(c,"seed","run.ts"),pi);if(await Bun.write(D(d,`${a}Module.ts`),m),!i)await Bun.write(D(d,"migrations","migrations.ts"),"");if(!o)await Bun.write(D(d,"seeds","seeds.ts"),"");await Bun.write(D(l,"package.json"),u),await Bun.write(D(l,"tsconfig.json"),ci),await Bun.write(D(h,`${a}Module.spec.ts`),y);let S=D(t,"modules","app","src","AppModule.ts");if(await Bun.file(S).exists())await this.addToAppModule(S,a,p);let f=D(t,"modules","app","tsconfig.json");if(await Bun.file(f).exists())await this.addPathAlias(f,p);if(!s)new Ap().success(`modules/${p} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}de=g([E.command()],de);class Pe{getName(){return"make:app"}getDescription(){return"Generate a new application"}async run(e){let{name:t,destination:s}=e;if(!t)t=await w({message:"Enter application name"});let r=Sp(t);if(!s)s=await Xr({message:"Enter destination path",initial:r});let i=ri.replace(/{{NAME}}/g,r);await Bun.write(B(s,".commitlintrc.ts"),Jr),await Bun.write(B(s,".env"),Mt),await Bun.write(B(s,".env.example"),Mt),await Bun.write(B(s,".gitignore"),jr),await Bun.write(B(s,"biome.jsonc"),kr),await Bun.write(B(s,"bunfig.toml"),ei),await Bun.write(B(s,"nx.json"),si),await Bun.write(B(s,"package.json"),i),await Bun.write(B(s,"tsconfig.json"),ii),await new de().run({name:"app",cwd:s,silent:!0,skipBin:!0,skipMigrations:!0,skipSeeds:!0}),await Bun.write(B(s,".husky","commit-msg"),'bunx commitlint --edit "$1"'),await Bun.write(B(s,".husky","pre-commit"),"lint-staged"),await Bun.write(B(s,"modules","app","src","index.ts"),ti),await Bun.write(B(s,"modules","app","var",".gitkeep"),""),new xp().success(`${r} created successfully at ${s}`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Pe=g([E.command()],Pe);import{join as j}from"path";import{TerminalLogger as Tp}from"@ooneex/logger";import{toPascalCase as _p}from"@ooneex/utils";var mi=`import { describe, expect, test } from "bun:test";
1264
+ `;class ue{getName(){return"make:module"}getDescription(){return"Generate a new module"}async addToAppModule(e,t,s){let r=await Bun.file(e).text(),o=`${t}Module`,a=`@${s}/${o}`,i=`import { ${o} } from "${a}";
1265
+ `,n=r.lastIndexOf("import "),l=r.indexOf(`
1266
+ `,n);r=`${r.slice(0,l+1)}${i}${r.slice(l+1)}`;let d=["controllers","entities","permissions","middlewares","cronJobs","events"];for(let u of d){let c=new RegExp(`(${u}:\\s*\\[)([^\\]]*)`,"s"),p=r.match(c);if(p){let m=p[2]?.trim(),h=`...${o}.${u}`,f=m?`${m}, ${h}`:h;r=r.replace(c,`$1${f}`)}}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)}
1267
+ `)}async run(e){let{cwd:t=process.cwd(),silent:s=!1,skipBin:r=!1,skipMigrations:o=!1,skipSeeds:a=!1}=e,{name:i}=e;if(!i)i=await N({message:"Enter module name"});let n=jl(i).replace(/Module$/,""),l=Fl(n),d=P(t,"modules",l),u=P(d,"bin"),c=P(d,"src"),p=P(d,"tests"),m=uo.replace(/{{NAME}}/g,n),h=ho.replace(/{{NAME}}/g,l),f=go.replace(/{{NAME}}/g,n);if(!r)await Bun.write(P(u,"migration","up.ts"),po),await Bun.write(P(u,"seed","run.ts"),fo);if(await Bun.write(P(c,`${n}Module.ts`),m),!o)await Bun.write(P(c,"migrations","migrations.ts"),"");if(!a)await Bun.write(P(c,"seeds","seeds.ts"),"");if(await Bun.write(P(d,"package.json"),h),await Bun.write(P(d,"tsconfig.json"),yo),await Bun.write(P(p,`${n}Module.spec.ts`),f),l!=="app"){let w=P(t,"modules","app","src","AppModule.ts");if(await Bun.file(w).exists())await this.addToAppModule(w,n,l);let g=P(t,"modules","app","tsconfig.json");if(await Bun.file(g).exists())await this.addPathAlias(g,l)}if(!s)new Yl().success(`modules/${l} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}ue=y([b.command()],ue);class Be{getName(){return"make:app"}getDescription(){return"Generate a new application"}async run(e){let{name:t,destination:s}=e;if(!t)t=await N({message:"Enter application name"});let r=Zl(t);if(!s)s=await Jr({message:"Enter destination path",initial:r});let o=mo.replace(/{{NAME}}/g,r);await Bun.write(R(s,".commitlintrc.ts"),eo),await Bun.write(R(s,".gitignore"),to),await Bun.write(R(s,"biome.jsonc"),ro),await Bun.write(R(s,"bunfig.toml"),oo),await Bun.write(R(s,"nx.json"),lo),await Bun.write(R(s,"package.json"),o),await Bun.write(R(s,"tsconfig.json"),co),await Bun.write(R(s,".husky","commit-msg"),'bunx commitlint --edit "$1"'),await Bun.write(R(s,".husky","pre-commit"),"lint-staged"),await new ue().run({name:"app",cwd:s,silent:!0,skipBin:!0,skipMigrations:!0,skipSeeds:!0});let i=R(s,"modules","app","package.json"),n=await Bun.file(i).json();n.scripts.dev="docker compose up -d && bun --hot run ./src/index.ts",n.scripts.build="bun build ./src/index.ts --outdir ./dist --target bun",await Bun.write(i,JSON.stringify(n,null,2));let l=St.replace("DATABASE_URL=",'DATABASE_URL="postgresql://ooneex:ooneex@localhost:5432/ooneex"').replace("CACHE_REDIS_URL=",'CACHE_REDIS_URL="redis://localhost:6379"').replace("PUBSUB_REDIS_URL=",'PUBSUB_REDIS_URL="redis://localhost:6379"').replace("RATE_LIMIT_REDIS_URL=",'RATE_LIMIT_REDIS_URL="redis://localhost:6379"').replace("DATABASE_REDIS_URL=",'DATABASE_REDIS_URL="redis://localhost:6379"');await Bun.write(R(s,"modules","app",".env"),l),await Bun.write(R(s,"modules","app",".env.example"),St),await Bun.write(R(s,"modules","app","src","databases","AppDatabase.ts"),so),await Bun.write(R(s,"modules","app","src","index.ts"),no);let d=Ql(t),u=io.replace(/{{NAME}}/g,d);await Bun.write(R(s,"modules","app","docker-compose.yml"),u);let c=ao.replace(/{{NAME}}/g,d);await Bun.write(R(s,"modules","app","Dockerfile"),c),await Bun.write(R(s,"modules","app","var",".gitkeep"),""),new zl().success(`${r} created successfully at ${s}`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Be=y([b.command()],Be);import{join as Y}from"path";import{TerminalLogger as ed}from"@ooneex/logger";import{toPascalCase as td}from"@ooneex/utils";var bo=`import { describe, expect, test } from "bun:test";
1082
1268
  import { {{NAME}}Cache } from "@/cache/{{NAME}}Cache";
1083
1269
 
1084
1270
  describe("{{NAME}}Cache", () => {
@@ -1106,7 +1292,7 @@ describe("{{NAME}}Cache", () => {
1106
1292
  expect(typeof {{NAME}}Cache.prototype.has).toBe("function");
1107
1293
  });
1108
1294
  });
1109
- `;var di=`import { CacheException, decorator } from "@ooneex/cache";
1295
+ `;var xo=`import { CacheException, decorator } from "@ooneex/cache";
1110
1296
  import type { ICache } from "@ooneex/cache";
1111
1297
 
1112
1298
  @decorator.cache()
@@ -1127,7 +1313,357 @@ export class {{NAME}}Cache implements ICache {
1127
1313
  throw new CacheException(\`Failed to check if key "\${key}" exists: Not implemented\`);
1128
1314
  }
1129
1315
  }
1130
- `;class Ie{getName(){return"make:cache"}getDescription(){return"Generate a new cache class"}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter cache name"});t=_p(t).replace(/Cache$/,"");let s=di.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=mi.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 c=new Tp;c.success(`${j(r,t)}Cache.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),c.success(`${j(a,t)}Cache.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ie=g([E.command()],Ie);import{basename as vp,join as ue}from"path";import{TerminalLogger as Rp}from"@ooneex/logger";var{Glob:Cp}=globalThis.Bun;class Le{getName(){return"make:claude:skill"}getDescription(){return"Generate Claude skills from templates"}async run(){let e=ue(import.meta.dir,"..","templates","claude","skills"),t=ue(".claude","skills"),s=ue(process.cwd(),t),r=new Cp("*.md.txt"),i=new Rp;for await(let o of r.scan(e)){let n=await Bun.file(ue(e,o)).text(),a=vp(o,".md.txt"),p=ue(s,`${a}.md`);await Bun.write(p,n),i.success(`${ue(t,a)}.md created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}}Le=g([E.command()],Le);import{basename as Fp,join as O}from"path";import{TerminalLogger as Qp}from"@ooneex/logger";import{toKebabCase as zp,toPascalCase as Rt,trim as Zp}from"@ooneex/utils";var ui=Y(Z(),1),$e=async(e)=>{return(await ui.prompt({type:"confirm",name:"confirm",message:e.message})).confirm};var be=["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD"];var hi=Y(Z(),1);import{Assert as Dp,Validation as Bp}from"@ooneex/validation";class Tt extends Bp{getConstraint(){return Dp("string >= 3")}getErrorMessage(){return`Route method must be one of: ${be.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(!be.includes(i))return{isValid:!1,message:this.getErrorMessage()||"Invalid route method"};return{isValid:!0}}}var fi=async(e)=>{return(await hi.prompt({type:"select",name:"method",message:e.message,initial:e.initial??0,choices:be.map((s)=>s),validate:(s)=>{let i=new Tt().validate(s);if(!i.isValid)return i.message||"Route method is invalid";return!0}})).method};var yi=Y(Z(),1);import{Assert as Op,Validation as Pp}from"@ooneex/validation";var Ip=/^[a-zA-Z0-9]+\.[a-zA-Z0-9]+\.[a-zA-Z0-9]+$/;class _t extends Pp{getConstraint(){return Op("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(!Ip.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 gi=async(e)=>{return(await yi.prompt({type:"input",name:"routeName",message:e.message,validate:(s)=>{let i=new _t().validate(s);if(!i.isValid)return i.message||"Route name is invalid";return!0}})).routeName};var Ei=Y(Z(),1);import{Assert as Lp,Validation as $p}from"@ooneex/validation";var Gp=1,Up=/^\/[\w\-/:]*$/,qp=/^[a-zA-Z0-9\-_]+$/,Kp=/^:[a-zA-Z][a-zA-Z0-9]*$/;class vt extends $p{getConstraint(){return Lp(`string >= ${Gp}`)}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(!Up.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(!Kp.test(o))return{isValid:!1,message:`Invalid parameter segment '${o}'. Parameters must follow format ':paramName' with alphanumeric characters only`}}else if(!qp.test(o))return{isValid:!1,message:`Invalid path segment '${o}'. Segments must contain only letters, numbers, hyphens, and underscores`}}return{isValid:!0}}}var Ai=async(e)=>{return(await Ei.prompt({type:"input",name:"path",message:e.message,initial:e.initial??"/",validate:(s)=>{let i=new vt().validate(s);if(!i.isValid)return i.message||"Route path is invalid";return!0}})).path};var bi=`import type { ContextType } from "@ooneex/socket";
1316
+ `;class Ie{getName(){return"make:cache"}getDescription(){return"Generate a new cache class"}async run(e){let{name:t,module:s}=e;if(!t)t=await N({message:"Enter cache name"});t=td(t).replace(/Cache$/,"");let r=xo.replace(/{{NAME}}/g,t),o=s?Y("modules",s):".",a=Y(o,"src","cache"),i=Y(process.cwd(),a),n=Y(i,`${t}Cache.ts`);await Bun.write(n,r);let l=bo.replace(/{{NAME}}/g,t),d=Y(o,"tests","cache"),u=Y(process.cwd(),d),c=Y(u,`${t}Cache.spec.ts`);await Bun.write(c,l);let p=new ed;p.success(`${Y(a,t)}Cache.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${Y(d,t)}Cache.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ie=y([b.command()],Ie);import{join as Le}from"path";import{TerminalLogger as wd}from"@ooneex/logger";var wo="---\nname: make:ai\ndescription: Generate a new AI class with its test file, then complete the generated code. Use when creating a new AI chat class that uses OpenAI via the @ooneex/ai package.\n---\n\n# Make AI Class\n\nGenerate a new AI class and its test file using the `make:ai` CLI command, then complete the generated code with proper implementation.\n\n## Steps\n\n### 1. Run the generator\n\nRun the following command to scaffold the AI class and test files:\n\n```bash\nbunx @ooneex/cli@latest make:ai --name <name> --module <module>\n```\n\nWhere `<name>` is the name provided by the user. The `--module` option is optional \u2014 if provided, files are generated under `modules/<module>/` instead of the project root. The command will generate:\n- `src/ai/<Name>Ai.ts` - The AI class file (or `modules/<module>/src/ai/<Name>Ai.ts` with `--module`)\n- `tests/ai/<Name>Ai.spec.ts` - The test file (or `modules/<module>/tests/ai/<Name>Ai.spec.ts` with `--module`)\n\n### 2. Read the generated files\n\nRead both generated files to understand the scaffolded code.\n\n### 3. Complete the AI class\n\nEdit `src/ai/<Name>Ai.ts` to complete the implementation:\n\n- Update the prompt in the `run` method from `\"My prompt\"` to a meaningful prompt based on the class purpose\n- Update the prompt in the `runStream` method from `\"My prompt\"` to a meaningful prompt based on the class purpose\n- Add any additional configuration or methods relevant to the AI class purpose\n- Ensure proper typing for the `run<T>()` generic return type\n\nThe generated class structure follows this pattern:\n\n```typescript\nimport { decorator, type IAiChat, OpenAi, type OpenAiConfigType } from \"@ooneex/ai\";\nimport { inject } from \"@ooneex/container\";\n\n@decorator.ai()\nexport class <Name>Ai implements IAiChat<OpenAiConfigType> {\n constructor(@inject(OpenAi) private readonly ai: OpenAi) {}\n\n public async run<T>(prompt?: string, config?: Omit<OpenAiConfigType, \"prompt\">): Promise<T> {\n return this.ai.run<T>(prompt || \"My prompt\", config);\n }\n\n public async *runStream(\n prompt?: string,\n config?: Omit<OpenAiConfigType, \"prompt\" | \"output\">,\n ): AsyncGenerator<string, void, unknown> {\n yield* this.ai.runStream(prompt || \"My prompt\", config);\n }\n}\n```\n\n### 4. Complete the test file\n\nEdit `tests/ai/<Name>Ai.spec.ts` to add meaningful tests beyond the scaffolded ones:\n\n- Keep the existing scaffolded tests (class name, run method, runStream method)\n- Add tests relevant to the specific AI class behavior\n\nThe generated test structure follows this pattern:\n\n```typescript\nimport { describe, expect, test } from \"bun:test\";\nimport { <Name>Ai } from \"@/ai/<Name>Ai\";\n\ndescribe(\"<Name>Ai\", () => {\n test(\"should have class name ending with 'Ai'\", () => {\n expect(<Name>Ai.name.endsWith(\"Ai\")).toBe(true);\n });\n\n test(\"should have 'run' method\", () => {\n expect(<Name>Ai.prototype.run).toBeDefined();\n expect(typeof <Name>Ai.prototype.run).toBe(\"function\");\n });\n\n test(\"should have 'runStream' method\", () => {\n expect(<Name>Ai.prototype.runStream).toBeDefined();\n expect(typeof <Name>Ai.prototype.runStream).toBe(\"function\");\n });\n});\n```\n\n### 5. Lint and format\n\nRun linting and formatting on the generated files:\n\n```bash\nbunx biome check --fix src/ai/<Name>Ai.ts tests/ai/<Name>Ai.spec.ts\n```\n";var Eo="---\nname: make:analytics\ndescription: Generate a new analytics class with its test file, then complete the generated code. Use when creating a new analytics tracking class that uses the @ooneex/analytics package.\n---\n\n# Make Analytics Class\n\nGenerate a new analytics class and its test file using the `make:analytics` CLI command, then complete the generated code with proper implementation.\n\n## Steps\n\n### 1. Run the generator\n\nRun the following command to scaffold the analytics class and test files:\n\n```bash\nbunx @ooneex/cli@latest make:analytics --name <name> --module <module>\n```\n\nWhere `<name>` is the name provided by the user. The `--module` option is optional \u2014 if provided, files are generated under `modules/<module>/` instead of the project root. The command will generate:\n- `src/analytics/<Name>Analytics.ts` - The analytics class file (or `modules/<module>/src/analytics/<Name>Analytics.ts` with `--module`)\n- `tests/analytics/<Name>Analytics.spec.ts` - The test file (or `modules/<module>/tests/analytics/<Name>Analytics.spec.ts` with `--module`)\n\n### 2. Read the generated files\n\nRead both generated files to understand the scaffolded code.\n\n### 3. Complete the analytics class\n\nEdit `src/analytics/<Name>Analytics.ts` to complete the implementation:\n\n- Implement the `capture` method with actual analytics tracking logic\n- Define a proper type for `CaptureOptionsType` instead of `Record<string, unknown>` based on the analytics purpose\n- Add any additional methods or properties relevant to the analytics class purpose\n\nThe generated class structure follows this pattern:\n\n```typescript\nimport { decorator } from \"@ooneex/analytics\";\nimport type { IAnalytics } from \"@ooneex/analytics\";\n\ntype CaptureOptionsType = Record<string, unknown>;\n\n@decorator.analytics()\nexport class <Name>Analytics<T extends CaptureOptionsType = CaptureOptionsType> implements IAnalytics<T> {\n public capture(options: T): void {\n // console.log(\"Analytics captured:\", options);\n }\n}\n```\n\n### 4. Complete the test file\n\nEdit `tests/analytics/<Name>Analytics.spec.ts` to add meaningful tests beyond the scaffolded ones:\n\n- Keep the existing scaffolded tests (class name, capture method)\n- Add tests relevant to the specific analytics class behavior\n\nThe generated test structure follows this pattern:\n\n```typescript\nimport { describe, expect, test } from \"bun:test\";\nimport { <Name>Analytics } from \"@/analytics/<Name>Analytics\";\n\ndescribe(\"<Name>Analytics\", () => {\n test(\"should have class name ending with 'Analytics'\", () => {\n expect(<Name>Analytics.name.endsWith(\"Analytics\")).toBe(true);\n });\n\n test(\"should have 'capture' method\", () => {\n expect(<Name>Analytics.prototype.capture).toBeDefined();\n expect(typeof <Name>Analytics.prototype.capture).toBe(\"function\");\n });\n});\n```\n\n### 5. Lint and format\n\nRun linting and formatting on the generated files:\n\n```bash\nbunx biome check --fix src/analytics/<Name>Analytics.ts tests/analytics/<Name>Analytics.spec.ts\n```\n";var Ao="---\nname: make:cache\ndescription: Generate a new cache adapter class with its test file, then complete the generated code. Use when creating a new cache adapter that implements the ICache interface from @ooneex/cache.\n---\n\n# Make Cache Class\n\nGenerate a new cache class and its test file using the `make:cache` CLI command, then complete the generated code with proper implementation.\n\n## Steps\n\n### 1. Run the generator\n\nRun the following command to scaffold the cache class and test files:\n\n```bash\nbunx @ooneex/cli@latest make:cache --name <name> --module <module>\n```\n\nWhere `<name>` is the name provided by the user. The `--module` option is optional \u2014 if provided, files are generated under `modules/<module>/` instead of the project root. The command will generate:\n- `src/cache/<Name>Cache.ts` - The cache class file (or `modules/<module>/src/cache/<Name>Cache.ts` with `--module`)\n- `tests/cache/<Name>Cache.spec.ts` - The test file (or `modules/<module>/tests/cache/<Name>Cache.spec.ts` with `--module`)\n\n### 2. Read the generated files\n\nRead both generated files to understand the scaffolded code.\n\n### 3. Complete the cache class\n\nEdit `src/cache/<Name>Cache.ts` to complete the implementation:\n\n- Implement the `get` method to retrieve cached values by key\n- Implement the `set` method to store values with optional TTL\n- Implement the `delete` method to remove cached entries\n- Implement the `has` method to check key existence\n- Replace the `CacheException` throws with actual cache logic\n- Inject any required dependencies (e.g., Redis client) via the constructor\n\nThe generated class structure follows this pattern:\n\n```typescript\nimport { CacheException, decorator } from \"@ooneex/cache\";\nimport type { ICache } from \"@ooneex/cache\";\n\n@decorator.cache()\nexport class <Name>Cache implements ICache {\n public async get<T = unknown>(key: string): Promise<T | undefined> {\n throw new CacheException(`Failed to get key \"${key}\": Not implemented`);\n }\n\n public async set<T = unknown>(key: string, value: T, ttl?: number): Promise<void> {\n throw new CacheException(`Failed to set key \"${key}\": Not implemented`);\n }\n\n public async delete(key: string): Promise<boolean> {\n throw new CacheException(`Failed to delete key \"${key}\": Not implemented`);\n }\n\n public async has(key: string): Promise<boolean> {\n throw new CacheException(`Failed to check if key \"${key}\" exists: Not implemented`);\n }\n}\n```\n\n### 4. Complete the test file\n\nEdit `tests/cache/<Name>Cache.spec.ts` to add meaningful tests beyond the scaffolded ones:\n\n- Keep the existing scaffolded tests (class name, get, set, delete, has methods)\n- Add tests relevant to the specific cache class behavior\n\nThe generated test structure follows this pattern:\n\n```typescript\nimport { describe, expect, test } from \"bun:test\";\nimport { <Name>Cache } from \"@/cache/<Name>Cache\";\n\ndescribe(\"<Name>Cache\", () => {\n test(\"should have class name ending with 'Cache'\", () => {\n expect(<Name>Cache.name.endsWith(\"Cache\")).toBe(true);\n });\n\n test(\"should have 'get' method\", () => {\n expect(<Name>Cache.prototype.get).toBeDefined();\n expect(typeof <Name>Cache.prototype.get).toBe(\"function\");\n });\n\n test(\"should have 'set' method\", () => {\n expect(<Name>Cache.prototype.set).toBeDefined();\n expect(typeof <Name>Cache.prototype.set).toBe(\"function\");\n });\n\n test(\"should have 'delete' method\", () => {\n expect(<Name>Cache.prototype.delete).toBeDefined();\n expect(typeof <Name>Cache.prototype.delete).toBe(\"function\");\n });\n\n test(\"should have 'has' method\", () => {\n expect(<Name>Cache.prototype.has).toBeDefined();\n expect(typeof <Name>Cache.prototype.has).toBe(\"function\");\n });\n});\n```\n\n### 5. Lint and format\n\nRun linting and formatting on the generated files:\n\n```bash\nbunx biome check --fix src/cache/<Name>Cache.ts tests/cache/<Name>Cache.spec.ts\n```\n";var No=`---
1317
+ name: make:controller
1318
+ description: Generate a new controller class with route type and test file, then complete the generated code. Use when creating a new HTTP or WebSocket controller with routing, validation, and role-based access.
1319
+ ---
1320
+
1321
+ # Make Controller Class
1322
+
1323
+ Generate a new controller class, its route type, and test file using the \`make:controller\` CLI command, then complete the generated code with proper implementation.
1324
+
1325
+ ## Steps
1326
+
1327
+ ### 1. Run the generator
1328
+
1329
+ Run the following command to scaffold the controller class and related files:
1330
+
1331
+ \`\`\`bash
1332
+ bunx @ooneex/cli@latest make:controller --name <name> --module <module> --is-socket <true|false> --route.name <route.name> --route.path <route.path> --route.method <route.method>
1333
+ \`\`\`
1334
+
1335
+ Where:
1336
+ - \`<name>\` is the controller name provided by the user
1337
+ - \`--module\` is optional \u2014 if provided, files are generated under \`modules/<module>/\` instead of the project root
1338
+ - \`--is-socket\` determines HTTP vs WebSocket controller (defaults to \`false\`)
1339
+ - \`--route.name\` is the route name using dot notation: \`<resource>.<action>\` (e.g., \`user.create\`, \`book.list\`, \`flashcard.delete\`)
1340
+ - \`--route.path\` is the route path (e.g., \`/api/users\`)
1341
+ - \`--route.method\` is the HTTP method (e.g., \`get\`, \`post\`, \`put\`, \`patch\`, \`delete\`) \u2014 only for HTTP controllers
1342
+
1343
+ The command will generate (paths prefixed with \`modules/<module>/\` when \`--module\` is provided):
1344
+ - \`src/controllers/<Name>Controller.ts\` - The controller class file
1345
+ - \`src/types/routes/<route.name>.ts\` - The route type file
1346
+ - \`tests/controllers/<Name>Controller.spec.ts\` - The test file
1347
+
1348
+ ### 2. Read the generated files
1349
+
1350
+ Read all three generated files to understand the scaffolded code.
1351
+
1352
+ ### 3. Complete the route type
1353
+
1354
+ Edit \`src/types/routes/<route.name>.ts\` to define the route's type contract.
1355
+
1356
+ **Add or remove \`params\`, \`payload\`, and \`queries\` based on context:**
1357
+
1358
+ - **\`params\`** \u2014 Include only when the route path contains dynamic segments (e.g., \`/api/users/:id\`). Remove entirely for routes with no URL parameters (e.g., \`/api/users\`).
1359
+ - **\`payload\`** \u2014 Include only for methods that accept a request body (\`post\`, \`put\`, \`patch\`). Remove entirely for \`get\` and \`delete\` routes.
1360
+ - **\`queries\`** \u2014 Include only when the route supports query string filtering, pagination, or sorting (e.g., list/search endpoints). Remove entirely when not needed.
1361
+ - **\`response\`** \u2014 Always include.
1362
+
1363
+ The generated route type structure follows this pattern (remove unused sections):
1364
+
1365
+ \`\`\`typescript
1366
+ // Example: GET /api/users (list) \u2014 no params, no payload, has queries
1367
+ export type <TypeName>RouteType = {
1368
+ queries: {
1369
+
1370
+ },
1371
+ response: {
1372
+
1373
+ },
1374
+ };
1375
+
1376
+ // Example: POST /api/users (create) \u2014 no params, has payload, no queries
1377
+ export type <TypeName>RouteType = {
1378
+ payload: {
1379
+
1380
+ },
1381
+ response: {
1382
+
1383
+ },
1384
+ };
1385
+
1386
+ // Example: GET /api/users/:id (detail) \u2014 has params, no payload, no queries
1387
+ export type <TypeName>RouteType = {
1388
+ params: {
1389
+
1390
+ },
1391
+ response: {
1392
+
1393
+ },
1394
+ };
1395
+
1396
+ // Example: PUT /api/users/:id (update) \u2014 has params, has payload, no queries
1397
+ export type <TypeName>RouteType = {
1398
+ params: {
1399
+
1400
+ },
1401
+ payload: {
1402
+
1403
+ },
1404
+ response: {
1405
+
1406
+ },
1407
+ };
1408
+ \`\`\`
1409
+
1410
+ ### 4. Complete the controller class
1411
+
1412
+ Edit \`src/controllers/<Name>Controller.ts\` to complete the implementation:
1413
+
1414
+ - Set appropriate \`roles\` for access control
1415
+ - Add a meaningful \`description\` for the route that explains what the endpoint does (e.g., \`"Create a new user account"\`, \`"List all books with pagination"\`)
1416
+ - Implement the \`index\` method with actual controller logic
1417
+ - Inject any required dependencies (repositories, services) via the constructor
1418
+
1419
+ **Add or remove \`params\`, \`payload\`, and \`queries\` in the \`@Route\` decorator to match the route type (step 3):**
1420
+
1421
+ - **\`params\`** \u2014 Include with \`Assert()\` validators only when the route has URL parameters. Remove the \`params\` key entirely otherwise.
1422
+ - **\`payload\`** \u2014 Include with \`Assert({...})\` only for \`post\`, \`put\`, \`patch\` methods. Remove the \`payload\` key entirely for \`get\` and \`delete\`.
1423
+ - **\`queries\`** \u2014 Include with \`Assert({...})\` only when query parameters are expected. Remove the \`queries\` key entirely otherwise.
1424
+ - **\`response\`** \u2014 Always include with \`Assert({...})\`.
1425
+
1426
+ **HTTP controller** generated structure (remove \`params\`, \`payload\`, \`queries\` as needed \u2014 see rules above):
1427
+
1428
+ \`\`\`typescript
1429
+ import type { ContextType } from "@ooneex/controller";
1430
+ import { ERole } from "@ooneex/role";
1431
+ import { Route } from "@ooneex/routing";
1432
+ import { Assert } from "@ooneex/validation";
1433
+ import type { <TypeName>RouteType } from "../types/routes/<route.name>";
1434
+
1435
+ @Route.<method>("<route.path>", {
1436
+ name: "<route.name>",
1437
+ version: 1,
1438
+ description: "",
1439
+ params: {
1440
+ // id: Assert("string"),
1441
+ },
1442
+ payload: Assert({
1443
+
1444
+ }),
1445
+ queries: Assert({
1446
+
1447
+ }),
1448
+ response: Assert({
1449
+
1450
+ }),
1451
+ roles: [ERole.USER],
1452
+ })
1453
+ export class <Name>Controller {
1454
+ public async index(context: ContextType<<TypeName>RouteType>) {
1455
+ // const { id } = context.params;
1456
+
1457
+ return context.response.json({
1458
+
1459
+ });
1460
+ }
1461
+ }
1462
+ \`\`\`
1463
+
1464
+ **Socket controller** generated structure (remove \`params\`, \`payload\`, \`queries\` as needed \u2014 see rules above):
1465
+
1466
+ \`\`\`typescript
1467
+ import type { ContextType } from "@ooneex/socket";
1468
+ import { ERole } from "@ooneex/role";
1469
+ import { Route } from "@ooneex/routing";
1470
+ import { Assert } from "@ooneex/validation";
1471
+ import type { <TypeName>RouteType } from "../types/routes/<route.name>";
1472
+
1473
+ @Route.socket("<route.path>", {
1474
+ name: "<route.name>",
1475
+ version: 1,
1476
+ description: "",
1477
+ params: {
1478
+ // id: Assert("string"),
1479
+ },
1480
+ payload: Assert({
1481
+
1482
+ }),
1483
+ queries: Assert({
1484
+
1485
+ }),
1486
+ response: Assert({
1487
+
1488
+ }),
1489
+ roles: [ERole.USER],
1490
+ })
1491
+ export class <Name>Controller {
1492
+ public async index(context: ContextType<<TypeName>RouteType>) {
1493
+ // const { id } = context.params;
1494
+
1495
+ return context.response.json({
1496
+
1497
+ });
1498
+ }
1499
+ }
1500
+ \`\`\`
1501
+
1502
+ ### 5. Complete the test file
1503
+
1504
+ Edit \`tests/controllers/<Name>Controller.spec.ts\` to add meaningful tests beyond the scaffolded ones:
1505
+
1506
+ - Keep the existing scaffolded tests (class name, index method)
1507
+ - Add tests relevant to the specific controller behavior
1508
+
1509
+ The generated test structure follows this pattern:
1510
+
1511
+ \`\`\`typescript
1512
+ import { describe, expect, test } from "bun:test";
1513
+ import { <Name>Controller } from "@/controllers/<Name>Controller";
1514
+
1515
+ describe("<Name>Controller", () => {
1516
+ test("should have class name ending with 'Controller'", () => {
1517
+ expect(<Name>Controller.name.endsWith("Controller")).toBe(true);
1518
+ });
1519
+
1520
+ test("should have 'index' method", () => {
1521
+ expect(<Name>Controller.prototype.index).toBeDefined();
1522
+ expect(typeof <Name>Controller.prototype.index).toBe("function");
1523
+ });
1524
+ });
1525
+ \`\`\`
1526
+
1527
+ ### 6. Register the controller in the module
1528
+
1529
+ Add the new controller to the module's \`controllers\` array in \`src/<PascalModuleName>Module.ts\` (e.g., \`src/BookModule.ts\` for the \`book\` module):
1530
+
1531
+ \`\`\`typescript
1532
+ import type { ModuleType } from "@ooneex/module";
1533
+ import { <Name>Controller } from "./controllers/<Name>Controller";
1534
+
1535
+ export const <PascalModuleName>Module: ModuleType = {
1536
+ controllers: [<Name>Controller],
1537
+ entities: [],
1538
+ permissions: [],
1539
+ middlewares: [],
1540
+ cronJobs: [],
1541
+ events: [],
1542
+ };
1543
+ \`\`\`
1544
+
1545
+ The module file uses PascalCase naming: \`<PascalModuleName>Module.ts\` with export \`<PascalModuleName>Module\`.
1546
+
1547
+ If the module already has other controllers registered, append the new controller to the existing \`controllers\` array and add the import alongside existing imports.
1548
+
1549
+ ### 7. Lint and format
1550
+
1551
+ Run linting and formatting on the generated files:
1552
+
1553
+ \`\`\`bash
1554
+ bunx biome check --fix src/controllers/<Name>Controller.ts src/types/routes/<route.name>.ts tests/controllers/<Name>Controller.spec.ts
1555
+ \`\`\`
1556
+
1557
+ ### 8. Create the service
1558
+
1559
+ After the controller is created, generate a service class for the controller's business logic using the \`make:service\` skill:
1560
+
1561
+ \`\`\`
1562
+ /make:service --name <Name>
1563
+ \`\`\`
1564
+
1565
+ Where \`<Name>\` matches the controller name (e.g., if the controller is \`CreateUserController\`, the service is \`CreateUserService\`).
1566
+
1567
+ ### 9. Create the pubsub event
1568
+
1569
+ After the service is created, generate a pubsub event class for the controller's domain events using the \`make:pubsub\` skill:
1570
+
1571
+ \`\`\`
1572
+ /make:pubsub --name <Name> --channel <resource>.<action>
1573
+ \`\`\`
1574
+
1575
+ Where:
1576
+ - \`<Name>\` matches the controller name (e.g., if the controller is \`CreateUserController\`, the event is \`CreateUserEvent\`)
1577
+ - \`<resource>.<action>\` follows the same dot notation as the route name (e.g., \`user.create\`, \`book.delete\`)
1578
+
1579
+ Once the event is created:
1580
+ - Inject the **service** into the **event** via the constructor, and call the service's \`execute\` method from the event's \`handler\` method.
1581
+ - Inject the **event** into the **controller** via the constructor, and publish the event from the controller's \`index\` method.
1582
+ `;var vo="---\nname: make:cron\ndescription: Generate a new cron job class with its test file, then complete the generated code. Use when creating a new scheduled task that extends the Cron base class from @ooneex/cron.\n---\n\n# Make Cron Class\n\nGenerate a new cron class and its test file using the `make:cron` CLI command, then complete the generated code with proper implementation.\n\n## Steps\n\n### 1. Run the generator\n\nRun the following command to scaffold the cron class and test files:\n\n```bash\nbunx @ooneex/cli@latest make:cron --name <name> --module <module>\n```\n\nWhere `<name>` is the name provided by the user. The `--module` option is optional \u2014 if provided, files are generated under `modules/<module>/` instead of the project root. The command will generate:\n- `src/cron/<Name>Cron.ts` - The cron class file (or `modules/<module>/src/cron/<Name>Cron.ts` with `--module`)\n- `tests/cron/<Name>Cron.spec.ts` - The test file (or `modules/<module>/tests/cron/<Name>Cron.spec.ts` with `--module`)\n\n### 2. Read the generated files\n\nRead both generated files to understand the scaffolded code.\n\n### 3. Complete the cron class\n\nEdit `src/cron/<Name>Cron.ts` to complete the implementation:\n\n- Set the appropriate cron schedule in `getTime()` (e.g., `\"every 5 minutes\"`, `\"every 1 hours\"`, `\"every 30 seconds\"`)\n- Set the timezone in `getTimeZone()` if needed, or keep `null` for server timezone\n- Implement the `handler()` method with the actual cron job logic\n- Inject any required dependencies via the constructor\n\nThe generated class structure follows this pattern:\n\n```typescript\nimport type { TimeZoneType } from \"@ooneex/country\";\nimport type { CronTimeType } from \"@ooneex/cron\";\nimport { Cron, decorator } from \"@ooneex/cron\";\n\n@decorator.cron()\nexport class <Name>Cron extends Cron {\n public getTime(): CronTimeType {\n // Examples: \"every 5 minutes\", \"every 1 hours\", \"every 30 seconds\"\n return \"every 1 hours\";\n }\n\n public getTimeZone(): TimeZoneType | null {\n // Return null to use server timezone, or specify a timezone like \"Europe/Paris\"\n return null;\n }\n\n public async handler(): Promise<void> {\n // Implement your cron handler logic here\n // console.log(\"<Name>Cron handler executed\");\n }\n}\n```\n\n### 4. Complete the test file\n\nEdit `tests/cron/<Name>Cron.spec.ts` to add meaningful tests beyond the scaffolded ones:\n\n- Keep the existing scaffolded tests (class name, getTime, getTimeZone, handler methods)\n- Add tests relevant to the specific cron class behavior\n\nThe generated test structure follows this pattern:\n\n```typescript\nimport { describe, expect, test } from \"bun:test\";\nimport { <Name>Cron } from \"@/cron/<Name>Cron\";\n\ndescribe(\"<Name>Cron\", () => {\n test(\"should have class name ending with 'Cron'\", () => {\n expect(<Name>Cron.name.endsWith(\"Cron\")).toBe(true);\n });\n\n test(\"should have 'getTime' method\", () => {\n expect(<Name>Cron.prototype.getTime).toBeDefined();\n expect(typeof <Name>Cron.prototype.getTime).toBe(\"function\");\n });\n\n test(\"should have 'getTimeZone' method\", () => {\n expect(<Name>Cron.prototype.getTimeZone).toBeDefined();\n expect(typeof <Name>Cron.prototype.getTimeZone).toBe(\"function\");\n });\n\n test(\"should have 'handler' method\", () => {\n expect(<Name>Cron.prototype.handler).toBeDefined();\n expect(typeof <Name>Cron.prototype.handler).toBe(\"function\");\n });\n});\n```\n\n### 5. Register the cron job in the module\n\nAdd the new cron job to the module's `cronJobs` array in `src/<PascalModuleName>Module.ts` (e.g., `src/BookModule.ts` for the `book` module):\n\n```typescript\nimport type { ModuleType } from \"@ooneex/module\";\nimport { <Name>Cron } from \"./cron/<Name>Cron\";\n\nexport const <PascalModuleName>Module: ModuleType = {\n controllers: [],\n entities: [],\n permissions: [],\n middlewares: [],\n cronJobs: [<Name>Cron],\n events: [],\n};\n```\n\nThe module file uses PascalCase naming: `<PascalModuleName>Module.ts` with export `<PascalModuleName>Module`.\n\nIf the module already has other cron jobs registered, append the new cron job to the existing `cronJobs` array and add the import alongside existing imports.\n\n### 6. Lint and format\n\nRun linting and formatting on the generated files:\n\n```bash\nbunx biome check --fix src/cron/<Name>Cron.ts tests/cron/<Name>Cron.spec.ts\n```\n";var To="---\nname: make:database\ndescription: Generate a new database class with its test file, then complete the generated code. Use when creating a new database adapter that extends TypeormDatabase from @ooneex/database.\n---\n\n# Make Database Class\n\nGenerate a new database class and its test file using the `make:database` CLI command, then complete the generated code with proper implementation.\n\n## Steps\n\n### 1. Run the generator\n\nRun the following command to scaffold the database class and test files:\n\n```bash\nbunx @ooneex/cli@latest make:database --name <name> --module <module>\n```\n\nWhere `<name>` is the name provided by the user. The `--module` option is optional \u2014 if provided, files are generated under `modules/<module>/` instead of the project root. The command will generate:\n- `src/databases/<Name>Database.ts` - The database class file (or `modules/<module>/src/databases/<Name>Database.ts` with `--module`)\n- `tests/databases/<Name>Database.spec.ts` - The test file (or `modules/<module>/tests/databases/<Name>Database.spec.ts` with `--module`)\n\n### 2. Read the generated files\n\nRead both generated files to understand the scaffolded code.\n\n### 3. Complete the database class\n\nEdit `src/databases/<Name>Database.ts` to complete the implementation:\n\n- Add entity imports and register them in the `entities` array\n- Adjust the database path if needed (default is `\"var/db\"`)\n- Configure DataSource options as appropriate (type, synchronize, etc.)\n- Inject any required dependencies via the constructor\n\nThe generated class structure follows this pattern:\n\n```typescript\nimport { DataSource } from \"typeorm\";\nimport { TypeormDatabase, DatabaseException, decorator } from \"@ooneex/database\";\n\n@decorator.database()\nexport class <Name>Database extends TypeormDatabase {\n public getSource(database?: string): DataSource {\n database = database || \"var/db\";\n\n this.source = new DataSource({\n synchronize: false,\n entities: [\n // TODO: Load your entities here\n ],\n enableWAL: true,\n busyErrorRetry: 2000,\n busyTimeout: 30_000,\n database,\n type: \"sqlite\",\n });\n\n return this.source;\n }\n}\n```\n\n### 4. Complete the test file\n\nEdit `tests/databases/<Name>Database.spec.ts` to add meaningful tests beyond the scaffolded ones:\n\n- Keep the existing scaffolded tests (class name, getSource method)\n- Add tests relevant to the specific database class behavior\n\nThe generated test structure follows this pattern:\n\n```typescript\nimport { describe, expect, test } from \"bun:test\";\nimport { <Name>Database } from \"@/databases/<Name>Database\";\n\ndescribe(\"<Name>Database\", () => {\n test(\"should have class name ending with 'Database'\", () => {\n expect(<Name>Database.name.endsWith(\"Database\")).toBe(true);\n });\n\n test(\"should have 'getSource' method\", () => {\n expect(<Name>Database.prototype.getSource).toBeDefined();\n expect(typeof <Name>Database.prototype.getSource).toBe(\"function\");\n });\n});\n```\n\n### 5. Lint and format\n\nRun linting and formatting on the generated files:\n\n```bash\nbunx biome check --fix src/databases/<Name>Database.ts tests/databases/<Name>Database.spec.ts\n```\n";var So="---\nname: make:entity\ndescription: Generate a new TypeORM entity class with its test file, then complete the generated code. Use when creating a new database entity with columns, relations, and table mapping.\n---\n\n# Make Entity Class\n\nGenerate a new entity class and its test file using the `make:entity` CLI command, then complete the generated code with proper implementation.\n\n## Steps\n\n### 1. Run the generator\n\nRun the following command to scaffold the entity class and test files:\n\n```bash\nbunx @ooneex/cli@latest make:entity --name <name> --module <module> --table-name <table_name>\n```\n\nWhere `<name>` is the name provided by the user. The `--table-name` option is optional \u2014 if omitted, it defaults to the snake_case pluralized form of the name (e.g., `UserProfile` becomes `user_profiles`). The `--module` option is optional \u2014 if provided, files are generated under `modules/<module>/` instead of the project root. The command will generate:\n- `src/entities/<Name>Entity.ts` - The entity class file (or `modules/<module>/src/entities/<Name>Entity.ts` with `--module`)\n- `tests/entities/<Name>Entity.spec.ts` - The test file (or `modules/<module>/tests/entities/<Name>Entity.spec.ts` with `--module`)\n\n### 2. Read the generated files\n\nRead both generated files to understand the scaffolded code.\n\n### 3. Complete the entity class\n\nEdit `src/entities/<Name>Entity.ts` to complete the implementation:\n\n- Add entity-specific columns with appropriate TypeORM decorators (`@Column`)\n- Add relations if needed (`@ManyToOne`, `@OneToMany`, `@ManyToMany`, etc.)\n- Remove any scaffolded columns that are not relevant to the entity\n- Adjust column types, lengths, and constraints as needed\n\nThe generated class structure follows this pattern:\n\n```typescript\nimport type { LocaleType } from \"@ooneex/translation\";\nimport { random } from \"@ooneex/utils\";\nimport { Column, CreateDateColumn, DeleteDateColumn, PrimaryColumn, UpdateDateColumn } from \"typeorm\";\n\n@Entity({\n name: \"<table_name>\",\n})\nexport class <Name>Entity extends BaseEntity {\n @PrimaryColumn({ name: \"id\", type: \"varchar\", length: 25 })\n id: string = random.nanoid(25);\n\n @Column({\n name: \"is_locked\",\n type: \"boolean\",\n default: false,\n nullable: true,\n })\n isLocked?: boolean;\n\n @Column({ name: \"locked_at\", type: \"timestamptz\", nullable: true })\n lockedAt?: Date;\n\n @Column({\n name: \"is_blocked\",\n type: \"boolean\",\n default: false,\n nullable: true,\n })\n isBlocked?: boolean;\n\n @Column({ name: \"blocked_at\", type: \"timestamptz\", nullable: true })\n blockedAt?: Date;\n\n @Column({ name: \"block_reason\", type: \"text\", nullable: true })\n blockReason?: string;\n\n @Column({ name: \"is_public\", type: \"boolean\", default: true, nullable: true })\n isPublic?: boolean;\n\n @Column({ name: \"lang\", type: \"varchar\", length: 10, nullable: true })\n lang?: LocaleType;\n\n @CreateDateColumn({ name: \"created_at\" })\n createdAt?: Date;\n\n @UpdateDateColumn({ name: \"updated_at\" })\n updatedAt?: Date;\n\n @DeleteDateColumn({ name: \"deleted_at\" })\n deletedAt?: Date;\n}\n```\n\n### 4. Complete the test file\n\nEdit `tests/entities/<Name>Entity.spec.ts` to add meaningful tests beyond the scaffolded ones:\n\n- Keep the existing scaffolded tests (class name, id, default columns)\n- Add tests for any new entity-specific columns and relations\n- Update tests if scaffolded columns were removed\n\nThe generated test structure follows this pattern:\n\n```typescript\nimport { describe, expect, test } from \"bun:test\";\nimport { <Name>Entity } from \"@/entities/<Name>Entity\";\n\ndescribe(\"<Name>Entity\", () => {\n test(\"should have class name ending with 'Entity'\", () => {\n expect(<Name>Entity.name.endsWith(\"Entity\")).toBe(true);\n });\n\n test(\"should have 'id' property with default nanoid\", () => {\n const entity = new <Name>Entity();\n expect(entity.id).toBeDefined();\n expect(typeof entity.id).toBe(\"string\");\n expect(entity.id.length).toBe(25);\n });\n\n test(\"should have 'isLocked' property\", () => {\n const entity = new <Name>Entity();\n expect(\"isLocked\" in entity).toBe(true);\n });\n\n // ... additional property tests\n});\n```\n\n### 5. Register the entity in the module\n\nAdd the new entity to the module's `entities` array in `src/<PascalModuleName>Module.ts` (e.g., `src/BookModule.ts` for the `book` module):\n\n```typescript\nimport type { ModuleType } from \"@ooneex/module\";\nimport { <Name>Entity } from \"./entities/<Name>Entity\";\n\nexport const <PascalModuleName>Module: ModuleType = {\n controllers: [],\n entities: [<Name>Entity],\n permissions: [],\n middlewares: [],\n cronJobs: [],\n events: [],\n};\n```\n\nThe module file uses PascalCase naming: `<PascalModuleName>Module.ts` with export `<PascalModuleName>Module`.\n\nIf the module already has other entities registered, append the new entity to the existing `entities` array and add the import alongside existing imports.\n\n### 6. Create a migration for the entity\n\nAfter creating or updating an entity, generate a migration to apply the corresponding schema changes to the database.\n\nRun the generator:\n\n```bash\nbunx @ooneex/cli@latest make:migration\n```\n\nThen read the generated migration file in `src/migrations/` and complete it:\n\n- In the `up` method, write the SQL to create the table (or alter it if updating an existing entity). Include all columns, types, constraints, defaults, and indexes matching the entity definition.\n- In the `down` method, write the reverse SQL to undo the changes (e.g., `DROP TABLE` or `ALTER TABLE DROP COLUMN`).\n- If the migration depends on another migration (e.g., a foreign key referencing another table), add that migration class to the `getDependencies()` return array.\n\nExample `up` method for a new entity:\n\n```typescript\npublic async up(tx: TransactionSQL): Promise<void> {\n await tx`\n CREATE TABLE IF NOT EXISTS <table_name> (\n id VARCHAR(25) PRIMARY KEY,\n is_locked BOOLEAN DEFAULT false,\n locked_at TIMESTAMPTZ,\n is_blocked BOOLEAN DEFAULT false,\n blocked_at TIMESTAMPTZ,\n block_reason TEXT,\n is_public BOOLEAN DEFAULT true,\n lang VARCHAR(10),\n created_at TIMESTAMPTZ DEFAULT NOW(),\n updated_at TIMESTAMPTZ DEFAULT NOW(),\n deleted_at TIMESTAMPTZ\n )\n `;\n}\n```\n\n### 7. Create a repository for the entity\n\nAfter creating the entity, generate a repository to handle database operations for it.\n\nRun the generator:\n\n```bash\nbunx @ooneex/cli@latest make:repository --name <name>\n```\n\nWhere `<name>` is the same name used for the entity. The command will generate:\n- `src/repositories/<Name>Repository.ts` - The repository class\n- `tests/repositories/<Name>Repository.spec.ts` - The test file\n\nThen read the generated files and complete the repository implementation:\n\n- Adjust search fields in the `find()` method to match the entity's searchable columns\n- Customize relations loading in `findOne`/`findOneBy` if the entity has relations\n- Add any domain-specific methods relevant to the entity\n- Remove methods that don't apply to the entity\n- Update tests to match the final repository methods\n\n### 8. Lint and format\n\nRun linting and formatting on all generated files:\n\n```bash\nbunx biome check --fix src/entities/<Name>Entity.ts tests/entities/<Name>Entity.spec.ts src/repositories/<Name>Repository.ts tests/repositories/<Name>Repository.spec.ts src/migrations/\n```\n";var Mo="---\nname: make:logger\ndescription: Generate a new logger class with its test file, then complete the generated code. Use when creating a new logger that implements the ILogger interface from @ooneex/logger.\n---\n\n# Make Logger Class\n\nGenerate a new logger class and its test file using the `make:logger` CLI command, then complete the generated code with proper implementation.\n\n## Steps\n\n### 1. Run the generator\n\nRun the following command to scaffold the logger class and test files:\n\n```bash\nbunx @ooneex/cli@latest make:logger --name <name> --module <module>\n```\n\nWhere `<name>` is the name provided by the user. The `--module` option is optional \u2014 if provided, files are generated under `modules/<module>/` instead of the project root. The command will generate:\n- `src/loggers/<Name>Logger.ts` - The logger class file (or `modules/<module>/src/loggers/<Name>Logger.ts` with `--module`)\n- `tests/loggers/<Name>Logger.spec.ts` - The test file (or `modules/<module>/tests/loggers/<Name>Logger.spec.ts` with `--module`)\n\n### 2. Read the generated files\n\nRead both generated files to understand the scaffolded code.\n\n### 3. Complete the logger class\n\nEdit `src/loggers/<Name>Logger.ts` to complete the implementation:\n\n- Implement the `init()` method to set up the logger (e.g., open file handles, configure transports)\n- Implement `log`, `debug`, `info`, `success`, `warn`, and `error` methods with actual logging logic\n- Inject any required dependencies via the constructor\n\nThe generated class structure follows this pattern:\n\n```typescript\nimport type { IException } from \"@ooneex/exception\";\nimport type { ILogger } from \"@ooneex/logger\";\nimport type { ScalarType } from \"@ooneex/types\";\nimport { decorator } from \"@ooneex/logger\";\n\n@decorator.logger()\nexport class <Name>Logger implements ILogger {\n public async init(): Promise<void> {\n // Initialize your logger here\n }\n\n public log(message: string, data?: Record<string, ScalarType>): void {\n // Handle general logging\n }\n\n public debug(message: string, data?: Record<string, ScalarType>): void {\n // Handle debug logging\n }\n\n public info(message: string, data?: Record<string, ScalarType>): void {\n // Handle info logging\n }\n\n public success(message: string, data?: Record<string, ScalarType>): void {\n // Handle success logging\n }\n\n public warn(message: string, data?: Record<string, ScalarType>): void {\n // Handle warning logging\n }\n\n public error(message: string | IException, data?: Record<string, ScalarType>): void {\n // Handle error logging\n }\n}\n```\n\n### 4. Complete the test file\n\nEdit `tests/loggers/<Name>Logger.spec.ts` to add meaningful tests beyond the scaffolded ones:\n\n- Keep the existing scaffolded tests (class name, init, log, debug, info, success, warn, error methods)\n- Add tests relevant to the specific logger class behavior\n\nThe generated test structure follows this pattern:\n\n```typescript\nimport { describe, expect, test } from \"bun:test\";\nimport { <Name>Logger } from \"@/loggers/<Name>Logger\";\n\ndescribe(\"<Name>Logger\", () => {\n test(\"should have class name ending with 'Logger'\", () => {\n expect(<Name>Logger.name.endsWith(\"Logger\")).toBe(true);\n });\n\n test(\"should have 'init' method\", () => {\n expect(<Name>Logger.prototype.init).toBeDefined();\n expect(typeof <Name>Logger.prototype.init).toBe(\"function\");\n });\n\n test(\"should have 'log' method\", () => {\n expect(<Name>Logger.prototype.log).toBeDefined();\n expect(typeof <Name>Logger.prototype.log).toBe(\"function\");\n });\n\n test(\"should have 'debug' method\", () => {\n expect(<Name>Logger.prototype.debug).toBeDefined();\n expect(typeof <Name>Logger.prototype.debug).toBe(\"function\");\n });\n\n test(\"should have 'info' method\", () => {\n expect(<Name>Logger.prototype.info).toBeDefined();\n expect(typeof <Name>Logger.prototype.info).toBe(\"function\");\n });\n\n test(\"should have 'success' method\", () => {\n expect(<Name>Logger.prototype.success).toBeDefined();\n expect(typeof <Name>Logger.prototype.success).toBe(\"function\");\n });\n\n test(\"should have 'warn' method\", () => {\n expect(<Name>Logger.prototype.warn).toBeDefined();\n expect(typeof <Name>Logger.prototype.warn).toBe(\"function\");\n });\n\n test(\"should have 'error' method\", () => {\n expect(<Name>Logger.prototype.error).toBeDefined();\n expect(typeof <Name>Logger.prototype.error).toBe(\"function\");\n });\n});\n```\n\n### 5. Lint and format\n\nRun linting and formatting on the generated files:\n\n```bash\nbunx biome check --fix src/loggers/<Name>Logger.ts tests/loggers/<Name>Logger.spec.ts\n```\n";var Ro="---\nname: make:mailer\ndescription: Generate a new mailer class with its template and test files, then complete the generated code. Use when creating a new email sender with JSX template using @ooneex/mailer.\n---\n\n# Make Mailer Class\n\nGenerate a new mailer class, its JSX template, and test files using the `make:mailer` CLI command, then complete the generated code with proper implementation.\n\n## Steps\n\n### 1. Run the generator\n\nRun the following command to scaffold the mailer class and test files:\n\n```bash\nbunx @ooneex/cli@latest make:mailer --name <name> --module <module>\n```\n\nWhere `<name>` is the name provided by the user. The `--module` option is optional \u2014 if provided, files are generated under `modules/<module>/` instead of the project root. The command will generate (paths prefixed with `modules/<module>/` when `--module` is provided):\n- `src/mailers/<Name>Mailer.ts` - The mailer class file\n- `src/mailers/<Name>MailerTemplate.tsx` - The JSX email template\n- `tests/mailers/<Name>Mailer.spec.ts` - The mailer test file\n- `tests/mailers/<Name>MailerTemplate.spec.ts` - The template test file\n\n### 2. Read the generated files\n\nRead all four generated files to understand the scaffolded code.\n\n### 3. Complete the mailer class\n\nEdit `src/mailers/<Name>Mailer.ts` to complete the implementation:\n\n- Adjust the `send` method config type if additional parameters are needed\n- Add any pre-send logic (validation, data transformation, etc.)\n\nThe generated class structure follows this pattern:\n\n```typescript\nimport { inject } from \"@ooneex/container\";\nimport type { IMailer } from \"@ooneex/mailer\";\nimport { type <Name>MailerPropsType, <Name>MailerTemplate } from \"./<Name>MailerTemplate\";\n\nexport class <Name>Mailer implements IMailer {\n constructor(\n @inject(\"mailer\")\n private readonly mailer: IMailer,\n ) {}\n\n public async send(config: {\n to: string[];\n subject: string;\n from?: { name: string; address: string };\n data?: <Name>MailerPropsType;\n }): Promise<void> {\n const { data, ...rest } = config;\n\n await this.mailer.send({\n ...rest,\n content: <Name>MailerTemplate(data),\n });\n }\n}\n```\n\n### 4. Complete the mailer template\n\nEdit `src/mailers/<Name>MailerTemplate.tsx` to complete the implementation:\n\n- Update `<Name>MailerPropsType` with the actual props needed for the email\n- Build the email body using `MailerLayout` components (Header, Body, Footer)\n- Add email content, styling, and dynamic data rendering\n\nThe generated template structure follows this pattern:\n\n```tsx\nimport { MailerLayout } from \"@ooneex/mailer\";\n\nexport type <Name>MailerPropsType = {\n link: string;\n};\n\nexport const <Name>MailerTemplate = (props?: <Name>MailerPropsType) => (\n <MailerLayout>\n <MailerLayout.Header />\n <MailerLayout.Body>\n <a href={props?.link}>Login</a>\n </MailerLayout.Body>\n <MailerLayout.Footer />\n </MailerLayout>\n);\n```\n\n### 5. Complete the test files\n\nEdit `tests/mailers/<Name>Mailer.spec.ts` and `tests/mailers/<Name>MailerTemplate.spec.ts` to add meaningful tests beyond the scaffolded ones.\n\n### 6. Lint and format\n\nRun linting and formatting on the generated files:\n\n```bash\nbunx biome check --fix src/mailers/<Name>Mailer.ts src/mailers/<Name>MailerTemplate.tsx tests/mailers/<Name>Mailer.spec.ts tests/mailers/<Name>MailerTemplate.spec.ts\n```\n";var Co="---\nname: make:middleware\ndescription: Generate a new middleware class with its test file, then complete the generated code. Use when creating a new HTTP or WebSocket middleware that implements IMiddleware from @ooneex/middleware.\n---\n\n# Make Middleware Class\n\nGenerate a new middleware class and its test file using the `make:middleware` CLI command, then complete the generated code with proper implementation.\n\n## Steps\n\n### 1. Run the generator\n\nRun the following command to scaffold the middleware class and test files:\n\n```bash\nbunx @ooneex/cli@latest make:middleware --name <name> --module <module> --is-socket <true|false>\n```\n\nWhere `<name>` is the name provided by the user. The `--module` option is optional \u2014 if provided, files are generated under `modules/<module>/` instead of the project root. The `--is-socket` option determines whether to generate an HTTP middleware or a WebSocket middleware (defaults to `false` if omitted). The command will generate:\n- `src/middlewares/<Name>Middleware.ts` - The middleware class file (or `modules/<module>/src/middlewares/<Name>Middleware.ts` with `--module`)\n- `tests/middlewares/<Name>Middleware.spec.ts` - The test file (or `modules/<module>/tests/middlewares/<Name>Middleware.spec.ts` with `--module`)\n\n### 2. Read the generated files\n\nRead both generated files to understand the scaffolded code.\n\n### 3. Complete the middleware class\n\nEdit `src/middlewares/<Name>Middleware.ts` to complete the implementation:\n\n- Implement the `handler` method with actual middleware logic\n- Add request/response transformations, authentication checks, logging, etc.\n- Inject any required dependencies via the constructor\n\n**HTTP middleware** generated structure:\n\n```typescript\nimport type { ContextType } from \"@ooneex/controller\";\nimport { decorator, type IMiddleware } from \"@ooneex/middleware\";\n\n@decorator.middleware()\nexport class <Name>Middleware implements IMiddleware {\n public async handler(context: ContextType): Promise<ContextType> {\n // Example: Add custom header\n // context.response.header(\"X-Custom-Header\", \"value\");\n\n return context\n }\n}\n```\n\n**Socket middleware** generated structure:\n\n```typescript\nimport type { ContextType } from \"@ooneex/socket\";\nimport { decorator, type IMiddleware } from \"@ooneex/middleware\";\n\n@decorator.middleware()\nexport class <Name>Middleware implements IMiddleware {\n public async handler(context: ContextType): Promise<ContextType> {\n // Example: Add custom header\n // context.response.header(\"X-Custom-Header\", \"value\");\n\n return context\n }\n}\n```\n\n### 4. Complete the test file\n\nEdit `tests/middlewares/<Name>Middleware.spec.ts` to add meaningful tests beyond the scaffolded ones:\n\n- Keep the existing scaffolded tests (class name, handler method)\n- Add tests relevant to the specific middleware behavior\n\nThe generated test structure follows this pattern:\n\n```typescript\nimport { describe, expect, test } from \"bun:test\";\nimport { <Name>Middleware } from \"@/middlewares/<Name>Middleware\";\n\ndescribe(\"<Name>Middleware\", () => {\n test(\"should have class name ending with 'Middleware'\", () => {\n expect(<Name>Middleware.name.endsWith(\"Middleware\")).toBe(true);\n });\n\n test(\"should have 'handler' method\", () => {\n expect(<Name>Middleware.prototype.handler).toBeDefined();\n expect(typeof <Name>Middleware.prototype.handler).toBe(\"function\");\n });\n});\n```\n\n### 5. Register the middleware in the module\n\nAdd the new middleware to the module's `middlewares` array in `src/<PascalModuleName>Module.ts` (e.g., `src/BookModule.ts` for the `book` module):\n\n```typescript\nimport type { ModuleType } from \"@ooneex/module\";\nimport { <Name>Middleware } from \"./middlewares/<Name>Middleware\";\n\nexport const <PascalModuleName>Module: ModuleType = {\n controllers: [],\n entities: [],\n permissions: [],\n middlewares: [<Name>Middleware],\n cronJobs: [],\n events: [],\n};\n```\n\nThe module file uses PascalCase naming: `<PascalModuleName>Module.ts` with export `<PascalModuleName>Module`.\n\nIf the module already has other middlewares registered, append the new middleware to the existing `middlewares` array and add the import alongside existing imports.\n\n### 6. Lint and format\n\nRun linting and formatting on the generated files:\n\n```bash\nbunx biome check --fix src/middlewares/<Name>Middleware.ts tests/middlewares/<Name>Middleware.spec.ts\n```\n";var _o=`---
1583
+ name: make:migration
1584
+ description: Generate a new database migration file, then complete the generated code. Use when creating a new database migration for schema changes using @ooneex/migrations.
1585
+ ---
1586
+
1587
+ # Make Migration
1588
+
1589
+ Generate a new migration file using the \`make:migration\` CLI command, then complete the generated code with proper implementation.
1590
+
1591
+ ## Steps
1592
+
1593
+ ### 1. Run the generator
1594
+
1595
+ Run the following command to scaffold the migration file:
1596
+
1597
+ \`\`\`bash
1598
+ bunx @ooneex/cli@latest make:migration --module <module>
1599
+ \`\`\`
1600
+
1601
+ The \`--module\` option is optional \u2014 if provided, the migration file is generated under \`modules/<module>/src/migrations/\` instead of \`src/migrations/\`. The command will:
1602
+ - Generate a timestamped migration file in \`src/migrations/\` (or \`modules/<module>/src/migrations/\` with \`--module\`)
1603
+ - Add a \`migration:up\` script to \`package.json\` if not already present
1604
+
1605
+ ### 2. Read the generated file
1606
+
1607
+ Read the generated migration file in \`src/migrations/\` to understand the scaffolded code.
1608
+
1609
+ ### 3. Complete the migration
1610
+
1611
+ Edit the generated migration file to implement:
1612
+
1613
+ - The \`up\` method with the schema changes (create tables, add columns, create indexes, etc.)
1614
+ - The \`down\` method with the reverse operations to undo the migration
1615
+
1616
+ ### 4. Lint and format
1617
+
1618
+ Run linting and formatting on the generated file:
1619
+
1620
+ \`\`\`bash
1621
+ bunx biome check --fix src/migrations/
1622
+ \`\`\`
1623
+ `;var Do="---\nname: make:permission\ndescription: Generate a new permission class with its test file, then complete the generated code. Use when creating a new permission that extends Permission from @ooneex/permission.\n---\n\n# Make Permission Class\n\nGenerate a new permission class and its test file using the `make:permission` CLI command, then complete the generated code with proper implementation.\n\n## Steps\n\n### 1. Run the generator\n\nRun the following command to scaffold the permission class and test files:\n\n```bash\nbunx @ooneex/cli@latest make:permission --name <name> --module <module>\n```\n\nWhere `<name>` is the name provided by the user. The `--module` option is optional \u2014 if provided, files are generated under `modules/<module>/` instead of the project root. The command will generate:\n- `src/permissions/<Name>Permission.ts` - The permission class file (or `modules/<module>/src/permissions/<Name>Permission.ts` with `--module`)\n- `tests/permissions/<Name>Permission.spec.ts` - The test file (or `modules/<module>/tests/permissions/<Name>Permission.spec.ts` with `--module`)\n\n### 2. Read the generated files\n\nRead both generated files to understand the scaffolded code.\n\n### 3. Complete the permission class\n\nEdit `src/permissions/<Name>Permission.ts` to complete the implementation:\n\n- Implement the `allow()` method with permission rules using `this.ability.can()`\n- Implement the `setUserPermissions()` method with role-based permission logic\n- Define which actions (read, create, update, delete, manage) are allowed on which entities\n\nThe generated class structure follows this pattern:\n\n```typescript\nimport { decorator, Permission } from \"@ooneex/permission\";\nimport type { IUser } from \"@ooneex/user\";\n\n@decorator.permission()\nexport class <Name>Permission extends Permission {\n public allow(): this {\n // Example: Add permissions using this.ability.can()\n // this.ability.can(\"read\", \"YourEntity\");\n // this.ability.can([\"read\", \"update\"], \"YourEntity\", { userId: user.id });\n\n return this;\n }\n\n public setUserPermissions(user: IUser | null): this {\n if (!user) {\n return this;\n }\n\n // Example: Grant full access to admins\n // const { roles } = user;\n // if (roles.includes(ERole.ADMIN)) {\n // this.ability.can(\"manage\", \"all\");\n // return this;\n // }\n\n // Example: Grant specific permissions based on roles\n // for (const role of roles) {\n // if (role === ERole.USER) {\n // this.ability.can([\"read\", \"update\"], \"YourEntity\", { userId: user.id });\n // }\n //\n // if (role === ERole.GUEST) {\n // this.ability.can(\"read\", \"YourEntity\", { public: true });\n // }\n // }\n\n return this;\n }\n}\n```\n\n### 4. Complete the test file\n\nEdit `tests/permissions/<Name>Permission.spec.ts` to add meaningful tests beyond the scaffolded ones:\n\n- Keep the existing scaffolded tests (class name, extends Permission, allow, setUserPermissions methods)\n- Add tests relevant to the specific permission rules\n\nThe generated test structure follows this pattern:\n\n```typescript\nimport { describe, expect, test } from \"bun:test\";\nimport { Permission } from \"@ooneex/permission\";\nimport { <Name>Permission } from \"@/permissions/<Name>Permission\";\n\ndescribe(\"<Name>Permission\", () => {\n test(\"should have class name ending with 'Permission'\", () => {\n expect(<Name>Permission.name.endsWith(\"Permission\")).toBe(true);\n });\n\n test(\"should extend Permission\", () => {\n const permission = new <Name>Permission();\n expect(permission).toBeInstanceOf(Permission);\n });\n\n test(\"should have 'allow' method\", () => {\n expect(<Name>Permission.prototype.allow).toBeDefined();\n expect(typeof <Name>Permission.prototype.allow).toBe(\"function\");\n });\n\n test(\"should have 'setUserPermissions' method\", () => {\n expect(<Name>Permission.prototype.setUserPermissions).toBeDefined();\n expect(typeof <Name>Permission.prototype.setUserPermissions).toBe(\"function\");\n });\n});\n```\n\n### 5. Register the permission in the module\n\nAdd the new permission to the module's `permissions` array in `src/<PascalModuleName>Module.ts` (e.g., `src/BookModule.ts` for the `book` module):\n\n```typescript\nimport type { ModuleType } from \"@ooneex/module\";\nimport { <Name>Permission } from \"./permissions/<Name>Permission\";\n\nexport const <PascalModuleName>Module: ModuleType = {\n controllers: [],\n entities: [],\n permissions: [<Name>Permission],\n middlewares: [],\n cronJobs: [],\n events: [],\n};\n```\n\nThe module file uses PascalCase naming: `<PascalModuleName>Module.ts` with export `<PascalModuleName>Module`.\n\nIf the module already has other permissions registered, append the new permission to the existing `permissions` array and add the import alongside existing imports.\n\n### 6. Lint and format\n\nRun linting and formatting on the generated files:\n\n```bash\nbunx biome check --fix src/permissions/<Name>Permission.ts tests/permissions/<Name>Permission.spec.ts\n```\n";var Po="---\nname: make:pubsub\ndescription: Generate a new PubSub event class with its test file, then complete the generated code. Use when creating a new publish/subscribe event that extends PubSub from @ooneex/pub-sub.\n---\n\n# Make PubSub Event Class\n\nGenerate a new PubSub event class and its test file using the `make:pubsub` CLI command, then complete the generated code with proper implementation.\n\n## Steps\n\n### 1. Run the generator\n\nRun the following command to scaffold the PubSub event class and test files:\n\n```bash\nbunx @ooneex/cli@latest make:pubsub --name <name> --module <module> --channel <channel>\n```\n\nWhere `<name>` is the name provided by the user. The `--module` option is optional \u2014 if provided, files are generated under `modules/<module>/` instead of the project root. The `--channel` option is optional \u2014 if omitted, it defaults to the kebab-case form of the name (e.g., `UserCreated` becomes `user-created`). The command will generate:\n- `src/events/<Name>Event.ts` - The event class file (or `modules/<module>/src/events/<Name>Event.ts` with `--module`)\n- `tests/events/<Name>Event.spec.ts` - The test file (or `modules/<module>/tests/events/<Name>Event.spec.ts` with `--module`)\n\n### 2. Read the generated files\n\nRead both generated files to understand the scaffolded code.\n\n### 3. Complete the PubSub event class\n\nEdit `src/events/<Name>Event.ts` to complete the implementation:\n\n- Define a proper data type instead of `Record<string, ScalarType>` for the event payload\n- Implement the `handler()` method with actual event handling logic\n- Set the appropriate channel name in `getChannel()`\n\nThe generated class structure follows this pattern:\n\n```typescript\nimport { inject } from \"@ooneex/container\";\nimport type { ScalarType } from \"@ooneex/types\";\nimport { decorator, PubSub, RedisPubSub } from \"@ooneex/pub-sub\";\n\n@decorator.pubSub()\nexport class <Name>Event<Data extends Record<string, ScalarType> = Record<string, ScalarType>> extends PubSub<Data> {\n constructor(\n @inject(RedisPubSub)\n client: RedisPubSub<Data>,\n ) {\n super(client);\n }\n\n public getChannel(): string {\n return \"<channel>\";\n }\n\n public async handler(context: { data: Data; channel: string }): Promise<void> {\n console.log(context);\n // TODO: Implement handler logic here\n }\n}\n```\n\n### 4. Complete the test file\n\nEdit `tests/events/<Name>Event.spec.ts` to add meaningful tests beyond the scaffolded ones:\n\n- Keep the existing scaffolded tests (class name, getChannel, handler, publish, subscribe, unsubscribe, unsubscribeAll methods)\n- Add tests relevant to the specific event behavior\n\nThe generated test structure follows this pattern:\n\n```typescript\nimport { describe, expect, test } from \"bun:test\";\nimport { <Name>PubSub } from \"@/pubsub/<Name>PubSub\";\n\ndescribe(\"<Name>PubSub\", () => {\n test(\"should have class name ending with 'PubSub'\", () => {\n expect(<Name>PubSub.name.endsWith(\"PubSub\")).toBe(true);\n });\n\n test(\"should have 'getChannel' method\", () => {\n expect(<Name>PubSub.prototype.getChannel).toBeDefined();\n expect(typeof <Name>PubSub.prototype.getChannel).toBe(\"function\");\n });\n\n test(\"should have 'handler' method\", () => {\n expect(<Name>PubSub.prototype.handler).toBeDefined();\n expect(typeof <Name>PubSub.prototype.handler).toBe(\"function\");\n });\n\n test(\"should have 'publish' method\", () => {\n expect(<Name>PubSub.prototype.publish).toBeDefined();\n expect(typeof <Name>PubSub.prototype.publish).toBe(\"function\");\n });\n\n test(\"should have 'subscribe' method\", () => {\n expect(<Name>PubSub.prototype.subscribe).toBeDefined();\n expect(typeof <Name>PubSub.prototype.subscribe).toBe(\"function\");\n });\n\n test(\"should have 'unsubscribe' method\", () => {\n expect(<Name>PubSub.prototype.unsubscribe).toBeDefined();\n expect(typeof <Name>PubSub.prototype.unsubscribe).toBe(\"function\");\n });\n\n test(\"should have 'unsubscribeAll' method\", () => {\n expect(<Name>PubSub.prototype.unsubscribeAll).toBeDefined();\n expect(typeof <Name>PubSub.prototype.unsubscribeAll).toBe(\"function\");\n });\n});\n```\n\n### 5. Register the event in the module\n\nAdd the new event to the module's `events` array in `src/<PascalModuleName>Module.ts` (e.g., `src/BookModule.ts` for the `book` module):\n\n```typescript\nimport type { ModuleType } from \"@ooneex/module\";\nimport { <Name>Event } from \"./events/<Name>Event\";\n\nexport const <PascalModuleName>Module: ModuleType = {\n controllers: [],\n entities: [],\n permissions: [],\n middlewares: [],\n cronJobs: [],\n events: [<Name>Event],\n};\n```\n\nThe module file uses PascalCase naming: `<PascalModuleName>Module.ts` with export `<PascalModuleName>Module`.\n\nIf the module already has other events registered, append the new event to the existing `events` array and add the import alongside existing imports.\n\n### 6. Lint and format\n\nRun linting and formatting on the generated files:\n\n```bash\nbunx biome check --fix src/events/<Name>Event.ts tests/events/<Name>Event.spec.ts\n```\n";var Oo="---\nname: make:repository\ndescription: Generate a new repository class with its test file, then complete the generated code. Use when creating a new TypeORM repository for database operations on an entity.\n---\n\n# Make Repository Class\n\nGenerate a new repository class and its test file using the `make:repository` CLI command, then complete the generated code with proper implementation.\n\n## Steps\n\n### 1. Run the generator\n\nRun the following command to scaffold the repository class and test files:\n\n```bash\nbunx @ooneex/cli@latest make:repository --name <name> --module <module>\n```\n\nWhere `<name>` is the name provided by the user. The `--module` option is optional \u2014 if provided, files are generated under `modules/<module>/` instead of the project root. The command will generate:\n- `src/repositories/<Name>Repository.ts` - The repository class file (or `modules/<module>/src/repositories/<Name>Repository.ts` with `--module`)\n- `tests/repositories/<Name>Repository.spec.ts` - The test file (or `modules/<module>/tests/repositories/<Name>Repository.spec.ts` with `--module`)\n\n### 2. Read the generated files\n\nRead both generated files to understand the scaffolded code.\n\n### 3. Complete the repository class\n\nEdit `src/repositories/<Name>Repository.ts` to complete the implementation:\n\n- Verify the entity import path matches the actual entity location\n- Adjust the `find` method's search fields (default searches `name` with `ILike`)\n- Customize relations loading in `findOne`/`findOneBy` if needed\n\n#### Adding methods\n\nLook at the entity's fields, relations, and business context to determine if custom domain-specific methods are needed. For example:\n- A `SessionRepository` might need `revokeSession(sessionId: string)` and `revokeAllUserSessions(userId: string)`\n- A `NotificationRepository` might need `markAsRead(id: string)` and `markAllAsRead(userId: string)`\n- Entities with status fields may need methods like `archive(id: string)` or `activate(id: string)`\n\nRead related entities, services, or actions in the module to understand what operations the repository should support, then add the appropriate methods.\n\n#### Removing methods\n\nRemove scaffolded methods that don't make sense for the entity's context:\n- Remove `createMany`/`updateMany` if the entity is always managed individually (e.g., user profiles, settings)\n- Remove `delete` if the entity uses soft deletes only (use a custom `softDelete` or `archive` method instead)\n- Remove `find` if the entity is only ever accessed by ID or specific criteria (e.g., singleton config entities)\n- Remove `count` if there's no use case for counting records of this entity\n\nThe generated class structure follows this pattern:\n\n```typescript\nimport { inject } from \"@ooneex/container\";\nimport type { ITypeormDatabase } from \"@ooneex/database\";\nimport { decorator } from \"@ooneex/repository\";\nimport type { FilterResultType } from \"@ooneex/types\";\nimport type { FindManyOptions, FindOptionsWhere, Repository, SaveOptions, UpdateResult } from \"typeorm\";\nimport { ILike } from \"typeorm\";\nimport { <Name>Entity } from \"../entities/<Name>Entity\";\n\n@decorator.repository()\nexport class <Name>Repository {\n constructor(\n @inject(\"database\")\n private readonly database: ITypeormDatabase,\n ) {}\n\n public async open(): Promise<Repository<<Name>Entity>> {\n return await this.database.open(<Name>Entity);\n }\n\n public async close(): Promise<void> {\n await this.database.close();\n }\n\n public async find(\n criteria: FindManyOptions<<Name>Entity> & { page?: number; limit?: number; q?: string },\n ): Promise<FilterResultType<<Name>Entity>> {\n // ... pagination and search logic\n }\n\n public async findOne(id: string): Promise<<Name>Entity | null> { ... }\n public async findOneBy(criteria: FindOptionsWhere<<Name>Entity>): Promise<<Name>Entity | null> { ... }\n public async create(entity: <Name>Entity, options?: SaveOptions): Promise<<Name>Entity> { ... }\n public async createMany(entities: <Name>Entity[], options?: SaveOptions): Promise<<Name>Entity[]> { ... }\n public async update(entity: <Name>Entity, options?: SaveOptions): Promise<<Name>Entity> { ... }\n public async updateMany(entities: <Name>Entity[], options?: SaveOptions): Promise<<Name>Entity[]> { ... }\n public async delete(criteria: FindOptionsWhere<<Name>Entity> | FindOptionsWhere<<Name>Entity>[]): Promise<UpdateResult> { ... }\n public async count(criteria?: FindOptionsWhere<<Name>Entity> | FindOptionsWhere<<Name>Entity>[]): Promise<number> { ... }\n}\n```\n\n### 4. Complete the test file\n\nEdit `tests/repositories/<Name>Repository.spec.ts` to add meaningful tests beyond the scaffolded ones:\n\n- Keep scaffolded tests for methods that remain in the repository (remove tests for methods that were removed)\n- Add tests for any custom domain-specific methods added to the repository\n- Add tests relevant to the specific repository behavior\n\n### 5. Lint and format\n\nRun linting and formatting on the generated files:\n\n```bash\nbunx biome check --fix src/repositories/<Name>Repository.ts tests/repositories/<Name>Repository.spec.ts\n```\n";var Bo=`---
1624
+ name: make:seed
1625
+ description: Generate a new database seed file, then complete the generated code. Use when creating seed data for populating the database using @ooneex/seeds.
1626
+ ---
1627
+
1628
+ # Make Seed
1629
+
1630
+ Generate a new seed file using the \`make:seed\` CLI command, then complete the generated code with proper implementation.
1631
+
1632
+ ## Steps
1633
+
1634
+ ### 1. Run the generator
1635
+
1636
+ Run the following command to scaffold the seed file:
1637
+
1638
+ \`\`\`bash
1639
+ bunx @ooneex/cli@latest make:seed --name <name> --module <module>
1640
+ \`\`\`
1641
+
1642
+ Where \`<name>\` is the name provided by the user. The \`--module\` option is optional \u2014 if provided, the seed file is generated under \`modules/<module>/src/seeds/\` instead of \`src/seeds/\`. The command will:
1643
+ - Generate a seed file in \`src/seeds/\` (or \`modules/<module>/src/seeds/\` with \`--module\`)
1644
+ - Add a \`seed:run\` script to \`package.json\` if not already present
1645
+
1646
+ ### 2. Read the generated file
1647
+
1648
+ Read the generated seed file in \`src/seeds/\` to understand the scaffolded code.
1649
+
1650
+ ### 3. Complete the seed
1651
+
1652
+ Edit the generated seed file to implement:
1653
+
1654
+ - Import the relevant entity classes
1655
+ - Create seed data with hardcoded nanoid values for \`id\` fields (generate via \`bun -e "import { random } from '@ooneex/utils'; console.log(random.nanoid())"\`)
1656
+ - Do NOT use sequential IDs like \`"item-1"\`, \`"item-2"\`
1657
+ - Ensure the same entity uses the same ID everywhere it appears
1658
+
1659
+ ### 4. Lint and format
1660
+
1661
+ Run linting and formatting on the generated file:
1662
+
1663
+ \`\`\`bash
1664
+ bunx biome check --fix src/seeds/
1665
+ \`\`\`
1666
+ `;var Io="---\nname: make:service\ndescription: Generate a new service class with its test file, then complete the generated code. Use when creating a new business logic service that implements IService from @ooneex/service.\n---\n\n# Make Service Class\n\nGenerate a new service class and its test file using the `make:service` CLI command, then complete the generated code with proper implementation.\n\n## Steps\n\n### 1. Run the generator\n\nRun the following command to scaffold the service class and test files:\n\n```bash\nbunx @ooneex/cli@latest make:service --name <name> --module <module>\n```\n\nWhere `<name>` is the name provided by the user. The `--module` option is optional \u2014 if provided, files are generated under `modules/<module>/` instead of the project root. The command will generate:\n- `src/services/<Name>Service.ts` - The service class file (or `modules/<module>/src/services/<Name>Service.ts` with `--module`)\n- `tests/services/<Name>Service.spec.ts` - The test file (or `modules/<module>/tests/services/<Name>Service.spec.ts` with `--module`)\n\n### 2. Read the generated files\n\nRead both generated files to understand the scaffolded code.\n\n### 3. Complete the service class\n\nEdit `src/services/<Name>Service.ts` to complete the implementation:\n\n- Define a proper type for `ServiceDataType` instead of `Record<string, unknown>`\n- Implement the `execute()` method with actual business logic\n- Inject any required dependencies (repositories, other services, etc.) via the constructor\n\nThe generated class structure follows this pattern:\n\n```typescript\nimport { decorator } from \"@ooneex/service\";\nimport type { IService } from \"@ooneex/service\";\n\ntype ServiceDataType = Record<string, unknown>;\n\n@decorator.service()\nexport class <Name>Service<T extends ServiceDataType = ServiceDataType> implements IService<T> {\n public async execute(data?: T): Promise<void> {\n // TODO: Implement service logic\n }\n}\n```\n\n### 4. Complete the test file\n\nEdit `tests/services/<Name>Service.spec.ts` to add meaningful tests beyond the scaffolded ones:\n\n- Keep the existing scaffolded tests (class name, execute method)\n- Add tests relevant to the specific service behavior\n\nThe generated test structure follows this pattern:\n\n```typescript\nimport { describe, expect, test } from \"bun:test\";\nimport { <Name>Service } from \"@/services/<Name>Service\";\n\ndescribe(\"<Name>Service\", () => {\n test(\"should have class name ending with 'Service'\", () => {\n expect(<Name>Service.name.endsWith(\"Service\")).toBe(true);\n });\n\n test(\"should have 'execute' method\", () => {\n expect(<Name>Service.prototype.execute).toBeDefined();\n expect(typeof <Name>Service.prototype.execute).toBe(\"function\");\n });\n});\n```\n\n### 5. Lint and format\n\nRun linting and formatting on the generated files:\n\n```bash\nbunx biome check --fix src/services/<Name>Service.ts tests/services/<Name>Service.spec.ts\n```\n";var Lo="---\nname: make:storage\ndescription: Generate a new storage class with its test file, then complete the generated code. Use when creating a new S3-compatible storage adapter that extends Storage from @ooneex/storage.\n---\n\n# Make Storage Class\n\nGenerate a new storage class and its test file using the `make:storage` CLI command, then complete the generated code with proper implementation.\n\n## Steps\n\n### 1. Run the generator\n\nRun the following command to scaffold the storage class and test files:\n\n```bash\nbunx @ooneex/cli@latest make:storage --name <name> --module <module>\n```\n\nWhere `<name>` is the name provided by the user. The `--module` option is optional \u2014 if provided, files are generated under `modules/<module>/` instead of the project root. The command will generate:\n- `src/storage/<Name>Storage.ts` - The storage class file (or `modules/<module>/src/storage/<Name>Storage.ts` with `--module`)\n- `tests/storage/<Name>Storage.spec.ts` - The test file (or `modules/<module>/tests/storage/<Name>Storage.spec.ts` with `--module`)\n\n### 2. Read the generated files\n\nRead both generated files to understand the scaffolded code.\n\n### 3. Complete the storage class\n\nEdit `src/storage/<Name>Storage.ts` to complete the implementation:\n\n- Set the `bucket` property to the appropriate bucket name\n- Verify the environment variable names match the project configuration (`STORAGE_<NAME_UPPER>_ACCESS_KEY`, `STORAGE_<NAME_UPPER>_SECRET_KEY`, `STORAGE_<NAME_UPPER>_ENDPOINT`, `STORAGE_<NAME_UPPER>_REGION`)\n- Add any additional storage-specific methods if needed\n\nThe generated class structure follows this pattern:\n\n```typescript\nimport { Storage, decorator, StorageException } from \"@ooneex/storage\";\nimport type { S3Options } from \"bun\";\n\n@decorator.storage()\nexport class <Name>Storage extends Storage {\n protected bucket: string;\n private readonly accessKey: string;\n private readonly secretKey: string;\n private readonly endpoint: string;\n private readonly region: string;\n\n constructor(options?: {\n accessKey?: string;\n secretKey?: string;\n endpoint?: string;\n region?: string;\n }) {\n super();\n\n const accessKey = options?.accessKey || Bun.env.STORAGE_<NAME_UPPER>_ACCESS_KEY;\n const secretKey = options?.secretKey || Bun.env.STORAGE_<NAME_UPPER>_SECRET_KEY;\n const endpoint = options?.endpoint || Bun.env.STORAGE_<NAME_UPPER>_ENDPOINT;\n\n // ... validation throws StorageException if missing ...\n\n this.accessKey = accessKey;\n this.secretKey = secretKey;\n this.endpoint = endpoint;\n this.region = options?.region || Bun.env.STORAGE_<NAME_UPPER>_REGION || \"auto\";\n }\n\n public getOptions(): S3Options {\n return {\n accessKeyId: this.accessKey,\n secretAccessKey: this.secretKey,\n endpoint: this.endpoint,\n bucket: this.bucket,\n region: this.region,\n };\n }\n}\n```\n\n### 4. Complete the test file\n\nEdit `tests/storage/<Name>Storage.spec.ts` to add meaningful tests beyond the scaffolded ones:\n\n- Keep the existing scaffolded tests (class name, bucket field, getOptions method)\n- Add tests relevant to the specific storage class behavior\n\nThe generated test structure follows this pattern:\n\n```typescript\nimport { describe, expect, test } from \"bun:test\";\nimport { <Name>StorageAdapter } from \"@/storage/<Name>StorageAdapter\";\n\ndescribe(\"<Name>StorageAdapter\", () => {\n test(\"should have class name ending with 'StorageAdapter'\", () => {\n expect(<Name>StorageAdapter.name.endsWith(\"StorageAdapter\")).toBe(true);\n });\n\n test(\"should have 'bucket' field\", () => {\n expect(\"bucket\" in <Name>StorageAdapter.prototype || \"bucket\" in Object.getOwnPropertyNames(<Name>StorageAdapter.prototype)).toBe(true);\n });\n\n test(\"should have 'getOptions' method\", () => {\n expect(<Name>StorageAdapter.prototype.getOptions).toBeDefined();\n expect(typeof <Name>StorageAdapter.prototype.getOptions).toBe(\"function\");\n });\n});\n```\n\n### 5. Lint and format\n\nRun linting and formatting on the generated files:\n\n```bash\nbunx biome check --fix src/storage/<Name>Storage.ts tests/storage/<Name>Storage.spec.ts\n```\n";var Uo="---\nname: make:vector-database\ndescription: Generate a new vector database class with its test file, then complete the generated code. Use when creating a new vector database that extends VectorDatabase from @ooneex/rag.\n---\n\n# Make Vector Database Class\n\nGenerate a new vector database class and its test file using the `make:vector-database` CLI command, then complete the generated code with proper implementation.\n\n## Steps\n\n### 1. Run the generator\n\nRun the following command to scaffold the vector database class and test files:\n\n```bash\nbunx @ooneex/cli@latest make:vector-database --name <name> --module <module>\n```\n\nWhere `<name>` is the name provided by the user. The `--module` option is optional \u2014 if provided, files are generated under `modules/<module>/` instead of the project root. The command will generate:\n- `src/databases/<Name>VectorDatabase.ts` - The vector database class file (or `modules/<module>/src/databases/<Name>VectorDatabase.ts` with `--module`)\n- `tests/databases/<Name>VectorDatabase.spec.ts` - The test file (or `modules/<module>/tests/databases/<Name>VectorDatabase.spec.ts` with `--module`)\n\n### 2. Read the generated files\n\nRead both generated files to understand the scaffolded code.\n\n### 3. Complete the vector database class\n\nEdit `src/databases/<Name>VectorDatabase.ts` to complete the implementation:\n\n- Set the `getDatabaseUri()` return value to the actual LanceDB database path\n- Configure the embedding provider and model in `getEmbeddingModel()`\n- Define the custom data fields in `DataType` and map them in `getSchema()`\n- Import the appropriate Apache Arrow types for your schema fields\n\nThe generated class structure follows this pattern:\n\n```typescript\nimport { VectorDatabase, decorator } from \"@ooneex/rag\";\nimport type { EmbeddingModelType, EmbeddingProviderType, FieldValueType } from \"@ooneex/rag\";\nimport { Utf8 } from \"apache-arrow\";\n\ntype DataType = {\n name: string;\n};\n\n@decorator.vectorDatabase()\nexport class <Name>VectorDatabase extends VectorDatabase<DataType> {\n public getDatabaseUri(): string {\n return \"\";\n }\n\n public getEmbeddingModel(): { provider: EmbeddingProviderType; model: EmbeddingModelType[\"model\"] } {\n return { provider: \"openai\", model: \"text-embedding-ada-002\" };\n }\n\n public getSchema(): { [K in keyof DataType]: FieldValueType } {\n return {\n name: new Utf8(),\n };\n }\n}\n```\n\n### 4. Complete the test file\n\nEdit `tests/databases/<Name>VectorDatabase.spec.ts` to add meaningful tests beyond the scaffolded ones:\n\n- Keep the existing scaffolded tests (class name, getDatabaseUri, getEmbeddingModel, getSchema methods)\n- Add tests relevant to the specific vector database class behavior\n\nThe generated test structure follows this pattern:\n\n```typescript\nimport { describe, expect, test } from \"bun:test\";\nimport { <Name>VectorDatabase } from \"@/databases/<Name>VectorDatabase\";\n\ndescribe(\"<Name>VectorDatabase\", () => {\n test(\"should have class name ending with 'VectorDatabase'\", () => {\n expect(<Name>VectorDatabase.name.endsWith(\"VectorDatabase\")).toBe(true);\n });\n\n test(\"should have 'getDatabaseUri' method\", () => {\n expect(<Name>VectorDatabase.prototype.getDatabaseUri).toBeDefined();\n expect(typeof <Name>VectorDatabase.prototype.getDatabaseUri).toBe(\"function\");\n });\n\n test(\"should have 'getEmbeddingModel' method\", () => {\n expect(<Name>VectorDatabase.prototype.getEmbeddingModel).toBeDefined();\n expect(typeof <Name>VectorDatabase.prototype.getEmbeddingModel).toBe(\"function\");\n });\n\n test(\"should have 'getSchema' method\", () => {\n expect(<Name>VectorDatabase.prototype.getSchema).toBeDefined();\n expect(typeof <Name>VectorDatabase.prototype.getSchema).toBe(\"function\");\n });\n});\n```\n\n### 5. Lint and format\n\nRun linting and formatting on the generated files:\n\n```bash\nbunx biome check --fix src/databases/<Name>VectorDatabase.ts tests/databases/<Name>VectorDatabase.spec.ts\n```\n";var Ed={"make.ai":wo,"make.analytics":Eo,"make.cache":Ao,"make.controller":No,"make.cron":vo,"make.database":To,"make.entity":So,"make.logger":Mo,"make.mailer":Ro,"make.middleware":Co,"make.migration":_o,"make.permission":Do,"make.pubsub":Po,"make.repository":Oo,"make.seed":Bo,"make.service":Io,"make.storage":Lo,"make.vector-database":Uo};class Ue{getName(){return"make:claude:skill"}getDescription(){return"Generate Claude skills from templates"}async run(){let e=Le(".claude","skills"),t=Le(process.cwd(),e),s=new wd;for(let[r,o]of Object.entries(Ed)){let a=r.replace(/\./g,"-"),i=Le(t,a,"SKILL.md");await Bun.write(i,o),s.success(`${Le(e,a,"SKILL.md")} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}}Ue=y([b.command()],Ue);import{basename as Ud,join as O}from"path";import{TerminalLogger as Gd}from"@ooneex/logger";import{toKebabCase as $d,toPascalCase as _t,trim as Wd}from"@ooneex/utils";var Go=te(ie(),1),Ge=async(e)=>{return(await Go.prompt({type:"confirm",name:"confirm",message:e.message})).confirm};var we=["GET","POST","PUT","DELETE","PATCH","OPTIONS","HEAD"];var $o=te(ie(),1);import{Assert as Ad,Validation as Nd}from"@ooneex/validation";class Mt extends Nd{getConstraint(){return Ad("string >= 3")}getErrorMessage(){return`Route method must be one of: ${we.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 o=r.toUpperCase();if(!we.includes(o))return{isValid:!1,message:this.getErrorMessage()||"Invalid route method"};return{isValid:!0}}}var Wo=async(e)=>{return(await $o.prompt({type:"select",name:"method",message:e.message,initial:e.initial??0,choices:we.map((s)=>s),validate:(s)=>{let o=new Mt().validate(s);if(!o.isValid)return o.message||"Route method is invalid";return!0}})).method};var qo=te(ie(),1);import{Assert as vd,Validation as Td}from"@ooneex/validation";var Sd=/^[a-zA-Z0-9]+\.[a-zA-Z0-9]+\.[a-zA-Z0-9]+$/;class Rt extends Td{getConstraint(){return vd("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(!Sd.test(r))return{isValid:!1,message:this.getErrorMessage()||"Invalid route name format"};let o=r.split(".");if(o.length!==3)return{isValid:!1,message:this.getErrorMessage()||"Invalid route name format"};let[a,i,n]=o;if(!a||!i||!n)return{isValid:!1,message:this.getErrorMessage()||"Invalid route name format"};return{isValid:!0}}}var ko=async(e)=>{return(await qo.prompt({type:"input",name:"routeName",message:e.message,validate:(s)=>{let o=new Rt().validate(s);if(!o.isValid)return o.message||"Route name is invalid";return!0}})).routeName};var Ko=te(ie(),1);import{Assert as Md,Validation as Rd}from"@ooneex/validation";var Cd=1,_d=/^\/[\w\-/:]*$/,Dd=/^[a-zA-Z0-9\-_]+$/,Pd=/^:[a-zA-Z][a-zA-Z0-9]*$/;class Ct extends Rd{getConstraint(){return Md(`string >= ${Cd}`)}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(!_d.test(r))return{isValid:!1,message:this.getErrorMessage()||"Invalid route path format"};if(r==="/")return{isValid:!0};let o=r.slice(1).split("/");for(let a of o){if(!a)return{isValid:!1,message:"Route path cannot contain empty segments (double slashes)"};if(a.startsWith(":")){if(!Pd.test(a))return{isValid:!1,message:`Invalid parameter segment '${a}'. Parameters must follow format ':paramName' with alphanumeric characters only`}}else if(!Dd.test(a))return{isValid:!1,message:`Invalid path segment '${a}'. Segments must contain only letters, numbers, hyphens, and underscores`}}return{isValid:!0}}}var Ho=async(e)=>{return(await Ko.prompt({type:"input",name:"path",message:e.message,initial:e.initial??"/",validate:(s)=>{let o=new Ct().validate(s);if(!o.isValid)return o.message||"Route path is invalid";return!0}})).path};var Vo=`import type { ContextType } from "@ooneex/socket";
1131
1667
  import { ERole } from "@ooneex/role";
1132
1668
  import { Route } from "@ooneex/routing";
1133
1669
  import { Assert } from "@ooneex/validation";
@@ -1160,7 +1696,7 @@ export class {{NAME}}Controller {
1160
1696
  });
1161
1697
  }
1162
1698
  }
1163
- `;var wi=`import { describe, expect, test } from "bun:test";
1699
+ `;var Yo=`import { describe, expect, test } from "bun:test";
1164
1700
  import { {{NAME}}Controller } from "@/controllers/{{NAME}}Controller";
1165
1701
 
1166
1702
  describe("{{NAME}}Controller", () => {
@@ -1173,7 +1709,7 @@ describe("{{NAME}}Controller", () => {
1173
1709
  expect(typeof {{NAME}}Controller.prototype.index).toBe("function");
1174
1710
  });
1175
1711
  });
1176
- `;var xi=`import type { ContextType } from "@ooneex/controller";
1712
+ `;var Fo=`import type { ContextType } from "@ooneex/controller";
1177
1713
  import { ERole } from "@ooneex/role";
1178
1714
  import { Route } from "@ooneex/routing";
1179
1715
  import { Assert } from "@ooneex/validation";
@@ -1206,7 +1742,7 @@ export class {{NAME}}Controller {
1206
1742
  });
1207
1743
  }
1208
1744
  }
1209
- `;var Si=`export type {{TYPE_NAME}}RouteType = {
1745
+ `;var jo=`export type {{TYPE_NAME}}RouteType = {
1210
1746
  params: {
1211
1747
 
1212
1748
  },
@@ -1220,9 +1756,9 @@ export class {{NAME}}Controller {
1220
1756
 
1221
1757
  },
1222
1758
  };
1223
- `;class Ge{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}";
1224
- `,o=s.lastIndexOf("import "),n=s.indexOf(`
1225
- `,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(),c=l?`${l}, ${r}`:r;s=s.replace(a,`$1${c}`)}await Bun.write(e,s)}async run(e){let{name:t,isSocket:s}=e;if(!t)t=await w({message:"Enter controller name"});if(s===void 0)s=await $e({message:"Is this a socket controller?"});t=Rt(t).replace(/Controller$/,"");let{route:r={}}=e,o=(s?bi:xi).replaceAll("{{NAME}}",t),n="",a="";if(!r.name)r.name=await gi({message:"Enter route name (e.g., api.user.create)"});if(n=Rt(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 Ai({message:"Enter route path",initial:"/"});let p=`/${zp(Zp(r.path,"/"))}`;if(o=o.replaceAll("{{ROUTE_PATH}}",p),!s&&!r.method)r.method=await fi({message:"Enter route method"});if(!s&&r.method)o=o.replaceAll("{{ROUTE_METHOD}}",r.method.toLowerCase());let l=O("src","controllers"),c=O(process.cwd(),l),d=O(c,`${t}Controller.ts`);await Bun.write(d,o);let h=O("src","types","routes"),m=O(process.cwd(),h),u=O(m,`${a}.ts`),y=Si.replaceAll("{{TYPE_NAME}}",n);await Bun.write(u,y);let S=wi.replace(/{{NAME}}/g,t),f=O("tests","controllers"),b=O(process.cwd(),f),x=O(b,`${t}Controller.spec.ts`);await Bun.write(x,S);let N=Rt(Fp(process.cwd())),T=O(process.cwd(),"src",`${N}Module.ts`);if(await Bun.file(T).exists())await this.addToModule(T,t);let v=new Qp;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})}}Ge=g([E.command()],Ge);import{basename as jp,join as U}from"path";import{TerminalLogger as kp}from"@ooneex/logger";import{toPascalCase as Ti}from"@ooneex/utils";var Ni=`import { describe, expect, test } from "bun:test";
1759
+ `;class $e{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`,o=`import { ${r} } from "./controllers/${r}";
1760
+ `,a=s.lastIndexOf("import "),i=s.indexOf(`
1761
+ `,a);s=`${s.slice(0,i+1)}${o}${s.slice(i+1)}`;let n=/(controllers:\s*\[)([^\]]*)/s,l=s.match(n);if(l){let d=l[2]?.trim(),u=d?`${d}, ${r}`:r;s=s.replace(n,`$1${u}`)}await Bun.write(e,s)}async run(e){let{name:t,module:s,isSocket:r}=e;if(!t)t=await N({message:"Enter controller name"});if(r===void 0)r=await Ge({message:"Is this a socket controller?"});t=_t(t).replace(/Controller$/,"");let{route:o={}}=e,i=(r?Vo:Fo).replaceAll("{{NAME}}",t),n="",l="";if(!o.name)o.name=await ko({message:"Enter route name (e.g., api.user.create)"});if(n=_t(o.name),l=o.name,i=i.replaceAll("{{ROUTE_NAME}}",o.name).replaceAll("{{TYPE_NAME}}",n).replaceAll("{{TYPE_NAME_FILE}}",l),!o.path)o.path=await Ho({message:"Enter route path",initial:"/"});let d=`/${$d(Wd(o.path,"/"))}`;if(i=i.replaceAll("{{ROUTE_PATH}}",d),!r&&!o.method)o.method=await Wo({message:"Enter route method"});if(!r&&o.method)i=i.replaceAll("{{ROUTE_METHOD}}",o.method.toLowerCase());let u=s?O("modules",s):".",c=O(u,"src","controllers"),p=O(process.cwd(),c),m=O(p,`${t}Controller.ts`);await Bun.write(m,i);let h=O(u,"src","types","routes"),f=O(process.cwd(),h),w=O(f,`${l}.ts`),g=jo.replaceAll("{{TYPE_NAME}}",n);await Bun.write(w,g);let E=Yo.replace(/{{NAME}}/g,t),A=O(u,"tests","controllers"),v=O(process.cwd(),A),S=O(v,`${t}Controller.spec.ts`);await Bun.write(S,E);let _=_t(Ud(process.cwd())),Ee=O(process.cwd(),"src",`${_}Module.ts`);if(await Bun.file(Ee).exists())await this.addToModule(Ee,t);let ee=new Gd;ee.success(`${O(c,t)}Controller.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),ee.success(`${O(h,l)}.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),ee.success(`${O(A,t)}Controller.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}$e=y([b.command()],$e);import{basename as Kd,join as G}from"path";import{TerminalLogger as Hd}from"@ooneex/logger";import{toPascalCase as Qo}from"@ooneex/utils";var zo=`import { describe, expect, test } from "bun:test";
1226
1762
  import { {{NAME}}Cron } from "@/cron/{{NAME}}Cron";
1227
1763
 
1228
1764
  describe("{{NAME}}Cron", () => {
@@ -1245,7 +1781,7 @@ describe("{{NAME}}Cron", () => {
1245
1781
  expect(typeof {{NAME}}Cron.prototype.handler).toBe("function");
1246
1782
  });
1247
1783
  });
1248
- `;var Mi=`import type { TimeZoneType } from "@ooneex/country";
1784
+ `;var Zo=`import type { TimeZoneType } from "@ooneex/country";
1249
1785
  import type { CronTimeType } from "@ooneex/cron";
1250
1786
  import { Cron, decorator } from "@ooneex/cron";
1251
1787
 
@@ -1266,9 +1802,9 @@ export class {{NAME}}Cron extends Cron {
1266
1802
  // console.log("{{NAME}}Cron handler executed");
1267
1803
  }
1268
1804
  }
1269
- `;class Ue{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}";
1270
- `,o=s.lastIndexOf("import "),n=s.indexOf(`
1271
- `,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(),c=l?`${l}, ${r}`:r;s=s.replace(a,`$1${c}`)}await Bun.write(e,s)}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter cron name"});t=Ti(t).replace(/Cron$/,"");let s=Mi.replace(/{{NAME}}/g,t),r=U("src","cron"),i=U(process.cwd(),r),o=U(i,`${t}Cron.ts`);await Bun.write(o,s);let n=Ni.replace(/{{NAME}}/g,t),a=U("tests","cron"),p=U(process.cwd(),a),l=U(p,`${t}Cron.spec.ts`);await Bun.write(l,n);let c=Ti(jp(process.cwd())),d=U(process.cwd(),"src",`${c}Module.ts`);if(await Bun.file(d).exists())await this.addToModule(d,t);let h=new kp;h.success(`${U(r,t)}Cron.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),h.success(`${U(a,t)}Cron.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ue=g([E.command()],Ue);import{join as k}from"path";import{TerminalLogger as sl}from"@ooneex/logger";import{toPascalCase as rl}from"@ooneex/utils";var _i=`import { describe, expect, test } from "bun:test";
1805
+ `;class We{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`,o=`import { ${r} } from "./cron/${r}";
1806
+ `,a=s.lastIndexOf("import "),i=s.indexOf(`
1807
+ `,a);s=`${s.slice(0,i+1)}${o}${s.slice(i+1)}`;let n=/(cronJobs:\s*\[)([^\]]*)/s,l=s.match(n);if(l){let d=l[2]?.trim(),u=d?`${d}, ${r}`:r;s=s.replace(n,`$1${u}`)}await Bun.write(e,s)}async run(e){let{name:t,module:s}=e;if(!t)t=await N({message:"Enter cron name"});t=Qo(t).replace(/Cron$/,"");let r=Zo.replace(/{{NAME}}/g,t),o=s?G("modules",s):".",a=G(o,"src","cron"),i=G(process.cwd(),a),n=G(i,`${t}Cron.ts`);await Bun.write(n,r);let l=zo.replace(/{{NAME}}/g,t),d=G(o,"tests","cron"),u=G(process.cwd(),d),c=G(u,`${t}Cron.spec.ts`);await Bun.write(c,l);let p=Qo(Kd(process.cwd())),m=G(process.cwd(),"src",`${p}Module.ts`);if(await Bun.file(m).exists())await this.addToModule(m,t);let h=new Hd;h.success(`${G(a,t)}Cron.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),h.success(`${G(d,t)}Cron.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}We=y([b.command()],We);import{join as F}from"path";import{TerminalLogger as Fd}from"@ooneex/logger";import{toPascalCase as jd}from"@ooneex/utils";var Xo=`import { describe, expect, test } from "bun:test";
1272
1808
  import { {{NAME}}Database } from "@/databases/{{NAME}}Database";
1273
1809
 
1274
1810
  describe("{{NAME}}Database", () => {
@@ -1281,7 +1817,7 @@ describe("{{NAME}}Database", () => {
1281
1817
  expect(typeof {{NAME}}Database.prototype.getSource).toBe("function");
1282
1818
  });
1283
1819
  });
1284
- `;var vi=`import { DataSource } from "typeorm";
1820
+ `;var Jo=`import { DataSource } from "typeorm";
1285
1821
  import { TypeormDatabase, DatabaseException, decorator } from "@ooneex/database";
1286
1822
 
1287
1823
  @decorator.database()
@@ -1304,7 +1840,7 @@ export class {{NAME}}Database extends TypeormDatabase {
1304
1840
  return this.source;
1305
1841
  }
1306
1842
  }
1307
- `;class qe{getName(){return"make:database"}getDescription(){return"Generate a new database class"}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter database name"});t=rl(t).replace(/DatabaseAdapter$/,"").replace(/Database$/,"");let s=vi.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=_i.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 c=new sl;c.success(`${k(r,t)}Database.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),c.success(`${k(a,t)}Database.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}qe=g([E.command()],qe);import{join as ji}from"path";import{TerminalLogger as Sl}from"@ooneex/logger";var{YAML:ki}=globalThis.Bun;var Ci=Y(Z(),1),Ri=["clickhouse","elasticsearch","grafana","jaeger","keycloak","libretranslate","maildev","memcached","minio","mongodb","mysql","nats","postgres","prometheus","rabbitmq","redis","temporal","vault"],Di=async(e)=>{return(await Ci.prompt({type:"autocomplete",name:"service",message:e.message,initial:e.initial,choices:Ri.map((s)=>s),validate:(s)=>{if(!Ri.includes(s))return"Docker service is invalid";return!0}})).service};var Bi=`services:
1843
+ `;class qe{getName(){return"make:database"}getDescription(){return"Generate a new database class"}async run(e){let{name:t,module:s}=e;if(!t)t=await N({message:"Enter database name"});t=jd(t).replace(/DatabaseAdapter$/,"").replace(/Database$/,"");let r=Jo.replace(/{{NAME}}/g,t),o=s?F("modules",s):".",a=F(o,"src","databases"),i=F(process.cwd(),a),n=F(i,`${t}Database.ts`);await Bun.write(n,r);let l=Xo.replace(/{{NAME}}/g,t),d=F(o,"tests","databases"),u=F(process.cwd(),d),c=F(u,`${t}Database.spec.ts`);await Bun.write(c,l);let p=new Fd;p.success(`${F(a,t)}Database.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${F(d,t)}Database.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}qe=y([b.command()],qe);import{join as Na}from"path";import{TerminalLogger as hm}from"@ooneex/logger";var{YAML:va}=globalThis.Bun;var ta=te(ie(),1),ea=["clickhouse","elasticsearch","grafana","jaeger","keycloak","libretranslate","maildev","memcached","minio","mongodb","mysql","nats","postgres","prometheus","rabbitmq","redis","temporal","vault"],sa=async(e)=>{return(await ta.prompt({type:"autocomplete",name:"service",message:e.message,initial:e.initial,choices:ea.map((s)=>s),validate:(s)=>{if(!ea.includes(s))return"Docker service is invalid";return!0}})).service};var ra=`services:
1308
1844
  # ClickHouse - Column-oriented OLAP database for analytics
1309
1845
  # Docs: https://clickhouse.com/docs
1310
1846
  # HTTP API: http://localhost:8123
@@ -1325,7 +1861,7 @@ export class {{NAME}}Database extends TypeormDatabase {
1325
1861
 
1326
1862
  volumes:
1327
1863
  clickhouse_data:
1328
- `;var Oi=`services:
1864
+ `;var oa=`services:
1329
1865
  # Elasticsearch - Full-text search and analytics engine
1330
1866
  # Docs: https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
1331
1867
  # HTTP API: http://localhost:9200
@@ -1346,7 +1882,7 @@ volumes:
1346
1882
 
1347
1883
  volumes:
1348
1884
  elasticsearch_data:
1349
- `;var Pi=`services:
1885
+ `;var aa=`services:
1350
1886
  # Grafana - Metrics visualization and dashboards
1351
1887
  # Docs: https://grafana.com/docs/grafana/latest/
1352
1888
  # Web UI: http://localhost:3000 (ooneex/ooneex)
@@ -1364,7 +1900,7 @@ volumes:
1364
1900
 
1365
1901
  volumes:
1366
1902
  grafana_data:
1367
- `;var Ii=`services:
1903
+ `;var ia=`services:
1368
1904
  # Jaeger - Distributed tracing system
1369
1905
  # Docs: https://www.jaegertracing.io/docs/
1370
1906
  # Web UI: http://localhost:16686
@@ -1378,7 +1914,7 @@ volumes:
1378
1914
  - "16686:16686"
1379
1915
  - "6831:6831/udp"
1380
1916
  - "14268:14268"
1381
- `;var Li=`services:
1917
+ `;var na=`services:
1382
1918
  # Keycloak - Identity and access management
1383
1919
  # Docs: https://www.keycloak.org/documentation
1384
1920
  # Admin Console: http://localhost:8080 (ooneex/ooneex)
@@ -1392,7 +1928,7 @@ volumes:
1392
1928
  - KEYCLOAK_ADMIN=ooneex
1393
1929
  - KEYCLOAK_ADMIN_PASSWORD=ooneex
1394
1930
  command: start-dev
1395
- `;var $i=`services:
1931
+ `;var la=`services:
1396
1932
  # LibreTranslate - Self-hosted machine translation API
1397
1933
  # Docs: https://libretranslate.com/docs/
1398
1934
  # API: http://localhost:4000
@@ -1419,7 +1955,7 @@ volumes:
1419
1955
 
1420
1956
  volumes:
1421
1957
  libretranslate_models:
1422
- `;var Gi=`services:
1958
+ `;var da=`services:
1423
1959
  # MailDev - Email testing tool with web UI
1424
1960
  # Docs: https://github.com/maildev/maildev
1425
1961
  # Web UI: http://localhost:1080
@@ -1430,7 +1966,7 @@ volumes:
1430
1966
  ports:
1431
1967
  - "1080:1080"
1432
1968
  - "1025:1025"
1433
- `;var Ui=`services:
1969
+ `;var ma=`services:
1434
1970
  # Memcached - Distributed memory caching system
1435
1971
  # Docs: https://memcached.org/
1436
1972
  # Connection: localhost:11211
@@ -1440,7 +1976,7 @@ volumes:
1440
1976
  restart: "on-failure"
1441
1977
  ports:
1442
1978
  - "11211:11211"
1443
- `;var qi=`services:
1979
+ `;var ca=`services:
1444
1980
  # MinIO - S3-compatible object storage
1445
1981
  # Docs: https://min.io/docs/minio/container/index.html
1446
1982
  # API: http://localhost:9000
@@ -1461,7 +1997,7 @@ volumes:
1461
1997
 
1462
1998
  volumes:
1463
1999
  minio_data:
1464
- `;var Ki=`services:
2000
+ `;var pa=`services:
1465
2001
  # MongoDB - NoSQL document database
1466
2002
  # Docs: https://www.mongodb.com/docs/
1467
2003
  # Connection: mongodb://ooneex:ooneex@localhost:27017/ooneex
@@ -1480,7 +2016,7 @@ volumes:
1480
2016
 
1481
2017
  volumes:
1482
2018
  mongodb_data:
1483
- `;var Hi=`services:
2019
+ `;var ua=`services:
1484
2020
  # MySQL - Alternative relational database
1485
2021
  # Docs: https://dev.mysql.com/doc/
1486
2022
  # Connection: mysql://ooneex:ooneex@localhost:3306/ooneex
@@ -1500,7 +2036,7 @@ volumes:
1500
2036
 
1501
2037
  volumes:
1502
2038
  mysql_db:
1503
- `;var Wi=`services:
2039
+ `;var ha=`services:
1504
2040
  # NATS - High-performance messaging system with JetStream
1505
2041
  # Docs: https://docs.nats.io/
1506
2042
  # Client: localhost:4222
@@ -1513,7 +2049,7 @@ volumes:
1513
2049
  - "4222:4222"
1514
2050
  - "8222:8222"
1515
2051
  command: "--jetstream --http_port 8222"
1516
- `;var Yi=`services:
2052
+ `;var fa=`services:
1517
2053
  # Jade - FastAPI REST API to fetch YouTube metadata and download videos or audio via Dockerized microservice.
1518
2054
  # API: http://localhost:8000
1519
2055
  # Docs: http://localhost:8000/docs
@@ -1531,7 +2067,7 @@ volumes:
1531
2067
 
1532
2068
  volumes:
1533
2069
  jade_data:
1534
- `;var Vi=`services:
2070
+ `;var ga=`services:
1535
2071
  # PostgreSQL - Primary relational database
1536
2072
  # Docs: https://www.postgresql.org/docs/
1537
2073
  # Connection: postgresql://ooneex:ooneex@localhost:5432/ooneex
@@ -1552,7 +2088,7 @@ volumes:
1552
2088
 
1553
2089
  volumes:
1554
2090
  postgres_db:
1555
- `;var Fi=`services:
2091
+ `;var ya=`services:
1556
2092
  # Prometheus - Metrics collection and monitoring
1557
2093
  # Docs: https://prometheus.io/docs/
1558
2094
  # Web UI: http://localhost:9090
@@ -1567,7 +2103,7 @@ volumes:
1567
2103
 
1568
2104
  volumes:
1569
2105
  prometheus_data:
1570
- `;var Qi=`services:
2106
+ `;var ba=`services:
1571
2107
  # RabbitMQ - Message broker for async processing
1572
2108
  # Docs: https://www.rabbitmq.com/docs
1573
2109
  # AMQP: amqp://ooneex:ooneex@localhost:5672/ooneex
@@ -1589,7 +2125,7 @@ volumes:
1589
2125
 
1590
2126
  volumes:
1591
2127
  rabbitmq_data:
1592
- `;var zi=`services:
2128
+ `;var xa=`services:
1593
2129
  # Redis - In-memory data store for caching and sessions
1594
2130
  # Docs: https://redis.io/docs/
1595
2131
  # Connection: redis://localhost:6379
@@ -1604,7 +2140,7 @@ volumes:
1604
2140
 
1605
2141
  volumes:
1606
2142
  redis_data:
1607
- `;var Zi=`services:
2143
+ `;var wa=`services:
1608
2144
  # Temporal - Workflow orchestration engine
1609
2145
  # Docs: https://docs.temporal.io/
1610
2146
  # gRPC: localhost:7233
@@ -1621,7 +2157,7 @@ volumes:
1621
2157
  - POSTGRES_USER=ooneex
1622
2158
  - POSTGRES_PWD=ooneex
1623
2159
  - POSTGRES_SEEDS=postgres
1624
- `;var Xi=`services:
2160
+ `;var Ea=`services:
1625
2161
  # Vault - Secrets management and encryption
1626
2162
  # Docs: https://developer.hashicorp.com/vault/docs
1627
2163
  # Web UI: http://localhost:8200 (token: ooneex)
@@ -1636,20 +2172,20 @@ volumes:
1636
2172
  - VAULT_DEV_LISTEN_ADDRESS=0.0.0.0:8200
1637
2173
  cap_add:
1638
2174
  - IPC_LOCK
1639
- `;var Ji={clickhouse:Bi,elasticsearch:Oi,grafana:Pi,"ooneex-jade":Yi,jaeger:Ii,keycloak:Li,libretranslate:$i,maildev:Gi,memcached:Ui,minio:qi,mongodb:Ki,mysql:Hi,nats:Wi,postgres:Vi,prometheus:Fi,rabbitmq:Qi,redis:zi,temporal:Zi,vault:Xi};function Nl(e){let t=e.split(`
1640
- `),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(`
1641
- `)}function Ml(e){let t=ki.parse(e);return t.volumes?Object.keys(t.volumes):[]}class Ke{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 Di({message:"Select docker service"});let s=Ji[t],r=ji(process.cwd(),"docker-compose.yml"),i=new Sl,o=Bun.file(r);if(await o.exists()){let p=await o.text(),l=ki.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 c=Nl(s),d=Ml(s),h=p,m=h.indexOf(`
1642
- volumes:`),u=h.indexOf(`
1643
- networks:`),y=-1;if(m!==-1&&u!==-1)y=Math.min(m,u);else if(m!==-1)y=m;else if(u!==-1)y=u;if(y!==-1)h=`${h.slice(0,y)}
1644
- ${c}${h.slice(y)}`;else h=`${h.trimEnd()}
1645
- ${c}`;for(let S of d)if(!h.includes(` ${S}:`))if(h.includes(`
1646
- volumes:`)){let f=h.indexOf(`
1647
- volumes:`),b=h.slice(f+9);h=`${h.slice(0,f+9)}
1648
- ${S}:${b}`}else h=`${h.trimEnd()}
2175
+ `;var Aa={clickhouse:ra,elasticsearch:oa,grafana:aa,"ooneex-jade":fa,jaeger:ia,keycloak:na,libretranslate:la,maildev:da,memcached:ma,minio:ca,mongodb:pa,mysql:ua,nats:ha,postgres:ga,prometheus:ya,rabbitmq:ba,redis:xa,temporal:wa,vault:Ea};function fm(e){let t=e.split(`
2176
+ `),s=[],r=!1;for(let o of t){if(o.startsWith("services:")){r=!0;continue}if(r){if(o.startsWith("volumes:")||o.startsWith("networks:"))break;s.push(o)}}return s.join(`
2177
+ `)}function gm(e){let t=va.parse(e);return t.volumes?Object.keys(t.volumes):[]}class ke{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 sa({message:"Select docker service"});let s=Aa[t],r=Na(process.cwd(),"docker-compose.yml"),o=new hm,a=Bun.file(r);if(await a.exists()){let l=await a.text(),d=va.parse(l);if(d.services&&t in d.services){o.warn(`Service "${t}" already exists in docker-compose.yml`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0});return}let u=fm(s),c=gm(s),p=l,m=p.indexOf(`
2178
+ volumes:`),h=p.indexOf(`
2179
+ networks:`),f=-1;if(m!==-1&&h!==-1)f=Math.min(m,h);else if(m!==-1)f=m;else if(h!==-1)f=h;if(f!==-1)p=`${p.slice(0,f)}
2180
+ ${u}${p.slice(f)}`;else p=`${p.trimEnd()}
2181
+ ${u}`;for(let w of c)if(!p.includes(` ${w}:`))if(p.includes(`
2182
+ volumes:`)){let g=p.indexOf(`
2183
+ volumes:`),E=p.slice(g+9);p=`${p.slice(0,g+9)}
2184
+ ${w}:${E}`}else p=`${p.trimEnd()}
1649
2185
 
1650
2186
  volumes:
1651
- ${S}:
1652
- `;await Bun.write(r,h)}else await Bun.write(r,s);let n=ji(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})}}Ke=g([E.command()],Ke);var io=Y(eo(),1);import{basename as vl,join as q}from"path";import{TerminalLogger as Rl}from"@ooneex/logger";import{toPascalCase as ro,toSnakeCase as Cl}from"@ooneex/utils";var to=`import { describe, expect, test } from "bun:test";
2187
+ ${w}:
2188
+ `;await Bun.write(r,p)}else await Bun.write(r,s);let i=Na(process.cwd(),"package.json"),n=Bun.file(i);if(await n.exists()){let l=await n.json();l.scripts=l.scripts||{},l.scripts.docker="docker compose up -d",await Bun.write(i,JSON.stringify(l,null,2))}o.success(`Service "${t}" added to docker-compose.yml`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),o.info("Run 'bun run docker' to start docker containers",void 0,{showTimestamp:!1,showArrow:!0,showLevel:!1})}}ke=y([b.command()],ke);var Ca=te(Ta(),1);import{basename as xm,join as $}from"path";import{TerminalLogger as wm}from"@ooneex/logger";import{toPascalCase as Ra,toSnakeCase as Em}from"@ooneex/utils";var Sa=`import { describe, expect, test } from "bun:test";
1653
2189
  import { {{NAME}}Entity } from "@/entities/{{NAME}}Entity";
1654
2190
 
1655
2191
  describe("{{NAME}}Entity", () => {
@@ -1714,7 +2250,7 @@ describe("{{NAME}}Entity", () => {
1714
2250
  expect("deletedAt" in entity).toBe(true);
1715
2251
  });
1716
2252
  });
1717
- `;var so=`import type { LocaleType } from "@ooneex/translation";
2253
+ `;var Ma=`import type { LocaleType } from "@ooneex/translation";
1718
2254
  import { random } from "@ooneex/utils";
1719
2255
  import { Column, CreateDateColumn, DeleteDateColumn, PrimaryColumn, UpdateDateColumn } from "typeorm";
1720
2256
 
@@ -1765,9 +2301,9 @@ export class {{NAME}}Entity extends BaseEntity {
1765
2301
  @DeleteDateColumn({ name: "deleted_at" })
1766
2302
  deletedAt?: Date;
1767
2303
  }
1768
- `;class He{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}";
1769
- `,o=s.lastIndexOf("import "),n=s.indexOf(`
1770
- `,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(),c=l?`${l}, ${r}`:r;s=s.replace(a,`$1${c}`)}await Bun.write(e,s)}async run(e){let{name:t,tableName:s}=e;if(!t)t=await w({message:"Enter entity name"});if(t=ro(t).replace(/Entity$/,""),!s)s=Cl(io.default(t));let r=so.replace(/{{NAME}}/g,t).replace(/{{TABLE_NAME}}/g,s),i=q("src","entities"),o=q(process.cwd(),i),n=q(o,`${t}Entity.ts`);await Bun.write(n,r);let a=to.replace(/{{NAME}}/g,t),p=q("tests","entities"),l=q(process.cwd(),p),c=q(l,`${t}Entity.spec.ts`);await Bun.write(c,a);let d=ro(vl(process.cwd())),h=q(process.cwd(),"src",`${d}Module.ts`);if(await Bun.file(h).exists())await this.addToModule(h,t);let m=new Rl;m.success(`${q(i,t)}Entity.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),m.success(`${q(p,t)}Entity.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}He=g([E.command()],He);import{join as ee}from"path";import{TerminalLogger as Ol}from"@ooneex/logger";import{toPascalCase as Pl}from"@ooneex/utils";var oo=`import { describe, expect, test } from "bun:test";
2304
+ `;class Ke{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`,o=`import { ${r} } from "./entities/${r}";
2305
+ `,a=s.lastIndexOf("import "),i=s.indexOf(`
2306
+ `,a);s=`${s.slice(0,i+1)}${o}${s.slice(i+1)}`;let n=/(entities:\s*\[)([^\]]*)/s,l=s.match(n);if(l){let d=l[2]?.trim(),u=d?`${d}, ${r}`:r;s=s.replace(n,`$1${u}`)}await Bun.write(e,s)}async run(e){let{name:t,module:s,tableName:r}=e;if(!t)t=await N({message:"Enter entity name"});if(t=Ra(t).replace(/Entity$/,""),!r)r=Em(Ca.default(t));let o=Ma.replace(/{{NAME}}/g,t).replace(/{{TABLE_NAME}}/g,r),a=s?$("modules",s):".",i=$(a,"src","entities"),n=$(process.cwd(),i),l=$(n,`${t}Entity.ts`);await Bun.write(l,o);let d=Sa.replace(/{{NAME}}/g,t),u=$(a,"tests","entities"),c=$(process.cwd(),u),p=$(c,`${t}Entity.spec.ts`);await Bun.write(p,d);let m=Ra(xm(process.cwd())),h=$(process.cwd(),"src",`${m}Module.ts`);if(await Bun.file(h).exists())await this.addToModule(h,t);let f=new wm;f.success(`${$(i,t)}Entity.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),f.success(`${$(u,t)}Entity.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ke=y([b.command()],Ke);import{join as j}from"path";import{TerminalLogger as vm}from"@ooneex/logger";import{toPascalCase as Tm}from"@ooneex/utils";var _a=`import { describe, expect, test } from "bun:test";
1771
2307
  import { {{NAME}}Logger } from "@/loggers/{{NAME}}Logger";
1772
2308
 
1773
2309
  describe("{{NAME}}Logger", () => {
@@ -1810,7 +2346,7 @@ describe("{{NAME}}Logger", () => {
1810
2346
  expect(typeof {{NAME}}Logger.prototype.error).toBe("function");
1811
2347
  });
1812
2348
  });
1813
- `;var no=`import type { IException } from "@ooneex/exception";
2349
+ `;var Da=`import type { IException } from "@ooneex/exception";
1814
2350
  import type { ILogger } from "@ooneex/logger";
1815
2351
  import type { ScalarType } from "@ooneex/types";
1816
2352
  import { decorator } from "@ooneex/logger";
@@ -1845,7 +2381,7 @@ export class {{NAME}}Logger implements ILogger {
1845
2381
  // Handle error logging
1846
2382
  }
1847
2383
  }
1848
- `;class We{getName(){return"make:logger"}getDescription(){return"Generate a new logger class"}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter logger name"});t=Pl(t).replace(/Logger$/,"");let s=no.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=oo.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 c=new Ol;c.success(`${ee(r,t)}Logger.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),c.success(`${ee(a,t)}Logger.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}We=g([E.command()],We);import{join as I}from"path";import{TerminalLogger as Ul}from"@ooneex/logger";import{toPascalCase as ql}from"@ooneex/utils";var ao=`import { describe, expect, test } from "bun:test";
2384
+ `;class He{getName(){return"make:logger"}getDescription(){return"Generate a new logger class"}async run(e){let{name:t,module:s}=e;if(!t)t=await N({message:"Enter logger name"});t=Tm(t).replace(/Logger$/,"");let r=Da.replace(/{{NAME}}/g,t),o=s?j("modules",s):".",a=j(o,"src","loggers"),i=j(process.cwd(),a),n=j(i,`${t}Logger.ts`);await Bun.write(n,r);let l=_a.replace(/{{NAME}}/g,t),d=j(o,"tests","loggers"),u=j(process.cwd(),d),c=j(u,`${t}Logger.spec.ts`);await Bun.write(c,l);let p=new vm;p.success(`${j(a,t)}Logger.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${j(d,t)}Logger.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}He=y([b.command()],He);import{join as B}from"path";import{TerminalLogger as _m}from"@ooneex/logger";import{toPascalCase as Dm}from"@ooneex/utils";var Pa=`import { describe, expect, test } from "bun:test";
1849
2385
  import { {{NAME}}Mailer } from "@/mailers/{{NAME}}Mailer";
1850
2386
 
1851
2387
  describe("{{NAME}}Mailer", () => {
@@ -1858,7 +2394,7 @@ describe("{{NAME}}Mailer", () => {
1858
2394
  expect(typeof {{NAME}}Mailer.prototype.send).toBe("function");
1859
2395
  });
1860
2396
  });
1861
- `;var po=`import { inject } from "@ooneex/container";
2397
+ `;var Oa=`import { inject } from "@ooneex/container";
1862
2398
  import type { IMailer } from "@ooneex/mailer";
1863
2399
  import { type {{NAME}}MailerPropsType, {{NAME}}MailerTemplate } from "./{{NAME}}MailerTemplate";
1864
2400
 
@@ -1882,7 +2418,7 @@ export class {{NAME}}Mailer implements IMailer {
1882
2418
  });
1883
2419
  }
1884
2420
  }
1885
- `;var lo=`import { describe, expect, test } from "bun:test";
2421
+ `;var Ba=`import { describe, expect, test } from "bun:test";
1886
2422
  import { {{NAME}}MailerTemplate } from "@/mailers/{{NAME}}MailerTemplate";
1887
2423
 
1888
2424
  describe("{{NAME}}MailerTemplate", () => {
@@ -1894,7 +2430,7 @@ describe("{{NAME}}MailerTemplate", () => {
1894
2430
  expect(typeof {{NAME}}MailerTemplate).toBe("function");
1895
2431
  });
1896
2432
  });
1897
- `;var co=`import { MailerLayout } from "@ooneex/mailer";
2433
+ `;var Ia=`import { MailerLayout } from "@ooneex/mailer";
1898
2434
 
1899
2435
  export type {{NAME}}MailerPropsType = {
1900
2436
  link: string;
@@ -1909,7 +2445,7 @@ export const {{NAME}}MailerTemplate = (props?: {{NAME}}MailerPropsType) => (
1909
2445
  <MailerLayout.Footer />
1910
2446
  </MailerLayout>
1911
2447
  );
1912
- `;class Ye{getName(){return"make:mailer"}getDescription(){return"Generate a new mailer class"}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter mailer name"});t=ql(t).replace(/Mailer$/,"");let s=po.replace(/{{NAME}}/g,t),r=co.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=ao.replace(/{{NAME}}/g,t),l=lo.replace(/{{NAME}}/g,t),c=I("tests","mailers"),d=I(process.cwd(),c),h=I(d,`${t}Mailer.spec.ts`),m=I(d,`${t}MailerTemplate.spec.ts`);await Bun.write(h,p),await Bun.write(m,l);let u=new Ul;u.success(`${I(i,t)}Mailer.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),u.success(`${I(i,t)}MailerTemplate.tsx created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),u.success(`${I(c,t)}Mailer.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),u.success(`${I(c,t)}MailerTemplate.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ye=g([E.command()],Ye);import{basename as Yl,join as K}from"path";import{TerminalLogger as Vl}from"@ooneex/logger";import{toPascalCase as fo}from"@ooneex/utils";var mo=`import type { ContextType } from "@ooneex/socket";
2448
+ `;class Ve{getName(){return"make:mailer"}getDescription(){return"Generate a new mailer class"}async run(e){let{name:t,module:s}=e;if(!t)t=await N({message:"Enter mailer name"});t=Dm(t).replace(/Mailer$/,"");let r=Oa.replace(/{{NAME}}/g,t),o=Ia.replace(/{{NAME}}/g,t),a=s?B("modules",s):".",i=B(a,"src","mailers"),n=B(process.cwd(),i),l=B(n,`${t}Mailer.ts`),d=B(n,`${t}MailerTemplate.tsx`);await Bun.write(l,r),await Bun.write(d,o);let u=Pa.replace(/{{NAME}}/g,t),c=Ba.replace(/{{NAME}}/g,t),p=B(a,"tests","mailers"),m=B(process.cwd(),p),h=B(m,`${t}Mailer.spec.ts`),f=B(m,`${t}MailerTemplate.spec.ts`);await Bun.write(h,u),await Bun.write(f,c);let w=new _m;w.success(`${B(i,t)}Mailer.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),w.success(`${B(i,t)}MailerTemplate.tsx created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),w.success(`${B(p,t)}Mailer.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),w.success(`${B(p,t)}MailerTemplate.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ve=y([b.command()],Ve);import{basename as Im,join as W}from"path";import{TerminalLogger as Lm}from"@ooneex/logger";import{toPascalCase as $a}from"@ooneex/utils";var La=`import type { ContextType } from "@ooneex/socket";
1913
2449
  import { decorator, type IMiddleware } from "@ooneex/middleware";
1914
2450
 
1915
2451
  @decorator.middleware()
@@ -1921,7 +2457,7 @@ export class {{NAME}}Middleware implements IMiddleware {
1921
2457
  return context
1922
2458
  }
1923
2459
  }
1924
- `;var uo=`import { describe, expect, test } from "bun:test";
2460
+ `;var Ua=`import { describe, expect, test } from "bun:test";
1925
2461
  import { {{NAME}}Middleware } from "@/middlewares/{{NAME}}Middleware";
1926
2462
 
1927
2463
  describe("{{NAME}}Middleware", () => {
@@ -1934,7 +2470,7 @@ describe("{{NAME}}Middleware", () => {
1934
2470
  expect(typeof {{NAME}}Middleware.prototype.handler).toBe("function");
1935
2471
  });
1936
2472
  });
1937
- `;var ho=`import type { ContextType } from "@ooneex/controller";
2473
+ `;var Ga=`import type { ContextType } from "@ooneex/controller";
1938
2474
  import { decorator, type IMiddleware } from "@ooneex/middleware";
1939
2475
 
1940
2476
  @decorator.middleware()
@@ -1946,9 +2482,9 @@ export class {{NAME}}Middleware implements IMiddleware {
1946
2482
  return context
1947
2483
  }
1948
2484
  }
1949
- `;class Ve{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}";
1950
- `,o=s.lastIndexOf("import "),n=s.indexOf(`
1951
- `,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(),c=l?`${l}, ${r}`:r;s=s.replace(a,`$1${c}`)}await Bun.write(e,s)}async run(e){let{name:t,isSocket:s}=e;if(!t)t=await w({message:"Enter middleware name"});if(s===void 0)s=await $e({message:"Is this a socket middleware?"});t=fo(t).replace(/Middleware$/,"");let i=(s?mo:ho).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=uo.replace(/{{NAME}}/g,t),l=K("tests","middlewares"),c=K(process.cwd(),l),d=K(c,`${t}Middleware.spec.ts`);await Bun.write(d,p);let h=fo(Yl(process.cwd())),m=K(process.cwd(),"src",`${h}Module.ts`);if(await Bun.file(m).exists())await this.addToModule(m,t);let u=new Vl;u.success(`${K(o,t)}Middleware.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),u.success(`${K(l,t)}Middleware.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ve=g([E.command()],Ve);import{join as Fl}from"path";import{TerminalLogger as Ql}from"@ooneex/logger";import{migrationCreate as zl}from"@ooneex/migrations";class Fe{getName(){return"make:migration"}getDescription(){return"Generate a new migration file"}async run(){await zl({dir:"src/migrations"});let e=Fl(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 Ql;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})}}Fe=g([E.command()],Fe);import{basename as Jl,join as H}from"path";import{TerminalLogger as jl}from"@ooneex/logger";import{toPascalCase as Eo}from"@ooneex/utils";var yo=`import { describe, expect, test } from "bun:test";
2485
+ `;class Ye{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`,o=`import { ${r} } from "./middlewares/${r}";
2486
+ `,a=s.lastIndexOf("import "),i=s.indexOf(`
2487
+ `,a);s=`${s.slice(0,i+1)}${o}${s.slice(i+1)}`;let n=/(middlewares:\s*\[)([^\]]*)/s,l=s.match(n);if(l){let d=l[2]?.trim(),u=d?`${d}, ${r}`:r;s=s.replace(n,`$1${u}`)}await Bun.write(e,s)}async run(e){let{name:t,module:s,isSocket:r}=e;if(!t)t=await N({message:"Enter middleware name"});if(r===void 0)r=await Ge({message:"Is this a socket middleware?"});t=$a(t).replace(/Middleware$/,"");let a=(r?La:Ga).replace(/{{NAME}}/g,t),i=s?W("modules",s):".",n=W(i,"src","middlewares"),l=W(process.cwd(),n),d=W(l,`${t}Middleware.ts`);await Bun.write(d,a);let u=Ua.replace(/{{NAME}}/g,t),c=W(i,"tests","middlewares"),p=W(process.cwd(),c),m=W(p,`${t}Middleware.spec.ts`);await Bun.write(m,u);let h=$a(Im(process.cwd())),f=W(process.cwd(),"src",`${h}Module.ts`);if(await Bun.file(f).exists())await this.addToModule(f,t);let w=new Lm;w.success(`${W(n,t)}Middleware.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),w.success(`${W(c,t)}Middleware.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ye=y([b.command()],Ye);import{join as Ot}from"path";import{TerminalLogger as Um}from"@ooneex/logger";import{migrationCreate as Gm}from"@ooneex/migrations";class Fe{getName(){return"make:migration"}getDescription(){return"Generate a new migration file"}async run(e){let{module:t}=e,s=t?Ot("modules",t):".";await Gm({dir:Ot(s,"src/migrations")});let r=Ot(process.cwd(),"package.json"),o=Bun.file(r);if(await o.exists()){let i=await o.json();i.scripts=i.scripts||{},i.scripts["migration:up"]="bun ./bin/migration/up.ts",await Bun.write(r,JSON.stringify(i,null,2))}let a=new Um;a.success("Migration file created successfully",void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),a.info("Run 'bun run migration:up' to execute migrations",void 0,{showTimestamp:!1,showArrow:!0,showLevel:!1})}}Fe=y([b.command()],Fe);import{basename as qm,join as q}from"path";import{TerminalLogger as km}from"@ooneex/logger";import{toPascalCase as ka}from"@ooneex/utils";var Wa=`import { describe, expect, test } from "bun:test";
1952
2488
  import { Permission } from "@ooneex/permission";
1953
2489
  import { {{NAME}}Permission } from "@/permissions/{{NAME}}Permission";
1954
2490
 
@@ -1973,7 +2509,7 @@ describe("{{NAME}}Permission", () => {
1973
2509
  });
1974
2510
 
1975
2511
  });
1976
- `;var go=`import { decorator, Permission } from "@ooneex/permission";
2512
+ `;var qa=`import { decorator, Permission } from "@ooneex/permission";
1977
2513
  import type { IUser } from "@ooneex/user";
1978
2514
 
1979
2515
  @decorator.permission()
@@ -2012,9 +2548,9 @@ export class {{NAME}}Permission extends Permission {
2012
2548
  return this;
2013
2549
  }
2014
2550
  }
2015
- `;class Qe{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}";
2016
- `,o=s.lastIndexOf("import "),n=s.indexOf(`
2017
- `,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(),c=l?`${l}, ${r}`:r;s=s.replace(a,`$1${c}`)}await Bun.write(e,s)}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter permission name"});t=Eo(t).replace(/Permission$/,"");let s=go.replace(/{{NAME}}/g,t),r=H("src","permissions"),i=H(process.cwd(),r),o=H(i,`${t}Permission.ts`);await Bun.write(o,s);let n=yo.replace(/{{NAME}}/g,t),a=H("tests","permissions"),p=H(process.cwd(),a),l=H(p,`${t}Permission.spec.ts`);await Bun.write(l,n);let c=Eo(Jl(process.cwd())),d=H(process.cwd(),"src",`${c}Module.ts`);if(await Bun.file(d).exists())await this.addToModule(d,t);let h=new jl;h.success(`${H(r,t)}Permission.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),h.success(`${H(a,t)}Permission.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Qe=g([E.command()],Qe);import{basename as tc,join as W}from"path";import{TerminalLogger as sc}from"@ooneex/logger";import{toKebabCase as rc,toPascalCase as wo}from"@ooneex/utils";var Ao=`import { describe, expect, test } from "bun:test";
2551
+ `;class je{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`,o=`import { ${r} } from "./permissions/${r}";
2552
+ `,a=s.lastIndexOf("import "),i=s.indexOf(`
2553
+ `,a);s=`${s.slice(0,i+1)}${o}${s.slice(i+1)}`;let n=/(permissions:\s*\[)([^\]]*)/s,l=s.match(n);if(l){let d=l[2]?.trim(),u=d?`${d}, ${r}`:r;s=s.replace(n,`$1${u}`)}await Bun.write(e,s)}async run(e){let{name:t,module:s}=e;if(!t)t=await N({message:"Enter permission name"});t=ka(t).replace(/Permission$/,"");let r=qa.replace(/{{NAME}}/g,t),o=s?q("modules",s):".",a=q(o,"src","permissions"),i=q(process.cwd(),a),n=q(i,`${t}Permission.ts`);await Bun.write(n,r);let l=Wa.replace(/{{NAME}}/g,t),d=q(o,"tests","permissions"),u=q(process.cwd(),d),c=q(u,`${t}Permission.spec.ts`);await Bun.write(c,l);let p=ka(qm(process.cwd())),m=q(process.cwd(),"src",`${p}Module.ts`);if(await Bun.file(m).exists())await this.addToModule(m,t);let h=new km;h.success(`${q(a,t)}Permission.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),h.success(`${q(d,t)}Permission.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}je=y([b.command()],je);import{basename as Vm,join as k}from"path";import{TerminalLogger as Ym}from"@ooneex/logger";import{toKebabCase as Fm,toPascalCase as Va}from"@ooneex/utils";var Ka=`import { describe, expect, test } from "bun:test";
2018
2554
  import { {{NAME}}PubSub } from "@/pubsub/{{NAME}}PubSub";
2019
2555
 
2020
2556
  describe("{{NAME}}PubSub", () => {
@@ -2052,7 +2588,7 @@ describe("{{NAME}}PubSub", () => {
2052
2588
  expect(typeof {{NAME}}PubSub.prototype.unsubscribeAll).toBe("function");
2053
2589
  });
2054
2590
  });
2055
- `;var bo=`import { inject } from "@ooneex/container";
2591
+ `;var Ha=`import { inject } from "@ooneex/container";
2056
2592
  import type { ScalarType } from "@ooneex/types";
2057
2593
  import { decorator, PubSub, RedisPubSub } from "@ooneex/pub-sub";
2058
2594
 
@@ -2074,9 +2610,9 @@ export class {{NAME}}Event<Data extends Record<string, ScalarType> = Record<stri
2074
2610
  // TODO: Implement handler logic here
2075
2611
  }
2076
2612
  }
2077
- `;class ze{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}";
2078
- `,o=s.lastIndexOf("import "),n=s.indexOf(`
2079
- `,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(),c=l?`${l}, ${r}`:r;s=s.replace(a,`$1${c}`)}await Bun.write(e,s)}async run(e){let{name:t,channel:s}=e;if(!t)t=await w({message:"Enter name"});if(t=wo(t).replace(/PubSub$/,""),!s)s=rc(t);let r=bo.replace(/{{NAME}}/g,t).replace(/{{CHANNEL}}/g,s),i=W("src","events"),o=W(process.cwd(),i),n=W(o,`${t}Event.ts`);await Bun.write(n,r);let a=Ao.replace(/{{NAME}}/g,t),p=W("tests","events"),l=W(process.cwd(),p),c=W(l,`${t}Event.spec.ts`);await Bun.write(c,a);let d=wo(tc(process.cwd())),h=W(process.cwd(),"src",`${d}Module.ts`);if(await Bun.file(h).exists())await this.addToModule(h,t);let m=new sc;m.success(`${W(i,t)}Event.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),m.success(`${W(p,t)}Event.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}ze=g([E.command()],ze);import{join as te}from"path";import{TerminalLogger as nc}from"@ooneex/logger";import{toPascalCase as ac}from"@ooneex/utils";var xo=`import { describe, expect, test } from "bun:test";
2613
+ `;class ze{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`,o=`import { ${r} } from "./events/${r}";
2614
+ `,a=s.lastIndexOf("import "),i=s.indexOf(`
2615
+ `,a);s=`${s.slice(0,i+1)}${o}${s.slice(i+1)}`;let n=/(events:\s*\[)([^\]]*)/s,l=s.match(n);if(l){let d=l[2]?.trim(),u=d?`${d}, ${r}`:r;s=s.replace(n,`$1${u}`)}await Bun.write(e,s)}async run(e){let{name:t,module:s,channel:r}=e;if(!t)t=await N({message:"Enter name"});if(t=Va(t).replace(/PubSub$/,""),!r)r=Fm(t);let o=Ha.replace(/{{NAME}}/g,t).replace(/{{CHANNEL}}/g,r),a=s?k("modules",s):".",i=k(a,"src","events"),n=k(process.cwd(),i),l=k(n,`${t}Event.ts`);await Bun.write(l,o);let d=Ka.replace(/{{NAME}}/g,t),u=k(a,"tests","events"),c=k(process.cwd(),u),p=k(c,`${t}Event.spec.ts`);await Bun.write(p,d);let m=Va(Vm(process.cwd())),h=k(process.cwd(),"src",`${m}Module.ts`);if(await Bun.file(h).exists())await this.addToModule(h,t);let f=new Ym;f.success(`${k(i,t)}Event.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),f.success(`${k(u,t)}Event.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}ze=y([b.command()],ze);import{join as z}from"path";import{TerminalLogger as Zm}from"@ooneex/logger";import{toPascalCase as Qm}from"@ooneex/utils";var Ya=`import { describe, expect, test } from "bun:test";
2080
2616
  import { {{NAME}}Repository } from "@/repositories/{{NAME}}Repository";
2081
2617
 
2082
2618
  describe("{{NAME}}Repository", () => {
@@ -2139,7 +2675,7 @@ describe("{{NAME}}Repository", () => {
2139
2675
  expect(typeof {{NAME}}Repository.prototype.count).toBe("function");
2140
2676
  });
2141
2677
  });
2142
- `;var So=`import { inject } from "@ooneex/container";
2678
+ `;var Fa=`import { inject } from "@ooneex/container";
2143
2679
  import type { ITypeormDatabase } from "@ooneex/database";
2144
2680
  import { decorator } from "@ooneex/repository";
2145
2681
  import type { FilterResultType } from "@ooneex/types";
@@ -2261,7 +2797,7 @@ export class {{NAME}}Repository {
2261
2797
  return await repository.count(criteria ? { where: criteria } : {});
2262
2798
  }
2263
2799
  }
2264
- `;class Ze{getName(){return"make:repository"}getDescription(){return"Generate a new repository class"}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter repository name"});t=ac(t).replace(/Repository$/,"");let s=So.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=xo.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 c=new nc;c.success(`${te(r,t)}Repository.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),c.success(`${te(a,t)}Repository.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ze=g([E.command()],Ze);import{join as pc}from"path";import{TerminalLogger as lc}from"@ooneex/logger";import{seedCreate as cc}from"@ooneex/seeds";class Xe{getName(){return"make:seed"}getDescription(){return"Generate a new seed file"}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter seed name"});let s=await cc({name:t,dir:"src/seeds"}),r=pc(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 lc;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})}}Xe=g([E.command()],Xe);import{join as se}from"path";import{TerminalLogger as uc}from"@ooneex/logger";import{toPascalCase as hc}from"@ooneex/utils";var No=`import { describe, expect, test } from "bun:test";
2800
+ `;class Ze{getName(){return"make:repository"}getDescription(){return"Generate a new repository class"}async run(e){let{name:t,module:s}=e;if(!t)t=await N({message:"Enter repository name"});t=Qm(t).replace(/Repository$/,"");let r=Fa.replace(/{{NAME}}/g,t),o=s?z("modules",s):".",a=z(o,"src","repositories"),i=z(process.cwd(),a),n=z(i,`${t}Repository.ts`);await Bun.write(n,r);let l=Ya.replace(/{{NAME}}/g,t),d=z(o,"tests","repositories"),u=z(process.cwd(),d),c=z(u,`${t}Repository.spec.ts`);await Bun.write(c,l);let p=new Zm;p.success(`${z(a,t)}Repository.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${z(d,t)}Repository.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Ze=y([b.command()],Ze);import{join as Bt}from"path";import{TerminalLogger as Xm}from"@ooneex/logger";import{seedCreate as Jm}from"@ooneex/seeds";class Qe{getName(){return"make:seed"}getDescription(){return"Generate a new seed file"}async run(e){let{name:t,module:s}=e;if(!t)t=await N({message:"Enter seed name"});let r=s?Bt("modules",s):".",o=await Jm({name:t,dir:Bt(r,"src/seeds")}),a=Bt(process.cwd(),"package.json"),i=Bun.file(a);if(await i.exists()){let l=await i.json();l.scripts=l.scripts||{},l.scripts["seed:run"]="bun ./bin/seed/run.ts",await Bun.write(a,JSON.stringify(l,null,2))}let n=new Xm;n.success(`${o} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),n.info("Run 'bun run seed:run' to execute seeds",void 0,{showTimestamp:!1,showArrow:!0,showLevel:!1})}}Qe=y([b.command()],Qe);import{join as Z}from"path";import{TerminalLogger as sc}from"@ooneex/logger";import{toPascalCase as rc}from"@ooneex/utils";var ja=`import { describe, expect, test } from "bun:test";
2265
2801
  import { {{NAME}}Service } from "@/services/{{NAME}}Service";
2266
2802
 
2267
2803
  describe("{{NAME}}Service", () => {
@@ -2274,7 +2810,7 @@ describe("{{NAME}}Service", () => {
2274
2810
  expect(typeof {{NAME}}Service.prototype.execute).toBe("function");
2275
2811
  });
2276
2812
  });
2277
- `;var Mo=`import { decorator } from "@ooneex/service";
2813
+ `;var za=`import { decorator } from "@ooneex/service";
2278
2814
  import type { IService } from "@ooneex/service";
2279
2815
 
2280
2816
  type ServiceDataType = Record<string, unknown>;
@@ -2285,7 +2821,7 @@ export class {{NAME}}Service<T extends ServiceDataType = ServiceDataType> implem
2285
2821
  // TODO: Implement service logic
2286
2822
  }
2287
2823
  }
2288
- `;class Je{getName(){return"make:service"}getDescription(){return"Generate a new service class"}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter service name"});t=hc(t).replace(/Service$/,"");let s=Mo.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=No.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 c=new uc;c.success(`${se(r,t)}Service.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),c.success(`${se(a,t)}Service.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Je=g([E.command()],Je);import{join as re}from"path";import{TerminalLogger as gc}from"@ooneex/logger";import{toPascalCase as Ec,toSnakeCase as Ac}from"@ooneex/utils";var To=`import { describe, expect, test } from "bun:test";
2824
+ `;class Xe{getName(){return"make:service"}getDescription(){return"Generate a new service class"}async run(e){let{name:t,module:s}=e;if(!t)t=await N({message:"Enter service name"});t=rc(t).replace(/Service$/,"");let r=za.replace(/{{NAME}}/g,t),o=s?Z("modules",s):".",a=Z(o,"src","services"),i=Z(process.cwd(),a),n=Z(i,`${t}Service.ts`);await Bun.write(n,r);let l=ja.replace(/{{NAME}}/g,t),d=Z(o,"tests","services"),u=Z(process.cwd(),d),c=Z(u,`${t}Service.spec.ts`);await Bun.write(c,l);let p=new sc;p.success(`${Z(a,t)}Service.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${Z(d,t)}Service.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Xe=y([b.command()],Xe);import{join as Q}from"path";import{TerminalLogger as ic}from"@ooneex/logger";import{toPascalCase as nc,toSnakeCase as lc}from"@ooneex/utils";var Za=`import { describe, expect, test } from "bun:test";
2289
2825
  import { {{NAME}}StorageAdapter } from "@/storage/{{NAME}}StorageAdapter";
2290
2826
 
2291
2827
  describe("{{NAME}}StorageAdapter", () => {
@@ -2302,7 +2838,7 @@ describe("{{NAME}}StorageAdapter", () => {
2302
2838
  expect(typeof {{NAME}}StorageAdapter.prototype.getOptions).toBe("function");
2303
2839
  });
2304
2840
  });
2305
- `;var _o=`import { Storage, decorator, StorageException } from "@ooneex/storage";
2841
+ `;var Qa=`import { Storage, decorator, StorageException } from "@ooneex/storage";
2306
2842
  import type { S3Options } from "bun";
2307
2843
 
2308
2844
  @decorator.storage()
@@ -2357,7 +2893,7 @@ export class {{NAME}}Storage extends Storage {
2357
2893
  };
2358
2894
  }
2359
2895
  }
2360
- `;class je{getName(){return"make:storage"}getDescription(){return"Generate a new storage class"}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter storage name"});t=Ec(t).replace(/Storage$/,"");let s=Ac(t).toUpperCase(),r=_o.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=To.replace(/{{NAME}}/g,t),p=re("tests","storage"),l=re(process.cwd(),p),c=re(l,`${t}Storage.spec.ts`);await Bun.write(c,a);let d=new gc;d.success(`${re(i,t)}Storage.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),d.success(`${re(p,t)}Storage.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}je=g([E.command()],je);import{join as ie}from"path";import{TerminalLogger as xc}from"@ooneex/logger";import{toPascalCase as Sc}from"@ooneex/utils";var vo=`import { describe, expect, test } from "bun:test";
2896
+ `;class Je{getName(){return"make:storage"}getDescription(){return"Generate a new storage class"}async run(e){let{name:t,module:s}=e;if(!t)t=await N({message:"Enter storage name"});t=nc(t).replace(/Storage$/,"");let r=lc(t).toUpperCase(),o=Qa.replace(/{{NAME}}/g,t).replace(/{{NAME_UPPER}}/g,r),a=s?Q("modules",s):".",i=Q(a,"src","storage"),n=Q(process.cwd(),i),l=Q(n,`${t}Storage.ts`);await Bun.write(l,o);let d=Za.replace(/{{NAME}}/g,t),u=Q(a,"tests","storage"),c=Q(process.cwd(),u),p=Q(c,`${t}Storage.spec.ts`);await Bun.write(p,d);let m=new ic;m.success(`${Q(i,t)}Storage.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),m.success(`${Q(u,t)}Storage.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}Je=y([b.command()],Je);import{join as X}from"path";import{TerminalLogger as cc}from"@ooneex/logger";import{toPascalCase as pc}from"@ooneex/utils";var Xa=`import { describe, expect, test } from "bun:test";
2361
2897
  import { {{NAME}}VectorDatabase } from "@/databases/{{NAME}}VectorDatabase";
2362
2898
 
2363
2899
  describe("{{NAME}}VectorDatabase", () => {
@@ -2380,7 +2916,7 @@ describe("{{NAME}}VectorDatabase", () => {
2380
2916
  expect(typeof {{NAME}}VectorDatabase.prototype.getSchema).toBe("function");
2381
2917
  });
2382
2918
  });
2383
- `;var Ro=`import { VectorDatabase, decorator } from "@ooneex/rag";
2919
+ `;var Ja=`import { VectorDatabase, decorator } from "@ooneex/rag";
2384
2920
  import type { EmbeddingModelType, EmbeddingProviderType, FieldValueType } from "@ooneex/rag";
2385
2921
  import { Utf8 } from "apache-arrow";
2386
2922
 
@@ -2404,8 +2940,8 @@ export class {{NAME}}VectorDatabase extends VectorDatabase<DataType> {
2404
2940
  };
2405
2941
  }
2406
2942
  }
2407
- `;class ke{getName(){return"make:vector-database"}getDescription(){return"Generate a new vector database class"}async run(e){let{name:t}=e;if(!t)t=await w({message:"Enter vector database name"});t=Sc(t).replace(/VectorDatabase$/,"").replace(/Database$/,"");let s=Ro.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=vo.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 c=new xc;c.success(`${ie(r,t)}VectorDatabase.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),c.success(`${ie(a,t)}VectorDatabase.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}ke=g([E.command()],ke);var{values:oe,positionals:Tc}=Nc({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}),Bt=new Mc,Co=Tc[2];if(!Co)Bt.error(`Command name is required
2408
- `),process.exit(1);var Do=Pt(Co);if(!Do)Bt.info(`No commands found
2409
- `),process.exit(1);var _c={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 Do.run(_c)}catch(e){Bt.error(e,void 0,{showArrow:!1,showTimestamp:!1,showLevel:!1}),process.exit(1)}
2943
+ `;class et{getName(){return"make:vector-database"}getDescription(){return"Generate a new vector database class"}async run(e){let{name:t,module:s}=e;if(!t)t=await N({message:"Enter vector database name"});t=pc(t).replace(/VectorDatabase$/,"").replace(/Database$/,"");let r=Ja.replace(/{{NAME}}/g,t),o=s?X("modules",s):".",a=X(o,"src","databases"),i=X(process.cwd(),a),n=X(i,`${t}VectorDatabase.ts`);await Bun.write(n,r);let l=Xa.replace(/{{NAME}}/g,t),d=X(o,"tests","databases"),u=X(process.cwd(),d),c=X(u,`${t}VectorDatabase.spec.ts`);await Bun.write(c,l);let p=new cc;p.success(`${X(a,t)}VectorDatabase.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${X(d,t)}VectorDatabase.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}et=y([b.command()],et);var{values:J,positionals:fc}=uc({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"},module:{type:"string"}},strict:!0,allowPositionals:!0}),It=new hc,ti=fc[2];if(!ti)It.error(`Command name is required
2944
+ `),process.exit(1);var si=Ut(ti);if(!si)It.info(`No commands found
2945
+ `),process.exit(1);var gc={name:J.name,dir:J.dir,channel:J.channel,isSocket:J["is-socket"],tableName:J["table-name"],module:J.module,route:{name:J["route-name"],path:J["route-path"],method:J["route-method"]}};try{await si.run(gc)}catch(e){let t=e instanceof ei?e:new ei(e instanceof Error?e:String(e));It.error(t,void 0,{showArrow:!1,showTimestamp:!1,showLevel:!1}),process.exit(1)}
2410
2946
 
2411
- //# debugId=379BE11F6545E8B464756E2164756E21
2947
+ //# debugId=7A8929E96D25F0F264756E2164756E21