@stacksjs/buddy 0.70.23 → 0.70.28
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/README.md +15 -23
- package/dist/cli.js +3 -1
- package/dist/index.js +449 -1
- package/dist/src/cli.d.ts +1 -0
- package/dist/src/commands/about.d.ts +2 -0
- package/dist/src/commands/auth.d.ts +2 -0
- package/dist/src/commands/build.d.ts +2 -0
- package/dist/src/commands/changelog.d.ts +2 -0
- package/dist/src/commands/clean.d.ts +2 -0
- package/dist/src/commands/cloud.d.ts +2 -0
- package/dist/src/commands/commit.d.ts +2 -0
- package/dist/src/commands/completion.d.ts +2 -0
- package/dist/src/commands/config-migrate.d.ts +26 -0
- package/dist/src/commands/configure.d.ts +2 -0
- package/dist/src/commands/create.d.ts +2 -0
- package/dist/src/commands/deploy.d.ts +2 -0
- package/dist/{dev.d.ts → src/commands/dev.d.ts} +1 -3
- package/dist/src/commands/dns.d.ts +2 -0
- package/dist/src/commands/doctor.d.ts +2 -0
- package/dist/src/commands/domains.d.ts +2 -0
- package/dist/src/commands/email.d.ts +2 -0
- package/dist/src/commands/env.d.ts +2 -0
- package/dist/src/commands/fresh.d.ts +2 -0
- package/dist/src/commands/generate.d.ts +2 -0
- package/dist/src/commands/http.d.ts +2 -0
- package/dist/src/commands/index.d.ts +49 -0
- package/dist/src/commands/install.d.ts +2 -0
- package/dist/src/commands/key.d.ts +2 -0
- package/dist/src/commands/lint.d.ts +2 -0
- package/dist/src/commands/list.d.ts +2 -0
- package/dist/src/commands/mail.d.ts +2 -0
- package/dist/src/commands/make.d.ts +2 -0
- package/dist/src/commands/migrate.d.ts +2 -0
- package/dist/src/commands/outdated.d.ts +2 -0
- package/dist/src/commands/phone.d.ts +2 -0
- package/dist/src/commands/ports.d.ts +2 -0
- package/dist/src/commands/prepublish.d.ts +2 -0
- package/dist/src/commands/projects.d.ts +2 -0
- package/dist/src/commands/publish.d.ts +2 -0
- package/dist/src/commands/queue.d.ts +2 -0
- package/dist/src/commands/release.d.ts +2 -0
- package/dist/src/commands/route.d.ts +2 -0
- package/dist/src/commands/saas.d.ts +2 -0
- package/dist/src/commands/schedule.d.ts +2 -0
- package/dist/src/commands/search.d.ts +2 -0
- package/dist/src/commands/seed.d.ts +2 -0
- package/dist/src/commands/setup.d.ts +12 -0
- package/dist/src/commands/sms.d.ts +2 -0
- package/dist/src/commands/telemetry.d.ts +2 -0
- package/dist/src/commands/test.d.ts +2 -0
- package/dist/src/commands/tinker.d.ts +2 -0
- package/dist/src/commands/types.d.ts +2 -0
- package/dist/src/commands/upgrade.d.ts +2 -0
- package/dist/src/commands/version.d.ts +2 -0
- package/dist/src/index.d.ts +1 -0
- package/package.json +64 -61
- package/dist/add.d.ts +0 -4
- package/dist/build.d.ts +0 -4
- package/dist/changelog.d.ts +0 -3
- package/dist/chunk-1nq7pv3c.js +0 -7
- package/dist/chunk-29k4nndh.js +0 -2
- package/dist/chunk-39dwerh8.js +0 -5
- package/dist/chunk-3zqgxrhy.js +0 -2
- package/dist/chunk-496r9jw6.js +0 -3
- package/dist/chunk-4k60zpwd.js +0 -2
- package/dist/chunk-51tnc6dm.js +0 -2
- package/dist/chunk-5nbczt72.js +0 -2
- package/dist/chunk-6fsr2f40.js +0 -10
- package/dist/chunk-6v69415e.js +0 -2
- package/dist/chunk-7pg49t20.js +0 -2
- package/dist/chunk-8d01gfhw.js +0 -2
- package/dist/chunk-8kjkww7q.js +0 -8
- package/dist/chunk-97pfgxpz.js +0 -15
- package/dist/chunk-a47wfx2k.js +0 -2
- package/dist/chunk-cqrmkpzz.js +0 -8
- package/dist/chunk-ftse0wqn.js +0 -5410
- package/dist/chunk-jffk6kjy.js +0 -2
- package/dist/chunk-kg8bv5wt.js +0 -55
- package/dist/chunk-knytfag6.js +0 -33
- package/dist/chunk-ksjzw2hp.js +0 -2
- package/dist/chunk-mk0bde63.js +0 -2
- package/dist/chunk-qm8eqyn5.js +0 -2
- package/dist/chunk-rdgds02z.js +0 -3
- package/dist/chunk-sk9vc7y5.js +0 -1
- package/dist/chunk-sq3kqg71.js +0 -35
- package/dist/chunk-t2wb516a.js +0 -3
- package/dist/chunk-t4y0mz3y.js +0 -10
- package/dist/chunk-vgn2n3rk.js +0 -2
- package/dist/chunk-wzns1fp3.js +0 -1
- package/dist/chunk-xc6fz0pt.js +0 -2
- package/dist/chunk-xfhw9xck.js +0 -240
- package/dist/chunk-yzwe58rn.js +0 -25
- package/dist/clean.d.ts +0 -3
- package/dist/cli.d.ts +0 -4
- package/dist/cloud.d.ts +0 -3
- package/dist/commit.d.ts +0 -3
- package/dist/configure.d.ts +0 -4
- package/dist/create.d.ts +0 -8
- package/dist/custom-cli.d.ts +0 -1
- package/dist/deploy.d.ts +0 -7
- package/dist/dns.d.ts +0 -18
- package/dist/domains.d.ts +0 -3
- package/dist/env.d.ts +0 -20
- package/dist/fresh.d.ts +0 -3
- package/dist/generate.d.ts +0 -3
- package/dist/http.d.ts +0 -6
- package/dist/index.d.ts +0 -1
- package/dist/install.d.ts +0 -3
- package/dist/key.d.ts +0 -3
- package/dist/lint.d.ts +0 -3
- package/dist/list.d.ts +0 -3
- package/dist/make.d.ts +0 -1
- package/dist/migrate.d.ts +0 -3
- package/dist/outdated.d.ts +0 -3
- package/dist/ports.d.ts +0 -6
- package/dist/prepublish.d.ts +0 -3
- package/dist/projects.d.ts +0 -3
- package/dist/queue.d.ts +0 -3
- package/dist/release.d.ts +0 -9
- package/dist/route.d.ts +0 -3
- package/dist/saas.d.ts +0 -3
- package/dist/schedule.d.ts +0 -3
- package/dist/search.d.ts +0 -3
- package/dist/seed.d.ts +0 -3
- package/dist/setup.d.ts +0 -8
- package/dist/test.d.ts +0 -3
- package/dist/tinker.d.ts +0 -3
- package/dist/types.d.ts +0 -3
- package/dist/upgrade.d.ts +0 -4
- package/dist/version.d.ts +0 -3
package/README.md
CHANGED
|
@@ -31,10 +31,10 @@ In other words, Stacks helps you, as a developer, every step along the way—in
|
|
|
31
31
|
It’s incredibly easy to get started with this framework. Simply run the following command in your terminal:
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
curl -Ssf stacksjs.
|
|
34
|
+
curl -Ssf stacksjs.com/install | sh # wip
|
|
35
35
|
|
|
36
|
-
# alternatively, if Bun >= v1.1.11 is installed already
|
|
37
|
-
# you may also get started via
|
|
36
|
+
# alternatively, if Bun >= v1.1.11 is installed already
|
|
37
|
+
# you may also get started via
|
|
38
38
|
bunx stacks new my-project
|
|
39
39
|
```
|
|
40
40
|
|
|
@@ -112,7 +112,7 @@ buddy development # `buddy dev` alias
|
|
|
112
112
|
|
|
113
113
|
buddy share # creates a sharable link to your local project
|
|
114
114
|
|
|
115
|
-
# for Laravel folks, `serve` may ring more familiar than the `dev` name. Hence, we aliased it
|
|
115
|
+
# for Laravel folks, `serve` may ring more familiar than the `dev` name. Hence, we aliased it
|
|
116
116
|
buddy serve
|
|
117
117
|
buddy serve:components
|
|
118
118
|
buddy serve:desktop
|
|
@@ -128,7 +128,6 @@ buddy build:library # builds any or all libraries
|
|
|
128
128
|
buddy build:functions # builds function library
|
|
129
129
|
buddy build:components # builds Vue component library & Web Component library
|
|
130
130
|
buddy build:web-components # builds framework agnostic Web Component library (i.e. Custom Elements)
|
|
131
|
-
buddy build:vue-components # builds Vue 2 & 3-ready Component library
|
|
132
131
|
buddy build:all # builds all your code
|
|
133
132
|
|
|
134
133
|
# `buddy build` aliases
|
|
@@ -138,7 +137,6 @@ buddy prod:desktop
|
|
|
138
137
|
buddy prod:library
|
|
139
138
|
buddy prod:views
|
|
140
139
|
buddy prod:functions
|
|
141
|
-
buddy prod:vue-components
|
|
142
140
|
buddy prod:web-components
|
|
143
141
|
buddy prod:all
|
|
144
142
|
buddy production # `buddy prod` alias
|
|
@@ -162,21 +160,15 @@ buddy migrate # runs database migrations
|
|
|
162
160
|
buddy migrate:dns # sets the ./config/dns.ts file
|
|
163
161
|
|
|
164
162
|
buddy dns example.com # list all DNS records for example.com
|
|
165
|
-
buddy dns example.com --type MX # list MX records for example.com
|
|
163
|
+
buddy dns example.com --type MX # list MX records for example.com
|
|
166
164
|
|
|
167
|
-
buddy https
|
|
165
|
+
buddy https example.com/api/hello
|
|
168
166
|
# http [flags] [METHOD] URL [ITEM [ITEM]]
|
|
169
167
|
buddy http --help
|
|
170
|
-
buddy http PUT
|
|
171
|
-
buddy http -v
|
|
172
|
-
buddy http
|
|
173
|
-
buddy http
|
|
174
|
-
buddy http -a USERNAME POST https://api.github.com/repos/httpie/cli/issues/83/comments body='HTTPie is awesome! :heart:'
|
|
175
|
-
buddy http pie.dev/post < files/data.json
|
|
176
|
-
buddy http pie.dev/image/png > image.png
|
|
177
|
-
buddy http --download pie.dev/image/png
|
|
178
|
-
buddy http --session=logged-in -a username:password pie.dev/get API-Key:123
|
|
179
|
-
buddy http --session=logged-in pie.dev/headers
|
|
168
|
+
buddy http PUT example.com/api/put X-API-Token:123 name=John # Custom HTTP method, HTTP headers and JSON data
|
|
169
|
+
buddy http -v example.com/api/get # See the request that is being sent using one of the output options
|
|
170
|
+
buddy http POST example.com/api/post hello=World # submitting forms
|
|
171
|
+
buddy http -a USERNAME POST https://api.github.com/repos/user/repo/issues/83/comments body='Great feature! :heart:'
|
|
180
172
|
buddy http localhost:8000 Host:example.com
|
|
181
173
|
|
|
182
174
|
buddy lint # runs linter
|
|
@@ -221,11 +213,11 @@ buddy types:generate # generates types for your components, functions, & views
|
|
|
221
213
|
buddy types:fix # auto-fixes types for your components, functions, & views
|
|
222
214
|
|
|
223
215
|
buddy domains # alias for `buddy domains:list`
|
|
224
|
-
buddy domains:add stacksjs.
|
|
225
|
-
buddy domains:remove stacksjs.
|
|
216
|
+
buddy domains:add stacksjs.com # adds a domain
|
|
217
|
+
buddy domains:remove stacksjs.com # removes a domain
|
|
226
218
|
buddy domains:list # lists all domains
|
|
227
219
|
buddy domains:update # apply ./config/dns.ts updates
|
|
228
|
-
buddy domains:purchase stacksjs.
|
|
220
|
+
buddy domains:purchase stacksjs.com # purchase a new domain
|
|
229
221
|
|
|
230
222
|
# test your stack
|
|
231
223
|
buddy test # runs test suite (unit & e2e)
|
|
@@ -233,7 +225,7 @@ buddy test:coverage # runs test coverage
|
|
|
233
225
|
buddy test:types # runs typecheck
|
|
234
226
|
|
|
235
227
|
# the CLI may be triggered in any
|
|
236
|
-
# of the following syntax
|
|
228
|
+
# of the following syntax
|
|
237
229
|
stx fresh
|
|
238
230
|
buddy fresh
|
|
239
231
|
bud fresh
|
|
@@ -258,7 +250,7 @@ _Develop dynamic UIs with helpers for atomic design, and much more._
|
|
|
258
250
|
- 🖥️ **Desktop** _transforms your web app into a desktop app, plus more_
|
|
259
251
|
- 📝 **Documentation** _markdown-based documentation, auto-generated_
|
|
260
252
|
- 📚 **Library** _auto-builds & manages component & function libraries_
|
|
261
|
-
- ⚡️ Powered by Bun, Tauri,
|
|
253
|
+
- ⚡️ Powered by Bun, Tauri, Headwind, Vite, VitePress and Vue
|
|
262
254
|
|
|
263
255
|
### Backend Development
|
|
264
256
|
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{$ as X,Aa as i,Ba as c,P as M,Q as N,R as O,S as Q,T as R,U as S,W as T,X as U,Z as V,_ as W,aa as Y,ba as Z,ca as _,da as $,ea as x,fa as z,ga as C,ha as F,ia as P,ja as h,ka as A,la as D,ma as k,na as f,oa as j,pa as I,qa as g,ra as p,sa as a,ta as m,ua as J,xa as n,ya as l}from"./chunk-ftse0wqn.js";import"./chunk-xfhw9xck.js";import"./chunk-29k4nndh.js";import"./chunk-t4y0mz3y.js";import"./chunk-knytfag6.js";import"./chunk-cqrmkpzz.js";import"./chunk-97pfgxpz.js";import"./chunk-6v69415e.js";import"./chunk-wzns1fp3.js";import"./chunk-5nbczt72.js";import"./chunk-39dwerh8.js";import"./chunk-yzwe58rn.js";import"./chunk-6fsr2f40.js";import"./chunk-sk9vc7y5.js";import"./chunk-xc6fz0pt.js";import"./chunk-4k60zpwd.js";import"./chunk-8kjkww7q.js";import"./chunk-3zqgxrhy.js";import"./chunk-ksjzw2hp.js";import w from"node:process";import{runAction as t}from"@stacksjs/actions";import{cli as e,log as v}from"@stacksjs/cli";import{Action as o}from"@stacksjs/enums";import{path as L}from"@stacksjs/path";import{fs as r}from"@stacksjs/storage";import{ensureProjectIsInitialized as b}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 s(){let q=e("buddy");if(J(q),x(q),await b())v.debug("Project is initialized");else{v.info("Your `APP_KEY` is not yet set"),v.info("Generating application key...");let B=await t(o.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),A(q),k(q),Y(q),Z(q),_(q),$(q),z(q),C(q),F(q),P(q),h(q),f(q),j(q),I(q),g(q),a(q),X(q),m(q),J(q),p(q),n(q),l(q),c(q),D(q),i(q),await y(q),q.help(),q.parse()}await s();async function y(q){let G=L.appPath("Commands"),B=r.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)}
|
|
2
|
+
var o=Object.defineProperty;var JJ=(J)=>J;function QJ(J,Q){this[J]=JJ.bind(null,Q)}var E=(J,Q)=>{for(var Z in Q)o(J,Z,{get:Q[Z],enumerable:!0,configurable:!0,set:QJ.bind(Q,Z)})};var P=(J,Q)=>()=>(J&&(Q=J(J=0)),Q);var q=import.meta.require;var p={};E(p,{validateConfig:()=>y,loadPlugins:()=>ZJ,loadBuddyConfig:()=>f,applyBuddyConfig:()=>$J});import{existsSync as XJ}from"fs";import{log as L}from"@stacksjs/cli";import{path as I}from"@stacksjs/path";function y(J){let Q=[];if(typeof J!=="object"||J===null)return Q.push({path:"config",message:"Config must be an object",value:J}),Q;if(J.theme!==void 0){let X=["default","dracula","nord","solarized","monokai"];if(typeof J.theme!=="string"||!X.includes(J.theme))Q.push({path:"theme",message:`Theme must be one of: ${X.join(", ")}`,value:J.theme})}if(J.emoji!==void 0&&typeof J.emoji!=="boolean")Q.push({path:"emoji",message:"Emoji must be a boolean",value:J.emoji});if(J.commands!==void 0)if(!Array.isArray(J.commands))Q.push({path:"commands",message:"Commands must be an array",value:J.commands});else J.commands.forEach((X,$)=>{if(typeof X!=="function")Q.push({path:`commands[${$}]`,message:"Each command must be a function",value:X})});if(J.defaultFlags!==void 0)if(typeof J.defaultFlags!=="object"||J.defaultFlags===null)Q.push({path:"defaultFlags",message:"Default flags must be an object",value:J.defaultFlags});else{let X=["verbose","quiet","debug"];for(let $ of Object.keys(J.defaultFlags))if(!X.includes($))Q.push({path:`defaultFlags.${$}`,message:`Unknown flag. Valid flags are: ${X.join(", ")}`,value:J.defaultFlags[$]});else if(typeof J.defaultFlags[$]!=="boolean")Q.push({path:`defaultFlags.${$}`,message:"Flag value must be a boolean",value:J.defaultFlags[$]})}if(J.aliases!==void 0){if(typeof J.aliases!=="object"||J.aliases===null||Array.isArray(J.aliases))Q.push({path:"aliases",message:"Aliases must be an object mapping alias names to command names",value:J.aliases});else for(let[X,$]of Object.entries(J.aliases))if(typeof $!=="string")Q.push({path:`aliases.${X}`,message:"Alias target must be a string",value:$})}if(J.plugins!==void 0)if(!Array.isArray(J.plugins))Q.push({path:"plugins",message:"Plugins must be an array",value:J.plugins});else J.plugins.forEach((X,$)=>{if(typeof X==="string")return;if(typeof X!=="object"||X===null){Q.push({path:`plugins[${$}]`,message:"Each plugin must be an object or a string (module path)",value:X});return}if(!X.name||typeof X.name!=="string")Q.push({path:`plugins[${$}].name`,message:"Plugin must have a name property of type string",value:X.name});if(!X.setup||typeof X.setup!=="function")Q.push({path:`plugins[${$}].setup`,message:"Plugin must have a setup function",value:X.setup});if(X.hooks!==void 0){if(typeof X.hooks!=="object"||X.hooks===null)Q.push({path:`plugins[${$}].hooks`,message:"Plugin hooks must be an object",value:X.hooks})}});let Z=["theme","emoji","commands","defaultFlags","aliases","plugins"];for(let X of Object.keys(J))if(!Z.includes(X))Q.push({path:X,message:`Unknown configuration key. Valid keys are: ${Z.join(", ")}`,value:J[X]});return Q}async function f(){if(A)return A;let J=[I.projectPath("buddy.config.ts"),I.projectPath("buddy.config.js"),I.projectPath(".buddy.config.ts"),I.projectPath(".buddy.config.js")];for(let Q of J)if(XJ(Q))try{L.debug(`Loading buddy config from ${Q}`);let Z=await import(Q),X=Z.default||Z,$=y(X);if($.length>0){L.error("Invalid buddy.config.ts:");for(let W of $)L.error(` - ${W.path}: ${W.message}`);throw Error("Configuration validation failed")}return A=X,A}catch(Z){L.warn(`Failed to load buddy config from ${Q}:`,Z)}return A={},A}async function ZJ(J,Q){if(!Q.plugins||Q.plugins.length===0)return;L.debug(`Loading ${Q.plugins.length} plugin(s)`);for(let Z of Q.plugins){let X;if(typeof Z==="string")try{let $=await import(Z);X=$.default||$}catch($){L.error(`Failed to load plugin from ${Z}:`,$);continue}else X=Z;try{if(L.debug(`Initializing plugin: ${X.name}${X.version?` v${X.version}`:""}`),await X.setup(J),X.hooks){if(X.hooks.beforeCommand)J.on("command:*",async($)=>{if(X.hooks?.beforeCommand)await X.hooks.beforeCommand({command:$})});if(X.hooks.afterCommand)J.on("command:*",async($)=>{if(X.hooks?.afterCommand)await X.hooks.afterCommand({command:$})})}L.debug(`Plugin ${X.name} initialized successfully`)}catch($){L.error(`Failed to initialize plugin ${X.name}:`,$)}}}async function $J(J){let Q=await f();if(Q.emoji!==void 0&&J.options.noEmoji===void 0)J.useEmoji=Q.emoji;if(Q.defaultFlags){if(Q.defaultFlags.verbose&&!J.isVerbose)J.isVerbose=!0;if(Q.defaultFlags.quiet&&!J.isQuiet)J.isQuiet=!0;if(Q.defaultFlags.debug&&!J.isDebug)J.isDebug=!0}if(Q.commands&&Array.isArray(Q.commands)){for(let Z of Q.commands)if(typeof Z==="function")Z(J)}if(Q.aliases)for(let[Z,X]of Object.entries(Q.aliases)){let $=J.commands.find((W)=>W.name===X);if($&&!$.aliasNames.includes(Z))$.aliasNames.push(Z)}}var A=null;var u=()=>{};var k={};E(k,{markLoaded:()=>BJ,loadCommands:()=>h,loadCommandGroup:()=>GJ,loadCommand:()=>l,loadAllCommands:()=>VJ,getCommandsToLoad:()=>YJ,getCommandNames:()=>zJ});function m(J){return`${J.path}#${J.exportName}`}function BJ(J,Q){let Z=Y[Q];if(!Z)return;let X=T.get(J);if(!X)X=new Set,T.set(J,X);X.add(m(Z))}async function l(J,Q){let Z=Y[J];if(!Z)return!1;let X=T.get(Q);if(!X)X=new Set,T.set(Q,X);let $=m(Z);if(X.has($))return!0;X.add($);try{let B=(await import(Z.path))[Z.exportName];if(typeof B==="function")return B(Q),!0;else return!1}catch{return!1}}async function h(J,Q){let Z=(W)=>new Promise((B,V)=>setTimeout(()=>V(Error("timeout")),W)),X=new Set,$=[];for(let W of J){let B=Y[W],V=B?`${B.path}#${B.exportName}`:`name:${W}`;if(X.has(V))continue;X.add(V),$.push(W)}await Promise.all($.map(async(W)=>{try{await Promise.race([l(W,Q),Z(5000)])}catch{}}))}async function GJ(J,Q){let Z=WJ[J];if(Z)await h(Z,Q)}async function VJ(J){let Q=Object.keys(Y);await h(Q,J)}function zJ(){return Object.keys(Y)}function YJ(J){let Q=J[0],Z=Q==="--version"||Q==="-v",X=Q==="--help"||Q==="-h",$=Q==="help";if(Z)return["version"];if(!Q||X||$)return Object.keys(Y);let W=Q.split(":")[0];if(W==="list")return["list",...Object.keys(Y).filter((B)=>B!=="list")];if(Y[W])return[W];if(Q.includes(":")){let B=W;if(Y[B])return[B]}return Object.keys(Y)}var Y,WJ,T;var C=P(()=>{Y={about:{path:"./commands/about.ts",exportName:"about"},add:{path:"./commands/add.ts",exportName:"add"},auth:{path:"./commands/auth.ts",exportName:"auth"},build:{path:"./commands/build.ts",exportName:"build"},changelog:{path:"./commands/changelog.ts",exportName:"changelog"},clean:{path:"./commands/clean.ts",exportName:"clean"},cloud:{path:"./commands/cloud.ts",exportName:"cloud"},commit:{path:"./commands/commit.ts",exportName:"commit"},completion:{path:"./commands/completion.ts",exportName:"completion"},"config:migrate":{path:"./commands/config-migrate.ts",exportName:"configMigrate"},configure:{path:"./commands/configure.ts",exportName:"configure"},create:{path:"./commands/create.ts",exportName:"create"},deploy:{path:"./commands/deploy.ts",exportName:"deploy"},dev:{path:"./commands/dev.ts",exportName:"dev"},dns:{path:"./commands/dns.ts",exportName:"dns"},doctor:{path:"./commands/doctor.ts",exportName:"doctor"},domains:{path:"./commands/domains.ts",exportName:"domains"},email:{path:"./commands/email.ts",exportName:"email"},env:{path:"./commands/env.ts",exportName:"env"},fresh:{path:"./commands/fresh.ts",exportName:"fresh"},generate:{path:"./commands/generate.ts",exportName:"generate"},http:{path:"./commands/http.ts",exportName:"http"},install:{path:"./commands/install.ts",exportName:"install"},key:{path:"./commands/key.ts",exportName:"key"},lint:{path:"./commands/lint.ts",exportName:"lint"},list:{path:"./commands/list.ts",exportName:"list"},mail:{path:"./commands/mail.ts",exportName:"mailCommands"},maintenance:{path:"./commands/maintenance.ts",exportName:"maintenance"},down:{path:"./commands/maintenance.ts",exportName:"maintenance"},up:{path:"./commands/maintenance.ts",exportName:"maintenance"},status:{path:"./commands/maintenance.ts",exportName:"maintenance"},make:{path:"./commands/make.ts",exportName:"make"},migrate:{path:"./commands/migrate.ts",exportName:"migrate"},outdated:{path:"./commands/outdated.ts",exportName:"outdated"},package:{path:"./commands/package.ts",exportName:"packageCommands"},phone:{path:"./commands/phone.ts",exportName:"phone"},ports:{path:"./commands/ports.ts",exportName:"ports"},prepublish:{path:"./commands/prepublish.ts",exportName:"prepublish"},projects:{path:"./commands/projects.ts",exportName:"projects"},publish:{path:"./commands/publish.ts",exportName:"publish"},"publish:model":{path:"./commands/publish.ts",exportName:"publish"},"publish:controller":{path:"./commands/publish.ts",exportName:"publish"},"publish:middleware":{path:"./commands/publish.ts",exportName:"publish"},"publish:action":{path:"./commands/publish.ts",exportName:"publish"},"publish:core":{path:"./commands/publish.ts",exportName:"publish"},queue:{path:"./commands/queue.ts",exportName:"queue"},release:{path:"./commands/release.ts",exportName:"release"},route:{path:"./commands/route.ts",exportName:"route"},saas:{path:"./commands/saas.ts",exportName:"saas"},schedule:{path:"./commands/schedule.ts",exportName:"schedule"},search:{path:"./commands/search.ts",exportName:"search"},seed:{path:"./commands/seed.ts",exportName:"seed"},setup:{path:"./commands/setup.ts",exportName:"setup"},share:{path:"./commands/share.ts",exportName:"share"},stack:{path:"./commands/stacks.ts",exportName:"stacks"},sms:{path:"./commands/sms.ts",exportName:"sms"},telemetry:{path:"./commands/telemetry.ts",exportName:"telemetryCommand"},test:{path:"./commands/test.ts",exportName:"test"},tinker:{path:"./commands/tinker.ts",exportName:"tinker"},types:{path:"./commands/types.ts",exportName:"types"},undeploy:{path:"./commands/cloud.ts",exportName:"cloud"},upgrade:{path:"./commands/upgrade.ts",exportName:"upgrade"},version:{path:"./commands/version.ts",exportName:"version"}},WJ={minimal:["version","help"],development:["dev","build","test","lint"],database:["migrate","seed","fresh"],scaffolding:["make","generate"],deployment:["deploy","release","cloud"],info:["about","doctor","list"]},T=new WeakMap});var i={};E(i,{setup:()=>MJ,optimizePantryDeps:()=>c,ensurePantryInstalled:()=>r,ensurePantryDependencies:()=>g,ensureEnvIsSet:()=>s,ensureAppKey:()=>a});import{existsSync as j,readFileSync as t,writeFileSync as HJ}from"fs";import{join as N}from"path";import O from"process";import{runAction as LJ,setupSSL as UJ}from"@stacksjs/actions";import{log as G,onUnknownSubcommand as OJ,runCommand as R}from"@stacksjs/cli";import{Action as KJ}from"@stacksjs/enums";import{handleError as M}from"@stacksjs/error-handling";import{path as v}from"@stacksjs/path";import{copyFile as qJ,storage as AJ}from"@stacksjs/storage";import{ExitCode as D}from"@stacksjs/types";function S(J,Q){let Z=Number(O.env[J]);if(Number.isFinite(Z)&&Z>0)return Z;return Q}function MJ(J){let Q={setup:"This command ensures your project is setup correctly",ssl:"Setup SSL certificates and hosts file for HTTPS development",ohMyZsh:"Enable Oh My Zsh",aws:"Ensures AWS is connected to the project",project:"Target a specific project",verbose:"Enable verbose output",domain:"Custom domain to setup (defaults to APP_URL)",skipHosts:"Skip adding domain to hosts file",skipTrust:"Skip trusting the certificate",skipAws:"Skip AWS configuration during setup",skipKeygen:"Skip generating an application key during setup"};J.command("setup",Q.setup).alias("ensure").option("-p, --project [project]",Q.project,{default:!1}).option("--skip-aws",Q.skipAws,{default:!1}).option("--skip-keygen",Q.skipKeygen,{default:!1}).option("--verbose",Q.verbose,{default:!1}).action(async(Z)=>{G.debug("Running `buddy setup` ...",Z),await r(),await c(),await TJ(Z)}),J.command("setup:ssl",Q.ssl).alias("ssl:setup").option("-d, --domain [domain]",Q.domain).option("--skip-hosts",Q.skipHosts,{default:!1}).option("--skip-trust",Q.skipTrust,{default:!1}).option("--verbose",Q.verbose,{default:!1}).action(async(Z)=>{if(G.debug("Running `buddy setup:ssl` ...",Z),!await UJ({domain:Z.domain,skipHosts:Z.skipHosts,skipTrust:Z.skipTrust,verbose:Z.verbose}))G.warn("SSL setup completed with warnings"),G.info("You may need to manually trust certificates or update hosts file")}),J.command("setup:oh-my-zsh",Q.ohMyZsh).alias("upgrade:oh-my-zsh").option("--verbose",Q.verbose,{default:!1}).action(async(Z)=>{G.debug("Running `buddy setup:oh-my-zsh` ...",Z);let X=await LJ(KJ.UpgradeShell);if(X.isErr)G.error(X.error),O.exit(D.FatalError)}),OJ(J,"setup")}async function SJ(){if((await R("pantry --version",{silent:!0,timeoutMs:DJ})).isOk)return!0;return!1}async function xJ(){let J=await R(v.frameworkPath("scripts/pantry-install"),{timeoutMs:FJ});if(J.isOk)return;M(J.error),O.exit(D.FatalError)}async function r(){if(!await SJ())await xJ()}async function g(J){G.info("Installing Pantry dependencies...");let Q=await R("pantry install",{cwd:J,timeoutMs:_J});if(Q.isOk){G.success("Installed Pantry dependencies");return}M(Q.error),O.exit(D.FatalError)}function IJ(J){let Q=N(J,".env");if(!j(Q))return!1;return/^APP_KEY=.+$/m.test(t(Q,"utf-8"))}async function a(J){if(IJ(J)){G.success("APP_KEY existed");return}let Q=await R("./buddy key:generate",{cwd:J,timeoutMs:NJ});if(Q.isErr)M(Q.error),O.exit(D.FatalError);G.success("Generated application key")}async function TJ(J){let Q=J.cwd||v.projectPath();if(await g(Q),await s(J),!J.skipKeygen)await a(Q);if(!J.skipAws){G.info("Ensuring AWS is connected...");let Z=await R("./buddy configure:aws",{cwd:Q,timeoutMs:RJ});if(Z.isErr)M(Z.error),O.exit(D.FatalError);G.success("Configured AWS")}G.success("Project is setup"),G.info("Happy coding! \uD83D\uDC99")}function vJ(J){let Q=N(J,".env"),Z=N(J,".env.example"),X=j(Q)?Q:j(Z)?Z:void 0;if(!X)return;let W=t(X,"utf-8").match(/^DB_CONNECTION=(.+)$/m);if(!W)return;let B=W[1].trim().replace(/['"]/g,"");return jJ[B]}async function c(){let J=v.projectPath(),Q=N(J,"config","deps.ts");if(!j(Q)){G.debug("No config/deps.ts found, skipping dependency optimization");return}let Z={};try{let B=await import(Q),V=B.config||B.default;if(V?.dependencies)Z={...V.dependencies}}catch(B){G.debug("Could not load config/deps.ts, skipping dependency optimization");return}let X=vJ(J);if(X){if(!Object.keys(Z).some((V)=>V===X||V.startsWith(`${X}/`)))G.info(`Detected DB_CONNECTION requires ${X}, adding to dependencies`),Z[X]="*"}let $=["# Auto-generated from config/deps.ts and .env sniffing.","# This file is regenerated on each `buddy setup` run.","#","# To learn more, please visit:","# https://stacksjs.com/docs/dependency-management","","dependencies:"];for(let[B,V]of Object.entries(Z))$.push(` ${B}: ${V}`);let W=N(J,"deps.yaml");HJ(W,`${$.join(`
|
|
3
|
+
`)}
|
|
4
|
+
`),G.success("Generated deps.yaml from config/deps.ts")}async function s(J){G.info("Ensuring .env exists...");let Q=J.cwd||v.projectPath(),Z=`${Q}/.env`,X=`${Q}/.env.example`;if(AJ.doesNotExist(Z)){try{qJ(X,Z)}catch($){M($),O.exit(D.FatalError)}G.success(".env created")}else G.success(".env existed")}var DJ,FJ,_J,NJ,RJ,jJ;var d=P(()=>{DJ=S("PANTRY_CHECK_TIMEOUT_MS",15000),FJ=S("PANTRY_INSTALL_TIMEOUT_MS",600000),_J=S("PANTRY_DEPENDENCIES_TIMEOUT_MS",1200000),NJ=S("KEYGEN_TIMEOUT_MS",120000),RJ=S("AWS_CONFIG_TIMEOUT_MS",900000);jJ={postgres:"postgresql.org",mysql:"mysql.com",sqlite:"sqlite.org"}});import U from"process";import{cli as wJ,log as z}from"@stacksjs/cli";import{path as w}from"@stacksjs/path";var F=U.argv.slice(2),b=F[0]||"help",e=F.includes("--help")||F.includes("-h"),EJ=["--version","-v","version"].includes(b),PJ=b==="help"||e&&F.length<=2,hJ=["build","lint","lint:fix","test","test:types","test:unit","test:feature","typecheck","types:fix","types:generate","clean","fresh","about","doctor","setup","setup:ssl","setup:oh-my-zsh","deploy","new","create"].some((J)=>b.startsWith(J))||e||PJ,n=!EJ;if(n)U.on("uncaughtException",(J)=>{z.debug("Buddy uncaughtException"),z.error(J),U.exit(1)}),U.on("unhandledRejection",(J)=>{z.debug("Buddy unhandledRejection"),z.error(J),U.exit(1)});async function kJ(){let J=wJ("buddy"),Q="./buddy.config.ts";try{await Bun.file("./buddy.config.ts").text();let{applyBuddyConfig:Z}=await Promise.resolve().then(() => (u(),p));await Z(J)}catch{}if(n){let{loadCommands:Z,getCommandsToLoad:X,markLoaded:$}=await Promise.resolve().then(() => (C(),k)),{setup:W}=await Promise.resolve().then(() => (d(),i));if(W(J),$(J,"setup"),!hJ){let{runAction:V}=await import("@stacksjs/actions"),{Action:H}=await import("@stacksjs/enums"),{ensureProjectIsInitialized:_}=await import("@stacksjs/utils");if(!await _()){z.info("Your `APP_KEY` is not yet set"),z.info("Generating application key...");let x=await V(H.KeyGenerate);if(x.isErr)z.error("Failed to set random application key.",x.error),U.exit(1)}}let B=X(F);await Z(B,J),await bJ(J)}else{let{loadCommand:Z}=await Promise.resolve().then(() => (C(),k));await Z("version",J)}if(J.help(),F.length===0&&U.stdin.isTTY&&!J.isNoInteraction)await CJ(J);else J.parse()}async function CJ(J){let{bold:Q,green:Z,intro:X}=await import("@stacksjs/cli"),{select:$}=await import("@stacksjs/cli");await X("buddy"),console.log(Q(Z("What would you like to do?"))),console.log("");let W=await $({message:"Select a command:",choices:[{value:"dev",label:"Start development server"},{value:"build",label:"Build for production"},{value:"test",label:"Run tests"},{value:"list",label:"List all commands"},{value:"doctor",label:"Run health checks"},{value:"about",label:"Show system information"},{value:"help",label:"Show help"},{value:"exit",label:"Exit"}],initial:0});if(console.log(""),W==="exit")U.exit(0);else if(W==="help")J.outputHelp();else U.argv=["bun","buddy",W],J.parse()}await kJ();async function bJ(J){let{fs:Q}=await import("@stacksjs/storage"),Z=w.appPath("Commands");try{let W=(await import(w.appPath("Commands.ts"))).default||{};for(let[B,V]of Object.entries(W)){let H=typeof V==="string"?{file:V,enabled:!0}:V;if(H.enabled===!1)continue;let _=`${Z}/${H.file}.ts`;if(!Q.existsSync(_)){z.debug(`Command file not found: ${_} (registered as '${B}')`);continue}try{let K=await import(_);if(typeof K.default==="function"){if(K.default(J),H.aliases&&Array.isArray(H.aliases))for(let x of H.aliases)J.alias(B,x)}else z.error(`Expected a default export function in ${H.file}.ts, but got:`,K.default)}catch(K){z.error(`Failed to load command ${H.file}:`,K)}}}catch{if(!Q.existsSync(Z)){z.debug("app/Commands directory not found, skipping user commands");return}z.debug("Commands.ts not found, using auto-discovery");let X=Q.readdirSync(Z).filter(($)=>$.endsWith(".ts"));for(let $ of X){let W=`${Z}/${$}`;try{let B=await import(W);if(typeof B.default==="function")B.default(J);else z.debug(`Skipping ${$} \u2014 no default export function`)}catch(B){z.error(`Failed to load command ${$}:`,B)}}}try{let X=await import(w.listenersPath("Console.ts"));if(typeof X.default==="function")X.default(J)}catch{}}
|