@hype-stack/cli 1.1.0 → 1.1.1
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-DdPVabIO.js → cli-BQlmo5KI.js} +495 -439
- package/dist/config/bin.js +1 -1
- package/dist/deploy/auth.d.ts +2 -1
- package/dist/deploy/auth.d.ts.map +1 -1
- package/dist/deploy/providers/fly.d.ts.map +1 -1
- package/dist/deploy/providers/railway.d.ts.map +1 -1
- package/dist/deploy/providers/types.d.ts +23 -0
- package/dist/deploy/providers/types.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ import { McpServer as se } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
17
17
|
import { StdioServerTransport as ce } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
18
18
|
import { Writable as le } from "node:stream";
|
|
19
19
|
//#region src/constants/constants.ts
|
|
20
|
-
var ue = "1.1.
|
|
20
|
+
var ue = "1.1.1", de = "gh:BetterTyped/hype-stack", fe = "stack.json", pe = "/schema/stack.json", me = "https://api.hype-stack.dev", he = "HYPE_STACK_API_URL", ge = "https://www.hype-stack.dev", _e = /^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/, ve = [
|
|
21
21
|
{
|
|
22
22
|
value: "cursor",
|
|
23
23
|
label: "Cursor",
|
|
@@ -6562,7 +6562,6 @@ function ad(e) {
|
|
|
6562
6562
|
}) : typeof t == "object" && t ? Object.values(t).filter((e) => typeof e == "string") : [];
|
|
6563
6563
|
}
|
|
6564
6564
|
async function od(e) {
|
|
6565
|
-
if (e.plan.fly.org) return e.plan.fly.org;
|
|
6566
6565
|
let t = await e.runner.run({
|
|
6567
6566
|
command: "fly",
|
|
6568
6567
|
args: [
|
|
@@ -6574,18 +6573,21 @@ async function od(e) {
|
|
|
6574
6573
|
allowFailure: !0,
|
|
6575
6574
|
label: "find your Fly organization"
|
|
6576
6575
|
});
|
|
6577
|
-
|
|
6578
|
-
let n = ad(t.stdout);
|
|
6579
|
-
if (n.length !== 0) {
|
|
6580
|
-
if (n.length > 1) throw Error(`Your Fly account belongs to ${n.length} organizations (${n.join(", ")}). Pass --fly-org <slug> so the deploy creates everything in the right one.`);
|
|
6581
|
-
return e.plan.fly.org = n[0], n[0];
|
|
6582
|
-
}
|
|
6576
|
+
return t.exitCode === 0 ? ad(t.stdout) : [];
|
|
6583
6577
|
}
|
|
6584
6578
|
async function sd(e) {
|
|
6579
|
+
if (e.plan.fly.org) return e.plan.fly.org;
|
|
6585
6580
|
let t = await od(e);
|
|
6581
|
+
if (t.length !== 0) {
|
|
6582
|
+
if (t.length > 1) throw Error(`Your Fly account belongs to ${t.length} organizations (${t.join(", ")}). Pass --fly-org <slug> so the deploy creates everything in the right one.`);
|
|
6583
|
+
return e.plan.fly.org = t[0], t[0];
|
|
6584
|
+
}
|
|
6585
|
+
}
|
|
6586
|
+
async function cd(e) {
|
|
6587
|
+
let t = await sd(e);
|
|
6586
6588
|
return t ? ["--org", t] : [];
|
|
6587
6589
|
}
|
|
6588
|
-
function
|
|
6590
|
+
function ld(e) {
|
|
6589
6591
|
let t = {};
|
|
6590
6592
|
for (let n of e.split(/\r?\n/)) {
|
|
6591
6593
|
let e = n.match(/^\s*([A-Za-z][A-Za-z0-9_ ]*?)\s*[:=]\s*(\S.*?)\s*$/);
|
|
@@ -6595,19 +6597,19 @@ function cd(e) {
|
|
|
6595
6597
|
}
|
|
6596
6598
|
return t;
|
|
6597
6599
|
}
|
|
6598
|
-
function
|
|
6600
|
+
function ud(e) {
|
|
6599
6601
|
let t = e.match(/\brediss?:\/\/\S+/);
|
|
6600
6602
|
return t ? t[0].replace(/[.,)]+$/, "") : null;
|
|
6601
6603
|
}
|
|
6602
|
-
function
|
|
6604
|
+
function dd(e) {
|
|
6603
6605
|
let t = e.match(/^\w+:\/\/[^/@:]*:([^@]+)@/);
|
|
6604
6606
|
return t ? decodeURIComponent(t[1]) : null;
|
|
6605
6607
|
}
|
|
6606
|
-
function
|
|
6608
|
+
function fd(e) {
|
|
6607
6609
|
let t = e.match(/\bpostgres(?:ql)?:\/\/\S+/);
|
|
6608
6610
|
return t ? t[0].replace(/[.,)]+$/, "") : null;
|
|
6609
6611
|
}
|
|
6610
|
-
function
|
|
6612
|
+
function pd(e, t) {
|
|
6611
6613
|
let n = $u(e);
|
|
6612
6614
|
if (!Array.isArray(n)) return null;
|
|
6613
6615
|
for (let e of n) {
|
|
@@ -6620,7 +6622,7 @@ function fd(e, t) {
|
|
|
6620
6622
|
}
|
|
6621
6623
|
return null;
|
|
6622
6624
|
}
|
|
6623
|
-
function
|
|
6625
|
+
function md(e) {
|
|
6624
6626
|
let t = $u(e);
|
|
6625
6627
|
if (typeof t != "object" || !t) return null;
|
|
6626
6628
|
let n = t.credentials;
|
|
@@ -6632,7 +6634,7 @@ function pd(e) {
|
|
|
6632
6634
|
}
|
|
6633
6635
|
return null;
|
|
6634
6636
|
}
|
|
6635
|
-
var
|
|
6637
|
+
var hd = {
|
|
6636
6638
|
id: "fly",
|
|
6637
6639
|
async checkAuth(e) {
|
|
6638
6640
|
let t = await e.runner.run({
|
|
@@ -6649,6 +6651,15 @@ var md = {
|
|
|
6649
6651
|
account: t.stdout.trim().split("\n").pop()?.trim()
|
|
6650
6652
|
};
|
|
6651
6653
|
},
|
|
6654
|
+
scope: {
|
|
6655
|
+
label: "organization",
|
|
6656
|
+
flag: "--fly-org",
|
|
6657
|
+
list: od,
|
|
6658
|
+
current: (e) => e.fly.org,
|
|
6659
|
+
pin: (e, t) => {
|
|
6660
|
+
e.fly.org = t;
|
|
6661
|
+
}
|
|
6662
|
+
},
|
|
6652
6663
|
async reserveTarget(e, t) {
|
|
6653
6664
|
let n = await e.runner.run({
|
|
6654
6665
|
command: "fly",
|
|
@@ -6657,7 +6668,7 @@ var md = {
|
|
|
6657
6668
|
"create",
|
|
6658
6669
|
t.app,
|
|
6659
6670
|
"--json",
|
|
6660
|
-
...await
|
|
6671
|
+
...await cd(e)
|
|
6661
6672
|
],
|
|
6662
6673
|
cwd: e.cwd,
|
|
6663
6674
|
allowFailure: !0,
|
|
@@ -6671,7 +6682,7 @@ var md = {
|
|
|
6671
6682
|
return n.external ? {
|
|
6672
6683
|
outputs: n.external,
|
|
6673
6684
|
note: "using the external values from stack.json"
|
|
6674
|
-
} : n.service === "postgres" ?
|
|
6685
|
+
} : n.service === "postgres" ? gd(e, t) : n.service === "valkey" ? bd(e, t) : Sd(e, t);
|
|
6675
6686
|
},
|
|
6676
6687
|
async setEnv(e, t) {
|
|
6677
6688
|
let n = Object.entries(t.env);
|
|
@@ -6749,10 +6760,10 @@ var md = {
|
|
|
6749
6760
|
};
|
|
6750
6761
|
}
|
|
6751
6762
|
};
|
|
6752
|
-
async function
|
|
6753
|
-
let { service: n, backend: r, crossProvider: i } = t, a = await
|
|
6763
|
+
async function gd(e, t) {
|
|
6764
|
+
let { service: n, backend: r, crossProvider: i } = t, a = await _d(e, n.name), o = a ?? await vd(e, t);
|
|
6754
6765
|
if (i || !r) {
|
|
6755
|
-
let t = await
|
|
6766
|
+
let t = await yd(e, o);
|
|
6756
6767
|
if (!t) throw Error(`The Fly Postgres cluster "${n.name}" exists, but Fly did not return its connection string. Run \`fly mpg status ${o.id} --json\` and set deploy.services.postgres.external.DATABASE_URL in stack.json.`);
|
|
6757
6768
|
return {
|
|
6758
6769
|
outputs: { DATABASE_URL: t },
|
|
@@ -6782,29 +6793,29 @@ async function hd(e, t) {
|
|
|
6782
6793
|
providedByProvider: ["DATABASE_URL"],
|
|
6783
6794
|
note: `already attached to ${r.app}`
|
|
6784
6795
|
};
|
|
6785
|
-
let c = await
|
|
6796
|
+
let c = await yd(e, o);
|
|
6786
6797
|
if (!c) throw Error(`Could not attach the Fly Postgres cluster "${n.name}" to ${r.app}, and could not read its connection string either:\n${s.stderr.trim() || s.stdout.trim()}`);
|
|
6787
6798
|
return {
|
|
6788
6799
|
outputs: { DATABASE_URL: c },
|
|
6789
6800
|
note: "attach failed, wired the connection string instead"
|
|
6790
6801
|
};
|
|
6791
6802
|
}
|
|
6792
|
-
async function
|
|
6803
|
+
async function _d(e, t) {
|
|
6793
6804
|
let n = await e.runner.run({
|
|
6794
6805
|
command: "fly",
|
|
6795
6806
|
args: [
|
|
6796
6807
|
"mpg",
|
|
6797
6808
|
"list",
|
|
6798
6809
|
"--json",
|
|
6799
|
-
...await
|
|
6810
|
+
...await cd(e)
|
|
6800
6811
|
],
|
|
6801
6812
|
cwd: e.cwd,
|
|
6802
6813
|
allowFailure: !0,
|
|
6803
6814
|
label: "look for an existing postgres cluster"
|
|
6804
6815
|
});
|
|
6805
|
-
return n.exitCode === 0 ?
|
|
6816
|
+
return n.exitCode === 0 ? pd(n.stdout, t) : null;
|
|
6806
6817
|
}
|
|
6807
|
-
async function
|
|
6818
|
+
async function vd(e, t) {
|
|
6808
6819
|
let { service: n } = t, r = await e.runner.run({
|
|
6809
6820
|
command: "fly",
|
|
6810
6821
|
args: [
|
|
@@ -6816,7 +6827,7 @@ async function _d(e, t) {
|
|
|
6816
6827
|
n.region ?? "iad",
|
|
6817
6828
|
"--plan",
|
|
6818
6829
|
e.plan.fly?.postgresPlan ?? "basic",
|
|
6819
|
-
...await
|
|
6830
|
+
...await cd(e)
|
|
6820
6831
|
],
|
|
6821
6832
|
cwd: e.cwd,
|
|
6822
6833
|
allowFailure: !0,
|
|
@@ -6828,11 +6839,11 @@ async function _d(e, t) {
|
|
|
6828
6839
|
id: i,
|
|
6829
6840
|
name: n.name
|
|
6830
6841
|
};
|
|
6831
|
-
let a = await
|
|
6842
|
+
let a = await _d(e, n.name);
|
|
6832
6843
|
if (a) return a;
|
|
6833
6844
|
throw Error(`Fly reported that the Postgres cluster "${n.name}" was created, but it is not in \`fly mpg list\`. Check https://fly.io/dashboard and run deploy again.`);
|
|
6834
6845
|
}
|
|
6835
|
-
async function
|
|
6846
|
+
async function yd(e, t) {
|
|
6836
6847
|
let n = await e.runner.run({
|
|
6837
6848
|
command: "fly",
|
|
6838
6849
|
args: [
|
|
@@ -6845,9 +6856,9 @@ async function vd(e, t) {
|
|
|
6845
6856
|
allowFailure: !0,
|
|
6846
6857
|
label: `read postgres status ${t.name}`
|
|
6847
6858
|
});
|
|
6848
|
-
return
|
|
6859
|
+
return md(n.stdout) ?? fd(n.stdout);
|
|
6849
6860
|
}
|
|
6850
|
-
async function
|
|
6861
|
+
async function bd(e, t) {
|
|
6851
6862
|
let { service: n } = t, r = await e.runner.run({
|
|
6852
6863
|
command: "fly",
|
|
6853
6864
|
args: [
|
|
@@ -6858,9 +6869,9 @@ async function yd(e, t) {
|
|
|
6858
6869
|
cwd: e.cwd,
|
|
6859
6870
|
allowFailure: !0,
|
|
6860
6871
|
label: `look for an existing valkey ${n.name}`
|
|
6861
|
-
}), i = r.exitCode === 0 ?
|
|
6872
|
+
}), i = r.exitCode === 0 ? ud(r.stdout + r.stderr) : null;
|
|
6862
6873
|
if (i) return {
|
|
6863
|
-
outputs:
|
|
6874
|
+
outputs: xd(i),
|
|
6864
6875
|
note: "reusing the existing database"
|
|
6865
6876
|
};
|
|
6866
6877
|
let a = await e.runner.run({
|
|
@@ -6875,23 +6886,23 @@ async function yd(e, t) {
|
|
|
6875
6886
|
"--no-replicas",
|
|
6876
6887
|
"--enable-eviction",
|
|
6877
6888
|
"--enable-prodpack=false",
|
|
6878
|
-
...await
|
|
6889
|
+
...await cd(e)
|
|
6879
6890
|
],
|
|
6880
6891
|
cwd: e.cwd,
|
|
6881
6892
|
allowFailure: !0,
|
|
6882
6893
|
label: `create valkey ${n.name}`
|
|
6883
|
-
}), o =
|
|
6894
|
+
}), o = ud(a.stdout + a.stderr);
|
|
6884
6895
|
if (!o) throw Error(`Could not read the connection URL for the Fly Redis database "${n.name}":\n${a.stderr.trim() || a.stdout.trim()}\nRun \`fly redis status ${n.name}\` and set deploy.services.valkey.external.VALKEY_URL in stack.json.`);
|
|
6885
|
-
return { outputs:
|
|
6896
|
+
return { outputs: xd(o) };
|
|
6886
6897
|
}
|
|
6887
|
-
function
|
|
6888
|
-
let t =
|
|
6898
|
+
function xd(e) {
|
|
6899
|
+
let t = dd(e);
|
|
6889
6900
|
return {
|
|
6890
6901
|
VALKEY_URL: e,
|
|
6891
6902
|
...t ? { VALKEY_PASSWORD: t } : {}
|
|
6892
6903
|
};
|
|
6893
6904
|
}
|
|
6894
|
-
async function
|
|
6905
|
+
async function Sd(e, t) {
|
|
6895
6906
|
let { service: n, backend: r, crossProvider: i } = t, a = n.name, o = await e.runner.run({
|
|
6896
6907
|
command: "fly",
|
|
6897
6908
|
args: [
|
|
@@ -6900,28 +6911,28 @@ async function xd(e, t) {
|
|
|
6900
6911
|
"--name",
|
|
6901
6912
|
a,
|
|
6902
6913
|
"--yes",
|
|
6903
|
-
...await
|
|
6914
|
+
...await cd(e)
|
|
6904
6915
|
],
|
|
6905
6916
|
cwd: e.cwd,
|
|
6906
6917
|
allowFailure: !0,
|
|
6907
6918
|
label: `create tigris bucket ${a}`
|
|
6908
|
-
}), s =
|
|
6919
|
+
}), s = Ed(ld(o.stdout + o.stderr), a);
|
|
6909
6920
|
if (s) return { outputs: s };
|
|
6910
6921
|
if (!rd.test(o.stderr + o.stdout)) throw Error(`Could not read the Tigris credentials for "${a}":\n${o.stderr.trim() || o.stdout.trim()}\nRun \`fly storage create --name ${a}\` yourself and copy the credentials into deploy.services.bucket.external in stack.json.`);
|
|
6911
|
-
if (!i && r && await
|
|
6922
|
+
if (!i && r && await Td(e, r.app)) return {
|
|
6912
6923
|
outputs: {},
|
|
6913
|
-
providedByProvider: [...
|
|
6924
|
+
providedByProvider: [...Cd],
|
|
6914
6925
|
note: `already set on ${r.app} by an earlier deploy`
|
|
6915
6926
|
};
|
|
6916
6927
|
throw Error(`The Tigris bucket "${a}" already exists and Fly will not show its keys again, and ${r ? `${r.app} does not have them set` : "there is no Fly app here holding them"}. Copy them into deploy.services.bucket.external in stack.json, or pick a different name with deploy.services.bucket.name.`);
|
|
6917
6928
|
}
|
|
6918
|
-
var
|
|
6929
|
+
var Cd = [
|
|
6919
6930
|
"RUSTFS_ENDPOINT",
|
|
6920
6931
|
"RUSTFS_ACCESS_KEY",
|
|
6921
6932
|
"RUSTFS_SECRET_KEY",
|
|
6922
6933
|
"BUCKET_NAME"
|
|
6923
6934
|
];
|
|
6924
|
-
function
|
|
6935
|
+
function wd(e) {
|
|
6925
6936
|
let t = $u(e);
|
|
6926
6937
|
return Array.isArray(t) ? t.flatMap((e) => {
|
|
6927
6938
|
if (typeof e != "object" || !e) return [];
|
|
@@ -6929,7 +6940,7 @@ function Cd(e) {
|
|
|
6929
6940
|
return typeof n == "string" ? [n] : [];
|
|
6930
6941
|
}) : [];
|
|
6931
6942
|
}
|
|
6932
|
-
async function
|
|
6943
|
+
async function Td(e, t) {
|
|
6933
6944
|
let n = await e.runner.run({
|
|
6934
6945
|
command: "fly",
|
|
6935
6946
|
args: [
|
|
@@ -6944,10 +6955,10 @@ async function wd(e, t) {
|
|
|
6944
6955
|
label: `check the storage keys already on ${t}`
|
|
6945
6956
|
});
|
|
6946
6957
|
if (n.exitCode !== 0) return !1;
|
|
6947
|
-
let r = new Set(
|
|
6948
|
-
return
|
|
6958
|
+
let r = new Set(wd(n.stdout));
|
|
6959
|
+
return Cd.every((e) => r.has(e));
|
|
6949
6960
|
}
|
|
6950
|
-
function
|
|
6961
|
+
function Ed(e, t) {
|
|
6951
6962
|
let n = e.AWS_ACCESS_KEY_ID, r = e.AWS_SECRET_ACCESS_KEY;
|
|
6952
6963
|
return !n || !r ? null : {
|
|
6953
6964
|
RUSTFS_ENDPOINT: e.AWS_ENDPOINT_URL_S3 ?? "https://t3.storage.dev",
|
|
@@ -6958,36 +6969,36 @@ function Td(e, t) {
|
|
|
6958
6969
|
}
|
|
6959
6970
|
//#endregion
|
|
6960
6971
|
//#region src/deploy/providers/railway.ts
|
|
6961
|
-
var
|
|
6962
|
-
function
|
|
6972
|
+
var Dd = "Postgres", Od = "Redis", kd = "rustfs/rustfs:latest", Ad = 9e3, jd = /already exists|duplicate|is already/i;
|
|
6973
|
+
function Md(e) {
|
|
6963
6974
|
let t = e.trim();
|
|
6964
6975
|
if (t.startsWith("{") || t.startsWith("[")) {
|
|
6965
|
-
let e = $u(t), n = e === null ? null :
|
|
6966
|
-
if (n) return
|
|
6976
|
+
let e = $u(t), n = e === null ? null : Pd(e);
|
|
6977
|
+
if (n) return Nd(n);
|
|
6967
6978
|
}
|
|
6968
6979
|
let n = t.match(/[a-z0-9-]+(?:\.[a-z0-9-]+)*\.(?:up\.railway\.app|railway\.app)/i);
|
|
6969
|
-
return n ?
|
|
6980
|
+
return n ? Nd(n[0]) : null;
|
|
6970
6981
|
}
|
|
6971
|
-
function
|
|
6982
|
+
function Nd(e) {
|
|
6972
6983
|
return `https://${e.replace(/^https?:\/\//i, "").replace(/\/+$/, "")}`;
|
|
6973
6984
|
}
|
|
6974
|
-
function
|
|
6985
|
+
function Pd(e) {
|
|
6975
6986
|
if (typeof e == "string") return /\.railway\.app/i.test(e) ? e : null;
|
|
6976
6987
|
if (Array.isArray(e)) {
|
|
6977
6988
|
for (let t of e) {
|
|
6978
|
-
let e =
|
|
6989
|
+
let e = Pd(t);
|
|
6979
6990
|
if (e) return e;
|
|
6980
6991
|
}
|
|
6981
6992
|
return null;
|
|
6982
6993
|
}
|
|
6983
6994
|
if (typeof e == "object" && e) for (let [t, n] of Object.entries(e)) {
|
|
6984
6995
|
if ((t === "domain" || t === "url" || t === "host") && typeof n == "string" && n.length > 0) return n;
|
|
6985
|
-
let e =
|
|
6996
|
+
let e = Pd(n);
|
|
6986
6997
|
if (e) return e;
|
|
6987
6998
|
}
|
|
6988
6999
|
return null;
|
|
6989
7000
|
}
|
|
6990
|
-
function
|
|
7001
|
+
function Fd(e) {
|
|
6991
7002
|
let t = $u(e.trim());
|
|
6992
7003
|
if (!Array.isArray(t)) return [];
|
|
6993
7004
|
let n = [];
|
|
@@ -7001,7 +7012,7 @@ function Pd(e) {
|
|
|
7001
7012
|
}
|
|
7002
7013
|
return n;
|
|
7003
7014
|
}
|
|
7004
|
-
function
|
|
7015
|
+
function Id(e) {
|
|
7005
7016
|
let t = e.trim();
|
|
7006
7017
|
if (t.startsWith("{")) {
|
|
7007
7018
|
let e = $u(t);
|
|
@@ -7018,7 +7029,7 @@ function Fd(e) {
|
|
|
7018
7029
|
}
|
|
7019
7030
|
return n;
|
|
7020
7031
|
}
|
|
7021
|
-
var
|
|
7032
|
+
var Ld = {
|
|
7022
7033
|
id: "railway",
|
|
7023
7034
|
async checkAuth(e) {
|
|
7024
7035
|
let t = await e.runner.run({
|
|
@@ -7035,10 +7046,19 @@ var Id = {
|
|
|
7035
7046
|
account: t.stdout.trim().split("\n").pop()?.trim()
|
|
7036
7047
|
};
|
|
7037
7048
|
},
|
|
7049
|
+
scope: {
|
|
7050
|
+
label: "workspace",
|
|
7051
|
+
flag: "--railway-workspace",
|
|
7052
|
+
list: Ud,
|
|
7053
|
+
current: (e) => e.railway.workspace,
|
|
7054
|
+
pin: (e, t) => {
|
|
7055
|
+
e.railway.workspace = t;
|
|
7056
|
+
}
|
|
7057
|
+
},
|
|
7038
7058
|
async reserveTarget(e, t) {
|
|
7039
|
-
await
|
|
7059
|
+
await Bd(e);
|
|
7040
7060
|
let n = t.spec.serveMode === "static" ? _u : t.spec.port ?? 3e3;
|
|
7041
|
-
if (!await
|
|
7061
|
+
if (!await Gd(e, t.app)) {
|
|
7042
7062
|
let r = await e.runner.run({
|
|
7043
7063
|
command: "railway",
|
|
7044
7064
|
args: [
|
|
@@ -7053,7 +7073,7 @@ var Id = {
|
|
|
7053
7073
|
allowFailure: !0,
|
|
7054
7074
|
label: `create railway service ${t.app}`
|
|
7055
7075
|
});
|
|
7056
|
-
if (r.exitCode !== 0 && !
|
|
7076
|
+
if (r.exitCode !== 0 && !jd.test(r.stderr + r.stdout)) throw Error(`Could not create the Railway service "${t.app}":\n${r.stderr.trim() || r.stdout.trim()}`);
|
|
7057
7077
|
}
|
|
7058
7078
|
if (t.url) return t.url;
|
|
7059
7079
|
let r = await e.runner.run({
|
|
@@ -7069,7 +7089,7 @@ var Id = {
|
|
|
7069
7089
|
cwd: e.cwd,
|
|
7070
7090
|
allowFailure: !0,
|
|
7071
7091
|
label: `generate domain for ${t.app}`
|
|
7072
|
-
}), i =
|
|
7092
|
+
}), i = Md(r.stdout + r.stderr);
|
|
7073
7093
|
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.`);
|
|
7074
7094
|
return i;
|
|
7075
7095
|
},
|
|
@@ -7078,23 +7098,23 @@ var Id = {
|
|
|
7078
7098
|
return n.external ? {
|
|
7079
7099
|
outputs: n.external,
|
|
7080
7100
|
note: "using the external values from stack.json"
|
|
7081
|
-
} : (await
|
|
7101
|
+
} : (await Bd(e), n.service === "postgres" ? Kd(e, {
|
|
7082
7102
|
database: "postgres",
|
|
7083
|
-
serviceName:
|
|
7103
|
+
serviceName: Dd,
|
|
7084
7104
|
privateKey: "DATABASE_URL",
|
|
7085
7105
|
publicKey: "DATABASE_PUBLIC_URL",
|
|
7086
7106
|
targetKey: "DATABASE_URL",
|
|
7087
7107
|
crossProvider: t.crossProvider
|
|
7088
|
-
}) : n.service === "valkey" ?
|
|
7108
|
+
}) : n.service === "valkey" ? Kd(e, {
|
|
7089
7109
|
database: "redis",
|
|
7090
|
-
serviceName:
|
|
7110
|
+
serviceName: Od,
|
|
7091
7111
|
privateKey: "REDIS_URL",
|
|
7092
7112
|
publicKey: "REDIS_PUBLIC_URL",
|
|
7093
7113
|
targetKey: "VALKEY_URL",
|
|
7094
7114
|
passwordKey: "REDISPASSWORD",
|
|
7095
7115
|
targetPasswordKey: "VALKEY_PASSWORD",
|
|
7096
7116
|
crossProvider: t.crossProvider
|
|
7097
|
-
}) :
|
|
7117
|
+
}) : qd(e, n.name));
|
|
7098
7118
|
},
|
|
7099
7119
|
async setEnv(e, t) {
|
|
7100
7120
|
for (let [n, r] of Object.entries(t.env)) await e.runner.run({
|
|
@@ -7137,14 +7157,14 @@ var Id = {
|
|
|
7137
7157
|
cwd: e.cwd,
|
|
7138
7158
|
label: `point ${n.app} at ${r}`
|
|
7139
7159
|
});
|
|
7140
|
-
let i = await
|
|
7160
|
+
let i = await Rd(e, {
|
|
7141
7161
|
dockerfile: r,
|
|
7142
7162
|
target: n,
|
|
7143
7163
|
releaseCommand: t.releaseCommand
|
|
7144
7164
|
});
|
|
7145
7165
|
try {
|
|
7146
7166
|
return {
|
|
7147
|
-
url:
|
|
7167
|
+
url: Md((await e.runner.run({
|
|
7148
7168
|
command: "railway",
|
|
7149
7169
|
args: [
|
|
7150
7170
|
"up",
|
|
@@ -7182,7 +7202,7 @@ var Id = {
|
|
|
7182
7202
|
};
|
|
7183
7203
|
}
|
|
7184
7204
|
};
|
|
7185
|
-
async function
|
|
7205
|
+
async function Rd(e, t) {
|
|
7186
7206
|
let { dockerfile: n, target: r, releaseCommand: i } = t;
|
|
7187
7207
|
if (await Cu(e.cwd)) return e.log?.(`Keeping your ${bu}, so ${r.app} uses the settings in it`), {
|
|
7188
7208
|
written: !1,
|
|
@@ -7201,11 +7221,11 @@ async function Ld(e, t) {
|
|
|
7201
7221
|
preDeployRan: o
|
|
7202
7222
|
});
|
|
7203
7223
|
}
|
|
7204
|
-
var
|
|
7205
|
-
async function zd(e) {
|
|
7206
|
-
Rd.has(e) || (await Bd(e), Rd.add(e));
|
|
7207
|
-
}
|
|
7224
|
+
var zd = /* @__PURE__ */ new WeakSet();
|
|
7208
7225
|
async function Bd(e) {
|
|
7226
|
+
zd.has(e) || (await Vd(e), zd.add(e));
|
|
7227
|
+
}
|
|
7228
|
+
async function Vd(e) {
|
|
7209
7229
|
if ((await e.runner.run({
|
|
7210
7230
|
command: "railway",
|
|
7211
7231
|
args: ["status", "--json"],
|
|
@@ -7213,7 +7233,7 @@ async function Bd(e) {
|
|
|
7213
7233
|
allowFailure: !0,
|
|
7214
7234
|
label: "check railway project link"
|
|
7215
7235
|
})).exitCode === 0) return;
|
|
7216
|
-
let t = await
|
|
7236
|
+
let t = await Wd(e);
|
|
7217
7237
|
await e.runner.run({
|
|
7218
7238
|
command: "railway",
|
|
7219
7239
|
args: [
|
|
@@ -7226,7 +7246,7 @@ async function Bd(e) {
|
|
|
7226
7246
|
label: `create railway project ${e.plan.projectName}`
|
|
7227
7247
|
});
|
|
7228
7248
|
}
|
|
7229
|
-
function
|
|
7249
|
+
function Hd(e) {
|
|
7230
7250
|
let t = $u(e);
|
|
7231
7251
|
if (typeof t != "object" || !t) return [];
|
|
7232
7252
|
let n = t.workspaces;
|
|
@@ -7236,8 +7256,7 @@ function Vd(e) {
|
|
|
7236
7256
|
return typeof n == "string" ? [n] : [];
|
|
7237
7257
|
}) : [];
|
|
7238
7258
|
}
|
|
7239
|
-
async function
|
|
7240
|
-
if (e.plan.railway.workspace) return e.plan.railway.workspace;
|
|
7259
|
+
async function Ud(e) {
|
|
7241
7260
|
let t = await e.runner.run({
|
|
7242
7261
|
command: "railway",
|
|
7243
7262
|
args: ["whoami", "--json"],
|
|
@@ -7245,14 +7264,17 @@ async function Hd(e) {
|
|
|
7245
7264
|
allowFailure: !0,
|
|
7246
7265
|
label: "find your Railway workspace"
|
|
7247
7266
|
});
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7267
|
+
return t.exitCode === 0 ? Hd(t.stdout) : [];
|
|
7268
|
+
}
|
|
7269
|
+
async function Wd(e) {
|
|
7270
|
+
if (e.plan.railway.workspace) return e.plan.railway.workspace;
|
|
7271
|
+
let t = await Ud(e);
|
|
7272
|
+
if (t.length !== 0) {
|
|
7273
|
+
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.`);
|
|
7274
|
+
return e.plan.railway.workspace = t[0], t[0];
|
|
7253
7275
|
}
|
|
7254
7276
|
}
|
|
7255
|
-
async function
|
|
7277
|
+
async function Gd(e, t) {
|
|
7256
7278
|
let n = await e.runner.run({
|
|
7257
7279
|
command: "railway",
|
|
7258
7280
|
args: [
|
|
@@ -7264,10 +7286,10 @@ async function Ud(e, t) {
|
|
|
7264
7286
|
allowFailure: !0,
|
|
7265
7287
|
label: "list railway services"
|
|
7266
7288
|
});
|
|
7267
|
-
return n.exitCode === 0 ?
|
|
7289
|
+
return n.exitCode === 0 ? Fd(n.stdout).some((e) => e.name === t) : !1;
|
|
7268
7290
|
}
|
|
7269
|
-
async function
|
|
7270
|
-
if (!await
|
|
7291
|
+
async function Kd(e, t) {
|
|
7292
|
+
if (!await Gd(e, t.serviceName)) {
|
|
7271
7293
|
let n = await e.runner.run({
|
|
7272
7294
|
command: "railway",
|
|
7273
7295
|
args: [
|
|
@@ -7280,7 +7302,7 @@ async function Wd(e, t) {
|
|
|
7280
7302
|
allowFailure: !0,
|
|
7281
7303
|
label: `add railway ${t.database}`
|
|
7282
7304
|
});
|
|
7283
|
-
if (n.exitCode !== 0 && !
|
|
7305
|
+
if (n.exitCode !== 0 && !jd.test(n.stderr + n.stdout)) throw Error(`Could not add a Railway ${t.database} database:\n${n.stderr.trim()}`);
|
|
7284
7306
|
}
|
|
7285
7307
|
let n = (e) => `\${{${t.serviceName}.${e}}}`;
|
|
7286
7308
|
if (!t.crossProvider) return {
|
|
@@ -7290,7 +7312,7 @@ async function Wd(e, t) {
|
|
|
7290
7312
|
},
|
|
7291
7313
|
note: `wired as a Railway reference to ${t.serviceName}.${t.privateKey}`
|
|
7292
7314
|
};
|
|
7293
|
-
let r =
|
|
7315
|
+
let r = Id((await e.runner.run({
|
|
7294
7316
|
command: "railway",
|
|
7295
7317
|
args: [
|
|
7296
7318
|
"variable",
|
|
@@ -7310,15 +7332,15 @@ async function Wd(e, t) {
|
|
|
7310
7332
|
...t.targetPasswordKey && a ? { [t.targetPasswordKey]: a } : {}
|
|
7311
7333
|
} };
|
|
7312
7334
|
}
|
|
7313
|
-
async function
|
|
7314
|
-
let n = await
|
|
7335
|
+
async function qd(e, t) {
|
|
7336
|
+
let n = await Jd(e, t), r = n?.accessKey ?? `hs${D(8).toString("hex")}`, i = n?.secretKey ?? D(24).toString("base64url");
|
|
7315
7337
|
if (!n) {
|
|
7316
7338
|
let n = await e.runner.run({
|
|
7317
7339
|
command: "railway",
|
|
7318
7340
|
args: [
|
|
7319
7341
|
"add",
|
|
7320
7342
|
"--image",
|
|
7321
|
-
|
|
7343
|
+
kd,
|
|
7322
7344
|
"--service",
|
|
7323
7345
|
t,
|
|
7324
7346
|
"--variables",
|
|
@@ -7326,7 +7348,7 @@ async function Gd(e, t) {
|
|
|
7326
7348
|
"--variables",
|
|
7327
7349
|
`RUSTFS_SECRET_KEY=${i}`,
|
|
7328
7350
|
"--variables",
|
|
7329
|
-
`RUSTFS_ADDRESS=:${
|
|
7351
|
+
`RUSTFS_ADDRESS=:${Ad}`,
|
|
7330
7352
|
"--json"
|
|
7331
7353
|
],
|
|
7332
7354
|
cwd: e.cwd,
|
|
@@ -7334,7 +7356,7 @@ async function Gd(e, t) {
|
|
|
7334
7356
|
secrets: [i],
|
|
7335
7357
|
label: `create object storage service ${t}`
|
|
7336
7358
|
});
|
|
7337
|
-
if (n.exitCode !== 0) throw
|
|
7359
|
+
if (n.exitCode !== 0) throw jd.test(n.stderr + n.stdout) ? Error(`The Railway storage service "${t}" already exists, but its access keys could not be read back. Copy them from the dashboard into deploy.services.bucket.external in stack.json.`) : Error(`Could not create the Railway storage service "${t}":\n${n.stderr.trim()}`);
|
|
7338
7360
|
}
|
|
7339
7361
|
let a = await e.runner.run({
|
|
7340
7362
|
command: "railway",
|
|
@@ -7350,7 +7372,7 @@ async function Gd(e, t) {
|
|
|
7350
7372
|
allowFailure: !0,
|
|
7351
7373
|
label: `attach a volume to ${t}`
|
|
7352
7374
|
});
|
|
7353
|
-
if (a.exitCode !== 0 && !
|
|
7375
|
+
if (a.exitCode !== 0 && !jd.test(a.stderr + a.stdout)) throw Error(`The Railway storage service "${t}" has no persistent volume, so anything uploaded to it would be lost on the next restart:\n${a.stderr.trim() || a.stdout.trim()}`);
|
|
7354
7376
|
let o = await e.runner.run({
|
|
7355
7377
|
command: "railway",
|
|
7356
7378
|
args: [
|
|
@@ -7358,14 +7380,14 @@ async function Gd(e, t) {
|
|
|
7358
7380
|
"--service",
|
|
7359
7381
|
t,
|
|
7360
7382
|
"--port",
|
|
7361
|
-
String(
|
|
7383
|
+
String(Ad),
|
|
7362
7384
|
"--json"
|
|
7363
7385
|
],
|
|
7364
7386
|
cwd: e.cwd,
|
|
7365
7387
|
allowFailure: !0,
|
|
7366
7388
|
label: `expose ${t}`
|
|
7367
|
-
}), s =
|
|
7368
|
-
if (!s) throw Error(`Could not get a public endpoint for the Railway storage service "${t}". Run \`railway domain --service ${t} --port ${
|
|
7389
|
+
}), s = Md(o.stdout + o.stderr);
|
|
7390
|
+
if (!s) throw Error(`Could not get a public endpoint for the Railway storage service "${t}". Run \`railway domain --service ${t} --port ${Ad}\` and set deploy.services.bucket.external in stack.json.`);
|
|
7369
7391
|
return {
|
|
7370
7392
|
outputs: {
|
|
7371
7393
|
RUSTFS_ENDPOINT: s,
|
|
@@ -7376,8 +7398,8 @@ async function Gd(e, t) {
|
|
|
7376
7398
|
note: n ? "reusing the existing RustFS service and its keys" : "RustFS on Railway, with a volume mounted at /data"
|
|
7377
7399
|
};
|
|
7378
7400
|
}
|
|
7379
|
-
async function
|
|
7380
|
-
if (!await
|
|
7401
|
+
async function Jd(e, t) {
|
|
7402
|
+
if (!await Gd(e, t)) return null;
|
|
7381
7403
|
let n = await e.runner.run({
|
|
7382
7404
|
command: "railway",
|
|
7383
7405
|
args: [
|
|
@@ -7392,7 +7414,7 @@ async function Kd(e, t) {
|
|
|
7392
7414
|
label: `read the keys already on ${t}`
|
|
7393
7415
|
});
|
|
7394
7416
|
if (n.exitCode !== 0) return null;
|
|
7395
|
-
let r =
|
|
7417
|
+
let r = Id(n.stdout), i = r.RUSTFS_ACCESS_KEY, a = r.RUSTFS_SECRET_KEY;
|
|
7396
7418
|
return i && a ? {
|
|
7397
7419
|
accessKey: i,
|
|
7398
7420
|
secretKey: a
|
|
@@ -7400,41 +7422,41 @@ async function Kd(e, t) {
|
|
|
7400
7422
|
}
|
|
7401
7423
|
//#endregion
|
|
7402
7424
|
//#region src/deploy/providers/index.ts
|
|
7403
|
-
var
|
|
7404
|
-
railway:
|
|
7405
|
-
fly:
|
|
7425
|
+
var Yd = {
|
|
7426
|
+
railway: Ld,
|
|
7427
|
+
fly: hd
|
|
7406
7428
|
};
|
|
7407
|
-
function
|
|
7408
|
-
return
|
|
7429
|
+
function Xd(e) {
|
|
7430
|
+
return Yd[e];
|
|
7409
7431
|
}
|
|
7410
7432
|
//#endregion
|
|
7411
7433
|
//#region src/deploy/runner.ts
|
|
7412
|
-
var
|
|
7434
|
+
var Zd = class extends Error {
|
|
7413
7435
|
spec;
|
|
7414
7436
|
result;
|
|
7415
7437
|
constructor(e, t) {
|
|
7416
7438
|
let n = (t.stderr.trim() || t.stdout.trim()).split("\n").slice(-8).join("\n");
|
|
7417
|
-
super(`${
|
|
7439
|
+
super(`${Qd(e)} exited with ${t.exitCode}${n ? `\n${n}` : ""}`), this.name = "CommandFailedError", this.spec = e, this.result = t;
|
|
7418
7440
|
}
|
|
7419
7441
|
};
|
|
7420
|
-
function
|
|
7421
|
-
let t = [e.command, ...e.args].map(
|
|
7422
|
-
return
|
|
7442
|
+
function Qd(e) {
|
|
7443
|
+
let t = [e.command, ...e.args].map(ef).join(" ");
|
|
7444
|
+
return $d(e.stdin === void 0 ? t : `${t} < (stdin)`, e.secrets ?? []);
|
|
7423
7445
|
}
|
|
7424
|
-
function
|
|
7446
|
+
function $d(e, t) {
|
|
7425
7447
|
let n = e;
|
|
7426
7448
|
for (let e of t) !e || e.length < 4 || (n = n.split(e).join("***"));
|
|
7427
7449
|
return n;
|
|
7428
7450
|
}
|
|
7429
|
-
function
|
|
7451
|
+
function ef(e) {
|
|
7430
7452
|
return e === "" ? "\"\"" : /[\s"'$`\\]/.test(e) ? `"${e.replace(/(["\\$`])/g, "\\$1")}"` : e;
|
|
7431
7453
|
}
|
|
7432
|
-
function
|
|
7454
|
+
function tf(e = {}) {
|
|
7433
7455
|
let t = [];
|
|
7434
7456
|
return {
|
|
7435
7457
|
transcript: t,
|
|
7436
7458
|
async run(n) {
|
|
7437
|
-
let r =
|
|
7459
|
+
let r = Qd(n);
|
|
7438
7460
|
t.push(r), e.onCommand?.(r);
|
|
7439
7461
|
let i = e.env || n.env ? {
|
|
7440
7462
|
...e.env,
|
|
@@ -7443,20 +7465,20 @@ function $d(e = {}) {
|
|
|
7443
7465
|
cwd: n.cwd,
|
|
7444
7466
|
stdin: n.stdin,
|
|
7445
7467
|
env: i,
|
|
7446
|
-
onData: e.onOutput ? (t) => e.onOutput?.(
|
|
7468
|
+
onData: e.onOutput ? (t) => e.onOutput?.($d(t, n.secrets ?? [])) : void 0
|
|
7447
7469
|
});
|
|
7448
|
-
if (a.exitCode !== 0 && !n.allowFailure) throw new
|
|
7470
|
+
if (a.exitCode !== 0 && !n.allowFailure) throw new Zd(n, a);
|
|
7449
7471
|
return a;
|
|
7450
7472
|
}
|
|
7451
7473
|
};
|
|
7452
7474
|
}
|
|
7453
|
-
function
|
|
7475
|
+
function nf(e = {}) {
|
|
7454
7476
|
let t = [];
|
|
7455
7477
|
return {
|
|
7456
7478
|
transcript: t,
|
|
7457
7479
|
dryRun: !0,
|
|
7458
7480
|
run(n) {
|
|
7459
|
-
let r =
|
|
7481
|
+
let r = Qd(n);
|
|
7460
7482
|
t.push(r), e.onCommand?.(r);
|
|
7461
7483
|
let i = e.responses?.find((e) => r.includes(e.match)), a = typeof i?.stdout == "function" ? i.stdout(n) : i?.stdout ?? "";
|
|
7462
7484
|
return Promise.resolve({
|
|
@@ -7469,47 +7491,52 @@ function ef(e = {}) {
|
|
|
7469
7491
|
}
|
|
7470
7492
|
//#endregion
|
|
7471
7493
|
//#region src/deploy/auth.ts
|
|
7472
|
-
function
|
|
7494
|
+
function rf() {
|
|
7473
7495
|
return {
|
|
7474
|
-
createRunner: (e) =>
|
|
7496
|
+
createRunner: (e) => tf({ env: e }),
|
|
7475
7497
|
runInteractive: async (e, t, n) => (await ei(e, t, { cwd: n })).exitCode,
|
|
7476
|
-
confirmInstall:
|
|
7477
|
-
chooseMethod:
|
|
7478
|
-
readToken:
|
|
7498
|
+
confirmInstall: hf,
|
|
7499
|
+
chooseMethod: gf,
|
|
7500
|
+
readToken: vf,
|
|
7501
|
+
chooseScope: _f
|
|
7479
7502
|
};
|
|
7480
7503
|
}
|
|
7481
|
-
async function
|
|
7482
|
-
let t = e.io ??
|
|
7504
|
+
async function af(e) {
|
|
7505
|
+
let t = e.io ?? rf(), n = {}, r = {};
|
|
7483
7506
|
for (let i of e.providers) {
|
|
7484
|
-
let a = Hu[i], o = e.adapters?.[i] ??
|
|
7507
|
+
let a = Hu[i], o = e.adapters?.[i] ?? Xd(i), s = {
|
|
7485
7508
|
io: t,
|
|
7486
7509
|
spec: a,
|
|
7487
7510
|
plan: e.plan,
|
|
7488
7511
|
skipPrompts: e.skipPrompts,
|
|
7489
7512
|
env: r
|
|
7490
7513
|
};
|
|
7491
|
-
await
|
|
7492
|
-
let c = await
|
|
7514
|
+
await of(s);
|
|
7515
|
+
let c = await uf({
|
|
7516
|
+
...s,
|
|
7517
|
+
adapter: o
|
|
7518
|
+
});
|
|
7519
|
+
r = c.env, c.account && (n[i] = c.account), await df({
|
|
7493
7520
|
...s,
|
|
7521
|
+
env: r,
|
|
7494
7522
|
adapter: o
|
|
7495
7523
|
});
|
|
7496
|
-
r = c.env, c.account && (n[i] = c.account);
|
|
7497
7524
|
}
|
|
7498
7525
|
return {
|
|
7499
7526
|
env: r,
|
|
7500
7527
|
accounts: n
|
|
7501
7528
|
};
|
|
7502
7529
|
}
|
|
7503
|
-
async function
|
|
7530
|
+
async function of(e) {
|
|
7504
7531
|
let { io: t, spec: n, plan: r, skipPrompts: i } = e;
|
|
7505
|
-
if (await
|
|
7532
|
+
if (await sf(e)) return;
|
|
7506
7533
|
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)}`;
|
|
7507
|
-
(i || !
|
|
7534
|
+
(i || !cf()) && z(a, { reason: "input_required" }), nt({
|
|
7508
7535
|
reason: "input_required",
|
|
7509
7536
|
message: a
|
|
7510
|
-
}), await t.confirmInstall(n) || z(a, { reason: "input_required" }), await t.runInteractive("sh", ["-c", n.install], r.projectRoot), await
|
|
7537
|
+
}), await t.confirmInstall(n) || z(a, { reason: "input_required" }), await t.runInteractive("sh", ["-c", n.install], r.projectRoot), await sf(e) || z(`That did not put ${F.command(n.bin)} on your PATH. ${a}`, { reason: "input_required" });
|
|
7511
7538
|
}
|
|
7512
|
-
async function
|
|
7539
|
+
async function sf(e) {
|
|
7513
7540
|
let t = await e.io.createRunner(e.env).run({
|
|
7514
7541
|
command: e.spec.bin,
|
|
7515
7542
|
args: ["--version"],
|
|
@@ -7518,11 +7545,11 @@ async function af(e) {
|
|
|
7518
7545
|
}).catch(() => null);
|
|
7519
7546
|
return t !== null && t.exitCode === 0;
|
|
7520
7547
|
}
|
|
7521
|
-
function
|
|
7548
|
+
function cf() {
|
|
7522
7549
|
return process.platform !== "win32";
|
|
7523
7550
|
}
|
|
7524
|
-
var
|
|
7525
|
-
async function
|
|
7551
|
+
var lf = 3;
|
|
7552
|
+
async function uf(e) {
|
|
7526
7553
|
let { io: t, spec: n, plan: r, skipPrompts: i, adapter: a } = e, o = { ...e.env }, s = 0;
|
|
7527
7554
|
for (;;) {
|
|
7528
7555
|
let e = {
|
|
@@ -7534,46 +7561,64 @@ async function cf(e) {
|
|
|
7534
7561
|
account: c.account,
|
|
7535
7562
|
env: o
|
|
7536
7563
|
};
|
|
7537
|
-
let l =
|
|
7564
|
+
let l = ff(n, o);
|
|
7538
7565
|
if (l) {
|
|
7539
7566
|
Object.assign(o, l);
|
|
7540
7567
|
continue;
|
|
7541
7568
|
}
|
|
7542
|
-
i && z(
|
|
7569
|
+
i && z(mf(n), { reason: "auth_required" }), nt({
|
|
7543
7570
|
reason: "auth_required",
|
|
7544
|
-
message:
|
|
7545
|
-
}), s >=
|
|
7571
|
+
message: mf(n)
|
|
7572
|
+
}), s >= lf && z(`${n.label} still does not know who you are. ${mf(n)}`, { reason: "auth_required" }), s += 1;
|
|
7546
7573
|
let u = await t.chooseMethod(n);
|
|
7547
7574
|
if (u === "token") {
|
|
7548
7575
|
let e = await t.readToken(n);
|
|
7549
|
-
Object.assign(o,
|
|
7576
|
+
Object.assign(o, pf(n.conflictingTokenEnv), { [n.tokenEnv]: e });
|
|
7550
7577
|
continue;
|
|
7551
7578
|
}
|
|
7552
7579
|
let d = u === "browserless" ? n.browserlessLoginArgs ?? n.loginArgs : n.loginArgs;
|
|
7553
7580
|
await t.runInteractive(n.bin, d, r.projectRoot);
|
|
7554
7581
|
}
|
|
7555
7582
|
}
|
|
7556
|
-
function
|
|
7583
|
+
async function df(e) {
|
|
7584
|
+
let { io: t, spec: n, plan: r, skipPrompts: i, env: a, adapter: o } = e, { scope: s } = o;
|
|
7585
|
+
if (!s || s.current(r)) return;
|
|
7586
|
+
let c = await s.list({
|
|
7587
|
+
runner: t.createRunner(a),
|
|
7588
|
+
plan: r,
|
|
7589
|
+
cwd: r.projectRoot
|
|
7590
|
+
});
|
|
7591
|
+
if (c.length <= 1) {
|
|
7592
|
+
c[0] && s.pin(r, c[0]);
|
|
7593
|
+
return;
|
|
7594
|
+
}
|
|
7595
|
+
let l = `Your ${n.label} account belongs to ${c.length} ${s.label}s (${c.join(", ")}). Pass ${F.command(`${s.flag} <name>`)} so the project is created in the right one.`;
|
|
7596
|
+
i && z(l, { reason: "input_required" }), nt({
|
|
7597
|
+
reason: "input_required",
|
|
7598
|
+
message: l
|
|
7599
|
+
}), s.pin(r, await t.chooseScope(n, s, c));
|
|
7600
|
+
}
|
|
7601
|
+
function ff(e, t) {
|
|
7557
7602
|
let n = (e.conflictingTokenEnv ?? []).filter((e) => !(e in t) && process.env[e] !== void 0);
|
|
7558
7603
|
if (n.length === 0) return null;
|
|
7559
7604
|
for (let t of n) gt(`${F.label(t)} is set in your shell, but it cannot create a ${e.label} project. Ignoring it for this run.`);
|
|
7560
|
-
return
|
|
7605
|
+
return pf(n);
|
|
7561
7606
|
}
|
|
7562
|
-
function
|
|
7607
|
+
function pf(e = []) {
|
|
7563
7608
|
return Object.fromEntries(e.map((e) => [e, void 0]));
|
|
7564
7609
|
}
|
|
7565
|
-
function
|
|
7610
|
+
function mf(e) {
|
|
7566
7611
|
let t = F.command(`${e.bin} ${e.loginArgs.join(" ")}`);
|
|
7567
7612
|
return `Not signed in to ${e.label}. Run ${t}, or set ${F.label(e.tokenEnv)} to a token from ${I(e.tokenUrl)}.`;
|
|
7568
7613
|
}
|
|
7569
|
-
async function
|
|
7614
|
+
async function hf(e) {
|
|
7570
7615
|
let t = await s.confirm({
|
|
7571
7616
|
message: `Deploying needs the ${F.highlight(e.label)} CLI. Install it with ${F.command(e.install)}?`,
|
|
7572
7617
|
initialValue: !0
|
|
7573
7618
|
});
|
|
7574
7619
|
return s.isCancel(t) && B(), t;
|
|
7575
7620
|
}
|
|
7576
|
-
async function
|
|
7621
|
+
async function gf(e) {
|
|
7577
7622
|
let t = [{
|
|
7578
7623
|
value: "browser",
|
|
7579
7624
|
label: "Log in through the browser",
|
|
@@ -7595,7 +7640,18 @@ async function pf(e) {
|
|
|
7595
7640
|
});
|
|
7596
7641
|
return s.isCancel(n) && B(), n;
|
|
7597
7642
|
}
|
|
7598
|
-
async function
|
|
7643
|
+
async function _f(e, t, n) {
|
|
7644
|
+
let r = await s.select({
|
|
7645
|
+
message: `Which ${F.highlight(e.label)} ${t.label} should this project live in?`,
|
|
7646
|
+
options: n.map((e) => ({
|
|
7647
|
+
value: e,
|
|
7648
|
+
label: e
|
|
7649
|
+
})),
|
|
7650
|
+
initialValue: n[0]
|
|
7651
|
+
});
|
|
7652
|
+
return s.isCancel(r) && B(), r;
|
|
7653
|
+
}
|
|
7654
|
+
async function vf(e) {
|
|
7599
7655
|
s.log.info(`Create one at ${I(e.tokenUrl)}. Give it the workspace this project should live in, not a single project.`);
|
|
7600
7656
|
let t = await s.password({
|
|
7601
7657
|
message: `Paste your ${e.label} token`,
|
|
@@ -7605,59 +7661,59 @@ async function mf(e) {
|
|
|
7605
7661
|
}
|
|
7606
7662
|
//#endregion
|
|
7607
7663
|
//#region src/deploy/config.ts
|
|
7608
|
-
var
|
|
7609
|
-
provider:
|
|
7664
|
+
var yf = j.enum(zu), bf = j.object({
|
|
7665
|
+
provider: yf,
|
|
7610
7666
|
app: j.string().min(1).optional(),
|
|
7611
7667
|
region: j.string().min(1).optional(),
|
|
7612
7668
|
url: j.string().url().optional()
|
|
7613
|
-
}),
|
|
7614
|
-
provider:
|
|
7669
|
+
}), xf = j.object({
|
|
7670
|
+
provider: yf,
|
|
7615
7671
|
name: j.string().min(1).optional(),
|
|
7616
7672
|
region: j.string().min(1).optional(),
|
|
7617
7673
|
external: j.record(j.string(), j.string()).optional()
|
|
7618
|
-
}),
|
|
7674
|
+
}), Sf = j.object({
|
|
7619
7675
|
org: j.string().min(1).optional(),
|
|
7620
7676
|
postgresPlan: j.string().min(1).optional()
|
|
7621
|
-
}),
|
|
7677
|
+
}), Cf = j.object({ workspace: j.string().min(1).optional() }), wf = j.object({
|
|
7622
7678
|
version: j.number().int().positive(),
|
|
7623
7679
|
projectName: j.string().min(1),
|
|
7624
7680
|
environment: j.string().min(1),
|
|
7625
|
-
defaultProvider:
|
|
7681
|
+
defaultProvider: yf.optional(),
|
|
7626
7682
|
targets: j.object({
|
|
7627
|
-
backend:
|
|
7628
|
-
frontend:
|
|
7629
|
-
admin:
|
|
7683
|
+
backend: bf.optional(),
|
|
7684
|
+
frontend: bf.optional(),
|
|
7685
|
+
admin: bf.optional()
|
|
7630
7686
|
}).default({}),
|
|
7631
7687
|
services: j.object({
|
|
7632
|
-
postgres:
|
|
7633
|
-
valkey:
|
|
7634
|
-
bucket:
|
|
7688
|
+
postgres: xf.optional(),
|
|
7689
|
+
valkey: xf.optional(),
|
|
7690
|
+
bucket: xf.optional()
|
|
7635
7691
|
}).default({}),
|
|
7636
|
-
fly:
|
|
7637
|
-
railway:
|
|
7692
|
+
fly: Sf.optional(),
|
|
7693
|
+
railway: Cf.optional()
|
|
7638
7694
|
});
|
|
7639
|
-
async function
|
|
7695
|
+
async function Tf(e) {
|
|
7640
7696
|
let t = await Y(e).catch((e) => {
|
|
7641
7697
|
throw Error(`Could not read ${Pu}: ${e instanceof Error ? e.message : String(e)}. Fix it, then run deploy again.`);
|
|
7642
7698
|
});
|
|
7643
7699
|
if (!t) throw Error(`No ${Pu} 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".`);
|
|
7644
7700
|
return t;
|
|
7645
7701
|
}
|
|
7646
|
-
async function
|
|
7647
|
-
let t = (await
|
|
7702
|
+
async function Ef(e) {
|
|
7703
|
+
let t = (await Tf(e))[Fu];
|
|
7648
7704
|
if (t === void 0) return null;
|
|
7649
|
-
let n =
|
|
7705
|
+
let n = wf.safeParse(t);
|
|
7650
7706
|
if (!n.success) throw Error(`Invalid "${Fu}" block in ${Pu}:\n ${j.prettifyError(n.error)}`);
|
|
7651
7707
|
if (n.data.version > 1) throw Error(`The "${Fu}" block in ${Pu} was written by a newer CLI (version ${n.data.version}, this CLI understands 1). Upgrade with "npm i -g @hype-stack/cli".`);
|
|
7652
7708
|
return n.data;
|
|
7653
7709
|
}
|
|
7654
|
-
async function
|
|
7710
|
+
async function Df(e, t) {
|
|
7655
7711
|
await ki(e, {
|
|
7656
|
-
...await
|
|
7657
|
-
[Fu]:
|
|
7712
|
+
...await Tf(e),
|
|
7713
|
+
[Fu]: kf(t)
|
|
7658
7714
|
});
|
|
7659
7715
|
}
|
|
7660
|
-
function
|
|
7716
|
+
function Of(e, t = Iu) {
|
|
7661
7717
|
return {
|
|
7662
7718
|
version: 1,
|
|
7663
7719
|
projectName: e,
|
|
@@ -7666,7 +7722,7 @@ function wf(e, t = Iu) {
|
|
|
7666
7722
|
services: {}
|
|
7667
7723
|
};
|
|
7668
7724
|
}
|
|
7669
|
-
function
|
|
7725
|
+
function kf(e) {
|
|
7670
7726
|
let t = {
|
|
7671
7727
|
version: e.version,
|
|
7672
7728
|
projectName: e.projectName,
|
|
@@ -7696,7 +7752,7 @@ function Tf(e) {
|
|
|
7696
7752
|
}
|
|
7697
7753
|
//#endregion
|
|
7698
7754
|
//#region src/deploy/detect.ts
|
|
7699
|
-
var
|
|
7755
|
+
var Af = [
|
|
7700
7756
|
"@hono/node-server",
|
|
7701
7757
|
"@tanstack/react-start",
|
|
7702
7758
|
"@tanstack/start",
|
|
@@ -7704,32 +7760,32 @@ var Ef = [
|
|
|
7704
7760
|
"express",
|
|
7705
7761
|
"fastify"
|
|
7706
7762
|
];
|
|
7707
|
-
function
|
|
7763
|
+
function jf(e, t, n) {
|
|
7708
7764
|
let r = Bu[t], i = n?.paths?.[r.pathKey]?.root, a = n?.apps?.[t];
|
|
7709
7765
|
return w.resolve(e, i ?? a ?? r.defaultRoot);
|
|
7710
7766
|
}
|
|
7711
|
-
async function
|
|
7767
|
+
async function Mf(e, t) {
|
|
7712
7768
|
return (await Promise.all(Lu.map(async (n) => {
|
|
7713
|
-
let r =
|
|
7769
|
+
let r = jf(e, n, t);
|
|
7714
7770
|
return await q(w.join(r, "package.json")) ? n : null;
|
|
7715
7771
|
}))).filter((e) => e !== null);
|
|
7716
7772
|
}
|
|
7717
|
-
var
|
|
7718
|
-
async function
|
|
7773
|
+
var Nf = ["build:web", "build"];
|
|
7774
|
+
async function Pf(e, t) {
|
|
7719
7775
|
let [n, r] = await Promise.all([q(w.join(e, "Dockerfile")), ri(w.join(e, "package.json")).catch(() => null)]);
|
|
7720
7776
|
if (n) return "node";
|
|
7721
7777
|
if (Bu[t].serveMode === "node") return null;
|
|
7722
7778
|
let i = r?.scripts ?? {}, a = {
|
|
7723
7779
|
...r?.dependencies,
|
|
7724
7780
|
...r?.devDependencies
|
|
7725
|
-
}, o =
|
|
7781
|
+
}, o = Nf.some((e) => i[e] !== void 0), s = Af.some((e) => a[e] !== void 0);
|
|
7726
7782
|
return o || !s ? "static" : null;
|
|
7727
7783
|
}
|
|
7728
|
-
async function
|
|
7729
|
-
let r = await Promise.all(t.map(async (t) => [t, await
|
|
7784
|
+
async function Ff(e, t, n) {
|
|
7785
|
+
let r = await Promise.all(t.map(async (t) => [t, await Pf(jf(e, t, n), t)]));
|
|
7730
7786
|
return Object.fromEntries(r);
|
|
7731
7787
|
}
|
|
7732
|
-
function
|
|
7788
|
+
function If(e) {
|
|
7733
7789
|
let t = {};
|
|
7734
7790
|
for (let n of Lu) {
|
|
7735
7791
|
let r = e[n];
|
|
@@ -7737,7 +7793,7 @@ function Mf(e) {
|
|
|
7737
7793
|
}
|
|
7738
7794
|
return t;
|
|
7739
7795
|
}
|
|
7740
|
-
async function
|
|
7796
|
+
async function Lf(e, t) {
|
|
7741
7797
|
let n = Bu[t].staticDir ?? "dist", r = [
|
|
7742
7798
|
n,
|
|
7743
7799
|
"dist",
|
|
@@ -7749,12 +7805,12 @@ async function Nf(e, t) {
|
|
|
7749
7805
|
}
|
|
7750
7806
|
//#endregion
|
|
7751
7807
|
//#region src/deploy/dry-run.ts
|
|
7752
|
-
var
|
|
7753
|
-
function
|
|
7808
|
+
var Rf = "dry-run-placeholder";
|
|
7809
|
+
function zf(e, t) {
|
|
7754
7810
|
let n = e.args.indexOf(t);
|
|
7755
7811
|
return n === -1 ? "app" : e.args[n + 1] ?? "app";
|
|
7756
7812
|
}
|
|
7757
|
-
var
|
|
7813
|
+
var Bf = "dryrun00cluster", Vf = [
|
|
7758
7814
|
{
|
|
7759
7815
|
match: "fly orgs list",
|
|
7760
7816
|
stdout: JSON.stringify([{
|
|
@@ -7772,21 +7828,21 @@ var If = "dryrun00cluster", Lf = [
|
|
|
7772
7828
|
},
|
|
7773
7829
|
{
|
|
7774
7830
|
match: "fly mpg create",
|
|
7775
|
-
stdout: `Managed Postgres cluster created successfully!\n ID: ${
|
|
7831
|
+
stdout: `Managed Postgres cluster created successfully!\n ID: ${Bf}\n Connection string: postgres://hype:${Rf}@example.flympg.net:5432/postgres`
|
|
7776
7832
|
},
|
|
7777
7833
|
{
|
|
7778
7834
|
match: "fly mpg status",
|
|
7779
7835
|
stdout: JSON.stringify({
|
|
7780
7836
|
data: {
|
|
7781
|
-
id:
|
|
7837
|
+
id: Bf,
|
|
7782
7838
|
status: "ready"
|
|
7783
7839
|
},
|
|
7784
|
-
credentials: { pgbouncer_uri: `postgres://hype:${
|
|
7840
|
+
credentials: { pgbouncer_uri: `postgres://hype:${Rf}@example.flympg.net:5432/postgres` }
|
|
7785
7841
|
})
|
|
7786
7842
|
},
|
|
7787
7843
|
{
|
|
7788
7844
|
match: "fly redis create",
|
|
7789
|
-
stdout: `Your Upstash Redis database is ready.\nPrivate URL = redis://default:${
|
|
7845
|
+
stdout: `Your Upstash Redis database is ready.\nPrivate URL = redis://default:${Rf}@example.upstash.io:6379`
|
|
7790
7846
|
},
|
|
7791
7847
|
{
|
|
7792
7848
|
match: "fly redis status",
|
|
@@ -7795,10 +7851,10 @@ var If = "dryrun00cluster", Lf = [
|
|
|
7795
7851
|
{
|
|
7796
7852
|
match: "fly storage create",
|
|
7797
7853
|
stdout: (e) => [
|
|
7798
|
-
`BUCKET_NAME: ${
|
|
7854
|
+
`BUCKET_NAME: ${zf(e, "--name")}`,
|
|
7799
7855
|
"AWS_ENDPOINT_URL_S3: https://fly.storage.tigris.dev",
|
|
7800
|
-
`AWS_ACCESS_KEY_ID: ${
|
|
7801
|
-
`AWS_SECRET_ACCESS_KEY: ${
|
|
7856
|
+
`AWS_ACCESS_KEY_ID: ${Rf}`,
|
|
7857
|
+
`AWS_SECRET_ACCESS_KEY: ${Rf}`
|
|
7802
7858
|
].join("\n")
|
|
7803
7859
|
},
|
|
7804
7860
|
{
|
|
@@ -7818,13 +7874,13 @@ var If = "dryrun00cluster", Lf = [
|
|
|
7818
7874
|
},
|
|
7819
7875
|
{
|
|
7820
7876
|
match: "railway domain",
|
|
7821
|
-
stdout: (e) => JSON.stringify({ domain: `${
|
|
7877
|
+
stdout: (e) => JSON.stringify({ domain: `${zf(e, "--service")}-production.up.railway.app` })
|
|
7822
7878
|
},
|
|
7823
7879
|
{
|
|
7824
7880
|
match: "railway variable list",
|
|
7825
|
-
stdout: [`DATABASE_PUBLIC_URL=postgres://postgres:${
|
|
7881
|
+
stdout: [`DATABASE_PUBLIC_URL=postgres://postgres:${Rf}@example.proxy.rlwy.net:5432/railway`, `REDIS_PUBLIC_URL=redis://default:${Rf}@example.proxy.rlwy.net:6379`].join("\n")
|
|
7826
7882
|
}
|
|
7827
|
-
],
|
|
7883
|
+
], Hf = {
|
|
7828
7884
|
backend: [
|
|
7829
7885
|
"NODE_ENV",
|
|
7830
7886
|
"APP_ENV",
|
|
@@ -7852,29 +7908,29 @@ var If = "dryrun00cluster", Lf = [
|
|
|
7852
7908
|
"VITE_APP_TYPE",
|
|
7853
7909
|
"VITE_ENVIRONMENT"
|
|
7854
7910
|
]
|
|
7855
|
-
},
|
|
7911
|
+
}, Uf = new Set([
|
|
7856
7912
|
"VITE_SENTRY_AUTH_TOKEN",
|
|
7857
7913
|
"POSTGRES_USER",
|
|
7858
7914
|
"POSTGRES_PASSWORD",
|
|
7859
7915
|
"POSTGRES_DB",
|
|
7860
7916
|
"POSTGRES_HOST",
|
|
7861
7917
|
"POSTGRES_PORT"
|
|
7862
|
-
]),
|
|
7863
|
-
function
|
|
7918
|
+
]), Wf = /(?:^|\/\/|@)(?:localhost|127\.0\.0\.1|0\.0\.0\.0|host\.docker\.internal)(?::\d+)?(?:\/|$)/i;
|
|
7919
|
+
function Gf(e) {
|
|
7864
7920
|
let { plan: t, serviceOutputs: n, urls: r, localEnv: i = {}, declaredKeys: a = {}, externallyProvided: o = {} } = e;
|
|
7865
7921
|
return t.targets.map((e) => {
|
|
7866
|
-
let s =
|
|
7922
|
+
let s = Jf({
|
|
7867
7923
|
target: e.target,
|
|
7868
7924
|
environment: t.environment,
|
|
7869
7925
|
port: e.spec.port,
|
|
7870
7926
|
serviceOutputs: n,
|
|
7871
7927
|
urls: r
|
|
7872
|
-
}), c = a[e.target] ?? [], { forwarded: l, skippedLocal: u } =
|
|
7928
|
+
}), c = a[e.target] ?? [], { forwarded: l, skippedLocal: u } = Xf({
|
|
7873
7929
|
declared: c,
|
|
7874
7930
|
local: i[e.target] ?? {},
|
|
7875
7931
|
managed: s,
|
|
7876
7932
|
target: e.target
|
|
7877
|
-
}), d = new Set(o[e.target] ?? []), f = c.filter((e) => s[e] === void 0 && l[e] === void 0 && !
|
|
7933
|
+
}), d = new Set(o[e.target] ?? []), f = c.filter((e) => s[e] === void 0 && l[e] === void 0 && !Uf.has(e) && !d.has(e));
|
|
7878
7934
|
return {
|
|
7879
7935
|
target: e.target,
|
|
7880
7936
|
managed: s,
|
|
@@ -7884,13 +7940,13 @@ function Vf(e) {
|
|
|
7884
7940
|
};
|
|
7885
7941
|
});
|
|
7886
7942
|
}
|
|
7887
|
-
var
|
|
7888
|
-
function
|
|
7943
|
+
var Kf = "(pending)";
|
|
7944
|
+
function qf(e) {
|
|
7889
7945
|
let { plan: t, localEnv: n, declaredKeys: r } = e, i = {};
|
|
7890
|
-
for (let e of t.targets) i[e.target] = e.url ??
|
|
7946
|
+
for (let e of t.targets) i[e.target] = e.url ?? Kf;
|
|
7891
7947
|
let a = {};
|
|
7892
|
-
for (let e of t.services) a[e.service] = e.external ?? Object.fromEntries(e.spec.provides.map((e) => [e,
|
|
7893
|
-
return
|
|
7948
|
+
for (let e of t.services) a[e.service] = e.external ?? Object.fromEntries(e.spec.provides.map((e) => [e, Kf]));
|
|
7949
|
+
return Gf({
|
|
7894
7950
|
plan: t,
|
|
7895
7951
|
serviceOutputs: a,
|
|
7896
7952
|
urls: i,
|
|
@@ -7898,14 +7954,14 @@ function Uf(e) {
|
|
|
7898
7954
|
declaredKeys: r
|
|
7899
7955
|
});
|
|
7900
7956
|
}
|
|
7901
|
-
function
|
|
7957
|
+
function Jf(e) {
|
|
7902
7958
|
let { target: t, environment: n, port: r, serviceOutputs: i, urls: a } = e;
|
|
7903
|
-
return t === "backend" ?
|
|
7959
|
+
return t === "backend" ? Yf({
|
|
7904
7960
|
environment: n,
|
|
7905
7961
|
port: r,
|
|
7906
7962
|
serviceOutputs: i,
|
|
7907
7963
|
urls: a
|
|
7908
|
-
}) :
|
|
7964
|
+
}) : Qf(t === "frontend" ? {
|
|
7909
7965
|
VITE_API_BASE_URL: a.backend,
|
|
7910
7966
|
VITE_ADMIN_URL: a.admin,
|
|
7911
7967
|
VITE_PUBLIC_SITE_URL: a.frontend,
|
|
@@ -7917,9 +7973,9 @@ function Wf(e) {
|
|
|
7917
7973
|
VITE_ENVIRONMENT: n
|
|
7918
7974
|
});
|
|
7919
7975
|
}
|
|
7920
|
-
function
|
|
7976
|
+
function Yf(e) {
|
|
7921
7977
|
let { environment: t, port: n, serviceOutputs: r, urls: i } = e;
|
|
7922
|
-
return
|
|
7978
|
+
return Qf({
|
|
7923
7979
|
NODE_ENV: "production",
|
|
7924
7980
|
APP_ENV: t,
|
|
7925
7981
|
PORT: n === void 0 ? void 0 : String(n),
|
|
@@ -7931,13 +7987,13 @@ function Gf(e) {
|
|
|
7931
7987
|
SERVER_URL: i.backend
|
|
7932
7988
|
});
|
|
7933
7989
|
}
|
|
7934
|
-
function
|
|
7935
|
-
let { declared: t, local: n, managed: r, target: i } = e, a = new Set(
|
|
7990
|
+
function Xf(e) {
|
|
7991
|
+
let { declared: t, local: n, managed: r, target: i } = e, a = new Set(Hf[i]), o = {}, s = [];
|
|
7936
7992
|
for (let e of t) {
|
|
7937
|
-
if (a.has(e) || r[e] !== void 0 ||
|
|
7993
|
+
if (a.has(e) || r[e] !== void 0 || Uf.has(e)) continue;
|
|
7938
7994
|
let t = n[e];
|
|
7939
7995
|
if (!(t === void 0 || t.trim() === "") && !t.includes("${")) {
|
|
7940
|
-
if (
|
|
7996
|
+
if (Wf.test(t)) {
|
|
7941
7997
|
s.push(e);
|
|
7942
7998
|
continue;
|
|
7943
7999
|
}
|
|
@@ -7949,18 +8005,18 @@ function Kf(e) {
|
|
|
7949
8005
|
skippedLocal: s
|
|
7950
8006
|
};
|
|
7951
8007
|
}
|
|
7952
|
-
function
|
|
8008
|
+
function Zf(e) {
|
|
7953
8009
|
return {
|
|
7954
8010
|
...e.forwarded,
|
|
7955
8011
|
...e.managed
|
|
7956
8012
|
};
|
|
7957
8013
|
}
|
|
7958
|
-
function
|
|
8014
|
+
function Qf(e) {
|
|
7959
8015
|
let t = {};
|
|
7960
8016
|
for (let [n, r] of Object.entries(e)) r !== void 0 && r !== "" && (t[n] = r);
|
|
7961
8017
|
return t;
|
|
7962
8018
|
}
|
|
7963
|
-
function
|
|
8019
|
+
function $f(e) {
|
|
7964
8020
|
let t = {};
|
|
7965
8021
|
for (let n of e.split(/\r?\n/)) {
|
|
7966
8022
|
let e = n.trim();
|
|
@@ -7968,27 +8024,27 @@ function Yf(e) {
|
|
|
7968
8024
|
let r = e.startsWith("export ") ? e.slice(7).trim() : e, i = r.indexOf("=");
|
|
7969
8025
|
if (i <= 0) continue;
|
|
7970
8026
|
let a = r.slice(0, i).trim();
|
|
7971
|
-
/^[A-Za-z_][A-Za-z0-9_]*$/.test(a) && (t[a] =
|
|
8027
|
+
/^[A-Za-z_][A-Za-z0-9_]*$/.test(a) && (t[a] = ep(r.slice(i + 1).trim()));
|
|
7972
8028
|
}
|
|
7973
8029
|
return t;
|
|
7974
8030
|
}
|
|
7975
|
-
function
|
|
8031
|
+
function ep(e) {
|
|
7976
8032
|
if (e.length >= 2 && (e.startsWith("\"") && e.endsWith("\"") || e.startsWith("'") && e.endsWith("'"))) return e.slice(1, -1);
|
|
7977
8033
|
let t = e.indexOf(" #");
|
|
7978
8034
|
return t === -1 ? e : e.slice(0, t).trim();
|
|
7979
8035
|
}
|
|
7980
|
-
function
|
|
7981
|
-
return [...new Set(Object.keys(
|
|
8036
|
+
function tp(e) {
|
|
8037
|
+
return [...new Set(Object.keys($f(e)))];
|
|
7982
8038
|
}
|
|
7983
8039
|
//#endregion
|
|
7984
8040
|
//#region src/deploy/migrations.ts
|
|
7985
|
-
var
|
|
8041
|
+
var np = [
|
|
7986
8042
|
"migration:latest",
|
|
7987
8043
|
"migrate:deploy",
|
|
7988
8044
|
"db:migrate:deploy"
|
|
7989
8045
|
];
|
|
7990
|
-
async function
|
|
7991
|
-
let n = await ri(w.join(e, "package.json")).catch(() => null), r =
|
|
8046
|
+
async function rp(e, t) {
|
|
8047
|
+
let n = await ri(w.join(e, "package.json")).catch(() => null), r = np.find((e) => typeof n?.scripts?.[e] == "string");
|
|
7992
8048
|
if (r && n?.name) return [
|
|
7993
8049
|
"pnpm",
|
|
7994
8050
|
"--filter",
|
|
@@ -8001,7 +8057,7 @@ async function $f(e, t) {
|
|
|
8001
8057
|
"run",
|
|
8002
8058
|
r
|
|
8003
8059
|
];
|
|
8004
|
-
let i = await
|
|
8060
|
+
let i = await ip(e);
|
|
8005
8061
|
return [
|
|
8006
8062
|
"npx",
|
|
8007
8063
|
"prisma",
|
|
@@ -8011,7 +8067,7 @@ async function $f(e, t) {
|
|
|
8011
8067
|
w.relative(t, i).split(w.sep).join("/")
|
|
8012
8068
|
];
|
|
8013
8069
|
}
|
|
8014
|
-
async function
|
|
8070
|
+
async function ip(e) {
|
|
8015
8071
|
let t = w.join(e, "prisma"), n = w.join(t, "schema");
|
|
8016
8072
|
if (await K(n)) return n;
|
|
8017
8073
|
let r = w.join(t, "schema.prisma");
|
|
@@ -8019,16 +8075,16 @@ async function ep(e) {
|
|
|
8019
8075
|
}
|
|
8020
8076
|
//#endregion
|
|
8021
8077
|
//#region src/deploy/orchestrate.ts
|
|
8022
|
-
async function
|
|
8078
|
+
async function ap(e) {
|
|
8023
8079
|
let { plan: t, runner: n, log: r } = e, i = [], a = {}, o = { ...e.knownServiceOutputs }, s = {}, c = [], l = {
|
|
8024
8080
|
runner: n,
|
|
8025
8081
|
plan: t,
|
|
8026
8082
|
cwd: t.projectRoot,
|
|
8027
8083
|
log: r
|
|
8028
|
-
}, u = (t) => e.adapters?.[t] ??
|
|
8084
|
+
}, u = (t) => e.adapters?.[t] ?? Xd(t), d = (e, n) => (i.push({
|
|
8029
8085
|
...e,
|
|
8030
8086
|
status: "failed",
|
|
8031
|
-
detail:
|
|
8087
|
+
detail: dp(n)
|
|
8032
8088
|
}), {
|
|
8033
8089
|
plan: t,
|
|
8034
8090
|
steps: i,
|
|
@@ -8037,7 +8093,7 @@ async function tp(e) {
|
|
|
8037
8093
|
envPlans: c,
|
|
8038
8094
|
ok: !1
|
|
8039
8095
|
});
|
|
8040
|
-
if (!e.skipAuthCheck) for (let n of
|
|
8096
|
+
if (!e.skipAuthCheck) for (let n of cp(t)) {
|
|
8041
8097
|
let t = {
|
|
8042
8098
|
id: `auth:${n}`,
|
|
8043
8099
|
label: `Check ${n} login`
|
|
@@ -8102,13 +8158,13 @@ async function tp(e) {
|
|
|
8102
8158
|
}, e.providedByProvider && f && (s[f.target] = [...s[f.target] ?? [], ...e.providedByProvider]), i.push({
|
|
8103
8159
|
...t,
|
|
8104
8160
|
status: "ok",
|
|
8105
|
-
detail: e.note ??
|
|
8161
|
+
detail: e.note ?? up(e.outputs)
|
|
8106
8162
|
});
|
|
8107
8163
|
} catch (e) {
|
|
8108
8164
|
return d(t, e);
|
|
8109
8165
|
}
|
|
8110
8166
|
}
|
|
8111
|
-
c =
|
|
8167
|
+
c = Gf({
|
|
8112
8168
|
plan: t,
|
|
8113
8169
|
serviceOutputs: o,
|
|
8114
8170
|
urls: a,
|
|
@@ -8116,9 +8172,9 @@ async function tp(e) {
|
|
|
8116
8172
|
declaredKeys: e.declaredKeys,
|
|
8117
8173
|
externallyProvided: s
|
|
8118
8174
|
});
|
|
8119
|
-
let p = new Map(c.map((e) => [e.target, e])), m = f && !e.skipMigrations ? await
|
|
8175
|
+
let p = new Map(c.map((e) => [e.target, e])), m = f && !e.skipMigrations ? await rp(f.root, t.projectRoot) : void 0, h = !1;
|
|
8120
8176
|
for (let e of t.targets) {
|
|
8121
|
-
let t = p.get(e.target), n = t ?
|
|
8177
|
+
let t = p.get(e.target), n = t ? Zf(t) : {}, o = lp(n), s = u(e.provider), c = {
|
|
8122
8178
|
id: `env:${e.target}`,
|
|
8123
8179
|
label: `Configure ${e.spec.label} env`
|
|
8124
8180
|
};
|
|
@@ -8172,7 +8228,7 @@ async function tp(e) {
|
|
|
8172
8228
|
detail: `${m.join(" ")} (ran with the release)`
|
|
8173
8229
|
});
|
|
8174
8230
|
else {
|
|
8175
|
-
let e = await
|
|
8231
|
+
let e = await op({
|
|
8176
8232
|
ctx: l,
|
|
8177
8233
|
adapter: u(f.provider),
|
|
8178
8234
|
backend: f,
|
|
@@ -8193,7 +8249,7 @@ async function tp(e) {
|
|
|
8193
8249
|
ok: i.every((e) => e.status !== "failed")
|
|
8194
8250
|
};
|
|
8195
8251
|
}
|
|
8196
|
-
async function
|
|
8252
|
+
async function op(e) {
|
|
8197
8253
|
let { ctx: t, adapter: n, backend: r, command: i } = e;
|
|
8198
8254
|
if (!n.runRemote) return {
|
|
8199
8255
|
status: "skipped",
|
|
@@ -8205,37 +8261,37 @@ async function np(e) {
|
|
|
8205
8261
|
status: "ok",
|
|
8206
8262
|
detail: i.join(" ")
|
|
8207
8263
|
};
|
|
8208
|
-
let o =
|
|
8264
|
+
let o = sp(a.output);
|
|
8209
8265
|
return {
|
|
8210
8266
|
status: "skipped",
|
|
8211
8267
|
detail: `Could not run migrations remotely${o ? ` (${o})` : ""}. Run "${i.join(" ")}" against ${r.app}.`
|
|
8212
8268
|
};
|
|
8213
8269
|
}
|
|
8214
|
-
function
|
|
8270
|
+
function sp(e) {
|
|
8215
8271
|
let t = e.split(/\r?\n/).map((e) => e.trim()).find((e) => e.length > 0);
|
|
8216
8272
|
if (t) return t.length > 160 ? `${t.slice(0, 157)}...` : t;
|
|
8217
8273
|
}
|
|
8218
|
-
function
|
|
8274
|
+
function cp(e) {
|
|
8219
8275
|
let t = /* @__PURE__ */ new Set();
|
|
8220
8276
|
for (let n of e.targets) t.add(n.provider);
|
|
8221
8277
|
for (let n of e.services) n.external || t.add(n.provider);
|
|
8222
8278
|
return [...t];
|
|
8223
8279
|
}
|
|
8224
|
-
function
|
|
8280
|
+
function lp(e) {
|
|
8225
8281
|
return Object.entries(e).filter(([e, t]) => t.length >= 8 && !e.startsWith("VITE_") && !/^https?:\/\//.test(t)).map(([, e]) => e);
|
|
8226
8282
|
}
|
|
8227
|
-
function
|
|
8283
|
+
function up(e) {
|
|
8228
8284
|
let t = Object.keys(e);
|
|
8229
8285
|
return t.length === 0 ? void 0 : `set ${t.join(", ")}`;
|
|
8230
8286
|
}
|
|
8231
|
-
function
|
|
8287
|
+
function dp(e) {
|
|
8232
8288
|
return e instanceof Error ? e.message : String(e);
|
|
8233
8289
|
}
|
|
8234
8290
|
//#endregion
|
|
8235
8291
|
//#region src/deploy/plan.ts
|
|
8236
|
-
function
|
|
8292
|
+
function fp(e) {
|
|
8237
8293
|
let { projectRoot: t, config: n, assignment: r, stackConfig: i, serveModes: a = {}, staticDirs: o = {} } = e, s = [];
|
|
8238
|
-
for (let [e, c] of
|
|
8294
|
+
for (let [e, c] of mp(r)) {
|
|
8239
8295
|
let r = n.targets[e], l = Bu[e];
|
|
8240
8296
|
s.push({
|
|
8241
8297
|
target: e,
|
|
@@ -8248,7 +8304,7 @@ function cp(e) {
|
|
|
8248
8304
|
app: r?.app ?? qu(n.projectName, e),
|
|
8249
8305
|
region: r?.region,
|
|
8250
8306
|
url: r?.url,
|
|
8251
|
-
root:
|
|
8307
|
+
root: jf(t, e, i)
|
|
8252
8308
|
});
|
|
8253
8309
|
}
|
|
8254
8310
|
let c = [];
|
|
@@ -8275,20 +8331,20 @@ function cp(e) {
|
|
|
8275
8331
|
railway: n.railway ?? {}
|
|
8276
8332
|
};
|
|
8277
8333
|
}
|
|
8278
|
-
var
|
|
8334
|
+
var pp = [
|
|
8279
8335
|
"frontend",
|
|
8280
8336
|
"admin",
|
|
8281
8337
|
"backend"
|
|
8282
8338
|
];
|
|
8283
|
-
function
|
|
8339
|
+
function mp(e) {
|
|
8284
8340
|
let t = [];
|
|
8285
|
-
for (let n of
|
|
8341
|
+
for (let n of pp) {
|
|
8286
8342
|
let r = e.targets[n];
|
|
8287
8343
|
r && t.push([n, r]);
|
|
8288
8344
|
}
|
|
8289
8345
|
return t;
|
|
8290
8346
|
}
|
|
8291
|
-
function
|
|
8347
|
+
function hp(e, t) {
|
|
8292
8348
|
let n = {
|
|
8293
8349
|
...e,
|
|
8294
8350
|
environment: t.environment,
|
|
@@ -8318,19 +8374,19 @@ function dp(e, t) {
|
|
|
8318
8374
|
}
|
|
8319
8375
|
//#endregion
|
|
8320
8376
|
//#region src/deploy/project-env.ts
|
|
8321
|
-
async function
|
|
8377
|
+
async function gp(e) {
|
|
8322
8378
|
return await q(e) ? S.readFile(e, "utf-8") : null;
|
|
8323
8379
|
}
|
|
8324
|
-
async function
|
|
8325
|
-
let n =
|
|
8326
|
-
let [t, r] = await Promise.all([
|
|
8380
|
+
async function _p(e, t) {
|
|
8381
|
+
let n = $f(await gp(w.join(e, ".env")) ?? ""), r = await Promise.all(t.map(async (e) => {
|
|
8382
|
+
let [t, r] = await Promise.all([gp(w.join(e.root, ".env")), gp(w.join(e.root, ".env.example"))]);
|
|
8327
8383
|
return {
|
|
8328
8384
|
target: e.target,
|
|
8329
8385
|
local: {
|
|
8330
8386
|
...n,
|
|
8331
|
-
|
|
8387
|
+
...$f(t ?? "")
|
|
8332
8388
|
},
|
|
8333
|
-
declared:
|
|
8389
|
+
declared: tp(r ?? "")
|
|
8334
8390
|
};
|
|
8335
8391
|
})), i = {}, a = {};
|
|
8336
8392
|
for (let e of r) i[e.target] = e.local, a[e.target] = e.declared;
|
|
@@ -8341,7 +8397,7 @@ async function pp(e, t) {
|
|
|
8341
8397
|
}
|
|
8342
8398
|
//#endregion
|
|
8343
8399
|
//#region src/deploy/report.ts
|
|
8344
|
-
function
|
|
8400
|
+
function vp(e) {
|
|
8345
8401
|
let t = [];
|
|
8346
8402
|
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"));
|
|
8347
8403
|
for (let n of e.targets) {
|
|
@@ -8357,7 +8413,7 @@ function mp(e) {
|
|
|
8357
8413
|
}
|
|
8358
8414
|
return t.join("\n");
|
|
8359
8415
|
}
|
|
8360
|
-
function
|
|
8416
|
+
function yp(e) {
|
|
8361
8417
|
let t = [];
|
|
8362
8418
|
for (let n of e) {
|
|
8363
8419
|
let e = Object.keys(n.managed).length, r = Object.keys(n.forwarded).length;
|
|
@@ -8365,19 +8421,19 @@ function hp(e) {
|
|
|
8365
8421
|
}
|
|
8366
8422
|
return t.join("\n");
|
|
8367
8423
|
}
|
|
8368
|
-
function
|
|
8424
|
+
function bp(e) {
|
|
8369
8425
|
return e.steps.map((e) => {
|
|
8370
8426
|
let t = e.status === "ok" ? F.success("✓") : e.status === "skipped" ? F.warning("-") : F.error("✗"), n = e.detail ? ` ${F.muted(e.detail)}` : "";
|
|
8371
8427
|
return `${t} ${e.label}${n}`;
|
|
8372
8428
|
}).join("\n");
|
|
8373
8429
|
}
|
|
8374
|
-
function
|
|
8430
|
+
function xp(e) {
|
|
8375
8431
|
return e.plan.targets.map((t) => {
|
|
8376
8432
|
let n = e.urls[t.target];
|
|
8377
8433
|
return n ? `${F.label(t.spec.label)} ${I(n)}` : `${F.label(t.spec.label)} ${F.muted("no public URL")}`;
|
|
8378
8434
|
}).join("\n");
|
|
8379
8435
|
}
|
|
8380
|
-
function
|
|
8436
|
+
function Sp(e) {
|
|
8381
8437
|
let t = [];
|
|
8382
8438
|
for (let n of e.envPlans) n.missing.length !== 0 && t.push(`${$(n.target)} is missing ${n.missing.join(", ")}. The app will boot only once those are set.`);
|
|
8383
8439
|
for (let n of e.steps) n.status === "skipped" && n.id === "migrate" && n.detail && t.push(n.detail);
|
|
@@ -8385,27 +8441,27 @@ function vp(e) {
|
|
|
8385
8441
|
}
|
|
8386
8442
|
//#endregion
|
|
8387
8443
|
//#region src/commands/deploy.ts
|
|
8388
|
-
async function
|
|
8444
|
+
async function Cp(e = {}) {
|
|
8389
8445
|
let t = w.resolve(e.cwd ?? process.cwd()), n = e.yes === !0;
|
|
8390
8446
|
Bs(), s.intro(F.brandBold("Deploy your stack")), await Ni(t) || z(`${F.path(t)} doesn't look like a Hype Stack project. Run this from the project root.`, { reason: "not_a_project" }), await Oi(t) || z(`${F.path(t)} has no ${F.path(fe)}, 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" });
|
|
8391
|
-
let r = await Y(t).catch(() => null), i = await
|
|
8392
|
-
i ||=
|
|
8447
|
+
let r = await Y(t).catch(() => null), i = await wp(t);
|
|
8448
|
+
i ||= Of(mi(r?.name ?? w.basename(t))), e.environment && (i.environment = e.environment), e.flyOrg && (i.fly = {
|
|
8393
8449
|
...i.fly,
|
|
8394
8450
|
org: e.flyOrg
|
|
8395
8451
|
}), e.railwayWorkspace && (i.railway = {
|
|
8396
8452
|
...i.railway,
|
|
8397
8453
|
workspace: e.railwayWorkspace
|
|
8398
8454
|
});
|
|
8399
|
-
let a = await
|
|
8455
|
+
let a = await Mf(t, r);
|
|
8400
8456
|
a.length === 0 && z("Found no deployable apps. Expected at least one of apps/backend, apps/frontend, or apps/admin.");
|
|
8401
|
-
let o = e.only ?? [], c =
|
|
8457
|
+
let o = e.only ?? [], c = Ep(e.assign), l = Tp(e.provider, "--provider"), u = Ju({
|
|
8402
8458
|
config: i,
|
|
8403
8459
|
defaultProvider: l,
|
|
8404
8460
|
overrides: c,
|
|
8405
8461
|
availableTargets: a,
|
|
8406
8462
|
only: o
|
|
8407
|
-
}), d = await
|
|
8408
|
-
n || (u = await
|
|
8463
|
+
}), d = await Ff(t, Yu(a, o), r);
|
|
8464
|
+
n || (u = await Op({
|
|
8409
8465
|
assignment: u,
|
|
8410
8466
|
availableTargets: a,
|
|
8411
8467
|
requestedTargets: o
|
|
@@ -8417,12 +8473,12 @@ async function yp(e = {}) {
|
|
|
8417
8473
|
serveModes: d
|
|
8418
8474
|
});
|
|
8419
8475
|
f.length > 0 && (R(Qu(f), "Cannot deploy yet"), z("Fix the assignments above and run deploy again.", { reason: "input_required" }));
|
|
8420
|
-
let p =
|
|
8476
|
+
let p = If(d), m = await Mp({
|
|
8421
8477
|
cwd: t,
|
|
8422
8478
|
targets: u.targets,
|
|
8423
8479
|
serveModes: p,
|
|
8424
8480
|
stackConfig: r
|
|
8425
|
-
}), h =
|
|
8481
|
+
}), h = fp({
|
|
8426
8482
|
projectRoot: t,
|
|
8427
8483
|
config: i,
|
|
8428
8484
|
assignment: u,
|
|
@@ -8430,13 +8486,13 @@ async function yp(e = {}) {
|
|
|
8430
8486
|
serveModes: p,
|
|
8431
8487
|
staticDirs: m
|
|
8432
8488
|
});
|
|
8433
|
-
R(
|
|
8489
|
+
R(vp(h), e.dryRun ? "Deployment plan (dry run)" : "Deployment plan");
|
|
8434
8490
|
let g = e.dryRun ? {
|
|
8435
8491
|
env: {},
|
|
8436
8492
|
accounts: {}
|
|
8437
|
-
} : await
|
|
8493
|
+
} : await af({
|
|
8438
8494
|
plan: h,
|
|
8439
|
-
providers:
|
|
8495
|
+
providers: cp(h),
|
|
8440
8496
|
skipPrompts: n
|
|
8441
8497
|
});
|
|
8442
8498
|
if (!n && !e.dryRun) {
|
|
@@ -8445,26 +8501,26 @@ async function yp(e = {}) {
|
|
|
8445
8501
|
message: "Deploying creates billable infrastructure. Re-run with --yes to confirm non-interactively."
|
|
8446
8502
|
});
|
|
8447
8503
|
let e = await s.confirm({
|
|
8448
|
-
message: `Create and deploy this on ${
|
|
8504
|
+
message: `Create and deploy this on ${Np(h.targets.map((e) => e.provider))}?`,
|
|
8449
8505
|
initialValue: !0
|
|
8450
8506
|
});
|
|
8451
8507
|
(s.isCancel(e) || !e) && B();
|
|
8452
8508
|
}
|
|
8453
|
-
let _ = await
|
|
8454
|
-
R(
|
|
8509
|
+
let _ = await _p(t, h.targets);
|
|
8510
|
+
R(yp(qf({
|
|
8455
8511
|
plan: h,
|
|
8456
8512
|
localEnv: _.local,
|
|
8457
8513
|
declaredKeys: _.declared
|
|
8458
8514
|
})), "Environment"), await Nu(t).catch(() => null);
|
|
8459
|
-
let v = xt(), y = [], b = e.dryRun ?
|
|
8515
|
+
let v = xt(), y = [], b = e.dryRun ? nf({
|
|
8460
8516
|
onCommand: (e) => y.push(e),
|
|
8461
|
-
responses:
|
|
8462
|
-
}) :
|
|
8517
|
+
responses: Vf
|
|
8518
|
+
}) : tf({
|
|
8463
8519
|
onCommand: (e) => y.push(e),
|
|
8464
8520
|
env: g.env
|
|
8465
8521
|
});
|
|
8466
8522
|
v.start(e.dryRun ? "Walking the plan" : "Deploying");
|
|
8467
|
-
let x = await
|
|
8523
|
+
let x = await ap({
|
|
8468
8524
|
plan: h,
|
|
8469
8525
|
runner: b,
|
|
8470
8526
|
localEnv: _.local,
|
|
@@ -8475,61 +8531,61 @@ async function yp(e = {}) {
|
|
|
8475
8531
|
knownAccounts: g.accounts,
|
|
8476
8532
|
log: (e) => v.message(e)
|
|
8477
8533
|
});
|
|
8478
|
-
if (v.stop(x.ok ? F.success("Deploy finished") : F.error("Deploy stopped")), R(
|
|
8534
|
+
if (v.stop(x.ok ? F.success("Deploy finished") : F.error("Deploy stopped")), R(bp(x), "Steps"), e.dryRun) {
|
|
8479
8535
|
R(y.map((e) => F.command(e)).join("\n"), "Commands that would run"), s.outro(F.muted("Dry run only. No infrastructure was created."));
|
|
8480
8536
|
return;
|
|
8481
8537
|
}
|
|
8482
|
-
if (await
|
|
8538
|
+
if (await Df(t, hp(i, x.plan)), !x.ok) {
|
|
8483
8539
|
let e = x.steps.find((e) => e.status === "failed");
|
|
8484
8540
|
R(`${e?.label ?? "A step"} failed.\n${e?.detail ?? ""}\n\nWhat succeeded is saved in ${F.path(Pu)}, so re-running picks up from here.`, "Deploy failed"), z("Deploy did not finish.");
|
|
8485
8541
|
}
|
|
8486
|
-
R(
|
|
8487
|
-
let S =
|
|
8542
|
+
R(xp(x), "Live");
|
|
8543
|
+
let S = Sp(x);
|
|
8488
8544
|
S.length > 0 && R(S.map((e) => `${F.warning("!")} ${e}`).join("\n\n"), "Still to do"), s.outro(F.brand("Shipped."));
|
|
8489
8545
|
}
|
|
8490
|
-
async function
|
|
8546
|
+
async function wp(e) {
|
|
8491
8547
|
try {
|
|
8492
|
-
return await
|
|
8548
|
+
return await Ef(e);
|
|
8493
8549
|
} catch (e) {
|
|
8494
8550
|
z(e instanceof Error ? e.message : String(e));
|
|
8495
8551
|
}
|
|
8496
8552
|
}
|
|
8497
|
-
function
|
|
8553
|
+
function Tp(e, t) {
|
|
8498
8554
|
if (e) return Wu(e) || z(`Unknown provider "${e}" for ${t}. Pick one of ${Object.keys(Hu).join(", ")}.`), e;
|
|
8499
8555
|
}
|
|
8500
|
-
function
|
|
8556
|
+
function Ep(e) {
|
|
8501
8557
|
let t = {};
|
|
8502
8558
|
for (let [n, r] of Object.entries(e ?? {})) {
|
|
8503
|
-
let e =
|
|
8559
|
+
let e = Tp(r, `--${n}`);
|
|
8504
8560
|
e && (t[n] = e);
|
|
8505
8561
|
}
|
|
8506
8562
|
return t;
|
|
8507
8563
|
}
|
|
8508
|
-
function
|
|
8564
|
+
function Dp(e) {
|
|
8509
8565
|
let { assignment: t, availableTargets: n, requestedTargets: r } = e, i = Yu(n, r).filter((e) => !t.targets[e]);
|
|
8510
8566
|
return {
|
|
8511
8567
|
targets: i,
|
|
8512
8568
|
services: t.targets.backend !== void 0 || i.includes("backend") ? Ru.filter((e) => !t.services[e]) : []
|
|
8513
8569
|
};
|
|
8514
8570
|
}
|
|
8515
|
-
async function
|
|
8571
|
+
async function Op(e) {
|
|
8516
8572
|
let t = {
|
|
8517
8573
|
targets: { ...e.assignment.targets },
|
|
8518
8574
|
services: { ...e.assignment.services }
|
|
8519
|
-
}, { targets: n, services: r } =
|
|
8575
|
+
}, { targets: n, services: r } = Dp(e);
|
|
8520
8576
|
if (n.length + r.length > 1) {
|
|
8521
|
-
let e = await
|
|
8577
|
+
let e = await kp();
|
|
8522
8578
|
if (e) {
|
|
8523
8579
|
for (let r of n) t.targets[r] = e;
|
|
8524
8580
|
for (let n of r) t.services[n] = e;
|
|
8525
8581
|
return t;
|
|
8526
8582
|
}
|
|
8527
8583
|
}
|
|
8528
|
-
for (let e of n) t.targets[e] = await
|
|
8529
|
-
for (let e of r) t.services[e] = await
|
|
8584
|
+
for (let e of n) t.targets[e] = await jp(e, Ku(e));
|
|
8585
|
+
for (let e of r) t.services[e] = await jp(e, Ku(e));
|
|
8530
8586
|
return t;
|
|
8531
8587
|
}
|
|
8532
|
-
async function
|
|
8588
|
+
async function kp() {
|
|
8533
8589
|
let e = await s.select({
|
|
8534
8590
|
message: `Where should ${F.highlight("your stack")} live?`,
|
|
8535
8591
|
options: [...zu.map((e) => ({
|
|
@@ -8537,16 +8593,16 @@ async function Tp() {
|
|
|
8537
8593
|
label: Gu(e),
|
|
8538
8594
|
hint: `everything on ${Hu[e].bin}`
|
|
8539
8595
|
})), {
|
|
8540
|
-
value:
|
|
8596
|
+
value: Ap,
|
|
8541
8597
|
label: "Mix providers",
|
|
8542
8598
|
hint: "choose for each app and service"
|
|
8543
8599
|
}],
|
|
8544
8600
|
initialValue: zu[0]
|
|
8545
8601
|
});
|
|
8546
|
-
return s.isCancel(e) && B(), e ===
|
|
8602
|
+
return s.isCancel(e) && B(), e === Ap ? void 0 : e;
|
|
8547
8603
|
}
|
|
8548
|
-
var
|
|
8549
|
-
async function
|
|
8604
|
+
var Ap = "__mixed__";
|
|
8605
|
+
async function jp(e, t) {
|
|
8550
8606
|
if (t.length === 0 && z(`Nothing in this CLI can host ${$(e)}. Provision it yourself and add it to the "${Fu}" block of ${Pu}.`), t.length === 1) return t[0];
|
|
8551
8607
|
let n = await s.select({
|
|
8552
8608
|
message: `Where should ${F.highlight($(e))} live?`,
|
|
@@ -8559,17 +8615,17 @@ async function Dp(e, t) {
|
|
|
8559
8615
|
});
|
|
8560
8616
|
return s.isCancel(n) && B(), n;
|
|
8561
8617
|
}
|
|
8562
|
-
async function
|
|
8563
|
-
let { cwd: t, targets: n, serveModes: r, stackConfig: i } = e, a = Object.keys(n).filter((e) => Uu(e) && r[e] === "static"), o = await Promise.all(a.map(async (e) => [e, await
|
|
8618
|
+
async function Mp(e) {
|
|
8619
|
+
let { cwd: t, targets: n, serveModes: r, stackConfig: i } = e, a = Object.keys(n).filter((e) => Uu(e) && r[e] === "static"), o = await Promise.all(a.map(async (e) => [e, await Lf(jf(t, e, i), e)]));
|
|
8564
8620
|
return Object.fromEntries(o);
|
|
8565
8621
|
}
|
|
8566
|
-
function
|
|
8622
|
+
function Np(e) {
|
|
8567
8623
|
let t = [...new Set(e)].map(Gu);
|
|
8568
8624
|
return t.length <= 1 ? t[0] ?? "your provider" : `${t.slice(0, -1).join(", ")} and ${t[t.length - 1]}`;
|
|
8569
8625
|
}
|
|
8570
8626
|
//#endregion
|
|
8571
8627
|
//#region src/commands/login.ts
|
|
8572
|
-
async function
|
|
8628
|
+
async function Pp() {
|
|
8573
8629
|
Vs(), s.intro(F.brandBold("Log in to Hype Stack")), He() && s.log.warn(`${N} is set and takes priority over this login. Unset it to use the browser session.`), s.log.step("Opening your browser to sign in...");
|
|
8574
8630
|
let e;
|
|
8575
8631
|
try {
|
|
@@ -8583,7 +8639,7 @@ async function Ap() {
|
|
|
8583
8639
|
}
|
|
8584
8640
|
//#endregion
|
|
8585
8641
|
//#region src/commands/logout.ts
|
|
8586
|
-
async function
|
|
8642
|
+
async function Fp() {
|
|
8587
8643
|
Vs(), s.intro(F.brandBold("Log out of Hype Stack"));
|
|
8588
8644
|
let e = M(), t = await Ue(e);
|
|
8589
8645
|
if (!t) {
|
|
@@ -8594,8 +8650,8 @@ async function jp() {
|
|
|
8594
8650
|
}
|
|
8595
8651
|
//#endregion
|
|
8596
8652
|
//#region src/commands/mcp.ts
|
|
8597
|
-
async function
|
|
8598
|
-
let t =
|
|
8653
|
+
async function Ip(e = {}) {
|
|
8654
|
+
let t = Rp(e.editor), n = Zc(t), r = zp(e.scope, t, n), i = Lp(e.token);
|
|
8599
8655
|
if (e.print) {
|
|
8600
8656
|
process.stdout.write(el(t, i));
|
|
8601
8657
|
return;
|
|
@@ -8609,28 +8665,28 @@ async function Mp(e = {}) {
|
|
|
8609
8665
|
});
|
|
8610
8666
|
a.changed ? s.log.success(`Wrote ${F.path(a.configPath)}`) : s.log.info(F.muted(`${F.path(a.configPath)} is already up to date.`)), i && s.log.warn(F.muted(`${N} is stored in plain text. Keep this file out of version control.`)), s.outro(F.muted("Restart your editor to pick up the server."));
|
|
8611
8667
|
}
|
|
8612
|
-
function
|
|
8668
|
+
function Lp(e) {
|
|
8613
8669
|
return e?.trim() || void 0;
|
|
8614
8670
|
}
|
|
8615
|
-
function
|
|
8671
|
+
function Rp(e) {
|
|
8616
8672
|
return e ? (Jc(e) || z(`Unknown editor "${e}". Expected one of: ${Gc.join(", ")}.`), e) : "cursor";
|
|
8617
8673
|
}
|
|
8618
|
-
function
|
|
8674
|
+
function zp(e, t, n) {
|
|
8619
8675
|
let r = e ?? n[0];
|
|
8620
8676
|
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;
|
|
8621
8677
|
}
|
|
8622
8678
|
//#endregion
|
|
8623
8679
|
//#region src/core/templates.ts
|
|
8624
|
-
var
|
|
8680
|
+
var Bp = W.createRequest()({
|
|
8625
8681
|
endpoint: "/templates/list",
|
|
8626
8682
|
method: "GET"
|
|
8627
8683
|
});
|
|
8628
|
-
async function
|
|
8629
|
-
let { data: e, error: t } = await
|
|
8684
|
+
async function Vp() {
|
|
8685
|
+
let { data: e, error: t } = await Bp.send();
|
|
8630
8686
|
if (t || !e) throw Error(`Failed to fetch template list: ${String(t)}`);
|
|
8631
8687
|
return e.templates;
|
|
8632
8688
|
}
|
|
8633
|
-
async function
|
|
8689
|
+
async function Hp(e) {
|
|
8634
8690
|
let { data: t, error: n, status: r } = await W.createRequest()({
|
|
8635
8691
|
endpoint: `/templates/${encodeURIComponent(e)}/manifest`,
|
|
8636
8692
|
method: "GET"
|
|
@@ -8639,7 +8695,7 @@ async function Rp(e) {
|
|
|
8639
8695
|
if (n || !t) throw Error(`Failed to load manifest for template "${e}": ${String(n)}`);
|
|
8640
8696
|
return t;
|
|
8641
8697
|
}
|
|
8642
|
-
async function
|
|
8698
|
+
async function Up(e, t = {}) {
|
|
8643
8699
|
let n = W.createRequest()({
|
|
8644
8700
|
endpoint: `/templates/${encodeURIComponent(e)}/download`,
|
|
8645
8701
|
method: "POST"
|
|
@@ -8675,7 +8731,7 @@ async function zp(e, t = {}) {
|
|
|
8675
8731
|
}
|
|
8676
8732
|
//#endregion
|
|
8677
8733
|
//#region src/commands/template.ts
|
|
8678
|
-
async function
|
|
8734
|
+
async function Wp(e = {}) {
|
|
8679
8735
|
let t = e.cwd ?? process.cwd();
|
|
8680
8736
|
Bs(), await Ss();
|
|
8681
8737
|
let r = s.spinner();
|
|
@@ -8689,7 +8745,7 @@ async function Bp(e = {}) {
|
|
|
8689
8745
|
r.stop("Packs loaded"), r.start("Loading templates...");
|
|
8690
8746
|
let c;
|
|
8691
8747
|
try {
|
|
8692
|
-
c = await
|
|
8748
|
+
c = await Vp();
|
|
8693
8749
|
} catch (e) {
|
|
8694
8750
|
r.stop("Failed to load templates"), z(`Could not reach Hype Stack. Check your connection and try again.\n${Q(e)}`);
|
|
8695
8751
|
}
|
|
@@ -8712,7 +8768,7 @@ async function Bp(e = {}) {
|
|
|
8712
8768
|
u || (r.stop("Template not found"), z(`Template "${l}" not found. Available: ${c.map((e) => e.id).join(", ") || "(none)"}`)), r.stop(`Template: ${u.name}`);
|
|
8713
8769
|
let d;
|
|
8714
8770
|
try {
|
|
8715
|
-
d = await
|
|
8771
|
+
d = await Hp(u.id);
|
|
8716
8772
|
} catch (e) {
|
|
8717
8773
|
z(Q(e));
|
|
8718
8774
|
}
|
|
@@ -8729,7 +8785,7 @@ async function Bp(e = {}) {
|
|
|
8729
8785
|
h || z(p ? `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'.`), h.paths || z(`${F.path("stack.json")} is missing ${F.path("paths")}. Run 'npx @hype-stack/cli init' again to regenerate it.`);
|
|
8730
8786
|
let _ = p ?? t;
|
|
8731
8787
|
s.intro(F.brandBold("Install a template"));
|
|
8732
|
-
let v = h.installedPacks ?? [], y = new Set(v), b = new Map(o.map((e) => [e.name, e])), x = (await Ve(M()))?.token ?? null, C = await
|
|
8788
|
+
let v = h.installedPacks ?? [], y = new Set(v), b = new Map(o.map((e) => [e.name, e])), x = (await Ve(M()))?.token ?? null, C = await Gp(u, e.variants, e.yes ?? !1), T = Ds(u.slots, C), E = Os(u.slots, u.packs, T), D = await Kp({
|
|
8733
8789
|
packs: o,
|
|
8734
8790
|
templatePacks: E,
|
|
8735
8791
|
installedSet: y,
|
|
@@ -8804,7 +8860,7 @@ async function Bp(e = {}) {
|
|
|
8804
8860
|
r.stop("Files installed"), t.installed.length > 0 && s.log.success(`${F.highlight(String(t.installed.length))} files installed`), t.skipped.length > 0 && (s.log.warning(`${t.skipped.length} files skipped (use --force to overwrite)`), Wl(t.skipped));
|
|
8805
8861
|
for (let e of t.errors) s.log.error(e);
|
|
8806
8862
|
r.start("Applying template overrides...");
|
|
8807
|
-
let o = await
|
|
8863
|
+
let o = await Up(u.id, { token: x });
|
|
8808
8864
|
o.status === "denied" && (r.stop("Template download denied"), z(zl(u.id, o.reason))), se = o.templateDir;
|
|
8809
8865
|
let c = await Jo({
|
|
8810
8866
|
manifest: d,
|
|
@@ -8829,7 +8885,7 @@ async function Bp(e = {}) {
|
|
|
8829
8885
|
let r = d.defaultMode === "dark" || d.defaultMode === "light" ? d.defaultMode : i;
|
|
8830
8886
|
await ac(e, r) ? s.log.success(`Default color mode set to ${r}`) : s.log.warning(F.muted(`Could not find ${F.path("src/hooks/use-theme.ts")} to set the default color mode`));
|
|
8831
8887
|
}
|
|
8832
|
-
await
|
|
8888
|
+
await qp({
|
|
8833
8889
|
prepared: A,
|
|
8834
8890
|
templateNpm: d.dependencies_npm,
|
|
8835
8891
|
paths: h.paths,
|
|
@@ -8859,7 +8915,7 @@ async function Bp(e = {}) {
|
|
|
8859
8915
|
skipBanner: !0
|
|
8860
8916
|
});
|
|
8861
8917
|
}
|
|
8862
|
-
async function
|
|
8918
|
+
async function Gp(e, t, n) {
|
|
8863
8919
|
let r = {};
|
|
8864
8920
|
for (let i of e.slots) {
|
|
8865
8921
|
if (t?.[i.family]) {
|
|
@@ -8883,7 +8939,7 @@ async function Vp(e, t, n) {
|
|
|
8883
8939
|
}
|
|
8884
8940
|
return r;
|
|
8885
8941
|
}
|
|
8886
|
-
async function
|
|
8942
|
+
async function Kp(e) {
|
|
8887
8943
|
let { packs: t, templatePacks: n, installedSet: r, options: i } = e, a = new Set(n);
|
|
8888
8944
|
if (i.packs && i.packs.length > 0) {
|
|
8889
8945
|
let e = i.packs.filter((e) => !t.some((t) => t.name === e));
|
|
@@ -8905,7 +8961,7 @@ async function Hp(e) {
|
|
|
8905
8961
|
});
|
|
8906
8962
|
return g(c) && z("Cancelled.", { code: 0 }), c;
|
|
8907
8963
|
}
|
|
8908
|
-
async function
|
|
8964
|
+
async function qp(e) {
|
|
8909
8965
|
let { prepared: t, templateNpm: n, paths: r, cwd: i, spinner: a } = e, o = Nl(t.map((e) => e.manifest.dependencies_npm)), c = Ml(n ? Nl([o, n]) : o, r);
|
|
8910
8966
|
if (c.errors.length > 0) {
|
|
8911
8967
|
for (let e of c.errors) s.log.error(e);
|
|
@@ -8918,9 +8974,9 @@ async function Up(e) {
|
|
|
8918
8974
|
}
|
|
8919
8975
|
//#endregion
|
|
8920
8976
|
//#region src/mcp/guard.ts
|
|
8921
|
-
var
|
|
8922
|
-
function
|
|
8923
|
-
if (
|
|
8977
|
+
var Jp = null;
|
|
8978
|
+
function Yp() {
|
|
8979
|
+
if (Jp) return Jp.protocolStream;
|
|
8924
8980
|
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 le({
|
|
8925
8981
|
write(t, n, r) {
|
|
8926
8982
|
e(t, (e) => r(e ?? null));
|
|
@@ -8929,7 +8985,7 @@ function Gp() {
|
|
|
8929
8985
|
e();
|
|
8930
8986
|
}
|
|
8931
8987
|
}), s = ((e, t, n) => typeof t == "function" ? process.stderr.write(e, t) : process.stderr.write(e, t, n));
|
|
8932
|
-
return process.stdout.write = s, console.log = console.error, console.info = console.error, console.debug = console.error, console.dir = console.error,
|
|
8988
|
+
return process.stdout.write = s, console.log = console.error, console.info = console.error, console.debug = console.error, console.dir = console.error, Jp = {
|
|
8933
8989
|
protocolStream: o,
|
|
8934
8990
|
restore: () => {
|
|
8935
8991
|
process.stdout.write = t, console.log = n, console.info = r, console.debug = i, console.dir = a;
|
|
@@ -8938,22 +8994,22 @@ function Gp() {
|
|
|
8938
8994
|
}
|
|
8939
8995
|
//#endregion
|
|
8940
8996
|
//#region src/mcp/result.ts
|
|
8941
|
-
async function
|
|
8997
|
+
async function Xp(e) {
|
|
8942
8998
|
Qe();
|
|
8943
8999
|
try {
|
|
8944
|
-
return
|
|
9000
|
+
return Zp({
|
|
8945
9001
|
...await e(),
|
|
8946
9002
|
ok: !0,
|
|
8947
9003
|
logs: $e()
|
|
8948
9004
|
}, !1);
|
|
8949
9005
|
} catch (e) {
|
|
8950
|
-
return tt(e) ?
|
|
9006
|
+
return tt(e) ? Zp({
|
|
8951
9007
|
ok: !1,
|
|
8952
9008
|
reason: e.reason,
|
|
8953
9009
|
message: e.message,
|
|
8954
9010
|
details: e.details,
|
|
8955
9011
|
logs: $e()
|
|
8956
|
-
}, !1) :
|
|
9012
|
+
}, !1) : Zp({
|
|
8957
9013
|
ok: !1,
|
|
8958
9014
|
reason: "failed",
|
|
8959
9015
|
message: e instanceof Error ? e.message : String(e),
|
|
@@ -8962,7 +9018,7 @@ async function Kp(e) {
|
|
|
8962
9018
|
}, !0);
|
|
8963
9019
|
}
|
|
8964
9020
|
}
|
|
8965
|
-
function
|
|
9021
|
+
function Zp(e, t) {
|
|
8966
9022
|
return {
|
|
8967
9023
|
content: [{
|
|
8968
9024
|
type: "text",
|
|
@@ -8974,7 +9030,7 @@ function qp(e, t) {
|
|
|
8974
9030
|
}
|
|
8975
9031
|
//#endregion
|
|
8976
9032
|
//#region src/mcp/tools/context.ts
|
|
8977
|
-
async function
|
|
9033
|
+
async function Qp() {
|
|
8978
9034
|
let e = await Ve(M());
|
|
8979
9035
|
return e ? {
|
|
8980
9036
|
token: e.token,
|
|
@@ -8984,26 +9040,26 @@ async function Jp() {
|
|
|
8984
9040
|
source: "none"
|
|
8985
9041
|
};
|
|
8986
9042
|
}
|
|
8987
|
-
function
|
|
9043
|
+
function $p(e) {
|
|
8988
9044
|
return w.resolve(e ?? process.cwd());
|
|
8989
9045
|
}
|
|
8990
|
-
var
|
|
9046
|
+
var em = {
|
|
8991
9047
|
envVar: N,
|
|
8992
9048
|
loginCommand: "npx @hype-stack/cli login"
|
|
8993
|
-
},
|
|
9049
|
+
}, tm = {
|
|
8994
9050
|
packs: j.array(j.string()).min(1).describe("Pack names to install. Append @frontend or @admin to a layout pack to target one shell."),
|
|
8995
9051
|
cwd: j.string().optional().describe("Project directory. Defaults to the workspace the server was started in."),
|
|
8996
9052
|
onConflict: j.enum(["keep", "overwrite"]).default("keep").describe("What to do with files that already exist: keep them, or let the pack overwrite them")
|
|
8997
9053
|
};
|
|
8998
|
-
async function
|
|
8999
|
-
let t =
|
|
9054
|
+
async function nm(e) {
|
|
9055
|
+
let t = $p(e.cwd), n = await rm(t);
|
|
9000
9056
|
await lu({
|
|
9001
9057
|
cwd: t,
|
|
9002
9058
|
packs: e.packs,
|
|
9003
9059
|
force: e.onConflict === "overwrite",
|
|
9004
9060
|
yes: !0
|
|
9005
9061
|
});
|
|
9006
|
-
let r = await
|
|
9062
|
+
let r = await rm(t), i = r.filter((e) => !n.includes(e));
|
|
9007
9063
|
return {
|
|
9008
9064
|
cwd: t,
|
|
9009
9065
|
installed: i,
|
|
@@ -9011,21 +9067,21 @@ async function Qp(e) {
|
|
|
9011
9067
|
followUp: i.length > 0 ? [...rs, "npx @hype-stack/cli onboard"] : []
|
|
9012
9068
|
};
|
|
9013
9069
|
}
|
|
9014
|
-
async function
|
|
9070
|
+
async function rm(e) {
|
|
9015
9071
|
return (await Y(e).catch(() => null))?.installedPacks ?? [];
|
|
9016
9072
|
}
|
|
9017
9073
|
//#endregion
|
|
9018
9074
|
//#region src/mcp/tools/apply-template.ts
|
|
9019
|
-
var
|
|
9075
|
+
var im = {
|
|
9020
9076
|
templateId: j.string().min(1).describe("Template id, e.g. vault. Use search_catalog to find one."),
|
|
9021
9077
|
cwd: j.string().optional().describe("Project directory. Defaults to the workspace the server was started in."),
|
|
9022
9078
|
variants: j.record(j.string(), j.string()).optional().describe("Slot overrides keyed by family, e.g. { \"starter-saas\": \"starter-saas-better-auth\" }"),
|
|
9023
9079
|
packs: j.array(j.string()).optional().describe("Extra packs to install on top of the template"),
|
|
9024
9080
|
onConflict: j.enum(["keep", "overwrite"]).default("keep").describe("What to do with files that already exist: keep them, or let the template overwrite them")
|
|
9025
9081
|
};
|
|
9026
|
-
async function
|
|
9027
|
-
let t =
|
|
9028
|
-
await
|
|
9082
|
+
async function am(e) {
|
|
9083
|
+
let t = $p(e.cwd), n = await om(t);
|
|
9084
|
+
await Wp({
|
|
9029
9085
|
cwd: t,
|
|
9030
9086
|
templateId: e.templateId,
|
|
9031
9087
|
variants: e.variants,
|
|
@@ -9033,7 +9089,7 @@ async function tm(e) {
|
|
|
9033
9089
|
force: e.onConflict === "overwrite",
|
|
9034
9090
|
yes: !0
|
|
9035
9091
|
});
|
|
9036
|
-
let r = await
|
|
9092
|
+
let r = await om(t);
|
|
9037
9093
|
return {
|
|
9038
9094
|
cwd: t,
|
|
9039
9095
|
templateId: e.templateId,
|
|
@@ -9042,21 +9098,21 @@ async function tm(e) {
|
|
|
9042
9098
|
followUp: [...rs, "npx @hype-stack/cli onboard"]
|
|
9043
9099
|
};
|
|
9044
9100
|
}
|
|
9045
|
-
async function
|
|
9101
|
+
async function om(e) {
|
|
9046
9102
|
return (await Y(e).catch(() => null))?.installedPacks ?? [];
|
|
9047
9103
|
}
|
|
9048
9104
|
//#endregion
|
|
9049
9105
|
//#region src/mcp/tools/auth-status.ts
|
|
9050
|
-
var
|
|
9051
|
-
async function
|
|
9052
|
-
let { token: e, source: t } = await
|
|
9106
|
+
var sm = {};
|
|
9107
|
+
async function cm() {
|
|
9108
|
+
let { token: e, source: t } = await Qp();
|
|
9053
9109
|
if (!e) return {
|
|
9054
9110
|
authenticated: !1,
|
|
9055
9111
|
tokenSource: "none",
|
|
9056
9112
|
apiUrl: M(),
|
|
9057
|
-
hint: `Run '${
|
|
9113
|
+
hint: `Run '${em.loginCommand}' in your terminal, or add ${em.envVar} to this server's env block in your editor's MCP config.`,
|
|
9058
9114
|
apiKeysUrl: `${je()}/api-keys`,
|
|
9059
|
-
...
|
|
9115
|
+
...em
|
|
9060
9116
|
};
|
|
9061
9117
|
let n = await Br(e);
|
|
9062
9118
|
return n ? {
|
|
@@ -9069,14 +9125,14 @@ async function im() {
|
|
|
9069
9125
|
authenticated: !1,
|
|
9070
9126
|
tokenSource: t,
|
|
9071
9127
|
apiUrl: M(),
|
|
9072
|
-
hint: t === "env" ? `The token in ${
|
|
9128
|
+
hint: t === "env" ? `The token in ${em.envVar} was rejected. It may be expired or revoked; mint a new one.` : `Your saved login was rejected. Run '${em.loginCommand}' again.`,
|
|
9073
9129
|
apiKeysUrl: `${je()}/api-keys`,
|
|
9074
|
-
...
|
|
9130
|
+
...em
|
|
9075
9131
|
};
|
|
9076
9132
|
}
|
|
9077
9133
|
//#endregion
|
|
9078
9134
|
//#region src/mcp/tools/create-application.ts
|
|
9079
|
-
var
|
|
9135
|
+
var lm = {
|
|
9080
9136
|
name: j.string().min(1).describe("Application name. Becomes the folder name and the package scope."),
|
|
9081
9137
|
directory: j.string().optional().describe("Parent folder to create the app inside. Defaults to the current workspace."),
|
|
9082
9138
|
editors: j.array(j.enum(ye)).optional().describe("AI editors to ship rule formats for. Pass every editor the team uses, they coexist. Defaults to cursor."),
|
|
@@ -9084,8 +9140,8 @@ var am = {
|
|
|
9084
9140
|
theme: j.string().optional().describe("Frontend color theme id"),
|
|
9085
9141
|
adminTheme: j.string().optional().describe("Admin color theme id. Defaults to the frontend theme.")
|
|
9086
9142
|
};
|
|
9087
|
-
async function
|
|
9088
|
-
let t =
|
|
9143
|
+
async function um(e) {
|
|
9144
|
+
let t = $p(e.directory), n = dm(e), r = await Kl({
|
|
9089
9145
|
name: e.name,
|
|
9090
9146
|
parentDirectory: t,
|
|
9091
9147
|
editors: n,
|
|
@@ -9098,19 +9154,19 @@ async function om(e) {
|
|
|
9098
9154
|
return {
|
|
9099
9155
|
projectRoot: r,
|
|
9100
9156
|
editors: n,
|
|
9101
|
-
mcpConfigPaths:
|
|
9157
|
+
mcpConfigPaths: fm(n, r),
|
|
9102
9158
|
followUp: [`cd ${r}`, ...rs]
|
|
9103
9159
|
};
|
|
9104
9160
|
}
|
|
9105
|
-
function
|
|
9161
|
+
function dm(e) {
|
|
9106
9162
|
let { editors: t, unknown: n } = Ce([...e.editors ?? [], ...e.editor ? [e.editor] : []]);
|
|
9107
9163
|
if (n.length > 0) throw Error(`Unknown editor "${n.join(", ")}". Expected one of: ${ye.join(", ")}.`);
|
|
9108
9164
|
return t.length > 0 ? t : [be];
|
|
9109
9165
|
}
|
|
9110
|
-
function
|
|
9111
|
-
return Xc(e).map((e) =>
|
|
9166
|
+
function fm(e, t) {
|
|
9167
|
+
return Xc(e).map((e) => pm(e, t)).filter((e) => e !== null);
|
|
9112
9168
|
}
|
|
9113
|
-
function
|
|
9169
|
+
function pm(e, t) {
|
|
9114
9170
|
try {
|
|
9115
9171
|
return Qc({
|
|
9116
9172
|
editor: e,
|
|
@@ -9123,8 +9179,8 @@ function lm(e, t) {
|
|
|
9123
9179
|
}
|
|
9124
9180
|
//#endregion
|
|
9125
9181
|
//#region src/core/env-status.ts
|
|
9126
|
-
async function
|
|
9127
|
-
let n = t?.onboarding?.envSections ?? [], r = await Uc(e), i = await Promise.all(r.map((t) =>
|
|
9182
|
+
async function mm(e, t) {
|
|
9183
|
+
let n = t?.onboarding?.envSections ?? [], r = await Uc(e), i = await Promise.all(r.map((t) => hm({
|
|
9128
9184
|
examplePath: t,
|
|
9129
9185
|
projectRoot: e,
|
|
9130
9186
|
installedEnvSections: n
|
|
@@ -9134,7 +9190,7 @@ async function um(e, t) {
|
|
|
9134
9190
|
missingCount: i.reduce((e, t) => e + t.sections.filter((e) => e.relevant).reduce((e, t) => e + t.vars.filter((e) => e.state === "missing").length, 0), 0)
|
|
9135
9191
|
};
|
|
9136
9192
|
}
|
|
9137
|
-
async function
|
|
9193
|
+
async function hm(e) {
|
|
9138
9194
|
let { examplePath: t, projectRoot: n, installedEnvSections: r } = e, i = w.join(w.dirname(t), ".env"), a = await S.readFile(t, "utf-8"), o = await Ql(i), s = Yl(a).map((e) => {
|
|
9139
9195
|
let t = Si(e.section);
|
|
9140
9196
|
return {
|
|
@@ -9143,7 +9199,7 @@ async function dm(e) {
|
|
|
9143
9199
|
link: t.link ?? null,
|
|
9144
9200
|
vars: e.vars.map((e) => ({
|
|
9145
9201
|
key: e.key,
|
|
9146
|
-
state:
|
|
9202
|
+
state: gm(_m(o, e.key), e.value)
|
|
9147
9203
|
}))
|
|
9148
9204
|
};
|
|
9149
9205
|
});
|
|
@@ -9154,10 +9210,10 @@ async function dm(e) {
|
|
|
9154
9210
|
sections: s
|
|
9155
9211
|
};
|
|
9156
9212
|
}
|
|
9157
|
-
function
|
|
9213
|
+
function gm(e, t) {
|
|
9158
9214
|
return e === "" ? "missing" : e === t.trim() ? "default" : "filled";
|
|
9159
9215
|
}
|
|
9160
|
-
function
|
|
9216
|
+
function _m(e, t) {
|
|
9161
9217
|
for (let n of e.split(/\r?\n/)) {
|
|
9162
9218
|
let e = n.trim();
|
|
9163
9219
|
if (e.startsWith("#")) continue;
|
|
@@ -9168,15 +9224,15 @@ function pm(e, t) {
|
|
|
9168
9224
|
}
|
|
9169
9225
|
//#endregion
|
|
9170
9226
|
//#region src/mcp/tools/env-status.ts
|
|
9171
|
-
var
|
|
9172
|
-
async function
|
|
9173
|
-
let t =
|
|
9227
|
+
var vm = { cwd: j.string().optional().describe("Project directory. Defaults to the workspace the server was started in.") };
|
|
9228
|
+
async function ym(e) {
|
|
9229
|
+
let t = $p(e.cwd), n = await Y(t).catch(() => null);
|
|
9174
9230
|
if (!n) throw new et({
|
|
9175
9231
|
reason: "not_a_project",
|
|
9176
9232
|
message: `${t} has no stack.json, so there is nothing to check.`,
|
|
9177
9233
|
details: { cwd: t }
|
|
9178
9234
|
});
|
|
9179
|
-
let r = await
|
|
9235
|
+
let r = await mm(t, n);
|
|
9180
9236
|
return {
|
|
9181
9237
|
cwd: t,
|
|
9182
9238
|
missingCount: r.missingCount,
|
|
@@ -9186,9 +9242,9 @@ async function hm(e) {
|
|
|
9186
9242
|
}
|
|
9187
9243
|
//#endregion
|
|
9188
9244
|
//#region src/mcp/tools/inspect-stack.ts
|
|
9189
|
-
var
|
|
9190
|
-
async function
|
|
9191
|
-
let t =
|
|
9245
|
+
var bm = { cwd: j.string().optional().describe("Project directory. Defaults to the workspace the server was started in.") };
|
|
9246
|
+
async function xm(e) {
|
|
9247
|
+
let t = $p(e.cwd), n = await Y(t).catch(() => null);
|
|
9192
9248
|
if (!n) throw new et({
|
|
9193
9249
|
reason: "not_a_project",
|
|
9194
9250
|
message: await Ni(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.`,
|
|
@@ -9215,12 +9271,12 @@ async function _m(e) {
|
|
|
9215
9271
|
}
|
|
9216
9272
|
//#endregion
|
|
9217
9273
|
//#region src/mcp/tools/plan-install.ts
|
|
9218
|
-
var
|
|
9274
|
+
var Sm = {
|
|
9219
9275
|
packs: j.array(j.string()).min(1).describe("Pack names to plan an install for"),
|
|
9220
9276
|
cwd: j.string().optional().describe("Project directory. Defaults to the workspace the server was started in.")
|
|
9221
9277
|
};
|
|
9222
|
-
async function
|
|
9223
|
-
let t =
|
|
9278
|
+
async function Cm(e) {
|
|
9279
|
+
let t = $p(e.cwd), { token: n, source: r } = await Qp(), i = await Y(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));
|
|
9224
9280
|
if (c.length > 0) throw Error(`Unknown pack${c.length === 1 ? "" : "s"}: ${c.join(", ")}`);
|
|
9225
9281
|
let l = Cs(o), u = Ts(e.packs, l, a), d = await Fl(u.order.map((e) => s.get(e)).filter((e) => e !== void 0), new Set(a), { token: n }), f = (e) => {
|
|
9226
9282
|
let t = s.get(e);
|
|
@@ -9249,12 +9305,12 @@ async function ym(e) {
|
|
|
9249
9305
|
purchaseUrl: n ? St(e) : null
|
|
9250
9306
|
};
|
|
9251
9307
|
}),
|
|
9252
|
-
...n === null ? { authHint:
|
|
9308
|
+
...n === null ? { authHint: em } : {}
|
|
9253
9309
|
};
|
|
9254
9310
|
}
|
|
9255
9311
|
//#endregion
|
|
9256
9312
|
//#region src/mcp/tools/search-catalog.ts
|
|
9257
|
-
var
|
|
9313
|
+
var wm = {
|
|
9258
9314
|
query: j.string().optional().describe("Free text matched against name, display name, and description"),
|
|
9259
9315
|
kind: j.enum([
|
|
9260
9316
|
"pack",
|
|
@@ -9267,31 +9323,31 @@ var bm = {
|
|
|
9267
9323
|
"paid",
|
|
9268
9324
|
"all"
|
|
9269
9325
|
]).default("all").describe("Restrict packs by price tier")
|
|
9270
|
-
},
|
|
9326
|
+
}, Tm = (e, t) => {
|
|
9271
9327
|
let n = t.trim().toLowerCase();
|
|
9272
9328
|
return n === "" ? !0 : e.some((e) => e.toLowerCase().includes(n));
|
|
9273
9329
|
};
|
|
9274
|
-
function
|
|
9330
|
+
function Em(e, t) {
|
|
9275
9331
|
let { query: n = "", category: r, tier: i = "all" } = t;
|
|
9276
|
-
return e.filter((e) => r && e.category !== r || i !== "all" && e.tier !== i ? !1 :
|
|
9332
|
+
return e.filter((e) => r && e.category !== r || i !== "all" && e.tier !== i ? !1 : Tm([
|
|
9277
9333
|
e.name,
|
|
9278
9334
|
e.displayName,
|
|
9279
9335
|
e.description
|
|
9280
9336
|
], n));
|
|
9281
9337
|
}
|
|
9282
|
-
function
|
|
9338
|
+
function Dm(e, t) {
|
|
9283
9339
|
let { query: n = "", category: r } = t;
|
|
9284
|
-
return e.filter((e) => r && e.category !== r ? !1 :
|
|
9340
|
+
return e.filter((e) => r && e.category !== r ? !1 : Tm([
|
|
9285
9341
|
e.id,
|
|
9286
9342
|
e.name,
|
|
9287
9343
|
e.description,
|
|
9288
9344
|
...e.tags
|
|
9289
9345
|
], n));
|
|
9290
9346
|
}
|
|
9291
|
-
async function
|
|
9292
|
-
let t = e.kind ?? "all", [n, r] = await Promise.all([t === "template" ? Promise.resolve([]) : zi(), t === "pack" ? Promise.resolve([]) :
|
|
9347
|
+
async function Om(e) {
|
|
9348
|
+
let t = e.kind ?? "all", [n, r] = await Promise.all([t === "template" ? Promise.resolve([]) : zi(), t === "pack" ? Promise.resolve([]) : Vp()]);
|
|
9293
9349
|
return {
|
|
9294
|
-
packs:
|
|
9350
|
+
packs: Em(n, e).map((e) => ({
|
|
9295
9351
|
name: e.name,
|
|
9296
9352
|
displayName: e.displayName,
|
|
9297
9353
|
description: e.description,
|
|
@@ -9300,7 +9356,7 @@ async function wm(e) {
|
|
|
9300
9356
|
price: e.price,
|
|
9301
9357
|
dependencies: e.dependencies
|
|
9302
9358
|
})),
|
|
9303
|
-
templates:
|
|
9359
|
+
templates: Dm(r, e).map((e) => ({
|
|
9304
9360
|
id: e.id,
|
|
9305
9361
|
name: e.name,
|
|
9306
9362
|
description: e.description,
|
|
@@ -9317,102 +9373,102 @@ async function wm(e) {
|
|
|
9317
9373
|
}
|
|
9318
9374
|
//#endregion
|
|
9319
9375
|
//#region src/mcp/server.ts
|
|
9320
|
-
var
|
|
9321
|
-
function
|
|
9376
|
+
var km = "hype-stack";
|
|
9377
|
+
function Am() {
|
|
9322
9378
|
let e = new se({
|
|
9323
|
-
name:
|
|
9379
|
+
name: km,
|
|
9324
9380
|
version: ue
|
|
9325
9381
|
}, {
|
|
9326
9382
|
capabilities: { tools: {} },
|
|
9327
|
-
instructions:
|
|
9383
|
+
instructions: jm
|
|
9328
9384
|
});
|
|
9329
9385
|
return e.registerTool("search_catalog", {
|
|
9330
9386
|
title: "Search the Hype Stack catalog",
|
|
9331
9387
|
description: "Find feature packs and project templates by keyword, category, or price tier. Read-only. Start here when the user asks what is available.",
|
|
9332
|
-
inputSchema:
|
|
9388
|
+
inputSchema: wm,
|
|
9333
9389
|
annotations: {
|
|
9334
9390
|
readOnlyHint: !0,
|
|
9335
9391
|
openWorldHint: !0
|
|
9336
9392
|
}
|
|
9337
|
-
}, (e) =>
|
|
9393
|
+
}, (e) => Xp(() => Om(e))), e.registerTool("plan_install", {
|
|
9338
9394
|
title: "Plan a pack install",
|
|
9339
9395
|
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.",
|
|
9340
|
-
inputSchema:
|
|
9396
|
+
inputSchema: Sm,
|
|
9341
9397
|
annotations: {
|
|
9342
9398
|
readOnlyHint: !0,
|
|
9343
9399
|
openWorldHint: !0
|
|
9344
9400
|
}
|
|
9345
|
-
}, (e) =>
|
|
9401
|
+
}, (e) => Xp(() => Cm(e))), e.registerTool("create_application", {
|
|
9346
9402
|
title: "Create a Hype Stack application",
|
|
9347
9403
|
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.",
|
|
9348
|
-
inputSchema:
|
|
9404
|
+
inputSchema: lm,
|
|
9349
9405
|
annotations: {
|
|
9350
9406
|
readOnlyHint: !1,
|
|
9351
9407
|
destructiveHint: !1,
|
|
9352
9408
|
openWorldHint: !0
|
|
9353
9409
|
}
|
|
9354
|
-
}, (e) =>
|
|
9410
|
+
}, (e) => Xp(() => um(e))), e.registerTool("add_packs", {
|
|
9355
9411
|
title: "Add feature packs",
|
|
9356
9412
|
description: "Install packs into an existing project. Requires an explicit onConflict policy because there is no prompt to fall back on.",
|
|
9357
|
-
inputSchema:
|
|
9413
|
+
inputSchema: tm,
|
|
9358
9414
|
annotations: {
|
|
9359
9415
|
readOnlyHint: !1,
|
|
9360
9416
|
destructiveHint: !0,
|
|
9361
9417
|
openWorldHint: !0
|
|
9362
9418
|
}
|
|
9363
|
-
}, (e) =>
|
|
9419
|
+
}, (e) => Xp(() => nm(e))), e.registerTool("apply_template", {
|
|
9364
9420
|
title: "Apply a project template",
|
|
9365
9421
|
description: "Install a template: its starter, layout, fixed packs, and frontend overrides. Pass variants to swap a slot away from the template default.",
|
|
9366
|
-
inputSchema:
|
|
9422
|
+
inputSchema: im,
|
|
9367
9423
|
annotations: {
|
|
9368
9424
|
readOnlyHint: !1,
|
|
9369
9425
|
destructiveHint: !0,
|
|
9370
9426
|
openWorldHint: !0
|
|
9371
9427
|
}
|
|
9372
|
-
}, (e) =>
|
|
9428
|
+
}, (e) => Xp(() => am(e))), e.registerTool("inspect_stack", {
|
|
9373
9429
|
title: "Inspect the project stack",
|
|
9374
9430
|
description: "Read stack.json and the detected workspace layout: installed packs, app paths, and whether this is a Hype Stack project at all.",
|
|
9375
|
-
inputSchema:
|
|
9431
|
+
inputSchema: bm,
|
|
9376
9432
|
annotations: {
|
|
9377
9433
|
readOnlyHint: !0,
|
|
9378
9434
|
openWorldHint: !1
|
|
9379
9435
|
}
|
|
9380
|
-
}, (e) =>
|
|
9436
|
+
}, (e) => Xp(() => xm(e))), e.registerTool("env_status", {
|
|
9381
9437
|
title: "Check environment variables",
|
|
9382
9438
|
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`.",
|
|
9383
|
-
inputSchema:
|
|
9439
|
+
inputSchema: vm,
|
|
9384
9440
|
annotations: {
|
|
9385
9441
|
readOnlyHint: !0,
|
|
9386
9442
|
openWorldHint: !1
|
|
9387
9443
|
}
|
|
9388
|
-
}, (e) =>
|
|
9444
|
+
}, (e) => Xp(() => ym(e))), e.registerTool("auth_status", {
|
|
9389
9445
|
title: "Check Hype Stack authentication",
|
|
9390
9446
|
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.",
|
|
9391
|
-
inputSchema:
|
|
9447
|
+
inputSchema: sm,
|
|
9392
9448
|
annotations: {
|
|
9393
9449
|
readOnlyHint: !0,
|
|
9394
9450
|
openWorldHint: !0
|
|
9395
9451
|
}
|
|
9396
|
-
}, () =>
|
|
9452
|
+
}, () => Xp(() => cm())), e;
|
|
9397
9453
|
}
|
|
9398
|
-
var
|
|
9399
|
-
async function
|
|
9454
|
+
var jm = "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\".";
|
|
9455
|
+
async function Mm() {
|
|
9400
9456
|
qe("mcp");
|
|
9401
|
-
let e =
|
|
9402
|
-
await
|
|
9457
|
+
let e = Yp();
|
|
9458
|
+
await Am().connect(new ce(process.stdin, e));
|
|
9403
9459
|
}
|
|
9404
9460
|
//#endregion
|
|
9405
9461
|
//#region src/cli.ts
|
|
9406
|
-
function
|
|
9462
|
+
function Nm(e) {
|
|
9407
9463
|
if (!e) return;
|
|
9408
9464
|
let t = e.split(",").map((e) => e.trim()).filter((e) => e.length > 0);
|
|
9409
9465
|
return t.length > 0 ? t : void 0;
|
|
9410
9466
|
}
|
|
9411
|
-
function
|
|
9467
|
+
function Pm(e, t) {
|
|
9412
9468
|
let n = e.split(",").map((e) => e.trim()).filter((e) => e.length > 0);
|
|
9413
9469
|
return [...t ?? [], ...n];
|
|
9414
9470
|
}
|
|
9415
|
-
function
|
|
9471
|
+
function Fm(e) {
|
|
9416
9472
|
if (!e) return;
|
|
9417
9473
|
let t = {};
|
|
9418
9474
|
for (let n of e.split(",")) {
|
|
@@ -9421,12 +9477,12 @@ function jm(e) {
|
|
|
9421
9477
|
}
|
|
9422
9478
|
return Object.keys(t).length > 0 ? t : void 0;
|
|
9423
9479
|
}
|
|
9424
|
-
function
|
|
9480
|
+
function Im(e) {
|
|
9425
9481
|
if (!e) return;
|
|
9426
9482
|
let t = e.split(",").map((e) => e.trim()).filter((e) => e.length > 0);
|
|
9427
9483
|
return t.length > 0 ? t : void 0;
|
|
9428
9484
|
}
|
|
9429
|
-
function
|
|
9485
|
+
function Lm(e) {
|
|
9430
9486
|
let t = {};
|
|
9431
9487
|
for (let n of [...Lu, ...Ru]) {
|
|
9432
9488
|
let r = e[n];
|
|
@@ -9434,9 +9490,9 @@ function Nm(e) {
|
|
|
9434
9490
|
}
|
|
9435
9491
|
return t;
|
|
9436
9492
|
}
|
|
9437
|
-
function
|
|
9493
|
+
function Rm() {
|
|
9438
9494
|
let e = new o();
|
|
9439
|
-
e.name("hype-stack").description("Build with Hype Stack -- templates, components, modules, and more").version(ue, "-v, --version"), 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 (${ye.join(", ")})`,
|
|
9495
|
+
e.name("hype-stack").description("Build with Hype Stack -- templates, components, modules, and more").version(ue, "-v, --version"), 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 (${ye.join(", ")})`, Pm).option("-t, --theme <theme>", "Frontend color theme (default, slate, rose, emerald, violet, amber, ocean, zinc-mono, crimson, midnight, black)").option("--admin-theme <theme>", "Admin app color theme (defaults to --theme when omitted)").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) => {
|
|
9440
9496
|
await Kl({
|
|
9441
9497
|
name: e.name,
|
|
9442
9498
|
directory: e.directory,
|
|
@@ -9456,26 +9512,26 @@ function Pm() {
|
|
|
9456
9512
|
});
|
|
9457
9513
|
}), 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) => {
|
|
9458
9514
|
await lu({
|
|
9459
|
-
packs:
|
|
9515
|
+
packs: Nm(e.packs),
|
|
9460
9516
|
force: e.force,
|
|
9461
9517
|
yes: e.yes,
|
|
9462
9518
|
cwd: e.cwd
|
|
9463
9519
|
});
|
|
9464
9520
|
}), 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) => {
|
|
9465
|
-
await
|
|
9521
|
+
await Wp({
|
|
9466
9522
|
templateId: e,
|
|
9467
|
-
variants:
|
|
9468
|
-
packs:
|
|
9523
|
+
variants: Fm(t.variants),
|
|
9524
|
+
packs: Nm(t.packs),
|
|
9469
9525
|
force: t.force,
|
|
9470
9526
|
yes: t.yes,
|
|
9471
9527
|
cwd: t.cwd
|
|
9472
9528
|
});
|
|
9473
|
-
}), 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 (${zu.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 (${Lu.join(", ")})`).option("-e, --environment <name>", "Deployment environment name (default: production)").option("--fly-org <org>", "Fly organization slug,
|
|
9474
|
-
await
|
|
9529
|
+
}), 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 (${zu.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 (${Lu.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) => {
|
|
9530
|
+
await Cp({
|
|
9475
9531
|
cwd: e.cwd,
|
|
9476
9532
|
provider: e.provider,
|
|
9477
|
-
assign:
|
|
9478
|
-
only:
|
|
9533
|
+
assign: Lm(e),
|
|
9534
|
+
only: Im(e.only),
|
|
9479
9535
|
environment: e.environment,
|
|
9480
9536
|
flyOrg: e.flyOrg,
|
|
9481
9537
|
railwayWorkspace: e.railwayWorkspace,
|
|
@@ -9487,9 +9543,9 @@ function Pm() {
|
|
|
9487
9543
|
});
|
|
9488
9544
|
let t = e.command("mcp").description("Run the Model Context Protocol server for AI editors");
|
|
9489
9545
|
return t.action(async () => {
|
|
9490
|
-
await
|
|
9546
|
+
await Mm();
|
|
9491
9547
|
}), t.command("install").description("Register the MCP server in your editor's config").option("-e, --editor <editor>", `Editor (${Gc.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) => {
|
|
9492
|
-
await
|
|
9548
|
+
await Ip({
|
|
9493
9549
|
editor: e.editor,
|
|
9494
9550
|
scope: e.scope,
|
|
9495
9551
|
cwd: e.cwd,
|
|
@@ -9497,12 +9553,12 @@ function Pm() {
|
|
|
9497
9553
|
print: e.print
|
|
9498
9554
|
});
|
|
9499
9555
|
}), e.command("login").description("Log in via your browser to install packs your organization owns").action(async () => {
|
|
9500
|
-
await
|
|
9556
|
+
await Pp();
|
|
9501
9557
|
}), e.command("logout").description("Log out and remove the saved CLI token").action(async () => {
|
|
9502
|
-
await
|
|
9558
|
+
await Fp();
|
|
9503
9559
|
}), e.command("auth").description("Alias for `login`").action(async () => {
|
|
9504
|
-
await
|
|
9560
|
+
await Pp();
|
|
9505
9561
|
}), e;
|
|
9506
9562
|
}
|
|
9507
9563
|
//#endregion
|
|
9508
|
-
export {
|
|
9564
|
+
export { Cp as a, ql as c, ue as d, Pp as i, Kl as l, Yp as n, lu as o, Fp as r, Jl as s, Rm as t, qe as u };
|