@geekmidas/cli 10.0.0-alpha.46 → 10.0.0-alpha.48

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 (32) hide show
  1. package/bin/gkm.mjs +9 -1
  2. package/bin/owning-tsconfig-jsx-register.mjs +18 -0
  3. package/bin/owning-tsconfig-jsx.mjs +108 -0
  4. package/dist/backends-B9V2XD2M.cjs +82 -0
  5. package/dist/backends-B9V2XD2M.cjs.map +1 -0
  6. package/dist/backends-CSuLl0YP.mjs +59 -0
  7. package/dist/backends-CSuLl0YP.mjs.map +1 -0
  8. package/dist/encryption-C7OGMve_.cjs +91 -0
  9. package/dist/encryption-C7OGMve_.cjs.map +1 -0
  10. package/dist/encryption-DyQnPsZN.mjs +90 -0
  11. package/dist/encryption-DyQnPsZN.mjs.map +1 -0
  12. package/dist/index.cjs +131 -51
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.mjs +123 -43
  15. package/dist/index.mjs.map +1 -1
  16. package/dist/{migrate-Dp5HFzuQ.cjs → migrate-BgEY9pdP.cjs} +2 -2
  17. package/dist/{migrate-Dp5HFzuQ.cjs.map → migrate-BgEY9pdP.cjs.map} +1 -1
  18. package/dist/{migrate-B3opyC3o.mjs → migrate-DhxTIA0z.mjs} +2 -2
  19. package/dist/{migrate-B3opyC3o.mjs.map → migrate-DhxTIA0z.mjs.map} +1 -1
  20. package/dist/{ready-V6Ou6-B6.mjs → ready-WfT-eWlm.mjs} +2 -1
  21. package/dist/{ready-V6Ou6-B6.mjs.map → ready-WfT-eWlm.mjs.map} +1 -1
  22. package/dist/{ready-L7I68yXf.cjs → ready-lr2Fm-ep.cjs} +2 -1
  23. package/dist/{ready-L7I68yXf.cjs.map → ready-lr2Fm-ep.cjs.map} +1 -1
  24. package/dist/vitest.cjs +1 -1
  25. package/dist/vitest.mjs +1 -1
  26. package/dist/{workspace-CHEC80sp.mjs → workspace-cb6U29EL.mjs} +56 -77
  27. package/dist/workspace-cb6U29EL.mjs.map +1 -0
  28. package/dist/{workspace-D9z2ymBW.cjs → workspace-vafrzZTC.cjs} +60 -99
  29. package/dist/workspace-vafrzZTC.cjs.map +1 -0
  30. package/package.json +14 -14
  31. package/dist/workspace-CHEC80sp.mjs.map +0 -1
  32. package/dist/workspace-D9z2ymBW.cjs.map +0 -1
package/dist/index.cjs CHANGED
@@ -6,10 +6,11 @@ const require_config = require("./config-CsYSyUya.cjs");
6
6
  const require_workspace = require("./workspace-DEibcoBe.cjs");
7
7
  const require_storage = require("./storage-CSGoC3bK.cjs");
8
8
  const require_store = require("./store-DQgxT_WR.cjs");
9
- const require_workspace$1 = require("./workspace-D9z2ymBW.cjs");
9
+ const require_workspace$1 = require("./workspace-vafrzZTC.cjs");
10
10
  const require_OpenApiTsGenerator = require("./OpenApiTsGenerator-BN0PIZxd.cjs");
11
11
  const require_openapi = require("./openapi.cjs");
12
- const require_ready = require("./ready-L7I68yXf.cjs");
12
+ const require_ready = require("./ready-lr2Fm-ep.cjs");
13
+ const require_backends = require("./backends-B9V2XD2M.cjs");
13
14
  const require_emit = require("./emit-Dmc1nvdS.cjs");
14
15
  let commander = require("commander");
15
16
  let node_process = require("node:process");
@@ -28,6 +29,7 @@ let chokidar = require("chokidar");
28
29
  chokidar = require_rolldown_runtime.__toESM(chokidar, 1);
29
30
  let node_crypto = require("node:crypto");
