@catladder/cli 0.0.0-next-80fd0ab4 → 0.0.0-next-ebc933f2

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 (35) hide show
  1. package/dist/bundles/catenv/index.js +223 -1
  2. package/dist/bundles/cli/index.js +223 -1
  3. package/dist/bundles/skills/catladder-cli/SKILL.md +53 -0
  4. package/dist/bundles/skills/catladder-cli/references/commands.md +273 -0
  5. package/dist/bundles/skills/catladder-config/SKILL.md +82 -0
  6. package/dist/bundles/skills/catladder-pipelines/SKILL.md +72 -0
  7. package/dist/bundles/skills/catladder-secrets/SKILL.md +74 -0
  8. package/dist/cli/src/scripts/generateCliSkillReference.d.ts +1 -0
  9. package/dist/cli/src/scripts/generateCliSkillReference.js +87 -0
  10. package/dist/cli/src/scripts/generateCliSkillReference.js.map +1 -0
  11. package/dist/pipeline/src/agentSkills/generateAgentSkills.d.ts +22 -0
  12. package/dist/pipeline/src/agentSkills/generateAgentSkills.js +82 -0
  13. package/dist/pipeline/src/agentSkills/generateAgentSkills.js.map +1 -0
  14. package/dist/pipeline/src/agentSkills/index.d.ts +3 -0
  15. package/dist/pipeline/src/agentSkills/index.js +27 -0
  16. package/dist/pipeline/src/agentSkills/index.js.map +1 -0
  17. package/dist/pipeline/src/agentSkills/shippedSkills.d.ts +22 -0
  18. package/dist/pipeline/src/agentSkills/shippedSkills.js +56 -0
  19. package/dist/pipeline/src/agentSkills/shippedSkills.js.map +1 -0
  20. package/dist/pipeline/src/agentSkills/types.d.ts +22 -0
  21. package/dist/pipeline/src/agentSkills/types.js +25 -0
  22. package/dist/pipeline/src/agentSkills/types.js.map +1 -0
  23. package/dist/pipeline/src/constants.js +1 -1
  24. package/dist/pipeline/src/pipeline/generatePipelineFiles.js +4 -0
  25. package/dist/pipeline/src/pipeline/generatePipelineFiles.js.map +1 -1
  26. package/dist/pipeline/src/types/config.d.ts +15 -0
  27. package/dist/pipeline/src/types/config.js.map +1 -1
  28. package/dist/skills/catladder-cli/SKILL.md +53 -0
  29. package/dist/skills/catladder-cli/references/commands.md +273 -0
  30. package/dist/skills/catladder-config/SKILL.md +82 -0
  31. package/dist/skills/catladder-pipelines/SKILL.md +72 -0
  32. package/dist/skills/catladder-secrets/SKILL.md +74 -0
  33. package/dist/tsconfig.tsbuildinfo +1 -1
  34. package/package.json +4 -2
  35. package/src/scripts/generateCliSkillReference.ts +102 -0
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: catladder-config
3
+ description: Working with catladder, the framework that generates this repository's CI/CD pipelines (GitLab CI and/or GitHub Actions) from catladder.ts. Use when editing catladder.ts, adding or changing components, builds, deploys, environments or env vars, or when a change to generated pipeline files (.catladder-generated/, .gitlab-ci.yml, .github/workflows/) seems needed. Triggers on "catladder", "catladder.ts", "add a component", "change the pipeline", "deploy config".
4
+ ---
5
+
6
+ # Working with catladder
7
+
8
+ catladder generates this repository's CI/CD pipelines, deployments and
9
+ environment files from the TypeScript config `catladder.ts` at the repo
10
+ root. It is installed per project (`@catladder/cli`) — always use the
11
+ locally installed version (`yarn catenv`, `yarn catladder`).
12
+
13
+ ## Golden rules
14
+
15
+ 1. **Never hand-edit generated files.** Everything under
16
+ `.catladder-generated/`, the generated parts of `.gitlab-ci.yml`, and
17
+ catladder-generated workflows under `.github/workflows/` are
18
+ overwritten on every regeneration (they carry a "generated by
19
+ catladder" header). To change them, change `catladder.ts` and
20
+ regenerate.
21
+ 2. **Regenerate after every `catladder.ts` change** by running
22
+ `yarn catenv`. With direnv set up, re-entering the project directory
23
+ does this automatically.
24
+ 3. **Commit the regenerated files together with the config change.**
25
+ Generated files are checked in; CI includes them directly.
26
+
27
+ ## Structure of catladder.ts
28
+
29
+ ```ts
30
+ import type { Config } from "@catladder/cli";
31
+
32
+ const config = {
33
+ appName: "my-app",
34
+ customerName: "pan",
35
+ pipelines: { gitlab: true, github: true }, // which CI systems to generate
36
+ components: {
37
+ www: {
38
+ dir: "frontend", // working directory of this component
39
+ vars: { public: {}, secret: [] }, // env vars (see catladder-secrets skill)
40
+ build: { type: "node" }, // build types: node | rails | base
41
+ deploy: { type: "kubernetes" }, // kubernetes | google-cloudrun | dockerTag | custom
42
+ env: { // enable/customize per environment
43
+ review: {},
44
+ dev: {},
45
+ stage: false, // false disables the env for this component
46
+ prod: {},
47
+ },
48
+ },
49
+ },
50
+ } satisfies Config;
51
+
52
+ export default config;
53
+ ```
54
+
55
+ Key concepts:
56
+
57
+ - **Components** are the sub-apps/services of the project (frontend,
58
+ api, ...). Each has a build config and a deploy config.
59
+ - **Environments**: `dev` (deployed on push to the main branch),
60
+ `review` (per merge/pull request), `stage` and `prod` (deployed on
61
+ tagged releases), `local` (only for local development via catenv).
62
+ Per-env overrides live under `env.<name>` and can override vars,
63
+ deploy settings, and more.
64
+ - **Pipelines**: `pipelines: { gitlab: true, github: true }` selects
65
+ which CI systems get generated files. Options objects instead of
66
+ `true` allow per-pipeline settings (e.g. `runnerVariables`).
67
+
68
+ ## Common tasks
69
+
70
+ - **Add a component**: add an entry under `components`, run
71
+ `yarn catenv`, commit config + generated files.
72
+ - **Change resources / deployment settings**: edit the component's
73
+ `deploy` (or per-env override), regenerate.
74
+ - **Inspect the resulting pipeline**: read the generated files (e.g.
75
+ `.catladder-generated/gitlab/`, `.github/workflows/`) — but never
76
+ edit them.
77
+
78
+ ## Related skills
79
+
80
+ - `catladder-secrets` — env vars and secret management
81
+ - `catladder-pipelines` — how the generated pipelines work, debugging CI
82
+ - `catladder-cli` — non-interactive CLI usage and command reference
@@ -0,0 +1,72 @@
1
+ ---
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, or when deployments misbehave. Triggers on "pipeline", "CI job", "gitlab-ci", "workflow", "deploy failed", "cache", "release".
4
+ ---
5
+
6
+ # How catladder pipelines work
7
+
8
+ All pipeline files are generated from `catladder.ts` — fix pipeline
9
+ problems in the config (see `catladder-config` skill), never in the
10
+ generated YAML.
11
+
12
+ ## Triggers and environments
13
+
14
+ | Trigger | Runs on | Deploys to |
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
+
20
+ Generated layout:
21
+
22
+ - **GitLab**: `.gitlab-ci.yml` includes generated files from
23
+ `.catladder-generated/gitlab/` (one per trigger).
24
+ - **GitHub**: workflows in `.github/workflows/` (generated ones carry a
25
+ "generated by catladder" header; others are unmanaged).
26
+
27
+ Stages: setup → test → build → deploy → verify (post-deploy checks),
28
+ plus stop jobs for review-app teardown.
29
+
30
+ ## Job images and catci
31
+
32
+ Jobs run in catladder-provided images. With `jobImages: "repo"`, image
33
+ definitions are materialized into `.catladder-generated/images/` and
34
+ built in the project's own registry (content-hashed, rebuilt only on
35
+ change). `.catladder-generated/catci/` holds a small bundled CI
36
+ companion used by generated jobs (e.g. the release security audit) —
37
+ all generated, never edit.
38
+
39
+ ## Caching
40
+
41
+ Cache configuration is generated per build type; node builds cache
42
+ `node_modules` and the yarn cache. GitLab uses mutable caches with
43
+ fallback keys (review branches fall back to the dev cache); GitHub uses
44
+ immutable lockfile-keyed caches where only the build job writes.
45
+ Caching behavior is changed via the build config in `catladder.ts`,
46
+ not in the YAML.
47
+
48
+ ## Releases
49
+
50
+ With `releases` configured, tagged releases are created by a release
51
+ job (method: `semantic-release` or `changesets`). The release job also
52
+ runs a dependency security audit via catci.
53
+
54
+ ## Debugging CI
55
+
56
+ Useful CLI commands (see the `catladder-cli` skill for invocation):
57
+
58
+ - `yarn catladder project ci job-log` / `project ci job-open` — fetch
59
+ or open a CI job
60
+ - `yarn catladder project doctor` — detect drift between `catladder.ts`
61
+ and the actually provisioned infrastructure (missing IAM roles, stale
62
+ secrets, ...). Run this when a deploy/teardown fails with permission
63
+ errors even though the config looks right; fix findings with
64
+ `yarn catladder project setup [component]`.
65
+ - `yarn catladder project logs open`, `project k8s list-pods`,
66
+ `project k8s get-shell` — inspect the running deployments
67
+
68
+ ## Related skills
69
+
70
+ - `catladder-config` — catladder.ts structure and regeneration
71
+ - `catladder-secrets` — env vars and secret management
72
+ - `catladder-cli` — non-interactive CLI usage and command reference
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: catladder-secrets
3
+ description: Managing environment variables and secrets in a catladder project. Use when adding or changing env vars in catladder.ts (vars.public / vars.secret), when a secret value must be set or rotated, when secrets need syncing to GitHub, or when local .env / direnv environment questions come up. Triggers on "env var", "secret", "vars", "catenv", ".env", "config-secrets".
4
+ ---
5
+
6
+ # Env vars and secrets with catladder
7
+
8
+ Environment variables are declared per component in `catladder.ts`;
9
+ secret *values* are never checked into the repo.
10
+
11
+ ## Declaring variables
12
+
13
+ ```ts
14
+ components: {
15
+ app: {
16
+ vars: {
17
+ // names of secret vars — values are stored in the secrets vault, not in git
18
+ secret: ["API_KEY"],
19
+ public: {
20
+ MY_VAR: "some value",
21
+ // reference other vars, including from other components:
22
+ GRAPHQL_ENDPOINT: "${api:ROOT_URL}/graphql",
23
+ },
24
+ },
25
+ },
26
+ }
27
+ ```
28
+
29
+ Predefined per component/env: `ROOT_URL`, `HOSTNAME`, `PORT` (plus
30
+ deploy-type specific ones). All vars are available at build time and at
31
+ runtime. After changing declarations, regenerate with `yarn catenv` and
32
+ commit.
33
+
34
+ ## Setting secret values
35
+
36
+ Secret values are managed through the catladder CLI — never by editing
37
+ files in the repo:
38
+
39
+ ```sh
40
+ yarn catladder project config-secrets
41
+ ```
42
+
43
+ This opens all env vars as YAML in `$EDITOR` (use e.g.
44
+ `EDITOR="code --wait"`); on save, catladder upserts the changed values
45
+ into the secrets vault. **An agent cannot drive this interactive
46
+ editor** — when a new secret *value* is needed, add the name to
47
+ `vars.secret`, regenerate, and ask the user to run
48
+ `project config-secrets` themselves.
49
+
50
+ ## GitHub pipelines
51
+
52
+ GitHub Actions cannot read the vault at runtime; secrets are mirrored
53
+ into GitHub *environment* secrets (one GitHub environment per catladder
54
+ env). Sync them with:
55
+
56
+ ```sh
57
+ yarn catladder project secrets-sync-github
58
+ ```
59
+
60
+ Run this after adding/changing secrets when a github pipeline is
61
+ enabled.
62
+
63
+ ## Local development
64
+
65
+ `catenv` generates the local env (`.env` files / exported vars via
66
+ direnv) for the `local` environment. If a var is missing locally,
67
+ check its declaration in `catladder.ts` and re-run `yarn catenv` before
68
+ suspecting anything else.
69
+
70
+ ## Related skills
71
+
72
+ - `catladder-config` — general catladder.ts structure and regeneration
73
+ - `catladder-pipelines` — how the generated pipelines work
74
+ - `catladder-cli` — non-interactive CLI usage and command reference