codebyplan 1.13.52 → 1.13.54
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/cli.js +3226 -897
- package/package.json +1 -1
- package/templates/agents/cbp-database-agent.md +1 -1
- package/templates/agents/cbp-e2e-maestro.md +1 -1
- package/templates/agents/cbp-e2e-playwright.md +24 -16
- package/templates/agents/cbp-e2e-tauri.md +1 -1
- package/templates/agents/cbp-e2e-vscode.md +1 -1
- package/templates/agents/cbp-e2e-xcuitest.md +1 -1
- package/templates/agents/cbp-improve-claude.md +2 -2
- package/templates/agents/{cbp-round-executor.md → cbp-round-builder.md} +23 -23
- package/templates/agents/{cbp-task-planner.md → cbp-round-planner.md} +26 -25
- package/templates/agents/cbp-security-agent.md +10 -2
- package/templates/agents/cbp-stripe-agent.md +2 -2
- package/templates/agents/cbp-testing-qa-agent.md +34 -20
- package/templates/agents/cbp-verify-reviewer.md +236 -0
- package/templates/context/architecture-map.md +4 -4
- package/templates/context/mcp-docs.md +57 -11
- package/templates/context/testing/e2e.md +9 -9
- package/templates/github-workflows/ci.yml +104 -0
- package/templates/github-workflows/publish.yml +8 -27
- package/templates/github-workflows/release-desktop.yml +215 -0
- package/templates/hooks/cbp-skill-context-guard.sh +1 -1
- package/templates/hooks/cbp-test-hooks.sh +9 -9
- package/templates/hooks/validate-structure-lengths.sh +1 -1
- package/templates/hooks/validate-structure-patterns.sh +1 -1
- package/templates/rules/README.md +1 -2
- package/templates/rules/agent-claim-verification.md +1 -1
- package/templates/rules/context-file-loading.md +10 -10
- package/templates/rules/development-workflow.md +73 -0
- package/templates/rules/e2e-mandatory.md +8 -8
- package/templates/rules/execution-proof.md +70 -0
- package/templates/rules/model-invocation-convention.md +2 -2
- package/templates/rules/parallel-waves.md +11 -11
- package/templates/rules/spawn-failure-is-gate-failure.md +76 -0
- package/templates/rules/task-routing-recommendation.md +1 -1
- package/templates/rules/todo-backend.md +3 -3
- package/templates/rules/two-tier-ci.md +63 -0
- package/templates/settings.project.base.json +15 -11
- package/templates/skills/cbp-build-cc-mode/SKILL.md +1 -1
- package/templates/skills/cbp-build-cc-settings/reference/cbp-permission-policy.md +7 -7
- package/templates/skills/cbp-build-cc-skill/SKILL.md +1 -1
- package/templates/skills/cbp-build-cc-skill/reference/cbp-quality.md +2 -2
- package/templates/skills/cbp-build-cc-skill/reference/fork-eligibility.md +11 -14
- package/templates/skills/cbp-checkpoint-check/SKILL.md +11 -3
- package/templates/skills/cbp-checkpoint-create/SKILL.md +16 -1
- package/templates/skills/cbp-checkpoint-end/SKILL.md +5 -1
- package/templates/skills/cbp-checkpoint-update/SKILL.md +3 -3
- package/templates/skills/cbp-clear-continue/SKILL.md +2 -2
- package/templates/skills/cbp-clear-prep/SKILL.md +3 -3
- package/templates/skills/{cbp-task-complete → cbp-finalize}/SKILL.md +25 -29
- package/templates/skills/{cbp-task-complete → cbp-finalize}/reference/checkpoint-done-branching.md +1 -1
- package/templates/skills/{cbp-task-complete → cbp-finalize}/reference/next-step-heuristic.md +1 -1
- package/templates/skills/cbp-frontend-design/SKILL.md +1 -1
- package/templates/skills/cbp-frontend-ui/SKILL.md +7 -7
- package/templates/skills/cbp-git-commit/SKILL.md +3 -3
- package/templates/skills/cbp-merge-main/SKILL.md +4 -4
- package/templates/skills/{cbp-round-execute → cbp-round-build}/SKILL.md +93 -75
- package/templates/skills/cbp-round-complete/SKILL.md +15 -14
- package/templates/skills/cbp-round-plan/SKILL.md +344 -0
- package/templates/skills/cbp-session-end/SKILL.md +1 -1
- package/templates/skills/cbp-setup-cd/SKILL.md +291 -0
- package/templates/skills/cbp-setup-cd/reference/github-actions-cd.md +231 -0
- package/templates/skills/cbp-setup-ci/SKILL.md +175 -0
- package/templates/skills/cbp-setup-ci/reference/github-actions.md +100 -0
- package/templates/skills/cbp-ship/SKILL.md +21 -0
- package/templates/skills/cbp-ship-main/SKILL.md +3 -2
- package/templates/skills/cbp-standalone-task-check/SKILL.md +10 -9
- package/templates/skills/cbp-standalone-task-complete/SKILL.md +12 -13
- package/templates/skills/cbp-standalone-task-create/SKILL.md +16 -9
- package/templates/skills/cbp-standalone-task-start/SKILL.md +9 -5
- package/templates/skills/cbp-standalone-task-testing/SKILL.md +16 -7
- package/templates/skills/cbp-task-create/SKILL.md +6 -7
- package/templates/skills/cbp-task-start/SKILL.md +8 -8
- package/templates/skills/cbp-todo/SKILL.md +6 -8
- package/templates/skills/cbp-verify/SKILL.md +146 -0
- package/templates/skills/cbp-verify/reference/deterministic-gates.md +114 -0
- package/templates/skills/{cbp-round-end → cbp-verify}/reference/findings-presentation.md +16 -12
- package/templates/skills/cbp-verify/reference/round-scope.md +62 -0
- package/templates/skills/cbp-verify/reference/task-scope.md +71 -0
- package/templates/agents/cbp-improve-round.md +0 -283
- package/templates/agents/cbp-task-check.md +0 -217
- package/templates/skills/cbp-round-check/SKILL.md +0 -132
- package/templates/skills/cbp-round-end/SKILL.md +0 -173
- package/templates/skills/cbp-round-end/reference/inline-fallback.md +0 -35
- package/templates/skills/cbp-round-execute/reference/inline-fallback.md +0 -55
- package/templates/skills/cbp-round-input/SKILL.md +0 -197
- package/templates/skills/cbp-round-start/SKILL.md +0 -261
- package/templates/skills/cbp-round-update/SKILL.md +0 -120
- package/templates/skills/cbp-ship/templates/workflow-eas-submit.yml +0 -53
- package/templates/skills/cbp-ship/templates/workflow-vsce-publish.yml +0 -31
- package/templates/skills/cbp-task-check/SKILL.md +0 -172
- package/templates/skills/cbp-task-testing/SKILL.md +0 -277
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# GitHub Actions CD Reference
|
|
2
|
+
|
|
3
|
+
Workflow anatomy, OIDC setup, drift-guard guidance, and per-surface credential
|
|
4
|
+
var-name lists for the `codebyplan cd` scaffold.
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
GitHub Actions CD runs on every push to main (path-filtered per surface). The
|
|
9
|
+
`codebyplan cd scaffold-workflow` command writes `.github/workflows/publish.yml`
|
|
10
|
+
(npm surface) and `.github/workflows/release-desktop.yml` (Tauri surface) from
|
|
11
|
+
bundled canonical templates.
|
|
12
|
+
|
|
13
|
+
Workflow triggers:
|
|
14
|
+
|
|
15
|
+
```yaml
|
|
16
|
+
# publish.yml (npm surface)
|
|
17
|
+
on:
|
|
18
|
+
push:
|
|
19
|
+
branches: [main, 'feat/**']
|
|
20
|
+
paths: ['packages/<package>/**']
|
|
21
|
+
workflow_dispatch:
|
|
22
|
+
inputs:
|
|
23
|
+
dry_run: { type: boolean, default: false }
|
|
24
|
+
|
|
25
|
+
# release-desktop.yml (Tauri surface)
|
|
26
|
+
on:
|
|
27
|
+
push:
|
|
28
|
+
branches: [main]
|
|
29
|
+
paths: ['apps/desktop/**']
|
|
30
|
+
workflow_dispatch: {}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## publish.yml Structure (npm surface)
|
|
34
|
+
|
|
35
|
+
Key sections of the scaffolded npm workflow:
|
|
36
|
+
|
|
37
|
+
| Section | What it does |
|
|
38
|
+
| ------- | ------------ |
|
|
39
|
+
| `check-version` job | Reads `package.json` version, compares against npm registry, sets `should_publish` output |
|
|
40
|
+
| `publish-codebyplan` job | Builds the package, upgrades npm for OIDC, publishes via `npm publish --access public --tag <dist_tag>` |
|
|
41
|
+
| `tag-and-release` job | Creates a `v<version>` git tag and GitHub release (idempotent) |
|
|
42
|
+
| `id-token: write` permission | Required for OIDC Trusted Publishing — no long-lived `NPM_TOKEN` needed |
|
|
43
|
+
|
|
44
|
+
The `check-version` job enforces several guards:
|
|
45
|
+
|
|
46
|
+
- **main push + stable version**: compares committed version against npm registry; publishes only when version is strictly greater.
|
|
47
|
+
- **main push + prerelease version**: skipped — prerelease versions on main require `workflow_dispatch` or a `feat/**` branch.
|
|
48
|
+
- **feat/** push + stable version**: skipped — feat branches require a prerelease version (e.g. `1.2.0-beta.1`).
|
|
49
|
+
- **feat/** push + prerelease version**: publishes only if the exact version is not already on npm (exact-version guard).
|
|
50
|
+
- **workflow_dispatch**: always publishes (recovery / forced re-publish path).
|
|
51
|
+
|
|
52
|
+
Scaffold only this workflow:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npx codebyplan cd scaffold-workflow --workflow publish
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Path filters are baked into the workflow templates (they are not a CLI flag) — edit
|
|
59
|
+
the generated `.github/workflows/publish.yml` `paths:` block directly if your package
|
|
60
|
+
lives elsewhere.
|
|
61
|
+
|
|
62
|
+
## release-desktop.yml Structure (Tauri surface)
|
|
63
|
+
|
|
64
|
+
Key sections of the scaffolded Tauri workflow:
|
|
65
|
+
|
|
66
|
+
| Section | What it does |
|
|
67
|
+
| ------- | ------------ |
|
|
68
|
+
| `check-version` job | Reads `apps/desktop/src-tauri/tauri.conf.json` version, checks whether `desktop-v<version>` tag exists |
|
|
69
|
+
| `build` job (matrix) | Builds macOS (arm64 + x86_64) and Windows (x86_64) using `tauri-apps/tauri-action` |
|
|
70
|
+
| `notify` job | Downloads `latest.json` from the GitHub release, posts release metadata to the CodeByPlan API |
|
|
71
|
+
| `contents: write` permission | Required to create tags and GitHub releases |
|
|
72
|
+
|
|
73
|
+
The build matrix:
|
|
74
|
+
|
|
75
|
+
| Platform | Target | Label |
|
|
76
|
+
| -------- | ------ | ----- |
|
|
77
|
+
| `macos-latest` | `aarch64-apple-darwin` | macOS (Apple Silicon) |
|
|
78
|
+
| `macos-latest` | `x86_64-apple-darwin` | macOS (Intel) |
|
|
79
|
+
| `windows-latest` | `x86_64-pc-windows-msvc` | Windows (x86_64) |
|
|
80
|
+
|
|
81
|
+
Windows leg is skipped when `WINDOWS_CERTIFICATE` secret is absent — lets macOS-only
|
|
82
|
+
notarized releases ship while the Windows EV cert is being procured.
|
|
83
|
+
|
|
84
|
+
## OIDC Setup for npm Publish
|
|
85
|
+
|
|
86
|
+
npm Trusted Publishing (OIDC) eliminates long-lived `NPM_TOKEN` secrets. GitHub exchanges
|
|
87
|
+
a short-lived OIDC token for a publish credential at workflow runtime.
|
|
88
|
+
|
|
89
|
+
**Requirements:**
|
|
90
|
+
|
|
91
|
+
1. npm >= 11.5.1 (the workflow upgrades npm before publishing — no manual action needed).
|
|
92
|
+
2. A Trusted Publisher entry on npmjs.com configured for this repo + workflow.
|
|
93
|
+
3. `id-token: write` permission on the publish job (already in the scaffolded template).
|
|
94
|
+
4. No `registry-url:` on `actions/setup-node` — that would inject `_authToken` into
|
|
95
|
+
`.npmrc`, shadowing the OIDC exchange and causing `E404`.
|
|
96
|
+
|
|
97
|
+
**Configuring the Trusted Publisher on npmjs.com:**
|
|
98
|
+
|
|
99
|
+
1. Go to `https://www.npmjs.com/package/<package-name>/access`.
|
|
100
|
+
2. Under **Trusted Publishers**, click **Add a publisher**.
|
|
101
|
+
3. Fill in:
|
|
102
|
+
- Publisher type: `GitHub Actions`
|
|
103
|
+
- Repository owner: `<github-org>`
|
|
104
|
+
- Repository name: `<repo-slug>`
|
|
105
|
+
- Workflow filename: `publish.yml`
|
|
106
|
+
- Environment: (blank unless a GitHub Environment is used)
|
|
107
|
+
4. Save.
|
|
108
|
+
|
|
109
|
+
After the first successful publish, no further action is needed unless the workflow
|
|
110
|
+
filename or repo changes.
|
|
111
|
+
|
|
112
|
+
**Prerelease dist-tag routing:**
|
|
113
|
+
|
|
114
|
+
The workflow computes the dist-tag from the version string:
|
|
115
|
+
|
|
116
|
+
| Version | dist-tag |
|
|
117
|
+
| ------- | -------- |
|
|
118
|
+
| `1.2.3` | `latest` |
|
|
119
|
+
| `1.2.3-beta.1` | `beta` |
|
|
120
|
+
| `1.2.3-rc.1` | `rc` |
|
|
121
|
+
|
|
122
|
+
Consumers install the stable channel with `npm install <pkg>` and the prerelease channel
|
|
123
|
+
with `npm install <pkg>@beta`.
|
|
124
|
+
|
|
125
|
+
## Drift Guard
|
|
126
|
+
|
|
127
|
+
Both workflow files may be adopted from the canonical templates via:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
npx codebyplan cd scaffold-workflow [--force]
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Without `--force`, the skill shows a diff of the existing file vs the template before
|
|
134
|
+
overwriting. **Never silently overwrite a customized workflow** — always diff first and
|
|
135
|
+
confirm.
|
|
136
|
+
|
|
137
|
+
Drift from the canonical template accumulates when:
|
|
138
|
+
|
|
139
|
+
- The repo patches a workflow inline (e.g. changes `node-version`).
|
|
140
|
+
- A new version of the template ships in `codebyplan` but the repo has not re-run
|
|
141
|
+
`/cbp-setup-cd`.
|
|
142
|
+
|
|
143
|
+
Recommended practice: re-run `/cbp-setup-cd` after each `codebyplan` version bump that
|
|
144
|
+
mentions workflow changes in its changelog; review the diff before accepting.
|
|
145
|
+
|
|
146
|
+
## Per-Surface Credential Var-Name Reference
|
|
147
|
+
|
|
148
|
+
Credential ENV VAR NAMES only — never the values. Set these as GitHub repository secrets
|
|
149
|
+
at Settings → Secrets and variables → Actions.
|
|
150
|
+
|
|
151
|
+
### npm surface (OIDC — no long-lived token required)
|
|
152
|
+
|
|
153
|
+
When `oidc_auth: true` (recommended):
|
|
154
|
+
|
|
155
|
+
| Var name | Purpose |
|
|
156
|
+
| -------- | ------- |
|
|
157
|
+
| *(none required)* | OIDC handles auth via Trusted Publisher; no secret needed |
|
|
158
|
+
|
|
159
|
+
When `oidc_auth: false` (fallback):
|
|
160
|
+
|
|
161
|
+
| Var name | Purpose |
|
|
162
|
+
| -------- | ------- |
|
|
163
|
+
| `NPM_TOKEN` | Long-lived npm automation token (scoped to the package) |
|
|
164
|
+
|
|
165
|
+
### tauri surface
|
|
166
|
+
|
|
167
|
+
| Var name | Required | Purpose |
|
|
168
|
+
| -------- | -------- | ------- |
|
|
169
|
+
| `TAURI_SIGNING_PRIVATE_KEY` | Yes | Updater artifact signing (all platforms) |
|
|
170
|
+
| `TAURI_SIGNING_PRIVATE_KEY_PASSWORD` | Yes | Passphrase for the signing key |
|
|
171
|
+
| `APPLE_CERTIFICATE` | macOS only | Base64-encoded `.p12` developer certificate |
|
|
172
|
+
| `APPLE_CERTIFICATE_PASSWORD` | macOS only | Password for the `.p12` certificate |
|
|
173
|
+
| `APPLE_SIGNING_IDENTITY` | macOS only | Certificate common name (`Developer ID Application: …`) |
|
|
174
|
+
| `APPLE_API_ISSUER` | macOS only | App Store Connect API issuer UUID |
|
|
175
|
+
| `APPLE_API_KEY` | macOS only | App Store Connect API key ID |
|
|
176
|
+
| `APPLE_API_KEY_CONTENT` | macOS only | Contents of the `.p8` API key file (for notarization) |
|
|
177
|
+
| `WINDOWS_CERTIFICATE` | Windows only | Base64-encoded EV certificate (`.pfx`) |
|
|
178
|
+
| `WINDOWS_CERTIFICATE_PASSWORD` | Windows only | Password for the `.pfx` certificate |
|
|
179
|
+
| `CODEBYPLAN_API_KEY` | notify job | API key for posting release metadata to the CodeByPlan API |
|
|
180
|
+
|
|
181
|
+
The Windows leg is skipped automatically when `WINDOWS_CERTIFICATE` is absent — macOS
|
|
182
|
+
notarized releases can ship independently while the Windows EV cert is being procured.
|
|
183
|
+
|
|
184
|
+
### vscode surface
|
|
185
|
+
|
|
186
|
+
| Var name | Required | Purpose |
|
|
187
|
+
| -------- | -------- | ------- |
|
|
188
|
+
| `VSCE_PAT` | Yes | VS Code Marketplace Personal Access Token |
|
|
189
|
+
|
|
190
|
+
### expo surface
|
|
191
|
+
|
|
192
|
+
| Var name | Required | Purpose |
|
|
193
|
+
| -------- | -------- | ------- |
|
|
194
|
+
| `EXPO_TOKEN` | Yes | EAS build + submit token |
|
|
195
|
+
|
|
196
|
+
## Troubleshooting
|
|
197
|
+
|
|
198
|
+
**publish.yml fails with `E401 Unauthorized`** — npm Trusted Publishing is not configured
|
|
199
|
+
on npmjs.com. Follow the OIDC Setup section above. Common mistake: the workflow filename in
|
|
200
|
+
the Trusted Publisher entry does not match the actual workflow filename (e.g. `release.yml`
|
|
201
|
+
vs `publish.yml`).
|
|
202
|
+
|
|
203
|
+
**publish.yml fails on `check if publish needed`** — GitHub Actions billing block or
|
|
204
|
+
spending-limit hit. Read the run annotations in the GitHub Actions UI, fix billing, run
|
|
205
|
+
`gh run rerun --failed <run-id>`, then merge manually if needed.
|
|
206
|
+
|
|
207
|
+
**release-desktop.yml: macOS build fails with `code signing error`** — the Apple
|
|
208
|
+
certificate in `APPLE_CERTIFICATE` secret is expired or the `APPLE_SIGNING_IDENTITY`
|
|
209
|
+
does not match the certificate's common name exactly. Verify with `security find-identity
|
|
210
|
+
-p codesigning -v` on a local Mac.
|
|
211
|
+
|
|
212
|
+
**release-desktop.yml: Windows leg skipped unexpectedly** — the `WINDOWS_CERTIFICATE`
|
|
213
|
+
secret may be empty or set to a blank string. An empty (but present) secret evaluates to
|
|
214
|
+
`''`, which the `env.HAS_WINDOWS_CERT` check treats as absent. Verify the secret value in
|
|
215
|
+
Settings → Secrets.
|
|
216
|
+
|
|
217
|
+
**Version already published on npm, workflow skips** — expected behavior for the stable
|
|
218
|
+
channel on main. If a re-publish is needed, use `workflow_dispatch` with `dry_run: false`.
|
|
219
|
+
|
|
220
|
+
**release-desktop.yml: tag already exists** — the `check-version` job detects the tag and
|
|
221
|
+
sets `should_release=false`. To re-release the same version, delete the `desktop-v<x>` tag
|
|
222
|
+
and re-run the workflow.
|
|
223
|
+
|
|
224
|
+
## Provider Roadmap
|
|
225
|
+
|
|
226
|
+
Additional CD provider reference docs are planned:
|
|
227
|
+
|
|
228
|
+
- `reference/gitlab-cd.md` — GitLab CI/CD release pipelines
|
|
229
|
+
- `reference/circleci-cd.md` — CircleCI release orbs
|
|
230
|
+
|
|
231
|
+
These will follow the same structure as this document when authored.
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
---
|
|
2
|
+
scope: org-shared
|
|
3
|
+
name: cbp-setup-ci
|
|
4
|
+
description: Detect CI platforms, write/update .codebyplan/ci.json, scaffold the GitHub Actions CI workflow, and enforce the required CI status check on the main branch. Interactive, idempotent.
|
|
5
|
+
argument-hint: "[--force]"
|
|
6
|
+
effort: xhigh
|
|
7
|
+
allowed-tools: Read, Write, Edit, Bash(cat *), Bash(jq *), Bash(test *), Bash(ls *), Bash(codebyplan ci *), Bash(npx codebyplan ci *), Bash(gh api *), Bash(gh auth *), AskUserQuestion
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# CI Setup
|
|
11
|
+
|
|
12
|
+
Configure `.codebyplan/ci.json`, scaffold `.github/workflows/ci.yml`, and register the
|
|
13
|
+
required GitHub status check so every PR runs a uniform CI gate.
|
|
14
|
+
|
|
15
|
+
Invoke at any time. Already-configured platforms are preserved unless `--force` is passed.
|
|
16
|
+
Pass `--force` to re-detect all platforms and overwrite existing platform keys.
|
|
17
|
+
|
|
18
|
+
## Arguments
|
|
19
|
+
|
|
20
|
+
Inspect `$ARGUMENTS` for `--force`. If present, set `force_mode = true`.
|
|
21
|
+
Absent: idempotent mode — existing platform keys in `.codebyplan/ci.json` are preserved;
|
|
22
|
+
`ci.yml` is not overwritten unless `--force`.
|
|
23
|
+
|
|
24
|
+
## Step 1 — Detect platforms + read current state
|
|
25
|
+
|
|
26
|
+
Run detection and read the existing config:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx codebyplan ci init --dry-run --json
|
|
30
|
+
cat .codebyplan/ci.json 2>/dev/null || echo '{}'
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The first command lists detected platform slugs without writing any files. The second reads
|
|
34
|
+
the current config for the idempotency check.
|
|
35
|
+
|
|
36
|
+
Display a detection table:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
Platform | Detected | Configured | Status
|
|
40
|
+
--------- | -------- | ---------- | ------
|
|
41
|
+
next_js | yes | yes | configured
|
|
42
|
+
package | yes | no | new
|
|
43
|
+
nestjs | no | no | absent
|
|
44
|
+
tauri | no | no | absent
|
|
45
|
+
vscode | no | no | absent
|
|
46
|
+
expo | no | no | absent
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Also show workflow + required-check state if `.codebyplan/ci.json` exists:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
jq '.workflow // {}' .codebyplan/ci.json 2>/dev/null
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Step 2 — Confirm the detected set
|
|
56
|
+
|
|
57
|
+
`codebyplan ci init` writes ci.json from signal-based auto-detection (next.config /
|
|
58
|
+
`@nestjs/core` / tauri.conf.json / `@types/vscode` / expo / a `packages/` dir) — it does NOT
|
|
59
|
+
accept an explicit platform list. So this step CONFIRMS the detected set; it is not a free
|
|
60
|
+
selector (a deselected platform cannot be withheld from `ci init`, and an undetected one
|
|
61
|
+
cannot be added through it).
|
|
62
|
+
|
|
63
|
+
AskUserQuestion (single choice):
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
Detected platforms: <list from Step 1>.
|
|
67
|
+
These (merged with any already in .codebyplan/ci.json) will be written. Proceed?
|
|
68
|
+
|
|
69
|
+
A) Proceed — write the detected platforms (recommended)
|
|
70
|
+
B) Cancel — stop without writing
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
If an expected platform is MISSING: add its detection signal (e.g. a `next.config.ts`, or
|
|
74
|
+
`@nestjs/core` in package.json) and re-run — detection is signal-based, not free-form.
|
|
75
|
+
To DROP a platform: remove its signal and re-run with `--force`, or edit `.codebyplan/ci.json`
|
|
76
|
+
directly. Without `--force`, existing platform keys are always preserved.
|
|
77
|
+
|
|
78
|
+
## Step 3 — Write .codebyplan/ci.json
|
|
79
|
+
|
|
80
|
+
Run `codebyplan ci init` to write the detected platforms:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npx codebyplan ci init [--force]
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The CLI deep-merges newly confirmed platforms into the existing config; existing keys are
|
|
87
|
+
left unchanged without `--force`. Confirm by reading back the result:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npx codebyplan ci init --dry-run --json
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Step 4 — Scaffold GitHub Actions workflow
|
|
94
|
+
|
|
95
|
+
Preview, then write `.github/workflows/ci.yml`:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npx codebyplan ci scaffold-workflow --dry-run
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
If the workflow already exists and `--force` is not set, confirm with the user before
|
|
102
|
+
writing. Then write:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npx codebyplan ci scaffold-workflow [--force] [--pnpm-version 10] [--node-version 22]
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The scaffolded workflow installs pnpm + Node, caches the pnpm store, installs deps with
|
|
109
|
+
`pnpm install --frozen-lockfile`, and runs full-repo checks under a single job named
|
|
110
|
+
**Lint + typecheck + test + build**.
|
|
111
|
+
|
|
112
|
+
If the CLI errors (network, missing bin), print the manual workflow template from
|
|
113
|
+
`reference/github-actions.md` and continue — workflow authoring is non-fatal.
|
|
114
|
+
|
|
115
|
+
## Step 5 — Enforce required status check
|
|
116
|
+
|
|
117
|
+
Register the GitHub required status check on the main branch:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
npx codebyplan ci enforce-check [--branch main] [--check-name "Lint + typecheck + test + build"]
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Behaviour:
|
|
124
|
+
- `workflow.required_check_enforced: true` already in `ci.json` — skip and report.
|
|
125
|
+
- `gh auth` not configured or API call fails with a permissions error — print the manual
|
|
126
|
+
fallback and point to `reference/github-actions.md` § Manual Setup.
|
|
127
|
+
- On success: the CLI writes `workflow.required_check_enforced: true` to `ci.json`.
|
|
128
|
+
|
|
129
|
+
**Name-match rule**: `--check-name` MUST equal `jobs.<job-id>.name` in `ci.yml` exactly.
|
|
130
|
+
A mismatch leaves the required check permanently pending. The default
|
|
131
|
+
`"Lint + typecheck + test + build"` matches the scaffolded template.
|
|
132
|
+
|
|
133
|
+
## Step 6 — Verify and report
|
|
134
|
+
|
|
135
|
+
Re-read the config and confirm the workflow file exists:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
cat .codebyplan/ci.json
|
|
139
|
+
test -f .github/workflows/ci.yml && echo "ci.yml present" || echo "ci.yml MISSING"
|
|
140
|
+
jq '.workflow' .codebyplan/ci.json
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Emit a summary:
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
CI Setup — Complete
|
|
147
|
+
|
|
148
|
+
Platform | unit_test | typecheck | build | lint | e2e
|
|
149
|
+
--------- | --------------- | -------------------- | ---------------- | ----------- | ---------
|
|
150
|
+
next_js | pnpm turbo test | pnpm turbo typecheck | pnpm turbo build | eslint.json | e2e.json
|
|
151
|
+
package | pnpm turbo test | pnpm turbo typecheck | pnpm turbo build | eslint.json | e2e.json
|
|
152
|
+
|
|
153
|
+
Workflow: .github/workflows/ci.yml (present)
|
|
154
|
+
Req check: Lint + typecheck + test + build (enforced: yes)
|
|
155
|
+
|
|
156
|
+
Next: push a branch and open a PR to verify the CI gate fires.
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Key Rules
|
|
160
|
+
|
|
161
|
+
- Idempotent — re-running without `--force` preserves all existing platform keys and the
|
|
162
|
+
workflow file; it never clobbers a customized `ci.yml`
|
|
163
|
+
- The required-check name MUST match `jobs.<job-id>.name` in `ci.yml` exactly — a mismatch
|
|
164
|
+
leaves the required check permanently pending
|
|
165
|
+
- Repos without `ci.json` fall back via `codebyplan ci resolve <category>` — this skill
|
|
166
|
+
writes the config that resolve reads
|
|
167
|
+
- This skill is org-shared; its template twin at
|
|
168
|
+
`packages/codebyplan-package/templates/skills/cbp-setup-ci/SKILL.md` must stay
|
|
169
|
+
byte-identical (GATE-6)
|
|
170
|
+
|
|
171
|
+
## Additional resources
|
|
172
|
+
|
|
173
|
+
- GitHub Actions workflow anatomy + required-check setup: [reference/github-actions.md](reference/github-actions.md)
|
|
174
|
+
- CI config schema: `packages/codebyplan-package/src/lib/types.ts` (`CiConfig`)
|
|
175
|
+
- Platform detection signals: `packages/codebyplan-package/src/lib/ci-init.ts` (`detectPlatforms`)
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# GitHub Actions CI Reference
|
|
2
|
+
|
|
3
|
+
Workflow anatomy, required status check setup, and troubleshooting for the
|
|
4
|
+
`codebyplan ci` scaffold.
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
GitHub Actions CI runs on every push and pull request. The `codebyplan ci scaffold-workflow`
|
|
9
|
+
command writes `.github/workflows/ci.yml` from a bundled template. The workflow installs
|
|
10
|
+
the Node + pnpm environment, caches dependencies, and runs a single job named
|
|
11
|
+
**Lint + typecheck + test + build** that gates every PR.
|
|
12
|
+
|
|
13
|
+
Workflow triggers:
|
|
14
|
+
|
|
15
|
+
```yaml
|
|
16
|
+
on:
|
|
17
|
+
push:
|
|
18
|
+
branches: [main]
|
|
19
|
+
pull_request:
|
|
20
|
+
branches: [main]
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## ci.yml Structure
|
|
24
|
+
|
|
25
|
+
Key sections of the scaffolded workflow:
|
|
26
|
+
|
|
27
|
+
| Section | What it does |
|
|
28
|
+
| ------- | ------------ |
|
|
29
|
+
| `on: push/pull_request` | Triggers on main pushes + all PRs targeting main |
|
|
30
|
+
| `pnpm/action-setup` | Installs pnpm at `{{PNPM_VERSION}}` (default: 10) |
|
|
31
|
+
| `actions/setup-node` | Installs Node.js at `{{NODE_VERSION}}` (default: 20) |
|
|
32
|
+
| pnpm store path + `actions/cache` | Caches the pnpm store keyed on lockfile hash |
|
|
33
|
+
| `pnpm install --frozen-lockfile` | Clean dep install — fails on lockfile drift |
|
|
34
|
+
| Job step: run checks | `pnpm -w lint && pnpm -w typecheck && pnpm -w test && pnpm -w build` |
|
|
35
|
+
|
|
36
|
+
The job `name:` field is `Lint + typecheck + test + build`. This string is what GitHub
|
|
37
|
+
registers as the required status check. **Changing this name breaks branch protection until
|
|
38
|
+
the required check entry is updated to match.**
|
|
39
|
+
|
|
40
|
+
Custom versions:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npx codebyplan ci scaffold-workflow --pnpm-version 9 --node-version 22
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Required Status Checks
|
|
47
|
+
|
|
48
|
+
GitHub branch protection can require a named CI check to pass before any PR merges.
|
|
49
|
+
`codebyplan ci enforce-check` automates this via the GitHub API (`gh api`).
|
|
50
|
+
|
|
51
|
+
The check name in branch protection is matched against `jobs.<job-id>.name` in the workflow
|
|
52
|
+
YAML. The exact string must match — capitalisation and whitespace matter. The default
|
|
53
|
+
scaffolded name is `Lint + typecheck + test + build`.
|
|
54
|
+
|
|
55
|
+
**Idempotency**: once enforced, `ci.json` records `workflow.required_check_enforced: true`.
|
|
56
|
+
Re-running `enforce-check` reads this flag and skips the API call.
|
|
57
|
+
|
|
58
|
+
## Manual Setup (GitHub UI)
|
|
59
|
+
|
|
60
|
+
Use when `enforce-check` cannot run (missing `gh auth`, insufficient API permissions):
|
|
61
|
+
|
|
62
|
+
1. Open the repository on GitHub.
|
|
63
|
+
2. Go to **Settings** → **Branches**.
|
|
64
|
+
3. Under **Branch protection rules**, click **Add rule** (or edit the existing rule for `main`).
|
|
65
|
+
4. In **Branch name pattern**, enter `main`.
|
|
66
|
+
5. Check **Require status checks to pass before merging**.
|
|
67
|
+
6. In the search box type `Lint + typecheck + test + build` and select it.
|
|
68
|
+
(The check must have run at least once for it to appear in the list — push a
|
|
69
|
+
commit to trigger the workflow first if the search returns nothing.)
|
|
70
|
+
7. Optionally check **Require branches to be up to date before merging**.
|
|
71
|
+
8. Click **Save changes**.
|
|
72
|
+
|
|
73
|
+
## Troubleshooting
|
|
74
|
+
|
|
75
|
+
**Required check stuck pending** — almost always a name mismatch. Compare the `name:`
|
|
76
|
+
field under your job in `ci.yml` with the required check name registered in branch
|
|
77
|
+
protection. They must be byte-identical.
|
|
78
|
+
|
|
79
|
+
**Workflow not triggering on a PR** — verify `on.pull_request.branches` includes the PR's
|
|
80
|
+
base branch. PRs targeting branches not in the list skip the workflow entirely.
|
|
81
|
+
|
|
82
|
+
**pnpm cache miss on every run** — confirm the cache key uses the lockfile hash:
|
|
83
|
+
|
|
84
|
+
```yaml
|
|
85
|
+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**`gh api` 403 on enforce-check** — the token needs admin write on the repo. For
|
|
89
|
+
fine-grained PATs, set the "Administration" repository permission to Read and write.
|
|
90
|
+
Otherwise use the Manual Setup path above.
|
|
91
|
+
|
|
92
|
+
## Provider Roadmap
|
|
93
|
+
|
|
94
|
+
Additional CI provider reference docs are planned:
|
|
95
|
+
|
|
96
|
+
- `reference/gitlab-ci.md` — GitLab CI/CD pipelines (`.gitlab-ci.yml` structure, required
|
|
97
|
+
pipeline gates, caching strategy)
|
|
98
|
+
- `reference/circleci.md` — CircleCI (`config.yml`, orbs, required workflow status checks)
|
|
99
|
+
|
|
100
|
+
These will follow the same structure as this document when authored.
|
|
@@ -110,6 +110,27 @@ If ALL detected surfaces are unconfigured AND the user picks Skip/Mark for all,
|
|
|
110
110
|
|
|
111
111
|
### Step 3 — Build the shipment plan
|
|
112
112
|
|
|
113
|
+
**cd.json pre-read (when present)**: before selecting deploy variants, read
|
|
114
|
+
`.codebyplan/cd.json` if it exists:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
cat .codebyplan/cd.json 2>/dev/null
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
When present, use its per-surface policy to inform variant selection:
|
|
121
|
+
|
|
122
|
+
| cd.json field | Effect on variant selection |
|
|
123
|
+
| ------------- | --------------------------- |
|
|
124
|
+
| `trigger` | `"push-to-main"` → confirm auto-deploy variant; other values surface as notes |
|
|
125
|
+
| `environment` | Non-empty → note the GitHub Environment name in the plan (approval gate may apply) |
|
|
126
|
+
| `approval_required: true` | Flag the surface as requiring manual approval in the plan summary |
|
|
127
|
+
| `oidc_auth: true` | Note that OIDC auth is used (no long-lived token secret to verify) |
|
|
128
|
+
| `credentials.env_var_names[]` | List expected secrets so the user can verify they are set in the repo |
|
|
129
|
+
| `version_gate: true` | Skip the surface when no version bump detected this checkpoint |
|
|
130
|
+
|
|
131
|
+
If `.codebyplan/cd.json` is absent (un-migrated repo), fall back to the existing
|
|
132
|
+
filesystem surface detection — no behavior change. Run `/cbp-setup-cd` to migrate.
|
|
133
|
+
|
|
113
134
|
For each surface with `configured: true`, determine the deploy variant:
|
|
114
135
|
|
|
115
136
|
| Surface | Variants |
|
|
@@ -79,12 +79,13 @@ If `branch_deleted === true`, run a conditional Supabase preview-branch teardown
|
|
|
79
79
|
> Lifecycle contract: see [[supabase-branch-lifecycle]].
|
|
80
80
|
|
|
81
81
|
- Read `FEAT_BRANCH` from the `feat_branch` field in the Step 3 JSON output — NOT from `git branch --show-current`. By the time Step 4 runs, `codebyplan ship` has already checked out the base branch (unless `--keep-feat` was passed), so the live branch is the base, not the feat branch.
|
|
82
|
-
-
|
|
82
|
+
- Resolve the parent project ref from config: `PARENT_REF=$(jq -r '.shipment.surfaces.supabase.project_ref' .codebyplan/shipment.json)` — never a hardcoded literal. If `PARENT_REF` resolves empty or `null` (no Supabase surface configured), skip the teardown silently — there is no preview branch to remove.
|
|
83
|
+
- Call `mcp__supabase__list_branches` with `project_id: $PARENT_REF`.
|
|
83
84
|
- Scan the returned list for an entry whose `name` exactly equals `$FEAT_BRANCH`.
|
|
84
85
|
- If found: call `mcp__supabase__delete_branch` with its `branch_id`. Report the Supabase delete outcome alongside `pr_url` / `merge_commit` / `branch_deleted`.
|
|
85
86
|
- If not found: no-op silently — the GitHub integration may have already removed the preview branch on PR close; not-found is success, NOT an error.
|
|
86
87
|
- If the `list_branches` call itself fails (network, auth, or a non-success response — distinct from a successful lookup that returns no match): emit a non-blocking warning that the Supabase preview branch for `$FEAT_BRANCH` may still exist and should be verified in the dashboard. Do not treat an API failure as a not-found success.
|
|
87
|
-
- Never delete the parent project `
|
|
88
|
+
- Never delete the parent project `$PARENT_REF` itself or any persistent/production branch.
|
|
88
89
|
- This coordinates safely with `/cbp-checkpoint-end` — the existence-checked delete makes any second attempt a harmless no-op.
|
|
89
90
|
|
|
90
91
|
## Key Rules
|
|
@@ -9,11 +9,11 @@ effort: high
|
|
|
9
9
|
|
|
10
10
|
# Standalone Task Check Command
|
|
11
11
|
|
|
12
|
-
AI-driven production readiness review for standalone tasks. Spawns the `cbp-
|
|
12
|
+
AI-driven production readiness review for standalone tasks. Spawns the `cbp-verify-reviewer` agent (`scope: 'task'`) for thorough verification including user satisfaction discussion. This command is a thin orchestrator — the agent does the heavy lifting.
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## Spawn Failure Is A Hard Gate Failure
|
|
15
15
|
|
|
16
|
-
If the `cbp-
|
|
16
|
+
If the `cbp-verify-reviewer` agent spawn fails for any reason, STOP and surface a retry directive per `rules/spawn-failure-is-gate-failure.md`. Do NOT walk the agent's phases inline and self-certify — a missing fresh-context review is a hard gate failure, not a pass. Retry when capacity returns.
|
|
17
17
|
|
|
18
18
|
## When Used
|
|
19
19
|
|
|
@@ -34,7 +34,7 @@ Any multi-segment input is an error:
|
|
|
34
34
|
|
|
35
35
|
```
|
|
36
36
|
standalone-task-check: argument `{value}` looks like a checkpoint-task pair.
|
|
37
|
-
Use /cbp-
|
|
37
|
+
Use /cbp-verify {chk}-{task} for checkpoint-bound tasks.
|
|
38
38
|
Standalone tasks use a bare number, e.g. /cbp-standalone-task-check 45.
|
|
39
39
|
```
|
|
40
40
|
|
|
@@ -44,7 +44,7 @@ Error cases: any multi-segment input, `abc`, `108-`, `-1`, anything with whitesp
|
|
|
44
44
|
|
|
45
45
|
- `standalone-task-check 45` → standalone TASK-45
|
|
46
46
|
- `standalone-task-check` (no arg) → active in-progress task via `get_current_standalone_task`
|
|
47
|
-
- `standalone-task-check 141-3` → error: "Use /cbp-
|
|
47
|
+
- `standalone-task-check 141-3` → error: "Use /cbp-verify {chk}-{task} for checkpoint-bound tasks."
|
|
48
48
|
- `standalone-task-check abc` → error: malformed
|
|
49
49
|
|
|
50
50
|
### Step 1.5: Get Current Task
|
|
@@ -66,7 +66,7 @@ If any rounds still in_progress:
|
|
|
66
66
|
## Cannot Run Standalone Task Check
|
|
67
67
|
|
|
68
68
|
Standalone TASK-[N] has an active round (Round [N]). Complete it first:
|
|
69
|
-
- Run `/cbp-
|
|
69
|
+
- Run `/cbp-verify` to finish the round
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
Stop here.
|
|
@@ -78,12 +78,13 @@ Stop here.
|
|
|
78
78
|
|
|
79
79
|
No checkpoint context is needed — standalone tasks have no parent checkpoint.
|
|
80
80
|
|
|
81
|
-
### Step 4: Spawn
|
|
81
|
+
### Step 4: Spawn Verify Reviewer Agent
|
|
82
82
|
|
|
83
|
-
Spawn `cbp-
|
|
83
|
+
Spawn `cbp-verify-reviewer` agent (`scope: 'task'`) with full context:
|
|
84
84
|
|
|
85
85
|
```yaml
|
|
86
86
|
input:
|
|
87
|
+
scope: 'task'
|
|
87
88
|
task_number: [N]
|
|
88
89
|
round_number: [total rounds]
|
|
89
90
|
checkpoint: null
|
|
@@ -117,7 +118,7 @@ Issues found that need addressing:
|
|
|
117
118
|
- [issue 2]
|
|
118
119
|
```
|
|
119
120
|
|
|
120
|
-
Suggest: `/cbp-round-
|
|
121
|
+
Suggest: `/cbp-round-plan` with specific issues. Stop — wait for user.
|
|
121
122
|
|
|
122
123
|
**NOT READY — needs new task:**
|
|
123
124
|
|