@hype-stack/cli 1.3.2 → 1.3.3
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/{cli-CFJ34DYw.js → cli-Bbv5yflm.js} +716 -502
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/onboard.d.ts +9 -4
- package/dist/commands/onboard.d.ts.map +1 -1
- package/dist/config/bin.js +1 -1
- package/dist/deploy/orchestrate.d.ts.map +1 -1
- package/dist/deploy/providers/railway.d.ts +37 -1
- package/dist/deploy/providers/railway.d.ts.map +1 -1
- package/dist/deploy/providers/types.d.ts +14 -0
- package/dist/deploy/providers/types.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/ui/env-prompt.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@ import { McpServer as ce } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
18
18
|
import { StdioServerTransport as le } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
19
19
|
import { Writable as ue } from "node:stream";
|
|
20
20
|
//#region src/constants/constants.ts
|
|
21
|
-
var de = "1.3.
|
|
21
|
+
var de = "1.3.3", fe = "gh:BetterTyped/hype-stack", pe = "stack.json", me = "/schema/stack.json", he = "https://api.hype-stack.dev", ge = "HYPE_STACK_API_URL", _e = "https://www.hype-stack.dev", ve = /^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/, ye = [
|
|
22
22
|
{
|
|
23
23
|
value: "cursor",
|
|
24
24
|
label: "Cursor",
|
|
@@ -7406,41 +7406,46 @@ function gf(e = {}) {
|
|
|
7406
7406
|
}
|
|
7407
7407
|
//#endregion
|
|
7408
7408
|
//#region src/deploy/providers/railway.ts
|
|
7409
|
-
var _f = "Postgres", vf = "valkey/valkey:
|
|
7409
|
+
var _f = "Postgres", vf = "valkey/valkey:latest", yf = 6379, bf = "/data", xf = "/bin/sh -c \"exec docker-entrypoint.sh valkey-server --port ${VALKEY_PORT} --requirepass ${VALKEY_PASSWORD} --appendonly yes\"", Sf = 12e4, Cf = 3e3, wf = 20 * 6e4, Tf = 1e4, Ef = new Set(["SUCCESS", "SLEEPING"]), Df = new Set([
|
|
7410
|
+
"FAILED",
|
|
7411
|
+
"CRASHED",
|
|
7412
|
+
"REMOVED",
|
|
7413
|
+
"SKIPPED"
|
|
7414
|
+
]), Of = "query Deployments($input: DeploymentListInput!) { deployments(input: $input, first: 1) { edges { node { id status } } } }", kf = "query BuildLogs($deploymentId: String!, $limit: Int) { buildLogs(deploymentId: $deploymentId, limit: $limit) { message } }", Af = "query DeploymentLogs($deploymentId: String!, $limit: Int) { deploymentLogs(deploymentId: $deploymentId, limit: $limit) { message } }", jf = [
|
|
7410
7415
|
"sjc",
|
|
7411
7416
|
"iad",
|
|
7412
7417
|
"ams",
|
|
7413
7418
|
"sin"
|
|
7414
|
-
],
|
|
7415
|
-
function
|
|
7419
|
+
], Mf = "iad", Nf = "rustfs/rustfs:latest", Pf = 9e3, Ff = "/data", If = /already exists|duplicate|is already/i, Lf = /unrecognized subcommand|unknown subcommand|unexpected argument|not a valid subcommand/i;
|
|
7420
|
+
function Rf(e) {
|
|
7416
7421
|
let t = e.trim();
|
|
7417
7422
|
if (t.startsWith("{") || t.startsWith("[")) {
|
|
7418
|
-
let e = Q(t), n = e === null ? null :
|
|
7419
|
-
if (n) return
|
|
7423
|
+
let e = Q(t), n = e === null ? null : Bf(e);
|
|
7424
|
+
if (n) return zf(n);
|
|
7420
7425
|
}
|
|
7421
7426
|
let n = t.match(/[a-z0-9-]+(?:\.[a-z0-9-]+)*\.(?:up\.railway\.app|railway\.app)/i);
|
|
7422
|
-
return n ?
|
|
7427
|
+
return n ? zf(n[0]) : null;
|
|
7423
7428
|
}
|
|
7424
|
-
function
|
|
7429
|
+
function zf(e) {
|
|
7425
7430
|
return `https://${e.replace(/^https?:\/\//i, "").replace(/\/+$/, "")}`;
|
|
7426
7431
|
}
|
|
7427
|
-
function
|
|
7432
|
+
function Bf(e) {
|
|
7428
7433
|
if (typeof e == "string") return /\.railway\.app/i.test(e) ? e : null;
|
|
7429
7434
|
if (Array.isArray(e)) {
|
|
7430
7435
|
for (let t of e) {
|
|
7431
|
-
let e =
|
|
7436
|
+
let e = Bf(t);
|
|
7432
7437
|
if (e) return e;
|
|
7433
7438
|
}
|
|
7434
7439
|
return null;
|
|
7435
7440
|
}
|
|
7436
7441
|
if (typeof e == "object" && e) for (let [t, n] of Object.entries(e)) {
|
|
7437
7442
|
if ((t === "domain" || t === "url" || t === "host") && typeof n == "string" && n.length > 0) return n;
|
|
7438
|
-
let e =
|
|
7443
|
+
let e = Bf(n);
|
|
7439
7444
|
if (e) return e;
|
|
7440
7445
|
}
|
|
7441
7446
|
return null;
|
|
7442
7447
|
}
|
|
7443
|
-
function
|
|
7448
|
+
function Vf(e) {
|
|
7444
7449
|
let t = Q(e.trim());
|
|
7445
7450
|
if (!Array.isArray(t)) return [];
|
|
7446
7451
|
let n = [];
|
|
@@ -7454,7 +7459,7 @@ function Mf(e) {
|
|
|
7454
7459
|
}
|
|
7455
7460
|
return n;
|
|
7456
7461
|
}
|
|
7457
|
-
function
|
|
7462
|
+
function Hf(e) {
|
|
7458
7463
|
let t = Q(e.trim());
|
|
7459
7464
|
if (typeof t != "object" || !t || Array.isArray(t)) return null;
|
|
7460
7465
|
let n = t, r = n.id;
|
|
@@ -7463,7 +7468,7 @@ function Nf(e) {
|
|
|
7463
7468
|
name: typeof n.name == "string" ? n.name : ""
|
|
7464
7469
|
};
|
|
7465
7470
|
}
|
|
7466
|
-
function
|
|
7471
|
+
function Uf(e) {
|
|
7467
7472
|
let t = e.trim();
|
|
7468
7473
|
if (t.startsWith("{")) {
|
|
7469
7474
|
let e = Q(t);
|
|
@@ -7480,7 +7485,7 @@ function Pf(e) {
|
|
|
7480
7485
|
}
|
|
7481
7486
|
return n;
|
|
7482
7487
|
}
|
|
7483
|
-
var
|
|
7488
|
+
var Wf = {
|
|
7484
7489
|
id: "railway",
|
|
7485
7490
|
async checkAuth(e) {
|
|
7486
7491
|
let t = await e.runner.run({
|
|
@@ -7500,16 +7505,16 @@ var Ff = {
|
|
|
7500
7505
|
scope: {
|
|
7501
7506
|
label: "workspace",
|
|
7502
7507
|
flag: "--railway-workspace",
|
|
7503
|
-
list:
|
|
7508
|
+
list: ep,
|
|
7504
7509
|
current: (e) => e.railway.workspace,
|
|
7505
7510
|
pin: (e, t) => {
|
|
7506
7511
|
e.railway.workspace = t;
|
|
7507
7512
|
}
|
|
7508
7513
|
},
|
|
7509
7514
|
async reserveTarget(e, t) {
|
|
7510
|
-
await
|
|
7515
|
+
await Zf(e);
|
|
7511
7516
|
let n = t.spec.serveMode === "static" ? $u : t.spec.port ?? 3e3;
|
|
7512
|
-
if (!await
|
|
7517
|
+
if (!await rp(e, t.app)) {
|
|
7513
7518
|
let r = await e.runner.run({
|
|
7514
7519
|
command: "railway",
|
|
7515
7520
|
args: [
|
|
@@ -7524,7 +7529,7 @@ var Ff = {
|
|
|
7524
7529
|
allowFailure: !0,
|
|
7525
7530
|
label: `create railway service ${t.app}`
|
|
7526
7531
|
});
|
|
7527
|
-
if (r.exitCode !== 0 && !
|
|
7532
|
+
if (r.exitCode !== 0 && !If.test(r.stderr + r.stdout)) throw Error(`Could not create the Railway service "${t.app}":\n${r.stderr.trim() || r.stdout.trim()}`);
|
|
7528
7533
|
}
|
|
7529
7534
|
if (t.url) return t.url;
|
|
7530
7535
|
let r = await e.runner.run({
|
|
@@ -7540,7 +7545,7 @@ var Ff = {
|
|
|
7540
7545
|
cwd: e.cwd,
|
|
7541
7546
|
allowFailure: !0,
|
|
7542
7547
|
label: `generate domain for ${t.app}`
|
|
7543
|
-
}), i =
|
|
7548
|
+
}), i = Rf(r.stdout + r.stderr);
|
|
7544
7549
|
if (!i) throw Error(`Railway did not return a domain for "${t.app}". Run \`railway domain --service ${t.app}\` and set deploy.targets.${t.target}.url in stack.json.`);
|
|
7545
7550
|
return i;
|
|
7546
7551
|
},
|
|
@@ -7549,7 +7554,7 @@ var Ff = {
|
|
|
7549
7554
|
return n.external ? {
|
|
7550
7555
|
outputs: n.external,
|
|
7551
7556
|
note: "using the external values from stack.json"
|
|
7552
|
-
} : (await
|
|
7557
|
+
} : (await Zf(e), n.service === "postgres" ? cp(e, t.crossProvider) : n.service === "valkey" ? fp(e, t) : Op(e, t));
|
|
7553
7558
|
},
|
|
7554
7559
|
async setEnv(e, t) {
|
|
7555
7560
|
for (let [n, r] of Object.entries(t.env)) await e.runner.run({
|
|
@@ -7570,7 +7575,40 @@ var Ff = {
|
|
|
7570
7575
|
});
|
|
7571
7576
|
},
|
|
7572
7577
|
async deployTarget(e, t) {
|
|
7573
|
-
return t.target.spec.serveMode === "static" ?
|
|
7578
|
+
return t.target.spec.serveMode === "static" ? Gf(e, t) : Kf(e, t);
|
|
7579
|
+
},
|
|
7580
|
+
async awaitTarget(e, t) {
|
|
7581
|
+
if (e.runner.dryRun) return {
|
|
7582
|
+
ok: !0,
|
|
7583
|
+
detail: "not checked on a dry run"
|
|
7584
|
+
};
|
|
7585
|
+
let n = await np(e, t.app);
|
|
7586
|
+
if (!n) return {
|
|
7587
|
+
ok: !0,
|
|
7588
|
+
detail: `could not find the service "${t.app}" to check on it, so look at the Railway dashboard`
|
|
7589
|
+
};
|
|
7590
|
+
let r = await yp(e, {
|
|
7591
|
+
name: t.app,
|
|
7592
|
+
serviceId: n.id,
|
|
7593
|
+
timeoutMs: wf,
|
|
7594
|
+
pollIntervalMs: Tf
|
|
7595
|
+
});
|
|
7596
|
+
if (r.ok) return {
|
|
7597
|
+
ok: !0,
|
|
7598
|
+
detail: r.status === null ? r.note : "live"
|
|
7599
|
+
};
|
|
7600
|
+
let i = r.deploymentId && r.status ? await xp(e, {
|
|
7601
|
+
id: r.deploymentId,
|
|
7602
|
+
status: r.status
|
|
7603
|
+
}) : null, a = r.note ?? `the deployment ${r.status === "CRASHED" ? "crashed after starting" : "failed"}`;
|
|
7604
|
+
return {
|
|
7605
|
+
ok: !1,
|
|
7606
|
+
detail: [
|
|
7607
|
+
`${t.app} did not come up: ${a}.`,
|
|
7608
|
+
i,
|
|
7609
|
+
`Fix it and run deploy again. \`railway logs --service ${t.app}\` has the full log.`
|
|
7610
|
+
].filter(Boolean).join("\n")
|
|
7611
|
+
};
|
|
7574
7612
|
},
|
|
7575
7613
|
async runRemote(e, t, n) {
|
|
7576
7614
|
let r = await e.runner.run({
|
|
@@ -7592,7 +7630,7 @@ var Ff = {
|
|
|
7592
7630
|
};
|
|
7593
7631
|
}
|
|
7594
7632
|
};
|
|
7595
|
-
async function
|
|
7633
|
+
async function Gf(e, t) {
|
|
7596
7634
|
let { target: n } = t, r = await zd(e, t), i = await pd({
|
|
7597
7635
|
projectRoot: e.cwd,
|
|
7598
7636
|
target: n,
|
|
@@ -7612,7 +7650,7 @@ async function If(e, t) {
|
|
|
7612
7650
|
cwd: e.cwd,
|
|
7613
7651
|
label: `point ${n.app} at the bundled Dockerfile`
|
|
7614
7652
|
}), {
|
|
7615
|
-
url:
|
|
7653
|
+
url: Rf((await qf(e, t, [
|
|
7616
7654
|
i,
|
|
7617
7655
|
"--path-as-root",
|
|
7618
7656
|
"--no-gitignore"
|
|
@@ -7620,7 +7658,7 @@ async function If(e, t) {
|
|
|
7620
7658
|
releaseRan: !1
|
|
7621
7659
|
};
|
|
7622
7660
|
}
|
|
7623
|
-
async function
|
|
7661
|
+
async function Kf(e, t) {
|
|
7624
7662
|
let { target: n } = t, r = await md(e.cwd, n);
|
|
7625
7663
|
if (!r) throw Error(`Railway builds the ${n.spec.label} from a Dockerfile, but there is none at ${n.spec.defaultRoot}/Dockerfile. Add one and run deploy again.`);
|
|
7626
7664
|
await e.runner.run({
|
|
@@ -7636,21 +7674,21 @@ async function Lf(e, t) {
|
|
|
7636
7674
|
cwd: e.cwd,
|
|
7637
7675
|
label: `point ${n.app} at ${r}`
|
|
7638
7676
|
});
|
|
7639
|
-
let i = await
|
|
7677
|
+
let i = await Yf(e, {
|
|
7640
7678
|
dockerfile: r,
|
|
7641
7679
|
target: n,
|
|
7642
7680
|
releaseCommand: t.releaseCommand
|
|
7643
7681
|
});
|
|
7644
7682
|
try {
|
|
7645
7683
|
return {
|
|
7646
|
-
url:
|
|
7684
|
+
url: Rf((await qf(e, t, [])).stdout) ?? n.url,
|
|
7647
7685
|
releaseRan: i.preDeployRan
|
|
7648
7686
|
};
|
|
7649
7687
|
} finally {
|
|
7650
7688
|
i.written && await sd(e.cwd);
|
|
7651
7689
|
}
|
|
7652
7690
|
}
|
|
7653
|
-
async function
|
|
7691
|
+
async function qf(e, t, n) {
|
|
7654
7692
|
let r = {
|
|
7655
7693
|
command: "railway",
|
|
7656
7694
|
args: [
|
|
@@ -7658,7 +7696,7 @@ async function Rf(e, t, n) {
|
|
|
7658
7696
|
...n,
|
|
7659
7697
|
"--service",
|
|
7660
7698
|
t.target.app,
|
|
7661
|
-
"--
|
|
7699
|
+
"--detach"
|
|
7662
7700
|
],
|
|
7663
7701
|
cwd: e.cwd,
|
|
7664
7702
|
secrets: t.secrets,
|
|
@@ -7666,10 +7704,10 @@ async function Rf(e, t, n) {
|
|
|
7666
7704
|
label: `deploy ${t.target.target} to railway`
|
|
7667
7705
|
}, i = await e.runner.run(r);
|
|
7668
7706
|
if (i.exitCode === 0) return i;
|
|
7669
|
-
let a = new df(r, i), o = await
|
|
7707
|
+
let a = new df(r, i), o = await Jf(e, t.target, i.stdout + i.stderr);
|
|
7670
7708
|
throw o ? /* @__PURE__ */ Error(`${a.message}\n\n${o}`) : a;
|
|
7671
7709
|
}
|
|
7672
|
-
async function
|
|
7710
|
+
async function Jf(e, t, n) {
|
|
7673
7711
|
let r = n.match(/Could not load ([\w@./-]+)/)?.[1];
|
|
7674
7712
|
if (!r) return null;
|
|
7675
7713
|
let i = [
|
|
@@ -7696,7 +7734,7 @@ async function zf(e, t, n) {
|
|
|
7696
7734
|
label: `check whether ${o} is gitignored`
|
|
7697
7735
|
})).exitCode === 0 ? `${o} exists here but is in .gitignore, and \`railway up\` only uploads what git would track, so the build on Railway cannot see it. Take it out of .gitignore (moving any secrets in it into environment variables first) and deploy again.` : null;
|
|
7698
7736
|
}
|
|
7699
|
-
async function
|
|
7737
|
+
async function Yf(e, t) {
|
|
7700
7738
|
let { dockerfile: n, target: r, releaseCommand: i } = t;
|
|
7701
7739
|
if (await ad(e.cwd)) return e.log?.(`Keeping your ${nd}, so ${r.app} uses the settings in it`), {
|
|
7702
7740
|
written: !1,
|
|
@@ -7715,11 +7753,11 @@ async function Bf(e, t) {
|
|
|
7715
7753
|
preDeployRan: o
|
|
7716
7754
|
});
|
|
7717
7755
|
}
|
|
7718
|
-
var
|
|
7719
|
-
async function
|
|
7720
|
-
|
|
7756
|
+
var Xf = /* @__PURE__ */ new WeakSet();
|
|
7757
|
+
async function Zf(e) {
|
|
7758
|
+
Xf.has(e) || (await Qf(e), Xf.add(e));
|
|
7721
7759
|
}
|
|
7722
|
-
async function
|
|
7760
|
+
async function Qf(e) {
|
|
7723
7761
|
if ((await e.runner.run({
|
|
7724
7762
|
command: "railway",
|
|
7725
7763
|
args: ["status", "--json"],
|
|
@@ -7727,7 +7765,7 @@ async function Uf(e) {
|
|
|
7727
7765
|
allowFailure: !0,
|
|
7728
7766
|
label: "check railway project link"
|
|
7729
7767
|
})).exitCode === 0) return;
|
|
7730
|
-
let t = await
|
|
7768
|
+
let t = await tp(e);
|
|
7731
7769
|
await e.runner.run({
|
|
7732
7770
|
command: "railway",
|
|
7733
7771
|
args: [
|
|
@@ -7740,7 +7778,7 @@ async function Uf(e) {
|
|
|
7740
7778
|
label: `create railway project ${e.plan.projectName}`
|
|
7741
7779
|
});
|
|
7742
7780
|
}
|
|
7743
|
-
function
|
|
7781
|
+
function $f(e) {
|
|
7744
7782
|
let t = Q(e);
|
|
7745
7783
|
if (typeof t != "object" || !t) return [];
|
|
7746
7784
|
let n = t.workspaces;
|
|
@@ -7750,7 +7788,7 @@ function Wf(e) {
|
|
|
7750
7788
|
return typeof n == "string" ? [n] : [];
|
|
7751
7789
|
}) : [];
|
|
7752
7790
|
}
|
|
7753
|
-
async function
|
|
7791
|
+
async function ep(e) {
|
|
7754
7792
|
let t = await e.runner.run({
|
|
7755
7793
|
command: "railway",
|
|
7756
7794
|
args: ["whoami", "--json"],
|
|
@@ -7758,17 +7796,17 @@ async function Gf(e) {
|
|
|
7758
7796
|
allowFailure: !0,
|
|
7759
7797
|
label: "find your Railway workspace"
|
|
7760
7798
|
});
|
|
7761
|
-
return t.exitCode === 0 ?
|
|
7799
|
+
return t.exitCode === 0 ? $f(t.stdout) : [];
|
|
7762
7800
|
}
|
|
7763
|
-
async function
|
|
7801
|
+
async function tp(e) {
|
|
7764
7802
|
if (e.plan.railway.workspace) return e.plan.railway.workspace;
|
|
7765
|
-
let t = await
|
|
7803
|
+
let t = await ep(e);
|
|
7766
7804
|
if (t.length !== 0) {
|
|
7767
7805
|
if (t.length > 1) throw Error(`Your Railway account belongs to ${t.length} workspaces (${t.join(", ")}). Pass --railway-workspace <name> so the project is created in the right one.`);
|
|
7768
7806
|
return e.plan.railway.workspace = t[0], t[0];
|
|
7769
7807
|
}
|
|
7770
7808
|
}
|
|
7771
|
-
async function
|
|
7809
|
+
async function np(e, t) {
|
|
7772
7810
|
let n = await e.runner.run({
|
|
7773
7811
|
command: "railway",
|
|
7774
7812
|
args: [
|
|
@@ -7780,18 +7818,18 @@ async function qf(e, t) {
|
|
|
7780
7818
|
allowFailure: !0,
|
|
7781
7819
|
label: "list railway services"
|
|
7782
7820
|
});
|
|
7783
|
-
return n.exitCode === 0 ?
|
|
7821
|
+
return n.exitCode === 0 ? Vf(n.stdout).find((e) => e.name === t) ?? null : null;
|
|
7784
7822
|
}
|
|
7785
|
-
async function
|
|
7786
|
-
return await
|
|
7823
|
+
async function rp(e, t) {
|
|
7824
|
+
return await np(e, t) !== null;
|
|
7787
7825
|
}
|
|
7788
|
-
function
|
|
7826
|
+
function ip(e, t) {
|
|
7789
7827
|
return `\${{${/^[\w-]+$/.test(e) ? e : `"${e}"`}.${t}}}`;
|
|
7790
7828
|
}
|
|
7791
|
-
function
|
|
7792
|
-
return `https://${
|
|
7829
|
+
function ap(e) {
|
|
7830
|
+
return `https://${ip(e, "RAILWAY_PUBLIC_DOMAIN")}`;
|
|
7793
7831
|
}
|
|
7794
|
-
async function
|
|
7832
|
+
async function op(e, t) {
|
|
7795
7833
|
let n = await e.runner.run({
|
|
7796
7834
|
command: "railway",
|
|
7797
7835
|
args: [
|
|
@@ -7805,9 +7843,9 @@ async function Zf(e, t) {
|
|
|
7805
7843
|
allowFailure: !0,
|
|
7806
7844
|
label: `read ${t} connection details`
|
|
7807
7845
|
});
|
|
7808
|
-
return n.exitCode === 0 ?
|
|
7846
|
+
return n.exitCode === 0 ? Uf(n.stdout) : {};
|
|
7809
7847
|
}
|
|
7810
|
-
var
|
|
7848
|
+
var sp = {
|
|
7811
7849
|
DATABASE_URL: "DATABASE_URL",
|
|
7812
7850
|
POSTGRES_DB: "PGDATABASE",
|
|
7813
7851
|
POSTGRES_HOST: "PGHOST",
|
|
@@ -7815,8 +7853,8 @@ var Qf = {
|
|
|
7815
7853
|
POSTGRES_USER: "PGUSER",
|
|
7816
7854
|
POSTGRES_PASSWORD: "PGPASSWORD"
|
|
7817
7855
|
};
|
|
7818
|
-
async function
|
|
7819
|
-
if (!await
|
|
7856
|
+
async function cp(e, t) {
|
|
7857
|
+
if (!await rp(e, "Postgres")) {
|
|
7820
7858
|
let t = await e.runner.run({
|
|
7821
7859
|
command: "railway",
|
|
7822
7860
|
args: [
|
|
@@ -7829,28 +7867,28 @@ async function $f(e, t) {
|
|
|
7829
7867
|
allowFailure: !0,
|
|
7830
7868
|
label: "add railway postgres"
|
|
7831
7869
|
});
|
|
7832
|
-
if (t.exitCode !== 0 && !
|
|
7870
|
+
if (t.exitCode !== 0 && !If.test(t.stderr + t.stdout)) throw Error(`Could not add a Railway postgres database:\n${t.stderr.trim()}`);
|
|
7833
7871
|
}
|
|
7834
7872
|
if (!t) {
|
|
7835
7873
|
let e = {};
|
|
7836
|
-
for (let [t, n] of Object.entries(
|
|
7874
|
+
for (let [t, n] of Object.entries(sp)) e[t] = ip(_f, n);
|
|
7837
7875
|
return {
|
|
7838
7876
|
outputs: e,
|
|
7839
7877
|
note: `wired as Railway references to ${_f}`
|
|
7840
7878
|
};
|
|
7841
7879
|
}
|
|
7842
|
-
let n = await
|
|
7880
|
+
let n = await op(e, _f), r = n.DATABASE_PUBLIC_URL ?? n.DATABASE_URL;
|
|
7843
7881
|
if (!r) throw Error(`Could not read DATABASE_PUBLIC_URL from the Railway ${_f} service. Enable a public proxy on it, or set ${vd("services", "postgres", "external")} in ${X}.`);
|
|
7844
7882
|
return { outputs: {
|
|
7845
7883
|
DATABASE_URL: r,
|
|
7846
|
-
...
|
|
7884
|
+
...lp(r)
|
|
7847
7885
|
} };
|
|
7848
7886
|
}
|
|
7849
|
-
function
|
|
7850
|
-
let t =
|
|
7887
|
+
function lp(e) {
|
|
7888
|
+
let t = up(e);
|
|
7851
7889
|
if (!t) return {};
|
|
7852
7890
|
let n = decodeURIComponent(t.pathname.replace(/^\//, ""));
|
|
7853
|
-
return
|
|
7891
|
+
return dp({
|
|
7854
7892
|
POSTGRES_HOST: t.hostname,
|
|
7855
7893
|
POSTGRES_PORT: t.port,
|
|
7856
7894
|
POSTGRES_USER: decodeURIComponent(t.username),
|
|
@@ -7858,33 +7896,33 @@ function ep(e) {
|
|
|
7858
7896
|
POSTGRES_DB: n
|
|
7859
7897
|
});
|
|
7860
7898
|
}
|
|
7861
|
-
function
|
|
7899
|
+
function up(e) {
|
|
7862
7900
|
try {
|
|
7863
7901
|
return new URL(e);
|
|
7864
7902
|
} catch {
|
|
7865
7903
|
return null;
|
|
7866
7904
|
}
|
|
7867
7905
|
}
|
|
7868
|
-
function
|
|
7906
|
+
function dp(e) {
|
|
7869
7907
|
return Object.fromEntries(Object.entries(e).filter(([, e]) => e !== ""));
|
|
7870
7908
|
}
|
|
7871
|
-
async function
|
|
7872
|
-
let n = t.service.name, r = await
|
|
7873
|
-
if (r || await
|
|
7909
|
+
async function fp(e, t) {
|
|
7910
|
+
let n = t.service.name, r = await np(e, n);
|
|
7911
|
+
if (r || await pp(e, n), !t.crossProvider) return {
|
|
7874
7912
|
outputs: {
|
|
7875
|
-
VALKEY_URL:
|
|
7876
|
-
VALKEY_PASSWORD:
|
|
7913
|
+
VALKEY_URL: ip(n, "VALKEY_URL"),
|
|
7914
|
+
VALKEY_PASSWORD: ip(n, "VALKEY_PASSWORD")
|
|
7877
7915
|
},
|
|
7878
7916
|
note: r ? "reusing the Valkey service already in the project" : `${vf} with a volume and a password`
|
|
7879
7917
|
};
|
|
7880
|
-
let i = await
|
|
7918
|
+
let i = await op(e, n), a = i.VALKEY_PUBLIC_URL ?? i.VALKEY_URL;
|
|
7881
7919
|
if (!a) throw Error(`Could not read VALKEY_PUBLIC_URL from the Railway Valkey service "${n}". Run \`railway tcp-proxy create --port ${yf} --service ${n}\`, or set ${vd("services", "valkey", "external")} in ${X}.`);
|
|
7882
|
-
return { outputs:
|
|
7920
|
+
return { outputs: dp({
|
|
7883
7921
|
VALKEY_URL: a,
|
|
7884
7922
|
VALKEY_PASSWORD: i.VALKEY_PASSWORD ?? ""
|
|
7885
7923
|
}) };
|
|
7886
7924
|
}
|
|
7887
|
-
async function
|
|
7925
|
+
async function pp(e, t) {
|
|
7888
7926
|
let n = O(24).toString("base64url"), r = await e.runner.run({
|
|
7889
7927
|
command: "railway",
|
|
7890
7928
|
args: [
|
|
@@ -7909,27 +7947,44 @@ async function ip(e, t) {
|
|
|
7909
7947
|
label: `create valkey service ${t}`
|
|
7910
7948
|
});
|
|
7911
7949
|
if (r.exitCode !== 0) throw Error(`Could not create the Railway Valkey service "${t}":\n${r.stderr.trim()}`);
|
|
7912
|
-
let i =
|
|
7950
|
+
let i = Hf(r.stdout)?.id;
|
|
7913
7951
|
if (!i) throw Error(`Railway created the Valkey service "${t}" but did not report its id, which is needed to mount its volume and set its start command. Run \`railway service list --json\`, finish it from the dashboard, or set ${vd("services", "valkey", "external")} in ${X}.`);
|
|
7914
|
-
await
|
|
7952
|
+
await Sp(e, {
|
|
7915
7953
|
name: t,
|
|
7916
7954
|
serviceId: i,
|
|
7917
7955
|
command: xf
|
|
7918
|
-
}), await
|
|
7956
|
+
}), await Fp(e, {
|
|
7919
7957
|
name: t,
|
|
7920
7958
|
serviceId: i,
|
|
7921
7959
|
mountPath: bf,
|
|
7922
7960
|
consequence: "everything cached in it would be lost on the next restart"
|
|
7923
|
-
}), await
|
|
7961
|
+
}), await Ep(e, {
|
|
7924
7962
|
name: t,
|
|
7925
7963
|
port: yf
|
|
7926
|
-
}), await
|
|
7964
|
+
}), await mp(e, {
|
|
7927
7965
|
name: t,
|
|
7928
7966
|
serviceId: i
|
|
7967
|
+
}), e.log?.(`Waiting for ${t} to come up`);
|
|
7968
|
+
let a = await yp(e, {
|
|
7969
|
+
name: t,
|
|
7970
|
+
serviceId: i,
|
|
7971
|
+
timeoutMs: Sf,
|
|
7972
|
+
pollIntervalMs: Cf
|
|
7929
7973
|
});
|
|
7974
|
+
if (!a.ok) {
|
|
7975
|
+
let n = a.deploymentId && a.status ? await xp(e, {
|
|
7976
|
+
id: a.deploymentId,
|
|
7977
|
+
status: a.status
|
|
7978
|
+
}) : null;
|
|
7979
|
+
throw Error([
|
|
7980
|
+
`The Railway Valkey service "${t}" was deployed but has not come up (${a.note ?? a.status?.toLowerCase() ?? "unknown status"}), and the backend cannot reach its cache until it does.`,
|
|
7981
|
+
n,
|
|
7982
|
+
"Check it in the Railway dashboard and run deploy again."
|
|
7983
|
+
].filter(Boolean).join("\n"));
|
|
7984
|
+
}
|
|
7930
7985
|
}
|
|
7931
|
-
async function
|
|
7932
|
-
let n = await
|
|
7986
|
+
async function mp(e, t) {
|
|
7987
|
+
let n = await wp(e), r = await e.runner.run({
|
|
7933
7988
|
command: "railway",
|
|
7934
7989
|
args: [
|
|
7935
7990
|
"api",
|
|
@@ -7947,8 +8002,120 @@ async function ap(e, t) {
|
|
|
7947
8002
|
});
|
|
7948
8003
|
if (r.exitCode !== 0) throw Error(`The Railway service "${t.name}" is configured but its first deployment could not be started, so nothing is running yet:\n${r.stderr.trim() || r.stdout.trim()}\nDeploy it from the Railway dashboard and run deploy again.`);
|
|
7949
8004
|
}
|
|
7950
|
-
|
|
7951
|
-
let
|
|
8005
|
+
function hp(e) {
|
|
8006
|
+
let t = Q(e.trim());
|
|
8007
|
+
return t === null ? null : gp(t);
|
|
8008
|
+
}
|
|
8009
|
+
function gp(e) {
|
|
8010
|
+
if (Array.isArray(e)) {
|
|
8011
|
+
for (let t of e) {
|
|
8012
|
+
let e = gp(t);
|
|
8013
|
+
if (e) return e;
|
|
8014
|
+
}
|
|
8015
|
+
return null;
|
|
8016
|
+
}
|
|
8017
|
+
if (typeof e == "object" && e) {
|
|
8018
|
+
let t = e, { id: n, status: r } = t;
|
|
8019
|
+
if (typeof n == "string" && typeof r == "string" && /^[A-Z_]+$/.test(r)) return {
|
|
8020
|
+
id: n,
|
|
8021
|
+
status: r
|
|
8022
|
+
};
|
|
8023
|
+
for (let e of Object.values(t)) {
|
|
8024
|
+
let t = gp(e);
|
|
8025
|
+
if (t) return t;
|
|
8026
|
+
}
|
|
8027
|
+
}
|
|
8028
|
+
return null;
|
|
8029
|
+
}
|
|
8030
|
+
function _p(e) {
|
|
8031
|
+
let t = [];
|
|
8032
|
+
return vp(Q(e.trim()), t), t;
|
|
8033
|
+
}
|
|
8034
|
+
function vp(e, t) {
|
|
8035
|
+
if (Array.isArray(e)) {
|
|
8036
|
+
for (let n of e) vp(n, t);
|
|
8037
|
+
return;
|
|
8038
|
+
}
|
|
8039
|
+
if (typeof e == "object" && e) {
|
|
8040
|
+
let n = e;
|
|
8041
|
+
typeof n.message == "string" && n.message.length > 0 && t.push(n.message);
|
|
8042
|
+
for (let [e, r] of Object.entries(n)) e !== "message" && vp(r, t);
|
|
8043
|
+
}
|
|
8044
|
+
}
|
|
8045
|
+
async function yp(e, t) {
|
|
8046
|
+
let n = await wp(e), r = Date.now() + t.timeoutMs;
|
|
8047
|
+
for (;;) {
|
|
8048
|
+
let i = await e.runner.run({
|
|
8049
|
+
command: "railway",
|
|
8050
|
+
args: [
|
|
8051
|
+
"api",
|
|
8052
|
+
Of,
|
|
8053
|
+
"--variables",
|
|
8054
|
+
JSON.stringify({ input: {
|
|
8055
|
+
serviceId: t.serviceId,
|
|
8056
|
+
environmentId: n
|
|
8057
|
+
} }),
|
|
8058
|
+
"--compact"
|
|
8059
|
+
],
|
|
8060
|
+
cwd: e.cwd,
|
|
8061
|
+
allowFailure: !0,
|
|
8062
|
+
label: `check the ${t.name} deployment`
|
|
8063
|
+
});
|
|
8064
|
+
if (e.runner.dryRun) return {
|
|
8065
|
+
ok: !0,
|
|
8066
|
+
status: null
|
|
8067
|
+
};
|
|
8068
|
+
let a = i.exitCode === 0 ? hp(i.stdout) : null;
|
|
8069
|
+
if (!a) return {
|
|
8070
|
+
ok: !0,
|
|
8071
|
+
status: null,
|
|
8072
|
+
note: `could not read the deployment status of ${t.name}, so check it in the Railway dashboard`
|
|
8073
|
+
};
|
|
8074
|
+
if (Ef.has(a.status)) return {
|
|
8075
|
+
ok: !0,
|
|
8076
|
+
status: a.status,
|
|
8077
|
+
deploymentId: a.id
|
|
8078
|
+
};
|
|
8079
|
+
if (Df.has(a.status)) return {
|
|
8080
|
+
ok: !1,
|
|
8081
|
+
status: a.status,
|
|
8082
|
+
deploymentId: a.id
|
|
8083
|
+
};
|
|
8084
|
+
if (Date.now() >= r) return {
|
|
8085
|
+
ok: !1,
|
|
8086
|
+
status: a.status,
|
|
8087
|
+
deploymentId: a.id,
|
|
8088
|
+
note: `still ${a.status.toLowerCase()} after ${Math.round(t.timeoutMs / 6e4)} minutes`
|
|
8089
|
+
};
|
|
8090
|
+
e.log?.(`${t.name} is ${a.status.toLowerCase()}`), await bp(t.pollIntervalMs);
|
|
8091
|
+
}
|
|
8092
|
+
}
|
|
8093
|
+
function bp(e) {
|
|
8094
|
+
return new Promise((t) => setTimeout(t, e));
|
|
8095
|
+
}
|
|
8096
|
+
async function xp(e, t) {
|
|
8097
|
+
let n = t.status === "CRASHED" ? Af : kf, r = await e.runner.run({
|
|
8098
|
+
command: "railway",
|
|
8099
|
+
args: [
|
|
8100
|
+
"api",
|
|
8101
|
+
n,
|
|
8102
|
+
"--variables",
|
|
8103
|
+
JSON.stringify({
|
|
8104
|
+
deploymentId: t.id,
|
|
8105
|
+
limit: 50
|
|
8106
|
+
}),
|
|
8107
|
+
"--compact"
|
|
8108
|
+
],
|
|
8109
|
+
cwd: e.cwd,
|
|
8110
|
+
allowFailure: !0,
|
|
8111
|
+
label: "read the failed deployment's logs"
|
|
8112
|
+
});
|
|
8113
|
+
if (r.exitCode !== 0) return null;
|
|
8114
|
+
let i = _p(r.stdout);
|
|
8115
|
+
return i.length === 0 ? null : i.slice(-15).join("\n");
|
|
8116
|
+
}
|
|
8117
|
+
async function Sp(e, t) {
|
|
8118
|
+
let n = await wp(e), r = await e.runner.run({
|
|
7952
8119
|
command: "railway",
|
|
7953
8120
|
args: [
|
|
7954
8121
|
"api",
|
|
@@ -7966,15 +8133,15 @@ async function op(e, t) {
|
|
|
7966
8133
|
label: `set the start command on ${t.name}`
|
|
7967
8134
|
});
|
|
7968
8135
|
if (r.exitCode !== 0) {
|
|
7969
|
-
let e = r.stderr.trim() || r.stdout.trim(), n =
|
|
8136
|
+
let e = r.stderr.trim() || r.stdout.trim(), n = Lf.test(e) ? "Your Railway CLI is too old for `railway api`. Update it with `npm i -g @railway/cli` and run deploy again." : `Set the start command on ${t.name} from the Railway dashboard: ${t.command}`;
|
|
7970
8137
|
throw Error(`Could not set the start command on the Railway service "${t.name}":\n${e}\n${n}`);
|
|
7971
8138
|
}
|
|
7972
8139
|
}
|
|
7973
|
-
var
|
|
7974
|
-
async function
|
|
7975
|
-
let t =
|
|
8140
|
+
var Cp = /* @__PURE__ */ new WeakMap();
|
|
8141
|
+
async function wp(e) {
|
|
8142
|
+
let t = Cp.get(e);
|
|
7976
8143
|
if (t) return t;
|
|
7977
|
-
let n =
|
|
8144
|
+
let n = Tp((await e.runner.run({
|
|
7978
8145
|
command: "railway",
|
|
7979
8146
|
args: ["status", "--json"],
|
|
7980
8147
|
cwd: e.cwd,
|
|
@@ -7982,9 +8149,9 @@ async function cp(e) {
|
|
|
7982
8149
|
label: "read the linked railway environment"
|
|
7983
8150
|
})).stdout, e.plan.environment);
|
|
7984
8151
|
if (!n) throw Error(`Could not find the Railway environment "${e.plan.environment}" in the linked project. Run \`railway status\` to check what is linked.`);
|
|
7985
|
-
return
|
|
8152
|
+
return Cp.set(e, n), n;
|
|
7986
8153
|
}
|
|
7987
|
-
function
|
|
8154
|
+
function Tp(e, t) {
|
|
7988
8155
|
let n = Q(e.trim());
|
|
7989
8156
|
if (typeof n != "object" || !n) return null;
|
|
7990
8157
|
let r = n.environments, i = typeof r == "object" && r ? r.edges : void 0;
|
|
@@ -8003,7 +8170,7 @@ function lp(e, t) {
|
|
|
8003
8170
|
let o = a.find((e) => e.name === t);
|
|
8004
8171
|
return o ? o.id : a.length === 1 ? a[0].id : null;
|
|
8005
8172
|
}
|
|
8006
|
-
async function
|
|
8173
|
+
async function Ep(e, t) {
|
|
8007
8174
|
let n = await e.runner.run({
|
|
8008
8175
|
command: "railway",
|
|
8009
8176
|
args: [
|
|
@@ -8019,15 +8186,15 @@ async function up(e, t) {
|
|
|
8019
8186
|
allowFailure: !0,
|
|
8020
8187
|
label: `expose ${t.name} on a tcp proxy`
|
|
8021
8188
|
});
|
|
8022
|
-
n.exitCode !== 0 && !
|
|
8189
|
+
n.exitCode !== 0 && !If.test(n.stderr + n.stdout) && e.log?.(`Could not open a TCP proxy on ${t.name}, so it is only reachable from inside the Railway project: ${n.stderr.trim() || n.stdout.trim()}`);
|
|
8023
8190
|
}
|
|
8024
|
-
var
|
|
8191
|
+
var Dp = {
|
|
8025
8192
|
RUSTFS_ENDPOINT: "ENDPOINT",
|
|
8026
8193
|
RUSTFS_ACCESS_KEY: "ACCESS_KEY_ID",
|
|
8027
8194
|
RUSTFS_SECRET_KEY: "SECRET_ACCESS_KEY",
|
|
8028
8195
|
BUCKET_NAME: "BUCKET"
|
|
8029
8196
|
};
|
|
8030
|
-
async function
|
|
8197
|
+
async function Op(e, t) {
|
|
8031
8198
|
let { service: n, crossProvider: r } = t, i = n.name, a = await e.runner.run({
|
|
8032
8199
|
command: "railway",
|
|
8033
8200
|
args: [
|
|
@@ -8040,14 +8207,14 @@ async function fp(e, t) {
|
|
|
8040
8207
|
label: "list railway buckets"
|
|
8041
8208
|
});
|
|
8042
8209
|
if (a.exitCode !== 0) {
|
|
8043
|
-
if (!
|
|
8044
|
-
return e.log?.("This Railway CLI has no `bucket` command, so storage runs as a RustFS service instead"),
|
|
8210
|
+
if (!Lf.test(a.stderr + a.stdout)) throw Error(`Could not list the Railway buckets in this project:\n${a.stderr.trim()}`);
|
|
8211
|
+
return e.log?.("This Railway CLI has no `bucket` command, so storage runs as a RustFS service instead"), Pp(e, n);
|
|
8045
8212
|
}
|
|
8046
|
-
|
|
8047
|
-
let o = await
|
|
8213
|
+
jp(a.stdout).some((e) => e.name === i) || await kp(e, n);
|
|
8214
|
+
let o = await np(e, i) !== null;
|
|
8048
8215
|
if (!r && !o) {
|
|
8049
8216
|
let e = {};
|
|
8050
|
-
for (let [t, n] of Object.entries(
|
|
8217
|
+
for (let [t, n] of Object.entries(Dp)) e[t] = ip(i, n);
|
|
8051
8218
|
return {
|
|
8052
8219
|
outputs: e,
|
|
8053
8220
|
note: `wired as Railway references to the ${i} bucket`
|
|
@@ -8065,14 +8232,14 @@ async function fp(e, t) {
|
|
|
8065
8232
|
cwd: e.cwd,
|
|
8066
8233
|
allowFailure: !0,
|
|
8067
8234
|
label: `read the ${i} bucket credentials`
|
|
8068
|
-
}), c =
|
|
8235
|
+
}), c = Np(s.stdout);
|
|
8069
8236
|
if (!c) throw Error(`Could not read the credentials for the Railway bucket "${i}":\n${s.stderr.trim() || s.stdout.trim()}\nRun \`railway bucket credentials --bucket ${i}\` and set ${vd("services", "bucket", "external")} in ${X}.`);
|
|
8070
8237
|
return {
|
|
8071
8238
|
outputs: c,
|
|
8072
8239
|
note: o ? `set as values, because the service "${i}" shares the bucket's name. Delete it with \`railway service delete --service ${i}\` to switch to references` : "read from the bucket, since a Railway reference does not resolve off Railway"
|
|
8073
8240
|
};
|
|
8074
8241
|
}
|
|
8075
|
-
async function
|
|
8242
|
+
async function kp(e, t) {
|
|
8076
8243
|
let n = await e.runner.run({
|
|
8077
8244
|
command: "railway",
|
|
8078
8245
|
args: [
|
|
@@ -8080,20 +8247,20 @@ async function pp(e, t) {
|
|
|
8080
8247
|
"create",
|
|
8081
8248
|
t.name,
|
|
8082
8249
|
"--region",
|
|
8083
|
-
|
|
8250
|
+
Ap(t.region),
|
|
8084
8251
|
"--json"
|
|
8085
8252
|
],
|
|
8086
8253
|
cwd: e.cwd,
|
|
8087
8254
|
allowFailure: !0,
|
|
8088
8255
|
label: `create the ${t.name} bucket`
|
|
8089
8256
|
});
|
|
8090
|
-
if (n.exitCode !== 0 && !
|
|
8091
|
-
if (
|
|
8257
|
+
if (n.exitCode !== 0 && !If.test(n.stderr + n.stdout)) throw Error(`Could not create the Railway bucket "${t.name}":\n${n.stderr.trim()}`);
|
|
8258
|
+
if (Mp(n.stdout)) throw Error(`The Railway bucket "${t.name}" was created but staged rather than deployed, because the environment has uncommitted changes. Commit them in the Railway dashboard and run deploy again.`);
|
|
8092
8259
|
}
|
|
8093
|
-
function
|
|
8094
|
-
return e &&
|
|
8260
|
+
function Ap(e) {
|
|
8261
|
+
return e && jf.includes(e) ? e : Mf;
|
|
8095
8262
|
}
|
|
8096
|
-
function
|
|
8263
|
+
function jp(e) {
|
|
8097
8264
|
let t = Q(e.trim());
|
|
8098
8265
|
if (!Array.isArray(t)) return [];
|
|
8099
8266
|
let n = [];
|
|
@@ -8107,11 +8274,11 @@ function hp(e) {
|
|
|
8107
8274
|
}
|
|
8108
8275
|
return n;
|
|
8109
8276
|
}
|
|
8110
|
-
function
|
|
8277
|
+
function Mp(e) {
|
|
8111
8278
|
let t = Q(e.trim());
|
|
8112
8279
|
return typeof t != "object" || !t ? !1 : t.staged === !0;
|
|
8113
8280
|
}
|
|
8114
|
-
function
|
|
8281
|
+
function Np(e) {
|
|
8115
8282
|
let t = Q(e.trim());
|
|
8116
8283
|
if (typeof t != "object" || !t) return null;
|
|
8117
8284
|
let n = t, r = (e) => typeof n[e] == "string" ? n[e] : "", i = r("endpoint"), a = r("accessKeyId"), o = r("secretAccessKey");
|
|
@@ -8122,15 +8289,15 @@ function _p(e) {
|
|
|
8122
8289
|
BUCKET_NAME: r("bucketName")
|
|
8123
8290
|
};
|
|
8124
8291
|
}
|
|
8125
|
-
async function
|
|
8126
|
-
let n = t.name, r = await
|
|
8292
|
+
async function Pp(e, t) {
|
|
8293
|
+
let n = t.name, r = await np(e, n), i = r ? await Ip(e, n) : null, a = i?.accessKey ?? `hs${O(8).toString("hex")}`, o = i?.secretKey ?? O(24).toString("base64url"), s = r?.id;
|
|
8127
8294
|
if (!i) {
|
|
8128
8295
|
let t = await e.runner.run({
|
|
8129
8296
|
command: "railway",
|
|
8130
8297
|
args: [
|
|
8131
8298
|
"add",
|
|
8132
8299
|
"--image",
|
|
8133
|
-
|
|
8300
|
+
Nf,
|
|
8134
8301
|
"--service",
|
|
8135
8302
|
n,
|
|
8136
8303
|
"--variables",
|
|
@@ -8138,7 +8305,7 @@ async function vp(e, t) {
|
|
|
8138
8305
|
"--variables",
|
|
8139
8306
|
`RUSTFS_SECRET_KEY=${o}`,
|
|
8140
8307
|
"--variables",
|
|
8141
|
-
`RUSTFS_ADDRESS=:${
|
|
8308
|
+
`RUSTFS_ADDRESS=:${Pf}`,
|
|
8142
8309
|
"--json"
|
|
8143
8310
|
],
|
|
8144
8311
|
cwd: e.cwd,
|
|
@@ -8146,14 +8313,14 @@ async function vp(e, t) {
|
|
|
8146
8313
|
secrets: [o],
|
|
8147
8314
|
label: `create object storage service ${n}`
|
|
8148
8315
|
});
|
|
8149
|
-
if (t.exitCode !== 0) throw
|
|
8150
|
-
s =
|
|
8316
|
+
if (t.exitCode !== 0) throw If.test(t.stderr + t.stdout) ? Error(`The Railway storage service "${n}" already exists, but its access keys could not be read back. Copy them from the dashboard into ${vd("services", "bucket", "external")} in ${X}.`) : Error(`Could not create the Railway storage service "${n}":\n${t.stderr.trim()}`);
|
|
8317
|
+
s = Hf(t.stdout)?.id ?? s;
|
|
8151
8318
|
}
|
|
8152
8319
|
if (!s) throw Error(`Could not find the id of the Railway storage service "${n}", which is what \`railway volume\` needs to mount a volume on it. Run \`railway service list --json\` to check the project, or set ${vd("services", "bucket", "external")} in ${X} to use storage you run yourself.`);
|
|
8153
|
-
await
|
|
8320
|
+
await Fp(e, {
|
|
8154
8321
|
name: n,
|
|
8155
8322
|
serviceId: s,
|
|
8156
|
-
mountPath:
|
|
8323
|
+
mountPath: Ff,
|
|
8157
8324
|
consequence: "anything uploaded to it would be lost on the next restart"
|
|
8158
8325
|
});
|
|
8159
8326
|
let c = await e.runner.run({
|
|
@@ -8163,14 +8330,14 @@ async function vp(e, t) {
|
|
|
8163
8330
|
"--service",
|
|
8164
8331
|
n,
|
|
8165
8332
|
"--port",
|
|
8166
|
-
String(
|
|
8333
|
+
String(Pf),
|
|
8167
8334
|
"--json"
|
|
8168
8335
|
],
|
|
8169
8336
|
cwd: e.cwd,
|
|
8170
8337
|
allowFailure: !0,
|
|
8171
8338
|
label: `expose ${n}`
|
|
8172
|
-
}), l =
|
|
8173
|
-
if (!l) throw Error(`Could not get a public endpoint for the Railway storage service "${n}". Run \`railway domain --service ${n} --port ${
|
|
8339
|
+
}), l = Rf(c.stdout + c.stderr);
|
|
8340
|
+
if (!l) throw Error(`Could not get a public endpoint for the Railway storage service "${n}". Run \`railway domain --service ${n} --port ${Pf}\` and set ${vd("services", "bucket", "external")} in ${X}.`);
|
|
8174
8341
|
return {
|
|
8175
8342
|
outputs: {
|
|
8176
8343
|
RUSTFS_ENDPOINT: l,
|
|
@@ -8178,10 +8345,10 @@ async function vp(e, t) {
|
|
|
8178
8345
|
RUSTFS_SECRET_KEY: o,
|
|
8179
8346
|
BUCKET_NAME: n
|
|
8180
8347
|
},
|
|
8181
|
-
note: i ? "reusing the existing RustFS service and its keys" : `RustFS on Railway, with a volume mounted at ${
|
|
8348
|
+
note: i ? "reusing the existing RustFS service and its keys" : `RustFS on Railway, with a volume mounted at ${Ff}`
|
|
8182
8349
|
};
|
|
8183
8350
|
}
|
|
8184
|
-
async function
|
|
8351
|
+
async function Fp(e, t) {
|
|
8185
8352
|
let n = await e.runner.run({
|
|
8186
8353
|
command: "railway",
|
|
8187
8354
|
args: [
|
|
@@ -8197,10 +8364,10 @@ async function yp(e, t) {
|
|
|
8197
8364
|
allowFailure: !0,
|
|
8198
8365
|
label: `attach a volume to ${t.name}`
|
|
8199
8366
|
});
|
|
8200
|
-
if (n.exitCode !== 0 && !
|
|
8367
|
+
if (n.exitCode !== 0 && !If.test(n.stderr + n.stdout)) throw Error(`The Railway service "${t.name}" has no persistent volume at ${t.mountPath}, so ${t.consequence}:\n${n.stderr.trim() || n.stdout.trim()}`);
|
|
8201
8368
|
}
|
|
8202
|
-
async function
|
|
8203
|
-
let n = await
|
|
8369
|
+
async function Ip(e, t) {
|
|
8370
|
+
let n = await op(e, t), r = n.RUSTFS_ACCESS_KEY, i = n.RUSTFS_SECRET_KEY;
|
|
8204
8371
|
return r && i ? {
|
|
8205
8372
|
accessKey: r,
|
|
8206
8373
|
secretKey: i
|
|
@@ -8208,41 +8375,41 @@ async function bp(e, t) {
|
|
|
8208
8375
|
}
|
|
8209
8376
|
//#endregion
|
|
8210
8377
|
//#region src/deploy/providers/index.ts
|
|
8211
|
-
var
|
|
8212
|
-
railway:
|
|
8378
|
+
var Lp = {
|
|
8379
|
+
railway: Wf,
|
|
8213
8380
|
fly: Qd
|
|
8214
8381
|
};
|
|
8215
|
-
function
|
|
8216
|
-
return
|
|
8382
|
+
function Rp(e) {
|
|
8383
|
+
return Lp[e];
|
|
8217
8384
|
}
|
|
8218
8385
|
//#endregion
|
|
8219
8386
|
//#region src/deploy/auth.ts
|
|
8220
|
-
function
|
|
8387
|
+
function zp() {
|
|
8221
8388
|
return {
|
|
8222
8389
|
createRunner: (e) => hf({ env: e }),
|
|
8223
8390
|
runInteractive: async (e, t, n) => (await ni(e, t, { cwd: n })).exitCode,
|
|
8224
|
-
confirmInstall:
|
|
8225
|
-
chooseMethod:
|
|
8226
|
-
readToken:
|
|
8227
|
-
chooseScope:
|
|
8391
|
+
confirmInstall: Xp,
|
|
8392
|
+
chooseMethod: Zp,
|
|
8393
|
+
readToken: $p,
|
|
8394
|
+
chooseScope: Qp
|
|
8228
8395
|
};
|
|
8229
8396
|
}
|
|
8230
|
-
async function
|
|
8231
|
-
let t = e.io ??
|
|
8397
|
+
async function Bp(e) {
|
|
8398
|
+
let t = e.io ?? zp(), n = {}, r = {};
|
|
8232
8399
|
for (let i of e.providers) {
|
|
8233
|
-
let a = Td[i], o = e.adapters?.[i] ??
|
|
8400
|
+
let a = Td[i], o = e.adapters?.[i] ?? Rp(i), s = {
|
|
8234
8401
|
io: t,
|
|
8235
8402
|
spec: a,
|
|
8236
8403
|
plan: e.plan,
|
|
8237
8404
|
skipPrompts: e.skipPrompts,
|
|
8238
8405
|
env: r
|
|
8239
8406
|
};
|
|
8240
|
-
await
|
|
8241
|
-
let c = await
|
|
8407
|
+
await Vp(s);
|
|
8408
|
+
let c = await Gp({
|
|
8242
8409
|
...s,
|
|
8243
8410
|
adapter: o
|
|
8244
8411
|
});
|
|
8245
|
-
r = c.env, c.account && (n[i] = c.account), await
|
|
8412
|
+
r = c.env, c.account && (n[i] = c.account), await Kp({
|
|
8246
8413
|
...s,
|
|
8247
8414
|
env: r,
|
|
8248
8415
|
adapter: o
|
|
@@ -8253,16 +8420,16 @@ async function wp(e) {
|
|
|
8253
8420
|
accounts: n
|
|
8254
8421
|
};
|
|
8255
8422
|
}
|
|
8256
|
-
async function
|
|
8423
|
+
async function Vp(e) {
|
|
8257
8424
|
let { io: t, spec: n, plan: r, skipPrompts: i } = e;
|
|
8258
|
-
if (await
|
|
8425
|
+
if (await Hp(e)) return;
|
|
8259
8426
|
let a = `The ${n.label} CLI is not on your PATH. Install it with ${F.command(n.install)} and run deploy again. ${I(n.docs)}`;
|
|
8260
|
-
(i || !
|
|
8427
|
+
(i || !Up()) && z(a, { reason: "input_required" }), rt({
|
|
8261
8428
|
reason: "input_required",
|
|
8262
8429
|
message: a
|
|
8263
|
-
}), await t.confirmInstall(n) || z(a, { reason: "input_required" }), await t.runInteractive("sh", ["-c", n.install], r.projectRoot), await
|
|
8430
|
+
}), await t.confirmInstall(n) || z(a, { reason: "input_required" }), await t.runInteractive("sh", ["-c", n.install], r.projectRoot), await Hp(e) || z(`That did not put ${F.command(n.bin)} on your PATH. ${a}`, { reason: "input_required" });
|
|
8264
8431
|
}
|
|
8265
|
-
async function
|
|
8432
|
+
async function Hp(e) {
|
|
8266
8433
|
let t = await e.io.createRunner(e.env).run({
|
|
8267
8434
|
command: e.spec.bin,
|
|
8268
8435
|
args: ["--version"],
|
|
@@ -8271,11 +8438,11 @@ async function Ep(e) {
|
|
|
8271
8438
|
}).catch(() => null);
|
|
8272
8439
|
return t !== null && t.exitCode === 0;
|
|
8273
8440
|
}
|
|
8274
|
-
function
|
|
8441
|
+
function Up() {
|
|
8275
8442
|
return process.platform !== "win32";
|
|
8276
8443
|
}
|
|
8277
|
-
var
|
|
8278
|
-
async function
|
|
8444
|
+
var Wp = 3;
|
|
8445
|
+
async function Gp(e) {
|
|
8279
8446
|
let { io: t, spec: n, plan: r, skipPrompts: i, adapter: a } = e, o = { ...e.env }, s = 0;
|
|
8280
8447
|
for (;;) {
|
|
8281
8448
|
let e = {
|
|
@@ -8287,26 +8454,26 @@ async function kp(e) {
|
|
|
8287
8454
|
account: c.account,
|
|
8288
8455
|
env: o
|
|
8289
8456
|
};
|
|
8290
|
-
let l =
|
|
8457
|
+
let l = qp(n, o);
|
|
8291
8458
|
if (l) {
|
|
8292
8459
|
Object.assign(o, l);
|
|
8293
8460
|
continue;
|
|
8294
8461
|
}
|
|
8295
|
-
i && z(
|
|
8462
|
+
i && z(Yp(n), { reason: "auth_required" }), rt({
|
|
8296
8463
|
reason: "auth_required",
|
|
8297
|
-
message:
|
|
8298
|
-
}), s >=
|
|
8464
|
+
message: Yp(n)
|
|
8465
|
+
}), s >= Wp && z(`${n.label} still does not know who you are. ${Yp(n)}`, { reason: "auth_required" }), s += 1;
|
|
8299
8466
|
let u = await t.chooseMethod(n);
|
|
8300
8467
|
if (u === "token") {
|
|
8301
8468
|
let e = await t.readToken(n);
|
|
8302
|
-
Object.assign(o,
|
|
8469
|
+
Object.assign(o, Jp(n.conflictingTokenEnv), { [n.tokenEnv]: e });
|
|
8303
8470
|
continue;
|
|
8304
8471
|
}
|
|
8305
8472
|
let d = u === "browserless" ? n.browserlessLoginArgs ?? n.loginArgs : n.loginArgs;
|
|
8306
8473
|
await t.runInteractive(n.bin, d, r.projectRoot);
|
|
8307
8474
|
}
|
|
8308
8475
|
}
|
|
8309
|
-
async function
|
|
8476
|
+
async function Kp(e) {
|
|
8310
8477
|
let { io: t, spec: n, plan: r, skipPrompts: i, env: a, adapter: o } = e, { scope: s } = o;
|
|
8311
8478
|
if (!s || s.current(r)) return;
|
|
8312
8479
|
let c = await s.list({
|
|
@@ -8324,27 +8491,27 @@ async function Ap(e) {
|
|
|
8324
8491
|
message: l
|
|
8325
8492
|
}), s.pin(r, await t.chooseScope(n, s, c));
|
|
8326
8493
|
}
|
|
8327
|
-
function
|
|
8494
|
+
function qp(e, t) {
|
|
8328
8495
|
let n = (e.conflictingTokenEnv ?? []).filter((e) => !(e in t) && process.env[e] !== void 0);
|
|
8329
8496
|
if (n.length === 0) return null;
|
|
8330
8497
|
for (let t of n) _t(`${F.label(t)} is set in your shell, but it cannot create a ${e.label} project. Ignoring it for this run.`);
|
|
8331
|
-
return
|
|
8498
|
+
return Jp(n);
|
|
8332
8499
|
}
|
|
8333
|
-
function
|
|
8500
|
+
function Jp(e = []) {
|
|
8334
8501
|
return Object.fromEntries(e.map((e) => [e, void 0]));
|
|
8335
8502
|
}
|
|
8336
|
-
function
|
|
8503
|
+
function Yp(e) {
|
|
8337
8504
|
let t = F.command(`${e.bin} ${e.loginArgs.join(" ")}`);
|
|
8338
8505
|
return `Not signed in to ${e.label}. Run ${t}, or set ${F.label(e.tokenEnv)} to a token from ${I(e.tokenUrl)}.`;
|
|
8339
8506
|
}
|
|
8340
|
-
async function
|
|
8507
|
+
async function Xp(e) {
|
|
8341
8508
|
let t = await c.confirm({
|
|
8342
8509
|
message: `Deploying needs the ${F.highlight(e.label)} CLI. Install it with ${F.command(e.install)}?`,
|
|
8343
8510
|
initialValue: !0
|
|
8344
8511
|
});
|
|
8345
8512
|
return c.isCancel(t) && B(), t;
|
|
8346
8513
|
}
|
|
8347
|
-
async function
|
|
8514
|
+
async function Zp(e) {
|
|
8348
8515
|
let t = [{
|
|
8349
8516
|
value: "browser",
|
|
8350
8517
|
label: "Log in through the browser",
|
|
@@ -8366,7 +8533,7 @@ async function Fp(e) {
|
|
|
8366
8533
|
});
|
|
8367
8534
|
return c.isCancel(n) && B(), n;
|
|
8368
8535
|
}
|
|
8369
|
-
async function
|
|
8536
|
+
async function Qp(e, t, n) {
|
|
8370
8537
|
let r = await c.select({
|
|
8371
8538
|
message: `Which ${F.highlight(e.label)} ${t.label} should this project live in?`,
|
|
8372
8539
|
options: n.map((e) => ({
|
|
@@ -8377,7 +8544,7 @@ async function Ip(e, t, n) {
|
|
|
8377
8544
|
});
|
|
8378
8545
|
return c.isCancel(r) && B(), r;
|
|
8379
8546
|
}
|
|
8380
|
-
async function
|
|
8547
|
+
async function $p(e) {
|
|
8381
8548
|
c.log.info(`Create one at ${I(e.tokenUrl)}. Give it the workspace this project should live in, not a single project.`);
|
|
8382
8549
|
let t = await c.password({
|
|
8383
8550
|
message: `Paste your ${e.label} token`,
|
|
@@ -8387,59 +8554,59 @@ async function Lp(e) {
|
|
|
8387
8554
|
}
|
|
8388
8555
|
//#endregion
|
|
8389
8556
|
//#region src/deploy/config.ts
|
|
8390
|
-
var
|
|
8391
|
-
provider:
|
|
8557
|
+
var em = j.enum(Sd), tm = j.object({
|
|
8558
|
+
provider: em,
|
|
8392
8559
|
app: j.string().min(1).optional(),
|
|
8393
8560
|
region: j.string().min(1).optional(),
|
|
8394
8561
|
url: j.string().url().optional()
|
|
8395
|
-
}),
|
|
8396
|
-
provider:
|
|
8562
|
+
}), nm = j.object({
|
|
8563
|
+
provider: em,
|
|
8397
8564
|
name: j.string().min(1).optional(),
|
|
8398
8565
|
region: j.string().min(1).optional(),
|
|
8399
8566
|
external: j.record(j.string(), j.string()).optional()
|
|
8400
|
-
}),
|
|
8567
|
+
}), rm = j.object({
|
|
8401
8568
|
org: j.string().min(1).optional(),
|
|
8402
8569
|
postgresPlan: j.string().min(1).optional()
|
|
8403
|
-
}),
|
|
8570
|
+
}), im = j.object({ workspace: j.string().min(1).optional() }), am = j.object({
|
|
8404
8571
|
version: j.number().int().positive(),
|
|
8405
8572
|
projectName: j.string().min(1),
|
|
8406
8573
|
environment: j.string().min(1),
|
|
8407
|
-
defaultProvider:
|
|
8574
|
+
defaultProvider: em.optional(),
|
|
8408
8575
|
targets: j.object({
|
|
8409
|
-
backend:
|
|
8410
|
-
frontend:
|
|
8411
|
-
admin:
|
|
8576
|
+
backend: tm.optional(),
|
|
8577
|
+
frontend: tm.optional(),
|
|
8578
|
+
admin: tm.optional()
|
|
8412
8579
|
}).default({}),
|
|
8413
8580
|
services: j.object({
|
|
8414
|
-
postgres:
|
|
8415
|
-
valkey:
|
|
8416
|
-
bucket:
|
|
8581
|
+
postgres: nm.optional(),
|
|
8582
|
+
valkey: nm.optional(),
|
|
8583
|
+
bucket: nm.optional()
|
|
8417
8584
|
}).default({}),
|
|
8418
|
-
fly:
|
|
8419
|
-
railway:
|
|
8585
|
+
fly: rm.optional(),
|
|
8586
|
+
railway: im.optional()
|
|
8420
8587
|
});
|
|
8421
|
-
async function
|
|
8588
|
+
async function om(e) {
|
|
8422
8589
|
let t = await q(e).catch((e) => {
|
|
8423
8590
|
throw Error(`Could not read ${X}: ${e instanceof Error ? e.message : String(e)}. Fix it, then run deploy again.`);
|
|
8424
8591
|
});
|
|
8425
8592
|
if (!t) throw Error(`No ${X} in this project, so there is nothing to deploy. Run "hype-stack init" to create one, or deploy from the root of a project made with "hype-stack create".`);
|
|
8426
8593
|
return t;
|
|
8427
8594
|
}
|
|
8428
|
-
async function
|
|
8429
|
-
let t = (await
|
|
8595
|
+
async function sm(e) {
|
|
8596
|
+
let t = (await om(e))[_d];
|
|
8430
8597
|
if (t === void 0) return null;
|
|
8431
|
-
let n =
|
|
8598
|
+
let n = am.safeParse(t);
|
|
8432
8599
|
if (!n.success) throw Error(`Invalid "${_d}" block in ${X}:\n ${j.prettifyError(n.error)}`);
|
|
8433
8600
|
if (n.data.version > 1) throw Error(`The "${_d}" block in ${X} was written by a newer CLI (version ${n.data.version}, this CLI understands 1). Upgrade with "npm i -g @hype-stack/cli".`);
|
|
8434
8601
|
return n.data;
|
|
8435
8602
|
}
|
|
8436
|
-
async function
|
|
8603
|
+
async function cm(e, t) {
|
|
8437
8604
|
await Vi(e, {
|
|
8438
|
-
...await
|
|
8439
|
-
[_d]:
|
|
8605
|
+
...await om(e),
|
|
8606
|
+
[_d]: um(t)
|
|
8440
8607
|
});
|
|
8441
8608
|
}
|
|
8442
|
-
function
|
|
8609
|
+
function lm(e, t = yd) {
|
|
8443
8610
|
return {
|
|
8444
8611
|
version: 1,
|
|
8445
8612
|
projectName: e,
|
|
@@ -8448,7 +8615,7 @@ function qp(e, t = yd) {
|
|
|
8448
8615
|
services: {}
|
|
8449
8616
|
};
|
|
8450
8617
|
}
|
|
8451
|
-
function
|
|
8618
|
+
function um(e) {
|
|
8452
8619
|
let t = {
|
|
8453
8620
|
version: e.version,
|
|
8454
8621
|
projectName: e.projectName,
|
|
@@ -8478,7 +8645,7 @@ function Jp(e) {
|
|
|
8478
8645
|
}
|
|
8479
8646
|
//#endregion
|
|
8480
8647
|
//#region src/deploy/detect.ts
|
|
8481
|
-
var
|
|
8648
|
+
var dm = [
|
|
8482
8649
|
"@hono/node-server",
|
|
8483
8650
|
"@tanstack/react-start",
|
|
8484
8651
|
"@tanstack/start",
|
|
@@ -8486,32 +8653,32 @@ var Yp = [
|
|
|
8486
8653
|
"express",
|
|
8487
8654
|
"fastify"
|
|
8488
8655
|
];
|
|
8489
|
-
function
|
|
8656
|
+
function fm(e, t, n) {
|
|
8490
8657
|
let r = Cd[t], i = n?.paths?.[r.pathKey]?.root, a = n?.apps?.[t];
|
|
8491
8658
|
return T.resolve(e, i ?? a ?? r.defaultRoot);
|
|
8492
8659
|
}
|
|
8493
|
-
async function
|
|
8660
|
+
async function pm(e, t) {
|
|
8494
8661
|
return (await Promise.all(bd.map(async (n) => {
|
|
8495
|
-
let r =
|
|
8662
|
+
let r = fm(e, n, t);
|
|
8496
8663
|
return await G(T.join(r, "package.json")) ? n : null;
|
|
8497
8664
|
}))).filter((e) => e !== null);
|
|
8498
8665
|
}
|
|
8499
|
-
var
|
|
8500
|
-
async function
|
|
8666
|
+
var mm = ["build:web", "build"];
|
|
8667
|
+
async function hm(e, t) {
|
|
8501
8668
|
let [n, r] = await Promise.all([G(T.join(e, "Dockerfile")), oi(T.join(e, "package.json")).catch(() => null)]);
|
|
8502
8669
|
if (n) return "node";
|
|
8503
8670
|
if (Cd[t].serveMode === "node") return null;
|
|
8504
8671
|
let i = r?.scripts ?? {}, a = {
|
|
8505
8672
|
...r?.dependencies,
|
|
8506
8673
|
...r?.devDependencies
|
|
8507
|
-
}, o =
|
|
8674
|
+
}, o = mm.some((e) => i[e] !== void 0), s = dm.some((e) => a[e] !== void 0);
|
|
8508
8675
|
return o || !s ? "static" : null;
|
|
8509
8676
|
}
|
|
8510
|
-
async function
|
|
8511
|
-
let r = await Promise.all(t.map(async (t) => [t, await
|
|
8677
|
+
async function gm(e, t, n) {
|
|
8678
|
+
let r = await Promise.all(t.map(async (t) => [t, await hm(fm(e, t, n), t)]));
|
|
8512
8679
|
return Object.fromEntries(r);
|
|
8513
8680
|
}
|
|
8514
|
-
function
|
|
8681
|
+
function _m(e) {
|
|
8515
8682
|
let t = {};
|
|
8516
8683
|
for (let n of bd) {
|
|
8517
8684
|
let r = e[n];
|
|
@@ -8519,7 +8686,7 @@ function tm(e) {
|
|
|
8519
8686
|
}
|
|
8520
8687
|
return t;
|
|
8521
8688
|
}
|
|
8522
|
-
async function
|
|
8689
|
+
async function vm(e, t) {
|
|
8523
8690
|
let n = Cd[t].staticDir ?? "dist", r = [
|
|
8524
8691
|
n,
|
|
8525
8692
|
"dist",
|
|
@@ -8532,11 +8699,11 @@ async function nm(e, t) {
|
|
|
8532
8699
|
//#endregion
|
|
8533
8700
|
//#region src/deploy/dry-run.ts
|
|
8534
8701
|
var $ = "dry-run-placeholder";
|
|
8535
|
-
function
|
|
8702
|
+
function ym(e, t) {
|
|
8536
8703
|
let n = e.args.indexOf(t);
|
|
8537
8704
|
return n === -1 ? "app" : e.args[n + 1] ?? "app";
|
|
8538
8705
|
}
|
|
8539
|
-
var
|
|
8706
|
+
var bm = "dryrun00cluster", xm = "dryrun00service", Sm = [
|
|
8540
8707
|
{
|
|
8541
8708
|
match: "fly orgs list",
|
|
8542
8709
|
stdout: JSON.stringify([{
|
|
@@ -8554,13 +8721,13 @@ var im = "dryrun00cluster", am = "dryrun00service", om = [
|
|
|
8554
8721
|
},
|
|
8555
8722
|
{
|
|
8556
8723
|
match: "fly mpg create",
|
|
8557
|
-
stdout: `Managed Postgres cluster created successfully!\n ID: ${
|
|
8724
|
+
stdout: `Managed Postgres cluster created successfully!\n ID: ${bm}\n Connection string: postgres://hype:${$}@example.flympg.net:5432/postgres`
|
|
8558
8725
|
},
|
|
8559
8726
|
{
|
|
8560
8727
|
match: "fly mpg status",
|
|
8561
8728
|
stdout: JSON.stringify({
|
|
8562
8729
|
data: {
|
|
8563
|
-
id:
|
|
8730
|
+
id: bm,
|
|
8564
8731
|
status: "ready"
|
|
8565
8732
|
},
|
|
8566
8733
|
credentials: { pgbouncer_uri: `postgres://hype:${$}@example.flympg.net:5432/postgres` }
|
|
@@ -8577,7 +8744,7 @@ var im = "dryrun00cluster", am = "dryrun00service", om = [
|
|
|
8577
8744
|
{
|
|
8578
8745
|
match: "fly storage create",
|
|
8579
8746
|
stdout: (e) => [
|
|
8580
|
-
`BUCKET_NAME: ${
|
|
8747
|
+
`BUCKET_NAME: ${ym(e, "--name")}`,
|
|
8581
8748
|
"AWS_ENDPOINT_URL_S3: https://fly.storage.tigris.dev",
|
|
8582
8749
|
`AWS_ACCESS_KEY_ID: ${$}`,
|
|
8583
8750
|
`AWS_SECRET_ACCESS_KEY: ${$}`
|
|
@@ -8598,8 +8765,8 @@ var im = "dryrun00cluster", am = "dryrun00service", om = [
|
|
|
8598
8765
|
{
|
|
8599
8766
|
match: "railway add",
|
|
8600
8767
|
stdout: (e) => JSON.stringify({
|
|
8601
|
-
id:
|
|
8602
|
-
name:
|
|
8768
|
+
id: xm,
|
|
8769
|
+
name: ym(e, "--service")
|
|
8603
8770
|
})
|
|
8604
8771
|
},
|
|
8605
8772
|
{
|
|
@@ -8614,7 +8781,7 @@ var im = "dryrun00cluster", am = "dryrun00service", om = [
|
|
|
8614
8781
|
},
|
|
8615
8782
|
{
|
|
8616
8783
|
match: "railway domain",
|
|
8617
|
-
stdout: (e) => JSON.stringify({ domain: `${
|
|
8784
|
+
stdout: (e) => JSON.stringify({ domain: `${ym(e, "--service")}-production.up.railway.app` })
|
|
8618
8785
|
},
|
|
8619
8786
|
{
|
|
8620
8787
|
match: "railway variable list",
|
|
@@ -8633,7 +8800,7 @@ var im = "dryrun00cluster", am = "dryrun00service", om = [
|
|
|
8633
8800
|
stdout: (e) => JSON.stringify({
|
|
8634
8801
|
id: "dryrun00bucket",
|
|
8635
8802
|
name: e.args[2] ?? "bucket",
|
|
8636
|
-
region:
|
|
8803
|
+
region: ym(e, "--region"),
|
|
8637
8804
|
staged: !1,
|
|
8638
8805
|
committed: !0
|
|
8639
8806
|
})
|
|
@@ -8653,7 +8820,7 @@ var im = "dryrun00cluster", am = "dryrun00service", om = [
|
|
|
8653
8820
|
match: "railway api",
|
|
8654
8821
|
stdout: JSON.stringify({ data: { serviceInstanceUpdate: !0 } })
|
|
8655
8822
|
}
|
|
8656
|
-
],
|
|
8823
|
+
], Cm = {
|
|
8657
8824
|
backend: [
|
|
8658
8825
|
"NODE_ENV",
|
|
8659
8826
|
"APP_ENV",
|
|
@@ -8681,30 +8848,30 @@ var im = "dryrun00cluster", am = "dryrun00service", om = [
|
|
|
8681
8848
|
"VITE_APP_TYPE",
|
|
8682
8849
|
"VITE_ENVIRONMENT"
|
|
8683
8850
|
]
|
|
8684
|
-
},
|
|
8851
|
+
}, wm = new Set([
|
|
8685
8852
|
"VITE_SENTRY_AUTH_TOKEN",
|
|
8686
8853
|
"POSTGRES_USER",
|
|
8687
8854
|
"POSTGRES_PASSWORD",
|
|
8688
8855
|
"POSTGRES_DB",
|
|
8689
8856
|
"POSTGRES_HOST",
|
|
8690
8857
|
"POSTGRES_PORT"
|
|
8691
|
-
]),
|
|
8692
|
-
function
|
|
8858
|
+
]), Tm = /(?:^|\/\/|@)(?:localhost|127\.0\.0\.1|0\.0\.0\.0|host\.docker\.internal)(?::\d+)?(?:\/|$)/i;
|
|
8859
|
+
function Em(e) {
|
|
8693
8860
|
let { plan: t, serviceOutputs: n, urls: r, localEnv: i = {}, declaredKeys: a = {}, exampleEnv: o = {}, externallyProvided: s = {} } = e;
|
|
8694
8861
|
return t.targets.map((e) => {
|
|
8695
|
-
let c =
|
|
8862
|
+
let c = Dm(e, t, r), l = Nm({
|
|
8696
8863
|
target: e.target,
|
|
8697
8864
|
environment: t.environment,
|
|
8698
8865
|
port: e.spec.port,
|
|
8699
8866
|
serviceOutputs: n,
|
|
8700
8867
|
urls: c
|
|
8701
|
-
}), u = a[e.target] ?? [], d = i[e.target] ?? {}, f = c[e.target], { forwarded: p, rehosted: m, skippedLocal: h } =
|
|
8868
|
+
}), u = a[e.target] ?? [], d = i[e.target] ?? {}, f = c[e.target], { forwarded: p, rehosted: m, skippedLocal: h } = Fm({
|
|
8702
8869
|
declared: u,
|
|
8703
8870
|
local: d,
|
|
8704
8871
|
managed: l,
|
|
8705
8872
|
origin: f,
|
|
8706
8873
|
target: e.target
|
|
8707
|
-
}), g = new Set(s[e.target] ?? []), _ = u.filter((e) => l[e] === void 0 && p[e] === void 0 && !
|
|
8874
|
+
}), g = new Set(s[e.target] ?? []), _ = u.filter((e) => l[e] === void 0 && p[e] === void 0 && !wm.has(e) && !g.has(e)), { seeded: v, seededRehosted: y } = Om({
|
|
8708
8875
|
keys: _,
|
|
8709
8876
|
example: o[e.target] ?? {},
|
|
8710
8877
|
origin: f
|
|
@@ -8720,21 +8887,21 @@ function um(e) {
|
|
|
8720
8887
|
};
|
|
8721
8888
|
});
|
|
8722
8889
|
}
|
|
8723
|
-
function
|
|
8890
|
+
function Dm(e, t, n) {
|
|
8724
8891
|
let r = e.provider === "railway" && e.spec.serveMode !== "static", i = {};
|
|
8725
|
-
for (let e of t.targets) i[e.target] = r && e.provider === "railway" ?
|
|
8892
|
+
for (let e of t.targets) i[e.target] = r && e.provider === "railway" ? ap(e.app) : n[e.target];
|
|
8726
8893
|
return i;
|
|
8727
8894
|
}
|
|
8728
|
-
function
|
|
8895
|
+
function Om(e) {
|
|
8729
8896
|
let t = {}, n = [];
|
|
8730
8897
|
for (let r of e.keys) {
|
|
8731
8898
|
let i = e.example[r];
|
|
8732
8899
|
if (i === void 0 || i.trim() === "" || i.includes("${")) continue;
|
|
8733
|
-
if (!
|
|
8900
|
+
if (!Tm.test(i)) {
|
|
8734
8901
|
t[r] = i;
|
|
8735
8902
|
continue;
|
|
8736
8903
|
}
|
|
8737
|
-
let a =
|
|
8904
|
+
let a = km(i, e.origin);
|
|
8738
8905
|
a && (t[r] = a, n.push(r));
|
|
8739
8906
|
}
|
|
8740
8907
|
return {
|
|
@@ -8742,7 +8909,7 @@ function fm(e) {
|
|
|
8742
8909
|
seededRehosted: n
|
|
8743
8910
|
};
|
|
8744
8911
|
}
|
|
8745
|
-
function
|
|
8912
|
+
function km(e, t) {
|
|
8746
8913
|
if (!t) return null;
|
|
8747
8914
|
let n;
|
|
8748
8915
|
try {
|
|
@@ -8752,13 +8919,13 @@ function pm(e, t) {
|
|
|
8752
8919
|
}
|
|
8753
8920
|
return /^https?:$/.test(n.protocol) ? `${t.replace(/\/+$/, "")}${n.pathname === "/" && !e.trimEnd().endsWith("/") ? "" : n.pathname}${n.search}${n.hash}` : null;
|
|
8754
8921
|
}
|
|
8755
|
-
var
|
|
8756
|
-
function
|
|
8922
|
+
var Am = "(pending)", jm = "https://pending.invalid";
|
|
8923
|
+
function Mm(e) {
|
|
8757
8924
|
let { plan: t, localEnv: n, declaredKeys: r, exampleEnv: i } = e, a = {};
|
|
8758
|
-
for (let e of t.targets) a[e.target] = e.url ??
|
|
8925
|
+
for (let e of t.targets) a[e.target] = e.url ?? jm;
|
|
8759
8926
|
let o = {};
|
|
8760
|
-
for (let e of t.services) o[e.service] = e.external ?? Object.fromEntries(e.spec.provides.map((e) => [e,
|
|
8761
|
-
return
|
|
8927
|
+
for (let e of t.services) o[e.service] = e.external ?? Object.fromEntries(e.spec.provides.map((e) => [e, Am]));
|
|
8928
|
+
return Em({
|
|
8762
8929
|
plan: t,
|
|
8763
8930
|
serviceOutputs: o,
|
|
8764
8931
|
urls: a,
|
|
@@ -8767,14 +8934,14 @@ function gm(e) {
|
|
|
8767
8934
|
exampleEnv: i
|
|
8768
8935
|
});
|
|
8769
8936
|
}
|
|
8770
|
-
function
|
|
8937
|
+
function Nm(e) {
|
|
8771
8938
|
let { target: t, environment: n, port: r, serviceOutputs: i, urls: a } = e;
|
|
8772
|
-
return t === "backend" ?
|
|
8939
|
+
return t === "backend" ? Pm({
|
|
8773
8940
|
environment: n,
|
|
8774
8941
|
port: r,
|
|
8775
8942
|
serviceOutputs: i,
|
|
8776
8943
|
urls: a
|
|
8777
|
-
}) :
|
|
8944
|
+
}) : Lm(t === "frontend" ? {
|
|
8778
8945
|
VITE_API_BASE_URL: a.backend,
|
|
8779
8946
|
VITE_ADMIN_URL: a.admin,
|
|
8780
8947
|
VITE_PUBLIC_SITE_URL: a.frontend,
|
|
@@ -8786,9 +8953,9 @@ function _m(e) {
|
|
|
8786
8953
|
VITE_ENVIRONMENT: n
|
|
8787
8954
|
});
|
|
8788
8955
|
}
|
|
8789
|
-
function
|
|
8956
|
+
function Pm(e) {
|
|
8790
8957
|
let { environment: t, port: n, serviceOutputs: r, urls: i } = e;
|
|
8791
|
-
return
|
|
8958
|
+
return Lm({
|
|
8792
8959
|
NODE_ENV: "production",
|
|
8793
8960
|
APP_ENV: t,
|
|
8794
8961
|
PORT: n === void 0 ? void 0 : String(n),
|
|
@@ -8800,14 +8967,14 @@ function vm(e) {
|
|
|
8800
8967
|
SERVER_URL: i.backend
|
|
8801
8968
|
});
|
|
8802
8969
|
}
|
|
8803
|
-
function
|
|
8804
|
-
let { declared: t, local: n, managed: r, origin: i, target: a } = e, o = new Set(
|
|
8970
|
+
function Fm(e) {
|
|
8971
|
+
let { declared: t, local: n, managed: r, origin: i, target: a } = e, o = new Set(Cm[a]), s = {}, c = [], l = [];
|
|
8805
8972
|
for (let e of t) {
|
|
8806
|
-
if (o.has(e) || r[e] !== void 0 ||
|
|
8973
|
+
if (o.has(e) || r[e] !== void 0 || wm.has(e)) continue;
|
|
8807
8974
|
let t = n[e];
|
|
8808
8975
|
if (!(t === void 0 || t.trim() === "") && !t.includes("${")) {
|
|
8809
|
-
if (
|
|
8810
|
-
let n =
|
|
8976
|
+
if (Tm.test(t)) {
|
|
8977
|
+
let n = km(t, i);
|
|
8811
8978
|
if (!n) {
|
|
8812
8979
|
l.push(e);
|
|
8813
8980
|
continue;
|
|
@@ -8824,19 +8991,19 @@ function ym(e) {
|
|
|
8824
8991
|
skippedLocal: l
|
|
8825
8992
|
};
|
|
8826
8993
|
}
|
|
8827
|
-
function
|
|
8994
|
+
function Im(e) {
|
|
8828
8995
|
return {
|
|
8829
8996
|
...e.seeded,
|
|
8830
8997
|
...e.forwarded,
|
|
8831
8998
|
...e.managed
|
|
8832
8999
|
};
|
|
8833
9000
|
}
|
|
8834
|
-
function
|
|
9001
|
+
function Lm(e) {
|
|
8835
9002
|
let t = {};
|
|
8836
9003
|
for (let [n, r] of Object.entries(e)) r !== void 0 && r !== "" && (t[n] = r);
|
|
8837
9004
|
return t;
|
|
8838
9005
|
}
|
|
8839
|
-
function
|
|
9006
|
+
function Rm(e) {
|
|
8840
9007
|
let t = {};
|
|
8841
9008
|
for (let n of e.split(/\r?\n/)) {
|
|
8842
9009
|
let e = n.trim();
|
|
@@ -8844,27 +9011,27 @@ function Sm(e) {
|
|
|
8844
9011
|
let r = e.startsWith("export ") ? e.slice(7).trim() : e, i = r.indexOf("=");
|
|
8845
9012
|
if (i <= 0) continue;
|
|
8846
9013
|
let a = r.slice(0, i).trim();
|
|
8847
|
-
/^[A-Za-z_][A-Za-z0-9_]*$/.test(a) && (t[a] =
|
|
9014
|
+
/^[A-Za-z_][A-Za-z0-9_]*$/.test(a) && (t[a] = zm(r.slice(i + 1).trim()));
|
|
8848
9015
|
}
|
|
8849
9016
|
return t;
|
|
8850
9017
|
}
|
|
8851
|
-
function
|
|
9018
|
+
function zm(e) {
|
|
8852
9019
|
if (e.length >= 2 && (e.startsWith("\"") && e.endsWith("\"") || e.startsWith("'") && e.endsWith("'"))) return e.slice(1, -1);
|
|
8853
9020
|
let t = e.indexOf(" #");
|
|
8854
9021
|
return t === -1 ? e : e.slice(0, t).trim();
|
|
8855
9022
|
}
|
|
8856
|
-
function
|
|
8857
|
-
return [...new Set(Object.keys(
|
|
9023
|
+
function Bm(e) {
|
|
9024
|
+
return [...new Set(Object.keys(Rm(e)))];
|
|
8858
9025
|
}
|
|
8859
9026
|
//#endregion
|
|
8860
9027
|
//#region src/deploy/migrations.ts
|
|
8861
|
-
var
|
|
9028
|
+
var Vm = [
|
|
8862
9029
|
"migration:latest",
|
|
8863
9030
|
"migrate:deploy",
|
|
8864
9031
|
"db:migrate:deploy"
|
|
8865
9032
|
];
|
|
8866
|
-
async function
|
|
8867
|
-
let n = await oi(T.join(e, "package.json")).catch(() => null), r =
|
|
9033
|
+
async function Hm(e, t) {
|
|
9034
|
+
let n = await oi(T.join(e, "package.json")).catch(() => null), r = Vm.find((e) => typeof n?.scripts?.[e] == "string");
|
|
8868
9035
|
if (r && n?.name) return [
|
|
8869
9036
|
"pnpm",
|
|
8870
9037
|
"--filter",
|
|
@@ -8877,7 +9044,7 @@ async function Em(e, t) {
|
|
|
8877
9044
|
"run",
|
|
8878
9045
|
r
|
|
8879
9046
|
];
|
|
8880
|
-
let i = await
|
|
9047
|
+
let i = await Um(e);
|
|
8881
9048
|
return [
|
|
8882
9049
|
"npx",
|
|
8883
9050
|
"prisma",
|
|
@@ -8887,7 +9054,7 @@ async function Em(e, t) {
|
|
|
8887
9054
|
T.relative(t, i).split(T.sep).join("/")
|
|
8888
9055
|
];
|
|
8889
9056
|
}
|
|
8890
|
-
async function
|
|
9057
|
+
async function Um(e) {
|
|
8891
9058
|
let t = T.join(e, "prisma"), n = T.join(t, "schema");
|
|
8892
9059
|
if (await ri(n)) return n;
|
|
8893
9060
|
let r = T.join(t, "schema.prisma");
|
|
@@ -8895,16 +9062,16 @@ async function Dm(e) {
|
|
|
8895
9062
|
}
|
|
8896
9063
|
//#endregion
|
|
8897
9064
|
//#region src/deploy/orchestrate.ts
|
|
8898
|
-
async function
|
|
9065
|
+
async function Wm(e) {
|
|
8899
9066
|
let { plan: t, runner: n, log: r } = e, i = [], a = {}, o = { ...e.knownServiceOutputs }, s = {}, c = [], l = {
|
|
8900
9067
|
runner: n,
|
|
8901
9068
|
plan: t,
|
|
8902
9069
|
cwd: t.projectRoot,
|
|
8903
9070
|
log: r
|
|
8904
|
-
}, u = (t) => e.adapters?.[t] ??
|
|
9071
|
+
}, u = (t) => e.adapters?.[t] ?? Rp(t), d = (e, n) => (i.push({
|
|
8905
9072
|
...e,
|
|
8906
9073
|
status: "failed",
|
|
8907
|
-
detail:
|
|
9074
|
+
detail: Xm(n)
|
|
8908
9075
|
}), {
|
|
8909
9076
|
plan: t,
|
|
8910
9077
|
steps: i,
|
|
@@ -8913,7 +9080,7 @@ async function Om(e) {
|
|
|
8913
9080
|
envPlans: c,
|
|
8914
9081
|
ok: !1
|
|
8915
9082
|
});
|
|
8916
|
-
if (!e.skipAuthCheck) for (let n of
|
|
9083
|
+
if (!e.skipAuthCheck) for (let n of qm(t)) {
|
|
8917
9084
|
let t = {
|
|
8918
9085
|
id: `auth:${n}`,
|
|
8919
9086
|
label: `Check ${n} login`
|
|
@@ -8978,13 +9145,13 @@ async function Om(e) {
|
|
|
8978
9145
|
}, e.providedByProvider && f && (s[f.target] = [...s[f.target] ?? [], ...e.providedByProvider]), i.push({
|
|
8979
9146
|
...t,
|
|
8980
9147
|
status: "ok",
|
|
8981
|
-
detail: e.note ??
|
|
9148
|
+
detail: e.note ?? Ym(e.outputs)
|
|
8982
9149
|
});
|
|
8983
9150
|
} catch (e) {
|
|
8984
9151
|
return d(t, e);
|
|
8985
9152
|
}
|
|
8986
9153
|
}
|
|
8987
|
-
c =
|
|
9154
|
+
c = Em({
|
|
8988
9155
|
plan: t,
|
|
8989
9156
|
serviceOutputs: o,
|
|
8990
9157
|
urls: a,
|
|
@@ -8993,9 +9160,9 @@ async function Om(e) {
|
|
|
8993
9160
|
exampleEnv: e.exampleEnv,
|
|
8994
9161
|
externallyProvided: s
|
|
8995
9162
|
});
|
|
8996
|
-
let p = new Map(c.map((e) => [e.target, e])), m = f && !e.skipMigrations ? await
|
|
9163
|
+
let p = new Map(c.map((e) => [e.target, e])), m = f && !e.skipMigrations ? await Hm(f.root, t.projectRoot) : void 0, h = !1, g = /* @__PURE__ */ new Set();
|
|
8997
9164
|
for (let e of t.targets) {
|
|
8998
|
-
let t = p.get(e.target), n = t ?
|
|
9165
|
+
let t = p.get(e.target), n = t ? Im(t) : {}, o = Jm(n), s = u(e.provider), c = {
|
|
8999
9166
|
id: `env:${e.target}`,
|
|
9000
9167
|
label: `Configure ${e.spec.label} env`
|
|
9001
9168
|
};
|
|
@@ -9009,10 +9176,15 @@ async function Om(e) {
|
|
|
9009
9176
|
status: "ok",
|
|
9010
9177
|
detail: `${Object.keys(n).length} variables`
|
|
9011
9178
|
});
|
|
9012
|
-
} catch (
|
|
9013
|
-
|
|
9179
|
+
} catch (t) {
|
|
9180
|
+
i.push({
|
|
9181
|
+
...c,
|
|
9182
|
+
status: "failed",
|
|
9183
|
+
detail: Xm(t)
|
|
9184
|
+
}), g.add(e.target);
|
|
9185
|
+
continue;
|
|
9014
9186
|
}
|
|
9015
|
-
let
|
|
9187
|
+
let d = {
|
|
9016
9188
|
id: `deploy:${e.target}`,
|
|
9017
9189
|
label: `Deploy ${e.spec.label}`
|
|
9018
9190
|
};
|
|
@@ -9025,12 +9197,40 @@ async function Om(e) {
|
|
|
9025
9197
|
releaseCommand: e === f ? m : void 0
|
|
9026
9198
|
});
|
|
9027
9199
|
t.url && (a[e.target] = t.url), t.releaseRan && (h = !0), i.push({
|
|
9028
|
-
...
|
|
9200
|
+
...d,
|
|
9029
9201
|
status: "ok",
|
|
9030
9202
|
detail: t.url ?? t.note
|
|
9031
9203
|
});
|
|
9032
|
-
} catch (
|
|
9033
|
-
|
|
9204
|
+
} catch (t) {
|
|
9205
|
+
i.push({
|
|
9206
|
+
...d,
|
|
9207
|
+
status: "failed",
|
|
9208
|
+
detail: Xm(t)
|
|
9209
|
+
}), g.add(e.target);
|
|
9210
|
+
}
|
|
9211
|
+
}
|
|
9212
|
+
for (let e of t.targets) {
|
|
9213
|
+
if (g.has(e.target)) continue;
|
|
9214
|
+
let t = u(e.provider);
|
|
9215
|
+
if (!t.awaitTarget) continue;
|
|
9216
|
+
let n = {
|
|
9217
|
+
id: `verify:${e.target}`,
|
|
9218
|
+
label: `Verify ${e.spec.label}`
|
|
9219
|
+
};
|
|
9220
|
+
try {
|
|
9221
|
+
r?.(`Waiting for ${e.spec.label} to come up`);
|
|
9222
|
+
let a = await t.awaitTarget(l, e);
|
|
9223
|
+
i.push({
|
|
9224
|
+
...n,
|
|
9225
|
+
status: a.ok ? "ok" : "failed",
|
|
9226
|
+
detail: a.detail
|
|
9227
|
+
}), a.ok || g.add(e.target);
|
|
9228
|
+
} catch (t) {
|
|
9229
|
+
i.push({
|
|
9230
|
+
...n,
|
|
9231
|
+
status: "failed",
|
|
9232
|
+
detail: Xm(t)
|
|
9233
|
+
}), g.add(e.target);
|
|
9034
9234
|
}
|
|
9035
9235
|
}
|
|
9036
9236
|
if (f) {
|
|
@@ -9038,7 +9238,12 @@ async function Om(e) {
|
|
|
9038
9238
|
id: "migrate",
|
|
9039
9239
|
label: "Apply database migrations"
|
|
9040
9240
|
};
|
|
9041
|
-
if (
|
|
9241
|
+
if (g.has(f.target)) i.push({
|
|
9242
|
+
...t,
|
|
9243
|
+
status: "skipped",
|
|
9244
|
+
detail: `not run because the ${f.spec.label} deploy failed`
|
|
9245
|
+
});
|
|
9246
|
+
else if (e.skipMigrations || !m) i.push({
|
|
9042
9247
|
...t,
|
|
9043
9248
|
status: "skipped",
|
|
9044
9249
|
detail: "--skip-migrations"
|
|
@@ -9049,7 +9254,7 @@ async function Om(e) {
|
|
|
9049
9254
|
detail: `${m.join(" ")} (ran with the release)`
|
|
9050
9255
|
});
|
|
9051
9256
|
else {
|
|
9052
|
-
let e = await
|
|
9257
|
+
let e = await Gm({
|
|
9053
9258
|
ctx: l,
|
|
9054
9259
|
adapter: u(f.provider),
|
|
9055
9260
|
backend: f,
|
|
@@ -9070,7 +9275,7 @@ async function Om(e) {
|
|
|
9070
9275
|
ok: i.every((e) => e.status !== "failed")
|
|
9071
9276
|
};
|
|
9072
9277
|
}
|
|
9073
|
-
async function
|
|
9278
|
+
async function Gm(e) {
|
|
9074
9279
|
let { ctx: t, adapter: n, backend: r, command: i } = e;
|
|
9075
9280
|
if (!n.runRemote) return {
|
|
9076
9281
|
status: "skipped",
|
|
@@ -9082,37 +9287,37 @@ async function km(e) {
|
|
|
9082
9287
|
status: "ok",
|
|
9083
9288
|
detail: i.join(" ")
|
|
9084
9289
|
};
|
|
9085
|
-
let o =
|
|
9290
|
+
let o = Km(a.output);
|
|
9086
9291
|
return {
|
|
9087
9292
|
status: "skipped",
|
|
9088
9293
|
detail: `Could not run migrations remotely${o ? ` (${o})` : ""}. Run "${i.join(" ")}" against ${r.app}.`
|
|
9089
9294
|
};
|
|
9090
9295
|
}
|
|
9091
|
-
function
|
|
9296
|
+
function Km(e) {
|
|
9092
9297
|
let t = e.split(/\r?\n/).map((e) => e.trim()).find((e) => e.length > 0);
|
|
9093
9298
|
if (t) return t.length > 160 ? `${t.slice(0, 157)}...` : t;
|
|
9094
9299
|
}
|
|
9095
|
-
function
|
|
9300
|
+
function qm(e) {
|
|
9096
9301
|
let t = /* @__PURE__ */ new Set();
|
|
9097
9302
|
for (let n of e.targets) t.add(n.provider);
|
|
9098
9303
|
for (let n of e.services) n.external || t.add(n.provider);
|
|
9099
9304
|
return [...t];
|
|
9100
9305
|
}
|
|
9101
|
-
function
|
|
9306
|
+
function Jm(e) {
|
|
9102
9307
|
return Object.entries(e).filter(([e, t]) => t.length >= 8 && !e.startsWith("VITE_") && !/^https?:\/\//.test(t)).map(([, e]) => e);
|
|
9103
9308
|
}
|
|
9104
|
-
function
|
|
9309
|
+
function Ym(e) {
|
|
9105
9310
|
let t = Object.keys(e);
|
|
9106
9311
|
return t.length === 0 ? void 0 : `set ${t.join(", ")}`;
|
|
9107
9312
|
}
|
|
9108
|
-
function
|
|
9313
|
+
function Xm(e) {
|
|
9109
9314
|
return e instanceof Error ? e.message : String(e);
|
|
9110
9315
|
}
|
|
9111
9316
|
//#endregion
|
|
9112
9317
|
//#region src/deploy/plan.ts
|
|
9113
|
-
function
|
|
9318
|
+
function Zm(e) {
|
|
9114
9319
|
let { projectRoot: t, config: n, assignment: r, stackConfig: i, serveModes: a = {}, staticDirs: o = {} } = e, s = [];
|
|
9115
|
-
for (let [e, c] of
|
|
9320
|
+
for (let [e, c] of $m(r)) {
|
|
9116
9321
|
let r = n.targets[e], l = Cd[e];
|
|
9117
9322
|
s.push({
|
|
9118
9323
|
target: e,
|
|
@@ -9125,7 +9330,7 @@ function Fm(e) {
|
|
|
9125
9330
|
app: r?.app ?? jd(n.projectName, e, c),
|
|
9126
9331
|
region: r?.region,
|
|
9127
9332
|
url: r?.url,
|
|
9128
|
-
root:
|
|
9333
|
+
root: fm(t, e, i)
|
|
9129
9334
|
});
|
|
9130
9335
|
}
|
|
9131
9336
|
let c = [];
|
|
@@ -9152,20 +9357,20 @@ function Fm(e) {
|
|
|
9152
9357
|
railway: n.railway ?? {}
|
|
9153
9358
|
};
|
|
9154
9359
|
}
|
|
9155
|
-
var
|
|
9360
|
+
var Qm = [
|
|
9156
9361
|
"frontend",
|
|
9157
9362
|
"admin",
|
|
9158
9363
|
"backend"
|
|
9159
9364
|
];
|
|
9160
|
-
function
|
|
9365
|
+
function $m(e) {
|
|
9161
9366
|
let t = [];
|
|
9162
|
-
for (let n of
|
|
9367
|
+
for (let n of Qm) {
|
|
9163
9368
|
let r = e.targets[n];
|
|
9164
9369
|
r && t.push([n, r]);
|
|
9165
9370
|
}
|
|
9166
9371
|
return t;
|
|
9167
9372
|
}
|
|
9168
|
-
function
|
|
9373
|
+
function eh(e, t) {
|
|
9169
9374
|
let n = {
|
|
9170
9375
|
...e,
|
|
9171
9376
|
environment: t.environment,
|
|
@@ -9195,20 +9400,20 @@ function Rm(e, t) {
|
|
|
9195
9400
|
}
|
|
9196
9401
|
//#endregion
|
|
9197
9402
|
//#region src/deploy/project-env.ts
|
|
9198
|
-
async function
|
|
9403
|
+
async function th(e) {
|
|
9199
9404
|
return await G(e) ? C.readFile(e, "utf-8") : null;
|
|
9200
9405
|
}
|
|
9201
|
-
async function
|
|
9202
|
-
let n =
|
|
9203
|
-
let [t, r] = await Promise.all([
|
|
9406
|
+
async function nh(e, t) {
|
|
9407
|
+
let n = Rm(await th(T.join(e, ".env")) ?? ""), r = await Promise.all(t.map(async (e) => {
|
|
9408
|
+
let [t, r] = await Promise.all([th(T.join(e.root, ".env")), th(T.join(e.root, ".env.example"))]);
|
|
9204
9409
|
return {
|
|
9205
9410
|
target: e.target,
|
|
9206
9411
|
local: {
|
|
9207
9412
|
...n,
|
|
9208
|
-
...
|
|
9413
|
+
...Rm(t ?? "")
|
|
9209
9414
|
},
|
|
9210
|
-
declared:
|
|
9211
|
-
example:
|
|
9415
|
+
declared: Bm(r ?? ""),
|
|
9416
|
+
example: Rm(r ?? "")
|
|
9212
9417
|
};
|
|
9213
9418
|
})), i = {}, a = {}, o = {};
|
|
9214
9419
|
for (let e of r) i[e.target] = e.local, a[e.target] = e.declared, o[e.target] = e.example;
|
|
@@ -9220,7 +9425,7 @@ async function Bm(e, t) {
|
|
|
9220
9425
|
}
|
|
9221
9426
|
//#endregion
|
|
9222
9427
|
//#region src/deploy/report.ts
|
|
9223
|
-
function
|
|
9428
|
+
function rh(e) {
|
|
9224
9429
|
let t = [];
|
|
9225
9430
|
t.push(`${F.label("Project")} ${F.highlight(e.projectName)}`), t.push(`${F.label("Env")} ${F.highlight(e.environment)}`), t.push(""), t.push(F.bold("Apps"));
|
|
9226
9431
|
for (let n of e.targets) {
|
|
@@ -9236,7 +9441,7 @@ function Vm(e) {
|
|
|
9236
9441
|
}
|
|
9237
9442
|
return t.join("\n");
|
|
9238
9443
|
}
|
|
9239
|
-
function
|
|
9444
|
+
function ih(e) {
|
|
9240
9445
|
let t = [];
|
|
9241
9446
|
for (let n of e) {
|
|
9242
9447
|
let e = Object.keys(n.managed).length, r = Object.keys(n.forwarded).length;
|
|
@@ -9246,19 +9451,19 @@ function Hm(e) {
|
|
|
9246
9451
|
}
|
|
9247
9452
|
return t.join("\n");
|
|
9248
9453
|
}
|
|
9249
|
-
function
|
|
9454
|
+
function ah(e) {
|
|
9250
9455
|
return e.steps.map((e) => {
|
|
9251
9456
|
let t = e.status === "ok" ? F.success("✓") : e.status === "skipped" ? F.warning("-") : F.error("✗"), n = e.detail ? ` ${F.muted(e.detail)}` : "";
|
|
9252
9457
|
return `${t} ${e.label}${n}`;
|
|
9253
9458
|
}).join("\n");
|
|
9254
9459
|
}
|
|
9255
|
-
function
|
|
9460
|
+
function oh(e) {
|
|
9256
9461
|
return e.plan.targets.map((t) => {
|
|
9257
9462
|
let n = e.urls[t.target];
|
|
9258
9463
|
return n ? `${F.label(t.spec.label)} ${I(n)}` : `${F.label(t.spec.label)} ${F.muted("no public URL")}`;
|
|
9259
9464
|
}).join("\n");
|
|
9260
9465
|
}
|
|
9261
|
-
function
|
|
9466
|
+
function sh(e) {
|
|
9262
9467
|
let t = [];
|
|
9263
9468
|
for (let n of e.envPlans) {
|
|
9264
9469
|
n.missing.length > 0 && t.push(`${Z(n.target)} is missing ${n.missing.join(", ")}. The app will boot only once those are set.`);
|
|
@@ -9270,27 +9475,27 @@ function Gm(e) {
|
|
|
9270
9475
|
}
|
|
9271
9476
|
//#endregion
|
|
9272
9477
|
//#region src/commands/deploy.ts
|
|
9273
|
-
async function
|
|
9478
|
+
async function ch(e = {}) {
|
|
9274
9479
|
let t = T.resolve(e.cwd ?? process.cwd()), n = e.yes === !0;
|
|
9275
9480
|
ll(), c.intro(F.brandBold("Deploy your stack")), await Gi(t) || z(`${F.path(t)} doesn't look like a Hype Stack project. Run this from the project root.`, { reason: "not_a_project" }), await Bi(t) || z(`${F.path(t)} has no ${F.path(pe)}, so it is not a Hype Stack project this CLI can deploy. Run "hype-stack init" here first, or deploy a project made with "hype-stack create".`, { reason: "not_a_project" });
|
|
9276
|
-
let r = await q(t).catch(() => null), i = await
|
|
9277
|
-
i ||=
|
|
9481
|
+
let r = await q(t).catch(() => null), i = await lh(t);
|
|
9482
|
+
i ||= lm(_i(r?.name ?? T.basename(t))), e.environment && (i.environment = e.environment), e.flyOrg && (i.fly = {
|
|
9278
9483
|
...i.fly,
|
|
9279
9484
|
org: e.flyOrg
|
|
9280
9485
|
}), e.railwayWorkspace && (i.railway = {
|
|
9281
9486
|
...i.railway,
|
|
9282
9487
|
workspace: e.railwayWorkspace
|
|
9283
9488
|
});
|
|
9284
|
-
let a = await
|
|
9489
|
+
let a = await pm(t, r);
|
|
9285
9490
|
a.length === 0 && z("Found no deployable apps. Expected at least one of apps/backend, apps/frontend, or apps/admin.");
|
|
9286
|
-
let o = e.only ?? [], s =
|
|
9491
|
+
let o = e.only ?? [], s = dh(e.assign), l = uh(e.provider, "--provider"), u = Md({
|
|
9287
9492
|
config: i,
|
|
9288
9493
|
defaultProvider: l,
|
|
9289
9494
|
overrides: s,
|
|
9290
9495
|
availableTargets: a,
|
|
9291
9496
|
only: o
|
|
9292
|
-
}), d = await
|
|
9293
|
-
n || (u = await
|
|
9497
|
+
}), d = await gm(t, Nd(a, o), r);
|
|
9498
|
+
n || (u = await ph({
|
|
9294
9499
|
assignment: u,
|
|
9295
9500
|
availableTargets: a,
|
|
9296
9501
|
requestedTargets: o
|
|
@@ -9302,12 +9507,12 @@ async function Km(e = {}) {
|
|
|
9302
9507
|
serveModes: d
|
|
9303
9508
|
});
|
|
9304
9509
|
f.length > 0 && (R(Id(f), "Cannot deploy yet"), z("Fix the assignments above and run deploy again.", { reason: "input_required" }));
|
|
9305
|
-
let p =
|
|
9510
|
+
let p = _m(d), m = await _h({
|
|
9306
9511
|
cwd: t,
|
|
9307
9512
|
targets: u.targets,
|
|
9308
9513
|
serveModes: p,
|
|
9309
9514
|
stackConfig: r
|
|
9310
|
-
}), h =
|
|
9515
|
+
}), h = Zm({
|
|
9311
9516
|
projectRoot: t,
|
|
9312
9517
|
config: i,
|
|
9313
9518
|
assignment: u,
|
|
@@ -9315,13 +9520,13 @@ async function Km(e = {}) {
|
|
|
9315
9520
|
serveModes: p,
|
|
9316
9521
|
staticDirs: m
|
|
9317
9522
|
});
|
|
9318
|
-
R(
|
|
9523
|
+
R(rh(h), e.dryRun ? "Deployment plan (dry run)" : "Deployment plan");
|
|
9319
9524
|
let g = e.dryRun ? {
|
|
9320
9525
|
env: {},
|
|
9321
9526
|
accounts: {}
|
|
9322
|
-
} : await
|
|
9527
|
+
} : await Bp({
|
|
9323
9528
|
plan: h,
|
|
9324
|
-
providers:
|
|
9529
|
+
providers: qm(h),
|
|
9325
9530
|
skipPrompts: n
|
|
9326
9531
|
});
|
|
9327
9532
|
if (!n && !e.dryRun) {
|
|
@@ -9330,13 +9535,13 @@ async function Km(e = {}) {
|
|
|
9330
9535
|
message: "Deploying creates billable infrastructure. Re-run with --yes to confirm non-interactively."
|
|
9331
9536
|
});
|
|
9332
9537
|
let e = await c.confirm({
|
|
9333
|
-
message: `Create and deploy this on ${
|
|
9538
|
+
message: `Create and deploy this on ${vh(h.targets.map((e) => e.provider))}?`,
|
|
9334
9539
|
initialValue: !0
|
|
9335
9540
|
});
|
|
9336
9541
|
(c.isCancel(e) || !e) && B();
|
|
9337
9542
|
}
|
|
9338
|
-
let _ = await
|
|
9339
|
-
R(
|
|
9543
|
+
let _ = await nh(t, h.targets);
|
|
9544
|
+
R(ih(Mm({
|
|
9340
9545
|
plan: h,
|
|
9341
9546
|
localEnv: _.local,
|
|
9342
9547
|
declaredKeys: _.declared,
|
|
@@ -9344,13 +9549,13 @@ async function Km(e = {}) {
|
|
|
9344
9549
|
})), "Environment"), await gd(t).catch(() => null);
|
|
9345
9550
|
let v = St(), y = [], b = e.dryRun ? gf({
|
|
9346
9551
|
onCommand: (e) => y.push(e),
|
|
9347
|
-
responses:
|
|
9552
|
+
responses: Sm
|
|
9348
9553
|
}) : hf({
|
|
9349
9554
|
onCommand: (e) => y.push(e),
|
|
9350
9555
|
env: g.env
|
|
9351
9556
|
});
|
|
9352
9557
|
v.start(e.dryRun ? "Walking the plan" : "Deploying");
|
|
9353
|
-
let x = await
|
|
9558
|
+
let x = await Wm({
|
|
9354
9559
|
plan: h,
|
|
9355
9560
|
runner: b,
|
|
9356
9561
|
localEnv: _.local,
|
|
@@ -9362,61 +9567,61 @@ async function Km(e = {}) {
|
|
|
9362
9567
|
knownAccounts: g.accounts,
|
|
9363
9568
|
log: (e) => v.message(e)
|
|
9364
9569
|
});
|
|
9365
|
-
if (v.stop(x.ok ? F.success("Deploy finished") : F.error("Deploy stopped")), R(
|
|
9570
|
+
if (v.stop(x.ok ? F.success("Deploy finished") : F.error("Deploy stopped")), R(ah(x), "Steps"), e.dryRun) {
|
|
9366
9571
|
R(y.map((e) => F.command(e)).join("\n"), "Commands that would run"), c.outro(F.muted("Dry run only. No infrastructure was created."));
|
|
9367
9572
|
return;
|
|
9368
9573
|
}
|
|
9369
|
-
if (await
|
|
9370
|
-
let e = x.steps.
|
|
9371
|
-
R(`${e
|
|
9574
|
+
if (await cm(t, eh(i, x.plan)), !x.ok) {
|
|
9575
|
+
let e = x.steps.filter((e) => e.status === "failed");
|
|
9576
|
+
R(`${e.length > 0 ? e.map((e) => `${e.label} failed.${e.detail ? `\n${e.detail}` : ""}`).join("\n\n") : "A step failed."}\n\nWhat succeeded is saved in ${F.path(X)}, so re-running picks up from here.`, "Deploy failed"), z("Deploy did not finish.");
|
|
9372
9577
|
}
|
|
9373
|
-
R(
|
|
9374
|
-
let S =
|
|
9578
|
+
R(oh(x), "Live");
|
|
9579
|
+
let S = sh(x);
|
|
9375
9580
|
S.length > 0 && R(S.map((e) => `${F.warning("!")} ${e}`).join("\n\n"), "Still to do"), c.outro(F.brand("Shipped."));
|
|
9376
9581
|
}
|
|
9377
|
-
async function
|
|
9582
|
+
async function lh(e) {
|
|
9378
9583
|
try {
|
|
9379
|
-
return await
|
|
9584
|
+
return await sm(e);
|
|
9380
9585
|
} catch (e) {
|
|
9381
9586
|
z(e instanceof Error ? e.message : String(e));
|
|
9382
9587
|
}
|
|
9383
9588
|
}
|
|
9384
|
-
function
|
|
9589
|
+
function uh(e, t) {
|
|
9385
9590
|
if (e) return Dd(e) || z(`Unknown provider "${e}" for ${t}. Pick one of ${Object.keys(Td).join(", ")}.`), e;
|
|
9386
9591
|
}
|
|
9387
|
-
function
|
|
9592
|
+
function dh(e) {
|
|
9388
9593
|
let t = {};
|
|
9389
9594
|
for (let [n, r] of Object.entries(e ?? {})) {
|
|
9390
|
-
let e =
|
|
9595
|
+
let e = uh(r, `--${n}`);
|
|
9391
9596
|
e && (t[n] = e);
|
|
9392
9597
|
}
|
|
9393
9598
|
return t;
|
|
9394
9599
|
}
|
|
9395
|
-
function
|
|
9600
|
+
function fh(e) {
|
|
9396
9601
|
let { assignment: t, availableTargets: n, requestedTargets: r } = e, i = Nd(n, r).filter((e) => !t.targets[e]);
|
|
9397
9602
|
return {
|
|
9398
9603
|
targets: i,
|
|
9399
9604
|
services: t.targets.backend !== void 0 || i.includes("backend") ? xd.filter((e) => !t.services[e]) : []
|
|
9400
9605
|
};
|
|
9401
9606
|
}
|
|
9402
|
-
async function
|
|
9607
|
+
async function ph(e) {
|
|
9403
9608
|
let t = {
|
|
9404
9609
|
targets: { ...e.assignment.targets },
|
|
9405
9610
|
services: { ...e.assignment.services }
|
|
9406
|
-
}, { targets: n, services: r } =
|
|
9611
|
+
}, { targets: n, services: r } = fh(e);
|
|
9407
9612
|
if (n.length + r.length > 1) {
|
|
9408
|
-
let e = await
|
|
9613
|
+
let e = await mh();
|
|
9409
9614
|
if (e) {
|
|
9410
9615
|
for (let r of n) t.targets[r] = e;
|
|
9411
9616
|
for (let n of r) t.services[n] = e;
|
|
9412
9617
|
return t;
|
|
9413
9618
|
}
|
|
9414
9619
|
}
|
|
9415
|
-
for (let e of n) t.targets[e] = await
|
|
9416
|
-
for (let e of r) t.services[e] = await
|
|
9620
|
+
for (let e of n) t.targets[e] = await gh(e, kd(e));
|
|
9621
|
+
for (let e of r) t.services[e] = await gh(e, kd(e));
|
|
9417
9622
|
return t;
|
|
9418
9623
|
}
|
|
9419
|
-
async function
|
|
9624
|
+
async function mh() {
|
|
9420
9625
|
let e = await c.select({
|
|
9421
9626
|
message: `Where should ${F.highlight("your stack")} live?`,
|
|
9422
9627
|
options: [...Sd.map((e) => ({
|
|
@@ -9424,16 +9629,16 @@ async function Qm() {
|
|
|
9424
9629
|
label: Od(e),
|
|
9425
9630
|
hint: `everything on ${Td[e].bin}`
|
|
9426
9631
|
})), {
|
|
9427
|
-
value:
|
|
9632
|
+
value: hh,
|
|
9428
9633
|
label: "Mix providers",
|
|
9429
9634
|
hint: "choose for each app and service"
|
|
9430
9635
|
}],
|
|
9431
9636
|
initialValue: Sd[0]
|
|
9432
9637
|
});
|
|
9433
|
-
return c.isCancel(e) && B(), e ===
|
|
9638
|
+
return c.isCancel(e) && B(), e === hh ? void 0 : e;
|
|
9434
9639
|
}
|
|
9435
|
-
var
|
|
9436
|
-
async function
|
|
9640
|
+
var hh = "__mixed__";
|
|
9641
|
+
async function gh(e, t) {
|
|
9437
9642
|
if (t.length === 0 && z(`Nothing in this CLI can host ${Z(e)}. Provision it yourself and add it to the "${_d}" block of ${X}.`), t.length === 1) return t[0];
|
|
9438
9643
|
let n = await c.select({
|
|
9439
9644
|
message: `Where should ${F.highlight(Z(e))} live?`,
|
|
@@ -9446,17 +9651,17 @@ async function eh(e, t) {
|
|
|
9446
9651
|
});
|
|
9447
9652
|
return c.isCancel(n) && B(), n;
|
|
9448
9653
|
}
|
|
9449
|
-
async function
|
|
9450
|
-
let { cwd: t, targets: n, serveModes: r, stackConfig: i } = e, a = Object.keys(n).filter((e) => Ed(e) && r[e] === "static"), o = await Promise.all(a.map(async (e) => [e, await
|
|
9654
|
+
async function _h(e) {
|
|
9655
|
+
let { cwd: t, targets: n, serveModes: r, stackConfig: i } = e, a = Object.keys(n).filter((e) => Ed(e) && r[e] === "static"), o = await Promise.all(a.map(async (e) => [e, await vm(fm(t, e, i), e)]));
|
|
9451
9656
|
return Object.fromEntries(o);
|
|
9452
9657
|
}
|
|
9453
|
-
function
|
|
9658
|
+
function vh(e) {
|
|
9454
9659
|
let t = [...new Set(e)].map(Od);
|
|
9455
9660
|
return t.length <= 1 ? t[0] ?? "your provider" : `${t.slice(0, -1).join(", ")} and ${t[t.length - 1]}`;
|
|
9456
9661
|
}
|
|
9457
9662
|
//#endregion
|
|
9458
9663
|
//#region src/commands/login.ts
|
|
9459
|
-
async function
|
|
9664
|
+
async function yh() {
|
|
9460
9665
|
ul(), c.intro(F.brandBold("Log in to Hype Stack")), Ue() && c.log.warn(`${N} is set and takes priority over this login. Unset it to use the browser session.`), c.log.step("Opening your browser to sign in...");
|
|
9461
9666
|
let e;
|
|
9462
9667
|
try {
|
|
@@ -9470,7 +9675,7 @@ async function rh() {
|
|
|
9470
9675
|
}
|
|
9471
9676
|
//#endregion
|
|
9472
9677
|
//#region src/commands/logout.ts
|
|
9473
|
-
async function
|
|
9678
|
+
async function bh() {
|
|
9474
9679
|
ul(), c.intro(F.brandBold("Log out of Hype Stack"));
|
|
9475
9680
|
let e = M(), t = await We(e);
|
|
9476
9681
|
if (!t) {
|
|
@@ -9481,8 +9686,8 @@ async function ih() {
|
|
|
9481
9686
|
}
|
|
9482
9687
|
//#endregion
|
|
9483
9688
|
//#region src/commands/mcp.ts
|
|
9484
|
-
async function
|
|
9485
|
-
let t =
|
|
9689
|
+
async function xh(e = {}) {
|
|
9690
|
+
let t = Ch(e.editor), n = nu(t), r = wh(e.scope, t, n), i = Sh(e.token);
|
|
9486
9691
|
if (e.print) {
|
|
9487
9692
|
process.stdout.write(au(t, i));
|
|
9488
9693
|
return;
|
|
@@ -9496,19 +9701,19 @@ async function ah(e = {}) {
|
|
|
9496
9701
|
});
|
|
9497
9702
|
a.changed ? c.log.success(`Wrote ${F.path(a.configPath)}`) : c.log.info(F.muted(`${F.path(a.configPath)} is already up to date.`)), i && c.log.warn(F.muted(`${N} is stored in plain text. Keep this file out of version control.`)), c.outro(F.muted("Restart your editor to pick up the server."));
|
|
9498
9703
|
}
|
|
9499
|
-
function
|
|
9704
|
+
function Sh(e) {
|
|
9500
9705
|
return e?.trim() || void 0;
|
|
9501
9706
|
}
|
|
9502
|
-
function
|
|
9707
|
+
function Ch(e) {
|
|
9503
9708
|
return e ? ($l(e) || z(`Unknown editor "${e}". Expected one of: ${Xl.join(", ")}.`), e) : "cursor";
|
|
9504
9709
|
}
|
|
9505
|
-
function
|
|
9710
|
+
function wh(e, t, n) {
|
|
9506
9711
|
let r = e ?? n[0];
|
|
9507
9712
|
return r !== "global" && r !== "project" && z(`Unknown scope "${r}". Expected global or project.`), n.includes(r) || z(`${t} does not support ${r} scope. Supported: ${n.join(", ")}.`), r;
|
|
9508
9713
|
}
|
|
9509
9714
|
//#endregion
|
|
9510
9715
|
//#region src/ui/env-prompt.ts
|
|
9511
|
-
var
|
|
9716
|
+
var Th = S("✔", "√"), Eh = S("✘", "x"), Dh = "\x1B[7m \x1B[27m", Oh = class extends ie {
|
|
9512
9717
|
constructor(e) {
|
|
9513
9718
|
super({
|
|
9514
9719
|
input: e.input,
|
|
@@ -9523,29 +9728,29 @@ var lh = S("✔", "√"), uh = S("✘", "x"), dh = class extends ie {
|
|
|
9523
9728
|
let { key: e, section: t, linkUrl: n, hint: r, checklist: i, currentMasked: a, progress: o } = this.promptOptions, s = y.withGuide, c = s ? `${A("gray", l)}\n` : "";
|
|
9524
9729
|
if (this.state === "submit") {
|
|
9525
9730
|
let t = (this.value ?? "").trim(), n = t ? F.muted(ds(t)) : a ? F.muted(`kept ${a}`) : F.muted("left empty");
|
|
9526
|
-
return `${c}${A("green",
|
|
9731
|
+
return `${c}${A("green", Th)} ${F.bold(e)} ${n}`;
|
|
9527
9732
|
}
|
|
9528
|
-
if (this.state === "cancel") return `${c}${A("red",
|
|
9733
|
+
if (this.state === "cancel") return `${c}${A("red", Eh)} ${A(["strikethrough", "dim"], e)}`;
|
|
9529
9734
|
let d = x(this.state), f = s ? `${d} ` : "", p = b(this.state), m = o ? ` ${F.muted(o)}` : "", h = `${c}${p} ${F.bold(e)}${m}`, g = [];
|
|
9530
9735
|
if (t) {
|
|
9531
9736
|
let e = n ? ` ${I(n)}` : "";
|
|
9532
9737
|
g.push(`${f}${F.description(t)}${e}`);
|
|
9533
9738
|
}
|
|
9534
|
-
if (i && i.length > 0) for (let e of i) g.push(`${f}${L.bullet} ${F.
|
|
9535
|
-
r && g.push(`${f}${F.
|
|
9536
|
-
let _ = this.userInput
|
|
9537
|
-
g.push(
|
|
9538
|
-
let
|
|
9539
|
-
return `${h}\n${g.join("\n")}\n${
|
|
9739
|
+
if (i && i.length > 0) for (let e of i) g.push(`${f}${L.bullet} ${F.description(e)}`);
|
|
9740
|
+
r && g.push(`${f}${F.description(r)}`);
|
|
9741
|
+
let _ = this.userInput !== "", v = a ? `${a} (Enter keeps this)` : "type a value, or Enter to skip", S = _ ? `${f}${L.arrow} ${this.userInputWithCursor}` : `${f}${L.arrow} ${Dh} ${F.muted(v)}`;
|
|
9742
|
+
g.push(S), this.state === "error" && g.push(`${f}${A("yellow", this.error)}`);
|
|
9743
|
+
let C = s ? this.state === "error" ? A("yellow", u) : A("cyan", u) : "";
|
|
9744
|
+
return `${h}\n${g.join("\n")}\n${C}`;
|
|
9540
9745
|
}
|
|
9541
9746
|
};
|
|
9542
|
-
async function
|
|
9543
|
-
let t = await new
|
|
9747
|
+
async function kh(e) {
|
|
9748
|
+
let t = await new Oh(e).prompt();
|
|
9544
9749
|
return g(t) || typeof t == "string" ? t : "";
|
|
9545
9750
|
}
|
|
9546
9751
|
//#endregion
|
|
9547
9752
|
//#region src/commands/onboard.ts
|
|
9548
|
-
async function
|
|
9753
|
+
async function Ah(e = {}) {
|
|
9549
9754
|
let t = e.cwd ?? process.cwd();
|
|
9550
9755
|
e.skipBanner || ll(), c.intro(F.brandBold("Onboard your stack"));
|
|
9551
9756
|
let n;
|
|
@@ -9560,12 +9765,12 @@ async function ph(e = {}) {
|
|
|
9560
9765
|
for (let e of r) await ms(e);
|
|
9561
9766
|
let i = await gs(t, n);
|
|
9562
9767
|
i.length > 0 && c.log.success(`Generated ${F.highlight(String(i.length))} secrets: ${i.map((e) => e.key).join(", ")}`);
|
|
9563
|
-
let a = await
|
|
9564
|
-
e.yes ? u.push(...o, ...l.filter((e) => !e.isSet)) : (await
|
|
9768
|
+
let a = await jh(t, n, r), o = a.filter((e) => e.setup.setup === "required" && !e.isSet), s = a.filter((e) => e.setup.setup === "required" && e.isSet), l = a.filter((e) => e.setup.setup === "optional"), u = [];
|
|
9769
|
+
e.yes ? u.push(...o, ...l.filter((e) => !e.isSet)) : (u.push(...await Mh(o)), u.push(...await Nh(l)), await Ph(s)), zh(u, t);
|
|
9565
9770
|
let d = Ai(n.installedPacks ?? []);
|
|
9566
9771
|
d.length > 0 && R(d.map((e) => ` ${F.muted("·")} ${e}`).join("\n"), "Tips"), c.outro(F.brand(`All set. Run ${F.command("pnpm dev")} to start your app.`));
|
|
9567
9772
|
}
|
|
9568
|
-
async function
|
|
9773
|
+
async function jh(e, t, n) {
|
|
9569
9774
|
let r = t.onboarding?.envVars ?? [], i = t.onboarding?.envSections ?? [], a = [];
|
|
9570
9775
|
for (let e of n) {
|
|
9571
9776
|
let t = T.join(T.dirname(e), ".env"), [n, o] = await Promise.all([C.readFile(e, "utf-8"), ps(t)]);
|
|
@@ -9585,31 +9790,40 @@ async function mh(e, t, n) {
|
|
|
9585
9790
|
}
|
|
9586
9791
|
return a;
|
|
9587
9792
|
}
|
|
9588
|
-
async function
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9793
|
+
async function Mh(e) {
|
|
9794
|
+
let t = [], n = Fh(e);
|
|
9795
|
+
if (n.size === 0) return t;
|
|
9796
|
+
let r = [...n.entries()].map(([e, t]) => `${F.bold(e)} ${F.muted(`(${t.length})`)}`).join(", ");
|
|
9797
|
+
c.log.step(`Keys needed for: ${r}`);
|
|
9798
|
+
for (let [e, r] of n) {
|
|
9799
|
+
let n = `${r.length} value${r.length === 1 ? "" : "s"}`;
|
|
9800
|
+
if (!await Ih(`Set up ${F.bold(e)} now? ${F.muted(`(${n})`)}`, !0)) {
|
|
9801
|
+
t.push(...r);
|
|
9802
|
+
continue;
|
|
9803
|
+
}
|
|
9804
|
+
await Lh(r);
|
|
9592
9805
|
}
|
|
9806
|
+
return t;
|
|
9593
9807
|
}
|
|
9594
|
-
async function
|
|
9808
|
+
async function Nh(e) {
|
|
9595
9809
|
let t = [];
|
|
9596
|
-
for (let [n, r] of
|
|
9810
|
+
for (let [n, r] of Fh(e)) {
|
|
9597
9811
|
let e = r.every((e) => e.isSet), i = `${r.length} value${r.length === 1 ? "" : "s"}`;
|
|
9598
|
-
if (!await
|
|
9812
|
+
if (!await Ih(e ? `Update ${F.bold(n)}? ${F.muted(`(${i}, already set)`)}` : `Set up ${F.bold(n)} now? ${F.muted(`(${i}, optional)`)}`)) {
|
|
9599
9813
|
t.push(...r.filter((e) => !e.isSet));
|
|
9600
9814
|
continue;
|
|
9601
9815
|
}
|
|
9602
|
-
await
|
|
9816
|
+
await Lh(r);
|
|
9603
9817
|
}
|
|
9604
9818
|
return t;
|
|
9605
9819
|
}
|
|
9606
|
-
async function
|
|
9607
|
-
for (let [t, n] of
|
|
9820
|
+
async function Ph(e) {
|
|
9821
|
+
for (let [t, n] of Fh(e)) {
|
|
9608
9822
|
let e = `${n.length} value${n.length === 1 ? "" : "s"}`;
|
|
9609
|
-
await
|
|
9823
|
+
await Ih(`Update ${F.bold(t)}? ${F.muted(`(${e}, already set)`)}`) && await Lh(n);
|
|
9610
9824
|
}
|
|
9611
9825
|
}
|
|
9612
|
-
function
|
|
9826
|
+
function Fh(e) {
|
|
9613
9827
|
let t = /* @__PURE__ */ new Map();
|
|
9614
9828
|
for (let n of e) {
|
|
9615
9829
|
let e = n.setup.group ?? n.section, r = t.get(e);
|
|
@@ -9617,20 +9831,20 @@ function vh(e) {
|
|
|
9617
9831
|
}
|
|
9618
9832
|
return t;
|
|
9619
9833
|
}
|
|
9620
|
-
async function
|
|
9621
|
-
let
|
|
9834
|
+
async function Ih(e, t = !1) {
|
|
9835
|
+
let n = await c.confirm({
|
|
9622
9836
|
message: e,
|
|
9623
|
-
initialValue:
|
|
9837
|
+
initialValue: t
|
|
9624
9838
|
});
|
|
9625
|
-
return c.isCancel(
|
|
9839
|
+
return c.isCancel(n) && B(), n === !0;
|
|
9626
9840
|
}
|
|
9627
|
-
async function
|
|
9841
|
+
async function Lh(e) {
|
|
9628
9842
|
let t = Ti(e[0].section);
|
|
9629
9843
|
t.link && c.log.info(F.muted(t.link));
|
|
9630
|
-
for (let [t, n] of e.entries()) await
|
|
9844
|
+
for (let [t, n] of e.entries()) await Rh(n, `${t + 1}/${e.length}`);
|
|
9631
9845
|
}
|
|
9632
|
-
async function
|
|
9633
|
-
let n = Ti(e.section), r = await
|
|
9846
|
+
async function Rh(e, t) {
|
|
9847
|
+
let n = Ti(e.section), r = await kh({
|
|
9634
9848
|
key: e.key,
|
|
9635
9849
|
section: e.section,
|
|
9636
9850
|
linkUrl: n.link,
|
|
@@ -9643,7 +9857,7 @@ async function xh(e, t) {
|
|
|
9643
9857
|
let i = (typeof r == "string" ? r : "").trim();
|
|
9644
9858
|
i !== "" && await hs(e.envPath, e.key, i);
|
|
9645
9859
|
}
|
|
9646
|
-
function
|
|
9860
|
+
function zh(e, t) {
|
|
9647
9861
|
if (e.length === 0) return;
|
|
9648
9862
|
let n = /* @__PURE__ */ new Map();
|
|
9649
9863
|
for (let t of e) {
|
|
@@ -9663,16 +9877,16 @@ function Sh(e, t) {
|
|
|
9663
9877
|
}
|
|
9664
9878
|
//#endregion
|
|
9665
9879
|
//#region src/core/templates.ts
|
|
9666
|
-
var
|
|
9880
|
+
var Bh = Vr.createRequest()({
|
|
9667
9881
|
endpoint: "/templates/list",
|
|
9668
9882
|
method: "GET"
|
|
9669
9883
|
});
|
|
9670
|
-
async function
|
|
9671
|
-
let { data: e, error: t } = await
|
|
9884
|
+
async function Vh() {
|
|
9885
|
+
let { data: e, error: t } = await Bh.send();
|
|
9672
9886
|
if (t || !e) throw Error(`Failed to fetch template list: ${String(t)}`);
|
|
9673
9887
|
return e.templates;
|
|
9674
9888
|
}
|
|
9675
|
-
async function
|
|
9889
|
+
async function Hh(e) {
|
|
9676
9890
|
let { data: t, error: n, status: r } = await Vr.createRequest()({
|
|
9677
9891
|
endpoint: `/templates/${encodeURIComponent(e)}/manifest`,
|
|
9678
9892
|
method: "GET"
|
|
@@ -9681,7 +9895,7 @@ async function Th(e) {
|
|
|
9681
9895
|
if (n || !t) throw Error(`Failed to load manifest for template "${e}": ${String(n)}`);
|
|
9682
9896
|
return t;
|
|
9683
9897
|
}
|
|
9684
|
-
async function
|
|
9898
|
+
async function Uh(e, t = {}) {
|
|
9685
9899
|
let n = Vr.createRequest()({
|
|
9686
9900
|
endpoint: `/templates/${encodeURIComponent(e)}/download`,
|
|
9687
9901
|
method: "POST"
|
|
@@ -9717,7 +9931,7 @@ async function Eh(e, t = {}) {
|
|
|
9717
9931
|
}
|
|
9718
9932
|
//#endregion
|
|
9719
9933
|
//#region src/commands/template.ts
|
|
9720
|
-
async function
|
|
9934
|
+
async function Wh(t = {}) {
|
|
9721
9935
|
let n = t.cwd ?? process.cwd();
|
|
9722
9936
|
ll(), await Gc();
|
|
9723
9937
|
let r = c.spinner();
|
|
@@ -9731,7 +9945,7 @@ async function Dh(t = {}) {
|
|
|
9731
9945
|
r.stop("Packs loaded"), r.start("Loading templates...");
|
|
9732
9946
|
let a;
|
|
9733
9947
|
try {
|
|
9734
|
-
a = await
|
|
9948
|
+
a = await Vh();
|
|
9735
9949
|
} catch (e) {
|
|
9736
9950
|
r.stop("Failed to load templates"), z(`Could not reach Hype Stack. Check your connection and try again.\n${ju(e)}`);
|
|
9737
9951
|
}
|
|
@@ -9754,7 +9968,7 @@ async function Dh(t = {}) {
|
|
|
9754
9968
|
s || (r.stop("Template not found"), z(`Template "${o}" not found. Available: ${a.map((e) => e.id).join(", ") || "(none)"}`)), r.stop(`Template: ${s.name}`);
|
|
9755
9969
|
let l;
|
|
9756
9970
|
try {
|
|
9757
|
-
l = await
|
|
9971
|
+
l = await Hh(s.id);
|
|
9758
9972
|
} catch (e) {
|
|
9759
9973
|
z(ju(e));
|
|
9760
9974
|
}
|
|
@@ -9776,7 +9990,7 @@ async function Dh(t = {}) {
|
|
|
9776
9990
|
p || z(d ? `Could not read ${F.path("stack.json")}. Run 'npx @hype-stack/cli init' to regenerate it, then run 'npx @hype-stack/cli template' again.` : `No ${F.path("stack.json")}. Run 'npx @hype-stack/cli init' first, then 'npx @hype-stack/cli template'.`), p.paths || z(`${F.path("stack.json")} is missing ${F.path("paths")}. Run 'npx @hype-stack/cli init' again to regenerate it.`);
|
|
9777
9991
|
let m = d ?? n;
|
|
9778
9992
|
c.intro(F.brandBold("Install a template"));
|
|
9779
|
-
let h = p.installedPacks ?? [], g = new Set(h), v = new Map(i.map((e) => [e.name, e])), y = (await He(M()))?.token ?? null, b = await
|
|
9993
|
+
let h = p.installedPacks ?? [], g = new Set(h), v = new Map(i.map((e) => [e.name, e])), y = (await He(M()))?.token ?? null, b = await Gh(s, t.variants, t.yes ?? !1), x = Xc(s.slots, b), S = Zc(s.slots, s.packs, x), w = await Kh({
|
|
9780
9994
|
packs: i,
|
|
9781
9995
|
templatePacks: S,
|
|
9782
9996
|
installedSet: g,
|
|
@@ -9851,7 +10065,7 @@ async function Dh(t = {}) {
|
|
|
9851
10065
|
r.stop("Files installed"), n.installed.length > 0 && c.log.success(`${F.highlight(String(n.installed.length))} files installed`), n.skipped.length > 0 && (c.log.warning(`${n.skipped.length} files skipped (use --force to overwrite)`), Bu(n.skipped));
|
|
9852
10066
|
for (let e of n.errors) c.log.error(e);
|
|
9853
10067
|
r.start("Applying template overrides...");
|
|
9854
|
-
let i = await
|
|
10068
|
+
let i = await Uh(s.id, { token: y });
|
|
9855
10069
|
i.status === "denied" && (r.stop("Template download denied"), z(Iu(s.id, i.reason))), oe = i.templateDir;
|
|
9856
10070
|
let a = await _c({
|
|
9857
10071
|
manifest: l,
|
|
@@ -9882,7 +10096,7 @@ async function Dh(t = {}) {
|
|
|
9882
10096
|
customization: n
|
|
9883
10097
|
}), c.log.success(`Applied the ${Xs(n.theme)} theme, ${e(n.radius)} corners, and ${n.mode} mode`);
|
|
9884
10098
|
}
|
|
9885
|
-
await
|
|
10099
|
+
await qh({
|
|
9886
10100
|
prepared: ie,
|
|
9887
10101
|
templateNpm: l.dependencies_npm,
|
|
9888
10102
|
paths: p.paths,
|
|
@@ -9909,7 +10123,7 @@ async function Dh(t = {}) {
|
|
|
9909
10123
|
});
|
|
9910
10124
|
}
|
|
9911
10125
|
}
|
|
9912
|
-
async function
|
|
10126
|
+
async function Gh(e, t, n) {
|
|
9913
10127
|
let r = {};
|
|
9914
10128
|
for (let i of e.slots) {
|
|
9915
10129
|
if (t?.[i.family]) {
|
|
@@ -9933,7 +10147,7 @@ async function Oh(e, t, n) {
|
|
|
9933
10147
|
}
|
|
9934
10148
|
return r;
|
|
9935
10149
|
}
|
|
9936
|
-
async function
|
|
10150
|
+
async function Kh(e) {
|
|
9937
10151
|
let { packs: t, templatePacks: n, installedSet: r, options: i } = e, a = new Set(n);
|
|
9938
10152
|
if (i.packs && i.packs.length > 0) {
|
|
9939
10153
|
let e = i.packs.filter((e) => !t.some((t) => t.name === e));
|
|
@@ -9955,7 +10169,7 @@ async function kh(e) {
|
|
|
9955
10169
|
});
|
|
9956
10170
|
return _(c) && z("Cancelled.", { code: 0 }), c;
|
|
9957
10171
|
}
|
|
9958
|
-
async function
|
|
10172
|
+
async function qh(e) {
|
|
9959
10173
|
let { prepared: t, templateNpm: n, paths: r, cwd: i, spinner: a } = e, o = ku(t.map((e) => e.manifest.dependencies_npm)), s = Ou(n ? ku([o, n]) : o, r);
|
|
9960
10174
|
if (s.errors.length > 0) {
|
|
9961
10175
|
for (let e of s.errors) c.log.error(e);
|
|
@@ -9968,9 +10182,9 @@ async function Ah(e) {
|
|
|
9968
10182
|
}
|
|
9969
10183
|
//#endregion
|
|
9970
10184
|
//#region src/mcp/guard.ts
|
|
9971
|
-
var
|
|
9972
|
-
function
|
|
9973
|
-
if (
|
|
10185
|
+
var Jh = null;
|
|
10186
|
+
function Yh() {
|
|
10187
|
+
if (Jh) return Jh.protocolStream;
|
|
9974
10188
|
let e = process.stdout.write.bind(process.stdout), t = process.stdout.write, n = console.log, r = console.info, i = console.debug, a = console.dir, o = new ue({
|
|
9975
10189
|
write(t, n, r) {
|
|
9976
10190
|
e(t, (e) => r(e ?? null));
|
|
@@ -9979,7 +10193,7 @@ function Mh() {
|
|
|
9979
10193
|
e();
|
|
9980
10194
|
}
|
|
9981
10195
|
}), s = ((e, t, n) => typeof t == "function" ? process.stderr.write(e, t) : process.stderr.write(e, t, n));
|
|
9982
|
-
return process.stdout.write = s, console.log = console.error, console.info = console.error, console.debug = console.error, console.dir = console.error,
|
|
10196
|
+
return process.stdout.write = s, console.log = console.error, console.info = console.error, console.debug = console.error, console.dir = console.error, Jh = {
|
|
9983
10197
|
protocolStream: o,
|
|
9984
10198
|
restore: () => {
|
|
9985
10199
|
process.stdout.write = t, console.log = n, console.info = r, console.debug = i, console.dir = a;
|
|
@@ -9988,22 +10202,22 @@ function Mh() {
|
|
|
9988
10202
|
}
|
|
9989
10203
|
//#endregion
|
|
9990
10204
|
//#region src/mcp/result.ts
|
|
9991
|
-
async function
|
|
10205
|
+
async function Xh(e) {
|
|
9992
10206
|
$e();
|
|
9993
10207
|
try {
|
|
9994
|
-
return
|
|
10208
|
+
return Zh({
|
|
9995
10209
|
...await e(),
|
|
9996
10210
|
ok: !0,
|
|
9997
10211
|
logs: et()
|
|
9998
10212
|
}, !1);
|
|
9999
10213
|
} catch (e) {
|
|
10000
|
-
return nt(e) ?
|
|
10214
|
+
return nt(e) ? Zh({
|
|
10001
10215
|
ok: !1,
|
|
10002
10216
|
reason: e.reason,
|
|
10003
10217
|
message: e.message,
|
|
10004
10218
|
details: e.details,
|
|
10005
10219
|
logs: et()
|
|
10006
|
-
}, !1) :
|
|
10220
|
+
}, !1) : Zh({
|
|
10007
10221
|
ok: !1,
|
|
10008
10222
|
reason: "failed",
|
|
10009
10223
|
message: e instanceof Error ? e.message : String(e),
|
|
@@ -10012,7 +10226,7 @@ async function Nh(e) {
|
|
|
10012
10226
|
}, !0);
|
|
10013
10227
|
}
|
|
10014
10228
|
}
|
|
10015
|
-
function
|
|
10229
|
+
function Zh(e, t) {
|
|
10016
10230
|
return {
|
|
10017
10231
|
content: [{
|
|
10018
10232
|
type: "text",
|
|
@@ -10024,7 +10238,7 @@ function Ph(e, t) {
|
|
|
10024
10238
|
}
|
|
10025
10239
|
//#endregion
|
|
10026
10240
|
//#region src/mcp/tools/context.ts
|
|
10027
|
-
async function
|
|
10241
|
+
async function Qh() {
|
|
10028
10242
|
let e = await He(M());
|
|
10029
10243
|
return e ? {
|
|
10030
10244
|
token: e.token,
|
|
@@ -10034,26 +10248,26 @@ async function Fh() {
|
|
|
10034
10248
|
source: "none"
|
|
10035
10249
|
};
|
|
10036
10250
|
}
|
|
10037
|
-
function
|
|
10251
|
+
function $h(e) {
|
|
10038
10252
|
return T.resolve(e ?? process.cwd());
|
|
10039
10253
|
}
|
|
10040
|
-
var
|
|
10254
|
+
var eg = {
|
|
10041
10255
|
envVar: N,
|
|
10042
10256
|
loginCommand: "npx @hype-stack/cli login"
|
|
10043
|
-
},
|
|
10257
|
+
}, tg = {
|
|
10044
10258
|
packs: j.array(j.string()).min(1).describe("Pack names to install. Append @frontend or @admin to a layout pack to target one shell."),
|
|
10045
10259
|
cwd: j.string().optional().describe("Project directory. Defaults to the workspace the server was started in."),
|
|
10046
10260
|
onConflict: j.enum(["keep", "overwrite"]).default("keep").describe("What to do with files that already exist: keep them, or let the pack overwrite them")
|
|
10047
10261
|
};
|
|
10048
|
-
async function
|
|
10049
|
-
let t =
|
|
10262
|
+
async function ng(e) {
|
|
10263
|
+
let t = $h(e.cwd), n = await rg(t);
|
|
10050
10264
|
await Gu({
|
|
10051
10265
|
cwd: t,
|
|
10052
10266
|
packs: e.packs,
|
|
10053
10267
|
force: e.onConflict === "overwrite",
|
|
10054
10268
|
yes: !0
|
|
10055
10269
|
});
|
|
10056
|
-
let r = await
|
|
10270
|
+
let r = await rg(t), i = r.filter((e) => !n.includes(e));
|
|
10057
10271
|
return {
|
|
10058
10272
|
cwd: t,
|
|
10059
10273
|
installed: i,
|
|
@@ -10061,21 +10275,21 @@ async function zh(e) {
|
|
|
10061
10275
|
followUp: i.length > 0 ? [...Ec, "npx @hype-stack/cli onboard"] : []
|
|
10062
10276
|
};
|
|
10063
10277
|
}
|
|
10064
|
-
async function
|
|
10278
|
+
async function rg(e) {
|
|
10065
10279
|
return (await q(e).catch(() => null))?.installedPacks ?? [];
|
|
10066
10280
|
}
|
|
10067
10281
|
//#endregion
|
|
10068
10282
|
//#region src/mcp/tools/apply-template.ts
|
|
10069
|
-
var
|
|
10283
|
+
var ig = {
|
|
10070
10284
|
templateId: j.string().min(1).describe("Template id, e.g. vault. Use search_catalog to find one."),
|
|
10071
10285
|
cwd: j.string().optional().describe("Project directory. Defaults to the workspace the server was started in."),
|
|
10072
10286
|
variants: j.record(j.string(), j.string()).optional().describe("Slot overrides keyed by family, e.g. { \"starter-saas\": \"starter-saas-better-auth\" }"),
|
|
10073
10287
|
packs: j.array(j.string()).optional().describe("Extra packs to install on top of the template"),
|
|
10074
10288
|
onConflict: j.enum(["keep", "overwrite"]).default("keep").describe("What to do with files that already exist: keep them, or let the template overwrite them")
|
|
10075
10289
|
};
|
|
10076
|
-
async function
|
|
10077
|
-
let t =
|
|
10078
|
-
await
|
|
10290
|
+
async function ag(e) {
|
|
10291
|
+
let t = $h(e.cwd), n = await og(t);
|
|
10292
|
+
await Wh({
|
|
10079
10293
|
cwd: t,
|
|
10080
10294
|
templateId: e.templateId,
|
|
10081
10295
|
variants: e.variants,
|
|
@@ -10083,7 +10297,7 @@ async function Hh(e) {
|
|
|
10083
10297
|
force: e.onConflict === "overwrite",
|
|
10084
10298
|
yes: !0
|
|
10085
10299
|
});
|
|
10086
|
-
let r = await
|
|
10300
|
+
let r = await og(t);
|
|
10087
10301
|
return {
|
|
10088
10302
|
cwd: t,
|
|
10089
10303
|
templateId: e.templateId,
|
|
@@ -10092,21 +10306,21 @@ async function Hh(e) {
|
|
|
10092
10306
|
followUp: [...Ec, "npx @hype-stack/cli onboard"]
|
|
10093
10307
|
};
|
|
10094
10308
|
}
|
|
10095
|
-
async function
|
|
10309
|
+
async function og(e) {
|
|
10096
10310
|
return (await q(e).catch(() => null))?.installedPacks ?? [];
|
|
10097
10311
|
}
|
|
10098
10312
|
//#endregion
|
|
10099
10313
|
//#region src/mcp/tools/auth-status.ts
|
|
10100
|
-
var
|
|
10101
|
-
async function
|
|
10102
|
-
let { token: e, source: t } = await
|
|
10314
|
+
var sg = {};
|
|
10315
|
+
async function cg() {
|
|
10316
|
+
let { token: e, source: t } = await Qh();
|
|
10103
10317
|
if (!e) return {
|
|
10104
10318
|
authenticated: !1,
|
|
10105
10319
|
tokenSource: "none",
|
|
10106
10320
|
apiUrl: M(),
|
|
10107
|
-
hint: `Run '${
|
|
10321
|
+
hint: `Run '${eg.loginCommand}' in your terminal, or add ${eg.envVar} to this server's env block in your editor's MCP config.`,
|
|
10108
10322
|
apiKeysUrl: `${Me()}/api-keys`,
|
|
10109
|
-
...
|
|
10323
|
+
...eg
|
|
10110
10324
|
};
|
|
10111
10325
|
let n = await Hr(e);
|
|
10112
10326
|
return n ? {
|
|
@@ -10119,14 +10333,14 @@ async function Gh() {
|
|
|
10119
10333
|
authenticated: !1,
|
|
10120
10334
|
tokenSource: t,
|
|
10121
10335
|
apiUrl: M(),
|
|
10122
|
-
hint: t === "env" ? `The token in ${
|
|
10336
|
+
hint: t === "env" ? `The token in ${eg.envVar} was rejected. It may be expired or revoked; mint a new one.` : `Your saved login was rejected. Run '${eg.loginCommand}' again.`,
|
|
10123
10337
|
apiKeysUrl: `${Me()}/api-keys`,
|
|
10124
|
-
...
|
|
10338
|
+
...eg
|
|
10125
10339
|
};
|
|
10126
10340
|
}
|
|
10127
10341
|
//#endregion
|
|
10128
10342
|
//#region src/mcp/tools/create-application.ts
|
|
10129
|
-
var
|
|
10343
|
+
var lg = {
|
|
10130
10344
|
name: j.string().min(1).describe("Application name. Becomes the folder name and the package scope."),
|
|
10131
10345
|
directory: j.string().optional().describe("Parent folder to create the app inside. Defaults to the current workspace."),
|
|
10132
10346
|
editors: j.array(j.enum(be)).optional().describe("AI editors to ship rule formats for. Pass every editor the team uses, they coexist. Defaults to cursor."),
|
|
@@ -10137,8 +10351,8 @@ var Kh = {
|
|
|
10137
10351
|
adminRadius: j.string().optional().describe("Admin corner radius. Defaults to the frontend radius."),
|
|
10138
10352
|
mode: j.enum(["light", "dark"]).optional().describe("Color mode the app boots in")
|
|
10139
10353
|
};
|
|
10140
|
-
async function
|
|
10141
|
-
let t =
|
|
10354
|
+
async function ug(e) {
|
|
10355
|
+
let t = $h(e.directory), n = dg(e), r = await Hu({
|
|
10142
10356
|
name: e.name,
|
|
10143
10357
|
parentDirectory: t,
|
|
10144
10358
|
editors: n,
|
|
@@ -10154,19 +10368,19 @@ async function qh(e) {
|
|
|
10154
10368
|
return {
|
|
10155
10369
|
projectRoot: r,
|
|
10156
10370
|
editors: n,
|
|
10157
|
-
mcpConfigPaths:
|
|
10371
|
+
mcpConfigPaths: fg(n, r),
|
|
10158
10372
|
followUp: [`cd ${r}`, ...Ec]
|
|
10159
10373
|
};
|
|
10160
10374
|
}
|
|
10161
|
-
function
|
|
10375
|
+
function dg(e) {
|
|
10162
10376
|
let { editors: t, unknown: n } = we([...e.editors ?? [], ...e.editor ? [e.editor] : []]);
|
|
10163
10377
|
if (n.length > 0) throw Error(`Unknown editor "${n.join(", ")}". Expected one of: ${be.join(", ")}.`);
|
|
10164
10378
|
return t.length > 0 ? t : [xe];
|
|
10165
10379
|
}
|
|
10166
|
-
function
|
|
10167
|
-
return tu(e).map((e) =>
|
|
10380
|
+
function fg(e, t) {
|
|
10381
|
+
return tu(e).map((e) => pg(e, t)).filter((e) => e !== null);
|
|
10168
10382
|
}
|
|
10169
|
-
function
|
|
10383
|
+
function pg(e, t) {
|
|
10170
10384
|
try {
|
|
10171
10385
|
return ru({
|
|
10172
10386
|
editor: e,
|
|
@@ -10179,8 +10393,8 @@ function Xh(e, t) {
|
|
|
10179
10393
|
}
|
|
10180
10394
|
//#endregion
|
|
10181
10395
|
//#region src/core/env-status.ts
|
|
10182
|
-
async function
|
|
10183
|
-
let n = t?.onboarding?.envSections ?? [], r = t?.onboarding?.envVars ?? [], i = await cs(e), a = await Promise.all(i.map((t) =>
|
|
10396
|
+
async function mg(e, t) {
|
|
10397
|
+
let n = t?.onboarding?.envSections ?? [], r = t?.onboarding?.envVars ?? [], i = await cs(e), a = await Promise.all(i.map((t) => hg({
|
|
10184
10398
|
examplePath: t,
|
|
10185
10399
|
projectRoot: e,
|
|
10186
10400
|
installedEnvSections: n,
|
|
@@ -10191,7 +10405,7 @@ async function Zh(e, t) {
|
|
|
10191
10405
|
missingCount: a.reduce((e, t) => e + t.sections.filter((e) => e.relevant).reduce((e, t) => e + t.vars.filter((e) => e.setup === "required" && e.state !== "filled").length, 0), 0)
|
|
10192
10406
|
};
|
|
10193
10407
|
}
|
|
10194
|
-
async function
|
|
10408
|
+
async function hg(e) {
|
|
10195
10409
|
let { examplePath: t, projectRoot: n, installedEnvSections: r, recorded: i } = e, a = T.join(T.dirname(t), ".env"), o = await C.readFile(t, "utf-8"), s = await ps(a), c = ls(o).map((e) => {
|
|
10196
10410
|
let t = Ti(e.section);
|
|
10197
10411
|
return {
|
|
@@ -10202,7 +10416,7 @@ async function Qh(e) {
|
|
|
10202
10416
|
let t = Li(e.key, i, r);
|
|
10203
10417
|
return {
|
|
10204
10418
|
key: e.key,
|
|
10205
|
-
state:
|
|
10419
|
+
state: gg(us(s, e.key), e.value),
|
|
10206
10420
|
setup: t?.setup ?? null,
|
|
10207
10421
|
...t?.group ? { group: t.group } : {}
|
|
10208
10422
|
};
|
|
@@ -10216,20 +10430,20 @@ async function Qh(e) {
|
|
|
10216
10430
|
sections: c
|
|
10217
10431
|
};
|
|
10218
10432
|
}
|
|
10219
|
-
function
|
|
10433
|
+
function gg(e, t) {
|
|
10220
10434
|
return e === "" ? "missing" : e === t.trim() ? "default" : "filled";
|
|
10221
10435
|
}
|
|
10222
10436
|
//#endregion
|
|
10223
10437
|
//#region src/mcp/tools/env-status.ts
|
|
10224
|
-
var
|
|
10225
|
-
async function
|
|
10226
|
-
let t =
|
|
10438
|
+
var _g = { cwd: j.string().optional().describe("Project directory. Defaults to the workspace the server was started in.") };
|
|
10439
|
+
async function vg(e) {
|
|
10440
|
+
let t = $h(e.cwd), n = await q(t).catch(() => null);
|
|
10227
10441
|
if (!n) throw new tt({
|
|
10228
10442
|
reason: "not_a_project",
|
|
10229
10443
|
message: `${t} has no stack.json, so there is nothing to check.`,
|
|
10230
10444
|
details: { cwd: t }
|
|
10231
10445
|
});
|
|
10232
|
-
let r = await
|
|
10446
|
+
let r = await mg(t, n);
|
|
10233
10447
|
return {
|
|
10234
10448
|
cwd: t,
|
|
10235
10449
|
missingCount: r.missingCount,
|
|
@@ -10239,9 +10453,9 @@ async function tg(e) {
|
|
|
10239
10453
|
}
|
|
10240
10454
|
//#endregion
|
|
10241
10455
|
//#region src/mcp/tools/inspect-stack.ts
|
|
10242
|
-
var
|
|
10243
|
-
async function
|
|
10244
|
-
let t =
|
|
10456
|
+
var yg = { cwd: j.string().optional().describe("Project directory. Defaults to the workspace the server was started in.") };
|
|
10457
|
+
async function bg(e) {
|
|
10458
|
+
let t = $h(e.cwd), n = await q(t).catch(() => null);
|
|
10245
10459
|
if (!n) throw new tt({
|
|
10246
10460
|
reason: "not_a_project",
|
|
10247
10461
|
message: await Gi(t) ? `${t} is a Hype Stack project but has no stack.json. Run 'npx @hype-stack/cli init' in it.` : `${t} is not a Hype Stack project.`,
|
|
@@ -10268,12 +10482,12 @@ async function rg(e) {
|
|
|
10268
10482
|
}
|
|
10269
10483
|
//#endregion
|
|
10270
10484
|
//#region src/mcp/tools/plan-install.ts
|
|
10271
|
-
var
|
|
10485
|
+
var xg = {
|
|
10272
10486
|
packs: j.array(j.string()).min(1).describe("Pack names to plan an install for"),
|
|
10273
10487
|
cwd: j.string().optional().describe("Project directory. Defaults to the workspace the server was started in.")
|
|
10274
10488
|
};
|
|
10275
|
-
async function
|
|
10276
|
-
let t =
|
|
10489
|
+
async function Sg(e) {
|
|
10490
|
+
let t = $h(e.cwd), { token: n, source: r } = await Qh(), i = await q(t).catch(() => null), a = i?.installedPacks ?? [], o = await Zi(), s = new Map(o.map((e) => [e.name, e])), c = e.packs.filter((e) => !s.has(e));
|
|
10277
10491
|
if (c.length > 0) throw Error(`Unknown pack${c.length === 1 ? "" : "s"}: ${c.join(", ")}`);
|
|
10278
10492
|
let l = Kc(o), u = Jc(e.packs, l, a), d = await Mu(u.order.map((e) => s.get(e)).filter((e) => e !== void 0), new Set(a), { token: n }), f = (e) => {
|
|
10279
10493
|
let t = s.get(e);
|
|
@@ -10302,12 +10516,12 @@ async function ag(e) {
|
|
|
10302
10516
|
purchaseUrl: n ? Ct(e) : null
|
|
10303
10517
|
};
|
|
10304
10518
|
}),
|
|
10305
|
-
...n === null ? { authHint:
|
|
10519
|
+
...n === null ? { authHint: eg } : {}
|
|
10306
10520
|
};
|
|
10307
10521
|
}
|
|
10308
10522
|
//#endregion
|
|
10309
10523
|
//#region src/mcp/tools/search-catalog.ts
|
|
10310
|
-
var
|
|
10524
|
+
var Cg = {
|
|
10311
10525
|
query: j.string().optional().describe("Free text matched against name, display name, and description"),
|
|
10312
10526
|
kind: j.enum([
|
|
10313
10527
|
"pack",
|
|
@@ -10320,31 +10534,31 @@ var og = {
|
|
|
10320
10534
|
"paid",
|
|
10321
10535
|
"all"
|
|
10322
10536
|
]).default("all").describe("Restrict packs by price tier")
|
|
10323
|
-
},
|
|
10537
|
+
}, wg = (e, t) => {
|
|
10324
10538
|
let n = t.trim().toLowerCase();
|
|
10325
10539
|
return n === "" ? !0 : e.some((e) => e.toLowerCase().includes(n));
|
|
10326
10540
|
};
|
|
10327
|
-
function
|
|
10541
|
+
function Tg(e, t) {
|
|
10328
10542
|
let { query: n = "", category: r, tier: i = "all" } = t;
|
|
10329
|
-
return e.filter((e) => r && e.category !== r || i !== "all" && e.tier !== i ? !1 :
|
|
10543
|
+
return e.filter((e) => r && e.category !== r || i !== "all" && e.tier !== i ? !1 : wg([
|
|
10330
10544
|
e.name,
|
|
10331
10545
|
e.displayName,
|
|
10332
10546
|
e.description
|
|
10333
10547
|
], n));
|
|
10334
10548
|
}
|
|
10335
|
-
function
|
|
10549
|
+
function Eg(e, t) {
|
|
10336
10550
|
let { query: n = "", category: r } = t;
|
|
10337
|
-
return e.filter((e) => r && e.category !== r ? !1 :
|
|
10551
|
+
return e.filter((e) => r && e.category !== r ? !1 : wg([
|
|
10338
10552
|
e.id,
|
|
10339
10553
|
e.name,
|
|
10340
10554
|
e.description,
|
|
10341
10555
|
...e.tags
|
|
10342
10556
|
], n));
|
|
10343
10557
|
}
|
|
10344
|
-
async function
|
|
10345
|
-
let t = e.kind ?? "all", [n, r] = await Promise.all([t === "template" ? Promise.resolve([]) : Zi(), t === "pack" ? Promise.resolve([]) :
|
|
10558
|
+
async function Dg(e) {
|
|
10559
|
+
let t = e.kind ?? "all", [n, r] = await Promise.all([t === "template" ? Promise.resolve([]) : Zi(), t === "pack" ? Promise.resolve([]) : Vh()]);
|
|
10346
10560
|
return {
|
|
10347
|
-
packs:
|
|
10561
|
+
packs: Tg(n, e).map((e) => ({
|
|
10348
10562
|
name: e.name,
|
|
10349
10563
|
displayName: e.displayName,
|
|
10350
10564
|
description: e.description,
|
|
@@ -10353,7 +10567,7 @@ async function ug(e) {
|
|
|
10353
10567
|
price: e.price,
|
|
10354
10568
|
dependencies: e.dependencies
|
|
10355
10569
|
})),
|
|
10356
|
-
templates:
|
|
10570
|
+
templates: Eg(r, e).map((e) => ({
|
|
10357
10571
|
id: e.id,
|
|
10358
10572
|
name: e.name,
|
|
10359
10573
|
description: e.description,
|
|
@@ -10370,117 +10584,117 @@ async function ug(e) {
|
|
|
10370
10584
|
}
|
|
10371
10585
|
//#endregion
|
|
10372
10586
|
//#region src/mcp/server.ts
|
|
10373
|
-
var
|
|
10374
|
-
function
|
|
10587
|
+
var Og = "hype-stack";
|
|
10588
|
+
function kg() {
|
|
10375
10589
|
let e = new ce({
|
|
10376
|
-
name:
|
|
10590
|
+
name: Og,
|
|
10377
10591
|
version: de
|
|
10378
10592
|
}, {
|
|
10379
10593
|
capabilities: { tools: {} },
|
|
10380
|
-
instructions:
|
|
10594
|
+
instructions: Ag
|
|
10381
10595
|
});
|
|
10382
10596
|
return e.registerTool("search_catalog", {
|
|
10383
10597
|
title: "Search the Hype Stack catalog",
|
|
10384
10598
|
description: "Find feature packs and project templates by keyword, category, or price tier. Read-only. Start here when the user asks what is available.",
|
|
10385
|
-
inputSchema:
|
|
10599
|
+
inputSchema: Cg,
|
|
10386
10600
|
annotations: {
|
|
10387
10601
|
readOnlyHint: !0,
|
|
10388
10602
|
openWorldHint: !0
|
|
10389
10603
|
}
|
|
10390
|
-
}, (e) =>
|
|
10604
|
+
}, (e) => Xh(() => Dg(e))), e.registerTool("plan_install", {
|
|
10391
10605
|
title: "Plan a pack install",
|
|
10392
10606
|
description: "Work out what installing a set of packs would do without writing anything: dependency order, packs already present, and which ones the current license does not cover. Call this before add_packs.",
|
|
10393
|
-
inputSchema:
|
|
10607
|
+
inputSchema: xg,
|
|
10394
10608
|
annotations: {
|
|
10395
10609
|
readOnlyHint: !0,
|
|
10396
10610
|
openWorldHint: !0
|
|
10397
10611
|
}
|
|
10398
|
-
}, (e) =>
|
|
10612
|
+
}, (e) => Xh(() => Sg(e))), e.registerTool("create_application", {
|
|
10399
10613
|
title: "Create a Hype Stack application",
|
|
10400
10614
|
description: "Scaffold a new application into a folder. Runs the clone and dependency install; Docker and database migrations are returned as follow-up commands for the user to run.",
|
|
10401
|
-
inputSchema:
|
|
10615
|
+
inputSchema: lg,
|
|
10402
10616
|
annotations: {
|
|
10403
10617
|
readOnlyHint: !1,
|
|
10404
10618
|
destructiveHint: !1,
|
|
10405
10619
|
openWorldHint: !0
|
|
10406
10620
|
}
|
|
10407
|
-
}, (e) =>
|
|
10621
|
+
}, (e) => Xh(() => ug(e))), e.registerTool("add_packs", {
|
|
10408
10622
|
title: "Add feature packs",
|
|
10409
10623
|
description: "Install packs into an existing project. Requires an explicit onConflict policy because there is no prompt to fall back on.",
|
|
10410
|
-
inputSchema:
|
|
10624
|
+
inputSchema: tg,
|
|
10411
10625
|
annotations: {
|
|
10412
10626
|
readOnlyHint: !1,
|
|
10413
10627
|
destructiveHint: !0,
|
|
10414
10628
|
openWorldHint: !0
|
|
10415
10629
|
}
|
|
10416
|
-
}, (e) =>
|
|
10630
|
+
}, (e) => Xh(() => ng(e))), e.registerTool("apply_template", {
|
|
10417
10631
|
title: "Apply a project template",
|
|
10418
10632
|
description: "Install a template: its starter, layout, fixed packs, and frontend overrides. Pass variants to swap a slot away from the template default.",
|
|
10419
|
-
inputSchema:
|
|
10633
|
+
inputSchema: ig,
|
|
10420
10634
|
annotations: {
|
|
10421
10635
|
readOnlyHint: !1,
|
|
10422
10636
|
destructiveHint: !0,
|
|
10423
10637
|
openWorldHint: !0
|
|
10424
10638
|
}
|
|
10425
|
-
}, (e) =>
|
|
10639
|
+
}, (e) => Xh(() => ag(e))), e.registerTool("inspect_stack", {
|
|
10426
10640
|
title: "Inspect the project stack",
|
|
10427
10641
|
description: "Read stack.json and the detected workspace layout: installed packs, app paths, and whether this is a Hype Stack project at all.",
|
|
10428
|
-
inputSchema:
|
|
10642
|
+
inputSchema: yg,
|
|
10429
10643
|
annotations: {
|
|
10430
10644
|
readOnlyHint: !0,
|
|
10431
10645
|
openWorldHint: !1
|
|
10432
10646
|
}
|
|
10433
|
-
}, (e) =>
|
|
10647
|
+
}, (e) => Xh(() => bg(e))), e.registerTool("env_status", {
|
|
10434
10648
|
title: "Check environment variables",
|
|
10435
10649
|
description: "Report which env vars the installed packs still need. Read-only; filling them in belongs in the user's own terminal via `hype-stack onboard`.",
|
|
10436
|
-
inputSchema:
|
|
10650
|
+
inputSchema: _g,
|
|
10437
10651
|
annotations: {
|
|
10438
10652
|
readOnlyHint: !0,
|
|
10439
10653
|
openWorldHint: !1
|
|
10440
10654
|
}
|
|
10441
|
-
}, (e) =>
|
|
10655
|
+
}, (e) => Xh(() => vg(e))), e.registerTool("auth_status", {
|
|
10442
10656
|
title: "Check Hype Stack authentication",
|
|
10443
10657
|
description: "Who this server is authenticated as, and how to fix it when the answer is nobody. Call this whenever another tool fails with auth_required.",
|
|
10444
|
-
inputSchema:
|
|
10658
|
+
inputSchema: sg,
|
|
10445
10659
|
annotations: {
|
|
10446
10660
|
readOnlyHint: !0,
|
|
10447
10661
|
openWorldHint: !0
|
|
10448
10662
|
}
|
|
10449
|
-
}, () =>
|
|
10663
|
+
}, () => Xh(() => cg())), e;
|
|
10450
10664
|
}
|
|
10451
|
-
var
|
|
10452
|
-
async function
|
|
10665
|
+
var Ag = "Tools for building with Hype Stack, a full-stack template you install feature packs into.\n\nThis server cannot prompt. When a tool returns ok: false, read the \"reason\" field and tell the user what to do:\n- auth_required: they need to run 'npx @hype-stack/cli login' in their own terminal, or set HYPE_STACK_TOKEN in this server's env block.\n- not_owned: the pack is paid and their organization does not have a license. The result carries a purchase URL.\n- not_a_project: run create_application first, or point the tool at the right directory with cwd.\n- conflicts: files already exist. Retry with onConflict set once the user has decided.\n\nInstalls never start Docker or touch a database. Anything the user has to run themselves comes back in \"followUp\".";
|
|
10666
|
+
async function jg() {
|
|
10453
10667
|
Je("mcp");
|
|
10454
|
-
let e =
|
|
10455
|
-
await
|
|
10668
|
+
let e = Yh();
|
|
10669
|
+
await kg().connect(new le(process.stdin, e));
|
|
10456
10670
|
}
|
|
10457
10671
|
//#endregion
|
|
10458
10672
|
//#region src/cli.ts
|
|
10459
|
-
function
|
|
10673
|
+
function Mg(e) {
|
|
10460
10674
|
if (!e) return;
|
|
10461
10675
|
let t = e.split(",").map((e) => e.trim()).filter((e) => e.length > 0);
|
|
10462
10676
|
return t.length > 0 ? t : void 0;
|
|
10463
10677
|
}
|
|
10464
|
-
function
|
|
10678
|
+
function Ng(e, t) {
|
|
10465
10679
|
let n = e.split(",").map((e) => e.trim()).filter((e) => e.length > 0);
|
|
10466
10680
|
return [...t ?? [], ...n];
|
|
10467
10681
|
}
|
|
10468
|
-
function
|
|
10682
|
+
function Pg(e) {
|
|
10469
10683
|
return e === "light" || e === "dark" ? e : void 0;
|
|
10470
10684
|
}
|
|
10471
|
-
function
|
|
10685
|
+
function Fg(e) {
|
|
10472
10686
|
return e.option("-t, --theme <theme>", `Frontend color theme (${i.join(", ")})`).option("--admin-theme <theme>", "Admin app color theme (defaults to --theme)").option("--radius <value>", `Frontend corner radius, a CSS length (e.g. ${t.map((e) => e.value).join(", ")})`).option("--admin-radius <value>", "Admin app corner radius (defaults to --radius)").option("--mode <mode>", "Color mode the app boots in (light, dark)");
|
|
10473
10687
|
}
|
|
10474
|
-
function
|
|
10688
|
+
function Ig(e) {
|
|
10475
10689
|
return {
|
|
10476
10690
|
theme: e.theme,
|
|
10477
10691
|
adminTheme: e.adminTheme,
|
|
10478
10692
|
radius: e.radius,
|
|
10479
10693
|
adminRadius: e.adminRadius,
|
|
10480
|
-
mode:
|
|
10694
|
+
mode: Pg(e.mode)
|
|
10481
10695
|
};
|
|
10482
10696
|
}
|
|
10483
|
-
function
|
|
10697
|
+
function Lg(e) {
|
|
10484
10698
|
if (!e) return;
|
|
10485
10699
|
let t = {};
|
|
10486
10700
|
for (let n of e.split(",")) {
|
|
@@ -10489,12 +10703,12 @@ function bg(e) {
|
|
|
10489
10703
|
}
|
|
10490
10704
|
return Object.keys(t).length > 0 ? t : void 0;
|
|
10491
10705
|
}
|
|
10492
|
-
function
|
|
10706
|
+
function Rg(e) {
|
|
10493
10707
|
if (!e) return;
|
|
10494
10708
|
let t = e.split(",").map((e) => e.trim()).filter((e) => e.length > 0);
|
|
10495
10709
|
return t.length > 0 ? t : void 0;
|
|
10496
10710
|
}
|
|
10497
|
-
function
|
|
10711
|
+
function zg(e) {
|
|
10498
10712
|
let t = {};
|
|
10499
10713
|
for (let n of [...bd, ...xd]) {
|
|
10500
10714
|
let r = e[n];
|
|
@@ -10502,10 +10716,10 @@ function Sg(e) {
|
|
|
10502
10716
|
}
|
|
10503
10717
|
return t;
|
|
10504
10718
|
}
|
|
10505
|
-
function
|
|
10719
|
+
function Bg() {
|
|
10506
10720
|
let e = new s();
|
|
10507
|
-
e.name("hype-stack").description("Build with Hype Stack -- templates, components, modules, and more").version(de, "-v, --version"),
|
|
10508
|
-
let t =
|
|
10721
|
+
e.name("hype-stack").description("Build with Hype Stack -- templates, components, modules, and more").version(de, "-v, --version"), Fg(e.command("create").description("Create a new Hype Stack project").option("-n, --name <name>", "Project name").option("-d, --directory <path>", "Target directory").option("-e, --editor <editors>", `AI editors to ship rules for, comma-separated or repeated (${be.join(", ")})`, Ng)).option("--no-install", "Skip dependency installation").option("--no-setup", "Skip Docker services and database migrations after create").option("-y, --yes", "Skip confirmation prompts (requires --name)").action(async (e) => {
|
|
10722
|
+
let t = Ig(e);
|
|
10509
10723
|
await Hu({
|
|
10510
10724
|
name: e.name,
|
|
10511
10725
|
directory: e.directory,
|
|
@@ -10522,34 +10736,34 @@ function Cg() {
|
|
|
10522
10736
|
}), e.command("init").description("Initialize stack.json in the current project").action(async () => {
|
|
10523
10737
|
await Uu({});
|
|
10524
10738
|
}), e.command("onboard").description("Set up env vars and get the start command").option("-y, --yes", "Skip prompts, accept defaults").option("--cwd <path>", "Working directory").action(async (e) => {
|
|
10525
|
-
await
|
|
10739
|
+
await Ah({
|
|
10526
10740
|
cwd: e.cwd,
|
|
10527
10741
|
yes: e.yes
|
|
10528
10742
|
});
|
|
10529
|
-
}),
|
|
10743
|
+
}), Fg(e.command("compose").description("Choose feature packs to add to your project").option("--packs <list>", "Comma-separated pack names (non-interactive). Append @frontend or @admin to a layout pack to target that app shell, e.g. layout-basic@frontend,layout-native-app-shell@admin")).option("--force", "Overwrite existing files").option("-y, --yes", "Skip confirmation prompts").option("--cwd <path>", "Working directory").action(async (e) => {
|
|
10530
10744
|
await Gu({
|
|
10531
|
-
packs:
|
|
10745
|
+
packs: Mg(e.packs),
|
|
10532
10746
|
force: e.force,
|
|
10533
10747
|
yes: e.yes,
|
|
10534
10748
|
cwd: e.cwd,
|
|
10535
|
-
...
|
|
10749
|
+
...Ig(e)
|
|
10536
10750
|
});
|
|
10537
|
-
}),
|
|
10538
|
-
await
|
|
10751
|
+
}), Fg(e.command("template").description("Install a template by id, with starter/layout variant swaps and extra packs on top").argument("[id]", "Template id (omit to pick interactively)").option("--variants <map>", "Preselect slot variants, e.g. starter-saas=starter-saas-better-auth,layout=layout-basic").option("--packs <list>", "Extra packs to add on top of the template (comma-separated)")).option("--force", "Overwrite existing files").option("-y, --yes", "Skip confirmation prompts (requires <id>)").option("--cwd <path>", "Working directory").action(async (e, t) => {
|
|
10752
|
+
await Wh({
|
|
10539
10753
|
templateId: e,
|
|
10540
|
-
variants:
|
|
10541
|
-
packs:
|
|
10754
|
+
variants: Lg(t.variants),
|
|
10755
|
+
packs: Mg(t.packs),
|
|
10542
10756
|
force: t.force,
|
|
10543
10757
|
yes: t.yes,
|
|
10544
10758
|
cwd: t.cwd,
|
|
10545
|
-
...
|
|
10759
|
+
...Ig(t)
|
|
10546
10760
|
});
|
|
10547
10761
|
}), e.command("deploy").description("Deploy the frontend, admin, and backend, and provision Postgres, Valkey, and a bucket").option("-p, --provider <provider>", `Provider for everything not assigned separately (${Sd.join(", ")})`).option("--backend <provider>", "Provider hosting the backend API").option("--frontend <provider>", "Provider hosting the frontend").option("--admin <provider>", "Provider hosting the admin app").option("--postgres <provider>", "Provider for the Postgres database").option("--valkey <provider>", "Provider for the Valkey cache").option("--bucket <provider>", "Provider for object storage").option("--only <targets>", `Deploy just these apps, comma-separated (${bd.join(", ")})`).option("-e, --environment <name>", "Deployment environment name (default: production)").option("--fly-org <org>", "Fly organization slug, skips the picker when you belong to several").option("--railway-workspace <workspace>", "Railway workspace, skips the picker when you belong to several").option("--dry-run", "Print every command that would run without creating anything").option("--skip-provision", "Assume Postgres, Valkey, and the bucket already exist").option("--skip-migrations", "Do not run database migrations after the backend deploys").option("-y, --yes", "Skip confirmation prompts").option("--cwd <path>", "Project directory").action(async (e) => {
|
|
10548
|
-
await
|
|
10762
|
+
await ch({
|
|
10549
10763
|
cwd: e.cwd,
|
|
10550
10764
|
provider: e.provider,
|
|
10551
|
-
assign:
|
|
10552
|
-
only:
|
|
10765
|
+
assign: zg(e),
|
|
10766
|
+
only: Rg(e.only),
|
|
10553
10767
|
environment: e.environment,
|
|
10554
10768
|
flyOrg: e.flyOrg,
|
|
10555
10769
|
railwayWorkspace: e.railwayWorkspace,
|
|
@@ -10561,9 +10775,9 @@ function Cg() {
|
|
|
10561
10775
|
});
|
|
10562
10776
|
let t = e.command("mcp").description("Run the Model Context Protocol server for AI editors");
|
|
10563
10777
|
return t.action(async () => {
|
|
10564
|
-
await
|
|
10778
|
+
await jg();
|
|
10565
10779
|
}), t.command("install").description("Register the MCP server in your editor's config").option("-e, --editor <editor>", `Editor (${Xl.join(", ")})`, "cursor").option("-s, --scope <scope>", "global or project (defaults to global where supported)").option("--cwd <path>", "Project directory, for project scope").option("--token <token>", "API key to store in the config (optional, defaults to your saved login)").option("--print", "Print the JSON block instead of writing a file").action(async (e) => {
|
|
10566
|
-
await
|
|
10780
|
+
await xh({
|
|
10567
10781
|
editor: e.editor,
|
|
10568
10782
|
scope: e.scope,
|
|
10569
10783
|
cwd: e.cwd,
|
|
@@ -10571,12 +10785,12 @@ function Cg() {
|
|
|
10571
10785
|
print: e.print
|
|
10572
10786
|
});
|
|
10573
10787
|
}), e.command("login").description("Log in via your browser to install packs your organization owns").action(async () => {
|
|
10574
|
-
await
|
|
10788
|
+
await yh();
|
|
10575
10789
|
}), e.command("logout").description("Log out and remove the saved CLI token").action(async () => {
|
|
10576
|
-
await
|
|
10790
|
+
await bh();
|
|
10577
10791
|
}), e.command("auth").description("Alias for `login`").action(async () => {
|
|
10578
|
-
await
|
|
10792
|
+
await yh();
|
|
10579
10793
|
}), e;
|
|
10580
10794
|
}
|
|
10581
10795
|
//#endregion
|
|
10582
|
-
export {
|
|
10796
|
+
export { ch as a, Uu as c, de as d, yh as i, Hu as l, Yh as n, Gu as o, bh as r, Wu as s, Bg as t, Je as u };
|