@voltro/cli 0.23.0 → 0.25.0

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 (99) hide show
  1. package/CHANGELOG.md +537 -0
  2. package/THIRD-PARTY-NOTICES.md +2 -2
  3. package/bin/voltro.mjs +39 -4
  4. package/dist/{apiBuild-JQtIhZPy.js → apiBuild-BqhCSytw.js} +46 -24
  5. package/dist/apiBuild-N1R4V792.js +2 -0
  6. package/dist/bin.js +3 -3
  7. package/dist/{commands-Bsu9Buln.js → commands-7EmYJ9Xg.js} +2796 -2478
  8. package/dist/dbCommand-CIrdFLp9.js +2 -0
  9. package/dist/{dbCommand-GI7-BVZt.js → dbCommand-FUU12FvD.js} +285 -246
  10. package/dist/{dev-DRxF_qOB.js → dev-BvHT7WZa.js} +1 -1
  11. package/dist/{dev-jM07kq_D.js → dev-MacSQ1Ll.js} +2042 -1631
  12. package/dist/fileConventions-3bffWssN.js +30 -0
  13. package/dist/frameworkTableAssembly-BsnCKzQ6.js +2 -0
  14. package/dist/{frameworkTableAssembly-sg41s14F.js → frameworkTableAssembly-Cw5zJz6n.js} +2 -2
  15. package/dist/index.js +1 -1
  16. package/dist/inspect-C9gjHwBk.js +2 -0
  17. package/dist/{inspect-_ldwsAwH.js → inspect-DuLUrZp9.js} +14 -1
  18. package/dist/{inspectMetrics-dcC7gnxu.js → inspectMetrics-EQwH7BI4.js} +15 -15
  19. package/dist/manifestBuild-BVwS1Z_6.js +2 -0
  20. package/dist/{manifestBuild-Bs1Uw22_.js → manifestBuild-Dneq4_Jx.js} +1 -1
  21. package/dist/serveCommand-5ZFiNO1R.js +1241 -0
  22. package/dist/serveEntry.js +2 -2
  23. package/dist/{start-C_4VUDT8.js → start-C-ZWSDpg.js} +2 -2
  24. package/dist/startEntry.js +2 -2
  25. package/package.json +17 -17
  26. package/templates/AGENTS.core.md +12 -5
  27. package/templates/AGENTS.md +14 -7
  28. package/templates/agent-docs/_index.md +2 -2
  29. package/templates/agent-docs/_manifest.json +3 -3
  30. package/templates/agent-docs/authentication.md +21 -0
  31. package/templates/agent-docs/cli.md +32 -0
  32. package/templates/agent-docs/data.md +491 -167
  33. package/templates/agent-docs/database/migrations.md +132 -63
  34. package/templates/agent-docs/database/schema.md +80 -0
  35. package/templates/agent-docs/database/seedsdialects.md +12 -0
  36. package/templates/agent-docs/deployment.md +75 -1
  37. package/templates/agent-docs/plugins.md +1 -1
  38. package/templates/agent-docs/reference.md +2 -2
  39. package/templates/agent-docs/security.md +18 -0
  40. package/templates/agent-docs/templates/apibackends.md +5 -5
  41. package/templates/agent-docs/templates/overview.md +1 -1
  42. package/templates/agent-docs/whats-new.md +263 -169
  43. package/templates/agent-docs/workflows.md +74 -20
  44. package/templates/apps/api-ai/package.json +8 -7
  45. package/templates/apps/api-auth/package.json +9 -8
  46. package/templates/apps/api-backend/package.json +8 -7
  47. package/templates/apps/api-backend-deactivation/package.json +8 -7
  48. package/templates/apps/api-backend-mail/package.json +9 -8
  49. package/templates/apps/api-backend-mariadb/package.json +10 -9
  50. package/templates/apps/api-backend-storage/package.json +9 -8
  51. package/templates/apps/api-data-advanced/package.json +9 -8
  52. package/templates/apps/api-durable/README.md +2 -1
  53. package/templates/apps/api-durable/events/orders.event.ts +18 -0
  54. package/templates/apps/api-durable/mutations/orders.place.mutation.server.ts +17 -15
  55. package/templates/apps/api-durable/package.json +9 -8
  56. package/templates/apps/api-durable/triggers/order.placed.trigger.tsx +6 -4
  57. package/templates/apps/api-feature-flags/package.json +10 -9
  58. package/templates/apps/api-governance/package.json +9 -8
  59. package/templates/apps/api-kv/package.json +9 -8
  60. package/templates/apps/api-moderation/package.json +9 -8
  61. package/templates/apps/api-observability/package.json +9 -8
  62. package/templates/apps/api-ratelimit/package.json +9 -8
  63. package/templates/apps/api-rbac/package.json +9 -8
  64. package/templates/apps/api-rest/package.json +8 -7
  65. package/templates/apps/api-saas/package.json +12 -11
  66. package/templates/apps/api-search/package.json +9 -8
  67. package/templates/apps/api-versioning/package.json +9 -8
  68. package/templates/apps/api-webhooks/README.md +2 -2
  69. package/templates/apps/api-webhooks/events/orders.event.ts +35 -0
  70. package/templates/apps/api-webhooks/package.json +10 -9
  71. package/templates/apps/api-webhooks/template.json +1 -1
  72. package/templates/apps/changelog/package.json +7 -6
  73. package/templates/apps/edge-functions/package.json +3 -2
  74. package/templates/apps/frontend-admin/package.json +9 -8
  75. package/templates/apps/frontend-app/package.json +9 -8
  76. package/templates/apps/frontend-blank/package.json +8 -7
  77. package/templates/apps/frontend-contact/package.json +8 -7
  78. package/templates/apps/frontend-contact/src/globals.d.ts +6 -0
  79. package/templates/apps/frontend-dashboard/package.json +8 -7
  80. package/templates/apps/frontend-docs/package.json +8 -7
  81. package/templates/apps/frontend-docs/src/globals.d.ts +6 -0
  82. package/templates/apps/frontend-i18n/package.json +7 -6
  83. package/templates/apps/frontend-landing/package.json +8 -7
  84. package/templates/apps/frontend-landing/src/globals.d.ts +6 -0
  85. package/templates/apps/frontend-spa/package.json +8 -7
  86. package/templates/apps/frontend-spa/src/globals.d.ts +6 -0
  87. package/templates/apps/frontend-ssr/package.json +8 -7
  88. package/templates/apps/frontend-ssr/src/globals.d.ts +6 -0
  89. package/templates/apps/frontend-ssr-api/package.json +9 -8
  90. package/templates/apps/frontend-static-blog/package.json +7 -6
  91. package/templates/apps/frontend-static-blog/src/globals.d.ts +6 -0
  92. package/dist/apiBuild-CD-4JLLA.js +0 -2
  93. package/dist/dbCommand-CSguuUQn.js +0 -2
  94. package/dist/fileConventions-CBNPZVOV.js +0 -29
  95. package/dist/frameworkTableAssembly-DRJrAVr1.js +0 -2
  96. package/dist/inspect-BA67TF6v.js +0 -2
  97. package/dist/manifestBuild-i-fRHg_H.js +0 -2
  98. package/dist/serveCommand-Cl8sicD5.js +0 -1162
  99. package/templates/apps/api-webhooks/events/order.completed.webhook.tsx +0 -22
