@geekmidas/cli 10.0.0-alpha.6 → 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 (70) 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-CNz5KaSR.cjs → config-BZ1F0WuA.cjs} +6 -50
  5. package/dist/config-BZ1F0WuA.cjs.map +1 -0
  6. package/dist/{config-CxP7P-qG.mjs → config-DVVph9yz.mjs} +7 -45
  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-DzsXZzkx.cjs → credentials-Xamqe_NJ.cjs} +19 -18
  13. package/dist/credentials-Xamqe_NJ.cjs.map +1 -0
  14. package/dist/{credentials-BK3Z93MX.mjs → credentials-dP8vRVRv.mjs} +19 -18
  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-BGGdjueF.d.cts → index-C6e-ULLx.d.mts} +2 -2
  19. package/dist/index-C6e-ULLx.d.mts.map +1 -0
  20. package/dist/{index-DEbaleny.d.mts → index-CR5urhWX.d.cts} +2 -2
  21. package/dist/index-CR5urhWX.d.cts.map +1 -0
  22. package/dist/index.cjs +596 -248
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.mjs +596 -248
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/{openapi-D-dx9Akj.cjs → openapi-SjsgARie.cjs} +4 -4
  27. package/dist/{openapi-D-dx9Akj.cjs.map → openapi-SjsgARie.cjs.map} +1 -1
  28. package/dist/{openapi-Bw8DWFWz.mjs → openapi-Xx0A7Wg0.mjs} +4 -4
  29. package/dist/{openapi-Bw8DWFWz.mjs.map → openapi-Xx0A7Wg0.mjs.map} +1 -1
  30. package/dist/openapi.cjs +3 -3
  31. package/dist/openapi.d.cts +3 -3
  32. package/dist/openapi.d.mts +3 -3
  33. package/dist/openapi.mjs +3 -3
  34. package/dist/reconcile/public.d.cts +1 -1
  35. package/dist/reconcile/public.d.mts +1 -1
  36. package/dist/{setup-DGIPd2fh.mjs → setup-BA8ciTPU.mjs} +4 -4
  37. package/dist/setup-BsZvZP6f.cjs +11 -0
  38. package/dist/{setup-BWMhbW-p.mjs → setup-C8KOx8_8.mjs} +5 -5
  39. package/dist/setup-C8KOx8_8.mjs.map +1 -0
  40. package/dist/{setup-D7L4BgBT.cjs → setup-hC6hI86f.cjs} +5 -5
  41. package/dist/setup-hC6hI86f.cjs.map +1 -0
  42. package/dist/{types-BLSNdrk0.d.cts → types-6pkp2RRj.d.mts} +48 -4
  43. package/dist/types-6pkp2RRj.d.mts.map +1 -0
  44. package/dist/{types-C3POXhw3.d.mts → types-Y3fKQSAK.d.cts} +45 -1
  45. package/dist/types-Y3fKQSAK.d.cts.map +1 -0
  46. package/dist/workspace/index.cjs +1 -1
  47. package/dist/workspace/index.d.cts +2 -2
  48. package/dist/workspace/index.d.mts +2 -2
  49. package/dist/workspace/index.mjs +1 -1
  50. package/dist/workspace-BzrG_2SI.mjs +8 -0
  51. package/dist/{workspace-LKiNyaDy.cjs → workspace-C6VJQVtG.cjs} +79 -1
  52. package/dist/workspace-C6VJQVtG.cjs.map +1 -0
  53. package/dist/{workspace-CGaUAw5A.cjs → workspace-XXtNhqJl.cjs} +3 -3
  54. package/dist/{workspace-DIuZx-cc.mjs → workspace-zoqRbihZ.mjs} +62 -2
  55. package/dist/workspace-zoqRbihZ.mjs.map +1 -0
  56. package/package.json +14 -13
  57. package/dist/config-CNz5KaSR.cjs.map +0 -1
  58. package/dist/config-CxP7P-qG.mjs.map +0 -1
  59. package/dist/credentials-BK3Z93MX.mjs.map +0 -1
  60. package/dist/credentials-DzsXZzkx.cjs.map +0 -1
  61. package/dist/index-BGGdjueF.d.cts.map +0 -1
  62. package/dist/index-DEbaleny.d.mts.map +0 -1
  63. package/dist/setup-8IWPsRIN.cjs +0 -11
  64. package/dist/setup-BWMhbW-p.mjs.map +0 -1
  65. package/dist/setup-D7L4BgBT.cjs.map +0 -1
  66. package/dist/types-BLSNdrk0.d.cts.map +0 -1
  67. package/dist/types-C3POXhw3.d.mts.map +0 -1
  68. package/dist/workspace-CnTqIlB3.mjs +0 -8
  69. package/dist/workspace-DIuZx-cc.mjs.map +0 -1
  70. package/dist/workspace-LKiNyaDy.cjs.map +0 -1
