@catladder/cli 5.4.1 → 5.5.0

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 (26) hide show
  1. package/dist/bundles/catenv/index.js +26 -8
  2. package/dist/bundles/cli/index.js +26 -8
  3. package/dist/bundles/skills/catladder-config/SKILL.md +18 -7
  4. package/dist/bundles/skills/catladder-pipelines/SKILL.md +21 -18
  5. package/dist/packages/pipeline/src/config/configruedEnvs.js +7 -1
  6. package/dist/packages/pipeline/src/config/configruedEnvs.js.map +1 -1
  7. package/dist/packages/pipeline/src/context/getEnvInherit.d.ts +2 -2
  8. package/dist/packages/pipeline/src/context/getEnvInherit.js +5 -2
  9. package/dist/packages/pipeline/src/context/getEnvInherit.js.map +1 -1
  10. package/dist/packages/pipeline/src/context/getEnvInstance.d.ts +2 -2
  11. package/dist/packages/pipeline/src/context/getEnvInstance.js.map +1 -1
  12. package/dist/packages/pipeline/src/context/getEnvOn.d.ts +2 -2
  13. package/dist/packages/pipeline/src/context/getEnvOn.js +1 -1
  14. package/dist/packages/pipeline/src/context/getEnvOn.js.map +1 -1
  15. package/dist/packages/pipeline/src/context/getEnvType.d.ts +3 -3
  16. package/dist/packages/pipeline/src/context/getEnvType.js +1 -1
  17. package/dist/packages/pipeline/src/context/getEnvType.js.map +1 -1
  18. package/dist/packages/pipeline/src/context/getEnvironmentContext.js +3 -2
  19. package/dist/packages/pipeline/src/context/getEnvironmentContext.js.map +1 -1
  20. package/dist/packages/pipeline/src/types/config.d.ts +20 -2
  21. package/dist/packages/pipeline/src/types/config.js +9 -1
  22. package/dist/packages/pipeline/src/types/config.js.map +1 -1
  23. package/dist/skills/catladder-config/SKILL.md +18 -7
  24. package/dist/skills/catladder-pipelines/SKILL.md +21 -18
  25. package/dist/tsconfig.tsbuildinfo +1 -1
  26. package/package.json +1 -1
