// @bun
import{A as f,B as j,C as I,D as J,G as g,H as p,J as a,K as m,a as M,b as N,c as O,d as Q,e as R,f as S,h as T,i as U,k as V,l as W,m as X,n as Y,o as Z,p as _,q as $,r as x,s as z,t as C,u as F,v as P,w as h,x as A,y as D,z as k}from"./chunk-3vjfkr7v.js";import"./chunk-d3awsfqm.js";import"./chunk-pv6hp18q.js";import"./chunk-b3wr7cpk.js";import"./chunk-9bxh78vd.js";import"./chunk-xmdbxa8w.js";import"./chunk-ra5sfgg4.js";import"./chunk-jr4naxsv.js";import"./chunk-hrsat16n.js";import"./chunk-yktee4wv.js";import"./chunk-yvmyw2r2.js";import w from"process";import{runAction as n}from"@stacksjs/actions";import{cli as l,log as v}from"@stacksjs/cli";import{Action as i}from"@stacksjs/enums";import{path as L}from"@stacksjs/path";import{fs as c}from"@stacksjs/storage";import{ensureProjectIsInitialized as t}from"@stacksjs/utils";w.on("uncaughtException",(q)=>{v.debug("Buddy uncaughtException"),v.error(q),w.exit(1)});w.on("unhandledRejection",(q)=>{v.debug("Buddy unhandledRejection"),v.error(q),w.exit(1)});async function e(){let q=l("buddy");if(J(q),$(q),await t())v.debug("Project is initialized");else{v.info("Your `APP_KEY` is not yet set"),v.info("Generating application key...");let B=await n(i.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),W(q),T(q),V(q),h(q),D(q),X(q),Y(q),Z(q),_(q),x(q),z(q),C(q),F(q),P(q),k(q),f(q),j(q),I(q),J(q),g(q),p(q),m(q),A(q),a(q),await o(q),q.help(),q.parse()}await e();async function o(q){let G=L.appPath("Commands"),B=c.readdirSync(G).filter((E)=>E.endsWith(".ts"));for(let E of B){let 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)}let K=await import(L.listenersPath("Console.ts"));if(typeof K.default==="function")K.default(q)}