@@ -1,3 +1,3 @@
1
- import { AppConfig, AppConfigInput, AppInput, AppsRecord, BackendFramework, ConstrainedApps, DeployConfig, DeployTarget, DokployWorkspaceConfig, FrontendFramework, InferAppNames, InferredWorkspaceConfig, LoadedConfig, MailServiceConfig, MobileFramework, ModelsConfig, NormalizedAppConfig, NormalizedWorkspace, PHASE_2_DEPLOY_TARGETS, SUPPORTED_DEPLOY_TARGETS, SecretsConfig, ServiceImageConfig, ServicesConfig, SharedConfig, WorkspaceConfig, WorkspaceConfigSchema, WorkspaceInput, formatValidationErrors, getDeployTargetError, isDeployTargetSupported, isPhase2DeployTarget, isWorkspaceConfig, safeValidateWorkspaceConfig, validateWorkspaceConfig } from "../types-BLSNdrk0.cjs";
2
- import { PUBLIC_ENV_PREFIXES, allConstructGlobs, appConstructGlobs, constructPatterns, defineWorkspace, getAppBuildOrder, getAppGkmConfig, getDependencyEnvVars, getEndpointForStage, getPublicEnvPrefix, normalizeWorkspace, processConfig, stripPublicPrefix, workspaceConstructGlobs, wrapSingleAppAsWorkspace } from "../index-BGGdjueF.cjs";
1
+ import { AppConfig, AppConfigInput, AppInput, AppsRecord, BackendFramework, ConstrainedApps, DeployConfig, DeployTarget, DokployWorkspaceConfig, FrontendFramework, InferAppNames, InferredWorkspaceConfig, LoadedConfig, MailServiceConfig, MobileFramework, ModelsConfig, NormalizedAppConfig, NormalizedWorkspace, PHASE_2_DEPLOY_TARGETS, SUPPORTED_DEPLOY_TARGETS, SecretsConfig, ServiceImageConfig, ServicesConfig, SharedConfig, WorkspaceConfig, WorkspaceConfigSchema, WorkspaceInput, formatValidationErrors, getDeployTargetError, isDeployTargetSupported, isPhase2DeployTarget, isWorkspaceConfig, safeValidateWorkspaceConfig, validateWorkspaceConfig } from "../types-Y3fKQSAK.cjs";
2
+ import { PUBLIC_ENV_PREFIXES, allConstructGlobs, appConstructGlobs, constructPatterns, defineWorkspace, getAppBuildOrder, getAppGkmConfig, getDependencyEnvVars, getEndpointForStage, getPublicEnvPrefix, normalizeWorkspace, processConfig, stripPublicPrefix, workspaceConstructGlobs, wrapSingleAppAsWorkspace } from "../index-CR5urhWX.cjs";
3
3
  export { AppConfig, AppConfigInput, AppInput, AppsRecord, BackendFramework, ConstrainedApps, DeployConfig, DeployTarget, DokployWorkspaceConfig, FrontendFramework, InferAppNames, InferredWorkspaceConfig, LoadedConfig, MailServiceConfig, MobileFramework, ModelsConfig, NormalizedAppConfig, NormalizedWorkspace, PHASE_2_DEPLOY_TARGETS, PUBLIC_ENV_PREFIXES, SUPPORTED_DEPLOY_TARGETS, SecretsConfig, ServiceImageConfig, ServicesConfig, SharedConfig, WorkspaceConfig, WorkspaceConfigSchema, WorkspaceInput, allConstructGlobs, appConstructGlobs, constructPatterns, defineWorkspace, formatValidationErrors, getAppBuildOrder, getAppGkmConfig, getDependencyEnvVars, getDeployTargetError, getEndpointForStage, getPublicEnvPrefix, isDeployTargetSupported, isPhase2DeployTarget, isWorkspaceConfig, normalizeWorkspace, processConfig, safeValidateWorkspaceConfig, stripPublicPrefix, validateWorkspaceConfig, workspaceConstructGlobs, wrapSingleAppAsWorkspace };
@@ -1,3 +1,3 @@
1
- import { AppConfig, AppConfigInput, AppInput, AppsRecord, BackendFramework, ConstrainedApps, DeployConfig, DeployTarget, DokployWorkspaceConfig, FrontendFramework, InferAppNames, InferredWorkspaceConfig, LoadedConfig, MailServiceConfig, MobileFramework, ModelsConfig, NormalizedAppConfig, NormalizedWorkspace, PHASE_2_DEPLOY_TARGETS, SUPPORTED_DEPLOY_TARGETS, SecretsConfig, ServiceImageConfig, ServicesConfig, SharedConfig, WorkspaceConfig, WorkspaceConfigSchema, WorkspaceInput, formatValidationErrors, getDeployTargetError, isDeployTargetSupported, isPhase2DeployTarget, isWorkspaceConfig, safeValidateWorkspaceConfig, validateWorkspaceConfig } from "../types-C3POXhw3.mjs";
2
- import { PUBLIC_ENV_PREFIXES, allConstructGlobs, appConstructGlobs, constructPatterns, defineWorkspace, getAppBuildOrder, getAppGkmConfig, getDependencyEnvVars, getEndpointForStage, getPublicEnvPrefix, normalizeWorkspace, processConfig, stripPublicPrefix, workspaceConstructGlobs, wrapSingleAppAsWorkspace } from "../index-DEbaleny.mjs";
1
+ import { AppConfig, AppConfigInput, AppInput, AppsRecord, BackendFramework, ConstrainedApps, DeployConfig, DeployTarget, DokployWorkspaceConfig, FrontendFramework, InferAppNames, InferredWorkspaceConfig, LoadedConfig, MailServiceConfig, MobileFramework, ModelsConfig, NormalizedAppConfig, NormalizedWorkspace, PHASE_2_DEPLOY_TARGETS, SUPPORTED_DEPLOY_TARGETS, SecretsConfig, ServiceImageConfig, ServicesConfig, SharedConfig, WorkspaceConfig, WorkspaceConfigSchema, WorkspaceInput, formatValidationErrors, getDeployTargetError, isDeployTargetSupported, isPhase2DeployTarget, isWorkspaceConfig, safeValidateWorkspaceConfig, validateWorkspaceConfig } from "../types-6pkp2RRj.mjs";
2
+ import { PUBLIC_ENV_PREFIXES, allConstructGlobs, appConstructGlobs, constructPatterns, defineWorkspace, getAppBuildOrder, getAppGkmConfig, getDependencyEnvVars, getEndpointForStage, getPublicEnvPrefix, normalizeWorkspace, processConfig, stripPublicPrefix, workspaceConstructGlobs, wrapSingleAppAsWorkspace } from "../index-C6e-ULLx.mjs";
3
3
  export { AppConfig, AppConfigInput, AppInput, AppsRecord, BackendFramework, ConstrainedApps, DeployConfig, DeployTarget, DokployWorkspaceConfig, FrontendFramework, InferAppNames, InferredWorkspaceConfig, LoadedConfig, MailServiceConfig, MobileFramework, ModelsConfig, NormalizedAppConfig, NormalizedWorkspace, PHASE_2_DEPLOY_TARGETS, PUBLIC_ENV_PREFIXES, SUPPORTED_DEPLOY_TARGETS, SecretsConfig, ServiceImageConfig, ServicesConfig, SharedConfig, WorkspaceConfig, WorkspaceConfigSchema, WorkspaceInput, allConstructGlobs, appConstructGlobs, constructPatterns, defineWorkspace, formatValidationErrors, getAppBuildOrder, getAppGkmConfig, getDependencyEnvVars, getDeployTargetError, getEndpointForStage, getPublicEnvPrefix, isDeployTargetSupported, isPhase2DeployTarget, isWorkspaceConfig, normalizeWorkspace, processConfig, safeValidateWorkspaceConfig, stripPublicPrefix, validateWorkspaceConfig, workspaceConstructGlobs, wrapSingleAppAsWorkspace };
@@ -1,3 +1,3 @@
1
- import { PHASE_2_DEPLOY_TARGETS, PUBLIC_ENV_PREFIXES, SUPPORTED_DEPLOY_TARGETS, WorkspaceConfigSchema, allConstructGlobs, appConstructGlobs, constructPatterns, defineWorkspace, formatValidationErrors, getAppBuildOrder, getAppGkmConfig, getDependencyEnvVars, getDeployTargetError, getEndpointForStage, getPublicEnvPrefix, isDeployTargetSupported, isPhase2DeployTarget, isWorkspaceConfig, normalizeWorkspace, processConfig, safeValidateWorkspaceConfig, stripPublicPrefix, validateWorkspaceConfig, workspaceConstructGlobs, wrapSingleAppAsWorkspace } from "../workspace-DIuZx-cc.mjs";
1
+ import { PHASE_2_DEPLOY_TARGETS, PUBLIC_ENV_PREFIXES, SUPPORTED_DEPLOY_TARGETS, WorkspaceConfigSchema, allConstructGlobs, appConstructGlobs, constructPatterns, defineWorkspace, formatValidationErrors, getAppBuildOrder, getAppGkmConfig, getDependencyEnvVars, getDeployTargetError, getEndpointForStage, getPublicEnvPrefix, isDeployTargetSupported, isPhase2DeployTarget, isWorkspaceConfig, normalizeWorkspace, processConfig, safeValidateWorkspaceConfig, stripPublicPrefix, validateWorkspaceConfig, workspaceConstructGlobs, wrapSingleAppAsWorkspace } from "../workspace-zoqRbihZ.mjs";
2
2
 
