void 0.7.9 → 0.7.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/dist/{auth-cmd-D3DNf9j9.mjs → auth-cmd-bS88H4Lb.mjs} +3 -3
- package/dist/{better-auth-shared-CjnJZFC0.mjs → better-auth-shared-D2JaoCs4.mjs} +1 -1
- package/dist/{cache-DcDAmion.mjs → cache-DUDCNty6.mjs} +4 -4
- package/dist/{cancel-deploy-CrMlOCW0.mjs → cancel-deploy-DOuSbPwX.mjs} +4 -4
- package/dist/cli/cli.mjs +26 -26
- package/dist/{client-Dw8roLzc.mjs → client-C_DYiXeu.mjs} +150 -89
- package/dist/{config-DqkeX_Fa.mjs → config-CeRQg3Lz.mjs} +1 -1
- package/dist/{config-BzM9Dy7T.mjs → config-DyUSwbeX.mjs} +1 -1
- package/dist/{create-project-CcPOkfA4.mjs → create-project-hvFe6rbI.mjs} +4 -4
- package/dist/{db-Daa0zMHP.mjs → db-j-XdTjQD.mjs} +27 -27
- package/dist/{delete-C96_gt6q.mjs → delete-XyM_VD9o.mjs} +4 -4
- package/dist/{deploy-Bfn434ed.mjs → deploy-CPAEgVQm.mjs} +23 -23
- package/dist/{domain-DUFBO_ob.mjs → domain-Dvj7u8tr.mjs} +4 -4
- package/dist/{drizzle-C-NRqGhx.mjs → drizzle-Cx7cVwrE.mjs} +1 -1
- package/dist/{env-Bt-92Ji0.mjs → env-Bjl0rzuf.mjs} +6 -6
- package/dist/{env-types-DknSA4SO.mjs → env-types-BSQghXbx.mjs} +1 -1
- package/dist/{env-validation-Bc_aiBUm.mjs → env-validation-Buy5pe3u.mjs} +3 -3
- package/dist/{gen-CpeKIqlM.mjs → gen-DU8NIdrH.mjs} +7 -7
- package/dist/{headers-C7Yf6_CN.mjs → headers-CuVHn6Kl.mjs} +2 -2
- package/dist/index.mjs +29 -29
- package/dist/{init-DwJ0Z0SL.mjs → init-iIiQWzyB.mjs} +15 -15
- package/dist/{link-wKnJUEcY.mjs → link-DdXqlUiJ.mjs} +5 -5
- package/dist/{list-BZI7LKvX.mjs → list-9Bxa5Odn.mjs} +4 -4
- package/dist/{login-21aIqVPD.mjs → login-C_MfDjhu.mjs} +3 -3
- package/dist/{logs-CFJ8deEd.mjs → logs-DjqCpEER.mjs} +4 -4
- package/dist/{mcp-CJduPlRn.mjs → mcp-vA0880_K.mjs} +2 -2
- package/dist/{node-DHVCtkgt.mjs → node-DDxMsKPm.mjs} +3 -3
- package/dist/{output-BwlcIYSR.mjs → output-D3g5otMC.mjs} +1 -1
- package/dist/pages/index.mjs +3 -3
- package/dist/pages/islands-plugin.mjs +1 -1
- package/dist/{plugin-inference-CXUuq0aC.mjs → plugin-inference-BexV6LL3.mjs} +1 -1
- package/dist/{prepare-CKzO06-Z.mjs → prepare-BEkH89oX.mjs} +10 -10
- package/dist/{preset-BhnZpb7t.mjs → preset-CYQh93UF.mjs} +1 -1
- package/dist/{project-cmd-qzFonrph.mjs → project-cmd-CeXO06hG.mjs} +10 -10
- package/dist/{rollback-CyLJaSSS.mjs → rollback-C8OSMxmq.mjs} +4 -4
- package/dist/{runner-BUPRnMFN.mjs → runner-BaWsik5f.mjs} +1 -1
- package/dist/{runner-pg-BI6f6Ncm.mjs → runner-pg-Bd_172vF.mjs} +1 -1
- package/dist/runtime/ai.mjs +1 -1
- package/dist/runtime/better-auth-pg.mjs +1 -1
- package/dist/runtime/better-auth.mjs +1 -1
- package/dist/runtime/remote/index.mjs +1 -1
- package/dist/{scan-CWfLxtOe.mjs → scan-CKpylFj9.mjs} +1 -1
- package/dist/{scan-B8iEm8xn.mjs → scan-CkK1Hzpa.mjs} +3 -3
- package/dist/{secret-DAfThcYQ.mjs → secret-NDvlqAN2.mjs} +4 -4
- package/dist/{skills-CbuYOthf.mjs → skills-SAG0WyVn.mjs} +1 -1
- package/dist/{subcommand-prompt-BMS1TNG5.mjs → subcommand-prompt-q9T06dpg.mjs} +2 -2
- package/dist/{validate-CaMavMxu.mjs → validate-DW3ViKTA.mjs} +1 -1
- package/package.json +2 -2
- /package/dist/{cf-access-Dee5cXxL.mjs → cf-access-BW8K93Fm.mjs} +0 -0
- /package/dist/{collect-CjeZgz5D.mjs → collect-HqAuilH6.mjs} +0 -0
- /package/dist/{discover-B7FkXBLB.mjs → discover-CKGQpis8.mjs} +0 -0
- /package/dist/{dist-Dayj3gCK.mjs → dist-D2L3_KTK.mjs} +0 -0
- /package/dist/{dist-DUyXJLkq.mjs → dist-q8b2Mjgb.mjs} +0 -0
- /package/dist/{dotenv-zdFCCgFU.mjs → dotenv-HQNhRalS.mjs} +0 -0
- /package/dist/{log-DXdqnmhF.mjs → log-7ChR5Fbc.mjs} +0 -0
- /package/dist/{magic-string.es-D6g9UnIy.mjs → magic-string.es-DS_lmuBe.mjs} +0 -0
- /package/dist/{project-TqORyHn8.mjs → project-DhB4A8_g.mjs} +0 -0
- /package/dist/{project-tsconfig-DfkESbDL.mjs → project-tsconfig-Bfy55qvs.mjs} +0 -0
- /package/dist/{providers-B3aMxWzP.mjs → providers-BlFNPYen.mjs} +0 -0
- /package/dist/{route-types-Cnqj_8a7.mjs → route-types-qVL-v-CB.mjs} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import { c as
|
|
3
|
-
import { n as runLoginCommand } from "./login-
|
|
1
|
+
import { c as getToken, d as removeToken, n as PlatformClient } from "./client-C_DYiXeu.mjs";
|
|
2
|
+
import { c as R } from "./dist-D2L3_KTK.mjs";
|
|
3
|
+
import { n as runLoginCommand } from "./login-C_MfDjhu.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-BlFNPYen.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,7 +1,7 @@
|
|
|
1
|
-
import { i as dim, n as cliTitle, r as createSpinner } from "./output-
|
|
2
|
-
import { c as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { i as dim, n as cliTitle, r as createSpinner } from "./output-D3g5otMC.mjs";
|
|
2
|
+
import { c as getToken, n as PlatformClient } from "./client-C_DYiXeu.mjs";
|
|
3
|
+
import { c as R, g as ge, y as ye } from "./dist-D2L3_KTK.mjs";
|
|
4
|
+
import { r as readProjectConfig } from "./project-DhB4A8_g.mjs";
|
|
5
5
|
import { r as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-DdjLQ2tB.mjs";
|
|
6
6
|
//#region src/cli/cache.ts
|
|
7
7
|
async function runPurgeCacheCommand(root, projectSlug) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as cliTitle } from "./output-
|
|
2
|
-
import { c as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { n as cliTitle } from "./output-D3g5otMC.mjs";
|
|
2
|
+
import { c as getToken, n as PlatformClient } from "./client-C_DYiXeu.mjs";
|
|
3
|
+
import { c as R, g as ge, v as ue, x as q, y as ye } from "./dist-D2L3_KTK.mjs";
|
|
4
|
+
import { r as readProjectConfig } from "./project-DhB4A8_g.mjs";
|
|
5
5
|
//#region src/cli/cancel-deploy.ts
|
|
6
6
|
const ACTIVE_STATUSES = new Set([
|
|
7
7
|
"pending",
|
package/dist/cli/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { a as join } from "../pathe.M-eThtNZ-D-kmWkCS.mjs";
|
|
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-
|
|
3
|
+
import { c as sectionTitle, o as helpLine, s as import_picocolors, t as categoryTitle } from "../output-D3g5otMC.mjs";
|
|
4
|
+
import { c as R, u as Se, y as ye } from "../dist-D2L3_KTK.mjs";
|
|
5
5
|
import { r as getPackageDir } from "../agents-DqkFfc2c.mjs";
|
|
6
6
|
import { readFileSync } from "node:fs";
|
|
7
7
|
import { parseArgs } from "node:util";
|
|
@@ -1474,7 +1474,7 @@ async function runSubcommandGroup(command, subcommands, parse, run) {
|
|
|
1474
1474
|
const sub = args[1];
|
|
1475
1475
|
try {
|
|
1476
1476
|
if ((!sub || sub.startsWith("-")) && process.stdin.isTTY) {
|
|
1477
|
-
const { promptSubcommand } = await import("../subcommand-prompt-
|
|
1477
|
+
const { promptSubcommand } = await import("../subcommand-prompt-q9T06dpg.mjs");
|
|
1478
1478
|
const result = await promptSubcommand(command, subcommands);
|
|
1479
1479
|
if (!result) process.exit(0);
|
|
1480
1480
|
await run(root, parse(buildArgs(result, args.slice(1))));
|
|
@@ -1503,7 +1503,7 @@ else if (command === "deploy") {
|
|
|
1503
1503
|
R.error(err instanceof Error ? err.message : String(err));
|
|
1504
1504
|
process.exit(1);
|
|
1505
1505
|
}
|
|
1506
|
-
import("../deploy-
|
|
1506
|
+
import("../deploy-CPAEgVQm.mjs").then((n) => n.t).then(({ runDeploy }) => {
|
|
1507
1507
|
runDeploy(root, {
|
|
1508
1508
|
projectSlug: deployArgs.projectSlug,
|
|
1509
1509
|
dir: deployArgs.dir,
|
|
@@ -1515,13 +1515,13 @@ else if (command === "deploy") {
|
|
|
1515
1515
|
process.exit(1);
|
|
1516
1516
|
});
|
|
1517
1517
|
});
|
|
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-
|
|
1518
|
+
} else if (command === "auth") runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (root, parsed) => import("../auth-cmd-bS88H4Lb.mjs").then(({ runAuthCommand }) => runAuthCommand(root, parsed)));
|
|
1519
|
+
else if (command === "project") runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (root, parsed) => import("../project-cmd-CeXO06hG.mjs").then(({ runProjectCommand }) => runProjectCommand(root, parsed)));
|
|
1520
|
+
else if (command === "secret") runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (root, parsed) => import("../secret-NDvlqAN2.mjs").then(({ runSecretCommand }) => runSecretCommand(root, parsed)));
|
|
1521
|
+
else if (command === "domain") runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (root, parsed) => import("../domain-Dvj7u8tr.mjs").then(({ runDomainCommand }) => runDomainCommand(root, parsed)));
|
|
1522
|
+
else if (command === "db") runSubcommandGroup("db", dbSubcommands, parseDbArgs, (root, parsed) => import("../db-j-XdTjQD.mjs").then(({ runDbCommand }) => runDbCommand(root, parsed)));
|
|
1523
|
+
else if (command === "env") runSubcommandGroup("env", envSubcommands, parseEnvArgs, (root, parsed) => import("../env-Bjl0rzuf.mjs").then(({ runEnvCommand }) => runEnvCommand(root, parsed)));
|
|
1524
|
+
else if (command === "gen") runSubcommandGroup("gen", genSubcommands, parseGenArgs, (root, parsed) => import("../gen-DU8NIdrH.mjs").then(({ runGenCommand }) => runGenCommand(root, parsed)));
|
|
1525
1525
|
else if (command === "prepare") {
|
|
1526
1526
|
const root = process.cwd();
|
|
1527
1527
|
let prepareArgs;
|
|
@@ -1531,7 +1531,7 @@ else if (command === "prepare") {
|
|
|
1531
1531
|
R.error(err instanceof Error ? err.message : String(err));
|
|
1532
1532
|
process.exit(1);
|
|
1533
1533
|
}
|
|
1534
|
-
import("../prepare-
|
|
1534
|
+
import("../prepare-BEkH89oX.mjs").then(({ runPrepareCommand }) => {
|
|
1535
1535
|
runPrepareCommand(root, prepareArgs).catch((err) => {
|
|
1536
1536
|
R.error(err.message ?? err);
|
|
1537
1537
|
process.exit(1);
|
|
@@ -1539,7 +1539,7 @@ else if (command === "prepare") {
|
|
|
1539
1539
|
});
|
|
1540
1540
|
} else if (command === "init") {
|
|
1541
1541
|
const root = process.cwd();
|
|
1542
|
-
import("../init-
|
|
1542
|
+
import("../init-iIiQWzyB.mjs").then(({ runInitCommand, parseInitArgs }) => {
|
|
1543
1543
|
let initArgs;
|
|
1544
1544
|
try {
|
|
1545
1545
|
initArgs = parseInitArgs(args.slice(1));
|
|
@@ -1552,7 +1552,7 @@ else if (command === "prepare") {
|
|
|
1552
1552
|
process.exit(1);
|
|
1553
1553
|
});
|
|
1554
1554
|
});
|
|
1555
|
-
} else if (command === "mcp") import("../mcp-
|
|
1555
|
+
} else if (command === "mcp") import("../mcp-vA0880_K.mjs").then(({ runMcp }) => {
|
|
1556
1556
|
runMcp();
|
|
1557
1557
|
});
|
|
1558
1558
|
else if (command === "-v" || command === "--version") {
|
|
@@ -1621,36 +1621,36 @@ else if (command === "-v" || command === "--version") {
|
|
|
1621
1621
|
];
|
|
1622
1622
|
(async () => {
|
|
1623
1623
|
printVoidHeader();
|
|
1624
|
-
const { promptSubcommand } = await import("../subcommand-prompt-
|
|
1624
|
+
const { promptSubcommand } = await import("../subcommand-prompt-q9T06dpg.mjs");
|
|
1625
1625
|
const result = await promptSubcommand("", topLevelCommands);
|
|
1626
1626
|
if (!result) process.exit(0);
|
|
1627
1627
|
const cmd = result.subcommand;
|
|
1628
1628
|
const root = process.cwd();
|
|
1629
1629
|
switch (cmd) {
|
|
1630
1630
|
case "init": {
|
|
1631
|
-
const { runInitCommand, parseInitArgs } = await import("../init-
|
|
1631
|
+
const { runInitCommand, parseInitArgs } = await import("../init-iIiQWzyB.mjs");
|
|
1632
1632
|
await runInitCommand(root, parseInitArgs([]));
|
|
1633
1633
|
return;
|
|
1634
1634
|
}
|
|
1635
1635
|
case "deploy": {
|
|
1636
|
-
const { runDeploy } = await import("../deploy-
|
|
1636
|
+
const { runDeploy } = await import("../deploy-CPAEgVQm.mjs").then((n) => n.t);
|
|
1637
1637
|
await runDeploy(root);
|
|
1638
1638
|
return;
|
|
1639
1639
|
}
|
|
1640
1640
|
case "mcp": {
|
|
1641
|
-
const { runMcp } = await import("../mcp-
|
|
1641
|
+
const { runMcp } = await import("../mcp-vA0880_K.mjs");
|
|
1642
1642
|
runMcp();
|
|
1643
1643
|
return;
|
|
1644
1644
|
}
|
|
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-
|
|
1645
|
+
case "auth": return runSubcommandGroup("auth", authSubcommands, parseAuthArgs, (r, p) => import("../auth-cmd-bS88H4Lb.mjs").then(({ runAuthCommand }) => runAuthCommand(r, p)));
|
|
1646
|
+
case "project": return runSubcommandGroup("project", projectSubcommands, parseProjectArgs, (r, p) => import("../project-cmd-CeXO06hG.mjs").then(({ runProjectCommand }) => runProjectCommand(r, p)));
|
|
1647
|
+
case "secret": return runSubcommandGroup("secret", secretSubcommands, parseSecretArgs, (r, p) => import("../secret-NDvlqAN2.mjs").then(({ runSecretCommand }) => runSecretCommand(r, p)));
|
|
1648
|
+
case "domain": return runSubcommandGroup("domain", domainSubcommands, parseDomainArgs, (r, p) => import("../domain-Dvj7u8tr.mjs").then(({ runDomainCommand }) => runDomainCommand(r, p)));
|
|
1649
|
+
case "db": return runSubcommandGroup("db", dbSubcommands, parseDbArgs, (r, p) => import("../db-j-XdTjQD.mjs").then(({ runDbCommand }) => runDbCommand(r, p)));
|
|
1650
|
+
case "env": return runSubcommandGroup("env", envSubcommands, parseEnvArgs, (r, p) => import("../env-Bjl0rzuf.mjs").then(({ runEnvCommand }) => runEnvCommand(r, p)));
|
|
1651
|
+
case "gen": return runSubcommandGroup("gen", genSubcommands, parseGenArgs, (r, p) => import("../gen-DU8NIdrH.mjs").then(({ runGenCommand }) => runGenCommand(r, p)));
|
|
1652
1652
|
case "prepare": {
|
|
1653
|
-
const { runPrepareCommand } = await import("../prepare-
|
|
1653
|
+
const { runPrepareCommand } = await import("../prepare-BEkH89oX.mjs");
|
|
1654
1654
|
await runPrepareCommand(root, parsePrepareArgs([]));
|
|
1655
1655
|
return;
|
|
1656
1656
|
}
|
|
@@ -1,14 +1,86 @@
|
|
|
1
1
|
import { n as __exportAll } from "./chunk-DJd-R1mw.mjs";
|
|
2
2
|
import { a as join } from "./pathe.M-eThtNZ-D-kmWkCS.mjs";
|
|
3
|
-
import { s as import_picocolors } from "./output-
|
|
4
|
-
import { t as
|
|
5
|
-
import { t as
|
|
3
|
+
import { s as import_picocolors } from "./output-D3g5otMC.mjs";
|
|
4
|
+
import { t as cfAccessHeaders } from "./cf-access-BW8K93Fm.mjs";
|
|
5
|
+
import { t as isVoidInternalStaging } from "./project-DhB4A8_g.mjs";
|
|
6
6
|
import { r as getPackageDir } from "./agents-DqkFfc2c.mjs";
|
|
7
7
|
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
8
|
-
import { randomBytes } from "node:crypto";
|
|
8
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
9
9
|
import { homedir } from "node:os";
|
|
10
10
|
import { Entry } from "@napi-rs/keyring";
|
|
11
11
|
import { spawnSync } from "node:child_process";
|
|
12
|
+
//#region src/cli/cf-access.ts
|
|
13
|
+
const probedHosts = /* @__PURE__ */ new Set();
|
|
14
|
+
/**
|
|
15
|
+
* If the CLI is about to talk to a Cloudflare-Access-gated staging host,
|
|
16
|
+
* probe the locally-installed `cloudflared` binary for a cached user JWT
|
|
17
|
+
* and export it as `CF_ACCESS_TOKEN`. On interactive shells with no cached
|
|
18
|
+
* token, open a browser login flow to populate the cache, then re-read it.
|
|
19
|
+
*
|
|
20
|
+
* Cached per-host so that an early non-gated call (e.g. prod) does not
|
|
21
|
+
* permanently disable the probe for a later gated call (e.g. staging) in
|
|
22
|
+
* the same process. Noop when:
|
|
23
|
+
* - a service-token pair is already set (CI path)
|
|
24
|
+
* - `CF_ACCESS_TOKEN` is already set (manual override or prior probe)
|
|
25
|
+
* - the target host is not gated
|
|
26
|
+
* - `cloudflared` is not installed
|
|
27
|
+
*/
|
|
28
|
+
function ensureCloudflaredToken(apiUrl) {
|
|
29
|
+
if (process.env.CF_ACCESS_CLIENT_ID && process.env.CF_ACCESS_CLIENT_SECRET) return;
|
|
30
|
+
if (process.env.CF_ACCESS_TOKEN) return;
|
|
31
|
+
if (!isGatedHost(apiUrl)) return;
|
|
32
|
+
const host = new URL(apiUrl).hostname;
|
|
33
|
+
if (probedHosts.has(host)) return;
|
|
34
|
+
probedHosts.add(host);
|
|
35
|
+
let token = runCloudflared([
|
|
36
|
+
"access",
|
|
37
|
+
"token",
|
|
38
|
+
`-app=${apiUrl}`
|
|
39
|
+
]);
|
|
40
|
+
if (!token && process.stdin.isTTY && process.stdout.isTTY) {
|
|
41
|
+
runCloudflared([
|
|
42
|
+
"access",
|
|
43
|
+
"login",
|
|
44
|
+
apiUrl
|
|
45
|
+
], {
|
|
46
|
+
inherit: true,
|
|
47
|
+
timeoutMs: 12e4
|
|
48
|
+
});
|
|
49
|
+
token = runCloudflared([
|
|
50
|
+
"access",
|
|
51
|
+
"token",
|
|
52
|
+
`-app=${apiUrl}`
|
|
53
|
+
]);
|
|
54
|
+
}
|
|
55
|
+
if (token) process.env.CF_ACCESS_TOKEN = token;
|
|
56
|
+
}
|
|
57
|
+
function runCloudflared(args, opts) {
|
|
58
|
+
try {
|
|
59
|
+
const result = spawnSync("cloudflared", args, {
|
|
60
|
+
encoding: "utf-8",
|
|
61
|
+
stdio: opts?.inherit ? "inherit" : [
|
|
62
|
+
"ignore",
|
|
63
|
+
"pipe",
|
|
64
|
+
"pipe"
|
|
65
|
+
],
|
|
66
|
+
timeout: opts?.timeoutMs ?? 5e3
|
|
67
|
+
});
|
|
68
|
+
if (result.error || result.status !== 0) return null;
|
|
69
|
+
const out = (result.stdout ?? "").trim();
|
|
70
|
+
return out.length > 0 ? out : null;
|
|
71
|
+
} catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function isGatedHost(apiUrl) {
|
|
76
|
+
try {
|
|
77
|
+
const host = new URL(apiUrl).hostname;
|
|
78
|
+
return host.endsWith(".staging.void.cloud") || host.endsWith(".staging.void.app");
|
|
79
|
+
} catch {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
12
84
|
//#region src/cli/auth.ts
|
|
13
85
|
const CONFIG_DIR = join(homedir(), ".void");
|
|
14
86
|
const CONFIG_PATH = join(CONFIG_DIR, "config.json");
|
|
@@ -103,6 +175,40 @@ function removeToken(root = process.cwd()) {
|
|
|
103
175
|
}
|
|
104
176
|
const DEFAULT_API_URL = "https://api.void.cloud";
|
|
105
177
|
const STAGING_API_URL = "https://api.staging.void.cloud";
|
|
178
|
+
function base64Url(buffer) {
|
|
179
|
+
return buffer.toString("base64").replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
|
|
180
|
+
}
|
|
181
|
+
function createCodeVerifier() {
|
|
182
|
+
return base64Url(randomBytes(32));
|
|
183
|
+
}
|
|
184
|
+
function createCodeChallenge(verifier) {
|
|
185
|
+
return base64Url(createHash("sha256").update(verifier).digest());
|
|
186
|
+
}
|
|
187
|
+
async function exchangeLoginCode(apiUrl, code, state, codeVerifier) {
|
|
188
|
+
const base = apiUrl.endsWith("/") ? apiUrl : `${apiUrl}/`;
|
|
189
|
+
ensureCloudflaredToken(apiUrl);
|
|
190
|
+
const res = await fetch(new URL("auth/cli/token", base), {
|
|
191
|
+
method: "POST",
|
|
192
|
+
headers: {
|
|
193
|
+
"Content-Type": "application/json",
|
|
194
|
+
...cfAccessHeaders(process.env)
|
|
195
|
+
},
|
|
196
|
+
body: JSON.stringify({
|
|
197
|
+
code,
|
|
198
|
+
state,
|
|
199
|
+
code_verifier: codeVerifier
|
|
200
|
+
})
|
|
201
|
+
});
|
|
202
|
+
if (!res.ok) throw new Error(`auth: Failed to exchange login code (${res.status}). Try logging in again.`);
|
|
203
|
+
let body;
|
|
204
|
+
try {
|
|
205
|
+
body = await res.json();
|
|
206
|
+
} catch {
|
|
207
|
+
throw new Error("auth: Login code exchange returned an invalid response.");
|
|
208
|
+
}
|
|
209
|
+
if (!body || typeof body !== "object" || !("token" in body) || typeof body.token !== "string" || body.token.length === 0) throw new Error("auth: Login code exchange did not return a token.");
|
|
210
|
+
return body.token;
|
|
211
|
+
}
|
|
106
212
|
/**
|
|
107
213
|
* Read the API URL from environment or config file.
|
|
108
214
|
* Priority: VOID_API_URL env var > ~/.void/config.json > default
|
|
@@ -134,7 +240,8 @@ function openBrowser(url, exec) {
|
|
|
134
240
|
}
|
|
135
241
|
/**
|
|
136
242
|
* Start a local HTTP server, open the browser to the platform login page,
|
|
137
|
-
* and wait for the OAuth callback with a
|
|
243
|
+
* and wait for the OAuth callback with a short-lived code. The CLI exchanges
|
|
244
|
+
* the code itself so the localhost callback never accepts bearer tokens.
|
|
138
245
|
*
|
|
139
246
|
* `onUrl` is invoked with the login URL once the local server is listening,
|
|
140
247
|
* so callers can show the URL to the user as a manual fallback when the
|
|
@@ -145,8 +252,23 @@ async function runLogin(root = process.cwd(), provider = "github", onUrl) {
|
|
|
145
252
|
const { exec } = await import("node:child_process");
|
|
146
253
|
const apiUrl = getApiUrl(root);
|
|
147
254
|
const state = randomBytes(32).toString("hex");
|
|
255
|
+
const codeVerifier = createCodeVerifier();
|
|
256
|
+
const codeChallenge = createCodeChallenge(codeVerifier);
|
|
148
257
|
return new Promise((resolve, reject) => {
|
|
149
|
-
|
|
258
|
+
let settled = false;
|
|
259
|
+
const fail = (error) => {
|
|
260
|
+
if (settled) return;
|
|
261
|
+
settled = true;
|
|
262
|
+
server.close();
|
|
263
|
+
reject(error);
|
|
264
|
+
};
|
|
265
|
+
const succeed = (token) => {
|
|
266
|
+
if (settled) return;
|
|
267
|
+
settled = true;
|
|
268
|
+
server.close();
|
|
269
|
+
resolve(token);
|
|
270
|
+
};
|
|
271
|
+
const server = http.createServer(async (req, res) => {
|
|
150
272
|
const url = new URL(req.url, `http://localhost`);
|
|
151
273
|
if (url.pathname !== "/callback") {
|
|
152
274
|
res.writeHead(404);
|
|
@@ -161,22 +283,32 @@ async function runLogin(root = process.cwd(), provider = "github", onUrl) {
|
|
|
161
283
|
if (url.searchParams.get("error") === "signup_restricted") {
|
|
162
284
|
res.writeHead(403, { "Content-Type": "text/html" });
|
|
163
285
|
res.end(page("Signup restricted", "Your email is not on the approved list for this environment."));
|
|
164
|
-
|
|
165
|
-
|
|
286
|
+
fail(/* @__PURE__ */ new Error("Signup restricted: your email is not on the approved list for this environment."));
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
if (url.searchParams.has("token")) {
|
|
290
|
+
res.writeHead(400, { "Content-Type": "text/html" });
|
|
291
|
+
res.end(page("Login failed", "Invalid login callback. Please try again."));
|
|
166
292
|
return;
|
|
167
293
|
}
|
|
168
|
-
const
|
|
169
|
-
if (!
|
|
294
|
+
const code = url.searchParams.get("code");
|
|
295
|
+
if (!code) {
|
|
170
296
|
res.writeHead(400, { "Content-Type": "text/html" });
|
|
171
|
-
res.end(page("Login failed", "No
|
|
172
|
-
|
|
173
|
-
|
|
297
|
+
res.end(page("Login failed", "No authorization code received. Please try again."));
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
let token;
|
|
301
|
+
try {
|
|
302
|
+
token = await exchangeLoginCode(apiUrl, code, state, codeVerifier);
|
|
303
|
+
} catch (err) {
|
|
304
|
+
res.writeHead(400, { "Content-Type": "text/html" });
|
|
305
|
+
res.end(page("Login failed", "Could not complete login. Please try again."));
|
|
306
|
+
fail(err instanceof Error ? err : /* @__PURE__ */ new Error("auth: Failed to complete login."));
|
|
174
307
|
return;
|
|
175
308
|
}
|
|
176
309
|
res.writeHead(200, { "Content-Type": "text/html" });
|
|
177
310
|
res.end(page("Login successful!", "You can close this tab and return to the terminal."));
|
|
178
|
-
|
|
179
|
-
resolve(token);
|
|
311
|
+
succeed(token);
|
|
180
312
|
});
|
|
181
313
|
server.on("connection", (socket) => socket.unref());
|
|
182
314
|
server.listen(0, "127.0.0.1", () => {
|
|
@@ -191,88 +323,17 @@ async function runLogin(root = process.cwd(), provider = "github", onUrl) {
|
|
|
191
323
|
const loginUrl = new URL("auth/login", apiUrl.endsWith("/") ? apiUrl : `${apiUrl}/`);
|
|
192
324
|
loginUrl.searchParams.set("redirect", redirect.href);
|
|
193
325
|
loginUrl.searchParams.set("provider", provider);
|
|
326
|
+
loginUrl.searchParams.set("code_challenge", codeChallenge);
|
|
327
|
+
loginUrl.searchParams.set("code_challenge_method", "S256");
|
|
194
328
|
onUrl?.(loginUrl.href);
|
|
195
329
|
openBrowser(loginUrl.href, exec);
|
|
196
330
|
});
|
|
197
331
|
setTimeout(() => {
|
|
198
|
-
|
|
199
|
-
reject(/* @__PURE__ */ new Error("auth: Login timed out after 5 minutes. Try again."));
|
|
332
|
+
fail(/* @__PURE__ */ new Error("auth: Login timed out after 5 minutes. Try again."));
|
|
200
333
|
}, 300 * 1e3).unref();
|
|
201
334
|
});
|
|
202
335
|
}
|
|
203
336
|
//#endregion
|
|
204
|
-
//#region src/cli/cf-access.ts
|
|
205
|
-
const probedHosts = /* @__PURE__ */ new Set();
|
|
206
|
-
/**
|
|
207
|
-
* If the CLI is about to talk to a Cloudflare-Access-gated staging host,
|
|
208
|
-
* probe the locally-installed `cloudflared` binary for a cached user JWT
|
|
209
|
-
* and export it as `CF_ACCESS_TOKEN`. On interactive shells with no cached
|
|
210
|
-
* token, open a browser login flow to populate the cache, then re-read it.
|
|
211
|
-
*
|
|
212
|
-
* Cached per-host so that an early non-gated call (e.g. prod) does not
|
|
213
|
-
* permanently disable the probe for a later gated call (e.g. staging) in
|
|
214
|
-
* the same process. Noop when:
|
|
215
|
-
* - a service-token pair is already set (CI path)
|
|
216
|
-
* - `CF_ACCESS_TOKEN` is already set (manual override or prior probe)
|
|
217
|
-
* - the target host is not gated
|
|
218
|
-
* - `cloudflared` is not installed
|
|
219
|
-
*/
|
|
220
|
-
function ensureCloudflaredToken(apiUrl) {
|
|
221
|
-
if (process.env.CF_ACCESS_CLIENT_ID && process.env.CF_ACCESS_CLIENT_SECRET) return;
|
|
222
|
-
if (process.env.CF_ACCESS_TOKEN) return;
|
|
223
|
-
if (!isGatedHost(apiUrl)) return;
|
|
224
|
-
const host = new URL(apiUrl).hostname;
|
|
225
|
-
if (probedHosts.has(host)) return;
|
|
226
|
-
probedHosts.add(host);
|
|
227
|
-
let token = runCloudflared([
|
|
228
|
-
"access",
|
|
229
|
-
"token",
|
|
230
|
-
`-app=${apiUrl}`
|
|
231
|
-
]);
|
|
232
|
-
if (!token && process.stdin.isTTY && process.stdout.isTTY) {
|
|
233
|
-
runCloudflared([
|
|
234
|
-
"access",
|
|
235
|
-
"login",
|
|
236
|
-
apiUrl
|
|
237
|
-
], {
|
|
238
|
-
inherit: true,
|
|
239
|
-
timeoutMs: 12e4
|
|
240
|
-
});
|
|
241
|
-
token = runCloudflared([
|
|
242
|
-
"access",
|
|
243
|
-
"token",
|
|
244
|
-
`-app=${apiUrl}`
|
|
245
|
-
]);
|
|
246
|
-
}
|
|
247
|
-
if (token) process.env.CF_ACCESS_TOKEN = token;
|
|
248
|
-
}
|
|
249
|
-
function runCloudflared(args, opts) {
|
|
250
|
-
try {
|
|
251
|
-
const result = spawnSync("cloudflared", args, {
|
|
252
|
-
encoding: "utf-8",
|
|
253
|
-
stdio: opts?.inherit ? "inherit" : [
|
|
254
|
-
"ignore",
|
|
255
|
-
"pipe",
|
|
256
|
-
"pipe"
|
|
257
|
-
],
|
|
258
|
-
timeout: opts?.timeoutMs ?? 5e3
|
|
259
|
-
});
|
|
260
|
-
if (result.error || result.status !== 0) return null;
|
|
261
|
-
const out = (result.stdout ?? "").trim();
|
|
262
|
-
return out.length > 0 ? out : null;
|
|
263
|
-
} catch {
|
|
264
|
-
return null;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
function isGatedHost(apiUrl) {
|
|
268
|
-
try {
|
|
269
|
-
const host = new URL(apiUrl).hostname;
|
|
270
|
-
return host.endsWith(".staging.void.cloud") || host.endsWith(".staging.void.app");
|
|
271
|
-
} catch {
|
|
272
|
-
return false;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
//#endregion
|
|
276
337
|
//#region src/cli/client.ts
|
|
277
338
|
var client_exports = /* @__PURE__ */ __exportAll({
|
|
278
339
|
PlatformApiError: () => PlatformApiError,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as __exportAll } from "./chunk-DJd-R1mw.mjs";
|
|
2
2
|
import { a as join } from "./pathe.M-eThtNZ-D-kmWkCS.mjs";
|
|
3
|
-
import { i as isVoidAuthProvider, t as VOID_AUTH_PROVIDERS } from "./providers-
|
|
3
|
+
import { i as isVoidAuthProvider, t as VOID_AUTH_PROVIDERS } from "./providers-BlFNPYen.mjs";
|
|
4
4
|
import { readFileSync } from "node:fs";
|
|
5
5
|
//#region src/config.ts
|
|
6
6
|
var config_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as __exportAll } from "./chunk-DJd-R1mw.mjs";
|
|
2
2
|
import { a as join } from "./pathe.M-eThtNZ-D-kmWkCS.mjs";
|
|
3
|
-
import { r as schemaSpecifier, t as discoverSchema } from "./discover-
|
|
3
|
+
import { r as schemaSpecifier, t as discoverSchema } from "./discover-CKGQpis8.mjs";
|
|
4
4
|
import { mkdirSync, writeFileSync } from "node:fs";
|
|
5
5
|
//#region src/drizzle/config.ts
|
|
6
6
|
var config_exports = /* @__PURE__ */ __exportAll({ writeDrizzleConfig: () => writeDrizzleConfig });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { s as import_picocolors } from "./output-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { s as import_picocolors } from "./output-D3g5otMC.mjs";
|
|
2
|
+
import { s as getSiteDomain, t as PlatformApiError } from "./client-C_DYiXeu.mjs";
|
|
3
|
+
import { _ as me, c as R, i as Ee, l as Re, x as q } from "./dist-D2L3_KTK.mjs";
|
|
4
|
+
import { a as writeProjectConfig } from "./project-DhB4A8_g.mjs";
|
|
5
5
|
import { n as validateProjectSlug } from "./project-slug-KRvHQEQI.mjs";
|
|
6
6
|
import { n as inferDefaultSlug } from "./resolve-project-DdjLQ2tB.mjs";
|
|
7
7
|
//#region src/cli/prompt.ts
|