@geekmidas/cli 10.0.0-alpha.66 → 10.0.0-alpha.67

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.
Files changed (114) hide show
  1. package/README.md +110 -178
  2. package/dist/{HostingerProvider-CY_VpVud.mjs → HostingerProvider-D85ayzTi.mjs} +2 -2
  3. package/dist/{HostingerProvider-CY_VpVud.mjs.map → HostingerProvider-D85ayzTi.mjs.map} +1 -1
  4. package/dist/{HostingerProvider-BznqRC2S.cjs → HostingerProvider-dxkwynSs.cjs} +2 -2
  5. package/dist/{HostingerProvider-BznqRC2S.cjs.map → HostingerProvider-dxkwynSs.cjs.map} +1 -1
  6. package/dist/{LegacyStateStore-BFcTT2QL.cjs → LegacyStateStore-BZiO9-Lw.cjs} +2 -2
  7. package/dist/{LegacyStateStore-BFcTT2QL.cjs.map → LegacyStateStore-BZiO9-Lw.cjs.map} +1 -1
  8. package/dist/{LegacyStateStore-CFheFo62.mjs → LegacyStateStore-C39UKwmf.mjs} +2 -2
  9. package/dist/{LegacyStateStore-CFheFo62.mjs.map → LegacyStateStore-C39UKwmf.mjs.map} +1 -1
  10. package/dist/{LocalStateStore-BVUexSvu.cjs → LocalStateStore-DHVsZLyF.cjs} +2 -2
  11. package/dist/{LocalStateStore-BVUexSvu.cjs.map → LocalStateStore-DHVsZLyF.cjs.map} +1 -1
  12. package/dist/{LocalStateStore-Bm3x9oOg.mjs → LocalStateStore-Dk3Wbvzk.mjs} +2 -2
  13. package/dist/{LocalStateStore-Bm3x9oOg.mjs.map → LocalStateStore-Dk3Wbvzk.mjs.map} +1 -1
  14. package/dist/{S3StateStore-CoXBhILd.cjs → S3StateStore--4tYVMAL.cjs} +2 -2
  15. package/dist/{S3StateStore-CoXBhILd.cjs.map → S3StateStore--4tYVMAL.cjs.map} +1 -1
  16. package/dist/{S3StateStore-BFHuctWM.mjs → S3StateStore-B_ZF9eHt.mjs} +2 -2
  17. package/dist/{S3StateStore-BFHuctWM.mjs.map → S3StateStore-B_ZF9eHt.mjs.map} +1 -1
  18. package/dist/{SSMStateStore-BqCA9TP2.cjs → SSMStateStore-ACZ8hRvZ.cjs} +2 -2
  19. package/dist/{SSMStateStore-BqCA9TP2.cjs.map → SSMStateStore-ACZ8hRvZ.cjs.map} +1 -1
  20. package/dist/{SSMStateStore-C1kvHScY.mjs → SSMStateStore-DjPuKqrm.mjs} +2 -2
  21. package/dist/{SSMStateStore-C1kvHScY.mjs.map → SSMStateStore-DjPuKqrm.mjs.map} +1 -1
  22. package/dist/{bundler-Dvaiud0h.mjs → bundler-Bq3HaLOZ.mjs} +20 -5
  23. package/dist/bundler-Bq3HaLOZ.mjs.map +1 -0
  24. package/dist/{bundler-orRqUJNZ.cjs → bundler-pyLj-gS0.cjs} +20 -5
  25. package/dist/bundler-pyLj-gS0.cjs.map +1 -0
  26. package/dist/{cli-CfHm0AO7.mjs → cli-C2Tjbn27.mjs} +4 -4
  27. package/dist/{cli-CfHm0AO7.mjs.map → cli-C2Tjbn27.mjs.map} +1 -1
  28. package/dist/{cli-D1JkkOwg.cjs → cli-DR7B2_fX.cjs} +4 -4
  29. package/dist/{cli-D1JkkOwg.cjs.map → cli-DR7B2_fX.cjs.map} +1 -1
  30. package/dist/{compose-jrLy7KGO.cjs → compose-5oNHAKNT.cjs} +135 -110
  31. package/dist/compose-5oNHAKNT.cjs.map +1 -0
  32. package/dist/{compose-CNQL8BnO.mjs → compose-BjToENzG.mjs} +128 -103
  33. package/dist/compose-BjToENzG.mjs.map +1 -0
  34. package/dist/{credentials-Bzbg23n8.cjs → credentials-BVs7mrtw.cjs} +239 -3
  35. package/dist/credentials-BVs7mrtw.cjs.map +1 -0
  36. package/dist/{credentials-Dq1MnWQf.mjs → credentials-pAtB70k3.mjs} +223 -5
  37. package/dist/credentials-pAtB70k3.mjs.map +1 -0
  38. package/dist/deploy/public.cjs +17 -17
  39. package/dist/deploy/public.cjs.map +1 -1
  40. package/dist/deploy/public.mjs +9 -9
  41. package/dist/{deploy-B7aJi_Ah.cjs → deploy-BucRfbvX.cjs} +9 -9
  42. package/dist/{deploy-B7aJi_Ah.cjs.map → deploy-BucRfbvX.cjs.map} +1 -1
  43. package/dist/{deploy-DWn7YfIc.mjs → deploy-DRAwTG72.mjs} +6 -6
  44. package/dist/{deploy-DWn7YfIc.mjs.map → deploy-DRAwTG72.mjs.map} +1 -1
  45. package/dist/{dokploy-DalwLML5.mjs → dokploy-DIt1IZl1.mjs} +2 -2
  46. package/dist/{dokploy-DalwLML5.mjs.map → dokploy-DIt1IZl1.mjs.map} +1 -1
  47. package/dist/{dokploy-B4LcYG1E.cjs → dokploy-m345Zx02.cjs} +2 -2
  48. package/dist/{dokploy-B4LcYG1E.cjs.map → dokploy-m345Zx02.cjs.map} +1 -1
  49. package/dist/{encryption-CPfENwWO.mjs → encryption-Ccbahik7.mjs} +2 -2
  50. package/dist/{encryption-CPfENwWO.mjs.map → encryption-Ccbahik7.mjs.map} +1 -1
  51. package/dist/{encryption-3KlGS1sl.cjs → encryption-rZ3BghXy.cjs} +2 -2
  52. package/dist/{encryption-3KlGS1sl.cjs.map → encryption-rZ3BghXy.cjs.map} +1 -1
  53. package/dist/{engine-DR6KurWX.cjs → engine-Cx_dvx9q.cjs} +9 -187
  54. package/dist/engine-Cx_dvx9q.cjs.map +1 -0
  55. package/dist/{engine-CunvOG3s.mjs → engine-Gs0abjuj.mjs} +5 -183
  56. package/dist/engine-Gs0abjuj.mjs.map +1 -0
  57. package/dist/{github-MXA9v7Ge.mjs → github-CJANTYqi.mjs} +2 -2
  58. package/dist/{github-MXA9v7Ge.mjs.map → github-CJANTYqi.mjs.map} +1 -1
  59. package/dist/{github-BJ5gh9bw.cjs → github-CrcGFkfD.cjs} +2 -2
  60. package/dist/{github-BJ5gh9bw.cjs.map → github-CrcGFkfD.cjs.map} +1 -1
  61. package/dist/index.cjs +51 -65
  62. package/dist/index.cjs.map +1 -1
  63. package/dist/index.mjs +47 -61
  64. package/dist/index.mjs.map +1 -1
  65. package/dist/{migrate-CF4J4GQS.cjs → migrate-CQdSpttI.cjs} +2 -2
  66. package/dist/{migrate-CF4J4GQS.cjs.map → migrate-CQdSpttI.cjs.map} +1 -1
  67. package/dist/{migrate-BJBcm4sG.mjs → migrate-DCVo5gLS.mjs} +2 -2
  68. package/dist/{migrate-BJBcm4sG.mjs.map → migrate-DCVo5gLS.mjs.map} +1 -1
  69. package/dist/{resolve-CVmch0wI.cjs → resolve-BexmDcsN.cjs} +4 -4
  70. package/dist/{resolve-CVmch0wI.cjs.map → resolve-BexmDcsN.cjs.map} +1 -1
  71. package/dist/{resolve-Db0tNlrW.mjs → resolve-DhZgtvZe.mjs} +4 -4
  72. package/dist/{resolve-Db0tNlrW.mjs.map → resolve-DhZgtvZe.mjs.map} +1 -1
  73. package/dist/{rollback-DxJK84hy.cjs → rollback-BnY7KuG_.cjs} +6 -7
  74. package/dist/{rollback-DxJK84hy.cjs.map → rollback-BnY7KuG_.cjs.map} +1 -1
  75. package/dist/{rollback-DvAo4OKS.mjs → rollback-m4Yeym5x.mjs} +5 -6
  76. package/dist/{rollback-DvAo4OKS.mjs.map → rollback-m4Yeym5x.mjs.map} +1 -1
  77. package/dist/run-BJLIerMM.mjs +133 -0
  78. package/dist/run-BJLIerMM.mjs.map +1 -0
  79. package/dist/run-fVZ-rLnc.cjs +174 -0
  80. package/dist/run-fVZ-rLnc.cjs.map +1 -0
  81. package/dist/{sniffer-BAQhLEsI.mjs → sniffer-BdFeLSmA.mjs} +8 -60
  82. package/dist/sniffer-BdFeLSmA.mjs.map +1 -0
  83. package/dist/{sniffer-5xmrkh2a.cjs → sniffer-D66HIvi9.cjs} +7 -77
  84. package/dist/{sniffer-5xmrkh2a.cjs.map → sniffer-D66HIvi9.cjs.map} +1 -1
  85. package/dist/{sst-B2HbrDR3.mjs → sst-DRi3H5TB.mjs} +3 -3
  86. package/dist/{sst-B2HbrDR3.mjs.map → sst-DRi3H5TB.mjs.map} +1 -1
  87. package/dist/{sst-DcfsVH6x.cjs → sst-hBrKouBy.cjs} +5 -5
  88. package/dist/{sst-DcfsVH6x.cjs.map → sst-hBrKouBy.cjs.map} +1 -1
  89. package/dist/{state-Y6ATakMX.cjs → state-DgmM4EKq.cjs} +3588 -3415
  90. package/dist/state-DgmM4EKq.cjs.map +1 -0
  91. package/dist/{state-uuYqnRVO.mjs → state-DkUStoqJ.mjs} +3528 -3385
  92. package/dist/state-DkUStoqJ.mjs.map +1 -0
  93. package/dist/target/public.cjs +1 -1
  94. package/dist/target/public.mjs +1 -1
  95. package/dist/{terminal-DUhcZ1ND.mjs → terminal-C3cv-OQu.mjs} +2 -2
  96. package/dist/{terminal-DUhcZ1ND.mjs.map → terminal-C3cv-OQu.mjs.map} +1 -1
  97. package/dist/{terminal-CHy_MdjG.cjs → terminal-DjzgLu6m.cjs} +2 -2
  98. package/dist/{terminal-CHy_MdjG.cjs.map → terminal-DjzgLu6m.cjs.map} +1 -1
  99. package/package.json +13 -13
  100. package/dist/bundler-Dvaiud0h.mjs.map +0 -1
  101. package/dist/bundler-orRqUJNZ.cjs.map +0 -1
  102. package/dist/compose-CNQL8BnO.mjs.map +0 -1
  103. package/dist/compose-jrLy7KGO.cjs.map +0 -1
  104. package/dist/credentials-Bzbg23n8.cjs.map +0 -1
  105. package/dist/credentials-Dq1MnWQf.mjs.map +0 -1
  106. package/dist/engine-CunvOG3s.mjs.map +0 -1
  107. package/dist/engine-DR6KurWX.cjs.map +0 -1
  108. package/dist/local-BdH4XN0E.cjs +0 -409
  109. package/dist/local-BdH4XN0E.cjs.map +0 -1
  110. package/dist/local-CWR4Y_kW.mjs +0 -350
  111. package/dist/local-CWR4Y_kW.mjs.map +0 -1
  112. package/dist/sniffer-BAQhLEsI.mjs.map +0 -1
  113. package/dist/state-Y6ATakMX.cjs.map +0 -1
  114. package/dist/state-uuYqnRVO.mjs.map +0 -1
