@stacksjs/buddy 0.70.57 → 0.70.58

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 +1 -1
package/dist/index.js CHANGED
@@ -3217,7 +3217,7 @@ export default {
3217
3217
  },
3218
3218
  } satisfies QueueConfig
3219
3219
  `};async function _B(K,G,V){let X=V.root?MB(V.root,`config/${K}.ts`):l3(`config/${K}.ts`),U=Bun.file(X);if(!await U.exists()){if(!V.createIfMissing)return"missing";return await Bun.write(X,Cb[K]),"created"}let H=await U.text(),W=/(^|\{)(\s*)enabled\s*:\s*(true|false)(\s*,?)/m;if(W.test(H)){let F=H.replace(W,(L,z,q,O,Z)=>{if(O===String(G))return`${z}${q}enabled: ${O}${Z}`;return`${z}${q}enabled: ${G}${Z}`});if(F===H)return"unchanged";return await Bun.write(X,F),"flipped"}let B=/(export default\s*\{)/;if(!B.test(H))throw Error(`Could not locate \`export default {\` in ${X} \u2014 please add \`enabled: ${G}\` manually.`);let Y=H.replace(B,`$1
3220
- enabled: ${G},`);return await Bun.write(X,Y),"flipped"}async function X_(K={}){let G=K.root??l3(),V=[];for(let X of n3){let U=await _B(X,!1,{createIfMissing:!1,root:G}),H=await V_(X,G);V.push({feature:X,configOutcome:U,filesRemoved:H})}return V}function Sb(K,G){let V=Jb[G],X=`config/${G}.ts`;K.command(`${G}:install`,`Activate the ${G} feature bundle. ${V}`).option("--force",`Overwrite any existing ${G} files in the project (default skips existing paths so the install is idempotent).`).action(async(U)=>{try{switch(await _B(G,!0,{createIfMissing:!0})){case"created":console.log(`\u2713 Created ${X} with '${G}' enabled.`);break;case"flipped":console.log(`\u2713 Enabled '${G}' in ${X}.`);break;case"unchanged":console.log(`\u2713 '${G}' is already enabled in ${X}.`);break}let{copied:W}=await Pb(G,{force:U.force===!0});if(W.length>0){console.log(`\u2713 Copied ${W.length} stamped path(s) from framework defaults:`);for(let B of W)console.log(` - ${B}`)}else if(ZV(G).length>0)console.log(` \u2192 ${G} scaffolding already in place \u2014 use --force to overwrite.`);console.log(` \u2192 next ./buddy dev will boot with ${G} loaded.`),OV.exit(MV.Success)}catch(H){console.error(`\u2717 Failed to install ${G}:`,H),OV.exit(MV.FatalError)}}),K.command(`${G}:uninstall`,`Deactivate the ${G} feature bundle.`).option("--keep-files",`Don't delete the ${G} scaffolding (action/model/view files). Flip the flag only.`).action(async(U)=>{try{switch(await _B(G,!1,{createIfMissing:!1})){case"missing":console.log(`\u2713 '${G}' is already disabled (${X} is absent).`);break;case"flipped":console.log(`\u2713 Disabled '${G}' in ${X}. Custom config preserved.`);break;case"unchanged":console.log(`\u2713 '${G}' is already disabled in ${X}.`);break;case"created":console.log(`\u2717 Unexpected create on uninstall for ${G}; please re-run with --force or report this bug.`);break}if(U.keepFiles){let W=ZV(G);if(W.length>0)console.log(` \u2192 ${W.length} stamped path(s) preserved (--keep-files).`)}else{let W=await V_(G);if(W.length>0){console.log(`\u2713 Removed ${W.length} stamped path(s):`);for(let B of W)console.log(` - ${B}`)}}console.log(` \u2192 next ./buddy dev will boot without ${G}.`),OV.exit(MV.Success)}catch(H){console.error(`\u2717 Failed to uninstall ${G}:`,H),OV.exit(MV.FatalError)}})}function zO0(K){for(let G of n3)Sb(K,G)}IV();function yO0(K){let G={name:"The name of the project",command:"Create a new Stacks project",ui:"Are you building a UI?",components:"Are you building UI components?",webComponents:"Automagically built optimized custom elements/web components?",vue:"Automagically built a Vue component library?",views:"How about views?",functions:"Are you developing functions/composables?",api:"Are you building an API?",database:"Do you need a database?",notifications:"Do you need notifications? e.g. email, SMS, push or chat notifications",cache:"Do you need caching?",email:"Do you need email?",project:"Target a specific project",minimal:"Skip optional feature bundles (cms, commerce, dashboard, marketing, monitoring, realtime, queue) \u2014 bare-bones API/SPA starter that can re-add them later via `./buddy <feature>:install`.",verbose:"Enable verbose output"};K.command("new [name]",G.command).alias("create [name]").option("-n, --name [name]",G.name,{default:!1}).option("-u, --ui",G.ui,{default:!0}).option("-c, --components",G.components,{default:!0}).option("-w, --web-components",G.webComponents,{default:!0}).option("-v, --vue",G.vue,{default:!0}).option("-p, --views",G.views,{default:!0}).option("-f, --functions",G.functions,{default:!0}).option("-a, --api",G.api,{default:!0}).option("-d, --database",G.database,{default:!0}).option("-ca, --cache",G.cache,{default:!1}).option("-e, --email",G.email,{default:!1}).option("-p, --project [project]",G.project,{default:!1}).option("-m, --minimal",G.minimal,{default:!1}).option("--verbose",G.verbose,{default:!1}).action(async(V,X)=>{M6.debug("Running `buddy new <name>` ...",X);let U=await Vf("buddy new");V=V??X.name;let H=W_(K2.cwd(),V);Bf(H),Yf();let W=await Ff(V,H,X);if(W.isErr)M6.error(W.error),K2.exit(b2.FatalError);if(await zf(H,X),Lf(H),await qf(H,X),X.minimal)await Of(H);if(U){let B=performance.now()-U;M6.success(Gf(`[${B.toFixed(2)}ms] Completed`))}M6.info(eb("Welcome to the Stacks Framework! \u269B\uFE0F")),M6.info("To learn more, visit https://stacksjs.com"),K2.exit(b2.Success)}),Xf(K,"new")}function Bf(K){if(Hf(K))M6.error(`Path ${K} already exists`),K2.exit(b2.FatalError)}function Yf(){if(!Wf())M6.info("It appears you are disconnected from the internet."),M6.info("The Stacks setup requires a brief internet connection for setup."),M6.info("For instance, it installs your dependencies from."),K2.exit(b2.FatalError)}async function Ff(K,G,V){M6.info("Setting up your stack.");try{let{downloadTemplate:X}=await import("@stacksjs/gitit");return await X("stacks",{dir:K}),M6.success(`Successfully scaffolded your project at ${Kf(G)}`),{isErr:!1}}catch(X){return{isErr:!0,error:X instanceof Error?X.message:String(X)}}}function Lf(K){for(let G of["buddy","bootstrap"])try{ab(W_(K,G),493)}catch{}}async function zf(K,G){M6.info("Ensuring your environment is ready..."),await b9(),await f9(K),M6.success("Environment is ready")}async function qf(K,G){M6.info("Installing & setting up Stacks"),M6.info("Running bun install...");let V=await QB("bun install",{...G,cwd:K});if(V?.isErr)M6.error(V.error),K2.exit(b2.FatalError);if(M6.info("Copying .env.example \u2192 .env"),V=await QB("cp .env.example .env",{...G,cwd:K}),V?.isErr)M6.error(V.error),K2.exit(b2.FatalError);M6.info("Generating application key...");let X=await tb(Uf.KeyGenerate,{...G,cwd:K});if(X.isErr)M6.error(X.error),K2.exit(b2.FatalError);if(M6.info("Initializing git repository..."),V=await QB("git init",{...G,cwd:K}),V.isErr)M6.error(V.error),K2.exit(b2.FatalError);M6.success("Installed & set-up \uD83D\uDE80")}async function Of(K){M6.info("Stripping optional feature bundles (--minimal)...");let G=await X_({root:K}),V=!1;for(let{feature:X,configOutcome:U,filesRemoved:H}of G)if(U==="flipped"||H.length>0){V=!0;let W=H.length>0?` (${H.length} path${H.length===1?"":"s"})`:"";M6.info(` - ${X}${W}`)}if(!V)M6.info(" \u2192 no feature scaffolding present; nothing to strip.");else M6.success("Minimal skeleton ready \u2014 run `./buddy <feature>:install` to add features back.")}NB();import{execSync as w5}from"child_process";import{existsSync as K8,readdirSync as S10,readFileSync as bJ}from"fs";import vJ from"readline";import O0 from"process";import{bold as e2,cyan as a8,dim as F0,green as t8,intro as PU,log as d7,onUnknownSubcommand as x10,outro as W9,prompts as k10,runCommand as v10,yellow as B9}from"@stacksjs/cli";import{homedir as xU}from"os";import{dirname as WG,join as G8}from"path";import{fileURLToPath as wz}from"url";import{Action as yJ}from"@stacksjs/enums";import{libsPath as y10,projectPath as _8}from"@stacksjs/path";import{ExitCode as q2}from"@stacksjs/types";var C_="0.70.57";var $10=3;function h10(){if(!O0.stdout.isTTY)return;for(let K=0;K<$10;K++)vJ.moveCursor(O0.stdout,0,-1),vJ.clearLine(O0.stdout,0)}var JU;function fJ(){return[_8("node_modules/@stacksjs/rpx/dist/index.js"),G8(xU(),"Code/Tools/rpx/packages/rpx/dist/index.js"),_8("pantry/@stacksjs/rpx/dist/src/index.js")].find((G)=>K8(G))??null}async function Y9(){if(JU)return JU;let K=fJ();return JU=K?await import(K):await import("@stacksjs/rpx"),JU}var SU=[],Iz;async function s8(){if(!Iz)Iz=await import("@stacksjs/actions");return Iz}function tj0(K){let G={dev:"Start development server",frontend:"Start the frontend development server",components:"Start the Components development server",desktop:"Start the Desktop App development server",native:"Start the app in a native Craft window",dashboard:"Start the Dashboard development server",api:"Start the local API development server",email:"Start the Email development server",docs:"Start the Documentation development server",systemTray:"Start the System Tray development server",interactive:"Get asked which development server to start",select:"Which development server are you trying to start?",withLocalhost:"Include the localhost URL in the output",project:"Target a specific project",verbose:"Enable verbose output"};K.command("dev [server]",G.dev).option("-f, --frontend",G.frontend).option("-a, --api",G.api).option("-e, --email",G.email).option("-c, --components",G.components).option("-d, --dashboard",G.dashboard).option("-k, --desktop",G.desktop).option("-n, --native",G.native).option("-o, --docs",G.docs).option("-s, --system-tray",G.systemTray).option("-i, --interactive",G.interactive,{default:!1}).option("-l, --with-localhost",G.withLocalhost,{default:!1}).option("-p, --project [project]",G.project,{default:!1}).option("--verbose",G.verbose,{default:!1}).action(async(V,X)=>{let U=Bun.nanoseconds(),H=V||(X.frontend?"frontend":void 0)||(X.api?"api":void 0)||(X.components?"components":void 0)||(X.dashboard?"dashboard":void 0)||(X.desktop?"desktop":void 0)||(X.native?"native":void 0)||(X.systemTray||X["system-tray"]?"system-tray":void 0)||(X.docs?"docs":void 0);if(H){let W={...X},B=await s8();switch(H){case"native":await CU({...W,native:!0},U);break;case"frontend":await B.runFrontendDevServer(W);break;case"api":await B.runApiDevServer(W);break;case"components":await B.runComponentsDevServer(W);break;case"dashboard":await B.runDashboardDevServer(W);break;case"desktop":await B.runDesktopDevServer(W);break;case"system-tray":await B.runSystemTrayDevServer(W);break;case"docs":await B.runDocsDevServer(W);break;default:d7.error(`Unknown server: ${H}`),O0.exit(q2.InvalidArgument)}}else if(q90(X)){let B=(await k10({type:"select",name:"value",message:G.select,choices:[{value:"all",title:"All"},{value:"frontend",title:"Frontend"},{value:"api",title:"Backend"},{value:"dashboard",title:"Dashboard"},{value:"desktop",title:"Desktop"},{value:"native",title:"Native App"},{value:"email",title:"Email"},{value:"components",title:"Components"},{value:"docs",title:"Documentation"}]})).value;if(B==="components")await(await s8()).runComponentsDevServer(X);else if(B==="api")await(await s8()).runApiDevServer(X);else if(B==="dashboard")await(await s8()).runDashboardDevServer(X);else if(B==="native")await CU({...X,native:!0},U);else if(B==="docs")await(await s8()).runDocsDevServer(X);else d7.error("Invalid option during interactive mode"),O0.exit(q2.InvalidArgument)}else await CU(X,U);W9("Exited",{startTime:U,useSeconds:!0}),O0.exit(q2.Success)}),K.command("dev:components",G.components).option("-p, --project [project]",G.project,{default:!1}).option("--verbose",G.verbose,{default:!1}).action(async(V)=>{let X=await PU("buddy dev:components"),U=await v10("bun run dev",{cwd:y10("components/vue")});if(V.verbose)d7.info("buddy dev:components result",U);if(U.isErr)await W9("While running the dev:components command, there was an issue",{startTime:X,useSeconds:!0},U.error),O0.exit(q2.FatalError);console.log(""),await W9("Exited",{startTime:X,useSeconds:!0}),O0.exit(q2.Success)}),K.command("dev:docs",G.docs).option("-p, --project [project]",G.project,{default:!1}).option("--verbose",G.verbose,{default:!1}).action(async(V)=>{let X=await PU("buddy dev:docs"),U=await(await s8()).runAction(yJ.DevDocs,V);if(U.isErr)await W9("While running the dev:docs command, there was an issue",{startTime:X,useSeconds:!0},U.error),O0.exit(q2.FatalError);console.log(""),await W9("Exited",{startTime:X,useSeconds:!0}),O0.exit(q2.Success)}),K.command("dev:native",G.native).option("-p, --project [project]",G.project,{default:!1}).option("--verbose",G.verbose,{default:!1}).action(async(V)=>{let X=await PU("buddy dev:native");await CU({...V,native:!0},X)}),K.command("dev:desktop",G.desktop).option("-p, --project [project]",G.project,{default:!1}).option("--verbose",G.verbose,{default:!1}).action(async(V)=>{let X=await PU("buddy dev:desktop"),U=await(await s8()).runAction(yJ.DevDesktop,V);if(U.isErr)await W9("While running the dev:desktop command, there was an issue",{startTime:X,useSeconds:!0},U.error),O0.exit(q2.FatalError);console.log(""),await W9("Exited",{startTime:X,useSeconds:!0}),O0.exit(q2.Success)}),K.command("dev:api",G.api).option("-p, --project [project]",G.project,{default:!1}).option("--no-watch-types","Skip the model/config type-regeneration watcher",{default:!1}).option("--verbose",G.verbose,{default:!1}).action(async(V)=>{let X=await s8();if(V.watchTypes!==!1)X.watchTypes(V).catch((U)=>{d7.warn("[dev:api] type watcher exited:",U)});await X.runApiDevServer(V)}),K.command("dev:frontend",G.frontend).alias("dev:pages").alias("dev:views").option("-p, --project [project]",G.project,{default:!1}).option("--verbose",G.verbose,{default:!1}).action(async(V)=>{await(await s8()).runFrontendDevServer(V)}),K.command("dev:dashboard",G.dashboard).alias("dev:admin").option("-p, --project [project]",G.project,{default:!1}).option("--verbose",G.verbose,{default:!1}).action(async(V)=>{await(await s8()).runDashboardDevServer(V)}),K.command("dev:system-tray",G.systemTray).alias("dev:tray").option("-p, --project [project]",G.project,{default:!1}).option("--verbose",G.verbose,{default:!1}).action(async(V)=>{await(await s8()).runSystemTrayDevServer(V)}),x10(K,"dev")}async function CU(K,G){let V=K,X=G,U=O0.env.APP_URL,H=V.native===!0,W=O0.env.STACKS_PROXY_MANAGED==="1",B=Number(O0.env.PORT)||3000,Y=Number(O0.env.PORT_API)||3008,F=Number(O0.env.PORT_DOCS)||3006,L=Number(O0.env.PORT_ADMIN)||3002,z=O0.env.STACKS_DEV_DASHBOARD==="1",q=!H&&U&&U!=="localhost"&&!U.includes("localhost:"),O=q?U.replace(/^https?:\/\//,""):null,Z=q&&!W,M=O?`dashboard.${O}`:null,Q=O?`https://${O}`:`http://localhost:${B}`,j=O?`https://${O}/api`:`http://localhost:${Y}`,I=O?`https://${O}/docs`:`http://localhost:${F}`,P=M?`https://${M}`:`http://localhost:${L}`,x=[B,Y,F,...z?[L]:[]];if(O0.env.STACKS_PROXY_MANAGED="1",O0.env.STACKS_DEV_QUIET="1",console.log(),console.log(` ${e2(a8("stacks"))} ${F0(`v${C_}`)} ${F0("starting\u2026")}`),console.log(),O0.env.STACKS_DEV_NO_KILL!=="1")await p10(x);let S=Z&&O?F90({domain:O,includeDashboard:z,options:V}):Promise.resolve();S.catch(()=>{});let v=!1,J,c=1500,T=()=>{if(v)return;v=!0,J?.(),cJ(SU),SU.length=0;try{O0.kill(-O0.pid,"SIGTERM")}catch{try{O0.kill(0,"SIGTERM")}catch{}}setTimeout(()=>{try{O0.kill(0,"SIGKILL")}catch{O0.exit(1)}},c).unref()};O0.on("SIGINT",T),O0.on("SIGTERM",T);let $={...V,quiet:!0},y=await s8(),l=[{name:"Frontend",port:B},{name:"API",port:Y}],X0=30000,G0=!1,f0=`http://localhost:${B}`,_0=H?$J(B,X0).then(async(Y0)=>{if(!Y0){d7.warn(`Native window skipped because the frontend did not answer within ${X0/1000}s`);return}J=await m10(f0,V)}):Promise.resolve();Promise.all(l.map((Y0)=>$J(Y0.port,X0))).then(async(Y0)=>{if(G0)return;G0=!0;let B6=Y0.map((k6,L5)=>k6?null:l[L5].name).filter((k6)=>k6!==null),c0=!1;if(Z&&O){if((async()=>{try{await S,await z90({domain:O,frontendPort:B,apiPort:Y,docsPort:F,dashboardPort:L,includeDashboard:z,options:V})}catch{}})(),c0=await t10(443,16000),!c0){if(console.log(` ${B9("\u26A0")} ${B9("HTTPS proxy not reachable on :443")} \u2014 serving ${a8(`http://localhost:${B}`)} instead`),console.log(` ${F0(" ")}${F0("rpx needs a valid SUDO_PASSWORD in .env to bind :443; trust the local CA, then restart `./buddy dev`.")}`),V.verbose)console.log(` ${F0(" ")}${F0(`Trust CA: sh ${G8(h4,"trust-rpx-cert.sh")}`)}`)}}if(h10(),g10({options:V,nativeMode:H,hasCustomDomain:!!q,proxyReachable:W?!0:c0,frontendUrl:Q,apiUrl:j,docsUrl:I,dashboardUrl:P,frontendPort:B,apiPort:Y,docsPort:F,includeDashboard:z,domain:O,dashboardPort:L,dashboardDomain:M}),X){let k6=(Bun.nanoseconds()-X)/1e6,L5=B6.length?`ready in ${(k6/1000).toFixed(1)}s \u2014 ${B6.join(", ")} did not bind within ${X0/1000}s`:`ready in ${(k6/1000).toFixed(1)}s`;console.log(` ${F0(L5)}`),console.log(),u10(),console.log()}if(O0.env.STACKS_PRINT_ROUTES==="1")await s10(Y).catch(()=>{})}).catch(()=>{}),await Promise.all([y.runFrontendDevServer($).catch((Y0)=>{if(V.verbose)d7.error(`Frontend: ${Y0}`)}),y.runApiDevServer($).catch((Y0)=>{if(V.verbose)d7.error(`API: ${Y0}`)}),y.runDocsDevServer($).catch((Y0)=>{if(V.verbose)d7.error(`Docs: ${Y0}`)}),z?y.runDashboardDevServer($).catch((Y0)=>{if(V.verbose)d7.error(`Dashboard: ${Y0}`)}):Promise.resolve(),_0.catch((Y0)=>{if(V.verbose)d7.warn(`Native window: ${Y0}`)})])}function b10(){if(K8(_8("storage/framework/coming-soon")))return!0;try{let K=_8("resources/views/index.stx");return K8(K)&&/siteMode\s*=\s*['"]coming-soon['"]/.test(bJ(K,"utf8"))}catch{return!1}}function f10(){try{let K=_8("content/blog");return K8(K)&&S10(K).some((G)=>G.endsWith(".md"))}catch{return!1}}function g10(K){let{options:G,nativeMode:V,hasCustomDomain:X,proxyReachable:U,frontendUrl:H,apiUrl:W,docsUrl:B,dashboardUrl:Y,frontendPort:F,apiPort:L,docsPort:z,includeDashboard:q,domain:O,dashboardPort:Z,dashboardDomain:M}=K,Q=G.verbose??!1,j=Q||G.withLocalhost===!0,I=X&&U,P=I?H:`http://localhost:${F}`,x=I?W:`http://localhost:${L}`,S=I?B:`http://localhost:${z}`,v=`${P.replace(/\/$/,"")}/blog`;if(console.log(),console.log(` ${t8("\u279C")} ${e2("Frontend")}: ${a8(P)}`),j&&I)console.log(` ${F0("\u279C")} ${F0("Local")}: ${F0(`http://localhost:${F}`)}`);if(V)console.log(` ${t8("\u279C")} ${e2("Native")}: ${a8(`Craft \u2192 http://localhost:${F}`)}`);if(console.log(` ${t8("\u279C")} ${e2("API")}: ${a8(x)}`),j&&I)console.log(` ${F0("\u279C")} ${F0("Local API")}: ${F0(`http://localhost:${L}`)}`);if(console.log(` ${t8("\u279C")} ${e2("Docs")}: ${a8(S)}`),j&&I)console.log(` ${F0("\u279C")} ${F0("Local docs")}: ${F0(`http://localhost:${z}`)}`);if(f10())console.log(` ${t8("\u279C")} ${e2("Blog")}: ${a8(v)}`);if(q)console.log(` ${t8("\u279C")} ${e2("Dashboard")}: ${a8(Y)}`);if(b10())console.log(),console.log(` ${B9("\u25CF")} ${e2(B9("Coming soon mode"))} ${F0("\u2014 visitors see the holding page; bypass with the coming-soon secret.")}`);if(Q&&O){if(console.log(` ${F0("\u279C")} ${F0("Proxy")}: ${F0(`localhost:${F} \u2192 ${O}`)}`),console.log(` ${F0("\u279C")} ${F0("Proxy")}: ${F0(`${H}/api \u2192 localhost:${L}`)}`),console.log(` ${F0("\u279C")} ${F0("Proxy")}: ${F0(`${H}/docs \u2192 localhost:${z}`)}`),q)console.log(` ${F0("\u279C")} ${F0("Proxy")}: ${F0(`localhost:${Z} \u2192 ${M}`)}`)}console.log()}function u10(){let K=G8(_8(),".stx/routes.ts"),G=G8(_8(),"config/crosswind.ts");if(K8(G)||K8(G8(_8(),"crosswind.config.ts")))console.log(` ${t8("[Crosswind]")} ${F0("CSS engine loaded")}`);if(K8(K))try{let U=(bJ(K,"utf8").match(/pattern:/g)??[]).length;if(U>0)console.log(` ${t8("[stx]")} ${F0(`Generated ${U} routes \u2192 .stx/routes.ts`)}`)}catch{console.log(` ${t8("[stx]")} ${F0("Routes manifest \u2192 .stx/routes.ts")}`)}}async function m10(K,G){let V;try{V=(await d10()).createApp}catch(W){if(G.verbose)d7.warn(`Native window unavailable: ${W}`);console.log(` ${F0("Native window unavailable. Install craft-native or set CRAFT_BIN to a Craft binary.")}
3220
+ enabled: ${G},`);return await Bun.write(X,Y),"flipped"}async function X_(K={}){let G=K.root??l3(),V=[];for(let X of n3){let U=await _B(X,!1,{createIfMissing:!1,root:G}),H=await V_(X,G);V.push({feature:X,configOutcome:U,filesRemoved:H})}return V}function Sb(K,G){let V=Jb[G],X=`config/${G}.ts`;K.command(`${G}:install`,`Activate the ${G} feature bundle. ${V}`).option("--force",`Overwrite any existing ${G} files in the project (default skips existing paths so the install is idempotent).`).action(async(U)=>{try{switch(await _B(G,!0,{createIfMissing:!0})){case"created":console.log(`\u2713 Created ${X} with '${G}' enabled.`);break;case"flipped":console.log(`\u2713 Enabled '${G}' in ${X}.`);break;case"unchanged":console.log(`\u2713 '${G}' is already enabled in ${X}.`);break}let{copied:W}=await Pb(G,{force:U.force===!0});if(W.length>0){console.log(`\u2713 Copied ${W.length} stamped path(s) from framework defaults:`);for(let B of W)console.log(` - ${B}`)}else if(ZV(G).length>0)console.log(` \u2192 ${G} scaffolding already in place \u2014 use --force to overwrite.`);console.log(` \u2192 next ./buddy dev will boot with ${G} loaded.`),OV.exit(MV.Success)}catch(H){console.error(`\u2717 Failed to install ${G}:`,H),OV.exit(MV.FatalError)}}),K.command(`${G}:uninstall`,`Deactivate the ${G} feature bundle.`).option("--keep-files",`Don't delete the ${G} scaffolding (action/model/view files). Flip the flag only.`).action(async(U)=>{try{switch(await _B(G,!1,{createIfMissing:!1})){case"missing":console.log(`\u2713 '${G}' is already disabled (${X} is absent).`);break;case"flipped":console.log(`\u2713 Disabled '${G}' in ${X}. Custom config preserved.`);break;case"unchanged":console.log(`\u2713 '${G}' is already disabled in ${X}.`);break;case"created":console.log(`\u2717 Unexpected create on uninstall for ${G}; please re-run with --force or report this bug.`);break}if(U.keepFiles){let W=ZV(G);if(W.length>0)console.log(` \u2192 ${W.length} stamped path(s) preserved (--keep-files).`)}else{let W=await V_(G);if(W.length>0){console.log(`\u2713 Removed ${W.length} stamped path(s):`);for(let B of W)console.log(` - ${B}`)}}console.log(` \u2192 next ./buddy dev will boot without ${G}.`),OV.exit(MV.Success)}catch(H){console.error(`\u2717 Failed to uninstall ${G}:`,H),OV.exit(MV.FatalError)}})}function zO0(K){for(let G of n3)Sb(K,G)}IV();function yO0(K){let G={name:"The name of the project",command:"Create a new Stacks project",ui:"Are you building a UI?",components:"Are you building UI components?",webComponents:"Automagically built optimized custom elements/web components?",vue:"Automagically built a Vue component library?",views:"How about views?",functions:"Are you developing functions/composables?",api:"Are you building an API?",database:"Do you need a database?",notifications:"Do you need notifications? e.g. email, SMS, push or chat notifications",cache:"Do you need caching?",email:"Do you need email?",project:"Target a specific project",minimal:"Skip optional feature bundles (cms, commerce, dashboard, marketing, monitoring, realtime, queue) \u2014 bare-bones API/SPA starter that can re-add them later via `./buddy <feature>:install`.",verbose:"Enable verbose output"};K.command("new [name]",G.command).alias("create [name]").option("-n, --name [name]",G.name,{default:!1}).option("-u, --ui",G.ui,{default:!0}).option("-c, --components",G.components,{default:!0}).option("-w, --web-components",G.webComponents,{default:!0}).option("-v, --vue",G.vue,{default:!0}).option("-p, --views",G.views,{default:!0}).option("-f, --functions",G.functions,{default:!0}).option("-a, --api",G.api,{default:!0}).option("-d, --database",G.database,{default:!0}).option("-ca, --cache",G.cache,{default:!1}).option("-e, --email",G.email,{default:!1}).option("-p, --project [project]",G.project,{default:!1}).option("-m, --minimal",G.minimal,{default:!1}).option("--verbose",G.verbose,{default:!1}).action(async(V,X)=>{M6.debug("Running `buddy new <name>` ...",X);let U=await Vf("buddy new");V=V??X.name;let H=W_(K2.cwd(),V);Bf(H),Yf();let W=await Ff(V,H,X);if(W.isErr)M6.error(W.error),K2.exit(b2.FatalError);if(await zf(H,X),Lf(H),await qf(H,X),X.minimal)await Of(H);if(U){let B=performance.now()-U;M6.success(Gf(`[${B.toFixed(2)}ms] Completed`))}M6.info(eb("Welcome to the Stacks Framework! \u269B\uFE0F")),M6.info("To learn more, visit https://stacksjs.com"),K2.exit(b2.Success)}),Xf(K,"new")}function Bf(K){if(Hf(K))M6.error(`Path ${K} already exists`),K2.exit(b2.FatalError)}function Yf(){if(!Wf())M6.info("It appears you are disconnected from the internet."),M6.info("The Stacks setup requires a brief internet connection for setup."),M6.info("For instance, it installs your dependencies from."),K2.exit(b2.FatalError)}async function Ff(K,G,V){M6.info("Setting up your stack.");try{let{downloadTemplate:X}=await import("@stacksjs/gitit");return await X("stacks",{dir:K}),M6.success(`Successfully scaffolded your project at ${Kf(G)}`),{isErr:!1}}catch(X){return{isErr:!0,error:X instanceof Error?X.message:String(X)}}}function Lf(K){for(let G of["buddy","bootstrap"])try{ab(W_(K,G),493)}catch{}}async function zf(K,G){M6.info("Ensuring your environment is ready..."),await b9(),await f9(K),M6.success("Environment is ready")}async function qf(K,G){M6.info("Installing & setting up Stacks"),M6.info("Running bun install...");let V=await QB("bun install",{...G,cwd:K});if(V?.isErr)M6.error(V.error),K2.exit(b2.FatalError);if(M6.info("Copying .env.example \u2192 .env"),V=await QB("cp .env.example .env",{...G,cwd:K}),V?.isErr)M6.error(V.error),K2.exit(b2.FatalError);M6.info("Generating application key...");let X=await tb(Uf.KeyGenerate,{...G,cwd:K});if(X.isErr)M6.error(X.error),K2.exit(b2.FatalError);if(M6.info("Initializing git repository..."),V=await QB("git init",{...G,cwd:K}),V.isErr)M6.error(V.error),K2.exit(b2.FatalError);M6.success("Installed & set-up \uD83D\uDE80")}async function Of(K){M6.info("Stripping optional feature bundles (--minimal)...");let G=await X_({root:K}),V=!1;for(let{feature:X,configOutcome:U,filesRemoved:H}of G)if(U==="flipped"||H.length>0){V=!0;let W=H.length>0?` (${H.length} path${H.length===1?"":"s"})`:"";M6.info(` - ${X}${W}`)}if(!V)M6.info(" \u2192 no feature scaffolding present; nothing to strip.");else M6.success("Minimal skeleton ready \u2014 run `./buddy <feature>:install` to add features back.")}NB();import{execSync as w5}from"child_process";import{existsSync as K8,readdirSync as S10,readFileSync as bJ}from"fs";import vJ from"readline";import O0 from"process";import{bold as e2,cyan as a8,dim as F0,green as t8,intro as PU,log as d7,onUnknownSubcommand as x10,outro as W9,prompts as k10,runCommand as v10,yellow as B9}from"@stacksjs/cli";import{homedir as xU}from"os";import{dirname as WG,join as G8}from"path";import{fileURLToPath as wz}from"url";import{Action as yJ}from"@stacksjs/enums";import{libsPath as y10,projectPath as _8}from"@stacksjs/path";import{ExitCode as q2}from"@stacksjs/types";var C_="0.70.58";var $10=3;function h10(){if(!O0.stdout.isTTY)return;for(let K=0;K<$10;K++)vJ.moveCursor(O0.stdout,0,-1),vJ.clearLine(O0.stdout,0)}var JU;function fJ(){return[_8("node_modules/@stacksjs/rpx/dist/index.js"),G8(xU(),"Code/Tools/rpx/packages/rpx/dist/index.js"),_8("pantry/@stacksjs/rpx/dist/src/index.js")].find((G)=>K8(G))??null}async function Y9(){if(JU)return JU;let K=fJ();return JU=K?await import(K):await import("@stacksjs/rpx"),JU}var SU=[],Iz;async function s8(){if(!Iz)Iz=await import("@stacksjs/actions");return Iz}function tj0(K){let G={dev:"Start development server",frontend:"Start the frontend development server",components:"Start the Components development server",desktop:"Start the Desktop App development server",native:"Start the app in a native Craft window",dashboard:"Start the Dashboard development server",api:"Start the local API development server",email:"Start the Email development server",docs:"Start the Documentation development server",systemTray:"Start the System Tray development server",interactive:"Get asked which development server to start",select:"Which development server are you trying to start?",withLocalhost:"Include the localhost URL in the output",project:"Target a specific project",verbose:"Enable verbose output"};K.command("dev [server]",G.dev).option("-f, --frontend",G.frontend).option("-a, --api",G.api).option("-e, --email",G.email).option("-c, --components",G.components).option("-d, --dashboard",G.dashboard).option("-k, --desktop",G.desktop).option("-n, --native",G.native).option("-o, --docs",G.docs).option("-s, --system-tray",G.systemTray).option("-i, --interactive",G.interactive,{default:!1}).option("-l, --with-localhost",G.withLocalhost,{default:!1}).option("-p, --project [project]",G.project,{default:!1}).option("--verbose",G.verbose,{default:!1}).action(async(V,X)=>{let U=Bun.nanoseconds(),H=V||(X.frontend?"frontend":void 0)||(X.api?"api":void 0)||(X.components?"components":void 0)||(X.dashboard?"dashboard":void 0)||(X.desktop?"desktop":void 0)||(X.native?"native":void 0)||(X.systemTray||X["system-tray"]?"system-tray":void 0)||(X.docs?"docs":void 0);if(H){let W={...X},B=await s8();switch(H){case"native":await CU({...W,native:!0},U);break;case"frontend":await B.runFrontendDevServer(W);break;case"api":await B.runApiDevServer(W);break;case"components":await B.runComponentsDevServer(W);break;case"dashboard":await B.runDashboardDevServer(W);break;case"desktop":await B.runDesktopDevServer(W);break;case"system-tray":await B.runSystemTrayDevServer(W);break;case"docs":await B.runDocsDevServer(W);break;default:d7.error(`Unknown server: ${H}`),O0.exit(q2.InvalidArgument)}}else if(q90(X)){let B=(await k10({type:"select",name:"value",message:G.select,choices:[{value:"all",title:"All"},{value:"frontend",title:"Frontend"},{value:"api",title:"Backend"},{value:"dashboard",title:"Dashboard"},{value:"desktop",title:"Desktop"},{value:"native",title:"Native App"},{value:"email",title:"Email"},{value:"components",title:"Components"},{value:"docs",title:"Documentation"}]})).value;if(B==="components")await(await s8()).runComponentsDevServer(X);else if(B==="api")await(await s8()).runApiDevServer(X);else if(B==="dashboard")await(await s8()).runDashboardDevServer(X);else if(B==="native")await CU({...X,native:!0},U);else if(B==="docs")await(await s8()).runDocsDevServer(X);else d7.error("Invalid option during interactive mode"),O0.exit(q2.InvalidArgument)}else await CU(X,U);W9("Exited",{startTime:U,useSeconds:!0}),O0.exit(q2.Success)}),K.command("dev:components",G.components).option("-p, --project [project]",G.project,{default:!1}).option("--verbose",G.verbose,{default:!1}).action(async(V)=>{let X=await PU("buddy dev:components"),U=await v10("bun run dev",{cwd:y10("components/vue")});if(V.verbose)d7.info("buddy dev:components result",U);if(U.isErr)await W9("While running the dev:components command, there was an issue",{startTime:X,useSeconds:!0},U.error),O0.exit(q2.FatalError);console.log(""),await W9("Exited",{startTime:X,useSeconds:!0}),O0.exit(q2.Success)}),K.command("dev:docs",G.docs).option("-p, --project [project]",G.project,{default:!1}).option("--verbose",G.verbose,{default:!1}).action(async(V)=>{let X=await PU("buddy dev:docs"),U=await(await s8()).runAction(yJ.DevDocs,V);if(U.isErr)await W9("While running the dev:docs command, there was an issue",{startTime:X,useSeconds:!0},U.error),O0.exit(q2.FatalError);console.log(""),await W9("Exited",{startTime:X,useSeconds:!0}),O0.exit(q2.Success)}),K.command("dev:native",G.native).option("-p, --project [project]",G.project,{default:!1}).option("--verbose",G.verbose,{default:!1}).action(async(V)=>{let X=await PU("buddy dev:native");await CU({...V,native:!0},X)}),K.command("dev:desktop",G.desktop).option("-p, --project [project]",G.project,{default:!1}).option("--verbose",G.verbose,{default:!1}).action(async(V)=>{let X=await PU("buddy dev:desktop"),U=await(await s8()).runAction(yJ.DevDesktop,V);if(U.isErr)await W9("While running the dev:desktop command, there was an issue",{startTime:X,useSeconds:!0},U.error),O0.exit(q2.FatalError);console.log(""),await W9("Exited",{startTime:X,useSeconds:!0}),O0.exit(q2.Success)}),K.command("dev:api",G.api).option("-p, --project [project]",G.project,{default:!1}).option("--no-watch-types","Skip the model/config type-regeneration watcher",{default:!1}).option("--verbose",G.verbose,{default:!1}).action(async(V)=>{let X=await s8();if(V.watchTypes!==!1)X.watchTypes(V).catch((U)=>{d7.warn("[dev:api] type watcher exited:",U)});await X.runApiDevServer(V)}),K.command("dev:frontend",G.frontend).alias("dev:pages").alias("dev:views").option("-p, --project [project]",G.project,{default:!1}).option("--verbose",G.verbose,{default:!1}).action(async(V)=>{await(await s8()).runFrontendDevServer(V)}),K.command("dev:dashboard",G.dashboard).alias("dev:admin").option("-p, --project [project]",G.project,{default:!1}).option("--verbose",G.verbose,{default:!1}).action(async(V)=>{await(await s8()).runDashboardDevServer(V)}),K.command("dev:system-tray",G.systemTray).alias("dev:tray").option("-p, --project [project]",G.project,{default:!1}).option("--verbose",G.verbose,{default:!1}).action(async(V)=>{await(await s8()).runSystemTrayDevServer(V)}),x10(K,"dev")}async function CU(K,G){let V=K,X=G,U=O0.env.APP_URL,H=V.native===!0,W=O0.env.STACKS_PROXY_MANAGED==="1",B=Number(O0.env.PORT)||3000,Y=Number(O0.env.PORT_API)||3008,F=Number(O0.env.PORT_DOCS)||3006,L=Number(O0.env.PORT_ADMIN)||3002,z=O0.env.STACKS_DEV_DASHBOARD==="1",q=!H&&U&&U!=="localhost"&&!U.includes("localhost:"),O=q?U.replace(/^https?:\/\//,""):null,Z=q&&!W,M=O?`dashboard.${O}`:null,Q=O?`https://${O}`:`http://localhost:${B}`,j=O?`https://${O}/api`:`http://localhost:${Y}`,I=O?`https://${O}/docs`:`http://localhost:${F}`,P=M?`https://${M}`:`http://localhost:${L}`,x=[B,Y,F,...z?[L]:[]];if(O0.env.STACKS_PROXY_MANAGED="1",O0.env.STACKS_DEV_QUIET="1",console.log(),console.log(` ${e2(a8("stacks"))} ${F0(`v${C_}`)} ${F0("starting\u2026")}`),console.log(),O0.env.STACKS_DEV_NO_KILL!=="1")await p10(x);let S=Z&&O?F90({domain:O,includeDashboard:z,options:V}):Promise.resolve();S.catch(()=>{});let v=!1,J,c=1500,T=()=>{if(v)return;v=!0,J?.(),cJ(SU),SU.length=0;try{O0.kill(-O0.pid,"SIGTERM")}catch{try{O0.kill(0,"SIGTERM")}catch{}}setTimeout(()=>{try{O0.kill(0,"SIGKILL")}catch{O0.exit(1)}},c).unref()};O0.on("SIGINT",T),O0.on("SIGTERM",T);let $={...V,quiet:!0},y=await s8(),l=[{name:"Frontend",port:B},{name:"API",port:Y}],X0=30000,G0=!1,f0=`http://localhost:${B}`,_0=H?$J(B,X0).then(async(Y0)=>{if(!Y0){d7.warn(`Native window skipped because the frontend did not answer within ${X0/1000}s`);return}J=await m10(f0,V)}):Promise.resolve();Promise.all(l.map((Y0)=>$J(Y0.port,X0))).then(async(Y0)=>{if(G0)return;G0=!0;let B6=Y0.map((k6,L5)=>k6?null:l[L5].name).filter((k6)=>k6!==null),c0=!1;if(Z&&O){if((async()=>{try{await S,await z90({domain:O,frontendPort:B,apiPort:Y,docsPort:F,dashboardPort:L,includeDashboard:z,options:V})}catch{}})(),c0=await t10(443,16000),!c0){if(console.log(` ${B9("\u26A0")} ${B9("HTTPS proxy not reachable on :443")} \u2014 serving ${a8(`http://localhost:${B}`)} instead`),console.log(` ${F0(" ")}${F0("rpx needs a valid SUDO_PASSWORD in .env to bind :443; trust the local CA, then restart `./buddy dev`.")}`),V.verbose)console.log(` ${F0(" ")}${F0(`Trust CA: sh ${G8(h4,"trust-rpx-cert.sh")}`)}`)}}if(h10(),g10({options:V,nativeMode:H,hasCustomDomain:!!q,proxyReachable:W?!0:c0,frontendUrl:Q,apiUrl:j,docsUrl:I,dashboardUrl:P,frontendPort:B,apiPort:Y,docsPort:F,includeDashboard:z,domain:O,dashboardPort:L,dashboardDomain:M}),X){let k6=(Bun.nanoseconds()-X)/1e6,L5=B6.length?`ready in ${(k6/1000).toFixed(1)}s \u2014 ${B6.join(", ")} did not bind within ${X0/1000}s`:`ready in ${(k6/1000).toFixed(1)}s`;console.log(` ${F0(L5)}`),console.log(),u10(),console.log()}if(O0.env.STACKS_PRINT_ROUTES==="1")await s10(Y).catch(()=>{})}).catch(()=>{}),await Promise.all([y.runFrontendDevServer($).catch((Y0)=>{if(V.verbose)d7.error(`Frontend: ${Y0}`)}),y.runApiDevServer($).catch((Y0)=>{if(V.verbose)d7.error(`API: ${Y0}`)}),y.runDocsDevServer($).catch((Y0)=>{if(V.verbose)d7.error(`Docs: ${Y0}`)}),z?y.runDashboardDevServer($).catch((Y0)=>{if(V.verbose)d7.error(`Dashboard: ${Y0}`)}):Promise.resolve(),_0.catch((Y0)=>{if(V.verbose)d7.warn(`Native window: ${Y0}`)})])}function b10(){if(K8(_8("storage/framework/coming-soon")))return!0;try{let K=_8("resources/views/index.stx");return K8(K)&&/siteMode\s*=\s*['"]coming-soon['"]/.test(bJ(K,"utf8"))}catch{return!1}}function f10(){try{let K=_8("content/blog");return K8(K)&&S10(K).some((G)=>G.endsWith(".md"))}catch{return!1}}function g10(K){let{options:G,nativeMode:V,hasCustomDomain:X,proxyReachable:U,frontendUrl:H,apiUrl:W,docsUrl:B,dashboardUrl:Y,frontendPort:F,apiPort:L,docsPort:z,includeDashboard:q,domain:O,dashboardPort:Z,dashboardDomain:M}=K,Q=G.verbose??!1,j=Q||G.withLocalhost===!0,I=X&&U,P=I?H:`http://localhost:${F}`,x=I?W:`http://localhost:${L}`,S=I?B:`http://localhost:${z}`,v=`${P.replace(/\/$/,"")}/blog`;if(console.log(),console.log(` ${t8("\u279C")} ${e2("Frontend")}: ${a8(P)}`),j&&I)console.log(` ${F0("\u279C")} ${F0("Local")}: ${F0(`http://localhost:${F}`)}`);if(V)console.log(` ${t8("\u279C")} ${e2("Native")}: ${a8(`Craft \u2192 http://localhost:${F}`)}`);if(console.log(` ${t8("\u279C")} ${e2("API")}: ${a8(x)}`),j&&I)console.log(` ${F0("\u279C")} ${F0("Local API")}: ${F0(`http://localhost:${L}`)}`);if(console.log(` ${t8("\u279C")} ${e2("Docs")}: ${a8(S)}`),j&&I)console.log(` ${F0("\u279C")} ${F0("Local docs")}: ${F0(`http://localhost:${z}`)}`);if(f10())console.log(` ${t8("\u279C")} ${e2("Blog")}: ${a8(v)}`);if(q)console.log(` ${t8("\u279C")} ${e2("Dashboard")}: ${a8(Y)}`);if(b10())console.log(),console.log(` ${B9("\u25CF")} ${e2(B9("Coming soon mode"))} ${F0("\u2014 visitors see the holding page; bypass with the coming-soon secret.")}`);if(Q&&O){if(console.log(` ${F0("\u279C")} ${F0("Proxy")}: ${F0(`localhost:${F} \u2192 ${O}`)}`),console.log(` ${F0("\u279C")} ${F0("Proxy")}: ${F0(`${H}/api \u2192 localhost:${L}`)}`),console.log(` ${F0("\u279C")} ${F0("Proxy")}: ${F0(`${H}/docs \u2192 localhost:${z}`)}`),q)console.log(` ${F0("\u279C")} ${F0("Proxy")}: ${F0(`localhost:${Z} \u2192 ${M}`)}`)}console.log()}function u10(){let K=G8(_8(),".stx/routes.ts"),G=G8(_8(),"config/crosswind.ts");if(K8(G)||K8(G8(_8(),"crosswind.config.ts")))console.log(` ${t8("[Crosswind]")} ${F0("CSS engine loaded")}`);if(K8(K))try{let U=(bJ(K,"utf8").match(/pattern:/g)??[]).length;if(U>0)console.log(` ${t8("[stx]")} ${F0(`Generated ${U} routes \u2192 .stx/routes.ts`)}`)}catch{console.log(` ${t8("[stx]")} ${F0("Routes manifest \u2192 .stx/routes.ts")}`)}}async function m10(K,G){let V;try{V=(await d10()).createApp}catch(W){if(G.verbose)d7.warn(`Native window unavailable: ${W}`);console.log(` ${F0("Native window unavailable. Install craft-native or set CRAFT_BIN to a Craft binary.")}
3221
3221
  `);return}if(!V){console.log(` ${F0("Native window unavailable. The Craft SDK did not export createApp.")}
3222
3222
  `);return}let X=n10();if(!X){console.log(` ${F0("Native window unavailable. Set CRAFT_BIN to a Craft binary, or install Craft in ~/Code/Tools/craft.")}
3223
3223
  `);return}let U=i10(),H=V({url:K,quiet:!G.verbose,craftPath:X,window:{title:await o10(),width:1280,height:860,titlebarHidden:!0,webSidebarMaterial:!0,webSidebarWidth:286,webSidebarMaterialOpacity:0.78,...U&&{icon:U}}});return H.show().catch((W)=>{if(G.verbose)d7.warn(`Native window exited: ${W}`)}),()=>H.close()}async function d10(){let K=O0.env.HOME?`${O0.env.HOME}/Code/Tools/craft/packages/typescript/src/index.ts`:void 0;if(K&&K8(K))return await import(K);try{return await Promise.resolve().then(() => (kJ(),xJ))}catch(G){try{return await import("@craft-native/craft")}catch{try{return await import("@stacksjs/ts-craft")}catch{throw G}}}}async function p10(K){let G=_8(),V=_8("storage/framework/core/actions/src/dev/"),X=new Set;for(let U of K)for(let H of await c10(U)){if(H===O0.pid)continue;let W=await l10(H);if(!W.includes(G))continue;if(W.includes("storage/framework/core/buddy/src/cli.ts dev")||W.includes("storage/framework/core/actions/src/dev/")||W.includes(V))X.add(H)}if(X.size===0)return;for(let U of X)try{O0.kill(U,"SIGTERM")}catch{}await new Promise((U)=>setTimeout(U,250));for(let U of X)try{O0.kill(U,"SIGKILL")}catch{}await new Promise((U)=>setTimeout(U,150))}async function c10(K){try{let G=Bun.spawn(["lsof","-nP",`-iTCP:${K}`,"-sTCP:LISTEN","-t"],{stdout:"pipe",stderr:"ignore"}),V=await new Response(G.stdout).text();return await G.exited,V.split(/\s+/).map((X)=>Number(X)).filter((X)=>Number.isInteger(X)&&X>0)}catch{return[]}}async function l10(K){try{let G=Bun.spawn(["ps","-p",String(K),"-o","command="],{stdout:"pipe",stderr:"ignore"}),V=await new Response(G.stdout).text();return await G.exited,V.trim()}catch{return""}}function n10(){let K=O0.env.HOME;return[O0.env.CRAFT_BIN,K?`${K}/Code/Tools/craft/craft`:void 0,K?`${K}/Code/Tools/craft/bin/craft`:void 0,K?`${K}/Code/Tools/craft/packages/zig/zig-out/bin/craft`:void 0,K?`${K}/Documents/Projects/craft/packages/zig/zig-out/bin/craft`:void 0].filter((V)=>Boolean(V)).find((V)=>K8(V))}function i10(){return[_8("resources/assets/images/app-icon.png"),_8("resources/assets/images/icon.png"),_8("public/icon.png")].find((G)=>K8(G))}async function o10(){try{let K=await Bun.file(_8("package.json")).json(),G=typeof K.productName==="string"?K.productName:K.name;if(typeof G==="string"&&G.length>0)return G.split(/[-_\s]+/).filter(Boolean).map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(" ")}catch{}return"Stacks App"}var r10={GET:a8,POST:t8,PUT:a8,PATCH:a8,DELETE:a8,OPTIONS:F0};async function s10(K){try{let G=new AbortController,V=setTimeout(()=>G.abort(),1500),X=await fetch(`http://127.0.0.1:${K}/__routes`,{signal:G.signal}).catch(()=>null);if(clearTimeout(V),!X||!X.ok)return;let U=await X.json();if(!Array.isArray(U)||U.length===0)return;let H=[...U].sort((B,Y)=>B.path.localeCompare(Y.path)||B.method.localeCompare(Y.method)),W=Math.max(...H.map((B)=>B.path.length));console.log(` ${F0("Registered routes")}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/buddy",
3
3
  "type": "module",
4
- "version": "0.70.57",
4
+ "version": "0.70.58",
5
5
  "description": "Meet Buddy. The Stacks runtime.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [