void 0.10.8 → 0.10.11
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/AGENT_PROMPT.md +4 -0
- package/README.md +1 -1
- package/dist/{agents-Bmr5tFFb.mjs → agents-CtgBYqld.mjs} +1 -1
- package/dist/{auth-cmd-DlgNwByu.mjs → auth-cmd-BqsdZJp5.mjs} +3 -3
- package/dist/{better-auth-shared-BvnM9px6.d.mts → better-auth-shared-DealXecJ.d.mts} +1 -1
- package/dist/{build-cmd-Br8qL0rA.mjs → build-cmd-Bujrv5q-.mjs} +3 -3
- package/dist/{cache-wH-mP8UE.mjs → cache-C11V8Fxq.mjs} +3 -3
- package/dist/{cancel-deploy-BEBOEgtu.mjs → cancel-deploy-fwFYF04b.mjs} +2 -2
- package/dist/cli/cli.mjs +175 -43
- package/dist/cli/env-schema-probe.d.mts +96 -0
- package/dist/cli/env-schema-probe.mjs +272 -0
- package/dist/{client-Cj96iiBH.mjs → client-Gb71-XkG.mjs} +20 -2
- package/dist/{config-BdUctCZD.mjs → config-CutEMNGJ.mjs} +3 -3
- package/dist/{config-1twldYCW.mjs → config-E03l1C_h.mjs} +8 -2
- package/dist/{create-project-DD9n8Ho-.mjs → create-project-DsYvl3TB.mjs} +3 -3
- package/dist/{db-DjKE2-A-.mjs → db-PZBsLSGb.mjs} +27 -27
- package/dist/{delete-D2kr3Kmk.mjs → delete-mh6p-zkQ.mjs} +3 -3
- package/dist/deploy-DT8wsPZd.mjs +6990 -0
- package/dist/{discover-BuVVSAum.mjs → discover-CJHyvYfR.mjs} +2 -2
- package/dist/dist-DaKKDf8D.mjs +41 -0
- package/dist/{domain-_luIsM_B.mjs → domain-DiaNQbrl.mjs} +2 -2
- package/dist/entry-D7yy4xVH.mjs +100 -0
- package/dist/{env-CO5XAS9t.mjs → env-AAHU02L6.mjs} +5 -5
- package/dist/env-mask-Dd47NbR6.mjs +90 -0
- package/dist/env-public-BfiLcMBk.d.mts +140 -0
- package/dist/env-raw-Cx8ElDdj.mjs +58 -0
- package/dist/{env-types-D51bnR-c.mjs → env-types-QBj-ndax.mjs} +2 -2
- package/dist/env-validation-BdDlGhbN.mjs +1069 -0
- package/dist/{gen-Cf79J4aw.mjs → gen-oup1xBN0.mjs} +8 -8
- package/dist/{github-cmd-B6OX9c7d.mjs → github-cmd-BdNaOVNa.mjs} +102 -3
- package/dist/{handler-imD0UVDT.d.mts → handler-Cjh8uM3Y.d.mts} +1 -1
- package/dist/{headers-BwvFGhkx.mjs → headers-BQknpzkn.mjs} +2 -2
- package/dist/index.d.mts +14 -2
- package/dist/index.mjs +102 -55
- package/dist/{init-KirOzVDs.mjs → init-Dl2PKuQn.mjs} +13 -14
- package/dist/{link-CUmiosyb.mjs → link-CdGHSIy-.mjs} +4 -4
- package/dist/{list-3GEw7b6m.mjs → list-CPwFDZ_c.mjs} +3 -3
- package/dist/{login-DJReaT_Q.mjs → login-BT3H8PN3.mjs} +2 -2
- package/dist/{logs-D-rQ56Lq.mjs → logs-Bt313ax7.mjs} +3 -2
- package/dist/{mcp-D7yc0dXY.mjs → mcp-DoM3_nhd.mjs} +7 -2
- package/dist/{node-yFFk626c.mjs → node-BDx8pmhq.mjs} +5 -5
- package/dist/{package-json-B0NuUWGd.mjs → package-json-Cx1osYo6.mjs} +1 -1
- package/dist/pages/client.d.mts +1 -1
- package/dist/pages/index.d.mts +1 -23
- package/dist/pages/index.mjs +5 -5
- package/dist/pages/islands-plugin.mjs +2 -2
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/{plugin-inference-CJxi_fWI.mjs → plugin-inference-DMeavIJ6.mjs} +4 -98
- package/dist/{prepare-C_cVurhP.mjs → prepare-DOBTY0o4.mjs} +10 -10
- package/dist/preset-BGrvB4Bl.mjs +539 -0
- package/dist/{project-cmd-DnU7u9QF.mjs → project-cmd-D_w-4w5B.mjs} +13 -9
- package/dist/{project-paths-tpdR1mJR.mjs → project-paths-BQd7OmIo.mjs} +1 -1
- package/dist/project-paths-GpziKeQQ.d.mts +25 -0
- package/dist/{project-tsconfig-D9uSVVpA.mjs → project-tsconfig-B-QtXjLQ.mjs} +2 -2
- package/dist/{protocol-6hTJ04T1.d.mts → protocol-Bnb0LFp3.d.mts} +1 -1
- package/dist/provision-BLrCEBbI.mjs +2557 -0
- package/dist/requests-B8sZxaFM.mjs +50 -0
- package/dist/{resolve-project-D2HI3TrG.mjs → resolve-project-BBMtLLV9.mjs} +1 -1
- package/dist/{rollback-Yh7bCKob.mjs → rollback-CkvTFXx5.mjs} +2 -2
- package/dist/{route-types-CfKfhbIg.mjs → route-types-COI2DsZv.mjs} +2 -2
- package/dist/{runner-h272wcPj.mjs → runner-kapo9aPs.mjs} +3 -3
- package/dist/{runner-pg-waxJOnBb.mjs → runner-pg-CHM76xuC.mjs} +1 -1
- package/dist/runtime/ai.mjs +113 -15
- package/dist/runtime/better-auth-pg.d.mts +1 -1
- package/dist/runtime/better-auth.d.mts +1 -1
- package/dist/runtime/env-public.d.mts +1 -139
- package/dist/runtime/env-public.mjs +10 -93
- package/dist/runtime/env.d.mts +14 -1
- package/dist/runtime/env.mjs +24 -10
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/isr-cache.d.mts +207 -0
- package/dist/runtime/isr-cache.mjs +523 -0
- package/dist/runtime/isr.d.mts +4 -3
- package/dist/runtime/isr.mjs +44 -5
- package/dist/runtime/live.d.mts +1 -1
- package/dist/runtime/live.mjs +1 -1
- package/dist/runtime/sandbox.mjs +1 -1
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/ws-server.d.mts +1 -1
- package/dist/runtime/ws.d.mts +2 -2
- package/dist/{scan-Dp_Gyzs3.mjs → scan-DEwlM_Xy.mjs} +2 -2
- package/dist/{scan-i7Yz54fv.mjs → scan-DYXkrasO.mjs} +4 -4
- package/dist/{secret-u7FRvg8d.mjs → secret-Dt32J6RI.mjs} +3 -3
- package/dist/{skills-DsdNDtX3.mjs → skills-CLjN0uUO.mjs} +2 -2
- package/dist/{subcommand-prompt-DtES-oP6.mjs → subcommand-prompt-BzV8iQZo.mjs} +1 -1
- package/dist/sveltekit.mjs +1 -1
- package/dist/{validate-DT7nFMlf.mjs → validate-Cw_RLeTj.mjs} +1 -1
- package/dist/{yarn-pnp-CW8LB6g_.mjs → yarn-pnp-DJn3SAHF.mjs} +1 -1
- package/getting-started-prompt.txt +3 -1
- package/package.json +6 -3
- package/schema.json +11 -0
- package/skills/void/SKILL.md +34 -33
- package/skills/void/docs/guide/auth.md +8 -0
- package/skills/void/docs/guide/deployment.md +1 -1
- package/skills/void/docs/guide/env-vars.md +14 -6
- package/skills/void/docs/guide/queues.md +4 -0
- package/skills/void/docs/integrations/cloudflare.md +171 -5
- package/skills/void/docs/node_modules/void/AGENT_PROMPT.md +4 -0
- package/skills/void/docs/node_modules/void/{AGENTS.md → CLAUDE.md} +14 -0
- package/skills/void/docs/node_modules/void/README.md +1 -1
- package/skills/void/docs/node_modules/void/node_modules/@types/proper-lockfile/README.md +51 -0
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/pathslash/README.md +64 -0
- package/skills/void/docs/node_modules/void/node_modules/pathslash/README.md +64 -0
- package/skills/void/docs/node_modules/void/node_modules/proper-lockfile/CHANGELOG.md +108 -0
- package/skills/void/docs/node_modules/void/node_modules/proper-lockfile/README.md +183 -0
- package/skills/void/docs/node_modules/void/skills/void/SKILL.md +34 -33
- package/skills/void/docs/node_modules/void/test/e2e/README.md +85 -0
- package/skills/void/docs/reference/cli.md +97 -14
- package/dist/deploy-C4PbkFyE.mjs +0 -3705
- package/dist/dotenv-D_UbC_vc.mjs +0 -173
- package/dist/env-raw-CoS20LHP.mjs +0 -32
- package/dist/env-validation-CeC2FL66.mjs +0 -163
- package/dist/pathe.M-eThtNZ-CQzLbt4c.mjs +0 -150
- package/dist/preset-CVvwCeIy.mjs +0 -208
- package/skills/void/docs/node_modules/void/node_modules/@void/md/node_modules/pathe/README.md +0 -73
- package/skills/void/docs/node_modules/void/node_modules/pathe/README.md +0 -73
package/AGENT_PROMPT.md
CHANGED
|
@@ -12,4 +12,8 @@ Rewrites and redirects: declare static rules in `void.json` under `routing.redir
|
|
|
12
12
|
|
|
13
13
|
Logs: surface app-level errors that should show up under `void project logs --level error` via `import { logger } from "void/log"` and `logger.error(msg, fields?)` (also `.warn` / `.info`). Anything caught and only persisted to your own DB is invisible to Cloudflare Tail; route it through `logger.*` or `console.*` so the platform can see it.
|
|
14
14
|
|
|
15
|
+
Requests: `void project logs` only has rows when a worker actually ran. 5xx generated by the edge router, and every request to a static/SPA project, produce no log line at all. Use `void project requests --status 5xx --range 12h` to see those — it lists status, method, and duration for every request the edge served, whether or not a worker was invoked.
|
|
16
|
+
|
|
17
|
+
Self-host deploy: `void deploy` targets the Void platform; to deploy to the user's OWN Cloudflare account instead, use `void deploy --backend cloudflare` (add `--provision` on the first deploy to create the D1/KV/R2/Queues/Hyperdrive resources the source needs). It uses local wrangler auth, so pin an account (`account_id` in `wrangler.jsonc` or `CLOUDFLARE_ACCOUNT_ID`) and keep real secrets in `wrangler secret put` — every `.env*` file this backend loads (`.env`, `.env.local`, `.env.production`, `.env.production.local`) ships as plaintext worker vars, `.local` included. Provisioning a Hyperdrive config reads `DATABASE_URL` from the shell, not from `.env*`. v1 supports full Void apps on the Cloudflare Workers target only (D1/KV/R2/Queues/Hyperdrive; auth and ISR on D1/SQLite); framework SSR of every kind (TanStack Start, React Router, vinext, SvelteKit, Nuxt, Analog, Astro), static/SPA/SSG apps (including `output: "static"`), WebSocket/Durable Object apps (`*.ws.ts`), a custom `migrations_pattern`, node/bun/deno targets, and PostgreSQL apps with auth all fail closed with guidance. Auth apps must ship checked-in migrations that produce the Better Auth schema. `--provision` is a single-operator, dev-machine step and is disabled in CI.
|
|
18
|
+
|
|
15
19
|
Full docs are in `node_modules/void/docs/`. If you have the `void` skill available, use it for a complete API reference covering project structure, routing, pages mode, database, auth, typed fetch, KV, storage, queues, cron jobs, CLI, configuration, and deployment.
|
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ export default defineConfig({
|
|
|
42
42
|
- `void auth login` — platform auth
|
|
43
43
|
- `void deploy` — build and deploy
|
|
44
44
|
- `void db *` — local DB and migration commands
|
|
45
|
-
- `void project *` — link, status, logs, rollback, delete
|
|
45
|
+
- `void project *` — link, status, logs, requests, rollback, delete
|
|
46
46
|
|
|
47
47
|
Runtime helpers include:
|
|
48
48
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __exportAll, r as __toESM, t as __commonJSMin } from "./rolldown-runtime-DJK8HYOj.mjs";
|
|
2
|
-
import { a as join } from "./
|
|
2
|
+
import { a as join } from "./dist-DaKKDf8D.mjs";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { styleText } from "node:util";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { T as log } from "./agents-
|
|
2
|
-
import { f as getToken, g as removeToken, n as PlatformClient } from "./client-
|
|
3
|
-
import { n as runLoginCommand } from "./login-
|
|
1
|
+
import { T as log } from "./agents-CtgBYqld.mjs";
|
|
2
|
+
import { f as getToken, g as removeToken, n as PlatformClient } from "./client-Gb71-XkG.mjs";
|
|
3
|
+
import { n as runLoginCommand } from "./login-BT3H8PN3.mjs";
|
|
4
4
|
import { execSync } from "node:child_process";
|
|
5
5
|
//#region src/cli/auth-cmd.ts
|
|
6
6
|
async function runAuthCommand(root, args) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as VoidAuthConfig, n as AuthState } from "./auth-qgMlYp7Z.mjs";
|
|
2
1
|
import { t as VoidAuthProvider } from "./providers-BNKRacMr.mjs";
|
|
2
|
+
import { i as VoidAuthConfig, n as AuthState } from "./auth-qgMlYp7Z.mjs";
|
|
3
3
|
import { DBFieldAttribute } from "better-auth/db";
|
|
4
4
|
import { BetterAuthOptions, betterAuth } from "better-auth";
|
|
5
5
|
import { Context } from "hono";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as outro, T as log, a as cliTitle, s as dim, u as import_picocolors, w as intro } from "./agents-
|
|
2
|
-
import { b as readProjectConfig, f as getToken, n as PlatformClient, t as PlatformApiError } from "./client-
|
|
3
|
-
import { r as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-
|
|
1
|
+
import { D as outro, T as log, a as cliTitle, s as dim, u as import_picocolors, w as intro } from "./agents-CtgBYqld.mjs";
|
|
2
|
+
import { b as readProjectConfig, f as getToken, n as PlatformClient, t as PlatformApiError } from "./client-Gb71-XkG.mjs";
|
|
3
|
+
import { r as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-BBMtLLV9.mjs";
|
|
4
4
|
import { appendFileSync, writeFileSync } from "node:fs";
|
|
5
5
|
//#region src/cli/build-cmd.ts
|
|
6
6
|
const POLL_MS = 1e3;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { D as outro, T as log, a as cliTitle, o as createSpinner, s as dim, w as intro } from "./agents-
|
|
2
|
-
import { b as readProjectConfig, f as getToken, n as PlatformClient } from "./client-
|
|
3
|
-
import { r as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-
|
|
1
|
+
import { D as outro, T as log, a as cliTitle, o as createSpinner, s as dim, w as intro } from "./agents-CtgBYqld.mjs";
|
|
2
|
+
import { b as readProjectConfig, f as getToken, n as PlatformClient } from "./client-Gb71-XkG.mjs";
|
|
3
|
+
import { r as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-BBMtLLV9.mjs";
|
|
4
4
|
//#region src/cli/cache.ts
|
|
5
5
|
async function runPurgeCacheCommand(root, projectSlug) {
|
|
6
6
|
console.log();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as outro, S as confirm, T as log, a as cliTitle, j as isCancel, w as intro } from "./agents-
|
|
2
|
-
import { b as readProjectConfig, f as getToken, n as PlatformClient } from "./client-
|
|
1
|
+
import { D as outro, S as confirm, T as log, a as cliTitle, j as isCancel, w as intro } from "./agents-CtgBYqld.mjs";
|
|
2
|
+
import { b as readProjectConfig, f as getToken, n as PlatformClient } from "./client-Gb71-XkG.mjs";
|
|
3
3
|
//#region src/cli/cancel-deploy.ts
|
|
4
4
|
const ACTIVE_STATUSES = /* @__PURE__ */ new Set([
|
|
5
5
|
"pending",
|
package/dist/cli/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as join } from "../
|
|
3
|
-
import { D as outro, E as note, T as log, d as sectionTitle, i as categoryTitle, l as helpLine, r as getPackageDir, u as import_picocolors } from "../agents-
|
|
2
|
+
import { a as join } from "../dist-DaKKDf8D.mjs";
|
|
3
|
+
import { D as outro, E as note, T as log, d as sectionTitle, i as categoryTitle, l as helpLine, r as getPackageDir, u as import_picocolors } from "../agents-CtgBYqld.mjs";
|
|
4
4
|
import { readFileSync } from "node:fs";
|
|
5
5
|
import { parseArgs } from "node:util";
|
|
6
6
|
//#region src/cli/args.ts
|
|
@@ -14,7 +14,9 @@ function parseDeployArgs(args) {
|
|
|
14
14
|
dir: { type: "string" },
|
|
15
15
|
spa: { type: "boolean" },
|
|
16
16
|
"skip-build": { type: "boolean" },
|
|
17
|
-
debug: { type: "boolean" }
|
|
17
|
+
debug: { type: "boolean" },
|
|
18
|
+
backend: { type: "string" },
|
|
19
|
+
provision: { type: "boolean" }
|
|
18
20
|
},
|
|
19
21
|
allowPositionals: true,
|
|
20
22
|
strict: true,
|
|
@@ -22,22 +24,43 @@ function parseDeployArgs(args) {
|
|
|
22
24
|
});
|
|
23
25
|
} catch (error) {
|
|
24
26
|
const message = error instanceof Error ? error.message : String(error);
|
|
25
|
-
if (message.includes("argument missing") || message.includes("argument is ambiguous"))
|
|
27
|
+
if (message.includes("argument missing") || message.includes("argument is ambiguous")) {
|
|
28
|
+
if (message.match(/Option '(--[a-z-]+)/)?.[1] === "--backend") throw new Error("deploy: --backend requires a value ('cloudflare').");
|
|
29
|
+
throw new Error("deploy: --project requires a slug.");
|
|
30
|
+
}
|
|
26
31
|
const unknownOptionMatch = message.match(/Unknown option '([^']+)'/);
|
|
27
32
|
if (unknownOptionMatch) throw new Error(`deploy: Unknown option '${unknownOptionMatch[1]}'.`);
|
|
28
33
|
throw new Error(`deploy: ${message}.`);
|
|
29
34
|
}
|
|
30
|
-
|
|
35
|
+
const tokens = parsed.tokens ?? [];
|
|
36
|
+
if (tokens.filter((token) => token.kind === "option" && token.name === "project").length > 1) throw new Error("deploy: --project can only be specified once.");
|
|
37
|
+
if (tokens.filter((token) => token.kind === "option" && token.name === "backend").length > 1) throw new Error("deploy: --backend can only be specified once.");
|
|
31
38
|
if (parsed.positionals.length > 0) throw new Error(`deploy: Unexpected argument '${parsed.positionals[0]}'.`);
|
|
32
39
|
const projectValue = parsed.values.project;
|
|
33
40
|
const projectSlug = typeof projectValue === "string" ? projectValue : void 0;
|
|
34
41
|
if (typeof projectSlug === "string" && projectSlug.startsWith("-")) throw new Error("deploy: --project requires a slug.");
|
|
42
|
+
const dir = typeof parsed.values.dir === "string" ? parsed.values.dir : void 0;
|
|
43
|
+
const spa = parsed.values.spa === true ? true : void 0;
|
|
44
|
+
const skipBuild = parsed.values["skip-build"] === true ? true : void 0;
|
|
45
|
+
const debug = parsed.values.debug === true ? true : void 0;
|
|
46
|
+
const backendValue = typeof parsed.values.backend === "string" ? parsed.values.backend : void 0;
|
|
47
|
+
if (backendValue !== void 0 && backendValue !== "cloudflare") throw new Error("deploy: --backend must be 'cloudflare'.");
|
|
48
|
+
const backend = backendValue;
|
|
49
|
+
const provision = parsed.values.provision === true ? true : void 0;
|
|
50
|
+
if (provision && backend !== "cloudflare") throw new Error("deploy: --provision requires --backend cloudflare.");
|
|
51
|
+
if (backend === "cloudflare") {
|
|
52
|
+
if (projectSlug !== void 0) throw new Error("deploy: --project is not supported with --backend cloudflare — this backend deploys to your own Cloudflare account and no Void project is involved.");
|
|
53
|
+
if (dir !== void 0) throw new Error("deploy: --dir is not supported with --backend cloudflare — this backend uploads the worker your build emits, not a static directory.");
|
|
54
|
+
if (spa) throw new Error("deploy: --spa is not supported with --backend cloudflare — this backend uploads the worker your build emits, not a static SPA.");
|
|
55
|
+
}
|
|
35
56
|
return {
|
|
36
57
|
projectSlug,
|
|
37
|
-
dir
|
|
38
|
-
spa
|
|
39
|
-
skipBuild
|
|
40
|
-
debug
|
|
58
|
+
dir,
|
|
59
|
+
spa,
|
|
60
|
+
skipBuild,
|
|
61
|
+
debug,
|
|
62
|
+
backend,
|
|
63
|
+
provision
|
|
41
64
|
};
|
|
42
65
|
}
|
|
43
66
|
//#endregion
|
|
@@ -638,6 +661,11 @@ const githubSubcommands = [
|
|
|
638
661
|
arg: "[project]",
|
|
639
662
|
description: "Show a project's GitHub connection (repo, branch, executor, workflow)"
|
|
640
663
|
},
|
|
664
|
+
{
|
|
665
|
+
name: "disconnect",
|
|
666
|
+
arg: "[project]",
|
|
667
|
+
description: "Disconnect a project from its GitHub repository"
|
|
668
|
+
},
|
|
641
669
|
{
|
|
642
670
|
name: "link",
|
|
643
671
|
description: "Link your GitHub account to Void"
|
|
@@ -780,7 +808,29 @@ function parseGithubArgs(args) {
|
|
|
780
808
|
projectName
|
|
781
809
|
};
|
|
782
810
|
}
|
|
783
|
-
|
|
811
|
+
if (subcommand === "disconnect") {
|
|
812
|
+
let projectName = "";
|
|
813
|
+
let yes = false;
|
|
814
|
+
for (let i = 0; i < rest.length; i++) {
|
|
815
|
+
const arg = rest[i];
|
|
816
|
+
if (arg === "--yes" || arg === "-y") yes = true;
|
|
817
|
+
else if (arg === "--project") {
|
|
818
|
+
if (i + 1 >= rest.length) throw new Error("github: --project requires a value.");
|
|
819
|
+
const value = rest[++i];
|
|
820
|
+
if (value.trim() === "") throw new Error("github: --project requires a value.");
|
|
821
|
+
if (projectName) throw new Error(`github: Unexpected argument '${value}'.`);
|
|
822
|
+
projectName = value;
|
|
823
|
+
} else if (arg.startsWith("-")) throw new Error(`github: Unexpected argument '${arg}'.`);
|
|
824
|
+
else if (projectName) throw new Error(`github: Unexpected argument '${arg}'.`);
|
|
825
|
+
else projectName = arg;
|
|
826
|
+
}
|
|
827
|
+
return {
|
|
828
|
+
subcommand,
|
|
829
|
+
projectName,
|
|
830
|
+
yes
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
throw new Error("github: Usage: void github <install|installations|connect|update|status|disconnect|link|join>.");
|
|
784
834
|
}
|
|
785
835
|
//#endregion
|
|
786
836
|
//#region src/cli/ascii.ts
|
|
@@ -857,7 +907,15 @@ const HELP_TREE = {
|
|
|
857
907
|
},
|
|
858
908
|
{
|
|
859
909
|
command: "--skip-build",
|
|
860
|
-
description: "Skip the build step and use existing output"
|
|
910
|
+
description: "Skip the build step and use existing output (not with --backend cloudflare)"
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
command: "--backend cloudflare",
|
|
914
|
+
description: "Deploy to your own Cloudflare account instead of the Void platform"
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
command: "--provision",
|
|
918
|
+
description: "Create missing D1/KV/R2/Queue/Hyperdrive resources (with --backend cloudflare)"
|
|
861
919
|
},
|
|
862
920
|
{
|
|
863
921
|
command: "--debug",
|
|
@@ -876,6 +934,14 @@ const HELP_TREE = {
|
|
|
876
934
|
{
|
|
877
935
|
command: "void deploy --dir dist --spa",
|
|
878
936
|
description: "Deploy a static SPA directory"
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
command: "void deploy --backend cloudflare",
|
|
940
|
+
description: "Deploy to your own Cloudflare account"
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
command: "void deploy --backend cloudflare --provision",
|
|
944
|
+
description: "Provision missing resources, then deploy to Cloudflare"
|
|
879
945
|
}
|
|
880
946
|
]
|
|
881
947
|
},
|
|
@@ -927,6 +993,10 @@ const HELP_TREE = {
|
|
|
927
993
|
command: "logs",
|
|
928
994
|
description: "Show runtime logs from the deployed project"
|
|
929
995
|
},
|
|
996
|
+
{
|
|
997
|
+
command: "requests",
|
|
998
|
+
description: "Show request-level traffic (status, method, timing)"
|
|
999
|
+
},
|
|
930
1000
|
{
|
|
931
1001
|
command: "rollback [deployId]",
|
|
932
1002
|
description: "Roll back to a previous deployment"
|
|
@@ -984,6 +1054,24 @@ const HELP_TREE = {
|
|
|
984
1054
|
}
|
|
985
1055
|
]
|
|
986
1056
|
},
|
|
1057
|
+
requests: {
|
|
1058
|
+
summary: "Show request-level traffic (status, method, type, timing). Surfaces 5xx that the edge router generated itself and requests to static/SPA projects that never invoke a worker — neither of which appears in `project logs`.",
|
|
1059
|
+
usage: ["void project requests [options]"],
|
|
1060
|
+
options: [{
|
|
1061
|
+
command: "--status <filter>",
|
|
1062
|
+
description: "Filter by status: a class like 5xx or an exact code like 500"
|
|
1063
|
+
}, {
|
|
1064
|
+
command: "--range <range>",
|
|
1065
|
+
description: "Time range to query (default: 1h)"
|
|
1066
|
+
}],
|
|
1067
|
+
examples: [{
|
|
1068
|
+
command: "void project requests --status 5xx",
|
|
1069
|
+
description: "Show recent server-error responses, including edge-generated ones"
|
|
1070
|
+
}, {
|
|
1071
|
+
command: "void project requests --range 24h",
|
|
1072
|
+
description: "Show all request traffic in the last day"
|
|
1073
|
+
}]
|
|
1074
|
+
},
|
|
987
1075
|
rollback: basicSubcommand("Roll back to a previous deployment.", "void project rollback [deployId]"),
|
|
988
1076
|
cancel: basicSubcommand("Cancel an active deployment.", "void project cancel [deployId]"),
|
|
989
1077
|
delete: {
|
|
@@ -1098,6 +1186,10 @@ const HELP_TREE = {
|
|
|
1098
1186
|
command: "status [project]",
|
|
1099
1187
|
description: "Show a project's GitHub connection (repo, branch, executor, workflow)"
|
|
1100
1188
|
},
|
|
1189
|
+
{
|
|
1190
|
+
command: "disconnect [project]",
|
|
1191
|
+
description: "Disconnect a project from its GitHub repository"
|
|
1192
|
+
},
|
|
1101
1193
|
{
|
|
1102
1194
|
command: "link",
|
|
1103
1195
|
description: "Link your GitHub account to Void"
|
|
@@ -1199,6 +1291,24 @@ const HELP_TREE = {
|
|
|
1199
1291
|
command: "void github status my-app",
|
|
1200
1292
|
description: "Show a specific project connection"
|
|
1201
1293
|
}]
|
|
1294
|
+
},
|
|
1295
|
+
disconnect: {
|
|
1296
|
+
summary: "Disconnect a project from its GitHub repository.",
|
|
1297
|
+
usage: ["void github disconnect [project] [options]"],
|
|
1298
|
+
options: [{
|
|
1299
|
+
command: "--project <name>",
|
|
1300
|
+
description: "Project name (alias for positional)"
|
|
1301
|
+
}, {
|
|
1302
|
+
command: "--yes",
|
|
1303
|
+
description: "Skip the confirmation prompt (required in non-interactive shells)"
|
|
1304
|
+
}],
|
|
1305
|
+
examples: [{
|
|
1306
|
+
command: "void github disconnect",
|
|
1307
|
+
description: "Disconnect the linked project's repository"
|
|
1308
|
+
}, {
|
|
1309
|
+
command: "void github disconnect my-app --yes",
|
|
1310
|
+
description: "Disconnect a specific project without confirmation"
|
|
1311
|
+
}]
|
|
1202
1312
|
}
|
|
1203
1313
|
}
|
|
1204
1314
|
},
|
|
@@ -1692,6 +1802,7 @@ const LOG_LEVELS = /* @__PURE__ */ new Set([
|
|
|
1692
1802
|
"debug",
|
|
1693
1803
|
"all"
|
|
1694
1804
|
]);
|
|
1805
|
+
const STATUS_FILTER = /^([1-5]xx|[1-5]\d{2}|all)$/;
|
|
1695
1806
|
const projectSubcommands = [
|
|
1696
1807
|
{
|
|
1697
1808
|
name: "status",
|
|
@@ -1711,6 +1822,10 @@ const projectSubcommands = [
|
|
|
1711
1822
|
name: "logs",
|
|
1712
1823
|
description: "Show runtime logs from the deployed project"
|
|
1713
1824
|
},
|
|
1825
|
+
{
|
|
1826
|
+
name: "requests",
|
|
1827
|
+
description: "Show request-level traffic (status, method, timing)"
|
|
1828
|
+
},
|
|
1714
1829
|
{
|
|
1715
1830
|
name: "rollback",
|
|
1716
1831
|
arg: "[deployId]",
|
|
@@ -1776,6 +1891,21 @@ function parseProjectArgs(args) {
|
|
|
1776
1891
|
level
|
|
1777
1892
|
};
|
|
1778
1893
|
}
|
|
1894
|
+
if (subcommand === "requests") {
|
|
1895
|
+
let status = "";
|
|
1896
|
+
let range = "1h";
|
|
1897
|
+
for (let i = 0; i < rest.length; i++) if (rest[i] === "--status" && rest[i + 1]) {
|
|
1898
|
+
const value = rest[++i];
|
|
1899
|
+
if (!STATUS_FILTER.test(value)) throw new Error(`project: Invalid --status '${value}'. Use a class like 5xx or an exact code like 500.`);
|
|
1900
|
+
status = value;
|
|
1901
|
+
} else if (rest[i] === "--range" && rest[i + 1]) range = rest[++i];
|
|
1902
|
+
else throw new Error(`project: Unexpected argument '${rest[i]}'.`);
|
|
1903
|
+
return {
|
|
1904
|
+
subcommand,
|
|
1905
|
+
status,
|
|
1906
|
+
range
|
|
1907
|
+
};
|
|
1908
|
+
}
|
|
1779
1909
|
if (subcommand === "rollback") {
|
|
1780
1910
|
const [deployId, extra] = rest;
|
|
1781
1911
|
if (deployId?.startsWith("-")) throw new Error(`project: Unknown flag '${deployId}'.`);
|
|
@@ -1816,7 +1946,7 @@ function parseProjectArgs(args) {
|
|
|
1816
1946
|
projectSlug
|
|
1817
1947
|
};
|
|
1818
1948
|
}
|
|
1819
|
-
throw new Error("project: Usage: void project <status|link|list|logs|rollback|cancel|delete|purge-cache>.");
|
|
1949
|
+
throw new Error("project: Usage: void project <status|link|list|logs|requests|rollback|cancel|delete|purge-cache>.");
|
|
1820
1950
|
}
|
|
1821
1951
|
//#endregion
|
|
1822
1952
|
//#region src/cli/secret-args.ts
|
|
@@ -1919,7 +2049,7 @@ async function runSubcommandGroup(command, subcommands, parse, run) {
|
|
|
1919
2049
|
const sub = args[1];
|
|
1920
2050
|
try {
|
|
1921
2051
|
if ((!sub || sub.startsWith("-")) && process.stdin.isTTY) {
|
|
1922
|
-
const { promptSubcommand } = await import("../subcommand-prompt-
|
|
2052
|
+
const { promptSubcommand } = await import("../subcommand-prompt-BzV8iQZo.mjs");
|
|
1923
2053
|
const result = await promptSubcommand(command, subcommands);
|
|
1924
2054
|
if (!result) process.exit(0);
|
|
1925
2055
|
await run(root, parse(buildArgs(result, args.slice(1))));
|
|
@@ -1948,27 +2078,29 @@ else if (command === "deploy") {
|
|
|
1948
2078
|
log.error(err instanceof Error ? err.message : String(err));
|
|
1949
2079
|
process.exit(1);
|
|
1950
2080
|
}
|
|
1951
|
-
import("../deploy-
|
|
2081
|
+
import("../deploy-DT8wsPZd.mjs").then((n) => n.t).then(({ runDeploy }) => {
|
|
1952
2082
|
runDeploy(root, {
|
|
1953
2083
|
projectSlug: deployArgs.projectSlug,
|
|
1954
2084
|
dir: deployArgs.dir,
|
|
1955
2085
|
spa: deployArgs.spa,
|
|
1956
2086
|
skipBuild: deployArgs.skipBuild,
|
|
1957
|
-
debug: deployArgs.debug
|
|
2087
|
+
debug: deployArgs.debug,
|
|
2088
|
+
backend: deployArgs.backend,
|
|
2089
|
+
provision: deployArgs.provision
|
|
1958
2090
|
}).catch((err) => {
|
|
1959
2091
|
log.error(err.message ?? err);
|
|
1960
2092
|
process.exit(1);
|
|
1961
2093
|
});
|
|
1962
2094
|
});
|
|
1963
|
-
} else if (command === "auth") runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (root, parsed) => import("../auth-cmd-
|
|
1964
|
-
else if (command === "project") runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (root, parsed) => import("../project-cmd-
|
|
1965
|
-
else if (command === "secret") runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (root, parsed) => import("../secret-
|
|
1966
|
-
else if (command === "domain") runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (root, parsed) => import("../domain-
|
|
1967
|
-
else if (command === "db") runSubcommandGroup("db", dbSubcommands, parseDbArgs, (root, parsed) => import("../db-
|
|
1968
|
-
else if (command === "env") runSubcommandGroup("env", envSubcommands, parseEnvArgs, (root, parsed) => import("../env-
|
|
1969
|
-
else if (command === "gen") runSubcommandGroup("gen", genSubcommands, parseGenArgs, (root, parsed) => import("../gen-
|
|
1970
|
-
else if (command === "github") runSubcommandGroup("github", githubSubcommands, parseGithubArgs, (root, parsed) => import("../github-cmd-
|
|
1971
|
-
else if (command === "build") runSubcommandGroup("build", buildSubcommands, parseBuildArgs, (root, parsed) => import("../build-cmd-
|
|
2095
|
+
} else if (command === "auth") runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (root, parsed) => import("../auth-cmd-BqsdZJp5.mjs").then(({ runAuthCommand }) => runAuthCommand(root, parsed)));
|
|
2096
|
+
else if (command === "project") runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (root, parsed) => import("../project-cmd-D_w-4w5B.mjs").then(({ runProjectCommand }) => runProjectCommand(root, parsed)));
|
|
2097
|
+
else if (command === "secret") runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (root, parsed) => import("../secret-Dt32J6RI.mjs").then(({ runSecretCommand }) => runSecretCommand(root, parsed)));
|
|
2098
|
+
else if (command === "domain") runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (root, parsed) => import("../domain-DiaNQbrl.mjs").then(({ runDomainCommand }) => runDomainCommand(root, parsed)));
|
|
2099
|
+
else if (command === "db") runSubcommandGroup("db", dbSubcommands, parseDbArgs, (root, parsed) => import("../db-PZBsLSGb.mjs").then(({ runDbCommand }) => runDbCommand(root, parsed)));
|
|
2100
|
+
else if (command === "env") runSubcommandGroup("env", envSubcommands, parseEnvArgs, (root, parsed) => import("../env-AAHU02L6.mjs").then(({ runEnvCommand }) => runEnvCommand(root, parsed)));
|
|
2101
|
+
else if (command === "gen") runSubcommandGroup("gen", genSubcommands, parseGenArgs, (root, parsed) => import("../gen-oup1xBN0.mjs").then(({ runGenCommand }) => runGenCommand(root, parsed)));
|
|
2102
|
+
else if (command === "github") runSubcommandGroup("github", githubSubcommands, parseGithubArgs, (root, parsed) => import("../github-cmd-BdNaOVNa.mjs").then(({ runGithubCommand }) => runGithubCommand(root, parsed)));
|
|
2103
|
+
else if (command === "build") runSubcommandGroup("build", buildSubcommands, parseBuildArgs, (root, parsed) => import("../build-cmd-Bujrv5q-.mjs").then(({ runBuildCommand }) => runBuildCommand(root, parsed)));
|
|
1972
2104
|
else if (command === "prepare") {
|
|
1973
2105
|
const root = process.cwd();
|
|
1974
2106
|
let prepareArgs;
|
|
@@ -1978,7 +2110,7 @@ else if (command === "prepare") {
|
|
|
1978
2110
|
log.error(err instanceof Error ? err.message : String(err));
|
|
1979
2111
|
process.exit(1);
|
|
1980
2112
|
}
|
|
1981
|
-
import("../prepare-
|
|
2113
|
+
import("../prepare-DOBTY0o4.mjs").then(({ runPrepareCommand }) => {
|
|
1982
2114
|
runPrepareCommand(root, prepareArgs).catch((err) => {
|
|
1983
2115
|
log.error(err.message ?? err);
|
|
1984
2116
|
process.exit(1);
|
|
@@ -1986,7 +2118,7 @@ else if (command === "prepare") {
|
|
|
1986
2118
|
});
|
|
1987
2119
|
} else if (command === "init") {
|
|
1988
2120
|
const root = process.cwd();
|
|
1989
|
-
import("../init-
|
|
2121
|
+
import("../init-Dl2PKuQn.mjs").then(({ runInitCommand, parseInitArgs }) => {
|
|
1990
2122
|
let initArgs;
|
|
1991
2123
|
try {
|
|
1992
2124
|
initArgs = parseInitArgs(args.slice(1));
|
|
@@ -1999,7 +2131,7 @@ else if (command === "prepare") {
|
|
|
1999
2131
|
process.exit(1);
|
|
2000
2132
|
});
|
|
2001
2133
|
});
|
|
2002
|
-
} else if (command === "mcp") import("../mcp-
|
|
2134
|
+
} else if (command === "mcp") import("../mcp-DoM3_nhd.mjs").then(({ runMcp }) => {
|
|
2003
2135
|
runMcp();
|
|
2004
2136
|
});
|
|
2005
2137
|
else if (command === "-v" || command === "--version") {
|
|
@@ -2025,7 +2157,7 @@ else if (command === "-v" || command === "--version") {
|
|
|
2025
2157
|
},
|
|
2026
2158
|
{
|
|
2027
2159
|
name: "project",
|
|
2028
|
-
hint: "status | link | list | logs | rollback | cancel | delete | purge-cache",
|
|
2160
|
+
hint: "status | link | list | logs | requests | rollback | cancel | delete | purge-cache",
|
|
2029
2161
|
description: "Manage projects and deployments"
|
|
2030
2162
|
},
|
|
2031
2163
|
{
|
|
@@ -2040,7 +2172,7 @@ else if (command === "-v" || command === "--version") {
|
|
|
2040
2172
|
},
|
|
2041
2173
|
{
|
|
2042
2174
|
name: "github",
|
|
2043
|
-
hint: "install | installations | connect | update | status | link | join",
|
|
2175
|
+
hint: "install | installations | connect | update | status | disconnect | link | join",
|
|
2044
2176
|
description: "Connect a GitHub repository for automatic deploys"
|
|
2045
2177
|
},
|
|
2046
2178
|
{
|
|
@@ -2078,38 +2210,38 @@ else if (command === "-v" || command === "--version") {
|
|
|
2078
2210
|
];
|
|
2079
2211
|
(async () => {
|
|
2080
2212
|
printVoidHeader();
|
|
2081
|
-
const { promptSubcommand } = await import("../subcommand-prompt-
|
|
2213
|
+
const { promptSubcommand } = await import("../subcommand-prompt-BzV8iQZo.mjs");
|
|
2082
2214
|
const result = await promptSubcommand("", topLevelCommands);
|
|
2083
2215
|
if (!result) process.exit(0);
|
|
2084
2216
|
const cmd = result.subcommand;
|
|
2085
2217
|
const root = process.cwd();
|
|
2086
2218
|
switch (cmd) {
|
|
2087
2219
|
case "init": {
|
|
2088
|
-
const { runInitCommand, parseInitArgs } = await import("../init-
|
|
2220
|
+
const { runInitCommand, parseInitArgs } = await import("../init-Dl2PKuQn.mjs");
|
|
2089
2221
|
await runInitCommand(root, parseInitArgs([]));
|
|
2090
2222
|
return;
|
|
2091
2223
|
}
|
|
2092
2224
|
case "deploy": {
|
|
2093
|
-
const { runDeploy } = await import("../deploy-
|
|
2225
|
+
const { runDeploy } = await import("../deploy-DT8wsPZd.mjs").then((n) => n.t);
|
|
2094
2226
|
await runDeploy(root);
|
|
2095
2227
|
return;
|
|
2096
2228
|
}
|
|
2097
2229
|
case "mcp": {
|
|
2098
|
-
const { runMcp } = await import("../mcp-
|
|
2230
|
+
const { runMcp } = await import("../mcp-DoM3_nhd.mjs");
|
|
2099
2231
|
runMcp();
|
|
2100
2232
|
return;
|
|
2101
2233
|
}
|
|
2102
|
-
case "auth": return runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (r, p) => import("../auth-cmd-
|
|
2103
|
-
case "project": return runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (r, p) => import("../project-cmd-
|
|
2104
|
-
case "secret": return runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (r, p) => import("../secret-
|
|
2105
|
-
case "domain": return runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (r, p) => import("../domain-
|
|
2106
|
-
case "github": return runSubcommandGroup("github", githubSubcommands, parseGithubArgs, (r, p) => import("../github-cmd-
|
|
2107
|
-
case "build": return runSubcommandGroup("build", buildSubcommands, parseBuildArgs, (r, p) => import("../build-cmd-
|
|
2108
|
-
case "db": return runSubcommandGroup("db", dbSubcommands, parseDbArgs, (r, p) => import("../db-
|
|
2109
|
-
case "env": return runSubcommandGroup("env", envSubcommands, parseEnvArgs, (r, p) => import("../env-
|
|
2110
|
-
case "gen": return runSubcommandGroup("gen", genSubcommands, parseGenArgs, (r, p) => import("../gen-
|
|
2234
|
+
case "auth": return runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (r, p) => import("../auth-cmd-BqsdZJp5.mjs").then(({ runAuthCommand }) => runAuthCommand(r, p)));
|
|
2235
|
+
case "project": return runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (r, p) => import("../project-cmd-D_w-4w5B.mjs").then(({ runProjectCommand }) => runProjectCommand(r, p)));
|
|
2236
|
+
case "secret": return runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (r, p) => import("../secret-Dt32J6RI.mjs").then(({ runSecretCommand }) => runSecretCommand(r, p)));
|
|
2237
|
+
case "domain": return runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (r, p) => import("../domain-DiaNQbrl.mjs").then(({ runDomainCommand }) => runDomainCommand(r, p)));
|
|
2238
|
+
case "github": return runSubcommandGroup("github", githubSubcommands, parseGithubArgs, (r, p) => import("../github-cmd-BdNaOVNa.mjs").then(({ runGithubCommand }) => runGithubCommand(r, p)));
|
|
2239
|
+
case "build": return runSubcommandGroup("build", buildSubcommands, parseBuildArgs, (r, p) => import("../build-cmd-Bujrv5q-.mjs").then(({ runBuildCommand }) => runBuildCommand(r, p)));
|
|
2240
|
+
case "db": return runSubcommandGroup("db", dbSubcommands, parseDbArgs, (r, p) => import("../db-PZBsLSGb.mjs").then(({ runDbCommand }) => runDbCommand(r, p)));
|
|
2241
|
+
case "env": return runSubcommandGroup("env", envSubcommands, parseEnvArgs, (r, p) => import("../env-AAHU02L6.mjs").then(({ runEnvCommand }) => runEnvCommand(r, p)));
|
|
2242
|
+
case "gen": return runSubcommandGroup("gen", genSubcommands, parseGenArgs, (r, p) => import("../gen-oup1xBN0.mjs").then(({ runGenCommand }) => runGenCommand(r, p)));
|
|
2111
2243
|
case "prepare": {
|
|
2112
|
-
const { runPrepareCommand } = await import("../prepare-
|
|
2244
|
+
const { runPrepareCommand } = await import("../prepare-DOBTY0o4.mjs");
|
|
2113
2245
|
await runPrepareCommand(root, parsePrepareArgs([]));
|
|
2114
2246
|
return;
|
|
2115
2247
|
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
//#region src/cli/env-validation.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The stable, values-free classification of a self-host schema failure.
|
|
4
|
+
* env.ts evaluation and Standard-Schema validators run ARBITRARY user code that
|
|
5
|
+
* can embed an env value in a thrown/rejected error (its `message`, `stack`, or
|
|
6
|
+
* `cause`), and `VOID_ENV_UNMASK` disables redaction — so the original error is
|
|
7
|
+
* never surfaced. Every {@link SelfHostSchemaError} instead carries only one of
|
|
8
|
+
* these codes plus fixed text, so neither its message, its `reason` field, nor
|
|
9
|
+
* its JSON serialization can echo a value.
|
|
10
|
+
* - `schema-load-failed` — importing/evaluating the user's env.ts threw.
|
|
11
|
+
* - `schema-validation-error` — a registered validator threw or rejected while
|
|
12
|
+
* checking a production value.
|
|
13
|
+
*/
|
|
14
|
+
type SelfHostSchemaFailureReason = "schema-load-failed" | "schema-validation-error";
|
|
15
|
+
/**
|
|
16
|
+
* The env-INSENSITIVE structural facts the self-host secret gate needs from the
|
|
17
|
+
* project's env schema: whether a schema is registered, the REQUIRED key names (a
|
|
18
|
+
* validator that rejects the ABSENT value — {@link requiredSchemaKeys}), and the
|
|
19
|
+
* keys the schema flags `.secret()` ({@link getSecretOverride} === 'secret').
|
|
20
|
+
* NONE of these depend on which `.env` file the build reads — they are fixed by
|
|
21
|
+
* env.ts's structure — so this needs no `loadEnv` and no build env, and the result
|
|
22
|
+
* is the SAME regardless of the build's mode/envDir. That is precisely why the old
|
|
23
|
+
* probe-vs-build divergence class is gone: nothing derived here can diverge from
|
|
24
|
+
* the build over which `.env*` set was loaded.
|
|
25
|
+
*/
|
|
26
|
+
type SelfHostSchemaFacts = {
|
|
27
|
+
/** Whether the project registered an env schema at all (no schema → nothing to gate). */hasSchema: boolean; /** Required key NAMES — validator rejects `undefined`. Values-free. */
|
|
28
|
+
requiredKeys: Array<string>; /** Keys the schema flags `.secret()`. Values-free. */
|
|
29
|
+
secretKeys: Array<string>;
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/cli/env-schema-probe.d.ts
|
|
33
|
+
/** Input handed to the child (JSON in argv[3]). Path only — no env values cross here. */
|
|
34
|
+
type EnvSchemaProbeInput = {
|
|
35
|
+
root: string;
|
|
36
|
+
};
|
|
37
|
+
/** The reason the `facts` probe rejected the app as unsupported (values-free). */
|
|
38
|
+
type EnvSchemaProbeRejectReason = "custom-envdir" | "non-production-mode";
|
|
39
|
+
/**
|
|
40
|
+
* The structured result of the `facts` operation. `ok` carries the env-insensitive
|
|
41
|
+
* schema facts; `reject` fails the deploy closed pre-account with clear v1-scope
|
|
42
|
+
* guidance; `schema-error` surfaces a values-free env.ts/validator failure.
|
|
43
|
+
*
|
|
44
|
+
* `reject` crosses the process boundary as a FIXED reason CODE only — never the raw
|
|
45
|
+
* resolved `mode` / `envDir` strings. Those are arbitrary Vite-config-derived values
|
|
46
|
+
* (a config could set `envDir`/`mode` from any inherited secret), so echoing them
|
|
47
|
+
* over fd 3 or into a parent log would break the values-free boundary; the parent
|
|
48
|
+
* renders fixed guidance from the code alone.
|
|
49
|
+
*/
|
|
50
|
+
type EnvSchemaProbeResult = {
|
|
51
|
+
kind: "ok";
|
|
52
|
+
facts: SelfHostSchemaFacts;
|
|
53
|
+
} | {
|
|
54
|
+
kind: "reject";
|
|
55
|
+
reason: EnvSchemaProbeRejectReason;
|
|
56
|
+
} | {
|
|
57
|
+
kind: "schema-error";
|
|
58
|
+
reason: SelfHostSchemaFailureReason;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* The structured result of the `validate-emitted` operation. `invalid-keys` carries
|
|
62
|
+
* the FAILING key NAMES only (never a value); `schema-error` surfaces a values-free
|
|
63
|
+
* env.ts/validator failure.
|
|
64
|
+
*/
|
|
65
|
+
type EnvSchemaValidateResult = {
|
|
66
|
+
kind: "invalid-keys";
|
|
67
|
+
invalidKeys: Array<string>;
|
|
68
|
+
} | {
|
|
69
|
+
kind: "schema-error";
|
|
70
|
+
reason: SelfHostSchemaFailureReason;
|
|
71
|
+
};
|
|
72
|
+
/** Minimal structural shape of a `spawnSync`-style result (injectable in tests). */
|
|
73
|
+
type EnvSchemaProbeSpawnResult = {
|
|
74
|
+
status: number | null; /** The fd-3 buffer (the framed result) — dedicated so stdout noise can't truncate it. */
|
|
75
|
+
fd3: string | null;
|
|
76
|
+
error?: Error | null;
|
|
77
|
+
signal?: NodeJS.Signals | null;
|
|
78
|
+
};
|
|
79
|
+
type EnvSchemaProbeSpawn = (command: string, args: Array<string>, options: {
|
|
80
|
+
cwd: string;
|
|
81
|
+
env: NodeJS.ProcessEnv;
|
|
82
|
+
}) => EnvSchemaProbeSpawnResult;
|
|
83
|
+
/**
|
|
84
|
+
* PARENT side (`facts`): return the env-insensitive schema facts + the v1 envDir/mode
|
|
85
|
+
* narrowing. Runs pre-build so a custom envDir / non-production mode / broken env.ts
|
|
86
|
+
* fails fast, before any account op.
|
|
87
|
+
*/
|
|
88
|
+
declare function resolveEnvSchemaFactsViaSubprocess(input: EnvSchemaProbeInput, env: NodeJS.ProcessEnv, spawn?: EnvSchemaProbeSpawn): Promise<EnvSchemaProbeResult>;
|
|
89
|
+
/**
|
|
90
|
+
* PARENT side (`validate-emitted`): validate the REAL emitted worker `vars` against
|
|
91
|
+
* the schema validators and return the FAILING key NAMES only. Runs post-build so
|
|
92
|
+
* the values validated are exactly what the worker ships.
|
|
93
|
+
*/
|
|
94
|
+
declare function validateEmittedVarsViaSubprocess(input: EnvSchemaProbeInput, env: NodeJS.ProcessEnv, spawn?: EnvSchemaProbeSpawn): Promise<EnvSchemaValidateResult>;
|
|
95
|
+
//#endregion
|
|
96
|
+
export { EnvSchemaProbeInput, EnvSchemaProbeRejectReason, EnvSchemaProbeResult, EnvSchemaProbeSpawn, EnvSchemaProbeSpawnResult, EnvSchemaValidateResult, resolveEnvSchemaFactsViaSubprocess, validateEmittedVarsViaSubprocess };
|