@@ -1,197 +1,19 @@
1
- const require_local = require("./local-BdH4XN0E.cjs");
2
- const require_credentials = require("./credentials-Bzbg23n8.cjs");
1
+ const require_credentials = require("./credentials-BVs7mrtw.cjs");
3
2
  const require_schemas = require("./schemas-RUlKHu27.cjs");
4
3
  const require_discover = require("./discover-OEfZ9OkA.cjs");
5
4
  const require_sandbox = require("./sandbox-CL--ZDui.cjs");
6
5
  const require_derive = require("./derive-DAbo49sm.cjs");
7
6
  const require_workspace = require("./workspace-ON-bqiJz.cjs");
8
- const require_state = require("./state-Y6ATakMX.cjs");
9
- const require_sniffer = require("./sniffer-5xmrkh2a.cjs");
7
+ const require_state = require("./state-DgmM4EKq.cjs");
8
+ const require_sniffer = require("./sniffer-D66HIvi9.cjs");
10
9
  const require_provider = require("./provider-B3Sv_a74.cjs");
11
10
  let node_path = require("node:path");
12
- let node_fs_promises = require("node:fs/promises");
13
- let node_os = require("node:os");
14
11
  let _geekmidas_manifest = require("@geekmidas/manifest");
15
12
  let node_crypto = require("node:crypto");
