codebyplan 1.13.52 → 1.13.53
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 +1776 -449
- package/package.json +1 -1
- package/templates/agents/cbp-security-agent.md +9 -1
- package/templates/agents/cbp-testing-qa-agent.md +23 -9
- package/templates/github-workflows/ci.yml +63 -0
- package/templates/github-workflows/publish.yml +8 -27
- package/templates/github-workflows/release-desktop.yml +215 -0
- package/templates/settings.project.base.json +7 -1
- package/templates/skills/cbp-checkpoint-check/SKILL.md +9 -1
- package/templates/skills/cbp-checkpoint-end/SKILL.md +5 -1
- package/templates/skills/cbp-round-check/SKILL.md +2 -0
- 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-standalone-task-testing/SKILL.md +11 -2
- package/templates/skills/cbp-task-testing/SKILL.md +2 -0
|
@@ -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 |
|
|
@@ -86,13 +86,22 @@ Read every non-deleted file in the aggregated list. Build a mental model of the
|
|
|
86
86
|
|
|
87
87
|
Capture stdout and stderr for each check.
|
|
88
88
|
|
|
89
|
+
**ci.json command resolution (absent-fallback safe):** Before running the checks below, resolve commands from `.codebyplan/ci.json`:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
CI_TYPES_CMD=$(npx codebyplan ci resolve typecheck 2>/dev/null)
|
|
93
|
+
CI_UNIT_CMD=$(npx codebyplan ci resolve unit_test 2>/dev/null)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Fallback: if `.codebyplan/ci.json` is absent, `ci resolve` returns the central default (exit 0). If the binary is unavailable, the variable is empty and the `${CI_*_CMD:-<literal>}` guards in the table below activate the hardcoded fallback.
|
|
97
|
+
|
|
89
98
|
**Hard-fail tests** (block completion):
|
|
90
99
|
|
|
91
100
|
| Category | Command | Condition |
|
|
92
101
|
|----------|---------|-----------|
|
|
93
102
|
| Full-repo lint | `pnpm -w lint` | Always |
|
|
94
|
-
| Full-repo types |
|
|
95
|
-
| Full-repo unit tests |
|
|
103
|
+
| Full-repo types | `${CI_TYPES_CMD:-pnpm exec tsc --noEmit}` | Source files changed |
|
|
104
|
+
| Full-repo unit tests | `${CI_UNIT_CMD:-pnpm test --run}` | Source files in aggregated_files |
|
|
96
105
|
| Per-package E2E | `pnpm --filter <pkg> e2e:test` | UI files in aggregated_files |
|
|
97
106
|
|
|
98
107
|
These are the workspace-wide / cross-package checks only — per-app build/lint/types, the `console.log`/debug scan, the OWASP/secret grep, and `pnpm audit` already ran per-round inside `testing-qa-agent` and are NOT repeated here.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
+
scope: org-shared
|
|
2
3
|
name: cbp-task-testing
|
|
3
4
|
description: Run comprehensive task-level testing after /cbp-task-check passes
|
|
4
5
|
argument-hint: [chk-task]
|
|
@@ -275,3 +276,4 @@ Waiting for user to run `/cbp-task-create`.
|
|
|
275
276
|
- **Writes**: `codebyplan task update` (CLI write-through; MCP `update_task` break-glass)
|
|
276
277
|
- **Triggers**: `cbp-task-complete` (auto via Skill tool, when ALL PASS — `ask`-tier, permission prompt IS the human gate); `cbp-round-input` (auto via Skill tool, on minor problems — `allow`-tier, fires silently)
|
|
277
278
|
- **Triggered by**: `cbp-task-check` auto-triggers this skill via Skill tool on READY verdict; `cbp-task-testing` is `allow`-tier and fires silently (no permission prompt)
|
|
279
|
+
- **ci.json awareness**: `codebyplan check --scope task --json` is turbo-native — it runs `turbo run lint|typecheck|test` directly and does NOT read `.codebyplan/ci.json`. ci.json command resolution (via `npx codebyplan ci resolve <category> [--platform <slug>]`) is used by non-check consumers (`cbp-testing-qa-agent`, `cbp-security-agent`, `cbp-standalone-task-testing`, `cbp-checkpoint-check`), with a central-default fallback ensuring exit 0 even when ci.json is absent.
|