void 0.7.12 → 0.8.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/AGENT_PROMPT.md +1 -1
- package/README.md +2 -2
- package/dist/{agents-DqkFfc2c.mjs → agents-Dkgafwfr.mjs} +1 -1
- package/dist/{auth-cmd-bS88H4Lb.mjs → auth-cmd-B1-7r6ng.mjs} +3 -3
- package/dist/{better-auth-shared-D2JaoCs4.mjs → better-auth-shared-CbAF6sOM.mjs} +1 -1
- package/dist/{better-auth-shared-HXlHRw02.d.mts → better-auth-shared-Fzyk5yS1.d.mts} +2 -7
- package/dist/{cache-DUDCNty6.mjs → cache-CGYC-2LW.mjs} +5 -5
- package/dist/{cancel-deploy-DOuSbPwX.mjs → cancel-deploy-B4j31z7d.mjs} +4 -4
- package/dist/canonical-json-CEyQaVDa.mjs +13 -0
- package/dist/cli/cli.mjs +44 -31
- package/dist/{client-C_DYiXeu.mjs → client-C-nH6yz3.mjs} +5 -5
- package/dist/{collect-HqAuilH6.mjs → collect-9rO3JFNM.mjs} +1 -1
- package/dist/{config-DyUSwbeX.mjs → config--wXmVOoe.mjs} +10 -8
- package/dist/{config-CeRQg3Lz.mjs → config-BVEC0lti.mjs} +11 -2
- package/dist/{config-CvHtTM0q.mjs → config-hhMYPVRT.mjs} +3 -12
- package/dist/{create-project-hvFe6rbI.mjs → create-project-BGnQMy5N.mjs} +44 -18
- package/dist/{db-YEYSTfGw.mjs → db-CT5Xg6ds.mjs} +42 -37
- package/dist/{delete-XyM_VD9o.mjs → delete-eMGTHHB9.mjs} +5 -5
- package/dist/{deploy-CPAEgVQm.mjs → deploy-7EA_lKq9.mjs} +169 -99
- package/dist/{discover-CKGQpis8.mjs → discover-C8N1I4tK.mjs} +9 -6
- package/dist/{domain-Dvj7u8tr.mjs → domain-UfLrp2vc.mjs} +64 -22
- package/dist/{drizzle-Cx7cVwrE.mjs → drizzle-DmaANP4-.mjs} +1 -1
- package/dist/{env-Bjl0rzuf.mjs → env-Cvdbbm_N.mjs} +7 -7
- package/dist/{env-helpers-Dw95CU8e.d.mts → env-helpers-Bt9yYg5I.d.mts} +1 -1
- package/dist/{env-types-BSQghXbx.mjs → env-types-D6qI1ThV.mjs} +8 -19
- package/dist/{env-validation-Buy5pe3u.mjs → env-validation-DBJsxZLz.mjs} +4 -4
- package/dist/{gen-DU8NIdrH.mjs → gen-Cn2hZ8RR.mjs} +37 -31
- package/dist/{handler-DJTuxB10.d.mts → handler-BPhL8AmU.d.mts} +3 -3
- package/dist/{headers-CuVHn6Kl.mjs → headers-wAPJigtE.mjs} +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +273 -104
- package/dist/{init-iIiQWzyB.mjs → init-DL6syXuF.mjs} +124 -38
- package/dist/{link-DdXqlUiJ.mjs → link-C5x1E-XZ.mjs} +5 -5
- package/dist/{list-9Bxa5Odn.mjs → list-ezL7hqDV.mjs} +5 -5
- package/dist/{login-C_MfDjhu.mjs → login-CkLr-AaI.mjs} +3 -3
- package/dist/{logs-DjqCpEER.mjs → logs-MnGILmLz.mjs} +4 -4
- package/dist/{mcp-vA0880_K.mjs → mcp-B84MmVAW.mjs} +3 -3
- package/dist/{node-gxRQXIRT.mjs → node-fpywdcbN.mjs} +6 -6
- package/dist/{output-D3g5otMC.mjs → output-DeiS4oEX.mjs} +1 -1
- package/dist/pages/client.d.mts +1 -1
- package/dist/pages/head-client.d.mts +1 -1
- package/dist/pages/head.d.mts +1 -1
- package/dist/pages/index.d.mts +28 -3
- package/dist/pages/index.mjs +6 -5
- package/dist/pages/islands-plugin.d.mts +1 -1
- package/dist/pages/islands-plugin.mjs +15 -14
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +1 -1
- package/dist/{pathe.M-eThtNZ-D-kmWkCS.mjs → pathe.M-eThtNZ-BrPhGF_K.mjs} +1 -1
- package/dist/plan-aD3wRDqF.mjs +271 -0
- package/dist/{plugin-inference-BexV6LL3.mjs → plugin-inference-Ba1uGdIy.mjs} +26 -20
- package/dist/{prepare-BEkH89oX.mjs → prepare-BrAISonG.mjs} +29 -19
- package/dist/{preset-CYQh93UF.mjs → preset-BRsCi8ZB.mjs} +10 -8
- package/dist/{project-DhB4A8_g.mjs → project-CH9pdo16.mjs} +1 -1
- package/dist/{project-cmd-CeXO06hG.mjs → project-cmd-JQUzv3qF.mjs} +10 -10
- package/dist/project-paths-CCMrHYQm.mjs +100 -0
- package/dist/{project-slug-KRvHQEQI.mjs → project-slug-De4UjtD9.mjs} +0 -1
- package/dist/{project-tsconfig-Bfy55qvs.mjs → project-tsconfig-HAGjfY6w.mjs} +10 -5
- package/dist/{protocol-D7r_deVZ.d.mts → protocol-mcSsdMij.d.mts} +3 -3
- package/dist/providers--_pvxpNN.d.mts +7 -0
- package/dist/{resolve-project-DdjLQ2tB.mjs → resolve-project-CNpUbUHd.mjs} +1 -1
- package/dist/{rollback-C8OSMxmq.mjs → rollback-CoAAvC18.mjs} +4 -4
- package/dist/{route-types-qVL-v-CB.mjs → route-types-jxRfWuCb.mjs} +1 -1
- package/dist/{runner-C0d3lJo1.mjs → runner-BkGBfr4e.mjs} +4 -2
- package/dist/{runner-pg-Bd_172vF.mjs → runner-pg-BXP0JpHW.mjs} +1 -1
- package/dist/runtime/ai.mjs +2 -2
- package/dist/runtime/auth.d.mts +1 -1
- package/dist/runtime/better-auth-pg.d.mts +1 -1
- package/dist/runtime/better-auth-pg.mjs +2 -2
- package/dist/runtime/better-auth.d.mts +1 -1
- package/dist/runtime/better-auth.mjs +2 -2
- package/dist/runtime/client.d.mts +2 -2
- package/dist/runtime/client.mjs +1 -1
- package/dist/runtime/env-helpers.d.mts +1 -1
- package/dist/runtime/env-public-client.d.mts +1 -1
- package/dist/runtime/env-public.d.mts +2 -2
- package/dist/runtime/env-public.mjs +1 -1
- package/dist/runtime/env.mjs +1 -1
- package/dist/runtime/fetch-stream.d.mts +1 -1
- package/dist/runtime/fetch-stream.mjs +1 -1
- package/dist/runtime/fetch.d.mts +1 -1
- package/dist/runtime/fetch.mjs +1 -1
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/handler.mjs +1 -1
- package/dist/runtime/isr.mjs +1 -1
- package/dist/runtime/live.d.mts +2 -2
- package/dist/runtime/live.mjs +1 -1
- package/dist/runtime/migration-handler.d.mts +33 -1
- package/dist/runtime/migration-handler.mjs +398 -23
- package/dist/runtime/remote/index.mjs +1 -1
- package/dist/runtime/sandbox.d.mts +73 -3
- package/dist/runtime/sandbox.mjs +239 -3
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/ws-server.d.mts +2 -2
- package/dist/runtime/ws.d.mts +3 -3
- package/dist/{scan-CKpylFj9.mjs → scan-2YmJkYAf.mjs} +4 -3
- package/dist/{scan-CkK1Hzpa.mjs → scan-DzzHqtiT.mjs} +82 -43
- package/dist/{secret-NDvlqAN2.mjs → secret-mz8t_CML.mjs} +5 -5
- package/dist/{skills-SAG0WyVn.mjs → skills-B_ynF4lA.mjs} +3 -3
- package/dist/{subcommand-prompt-q9T06dpg.mjs → subcommand-prompt-CPuV7tPW.mjs} +2 -2
- package/dist/sveltekit.mjs +1 -1
- package/dist/{validate-DW3ViKTA.mjs → validate-CNWm-PsL.mjs} +49 -9
- package/dist/{yarn-pnp-6LD6_3Ej.mjs → yarn-pnp-QgEYVC3V.mjs} +1 -1
- package/getting-started-prompt.txt +2 -2
- package/package.json +3 -2
- package/schema.json +5 -0
- package/skills/void/SKILL.md +1 -1
- package/skills/void/docs/guide/ai.md +1 -1
- package/skills/void/docs/guide/app-types.md +1 -1
- package/skills/void/docs/guide/database/postgresql.md +1 -1
- package/skills/void/docs/guide/edge/headers.md +1 -1
- package/skills/void/docs/guide/edge/static-assets.md +34 -0
- package/skills/void/docs/guide/pages-routing/overview.md +1 -1
- package/skills/void/docs/guide/quickstart.md +2 -2
- package/skills/void/docs/guide/sandboxes.md +3 -2
- package/skills/void/docs/guide/ssr.md +25 -2
- package/skills/void/docs/integrations/cloudflare.md +5 -3
- package/skills/void/docs/integrations/frameworks/overview.md +1 -1
- package/skills/void/docs/integrations/nodejs-bun-deno.md +10 -9
- package/skills/void/docs/node_modules/void/AGENT_PROMPT.md +1 -1
- package/skills/void/docs/node_modules/void/README.md +2 -2
- package/skills/void/docs/node_modules/void/skills/void/SKILL.md +1 -1
- package/skills/void/docs/reference/api.md +204 -13
- package/skills/void/docs/reference/cli.md +55 -7
- package/skills/void/docs/reference/config.md +27 -4
- package/skills/void/docs/reference/resource-inference.md +1 -1
- /package/dist/{auth-DmuALf16.d.mts → auth-SfRBhXan.d.mts} +0 -0
- /package/dist/{auth-migrations-BwLPwRgH.mjs → auth-migrations-BqJoGqGQ.mjs} +0 -0
- /package/dist/{cf-access-BW8K93Fm.mjs → cf-access-DKDsgwOU.mjs} +0 -0
- /package/dist/{defer-2ARBu8Et.mjs → defer-DkoEwda-.mjs} +0 -0
- /package/dist/{dist-q8b2Mjgb.mjs → dist-DR9sIMbM.mjs} +0 -0
- /package/dist/{dist-D2L3_KTK.mjs → dist-abzUneor.mjs} +0 -0
- /package/dist/{dotenv-HQNhRalS.mjs → dotenv-Bkoqyq9r.mjs} +0 -0
- /package/dist/{env-raw-DtfQ9E31.mjs → env-raw-zk5JQKZe.mjs} +0 -0
- /package/dist/{fetch-error-DZ868Xq4.d.mts → fetch-error-BbixZ9vW.d.mts} +0 -0
- /package/dist/{fetch-error-CEr0ACTl.mjs → fetch-error-rXermVU3.mjs} +0 -0
- /package/dist/{head-C7QW7UY1.d.mts → head-CZs8dMxG.d.mts} +0 -0
- /package/dist/{log-7ChR5Fbc.mjs → log-CWWZV4V1.mjs} +0 -0
- /package/dist/{magic-string.es-DS_lmuBe.mjs → magic-string.es-C1Fb0uxq.mjs} +0 -0
- /package/dist/{providers-BlFNPYen.mjs → providers-uC0PJg1c.mjs} +0 -0
- /package/dist/{standard-schema-D2qvCEYV.d.mts → standard-schema-WhHcCaqJ.d.mts} +0 -0
- /package/dist/{types-DG_Ynnyd.d.mts → types-C8wsi1hv.d.mts} +0 -0
package/AGENT_PROMPT.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## Void
|
|
2
2
|
|
|
3
|
-
This project uses [Void](https://void.cloud) — a fullstack Vite plugin + deployment platform for Cloudflare. `voidPlugin()` in `vite.config.ts` gives you file-based API routing on Hono (`routes/`), Inertia-inspired server-rendered pages with co-located loaders/actions (`pages/` + `@void/vue` or `@void/react`), auto-provisioned D1/KV/R2 bindings, first-class Drizzle ORM integration (schema in `db/schema.ts` -> `void/db` Drizzle instance -> typed routes -> typed fetch client), built-in auth, queues, cron jobs, edge caching (ISR), and one-command deploys via `npx void deploy`. For first-time setup, prefer `npx void init`; in an empty directory, install `void` first and let the interactive flow scaffold the starter, add the matching framework adapter, configure project files, handle auth, and link or create the deploy project before the first deploy. In an existing app, `void init` configures Void in place by adding missing Vite scripts and creating or patching `vite.config.*` with `voidPlugin()`. Use `void` and `@void/*` package names in source code and package manifests.
|
|
3
|
+
This project uses [Void](https://void.cloud) — a fullstack Vite plugin + deployment platform for Cloudflare. `voidPlugin()` in `vite.config.ts` gives you file-based API routing on Hono (`routes/`), Inertia-inspired server-rendered pages with co-located loaders/actions (`pages/` + `@void/vue` or `@void/react`), auto-provisioned D1/KV/R2 bindings, first-class Drizzle ORM integration (schema in `db/schema.ts` -> `void/db` Drizzle instance -> typed routes -> typed fetch client), built-in auth, queues, cron jobs, edge caching (ISR), and one-command deploys via `npx void deploy`. For first-time setup, prefer `npx void init`; in an empty directory, install `void` first and let the interactive flow scaffold the starter with Vite+ by default, add the matching framework adapter, configure project files, handle auth, and link or create the deploy project before the first deploy. In an existing app, `void init` configures Void in place by adding missing Vite scripts and creating or patching `vite.config.*` with `voidPlugin()`. Use `void` and `@void/*` package names in source code and package manifests.
|
|
4
4
|
|
|
5
5
|
Database: define Drizzle tables in `db/schema.ts`, import `db` from `void/db` and tables from `@schema`. Use `void db push` for prototyping, `void db generate` for production migrations. `drizzle-orm` and `drizzle-kit` ship with void (no extra install). Migrations live in `db/migrations/`.
|
|
6
6
|
|
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ Install the Void CLI:
|
|
|
21
21
|
npm install -D void
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
If you run `void init` in an empty directory, the scaffold flow adds the matching Pages adapter and Vite
|
|
24
|
+
If you run `void init` in an empty directory, the scaffold flow adds the matching Pages adapter and Vite+ by default.
|
|
25
25
|
|
|
26
26
|
Then run `npx void init`. In an empty directory, the full interactive flow can scaffold a starter, configure local project files, log you in, and link or create your Void project so the next step is just `npx void deploy`. In an existing app, it configures Void in place by adding missing Vite scripts and creating or patching `vite.config.*` with `voidPlugin()`.
|
|
27
27
|
|
|
@@ -82,7 +82,7 @@ There is Vinext-specific source in the repo, but it is intentionally on hold and
|
|
|
82
82
|
|
|
83
83
|
## Documentation
|
|
84
84
|
|
|
85
|
-
Full docs live at [void.cloud/
|
|
85
|
+
Full docs live at [void.cloud/guide](https://void.cloud/guide).
|
|
86
86
|
|
|
87
87
|
## License
|
|
88
88
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as getToken, d as removeToken, n as PlatformClient } from "./client-
|
|
2
|
-
import { c as R } from "./dist-
|
|
3
|
-
import { n as runLoginCommand } from "./login-
|
|
1
|
+
import { c as getToken, d as removeToken, n as PlatformClient } from "./client-C-nH6yz3.mjs";
|
|
2
|
+
import { c as R } from "./dist-abzUneor.mjs";
|
|
3
|
+
import { n as runLoginCommand } from "./login-CkLr-AaI.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,4 +1,4 @@
|
|
|
1
|
-
import { a as isVoidSocialAuthProvider, r as getVoidAuthProviderEnvNames } from "./providers-
|
|
1
|
+
import { a as isVoidSocialAuthProvider, r as getVoidAuthProviderEnvNames } from "./providers-uC0PJg1c.mjs";
|
|
2
2
|
import { authContext } from "./runtime/auth.mjs";
|
|
3
3
|
import { randomBytes, scrypt, timingSafeEqual } from "node:crypto";
|
|
4
4
|
import { betterAuth } from "better-auth";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { i as VoidAuthConfig, n as AuthState } from "./auth-
|
|
1
|
+
import { i as VoidAuthConfig, n as AuthState } from "./auth-SfRBhXan.mjs";
|
|
2
|
+
import { t as VoidAuthProvider } from "./providers--_pvxpNN.mjs";
|
|
2
3
|
import { DBFieldAttribute } from "better-auth/db";
|
|
3
4
|
import { BetterAuthOptions, betterAuth } from "better-auth";
|
|
4
5
|
import { Context } from "hono";
|
|
@@ -28,12 +29,6 @@ type VoidAuthMigrationSchema = {
|
|
|
28
29
|
tables: Array<VoidAuthMigrationTable>;
|
|
29
30
|
};
|
|
30
31
|
//#endregion
|
|
31
|
-
//#region src/auth/providers.d.ts
|
|
32
|
-
declare const VOID_SOCIAL_AUTH_PROVIDERS: readonly ["apple", "atlassian", "cognito", "discord", "dropbox", "facebook", "figma", "github", "gitlab", "google", "huggingface", "kakao", "kick", "line", "linear", "linkedin", "microsoft", "naver", "notion", "paybin", "paypal", "polar", "railway", "reddit", "roblox", "salesforce", "slack", "spotify", "tiktok", "twitch", "twitter", "vercel", "vk", "zoom"];
|
|
33
|
-
declare const VOID_EMAIL_AUTH_PROVIDER = "email";
|
|
34
|
-
declare const VOID_AUTH_PROVIDERS: readonly [typeof VOID_EMAIL_AUTH_PROVIDER, ...typeof VOID_SOCIAL_AUTH_PROVIDERS];
|
|
35
|
-
type VoidAuthProvider = (typeof VOID_AUTH_PROVIDERS)[number];
|
|
36
|
-
//#endregion
|
|
37
32
|
//#region src/runtime/better-auth-shared.d.ts
|
|
38
33
|
type VoidAuthDialect = "sqlite" | "postgresql";
|
|
39
34
|
type VoidAuthRuntimeOptions = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { i as dim, n as cliTitle, r as createSpinner } from "./output-
|
|
2
|
-
import { c as getToken, n as PlatformClient } from "./client-
|
|
3
|
-
import { c as R, g as ge, y as ye } from "./dist-
|
|
4
|
-
import { r as readProjectConfig } from "./project-
|
|
5
|
-
import { r as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-
|
|
1
|
+
import { i as dim, n as cliTitle, r as createSpinner } from "./output-DeiS4oEX.mjs";
|
|
2
|
+
import { c as getToken, n as PlatformClient } from "./client-C-nH6yz3.mjs";
|
|
3
|
+
import { c as R, g as ge, y as ye } from "./dist-abzUneor.mjs";
|
|
4
|
+
import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
|
|
5
|
+
import { r as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-CNpUbUHd.mjs";
|
|
6
6
|
//#region src/cli/cache.ts
|
|
7
7
|
async function runPurgeCacheCommand(root, projectSlug) {
|
|
8
8
|
console.log();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as cliTitle } from "./output-
|
|
2
|
-
import { c as getToken, n as PlatformClient } from "./client-
|
|
3
|
-
import { c as R, g as ge, v as ue, x as q, y as ye } from "./dist-
|
|
4
|
-
import { r as readProjectConfig } from "./project-
|
|
1
|
+
import { n as cliTitle } from "./output-DeiS4oEX.mjs";
|
|
2
|
+
import { c as getToken, n as PlatformClient } from "./client-C-nH6yz3.mjs";
|
|
3
|
+
import { c as R, g as ge, v as ue, x as q, y as ye } from "./dist-abzUneor.mjs";
|
|
4
|
+
import { r as readProjectConfig } from "./project-CH9pdo16.mjs";
|
|
5
5
|
//#region src/cli/cancel-deploy.ts
|
|
6
6
|
const ACTIVE_STATUSES = new Set([
|
|
7
7
|
"pending",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/migrations/canonical-json.ts
|
|
2
|
+
function canonicalJson(value) {
|
|
3
|
+
if (value === null) return "null";
|
|
4
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return JSON.stringify(value);
|
|
5
|
+
if (Array.isArray(value)) return `[${value.map((entry) => canonicalJson(entry)).join(",")}]`;
|
|
6
|
+
if (typeof value === "object") {
|
|
7
|
+
const object = value;
|
|
8
|
+
return `{${Object.keys(object).sort().filter((key) => object[key] !== void 0).map((key) => `${JSON.stringify(key)}:${canonicalJson(object[key])}`).join(",")}}`;
|
|
9
|
+
}
|
|
10
|
+
throw new TypeError(`Unsupported canonical JSON value: ${typeof value}`);
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { canonicalJson as t };
|
package/dist/cli/cli.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as join } from "../pathe.M-eThtNZ-
|
|
3
|
-
import { c as sectionTitle, o as helpLine, s as import_picocolors, t as categoryTitle } from "../output-
|
|
4
|
-
import { c as R, u as Se, y as ye } from "../dist-
|
|
5
|
-
import { r as getPackageDir } from "../agents-
|
|
2
|
+
import { a as join } from "../pathe.M-eThtNZ-BrPhGF_K.mjs";
|
|
3
|
+
import { c as sectionTitle, o as helpLine, s as import_picocolors, t as categoryTitle } from "../output-DeiS4oEX.mjs";
|
|
4
|
+
import { c as R, u as Se, y as ye } from "../dist-abzUneor.mjs";
|
|
5
|
+
import { r as getPackageDir } from "../agents-Dkgafwfr.mjs";
|
|
6
6
|
import { readFileSync } from "node:fs";
|
|
7
7
|
import { parseArgs } from "node:util";
|
|
8
8
|
//#region src/cli/args.ts
|
|
@@ -265,14 +265,17 @@ function parseDomainArgs(args) {
|
|
|
265
265
|
].includes(subcommand)) throw new Error("domain: Usage: void domain <add|delete|list|status> [hostname] [--project <name>].");
|
|
266
266
|
let hostname;
|
|
267
267
|
let projectSlug;
|
|
268
|
+
let verbose = false;
|
|
268
269
|
const rest = args.slice(1);
|
|
269
270
|
for (let i = 0; i < rest.length; i++) if (rest[i] === "--project" && rest[i + 1]) projectSlug = rest[++i];
|
|
271
|
+
else if (rest[i] === "--verbose") verbose = true;
|
|
270
272
|
else if (!hostname) hostname = rest[i];
|
|
271
273
|
if ((subcommand === "add" || subcommand === "delete" || subcommand === "status") && !hostname) throw new Error(`domain: Usage: void domain ${subcommand} <hostname> [--project <name>].`);
|
|
272
274
|
return {
|
|
273
275
|
subcommand,
|
|
274
276
|
hostname,
|
|
275
|
-
projectSlug
|
|
277
|
+
projectSlug,
|
|
278
|
+
verbose
|
|
276
279
|
};
|
|
277
280
|
}
|
|
278
281
|
//#endregion
|
|
@@ -826,7 +829,17 @@ const HELP_TREE = {
|
|
|
826
829
|
add: withProjectOption("Add a custom domain.", "void domain add <hostname> [options]"),
|
|
827
830
|
delete: withProjectOption("Remove a custom domain.", "void domain delete <hostname> [options]"),
|
|
828
831
|
list: withProjectOption("List custom domains and status.", "void domain list [options]"),
|
|
829
|
-
status:
|
|
832
|
+
status: {
|
|
833
|
+
summary: "Check domain verification status. Prints a rolled-up state with a one-line diagnostic.",
|
|
834
|
+
usage: ["void domain status <hostname> [options]"],
|
|
835
|
+
options: [{
|
|
836
|
+
command: "--project <name>",
|
|
837
|
+
description: "Project name override"
|
|
838
|
+
}, {
|
|
839
|
+
command: "--verbose",
|
|
840
|
+
description: "Also print the raw multi-line status breakdown"
|
|
841
|
+
}]
|
|
842
|
+
}
|
|
830
843
|
}
|
|
831
844
|
},
|
|
832
845
|
db: {
|
|
@@ -1474,7 +1487,7 @@ async function runSubcommandGroup(command, subcommands, parse, run) {
|
|
|
1474
1487
|
const sub = args[1];
|
|
1475
1488
|
try {
|
|
1476
1489
|
if ((!sub || sub.startsWith("-")) && process.stdin.isTTY) {
|
|
1477
|
-
const { promptSubcommand } = await import("../subcommand-prompt-
|
|
1490
|
+
const { promptSubcommand } = await import("../subcommand-prompt-CPuV7tPW.mjs");
|
|
1478
1491
|
const result = await promptSubcommand(command, subcommands);
|
|
1479
1492
|
if (!result) process.exit(0);
|
|
1480
1493
|
await run(root, parse(buildArgs(result, args.slice(1))));
|
|
@@ -1503,7 +1516,7 @@ else if (command === "deploy") {
|
|
|
1503
1516
|
R.error(err instanceof Error ? err.message : String(err));
|
|
1504
1517
|
process.exit(1);
|
|
1505
1518
|
}
|
|
1506
|
-
import("../deploy-
|
|
1519
|
+
import("../deploy-7EA_lKq9.mjs").then((n) => n.t).then(({ runDeploy }) => {
|
|
1507
1520
|
runDeploy(root, {
|
|
1508
1521
|
projectSlug: deployArgs.projectSlug,
|
|
1509
1522
|
dir: deployArgs.dir,
|
|
@@ -1515,13 +1528,13 @@ else if (command === "deploy") {
|
|
|
1515
1528
|
process.exit(1);
|
|
1516
1529
|
});
|
|
1517
1530
|
});
|
|
1518
|
-
} else if (command === "auth") runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (root, parsed) => import("../auth-cmd-
|
|
1519
|
-
else if (command === "project") runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (root, parsed) => import("../project-cmd-
|
|
1520
|
-
else if (command === "secret") runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (root, parsed) => import("../secret-
|
|
1521
|
-
else if (command === "domain") runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (root, parsed) => import("../domain-
|
|
1522
|
-
else if (command === "db") runSubcommandGroup("db", dbSubcommands, parseDbArgs, (root, parsed) => import("../db-
|
|
1523
|
-
else if (command === "env") runSubcommandGroup("env", envSubcommands, parseEnvArgs, (root, parsed) => import("../env-
|
|
1524
|
-
else if (command === "gen") runSubcommandGroup("gen", genSubcommands, parseGenArgs, (root, parsed) => import("../gen-
|
|
1531
|
+
} else if (command === "auth") runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (root, parsed) => import("../auth-cmd-B1-7r6ng.mjs").then(({ runAuthCommand }) => runAuthCommand(root, parsed)));
|
|
1532
|
+
else if (command === "project") runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (root, parsed) => import("../project-cmd-JQUzv3qF.mjs").then(({ runProjectCommand }) => runProjectCommand(root, parsed)));
|
|
1533
|
+
else if (command === "secret") runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (root, parsed) => import("../secret-mz8t_CML.mjs").then(({ runSecretCommand }) => runSecretCommand(root, parsed)));
|
|
1534
|
+
else if (command === "domain") runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (root, parsed) => import("../domain-UfLrp2vc.mjs").then(({ runDomainCommand }) => runDomainCommand(root, parsed)));
|
|
1535
|
+
else if (command === "db") runSubcommandGroup("db", dbSubcommands, parseDbArgs, (root, parsed) => import("../db-CT5Xg6ds.mjs").then(({ runDbCommand }) => runDbCommand(root, parsed)));
|
|
1536
|
+
else if (command === "env") runSubcommandGroup("env", envSubcommands, parseEnvArgs, (root, parsed) => import("../env-Cvdbbm_N.mjs").then(({ runEnvCommand }) => runEnvCommand(root, parsed)));
|
|
1537
|
+
else if (command === "gen") runSubcommandGroup("gen", genSubcommands, parseGenArgs, (root, parsed) => import("../gen-Cn2hZ8RR.mjs").then(({ runGenCommand }) => runGenCommand(root, parsed)));
|
|
1525
1538
|
else if (command === "prepare") {
|
|
1526
1539
|
const root = process.cwd();
|
|
1527
1540
|
let prepareArgs;
|
|
@@ -1531,7 +1544,7 @@ else if (command === "prepare") {
|
|
|
1531
1544
|
R.error(err instanceof Error ? err.message : String(err));
|
|
1532
1545
|
process.exit(1);
|
|
1533
1546
|
}
|
|
1534
|
-
import("../prepare-
|
|
1547
|
+
import("../prepare-BrAISonG.mjs").then(({ runPrepareCommand }) => {
|
|
1535
1548
|
runPrepareCommand(root, prepareArgs).catch((err) => {
|
|
1536
1549
|
R.error(err.message ?? err);
|
|
1537
1550
|
process.exit(1);
|
|
@@ -1539,7 +1552,7 @@ else if (command === "prepare") {
|
|
|
1539
1552
|
});
|
|
1540
1553
|
} else if (command === "init") {
|
|
1541
1554
|
const root = process.cwd();
|
|
1542
|
-
import("../init-
|
|
1555
|
+
import("../init-DL6syXuF.mjs").then(({ runInitCommand, parseInitArgs }) => {
|
|
1543
1556
|
let initArgs;
|
|
1544
1557
|
try {
|
|
1545
1558
|
initArgs = parseInitArgs(args.slice(1));
|
|
@@ -1552,7 +1565,7 @@ else if (command === "prepare") {
|
|
|
1552
1565
|
process.exit(1);
|
|
1553
1566
|
});
|
|
1554
1567
|
});
|
|
1555
|
-
} else if (command === "mcp") import("../mcp-
|
|
1568
|
+
} else if (command === "mcp") import("../mcp-B84MmVAW.mjs").then(({ runMcp }) => {
|
|
1556
1569
|
runMcp();
|
|
1557
1570
|
});
|
|
1558
1571
|
else if (command === "-v" || command === "--version") {
|
|
@@ -1578,7 +1591,7 @@ else if (command === "-v" || command === "--version") {
|
|
|
1578
1591
|
},
|
|
1579
1592
|
{
|
|
1580
1593
|
name: "project",
|
|
1581
|
-
hint: "status | link | list | logs | rollback | delete | purge-cache",
|
|
1594
|
+
hint: "status | link | list | logs | rollback | cancel | delete | purge-cache",
|
|
1582
1595
|
description: "Manage projects and deployments"
|
|
1583
1596
|
},
|
|
1584
1597
|
{
|
|
@@ -1621,36 +1634,36 @@ else if (command === "-v" || command === "--version") {
|
|
|
1621
1634
|
];
|
|
1622
1635
|
(async () => {
|
|
1623
1636
|
printVoidHeader();
|
|
1624
|
-
const { promptSubcommand } = await import("../subcommand-prompt-
|
|
1637
|
+
const { promptSubcommand } = await import("../subcommand-prompt-CPuV7tPW.mjs");
|
|
1625
1638
|
const result = await promptSubcommand("", topLevelCommands);
|
|
1626
1639
|
if (!result) process.exit(0);
|
|
1627
1640
|
const cmd = result.subcommand;
|
|
1628
1641
|
const root = process.cwd();
|
|
1629
1642
|
switch (cmd) {
|
|
1630
1643
|
case "init": {
|
|
1631
|
-
const { runInitCommand, parseInitArgs } = await import("../init-
|
|
1644
|
+
const { runInitCommand, parseInitArgs } = await import("../init-DL6syXuF.mjs");
|
|
1632
1645
|
await runInitCommand(root, parseInitArgs([]));
|
|
1633
1646
|
return;
|
|
1634
1647
|
}
|
|
1635
1648
|
case "deploy": {
|
|
1636
|
-
const { runDeploy } = await import("../deploy-
|
|
1649
|
+
const { runDeploy } = await import("../deploy-7EA_lKq9.mjs").then((n) => n.t);
|
|
1637
1650
|
await runDeploy(root);
|
|
1638
1651
|
return;
|
|
1639
1652
|
}
|
|
1640
1653
|
case "mcp": {
|
|
1641
|
-
const { runMcp } = await import("../mcp-
|
|
1654
|
+
const { runMcp } = await import("../mcp-B84MmVAW.mjs");
|
|
1642
1655
|
runMcp();
|
|
1643
1656
|
return;
|
|
1644
1657
|
}
|
|
1645
|
-
case "auth": return runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (r, p) => import("../auth-cmd-
|
|
1646
|
-
case "project": return runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (r, p) => import("../project-cmd-
|
|
1647
|
-
case "secret": return runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (r, p) => import("../secret-
|
|
1648
|
-
case "domain": return runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (r, p) => import("../domain-
|
|
1649
|
-
case "db": return runSubcommandGroup("db", dbSubcommands, parseDbArgs, (r, p) => import("../db-
|
|
1650
|
-
case "env": return runSubcommandGroup("env", envSubcommands, parseEnvArgs, (r, p) => import("../env-
|
|
1651
|
-
case "gen": return runSubcommandGroup("gen", genSubcommands, parseGenArgs, (r, p) => import("../gen-
|
|
1658
|
+
case "auth": return runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (r, p) => import("../auth-cmd-B1-7r6ng.mjs").then(({ runAuthCommand }) => runAuthCommand(r, p)));
|
|
1659
|
+
case "project": return runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (r, p) => import("../project-cmd-JQUzv3qF.mjs").then(({ runProjectCommand }) => runProjectCommand(r, p)));
|
|
1660
|
+
case "secret": return runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (r, p) => import("../secret-mz8t_CML.mjs").then(({ runSecretCommand }) => runSecretCommand(r, p)));
|
|
1661
|
+
case "domain": return runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (r, p) => import("../domain-UfLrp2vc.mjs").then(({ runDomainCommand }) => runDomainCommand(r, p)));
|
|
1662
|
+
case "db": return runSubcommandGroup("db", dbSubcommands, parseDbArgs, (r, p) => import("../db-CT5Xg6ds.mjs").then(({ runDbCommand }) => runDbCommand(r, p)));
|
|
1663
|
+
case "env": return runSubcommandGroup("env", envSubcommands, parseEnvArgs, (r, p) => import("../env-Cvdbbm_N.mjs").then(({ runEnvCommand }) => runEnvCommand(r, p)));
|
|
1664
|
+
case "gen": return runSubcommandGroup("gen", genSubcommands, parseGenArgs, (r, p) => import("../gen-Cn2hZ8RR.mjs").then(({ runGenCommand }) => runGenCommand(r, p)));
|
|
1652
1665
|
case "prepare": {
|
|
1653
|
-
const { runPrepareCommand } = await import("../prepare-
|
|
1666
|
+
const { runPrepareCommand } = await import("../prepare-BrAISonG.mjs");
|
|
1654
1667
|
await runPrepareCommand(root, parsePrepareArgs([]));
|
|
1655
1668
|
return;
|
|
1656
1669
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as __exportAll } from "./chunk-DJd-R1mw.mjs";
|
|
2
|
-
import { a as join } from "./pathe.M-eThtNZ-
|
|
3
|
-
import { s as import_picocolors } from "./output-
|
|
4
|
-
import { t as cfAccessHeaders } from "./cf-access-
|
|
5
|
-
import { t as isVoidInternalStaging } from "./project-
|
|
6
|
-
import { r as getPackageDir } from "./agents-
|
|
2
|
+
import { a as join } from "./pathe.M-eThtNZ-BrPhGF_K.mjs";
|
|
3
|
+
import { s as import_picocolors } from "./output-DeiS4oEX.mjs";
|
|
4
|
+
import { t as cfAccessHeaders } from "./cf-access-DKDsgwOU.mjs";
|
|
5
|
+
import { t as isVoidInternalStaging } from "./project-CH9pdo16.mjs";
|
|
6
|
+
import { r as getPackageDir } from "./agents-Dkgafwfr.mjs";
|
|
7
7
|
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
8
8
|
import { createHash, randomBytes } from "node:crypto";
|
|
9
9
|
import { homedir } from "node:os";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __exportAll } from "./chunk-DJd-R1mw.mjs";
|
|
2
|
-
import { a as join, n as dirname } from "./pathe.M-eThtNZ-
|
|
2
|
+
import { a as join, n as dirname } from "./pathe.M-eThtNZ-BrPhGF_K.mjs";
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
4
4
|
//#region src/migrations/collect.ts
|
|
5
5
|
var collect_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { n as __exportAll } from "./chunk-DJd-R1mw.mjs";
|
|
2
|
-
import { a as join } from "./pathe.M-eThtNZ-
|
|
3
|
-
import {
|
|
2
|
+
import { a as join, s as relative } from "./pathe.M-eThtNZ-BrPhGF_K.mjs";
|
|
3
|
+
import { n as readProjectPaths } from "./project-paths-CCMrHYQm.mjs";
|
|
4
|
+
import { r as schemaSpecifier, t as discoverSchema } from "./discover-C8N1I4tK.mjs";
|
|
4
5
|
import { mkdirSync, writeFileSync } from "node:fs";
|
|
5
6
|
//#region src/drizzle/config.ts
|
|
6
7
|
var config_exports = /* @__PURE__ */ __exportAll({ writeDrizzleConfig: () => writeDrizzleConfig });
|
|
@@ -12,20 +13,21 @@ var config_exports = /* @__PURE__ */ __exportAll({ writeDrizzleConfig: () => wri
|
|
|
12
13
|
* @returns Absolute path to the written config file.
|
|
13
14
|
*/
|
|
14
15
|
function writeDrizzleConfig(root, dbPath, dialect = "sqlite") {
|
|
15
|
-
const
|
|
16
|
-
|
|
16
|
+
const paths = readProjectPaths(root);
|
|
17
|
+
const schema = discoverSchema(root, paths);
|
|
18
|
+
if (!schema) throw new Error(`db: No Drizzle schema found. Create ${paths.sourceRelative("db/schema.ts")} or run \`void gen model <name>\`.`);
|
|
17
19
|
const outDir = join(root, ".void");
|
|
18
20
|
mkdirSync(outDir, { recursive: true });
|
|
19
21
|
const config = dialect === "postgresql" ? {
|
|
20
22
|
dialect: "postgresql",
|
|
21
|
-
schema: schemaSpecifier(schema),
|
|
22
|
-
out: "
|
|
23
|
+
schema: schemaSpecifier(schema, root),
|
|
24
|
+
out: `./${relative(root, paths.migrationsDir).replace(/\\/g, "/")}`,
|
|
23
25
|
migrations: { prefix: "timestamp" },
|
|
24
26
|
dbCredentials: { url: dbPath }
|
|
25
27
|
} : {
|
|
26
28
|
dialect: "sqlite",
|
|
27
|
-
schema: schemaSpecifier(schema),
|
|
28
|
-
out: "
|
|
29
|
+
schema: schemaSpecifier(schema, root),
|
|
30
|
+
out: `./${relative(root, paths.migrationsDir).replace(/\\/g, "/")}`,
|
|
29
31
|
migrations: { prefix: "timestamp" },
|
|
30
32
|
dbCredentials: { url: dbPath }
|
|
31
33
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { n as __exportAll } from "./chunk-DJd-R1mw.mjs";
|
|
2
|
-
import { a as join } from "./pathe.M-eThtNZ-
|
|
3
|
-
import {
|
|
2
|
+
import { a as join } from "./pathe.M-eThtNZ-BrPhGF_K.mjs";
|
|
3
|
+
import { a as validateSourceDir } from "./project-paths-CCMrHYQm.mjs";
|
|
4
|
+
import { i as isVoidAuthProvider, t as VOID_AUTH_PROVIDERS } from "./providers-uC0PJg1c.mjs";
|
|
4
5
|
import { readFileSync } from "node:fs";
|
|
5
6
|
//#region src/config.ts
|
|
6
7
|
var config_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -227,6 +228,10 @@ function readConfig(root) {
|
|
|
227
228
|
if (typeof config !== "object" || config === null || Array.isArray(config)) throw new Error(`config: ${CONFIG_FILE} must be a JSON object.`);
|
|
228
229
|
const obj = config;
|
|
229
230
|
for (const [key, message] of Object.entries(MIGRATION_ERRORS)) if (obj[key] !== void 0) throw new Error(`config: ${message} in ${CONFIG_FILE}.`);
|
|
231
|
+
if (obj.sourceDir !== void 0) {
|
|
232
|
+
if (typeof obj.sourceDir !== "string") throw new Error(`config: "sourceDir" in ${CONFIG_FILE} must be a string.`);
|
|
233
|
+
validateSourceDir(obj.sourceDir);
|
|
234
|
+
}
|
|
230
235
|
if (obj.target !== void 0) {
|
|
231
236
|
if (typeof obj.target !== "string" || !VALID_TARGETS.has(obj.target)) throw new Error(`config: "target" in ${CONFIG_FILE} must be one of: cloudflare, node, bun, deno.`);
|
|
232
237
|
}
|
|
@@ -417,6 +422,10 @@ function readConfig(root) {
|
|
|
417
422
|
if (w.compatibility_flags !== void 0) {
|
|
418
423
|
if (!Array.isArray(w.compatibility_flags) || !w.compatibility_flags.every((f) => typeof f === "string")) throw new Error(`config: "worker.compatibility_flags" in ${CONFIG_FILE} must be an array of strings.`);
|
|
419
424
|
}
|
|
425
|
+
if (w.vars !== void 0) {
|
|
426
|
+
if (typeof w.vars !== "object" || w.vars === null || Array.isArray(w.vars)) throw new Error(`config: "worker.vars" in ${CONFIG_FILE} must be an object.`);
|
|
427
|
+
for (const [key, value] of Object.entries(w.vars)) if (typeof value !== "string") throw new Error(`config: "worker.vars.${key}" in ${CONFIG_FILE} must be a string.`);
|
|
428
|
+
}
|
|
420
429
|
}
|
|
421
430
|
if (obj.database !== void 0) {
|
|
422
431
|
if (typeof obj.database !== "string" || !VALID_DATABASE_VALUES.has(obj.database)) throw new Error(`config: "database" in ${CONFIG_FILE} must be "pg".`);
|
|
@@ -1,21 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as readProjectPaths } from "./project-paths-CCMrHYQm.mjs";
|
|
2
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
//#region src/auth/config.ts
|
|
5
|
-
const AUTH_CONFIG_CANDIDATES = [
|
|
6
|
-
"auth.ts",
|
|
7
|
-
"auth.mts",
|
|
8
|
-
"auth.js",
|
|
9
|
-
"auth.mjs",
|
|
10
|
-
"auth.cts",
|
|
11
|
-
"auth.cjs"
|
|
12
|
-
];
|
|
13
5
|
function isVoidAuthConfigSource(code) {
|
|
14
6
|
return /\bfrom\s+["']void\/auth["']/.test(code);
|
|
15
7
|
}
|
|
16
|
-
function findVoidAuthConfig(root) {
|
|
17
|
-
for (const
|
|
18
|
-
const absPath = join(root, file);
|
|
8
|
+
function findVoidAuthConfig(root, paths = readProjectPaths(root)) {
|
|
9
|
+
for (const absPath of paths.authConfigCandidates) {
|
|
19
10
|
if (!existsSync(absPath)) continue;
|
|
20
11
|
if (isVoidAuthConfigSource(readFileSync(absPath, "utf-8"))) return absPath;
|
|
21
12
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { s as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { n as
|
|
1
|
+
import { n as __exportAll } from "./chunk-DJd-R1mw.mjs";
|
|
2
|
+
import { s as import_picocolors } from "./output-DeiS4oEX.mjs";
|
|
3
|
+
import { s as getSiteDomain, t as PlatformApiError } from "./client-C-nH6yz3.mjs";
|
|
4
|
+
import { _ as me, c as R, i as Ee, l as Re, x as q } from "./dist-abzUneor.mjs";
|
|
5
|
+
import { a as writeProjectConfig } from "./project-CH9pdo16.mjs";
|
|
6
|
+
import { n as validateProjectSlug } from "./project-slug-De4UjtD9.mjs";
|
|
7
|
+
import { n as inferDefaultSlug } from "./resolve-project-CNpUbUHd.mjs";
|
|
7
8
|
//#region src/cli/prompt.ts
|
|
8
9
|
async function promptProjectSetupAction(message = "Set up a Void project:", options = {}) {
|
|
9
10
|
const result = await Ee({
|
|
@@ -58,20 +59,30 @@ async function promptProjectSlug(defaultSlug) {
|
|
|
58
59
|
}
|
|
59
60
|
//#endregion
|
|
60
61
|
//#region src/cli/create-project.ts
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
var create_project_exports = /* @__PURE__ */ __exportAll({
|
|
63
|
+
createProjectWithSlugRetry: () => createProjectWithSlugRetry,
|
|
64
|
+
isRetryableCreateError: () => isRetryableCreateError,
|
|
65
|
+
promptAndCreateProject: () => promptAndCreateProject
|
|
66
|
+
});
|
|
67
|
+
/**
|
|
68
|
+
* Prompts for a slug and calls `client.createProject`, re-prompting whenever
|
|
69
|
+
* the server rejects with a retryable error (e.g. free-plan short-slug 403,
|
|
70
|
+
* slug-already-taken 409, validation 400/422). Returns `undefined` when the
|
|
71
|
+
* caller's prompt callback returns `undefined` (cancel).
|
|
72
|
+
*
|
|
73
|
+
* The shared retry loop keeps `promptAndCreateProject` (deploy/link paths)
|
|
74
|
+
* and the AI-setup path in `index.ts` in sync.
|
|
75
|
+
*/
|
|
76
|
+
async function createProjectWithSlugRetry(client, initialDefaultSlug, promptSlug) {
|
|
77
|
+
let defaultSlug = initialDefaultSlug;
|
|
63
78
|
while (true) {
|
|
64
|
-
const slug = await
|
|
79
|
+
const slug = await promptSlug(defaultSlug);
|
|
80
|
+
if (slug === void 0) return;
|
|
65
81
|
try {
|
|
66
82
|
R.step(`Creating project ${import_picocolors.default.blue(slug)}...`);
|
|
67
83
|
const project = await client.createProject(slug);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
slug: project.slug
|
|
71
|
-
};
|
|
72
|
-
writeProjectConfig(root, config);
|
|
73
|
-
R.success(`Project created: ${import_picocolors.default.blue(config.slug)}`);
|
|
74
|
-
return config;
|
|
84
|
+
R.success(`Project created: ${import_picocolors.default.blue(project.slug)}`);
|
|
85
|
+
return project;
|
|
75
86
|
} catch (error) {
|
|
76
87
|
if (error instanceof PlatformApiError && isRetryableCreateError(error)) {
|
|
77
88
|
const reason = error.code || error.body || `HTTP ${error.status}`;
|
|
@@ -83,8 +94,23 @@ async function promptAndCreateProject(root, client) {
|
|
|
83
94
|
}
|
|
84
95
|
}
|
|
85
96
|
}
|
|
97
|
+
async function promptAndCreateProject(root, client) {
|
|
98
|
+
const project = await createProjectWithSlugRetry(client, inferDefaultSlug(root), async (defaultSlug) => promptProjectSlug(defaultSlug));
|
|
99
|
+
if (!project) throw new Error("Project creation cancelled.");
|
|
100
|
+
const config = {
|
|
101
|
+
projectId: project.id,
|
|
102
|
+
slug: project.slug
|
|
103
|
+
};
|
|
104
|
+
writeProjectConfig(root, config);
|
|
105
|
+
return config;
|
|
106
|
+
}
|
|
86
107
|
function isRetryableCreateError(error) {
|
|
87
|
-
|
|
108
|
+
if (error.status === 400 || error.status === 409 || error.status === 422) return true;
|
|
109
|
+
if (error.status === 403) return isSlugRelatedError(error);
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
function isSlugRelatedError(error) {
|
|
113
|
+
return `${error.code ?? ""} ${error.body ?? ""}`.toLowerCase().includes("slug");
|
|
88
114
|
}
|
|
89
115
|
//#endregion
|
|
90
|
-
export {
|
|
116
|
+
export { promptProjectSetupAction as i, promptAndCreateProject as n, promptProjectSelection as r, create_project_exports as t };
|