// @bun
import"./chunk-t49ytmk0.js";import{A,B as D,C as k,D as f,E as j,F as J,I,J as g,L as p,M as a,d as M,e as N,f as O,g as Q,h as R,i as S,k as T,l as U,n as V,o as W,p as X,q as Y,r as Z,s as _,t as $,u as x,v as z,w as C,x as F,y as P,z as h}from"./chunk-pf356ggx.js";import"./chunk-wmfxrbxe.js";import"./chunk-a6jhzhht.js";import"./chunk-v1w6bgfy.js";import"./chunk-5bf9sq7t.js";import"./chunk-ac1gbd0g.js";import"./chunk-agapayce.js";import"./chunk-vc4pnt6y.js";import"./chunk-59vbpar7.js";import w from"process";import{runAction as m}from"@stacksjs/actions";import{cli as n,log as v}from"@stacksjs/cli";import{Action as l}from"@stacksjs/enums";import{path as L}from"@stacksjs/path";import{fs as i}from"@stacksjs/storage";import{ensureProjectIsInitialized as c}from"@stacksjs/utils";async function t(){const q=n("buddy");if(J(q),z(q),await c())v.debug("Project is initialized");else{v.info("Your `APP_KEY` is not yet set"),v.info("Generating application key...");const B=await m(l.KeyGenerate);if(B.isErr())v.error("Failed to set random application key.",B.error),w.exit()}M(q),N(q),O(q),Q(q),R(q),S(q),U(q),V(q),T(q),W(q),h(q),D(q),X(q),Y(q),Z(q),x(q),_(q),$(q),C(q),F(q),P(q),k(q),f(q),j(q),J(q),I(q),g(q),a(q),A(q),p(q),await e(q),q.help(),q.parse()}async function e(q){const G=L.appPath("Commands"),B=i.readdirSync(G).filter((E)=>E.endsWith(".ts"));for(let E of B){const H=await import(`${G}/${E}`);if(typeof H.default==="function")H.default(q);else console.error(`Expected a default export function in ${E}, but got:`,H.default)}const K=await import(L.listenersPath("Console.ts"));if(typeof K.default==="function")K.default(q)}w.on("uncaughtException",(q)=>{v.debug("uncaughtException"),v.error(q),w.exit(1)});w.on("unhandledRejection",(q)=>{v.debug("unhandledRejection",q),v.error(q),w.exit(1)});await t();

//# debugId=98CD31F4F04EAB8C64756E2164756E21
//# sourceMappingURL=cli.js.map
