@geekmidas/cli 10.0.0-alpha.16 → 10.0.0-alpha.17

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 (89) hide show
  1. package/dist/{bundler-BeNDZdHQ.cjs → bundler-mjqGAvu1.cjs} +2 -2
  2. package/dist/{bundler-BeNDZdHQ.cjs.map → bundler-mjqGAvu1.cjs.map} +1 -1
  3. package/dist/{bundler-BodTL4kf.mjs → bundler-mwH7WOb1.mjs} +2 -2
  4. package/dist/{bundler-BodTL4kf.mjs.map → bundler-mwH7WOb1.mjs.map} +1 -1
  5. package/dist/{config-Q1rvKHvw.cjs → config-CdTMeMU_.cjs} +2 -2
  6. package/dist/{config-Q1rvKHvw.cjs.map → config-CdTMeMU_.cjs.map} +1 -1
  7. package/dist/{config-pqGD3hF9.mjs → config-DPnPkWyH.mjs} +2 -2
  8. package/dist/{config-pqGD3hF9.mjs.map → config-DPnPkWyH.mjs.map} +1 -1
  9. package/dist/config.cjs +2 -2
  10. package/dist/config.d.cts +2 -2
  11. package/dist/config.d.mts +2 -2
  12. package/dist/config.mjs +2 -2
  13. package/dist/{credentials-BekkKtY_.mjs → credentials-fJP5-fa1.mjs} +4 -4
  14. package/dist/{credentials-BekkKtY_.mjs.map → credentials-fJP5-fa1.mjs.map} +1 -1
  15. package/dist/{credentials-Q6F0uqJq.cjs → credentials-tvyReUAd.cjs} +4 -4
  16. package/dist/{credentials-Q6F0uqJq.cjs.map → credentials-tvyReUAd.cjs.map} +1 -1
  17. package/dist/discover-BERGFg8v.cjs.map +1 -1
  18. package/dist/discover-CK-n3w6b.mjs.map +1 -1
  19. package/dist/{github-CRwnxKmD.mjs → github-CAfKyYPN.mjs} +21 -8
  20. package/dist/github-CAfKyYPN.mjs.map +1 -0
  21. package/dist/{github-BfflNPVe.cjs → github-DVE8Gg_F.cjs} +22 -9
  22. package/dist/github-DVE8Gg_F.cjs.map +1 -0
  23. package/dist/{index-C-VLwB_Y.d.mts → index-B4H4XF7A.d.mts} +2 -2
  24. package/dist/{index-C-HkOEBt.d.cts.map → index-B4H4XF7A.d.mts.map} +1 -1
  25. package/dist/{index-C-HkOEBt.d.cts → index-RCUizGxL.d.cts} +2 -2
  26. package/dist/{index-C-VLwB_Y.d.mts.map → index-RCUizGxL.d.cts.map} +1 -1
  27. package/dist/index.cjs +161 -168
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.mjs +156 -163
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/{openapi-Dcbme-Us.cjs → openapi-BeckoaP9.cjs} +2 -2
  32. package/dist/{openapi-Dcbme-Us.cjs.map → openapi-BeckoaP9.cjs.map} +1 -1
  33. package/dist/{openapi-vy4JzhUv.mjs → openapi-DolhBm6r.mjs} +2 -2
  34. package/dist/{openapi-vy4JzhUv.mjs.map → openapi-DolhBm6r.mjs.map} +1 -1
  35. package/dist/openapi.cjs +1 -1
  36. package/dist/openapi.d.cts +1 -1
  37. package/dist/openapi.d.mts +1 -1
  38. package/dist/openapi.mjs +1 -1
  39. package/dist/reconcile/public.d.cts +1 -1
  40. package/dist/reconcile/public.d.mts +1 -1
  41. package/dist/{fullstack-secrets-DXsWO-5m.cjs → reconcile-Cq4cO83R.cjs} +45 -1
  42. package/dist/reconcile-Cq4cO83R.cjs.map +1 -0
  43. package/dist/{fullstack-secrets-BET8gqwK.mjs → reconcile-fmoluZmZ.mjs} +34 -2
  44. package/dist/reconcile-fmoluZmZ.mjs.map +1 -0
  45. package/dist/ssm-BKN1Cg4z.mjs +60 -0
  46. package/dist/ssm-BKN1Cg4z.mjs.map +1 -0
  47. package/dist/ssm-FxeSAt35.cjs +60 -0
  48. package/dist/ssm-FxeSAt35.cjs.map +1 -0
  49. package/dist/{storage-C-30BD1e.cjs → storage-DgypfSD6.cjs} +83 -4
  50. package/dist/storage-DgypfSD6.cjs.map +1 -0
  51. package/dist/{storage-P_b3w7uj.mjs → storage-TP0x118M.mjs} +77 -4
  52. package/dist/storage-TP0x118M.mjs.map +1 -0
  53. package/dist/transfer-4A4S2hcw.mjs +122 -0
  54. package/dist/transfer-4A4S2hcw.mjs.map +1 -0
  55. package/dist/transfer-DdmtKLzi.cjs +151 -0
  56. package/dist/transfer-DdmtKLzi.cjs.map +1 -0
  57. package/dist/{types-RhXmHR-e.d.cts → types-7R81hu0i.d.mts} +138 -1
  58. package/dist/types-7R81hu0i.d.mts.map +1 -0
  59. package/dist/{types-kvBQjpPo.d.mts → types-N7c2O2m7.d.cts} +140 -1
  60. package/dist/types-N7c2O2m7.d.cts.map +1 -0
  61. package/dist/workspace/index.cjs +1 -1
  62. package/dist/workspace/index.d.cts +2 -2
  63. package/dist/workspace/index.d.mts +2 -2
  64. package/dist/workspace/index.mjs +1 -1
  65. package/dist/{workspace-mFpI_ky_.cjs → workspace-B8NLb54N.cjs} +13 -2
  66. package/dist/{workspace-mFpI_ky_.cjs.map → workspace-B8NLb54N.cjs.map} +1 -1
  67. package/dist/{workspace-CgwmXEtc.mjs → workspace-DI-M3BnN.mjs} +13 -2
  68. package/dist/{workspace-CgwmXEtc.mjs.map → workspace-DI-M3BnN.mjs.map} +1 -1
  69. package/package.json +11 -11
  70. package/dist/fullstack-secrets-BET8gqwK.mjs.map +0 -1
  71. package/dist/fullstack-secrets-DXsWO-5m.cjs.map +0 -1
  72. package/dist/github-BfflNPVe.cjs.map +0 -1
  73. package/dist/github-CRwnxKmD.mjs.map +0 -1
  74. package/dist/keystore-B4PRlbgE.mjs +0 -81
  75. package/dist/keystore-B4PRlbgE.mjs.map +0 -1
  76. package/dist/keystore-DgGRj2Yy.cjs +0 -98
  77. package/dist/keystore-DgGRj2Yy.cjs.map +0 -1
  78. package/dist/reconcile-Dd2iyILf.cjs +0 -34
  79. package/dist/reconcile-Dd2iyILf.cjs.map +0 -1
  80. package/dist/reconcile-DhQ00DpU.mjs +0 -34
  81. package/dist/reconcile-DhQ00DpU.mjs.map +0 -1
  82. package/dist/storage-C-30BD1e.cjs.map +0 -1
  83. package/dist/storage-P_b3w7uj.mjs.map +0 -1
  84. package/dist/sync-B3xxXtJT.mjs +0 -88
  85. package/dist/sync-B3xxXtJT.mjs.map +0 -1
  86. package/dist/sync-D7uTIIEi.cjs +0 -111
  87. package/dist/sync-D7uTIIEi.cjs.map +0 -1
  88. package/dist/types-RhXmHR-e.d.cts.map +0 -1
  89. package/dist/types-kvBQjpPo.d.mts.map +0 -1
