@stacksjs/cli 0.75.119 → 0.75.120

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +9 -9
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import Re from"process";async function Me(e,t={silent:!0}){let r=t.packageManage
4
4
  `);throw Error(`Command failed with exit code ${n.exitCode}: ${r.join(" ")}
5
5
  ${l}`)}return o}function Ee(e,t,r,n,o){if(p.debug(`exitHandler: ${e}, exitCode: ${r}, signalCode: ${n}`),o)p.debug("Process error:",o.message)}import{handleError as Ct}from"@stacksjs/error-handling";import{log as p}from"@stacksjs/logging";import{ExitCode as Se}from"@stacksjs/types";import{collect as gt}from"@stacksjs/collections";var u=!process.env.NO_COLOR&&(process.env.FORCE_COLOR?process.env.FORCE_COLOR!=="0":!!process.stdout?.isTTY),d={reset:u?"\x1B[0m":"",black:u?"\x1B[30m":"",red:u?"\x1B[31m":"",green:u?"\x1B[32m":"",yellow:u?"\x1B[33m":"",blue:u?"\x1B[34m":"",magenta:u?"\x1B[35m":"",cyan:u?"\x1B[36m":"",white:u?"\x1B[37m":"",gray:u?"\x1B[90m":"",lightRed:u?"\x1B[91m":"",lightGreen:u?"\x1B[92m":"",lightYellow:u?"\x1B[93m":"",lightBlue:u?"\x1B[94m":"",lightMagenta:u?"\x1B[95m":"",lightCyan:u?"\x1B[96m":"",lightGray:u?"\x1B[37m":"",bgBlack:u?"\x1B[40m":"",bgRed:u?"\x1B[41m":"",bgGreen:u?"\x1B[42m":"",bgYellow:u?"\x1B[43m":"",bgBlue:u?"\x1B[44m":"",bgMagenta:u?"\x1B[45m":"",bgCyan:u?"\x1B[46m":"",bgWhite:u?"\x1B[47m":"",bgGray:u?"\x1B[100m":"",bgLightRed:u?"\x1B[101m":"",bgLightGreen:u?"\x1B[102m":"",bgLightYellow:u?"\x1B[103m":"",bgLightBlue:u?"\x1B[104m":"",bgLightMagenta:u?"\x1B[105m":"",bgLightCyan:u?"\x1B[106m":"",bgLightGray:u?"\x1B[47m":"",bold:u?"\x1B[1m":"",dim:u?"\x1B[2m":"",italic:u?"\x1B[3m":"",underline:u?"\x1B[4m":"",inverse:u?"\x1B[7m":"",hidden:u?"\x1B[8m":"",strikethrough:u?"\x1B[9m":""},D="\x1B[",ut="\x1B]8;;",dt="\x1B]8;;\x07",Ge=(e)=>String(e);function k(e,t,r){return Math.min(Math.max(Math.floor(e),t),r)}function c(e,t=d.reset){return(r)=>{if(!u)return String(r);return`${e}${String(r)}${t}`}}function mt(e){return e.replace(/\x1B\]8;;[^\x07]*(?:\x07|\x1B\\)/g,"").replace(/\x1B\]8;;(?:\x07|\x1B\\)/g,"")}function O(e){return mt(e).replace(/\x1B\[[0-?]*[ -/]*[@-~]/g,"")}var Ae=O;function Pe(e){return Array.from(O(e)).length}var Q=c(d.black),X=c(d.red),L=c(d.green),Z=c(d.yellow),ee=c(d.blue),te=c(d.magenta),R=c(d.cyan),ne=c(d.white),F=c(d.gray),re=c(d.lightRed),oe=c(d.lightGreen),se=c(d.lightYellow),ie=c(d.lightBlue),ae=c(d.lightMagenta),le=c(d.lightCyan),W=c(d.lightGray),ce=c(d.bgBlack),ge=c(d.bgRed),ue=c(d.bgGreen),de=c(d.bgYellow),me=c(d.bgBlue),pe=c(d.bgMagenta),j=c(d.bgCyan),fe=c(d.bgWhite),he=c(d.bgGray),be=c(d.bgLightRed),ye=c(d.bgLightGreen),Ce=c(d.bgLightYellow),xe=c(d.bgLightBlue),we=c(d.bgLightMagenta),ke=c(d.bgLightCyan),N=c(d.bgLightGray),C=c(d.bold),v=c(d.dim),h=c(d.italic),Fe=c(d.underline),$e=c(d.inverse),ve=c(d.hidden),Oe=c(d.strikethrough),Be=c(d.reset,"");function Ye(e){return c(`${D}38;5;${k(e,0,255)}m`)}function We(e){return c(`${D}48;5;${k(e,0,255)}m`)}function Ne(e,t,r){return c(`${D}38;2;${k(e,0,255)};${k(t,0,255)};${k(r,0,255)}m`)}function De(e,t,r){return c(`${D}48;2;${k(e,0,255)};${k(t,0,255)};${k(r,0,255)}m`)}function ze(e,t){let r=(o,s)=>{let l=String(o);if(!u)return l;return`${ut}${s}\x07${l}${dt}`};if(typeof t==="string")return r(e,t);let n=String(e);return(o)=>r(o,n)}var pt={black:Q,red:X,green:L,yellow:Z,blue:ee,magenta:te,cyan:R,white:ne,gray:F,lightRed:re,lightGreen:oe,lightYellow:se,lightBlue:ie,lightMagenta:ae,lightCyan:le,lightGray:W,bgBlack:ce,bgRed:ge,bgGreen:ue,bgYellow:de,bgBlue:me,bgMagenta:pe,bgCyan:j,bgWhite:fe,bgGray:he,bgLightRed:be,bgLightGreen:ye,bgLightYellow:Ce,bgLightBlue:xe,bgLightMagenta:we,bgLightCyan:ke,bgLightGray:N,bold:C,dim:v,italic:h,underline:Fe,inverse:$e,hidden:ve,strikethrough:Oe,reset:Be};function _e(e){return pt[e]??Ge}function cn(e,t){if(typeof t==="function")return t(e);return _e(t)(e)}function ft(){return u}var gn={black:Q,red:X,green:L,yellow:Z,blue:ee,magenta:te,cyan:R,white:ne,gray:F,lightRed:re,lightGreen:oe,lightYellow:se,lightBlue:ie,lightMagenta:ae,lightCyan:le,lightGray:W,bgBlack:ce,bgRed:ge,bgGreen:ue,bgYellow:de,bgBlue:me,bgMagenta:pe,bgCyan:j,bgWhite:fe,bgGray:he,bgLightRed:be,bgLightGreen:ye,bgLightYellow:Ce,bgLightBlue:xe,bgLightMagenta:we,bgLightCyan:ke,bgLightGray:N,bold:C,dim:v,italic:h,underline:Fe,inverse:$e,hidden:ve,strikethrough:Oe,reset:Be,ansi256:Ye,ansi256Bg:We,trueColor:Ne,trueColorBg:De,link:ze,stripColors:Ae},un={black:Q,red:X,green:L,yellow:Z,blue:ee,magenta:te,cyan:R,white:ne,gray:F,lightRed:re,lightGreen:oe,lightYellow:se,lightBlue:ie,lightMagenta:ae,lightCyan:le,lightGray:W,bgBlack:ce,bgRed:ge,bgGreen:ue,bgYellow:de,bgBlue:me,bgMagenta:pe,bgCyan:j,bgWhite:fe,bgGray:he,bgLightRed:be,bgLightGreen:ye,bgLightYellow:Ce,bgLightBlue:xe,bgLightMagenta:we,bgLightCyan:ke,bgLightGray:N,bold:C,dim:v,italic:h,underline:Fe,inverse:$e,hidden:ve,strikethrough:Oe,reset:Be,ansi256:Ye,ansi256Bg:We,trueColor:Ne,trueColorBg:De,link:ze,stripColors:Ae,grey:F,lightGrey:W,bgLightGrey:N,supportsColor:ft};function ht(e,t,r,n){let o=Pe(e);if(o>=t)return e;let s=n[0]||" ",l=t-o;if(r==="right")return`${s.repeat(l)}${e}`;if(r==="center"){let a=Math.floor(l/2),i=l-a;return`${s.repeat(a)}${e}${s.repeat(i)}`}return`${e}${s.repeat(l)}`}function z(e){return Math.max(0,...e.map(Pe))}function _(e,t,r="left"){let n=String(e).split(/\r?\n/),o=typeof t==="object"?t:void 0,s=typeof t==="number"?t:o?.width??z(n),l=o?.align??r,a=o?.padChar??" ";return n.map((i)=>ht(i,Math.max(0,s),l,a)).join(`
6
6
  `)}function dn(e,t){return _(e,t,"left")}function mn(e,t){let r=String(e).split(/\r?\n/);return _(e,t??process.stdout?.columns??z(r),"right")}function pn(e,t){let r=String(e).split(/\r?\n/);return _(e,t??process.stdout?.columns??z(r),"center")}var bt={single:{topLeft:"\u250C",topRight:"\u2510",bottomLeft:"\u2514",bottomRight:"\u2518",horizontal:"\u2500",vertical:"\u2502"},double:{topLeft:"\u2554",topRight:"\u2557",bottomLeft:"\u255A",bottomRight:"\u255D",horizontal:"\u2550",vertical:"\u2551"},round:{topLeft:"\u256D",topRight:"\u256E",bottomLeft:"\u2570",bottomRight:"\u256F",horizontal:"\u2500",vertical:"\u2502"}};function qe(e,t={}){let r=String(e).split(/\r?\n/),n=bt[t.borderStyle??"single"],o=Math.max(0,t.padding??1),s=Math.max(0,t.margin??0),l=t.align??"left",a=z(r),i=a+o*2,g=typeof t.borderColor==="function"?t.borderColor:t.borderColor?_e(t.borderColor):Ge,b=g((()=>{if(!t.title)return`${n.topLeft}${n.horizontal.repeat(i)}${n.topRight}`;let S=` ${O(String(t.title))} `.slice(0,i),H=n.horizontal.repeat(Math.max(0,i-S.length));return`${n.topLeft}${S}${H}${n.topRight}`})()),y=g(`${n.bottomLeft}${n.horizontal.repeat(i)}${n.bottomRight}`),x=r.map((w)=>{let S=_(w,{align:l,width:a}),H=`${" ".repeat(o)}${S}${" ".repeat(o)}`;return`${g(n.vertical)}${H}${g(n.vertical)}`}),T=" ".repeat(s);return[b,...x,y].map((w)=>`${T}${w}`).join(`
7
- `)}var fn=gt(["The best way to get started is to quit talking and begin doing.","The pessimist sees difficulty in every opportunity. The optimist sees opportunity in every difficulty.","Don\u2019t let yesterday take up too much of today.","You learn more from failure than from success. Don\u2019t let it stop you. Failure builds character.","It\u2019s not whether you get knocked down, it\u2019s whether you get up.","If you are working on something that you really care about, you don\u2019t have to be pushed. The vision pulls you.","People who are crazy enough to think they can change the world, are the ones who do.","Failure will never overtake me if my determination to succeed is strong enough.","Entrepreneurs are great at dealing with uncertainty and also very good at minimizing risk. That\u2019s the classic entrepreneur.","We may encounter many defeats but we must not be defeated.","Knowing is not enough; we must apply. Wishing is not enough; we must do.","Imagine your life is perfect in every respect; what would it look like?","We generate fears while we sit. We overcome them by action.","Whether you think you can or think you can\u2019t, you\u2019re right.","Security is mostly a superstition. Life is either a daring adventure or nothing."]);var Ke="0.75.119";async function Fn(e,t){return new Promise((r)=>{if(t?.quiet===!1)console.log(),console.log(R(C("Stacks CLI"))+v(` v${Ke}`)),console.log();if(p.info(`Running ${j(h(C(` ${e} `)))}`),t?.showPerformance===!1||t?.quiet)return r(0);return r(performance.now())})}function $n(e,t,r){let n={type:"success",useSeconds:!0,...t};return n.message=t?.message||e,new Promise((o)=>{if(r)return Ct(r),o(Se.FatalError);if(n?.startTime){let s=performance.now()-n.startTime;if(n.useSeconds)s=s/1000,s=Math.round(s*100)/100;if(n.quiet===!0)return o(Se.Success);if(r)p.error(`[${s.toFixed(2)}${n.useSeconds?"s":"ms"}] Failed`);else if(n.type==="error")p.error(`[${s.toFixed(2)}${n.useSeconds?"s":"ms"}] ${n.message??"Failed"}`);else if(n.type==="warning")p.warn(`[${s.toFixed(2)}${n.useSeconds?"s":"ms"}] ${n.message??"Complete"}`);else if(n.type==="info")p.info(`${v(F(`[${s.toFixed(2)}${n.useSeconds?"s":"ms"}]`))} ${n.message??"Complete"}`);else p.success(`${v(F(C(`[${s.toFixed(2)}${n.useSeconds?"s":"ms"}]`)))} ${C(L(n.message??"Complete"))}`)}else if(n?.type==="info")p.info(e);else if(n?.type==="error")p.error(e);else if(n?.type==="warning")p.warn(e);else if(n?.type==="success"&&n?.quiet!==!0)p.success(e);p.flush().catch(()=>{}).then(()=>o(Se.Success))})}import q from"process";function He(e){if(!e)return!1;return e.startsWith("--")}function xt(e){return e.startsWith("-")&&!He(e)}function Le(e){if(e==="true")return!0;if(e==="false")return!1;let t=Number.parseFloat(e);if(!Number.isNaN(t))return t;return e.replace(/"/g,"")}function wt(e,t,r,n){let[o,s]=e.slice(2).split("=");if(s!==void 0)n[o]=Le(s);else if(r+1<t.length&&!t[r+1]?.startsWith("-"))n[o]=t[r+1],r++;else n[o]=!0;return r}function kt(e,t,r,n){let[o,s]=e.slice(1).split("=");if(o===void 0)return r;if(s!==void 0&&o!==void 0)for(let l=0;l<o.length;l++)n[o[l]]=Le(s);else for(let l=0;l<o.length;l++)if(r+1<t.length&&l===o.length-1&&!t[r+1]?.startsWith("-"))n[o[l]]=Le(t[r+1]),r++;else n[o[l]]=!0;return r}function Ft(e){if(e===void 0)e=q.argv.slice(2);let t=[],r={};for(let n=0;n<e.length;n++){let o=e[n];if(!o)continue;if(He(o))n=wt(o,e,n,r);else if(xt(o))n=kt(o,e,n,r);else t.push(o)}return{args:t,options:r}}function Sn(e){if(e===void 0)e=q.argv.slice(2);return Ft(e).args}function Ln(e){e=e||{};let t={dryRun:!1,quiet:!1,verbose:!1},r=q.argv.slice(2);for(let n=0;n<r.length;n++){let o=r[n];if(o?.startsWith("--")){let l=o.substring(2).replace(/-([a-z])/gi,(a)=>a[1]?a[1].toUpperCase():"");if(n+1<r.length&&!r?.[n+1]?.startsWith("--"))if(r?.[n+1]==="true"||r?.[n+1]==="false")e[l]=r[n+1]==="true",n++;else e[l]=r[n+1],n++;else e[l]=!0}}if(Object.keys(e).length===0)return{};return{...t,...e}}function $t(e){let t=[];for(let[r,n]of Object.entries(e)){if(r==="--"||r==="_"||n===!1||n===void 0||n===null)continue;if(typeof n==="object"&&!Array.isArray(n))continue;if(typeof n==="function"||typeof n==="symbol")continue;if(n===!0)t.push(`--${r}`);else t.push(`--${r}`,String(n))}return t}function vt(e){if(Array.isArray(e)){if(e=Array.from(new Set(e)),Array.isArray(e)&&e[0]&&!e[0].startsWith("-"))e.shift();return e.join(" ")}if(typeof e==="object"&&e!==null)return $t(e).join(" ");return vt(q.argv.slice(2))}import f from"process";import{createInterface as Ot}from"readline";var Tn=f.stdin.destroy;f.stdin.destroy=function(e){if(e)this.emit("error",e);return this};f.on("SIGINT",()=>{console.log(`
7
+ `)}var fn=gt(["The best way to get started is to quit talking and begin doing.","The pessimist sees difficulty in every opportunity. The optimist sees opportunity in every difficulty.","Don\u2019t let yesterday take up too much of today.","You learn more from failure than from success. Don\u2019t let it stop you. Failure builds character.","It\u2019s not whether you get knocked down, it\u2019s whether you get up.","If you are working on something that you really care about, you don\u2019t have to be pushed. The vision pulls you.","People who are crazy enough to think they can change the world, are the ones who do.","Failure will never overtake me if my determination to succeed is strong enough.","Entrepreneurs are great at dealing with uncertainty and also very good at minimizing risk. That\u2019s the classic entrepreneur.","We may encounter many defeats but we must not be defeated.","Knowing is not enough; we must apply. Wishing is not enough; we must do.","Imagine your life is perfect in every respect; what would it look like?","We generate fears while we sit. We overcome them by action.","Whether you think you can or think you can\u2019t, you\u2019re right.","Security is mostly a superstition. Life is either a daring adventure or nothing."]);var Ke="0.75.120";async function Fn(e,t){return new Promise((r)=>{if(t?.quiet===!1)console.log(),console.log(R(C("Stacks CLI"))+v(` v${Ke}`)),console.log();if(p.info(`Running ${j(h(C(` ${e} `)))}`),t?.showPerformance===!1||t?.quiet)return r(0);return r(performance.now())})}function $n(e,t,r){let n={type:"success",useSeconds:!0,...t};return n.message=t?.message||e,new Promise((o)=>{if(r)return Ct(r),o(Se.FatalError);if(n?.startTime){let s=performance.now()-n.startTime;if(n.useSeconds)s=s/1000,s=Math.round(s*100)/100;if(n.quiet===!0)return o(Se.Success);if(r)p.error(`[${s.toFixed(2)}${n.useSeconds?"s":"ms"}] Failed`);else if(n.type==="error")p.error(`[${s.toFixed(2)}${n.useSeconds?"s":"ms"}] ${n.message??"Failed"}`);else if(n.type==="warning")p.warn(`[${s.toFixed(2)}${n.useSeconds?"s":"ms"}] ${n.message??"Complete"}`);else if(n.type==="info")p.info(`${v(F(`[${s.toFixed(2)}${n.useSeconds?"s":"ms"}]`))} ${n.message??"Complete"}`);else p.success(`${v(F(C(`[${s.toFixed(2)}${n.useSeconds?"s":"ms"}]`)))} ${C(L(n.message??"Complete"))}`)}else if(n?.type==="info")p.info(e);else if(n?.type==="error")p.error(e);else if(n?.type==="warning")p.warn(e);else if(n?.type==="success"&&n?.quiet!==!0)p.success(e);p.flush().catch(()=>{}).then(()=>o(Se.Success))})}import q from"process";function He(e){if(!e)return!1;return e.startsWith("--")}function xt(e){return e.startsWith("-")&&!He(e)}function Le(e){if(e==="true")return!0;if(e==="false")return!1;let t=Number.parseFloat(e);if(!Number.isNaN(t))return t;return e.replace(/"/g,"")}function wt(e,t,r,n){let[o,s]=e.slice(2).split("=");if(s!==void 0)n[o]=Le(s);else if(r+1<t.length&&!t[r+1]?.startsWith("-"))n[o]=t[r+1],r++;else n[o]=!0;return r}function kt(e,t,r,n){let[o,s]=e.slice(1).split("=");if(o===void 0)return r;if(s!==void 0&&o!==void 0)for(let l=0;l<o.length;l++)n[o[l]]=Le(s);else for(let l=0;l<o.length;l++)if(r+1<t.length&&l===o.length-1&&!t[r+1]?.startsWith("-"))n[o[l]]=Le(t[r+1]),r++;else n[o[l]]=!0;return r}function Ft(e){if(e===void 0)e=q.argv.slice(2);let t=[],r={};for(let n=0;n<e.length;n++){let o=e[n];if(!o)continue;if(He(o))n=wt(o,e,n,r);else if(xt(o))n=kt(o,e,n,r);else t.push(o)}return{args:t,options:r}}function Sn(e){if(e===void 0)e=q.argv.slice(2);return Ft(e).args}function Ln(e){e=e||{};let t={dryRun:!1,quiet:!1,verbose:!1},r=q.argv.slice(2);for(let n=0;n<r.length;n++){let o=r[n];if(o?.startsWith("--")){let l=o.substring(2).replace(/-([a-z])/gi,(a)=>a[1]?a[1].toUpperCase():"");if(n+1<r.length&&!r?.[n+1]?.startsWith("--"))if(r?.[n+1]==="true"||r?.[n+1]==="false")e[l]=r[n+1]==="true",n++;else e[l]=r[n+1],n++;else e[l]=!0}}if(Object.keys(e).length===0)return{};return{...t,...e}}function $t(e){let t=[];for(let[r,n]of Object.entries(e)){if(r==="--"||r==="_"||n===!1||n===void 0||n===null)continue;if(typeof n==="object"&&!Array.isArray(n))continue;if(typeof n==="function"||typeof n==="symbol")continue;if(n===!0)t.push(`--${r}`);else t.push(`--${r}`,String(n))}return t}function vt(e){if(Array.isArray(e)){if(e=Array.from(new Set(e)),Array.isArray(e)&&e[0]&&!e[0].startsWith("-"))e.shift();return e.join(" ")}if(typeof e==="object"&&e!==null)return $t(e).join(" ");return vt(q.argv.slice(2))}import f from"process";import{createInterface as Ot}from"readline";var Tn=f.stdin.destroy;f.stdin.destroy=function(e){if(e)this.emit("error",e);return this};f.on("SIGINT",()=>{console.log(`
8
8
  `),f.exit(130)});var M=null;function Bt(){if(!M){let e=f.stdin.isTTY&&f.stdout.isTTY;if(M=Ot({input:f.stdin,output:f.stdout,terminal:e}),e&&typeof f.stdin.setRawMode==="function")M.on("SIGINT",()=>{f.emit("SIGINT")});M.once("close",()=>{M=null})}return M}var K=Symbol("stdin-eof");function Ue(e){return new Promise((t)=>{let r=Bt(),n=!1,o=(l)=>{if(n)return;n=!0,r.off("close",s),t(l)},s=()=>o(K);r.once("close",s);try{r.question(e,o)}catch{o(K)}})}function Ve(){if(f.argv.includes("--no-interaction"))return!1;if(f.env.CI)return!1;return Boolean(f.stdin.isTTY&&f.stdout.isTTY)}async function E(e){if(!Ve())return"";let t=await Ue(e);return t===K?"":t}function Je(e,t){let r=e.toLowerCase().trim();if(!r)return t;if(r==="y"||r==="yes")return!0;if(r==="n"||r==="no")return!1;return t}async function jn(e){let t=typeof e==="string"?{message:e}:e,r=t.initial??!1,n=r?" (Y/n) ":" (y/N) ";if(!Ve())return null;let o=await Ue(`${t.message}${n}`);if(o===K)return null;return Je(o,r)}async function St(e){let t=typeof e==="string"?{message:e}:e,r=t.initial??!1,n=r?" (Y/n) ":" (y/N) ",o=await E(`${t.message}${n}`);return Je(o,r)}async function Lt(e){let t=typeof e==="string"?{message:e}:e,r=t.placeholder||t.initial||"",n=r?` (${r}) `:" ";return(await E(`${t.message}${n}`)).trim()||t.initial||""}async function Rt(e){console.log(e.message),e.choices.forEach((o,s)=>{let l=s===(e.initial??0)?">":" ";console.log(`${l} ${s+1}. ${o.label}`)});let t=await E("Select (number): "),r=Number.parseInt(t.trim(),10)-1,n=e.choices[r]??e.choices[e.initial??0];if(!n)throw Error("select prompt: no choices available");return n.value}async function Mt(e){console.log(e.message),console.log("(Enter numbers separated by commas)"),e.choices.forEach((o,s)=>{console.log(` ${s+1}. ${o.label}`)});let r=(await E("Select (e.g., 1,3,4): ")).split(",").map((o)=>Number.parseInt(o.trim(),10)-1),n=[];for(let o of r){let s=e.choices[o];if(s)n.push(s.value)}return n}async function It(e){return(await E(`${(typeof e==="string"?{message:e}:e).message} `)).trim()}var En={text:Lt,confirm:St,select:Rt,multiselect:Mt,password:It};import{handleError as Tt}from"@stacksjs/error-handling";async function jt(e,t){let r={...t,stdin:t?.stdin??"inherit",verbose:t?.verbose??!1};return await J(e,r)}async function Yn(e,t){let r={...t,stdio:[t?.stdin??"inherit","pipe","pipe"],verbose:t?.verbose??!1};return await J(e,r)}async function Wn(e,t){let r={...t,stdio:[t?.stdin??"inherit","pipe","pipe"],verbose:t?.verbose??!1};return await je(e,r)}async function Nn(e,t){let r=[];for(let n of e){let o=await jt(n,t);if(o.isErr)throw Tt("Error during runCommands",o.error),o.error;r.push(o)}return r}import Et from"process";var Gt=["SIGINT","SIGTERM","SIGHUP"],I=new Map,Qe=!1;function At(){if(Qe)return;Qe=!0;for(let e of Gt)Et.on(e,async()=>{for(let[t,r]of I)try{await r()}catch(n){console.error(`[signals] cleanup '${t}' threw:`,n)}})}function _n(e,t){return At(),I.set(e,t),()=>{if(I.get(e)===t)I.delete(e)}}function qn(e){I.delete(e)}function Kn(){return[...I.keys()]}var Xe=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],G=process.stdout.isTTY&&!process.env.CI;function Pt(e){let t=e||"",r=0,n=null,o=!1,s=()=>{if(G)process.stdout.write("\r\x1B[K")},l=()=>{if(!G)return;s();let a=Xe[r];process.stdout.write(`${a} ${t}`),r=(r+1)%Xe.length};return{start(a){if(a)t=a;if(o)return;if(o=!0,G)l(),n=setInterval(l,80);else if(t)console.log(` ${t}`)},stop(a){if(o=!1,n)clearInterval(n),n=null;if(s(),a)console.log(a)},update(a){if(t=a,!G&&o)console.log(` ${a}`)},succeed(a){let i=a||t;if(o=!1,n)clearInterval(n),n=null;s(),console.log(`\u2713 ${i}`)},fail(a){let i=a||t;if(o=!1,n)clearInterval(n),n=null;s(),console.error(`\u2717 ${i}`)},get text(){return t},set text(a){if(t=a,G&&o)l()},get isSpinning(){return o}}}async function Un(e,t,r){let n=Pt(e);n.start();try{let o=await t();return n.succeed(r?.successMessage||e),o}catch(o){throw n.fail(r?.failMessage||`Failed: ${e}`),o}}import B from"process";var Ze="\r\x1B[2K";function Yt(){return{columns:B.stdout.columns??80,rows:B.stdout.rows??24}}function Wt(){return Boolean(B.stdout.isTTY)&&!B.env.CI}function Xn(e,t){console.log(qe(e,t===void 0?{}:{title:t}))}function Zn(e,t={}){let n=(t.columns??[...new Set(e.flatMap((i)=>Object.keys(i)))]).map((i)=>typeof i==="string"?{key:i}:i);if(n.length===0)return"";let o=(i,g)=>{let m=i[g.key];return m===void 0||m===null?"":String(m)},s=n.map((i)=>{let g=t.header===!1?"":i.header??i.key;return Math.max(O(g).length,...e.map((m)=>O(o(m,i)).length))}),l=(i,g,m)=>{let b=Math.max(0,g-O(i).length);return m==="right"?" ".repeat(b)+i:i+" ".repeat(b)},a=[];if(t.header!==!1)a.push(n.map((i,g)=>l(i.header??i.key,s[g],i.align)).join(" ").trimEnd()),a.push(n.map((i,g)=>"-".repeat(s[g])).join(" "));for(let i of e)a.push(n.map((g,m)=>l(o(i,g),s[m],g.align)).join(" ").trimEnd());return a.join(`
9
9
  `)}function er(e){if(!Number.isFinite(e.total)||e.total<=0)throw TypeError(`progress() needs a positive total; got ${e.total}`);let t=e.format??"|{bar}| {percentage}% | {value}/{total}",r=e.width??Math.max(10,Math.floor(Yt().columns/3)),n=Wt(),o=0,s=-1,l=(i)=>{let g=Math.min(1,o/e.total),m=Math.round(g*r),b={bar:"\u2588".repeat(m)+"\u2591".repeat(r-m),percentage:Math.round(g*100),value:o,total:e.total,...i},y=t.replace(/\{(\w+)\}/g,(T,w)=>String(b[w]??T));if(n){B.stdout.write(`${Ze}${y}`);return}let x=Math.floor(g*10);if(x>s)s=x,console.log(y)},a={update(i,g={}){o=Math.max(0,Math.min(e.total,i)),l(g)},increment(i=1){a.update(o+i)},stop(i){if(n)B.stdout.write(Ze);if(i)console.log(i);else if(n)B.stdout.write(`
10
10
  `)},get value(){return o},get total(){return e.total}};return a}async function tr(e){let t=[];for(let r of e){let n=Date.now(),o=r.skip?.();if(o){console.log(`- ${r.title}${typeof o==="string"?` (${o})`:""}`),t.push({title:r.title,status:"skipped",durationMs:0});continue}try{await r.task(),console.log(`\u2713 ${r.title}`),t.push({title:r.title,status:"done",durationMs:Date.now()-n})}catch(s){throw console.log(`\u2717 ${r.title}`),t.push({title:r.title,status:"failed",error:s instanceof Error?s:Error(String(s)),durationMs:Date.now()-n}),s}}return t}export{Kt as CLI,_ as align,Ye as ansi256,We as ansi256Bg,it as applyAliases,ce as bgBlack,me as bgBlue,j as bgCyan,he as bgGray,ue as bgGreen,xe as bgLightBlue,ke as bgLightCyan,N as bgLightGray,ye as bgLightGreen,we as bgLightMagenta,be as bgLightRed,Ce as bgLightYellow,pe as bgMagenta,ge as bgRed,fe as bgWhite,de as bgYellow,Q as black,ee as blue,C as bold,qe as box,$t as buddyOptionArgs,vt as buddyOptions,pn as centerAlign,Ut as cli,cn as colorize,gn as colors,St as confirm,jn as confirmOrNull,R as cyan,Zt as defineCommand,en as defineCommands,v as dim,ot as discoverCommandFiles,J as exec,je as execSync,_e as getColor,Yt as getTerminalSize,F as gray,L as green,ve as hidden,Dt as installPackage,zt as installStack,Fn as intro,$e as inverse,Wt as isInteractive,h as italic,un as kolorist,dn as leftAlign,ie as lightBlue,le as lightCyan,W as lightGray,oe as lightGreen,ae as lightMagenta,re as lightRed,se as lightYellow,ze as link,Kn as listSignalHandlers,Te as loadCommandRegistry,Xt as loadCommands,p as log,te as magenta,Mt as multiselect,Xn as note,qn as offSignal,_n as onSignal,Ht as onUnknownSubcommand,$n as outro,Sn as parseArgs,Ft as parseArgv,Ln as parseOptions,It as password,er as progress,En as prompts,Ve as promptsAreInteractive,fn as quotes,X as red,Be as reset,st as resolveCommands,mn as rightAlign,jt as runCommand,Wn as runCommandSync,Nn as runCommands,Yn as runProcess,Rt as select,Pt as spinner,Oe as strikethrough,O as stripAnsi,Ae as stripColors,Zn as table,tr as tasks,Lt as text,Ne as trueColor,De as trueColorBg,Fe as underline,ne as white,Un as withSpinner,Z as yellow};
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/cli",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.119",
5
+ "version": "0.75.120",
6
6
  "description": "TypeScript framework for CLI artisans. Build beautiful console apps with ease.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -70,16 +70,16 @@
70
70
  },
71
71
  "dependencies": {
72
72
  "@stacksjs/clapp": "^0.2.12",
73
- "@stacksjs/collections": "0.75.119",
74
- "@stacksjs/error-handling": "0.75.119",
75
- "@stacksjs/logging": "0.75.119",
76
- "@stacksjs/types": "0.75.119"
73
+ "@stacksjs/collections": "0.75.120",
74
+ "@stacksjs/error-handling": "0.75.120",
75
+ "@stacksjs/logging": "0.75.120",
76
+ "@stacksjs/types": "0.75.120"
77
77
  },
78
78
  "devDependencies": {
79
- "@stacksjs/config": "0.75.119",
80
- "@stacksjs/path": "0.75.119",
81
- "@stacksjs/utils": "0.75.119",
82
- "@stacksjs/validation": "0.75.119",
79
+ "@stacksjs/config": "0.75.120",
80
+ "@stacksjs/path": "0.75.120",
81
+ "@stacksjs/utils": "0.75.120",
82
+ "@stacksjs/validation": "0.75.120",
83
83
  "better-dx": "^0.2.24"
84
84
  }
85
85
  }