@geekmidas/cli 10.0.0-alpha.63 → 10.0.0-alpha.64
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/{HostingerProvider-mJ7YruxH.cjs → HostingerProvider-Bx2lHHvu.cjs} +3 -3
- package/dist/{HostingerProvider-mJ7YruxH.cjs.map → HostingerProvider-Bx2lHHvu.cjs.map} +1 -1
- package/dist/{HostingerProvider-DBBwpDjn.mjs → HostingerProvider-Cd4aS5Kj.mjs} +2 -2
- package/dist/{HostingerProvider-DBBwpDjn.mjs.map → HostingerProvider-Cd4aS5Kj.mjs.map} +1 -1
- package/dist/{LegacyStateStore-CP7SZwTP.cjs → LegacyStateStore-C2abV49N.cjs} +2 -2
- package/dist/{LegacyStateStore-CP7SZwTP.cjs.map → LegacyStateStore-C2abV49N.cjs.map} +1 -1
- package/dist/{LegacyStateStore-Q3GmKOdw.mjs → LegacyStateStore-DIgkGaUP.mjs} +2 -2
- package/dist/{LegacyStateStore-Q3GmKOdw.mjs.map → LegacyStateStore-DIgkGaUP.mjs.map} +1 -1
- package/dist/{LocalStateStore-BGIXcrvX.mjs → LocalStateStore-Cy1ZBW7U.mjs} +2 -2
- package/dist/{LocalStateStore-BGIXcrvX.mjs.map → LocalStateStore-Cy1ZBW7U.mjs.map} +1 -1
- package/dist/{LocalStateStore-sS8mvLeq.cjs → LocalStateStore-DiJqKyPy.cjs} +2 -2
- package/dist/{LocalStateStore-sS8mvLeq.cjs.map → LocalStateStore-DiJqKyPy.cjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-CjHWFRDd.cjs → OpenApiTsGenerator-BWuDRHe9.cjs} +2 -2
- package/dist/{OpenApiTsGenerator-CjHWFRDd.cjs.map → OpenApiTsGenerator-BWuDRHe9.cjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-CnAwhGxi.mjs → OpenApiTsGenerator-C6v-IeHt.mjs} +2 -2
- package/dist/{OpenApiTsGenerator-CnAwhGxi.mjs.map → OpenApiTsGenerator-C6v-IeHt.mjs.map} +1 -1
- package/dist/{S3StateStore-D7l_lWJ3.mjs → S3StateStore-D3x6ivBL.mjs} +2 -2
- package/dist/{S3StateStore-D7l_lWJ3.mjs.map → S3StateStore-D3x6ivBL.mjs.map} +1 -1
- package/dist/{S3StateStore-6jqITH2F.cjs → S3StateStore-Ds0V1Lgm.cjs} +2 -2
- package/dist/{S3StateStore-6jqITH2F.cjs.map → S3StateStore-Ds0V1Lgm.cjs.map} +1 -1
- package/dist/{SSMStateStore-B__F7IJa.cjs → SSMStateStore-CLipvx47.cjs} +2 -2
- package/dist/{SSMStateStore-B__F7IJa.cjs.map → SSMStateStore-CLipvx47.cjs.map} +1 -1
- package/dist/{SSMStateStore-CAQDVpoc.mjs → SSMStateStore-DfF174xQ.mjs} +2 -2
- package/dist/{SSMStateStore-CAQDVpoc.mjs.map → SSMStateStore-DfF174xQ.mjs.map} +1 -1
- package/dist/{bundler-DLfOn0ls.cjs → bundler-C8uJf324.cjs} +3 -3
- package/dist/{bundler-DLfOn0ls.cjs.map → bundler-C8uJf324.cjs.map} +1 -1
- package/dist/{bundler-DyWI41Iy.mjs → bundler-DYgm9xsd.mjs} +3 -3
- package/dist/{bundler-DyWI41Iy.mjs.map → bundler-DYgm9xsd.mjs.map} +1 -1
- package/dist/{cli-PkVF28LM.mjs → cli-Bogz-zEj.mjs} +5 -4
- package/dist/{cli-PkVF28LM.mjs.map → cli-Bogz-zEj.mjs.map} +1 -1
- package/dist/{cli-D-ZM-X2s.cjs → cli-D3jofJ6j.cjs} +7 -6
- package/dist/{cli-D-ZM-X2s.cjs.map → cli-D3jofJ6j.cjs.map} +1 -1
- package/dist/{config-CemHVcIr.d.cts → config-Be-4_I6H.d.cts} +3 -3
- package/dist/{config-C2BUosLm.d.mts.map → config-Be-4_I6H.d.cts.map} +1 -1
- package/dist/{config-C2BUosLm.d.mts → config-DqNRiQOp.d.mts} +3 -3
- package/dist/{config-CemHVcIr.d.cts.map → config-DqNRiQOp.d.mts.map} +1 -1
- package/dist/config.cjs +416 -17
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +3 -3
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +401 -2
- package/dist/config.mjs.map +1 -0
- package/dist/credentials-B70vmLcm.cjs +125 -0
- package/dist/credentials-B70vmLcm.cjs.map +1 -0
- package/dist/credentials-s0wMeZBU.mjs +108 -0
- package/dist/credentials-s0wMeZBU.mjs.map +1 -0
- package/dist/{define-CHBIEc5j.mjs → define-CYs0PEfZ.mjs} +2 -3
- package/dist/define-CYs0PEfZ.mjs.map +1 -0
- package/dist/{define-Cv_QvDrg.cjs → define-zUsP72ym.cjs} +2 -3
- package/dist/define-zUsP72ym.cjs.map +1 -0
- package/dist/deploy/public.cjs +32 -26
- package/dist/deploy/public.cjs.map +1 -1
- package/dist/deploy/public.d.cts +40 -4
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts +40 -4
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +15 -12
- package/dist/deploy/public.mjs.map +1 -1
- package/dist/{deploy-ABBI0lf1.cjs → deploy-55rJkdKz.cjs} +17 -14
- package/dist/{deploy-ABBI0lf1.cjs.map → deploy-55rJkdKz.cjs.map} +1 -1
- package/dist/{deploy-CGW-QY9D.mjs → deploy-Dc2LBJaK.mjs} +8 -7
- package/dist/{deploy-CGW-QY9D.mjs.map → deploy-Dc2LBJaK.mjs.map} +1 -1
- package/dist/{deploy-CG8bfFij.mjs → deploy-ZRXIPp1c.mjs} +11 -8
- package/dist/{deploy-CG8bfFij.mjs.map → deploy-ZRXIPp1c.mjs.map} +1 -1
- package/dist/{deploy-BiMrP9i7.cjs → deploy-yUcR2OlW.cjs} +12 -11
- package/dist/{deploy-BiMrP9i7.cjs.map → deploy-yUcR2OlW.cjs.map} +1 -1
- package/dist/derive-B4vDpzgP.mjs +150 -0
- package/dist/derive-B4vDpzgP.mjs.map +1 -0
- package/dist/derive-DAbo49sm.cjs +161 -0
- package/dist/derive-DAbo49sm.cjs.map +1 -0
- package/dist/{discover-C_6COHEv.cjs → discover-DHdECueV.cjs} +6 -157
- package/dist/discover-DHdECueV.cjs.map +1 -0
- package/dist/{discover-BaT6bpnA.mjs → discover-LMrqsWSU.mjs} +8 -117
- package/dist/discover-LMrqsWSU.mjs.map +1 -0
- package/dist/{dokploy-CwdmlyQL.mjs → dokploy-CepdXuMl.mjs} +3 -3
- package/dist/{dokploy-CwdmlyQL.mjs.map → dokploy-CepdXuMl.mjs.map} +1 -1
- package/dist/{dokploy-QJxMhxdf.cjs → dokploy-D1d37rvM.cjs} +3 -3
- package/dist/{dokploy-QJxMhxdf.cjs.map → dokploy-D1d37rvM.cjs.map} +1 -1
- package/dist/{encryption-DXw3jj0c.cjs → encryption-C9X98u2F.cjs} +5 -5
- package/dist/{encryption-DXw3jj0c.cjs.map → encryption-C9X98u2F.cjs.map} +1 -1
- package/dist/{encryption-CbQG_ayW.mjs → encryption-CKHjMpCr.mjs} +5 -5
- package/dist/{encryption-CbQG_ayW.mjs.map → encryption-CKHjMpCr.mjs.map} +1 -1
- package/dist/{github-ciwbIwVa.mjs → github-D-byNI7T.mjs} +4 -4
- package/dist/{github-ciwbIwVa.mjs.map → github-D-byNI7T.mjs.map} +1 -1
- package/dist/{github-BH_mETav.cjs → github-Dd3tMa1u.cjs} +4 -4
- package/dist/{github-BH_mETav.cjs.map → github-Dd3tMa1u.cjs.map} +1 -1
- package/dist/{index-DrKzpHl-.d.mts → index-CJ2qsSpp.d.mts} +2 -2
- package/dist/{index-BtXDZQuF.d.cts.map → index-CJ2qsSpp.d.mts.map} +1 -1
- package/dist/{index-BtXDZQuF.d.cts → index-CfE9Y885.d.cts} +2 -2
- package/dist/{index-DrKzpHl-.d.mts.map → index-CfE9Y885.d.cts.map} +1 -1
- package/dist/index.cjs +100 -235
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +71 -206
- package/dist/index.mjs.map +1 -1
- package/dist/local-C7wnrcYK.cjs +586 -0
- package/dist/local-C7wnrcYK.cjs.map +1 -0
- package/dist/local-Cd8ZYQG3.mjs +473 -0
- package/dist/local-Cd8ZYQG3.mjs.map +1 -0
- package/dist/{migrate-ImBKTBcW.mjs → migrate-B4gngTLe.mjs} +6 -6
- package/dist/{migrate-ImBKTBcW.mjs.map → migrate-B4gngTLe.mjs.map} +1 -1
- package/dist/{migrate-6oa9y_f2.cjs → migrate-tx9-P9uz.cjs} +6 -6
- package/dist/{migrate-6oa9y_f2.cjs.map → migrate-tx9-P9uz.cjs.map} +1 -1
- package/dist/openapi.cjs +2 -2
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/openapi.mjs +2 -2
- package/dist/{ready-Bpdnn2ON.mjs → ready-bQfu9GES.mjs} +3 -3
- package/dist/{ready-Bpdnn2ON.mjs.map → ready-bQfu9GES.mjs.map} +1 -1
- package/dist/{ready-BiG0rt4h.cjs → ready-brEhh68f.cjs} +3 -3
- package/dist/{ready-BiG0rt4h.cjs.map → ready-brEhh68f.cjs.map} +1 -1
- package/dist/reconcile/public.cjs +1 -1
- package/dist/reconcile/public.d.cts +1 -1
- package/dist/reconcile/public.d.mts +1 -1
- package/dist/reconcile/public.mjs +1 -1
- package/dist/{resolve-xytBTtG4.cjs → resolve-BXsNQjMR.cjs} +9 -6
- package/dist/resolve-BXsNQjMR.cjs.map +1 -0
- package/dist/{resolve-B1T0hUaR.mjs → resolve-DZ2IJ0qY.mjs} +9 -6
- package/dist/resolve-DZ2IJ0qY.mjs.map +1 -0
- package/dist/{runtime-CMwtq0AL.cjs → runtime-BGNDrHzh.cjs} +2 -2
- package/dist/{runtime-CMwtq0AL.cjs.map → runtime-BGNDrHzh.cjs.map} +1 -1
- package/dist/{runtime-Dn_n-29S.d.cts → runtime-CJEYK4Gz.d.mts} +2 -2
- package/dist/{runtime-CXPlkZzs.d.mts.map → runtime-CJEYK4Gz.d.mts.map} +1 -1
- package/dist/{runtime-CXPlkZzs.d.mts → runtime-Cjq1jlVX.d.cts} +2 -2
- package/dist/{runtime-Dn_n-29S.d.cts.map → runtime-Cjq1jlVX.d.cts.map} +1 -1
- package/dist/{runtime-DbakJS8u.mjs → runtime-Cmn-FeYO.mjs} +2 -2
- package/dist/{runtime-DbakJS8u.mjs.map → runtime-Cmn-FeYO.mjs.map} +1 -1
- package/dist/sandbox/discover-worker.cjs +1 -1
- package/dist/sandbox/discover-worker.mjs +1 -1
- package/dist/sandbox-CL--ZDui.cjs +164 -0
- package/dist/sandbox-CL--ZDui.cjs.map +1 -0
- package/dist/sandbox-Dm247NGx.mjs +117 -0
- package/dist/sandbox-Dm247NGx.mjs.map +1 -0
- package/dist/{sniffer-aO_-s5vq.mjs → sniffer-49KPbDgq.mjs} +25 -470
- package/dist/sniffer-49KPbDgq.mjs.map +1 -0
- package/dist/{sniffer-D_SYc_pO.cjs → sniffer-ByhbEW5A.cjs} +38 -567
- package/dist/sniffer-ByhbEW5A.cjs.map +1 -0
- package/dist/sst-BdALKEas.cjs +453 -0
- package/dist/sst-BdALKEas.cjs.map +1 -0
- package/dist/sst-Cper040I.mjs +430 -0
- package/dist/sst-Cper040I.mjs.map +1 -0
- package/dist/{store-BS8A7NcA.mjs → store-BaaonhkJ.mjs} +2 -2
- package/dist/{store-BS8A7NcA.mjs.map → store-BaaonhkJ.mjs.map} +1 -1
- package/dist/{store-KvNQwYaB.cjs → store-D_2ByRtW.cjs} +4 -4
- package/dist/{store-KvNQwYaB.cjs.map → store-D_2ByRtW.cjs.map} +1 -1
- package/dist/target/public.cjs +3 -3
- package/dist/target/public.d.cts +3 -3
- package/dist/target/public.d.mts +3 -3
- package/dist/target/public.mjs +3 -3
- package/dist/{terminal-D0f1u0LG.cjs → terminal-Bdv--jhY.cjs} +16 -111
- package/dist/terminal-Bdv--jhY.cjs.map +1 -0
- package/dist/{terminal-gMxAo9Dj.mjs → terminal-D7Ntz6WE.mjs} +13 -90
- package/dist/terminal-D7Ntz6WE.mjs.map +1 -0
- package/dist/{types-DIA7Li-J.d.cts → types-B_bEQvb9.d.mts} +42 -7
- package/dist/types-B_bEQvb9.d.mts.map +1 -0
- package/dist/{types-CfLKGfC_.d.mts → types-DkrDOMxw.d.cts} +43 -6
- package/dist/types-DkrDOMxw.d.cts.map +1 -0
- package/dist/utils-D2Nk1Nv2.cjs +205 -0
- package/dist/utils-D2Nk1Nv2.cjs.map +1 -0
- package/dist/utils-D_fxUqvU.mjs +156 -0
- package/dist/utils-D_fxUqvU.mjs.map +1 -0
- package/dist/vitest.cjs +1 -1
- package/dist/vitest.mjs +1 -1
- package/dist/workspace/index.cjs +1 -1
- package/dist/workspace/index.d.cts +2 -2
- package/dist/workspace/index.d.mts +2 -2
- package/dist/workspace/index.mjs +1 -1
- package/dist/{workspace-Kl4NG9IH.cjs → workspace-BwgWJK7h.cjs} +5 -5
- package/dist/workspace-BwgWJK7h.cjs.map +1 -0
- package/dist/{workspace-Dh7rr7l4.mjs → workspace-Bwit4q9O.mjs} +5 -5
- package/dist/workspace-Bwit4q9O.mjs.map +1 -0
- package/package.json +13 -13
- package/dist/config-BEJYKd4s.cjs +0 -648
- package/dist/config-BEJYKd4s.cjs.map +0 -1
- package/dist/config-LKKCVCnC.mjs +0 -547
- package/dist/config-LKKCVCnC.mjs.map +0 -1
- package/dist/define-CHBIEc5j.mjs.map +0 -1
- package/dist/define-Cv_QvDrg.cjs.map +0 -1
- package/dist/discover-BaT6bpnA.mjs.map +0 -1
- package/dist/discover-C_6COHEv.cjs.map +0 -1
- package/dist/home-DOzBaWaL.cjs +0 -33
- package/dist/home-DOzBaWaL.cjs.map +0 -1
- package/dist/home-GI7pJl1M.mjs +0 -22
- package/dist/home-GI7pJl1M.mjs.map +0 -1
- package/dist/resolve-B1T0hUaR.mjs.map +0 -1
- package/dist/resolve-xytBTtG4.cjs.map +0 -1
- package/dist/sniffer-D_SYc_pO.cjs.map +0 -1
- package/dist/sniffer-aO_-s5vq.mjs.map +0 -1
- package/dist/terminal-D0f1u0LG.cjs.map +0 -1
- package/dist/terminal-gMxAo9Dj.mjs.map +0 -1
- package/dist/types-CfLKGfC_.d.mts.map +0 -1
- package/dist/types-DIA7Li-J.d.cts.map +0 -1
- package/dist/workspace-Dh7rr7l4.mjs.map +0 -1
- package/dist/workspace-Kl4NG9IH.cjs.map +0 -1
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
|
|
2
|
-
const
|
|
3
|
-
const require_discover = require("./discover-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
2
|
+
const require_local = require("./local-C7wnrcYK.cjs");
|
|
3
|
+
const require_discover = require("./discover-DHdECueV.cjs");
|
|
4
|
+
const require_sandbox = require("./sandbox-CL--ZDui.cjs");
|
|
5
|
+
const require_derive = require("./derive-DAbo49sm.cjs");
|
|
6
|
+
const require_workspace = require("./workspace-BwgWJK7h.cjs");
|
|
7
|
+
const require_config = require("./config.cjs");
|
|
6
8
|
const require_storage = require("./storage-CSGoC3bK.cjs");
|
|
7
|
-
const require_store = require("./store-
|
|
8
|
-
const require_runtime = require("./runtime-
|
|
9
|
+
const require_store = require("./store-D_2ByRtW.cjs");
|
|
10
|
+
const require_runtime = require("./runtime-BGNDrHzh.cjs");
|
|
9
11
|
const require_fakes = require("./fakes-zW-jNAbQ.cjs");
|
|
10
12
|
let node_path = require("node:path");
|
|
11
13
|
let node_process = require("node:process");
|
|
@@ -108,128 +110,6 @@ async function prompt(message, options) {
|
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
112
|
//#endregion
|
|
111
|
-
//#region src/auth/credentials.ts
|
|
112
|
-
/**
|
|
113
|
-
* Get the path to the credentials directory
|
|
114
|
-
*/
|
|
115
|
-
function getCredentialsDir(options) {
|
|
116
|
-
if (options?.home) return options.home;
|
|
117
|
-
return options?.root ? (0, node_path.join)(options.root, ".gkm") : require_home.gkmHome();
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Get the path to the credentials file
|
|
121
|
-
*/
|
|
122
|
-
function getCredentialsPath(options) {
|
|
123
|
-
return (0, node_path.join)(getCredentialsDir(options), "credentials.json");
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Ensure the credentials directory exists
|
|
127
|
-
*/
|
|
128
|
-
function ensureCredentialsDir(options) {
|
|
129
|
-
const dir = getCredentialsDir(options);
|
|
130
|
-
if (!(0, node_fs.existsSync)(dir)) (0, node_fs.mkdirSync)(dir, {
|
|
131
|
-
recursive: true,
|
|
132
|
-
mode: 448
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Read stored credentials from disk
|
|
137
|
-
*/
|
|
138
|
-
async function readCredentials(options) {
|
|
139
|
-
const path = getCredentialsPath(options);
|
|
140
|
-
if (!(0, node_fs.existsSync)(path)) return {};
|
|
141
|
-
try {
|
|
142
|
-
const content = await (0, node_fs_promises.readFile)(path, "utf-8");
|
|
143
|
-
return JSON.parse(content);
|
|
144
|
-
} catch {
|
|
145
|
-
return {};
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Write credentials to disk
|
|
150
|
-
*/
|
|
151
|
-
async function writeCredentials(credentials, options) {
|
|
152
|
-
ensureCredentialsDir(options);
|
|
153
|
-
const path = getCredentialsPath(options);
|
|
154
|
-
await (0, node_fs_promises.writeFile)(path, JSON.stringify(credentials, null, 2), { mode: 384 });
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Store Dokploy credentials
|
|
158
|
-
*/
|
|
159
|
-
async function storeDokployCredentials(token, endpoint, options) {
|
|
160
|
-
const credentials = await readCredentials(options);
|
|
161
|
-
credentials.dokploy = {
|
|
162
|
-
token,
|
|
163
|
-
endpoint,
|
|
164
|
-
storedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
165
|
-
};
|
|
166
|
-
await writeCredentials(credentials, options);
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Get stored Dokploy credentials
|
|
170
|
-
*/
|
|
171
|
-
async function getDokployCredentials(options) {
|
|
172
|
-
const credentials = await readCredentials(options);
|
|
173
|
-
const token = process.env.DOKPLOY_API_TOKEN ?? credentials.dokploy?.token;
|
|
174
|
-
const endpoint = process.env.DOKPLOY_ENDPOINT ?? credentials.dokploy?.endpoint;
|
|
175
|
-
if (!token || !endpoint) return null;
|
|
176
|
-
return {
|
|
177
|
-
token,
|
|
178
|
-
endpoint: endpoint.replace(/\/$/, ""),
|
|
179
|
-
...credentials.dokploy?.registryId ? { registryId: credentials.dokploy.registryId } : {}
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Remove Dokploy credentials
|
|
184
|
-
*/
|
|
185
|
-
async function removeDokployCredentials(options) {
|
|
186
|
-
const credentials = await readCredentials(options);
|
|
187
|
-
if (!credentials.dokploy) return false;
|
|
188
|
-
delete credentials.dokploy;
|
|
189
|
-
await writeCredentials(credentials, options);
|
|
190
|
-
return true;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Get Dokploy API token, checking stored credentials first, then environment
|
|
194
|
-
*/
|
|
195
|
-
async function getDokployToken(options) {
|
|
196
|
-
const envToken = process.env.DOKPLOY_API_TOKEN;
|
|
197
|
-
if (envToken) return envToken;
|
|
198
|
-
const stored = await getDokployCredentials(options);
|
|
199
|
-
if (stored) return stored.token;
|
|
200
|
-
return null;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Get Dokploy registry ID from stored credentials
|
|
204
|
-
*/
|
|
205
|
-
async function getDokployRegistryId(options) {
|
|
206
|
-
return (await getDokployCredentials(options))?.registryId ?? void 0;
|
|
207
|
-
}
|
|
208
|
-
/**
|
|
209
|
-
* Store Hostinger API token
|
|
210
|
-
*
|
|
211
|
-
* @param token - API token from hpanel.hostinger.com/profile/api
|
|
212
|
-
*/
|
|
213
|
-
async function storeHostingerToken(token, options) {
|
|
214
|
-
const credentials = await readCredentials(options);
|
|
215
|
-
credentials.hostinger = {
|
|
216
|
-
token,
|
|
217
|
-
storedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
218
|
-
};
|
|
219
|
-
await writeCredentials(credentials, options);
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Get stored Hostinger API token
|
|
223
|
-
*
|
|
224
|
-
* Checks environment variable first (HOSTINGER_API_TOKEN),
|
|
225
|
-
* then falls back to stored credentials.
|
|
226
|
-
*/
|
|
227
|
-
async function getHostingerToken(options) {
|
|
228
|
-
const envToken = process.env.HOSTINGER_API_TOKEN;
|
|
229
|
-
if (envToken) return envToken;
|
|
230
|
-
return (await readCredentials(options)).hostinger?.token ?? null;
|
|
231
|
-
}
|
|
232
|
-
//#endregion
|
|
233
113
|
//#region src/auth/index.ts
|
|
234
114
|
const logger$2 = console;
|
|
235
115
|
/**
|
|
@@ -277,10 +157,10 @@ async function loginCommand(options) {
|
|
|
277
157
|
logger$2.error("\n✗ Invalid credentials. Please check your token and try again.");
|
|
278
158
|
process.exit(1);
|
|
279
159
|
}
|
|
280
|
-
await storeDokployCredentials(token, endpoint);
|
|
160
|
+
await require_local.storeDokployCredentials(token, endpoint);
|
|
281
161
|
logger$2.log("\n✓ Successfully logged in to Dokploy!");
|
|
282
162
|
logger$2.log(` Endpoint: ${endpoint}`);
|
|
283
|
-
logger$2.log(` Credentials stored in: ${getCredentialsPath()}`);
|
|
163
|
+
logger$2.log(` Credentials stored in: ${require_local.getCredentialsPath()}`);
|
|
284
164
|
logger$2.log("\nYou can now use deploy commands without setting DOKPLOY_API_TOKEN.");
|
|
285
165
|
}
|
|
286
166
|
if (provider === "hostinger") {
|
|
@@ -297,9 +177,9 @@ async function loginCommand(options) {
|
|
|
297
177
|
logger$2.error("Token is required");
|
|
298
178
|
process.exit(1);
|
|
299
179
|
}
|
|
300
|
-
await storeHostingerToken(token);
|
|
180
|
+
await require_local.storeHostingerToken(token);
|
|
301
181
|
logger$2.log("\n✓ Hostinger token stored.");
|
|
302
|
-
logger$2.log(` Credentials stored in: ${getCredentialsPath()}`);
|
|
182
|
+
logger$2.log(` Credentials stored in: ${require_local.getCredentialsPath()}`);
|
|
303
183
|
logger$2.log(" Not validated here: every DNS endpoint is scoped to a domain, so the\n first deploy that touches DNS is where a bad token reports itself.");
|
|
304
184
|
logger$2.log("\nYou can now use it as a DNS provider without setting HOSTINGER_API_TOKEN.");
|
|
305
185
|
}
|
|
@@ -310,12 +190,12 @@ async function loginCommand(options) {
|
|
|
310
190
|
async function logoutCommand(options) {
|
|
311
191
|
const { provider = "dokploy" } = options;
|
|
312
192
|
if (provider === "all") {
|
|
313
|
-
if (await removeDokployCredentials()) logger$2.log("\n✓ Logged out from all services");
|
|
193
|
+
if (await require_local.removeDokployCredentials()) logger$2.log("\n✓ Logged out from all services");
|
|
314
194
|
else logger$2.log("\nNo stored credentials found");
|
|
315
195
|
return;
|
|
316
196
|
}
|
|
317
197
|
if (provider === "dokploy") {
|
|
318
|
-
if (await removeDokployCredentials()) logger$2.log("\n✓ Logged out from Dokploy");
|
|
198
|
+
if (await require_local.removeDokployCredentials()) logger$2.log("\n✓ Logged out from Dokploy");
|
|
319
199
|
else logger$2.log("\nNo Dokploy credentials found");
|
|
320
200
|
}
|
|
321
201
|
}
|
|
@@ -324,13 +204,13 @@ async function logoutCommand(options) {
|
|
|
324
204
|
*/
|
|
325
205
|
async function whoamiCommand() {
|
|
326
206
|
logger$2.log("\n📋 Current credentials:\n");
|
|
327
|
-
const dokploy = await getDokployCredentials();
|
|
207
|
+
const dokploy = await require_local.getDokployCredentials();
|
|
328
208
|
if (dokploy) {
|
|
329
209
|
logger$2.log(" Dokploy:");
|
|
330
210
|
logger$2.log(` Endpoint: ${dokploy.endpoint}`);
|
|
331
211
|
logger$2.log(` Token: ${maskToken(dokploy.token)}`);
|
|
332
212
|
} else logger$2.log(" Dokploy: Not logged in");
|
|
333
|
-
logger$2.log(`\n Credentials file: ${getCredentialsPath()}`);
|
|
213
|
+
logger$2.log(`\n Credentials file: ${require_local.getCredentialsPath()}`);
|
|
334
214
|
}
|
|
335
215
|
/**
|
|
336
216
|
* Mask a token for display
|
|
@@ -1308,11 +1188,11 @@ function planFor(manifest, stage, order, options = {}) {
|
|
|
1308
1188
|
const root = rootSite(sites.map((r) => {
|
|
1309
1189
|
const declared = manifest[r.id];
|
|
1310
1190
|
return {
|
|
1311
|
-
name:
|
|
1191
|
+
name: require_derive.appKey(r.id),
|
|
1312
1192
|
...declared?.kind === "site" && declared.root ? { root: true } : {}
|
|
1313
1193
|
};
|
|
1314
1194
|
}));
|
|
1315
|
-
for (const site of sites) if (
|
|
1195
|
+
for (const site of sites) if (require_derive.appKey(site.id) === root) site.root = true;
|
|
1316
1196
|
const workerBroker = events === "pgboss" && Object.values(manifest).some((d) => d?.kind === "worker") && resources.some((r) => r.kind === "database");
|
|
1317
1197
|
return {
|
|
1318
1198
|
stage,
|
|
@@ -1866,7 +1746,7 @@ function localPlan(workspace, manifest, fakes = {}) {
|
|
|
1866
1746
|
* host's port for each app, never a name on the compose network.
|
|
1867
1747
|
*/
|
|
1868
1748
|
function sitePublicArgs(manifest, appName, env) {
|
|
1869
|
-
const declaration = Object.entries(manifest).find(([id, d]) => d.kind === "site" &&
|
|
1749
|
+
const declaration = Object.entries(manifest).find(([id, d]) => d.kind === "site" && require_derive.appKey(id) === appName)?.[1];
|
|
1870
1750
|
if (declaration?.kind !== "site") return {};
|
|
1871
1751
|
const args = {};
|
|
1872
1752
|
for (const key of Object.keys((0, _geekmidas_manifest.publicEnvFor)(declaration, manifest))) {
|
|
@@ -1922,7 +1802,7 @@ function networkEnv(plan, options) {
|
|
|
1922
1802
|
* port.
|
|
1923
1803
|
*/
|
|
1924
1804
|
function appEnvKeys(manifest, appName, runnables = {}) {
|
|
1925
|
-
const entry = Object.entries(manifest).find(([id, d]) => (d.kind === "rest-api" || d.kind === "site" || d.kind === "mobile-app") &&
|
|
1805
|
+
const entry = Object.entries(manifest).find(([id, d]) => (d.kind === "rest-api" || d.kind === "site" || d.kind === "mobile-app") && require_derive.appKey(id) === appName);
|
|
1926
1806
|
if (!entry) return void 0;
|
|
1927
1807
|
const [id, declaration] = entry;
|
|
1928
1808
|
const keys = /* @__PURE__ */ new Set([
|
|
@@ -1971,7 +1851,7 @@ function appServices(workspace, manifest, containers, runnables = {}, fakes = {}
|
|
|
1971
1851
|
const services = {};
|
|
1972
1852
|
for (const [name, app] of Object.entries(workspace.apps)) {
|
|
1973
1853
|
if (app.type === "mobile" || !app.port) continue;
|
|
1974
|
-
const key =
|
|
1854
|
+
const key = require_derive.appKey(name);
|
|
1975
1855
|
const health = app.type === "web" ? "/" : "/health";
|
|
1976
1856
|
const dockerfile = dockerfileOf(name, app.path);
|
|
1977
1857
|
const ports = [`${app.port}:${app.port}`];
|
|
@@ -2433,7 +2313,7 @@ var UnassignedPort = class extends Error {
|
|
|
2433
2313
|
* Every call is scoped to the generated compose file. Nothing here can touch a
|
|
2434
2314
|
* container this project did not generate.
|
|
2435
2315
|
*/
|
|
2436
|
-
const run
|
|
2316
|
+
const run = (0, node_util.promisify)(node_child_process.execFile);
|
|
2437
2317
|
/**
|
|
2438
2318
|
* The generated file, then the project's own if it has one.
|
|
2439
2319
|
*
|
|
@@ -2476,7 +2356,7 @@ function shown(args, services) {
|
|
|
2476
2356
|
const dockerCli = {
|
|
2477
2357
|
async publishedPort(composePath, service, inside) {
|
|
2478
2358
|
try {
|
|
2479
|
-
const { stdout } = await run
|
|
2359
|
+
const { stdout } = await run("docker", [
|
|
2480
2360
|
"compose",
|
|
2481
2361
|
...composeFiles(composePath),
|
|
2482
2362
|
"port",
|
|
@@ -2501,11 +2381,11 @@ const dockerCli = {
|
|
|
2501
2381
|
...services
|
|
2502
2382
|
];
|
|
2503
2383
|
if (options.show) return shown(args, services);
|
|
2504
|
-
await run
|
|
2384
|
+
await run("docker", args);
|
|
2505
2385
|
},
|
|
2506
2386
|
async copyOut(composePath, service, from, to) {
|
|
2507
2387
|
await (0, node_fs_promises.mkdir)((0, node_path.dirname)(to), { recursive: true });
|
|
2508
|
-
await run
|
|
2388
|
+
await run("docker", [
|
|
2509
2389
|
"compose",
|
|
2510
2390
|
...composeFiles(composePath),
|
|
2511
2391
|
"cp",
|
|
@@ -2514,7 +2394,7 @@ const dockerCli = {
|
|
|
2514
2394
|
]);
|
|
2515
2395
|
},
|
|
2516
2396
|
async reload(composePath, service) {
|
|
2517
|
-
await run
|
|
2397
|
+
await run("docker", [
|
|
2518
2398
|
"compose",
|
|
2519
2399
|
...composeFiles(composePath),
|
|
2520
2400
|
"exec",
|
|
@@ -2529,7 +2409,7 @@ const dockerCli = {
|
|
|
2529
2409
|
async healthy(composePath, services) {
|
|
2530
2410
|
if (services.length === 0) return true;
|
|
2531
2411
|
try {
|
|
2532
|
-
const { stdout } = await run
|
|
2412
|
+
const { stdout } = await run("docker", [
|
|
2533
2413
|
"compose",
|
|
2534
2414
|
...composeFiles(composePath),
|
|
2535
2415
|
"ps",
|
|
@@ -3445,7 +3325,7 @@ function metroPorts(workspace, manifest) {
|
|
|
3445
3325
|
const ports = {};
|
|
3446
3326
|
for (const [id, declaration] of Object.entries(manifest)) {
|
|
3447
3327
|
if (declaration.kind !== "mobile-app") continue;
|
|
3448
|
-
const port = workspace.apps[
|
|
3328
|
+
const port = workspace.apps[require_derive.appKey(id)]?.port;
|
|
3449
3329
|
if (port) ports[id] = port;
|
|
3450
3330
|
}
|
|
3451
3331
|
return ports;
|
|
@@ -3470,7 +3350,7 @@ function surfaceAddresses(workspace, manifest, at = (_app, port) => localAddress
|
|
|
3470
3350
|
const addresses = {};
|
|
3471
3351
|
for (const [id, declaration] of Object.entries(manifest)) {
|
|
3472
3352
|
if (declaration.kind !== "rest-api" && declaration.kind !== "site") continue;
|
|
3473
|
-
const host =
|
|
3353
|
+
const host = require_derive.appKey(id);
|
|
3474
3354
|
const port = workspace.apps[host]?.port;
|
|
3475
3355
|
if (port) addresses[id] = at(host, port);
|
|
3476
3356
|
}
|
|
@@ -3481,331 +3361,6 @@ function localAddress(port) {
|
|
|
3481
3361
|
return `http://localhost:${port}`;
|
|
3482
3362
|
}
|
|
3483
3363
|
//#endregion
|
|
3484
|
-
//#region src/run.ts
|
|
3485
|
-
/**
|
|
3486
|
-
* Start a program with an argument array, never a shell string.
|
|
3487
|
-
*
|
|
3488
|
-
* `gkm build`, `gkm docker` and `gkm deploy` pass values that come from the
|
|
3489
|
-
* workspace — image refs, tags, build args, package names — to `docker` and
|
|
3490
|
-
* `turbo`. Joined into a string and handed to a shell, a package named
|
|
3491
|
-
* `x;curl …|sh` or a tag holding `$(…)` became part of the command line, which
|
|
3492
|
-
* matters most where the CLI builds a repository it didn't write: a CI job for a
|
|
3493
|
-
* fork, a shared build runner. Here every value reaches the program as one
|
|
3494
|
-
* `argv` element, whatever it contains.
|
|
3495
|
-
*/
|
|
3496
|
-
/** Long enough for a cold image build; short enough that a hung one ends. */
|
|
3497
|
-
const DEFAULT_TIMEOUT_MS = 18e5;
|
|
3498
|
-
/** How long a timed-out child has to exit on SIGTERM before it is killed. */
|
|
3499
|
-
const KILL_GRACE_MS$1 = 5e3;
|
|
3500
|
-
/** The command line as a person would read it — for messages, never to run. */
|
|
3501
|
-
function display(command, args) {
|
|
3502
|
-
return [command, ...args].join(" ");
|
|
3503
|
-
}
|
|
3504
|
-
/** The program ran and exited unsuccessfully; its own output said why. */
|
|
3505
|
-
var CommandFailed = class extends Error {
|
|
3506
|
-
command;
|
|
3507
|
-
args;
|
|
3508
|
-
exitCode;
|
|
3509
|
-
signal;
|
|
3510
|
-
constructor(command, args, exitCode, signal) {
|
|
3511
|
-
super(`\`${display(command, args)}\` ${exitCode === null ? `was stopped by ${signal ?? "a signal"}` : `exited with code ${exitCode}`}. Its output above says why; run it by hand to see it again.`);
|
|
3512
|
-
this.command = command;
|
|
3513
|
-
this.args = args;
|
|
3514
|
-
this.exitCode = exitCode;
|
|
3515
|
-
this.signal = signal;
|
|
3516
|
-
this.name = "CommandFailed";
|
|
3517
|
-
}
|
|
3518
|
-
};
|
|
3519
|
-
/** The program ran past its timeout and was killed. */
|
|
3520
|
-
var CommandTimedOut = class extends Error {
|
|
3521
|
-
command;
|
|
3522
|
-
args;
|
|
3523
|
-
timeoutMs;
|
|
3524
|
-
constructor(command, args, timeoutMs) {
|
|
3525
|
-
super(`\`${display(command, args)}\` was still running after ${Math.round(timeoutMs / 1e3)}s and was stopped. Check what it was waiting on — a registry, the Docker daemon, a prompt — and run it again.`);
|
|
3526
|
-
this.command = command;
|
|
3527
|
-
this.args = args;
|
|
3528
|
-
this.timeoutMs = timeoutMs;
|
|
3529
|
-
this.name = "CommandTimedOut";
|
|
3530
|
-
}
|
|
3531
|
-
};
|
|
3532
|
-
/**
|
|
3533
|
-
* Run `command` with `args`, resolving when it exits 0.
|
|
3534
|
-
*
|
|
3535
|
-
* Rejects with {@link CommandFailed} on any other exit, {@link CommandTimedOut}
|
|
3536
|
-
* once `timeoutMs` passes (after the child is gone), and with the spawn error
|
|
3537
|
-
* itself when the program cannot be started at all — `ENOENT` already names it.
|
|
3538
|
-
*/
|
|
3539
|
-
async function run(command, args, options = {}) {
|
|
3540
|
-
await spawnChild(command, args, options, false);
|
|
3541
|
-
}
|
|
3542
|
-
/**
|
|
3543
|
-
* {@link run}, resolving with what the program wrote to stdout — for a value
|
|
3544
|
-
* the CLI reads back, such as the digest `docker inspect` reports. stderr still
|
|
3545
|
-
* reaches the terminal, so a failure explains itself the same way.
|
|
3546
|
-
*/
|
|
3547
|
-
function runOutput(command, args, options = {}) {
|
|
3548
|
-
return spawnChild(command, args, options, true);
|
|
3549
|
-
}
|
|
3550
|
-
function spawnChild(command, args, options, capture) {
|
|
3551
|
-
const { timeoutMs = DEFAULT_TIMEOUT_MS, ...spawnOptions } = options;
|
|
3552
|
-
return new Promise((resolve, reject) => {
|
|
3553
|
-
const child = (0, node_child_process.spawn)(command, [...args], {
|
|
3554
|
-
stdio: "inherit",
|
|
3555
|
-
...spawnOptions,
|
|
3556
|
-
...capture ? { stdio: [
|
|
3557
|
-
"ignore",
|
|
3558
|
-
"pipe",
|
|
3559
|
-
"inherit"
|
|
3560
|
-
] } : {},
|
|
3561
|
-
shell: false
|
|
3562
|
-
});
|
|
3563
|
-
let stdout = "";
|
|
3564
|
-
child.stdout?.on("data", (chunk) => {
|
|
3565
|
-
stdout += chunk.toString();
|
|
3566
|
-
});
|
|
3567
|
-
let timedOut = false;
|
|
3568
|
-
let killer;
|
|
3569
|
-
const timer = setTimeout(() => {
|
|
3570
|
-
timedOut = true;
|
|
3571
|
-
child.kill("SIGTERM");
|
|
3572
|
-
killer = setTimeout(() => child.kill("SIGKILL"), KILL_GRACE_MS$1);
|
|
3573
|
-
killer.unref?.();
|
|
3574
|
-
}, timeoutMs);
|
|
3575
|
-
timer.unref?.();
|
|
3576
|
-
const settle = () => {
|
|
3577
|
-
clearTimeout(timer);
|
|
3578
|
-
if (killer) clearTimeout(killer);
|
|
3579
|
-
};
|
|
3580
|
-
child.on("error", (error) => {
|
|
3581
|
-
settle();
|
|
3582
|
-
reject(spawnOptions.signal?.aborted ? spawnOptions.signal.reason : error);
|
|
3583
|
-
});
|
|
3584
|
-
child.on("close", (code, signal) => {
|
|
3585
|
-
settle();
|
|
3586
|
-
if (spawnOptions.signal?.aborted) reject(spawnOptions.signal.reason);
|
|
3587
|
-
else if (timedOut) reject(new CommandTimedOut(command, args, timeoutMs));
|
|
3588
|
-
else if (code === 0) resolve(stdout);
|
|
3589
|
-
else reject(new CommandFailed(command, args, code, signal));
|
|
3590
|
-
});
|
|
3591
|
-
});
|
|
3592
|
-
}
|
|
3593
|
-
//#endregion
|
|
3594
|
-
//#region src/sandbox/env.ts
|
|
3595
|
-
/**
|
|
3596
|
-
* What of the host's environment a local sandbox passes on.
|
|
3597
|
-
*
|
|
3598
|
-
* An allowlist, not a denylist: a credential's variable has any name its
|
|
3599
|
-
* owner chose (`DOKPLOY_TOKEN`, `AWS_SECRET_ACCESS_KEY`, `MY_VAULT_TOKEN`), so
|
|
3600
|
-
* the only safe default is to name what a program needs to *run* and pass
|
|
3601
|
-
* nothing else.
|
|
3602
|
-
*/
|
|
3603
|
-
/**
|
|
3604
|
-
* Variables a command needs to find programs, write temp files, print in the
|
|
3605
|
-
* user's locale and reach the network through the host's proxy — and nothing
|
|
3606
|
-
* that authenticates as anyone.
|
|
3607
|
-
*
|
|
3608
|
-
* Deliberately left out:
|
|
3609
|
-
* - `NODE_OPTIONS`: it can `--require` or `--import` code into every node
|
|
3610
|
-
* process, and CI often holds `--import tsx` there. A step that needs a
|
|
3611
|
-
* loader passes its own.
|
|
3612
|
-
* - `NODE_AUTH_TOKEN`, `NPM_TOKEN`, `npm_config_*`: registry tokens
|
|
3613
|
-
* (`actions/setup-node` writes `NODE_AUTH_TOKEN`), which is why there is no
|
|
3614
|
-
* `NODE_*` wildcard.
|
|
3615
|
-
* - `AWS_*`, `DOCKER_*`, `DOKPLOY_*`, `GITHUB_TOKEN`, `TURBO_TOKEN`, `GKM_*`:
|
|
3616
|
-
* credentials, or where the deploy keeps them.
|
|
3617
|
-
* - `SHELL`, `EDITOR` and the rest of a login session: nothing here starts a
|
|
3618
|
-
* shell.
|
|
3619
|
-
*
|
|
3620
|
-
* Proxies are passed: behind one, nothing installs or builds without it. A
|
|
3621
|
-
* proxy URL with a password in it reaches the command too — a host that keeps
|
|
3622
|
-
* one there and builds code it does not trust should pass a sandbox of its
|
|
3623
|
-
* own.
|
|
3624
|
-
*/
|
|
3625
|
-
const SANDBOX_ENV_ALLOWLIST = [
|
|
3626
|
-
"PATH",
|
|
3627
|
-
"HOME",
|
|
3628
|
-
"USER",
|
|
3629
|
-
"LOGNAME",
|
|
3630
|
-
"TMPDIR",
|
|
3631
|
-
"TMP",
|
|
3632
|
-
"TEMP",
|
|
3633
|
-
"LANG",
|
|
3634
|
-
"LANGUAGE",
|
|
3635
|
-
"TZ",
|
|
3636
|
-
/^LC_[A-Z]+$/,
|
|
3637
|
-
"TERM",
|
|
3638
|
-
"COLORTERM",
|
|
3639
|
-
"NO_COLOR",
|
|
3640
|
-
"FORCE_COLOR",
|
|
3641
|
-
"CI",
|
|
3642
|
-
"NODE_ENV",
|
|
3643
|
-
"NODE_EXTRA_CA_CERTS",
|
|
3644
|
-
"COREPACK_HOME",
|
|
3645
|
-
"PNPM_HOME",
|
|
3646
|
-
"XDG_CACHE_HOME",
|
|
3647
|
-
"XDG_DATA_HOME",
|
|
3648
|
-
"HTTP_PROXY",
|
|
3649
|
-
"HTTPS_PROXY",
|
|
3650
|
-
"NO_PROXY",
|
|
3651
|
-
"http_proxy",
|
|
3652
|
-
"https_proxy",
|
|
3653
|
-
"no_proxy",
|
|
3654
|
-
"SystemRoot",
|
|
3655
|
-
"SYSTEMROOT",
|
|
3656
|
-
"windir",
|
|
3657
|
-
"WINDIR",
|
|
3658
|
-
"ComSpec",
|
|
3659
|
-
"COMSPEC",
|
|
3660
|
-
"PATHEXT",
|
|
3661
|
-
"USERPROFILE",
|
|
3662
|
-
"APPDATA",
|
|
3663
|
-
"LOCALAPPDATA"
|
|
3664
|
-
];
|
|
3665
|
-
function allowed(name) {
|
|
3666
|
-
return SANDBOX_ENV_ALLOWLIST.some((entry) => typeof entry === "string" ? entry === name : entry.test(name));
|
|
3667
|
-
}
|
|
3668
|
-
/**
|
|
3669
|
-
* The allowlisted part of `source`, plus each of `extra` the host chose to
|
|
3670
|
-
* pass on by name.
|
|
3671
|
-
*/
|
|
3672
|
-
function allowlistedEnv(source = process.env, extra = []) {
|
|
3673
|
-
const env = {};
|
|
3674
|
-
for (const [name, value] of Object.entries(source)) {
|
|
3675
|
-
if (value === void 0) continue;
|
|
3676
|
-
if (allowed(name) || extra.includes(name)) env[name] = value;
|
|
3677
|
-
}
|
|
3678
|
-
return env;
|
|
3679
|
-
}
|
|
3680
|
-
//#endregion
|
|
3681
|
-
//#region src/sandbox/local.ts
|
|
3682
|
-
/** How long a timed-out command has to exit on SIGTERM before SIGKILL. */
|
|
3683
|
-
const KILL_GRACE_MS = 5e3;
|
|
3684
|
-
/** Where `output` sends a child's streams. */
|
|
3685
|
-
const STDIO = {
|
|
3686
|
-
capture: [
|
|
3687
|
-
"ignore",
|
|
3688
|
-
"pipe",
|
|
3689
|
-
"pipe"
|
|
3690
|
-
],
|
|
3691
|
-
inherit: "inherit",
|
|
3692
|
-
stderr: [
|
|
3693
|
-
"ignore",
|
|
3694
|
-
2,
|
|
3695
|
-
2
|
|
3696
|
-
],
|
|
3697
|
-
ignore: "ignore"
|
|
3698
|
-
};
|
|
3699
|
-
/**
|
|
3700
|
-
* A child process on this machine, as this user, with an allowlisted
|
|
3701
|
-
* environment.
|
|
3702
|
-
*
|
|
3703
|
-
* What it withholds from the command: the host's environment beyond
|
|
3704
|
-
* {@link SANDBOX_ENV_ALLOWLIST}, a shell, a working directory outside the
|
|
3705
|
-
* project, and any time past the timeout. What it does not: the host's
|
|
3706
|
-
* filesystem, which the command can read and write as the user running the
|
|
3707
|
-
* deploy. So it is not `isolating`, and it is the default for projects the
|
|
3708
|
-
* host already trusts — the developer's own, a team's own CI. Code nobody
|
|
3709
|
-
* vetted belongs in a sandbox that is.
|
|
3710
|
-
*
|
|
3711
|
-
* A timed-out command is sent SIGTERM, then SIGKILL; processes it started
|
|
3712
|
-
* itself are its to stop.
|
|
3713
|
-
*/
|
|
3714
|
-
var LocalSandbox = class {
|
|
3715
|
-
root;
|
|
3716
|
-
isolating = false;
|
|
3717
|
-
env;
|
|
3718
|
-
constructor(options) {
|
|
3719
|
-
this.root = (0, node_path.resolve)(options.root);
|
|
3720
|
-
this.env = {
|
|
3721
|
-
...allowlistedEnv(options.hostEnv ?? process.env, options.passEnv),
|
|
3722
|
-
...options.home ? {
|
|
3723
|
-
HOME: options.home,
|
|
3724
|
-
USERPROFILE: options.home
|
|
3725
|
-
} : {}
|
|
3726
|
-
};
|
|
3727
|
-
}
|
|
3728
|
-
async exec(command, args, options) {
|
|
3729
|
-
const cwd = require_discover.confineCwd(this.root, options.cwd);
|
|
3730
|
-
require_discover.assertSecretNames(options.secrets);
|
|
3731
|
-
options.signal?.throwIfAborted();
|
|
3732
|
-
const secretsDir = await mountSecrets(options.secrets);
|
|
3733
|
-
try {
|
|
3734
|
-
return await spawnConfined(command, args, {
|
|
3735
|
-
...options,
|
|
3736
|
-
cwd,
|
|
3737
|
-
env: secretsDir ? {
|
|
3738
|
-
...options.env,
|
|
3739
|
-
[require_discover.SECRETS_DIR_ENV]: secretsDir
|
|
3740
|
-
} : options.env
|
|
3741
|
-
});
|
|
3742
|
-
} finally {
|
|
3743
|
-
if (secretsDir) await (0, node_fs_promises.rm)(secretsDir, {
|
|
3744
|
-
recursive: true,
|
|
3745
|
-
force: true
|
|
3746
|
-
});
|
|
3747
|
-
}
|
|
3748
|
-
}
|
|
3749
|
-
};
|
|
3750
|
-
/**
|
|
3751
|
-
* Each secret as a 0600 file in a fresh 0700 directory outside the project —
|
|
3752
|
-
* where nothing the build writes, packs or commits will pick it up.
|
|
3753
|
-
*/
|
|
3754
|
-
async function mountSecrets(secrets) {
|
|
3755
|
-
if (!secrets || Object.keys(secrets).length === 0) return void 0;
|
|
3756
|
-
const dir = await (0, node_fs_promises.mkdtemp)((0, node_path.join)((0, node_os.tmpdir)(), "gkm-secrets-"));
|
|
3757
|
-
for (const [name, value] of Object.entries(secrets)) await (0, node_fs_promises.writeFile)((0, node_path.join)(dir, name), value, { mode: 384 });
|
|
3758
|
-
return dir;
|
|
3759
|
-
}
|
|
3760
|
-
function spawnConfined(command, args, options) {
|
|
3761
|
-
const { output = "capture", signal, timeoutMs } = options;
|
|
3762
|
-
return new Promise((resolvePromise, reject) => {
|
|
3763
|
-
const child = (0, node_child_process.spawn)(command, [...args], {
|
|
3764
|
-
cwd: options.cwd,
|
|
3765
|
-
env: { ...options.env },
|
|
3766
|
-
stdio: STDIO[output],
|
|
3767
|
-
shell: false,
|
|
3768
|
-
...signal ? { signal } : {}
|
|
3769
|
-
});
|
|
3770
|
-
let stdout = "";
|
|
3771
|
-
let stderr = "";
|
|
3772
|
-
child.stdout?.on("data", (chunk) => {
|
|
3773
|
-
stdout += chunk.toString();
|
|
3774
|
-
});
|
|
3775
|
-
child.stderr?.on("data", (chunk) => {
|
|
3776
|
-
stderr += chunk.toString();
|
|
3777
|
-
});
|
|
3778
|
-
let timedOut = false;
|
|
3779
|
-
let killer;
|
|
3780
|
-
const timer = setTimeout(() => {
|
|
3781
|
-
timedOut = true;
|
|
3782
|
-
child.kill("SIGTERM");
|
|
3783
|
-
killer = setTimeout(() => child.kill("SIGKILL"), KILL_GRACE_MS);
|
|
3784
|
-
killer.unref?.();
|
|
3785
|
-
}, timeoutMs);
|
|
3786
|
-
timer.unref?.();
|
|
3787
|
-
const settle = () => {
|
|
3788
|
-
clearTimeout(timer);
|
|
3789
|
-
if (killer) clearTimeout(killer);
|
|
3790
|
-
};
|
|
3791
|
-
child.on("error", (error) => {
|
|
3792
|
-
settle();
|
|
3793
|
-
reject(signal?.aborted ? signal.reason : error);
|
|
3794
|
-
});
|
|
3795
|
-
child.on("close", (code, killedBy) => {
|
|
3796
|
-
settle();
|
|
3797
|
-
if (signal?.aborted) reject(signal.reason);
|
|
3798
|
-
else if (timedOut) reject(new CommandTimedOut(command, args, timeoutMs));
|
|
3799
|
-
else resolvePromise({
|
|
3800
|
-
exitCode: code,
|
|
3801
|
-
signal: killedBy ?? null,
|
|
3802
|
-
stdout,
|
|
3803
|
-
stderr
|
|
3804
|
-
});
|
|
3805
|
-
});
|
|
3806
|
-
});
|
|
3807
|
-
}
|
|
3808
|
-
//#endregion
|
|
3809
3364
|
//#region src/secrets/encryption.ts
|
|
3810
3365
|
var encryption_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
3811
3366
|
encryptSecrets: () => encryptSecrets,
|
|
@@ -4230,17 +3785,17 @@ function isStateStore(value) {
|
|
|
4230
3785
|
async function createStateStore(options) {
|
|
4231
3786
|
const { config, workspaceRoot, workspaceName } = options;
|
|
4232
3787
|
if (!config || config.provider === "local") {
|
|
4233
|
-
const { LocalStateStore } = await Promise.resolve().then(() => require("./LocalStateStore-
|
|
3788
|
+
const { LocalStateStore } = await Promise.resolve().then(() => require("./LocalStateStore-DiJqKyPy.cjs")).then((n) => n.LocalStateStore_exports);
|
|
4234
3789
|
return new LocalStateStore(workspaceRoot);
|
|
4235
3790
|
}
|
|
4236
3791
|
if (isStateStore(config.provider)) return config.provider;
|
|
4237
3792
|
if (isStateProvider(config.provider)) {
|
|
4238
|
-
const { LegacyStateStore } = await Promise.resolve().then(() => require("./LegacyStateStore-
|
|
3793
|
+
const { LegacyStateStore } = await Promise.resolve().then(() => require("./LegacyStateStore-C2abV49N.cjs"));
|
|
4239
3794
|
return new LegacyStateStore(config.provider, { warn: options.warn });
|
|
4240
3795
|
}
|
|
4241
3796
|
if (config.provider === "ssm") {
|
|
4242
3797
|
if (!workspaceName) throw new StateStoreNeedsWorkspaceName("ssm");
|
|
4243
|
-
const { SSMStateStore } = await Promise.resolve().then(() => require("./SSMStateStore-
|
|
3798
|
+
const { SSMStateStore } = await Promise.resolve().then(() => require("./SSMStateStore-CLipvx47.cjs"));
|
|
4244
3799
|
const ssm = config;
|
|
4245
3800
|
return SSMStateStore.create({
|
|
4246
3801
|
workspaceName,
|
|
@@ -4250,7 +3805,7 @@ async function createStateStore(options) {
|
|
|
4250
3805
|
}
|
|
4251
3806
|
if (config.provider === "s3") {
|
|
4252
3807
|
if (!workspaceName) throw new StateStoreNeedsWorkspaceName("s3");
|
|
4253
|
-
const { S3StateStore } = await Promise.resolve().then(() => require("./S3StateStore-
|
|
3808
|
+
const { S3StateStore } = await Promise.resolve().then(() => require("./S3StateStore-Ds0V1Lgm.cjs"));
|
|
4254
3809
|
const s3 = config;
|
|
4255
3810
|
return S3StateStore.create({
|
|
4256
3811
|
workspaceName,
|
|
@@ -5434,7 +4989,7 @@ async function buildDockerImage(imageName, options, cwd) {
|
|
|
5434
4989
|
logger.log(`\n🐳 Building Docker image: ${fullImageName}`);
|
|
5435
4990
|
const cleanup = ensureLockfile(cwd);
|
|
5436
4991
|
try {
|
|
5437
|
-
await run("docker", [
|
|
4992
|
+
await require_local.run("docker", [
|
|
5438
4993
|
"build",
|
|
5439
4994
|
"--file=.gkm/docker/Dockerfile",
|
|
5440
4995
|
`--tag=${fullImageName}`,
|
|
@@ -5463,7 +5018,7 @@ async function pushDockerImage(imageName, options, cwd) {
|
|
|
5463
5018
|
const fullImageName = validateImageRef(`${registry}/${imageName}:${tag}`);
|
|
5464
5019
|
logger.log(`\n🚀 Pushing Docker image: ${fullImageName}`);
|
|
5465
5020
|
try {
|
|
5466
|
-
await run("docker", ["push", fullImageName], { cwd });
|
|
5021
|
+
await require_local.run("docker", ["push", fullImageName], { cwd });
|
|
5467
5022
|
logger.log(`✅ Docker image pushed: ${fullImageName}`);
|
|
5468
5023
|
} catch (error) {
|
|
5469
5024
|
throw new DockerPushFailed(fullImageName, error);
|
|
@@ -5566,7 +5121,7 @@ async function workspaceDockerCommand(workspace, manifest) {
|
|
|
5566
5121
|
* leaving the bundle with an empty URL.
|
|
5567
5122
|
*/
|
|
5568
5123
|
function siteDockerfile(appName, app, options) {
|
|
5569
|
-
const declared = options.manifest ? Object.entries(options.manifest).find(([id, d]) => d.kind === "site" &&
|
|
5124
|
+
const declared = options.manifest ? Object.entries(options.manifest).find(([id, d]) => d.kind === "site" && require_derive.appKey(id) === appName)?.[1] : void 0;
|
|
5570
5125
|
const publicUrlArgs = declared?.kind === "site" && options.manifest ? Object.keys((0, _geekmidas_manifest.publicEnvFor)(declared, options.manifest)) : getPublicUrlArgNames(app);
|
|
5571
5126
|
const webOpts = {
|
|
5572
5127
|
imageName: appName,
|
|
@@ -6429,7 +5984,7 @@ function resolveSnifferFile(baseName) {
|
|
|
6429
5984
|
* comes back as the error the caller reports.
|
|
6430
5985
|
*/
|
|
6431
5986
|
async function runSniffer(run, workspacePath, cwd, nodeArgs) {
|
|
6432
|
-
const sandbox = run.sandbox ??
|
|
5987
|
+
const sandbox = run.sandbox ?? require_sandbox.activeSandbox() ?? new require_local.LocalSandbox({ root: (0, node_path.resolve)(workspacePath) });
|
|
6433
5988
|
try {
|
|
6434
5989
|
const result = await sandbox.exec("node", nodeArgs, {
|
|
6435
5990
|
cwd,
|
|
@@ -6700,30 +6255,12 @@ async function sniffAllApps(apps, workspacePath, options = {}) {
|
|
|
6700
6255
|
return results;
|
|
6701
6256
|
}
|
|
6702
6257
|
//#endregion
|
|
6703
|
-
Object.defineProperty(exports, "CommandFailed", {
|
|
6704
|
-
enumerable: true,
|
|
6705
|
-
get: function() {
|
|
6706
|
-
return CommandFailed;
|
|
6707
|
-
}
|
|
6708
|
-
});
|
|
6709
|
-
Object.defineProperty(exports, "CommandTimedOut", {
|
|
6710
|
-
enumerable: true,
|
|
6711
|
-
get: function() {
|
|
6712
|
-
return CommandTimedOut;
|
|
6713
|
-
}
|
|
6714
|
-
});
|
|
6715
6258
|
Object.defineProperty(exports, "DEFAULT_IMAGES", {
|
|
6716
6259
|
enumerable: true,
|
|
6717
6260
|
get: function() {
|
|
6718
6261
|
return DEFAULT_IMAGES;
|
|
6719
6262
|
}
|
|
6720
6263
|
});
|
|
6721
|
-
Object.defineProperty(exports, "DEFAULT_TIMEOUT_MS", {
|
|
6722
|
-
enumerable: true,
|
|
6723
|
-
get: function() {
|
|
6724
|
-
return DEFAULT_TIMEOUT_MS;
|
|
6725
|
-
}
|
|
6726
|
-
});
|
|
6727
6264
|
Object.defineProperty(exports, "DockerBuildFailed", {
|
|
6728
6265
|
enumerable: true,
|
|
6729
6266
|
get: function() {
|
|
@@ -6766,18 +6303,6 @@ Object.defineProperty(exports, "LOCAL_CA_PATH", {
|
|
|
6766
6303
|
return LOCAL_CA_PATH;
|
|
6767
6304
|
}
|
|
6768
6305
|
});
|
|
6769
|
-
Object.defineProperty(exports, "LocalSandbox", {
|
|
6770
|
-
enumerable: true,
|
|
6771
|
-
get: function() {
|
|
6772
|
-
return LocalSandbox;
|
|
6773
|
-
}
|
|
6774
|
-
});
|
|
6775
|
-
Object.defineProperty(exports, "SANDBOX_ENV_ALLOWLIST", {
|
|
6776
|
-
enumerable: true,
|
|
6777
|
-
get: function() {
|
|
6778
|
-
return SANDBOX_ENV_ALLOWLIST;
|
|
6779
|
-
}
|
|
6780
|
-
});
|
|
6781
6306
|
Object.defineProperty(exports, "StageStateMissing", {
|
|
6782
6307
|
enumerable: true,
|
|
6783
6308
|
get: function() {
|
|
@@ -6808,12 +6333,6 @@ Object.defineProperty(exports, "StateVersionConflict", {
|
|
|
6808
6333
|
return StateVersionConflict;
|
|
6809
6334
|
}
|
|
6810
6335
|
});
|
|
6811
|
-
Object.defineProperty(exports, "allowlistedEnv", {
|
|
6812
|
-
enumerable: true,
|
|
6813
|
-
get: function() {
|
|
6814
|
-
return allowlistedEnv;
|
|
6815
|
-
}
|
|
6816
|
-
});
|
|
6817
6336
|
Object.defineProperty(exports, "appEnvKeys", {
|
|
6818
6337
|
enumerable: true,
|
|
6819
6338
|
get: function() {
|
|
@@ -6976,36 +6495,12 @@ Object.defineProperty(exports, "getBackupState", {
|
|
|
6976
6495
|
return getBackupState;
|
|
6977
6496
|
}
|
|
6978
6497
|
});
|
|
6979
|
-
Object.defineProperty(exports, "getDokployCredentials", {
|
|
6980
|
-
enumerable: true,
|
|
6981
|
-
get: function() {
|
|
6982
|
-
return getDokployCredentials;
|
|
6983
|
-
}
|
|
6984
|
-
});
|
|
6985
|
-
Object.defineProperty(exports, "getDokployRegistryId", {
|
|
6986
|
-
enumerable: true,
|
|
6987
|
-
get: function() {
|
|
6988
|
-
return getDokployRegistryId;
|
|
6989
|
-
}
|
|
6990
|
-
});
|
|
6991
|
-
Object.defineProperty(exports, "getDokployToken", {
|
|
6992
|
-
enumerable: true,
|
|
6993
|
-
get: function() {
|
|
6994
|
-
return getDokployToken;
|
|
6995
|
-
}
|
|
6996
|
-
});
|
|
6997
6498
|
Object.defineProperty(exports, "getGeneratedSecret", {
|
|
6998
6499
|
enumerable: true,
|
|
6999
6500
|
get: function() {
|
|
7000
6501
|
return getGeneratedSecret;
|
|
7001
6502
|
}
|
|
7002
6503
|
});
|
|
7003
|
-
Object.defineProperty(exports, "getHostingerToken", {
|
|
7004
|
-
enumerable: true,
|
|
7005
|
-
get: function() {
|
|
7006
|
-
return getHostingerToken;
|
|
7007
|
-
}
|
|
7008
|
-
});
|
|
7009
6504
|
Object.defineProperty(exports, "hostFor", {
|
|
7010
6505
|
enumerable: true,
|
|
7011
6506
|
get: function() {
|
|
@@ -7138,12 +6633,6 @@ Object.defineProperty(exports, "quoteIdentifier", {
|
|
|
7138
6633
|
return quoteIdentifier;
|
|
7139
6634
|
}
|
|
7140
6635
|
});
|
|
7141
|
-
Object.defineProperty(exports, "readCredentials", {
|
|
7142
|
-
enumerable: true,
|
|
7143
|
-
get: function() {
|
|
7144
|
-
return readCredentials;
|
|
7145
|
-
}
|
|
7146
|
-
});
|
|
7147
6636
|
Object.defineProperty(exports, "reconcileWorkspace", {
|
|
7148
6637
|
enumerable: true,
|
|
7149
6638
|
get: function() {
|
|
@@ -7162,18 +6651,6 @@ Object.defineProperty(exports, "resourceName", {
|
|
|
7162
6651
|
return resourceName;
|
|
7163
6652
|
}
|
|
7164
6653
|
});
|
|
7165
|
-
Object.defineProperty(exports, "run", {
|
|
7166
|
-
enumerable: true,
|
|
7167
|
-
get: function() {
|
|
7168
|
-
return run;
|
|
7169
|
-
}
|
|
7170
|
-
});
|
|
7171
|
-
Object.defineProperty(exports, "runOutput", {
|
|
7172
|
-
enumerable: true,
|
|
7173
|
-
get: function() {
|
|
7174
|
-
return runOutput;
|
|
7175
|
-
}
|
|
7176
|
-
});
|
|
7177
6654
|
Object.defineProperty(exports, "setApplicationId", {
|
|
7178
6655
|
enumerable: true,
|
|
7179
6656
|
get: function() {
|
|
@@ -7240,12 +6717,6 @@ Object.defineProperty(exports, "storageBackendFor", {
|
|
|
7240
6717
|
return storageBackendFor;
|
|
7241
6718
|
}
|
|
7242
6719
|
});
|
|
7243
|
-
Object.defineProperty(exports, "storeDokployCredentials", {
|
|
7244
|
-
enumerable: true,
|
|
7245
|
-
get: function() {
|
|
7246
|
-
return storeDokployCredentials;
|
|
7247
|
-
}
|
|
7248
|
-
});
|
|
7249
6720
|
Object.defineProperty(exports, "validateDokployToken", {
|
|
7250
6721
|
enumerable: true,
|
|
7251
6722
|
get: function() {
|
|
@@ -7277,4 +6748,4 @@ Object.defineProperty(exports, "workspace_exports", {
|
|
|
7277
6748
|
}
|
|
7278
6749
|
});
|
|
7279
6750
|
|
|
7280
|
-
//# sourceMappingURL=sniffer-
|
|
6751
|
+
//# sourceMappingURL=sniffer-ByhbEW5A.cjs.map
|