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

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 (90) 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-DSXI480r.cjs} +2 -2
  6. package/dist/{config-Q1rvKHvw.cjs.map → config-DSXI480r.cjs.map} +1 -1
  7. package/dist/{config-pqGD3hF9.mjs → config-DdKkoUE1.mjs} +2 -2
  8. package/dist/{config-pqGD3hF9.mjs.map → config-DdKkoUE1.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-Q6F0uqJq.cjs → credentials-C6Pfn6GY.cjs} +31 -9
  14. package/dist/credentials-C6Pfn6GY.cjs.map +1 -0
  15. package/dist/{credentials-BekkKtY_.mjs → credentials-lbv-j0Be.mjs} +32 -10
  16. package/dist/{credentials-BekkKtY_.mjs.map → credentials-lbv-j0Be.mjs.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-DlIrXPee.mjs} +21 -8
  20. package/dist/github-DlIrXPee.mjs.map +1 -0
  21. package/dist/{github-BfflNPVe.cjs → github-n7N9yOff.cjs} +22 -9
  22. package/dist/github-n7N9yOff.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 +164 -172
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.mjs +159 -167
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/{openapi-Dcbme-Us.cjs → openapi-B8bu_OXN.cjs} +2 -2
  32. package/dist/{openapi-Dcbme-Us.cjs.map → openapi-B8bu_OXN.cjs.map} +1 -1
  33. package/dist/{openapi-vy4JzhUv.mjs → openapi-DfjbhrsM.mjs} +2 -2
  34. package/dist/{openapi-vy4JzhUv.mjs.map → openapi-DfjbhrsM.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-2aRVVJ6I.mjs +122 -0
  54. package/dist/transfer-2aRVVJ6I.mjs.map +1 -0
  55. package/dist/transfer-C3WZVmj_.cjs +151 -0
  56. package/dist/transfer-C3WZVmj_.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-CgwmXEtc.mjs → workspace-Bu3xNCej.mjs} +14 -3
  66. package/dist/{workspace-CgwmXEtc.mjs.map → workspace-Bu3xNCej.mjs.map} +1 -1
  67. package/dist/{workspace-mFpI_ky_.cjs → workspace-CRD9YinV.cjs} +19 -2
  68. package/dist/{workspace-mFpI_ky_.cjs.map → workspace-CRD9YinV.cjs.map} +1 -1
  69. package/package.json +11 -11
  70. package/dist/credentials-Q6F0uqJq.cjs.map +0 -1
  71. package/dist/fullstack-secrets-BET8gqwK.mjs.map +0 -1
  72. package/dist/fullstack-secrets-DXsWO-5m.cjs.map +0 -1
  73. package/dist/github-BfflNPVe.cjs.map +0 -1
  74. package/dist/github-CRwnxKmD.mjs.map +0 -1
  75. package/dist/keystore-B4PRlbgE.mjs +0 -81
  76. package/dist/keystore-B4PRlbgE.mjs.map +0 -1
  77. package/dist/keystore-DgGRj2Yy.cjs +0 -98
  78. package/dist/keystore-DgGRj2Yy.cjs.map +0 -1
  79. package/dist/reconcile-Dd2iyILf.cjs +0 -34
  80. package/dist/reconcile-Dd2iyILf.cjs.map +0 -1
  81. package/dist/reconcile-DhQ00DpU.mjs +0 -34
  82. package/dist/reconcile-DhQ00DpU.mjs.map +0 -1
  83. package/dist/storage-C-30BD1e.cjs.map +0 -1
  84. package/dist/storage-P_b3w7uj.mjs.map +0 -1
  85. package/dist/sync-B3xxXtJT.mjs +0 -88
  86. package/dist/sync-B3xxXtJT.mjs.map +0 -1
  87. package/dist/sync-D7uTIIEi.cjs +0 -111
  88. package/dist/sync-D7uTIIEi.cjs.map +0 -1
  89. package/dist/types-RhXmHR-e.d.cts.map +0 -1
  90. 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-DSXI480r.cjs");
