codebyplan 1.5.1 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +4462 -748
- package/package.json +5 -1
- package/templates/.gitkeep +0 -0
- package/templates/README.md +20 -0
- package/templates/agents/cbp-cc-executor.md +213 -0
- package/templates/agents/cbp-database-agent.md +229 -0
- package/templates/agents/cbp-improve-claude.md +245 -0
- package/templates/agents/cbp-improve-round.md +284 -0
- package/templates/agents/cbp-mechanical-edits.md +111 -0
- package/templates/agents/cbp-research.md +282 -0
- package/templates/agents/cbp-round-executor.md +604 -0
- package/templates/agents/cbp-security-agent.md +134 -0
- package/templates/agents/cbp-task-check.md +213 -0
- package/templates/agents/cbp-task-planner.md +582 -0
- package/templates/agents/cbp-test-e2e-agent.md +363 -0
- package/templates/agents/cbp-testing-qa-agent.md +400 -0
- package/templates/context/mcp-docs.md +139 -0
- package/templates/hooks/README.md +236 -0
- package/templates/hooks/cbp-auto-test-hooks.sh +44 -0
- package/templates/hooks/cbp-lint-format-on-edit.sh +159 -0
- package/templates/hooks/cbp-maestro-yaml-validate.sh +100 -0
- package/templates/hooks/cbp-mcp-migration-guard.sh +32 -0
- package/templates/hooks/cbp-mcp-round-sync.sh +79 -0
- package/templates/hooks/cbp-mcp-worktree-inject.sh +76 -0
- package/templates/hooks/cbp-notify.sh +68 -0
- package/templates/hooks/cbp-plugin-dispatch.sh +29 -0
- package/templates/hooks/cbp-pre-commit-quality-gate.sh +204 -0
- package/templates/hooks/cbp-statusline.sh +347 -0
- package/templates/hooks/cbp-subagent-statusline.sh +182 -0
- package/templates/hooks/cbp-test-coverage-gate.sh +144 -0
- package/templates/hooks/cbp-test-hooks.sh +320 -0
- package/templates/hooks/hooks.json +85 -0
- package/templates/hooks/validate-context-usage.sh +59 -0
- package/templates/hooks/validate-git-commit.sh +78 -0
- package/templates/hooks/validate-git-stash-deny.sh +32 -0
- package/templates/hooks/validate-structure-lengths.sh +57 -0
- package/templates/hooks/validate-structure-lib.sh +104 -0
- package/templates/hooks/validate-structure-patterns.sh +54 -0
- package/templates/hooks/validate-structure-scope.sh +33 -0
- package/templates/hooks/validate-structure-smoke.sh +95 -0
- package/templates/hooks/validate-structure-templates.sh +34 -0
- package/templates/hooks/validate-structure.sh +69 -0
- package/templates/rules/.gitkeep +0 -0
- package/templates/rules/README.md +47 -0
- package/templates/rules/context-file-loading.md +52 -0
- package/templates/rules/scope-vocabulary.md +64 -0
- package/templates/rules/todo-backend.md +109 -0
- package/templates/settings.project.base.json +55 -0
- package/templates/settings.user.base.json +25 -0
- package/templates/skills/cbp-build-cc-agent/SKILL.md +139 -0
- package/templates/skills/cbp-build-cc-agent/examples/read-only-reviewer.md +32 -0
- package/templates/skills/cbp-build-cc-agent/examples/with-hooks.md +41 -0
- package/templates/skills/cbp-build-cc-agent/examples/with-skills-preload.md +25 -0
- package/templates/skills/cbp-build-cc-agent/reference/cbp-quality.md +153 -0
- package/templates/skills/cbp-build-cc-agent/reference/frontmatter-fields.md +37 -0
- package/templates/skills/cbp-build-cc-agent/reference/permission-modes.md +18 -0
- package/templates/skills/cbp-build-cc-agent/scripts/validate-agent.sh +67 -0
- package/templates/skills/cbp-build-cc-agent/templates/agent.md +66 -0
- package/templates/skills/cbp-build-cc-claude-file/SKILL.md +178 -0
- package/templates/skills/cbp-build-cc-claude-file/examples/minimal-project.md +33 -0
- package/templates/skills/cbp-build-cc-claude-file/examples/monorepo-with-imports.md +39 -0
- package/templates/skills/cbp-build-cc-claude-file/reference/imports.md +72 -0
- package/templates/skills/cbp-build-cc-claude-file/reference/what-belongs.md +39 -0
- package/templates/skills/cbp-build-cc-claude-file/templates/project-claude-md.md +48 -0
- package/templates/skills/cbp-build-cc-claude-file/templates/user-claude-md.md +22 -0
- package/templates/skills/cbp-build-cc-memory/SKILL.md +201 -0
- package/templates/skills/cbp-build-cc-memory/examples/feedback-memory.md +11 -0
- package/templates/skills/cbp-build-cc-memory/examples/project-memory.md +11 -0
- package/templates/skills/cbp-build-cc-memory/examples/reference-memory.md +13 -0
- package/templates/skills/cbp-build-cc-memory/examples/user-memory.md +14 -0
- package/templates/skills/cbp-build-cc-memory/reference/memory-types.md +59 -0
- package/templates/skills/cbp-build-cc-memory/reference/when-to-save.md +62 -0
- package/templates/skills/cbp-build-cc-memory/templates/MEMORY-index.md +4 -0
- package/templates/skills/cbp-build-cc-memory/templates/memory-entry.md +15 -0
- package/templates/skills/cbp-build-cc-mode/SKILL.md +99 -0
- package/templates/skills/cbp-build-cc-rule/SKILL.md +176 -0
- package/templates/skills/cbp-build-cc-rule/examples/global-rule.md +19 -0
- package/templates/skills/cbp-build-cc-rule/examples/scoped-rule.md +41 -0
- package/templates/skills/cbp-build-cc-rule/reference/paths-patterns.md +48 -0
- package/templates/skills/cbp-build-cc-rule/templates/rule.md +32 -0
- package/templates/skills/cbp-build-cc-settings/SKILL.md +220 -0
- package/templates/skills/cbp-build-cc-settings/examples/hooks-config.json +64 -0
- package/templates/skills/cbp-build-cc-settings/examples/permissions-config.json +34 -0
- package/templates/skills/cbp-build-cc-settings/examples/sandbox-config.json +42 -0
- package/templates/skills/cbp-build-cc-settings/reference/cbp-conventions.md +104 -0
- package/templates/skills/cbp-build-cc-settings/reference/permission-rules.md +61 -0
- package/templates/skills/cbp-build-cc-settings/reference/scope-precedence.md +73 -0
- package/templates/skills/cbp-build-cc-settings/reference/settings-fields.md +166 -0
- package/templates/skills/cbp-build-cc-settings/templates/settings.json +23 -0
- package/templates/skills/cbp-build-cc-settings/templates/settings.local.json +10 -0
- package/templates/skills/cbp-build-cc-skill/SKILL.md +154 -0
- package/templates/skills/cbp-build-cc-skill/examples/dynamic-context.md +31 -0
- package/templates/skills/cbp-build-cc-skill/examples/fork-skill.md +22 -0
- package/templates/skills/cbp-build-cc-skill/examples/knowledge-skill.md +25 -0
- package/templates/skills/cbp-build-cc-skill/examples/task-skill.md +29 -0
- package/templates/skills/cbp-build-cc-skill/reference/cbp-quality.md +157 -0
- package/templates/skills/cbp-build-cc-skill/reference/frontmatter-fields.md +35 -0
- package/templates/skills/cbp-build-cc-skill/reference/string-substitutions.md +60 -0
- package/templates/skills/cbp-build-cc-skill/scripts/validate-skill.sh +90 -0
- package/templates/skills/cbp-build-cc-skill/templates/skill.md +51 -0
- package/templates/skills/cbp-checkpoint-check/SKILL.md +156 -0
- package/templates/skills/cbp-checkpoint-complete/SKILL.md +109 -0
- package/templates/skills/cbp-checkpoint-create/SKILL.md +116 -0
- package/templates/skills/cbp-checkpoint-end/SKILL.md +241 -0
- package/templates/skills/cbp-checkpoint-plan/SKILL.md +137 -0
- package/templates/skills/cbp-checkpoint-plan/reference/alternative-comparison-template.md +54 -0
- package/templates/skills/cbp-checkpoint-plan/reference/dep-decision-rubric.md +50 -0
- package/templates/skills/cbp-checkpoint-plan/reference/e2e-discovery-probe.md +57 -0
- package/templates/skills/cbp-checkpoint-plan/reference/gap-analysis-playbook.md +47 -0
- package/templates/skills/cbp-checkpoint-start/SKILL.md +84 -0
- package/templates/skills/cbp-checkpoint-update/SKILL.md +115 -0
- package/templates/skills/cbp-frontend-a11y/SKILL.md +109 -0
- package/templates/skills/cbp-frontend-a11y/reference/aria-roles-states.md +130 -0
- package/templates/skills/cbp-frontend-a11y/reference/contrast-visual.md +122 -0
- package/templates/skills/cbp-frontend-a11y/reference/keyboard-patterns.md +154 -0
- package/templates/skills/cbp-frontend-a11y/reference/semantic-html.md +111 -0
- package/templates/skills/cbp-frontend-design/SKILL.md +145 -0
- package/templates/skills/cbp-frontend-design/reference/nextjs-scss.md +118 -0
- package/templates/skills/cbp-frontend-design/reference/rn-expo.md +101 -0
- package/templates/skills/cbp-frontend-design/reference/tauri-react.md +82 -0
- package/templates/skills/cbp-frontend-ui/SKILL.md +262 -0
- package/templates/skills/cbp-frontend-ui/reference/ui-label-maps.md +42 -0
- package/templates/skills/cbp-frontend-ui/reference/ui-layout-patterns.md +105 -0
- package/templates/skills/cbp-frontend-ui/reference/variant-defaults.md +149 -0
- package/templates/skills/cbp-frontend-ux/SKILL.md +181 -0
- package/templates/skills/cbp-git-branch-feat-create/SKILL.md +115 -0
- package/templates/skills/cbp-git-commit/SKILL.md +278 -0
- package/templates/skills/cbp-git-worktree-create/SKILL.md +226 -0
- package/templates/skills/cbp-git-worktree-remove/SKILL.md +145 -0
- package/templates/skills/cbp-merge-main/SKILL.md +228 -0
- package/templates/skills/cbp-round-check/SKILL.md +104 -0
- package/templates/skills/cbp-round-end/SKILL.md +183 -0
- package/templates/skills/cbp-round-end/reference/findings-presentation.md +44 -0
- package/templates/skills/cbp-round-end/reference/inline-fallback.md +35 -0
- package/templates/skills/cbp-round-execute/SKILL.md +211 -0
- package/templates/skills/cbp-round-execute/reference/inline-fallback.md +59 -0
- package/templates/skills/cbp-round-input/SKILL.md +165 -0
- package/templates/skills/cbp-round-start/SKILL.md +222 -0
- package/templates/skills/cbp-round-update/SKILL.md +163 -0
- package/templates/skills/cbp-session-end/SKILL.md +187 -0
- package/templates/skills/cbp-session-start/SKILL.md +155 -0
- package/templates/skills/cbp-ship/SKILL.md +332 -0
- package/templates/skills/cbp-ship/reference/changesets-overview.md +120 -0
- package/templates/skills/cbp-ship/reference/eas-cli-overview.md +60 -0
- package/templates/skills/cbp-ship/reference/gh-cli-overview.md +135 -0
- package/templates/skills/cbp-ship/reference/gh-cli-shipment-commands.md +283 -0
- package/templates/skills/cbp-ship/reference/npm-publish-monorepo.md +252 -0
- package/templates/skills/cbp-ship/reference/npm-publish-oidc-trusted.md +157 -0
- package/templates/skills/cbp-ship/reference/npm-publish-overview.md +171 -0
- package/templates/skills/cbp-ship/reference/preflight-checklist.md +88 -0
- package/templates/skills/cbp-ship/reference/railway-nestjs-deployment.md +169 -0
- package/templates/skills/cbp-ship/reference/railway-overview.md +120 -0
- package/templates/skills/cbp-ship/reference/railway-troubleshooting.md +168 -0
- package/templates/skills/cbp-ship/reference/release-please-overview.md +99 -0
- package/templates/skills/cbp-ship/reference/surface-expo-eas.md +155 -0
- package/templates/skills/cbp-ship/reference/surface-npm.md +180 -0
- package/templates/skills/cbp-ship/reference/surface-railway.md +152 -0
- package/templates/skills/cbp-ship/reference/surface-supabase.md +178 -0
- package/templates/skills/cbp-ship/reference/surface-tauri.md +138 -0
- package/templates/skills/cbp-ship/reference/surface-vercel.md +124 -0
- package/templates/skills/cbp-ship/reference/surface-vscode-ext.md +144 -0
- package/templates/skills/cbp-ship/reference/surfaces.md +60 -0
- package/templates/skills/cbp-ship/reference/testflight-automation.md +215 -0
- package/templates/skills/cbp-ship/reference/testflight-internal-vs-external.md +69 -0
- package/templates/skills/cbp-ship/reference/testflight-overview.md +98 -0
- package/templates/skills/cbp-ship/reference/versioning.md +116 -0
- package/templates/skills/cbp-ship/scripts/detect-surfaces.sh +217 -0
- package/templates/skills/cbp-ship/scripts/verify-expo-eas.sh +35 -0
- package/templates/skills/cbp-ship/scripts/verify-npm.sh +21 -0
- package/templates/skills/cbp-ship/scripts/verify-railway.sh +41 -0
- package/templates/skills/cbp-ship/scripts/verify-supabase.sh +19 -0
- package/templates/skills/cbp-ship/scripts/verify-tauri.sh +24 -0
- package/templates/skills/cbp-ship/scripts/verify-vercel.sh +32 -0
- package/templates/skills/cbp-ship/scripts/verify-vscode-ext.sh +25 -0
- package/templates/skills/cbp-ship/templates/eas.json +66 -0
- package/templates/skills/cbp-ship/templates/railway.toml +15 -0
- package/templates/skills/cbp-ship/templates/release-please-config.json +17 -0
- package/templates/skills/cbp-ship/templates/vercel.json +19 -0
- package/templates/skills/cbp-ship/templates/vscodeignore +21 -0
- package/templates/skills/cbp-ship/templates/workflow-changesets.yml +41 -0
- package/templates/skills/cbp-ship/templates/workflow-eas-submit.yml +53 -0
- package/templates/skills/cbp-ship/templates/workflow-npm-publish.yml +36 -0
- package/templates/skills/cbp-ship/templates/workflow-release-please.yml +21 -0
- package/templates/skills/cbp-ship/templates/workflow-tauri-release.yml +69 -0
- package/templates/skills/cbp-ship/templates/workflow-vsce-publish.yml +31 -0
- package/templates/skills/cbp-ship-configure/SKILL.md +296 -0
- package/templates/skills/cbp-ship-configure/reference/expo-mobile.md +204 -0
- package/templates/skills/cbp-ship-configure/reference/npm-package.md +165 -0
- package/templates/skills/cbp-ship-configure/reference/railway-backend.md +199 -0
- package/templates/skills/cbp-ship-configure/reference/supabase.md +200 -0
- package/templates/skills/cbp-ship-configure/reference/tauri-desktop.md +181 -0
- package/templates/skills/cbp-ship-configure/reference/vercel.md +117 -0
- package/templates/skills/cbp-ship-configure/reference/vscode-ext.md +155 -0
- package/templates/skills/cbp-ship-main/SKILL.md +65 -0
- package/templates/skills/cbp-supabase-branch-check/SKILL.md +337 -0
- package/templates/skills/cbp-supabase-branch-check/reference/dag-steps.md +29 -0
- package/templates/skills/cbp-supabase-migrate/SKILL.md +314 -0
- package/templates/skills/cbp-supabase-migrate/reference/advisor-triage.md +70 -0
- package/templates/skills/cbp-supabase-migrate/reference/cli-fallback.md +87 -0
- package/templates/skills/cbp-supabase-migrate/reference/preflight-dry-run.md +58 -0
- package/templates/skills/cbp-supabase-setup/SKILL.md +239 -0
- package/templates/skills/cbp-supabase-setup/reference/branching-setup.md +121 -0
- package/templates/skills/cbp-supabase-setup/reference/cli-fallback.md +109 -0
- package/templates/skills/cbp-task-check/SKILL.md +166 -0
- package/templates/skills/cbp-task-complete/SKILL.md +206 -0
- package/templates/skills/cbp-task-complete/reference/checkpoint-done-branching.md +48 -0
- package/templates/skills/cbp-task-complete/reference/next-step-heuristic.md +56 -0
- package/templates/skills/cbp-task-create/SKILL.md +167 -0
- package/templates/skills/cbp-task-start/SKILL.md +239 -0
- package/templates/skills/cbp-task-testing/SKILL.md +277 -0
- package/templates/skills/cbp-todo/SKILL.md +111 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
---
|
|
2
|
+
scope: org-shared
|
|
3
|
+
name: cbp-merge-main
|
|
4
|
+
description: Merge main into the current feat branch with interactive per-conflict resolution and inline QA re-run
|
|
5
|
+
model: sonnet
|
|
6
|
+
effort: high
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Merge Main into Feat Branch
|
|
10
|
+
|
|
11
|
+
Codifies the long-lived-branch-integration auto-memory rule (`[[feedback_long-lived-branch-integration]]`): when working on a feat branch that has diverged from main, merge main INTO the feat branch (not the reverse), resolve conflicts with the user, run a scoped QA pass, then return control to the caller — never rebase, never force-push, never push automatically.
|
|
12
|
+
|
|
13
|
+
Triggered by `/cbp-task-start` (Step 3.6, optional stale-check), `/cbp-task-complete` (Step 4.5, mandatory pre-complete), and `/cbp-checkpoint-end` (Step 0, mandatory pre-shipment). User can also invoke manually at any time.
|
|
14
|
+
|
|
15
|
+
## When to Use
|
|
16
|
+
|
|
17
|
+
- **Auto-trigger (optional)**: `/cbp-task-start` Step 3.6 detects the feat branch is >10 commits behind `origin/{BASE}` OR the last fetch is >24h old.
|
|
18
|
+
- **Auto-trigger (mandatory)**: `/cbp-task-complete` Step 4.5 — always run before marking a task complete to ensure the feat branch includes the latest main work.
|
|
19
|
+
- **Auto-trigger (mandatory)**: `/cbp-checkpoint-end` Step 0 — always run before shipment to ensure no main drift reaches production.
|
|
20
|
+
- **Manual invocation**: user runs `/cbp-merge-main` directly when they know main has advanced and want to pull it in immediately.
|
|
21
|
+
|
|
22
|
+
## Instructions
|
|
23
|
+
|
|
24
|
+
### Step 0: Pre-flight
|
|
25
|
+
|
|
26
|
+
1. Read `.codebyplan/git.json` → `branch_config.base` (default `"main"`, read defensively — file may be absent) and `branch_config.protected` (default `["main"]`). Do NOT reference a removed `branch_config.integration` key.
|
|
27
|
+
2. Run `git branch --show-current` → `CURRENT`. If `CURRENT` is in `branch_config.protected` OR does NOT match `feat/*`, error and STOP:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
/cbp-merge-main must run on a feat branch. Current: {CURRENT}.
|
|
31
|
+
Switch to a feat branch first.
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
3. Working-tree gate:
|
|
35
|
+
- Run `git diff --quiet`; if exit code is non-zero, `unstaged_dirty=true`, else `unstaged_dirty=false`.
|
|
36
|
+
- Run `git diff --cached --quiet`; if exit code is non-zero, `staged_present=true`, else `staged_present=false`.
|
|
37
|
+
|
|
38
|
+
Decision matrix:
|
|
39
|
+
- `unstaged_dirty=true` → AskUserQuestion:
|
|
40
|
+
- **Commit current changes first** (recommended) — trigger `/cbp-git-commit`, then re-check tree, then proceed.
|
|
41
|
+
- **Proceed with dirty tree** — soft warning; the merge may interleave with uncommitted edits.
|
|
42
|
+
- **Cancel** — abort the skill.
|
|
43
|
+
- `unstaged_dirty=false AND staged_present=true` → print one informational line and proceed to Step 1:
|
|
44
|
+
`Staged changes detected — proceeding with merge.`
|
|
45
|
+
(Pre-staged files will be included in the merge commit at Step 2 — this is intentional; the caller already approved them via /cbp-round-update.)
|
|
46
|
+
- `unstaged_dirty=false AND staged_present=false` → proceed silently to Step 1.
|
|
47
|
+
- Either `git diff` command exits with code ≥ 2 (git hard error — not-a-repo, detached HEAD with no commits, index lock, corrupt object store): surface the raw error output and STOP. Do NOT proceed to Step 1.
|
|
48
|
+
|
|
49
|
+
NEVER `git stash` for any reason (per `[[feedback_no-git-stash]]`).
|
|
50
|
+
|
|
51
|
+
### Step 1: Fetch Latest Main
|
|
52
|
+
|
|
53
|
+
1. Run `git fetch origin {BASE}`. **If this fails (offline, auth, registry)**, abort:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
/cbp-merge-main cannot proceed offline — `git fetch origin {BASE}` failed.
|
|
57
|
+
Resolve connectivity and re-invoke.
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
2. Measure drift:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
BEHIND=$(git rev-list --count HEAD..origin/{BASE})
|
|
64
|
+
AHEAD=$(git rev-list --count origin/{BASE}..HEAD)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
3. If `BEHIND == 0`: print one-line `Already up to date with origin/{BASE} ({AHEAD} ahead, 0 behind).` and RETURN SUCCESS to the caller. No merge needed.
|
|
68
|
+
|
|
69
|
+
### Step 1.5: Migration Timestamp Collision Pre-Check
|
|
70
|
+
|
|
71
|
+
Supabase migrations are version-keyed by their numeric filename prefix. Two files sharing a prefix break `supabase db push`: the schema_migrations table records ONE version per prefix, the second file at the same prefix becomes orphaned, and every subsequent migration stalls — surfacing as the Supabase Preview check failing with `MIGRATIONS_FAILED`. Catch this BEFORE committing the merge, while a clean rollback is one `git merge --abort` away.
|
|
72
|
+
|
|
73
|
+
1. Probe both sides of the would-be merge. Use `git ls-files` for the HEAD side so any in-progress `git mv` staged in the index (e.g. a rename produced by step 5 of a prior pass through this section) is reflected — `git ls-tree HEAD` would still see the committed-only state and re-trigger the collision. Use `git ls-tree origin/{BASE}` for the main side since we want the committed remote state, not anything locally staged:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
git ls-files supabase/migrations/ 2>/dev/null \
|
|
77
|
+
| sed 's|.*/||' | sort > /tmp/cbp-merge-our-names.txt
|
|
78
|
+
git ls-tree -r --name-only origin/{BASE} supabase/migrations/ 2>/dev/null \
|
|
79
|
+
| sed 's|.*/||' | sort > /tmp/cbp-merge-their-names.txt
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
2. A true collision is a numeric prefix that appears on BOTH sides with DIFFERENT filenames. A shared filename (same prefix, same basename — i.e. an already-merged migration) is NOT a collision. Compute the unique-to-each-side basenames first, then look for shared prefixes within that unique set:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Files unique to each side (same-named files are NOT collisions)
|
|
86
|
+
comm -23 /tmp/cbp-merge-our-names.txt /tmp/cbp-merge-their-names.txt > /tmp/cbp-merge-only-ours.txt
|
|
87
|
+
comm -13 /tmp/cbp-merge-our-names.txt /tmp/cbp-merge-their-names.txt > /tmp/cbp-merge-only-theirs.txt
|
|
88
|
+
# True collision: a prefix in only-ours also appears in only-theirs (same prefix, different basename)
|
|
89
|
+
COLLISIONS=$(cat /tmp/cbp-merge-only-ours.txt /tmp/cbp-merge-only-theirs.txt \
|
|
90
|
+
| sed 's|_.*||' | sort | uniq -d)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
3. If `COLLISIONS` is empty, proceed silently to Step 2.
|
|
94
|
+
|
|
95
|
+
4. If `COLLISIONS` is non-empty, for each colliding prefix list both file paths (one from `HEAD`, one from `origin/{BASE}`) and surface via AskUserQuestion:
|
|
96
|
+
|
|
97
|
+
- **Rename HEAD-side (Recommended when a main migration is already applied to a shared remote)** — rename the local file to a fresh, sequential timestamp that respects existing apply-order dependencies (probe `supabase migration list --db-url <preview>` if a preview branch exists, or inspect FK references in surrounding migrations). The orchestrator runs `git mv <old> <new>` itself; the rename lands in the git index and is picked up by the re-probe at step 5.
|
|
98
|
+
- **Rename main-side (manual, OUT-OF-SKILL)** — only when the main file definitely has not been applied anywhere yet AND the user has write access to `{BASE}`. This skill does NOT touch the main branch: it runs on a feat branch (Step 0 enforces this) and the Key Rules below forbid any push from this skill. The user must, in a separate terminal: `git checkout {BASE} && git mv <old> <new> && git commit -m "fix(migration): rename to resolve collision with feat/..." && git push origin {BASE}`. After that push is confirmed remote-side, re-invoke `/cbp-merge-main` — Step 1 will fetch the updated main tip and Step 1.5 will re-probe with the rename in place.
|
|
99
|
+
- **Defer to a new task in the active checkpoint** — `git merge --abort` is unnecessary because Step 2 has not started. Create a CHK-bound task per `infra-issue-absorption.md` "Resolve-in-Current-Scope by Default" and STOP `/cbp-merge-main`. Resume after the task completes.
|
|
100
|
+
- **Abort merge** — STOP the skill. User decides later.
|
|
101
|
+
|
|
102
|
+
5. After any HEAD-side rename action, re-execute Step 1.5 (collisions may chain — fixing one can expose another). The HEAD-side probe at step 1 uses `git ls-files` rather than `git ls-tree HEAD`, so the freshly-staged `git mv` is visible without requiring a commit. Main-side renames require a fresh `/cbp-merge-main` invocation (the user manually fetched and re-ran per option 2 above), not an in-skill loop.
|
|
103
|
+
|
|
104
|
+
This check is intentionally placed BEFORE Step 2's `git merge`: catching collisions pre-merge means no merge commit to revert, no conflict-resolution work to throw away, no Supabase Preview poll to fail.
|
|
105
|
+
|
|
106
|
+
### Step 2: Merge with `--no-ff --no-commit`
|
|
107
|
+
|
|
108
|
+
1. Run:
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
git merge origin/{BASE} --no-ff --no-commit
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`--no-commit` defers the merge commit so Step 3 can resolve conflicts before committing (or `git merge --abort` if the user cancels). NEVER use `--ff-only` or rebase semantics — per locked decision.
|
|
115
|
+
|
|
116
|
+
2. If git reports `Automatic merge went well; stopped before committing as requested.` (no conflicts):
|
|
117
|
+
- Commit the merge: `git commit --no-edit` (uses git's default merge message). If that fails (e.g. no MERGE_MSG template), fall back to: `git commit -m "chore(merge): integrate origin/{BASE} into {CURRENT}"`.
|
|
118
|
+
- Skip to Step 4.
|
|
119
|
+
|
|
120
|
+
3. If conflicts: continue to Step 3.
|
|
121
|
+
|
|
122
|
+
### Step 3: Interactive Per-Conflict Resolution
|
|
123
|
+
|
|
124
|
+
1. List conflicted files and lock the count: `N=$(git diff --name-only --diff-filter=U | wc -l)`. `N` is the canonical conflict count used by Step 3.5 fallback message and Step 5 output; it stays fixed at the initial value across loop-backs.
|
|
125
|
+
|
|
126
|
+
2. Load cross-reference context. Via MCP, gather all active CHK/TASK file ownership:
|
|
127
|
+
- `get_checkpoints(repo_id)` filtered to `status IN ('pending', 'active', 'in_progress')`.
|
|
128
|
+
- For each active checkpoint, also call `get_tasks(checkpoint_id)` and collect every `task.files_changed[].path` — checkpoint-bound task file ownership lives here, NOT on the checkpoint itself.
|
|
129
|
+
- `get_tasks(repo_id, standalone: true)` filtered to `status IN ('pending', 'in_progress')` — adds standalone-task file ownership.
|
|
130
|
+
|
|
131
|
+
Build a map `path -> [referencing CHK-NNN TASK-N + brief context]` by matching each conflicted path against:
|
|
132
|
+
- `checkpoint.context.files_to_change[]` (checkpoint-level plan)
|
|
133
|
+
- `task.files_changed[].path` (both checkpoint-bound AND standalone task file ownership)
|
|
134
|
+
- `task.requirements` (substring match for the path)
|
|
135
|
+
|
|
136
|
+
3. For each conflicted file, IN ORDER:
|
|
137
|
+
|
|
138
|
+
a. Show:
|
|
139
|
+
- Conflicted file path
|
|
140
|
+
- `BEHIND` / `AHEAD` summary
|
|
141
|
+
- Cross-reference matches (`This file is referenced by CHK-NNN TASK-N: <brief>`)
|
|
142
|
+
- A unified diff of the conflict markers (`git diff -- {path}`)
|
|
143
|
+
|
|
144
|
+
b. Surface AskUserQuestion with these options. The "Recommended" tag is computed from cross-reference data:
|
|
145
|
+
- **Take ours (feat branch)** — `git checkout --ours {path} && git add {path}`.
|
|
146
|
+
Recommended when the path appears in any active CHK/TASK files_changed (the feat branch's work owns this file).
|
|
147
|
+
- **Take theirs (main)** — `git checkout --theirs {path} && git add {path}`.
|
|
148
|
+
Recommended when the path is NOT referenced by any active CHK/TASK (main's evolution wins by default).
|
|
149
|
+
- **Manual edit** — pause the skill. Prompt: `Edit {path} to resolve, then reply 'done' to continue.` Wait. After 'done': run `grep -l '<<<<<<<' {path}` — if it matches, the file still has conflict markers; surface the same prompt again. When clean: `git add {path}` and move on.
|
|
150
|
+
- **Show full diff** — print `git diff -- {path}` (working copy vs HEAD). For per-side views, run each separately (the `--base` / `--ours` / `--theirs` flags are mutually exclusive — combining them in one `git diff` invocation is invalid): `git diff --base -- {path}` (ancestor), `git diff --ours -- {path}` (HEAD), `git diff --theirs -- {path}` (MERGE_HEAD). After printing, RE-ASK the question — this option is meta and does not progress.
|
|
151
|
+
|
|
152
|
+
c. **Deliberate override of `[[feedback_claude-dir-wholesale-on-merge]]`**: that auto-memory rule recommended a wholesale `.claude/` overwrite for one-off long-lived-branch migrations. THIS skill is the routine periodic-sync mechanism, and the user explicitly chose per-conflict review for ALL paths including `.claude/`. Do NOT add a `.claude/`-wholesale shortcut. If a future maintainer is tempted to optimize by re-introducing the wholesale rule, the comment in this step is the contract: per-conflict review is the policy.
|
|
153
|
+
|
|
154
|
+
4. After all conflicts resolved, verify clean: `git diff --name-only --diff-filter=U` MUST return empty. If not, loop back to step 3 with the remaining conflicts.
|
|
155
|
+
|
|
156
|
+
5. Commit the merge:
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
git commit --no-edit
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
If that fails (e.g. no merge message template), fall back to explicit message:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
git commit -m "chore(merge): integrate origin/{BASE} into {CURRENT} (resolved {N} conflicts)"
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Step 4: Inline Automated QA Re-run
|
|
169
|
+
|
|
170
|
+
Run a scoped subset of the testing-qa check matrix INLINE (no agent spawn — this skill stays lightweight):
|
|
171
|
+
|
|
172
|
+
1. `pnpm -w lint` — always. On non-zero exit, surface stdout/stderr and AskUserQuestion:
|
|
173
|
+
- **Continue (commit-as-is)** — leave the merge committed; flag QA failure in output.
|
|
174
|
+
- **Abort merge** — `git reset --hard HEAD~1` to revert just the merge commit. Stop the skill.
|
|
175
|
+
- **Skip (mark warn)** — leave the merge committed; treat as warn, not fail.
|
|
176
|
+
|
|
177
|
+
2. `pnpm exec tsc --noEmit` — only if any merged file matches `*.ts` or `*.tsx`. Same three-option prompt on failure.
|
|
178
|
+
|
|
179
|
+
3. `pnpm test --run` — only if any merged file matches typical source globs (`src/**`, `apps/**/src/**`, `packages/**/src/**`). Same three-option prompt on failure.
|
|
180
|
+
|
|
181
|
+
4. Build a `qa_summary` object:
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
{
|
|
185
|
+
"lint": "pass" | "fail" | "warn" | "skipped",
|
|
186
|
+
"tsc": "pass" | "fail" | "warn" | "skipped",
|
|
187
|
+
"tests": "pass" | "fail" | "warn" | "skipped",
|
|
188
|
+
"merged_files_count": N,
|
|
189
|
+
"user_choice_on_failure": "continue" | "abort" | "skip" | null
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Do NOT auto-revert without user consent. User-driven gating is the contract.
|
|
194
|
+
|
|
195
|
+
### Step 5: Output
|
|
196
|
+
|
|
197
|
+
Print:
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
## /cbp-merge-main complete
|
|
201
|
+
|
|
202
|
+
**Merged**: origin/{BASE} → {CURRENT}
|
|
203
|
+
**Commits pulled in**: {BEHIND}
|
|
204
|
+
**Conflicts resolved**: {N}
|
|
205
|
+
**QA**: {pass|warn|fail} ({passed}/{total})
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Return control to the caller. **This skill NEVER pushes** — the caller decides when to push (preserves merge-commit review opportunity for the user before it lands on remote).
|
|
209
|
+
|
|
210
|
+
## Key Rules
|
|
211
|
+
|
|
212
|
+
- **Never rebase. Never force-push.** Merge-only via `--no-ff` (per `[[feedback_long-lived-branch-integration]]`).
|
|
213
|
+
- **Never `git stash`** (per `[[feedback_no-git-stash]]`). Dirty tree → commit or cancel.
|
|
214
|
+
- **Per-conflict user prompts — no shortcuts.** Deliberate override of `[[feedback_claude-dir-wholesale-on-merge]]`; that rule was scoped to a one-off migration.
|
|
215
|
+
- **Never push.** Caller pushes after reviewing the merge commit.
|
|
216
|
+
- **Abort on offline.** `git fetch` failure is a hard stop.
|
|
217
|
+
|
|
218
|
+
## Integration
|
|
219
|
+
|
|
220
|
+
- **Triggered by**:
|
|
221
|
+
- `/cbp-task-start` Step 3.6 (optional stale-check: >10 commits behind OR >24h fetch age)
|
|
222
|
+
- `/cbp-task-complete` Step 4.5 (mandatory pre-complete)
|
|
223
|
+
- `/cbp-checkpoint-end` Step 0 (mandatory pre-shipment)
|
|
224
|
+
- User-invocable manually
|
|
225
|
+
- **Reads**: `.codebyplan/git.json`, MCP `get_checkpoints`, MCP `get_tasks`, git state
|
|
226
|
+
- **Writes**: git merge commit (no MCP writes; no remote push)
|
|
227
|
+
- **Spawns**: none (`/cbp-git-commit` is inline-triggered at Step 0 dirty-tree handling)
|
|
228
|
+
- **Network**: contacts `origin` via `git fetch`. Offline = abort.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
scope: org-shared
|
|
3
|
+
name: cbp-round-check
|
|
4
|
+
description: Run automated checks standalone for the current round
|
|
5
|
+
effort: low
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- Re-read this file before executing. Do not rely on memory. -->
|
|
9
|
+
|
|
10
|
+
# Round Check Command
|
|
11
|
+
|
|
12
|
+
Run automated checks independently with mandatory execution. Updates round QA. Hard fails if mandatory checks (build/lint/types) fail.
|
|
13
|
+
|
|
14
|
+
## Instructions
|
|
15
|
+
|
|
16
|
+
### Step 1: Get Current Round
|
|
17
|
+
|
|
18
|
+
Use MCP `get_current_task` to find active task, then `get_rounds` to find the in-progress round.
|
|
19
|
+
|
|
20
|
+
### Step 2: Determine Project Root
|
|
21
|
+
|
|
22
|
+
Find the correct app directory:
|
|
23
|
+
```bash
|
|
24
|
+
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
|
25
|
+
```
|
|
26
|
+
Identify app dir from project structure (e.g., `apps/web/` for Next.js).
|
|
27
|
+
|
|
28
|
+
### Step 3: Execute Mandatory Checks (Hard Fail)
|
|
29
|
+
|
|
30
|
+
For each check, EXECUTE the command and capture stdout + stderr. Log execution status.
|
|
31
|
+
|
|
32
|
+
| Check | Command | Hard Fail |
|
|
33
|
+
|-------|---------|-----------|
|
|
34
|
+
| **Build** | `cd {app_dir} && npm run build 2>&1` | YES |
|
|
35
|
+
| **Lint** | `cd {app_dir} && npm run lint 2>&1` | YES |
|
|
36
|
+
| **Types** | `cd {app_dir} && npx tsc --noEmit 2>&1` | YES |
|
|
37
|
+
|
|
38
|
+
For each:
|
|
39
|
+
- Run the command via Bash tool
|
|
40
|
+
- Log `EXECUTED: <command>` or `FAILED: <command> (exit code: N)`
|
|
41
|
+
- If skipping (infrastructure-only changes): log `SKIPPED: <command> (reason: no app code changed)`
|
|
42
|
+
|
|
43
|
+
### Step 4: Execute Conditional Checks
|
|
44
|
+
|
|
45
|
+
| Check | Command | Condition |
|
|
46
|
+
|-------|---------|-----------|
|
|
47
|
+
| **Tests** | `cd {app_dir} && npx vitest --run 2>&1` | Test files exist |
|
|
48
|
+
| **A11y** | Static check (aria, alt, focus) | UI files changed |
|
|
49
|
+
| **API Health** | `curl -s -o /dev/null -w "%{http_code}" http://localhost:{PORT}/` | API routes changed |
|
|
50
|
+
| **Visual** | Visual check flow (page-map + visual-check) | UI work + dev server running |
|
|
51
|
+
|
|
52
|
+
### Step 5: Analyze Build Output
|
|
53
|
+
|
|
54
|
+
Scan all captured output for:
|
|
55
|
+
- **Warnings** (not just errors)
|
|
56
|
+
- **Deprecation notices** (`grep -i "deprecat"` in output)
|
|
57
|
+
- **Console.log in changed files**: `grep -rn "console\.\(log\|debug\|info\)" {changed_files}` (exclude tests)
|
|
58
|
+
- **Bundle size warnings**
|
|
59
|
+
|
|
60
|
+
### Step 6: Save QA Results
|
|
61
|
+
|
|
62
|
+
Update round QA via MCP `update_round(round_id, qa: ...)`:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"items": [
|
|
67
|
+
{"type": "auto", "check": "build", "status": "pass", "ran_at": "...", "notes": null, "executed": true},
|
|
68
|
+
{"type": "auto", "check": "lint", "status": "fail", "ran_at": "...", "notes": "3 errors", "executed": true},
|
|
69
|
+
{"type": "auto", "check": "types", "status": "pass", "ran_at": "...", "notes": null, "executed": true},
|
|
70
|
+
{"type": "auto", "check": "tests", "status": "skipped", "ran_at": "...", "notes": "no test files", "executed": false}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Step 7: Show Results
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
## Round Check Results
|
|
79
|
+
|
|
80
|
+
| Check | Status | Executed | Notes |
|
|
81
|
+
|-------|--------|----------|-------|
|
|
82
|
+
| Build | pass | yes | - |
|
|
83
|
+
| Lint | fail | yes | 3 errors |
|
|
84
|
+
| Types | pass | yes | - |
|
|
85
|
+
| Tests | skipped | no | no test files |
|
|
86
|
+
| Visual | pass | yes | screenshots saved |
|
|
87
|
+
|
|
88
|
+
### Build Analysis
|
|
89
|
+
- Warnings: [N]
|
|
90
|
+
- Deprecations: [N]
|
|
91
|
+
- Console.logs in code: [N]
|
|
92
|
+
|
|
93
|
+
**Result**: [N] passed, [N] failed, [N] skipped
|
|
94
|
+
**Hard fail**: [yes/no]
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
If hard fail: `Mandatory checks failed. Fix issues before continuing.`
|
|
98
|
+
If soft failures only: `Run /cbp-round-start to trigger auto-fix, or fix manually.`
|
|
99
|
+
|
|
100
|
+
## Integration
|
|
101
|
+
|
|
102
|
+
- **Reads**: MCP `get_current_task`, `get_rounds`
|
|
103
|
+
- **Writes**: MCP `update_round` (qa field)
|
|
104
|
+
- **Standalone**: Can be run independently at any time
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
---
|
|
2
|
+
scope: org-shared
|
|
3
|
+
name: cbp-round-end
|
|
4
|
+
description: Summary wrap-up after testing phase completes
|
|
5
|
+
effort: high
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Round End Command
|
|
9
|
+
|
|
10
|
+
Summary phase — presents what was done, then runs code quality review to catch bugs and logic errors that automated checks miss.
|
|
11
|
+
|
|
12
|
+
**Inline-fallback for any spawn failure**: when `cbp-improve-round` (or any peer agent) fails to spawn, the orchestrator falls through to an inline procedure that produces equivalent (lower-fidelity but valid) output. The contract: detect failure class → record in `round.context.improve_round_findings.spawn_failure` → walk the agent's Phase checklist inline → continue the skill. Same procedure for every failure class (org/billing, monthly Agent cap, provider 5xx, rate limit, context overflow, tool not available). Pre-emptive skip applies when the same class fired on the prior round.
|
|
13
|
+
|
|
14
|
+
See `reference/inline-fallback.md` for full trigger table, procedure, and coverage list.
|
|
15
|
+
|
|
16
|
+
## Pipeline
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
/cbp-round-execute → /cbp-round-end → [code review + user decisions] → /cbp-round-update
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Identifier Notation
|
|
23
|
+
|
|
24
|
+
This skill operates on the **active** task/round resolved via MCP `get_current_task` / `get_rounds` and does not accept a positional identifier argument. Canonical chk-task-round notation — used in prose, error messages, and cross-references — follows `.claude/rules/notation-consistency.md` "CHK / TASK / ROUND Identifier Notation": `108-1` (CHK-108 TASK-1), `45` (standalone TASK-45), `108-1-2` (round 2 of CHK-108 TASK-1), `45-2` (round 2 of standalone TASK-45).
|
|
25
|
+
|
|
26
|
+
## Instructions
|
|
27
|
+
|
|
28
|
+
### Step 1: Get Current Task and Round
|
|
29
|
+
|
|
30
|
+
Use MCP `get_current_task` with repo_id (pass `checkpoint_id` if known to avoid disambiguation) to find the active task.
|
|
31
|
+
Use MCP `get_rounds` for the task to find the in-progress round.
|
|
32
|
+
|
|
33
|
+
Load round context with all outputs (executor_output, testing_qa_output, reviewer_output).
|
|
34
|
+
|
|
35
|
+
### Step 2: Collect Files Changed
|
|
36
|
+
|
|
37
|
+
Collect all files changed during this round from:
|
|
38
|
+
|
|
39
|
+
- Work executor output
|
|
40
|
+
- `git diff --name-status HEAD` for final state
|
|
41
|
+
|
|
42
|
+
Build the files list with approval status:
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
[
|
|
46
|
+
{
|
|
47
|
+
"path": "src/file.ts",
|
|
48
|
+
"action": "modified",
|
|
49
|
+
"claude_approved": true,
|
|
50
|
+
"user_approved": false
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**claude_approved**: `true` if cbp-testing-qa-agent passed for this file. `false` if issues remain.
|
|
56
|
+
**user_approved**: Always `false` initially. User approves via git staging or web UI.
|
|
57
|
+
|
|
58
|
+
### Step 3: Collect and Aggregate QA Results
|
|
59
|
+
|
|
60
|
+
**No QA runs here** — all QA was already executed by per-wave `cbp-testing-qa-agent` inside `/cbp-round-execute` Step 5.
|
|
61
|
+
|
|
62
|
+
This step is the **canonical user_qa[] construction site**. cbp-testing-qa-agent and cbp-test-e2e-agent are fully independent producers (no cross-read); cross-source user_qa items that combine signals from multiple producers are built here, at the user-facing boundary. Single-source user_qa items (derivable from one producer's data alone) stay with that producer.
|
|
63
|
+
|
|
64
|
+
#### 3a — Collect single-source items from agent outputs
|
|
65
|
+
|
|
66
|
+
Collect from round context (all three sources are agent-derived):
|
|
67
|
+
|
|
68
|
+
- **Auto items**: from `testing_qa_output.auto_qa.items`
|
|
69
|
+
- **User items (single-source)**: from `testing_qa_output.user_qa.items` (Phase 4b.1 design-source comparison + Phase 4b.2 mechanical-sweep spot-check + Phase 4b.0 connection smoke — all derivable from cbp-testing-qa-agent's own data)
|
|
70
|
+
- **Default items**: from `testing_qa_output.default_checklist.items`
|
|
71
|
+
|
|
72
|
+
#### 3b — Construct cross-source user_qa from frontend_ui_review (NEW)
|
|
73
|
+
|
|
74
|
+
Read `round.context.frontend_ui_review.findings[]` (populated by the `cbp-frontend-ui` skill at `/cbp-round-execute` Step 5b under `phase: 'screenshot_review'`). For each finding, emit a `user_qa` item per the rules below.
|
|
75
|
+
|
|
76
|
+
| Finding `category` | Finding `severity` | Emitted user_qa item |
|
|
77
|
+
|--------------------|-------------------|---------------------|
|
|
78
|
+
| `baseline_regression` | any | `{ type: 'user', check: 'Visual baseline regression — {page_or_screen}', status: 'pending', round_number: N, instructions: 'Open the diff PNG at `{screenshot}` (the `-diff.png` sibling shows pixel differences). Pixel-diff was `{baseline_diff_pct}%`. Decide: (a) regression — add a task to fix, OR (b) new rendering is correct — run `pnpm exec playwright test --update-snapshots` in `apps/{app}` and commit the updated baselines. Do NOT proceed until a decision is recorded.' }` |
|
|
79
|
+
| `rendered_visual` | `critical` | `{ type: 'user', check: 'Rendered-visual critical — {page_or_screen}', status: 'pending', round_number: N, instructions: 'Open the screenshot at `{screenshot}`. The cbp-frontend-ui review flagged a critical rendering issue: `{finding.issue}`. Suggested fix: `{finding.suggestion}`. Decide whether this needs a fix-round before proceeding.' }` |
|
|
80
|
+
| `rendered_visual` | `warning` | (no user_qa item; finding stays in `frontend_ui_review.findings` and surfaces via Step 7 findings presentation if relevant) |
|
|
81
|
+
| Other categories | any | (no user_qa item from this step) |
|
|
82
|
+
|
|
83
|
+
Skip Step 3b entirely when `round.context.frontend_ui_review` is absent (no e2e ran, or screenshot-review phase didn't execute).
|
|
84
|
+
|
|
85
|
+
This is the required user gate for baseline updates — baselines are NEVER auto-accepted.
|
|
86
|
+
|
|
87
|
+
#### 3c — Merge
|
|
88
|
+
|
|
89
|
+
Combine the single-source items (3a) and cross-source items (3b) into a single `user_qa[]` for the round. Merge with previous rounds (supersede items for re-modified files, preserve verified items).
|
|
90
|
+
|
|
91
|
+
### Step 4: Update Task Files and QA
|
|
92
|
+
|
|
93
|
+
Update via MCP:
|
|
94
|
+
|
|
95
|
+
- `update_task(task_id, files_changed: [...])` — merge with existing
|
|
96
|
+
- `update_round(round_id, files_changed: [...], qa: {items: [...]})` — round-specific
|
|
97
|
+
- `update_task(task_id, qa: {items: [...]})` — aggregated
|
|
98
|
+
|
|
99
|
+
### Step 5: Present Summary
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
## Round [N] Complete - Ready for Review
|
|
103
|
+
|
|
104
|
+
### Work Done
|
|
105
|
+
[Brief summary from executor_output]
|
|
106
|
+
|
|
107
|
+
### Files Changed ([N] files, [N] need approval)
|
|
108
|
+
| File | Action | Claude | User |
|
|
109
|
+
|------|--------|--------|------|
|
|
110
|
+
| src/file.ts | modified | approved | pending |
|
|
111
|
+
|
|
112
|
+
### Auto Checks
|
|
113
|
+
| Check | Status |
|
|
114
|
+
|-------|--------|
|
|
115
|
+
| Build | pass |
|
|
116
|
+
| Lint | pass |
|
|
117
|
+
| Types | pass |
|
|
118
|
+
| Tests | pass/skipped |
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Step 6: Spawn Code Quality Review
|
|
122
|
+
|
|
123
|
+
Spawn `cbp-improve-round` agent via Agent tool with:
|
|
124
|
+
|
|
125
|
+
```yaml
|
|
126
|
+
input:
|
|
127
|
+
repo_id: [from config]
|
|
128
|
+
task: {id, title, requirements, context}
|
|
129
|
+
round: {id, number, requirements, files_changed, context}
|
|
130
|
+
project_path: [working directory]
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Wait for agent to complete. If the spawn fails for any reason, apply the inline-fallback procedure documented in `reference/inline-fallback.md` (record `round.context.improve_round_findings.spawn_failure`, walk the agent's Phase checklist inline, continue the skill).
|
|
134
|
+
|
|
135
|
+
### Step 7: Present Findings
|
|
136
|
+
|
|
137
|
+
**If `status: 'no_findings'`:** show `### Code Review\nNo issues found. Code looks good.` and skip to Step 8.
|
|
138
|
+
|
|
139
|
+
**If findings exist**, present them grouped by severity (table + per-finding details), then ask the user via AskUserQuestion which to fix: `all`, `1,2` (specific numbers), `none`, or `inline` (only when all findings qualify under the Trivial-Resolution Exception).
|
|
140
|
+
|
|
141
|
+
Example tables and the `inline` option gating spec: see `reference/findings-presentation.md`.
|
|
142
|
+
|
|
143
|
+
### Step 8: Route Based on Decisions
|
|
144
|
+
|
|
145
|
+
**If `round.context.auto_loop_mode === true`** (auto-loop active):
|
|
146
|
+
|
|
147
|
+
- Auto-accept ALL findings into `improve_round_findings[]` regardless of severity (the user opted into the loop).
|
|
148
|
+
- Skip the polish-spiral stop-gate (auto-loop has its own cap-exhausted termination).
|
|
149
|
+
- Skip the user findings-decision prompt.
|
|
150
|
+
- Save findings via `update_round` exactly as in manual mode.
|
|
151
|
+
- Auto-trigger `/cbp-round-update` immediately. round-update Step 6 will decide whether to spawn another round or exit clean (see cbp-round-update SKILL.md Step 6).
|
|
152
|
+
|
|
153
|
+
**Else (manual mode — flag absent or false):**
|
|
154
|
+
|
|
155
|
+
Run the existing flow:
|
|
156
|
+
|
|
157
|
+
1. After round 2+, surface the polish-spiral stop-gate per `polish-spiral-stop-gate.md` (defer-to-followups vs continue).
|
|
158
|
+
2. Surface the findings-decision AskUserQuestion (with optional `inline` per the gating rules in `reference/findings-presentation.md`).
|
|
159
|
+
3. Save accepted/rejected findings to round context via MCP `update_round`:
|
|
160
|
+
```json
|
|
161
|
+
{
|
|
162
|
+
"context": {
|
|
163
|
+
"improve_round_findings": [accepted findings],
|
|
164
|
+
"improve_round_rejected": [rejected findings with user reasons]
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
4. Auto-trigger `/cbp-round-update`. round-update will see unapproved files and route to `/cbp-round-input`; `/cbp-round-input` picks up the findings from round context and includes them in the new round's requirements automatically.
|
|
169
|
+
|
|
170
|
+
## Key Rules
|
|
171
|
+
|
|
172
|
+
- Claude NEVER git adds files — user does code review
|
|
173
|
+
- Auto-triggers `/cbp-round-update` after findings are handled
|
|
174
|
+
- `/cbp-round-end` is auto-triggered by `/cbp-round-execute` (user does not call it directly)
|
|
175
|
+
- Findings are **presented for user decision** — never auto-fix without user consent
|
|
176
|
+
|
|
177
|
+
## Integration
|
|
178
|
+
|
|
179
|
+
- **Triggered by**: `/cbp-round-execute` (auto, after all waves + testing complete)
|
|
180
|
+
- **Reads**: MCP `get_current_task`, `get_rounds`, round context
|
|
181
|
+
- **Writes**: MCP `update_round`, `update_task` (files_changed, qa, findings)
|
|
182
|
+
- **Spawns**: `cbp-improve-round` (code quality review)
|
|
183
|
+
- **Triggers**: `/cbp-round-update` (auto, after findings handled)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Findings Presentation in `/cbp-round-end` Step 7
|
|
2
|
+
|
|
3
|
+
When `improve-round` returns findings, Step 7 presents them grouped by severity and asks the user how to proceed.
|
|
4
|
+
|
|
5
|
+
## Example output
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
### Code Review Findings
|
|
9
|
+
|
|
10
|
+
| # | Severity | Category | File | Issue |
|
|
11
|
+
|---|----------|----------|------|-------|
|
|
12
|
+
| 1 | critical | bug | src/api.ts:42 | Missing null check on user input |
|
|
13
|
+
| 2 | high | logic_error | src/calc.ts:15 | Off-by-one in loop boundary |
|
|
14
|
+
| 3 | medium | edge_case | src/form.ts:88 | Empty array not handled |
|
|
15
|
+
|
|
16
|
+
#### Details
|
|
17
|
+
|
|
18
|
+
**1. Missing null check on user input** (critical)
|
|
19
|
+
[description + suggested fix from agent]
|
|
20
|
+
|
|
21
|
+
**2. Off-by-one in loop boundary** (high)
|
|
22
|
+
[description + suggested fix from agent]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## AskUserQuestion options
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Which findings should be fixed?
|
|
29
|
+
- "all" — fix all findings in a new round
|
|
30
|
+
- "1,2" — fix specific findings by number
|
|
31
|
+
- "none" — skip all, proceed to round-update
|
|
32
|
+
- "inline" — fix in THIS round before proceeding (only offered when all findings qualify under `infra-issue-absorption.md` Trivial-Resolution Exception)
|
|
33
|
+
- Or explain why specific findings are not issues
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## "inline" option gating
|
|
37
|
+
|
|
38
|
+
Only present the "inline" option when ALL pending findings simultaneously satisfy:
|
|
39
|
+
|
|
40
|
+
1. Diff is comment-only, annotation-only, banner-only, or single-value rename — no logic, no control flow
|
|
41
|
+
2. Each fix is under ~5 minutes of executor time
|
|
42
|
+
3. Verification is automatic — the existing test/lint/audit pipeline confirms the change
|
|
43
|
+
|
|
44
|
+
If any finding fails these gates, omit the "inline" option entirely (revert to the 3-option prompt). When inline is chosen, apply the edits via direct `Edit`, re-run the verification commands (hook syntax check + `testing-qa-agent` scoped to modified files) and proceed to `/cbp-round-update` without spawning a new round. Document the decision in `round.context.inline_fix_log = { findings: [ids], rationale: "trivial-resolution exception", applied_at: <ISO> }` (mirrors the `bypass_log` shape from `infra-issue-absorption.md` "Pipeline Bypass for Trivial-Resolution Rounds").
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Inline-Fallback for Any Spawn Failure
|
|
2
|
+
|
|
3
|
+
When `improve-round` (or any agent spawned by this or peer skills) fails to spawn, the orchestrator falls through to an inline procedure that produces equivalent (lower-fidelity but valid) output. Same contract for every failure class — no special-casing per class.
|
|
4
|
+
|
|
5
|
+
## Trigger conditions (any one)
|
|
6
|
+
|
|
7
|
+
| Failure class | Detection signal |
|
|
8
|
+
| ------------------------- | ------------------------------------------------------------------------------------- |
|
|
9
|
+
| Org/billing limit | `API Error: Extra usage is required for 1M context` (the original Proposal U trigger) |
|
|
10
|
+
| Monthly Agent usage cap | `API Error: This conversation has reached the monthly Agent usage limit` or similar |
|
|
11
|
+
| Provider 5xx | Spawn returns `API Error 500` / `502` / `503` — transient or sustained |
|
|
12
|
+
| Rate limit | `API Error 429` with retry hint |
|
|
13
|
+
| Context overflow at spawn | Spawn returns `Context window exceeded` before agent can run |
|
|
14
|
+
| Tool not available | Skill caller's tool surface lacks Agent (rare — only in nested-agent contexts) |
|
|
15
|
+
|
|
16
|
+
## Fallback procedure (uniform across all triggers)
|
|
17
|
+
|
|
18
|
+
1. Note the failure: `agent_spawned: false`, `skip_reason: "<one-line failure class>"`. Save to `round.context.improve_round_findings.spawn_failure = { class, error_message, decided_at }`.
|
|
19
|
+
2. Perform the agent's analysis inline using whatever tools the orchestrator has (typically `Read` + `Bash` grep/find/head + `Glob`/`Grep`). Use the agent's documented Phase checklist as the script — agents are essentially curated checklists; following them inline produces equivalent (lower-fidelity but valid) output.
|
|
20
|
+
3. Record findings in the same shape the agent would have returned (`findings[]` array with `severity`, `category`, `file`, `description`, `suggested_fix`). Mark each with `mode: 'inline_fallback'` so analytics can distinguish.
|
|
21
|
+
4. Continue the skill — do NOT abort the round on spawn failure. The fallback is intended to keep the pipeline moving; aborting would force the user to manually re-run when the same failure will recur.
|
|
22
|
+
|
|
23
|
+
**Pre-emptive skip**: when the same failure class fired in the previous round of the same task, skip the spawn attempt entirely and go straight to inline. This avoids one wasted API call per round during a sustained outage.
|
|
24
|
+
|
|
25
|
+
## Coverage
|
|
26
|
+
|
|
27
|
+
This fallback applies to:
|
|
28
|
+
|
|
29
|
+
- `improve-round` spawned by `/cbp-round-end` (Step 6) — original case
|
|
30
|
+
- `task-planner` spawned by `/cbp-round-start` Step 7 — orchestrator falls back to inline planning using the planner's Phase checklist
|
|
31
|
+
- `testing-qa-agent` spawned by `/cbp-round-execute` Step 5 (per-wave) — orchestrator runs build/lint/types/tests inline via Bash and aggregates results in the agent's output shape
|
|
32
|
+
- `task-check` spawned by `/cbp-task-check` skill — orchestrator walks the agent's verdict checklist inline
|
|
33
|
+
- `improve-claude` spawned by its caller (when re-enabled) — orchestrator walks the agent's Phase 0-7 inline
|
|
34
|
+
|
|
35
|
+
For details, each spawning skill carries a brief "Inline fallback" section pointing back to this contract. The canonical reference is here.
|