@geekmidas/cli 10.0.0-alpha.5 → 10.0.0-alpha.9

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 (74) hide show
  1. package/README.md +12 -8
  2. package/bin/adjacent-tsconfig.mjs +59 -0
  3. package/bin/gkm.mjs +7 -1
  4. package/dist/{config-C21ocYNd.cjs → config-BZ1F0WuA.cjs} +8 -81
  5. package/dist/config-BZ1F0WuA.cjs.map +1 -0
  6. package/dist/{config-WRdsQYZK.mjs → config-DVVph9yz.mjs} +10 -77
  7. package/dist/config-DVVph9yz.mjs.map +1 -0
  8. package/dist/config.cjs +2 -2
  9. package/dist/config.d.cts +2 -2
  10. package/dist/config.d.mts +2 -2
  11. package/dist/config.mjs +2 -2
  12. package/dist/{credentials-G1JwBoXH.cjs → credentials-Xamqe_NJ.cjs} +20 -19
  13. package/dist/credentials-Xamqe_NJ.cjs.map +1 -0
  14. package/dist/{credentials-BBIRJVp4.mjs → credentials-dP8vRVRv.mjs} +20 -19
  15. package/dist/credentials-dP8vRVRv.mjs.map +1 -0
  16. package/dist/discover-CAlFgYec.mjs.map +1 -1
  17. package/dist/discover-DTmFeloL.cjs.map +1 -1
  18. package/dist/{index-BThUzEIp.d.mts → index-C6e-ULLx.d.mts} +2 -2
  19. package/dist/index-C6e-ULLx.d.mts.map +1 -0
  20. package/dist/{index-CHB4tSzX.d.cts → index-CR5urhWX.d.cts} +2 -2
  21. package/dist/index-CR5urhWX.d.cts.map +1 -0
  22. package/dist/index.cjs +871 -337
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.mjs +871 -337
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/{openapi-CA0yJUTN.cjs → openapi-SjsgARie.cjs} +122 -50
  27. package/dist/openapi-SjsgARie.cjs.map +1 -0
  28. package/dist/{openapi-kkQbsRVj.mjs → openapi-Xx0A7Wg0.mjs} +104 -50
  29. package/dist/openapi-Xx0A7Wg0.mjs.map +1 -0
  30. package/dist/openapi.cjs +5 -3
  31. package/dist/openapi.d.cts +46 -10
  32. package/dist/openapi.d.cts.map +1 -1
  33. package/dist/openapi.d.mts +46 -10
  34. package/dist/openapi.d.mts.map +1 -1
  35. package/dist/openapi.mjs +4 -4
  36. package/dist/reconcile/public.d.cts +1 -1
  37. package/dist/reconcile/public.d.mts +1 -1
  38. package/dist/{setup-ZijS4qeC.mjs → setup-BA8ciTPU.mjs} +4 -4
  39. package/dist/setup-BsZvZP6f.cjs +11 -0
  40. package/dist/{setup-DXvRLTZN.mjs → setup-C8KOx8_8.mjs} +5 -5
  41. package/dist/setup-C8KOx8_8.mjs.map +1 -0
  42. package/dist/{setup-Cm2UnAdh.cjs → setup-hC6hI86f.cjs} +5 -5
  43. package/dist/setup-hC6hI86f.cjs.map +1 -0
  44. package/dist/{types-C-arnQ1r.d.mts → types-6pkp2RRj.d.mts} +46 -10
  45. package/dist/types-6pkp2RRj.d.mts.map +1 -0
  46. package/dist/{types-abJQuk7m.d.cts → types-Y3fKQSAK.d.cts} +46 -10
  47. package/dist/types-Y3fKQSAK.d.cts.map +1 -0
  48. package/dist/workspace/index.cjs +1 -1
  49. package/dist/workspace/index.d.cts +2 -2
  50. package/dist/workspace/index.d.mts +2 -2
  51. package/dist/workspace/index.mjs +1 -1
  52. package/dist/workspace-BzrG_2SI.mjs +8 -0
  53. package/dist/{workspace-BcucjwvA.cjs → workspace-C6VJQVtG.cjs} +79 -17
  54. package/dist/workspace-C6VJQVtG.cjs.map +1 -0
  55. package/dist/{workspace-DdJss8I6.cjs → workspace-XXtNhqJl.cjs} +3 -3
  56. package/dist/{workspace-BFMrAKqI.mjs → workspace-zoqRbihZ.mjs} +62 -18
  57. package/dist/workspace-zoqRbihZ.mjs.map +1 -0
  58. package/package.json +14 -13
  59. package/dist/config-C21ocYNd.cjs.map +0 -1
  60. package/dist/config-WRdsQYZK.mjs.map +0 -1
  61. package/dist/credentials-BBIRJVp4.mjs.map +0 -1
  62. package/dist/credentials-G1JwBoXH.cjs.map +0 -1
  63. package/dist/index-BThUzEIp.d.mts.map +0 -1
  64. package/dist/index-CHB4tSzX.d.cts.map +0 -1
  65. package/dist/openapi-CA0yJUTN.cjs.map +0 -1
  66. package/dist/openapi-kkQbsRVj.mjs.map +0 -1
  67. package/dist/setup-B5_oHHUj.cjs +0 -11
  68. package/dist/setup-Cm2UnAdh.cjs.map +0 -1
  69. package/dist/setup-DXvRLTZN.mjs.map +0 -1
  70. package/dist/types-C-arnQ1r.d.mts.map +0 -1
  71. package/dist/types-abJQuk7m.d.cts.map +0 -1
  72. package/dist/workspace-BFMrAKqI.mjs.map +0 -1
  73. package/dist/workspace-BcucjwvA.cjs.map +0 -1
  74. package/dist/workspace-k4l3rsFh.mjs +0 -8
