@voltro/cli 0.44.0 → 0.45.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.
- package/CHANGELOG.md +120 -1
- package/dist/{apiBuild-DvWreIQP.js → apiBuild-CDQBNRDx.js} +1 -1
- package/dist/apiBuild-yJCqJYQ8.js +2 -0
- package/dist/bin.d.ts +16 -0
- package/dist/bin.js +46 -11
- package/dist/{build-Ckc-FA7d.js → build-yvsLG77U.js} +7 -7
- package/dist/{checkCommand-BNfEs4KG.js → checkCommand-Boxov8lr.js} +11 -11
- package/dist/{checkCommand-AlbawIal.js → checkCommand-lrzwOzV1.js} +1 -1
- package/dist/codegen-DcE2li1i.js +2 -0
- package/dist/{codegen-CbpGCWLG.js → codegen-sbN1Y8PB.js} +37 -37
- package/dist/codegenCommand-CQOLytL-.js +144 -0
- package/dist/{codemodRunner-BKTnaGOz.js → codemodRunner-5ZhDH3rB.js} +41 -0
- package/dist/{commands-fsnezHLH.js → commands-CEkVoFM5.js} +19 -19
- package/dist/{dashboardCommand-DHDmlo9A.js → dashboardCommand-0ahyp-zA.js} +1 -1
- package/dist/{dataCommand-sfpGV694.js → dataCommand-D4IlZcih.js} +277 -210
- package/dist/{dev-D-JZ6CGQ.js → dev-DAM5CnAa.js} +1856 -1801
- package/dist/{dev-BZO5aLdr.js → dev-P4HyeY9W.js} +1 -1
- package/dist/devActivity.d.ts +16 -0
- package/dist/doctorCommand-2K1dIzYk.js +2 -0
- package/dist/{doctorCommand-BlUyESpD.js → doctorCommand-DW2cwAvC.js} +244 -223
- package/dist/doctorSourceRelations-CPjSwYuZ.js +83 -0
- package/dist/{dormancyCommand-lQxdrU8C.js → dormancyCommand-BqQz7lbM.js} +1 -1
- package/dist/{embeddingsCommand-ByBTju6X.js → embeddingsCommand-DJyArpU4.js} +1 -1
- package/dist/{envCommand-CpCbYAgR.js → envCommand-CviRZx1L.js} +1 -1
- package/dist/{evolveCommand-CBV3-TtK.js → evolveCommand-qdlP-R9G.js} +2 -2
- package/dist/index.d.ts +16 -0
- package/dist/index.js +1 -1
- package/dist/{infoCommand-DJoA9cKD.js → infoCommand-CNWPSUcW.js} +1 -1
- package/dist/inspectState.d.ts +16 -0
- package/dist/{runtimeTrace-DJ9tPhrc.js → runtimeTrace-BDZSt9W_.js} +1 -1
- package/dist/{sdkgen-7dr8-Onw.js → sdkgen-sNaD3oZB.js} +1 -1
- package/dist/{serveCommand-BlnAlNQg.js → serveCommand-BBhT2U94.js} +731 -737
- package/dist/serveCommand-DY2jLy0o.js +2 -0
- package/dist/serveEntry.d.ts +16 -0
- package/dist/serveEntry.js +1 -1
- package/dist/startEntry.d.ts +16 -0
- package/dist/startup.d.ts +16 -0
- package/dist/{test-CLYXrZ2F.js → test-CHb7UwvE.js} +1 -1
- package/dist/updateCommand-BH6EGuCc.js +2 -0
- package/dist/{updateCommand-BvRidHp6.js → updateCommand-rCnhaj84.js} +1 -1
- package/dist/{webhooksCommand-BfO_JF2b.js → webhooksCommand-C0iZZfaI.js} +1 -1
- package/package.json +23 -17
- package/templates/AGENTS.md +1 -1
- package/templates/agent-docs/_index.md +1 -1
- package/templates/agent-docs/cli.md +63 -3
- package/templates/agent-docs/data.md +33 -3
- package/templates/agent-docs/plugins/versioning.md +2 -0
- package/templates/agent-docs/whats-new.md +83 -14
- package/templates/apps/api-ai/package.json +7 -7
- package/templates/apps/api-auth/package.json +8 -8
- package/templates/apps/api-backend/package.json +7 -7
- package/templates/apps/api-backend-deactivation/package.json +7 -7
- package/templates/apps/api-backend-mail/package.json +8 -8
- package/templates/apps/api-backend-mariadb/package.json +9 -9
- package/templates/apps/api-backend-sqlite/package.json +8 -8
- package/templates/apps/api-backend-storage/package.json +8 -8
- package/templates/apps/api-cms/package.json +10 -10
- package/templates/apps/api-collab/package.json +8 -8
- package/templates/apps/api-data-advanced/package.json +8 -8
- package/templates/apps/api-durable/package.json +8 -8
- package/templates/apps/api-feature-flags/package.json +9 -9
- package/templates/apps/api-governance/package.json +8 -8
- package/templates/apps/api-kv/package.json +8 -8
- package/templates/apps/api-moderation/package.json +8 -8
- package/templates/apps/api-observability/package.json +8 -8
- package/templates/apps/api-ratelimit/package.json +8 -8
- package/templates/apps/api-rbac/package.json +8 -8
- package/templates/apps/api-rest/package.json +7 -7
- package/templates/apps/api-saas/package.json +11 -11
- package/templates/apps/api-saas-starter/package.json +10 -10
- package/templates/apps/api-search/package.json +8 -8
- package/templates/apps/api-status/package.json +8 -8
- package/templates/apps/api-versioning/package.json +8 -8
- package/templates/apps/api-webhooks/package.json +9 -9
- package/templates/apps/changelog/package.json +6 -6
- package/templates/apps/edge-functions/package.json +2 -2
- package/templates/apps/frontend-admin/package.json +8 -8
- package/templates/apps/frontend-app/package.json +9 -9
- package/templates/apps/frontend-auth/package.json +8 -8
- package/templates/apps/frontend-blank/package.json +7 -7
- package/templates/apps/frontend-cms/package.json +9 -9
- package/templates/apps/frontend-collab/package.json +10 -10
- package/templates/apps/frontend-contact/package.json +7 -7
- package/templates/apps/frontend-dashboard/package.json +7 -7
- package/templates/apps/frontend-docs/package.json +7 -7
- package/templates/apps/frontend-i18n/package.json +6 -6
- package/templates/apps/frontend-landing/package.json +7 -7
- package/templates/apps/frontend-portal/package.json +8 -8
- package/templates/apps/frontend-saas/package.json +8 -8
- package/templates/apps/frontend-spa/package.json +7 -7
- package/templates/apps/frontend-ssr/package.json +7 -7
- package/templates/apps/frontend-ssr-api/package.json +8 -8
- package/templates/apps/frontend-static-blog/package.json +6 -6
- package/templates/apps/frontend-status/package.json +8 -8
- package/templates/apps/mobile-app/package.json +4 -4
- package/dist/apiBuild-XaW40W8x.js +0 -2
- package/dist/codegen-i8QGcHsi.js +0 -2
- package/dist/codegenCommand-iClXoRCW.js +0 -129
- package/dist/doctorCommand-BeLOwq7S.js +0 -2
- package/dist/serveCommand-Dg_E1ev4.js +0 -2
- package/dist/updateCommand-DcKVmLVN.js +0 -2
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { l as e, z as t } from "./dev-D-JZ6CGQ.js";
|
|
2
|
-
import { dt as n } from "./webDev-101csg6Q.js";
|
|
3
|
-
import { r } from "./codegen-CbpGCWLG.js";
|
|
4
|
-
import { basename as i, join as a, relative as o, resolve as s } from "node:path";
|
|
5
|
-
import { promises as c } from "node:fs";
|
|
6
|
-
import { pathToFileURL as l } from "node:url";
|
|
7
|
-
//#region src/mobileCodegen.ts
|
|
8
|
-
var u = "voltro.mobile.ts", d = a(".framework", "mobileApis.generated.ts"), f = (e) => e.replace(/[^a-zA-Z0-9]/g, "_"), p = async (e) => {
|
|
9
|
-
let t = a(e, u);
|
|
10
|
-
try {
|
|
11
|
-
await c.stat(t);
|
|
12
|
-
} catch {
|
|
13
|
-
return { present: !1 };
|
|
14
|
-
}
|
|
15
|
-
try {
|
|
16
|
-
let e = (await import(`${l(t).href}?t=${Date.now()}`)).default;
|
|
17
|
-
return e === void 0 || typeof e != "object" || e.apis === void 0 ? {
|
|
18
|
-
present: !0,
|
|
19
|
-
error: /* @__PURE__ */ Error(`${u} has no default export with an \`apis\` map`)
|
|
20
|
-
} : {
|
|
21
|
-
present: !0,
|
|
22
|
-
binding: e
|
|
23
|
-
};
|
|
24
|
-
} catch (e) {
|
|
25
|
-
return {
|
|
26
|
-
present: !0,
|
|
27
|
-
error: e instanceof Error ? e : Error(String(e))
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
}, m = (e, t) => {
|
|
31
|
-
let n = t.filter(([, e]) => e.package !== void 0).map(([e, t]) => {
|
|
32
|
-
let n = `${f(e)}Group`, r = `${f(e)}Descriptors`;
|
|
33
|
-
return `import { ${n === "appGroup" ? "appGroup" : `appGroup as ${n}`}, ${r === "appDescriptors" ? "appDescriptors" : `appDescriptors as ${r}`} } from '${t.package}/rpcGroup'`;
|
|
34
|
-
}), r = t.map(([e, t]) => t.package === void 0 ? ` // ${JSON.stringify(e)}: declared with \`url\` only — no local rpc surface to import.\n // Add \`package: '<the api package>'\` to ${u} to get typed hooks for it.` : ` { ${[
|
|
35
|
-
`name: ${JSON.stringify(e)}`,
|
|
36
|
-
`group: ${f(e)}Group`,
|
|
37
|
-
`descriptors: ${f(e)}Descriptors`,
|
|
38
|
-
`wsUrl: wsUrl(${JSON.stringify(e)})`
|
|
39
|
-
].join(", ")} },`), i = t.filter(([, e]) => e.url !== void 0).map(([e, t]) => ` ${JSON.stringify(e)}: ${JSON.stringify(t.url)},`);
|
|
40
|
-
return [
|
|
41
|
-
"// GENERATED BY `voltro codegen` — do not edit; regenerate with `voltro codegen`.",
|
|
42
|
-
"//",
|
|
43
|
-
`// The api bindings declared in ${u}. Only the BINDING is`,
|
|
44
|
-
"// generated: the procedure types ride the imports below, so a schema change",
|
|
45
|
-
"// in an api needs no regeneration here.",
|
|
46
|
-
"",
|
|
47
|
-
...n,
|
|
48
|
-
"import type { MobileApiBinding } from '@voltro/react-native'",
|
|
49
|
-
"",
|
|
50
|
-
"/** Every api this app talks to, bound to a runtime-resolved ws URL.",
|
|
51
|
-
" *",
|
|
52
|
-
" * The URL is a parameter because it differs per environment and `localhost`",
|
|
53
|
-
" * on a device is the DEVICE — see `resolveDevWsUrl` in @voltro/react-native. */",
|
|
54
|
-
"export const mobileApis = (",
|
|
55
|
-
" wsUrl: (apiName: string) => string,",
|
|
56
|
-
"): ReadonlyArray<MobileApiBinding> => [",
|
|
57
|
-
...r,
|
|
58
|
-
"]",
|
|
59
|
-
"",
|
|
60
|
-
"/** Api names in declaration order — the keys the hooks bind to. */",
|
|
61
|
-
`export const MOBILE_API_NAMES = [${t.map(([e]) => JSON.stringify(e)).join(", ")}] as const`,
|
|
62
|
-
...i.length > 0 ? [
|
|
63
|
-
"",
|
|
64
|
-
`/** URLs declared in ${u} for apis this app does not build. */`,
|
|
65
|
-
"export const MOBILE_API_URLS: Readonly<Record<string, string>> = {",
|
|
66
|
-
...i,
|
|
67
|
-
"}"
|
|
68
|
-
] : [],
|
|
69
|
-
""
|
|
70
|
-
].join("\n");
|
|
71
|
-
}, h = async (e) => {
|
|
72
|
-
let t = s(e), r = await p(t);
|
|
73
|
-
if (!r.present) return { kind: "not-a-mobile-app" };
|
|
74
|
-
if ("error" in r) return {
|
|
75
|
-
kind: "refused",
|
|
76
|
-
reason: `${u} could not be loaded — ${r.error.message}`
|
|
77
|
-
};
|
|
78
|
-
let i = Object.entries(r.binding.apis);
|
|
79
|
-
if (i.length === 0) return {
|
|
80
|
-
kind: "refused",
|
|
81
|
-
reason: `${u} declares no apis`
|
|
82
|
-
};
|
|
83
|
-
for (let [e, t] of i) if (t.package === void 0 && t.url === void 0) return {
|
|
84
|
-
kind: "refused",
|
|
85
|
-
reason: `api ${JSON.stringify(e)} declares neither \`package\` nor \`url\``
|
|
86
|
-
};
|
|
87
|
-
for (let [e, r] of i) if (r.package !== void 0 && await n(t, r.package) === null) return {
|
|
88
|
-
kind: "refused",
|
|
89
|
-
reason: `api ${JSON.stringify(e)}: ${r.package} is not a workspace dependency of this app. Add it to the app's package.json (\`"${r.package}": "workspace:*"\`) and install.`
|
|
90
|
-
};
|
|
91
|
-
let o = a(t, d), l = m(t, i);
|
|
92
|
-
await c.mkdir(a(t, ".framework"), { recursive: !0 });
|
|
93
|
-
let f = null;
|
|
94
|
-
try {
|
|
95
|
-
f = await c.readFile(o, "utf8");
|
|
96
|
-
} catch {}
|
|
97
|
-
return f !== l && await c.writeFile(o, l, "utf8"), {
|
|
98
|
-
kind: "wrote",
|
|
99
|
-
file: o,
|
|
100
|
-
apis: i.map(([e]) => e)
|
|
101
|
-
};
|
|
102
|
-
}, g = (e, t) => t.kind === "wrote" ? `voltro codegen: wrote ${o(e, t.file)} (apis ${t.apis.join(", ")})` : t.kind === "refused" ? `voltro codegen: ${t.reason} — refusing to write.` : `voltro codegen: no ${u} here — not a mobile app.`, _ = async (n) => {
|
|
103
|
-
let { config: a, present: o, error: s } = await e(n);
|
|
104
|
-
if (o && a === null) return {
|
|
105
|
-
kind: "refused",
|
|
106
|
-
reason: "app.config.ts exists but could not be loaded" + (s === void 0 ? "" : ` — ${s instanceof Error ? s.message : String(s)}`)
|
|
107
|
-
};
|
|
108
|
-
let c = a?.plugins ?? [], { pluginContributions: l, pluginErrorImports: u, pluginRpcImports: d } = await t(c, a?.name ?? i(n), n), f = await r({
|
|
109
|
-
root: n,
|
|
110
|
-
...l.length > 0 ? { pluginContributions: l } : {},
|
|
111
|
-
...u.length > 0 ? { pluginErrorImports: u } : {},
|
|
112
|
-
...d.length > 0 ? { pluginRpcImports: d } : {},
|
|
113
|
-
...a?.name === void 0 ? {} : { apiName: a.name }
|
|
114
|
-
});
|
|
115
|
-
return f ? {
|
|
116
|
-
kind: "wrote",
|
|
117
|
-
file: f,
|
|
118
|
-
plugins: c.length,
|
|
119
|
-
errorSchemas: u.length,
|
|
120
|
-
routes: d.length
|
|
121
|
-
} : { kind: "nothing-to-write" };
|
|
122
|
-
}, v = async (e) => {
|
|
123
|
-
let t = s(e.find((e) => !e.startsWith("-")) ?? process.cwd()), n = await h(t);
|
|
124
|
-
if (n.kind !== "not-a-mobile-app") return console.log(g(t, n)), n.kind === "wrote" ? 0 : 1;
|
|
125
|
-
let r = await _(t);
|
|
126
|
-
return r.kind === "refused" ? (console.error(`voltro codegen: ${r.reason} — refusing to write.`), console.error(" The generated file would omit every plugin's error union and client routes, and would typecheck, so the omission would only surface as a missing error tag at runtime."), 1) : r.kind === "nothing-to-write" ? (console.log("voltro codegen: no rpc primitives found — nothing to write."), 0) : (console.log(`voltro codegen: wrote ${o(t, r.file)} (plugins ${r.plugins}, error schemas ${r.errorSchemas}, plugin routes ${r.routes})`), r.plugins > 0 && r.errorSchemas === 0 && console.log(" note: no plugin contributed a cross-cutting error schema, so the wire error union carries only each procedure's own `error:`. Expected if none of your plugins declare `errorSchemas` — but `guards:` needs @voltro/plugin-rbac for its ScopeError to decode typed."), 0);
|
|
127
|
-
};
|
|
128
|
-
//#endregion
|
|
129
|
-
export { _ as regenerateRpcGroup, v as runCodegenCommand };
|