16
13
  let _geekmidas_db_pg_roles = require("@geekmidas/db/pg/roles");
17
14
  let pg = require("pg");
18
15
  let _geekmidas_cache_postgres = require("@geekmidas/cache/postgres");
19
16
  let node_dns_promises = require("node:dns/promises");
20
- //#region src/deploy/docker.ts
21
- const logger$3 = require_discover.output;
22
- /**
23
- * The id the Dockerfile templates mount the encrypted credentials under:
24
- * `RUN --mount=type=secret,id=gkm_credentials`.
25
- */
26
- const CREDENTIALS_SECRET_ID = "gkm_credentials";
27
- /**
28
- * Get the full image reference
29
- */
30
- function getImageRef(registry, imageName, tag) {
31
- if (registry) return `${registry}/${imageName}:${tag}`;
32
- return `${imageName}:${tag}`;
33
- }
34
- /**
35
- * The `docker build` argv for an image.
36
- *
37
- * One element per value, so nothing in a ref or a build arg is read by a
38
- * shell, and `--opt=value` rather than `--opt value`, so a value that starts
39
- * with `-` cannot be taken for one of docker's own flags.
40
- *
41
- * @internal Exported for testing
42
- */
43
- function dockerBuildArgs(options) {
44
- const { dockerfilePath, imageRef, buildArgs = [], credentialsFile } = options;
45
- return [
46
- "build",
47
- "--platform=linux/amd64",
48
- `--file=${dockerfilePath}`,
49
- `--tag=${imageRef}`,
50
- ...buildArgs.map((arg) => `--build-arg=${arg}`),
51
- ...credentialsFile ? [`--secret=id=${CREDENTIALS_SECRET_ID},src=${credentialsFile}`] : [],
52
- "."
53
- ];
54
- }
55
- /**
56
- * Write the encrypted credentials where `docker build --secret` reads them.
57
- *
58
- * Two lines — ciphertext, then IV — so a template can split them with `sed`
59
- * in any base image. Owner-only, in a directory of its own, and the returned
60
- * cleanup removes both whatever the build did.
61
- *
62
- * @internal Exported for testing
63
- */
64
- async function writeCredentialsFile(credentials) {
65
- const dir = await (0, node_fs_promises.mkdtemp)((0, node_path.join)((0, node_os.tmpdir)(), "gkm-credentials-"));
66
- const path = (0, node_path.join)(dir, CREDENTIALS_SECRET_ID);
67
- await (0, node_fs_promises.writeFile)(path, `${credentials.encrypted}\n${credentials.iv}\n`, { mode: 384 });
68
- await (0, node_fs_promises.chmod)(path, 384);
69
- return {
70
- path,
71
- cleanup: () => (0, node_fs_promises.rm)(dir, {
72
- recursive: true,
73
- force: true
74
- })
75
- };
76
- }
77
- /**
78
- * Build Docker image
79
- * @param imageRef - Full image reference (registry/name:tag)
80
- * @param buildArgs - Build arguments to pass to docker build
81
- * @param credentials - Encrypted credentials, passed as a build secret
82
- */
83
- async function buildImage(imageRef, buildArgs, credentials, { cwd, dockerfile, signal, stdio }) {
84
- logger$3.log(`\n🔨 Building Docker image: ${imageRef}`);
85
- logger$3.log(" Generating Dockerfile...");
86
- await require_state.dockerCommand({
87
- slim: true,
88
- cwd
89
- });
90
- const dockerfilePath = dockerfile;
91
- const secret = credentials ? await writeCredentialsFile(credentials) : void 0;
92
- try {
93
- await require_local.run("docker", dockerBuildArgs({
94
- dockerfilePath,
95
- imageRef,
96
- buildArgs,
97
- credentialsFile: secret?.path
98
- }), {
99
- cwd,
100
- env: {
101
- ...process.env,
102
- DOCKER_BUILDKIT: "1"
103
- },
104
- ...signal ? { signal } : {},
105
- ...stdio ? { stdio } : {}
106
- });
107
- logger$3.log(`✅ Image built: ${imageRef}`);
108
- } catch (error) {
109
- throw new require_state.DockerBuildFailed(imageRef, error);
110
- } finally {
111
- await secret?.cleanup();
112
- }
113
- }
114
- /**
115
- * Push Docker image to registry
116
- */
117
- async function pushImage(imageRef, { cwd, signal, stdio }) {
118
- logger$3.log(`\n☁️ Pushing image: ${imageRef}`);
119
- try {
120
- await require_local.run("docker", ["push", imageRef], {
121
- cwd,
122
- ...signal ? { signal } : {},
123
- ...stdio ? { stdio } : {}
124
- });
125
- logger$3.log(`✅ Image pushed: ${imageRef}`);
126
- } catch (error) {
127
- throw new require_state.DockerPushFailed(imageRef, error);
128
- }
129
- }
130
- /**
131
- * The digest the registry gave a pushed image, `sha256:…`.
132
- *
133
- * A tag can be pushed over — by the next deploy, or by anything else that
134
- * shares the repository — and the digest is what says which image a stage
135
- * actually ran. `RepoDigests` has one entry per repository the image was
136
- * pushed to, so the one for this ref's repository is picked by name.
137
- *
138
- * @internal Exported for testing
139
- */
140
- async function pushedDigest(imageRef, { cwd, signal } = { cwd: process.cwd() }) {
141
- const repository = imageRef.split("@")[0].replace(/:[\w][\w.-]*$/, "");
142
- const output = await require_local.runOutput("docker", [
143
- "image",
144
- "inspect",
145
- "--format={{json .RepoDigests}}",
146
- imageRef
147
- ], {
148
- cwd,
149
- ...signal ? { signal } : {}
150
- });
151
- let digests;
152
- try {
153
- digests = JSON.parse(output.trim() || "[]");
154
- } catch {
155
- return;
156
- }
157
- if (!Array.isArray(digests)) return void 0;
158
- return digests.find((entry) => typeof entry === "string" && entry.startsWith(`${repository}@`))?.slice(repository.length + 1);
159
- }
160
- /**
161
- * Deploy using Docker (build and optionally push image)
162
- */
163
- async function deployDocker(options) {
164
- const { stage, tag, skipPush, masterKey, config, buildArgs, credentials } = options;
165
- const imageName = config.imageName;
166
- const imageRef = require_state.validateImageRef(getImageRef(config.registry, imageName, tag));
167
- const cwd = options.cwd ?? process.cwd();
168
- const docker = {
169
- cwd,
170
- dockerfile: (0, node_path.join)(cwd, require_state.dockerfileOf(config.appName ?? imageName, options.appPath ?? ".")),
171
- ...options.signal ? { signal: options.signal } : {},
172
- ...options.stdio ? { stdio: options.stdio } : {}
173
- };
174
- await buildImage(imageRef, buildArgs, credentials, docker);
175
- let digest;
176
- if (!skipPush) {
177
- if (!config.registry) logger$3.warn("\n⚠️ No registry configured. Use --skip-push or configure docker.registry in gkm.config.ts");
178
- else {
179
- await pushImage(imageRef, docker);
180
- digest = await pushedDigest(imageRef, docker);
181
- }
182
- }
183
- logger$3.log("\n✅ Docker deployment ready!");
184
- logger$3.log(`\n📋 Deployment details:`);
185
- logger$3.log(` Image: ${imageRef}`);
186
- logger$3.log(` Stage: ${stage}`);
187
- if (masterKey) logger$3.log(`\n🔐 Run the container with GKM_MASTER_KEY set to the key with fingerprint ${require_sniffer.keyFingerprint(masterKey)}.`);
188
- return {
189
- imageRef,
190
- ...digest ? { digest } : {},
191
- masterKey
192
- };
193
- }
194
- //#endregion
195
17
  //#region src/deploy/ownership.ts