package/dist/index.cjs CHANGED
@@ -2,16 +2,15 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
4
4
  const require_discover = require("./discover-BERGFg8v.cjs");
5
- const require_config = require("./config-Q1rvKHvw.cjs");
6
- const require_workspace = require("./workspace-mFpI_ky_.cjs");
7
- const require_credentials = require("./credentials-Q6F0uqJq.cjs");
5
+ const require_config = require("./config-CdTMeMU_.cjs");
6
+ const require_workspace = require("./workspace-B8NLb54N.cjs");
7
+ const require_credentials = require("./credentials-tvyReUAd.cjs");
8
8
  const require_generator = require("./generator-Wdfp0jCS.cjs");
9
- const require_keystore = require("./keystore-DgGRj2Yy.cjs");
10
- const require_storage = require("./storage-C-30BD1e.cjs");
11
- const require_openapi = require("./openapi-Dcbme-Us.cjs");
9
+ const require_storage = require("./storage-DgypfSD6.cjs");
10
+ const require_openapi = require("./openapi-BeckoaP9.cjs");
12
11
  const require_emit = require("./emit-BdoPFjZf.cjs");
13
- const require_fullstack_secrets = require("./fullstack-secrets-DXsWO-5m.cjs");
14
- const require_sync = require("./sync-D7uTIIEi.cjs");
12
+ const require_reconcile = require("./reconcile-Cq4cO83R.cjs");
13
+ const require_transfer = require("./transfer-DdmtKLzi.cjs");
15
14
  let commander = require("commander");
16
15
  let node_process = require("node:process");
17
16
  let node_readline_promises = require("node:readline/promises");
@@ -43,7 +42,7 @@ let node_module = require("node:module");
43
42
  let prompts = require("prompts");
44
43
  prompts = require_rolldown_runtime.__toESM(prompts, 1);
45
44
  //#region package.json
46
- var version = "10.0.0-alpha.16";
45
+ var version = "10.0.0-alpha.17";
47
46
  //#endregion
48
47
  //#region src/auth/credentials.ts
49
48
  /**
@@ -2614,7 +2613,7 @@ async function buildForProvider(provider, context, rootOutputDir, endpointGenera
2614
2613
  let masterKey;
2615
2614
  if (context.production?.bundle && !skipBundle) {
2616
2615
  logger$9.log(`\n📦 Bundling production server...`);
2617
- const { bundleServer } = await Promise.resolve().then(() => require("./bundler-BeNDZdHQ.cjs"));
2616
+ const { bundleServer } = await Promise.resolve().then(() => require("./bundler-mjqGAvu1.cjs"));
2618
2617
  const allConstructs = [
2619
2618
  ...endpoints.map((e) => e.construct),
2620
2619
  ...functions.map((f) => f.construct),
@@ -8312,7 +8311,6 @@ const DEPENDENCY_VERSIONS = {
8312
8311
  clsx: "~2.1.1",
8313
8312
  "lucide-react": "~1.48.0",
8314
8313
  "tailwind-merge": "~3.7.0",
8315
- "vite-tsconfig-paths": "~5.1.4",
8316
8314
  "@biomejs/biome": "~2.5.14",
8317
8315
  "@faker-js/faker": "~10.6.0",
8318
8316
  turbo: "~2.11.4",
@@ -8323,26 +8321,21 @@ const DEPENDENCY_VERSIONS = {
8323
8321
  "@types/aws-lambda": "~8.10.163"
8324
8322
  };
8325
8323
  /**
8326
- * The build and test toolchain, at the versions it was already on.
8327
- *
8328
- * Held here so it moves in one place, but not moved yet: it changes how every
8329
- * scaffold compiles and runs, and tranche 2 (#40) moves it together with the
8330
- * repository's own toolchain.
8324
+ * The build and test toolchain, at the versions the repository itself builds
8325
+ * and tests with (scripts/dependency-versions.json), so a scaffold compiles
8326
+ * with the compiler its own `@geekmidas` packages were checked against.
8331
8327
  */
8332
8328
  const TOOLCHAIN_VERSIONS = {
8333
- typescript: "~5.8.2",
8334
- tsx: "~4.20.0",
8335
- esbuild: "~0.27.0",
8336
- vitest: "~4.0.0",
8337
- vite: "^7.0.0",
8338
- "@vitejs/plugin-react": "^4.3.4",
8339
- storybook: "^8.4.7",
8340
- "@storybook/addon-a11y": "^8.4.7",
8341
- "@storybook/addon-essentials": "^8.4.7",
8342
- "@storybook/addon-interactions": "^8.4.7",
8343
- "@storybook/react": "^8.4.7",
8344
- "@storybook/react-vite": "^8.4.7",
8345
- "vite@storybook": "^6.0.0"
8329
+ typescript: "~7.0.2",
8330
+ tsx: "~4.23.15",
8331
+ esbuild: "~0.28.2",
8332
+ vitest: "~5.0.2",
8333
+ vite: "~8.3.1",
8334
+ "@vitejs/plugin-react": "^6.1.1",
8335
+ storybook: "^10.6.0",
8336
+ "@storybook/addon-docs": "^10.6.0",
8337
+ "@storybook/addon-a11y": "^10.6.0",
8338
+ "@storybook/react-vite": "^10.6.0"
8346
8339
  };
8347
8340
  /**
8348
8341
  * The Expo app's packages, which track an Expo SDK release (55) rather than
@@ -8372,6 +8365,15 @@ const EXPO_VERSIONS = {
8372
8365
  nativewind: "~4.2.0",
8373
8366
  tailwindcss: "~3.4.0"
8374
8367
  };
8368
+ /**
8369
+ * The pnpm a pnpm scaffold runs under, through \`packageManager\`.
8370
+ *
8371
+ * Pinned in every layout. Without it Corepack takes the newest pnpm, and 11
8372
+ * fails the first install on dependencies with build scripts (esbuild) until
8373
+ * they are approved — a single-app scaffold that did not pin it could not
8374
+ * install at all.
8375
+ */
8376
+ const PNPM_VERSION = "pnpm@10.13.1";
8375
8377
  /** The Biome config schema matching the Biome the scaffold installs. */
8376
8378
  const BIOME_SCHEMA = `https://biomejs.dev/schemas/${DEPENDENCY_VERSIONS["@biomejs/biome"].replace(/^[~^]/, "")}/schema.json`;
