@catladder/cli 5.6.0 → 5.7.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 (64) hide show
  1. package/dist/apps/cli/src/catci.js +22 -0
  2. package/dist/apps/cli/src/catci.js.map +1 -1
  3. package/dist/apps/cli/src/commands/index.d.ts +1 -0
  4. package/dist/apps/cli/src/commands/index.js +4 -1
  5. package/dist/apps/cli/src/commands/index.js.map +1 -1
  6. package/dist/apps/cli/src/commands/project/commandMrPin.d.ts +9 -0
  7. package/dist/apps/cli/src/commands/project/commandMrPin.js +11 -13
  8. package/dist/apps/cli/src/commands/project/commandMrPin.js.map +1 -1
  9. package/dist/apps/cli/src/commands/project/commandMrReviewApp.d.ts +21 -0
  10. package/dist/apps/cli/src/commands/project/commandMrReviewApp.js +102 -0
  11. package/dist/apps/cli/src/commands/project/commandMrReviewApp.js.map +1 -0
  12. package/dist/apps/cli/src/reviewApps/github.d.ts +10 -0
  13. package/dist/apps/cli/src/reviewApps/github.js +196 -0
  14. package/dist/apps/cli/src/reviewApps/github.js.map +1 -0
  15. package/dist/bundles/catci/index.js +4 -4
  16. package/dist/bundles/catenv/index.js +897 -25
  17. package/dist/bundles/cli/index.js +1021 -39
  18. package/dist/bundles/skills/catladder-cli/references/commands.md +13 -0
  19. package/dist/bundles/skills/catladder-config/SKILL.md +4 -0
  20. package/dist/bundles/skills/catladder-deploys/SKILL.md +6 -0
  21. package/dist/bundles/skills/catladder-pipelines/SKILL.md +79 -1
  22. package/dist/packages/pipeline/src/backends/github/GithubBackend.js +60 -3
  23. package/dist/packages/pipeline/src/backends/github/GithubBackend.js.map +1 -1
  24. package/dist/packages/pipeline/src/backends/github/aggregateCheckJob.d.ts +1 -1
  25. package/dist/packages/pipeline/src/backends/github/aggregateCheckJob.js +22 -8
  26. package/dist/packages/pipeline/src/backends/github/aggregateCheckJob.js.map +1 -1
  27. package/dist/packages/pipeline/src/backends/github/reviewDeployWorkflow.d.ts +128 -0
  28. package/dist/packages/pipeline/src/backends/github/reviewDeployWorkflow.js +510 -0
  29. package/dist/packages/pipeline/src/backends/github/reviewDeployWorkflow.js.map +1 -0
  30. package/dist/packages/pipeline/src/backends/gitlab/GitlabBackend.js +29 -4
  31. package/dist/packages/pipeline/src/backends/gitlab/GitlabBackend.js.map +1 -1
  32. package/dist/packages/pipeline/src/backends/gitlab/createGitlabPipeline.d.ts +11 -1
  33. package/dist/packages/pipeline/src/backends/gitlab/createGitlabPipeline.js +17 -5
  34. package/dist/packages/pipeline/src/backends/gitlab/createGitlabPipeline.js.map +1 -1
  35. package/dist/packages/pipeline/src/backends/gitlab/reviewDeployGate.d.ts +26 -0
  36. package/dist/packages/pipeline/src/backends/gitlab/reviewDeployGate.js +94 -0
  37. package/dist/packages/pipeline/src/backends/gitlab/reviewDeployGate.js.map +1 -0
  38. package/dist/packages/pipeline/src/deploy/base/deploy.js +10 -3
  39. package/dist/packages/pipeline/src/deploy/base/deploy.js.map +1 -1
  40. package/dist/packages/pipeline/src/index.d.ts +1 -0
  41. package/dist/packages/pipeline/src/index.js +1 -0
  42. package/dist/packages/pipeline/src/index.js.map +1 -1
  43. package/dist/packages/pipeline/src/pipeline/resolveRequirements.d.ts +2 -0
  44. package/dist/packages/pipeline/src/pipeline/resolveRequirements.js +3 -2
  45. package/dist/packages/pipeline/src/pipeline/resolveRequirements.js.map +1 -1
  46. package/dist/packages/pipeline/src/reviewApps.d.ts +38 -0
  47. package/dist/packages/pipeline/src/reviewApps.js +86 -0
  48. package/dist/packages/pipeline/src/reviewApps.js.map +1 -0
  49. package/dist/packages/pipeline/src/reviewAppsPolicy.d.ts +46 -0
  50. package/dist/packages/pipeline/src/reviewAppsPolicy.js +37 -0
  51. package/dist/packages/pipeline/src/reviewAppsPolicy.js.map +1 -0
  52. package/dist/packages/pipeline/src/types/config.d.ts +55 -0
  53. package/dist/packages/pipeline/src/types/config.js.map +1 -1
  54. package/dist/skills/catladder-cli/references/commands.md +13 -0
  55. package/dist/skills/catladder-config/SKILL.md +4 -0
  56. package/dist/skills/catladder-deploys/SKILL.md +6 -0
  57. package/dist/skills/catladder-pipelines/SKILL.md +79 -1
  58. package/dist/tsconfig.tsbuildinfo +1 -1
  59. package/package.json +1 -1
  60. package/src/catci.ts +29 -0
  61. package/src/commands/index.ts +4 -0
  62. package/src/commands/project/commandMrPin.ts +15 -14
  63. package/src/commands/project/commandMrReviewApp.ts +143 -0
  64. package/src/reviewApps/github.ts +253 -0