3
3
  export { PHASE_2_DEPLOY_TARGETS, PUBLIC_ENV_PREFIXES, SUPPORTED_DEPLOY_TARGETS, WorkspaceConfigSchema, allConstructGlobs, appConstructGlobs, constructPatterns, defineWorkspace, formatValidationErrors, getAppBuildOrder, getAppGkmConfig, getDependencyEnvVars, getDeployTargetError, getEndpointForStage, getPublicEnvPrefix, isDeployTargetSupported, isPhase2DeployTarget, isWorkspaceConfig, normalizeWorkspace, processConfig, safeValidateWorkspaceConfig, stripPublicPrefix, validateWorkspaceConfig, workspaceConstructGlobs, wrapSingleAppAsWorkspace };
@@ -0,0 +1,8 @@
1
+ import "./discover-CAlFgYec.mjs";
2
+ import "./config-DVVph9yz.mjs";
3
+ import "./workspace-zoqRbihZ.mjs";
4
+ import { constructGlobs, derivedContainers, imagePins, reconcileWorkspace, usesConstructs } from "./credentials-dP8vRVRv.mjs";
5
+ import "./generator-VE2JrFlY.mjs";
6
+ import "./storage-Bi24WfoW.mjs";
7
+
8
+ export { derivedContainers, reconcileWorkspace };
@@ -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
  };
@@ -6448,6 +6506,7 @@ function wrapSingleAppAsWorkspace(config$1, cwd) {
6448
6506
  ...config$1.deploy
6449
6507
  },
6450
6508
  shared: { packages: [] },
6509
+ stages: validateStages(config$1.stages),
6451
6510
  secrets: {}
6452
6511
  };
6453
6512
  }
@@ -6528,6 +6587,7 @@ function getAppGkmConfig(workspace, appName) {
6528
6587
  if (!app || app.type !== "backend") return void 0;
6529
6588
  return {
6530
6589
  services: workspace.services,
6590
+ stages: workspace.stages,
6531
6591
  constructs: appConstructGlobs(workspace, appName),
6532
6592
  providers: app.providers,
6533
6593
  hooks: app.hooks,
@@ -6650,6 +6710,12 @@ Object.defineProperty(exports, 'appConstructGlobs', {
6650
6710
  return appConstructGlobs;
6651
6711
  }
6652
6712
  });
6713
+ Object.defineProperty(exports, 'assertDeployedStage', {
6714
+ enumerable: true,
6715
+ get: function () {
6716
+ return assertDeployedStage;
6717
+ }
6718
+ });
6653
6719
  Object.defineProperty(exports, 'constructPatterns', {
6654
6720
  enumerable: true,
6655
6721
  get: function () {
@@ -6662,6 +6728,12 @@ Object.defineProperty(exports, 'defineWorkspace', {
6662
6728
  return defineWorkspace;
6663
6729
  }
6664
6730
  });
6731
+ Object.defineProperty(exports, 'deployedProblems', {
6732
+ enumerable: true,
6733
+ get: function () {
6734
+ return deployedProblems;
6735
+ }
6736
+ });
6665
6737
  Object.defineProperty(exports, 'formatValidationErrors', {
6666
6738
  enumerable: true,
6667
6739
  get: function () {
@@ -6740,6 +6812,12 @@ Object.defineProperty(exports, 'safeValidateWorkspaceConfig', {
6740
6812
  return safeValidateWorkspaceConfig;
6741
6813
  }
6742
6814
  });
6815
+ Object.defineProperty(exports, 'stageProblems', {
6816
+ enumerable: true,
6817
+ get: function () {
6818
+ return stageProblems;
6819
+ }
6820
+ });
6743
6821
  Object.defineProperty(exports, 'stripPublicPrefix', {
6744
6822
  enumerable: true,
6745
6823
  get: function () {
@@ -6764,4 +6842,4 @@ Object.defineProperty(exports, 'wrapSingleAppAsWorkspace', {
6764
6842
  return wrapSingleAppAsWorkspace;
6765
6843
  }
6766
6844
  });
6767
- //# sourceMappingURL=workspace-LKiNyaDy.cjs.map
6845
+ //# sourceMappingURL=workspace-C6VJQVtG.cjs.map