8377
8379
  //#endregion
@@ -8391,26 +8393,26 @@ function loadPackageJson() {
8391
8393
  * Run: pnpm --filter @geekmidas/cli sync-versions
8392
8394
  */
8393
8395
  const GEEKMIDAS_VERSIONS = {
8394
- "@geekmidas/audit": "~10.0.0-alpha.16",
8395
- "@geekmidas/auth": "~10.0.0-alpha.16",
8396
- "@geekmidas/cache": "~10.0.0-alpha.16",
8397
- "@geekmidas/client": "~10.0.0-alpha.16",
8398
- "@geekmidas/cloud": "~10.0.0-alpha.16",
8399
- "@geekmidas/constructs": "~10.0.0-alpha.16",
8400
- "@geekmidas/db": "~10.0.0-alpha.16",
8401
- "@geekmidas/emailkit": "~10.0.0-alpha.16",
8402
- "@geekmidas/envkit": "~10.0.0-alpha.16",
8403
- "@geekmidas/errors": "~10.0.0-alpha.16",
8404
- "@geekmidas/events": "~10.0.0-alpha.16",
8405
- "@geekmidas/logger": "~10.0.0-alpha.16",
8406
- "@geekmidas/manifest": "~10.0.0-alpha.16",
8407
- "@geekmidas/rate-limit": "~10.0.0-alpha.16",
8408
- "@geekmidas/schema": "~10.0.0-alpha.16",
8409
- "@geekmidas/services": "~10.0.0-alpha.16",
8410
- "@geekmidas/storage": "~10.0.0-alpha.16",
8411
- "@geekmidas/studio": "~10.0.0-alpha.16",
8412
- "@geekmidas/telescope": "~10.0.0-alpha.16",
8413
- "@geekmidas/testkit": "~10.0.0-alpha.16",
8396
+ "@geekmidas/audit": "~10.0.0-alpha.17",
8397
+ "@geekmidas/auth": "~10.0.0-alpha.17",
8398
+ "@geekmidas/cache": "~10.0.0-alpha.17",
8399
+ "@geekmidas/client": "~10.0.0-alpha.17",
8400
+ "@geekmidas/cloud": "~10.0.0-alpha.17",
8401
+ "@geekmidas/constructs": "~10.0.0-alpha.17",
8402
+ "@geekmidas/db": "~10.0.0-alpha.17",
8403
+ "@geekmidas/emailkit": "~10.0.0-alpha.17",
8404
+ "@geekmidas/envkit": "~10.0.0-alpha.17",
8405
+ "@geekmidas/errors": "~10.0.0-alpha.17",
8406
+ "@geekmidas/events": "~10.0.0-alpha.17",
8407
+ "@geekmidas/logger": "~10.0.0-alpha.17",
8408
+ "@geekmidas/manifest": "~10.0.0-alpha.17",
8409
+ "@geekmidas/rate-limit": "~10.0.0-alpha.17",
8410
+ "@geekmidas/schema": "~10.0.0-alpha.17",
8411
+ "@geekmidas/services": "~10.0.0-alpha.17",
8412
+ "@geekmidas/storage": "~10.0.0-alpha.17",
8413
+ "@geekmidas/studio": "~10.0.0-alpha.17",
8414
+ "@geekmidas/telescope": "~10.0.0-alpha.17",
8415
+ "@geekmidas/testkit": "~10.0.0-alpha.17",
8414
8416
  "@geekmidas/cli": `~${loadPackageJson().version}`
8415
8417
  };
8416
8418
  //#endregion
@@ -8458,7 +8460,6 @@ function generateAuthAppFiles(options) {
8458
8460
  compilerOptions: {
8459
8461
  noEmit: true,
8460
8462
  allowImportingTsExtensions: true,
8461
- baseUrl: ".",
8462
8463
  paths: {
8463
8464
  "~/*": ["./src/*"],
8464
8465
  [`@${options.name}/*`]: ["../../packages/*/src"]
@@ -8514,10 +8515,10 @@ function stageEnv(stages) {
8514
8515
  * Vitest config content with globalSetup for database-enabled apps
8515
8516
  */
8516
8517
  const vitestConfigContent = `import { defineConfig } from 'vitest/config';
8517
- import tsconfigPaths from 'vite-tsconfig-paths';
8518
8518
 
8519
8519
  export default defineConfig({
8520
- plugins: [tsconfigPaths()],
8520
+ // Vite resolves tsconfig \`paths\` itself; no plugin needed.
8521
+ resolve: { tsconfigPaths: true },
8521
8522
  test: {
8522
8523
  environment: 'node',
8523
8524
  globalSetup: './test/globalSetup.ts',
@@ -8583,7 +8584,6 @@ export default defineConfig({${stagesBlock(options.stages)}${options.monorepo ?
8583
8584
  resolveJsonModule: true,
8584
8585
  noEmit: true,
8585
8586
  allowImportingTsExtensions: true,
8586
- baseUrl: ".",
8587
8587
  paths: { "~/*": ["./src/*"] }
8588
8588
  },
8589
8589
  include: ["src/**/*.ts"],
@@ -8707,7 +8707,6 @@ function workspaceApiTsConfig(name) {
8707
8707
  compilerOptions: {
8708
8708
  noEmit: true,
8709
8709
  allowImportingTsExtensions: true,
8710
- baseUrl: ".",
8711
8710
  paths: {
8712
8711
  "~/*": ["./src/*"],
8713
8712
  [`@${name}/constructs/*`]: ["../../constructs/*"],
@@ -8979,6 +8978,32 @@ function deploy(options) {
8979
8978
  role-to-assume: \${{ vars.AWS_ROLE_ARN }}
8980
8979
  aws-region: ${options.region}
8981
8980
  ` : "";
8981
+ const stageSecrets = sst ? `${credentials}
8982
+ # The stage's secrets, from SSM in the account the role belongs to —
8983
+ # pushed there once with \`gkm secrets:push --stage <stage> --profile …\`.
8984
+ # The stage reaches the shell as a variable, never pasted into the script:
8985
+ # on a manual run it is whatever was typed.
8986
+ - name: Stage secrets
8987
+ run: ${pm.exec} gkm secrets:pull --stage "$STAGE"
8988
+ env:
8989
+ STAGE: \${{ matrix.stage }}
8990
+ ` : `
8991
+ # The stage's secrets are kept in the encrypted .gkm/secrets/<stage>.json,
8992
+ # and each environment holds its key as GKM_SECRETS_KEY. .gkm/ is
8993
+ # gitignored, so a checkout has the key but not the file: set
8994
+ # secrets.store in gkm.config.ts to a store CI can reach before deploying
8995
+ # from here.
8996
+ # Owner-only, as the CLI writes its own keys. The stage reaches the shell
8997
+ # as a variable, never pasted into the script: on a manual run it is
8998
+ # whatever was typed.
8999
+ - name: Stage secrets key
9000
+ run: |
9001
+ mkdir -p -m 700 ~/.gkm/${options.name}
9002
+ (umask 077 && printf '%s' "$KEY" > ~/.gkm/${options.name}/"$STAGE".key)
9003
+ env:
9004
+ KEY: \${{ secrets.GKM_SECRETS_KEY }}
9005
+ STAGE: \${{ matrix.stage }}
9006
+ `;
8982
9007
  const deployEnv = sst ? "" : `
8983
9008
  DOKPLOY_API_TOKEN: \${{ secrets.DOKPLOY_API_TOKEN }}
8984
9009
  DOKPLOY_ENDPOINT: \${{ vars.DOKPLOY_ENDPOINT }}`;
@@ -9060,20 +9085,7 @@ ${pm.setup}
9060
9085
  ${pm.setup}
9061
9086
  - name: Install
9062
9087
  run: ${pm.install}
9063
-
9064
- # The stage's secrets are committed encrypted; the key never is. Each
9065
- # environment holds its own as GKM_SECRETS_KEY.
9066
- # Owner-only, as the CLI writes its own keys. The stage reaches the shell
9067
- # as a variable, never pasted into the script: on a manual run it is
9068
- # whatever was typed.
9069
- - name: Stage secrets key
9070
- run: |
9071
- mkdir -p -m 700 ~/.gkm/${options.name}
9072
- (umask 077 && printf '%s' "$KEY" > ~/.gkm/${options.name}/"$STAGE".key)
9073
- env:
9074
- KEY: \${{ secrets.GKM_SECRETS_KEY }}
9075
- STAGE: \${{ matrix.stage }}
9076
- ${credentials}
9088
+ ${stageSecrets}
9077
9089
  - name: Deploy
9078
9090
  run: ${pm.run} "deploy:$STAGE"
9079
9091
  env:
@@ -9982,7 +9994,7 @@ function generateMonorepoFiles(options, _template) {
9982
9994
  version: "0.0.1",
9983
9995
  private: true,
9984
9996
  type: "module",
9985
- packageManager: "pnpm@10.13.1",
9997
+ packageManager: PNPM_VERSION,
9986
9998
  scripts: {
9987
9999
  dev: isFullstack ? "gkm dev" : "turbo dev",
9988
10000
  build: isFullstack ? "gkm build" : "turbo build",
@@ -10136,7 +10148,6 @@ ${isSst ? "\n# SST\n.sst/\n" : ""}`;
10136
10148
  const tsConfig = {
10137
10149
  compilerOptions: {
10138
10150
  ...isFullstack ? {
10139
- baseUrl: ".",
10140
10151
  paths: { [`@${options.name}/constructs/*`]: ["./constructs/*"] },
10141
10152
  allowImportingTsExtensions: true,
10142
10153
  noEmit: true
@@ -10286,12 +10297,24 @@ ${workspaceConstructsGlobs(options.routesStructure, (0, node_path.dirname)(optio
10286
10297
  ],
10287
10298
 
10288
10299
  secrets: {
10289
- enabled: true,
10300
+ enabled: true,${secretsStore(options)}
10290
10301
  },
10291
10302
  });
10292
10303
  `;
10293
10304
  }
10294
10305
  /**
10306
+ * Where a deployed stage's secrets live. On AWS that is SSM in the stage's own
10307
+ * account, which the deploy job reaches with the role it already assumed; a
10308
+ * server target keeps the encrypted local file, the default.
10309
+ */
10310
+ function secretsStore(options) {
10311
+ if (options.deployTarget !== "sst" || !options.region) return "";
10312
+ return `
10313
+ // Deployed stages keep their secrets in SSM, in the account each stage
10314
+ // deploys to: \`gkm secrets:push --stage <stage> --profile <profile>\`.
10315
+ store: { provider: 'ssm', region: '${options.region}' },`;
10316
+ }
10317
+ /**
10295
10318
  * The workspace's constructs, at its root rather than inside an app.
10296
10319
  *
10297
10320
  * They outlive the app that used them first: a site depending on the API is a
@@ -10506,7 +10529,7 @@ const apiTemplate = {
10506
10529
  const kv = cacheFor();
10507
10530
  const db = databaseFor();
10508
10531
  const mail = emailFor();
10509
- const src = (path) => monorepo ? `~/${path}` : `./${path}`;
10532
+ const src = (path) => `~/${path}`;
10510
10533
  const declares = !monorepo;
10511
10534
  const loggerContent = `import { createLogger } from '@geekmidas/logger/${loggerType}';
10512
10535
 
@@ -10589,7 +10612,7 @@ export const healthEndpoint = router
10589
10612
  timestamp: new Date().toISOString(),
10590
10613
  }));
10591
10614
  ` : `import { z } from 'zod';
10592
- import { router } from './router.ts';
10615
+ import { router } from '~/router.ts';
10593
10616
 
10594
10617
  export const healthEndpoint = router
10595
10618
  .get('/health')
@@ -11050,8 +11073,8 @@ export const telescope = new Telescope({
11050
11073
  content: `import { Direction, InMemoryMonitoringStorage, Studio } from '@geekmidas/studio';
11051
11074
  import { Kysely, PostgresDialect } from 'kysely';
11052
11075
  import pg from 'pg';
11053
- import type { Database } from './constructs/database.ts';
11054
- import { envParser } from './config/env.ts';
11076
+ import type { Database } from '~/constructs/database.ts';
11077
+ import { envParser } from '~/config/env.ts';
11055
11078
 
11056
11079
  // The key the database construct publishes — not a hand-written DATABASE_URL.
11057
11080
  const studioConfig = envParser
@@ -11610,7 +11633,6 @@ function generatePackageJson(options, template) {
11610
11633
  devDependencies["@geekmidas/testkit"] = GEEKMIDAS_VERSIONS["@geekmidas/testkit"];
11611
11634
  devDependencies["@faker-js/faker"] = DEPENDENCY_VERSIONS["@faker-js/faker"];
11612
11635
  devDependencies["kysely-ctl"] = DEPENDENCY_VERSIONS["kysely-ctl"];
11613
- devDependencies["vite-tsconfig-paths"] = DEPENDENCY_VERSIONS["vite-tsconfig-paths"];
11614
11636
  }
11615
11637
  if (monorepo) {
11616
11638
  delete devDependencies["@biomejs/biome"];
@@ -11635,6 +11657,7 @@ function generatePackageJson(options, template) {
11635
11657
  version: "0.0.1",
11636
11658
  private: true,
11637
11659
  type: "module",
11660
+ ...!monorepo && options.packageManager === "pnpm" ? { packageManager: PNPM_VERSION } : {},
11638
11661
  exports: {
11639
11662
  "./client": OPENAPI_OUTPUT_PATH,
11640
11663
  "./endpoints": ENDPOINTS_OUTPUT_PATH
@@ -11843,9 +11866,7 @@ function generateUiPackageFiles(options) {
11843
11866
  },
11844
11867
  devDependencies: {
11845
11868
  "@storybook/addon-a11y": TOOLCHAIN_VERSIONS["@storybook/addon-a11y"],
11846
- "@storybook/addon-essentials": TOOLCHAIN_VERSIONS["@storybook/addon-essentials"],
11847
- "@storybook/addon-interactions": TOOLCHAIN_VERSIONS["@storybook/addon-interactions"],
11848
- "@storybook/react": TOOLCHAIN_VERSIONS["@storybook/react"],
11869
+ "@storybook/addon-docs": TOOLCHAIN_VERSIONS["@storybook/addon-docs"],
11849
11870
  "@storybook/react-vite": TOOLCHAIN_VERSIONS["@storybook/react-vite"],
11850
11871
  "@tailwindcss/vite": DEPENDENCY_VERSIONS["@tailwindcss/vite"],
11851
11872
  "@types/react": DEPENDENCY_VERSIONS["@types/react"],
@@ -11855,7 +11876,7 @@ function generateUiPackageFiles(options) {
11855
11876
  storybook: TOOLCHAIN_VERSIONS["storybook"],
11856
11877
  tailwindcss: DEPENDENCY_VERSIONS["tailwindcss"],
11857
11878
  typescript: TOOLCHAIN_VERSIONS["typescript"],
11858
- vite: TOOLCHAIN_VERSIONS["vite@storybook"]
11879
+ vite: TOOLCHAIN_VERSIONS["vite"]
11859
11880
  },
11860
11881
  peerDependencies: {
11861
11882
  react: ">=18.0.0",
@@ -11874,7 +11895,6 @@ function generateUiPackageFiles(options) {
11874
11895
  ],
11875
11896
  noEmit: true,
11876
11897
  allowImportingTsExtensions: true,
11877
- baseUrl: ".",
11878
11898
  paths: { "~/*": ["./src/*"] }
11879
11899
  },
11880
11900
  include: ["src/**/*"],
@@ -11909,17 +11929,17 @@ function generateUiPackageFiles(options) {
11909
11929
 
11910
11930
  const config: StorybookConfig = {
11911
11931
  stories: ['../src/**/*.stories.@(ts|tsx)'],
11912
- addons: [
11913
- '@storybook/addon-essentials',
11914
- '@storybook/addon-interactions',
11915
- '@storybook/addon-a11y',
11916
- ],
11932
+ // Controls, actions, backgrounds, viewport and interactions are part of
11933
+ // \`storybook\` itself; docs and a11y are add-ons.
11934
+ addons: ['@storybook/addon-docs', '@storybook/addon-a11y'],
11917
11935
  framework: {
11918
11936
  name: '@storybook/react-vite',
11919
11937
  options: {},
11920
11938
  },
11921
- docs: {
11922
- autodocs: 'tag',
11939
+ // \`react-docgen\` parses components itself. The TypeScript-based docgen
11940
+ // calls into TypeScript's JavaScript API, which TypeScript 7 no longer ships.
11941
+ typescript: {
11942
+ reactDocgen: 'react-docgen',
11923
11943
  },
11924
11944
  viteFinal: async (config) => {
11925
11945
  // Add Tailwind CSS v4 plugin
@@ -11932,18 +11952,21 @@ const config: StorybookConfig = {
11932
11952
 
11933
11953
  export default config;
11934
11954
  `;
11935
- const storybookPreview = `import type { Preview } from '@storybook/react';
11955
+ const storybookPreview = `import type { Preview } from '@storybook/react-vite';
11936
11956
  import '../src/styles/globals.css';
11937
11957
 
11938
11958
  const preview: Preview = {
11959
+ // The starting background is a global, not a parameter.
11960
+ initialGlobals: {
11961
+ backgrounds: { value: 'dark' },
11962
+ },
11939
11963
  parameters: {
11940
11964
  backgrounds: {
11941
- default: 'dark',
11942
- values: [
11943
- { name: 'dark', value: '#171717' },
11944
- { name: 'surface', value: '#1c1c1c' },
11945
- { name: 'light', value: '#fafafa' },
11946
- ],
11965
+ options: {
11966
+ dark: { name: 'dark', value: '#171717' },
11967
+ surface: { name: 'surface', value: '#1c1c1c' },
11968
+ light: { name: 'light', value: '#fafafa' },
11969
+ },
11947
11970
  },
11948
11971
  controls: {
11949
11972
  matchers: {
@@ -12106,7 +12129,7 @@ Button.displayName = 'Button';
12106
12129
 
12107
12130
  export { Button, buttonVariants };
12108
12131
  `;
12109
- const buttonStories = `import type { Meta, StoryObj } from '@storybook/react';
12132
+ const buttonStories = `import type { Meta, StoryObj } from '@storybook/react-vite';
12110
12133
  import { Button } from '~/components/ui/button';
12111
12134
 
12112
12135
  const meta: Meta<typeof Button> = {
@@ -12271,7 +12294,7 @@ CardFooter.displayName = 'CardFooter';
12271
12294
 
12272
12295
  export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };
12273
12296
  `;
12274
- const inputStories = `import type { Meta, StoryObj } from '@storybook/react';
12297
+ const inputStories = `import type { Meta, StoryObj } from '@storybook/react-vite';
12275
12298
  import { Input } from '~/components/ui/input';
12276
12299
 
12277
12300
  const meta: Meta<typeof Input> = {
@@ -12325,7 +12348,7 @@ export const WithValue: Story = {
12325
12348
  },
12326
12349
  };
12327
12350
  `;
12328
- const cardStories = `import type { Meta, StoryObj } from '@storybook/react';
12351
+ const cardStories = `import type { Meta, StoryObj } from '@storybook/react-vite';
12329
12352
  import { Button } from '~/components/ui/button';
12330
12353
  import {
12331
12354
  Card,
@@ -12412,7 +12435,7 @@ Label.displayName = LabelPrimitive.Root.displayName;
12412
12435
 
12413
12436
  export { Label };
12414
12437
  `;
12415
- const labelStories = `import type { Meta, StoryObj } from '@storybook/react';
12438
+ const labelStories = `import type { Meta, StoryObj } from '@storybook/react-vite';
12416
12439
  import { Input } from '~/components/ui/input';
12417
12440
  import { Label } from '~/components/ui/label';
12418
12441
 
@@ -12488,7 +12511,7 @@ function Badge({ className, variant, ...props }: BadgeProps) {
12488
12511
 
12489
12512
  export { Badge, badgeVariants };
12490
12513
  `;
12491
- const badgeStories = `import type { Meta, StoryObj } from '@storybook/react';
12514
+ const badgeStories = `import type { Meta, StoryObj } from '@storybook/react-vite';
12492
12515
  import { Badge } from '~/components/ui/badge';
12493
12516
 
12494
12517
  const meta: Meta<typeof Badge> = {
@@ -12564,7 +12587,7 @@ Separator.displayName = SeparatorPrimitive.Root.displayName;
12564
12587
 
12565
12588
  export { Separator };
12566
12589
  `;
12567
- const separatorStories = `import type { Meta, StoryObj } from '@storybook/react';
12590
+ const separatorStories = `import type { Meta, StoryObj } from '@storybook/react-vite';
12568
12591
  import { Separator } from '~/components/ui/separator';
12569
12592
 
12570
12593
  const meta: Meta<typeof Separator> = {
@@ -12669,7 +12692,7 @@ TabsContent.displayName = TabsPrimitive.Content.displayName;
12669
12692
 
12670
12693
  export { Tabs, TabsList, TabsTrigger, TabsContent };
12671
12694
  `;
12672
- const tabsStories = `import type { Meta, StoryObj } from '@storybook/react';
12695
+ const tabsStories = `import type { Meta, StoryObj } from '@storybook/react-vite';
12673
12696
  import { Tabs, TabsContent, TabsList, TabsTrigger } from '~/components/ui/tabs';
12674
12697
  import { Button } from '~/components/ui/button';
12675
12698
  import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '~/components/ui/card';
@@ -12773,7 +12796,7 @@ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
12773
12796
 
12774
12797
  export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
12775
12798
  `;
12776
- const tooltipStories = `import type { Meta, StoryObj } from '@storybook/react';
12799
+ const tooltipStories = `import type { Meta, StoryObj } from '@storybook/react-vite';
12777
12800
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '~/components/ui/tooltip';
12778
12801
  import { Button } from '~/components/ui/button';
12779
12802
 
@@ -12966,7 +12989,7 @@ export {
12966
12989
  DialogDescription,
12967
12990
  };
12968
12991
  `;
12969
- const dialogStories = `import type { Meta, StoryObj } from '@storybook/react';
12992
+ const dialogStories = `import type { Meta, StoryObj } from '@storybook/react-vite';
12970
12993
  import {
12971
12994
  Dialog,
12972
12995
  DialogContent,
@@ -13298,7 +13321,6 @@ export default nextConfig;
13298
13321
  jsx: "preserve",
13299
13322
  incremental: true,
13300
13323
  plugins: [{ name: "next" }],
13301
- baseUrl: ".",
13302
13324
  paths: {
13303
13325
  "~/*": ["./src/*", "../../packages/ui/src/*"],
13304
13326
  [`${apiPackage}/client`]: ["../../apps/api/.gkm/openapi/api.ts"],
@@ -13593,8 +13615,7 @@ function generateTanStackWebFiles(options) {
13593
13615
  tailwindcss: DEPENDENCY_VERSIONS["tailwindcss"],
13594
13616
  tsx: TOOLCHAIN_VERSIONS["tsx"],
13595
13617
  typescript: TOOLCHAIN_VERSIONS["typescript"],
13596
- vite: TOOLCHAIN_VERSIONS["vite"],
13597
- "vite-tsconfig-paths": DEPENDENCY_VERSIONS["vite-tsconfig-paths"]
13618
+ vite: TOOLCHAIN_VERSIONS["vite"]
13598
13619
  }
13599
13620
  };
13600
13621
  const viteConfig = `import { Credentials } from '@geekmidas/envkit/credentials';
@@ -13602,16 +13623,16 @@ import tailwindcss from '@tailwindcss/vite';
13602
13623
  import { tanstackStart } from '@tanstack/react-start/plugin/vite';
13603
13624
  import viteReact from '@vitejs/plugin-react';
13604
13625
  import { defineConfig } from 'vite';
13605
- import tsconfigPaths from 'vite-tsconfig-paths';
13606
13626
 
13607
13627
  export default defineConfig({
13628
+ // Vite resolves tsconfig \`paths\` itself; no plugin needed.
13629
+ resolve: { tsconfigPaths: true },
13608
13630
  server: {
13609
13631
  port: Number(Credentials.PORT ?? 3001),
13610
13632
  },
13611
13633
  // VITE_* vars are inlined automatically; no manual loadEnv needed.
13612
13634
  envPrefix: 'VITE_',
13613
13635
  plugins: [
13614
- tsconfigPaths({ root: import.meta.dirname }),
13615
13636
  tailwindcss(),
13616
13637
  tanstackStart(),
13617
13638
  viteReact(),
@@ -13638,7 +13659,6 @@ export default defineConfig({
13638
13659
  isolatedModules: true,
13639
13660
  jsx: "preserve",
13640
13661
  incremental: true,
13641
- baseUrl: ".",
13642
13662
  types: ["vite/client"],
13643
13663
  paths: {
13644
13664
  "~/*": ["./src/*", "../../packages/ui/src/*"],
@@ -14323,7 +14343,7 @@ async function initCommand(projectName, options = {}) {
14323
14343
  }
14324
14344
  devSecrets.custom = customSecrets;
14325
14345
  await require_storage.writeStageSecrets(devSecrets, targetDir);
14326
- const keyPath = require_keystore.getKeyPath(local, name);
14346
+ const keyPath = require_storage.getKeyPath(local, name);
14327
14347
  console.log(` Secrets: .gkm/secrets/${local}.json (encrypted)`);
14328
14348
  console.log(` Key: ${keyPath}\n`);
14329
14349
  if (!options.skipInstall) {
@@ -14489,7 +14509,7 @@ async function secretsInitCommand(options) {
14489
14509
  const loaded = await require_config.loadWorkspaceConfig();
14490
14510
  projectName = loaded.workspace.name;
14491
14511
  if (Object.keys(loaded.workspace.apps).length > 1) {
14492
- workspaceSecrets = require_fullstack_secrets.generateFullstackCustomSecrets(loaded.workspace);
14512
+ workspaceSecrets = require_reconcile.generateFullstackCustomSecrets(loaded.workspace);
14493
14513
  logger$3.log(" Detected workspace mode — generating per-app secrets");
14494
14514
  }
14495
14515
  } catch {}
@@ -14866,7 +14886,7 @@ async function setupCommand(options = {}) {
14866
14886
  }
14867
14887
  const containers = await require_credentials.derivedContainers(workspace, stage);
14868
14888
  if (isMultiApp && containers.includes("postgres")) {
14869
- await require_fullstack_secrets.writeDockerEnvFromSecrets(secrets, workspace.root);
14889
+ await require_reconcile.writeDockerEnvFromSecrets(secrets, workspace.root);
14870
14890
  logger$1.log("📄 Generated docker/.env with database passwords");
14871
14891
  }
14872
14892
  if (!options.skipDocker) {
@@ -14901,7 +14921,7 @@ async function reconcileLocal(workspace, stage, options) {
14901
14921
  /**
14902
14922
  * Resolve secrets with priority:
14903
14923
  * 1. Local secrets exist → use them (preserves manual additions)
14904
- * 2. SSM configured and has secrets → pull and use
14924
+ * 2. A deployed stage whose store has secrets → pull and use
14905
14925
  * 3. Neither → generate fresh secrets
14906
14926
  *
14907
14927
  * --force skips checks 1 and 2 and always regenerates.
@@ -14920,18 +14940,15 @@ async function resolveSecrets(stage, workspace, options) {
14920
14940
  return reconciled ?? secrets;
14921
14941
  }
14922
14942
  }
14923
- if (require_sync.isSSMConfigured(workspace)) {
14924
- logger$1.log("☁️ Checking for remote secrets in SSM...");
14943
+ if (require_transfer.isRemoteStore(workspace, stage)) {
14944
+ logger$1.log("☁️ Checking the secrets store...");
14925
14945
  try {
14926
- const remoteSecrets = await require_sync.pullSecrets(stage, workspace);
14927
- if (remoteSecrets) {
14928
- logger$1.log("✅ Pulled secrets from SSM");
14929
- await require_storage.writeStageSecrets(remoteSecrets, workspace.root);
14930
- return remoteSecrets;
14931
- }
14932
- logger$1.log(" No remote secrets found");
14946
+ const { secrets } = await require_transfer.pullStageSecrets(workspace, stage);
14947
+ logger$1.log("✅ Pulled secrets from the store");
14948
+ return secrets;
14933
14949
  } catch (error) {
14934
- logger$1.warn(`⚠️ Failed to pull from SSM: ${error.message}`);
14950
+ if (error instanceof require_transfer.NoStoredSecrets) logger$1.log(" The store holds none yet");
14951
+ else logger$1.warn(`⚠️ Could not pull from the store: ${error.message}`);
14935
14952
  }
14936
14953
  }
14937
14954
  logger$1.log("🔐 Generating fresh development secrets...");
@@ -15001,7 +15018,7 @@ function reconcileSecrets(secrets, workspace, containers = []) {
15001
15018
  changed = true;
15002
15019
  }
15003
15020
  if (Object.keys(workspace.apps).length > 1) {
15004
- const expected = require_fullstack_secrets.generateFullstackCustomSecrets(workspace, containers);
15021
+ const expected = require_reconcile.generateFullstackCustomSecrets(workspace, containers);
15005
15022
  const missing = {};
15006
15023
  for (const [key, value] of Object.entries(expected)) if (!(key in result.custom)) missing[key] = value;
15007
15024
  if (Object.keys(missing).length > 0) {
@@ -15032,7 +15049,7 @@ function reconcileSecrets(secrets, workspace, containers = []) {
15032
15049
  function createFreshWorkspaceSecrets(stage, workspace, containers = []) {
15033
15050
  const serviceNames = credentialedServices(containers);
15034
15051
  const secrets = require_generator.createStageSecrets(stage, serviceNames, { projectName: workspace.name });
15035
- if (Object.keys(workspace.apps).length > 1) secrets.custom = require_fullstack_secrets.generateFullstackCustomSecrets(workspace, containers);
15052
+ if (Object.keys(workspace.apps).length > 1) secrets.custom = require_reconcile.generateFullstackCustomSecrets(workspace, containers);
15036
15053
  else secrets.custom = {
15037
15054
  NODE_ENV: "development",
15038
15055
  PORT: "3000",
@@ -15065,18 +15082,18 @@ async function generateFreshSecrets(stage, workspace, options) {
15065
15082
  const secrets = createFreshWorkspaceSecrets(stage, workspace, await require_credentials.derivedContainers(workspace, stage));
15066
15083
  await require_storage.writeStageSecrets(secrets, workspace.root);
15067
15084
  logger$1.log(` Secrets written to .gkm/secrets/${stage}.json`);
15068
- if (require_sync.isSSMConfigured(workspace) && !options.yes) {
15085
+ if (require_transfer.isRemoteStore(workspace, stage) && !options.yes) {
15069
15086
  const { shouldPush } = await (0, prompts.default)({
15070
15087
  type: "confirm",
15071
15088
  name: "shouldPush",
15072
- message: "Push secrets to SSM for team sharing?",
15089
+ message: `Push the "${stage}" secrets to its store?`,
15073
15090
  initial: true
15074
15091
  });
15075
15092
  if (shouldPush) try {
15076
- await require_sync.pushSecrets(stage, workspace);
15077
- logger$1.log("☁️ Secrets pushed to SSM");
15093
+ await require_transfer.pushStageSecrets(workspace, stage);
15094
+ logger$1.log("☁️ Secrets pushed to the store");
15078
15095
  } catch (error) {
15079
- logger$1.warn(`⚠️ Failed to push to SSM: ${error.message}`);
15096
+ logger$1.warn(`⚠️ Could not push to the store: ${error.message}`);
15080
15097
  }
15081
15098
  }
15082
15099
  return secrets;
@@ -15510,7 +15527,7 @@ const program = new commander.Command();
15510
15527
  program.name("gkm").description("GeekMidas backend framework CLI").version(version).option("--cwd <path>", "Change working directory").option("--debug", "Enable debug mode (verbose errors with stack traces)").hook("preAction", () => {
15511
15528
  if (program.opts().debug);
15512
15529
  });
15513
- program.command("init").description("Scaffold a new project").argument("[name]", "Project name").option("--template <template>", "Project template (minimal, api, serverless, worker)").option("--skip-install", "Skip dependency installation", false).option("-y, --yes", "Skip prompts, use defaults", false).option("--monorepo", "Setup as monorepo with packages/models", false).option("--api-path <path>", "API app path in monorepo (default: apps/api)").option("--pm <manager>", "Package manager (pnpm, npm, yarn, bun)").option("--deploy <target>", "Where it deploys (dokploy, sst, none)").option("--region <region>", "AWS region for an SST deploy (e.g. eu-west-1)").option("--stages <names>", "Deployed stages, comma-separated (e.g. staging,prod)").option("--protected-stage <name>", "Which deployed stage is production").option("--local-stage <name>", "What gkm dev runs as (e.g. dev)").option("--region <region>", "AWS region for an SST deploy (e.g. eu-west-1)").action(async (name, options) => {
15530
+ program.command("init").description("Scaffold a new project").argument("[name]", "Project name").option("--template <template>", "Project template (minimal, api, serverless, worker)").option("--skip-install", "Skip dependency installation", false).option("-y, --yes", "Skip prompts, use defaults", false).option("--monorepo", "Setup as monorepo with packages/models", false).option("--api-path <path>", "API app path in monorepo (default: apps/api)").option("--pm <manager>", "Package manager (pnpm, npm, yarn, bun)").option("--deploy <target>", "Where it deploys (dokploy, sst, none)").option("--region <region>", "AWS region for an SST deploy (e.g. eu-west-1)").option("--stages <names>", "Deployed stages, comma-separated (e.g. staging,prod)").option("--protected-stage <name>", "Which deployed stage is production").option("--local-stage <name>", "What gkm dev runs as (e.g. dev)").action(async (name, options) => {
15514
15531
  try {
15515
15532
  const globalOptions = program.opts();
15516
15533
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
@@ -15727,54 +15744,30 @@ program.command("secrets:import").description("Import secrets from a JSON file")
15727
15744
  process.exit(1);
15728
15745
  }
15729
15746
  });
15730
- program.command("secrets:push").description("Push secrets to remote provider (SSM)").requiredOption("--stage <stage>", "Stage name").action(async (options) => {
15747
+ program.command("secrets:push").description("Send a deployed stage's secrets to its store (secrets.store)").requiredOption("--stage <stage>", "A deployed stage").option("--profile <profile>", "AWS profile for the stage's account").action(async (options) => {
15731
15748
  try {
15732
15749
  const globalOptions = program.opts();
15733
15750
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
15734
15751
  const { loadWorkspaceConfig } = await Promise.resolve().then(() => require("./config.cjs"));
15735
- const { pushSecrets } = await Promise.resolve().then(() => require("./sync-D7uTIIEi.cjs")).then((n) => n.sync_exports);
15736
- const { reconcileMissingSecrets } = await Promise.resolve().then(() => require("./reconcile-Dd2iyILf.cjs"));
15737
- const { readStageSecrets, writeStageSecrets } = await Promise.resolve().then(() => require("./storage-C-30BD1e.cjs")).then((n) => n.storage_exports);
15752
+ const { pushStageSecrets } = await Promise.resolve().then(() => require("./transfer-DdmtKLzi.cjs")).then((n) => n.transfer_exports);
15738
15753
  const { workspace } = await loadWorkspaceConfig();
15739
- const secrets = await readStageSecrets(options.stage, workspace.root);
15740
- if (secrets) {
15741
- const { derivedContainers } = await Promise.resolve().then(() => require("./credentials-Q6F0uqJq.cjs")).then((n) => n.workspace_exports);
15742
- const result = reconcileMissingSecrets(secrets, workspace, await derivedContainers(workspace, options.stage));
15743
- if (result) {
15744
- await writeStageSecrets(result.secrets, workspace.root);
15745
- console.log(` Reconciled ${result.addedKeys.length} missing secret(s):`);
15746
- for (const key of result.addedKeys) console.log(` + ${key}`);
15747
- }
15748
- }
15749
- await pushSecrets(options.stage, workspace);
15754
+ const { addedKeys } = await pushStageSecrets(workspace, options.stage, { profile: options.profile });
15755
+ for (const key of addedKeys) console.log(` + ${key} (reconciled)`);
15750
15756
  console.log(`\n✓ Secrets pushed for stage "${options.stage}"`);
15751
15757
  } catch (error) {
15752
15758
  console.error(formatError(error));
15753
15759
  process.exit(1);
15754
15760
  }
15755
15761
  });
15756
- program.command("secrets:pull").description("Pull secrets from remote provider (SSM)").requiredOption("--stage <stage>", "Stage name").action(async (options) => {
15762
+ program.command("secrets:pull").description("Bring a deployed stage's secrets from its store into the local copy").requiredOption("--stage <stage>", "A deployed stage").option("--profile <profile>", "AWS profile for the stage's account").action(async (options) => {
15757
15763
  try {
15758
15764
  const globalOptions = program.opts();
15759
15765
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
15760
15766
  const { loadWorkspaceConfig } = await Promise.resolve().then(() => require("./config.cjs"));
15761
- const { pullSecrets } = await Promise.resolve().then(() => require("./sync-D7uTIIEi.cjs")).then((n) => n.sync_exports);
15762
- const { writeStageSecrets } = await Promise.resolve().then(() => require("./storage-C-30BD1e.cjs")).then((n) => n.storage_exports);
15763
- const { reconcileMissingSecrets } = await Promise.resolve().then(() => require("./reconcile-Dd2iyILf.cjs"));
15767
+ const { pullStageSecrets } = await Promise.resolve().then(() => require("./transfer-DdmtKLzi.cjs")).then((n) => n.transfer_exports);
15764
15768
  const { workspace } = await loadWorkspaceConfig();
15765
- let secrets = await pullSecrets(options.stage, workspace);
15766
- if (!secrets) {
15767
- console.error(`No remote secrets found for stage "${options.stage}".`);
15768
- process.exit(1);
15769
- }
15770
- const { derivedContainers } = await Promise.resolve().then(() => require("./credentials-Q6F0uqJq.cjs")).then((n) => n.workspace_exports);
15771
- const result = reconcileMissingSecrets(secrets, workspace, await derivedContainers(workspace, options.stage));
15772
- if (result) {
15773
- secrets = result.secrets;
15774
- console.log(` Reconciled ${result.addedKeys.length} missing secret(s):`);
15775
- for (const key of result.addedKeys) console.log(` + ${key}`);
15776
- }
15777
- await writeStageSecrets(secrets, workspace.root);
15769
+ const { addedKeys } = await pullStageSecrets(workspace, options.stage, { profile: options.profile });
15770
+ for (const key of addedKeys) console.log(` + ${key} (reconciled)`);
15778
15771
  console.log(`\n✓ Secrets pulled for stage "${options.stage}"`);
15779
15772
  } catch (error) {
15780
15773
  console.error(formatError(error));
@@ -15786,8 +15779,8 @@ program.command("secrets:reconcile").description("Backfill missing custom secret
15786
15779
  const globalOptions = program.opts();
15787
15780
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
15788
15781
  const { loadWorkspaceConfig } = await Promise.resolve().then(() => require("./config.cjs"));
15789
- const { reconcileMissingSecrets } = await Promise.resolve().then(() => require("./reconcile-Dd2iyILf.cjs"));
15790
- const { readStageSecrets, writeStageSecrets } = await Promise.resolve().then(() => require("./storage-C-30BD1e.cjs")).then((n) => n.storage_exports);
15782
+ const { reconcileMissingSecrets } = await Promise.resolve().then(() => require("./reconcile-Cq4cO83R.cjs")).then((n) => n.reconcile_exports);
15783
+ const { readStageSecrets, writeStageSecrets } = await Promise.resolve().then(() => require("./storage-DgypfSD6.cjs")).then((n) => n.storage_exports);
15791
15784
  const { workspace } = await loadWorkspaceConfig();
15792
15785
  const stage = options.stage ?? workspace.stages.local;
15793
15786
  const secrets = await readStageSecrets(stage, workspace.root);
@@ -15795,7 +15788,7 @@ program.command("secrets:reconcile").description("Backfill missing custom secret
15795
15788
  console.error(`No secrets found for stage "${stage}". Run "gkm secrets:init --stage ${stage}" first.`);
15796
15789
  process.exit(1);
15797
15790
  }
15798
- const { derivedContainers } = await Promise.resolve().then(() => require("./credentials-Q6F0uqJq.cjs")).then((n) => n.workspace_exports);
15791
+ const { derivedContainers } = await Promise.resolve().then(() => require("./credentials-tvyReUAd.cjs")).then((n) => n.workspace_exports);
15799
15792
  const result = reconcileMissingSecrets(secrets, workspace, await derivedContainers(workspace, stage));
15800
15793
  if (!result) {
15801
15794
  console.log(`\n✓ Secrets for stage "${stage}" are up-to-date`);
@@ -15854,7 +15847,7 @@ program.command("deploy:github").description("Let GitHub Actions deploy a stage:
15854
15847
  try {
15855
15848
  const globalOptions = program.opts();
15856
15849
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
15857
- const { deployGithubCommand } = await Promise.resolve().then(() => require("./github-BfflNPVe.cjs"));
15850
+ const { deployGithubCommand } = await Promise.resolve().then(() => require("./github-DVE8Gg_F.cjs"));
15858
15851
  await deployGithubCommand(options);
15859
15852
  } catch (error) {
15860
15853
  console.error(formatError(error));