@@ -86,6 +86,19 @@ pin the review apps of a merge request (disable their auto-stop) by adding the p
86
86
  - `mr` (positional): merge request IID (defaults to the open MR of the current branch)
87
87
  - `--pipeline`: trigger a merge-request pipeline so the pin takes effect immediately
88
88
 
89
+ ## `catladder mr review-app-off [mr]`
90
+
91
+ stop deploying the review apps of a merge request: switches the reviewApps label off (opt-in: removes it, opt-out: adds the skip label). Running review apps stay until the MR closes or they auto-stop
92
+
93
+ - `mr` (positional): merge request IID (defaults to the open MR of the current branch)
94
+
95
+ ## `catladder mr review-app-on [mr]`
96
+
97
+ deploy the review apps of a merge request: switches the reviewApps label on (opt-in: adds it, opt-out: removes the skip label) and triggers a pipeline, since gitlab doesn't start one for label changes
98
+
99
+ - `mr` (positional): merge request IID (defaults to the open MR of the current branch)
100
+ - `--pipeline`: trigger a merge-request pipeline so the review apps deploy now
101
+
89
102
  ## `catladder mr unpin [mr]`
90
103
 
91
104
  unpin the review apps of a merge request — the auto-stop timer re-arms with the next deploy
@@ -104,6 +104,10 @@ Key concepts:
104
104
  affects both). The object form separates the axes:
105
105
  `inherit: { config: "dev" }` inherits config only,
106
106
  `inherit: { config: "dev", secrets: "dev" }` both.
107
+ - **Review apps**: top-level `reviewApps: { deploy, label, skipLabel,
108
+ drafts }` decides whether merge/pull requests deploy their review
109
+ apps — every MR/PR (default), opt-in or opt-out by label, or on
110
+ request; and what drafts run. See the `catladder-pipelines` skill.
107
111
  - **Pipelines**: `pipelines: { gitlab: true, github: true }` selects
108
112
  which CI systems get generated files. Options objects instead of