@@ -170,7 +170,10 @@ export type EnvironmentConfig = {
170
170
  * `{ branch: "next" }` deploys the env on pushes to that branch —
171
171
  * one stable environment tracking a long-lived branch.
172
172
  *
173
- * `false` removes the env from all pipelines.
173
+ * `false` keeps the env but never deploys it from a pipeline (like
174
+ * `local`): it still exists for `catladder project setup`, secrets and
175
+ * catenv. To remove an env from the project entirely, disable it
176
+ * instead: `environments: { stage: false }`.
174
177
  */
175
178
  on?: EnvOnConfig;
176
179
  /**
@@ -220,6 +223,18 @@ export type EnvironmentConfig = {
220
223
  * Inheriting from `local` is not possible, chains are followed, cycles
221
224
  * are an error.
222
225
  */
226
+ /**
227
+ * the top-level `environments` config: per env either its project-wide
228
+ * declaration/tuning, or `false` to disable the env for the whole
229
+ * project (all components, setup, secrets, pipelines, catenv).
230
+ */
231
+ export type EnvironmentsConfig = Record<string, EnvironmentConfig | false>;
232
+ /**
233
+ * the project-wide config of `env` (undefined when not declared or
234
+ * disabled)
235
+ */
236
+ export declare const getEnvironmentConfig: (environments: EnvironmentsConfig | undefined, env: string) => EnvironmentConfig | undefined;
237
+ export declare const isEnvironmentDisabled: (environments: EnvironmentsConfig | undefined, env: string) => boolean;
223
238
  export type EnvironmentInheritConfig = string | {
224
239
  /** env whose per-component config overrides are inherited */
225
240
  config?: string;
@@ -430,8 +445,11 @@ export type Config<C extends ConfigProps = never> = {
430
445
  * - declare an extra env (every component deploys to it unless it
431
446
  * opts out with `env.<name>: false`):
432
447
  * `environments: { next: { type: "dev", on: { branch: "next" } } }`
448
+ * - disable an env for the whole project (no setup, secrets, jobs or
449
+ * catenv for any component): `environments: { stage: false }`.
450
+ * A single component opts out with `env.<name>: false` instead.
433
451
  */
434
- environments?: Record<string, EnvironmentConfig>;
452
+ environments?: EnvironmentsConfig;
435
453
  /**
436
454
  * components (sub apps)
437
455
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isKnowEnvType = exports.DEFAULT_ENV_TYPES = exports.DEFAULT_ENVS = exports.ENV_TYPES = exports.envTriggerEquals = exports.isBranchTrigger = exports.ALL_PIPELINE_TRIGGERS = void 0;
3
+ exports.isEnvironmentDisabled = exports.getEnvironmentConfig = exports.isKnowEnvType = exports.DEFAULT_ENV_TYPES = exports.DEFAULT_ENVS = exports.ENV_TYPES = exports.envTriggerEquals = exports.isBranchTrigger = exports.ALL_PIPELINE_TRIGGERS = void 0;
4
4
  exports.ALL_PIPELINE_TRIGGERS = [
5
5
  "mainBranch",
6
6
  "mr",
@@ -43,4 +43,12 @@ const isKnowEnvType = (env) => {
43
43
  return env in exports.ENV_TYPES;
44
44
  };
45
45
  exports.isKnowEnvType = isKnowEnvType;
46
+ /**
47
+ * the project-wide config of `env` (undefined when not declared or
48
+ * disabled)
49
+ */
50
+ const getEnvironmentConfig = (environments, env) => (environments === null || environments === void 0 ? void 0 : environments[env]) || undefined;
51
+ exports.getEnvironmentConfig = getEnvironmentConfig;
52
+ const isEnvironmentDisabled = (environments, env) => (environments === null || environments === void 0 ? void 0 : environments[env]) === false;
53
+ exports.isEnvironmentDisabled = isEnvironmentDisabled;
46
54
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/types/config.ts"],"names":[],"mappings":";;;AAea,QAAA,qBAAqB,GAAG;IACnC,YAAY;IACZ,IAAI;IACJ,eAAe;CACP,CAAC;AAoBJ,MAAM,eAAe,GAAG,CAC7B,OAA2B,EACO,EAAE,CACpC,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,IAAI,QAAQ,IAAI,OAAO,CAAC;AAH5D,QAAA,eAAe,mBAG6C;AAElE,MAAM,gBAAgB,GAAG,CAC9B,CAA0B,EAC1B,CAAqB,EACZ,EAAE;IACX,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;IACjD,IAAI,IAAA,uBAAe,EAAC,CAAC,CAAC;QAAE,OAAO,IAAA,uBAAe,EAAC,CAAC,CAAC,IAAI,CAAC,CAAC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e,EAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,CAAC;IAC3E,OAAO,CAAC,KAAK,CAAC,CAAC;AACjB,CAAC,CAAC;AAPW,QAAA,gBAAgB,oBAO3B;AAEF;;;GAGG;AACU,QAAA,SAAS,GAAG;IACvB,GAAG,EAAE;QACH,QAAQ,EAAE,CAAC,YAAY,CAAC;KACzB;IACD,MAAM,EAAE;QACN,QAAQ,EAAE,CAAC,IAAI,CAAC;KACjB;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,CAAC,eAAe,CAAC;KAC5B;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,CAAC,eAAe,CAAC;KAC5B;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,EAAE;KACb;CACO,CAAC;AAEE,QAAA,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,iBAAS,CAAC,CAAC;AACtC,QAAA,iBAAiB,GAAG,oBAAyB,CAAC;AAGpD,MAAM,aAAa,GAAG,CAAC,GAAW,EAAkB,EAAE;IAC3D,OAAO,GAAG,IAAI,iBAAS,CAAC;AAC1B,CAAC,CAAC;AAFW,QAAA,aAAa,iBAExB;AAmMF;;;GAGG;AACI,MAAM,oBAAoB,GAAG,CAClC,YAA4C,EAC5C,GAAW,EACoB,EAAE,CAAC,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAG,GAAG,CAAC,KAAI,SAAS,CAAC;AAHxD,QAAA,oBAAoB,wBAGoC;AAE9D,MAAM,qBAAqB,GAAG,CACnC,YAA4C,EAC5C,GAAW,EACF,EAAE,CAAC,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAG,GAAG,CAAC,MAAK,KAAK,CAAC;AAH/B,QAAA,qBAAqB,yBAGU"}
@@ -33,20 +33,23 @@ const config = {
33
33
  appName: "my-app",
34
34
  customerName: "pan",
35
35
  pipelines: { gitlab: true, github: true }, // which CI systems to generate
36
- environments: { // optional: project-wide env declarations/tuning
36
+ environments: {
37
+ // optional: project-wide env declarations/tuning
37
38
  review: { autoStop: "3 days" },
39
+ stage: false, // the project has no stage env (any component)
38
40
  next: { type: "dev", on: { branch: "next" } }, // extra branch-tracking env
39
41
  },
40
42
  components: {
41
43
  www: {
42
- dir: "frontend", // working directory of this component
43
- vars: { public: {}, secret: [] }, // env vars (see catladder-secrets skill)
44
- build: { type: "node" }, // node | rails | meteor | custom — see catladder-builds
44
+ dir: "frontend", // working directory of this component
45
+ vars: { public: {}, secret: [] }, // env vars (see catladder-secrets skill)
46
+ build: { type: "node" }, // node | rails | meteor | custom — see catladder-builds
45
47
  deploy: { type: "kubernetes" }, // kubernetes | google-cloudrun | dockerTag | custom — see catladder-deploys
46
- env: { // enable/customize per environment
48
+ env: {
49
+ // enable/customize per environment
47
50
  review: {},
48
51
  dev: {},
49
- stage: false, // false disables the env for this component
52
+ stage: false, // false disables the env for this component only
50
53
  prod: {},
51
54
  },
52
55
  },
@@ -68,9 +71,17 @@ Key concepts:
68
71
  per-component `env.<name>` entries only carry component-local
69
72
  overrides (vars, deploy settings, host, autoStop) or `false` to opt
70
73
  the component out. In `environments`:
74
+ - `<name>: false` — disables the env for the whole project: no
75
+ component has it, so no setup contexts (`catladder project setup`),
76
+ secrets, pipeline jobs/workflows or catenv for it. This is how to
77
+ say "this project has no stage": `environments: { stage: false }`
78
+ (not `on: false`). `local` cannot be disabled; inheriting from a
79
+ disabled env is an error.
71
80
  - `on` — when the env deploys: `"mainBranch"`, `"mr"`,
72
81
  `"taggedRelease"`, `{ branch: "next" }` (a stable env deploying on
73
- pushes to that branch), or `false` (in no pipeline). `on: "mr"`
82
+ pushes to that branch), or `false` (never deployed by a pipeline —
83
+ the env still exists for setup, secrets and catenv; use
84
+ `environments.<name>: false` to remove it). `on: "mr"`
74
85
  makes an env a review app (one instance per MR/PR, torn down on
75
86
  close). Defaults from the env type.
76
87
  - `autoStop` — how long a stoppable environment stays up after its
@@ -11,12 +11,12 @@ generated YAML.
11
11
 
12
12
  ## Triggers and environments
13
13
 
14
- | Trigger | Runs on | Deploys to (default) |
15
- |---|---|---|
16
- | `mainBranch` | push to the main branch | `dev` |
17
- | `mr` | merge/pull requests | `review` (one app per MR/PR) |
18
- | `taggedRelease` | git tags | `stage`, `prod` |
19
- | `{ branch: "<name>" }` | push to that branch | envs declaring it via `on` |
14
+ | Trigger | Runs on | Deploys to (default) |
15
+ | ---------------------- | ----------------------- | ---------------------------- |
16
+ | `mainBranch` | push to the main branch | `dev` |
17
+ | `mr` | merge/pull requests | `review` (one app per MR/PR) |
18
+ | `taggedRelease` | git tags | `stage`, `prod` |
19
+ | `{ branch: "<name>" }` | push to that branch | envs declaring it via `on` |
20
20
 
21
21
  The trigger of each env is its `on` in the top-level `environments`
22
22
  config (project-wide — components cannot diverge), defaulting from the
@@ -25,6 +25,9 @@ own pipeline (gitlab: rules on `$CI_COMMIT_BRANCH`; github: a
25
25
  `catladder-branch-<name>.yml` workflow) and deploys as one stable,
26
26
  branch-tracking environment — unlike review apps, it is not
27
27
  per-instance and is stopped via the manual stop job/workflow.
28
+ `on: false` keeps an env out of every pipeline but the env still exists
29
+ (setup, secrets, catenv); `environments: { <name>: false }` removes it
30
+ entirely.
28
31
 
29
32
  Generated layout:
30
33
 
@@ -34,12 +37,12 @@ Generated layout:
34
37
  "generated by catladder" header; others are unmanaged). Manual
35
38
  actions are per-kind `workflow_dispatch` workflows, visually grouped
36
39
  by their emoji prefix in the Actions sidebar: `🚀 catladder create
37
- release`, `▶️ catladder deploy` (manual-gated deploys), `🛑 catladder
38
- stop`, `↩️ catladder rollback` — when all of a kind's tasks target one
40
+ release`, `▶️ catladder deploy` (manual-gated deploys), `🛑 catladder
41
+ stop`, `↩️ catladder rollback` — when all of a kind's tasks target one
39
42
  env the name carries it (e.g. `▶️ catladder deploy prod`); otherwise
40
43
  pick the task from the workflow's dropdown. Review apps are stopped
41
44
  automatically when their pull request closes (`🛑 catladder stop
42
- review app`); the same workflow can be dispatched with a PR number to
45
+ review app`); the same workflow can be dispatched with a PR number to
43
46
  tear one down while the pull request is still open (gitlab runs these as manual jobs inside the pipeline
44
47
  instead).
45
48
 
@@ -51,22 +54,22 @@ plus stop jobs for review-app teardown.
51
54
  Pushing a new commit cancels the pipeline of the previous one, so the
52
55
  runners are not busy with results nobody will read.
53
56
 
54
- | Pipeline | On a new commit |
55
- |---|---|
56
- | `mr` | cancelled |
57
- | `mainBranch` (dev) | cancelled, except a release already running |
58
- | `taggedRelease` | **runs through** — never cancelled |
59
- | agent runs (`trigger`) | **runs through** — never cancelled |
57
+ | Pipeline | On a new commit |
58
+ | ---------------------- | ------------------------------------------- |
59
+ | `mr` | cancelled |
60
+ | `mainBranch` (dev) | cancelled, except a release already running |
61
+ | `taggedRelease` | **runs through** — never cancelled |
62
+ | agent runs (`trigger`) | **runs through** — never cancelled |
60
63
 
61
64
  - **GitHub**: the generated MR workflow sets `concurrency` with
62
65
  `cancel-in-progress: true`.
63
66
  - **GitLab**: generated `workflow:auto_cancel:on_new_commit:
64
- interruptible`, with per-rule `none` for tags and agent runs. Every
67
+ interruptible`, with per-rule `none` for tags and agent runs. Every
65
68
  job carries an explicit `interruptible`, jobs that must finish
66
69
  (release jobs, agent jobs) carry `interruptible: false`.
67
70
 
68
71
  **GitLab requires the project setting too.** The generated YAML only
69
- tunes *how* redundant pipelines are cancelled — it does not switch the
72
+ tunes _how_ redundant pipelines are cancelled — it does not switch the
70
73
  feature on. If old pipelines keep running, check **Settings > CI/CD >
71
74
  General pipelines > Auto-cancel redundant pipelines**; with that
72
75
  checkbox off nothing is ever cancelled. (`catladder project-doctor`
@@ -74,7 +77,7 @@ does not check this.)
74
77
 
75
78
  **Adding a hand-written GitLab job?** Set `interruptible` explicitly.
76
79
  GitLab defaults it to `false`, and a non-interruptible job that has
77
- started keeps *itself* alive — under gitlab's own default
80
+ started keeps _itself_ alive — under gitlab's own default
78
81
  (`conservative`, which catladder overrides) it would shield the whole
79
82
  pipeline from cancellation.
80
83