196
18
  /**
197
19
  * Which Dokploy project a deploy is allowed to deploy into.
@@ -439,7 +261,7 @@ function filterSecretsForApp(stageSecrets, sniffedEnv) {
439
261
  * @returns Encrypted payload with master key
440
262
  */
441
263
  function encryptSecretsForApp(filteredSecrets) {
442
- const payload = require_sniffer.encryptSecrets(filteredSecrets.secrets);
264
+ const payload = require_state.encryptSecrets(filteredSecrets.secrets);
443
265
  return {
444
266
  appName: filteredSecrets.appName,
445
267
  payload,
@@ -1273,7 +1095,7 @@ async function createDnsProvider(options) {
1273
1095
  if (isDnsProvider(config.provider)) return config.provider;
1274
1096
  const provider = config.provider;
1275
1097
  if (provider === "hostinger") {
1276
- const { HostingerProvider } = await Promise.resolve().then(() => require("./HostingerProvider-BznqRC2S.cjs"));
1098
+ const { HostingerProvider } = await Promise.resolve().then(() => require("./HostingerProvider-dxkwynSs.cjs"));
1277
1099
  return new HostingerProvider();
1278
1100
  }
1279
1101
  if (provider === "route53") {
@@ -1841,7 +1663,7 @@ const answer = require_schemas.discriminatedUnion("reason", [require_schemas.obj
1841
1663
  })]);
1842
1664
  /** Apply every pending migration, in the sandbox, as each construct's owner. */
1843
1665
  async function runMigrations(options) {
1844
- const sandbox = options.sandbox ?? require_sandbox.activeSandbox() ?? new require_local.LocalSandbox({ root: options.root });
1666
+ const sandbox = options.sandbox ?? require_sandbox.activeSandbox() ?? new require_credentials.LocalSandbox({ root: options.root });
1845
1667
  const { value } = await require_discover.runWorker(sandbox, "migrations", {
1846
1668
  name: "migrate-worker",
1847
1669
  args: [JSON.stringify({
@@ -2535,7 +2357,7 @@ async function releaseDokploy(run) {
2535
2357
  if (appSecrets && credentials) logger.log(` Encrypted ${appSecrets.secretCount} secrets`);
2536
2358
  const imageRef$1 = require_state.imageRef(identity, appName, registry, imageTag);
2537
2359
  logger.log(` Building Docker image: ${imageRef$1}`);
2538
- const image = await deployDocker({
2360
+ const image = await require_state.deployDocker({
2539
2361
  stage,
2540
2362
  tag: imageTag,
2541
2363
  skipPush: false,
@@ -2644,7 +2466,7 @@ async function releaseDokploy(run) {
2644
2466
  if (buildArgs.length > 0) logger.log(` Build args: ${publicUrlArgNames.join(", ")}`);
2645
2467
  const imageRef$2 = require_state.imageRef(identity, appName, registry, imageTag);
2646
2468
  logger.log(` Building Docker image: ${imageRef$2}`);
2647
- const image = await deployDocker({
2469
+ const image = await require_state.deployDocker({
2648
2470
  stage,
2649
2471
  tag: imageTag,
2650
2472
  skipPush: false,
@@ -3276,4 +3098,4 @@ Object.defineProperty(exports, "verifySettings", {
3276
3098
  }
3277
3099
  });
3278
3100
 
3279
- //# sourceMappingURL=engine-DR6KurWX.cjs.map
3101
+ //# sourceMappingURL=engine-Cx_dvx9q.cjs.map