@@ -10914,7 +10914,7 @@ programs and associated documentation files created by the
10914
10914
  Original Author, when distributed with the Software.
10915
10915
  ```
10916
10916
 
10917
- ## brace-expansion@5.0.8
10917
+ ## brace-expansion@5.0.9
10918
10918
 
10919
10919
  License: MIT
10920
10920
 
@@ -14150,7 +14150,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
14150
14150
  THE SOFTWARE.
14151
14151
  ```
14152
14152
 
14153
- ## postcss@8.5.21
14153
+ ## postcss@8.5.25
14154
14154
 
14155
14155
  License: MIT
14156
14156
 
package/bin/voltro.mjs CHANGED
@@ -113,8 +113,32 @@ if (argv[0] === 'serve') {
113
113
  // by walking the app tree). This is what makes the bundle relocation-safe —
114
114
  // the Docker deploy moves the app from `apps/x/api` to the image root.
115
115
  if (serveRoot !== process.cwd()) process.chdir(serveRoot)
116
- const mod = await import(pathToFileURL(serveBundle).href)
117
- if (typeof mod.runServe === 'function') {
116
+ // The IMPORT and the RUN are separated on purpose, and the reason is a
117
+ // consumer's deploy. One `try` around both meant every runtime fault the
118
+ // app's boot could raise came out as "serve bundle failed to load … Run
119
+ // `voltro build`" — with the stack discarded. They had just run it. The
120
+ // real fault was a `TypeError` two frames into CDC startup, which sends you
121
+ // to rebuild, then to check `.dockerignore`, then to doubt the image, and
122
+ // never to the actual line.
123
+ //
124
+ // An import that throws IS a build problem (missing / stale / corrupt
125
+ // artefact) and degrades as before. An import that SUCCEEDS and then throws
126
+ // from `runServe` is the app failing to boot: it is reported as itself,
127
+ // with its stack, and it does not fall through to a second execution path —
128
+ // silently switching to tsx is how a bundle-only defect stays a mystery.
129
+ let mod
130
+ try {
131
+ mod = await import(pathToFileURL(serveBundle).href)
132
+ } catch (importError) {
133
+ if (importError?.name === 'VoltroBootRefusal') {
134
+ console.error(String(importError.message))
135
+ process.exit(1)
136
+ }
137
+ console.warn('[voltro] serve bundle failed to load:', importError?.message ?? importError)
138
+ if (importError?.stack) console.warn(String(importError.stack))
139
+ mod = undefined
140
+ }
141
+ if (mod && typeof mod.runServe === 'function') {
118
142
  const code = await mod.runServe(argv.slice(1))
119
143
  process.exit(typeof code === 'number' ? code : 0)
120
144
  }
@@ -130,8 +154,19 @@ if (argv[0] === 'serve') {
130
154
  console.error(String(error.message))
131
155
  process.exit(1)
132
156
  }
133
- // Unusable bundle degrade to the standard tsx path, never crash the boot.
134
- console.warn('[voltro] serve bundle failed to load:', error?.message ?? error)
157
+ // Reached only when the bundle IMPORTED and `runServe` threw the app
158
+ // failed to boot. Not a build problem, so say what happened and stop.
159
+ console.error('[voltro] the serve bundle loaded, and the app failed to boot:')
160
+ console.error(String(error?.stack ?? error?.message ?? error))
161
+ // No "try this flag" line here on purpose: there is no supported switch that
162
+ // runs `voltro serve` off the bundle, and naming one that does not exist is
163
+ // the same defect as the message this replaced.
164
+ console.error(
165
+ '\n[voltro] This is a runtime error, not a missing bundle — `voltro build` will not change it.\n'
166
+ + ' If the same app boots under `voltro dev` (which loads from source), the fault is in\n'
167
+ + ' what the bundle did to a dependency, not in your code — report the stack above.',
168
+ )
169
+ process.exit(1)
135
170
  }
136
171
  }