109
113
  `true` allow per-pipeline settings (e.g. `runnerVariables`,
@@ -46,6 +46,12 @@ is `auto`.** Set per component or per environment (`env.<name>.deploy`).
46
46
  `waitFor: ["otherComponent"]` (experimental) makes a deploy wait for
47
47
  another component to deploy first.
48
48
 
49
+ Whether merge/pull requests deploy review apps at all (opt-in/opt-out
50
+ by label, drafts, deploy on request for all components at once) is the
51
+ project-wide top-level `reviewApps` config — see the
52
+ `catladder-pipelines` skill. With it set, per-component `when` of the
53
+ review env is ignored.
54
+
49
55
  ## Environment lifetimes
50
56
 
51
57
  Review apps auto-stop after 1 week, dev environments after 4 weeks
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: catladder-pipelines
3
- description: Understanding and debugging the CI/CD pipelines catladder generates (GitLab CI and GitHub Actions) — pipeline triggers, stages, environments, caching, job images, releases, and infrastructure drift. Use when investigating failing CI jobs, when asked why/when a job runs, when changing caching or job behavior, when deployments misbehave, or when a review app stopped/expired or should be kept alive (pinning). Triggers on "pipeline", "CI job", "gitlab-ci", "workflow", "deploy failed", "cache", "release", "auto-stop", "review app stopped", "pin review app", "keep review app".
3
+ description: Understanding and debugging the CI/CD pipelines catladder generates (GitLab CI and GitHub Actions) — pipeline triggers, stages, environments, caching, job images, releases, and infrastructure drift. Use when investigating failing CI jobs, when asked why/when a job runs, when changing caching or job behavior, when deployments misbehave, when a review app should (not) be deployed for a merge/pull request (opt-in/opt-out labels, drafts, deploy on request), or when a review app stopped/expired or should be kept alive (pinning). Triggers on "pipeline", "CI job", "gitlab-ci", "workflow", "deploy failed", "cache", "release", "auto-stop", "review app stopped", "pin review app", "keep review app", "deploy review app", "review app label", "skip review app", "draft PR", "reviewApps".
4
4
  ---
5
5
 
6
6
  # How catladder pipelines work
@@ -82,6 +82,84 @@ started keeps _itself_ alive — under gitlab's own default
82
82
  (`conservative`, which catladder overrides) it would shield the whole
83
83
  pipeline from cancellation.
84
84
 
85
+ ## When review apps deploy (`reviewApps`)
86
+
87
+ By default every merge/pull request deploys its review apps. Projects
88
+ with many MRs/PRs (e.g. opened by agents) can put the review delivery
89
+ chains — docker image → deploy → verify, for all components — behind
90
+ ONE switch per MR/PR with the top-level `reviewApps` config. Tests,
91
+ lint and audit always run; only the delivery waits.
92
+
93
+ ```ts
94
+ reviewApps: {
95
+ deploy: "optIn", // auto (default) | manual | optIn | optOut
96
+ // label: "catladder:review-app", // optIn label (default)
97
+ // skipLabel: "catladder:no-review-app", // optOut label (default)
98
+ drafts: "checksOnly", // likeReady (default) | checksOnly (no review apps) | skip (no pipeline)
99
+ },
100
+ ```
101
+
102
+ - `optIn`: deploys only while the MR/PR carries `label`.
103
+ - `optOut`: deploys unless it carries `skipLabel`.
104
+ - `manual`: never on its own — only on request.
105
+ - `drafts: "checksOnly"`: drafts run tests, lint and audit only, the review apps deploy once the
106
+ MR/PR is marked ready; `"skip"`: drafts run nothing.
107
+ - Per-component `deploy.when` of the review env is ignored then.
108
+
109
+ **GitHub** — like gitlab, the review workflow decides at its start
110
+ from the PR's labels and draft state: when the policy says deploy, the
111
+ chains run in the same run (one app build). Whatever changes later goes
112
+ through the `▶️ catladder deploy review` workflow
113
+ (`catladder-deploy-review.yml`, which rebuilds the app):
114
+
115
+ - when the review workflow is green but didn't deploy, its last job
116
+ (`▶️ trigger review deploy`) reads the PR's labels/draft state again
117
+ and dispatches the deploy if the policy now says so — a label set
118
+ while CI ran counts;
119
+ - switching the label on (opt-in: add `label`, opt-out: remove
120
+ `skipLabel`) deploys right away if the PR's `catladder ✅` is green;
121
+ switching it off stops the review apps (`🛑 catladder stop review
122
+ app`), and so does closing the PR — the stop first waits for a
123
+ review run of the PR that may still be deploying (on close it
124
+ cancels it), so a late deploy can't outlive the teardown;
125
+ - on request, any time (agents included):
126
+ `gh workflow run catladder-deploy-review.yml --ref <pr-branch> -f pr=<number>`
127
+ — explicit requests always deploy, but need the PR open and its CI
128
+ green (the run reuses the green CI instead of re-running tests);
129
+ - merge gates wait for **`catladder review app ✅`** (stable name,
130
+ independent of the components), the last job of whichever run
131
+ deploys. It also sets the commit status `catladder review app` on
132
+ the PR head (`success`/`failure`; the deploy workflow marks it
133
+ `pending` first) — dispatched runs are attached to the commit but not
134
+ listed on the pull request, the commit status is. A run that doesn't
135
+ deploy, or is cancelled (superseded, stopped), reports nothing — a
136
+ gate must treat a missing or `pending` status on the current head as
137
+ "wait". In the review run a skipped chain doesn't
138
+ fail `catladder ✅`, a failed one does;
139
+ - `gh pr edit <number> --add-label catladder:review-app` is the
140
+ agent-friendly opt-in. Labels set with the workflow's own
141
+ `GITHUB_TOKEN` (from inside a workflow) trigger nothing — use a user
142
+ or app token;
143
+ - the dispatch only works once the workflow exists on the default
144
+ branch (github rule) — the PR introducing `reviewApps` can't dispatch
145
+ yet.
146
+
147
+ A single component with `env.review.deploy.when: "manual"` (and no
148
+ `reviewApps`) uses the same workflow for just that component, without
149
+ the automatic trigger.
150
+
151
+ **GitLab** — a `🚀 deploy review` job in the MR pipeline is the
152
+ switch: the docker and deploy jobs of all components `need` it. The
153
+ policy decides whether it starts on its own (label set / opt-out not
154
+ set) or waits as a manual job; playing it any time deploys (early
155
+ clicks wait for builds and tests). It has `allow_failure: true`, so an
156
+ unplayed switch leaves the pipeline green. Label changes don't start
157
+ a pipeline on gitlab — use `yarn catladder mr review-app-on` (sets the
158
+ label and triggers a pipeline) / `mr review-app-off`. Drafts are
159
+ detected by their title prefix (`Draft:`, `[Draft]`, `(Draft)`); with
160
+ `drafts: "skip"` marking an MR ready starts no pipeline, the next push
161
+ does.
162
+
85
163
  ## Review-app auto-stop and pinning (GitLab)
86
164
 
87
165
  GitLab review environments stop automatically after 1 week, dev