30
31
  let node_url = require("node:url");
32
+ let _geekmidas_constructs_encryption = require("@geekmidas/constructs/encryption");
31
33
  let _geekmidas_db_pg_roles = require("@geekmidas/db/pg/roles");
32
34
  let pg = require("pg");
33
35
  let yaml = require("yaml");
@@ -46,7 +48,7 @@ let _geekmidas_constructs_queue = require("@geekmidas/constructs/queue");
46
48
  let _geekmidas_constructs_topic = require("@geekmidas/constructs/topic");
47
49
  let node_dns_promises = require("node:dns/promises");
48
50
  //#region package.json
49
- var version = "10.0.0-alpha.46";
51
+ var version = "10.0.0-alpha.48";
50
52
  //#endregion
51
53
  //#region src/auth/credentials.ts
52
54
  /**
@@ -342,6 +344,45 @@ function normalizeRoutes(routes) {
342
344
  return Array.isArray(routes) ? routes : [routes];
343
345
  }
344
346
  //#endregion
347
+ //#region src/owningTsconfigJsx.ts
348
+ const REGISTER = "owning-tsconfig-jsx-register.mjs";
349
+ /** The CLI's `bin/` was not found above the module looking for it. */
350
+ var OwningTsconfigJsxHookMissing = class extends Error {
351
+ from;
352
+ constructor(from) {
353
+ super(`Could not find bin/${REGISTER} in any directory above '${from}'. It ships with @geekmidas/cli beside bin/gkm.mjs; reinstall the package if it is missing.`);
354
+ this.from = from;
355
+ this.name = "OwningTsconfigJsxHookMissing";
356
+ }
357
+ };
358
+ /**
359
+ * The CLI's `bin/owning-tsconfig-jsx-register.mjs`, as a file URL. Searched
360
+ * upward because this module runs from `src/` in the repo and from a chunk in
361
+ * `dist/` once built, and `bin/` sits beside both.
362
+ */
363
+ function registerUrl() {
364
+ const from = (0, node_path.dirname)((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
365
+ for (let dir = from;; dir = (0, node_path.dirname)(dir)) {
366
+ const candidate = (0, node_path.join)(dir, "bin", REGISTER);
367
+ if ((0, node_fs.existsSync)(candidate)) return (0, node_url.pathToFileURL)(candidate).href;
368
+ if ((0, node_path.dirname)(dir) === dir) throw new OwningTsconfigJsxHookMissing(from);
369
+ }
370
+ }
371
+ /**
372
+ * `NODE_OPTIONS` for a process that runs app code through tsx, with the hook
373
+ * that compiles each `.tsx` with its own tsconfig's JSX settings (see
374
+ * `bin/owning-tsconfig-jsx.mjs`) put in front of every other `--import`, so it
375
+ * is registered before tsx and reads the source on tsx's behalf.
376
+ *
377
+ * `bin/gkm.mjs` already starts the CLI this way, and its children inherit it;
378
+ * this is for those that set `NODE_OPTIONS` themselves, or whose CLI was
379
+ * started with tsx already imported.
380
+ */
381
+ function withOwningTsconfigJsx(nodeOptions = "") {
382
+ if (nodeOptions.includes(REGISTER)) return nodeOptions;
383
+ return [`--import=${registerUrl()}`, nodeOptions].filter(Boolean).join(" ");
384
+ }
385
+ //#endregion
345
386
  //#region src/trust/index.ts
346
387
  /**
347
388
  * Installing the local edge's certificate authority into the OS trust store.
@@ -1184,7 +1225,7 @@ async function devCommand(options) {
1184
1225
  appRoot,
1185
1226
  target: "server",
1186
1227
  enableOpenApi,
1187
- cacheBackend: require_workspace$1.cacheBackendFor(require_workspace$1.providerOf(workspace ?? config)),
1228
+ cacheBackend: require_backends.cacheBackendFor(require_backends.providerOf(workspace ?? config)),
1188
1229
  telescope,
1189
1230
  studio,
1190
1231
  hooks,
@@ -1202,9 +1243,9 @@ async function devCommand(options) {
1202
1243
  stage: workspace.stages.local,
1203
1244
  ...options.fake ? { fake: true } : {}
1204
1245
  });
1205
- if (reconciled.changed && reconciled.plan.containers.length > 0) {
1206
- logger$9.log(`🐳 Services: ${reconciled.plan.containers.join(", ")}`);
1207
- for (const [container, address] of Object.entries(reconciled.addresses)) logger$9.log(` ${container}: ${address}`);
1246
+ if (reconciled.services.length > 0) {
1247
+ logger$9.log("🐳 Services");
1248
+ for (const line of require_workspace$1.describeServices(reconciled.services)) logger$9.log(line);
1208
1249
  }
1209
1250
  Object.assign(appSecrets, reconciled.env);
1210
1251
  const own = reconciled.plan.resources.find((r) => (r.kind === "rest-api" || r.kind === "site") && require_config.appKey(r.id) === workspaceAppName);
@@ -1485,9 +1526,9 @@ async function workspaceDevCommand(workspace, options) {
1485
1526
  stage: workspace.stages.local,
1486
1527
  ...options.fake ? { fake: true } : {}
1487
1528
  });
1488
- if (reconciled.changed && reconciled.plan.containers.length > 0) {
1489
- logger$9.log(`🐳 Services: ${reconciled.plan.containers.join(", ")}`);
1490
- for (const [container, address] of Object.entries(reconciled.addresses)) logger$9.log(` ${container}: ${address}`);
1529
+ if (reconciled.services.length > 0) {
1530
+ logger$9.log("🐳 Services");
1531
+ for (const line of require_workspace$1.describeServices(reconciled.services)) logger$9.log(line);
1491
1532
  }
1492
1533
  const secretsEnv = {
1493
1534
  ...rawSecrets,
@@ -1496,9 +1537,9 @@ async function workspaceDevCommand(workspace, options) {
1496
1537
  const fakes = options.fake ? await serveFakes(reconciled.fakes, reconciled.ports) : [];
1497
1538
  for (const { id, port } of fakes) logger$9.log(`🎭 ${id} fake: http://localhost:${port}`);
1498
1539
  if (options.migrate || options.seed) {
1499
- const { prepareDevDatabases } = await Promise.resolve().then(() => require("./migrate-Dp5HFzuQ.cjs"));
1540
+ const { prepareDevDatabases } = await Promise.resolve().then(() => require("./migrate-BgEY9pdP.cjs"));
1500
1541
  await prepareDevDatabases(workspace, reconciled.env, { seed: !!options.seed });
1501
- } else await Promise.resolve().then(() => require("./migrate-Dp5HFzuQ.cjs")).then(({ reportPendingMigrations }) => reportPendingMigrations(workspace, reconciled.env)).catch((error) => {
1542
+ } else await Promise.resolve().then(() => require("./migrate-BgEY9pdP.cjs")).then(({ reportPendingMigrations }) => reportPendingMigrations(workspace, reconciled.env)).catch((error) => {
1502
1543
  logger$9.log(`⚠️ Could not check for pending migrations: ${error instanceof Error ? error.message : String(error)}`);
1503
1544
  });
1504
1545
  const appUrls = {};
@@ -1694,7 +1735,8 @@ var EntryRunner = class {
1694
1735
  async runProcess() {
1695
1736
  const env = {
1696
1737
  ...process.env,
1697
- PORT: String(this.port)
1738
+ PORT: String(this.port),
1739
+ NODE_OPTIONS: withOwningTsconfigJsx(process.env.NODE_OPTIONS)
1698
1740
  };
1699
1741
  this.childProcess = (0, node_child_process.spawn)(...tsxCommand((0, node_path.dirname)(this.wrapperPath), [this.wrapperPath]), {
1700
1742
  stdio: "inherit",
@@ -1944,7 +1986,8 @@ var DevServer = class {
1944
1986
  env: {
1945
1987
  ...process.env,
1946
1988
  NODE_ENV: "development",
1947
- GKM_DEV_PID: String(process.pid)
1989
+ GKM_DEV_PID: String(process.pid),
1990
+ NODE_OPTIONS: withOwningTsconfigJsx(process.env.NODE_OPTIONS)
1948
1991
  },
1949
1992
  detached: true
1950
1993
  });
@@ -2633,7 +2676,7 @@ async function buildCommand(options) {
2633
2676
  }
2634
2677
  }
2635
2678
  const config = loadedConfig.type !== "workspace" ? await require_config.loadConfig() : (0, node_path.resolve)(process.cwd()) === (0, node_path.resolve)(loadedConfig.workspace.root) ? rootGkmConfig(loadedConfig.workspace) : (await require_config.loadAppConfig()).gkmConfig;
2636
- const target = options.provider ?? require_workspace$1.providerOf(loadedConfig.workspace);
2679
+ const target = options.provider ?? require_backends.providerOf(loadedConfig.workspace);
2637
2680
  const workspaceRoot = loadedConfig.workspace.root;
2638
2681
  const appRoot = process.cwd();
2639
2682
  const output = await buildOneApp({
@@ -2665,14 +2708,14 @@ async function declaredIn(config, cwd) {
2665
2708
  */
2666
2709
  function backendsOf(workspace) {
2667
2710
  return {
2668
- cache: require_workspace$1.cacheBackendFor(require_workspace$1.providerOf(workspace)),
2711
+ cache: require_backends.cacheBackendFor(require_backends.providerOf(workspace)),
2669
2712
  email: "ses"
2670
2713
  };
2671
2714
  }
2672
2715
  /** One app's build, from its config and the command's options. */
2673
2716
  async function buildOneApp(input) {
2674
2717
  const { config, options, workspace, appRoot, target } = input;
2675
- const cacheBackend = require_workspace$1.cacheBackendFor(require_workspace$1.providerOf(workspace));
2718
+ const cacheBackend = require_backends.cacheBackendFor(require_backends.providerOf(workspace));
2676
2719
  const production = normalizeProductionConfig(options.production ?? false);
2677
2720
  if (production) logger$8.log(`🏭 Building for PRODUCTION`);
2678
2721
  logger$8.log(`Building for ${target}`);
@@ -2975,7 +3018,7 @@ async function workspaceBuildCommand(workspace, options) {
2975
3018
  const buildOrder = require_workspace.getAppBuildOrder(workspace);
2976
3019
  logger$8.log(` Build order: ${buildOrder.join(" → ")}`);
2977
3020
  try {
2978
- const target = options.provider ?? require_workspace$1.providerOf(workspace);
3021
+ const target = options.provider ?? require_backends.providerOf(workspace);
2979
3022
  const builds = [];
2980
3023
  for (const appName of buildOrder) {
2981
3024
  const app = workspace.apps[appName];
@@ -3376,6 +3419,19 @@ const PROVISIONERS = {
3376
3419
  return { provides: { [key]: supplied(declaration.id, key, context) } };
3377
3420
  },
3378
3421
  /**
3422
+ * The keyring the stage keeps in its secrets.
3423
+ *
3424
+ * Generated on the first deploy (`withGeneratedSecrets`) and rotated only
3425
+ * by `gkm encryption:rotate`, so a redeploy never changes a key and nothing
3426
+ * written becomes unreadable. Nothing is created in Dokploy: the process
3427
+ * holds the keyring.
3428
+ */
3429
+ encryption: async (declaration, context) => {
3430
+ if (declaration.kind !== "encryption") throw new WrongKind(declaration.kind);
3431
+ const key = (0, _geekmidas_manifest.provideKey)(declaration.id, "url");
3432
+ return { provides: { [key]: supplied(declaration.id, key, context) } };
3433
+ },
3434
+ /**
3379
3435
  * A third party's credentials, as the stage was given them.
3380
3436
  *
3381
3437
  * Nothing is created and nothing derived: the value was issued by somebody
@@ -3745,9 +3801,9 @@ async function provisionDeclared(options) {
3745
3801
  environmentId: options.environmentId,
3746
3802
  stage: options.stage,
3747
3803
  project: workspace.name,
3748
- cache: require_workspace$1.cacheBackendFor(require_workspace$1.providerOf(workspace)),
3749
- events: require_workspace$1.eventsBackendFor(require_workspace$1.providerOf(workspace)),
3750
- storage: require_workspace$1.storageBackendFor(require_workspace$1.providerOf(workspace)),
3804
+ cache: require_backends.cacheBackendFor(require_backends.providerOf(workspace)),
3805
+ events: require_backends.eventsBackendFor(require_backends.providerOf(workspace)),
3806
+ storage: require_backends.storageBackendFor(require_backends.providerOf(workspace)),
3751
3807
  addresses: surfaceAddresses(workspace, manifest, options.appUrls),
3752
3808
  seed: options.seed,
3753
3809
  ...options.supplied ? { supplied: options.supplied } : {},
@@ -6385,6 +6441,8 @@ function validateEnvVars(requiredVars, context) {
6385
6441
  * who could read the repo.
6386
6442
  * - **Each `secret` construct's value** — an auth server's signing secret —
6387
6443
  * random, rather than derived.
6444
+ * - **Each `encryption` construct's keyring** — one random key and an index
6445
+ * key. Later keys are added by `gkm encryption:rotate`, never by a deploy.
6388
6446
  *
6389
6447
  * Both are generated on the first deploy that needs them and written to the
6390
6448
  * stage's store, so every later deploy reads the same values: sessions survive
@@ -6400,10 +6458,10 @@ function withGeneratedSecrets(secrets, manifest) {
6400
6458
  const generated = [];
6401
6459
  const custom = { ...secrets.custom };
6402
6460
  for (const declaration of Object.values(manifest)) {
6403
- if (declaration?.kind !== "secret") continue;
6461
+ if (declaration?.kind !== "secret" && declaration?.kind !== "encryption") continue;
6404
6462
  const key = declaration.provides?.[0];
6405
6463
  if (!key || custom[key]) continue;
6406
- custom[key] = random();
6464
+ custom[key] = declaration.kind === "encryption" ? (0, _geekmidas_constructs_encryption.generateKeyring)() : random();
6407
6465
  generated.push(key);
6408
6466
  }
6409
6467
  const seed = secrets.seed ?? random();
@@ -6761,7 +6819,7 @@ async function sniffEntryFile(entryPath, appPath, workspacePath) {
6761
6819
  ],
6762
6820
  env: {
6763
6821
  ...process.env,
6764
- NODE_OPTIONS: "--import=tsx"
6822
+ NODE_OPTIONS: withOwningTsconfigJsx("--import=tsx")
6765
6823
  }
6766
6824
  });
6767
6825
  let stdout = "";
@@ -9077,26 +9135,26 @@ function loadPackageJson() {
9077
9135
  * Run: pnpm --filter @geekmidas/cli sync-versions
9078
9136
  */
9079
9137
  const GEEKMIDAS_VERSIONS = {
9080
- "@geekmidas/audit": "~10.0.0-alpha.46",
9081
- "@geekmidas/auth": "~10.0.0-alpha.46",
9082
- "@geekmidas/cache": "~10.0.0-alpha.46",
9083
- "@geekmidas/client": "~10.0.0-alpha.46",
9084
- "@geekmidas/cloud": "~10.0.0-alpha.46",
9085
- "@geekmidas/constructs": "~10.0.0-alpha.46",
9086
- "@geekmidas/db": "~10.0.0-alpha.46",
9087
- "@geekmidas/emailkit": "~10.0.0-alpha.46",
9088
- "@geekmidas/envkit": "~10.0.0-alpha.46",
9089
- "@geekmidas/errors": "~10.0.0-alpha.46",
9090
- "@geekmidas/events": "~10.0.0-alpha.46",
9091
- "@geekmidas/logger": "~10.0.0-alpha.46",
9092
- "@geekmidas/manifest": "~10.0.0-alpha.46",
9093
- "@geekmidas/rate-limit": "~10.0.0-alpha.46",
9094
- "@geekmidas/schema": "~10.0.0-alpha.46",
9095
- "@geekmidas/services": "~10.0.0-alpha.46",
9096
- "@geekmidas/storage": "~10.0.0-alpha.46",
9097
- "@geekmidas/studio": "~10.0.0-alpha.46",
9098
- "@geekmidas/telescope": "~10.0.0-alpha.46",
9099
- "@geekmidas/testkit": "~10.0.0-alpha.46",
9138
+ "@geekmidas/audit": "~10.0.0-alpha.48",
9139
+ "@geekmidas/auth": "~10.0.0-alpha.48",
9140
+ "@geekmidas/cache": "~10.0.0-alpha.48",
9141
+ "@geekmidas/client": "~10.0.0-alpha.48",
9142
+ "@geekmidas/cloud": "~10.0.0-alpha.48",
9143
+ "@geekmidas/constructs": "~10.0.0-alpha.48",
9144
+ "@geekmidas/db": "~10.0.0-alpha.48",
9145
+ "@geekmidas/emailkit": "~10.0.0-alpha.48",
9146
+ "@geekmidas/envkit": "~10.0.0-alpha.48",
9147
+ "@geekmidas/errors": "~10.0.0-alpha.48",
9148
+ "@geekmidas/events": "~10.0.0-alpha.48",
9149
+ "@geekmidas/logger": "~10.0.0-alpha.48",
9150
+ "@geekmidas/manifest": "~10.0.0-alpha.48",
9151
+ "@geekmidas/rate-limit": "~10.0.0-alpha.48",
9152
+ "@geekmidas/schema": "~10.0.0-alpha.48",
9153
+ "@geekmidas/services": "~10.0.0-alpha.48",
9154
+ "@geekmidas/storage": "~10.0.0-alpha.48",
9155
+ "@geekmidas/studio": "~10.0.0-alpha.48",
9156
+ "@geekmidas/telescope": "~10.0.0-alpha.48",
9157
+ "@geekmidas/testkit": "~10.0.0-alpha.48",
9100
9158
  "@geekmidas/cli": `~${loadPackageJson().version}`
9101
9159
  };
9102
9160
  //#endregion
@@ -15505,8 +15563,8 @@ async function reconcileLocal(workspace, stage, options) {
15505
15563
  logger$1.log("🐳 Services already up to date");
15506
15564
  return;
15507
15565
  }
15508
- logger$1.log(`🐳 Services: ${result.plan.containers.join(", ")}`);
15509
- for (const [container, address] of Object.entries(result.addresses)) logger$1.log(` ${container}: ${address}`);
15566
+ logger$1.log("🐳 Services");
15567
+ for (const line of require_workspace$1.describeServices(result.services)) logger$1.log(line);
15510
15568
  const url = result.plan.resources.filter((r) => r.kind === "rest-api" || r.kind === "site" || r.kind === "file-server").map((r) => result.env[r.envKey]).find((address) => address?.startsWith("https://"));
15511
15569
  if (url) await ensureTrusted(workspace.root, url, { ...options.yes ? { assumeYes: true } : {} });
15512
15570
  }
@@ -15853,7 +15911,7 @@ function testDatabases(reconciled) {
15853
15911
  * starts without the reference data the app needs.
15854
15912
  */
15855
15913
  async function migrateTestStage(workspace, env) {
15856
- const { migrateAndSeed } = await Promise.resolve().then(() => require("./migrate-Dp5HFzuQ.cjs"));
15914
+ const { migrateAndSeed } = await Promise.resolve().then(() => require("./migrate-BgEY9pdP.cjs"));
15857
15915
  const { discover } = await Promise.resolve().then(() => require("./discover-DXNviAh-.cjs")).then((n) => n.discover_exports);
15858
15916
  const sources = {};
15859
15917
  const manifest = await discover({
@@ -16284,7 +16342,7 @@ program.command("migrate").description("Apply each database construct's migratio
16284
16342
  try {
16285
16343
  const globalOptions = program.opts();
16286
16344
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
16287
- const { migrateCommand } = await Promise.resolve().then(() => require("./migrate-Dp5HFzuQ.cjs"));
16345
+ const { migrateCommand } = await Promise.resolve().then(() => require("./migrate-BgEY9pdP.cjs"));
16288
16346
  await migrateCommand({
16289
16347
  ...options,
16290
16348
  ...construct ? { construct } : {}
@@ -16298,7 +16356,7 @@ program.command("seed").description("Migrate, then run each database construct's
16298
16356
  try {
16299
16357
  const globalOptions = program.opts();
16300
16358
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
16301
- const { seedCommand } = await Promise.resolve().then(() => require("./migrate-Dp5HFzuQ.cjs"));
16359
+ const { seedCommand } = await Promise.resolve().then(() => require("./migrate-BgEY9pdP.cjs"));
16302
16360
  await seedCommand({
16303
16361
  ...options,
16304
16362
  ...construct ? { construct } : {}
@@ -16312,7 +16370,7 @@ program.command("migration").description("Write a construct's next migration: an
16312
16370
  try {
16313
16371
  const globalOptions = program.opts();
16314
16372
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
16315
- const { migrationCommand } = await Promise.resolve().then(() => require("./migrate-Dp5HFzuQ.cjs"));
16373
+ const { migrationCommand } = await Promise.resolve().then(() => require("./migrate-BgEY9pdP.cjs"));
16316
16374
  await migrationCommand({
16317
16375
  construct,
16318
16376
  ...name ? { name } : {}
@@ -16406,6 +16464,28 @@ program.command("secrets:set").description("Set a custom secret for a stage").ar
16406
16464
  process.exit(1);
16407
16465
  }
16408
16466
  });
16467
+ program.command("encryption:rotate").description("Add a new current key to an Encryption construct's keyring on a server stage").argument("<construct>", "The Encryption construct (e.g. Pii)").requiredOption("--stage <stage>", "A deployed stage").action(async (construct, options) => {
16468
+ try {
16469
+ const globalOptions = program.opts();
16470
+ if (globalOptions.cwd) process.chdir(globalOptions.cwd);
16471
+ const { encryptionRotateCommand } = await Promise.resolve().then(() => require("./encryption-C7OGMve_.cjs"));
16472
+ await encryptionRotateCommand(construct, options);
16473
+ } catch (error) {
16474
+ console.error(formatError(error));
16475
+ process.exit(1);
16476
+ }
16477
+ });
16478
+ program.command("encryption:retire").description("Remove an old key from an Encryption construct's keyring, once nothing is under it").argument("<construct>", "The Encryption construct (e.g. Pii)").argument("<key>", "The key to retire (e.g. k1)").requiredOption("--stage <stage>", "A deployed stage").action(async (construct, key, options) => {
16479
+ try {
16480
+ const globalOptions = program.opts();
16481
+ if (globalOptions.cwd) process.chdir(globalOptions.cwd);
16482
+ const { encryptionRetireCommand } = await Promise.resolve().then(() => require("./encryption-C7OGMve_.cjs"));
16483
+ await encryptionRetireCommand(construct, key, options);
16484
+ } catch (error) {
16485
+ console.error(formatError(error));
16486
+ process.exit(1);
16487
+ }
16488
+ });
16409
16489
  program.command("secrets:show").description("Show secrets for a stage").requiredOption("--stage <stage>", "Stage name").option("--reveal", "Show actual secret values (not masked)").action(async (options) => {
16410
16490
  try {
16411
16491
  const globalOptions = program.opts();
@@ -16451,7 +16531,7 @@ program.command("secrets:reconcile").description("Backfill missing custom secret
16451
16531
  console.error(`No secrets found for stage "${stage}". Run "gkm secrets:init --stage ${stage}" first.`);
16452
16532
  process.exit(1);
16453
16533
  }
16454
- const { derivedContainers } = await Promise.resolve().then(() => require("./workspace-D9z2ymBW.cjs")).then((n) => n.workspace_exports);
16534
+ const { derivedContainers } = await Promise.resolve().then(() => require("./workspace-vafrzZTC.cjs")).then((n) => n.workspace_exports);
16455
16535
  const result = reconcileMissingSecrets(secrets, workspace, await derivedContainers(workspace, stage));
16456
16536
  if (!result) {
16457
16537
  console.log(`\n✓ Secrets for stage "${stage}" are up-to-date`);