137
172
  // PRODUCTION MUST serve from the precompiled bundle — never transpile on demand.
@@ -1,6 +1,6 @@
1
- import { lt as e } from "./inspectMetrics-dcC7gnxu.js";
1
+ import { lt as e } from "./inspectMetrics-EQwH7BI4.js";
2
2
  import { a as t } from "./seedRunner-D6eu-u5U.js";
3
- import { m as n } from "./dev-jM07kq_D.js";
3
+ import { h as n } from "./dev-MacSQ1Ll.js";
4
4
  import { dirname as r, isAbsolute as i, join as a, relative as o, resolve as s } from "node:path";
5
5
  import { fileURLToPath as c } from "node:url";
6
6
  import { createLogger as l } from "@voltro/logger";
@@ -41,7 +41,7 @@ var p = l({ scope: "voltro:build" }), m = (e) => {
41
41
  return !1;
42
42
  }
43
43
  });
44
- }, g = /(?:\.(?:query|mutation|action|stream)(?:\.server)?\.ts|\.workflow(?:\.server)?\.tsx|\.(?:subscribe|reaction|aggregate|agent|tool|webhook|cron|trigger|outbox|connection|email)(?:\.server)?\.tsx?|\.(?:startup|seed)\.tsx?|\.(?:entity|schema|relations|migration)\.ts|(?:^|\/)schema\.ts)$/, _ = (e) => /\.(ts|tsx)$/.test(e) && !/\.(test|spec)\.[tj]sx?$/.test(e), v = async (e) => (await n(e)).filter((t) => g.test(t) && _(t) && !t.includes(`${e}/.framework/`)), y = {
44
+ }, g = /(?:\.(?:query|mutation|action|stream)(?:\.server)?\.ts|\.workflow(?:\.server)?\.tsx|\.(?:subscribe|reaction|aggregate|agent|tool|webhook|cron|trigger|outbox|connection|email)(?:\.server)?\.tsx?|\.(?:startup|seed)\.tsx?|\.(?:entity|schema|relations|migration|event)\.ts|(?:^|\/)schema\.ts)$/, _ = (e) => /\.(ts|tsx)$/.test(e) && !/\.(test|spec)\.[tj]sx?$/.test(e), v = async (e) => (await n(e)).filter((t) => g.test(t) && _(t) && !t.includes(`${e}/.framework/`)), y = {
45
45
  name: "externalize-bare",
46
46
  setup(e) {
47
47
  e.onResolve({ filter: /.*/ }, (e) => {
@@ -100,7 +100,6 @@ var p = l({ scope: "voltro:build" }), m = (e) => {
100
100
  "pg-native",
101
101
  "@tursodatabase/*",
102
102
  "@libsql/*",
103
- "@vlasky/zongji",
104
103
  "ioredis",
105
104
  "nodemailer"
106
105
  ], C = [
@@ -145,13 +144,33 @@ const drivers = ${JSON.stringify(t)}\nlet mod\nfor (const d of drivers) {\n try
145
144
  loader: "js"
146
145
  }));
147
146
  }
148
- }), D = (e) => a(e, ".framework", "dist-api", "serveBundle", "serveEntry.js"), O = async (t) => {
147
+ }), D = (e) => a(e, ".framework", "dist-api", "serveBundle", "serveEntry.js"), O = 1e3, k = async (e, t) => {
148
+ let n = t - O, r = 0, i = async (e) => {
149
+ let t;
150
+ try {
151
+ t = await d.readdir(e, { withFileTypes: !0 });
152
+ } catch {
153
+ return;
154
+ }
155
+ for (let o of t) {
156
+ let t = a(e, o.name);
157
+ if (o.isDirectory()) {
158
+ await i(t);
159
+ continue;
160
+ }
161
+ try {
162
+ (await d.stat(t)).mtimeMs < n && (await d.rm(t, { force: !0 }), r += 1);
163
+ } catch {}
164
+ }
165
+ };
166
+ return await i(e), r;
167
+ }, A = async (t) => {
149
168
  let n = await e("esbuild", () => import("esbuild")), r = a(t, ".framework"), i = a(r, "dist-api", "serveBundle");
150
169
  await d.mkdir(r, { recursive: !0 });
151
- let c = [...await v(t)], l = a(t, "app.config.ts");
152
- if (u(l) && c.push(l), c.length === 0) return null;
153
- let f = a(t, "tsconfig.json"), g = await n.build({
154
- entryPoints: c,
170
+ let c = Date.now(), l = [...await v(t)], f = a(t, "app.config.ts");
171
+ if (u(f) && l.push(f), l.length === 0) return null;
172
+ let g = a(t, "tsconfig.json"), b = await n.build({
173
+ entryPoints: l,
155
174
  bundle: !0,
156
175
  write: !1,
157
176
  metafile: !0,
@@ -163,26 +182,26 @@ const drivers = ${JSON.stringify(t)}\nlet mod\nfor (const d of drivers) {\n try
163
182
  logLevel: "silent",
164
183
  plugins: [y],
165
184
  outdir: a(i, ".probe"),
166
- ...u(f) ? { tsconfig: f } : {}
167
- }), b = Object.keys(g.metafile.inputs).map((e) => s(t, e)).filter((e) => e.startsWith(`${t}/`) && !e.includes("/node_modules/") && !e.includes("/.framework/") && _(e)), x = await h(t), S = /* @__PURE__ */ new Set(), C = [
185
+ ...u(g) ? { tsconfig: g } : {}
186
+ }), x = Object.keys(b.metafile.inputs).map((e) => s(t, e)).filter((e) => e.startsWith(`${t}/`) && !e.includes("/node_modules/") && !e.includes("/.framework/") && _(e)), S = await h(t), C = /* @__PURE__ */ new Set(), w = [
168
187
  "// GENERATED BY `voltro build` — do not edit; overwritten on next build.",
169
188
  "import { join as __join, dirname as __dirname, resolve as __resolve } from 'node:path'",
170
189
  "import { pathToFileURL as __pathToFileURL, fileURLToPath as __fileURLToPath } from 'node:url'",
171
190
  "import { runServe as __runServe, registerAppModules, registerDriver, loadDotEnv } from '@voltro/cli/serveEntry'",
172
- ...x.map((e, t) => `import * as __drv${t} from ${JSON.stringify(e)}`),
191
+ ...S.map((e, t) => `import * as __drv${t} from ${JSON.stringify(e)}`),
173
192
  "const __isMain = Boolean(process.argv[1]) && import.meta.url === __pathToFileURL(process.argv[1]).href",
174
193
  "if (__isMain) process.chdir(__resolve(__dirname(__fileURLToPath(import.meta.url)), '..', '..', '..'))",
175
194
  "const __root = process.cwd()",
176
195
  "registerAppModules({",
177
- ...b.map((e) => ` [__join(__root, ${JSON.stringify(o(t, e))})]: () => import(${JSON.stringify(e)}),`),
196
+ ...x.map((e) => ` [__join(__root, ${JSON.stringify(o(t, e))})]: () => import(${JSON.stringify(e)}),`),
178
197
  "})",
179
- ...x.map((e, t) => `registerDriver(${JSON.stringify(e)}, __drv${t})`),
198
+ ...S.map((e, t) => `registerDriver(${JSON.stringify(e)}, __drv${t})`),
180
199
  "export const runServe = (args = []) => { loadDotEnv([]); return __runServe(args) }",
181
200
  "if (__isMain) runServe(process.argv.slice(2)).then((c) => process.exit(typeof c === 'number' ? c : 0))",
182
201
  ""
183
- ], w = a(r, "serveEntry.ts");
184
- return await d.writeFile(w, C.join("\n"), "utf8"), await n.build({
185
- entryPoints: [w],
202
+ ], T = a(r, "serveEntry.ts");
203
+ await d.writeFile(T, w.join("\n"), "utf8"), await n.build({
204
+ entryPoints: [T],
186
205
  bundle: !0,
187
206
  format: "esm",
188
207
  platform: "node",
@@ -190,20 +209,23 @@ const drivers = ${JSON.stringify(t)}\nlet mod\nfor (const d of drivers) {\n try
190
209
  outdir: i,
191
210
  splitting: !0,
192
211
  write: !0,
193
- plugins: [E(x, t, S)],
212
+ plugins: [E(S, t, C)],
194
213
  banner: { js: "import { createRequire as __voltroRequire } from 'node:module'; const require = __voltroRequire(import.meta.url);" },
195
214
  jsx: "automatic",
196
215
  jsxImportSource: "react",
197
216
  logLevel: "silent",
198
217
  absWorkingDir: t,
199
218
  alias: m("serveEntry"),
200
- ...u(f) ? { tsconfig: f } : {}
201
- }), p.info("api build: serve bundle written", {
202
- appModules: b.length,
203
- drivers: x.length > 0 ? x.join(", ") : "none (memory)",
204
- ...S.size > 0 ? { externalizedOptionalPeers: [...S].join(", ") } : {},
219
+ ...u(g) ? { tsconfig: g } : {}
220
+ });
221
+ let D = await k(i, c);
222
+ return p.info("api build: serve bundle written", {
223
+ appModules: x.length,
224
+ drivers: S.length > 0 ? S.join(", ") : "none (memory)",
225
+ ...C.size > 0 ? { externalizedOptionalPeers: [...C].join(", ") } : {},
226
+ ...D > 0 ? { prunedStaleChunks: D } : {},
205
227
  out: a(".framework", "dist-api", "serveBundle", "serveEntry.js")
206
228
  }), a(i, "serveEntry.js");
207
229
  };
208
230
  //#endregion
209
- export { v as a, O as c, m as i, D as l, S as n, E as o, x as r, b as s, g as t };
231
+ export { v as a, b as c, m as i, A as l, S as n, E as o, x as r, k as s, g as t, D as u };
@@ -0,0 +1,2 @@
1
+ import { c as e, l as t } from "./apiBuild-BqhCSytw.js";
2
+ export { e as runApiBuild, t as runServeBundleBuild };
package/dist/bin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { Z as e } from "./inspectMetrics-dcC7gnxu.js";
3
- import { r as t } from "./commands-Bsu9Buln.js";
4
- import { l as n } from "./dbCommand-GI7-BVZt.js";
2
+ import { Z as e } from "./inspectMetrics-EQwH7BI4.js";
3
+ import { r as t } from "./commands-7EmYJ9Xg.js";
4
+ import { l as n } from "./dbCommand-FUU12FvD.js";
5
5
  import { createLogger as r } from "@voltro/logger";
6
6
  //#region src/sqlErrorDetail.ts
7
7
  var i = (e) => typeof e == "object" && !!e, a = (e) => {