6
+ const require_workspace = require("./workspace-CRD9YinV.cjs");
7
+ const require_credentials = require("./credentials-C6Pfn6GY.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-B8bu_OXN.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-C3WZVmj_.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.18";
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.18",
8397
+ "@geekmidas/auth": "~10.0.0-alpha.18",
8398
+ "@geekmidas/cache": "~10.0.0-alpha.18",
8399
+ "@geekmidas/client": "~10.0.0-alpha.18",
8400
+ "@geekmidas/cloud": "~10.0.0-alpha.18",
8401
+ "@geekmidas/constructs": "~10.0.0-alpha.18",
8402
+ "@geekmidas/db": "~10.0.0-alpha.18",
8403
+ "@geekmidas/emailkit": "~10.0.0-alpha.18",
8404
+ "@geekmidas/envkit": "~10.0.0-alpha.18",
8405
+ "@geekmidas/errors": "~10.0.0-alpha.18",
8406
+ "@geekmidas/events": "~10.0.0-alpha.18",
8407
+ "@geekmidas/logger": "~10.0.0-alpha.18",
8408
+ "@geekmidas/manifest": "~10.0.0-alpha.18",
8409
+ "@geekmidas/rate-limit": "~10.0.0-alpha.18",
8410
+ "@geekmidas/schema": "~10.0.0-alpha.18",
8411
+ "@geekmidas/services": "~10.0.0-alpha.18",
8412
+ "@geekmidas/storage": "~10.0.0-alpha.18",
8413
+ "@geekmidas/studio": "~10.0.0-alpha.18",
8414
+ "@geekmidas/telescope": "~10.0.0-alpha.18",
8415
+ "@geekmidas/testkit": "~10.0.0-alpha.18",
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
@@ -11666,10 +11689,9 @@ function generateSourceFiles(options, template) {
11666
11689
  function generateTestFiles(options, _template) {
11667
11690
  if (!options.constructs.database) return [];
11668
11691
  const db = databaseFor();
11669
- const declares = !options.monorepo;
11670
- const schema = declares ? "../src/constructs/database.ts" : "~/services/database.ts";
11671
- const runtimeUrl = declares ? db.urlKey : "DATABASE_URL";
11672
- const ownerUrl = declares ? db.ownerUrlKey : "DATABASE_URL";
11692
+ const schema = !options.monorepo ? "../src/constructs/database.ts" : "~/services/database.ts";
11693
+ const runtimeUrl = db.urlKey;
11694
+ const ownerUrl = db.ownerUrlKey;
11673
11695
  return [
11674
11696
  {
11675
11697
  path: "kysely.config.ts",
@@ -11843,9 +11865,7 @@ function generateUiPackageFiles(options) {
11843
11865
  },
11844
11866
  devDependencies: {
11845
11867
  "@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"],
11868
+ "@storybook/addon-docs": TOOLCHAIN_VERSIONS["@storybook/addon-docs"],
11849
11869
  "@storybook/react-vite": TOOLCHAIN_VERSIONS["@storybook/react-vite"],
11850
11870
  "@tailwindcss/vite": DEPENDENCY_VERSIONS["@tailwindcss/vite"],
11851
11871
  "@types/react": DEPENDENCY_VERSIONS["@types/react"],
@@ -11855,7 +11875,7 @@ function generateUiPackageFiles(options) {
11855
11875
  storybook: TOOLCHAIN_VERSIONS["storybook"],
11856
11876
  tailwindcss: DEPENDENCY_VERSIONS["tailwindcss"],
11857
11877
  typescript: TOOLCHAIN_VERSIONS["typescript"],
11858
- vite: TOOLCHAIN_VERSIONS["vite@storybook"]
11878
+ vite: TOOLCHAIN_VERSIONS["vite"]
11859
11879
  },
11860
11880
  peerDependencies: {
11861
11881
  react: ">=18.0.0",
@@ -11874,7 +11894,6 @@ function generateUiPackageFiles(options) {
11874
11894
  ],
11875
11895
  noEmit: true,
11876
11896
  allowImportingTsExtensions: true,
11877
- baseUrl: ".",
11878
11897
  paths: { "~/*": ["./src/*"] }
11879
11898
  },
11880
11899
  include: ["src/**/*"],
@@ -11909,17 +11928,17 @@ function generateUiPackageFiles(options) {
11909
11928
 
11910
11929
  const config: StorybookConfig = {
11911
11930
  stories: ['../src/**/*.stories.@(ts|tsx)'],
11912
- addons: [
11913
- '@storybook/addon-essentials',
11914
- '@storybook/addon-interactions',
11915
- '@storybook/addon-a11y',
11916
- ],
11931
+ // Controls, actions, backgrounds, viewport and interactions are part of
11932
+ // \`storybook\` itself; docs and a11y are add-ons.
11933
+ addons: ['@storybook/addon-docs', '@storybook/addon-a11y'],
11917
11934
  framework: {
11918
11935
  name: '@storybook/react-vite',
11919
11936
  options: {},
11920
11937
  },
11921
- docs: {
11922
- autodocs: 'tag',
11938
+ // \`react-docgen\` parses components itself. The TypeScript-based docgen
11939
+ // calls into TypeScript's JavaScript API, which TypeScript 7 no longer ships.
11940
+ typescript: {
11941
+ reactDocgen: 'react-docgen',
11923
11942
  },
11924
11943
  viteFinal: async (config) => {
11925
11944
  // Add Tailwind CSS v4 plugin
@@ -11932,18 +11951,21 @@ const config: StorybookConfig = {
11932
11951
 
11933
11952
  export default config;
11934
11953
  `;
11935
- const storybookPreview = `import type { Preview } from '@storybook/react';
11954
+ const storybookPreview = `import type { Preview } from '@storybook/react-vite';
11936
11955
  import '../src/styles/globals.css';
11937
11956
 
11938
11957
  const preview: Preview = {
11958
+ // The starting background is a global, not a parameter.
11959
+ initialGlobals: {
11960
+ backgrounds: { value: 'dark' },
11961
+ },
11939
11962
  parameters: {
11940
11963
  backgrounds: {
11941
- default: 'dark',
11942
- values: [
11943
- { name: 'dark', value: '#171717' },
11944
- { name: 'surface', value: '#1c1c1c' },
11945
- { name: 'light', value: '#fafafa' },
11946
- ],
11964
+ options: {
11965
+ dark: { name: 'dark', value: '#171717' },
11966
+ surface: { name: 'surface', value: '#1c1c1c' },
11967
+ light: { name: 'light', value: '#fafafa' },
11968
+ },
11947
11969
  },
11948
11970
  controls: {
11949
11971
  matchers: {
@@ -12106,7 +12128,7 @@ Button.displayName = 'Button';
12106
12128
 
12107
12129
  export { Button, buttonVariants };
12108
12130
  `;
12109
- const buttonStories = `import type { Meta, StoryObj } from '@storybook/react';
12131
+ const buttonStories = `import type { Meta, StoryObj } from '@storybook/react-vite';
12110
12132
  import { Button } from '~/components/ui/button';
12111
12133
 
12112
12134
  const meta: Meta<typeof Button> = {
@@ -12271,7 +12293,7 @@ CardFooter.displayName = 'CardFooter';
12271
12293
 
12272
12294
  export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };
12273
12295
  `;
12274
- const inputStories = `import type { Meta, StoryObj } from '@storybook/react';
12296
+ const inputStories = `import type { Meta, StoryObj } from '@storybook/react-vite';
12275
12297
  import { Input } from '~/components/ui/input';
12276
12298
 
12277
12299
  const meta: Meta<typeof Input> = {
@@ -12325,7 +12347,7 @@ export const WithValue: Story = {
12325
12347
  },
12326
12348
  };
12327
12349
  `;
12328
- const cardStories = `import type { Meta, StoryObj } from '@storybook/react';
12350
+ const cardStories = `import type { Meta, StoryObj } from '@storybook/react-vite';
12329
12351
  import { Button } from '~/components/ui/button';
12330
12352
  import {
12331
12353
  Card,
@@ -12412,7 +12434,7 @@ Label.displayName = LabelPrimitive.Root.displayName;
12412
12434
 
12413
12435
  export { Label };
12414
12436
  `;
12415
- const labelStories = `import type { Meta, StoryObj } from '@storybook/react';
12437
+ const labelStories = `import type { Meta, StoryObj } from '@storybook/react-vite';
12416
12438
  import { Input } from '~/components/ui/input';
12417
12439
  import { Label } from '~/components/ui/label';
12418
12440
 
@@ -12488,7 +12510,7 @@ function Badge({ className, variant, ...props }: BadgeProps) {
12488
12510
 
12489
12511
  export { Badge, badgeVariants };
12490
12512
  `;
12491
- const badgeStories = `import type { Meta, StoryObj } from '@storybook/react';
12513
+ const badgeStories = `import type { Meta, StoryObj } from '@storybook/react-vite';
12492
12514
  import { Badge } from '~/components/ui/badge';
12493
12515
 
12494
12516
  const meta: Meta<typeof Badge> = {
@@ -12564,7 +12586,7 @@ Separator.displayName = SeparatorPrimitive.Root.displayName;
12564
12586
 
12565
12587
  export { Separator };
12566
12588
  `;
12567
- const separatorStories = `import type { Meta, StoryObj } from '@storybook/react';
12589
+ const separatorStories = `import type { Meta, StoryObj } from '@storybook/react-vite';
12568
12590
  import { Separator } from '~/components/ui/separator';
12569
12591
 
12570
12592
  const meta: Meta<typeof Separator> = {
@@ -12669,7 +12691,7 @@ TabsContent.displayName = TabsPrimitive.Content.displayName;
12669
12691
 
12670
12692
  export { Tabs, TabsList, TabsTrigger, TabsContent };
12671
12693
  `;
12672
- const tabsStories = `import type { Meta, StoryObj } from '@storybook/react';
12694
+ const tabsStories = `import type { Meta, StoryObj } from '@storybook/react-vite';
12673
12695
  import { Tabs, TabsContent, TabsList, TabsTrigger } from '~/components/ui/tabs';
12674
12696
  import { Button } from '~/components/ui/button';
12675
12697
  import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '~/components/ui/card';
@@ -12773,7 +12795,7 @@ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
12773
12795
 
12774
12796
  export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
12775
12797
  `;
12776
- const tooltipStories = `import type { Meta, StoryObj } from '@storybook/react';
12798
+ const tooltipStories = `import type { Meta, StoryObj } from '@storybook/react-vite';
12777
12799
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '~/components/ui/tooltip';
12778
12800
  import { Button } from '~/components/ui/button';
12779
12801
 
@@ -12966,7 +12988,7 @@ export {
12966
12988
  DialogDescription,
12967
12989
  };
12968
12990
  `;
12969
- const dialogStories = `import type { Meta, StoryObj } from '@storybook/react';
12991
+ const dialogStories = `import type { Meta, StoryObj } from '@storybook/react-vite';
12970
12992
  import {
12971
12993
  Dialog,
12972
12994
  DialogContent,
@@ -13298,7 +13320,6 @@ export default nextConfig;
13298
13320
  jsx: "preserve",
13299
13321
  incremental: true,
13300
13322
  plugins: [{ name: "next" }],
13301
- baseUrl: ".",
13302
13323
  paths: {
13303
13324
  "~/*": ["./src/*", "../../packages/ui/src/*"],
13304
13325
  [`${apiPackage}/client`]: ["../../apps/api/.gkm/openapi/api.ts"],
@@ -13593,8 +13614,7 @@ function generateTanStackWebFiles(options) {
13593
13614
  tailwindcss: DEPENDENCY_VERSIONS["tailwindcss"],
13594
13615
  tsx: TOOLCHAIN_VERSIONS["tsx"],
13595
13616
  typescript: TOOLCHAIN_VERSIONS["typescript"],
13596
- vite: TOOLCHAIN_VERSIONS["vite"],
13597
- "vite-tsconfig-paths": DEPENDENCY_VERSIONS["vite-tsconfig-paths"]
13617
+ vite: TOOLCHAIN_VERSIONS["vite"]
13598
13618
  }
13599
13619
  };
13600
13620
  const viteConfig = `import { Credentials } from '@geekmidas/envkit/credentials';
@@ -13602,16 +13622,16 @@ import tailwindcss from '@tailwindcss/vite';
13602
13622
  import { tanstackStart } from '@tanstack/react-start/plugin/vite';
13603
13623
  import viteReact from '@vitejs/plugin-react';
13604
13624
  import { defineConfig } from 'vite';
13605
- import tsconfigPaths from 'vite-tsconfig-paths';
13606
13625
 
13607
13626
  export default defineConfig({
13627
+ // Vite resolves tsconfig \`paths\` itself; no plugin needed.
13628
+ resolve: { tsconfigPaths: true },
13608
13629
  server: {
13609
13630
  port: Number(Credentials.PORT ?? 3001),
13610
13631
  },
13611
13632
  // VITE_* vars are inlined automatically; no manual loadEnv needed.
13612
13633
  envPrefix: 'VITE_',
13613
13634
  plugins: [
13614
- tsconfigPaths({ root: import.meta.dirname }),
13615
13635
  tailwindcss(),
13616
13636
  tanstackStart(),
13617
13637
  viteReact(),
@@ -13638,7 +13658,6 @@ export default defineConfig({
13638
13658
  isolatedModules: true,
13639
13659
  jsx: "preserve",
13640
13660
  incremental: true,
13641
- baseUrl: ".",
13642
13661
  types: ["vite/client"],
13643
13662
  paths: {
13644
13663
  "~/*": ["./src/*", "../../packages/ui/src/*"],
@@ -14323,7 +14342,7 @@ async function initCommand(projectName, options = {}) {
14323
14342
  }
14324
14343
  devSecrets.custom = customSecrets;
14325
14344
  await require_storage.writeStageSecrets(devSecrets, targetDir);
14326
- const keyPath = require_keystore.getKeyPath(local, name);
14345
+ const keyPath = require_storage.getKeyPath(local, name);
14327
14346
  console.log(` Secrets: .gkm/secrets/${local}.json (encrypted)`);
14328
14347
  console.log(` Key: ${keyPath}\n`);
14329
14348
  if (!options.skipInstall) {
@@ -14489,7 +14508,7 @@ async function secretsInitCommand(options) {
14489
14508
  const loaded = await require_config.loadWorkspaceConfig();
14490
14509
  projectName = loaded.workspace.name;
14491
14510
  if (Object.keys(loaded.workspace.apps).length > 1) {
14492
- workspaceSecrets = require_fullstack_secrets.generateFullstackCustomSecrets(loaded.workspace);
14511
+ workspaceSecrets = require_reconcile.generateFullstackCustomSecrets(loaded.workspace);
14493
14512
  logger$3.log(" Detected workspace mode — generating per-app secrets");
14494
14513
  }
14495
14514
  } catch {}
@@ -14866,7 +14885,7 @@ async function setupCommand(options = {}) {
14866
14885
  }
14867
14886
  const containers = await require_credentials.derivedContainers(workspace, stage);
14868
14887
  if (isMultiApp && containers.includes("postgres")) {
14869
- await require_fullstack_secrets.writeDockerEnvFromSecrets(secrets, workspace.root);
14888
+ await require_reconcile.writeDockerEnvFromSecrets(secrets, workspace.root);
14870
14889
  logger$1.log("📄 Generated docker/.env with database passwords");
14871
14890
  }
14872
14891
  if (!options.skipDocker) {
@@ -14901,7 +14920,7 @@ async function reconcileLocal(workspace, stage, options) {
14901
14920
  /**
14902
14921
  * Resolve secrets with priority:
14903
14922
  * 1. Local secrets exist → use them (preserves manual additions)
14904
- * 2. SSM configured and has secrets → pull and use
14923
+ * 2. A deployed stage whose store has secrets → pull and use
14905
14924
  * 3. Neither → generate fresh secrets
14906
14925
  *
14907
14926
  * --force skips checks 1 and 2 and always regenerates.
@@ -14920,18 +14939,15 @@ async function resolveSecrets(stage, workspace, options) {
14920
14939
  return reconciled ?? secrets;
14921
14940
  }
14922
14941
  }
14923
- if (require_sync.isSSMConfigured(workspace)) {
14924
- logger$1.log("☁️ Checking for remote secrets in SSM...");
14942
+ if (require_transfer.isRemoteStore(workspace, stage)) {
14943
+ logger$1.log("☁️ Checking the secrets store...");
14925
14944
  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");
14945
+ const { secrets } = await require_transfer.pullStageSecrets(workspace, stage);
14946
+ logger$1.log("✅ Pulled secrets from the store");
14947
+ return secrets;
14933
14948
  } catch (error) {
14934
- logger$1.warn(`⚠️ Failed to pull from SSM: ${error.message}`);
14949
+ if (error instanceof require_transfer.NoStoredSecrets) logger$1.log(" The store holds none yet");
14950
+ else logger$1.warn(`⚠️ Could not pull from the store: ${error.message}`);
14935
14951
  }
14936
14952
  }
14937
14953
  logger$1.log("🔐 Generating fresh development secrets...");
@@ -15001,7 +15017,7 @@ function reconcileSecrets(secrets, workspace, containers = []) {
15001
15017
  changed = true;
15002
15018
  }
15003
15019
  if (Object.keys(workspace.apps).length > 1) {
15004
- const expected = require_fullstack_secrets.generateFullstackCustomSecrets(workspace, containers);
15020
+ const expected = require_reconcile.generateFullstackCustomSecrets(workspace, containers);
15005
15021
  const missing = {};
15006
15022
  for (const [key, value] of Object.entries(expected)) if (!(key in result.custom)) missing[key] = value;
15007
15023
  if (Object.keys(missing).length > 0) {
@@ -15032,7 +15048,7 @@ function reconcileSecrets(secrets, workspace, containers = []) {
15032
15048
  function createFreshWorkspaceSecrets(stage, workspace, containers = []) {
15033
15049
  const serviceNames = credentialedServices(containers);
15034
15050
  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);
15051
+ if (Object.keys(workspace.apps).length > 1) secrets.custom = require_reconcile.generateFullstackCustomSecrets(workspace, containers);
15036
15052
  else secrets.custom = {
15037
15053
  NODE_ENV: "development",
15038
15054
  PORT: "3000",
@@ -15065,18 +15081,18 @@ async function generateFreshSecrets(stage, workspace, options) {
15065
15081
  const secrets = createFreshWorkspaceSecrets(stage, workspace, await require_credentials.derivedContainers(workspace, stage));
15066
15082
  await require_storage.writeStageSecrets(secrets, workspace.root);
15067
15083
  logger$1.log(` Secrets written to .gkm/secrets/${stage}.json`);
15068
- if (require_sync.isSSMConfigured(workspace) && !options.yes) {
15084
+ if (require_transfer.isRemoteStore(workspace, stage) && !options.yes) {
15069
15085
  const { shouldPush } = await (0, prompts.default)({
15070
15086
  type: "confirm",
15071
15087
  name: "shouldPush",
15072
- message: "Push secrets to SSM for team sharing?",
15088
+ message: `Push the "${stage}" secrets to its store?`,
15073
15089
  initial: true
15074
15090
  });
15075
15091
  if (shouldPush) try {
15076
- await require_sync.pushSecrets(stage, workspace);
15077
- logger$1.log("☁️ Secrets pushed to SSM");
15092
+ await require_transfer.pushStageSecrets(workspace, stage);
15093
+ logger$1.log("☁️ Secrets pushed to the store");
15078
15094
  } catch (error) {
15079
- logger$1.warn(`⚠️ Failed to push to SSM: ${error.message}`);
15095
+ logger$1.warn(`⚠️ Could not push to the store: ${error.message}`);
15080
15096
  }
15081
15097
  }
15082
15098
  return secrets;
@@ -15510,7 +15526,7 @@ const program = new commander.Command();
15510
15526
  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
15527
  if (program.opts().debug);
15512
15528
  });
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) => {
15529
+ 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
15530
  try {
15515
15531
  const globalOptions = program.opts();
15516
15532
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
@@ -15727,54 +15743,30 @@ program.command("secrets:import").description("Import secrets from a JSON file")
15727
15743
  process.exit(1);
15728
15744
  }
15729
15745
  });
15730
- program.command("secrets:push").description("Push secrets to remote provider (SSM)").requiredOption("--stage <stage>", "Stage name").action(async (options) => {
15746
+ 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
15747
  try {
15732
15748
  const globalOptions = program.opts();
15733
15749
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
15734
15750
  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);
15751
+ const { pushStageSecrets } = await Promise.resolve().then(() => require("./transfer-C3WZVmj_.cjs")).then((n) => n.transfer_exports);
15738
15752
  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);
15753
+ const { addedKeys } = await pushStageSecrets(workspace, options.stage, { profile: options.profile });
15754
+ for (const key of addedKeys) console.log(` + ${key} (reconciled)`);
15750
15755
  console.log(`\n✓ Secrets pushed for stage "${options.stage}"`);
15751
15756
  } catch (error) {
15752
15757
  console.error(formatError(error));
15753
15758
  process.exit(1);
15754
15759
  }
15755
15760
  });
15756
- program.command("secrets:pull").description("Pull secrets from remote provider (SSM)").requiredOption("--stage <stage>", "Stage name").action(async (options) => {
15761
+ 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
15762
  try {
15758
15763
  const globalOptions = program.opts();
15759
15764
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
15760
15765
  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"));
15766
+ const { pullStageSecrets } = await Promise.resolve().then(() => require("./transfer-C3WZVmj_.cjs")).then((n) => n.transfer_exports);
15764
15767
  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);
15768
+ const { addedKeys } = await pullStageSecrets(workspace, options.stage, { profile: options.profile });
15769
+ for (const key of addedKeys) console.log(` + ${key} (reconciled)`);
15778
15770
  console.log(`\n✓ Secrets pulled for stage "${options.stage}"`);
15779
15771
  } catch (error) {
15780
15772
  console.error(formatError(error));
@@ -15786,8 +15778,8 @@ program.command("secrets:reconcile").description("Backfill missing custom secret
15786
15778
  const globalOptions = program.opts();
15787
15779
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
15788
15780
  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);
15781
+ const { reconcileMissingSecrets } = await Promise.resolve().then(() => require("./reconcile-Cq4cO83R.cjs")).then((n) => n.reconcile_exports);
15782
+ const { readStageSecrets, writeStageSecrets } = await Promise.resolve().then(() => require("./storage-DgypfSD6.cjs")).then((n) => n.storage_exports);
15791
15783
  const { workspace } = await loadWorkspaceConfig();
15792
15784
  const stage = options.stage ?? workspace.stages.local;
15793
15785
  const secrets = await readStageSecrets(stage, workspace.root);
@@ -15795,7 +15787,7 @@ program.command("secrets:reconcile").description("Backfill missing custom secret
15795
15787
  console.error(`No secrets found for stage "${stage}". Run "gkm secrets:init --stage ${stage}" first.`);
15796
15788
  process.exit(1);
15797
15789
  }
15798
- const { derivedContainers } = await Promise.resolve().then(() => require("./credentials-Q6F0uqJq.cjs")).then((n) => n.workspace_exports);
15790
+ const { derivedContainers } = await Promise.resolve().then(() => require("./credentials-C6Pfn6GY.cjs")).then((n) => n.workspace_exports);
15799
15791
  const result = reconcileMissingSecrets(secrets, workspace, await derivedContainers(workspace, stage));
15800
15792
  if (!result) {
15801
15793
  console.log(`\n✓ Secrets for stage "${stage}" are up-to-date`);
@@ -15854,7 +15846,7 @@ program.command("deploy:github").description("Let GitHub Actions deploy a stage:
15854
15846
  try {
15855
15847
  const globalOptions = program.opts();
15856
15848
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
15857
- const { deployGithubCommand } = await Promise.resolve().then(() => require("./github-BfflNPVe.cjs"));
15849
+ const { deployGithubCommand } = await Promise.resolve().then(() => require("./github-n7N9yOff.cjs"));
15858
15850
  await deployGithubCommand(options);
15859
15851
  } catch (error) {
15860
15852
  console.error(formatError(error));