@@ -5711,6 +5711,52 @@ function superRefine(fn, params) {
5711
5711
  const describe = describe$1;
5712
5712
  const meta = meta$1;
5713
5713
 
5714
+ //#endregion
5715
+ //#region src/workspace/stages.ts
5716
+ /**
5717
+ * What `gkm test` runs as. The CLI's own, so no project stage may take it:
5718
+ * its containers are torn down and rebuilt between runs.
5719
+ */
5720
+ const TEST_STAGE = "test";
5721
+ /** A stage becomes part of every physical name, so it has to fit in one. */
5722
+ const STAGE_NAME = /^[a-z][a-z0-9-]*$/;
5723
+ /** Everything wrong with one stage name, or nothing. */
5724
+ function nameProblems(name) {
5725
+ const problems = [];
5726
+ if (!STAGE_NAME.test(name)) problems.push(`stage "${name}" must be lowercase letters, digits and hyphens, starting with a letter`);
5727
+ if (name === TEST_STAGE) problems.push(`stage "${TEST_STAGE}" is reserved for gkm test`);
5728
+ return problems;
5729
+ }
5730
+ /** Everything wrong with a list of deployed stages on its own. */
5731
+ function deployedProblems(deployed) {
5732
+ const problems = deployed.flatMap(nameProblems);
5733
+ const seen = /* @__PURE__ */ new Set();
5734
+ for (const name of deployed) {
5735
+ if (seen.has(name)) problems.push(`stage "${name}" is listed twice`);
5736
+ seen.add(name);
5737
+ }
5738
+ return problems;
5739
+ }
5740
+ /** Everything wrong with a stages block, or nothing. */
5741
+ function stageProblems(stages) {
5742
+ if (!stages) return ["`stages` is required, e.g. stages: { local: 'dev', deployed: ['prod'] }"];
5743
+ const { local, deployed, protected: kept = [] } = stages;
5744
+ const problems = [...nameProblems(local), ...deployedProblems(deployed)];
5745
+ if (deployed.includes(local)) problems.push(`"${local}" is both the local stage and a deployed one; they would share secrets`);
5746
+ for (const name of kept) if (!deployed.includes(name)) problems.push(`protected stage "${name}" is not a deployed stage`);
5747
+ return problems;
5748
+ }
5749
+ /** The stages block, or an error naming everything wrong with it. */
5750
+ function validateStages(stages) {
5751
+ const problems = stageProblems(stages);
5752
+ if (problems.length) throw new Error(`Invalid stages in gkm.config.ts:\n ${problems.join("\n ")}`);
5753
+ return stages;
5754
+ }
5755
+ /** Refuses a stage the project does not deploy to. */
5756
+ function assertDeployedStage(stages, stage) {
5757
+ if (!stages.deployed.includes(stage)) throw new Error(`"${stage}" is not a deployed stage. gkm.config.ts deploys to: ${stages.deployed.join(", ") || "nothing yet"}.`);
5758
+ }
5759
+
5714
5760
  //#endregion
5715
5761
  //#region src/workspace/schema.ts
5716
5762
  /**
@@ -6097,6 +6143,16 @@ const SharedConfigSchema = object({
6097
6143
  /**
6098
6144
  * Secrets configuration schema.
6099
6145
  */
6146
+ const StagesConfigSchema = object({
6147
+ local: string(),
6148
+ deployed: array(string()),
6149
+ protected: array(string()).optional()
6150
+ }).superRefine((stages, ctx) => {
6151
+ for (const message of stageProblems(stages)) ctx.addIssue({
6152
+ code: "custom",
6153
+ message
6154
+ });
6155
+ });
6100
6156
  const SecretsConfigSchema = object({
6101
6157
  enabled: boolean().optional(),
6102
6158
  algorithm: string().optional(),
@@ -6200,6 +6256,7 @@ const WorkspaceConfigSchema = object({
6200
6256
  shared: SharedConfigSchema.optional(),
6201
6257
  deploy: DeployConfigSchema.optional(),
6202
6258
  services: ServicesConfigSchema.optional(),
6259
+ stages: StagesConfigSchema,
6203
6260
  secrets: SecretsConfigSchema.optional(),
6204
6261
  state: StateConfigSchema.optional()
6205
6262
  }).refine((data) => {
@@ -6397,6 +6454,7 @@ function normalizeWorkspace(config$1, cwd) {
6397
6454
  services: config$1.services ?? {},
6398
6455
  deploy: config$1.deploy ?? { default: "dokploy" },
6399
6456
  shared: config$1.shared ?? { packages: ["packages/*"] },
6457
+ stages: validateStages(config$1.stages),
6400
6458
  secrets: config$1.secrets ?? {},
6401
6459
  state: config$1.state
6402
6460
  };
@@ -6430,14 +6488,6 @@ function wrapSingleAppAsWorkspace(config$1, cwd) {
6430
6488
  dependencies: [],
6431
6489
  resolvedDeployTarget: config$1.deploy?.default ?? "dokploy",
6432
6490
  constructs: config$1.constructs,
6433
- routes: config$1.routes,
6434
- functions: config$1.functions,
6435
- crons: config$1.crons,
6436
- queues: config$1.queues,
6437
- topics: config$1.topics,
6438
- subscribers: config$1.subscribers,
6439
- envParser: config$1.envParser,
6440
- logger: config$1.logger,
6441
6491
  providers: config$1.providers,
6442
6492
  hooks: config$1.hooks,
6443
6493
  telescope: config$1.telescope,
@@ -6456,6 +6506,7 @@ function wrapSingleAppAsWorkspace(config$1, cwd) {
6456
6506
  ...config$1.deploy
6457
6507
  },
6458
6508
  shared: { packages: [] },
6509
+ stages: validateStages(config$1.stages),
6459
6510
  secrets: {}
6460
6511
  };
6461
6512
  }
@@ -6536,15 +6587,8 @@ function getAppGkmConfig(workspace, appName) {
6536
6587
  if (!app || app.type !== "backend") return void 0;
6537
6588
  return {
6538
6589
  services: workspace.services,
6590
+ stages: workspace.stages,
6539
6591
  constructs: appConstructGlobs(workspace, appName),
6540
- routes: app.routes ?? "",
6541
- functions: app.functions,
6542
- crons: app.crons,
6543
- queues: app.queues,
6544
- topics: app.topics,
6545
- subscribers: app.subscribers,
6546
- envParser: app.envParser ?? "",
6547
- logger: app.logger ?? "",
6548
6592
  providers: app.providers,
6549
6593
  hooks: app.hooks,
6550
6594
  telescope: app.telescope,
@@ -6666,6 +6710,12 @@ Object.defineProperty(exports, 'appConstructGlobs', {
6666
6710
  return appConstructGlobs;
6667
6711
  }
6668
6712
  });
6713
+ Object.defineProperty(exports, 'assertDeployedStage', {
6714
+ enumerable: true,
6715
+ get: function () {
6716
+ return assertDeployedStage;
6717
+ }
6718
+ });
6669
6719
  Object.defineProperty(exports, 'constructPatterns', {
6670
6720
  enumerable: true,
6671
6721
  get: function () {
@@ -6678,6 +6728,12 @@ Object.defineProperty(exports, 'defineWorkspace', {
6678
6728
  return defineWorkspace;
6679
6729
  }
6680
6730
  });
6731
+ Object.defineProperty(exports, 'deployedProblems', {
6732
+ enumerable: true,
6733
+ get: function () {
6734
+ return deployedProblems;
6735
+ }
6736
+ });
6681
6737
  Object.defineProperty(exports, 'formatValidationErrors', {
6682
6738
  enumerable: true,
6683
6739
  get: function () {
@@ -6756,6 +6812,12 @@ Object.defineProperty(exports, 'safeValidateWorkspaceConfig', {
6756
6812
  return safeValidateWorkspaceConfig;
6757
6813
  }
6758
6814
  });
6815
+ Object.defineProperty(exports, 'stageProblems', {
6816
+ enumerable: true,
6817
+ get: function () {
6818
+ return stageProblems;
6819
+ }
6820
+ });
6759
6821
  Object.defineProperty(exports, 'stripPublicPrefix', {
6760
6822
  enumerable: true,
6761
6823
  get: function () {
@@ -6780,4 +6842,4 @@ Object.defineProperty(exports, 'wrapSingleAppAsWorkspace', {
6780
6842
  return wrapSingleAppAsWorkspace;
6781
6843
  }
6782
6844
  });
6783
- //# sourceMappingURL=workspace-BcucjwvA.cjs.map
6845
+ //# sourceMappingURL=workspace-C6VJQVtG.cjs.map