@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.
- package/dist/bundles/catenv/index.js +223 -1
- package/dist/bundles/cli/index.js +223 -1
- package/dist/bundles/skills/catladder-cli/SKILL.md +53 -0
- package/dist/bundles/skills/catladder-cli/references/commands.md +273 -0
- package/dist/bundles/skills/catladder-config/SKILL.md +82 -0
- package/dist/bundles/skills/catladder-pipelines/SKILL.md +72 -0
- package/dist/bundles/skills/catladder-secrets/SKILL.md +74 -0
- package/dist/cli/src/scripts/generateCliSkillReference.d.ts +1 -0
- package/dist/cli/src/scripts/generateCliSkillReference.js +87 -0
- package/dist/cli/src/scripts/generateCliSkillReference.js.map +1 -0
- package/dist/pipeline/src/agentSkills/generateAgentSkills.d.ts +22 -0
- package/dist/pipeline/src/agentSkills/generateAgentSkills.js +82 -0
- package/dist/pipeline/src/agentSkills/generateAgentSkills.js.map +1 -0
- package/dist/pipeline/src/agentSkills/index.d.ts +3 -0
- package/dist/pipeline/src/agentSkills/index.js +27 -0
- package/dist/pipeline/src/agentSkills/index.js.map +1 -0
- package/dist/pipeline/src/agentSkills/shippedSkills.d.ts +22 -0
- package/dist/pipeline/src/agentSkills/shippedSkills.js +56 -0
- package/dist/pipeline/src/agentSkills/shippedSkills.js.map +1 -0
- package/dist/pipeline/src/agentSkills/types.d.ts +22 -0
- package/dist/pipeline/src/agentSkills/types.js +25 -0
- package/dist/pipeline/src/agentSkills/types.js.map +1 -0
- package/dist/pipeline/src/constants.js +1 -1
- package/dist/pipeline/src/pipeline/generatePipelineFiles.js +4 -0
- package/dist/pipeline/src/pipeline/generatePipelineFiles.js.map +1 -1
- package/dist/pipeline/src/types/config.d.ts +15 -0
- package/dist/pipeline/src/types/config.js.map +1 -1
- package/dist/skills/catladder-cli/SKILL.md +53 -0
- package/dist/skills/catladder-cli/references/commands.md +273 -0
- package/dist/skills/catladder-config/SKILL.md +82 -0
- package/dist/skills/catladder-pipelines/SKILL.md +72 -0
- package/dist/skills/catladder-secrets/SKILL.md +74 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -2
- package/src/scripts/generateCliSkillReference.ts +102 -0
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# catladder CLI command reference
|
|
2
|
+
|
|
3
|
+
<!-- rendered from the command definitions by
|
|
4
|
+
cli/src/scripts/generateCliSkillReference.ts — do not edit -->
|
|
5
|
+
|
|
6
|
+
All commands run non-interactively as `yarn catladder <command> ...`;
|
|
7
|
+
see SKILL.md for how to pass inputs.
|
|
8
|
+
|
|
9
|
+
## `catladder cloudsql restore-db`
|
|
10
|
+
|
|
11
|
+
restore a db from one source to another target
|
|
12
|
+
|
|
13
|
+
- `--source <value>`: Source instance (connection string or 'local')?
|
|
14
|
+
- `--source-local-port <value>`: Local Port for source? (default: 5432)
|
|
15
|
+
- `--source-username <value>`: Source Username? (default: "postgres")
|
|
16
|
+
- `--source-password <value>`: Source Password?
|
|
17
|
+
- `--source-db-name <value>`: Source DB name?
|
|
18
|
+
- `--target <value>`: Target INSTANCE (connection string or 'local')?
|
|
19
|
+
- `--target-local-port <value>`: Local Port for target? (default: 5432)
|
|
20
|
+
- `--target-username <value>`: Target Username? (default: "postgres")
|
|
21
|
+
- `--target-password <value>`: Target Password?
|
|
22
|
+
- `--target-db-name <value>`: Target DB name?
|
|
23
|
+
|
|
24
|
+
## `catladder fun dadjoke`
|
|
25
|
+
|
|
26
|
+
something for jonas.
|
|
27
|
+
|
|
28
|
+
## `catladder fun starwars`
|
|
29
|
+
|
|
30
|
+
Long time ago... in a galaxy far far away...
|
|
31
|
+
|
|
32
|
+
## `catladder k8s current-context`
|
|
33
|
+
|
|
34
|
+
show current kubernetes context
|
|
35
|
+
|
|
36
|
+
## `catladder k8s get-shell [namespace]`
|
|
37
|
+
|
|
38
|
+
get a shell to a pod in the environment
|
|
39
|
+
|
|
40
|
+
- `namespace` (positional): kubernetes namespace
|
|
41
|
+
- `--pod-name <value>`: Which pod?
|
|
42
|
+
|
|
43
|
+
## `catladder k8s list-namespaces`
|
|
44
|
+
|
|
45
|
+
list all namespaces
|
|
46
|
+
|
|
47
|
+
## `catladder k8s list-pods [namespace]`
|
|
48
|
+
|
|
49
|
+
list all pods of namespace
|
|
50
|
+
|
|
51
|
+
- `namespace` (positional): kubernetes namespace
|
|
52
|
+
|
|
53
|
+
## `catladder k8s list-secrets [namespace]`
|
|
54
|
+
|
|
55
|
+
show secrets
|
|
56
|
+
|
|
57
|
+
- `namespace` (positional): kubernetes namespace
|
|
58
|
+
|
|
59
|
+
## `catladder k8s port-forward [namespace]`
|
|
60
|
+
|
|
61
|
+
start port-forwarding
|
|
62
|
+
|
|
63
|
+
- `namespace` (positional): kubernetes namespace
|
|
64
|
+
- `--pod-name <value>`: Which pod?
|
|
65
|
+
- `--local-port <value>`: Local port:
|
|
66
|
+
- `--remote-port <value>`: Remote port:
|
|
67
|
+
|
|
68
|
+
## `catladder k8s stop-portforward [name]`
|
|
69
|
+
|
|
70
|
+
stop a running port forward
|
|
71
|
+
|
|
72
|
+
- `name` (positional): port forward name
|
|
73
|
+
|
|
74
|
+
## `catladder k8s trigger-cronjob [namespace]`
|
|
75
|
+
|
|
76
|
+
trigger cronjob
|
|
77
|
+
|
|
78
|
+
- `namespace` (positional): kubernetes namespace
|
|
79
|
+
- `--job-name <value>`: Which cronjob?
|
|
80
|
+
|
|
81
|
+
## `catladder project ci job-log`
|
|
82
|
+
|
|
83
|
+
Show a job's log
|
|
84
|
+
|
|
85
|
+
- `--job-name <value>`: Which job?
|
|
86
|
+
|
|
87
|
+
## `catladder project ci job-open`
|
|
88
|
+
|
|
89
|
+
Open a Job
|
|
90
|
+
|
|
91
|
+
- `--job-name <value>`: Which job?
|
|
92
|
+
|
|
93
|
+
## `catladder project cloudsql proxy [envComponent]`
|
|
94
|
+
|
|
95
|
+
proxy to cloud sql db
|
|
96
|
+
|
|
97
|
+
- `envComponent` (positional): environment:component
|
|
98
|
+
- `--local-port <value>`: Local port: (default: 54320)
|
|
99
|
+
|
|
100
|
+
## `catladder project cloudsql restore-db`
|
|
101
|
+
|
|
102
|
+
restores a project db from one source to another target
|
|
103
|
+
|
|
104
|
+
- `--source <value>`: Source instance?
|
|
105
|
+
- `--target <value>`: target env?
|
|
106
|
+
- `--confirm-instance <value>`: confirm:
|
|
107
|
+
|
|
108
|
+
## `catladder project config-secrets [envComponent]`
|
|
109
|
+
|
|
110
|
+
setup/update secrets stored in pass
|
|
111
|
+
|
|
112
|
+
- `envComponent` (positional): environment:component
|
|
113
|
+
|
|
114
|
+
## `catladder project doctor [component]`
|
|
115
|
+
|
|
116
|
+
Checks for drift between the config and the provisioned infrastructure (read-only): service accounts, IAM roles, gitlab tokens, github secrets, store entries.
|
|
117
|
+
|
|
118
|
+
- `component` (positional): component name
|
|
119
|
+
|
|
120
|
+
## `catladder project env-vars [envComponent]`
|
|
121
|
+
|
|
122
|
+
list env vars
|
|
123
|
+
|
|
124
|
+
- `envComponent` (positional): environment:component
|
|
125
|
+
|
|
126
|
+
## `catladder project k8s delete [envComponent]`
|
|
127
|
+
|
|
128
|
+
deletes a environment of a project (it deletes the namespace)
|
|
129
|
+
|
|
130
|
+
- `envComponent` (positional): environment:component
|
|
131
|
+
|
|
132
|
+
## `catladder project k8s delete-pods [envComponent]`
|
|
133
|
+
|
|
134
|
+
delete / restart pods
|
|
135
|
+
|
|
136
|
+
- `envComponent` (positional): environment:component
|
|
137
|
+
- `--selected-pod-names <value>`: Which pods to delete / restart ?
|
|
138
|
+
|
|
139
|
+
## `catladder project k8s get-shell [envComponent]`
|
|
140
|
+
|
|
141
|
+
get a shell to a pod in the environment
|
|
142
|
+
|
|
143
|
+
- `envComponent` (positional): environment:component
|
|
144
|
+
- `--pod-name <value>`: Which pod?
|
|
145
|
+
|
|
146
|
+
## `catladder project k8s list-pods [envComponent]`
|
|
147
|
+
|
|
148
|
+
list pods of local project
|
|
149
|
+
|
|
150
|
+
- `envComponent` (positional): environment:component
|
|
151
|
+
|
|
152
|
+
## `catladder project k8s namespace [envComponent]`
|
|
153
|
+
|
|
154
|
+
show namespace of local project
|
|
155
|
+
|
|
156
|
+
- `envComponent` (positional): environment:component
|
|
157
|
+
|
|
158
|
+
## `catladder project k8s pause [envComponent]`
|
|
159
|
+
|
|
160
|
+
halts all running pods (scales to 0)
|
|
161
|
+
|
|
162
|
+
- `envComponent` (positional): environment:component
|
|
163
|
+
|
|
164
|
+
## `catladder project k8s trigger-cronjob [envComponent]`
|
|
165
|
+
|
|
166
|
+
trigger cronjob
|
|
167
|
+
|
|
168
|
+
- `envComponent` (positional): environment:component
|
|
169
|
+
- `--job-name <value>`: Which cronjob?
|
|
170
|
+
|
|
171
|
+
## `catladder project logs open [envComponent]`
|
|
172
|
+
|
|
173
|
+
open logs for a component (Google Cloud Logging)
|
|
174
|
+
|
|
175
|
+
- `envComponent` (positional): environment:component
|
|
176
|
+
|
|
177
|
+
## `catladder project mongo destroy-member [envComponent]`
|
|
178
|
+
|
|
179
|
+
DESTROY a member of a replicaset in order to reinitialize it
|
|
180
|
+
|
|
181
|
+
- `envComponent` (positional): environment:component
|
|
182
|
+
- `--pod-name <value>`: Which pod?
|
|
183
|
+
|
|
184
|
+
## `catladder project mongo get-shell [envComponent]`
|
|
185
|
+
|
|
186
|
+
get a shell to a mongodb in the environment
|
|
187
|
+
|
|
188
|
+
- `envComponent` (positional): environment:component
|
|
189
|
+
- `--pod-name <value>`: Which pod?
|
|
190
|
+
|
|
191
|
+
## `catladder project mongo port-forward [envComponent]`
|
|
192
|
+
|
|
193
|
+
port forward to a mongodb
|
|
194
|
+
|
|
195
|
+
- `envComponent` (positional): environment:component
|
|
196
|
+
- `--pod-name <value>`: Which pod?
|
|
197
|
+
- `--local-port <value>`: Local port: (default: 30000)
|
|
198
|
+
|
|
199
|
+
## `catladder project open env [envComponent]`
|
|
200
|
+
|
|
201
|
+
open the live environment
|
|
202
|
+
|
|
203
|
+
- `envComponent` (positional): environment:component
|
|
204
|
+
|
|
205
|
+
## `catladder project open git`
|
|
206
|
+
|
|
207
|
+
open the repo on gitlab / github in your browser
|
|
208
|
+
|
|
209
|
+
## `catladder project port-forward [envComponent]`
|
|
210
|
+
|
|
211
|
+
start port-forwarding
|
|
212
|
+
|
|
213
|
+
- `envComponent` (positional): environment:component
|
|
214
|
+
- `--pod-name <value>`: Which pod?
|
|
215
|
+
- `--local-port <value>`: Local port:
|
|
216
|
+
- `--remote-port <value>`: Remote port:
|
|
217
|
+
- `--mr <value>`: Which mr
|
|
218
|
+
|
|
219
|
+
## `catladder project renew-token`
|
|
220
|
+
|
|
221
|
+
Configures the project access token for semantic release.
|
|
222
|
+
|
|
223
|
+
## `catladder project secrets-clear-backups`
|
|
224
|
+
|
|
225
|
+
clears all backups
|
|
226
|
+
|
|
227
|
+
- `--keep <value>`: How many backups should we keep? (default: 1)
|
|
228
|
+
|
|
229
|
+
## `catladder project secrets-sync-github [repo] [env]`
|
|
230
|
+
|
|
231
|
+
copies all secrets from the vault to github repo secrets (same names), for the github pipeline
|
|
232
|
+
|
|
233
|
+
- `repo` (positional): github repository (owner/name)
|
|
234
|
+
- `env` (positional): only sync these environments (comma-separated, e.g. review,dev) — github allows at most 100 repo secrets
|
|
235
|
+
|
|
236
|
+
## `catladder project security-evaluate`
|
|
237
|
+
|
|
238
|
+
evaluate project's security audit document
|
|
239
|
+
|
|
240
|
+
## `catladder project setup [component]`
|
|
241
|
+
|
|
242
|
+
Initializes all environments and creates required resources, service accounts, etc.
|
|
243
|
+
|
|
244
|
+
- `component` (positional): component name
|
|
245
|
+
|
|
246
|
+
## `catladder project worktime`
|
|
247
|
+
|
|
248
|
+
show the total worktime that you spent on a project
|
|
249
|
+
|
|
250
|
+
## `catladder security audit ci-job [path] [token] [mainBranch] [projectId] [userId]`
|
|
251
|
+
|
|
252
|
+
Evaluates security audit document. Creates MR with template if missing.
|
|
253
|
+
|
|
254
|
+
- `path` (positional): path to project root
|
|
255
|
+
- `token` (positional): GitLab token (api scope)
|
|
256
|
+
- `mainBranch` (positional): main branch name
|
|
257
|
+
- `projectId` (positional): GitLab project ID
|
|
258
|
+
- `userId` (positional): GitLab user ID (assignee)
|
|
259
|
+
|
|
260
|
+
## `catladder security audit create [token] [mainBranch] [projectId] [userId]`
|
|
261
|
+
|
|
262
|
+
Creates a MR with the latest security audit template document
|
|
263
|
+
|
|
264
|
+
- `token` (positional): GitLab token (api scope)
|
|
265
|
+
- `mainBranch` (positional): main branch name
|
|
266
|
+
- `projectId` (positional): GitLab project ID
|
|
267
|
+
- `userId` (positional): GitLab user ID (assignee)
|
|
268
|
+
|
|
269
|
+
## `catladder security audit evaluate [path]`
|
|
270
|
+
|
|
271
|
+
Evaluates security audit document in given path
|
|
272
|
+
|
|
273
|
+
- `path` (positional): path to project root
|
|
@@ -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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const renderCliReference: () => string;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
} : function (o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
});
|
|
19
|
+
var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
value: v
|
|
23
|
+
});
|
|
24
|
+
} : function (o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = this && this.__importStar || function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", {
|
|
35
|
+
value: true
|
|
36
|
+
});
|
|
37
|
+
exports.renderCliReference = void 0;
|
|
38
|
+
const fs_1 = require("fs");
|
|
39
|
+
const path_1 = require("path");
|
|
40
|
+
const commands = __importStar(require("../commands"));
|
|
41
|
+
/**
|
|
42
|
+
* renders the CLI command reference of the catladder-cli agent skill
|
|
43
|
+
* from the command definitions, so the skill always documents the
|
|
44
|
+
* commands that actually exist. Runs as part of the cli build
|
|
45
|
+
* (`build:skill-cli-reference`) and writes into the repository's
|
|
46
|
+
* `skills/` directory — commit the result.
|
|
47
|
+
*/
|
|
48
|
+
const kebab = name => name.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
49
|
+
const cleanMessage = message => message.replace(/\s*🤔\s*$/, "").trim();
|
|
50
|
+
const renderInput = ([name, def]) => {
|
|
51
|
+
const description = cleanMessage(def.message);
|
|
52
|
+
const details = [def.required ? "required" : undefined, "default" in def && def.default !== undefined ? `default: ${JSON.stringify(def.default)}` : undefined].filter(Boolean).join(", ");
|
|
53
|
+
const usage = def.positional ? `\`${name}\` (positional)` : def.type === "boolean" ? `\`--${kebab(name)}\`` : `\`--${kebab(name)} <value>\``;
|
|
54
|
+
return `- ${usage}: ${description}${details ? ` (${details})` : ""}`;
|
|
55
|
+
};
|
|
56
|
+
const renderCommand = def => {
|
|
57
|
+
const positionals = Object.entries(def.inputs).filter(([, input]) => input.positional).map(([name]) => ` [${name}]`).join("");
|
|
58
|
+
const inputs = Object.entries(def.inputs);
|
|
59
|
+
return [`## \`catladder ${def.name}${positionals}\``, "", def.description, ...(inputs.length > 0 ? ["", ...inputs.map(renderInput)] : [])].join("\n");
|
|
60
|
+
};
|
|
61
|
+
const isCommandDef = value => typeof value === "object" && value !== null && "name" in value && "execute" in value;
|
|
62
|
+
const renderCliReference = () => {
|
|
63
|
+
const defs = Object.values(commands).filter(isCommandDef).sort((a, b) => a.name.localeCompare(b.name));
|
|
64
|
+
return ["# catladder CLI command reference", "", "<!-- rendered from the command definitions by", " cli/src/scripts/generateCliSkillReference.ts — do not edit -->", "", "All commands run non-interactively as `yarn catladder <command> ...`;", "see SKILL.md for how to pass inputs.", "", defs.map(renderCommand).join("\n\n"), ""].join("\n");
|
|
65
|
+
};
|
|
66
|
+
exports.renderCliReference = renderCliReference;
|
|
67
|
+
// executed by the cli build via tsx (node itself cannot require the
|
|
68
|
+
// ESM-only deps of the command modules on older versions)
|
|
69
|
+
const main = () => {
|
|
70
|
+
const repoRootCandidates = [(0, path_1.join)(__dirname, "../../.."),
|
|
71
|
+
// source: cli/src/scripts
|
|
72
|
+
(0, path_1.join)(__dirname, "../../../../..") // compiled: cli/dist/cli/src/scripts
|
|
73
|
+
];
|
|
74
|
+
const repoRoot = repoRootCandidates.find(candidate => (0, fs_1.existsSync)((0, path_1.join)(candidate, "skills")));
|
|
75
|
+
if (!repoRoot) {
|
|
76
|
+
throw new Error("skills directory not found next to the cli workspace");
|
|
77
|
+
}
|
|
78
|
+
const target = (0, path_1.join)(repoRoot, "skills", "catladder-cli", "references", "commands.md");
|
|
79
|
+
(0, fs_1.mkdirSync)((0, path_1.join)(target, ".."), {
|
|
80
|
+
recursive: true
|
|
81
|
+
});
|
|
82
|
+
(0, fs_1.writeFileSync)(target, (0, exports.renderCliReference)(), "utf-8");
|
|
83
|
+
console.log(`wrote ${target}`);
|
|
84
|
+
};
|
|
85
|
+
if (require.main === module) {
|
|
86
|
+
main();
|
|
87
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateCliSkillReference.js","sourceRoot":"","sources":["../../../../src/scripts/generateCliSkillReference.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAA0D;AAC1D,+BAA4B;AAC5B,sDAAwC;AAGxC;;;;;;GAMG;AAEH,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;AAE9E,MAAM,YAAY,GAAG,CAAC,OAAe,EAAE,EAAE,CACvC,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AAE1C,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,CAAqB,EAAU,EAAE;IAC9D,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG;QACd,GAAG,CAAC,QAAQ,CAAC,CAAC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CAAC,CAAC,CACtC,CAAC;IACF,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;IACD,MAAM,MAAM,GAAG,IAAA,WAAI,EACjB,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,aAAa,CACd,CAAC;IACF,IAAA,cAAS,EAAC,IAAA,WAAI,EAAC,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACnD,IAAA,kBAAa,EAAC,MAAM,EAAE,IAAA,0BAAkB,GAAE,EAAE,OAAO,CAAC,CAAC;IACrD,OAAO,CAAC,GAAG,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,IAAI,EAAE,CAAC;AACT,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CatenvContext } from "../catenv";
|
|
2
|
+
/**
|
|
3
|
+
* marks a materialized skill file as generated. Cleanup only ever
|
|
4
|
+
* removes skill directories whose SKILL.md carries this marker, so a
|
|
5
|
+
* user's own skills are never touched — even if they picked a
|
|
6
|
+
* `catladder-*` name.
|
|
7
|
+
*/
|
|
8
|
+
export declare const AGENT_SKILL_GENERATED_MARKER = "<!-- \uD83D\uDC31 \uD83D\uDD28 generated by catladder \u2014 do not edit manually, this file is overwritten on every catenv run -->";
|
|
9
|
+
/**
|
|
10
|
+
* inserts the generated-marker into a markdown file: after the YAML
|
|
11
|
+
* frontmatter when there is one (a leading comment would break
|
|
12
|
+
* frontmatter parsing), at the top otherwise
|
|
13
|
+
*/
|
|
14
|
+
export declare const injectGeneratedMarker: (content: string) => string;
|
|
15
|
+
/**
|
|
16
|
+
* materializes the agent skills shipped with catladder (usage guides
|
|
17
|
+
* for AI coding agents) into the repository's agent skill directories,
|
|
18
|
+
* so agents working in the project use knowledge matching the installed
|
|
19
|
+
* catladder version. Opt out or narrow the targets via
|
|
20
|
+
* `agentSkills` in the config.
|
|
21
|
+
*/
|
|
22
|
+
export declare const generateAgentSkills: (context: CatenvContext, rootDir?: string) => Promise<void>;
|